Agent files are minified before execution: errors name esbuild temporaries and unnamed nodes take mangled names
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 205
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 92
Description
`dev/src/utils/agent_loader.ts:202` sets `minify: this.options.bundle` (default `true`) with no `keepNames` and no `sourcemap`. Two consequences: every runtime error out of user node code names a one-letter esbuild temporary, and `node(fn)` without `{name}` adopts the mangled `Function.prototype.name` as the node's public identity — which is what the CLI prints as the author and what `event.author` / `nodeInfo.path` carry over HTTP.
```bash
cd dev
npx adk api_server ../samples/workflows/routes -p 8123 &
curl -s -X POST localhost:8123/apps/function_node/users/u1/sessions/s1 -H 'Content-Type: application/json' -d '{}'
curl -s -X POST localhost:8123/run -H 'Content-Type: application/json' \
-d '{"appName":"function_node","userId":"u1","sessionId":"s1","newMessage":{"role":"user","parts":[{"inlineData":{"mimeType":"image/png","data":"aGk="}}]}}'
# {"error":"Failed to run agent: TypeError: e.toUpperCase is not a function"}
# source is samples/workflows/routes/function_node/agent.ts:42 -> nodeInput.toUpperCase()
```
```ts
// /tmp/a.ts — the dynamic/nodes sample minus the {name} option
const helloNode = node(function myFunctionNode(_ctx, x) { return `Hello ${x}`; });
// npx adk run /tmp/a.ts -> [pjr]: Hello x (expected [myFunctionNode]:)
// direct `tsx` import of the same file derives "myFunctionNode" correctly
```
Likely `keepNames: true` (plus `sourcemap: 'inline'` for stack frames). The documented escape hatch `--bundle false` is itself broken (filed separately).
Contributor guide
Assessment
This issue has not been assessed yet.