Skip to content

feat(agents): agent tools as a Lifecycle capability with parent and child roles - #2227

Closed
mattzcarey wants to merge 13 commits into
mainfrom
feat/agent-tools-capability
Closed

mattzcarey wants to merge 13 commits into
mainfrom
feat/agent-tools-capability

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Extracts the agent-tool engine out of Agent, Think and AIChatAgent into one capability, agents/agent-tools, with a parent role (AgentTools) and a child role (AgentToolsChild). Public API, hooks, wire frames and the React hook are unchanged. Design spec: agent tools were the one concern in the two big classes that crosses Durable Object boundaries with a contract the base class dictates, so both chat harnesses had to re-implement the same ~700 lines of child side, ~85% of it verbatim.

Sizes: Agent −2.4k lines, Think −0.7k, AIChatAgent −0.7k. The capability is ~4.3k lines including the child role.

What moved where

  • Parent role (AgentTools, installed by Agent as this.agentTools): dispatch, cf_agent_tool_runs under its own schema key, chunk forwarding, detached fast path, startup reattach and reconcile, replay on connect. runAgentTool and friends are one-line facades. The hooks and the three protected seams (_runDetachedDelivery, _onAgentToolStreamProgress, _deliverDetachedMilestone) stay on Agent so subclass overrides keep working. Host bindings arrive through setAgentToolsHost, the same WeakMap aperture shape as setSchedulerCallbackResolver.
  • Child role (AgentToolsChild, installed by Think and AIChatAgent as this.agentToolsChild): child-run and milestone tables, the five adapter methods the parent calls over RPC, progress, tail, stale-run reconcile. Bound through setAgentToolsChildHost. Think's schema is canonical plus AIChatAgent's input_json and its request_id index. AIChatAgent's legacy tables fold in on first wake.
  • Detached backbone is a singleflight Lifecycle job with a fixed id, re-pushed at the 5/15/30/120s cadence while runs are outstanding. The self-scheduling _cfDetachedReconcileTick schedule, its listing/dedupe and the in-isolate arming mutex are gone. Tests observe it through agentTools.pendingDetachedReconcile().
  • Chunk attribution is an explicit observeChunk / observeError tap from each harness's single frame sender (_broadcastChat, _broadcastChatMessage). The broadcast() override, the idle guard, the JSON parse of every outgoing frame and the leaky negative cache are deleted, along with interceptAgentToolBroadcast in agents/chat.
  • Any Agent subclass can now be a child; documented in docs/agents/agent-tools.md.

The capability's public surface

AgentTools exposes operations only: run, cancel, has, clear, replayToConnection, recoveryRunIds, scheduleStartupRecovery, reconcile, hasOutstandingDetachedRuns, pendingDetachedReconcile, armDetachedBackbone, reconcileTick (plus the onStart / onJob Lifecycle hooks). The storage and streaming internals — readRun, resultFromRow, updateTerminal, deliverDetachedTerminal, reattachToTerminal, forwardStream, broadcastStoredChunksFromAdapter, runDeferredFinishHooks — are private; deferred finish hooks are drained inside scheduleStartupRecovery, their only caller. reconcile stays public as a legitimate "recover now" operation and says so in its doc comment.

Nothing is exposed for tests. The faults the Think and ai-chat test workers used to inject by monkey-patching those seams now act at a boundary the capability already depends on: a scripted CHILD adapter installed through the host port (getAgentToolsHost is exported next to setAgentToolsHost so a host — or a test — can re-install a wrapped port), driven through a public operation (reconcile for recovery seals, reconcileTick for detached delivery, run for live forwarding). Parent rows are read with plain SQL in the test agents that already seed them.

Two new policy options

  • agentToolReplayOnConnect: { maxRuns, maxChunksPerRun } (static option; replayOnConnect on AgentToolsOptions) bounds the reconnect burst: the newest N runs by started_at, still replayed oldest-first, and the last N stored chunks of each run. A cut run sends no frames at all; dropped chunks still advance the frame sequence, so retained frames carry the sequence numbers an uncapped replay would use and useAgentToolEvents() dedupes exactly as before. Both default to Infinity — no behaviour change — and capping the replay never deletes a run.
  • maxConcurrentDetachedAgentTools (live Agent field; maxConcurrentDetached on AgentToolsOptions) caps non-terminal DETACHED runs separately, inside the maxConcurrentAgentTools total. Default Infinity. Detached runs still count toward the total; a detached dispatch over the detached cap fails exactly like the total cap does — synchronous error row, started + error events, no child spawned, message naming the detached cap. The live-detached-count warning now points at this knob.

