@copilotkit/shared 2.0.0-rc.2 → 2.0.0-rc.20

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 (272) hide show
  1. package/README.md +3 -14
  2. package/dist/a2ui-envelope.cjs +2 -2
  3. package/dist/a2ui-envelope.cjs.map +1 -1
  4. package/dist/a2ui-envelope.d.cts +1 -1
  5. package/dist/a2ui-envelope.d.cts.map +1 -1
  6. package/dist/a2ui-envelope.d.mts +1 -1
  7. package/dist/a2ui-envelope.d.mts.map +1 -1
  8. package/dist/a2ui-envelope.mjs +2 -2
  9. package/dist/a2ui-envelope.mjs.map +1 -1
  10. package/dist/a2ui-prompts.cjs +21 -62
  11. package/dist/a2ui-prompts.cjs.map +1 -1
  12. package/dist/a2ui-prompts.d.cts +8 -1
  13. package/dist/a2ui-prompts.d.cts.map +1 -1
  14. package/dist/a2ui-prompts.d.mts +8 -1
  15. package/dist/a2ui-prompts.d.mts.map +1 -1
  16. package/dist/a2ui-prompts.mjs +22 -62
  17. package/dist/a2ui-prompts.mjs.map +1 -1
  18. package/dist/finalize-events.cjs +16 -0
  19. package/dist/finalize-events.cjs.map +1 -1
  20. package/dist/finalize-events.d.cts.map +1 -1
  21. package/dist/finalize-events.d.mts.map +1 -1
  22. package/dist/finalize-events.mjs +16 -0
  23. package/dist/finalize-events.mjs.map +1 -1
  24. package/dist/generative-ui/basic-functions.cjs +1 -1
  25. package/dist/generative-ui/basic-functions.cjs.map +1 -1
  26. package/dist/generative-ui/basic-functions.mjs +1 -1
  27. package/dist/generative-ui/basic-functions.mjs.map +1 -1
  28. package/dist/generative-ui/child-refs.cjs +3 -3
  29. package/dist/generative-ui/child-refs.cjs.map +1 -1
  30. package/dist/generative-ui/child-refs.d.cts.map +1 -1
  31. package/dist/generative-ui/child-refs.d.mts.map +1 -1
  32. package/dist/generative-ui/child-refs.mjs +3 -3
  33. package/dist/generative-ui/child-refs.mjs.map +1 -1
  34. package/dist/generative-ui/compact-schema.cjs +187 -0
  35. package/dist/generative-ui/compact-schema.cjs.map +1 -0
  36. package/dist/generative-ui/compact-schema.d.cts +55 -0
  37. package/dist/generative-ui/compact-schema.d.cts.map +1 -0
  38. package/dist/generative-ui/compact-schema.d.mts +55 -0
  39. package/dist/generative-ui/compact-schema.d.mts.map +1 -0
  40. package/dist/generative-ui/compact-schema.mjs +185 -0
  41. package/dist/generative-ui/compact-schema.mjs.map +1 -0
  42. package/dist/generative-ui/prompt-spec.cjs +225 -0
  43. package/dist/generative-ui/prompt-spec.cjs.map +1 -0
  44. package/dist/generative-ui/prompt-spec.d.cts +94 -0
  45. package/dist/generative-ui/prompt-spec.d.cts.map +1 -0
  46. package/dist/generative-ui/prompt-spec.d.mts +94 -0
  47. package/dist/generative-ui/prompt-spec.d.mts.map +1 -0
  48. package/dist/generative-ui/prompt-spec.mjs +220 -0
  49. package/dist/generative-ui/prompt-spec.mjs.map +1 -0
  50. package/dist/generative-ui/prompt.cjs +10 -36
  51. package/dist/generative-ui/prompt.cjs.map +1 -1
  52. package/dist/generative-ui/prompt.d.cts +2 -1
  53. package/dist/generative-ui/prompt.d.cts.map +1 -1
  54. package/dist/generative-ui/prompt.d.mts +2 -1
  55. package/dist/generative-ui/prompt.d.mts.map +1 -1
  56. package/dist/generative-ui/prompt.mjs +12 -38
  57. package/dist/generative-ui/prompt.mjs.map +1 -1
  58. package/dist/generative-ui/render-ui-args.cjs +1 -0
  59. package/dist/generative-ui/render-ui-args.cjs.map +1 -1
  60. package/dist/generative-ui/render-ui-args.d.cts.map +1 -1
  61. package/dist/generative-ui/render-ui-args.d.mts.map +1 -1
  62. package/dist/generative-ui/render-ui-args.mjs +1 -0
  63. package/dist/generative-ui/render-ui-args.mjs.map +1 -1
  64. package/dist/generative-ui/schema-render.cjs +242 -0
  65. package/dist/generative-ui/schema-render.cjs.map +1 -0
  66. package/dist/generative-ui/schema-render.d.cts +44 -0
  67. package/dist/generative-ui/schema-render.d.cts.map +1 -0
  68. package/dist/generative-ui/schema-render.d.mts +44 -0
  69. package/dist/generative-ui/schema-render.d.mts.map +1 -0
  70. package/dist/generative-ui/schema-render.mjs +239 -0
  71. package/dist/generative-ui/schema-render.mjs.map +1 -0
  72. package/dist/generative-ui/types.cjs +2 -2
  73. package/dist/generative-ui/types.cjs.map +1 -1
  74. package/dist/generative-ui/types.d.cts +7 -7
  75. package/dist/generative-ui/types.d.cts.map +1 -1
  76. package/dist/generative-ui/types.d.mts +7 -7
  77. package/dist/generative-ui/types.d.mts.map +1 -1
  78. package/dist/generative-ui/types.mjs +2 -2
  79. package/dist/generative-ui/types.mjs.map +1 -1
  80. package/dist/generative-ui/validate-operation.cjs +2 -2
  81. package/dist/generative-ui/validate-operation.cjs.map +1 -1
  82. package/dist/generative-ui/validate-operation.mjs +2 -2
  83. package/dist/generative-ui/validate-operation.mjs.map +1 -1
  84. package/dist/index.cjs +17 -15
  85. package/dist/index.cjs.map +1 -1
  86. package/dist/index.d.cts +10 -9
  87. package/dist/index.d.cts.map +1 -1
  88. package/dist/index.d.mts +10 -9
  89. package/dist/index.d.mts.map +1 -1
  90. package/dist/index.mjs +9 -7
  91. package/dist/index.mjs.map +1 -1
  92. package/dist/index.umd.js +839 -447
  93. package/dist/index.umd.js.map +1 -1
  94. package/dist/package.cjs +1 -1
  95. package/dist/package.mjs +1 -1
  96. package/dist/standard-schema.cjs +20 -7
  97. package/dist/standard-schema.cjs.map +1 -1
  98. package/dist/standard-schema.d.cts +15 -16
  99. package/dist/standard-schema.d.cts.map +1 -1
  100. package/dist/standard-schema.d.mts +15 -16
  101. package/dist/standard-schema.d.mts.map +1 -1
  102. package/dist/standard-schema.mjs +20 -8
  103. package/dist/standard-schema.mjs.map +1 -1
  104. package/dist/telemetry/lambda-client.cjs +1 -1
  105. package/dist/telemetry/lambda-client.cjs.map +1 -1
  106. package/dist/telemetry/lambda-client.d.cts.map +1 -1
  107. package/dist/telemetry/lambda-client.d.mts.map +1 -1
  108. package/dist/telemetry/lambda-client.mjs +1 -1
  109. package/dist/telemetry/lambda-client.mjs.map +1 -1
  110. package/dist/telemetry/telemetry-disabled.cjs +3 -6
  111. package/dist/telemetry/telemetry-disabled.cjs.map +1 -1
  112. package/dist/telemetry/telemetry-disabled.d.cts +0 -5
  113. package/dist/telemetry/telemetry-disabled.d.cts.map +1 -1
  114. package/dist/telemetry/telemetry-disabled.d.mts +0 -5
  115. package/dist/telemetry/telemetry-disabled.d.mts.map +1 -1
  116. package/dist/telemetry/telemetry-disabled.mjs +4 -6
  117. package/dist/telemetry/telemetry-disabled.mjs.map +1 -1
  118. package/dist/types/message.d.cts +1 -18
  119. package/dist/types/message.d.cts.map +1 -1
  120. package/dist/types/message.d.mts +1 -18
  121. package/dist/types/message.d.mts.map +1 -1
  122. package/dist/utils/errors.cjs +5 -42
  123. package/dist/utils/errors.cjs.map +1 -1
  124. package/dist/utils/errors.d.cts +16 -34
  125. package/dist/utils/errors.d.cts.map +1 -1
  126. package/dist/utils/errors.d.mts +16 -34
  127. package/dist/utils/errors.d.mts.map +1 -1
  128. package/dist/utils/errors.mjs +6 -41
  129. package/dist/utils/errors.mjs.map +1 -1
  130. package/dist/utils/index.cjs +1 -2
  131. package/dist/utils/index.cjs.map +1 -1
  132. package/dist/utils/index.d.cts +4 -5
  133. package/dist/utils/index.d.cts.map +1 -1
  134. package/dist/utils/index.d.mts +4 -5
  135. package/dist/utils/index.d.mts.map +1 -1
  136. package/dist/utils/index.mjs +4 -5
  137. package/dist/utils/index.mjs.map +1 -1
  138. package/dist/utils/json-schema.cjs +4 -79
  139. package/dist/utils/json-schema.cjs.map +1 -1
  140. package/dist/utils/json-schema.d.cts +1 -4
  141. package/dist/utils/json-schema.d.cts.map +1 -1
  142. package/dist/utils/json-schema.d.mts +1 -4
  143. package/dist/utils/json-schema.d.mts.map +1 -1
  144. package/dist/utils/json-schema.mjs +5 -78
  145. package/dist/utils/json-schema.mjs.map +1 -1
  146. package/dist/utils/process-env.cjs +14 -0
  147. package/dist/utils/process-env.cjs.map +1 -0
  148. package/dist/utils/process-env.d.cts +10 -0
  149. package/dist/utils/process-env.d.cts.map +1 -0
  150. package/dist/utils/process-env.d.mts +10 -0
  151. package/dist/utils/process-env.d.mts.map +1 -0
  152. package/dist/utils/process-env.mjs +13 -0
  153. package/dist/utils/process-env.mjs.map +1 -0
  154. package/dist/utils/random-id.cjs +13 -26
  155. package/dist/utils/random-id.cjs.map +1 -1
  156. package/dist/utils/random-id.d.cts +6 -3
  157. package/dist/utils/random-id.d.cts.map +1 -1
  158. package/dist/utils/random-id.d.mts +6 -3
  159. package/dist/utils/random-id.d.mts.map +1 -1
  160. package/dist/utils/random-id.mjs +14 -25
  161. package/dist/utils/random-id.mjs.map +1 -1
  162. package/package.json +8 -32
  163. package/scripts/verify-cjs-exports.cjs +1 -1
  164. package/src/__tests__/a2ui-envelope.test.ts +18 -13
  165. package/src/__tests__/a2ui-prompts.test.ts +47 -14
  166. package/src/__tests__/fixtures/prompt-goldens.json +354 -0
  167. package/src/__tests__/prompt-spec.test.ts +191 -0
  168. package/src/__tests__/root-entry-browser-safety.test.ts +5 -7
  169. package/src/__tests__/schema-render.test.ts +245 -0
  170. package/src/__tests__/standard-schema.test.ts +61 -101
  171. package/src/a2ui-envelope.ts +7 -6
  172. package/src/a2ui-prompts.ts +47 -96
  173. package/src/finalize-events.ts +16 -0
  174. package/src/generative-ui/__tests__/render-ui-args.test.ts +7 -7
  175. package/src/generative-ui/__tests__/validate-operation.test.ts +19 -13
  176. package/src/generative-ui/basic-functions.ts +1 -1
  177. package/src/generative-ui/child-refs.ts +5 -4
  178. package/src/generative-ui/compact-schema.ts +277 -0
  179. package/src/generative-ui/index.ts +3 -0
  180. package/src/generative-ui/prompt-spec.ts +335 -0
  181. package/src/generative-ui/prompt.ts +25 -75
  182. package/src/generative-ui/render-ui-args.ts +3 -0
  183. package/src/generative-ui/schema-render.ts +377 -0
  184. package/src/generative-ui/types.ts +10 -7
  185. package/src/generative-ui/validate-operation.ts +2 -2
  186. package/src/index.ts +3 -16
  187. package/src/standard-schema.ts +24 -27
  188. package/src/telemetry/lambda-client.ts +8 -3
  189. package/src/telemetry/model-host.test.ts +2 -5
  190. package/src/telemetry/telemetry-disabled.ts +7 -12
  191. package/src/types/message.ts +1 -19
  192. package/src/utils/__tests__/errors.test.ts +44 -0
  193. package/src/utils/__tests__/json-schema.test.ts +3 -479
  194. package/src/utils/__tests__/process-env.test.ts +22 -0
  195. package/src/utils/__tests__/random-id.test.ts +37 -0
  196. package/src/utils/errors.ts +28 -85
  197. package/src/utils/index.ts +1 -2
  198. package/src/utils/json-schema.ts +5 -152
  199. package/src/utils/process-env.ts +14 -0
  200. package/src/utils/random-id.ts +17 -37
  201. package/tsconfig.json +3 -1
  202. package/tsdown.config.ts +2 -19
  203. package/dist/event-transforms/index.cjs +0 -15
  204. package/dist/event-transforms/index.d.cts +0 -4
  205. package/dist/event-transforms/index.d.mts +0 -4
  206. package/dist/event-transforms/index.mjs +0 -5
  207. package/dist/event-transforms/open-generative-ui-middleware.cjs +0 -286
  208. package/dist/event-transforms/open-generative-ui-middleware.cjs.map +0 -1
  209. package/dist/event-transforms/open-generative-ui-middleware.d.cts +0 -60
  210. package/dist/event-transforms/open-generative-ui-middleware.d.cts.map +0 -1
  211. package/dist/event-transforms/open-generative-ui-middleware.d.mts +0 -60
  212. package/dist/event-transforms/open-generative-ui-middleware.d.mts.map +0 -1
  213. package/dist/event-transforms/open-generative-ui-middleware.mjs +0 -283
  214. package/dist/event-transforms/open-generative-ui-middleware.mjs.map +0 -1
  215. package/dist/event-transforms/recorded-events.cjs +0 -59
  216. package/dist/event-transforms/recorded-events.cjs.map +0 -1
  217. package/dist/event-transforms/recorded-events.d.cts +0 -23
  218. package/dist/event-transforms/recorded-events.d.cts.map +0 -1
  219. package/dist/event-transforms/recorded-events.d.mts +0 -23
  220. package/dist/event-transforms/recorded-events.d.mts.map +0 -1
  221. package/dist/event-transforms/recorded-events.mjs +0 -58
  222. package/dist/event-transforms/recorded-events.mjs.map +0 -1
  223. package/dist/telemetry/events.d.cts +0 -72
  224. package/dist/telemetry/events.d.cts.map +0 -1
  225. package/dist/telemetry/events.d.mts +0 -72
  226. package/dist/telemetry/events.d.mts.map +0 -1
  227. package/dist/telemetry/index.cjs +0 -18
  228. package/dist/telemetry/index.d.cts +0 -5
  229. package/dist/telemetry/index.d.mts +0 -5
  230. package/dist/telemetry/index.mjs +0 -6
  231. package/dist/telemetry/telemetry-client.cjs +0 -165
  232. package/dist/telemetry/telemetry-client.cjs.map +0 -1
  233. package/dist/telemetry/telemetry-client.d.cts +0 -87
  234. package/dist/telemetry/telemetry-client.d.cts.map +0 -1
  235. package/dist/telemetry/telemetry-client.d.mts +0 -87
  236. package/dist/telemetry/telemetry-client.d.mts.map +0 -1
  237. package/dist/telemetry/telemetry-client.mjs +0 -164
  238. package/dist/telemetry/telemetry-client.mjs.map +0 -1
  239. package/dist/telemetry/utils.cjs +0 -14
  240. package/dist/telemetry/utils.cjs.map +0 -1
  241. package/dist/telemetry/utils.mjs +0 -13
  242. package/dist/telemetry/utils.mjs.map +0 -1
  243. package/dist/utils/conditions.cjs +0 -32
  244. package/dist/utils/conditions.cjs.map +0 -1
  245. package/dist/utils/conditions.d.cts +0 -31
  246. package/dist/utils/conditions.d.cts.map +0 -1
  247. package/dist/utils/conditions.d.mts +0 -31
  248. package/dist/utils/conditions.d.mts.map +0 -1
  249. package/dist/utils/conditions.mjs +0 -31
  250. package/dist/utils/conditions.mjs.map +0 -1
  251. package/dist/utils/console-styling.cjs +0 -91
  252. package/dist/utils/console-styling.cjs.map +0 -1
  253. package/dist/utils/console-styling.d.cts +0 -65
  254. package/dist/utils/console-styling.d.cts.map +0 -1
  255. package/dist/utils/console-styling.d.mts +0 -65
  256. package/dist/utils/console-styling.d.mts.map +0 -1
  257. package/dist/utils/console-styling.mjs +0 -85
  258. package/dist/utils/console-styling.mjs.map +0 -1
  259. package/src/__tests__/zod-regression.test.ts +0 -319
  260. package/src/event-transforms/index.ts +0 -5
  261. package/src/event-transforms/open-generative-ui-middleware.ts +0 -392
  262. package/src/event-transforms/recorded-events.test.ts +0 -166
  263. package/src/event-transforms/recorded-events.ts +0 -74
  264. package/src/telemetry/events.ts +0 -68
  265. package/src/telemetry/index.ts +0 -9
  266. package/src/telemetry/telemetry-blank-license-identity.test.ts +0 -128
  267. package/src/telemetry/telemetry-client.test.ts +0 -798
  268. package/src/telemetry/telemetry-client.ts +0 -328
  269. package/src/telemetry/utils.ts +0 -15
  270. package/src/utils/__tests__/conditions.test.ts +0 -161
  271. package/src/utils/conditions.ts +0 -116
  272. package/src/utils/console-styling.ts +0 -126
