feat(ai-code-mode, ai-harness): code mode for harnesses with pluggable isolates - #1524
AlemTuzlak wants to merge 6 commits into
Conversation
…luggable isolates
…' into feat/harness-p8-code-mode
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: TanStack/ai/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 74925e5
☁️ Nx Cloud last updated this comment at |
…' into feat/harness-p8-code-mode
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-cloudflare
@tanstack/ai-code-mode
@tanstack/ai-code-mode-snippets
@tanstack/ai-codex
@tanstack/ai-cohere
@tanstack/ai-compaction
@tanstack/ai-dashboard
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-harness
@tanstack/ai-harness-cli
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-daytona
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-isolate-quickjs-bun
@tanstack/ai-llmgateway
@tanstack/ai-lovable
@tanstack/ai-mcp
@tanstack/ai-memory
@tanstack/ai-mistral
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-perplexity
@tanstack/ai-persistence
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-reactor
@tanstack/ai-remix
@tanstack/ai-sandbox
@tanstack/ai-sandbox-blaxel
@tanstack/ai-sandbox-boxd
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-e2b
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-upstash-box
@tanstack/ai-sandbox-vercel
@tanstack/ai-skills
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-typesafe
@tanstack/ai-utils
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/ai-worldlabs
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
@tanstack/svelte-ai-devtools
commit: |
…' into feat/harness-p8-code-mode
…' into feat/harness-p8-code-mode
…' into feat/harness-p8-code-mode
Add
codeMode({ driver })to a harness, and the model gets oneexecute_typescripttool. It writes one TypeScript program that calls several tools, and the program runs in the isolate you pick: QuickJS, Node, Cloudflare, or Daytona. Read-only tools move into code mode, including MCP tools found after/connect. Tools that need approval stay normal tool calls.Stacked on #1523 (Phase 7) → #1522 → #1521 → #1520 → #1519 → #1518 → #1515 → #1513 → #1509. Merge those first.
🎯 Changes
codeModeat@tanstack/ai-code-mode/harness: a harness plugin.drivertakes any@tanstack/ai-isolate-*driver. The othercreateCodeModeoptions pass through.executethat do not setneedsApprovaland that the permission rules allow in plan mode (file reads, read-only MCP tools).includepicks the tools yourself. A call inside the isolate does not stop for approval, so edits and commands stay out.notion-searchare not JavaScript identifiers. The plugin gives code mode a copy namednotion_search. If two names clash, the second tool stays a direct tool.prepareToolsplugin hook in@tanstack/ai-harness: change the tool list of each turn, afterdiscoverToolsand before prompts resolve.PermissionRulesanddecidePermissionare also exported from the@tanstack/ai-harnessroot, because./pluginsis Node only and code mode stays edge-safe.examples/harness-cliturns on code mode with the QuickJS driver.docs/harness/code-mode.md(new). Changeset: ai-code-mode, ai-harness (minor).✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.docs/for this change, or this change is not user-facing.pnpm changeset), or this PR does not change a published package.🚀 Release Impact
Testing
Commands run (not the full
pnpm test:pr, see below):@tanstack/ai-code-mode:vitest run(153 passed),test:types,publint --strict. New:tests/harness.test.ts(tools move behindexecute_typescript, discovered MCP tools included, approvals and edits kept,include, no match, safe names and clashes).@tanstack/ai-harness:vitest run(147 passed),test:types. New:tests/prepare-tools.test.ts.examples/harness-cli:tsc --noEmit.kiira check docs/harness/code-mode.md,oxfmt,oxlinton the changed files.pnpm test:prbecause it is slow on this machine. CI runs it. No new E2E test: the tests use a stand-in isolate, and the manual run below used the real QuickJS driver.Manual test (done with real accounts)
.env,/connect linear,/connect notion).in one execute_typescript program, list my Linear issues and search Notion for "Teams CLI", then summarize.external_linear_list_issuesandexternal_notion_notion_search, and the answer used both results.How this PR makes testing easy
packages/ai-code-mode/tests/harness.test.tsandpackages/ai-harness/tests/prepare-tools.test.ts.examples/harness-cliruns code mode with the QuickJS driver.Risk / rollback
Low. A new subpath and a new plugin hook. Code mode is opt-in. Revert the PR to undo.
Public API change
Before
After
🤖 Generated with Claude Code
https://claude.ai/code/session_01APYv1qshKyjPPpkFyRZhfZ