@copilotkit/runtime 2.0.0-rc.49 → 2.0.0-rc.50

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 (170) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +8 -3
  3. package/dist/index.d.cts +9 -9
  4. package/dist/index.d.mts +9 -9
  5. package/dist/index.mjs +4 -3
  6. package/dist/node.cjs +2 -0
  7. package/dist/node.d.cts +3 -3
  8. package/dist/node.d.mts +3 -3
  9. package/dist/node.mjs +3 -3
  10. package/dist/runtime/core/channel-manager.cjs.map +1 -1
  11. package/dist/runtime/core/channel-manager.mjs.map +1 -1
  12. package/dist/runtime/core/debug-event-bus.cjs.map +1 -1
  13. package/dist/runtime/core/debug-event-bus.d.cts +2 -2
  14. package/dist/runtime/core/debug-event-bus.d.cts.map +1 -1
  15. package/dist/runtime/core/debug-event-bus.d.mts +2 -2
  16. package/dist/runtime/core/debug-event-bus.d.mts.map +1 -1
  17. package/dist/runtime/core/debug-event-bus.mjs.map +1 -1
  18. package/dist/runtime/core/fetch-cors.cjs.map +1 -1
  19. package/dist/runtime/core/fetch-cors.d.cts +2 -2
  20. package/dist/runtime/core/fetch-cors.d.cts.map +1 -1
  21. package/dist/runtime/core/fetch-cors.d.mts +2 -2
  22. package/dist/runtime/core/fetch-cors.d.mts.map +1 -1
  23. package/dist/runtime/core/fetch-cors.mjs.map +1 -1
  24. package/dist/runtime/core/fetch-handler.cjs +9 -1
  25. package/dist/runtime/core/fetch-handler.cjs.map +1 -1
  26. package/dist/runtime/core/fetch-handler.d.cts +27 -14
  27. package/dist/runtime/core/fetch-handler.d.cts.map +1 -1
  28. package/dist/runtime/core/fetch-handler.d.mts +27 -14
  29. package/dist/runtime/core/fetch-handler.d.mts.map +1 -1
  30. package/dist/runtime/core/fetch-handler.mjs +9 -2
  31. package/dist/runtime/core/fetch-handler.mjs.map +1 -1
  32. package/dist/runtime/core/hooks.cjs.map +1 -1
  33. package/dist/runtime/core/hooks.d.cts +5 -5
  34. package/dist/runtime/core/hooks.d.cts.map +1 -1
  35. package/dist/runtime/core/hooks.d.mts +5 -5
  36. package/dist/runtime/core/hooks.d.mts.map +1 -1
  37. package/dist/runtime/core/hooks.mjs.map +1 -1
  38. package/dist/runtime/core/learning.cjs.map +1 -1
  39. package/dist/runtime/core/learning.d.cts +8 -8
  40. package/dist/runtime/core/learning.d.cts.map +1 -1
  41. package/dist/runtime/core/learning.d.mts +8 -8
  42. package/dist/runtime/core/learning.d.mts.map +1 -1
  43. package/dist/runtime/core/learning.mjs.map +1 -1
  44. package/dist/runtime/core/logger.cjs.map +1 -1
  45. package/dist/runtime/core/logger.d.cts +3 -3
  46. package/dist/runtime/core/logger.d.cts.map +1 -1
  47. package/dist/runtime/core/logger.d.mts +3 -3
  48. package/dist/runtime/core/logger.d.mts.map +1 -1
  49. package/dist/runtime/core/logger.mjs.map +1 -1
  50. package/dist/runtime/core/middleware-sse-parser.cjs.map +1 -1
  51. package/dist/runtime/core/middleware-sse-parser.mjs.map +1 -1
  52. package/dist/runtime/core/middleware.cjs.map +1 -1
  53. package/dist/runtime/core/middleware.d.cts +3 -3
  54. package/dist/runtime/core/middleware.d.cts.map +1 -1
  55. package/dist/runtime/core/middleware.d.mts +3 -3
  56. package/dist/runtime/core/middleware.d.mts.map +1 -1
  57. package/dist/runtime/core/middleware.mjs.map +1 -1
  58. package/dist/runtime/core/package-info.cjs +1 -1
  59. package/dist/runtime/core/package-info.mjs +1 -1
  60. package/dist/runtime/core/runtime-error-reporter.cjs.map +1 -1
  61. package/dist/runtime/core/runtime-error-reporter.mjs.map +1 -1
  62. package/dist/runtime/core/runtime.cjs +17 -17
  63. package/dist/runtime/core/runtime.cjs.map +1 -1
  64. package/dist/runtime/core/runtime.d.cts +65 -65
  65. package/dist/runtime/core/runtime.d.cts.map +1 -1
  66. package/dist/runtime/core/runtime.d.mts +65 -65
  67. package/dist/runtime/core/runtime.d.mts.map +1 -1
  68. package/dist/runtime/core/runtime.mjs +15 -15
  69. package/dist/runtime/core/runtime.mjs.map +1 -1
  70. package/dist/runtime/endpoints/auto-start-channels.cjs.map +1 -1
  71. package/dist/runtime/endpoints/auto-start-channels.mjs.map +1 -1
  72. package/dist/runtime/endpoints/node-fetch-handler.cjs +9 -1
  73. package/dist/runtime/endpoints/node-fetch-handler.cjs.map +1 -1
  74. package/dist/runtime/endpoints/node-fetch-handler.d.cts +9 -4
  75. package/dist/runtime/endpoints/node-fetch-handler.d.cts.map +1 -1
  76. package/dist/runtime/endpoints/node-fetch-handler.d.mts +9 -4
  77. package/dist/runtime/endpoints/node-fetch-handler.d.mts.map +1 -1
  78. package/dist/runtime/endpoints/node-fetch-handler.mjs +9 -2
  79. package/dist/runtime/endpoints/node-fetch-handler.mjs.map +1 -1
  80. package/dist/runtime/endpoints/node.cjs +11 -3
  81. package/dist/runtime/endpoints/node.cjs.map +1 -1
  82. package/dist/runtime/endpoints/node.d.cts +39 -16
  83. package/dist/runtime/endpoints/node.d.cts.map +1 -1
  84. package/dist/runtime/endpoints/node.d.mts +39 -16
  85. package/dist/runtime/endpoints/node.d.mts.map +1 -1
  86. package/dist/runtime/endpoints/node.mjs +13 -6
  87. package/dist/runtime/endpoints/node.mjs.map +1 -1
  88. package/dist/runtime/generative-ui/a2ui-v09-middleware.cjs.map +1 -1
  89. package/dist/runtime/generative-ui/a2ui-v09-middleware.mjs.map +1 -1
  90. package/dist/runtime/handlers/get-runtime-info.cjs.map +1 -1
  91. package/dist/runtime/handlers/get-runtime-info.mjs.map +1 -1
  92. package/dist/runtime/handlers/handle-debug-events.cjs.map +1 -1
  93. package/dist/runtime/handlers/handle-debug-events.mjs.map +1 -1
  94. package/dist/runtime/handlers/handle-inspector-learning.cjs.map +1 -1
  95. package/dist/runtime/handlers/handle-inspector-learning.mjs.map +1 -1
  96. package/dist/runtime/handlers/handle-inspector-metadata.cjs.map +1 -1
  97. package/dist/runtime/handlers/handle-inspector-metadata.mjs.map +1 -1
  98. package/dist/runtime/handlers/handle-stop.cjs.map +1 -1
  99. package/dist/runtime/handlers/handle-stop.mjs.map +1 -1
  100. package/dist/runtime/handlers/handle-suggest.cjs.map +1 -1
  101. package/dist/runtime/handlers/handle-suggest.mjs.map +1 -1
  102. package/dist/runtime/handlers/handle-trajectory-connect.cjs.map +1 -1
  103. package/dist/runtime/handlers/handle-trajectory-connect.mjs.map +1 -1
  104. package/dist/runtime/handlers/handle-transcribe.cjs.map +1 -1
  105. package/dist/runtime/handlers/handle-transcribe.mjs.map +1 -1
  106. package/dist/runtime/handlers/intelligence/annotate.cjs +1 -1
  107. package/dist/runtime/handlers/intelligence/annotate.cjs.map +1 -1
  108. package/dist/runtime/handlers/intelligence/annotate.mjs +1 -1
  109. package/dist/runtime/handlers/intelligence/annotate.mjs.map +1 -1
  110. package/dist/runtime/handlers/intelligence/connect.cjs.map +1 -1
  111. package/dist/runtime/handlers/intelligence/connect.mjs.map +1 -1
  112. package/dist/runtime/handlers/intelligence/memories.cjs +1 -1
  113. package/dist/runtime/handlers/intelligence/memories.cjs.map +1 -1
  114. package/dist/runtime/handlers/intelligence/memories.mjs +1 -1
  115. package/dist/runtime/handlers/intelligence/memories.mjs.map +1 -1
  116. package/dist/runtime/handlers/intelligence/run.cjs.map +1 -1
  117. package/dist/runtime/handlers/intelligence/run.mjs.map +1 -1
  118. package/dist/runtime/handlers/intelligence/thread-names.cjs.map +1 -1
  119. package/dist/runtime/handlers/intelligence/thread-names.mjs.map +1 -1
  120. package/dist/runtime/handlers/intelligence/threads.cjs +5 -5
  121. package/dist/runtime/handlers/intelligence/threads.cjs.map +1 -1
  122. package/dist/runtime/handlers/intelligence/threads.mjs +5 -5
  123. package/dist/runtime/handlers/intelligence/threads.mjs.map +1 -1
  124. package/dist/runtime/handlers/shared/agent-utils.cjs.map +1 -1
  125. package/dist/runtime/handlers/shared/agent-utils.mjs.map +1 -1
  126. package/dist/runtime/handlers/shared/memory-policy.cjs.map +1 -1
  127. package/dist/runtime/handlers/shared/memory-policy.mjs.map +1 -1
  128. package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs.map +1 -1
  129. package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs.map +1 -1
  130. package/dist/runtime/handlers/shared/sse-response.cjs.map +1 -1
  131. package/dist/runtime/handlers/shared/sse-response.mjs.map +1 -1
  132. package/dist/runtime/handlers/shared/thread-access.cjs +1 -1
  133. package/dist/runtime/handlers/shared/thread-access.cjs.map +1 -1
  134. package/dist/runtime/handlers/shared/thread-access.mjs +1 -1
  135. package/dist/runtime/handlers/shared/thread-access.mjs.map +1 -1
  136. package/dist/runtime/handlers/sse/connect.cjs.map +1 -1
  137. package/dist/runtime/handlers/sse/connect.mjs.map +1 -1
  138. package/dist/runtime/handlers/sse/run.cjs.map +1 -1
  139. package/dist/runtime/handlers/sse/run.mjs.map +1 -1
  140. package/dist/runtime/index.cjs +29 -0
  141. package/dist/runtime/index.cjs.map +1 -0
  142. package/dist/runtime/index.d.cts +58 -7
  143. package/dist/runtime/index.d.cts.map +1 -0
  144. package/dist/runtime/index.d.mts +58 -7
  145. package/dist/runtime/index.d.mts.map +1 -0
  146. package/dist/runtime/index.mjs +27 -0
  147. package/dist/runtime/index.mjs.map +1 -0
  148. package/dist/runtime/intelligence-platform/analytics-context.cjs.map +1 -1
  149. package/dist/runtime/intelligence-platform/analytics-context.mjs.map +1 -1
  150. package/dist/runtime/intelligence-platform/client.cjs +3 -3
  151. package/dist/runtime/intelligence-platform/client.cjs.map +1 -1
  152. package/dist/runtime/intelligence-platform/client.d.cts +1 -1
  153. package/dist/runtime/intelligence-platform/client.d.mts +1 -1
  154. package/dist/runtime/intelligence-platform/client.mjs +3 -3
  155. package/dist/runtime/intelligence-platform/client.mjs.map +1 -1
  156. package/dist/runtime/intelligence-platform/thread-lock-heartbeat.cjs.map +1 -1
  157. package/dist/runtime/intelligence-platform/thread-lock-heartbeat.mjs.map +1 -1
  158. package/dist/runtime/node.d.cts +2 -2
  159. package/dist/runtime/node.d.mts +2 -2
  160. package/dist/runtime/runner/intelligence.cjs.map +1 -1
  161. package/dist/runtime/runner/intelligence.d.cts +2 -2
  162. package/dist/runtime/runner/intelligence.d.cts.map +1 -1
  163. package/dist/runtime/runner/intelligence.d.mts +2 -2
  164. package/dist/runtime/runner/intelligence.d.mts.map +1 -1
  165. package/dist/runtime/runner/intelligence.mjs.map +1 -1
  166. package/dist/runtime/telemetry/disclosure.cjs.map +1 -1
  167. package/dist/runtime/telemetry/disclosure.mjs.map +1 -1
  168. package/dist/runtime/telemetry/instance-created.cjs.map +1 -1
  169. package/dist/runtime/telemetry/instance-created.mjs.map +1 -1
  170. package/package.json +4 -4
@@ -1,29 +1,29 @@
1
1
  import { RuntimeWithDeclaredChannels } from "../core/runtime.cjs";
2
2
  import { ChannelsControl } from "../core/channel-manager.cjs";
3
- import { CopilotRuntimeHandlerOptions } from "../core/fetch-handler.cjs";
3
+ import { CopilotKitRuntimeHandlerOptions } from "../core/fetch-handler.cjs";
4
4
  import { NodeFetchHandler } from "./node-fetch-handler.cjs";
5
5
 
6
6
  //#region src/runtime/endpoints/node.d.ts
7
7
  /**
8
8
  * A Node.js HTTP request listener that is also a callable object carrying an
9
9
  * optional {@link ChannelsControl} surface, mirroring
10
- * `CopilotRuntimeFetchHandler.channels`. Node is the long-running,
10
+ * `CopilotKitRuntimeFetchHandler.channels`. Node is the long-running,
11
11
  * lifecycle-owning entry point for the runtime, so it is the surface that
12
12
  * exposes `.channels` for callers that need to observe or stop the managed
13
13
  * Channel activation the listener starts at creation.
14
14
  */