@@ -1 +1 @@
1
- {"version":3,"file":"validate-operation.mjs","names":[],"sources":["../../src/generative-ui/validate-operation.ts"],"sourcesContent":["import {\n GENERATIVE_UI_FUNCTIONS,\n functionCallers,\n isA2UIBasicFunction,\n isA2UIValueFunction,\n isCallBinding,\n} from \"./basic-functions\";\nimport type { A2UIFunctionPermissions } from \"./basic-functions\";\nimport { collectChildRefs } from \"./child-refs\";\nimport type { ChildRef } from \"./child-refs\";\nimport {\n A2UI_VERSION,\n GENERATIVE_UI_AGENT_FUNCTION_CALLS,\n GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON,\n} from \"./types\";\nimport type {\n GenerativeUIActionBinding,\n GenerativeUIJSONSchema,\n GenerativeUIManifest,\n} from \"./types\";\nimport { isRecord } from \"./is-record\";\n\nexport type OperationValidation = { ok: true } | { ok: false; reason: string };\n\nconst OPERATION_KINDS = [\n \"createSurface\",\n \"updateComponents\",\n \"updateDataModel\",\n \"deleteSurface\",\n \"callRendererFunction\",\n] as const;\nexport type OperationKind = (typeof OPERATION_KINDS)[number];\n\nexport interface ValidateOperationOptions {\n manifest: Pick<\n GenerativeUIManifest,\n \"catalogId\" | \"catalogIds\" | \"components\"\n >;\n /**\n * Surfaces that exist before this operation is applied. `updateComponents`,\n * `updateDataModel`, and `deleteSurface` need their surface in this set.\n */\n knownSurfaces: ReadonlySet<string>;\n /**\n * Surface ids that were created before, also the deleted ones. A surface id\n * is unique for the life of the page, so `createSurface` rejects them.\n */\n createdSurfaces?: ReadonlySet<string>;\n /**\n * UI-callable functions. When provided, `functionCall` bindings and\n * `callRendererFunction` must name one of them. The client omits it:\n * availability is checked when the function runs.\n */\n functions?: GenerativeUIManifest[\"functions\"];\n /**\n * The components that the target of the surface takes. When provided,\n * `updateComponents` and the inline components of `createSurface` can use\n * only these names. Left out, every catalog component is allowed.\n */\n allowedComponents?: AllowedComponents;\n}\n\n/** The component names that one target takes. */\nexport interface AllowedComponents {\n /** The target id, for the reason of a rejection. */\n target: string;\n names: ReadonlySet<string>;\n}\n\nconst OK: OperationValidation = { ok: true };\nconst fail = (reason: string): OperationValidation => ({ ok: false, reason });\n\n/** Models write the v0.9 binding from habit. The reason names the v1.0 form. */\nconst V09_PATH_REASON = 'bind data with {\"@path\": \"/x\"}, not {\"path\": \"/x\"}';\n\nfunction hasOwn(record: object, key: string) {\n return Object.prototype.hasOwnProperty.call(record, key);\n}\n\n/**\n * Reads an own property only. Model-controlled keys such as \"constructor\" or\n * \"toString\" must not resolve to Object.prototype members.\n */\nfunction ownValue<T>(record: Record<string, T> | undefined, key: string) {\n return record && hasOwn(record, key) ? record[key] : undefined;\n}\n\nexport function getOperationKind(op: unknown) {\n if (!isRecord(op)) return undefined;\n const kinds = OPERATION_KINDS.filter((kind) => kind in op);\n return kinds.length === 1 ? kinds[0] : undefined;\n}\n\n/** The `surfaceId` of a surface operation. `callRendererFunction` has none. */\nexport function getOperationSurfaceId(op: unknown) {\n if (!isRecord(op)) return undefined;\n const kind = getOperationKind(op);\n if (!kind) return undefined;\n const payload = op[kind];\n return isRecord(payload) && typeof payload.surfaceId === \"string\"\n ? payload.surfaceId\n : undefined;\n}\n\n/** `{ \"@path\": \"/x\" }`: a data-model binding. */\nexport function isPathBinding(value: unknown): value is { \"@path\": string } {\n return (\n isRecord(value) &&\n typeof value[\"@path\"] === \"string\" &&\n Object.keys(value).length === 1\n );\n}\n\n/** `{ \"path\": \"/x\" }`: the v0.9 binding, which v1.0 does not accept. */\nfunction isV09PathBinding(value: unknown) {\n return (\n isRecord(value) &&\n typeof value.path === \"string\" &&\n Object.keys(value).length === 1\n );\n}\n\n/**\n * `{ \"@call\": \"@index\" }` or `{ \"@call\": \"@index\", \"args\": { \"offset\": 1 } }`:\n * the 0-based position of the item in a template, plus `offset`.\n */\nexport function isIndexCall(\n value: unknown,\n): value is { \"@call\": \"@index\"; args?: { offset?: number } } {\n if (!isRecord(value) || value[\"@call\"] !== \"@index\") return false;\n const hasOnlyCallKeys = Object.keys(value).every(\n (key) => key === \"@call\" || key === \"args\",\n );\n if (!hasOnlyCallKeys) return false;\n const { args } = value;\n if (args === undefined) return true;\n return (\n isRecord(args) &&\n Object.keys(args).every((key) => key === \"offset\") &&\n (args.offset === undefined || Number.isFinite(args.offset))\n );\n}\n\nexport function isActionBinding(\n value: unknown,\n): value is GenerativeUIActionBinding {\n return (\n isRecord(value) &&\n Object.keys(value).length === 1 &&\n (isRecord(value.functionCall) || isRecord(value.event))\n );\n}\n\n/**\n * Checks one A2UI v1.0 operation against the catalog and the surfaces that\n * exist. The operation comes from the model, so nothing in it is trusted.\n *\n * @param op - The operation, as parsed from JSON.\n * @param options - The catalog, the known and created surfaces, the\n * functions that the UI can call, and the components that the target of\n * the surface takes.\n *\n * @example\n * ```ts\n * const result = validateOperation(op, { manifest, knownSurfaces });\n * if (!result.ok) rejected.push({ index, reason: result.reason });\n * ```\n */\nexport function validateOperation(\n op: unknown,\n options: ValidateOperationOptions,\n) {\n if (!isRecord(op)) return fail(\"operation must be a JSON object\");\n if (op.version !== A2UI_VERSION) return fail(versionProblem(op.version));\n const kind = getOperationKind(op);\n if (!kind) {\n return fail(\n `operation must contain exactly one of ${OPERATION_KINDS.join(\", \")}`,\n );\n }\n const payload = op[kind];\n if (kind === \"callRendererFunction\") {\n if (!GENERATIVE_UI_AGENT_FUNCTION_CALLS) {\n return fail(GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON);\n }\n return validateRendererFunctionCall(payload, options);\n }\n if (\n !isRecord(payload) ||\n typeof payload.surfaceId !== \"string\" ||\n !payload.surfaceId\n ) {\n return fail(`${kind}.surfaceId is required`);\n }\n const surfaceId = payload.surfaceId;\n if (kind === \"createSurface\") {\n return validateCreateSurface(payload, surfaceId, options);\n }\n if (!options.knownSurfaces.has(surfaceId)) {\n return fail(\n `surface \"${surfaceId}\" does not exist; send createSurface first`,\n );\n }\n switch (kind) {\n case \"deleteSurface\":\n return OK;\n case \"updateDataModel\":\n return validateDataModelUpdate(payload);\n case \"updateComponents\":\n return validateComponents(\n payload.components,\n \"updateComponents.components\",\n options,\n );\n }\n}\n\nfunction versionProblem(version: unknown) {\n return typeof version === \"string\"\n ? `unsupported version \"${version}\"; use \"${A2UI_VERSION}\"`\n : `operation needs \"version\":\"${A2UI_VERSION}\"`;\n}\n\n/** A `catalogId` can name the catalog of the run or one of its bases. */\nfunction catalogProblem(\n catalogId: unknown,\n manifest: ValidateOperationOptions[\"manifest\"],\n) {\n const ids = manifest.catalogIds ?? [manifest.catalogId];\n if (catalogId === undefined || ids.includes(catalogId as string)) {\n return undefined;\n }\n const names = ids.map((id) => `\"${id}\"`).join(\", \");\n const use = ids.length === 1 ? names : `one of: ${names}`;\n return `unknown catalog \"${String(catalogId)}\"; leave out catalogId or use ${use}`;\n}\n\nfunction validateCreateSurface(\n payload: Record<string, unknown>,\n surfaceId: string,\n options: ValidateOperationOptions,\n) {\n if (options.knownSurfaces.has(surfaceId)) {\n return fail(`surface \"${surfaceId}\" already exists`);\n }\n if (options.createdSurfaces?.has(surfaceId)) {\n return fail(\n `surface id \"${surfaceId}\" was used before; use a new surfaceId`,\n );\n }\n const catalogReason = catalogProblem(payload.catalogId, options.manifest);\n if (catalogReason) return fail(catalogReason);\n const { dataModel, components } = payload;\n if (dataModel !== undefined && !isRecord(dataModel)) {\n return fail(\"createSurface.dataModel must be a JSON object\");\n }\n if (components === undefined) return OK;\n return validateComponents(components, \"createSurface.components\", options);\n}\n\nfunction validateRendererFunctionCall(\n payload: unknown,\n options: ValidateOperationOptions,\n) {\n const hasCallId =\n isRecord(payload) &&\n typeof payload.functionCallId === \"string\" &&\n payload.functionCallId !== \"\";\n if (!hasCallId) {\n return fail(\n \"callRendererFunction.functionCallId must be a non-empty string\",\n );\n }\n const reason = functionCallProblem(\n payload.callFunction,\n \"callRendererFunction.callFunction\",\n options,\n );\n return reason ? fail(reason) : OK;\n}\n\nconst FORBIDDEN_SEGMENTS = new Set([\"__proto__\", \"constructor\", \"prototype\"]);\n\nfunction decodeSegment(segment: string) {\n return segment.replace(/~([01])/g, (_, g) => (g === \"1\" ? \"/\" : \"~\"));\n}\n\nfunction validateDataModelUpdate(payload: Record<string, unknown>) {\n if (payload.value === undefined) {\n return fail(\n 'updateDataModel.value is required; use \"value\":null to delete',\n );\n }\n const path = payload.path ?? \"/\";\n if (typeof path !== \"string\" || !path.startsWith(\"/\")) {\n return fail(\"updateDataModel.path must be an absolute JSON pointer\");\n }\n if (path === \"/\") {\n // Paths such as \"/items\" point into the root, so the root must be an object.\n if (!isRecord(payload.value)) {\n return fail(\"a root updateDataModel value must be a JSON object\");\n }\n return OK;\n }\n const reason = pathProblem(path, \"updateDataModel.path\");\n return reason ? fail(reason) : OK;\n}\n\n/**\n * Checks the segments of an absolute JSON pointer (\"/a/b\") or of a path\n * relative to a template item (\"a/b\"). `label` names the field in the reason.\n */\nfunction pathProblem(path: string, label: string) {\n const relative = path.startsWith(\"/\") ? path.slice(1) : path;\n const segments = relative.split(\"/\");\n if (segments.some((segment) => segment === \"\")) {\n return `${label} must not contain empty segments`;\n }\n const decoded = segments.map(decodeSegment);\n const forbidden = decoded.find((segment) => FORBIDDEN_SEGMENTS.has(segment));\n if (forbidden !== undefined) {\n return `path segment \"${forbidden}\" is not allowed in ${label}`;\n }\n return undefined;\n}\n\nfunction validateComponents(\n components: unknown,\n label: string,\n options: ValidateOperationOptions,\n) {\n if (!Array.isArray(components) || components.length === 0) {\n return fail(`${label} must be a non-empty array`);\n }\n const ids = new Set<string>();\n for (const node of components) {\n if (!isRecord(node)) return fail(\"component must be a JSON object\");\n const { id } = node;\n if (typeof id !== \"string\" || !id) return fail(\"id is required\");\n const reason = nodeProblem(node, id, options);\n if (reason) return fail(`component \"${id}\": ${reason}`);\n if (ids.has(id)) {\n return fail(`component \"${id}\" appears twice in one update`);\n }\n ids.add(id);\n }\n return OK;\n}\n\nfunction nodeProblem(\n node: Record<string, unknown>,\n id: string,\n options: ValidateOperationOptions,\n) {\n if (typeof node.component !== \"string\") return \"component type is required\";\n const entry = ownValue(options.manifest.components, node.component);\n if (!entry) return `unknown component \"${node.component}\"`;\n const { allowedComponents } = options;\n if (allowedComponents && !allowedComponents.names.has(node.component)) {\n const names = [...allowedComponents.names].join(\", \") || \"none\";\n return `\"${node.component}\" is not allowed in target \"${allowedComponents.target}\"; use one of: ${names}`;\n }\n const { properties, required } = entry.props;\n const propNames = isRecord(properties) ? Object.keys(properties) : [];\n const props = Object.entries(node);\n for (const [key, value] of props) {\n if (key === \"id\" || key === \"component\") continue;\n if (key === \"catalogId\") {\n const reason = catalogProblem(value, options.manifest);\n if (reason) return `${key}: ${reason}`;\n continue;\n }\n if (key === \"metadata\") {\n const isMetadata =\n isRecord(value) &&\n (value.extensions === undefined || isRecord(value.extensions));\n if (!isMetadata) return 'metadata must be { \"extensions\": { ... } }';\n continue;\n }\n if (key === \"accessibility\") {\n const reason = accessibilityProblem(value);\n if (reason) return `${key}: ${reason}`;\n continue;\n }\n if (ownValue(entry.events, key)) {\n const reason = actionBindingProblem(value, options);\n if (reason) return `${key}: ${reason}`;\n continue;\n }\n const slot = ownValue(entry.slots, key);\n if (slot) {\n const reason = slotProblem(value, slot, id);\n if (reason) return `${key}: ${reason}`;\n continue;\n }\n if (!propNames.includes(key)) return `unknown prop \"${key}\"`;\n if (isV09PathBinding(value)) return `${key}: ${V09_PATH_REASON}`;\n const call = findForbiddenCall(value, { allowValueFunctions: true });\n if (call !== undefined) {\n return `${key}: ${call}; a data prop can call only ${VALUE_FUNCTION_LIST}`;\n }\n }\n for (const ref of childRefsOf(entry.props)) {\n const reason = childRefProblem(node, ref, id);\n if (reason) return reason;\n }\n const requiredNames = Array.isArray(required) ? required : [];\n for (const name of requiredNames) {\n if (typeof name === \"string\" && !(name in node)) {\n return `missing required prop \"${name}\"`;\n }\n }\n return undefined;\n}\n\nconst ACCESSIBILITY_KEYS = [\"label\", \"description\", \"live\", \"hidden\"];\nconst LIVE_VALUES = [\"off\", \"polite\", \"assertive\"];\n\n/**\n * Checks the `accessibility` of a component envelope: `label` and\n * `description` are strings or dynamic values, `live` is one of the ARIA\n * values, `hidden` is a boolean or a dynamic value.\n */\nfunction accessibilityProblem(value: unknown) {\n if (!isRecord(value)) {\n return 'must be { \"label\": \"...\", \"description\": \"...\", \"live\": \"polite\", \"hidden\": false }';\n }\n const isDynamic = (field: unknown) =>\n isPathBinding(field) || isCallBinding(field);\n for (const [key, field] of Object.entries(value)) {\n if (!ACCESSIBILITY_KEYS.includes(key)) return `unknown key \"${key}\"`;\n if (isV09PathBinding(field)) return `${key}: ${V09_PATH_REASON}`;\n if (isDynamic(field)) {\n const call = findForbiddenCall(field, { allowValueFunctions: true });\n if (call !== undefined) return `${key}: ${call}`;\n continue;\n }\n if (key === \"live\") {\n if (typeof field !== \"string\" || !LIVE_VALUES.includes(field)) {\n return `live must be one of ${LIVE_VALUES.join(\", \")}`;\n }\n } else if (key === \"hidden\") {\n if (typeof field !== \"boolean\") return \"hidden must be a boolean\";\n } else if (typeof field !== \"string\") {\n return `${key} must be a string`;\n }\n }\n return undefined;\n}\n\nfunction actionBindingProblem(\n value: unknown,\n options: ValidateOperationOptions,\n) {\n if (!isRecord(value)) return \"must be an action object\";\n const keys = Object.keys(value);\n const isOneAction =\n keys.length === 1 && (keys[0] === \"functionCall\" || keys[0] === \"event\");\n if (!isOneAction) {\n return 'must be { \"event\": ... } or { \"functionCall\": ... }';\n }\n if (keys[0] === \"functionCall\") {\n return functionCallProblem(value.functionCall, \"functionCall\", options);\n }\n return eventProblem(value.event);\n}\n\n/**\n * Checks `{ \"@call\": \"<function>\", \"args\": { ... } }`. `label` names the\n * field in the reason.\n */\nfunction functionCallProblem(\n call: unknown,\n label: string,\n options: ValidateOperationOptions,\n) {\n if (!isRecord(call)) {\n return `${label} must be { \"@call\": \"<function>\", \"args\": { ... } }`;\n }\n const name = call[\"@call\"];\n if (typeof name !== \"string\" || !name) {\n return typeof call.call === \"string\"\n ? `${label} names the function with \"@call\", not \"call\"`\n : `${label}[\"@call\"] must be a function name`;\n }\n const { args } = call;\n if (args !== undefined && !isRecord(args)) {\n return `${label}.args must be an object`;\n }\n const catalogReason = catalogProblem(call.catalogId, options.manifest);\n if (catalogReason) return `${label}: ${catalogReason}`;\n const argEntries = Object.entries(args ?? {});\n for (const [key, arg] of argEntries) {\n if (isV09PathBinding(arg))\n return `${label}.args.${key}: ${V09_PATH_REASON}`;\n }\n // A function the app declares under a built-in name is the app's; the\n // restrictions of the built-in do not apply to it.\n const appFunctions = options.functions;\n const declared =\n appFunctions !== undefined && hasOwn(appFunctions, name)\n ? appFunctions[name]\n : undefined;\n const builtIn =\n declared === undefined && hasOwn(GENERATIVE_UI_FUNCTIONS, name)\n ? GENERATIVE_UI_FUNCTIONS[name]\n : undefined;\n if (declared === undefined && builtIn === undefined) {\n return appFunctions === undefined\n ? undefined\n : `function \"${name}\" is not exposed to generative UI`;\n }\n // Without the list of app functions, a built-in name may be the app's own\n // function, so the dispatcher applies the restriction when the call runs.\n if (declared === undefined && appFunctions === undefined) return undefined;\n return callerProblem(\n name,\n declared ?? builtIn!,\n label.startsWith(\"callRendererFunction\") ? \"agent\" : \"renderer\",\n );\n}\n\n/**\n * Why `caller` may not call a function with these permissions, or\n * `undefined` when it may. The dispatcher gives the same reasons at run\n * time, for the calls that are not validated against a function list.\n */\nexport function callerProblem(\n name: string,\n fn: A2UIFunctionPermissions,\n caller: \"agent\" | \"renderer\",\n) {\n const callers = functionCallers(fn);\n if (caller === \"agent\" && !callers.agent) {\n return fn.requiresUserActivation\n ? `function \"${name}\" runs only from a user gesture; the agent cannot call it`\n : `function \"${name}\" runs only in the UI (allowedCallers \"rendererOnly\"); the agent cannot call it`;\n }\n if (caller === \"renderer\" && !callers.renderer) {\n return `function \"${name}\" runs only for the agent (allowedCallers \"agentOnly\"); the UI cannot call it`;\n }\n return undefined;\n}\n\nfunction eventProblem(event: unknown) {\n if (!isRecord(event) || typeof event.name !== \"string\" || !event.name) {\n return \"event.name is required\";\n }\n const { userMessage, context } = event;\n const isUserMessage =\n userMessage === undefined ||\n typeof userMessage === \"string\" ||\n isPathBinding(userMessage) ||\n (isRecord(userMessage) &&\n typeof userMessage[\"@call\"] === \"string\" &&\n findForbiddenCall(userMessage, { allowValueFunctions: true }) ===\n undefined);\n if (!isUserMessage) {\n return isV09PathBinding(userMessage)\n ? `event.userMessage: ${V09_PATH_REASON}`\n : 'event.userMessage must be a string, {\"@path\": \"/x\"} or a function value';\n }\n if (context === undefined) return undefined;\n if (!isRecord(context)) return \"event.context must be an object\";\n const entries = Object.entries(context);\n for (const [key, entry] of entries) {\n if (isV09PathBinding(entry)) {\n return `event.context.${key}: ${V09_PATH_REASON}`;\n }\n const call = findForbiddenCall(entry, { allowValueFunctions: true });\n if (call !== undefined) {\n return `event.context.${key}: ${call}; a context value can call only ${VALUE_FUNCTION_LIST}`;\n }\n }\n return undefined;\n}\n\nfunction slotProblem(\n value: unknown,\n kind: \"single\" | \"multiple\",\n ownId: string,\n) {\n const isTemplate = isRecord(value) && \"componentId\" in value;\n if (kind === \"single\" && isTemplate) {\n return 'a template { \"componentId\", \"path\" } is only allowed in a \"multiple\" slot';\n }\n if (kind === \"multiple\" && isTemplate) {\n return templateProblem(value, ownId);\n }\n if (kind === \"multiple\" && !Array.isArray(value)) {\n return 'must be an array of component ids or a template { \"componentId\", \"path\" }';\n }\n const ids = kind === \"multiple\" && Array.isArray(value) ? value : [value];\n for (const id of ids) {\n if (typeof id !== \"string\" || !id)\n return \"must reference component ids (strings)\";\n if (id === ownId) return \"a component cannot be its own child\";\n }\n return undefined;\n}\n\nfunction templateProblem(template: Record<string, unknown>, ownId: string) {\n const hasOnlyTemplateKeys = Object.keys(template).every(\n (key) => key === \"componentId\" || key === \"path\",\n );\n if (!hasOnlyTemplateKeys) {\n return 'a template takes only \"componentId\" and \"path\"';\n }\n const { componentId, path } = template;\n if (typeof componentId !== \"string\" || !componentId) {\n return \"template componentId must be a component id\";\n }\n if (componentId === ownId) return \"a component cannot be its own child\";\n if (typeof path !== \"string\" || !path) {\n return \"template path must be a JSON pointer or a relative path\";\n }\n return pathProblem(path, \"template path\");\n}\n\nconst VALUE_FUNCTION_LIST = `@index and the built-in functions (${Object.keys(\n GENERATIVE_UI_FUNCTIONS,\n)\n .filter(isA2UIValueFunction)\n .join(\", \")})`;\n\n/**\n * The reason for the first function call in `value` that a data value may\n * not make, at any depth, or `undefined`. A data value may call `@index`\n * and, with `allowValueFunctions`, the basic functions that need no user\n * gesture; the renderer resolves those. An app function, `openUrl`, or an\n * event binding is not a value.\n */\n// The annotation is needed: the function calls itself in its return.\nfunction findForbiddenCall(\n value: unknown,\n options: { allowValueFunctions: boolean },\n): string | undefined {\n if (Array.isArray(value)) {\n for (const item of value) {\n const reason = findForbiddenCall(item, options);\n if (reason !== undefined) return reason;\n }\n return undefined;\n }\n if (!isRecord(value)) return undefined;\n if (isIndexCall(value)) return undefined;\n if (value[\"@call\"] === \"@index\") return \"@index takes only an offset\";\n if (typeof value.call === \"string\") {\n return 'name the function with \"@call\", not \"call\"';\n }\n if (\"functionCall\" in value) {\n return \"an event binding is not a value\";\n }\n const name = value[\"@call\"];\n if (typeof name === \"string\") {\n if (!options.allowValueFunctions || !isA2UIValueFunction(name)) {\n return isA2UIBasicFunction(name)\n ? `\"${name}\" runs only from an event`\n : `\"${name}\" is not a basic function`;\n }\n const args = value.args;\n if (args !== undefined && !isRecord(args)) {\n return `the args of \"${name}\" must be an object`;\n }\n return args === undefined ? undefined : findForbiddenCall(args, options);\n }\n for (const item of Object.values(value)) {\n const reason = findForbiddenCall(item, options);\n if (reason !== undefined) return reason;\n }\n return undefined;\n}\n\nconst childRefCache = new WeakMap<GenerativeUIJSONSchema, ChildRef[]>();\n\n/** The component references of a props schema, computed once per schema. */\nfunction childRefsOf(props: GenerativeUIJSONSchema) {\n let refs = childRefCache.get(props);\n if (!refs) {\n refs = collectChildRefs(props);\n childRefCache.set(props, refs);\n }\n return refs;\n}\n\n/**\n * Checks the component ids at one reference of a node: a typed `child()`\n * or `childList()` prop, at any depth. A missing key is fine; the props\n * schema reports a required one.\n */\nfunction childRefProblem(\n node: Record<string, unknown>,\n ref: ChildRef,\n ownId: string,\n): string | undefined {\n const label = ref.path.filter((step) => step !== \"*\").join(\".\");\n const isDynamic = (value: unknown) =>\n isPathBinding(value) || (isRecord(value) && \"@call\" in value);\n const visit = (\n value: unknown,\n steps: readonly string[],\n ): string | undefined => {\n // A bound or computed value, at the reference or above it, is known\n // only at render.\n if (isDynamic(value)) return undefined;\n if (steps.length === 0) {\n const reason = slotProblem(value, ref.kind, ownId);\n return reason ? `${label}: ${reason}` : undefined;\n }\n const [head, ...rest] = steps;\n if (head === \"*\") {\n if (!Array.isArray(value)) return undefined;\n for (const item of value) {\n const reason = visit(item, rest);\n if (reason) return reason;\n }\n return undefined;\n }\n if (!isRecord(value) || !hasOwn(value, head)) return undefined;\n return visit(value[head], rest);\n };\n return visit(node, ref.path);\n}\n"],"mappings":";;;;;;AAwBA,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACD;AAuCD,MAAM,KAA0B,EAAE,IAAI,MAAM;AAC5C,MAAM,QAAQ,YAAyC;CAAE,IAAI;CAAO;CAAQ;;AAG5E,MAAM,kBAAkB;AAExB,SAAS,OAAO,QAAgB,KAAa;AAC3C,QAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI;;;;;;AA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CACpB,MAAM,QAAQ,IAAI,KAAK,QAAQ,SAAS,SAAS,IAAI,CAAC,KAAK,IAAI;CAC/D,MAAM,aAAa,UACjB,cAAc,MAAM,IAAK,SAAS,MAAM,IAAI,WAAW;CACzD,MAAM,SACJ,OACA,UACuB;AAGvB,MAAI,UAAU,MAAM,CAAE,QAAO;AAC7B,MAAI,MAAM,WAAW,GAAG;GACtB,MAAM,SAAS,YAAY,OAAO,IAAI,MAAM,MAAM;AAClD,UAAO,SAAS,GAAG,MAAM,IAAI,WAAW;;EAE1C,MAAM,CAAC,MAAM,GAAG,QAAQ;AACxB,MAAI,SAAS,KAAK;AAChB,OAAI,CAAC,MAAM,QAAQ,MAAM,CAAE,QAAO;AAClC,QAAK,MAAM,QAAQ,OAAO;IACxB,MAAM,SAAS,MAAM,MAAM,KAAK;AAChC,QAAI,OAAQ,QAAO;;AAErB;;AAEF,MAAI,CAAC,SAAS,MAAM,IAAI,CAAC,OAAO,OAAO,KAAK,CAAE,QAAO;AACrD,SAAO,MAAM,MAAM,OAAO,KAAK;;AAEjC,QAAO,MAAM,MAAM,IAAI,KAAK"}
1
+ {"version":3,"file":"validate-operation.mjs","names":[],"sources":["../../src/generative-ui/validate-operation.ts"],"sourcesContent":["import {\n GENERATIVE_UI_FUNCTIONS,\n functionCallers,\n isA2UIBasicFunction,\n isA2UIValueFunction,\n isCallBinding,\n} from \"./basic-functions\";\nimport type { A2UIFunctionPermissions } from \"./basic-functions\";\nimport { collectChildRefs } from \"./child-refs\";\nimport type { ChildRef } from \"./child-refs\";\nimport {\n A2UI_VERSION,\n GENERATIVE_UI_AGENT_FUNCTION_CALLS,\n GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON,\n} from \"./types\";\nimport type {\n GenerativeUIActionBinding,\n GenerativeUIJSONSchema,\n GenerativeUIManifest,\n} from \"./types\";\nimport { isRecord } from \"./is-record\";\n\nexport type OperationValidation = { ok: true } | { ok: false; reason: string };\n\nconst OPERATION_KINDS = [\n \"createSurface\",\n \"updateComponents\",\n \"updateDataModel\",\n \"deleteSurface\",\n \"callRendererFunction\",\n] as const;\nexport type OperationKind = (typeof OPERATION_KINDS)[number];\n\nexport interface ValidateOperationOptions {\n manifest: Pick<\n GenerativeUIManifest,\n \"catalogId\" | \"catalogIds\" | \"components\"\n >;\n /**\n * Surfaces that exist before this operation is applied. `updateComponents`,\n * `updateDataModel`, and `deleteSurface` need their surface in this set.\n */\n knownSurfaces: ReadonlySet<string>;\n /**\n * Surface ids that were created before, also the deleted ones. A surface id\n * is unique for the life of the page, so `createSurface` rejects them.\n */\n createdSurfaces?: ReadonlySet<string>;\n /**\n * UI-callable functions. When provided, `functionCall` bindings and\n * `callRendererFunction` must name one of them. The client omits it:\n * availability is checked when the function runs.\n */\n functions?: GenerativeUIManifest[\"functions\"];\n /**\n * The components that the target of the surface takes. When provided,\n * `updateComponents` and the inline components of `createSurface` can use\n * only these names. Left out, every catalog component is allowed.\n */\n allowedComponents?: AllowedComponents;\n}\n\n/** The component names that one target takes. */\nexport interface AllowedComponents {\n /** The target id, for the reason of a rejection. */\n target: string;\n names: ReadonlySet<string>;\n}\n\nconst OK: OperationValidation = { ok: true };\nconst fail = (reason: string): OperationValidation => ({ ok: false, reason });\n\n/** Models write the v0.9 binding from habit. The reason names the v1.0 form. */\nconst V09_PATH_REASON = 'bind data with {\"@path\": \"/x\"}, not {\"path\": \"/x\"}';\n\nfunction hasOwn(record: object, key: string) {\n return Object.prototype.hasOwnProperty.call(record, key);\n}\n\n/**\n * Reads an own property only. Model-controlled keys such as \"constructor\" or\n * \"toString\" must not resolve to Object.prototype members.\n */\nfunction ownValue<T>(record: Record<string, T> | undefined, key: string) {\n return record && hasOwn(record, key) ? record[key] : undefined;\n}\n\nexport function getOperationKind(op: unknown) {\n if (!isRecord(op)) return undefined;\n const kinds = OPERATION_KINDS.filter((kind) => kind in op);\n return kinds.length === 1 ? kinds[0] : undefined;\n}\n\n/** The `surfaceId` of a surface operation. `callRendererFunction` has none. */\nexport function getOperationSurfaceId(op: unknown) {\n if (!isRecord(op)) return undefined;\n const kind = getOperationKind(op);\n if (!kind) return undefined;\n const payload = op[kind];\n return isRecord(payload) && typeof payload.surfaceId === \"string\"\n ? payload.surfaceId\n : undefined;\n}\n\n/** `{ \"@path\": \"/x\" }`: a data-model binding. */\nexport function isPathBinding(value: unknown): value is { \"@path\": string } {\n return (\n isRecord(value) &&\n typeof value[\"@path\"] === \"string\" &&\n Object.keys(value).length === 1\n );\n}\n\n/** `{ \"path\": \"/x\" }`: the v0.9 binding, which v1.0 does not accept. */\nfunction isV09PathBinding(value: unknown) {\n return (\n isRecord(value) &&\n typeof value.path === \"string\" &&\n Object.keys(value).length === 1\n );\n}\n\n/**\n * `{ \"@call\": \"@index\" }` or `{ \"@call\": \"@index\", \"args\": { \"offset\": 1 } }`:\n * the 0-based position of the item in a template, plus `offset`.\n */\nexport function isIndexCall(\n value: unknown,\n): value is { \"@call\": \"@index\"; args?: { offset?: number } } {\n if (!isRecord(value) || value[\"@call\"] !== \"@index\") return false;\n const hasOnlyCallKeys = Object.keys(value).every(\n (key) => key === \"@call\" || key === \"args\",\n );\n if (!hasOnlyCallKeys) return false;\n const { args } = value;\n if (args === undefined) return true;\n return (\n isRecord(args) &&\n Object.keys(args).every((key) => key === \"offset\") &&\n (args.offset === undefined || Number.isFinite(args.offset))\n );\n}\n\nexport function isActionBinding(\n value: unknown,\n): value is GenerativeUIActionBinding {\n return (\n isRecord(value) &&\n Object.keys(value).length === 1 &&\n (isRecord(value.functionCall) || isRecord(value.event))\n );\n}\n\n/**\n * Checks one A2UI v1.0 operation against the catalog and the surfaces that\n * exist. The operation comes from the model, so nothing in it is trusted.\n *\n * @param op - The operation, as parsed from JSON.\n * @param options - The catalog, the known and created surfaces, the\n * functions that the UI can call, and the components that the target of\n * the surface takes.\n *\n * @example\n * ```ts\n * const result = validateOperation(op, { manifest, knownSurfaces });\n * if (!result.ok) rejected.push({ index, reason: result.reason });\n * ```\n */\nexport function validateOperation(\n op: unknown,\n options: ValidateOperationOptions,\n) {\n if (!isRecord(op)) return fail(\"operation must be a JSON object\");\n if (op.version !== A2UI_VERSION) return fail(versionProblem(op.version));\n const kind = getOperationKind(op);\n if (!kind) {\n return fail(\n `operation must contain exactly one of ${OPERATION_KINDS.join(\", \")}`,\n );\n }\n const payload = op[kind];\n if (kind === \"callRendererFunction\") {\n if (!GENERATIVE_UI_AGENT_FUNCTION_CALLS) {\n return fail(GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON);\n }\n return validateRendererFunctionCall(payload, options);\n }\n if (\n !isRecord(payload) ||\n typeof payload.surfaceId !== \"string\" ||\n !payload.surfaceId\n ) {\n return fail(`${kind}.surfaceId is required`);\n }\n const surfaceId = payload.surfaceId;\n if (kind === \"createSurface\") {\n return validateCreateSurface(payload, surfaceId, options);\n }\n if (!options.knownSurfaces.has(surfaceId)) {\n return fail(\n `surface \"${surfaceId}\" does not exist; send createSurface first`,\n );\n }\n switch (kind) {\n case \"deleteSurface\":\n return OK;\n case \"updateDataModel\":\n return validateDataModelUpdate(payload);\n case \"updateComponents\":\n return validateComponents(\n payload.components,\n \"updateComponents.components\",\n options,\n );\n }\n}\n\nfunction versionProblem(version: unknown) {\n return typeof version === \"string\"\n ? `unsupported version \"${version}\"; use \"${A2UI_VERSION}\"`\n : `operation needs \"version\":\"${A2UI_VERSION}\"`;\n}\n\n/** A `catalogId` can name the catalog of the run or one of its bases. */\nfunction catalogProblem(\n catalogId: unknown,\n manifest: ValidateOperationOptions[\"manifest\"],\n) {\n const ids = manifest.catalogIds ?? [manifest.catalogId];\n if (catalogId === undefined || ids.includes(catalogId as string)) {\n return undefined;\n }\n const names = ids.map((id) => `\"${id}\"`).join(\", \");\n const use = ids.length === 1 ? names : `one of: ${names}`;\n return `unknown catalog \"${String(catalogId)}\"; leave out catalogId or use ${use}`;\n}\n\nfunction validateCreateSurface(\n payload: Record<string, unknown>,\n surfaceId: string,\n options: ValidateOperationOptions,\n) {\n if (options.knownSurfaces.has(surfaceId)) {\n return fail(`surface \"${surfaceId}\" already exists`);\n }\n if (options.createdSurfaces?.has(surfaceId)) {\n return fail(\n `surface id \"${surfaceId}\" was used before; use a new surfaceId`,\n );\n }\n const catalogReason = catalogProblem(payload.catalogId, options.manifest);\n if (catalogReason) return fail(catalogReason);\n const { dataModel, components } = payload;\n if (dataModel !== undefined && !isRecord(dataModel)) {\n return fail(\"createSurface.dataModel must be a JSON object\");\n }\n if (components === undefined) return OK;\n return validateComponents(components, \"createSurface.components\", options);\n}\n\nfunction validateRendererFunctionCall(\n payload: unknown,\n options: ValidateOperationOptions,\n) {\n const hasCallId =\n isRecord(payload) &&\n typeof payload.functionCallId === \"string\" &&\n payload.functionCallId !== \"\";\n if (!hasCallId) {\n return fail(\n \"callRendererFunction.functionCallId must be a non-empty string\",\n );\n }\n const reason = functionCallProblem(\n payload.callFunction,\n \"callRendererFunction.callFunction\",\n options,\n );\n return reason ? fail(reason) : OK;\n}\n\nconst FORBIDDEN_SEGMENTS = new Set([\"__proto__\", \"constructor\", \"prototype\"]);\n\nfunction decodeSegment(segment: string) {\n return segment.replace(/~([01])/g, (_, g) => (g === \"1\" ? \"/\" : \"~\"));\n}\n\nfunction validateDataModelUpdate(payload: Record<string, unknown>) {\n if (payload.value === undefined) {\n return fail(\n 'updateDataModel.value is required; use \"value\":null to delete',\n );\n }\n const path = payload.path ?? \"/\";\n if (typeof path !== \"string\" || !path.startsWith(\"/\")) {\n return fail(\"updateDataModel.path must be an absolute JSON pointer\");\n }\n if (path === \"/\") {\n // Paths such as \"/items\" point into the root, so the root must be an object.\n if (!isRecord(payload.value)) {\n return fail(\"a root updateDataModel value must be a JSON object\");\n }\n return OK;\n }\n const reason = pathProblem(path, \"updateDataModel.path\");\n return reason ? fail(reason) : OK;\n}\n\n/**\n * Checks the segments of an absolute JSON pointer (\"/a/b\") or of a path\n * relative to a template item (\"a/b\"). `label` names the field in the reason.\n */\nfunction pathProblem(path: string, label: string) {\n const relative = path.startsWith(\"/\") ? path.slice(1) : path;\n const segments = relative.split(\"/\");\n if (segments.some((segment) => segment === \"\")) {\n return `${label} must not contain empty segments`;\n }\n const decoded = segments.map(decodeSegment);\n const forbidden = decoded.find((segment) => FORBIDDEN_SEGMENTS.has(segment));\n if (forbidden !== undefined) {\n return `path segment \"${forbidden}\" is not allowed in ${label}`;\n }\n return undefined;\n}\n\nfunction validateComponents(\n components: unknown,\n label: string,\n options: ValidateOperationOptions,\n) {\n if (!Array.isArray(components) || components.length === 0) {\n return fail(`${label} must be a non-empty array`);\n }\n const ids = new Set<string>();\n for (const node of components) {\n if (!isRecord(node)) return fail(\"component must be a JSON object\");\n const { id } = node;\n if (typeof id !== \"string\" || !id) return fail(\"id is required\");\n const reason = nodeProblem(node, id, options);\n if (reason) return fail(`component \"${id}\": ${reason}`);\n if (ids.has(id)) {\n return fail(`component \"${id}\" appears twice in one update`);\n }\n ids.add(id);\n }\n return OK;\n}\n\nfunction nodeProblem(\n node: Record<string, unknown>,\n id: string,\n options: ValidateOperationOptions,\n) {\n if (typeof node.component !== \"string\") return \"component type is required\";\n const entry = ownValue(options.manifest.components, node.component);\n if (!entry) return `unknown component \"${node.component}\"`;\n const { allowedComponents } = options;\n if (allowedComponents && !allowedComponents.names.has(node.component)) {\n const names = [...allowedComponents.names].join(\", \") || \"none\";\n return `\"${node.component}\" is not allowed in target \"${allowedComponents.target}\"; use one of: ${names}`;\n }\n const { properties, required } = entry.props;\n const propNames = isRecord(properties) ? Object.keys(properties) : [];\n const props = Object.entries(node);\n for (const [key, value] of props) {\n if (key === \"id\" || key === \"component\") continue;\n if (key === \"catalogId\") {\n const reason = catalogProblem(value, options.manifest);\n if (reason) return `${key}: ${reason}`;\n continue;\n }\n if (key === \"metadata\") {\n const isMetadata =\n isRecord(value) &&\n (value.extensions === undefined || isRecord(value.extensions));\n if (!isMetadata) return 'metadata must be { \"extensions\": { ... } }';\n continue;\n }\n if (key === \"accessibility\") {\n const reason = accessibilityProblem(value);\n if (reason) return `${key}: ${reason}`;\n continue;\n }\n if (ownValue(entry.events, key)) {\n const reason = actionBindingProblem(value, options);\n if (reason) return `${key}: ${reason}`;\n continue;\n }\n const slot = ownValue(entry.slots, key);\n if (slot) {\n const reason = slotProblem(value, slot, id);\n if (reason) return `${key}: ${reason}`;\n continue;\n }\n if (!propNames.includes(key)) return `unknown prop \"${key}\"`;\n if (isV09PathBinding(value)) return `${key}: ${V09_PATH_REASON}`;\n const call = findForbiddenCall(value, { allowValueFunctions: true });\n if (call !== undefined) {\n return `${key}: ${call}; a data prop can call only ${VALUE_FUNCTION_LIST}`;\n }\n }\n for (const ref of childRefsOf(entry.props)) {\n const reason = childRefProblem(node, ref, id);\n if (reason) return reason;\n }\n const requiredNames = Array.isArray(required) ? required : [];\n for (const name of requiredNames) {\n if (typeof name === \"string\" && !(name in node)) {\n return `missing required prop \"${name}\"`;\n }\n }\n return undefined;\n}\n\nconst ACCESSIBILITY_KEYS = [\"label\", \"description\", \"live\", \"hidden\"];\nconst LIVE_VALUES = [\"off\", \"polite\", \"assertive\"];\n\n/**\n * Checks the `accessibility` of a component envelope: `label` and\n * `description` are strings or dynamic values, `live` is one of the ARIA\n * values, `hidden` is a boolean or a dynamic value.\n */\nfunction accessibilityProblem(value: unknown) {\n if (!isRecord(value)) {\n return 'must be { \"label\": \"...\", \"description\": \"...\", \"live\": \"polite\", \"hidden\": false }';\n }\n const isDynamic = (field: unknown) =>\n isPathBinding(field) || isCallBinding(field);\n for (const [key, field] of Object.entries(value)) {\n if (!ACCESSIBILITY_KEYS.includes(key)) return `unknown key \"${key}\"`;\n if (isV09PathBinding(field)) return `${key}: ${V09_PATH_REASON}`;\n if (isDynamic(field)) {\n const call = findForbiddenCall(field, { allowValueFunctions: true });\n if (call !== undefined) return `${key}: ${call}`;\n continue;\n }\n if (key === \"live\") {\n if (typeof field !== \"string\" || !LIVE_VALUES.includes(field)) {\n return `live must be one of ${LIVE_VALUES.join(\", \")}`;\n }\n } else if (key === \"hidden\") {\n if (typeof field !== \"boolean\") return \"hidden must be a boolean\";\n } else if (typeof field !== \"string\") {\n return `${key} must be a string`;\n }\n }\n return undefined;\n}\n\nfunction actionBindingProblem(\n value: unknown,\n options: ValidateOperationOptions,\n) {\n if (!isRecord(value)) return \"must be an action object\";\n const keys = Object.keys(value);\n const isOneAction =\n keys.length === 1 && (keys[0] === \"functionCall\" || keys[0] === \"event\");\n if (!isOneAction) {\n return 'must be { \"event\": ... } or { \"functionCall\": ... }';\n }\n if (keys[0] === \"functionCall\") {\n return functionCallProblem(value.functionCall, \"functionCall\", options);\n }\n return eventProblem(value.event);\n}\n\n/**\n * Checks `{ \"@call\": \"<function>\", \"args\": { ... } }`. `label` names the\n * field in the reason.\n */\nfunction functionCallProblem(\n call: unknown,\n label: string,\n options: ValidateOperationOptions,\n) {\n if (!isRecord(call)) {\n return `${label} must be { \"@call\": \"<function>\", \"args\": { ... } }`;\n }\n const name = call[\"@call\"];\n if (typeof name !== \"string\" || !name) {\n return typeof call.call === \"string\"\n ? `${label} names the function with \"@call\", not \"call\"`\n : `${label}[\"@call\"] must be a function name`;\n }\n const { args } = call;\n if (args !== undefined && !isRecord(args)) {\n return `${label}.args must be an object`;\n }\n const catalogReason = catalogProblem(call.catalogId, options.manifest);\n if (catalogReason) return `${label}: ${catalogReason}`;\n const argEntries = Object.entries(args ?? {});\n for (const [key, arg] of argEntries) {\n if (isV09PathBinding(arg))\n return `${label}.args.${key}: ${V09_PATH_REASON}`;\n }\n // A function the app declares under a built-in name is the app's; the\n // restrictions of the built-in do not apply to it.\n const appFunctions = options.functions;\n const declared =\n appFunctions !== undefined && hasOwn(appFunctions, name)\n ? appFunctions[name]\n : undefined;\n const builtIn =\n declared === undefined && hasOwn(GENERATIVE_UI_FUNCTIONS, name)\n ? GENERATIVE_UI_FUNCTIONS[name]\n : undefined;\n if (declared === undefined && builtIn === undefined) {\n return appFunctions === undefined\n ? undefined\n : `function \"${name}\" is not exposed to generative UI`;\n }\n // Without the list of app functions, a built-in name may be the app's own\n // function, so the dispatcher applies the restriction when the call runs.\n if (declared === undefined && appFunctions === undefined) return undefined;\n return callerProblem(\n name,\n declared ?? builtIn!,\n label.startsWith(\"callRendererFunction\") ? \"agent\" : \"renderer\",\n );\n}\n\n/**\n * Why `caller` may not call a function with these permissions, or\n * `undefined` when it may. The dispatcher gives the same reasons at run\n * time, for the calls that are not validated against a function list.\n */\nexport function callerProblem(\n name: string,\n fn: A2UIFunctionPermissions,\n caller: \"agent\" | \"renderer\",\n) {\n const callers = functionCallers(fn);\n if (caller === \"agent\" && !callers.agent) {\n return fn.requiresUserActivation\n ? `function \"${name}\" runs only from a user gesture; the agent cannot call it`\n : `function \"${name}\" runs only in the UI (allowedCallers \"rendererOnly\"); the agent cannot call it`;\n }\n if (caller === \"renderer\" && !callers.renderer) {\n return `function \"${name}\" runs only for the agent (allowedCallers \"agentOnly\"); the UI cannot call it`;\n }\n return undefined;\n}\n\nfunction eventProblem(event: unknown) {\n if (!isRecord(event) || typeof event.name !== \"string\" || !event.name) {\n return \"event.name is required\";\n }\n const { userMessage, context } = event;\n const isUserMessage =\n userMessage === undefined ||\n typeof userMessage === \"string\" ||\n isPathBinding(userMessage) ||\n (isRecord(userMessage) &&\n typeof userMessage[\"@call\"] === \"string\" &&\n findForbiddenCall(userMessage, { allowValueFunctions: true }) ===\n undefined);\n if (!isUserMessage) {\n return isV09PathBinding(userMessage)\n ? `event.userMessage: ${V09_PATH_REASON}`\n : 'event.userMessage must be a string, {\"@path\": \"/x\"} or a function value';\n }\n if (context === undefined) return undefined;\n if (!isRecord(context)) return \"event.context must be an object\";\n const entries = Object.entries(context);\n for (const [key, entry] of entries) {\n if (isV09PathBinding(entry)) {\n return `event.context.${key}: ${V09_PATH_REASON}`;\n }\n const call = findForbiddenCall(entry, { allowValueFunctions: true });\n if (call !== undefined) {\n return `event.context.${key}: ${call}; a context value can call only ${VALUE_FUNCTION_LIST}`;\n }\n }\n return undefined;\n}\n\nfunction slotProblem(\n value: unknown,\n kind: \"single\" | \"multiple\",\n ownId: string,\n) {\n const isTemplate = isRecord(value) && \"componentId\" in value;\n if (kind === \"single\" && isTemplate) {\n return 'a template { \"componentId\", \"path\" } is only allowed in a \"multiple\" slot';\n }\n if (kind === \"multiple\" && isTemplate) {\n return templateProblem(value, ownId);\n }\n if (kind === \"multiple\" && !Array.isArray(value)) {\n return 'must be an array of component ids or a template { \"componentId\", \"path\" }';\n }\n const ids = kind === \"multiple\" && Array.isArray(value) ? value : [value];\n for (const id of ids) {\n if (typeof id !== \"string\" || !id)\n return \"must reference component ids (strings)\";\n if (id === ownId) return \"a component cannot be its own child\";\n }\n return undefined;\n}\n\nfunction templateProblem(template: Record<string, unknown>, ownId: string) {\n const hasOnlyTemplateKeys = Object.keys(template).every(\n (key) => key === \"componentId\" || key === \"path\",\n );\n if (!hasOnlyTemplateKeys) {\n return 'a template takes only \"componentId\" and \"path\"';\n }\n const { componentId, path } = template;\n if (typeof componentId !== \"string\" || !componentId) {\n return \"template componentId must be a component id\";\n }\n if (componentId === ownId) return \"a component cannot be its own child\";\n if (typeof path !== \"string\" || !path) {\n return \"template path must be a JSON pointer or a relative path\";\n }\n return pathProblem(path, \"template path\");\n}\n\nconst VALUE_FUNCTION_LIST = `@index and the built-in functions (${Object.keys(\n GENERATIVE_UI_FUNCTIONS,\n)\n .filter(isA2UIValueFunction)\n .join(\", \")})`;\n\n/**\n * The reason for the first function call in `value` that a data value may\n * not make, at any depth, or `undefined`. A data value may call `@index`\n * and, with `allowValueFunctions`, the basic functions that need no user\n * gesture; the renderer resolves those. An app function, `openUrl`, or an\n * event binding is not a value.\n */\n// The annotation is needed: the function calls itself in its return.\nfunction findForbiddenCall(\n value: unknown,\n options: { allowValueFunctions: boolean },\n): string | undefined {\n if (Array.isArray(value)) {\n for (const item of value) {\n const reason = findForbiddenCall(item, options);\n if (reason !== undefined) return reason;\n }\n return undefined;\n }\n if (!isRecord(value)) return undefined;\n if (isIndexCall(value)) return undefined;\n if (value[\"@call\"] === \"@index\") return \"@index takes only an offset\";\n if (typeof value.call === \"string\") {\n return 'name the function with \"@call\", not \"call\"';\n }\n if (\"functionCall\" in value) {\n return \"an event binding is not a value\";\n }\n const name = value[\"@call\"];\n if (typeof name === \"string\") {\n if (!options.allowValueFunctions || !isA2UIValueFunction(name)) {\n return isA2UIBasicFunction(name)\n ? `\"${name}\" runs only from an event`\n : `\"${name}\" is not a basic function`;\n }\n const args = value.args;\n if (args !== undefined && !isRecord(args)) {\n return `the args of \"${name}\" must be an object`;\n }\n return args === undefined ? undefined : findForbiddenCall(args, options);\n }\n for (const item of Object.values(value)) {\n const reason = findForbiddenCall(item, options);\n if (reason !== undefined) return reason;\n }\n return undefined;\n}\n\nconst childRefCache = new WeakMap<GenerativeUIJSONSchema, ChildRef[]>();\n\n/** The component references of a props schema, computed once per schema. */\nfunction childRefsOf(props: GenerativeUIJSONSchema) {\n let refs = childRefCache.get(props);\n if (!refs) {\n refs = collectChildRefs(props);\n childRefCache.set(props, refs);\n }\n return refs;\n}\n\n/**\n * Checks the component ids at one reference of a node: a typed `child()`\n * or `childList()` prop, at any depth. A missing key is fine; the props\n * schema reports a required one.\n */\nfunction childRefProblem(\n node: Record<string, unknown>,\n ref: ChildRef,\n ownId: string,\n): string | undefined {\n const label = ref.path.filter((step) => step !== \"*\").join(\".\");\n const isDynamic = (value: unknown) =>\n isPathBinding(value) || (isRecord(value) && \"@call\" in value);\n const visit = (\n value: unknown,\n steps: readonly string[],\n ): string | undefined => {\n // A bound or computed value, at the reference or above it, is known\n // only at render.\n if (isDynamic(value)) return undefined;\n const [head, ...rest] = steps;\n if (head === undefined) {\n const reason = slotProblem(value, ref.kind, ownId);\n return reason ? `${label}: ${reason}` : undefined;\n }\n if (head === \"*\") {\n if (!Array.isArray(value)) return undefined;\n for (const item of value) {\n const reason = visit(item, rest);\n if (reason) return reason;\n }\n return undefined;\n }\n if (!isRecord(value) || !hasOwn(value, head)) return undefined;\n return visit(value[head], rest);\n };\n return visit(node, ref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AAM,QAAQ;AAC/C,MAAI,WAAW,OAAW,QAAO;;;AAKrC,MAAM,gCAAgB,IAAI,SAA6C;;AAGvE,SAAS,YAAY,OAA+B;CAClD,IAAI,OAAO,cAAc,IAAI,MAAM;AACnC,KAAI,CAAC,MAAM;AACT,SAAO,iBAAiB,MAAM;AAC9B,gBAAc,IAAI,OAAO,KAAK;;AAEhC,QAAO;;;;;;;AAQT,SAAS,gBACP,MACA,KACA,OACoB;CACpB,MAAM,QAAQ,IAAI,KAAK,QAAQ,SAAS,SAAS,IAAI,CAAC,KAAK,IAAI;CAC/D,MAAM,aAAa,UACjB,cAAc,MAAM,IAAK,SAAS,MAAM,IAAI,WAAW;CACzD,MAAM,SACJ,OACA,UACuB;AAGvB,MAAI,UAAU,MAAM,CAAE,QAAO;EAC7B,MAAM,CAAC,MAAM,GAAG,QAAQ;AACxB,MAAI,SAAS,QAAW;GACtB,MAAM,SAAS,YAAY,OAAO,IAAI,MAAM,MAAM;AAClD,UAAO,SAAS,GAAG,MAAM,IAAI,WAAW;;AAE1C,MAAI,SAAS,KAAK;AAChB,OAAI,CAAC,MAAM,QAAQ,MAAM,CAAE,QAAO;AAClC,QAAK,MAAM,QAAQ,OAAO;IACxB,MAAM,SAAS,MAAM,MAAM,KAAK;AAChC,QAAI,OAAQ,QAAO;;AAErB;;AAEF,MAAI,CAAC,SAAS,MAAM,IAAI,CAAC,OAAO,OAAO,KAAK,CAAE,QAAO;AACrD,SAAO,MAAM,MAAM,OAAO,KAAK;;AAEjC,QAAO,MAAM,MAAM,IAAI,KAAK"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_clipboard = require('./utils/clipboard.cjs');
3
- const require_conditions = require('./utils/conditions.cjs');
4
- const require_console_styling = require('./utils/console-styling.cjs');
5
3
  const require_errors = require('./utils/errors.cjs');
6
4
  const require_json_schema = require('./utils/json-schema.cjs');
7
5
  const require_inspector_metadata = require('./utils/inspector-metadata.cjs');
@@ -9,6 +7,7 @@ const require_inspector_learning = require('./utils/inspector-learning.cjs');
9
7
  const require_inspector_visibility = require('./utils/inspector-visibility.cjs');
10
8
  const require_types = require('./utils/types.cjs');
11
9
  const require_random_id = require('./utils/random-id.cjs');
10
+ const require_process_env = require('./utils/process-env.cjs');
12
11
  const require_requests = require('./utils/requests.cjs');
13
12
  const require_row_render_keys = require('./utils/row-render-keys.cjs');
14
13
  const require_index = require('./utils/index.cjs');
@@ -29,11 +28,14 @@ const require_package = require('./package.cjs');
29
28
  const require_basic_functions = require('./generative-ui/basic-functions.cjs');
30
29
  const require_child_refs = require('./generative-ui/child-refs.cjs');
31
30
  const require_types$1 = require('./generative-ui/types.cjs');
31
+ const require_prompt_spec = require('./generative-ui/prompt-spec.cjs');
32
32
  const require_a2ui_prompts = require('./a2ui-prompts.cjs');
33
33
  const require_a2ui_envelope = require('./a2ui-envelope.cjs');
34
34
  const require_open_generative_ui_prompts = require('./open-generative-ui-prompts.cjs');
35
35
  const require_validate_operation = require('./generative-ui/validate-operation.cjs');
36
36
  const require_render_ui_args = require('./generative-ui/render-ui-args.cjs');
37
+ const require_compact_schema = require('./generative-ui/compact-schema.cjs');
38
+ const require_schema_render = require('./generative-ui/schema-render.cjs');
37
39
  const require_prompt = require('./generative-ui/prompt.cjs');
38
40
 
39
41
  //#region src/index.ts
@@ -99,8 +101,6 @@ exports.COPILOT_CLOUD_ERROR_NAMES = require_errors.COPILOT_CLOUD_ERROR_NAMES;
99
101
  exports.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = require_index$1.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER;
100
102
  exports.COPILOT_CLOUD_VERSION = require_index$1.COPILOT_CLOUD_VERSION;
101
103
  exports.ConfigurationError = require_errors.ConfigurationError;
102
- exports.ConsoleColors = require_console_styling.ConsoleColors;
103
- exports.ConsoleStyles = require_console_styling.ConsoleStyles;
104
104
  exports.CopilotKitAgentDiscoveryError = require_errors.CopilotKitAgentDiscoveryError;
105
105
  exports.CopilotKitApiDiscoveryError = require_errors.CopilotKitApiDiscoveryError;
106
106
  exports.CopilotKitError = require_errors.CopilotKitError;
@@ -108,7 +108,6 @@ exports.CopilotKitErrorCode = require_errors.CopilotKitErrorCode;
108
108
  exports.CopilotKitLowLevelError = require_errors.CopilotKitLowLevelError;
109
109
  exports.CopilotKitMisuseError = require_errors.CopilotKitMisuseError;
110
110
  exports.CopilotKitRemoteEndpointDiscoveryError = require_errors.CopilotKitRemoteEndpointDiscoveryError;
111
- exports.CopilotKitVersionMismatchError = require_errors.CopilotKitVersionMismatchError;
112
111
  exports.DEFAULT_AGENT_ID = require_index$1.DEFAULT_AGENT_ID;
113
112
  exports.ERROR_CONFIG = require_errors.ERROR_CONFIG;
114
113
  exports.ERROR_NAMES = require_errors.ERROR_NAMES;
@@ -125,11 +124,14 @@ exports.GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE = require_types$1.GENERATIVE_U
125
124
  exports.GENERATIVE_UI_MARKDOWN_GUIDELINES = require_a2ui_prompts.GENERATIVE_UI_MARKDOWN_GUIDELINES;
126
125
  exports.GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION = require_a2ui_prompts.GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION;
127
126
  exports.GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION = require_a2ui_prompts.GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION;
127
+ exports.GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW = require_prompt_spec.GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW;
128
128
  exports.GENERATIVE_UI_MAX_REJECTION_LENGTH = require_types$1.GENERATIVE_UI_MAX_REJECTION_LENGTH;
129
129
  exports.GENERATIVE_UI_MAX_SUMMARY_REJECTIONS = require_types$1.GENERATIVE_UI_MAX_SUMMARY_REJECTIONS;
130
130
  exports.GENERATIVE_UI_MAX_TARGET_COMPONENTS = require_types$1.GENERATIVE_UI_MAX_TARGET_COMPONENTS;
131
131
  exports.GENERATIVE_UI_RENDER_TOOL = require_types$1.GENERATIVE_UI_RENDER_TOOL;
132
132
  exports.GENERATIVE_UI_ROOT_ID = require_types$1.GENERATIVE_UI_ROOT_ID;
133
+ exports.GENERATIVE_UI_WHEN_TO_SHOW = require_prompt_spec.GENERATIVE_UI_WHEN_TO_SHOW;
134
+ exports.GUIDE_COMPONENTS = require_prompt_spec.GUIDE_COMPONENTS;
133
135
  exports.MODEL_HOST_CLASSES = require_model_host.MODEL_HOST_CLASSES;
134
136
  exports.MissingPublicApiKeyError = require_errors.MissingPublicApiKeyError;
135
137
  exports.RUNTIME_MODE_INTELLIGENCE = require_types.RUNTIME_MODE_INTELLIGENCE;
@@ -148,6 +150,8 @@ exports.UNSAMPLED_RATE = require_sampling.UNSAMPLED_RATE;
148
150
  exports.UpgradeRequiredError = require_errors.UpgradeRequiredError;
149
151
  exports.actionParametersToJsonSchema = require_json_schema.actionParametersToJsonSchema;
150
152
  exports.applyChildRefMarks = require_child_refs.applyChildRefMarks;
153
+ exports.applyDescriptionOverrides = require_schema_render.applyDescriptionOverrides;
154
+ exports.buildCompactGenerativeUISchema = require_compact_schema.buildCompactGenerativeUISchema;
151
155
  exports.buildGenerativeUIMarkdownGuidelines = require_a2ui_prompts.buildGenerativeUIMarkdownGuidelines;
152
156
  exports.buildGenerativeUIPrompt = require_prompt.buildGenerativeUIPrompt;
153
157
  exports.callerProblem = require_validate_operation.callerProblem;
@@ -157,17 +161,15 @@ exports.classifyModelHost = require_model_host.classifyModelHost;
157
161
  exports.collectChildRefs = require_child_refs.collectChildRefs;
158
162
  exports.commitRowKeyStore = require_row_render_keys.commitRowKeyStore;
159
163
  exports.computeSamplingMeta = require_sampling.computeSamplingMeta;
160
- exports.convertJsonSchemaToZodSchema = require_json_schema.convertJsonSchemaToZodSchema;
161
164
  exports.copyToClipboard = require_clipboard.copyToClipboard;
162
165
  exports.createAttachmentContent = require_content.createAttachmentContent;
163
166
  exports.createLicenseContextValue = createLicenseContextValue;
164
167
  exports.createRowKeyStore = require_row_render_keys.createRowKeyStore;
165
168
  exports.createRunEventFinalizer = require_finalize_events.createRunEventFinalizer;
166
- exports.dataToUUID = require_random_id.dataToUUID;
169
+ exports.defaultGenerativeUIPromptSpec = require_prompt_spec.defaultGenerativeUIPromptSpec;
167
170
  exports.ensureStructuredError = require_errors.ensureStructuredError;
168
171
  exports.envelopeToManifest = require_a2ui_envelope.envelopeToManifest;
169
172
  exports.exceedsMaxSize = require_utils.exceedsMaxSize;
170
- exports.executeConditions = require_conditions.executeConditions;
171
173
  exports.extractRenderUIArgs = require_render_ui_args.extractRenderUIArgs;
172
174
  exports.finalizeRunEvents = require_finalize_events.finalizeRunEvents;
173
175
  exports.firstNonBlankTelemetryId = require_lambda_client.firstNonBlankTelemetryId;
@@ -176,14 +178,13 @@ exports.functionCallers = require_basic_functions.functionCallers;
176
178
  exports.generateVideoThumbnail = require_utils.generateVideoThumbnail;
177
179
  exports.generativeUIFunctionCallMessageId = require_types$1.generativeUIFunctionCallMessageId;
178
180
  exports.generativeUIGuideFeatures = require_a2ui_prompts.generativeUIGuideFeatures;
181
+ exports.generativeUIPromptFeatures = require_prompt_spec.generativeUIPromptFeatures;
179
182
  exports.generativeUISurfaceMessageId = require_types$1.generativeUISurfaceMessageId;
180
183
  exports.getDocumentIcon = require_utils.getDocumentIcon;
181
184
  exports.getModalityFromMimeType = require_utils.getModalityFromMimeType;
182
185
  exports.getOperationKind = require_validate_operation.getOperationKind;
183
186
  exports.getOperationSurfaceId = require_validate_operation.getOperationSurfaceId;
184
- exports.getPossibleVersionMismatch = require_errors.getPossibleVersionMismatch;
185
187
  exports.getSourceUrl = require_utils.getSourceUrl;
186
- exports.getZodParameters = require_json_schema.getZodParameters;
187
188
  exports.hasBoundChildRef = require_child_refs.hasBoundChildRef;
188
189
  exports.isA2UIBasicFunction = require_basic_functions.isA2UIBasicFunction;
189
190
  exports.isA2UIValueFunction = require_basic_functions.isA2UIValueFunction;
@@ -194,12 +195,9 @@ exports.isMacOS = require_index.isMacOS;
194
195
  exports.isPathBinding = require_validate_operation.isPathBinding;
195
196
  exports.isStructuredCopilotKitError = require_errors.isStructuredCopilotKitError;
196
197
  exports.isTelemetryDisabled = require_telemetry_disabled.isTelemetryDisabled;
197
- exports.isValidUUID = require_random_id.isValidUUID;
198
198
  exports.isValidationResult = require_basic_functions.isValidationResult;
199
199
  exports.jsonSchemaToActionParameters = require_json_schema.jsonSchemaToActionParameters;
200
200
  exports.lambdaClient = require_lambda_client.lambdaClient;
201
- exports.logCopilotKitPlatformMessage = require_console_styling.logCopilotKitPlatformMessage;
202
- exports.logStyled = require_console_styling.logStyled;
203
201
  exports.logger = require_logger.logger;
204
202
  exports.mapAtChildRef = require_child_refs.mapAtChildRef;
205
203
  exports.matchesAcceptFilter = require_utils.matchesAcceptFilter;
@@ -212,22 +210,26 @@ exports.parseJson = require_index.parseJson;
212
210
  exports.parseTelemetryIdFromLicense = require_lambda_client.parseTelemetryIdFromLicense;
213
211
  exports.partialJSONParse = require_index.partialJSONParse;
214
212
  exports.phoenixExponentialBackoff = require_index.phoenixExponentialBackoff;
213
+ exports.processEnv = require_process_env.processEnv;
215
214
  exports.pruneRowKeyStore = require_row_render_keys.pruneRowKeyStore;
216
- exports.publicApiKeyRequired = require_console_styling.publicApiKeyRequired;
217
215
  exports.randomId = require_random_id.randomId;
218
216
  exports.randomUUID = require_random_id.randomUUID;
219
217
  exports.readBody = require_requests.readBody;
220
218
  exports.readCopilotKitUIEnvelope = require_a2ui_envelope.readCopilotKitUIEnvelope;
221
219
  exports.readFileAsBase64 = require_utils.readFileAsBase64;
220
+ exports.renderGenerativeUIComponentList = require_schema_render.renderGenerativeUIComponentList;
221
+ exports.renderGenerativeUISchema = require_schema_render.renderGenerativeUISchema;
222
222
  exports.resolveDebugConfig = require_debug.resolveDebugConfig;
223
223
  exports.resolveRowRenderKeys = require_row_render_keys.resolveRowRenderKeys;
224
224
  exports.resolveRowRenderKeysById = require_row_render_keys.resolveRowRenderKeysById;
225
225
  exports.safeParseToolArgs = require_index.safeParseToolArgs;
226
+ exports.schemaCoverage = require_schema_render.schemaCoverage;
226
227
  exports.schemaToJsonSchema = require_standard_schema.schemaToJsonSchema;
228
+ exports.selectPromptItems = require_prompt_spec.selectPromptItems;
227
229
  exports.shouldEnableInspector = require_inspector_visibility.shouldEnableInspector;
228
230
  exports.stripIntelligenceRoutingFields = require_intelligence_routing_fields.stripIntelligenceRoutingFields;
229
- exports.styledConsole = require_console_styling.styledConsole;
230
231
  exports.toA2UIActionMessage = require_types$1.toA2UIActionMessage;
231
232
  exports.tryMap = require_index.tryMap;
232
233
  exports.validateOperation = require_validate_operation.validateOperation;
234
+ exports.ɵanySchema = require_standard_schema.ɵanySchema;
233
235
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\n// Telemetry is split deliberately. `TelemetryClient` imports\n// `@segment/analytics-node`, which imports `node-fetch`, which imports the\n// Node built-ins `stream`, `http`, `https` and `zlib`. Browser bundlers\n// resolve the whole module graph before they tree-shake, so re-exporting\n// that module here made every browser build of a dependent package print\n// \"Module ... has been externalized for browser compatibility\" warnings,\n// even when the consumer never touched telemetry (#4151). Only the\n// browser-safe telemetry surface is re-exported from this entry. Server\n// code that needs the client imports it from `@copilotkit/shared/telemetry`.\n// This mirrors the license-verifier note below.\nexport { isTelemetryDisabled } from \"./telemetry/telemetry-disabled\";\nexport * from \"./telemetry/sampling\";\n// Pure string classification with no imports, so it carries no runtime edge\n// into browser builds — same reasoning as `sampling` above.\nexport * from \"./telemetry/model-host\";\nexport {\n firstNonBlankTelemetryId,\n lambdaClient,\n parseTelemetryIdFromLicense,\n parseAndWarnTelemetryId,\n} from \"./telemetry/lambda-client\";\nexport type { LambdaSendOptions } from \"./telemetry/lambda-client\";\n// Types only: erased at build time, so they add no runtime edge to\n// `telemetry-client.ts` and therefore none to @segment/analytics-node.\nexport type {\n TelemetryCapture,\n TelemetryIdentity,\n} from \"./telemetry/telemetry-client\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport {\n createRunEventFinalizer,\n finalizeRunEvents,\n type FinalizeRunOptions,\n type RunEventFinalizer,\n} from \"./finalize-events\";\nexport { stripIntelligenceRoutingFields } from \"./intelligence-routing-fields\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n} from \"@copilotkit/license-verifier\";\n\nimport type { LicensePayload } from \"@copilotkit/license-verifier\";\nimport type {\n RuntimeEntitlementResponse,\n RuntimeLicenseStatus,\n} from \"./utils/types\";\n\n// LicenseContextValue was dropped from license-verifier's public API in\n// 0.3.0, so it is defined here. The context shape is owned by this package\n// anyway via createLicenseContextValue below.\n\n/**\n * License context value exposed to child components.\n * Frontend providers create their own context using this shape.\n */\nexport interface LicenseContextValue {\n /** Effective license status after structured entitlement precedence. Null until known. */\n status: RuntimeLicenseStatus | null;\n /** The license payload if available. Always null on the client; the payload stays server-side. */\n license: LicensePayload | null;\n /** Whether a feature is licensed. Ready entitlements override legacy status behavior. */\n checkFeature: (feature: string) => boolean;\n /** Get a numeric feature limit. Zero means unlimited; null means not applicable. */\n getLimit: (feature: string) => number | null;\n}\n\n/** Read a record value without traversing its prototype chain. */\nfunction getOwnRecordValue<Value>(\n record: Readonly<Record<string, Value>>,\n key: string,\n): Value | undefined {\n return Object.prototype.hasOwnProperty.call(record, key)\n ? record[key]\n : undefined;\n}\n\n/** Legacy UI surfaces that remain available for every active entitlement. */\nfunction isLegacyUiFeature(feature: string): boolean {\n return feature === \"chat\" || feature === \"popup\" || feature === \"sidebar\";\n}\n\n/**\n * Client-safe license context factory, driven by the license authority the\n * runtime reports via /info.\n *\n * A ready managed entitlement is authoritative in both directions. A ready\n * active self-hosted entitlement is also authoritative, while an inactive\n * self-hosted response preserves the legacy signed-license fallback. Active\n * entitlements supply feature grants and limits; authoritative inactive\n * entitlements deny every feature and limit. Older runtimes that report only a\n * status retain the legacy behavior: features are enabled unless the status is\n * \"expired\" or \"invalid\", and no limits are reported. This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on Node's\n * `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(\n status: RuntimeLicenseStatus | null | undefined,\n runtimeEntitlements?: RuntimeEntitlementResponse,\n): LicenseContextValue {\n const readyEntitlement =\n runtimeEntitlements?.status === \"ready\"\n ? runtimeEntitlements.entitlement\n : null;\n const hasUsableSelfHostedLegacyFallback =\n readyEntitlement &&\n !readyEntitlement.active &&\n readyEntitlement.source === \"selfHostedDeploymentLicense\" &&\n (status === \"valid\" || status === \"expiring\");\n const featureAuthority =\n readyEntitlement && !hasUsableSelfHostedLegacyFallback\n ? readyEntitlement\n : null;\n const activeEntitlement = featureAuthority?.active ? featureAuthority : null;\n const resolvedStatus = activeEntitlement\n ? \"valid\"\n : readyEntitlement?.source === \"managedOrgSubscription\" ||\n readyEntitlement?.source === \"awsMarketplaceDeploymentLicense\"\n ? \"none\"\n : featureAuthority\n ? (status ?? \"none\")\n : (status ?? null);\n const featuresEnabled =\n resolvedStatus !== \"expired\" && resolvedStatus !== \"invalid\";\n\n return {\n status: resolvedStatus,\n license: null,\n checkFeature: (feature) =>\n featureAuthority\n ? activeEntitlement\n ? feature === \"threads\" &&\n Object.prototype.hasOwnProperty.call(\n activeEntitlement.limits,\n \"threads.max_count\",\n )\n ? true\n : (getOwnRecordValue(activeEntitlement.features, feature) ??\n isLegacyUiFeature(feature))\n : false\n : featuresEnabled,\n getLimit: (feature) =>\n activeEntitlement\n ? (getOwnRecordValue(activeEntitlement.limits, feature) ?? null)\n : null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n ALL_GENERATIVE_UI_GUIDE_FEATURES,\n buildGenerativeUIMarkdownGuidelines,\n generativeUIGuideFeatures,\n GENERATIVE_UI_MARKDOWN_GUIDELINES,\n GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION,\n GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION,\n} from \"./a2ui-prompts\";\nexport type { GenerativeUIGuideFeatures } from \"./a2ui-prompts\";\nexport {\n COPILOTKIT_FORWARDED_PROPS_KEY,\n COPILOTKIT_UI_ENVELOPE_FORMAT,\n envelopeToManifest,\n readCopilotKitUIEnvelope,\n} from \"./a2ui-envelope\";\nexport type { CopilotKitUIEnvelope } from \"./a2ui-envelope\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n\nexport { GENERATE_SANDBOXED_UI_DESCRIPTION } from \"./open-generative-ui-prompts\";\nexport * from \"./generative-ui\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa;;AA0Cb,SAAS,kBACP,QACA,KACmB;AACnB,QAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,GACpD,OAAO,OACP;;;AAIN,SAAS,kBAAkB,SAA0B;AACnD,QAAO,YAAY,UAAU,YAAY,WAAW,YAAY;;;;;;;;;;;;;;;;AAiBlE,SAAgB,0BACd,QACA,qBACqB;CACrB,MAAM,mBACJ,qBAAqB,WAAW,UAC5B,oBAAoB,cACpB;CACN,MAAM,oCACJ,oBACA,CAAC,iBAAiB,UAClB,iBAAiB,WAAW,kCAC3B,WAAW,WAAW,WAAW;CACpC,MAAM,mBACJ,oBAAoB,CAAC,oCACjB,mBACA;CACN,MAAM,oBAAoB,kBAAkB,SAAS,mBAAmB;CACxE,MAAM,iBAAiB,oBACnB,UACA,kBAAkB,WAAW,4BAC3B,kBAAkB,WAAW,oCAC7B,SACA,mBACG,UAAU,SACV,UAAU;CACnB,MAAM,kBACJ,mBAAmB,aAAa,mBAAmB;AAErD,QAAO;EACL,QAAQ;EACR,SAAS;EACT,eAAe,YACb,mBACI,oBACE,YAAY,aACZ,OAAO,UAAU,eAAe,KAC9B,kBAAkB,QAClB,oBACD,GACC,OACC,kBAAkB,kBAAkB,UAAU,QAAQ,IACvD,kBAAkB,QAAQ,GAC5B,QACF;EACN,WAAW,YACT,oBACK,kBAAkB,kBAAkB,QAAQ,QAAQ,IAAI,OACzD;EACP"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\n// Only browser-safe telemetry helpers live here. The runtime owns its\n// telemetry client (`packages/runtime/src/runtime/telemetry`), so this package\n// imports no Node-only analytics SDK (#4151).\nexport { isTelemetryDisabled } from \"./telemetry/telemetry-disabled\";\nexport * from \"./telemetry/sampling\";\n// Pure string classification with no imports, so it carries no runtime edge\n// into browser builds — same reasoning as `sampling` above.\nexport * from \"./telemetry/model-host\";\nexport {\n firstNonBlankTelemetryId,\n lambdaClient,\n parseTelemetryIdFromLicense,\n parseAndWarnTelemetryId,\n} from \"./telemetry/lambda-client\";\nexport type { LambdaSendOptions } from \"./telemetry/lambda-client\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport {\n createRunEventFinalizer,\n finalizeRunEvents,\n type FinalizeRunOptions,\n type RunEventFinalizer,\n} from \"./finalize-events\";\nexport { stripIntelligenceRoutingFields } from \"./intelligence-routing-fields\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n} from \"@copilotkit/license-verifier\";\n\nimport type { LicensePayload } from \"@copilotkit/license-verifier\";\nimport type {\n RuntimeEntitlementResponse,\n RuntimeLicenseStatus,\n} from \"./utils/types\";\n\n// LicenseContextValue was dropped from license-verifier's public API in\n// 0.3.0, so it is defined here. The context shape is owned by this package\n// anyway via createLicenseContextValue below.\n\n/**\n * License context value exposed to child components.\n * Frontend providers create their own context using this shape.\n */\nexport interface LicenseContextValue {\n /** Effective license status after structured entitlement precedence. Null until known. */\n status: RuntimeLicenseStatus | null;\n /** The license payload if available. Always null on the client; the payload stays server-side. */\n license: LicensePayload | null;\n /** Whether a feature is licensed. Ready entitlements override legacy status behavior. */\n checkFeature: (feature: string) => boolean;\n /** Get a numeric feature limit. Zero means unlimited; null means not applicable. */\n getLimit: (feature: string) => number | null;\n}\n\n/** Read a record value without traversing its prototype chain. */\nfunction getOwnRecordValue<Value>(\n record: Readonly<Record<string, Value>>,\n key: string,\n): Value | undefined {\n return Object.prototype.hasOwnProperty.call(record, key)\n ? record[key]\n : undefined;\n}\n\n/** Legacy UI surfaces that remain available for every active entitlement. */\nfunction isLegacyUiFeature(feature: string): boolean {\n return feature === \"chat\" || feature === \"popup\" || feature === \"sidebar\";\n}\n\n/**\n * Client-safe license context factory, driven by the license authority the\n * runtime reports via /info.\n *\n * A ready managed entitlement is authoritative in both directions. A ready\n * active self-hosted entitlement is also authoritative, while an inactive\n * self-hosted response preserves the legacy signed-license fallback. Active\n * entitlements supply feature grants and limits; authoritative inactive\n * entitlements deny every feature and limit. Older runtimes that report only a\n * status retain the legacy behavior: features are enabled unless the status is\n * \"expired\" or \"invalid\", and no limits are reported. This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on Node's\n * `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(\n status: RuntimeLicenseStatus | null | undefined,\n runtimeEntitlements?: RuntimeEntitlementResponse,\n): LicenseContextValue {\n const readyEntitlement =\n runtimeEntitlements?.status === \"ready\"\n ? runtimeEntitlements.entitlement\n : null;\n const hasUsableSelfHostedLegacyFallback =\n readyEntitlement &&\n !readyEntitlement.active &&\n readyEntitlement.source === \"selfHostedDeploymentLicense\" &&\n (status === \"valid\" || status === \"expiring\");\n const featureAuthority =\n readyEntitlement && !hasUsableSelfHostedLegacyFallback\n ? readyEntitlement\n : null;\n const activeEntitlement = featureAuthority?.active ? featureAuthority : null;\n const resolvedStatus = activeEntitlement\n ? \"valid\"\n : readyEntitlement?.source === \"managedOrgSubscription\" ||\n readyEntitlement?.source === \"awsMarketplaceDeploymentLicense\"\n ? \"none\"\n : featureAuthority\n ? (status ?? \"none\")\n : (status ?? null);\n const featuresEnabled =\n resolvedStatus !== \"expired\" && resolvedStatus !== \"invalid\";\n\n return {\n status: resolvedStatus,\n license: null,\n checkFeature: (feature) =>\n featureAuthority\n ? activeEntitlement\n ? feature === \"threads\" &&\n Object.prototype.hasOwnProperty.call(\n activeEntitlement.limits,\n \"threads.max_count\",\n )\n ? true\n : (getOwnRecordValue(activeEntitlement.features, feature) ??\n isLegacyUiFeature(feature))\n : false\n : featuresEnabled,\n getLimit: (feature) =>\n activeEntitlement\n ? (getOwnRecordValue(activeEntitlement.limits, feature) ?? null)\n : null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n ALL_GENERATIVE_UI_GUIDE_FEATURES,\n buildGenerativeUIMarkdownGuidelines,\n generativeUIGuideFeatures,\n GENERATIVE_UI_MARKDOWN_GUIDELINES,\n GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION,\n GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION,\n} from \"./a2ui-prompts\";\nexport type { GenerativeUIGuideFeatures } from \"./a2ui-prompts\";\nexport {\n COPILOTKIT_FORWARDED_PROPS_KEY,\n COPILOTKIT_UI_ENVELOPE_FORMAT,\n envelopeToManifest,\n readCopilotKitUIEnvelope,\n} from \"./a2ui-envelope\";\nexport type { CopilotKitUIEnvelope } from \"./a2ui-envelope\";\n\nexport type { DebugEventEnvelope } from \"./debug-event-envelope\";\n\nexport { GENERATE_SANDBOXED_UI_DESCRIPTION } from \"./open-generative-ui-prompts\";\nexport * from \"./generative-ui\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa;;AA0Cb,SAAS,kBACP,QACA,KACmB;AACnB,QAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,GACpD,OAAO,OACP;;;AAIN,SAAS,kBAAkB,SAA0B;AACnD,QAAO,YAAY,UAAU,YAAY,WAAW,YAAY;;;;;;;;;;;;;;;;AAiBlE,SAAgB,0BACd,QACA,qBACqB;CACrB,MAAM,mBACJ,qBAAqB,WAAW,UAC5B,oBAAoB,cACpB;CACN,MAAM,oCACJ,oBACA,CAAC,iBAAiB,UAClB,iBAAiB,WAAW,kCAC3B,WAAW,WAAW,WAAW;CACpC,MAAM,mBACJ,oBAAoB,CAAC,oCACjB,mBACA;CACN,MAAM,oBAAoB,kBAAkB,SAAS,mBAAmB;CACxE,MAAM,iBAAiB,oBACnB,UACA,kBAAkB,WAAW,4BAC3B,kBAAkB,WAAW,oCAC7B,SACA,mBACG,UAAU,SACV,UAAU;CACnB,MAAM,kBACJ,mBAAmB,aAAa,mBAAmB;AAErD,QAAO;EACL,QAAQ;EACR,SAAS;EACT,eAAe,YACb,mBACI,oBACE,YAAY,aACZ,OAAO,UAAU,eAAe,KAC9B,kBAAkB,QAClB,oBACD,GACC,OACC,kBAAkB,kBAAkB,UAAU,QAAQ,IACvD,kBAAkB,QAAQ,GAC5B,QACF;EACN,WAAW,YACT,oBACK,kBAAkB,kBAAkB,QAAQ,QAAQ,IAAI,OACzD;EACP"}
package/dist/index.d.cts CHANGED
@@ -3,17 +3,16 @@ import { Action, MappedParameterTypes, Parameter } from "./types/action.cjs";
3
3
  import { CopilotCloudConfig } from "./types/copilot-cloud-config.cjs";
4
4
  import { PartialBy, RequiredBy } from "./types/utility.cjs";
5
5
  import { CopilotErrorEvent, CopilotErrorHandler, CopilotRequestContext } from "./types/error.cjs";
6
- import { AIMessage, ActivityMessage, AudioInputPart, DeveloperMessage, DocumentInputPart, ImageData, ImageInputPart, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, Message, ReasoningMessage, Role, SystemMessage, TextInputPart, ToolCall, ToolResult, UserMessage, VideoInputPart } from "./types/message.cjs";
6
+ import { AIMessage, ActivityMessage, AudioInputPart, DeveloperMessage, DocumentInputPart, ImageInputPart, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, Message, ReasoningMessage, Role, SystemMessage, TextInputPart, ToolCall, ToolResult, UserMessage, VideoInputPart } from "./types/message.cjs";
7
7
  import { copyToClipboard } from "./utils/clipboard.cjs";
8
- import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions } from "./utils/conditions.cjs";
9
- import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.cjs";
10
- import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.cjs";
11
- import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.cjs";
8
+ import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitErrorExtensions, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, isStructuredCopilotKitError } from "./utils/errors.cjs";
9
+ import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, jsonSchemaToActionParameters } from "./utils/json-schema.cjs";
12
10
  import { InspectorMetadataV1, parseInspectorMetadataV1 } from "./utils/inspector-metadata.cjs";
