@copilotkit/runtime 1.72.1-canary.sp-longthread-perf → 1.73.1
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/agent/index.cjs +49 -9
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +20 -7
- package/dist/agent/index.d.cts.map +1 -1
- package/dist/agent/index.d.mts +19 -6
- package/dist/agent/index.d.mts.map +1 -1
- package/dist/agent/index.mjs +49 -9
- package/dist/agent/index.mjs.map +1 -1
- package/dist/agent/learned-skills.cjs +77 -0
- package/dist/agent/learned-skills.cjs.map +1 -0
- package/dist/agent/learned-skills.d.cts +16 -0
- package/dist/agent/learned-skills.d.cts.map +1 -0
- package/dist/agent/learned-skills.d.mts +16 -0
- package/dist/agent/learned-skills.d.mts.map +1 -0
- package/dist/agent/learned-skills.mjs +75 -0
- package/dist/agent/learned-skills.mjs.map +1 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/internal/learned-skills.cjs +22 -0
- package/dist/internal/learned-skills.d.cts +10 -0
- package/dist/internal/learned-skills.d.mts +10 -0
- package/dist/internal/learned-skills.mjs +10 -0
- package/dist/lib/index.d.cts +2 -2
- package/dist/lib/index.d.mts +2 -2
- package/dist/lib/integrations/nextjs/app-router.cjs +1 -1
- package/dist/lib/integrations/nextjs/app-router.cjs.map +1 -1
- package/dist/lib/integrations/nextjs/app-router.mjs +1 -1
- package/dist/lib/integrations/nextjs/app-router.mjs.map +1 -1
- package/dist/lib/integrations/node-http/index.cjs +1 -1
- package/dist/lib/integrations/node-http/index.cjs.map +1 -1
- package/dist/lib/integrations/node-http/index.d.cts.map +1 -1
- package/dist/lib/integrations/node-http/index.d.mts.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/lib/integrations/node-http/index.mjs.map +1 -1
- package/dist/lib/integrations/shared.cjs.map +1 -1
- package/dist/lib/integrations/shared.d.cts +1 -1
- package/dist/lib/integrations/shared.d.cts.map +1 -1
- package/dist/lib/integrations/shared.d.mts +1 -1
- package/dist/lib/integrations/shared.d.mts.map +1 -1
- package/dist/lib/integrations/shared.mjs.map +1 -1
- package/dist/lib/runtime/agent-integrations/langgraph/agent.d.cts +1 -1
- package/dist/lib/runtime/copilot-runtime.cjs +79 -37
- package/dist/lib/runtime/copilot-runtime.cjs.map +1 -1
- package/dist/lib/runtime/copilot-runtime.d.cts +54 -4
- package/dist/lib/runtime/copilot-runtime.d.cts.map +1 -1
- package/dist/lib/runtime/copilot-runtime.d.mts +56 -6
- package/dist/lib/runtime/copilot-runtime.d.mts.map +1 -1
- package/dist/lib/runtime/copilot-runtime.mjs +79 -37
- package/dist/lib/runtime/copilot-runtime.mjs.map +1 -1
- package/dist/lib/runtime/mcp-client-cache.cjs +135 -0
- package/dist/lib/runtime/mcp-client-cache.cjs.map +1 -0
- package/dist/lib/runtime/mcp-client-cache.mjs +132 -0
- package/dist/lib/runtime/mcp-client-cache.mjs.map +1 -0
- package/dist/lib/runtime/telemetry-agent-runner.cjs.map +1 -1
- package/dist/lib/runtime/telemetry-agent-runner.d.cts +1 -1
- package/dist/lib/runtime/telemetry-agent-runner.d.mts +1 -1
- package/dist/lib/runtime/telemetry-agent-runner.mjs.map +1 -1
- package/dist/package.cjs +15 -7
- package/dist/package.mjs +15 -7
- package/dist/service-adapters/anthropic/anthropic-adapter.cjs.map +1 -1
- package/dist/service-adapters/anthropic/anthropic-adapter.d.cts.map +1 -1
- package/dist/service-adapters/anthropic/anthropic-adapter.d.mts.map +1 -1
- package/dist/service-adapters/anthropic/anthropic-adapter.mjs.map +1 -1
- package/dist/service-adapters/shared/sdk-client-utils.cjs.map +1 -1
- package/dist/service-adapters/shared/sdk-client-utils.d.cts.map +1 -1
- package/dist/service-adapters/shared/sdk-client-utils.d.mts.map +1 -1
- package/dist/service-adapters/shared/sdk-client-utils.mjs.map +1 -1
- package/dist/v2/index.cjs +9 -3
- package/dist/v2/index.d.cts +12 -11
- package/dist/v2/index.d.mts +12 -11
- package/dist/v2/index.mjs +5 -5
- package/dist/v2/runtime/core/channel-manager.cjs +1 -1
- package/dist/v2/runtime/core/channel-manager.d.cts +1 -1
- package/dist/v2/runtime/core/channel-manager.d.mts +1 -1
- package/dist/v2/runtime/core/channel-manager.mjs +1 -1
- package/dist/v2/runtime/core/fetch-handler.cjs +1 -0
- package/dist/v2/runtime/core/fetch-handler.cjs.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.d.cts +2 -2
- package/dist/v2/runtime/core/fetch-handler.d.mts +2 -2
- package/dist/v2/runtime/core/fetch-handler.mjs +1 -0
- package/dist/v2/runtime/core/fetch-handler.mjs.map +1 -1
- package/dist/v2/runtime/core/runtime.cjs +5 -0
- package/dist/v2/runtime/core/runtime.cjs.map +1 -1
- package/dist/v2/runtime/core/runtime.d.cts +18 -3
- package/dist/v2/runtime/core/runtime.d.cts.map +1 -1
- package/dist/v2/runtime/core/runtime.d.mts +17 -2
- package/dist/v2/runtime/core/runtime.d.mts.map +1 -1
- package/dist/v2/runtime/core/runtime.mjs +5 -0
- package/dist/v2/runtime/core/runtime.mjs.map +1 -1
- package/dist/v2/runtime/endpoints/express-single.cjs.map +1 -1
- package/dist/v2/runtime/endpoints/express-single.d.cts +2 -2
- package/dist/v2/runtime/endpoints/express-single.d.cts.map +1 -1
- package/dist/v2/runtime/endpoints/express-single.d.mts +2 -2
- package/dist/v2/runtime/endpoints/express-single.d.mts.map +1 -1
- package/dist/v2/runtime/endpoints/express-single.mjs.map +1 -1
- package/dist/v2/runtime/endpoints/express.cjs +2 -3
- package/dist/v2/runtime/endpoints/express.cjs.map +1 -1
- package/dist/v2/runtime/endpoints/express.d.cts +26 -7
- package/dist/v2/runtime/endpoints/express.d.cts.map +1 -1
- package/dist/v2/runtime/endpoints/express.d.mts +26 -7
- package/dist/v2/runtime/endpoints/express.d.mts.map +1 -1
- package/dist/v2/runtime/endpoints/express.mjs +2 -2
- package/dist/v2/runtime/endpoints/express.mjs.map +1 -1
- package/dist/v2/runtime/endpoints/hono.d.cts +2 -2
- package/dist/v2/runtime/endpoints/hono.d.mts +2 -2
- package/dist/v2/runtime/endpoints/index.d.cts +3 -3
- package/dist/v2/runtime/endpoints/index.d.mts +3 -3
- package/dist/v2/runtime/endpoints/load-express.cjs +36 -0
- package/dist/v2/runtime/endpoints/load-express.cjs.map +1 -0
- package/dist/v2/runtime/endpoints/load-express.mjs +35 -0
- package/dist/v2/runtime/endpoints/load-express.mjs.map +1 -0
- package/dist/v2/runtime/handlers/handle-stop.cjs +18 -14
- package/dist/v2/runtime/handlers/handle-stop.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-stop.mjs +18 -14
- package/dist/v2/runtime/handlers/handle-stop.mjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-suggest.cjs +4 -3
- package/dist/v2/runtime/handlers/handle-suggest.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-suggest.mjs +5 -4
- package/dist/v2/runtime/handlers/handle-suggest.mjs.map +1 -1
- package/dist/v2/runtime/handlers/shared/agent-utils.cjs +3 -4
- package/dist/v2/runtime/handlers/shared/agent-utils.cjs.map +1 -1
- package/dist/v2/runtime/handlers/shared/agent-utils.mjs +1 -2
- package/dist/v2/runtime/handlers/shared/agent-utils.mjs.map +1 -1
- package/dist/v2/runtime/handlers/shared/sse-keep-alive.cjs +69 -0
- package/dist/v2/runtime/handlers/shared/sse-keep-alive.cjs.map +1 -0
- package/dist/v2/runtime/handlers/shared/sse-keep-alive.mjs +67 -0
- package/dist/v2/runtime/handlers/shared/sse-keep-alive.mjs.map +1 -0
- package/dist/v2/runtime/handlers/shared/sse-response.cjs +5 -2
- package/dist/v2/runtime/handlers/shared/sse-response.cjs.map +1 -1
- package/dist/v2/runtime/handlers/shared/sse-response.mjs +5 -2
- package/dist/v2/runtime/handlers/shared/sse-response.mjs.map +1 -1
- package/dist/v2/runtime/handlers/sse/connect.cjs +1 -0
- package/dist/v2/runtime/handlers/sse/connect.cjs.map +1 -1
- package/dist/v2/runtime/handlers/sse/connect.mjs +1 -0
- package/dist/v2/runtime/handlers/sse/connect.mjs.map +1 -1
- package/dist/v2/runtime/handlers/sse/run.cjs +1 -0
- package/dist/v2/runtime/handlers/sse/run.cjs.map +1 -1
- package/dist/v2/runtime/handlers/sse/run.mjs +1 -0
- package/dist/v2/runtime/handlers/sse/run.mjs.map +1 -1
- package/dist/v2/runtime/index.d.cts +9 -9
- package/dist/v2/runtime/index.d.mts +9 -9
- package/dist/v2/runtime/intelligence-platform/client.cjs +1 -1
- package/dist/v2/runtime/intelligence-platform/client.d.cts +1 -1
- package/dist/v2/runtime/intelligence-platform/client.d.mts +1 -1
- package/dist/v2/runtime/intelligence-platform/client.mjs +1 -1
- package/dist/v2/runtime/intelligence-platform/skill-registry/archive.cjs +132 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/archive.cjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/archive.d.cts +11 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/archive.d.cts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/archive.d.mts +11 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/archive.d.mts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/archive.mjs +128 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/archive.mjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/config.cjs +48 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/config.cjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/config.d.cts +27 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/config.d.cts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/config.d.mts +27 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/config.d.mts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/config.mjs +48 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/config.mjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/errors.cjs +11 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/errors.cjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/errors.d.cts +8 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/errors.d.cts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/errors.d.mts +8 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/errors.d.mts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/errors.mjs +11 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/errors.mjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/index.d.cts +8 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/index.d.mts +8 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/registry.cjs +132 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/registry.cjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/registry.d.cts +31 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/registry.d.cts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/registry.d.mts +31 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/registry.d.mts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/registry.mjs +132 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/registry.mjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.cjs +42 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.cjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.d.cts +13 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.d.cts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.d.mts +13 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.d.mts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.mjs +39 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.mjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.cjs +93 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.cjs.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.d.cts +28 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.d.cts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.d.mts +28 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.d.mts.map +1 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.mjs +92 -0
- package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.mjs.map +1 -0
- package/dist/v2/runtime/runner/agent-runner.d.cts +1 -1
- package/dist/v2/runtime/runner/in-memory.d.cts +1 -1
- package/dist/v2/runtime/runner/index.d.cts +2 -2
- package/dist/v2/runtime/runner/index.d.mts +2 -2
- package/dist/v2/runtime/runner/index.mjs +2 -2
- package/dist/v2/runtime/runner/intelligence.d.cts +1 -1
- package/package.json +17 -7
- package/dist/v2/runtime/open-generative-ui-middleware.cjs +0 -286
- package/dist/v2/runtime/open-generative-ui-middleware.cjs.map +0 -1
- package/dist/v2/runtime/open-generative-ui-middleware.mjs +0 -284
- package/dist/v2/runtime/open-generative-ui-middleware.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express-single.cjs","names":["createCopilotExpressHandler"],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"express-single.cjs","names":["createCopilotExpressHandler"],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"sourcesContent":["import { createCopilotExpressHandler } from \"./express\";\nimport type { CopilotExpressRouter } from \"./express\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\n\ninterface CopilotSingleRouteExpressParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n}\n\n/**\n * Creates an Express router that serves the CopilotKit runtime as a single\n * POST endpoint. Clients send a JSON envelope with `{ method, params, body }`\n * to dispatch to the appropriate handler.\n *\n * This is a convenience wrapper around {@link createCopilotExpressHandler}\n * with `mode: \"single-route\"` and `cors: true`.\n *\n * @example\n * ```typescript\n * import express from \"express\";\n * import { CopilotRuntime } from \"@copilotkit/runtime/v2\";\n * import { createCopilotEndpointSingleRouteExpress } 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(createCopilotEndpointSingleRouteExpress({\n * runtime,\n * basePath: \"/api/copilotkit\",\n * }));\n * app.listen(4000);\n * ```\n */\n/** @deprecated Use `createCopilotExpressHandler` with `mode: \"single-route\"` instead. */\nexport function createCopilotEndpointSingleRouteExpress({\n runtime,\n basePath,\n hooks,\n}: CopilotSingleRouteExpressParams): CopilotExpressRouter {\n return createCopilotExpressHandler({\n runtime,\n basePath,\n mode: \"single-route\",\n cors: true,\n hooks,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,wCAAwC,EACtD,SACA,UACA,SACwD;AACxD,QAAOA,4CAA4B;EACjC;EACA;EACA,MAAM;EACN,MAAM;EACN;EACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { CopilotRuntimeLike } from "../core/runtime.cjs";
|
|
3
3
|
import { CopilotRuntimeHooks } from "../core/hooks.cjs";
|
|
4
|
-
import {
|
|
4
|
+
import { CopilotExpressRouter } from "./express.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/v2/runtime/endpoints/express-single.d.ts
|
|
7
7
|
interface CopilotSingleRouteExpressParams {
|
|
@@ -43,7 +43,7 @@ declare function createCopilotEndpointSingleRouteExpress({
|
|
|
43
43
|
runtime,
|
|
44
44
|
basePath,
|
|
45
45
|
hooks
|
|
46
|
-
}: CopilotSingleRouteExpressParams):
|
|
46
|
+
}: CopilotSingleRouteExpressParams): CopilotExpressRouter;
|
|
47
47
|
//#endregion
|
|
48
48
|
export { createCopilotEndpointSingleRouteExpress };
|
|
49
49
|
//# sourceMappingURL=express-single.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express-single.d.cts","names":[],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"mappings":";;;;;;UAKU,+BAAA;EACR,OAAA,EAAS,kBAAA;EACT,QAAA;EAFuC;;;EAMvC,KAAA,GAAQ,mBAAA;AAAA;;;;;;AA8BV;;;;;;;;;;;;;;;;;;;;;;iBAAgB,uCAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA;AAAA,GACC,+BAAA,GAAkC,
|
|
1
|
+
{"version":3,"file":"express-single.d.cts","names":[],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"mappings":";;;;;;UAKU,+BAAA;EACR,OAAA,EAAS,kBAAA;EACT,QAAA;EAFuC;;;EAMvC,KAAA,GAAQ,mBAAA;AAAA;;;;;;AA8BV;;;;;;;;;;;;;;;;;;;;;;iBAAgB,uCAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA;AAAA,GACC,+BAAA,GAAkC,oBAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { CopilotRuntimeLike } from "../core/runtime.mjs";
|
|
3
3
|
import { CopilotRuntimeHooks } from "../core/hooks.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { CopilotExpressRouter } from "./express.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/v2/runtime/endpoints/express-single.d.ts
|
|
7
7
|
interface CopilotSingleRouteExpressParams {
|
|
@@ -43,7 +43,7 @@ declare function createCopilotEndpointSingleRouteExpress({
|
|
|
43
43
|
runtime,
|
|
44
44
|
basePath,
|
|
45
45
|
hooks
|
|
46
|
-
}: CopilotSingleRouteExpressParams):
|
|
46
|
+
}: CopilotSingleRouteExpressParams): CopilotExpressRouter;
|
|
47
47
|
//#endregion
|
|
48
48
|
export { createCopilotEndpointSingleRouteExpress };
|
|
49
49
|
//# sourceMappingURL=express-single.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express-single.d.mts","names":[],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"mappings":";;;;;;UAKU,+BAAA;EACR,OAAA,EAAS,kBAAA;EACT,QAAA;EAFuC;;;EAMvC,KAAA,GAAQ,mBAAA;AAAA;;;;;;AA8BV;;;;;;;;;;;;;;;;;;;;;;iBAAgB,uCAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA;AAAA,GACC,+BAAA,GAAkC,
|
|
1
|
+
{"version":3,"file":"express-single.d.mts","names":[],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"mappings":";;;;;;UAKU,+BAAA;EACR,OAAA,EAAS,kBAAA;EACT,QAAA;EAFuC;;;EAMvC,KAAA,GAAQ,mBAAA;AAAA;;;;;;AA8BV;;;;;;;;;;;;;;;;;;;;;;iBAAgB,uCAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA;AAAA,GACC,+BAAA,GAAkC,oBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express-single.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"express-single.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/express-single.ts"],"sourcesContent":["import { createCopilotExpressHandler } from \"./express\";\nimport type { CopilotExpressRouter } from \"./express\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\n\ninterface CopilotSingleRouteExpressParams {\n runtime: CopilotRuntimeLike;\n basePath: string;\n /**\n * Lifecycle hooks for request processing.\n */\n hooks?: CopilotRuntimeHooks;\n}\n\n/**\n * Creates an Express router that serves the CopilotKit runtime as a single\n * POST endpoint. Clients send a JSON envelope with `{ method, params, body }`\n * to dispatch to the appropriate handler.\n *\n * This is a convenience wrapper around {@link createCopilotExpressHandler}\n * with `mode: \"single-route\"` and `cors: true`.\n *\n * @example\n * ```typescript\n * import express from \"express\";\n * import { CopilotRuntime } from \"@copilotkit/runtime/v2\";\n * import { createCopilotEndpointSingleRouteExpress } 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(createCopilotEndpointSingleRouteExpress({\n * runtime,\n * basePath: \"/api/copilotkit\",\n * }));\n * app.listen(4000);\n * ```\n */\n/** @deprecated Use `createCopilotExpressHandler` with `mode: \"single-route\"` instead. */\nexport function createCopilotEndpointSingleRouteExpress({\n runtime,\n basePath,\n hooks,\n}: CopilotSingleRouteExpressParams): CopilotExpressRouter {\n return createCopilotExpressHandler({\n runtime,\n basePath,\n mode: \"single-route\",\n cors: true,\n hooks,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,wCAAwC,EACtD,SACA,UACA,SACwD;AACxD,QAAO,4BAA4B;EACjC;EACA;EACA,MAAM;EACN,MAAM;EACN;EACD,CAAC"}
|
|
@@ -2,9 +2,8 @@ require("reflect-metadata");
|
|
|
2
2
|
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_fetch_handler = require('../core/fetch-handler.cjs');
|
|
4
4
|
const require_express_fetch_bridge = require('./express-fetch-bridge.cjs');
|
|
5
|
+
const require_load_express = require('./load-express.cjs');
|
|
5
6
|
const require_auto_start_channels = require('./auto-start-channels.cjs');
|
|
6
|
-
let express = require("express");
|
|
7
|
-
express = require_runtime.__toESM(express);
|
|
8
7
|
let cors = require("cors");
|
|
9
8
|
cors = require_runtime.__toESM(cors);
|
|
10
9
|
|
|
@@ -28,7 +27,7 @@ function createCopilotExpressHandler({ runtime, basePath, mode = "multi-route",
|
|
|
28
27
|
next(err);
|
|
29
28
|
}
|
|
30
29
|
};
|
|
31
|
-
const router =
|
|
30
|
+
const router = require_load_express.loadExpress().Router();
|
|
32
31
|
if (corsOption) {
|
|
33
32
|
const corsConfig = corsOption === true ? {
|
|
34
33
|
origin: "*",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.cjs","names":["createCopilotRuntimeHandler","createExpressNodeHandler"],"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,SAAgB,4BAA4B,EAC1C,SACA,UACA,OAAO,eACP,MAAM,aAAa,MACnB,OACA,kBACA,mBACqD;CACrD,MAAM,iBAAiB,kBAAkB,SAAS;CAElD,MAAM,UAAUA,kDAA4B;EAC1C;EACA,UAAU;EACV;EACA,MAAM;EACN;EACA;EACA;EACD,CAAC;CAEF,MAAM,cAAcC,sDAAyB,QAAQ;CAErD,MAAM,iBAAiB,OACrB,KACA,KACA,SACG;AACH,MAAI;AACF,SAAM,YAAY,KAAK,IAAI;WACpB,KAAK;AACZ,QAAK,IAAI;;;CAIb,MAAM,SAAS,gBAAQ,QAAQ;AAG/B,KAAI,YAAY;EACd,MAAM,aACJ,eAAe,OACX;GACE,QAAQ;GACR,SAAS;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACD,gBAAgB,CAAC,IAAI;GACtB,GACD;AACN,SAAO,sBAAS,WAAW,CAAC;;AAI9B,KAAI,SAAS,gBAAgB;AAC3B,SAAO,KAAK,gBAAgB,eAAe;AAC3C,SAAO,QAAQ,gBAAgB,eAAe;YACrC,mBAAmB,IAC5B,QAAO,IAAI,MAAM,eAAe;KAEhC,QAAO,IACL,IAAI,OAAO,IAAI,aAAa,eAAe,CAAC,WAAW,EACvD,eACD;CAGH,MAAM,gBAAsC;AAC5C,eAAc,WAAW,QAAQ;AACjC,+CAAkB,cAAc,SAAS;AACzC,QAAO;;AAGT,SAAS,aAAa,GAAmB;AACvC,QAAO,EAAE,QAAQ,uBAAuB,OAAO;;AAGjD,SAAS,kBAAkB,MAAsB;AAC/C,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,iDAAiD;AAGnE,KAAI,CAAC,KAAK,WAAW,IAAI,CACvB,QAAO,IAAI;AAGb,KAAI,KAAK,SAAS,KAAK,KAAK,SAAS,IAAI,CACvC,QAAO,KAAK,MAAM,GAAG,GAAG;AAG1B,QAAO"}
|
|
1
|
+
{"version":3,"file":"express.cjs","names":["createCopilotRuntimeHandler","createExpressNodeHandler","loadExpress"],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"sourcesContent":["import type {\n Request as ExpressRequest,\n Response as ExpressResponse,\n NextFunction,\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 { loadExpress } from \"./load-express\";\nimport { autoStartChannels } from \"./auto-start-channels\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\n\n/**\n * The middleware `createCopilotExpressHandler` returns: an Express router that\n * may also carry an optional {@link ChannelsControl} surface. The router object\n * itself is request-scoped middleware, but an Express app can only run inside a\n * long-running `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 *\n * Deliberately NOT typed as Express's own `Router`. Pinning that type binds our\n * public surface to a single Express major: `@types/express@4` declares\n * `Request.param()` and `@types/express@5` does not, so a v4-typed router is not\n * assignable to a v5 `app.use()` and an Express 5 app cannot compile against us\n * at all (#7276). The call signature below is what `use()` accepts in both\n * majors, and the methods beside it are the router surface both majors share.\n *\n * The runtime value is still a real `express.Router()`; only the declared type\n * is widened.\n */\nexport type CopilotExpressRouter = ((\n req: any,\n res: any,\n next: (err?: unknown) => void,\n) => void) & {\n channels?: ChannelsControl;\n\n // The common router-configuration surface, declared structurally so that\n // consumers who add their own middleware or routes to the returned value keep\n // compiling. These are NOT taken from either Express major's `Router`, because\n // that is exactly what makes the type un-mountable across majors.\n use(...handlers: any[]): CopilotExpressRouter;\n get(...handlers: any[]): CopilotExpressRouter;\n post(...handlers: any[]): CopilotExpressRouter;\n put(...handlers: any[]): CopilotExpressRouter;\n patch(...handlers: any[]): CopilotExpressRouter;\n delete(...handlers: any[]): CopilotExpressRouter;\n options(...handlers: any[]): CopilotExpressRouter;\n all(...handlers: any[]): CopilotExpressRouter;\n\n // `route()` and `param()` are the remaining Router-configuration methods\n // consumers reach for, and dropping them would break\n // `router.route(\"/x\").get(...)` and `router.param(...)` callers for no gain: a\n // re-pin to either Express major is caught by\n // `scripts/validate-dts-imports.ts`, which fails on any published declaration\n // that names `express` at all.\n //\n // `stack` is deliberately absent. It is Express's own internal middleware\n // array, not a configuration surface, and it is what\n // `express-major-compat.test-d.ts` asserts against to keep this type from\n // quietly becoming a `Router` again.\n route(path: any): any;\n param(...handlers: any[]): CopilotExpressRouter;\n};\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 = loadExpress().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":";;;;;;;;;;AAmKA,SAAgB,4BAA4B,EAC1C,SACA,UACA,OAAO,eACP,MAAM,aAAa,MACnB,OACA,kBACA,mBACqD;CACrD,MAAM,iBAAiB,kBAAkB,SAAS;CAElD,MAAM,UAAUA,kDAA4B;EAC1C;EACA,UAAU;EACV;EACA,MAAM;EACN;EACA;EACA;EACD,CAAC;CAEF,MAAM,cAAcC,sDAAyB,QAAQ;CAErD,MAAM,iBAAiB,OACrB,KACA,KACA,SACG;AACH,MAAI;AACF,SAAM,YAAY,KAAK,IAAI;WACpB,KAAK;AACZ,QAAK,IAAI;;;CAIb,MAAM,SAASC,kCAAa,CAAC,QAAQ;AAGrC,KAAI,YAAY;EACd,MAAM,aACJ,eAAe,OACX;GACE,QAAQ;GACR,SAAS;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACD,gBAAgB,CAAC,IAAI;GACtB,GACD;AACN,SAAO,sBAAS,WAAW,CAAC;;AAI9B,KAAI,SAAS,gBAAgB;AAC3B,SAAO,KAAK,gBAAgB,eAAe;AAC3C,SAAO,QAAQ,gBAAgB,eAAe;YACrC,mBAAmB,IAC5B,QAAO,IAAI,MAAM,eAAe;KAEhC,QAAO,IACL,IAAI,OAAO,IAAI,aAAa,eAAe,CAAC,WAAW,EACvD,eACD;CAGH,MAAM,gBAAsC;AAC5C,eAAc,WAAW,QAAQ;AACjC,+CAAkB,cAAc,SAAS;AACzC,QAAO;;AAGT,SAAS,aAAa,GAAmB;AACvC,QAAO,EAAE,QAAQ,uBAAuB,OAAO;;AAGjD,SAAS,kBAAkB,MAAsB;AAC/C,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,iDAAiD;AAGnE,KAAI,CAAC,KAAK,WAAW,IAAI,CACvB,QAAO,IAAI;AAGb,KAAI,KAAK,SAAS,KAAK,KAAK,SAAS,IAAI,CACvC,QAAO,KAAK,MAAM,GAAG,GAAG;AAG1B,QAAO"}
|
|
@@ -1,22 +1,41 @@
|
|
|
1
1
|
|
|
2
2
|
import { CopilotRuntimeLike } from "../core/runtime.cjs";
|
|
3
|
-
import { CopilotRuntimeHooks } from "../core/hooks.cjs";
|
|
4
3
|
import { ActivateChannelEngine, ChannelsControl } from "../core/channel-manager.cjs";
|
|
5
|
-
import {
|
|
4
|
+
import { CopilotRuntimeHooks } from "../core/hooks.cjs";
|
|
6
5
|
import { CorsOptions } from "cors";
|
|
7
6
|
|
|
8
7
|
//#region src/v2/runtime/endpoints/express.d.ts
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
11
|
-
* {@link ChannelsControl} surface. The
|
|
12
|
-
* middleware, but an Express app can only run inside a
|
|
13
|
-
* `http.Server` — so this wrapper is a lifecycle-owning host like
|
|
9
|
+
* The middleware `createCopilotExpressHandler` returns: an Express router that
|
|
10
|
+
* may also carry an optional {@link ChannelsControl} surface. The router object
|
|
11
|
+
* itself is request-scoped middleware, but an Express app can only run inside a
|
|
12
|
+
* long-running `http.Server` — so this wrapper is a lifecycle-owning host like
|
|
14
13
|
* `createCopilotNodeListener`: it STARTS activation of the runtime's declared
|
|
15
14
|
* managed Channels at creation, and `.channels` is here to observe (`ready()`)
|
|
16
15
|
* or tear down (`stop()`) that activation.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately NOT typed as Express's own `Router`. Pinning that type binds our
|
|
18
|
+
* public surface to a single Express major: `@types/express@4` declares
|
|
19
|
+
* `Request.param()` and `@types/express@5` does not, so a v4-typed router is not
|
|
20
|
+
* assignable to a v5 `app.use()` and an Express 5 app cannot compile against us
|
|
21
|
+
* at all (#7276). The call signature below is what `use()` accepts in both
|
|
22
|
+
* majors, and the methods beside it are the router surface both majors share.
|
|
23
|
+
*
|
|
24
|
+
* The runtime value is still a real `express.Router()`; only the declared type
|
|
25
|
+
* is widened.
|
|
17
26
|
*/
|
|
18
|
-
type CopilotExpressRouter =
|
|
27
|
+
type CopilotExpressRouter = ((req: any, res: any, next: (err?: unknown) => void) => void) & {
|
|
19
28
|
channels?: ChannelsControl;
|
|
29
|
+
use(...handlers: any[]): CopilotExpressRouter;
|
|
30
|
+
get(...handlers: any[]): CopilotExpressRouter;
|
|
31
|
+
post(...handlers: any[]): CopilotExpressRouter;
|
|
32
|
+
put(...handlers: any[]): CopilotExpressRouter;
|
|
33
|
+
patch(...handlers: any[]): CopilotExpressRouter;
|
|
34
|
+
delete(...handlers: any[]): CopilotExpressRouter;
|
|
35
|
+
options(...handlers: any[]): CopilotExpressRouter;
|
|
36
|
+
all(...handlers: any[]): CopilotExpressRouter;
|
|
37
|
+
route(path: any): any;
|
|
38
|
+
param(...handlers: any[]): CopilotExpressRouter;
|
|
20
39
|
};
|
|
21
40
|
interface CopilotExpressEndpointParams {
|
|
22
41
|
runtime: CopilotRuntimeLike;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.d.cts","names":[],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"express.d.cts","names":[],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"mappings":";;;;;;;;;AAqCA;;;;;;;;;;;;;;;;;KAAY,oBAAA,KACV,GAAA,OACA,GAAA,OACA,IAAA,GAAO,GAAA;EAEP,QAAA,GAAW,eAAA;EAMX,GAAA,IAAO,QAAA,UAAkB,oBAAA;EACzB,GAAA,IAAO,QAAA,UAAkB,oBAAA;EACzB,IAAA,IAAQ,QAAA,UAAkB,oBAAA;EAC1B,GAAA,IAAO,QAAA,UAAkB,oBAAA;EACzB,KAAA,IAAS,QAAA,UAAkB,oBAAA;EAC3B,MAAA,IAAU,QAAA,UAAkB,oBAAA;EAC5B,OAAA,IAAW,QAAA,UAAkB,oBAAA;EAC7B,GAAA,IAAO,QAAA,UAAkB,oBAAA;EAazB,KAAA,CAAM,IAAA;EACN,KAAA,IAAS,QAAA,UAAkB,oBAAA;AAAA;AAAA,UAGZ,4BAAA;EACf,OAAA,EAAS,kBAAA;EACT,QAAA;EAtBA;;;;;EA6BA,IAAA;EA3BA;;;;;;EAmCA,IAAA,aAAiB,WAAA;EArBX;;;EA0BN,KAAA,GAAQ,mBAAA;EAzBuC;;AAGjD;;;;;EA+BE,gBAAA;EAMkB;;;;EAAlB,eAAA,GAAkB,qBAAA;AAAA;AAAA,iBAsDJ,2BAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA,EAAM,UAAA;EACN,KAAA;EACA,gBAAA;EACA;AAAA,GACC,4BAAA,GAA+B,oBAAA"}
|
|
@@ -1,22 +1,41 @@
|
|
|
1
1
|
|
|
2
2
|
import { CopilotRuntimeLike } from "../core/runtime.mjs";
|
|
3
|
-
import { CopilotRuntimeHooks } from "../core/hooks.mjs";
|
|
4
3
|
import { ActivateChannelEngine, ChannelsControl } from "../core/channel-manager.mjs";
|
|
5
|
-
import {
|
|
4
|
+
import { CopilotRuntimeHooks } from "../core/hooks.mjs";
|
|
6
5
|
import { CorsOptions } from "cors";
|
|
7
6
|
|
|
8
7
|
//#region src/v2/runtime/endpoints/express.d.ts
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
11
|
-
* {@link ChannelsControl} surface. The
|
|
12
|
-
* middleware, but an Express app can only run inside a
|
|
13
|
-
* `http.Server` — so this wrapper is a lifecycle-owning host like
|
|
9
|
+
* The middleware `createCopilotExpressHandler` returns: an Express router that
|
|
10
|
+
* may also carry an optional {@link ChannelsControl} surface. The router object
|
|
11
|
+
* itself is request-scoped middleware, but an Express app can only run inside a
|
|
12
|
+
* long-running `http.Server` — so this wrapper is a lifecycle-owning host like
|
|
14
13
|
* `createCopilotNodeListener`: it STARTS activation of the runtime's declared
|
|
15
14
|
* managed Channels at creation, and `.channels` is here to observe (`ready()`)
|
|
16
15
|
* or tear down (`stop()`) that activation.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately NOT typed as Express's own `Router`. Pinning that type binds our
|
|
18
|
+
* public surface to a single Express major: `@types/express@4` declares
|
|
19
|
+
* `Request.param()` and `@types/express@5` does not, so a v4-typed router is not
|
|
20
|
+
* assignable to a v5 `app.use()` and an Express 5 app cannot compile against us
|
|
21
|
+
* at all (#7276). The call signature below is what `use()` accepts in both
|
|
22
|
+
* majors, and the methods beside it are the router surface both majors share.
|
|
23
|
+
*
|
|
24
|
+
* The runtime value is still a real `express.Router()`; only the declared type
|
|
25
|
+
* is widened.
|
|
17
26
|
*/
|
|
18
|
-
type CopilotExpressRouter =
|
|
27
|
+
type CopilotExpressRouter = ((req: any, res: any, next: (err?: unknown) => void) => void) & {
|
|
19
28
|
channels?: ChannelsControl;
|
|
29
|
+
use(...handlers: any[]): CopilotExpressRouter;
|
|
30
|
+
get(...handlers: any[]): CopilotExpressRouter;
|
|
31
|
+
post(...handlers: any[]): CopilotExpressRouter;
|
|
32
|
+
put(...handlers: any[]): CopilotExpressRouter;
|
|
33
|
+
patch(...handlers: any[]): CopilotExpressRouter;
|
|
34
|
+
delete(...handlers: any[]): CopilotExpressRouter;
|
|
35
|
+
options(...handlers: any[]): CopilotExpressRouter;
|
|
36
|
+
all(...handlers: any[]): CopilotExpressRouter;
|
|
37
|
+
route(path: any): any;
|
|
38
|
+
param(...handlers: any[]): CopilotExpressRouter;
|
|
20
39
|
};
|
|
21
40
|
interface CopilotExpressEndpointParams {
|
|
22
41
|
runtime: CopilotRuntimeLike;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.d.mts","names":[],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"express.d.mts","names":[],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"mappings":";;;;;;;;;AAqCA;;;;;;;;;;;;;;;;;KAAY,oBAAA,KACV,GAAA,OACA,GAAA,OACA,IAAA,GAAO,GAAA;EAEP,QAAA,GAAW,eAAA;EAMX,GAAA,IAAO,QAAA,UAAkB,oBAAA;EACzB,GAAA,IAAO,QAAA,UAAkB,oBAAA;EACzB,IAAA,IAAQ,QAAA,UAAkB,oBAAA;EAC1B,GAAA,IAAO,QAAA,UAAkB,oBAAA;EACzB,KAAA,IAAS,QAAA,UAAkB,oBAAA;EAC3B,MAAA,IAAU,QAAA,UAAkB,oBAAA;EAC5B,OAAA,IAAW,QAAA,UAAkB,oBAAA;EAC7B,GAAA,IAAO,QAAA,UAAkB,oBAAA;EAazB,KAAA,CAAM,IAAA;EACN,KAAA,IAAS,QAAA,UAAkB,oBAAA;AAAA;AAAA,UAGZ,4BAAA;EACf,OAAA,EAAS,kBAAA;EACT,QAAA;EAtBA;;;;;EA6BA,IAAA;EA3BA;;;;;;EAmCA,IAAA,aAAiB,WAAA;EArBX;;;EA0BN,KAAA,GAAQ,mBAAA;EAzBuC;;AAGjD;;;;;EA+BE,gBAAA;EAMkB;;;;EAAlB,eAAA,GAAkB,qBAAA;AAAA;AAAA,iBAsDJ,2BAAA,CAAA;EACd,OAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA,EAAM,UAAA;EACN,KAAA;EACA,gBAAA;EACA;AAAA,GACC,4BAAA,GAA+B,oBAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { createCopilotRuntimeHandler } from "../core/fetch-handler.mjs";
|
|
3
3
|
import { createExpressNodeHandler } from "./express-fetch-bridge.mjs";
|
|
4
|
+
import { loadExpress } from "./load-express.mjs";
|
|
4
5
|
import { autoStartChannels } from "./auto-start-channels.mjs";
|
|
5
|
-
import express from "express";
|
|
6
6
|
import cors from "cors";
|
|
7
7
|
|
|
8
8
|
//#region src/v2/runtime/endpoints/express.ts
|
|
@@ -25,7 +25,7 @@ function createCopilotExpressHandler({ runtime, basePath, mode = "multi-route",
|
|
|
25
25
|
next(err);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
const router =
|
|
28
|
+
const router = loadExpress().Router();
|
|
29
29
|
if (corsOption) {
|
|
30
30
|
const corsConfig = corsOption === true ? {
|
|
31
31
|
origin: "*",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"express.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/express.ts"],"sourcesContent":["import type {\n Request as ExpressRequest,\n Response as ExpressResponse,\n NextFunction,\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 { loadExpress } from \"./load-express\";\nimport { autoStartChannels } from \"./auto-start-channels\";\nimport type { CopilotRuntimeHooks } from \"../core/hooks\";\n\n/**\n * The middleware `createCopilotExpressHandler` returns: an Express router that\n * may also carry an optional {@link ChannelsControl} surface. The router object\n * itself is request-scoped middleware, but an Express app can only run inside a\n * long-running `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 *\n * Deliberately NOT typed as Express's own `Router`. Pinning that type binds our\n * public surface to a single Express major: `@types/express@4` declares\n * `Request.param()` and `@types/express@5` does not, so a v4-typed router is not\n * assignable to a v5 `app.use()` and an Express 5 app cannot compile against us\n * at all (#7276). The call signature below is what `use()` accepts in both\n * majors, and the methods beside it are the router surface both majors share.\n *\n * The runtime value is still a real `express.Router()`; only the declared type\n * is widened.\n */\nexport type CopilotExpressRouter = ((\n req: any,\n res: any,\n next: (err?: unknown) => void,\n) => void) & {\n channels?: ChannelsControl;\n\n // The common router-configuration surface, declared structurally so that\n // consumers who add their own middleware or routes to the returned value keep\n // compiling. These are NOT taken from either Express major's `Router`, because\n // that is exactly what makes the type un-mountable across majors.\n use(...handlers: any[]): CopilotExpressRouter;\n get(...handlers: any[]): CopilotExpressRouter;\n post(...handlers: any[]): CopilotExpressRouter;\n put(...handlers: any[]): CopilotExpressRouter;\n patch(...handlers: any[]): CopilotExpressRouter;\n delete(...handlers: any[]): CopilotExpressRouter;\n options(...handlers: any[]): CopilotExpressRouter;\n all(...handlers: any[]): CopilotExpressRouter;\n\n // `route()` and `param()` are the remaining Router-configuration methods\n // consumers reach for, and dropping them would break\n // `router.route(\"/x\").get(...)` and `router.param(...)` callers for no gain: a\n // re-pin to either Express major is caught by\n // `scripts/validate-dts-imports.ts`, which fails on any published declaration\n // that names `express` at all.\n //\n // `stack` is deliberately absent. It is Express's own internal middleware\n // array, not a configuration surface, and it is what\n // `express-major-compat.test-d.ts` asserts against to keep this type from\n // quietly becoming a `Router` again.\n route(path: any): any;\n param(...handlers: any[]): CopilotExpressRouter;\n};\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 = loadExpress().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":";;;;;;;;AAmKA,SAAgB,4BAA4B,EAC1C,SACA,UACA,OAAO,eACP,MAAM,aAAa,MACnB,OACA,kBACA,mBACqD;CACrD,MAAM,iBAAiB,kBAAkB,SAAS;CAElD,MAAM,UAAU,4BAA4B;EAC1C;EACA,UAAU;EACV;EACA,MAAM;EACN;EACA;EACA;EACD,CAAC;CAEF,MAAM,cAAc,yBAAyB,QAAQ;CAErD,MAAM,iBAAiB,OACrB,KACA,KACA,SACG;AACH,MAAI;AACF,SAAM,YAAY,KAAK,IAAI;WACpB,KAAK;AACZ,QAAK,IAAI;;;CAIb,MAAM,SAAS,aAAa,CAAC,QAAQ;AAGrC,KAAI,YAAY;EACd,MAAM,aACJ,eAAe,OACX;GACE,QAAQ;GACR,SAAS;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACD,gBAAgB,CAAC,IAAI;GACtB,GACD;AACN,SAAO,IAAI,KAAK,WAAW,CAAC;;AAI9B,KAAI,SAAS,gBAAgB;AAC3B,SAAO,KAAK,gBAAgB,eAAe;AAC3C,SAAO,QAAQ,gBAAgB,eAAe;YACrC,mBAAmB,IAC5B,QAAO,IAAI,MAAM,eAAe;KAEhC,QAAO,IACL,IAAI,OAAO,IAAI,aAAa,eAAe,CAAC,WAAW,EACvD,eACD;CAGH,MAAM,gBAAsC;AAC5C,eAAc,WAAW,QAAQ;AACjC,mBAAkB,cAAc,SAAS;AACzC,QAAO;;AAGT,SAAS,aAAa,GAAmB;AACvC,QAAO,EAAE,QAAQ,uBAAuB,OAAO;;AAGjD,SAAS,kBAAkB,MAAsB;AAC/C,KAAI,CAAC,KACH,OAAM,IAAI,MAAM,iDAAiD;AAGnE,KAAI,CAAC,KAAK,WAAW,IAAI,CACvB,QAAO,IAAI;AAGb,KAAI,KAAK,SAAS,KAAK,KAAK,SAAS,IAAI,CACvC,QAAO,KAAK,MAAM,GAAG,GAAG;AAG1B,QAAO"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { CopilotRuntimeLike } from "../core/runtime.cjs";
|
|
3
|
-
import { CopilotCorsConfig } from "../core/fetch-cors.cjs";
|
|
4
|
-
import { CopilotRuntimeHooks } from "../core/hooks.cjs";
|
|
5
3
|
import { ActivateChannelEngine, ChannelsControl } from "../core/channel-manager.cjs";
|
|
4
|
+
import { CopilotRuntimeHooks } from "../core/hooks.cjs";
|
|
5
|
+
import { CopilotCorsConfig } from "../core/fetch-cors.cjs";
|
|
6
6
|
import { Hono } from "hono";
|
|
7
7
|
|
|
8
8
|
//#region src/v2/runtime/endpoints/hono.d.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { CopilotRuntimeLike } from "../core/runtime.mjs";
|
|
3
|
-
import { CopilotCorsConfig } from "../core/fetch-cors.mjs";
|
|
4
|
-
import { CopilotRuntimeHooks } from "../core/hooks.mjs";
|
|
5
3
|
import { ActivateChannelEngine, ChannelsControl } from "../core/channel-manager.mjs";
|
|
4
|
+
import { CopilotRuntimeHooks } from "../core/hooks.mjs";
|
|
5
|
+
import { CopilotCorsConfig } from "../core/fetch-cors.mjs";
|
|
6
6
|
import { Hono } from "hono";
|
|
7
7
|
|
|
8
8
|
//#region src/v2/runtime/endpoints/hono.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig } from "./hono.cjs";
|
|
3
|
-
import { createCopilotEndpointSingleRoute } from "./hono-single.cjs";
|
|
4
2
|
import { CopilotExpressEndpointParams, CopilotExpressRouter, createCopilotExpressHandler } from "./express.cjs";
|
|
5
|
-
import { createCopilotEndpointSingleRouteExpress } from "./express-single.cjs";
|
|
3
|
+
import { createCopilotEndpointSingleRouteExpress } from "./express-single.cjs";
|
|
4
|
+
import { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig } from "./hono.cjs";
|
|
5
|
+
import { createCopilotEndpointSingleRoute } from "./hono-single.cjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig } from "./hono.mjs";
|
|
3
|
-
import { createCopilotEndpointSingleRoute } from "./hono-single.mjs";
|
|
4
2
|
import { CopilotExpressEndpointParams, CopilotExpressRouter, createCopilotExpressHandler } from "./express.mjs";
|
|
5
|
-
import { createCopilotEndpointSingleRouteExpress } from "./express-single.mjs";
|
|
3
|
+
import { createCopilotEndpointSingleRouteExpress } from "./express-single.mjs";
|
|
4
|
+
import { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig } from "./hono.mjs";
|
|
5
|
+
import { createCopilotEndpointSingleRoute } from "./hono-single.mjs";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require("reflect-metadata");
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let node_module = require("node:module");
|
|
4
|
+
|
|
5
|
+
//#region src/v2/runtime/endpoints/load-express.ts
|
|
6
|
+
/**
|
|
7
|
+
* Load `express` at call time rather than at module load time.
|
|
8
|
+
*
|
|
9
|
+
* `express` is an OPTIONAL peer: an app that mounts the Hono or Node adapter
|
|
10
|
+
* never installs it. The Express adapter is re-exported from the
|
|
11
|
+
* `@copilotkit/runtime/v2` barrel, so a static `import express from "express"`
|
|
12
|
+
* there would make that barrel unimportable for every consumer who does not use
|
|
13
|
+
* Express. Loading it inside the factory keeps the barrel free of Express and
|
|
14
|
+
* moves the failure to the only place it is a real failure: calling an Express
|
|
15
|
+
* factory without Express installed.
|
|
16
|
+
*
|
|
17
|
+
* This lives in its own module, and not beside the factory, for two reasons: it
|
|
18
|
+
* is not part of the published surface (the endpoints barrel does not re-export
|
|
19
|
+
* it), and a test can reach it directly and inject `requireFrom`.
|
|
20
|
+
*
|
|
21
|
+
* `scripts/validate-optional-peer-entries.ts` is what keeps the loading lazy: it
|
|
22
|
+
* fails if any entry point reaches an optional peer at module-initialization
|
|
23
|
+
* time, in either published format.
|
|
24
|
+
*/
|
|
25
|
+
function loadExpress(requireFrom = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)) {
|
|
26
|
+
try {
|
|
27
|
+
requireFrom.resolve("express");
|
|
28
|
+
} catch (cause) {
|
|
29
|
+
throw new Error("@copilotkit/runtime: the Express adapter requires `express`, which is an optional peer dependency and is not installed. Install it with `npm install express` (^4.18.0 || ^5.0.0), or mount the Hono adapter from `@copilotkit/runtime/v2/hono` instead.", { cause });
|
|
30
|
+
}
|
|
31
|
+
return requireFrom("express");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.loadExpress = loadExpress;
|
|
36
|
+
//# sourceMappingURL=load-express.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-express.cjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/load-express.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\n/**\n * How `loadExpress` reaches the module system. `createRequire(...)` returns\n * exactly this shape; a test can pass its own.\n */\nexport interface RequireLike {\n (specifier: string): any;\n resolve(specifier: string): string;\n}\n\n/**\n * Load `express` at call time rather than at module load time.\n *\n * `express` is an OPTIONAL peer: an app that mounts the Hono or Node adapter\n * never installs it. The Express adapter is re-exported from the\n * `@copilotkit/runtime/v2` barrel, so a static `import express from \"express\"`\n * there would make that barrel unimportable for every consumer who does not use\n * Express. Loading it inside the factory keeps the barrel free of Express and\n * moves the failure to the only place it is a real failure: calling an Express\n * factory without Express installed.\n *\n * This lives in its own module, and not beside the factory, for two reasons: it\n * is not part of the published surface (the endpoints barrel does not re-export\n * it), and a test can reach it directly and inject `requireFrom`.\n *\n * `scripts/validate-optional-peer-entries.ts` is what keeps the loading lazy: it\n * fails if any entry point reaches an optional peer at module-initialization\n * time, in either published format.\n */\nexport function loadExpress(\n requireFrom: RequireLike = createRequire(import.meta.url) as RequireLike,\n): { Router: () => any } {\n // Resolve and evaluate in two steps, so that only a RESOLUTION failure is\n // reported as \"not installed\". Wrapping the whole load would also catch\n // express throwing while it evaluates -- a broken transitive dependency, a\n // failed native binding, a syntax error in a patched copy -- and would send\n // the reader off to install a package they already have. Those errors must\n // surface as themselves.\n try {\n requireFrom.resolve(\"express\");\n } catch (cause) {\n throw new Error(\n \"@copilotkit/runtime: the Express adapter requires `express`, which is an \" +\n \"optional peer dependency and is not installed. Install it with \" +\n \"`npm install express` (^4.18.0 || ^5.0.0), or mount the Hono adapter \" +\n \"from `@copilotkit/runtime/v2/hono` instead.\",\n { cause },\n );\n }\n\n return requireFrom(\"express\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,YACd,2FAAyD,EAClC;AAOvB,KAAI;AACF,cAAY,QAAQ,UAAU;UACvB,OAAO;AACd,QAAM,IAAI,MACR,4PAIA,EAAE,OAAO,CACV;;AAGH,QAAO,YAAY,UAAU"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
|
|
4
|
+
//#region src/v2/runtime/endpoints/load-express.ts
|
|
5
|
+
/**
|
|
6
|
+
* Load `express` at call time rather than at module load time.
|
|
7
|
+
*
|
|
8
|
+
* `express` is an OPTIONAL peer: an app that mounts the Hono or Node adapter
|
|
9
|
+
* never installs it. The Express adapter is re-exported from the
|
|
10
|
+
* `@copilotkit/runtime/v2` barrel, so a static `import express from "express"`
|
|
11
|
+
* there would make that barrel unimportable for every consumer who does not use
|
|
12
|
+
* Express. Loading it inside the factory keeps the barrel free of Express and
|
|
13
|
+
* moves the failure to the only place it is a real failure: calling an Express
|
|
14
|
+
* factory without Express installed.
|
|
15
|
+
*
|
|
16
|
+
* This lives in its own module, and not beside the factory, for two reasons: it
|
|
17
|
+
* is not part of the published surface (the endpoints barrel does not re-export
|
|
18
|
+
* it), and a test can reach it directly and inject `requireFrom`.
|
|
19
|
+
*
|
|
20
|
+
* `scripts/validate-optional-peer-entries.ts` is what keeps the loading lazy: it
|
|
21
|
+
* fails if any entry point reaches an optional peer at module-initialization
|
|
22
|
+
* time, in either published format.
|
|
23
|
+
*/
|
|
24
|
+
function loadExpress(requireFrom = createRequire(import.meta.url)) {
|
|
25
|
+
try {
|
|
26
|
+
requireFrom.resolve("express");
|
|
27
|
+
} catch (cause) {
|
|
28
|
+
throw new Error("@copilotkit/runtime: the Express adapter requires `express`, which is an optional peer dependency and is not installed. Install it with `npm install express` (^4.18.0 || ^5.0.0), or mount the Hono adapter from `@copilotkit/runtime/v2/hono` instead.", { cause });
|
|
29
|
+
}
|
|
30
|
+
return requireFrom("express");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { loadExpress };
|
|
35
|
+
//# sourceMappingURL=load-express.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-express.mjs","names":[],"sources":["../../../../src/v2/runtime/endpoints/load-express.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\n/**\n * How `loadExpress` reaches the module system. `createRequire(...)` returns\n * exactly this shape; a test can pass its own.\n */\nexport interface RequireLike {\n (specifier: string): any;\n resolve(specifier: string): string;\n}\n\n/**\n * Load `express` at call time rather than at module load time.\n *\n * `express` is an OPTIONAL peer: an app that mounts the Hono or Node adapter\n * never installs it. The Express adapter is re-exported from the\n * `@copilotkit/runtime/v2` barrel, so a static `import express from \"express\"`\n * there would make that barrel unimportable for every consumer who does not use\n * Express. Loading it inside the factory keeps the barrel free of Express and\n * moves the failure to the only place it is a real failure: calling an Express\n * factory without Express installed.\n *\n * This lives in its own module, and not beside the factory, for two reasons: it\n * is not part of the published surface (the endpoints barrel does not re-export\n * it), and a test can reach it directly and inject `requireFrom`.\n *\n * `scripts/validate-optional-peer-entries.ts` is what keeps the loading lazy: it\n * fails if any entry point reaches an optional peer at module-initialization\n * time, in either published format.\n */\nexport function loadExpress(\n requireFrom: RequireLike = createRequire(import.meta.url) as RequireLike,\n): { Router: () => any } {\n // Resolve and evaluate in two steps, so that only a RESOLUTION failure is\n // reported as \"not installed\". Wrapping the whole load would also catch\n // express throwing while it evaluates -- a broken transitive dependency, a\n // failed native binding, a syntax error in a patched copy -- and would send\n // the reader off to install a package they already have. Those errors must\n // surface as themselves.\n try {\n requireFrom.resolve(\"express\");\n } catch (cause) {\n throw new Error(\n \"@copilotkit/runtime: the Express adapter requires `express`, which is an \" +\n \"optional peer dependency and is not installed. Install it with \" +\n \"`npm install express` (^4.18.0 || ^5.0.0), or mount the Hono adapter \" +\n \"from `@copilotkit/runtime/v2/hono` instead.\",\n { cause },\n );\n }\n\n return requireFrom(\"express\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,YACd,cAA2B,cAAc,OAAO,KAAK,IAAI,EAClC;AAOvB,KAAI;AACF,cAAY,QAAQ,UAAU;UACvB,OAAO;AACd,QAAM,IAAI,MACR,4PAIA,EAAE,OAAO,CACV;;AAGH,QAAO,YAAY,UAAU"}
|
|
@@ -7,29 +7,33 @@ const require_resolve_intelligence_user = require('./shared/resolve-intelligence
|
|
|
7
7
|
let _ag_ui_client = require("@ag-ui/client");
|
|
8
8
|
|
|
9
9
|
//#region src/v2/runtime/handlers/handle-stop.ts
|
|
10
|
+
/** Read `{ runId? }` from a stop request body; a 400 Response when the body is not a valid scope. */
|
|
11
|
+
async function parseStopScope(request) {
|
|
12
|
+
try {
|
|
13
|
+
const raw = await request.text();
|
|
14
|
+
const body = raw.trim() ? JSON.parse(raw) : {};
|
|
15
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) return Response.json({ error: "Invalid stop request" }, { status: 400 });
|
|
16
|
+
if (Object.keys(body).some((key) => key !== "runId")) return Response.json({ error: "Invalid stop request" }, { status: 400 });
|
|
17
|
+
if (!("runId" in body)) return {};
|
|
18
|
+
if (typeof body.runId !== "string" || !body.runId.trim()) return Response.json({ error: "Invalid runId" }, { status: 400 });
|
|
19
|
+
return { runId: body.runId };
|
|
20
|
+
} catch {
|
|
21
|
+
return Response.json({ error: "Invalid stop request" }, { status: 400 });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
10
24
|
/** Stop an active run after applying the runtime's application identity policy. */
|
|
11
25
|
async function handleStopAgent({ runtime, request, agentId, threadId }) {
|
|
12
26
|
try {
|
|
27
|
+
const scope = await parseStopScope(request.clone());
|
|
28
|
+
if (require_json_response.isHandlerResponse(scope)) return scope;
|
|
29
|
+
const { runId } = scope;
|
|
13
30
|
let stopThreadId = threadId;
|
|
14
|
-
let runId;
|
|
15
31
|
if (require_runtime$1.isIntelligenceRuntime(runtime)) {
|
|
16
|
-
const bodyRequest = request.clone();
|
|
17
32
|
const user = await require_resolve_intelligence_user.resolveIntelligenceUser({
|
|
18
33
|
runtime,
|
|
19
34
|
request
|
|
20
35
|
});
|
|
21
36
|
if (require_json_response.isHandlerResponse(user)) return user;
|
|
22
|
-
try {
|
|
23
|
-
const raw = await bodyRequest.text();
|
|
24
|
-
const body = raw.trim() ? JSON.parse(raw) : {};
|
|
25
|
-
if (typeof body !== "object" || body === null || Array.isArray(body)) return Response.json({ error: "Invalid stop request" }, { status: 400 });
|
|
26
|
-
if ("runId" in body) {
|
|
27
|
-
if (typeof body.runId !== "string" || !body.runId.trim()) return Response.json({ error: "Invalid runId" }, { status: 400 });
|
|
28
|
-
runId = body.runId;
|
|
29
|
-
}
|
|
30
|
-
} catch {
|
|
31
|
-
return Response.json({ error: "Invalid stop request" }, { status: 400 });
|
|
32
|
-
}
|
|
33
37
|
try {
|
|
34
38
|
const thread = await runtime.intelligence.getThread({
|
|
35
39
|
threadId,
|
|
@@ -55,7 +59,7 @@ async function handleStopAgent({ runtime, request, agentId, threadId }) {
|
|
|
55
59
|
...runId === void 0 ? {} : { runId }
|
|
56
60
|
})) return new Response(JSON.stringify({
|
|
57
61
|
stopped: false,
|
|
58
|
-
message: `No active run for thread '${threadId}'.`
|
|
62
|
+
message: runId === void 0 ? `No active run for thread '${threadId}'.` : `Run '${runId}' is not the active run for thread '${threadId}'.`
|
|
59
63
|
}), {
|
|
60
64
|
status: 200,
|
|
61
65
|
headers: { "Content-Type": "application/json" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-stop.cjs","names":["
|
|
1
|
+
{"version":3,"file":"handle-stop.cjs","names":["isHandlerResponse","isIntelligenceRuntime","resolveIntelligenceUser","getPlatformErrorStatus","resolveAgents","EventType"],"sources":["../../../../src/v2/runtime/handlers/handle-stop.ts"],"sourcesContent":["import type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { isIntelligenceRuntime, resolveAgents } from \"../core/runtime\";\nimport { EventType } from \"@ag-ui/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\nimport { isHandlerResponse } from \"./shared/json-response\";\nimport { getPlatformErrorStatus } from \"./shared/intelligence-utils\";\n\ninterface StopAgentParameters {\n request: Request;\n runtime: CopilotRuntimeLike;\n agentId: string;\n threadId: string;\n}\n\n/** Read `{ runId? }` from a stop request body; a 400 Response when the body is not a valid scope. */\nasync function parseStopScope(\n request: Request,\n): Promise<{ runId?: string } | Response> {\n try {\n const raw = await request.text();\n const body: unknown = raw.trim() ? JSON.parse(raw) : {};\n if (typeof body !== \"object\" || body === null || Array.isArray(body)) {\n return Response.json({ error: \"Invalid stop request\" }, { status: 400 });\n }\n // Only `runId` is allowed. A misspelt key must not fall through to a\n // thread-wide stop, because a stop cannot be undone.\n if (Object.keys(body).some((key) => key !== \"runId\")) {\n return Response.json({ error: \"Invalid stop request\" }, { status: 400 });\n }\n if (!(\"runId\" in body)) return {};\n if (typeof body.runId !== \"string\" || !body.runId.trim()) {\n return Response.json({ error: \"Invalid runId\" }, { status: 400 });\n }\n return { runId: body.runId };\n } catch {\n return Response.json({ error: \"Invalid stop request\" }, { status: 400 });\n }\n}\n\n/** Stop an active run after applying the runtime's application identity policy. */\nexport async function handleStopAgent({\n runtime,\n request,\n agentId,\n threadId,\n}: StopAgentParameters): Promise<Response> {\n try {\n // Parse the optional run scope for every runtime kind, from a clone so an\n // identity callback can still read the original body. No body or `{}`\n // keeps the thread-wide stop existing clients rely on.\n const scope = await parseStopScope(request.clone());\n if (isHandlerResponse(scope)) return scope;\n const { runId } = scope;\n let stopThreadId = threadId;\n if (isIntelligenceRuntime(runtime)) {\n const user = await resolveIntelligenceUser({ runtime, request });\n if (isHandlerResponse(user)) return user;\n try {\n const thread = await runtime.intelligence.getThread({\n threadId,\n userId: user.id,\n });\n if (!thread || typeof thread.id !== \"string\" || !thread.id.trim()) {\n return Response.json(\n { error: \"Invalid thread response\" },\n { status: 502 },\n );\n }\n if (thread.agentId !== undefined && thread.agentId !== agentId) {\n return Response.json(\n { error: \"Thread access denied\" },\n { status: 403 },\n );\n }\n stopThreadId = thread.id;\n } catch (error) {\n const status = getPlatformErrorStatus(error);\n return Response.json(\n { error: \"Thread access denied\" },\n { status: status && status >= 400 && status < 500 ? status : 502 },\n );\n }\n }\n const agents = await resolveAgents(runtime.agents, request);\n\n if (!agents[agentId]) {\n return new Response(\n JSON.stringify({\n error: \"Agent not found\",\n message: `Agent '${agentId}' does not exist`,\n }),\n {\n status: 404,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n const stopped = await runtime.runner.stop({\n threadId: stopThreadId,\n ...(runId === undefined ? {} : { runId }),\n });\n\n if (!stopped) {\n return new Response(\n JSON.stringify({\n stopped: false,\n message:\n runId === undefined\n ? `No active run for thread '${threadId}'.`\n : `Run '${runId}' is not the active run for thread '${threadId}'.`,\n }),\n {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n return new Response(\n JSON.stringify({\n stopped: true,\n interrupt: {\n type: EventType.RUN_ERROR,\n message: \"Run stopped by user\",\n code: \"STOPPED\",\n },\n }),\n {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n } catch (error) {\n console.error(\"Error stopping agent run:\", error);\n\n return new Response(\n JSON.stringify({\n error: \"Failed to stop agent\",\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"],"mappings":";;;;;;;;;;AAeA,eAAe,eACb,SACwC;AACxC,KAAI;EACF,MAAM,MAAM,MAAM,QAAQ,MAAM;EAChC,MAAM,OAAgB,IAAI,MAAM,GAAG,KAAK,MAAM,IAAI,GAAG,EAAE;AACvD,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,MAAM,QAAQ,KAAK,CAClE,QAAO,SAAS,KAAK,EAAE,OAAO,wBAAwB,EAAE,EAAE,QAAQ,KAAK,CAAC;AAI1E,MAAI,OAAO,KAAK,KAAK,CAAC,MAAM,QAAQ,QAAQ,QAAQ,CAClD,QAAO,SAAS,KAAK,EAAE,OAAO,wBAAwB,EAAE,EAAE,QAAQ,KAAK,CAAC;AAE1E,MAAI,EAAE,WAAW,MAAO,QAAO,EAAE;AACjC,MAAI,OAAO,KAAK,UAAU,YAAY,CAAC,KAAK,MAAM,MAAM,CACtD,QAAO,SAAS,KAAK,EAAE,OAAO,iBAAiB,EAAE,EAAE,QAAQ,KAAK,CAAC;AAEnE,SAAO,EAAE,OAAO,KAAK,OAAO;SACtB;AACN,SAAO,SAAS,KAAK,EAAE,OAAO,wBAAwB,EAAE,EAAE,QAAQ,KAAK,CAAC;;;;AAK5E,eAAsB,gBAAgB,EACpC,SACA,SACA,SACA,YACyC;AACzC,KAAI;EAIF,MAAM,QAAQ,MAAM,eAAe,QAAQ,OAAO,CAAC;AACnD,MAAIA,wCAAkB,MAAM,CAAE,QAAO;EACrC,MAAM,EAAE,UAAU;EAClB,IAAI,eAAe;AACnB,MAAIC,wCAAsB,QAAQ,EAAE;GAClC,MAAM,OAAO,MAAMC,0DAAwB;IAAE;IAAS;IAAS,CAAC;AAChE,OAAIF,wCAAkB,KAAK,CAAE,QAAO;AACpC,OAAI;IACF,MAAM,SAAS,MAAM,QAAQ,aAAa,UAAU;KAClD;KACA,QAAQ,KAAK;KACd,CAAC;AACF,QAAI,CAAC,UAAU,OAAO,OAAO,OAAO,YAAY,CAAC,OAAO,GAAG,MAAM,CAC/D,QAAO,SAAS,KACd,EAAE,OAAO,2BAA2B,EACpC,EAAE,QAAQ,KAAK,CAChB;AAEH,QAAI,OAAO,YAAY,UAAa,OAAO,YAAY,QACrD,QAAO,SAAS,KACd,EAAE,OAAO,wBAAwB,EACjC,EAAE,QAAQ,KAAK,CAChB;AAEH,mBAAe,OAAO;YACf,OAAO;IACd,MAAM,SAASG,kDAAuB,MAAM;AAC5C,WAAO,SAAS,KACd,EAAE,OAAO,wBAAwB,EACjC,EAAE,QAAQ,UAAU,UAAU,OAAO,SAAS,MAAM,SAAS,KAAK,CACnE;;;AAKL,MAAI,EAFW,MAAMC,gCAAc,QAAQ,QAAQ,QAAQ,EAE/C,SACV,QAAO,IAAI,SACT,KAAK,UAAU;GACb,OAAO;GACP,SAAS,UAAU,QAAQ;GAC5B,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF;AAQH,MAAI,CALY,MAAM,QAAQ,OAAO,KAAK;GACxC,UAAU;GACV,GAAI,UAAU,SAAY,EAAE,GAAG,EAAE,OAAO;GACzC,CAAC,CAGA,QAAO,IAAI,SACT,KAAK,UAAU;GACb,SAAS;GACT,SACE,UAAU,SACN,6BAA6B,SAAS,MACtC,QAAQ,MAAM,sCAAsC,SAAS;GACpE,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF;AAGH,SAAO,IAAI,SACT,KAAK,UAAU;GACb,SAAS;GACT,WAAW;IACT,MAAMC,wBAAU;IAChB,SAAS;IACT,MAAM;IACP;GACF,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF;UACM,OAAO;AACd,UAAQ,MAAM,6BAA6B,MAAM;AAEjD,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"}
|