v1.66.4
CopilotKit v1.66.4
A patch release on the 1.66 line, covering the combined v1.66.2 → v1.66.4 range — 1.66.3 shipped to npm without a GitHub release; its changes are included below. The headline is a bounded in-memory agent runner that no longer grows until the process OOMs (#5837), Channel status split into transport and provider legs so status() stops reporting online for a Channel with no provider app bound (#6360), and a set of HITL run-identity fixes that stop follow-up runs duplicating tool calls or losing their own (#6296, #6411, #6407).
Install
npm install @copilotkit/react-core@1.66.4 @copilotkit/react-ui@1.66.4 @copilotkit/runtime@1.66.4Features
- Channel status reports transport and provider legs separately (
@copilotkit/runtime) —status().overall === "online"proved only that the runtime reached the Gateway with a valid project key, so a Channel with no Slack/Teams app attached still reportedonline. The runtime now captures the Gateway's control join reply, andstatus()gains a per-channeldetailreportingtransportandproviderseparately;overallandchannelsfold both legs, so a joined Channel with no provider attached reportssetup_required. The fold is conservative — an older Gateway, a failed lookup, or an unrecognized state yieldsunknownand keeps today's transport-derived status, so no existing deployment turns amber on upgrade — and provider attachment is re-read on every gateway rejoin, so a Channel provisioned while the runtime was disconnected is picked up automatically. The gateway side ships with Channelsv0.8.0. (#6360)
Runtime fixes (@copilotkit/runtime)
- The in-memory agent runner is bounded — no more OOM —
InMemoryAgentRunner(the default runner when the runtime has no Intelligence backend) kept every thread, every run, and a per-runReplaySubject(Infinity)buffer in an unbounded process-globalMap; one production deployment hit a fatal V8 OOM after ~173 threads / ~15.5k runs. Storage now goes through a bounded store with three defaults —maxThreads: 1000(LRU),maxRunsPerThread: 100(FIFO;0/Infinitydisables),maxBytes: 512 MiB— tunable on the existingInMemoryAgentRunneroptions bag. The store never evicts a running or still-finalizing thread, releases run buffers once a run completes, logs evictions through a warn-once latch, and clamps invalid limits with a warning instead of crashing. Superseded or stopped runs also get isolated teardown, so a replaced run can no longer leak a duplicateRUN_STARTEDor a syntheticRUN_ERRORinto the live run's stream. (#5837) AGUISendStateDeltainitializes arrays before/-append — a state delta appending to an array that no prior state event had initialized produced a patch that failed event compaction withOPERATION_PATH_CANNOT_ADD. The runtime now emits the authoritative input state before the first delta when needed and initializes a missing array immediately before its first/-append, across the generic, AI SDK, and TanStack state-delta paths; existing arrays and valid deltas keep their contents and operation order. (#6293, fixes #5998)- Unenforceable
mcpAppstool policy is rejected instead of silently ignored —mcpApps.serversentries carryingincludeTools/excludeToolswere accepted even though the pinned@ag-ui/mcp-apps-middleware@0.0.3has no such option, so tools an operator meant to restrict stayed available. The runtime now returns a configuration error naming the unsupported key, server, and owning package before constructing the middleware; once the middleware supports the fields, the rejection can be removed. (#6292) - No more value-less activity patches from open generative UI — when the model emitted
jsFunctionsorcssasnull, the open-gen-UI middleware produced a JSON Patchaddop with novalue, which clients rejected withOPERATION_VALUE_REQUIRED(Failed to apply activity patch …) and dropped the whole patch. Value-less param deltas are now skipped; empty arrays and completion markers likejsFunctionsCompletestill emit. (#6396)
Core fixes (@copilotkit/core)
- HITL follow-ups keep one logical run id — without confusing the transport — resolving a legacy
useCopilotAction({ renderAndWaitForResponse })tool used to split one logical run into two run ids, breaking external tracing (#6296, fixes #3456). Pinning the originating id on the wire then made the transport treat the follow-up as resuming a finished run — re-delivering that run's already-applied tool calls (each duplicate with empty arguments) and keeping the continuation's own tool call from ever reaching client state. The state manager now re-stamps the continuation's events onto the expected logical id while the wire carries a fresh run id, so tracing still sees one run and nothing is re-delivered. (#6411)
React fixes (@copilotkit/react-core)
- Duplicate tool-call ids collapse in the message view — when a
TOOL_CALL_STARTwas applied twice (as the HITL flow could trigger afterrespond()), the assistant message carried the same call id twice; the second copy had empty arguments and rendered as a blank duplicate card, along with React's duplicate-key warning.deduplicateMessages()now also collapses duplicate call ids within a message, preferring the copy that carries arguments, and returns the original array untouched when there is nothing to collapse. (#6407)
Web inspector fixes (@copilotkit/web-inspector)
- Step lifecycle events are recorded — the inspector did not record
STEP_STARTED/STEP_FINISHEDfrom live agent events; both are now recorded and selectable in the event filter. (#6323, fixes #6324)
Dependencies
@ag-ui/*unchanged from1.66.2—@ag-ui/langgraphat0.0.42,@ag-ui/a2ui-middlewareat0.0.10,@ag-ui/mcp-apps-middlewareat0.0.3,@ag-ui/mcp-middlewareat0.0.1,@ag-ui/core/@ag-ui/client/@ag-ui/encoderat0.0.57.@copilotkit/license-verifierstays at~0.5.0.
Packages republished at 1.66.4
@copilotkit/runtime, @copilotkit/react-core, @copilotkit/react-ui, @copilotkit/react-native, @copilotkit/core, @copilotkit/shared, @copilotkit/runtime-client-gql, @copilotkit/sdk-js, @copilotkit/vue, @copilotkit/voice, @copilotkit/web-inspector, @copilotkit/web-components, @copilotkit/a2ui-renderer, @copilotkit/react-textarea, @copilotkit/sqlite-runner, and @copilotkit/agentcore-runner.