13
11
  import { InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl } from "./utils/inspector-learning.cjs";
14
12
  import { InspectorVisibilityOptions, shouldEnableInspector } from "./utils/inspector-visibility.cjs";
15
13
  import { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SingleRouteRuntimeInfo, ThreadEndpointRuntimeInfo } from "./utils/types.cjs";
16
- import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.cjs";
14
+ import { randomId, randomUUID } from "./utils/random-id.cjs";
15
+ import { processEnv } from "./utils/process-env.cjs";
17
16
  import { readBody } from "./utils/requests.cjs";
18
17
  import { RowKeyStore, commitRowKeyStore, createRowKeyStore, pruneRowKeyStore, resolveRowRenderKeys, resolveRowRenderKeysById } from "./utils/row-render-keys.cjs";
19
18
  import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.cjs";
@@ -22,9 +21,8 @@ import { isTelemetryDisabled } from "./telemetry/telemetry-disabled.cjs";
22
21
  import { SamplingMeta, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SURFACE_V1, TELEMETRY_SURFACE_V2, TelemetryEmitter, TelemetrySurface, TelemetryTransport, UNSAMPLED_RATE, computeSamplingMeta } from "./telemetry/sampling.cjs";
23
22
  import { MODEL_HOST_CLASSES, ModelHostClass, classifyModelHost } from "./telemetry/model-host.cjs";