15
- type NodeCopilotListener = NodeFetchHandler & {
15
+ type NodeCopilotKitListener = NodeFetchHandler & {
16
16
  channels?: ChannelsControl;
17
17
  };
18
18
  /**
19
- * A {@link NodeCopilotListener} whose {@link ChannelsControl} surface is
19
+ * A {@link NodeCopilotKitListener} whose {@link ChannelsControl} surface is
20
20
  * guaranteed present. Returned when the runtime was constructed with at least
21
21
  * one declared Intelligence Channel and activation was not opted out of, so the
22
22
  * documented `listener.channels.ready(...)` call type-checks without a `!` or a
23
23
  * `?.` under strict TypeScript — the Node mirror of
24
- * `CopilotRuntimeFetchHandlerWithChannels`.
24
+ * `CopilotKitRuntimeFetchHandlerWithChannels`.
25
25
  */
26
- type NodeCopilotListenerWithChannels = NodeFetchHandler & {
26
+ type NodeCopilotKitListenerWithChannels = NodeFetchHandler & {
27
27
  /** Lifecycle control surface for the runtime's declared managed Channels. */channels: ChannelsControl;
28
28
  };
29
29
  /**
@@ -41,7 +41,7 @@ type NodeCopilotListenerWithChannels = NodeFetchHandler & {
41
41
  * Gateway WebSocket and starts every direct adapter on the declared Channels.
42
42
  * Node owns its own process lifetime, so there is nothing to defer to and no
43
43
  * required incantation: a declared Channel connects because it was declared.
44
- * (The generic `createCopilotRuntimeHandler` is the opposite — it stays lazy for
44
+ * (The generic `createCopilotKitRuntimeHandler` is the opposite — it stays lazy for
45
45
  * serverless/edge safety; see its TSDoc.)
46
46
  *
47
47
  * `await listener.channels.ready()` is therefore OPTIONAL and purely
@@ -59,11 +59,11 @@ type NodeCopilotListenerWithChannels = NodeFetchHandler & {
59
59
  * @example
60
60
  * ```typescript
61
61
  * import { createServer } from "node:http";
62
- * import { CopilotRuntime } from "@copilotkit/runtime";
63
- * import { createCopilotNodeListener } from "@copilotkit/runtime/node";
62
+ * import { CopilotKitRuntime } from "@copilotkit/runtime";
63
+ * import { createCopilotKitNodeListener } from "@copilotkit/runtime/node";
64
64
  *
65
- * const listener = createCopilotNodeListener({
66
- * runtime: new CopilotRuntime({ agents: { ... } }),
65
+ * const listener = createCopilotKitNodeListener({
66
+ * runtime: new CopilotKitRuntime({ agents: { ... } }),
67
67
  * basePath: "/api/copilotkit",
68
68
  * cors: true,
69
69
  * });
@@ -83,22 +83,45 @@ type NodeCopilotListenerWithChannels = NodeFetchHandler & {
83
83
  * `true | undefined` here so passing `activateChannels: false` (which leaves no
84
84
  * `.channels`) falls through to the optional-shape overload below rather than
85
85
  * dishonestly promising a control surface that will not exist. Mirrors the
86
- * `createCopilotRuntimeHandler` overload pair so the brand survives the wrapper.
86
+ * `createCopilotKitRuntimeHandler` overload pair so the brand survives the wrapper.
87
87
  *
88
88
  * The brand comes from constructing the runtime with a literal non-empty
89
89
  * `channels` list (`readonly [Channel, ...Channel[]]`). A runtime built from a
90
90
  * dynamically-assembled `Channel[]` is not branded, so it falls to the
91
91
  * optional-shape overload and its call sites still need `?.`.
92
92
  */
93
- declare function createCopilotNodeListener(options: CopilotRuntimeHandlerOptions & {
93
+ declare function createCopilotKitNodeListener(options: CopilotKitRuntimeHandlerOptions & {
94
94
  runtime: RuntimeWithDeclaredChannels;
95
95
  activateChannels?: true | undefined;
96
- }): NodeCopilotListenerWithChannels;
96
+ }): NodeCopilotKitListenerWithChannels;
97
97
  /**
98
98
  * Overload: every other runtime (SSE, Intelligence without channels, or with
99
99
  * activation disabled) yields a listener whose `.channels` is optional.
100
100
  */
101
- declare function createCopilotNodeListener(options: CopilotRuntimeHandlerOptions): NodeCopilotListener;
101
+ declare function createCopilotKitNodeListener(options: CopilotKitRuntimeHandlerOptions): NodeCopilotKitListener;
102
+ /**
103
+ * @deprecated Use createCopilotKitNodeListener. This old name is an alias with
104
+ * the same behavior.
105
+ */
106
+ declare function createCopilotNodeListener(options: CopilotKitRuntimeHandlerOptions & {
107
+ runtime: RuntimeWithDeclaredChannels;
108
+ activateChannels?: true | undefined;
109
+ }): NodeCopilotKitListenerWithChannels;
110
+ /**
111
+ * @deprecated Use createCopilotKitNodeListener. This old name is an alias with
112
+ * the same behavior.
113
+ */
114
+ declare function createCopilotNodeListener(options: CopilotKitRuntimeHandlerOptions): NodeCopilotKitListener;
115
+ /**
116
+ * @deprecated Use NodeCopilotKitListener. This old name is an alias with the
117
+ * same behavior.
118
+ */
119
+ type NodeCopilotListener = NodeCopilotKitListener;
120
+ /**
121
+ * @deprecated Use NodeCopilotKitListenerWithChannels. This old name is an
122
+ * alias with the same behavior.
123
+ */
124
+ type NodeCopilotListenerWithChannels = NodeCopilotKitListenerWithChannels;
102
125
  //#endregion
103
- export { NodeCopilotListener, NodeCopilotListenerWithChannels, createCopilotNodeListener };
126
+ export { NodeCopilotKitListener, NodeCopilotKitListenerWithChannels, NodeCopilotListener, NodeCopilotListenerWithChannels, createCopilotKitNodeListener, createCopilotNodeListener };
104
127
  //# sourceMappingURL=node.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.cts","names":[],"sources":["../../../src/runtime/endpoints/node.ts"],"mappings":";;;;;;;;AAiBA;;;;;;KAAY,mBAAA,GAAsB,gBAAA;EAChC,QAAA,GAAW,eAAA;AAAA;AAWb;;;;;;;;AAAA,KAAY,+BAAA,GAAkC,gBAAA;EAqE9B,6EAnEd,QAAA,EAAU,eAAA;AAAA;;;;;;;;;;;;;;AA6EZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAVgB,yBAAA,CACd,OAAA,EAAS,4BAAA;EACP,OAAA,EAAS,2BAAA;EACT,gBAAA;AAAA,IAED,+BAAA;;;;;iBAKa,yBAAA,CACd,OAAA,EAAS,4BAAA,GACR,mBAAA"}
1
+ {"version":3,"file":"node.d.cts","names":[],"sources":["../../../src/runtime/endpoints/node.ts"],"mappings":";;;;;;;;AAiBA;;;;;;KAAY,sBAAA,GAAyB,gBAAA;EACnC,QAAA,GAAW,eAAA;AAAA;AAWb;;;;;;;;AAAA,KAAY,kCAAA,GAAqC,gBAAA;EAqEjC,6EAnEd,QAAA,EAAU,eAAA;AAAA;;;;;;;;;;;;;;AA6EZ;;;;;;;;;AAqBA;;;;;;;;;;;;;;;;AAUA;;;;;;;;;AAiBA;;;;;AAKA;;;;;;;;;;;;iBA/DgB,4BAAA,CACd,OAAA,EAAS,+BAAA;EACP,OAAA,EAAS,2BAAA;EACT,gBAAA;AAAA,IAED,kCAAA;;;;;iBAKa,4BAAA,CACd,OAAA,EAAS,+BAAA,GACR,sBAAA;;;;;iBAmBa,yBAAA,CACd,OAAA,EAAS,+BAAA;EACP,OAAA,EAAS,2BAAA;EACT,gBAAA;AAAA,IAED,kCAAA;;;;;iBAKa,yBAAA,CACd,OAAA,EAAS,+BAAA,GACR,sBAAA;;;;;KAeS,mBAAA,GAAsB,sBAAA;;;;;KAKtB,+BAAA,GACV,kCAAA"}
@@ -1,29 +1,29 @@
1
1
  import { RuntimeWithDeclaredChannels } from "../core/runtime.mjs";
2
2
  import { ChannelsControl } from "../core/channel-manager.mjs";
3
- import { CopilotRuntimeHandlerOptions } from "../core/fetch-handler.mjs";
3
+ import { CopilotKitRuntimeHandlerOptions } from "../core/fetch-handler.mjs";
4
4
  import { NodeFetchHandler } from "./node-fetch-handler.mjs";
5
5
 
6
6
  //#region src/runtime/endpoints/node.d.ts
7
7
  /**
8
8
  * A Node.js HTTP request listener that is also a callable object carrying an
9
9
  * optional {@link ChannelsControl} surface, mirroring
10
- * `CopilotRuntimeFetchHandler.channels`. Node is the long-running,
10
+ * `CopilotKitRuntimeFetchHandler.channels`. Node is the long-running,
11
11
  * lifecycle-owning entry point for the runtime, so it is the surface that
12
12
  * exposes `.channels` for callers that need to observe or stop the managed
13
13
  * Channel activation the listener starts at creation.
14
14
  */
15
- type NodeCopilotListener = NodeFetchHandler & {
15
+ type NodeCopilotKitListener = NodeFetchHandler & {
16
16
  channels?: ChannelsControl;
17
17
  };
18
18
  /**
19
- * A {@link NodeCopilotListener} whose {@link ChannelsControl} surface is
19
+ * A {@link NodeCopilotKitListener} whose {@link ChannelsControl} surface is
20
20
  * guaranteed present. Returned when the runtime was constructed with at least
21
21
  * one declared Intelligence Channel and activation was not opted out of, so the
22
22
  * documented `listener.channels.ready(...)` call type-checks without a `!` or a
23
23
  * `?.` under strict TypeScript — the Node mirror of
24
- * `CopilotRuntimeFetchHandlerWithChannels`.
24
+ * `CopilotKitRuntimeFetchHandlerWithChannels`.
25
25
  */
26
- type NodeCopilotListenerWithChannels = NodeFetchHandler & {
26
+ type NodeCopilotKitListenerWithChannels = NodeFetchHandler & {
27
27
  /** Lifecycle control surface for the runtime's declared managed Channels. */channels: ChannelsControl;
28
28
  };
29
29
  /**
@@ -41,7 +41,7 @@ type NodeCopilotListenerWithChannels = NodeFetchHandler & {
41
41
  * Gateway WebSocket and starts every direct adapter on the declared Channels.
42
42
  * Node owns its own process lifetime, so there is nothing to defer to and no
43
43
  * required incantation: a declared Channel connects because it was declared.
44
- * (The generic `createCopilotRuntimeHandler` is the opposite — it stays lazy for
44
+ * (The generic `createCopilotKitRuntimeHandler` is the opposite — it stays lazy for
45
45
  * serverless/edge safety; see its TSDoc.)
46
46
  *
47
47
  * `await listener.channels.ready()` is therefore OPTIONAL and purely
@@ -59,11 +59,11 @@ type NodeCopilotListenerWithChannels = NodeFetchHandler & {
59
59
  * @example
60
60
  * ```typescript
61
61
  * import { createServer } from "node:http";
62
- * import { CopilotRuntime } from "@copilotkit/runtime";
63
- * import { createCopilotNodeListener } from "@copilotkit/runtime/node";
62
+ * import { CopilotKitRuntime } from "@copilotkit/runtime";
63
+ * import { createCopilotKitNodeListener } from "@copilotkit/runtime/node";
64
64
  *
65
- * const listener = createCopilotNodeListener({
66
- * runtime: new CopilotRuntime({ agents: { ... } }),
65
+ * const listener = createCopilotKitNodeListener({
66
+ * runtime: new CopilotKitRuntime({ agents: { ... } }),
67
67
  * basePath: "/api/copilotkit",
68
68
  * cors: true,
69
69
  * });
@@ -83,22 +83,45 @@ type NodeCopilotListenerWithChannels = NodeFetchHandler & {
83
83
  * `true | undefined` here so passing `activateChannels: false` (which leaves no
84
84
  * `.channels`) falls through to the optional-shape overload below rather than
85
85
  * dishonestly promising a control surface that will not exist. Mirrors the
86
- * `createCopilotRuntimeHandler` overload pair so the brand survives the wrapper.
86
+ * `createCopilotKitRuntimeHandler` overload pair so the brand survives the wrapper.
87
87
  *
88
88
  * The brand comes from constructing the runtime with a literal non-empty
89
89
  * `channels` list (`readonly [Channel, ...Channel[]]`). A runtime built from a
90
90
  * dynamically-assembled `Channel[]` is not branded, so it falls to the
91
91
  * optional-shape overload and its call sites still need `?.`.
92
92
  */
93
- declare function createCopilotNodeListener(options: CopilotRuntimeHandlerOptions & {
93
+ declare function createCopilotKitNodeListener(options: CopilotKitRuntimeHandlerOptions & {
94
94
  runtime: RuntimeWithDeclaredChannels;
95
95
  activateChannels?: true | undefined;
96
- }): NodeCopilotListenerWithChannels;
96
+ }): NodeCopilotKitListenerWithChannels;
97
97
  /**
98
98
  * Overload: every other runtime (SSE, Intelligence without channels, or with
99
99
  * activation disabled) yields a listener whose `.channels` is optional.
100
100
  */
101
- declare function createCopilotNodeListener(options: CopilotRuntimeHandlerOptions): NodeCopilotListener;
101
+ declare function createCopilotKitNodeListener(options: CopilotKitRuntimeHandlerOptions): NodeCopilotKitListener;
102
+ /**
103
+ * @deprecated Use createCopilotKitNodeListener. This old name is an alias with
104
+ * the same behavior.
105
+ */
106
+ declare function createCopilotNodeListener(options: CopilotKitRuntimeHandlerOptions & {
107
+ runtime: RuntimeWithDeclaredChannels;
108
+ activateChannels?: true | undefined;
109
+ }): NodeCopilotKitListenerWithChannels;
110
+ /**
111
+ * @deprecated Use createCopilotKitNodeListener. This old name is an alias with
112
+ * the same behavior.
113
+ */
114
+ declare function createCopilotNodeListener(options: CopilotKitRuntimeHandlerOptions): NodeCopilotKitListener;
115
+ /**
116
+ * @deprecated Use NodeCopilotKitListener. This old name is an alias with the
117
+ * same behavior.
118
+ */
119
+ type NodeCopilotListener = NodeCopilotKitListener;
120
+ /**
121
+ * @deprecated Use NodeCopilotKitListenerWithChannels. This old name is an
122
+ * alias with the same behavior.
123
+ */
124
+ type NodeCopilotListenerWithChannels = NodeCopilotKitListenerWithChannels;
102
125
  //#endregion
103
- export { NodeCopilotListener, NodeCopilotListenerWithChannels, createCopilotNodeListener };
126
+ export { NodeCopilotKitListener, NodeCopilotKitListenerWithChannels, NodeCopilotListener, NodeCopilotListenerWithChannels, createCopilotKitNodeListener, createCopilotNodeListener };
104
127
  //# sourceMappingURL=node.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.mts","names":[],"sources":["../../../src/runtime/endpoints/node.ts"],"mappings":";;;;;;;;AAiBA;;;;;;KAAY,mBAAA,GAAsB,gBAAA;EAChC,QAAA,GAAW,eAAA;AAAA;AAWb;;;;;;;;AAAA,KAAY,+BAAA,GAAkC,gBAAA;EAqE9B,6EAnEd,QAAA,EAAU,eAAA;AAAA;;;;;;;;;;;;;;AA6EZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAVgB,yBAAA,CACd,OAAA,EAAS,4BAAA;EACP,OAAA,EAAS,2BAAA;EACT,gBAAA;AAAA,IAED,+BAAA;;;;;iBAKa,yBAAA,CACd,OAAA,EAAS,4BAAA,GACR,mBAAA"}
1
+ {"version":3,"file":"node.d.mts","names":[],"sources":["../../../src/runtime/endpoints/node.ts"],"mappings":";;;;;;;;AAiBA;;;;;;KAAY,sBAAA,GAAyB,gBAAA;EACnC,QAAA,GAAW,eAAA;AAAA;AAWb;;;;;;;;AAAA,KAAY,kCAAA,GAAqC,gBAAA;EAqEjC,6EAnEd,QAAA,EAAU,eAAA;AAAA;;;;;;;;;;;;;;AA6EZ;;;;;;;;;AAqBA;;;;;;;;;;;;;;;;AAUA;;;;;;;;;AAiBA;;;;;AAKA;;;;;;;;;;;;iBA/DgB,4BAAA,CACd,OAAA,EAAS,+BAAA;EACP,OAAA,EAAS,2BAAA;EACT,gBAAA;AAAA,IAED,kCAAA;;;;;iBAKa,4BAAA,CACd,OAAA,EAAS,+BAAA,GACR,sBAAA;;;;;iBAmBa,yBAAA,CACd,OAAA,EAAS,+BAAA;EACP,OAAA,EAAS,2BAAA;EACT,gBAAA;AAAA,IAED,kCAAA;;;;;iBAKa,yBAAA,CACd,OAAA,EAAS,+BAAA,GACR,sBAAA;;;;;KAeS,mBAAA,GAAsB,sBAAA;;;;;KAKtB,+BAAA,GACV,kCAAA"}
@@ -1,18 +1,25 @@
1
1
  import { getRuntimeLogger } from "../core/logger.mjs";
2
- import { createCopilotRuntimeHandler } from "../core/fetch-handler.mjs";
3
- import { createCopilotNodeHandler } from "./node-fetch-handler.mjs";
2
+ import { createCopilotKitRuntimeHandler } from "../core/fetch-handler.mjs";
3
+ import { createCopilotKitNodeHandler } from "./node-fetch-handler.mjs";
4
4
  import { autoStartChannels } from "./auto-start-channels.mjs";
5
5
 
6
6
  //#region src/runtime/endpoints/node.ts
7
- function createCopilotNodeListener(options) {
8
- const handler = createCopilotRuntimeHandler(options);
7
+ function createCopilotKitNodeListener(options) {
8
+ const handler = createCopilotKitRuntimeHandler(options);
9
9
  const logger = getRuntimeLogger(options.runtime);
10
- const listener = createCopilotNodeHandler(handler, logger);
10
+ const listener = createCopilotKitNodeHandler(handler, logger);
11
11
  listener.channels = handler.channels;
12
12
  autoStartChannels(listener.channels, logger);
13
13
  return listener;
14
14
  }
15
+ /**
16
+ * @deprecated Use createCopilotKitNodeListener. This old name is an alias with
17
+ * the same behavior.
18
+ */
19
+ function createCopilotNodeListener(options) {
20
+ return createCopilotKitNodeListener(options);
21
+ }
15
22
 
16
23
  //#endregion
17
- export { createCopilotNodeListener };
24
+ export { createCopilotKitNodeListener, createCopilotNodeListener };
18
25
  //# sourceMappingURL=node.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.mjs","names":[],"sources":["../../../src/runtime/endpoints/node.ts"],"sourcesContent":["import { createCopilotRuntimeHandler } from \"../core/fetch-handler\";\nimport type { CopilotRuntimeHandlerOptions } from \"../core/fetch-handler\";\nimport type { RuntimeWithDeclaredChannels } from \"../core/runtime\";\nimport type { ChannelsControl } from \"../core/channel-manager\";\nimport { createCopilotNodeHandler } from \"./node-fetch-handler\";\nimport type { NodeFetchHandler } from \"./node-fetch-handler\";\nimport { autoStartChannels } from \"./auto-start-channels\";\nimport { getRuntimeLogger } from \"../core/logger\";\n\n/**\n * A Node.js HTTP request listener that is also a callable object carrying an\n * optional {@link ChannelsControl} surface, mirroring\n * `CopilotRuntimeFetchHandler.channels`. Node is the long-running,\n * lifecycle-owning entry point for the runtime, so it is the surface that\n * exposes `.channels` for callers that need to observe or stop the managed\n * Channel activation the listener starts at creation.\n */\nexport type NodeCopilotListener = NodeFetchHandler & {\n channels?: ChannelsControl;\n};\n\n/**\n * A {@link NodeCopilotListener} whose {@link ChannelsControl} surface is\n * guaranteed present. Returned when the runtime was constructed with at least\n * one declared Intelligence Channel and activation was not opted out of, so the\n * documented `listener.channels.ready(...)` call type-checks without a `!` or a\n * `?.` under strict TypeScript — the Node mirror of\n * `CopilotRuntimeFetchHandlerWithChannels`.\n */\nexport type NodeCopilotListenerWithChannels = NodeFetchHandler & {\n /** Lifecycle control surface for the runtime's declared managed Channels. */\n channels: ChannelsControl;\n};\n\n/**\n * Convenience wrapper for creating a Node.js HTTP request listener\n * from CopilotKit runtime handler options.\n *\n * When the runtime declares managed Channels (and activation was not opted\n * out of via `activateChannels: false`), the returned listener exposes\n * `.channels` — the same {@link ChannelsControl} surface carried by the\n * underlying fetch handler.\n *\n * ## Managed Channels lifecycle\n *\n * Creating the listener STARTS activation — which opens the persistent Realtime\n * Gateway WebSocket and starts every direct adapter on the declared Channels.\n * Node owns its own process lifetime, so there is nothing to defer to and no\n * required incantation: a declared Channel connects because it was declared.\n * (The generic `createCopilotRuntimeHandler` is the opposite — it stays lazy for\n * serverless/edge safety; see its TSDoc.)\n *\n * `await listener.channels.ready()` is therefore OPTIONAL and purely\n * await-and-observe: it resolves once every declared Channel has settled to\n * `online`/`setup_required` and rejects with the activation failure, observing\n * the activation started at creation rather than triggering a second one. Await\n * it when startup should block on Channels being live (or should exit non-zero\n * when they are not); skip it and activation failures land in the logs instead.\n * `listener.channels.stop()` tears activation down.\n *\n * Pass `activateChannels: false` to build no control surface and open no socket\n * — the clean opt-out for a test or a short-lived script that mounts the\n * listener without wanting its Channels connected.\n *\n * @example\n * ```typescript\n * import { createServer } from \"node:http\";\n * import { CopilotRuntime } from \"@copilotkit/runtime\";\n * import { createCopilotNodeListener } from \"@copilotkit/runtime/node\";\n *\n * const listener = createCopilotNodeListener({\n * runtime: new CopilotRuntime({ agents: { ... } }),\n * basePath: \"/api/copilotkit\",\n * cors: true,\n * });\n * createServer(listener).listen(3000);\n * // Declared managed Channels are already connecting at this point.\n *\n * // Optional: block startup on them being live. Bound it so one wedged adapter\n * // cannot hang startup forever.\n * await listener.channels.ready({ timeoutMs: 30_000 });\n * ```\n */\n/**\n * Overload: a runtime constructed with at least one declared Intelligence\n * Channel (a {@link RuntimeWithDeclaredChannels}-branded runtime), when\n * activation is not disabled, yields a listener with a **non-optional**\n * {@link ChannelsControl}. `activateChannels` is constrained to\n * `true | undefined` here so passing `activateChannels: false` (which leaves no\n * `.channels`) falls through to the optional-shape overload below rather than\n * dishonestly promising a control surface that will not exist. Mirrors the\n * `createCopilotRuntimeHandler` overload pair so the brand survives the wrapper.\n *\n * The brand comes from constructing the runtime with a literal non-empty\n * `channels` list (`readonly [Channel, ...Channel[]]`). A runtime built from a\n * dynamically-assembled `Channel[]` is not branded, so it falls to the\n * optional-shape overload and its call sites still need `?.`.\n */\nexport function createCopilotNodeListener(\n options: CopilotRuntimeHandlerOptions & {\n runtime: RuntimeWithDeclaredChannels;\n activateChannels?: true | undefined;\n },\n): NodeCopilotListenerWithChannels;\n/**\n * Overload: every other runtime (SSE, Intelligence without channels, or with\n * activation disabled) yields a listener whose `.channels` is optional.\n */\nexport function createCopilotNodeListener(\n options: CopilotRuntimeHandlerOptions,\n): NodeCopilotListener;\nexport function createCopilotNodeListener(\n options: CopilotRuntimeHandlerOptions,\n): NodeCopilotListener {\n const handler = createCopilotRuntimeHandler(options);\n const logger = getRuntimeLogger(options.runtime);\n const listener: NodeCopilotListener = createCopilotNodeHandler(\n handler,\n logger,\n );\n listener.channels = handler.channels;\n autoStartChannels(listener.channels, logger);\n return listener;\n}\n"],"mappings":";;;;;;AA+GA,SAAgB,0BACd,SACqB;CACrB,MAAM,UAAU,4BAA4B,QAAQ;CACpD,MAAM,SAAS,iBAAiB,QAAQ,QAAQ;CAChD,MAAM,WAAgC,yBACpC,SACA,OACD;AACD,UAAS,WAAW,QAAQ;AAC5B,mBAAkB,SAAS,UAAU,OAAO;AAC5C,QAAO"}
1
+ {"version":3,"file":"node.mjs","names":[],"sources":["../../../src/runtime/endpoints/node.ts"],"sourcesContent":["import { createCopilotKitRuntimeHandler } from \"../core/fetch-handler\";\nimport type { CopilotKitRuntimeHandlerOptions } from \"../core/fetch-handler\";\nimport type { RuntimeWithDeclaredChannels } from \"../core/runtime\";\nimport type { ChannelsControl } from \"../core/channel-manager\";\nimport { createCopilotKitNodeHandler } from \"./node-fetch-handler\";\nimport type { NodeFetchHandler } from \"./node-fetch-handler\";\nimport { autoStartChannels } from \"./auto-start-channels\";\nimport { getRuntimeLogger } from \"../core/logger\";\n\n/**\n * A Node.js HTTP request listener that is also a callable object carrying an\n * optional {@link ChannelsControl} surface, mirroring\n * `CopilotKitRuntimeFetchHandler.channels`. Node is the long-running,\n * lifecycle-owning entry point for the runtime, so it is the surface that\n * exposes `.channels` for callers that need to observe or stop the managed\n * Channel activation the listener starts at creation.\n */\nexport type NodeCopilotKitListener = NodeFetchHandler & {\n channels?: ChannelsControl;\n};\n\n/**\n * A {@link NodeCopilotKitListener} whose {@link ChannelsControl} surface is\n * guaranteed present. Returned when the runtime was constructed with at least\n * one declared Intelligence Channel and activation was not opted out of, so the\n * documented `listener.channels.ready(...)` call type-checks without a `!` or a\n * `?.` under strict TypeScript — the Node mirror of\n * `CopilotKitRuntimeFetchHandlerWithChannels`.\n */\nexport type NodeCopilotKitListenerWithChannels = NodeFetchHandler & {\n /** Lifecycle control surface for the runtime's declared managed Channels. */\n channels: ChannelsControl;\n};\n\n/**\n * Convenience wrapper for creating a Node.js HTTP request listener\n * from CopilotKit runtime handler options.\n *\n * When the runtime declares managed Channels (and activation was not opted\n * out of via `activateChannels: false`), the returned listener exposes\n * `.channels` — the same {@link ChannelsControl} surface carried by the\n * underlying fetch handler.\n *\n * ## Managed Channels lifecycle\n *\n * Creating the listener STARTS activation — which opens the persistent Realtime\n * Gateway WebSocket and starts every direct adapter on the declared Channels.\n * Node owns its own process lifetime, so there is nothing to defer to and no\n * required incantation: a declared Channel connects because it was declared.\n * (The generic `createCopilotKitRuntimeHandler` is the opposite — it stays lazy for\n * serverless/edge safety; see its TSDoc.)\n *\n * `await listener.channels.ready()` is therefore OPTIONAL and purely\n * await-and-observe: it resolves once every declared Channel has settled to\n * `online`/`setup_required` and rejects with the activation failure, observing\n * the activation started at creation rather than triggering a second one. Await\n * it when startup should block on Channels being live (or should exit non-zero\n * when they are not); skip it and activation failures land in the logs instead.\n * `listener.channels.stop()` tears activation down.\n *\n * Pass `activateChannels: false` to build no control surface and open no socket\n * — the clean opt-out for a test or a short-lived script that mounts the\n * listener without wanting its Channels connected.\n *\n * @example\n * ```typescript\n * import { createServer } from \"node:http\";\n * import { CopilotKitRuntime } from \"@copilotkit/runtime\";\n * import { createCopilotKitNodeListener } from \"@copilotkit/runtime/node\";\n *\n * const listener = createCopilotKitNodeListener({\n * runtime: new CopilotKitRuntime({ agents: { ... } }),\n * basePath: \"/api/copilotkit\",\n * cors: true,\n * });\n * createServer(listener).listen(3000);\n * // Declared managed Channels are already connecting at this point.\n *\n * // Optional: block startup on them being live. Bound it so one wedged adapter\n * // cannot hang startup forever.\n * await listener.channels.ready({ timeoutMs: 30_000 });\n * ```\n */\n/**\n * Overload: a runtime constructed with at least one declared Intelligence\n * Channel (a {@link RuntimeWithDeclaredChannels}-branded runtime), when\n * activation is not disabled, yields a listener with a **non-optional**\n * {@link ChannelsControl}. `activateChannels` is constrained to\n * `true | undefined` here so passing `activateChannels: false` (which leaves no\n * `.channels`) falls through to the optional-shape overload below rather than\n * dishonestly promising a control surface that will not exist. Mirrors the\n * `createCopilotKitRuntimeHandler` overload pair so the brand survives the wrapper.\n *\n * The brand comes from constructing the runtime with a literal non-empty\n * `channels` list (`readonly [Channel, ...Channel[]]`). A runtime built from a\n * dynamically-assembled `Channel[]` is not branded, so it falls to the\n * optional-shape overload and its call sites still need `?.`.\n */\nexport function createCopilotKitNodeListener(\n options: CopilotKitRuntimeHandlerOptions & {\n runtime: RuntimeWithDeclaredChannels;\n activateChannels?: true | undefined;\n },\n): NodeCopilotKitListenerWithChannels;\n/**\n * Overload: every other runtime (SSE, Intelligence without channels, or with\n * activation disabled) yields a listener whose `.channels` is optional.\n */\nexport function createCopilotKitNodeListener(\n options: CopilotKitRuntimeHandlerOptions,\n): NodeCopilotKitListener;\nexport function createCopilotKitNodeListener(\n options: CopilotKitRuntimeHandlerOptions,\n): NodeCopilotKitListener {\n const handler = createCopilotKitRuntimeHandler(options);\n const logger = getRuntimeLogger(options.runtime);\n const listener: NodeCopilotKitListener = createCopilotKitNodeHandler(\n handler,\n logger,\n );\n listener.channels = handler.channels;\n autoStartChannels(listener.channels, logger);\n return listener;\n}\n\n/**\n * @deprecated Use createCopilotKitNodeListener. This old name is an alias with\n * the same behavior.\n */\nexport function createCopilotNodeListener(\n options: CopilotKitRuntimeHandlerOptions & {\n runtime: RuntimeWithDeclaredChannels;\n activateChannels?: true | undefined;\n },\n): NodeCopilotKitListenerWithChannels;\n/**\n * @deprecated Use createCopilotKitNodeListener. This old name is an alias with\n * the same behavior.\n */\nexport function createCopilotNodeListener(\n options: CopilotKitRuntimeHandlerOptions,\n): NodeCopilotKitListener;\n/**\n * @deprecated Use createCopilotKitNodeListener. This old name is an alias with\n * the same behavior.\n */\nexport function createCopilotNodeListener(\n options: CopilotKitRuntimeHandlerOptions,\n): NodeCopilotKitListener {\n return createCopilotKitNodeListener(options);\n}\n\n/**\n * @deprecated Use NodeCopilotKitListener. This old name is an alias with the\n * same behavior.\n */\nexport type NodeCopilotListener = NodeCopilotKitListener;\n/**\n * @deprecated Use NodeCopilotKitListenerWithChannels. This old name is an\n * alias with the same behavior.\n */\nexport type NodeCopilotListenerWithChannels =\n NodeCopilotKitListenerWithChannels;\n"],"mappings":";;;;;;AA+GA,SAAgB,6BACd,SACwB;CACxB,MAAM,UAAU,+BAA+B,QAAQ;CACvD,MAAM,SAAS,iBAAiB,QAAQ,QAAQ;CAChD,MAAM,WAAmC,4BACvC,SACA,OACD;AACD,UAAS,WAAW,QAAQ;AAC5B,mBAAkB,SAAS,UAAU,OAAO;AAC5C,QAAO;;;;;;AAwBT,SAAgB,0BACd,SACwB;AACxB,QAAO,6BAA6B,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"a2ui-v09-middleware.cjs","names":["downgradeA2UIV09Action","buildA2UIV09CatalogContext","Middleware","createA2UIV09ActivityUpgrader"],"sources":["../../../src/runtime/generative-ui/a2ui-v09-middleware.ts"],"sourcesContent":["import { Middleware } from \"@ag-ui/client\";\nimport type { AbstractAgent, BaseEvent, RunAgentInput } from \"@ag-ui/client\";\nimport { concatMap } from \"rxjs\";\nimport type { Observable } from \"rxjs\";\nimport type { A2UIVersion, CopilotRuntimeOptions } from \"../core/runtime\";\nimport { downgradeA2UIV09Action } from \"./a2ui-v09-actions\";\nimport { buildA2UIV09CatalogContext } from \"./a2ui-v09-catalog\";\nimport { createA2UIV09ActivityUpgrader } from \"./a2ui-v09-operations\";\n\n/**\n * The A2UI version of one agent, from the runtime's `generativeUI` option.\n * Without `a2uiVersion`, and for an agent that is not in an `a2uiVersion`\n * record, the version is `\"1.0\"`.\n *\n * @param generativeUI - The runtime's `generativeUI` option.\n * @param agentId - The id of the agent.\n * @returns `\"0.9\"` or `\"1.0\"`.\n */\nexport function resolveA2UIVersion(\n generativeUI: CopilotRuntimeOptions[\"generativeUI\"],\n agentId: string,\n): A2UIVersion {\n const option =\n typeof generativeUI === \"object\" ? generativeUI.a2uiVersion : undefined;\n const version =\n typeof option === \"object\" && option !== null ? option[agentId] : option;\n return version === \"0.9\" ? \"0.9\" : \"1.0\";\n}\n\n/**\n * The input that the agent side of a run gets:\n * - A click on a surface that was converted from v0.9 becomes the v0.9\n * action (`forwardedProps.a2uiAction`), see {@link downgradeA2UIV09Action}.\n * The input of a middleware has no activity messages (`AbstractAgent`\n * removes them), so in practice `agentVersion` decides: every click of a\n * run of a v0.9 agent becomes a v0.9 action.\n * - For a v0.9 agent, the v0.9 component schema of the client's catalog is\n * added to the context. An entry with the same description is replaced.\n *\n * It never mutates `input`.\n */\nexport function prepareA2UIV09AgentInput(\n input: RunAgentInput,\n agentVersion: A2UIVersion,\n): RunAgentInput {\n const agentInput = downgradeA2UIV09Action(input, { agentVersion });\n if (agentVersion !== \"0.9\") return agentInput;\n const catalog = buildA2UIV09CatalogContext(agentInput);\n if (!catalog) return agentInput;\n const descriptions = new Set(catalog.context.map((e) => e.description));\n return {\n ...agentInput,\n context: [\n ...(agentInput.context ?? []).filter(\n (entry) => !descriptions.has(entry.description),\n ),\n ...catalog.context,\n ],\n };\n}\n\n/**\n * Connects agents that speak A2UI v0.9 to the A2UI 1.0 client.\n *\n * - Input: {@link prepareA2UIV09AgentInput}. Only the agent side gets the\n * changed input. The runtime stores the input of the client, so the\n * thread keeps the click message.\n * - Output: every `a2ui-surface` activity event becomes a\n * `generative-ui-surface` event, see `createA2UIV09ActivityUpgrader`.\n * The version of each operation decides, so v0.9 surfaces convert also\n * for a `\"1.0\"` agent (for example, from a tool result), and native 1.0\n * operations on this path (for example, from ADK) reach the client as 1.0\n * surfaces too.\n *\n * The first middleware given to `agent.use` is the outermost: it sees the\n * input first and the events last. Use this middleware before\n * `A2UIMiddleware`, so that `A2UIMiddleware` gets the v0.9 input and this\n * middleware converts the surfaces that `A2UIMiddleware` emits.\n *\n * @example\n * ```ts\n * agent.use(\n * new A2UIV09BridgeMiddleware({ agentVersion: \"0.9\" }),\n * new A2UIMiddleware({ injectA2UITool: true }),\n * );\n * ```\n */\nexport class A2UIV09BridgeMiddleware extends Middleware {\n private readonly agentVersion: A2UIVersion;\n\n constructor(options: { agentVersion?: A2UIVersion } = {}) {\n super();\n this.agentVersion = options.agentVersion ?? \"1.0\";\n }\n\n run(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent> {\n const upgrader = createA2UIV09ActivityUpgrader();\n return this.runNext(\n prepareA2UIV09AgentInput(input, this.agentVersion),\n next,\n ).pipe(concatMap((event) => upgrader.transform(event)));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,SAAgB,mBACd,cACA,SACa;CACb,MAAM,SACJ,OAAO,iBAAiB,WAAW,aAAa,cAAc;AAGhE,SADE,OAAO,WAAW,YAAY,WAAW,OAAO,OAAO,WAAW,YACjD,QAAQ,QAAQ;;;;;;;;;;;;;;AAerC,SAAgB,yBACd,OACA,cACe;CACf,MAAM,aAAaA,gDAAuB,OAAO,EAAE,cAAc,CAAC;AAClE,KAAI,iBAAiB,MAAO,QAAO;CACnC,MAAM,UAAUC,oDAA2B,WAAW;AACtD,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,eAAe,IAAI,IAAI,QAAQ,QAAQ,KAAK,MAAM,EAAE,YAAY,CAAC;AACvE,QAAO;EACL,GAAG;EACH,SAAS,CACP,IAAI,WAAW,WAAW,EAAE,EAAE,QAC3B,UAAU,CAAC,aAAa,IAAI,MAAM,YAAY,CAChD,EACD,GAAG,QAAQ,QACZ;EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,IAAa,0BAAb,cAA6CC,yBAAW;CAGtD,YAAY,UAA0C,EAAE,EAAE;AACxD,SAAO;AACP,OAAK,eAAe,QAAQ,gBAAgB;;CAG9C,IAAI,OAAsB,MAA4C;EACpE,MAAM,WAAWC,2DAA+B;AAChD,SAAO,KAAK,QACV,yBAAyB,OAAO,KAAK,aAAa,EAClD,KACD,CAAC,0BAAgB,UAAU,SAAS,UAAU,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"a2ui-v09-middleware.cjs","names":["downgradeA2UIV09Action","buildA2UIV09CatalogContext","Middleware","createA2UIV09ActivityUpgrader"],"sources":["../../../src/runtime/generative-ui/a2ui-v09-middleware.ts"],"sourcesContent":["import { Middleware } from \"@ag-ui/client\";\nimport type { AbstractAgent, BaseEvent, RunAgentInput } from \"@ag-ui/client\";\nimport { concatMap } from \"rxjs\";\nimport type { Observable } from \"rxjs\";\nimport type { A2UIVersion, CopilotKitRuntimeOptions } from \"../core/runtime\";\nimport { downgradeA2UIV09Action } from \"./a2ui-v09-actions\";\nimport { buildA2UIV09CatalogContext } from \"./a2ui-v09-catalog\";\nimport { createA2UIV09ActivityUpgrader } from \"./a2ui-v09-operations\";\n\n/**\n * The A2UI version of one agent, from the runtime's `generativeUI` option.\n * Without `a2uiVersion`, and for an agent that is not in an `a2uiVersion`\n * record, the version is `\"1.0\"`.\n *\n * @param generativeUI - The runtime's `generativeUI` option.\n * @param agentId - The id of the agent.\n * @returns `\"0.9\"` or `\"1.0\"`.\n */\nexport function resolveA2UIVersion(\n generativeUI: CopilotKitRuntimeOptions[\"generativeUI\"],\n agentId: string,\n): A2UIVersion {\n const option =\n typeof generativeUI === \"object\" ? generativeUI.a2uiVersion : undefined;\n const version =\n typeof option === \"object\" && option !== null ? option[agentId] : option;\n return version === \"0.9\" ? \"0.9\" : \"1.0\";\n}\n\n/**\n * The input that the agent side of a run gets:\n * - A click on a surface that was converted from v0.9 becomes the v0.9\n * action (`forwardedProps.a2uiAction`), see {@link downgradeA2UIV09Action}.\n * The input of a middleware has no activity messages (`AbstractAgent`\n * removes them), so in practice `agentVersion` decides: every click of a\n * run of a v0.9 agent becomes a v0.9 action.\n * - For a v0.9 agent, the v0.9 component schema of the client's catalog is\n * added to the context. An entry with the same description is replaced.\n *\n * It never mutates `input`.\n */\nexport function prepareA2UIV09AgentInput(\n input: RunAgentInput,\n agentVersion: A2UIVersion,\n): RunAgentInput {\n const agentInput = downgradeA2UIV09Action(input, { agentVersion });\n if (agentVersion !== \"0.9\") return agentInput;\n const catalog = buildA2UIV09CatalogContext(agentInput);\n if (!catalog) return agentInput;\n const descriptions = new Set(catalog.context.map((e) => e.description));\n return {\n ...agentInput,\n context: [\n ...(agentInput.context ?? []).filter(\n (entry) => !descriptions.has(entry.description),\n ),\n ...catalog.context,\n ],\n };\n}\n\n/**\n * Connects agents that speak A2UI v0.9 to the A2UI 1.0 client.\n *\n * - Input: {@link prepareA2UIV09AgentInput}. Only the agent side gets the\n * changed input. The runtime stores the input of the client, so the\n * thread keeps the click message.\n * - Output: every `a2ui-surface` activity event becomes a\n * `generative-ui-surface` event, see `createA2UIV09ActivityUpgrader`.\n * The version of each operation decides, so v0.9 surfaces convert also\n * for a `\"1.0\"` agent (for example, from a tool result), and native 1.0\n * operations on this path (for example, from ADK) reach the client as 1.0\n * surfaces too.\n *\n * The first middleware given to `agent.use` is the outermost: it sees the\n * input first and the events last. Use this middleware before\n * `A2UIMiddleware`, so that `A2UIMiddleware` gets the v0.9 input and this\n * middleware converts the surfaces that `A2UIMiddleware` emits.\n *\n * @example\n * ```ts\n * agent.use(\n * new A2UIV09BridgeMiddleware({ agentVersion: \"0.9\" }),\n * new A2UIMiddleware({ injectA2UITool: true }),\n * );\n * ```\n */\nexport class A2UIV09BridgeMiddleware extends Middleware {\n private readonly agentVersion: A2UIVersion;\n\n constructor(options: { agentVersion?: A2UIVersion } = {}) {\n super();\n this.agentVersion = options.agentVersion ?? \"1.0\";\n }\n\n run(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent> {\n const upgrader = createA2UIV09ActivityUpgrader();\n return this.runNext(\n prepareA2UIV09AgentInput(input, this.agentVersion),\n next,\n ).pipe(concatMap((event) => upgrader.transform(event)));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,SAAgB,mBACd,cACA,SACa;CACb,MAAM,SACJ,OAAO,iBAAiB,WAAW,aAAa,cAAc;AAGhE,SADE,OAAO,WAAW,YAAY,WAAW,OAAO,OAAO,WAAW,YACjD,QAAQ,QAAQ;;;;;;;;;;;;;;AAerC,SAAgB,yBACd,OACA,cACe;CACf,MAAM,aAAaA,gDAAuB,OAAO,EAAE,cAAc,CAAC;AAClE,KAAI,iBAAiB,MAAO,QAAO;CACnC,MAAM,UAAUC,oDAA2B,WAAW;AACtD,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,eAAe,IAAI,IAAI,QAAQ,QAAQ,KAAK,MAAM,EAAE,YAAY,CAAC;AACvE,QAAO;EACL,GAAG;EACH,SAAS,CACP,IAAI,WAAW,WAAW,EAAE,EAAE,QAC3B,UAAU,CAAC,aAAa,IAAI,MAAM,YAAY,CAChD,EACD,GAAG,QAAQ,QACZ;EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,IAAa,0BAAb,cAA6CC,yBAAW;CAGtD,YAAY,UAA0C,EAAE,EAAE;AACxD,SAAO;AACP,OAAK,eAAe,QAAQ,gBAAgB;;CAG9C,IAAI,OAAsB,MAA4C;EACpE,MAAM,WAAWC,2DAA+B;AAChD,SAAO,KAAK,QACV,yBAAyB,OAAO,KAAK,aAAa,EAClD,KACD,CAAC,0BAAgB,UAAU,SAAS,UAAU,MAAM,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"a2ui-v09-middleware.mjs","names":[],"sources":["../../../src/runtime/generative-ui/a2ui-v09-middleware.ts"],"sourcesContent":["import { Middleware } from \"@ag-ui/client\";\nimport type { AbstractAgent, BaseEvent, RunAgentInput } from \"@ag-ui/client\";\nimport { concatMap } from \"rxjs\";\nimport type { Observable } from \"rxjs\";\nimport type { A2UIVersion, CopilotRuntimeOptions } from \"../core/runtime\";\nimport { downgradeA2UIV09Action } from \"./a2ui-v09-actions\";\nimport { buildA2UIV09CatalogContext } from \"./a2ui-v09-catalog\";\nimport { createA2UIV09ActivityUpgrader } from \"./a2ui-v09-operations\";\n\n/**\n * The A2UI version of one agent, from the runtime's `generativeUI` option.\n * Without `a2uiVersion`, and for an agent that is not in an `a2uiVersion`\n * record, the version is `\"1.0\"`.\n *\n * @param generativeUI - The runtime's `generativeUI` option.\n * @param agentId - The id of the agent.\n * @returns `\"0.9\"` or `\"1.0\"`.\n */\nexport function resolveA2UIVersion(\n generativeUI: CopilotRuntimeOptions[\"generativeUI\"],\n agentId: string,\n): A2UIVersion {\n const option =\n typeof generativeUI === \"object\" ? generativeUI.a2uiVersion : undefined;\n const version =\n typeof option === \"object\" && option !== null ? option[agentId] : option;\n return version === \"0.9\" ? \"0.9\" : \"1.0\";\n}\n\n/**\n * The input that the agent side of a run gets:\n * - A click on a surface that was converted from v0.9 becomes the v0.9\n * action (`forwardedProps.a2uiAction`), see {@link downgradeA2UIV09Action}.\n * The input of a middleware has no activity messages (`AbstractAgent`\n * removes them), so in practice `agentVersion` decides: every click of a\n * run of a v0.9 agent becomes a v0.9 action.\n * - For a v0.9 agent, the v0.9 component schema of the client's catalog is\n * added to the context. An entry with the same description is replaced.\n *\n * It never mutates `input`.\n */\nexport function prepareA2UIV09AgentInput(\n input: RunAgentInput,\n agentVersion: A2UIVersion,\n): RunAgentInput {\n const agentInput = downgradeA2UIV09Action(input, { agentVersion });\n if (agentVersion !== \"0.9\") return agentInput;\n const catalog = buildA2UIV09CatalogContext(agentInput);\n if (!catalog) return agentInput;\n const descriptions = new Set(catalog.context.map((e) => e.description));\n return {\n ...agentInput,\n context: [\n ...(agentInput.context ?? []).filter(\n (entry) => !descriptions.has(entry.description),\n ),\n ...catalog.context,\n ],\n };\n}\n\n/**\n * Connects agents that speak A2UI v0.9 to the A2UI 1.0 client.\n *\n * - Input: {@link prepareA2UIV09AgentInput}. Only the agent side gets the\n * changed input. The runtime stores the input of the client, so the\n * thread keeps the click message.\n * - Output: every `a2ui-surface` activity event becomes a\n * `generative-ui-surface` event, see `createA2UIV09ActivityUpgrader`.\n * The version of each operation decides, so v0.9 surfaces convert also\n * for a `\"1.0\"` agent (for example, from a tool result), and native 1.0\n * operations on this path (for example, from ADK) reach the client as 1.0\n * surfaces too.\n *\n * The first middleware given to `agent.use` is the outermost: it sees the\n * input first and the events last. Use this middleware before\n * `A2UIMiddleware`, so that `A2UIMiddleware` gets the v0.9 input and this\n * middleware converts the surfaces that `A2UIMiddleware` emits.\n *\n * @example\n * ```ts\n * agent.use(\n * new A2UIV09BridgeMiddleware({ agentVersion: \"0.9\" }),\n * new A2UIMiddleware({ injectA2UITool: true }),\n * );\n * ```\n */\nexport class A2UIV09BridgeMiddleware extends Middleware {\n private readonly agentVersion: A2UIVersion;\n\n constructor(options: { agentVersion?: A2UIVersion } = {}) {\n super();\n this.agentVersion = options.agentVersion ?? \"1.0\";\n }\n\n run(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent> {\n const upgrader = createA2UIV09ActivityUpgrader();\n return this.runNext(\n prepareA2UIV09AgentInput(input, this.agentVersion),\n next,\n ).pipe(concatMap((event) => upgrader.transform(event)));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,SAAgB,mBACd,cACA,SACa;CACb,MAAM,SACJ,OAAO,iBAAiB,WAAW,aAAa,cAAc;AAGhE,SADE,OAAO,WAAW,YAAY,WAAW,OAAO,OAAO,WAAW,YACjD,QAAQ,QAAQ;;;;;;;;;;;;;;AAerC,SAAgB,yBACd,OACA,cACe;CACf,MAAM,aAAa,uBAAuB,OAAO,EAAE,cAAc,CAAC;AAClE,KAAI,iBAAiB,MAAO,QAAO;CACnC,MAAM,UAAU,2BAA2B,WAAW;AACtD,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,eAAe,IAAI,IAAI,QAAQ,QAAQ,KAAK,MAAM,EAAE,YAAY,CAAC;AACvE,QAAO;EACL,GAAG;EACH,SAAS,CACP,IAAI,WAAW,WAAW,EAAE,EAAE,QAC3B,UAAU,CAAC,aAAa,IAAI,MAAM,YAAY,CAChD,EACD,GAAG,QAAQ,QACZ;EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,IAAa,0BAAb,cAA6C,WAAW;CAGtD,YAAY,UAA0C,EAAE,EAAE;AACxD,SAAO;AACP,OAAK,eAAe,QAAQ,gBAAgB;;CAG9C,IAAI,OAAsB,MAA4C;EACpE,MAAM,WAAW,+BAA+B;AAChD,SAAO,KAAK,QACV,yBAAyB,OAAO,KAAK,aAAa,EAClD,KACD,CAAC,KAAK,WAAW,UAAU,SAAS,UAAU,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"a2ui-v09-middleware.mjs","names":[],"sources":["../../../src/runtime/generative-ui/a2ui-v09-middleware.ts"],"sourcesContent":["import { Middleware } from \"@ag-ui/client\";\nimport type { AbstractAgent, BaseEvent, RunAgentInput } from \"@ag-ui/client\";\nimport { concatMap } from \"rxjs\";\nimport type { Observable } from \"rxjs\";\nimport type { A2UIVersion, CopilotKitRuntimeOptions } from \"../core/runtime\";\nimport { downgradeA2UIV09Action } from \"./a2ui-v09-actions\";\nimport { buildA2UIV09CatalogContext } from \"./a2ui-v09-catalog\";\nimport { createA2UIV09ActivityUpgrader } from \"./a2ui-v09-operations\";\n\n/**\n * The A2UI version of one agent, from the runtime's `generativeUI` option.\n * Without `a2uiVersion`, and for an agent that is not in an `a2uiVersion`\n * record, the version is `\"1.0\"`.\n *\n * @param generativeUI - The runtime's `generativeUI` option.\n * @param agentId - The id of the agent.\n * @returns `\"0.9\"` or `\"1.0\"`.\n */\nexport function resolveA2UIVersion(\n generativeUI: CopilotKitRuntimeOptions[\"generativeUI\"],\n agentId: string,\n): A2UIVersion {\n const option =\n typeof generativeUI === \"object\" ? generativeUI.a2uiVersion : undefined;\n const version =\n typeof option === \"object\" && option !== null ? option[agentId] : option;\n return version === \"0.9\" ? \"0.9\" : \"1.0\";\n}\n\n/**\n * The input that the agent side of a run gets:\n * - A click on a surface that was converted from v0.9 becomes the v0.9\n * action (`forwardedProps.a2uiAction`), see {@link downgradeA2UIV09Action}.\n * The input of a middleware has no activity messages (`AbstractAgent`\n * removes them), so in practice `agentVersion` decides: every click of a\n * run of a v0.9 agent becomes a v0.9 action.\n * - For a v0.9 agent, the v0.9 component schema of the client's catalog is\n * added to the context. An entry with the same description is replaced.\n *\n * It never mutates `input`.\n */\nexport function prepareA2UIV09AgentInput(\n input: RunAgentInput,\n agentVersion: A2UIVersion,\n): RunAgentInput {\n const agentInput = downgradeA2UIV09Action(input, { agentVersion });\n if (agentVersion !== \"0.9\") return agentInput;\n const catalog = buildA2UIV09CatalogContext(agentInput);\n if (!catalog) return agentInput;\n const descriptions = new Set(catalog.context.map((e) => e.description));\n return {\n ...agentInput,\n context: [\n ...(agentInput.context ?? []).filter(\n (entry) => !descriptions.has(entry.description),\n ),\n ...catalog.context,\n ],\n };\n}\n\n/**\n * Connects agents that speak A2UI v0.9 to the A2UI 1.0 client.\n *\n * - Input: {@link prepareA2UIV09AgentInput}. Only the agent side gets the\n * changed input. The runtime stores the input of the client, so the\n * thread keeps the click message.\n * - Output: every `a2ui-surface` activity event becomes a\n * `generative-ui-surface` event, see `createA2UIV09ActivityUpgrader`.\n * The version of each operation decides, so v0.9 surfaces convert also\n * for a `\"1.0\"` agent (for example, from a tool result), and native 1.0\n * operations on this path (for example, from ADK) reach the client as 1.0\n * surfaces too.\n *\n * The first middleware given to `agent.use` is the outermost: it sees the\n * input first and the events last. Use this middleware before\n * `A2UIMiddleware`, so that `A2UIMiddleware` gets the v0.9 input and this\n * middleware converts the surfaces that `A2UIMiddleware` emits.\n *\n * @example\n * ```ts\n * agent.use(\n * new A2UIV09BridgeMiddleware({ agentVersion: \"0.9\" }),\n * new A2UIMiddleware({ injectA2UITool: true }),\n * );\n * ```\n */\nexport class A2UIV09BridgeMiddleware extends Middleware {\n private readonly agentVersion: A2UIVersion;\n\n constructor(options: { agentVersion?: A2UIVersion } = {}) {\n super();\n this.agentVersion = options.agentVersion ?? \"1.0\";\n }\n\n run(input: RunAgentInput, next: AbstractAgent): Observable<BaseEvent> {\n const upgrader = createA2UIV09ActivityUpgrader();\n return this.runNext(\n prepareA2UIV09AgentInput(input, this.agentVersion),\n next,\n ).pipe(concatMap((event) => upgrader.transform(event)));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,SAAgB,mBACd,cACA,SACa;CACb,MAAM,SACJ,OAAO,iBAAiB,WAAW,aAAa,cAAc;AAGhE,SADE,OAAO,WAAW,YAAY,WAAW,OAAO,OAAO,WAAW,YACjD,QAAQ,QAAQ;;;;;;;;;;;;;;AAerC,SAAgB,yBACd,OACA,cACe;CACf,MAAM,aAAa,uBAAuB,OAAO,EAAE,cAAc,CAAC;AAClE,KAAI,iBAAiB,MAAO,QAAO;CACnC,MAAM,UAAU,2BAA2B,WAAW;AACtD,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,eAAe,IAAI,IAAI,QAAQ,QAAQ,KAAK,MAAM,EAAE,YAAY,CAAC;AACvE,QAAO;EACL,GAAG;EACH,SAAS,CACP,IAAI,WAAW,WAAW,EAAE,EAAE,QAC3B,UAAU,CAAC,aAAa,IAAI,MAAM,YAAY,CAChD,EACD,GAAG,QAAQ,QACZ;EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,IAAa,0BAAb,cAA6C,WAAW;CAGtD,YAAY,UAA0C,EAAE,EAAE;AACxD,SAAO;AACP,OAAK,eAAe,QAAQ,gBAAgB;;CAG9C,IAAI,OAAsB,MAA4C;EACpE,MAAM,WAAW,+BAA+B;AAChD,SAAO,KAAK,QACV,yBAAyB,OAAO,KAAK,aAAa,EAClD,KACD,CAAC,KAAK,WAAW,UAAU,SAAS,UAAU,MAAM,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-runtime-info.cjs","names":["isIntelligenceRuntime","PlatformRequestError","resolveAgents","VERSION","hasLearningContainerConfiguration","isTelemetryDisabled","supportsLocalThreadEndpoints","isThreadOperationAvailable"],"sources":["../../../src/runtime/handlers/get-runtime-info.ts"],"sourcesContent":["import { getRuntimeLogger } from \"../core/logger\";\nimport type { AgentCapabilities } from \"@ag-ui/core\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime, resolveAgents } from \"../core/runtime\";\nimport type {\n AgentDescription,\n GenerativeUIRuntimeInfo,\n RuntimeInfo,\n RuntimeEntitlementResponse,\n ThreadEndpointRuntimeInfo,\n} from \"@copilotkit/shared\";\nimport type { RuntimeLicenseStatus } from \"@copilotkit/shared\";\nimport type { LicenseChecker } from \"@copilotkit/license-verifier\";\nimport { VERSION } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { isTelemetryDisabled } from \"../telemetry/telemetry-client\";\nimport { supportsLocalThreadEndpoints } from \"../runner/agent-runner\";\nimport { isThreadOperationAvailable } from \"./shared/thread-access\";\n\nfunction resolveLicenseStatus(\n licenseChecker: LicenseChecker | undefined,\n): RuntimeLicenseStatus {\n if (!licenseChecker) return \"none\";\n const status = licenseChecker.getStatus();\n if (status.warningSeverity === \"none\") return \"valid\";\n if (status.error === \"expired\") return \"expired\";\n if (status.warningSeverity === \"warning\") return \"expiring\";\n if (status.error) return \"invalid\";\n if (status.warningSeverity === \"info\") return \"none\";\n return \"unknown\";\n}\n\n/**\n * Map the structured entitlement authority onto the legacy status consumed by\n * older Core, React, and Angular thread surfaces. A ready managed entitlement\n * is authoritative in both directions. Otherwise, preserve the legacy\n * self-hosted license fallback. A retryable lookup without that fallback\n * remains unknown until it resolves.\n */\nfunction resolveCompatibilityLicenseStatus(\n licenseChecker: LicenseChecker | undefined,\n runtimeEntitlements: RuntimeEntitlementResponse | undefined,\n): RuntimeLicenseStatus {\n if (runtimeEntitlements?.status === \"ready\") {\n if (\n runtimeEntitlements.entitlement.source === \"managedOrgSubscription\" ||\n runtimeEntitlements.entitlement.source ===\n \"awsMarketplaceDeploymentLicense\"\n ) {\n return runtimeEntitlements.entitlement.active ? \"valid\" : \"none\";\n }\n\n if (runtimeEntitlements.entitlement.active) {\n return \"valid\";\n }\n }\n\n const legacyLicenseStatus = resolveLicenseStatus(licenseChecker);\n if (\n legacyLicenseStatus === \"none\" &&\n runtimeEntitlements?.status !== \"ready\" &&\n runtimeEntitlements?.error.retryable\n ) {\n return \"unknown\";\n }\n\n return legacyLicenseStatus;\n}\n\ninterface HandleGetRuntimeInfoParameters {\n runtime: CopilotRuntimeLike;\n request: Request;\n threadEndpointsEnabled?: boolean;\n singleRouteResourceOperationsEnabled?: boolean;\n}\n\n/**\n * Resolve structured Runtime entitlements for configured Intelligence runtimes.\n *\n * Dependency failures are deliberately converted to a stable unavailable\n * diagnostic so `/info` remains an availability endpoint. The underlying\n * error is not exposed because it may contain upstream response details.\n */\nasync function resolveRuntimeEntitlements(\n runtime: CopilotRuntimeLike,\n): Promise<RuntimeEntitlementResponse | undefined> {\n if (!isIntelligenceRuntime(runtime)) {\n return undefined;\n }\n\n try {\n return await runtime.intelligence.getRuntimeEntitlements();\n } catch (error) {\n if (error instanceof PlatformRequestError && error.retryable === false) {\n return {\n status: \"misconfigured\",\n error: {\n code: \"runtime_entitlements_misconfigured\",\n message: \"Runtime entitlement lookup is misconfigured\",\n retryable: false,\n },\n };\n }\n\n return {\n status: \"unavailable\",\n error: {\n code: \"runtime_entitlements_unavailable\",\n message: \"Runtime entitlement lookup failed\",\n retryable: true,\n },\n };\n }\n}\n\nexport async function handleGetRuntimeInfo({\n runtime,\n request,\n threadEndpointsEnabled = true,\n singleRouteResourceOperationsEnabled = false,\n}: HandleGetRuntimeInfoParameters) {\n try {\n const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);\n const webEnabled =\n !isIntelligenceRuntime(runtime) || runtime.identifyUser !== undefined;\n const agents = webEnabled\n ? await resolveAgents(runtime.agents, request)\n : {};\n\n const agentEntries = await Promise.all(\n Object.entries(agents).map(async ([name, agent]) => {\n let capabilities: AgentCapabilities | undefined;\n try {\n capabilities = agent.getCapabilities\n ? await agent.getCapabilities()\n : undefined;\n } catch (error) {\n // Per-agent isolation: a single agent failing to report capabilities\n // must not take down the entire /info endpoint.\n getRuntimeLogger(runtime).warn(\n { err: error, agentId: name },\n `Failed to fetch capabilities for agent \"${name}\"`,\n );\n capabilities = undefined;\n }\n\n const description: AgentDescription = {\n name,\n description: agent.description,\n className: agent.constructor.name,\n ...(capabilities ? { capabilities } : {}),\n };\n\n return [name, description] as const;\n }),\n );\n\n const agentsDict: Record<string, AgentDescription> =\n Object.fromEntries(agentEntries);\n const runtimeEntitlements = await runtimeEntitlementsPromise;\n // Verified on first use, not at construction (see getLicenseChecker).\n const licenseChecker = isIntelligenceRuntime(runtime)\n ? await runtime.getLicenseChecker?.()\n : undefined;\n\n const runtimeInfo: RuntimeInfo = {\n version: VERSION,\n agents: agentsDict,\n audioFileTranscriptionEnabled:\n webEnabled && !!runtime.transcriptionService,\n mode: runtime.mode,\n threadEndpoints: resolveThreadEndpointInfo(\n runtime,\n threadEndpointsEnabled && webEnabled,\n ),\n ...(singleRouteResourceOperationsEnabled\n ? {\n singleRoute: {\n resourceOperations: true,\n threadEndpoints: resolveThreadEndpointInfo(runtime, webEnabled),\n },\n }\n : {}),\n // Advertised unconditionally. Multi-route runtimes expose the dedicated\n // POST /agent/:agentId/suggest path; single-route clients fall back to a\n // client-side run (they don't construct the single-route envelope for\n // suggest). The flag lets multi-route clients detect the stateless path.\n suggestions: webEnabled,\n ...(isIntelligenceRuntime(runtime) && webEnabled\n ? {\n intelligence: {\n wsUrl: runtime.intelligence.ɵgetClientWsUrl(),\n },\n inspectorMetadata: true,\n ...(hasLearningContainerConfiguration(runtime)\n ? { inspectorLearning: true }\n : {}),\n }\n : {}),\n openGenerativeUIEnabled: webEnabled && !!runtime.openGenerativeUI,\n generativeUI: resolveGenerativeUIInfo(runtime, webEnabled),\n ...(isIntelligenceRuntime(runtime)\n ? {\n licenseStatus: resolveCompatibilityLicenseStatus(\n licenseChecker,\n runtimeEntitlements,\n ),\n }\n : {}),\n ...(runtimeEntitlements ? { runtimeEntitlements } : {}),\n telemetryDisabled: isTelemetryDisabled(),\n };\n\n return new Response(JSON.stringify(runtimeInfo), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n return new Response(\n JSON.stringify({\n error: \"Failed to retrieve runtime information\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n\n/**\n * Report generative UI with the rules `configureAgentForRequest` uses to\n * attach the generative UI middlewares: it is on unless `generativeUI` is\n * `false`, and `{ agents }` limits it to those agents. The A2UI version of an\n * agent (`a2uiVersion`) does not change it: the client renders 1.0 for both,\n * as the runtime converts v0.9 surfaces. When the option is omitted, the\n * middlewares run only for a client that asks for them, so the client can\n * still turn generative UI on.\n */\nfunction resolveGenerativeUIInfo(\n runtime: CopilotRuntimeLike,\n webEnabled: boolean,\n): GenerativeUIRuntimeInfo {\n const generativeUI = runtime.generativeUI;\n if (!webEnabled || generativeUI === false) return { enabled: false };\n const agents =\n typeof generativeUI === \"object\" ? generativeUI.agents : undefined;\n return { enabled: true, ...(agents ? { agents } : {}) };\n}\n\nfunction resolveThreadEndpointInfo(\n runtime: CopilotRuntimeLike,\n threadEndpointsEnabled: boolean,\n): ThreadEndpointRuntimeInfo {\n // A local route is advertised only when the Thread access policy lets it\n // serve requests: without identity, list is refused by default while\n // reading a Thread by id is not.\n const available = (operation: \"list\" | \"read\") =>\n threadEndpointsEnabled &&\n (isIntelligenceRuntime(runtime) ||\n (supportsLocalThreadEndpoints(runtime.runner) &&\n isThreadOperationAvailable(runtime, operation)));\n const managedThreadMetadata =\n threadEndpointsEnabled && isIntelligenceRuntime(runtime);\n\n return {\n list: available(\"list\"),\n inspect: available(\"read\"),\n mutations: managedThreadMetadata,\n realtimeMetadata: managedThreadMetadata,\n };\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAS,qBACP,gBACsB;AACtB,KAAI,CAAC,eAAgB,QAAO;CAC5B,MAAM,SAAS,eAAe,WAAW;AACzC,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,oBAAoB,UAAW,QAAO;AACjD,KAAI,OAAO,MAAO,QAAO;AACzB,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,QAAO;;;;;;;;;AAUT,SAAS,kCACP,gBACA,qBACsB;AACtB,KAAI,qBAAqB,WAAW,SA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AO,EAAE,SAAS,OAAO;CACpE,MAAM,SACJ,OAAO,iBAAiB,WAAW,aAAa,SAAS;AAC3D,QAAO;EAAE,SAAS;EAAM,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAAG;;AAGzD,SAAS,0BACP,SACA,wBAC2B;CAI3B,MAAM,aAAa,cACjB,2BACCL,sCAAsB,QAAQ,IAC5BM,kDAA6B,QAAQ,OAAO,IAC3CC,iDAA2B,SAAS,UAAU;CACpD,MAAM,wBACJ,0BAA0BP,sCAAsB,QAAQ;AAE1D,QAAO;EACL,MAAM,UAAU,OAAO;EACvB,SAAS,UAAU,OAAO;EAC1B,WAAW;EACX,kBAAkB;EACnB"}
1
+ {"version":3,"file":"get-runtime-info.cjs","names":["isIntelligenceRuntime","PlatformRequestError","resolveAgents","VERSION","hasLearningContainerConfiguration","isTelemetryDisabled","supportsLocalThreadEndpoints","isThreadOperationAvailable"],"sources":["../../../src/runtime/handlers/get-runtime-info.ts"],"sourcesContent":["import { getRuntimeLogger } from \"../core/logger\";\nimport type { AgentCapabilities } from \"@ag-ui/core\";\nimport type { CopilotKitRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime, resolveAgents } from \"../core/runtime\";\nimport type {\n AgentDescription,\n GenerativeUIRuntimeInfo,\n RuntimeInfo,\n RuntimeEntitlementResponse,\n ThreadEndpointRuntimeInfo,\n} from \"@copilotkit/shared\";\nimport type { RuntimeLicenseStatus } from \"@copilotkit/shared\";\nimport type { LicenseChecker } from \"@copilotkit/license-verifier\";\nimport { VERSION } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { isTelemetryDisabled } from \"../telemetry/telemetry-client\";\nimport { supportsLocalThreadEndpoints } from \"../runner/agent-runner\";\nimport { isThreadOperationAvailable } from \"./shared/thread-access\";\n\nfunction resolveLicenseStatus(\n licenseChecker: LicenseChecker | undefined,\n): RuntimeLicenseStatus {\n if (!licenseChecker) return \"none\";\n const status = licenseChecker.getStatus();\n if (status.warningSeverity === \"none\") return \"valid\";\n if (status.error === \"expired\") return \"expired\";\n if (status.warningSeverity === \"warning\") return \"expiring\";\n if (status.error) return \"invalid\";\n if (status.warningSeverity === \"info\") return \"none\";\n return \"unknown\";\n}\n\n/**\n * Map the structured entitlement authority onto the legacy status consumed by\n * older Core, React, and Angular thread surfaces. A ready managed entitlement\n * is authoritative in both directions. Otherwise, preserve the legacy\n * self-hosted license fallback. A retryable lookup without that fallback\n * remains unknown until it resolves.\n */\nfunction resolveCompatibilityLicenseStatus(\n licenseChecker: LicenseChecker | undefined,\n runtimeEntitlements: RuntimeEntitlementResponse | undefined,\n): RuntimeLicenseStatus {\n if (runtimeEntitlements?.status === \"ready\") {\n if (\n runtimeEntitlements.entitlement.source === \"managedOrgSubscription\" ||\n runtimeEntitlements.entitlement.source ===\n \"awsMarketplaceDeploymentLicense\"\n ) {\n return runtimeEntitlements.entitlement.active ? \"valid\" : \"none\";\n }\n\n if (runtimeEntitlements.entitlement.active) {\n return \"valid\";\n }\n }\n\n const legacyLicenseStatus = resolveLicenseStatus(licenseChecker);\n if (\n legacyLicenseStatus === \"none\" &&\n runtimeEntitlements?.status !== \"ready\" &&\n runtimeEntitlements?.error.retryable\n ) {\n return \"unknown\";\n }\n\n return legacyLicenseStatus;\n}\n\ninterface HandleGetRuntimeInfoParameters {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n threadEndpointsEnabled?: boolean;\n singleRouteResourceOperationsEnabled?: boolean;\n}\n\n/**\n * Resolve structured Runtime entitlements for configured Intelligence runtimes.\n *\n * Dependency failures are deliberately converted to a stable unavailable\n * diagnostic so `/info` remains an availability endpoint. The underlying\n * error is not exposed because it may contain upstream response details.\n */\nasync function resolveRuntimeEntitlements(\n runtime: CopilotKitRuntimeLike,\n): Promise<RuntimeEntitlementResponse | undefined> {\n if (!isIntelligenceRuntime(runtime)) {\n return undefined;\n }\n\n try {\n return await runtime.intelligence.getRuntimeEntitlements();\n } catch (error) {\n if (error instanceof PlatformRequestError && error.retryable === false) {\n return {\n status: \"misconfigured\",\n error: {\n code: \"runtime_entitlements_misconfigured\",\n message: \"Runtime entitlement lookup is misconfigured\",\n retryable: false,\n },\n };\n }\n\n return {\n status: \"unavailable\",\n error: {\n code: \"runtime_entitlements_unavailable\",\n message: \"Runtime entitlement lookup failed\",\n retryable: true,\n },\n };\n }\n}\n\nexport async function handleGetRuntimeInfo({\n runtime,\n request,\n threadEndpointsEnabled = true,\n singleRouteResourceOperationsEnabled = false,\n}: HandleGetRuntimeInfoParameters) {\n try {\n const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);\n const webEnabled =\n !isIntelligenceRuntime(runtime) || runtime.identifyUser !== undefined;\n const agents = webEnabled\n ? await resolveAgents(runtime.agents, request)\n : {};\n\n const agentEntries = await Promise.all(\n Object.entries(agents).map(async ([name, agent]) => {\n let capabilities: AgentCapabilities | undefined;\n try {\n capabilities = agent.getCapabilities\n ? await agent.getCapabilities()\n : undefined;\n } catch (error) {\n // Per-agent isolation: a single agent failing to report capabilities\n // must not take down the entire /info endpoint.\n getRuntimeLogger(runtime).warn(\n { err: error, agentId: name },\n `Failed to fetch capabilities for agent \"${name}\"`,\n );\n capabilities = undefined;\n }\n\n const description: AgentDescription = {\n name,\n description: agent.description,\n className: agent.constructor.name,\n ...(capabilities ? { capabilities } : {}),\n };\n\n return [name, description] as const;\n }),\n );\n\n const agentsDict: Record<string, AgentDescription> =\n Object.fromEntries(agentEntries);\n const runtimeEntitlements = await runtimeEntitlementsPromise;\n // Verified on first use, not at construction (see getLicenseChecker).\n const licenseChecker = isIntelligenceRuntime(runtime)\n ? await runtime.getLicenseChecker?.()\n : undefined;\n\n const runtimeInfo: RuntimeInfo = {\n version: VERSION,\n agents: agentsDict,\n audioFileTranscriptionEnabled:\n webEnabled && !!runtime.transcriptionService,\n mode: runtime.mode,\n threadEndpoints: resolveThreadEndpointInfo(\n runtime,\n threadEndpointsEnabled && webEnabled,\n ),\n ...(singleRouteResourceOperationsEnabled\n ? {\n singleRoute: {\n resourceOperations: true,\n threadEndpoints: resolveThreadEndpointInfo(runtime, webEnabled),\n },\n }\n : {}),\n // Advertised unconditionally. Multi-route runtimes expose the dedicated\n // POST /agent/:agentId/suggest path; single-route clients fall back to a\n // client-side run (they don't construct the single-route envelope for\n // suggest). The flag lets multi-route clients detect the stateless path.\n suggestions: webEnabled,\n ...(isIntelligenceRuntime(runtime) && webEnabled\n ? {\n intelligence: {\n wsUrl: runtime.intelligence.ɵgetClientWsUrl(),\n },\n inspectorMetadata: true,\n ...(hasLearningContainerConfiguration(runtime)\n ? { inspectorLearning: true }\n : {}),\n }\n : {}),\n openGenerativeUIEnabled: webEnabled && !!runtime.openGenerativeUI,\n generativeUI: resolveGenerativeUIInfo(runtime, webEnabled),\n ...(isIntelligenceRuntime(runtime)\n ? {\n licenseStatus: resolveCompatibilityLicenseStatus(\n licenseChecker,\n runtimeEntitlements,\n ),\n }\n : {}),\n ...(runtimeEntitlements ? { runtimeEntitlements } : {}),\n telemetryDisabled: isTelemetryDisabled(),\n };\n\n return new Response(JSON.stringify(runtimeInfo), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n return new Response(\n JSON.stringify({\n error: \"Failed to retrieve runtime information\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n\n/**\n * Report generative UI with the rules `configureAgentForRequest` uses to\n * attach the generative UI middlewares: it is on unless `generativeUI` is\n * `false`, and `{ agents }` limits it to those agents. The A2UI version of an\n * agent (`a2uiVersion`) does not change it: the client renders 1.0 for both,\n * as the runtime converts v0.9 surfaces. When the option is omitted, the\n * middlewares run only for a client that asks for them, so the client can\n * still turn generative UI on.\n */\nfunction resolveGenerativeUIInfo(\n runtime: CopilotKitRuntimeLike,\n webEnabled: boolean,\n): GenerativeUIRuntimeInfo {\n const generativeUI = runtime.generativeUI;\n if (!webEnabled || generativeUI === false) return { enabled: false };\n const agents =\n typeof generativeUI === \"object\" ? generativeUI.agents : undefined;\n return { enabled: true, ...(agents ? { agents } : {}) };\n}\n\nfunction resolveThreadEndpointInfo(\n runtime: CopilotKitRuntimeLike,\n threadEndpointsEnabled: boolean,\n): ThreadEndpointRuntimeInfo {\n // A local route is advertised only when the Thread access policy lets it\n // serve requests: without identity, list is refused by default while\n // reading a Thread by id is not.\n const available = (operation: \"list\" | \"read\") =>\n threadEndpointsEnabled &&\n (isIntelligenceRuntime(runtime) ||\n (supportsLocalThreadEndpoints(runtime.runner) &&\n isThreadOperationAvailable(runtime, operation)));\n const managedThreadMetadata =\n threadEndpointsEnabled && isIntelligenceRuntime(runtime);\n\n return {\n list: available(\"list\"),\n inspect: available(\"read\"),\n mutations: managedThreadMetadata,\n realtimeMetadata: managedThreadMetadata,\n };\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAS,qBACP,gBACsB;AACtB,KAAI,CAAC,eAAgB,QAAO;CAC5B,MAAM,SAAS,eAAe,WAAW;AACzC,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,oBAAoB,UAAW,QAAO;AACjD,KAAI,OAAO,MAAO,QAAO;AACzB,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,QAAO;;;;;;;;;AAUT,SAAS,kCACP,gBACA,qBACsB;AACtB,KAAI,qBAAqB,WAAW,SAAS;AAC3C,MACE,oBAAoB,YAAY,WAAW,4BAC3C,oBAAoB,YAAY,WAC9B,kCAEF,QAAO,oBAAoB,YAAY,SAAS,UAAU;AAG5D,MAAI,oBAAoB,YAAY,OAClC,QAAO;;CAIX,MAAM,sBAAsB,qBAAqB,eAAe;AAChE,KACE,wBAAwB,UACxB,qBAAqB,WAAW,WAChC,qBAAqB,MAAM,UAE3B,QAAO;AAGT,QAAO;;;;;;;;;AAiBT,eAAe,2BACb,SACiD;A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J,0BAA0BP,sCAAsB,QAAQ;AAE1D,QAAO;EACL,MAAM,UAAU,OAAO;EACvB,SAAS,UAAU,OAAO;EAC1B,WAAW;EACX,kBAAkB;EACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-runtime-info.mjs","names":[],"sources":["../../../src/runtime/handlers/get-runtime-info.ts"],"sourcesContent":["import { getRuntimeLogger } from \"../core/logger\";\nimport type { AgentCapabilities } from \"@ag-ui/core\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime, resolveAgents } from \"../core/runtime\";\nimport type {\n AgentDescription,\n GenerativeUIRuntimeInfo,\n RuntimeInfo,\n RuntimeEntitlementResponse,\n ThreadEndpointRuntimeInfo,\n} from \"@copilotkit/shared\";\nimport type { RuntimeLicenseStatus } from \"@copilotkit/shared\";\nimport type { LicenseChecker } from \"@copilotkit/license-verifier\";\nimport { VERSION } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { isTelemetryDisabled } from \"../telemetry/telemetry-client\";\nimport { supportsLocalThreadEndpoints } from \"../runner/agent-runner\";\nimport { isThreadOperationAvailable } from \"./shared/thread-access\";\n\nfunction resolveLicenseStatus(\n licenseChecker: LicenseChecker | undefined,\n): RuntimeLicenseStatus {\n if (!licenseChecker) return \"none\";\n const status = licenseChecker.getStatus();\n if (status.warningSeverity === \"none\") return \"valid\";\n if (status.error === \"expired\") return \"expired\";\n if (status.warningSeverity === \"warning\") return \"expiring\";\n if (status.error) return \"invalid\";\n if (status.warningSeverity === \"info\") return \"none\";\n return \"unknown\";\n}\n\n/**\n * Map the structured entitlement authority onto the legacy status consumed by\n * older Core, React, and Angular thread surfaces. A ready managed entitlement\n * is authoritative in both directions. Otherwise, preserve the legacy\n * self-hosted license fallback. A retryable lookup without that fallback\n * remains unknown until it resolves.\n */\nfunction resolveCompatibilityLicenseStatus(\n licenseChecker: LicenseChecker | undefined,\n runtimeEntitlements: RuntimeEntitlementResponse | undefined,\n): RuntimeLicenseStatus {\n if (runtimeEntitlements?.status === \"ready\") {\n if (\n runtimeEntitlements.entitlement.source === \"managedOrgSubscription\" ||\n runtimeEntitlements.entitlement.source ===\n \"awsMarketplaceDeploymentLicense\"\n ) {\n return runtimeEntitlements.entitlement.active ? \"valid\" : \"none\";\n }\n\n if (runtimeEntitlements.entitlement.active) {\n return \"valid\";\n }\n }\n\n const legacyLicenseStatus = resolveLicenseStatus(licenseChecker);\n if (\n legacyLicenseStatus === \"none\" &&\n runtimeEntitlements?.status !== \"ready\" &&\n runtimeEntitlements?.error.retryable\n ) {\n return \"unknown\";\n }\n\n return legacyLicenseStatus;\n}\n\ninterface HandleGetRuntimeInfoParameters {\n runtime: CopilotRuntimeLike;\n request: Request;\n threadEndpointsEnabled?: boolean;\n singleRouteResourceOperationsEnabled?: boolean;\n}\n\n/**\n * Resolve structured Runtime entitlements for configured Intelligence runtimes.\n *\n * Dependency failures are deliberately converted to a stable unavailable\n * diagnostic so `/info` remains an availability endpoint. The underlying\n * error is not exposed because it may contain upstream response details.\n */\nasync function resolveRuntimeEntitlements(\n runtime: CopilotRuntimeLike,\n): Promise<RuntimeEntitlementResponse | undefined> {\n if (!isIntelligenceRuntime(runtime)) {\n return undefined;\n }\n\n try {\n return await runtime.intelligence.getRuntimeEntitlements();\n } catch (error) {\n if (error instanceof PlatformRequestError && error.retryable === false) {\n return {\n status: \"misconfigured\",\n error: {\n code: \"runtime_entitlements_misconfigured\",\n message: \"Runtime entitlement lookup is misconfigured\",\n retryable: false,\n },\n };\n }\n\n return {\n status: \"unavailable\",\n error: {\n code: \"runtime_entitlements_unavailable\",\n message: \"Runtime entitlement lookup failed\",\n retryable: true,\n },\n };\n }\n}\n\nexport async function handleGetRuntimeInfo({\n runtime,\n request,\n threadEndpointsEnabled = true,\n singleRouteResourceOperationsEnabled = false,\n}: HandleGetRuntimeInfoParameters) {\n try {\n const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);\n const webEnabled =\n !isIntelligenceRuntime(runtime) || runtime.identifyUser !== undefined;\n const agents = webEnabled\n ? await resolveAgents(runtime.agents, request)\n : {};\n\n const agentEntries = await Promise.all(\n Object.entries(agents).map(async ([name, agent]) => {\n let capabilities: AgentCapabilities | undefined;\n try {\n capabilities = agent.getCapabilities\n ? await agent.getCapabilities()\n : undefined;\n } catch (error) {\n // Per-agent isolation: a single agent failing to report capabilities\n // must not take down the entire /info endpoint.\n getRuntimeLogger(runtime).warn(\n { err: error, agentId: name },\n `Failed to fetch capabilities for agent \"${name}\"`,\n );\n capabilities = undefined;\n }\n\n const description: AgentDescription = {\n name,\n description: agent.description,\n className: agent.constructor.name,\n ...(capabilities ? { capabilities } : {}),\n };\n\n return [name, description] as const;\n }),\n );\n\n const agentsDict: Record<string, AgentDescription> =\n Object.fromEntries(agentEntries);\n const runtimeEntitlements = await runtimeEntitlementsPromise;\n // Verified on first use, not at construction (see getLicenseChecker).\n const licenseChecker = isIntelligenceRuntime(runtime)\n ? await runtime.getLicenseChecker?.()\n : undefined;\n\n const runtimeInfo: RuntimeInfo = {\n version: VERSION,\n agents: agentsDict,\n audioFileTranscriptionEnabled:\n webEnabled && !!runtime.transcriptionService,\n mode: runtime.mode,\n threadEndpoints: resolveThreadEndpointInfo(\n runtime,\n threadEndpointsEnabled && webEnabled,\n ),\n ...(singleRouteResourceOperationsEnabled\n ? {\n singleRoute: {\n resourceOperations: true,\n threadEndpoints: resolveThreadEndpointInfo(runtime, webEnabled),\n },\n }\n : {}),\n // Advertised unconditionally. Multi-route runtimes expose the dedicated\n // POST /agent/:agentId/suggest path; single-route clients fall back to a\n // client-side run (they don't construct the single-route envelope for\n // suggest). The flag lets multi-route clients detect the stateless path.\n suggestions: webEnabled,\n ...(isIntelligenceRuntime(runtime) && webEnabled\n ? {\n intelligence: {\n wsUrl: runtime.intelligence.ɵgetClientWsUrl(),\n },\n inspectorMetadata: true,\n ...(hasLearningContainerConfiguration(runtime)\n ? { inspectorLearning: true }\n : {}),\n }\n : {}),\n openGenerativeUIEnabled: webEnabled && !!runtime.openGenerativeUI,\n generativeUI: resolveGenerativeUIInfo(runtime, webEnabled),\n ...(isIntelligenceRuntime(runtime)\n ? {\n licenseStatus: resolveCompatibilityLicenseStatus(\n licenseChecker,\n runtimeEntitlements,\n ),\n }\n : {}),\n ...(runtimeEntitlements ? { runtimeEntitlements } : {}),\n telemetryDisabled: isTelemetryDisabled(),\n };\n\n return new Response(JSON.stringify(runtimeInfo), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n return new Response(\n JSON.stringify({\n error: \"Failed to retrieve runtime information\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n\n/**\n * Report generative UI with the rules `configureAgentForRequest` uses to\n * attach the generative UI middlewares: it is on unless `generativeUI` is\n * `false`, and `{ agents }` limits it to those agents. The A2UI version of an\n * agent (`a2uiVersion`) does not change it: the client renders 1.0 for both,\n * as the runtime converts v0.9 surfaces. When the option is omitted, the\n * middlewares run only for a client that asks for them, so the client can\n * still turn generative UI on.\n */\nfunction resolveGenerativeUIInfo(\n runtime: CopilotRuntimeLike,\n webEnabled: boolean,\n): GenerativeUIRuntimeInfo {\n const generativeUI = runtime.generativeUI;\n if (!webEnabled || generativeUI === false) return { enabled: false };\n const agents =\n typeof generativeUI === \"object\" ? generativeUI.agents : undefined;\n return { enabled: true, ...(agents ? { agents } : {}) };\n}\n\nfunction resolveThreadEndpointInfo(\n runtime: CopilotRuntimeLike,\n threadEndpointsEnabled: boolean,\n): ThreadEndpointRuntimeInfo {\n // A local route is advertised only when the Thread access policy lets it\n // serve requests: without identity, list is refused by default while\n // reading a Thread by id is not.\n const available = (operation: \"list\" | \"read\") =>\n threadEndpointsEnabled &&\n (isIntelligenceRuntime(runtime) ||\n (supportsLocalThreadEndpoints(runtime.runner) &&\n isThreadOperationAvailable(runtime, operation)));\n const managedThreadMetadata =\n threadEndpointsEnabled && isIntelligenceRuntime(runtime);\n\n return {\n list: available(\"list\"),\n inspect: available(\"read\"),\n mutations: managedThreadMetadata,\n realtimeMetadata: managedThreadMetadata,\n };\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAS,qBACP,gBACsB;AACtB,KAAI,CAAC,eAAgB,QAAO;CAC5B,MAAM,SAAS,eAAe,WAAW;AACzC,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,oBAAoB,UAAW,QAAO;AACjD,KAAI,OAAO,MAAO,QAAO;AACzB,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,QAAO;;;;;;;;;AAUT,SAAS,kCACP,gBACA,qBACsB;AACtB,KAAI,qBAAqB,WAAW,SAAS;AAC3C,MACE,oBAAoB,YAAY,WAAW,4BAC3C,oBAAoB,YAAY,WAC9B,kCAEF,QAAO,oBAAoB,YAAY,SAAS,UAAU;AAG5D,MAAI,oBAAoB,YAAY,OAClC,QAAO;;CAIX,MAAM,sBAAsB,qBAAqB,eAAe;AAChE,KACE,wBAAwB,UACxB,qBAAqB,WAAW,WAChC,qBAAqB,MAAM,UAE3B,QAAO;AAGT,QAAO;;;;;;;;;AAiBT,eAAe,2BACb,SACiD;AACjD,KAAI,CAAC,sBAAsB,QAAQ,CACjC;AAGF,KAAI;AACF,SAAO,MAAM,QAAQ,aAAa,wBAAwB;UACnD,OAAO;AACd,MAAI,iBAAiB,wBAAwB,MAAM,cAAc,MAC/D,QAAO;GACL,QAAQ;GACR,OAAO;IACL,MAAM;IACN,SAAS;IACT,WAAW;IACZ;GACF;AAGH,SAAO;GACL,QAAQ;GACR,OAAO;IACL,MAAM;IACN,SAAS;IACT,WAAW;IACZ;GACF;;;AAIL,eAAsB,qBAAqB,EACzC,SACA,SACA,yBAAyB,MACzB,uCAAuC,SACN;AACjC,KAAI;EACF,MAAM,6BAA6B,2BAA2B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AAQ,GAC9B,EACE,eAAe,kCACb,gBACA,oBACD,EACF,GACD,EAAE;GACN,GAAI,sBAAsB,EAAE,qBAAqB,GAAG,EAAE;GACtD,mBAAmB,qBAAqB;GACzC;AAED,SAAO,IAAI,SAAS,KAAK,UAAU,YAAY,EAAE;GAC/C,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CAAC;UACK,OAAO;AACd,SAAO,IAAI,SACT,KAAK,UAAU;GACb,OAAO;GACP,SAAS,iBAAiB,QAAQ,MAAM,UAAU;GACnD,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF;;;;;;;;;;;;AAaL,SAAS,wBACP,SACA,YACyB;CACzB,MAAM,eAAe,QAAQ;AAC7B,KAAI,CAAC,cAAc,iBAAiB,MAAO,QAAO,EAAE,SAAS,OAAO;CACpE,MAAM,SACJ,OAAO,iBAAiB,WAAW,aAAa,SAAS;AAC3D,QAAO;EAAE,SAAS;EAAM,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAAG;;AAGzD,SAAS,0BACP,SACA,wBAC2B;CAI3B,MAAM,aAAa,cACjB,2BACC,sBAAsB,QAAQ,IAC5B,6BAA6B,QAAQ,OAAO,IAC3C,2BAA2B,SAAS,UAAU;CACpD,MAAM,wBACJ,0BAA0B,sBAAsB,QAAQ;AAE1D,QAAO;EACL,MAAM,UAAU,OAAO;EACvB,SAAS,UAAU,OAAO;EAC1B,WAAW;EACX,kBAAkB;EACnB"}
1
+ {"version":3,"file":"get-runtime-info.mjs","names":[],"sources":["../../../src/runtime/handlers/get-runtime-info.ts"],"sourcesContent":["import { getRuntimeLogger } from \"../core/logger\";\nimport type { AgentCapabilities } from \"@ag-ui/core\";\nimport type { CopilotKitRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime, resolveAgents } from \"../core/runtime\";\nimport type {\n AgentDescription,\n GenerativeUIRuntimeInfo,\n RuntimeInfo,\n RuntimeEntitlementResponse,\n ThreadEndpointRuntimeInfo,\n} from \"@copilotkit/shared\";\nimport type { RuntimeLicenseStatus } from \"@copilotkit/shared\";\nimport type { LicenseChecker } from \"@copilotkit/license-verifier\";\nimport { VERSION } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { isTelemetryDisabled } from \"../telemetry/telemetry-client\";\nimport { supportsLocalThreadEndpoints } from \"../runner/agent-runner\";\nimport { isThreadOperationAvailable } from \"./shared/thread-access\";\n\nfunction resolveLicenseStatus(\n licenseChecker: LicenseChecker | undefined,\n): RuntimeLicenseStatus {\n if (!licenseChecker) return \"none\";\n const status = licenseChecker.getStatus();\n if (status.warningSeverity === \"none\") return \"valid\";\n if (status.error === \"expired\") return \"expired\";\n if (status.warningSeverity === \"warning\") return \"expiring\";\n if (status.error) return \"invalid\";\n if (status.warningSeverity === \"info\") return \"none\";\n return \"unknown\";\n}\n\n/**\n * Map the structured entitlement authority onto the legacy status consumed by\n * older Core, React, and Angular thread surfaces. A ready managed entitlement\n * is authoritative in both directions. Otherwise, preserve the legacy\n * self-hosted license fallback. A retryable lookup without that fallback\n * remains unknown until it resolves.\n */\nfunction resolveCompatibilityLicenseStatus(\n licenseChecker: LicenseChecker | undefined,\n runtimeEntitlements: RuntimeEntitlementResponse | undefined,\n): RuntimeLicenseStatus {\n if (runtimeEntitlements?.status === \"ready\") {\n if (\n runtimeEntitlements.entitlement.source === \"managedOrgSubscription\" ||\n runtimeEntitlements.entitlement.source ===\n \"awsMarketplaceDeploymentLicense\"\n ) {\n return runtimeEntitlements.entitlement.active ? \"valid\" : \"none\";\n }\n\n if (runtimeEntitlements.entitlement.active) {\n return \"valid\";\n }\n }\n\n const legacyLicenseStatus = resolveLicenseStatus(licenseChecker);\n if (\n legacyLicenseStatus === \"none\" &&\n runtimeEntitlements?.status !== \"ready\" &&\n runtimeEntitlements?.error.retryable\n ) {\n return \"unknown\";\n }\n\n return legacyLicenseStatus;\n}\n\ninterface HandleGetRuntimeInfoParameters {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n threadEndpointsEnabled?: boolean;\n singleRouteResourceOperationsEnabled?: boolean;\n}\n\n/**\n * Resolve structured Runtime entitlements for configured Intelligence runtimes.\n *\n * Dependency failures are deliberately converted to a stable unavailable\n * diagnostic so `/info` remains an availability endpoint. The underlying\n * error is not exposed because it may contain upstream response details.\n */\nasync function resolveRuntimeEntitlements(\n runtime: CopilotKitRuntimeLike,\n): Promise<RuntimeEntitlementResponse | undefined> {\n if (!isIntelligenceRuntime(runtime)) {\n return undefined;\n }\n\n try {\n return await runtime.intelligence.getRuntimeEntitlements();\n } catch (error) {\n if (error instanceof PlatformRequestError && error.retryable === false) {\n return {\n status: \"misconfigured\",\n error: {\n code: \"runtime_entitlements_misconfigured\",\n message: \"Runtime entitlement lookup is misconfigured\",\n retryable: false,\n },\n };\n }\n\n return {\n status: \"unavailable\",\n error: {\n code: \"runtime_entitlements_unavailable\",\n message: \"Runtime entitlement lookup failed\",\n retryable: true,\n },\n };\n }\n}\n\nexport async function handleGetRuntimeInfo({\n runtime,\n request,\n threadEndpointsEnabled = true,\n singleRouteResourceOperationsEnabled = false,\n}: HandleGetRuntimeInfoParameters) {\n try {\n const runtimeEntitlementsPromise = resolveRuntimeEntitlements(runtime);\n const webEnabled =\n !isIntelligenceRuntime(runtime) || runtime.identifyUser !== undefined;\n const agents = webEnabled\n ? await resolveAgents(runtime.agents, request)\n : {};\n\n const agentEntries = await Promise.all(\n Object.entries(agents).map(async ([name, agent]) => {\n let capabilities: AgentCapabilities | undefined;\n try {\n capabilities = agent.getCapabilities\n ? await agent.getCapabilities()\n : undefined;\n } catch (error) {\n // Per-agent isolation: a single agent failing to report capabilities\n // must not take down the entire /info endpoint.\n getRuntimeLogger(runtime).warn(\n { err: error, agentId: name },\n `Failed to fetch capabilities for agent \"${name}\"`,\n );\n capabilities = undefined;\n }\n\n const description: AgentDescription = {\n name,\n description: agent.description,\n className: agent.constructor.name,\n ...(capabilities ? { capabilities } : {}),\n };\n\n return [name, description] as const;\n }),\n );\n\n const agentsDict: Record<string, AgentDescription> =\n Object.fromEntries(agentEntries);\n const runtimeEntitlements = await runtimeEntitlementsPromise;\n // Verified on first use, not at construction (see getLicenseChecker).\n const licenseChecker = isIntelligenceRuntime(runtime)\n ? await runtime.getLicenseChecker?.()\n : undefined;\n\n const runtimeInfo: RuntimeInfo = {\n version: VERSION,\n agents: agentsDict,\n audioFileTranscriptionEnabled:\n webEnabled && !!runtime.transcriptionService,\n mode: runtime.mode,\n threadEndpoints: resolveThreadEndpointInfo(\n runtime,\n threadEndpointsEnabled && webEnabled,\n ),\n ...(singleRouteResourceOperationsEnabled\n ? {\n singleRoute: {\n resourceOperations: true,\n threadEndpoints: resolveThreadEndpointInfo(runtime, webEnabled),\n },\n }\n : {}),\n // Advertised unconditionally. Multi-route runtimes expose the dedicated\n // POST /agent/:agentId/suggest path; single-route clients fall back to a\n // client-side run (they don't construct the single-route envelope for\n // suggest). The flag lets multi-route clients detect the stateless path.\n suggestions: webEnabled,\n ...(isIntelligenceRuntime(runtime) && webEnabled\n ? {\n intelligence: {\n wsUrl: runtime.intelligence.ɵgetClientWsUrl(),\n },\n inspectorMetadata: true,\n ...(hasLearningContainerConfiguration(runtime)\n ? { inspectorLearning: true }\n : {}),\n }\n : {}),\n openGenerativeUIEnabled: webEnabled && !!runtime.openGenerativeUI,\n generativeUI: resolveGenerativeUIInfo(runtime, webEnabled),\n ...(isIntelligenceRuntime(runtime)\n ? {\n licenseStatus: resolveCompatibilityLicenseStatus(\n licenseChecker,\n runtimeEntitlements,\n ),\n }\n : {}),\n ...(runtimeEntitlements ? { runtimeEntitlements } : {}),\n telemetryDisabled: isTelemetryDisabled(),\n };\n\n return new Response(JSON.stringify(runtimeInfo), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n return new Response(\n JSON.stringify({\n error: \"Failed to retrieve runtime information\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n\n/**\n * Report generative UI with the rules `configureAgentForRequest` uses to\n * attach the generative UI middlewares: it is on unless `generativeUI` is\n * `false`, and `{ agents }` limits it to those agents. The A2UI version of an\n * agent (`a2uiVersion`) does not change it: the client renders 1.0 for both,\n * as the runtime converts v0.9 surfaces. When the option is omitted, the\n * middlewares run only for a client that asks for them, so the client can\n * still turn generative UI on.\n */\nfunction resolveGenerativeUIInfo(\n runtime: CopilotKitRuntimeLike,\n webEnabled: boolean,\n): GenerativeUIRuntimeInfo {\n const generativeUI = runtime.generativeUI;\n if (!webEnabled || generativeUI === false) return { enabled: false };\n const agents =\n typeof generativeUI === \"object\" ? generativeUI.agents : undefined;\n return { enabled: true, ...(agents ? { agents } : {}) };\n}\n\nfunction resolveThreadEndpointInfo(\n runtime: CopilotKitRuntimeLike,\n threadEndpointsEnabled: boolean,\n): ThreadEndpointRuntimeInfo {\n // A local route is advertised only when the Thread access policy lets it\n // serve requests: without identity, list is refused by default while\n // reading a Thread by id is not.\n const available = (operation: \"list\" | \"read\") =>\n threadEndpointsEnabled &&\n (isIntelligenceRuntime(runtime) ||\n (supportsLocalThreadEndpoints(runtime.runner) &&\n isThreadOperationAvailable(runtime, operation)));\n const managedThreadMetadata =\n threadEndpointsEnabled && isIntelligenceRuntime(runtime);\n\n return {\n list: available(\"list\"),\n inspect: available(\"read\"),\n mutations: managedThreadMetadata,\n realtimeMetadata: managedThreadMetadata,\n };\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAS,qBACP,gBACsB;AACtB,KAAI,CAAC,eAAgB,QAAO;CAC5B,MAAM,SAAS,eAAe,WAAW;AACzC,KAAI,OAAO,oBAAoB,OAAQ,QAAO;AAC9C,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,oBAAoB,UAAW,QAAO;AACjD,KAAI,OAAO,MAAO,QAAO;AACzB,KAAI,OAAO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;AAaL,SAAS,wBACP,SACA,YACyB;CACzB,MAAM,eAAe,QAAQ;AAC7B,KAAI,CAAC,cAAc,iBAAiB,MAAO,QAAO,EAAE,SAAS,OAAO;CACpE,MAAM,SACJ,OAAO,iBAAiB,WAAW,aAAa,SAAS;AAC3D,QAAO;EAAE,SAAS;EAAM,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAAG;;AAGzD,SAAS,0BACP,SACA,wBAC2B;CAI3B,MAAM,aAAa,cACjB,2BACC,sBAAsB,QAAQ,IAC5B,6BAA6B,QAAQ,OAAO,IAC3C,2BAA2B,SAAS,UAAU;CACpD,MAAM,wBACJ,0BAA0B,sBAAsB,QAAQ;AAE1D,QAAO;EACL,MAAM,UAAU,OAAO;EACvB,SAAS,UAAU,OAAO;EAC1B,WAAW;EACX,kBAAkB;EACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"handle-debug-events.cjs","names":["isDebugEventFeedEnabled"],"sources":["../../../src/runtime/handlers/handle-debug-events.ts"],"sourcesContent":["import type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { isDebugEventFeedEnabled } from \"../core/debug-event-bus\";\nimport type { DebugEventEnvelope } from \"@copilotkit/shared\";\n\ninterface HandleDebugEventsParams {\n runtime: CopilotRuntimeLike;\n request: Request;\n}\n\nexport function handleDebugEvents({\n runtime,\n request,\n}: HandleDebugEventsParams): Response {\n if (!isDebugEventFeedEnabled(runtime.debug)) {\n return new Response(\"Not Found\", { status: 404 });\n }\n\n if (!runtime.debugEventBus) {\n return new Response(\"Debug event bus not available\", { status: 503 });\n }\n\n const bus = runtime.debugEventBus;\n const encoder = new TextEncoder();\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n\n // Send an SSE comment immediately to flush response headers to the client.\n // Without this, some frameworks buffer the response until actual data is written,\n // leaving the client stuck in \"connecting\" state.\n writer.write(encoder.encode(\": connected\\n\\n\")).catch(() => {});\n\n const unsubscribe = bus.subscribe((envelope: DebugEventEnvelope) => {\n if (request.signal.aborted) return;\n const line = `data: ${JSON.stringify(envelope)}\\n\\n`;\n writer.write(encoder.encode(line)).catch(() => {\n // Client disconnected, will be cleaned up by abort handler.\n });\n });\n\n request.signal.addEventListener(\"abort\", () => {\n unsubscribe();\n writer.close().catch(() => {});\n });\n\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n}\n"],"mappings":";;;AASA,SAAgB,kBAAkB,EAChC,SACA,WACoC;AACpC,KAAI,CAACA,gDAAwB,QAAQ,MAAM,CACzC,QAAO,IAAI,SAAS,aAAa,EAAE,QAAQ,KAAK,CAAC;AAGnD,KAAI,CAAC,QAAQ,cACX,QAAO,IAAI,SAAS,iCAAiC,EAAE,QAAQ,KAAK,CAAC;CAGvE,MAAM,MAAM,QAAQ;CACpB,MAAM,UAAU,IAAI,aAAa;CACjC,MAAM,SAAS,IAAI,iBAAiB;CACpC,MAAM,SAAS,OAAO,SAAS,WAAW;AAK1C,QAAO,MAAM,QAAQ,OAAO,kBAAkB,CAAC,CAAC,YAAY,GAAG;CAE/D,MAAM,cAAc,IAAI,WAAW,aAAiC;AAClE,MAAI,QAAQ,OAAO,QAAS;EAC5B,MAAM,OAAO,SAAS,KAAK,UAAU,SAAS,CAAC;AAC/C,SAAO,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,YAAY,GAE7C;GACF;AAEF,SAAQ,OAAO,iBAAiB,eAAe;AAC7C,eAAa;AACb,SAAO,OAAO,CAAC,YAAY,GAAG;GAC9B;AAEF,QAAO,IAAI,SAAS,OAAO,UAAU;EACnC,QAAQ;EACR,SAAS;GACP,gBAAgB;GAChB,iBAAiB;GACjB,YAAY;GACb;EACF,CAAC"}
1
+ {"version":3,"file":"handle-debug-events.cjs","names":["isDebugEventFeedEnabled"],"sources":["../../../src/runtime/handlers/handle-debug-events.ts"],"sourcesContent":["import type { CopilotKitRuntimeLike } from \"../core/runtime\";\nimport { isDebugEventFeedEnabled } from \"../core/debug-event-bus\";\nimport type { DebugEventEnvelope } from \"@copilotkit/shared\";\n\ninterface HandleDebugEventsParams {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n}\n\nexport function handleDebugEvents({\n runtime,\n request,\n}: HandleDebugEventsParams): Response {\n if (!isDebugEventFeedEnabled(runtime.debug)) {\n return new Response(\"Not Found\", { status: 404 });\n }\n\n if (!runtime.debugEventBus) {\n return new Response(\"Debug event bus not available\", { status: 503 });\n }\n\n const bus = runtime.debugEventBus;\n const encoder = new TextEncoder();\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n\n // Send an SSE comment immediately to flush response headers to the client.\n // Without this, some frameworks buffer the response until actual data is written,\n // leaving the client stuck in \"connecting\" state.\n writer.write(encoder.encode(\": connected\\n\\n\")).catch(() => {});\n\n const unsubscribe = bus.subscribe((envelope: DebugEventEnvelope) => {\n if (request.signal.aborted) return;\n const line = `data: ${JSON.stringify(envelope)}\\n\\n`;\n writer.write(encoder.encode(line)).catch(() => {\n // Client disconnected, will be cleaned up by abort handler.\n });\n });\n\n request.signal.addEventListener(\"abort\", () => {\n unsubscribe();\n writer.close().catch(() => {});\n });\n\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n}\n"],"mappings":";;;AASA,SAAgB,kBAAkB,EAChC,SACA,WACoC;AACpC,KAAI,CAACA,gDAAwB,QAAQ,MAAM,CACzC,QAAO,IAAI,SAAS,aAAa,EAAE,QAAQ,KAAK,CAAC;AAGnD,KAAI,CAAC,QAAQ,cACX,QAAO,IAAI,SAAS,iCAAiC,EAAE,QAAQ,KAAK,CAAC;CAGvE,MAAM,MAAM,QAAQ;CACpB,MAAM,UAAU,IAAI,aAAa;CACjC,MAAM,SAAS,IAAI,iBAAiB;CACpC,MAAM,SAAS,OAAO,SAAS,WAAW;AAK1C,QAAO,MAAM,QAAQ,OAAO,kBAAkB,CAAC,CAAC,YAAY,GAAG;CAE/D,MAAM,cAAc,IAAI,WAAW,aAAiC;AAClE,MAAI,QAAQ,OAAO,QAAS;EAC5B,MAAM,OAAO,SAAS,KAAK,UAAU,SAAS,CAAC;AAC/C,SAAO,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,YAAY,GAE7C;GACF;AAEF,SAAQ,OAAO,iBAAiB,eAAe;AAC7C,eAAa;AACb,SAAO,OAAO,CAAC,YAAY,GAAG;GAC9B;AAEF,QAAO,IAAI,SAAS,OAAO,UAAU;EACnC,QAAQ;EACR,SAAS;GACP,gBAAgB;GAChB,iBAAiB;GACjB,YAAY;GACb;EACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"handle-debug-events.mjs","names":[],"sources":["../../../src/runtime/handlers/handle-debug-events.ts"],"sourcesContent":["import type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { isDebugEventFeedEnabled } from \"../core/debug-event-bus\";\nimport type { DebugEventEnvelope } from \"@copilotkit/shared\";\n\ninterface HandleDebugEventsParams {\n runtime: CopilotRuntimeLike;\n request: Request;\n}\n\nexport function handleDebugEvents({\n runtime,\n request,\n}: HandleDebugEventsParams): Response {\n if (!isDebugEventFeedEnabled(runtime.debug)) {\n return new Response(\"Not Found\", { status: 404 });\n }\n\n if (!runtime.debugEventBus) {\n return new Response(\"Debug event bus not available\", { status: 503 });\n }\n\n const bus = runtime.debugEventBus;\n const encoder = new TextEncoder();\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n\n // Send an SSE comment immediately to flush response headers to the client.\n // Without this, some frameworks buffer the response until actual data is written,\n // leaving the client stuck in \"connecting\" state.\n writer.write(encoder.encode(\": connected\\n\\n\")).catch(() => {});\n\n const unsubscribe = bus.subscribe((envelope: DebugEventEnvelope) => {\n if (request.signal.aborted) return;\n const line = `data: ${JSON.stringify(envelope)}\\n\\n`;\n writer.write(encoder.encode(line)).catch(() => {\n // Client disconnected, will be cleaned up by abort handler.\n });\n });\n\n request.signal.addEventListener(\"abort\", () => {\n unsubscribe();\n writer.close().catch(() => {});\n });\n\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n}\n"],"mappings":";;;AASA,SAAgB,kBAAkB,EAChC,SACA,WACoC;AACpC,KAAI,CAAC,wBAAwB,QAAQ,MAAM,CACzC,QAAO,IAAI,SAAS,aAAa,EAAE,QAAQ,KAAK,CAAC;AAGnD,KAAI,CAAC,QAAQ,cACX,QAAO,IAAI,SAAS,iCAAiC,EAAE,QAAQ,KAAK,CAAC;CAGvE,MAAM,MAAM,QAAQ;CACpB,MAAM,UAAU,IAAI,aAAa;CACjC,MAAM,SAAS,IAAI,iBAAiB;CACpC,MAAM,SAAS,OAAO,SAAS,WAAW;AAK1C,QAAO,MAAM,QAAQ,OAAO,kBAAkB,CAAC,CAAC,YAAY,GAAG;CAE/D,MAAM,cAAc,IAAI,WAAW,aAAiC;AAClE,MAAI,QAAQ,OAAO,QAAS;EAC5B,MAAM,OAAO,SAAS,KAAK,UAAU,SAAS,CAAC;AAC/C,SAAO,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,YAAY,GAE7C;GACF;AAEF,SAAQ,OAAO,iBAAiB,eAAe;AAC7C,eAAa;AACb,SAAO,OAAO,CAAC,YAAY,GAAG;GAC9B;AAEF,QAAO,IAAI,SAAS,OAAO,UAAU;EACnC,QAAQ;EACR,SAAS;GACP,gBAAgB;GAChB,iBAAiB;GACjB,YAAY;GACb;EACF,CAAC"}
1
+ {"version":3,"file":"handle-debug-events.mjs","names":[],"sources":["../../../src/runtime/handlers/handle-debug-events.ts"],"sourcesContent":["import type { CopilotKitRuntimeLike } from \"../core/runtime\";\nimport { isDebugEventFeedEnabled } from \"../core/debug-event-bus\";\nimport type { DebugEventEnvelope } from \"@copilotkit/shared\";\n\ninterface HandleDebugEventsParams {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n}\n\nexport function handleDebugEvents({\n runtime,\n request,\n}: HandleDebugEventsParams): Response {\n if (!isDebugEventFeedEnabled(runtime.debug)) {\n return new Response(\"Not Found\", { status: 404 });\n }\n\n if (!runtime.debugEventBus) {\n return new Response(\"Debug event bus not available\", { status: 503 });\n }\n\n const bus = runtime.debugEventBus;\n const encoder = new TextEncoder();\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n\n // Send an SSE comment immediately to flush response headers to the client.\n // Without this, some frameworks buffer the response until actual data is written,\n // leaving the client stuck in \"connecting\" state.\n writer.write(encoder.encode(\": connected\\n\\n\")).catch(() => {});\n\n const unsubscribe = bus.subscribe((envelope: DebugEventEnvelope) => {\n if (request.signal.aborted) return;\n const line = `data: ${JSON.stringify(envelope)}\\n\\n`;\n writer.write(encoder.encode(line)).catch(() => {\n // Client disconnected, will be cleaned up by abort handler.\n });\n });\n\n request.signal.addEventListener(\"abort\", () => {\n unsubscribe();\n writer.close().catch(() => {});\n });\n\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n}\n"],"mappings":";;;AASA,SAAgB,kBAAkB,EAChC,SACA,WACoC;AACpC,KAAI,CAAC,wBAAwB,QAAQ,MAAM,CACzC,QAAO,IAAI,SAAS,aAAa,EAAE,QAAQ,KAAK,CAAC;AAGnD,KAAI,CAAC,QAAQ,cACX,QAAO,IAAI,SAAS,iCAAiC,EAAE,QAAQ,KAAK,CAAC;CAGvE,MAAM,MAAM,QAAQ;CACpB,MAAM,UAAU,IAAI,aAAa;CACjC,MAAM,SAAS,IAAI,iBAAiB;CACpC,MAAM,SAAS,OAAO,SAAS,WAAW;AAK1C,QAAO,MAAM,QAAQ,OAAO,kBAAkB,CAAC,CAAC,YAAY,GAAG;CAE/D,MAAM,cAAc,IAAI,WAAW,aAAiC;AAClE,MAAI,QAAQ,OAAO,QAAS;EAC5B,MAAM,OAAO,SAAS,KAAK,UAAU,SAAS,CAAC;AAC/C,SAAO,MAAM,QAAQ,OAAO,KAAK,CAAC,CAAC,YAAY,GAE7C;GACF;AAEF,SAAQ,OAAO,iBAAiB,eAAe;AAC7C,eAAa;AACb,SAAO,OAAO,CAAC,YAAY,GAAG;GAC9B;AAEF,QAAO,IAAI,SAAS,OAAO,UAAU;EACnC,QAAQ;EACR,SAAS;GACP,gBAAgB;GAChB,iBAAiB;GACjB,YAAY;GACb;EACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"handle-inspector-learning.cjs","names":["isIntelligenceRuntime","hasLearningContainerConfiguration","resolveIntelligenceUser","PlatformRequestError"],"sources":["../../../src/runtime/handlers/handle-inspector-learning.ts"],"sourcesContent":["import {\n parseInspectorLearningRequestV1,\n parseInspectorLearningSnapshotV1,\n} from \"@copilotkit/shared\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\n\nconst headers = {\n \"Cache-Control\": \"no-store, private\",\n \"Content-Type\": \"application/json\",\n} as const;\n\nconst errorResponse = (status: number, message: string) =>\n new Response(JSON.stringify({ error: message }), { status, headers });\n\nconst queryPage = (value: string | null): number | undefined =>\n value === null ? undefined : Number(value);\n\n/** Proxies a bounded Learning read through the runtime's server-held credential. */\nexport async function handleInspectorLearning({\n runtime,\n request,\n}: {\n readonly runtime: CopilotRuntimeLike;\n readonly request: Request;\n}): Promise<Response> {\n if (\n !isIntelligenceRuntime(runtime) ||\n !hasLearningContainerConfiguration(runtime)\n ) {\n return errorResponse(404, \"Not found\");\n }\n const user = await resolveIntelligenceUser({ runtime, request });\n if (user instanceof Response) return user;\n const url = new URL(request.url);\n if (\n [...url.searchParams.keys()].some(\n (key) => ![\"agentId\", \"skillsPage\", \"insightsPage\"].includes(key),\n )\n ) {\n return errorResponse(400, \"Invalid Inspector Learning request\");\n }\n const parsedRequest = parseInspectorLearningRequestV1({\n agentId: url.searchParams.get(\"agentId\") ?? undefined,\n skillsPage: queryPage(url.searchParams.get(\"skillsPage\")),\n insightsPage: queryPage(url.searchParams.get(\"insightsPage\")),\n });\n if (!parsedRequest)\n return errorResponse(400, \"Invalid Inspector Learning request\");\n\n try {\n const snapshot = parseInspectorLearningSnapshotV1(\n await runtime.intelligence.getInspectorLearning({\n ...parsedRequest,\n ...(typeof runtime.learning?.containerId === \"string\"\n ? { runtimeContainerId: runtime.learning.containerId }\n : {}),\n }),\n );\n if (!snapshot)\n return errorResponse(502, \"Invalid Inspector Learning response\");\n return new Response(JSON.stringify(snapshot), { status: 200, headers });\n } catch (error) {\n if (error instanceof PlatformRequestError && error.status === 404) {\n return errorResponse(404, \"Not found\");\n }\n return errorResponse(503, \"Inspector Learning is temporarily unavailable\");\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAM,UAAU;CACd,iBAAiB;CACjB,gBAAgB;CACjB;AAED,MAAM,iBAAiB,QAAgB,YACrC,IAAI,SAAS,KAAK,UAAU,EAAE,OAAO,SAAS,CAAC,EAAE;CAAE;CAAQ;CAAS,CAAC;AAEvE,MAAM,aAAa,UACjB,UAAU,OAAO,SAAY,OAAO,MAAM;;AAG5C,eAAsB,wBAAwB,EAC5C,SACA,WAIoB;AACpB,KACE,CAACA,sCAAsB,QAAQ,IAC/B,CAACC,mDAAkC,QAAQ,CAE3C,QAAO,cAAc,KAAK,YAAY;CAExC,MAAM,OAAO,MAAMC,0DAAwB;EAAE;EAAS;EAAS,CAAC;AAChE,KAAI,gBAAgB,SAAU,QAAO;CACrC,MAAM,MAAM,IAAI,IAAI,QAAQ,IAAI;AAChC,KACE,CAAC,GAAG,IAAI,aAAa,MAAM,CAAC,CAAC,MAC1B,QAAQ,CAAC;EAAC;EAAW;EAAc;EAAe,CAAC,SAAS,IAAI,CAClE,CAED,QAAO,cAAc,KAAK,qCAAqC;CAEjE,MAAM,wEAAgD;EACpD,SAAS,IAAI,aAAa,IAAI,UAAU,IAAI;EAC5C,YAAY,UAAU,IAAI,aAAa,IAAI,aAAa,CAAC;EACzD,cAAc,UAAU,IAAI,aAAa,IAAI,eAAe,CAAC;EAC9D,CAAC;AACF,KAAI,CAAC,cACH,QAAO,cAAc,KAAK,qCAAqC;AAEjE,KAAI;EACF,MAAM,oEACJ,MAAM,QAAQ,aAAa,qBAAqB;GAC9C,GAAG;GACH,GAAI,OAAO,QAAQ,UAAU,gBAAgB,WACzC,EAAE,oBAAoB,QAAQ,SAAS,aAAa,GACpD,EAAE;GACP,CAAC,CACH;AACD,MAAI,CAAC,SACH,QAAO,cAAc,KAAK,sCAAsC;AAClE,SAAO,IAAI,SAAS,KAAK,UAAU,SAAS,EAAE;GAAE,QAAQ;GAAK;GAAS,CAAC;UAChE,OAAO;AACd,MAAI,iBAAiBC,uCAAwB,MAAM,WAAW,IAC5D,QAAO,cAAc,KAAK,YAAY;AAExC,SAAO,cAAc,KAAK,gDAAgD"}
1
+ {"version":3,"file":"handle-inspector-learning.cjs","names":["isIntelligenceRuntime","hasLearningContainerConfiguration","resolveIntelligenceUser","PlatformRequestError"],"sources":["../../../src/runtime/handlers/handle-inspector-learning.ts"],"sourcesContent":["import {\n parseInspectorLearningRequestV1,\n parseInspectorLearningSnapshotV1,\n} from \"@copilotkit/shared\";\nimport type { CopilotKitRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\n\nconst headers = {\n \"Cache-Control\": \"no-store, private\",\n \"Content-Type\": \"application/json\",\n} as const;\n\nconst errorResponse = (status: number, message: string) =>\n new Response(JSON.stringify({ error: message }), { status, headers });\n\nconst queryPage = (value: string | null): number | undefined =>\n value === null ? undefined : Number(value);\n\n/** Proxies a bounded Learning read through the runtime's server-held credential. */\nexport async function handleInspectorLearning({\n runtime,\n request,\n}: {\n readonly runtime: CopilotKitRuntimeLike;\n readonly request: Request;\n}): Promise<Response> {\n if (\n !isIntelligenceRuntime(runtime) ||\n !hasLearningContainerConfiguration(runtime)\n ) {\n return errorResponse(404, \"Not found\");\n }\n const user = await resolveIntelligenceUser({ runtime, request });\n if (user instanceof Response) return user;\n const url = new URL(request.url);\n if (\n [...url.searchParams.keys()].some(\n (key) => ![\"agentId\", \"skillsPage\", \"insightsPage\"].includes(key),\n )\n ) {\n return errorResponse(400, \"Invalid Inspector Learning request\");\n }\n const parsedRequest = parseInspectorLearningRequestV1({\n agentId: url.searchParams.get(\"agentId\") ?? undefined,\n skillsPage: queryPage(url.searchParams.get(\"skillsPage\")),\n insightsPage: queryPage(url.searchParams.get(\"insightsPage\")),\n });\n if (!parsedRequest)\n return errorResponse(400, \"Invalid Inspector Learning request\");\n\n try {\n const snapshot = parseInspectorLearningSnapshotV1(\n await runtime.intelligence.getInspectorLearning({\n ...parsedRequest,\n ...(typeof runtime.learning?.containerId === \"string\"\n ? { runtimeContainerId: runtime.learning.containerId }\n : {}),\n }),\n );\n if (!snapshot)\n return errorResponse(502, \"Invalid Inspector Learning response\");\n return new Response(JSON.stringify(snapshot), { status: 200, headers });\n } catch (error) {\n if (error instanceof PlatformRequestError && error.status === 404) {\n return errorResponse(404, \"Not found\");\n }\n return errorResponse(503, \"Inspector Learning is temporarily unavailable\");\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAM,UAAU;CACd,iBAAiB;CACjB,gBAAgB;CACjB;AAED,MAAM,iBAAiB,QAAgB,YACrC,IAAI,SAAS,KAAK,UAAU,EAAE,OAAO,SAAS,CAAC,EAAE;CAAE;CAAQ;CAAS,CAAC;AAEvE,MAAM,aAAa,UACjB,UAAU,OAAO,SAAY,OAAO,MAAM;;AAG5C,eAAsB,wBAAwB,EAC5C,SACA,WAIoB;AACpB,KACE,CAACA,sCAAsB,QAAQ,IAC/B,CAACC,mDAAkC,QAAQ,CAE3C,QAAO,cAAc,KAAK,YAAY;CAExC,MAAM,OAAO,MAAMC,0DAAwB;EAAE;EAAS;EAAS,CAAC;AAChE,KAAI,gBAAgB,SAAU,QAAO;CACrC,MAAM,MAAM,IAAI,IAAI,QAAQ,IAAI;AAChC,KACE,CAAC,GAAG,IAAI,aAAa,MAAM,CAAC,CAAC,MAC1B,QAAQ,CAAC;EAAC;EAAW;EAAc;EAAe,CAAC,SAAS,IAAI,CAClE,CAED,QAAO,cAAc,KAAK,qCAAqC;CAEjE,MAAM,wEAAgD;EACpD,SAAS,IAAI,aAAa,IAAI,UAAU,IAAI;EAC5C,YAAY,UAAU,IAAI,aAAa,IAAI,aAAa,CAAC;EACzD,cAAc,UAAU,IAAI,aAAa,IAAI,eAAe,CAAC;EAC9D,CAAC;AACF,KAAI,CAAC,cACH,QAAO,cAAc,KAAK,qCAAqC;AAEjE,KAAI;EACF,MAAM,oEACJ,MAAM,QAAQ,aAAa,qBAAqB;GAC9C,GAAG;GACH,GAAI,OAAO,QAAQ,UAAU,gBAAgB,WACzC,EAAE,oBAAoB,QAAQ,SAAS,aAAa,GACpD,EAAE;GACP,CAAC,CACH;AACD,MAAI,CAAC,SACH,QAAO,cAAc,KAAK,sCAAsC;AAClE,SAAO,IAAI,SAAS,KAAK,UAAU,SAAS,EAAE;GAAE,QAAQ;GAAK;GAAS,CAAC;UAChE,OAAO;AACd,MAAI,iBAAiBC,uCAAwB,MAAM,WAAW,IAC5D,QAAO,cAAc,KAAK,YAAY;AAExC,SAAO,cAAc,KAAK,gDAAgD"}
@@ -1 +1 @@
1
- {"version":3,"file":"handle-inspector-learning.mjs","names":[],"sources":["../../../src/runtime/handlers/handle-inspector-learning.ts"],"sourcesContent":["import {\n parseInspectorLearningRequestV1,\n parseInspectorLearningSnapshotV1,\n} from \"@copilotkit/shared\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\n\nconst headers = {\n \"Cache-Control\": \"no-store, private\",\n \"Content-Type\": \"application/json\",\n} as const;\n\nconst errorResponse = (status: number, message: string) =>\n new Response(JSON.stringify({ error: message }), { status, headers });\n\nconst queryPage = (value: string | null): number | undefined =>\n value === null ? undefined : Number(value);\n\n/** Proxies a bounded Learning read through the runtime's server-held credential. */\nexport async function handleInspectorLearning({\n runtime,\n request,\n}: {\n readonly runtime: CopilotRuntimeLike;\n readonly request: Request;\n}): Promise<Response> {\n if (\n !isIntelligenceRuntime(runtime) ||\n !hasLearningContainerConfiguration(runtime)\n ) {\n return errorResponse(404, \"Not found\");\n }\n const user = await resolveIntelligenceUser({ runtime, request });\n if (user instanceof Response) return user;\n const url = new URL(request.url);\n if (\n [...url.searchParams.keys()].some(\n (key) => ![\"agentId\", \"skillsPage\", \"insightsPage\"].includes(key),\n )\n ) {\n return errorResponse(400, \"Invalid Inspector Learning request\");\n }\n const parsedRequest = parseInspectorLearningRequestV1({\n agentId: url.searchParams.get(\"agentId\") ?? undefined,\n skillsPage: queryPage(url.searchParams.get(\"skillsPage\")),\n insightsPage: queryPage(url.searchParams.get(\"insightsPage\")),\n });\n if (!parsedRequest)\n return errorResponse(400, \"Invalid Inspector Learning request\");\n\n try {\n const snapshot = parseInspectorLearningSnapshotV1(\n await runtime.intelligence.getInspectorLearning({\n ...parsedRequest,\n ...(typeof runtime.learning?.containerId === \"string\"\n ? { runtimeContainerId: runtime.learning.containerId }\n : {}),\n }),\n );\n if (!snapshot)\n return errorResponse(502, \"Invalid Inspector Learning response\");\n return new Response(JSON.stringify(snapshot), { status: 200, headers });\n } catch (error) {\n if (error instanceof PlatformRequestError && error.status === 404) {\n return errorResponse(404, \"Not found\");\n }\n return errorResponse(503, \"Inspector Learning is temporarily unavailable\");\n }\n}\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BAAwB,MAAM,WAAW,IAC5D,QAAO,cAAc,KAAK,YAAY;AAExC,SAAO,cAAc,KAAK,gDAAgD"}
1
+ {"version":3,"file":"handle-inspector-learning.mjs","names":[],"sources":["../../../src/runtime/handlers/handle-inspector-learning.ts"],"sourcesContent":["import {\n parseInspectorLearningRequestV1,\n parseInspectorLearningSnapshotV1,\n} from \"@copilotkit/shared\";\nimport type { CopilotKitRuntimeLike } from \"../core/runtime\";\nimport { hasLearningContainerConfiguration } from \"../core/learning\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\nimport { PlatformRequestError } from \"../intelligence-platform/client\";\nimport { resolveIntelligenceUser } from \"./shared/resolve-intelligence-user\";\n\nconst headers = {\n \"Cache-Control\": \"no-store, private\",\n \"Content-Type\": \"application/json\",\n} as const;\n\nconst errorResponse = (status: number, message: string) =>\n new Response(JSON.stringify({ error: message }), { status, headers });\n\nconst queryPage = (value: string | null): number | undefined =>\n value === null ? undefined : Number(value);\n\n/** Proxies a bounded Learning read through the runtime's server-held credential. */\nexport async function handleInspectorLearning({\n runtime,\n request,\n}: {\n readonly runtime: CopilotKitRuntimeLike;\n readonly request: Request;\n}): Promise<Response> {\n if (\n !isIntelligenceRuntime(runtime) ||\n !hasLearningContainerConfiguration(runtime)\n ) {\n return errorResponse(404, \"Not found\");\n }\n const user = await resolveIntelligenceUser({ runtime, request });\n if (user instanceof Response) return user;\n const url = new URL(request.url);\n if (\n [...url.searchParams.keys()].some(\n (key) => ![\"agentId\", \"skillsPage\", \"insightsPage\"].includes(key),\n )\n ) {\n return errorResponse(400, \"Invalid Inspector Learning request\");\n }\n const parsedRequest = parseInspectorLearningRequestV1({\n agentId: url.searchParams.get(\"agentId\") ?? undefined,\n skillsPage: queryPage(url.searchParams.get(\"skillsPage\")),\n insightsPage: queryPage(url.searchParams.get(\"insightsPage\")),\n });\n if (!parsedRequest)\n return errorResponse(400, \"Invalid Inspector Learning request\");\n\n try {\n const snapshot = parseInspectorLearningSnapshotV1(\n await runtime.intelligence.getInspectorLearning({\n ...parsedRequest,\n ...(typeof runtime.learning?.containerId === \"string\"\n ? { runtimeContainerId: runtime.learning.containerId }\n : {}),\n }),\n );\n if (!snapshot)\n return errorResponse(502, \"Invalid Inspector Learning response\");\n return new Response(JSON.stringify(snapshot), { status: 200, headers });\n } catch (error) {\n if (error instanceof PlatformRequestError && error.status === 404) {\n return errorResponse(404, \"Not found\");\n }\n return errorResponse(503, \"Inspector Learning is temporarily unavailable\");\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAM,UAAU;CACd,iBAAiB;CACjB,gBAAgB;CACjB;AAED,MAAM,iBAAiB,QAAgB,YACrC,IAAI,SAAS,KAAK,UAAU,EAAE,OAAO,SAAS,CAAC,EAAE;CAAE;CAAQ;CAAS,CAAC;AAEvE,MAAM,aAAa,UACjB,UAAU,OAAO,SAAY,OAAO,MAAM;;AAG5C,eAAsB,wBAAwB,EAC5C,SACA,WAIoB;AACpB,KACE,CAAC,sBAAsB,QAAQ,IAC/B,CAAC,kCAAkC,QAAQ,CAE3C,QAAO,cAAc,KAAK,YAAY;CAExC,MAAM,OAAO,MAAM,wBAAwB;EAAE;EAAS;EAAS,CAAC;AAChE,KAAI,gBAAgB,SAAU,QAAO;CACrC,MAAM,MAAM,IAAI,IAAI,QAAQ,IAAI;AAChC,KACE,CAAC,GAAG,IAAI,aAAa,MAAM,CAAC,CAAC,MAC1B,QAAQ,CAAC;EAAC;EAAW;EAAc;EAAe,CAAC,SAAS,IAAI,CAClE,CAED,QAAO,cAAc,KAAK,qCAAqC;CAEjE,MAAM,gBAAgB,gCAAgC;EACpD,SAAS,IAAI,aAAa,IAAI,UAAU,IAAI;EAC5C,YAAY,UAAU,IAAI,aAAa,IAAI,aAAa,CAAC;EACzD,cAAc,UAAU,IAAI,aAAa,IAAI,eAAe,CAAC;EAC9D,CAAC;AACF,KAAI,CAAC,cACH,QAAO,cAAc,KAAK,qCAAqC;AAEjE,KAAI;EACF,MAAM,WAAW,iCACf,MAAM,QAAQ,aAAa,qBAAqB;GAC9C,GAAG;GACH,GAAI,OAAO,QAAQ,UAAU,gBAAgB,WACzC,EAAE,oBAAoB,QAAQ,SAAS,aAAa,GACpD,EAAE;GACP,CAAC,CACH;AACD,MAAI,CAAC,SACH,QAAO,cAAc,KAAK,sCAAsC;AAClE,SAAO,IAAI,SAAS,KAAK,UAAU,SAAS,EAAE;GAAE,QAAQ;GAAK;GAAS,CAAC;UAChE,OAAO;AACd,MAAI,iBAAiB,wBAAwB,MAAM,WAAW,IAC5D,QAAO,cAAc,KAAK,YAAY;AAExC,SAAO,cAAc,KAAK,gDAAgD"}
@@ -1 +1 @@
1
- {"version":3,"file":"handle-inspector-metadata.cjs","names":["isIntelligenceRuntime"],"sources":["../../../src/runtime/handlers/handle-inspector-metadata.ts"],"sourcesContent":["import { parseInspectorMetadataV1 } from \"@copilotkit/shared\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\n\nconst PRIVATE_NO_STORE_HEADERS = {\n \"Cache-Control\": \"no-store, private\",\n} as const;\n\ninterface HandleInspectorMetadataParameters {\n runtime: CopilotRuntimeLike;\n request: Request;\n}\n\nfunction emptyInspectorMetadataResponse(): Response {\n return new Response(null, {\n status: 204,\n headers: PRIVATE_NO_STORE_HEADERS,\n });\n}\n\n/**\n * Returns trusted, sanitized Inspector metadata without exposing provider\n * failures or forwarding any browser request credentials to Intelligence.\n */\nexport async function handleInspectorMetadata({\n runtime,\n}: HandleInspectorMetadataParameters): Promise<Response> {\n if (!isIntelligenceRuntime(runtime)) {\n return emptyInspectorMetadataResponse();\n }\n\n try {\n const metadata = parseInspectorMetadataV1(\n await runtime.intelligence.getInspectorMetadata(),\n );\n if (metadata === undefined) {\n return emptyInspectorMetadataResponse();\n }\n\n return new Response(JSON.stringify(metadata), {\n status: 200,\n headers: {\n ...PRIVATE_NO_STORE_HEADERS,\n \"Content-Type\": \"application/json\",\n },\n });\n } catch {\n return emptyInspectorMetadataResponse();\n }\n}\n"],"mappings":";;;;AAIA,MAAM,2BAA2B,EAC/B,iBAAiB,qBAClB;AAOD,SAAS,iCAA2C;AAClD,QAAO,IAAI,SAAS,MAAM;EACxB,QAAQ;EACR,SAAS;EACV,CAAC;;;;;;AAOJ,eAAsB,wBAAwB,EAC5C,WACuD;AACvD,KAAI,CAACA,sCAAsB,QAAQ,CACjC,QAAO,gCAAgC;AAGzC,KAAI;EACF,MAAM,4DACJ,MAAM,QAAQ,aAAa,sBAAsB,CAClD;AACD,MAAI,aAAa,OACf,QAAO,gCAAgC;AAGzC,SAAO,IAAI,SAAS,KAAK,UAAU,SAAS,EAAE;GAC5C,QAAQ;GACR,SAAS;IACP,GAAG;IACH,gBAAgB;IACjB;GACF,CAAC;SACI;AACN,SAAO,gCAAgC"}
1
+ {"version":3,"file":"handle-inspector-metadata.cjs","names":["isIntelligenceRuntime"],"sources":["../../../src/runtime/handlers/handle-inspector-metadata.ts"],"sourcesContent":["import { parseInspectorMetadataV1 } from \"@copilotkit/shared\";\nimport type { CopilotKitRuntimeLike } from \"../core/runtime\";\nimport { isIntelligenceRuntime } from \"../core/runtime\";\n\nconst PRIVATE_NO_STORE_HEADERS = {\n \"Cache-Control\": \"no-store, private\",\n} as const;\n\ninterface HandleInspectorMetadataParameters {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n}\n\nfunction emptyInspectorMetadataResponse(): Response {\n return new Response(null, {\n status: 204,\n headers: PRIVATE_NO_STORE_HEADERS,\n });\n}\n\n/**\n * Returns trusted, sanitized Inspector metadata without exposing provider\n * failures or forwarding any browser request credentials to Intelligence.\n */\nexport async function handleInspectorMetadata({\n runtime,\n}: HandleInspectorMetadataParameters): Promise<Response> {\n if (!isIntelligenceRuntime(runtime)) {\n return emptyInspectorMetadataResponse();\n }\n\n try {\n const metadata = parseInspectorMetadataV1(\n await runtime.intelligence.getInspectorMetadata(),\n );\n if (metadata === undefined) {\n return emptyInspectorMetadataResponse();\n }\n\n return new Response(JSON.stringify(metadata), {\n status: 200,\n headers: {\n ...PRIVATE_NO_STORE_HEADERS,\n \"Content-Type\": \"application/json\",\n },\n });\n } catch {\n return emptyInspectorMetadataResponse();\n }\n}\n"],"mappings":";;;;AAIA,MAAM,2BAA2B,EAC/B,iBAAiB,qBAClB;AAOD,SAAS,iCAA2C;AAClD,QAAO,IAAI,SAAS,MAAM;EACxB,QAAQ;EACR,SAAS;EACV,CAAC;;;;;;AAOJ,eAAsB,wBAAwB,EAC5C,WACuD;AACvD,KAAI,CAACA,sCAAsB,QAAQ,CACjC,QAAO,gCAAgC;AAGzC,KAAI;EACF,MAAM,4DACJ,MAAM,QAAQ,aAAa,sBAAsB,CAClD;AACD,MAAI,aAAa,OACf,QAAO,gCAAgC;AAGzC,SAAO,IAAI,SAAS,KAAK,UAAU,SAAS,EAAE;GAC5C,QAAQ;GACR,SAAS;IACP,GAAG;IACH,gBAAgB;IACjB;GACF,CAAC;SACI;AACN,SAAO,gCAAgC"}