@copilotkit/shared 2.0.0-rc.4 → 2.0.0-rc.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -15
- package/dist/a2ui-envelope.cjs +2 -2
- package/dist/a2ui-envelope.cjs.map +1 -1
- package/dist/a2ui-envelope.d.cts +1 -1
- package/dist/a2ui-envelope.d.cts.map +1 -1
- package/dist/a2ui-envelope.d.mts +1 -1
- package/dist/a2ui-envelope.d.mts.map +1 -1
- package/dist/a2ui-envelope.mjs +2 -2
- package/dist/a2ui-envelope.mjs.map +1 -1
- package/dist/a2ui-prompts.cjs +21 -62
- package/dist/a2ui-prompts.cjs.map +1 -1
- package/dist/a2ui-prompts.d.cts +8 -1
- package/dist/a2ui-prompts.d.cts.map +1 -1
- package/dist/a2ui-prompts.d.mts +8 -1
- package/dist/a2ui-prompts.d.mts.map +1 -1
- package/dist/a2ui-prompts.mjs +22 -62
- package/dist/a2ui-prompts.mjs.map +1 -1
- package/dist/attachments/types.d.cts +1 -3
- package/dist/attachments/types.d.cts.map +1 -1
- package/dist/attachments/types.d.mts +1 -3
- package/dist/attachments/types.d.mts.map +1 -1
- package/dist/attachments/utils.cjs +16 -5
- package/dist/attachments/utils.cjs.map +1 -1
- package/dist/attachments/utils.d.cts +3 -1
- package/dist/attachments/utils.d.cts.map +1 -1
- package/dist/attachments/utils.d.mts +3 -1
- package/dist/attachments/utils.d.mts.map +1 -1
- package/dist/attachments/utils.mjs +16 -5
- package/dist/attachments/utils.mjs.map +1 -1
- package/dist/finalize-events.cjs +16 -0
- package/dist/finalize-events.cjs.map +1 -1
- package/dist/finalize-events.d.cts.map +1 -1
- package/dist/finalize-events.d.mts.map +1 -1
- package/dist/finalize-events.mjs +16 -0
- package/dist/finalize-events.mjs.map +1 -1
- package/dist/generative-ui/basic-functions.cjs +1 -1
- package/dist/generative-ui/basic-functions.cjs.map +1 -1
- package/dist/generative-ui/basic-functions.mjs +1 -1
- package/dist/generative-ui/basic-functions.mjs.map +1 -1
- package/dist/generative-ui/catalog/catalog-export.cjs +329 -0
- package/dist/generative-ui/catalog/catalog-export.cjs.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.d.cts +92 -0
- package/dist/generative-ui/catalog/catalog-export.d.cts.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.d.mts +92 -0
- package/dist/generative-ui/catalog/catalog-export.d.mts.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.mjs +328 -0
- package/dist/generative-ui/catalog/catalog-export.mjs.map +1 -0
- package/dist/generative-ui/catalog/catalog.cjs +315 -0
- package/dist/generative-ui/catalog/catalog.cjs.map +1 -0
- package/dist/generative-ui/catalog/catalog.d.cts +407 -0
- package/dist/generative-ui/catalog/catalog.d.cts.map +1 -0
- package/dist/generative-ui/catalog/catalog.d.mts +407 -0
- package/dist/generative-ui/catalog/catalog.d.mts.map +1 -0
- package/dist/generative-ui/catalog/catalog.mjs +312 -0
- package/dist/generative-ui/catalog/catalog.mjs.map +1 -0
- package/dist/generative-ui/catalog/errors.cjs +13 -0
- package/dist/generative-ui/catalog/errors.cjs.map +1 -0
- package/dist/generative-ui/catalog/errors.d.cts +46 -0
- package/dist/generative-ui/catalog/errors.d.cts.map +1 -0
- package/dist/generative-ui/catalog/errors.d.mts +46 -0
- package/dist/generative-ui/catalog/errors.d.mts.map +1 -0
- package/dist/generative-ui/catalog/errors.mjs +12 -0
- package/dist/generative-ui/catalog/errors.mjs.map +1 -0
- package/dist/generative-ui/catalog/index.d.mts +6 -0
- package/dist/generative-ui/catalog/json-schema.cjs +16 -0
- package/dist/generative-ui/catalog/json-schema.cjs.map +1 -0
- package/dist/generative-ui/catalog/json-schema.d.cts +12 -0
- package/dist/generative-ui/catalog/json-schema.d.cts.map +1 -0
- package/dist/generative-ui/catalog/json-schema.d.mts +12 -0
- package/dist/generative-ui/catalog/json-schema.d.mts.map +1 -0
- package/dist/generative-ui/catalog/json-schema.mjs +16 -0
- package/dist/generative-ui/catalog/json-schema.mjs.map +1 -0
- package/dist/generative-ui/catalog/refs.cjs +21 -0
- package/dist/generative-ui/catalog/refs.cjs.map +1 -0
- package/dist/generative-ui/catalog/refs.d.cts +55 -0
- package/dist/generative-ui/catalog/refs.d.cts.map +1 -0
- package/dist/generative-ui/catalog/refs.d.mts +55 -0
- package/dist/generative-ui/catalog/refs.d.mts.map +1 -0
- package/dist/generative-ui/catalog/refs.mjs +18 -0
- package/dist/generative-ui/catalog/refs.mjs.map +1 -0
- package/dist/generative-ui/catalog/schema.cjs +74 -0
- package/dist/generative-ui/catalog/schema.cjs.map +1 -0
- package/dist/generative-ui/catalog/schema.d.cts +43 -0
- package/dist/generative-ui/catalog/schema.d.cts.map +1 -0
- package/dist/generative-ui/catalog/schema.d.mts +43 -0
- package/dist/generative-ui/catalog/schema.d.mts.map +1 -0
- package/dist/generative-ui/catalog/schema.mjs +68 -0
- package/dist/generative-ui/catalog/schema.mjs.map +1 -0
- package/dist/generative-ui/child-refs.cjs +3 -3
- package/dist/generative-ui/child-refs.cjs.map +1 -1
- package/dist/generative-ui/child-refs.d.cts.map +1 -1
- package/dist/generative-ui/child-refs.d.mts.map +1 -1
- package/dist/generative-ui/child-refs.mjs +3 -3
- package/dist/generative-ui/child-refs.mjs.map +1 -1
- package/dist/generative-ui/clone-value.cjs +364 -0
- package/dist/generative-ui/clone-value.cjs.map +1 -0
- package/dist/generative-ui/clone-value.d.cts +51 -0
- package/dist/generative-ui/clone-value.d.cts.map +1 -0
- package/dist/generative-ui/clone-value.d.mts +51 -0
- package/dist/generative-ui/clone-value.d.mts.map +1 -0
- package/dist/generative-ui/clone-value.mjs +363 -0
- package/dist/generative-ui/clone-value.mjs.map +1 -0
- package/dist/generative-ui/compact-schema.cjs +187 -0
- package/dist/generative-ui/compact-schema.cjs.map +1 -0
- package/dist/generative-ui/compact-schema.d.cts +55 -0
- package/dist/generative-ui/compact-schema.d.cts.map +1 -0
- package/dist/generative-ui/compact-schema.d.mts +55 -0
- package/dist/generative-ui/compact-schema.d.mts.map +1 -0
- package/dist/generative-ui/compact-schema.mjs +185 -0
- package/dist/generative-ui/compact-schema.mjs.map +1 -0
- package/dist/generative-ui/index.cjs +286 -0
- package/dist/generative-ui/index.d.cts +39 -0
- package/dist/generative-ui/index.d.mts +41 -0
- package/dist/generative-ui/index.mjs +40 -0
- package/dist/generative-ui/is-record.cjs +6 -1
- package/dist/generative-ui/is-record.cjs.map +1 -1
- package/dist/generative-ui/is-record.d.cts +8 -0
- package/dist/generative-ui/is-record.d.cts.map +1 -0
- package/dist/generative-ui/is-record.d.mts +8 -0
- package/dist/generative-ui/is-record.d.mts.map +1 -0
- package/dist/generative-ui/is-record.mjs +6 -2
- package/dist/generative-ui/is-record.mjs.map +1 -1
- package/dist/generative-ui/prompt-spec.cjs +225 -0
- package/dist/generative-ui/prompt-spec.cjs.map +1 -0
- package/dist/generative-ui/prompt-spec.d.cts +94 -0
- package/dist/generative-ui/prompt-spec.d.cts.map +1 -0
- package/dist/generative-ui/prompt-spec.d.mts +94 -0
- package/dist/generative-ui/prompt-spec.d.mts.map +1 -0
- package/dist/generative-ui/prompt-spec.mjs +220 -0
- package/dist/generative-ui/prompt-spec.mjs.map +1 -0
- package/dist/generative-ui/prompt.cjs +10 -36
- package/dist/generative-ui/prompt.cjs.map +1 -1
- package/dist/generative-ui/prompt.d.cts +2 -1
- package/dist/generative-ui/prompt.d.cts.map +1 -1
- package/dist/generative-ui/prompt.d.mts +2 -1
- package/dist/generative-ui/prompt.d.mts.map +1 -1
- package/dist/generative-ui/prompt.mjs +12 -38
- package/dist/generative-ui/prompt.mjs.map +1 -1
- package/dist/generative-ui/render-ui-args.cjs +1 -0
- package/dist/generative-ui/render-ui-args.cjs.map +1 -1
- package/dist/generative-ui/render-ui-args.d.cts.map +1 -1
- package/dist/generative-ui/render-ui-args.d.mts.map +1 -1
- package/dist/generative-ui/render-ui-args.mjs +1 -0
- package/dist/generative-ui/render-ui-args.mjs.map +1 -1
- package/dist/generative-ui/schema-render.cjs +243 -0
- package/dist/generative-ui/schema-render.cjs.map +1 -0
- package/dist/generative-ui/schema-render.d.cts +44 -0
- package/dist/generative-ui/schema-render.d.cts.map +1 -0
- package/dist/generative-ui/schema-render.d.mts +44 -0
- package/dist/generative-ui/schema-render.d.mts.map +1 -0
- package/dist/generative-ui/schema-render.mjs +240 -0
- package/dist/generative-ui/schema-render.mjs.map +1 -0
- package/dist/generative-ui/standard/chart-config.cjs +347 -0
- package/dist/generative-ui/standard/chart-config.cjs.map +1 -0
- package/dist/generative-ui/standard/chart-config.d.cts +97 -0
- package/dist/generative-ui/standard/chart-config.d.cts.map +1 -0
- package/dist/generative-ui/standard/chart-config.d.mts +97 -0
- package/dist/generative-ui/standard/chart-config.d.mts.map +1 -0
- package/dist/generative-ui/standard/chart-config.mjs +342 -0
- package/dist/generative-ui/standard/chart-config.mjs.map +1 -0
- package/dist/generative-ui/standard/chart.cjs +56 -0
- package/dist/generative-ui/standard/chart.cjs.map +1 -0
- package/dist/generative-ui/standard/chart.d.cts +62 -0
- package/dist/generative-ui/standard/chart.d.cts.map +1 -0
- package/dist/generative-ui/standard/chart.d.mts +62 -0
- package/dist/generative-ui/standard/chart.d.mts.map +1 -0
- package/dist/generative-ui/standard/chart.mjs +54 -0
- package/dist/generative-ui/standard/chart.mjs.map +1 -0
- package/dist/generative-ui/standard/checks.cjs +74 -0
- package/dist/generative-ui/standard/checks.cjs.map +1 -0
- package/dist/generative-ui/standard/checks.d.cts +56 -0
- package/dist/generative-ui/standard/checks.d.cts.map +1 -0
- package/dist/generative-ui/standard/checks.d.mts +56 -0
- package/dist/generative-ui/standard/checks.d.mts.map +1 -0
- package/dist/generative-ui/standard/checks.mjs +71 -0
- package/dist/generative-ui/standard/checks.mjs.map +1 -0
- package/dist/generative-ui/standard/components.cjs +23 -0
- package/dist/generative-ui/standard/components.cjs.map +1 -0
- package/dist/generative-ui/standard/components.d.cts +24 -0
- package/dist/generative-ui/standard/components.d.cts.map +1 -0
- package/dist/generative-ui/standard/components.d.mts +24 -0
- package/dist/generative-ui/standard/components.d.mts.map +1 -0
- package/dist/generative-ui/standard/components.mjs +22 -0
- package/dist/generative-ui/standard/components.mjs.map +1 -0
- package/dist/generative-ui/standard/composites.cjs +143 -0
- package/dist/generative-ui/standard/composites.cjs.map +1 -0
- package/dist/generative-ui/standard/composites.d.cts +233 -0
- package/dist/generative-ui/standard/composites.d.cts.map +1 -0
- package/dist/generative-ui/standard/composites.d.mts +233 -0
- package/dist/generative-ui/standard/composites.d.mts.map +1 -0
- package/dist/generative-ui/standard/composites.mjs +132 -0
- package/dist/generative-ui/standard/composites.mjs.map +1 -0
- package/dist/generative-ui/standard/data.cjs +176 -0
- package/dist/generative-ui/standard/data.cjs.map +1 -0
- package/dist/generative-ui/standard/data.d.cts +365 -0
- package/dist/generative-ui/standard/data.d.cts.map +1 -0
- package/dist/generative-ui/standard/data.d.mts +365 -0
- package/dist/generative-ui/standard/data.d.mts.map +1 -0
- package/dist/generative-ui/standard/data.mjs +167 -0
- package/dist/generative-ui/standard/data.mjs.map +1 -0
- package/dist/generative-ui/standard/declarations.cjs +40 -0
- package/dist/generative-ui/standard/declarations.cjs.map +1 -0
- package/dist/generative-ui/standard/declarations.d.cts +2570 -0
- package/dist/generative-ui/standard/declarations.d.cts.map +1 -0
- package/dist/generative-ui/standard/declarations.d.mts +2571 -0
- package/dist/generative-ui/standard/declarations.d.mts.map +1 -0
- package/dist/generative-ui/standard/declarations.mjs +39 -0
- package/dist/generative-ui/standard/declarations.mjs.map +1 -0
- package/dist/generative-ui/standard/feedback.cjs +97 -0
- package/dist/generative-ui/standard/feedback.cjs.map +1 -0
- package/dist/generative-ui/standard/feedback.d.cts +133 -0
- package/dist/generative-ui/standard/feedback.d.cts.map +1 -0
- package/dist/generative-ui/standard/feedback.d.mts +133 -0
- package/dist/generative-ui/standard/feedback.d.mts.map +1 -0
- package/dist/generative-ui/standard/feedback.mjs +90 -0
- package/dist/generative-ui/standard/feedback.mjs.map +1 -0
- package/dist/generative-ui/standard/index.d.mts +20 -0
- package/dist/generative-ui/standard/inputs.cjs +333 -0
- package/dist/generative-ui/standard/inputs.cjs.map +1 -0
- package/dist/generative-ui/standard/inputs.d.cts +1128 -0
- package/dist/generative-ui/standard/inputs.d.cts.map +1 -0
- package/dist/generative-ui/standard/inputs.d.mts +1128 -0
- package/dist/generative-ui/standard/inputs.d.mts.map +1 -0
- package/dist/generative-ui/standard/inputs.mjs +318 -0
- package/dist/generative-ui/standard/inputs.mjs.map +1 -0
- package/dist/generative-ui/standard/layout.cjs +289 -0
- package/dist/generative-ui/standard/layout.cjs.map +1 -0
- package/dist/generative-ui/standard/layout.d.cts +1974 -0
- package/dist/generative-ui/standard/layout.d.cts.map +1 -0
- package/dist/generative-ui/standard/layout.d.mts +1975 -0
- package/dist/generative-ui/standard/layout.d.mts.map +1 -0
- package/dist/generative-ui/standard/layout.mjs +269 -0
- package/dist/generative-ui/standard/layout.mjs.map +1 -0
- package/dist/generative-ui/standard/map-helpers.cjs +104 -0
- package/dist/generative-ui/standard/map-helpers.cjs.map +1 -0
- package/dist/generative-ui/standard/map-helpers.d.cts +88 -0
- package/dist/generative-ui/standard/map-helpers.d.cts.map +1 -0
- package/dist/generative-ui/standard/map-helpers.d.mts +88 -0
- package/dist/generative-ui/standard/map-helpers.d.mts.map +1 -0
- package/dist/generative-ui/standard/map-helpers.mjs +95 -0
- package/dist/generative-ui/standard/map-helpers.mjs.map +1 -0
- package/dist/generative-ui/standard/map.cjs +27 -0
- package/dist/generative-ui/standard/map.cjs.map +1 -0
- package/dist/generative-ui/standard/map.d.cts +31 -0
- package/dist/generative-ui/standard/map.d.cts.map +1 -0
- package/dist/generative-ui/standard/map.d.mts +31 -0
- package/dist/generative-ui/standard/map.d.mts.map +1 -0
- package/dist/generative-ui/standard/map.mjs +25 -0
- package/dist/generative-ui/standard/map.mjs.map +1 -0
- package/dist/generative-ui/standard/media.cjs +215 -0
- package/dist/generative-ui/standard/media.cjs.map +1 -0
- package/dist/generative-ui/standard/media.d.cts +396 -0
- package/dist/generative-ui/standard/media.d.cts.map +1 -0
- package/dist/generative-ui/standard/media.d.mts +396 -0
- package/dist/generative-ui/standard/media.d.mts.map +1 -0
- package/dist/generative-ui/standard/media.mjs +205 -0
- package/dist/generative-ui/standard/media.mjs.map +1 -0
- package/dist/generative-ui/standard/parameter-order.cjs +231 -0
- package/dist/generative-ui/standard/parameter-order.cjs.map +1 -0
- package/dist/generative-ui/standard/parameter-order.d.cts +84 -0
- package/dist/generative-ui/standard/parameter-order.d.cts.map +1 -0
- package/dist/generative-ui/standard/parameter-order.d.mts +84 -0
- package/dist/generative-ui/standard/parameter-order.d.mts.map +1 -0
- package/dist/generative-ui/standard/parameter-order.mjs +230 -0
- package/dist/generative-ui/standard/parameter-order.mjs.map +1 -0
- package/dist/generative-ui/standard/style-helpers.cjs +151 -0
- package/dist/generative-ui/standard/style-helpers.cjs.map +1 -0
- package/dist/generative-ui/standard/style-helpers.d.cts +56 -0
- package/dist/generative-ui/standard/style-helpers.d.cts.map +1 -0
- package/dist/generative-ui/standard/style-helpers.d.mts +56 -0
- package/dist/generative-ui/standard/style-helpers.d.mts.map +1 -0
- package/dist/generative-ui/standard/style-helpers.mjs +142 -0
- package/dist/generative-ui/standard/style-helpers.mjs.map +1 -0
- package/dist/generative-ui/standard/styles.cjs +62 -0
- package/dist/generative-ui/standard/styles.cjs.map +1 -0
- package/dist/generative-ui/standard/styles.d.cts +17 -0
- package/dist/generative-ui/standard/styles.d.cts.map +1 -0
- package/dist/generative-ui/standard/styles.d.mts +17 -0
- package/dist/generative-ui/standard/styles.d.mts.map +1 -0
- package/dist/generative-ui/standard/styles.mjs +60 -0
- package/dist/generative-ui/standard/styles.mjs.map +1 -0
- package/dist/generative-ui/standard/text.cjs +226 -0
- package/dist/generative-ui/standard/text.cjs.map +1 -0
- package/dist/generative-ui/standard/text.d.cts +522 -0
- package/dist/generative-ui/standard/text.d.cts.map +1 -0
- package/dist/generative-ui/standard/text.d.mts +522 -0
- package/dist/generative-ui/standard/text.d.mts.map +1 -0
- package/dist/generative-ui/standard/text.mjs +209 -0
- package/dist/generative-ui/standard/text.mjs.map +1 -0
- package/dist/generative-ui/standard/theme.cjs +115 -0
- package/dist/generative-ui/standard/theme.cjs.map +1 -0
- package/dist/generative-ui/standard/theme.d.cts +60 -0
- package/dist/generative-ui/standard/theme.d.cts.map +1 -0
- package/dist/generative-ui/standard/theme.d.mts +60 -0
- package/dist/generative-ui/standard/theme.d.mts.map +1 -0
- package/dist/generative-ui/standard/theme.mjs +112 -0
- package/dist/generative-ui/standard/theme.mjs.map +1 -0
- package/dist/generative-ui/standard/tokens.cjs +336 -0
- package/dist/generative-ui/standard/tokens.cjs.map +1 -0
- package/dist/generative-ui/standard/tokens.d.cts +76 -0
- package/dist/generative-ui/standard/tokens.d.cts.map +1 -0
- package/dist/generative-ui/standard/tokens.d.mts +76 -0
- package/dist/generative-ui/standard/tokens.d.mts.map +1 -0
- package/dist/generative-ui/standard/tokens.mjs +305 -0
- package/dist/generative-ui/standard/tokens.mjs.map +1 -0
- package/dist/generative-ui/standard/url.cjs +54 -0
- package/dist/generative-ui/standard/url.cjs.map +1 -0
- package/dist/generative-ui/standard/url.d.cts +32 -0
- package/dist/generative-ui/standard/url.d.cts.map +1 -0
- package/dist/generative-ui/standard/url.d.mts +32 -0
- package/dist/generative-ui/standard/url.d.mts.map +1 -0
- package/dist/generative-ui/standard/url.mjs +50 -0
- package/dist/generative-ui/standard/url.mjs.map +1 -0
- package/dist/generative-ui/thrown.cjs +69 -0
- package/dist/generative-ui/thrown.cjs.map +1 -0
- package/dist/generative-ui/thrown.d.cts +21 -0
- package/dist/generative-ui/thrown.d.cts.map +1 -0
- package/dist/generative-ui/thrown.d.mts +21 -0
- package/dist/generative-ui/thrown.d.mts.map +1 -0
- package/dist/generative-ui/thrown.mjs +67 -0
- package/dist/generative-ui/thrown.mjs.map +1 -0
- package/dist/generative-ui/types.cjs +2 -2
- package/dist/generative-ui/types.cjs.map +1 -1
- package/dist/generative-ui/types.d.cts +7 -7
- package/dist/generative-ui/types.d.cts.map +1 -1
- package/dist/generative-ui/types.d.mts +7 -7
- package/dist/generative-ui/types.d.mts.map +1 -1
- package/dist/generative-ui/types.mjs +2 -2
- package/dist/generative-ui/types.mjs.map +1 -1
- package/dist/generative-ui/validate-operation.cjs +2 -2
- package/dist/generative-ui/validate-operation.cjs.map +1 -1
- package/dist/generative-ui/validate-operation.mjs +2 -2
- package/dist/generative-ui/validate-operation.mjs.map +1 -1
- package/dist/index.cjs +18 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -16
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +17 -16
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -8
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1233 -456
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/standard-schema.cjs +20 -7
- package/dist/standard-schema.cjs.map +1 -1
- package/dist/standard-schema.d.cts +15 -16
- package/dist/standard-schema.d.cts.map +1 -1
- package/dist/standard-schema.d.mts +15 -16
- package/dist/standard-schema.d.mts.map +1 -1
- package/dist/standard-schema.mjs +20 -8
- package/dist/standard-schema.mjs.map +1 -1
- package/dist/telemetry/lambda-client.cjs +1 -1
- package/dist/telemetry/lambda-client.cjs.map +1 -1
- package/dist/telemetry/lambda-client.d.cts.map +1 -1
- package/dist/telemetry/lambda-client.d.mts.map +1 -1
- package/dist/telemetry/lambda-client.mjs +1 -1
- package/dist/telemetry/lambda-client.mjs.map +1 -1
- package/dist/telemetry/telemetry-disabled.cjs +0 -5
- package/dist/telemetry/telemetry-disabled.cjs.map +1 -1
- package/dist/telemetry/telemetry-disabled.d.cts +0 -5
- package/dist/telemetry/telemetry-disabled.d.cts.map +1 -1
- package/dist/telemetry/telemetry-disabled.d.mts +0 -5
- package/dist/telemetry/telemetry-disabled.d.mts.map +1 -1
- package/dist/telemetry/telemetry-disabled.mjs +0 -5
- package/dist/telemetry/telemetry-disabled.mjs.map +1 -1
- package/dist/types/message.d.cts +1 -18
- package/dist/types/message.d.cts.map +1 -1
- package/dist/types/message.d.mts +1 -18
- package/dist/types/message.d.mts.map +1 -1
- package/dist/utils/errors.cjs +5 -42
- package/dist/utils/errors.cjs.map +1 -1
- package/dist/utils/errors.d.cts +16 -34
- package/dist/utils/errors.d.cts.map +1 -1
- package/dist/utils/errors.d.mts +16 -34
- package/dist/utils/errors.d.mts.map +1 -1
- package/dist/utils/errors.mjs +6 -41
- package/dist/utils/errors.mjs.map +1 -1
- package/dist/utils/index.cjs +0 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +4 -6
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +4 -6
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +4 -6
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/inspector-visibility.cjs +25 -3
- package/dist/utils/inspector-visibility.cjs.map +1 -1
- package/dist/utils/inspector-visibility.d.cts +26 -3
- package/dist/utils/inspector-visibility.d.cts.map +1 -1
- package/dist/utils/inspector-visibility.d.mts +26 -3
- package/dist/utils/inspector-visibility.d.mts.map +1 -1
- package/dist/utils/inspector-visibility.mjs +25 -4
- package/dist/utils/inspector-visibility.mjs.map +1 -1
- package/dist/utils/json-schema.cjs +4 -79
- package/dist/utils/json-schema.cjs.map +1 -1
- package/dist/utils/json-schema.d.cts +1 -4
- package/dist/utils/json-schema.d.cts.map +1 -1
- package/dist/utils/json-schema.d.mts +1 -4
- package/dist/utils/json-schema.d.mts.map +1 -1
- package/dist/utils/json-schema.mjs +5 -78
- package/dist/utils/json-schema.mjs.map +1 -1
- package/dist/utils/random-id.cjs +13 -26
- package/dist/utils/random-id.cjs.map +1 -1
- package/dist/utils/random-id.d.cts +6 -3
- package/dist/utils/random-id.d.cts.map +1 -1
- package/dist/utils/random-id.d.mts +6 -3
- package/dist/utils/random-id.d.mts.map +1 -1
- package/dist/utils/random-id.mjs +14 -25
- package/dist/utils/random-id.mjs.map +1 -1
- package/package.json +19 -32
- package/scripts/verify-cjs-exports.cjs +1 -1
- package/src/__tests__/a2ui-envelope.test.ts +18 -13
- package/src/__tests__/a2ui-prompts.test.ts +47 -14
- package/src/__tests__/fixtures/prompt-goldens.json +354 -0
- package/src/__tests__/prompt-spec.test.ts +191 -0
- package/src/__tests__/root-entry-browser-safety.test.ts +5 -7
- package/src/__tests__/schema-render.test.ts +323 -0
- package/src/__tests__/standard-schema.test.ts +61 -101
- package/src/a2ui-envelope.ts +7 -6
- package/src/a2ui-prompts.ts +47 -96
- package/src/attachments/__tests__/utils.test.ts +22 -0
- package/src/attachments/types.ts +1 -3
- package/src/attachments/utils.ts +23 -5
- package/src/finalize-events.ts +16 -0
- package/src/generative-ui/__tests__/clone-value-differential.test.ts +480 -0
- package/src/generative-ui/__tests__/clone-value.test.ts +226 -0
- package/src/generative-ui/__tests__/render-ui-args.test.ts +7 -7
- package/src/generative-ui/__tests__/validate-operation.test.ts +19 -13
- package/src/generative-ui/base.ts +9 -0
- package/src/generative-ui/basic-functions.ts +1 -1
- package/src/generative-ui/catalog/catalog-export.ts +478 -0
- package/src/generative-ui/catalog/catalog.ts +1167 -0
- package/src/generative-ui/catalog/errors.ts +102 -0
- package/src/generative-ui/catalog/index.ts +6 -0
- package/src/generative-ui/catalog/json-schema.ts +14 -0
- package/src/generative-ui/catalog/refs.ts +87 -0
- package/src/generative-ui/catalog/schema.ts +107 -0
- package/src/generative-ui/child-refs.ts +5 -4
- package/src/generative-ui/clone-value.ts +511 -0
- package/src/generative-ui/compact-schema.ts +277 -0
- package/src/generative-ui/index.ts +14 -0
- package/src/generative-ui/is-record.ts +6 -1
- package/src/generative-ui/prompt-spec.ts +335 -0
- package/src/generative-ui/prompt.ts +25 -75
- package/src/generative-ui/render-ui-args.ts +3 -0
- package/src/generative-ui/schema-render.ts +378 -0
- package/src/generative-ui/standard/__tests__/standard-helpers.test.ts +407 -0
- package/src/generative-ui/standard/__tests__/theme.test.ts +61 -0
- package/src/generative-ui/standard/__tests__/tokens.test.ts +139 -0
- package/src/generative-ui/standard/chart-config.ts +434 -0
- package/src/generative-ui/standard/chart.ts +79 -0
- package/src/generative-ui/standard/checks.ts +98 -0
- package/src/generative-ui/standard/components.ts +35 -0
- package/src/generative-ui/standard/composites.ts +158 -0
- package/src/generative-ui/standard/data.ts +213 -0
- package/src/generative-ui/standard/declarations.ts +57 -0
- package/src/generative-ui/standard/feedback.ts +105 -0
- package/src/generative-ui/standard/index.ts +55 -0
- package/src/generative-ui/standard/inputs.ts +423 -0
- package/src/generative-ui/standard/layout.ts +312 -0
- package/src/generative-ui/standard/map-helpers.ts +155 -0
- package/src/generative-ui/standard/map.ts +32 -0
- package/src/generative-ui/standard/media.ts +265 -0
- package/src/generative-ui/standard/parameter-order.ts +155 -0
- package/src/generative-ui/standard/style-helpers.ts +170 -0
- package/src/generative-ui/standard/styles.ts +79 -0
- package/src/generative-ui/standard/text.ts +210 -0
- package/src/generative-ui/standard/theme.ts +198 -0
- package/src/generative-ui/standard/tokens.ts +317 -0
- package/src/generative-ui/standard/url.ts +51 -0
- package/src/generative-ui/thrown.ts +90 -0
- package/src/generative-ui/types.ts +10 -7
- package/src/generative-ui/validate-operation.ts +2 -2
- package/src/index.ts +9 -17
- package/src/standard-schema.ts +24 -27
- package/src/telemetry/lambda-client.ts +8 -3
- package/src/telemetry/model-host.test.ts +2 -5
- package/src/telemetry/telemetry-disabled.ts +0 -5
- package/src/types/message.ts +1 -19
- package/src/utils/__tests__/errors.test.ts +44 -0
- package/src/utils/__tests__/json-schema.test.ts +3 -479
- package/src/utils/__tests__/random-id.test.ts +37 -0
- package/src/utils/errors.ts +28 -85
- package/src/utils/index.ts +0 -2
- package/src/utils/inspector-visibility.test.ts +26 -0
- package/src/utils/inspector-visibility.ts +35 -3
- package/src/utils/json-schema.ts +5 -152
- package/src/utils/random-id.ts +17 -37
- package/tsconfig.json +3 -1
- package/tsdown.config.ts +2 -19
- package/dist/event-transforms/index.cjs +0 -15
- package/dist/event-transforms/index.d.cts +0 -4
- package/dist/event-transforms/index.d.mts +0 -4
- package/dist/event-transforms/index.mjs +0 -5
- package/dist/event-transforms/open-generative-ui-middleware.cjs +0 -286
- package/dist/event-transforms/open-generative-ui-middleware.cjs.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.d.cts +0 -60
- package/dist/event-transforms/open-generative-ui-middleware.d.cts.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.d.mts +0 -60
- package/dist/event-transforms/open-generative-ui-middleware.d.mts.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.mjs +0 -283
- package/dist/event-transforms/open-generative-ui-middleware.mjs.map +0 -1
- package/dist/event-transforms/recorded-events.cjs +0 -59
- package/dist/event-transforms/recorded-events.cjs.map +0 -1
- package/dist/event-transforms/recorded-events.d.cts +0 -23
- package/dist/event-transforms/recorded-events.d.cts.map +0 -1
- package/dist/event-transforms/recorded-events.d.mts +0 -23
- package/dist/event-transforms/recorded-events.d.mts.map +0 -1
- package/dist/event-transforms/recorded-events.mjs +0 -58
- package/dist/event-transforms/recorded-events.mjs.map +0 -1
- package/dist/telemetry/events.d.cts +0 -72
- package/dist/telemetry/events.d.cts.map +0 -1
- package/dist/telemetry/events.d.mts +0 -72
- package/dist/telemetry/events.d.mts.map +0 -1
- package/dist/telemetry/index.cjs +0 -18
- package/dist/telemetry/index.d.cts +0 -5
- package/dist/telemetry/index.d.mts +0 -5
- package/dist/telemetry/index.mjs +0 -6
- package/dist/telemetry/telemetry-client.cjs +0 -165
- package/dist/telemetry/telemetry-client.cjs.map +0 -1
- package/dist/telemetry/telemetry-client.d.cts +0 -87
- package/dist/telemetry/telemetry-client.d.cts.map +0 -1
- package/dist/telemetry/telemetry-client.d.mts +0 -87
- package/dist/telemetry/telemetry-client.d.mts.map +0 -1
- package/dist/telemetry/telemetry-client.mjs +0 -164
- package/dist/telemetry/telemetry-client.mjs.map +0 -1
- package/dist/telemetry/utils.cjs +0 -14
- package/dist/telemetry/utils.cjs.map +0 -1
- package/dist/telemetry/utils.mjs +0 -13
- package/dist/telemetry/utils.mjs.map +0 -1
- package/dist/utils/conditions.cjs +0 -32
- package/dist/utils/conditions.cjs.map +0 -1
- package/dist/utils/conditions.d.cts +0 -31
- package/dist/utils/conditions.d.cts.map +0 -1
- package/dist/utils/conditions.d.mts +0 -31
- package/dist/utils/conditions.d.mts.map +0 -1
- package/dist/utils/conditions.mjs +0 -31
- package/dist/utils/conditions.mjs.map +0 -1
- package/dist/utils/console-styling.cjs +0 -91
- package/dist/utils/console-styling.cjs.map +0 -1
- package/dist/utils/console-styling.d.cts +0 -65
- package/dist/utils/console-styling.d.cts.map +0 -1
- package/dist/utils/console-styling.d.mts +0 -65
- package/dist/utils/console-styling.d.mts.map +0 -1
- package/dist/utils/console-styling.mjs +0 -85
- package/dist/utils/console-styling.mjs.map +0 -1
- package/src/__tests__/zod-regression.test.ts +0 -319
- package/src/event-transforms/index.ts +0 -5
- package/src/event-transforms/open-generative-ui-middleware.ts +0 -392
- package/src/event-transforms/recorded-events.test.ts +0 -166
- package/src/event-transforms/recorded-events.ts +0 -74
- package/src/telemetry/events.ts +0 -68
- package/src/telemetry/index.ts +0 -9
- package/src/telemetry/telemetry-blank-license-identity.test.ts +0 -128
- package/src/telemetry/telemetry-client.test.ts +0 -798
- package/src/telemetry/telemetry-client.ts +0 -328
- package/src/telemetry/utils.ts +0 -15
- package/src/utils/__tests__/conditions.test.ts +0 -161
- package/src/utils/conditions.ts +0 -116
- package/src/utils/console-styling.ts +0 -126
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { hasOwnKey } from "../is-record";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Design tokens of the standard components. Each token is a CSS variable
|
|
5
|
+
* with a literal fallback, so a host can restyle a surface with the
|
|
6
|
+
* `--a2ui-*` variables. A value that is not a token passes through as raw
|
|
7
|
+
* CSS.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Id of `standardUI`, the catalog id the model writes in createSurface. */
|
|
11
|
+
export const STANDARD_CATALOG_ID = "copilotkit/standard@1";
|
|
12
|
+
|
|
13
|
+
export const TITLE_SIZES = [
|
|
14
|
+
"sm",
|
|
15
|
+
"md",
|
|
16
|
+
"lg",
|
|
17
|
+
"xl",
|
|
18
|
+
"2xl",
|
|
19
|
+
"3xl",
|
|
20
|
+
"4xl",
|
|
21
|
+
"5xl",
|
|
22
|
+
] as const;
|
|
23
|
+
export const TEXT_SIZES = ["3xs", "2xs", "xs", "sm", "md", "lg"] as const;
|
|
24
|
+
export const WEIGHTS = ["normal", "medium", "semibold", "bold"] as const;
|
|
25
|
+
export const ALIGN = ["start", "center", "end", "baseline", "stretch"] as const;
|
|
26
|
+
export const JUSTIFY = [
|
|
27
|
+
"start",
|
|
28
|
+
"center",
|
|
29
|
+
"end",
|
|
30
|
+
"spaceBetween",
|
|
31
|
+
"spaceAround",
|
|
32
|
+
"spaceEvenly",
|
|
33
|
+
"stretch",
|
|
34
|
+
] as const;
|
|
35
|
+
export const WRAP = ["nowrap", "wrap", "wrap-reverse"] as const;
|
|
36
|
+
export const RADII = [
|
|
37
|
+
"2xs",
|
|
38
|
+
"xs",
|
|
39
|
+
"sm",
|
|
40
|
+
"md",
|
|
41
|
+
"lg",
|
|
42
|
+
"xl",
|
|
43
|
+
"2xl",
|
|
44
|
+
"3xl",
|
|
45
|
+
"4xl",
|
|
46
|
+
"full",
|
|
47
|
+
] as const;
|
|
48
|
+
export const TEXT_COLORS = [
|
|
49
|
+
"default",
|
|
50
|
+
"prose",
|
|
51
|
+
"primary",
|
|
52
|
+
"emphasis",
|
|
53
|
+
"secondary",
|
|
54
|
+
"tertiary",
|
|
55
|
+
"success",
|
|
56
|
+
"info",
|
|
57
|
+
"warning",
|
|
58
|
+
"caution",
|
|
59
|
+
"danger",
|
|
60
|
+
"discovery",
|
|
61
|
+
] as const;
|
|
62
|
+
export const BORDER_COLORS = [
|
|
63
|
+
"default",
|
|
64
|
+
"subtle",
|
|
65
|
+
"strong",
|
|
66
|
+
"info",
|
|
67
|
+
"warning",
|
|
68
|
+
"caution",
|
|
69
|
+
"success",
|
|
70
|
+
"danger",
|
|
71
|
+
"discovery",
|
|
72
|
+
] as const;
|
|
73
|
+
export const BACKGROUNDS = [
|
|
74
|
+
"surface",
|
|
75
|
+
"surface-secondary",
|
|
76
|
+
"surface-tertiary",
|
|
77
|
+
"surface-elevated",
|
|
78
|
+
"surface-elevated-secondary",
|
|
79
|
+
"surface-inverted",
|
|
80
|
+
"surface-soft",
|
|
81
|
+
"info",
|
|
82
|
+
"warning",
|
|
83
|
+
"caution",
|
|
84
|
+
"success",
|
|
85
|
+
"danger",
|
|
86
|
+
"discovery",
|
|
87
|
+
"info-solid",
|
|
88
|
+
"warning-solid",
|
|
89
|
+
"caution-solid",
|
|
90
|
+
"success-solid",
|
|
91
|
+
"danger-solid",
|
|
92
|
+
"discovery-solid",
|
|
93
|
+
] as const;
|
|
94
|
+
|
|
95
|
+
export type TitleSize = (typeof TITLE_SIZES)[number];
|
|
96
|
+
export type TextSize = (typeof TEXT_SIZES)[number];
|
|
97
|
+
export type Weight = (typeof WEIGHTS)[number];
|
|
98
|
+
export type Radius = (typeof RADII)[number];
|
|
99
|
+
|
|
100
|
+
const RADIUS_PX: Record<Radius, string> = {
|
|
101
|
+
"2xs": "2px",
|
|
102
|
+
xs: "4px",
|
|
103
|
+
sm: "6px",
|
|
104
|
+
md: "8px",
|
|
105
|
+
lg: "12px",
|
|
106
|
+
xl: "16px",
|
|
107
|
+
"2xl": "20px",
|
|
108
|
+
"3xl": "24px",
|
|
109
|
+
"4xl": "32px",
|
|
110
|
+
full: "9999px",
|
|
111
|
+
};
|
|
112
|
+
const TEXT_COLOR_FALLBACK: Record<string, string> = {
|
|
113
|
+
default: "#0d0d0d",
|
|
114
|
+
prose: "#0d0d0d",
|
|
115
|
+
primary: "#0d0d0d",
|
|
116
|
+
emphasis: "#000",
|
|
117
|
+
secondary: "#5d5d5d",
|
|
118
|
+
tertiary: "#8e8e8e",
|
|
119
|
+
success: "#00805d",
|
|
120
|
+
info: "#0068bc",
|
|
121
|
+
warning: "#946200",
|
|
122
|
+
caution: "#946200",
|
|
123
|
+
danger: "#c1322c",
|
|
124
|
+
discovery: "#7040c1",
|
|
125
|
+
};
|
|
126
|
+
const BG_FALLBACK: Record<string, string> = {
|
|
127
|
+
surface: "#fff",
|
|
128
|
+
"surface-secondary": "#f7f7f8",
|
|
129
|
+
"surface-tertiary": "#ececec",
|
|
130
|
+
"surface-elevated": "#fff",
|
|
131
|
+
"surface-elevated-secondary": "#f7f7f8",
|
|
132
|
+
"surface-inverted": "#0d0d0d",
|
|
133
|
+
"surface-soft": "#fcfcfc",
|
|
134
|
+
// A semantic tint is a hint, not a block: the text color at low alpha.
|
|
135
|
+
info: "rgba(0, 104, 188, 0.08)",
|
|
136
|
+
warning: "rgba(148, 98, 0, 0.08)",
|
|
137
|
+
caution: "rgba(148, 98, 0, 0.08)",
|
|
138
|
+
success: "rgba(0, 128, 93, 0.08)",
|
|
139
|
+
danger: "rgba(193, 50, 44, 0.08)",
|
|
140
|
+
discovery: "rgba(112, 64, 193, 0.08)",
|
|
141
|
+
"info-solid": "#0068bc",
|
|
142
|
+
"warning-solid": "#946200",
|
|
143
|
+
"caution-solid": "#946200",
|
|
144
|
+
"success-solid": "#00805d",
|
|
145
|
+
"danger-solid": "#c1322c",
|
|
146
|
+
"discovery-solid": "#7040c1",
|
|
147
|
+
};
|
|
148
|
+
const BORDER_FALLBACK: Record<string, string> = {
|
|
149
|
+
default: "rgba(0, 0, 0, 0.1)",
|
|
150
|
+
subtle: "rgba(0, 0, 0, 0.05)",
|
|
151
|
+
strong: "#cdcdcd",
|
|
152
|
+
info: "#9cc4ea",
|
|
153
|
+
warning: "#e6c98a",
|
|
154
|
+
caution: "#e6c98a",
|
|
155
|
+
success: "#9ad9c3",
|
|
156
|
+
danger: "#eeaaa6",
|
|
157
|
+
discovery: "#c8b4ea",
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
function hasToken<Key extends string>(
|
|
161
|
+
table: Record<Key, string>,
|
|
162
|
+
key: string,
|
|
163
|
+
): key is Key {
|
|
164
|
+
return hasOwnKey(table, key);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** A number is a count of 4px steps. A string passes through as CSS. */
|
|
168
|
+
export function spacing(value: number | string | undefined) {
|
|
169
|
+
if (value === undefined) return undefined;
|
|
170
|
+
return typeof value === "number"
|
|
171
|
+
? `calc(var(--spacing, 0.25rem) * ${value})`
|
|
172
|
+
: value;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** A radius token, a number of pixels, or raw CSS. */
|
|
176
|
+
export function radius(value: string | number | undefined) {
|
|
177
|
+
if (value === undefined) return undefined;
|
|
178
|
+
if (typeof value === "number") return `${value}px`;
|
|
179
|
+
if (value === "full") return "9999px";
|
|
180
|
+
return hasToken(RADIUS_PX, value)
|
|
181
|
+
? `var(--a2ui-radius-${value}, ${RADIUS_PX[value]})`
|
|
182
|
+
: value;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** A text color token, or a raw CSS color. */
|
|
186
|
+
export function textColor(value: string | undefined) {
|
|
187
|
+
if (!value) return undefined;
|
|
188
|
+
return hasToken(TEXT_COLOR_FALLBACK, value)
|
|
189
|
+
? `var(--a2ui-color-text-${value}, ${TEXT_COLOR_FALLBACK[value]})`
|
|
190
|
+
: value;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** A background token, or a raw CSS color. */
|
|
194
|
+
export function backgroundColor(value: string | undefined) {
|
|
195
|
+
if (!value) return undefined;
|
|
196
|
+
return hasToken(BG_FALLBACK, value)
|
|
197
|
+
? `var(--a2ui-color-${value}, ${BG_FALLBACK[value]})`
|
|
198
|
+
: value;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** The one inner panel of a Card: near-white fill. */
|
|
202
|
+
export const INNER_PANEL_BG = "var(--a2ui-color-panel, rgb(252, 252, 252))";
|
|
203
|
+
const SOFT_TINT: Record<string, string> = {
|
|
204
|
+
info: "rgba(0, 104, 188, 0.06)",
|
|
205
|
+
warning: "rgba(148, 98, 0, 0.06)",
|
|
206
|
+
caution: "rgba(148, 98, 0, 0.06)",
|
|
207
|
+
success: "rgba(0, 128, 93, 0.06)",
|
|
208
|
+
danger: "rgba(193, 50, 44, 0.06)",
|
|
209
|
+
discovery: "rgba(112, 64, 193, 0.06)",
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The background of a panel inside a Card. A neutral surface becomes the
|
|
214
|
+
* near-white inner panel. A semantic tint gets lighter (about 6% alpha).
|
|
215
|
+
* Solid and raw values go through `backgroundColor`.
|
|
216
|
+
*/
|
|
217
|
+
export function panelBackground(value: string | undefined) {
|
|
218
|
+
if (!value) return undefined;
|
|
219
|
+
const isNeutral =
|
|
220
|
+
value === "surface-secondary" ||
|
|
221
|
+
value === "surface-soft" ||
|
|
222
|
+
value === "surface-elevated-secondary";
|
|
223
|
+
if (isNeutral) return INNER_PANEL_BG;
|
|
224
|
+
return hasToken(SOFT_TINT, value)
|
|
225
|
+
? `var(--a2ui-color-${value}-soft, ${SOFT_TINT[value]})`
|
|
226
|
+
: backgroundColor(value);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** A border color token, or a raw CSS color. */
|
|
230
|
+
export function borderColor(value: string | undefined) {
|
|
231
|
+
if (!value) return undefined;
|
|
232
|
+
return hasToken(BORDER_FALLBACK, value)
|
|
233
|
+
? `var(--a2ui-color-border-${value}, ${BORDER_FALLBACK[value]})`
|
|
234
|
+
: value;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The type scale at a 16px base, in em, so a surface scales with the font
|
|
239
|
+
* size of the host: title lg = 18/28, 2xl = 24/32; text md = 16/26,
|
|
240
|
+
* sm = 14/20, xs = 12/16, 3xs = 10/12. Line heights are unitless ratios.
|
|
241
|
+
*/
|
|
242
|
+
const TITLE_SCALE: Record<TitleSize, [string, number]> = {
|
|
243
|
+
sm: [".875em", 1.429],
|
|
244
|
+
md: ["1em", 1.5],
|
|
245
|
+
lg: ["1.125em", 1.556],
|
|
246
|
+
xl: ["1.25em", 1.4],
|
|
247
|
+
"2xl": ["1.5em", 1.333],
|
|
248
|
+
"3xl": ["1.875em", 1.2],
|
|
249
|
+
"4xl": ["2.25em", 1.111],
|
|
250
|
+
"5xl": ["3em", 1.083],
|
|
251
|
+
};
|
|
252
|
+
const TEXT_SCALE: Record<TextSize, [string, number]> = {
|
|
253
|
+
"3xs": [".625em", 1.2],
|
|
254
|
+
"2xs": [".6875em", 1.273],
|
|
255
|
+
xs: [".75em", 1.333],
|
|
256
|
+
sm: [".875em", 1.429],
|
|
257
|
+
md: ["1em", 1.625],
|
|
258
|
+
lg: ["1.125em", 1.556],
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/** Text on an accent fill (solid buttons and badges, selected segments). */
|
|
262
|
+
export const ON_ACCENT = "var(--a2ui-color-on-accent, #fff)";
|
|
263
|
+
/** The fill of a control (checkbox, radio, slider thumb, selected segment). */
|
|
264
|
+
export const CONTROL_BG = "var(--a2ui-color-control, #fff)";
|
|
265
|
+
export const SHADOW_XS = "var(--a2ui-shadow-xs, 0 1px 2px rgba(0,0,0,.12))";
|
|
266
|
+
export const SHADOW_SM = "var(--a2ui-shadow-sm, 0 1px 3px rgba(0,0,0,.12))";
|
|
267
|
+
export const SHADOW_SOFT = "var(--a2ui-shadow-soft, 0 1px 3px rgba(0,0,0,.06))";
|
|
268
|
+
export const SHADOW_MD = "var(--a2ui-shadow-md, 0 4px 12px rgba(0,0,0,.08))";
|
|
269
|
+
/** The scrim behind a lightbox or modal. */
|
|
270
|
+
export const BACKDROP = "var(--a2ui-color-backdrop, rgba(0,0,0,.8))";
|
|
271
|
+
/** The moving highlight of a shimmer placeholder. */
|
|
272
|
+
export const SHIMMER_HIGHLIGHT =
|
|
273
|
+
"var(--a2ui-color-shimmer, rgba(255,255,255,.55))";
|
|
274
|
+
/** The hover band behind a chart column. */
|
|
275
|
+
export const CHART_CURSOR = "var(--a2ui-color-chart-cursor, rgba(0,0,0,.04))";
|
|
276
|
+
/**
|
|
277
|
+
* Chart series colors: a soft blue family first, then muted companions, so
|
|
278
|
+
* a chart with many series stays easy to read. A host can change each one
|
|
279
|
+
* with `--a2ui-chart-1`, `--a2ui-chart-2`, and so on.
|
|
280
|
+
*/
|
|
281
|
+
const CHART_PALETTE_FALLBACK = [
|
|
282
|
+
"#7fb0f2",
|
|
283
|
+
"#2f6fd1",
|
|
284
|
+
"#b7cff7",
|
|
285
|
+
"#8bb5a8",
|
|
286
|
+
"#d9b36b",
|
|
287
|
+
"#c08bb0",
|
|
288
|
+
];
|
|
289
|
+
export const CHART_PALETTE = CHART_PALETTE_FALLBACK.map(
|
|
290
|
+
(hex, index) => `var(--a2ui-chart-${index + 1}, ${hex})`,
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* A UI font stack. A surface inherits the font of the host. This value is
|
|
295
|
+
* for hosts that want it (`font-family: var(--a2ui-font-family, ...)`).
|
|
296
|
+
*/
|
|
297
|
+
export const FONT_FAMILY =
|
|
298
|
+
'var(--a2ui-font-family, -apple-system, ui-sans-serif, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol")';
|
|
299
|
+
|
|
300
|
+
/** The heading scale in em. */
|
|
301
|
+
export function titleFont(size: TitleSize = "md") {
|
|
302
|
+
const [fontSize, lineHeight] = TITLE_SCALE[size];
|
|
303
|
+
return { fontSize, lineHeight, fontWeight: 600 };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** The body text size, in em of the text around it. */
|
|
307
|
+
export function textFont(size: TextSize = "md") {
|
|
308
|
+
const [fontSize, lineHeight] = TEXT_SCALE[size];
|
|
309
|
+
return { fontSize, lineHeight };
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export const FONT_WEIGHT: Record<Weight, number> = {
|
|
313
|
+
normal: 400,
|
|
314
|
+
medium: 500,
|
|
315
|
+
semibold: 600,
|
|
316
|
+
bold: 700,
|
|
317
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Framework-free URL helpers of the standard components.
|
|
2
|
+
|
|
3
|
+
const SAFE_URL = /^(https?:|mailto:)/i;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The trimmed URL when its scheme is http, https or mailto, else
|
|
7
|
+
* `undefined`. Use it before a URL from agent data becomes an `href`.
|
|
8
|
+
*
|
|
9
|
+
* @example safeHref(" https://example.com ") // "https://example.com"
|
|
10
|
+
*/
|
|
11
|
+
export function safeHref(url: string) {
|
|
12
|
+
const trimmed = url.trim();
|
|
13
|
+
return SAFE_URL.test(trimmed) ? trimmed : undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The host name of a URL, with or without a scheme. `undefined` when the
|
|
18
|
+
* text is not a URL.
|
|
19
|
+
*
|
|
20
|
+
* @example hostOf("example.com/page") // "example.com"
|
|
21
|
+
*/
|
|
22
|
+
export function hostOf(url: string) {
|
|
23
|
+
try {
|
|
24
|
+
return new URL(url.includes("://") ? url : `https://${url}`).hostname;
|
|
25
|
+
} catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The URL of the favicon of a host, from Google's favicon service.
|
|
32
|
+
*
|
|
33
|
+
* @param host - A host name, for example the result of `hostOf`.
|
|
34
|
+
*/
|
|
35
|
+
export function faviconSrc(host: string) {
|
|
36
|
+
return `https://www.google.com/s2/favicons?domain=${encodeURIComponent(host)}&sz=64`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Opens a URL in a new tab. An unsafe scheme (javascript:, data:) is
|
|
41
|
+
* ignored. Does nothing where there is no `window.open`, for example on
|
|
42
|
+
* the server or on React Native.
|
|
43
|
+
*
|
|
44
|
+
* @param href - The URL to open. `undefined` does nothing.
|
|
45
|
+
*/
|
|
46
|
+
export function openUrl(href: string | undefined) {
|
|
47
|
+
if (!href || typeof window === "undefined") return;
|
|
48
|
+
if (typeof window.open !== "function") return; // hermes-ok: feature check
|
|
49
|
+
const safe = safeHref(href);
|
|
50
|
+
if (safe) window.open(safe, "_blank", "noopener,noreferrer"); // hermes-ok: checked above
|
|
51
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Turns any thrown value into an Error, for the error boundaries of the
|
|
2
|
+
// framework packages. Framework-free, and safe on Hermes.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sets `cause` as an own property. `new Error(message, { cause })` needs
|
|
6
|
+
* ES2022 error options, which an engine without them (the JavaScriptCore of
|
|
7
|
+
* iOS before 15, which React Native 0.70 can still run on) ignores without a
|
|
8
|
+
* word, so it is set by hand on every engine.
|
|
9
|
+
*/
|
|
10
|
+
export function withCause(error: Error, cause: unknown): Error {
|
|
11
|
+
Object.defineProperty(error, "cause", {
|
|
12
|
+
value: cause,
|
|
13
|
+
writable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
enumerable: false,
|
|
16
|
+
});
|
|
17
|
+
return error;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The longest description of a thrown object's data. */
|
|
21
|
+
const MAX_DESCRIPTION = 200;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Reads what a thrown value says without letting the reading throw: a
|
|
25
|
+
* getter, a Proxy trap, a `toJSON` or a `toString` may throw too.
|
|
26
|
+
*/
|
|
27
|
+
function attempt<T>(read: () => T): T | undefined {
|
|
28
|
+
try {
|
|
29
|
+
return read();
|
|
30
|
+
} catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The `message` of a thrown object, when it is a non-empty string. */
|
|
36
|
+
function messageOf(value: unknown): string | undefined {
|
|
37
|
+
if (typeof value !== "object" || value === null) return undefined;
|
|
38
|
+
const message = attempt(() => (value as { message?: unknown }).message);
|
|
39
|
+
return typeof message === "string" && message !== "" ? message : undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** A thrown value as text, for a value that is not an Error. */
|
|
43
|
+
function describeThrown(value: unknown): string {
|
|
44
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
45
|
+
if (typeof value === "object" && value !== null) {
|
|
46
|
+
// Its data, not "[object Object]".
|
|
47
|
+
const json = attempt(() => JSON.stringify(value));
|
|
48
|
+
if (typeof json === "string") {
|
|
49
|
+
return json.length > MAX_DESCRIPTION
|
|
50
|
+
? `${json.slice(0, MAX_DESCRIPTION)}…`
|
|
51
|
+
: json;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return (
|
|
55
|
+
attempt(() => String(value)) ??
|
|
56
|
+
attempt(() => Object.prototype.toString.call(value)) ??
|
|
57
|
+
typeof value
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** An Error of this realm, or of another one (a frame, a VM context). */
|
|
62
|
+
function isError(value: unknown): value is Error {
|
|
63
|
+
// `instanceof` runs a Proxy's getPrototypeOf trap, which may throw.
|
|
64
|
+
if (attempt(() => value instanceof Error)) return true;
|
|
65
|
+
// Another realm's Error fails `instanceof`; its tag says what it is. A
|
|
66
|
+
// tag can be set on any object, so it must have a message as well.
|
|
67
|
+
return (
|
|
68
|
+
attempt(() => Object.prototype.toString.call(value)) === "[object Error]" &&
|
|
69
|
+
typeof attempt(() => (value as { message?: unknown }).message) === "string"
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The Error for any thrown value. Code may throw anything: a string, or a
|
|
75
|
+
* falsy value (`undefined`, `null`, `0`, `""`) that a boundary which keeps
|
|
76
|
+
* the thrown value and tests it for truth would take for "no error". An
|
|
77
|
+
* Error comes back as it is; a non-empty string, or the string `message`
|
|
78
|
+
* of a thrown object, becomes the message; any other value is described in
|
|
79
|
+
* the message. A value that is not an Error is kept as the `cause`. This
|
|
80
|
+
* never throws, whatever the value.
|
|
81
|
+
*/
|
|
82
|
+
export function toError(value: unknown): Error {
|
|
83
|
+
if (isError(value)) return value;
|
|
84
|
+
const message =
|
|
85
|
+
typeof value === "string" && value !== ""
|
|
86
|
+
? value
|
|
87
|
+
: (messageOf(value) ??
|
|
88
|
+
`A value that is not an Error was thrown: ${describeThrown(value)}`);
|
|
89
|
+
return withCause(new Error(message), value);
|
|
90
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** A2UI protocol version used on the wire. */
|
|
2
|
-
export const A2UI_VERSION = "
|
|
2
|
+
export const A2UI_VERSION = "1.0";
|
|
3
3
|
/** Activity type of a generated surface message. */
|
|
4
4
|
export const GENERATIVE_UI_ACTIVITY_TYPE = "generative-ui-surface";
|
|
5
5
|
/** Activity type of a function call that the agent asks the client to run. */
|
|
@@ -83,7 +83,7 @@ export type A2UIFunctionCall = {
|
|
|
83
83
|
|
|
84
84
|
export type A2UIOperation =
|
|
85
85
|
| {
|
|
86
|
-
version:
|
|
86
|
+
version: typeof A2UI_VERSION;
|
|
87
87
|
createSurface: {
|
|
88
88
|
surfaceId: string;
|
|
89
89
|
/** Left out by the model. The run's catalog id is filled in. */
|
|
@@ -97,20 +97,23 @@ export type A2UIOperation =
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
| {
|
|
100
|
-
version:
|
|
100
|
+
version: typeof A2UI_VERSION;
|
|
101
101
|
updateComponents: { surfaceId: string; components: A2UIComponentNode[] };
|
|
102
102
|
}
|
|
103
103
|
| {
|
|
104
|
-
version:
|
|
104
|
+
version: typeof A2UI_VERSION;
|
|
105
105
|
/**
|
|
106
106
|
* Sets `value` at `path`. A `null` value deletes the key at `path`.
|
|
107
107
|
* With no `path`, or `"/"`, it sets the whole data model.
|
|
108
108
|
*/
|
|
109
109
|
updateDataModel: { surfaceId: string; path?: string; value: unknown };
|
|
110
110
|
}
|
|
111
|
-
| { version: "v1.0"; deleteSurface: { surfaceId: string } }
|
|
112
111
|
| {
|
|
113
|
-
version:
|
|
112
|
+
version: typeof A2UI_VERSION;
|
|
113
|
+
deleteSurface: { surfaceId: string };
|
|
114
|
+
}
|
|
115
|
+
| {
|
|
116
|
+
version: typeof A2UI_VERSION;
|
|
114
117
|
/** Runs an app function in the browser, with no user interaction. */
|
|
115
118
|
callRendererFunction: {
|
|
116
119
|
functionCallId: string;
|
|
@@ -292,7 +295,7 @@ export interface A2UIActionMessage {
|
|
|
292
295
|
* @example
|
|
293
296
|
* ```ts
|
|
294
297
|
* toA2UIActionMessage({ name: "buy", surfaceId: "s1", componentId: "b", context: { sku: "a" } });
|
|
295
|
-
* // { version: "
|
|
298
|
+
* // { version: "1.0", action: { name: "buy", surfaceId: "s1", sourceComponentId: "b", timestamp: "2026-…", context: { sku: "a" } } }
|
|
296
299
|
* ```
|
|
297
300
|
*/
|
|
298
301
|
export function toA2UIActionMessage(
|
|
@@ -703,11 +703,11 @@ function childRefProblem(
|
|
|
703
703
|
// A bound or computed value, at the reference or above it, is known
|
|
704
704
|
// only at render.
|
|
705
705
|
if (isDynamic(value)) return undefined;
|
|
706
|
-
|
|
706
|
+
const [head, ...rest] = steps;
|
|
707
|
+
if (head === undefined) {
|
|
707
708
|
const reason = slotProblem(value, ref.kind, ownId);
|
|
708
709
|
return reason ? `${label}: ${reason}` : undefined;
|
|
709
710
|
}
|
|
710
|
-
const [head, ...rest] = steps;
|
|
711
711
|
if (head === "*") {
|
|
712
712
|
if (!Array.isArray(value)) return undefined;
|
|
713
713
|
for (const item of value) {
|
package/src/index.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
export * from "./types";
|
|
2
2
|
export * from "./utils";
|
|
3
3
|
export * from "./constants";
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// Node
|
|
7
|
-
// resolve the whole module graph before they tree-shake, so re-exporting
|
|
8
|
-
// that module here made every browser build of a dependent package print
|
|
9
|
-
// "Module ... has been externalized for browser compatibility" warnings,
|
|
10
|
-
// even when the consumer never touched telemetry (#4151). Only the
|
|
11
|
-
// browser-safe telemetry surface is re-exported from this entry. Server
|
|
12
|
-
// code that needs the client imports it from `@copilotkit/shared/telemetry`.
|
|
13
|
-
// This mirrors the license-verifier note below.
|
|
4
|
+
// Only browser-safe telemetry helpers live here. The runtime owns its
|
|
5
|
+
// telemetry client (`packages/runtime/src/runtime/telemetry`), so this package
|
|
6
|
+
// imports no Node-only analytics SDK (#4151).
|
|
14
7
|
export { isTelemetryDisabled } from "./telemetry/telemetry-disabled";
|
|
15
8
|
export * from "./telemetry/sampling";
|
|
16
9
|
// Pure string classification with no imports, so it carries no runtime edge
|
|
@@ -23,12 +16,6 @@ export {
|
|
|
23
16
|
parseAndWarnTelemetryId,
|
|
24
17
|
} from "./telemetry/lambda-client";
|
|
25
18
|
export type { LambdaSendOptions } from "./telemetry/lambda-client";
|
|
26
|
-
// Types only: erased at build time, so they add no runtime edge to
|
|
27
|
-
// `telemetry-client.ts` and therefore none to @segment/analytics-node.
|
|
28
|
-
export type {
|
|
29
|
-
TelemetryCapture,
|
|
30
|
-
TelemetryIdentity,
|
|
31
|
-
} from "./telemetry/telemetry-client";
|
|
32
19
|
export * from "./debug";
|
|
33
20
|
export * from "./standard-schema";
|
|
34
21
|
export * from "./attachments";
|
|
@@ -193,4 +180,9 @@ export type { CopilotKitUIEnvelope } from "./a2ui-envelope";
|
|
|
193
180
|
export type { DebugEventEnvelope } from "./debug-event-envelope";
|
|
194
181
|
|
|
195
182
|
export { GENERATE_SANDBOXED_UI_DESCRIPTION } from "./open-generative-ui-prompts";
|
|
196
|
-
export * from "./generative-ui";
|
|
183
|
+
export * from "./generative-ui/base";
|
|
184
|
+
// On the root, not only on `@copilotkit/shared/generative-ui`: the core
|
|
185
|
+
// root entry needs it, and importing the generative UI barrel there would
|
|
186
|
+
// load its validators and catalogs in every app (Metro does not
|
|
187
|
+
// tree-shake), and leave the UMD build without a global for the subpath.
|
|
188
|
+
export { cloneValue } from "./generative-ui/clone-value";
|
package/src/standard-schema.ts
CHANGED
|
@@ -5,6 +5,21 @@ import type {
|
|
|
5
5
|
|
|
6
6
|
export type { StandardSchemaV1, StandardJSONSchemaV1 };
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A Standard Schema that accepts any value and returns it unchanged.
|
|
10
|
+
*
|
|
11
|
+
* Wildcard tool call renderers use it when they declare no `args` schema.
|
|
12
|
+
*
|
|
13
|
+
* @internal Application authors must not depend on this contract.
|
|
14
|
+
*/
|
|
15
|
+
export const ɵanySchema: StandardSchemaV1<unknown, unknown> = {
|
|
16
|
+
"~standard": {
|
|
17
|
+
version: 1,
|
|
18
|
+
vendor: "copilotkit",
|
|
19
|
+
validate: (value) => ({ value }),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
8
23
|
/**
|
|
9
24
|
* Extract the Output type from a StandardSchemaV1 schema.
|
|
10
25
|
* Replaces `z.infer<S>` for generic schema inference.
|
|
@@ -12,18 +27,6 @@ export type { StandardSchemaV1, StandardJSONSchemaV1 };
|
|
|
12
27
|
export type InferSchemaOutput<S> =
|
|
13
28
|
S extends StandardSchemaV1<any, infer O> ? O : never;
|
|
14
29
|
|
|
15
|
-
export interface SchemaToJsonSchemaOptions {
|
|
16
|
-
/**
|
|
17
|
-
* Injected `zodToJsonSchema` function so that `shared` does not depend on
|
|
18
|
-
* `zod-to-json-schema`. Required when the schema is a Zod v3 schema that
|
|
19
|
-
* does not implement Standard JSON Schema V1.
|
|
20
|
-
*/
|
|
21
|
-
zodToJsonSchema?: (
|
|
22
|
-
schema: unknown,
|
|
23
|
-
options?: { $refStrategy?: string },
|
|
24
|
-
) => Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
30
|
/**
|
|
28
31
|
* Check whether a schema implements the Standard JSON Schema V1 protocol.
|
|
29
32
|
*/
|
|
@@ -48,35 +51,29 @@ function hasStandardJsonSchema(
|
|
|
48
51
|
* Strategy:
|
|
49
52
|
* 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),
|
|
50
53
|
* call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.
|
|
51
|
-
* 2
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
54
|
+
* Zod 4.2+, ArkType 2.1.28+ and Valibot (via `toStandardJsonSchema`) do.
|
|
55
|
+
* 2. If the schema exposes a `toJSONSchema()` method, call it directly.
|
|
56
|
+
* 3. Otherwise throw a descriptive error. Zod 3 schemas land here: they
|
|
57
|
+
* implement Standard Schema validation but cannot describe themselves as
|
|
58
|
+
* JSON Schema.
|
|
55
59
|
*/
|
|
56
60
|
export function schemaToJsonSchema(
|
|
57
61
|
schema: StandardSchemaV1,
|
|
58
|
-
options?: SchemaToJsonSchemaOptions,
|
|
59
62
|
): Record<string, unknown> {
|
|
60
63
|
// 1. Standard JSON Schema V1
|
|
61
64
|
if (hasStandardJsonSchema(schema)) {
|
|
62
65
|
return schema["~standard"].jsonSchema.input({ target: "draft-07" });
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
// 2.
|
|
68
|
+
// 2. Native toJSONSchema() method
|
|
66
69
|
if (typeof (schema as any).toJSONSchema === "function") {
|
|
67
70
|
return (schema as any).toJSONSchema() as Record<string, unknown>;
|
|
68
71
|
}
|
|
69
72
|
|
|
70
|
-
// 3. Zod v3 fallback
|
|
71
73
|
const vendor = schema["~standard"].vendor;
|
|
72
|
-
if (vendor === "zod" && options?.zodToJsonSchema) {
|
|
73
|
-
return options.zodToJsonSchema(schema, { $refStrategy: "none" });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
74
|
throw new Error(
|
|
77
|
-
`Cannot convert schema to JSON Schema. The schema (vendor: "${vendor}") does not implement Standard JSON Schema V1 ` +
|
|
78
|
-
`
|
|
79
|
-
`
|
|
80
|
-
`or pass a zodToJsonSchema function in options.`,
|
|
75
|
+
`Cannot convert schema to JSON Schema. The schema (vendor: "${vendor}") does not implement Standard JSON Schema V1. ` +
|
|
76
|
+
`Use a library that does: Zod 4.2+ (Zod 3 is not supported), Valibot v1+ wrapped with ` +
|
|
77
|
+
`toStandardJsonSchema() from @valibot/to-json-schema, or ArkType v2.1.28+.`,
|
|
81
78
|
);
|
|
82
79
|
}
|
|
@@ -109,7 +109,11 @@ export function parseTelemetryIdFromLicense(token?: string): string | null {
|
|
|
109
109
|
if (parts.length !== 3) return null;
|
|
110
110
|
try {
|
|
111
111
|
const payload = parts[1];
|
|
112
|
-
if (
|
|
112
|
+
if (
|
|
113
|
+
payload === undefined ||
|
|
114
|
+
!/^[A-Za-z0-9_-]+$/.test(payload) ||
|
|
115
|
+
payload.length % 4 === 1
|
|
116
|
+
) {
|
|
113
117
|
return null;
|
|
114
118
|
}
|
|
115
119
|
|
|
@@ -136,8 +140,9 @@ export function parseTelemetryIdFromLicense(token?: string): string | null {
|
|
|
136
140
|
// Parse the telemetry_id from a license token AND emit the rollout smoke
|
|
137
141
|
// signal if the parse returned null. Returning the parsed id lets callers
|
|
138
142
|
// cache it in one step (avoiding a second parseTelemetryIdFromLicense
|
|
139
|
-
// pass) while keeping the warn text in lockstep between v1 (shared)
|
|
140
|
-
// v2 (runtime)
|
|
143
|
+
// pass) while keeping the warn text in lockstep between the v1 (shared)
|
|
144
|
+
// TelemetryClient.setLicenseToken and the v2 (runtime)
|
|
145
|
+
// TelemetryClient.setTelemetryIdentity.
|
|
141
146
|
export function parseAndWarnTelemetryId(licenseToken: string): string | null {
|
|
142
147
|
const telemetryId = parseTelemetryIdFromLicense(licenseToken);
|
|
143
148
|
if (!telemetryId) {
|