24
23
  import { LambdaSendOptions, firstNonBlankTelemetryId, lambdaClient, parseAndWarnTelemetryId, parseTelemetryIdFromLicense } from "./telemetry/lambda-client.cjs";
25
- import { TelemetryCapture, TelemetryIdentity } from "./telemetry/telemetry-client.cjs";
26
24
  import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.cjs";
27
- import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.cjs";
25
+ import { InferSchemaOutput, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema, ɵanySchema } from "./standard-schema.cjs";
28
26
  import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.cjs";
29
27
  import { createAttachmentContent } from "./attachments/content.cjs";
30
28
  import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.cjs";
@@ -34,6 +32,7 @@ import { stripIntelligenceRoutingFields } from "./intelligence-routing-fields.cj
34
32
  import { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors } from "./transcription-errors.cjs";
35
33
  import { A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_INDEX_FUNCTION, COPILOTKIT_FUNCTIONS, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, functionCallers, isA2UIBasicFunction, isA2UIValueFunction, isCallBinding, isValidationResult } from "./generative-ui/basic-functions.cjs";
36
34
  import { A2UIActionMessage, A2UIComponentNode, A2UIFunctionCall, A2UIOperation, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_VERSION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, generativeUIFunctionCallMessageId, generativeUISurfaceMessageId, toA2UIActionMessage } from "./generative-ui/types.cjs";
