Skip to content

CodeAct sandbox graph builder runs on the shared graph DSL core - #4782

Merged
georgi merged 1 commit into
mainfrom
claude/codeact-js-nodetool-dsl-p5riib
Aug 8, 2026
Merged

CodeAct sandbox graph builder runs on the shared graph DSL core#4782
georgi merged 1 commit into
mainfrom
claude/codeact-js-nodetool-dsl-p5riib

Conversation

@georgi

@georgi georgi commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What

nodetool.graph() in the CodeAct sandbox and the GraphPlanner's submit_graph DSL were two hand-rolled graph-building implementations with divergent semantics: incompatible handle shapes (__ntOutput/node/slot vs __handle/source/sourceHandle), different auto-id schemes (stringinput_1 vs string_input), and the sandbox builder missing the DSL's guards. This extracts one guest-side core — packages/agents/src/graph-dsl-core.ts (__graphDslBuilder) — and rebuilds both surfaces on it, so a wiring fix lands in both and the two DSLs cannot drift.

Validation the sandbox builder gains

  • Handle-in-string guard: interpolating ref.output() into a string used to silently wire nothing and leave "[object Object]" in a property — a broken graph that only failed downstream. It now throws at the point of the mistake (Symbol.toPrimitive guard, previously planner-only).
  • connect() id checks: connecting to an id the graph does not have now throws naming the known ids, instead of producing a dangling edge caught only by validate_workflow.
  • node(type, props) argument validation and a required non-empty targetHandle on connect().
  • Snake_case auto ids (text_to_image, text_to_image_2) — the planner DSL's readable scheme replaces the builder's texttoimage_2.

The planner DSL gains the duplicate-explicit-id check the builder already had. The sandbox layer keeps only what needs the toolbelt: validate(), save(), and the save-and-run run().

Succinctness

The planner's GRAPH_DSL_PRELUDE shrinks to a thin wrapper (node()/graph() over one core builder), and nodetool-api.ts drops its ~150-line duplicate builder. Sandbox refs and planner refs now share one shape (both carry .set(), .properties, interchangeable handles), and the graph-namespace prompt section documents the new build-time checks in two lines.

Tests

  • tests/graph-dsl.test.ts: +2 (interpolated-handle refusal, duplicate explicit id); existing id-scheme and wiring tests pass unchanged.
  • tests/nodetool-api.test.ts: +1 (build-time wiring validation: interpolation guard, unknown connect() target, bad type, snake_case ids).
  • Full packages/agents suite: 150 files, 2132 passed. npm run lint clean; npm run typecheck clean for web and electron (mobile has no dependency tree in this container — pre-existing, unrelated).

Also syncs the agents package's stale package-lock.json entry with its package.json (@napi-rs/canvas, @nodetool-ai/image-editor), which was breaking clean installs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QJiThBaVnDxz4ipkQuGdd7


Generated by Claude Code

nodetool.graph() in the CodeAct sandbox and the GraphPlanner's
submit_graph programs were two hand-rolled graph DSLs with divergent
semantics: different handle shapes, different auto-id schemes, and the
sandbox builder missing the DSL's guards. Extract one guest-side core
(src/graph-dsl-core.ts) and rebuild both surfaces on it.

The sandbox builder gains the DSL's validation: node(type, props)
argument checks, snake_case auto ids, connect() refusing an id the graph
does not have, and handles that throw when interpolated into a string
instead of silently wiring nothing and leaving "[object Object]" in a
property. The planner DSL gains the duplicate-explicit-id check. The
sandbox layer keeps only the tool-backed methods (validate/save/run).

Also sync the agents package's stale package-lock entry with its
package.json (@napi-rs/canvas, @nodetool-ai/image-editor).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJiThBaVnDxz4ipkQuGdd7
@georgi
georgi enabled auto-merge (squash) August 8, 2026 11:33
@georgi
georgi merged commit 8cdf606 into main Aug 8, 2026
25 checks passed
@georgi
georgi deleted the claude/codeact-js-nodetool-dsl-p5riib branch August 8, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants