@copilotkit/runtime 1.63.2 → 1.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/agent/index.cjs +19 -3
  2. package/dist/agent/index.cjs.map +1 -1
  3. package/dist/agent/index.d.cts +3 -1
  4. package/dist/agent/index.d.cts.map +1 -1
  5. package/dist/agent/index.d.mts +3 -1
  6. package/dist/agent/index.d.mts.map +1 -1
  7. package/dist/agent/index.mjs +19 -3
  8. package/dist/agent/index.mjs.map +1 -1
  9. package/dist/package.cjs +2 -2
  10. package/dist/runtime/package.mjs +2 -2
  11. package/dist/service-adapters/anthropic/anthropic-adapter.cjs +2 -2
  12. package/dist/service-adapters/anthropic/anthropic-adapter.cjs.map +1 -1
  13. package/dist/service-adapters/anthropic/anthropic-adapter.d.cts.map +1 -1
  14. package/dist/service-adapters/anthropic/anthropic-adapter.d.mts.map +1 -1
  15. package/dist/service-adapters/anthropic/anthropic-adapter.mjs +3 -3
  16. package/dist/service-adapters/anthropic/anthropic-adapter.mjs.map +1 -1
  17. package/dist/service-adapters/anthropic/utils.cjs +20 -0
  18. package/dist/service-adapters/anthropic/utils.cjs.map +1 -1
  19. package/dist/service-adapters/anthropic/utils.mjs +20 -1
  20. package/dist/service-adapters/anthropic/utils.mjs.map +1 -1
  21. package/dist/v2/node.d.cts +2 -2
  22. package/dist/v2/node.d.mts +2 -2
  23. package/dist/v2/runtime/core/channel-manager.cjs +125 -56
  24. package/dist/v2/runtime/core/channel-manager.cjs.map +1 -1
  25. package/dist/v2/runtime/core/channel-manager.d.cts +20 -9
  26. package/dist/v2/runtime/core/channel-manager.d.cts.map +1 -1
  27. package/dist/v2/runtime/core/channel-manager.d.mts +20 -9
  28. package/dist/v2/runtime/core/channel-manager.d.mts.map +1 -1
  29. package/dist/v2/runtime/core/channel-manager.mjs +125 -56
  30. package/dist/v2/runtime/core/channel-manager.mjs.map +1 -1
  31. package/dist/v2/runtime/endpoints/express.cjs.map +1 -1
  32. package/dist/v2/runtime/endpoints/express.d.cts +5 -4
  33. package/dist/v2/runtime/endpoints/express.d.cts.map +1 -1
  34. package/dist/v2/runtime/endpoints/express.d.mts +5 -4
  35. package/dist/v2/runtime/endpoints/express.d.mts.map +1 -1
  36. package/dist/v2/runtime/endpoints/express.mjs.map +1 -1
  37. package/dist/v2/runtime/endpoints/hono.cjs.map +1 -1
  38. package/dist/v2/runtime/endpoints/hono.d.cts +5 -4
  39. package/dist/v2/runtime/endpoints/hono.d.cts.map +1 -1
  40. package/dist/v2/runtime/endpoints/hono.d.mts +5 -4
  41. package/dist/v2/runtime/endpoints/hono.d.mts.map +1 -1
  42. package/dist/v2/runtime/endpoints/hono.mjs.map +1 -1
  43. package/dist/v2/runtime/endpoints/node.cjs +0 -26
  44. package/dist/v2/runtime/endpoints/node.cjs.map +1 -1
  45. package/dist/v2/runtime/endpoints/node.d.cts +54 -6
  46. package/dist/v2/runtime/endpoints/node.d.cts.map +1 -1
  47. package/dist/v2/runtime/endpoints/node.d.mts +54 -6
  48. package/dist/v2/runtime/endpoints/node.d.mts.map +1 -1
  49. package/dist/v2/runtime/endpoints/node.mjs +0 -26
  50. package/dist/v2/runtime/endpoints/node.mjs.map +1 -1
  51. package/dist/v2/runtime/intelligence-platform/client.cjs +73 -2
  52. package/dist/v2/runtime/intelligence-platform/client.cjs.map +1 -1
  53. package/dist/v2/runtime/intelligence-platform/client.d.cts +51 -25
  54. package/dist/v2/runtime/intelligence-platform/client.d.cts.map +1 -1
  55. package/dist/v2/runtime/intelligence-platform/client.d.mts +51 -25
  56. package/dist/v2/runtime/intelligence-platform/client.d.mts.map +1 -1
  57. package/dist/v2/runtime/intelligence-platform/client.mjs +73 -2
  58. package/dist/v2/runtime/intelligence-platform/client.mjs.map +1 -1
  59. package/dist/v2/runtime/node.d.cts +1 -1
  60. package/dist/v2/runtime/node.d.mts +1 -1
  61. package/dist/v2/runtime/open-generative-ui-middleware.cjs +4 -1
  62. package/dist/v2/runtime/open-generative-ui-middleware.cjs.map +1 -1
  63. package/dist/v2/runtime/open-generative-ui-middleware.mjs +4 -1
  64. package/dist/v2/runtime/open-generative-ui-middleware.mjs.map +1 -1
  65. package/package.json +7 -7
  66. package/skills/runtime/references/intelligence-mode.md +50 -17