35
+ import { GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUISchemaSettings, defaultGenerativeUIPromptSpec, generativeUIPromptFeatures, selectPromptItems } from "./generative-ui/prompt-spec.cjs";
37
36
  import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, ALL_GENERATIVE_UI_GUIDE_FEATURES, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GenerativeUIGuideFeatures, buildGenerativeUIMarkdownGuidelines, generativeUIGuideFeatures } from "./a2ui-prompts.cjs";
38
37
  import { COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_UI_ENVELOPE_FORMAT, CopilotKitUIEnvelope, envelopeToManifest, readCopilotKitUIEnvelope } from "./a2ui-envelope.cjs";
39
38
  import { DebugEventEnvelope } from "./debug-event-envelope.cjs";
@@ -42,6 +41,8 @@ import { AllowedComponents, OperationKind, OperationValidation, ValidateOperatio
42
41
  import { ExtractedRenderUIArgs, RenderUIArgsStream, extractRenderUIArgs } from "./generative-ui/render-ui-args.cjs";
43
42
  import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, ChildRef, ChildRefKind, applyChildRefMarks, childIdsAtRefs, childRefKind, collectChildRefs, hasBoundChildRef, mapAtChildRef } from "./generative-ui/child-refs.cjs";
44
43
  import { GENERATIVE_UI_CONTEXT_DESCRIPTION, buildGenerativeUIPrompt } from "./generative-ui/prompt.cjs";
