Skip to content

v1.57.1

Choose a tag to compare

@github-actions github-actions released this 07 May 17:18
· 2235 commits to main since this release
8f4b7ad

CopilotKit v1.57.1

A patch release on the 1.57 line. Adds @copilotkit/react-native for using CopilotKit hooks in React Native apps, ships registerProxiedAgent for mounting frontend tools/context against a single runtime agent, adds a per-call getHeaders resolver to BuiltInAgent's MCP server config, and auto-mounts the IntelligenceIndicator pill when intelligence is configured on the runtime.

Install

npm install @copilotkit/react-core@1.57.1 @copilotkit/react-ui@1.57.1 @copilotkit/runtime@1.57.1

Features

  • @copilotkit/react-native — New package for using CopilotKit in React Native apps. Ships a lightweight CopilotKitProvider (no DOM, CSS, Radix, Lit, or A2UI deps), an installStreamingFetch() XHR-based shim that gives response.body.getReader() support, and granular polyfills for ReadableStream, TextEncoder, crypto, DOMException, and window.location. All hooks (useAgent, useFrontendTool, useHumanInTheLoop, etc.) re-export directly from react-core over a shared context. Backed by an extraction of CopilotKitContext and useCopilotKit into a standalone @copilotkit/react-core/v2/context entry point so cross-platform consumers don't pull web-only deps via the barrel. (#3633)

    // index.js — entry point, before other imports
    import "@copilotkit/react-native/polyfills";
    import { installStreamingFetch } from "@copilotkit/react-native";
    installStreamingFetch();
    
    // App.tsx
    import { CopilotKitProvider, useAgent } from "@copilotkit/react-native";
  • registerProxiedAgent in @copilotkit/core — New API for mounting a frontend-side agent (with frontend tools, context, render hooks) against a server-defined runtime agent. CopilotKitCore.registerProxiedAgent({ agentId, runtimeAgentId }) mints a ProxiedCopilotRuntimeAgent under a local registry id and routes its outbound HTTP requests (/agent/<id>/run, /connect, /stop) to the named runtime agent. Returns { agent, unregister } for useEffect cleanup. Throws on duplicate agentId (collisions with agents__unsafe_dev_only or another registerProxiedAgent are loud, not silent). Replaces the implicit per-thread agent cloning from earlier work, which has been reverted because it wiped agent state on tool calls — the registry now keeps a single agent per id. (#4629)

    const { copilotkit } = useCopilotKit();
    useEffect(() => {
      const { unregister } = copilotkit.registerProxiedAgent({
        agentId: "chat-1",         // local registry id (subscriber bookkeeping)
        runtimeAgentId: "default", // runtime id (URL routing only)
      });
      return unregister;
    }, [copilotkit]);
    // <CopilotChat agentId="chat-1" />
  • Configurable MCP server on BuiltInAgent@copilotkit/runtime/v2's BuiltInAgent MCP config now accepts an authToken (static Bearer shorthand) and a getHeaders resolver that runs on every outbound HTTP request — initialize, tools/list, tools/call, reconnects. The resolver receives MCPRequestContext (requestHeaders, input, mcpServerUrl) so headers can be derived per request rather than baked into the client config. The MCP layer now sits directly on @ai-sdk/mcp (MCPClient, MCPTransport, OAuthClientProvider, OAuthTokens, and UnauthorizedError re-exported from @copilotkit/runtime/v2); the agent module no longer imports @modelcontextprotocol/sdk directly. Side-effect fix: SSE static headers now reach the wire — the previous direct-SDK construction silently dropped them. (#4420)

    import {
      BuiltInAgent,
      INTELLIGENCE_USER_ID_HEADER,
    } from "@copilotkit/runtime/v2";
    
    new BuiltInAgent({
      model: "openai/gpt-4o",
      mcpServers: [{
        type: "http",
        url: `${process.env.INTELLIGENCE_API_URL}/mcp`,
        authToken: process.env.INTELLIGENCE_API_KEY!,
        getHeaders: ({ requestHeaders }) => {
          const userId = requestHeaders[INTELLIGENCE_USER_ID_HEADER]?.trim();
          if (!userId) throw new Error("missing user-id");
          return { [INTELLIGENCE_USER_ID_HEADER]: userId };
        },
      }],
    });
  • IntelligenceIndicator auto-mounts in @copilotkit/react-core — When intelligence is configured on the runtime (/info returns intelligence), CopilotChatMessageView mounts a "Using CopilotKit Intelligence" pill on the canonical message slot — no factory, no provider, no renderCustomMessages registration. The indicator self-gates: only the last message of the latest in-flight run with a tool call matching DEFAULT_TOOL_PATTERNS (currently [/^bash$/]) renders. Per-instance phase machine (spinner → debounced checkfadinghidden) absorbs step-boundary RUN_FINISHED → RUN_STARTED blips. Pill width follows content; gate no longer depends on getRunIdForMessage; the indicator stays through tool-result interleaving. (#4632)

Dependency hygiene

  • Bump @copilotkit/license-verifier 0.2.0 → 0.4.0 — applied in packages/runtime, packages/shared, and the root pnpm overrides block. (#4699)

Build / packaging

  • @copilotkit/react-native wired into the release system — added to changesets configuration and the release pipeline so the new package is versioned and published alongside the rest of the monorepo. (9328de4a)

Packages republished at 1.57.1

@copilotkit/runtime, @copilotkit/react-core, @copilotkit/react-ui, @copilotkit/react-native, @copilotkit/core, @copilotkit/shared, @copilotkit/runtime-client-gql, @copilotkit/sdk-js, @copilotkit/voice, @copilotkit/web-inspector, @copilotkit/a2ui-renderer, @copilotkit/react-textarea, and @copilotkit/sqlite-runner.