@copilotkit/runtime 2.0.0-rc.0 → 2.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +0 -2
  2. package/dist/index.cjs +1 -12
  3. package/dist/index.d.cts +4 -8
  4. package/dist/index.d.mts +4 -8
  5. package/dist/index.mjs +2 -6
  6. package/dist/runtime/core/fetch-handler.cjs.map +1 -1
  7. package/dist/runtime/core/fetch-handler.d.cts +1 -2
  8. package/dist/runtime/core/fetch-handler.d.cts.map +1 -1
  9. package/dist/runtime/core/fetch-handler.d.mts +1 -2
  10. package/dist/runtime/core/fetch-handler.d.mts.map +1 -1
  11. package/dist/runtime/core/fetch-handler.mjs.map +1 -1
  12. package/dist/runtime/core/package-info.cjs +1 -1
  13. package/dist/runtime/core/package-info.mjs +1 -1
  14. package/dist/runtime/index.d.cts +3 -8
  15. package/dist/runtime/index.d.cts.map +1 -1
  16. package/dist/runtime/index.d.mts +3 -8
  17. package/dist/runtime/index.d.mts.map +1 -1
  18. package/package.json +6 -22
  19. package/dist/express.cjs +0 -7
  20. package/dist/express.d.cts +0 -4
  21. package/dist/express.d.mts +0 -4
  22. package/dist/express.mjs +0 -4
  23. package/dist/hono.cjs +0 -8
  24. package/dist/hono.d.cts +0 -4
  25. package/dist/hono.d.mts +0 -4
  26. package/dist/hono.mjs +0 -4
  27. package/dist/runtime/endpoints/express-single.cjs +0 -43
  28. package/dist/runtime/endpoints/express-single.cjs.map +0 -1
  29. package/dist/runtime/endpoints/express-single.d.cts +0 -48
  30. package/dist/runtime/endpoints/express-single.d.cts.map +0 -1
  31. package/dist/runtime/endpoints/express-single.d.mts +0 -48
  32. package/dist/runtime/endpoints/express-single.d.mts.map +0 -1
  33. package/dist/runtime/endpoints/express-single.mjs +0 -43
  34. package/dist/runtime/endpoints/express-single.mjs.map +0 -1
  35. package/dist/runtime/endpoints/express.cjs +0 -68
  36. package/dist/runtime/endpoints/express.cjs.map +0 -1
  37. package/dist/runtime/endpoints/express.d.cts +0 -84
  38. package/dist/runtime/endpoints/express.d.cts.map +0 -1
  39. package/dist/runtime/endpoints/express.d.mts +0 -84
  40. package/dist/runtime/endpoints/express.d.mts.map +0 -1
  41. package/dist/runtime/endpoints/express.mjs +0 -66
  42. package/dist/runtime/endpoints/express.mjs.map +0 -1
  43. package/dist/runtime/endpoints/hono-single.cjs +0 -28
  44. package/dist/runtime/endpoints/hono-single.cjs.map +0 -1
  45. package/dist/runtime/endpoints/hono-single.d.cts +0 -43
  46. package/dist/runtime/endpoints/hono-single.d.cts.map +0 -1
  47. package/dist/runtime/endpoints/hono-single.d.mts +0 -43
  48. package/dist/runtime/endpoints/hono-single.d.mts.map +0 -1
  49. package/dist/runtime/endpoints/hono-single.mjs +0 -27
  50. package/dist/runtime/endpoints/hono-single.mjs.map +0 -1
  51. package/dist/runtime/endpoints/hono.cjs +0 -37
  52. package/dist/runtime/endpoints/hono.cjs.map +0 -1
  53. package/dist/runtime/endpoints/hono.d.cts +0 -96
  54. package/dist/runtime/endpoints/hono.d.cts.map +0 -1
  55. package/dist/runtime/endpoints/hono.d.mts +0 -96
  56. package/dist/runtime/endpoints/hono.d.mts.map +0 -1
  57. package/dist/runtime/endpoints/hono.mjs +0 -34
  58. package/dist/runtime/endpoints/hono.mjs.map +0 -1
  59. package/dist/runtime/endpoints/index.d.cts +0 -4
  60. package/dist/runtime/endpoints/index.d.mts +0 -4
  61. package/dist/runtime/endpoints/load-express.cjs +0 -35
  62. package/dist/runtime/endpoints/load-express.cjs.map +0 -1
  63. package/dist/runtime/endpoints/load-express.mjs +0 -34
  64. package/dist/runtime/endpoints/load-express.mjs.map +0 -1
  65. package/dist/runtime/express.d.cts +0 -2
  66. package/dist/runtime/express.d.mts +0 -2
  67. package/dist/runtime/hono.d.cts +0 -2
  68. package/dist/runtime/hono.d.mts +0 -2