44
+ import { buildCompactGenerativeUISchema } from "./generative-ui/compact-schema.cjs";
45
+ import { applyDescriptionOverrides, renderGenerativeUIComponentList, renderGenerativeUISchema, schemaCoverage } from "./generative-ui/schema-render.cjs";
45
46
  import { LicenseChecker, LicenseFeatures, LicenseOwner, LicensePayload, LicensePayload as LicensePayload$1, LicenseStatus, LicenseTier } from "@copilotkit/license-verifier";
46
47
 
47
48
  //#region src/index.d.ts
@@ -76,5 +77,5 @@ interface LicenseContextValue {
76
77
  */
77
78
  declare function createLicenseContextValue(status: RuntimeLicenseStatus | null | undefined, runtimeEntitlements?: RuntimeEntitlementResponse): LicenseContextValue;
78
79
  //#endregion
79
- export { A2UIActionMessage, A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIComponentNode, A2UIFunctionCall, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, A2UIRuntimeInfo, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_INDEX_FUNCTION, A2UI_VERSION, AG_UI_CHANNEL_EVENT, AIMessage, ALL_GENERATIVE_UI_GUIDE_FEATURES, Action, ActivityMessage, AgentDescription, AllowedComponents, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_FUNCTIONS, COPILOTKIT_UI_ENVELOPE_FORMAT, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ChildRef, ChildRefKind, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, type CopilotKitUIEnvelope, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, type DebugEventEnvelope, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, ExtractedRenderUIArgs, type FinalizeRunOptions, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_CONTEXT_DESCRIPTION, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, type GenerativeUIGuideFeatures, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, InspectorMetadataV1, InspectorVisibilityOptions, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LambdaSendOptions, type LicenseChecker, LicenseContextValue, type LicenseFeatures, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MODEL_HOST_CLASSES, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, ModelHostClass, NonEmptyRecord, OperationKind, OperationValidation, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RenderUIArgsStream, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, RowKeyStore, Rule, type RunEventFinalizer, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SamplingMeta, SchemaToJsonSchemaOptions, Severity, SingleRouteRuntimeInfo, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SURFACE_V1, TELEMETRY_SURFACE_V2, THREAD_ALREADY_RUNNING_ERROR_CODE, type TelemetryCapture, TelemetryEmitter, type TelemetryIdentity, TelemetrySurface, TelemetryTransport, TextInputPart, ThreadEndpointRuntimeInfo, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UNSAMPLED_RATE, UpgradeRequiredError, UserMessage, ValidateOperationOptions, VideoInputPart, actionParametersToJsonSchema, applyChildRefMarks, buildGenerativeUIMarkdownGuidelines, buildGenerativeUIPrompt, callerProblem, childIdsAtRefs, childRefKind, classifyModelHost, collectChildRefs, commitRowKeyStore, computeSamplingMeta, convertJsonSchemaToZodSchema, copyToClipboard, createAttachmentContent, createLicenseContextValue, createRowKeyStore, createRunEventFinalizer, dataToUUID, ensureStructuredError, envelopeToManifest, exceedsMaxSize, executeConditions, extractRenderUIArgs, finalizeRunEvents, firstNonBlankTelemetryId, formatFileSize, functionCallers, generateVideoThumbnail, generativeUIFunctionCallMessageId, generativeUIGuideFeatures, generativeUISurfaceMessageId, getDocumentIcon, getModalityFromMimeType, getOperationKind, getOperationSurfaceId, getPossibleVersionMismatch, getSourceUrl, getZodParameters, hasBoundChildRef, isA2UIBasicFunction, isA2UIValueFunction, isActionBinding, isCallBinding, isIndexCall, isMacOS, isPathBinding, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, isValidationResult, jsonSchemaToActionParameters, lambdaClient, logCopilotKitPlatformMessage, logStyled, logger, mapAtChildRef, matchesAcceptFilter, parseAndWarnTelemetryId, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, pruneRowKeyStore, publicApiKeyRequired, randomId, randomUUID, readBody, readCopilotKitUIEnvelope, readFileAsBase64, resolveDebugConfig, resolveRowRenderKeys, resolveRowRenderKeysById, safeParseToolArgs, schemaToJsonSchema, shouldEnableInspector, stripIntelligenceRoutingFields, styledConsole, toA2UIActionMessage, tryMap, validateOperation };
80
+ export { A2UIActionMessage, A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIComponentNode, A2UIFunctionCall, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, A2UIRuntimeInfo, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_INDEX_FUNCTION, A2UI_VERSION, AG_UI_CHANNEL_EVENT, AIMessage, ALL_GENERATIVE_UI_GUIDE_FEATURES, Action, ActivityMessage, AgentDescription, AllowedComponents, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_FUNCTIONS, COPILOTKIT_UI_ENVELOPE_FORMAT, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ChildRef, ChildRefKind, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ConfigurationError, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitErrorExtensions, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, type CopilotKitUIEnvelope, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, type DebugEventEnvelope, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExtractedRenderUIArgs, type FinalizeRunOptions, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_CONTEXT_DESCRIPTION, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, type GenerativeUIGuideFeatures, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUIRejectedOperation, GenerativeUISchemaSettings, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, InspectorMetadataV1, InspectorVisibilityOptions, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LambdaSendOptions, type LicenseChecker, LicenseContextValue, type LicenseFeatures, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, MODEL_HOST_CLASSES, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, ModelHostClass, NonEmptyRecord, OperationKind, OperationValidation, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RenderUIArgsStream, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, RowKeyStore, type RunEventFinalizer, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SamplingMeta, Severity, SingleRouteRuntimeInfo, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SURFACE_V1, TELEMETRY_SURFACE_V2, THREAD_ALREADY_RUNNING_ERROR_CODE, TelemetryEmitter, TelemetrySurface, TelemetryTransport, TextInputPart, ThreadEndpointRuntimeInfo, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UNSAMPLED_RATE, UpgradeRequiredError, UserMessage, ValidateOperationOptions, VideoInputPart, actionParametersToJsonSchema, applyChildRefMarks, applyDescriptionOverrides, buildCompactGenerativeUISchema, buildGenerativeUIMarkdownGuidelines, buildGenerativeUIPrompt, callerProblem, childIdsAtRefs, childRefKind, classifyModelHost, collectChildRefs, commitRowKeyStore, computeSamplingMeta, copyToClipboard, createAttachmentContent, createLicenseContextValue, createRowKeyStore, createRunEventFinalizer, defaultGenerativeUIPromptSpec, ensureStructuredError, envelopeToManifest, exceedsMaxSize, extractRenderUIArgs, finalizeRunEvents, firstNonBlankTelemetryId, formatFileSize, functionCallers, generateVideoThumbnail, generativeUIFunctionCallMessageId, generativeUIGuideFeatures, generativeUIPromptFeatures, generativeUISurfaceMessageId, getDocumentIcon, getModalityFromMimeType, getOperationKind, getOperationSurfaceId, getSourceUrl, hasBoundChildRef, isA2UIBasicFunction, isA2UIValueFunction, isActionBinding, isCallBinding, isIndexCall, isMacOS, isPathBinding, isStructuredCopilotKitError, isTelemetryDisabled, isValidationResult, jsonSchemaToActionParameters, lambdaClient, logger, mapAtChildRef, matchesAcceptFilter, parseAndWarnTelemetryId, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, processEnv, pruneRowKeyStore, randomId, randomUUID, readBody, readCopilotKitUIEnvelope, readFileAsBase64, renderGenerativeUIComponentList, renderGenerativeUISchema, resolveDebugConfig, resolveRowRenderKeys, resolveRowRenderKeysById, safeParseToolArgs, schemaCoverage, schemaToJsonSchema, selectPromptItems, shouldEnableInspector, stripIntelligenceRoutingFields, toA2UIActionMessage, tryMap, validateOperation, ɵanySchema };
80
81
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmDa,kBAAA;;;;;UA8BI,mBAAA;;EAEf,MAAA,EAAQ,oBAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;;;;;;;;;;;;AAtCb;iBAsEgB,yBAAA,CACd,MAAA,EAAQ,oBAAA,qBACR,mBAAA,GAAsB,0BAAA,GACrB,mBAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCa,kBAAA;;;;;UA8BI,mBAAA;;EAEf,MAAA,EAAQ,oBAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;;;;;;;;;;;;;iBAgCG,yBAAA,CACd,MAAA,EAAQ,oBAAA,qBACR,mBAAA,GAAsB,0BAAA,GACrB,mBAAA"}
package/dist/index.d.mts CHANGED
@@ -3,17 +3,16 @@ import { Action, MappedParameterTypes, Parameter } from "./types/action.mjs";
3
3
  import { CopilotCloudConfig } from "./types/copilot-cloud-config.mjs";
4
4
  import { PartialBy, RequiredBy } from "./types/utility.mjs";
5
5
  import { CopilotErrorEvent, CopilotErrorHandler, CopilotRequestContext } from "./types/error.mjs";
6
- import { AIMessage, ActivityMessage, AudioInputPart, DeveloperMessage, DocumentInputPart, ImageData, ImageInputPart, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, Message, ReasoningMessage, Role, SystemMessage, TextInputPart, ToolCall, ToolResult, UserMessage, VideoInputPart } from "./types/message.mjs";
6
+ import { AIMessage, ActivityMessage, AudioInputPart, DeveloperMessage, DocumentInputPart, ImageInputPart, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, Message, ReasoningMessage, Role, SystemMessage, TextInputPart, ToolCall, ToolResult, UserMessage, VideoInputPart } from "./types/message.mjs";
7
7
  import { copyToClipboard } from "./utils/clipboard.mjs";
8
- import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions } from "./utils/conditions.mjs";
9
- import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./utils/console-styling.mjs";
10
- import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./utils/errors.mjs";
11
- import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./utils/json-schema.mjs";
8
+ import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitErrorExtensions, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, isStructuredCopilotKitError } from "./utils/errors.mjs";
9
+ import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, jsonSchemaToActionParameters } from "./utils/json-schema.mjs";
12
10
  import { InspectorMetadataV1, parseInspectorMetadataV1 } from "./utils/inspector-metadata.mjs";