Deviations from the spec worth knowing

  • No new Lifecycle contract hooks. The spec proposed a WebSockets connection observer and a generic _cf_capability RPC aperture. Neither turned out to be needed: Agent's onConnect wrapper calls agentTools.replayToConnection, and the harnesses keep one-line facades for the five child RPC names so the stub wire is byte-identical. Both can be added later if a third host wants them.
  • AgentToolsChild.activeRunForRequest(requestId) was added so both harnesses decide stream cutover without reading the capability's table.
  • A white-box test in ai-chat that measured the size of the now-private request-id cache was removed; the observable half (an unrelated error frame does not contaminate a run's terminal) is still covered.

Review fixes folded in

  • The legacy cf_ai_chat_agent_tool_runs fold named progress_json / last_signal_at unconditionally, but ai-chat releases predating the progress work created that table without them (later releases added them by ALTER), so such a deployment upgrading straight to this version threw in onStart and never became reachable. The copied column list is now the intersection with the legacy table's actual columns.
  • readRun omitted detached_on_milestones, which the warm-tail milestone delivery reads, so a milestone reached while the parent was tailing live was never notified — only the backbone tick delivered it. Latent in the original _readAgentToolRun too, so this is a behaviour improvement, with a regression test that fails without it.
  • The child seal called the host's output / summary projections for every outcome, so user getAgentToolOutput / getAgentToolSummary overrides with completion side effects fired on error/aborted/skipped runs. They now run only for a completed seal, which also stops a non-completed row carrying a summary — matching what the parent already surfaced for a non-completed inspection (#terminalResultFromInspection only reads summary on completed).

Second pass after merging main

Merged origin/main (state, queue and WebSockets protocol capabilities, claims refactor). Conflicts were confined to import and type moves plus Think's alarm override, which main had already removed with the queue capability. Both new capabilities keep the default selective claim.

A fresh review of the full diff found one dead comment and two pre-existing backbone edge cases in the engine this PR now owns; all fixed here with regression tests:

  • A give-up that tore its child down kept the backbone re-arming forever because its finish slot never closes. The run now counts as outstanding for two top-cadence ticks, so a completion racing the cancel still repairs the row (Feature request: first-class detached ("background") sub-agent runs with a durable completion hook #1752 stays intact), then settles.
  • A soft no-progress give-up that left the child running is torn down once the absolute budget passes, instead of never.
  • A throwing durable onFinish is reported through onError rather than escaping the tick, so sibling rows still deliver and the backbone still re-arms.

Verification

sherif: no issues · check:exports: 8 packages valid · oxfmt --check .: clean · oxlint: clean
npm run typecheck: all 119 projects
packages/agents  --project workers: 124 files, 1907 tests passed
packages/think   src/tests:           44 files,  891 tests passed
packages/ai-chat --project workers:   50 files,  652 tests passed

Known pre-existing flake: the workerd pool occasionally segfaults partway through ai-chat/src/tests/agent-tools.test.ts when run in isolation. It passes in the full-suite run.


Devin Review

Move the agent-tool parent engine out of Agent into AgentTools, a
LifecycleCapability that owns cf_agent_tool_runs under its own schema key
and runs the detached reconcile backbone as a singleflight Lifecycle job
instead of a self-scheduling Scheduler callback. Agent keeps runAgentTool,
cancelAgentTool, hasAgentToolRun, clearAgentToolRuns and the hooks as thin
facades over this.agentTools.

Add AgentToolsChild, the child role, built from the Think and AIChatAgent
implementations: one set of child-run and milestone tables, the adapter
methods the parent calls, and an explicit observeChunk tap in place of the
broadcast-snooping interceptor.
AIChatAgent installs AgentToolsChild, binds its host port, keeps the five
adapter methods as facades, and taps chat frames explicitly from
_broadcastChatMessage instead of overriding broadcast. The legacy
cf_ai_chat_agent_tool_* tables fold into the shared child tables on start.
Think installs AgentToolsChild, binds its host port, keeps the adapter
methods as facades, and taps chat frames from _broadcastChat instead of
overriding broadcast. The child capability exposes activeRunForRequest so
both harnesses decide stream cutover without reading its table.
Both harnesses now tap chat frames explicitly through AgentToolsChild, so
the snooping interceptor and its host substrate have no callers. Document
how any Agent subclass becomes an agent-tool child.
@changeset-bot

changeset-bot Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3f93d32

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
agents Minor
@cloudflare/think Minor
@cloudflare/ai-chat Minor
@cloudflare/agent-think Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@agent-think

agent-think Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🟡 agents import sizes

Measured 350 runtime imports as minified bundles. The primary size is gzip; raw minified size is included for diagnosis. An existing import growing by more than 10% is marked red. This report is informational.

Red Yellow Green Unchanged New Removed
0 52 93 197 7 1

Compared 46760e63 with 3f93d328. Open workflow run.

Changed imports (153)
Status Import Base gzip Head gzip Delta
🟡 agents#unstable_callable 261.1 KiB 262.4 KiB +1.3 KiB (+0.5%)
🟡 agents/chat-sdk#defaultThreadShard 261.0 KiB 262.3 KiB +1.3 KiB (+0.5%)
🟡 agents/chat-sdk#defaultKeyShard 261.2 KiB 262.4 KiB +1.3 KiB (+0.49%)
🟡 agents/chat-sdk#ChatSdkStateAgent 262.8 KiB 264.1 KiB +1.3 KiB (+0.49%)
🟡 agents#buildAgentUrl 261.7 KiB 263.0 KiB +1.3 KiB (+0.49%)
🟡 agents#getSubAgentByName 261.3 KiB 262.6 KiB +1.3 KiB (+0.49%)
🟡 agents#createHeaderBasedEmailResolver 261.2 KiB 262.5 KiB +1.3 KiB (+0.49%)
🟡 agents#callable 261.1 KiB 262.3 KiB +1.3 KiB (+0.49%)
🟡 agents#AGENT_TOOL_MILESTONE_PART 261.0 KiB 262.3 KiB +1.3 KiB (+0.49%)
🟡 agents#StreamingResponse 261.0 KiB 262.3 KiB +1.3 KiB (+0.49%)
🟡 agents#MessageType 261.2 KiB 262.5 KiB +1.3 KiB (+0.49%)
🟡 agents/workflows#WorkflowRejectedError 261.1 KiB 262.4 KiB +1.3 KiB (+0.49%)
🟡 agents#__DO_NOT_USE_WILL_BREAK__withInvocationScope 261.0 KiB 262.3 KiB +1.3 KiB (+0.49%)
🟡 agents#Agent 261.0 KiB 262.3 KiB +1.3 KiB (+0.49%)
🟡 agents/chat-sdk#ChatSdkStateAdapter 263.4 KiB 264.7 KiB +1.3 KiB (+0.49%)
🟡 agents#buildAgentPath 261.6 KiB 262.9 KiB +1.3 KiB (+0.49%)
🟡 agents#AGENT_TOOL_PROGRESS_PART 261.0 KiB 262.3 KiB +1.3 KiB (+0.49%)
🟡 agents/chat-sdk#createChatSdkState 263.4 KiB 264.7 KiB +1.3 KiB (+0.48%)
🟡 agents#SUB_PREFIX 261.0 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#isDurableObjectStorageReset 261.1 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#routeAgentRequest 261.7 KiB 263.0 KiB +1.3 KiB (+0.48%)
🟡 agents#routeSubAgentRequest 261.3 KiB 262.5 KiB +1.3 KiB (+0.48%)
🟡 agents#parseSubAgentPath 261.0 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#DEFAULT_AGENT_STATIC_OPTIONS 261.0 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#isDurableObjectMemoryLimitReset 261.0 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#DurableObjectOAuthClientProvider 261.0 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#MCP_SERVER_ID_MAX_LENGTH 261.0 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#__DO_NOT_USE_WILL_BREAK__agentContext 261.0 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#camelCaseToKebabCase 261.0 KiB 262.3 KiB +1.3 KiB (+0.48%)
🟡 agents#isDurableObjectCodeUpdateReset 261.0 KiB 262.3 KiB +1.2 KiB (+0.48%)
🟡 agents#SqlError 261.0 KiB 262.3 KiB +1.2 KiB (+0.48%)
🟡 agents#isPlatformTransientError 261.0 KiB 262.3 KiB +1.2 KiB (+0.48%)
🟡 agents#getAgentByName 261.0 KiB 262.3 KiB +1.2 KiB (+0.48%)
🟡 agents#routeAgentEmail 261.3 KiB 262.6 KiB +1.2 KiB (+0.48%)
🟡 agents/workflows#AgentWorkflow 262.4 KiB 263.6 KiB +1.2 KiB (+0.47%)
🟡 agents#normalizeServerId 261.0 KiB 262.3 KiB +1.2 KiB (+0.47%)
🟡 agents#getCurrentAgent 261.0 KiB 262.3 KiB +1.2 KiB (+0.47%)
🟡 agents/mcp#SSEEdgeClientTransport 345.1 KiB 346.5 KiB +1.3 KiB (+0.38%)
🟡 agents/mcp#MCP_SERVER_ID_MAX_LENGTH 345.1 KiB 346.4 KiB +1.3 KiB (+0.38%)
🟡 agents/mcp#getMcpAuthContext 345.1 KiB 346.4 KiB +1.3 KiB (+0.37%)
🟡 agents/mcp#McpAgent 345.1 KiB 346.4 KiB +1.3 KiB (+0.37%)
🟡 agents/mcp#RPC_DO_PREFIX 345.1 KiB 346.4 KiB +1.3 KiB (+0.37%)
🟡 agents/mcp#DurableObjectEventStore 345.1 KiB 346.4 KiB +1.3 KiB (+0.37%)
🟡 agents/mcp#normalizeServerId 345.1 KiB 346.4 KiB +1.3 KiB (+0.37%)
🟡 agents/mcp#RPCServerTransport 345.1 KiB 346.4 KiB +1.3 KiB (+0.37%)
🟡 agents/mcp#RPCClientTransport 345.1 KiB 346.4 KiB +1.3 KiB (+0.37%)
🟡 agents/mcp#StreamableHTTPEdgeClientTransport 345.2 KiB 346.4 KiB +1.3 KiB (+0.37%)
🟡 agents/mcp#ElicitRequestSchema 345.1 KiB 346.4 KiB +1.3 KiB (+0.36%)
🟡 agents/mcp#WorkerTransport 348.5 KiB 349.7 KiB +1.2 KiB (+0.35%)
🟡 agents/mcp#experimental_createMcpHandler 378.7 KiB 380.0 KiB +1.3 KiB (+0.33%)
🟡 agents/mcp#createLegacyMcpHandler 378.6 KiB 379.8 KiB +1.2 KiB (+0.33%)
🟡 agents/mcp#createMcpHandler 390.9 KiB 392.0 KiB +1.1 KiB (+0.29%)
🟢 agents/chat#sweepStaleChatRecoveryIncidents 2.4 KiB 2.4 KiB -31 B (-1.24%)
🟢 agents/chat#recordChatTerminal 2.4 KiB 2.3 KiB -28 B (-1.16%)
🟢 agents/chat#listActiveChatRecoveryIncidents 2.4 KiB 2.4 KiB -28 B (-1.14%)
🟢 agents/chat#CHAT_LAST_TERMINAL_KEY 2.3 KiB 2.3 KiB -27 B (-1.13%)
🟢 agents/chat#classifyAgentToolChildRecovery 2.4 KiB 2.4 KiB -28 B (-1.12%)
🟢 agents/chat#pendingChatTerminal 2.3 KiB 2.3 KiB -27 B (-1.12%)
🟢 agents/chat#clearChatTerminal 2.3 KiB 2.3 KiB -27 B (-1.12%)
🟢 agents/chat#bumpChatRecoveryProgress 2.4 KiB 2.3 KiB -27 B (-1.12%)
🟢 agents/chat#resolveChatRecoveryConfig 2.6 KiB 2.5 KiB -28 B (-1.07%)
🟢 agents/chat#applyToolUpdate 2.4 KiB 2.4 KiB -26 B (-1.06%)
🟢 agents/chat#pausedExecutionUpdate 2.4 KiB 2.4 KiB -26 B (-1.06%)
🟢 agents/chat#awaitWithDeadline 2.4 KiB 2.4 KiB -26 B (-1.06%)
🟢 agents/chat#aiSdkRecoveryCodec 2.3 KiB 2.3 KiB -25 B (-1.06%)
🟢 agents/chat#CHAT_RECOVERY_STABLE_RETRY_DELAY_SECONDS 2.3 KiB 2.3 KiB -25 B (-1.06%)
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_MAX_OOM_RETRIES 2.3 KiB 2.3 KiB -25 B (-1.06%)
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_MAX_ATTEMPTS 2.3 KiB 2.3 KiB -25 B (-1.05%)
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_MAX_WORK 2.3 KiB 2.3 KiB -25 B (-1.05%)
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_STABLE_TIMEOUT_MS 2.3 KiB 2.3 KiB -25 B (-1.05%)
🟢 agents/chat#MAX_BOUND_PARAMS 2.3 KiB 2.3 KiB -25 B (-1.05%)
🟢 agents/chat#crossMessageToolResultUpdate 2.4 KiB 2.4 KiB -26 B (-1.05%)
🟢 agents/chat#CHAT_RECOVERY_TASK_NAME 2.3 KiB 2.3 KiB -25 B (-1.05%)
🟢 agents/chat#CHAT_RECOVERY_PROGRESS_KEY 2.3 KiB 2.3 KiB -25 B (-1.05%)
🟢 agents/chat#wrapChatFiberSnapshot 2.3 KiB 2.3 KiB -25 B (-1.05%)
🟢 agents/chat#CHAT_RECOVERY_INCIDENT_KEY_PREFIX 2.3 KiB 2.3 KiB -25 B (-1.05%)
🟢 agents/chat#clientResolvableToolNames 2.3 KiB 2.3 KiB -25 B (-1.04%)
🟢 agents/chat#createAgentToolEventState 2.3 KiB 2.3 KiB -25 B (-1.04%)
🟢 agents/chat#MessageType 2.4 KiB 2.4 KiB -26 B (-1.04%)
🟢 agents/chat#readChatRecoveryProgress 2.3 KiB 2.3 KiB -25 B (-1.04%)
🟢 agents/chat#STREAM_RESUME_NONE_REASONS 2.3 KiB 2.3 KiB -25 B (-1.04%)
🟢 agents/chat#drainInteractionApplies 2.3 KiB 2.3 KiB -25 B (-1.04%)
🟢 agents/chat#AgentToolStreamProgressThrottle 2.4 KiB 2.3 KiB -25 B (-1.04%)
🟢 agents/chat#StreamProgressCreditThrottle 2.4 KiB 2.3 KiB -25 B (-1.04%)
🟢 agents/chat#shouldCreditStreamProgress 2.4 KiB 2.3 KiB -25 B (-1.03%)
🟢 agents/chat#createChatFiberSnapshot 2.5 KiB 2.4 KiB -26 B (-1.03%)
🟢 agents/chat#buildChatRecoveringFrame 2.4 KiB 2.4 KiB -25 B (-1.02%)
🟢 agents/chat#AutoContinuationController 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#normalizeToolInput 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#applyChunkToParts 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#CHAT_MESSAGE_TYPES 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#toolApprovalUpdate 2.4 KiB 2.4 KiB -25 B (-1.01%)
🟢 agents/chat#AGENT_TOOL_STREAM_PROGRESS_BUMP_THROTTLE_MS 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#CHAT_STREAM_PROGRESS_CREDIT_THROTTLE_MS 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#ROW_MAX_BYTES 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#CHAT_RECOVERING_KEY 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#TIMED_OUT 2.3 KiB 2.3 KiB -24 B (-1.01%)
🟢 agents/chat#chatRecoveryTaskRunOptions 2.4 KiB 2.4 KiB -25 B (-1%)
🟢 agents/chat#ChatStreamStalledError 2.4 KiB 2.3 KiB -24 B (-1%)
🟢 agents/chat#isReplayChunk 2.4 KiB 2.4 KiB -24 B (-0.98%)
🟢 agents/chat#sendIfOpen 2.4 KiB 2.4 KiB -24 B (-0.98%)
🟢 agents/chat#toolResultUpdate 2.4 KiB 2.4 KiB -24 B (-0.98%)
🟢 agents/chat#resolveToolMergeId 2.4 KiB 2.4 KiB -24 B (-0.98%)
🟢 agents/chat#reconcileOrphanPartial 2.4 KiB 2.4 KiB -24 B (-0.98%)
🟢 agents/chat#repairInterruptedToolParts 2.6 KiB 2.6 KiB -26 B (-0.97%)
🟢 agents/chat#buildInClauseStrings 2.4 KiB 2.4 KiB -24 B (-0.97%)
🟢 agents/chat#hasIncompleteToolBatch 2.4 KiB 2.4 KiB -24 B (-0.96%)
🟢 agents/chat#toolPartHasSettledResult 2.3 KiB 2.3 KiB -23 B (-0.96%)
🟢 agents/chat#sanitizeMessage 2.5 KiB 2.5 KiB -25 B (-0.96%)
🟢 agents/chat#ContinuationState 2.7 KiB 2.6 KiB -26 B (-0.96%)
🟢 agents/chat#setChatRecovering 2.5 KiB 2.4 KiB -24 B (-0.96%)
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_TERMINAL_MESSAGE 2.4 KiB 2.3 KiB -23 B (-0.95%)
🟢 agents/chat#iterateWithStallWatchdog 2.6 KiB 2.6 KiB -25 B (-0.94%)
🟢 agents/chat#partAwaitsClientInteraction 2.4 KiB 2.4 KiB -23 B (-0.93%)
🟢 agents/chat#KV_DELETE_MAX_KEYS 2.3 KiB 2.3 KiB -22 B (-0.93%)
🟢 agents/chat#unwrapChatFiberSnapshot 2.4 KiB 2.4 KiB -23 B (-0.93%)
🟢 agents/chat#AbortRegistry 2.5 KiB 2.5 KiB -24 B (-0.92%)
🟢 agents/chat#AgentToolProgressEmitter 2.7 KiB 2.6 KiB -25 B (-0.92%)
🟢 agents/chat#runChatRecoveryExhaustion 2.6 KiB 2.5 KiB -24 B (-0.92%)
🟢 agents/chat#byteLength 2.5 KiB 2.4 KiB -23 B (-0.92%)
🟢 agents/chat#TurnQueue 2.6 KiB 2.6 KiB -24 B (-0.9%)
🟢 agents/chat#createChatRecoveryTaskDefinition 2.6 KiB 2.6 KiB -24 B (-0.9%)
🟢 agents/chat#parseProtocolMessage 2.5 KiB 2.5 KiB -23 B (-0.89%)
🟢 agents/chat#createChatTurnTaskDefinition 2.7 KiB 2.6 KiB -24 B (-0.88%)
🟢 agents/chat#TextSegmentJoiner 2.7 KiB 2.7 KiB -24 B (-0.87%)
🟢 agents/chat#isPlatformFailure 2.6 KiB 2.6 KiB -23 B (-0.85%)
🟢 agents/chat#PreStreamTurns 2.6 KiB 2.6 KiB -23 B (-0.85%)
🟢 agents/chat#reconcileMessages 2.8 KiB 2.8 KiB -24 B (-0.84%)
🟢 agents/chat#applyAgentToolEvent 3.2 KiB 3.2 KiB -27 B (-0.83%)
🟢 agents/chat#SubmitConcurrencyController 2.9 KiB 2.9 KiB -24 B (-0.81%)
🟢 agents/chat#CHAT_RECOVERY_ALARM_DEBOUNCE_MS 2.3 KiB 2.3 KiB -19 B (-0.8%)
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_NO_PROGRESS_TIMEOUT_MS 2.3 KiB 2.3 KiB -19 B (-0.8%)
🟢 agents/chat#dispatchChatRecoveryToHandoff 3.0 KiB 3.0 KiB -25 B (-0.8%)
🟢 agents/chat#StreamAccumulator 2.9 KiB 2.9 KiB -24 B (-0.8%)
🟢 agents/chat#ResumeHandshake 3.0 KiB 2.9 KiB -24 B (-0.79%)
🟢 agents/chat#broadcastTransition 3.2 KiB 3.1 KiB -25 B (-0.77%)
🟢 agents/chat#truncateOlderMessages 3.2 KiB 3.1 KiB -25 B (-0.77%)
🟢 agents/chat#persistReconstructedOrphan 3.1 KiB 3.0 KiB -24 B (-0.77%)
🟢 agents/chat#CHAT_RECOVERY_INCIDENT_TTL_MS 2.3 KiB 2.3 KiB -18 B (-0.76%)
🟢 agents/chat#CHAT_RECOVERING_FLAG_TTL_MS 2.3 KiB 2.3 KiB -17 B (-0.72%)
🟢 agents/chat#enforceRowSizeLimit 3.5 KiB 3.5 KiB -24 B (-0.67%)
🟢 agents/chat#ResumableStream 5.1 KiB 5.1 KiB -21 B (-0.4%)
🟢 agents/chat#createChatStreams 6.4 KiB 6.4 KiB -24 B (-0.37%)
🟢 agents/chat#ChatRecoveryEngine 4.4 KiB 4.4 KiB -14 B (-0.31%)
🟢 agents/chat#createToolsFromClientSchemas 114.3 KiB 114.3 KiB -28 B (-0.02%)
⚪ agents#AgentTools — 262.3 KiB —
⚪ agents#AgentToolsChild — 265.9 KiB —
⚪ agents#defaultDetachedCompletionText — 262.5 KiB —
⚪ agents#defaultDetachedMilestoneText — 262.4 KiB —
⚪ agents#getAgentToolsHost — 262.3 KiB —
⚪ agents#setAgentToolsChildHost — 262.3 KiB —
⚪ agents#setAgentToolsHost — 262.3 KiB —
🟢 agents/chat#interceptAgentToolBroadcast 2.5 KiB — —
All 349 current runtime imports
Status Import Gzip Raw minified
🟡 agents#__DO_NOT_USE_WILL_BREAK__agentContext 262.3 KiB 1144.3 KiB
🟡 agents#__DO_NOT_USE_WILL_BREAK__withInvocationScope 262.3 KiB 1144.3 KiB
🟡 agents#Agent 262.3 KiB 1144.3 KiB
🟡 agents#AGENT_TOOL_MILESTONE_PART 262.3 KiB 1144.3 KiB
🟡 agents#AGENT_TOOL_PROGRESS_PART 262.3 KiB 1144.4 KiB
⚪ agents#AgentTools 262.3 KiB 1144.3 KiB
⚪ agents#AgentToolsChild 265.9 KiB 1158.7 KiB
🟡 agents#buildAgentPath 262.9 KiB 1146.6 KiB
🟡 agents#buildAgentUrl 263.0 KiB 1147.1 KiB
🟡 agents#callable 262.3 KiB 1144.4 KiB
🟡 agents#camelCaseToKebabCase 262.3 KiB 1144.3 KiB
🟡 agents#createHeaderBasedEmailResolver 262.5 KiB 1144.8 KiB
🟡 agents#DEFAULT_AGENT_STATIC_OPTIONS 262.3 KiB 1144.3 KiB
⚪ agents#defaultDetachedCompletionText 262.5 KiB 1144.8 KiB
⚪ agents#defaultDetachedMilestoneText 262.4 KiB 1144.5 KiB
🟡 agents#DurableObjectOAuthClientProvider 262.3 KiB 1144.3 KiB
🟡 agents#getAgentByName 262.3 KiB 1144.3 KiB
⚪ agents#getAgentToolsHost 262.3 KiB 1144.3 KiB
🟡 agents#getCurrentAgent 262.3 KiB 1144.3 KiB
🟡 agents#getSubAgentByName 262.6 KiB 1145.0 KiB
🟡 agents#isDurableObjectCodeUpdateReset 262.3 KiB 1144.3 KiB
🟡 agents#isDurableObjectMemoryLimitReset 262.3 KiB 1144.3 KiB
🟡 agents#isDurableObjectStorageReset 262.3 KiB 1144.4 KiB
🟡 agents#isPlatformTransientError 262.3 KiB 1144.3 KiB
🟡 agents#MCP_SERVER_ID_MAX_LENGTH 262.3 KiB 1144.3 KiB
🟡 agents#MessageType 262.5 KiB 1144.7 KiB
🟡 agents#normalizeServerId 262.3 KiB 1144.3 KiB
🟡 agents#parseSubAgentPath 262.3 KiB 1144.3 KiB
🟡 agents#routeAgentEmail 262.6 KiB 1145.1 KiB
🟡 agents#routeAgentRequest 263.0 KiB 1146.2 KiB
🟡 agents#routeSubAgentRequest 262.5 KiB 1144.9 KiB
⚪ agents#setAgentToolsChildHost 262.3 KiB 1144.4 KiB
⚪ agents#setAgentToolsHost 262.3 KiB 1144.3 KiB
🟡 agents#SqlError 262.3 KiB 1144.3 KiB
🟡 agents#StreamingResponse 262.3 KiB 1144.3 KiB
🟡 agents#SUB_PREFIX 262.3 KiB 1144.3 KiB
🟡 agents#unstable_callable 262.4 KiB 1144.6 KiB
⚪ agents/agent-tools#agentTool 112.5 KiB 538.2 KiB
⚪ agents/browser#BrowserConnector 50.5 KiB 176.6 KiB
⚪ agents/browser#browserContent 36.3 KiB 127.4 KiB
⚪ agents/browser#browserExtract 36.3 KiB 127.4 KiB
⚪ agents/browser#browserLinks 36.3 KiB 127.4 KiB
⚪ agents/browser#browserMarkdown 36.3 KiB 127.4 KiB
⚪ agents/browser#browserPdf 36.3 KiB 127.3 KiB
⚪ agents/browser#BrowserRenderingError 36.0 KiB 126.7 KiB
⚪ agents/browser#browserScrape 36.3 KiB 127.4 KiB
⚪ agents/browser#browserScreenshot 36.3 KiB 127.3 KiB
⚪ agents/browser#browserSnapshot 36.3 KiB 127.4 KiB
⚪ agents/browser#CdpSession 37.2 KiB 129.8 KiB
⚪ agents/browser#CodemodeRuntime 39.6 KiB 139.0 KiB
⚪ agents/browser#connectBrowser 37.8 KiB 131.4 KiB
⚪ agents/browser#connectBrowserSession 37.5 KiB 130.4 KiB
⚪ agents/browser#connectUrl 37.6 KiB 130.5 KiB
⚪ agents/browser#createBrowserSession 36.3 KiB 127.5 KiB
⚪ agents/browser#DEFAULT_EXEC_SWEEP_IDLE_MS 36.0 KiB 126.6 KiB
⚪ agents/browser#DEFAULT_SWEEP_IDLE_MS 36.0 KiB 126.6 KiB
⚪ agents/browser#deleteBrowserSession 36.1 KiB 126.9 KiB
⚪ agents/browser#DurableBrowserSessionStore 36.4 KiB 127.6 KiB
⚪ agents/browser#getBrowserRecording 36.2 KiB 127.1 KiB
⚪ agents/browser#listBrowserTargets 36.1 KiB 126.9 KiB
⚪ agents/browser#loadCdpSpec 36.6 KiB 128.3 KiB
⚪ agents/browser#runQuickAction 36.0 KiB 126.6 KiB
⚪ agents/browser/ai#createBrowserRuntime 147.0 KiB 632.8 KiB
⚪ agents/browser/ai#createBrowserTools 147.0 KiB 632.9 KiB
⚪ agents/browser/ai#createQuickActionTools 122.5 KiB 554.3 KiB
⚪ agents/browser/tanstack-ai#createBrowserTools 162.7 KiB 701.7 KiB
⚪ agents/channels#ChannelHost 3.3 KiB 9.1 KiB
⚪ agents/channels#consumeChunks 237 B 321 B
⚪ agents/channels#createUserIdentityStore 1.3 KiB 3.2 KiB
⚪ agents/channels#fallback 155 B 160 B
⚪ agents/channels#fallbackChannel 893 B 1.9 KiB
⚪ agents/channels#fanout 151 B 156 B
⚪ agents/channels#fanoutChannel 875 B 1.9 KiB
⚪ agents/channels#identityKey 178 B 223 B
⚪ agents/channels#isChannelMessageSurface 271 B 452 B
⚪ agents/channels#linkChannelIdentities 113 B 99 B
⚪ agents/channels#matchesPath 110 B 96 B
⚪ agents/channels#routes 307 B 507 B
⚪ agents/channels#UserIdentityConflictError 248 B 335 B
⚪ agents/channels/ai-sdk#createSendMessageTool 112.2 KiB 537.4 KiB
⚪ agents/channels/ai-sdk#toChannelChunks 112.5 KiB 538.4 KiB
⚪ agents/channels/email#email 23.5 KiB 75.4 KiB
⚪ agents/channels/email#inboundEmail 22.3 KiB 72.3 KiB
⚪ agents/channels/slack#slack 5.5 KiB 14.6 KiB
⚪ agents/channels/slack#slackWebhook 2.2 KiB 5.1 KiB
⚪ agents/channels/tanstack-ai#createSendMessageTool 16.2 KiB 68.4 KiB
⚪ agents/channels/telegram#telegram 3.8 KiB 10.3 KiB
⚪ agents/channels/telegram#telegramWebhook 1.6 KiB 3.6 KiB
⚪ agents/channels/voice#browserVoice 1010 B 2.2 KiB
🟢 agents/chat#AbortRegistry 2.5 KiB 8.9 KiB
🟢 agents/chat#AGENT_TOOL_STREAM_PROGRESS_BUMP_THROTTLE_MS 2.3 KiB 8.2 KiB
🟢 agents/chat#AgentToolProgressEmitter 2.6 KiB 9.5 KiB
🟢 agents/chat#AgentToolStreamProgressThrottle 2.3 KiB 8.3 KiB
🟢 agents/chat#aiSdkRecoveryCodec 2.3 KiB 8.1 KiB
🟢 agents/chat#applyAgentToolEvent 3.2 KiB 10.9 KiB
🟢 agents/chat#applyChunkToParts 2.3 KiB 8.1 KiB
🟢 agents/chat#applyToolUpdate 2.4 KiB 8.4 KiB
🟢 agents/chat#AutoContinuationController 2.3 KiB 8.1 KiB
🟢 agents/chat#awaitWithDeadline 2.4 KiB 8.3 KiB
🟢 agents/chat#broadcastTransition 3.1 KiB 11.4 KiB
🟢 agents/chat#buildChatRecoveringFrame 2.4 KiB 8.3 KiB
🟢 agents/chat#buildInClauseStrings 2.4 KiB 8.3 KiB
🟢 agents/chat#bumpChatRecoveryProgress 2.3 KiB 8.3 KiB
🟢 agents/chat#byteLength 2.4 KiB 8.4 KiB
🟢 agents/chat#CHAT_LAST_TERMINAL_KEY 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_MESSAGE_TYPES 2.3 KiB 8.1 KiB
🟢 agents/chat#CHAT_RECOVERING_FLAG_TTL_MS 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_RECOVERING_KEY 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_RECOVERY_ALARM_DEBOUNCE_MS 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_RECOVERY_INCIDENT_KEY_PREFIX 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_RECOVERY_INCIDENT_TTL_MS 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_RECOVERY_PROGRESS_KEY 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_RECOVERY_STABLE_RETRY_DELAY_SECONDS 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_RECOVERY_TASK_NAME 2.3 KiB 8.2 KiB
🟢 agents/chat#CHAT_STREAM_PROGRESS_CREDIT_THROTTLE_MS 2.3 KiB 8.2 KiB
🟢 agents/chat#ChatRecoveryEngine 4.4 KiB 15.2 KiB
🟢 agents/chat#chatRecoveryTaskRunOptions 2.4 KiB 8.5 KiB
🟢 agents/chat#ChatStreamStalledError 2.3 KiB 8.3 KiB
🟢 agents/chat#classifyAgentToolChildRecovery 2.4 KiB 8.4 KiB
🟢 agents/chat#clearChatTerminal 2.3 KiB 8.2 KiB
🟢 agents/chat#clientResolvableToolNames 2.3 KiB 8.2 KiB
🟢 agents/chat#ContinuationState 2.6 KiB 9.8 KiB
🟢 agents/chat#createAgentToolEventState 2.3 KiB 8.2 KiB
🟢 agents/chat#createChatFiberSnapshot 2.4 KiB 8.6 KiB
🟢 agents/chat#createChatRecoveryTaskDefinition 2.6 KiB 8.9 KiB
🟢 agents/chat#createChatStreams 6.4 KiB 22.0 KiB
🟢 agents/chat#createChatTurnTaskDefinition 2.6 KiB 8.9 KiB
🟢 agents/chat#createToolsFromClientSchemas 114.3 KiB 545.3 KiB
🟢 agents/chat#crossMessageToolResultUpdate 2.4 KiB 8.6 KiB
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_MAX_ATTEMPTS 2.3 KiB 8.2 KiB
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_MAX_OOM_RETRIES 2.3 KiB 8.2 KiB
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_MAX_WORK 2.3 KiB 8.2 KiB
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_NO_PROGRESS_TIMEOUT_MS 2.3 KiB 8.2 KiB
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_STABLE_TIMEOUT_MS 2.3 KiB 8.2 KiB
🟢 agents/chat#DEFAULT_CHAT_RECOVERY_TERMINAL_MESSAGE 2.3 KiB 8.2 KiB
🟢 agents/chat#dispatchChatRecoveryToHandoff 3.0 KiB 9.8 KiB
🟢 agents/chat#drainInteractionApplies 2.3 KiB 8.2 KiB
🟢 agents/chat#enforceRowSizeLimit 3.5 KiB 11.1 KiB
🟢 agents/chat#hasIncompleteToolBatch 2.4 KiB 8.6 KiB
🟢 agents/chat#isPlatformFailure 2.6 KiB 8.9 KiB
🟢 agents/chat#isReplayChunk 2.4 KiB 8.6 KiB
🟢 agents/chat#iterateWithStallWatchdog 2.6 KiB 8.7 KiB
🟢 agents/chat#KV_DELETE_MAX_KEYS 2.3 KiB 8.2 KiB
🟢 agents/chat#listActiveChatRecoveryIncidents 2.4 KiB 8.4 KiB
🟢 agents/chat#MAX_BOUND_PARAMS 2.3 KiB 8.2 KiB
🟢 agents/chat#MessageType 2.4 KiB 8.9 KiB
🟢 agents/chat#normalizeToolInput 2.3 KiB 8.1 KiB
🟢 agents/chat#parseProtocolMessage 2.5 KiB 9.0 KiB
🟢 agents/chat#partAwaitsClientInteraction 2.4 KiB 8.5 KiB
🟢 agents/chat#pausedExecutionUpdate 2.4 KiB 8.3 KiB
🟢 agents/chat#pendingChatTerminal 2.3 KiB 8.2 KiB
🟢 agents/chat#persistReconstructedOrphan 3.0 KiB 11.0 KiB
🟢 agents/chat#PreStreamTurns 2.6 KiB 9.2 KiB
🟢 agents/chat#readChatRecoveryProgress 2.3 KiB 8.2 KiB
🟢 agents/chat#reconcileMessages 2.8 KiB 9.5 KiB
🟢 agents/chat#reconcileOrphanPartial 2.4 KiB 8.4 KiB
🟢 agents/chat#recordChatTerminal 2.3 KiB 8.2 KiB
🟢 agents/chat#repairInterruptedToolParts 2.6 KiB 9.1 KiB
🟢 agents/chat#resolveChatRecoveryConfig 2.5 KiB 8.8 KiB
🟢 agents/chat#resolveToolMergeId 2.4 KiB 8.4 KiB
🟢 agents/chat#ResumableStream 5.1 KiB 16.8 KiB
🟢 agents/chat#ResumeHandshake 2.9 KiB 10.3 KiB
🟢 agents/chat#ROW_MAX_BYTES 2.3 KiB 8.2 KiB
🟢 agents/chat#runChatRecoveryExhaustion 2.5 KiB 8.9 KiB
🟢 agents/chat#sanitizeMessage 2.5 KiB 8.7 KiB
🟢 agents/chat#sendIfOpen 2.4 KiB 8.3 KiB
🟢 agents/chat#setChatRecovering 2.4 KiB 8.4 KiB
🟢 agents/chat#shouldCreditStreamProgress 2.3 KiB 8.3 KiB
🟢 agents/chat#STREAM_RESUME_NONE_REASONS 2.3 KiB 8.2 KiB
🟢 agents/chat#StreamAccumulator 2.9 KiB 10.7 KiB
🟢 agents/chat#StreamProgressCreditThrottle 2.3 KiB 8.3 KiB
🟢 agents/chat#SubmitConcurrencyController 2.9 KiB 10.2 KiB
🟢 agents/chat#sweepStaleChatRecoveryIncidents 2.4 KiB 8.4 KiB
🟢 agents/chat#TextSegmentJoiner 2.7 KiB 9.2 KiB
🟢 agents/chat#TIMED_OUT 2.3 KiB 8.2 KiB
🟢 agents/chat#toolApprovalUpdate 2.4 KiB 8.5 KiB
🟢 agents/chat#toolPartHasSettledResult 2.3 KiB 8.3 KiB
🟢 agents/chat#toolResultUpdate 2.4 KiB 8.4 KiB
🟢 agents/chat#truncateOlderMessages 3.1 KiB 10.3 KiB
🟢 agents/chat#TurnQueue 2.6 KiB 9.1 KiB
🟢 agents/chat#unwrapChatFiberSnapshot 2.4 KiB 8.5 KiB
🟢 agents/chat#wrapChatFiberSnapshot 2.3 KiB 8.2 KiB
🟡 agents/chat-sdk#ChatSdkStateAdapter 264.7 KiB 1155.9 KiB
🟡 agents/chat-sdk#ChatSdkStateAgent 264.1 KiB 1153.4 KiB
🟡 agents/chat-sdk#createChatSdkState 264.7 KiB 1156.0 KiB
🟡 agents/chat-sdk#defaultKeyShard 262.4 KiB 1144.6 KiB
🟡 agents/chat-sdk#defaultThreadShard 262.3 KiB 1144.4 KiB
⚪ agents/chat/react#detectToolsRequiringConfirmation 3.3 KiB 8.3 KiB
⚪ agents/chat/react#extractClientToolSchemas 3.2 KiB 8.3 KiB
⚪ agents/chat/react#getAgentMessages 3.4 KiB 8.6 KiB
⚪ agents/chat/react#getToolApproval 3.1 KiB 8.0 KiB
⚪ agents/chat/react#getToolCallId 3.1 KiB 8.0 KiB
⚪ agents/chat/react#getToolInput 3.1 KiB 8.0 KiB
⚪ agents/chat/react#getToolOutput 3.1 KiB 8.0 KiB
⚪ agents/chat/react#getToolPartState 3.2 KiB 8.2 KiB
⚪ agents/chat/react#useAgentChat 132.9 KiB 609.7 KiB
⚪ agents/chat/react#WebSocketChatTransport 5.7 KiB 17.1 KiB
⚪ agents/chat/transport#WebSocketChatTransport 2.8 KiB 9.2 KiB
⚪ agents/client#AgentClient 21.8 KiB 75.2 KiB
⚪ agents/client#AgentConnectionError 16.3 KiB 57.8 KiB
⚪ agents/client#agentFetch 19.7 KiB 69.0 KiB
⚪ agents/client#createStubProxy 16.4 KiB 57.8 KiB
⚪ agents/client#DEFAULT_CALL_TIMEOUT_MS 16.2 KiB 57.6 KiB
⚪ agents/client#isTerminalCloseEvent 16.3 KiB 57.6 KiB
⚪ agents/client#nativeCall 16.5 KiB 58.3 KiB
⚪ agents/client#NativeCallQueue 16.7 KiB 58.9 KiB
⚪ agents/client#splitCallOptions 16.3 KiB 57.7 KiB
⚪ agents/context#AgentContextProvider 412 B 792 B
⚪ agents/context#AgentSearchProvider 640 B 1.3 KiB
⚪ agents/context#ContextBlocks 87.4 KiB 429.7 KiB
⚪ agents/email#createAddressBasedEmailResolver 193 B 227 B
⚪ agents/email#createCatchAllEmailResolver 110 B 97 B
⚪ agents/email#createHeaderBasedEmailResolver 334 B 492 B
⚪ agents/email#createSecureReplyEmailResolver 718 B 1.3 KiB
⚪ agents/email#DEFAULT_MAX_AGE_SECONDS 56 B 39 B
⚪ agents/email#isAutoReplyEmail 201 B 249 B
⚪ agents/email#signAgentHeaders 424 B 812 B
⚪ agents/experimental/webmcp#registerWebMcp 85.2 KiB 295.8 KiB
⚪ agents/lifecycle#getCurrentAgent 376 B 798 B
⚪ agents/lifecycle#Lifecycle 8.4 KiB 26.1 KiB
⚪ agents/lifecycle#LifecycleCapability 497 B 999 B
🟡 agents/mcp#createLegacyMcpHandler 379.8 KiB 1586.8 KiB
🟡 agents/mcp#createMcpHandler 392.0 KiB 1632.0 KiB
🟡 agents/mcp#DurableObjectEventStore 346.4 KiB 1445.3 KiB
🟡 agents/mcp#ElicitRequestSchema 346.4 KiB 1445.3 KiB
🟡 agents/mcp#experimental_createMcpHandler 380.0 KiB 1587.1 KiB
🟡 agents/mcp#getMcpAuthContext 346.4 KiB 1445.4 KiB
🟡 agents/mcp#MCP_SERVER_ID_MAX_LENGTH 346.4 KiB 1445.4 KiB
🟡 agents/mcp#McpAgent 346.4 KiB 1445.3 KiB
🟡 agents/mcp#normalizeServerId 346.4 KiB 1445.3 KiB
🟡 agents/mcp#RPC_DO_PREFIX 346.4 KiB 1445.3 KiB
🟡 agents/mcp#RPCClientTransport 346.4 KiB 1445.3 KiB
🟡 agents/mcp#RPCServerTransport 346.4 KiB 1445.3 KiB
🟡 agents/mcp#SSEEdgeClientTransport 346.5 KiB 1445.6 KiB
🟡 agents/mcp#StreamableHTTPEdgeClientTransport 346.4 KiB 1445.6 KiB
🟡 agents/mcp#WorkerTransport 349.7 KiB 1462.2 KiB
⚪ agents/mcp/client#getNamespacedData 62.9 KiB 240.0 KiB
⚪ agents/mcp/client#MCP_SERVER_ID_MAX_LENGTH 62.9 KiB 239.9 KiB
⚪ agents/mcp/client#MCPClientManager 158.6 KiB 702.6 KiB
⚪ agents/mcp/client#normalizeServerId 63.0 KiB 240.2 KiB
⚪ agents/mcp/do-oauth-client-provider#DurableObjectOAuthClientProvider 2.1 KiB 6.6 KiB
⚪ agents/mcp/server#createMcpHandler 80.5 KiB 307.2 KiB
⚪ agents/mcp/server#getMcpAuthContext 64.0 KiB 245.5 KiB
⚪ agents/observability#channels 259 B 549 B
⚪ agents/observability#genericObservability 470 B 1.2 KiB
⚪ agents/observability#subscribe 324 B 668 B
⚪ agents/observability/ai#wrapAISDK 8.8 KiB 30.5 KiB
⚪ agents/queue#Queue 3.1 KiB 9.6 KiB
⚪ agents/react#_testUtils 19.3 KiB 66.4 KiB
⚪ agents/react#useAgent 27.1 KiB 89.9 KiB
⚪ agents/react#useAgentToolEvents 21.1 KiB 73.7 KiB
⚪ agents/routing#getAgentByName 795 B 1.7 KiB
⚪ agents/routing#routeAgentRequest 1.6 KiB 3.6 KiB
⚪ agents/routing#RoutedAgents 2.4 KiB 6.2 KiB
⚪ agents/schedule#getSchedulePrompt 85.8 KiB 424.7 KiB
⚪ agents/schedule#scheduleSchema 85.3 KiB 423.6 KiB
⚪ agents/schedule#unstable_getSchedulePrompt 85.9 KiB 424.9 KiB
⚪ agents/schedule#unstable_scheduleSchema 85.3 KiB 423.6 KiB
⚪ agents/schedules#Scheduler 6.8 KiB 22.0 KiB
⚪ agents/schedules/parser#getSchedulePrompt 85.8 KiB 424.7 KiB
⚪ agents/schedules/parser#scheduleSchema 85.3 KiB 423.6 KiB
⚪ agents/sessions#COMPACTION_PREFIX 147 B 160 B
⚪ agents/sessions#createCompactFunction 1.7 KiB 4.0 KiB
⚪ agents/sessions#isCompactionMessage 177 B 200 B
⚪ agents/sessions#Session 2.0 KiB 6.3 KiB
⚪ agents/sessions#Sessions 9.6 KiB 34.3 KiB
⚪ agents/skills#fromManifest 309.8 KiB 1084.0 KiB
⚪ agents/skills#parseSkillFrontmatter 328.4 KiB 1146.2 KiB
⚪ agents/skills#parseSkillMarkdown 328.6 KiB 1146.5 KiB
⚪ agents/skills#r2 330.2 KiB 1150.4 KiB
⚪ agents/skills#runner 369.0 KiB 1297.8 KiB
⚪ agents/skills#SkillRegistry 416.4 KiB 1581.7 KiB
⚪ agents/skills/compile#compileSkillScript 15.4 KiB 43.4 KiB
⚪ agents/skills/compile#isCompilableSkillScript 15.4 KiB 43.3 KiB
⚪ agents/state#State 1.1 KiB 2.4 KiB
⚪ agents/streams#DEFAULT_MAX_CHUNK_BYTES 94 B 96 B
⚪ agents/streams#sseResponse 857 B 1.6 KiB
⚪ agents/streams#StreamClosedError 175 B 212 B
⚪ agents/streams#StreamNotFoundError 215 B 276 B
⚪ agents/streams#Streams 4.3 KiB 13.9 KiB
⚪ agents/streams#StreamSerializationError 171 B 201 B
⚪ agents/tasks#DuplicateTaskStepError 328 B 463 B
⚪ agents/tasks#MAX_SERIALIZED_BYTES 190 B 232 B
⚪ agents/tasks#MissingTaskDefinitionError 358 B 536 B
⚪ agents/tasks#NonRetryableError 238 B 308 B
⚪ agents/tasks#TaskReplayDivergedError 341 B 483 B
⚪ agents/tasks#Tasks 8.9 KiB 31.8 KiB
⚪ agents/tasks#TaskSerializationError 258 B 339 B
⚪ agents/types#MessageType 211 B 365 B
⚪ agents/vite#default 353.8 KiB 1356.1 KiB
⚪ agents/voice#addSFUTracks 324 B 424 B
⚪ agents/voice#createSFUSession 255 B 306 B
⚪ agents/voice#createSFUWebSocketAdapter 331 B 429 B
⚪ agents/voice#decodeVarint 157 B 160 B
⚪ agents/voice#downsample48kStereoTo16kMono 238 B 324 B
⚪ agents/voice#encodePayloadToProtobuf 189 B 279 B
⚪ agents/voice#encodeVarint 129 B 122 B
⚪ agents/voice#extractPayloadFromProtobuf 271 B 425 B
⚪ agents/voice#iterateText 1.6 KiB 3.8 KiB
⚪ agents/voice#renegotiateSFUSession 329 B 428 B
⚪ agents/voice#SentenceChunker 550 B 1.1 KiB
⚪ agents/voice#sfuFetch 294 B 358 B
⚪ agents/voice#upsample16kMonoTo48kStereo 211 B 272 B
⚪ agents/voice#VOICE_PROTOCOL_VERSION 51 B 31 B
⚪ agents/voice#withVoice 9.5 KiB 32.7 KiB
⚪ agents/voice#withVoiceInput 4.8 KiB 16.0 KiB
⚪ agents/voice#WorkersAIFluxSTT 1.5 KiB 4.3 KiB
⚪ agents/voice#WorkersAINova3STT 1.6 KiB 4.3 KiB
⚪ agents/voice#WorkersAITTS 682 B 1.4 KiB
⚪ agents/voice/client#VOICE_PROTOCOL_VERSION 473 B 768 B
⚪ agents/voice/client#VoiceClient 10.1 KiB 31.6 KiB
⚪ agents/voice/client#WebSocketVoiceTransport 4.6 KiB 13.3 KiB
⚪ agents/voice/errors#logVoiceError 132 B 173 B
⚪ agents/voice/errors#toVoiceError 94 B 80 B
⚪ agents/voice/errors#voiceErrorMessage 125 B 111 B
⚪ agents/voice/errors#VoiceProviderError 190 B 345 B
⚪ agents/voice/react#useVoiceAgent 13.6 KiB 42.5 KiB
⚪ agents/voice/react#useVoiceInput 13.3 KiB 41.4 KiB
⚪ agents/voice/react#WebSocketVoiceTransport 7.4 KiB 21.3 KiB
⚪ agents/voice/sfu#addSFUTracks 323 B 424 B
⚪ agents/voice/sfu#createSFUSession 254 B 306 B
⚪ agents/voice/sfu#createSFUWebSocketAdapter 329 B 429 B
⚪ agents/voice/sfu#decodeVarint 155 B 160 B
⚪ agents/voice/sfu#downsample48kStereoTo16kMono 236 B 324 B
⚪ agents/voice/sfu#encodePayloadToProtobuf 188 B 279 B
⚪ agents/voice/sfu#encodeVarint 129 B 122 B
⚪ agents/voice/sfu#extractPayloadFromProtobuf 270 B 425 B
⚪ agents/voice/sfu#renegotiateSFUSession 329 B 428 B
⚪ agents/voice/sfu#sfuFetch 292 B 358 B
⚪ agents/voice/sfu#upsample16kMonoTo48kStereo 209 B 272 B
⚪ agents/voice/text#iterateText 1.6 KiB 3.8 KiB
⚪ agents/voice/text#SentenceChunker 549 B 1.1 KiB
⚪ agents/voice/types#VOICE_PROTOCOL_VERSION 51 B 31 B
⚪ agents/voice/workers-ai#WorkersAIFluxSTT 1.5 KiB 4.3 KiB
⚪ agents/voice/workers-ai#WorkersAINova3STT 1.6 KiB 4.3 KiB
⚪ agents/voice/workers-ai#WorkersAITTS 682 B 1.4 KiB
⚪ agents/websockets#CAPNWEB_TRANSPORT_QUERY 12.4 KiB 43.3 KiB
⚪ agents/websockets#CAPNWEB_TRANSPORT_VALUE 12.4 KiB 43.3 KiB
⚪ agents/websockets#capnWebTransportUrl 12.5 KiB 43.5 KiB
⚪ agents/websockets#CF_NO_PROTOCOL_KEY 12.4 KiB 43.3 KiB
⚪ agents/websockets#CF_READONLY_KEY 12.4 KiB 43.3 KiB
⚪ agents/websockets#isCapnWebTransportUpgrade 12.5 KiB 43.4 KiB
⚪ agents/websockets#registerInternalConnectionKeys 12.4 KiB 43.4 KiB
⚪ agents/websockets#WebSockets 20.0 KiB 69.3 KiB
🟡 agents/workflows#AgentWorkflow 263.6 KiB 1149.1 KiB
🟡 agents/workflows#WorkflowRejectedError 262.4 KiB 1144.6 KiB
⚪ agents/x402#normalizeNetwork 14.7 KiB 61.1 KiB
⚪ agents/x402#withX402 23.0 KiB 89.2 KiB
⚪ agents/x402#withX402Client 104.1 KiB 346.5 KiB

Reported by agent-think[bot].

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@2227

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@2227

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@2227

hono-agents

npm i https://pkg.pr.new/hono-agents@2227

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@2227

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@2227

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@2227

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@2227

commit: 3f93d32

The parent agent-tool capability exposed eight storage/streaming internals
(`readRun`, `resultFromRow`, `updateTerminal`, `deliverDetachedTerminal`,
`reattachToTerminal`, `forwardStream`, `broadcastStoredChunksFromAdapter`,
`runDeferredFinishHooks`) only because test workers monkey-patched them. They
are now private; `runDeferredFinishHooks` is folded into the startup-recovery
pass that was its only caller. The public surface is dispatch and operations:
run, cancel, has, clear, replayToConnection, recoveryRunIds,
scheduleStartupRecovery, reconcile, hasOutstandingDetachedRuns,
pendingDetachedReconcile, armDetachedBackbone, reconcileTick.

Every fault the tests injected through those seams now acts at a boundary the
capability already depends on: a scripted CHILD adapter installed through the
host port (`getAgentToolsHost` is now exported so a host or test can re-install
a wrapped port), or a public operation — `reconcile` for recovery seals,
`reconcileTick` for detached delivery, `run` for live forwarding. Parent rows
are read with plain SQL in the test agents that already seed them.
`replayToConnection` sent every retained run with all of its stored chunks to
each new connection — an unbounded burst for a parent that has accumulated many
runs or long child transcripts. `AgentToolsOptions.replayOnConnect`, wired from
the `agentToolReplayOnConnect` static option, bounds it:

- `maxRuns` keeps the newest N runs by `started_at` (still emitted oldest-first);
  a cut run sends no frames at all.
- `maxChunksPerRun` keeps the LAST N stored chunks of each run, and the dropped
  chunks still advance the frame sequence, so retained frames carry the same
  sequence numbers an uncapped replay would use and the client's live-vs-replay
  dedupe is unaffected.

Both default to `Infinity`, so behaviour is unchanged unless set. Retention is
untouched: a cut run is still stored and still drillable.
`maxConcurrent` counted awaited and detached runs together, so background work
that piles up starves the foreground turns sharing the budget — and the only
remedy was lowering the total cap for everything. `maxConcurrentDetached`
(`AgentToolsOptions`) and `maxConcurrentDetachedAgentTools` (the live Agent
field, read through the host port like the total cap) bound detached dispatches
on their own. Default `Infinity`, so nothing changes unless set.

Detached runs still count toward the total cap; the detached cap is checked
after it. Either rejection is identical and synchronous: an `error` row, the
`started` + `error` events, no child spawned, and a message naming the cap that
was hit. The live-detached-count warning now points at the detached cap.
- The legacy `cf_ai_chat_agent_tool_runs` fold named `progress_json` and
  `last_signal_at` unconditionally, but `ai-chat` releases predating the
  progress work created that table without them (later releases added them by
  ALTER). Such a deployment upgrading straight to this version threw in
  `onStart` and never became reachable. The copied column list is now the
  intersection of the wanted columns with the legacy table's actual ones.
- `readRun` omitted `detached_on_milestones`, which the warm-tail milestone
  delivery reads, so a milestone reached while the parent was tailing live was
  never notified — only the backbone tick delivered it (latent in the original
  `_readAgentToolRun` too). Fixed with the narrowing commit; the regression test
  lands here.
- The child seal called the host's `output` / `summary` projections for every
  outcome, so user `getAgentToolOutput` / `getAgentToolSummary` overrides with
  completion side effects fired on error, aborted and skipped runs. They are now
  computed only for a `completed` seal, which also stops a non-completed row
  carrying a summary — matching what the parent surfaces for a non-completed
  inspection.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 1 new potential issue.

Devin Review

Comment on lines +211 to +212
const existing = this.#readRun(runId);
if (existing) {

@devin-ai-integration devin-ai-integration Bot Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Reused run ID changes child

Reusing runId with another class makes run() treat the existing row as that class's run. It can resolve the wrong child or return a false detached handle.

Learn more

A run ID is the primary key of cf_agent_tool_runs, so an existing row already fixes the child class in agent_type. The current branch checks only the ID, but later reattachment resolves agentType from the newly supplied class at the child lookup. Completed awaited runs instead return the old row, producing inconsistent behavior across statuses.

Example: A caller starts ResearchAgent with runId: "job-1", then calls run(SummaryAgent, { runId: "job-1" }). A running row causes the parent to resolve a SummaryAgent facet named job-1, although the recorded and active child is ResearchAgent. A detached retry immediately returns { agentType: "SummaryAgent", status: "running" } even though no such child started.

Recommended fix: When an existing row is found, compare existing.agent_type with cls.name. Reject a mismatch with a clear error, or consistently use the persisted class and return its identity. Rejecting is safer because the caller's requested class and input cannot be honored idempotently.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

… React test

The React replay test still called the removed seedInterruptedRunForTest
callable; use sealInterruptedRunForTest, which drives the real reconcile
path against a scripted silent child.
…bility

# Conflicts:
#	packages/agents/src/index.ts
#	packages/think/src/think.ts
…inish hooks

A give-up that tore its child down kept the backbone re-arming forever
because its finish slot never closes. The run now counts as outstanding
for two top-cadence ticks, so a completion racing the cancel still repairs
the row, then settles. A soft no-progress give-up that left the child
running is torn down once the absolute budget passes. A throwing durable
onFinish is reported through onError instead of escaping the tick and
skipping sibling rows and the re-arm. Drop the unused schema helper left
behind by the queue extraction and a duplicated JSDoc in the child role.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment on lines +359 to +367
const input = parseValue(row.input_json);
return this.#inspectionFromRow(
row,
this.#hostOrUndefined()?.output(
runId,
this.#messagesAfterStart(runId),
input
)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Non-completed inspections invoke output hooks

Inspecting an errored, aborted, or running child calls host.output. User output hooks can run completion side effects for non-completed outcomes.

Learn more

Child output projections are user-overridable hooks and can perform completion side effects. The terminal sealing path now limits them to completed turns, but inspection evaluates host.output for every status before #inspectionFromRow receives the value. This also regresses AIChatAgent's previous inspection behavior, which gated getAgentToolOutput on status === "completed".

Example: An aborted run has no stored output. A later parent reconciliation inspects it, invokes an override that records billing, then reports the run as aborted.

Recommended fix: Evaluate host.output only when row.status === "completed"; pass undefined for every other status.

Suggested change
const input = parseValue(row.input_json);
return this.#inspectionFromRow(
row,
this.#hostOrUndefined()?.output(
runId,
this.#messagesAfterStart(runId),
input
)
);
const input = parseValue(row.input_json);
const output =
row.status === "completed"
? this.#hostOrUndefined()?.output(
runId,
this.#messagesAfterStart(runId),
input
)
: undefined;
return this.#inspectionFromRow(row, output);
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +2738 to +2745
void Promise.resolve(
this.#host.deliverDetachedMilestone(runInfo, milestone, mode)
).catch((error) => {
console.error(
`[agents] detached milestone delivery threw for run ${runInfo.runId} (${milestone.name}):`,
error instanceof Error ? error.message : String(error)
);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Milestone delivery loses execution lifetime

Configured milestones start deliverDetachedMilestone without awaiting or retaining it. The enclosing alarm or warm tail can finish before notification persistence completes.

Learn more

Milestone delivery can persist a synthetic chat message and, in react mode, run a model turn. #maybeDeliverMilestone drops that promise after attaching a rejection handler. Neither the reconcile alarm nor the detached fast path retains it through the host's execution-lifetime mechanism.

Example: A detached child reaches sources-gathered immediately before completion. The warm tail starts the notification, then completes terminal delivery and releases its waitUntil; eviction can interrupt the notification before its message persists.

Recommended fix: Make #maybeDeliverMilestone asynchronous and await it from both warm and reconcile paths, or pass the delivery promise to AgentToolsHost.waitUntil. Preserve rejection handling so one failed notification does not abort sibling reconciliation.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@mattzcarey
mattzcarey marked this pull request as draft September 25, 2026 16:03
@mattzcarey

Copy link
Copy Markdown
Member Author

Closing: Think is moving onto the driver-based ThinkHarness (#2396). This will be revisited there.

@mattzcarey mattzcarey closed this Sep 28, 2026
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.

1 participant