@@ -1,96 +0,0 @@
1
- import { CopilotRuntimeLike } from "../core/runtime.cjs";
2
- import { ActivateChannelEngine, ChannelsControl } from "../core/channel-manager.cjs";
3
- import { CopilotRuntimeHooks } from "../core/hooks.cjs";
4
- import { CopilotCorsConfig } from "../core/fetch-cors.cjs";
5
- import { Hono } from "hono";
6
-
7
- //#region src/runtime/endpoints/hono.d.ts
8
- /**
9
- * A Hono app that may also carry an optional {@link ChannelsControl} surface.
10
- *
11
- * Unlike the Node and Express wrappers — which own a process and therefore START
12
- * managed-Channel activation at creation (OSS-641) — this wrapper stays LAZY:
13
- * activation is triggered by the first `app.channels.ready()` and never before.
14
- * A Hono app is multi-runtime and is our edge/serverless surface in practice:
15
- * every Next.js App Router route handler in `examples/showcases/*` builds one at
16
- * module scope, and those isolates freeze and recycle per request. Auto-starting
17
- * there would mint a competing listener for the same Channel on every cold
18
- * start, which is exactly what the lazy design exists to prevent (see the
19
- * `createCopilotRuntimeHandler` TSDoc).
20
- *
21
- * So on a LONG-RUNNING Hono host (`@hono/node-server`, Bun, Deno) calling
22
- * `await app.channels.ready()` once at startup is REQUIRED to connect declared
23
- * Channels; on an edge/serverless host do NOT call it.
24
- */
25
- type CopilotHonoApp = Hono & {
26
- channels?: ChannelsControl;
27
- };
28
- /**
29
- * CORS configuration for CopilotKit endpoints.
30
- * When using credentials (e.g., HTTP-only cookies), you must specify an explicit origin.
31
- */
32
- interface CopilotEndpointCorsConfig {
33
- /**
34
- * Allowed origin(s) for CORS. Can be:
35
- * - A string: exact origin (e.g., "https://myapp.com")
36
- * - An array: list of allowed origins
37
- * - A function: dynamic origin resolution
38
- *
39
- * Note: When credentials is true, origin cannot be "*"
40
- */
41
- origin: string | string[] | ((origin: string, c: any) => string | undefined | null);
42
- /**
43
- * Whether to allow credentials (cookies, HTTP authentication).
44
- * When true, origin must be explicitly specified (not "*").
45
- */
46
- credentials?: boolean;
47
- }
48
- interface CopilotEndpointParams {
49
- runtime: CopilotRuntimeLike;
50
- basePath: string;
51
- /**
52
- * Endpoint mode.
53
- * - `"multi-route"` (default): separate routes for each operation
54
- * - `"single-route"`: single POST endpoint with JSON envelope dispatch
55
- */
56
- mode?: "multi-route" | "single-route";
57
- /**
58
- * Optional CORS configuration. When not provided, defaults to allowing all origins without credentials.
59
- * To support HTTP-only cookies, provide cors config with credentials: true and explicit origin.
60
- */
61
- cors?: CopilotEndpointCorsConfig;
62
- /**
63
- * Lifecycle hooks for request processing.
64
- */
65
- hooks?: CopilotRuntimeHooks;
66
- /**
67
- * Whether the underlying handler builds the control surface for the runtime's
68
- * declared managed Channels. Defaults to `true`. Building it opens no
69
- * connection — activation is deferred to the first `channels.ready()`. See
70
- * `CopilotRuntimeHandlerOptions.activateChannels`.
71
- */
72
- activateChannels?: boolean;
73
- /**
74
- * @internal Test seam: inject a fake Channel activation engine. Forwarded
75
- * to `createCopilotRuntimeHandler`. Not part of the public API.
76
- */
77
- __channelEngine?: ActivateChannelEngine;
78
- }
79
- /** @deprecated Use `createCopilotHonoHandler` instead. */
80
- declare const createCopilotEndpoint: typeof createCopilotHonoHandler;
81
- declare function createCopilotHonoHandler({
82
- runtime,
83
- basePath,
84
- mode,
85
- cors: corsConfig,
86
- hooks,
87
- activateChannels,
88
- __channelEngine
89
- }: CopilotEndpointParams): CopilotHonoApp;
90
- /**
91
- * Convert Hono-specific CORS config to the fetch handler's CopilotCorsConfig.
92
- */
93
- declare function toFetchCorsConfig(config: CopilotEndpointCorsConfig): CopilotCorsConfig;
94
- //#endregion
95
- export { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig };
96
- //# sourceMappingURL=hono.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hono.d.cts","names":[],"sources":["../../../src/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"}
@@ -1,96 +0,0 @@
1
- import { CopilotRuntimeLike } from "../core/runtime.mjs";
2
- import { ActivateChannelEngine, ChannelsControl } from "../core/channel-manager.mjs";
3
- import { CopilotRuntimeHooks } from "../core/hooks.mjs";
4
- import { CopilotCorsConfig } from "../core/fetch-cors.mjs";
5
- import { Hono } from "hono";
6
-
7
- //#region src/runtime/endpoints/hono.d.ts
8
- /**
9
- * A Hono app that may also carry an optional {@link ChannelsControl} surface.
10
- *
11
- * Unlike the Node and Express wrappers — which own a process and therefore START
12
- * managed-Channel activation at creation (OSS-641) — this wrapper stays LAZY:
13
- * activation is triggered by the first `app.channels.ready()` and never before.
14
- * A Hono app is multi-runtime and is our edge/serverless surface in practice:
15
- * every Next.js App Router route handler in `examples/showcases/*` builds one at
16
- * module scope, and those isolates freeze and recycle per request. Auto-starting
17
- * there would mint a competing listener for the same Channel on every cold
18
- * start, which is exactly what the lazy design exists to prevent (see the
19
- * `createCopilotRuntimeHandler` TSDoc).
20
- *
21
- * So on a LONG-RUNNING Hono host (`@hono/node-server`, Bun, Deno) calling
22
- * `await app.channels.ready()` once at startup is REQUIRED to connect declared
23
- * Channels; on an edge/serverless host do NOT call it.
24
- */
25
- type CopilotHonoApp = Hono & {
26
- channels?: ChannelsControl;
27
- };
28
- /**
29
- * CORS configuration for CopilotKit endpoints.
30
- * When using credentials (e.g., HTTP-only cookies), you must specify an explicit origin.
31
- */
32
- interface CopilotEndpointCorsConfig {
33
- /**
34
- * Allowed origin(s) for CORS. Can be:
35
- * - A string: exact origin (e.g., "https://myapp.com")
36
- * - An array: list of allowed origins
37
- * - A function: dynamic origin resolution
38
- *
39
- * Note: When credentials is true, origin cannot be "*"
40
- */
41
- origin: string | string[] | ((origin: string, c: any) => string | undefined | null);
42
- /**
43
- * Whether to allow credentials (cookies, HTTP authentication).
44
- * When true, origin must be explicitly specified (not "*").
45
- */
46
- credentials?: boolean;
47
- }
48
- interface CopilotEndpointParams {
49
- runtime: CopilotRuntimeLike;
50
- basePath: string;
51
- /**
52
- * Endpoint mode.
53
- * - `"multi-route"` (default): separate routes for each operation
54
- * - `"single-route"`: single POST endpoint with JSON envelope dispatch
55
- */
56
- mode?: "multi-route" | "single-route";
57
- /**
58
- * Optional CORS configuration. When not provided, defaults to allowing all origins without credentials.
59
- * To support HTTP-only cookies, provide cors config with credentials: true and explicit origin.
60
- */
61
- cors?: CopilotEndpointCorsConfig;
62
- /**
63
- * Lifecycle hooks for request processing.
64
- */
65
- hooks?: CopilotRuntimeHooks;
66
- /**
67
- * Whether the underlying handler builds the control surface for the runtime's
68
- * declared managed Channels. Defaults to `true`. Building it opens no
69
- * connection — activation is deferred to the first `channels.ready()`. See
70
- * `CopilotRuntimeHandlerOptions.activateChannels`.
71
- */
72
- activateChannels?: boolean;
73
- /**
74
- * @internal Test seam: inject a fake Channel activation engine. Forwarded
75
- * to `createCopilotRuntimeHandler`. Not part of the public API.
76
- */
77
- __channelEngine?: ActivateChannelEngine;
78
- }
79
- /** @deprecated Use `createCopilotHonoHandler` instead. */
80
- declare const createCopilotEndpoint: typeof createCopilotHonoHandler;
81
- declare function createCopilotHonoHandler({
82
- runtime,
83
- basePath,
84
- mode,
85
- cors: corsConfig,
86
- hooks,
87
- activateChannels,
88
- __channelEngine
89
- }: CopilotEndpointParams): CopilotHonoApp;
90
- /**
91
- * Convert Hono-specific CORS config to the fetch handler's CopilotCorsConfig.
92
- */
93
- declare function toFetchCorsConfig(config: CopilotEndpointCorsConfig): CopilotCorsConfig;
94
- //#endregion
95
- export { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig };
96
- //# sourceMappingURL=hono.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hono.d.mts","names":[],"sources":["../../../src/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"}
@@ -1,34 +0,0 @@
1
- import { createCopilotRuntimeHandler } from "../core/fetch-handler.mjs";
2
- import { Hono } from "hono";
3
-
4
- //#region src/runtime/endpoints/hono.ts
5
- /** @deprecated Use `createCopilotHonoHandler` instead. */
6
- const createCopilotEndpoint = createCopilotHonoHandler;
7
- function createCopilotHonoHandler({ runtime, basePath, mode = "multi-route", cors: corsConfig, hooks, activateChannels, __channelEngine }) {
8
- const handler = createCopilotRuntimeHandler({
9
- runtime,
10
- basePath,
11
- mode,
12
- cors: corsConfig ? toFetchCorsConfig(corsConfig) : true,
13
- hooks,
14
- activateChannels,
15
- __channelEngine
16
- });
17
- const scopedApp = new Hono().basePath(basePath).all("*", async (c) => handler(c.req.raw));
18
- scopedApp.channels = handler.channels;
19
- return scopedApp;
20
- }
21
- /**
22
- * Convert Hono-specific CORS config to the fetch handler's CopilotCorsConfig.
23
- */
24
- function toFetchCorsConfig(config) {
25
- const origin = config.origin;
26
- return {
27
- origin: typeof origin === "function" ? (reqOrigin) => origin(reqOrigin, void 0) ?? null : origin,
28
- credentials: config.credentials
29
- };
30
- }
31
-
32
- //#endregion
33
- export { createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig };
34
- //# sourceMappingURL=hono.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hono.mjs","names":[],"sources":["../../../src/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,4 +0,0 @@
1
- import { CopilotExpressEndpointParams, CopilotExpressRouter, createCopilotExpressHandler } from "./express.cjs";
2
- import { createCopilotEndpointSingleRouteExpress } from "./express-single.cjs";
3
- import { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig } from "./hono.cjs";
4
- import { createCopilotEndpointSingleRoute } from "./hono-single.cjs";
@@ -1,4 +0,0 @@
1
- import { CopilotExpressEndpointParams, CopilotExpressRouter, createCopilotExpressHandler } from "./express.mjs";
2
- import { createCopilotEndpointSingleRouteExpress } from "./express-single.mjs";
3
- import { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig } from "./hono.mjs";
4
- import { createCopilotEndpointSingleRoute } from "./hono-single.mjs";
@@ -1,35 +0,0 @@
1
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
- let node_module = require("node:module");
3
-
4
- //#region src/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` 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 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)) {
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/hono` instead.", { cause });
29
- }
30
- return requireFrom("express");
31
- }
32
-
33
- //#endregion
34
- exports.loadExpress = loadExpress;
35
- //# sourceMappingURL=load-express.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-express.cjs","names":[],"sources":["../../../src/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` 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/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,yPAIA,EAAE,OAAO,CACV;;AAGH,QAAO,YAAY,UAAU"}
@@ -1,34 +0,0 @@
1
- import { createRequire } from "node:module";
2
-
3
- //#region src/runtime/endpoints/load-express.ts
4
- /**
5
- * Load `express` at call time rather than at module load time.
6
- *
7
- * `express` is an OPTIONAL peer: an app that mounts the Hono or Node adapter
8
- * never installs it. The Express adapter is re-exported from the
9
- * `@copilotkit/runtime` barrel, so a static `import express from "express"`
10
- * there would make that barrel unimportable for every consumer who does not use
11
- * Express. Loading it inside the factory keeps the barrel free of Express and
12
- * moves the failure to the only place it is a real failure: calling an Express
13
- * factory without Express installed.
14
- *
15
- * This lives in its own module, and not beside the factory, for two reasons: it
16
- * is not part of the published surface (the endpoints barrel does not re-export
17
- * it), and a test can reach it directly and inject `requireFrom`.
18
- *
19
- * `scripts/validate-optional-peer-entries.ts` is what keeps the loading lazy: it
20
- * fails if any entry point reaches an optional peer at module-initialization
21
- * time, in either published format.
22
- */
23
- function loadExpress(requireFrom = createRequire(import.meta.url)) {
24
- try {
25
- requireFrom.resolve("express");
26
- } catch (cause) {
27
- 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/hono` instead.", { cause });
28
- }
29
- return requireFrom("express");
30
- }
31
-
32
- //#endregion
33
- export { loadExpress };
34
- //# sourceMappingURL=load-express.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-express.mjs","names":[],"sources":["../../../src/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` 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/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,yPAIA,EAAE,OAAO,CACV;;AAGH,QAAO,YAAY,UAAU"}
@@ -1,2 +0,0 @@
1
- import { CopilotExpressEndpointParams, CopilotExpressRouter, createCopilotExpressHandler } from "./endpoints/express.cjs";
2
- import { createCopilotEndpointSingleRouteExpress } from "./endpoints/express-single.cjs";
@@ -1,2 +0,0 @@
1
- import { CopilotExpressEndpointParams, CopilotExpressRouter, createCopilotExpressHandler } from "./endpoints/express.mjs";
2
- import { createCopilotEndpointSingleRouteExpress } from "./endpoints/express-single.mjs";
@@ -1,2 +0,0 @@
1
- import { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig } from "./endpoints/hono.cjs";
2
- import { createCopilotEndpointSingleRoute } from "./endpoints/hono-single.cjs";
@@ -1,2 +0,0 @@
1
- import { CopilotEndpointCorsConfig, CopilotHonoApp, createCopilotEndpoint, createCopilotHonoHandler, toFetchCorsConfig } from "./endpoints/hono.mjs";
2
- import { createCopilotEndpointSingleRoute } from "./endpoints/hono-single.mjs";