13
11
  import { InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl } from "./utils/inspector-learning.mjs";
14
12
  import { InspectorVisibilityOptions, shouldEnableInspector } from "./utils/inspector-visibility.mjs";
15
13
  import { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SingleRouteRuntimeInfo, ThreadEndpointRuntimeInfo } from "./utils/types.mjs";
16
- import { dataToUUID, isValidUUID, randomId, randomUUID } from "./utils/random-id.mjs";
14
+ import { randomId, randomUUID } from "./utils/random-id.mjs";
15
+ import { processEnv } from "./utils/process-env.mjs";
17
16
  import { readBody } from "./utils/requests.mjs";
18
17
  import { RowKeyStore, commitRowKeyStore, createRowKeyStore, pruneRowKeyStore, resolveRowRenderKeys, resolveRowRenderKeysById } from "./utils/row-render-keys.mjs";
19
18
  import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safeParseToolArgs, tryMap } from "./utils/index.mjs";
@@ -22,9 +21,8 @@ import { isTelemetryDisabled } from "./telemetry/telemetry-disabled.mjs";
22
21
  import { SamplingMeta, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SURFACE_V1, TELEMETRY_SURFACE_V2, TelemetryEmitter, TelemetrySurface, TelemetryTransport, UNSAMPLED_RATE, computeSamplingMeta } from "./telemetry/sampling.mjs";