@@ -11,20 +11,35 @@ Obtain `apiKey` and `organizationId` from the CopilotKit Intelligence dashboard.
11
11
 
12
12
  ### URL format
13
13
 
14
- The client prepends `/api/...` and the Intelligence websocket layer derives `/runner`
15
- or `/client` suffixes internally. Pass the bare base URLs — do NOT append `/api`,
14
+ **Omit `apiUrl` and `wsUrl`.** Both default to the managed platform
15
+ (`https://api.intelligence.copilotkit.ai` and
16
+ `wss://realtime.intelligence.copilotkit.ai`), so `apiKey` is the only URL-related
17
+ config you need. Never invent or guess these values — leaving them unset is always
18
+ correct against the managed service.
19
+
20
+ If you do set them (non-production or a future self-hosted deployment), the client
21
+ prepends `/api/...` and the Intelligence websocket layer derives `/runner` or
22
+ `/client` suffixes internally. Pass the bare base URLs — do NOT append `/api`,
16
23
  `/socket`, `/runner`, or `/client` yourself:
17
24
 
18
25
  ```typescript
19
- // Correct — bare base URLs
20
- apiUrl: "https://api.copilotkit.ai",
21
- wsUrl: "wss://api.copilotkit.ai",
26
+ // Correct — bare base URLs, and note the two planes are DIFFERENT hosts
27
+ apiUrl: "https://api.intelligence.copilotkit.ai",
28
+ wsUrl: "wss://realtime.intelligence.copilotkit.ai",
22
29
 
23
30
  // Wrong — adding /api produces /api/api/... on every REST call; /socket/runner is not a real path
24
- apiUrl: "https://api.copilotkit.ai/api",
25
- wsUrl: "wss://api.copilotkit.ai/socket",
31
+ apiUrl: "https://api.intelligence.copilotkit.ai/api",
32
+ wsUrl: "wss://realtime.intelligence.copilotkit.ai/socket",
26
33
  ```
27
34
 
35
+ `apiUrl` and `wsUrl` are **separate hosts** (`api.…` vs `realtime.…`), so you cannot
36
+ produce one from the other by swapping the scheme. Deriving `wsUrl` as
37
+ `apiUrl.replace(/^http/, "ws")` yields `wss://api.intelligence.copilotkit.ai`, which
38
+ serves no socket — and the resulting failure is a silent hang, not an error, because
39
+ the socket layer treats an unreachable host as a retryable reconnect. For the same
40
+ reason, override the two together or not at all: setting one alone leaves the other
41
+ plane on the managed host, which the client warns about at construction.
42
+
28
43
  Source: `packages/runtime/src/v2/runtime/intelligence-platform/client.ts:41-46, 259,
29
44
  356-357, 437, 468, 682-708`.
30
45
 
@@ -38,8 +53,7 @@ import {
38
53
  } from "@copilotkit/runtime/v2";
39
54
 
40
55
  const intelligence = new CopilotKitIntelligence({
41
- apiUrl: "https://api.copilotkit.ai",
42
- wsUrl: "wss://api.copilotkit.ai",
56
+ // apiUrl / wsUrl default to the managed Intelligence platform — leave them unset.
43
57
  apiKey: process.env.COPILOTKIT_INTELLIGENCE_API_KEY!,
44
58
  organizationId: process.env.COPILOTKIT_INTELLIGENCE_ORG_ID!,
45
59
  });
