@copilotkit/runtime 1.70.2 → 1.70.3
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.
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/v2/runtime/core/channel-activation-config.d.cts +1 -0
- package/dist/v2/runtime/core/channel-activation-config.d.cts.map +1 -1
- package/dist/v2/runtime/core/channel-manager.d.cts +2 -0
- package/dist/v2/runtime/core/channel-manager.d.cts.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.cjs +2 -6
- package/dist/v2/runtime/core/fetch-handler.cjs.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.d.cts +0 -7
- package/dist/v2/runtime/core/fetch-handler.d.cts.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.d.mts +0 -7
- package/dist/v2/runtime/core/fetch-handler.d.mts.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.mjs +2 -6
- package/dist/v2/runtime/core/fetch-handler.mjs.map +1 -1
- package/dist/v2/runtime/core/learning.cjs +5 -0
- package/dist/v2/runtime/core/learning.cjs.map +1 -1
- package/dist/v2/runtime/core/learning.d.cts +1 -0
- package/dist/v2/runtime/core/learning.d.cts.map +1 -1
- package/dist/v2/runtime/core/learning.d.mts +1 -0
- package/dist/v2/runtime/core/learning.d.mts.map +1 -1
- package/dist/v2/runtime/core/learning.mjs +5 -1
- package/dist/v2/runtime/core/learning.mjs.map +1 -1
- package/dist/v2/runtime/core/runtime.d.cts +1 -0
- package/dist/v2/runtime/core/runtime.d.cts.map +1 -1
- package/dist/v2/runtime/endpoints/express-fetch-bridge.cjs +1 -2
- package/dist/v2/runtime/endpoints/express-fetch-bridge.cjs.map +1 -1
- package/dist/v2/runtime/endpoints/express-fetch-bridge.mjs +1 -2
- package/dist/v2/runtime/endpoints/express-fetch-bridge.mjs.map +1 -1
- package/dist/v2/runtime/endpoints/express.cjs +1 -2
- package/dist/v2/runtime/endpoints/express.cjs.map +1 -1
- package/dist/v2/runtime/endpoints/express.d.cts +0 -6
- package/dist/v2/runtime/endpoints/express.d.cts.map +1 -1
- package/dist/v2/runtime/endpoints/express.d.mts +0 -6
- package/dist/v2/runtime/endpoints/express.d.mts.map +1 -1
- package/dist/v2/runtime/endpoints/express.mjs +1 -2
- package/dist/v2/runtime/endpoints/express.mjs.map +1 -1
- package/dist/v2/runtime/endpoints/hono.cjs +1 -2
- package/dist/v2/runtime/endpoints/hono.cjs.map +1 -1
- package/dist/v2/runtime/endpoints/hono.d.cts +0 -6
- package/dist/v2/runtime/endpoints/hono.d.cts.map +1 -1
- package/dist/v2/runtime/endpoints/hono.d.mts +0 -6
- package/dist/v2/runtime/endpoints/hono.d.mts.map +1 -1
- package/dist/v2/runtime/endpoints/hono.mjs +1 -2
- package/dist/v2/runtime/endpoints/hono.mjs.map +1 -1
- package/dist/v2/runtime/handlers/get-runtime-info.cjs +3 -2
- package/dist/v2/runtime/handlers/get-runtime-info.cjs.map +1 -1
- package/dist/v2/runtime/handlers/get-runtime-info.mjs +3 -2
- package/dist/v2/runtime/handlers/get-runtime-info.mjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-inspector-learning.cjs +3 -2
- package/dist/v2/runtime/handlers/handle-inspector-learning.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-inspector-learning.mjs +3 -2
- package/dist/v2/runtime/handlers/handle-inspector-learning.mjs.map +1 -1
- package/dist/v2/runtime/index.d.cts +1 -0
- package/dist/v2/runtime/index.d.cts.map +1 -1
- package/dist/v2/runtime/intelligence-platform/index.d.cts +2 -0
- package/package.json +2 -2
- package/skills/runtime/SKILL.md +1 -1
|
@@ -6,7 +6,7 @@ import express from "express";
|
|
|
6
6
|
import cors from "cors";
|
|
7
7
|
|
|
8
8
|
//#region src/v2/runtime/endpoints/express.ts
|
|
9
|
-
function createCopilotExpressHandler({ runtime, basePath, mode = "multi-route", cors: corsOption = true, hooks,
|
|
9
|
+
function createCopilotExpressHandler({ runtime, basePath, mode = "multi-route", cors: corsOption = true, hooks, activateChannels, __channelEngine }) {
|
|
10
10
|
const normalizedBase = normalizeBasePath(basePath);
|
|
11
11
|
const handler = createCopilotRuntimeHandler({
|
|
12
12
|
runtime,
|
|
@@ -14,7 +14,6 @@ function createCopilotExpressHandler({ runtime, basePath, mode = "multi-route",
|
|
|
14
14
|
mode,
|
|
15
15
|
cors: false,
|
|
16
16
|
hooks,
|
|
17
|
-
inspectorLearning,
|
|
18
17
|
activateChannels,
|
|
19
18
|
__channelEngine
|
|
20
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"sourcesContent":["import express from \"express\";\nimport type {\n Request as ExpressRequest,\n Response as ExpressResponse,\n NextFunction,\n Router,\n} from \"express\";\nimport cors from \"cors\";\nimport type { CorsOptions } from \"cors\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { createCopilotRuntimeHandler } from \"../core/fetch-handler\";\nimport type {\n ActivateChannelEngine,\n ChannelsControl,\n} from \"../core/channel-manager\";\nimport { createExpressNodeHandler } from \"./express-fetch-bridge\";\nimport { autoStartChannels } from \"./auto-start-channels\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\n\n/**\n * An Express {@link Router} that may also carry an optional\n * {@link ChannelsControl} surface. The Router object itself is request-scoped\n * middleware, but an Express app can only run inside a long-running\n * `http.Server` — so this wrapper is a lifecycle-owning host like\n * `createCopilotNodeListener`: it STARTS activation of the runtime's declared\n * managed Channels at creation, and `.channels` is here to observe (`ready()`)\n * or tear down (`stop()`) that activation.\n */\nexport type CopilotExpressRouter = Router & { channels?: ChannelsControl };\n\nexport interface CopilotExpressEndpointParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n\n /**\n * Endpoint mode.\n * - `\"multi-route\"` (default): separate routes for each operation\n * - `\"single-route\"`: single POST endpoint with JSON envelope dispatch\n */\n mode?: \"multi-route\" | \"single-route\";\n\n /**\n * CORS configuration for the Express router.\n * - `true` (default): permissive CORS (`origin: \"*\"`, all methods, all headers).\n * - `false`: no CORS middleware is applied — handle it yourself.\n * - object: passed directly to the Express `cors()` middleware.\n */\n cors?: boolean | CorsOptions;\n\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n\n /**\n * Whether
|
|
1
|
+
{"version":3,"file":"express.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"sourcesContent":["import express from \"express\";\nimport type {\n Request as ExpressRequest,\n Response as ExpressResponse,\n NextFunction,\n Router,\n} from \"express\";\nimport cors from \"cors\";\nimport type { CorsOptions } from \"cors\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { createCopilotRuntimeHandler } from \"../core/fetch-handler\";\nimport type {\n ActivateChannelEngine,\n ChannelsControl,\n} from \"../core/channel-manager\";\nimport { createExpressNodeHandler } from \"./express-fetch-bridge\";\nimport { autoStartChannels } from \"./auto-start-channels\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\n\n/**\n * An Express {@link Router} that may also carry an optional\n * {@link ChannelsControl} surface. The Router object itself is request-scoped\n * middleware, but an Express app can only run inside a long-running\n * `http.Server` — so this wrapper is a lifecycle-owning host like\n * `createCopilotNodeListener`: it STARTS activation of the runtime's declared\n * managed Channels at creation, and `.channels` is here to observe (`ready()`)\n * or tear down (`stop()`) that activation.\n */\nexport type CopilotExpressRouter = Router & { channels?: ChannelsControl };\n\nexport interface CopilotExpressEndpointParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n\n /**\n * Endpoint mode.\n * - `\"multi-route\"` (default): separate routes for each operation\n * - `\"single-route\"`: single POST endpoint with JSON envelope dispatch\n */\n mode?: \"multi-route\" | \"single-route\";\n\n /**\n * CORS configuration for the Express router.\n * - `true` (default): permissive CORS (`origin: \"*\"`, all methods, all headers).\n * - `false`: no CORS middleware is applied — handle it yourself.\n * - object: passed directly to the Express `cors()` middleware.\n */\n cors?: boolean | CorsOptions;\n\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n\n /**\n * Whether the underlying handler builds the control surface for the runtime's\n * declared managed Channels — and, because Express is a long-running host,\n * starts their activation at creation. Defaults to `true`. Set `false` to\n * build no surface and open no socket (tests, short-lived scripts). See\n * `CopilotRuntimeHandlerOptions.activateChannels`.\n */\n activateChannels?: boolean;\n\n /**\n * @internal Test seam: inject a fake Channel activation engine. Forwarded\n * to `createCopilotRuntimeHandler`. Not part of the public API.\n */\n __channelEngine?: ActivateChannelEngine;\n}\n\n/**\n * Creates an Express router that serves the CopilotKit runtime.\n *\n * In **multi-route** mode (default) the router exposes:\n * - `GET {basePath}/info` — runtime info\n * - `POST {basePath}/agent/:agentId/run` — start an agent run\n * - `POST {basePath}/agent/:agentId/connect` — connect to an agent run\n * - `POST {basePath}/agent/:agentId/stop/:threadId` — stop an agent run\n * - `POST {basePath}/transcribe` — transcribe audio\n *\n * In **single-route** mode a single `POST {basePath}` endpoint accepts a JSON\n * envelope `{ method, params, body }` and dispatches to the appropriate handler.\n *\n * @example\n * ```typescript\n * import express from \"express\";\n * import { CopilotRuntime } from \"@copilotkit/runtime/v2\";\n * import { createCopilotExpressHandler } from \"@copilotkit/runtime/v2/express\";\n *\n * const runtime = new CopilotRuntime({\n * agents: { default: new BuiltInAgent({ model: \"openai/gpt-4o-mini\" }) },\n * });\n *\n * const app = express();\n * app.use(createCopilotExpressHandler({\n * runtime,\n * basePath: \"/api/copilotkit\",\n * cors: true,\n * }));\n * app.listen(4000);\n * ```\n *\n * @example Single-route mode with lifecycle hooks\n * ```typescript\n * app.use(createCopilotExpressHandler({\n * runtime,\n * basePath: \"/api/copilotkit\",\n * mode: \"single-route\",\n * hooks: {\n * onRequest: ({ request }) => {\n * if (!request.headers.get(\"authorization\")) {\n * throw new Response(\"Unauthorized\", { status: 401 });\n * }\n * },\n * },\n * }));\n * ```\n */\n/** @deprecated Use `createCopilotExpressHandler` instead. */\nexport { createCopilotExpressHandler as createCopilotEndpointExpress };\n\nexport function createCopilotExpressHandler({\n runtime,\n basePath,\n mode = \"multi-route\",\n cors: corsOption = true,\n hooks,\n activateChannels,\n __channelEngine,\n}: CopilotExpressEndpointParams): CopilotExpressRouter {\n const normalizedBase = normalizeBasePath(basePath);\n\n const handler = createCopilotRuntimeHandler({\n runtime,\n basePath: normalizedBase,\n mode,\n cors: false, // CORS is handled at the Express middleware layer\n hooks,\n activateChannels,\n __channelEngine,\n });\n\n const nodeHandler = createExpressNodeHandler(handler);\n\n const expressHandler = async (\n req: ExpressRequest,\n res: ExpressResponse,\n next: NextFunction,\n ) => {\n try {\n await nodeHandler(req, res);\n } catch (err) {\n next(err);\n }\n };\n\n const router = express.Router();\n\n // CORS middleware\n if (corsOption) {\n const corsConfig: CorsOptions =\n corsOption === true\n ? {\n origin: \"*\",\n methods: [\n \"GET\",\n \"HEAD\",\n \"PUT\",\n \"POST\",\n \"DELETE\",\n \"PATCH\",\n \"OPTIONS\",\n ],\n allowedHeaders: [\"*\"],\n }\n : corsOption;\n router.use(cors(corsConfig));\n }\n\n // Route mounting\n if (mode === \"single-route\") {\n router.post(normalizedBase, expressHandler);\n router.options(normalizedBase, expressHandler);\n } else if (normalizedBase === \"/\") {\n router.all(/.*/, expressHandler);\n } else {\n router.all(\n new RegExp(`^${escapeRegExp(normalizedBase)}(\\\\/.*)?$`),\n expressHandler,\n );\n }\n\n const exposedRouter: CopilotExpressRouter = router;\n exposedRouter.channels = handler.channels;\n autoStartChannels(exposedRouter.channels);\n return exposedRouter;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction normalizeBasePath(path: string): string {\n if (!path) {\n throw new Error(\"basePath must be provided for Express endpoint\");\n }\n\n if (!path.startsWith(\"/\")) {\n return `/${path}`;\n }\n\n if (path.length > 1 && path.endsWith(\"/\")) {\n return path.slice(0, -1);\n }\n\n return path;\n}\n"],"mappings":";;;;;;;;AAyHA,S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.ts
|
|
7
7
|
/** @deprecated Use `createCopilotHonoHandler` instead. */
|
|
8
8
|
const createCopilotEndpoint = createCopilotHonoHandler;
|
|
9
|
-
function createCopilotHonoHandler({ runtime, basePath, mode = "multi-route", cors: corsConfig, hooks,
|
|
9
|
+
function createCopilotHonoHandler({ runtime, basePath, mode = "multi-route", cors: corsConfig, hooks, activateChannels, __channelEngine }) {
|
|
10
10
|
const handler = require_fetch_handler.createCopilotRuntimeHandler({
|
|
11
11
|
runtime,
|
|
12
12
|
basePath,
|
|
13
13
|
mode,
|
|
14
14
|
cors: corsConfig ? toFetchCorsConfig(corsConfig) : true,
|
|
15
15
|
hooks,
|
|
16
|
-
inspectorLearning,
|
|
17
16
|
activateChannels,
|
|
18
17
|
__channelEngine
|
|
19
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono.cjs","names":["createCopilotRuntimeHandler","Hono"],"sources":["../../../../src/v2/runtime/endpoints/hono.ts"],"sourcesContent":["import { Hono } from \"hono\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { createCopilotRuntimeHandler } from \"../core/fetch-handler\";\nimport type { CopilotCorsConfig } from \"../core/fetch-cors\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\nimport type {\n ActivateChannelEngine,\n ChannelsControl,\n} from \"../core/channel-manager\";\n\n/**\n * A Hono app that may also carry an optional {@link ChannelsControl} surface.\n *\n * Unlike the Node and Express wrappers — which own a process and therefore START\n * managed-Channel activation at creation (OSS-641) — this wrapper stays LAZY:\n * activation is triggered by the first `app.channels.ready()` and never before.\n * A Hono app is multi-runtime and is our edge/serverless surface in practice:\n * every Next.js App Router route handler in `examples/showcases/*` builds one at\n * module scope, and those isolates freeze and recycle per request. Auto-starting\n * there would mint a competing listener for the same Channel on every cold\n * start, which is exactly what the lazy design exists to prevent (see the\n * `createCopilotRuntimeHandler` TSDoc).\n *\n * So on a LONG-RUNNING Hono host (`@hono/node-server`, Bun, Deno) calling\n * `await app.channels.ready()` once at startup is REQUIRED to connect declared\n * Channels; on an edge/serverless host do NOT call it.\n */\nexport type CopilotHonoApp = Hono & { channels?: ChannelsControl };\n\n/**\n * CORS configuration for CopilotKit endpoints.\n * When using credentials (e.g., HTTP-only cookies), you must specify an explicit origin.\n */\nexport interface CopilotEndpointCorsConfig {\n /**\n * Allowed origin(s) for CORS. Can be:\n * - A string: exact origin (e.g., \"https://myapp.com\")\n * - An array: list of allowed origins\n * - A function: dynamic origin resolution\n *\n * Note: When credentials is true, origin cannot be \"*\"\n */\n origin:\n | string\n | string[]\n | ((origin: string, c: any) => string | undefined | null);\n /**\n * Whether to allow credentials (cookies, HTTP authentication).\n * When true, origin must be explicitly specified (not \"*\").\n */\n credentials?: boolean;\n}\n\ninterface CopilotEndpointParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n\n /**\n * Endpoint mode.\n * - `\"multi-route\"` (default): separate routes for each operation\n * - `\"single-route\"`: single POST endpoint with JSON envelope dispatch\n */\n mode?: \"multi-route\" | \"single-route\";\n\n /**\n * Optional CORS configuration. When not provided, defaults to allowing all origins without credentials.\n * To support HTTP-only cookies, provide cors config with credentials: true and explicit origin.\n */\n cors?: CopilotEndpointCorsConfig;\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n\n /**\n * Whether
|
|
1
|
+
{"version":3,"file":"hono.cjs","names":["createCopilotRuntimeHandler","Hono"],"sources":["../../../../src/v2/runtime/endpoints/hono.ts"],"sourcesContent":["import { Hono } from \"hono\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { createCopilotRuntimeHandler } from \"../core/fetch-handler\";\nimport type { CopilotCorsConfig } from \"../core/fetch-cors\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\nimport type {\n ActivateChannelEngine,\n ChannelsControl,\n} from \"../core/channel-manager\";\n\n/**\n * A Hono app that may also carry an optional {@link ChannelsControl} surface.\n *\n * Unlike the Node and Express wrappers — which own a process and therefore START\n * managed-Channel activation at creation (OSS-641) — this wrapper stays LAZY:\n * activation is triggered by the first `app.channels.ready()` and never before.\n * A Hono app is multi-runtime and is our edge/serverless surface in practice:\n * every Next.js App Router route handler in `examples/showcases/*` builds one at\n * module scope, and those isolates freeze and recycle per request. Auto-starting\n * there would mint a competing listener for the same Channel on every cold\n * start, which is exactly what the lazy design exists to prevent (see the\n * `createCopilotRuntimeHandler` TSDoc).\n *\n * So on a LONG-RUNNING Hono host (`@hono/node-server`, Bun, Deno) calling\n * `await app.channels.ready()` once at startup is REQUIRED to connect declared\n * Channels; on an edge/serverless host do NOT call it.\n */\nexport type CopilotHonoApp = Hono & { channels?: ChannelsControl };\n\n/**\n * CORS configuration for CopilotKit endpoints.\n * When using credentials (e.g., HTTP-only cookies), you must specify an explicit origin.\n */\nexport interface CopilotEndpointCorsConfig {\n /**\n * Allowed origin(s) for CORS. Can be:\n * - A string: exact origin (e.g., \"https://myapp.com\")\n * - An array: list of allowed origins\n * - A function: dynamic origin resolution\n *\n * Note: When credentials is true, origin cannot be \"*\"\n */\n origin:\n | string\n | string[]\n | ((origin: string, c: any) => string | undefined | null);\n /**\n * Whether to allow credentials (cookies, HTTP authentication).\n * When true, origin must be explicitly specified (not \"*\").\n */\n credentials?: boolean;\n}\n\ninterface CopilotEndpointParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n\n /**\n * Endpoint mode.\n * - `\"multi-route\"` (default): separate routes for each operation\n * - `\"single-route\"`: single POST endpoint with JSON envelope dispatch\n */\n mode?: \"multi-route\" | \"single-route\";\n\n /**\n * Optional CORS configuration. When not provided, defaults to allowing all origins without credentials.\n * To support HTTP-only cookies, provide cors config with credentials: true and explicit origin.\n */\n cors?: CopilotEndpointCorsConfig;\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n\n /**\n * Whether the underlying handler builds the control surface for the runtime's\n * declared managed Channels. Defaults to `true`. Building it opens no\n * connection — activation is deferred to the first `channels.ready()`. See\n * `CopilotRuntimeHandlerOptions.activateChannels`.\n */\n activateChannels?: boolean;\n\n /**\n * @internal Test seam: inject a fake Channel activation engine. Forwarded\n * to `createCopilotRuntimeHandler`. Not part of the public API.\n */\n __channelEngine?: ActivateChannelEngine;\n}\n/** @deprecated Use `createCopilotHonoHandler` instead. */\nexport const createCopilotEndpoint = createCopilotHonoHandler;\n\nexport function createCopilotHonoHandler({\n runtime,\n basePath,\n mode = \"multi-route\",\n cors: corsConfig,\n hooks,\n activateChannels,\n __channelEngine,\n}: CopilotEndpointParams): CopilotHonoApp {\n const handler = createCopilotRuntimeHandler({\n runtime,\n basePath,\n mode,\n cors: corsConfig ? toFetchCorsConfig(corsConfig) : true,\n hooks,\n activateChannels,\n __channelEngine,\n });\n\n const app = new Hono();\n\n const scopedApp: CopilotHonoApp = app\n .basePath(basePath)\n .all(\"*\", async (c) => handler(c.req.raw));\n scopedApp.channels = handler.channels;\n return scopedApp;\n}\n\n/**\n * Convert Hono-specific CORS config to the fetch handler's CopilotCorsConfig.\n */\nexport function toFetchCorsConfig(\n config: CopilotEndpointCorsConfig,\n): CopilotCorsConfig {\n const origin = config.origin;\n return {\n origin:\n typeof origin === \"function\"\n ? (reqOrigin: string) => origin(reqOrigin, undefined) ?? null\n : origin,\n credentials: config.credentials,\n };\n}\n"],"mappings":";;;;;;;AAyFA,MAAa,wBAAwB;AAErC,SAAgB,yBAAyB,EACvC,SACA,UACA,OAAO,eACP,MAAM,YACN,OACA,kBACA,mBACwC;CACxC,MAAM,UAAUA,kDAA4B;EAC1C;EACA;EACA;EACA,MAAM,aAAa,kBAAkB,WAAW,GAAG;EACnD;EACA;EACA;EACD,CAAC;CAIF,MAAM,YAFM,IAAIC,WAAM,CAGnB,SAAS,SAAS,CAClB,IAAI,KAAK,OAAO,MAAM,QAAQ,EAAE,IAAI,IAAI,CAAC;AAC5C,WAAU,WAAW,QAAQ;AAC7B,QAAO;;;;;AAMT,SAAgB,kBACd,QACmB;CACnB,MAAM,SAAS,OAAO;AACtB,QAAO;EACL,QACE,OAAO,WAAW,cACb,cAAsB,OAAO,WAAW,OAAU,IAAI,OACvD;EACN,aAAa,OAAO;EACrB"}
|
|
@@ -64,11 +64,6 @@ interface CopilotEndpointParams {
|
|
|
64
64
|
* Lifecycle hooks for request processing.
|
|
65
65
|
*/
|
|
66
66
|
hooks?: CopilotRuntimeHooks;
|
|
67
|
-
/**
|
|
68
|
-
* Whether to expose the debug-gated Inspector Learning snapshot route.
|
|
69
|
-
* Defaults to `false`.
|
|
70
|
-
*/
|
|
71
|
-
inspectorLearning?: boolean;
|
|
72
67
|
/**
|
|
73
68
|
* Whether the underlying handler builds the control surface for the runtime's
|
|
74
69
|
* declared managed Channels. Defaults to `true`. Building it opens no
|
|
@@ -90,7 +85,6 @@ declare function createCopilotHonoHandler({
|
|
|
90
85
|
mode,
|
|
91
86
|
cors: corsConfig,
|
|
92
87
|
hooks,
|
|
93
|
-
inspectorLearning,
|
|
94
88
|
activateChannels,
|
|
95
89
|
__channelEngine
|
|
96
90
|
}: CopilotEndpointParams): CopilotHonoApp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono.d.cts","names":[],"sources":["../../../../src/v2/runtime/endpoints/hono.ts"],"mappings":";;;;;;;;;;AA2BA;;;;;;;;;AAMA;;;;;;KANY,cAAA,GAAiB,IAAA;EAAS,QAAA,GAAW,eAAA;AAAA;;AAwBhD;;;UAlBgB,yBAAA;EAmCR;;;;;;;;EA1BP,MAAA,wBAGM,MAAA,UAAgB,CAAA;EAuBtB;;;;EAlBA,WAAA;AAAA;AAAA,UAGQ,qBAAA;EACR,OAAA,EAAS,kBAAA;EACT,QAAA;
|
|
1
|
+
{"version":3,"file":"hono.d.cts","names":[],"sources":["../../../../src/v2/runtime/endpoints/hono.ts"],"mappings":";;;;;;;;;;AA2BA;;;;;;;;;AAMA;;;;;;KANY,cAAA,GAAiB,IAAA;EAAS,QAAA,GAAW,eAAA;AAAA;;AAwBhD;;;UAlBgB,yBAAA;EAmCR;;;;;;;;EA1BP,MAAA,wBAGM,MAAA,UAAgB,CAAA;EAuBtB;;;;EAlBA,WAAA;AAAA;AAAA,UAGQ,qBAAA;EACR,OAAA,EAAS,kBAAA;EACT,QAAA;EAkCW;;;;;EA3BX,IAAA;EA6BsC;;;;EAvBtC,IAAA,GAAO,yBAAA;EA2BD;;;EAvBN,KAAA,GAAQ,mBAAA;EA2BP;;;;;;EAnBD,gBAAA;EAaA;;;;EAPA,eAAA,GAAkB,qBAAA;AAAA;;cAGP,qBAAA,SAAqB,wBAAA;AAAA,iBAElB,wBAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA,EAAM,UAAA;EACN,KAAA;EACA,gBAAA;EACA;AAAA,GACC,qBAAA,GAAwB,cAAA;;;;iBAuBX,iBAAA,CACd,MAAA,EAAQ,yBAAA,GACP,iBAAA"}
|
|
@@ -64,11 +64,6 @@ interface CopilotEndpointParams {
|
|
|
64
64
|
* Lifecycle hooks for request processing.
|
|
65
65
|
*/
|
|
66
66
|
hooks?: CopilotRuntimeHooks;
|
|
67
|
-
/**
|
|
68
|
-
* Whether to expose the debug-gated Inspector Learning snapshot route.
|
|
69
|
-
* Defaults to `false`.
|
|
70
|
-
*/
|
|
71
|
-
inspectorLearning?: boolean;
|
|
72
67
|
/**
|
|
73
68
|
* Whether the underlying handler builds the control surface for the runtime's
|
|
74
69
|
* declared managed Channels. Defaults to `true`. Building it opens no
|
|
@@ -90,7 +85,6 @@ declare function createCopilotHonoHandler({
|
|
|
90
85
|
mode,
|
|
91
86
|
cors: corsConfig,
|
|
92
87
|
hooks,
|
|
93
|
-
inspectorLearning,
|
|
94
88
|
activateChannels,
|
|
95
89
|
__channelEngine
|
|
96
90
|
}: CopilotEndpointParams): CopilotHonoApp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono.d.mts","names":[],"sources":["../../../../src/v2/runtime/endpoints/hono.ts"],"mappings":";;;;;;;;;;AA2BA;;;;;;;;;AAMA;;;;;;KANY,cAAA,GAAiB,IAAA;EAAS,QAAA,GAAW,eAAA;AAAA;;AAwBhD;;;UAlBgB,yBAAA;EAmCR;;;;;;;;EA1BP,MAAA,wBAGM,MAAA,UAAgB,CAAA;EAuBtB;;;;EAlBA,WAAA;AAAA;AAAA,UAGQ,qBAAA;EACR,OAAA,EAAS,kBAAA;EACT,QAAA;
|
|
1
|
+
{"version":3,"file":"hono.d.mts","names":[],"sources":["../../../../src/v2/runtime/endpoints/hono.ts"],"mappings":";;;;;;;;;;AA2BA;;;;;;;;;AAMA;;;;;;KANY,cAAA,GAAiB,IAAA;EAAS,QAAA,GAAW,eAAA;AAAA;;AAwBhD;;;UAlBgB,yBAAA;EAmCR;;;;;;;;EA1BP,MAAA,wBAGM,MAAA,UAAgB,CAAA;EAuBtB;;;;EAlBA,WAAA;AAAA;AAAA,UAGQ,qBAAA;EACR,OAAA,EAAS,kBAAA;EACT,QAAA;EAkCW;;;;;EA3BX,IAAA;EA6BsC;;;;EAvBtC,IAAA,GAAO,yBAAA;EA2BD;;;EAvBN,KAAA,GAAQ,mBAAA;EA2BP;;;;;;EAnBD,gBAAA;EAaA;;;;EAPA,eAAA,GAAkB,qBAAA;AAAA;;cAGP,qBAAA,SAAqB,wBAAA;AAAA,iBAElB,wBAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA,EAAM,UAAA;EACN,KAAA;EACA,gBAAA;EACA;AAAA,GACC,qBAAA,GAAwB,cAAA;;;;iBAuBX,iBAAA,CACd,MAAA,EAAQ,yBAAA,GACP,iBAAA"}
|
|
@@ -5,14 +5,13 @@ import { Hono } from "hono";
|
|
|
5
5
|
//#region src/v2/runtime/endpoints/hono.ts
|
|
6
6
|
/** @deprecated Use `createCopilotHonoHandler` instead. */
|
|
7
7
|
const createCopilotEndpoint = createCopilotHonoHandler;
|
|
8
|
-
function createCopilotHonoHandler({ runtime, basePath, mode = "multi-route", cors: corsConfig, hooks,
|
|
8
|
+
function createCopilotHonoHandler({ runtime, basePath, mode = "multi-route", cors: corsConfig, hooks, activateChannels, __channelEngine }) {
|
|
9
9
|
const handler = createCopilotRuntimeHandler({
|
|
10
10
|
runtime,
|
|
11
11
|
basePath,
|
|
12
12
|
mode,
|
|
13
13
|
cors: corsConfig ? toFetchCorsConfig(corsConfig) : true,
|
|
14
14
|
hooks,
|
|
15
|
-
inspectorLearning,
|
|
16
15
|
activateChannels,
|
|
17
16
|
__channelEngine
|
|
18
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/hono.ts"],"sourcesContent":["import { Hono } from \"hono\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { createCopilotRuntimeHandler } from \"../core/fetch-handler\";\nimport type { CopilotCorsConfig } from \"../core/fetch-cors\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\nimport type {\n ActivateChannelEngine,\n ChannelsControl,\n} from \"../core/channel-manager\";\n\n/**\n * A Hono app that may also carry an optional {@link ChannelsControl} surface.\n *\n * Unlike the Node and Express wrappers — which own a process and therefore START\n * managed-Channel activation at creation (OSS-641) — this wrapper stays LAZY:\n * activation is triggered by the first `app.channels.ready()` and never before.\n * A Hono app is multi-runtime and is our edge/serverless surface in practice:\n * every Next.js App Router route handler in `examples/showcases/*` builds one at\n * module scope, and those isolates freeze and recycle per request. Auto-starting\n * there would mint a competing listener for the same Channel on every cold\n * start, which is exactly what the lazy design exists to prevent (see the\n * `createCopilotRuntimeHandler` TSDoc).\n *\n * So on a LONG-RUNNING Hono host (`@hono/node-server`, Bun, Deno) calling\n * `await app.channels.ready()` once at startup is REQUIRED to connect declared\n * Channels; on an edge/serverless host do NOT call it.\n */\nexport type CopilotHonoApp = Hono & { channels?: ChannelsControl };\n\n/**\n * CORS configuration for CopilotKit endpoints.\n * When using credentials (e.g., HTTP-only cookies), you must specify an explicit origin.\n */\nexport interface CopilotEndpointCorsConfig {\n /**\n * Allowed origin(s) for CORS. Can be:\n * - A string: exact origin (e.g., \"https://myapp.com\")\n * - An array: list of allowed origins\n * - A function: dynamic origin resolution\n *\n * Note: When credentials is true, origin cannot be \"*\"\n */\n origin:\n | string\n | string[]\n | ((origin: string, c: any) => string | undefined | null);\n /**\n * Whether to allow credentials (cookies, HTTP authentication).\n * When true, origin must be explicitly specified (not \"*\").\n */\n credentials?: boolean;\n}\n\ninterface CopilotEndpointParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n\n /**\n * Endpoint mode.\n * - `\"multi-route\"` (default): separate routes for each operation\n * - `\"single-route\"`: single POST endpoint with JSON envelope dispatch\n */\n mode?: \"multi-route\" | \"single-route\";\n\n /**\n * Optional CORS configuration. When not provided, defaults to allowing all origins without credentials.\n * To support HTTP-only cookies, provide cors config with credentials: true and explicit origin.\n */\n cors?: CopilotEndpointCorsConfig;\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n\n /**\n * Whether
|
|
1
|
+
{"version":3,"file":"hono.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/hono.ts"],"sourcesContent":["import { Hono } from \"hono\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { createCopilotRuntimeHandler } from \"../core/fetch-handler\";\nimport type { CopilotCorsConfig } from \"../core/fetch-cors\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\nimport type {\n ActivateChannelEngine,\n ChannelsControl,\n} from \"../core/channel-manager\";\n\n/**\n * A Hono app that may also carry an optional {@link ChannelsControl} surface.\n *\n * Unlike the Node and Express wrappers — which own a process and therefore START\n * managed-Channel activation at creation (OSS-641) — this wrapper stays LAZY:\n * activation is triggered by the first `app.channels.ready()` and never before.\n * A Hono app is multi-runtime and is our edge/serverless surface in practice:\n * every Next.js App Router route handler in `examples/showcases/*` builds one at\n * module scope, and those isolates freeze and recycle per request. Auto-starting\n * there would mint a competing listener for the same Channel on every cold\n * start, which is exactly what the lazy design exists to prevent (see the\n * `createCopilotRuntimeHandler` TSDoc).\n *\n * So on a LONG-RUNNING Hono host (`@hono/node-server`, Bun, Deno) calling\n * `await app.channels.ready()` once at startup is REQUIRED to connect declared\n * Channels; on an edge/serverless host do NOT call it.\n */\nexport type CopilotHonoApp = Hono & { channels?: ChannelsControl };\n\n/**\n * CORS configuration for CopilotKit endpoints.\n * When using credentials (e.g., HTTP-only cookies), you must specify an explicit origin.\n */\nexport interface CopilotEndpointCorsConfig {\n /**\n * Allowed origin(s) for CORS. Can be:\n * - A string: exact origin (e.g., \"https://myapp.com\")\n * - An array: list of allowed origins\n * - A function: dynamic origin resolution\n *\n * Note: When credentials is true, origin cannot be \"*\"\n */\n origin:\n | string\n | string[]\n | ((origin: string, c: any) => string | undefined | null);\n /**\n * Whether to allow credentials (cookies, HTTP authentication).\n * When true, origin must be explicitly specified (not \"*\").\n */\n credentials?: boolean;\n}\n\ninterface CopilotEndpointParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n\n /**\n * Endpoint mode.\n * - `\"multi-route\"` (default): separate routes for each operation\n * - `\"single-route\"`: single POST endpoint with JSON envelope dispatch\n */\n mode?: \"multi-route\" | \"single-route\";\n\n /**\n * Optional CORS configuration. When not provided, defaults to allowing all origins without credentials.\n * To support HTTP-only cookies, provide cors config with credentials: true and explicit origin.\n */\n cors?: CopilotEndpointCorsConfig;\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n\n /**\n * Whether the underlying handler builds the control surface for the runtime's\n * declared managed Channels. Defaults to `true`. Building it opens no\n * connection — activation is deferred to the first `channels.ready()`. See\n * `CopilotRuntimeHandlerOptions.activateChannels`.\n */\n activateChannels?: boolean;\n\n /**\n * @internal Test seam: inject a fake Channel activation engine. Forwarded\n * to `createCopilotRuntimeHandler`. Not part of the public API.\n */\n __channelEngine?: ActivateChannelEngine;\n}\n/** @deprecated Use `createCopilotHonoHandler` instead. */\nexport const createCopilotEndpoint = createCopilotHonoHandler;\n\nexport function createCopilotHonoHandler({\n runtime,\n basePath,\n mode = \"multi-route\",\n cors: corsConfig,\n hooks,\n activateChannels,\n __channelEngine,\n}: CopilotEndpointParams): CopilotHonoApp {\n const handler = createCopilotRuntimeHandler({\n runtime,\n basePath,\n mode,\n cors: corsConfig ? toFetchCorsConfig(corsConfig) : true,\n hooks,\n activateChannels,\n __channelEngine,\n });\n\n const app = new Hono();\n\n const scopedApp: CopilotHonoApp = app\n .basePath(basePath)\n .all(\"*\", async (c) => handler(c.req.raw));\n scopedApp.channels = handler.channels;\n return scopedApp;\n}\n\n/**\n * Convert Hono-specific CORS config to the fetch handler's CopilotCorsConfig.\n */\nexport function toFetchCorsConfig(\n config: CopilotEndpointCorsConfig,\n): CopilotCorsConfig {\n const origin = config.origin;\n return {\n origin:\n typeof origin === \"function\"\n ? (reqOrigin: string) => origin(reqOrigin, undefined) ?? null\n : origin,\n credentials: config.credentials,\n };\n}\n"],"mappings":";;;;;;AAyFA,MAAa,wBAAwB;AAErC,SAAgB,yBAAyB,EACvC,SACA,UACA,OAAO,eACP,MAAM,YACN,OACA,kBACA,mBACwC;CACxC,MAAM,UAAU,4BAA4B;EAC1C;EACA;EACA;EACA,MAAM,aAAa,kBAAkB,WAAW,GAAG;EACnD;EACA;EACA;EACD,CAAC;CAIF,MAAM,YAFM,IAAI,MAAM,CAGnB,SAAS,SAAS,CAClB,IAAI,KAAK,OAAO,MAAM,QAAQ,EAAE,IAAI,IAAI,CAAC;AAC5C,WAAU,WAAW,QAAQ;AAC7B,QAAO;;;;;AAMT,SAAgB,kBACd,QACmB;CACnB,MAAM,SAAS,OAAO;AACtB,QAAO;EACL,QACE,OAAO,WAAW,cACb,cAAsB,OAAO,WAAW,OAAU,IAAI,OACvD;EACN,aAAa,OAAO;EACrB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require("reflect-metadata");
|
|
2
2
|
const require_agent_runner = require('../runner/agent-runner.cjs');
|
|
3
3
|
const require_telemetry_client = require('../telemetry/telemetry-client.cjs');
|
|
4
|
+
const require_learning = require('../core/learning.cjs');
|
|
4
5
|
const require_runtime = require('../core/runtime.cjs');
|
|
5
6
|
const require_client = require('../intelligence-platform/client.cjs');
|
|
6
7
|
|
|
@@ -61,7 +62,7 @@ async function resolveRuntimeEntitlements(runtime) {
|
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
async function handleGetRuntimeInfo({ runtime, request, threadEndpointsEnabled = true,
|
|
65
|
+
async function handleGetRuntimeInfo({ runtime, request, threadEndpointsEnabled = true, singleRouteResourceOperationsEnabled = false }) {
|
|
65
66
|
try {
|
|
66
67
|
const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);
|
|
67
68
|
const webEnabled = !require_runtime.isIntelligenceRuntime(runtime) || runtime.identifyUser !== void 0;
|
|
@@ -97,7 +98,7 @@ async function handleGetRuntimeInfo({ runtime, request, threadEndpointsEnabled =
|
|
|
97
98
|
...require_runtime.isIntelligenceRuntime(runtime) && webEnabled ? {
|
|
98
99
|
intelligence: { wsUrl: runtime.intelligence.ɵgetClientWsUrl() },
|
|
99
100
|
inspectorMetadata: true,
|
|
100
|
-
...runtime
|
|
101
|
+
...require_learning.hasLearningContainerConfiguration(runtime) ? { inspectorLearning: true } : {}
|
|
101
102
|
} : {},
|
|
102
103
|
a2uiEnabled: webEnabled && require_runtime.isA2UIEnabled(runtime.a2ui),
|
|
103
104
|
...webEnabled && require_runtime.isA2UIEnabled(runtime.a2ui) ? { a2ui: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-runtime-info.cjs","names":["isIntelligenceRuntime","PlatformRequestError","resolveAgents","VERSION","isA2UIEnabled","isTelemetryDisabled","supportsLocalThreadEndpoints"],"sources":["../../../../src/v2/runtime/handlers/get-runtime-info.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport {\n isA2UIEnabled,\n isIntelligenceRuntime,\n resolveAgents,\n} from \"../core/runtime\";\nimport type {\n AgentDescription,\n RuntimeInfo,\n RuntimeEntitlementResponse,\n ThreadEndpointRuntimeInfo,\n} from \"@copilotkit/shared\";\nimport type { RuntimeLicenseStatus } from \"@copilotkit/shared\";\nimport { VERSION } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { isTelemetryDisabled } from \"../telemetry/telemetry-client\";\nimport { supportsLocalThreadEndpoints } from \"../runner/agent-runner\";\n\nfunction resolveLicenseStatus(\n runtime: CopilotRuntimeLike,\n): RuntimeLicenseStatus {\n if (!runtime.licenseChecker) return \"none\";\n const status = runtime.licenseChecker.getStatus();\n if (status.warningSeverity === \"none\") return \"valid\";\n if (status.error === \"expired\") return \"expired\";\n if (status.warningSeverity === \"warning\") return \"expiring\";\n if (status.error) return \"invalid\";\n if (status.warningSeverity === \"info\") return \"none\";\n return \"unknown\";\n}\n\n/**\n * Map the structured entitlement authority onto the legacy status consumed by\n * older Core, React, and Angular thread surfaces. A ready managed entitlement\n * is authoritative in both directions. Otherwise, preserve the legacy\n * self-hosted license fallback. A retryable lookup without that fallback\n * remains unknown until it resolves.\n */\nfunction resolveCompatibilityLicenseStatus(\n runtime: CopilotRuntimeLike,\n runtimeEntitlements: RuntimeEntitlementResponse | undefined,\n): RuntimeLicenseStatus {\n if (runtimeEntitlements?.status === \"ready\") {\n if (\n runtimeEntitlements.entitlement.source === \"managedOrgSubscription\" ||\n runtimeEntitlements.entitlement.source ===\n \"awsMarketplaceDeploymentLicense\"\n ) {\n return runtimeEntitlements.entitlement.active ? \"valid\" : \"none\";\n }\n\n if (runtimeEntitlements.entitlement.active) {\n return \"valid\";\n }\n }\n\n const legacyLicenseStatus = resolveLicenseStatus(runtime);\n if (\n legacyLicenseStatus === \"none\" &&\n runtimeEntitlements?.status !== \"ready\" &&\n runtimeEntitlements?.error.retryable\n ) {\n return \"unknown\";\n }\n\n return legacyLicenseStatus;\n}\n\ninterface HandleGetRuntimeInfoParameters {\n runtime: CopilotRuntimeLike;\n request: Request;\n threadEndpointsEnabled?: boolean;\n inspectorLearningEnabled?: boolean;\n singleRouteResourceOperationsEnabled?: boolean;\n}\n\n/**\n * Resolve structured Runtime entitlements for configured Intelligence runtimes.\n *\n * Dependency failures are deliberately converted to a stable unavailable\n * diagnostic so `/info` remains an availability endpoint. The underlying\n * error is not exposed because it may contain upstream response details.\n */\nasync function resolveRuntimeEntitlements(\n runtime: CopilotRuntimeLike,\n): Promise<RuntimeEntitlementResponse | undefined> {\n if (!isIntelligenceRuntime(runtime)) {\n return undefined;\n }\n\n try {\n return await runtime.intelligence.getRuntimeEntitlements();\n } catch (error) {\n if (error instanceof PlatformRequestError && error.retryable === false) {\n return {\n status: \"misconfigured\",\n error: {\n code: \"runtime_entitlements_misconfigured\",\n message: \"Runtime entitlement lookup is misconfigured\",\n retryable: false,\n },\n };\n }\n\n return {\n status: \"unavailable\",\n error: {\n code: \"runtime_entitlements_unavailable\",\n message: \"Runtime entitlement lookup failed\",\n retryable: true,\n },\n };\n }\n}\n\nexport async function handleGetRuntimeInfo({\n runtime,\n request,\n threadEndpointsEnabled = true,\n inspectorLearningEnabled = false,\n singleRouteResourceOperationsEnabled = false,\n}: HandleGetRuntimeInfoParameters) {\n try {\n const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);\n const webEnabled =\n !isIntelligenceRuntime(runtime) || runtime.identifyUser !== undefined;\n const agents = webEnabled\n ? await resolveAgents(runtime.agents, request)\n : {};\n\n const agentEntries = await Promise.all(\n Object.entries(agents).map(async ([name, agent]) => {\n let capabilities: AgentCapabilities | undefined;\n try {\n capabilities = agent.getCapabilities\n ? await agent.getCapabilities()\n : undefined;\n } catch (error) {\n // Per-agent isolation: a single agent failing to report capabilities\n // must not take down the entire /info endpoint.\n console.warn(\n `Failed to fetch capabilities for agent \"${name}\":`,\n error instanceof Error ? error.message : error,\n );\n capabilities = undefined;\n }\n\n const description: AgentDescription = {\n name,\n description: agent.description,\n className: agent.constructor.name,\n ...(capabilities ? { capabilities } : {}),\n };\n\n return [name, description] as const;\n }),\n );\n\n const agentsDict: Record<string, AgentDescription> =\n Object.fromEntries(agentEntries);\n const runtimeEntitlements = await runtimeEntitlementsPromise;\n\n const runtimeInfo: RuntimeInfo = {\n version: VERSION,\n agents: agentsDict,\n audioFileTranscriptionEnabled:\n webEnabled && !!runtime.transcriptionService,\n mode: runtime.mode,\n threadEndpoints: resolveThreadEndpointInfo(\n runtime,\n threadEndpointsEnabled && webEnabled,\n ),\n ...(singleRouteResourceOperationsEnabled\n ? {\n singleRoute: {\n resourceOperations: true,\n threadEndpoints: resolveThreadEndpointInfo(runtime, webEnabled),\n },\n }\n : {}),\n // Advertised unconditionally. Multi-route runtimes expose the dedicated\n // POST /agent/:agentId/suggest path; single-route clients fall back to a\n // client-side run (they don't construct the single-route envelope for\n // suggest). The flag lets multi-route clients detect the stateless path.\n suggestions: webEnabled,\n ...(isIntelligenceRuntime(runtime) && webEnabled\n ? {\n intelligence: {\n wsUrl: runtime.intelligence.ɵgetClientWsUrl(),\n },\n inspectorMetadata: true,\n ...(runtime.debug?.enabled === true && inspectorLearningEnabled\n ? { inspectorLearning: true }\n : {}),\n }\n : {}),\n // Legacy flat flag, kept for older clients. The `a2ui` object below is\n // the source of truth: it preserves the per-agent scoping that this\n // boolean discards (see CopilotKit/CopilotKit#5369). Both go through the\n // shared isA2UIEnabled() predicate so an explicit `enabled: false`\n // disables a2ui here exactly as it does on the run path.\n a2uiEnabled: webEnabled && isA2UIEnabled(runtime.a2ui),\n ...(webEnabled && isA2UIEnabled(runtime.a2ui)\n ? {\n a2ui: {\n enabled: true,\n ...(runtime.a2ui.agents ? { agents: runtime.a2ui.agents } : {}),\n },\n }\n : {}),\n openGenerativeUIEnabled: webEnabled && !!runtime.openGenerativeUI,\n ...(isIntelligenceRuntime(runtime)\n ? {\n licenseStatus: resolveCompatibilityLicenseStatus(\n runtime,\n runtimeEntitlements,\n ),\n }\n : {}),\n ...(runtimeEntitlements ? { runtimeEntitlements } : {}),\n telemetryDisabled: isTelemetryDisabled(),\n };\n\n return new Response(JSON.stringify(runtimeInfo), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n return new Response(\n JSON.stringify({\n error: \"Failed to retrieve runtime information\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n\nfunction resolveThreadEndpointInfo(\n runtime: CopilotRuntimeLike,\n threadEndpointsEnabled: boolean,\n): ThreadEndpointRuntimeInfo {\n const hasRestThreadBackend =\n isIntelligenceRuntime(runtime) ||\n supportsLocalThreadEndpoints(runtime.runner);\n const restEndpointsAvailable = threadEndpointsEnabled && hasRestThreadBackend;\n const managedThreadMetadata =\n threadEndpointsEnabled && isIntelligenceRuntime(runtime);\n\n return {\n list: restEndpointsAvailable,\n inspect: restEndpointsAvailable,\n mutations: managedThreadMetadata,\n realtimeMetadata: managedThreadMetadata,\n };\n}\n"],"mappings":";;;;;;;AAmBA,SAAS,qBACP,SACsB;AACtB,KAAI,CAAC,QAAQ,eAAgB,QAAO;CACpC,MAAM,SAAS,QAAQ,eAAe,WAAW;AACjD,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,oBAAoB,UAAW,QAAO;AACjD,KAAI,OAAO,MAAO,QAAO;AACzB,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,QAAO;;;;;;;;;AAUT,SAAS,kCACP,SACA,qBACsB;AACtB,KAAI,qBAAqB,WAAW,SAAS;AAC3C,MACE,oBAAoB,YAAY,WAAW,4BAC3C,oBAAoB,YAAY,WAC9B,kCAEF,QAAO,oBAAoB,YAAY,SAAS,UAAU;AAG5D,MAAI,oBAAoB,YAAY,OAClC,QAAO;;CAIX,MAAM,sBAAsB,qBAAqB,QAAQ;AACzD,KACE,wBAAwB,UACxB,qBAAqB,WAAW,WAChC,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AkB;EACnB"}
|
|
1
|
+
{"version":3,"file":"get-runtime-info.cjs","names":["isIntelligenceRuntime","PlatformRequestError","resolveAgents","VERSION","hasLearningContainerConfiguration","isA2UIEnabled","isTelemetryDisabled","supportsLocalThreadEndpoints"],"sources":["../../../../src/v2/runtime/handlers/get-runtime-info.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport {\n isA2UIEnabled,\n isIntelligenceRuntime,\n resolveAgents,\n} from \"../core/runtime\";\nimport type {\n AgentDescription,\n RuntimeInfo,\n RuntimeEntitlementResponse,\n ThreadEndpointRuntimeInfo,\n} from \"@copilotkit/shared\";\nimport type { RuntimeLicenseStatus } from \"@copilotkit/shared\";\nimport { VERSION } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { isTelemetryDisabled } from \"../telemetry/telemetry-client\";\nimport { supportsLocalThreadEndpoints } from \"../runner/agent-runner\";\n\nfunction resolveLicenseStatus(\n runtime: CopilotRuntimeLike,\n): RuntimeLicenseStatus {\n if (!runtime.licenseChecker) return \"none\";\n const status = runtime.licenseChecker.getStatus();\n if (status.warningSeverity === \"none\") return \"valid\";\n if (status.error === \"expired\") return \"expired\";\n if (status.warningSeverity === \"warning\") return \"expiring\";\n if (status.error) return \"invalid\";\n if (status.warningSeverity === \"info\") return \"none\";\n return \"unknown\";\n}\n\n/**\n * Map the structured entitlement authority onto the legacy status consumed by\n * older Core, React, and Angular thread surfaces. A ready managed entitlement\n * is authoritative in both directions. Otherwise, preserve the legacy\n * self-hosted license fallback. A retryable lookup without that fallback\n * remains unknown until it resolves.\n */\nfunction resolveCompatibilityLicenseStatus(\n runtime: CopilotRuntimeLike,\n runtimeEntitlements: RuntimeEntitlementResponse | undefined,\n): RuntimeLicenseStatus {\n if (runtimeEntitlements?.status === \"ready\") {\n if (\n runtimeEntitlements.entitlement.source === \"managedOrgSubscription\" ||\n runtimeEntitlements.entitlement.source ===\n \"awsMarketplaceDeploymentLicense\"\n ) {\n return runtimeEntitlements.entitlement.active ? \"valid\" : \"none\";\n }\n\n if (runtimeEntitlements.entitlement.active) {\n return \"valid\";\n }\n }\n\n const legacyLicenseStatus = resolveLicenseStatus(runtime);\n if (\n legacyLicenseStatus === \"none\" &&\n runtimeEntitlements?.status !== \"ready\" &&\n runtimeEntitlements?.error.retryable\n ) {\n return \"unknown\";\n }\n\n return legacyLicenseStatus;\n}\n\ninterface HandleGetRuntimeInfoParameters {\n runtime: CopilotRuntimeLike;\n request: Request;\n threadEndpointsEnabled?: boolean;\n singleRouteResourceOperationsEnabled?: boolean;\n}\n\n/**\n * Resolve structured Runtime entitlements for configured Intelligence runtimes.\n *\n * Dependency failures are deliberately converted to a stable unavailable\n * diagnostic so `/info` remains an availability endpoint. The underlying\n * error is not exposed because it may contain upstream response details.\n */\nasync function resolveRuntimeEntitlements(\n runtime: CopilotRuntimeLike,\n): Promise<RuntimeEntitlementResponse | undefined> {\n if (!isIntelligenceRuntime(runtime)) {\n return undefined;\n }\n\n try {\n return await runtime.intelligence.getRuntimeEntitlements();\n } catch (error) {\n if (error instanceof PlatformRequestError && error.retryable === false) {\n return {\n status: \"misconfigured\",\n error: {\n code: \"runtime_entitlements_misconfigured\",\n message: \"Runtime entitlement lookup is misconfigured\",\n retryable: false,\n },\n };\n }\n\n return {\n status: \"unavailable\",\n error: {\n code: \"runtime_entitlements_unavailable\",\n message: \"Runtime entitlement lookup failed\",\n retryable: true,\n },\n };\n }\n}\n\nexport async function handleGetRuntimeInfo({\n runtime,\n request,\n threadEndpointsEnabled = true,\n singleRouteResourceOperationsEnabled = false,\n}: HandleGetRuntimeInfoParameters) {\n try {\n const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);\n const webEnabled =\n !isIntelligenceRuntime(runtime) || runtime.identifyUser !== undefined;\n const agents = webEnabled\n ? await resolveAgents(runtime.agents, request)\n : {};\n\n const agentEntries = await Promise.all(\n Object.entries(agents).map(async ([name, agent]) => {\n let capabilities: AgentCapabilities | undefined;\n try {\n capabilities = agent.getCapabilities\n ? await agent.getCapabilities()\n : undefined;\n } catch (error) {\n // Per-agent isolation: a single agent failing to report capabilities\n // must not take down the entire /info endpoint.\n console.warn(\n `Failed to fetch capabilities for agent \"${name}\":`,\n error instanceof Error ? error.message : error,\n );\n capabilities = undefined;\n }\n\n const description: AgentDescription = {\n name,\n description: agent.description,\n className: agent.constructor.name,\n ...(capabilities ? { capabilities } : {}),\n };\n\n return [name, description] as const;\n }),\n );\n\n const agentsDict: Record<string, AgentDescription> =\n Object.fromEntries(agentEntries);\n const runtimeEntitlements = await runtimeEntitlementsPromise;\n\n const runtimeInfo: RuntimeInfo = {\n version: VERSION,\n agents: agentsDict,\n audioFileTranscriptionEnabled:\n webEnabled && !!runtime.transcriptionService,\n mode: runtime.mode,\n threadEndpoints: resolveThreadEndpointInfo(\n runtime,\n threadEndpointsEnabled && webEnabled,\n ),\n ...(singleRouteResourceOperationsEnabled\n ? {\n singleRoute: {\n resourceOperations: true,\n threadEndpoints: resolveThreadEndpointInfo(runtime, webEnabled),\n },\n }\n : {}),\n // Advertised unconditionally. Multi-route runtimes expose the dedicated\n // POST /agent/:agentId/suggest path; single-route clients fall back to a\n // client-side run (they don't construct the single-route envelope for\n // suggest). The flag lets multi-route clients detect the stateless path.\n suggestions: webEnabled,\n ...(isIntelligenceRuntime(runtime) && webEnabled\n ? {\n intelligence: {\n wsUrl: runtime.intelligence.ɵgetClientWsUrl(),\n },\n inspectorMetadata: true,\n ...(hasLearningContainerConfiguration(runtime)\n ? { inspectorLearning: true }\n : {}),\n }\n : {}),\n // Legacy flat flag, kept for older clients. The `a2ui` object below is\n // the source of truth: it preserves the per-agent scoping that this\n // boolean discards (see CopilotKit/CopilotKit#5369). Both go through the\n // shared isA2UIEnabled() predicate so an explicit `enabled: false`\n // disables a2ui here exactly as it does on the run path.\n a2uiEnabled: webEnabled && isA2UIEnabled(runtime.a2ui),\n ...(webEnabled && isA2UIEnabled(runtime.a2ui)\n ? {\n a2ui: {\n enabled: true,\n ...(runtime.a2ui.agents ? { agents: runtime.a2ui.agents } : {}),\n },\n }\n : {}),\n openGenerativeUIEnabled: webEnabled && !!runtime.openGenerativeUI,\n ...(isIntelligenceRuntime(runtime)\n ? {\n licenseStatus: resolveCompatibilityLicenseStatus(\n runtime,\n runtimeEntitlements,\n ),\n }\n : {}),\n ...(runtimeEntitlements ? { runtimeEntitlements } : {}),\n telemetryDisabled: isTelemetryDisabled(),\n };\n\n return new Response(JSON.stringify(runtimeInfo), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n return new Response(\n JSON.stringify({\n error: \"Failed to retrieve runtime information\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n\nfunction resolveThreadEndpointInfo(\n runtime: CopilotRuntimeLike,\n threadEndpointsEnabled: boolean,\n): ThreadEndpointRuntimeInfo {\n const hasRestThreadBackend =\n isIntelligenceRuntime(runtime) ||\n supportsLocalThreadEndpoints(runtime.runner);\n const restEndpointsAvailable = threadEndpointsEnabled && hasRestThreadBackend;\n const managedThreadMetadata =\n threadEndpointsEnabled && isIntelligenceRuntime(runtime);\n\n return {\n list: restEndpointsAvailable,\n inspect: restEndpointsAvailable,\n mutations: managedThreadMetadata,\n realtimeMetadata: managedThreadMetadata,\n };\n}\n"],"mappings":";;;;;;;;AAoBA,SAAS,qBACP,SACsB;AACtB,KAAI,CAAC,QAAQ,eAAgB,QAAO;CACpC,MAAM,SAAS,QAAQ,eAAe,WAAW;AACjD,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,oBAAoB,UAAW,QAAO;AACjD,KAAI,OAAO,MAAO,QAAO;AACzB,KAAI,OAAO,oBAAoB,OAAQ,QAAO;A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,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF;;;AAIL,SAAS,0BACP,SACA,wBAC2B;CAC3B,MAAM,uBACJN,sCAAsB,QAAQ,IAC9BO,kDAA6B,QAAQ,OAAO;CAC9C,MAAM,yBAAyB,0BAA0B;CACzD,MAAM,wBACJ,0BAA0BP,sCAAsB,QAAQ;AAE1D,QAAO;EACL,MAAM;EACN,SAAS;EACT,WAAW;EACX,kBAAkB;EACnB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { supportsLocalThreadEndpoints } from "../runner/agent-runner.mjs";
|
|
3
3
|
import { isTelemetryDisabled } from "../telemetry/telemetry-client.mjs";
|
|
4
|
+
import { hasLearningContainerConfiguration } from "../core/learning.mjs";
|
|
4
5
|
import { VERSION, isA2UIEnabled, isIntelligenceRuntime, resolveAgents } from "../core/runtime.mjs";
|
|
5
6
|
import { PlatformRequestError } from "../intelligence-platform/client.mjs";
|
|
6
7
|
|
|
@@ -61,7 +62,7 @@ async function resolveRuntimeEntitlements(runtime) {
|
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
async function handleGetRuntimeInfo({ runtime, request, threadEndpointsEnabled = true,
|
|
65
|
+
async function handleGetRuntimeInfo({ runtime, request, threadEndpointsEnabled = true, singleRouteResourceOperationsEnabled = false }) {
|
|
65
66
|
try {
|
|
66
67
|
const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);
|
|
67
68
|
const webEnabled = !isIntelligenceRuntime(runtime) || runtime.identifyUser !== void 0;
|
|
@@ -97,7 +98,7 @@ async function handleGetRuntimeInfo({ runtime, request, threadEndpointsEnabled =
|
|
|
97
98
|
...isIntelligenceRuntime(runtime) && webEnabled ? {
|
|
98
99
|
intelligence: { wsUrl: runtime.intelligence.ɵgetClientWsUrl() },
|
|
99
100
|
inspectorMetadata: true,
|
|
100
|
-
...runtime
|
|
101
|
+
...hasLearningContainerConfiguration(runtime) ? { inspectorLearning: true } : {}
|
|
101
102
|
} : {},
|
|
102
103
|
a2uiEnabled: webEnabled && isA2UIEnabled(runtime.a2ui),
|
|
103
104
|
...webEnabled && isA2UIEnabled(runtime.a2ui) ? { a2ui: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-runtime-info.mjs","names":[],"sources":["../../../../src/v2/runtime/handlers/get-runtime-info.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport {\n isA2UIEnabled,\n isIntelligenceRuntime,\n resolveAgents,\n} from \"../core/runtime\";\nimport type {\n AgentDescription,\n RuntimeInfo,\n RuntimeEntitlementResponse,\n ThreadEndpointRuntimeInfo,\n} from \"@copilotkit/shared\";\nimport type { RuntimeLicenseStatus } from \"@copilotkit/shared\";\nimport { VERSION } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { isTelemetryDisabled } from \"../telemetry/telemetry-client\";\nimport { supportsLocalThreadEndpoints } from \"../runner/agent-runner\";\n\nfunction resolveLicenseStatus(\n runtime: CopilotRuntimeLike,\n): RuntimeLicenseStatus {\n if (!runtime.licenseChecker) return \"none\";\n const status = runtime.licenseChecker.getStatus();\n if (status.warningSeverity === \"none\") return \"valid\";\n if (status.error === \"expired\") return \"expired\";\n if (status.warningSeverity === \"warning\") return \"expiring\";\n if (status.error) return \"invalid\";\n if (status.warningSeverity === \"info\") return \"none\";\n return \"unknown\";\n}\n\n/**\n * Map the structured entitlement authority onto the legacy status consumed by\n * older Core, React, and Angular thread surfaces. A ready managed entitlement\n * is authoritative in both directions. Otherwise, preserve the legacy\n * self-hosted license fallback. A retryable lookup without that fallback\n * remains unknown until it resolves.\n */\nfunction resolveCompatibilityLicenseStatus(\n runtime: CopilotRuntimeLike,\n runtimeEntitlements: RuntimeEntitlementResponse | undefined,\n): RuntimeLicenseStatus {\n if (runtimeEntitlements?.status === \"ready\") {\n if (\n runtimeEntitlements.entitlement.source === \"managedOrgSubscription\" ||\n runtimeEntitlements.entitlement.source ===\n \"awsMarketplaceDeploymentLicense\"\n ) {\n return runtimeEntitlements.entitlement.active ? \"valid\" : \"none\";\n }\n\n if (runtimeEntitlements.entitlement.active) {\n return \"valid\";\n }\n }\n\n const legacyLicenseStatus = resolveLicenseStatus(runtime);\n if (\n legacyLicenseStatus === \"none\" &&\n runtimeEntitlements?.status !== \"ready\" &&\n runtimeEntitlements?.error.retryable\n ) {\n return \"unknown\";\n }\n\n return legacyLicenseStatus;\n}\n\ninterface HandleGetRuntimeInfoParameters {\n runtime: CopilotRuntimeLike;\n request: Request;\n threadEndpointsEnabled?: boolean;\n inspectorLearningEnabled?: boolean;\n singleRouteResourceOperationsEnabled?: boolean;\n}\n\n/**\n * Resolve structured Runtime entitlements for configured Intelligence runtimes.\n *\n * Dependency failures are deliberately converted to a stable unavailable\n * diagnostic so `/info` remains an availability endpoint. The underlying\n * error is not exposed because it may contain upstream response details.\n */\nasync function resolveRuntimeEntitlements(\n runtime: CopilotRuntimeLike,\n): Promise<RuntimeEntitlementResponse | undefined> {\n if (!isIntelligenceRuntime(runtime)) {\n return undefined;\n }\n\n try {\n return await runtime.intelligence.getRuntimeEntitlements();\n } catch (error) {\n if (error instanceof PlatformRequestError && error.retryable === false) {\n return {\n status: \"misconfigured\",\n error: {\n code: \"runtime_entitlements_misconfigured\",\n message: \"Runtime entitlement lookup is misconfigured\",\n retryable: false,\n },\n };\n }\n\n return {\n status: \"unavailable\",\n error: {\n code: \"runtime_entitlements_unavailable\",\n message: \"Runtime entitlement lookup failed\",\n retryable: true,\n },\n };\n }\n}\n\nexport async function handleGetRuntimeInfo({\n runtime,\n request,\n threadEndpointsEnabled = true,\n inspectorLearningEnabled = false,\n singleRouteResourceOperationsEnabled = false,\n}: HandleGetRuntimeInfoParameters) {\n try {\n const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);\n const webEnabled =\n !isIntelligenceRuntime(runtime) || runtime.identifyUser !== undefined;\n const agents = webEnabled\n ? await resolveAgents(runtime.agents, request)\n : {};\n\n const agentEntries = await Promise.all(\n Object.entries(agents).map(async ([name, agent]) => {\n let capabilities: AgentCapabilities | undefined;\n try {\n capabilities = agent.getCapabilities\n ? await agent.getCapabilities()\n : undefined;\n } catch (error) {\n // Per-agent isolation: a single agent failing to report capabilities\n // must not take down the entire /info endpoint.\n console.warn(\n `Failed to fetch capabilities for agent \"${name}\":`,\n error instanceof Error ? error.message : error,\n );\n capabilities = undefined;\n }\n\n const description: AgentDescription = {\n name,\n description: agent.description,\n className: agent.constructor.name,\n ...(capabilities ? { capabilities } : {}),\n };\n\n return [name, description] as const;\n }),\n );\n\n const agentsDict: Record<string, AgentDescription> =\n Object.fromEntries(agentEntries);\n const runtimeEntitlements = await runtimeEntitlementsPromise;\n\n const runtimeInfo: RuntimeInfo = {\n version: VERSION,\n agents: agentsDict,\n audioFileTranscriptionEnabled:\n webEnabled && !!runtime.transcriptionService,\n mode: runtime.mode,\n threadEndpoints: resolveThreadEndpointInfo(\n runtime,\n threadEndpointsEnabled && webEnabled,\n ),\n ...(singleRouteResourceOperationsEnabled\n ? {\n singleRoute: {\n resourceOperations: true,\n threadEndpoints: resolveThreadEndpointInfo(runtime, webEnabled),\n },\n }\n : {}),\n // Advertised unconditionally. Multi-route runtimes expose the dedicated\n // POST /agent/:agentId/suggest path; single-route clients fall back to a\n // client-side run (they don't construct the single-route envelope for\n // suggest). The flag lets multi-route clients detect the stateless path.\n suggestions: webEnabled,\n ...(isIntelligenceRuntime(runtime) && webEnabled\n ? {\n intelligence: {\n wsUrl: runtime.intelligence.ɵgetClientWsUrl(),\n },\n inspectorMetadata: true,\n ...(runtime.debug?.enabled === true && inspectorLearningEnabled\n ? { inspectorLearning: true }\n : {}),\n }\n : {}),\n // Legacy flat flag, kept for older clients. The `a2ui` object below is\n // the source of truth: it preserves the per-agent scoping that this\n // boolean discards (see CopilotKit/CopilotKit#5369). Both go through the\n // shared isA2UIEnabled() predicate so an explicit `enabled: false`\n // disables a2ui here exactly as it does on the run path.\n a2uiEnabled: webEnabled && isA2UIEnabled(runtime.a2ui),\n ...(webEnabled && isA2UIEnabled(runtime.a2ui)\n ? {\n a2ui: {\n enabled: true,\n ...(runtime.a2ui.agents ? { agents: runtime.a2ui.agents } : {}),\n },\n }\n : {}),\n openGenerativeUIEnabled: webEnabled && !!runtime.openGenerativeUI,\n ...(isIntelligenceRuntime(runtime)\n ? {\n licenseStatus: resolveCompatibilityLicenseStatus(\n runtime,\n runtimeEntitlements,\n ),\n }\n : {}),\n ...(runtimeEntitlements ? { runtimeEntitlements } : {}),\n telemetryDisabled: isTelemetryDisabled(),\n };\n\n return new Response(JSON.stringify(runtimeInfo), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n return new Response(\n JSON.stringify({\n error: \"Failed to retrieve runtime information\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n\nfunction resolveThreadEndpointInfo(\n runtime: CopilotRuntimeLike,\n threadEndpointsEnabled: boolean,\n): ThreadEndpointRuntimeInfo {\n const hasRestThreadBackend =\n isIntelligenceRuntime(runtime) ||\n supportsLocalThreadEndpoints(runtime.runner);\n const restEndpointsAvailable = threadEndpointsEnabled && hasRestThreadBackend;\n const managedThreadMetadata =\n threadEndpointsEnabled && isIntelligenceRuntime(runtime);\n\n return {\n list: restEndpointsAvailable,\n inspect: restEndpointsAvailable,\n mutations: managedThreadMetadata,\n realtimeMetadata: managedThreadMetadata,\n };\n}\n"],"mappings":";;;;;;;AAmBA,SAAS,qBACP,SACsB;AACtB,KAAI,CAAC,QAAQ,eAAgB,QAAO;CACpC,MAAM,SAAS,QAAQ,eAAe,WAAW;AACjD,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,oBAAoB,UA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AO,IAAI,SACT,KAAK,UAAU;GACb,OAAO;GACP,SAAS,iBAAiB,QAAQ,MAAM,UAAU;GACnD,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF;;;AAIL,SAAS,0BACP,SACA,wBAC2B;CAC3B,MAAM,uBACJ,sBAAsB,QAAQ,IAC9B,6BAA6B,QAAQ,OAAO;CAC9C,MAAM,yBAAyB,0BAA0B;CACzD,MAAM,wBACJ,0BAA0B,sBAAsB,QAAQ;AAE1D,QAAO;EACL,MAAM;EACN,SAAS;EACT,WAAW;EACX,kBAAkB;EACnB"}
|
|
1
|
+
{"version":3,"file":"get-runtime-info.mjs","names":[],"sources":["../../../../src/v2/runtime/handlers/get-runtime-info.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport {\n isA2UIEnabled,\n isIntelligenceRuntime,\n resolveAgents,\n} from \"../core/runtime\";\nimport type {\n AgentDescription,\n RuntimeInfo,\n RuntimeEntitlementResponse,\n ThreadEndpointRuntimeInfo,\n} from \"@copilotkit/shared\";\nimport type { RuntimeLicenseStatus } from \"@copilotkit/shared\";\nimport { VERSION } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { isTelemetryDisabled } from \"../telemetry/telemetry-client\";\nimport { supportsLocalThreadEndpoints } from \"../runner/agent-runner\";\n\nfunction resolveLicenseStatus(\n runtime: CopilotRuntimeLike,\n): RuntimeLicenseStatus {\n if (!runtime.licenseChecker) return \"none\";\n const status = runtime.licenseChecker.getStatus();\n if (status.warningSeverity === \"none\") return \"valid\";\n if (status.error === \"expired\") return \"expired\";\n if (status.warningSeverity === \"warning\") return \"expiring\";\n if (status.error) return \"invalid\";\n if (status.warningSeverity === \"info\") return \"none\";\n return \"unknown\";\n}\n\n/**\n * Map the structured entitlement authority onto the legacy status consumed by\n * older Core, React, and Angular thread surfaces. A ready managed entitlement\n * is authoritative in both directions. Otherwise, preserve the legacy\n * self-hosted license fallback. A retryable lookup without that fallback\n * remains unknown until it resolves.\n */\nfunction resolveCompatibilityLicenseStatus(\n runtime: CopilotRuntimeLike,\n runtimeEntitlements: RuntimeEntitlementResponse | undefined,\n): RuntimeLicenseStatus {\n if (runtimeEntitlements?.status === \"ready\") {\n if (\n runtimeEntitlements.entitlement.source === \"managedOrgSubscription\" ||\n runtimeEntitlements.entitlement.source ===\n \"awsMarketplaceDeploymentLicense\"\n ) {\n return runtimeEntitlements.entitlement.active ? \"valid\" : \"none\";\n }\n\n if (runtimeEntitlements.entitlement.active) {\n return \"valid\";\n }\n }\n\n const legacyLicenseStatus = resolveLicenseStatus(runtime);\n if (\n legacyLicenseStatus === \"none\" &&\n runtimeEntitlements?.status !== \"ready\" &&\n runtimeEntitlements?.error.retryable\n ) {\n return \"unknown\";\n }\n\n return legacyLicenseStatus;\n}\n\ninterface HandleGetRuntimeInfoParameters {\n runtime: CopilotRuntimeLike;\n request: Request;\n threadEndpointsEnabled?: boolean;\n singleRouteResourceOperationsEnabled?: boolean;\n}\n\n/**\n * Resolve structured Runtime entitlements for configured Intelligence runtimes.\n *\n * Dependency failures are deliberately converted to a stable unavailable\n * diagnostic so `/info` remains an availability endpoint. The underlying\n * error is not exposed because it may contain upstream response details.\n */\nasync function resolveRuntimeEntitlements(\n runtime: CopilotRuntimeLike,\n): Promise<RuntimeEntitlementResponse | undefined> {\n if (!isIntelligenceRuntime(runtime)) {\n return undefined;\n }\n\n try {\n return await runtime.intelligence.getRuntimeEntitlements();\n } catch (error) {\n if (error instanceof PlatformRequestError && error.retryable === false) {\n return {\n status: \"misconfigured\",\n error: {\n code: \"runtime_entitlements_misconfigured\",\n message: \"Runtime entitlement lookup is misconfigured\",\n retryable: false,\n },\n };\n }\n\n return {\n status: \"unavailable\",\n error: {\n code: \"runtime_entitlements_unavailable\",\n message: \"Runtime entitlement lookup failed\",\n retryable: true,\n },\n };\n }\n}\n\nexport async function handleGetRuntimeInfo({\n runtime,\n request,\n threadEndpointsEnabled = true,\n singleRouteResourceOperationsEnabled = false,\n}: HandleGetRuntimeInfoParameters) {\n try {\n const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);\n const webEnabled =\n !isIntelligenceRuntime(runtime) || runtime.identifyUser !== undefined;\n const agents = webEnabled\n ? await resolveAgents(runtime.agents, request)\n : {};\n\n const agentEntries = await Promise.all(\n Object.entries(agents).map(async ([name, agent]) => {\n let capabilities: AgentCapabilities | undefined;\n try {\n capabilities = agent.getCapabilities\n ? await agent.getCapabilities()\n : undefined;\n } catch (error) {\n // Per-agent isolation: a single agent failing to report capabilities\n // must not take down the entire /info endpoint.\n console.warn(\n `Failed to fetch capabilities for agent \"${name}\":`,\n error instanceof Error ? error.message : error,\n );\n capabilities = undefined;\n }\n\n const description: AgentDescription = {\n name,\n description: agent.description,\n className: agent.constructor.name,\n ...(capabilities ? { capabilities } : {}),\n };\n\n return [name, description] as const;\n }),\n );\n\n const agentsDict: Record<string, AgentDescription> =\n Object.fromEntries(agentEntries);\n const runtimeEntitlements = await runtimeEntitlementsPromise;\n\n const runtimeInfo: RuntimeInfo = {\n version: VERSION,\n agents: agentsDict,\n audioFileTranscriptionEnabled:\n webEnabled && !!runtime.transcriptionService,\n mode: runtime.mode,\n threadEndpoints: resolveThreadEndpointInfo(\n runtime,\n threadEndpointsEnabled && webEnabled,\n ),\n ...(singleRouteResourceOperationsEnabled\n ? {\n singleRoute: {\n resourceOperations: true,\n threadEndpoints: resolveThreadEndpointInfo(runtime, webEnabled),\n },\n }\n : {}),\n // Advertised unconditionally. Multi-route runtimes expose the dedicated\n // POST /agent/:agentId/suggest path; single-route clients fall back to a\n // client-side run (they don't construct the single-route envelope for\n // suggest). The flag lets multi-route clients detect the stateless path.\n suggestions: webEnabled,\n ...(isIntelligenceRuntime(runtime) && webEnabled\n ? {\n intelligence: {\n wsUrl: runtime.intelligence.ɵgetClientWsUrl(),\n },\n inspectorMetadata: true,\n ...(hasLearningContainerConfiguration(runtime)\n ? { inspectorLearning: true }\n : {}),\n }\n : {}),\n // Legacy flat flag, kept for older clients. The `a2ui` object below is\n // the source of truth: it preserves the per-agent scoping that this\n // boolean discards (see CopilotKit/CopilotKit#5369). Both go through the\n // shared isA2UIEnabled() predicate so an explicit `enabled: false`\n // disables a2ui here exactly as it does on the run path.\n a2uiEnabled: webEnabled && isA2UIEnabled(runtime.a2ui),\n ...(webEnabled && isA2UIEnabled(runtime.a2ui)\n ? {\n a2ui: {\n enabled: true,\n ...(runtime.a2ui.agents ? { agents: runtime.a2ui.agents } : {}),\n },\n }\n : {}),\n openGenerativeUIEnabled: webEnabled && !!runtime.openGenerativeUI,\n ...(isIntelligenceRuntime(runtime)\n ? {\n licenseStatus: resolveCompatibilityLicenseStatus(\n runtime,\n runtimeEntitlements,\n ),\n }\n : {}),\n ...(runtimeEntitlements ? { runtimeEntitlements } : {}),\n telemetryDisabled: isTelemetryDisabled(),\n };\n\n return new Response(JSON.stringify(runtimeInfo), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n return new Response(\n JSON.stringify({\n error: \"Failed to retrieve runtime information\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n\nfunction resolveThreadEndpointInfo(\n runtime: CopilotRuntimeLike,\n threadEndpointsEnabled: boolean,\n): ThreadEndpointRuntimeInfo {\n const hasRestThreadBackend =\n isIntelligenceRuntime(runtime) ||\n supportsLocalThreadEndpoints(runtime.runner);\n const restEndpointsAvailable = threadEndpointsEnabled && hasRestThreadBackend;\n const managedThreadMetadata =\n threadEndpointsEnabled && isIntelligenceRuntime(runtime);\n\n return {\n list: restEndpointsAvailable,\n inspect: restEndpointsAvailable,\n mutations: managedThreadMetadata,\n realtimeMetadata: managedThreadMetadata,\n };\n}\n"],"mappings":";;;;;;;;AAoBA,SAAS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B,GAAG,EAAE;GACtD,mBAAmB,qBAAqB;GACzC;AAED,SAAO,IAAI,SAAS,KAAK,UAAU,YAAY,EAAE;GAC/C,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CAAC;UACK,OAAO;AACd,SAAO,IAAI,SACT,KAAK,UAAU;GACb,OAAO;GACP,SAAS,iBAAiB,QAAQ,MAAM,UAAU;GACnD,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF;;;AAIL,SAAS,0BACP,SACA,wBAC2B;CAC3B,MAAM,uBACJ,sBAAsB,QAAQ,IAC9B,6BAA6B,QAAQ,OAAO;CAC9C,MAAM,yBAAyB,0BAA0B;CACzD,MAAM,wBACJ,0BAA0B,sBAAsB,QAAQ;AAE1D,QAAO;EACL,MAAM;EACN,SAAS;EACT,WAAW;EACX,kBAAkB;EACnB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require("reflect-metadata");
|
|
2
2
|
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_learning = require('../core/learning.cjs');
|
|
3
4
|
const require_runtime$1 = require('../core/runtime.cjs');
|
|
4
5
|
const require_client = require('../intelligence-platform/client.cjs');
|
|
5
6
|
const require_resolve_intelligence_user = require('./shared/resolve-intelligence-user.cjs');
|
|
@@ -16,8 +17,8 @@ const errorResponse = (status, message) => new Response(JSON.stringify({ error:
|
|
|
16
17
|
});
|
|
17
18
|
const queryPage = (value) => value === null ? void 0 : Number(value);
|
|
18
19
|
/** Proxies a bounded Learning read through the runtime's server-held credential. */
|
|
19
|
-
async function handleInspectorLearning({ runtime, request
|
|
20
|
-
if (!
|
|
20
|
+
async function handleInspectorLearning({ runtime, request }) {
|
|
21
|
+
if (!require_runtime$1.isIntelligenceRuntime(runtime) || !require_learning.hasLearningContainerConfiguration(runtime)) return errorResponse(404, "Not found");
|
|
21
22
|
const user = await require_resolve_intelligence_user.resolveIntelligenceUser({
|
|
22
23
|
runtime,
|
|
23
24
|
request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-inspector-learning.cjs","names":["isIntelligenceRuntime","resolveIntelligenceUser","PlatformRequestError"],"sources":["../../../../src/v2/runtime/handlers/handle-inspector-learning.ts"],"sourcesContent":["import {\n parseInspectorLearningRequestV1,\n parseInspectorLearningSnapshotV1,\n} from \"@copilotkit/shared\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\n\nconst headers = {\n \"Cache-Control\": \"no-store, private\",\n \"Content-Type\": \"application/json\",\n} as const;\n\nconst errorResponse = (status: number, message: string) =>\n new Response(JSON.stringify({ error: message }), { status, headers });\n\nconst queryPage = (value: string | null): number | undefined =>\n value === null ? undefined : Number(value);\n\n/** Proxies a bounded Learning read through the runtime's server-held credential. */\nexport async function handleInspectorLearning({\n runtime,\n request,\n
|
|
1
|
+
{"version":3,"file":"handle-inspector-learning.cjs","names":["isIntelligenceRuntime","hasLearningContainerConfiguration","resolveIntelligenceUser","PlatformRequestError"],"sources":["../../../../src/v2/runtime/handlers/handle-inspector-learning.ts"],"sourcesContent":["import {\n parseInspectorLearningRequestV1,\n parseInspectorLearningSnapshotV1,\n} from \"@copilotkit/shared\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\n\nconst headers = {\n \"Cache-Control\": \"no-store, private\",\n \"Content-Type\": \"application/json\",\n} as const;\n\nconst errorResponse = (status: number, message: string) =>\n new Response(JSON.stringify({ error: message }), { status, headers });\n\nconst queryPage = (value: string | null): number | undefined =>\n value === null ? undefined : Number(value);\n\n/** Proxies a bounded Learning read through the runtime's server-held credential. */\nexport async function handleInspectorLearning({\n runtime,\n request,\n}: {\n readonly runtime: CopilotRuntimeLike;\n readonly request: Request;\n}): Promise<Response> {\n if (\n !isIntelligenceRuntime(runtime) ||\n !hasLearningContainerConfiguration(runtime)\n ) {\n return errorResponse(404, \"Not found\");\n }\n const user = await resolveIntelligenceUser({ runtime, request });\n if (user instanceof Response) return user;\n const url = new URL(request.url);\n if (\n [...url.searchParams.keys()].some(\n (key) => ![\"agentId\", \"skillsPage\", \"insightsPage\"].includes(key),\n )\n ) {\n return errorResponse(400, \"Invalid Inspector Learning request\");\n }\n const parsedRequest = parseInspectorLearningRequestV1({\n agentId: url.searchParams.get(\"agentId\") ?? undefined,\n skillsPage: queryPage(url.searchParams.get(\"skillsPage\")),\n insightsPage: queryPage(url.searchParams.get(\"insightsPage\")),\n });\n if (!parsedRequest)\n return errorResponse(400, \"Invalid Inspector Learning request\");\n\n try {\n const snapshot = parseInspectorLearningSnapshotV1(\n await runtime.intelligence.getInspectorLearning({\n ...parsedRequest,\n ...(typeof runtime.learning?.containerId === \"string\"\n ? { runtimeContainerId: runtime.learning.containerId }\n : {}),\n }),\n );\n if (!snapshot)\n return errorResponse(502, \"Invalid Inspector Learning response\");\n return new Response(JSON.stringify(snapshot), { status: 200, headers });\n } catch (error) {\n if (error instanceof PlatformRequestError && error.status === 404) {\n return errorResponse(404, \"Not found\");\n }\n return errorResponse(503, \"Inspector Learning is temporarily unavailable\");\n }\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,UAAU;CACd,iBAAiB;CACjB,gBAAgB;CACjB;AAED,MAAM,iBAAiB,QAAgB,YACrC,IAAI,SAAS,KAAK,UAAU,EAAE,OAAO,SAAS,CAAC,EAAE;CAAE;CAAQ;CAAS,CAAC;AAEvE,MAAM,aAAa,UACjB,UAAU,OAAO,SAAY,OAAO,MAAM;;AAG5C,eAAsB,wBAAwB,EAC5C,SACA,WAIoB;AACpB,KACE,CAACA,wCAAsB,QAAQ,IAC/B,CAACC,mDAAkC,QAAQ,CAE3C,QAAO,cAAc,KAAK,YAAY;CAExC,MAAM,OAAO,MAAMC,0DAAwB;EAAE;EAAS;EAAS,CAAC;AAChE,KAAI,gBAAgB,SAAU,QAAO;CACrC,MAAM,MAAM,IAAI,IAAI,QAAQ,IAAI;AAChC,KACE,CAAC,GAAG,IAAI,aAAa,MAAM,CAAC,CAAC,MAC1B,QAAQ,CAAC;EAAC;EAAW;EAAc;EAAe,CAAC,SAAS,IAAI,CAClE,CAED,QAAO,cAAc,KAAK,qCAAqC;CAEjE,MAAM,wEAAgD;EACpD,SAAS,IAAI,aAAa,IAAI,UAAU,IAAI;EAC5C,YAAY,UAAU,IAAI,aAAa,IAAI,aAAa,CAAC;EACzD,cAAc,UAAU,IAAI,aAAa,IAAI,eAAe,CAAC;EAC9D,CAAC;AACF,KAAI,CAAC,cACH,QAAO,cAAc,KAAK,qCAAqC;AAEjE,KAAI;EACF,MAAM,oEACJ,MAAM,QAAQ,aAAa,qBAAqB;GAC9C,GAAG;GACH,GAAI,OAAO,QAAQ,UAAU,gBAAgB,WACzC,EAAE,oBAAoB,QAAQ,SAAS,aAAa,GACpD,EAAE;GACP,CAAC,CACH;AACD,MAAI,CAAC,SACH,QAAO,cAAc,KAAK,sCAAsC;AAClE,SAAO,IAAI,SAAS,KAAK,UAAU,SAAS,EAAE;GAAE,QAAQ;GAAK;GAAS,CAAC;UAChE,OAAO;AACd,MAAI,iBAAiBC,uCAAwB,MAAM,WAAW,IAC5D,QAAO,cAAc,KAAK,YAAY;AAExC,SAAO,cAAc,KAAK,gDAAgD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
+
import { hasLearningContainerConfiguration } from "../core/learning.mjs";
|
|
2
3
|
import { isIntelligenceRuntime } from "../core/runtime.mjs";
|
|
3
4
|
import { PlatformRequestError } from "../intelligence-platform/client.mjs";
|
|
4
5
|
import { resolveIntelligenceUser } from "./shared/resolve-intelligence-user.mjs";
|
|
@@ -15,8 +16,8 @@ const errorResponse = (status, message) => new Response(JSON.stringify({ error:
|
|
|
15
16
|
});
|
|
16
17
|
const queryPage = (value) => value === null ? void 0 : Number(value);
|
|
17
18
|
/** Proxies a bounded Learning read through the runtime's server-held credential. */
|
|
18
|
-
async function handleInspectorLearning({ runtime, request
|
|
19
|
-
if (!
|
|
19
|
+
async function handleInspectorLearning({ runtime, request }) {
|
|
20
|
+
if (!isIntelligenceRuntime(runtime) || !hasLearningContainerConfiguration(runtime)) return errorResponse(404, "Not found");
|
|
20
21
|
const user = await resolveIntelligenceUser({
|
|
21
22
|
runtime,
|
|
22
23
|
request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-inspector-learning.mjs","names":[],"sources":["../../../../src/v2/runtime/handlers/handle-inspector-learning.ts"],"sourcesContent":["import {\n parseInspectorLearningRequestV1,\n parseInspectorLearningSnapshotV1,\n} from \"@copilotkit/shared\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\n\nconst headers = {\n \"Cache-Control\": \"no-store, private\",\n \"Content-Type\": \"application/json\",\n} as const;\n\nconst errorResponse = (status: number, message: string) =>\n new Response(JSON.stringify({ error: message }), { status, headers });\n\nconst queryPage = (value: string | null): number | undefined =>\n value === null ? undefined : Number(value);\n\n/** Proxies a bounded Learning read through the runtime's server-held credential. */\nexport async function handleInspectorLearning({\n runtime,\n request,\n
|
|
1
|
+
{"version":3,"file":"handle-inspector-learning.mjs","names":[],"sources":["../../../../src/v2/runtime/handlers/handle-inspector-learning.ts"],"sourcesContent":["import {\n parseInspectorLearningRequestV1,\n parseInspectorLearningSnapshotV1,\n} from \"@copilotkit/shared\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\n\nconst headers = {\n \"Cache-Control\": \"no-store, private\",\n \"Content-Type\": \"application/json\",\n} as const;\n\nconst errorResponse = (status: number, message: string) =>\n new Response(JSON.stringify({ error: message }), { status, headers });\n\nconst queryPage = (value: string | null): number | undefined =>\n value === null ? undefined : Number(value);\n\n/** Proxies a bounded Learning read through the runtime's server-held credential. */\nexport async function handleInspectorLearning({\n runtime,\n request,\n}: {\n readonly runtime: CopilotRuntimeLike;\n readonly request: Request;\n}): Promise<Response> {\n if (\n !isIntelligenceRuntime(runtime) ||\n !hasLearningContainerConfiguration(runtime)\n ) {\n return errorResponse(404, \"Not found\");\n }\n const user = await resolveIntelligenceUser({ runtime, request });\n if (user instanceof Response) return user;\n const url = new URL(request.url);\n if (\n [...url.searchParams.keys()].some(\n (key) => ![\"agentId\", \"skillsPage\", \"insightsPage\"].includes(key),\n )\n ) {\n return errorResponse(400, \"Invalid Inspector Learning request\");\n }\n const parsedRequest = parseInspectorLearningRequestV1({\n agentId: url.searchParams.get(\"agentId\") ?? undefined,\n skillsPage: queryPage(url.searchParams.get(\"skillsPage\")),\n insightsPage: queryPage(url.searchParams.get(\"insightsPage\")),\n });\n if (!parsedRequest)\n return errorResponse(400, \"Invalid Inspector Learning request\");\n\n try {\n const snapshot = parseInspectorLearningSnapshotV1(\n await runtime.intelligence.getInspectorLearning({\n ...parsedRequest,\n ...(typeof runtime.learning?.containerId === \"string\"\n ? { runtimeContainerId: runtime.learning.containerId }\n : {}),\n }),\n );\n if (!snapshot)\n return errorResponse(502, \"Invalid Inspector Learning response\");\n return new Response(JSON.stringify(snapshot), { status: 200, headers });\n } catch (error) {\n if (error instanceof PlatformRequestError && error.status === 404) {\n return errorResponse(404, \"Not found\");\n }\n return errorResponse(503, \"Inspector Learning is temporarily unavailable\");\n }\n}\n"],"mappings":";;;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,WAAW,IAC5D,QAAO,cAAc,KAAK,YAAY;AAExC,SAAO,cAAc,KAAK,gDAAgD"}
|
|
@@ -3,6 +3,7 @@ import { TranscribeFileOptions, TranscriptionService } from "./transcription-ser
|
|
|
3
3
|
import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, LocalThreadEndpointRecord, LocalThreadEndpointRunner, supportsLocalThreadEndpoints } from "./runner/agent-runner.cjs";
|
|
4
4
|
import { CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeUser, GetLearningContainerId, LearningContainerSelectorInput } from "./core/learning.cjs";
|
|
5
5
|
import { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest } from "./intelligence-platform/client.cjs";
|
|
6
|
+
import "./intelligence-platform/index.cjs";
|
|
6
7
|
import { AgentFactoryContext, AgentsConfig, AgentsFactory, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeConstructor, CopilotRuntimeLike, CopilotRuntimeMemoryConfig, CopilotRuntimeOptions, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions, IdentifyUserCallback, McpAppsConfig, McpAppsServerConfig, MemoryAccess, MemoryConsumer, MemoryGrant, OpenGenerativeUIConfig, OpenGenerativeUIOptions, RuntimeWithDeclaredChannels, VERSION, isA2UIEnabled, isIntelligenceRuntime, resolveAgents } from "./core/runtime.cjs";
|
|
7
8
|
import { CopilotCorsConfig } from "./core/fetch-cors.cjs";
|
|
8
9
|
import { CopilotRuntimeHooks, ErrorHookContext, HandlerHookContext, HookContext, ResponseHookContext, RouteInfo } from "./core/hooks.cjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/v2/runtime/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/v2/runtime/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;KAqDY,wBAAA,IAA4B,MAAA;EACtC,OAAA,EAAS,OAAA;AAAA,MACL,OAAA,CAAQ,QAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/runtime",
|
|
3
|
-
"version": "1.70.
|
|
3
|
+
"version": "1.70.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"ws": "^8.18.0",
|
|
109
109
|
"zod": "^3.23.3",
|
|
110
110
|
"@copilotkit/channels-core": "^0.9.2",
|
|
111
|
-
"@copilotkit/shared": "1.70.
|
|
111
|
+
"@copilotkit/shared": "1.70.3",
|
|
112
112
|
"@copilotkit/channels-intelligence": "0.9.2"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
package/skills/runtime/SKILL.md
CHANGED
|
@@ -11,7 +11,7 @@ description: >
|
|
|
11
11
|
discouraged. Load the reference under references/ that matches your task.
|
|
12
12
|
type: core
|
|
13
13
|
library: copilotkit
|
|
14
|
-
library_version: "1.70.
|
|
14
|
+
library_version: "1.70.3"
|
|
15
15
|
requires: []
|
|
16
16
|
sources:
|
|
17
17
|
- "CopilotKit/CopilotKit:packages/runtime/src/v2/runtime/core/fetch-handler.ts"
|