23
22
  import { MODEL_HOST_CLASSES, ModelHostClass, classifyModelHost } from "./telemetry/model-host.mjs";
24
23
  import { LambdaSendOptions, firstNonBlankTelemetryId, lambdaClient, parseAndWarnTelemetryId, parseTelemetryIdFromLicense } from "./telemetry/lambda-client.mjs";
25
- import { TelemetryCapture, TelemetryIdentity } from "./telemetry/telemetry-client.mjs";
26
24
  import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.mjs";
27
- import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.mjs";
25
+ import { InferSchemaOutput, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema, ɵanySchema } from "./standard-schema.mjs";
28
26
  import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.mjs";
29
27
  import { createAttachmentContent } from "./attachments/content.mjs";
30
28
  import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs";
@@ -34,6 +32,7 @@ import { stripIntelligenceRoutingFields } from "./intelligence-routing-fields.mj
34
32
  import { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors } from "./transcription-errors.mjs";
35
33
  import { A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_INDEX_FUNCTION, COPILOTKIT_FUNCTIONS, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, functionCallers, isA2UIBasicFunction, isA2UIValueFunction, isCallBinding, isValidationResult } from "./generative-ui/basic-functions.mjs";
36
34
  import { A2UIActionMessage, A2UIComponentNode, A2UIFunctionCall, A2UIOperation, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_VERSION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, generativeUIFunctionCallMessageId, generativeUISurfaceMessageId, toA2UIActionMessage } from "./generative-ui/types.mjs";
35
+ import { GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUISchemaSettings, defaultGenerativeUIPromptSpec, generativeUIPromptFeatures, selectPromptItems } from "./generative-ui/prompt-spec.mjs";
37
36
  import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, ALL_GENERATIVE_UI_GUIDE_FEATURES, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GenerativeUIGuideFeatures, buildGenerativeUIMarkdownGuidelines, generativeUIGuideFeatures } from "./a2ui-prompts.mjs";
38
37
  import { COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_UI_ENVELOPE_FORMAT, CopilotKitUIEnvelope, envelopeToManifest, readCopilotKitUIEnvelope } from "./a2ui-envelope.mjs";
39
38
  import { DebugEventEnvelope } from "./debug-event-envelope.mjs";
@@ -42,6 +41,8 @@ import { AllowedComponents, OperationKind, OperationValidation, ValidateOperatio
42
41
  import { ExtractedRenderUIArgs, RenderUIArgsStream, extractRenderUIArgs } from "./generative-ui/render-ui-args.mjs";
43
42
  import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, ChildRef, ChildRefKind, applyChildRefMarks, childIdsAtRefs, childRefKind, collectChildRefs, hasBoundChildRef, mapAtChildRef } from "./generative-ui/child-refs.mjs";
44
43
  import { GENERATIVE_UI_CONTEXT_DESCRIPTION, buildGenerativeUIPrompt } from "./generative-ui/prompt.mjs";
44
+ import { buildCompactGenerativeUISchema } from "./generative-ui/compact-schema.mjs";
45
+ import { applyDescriptionOverrides, renderGenerativeUIComponentList, renderGenerativeUISchema, schemaCoverage } from "./generative-ui/schema-render.mjs";
45
46
  import { LicenseChecker, LicenseFeatures, LicenseOwner, LicensePayload, LicensePayload as LicensePayload$1, LicenseStatus, LicenseTier } from "@copilotkit/license-verifier";
46
47
 
47
48
  //#region src/index.d.ts
@@ -76,5 +77,5 @@ interface LicenseContextValue {
76
77
  */
77
78
  declare function createLicenseContextValue(status: RuntimeLicenseStatus | null | undefined, runtimeEntitlements?: RuntimeEntitlementResponse): LicenseContextValue;
78
79
  //#endregion
79
- export { A2UIActionMessage, A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIComponentNode, A2UIFunctionCall, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, A2UIRuntimeInfo, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_INDEX_FUNCTION, A2UI_VERSION, AG_UI_CHANNEL_EVENT, AIMessage, ALL_GENERATIVE_UI_GUIDE_FEATURES, Action, ActivityMessage, AgentDescription, AllowedComponents, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_FUNCTIONS, COPILOTKIT_UI_ENVELOPE_FORMAT, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ChildRef, ChildRefKind, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, type CopilotKitUIEnvelope, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, type DebugEventEnvelope, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, ExtractedRenderUIArgs, type FinalizeRunOptions, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_CONTEXT_DESCRIPTION, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, type GenerativeUIGuideFeatures, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIRejectedOperation, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, InspectorMetadataV1, InspectorVisibilityOptions, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LambdaSendOptions, type LicenseChecker, LicenseContextValue, type LicenseFeatures, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MODEL_HOST_CLASSES, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, ModelHostClass, NonEmptyRecord, OperationKind, OperationValidation, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RenderUIArgsStream, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, RowKeyStore, Rule, type RunEventFinalizer, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SamplingMeta, SchemaToJsonSchemaOptions, Severity, SingleRouteRuntimeInfo, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SURFACE_V1, TELEMETRY_SURFACE_V2, THREAD_ALREADY_RUNNING_ERROR_CODE, type TelemetryCapture, TelemetryEmitter, type TelemetryIdentity, TelemetrySurface, TelemetryTransport, TextInputPart, ThreadEndpointRuntimeInfo, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UNSAMPLED_RATE, UpgradeRequiredError, UserMessage, ValidateOperationOptions, VideoInputPart, actionParametersToJsonSchema, applyChildRefMarks, buildGenerativeUIMarkdownGuidelines, buildGenerativeUIPrompt, callerProblem, childIdsAtRefs, childRefKind, classifyModelHost, collectChildRefs, commitRowKeyStore, computeSamplingMeta, convertJsonSchemaToZodSchema, copyToClipboard, createAttachmentContent, createLicenseContextValue, createRowKeyStore, createRunEventFinalizer, dataToUUID, ensureStructuredError, envelopeToManifest, exceedsMaxSize, executeConditions, extractRenderUIArgs, finalizeRunEvents, firstNonBlankTelemetryId, formatFileSize, functionCallers, generateVideoThumbnail, generativeUIFunctionCallMessageId, generativeUIGuideFeatures, generativeUISurfaceMessageId, getDocumentIcon, getModalityFromMimeType, getOperationKind, getOperationSurfaceId, getPossibleVersionMismatch, getSourceUrl, getZodParameters, hasBoundChildRef, isA2UIBasicFunction, isA2UIValueFunction, isActionBinding, isCallBinding, isIndexCall, isMacOS, isPathBinding, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, isValidationResult, jsonSchemaToActionParameters, lambdaClient, logCopilotKitPlatformMessage, logStyled, logger, mapAtChildRef, matchesAcceptFilter, parseAndWarnTelemetryId, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, pruneRowKeyStore, publicApiKeyRequired, randomId, randomUUID, readBody, readCopilotKitUIEnvelope, readFileAsBase64, resolveDebugConfig, resolveRowRenderKeys, resolveRowRenderKeysById, safeParseToolArgs, schemaToJsonSchema, shouldEnableInspector, stripIntelligenceRoutingFields, styledConsole, toA2UIActionMessage, tryMap, validateOperation };
80
+ export { A2UIActionMessage, A2UIAllowedCallers, A2UIBasicFunctionInfo, A2UIComponentNode, A2UIFunctionCall, A2UIFunctionPermissions, A2UIFunctionReturnType, A2UIOperation, A2UIRuntimeInfo, A2UIValidationResult, A2UIValidationSeverity, A2UI_BASIC_FUNCTIONS, A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_INDEX_FUNCTION, A2UI_VERSION, AG_UI_CHANNEL_EVENT, AIMessage, ALL_GENERATIVE_UI_GUIDE_FEATURES, Action, ActivityMessage, AgentDescription, AllowedComponents, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_FUNCTIONS, COPILOTKIT_UI_ENVELOPE_FORMAT, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ChildRef, ChildRefKind, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ConfigurationError, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitErrorExtensions, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, type CopilotKitUIEnvelope, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, type DebugEventEnvelope, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExtractedRenderUIArgs, type FinalizeRunOptions, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_CONTEXT_DESCRIPTION, GENERATIVE_UI_DEFAULT_ALLOWED_CALLERS, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MARKDOWN_GUIDELINES, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GENERATIVE_UI_MARKDOWN_WHEN_TO_SHOW, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, GENERATIVE_UI_RENDER_TOOL, GENERATIVE_UI_ROOT_ID, GENERATIVE_UI_WHEN_TO_SHOW, GUIDE_COMPONENTS, GenerativeUIActionBinding, GenerativeUIComponentManifest, GenerativeUIFunctionCallContent, GenerativeUIFunctionManifest, type GenerativeUIGuideFeatures, GenerativeUIJSONSchema, GenerativeUIManifest, GenerativeUIPromptFeature, GenerativeUIPromptFeatures, GenerativeUIPromptItem, GenerativeUIPromptSection, GenerativeUIPromptSpec, GenerativeUIRejectedOperation, GenerativeUISchemaSettings, GenerativeUISurfaceContent, GenerativeUISurfaceStatus, GenerativeUISurfaceSummary, GenerativeUITarget, GenerativeUITemplateChildren, GenerativeUIUserEvent, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, InspectorMetadataV1, InspectorVisibilityOptions, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LambdaSendOptions, type LicenseChecker, LicenseContextValue, type LicenseFeatures, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, MODEL_HOST_CLASSES, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, ModelHostClass, NonEmptyRecord, OperationKind, OperationValidation, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RenderUIArgsStream, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, RowKeyStore, type RunEventFinalizer, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SamplingMeta, Severity, SingleRouteRuntimeInfo, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TELEMETRY_EMITTER_V1, TELEMETRY_EMITTER_V2, TELEMETRY_SURFACE_V1, TELEMETRY_SURFACE_V2, THREAD_ALREADY_RUNNING_ERROR_CODE, TelemetryEmitter, TelemetrySurface, TelemetryTransport, TextInputPart, ThreadEndpointRuntimeInfo, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UNSAMPLED_RATE, UpgradeRequiredError, UserMessage, ValidateOperationOptions, VideoInputPart, actionParametersToJsonSchema, applyChildRefMarks, applyDescriptionOverrides, buildCompactGenerativeUISchema, buildGenerativeUIMarkdownGuidelines, buildGenerativeUIPrompt, callerProblem, childIdsAtRefs, childRefKind, classifyModelHost, collectChildRefs, commitRowKeyStore, computeSamplingMeta, copyToClipboard, createAttachmentContent, createLicenseContextValue, createRowKeyStore, createRunEventFinalizer, defaultGenerativeUIPromptSpec, ensureStructuredError, envelopeToManifest, exceedsMaxSize, extractRenderUIArgs, finalizeRunEvents, firstNonBlankTelemetryId, formatFileSize, functionCallers, generateVideoThumbnail, generativeUIFunctionCallMessageId, generativeUIGuideFeatures, generativeUIPromptFeatures, generativeUISurfaceMessageId, getDocumentIcon, getModalityFromMimeType, getOperationKind, getOperationSurfaceId, getSourceUrl, hasBoundChildRef, isA2UIBasicFunction, isA2UIValueFunction, isActionBinding, isCallBinding, isIndexCall, isMacOS, isPathBinding, isStructuredCopilotKitError, isTelemetryDisabled, isValidationResult, jsonSchemaToActionParameters, lambdaClient, logger, mapAtChildRef, matchesAcceptFilter, parseAndWarnTelemetryId, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl, parseInspectorMetadataV1, parseJson, parseTelemetryIdFromLicense, partialJSONParse, phoenixExponentialBackoff, processEnv, pruneRowKeyStore, randomId, randomUUID, readBody, readCopilotKitUIEnvelope, readFileAsBase64, renderGenerativeUIComponentList, renderGenerativeUISchema, resolveDebugConfig, resolveRowRenderKeys, resolveRowRenderKeysById, safeParseToolArgs, schemaCoverage, schemaToJsonSchema, selectPromptItems, shouldEnableInspector, stripIntelligenceRoutingFields, toA2UIActionMessage, tryMap, validateOperation, ɵanySchema };
80
81
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmDa,kBAAA;;;;;UA8BI,mBAAA;;EAEf,MAAA,EAAQ,oBAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;;;;;;;;;;;;AAtCb;iBAsEgB,yBAAA,CACd,MAAA,EAAQ,oBAAA,qBACR,mBAAA,GAAsB,0BAAA,GACrB,mBAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCa,kBAAA;;;;;UA8BI,mBAAA;;EAEf,MAAA,EAAQ,oBAAA;;EAER,OAAA,EAAS,gBAAA;;EAET,YAAA,GAAe,OAAA;;EAEf,QAAA,GAAW,OAAA;AAAA;;;;;;;;;;;;;;;iBAgCG,yBAAA,CACd,MAAA,EAAQ,oBAAA,qBACR,mBAAA,GAAsB,0BAAA,GACrB,mBAAA"}