- #1555
2d45abdThanks @mattzcarey! - DefaultopenApiMcpServerto the MCP SDK's Workers-safe JSON schema validator so elicitation response validation does not rely on runtime code generation.
- #1547
f739ec9Thanks @mattzcarey! - Dispatch all codemode tool calls positionally and remove provider-levelpositionalArgsconfiguration.
-
#1521
2911baeThanks @mattzcarey! - Preserve binary values across codemode tool calls soUint8Arrayarguments and results survive the sandbox boundary. This fixesstate.writeFileBytes()from codemode with byte arrays and keepsreadFileBytes()results asUint8Arrayvalues. -
#1523
5f1376fThanks @mattzcarey! - Remove the echoed sourcecodefield from codemode tool results. Successful sandbox executions now return only the executionresultand any capturedlogs.
-
#1468
186a2a4Thanks @mattzcarey! - Add a browser-safe codemode export with an iframe sandbox executor and browser tool helper. Harden iframe message handling with nonce-scoped messages, reject sanitized tool name collisions, and keep tools withneedsApproval: false. -
#1470
1033fa2Thanks @mattzcarey! - Resolve OpenAPI specs inside the codemode sandbox to avoid Worker Loader RPC size limits for heavily-referenced specs. -
#1508
13acffeThanks @threepointone! - fix(codemode): harden OpenAPI sandbox ref handling
-
#1266
d5dbf45Thanks @threepointone! - Add optionaldescriptiontocodeMcpServer, matching the existing option oncreateCodeTool. Supports{{types}}and{{example}}placeholders; falls back to the built-in default when omitted. -
c5ca556Thanks @threepointone! - Fix@tanstack/aipeer dependency range from^0.8.0to>=0.8.0 <1.0.0. The caret range for pre-1.0 packages only allows>=0.8.0 <0.9.0, which excluded the current 0.10.0 release.
- #1248
c74b615Thanks @threepointone! - Update dependencies
- #1204
39d8d62Thanks @threepointone! - Unwrap MCP content wrappers incodeMcpServerso sandbox code sees plain values instead of raw{ content: [{ type: "text", text }] }objects. Error responses (isError) now throw proper exceptions catchable via try/catch, andstructuredContentis returned directly when present.
- #1181
e9bace9Thanks @threepointone! - FixcreateCodeTooldroppingpositionalArgsfrom providers, causing multi-argument tool calls (e.g.stateTools) to silently lose arguments after the first.
- #1138
36e2020Thanks @threepointone! - Drop Zod v3 from peer dependency range — now requireszod ^4.0.0. Replace dynamicimport("ai")withz.fromJSONSchema()from Zod 4 for MCP tool schema conversion, removing theairuntime dependency from the agents core. RemoveensureJsonSchema().
-
#1149
47ce125Thanks @threepointone! - feat: add TanStack AI integration (@cloudflare/codemode/tanstack-ai)New entry point for using codemode with TanStack AI's
chat()instead of the Vercel AI SDK'sstreamText().import { createCodeTool, tanstackTools } from "@cloudflare/codemode/tanstack-ai"; import { chat } from "@tanstack/ai"; const codeTool = createCodeTool({ tools: [tanstackTools(myServerTools)], executor }); const stream = chat({ adapter, tools: [codeTool], messages });
Exports:
createCodeTool— returns a TanStack AIServerTool(viatoolDefinition().server())tanstackTools— converts aTanStackTool[]into aToolProviderwith pre-generated typesgenerateTypes— generates TypeScript type definitions from TanStack AI toolsresolveProvider— re-exported framework-agnostic provider resolver
Internal cleanup: extracted
resolveProviderinto a framework-agnosticresolve.tsmodule so the main entry (@cloudflare/codemode) no longer pulls in theaipackage at runtime. Shared constants and helpers moved toshared.tsto avoid duplication between the AI SDK and TanStack AI entry points.
- #1122
a16e74dThanks @threepointone! - AddToolProviderinterface for composing tools from multiple sources into a single codemode sandbox.createCodeToolnow accepts aToolProvider[]alongside raw tool sets. Each provider contributes tools under a named namespace (e.g.state.*,mcp.*) with the default beingcodemode.*. Providers withpositionalArgs: trueuse natural function signatures (state.readFile("/path")) instead of single-object args. The oldexecutor.execute(code, fns)signature is deprecated but still works with a warning.
-
#1114
5d88b81Thanks @mattzcarey! - Add@cloudflare/codemode/mcpbarrel export with two functions:codeMcpServer({ server, executor })— wraps an MCP server with a singlecodetool where each upstream tool becomes a typedcodemode.*methodopenApiMcpServer({ spec, executor, request })— createssearch+executeMCP tools from an OpenAPI spec with host-side request proxying and automatic$refresolution
-
#1113
1264372Thanks @mattzcarey! - Add optionalmodulesoption toDynamicWorkerExecutorOptionsto allow injecting custom ES modules into the sandbox -
#1117
9837adcThanks @mattzcarey! - DynamicWorkerExecutor now normalizes code and sanitizes tool names internally. Users no longer need to callnormalizeCode()orsanitizeToolName()before passing code/fns toexecute().
-
#1102
f07ef51Thanks @mattzcarey! - BREAKING:generateTypesandToolDescriptor/ToolDescriptorstypes are no longer exported from the main entry point. Import them from@cloudflare/codemode/aiinstead:// Before import { generateTypes } from "@cloudflare/codemode"; // After import { generateTypes } from "@cloudflare/codemode/ai";
The main entry point (
@cloudflare/codemode) no longer requires theaiorzodpeer dependencies. It now exports:sanitizeToolName— sanitize tool names into valid JS identifiersnormalizeCode— normalize LLM-generated code into async arrow functionsgenerateTypesFromJsonSchema— generate TypeScript type definitions from plain JSON Schema (no AI SDK needed)jsonSchemaToType— convert a JSON Schema to a TypeScript type declaration stringDynamicWorkerExecutor,ToolDispatcher— sandboxed code executionJsonSchemaToolDescriptor/JsonSchemaToolDescriptors— types for the JSON Schema API
The
aiandzodpeer dependencies are now optional — only required when importing from@cloudflare/codemode/ai.
-
#1092
c2df742Thanks @mattzcarey! - ExportnormalizeCodeutility function for use by consumers that need to normalize user-provided code to async arrow function format before sandbox execution. -
#1074
33b92d5Thanks @mattzcarey! - Removezod-to-tsdependency to reduce bundle size. Zod schemas are now converted to TypeScript strings via JSON Schema using the existingjsonSchemaToTypeString()function and AI SDK'sasSchema().
- #1020
70ebb05Thanks @threepointone! - udpate dependencies
-
#962
ef46d68Thanks @tumberger! - Validate tool arguments against Zod schema before execution in codemode sandbox -
#973
969fbffThanks @threepointone! - Update dependencies -
#960
179b8cbThanks @mattzcarey! - Harden JSON Schema to TypeScript converter for production use- Add depth and circular reference guards to prevent stack overflows on recursive or deeply nested schemas
- Add
$refresolution for internal JSON Pointers (#/definitions/...,#/$defs/...,#) - Add tuple support (
prefixItemsfor JSON Schema 2020-12, arrayitemsfor draft-07) - Add OpenAPI 3.0
nullable: truesupport across all schema branches - Fix string escaping in enum/const values, property names (control chars, U+2028/U+2029), and JSDoc comments (
*/) - Add per-tool error isolation in
generateTypes()so one malformed schema cannot crash the pipeline - Guard missing
inputSchemaingetAITools()with a fallback to{ type: "object" } - Add per-tool error isolation in
getAITools()so one bad MCP tool does not break the entire tool set
-
#961
f6aa79fThanks @mattzcarey! - Updated default tool prompt to explicitly request JavaScript code from LLMs, preventing TypeScript syntax errors in the Dynamic Worker executor.
-
#879
90e54daThanks @mattzcarey! - Remove experimental_codemode() and CodeModeProxy. Replace with createCodeTool() from @cloudflare/codemode/ai which returns a standard AI SDK Tool. The package no longer owns an LLM call or model choice. Users call streamText/generateText with their own model and pass the codemode tool.The AI-dependent export (createCodeTool) is now at @cloudflare/codemode/ai. The root export (@cloudflare/codemode) contains the executor, type generation, and utilities which do not require the ai peer dependency.
ToolDispatcher (extends RpcTarget) replaces CodeModeProxy (extends WorkerEntrypoint) for dispatching tool calls from the sandbox back to the host. It is passed as a parameter to the dynamic worker's evaluate() method instead of being injected as an env binding, removing the need for CodeModeProxy and globalOutbound service bindings. Only a WorkerLoader binding is required now. globalOutbound on DynamicWorkerExecutor defaults to null which blocks fetch/connect at the runtime level. New Executor interface (execute(code, fns) => ExecuteResult) allows custom sandbox implementations. DynamicWorkerExecutor is the Cloudflare Workers implementation. Console output captured in ExecuteResult.logs. Configurable execution timeout.
AST-based code normalization via acorn replaces regex. sanitizeToolName() exported for converting MCP-style tool names to valid JS identifiers.
- #954
943c407Thanks @threepointone! - update dependencies
- #916
24e16e0Thanks @threepointone! - Widen peer dependency ranges across packages to prevent cascading major bumps during 0.x minor releases. Mark@cloudflare/ai-chatand@cloudflare/codemodeas optional peer dependencies ofagentsto fix unmet peer dependency warnings during installation.
-
#849
21a7977Thanks @Muhammad-Bin-Ali! - Allow configurable model inexperimental_codemodeinstead of hardcodedgpt-4.1 -
#859
3de98a3Thanks @threepointone! - broaden peer deps -
#865
c3211d0Thanks @threepointone! - update dependencies
-
#813
7aebab3Thanks @threepointone! - update dependencies -
#800
a54edf5Thanks @threepointone! - Update dependencies -
#818
7c74336Thanks @threepointone! - update dependencies -
Updated dependencies [
0c3c9bb,0c3c9bb,d1a0c2b,6218541,6218541,6218541,6218541,fd79481,6218541,0c3c9bb,6218541,6218541,e20da53,f604008,7aebab3,a54edf5,7c74336,6218541,ded8d3e]:- agents@0.3.7
-
#776
93c613eThanks @ShoeBoom! - prepend custom prompt to default assistant text -
Updated dependencies [
395f461,f27e62c]:- agents@0.3.6
-
#771
87dc96dThanks @threepointone! - update dependencies -
Updated dependencies [
cf8a1e7,87dc96d]:- agents@0.3.4
-
a5d0137Thanks @threepointone! - trigger a new release -
Updated dependencies [
a5d0137]:- agents@0.3.3
-
#756
0c4275fThanks @threepointone! - feat: split ai-chat and codemode into separate packagesExtract @cloudflare/ai-chat and @cloudflare/codemode into their own packages with comprehensive READMEs. Update agents README to remove chat-specific content and point to new packages. Fix documentation imports to reflect new package structure.
Maintains backward compatibility, no breaking changes.
-
Updated dependencies [
0c4275f,f12553f]:- agents@0.3.2