Repository navigation
@tanstack/ai-code-mode@1.0.0
Major Changes
- #1840
f1b3f65- TanStack AI 1.0.0. This release removes every API that was deprecated in 0.x. Read the upgrade guide before you upgrade: https://tanstack.com/ai/latest/docs/migration/v1- Removed all
@deprecatedexports, options, fields, and type aliases. Each one has a replacement that already shipped in 0.x. - Removed
addToolApprovalResponse()fromChatClientand every chat hook. Resolve the boundtool-approvalinterrupt withresolveInterruptinstead. The devtools eventtools:approval:respondedis also removed. - Removed the old wire formats: the CUSTOM
approval-requestedandtool-input-availableevents, the[DONE]SSE line, thedatacopy offorwardedProps, pre-binding interrupt descriptors and theirapproval_requiredandclient_tool_inputreasons, and the STEP events that adapters sent next toREASONING_*events. Use a 1.0 client with a 1.0 server. - Removed the
toolNamealias fromTOOL_CALL_STARTchunks. ReadtoolCallNameinstead. threadIdis now required onuseChatand every other chat hook,ChatClient, the generation hooks and clients,chat(),summarize(), the generation functions,codeModeWithSnippets(),selectRelevantSnippets(),CompactionContext, andSummarizeInput. TanStack AI no longer makes a thread id for you. Pass a stable id for each conversation.createChatHookfactory options no longer takethreadId: pass it on each hook call. Octane generation hooks takethreadIdinstead ofid.@tanstack/ai-sandboxremovesresolveDurableThreadIdandDurableThreadIdRequiredError.- The published
@tanstack/ai-octane/uitypes are now strict.UI.Messages,UI.Message,UI.Part, andUI.Interruptstype their render children.ToolPropstypespart.inputandpart.outputfor the named tool.toolsComponentsandinterruptsComponentsare required when the chat options declare tools or named interrupts. Code that relied on the old loose types can fail to compile. - A connection adapter's
connect()andsend()need the run context (withthreadId) as their fourth argument.ChatClientand the generation clients pass it. @tanstack/ai-sandbox:createToolBridgeCore(),startHostToolBridge(), aToolBridgeProvisioner, andexecuteHostTool()take a requiredthreadId. Bridged tools get it in their context.@tanstack/ai-sandbox: the harness tool bridge andexecuteHostTool()refuse a tool withneedsApproval. Before, the tool ran with no approval. RemoveneedsApproval, or run the tool with an HTTP adapter.stream()andrpcStream()pass the AG-UIRunAgentInputfor the run as the fourth factory argument, the same body the HTTP adapters send. Read it on the server withchatParamsFromRequestBody()orgenerationParamsFromBody(), sothreadId,runId, and interruptresumereach a server function.RunAgentInputis exported from@tanstack/ai/client.- A generation
fetchergetsthreadIdandrunIdin its second argument, next tosignalandheaders. Pass them to the server generation call. generationParamsFromBody()andgenerationParamsFromRequest()read the generation input fromforwardedProps. A server that readsbody.datagetsundefined. Readbody.forwardedPropsinstead. They also requirethreadIdandrunIdand return them as strings, the same aschatParamsFromRequestBody()and the AG-UIRunAgentInput. A body that holds only the input is rejected.- Removed the readers for data saved in old 0.x formats (old Cloudflare run-log records, a bare
UIMessage[]from client persistence, artifact records withoutblobKey). - Removed provider models that are shut down.
@tanstack/ai-react-ui,@tanstack/ai-solid-ui, and@tanstack/ai-vue-uiget no 1.0 release. Import from@tanstack/ai-react/ui,@tanstack/ai-solid/ui, or@tanstack/ai-vue/ui.
- Removed all
Minor Changes
-
#1755
39c1c79- Add@tanstack/ai-code-mode/harnesswithcodeMode({ driver }): a harness plugin that gives the model oneexecute_typescripttool. The model writes a program that calls several tools, and the program runs in the isolate of any@tanstack/ai-isolate-*driver.- By default, only tools that are safe to run without a question move into code mode. These are server tools with no
needsApprovaland no permission resources, which the permission rules allow in plan mode. A safe tool withmetadata.codeMode: truealways moves. includepicks more tools, also tools with permission checks, such as the coding toolsread_file,write_file,edit_file,patch,list_files,grep,bash, andwebfetch. Each call of such a tool in a program gets the same decision frompermissions()as a direct call. The call runs, or it throws an error with the reason, or the program waits for the user to approve it. The approval is a question wait thatsession.answeranswers withonce,always, orreject. A program that can wait gets a timeout of 10 minutes by default.- The session log keeps the result of each checked call. After a stop, the next host runs the program again, and a call that finished before the stop does not run twice. A call that the stop cut, and that is not safe to run again, throws in the program.
includenever moves a tool that needs approval, or a tool that the rules deny in the current permission mode. The rules decide again at each turn, so in plan mode the tools that edit stay normal tool calls.directCalls: 'keep'keeps the moved tools in the model's tool list too. The session settingdirectCallschanges it while the session runs.lazy: truelists only the tool names and addsdiscover_tools. A tool name that is not a JavaScript identifier gets a safe name inside the program.
@tanstack/ai-harnessis an optional peer dependency. - By default, only tools that are safe to run without a question move into code mode. These are server tools with no
Patch Changes
-
#1755
39c1c79- Theexecute_typescripttool description and the code-mode system prompt now tell the model that the tool returns{ success, result, logs, error }, whereresultis the value its code returned. -
#1755
39c1c79- Themcp(),codeMode(), andskills()harness plugins send their warnings to the logger of the host (createHarnessHost({ logger })). -
Updated dependencies [
fcbd199,39c1c79,39c1c79,959f43e,a5c2af3,39c1c79,39c1c79,fa2a291,f7e7cce,7a0a48b,468063c,fe83aa0,781a3a8,39abb7e,f1b3f65]:- @tanstack/ai@1.0.0
- @tanstack/ai-harness@0.1.0