@@ -167,14 +181,22 @@ scoped to a user ID.
167
181
 
168
182
  Source: `packages/runtime/src/v2/runtime/core/runtime.ts:156-160`.
169
183
 
170
- ### CRITICAL Adding /api or /socket suffixes, or pointing at an unsupported self-hosted server
184
+ ### CRITICAL Deriving wsUrl from apiUrl, adding /api or /socket suffixes, or pointing at an unsupported self-hosted server
171
185
 
172
186
  Wrong:
173
187
 
174
188
  ```typescript
175
189
  new CopilotKitIntelligence({
176
- apiUrl: "https://api.copilotkit.ai/api", // double /api prefix
177
- wsUrl: "wss://api.copilotkit.ai/socket", // /socket is not a real path
190
+ apiUrl: "https://api.intelligence.copilotkit.ai",
191
+ // Scheme-swapped from apiUrl — WRONG HOST. Serves no socket; hangs instead of erroring.
192
+ wsUrl: apiUrl.replace(/^http/, "ws"),
193
+ apiKey,
194
+ organizationId,
195
+ });
196
+
197
+ new CopilotKitIntelligence({
198
+ apiUrl: "https://api.intelligence.copilotkit.ai/api", // double /api prefix
199
+ wsUrl: "wss://realtime.intelligence.copilotkit.ai/socket", // /socket is not a real path
178
200
  apiKey,
179
201
  organizationId,
180
202
  });
@@ -185,27 +207,38 @@ new CopilotKitIntelligence({
185
207
  apiKey,
186
208
  organizationId,
187
209
  });
210
+
211
+ new CopilotKitIntelligence({
212
+ // Only one plane overridden — wsUrl silently stays on the managed host. Warns, then hangs.
213
+ apiUrl: "https://api.intelligence.copilotkit.ai",
214
+ apiKey,
215
+ organizationId,
216
+ });
188
217
  ```
189
218
 
190
219
  Correct:
191
220
 
192
221
  ```typescript
193
222
  new CopilotKitIntelligence({
194
- apiUrl: "https://api.copilotkit.ai",
195
- wsUrl: "wss://api.copilotkit.ai",
223
+ // No apiUrl / wsUrl — they default to the managed platform.
196
224
  apiKey: process.env.COPILOTKIT_INTELLIGENCE_API_KEY!,
197
225
  organizationId: process.env.COPILOTKIT_INTELLIGENCE_ORG_ID!,
198
226
  });
199
227
  // For on-prem durability without Intelligence: SSE mode + SqliteAgentRunner.
200
228
  ```
201
229
 
202
- Two failure modes to avoid:
230
+ Three failure modes to avoid:
203
231
 
204
- 1. The client prepends `/api/...` to every REST call (`#request` at line 356-357) and
232
+ 1. The API and realtime planes are **different hosts**, so `wsUrl` cannot be derived
233
+ from `apiUrl`. A scheme-only swap keeps the API host (and port) and produces a URL
234
+ that serves no socket. This one is expensive to debug: a wrong `apiUrl` fails fast
235
+ with an HTTP error, while a wrong `wsUrl` sits in `connecting` until the settle
236
+ timeout and reports only "did not settle in time".
237
+ 2. The client prepends `/api/...` to every REST call (`#request` at line 356-357) and
205
238
  the websocket layer derives `/runner` / `/client` suffixes from `wsUrl` internally.
206
239
  Passing `apiUrl: ".../api"` produces double-prefixed `/api/api/threads`; passing
207
240
  `wsUrl: ".../socket"` produces a broken `.../socket/runner` upgrade path.
208
- 2. Self-hosting Intelligence is not yet supported. The `ɵ`-prefixed runtime internals
241
+ 3. Self-hosting Intelligence is not yet supported. The `ɵ`-prefixed runtime internals
209
242
  and REST/WebSocket contract are still stabilizing. `organizationId` is reserved for
210
243
  future self-hosted instances. For on-prem durable threads today, use SSE mode +
211
244
  `SqliteAgentRunner` (see `copilotkit/agent-runners`).