@copilotkit/shared 2.0.0-next.1 → 2.0.0-rc.0
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/LICENSE +21 -0
- package/README.md +93 -12
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/a2ui-envelope.cjs +154 -0
- package/dist/a2ui-envelope.cjs.map +1 -0
- package/dist/a2ui-envelope.d.cts +101 -0
- package/dist/a2ui-envelope.d.cts.map +1 -0
- package/dist/a2ui-envelope.d.mts +101 -0
- package/dist/a2ui-envelope.d.mts.map +1 -0
- package/dist/a2ui-envelope.mjs +151 -0
- package/dist/a2ui-envelope.mjs.map +1 -0
- package/dist/a2ui-prompts.cjs +259 -0
- package/dist/a2ui-prompts.cjs.map +1 -0
- package/dist/a2ui-prompts.d.cts +79 -0
- package/dist/a2ui-prompts.d.cts.map +1 -0
- package/dist/a2ui-prompts.d.mts +79 -0
- package/dist/a2ui-prompts.d.mts.map +1 -0
- package/dist/a2ui-prompts.mjs +251 -0
- package/dist/a2ui-prompts.mjs.map +1 -0
- package/dist/attachments/content.cjs +17 -0
- package/dist/attachments/content.cjs.map +1 -0
- package/dist/attachments/content.d.cts +9 -0
- package/dist/attachments/content.d.cts.map +1 -0
- package/dist/attachments/content.d.mts +9 -0
- package/dist/attachments/content.d.mts.map +1 -0
- package/dist/attachments/content.mjs +16 -0
- package/dist/attachments/content.mjs.map +1 -0
- package/dist/attachments/types.d.cts +64 -0
- package/dist/attachments/types.d.cts.map +1 -0
- package/dist/attachments/types.d.mts +64 -0
- package/dist/attachments/types.d.mts.map +1 -0
- package/dist/attachments/utils.cjs +137 -0
- package/dist/attachments/utils.cjs.map +1 -0
- package/dist/attachments/utils.d.cts +44 -0
- package/dist/attachments/utils.d.cts.map +1 -0
- package/dist/attachments/utils.d.mts +44 -0
- package/dist/attachments/utils.d.mts.map +1 -0
- package/dist/attachments/utils.mjs +129 -0
- package/dist/attachments/utils.mjs.map +1 -0
- package/dist/constants/index.cjs +25 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +17 -0
- package/dist/constants/index.d.cts.map +1 -0
- package/dist/constants/index.d.mts +17 -0
- package/dist/constants/index.d.mts.map +1 -0
- package/dist/constants/index.mjs +17 -12
- package/dist/constants/index.mjs.map +1 -1
- package/dist/debug-event-envelope.d.cts +13 -0
- package/dist/debug-event-envelope.d.cts.map +1 -0
- package/dist/debug-event-envelope.d.mts +13 -0
- package/dist/debug-event-envelope.d.mts.map +1 -0
- package/dist/debug.cjs +38 -0
- package/dist/debug.cjs.map +1 -0
- package/dist/debug.d.cts +29 -0
- package/dist/debug.d.cts.map +1 -0
- package/dist/debug.d.mts +29 -0
- package/dist/debug.d.mts.map +1 -0
- package/dist/debug.mjs +37 -0
- package/dist/debug.mjs.map +1 -0
- package/dist/event-transforms/index.cjs +15 -0
- package/dist/event-transforms/index.d.cts +4 -0
- package/dist/event-transforms/index.d.mts +4 -0
- package/dist/event-transforms/index.mjs +5 -0
- package/dist/event-transforms/open-generative-ui-middleware.cjs +286 -0
- package/dist/event-transforms/open-generative-ui-middleware.cjs.map +1 -0
- package/dist/event-transforms/open-generative-ui-middleware.d.cts +60 -0
- package/dist/event-transforms/open-generative-ui-middleware.d.cts.map +1 -0
- package/dist/event-transforms/open-generative-ui-middleware.d.mts +60 -0
- package/dist/event-transforms/open-generative-ui-middleware.d.mts.map +1 -0
- package/dist/event-transforms/open-generative-ui-middleware.mjs +283 -0
- package/dist/event-transforms/open-generative-ui-middleware.mjs.map +1 -0
- package/dist/event-transforms/recorded-events.cjs +59 -0
- package/dist/event-transforms/recorded-events.cjs.map +1 -0
- package/dist/event-transforms/recorded-events.d.cts +23 -0
- package/dist/event-transforms/recorded-events.d.cts.map +1 -0
- package/dist/event-transforms/recorded-events.d.mts +23 -0
- package/dist/event-transforms/recorded-events.d.mts.map +1 -0
- package/dist/event-transforms/recorded-events.mjs +58 -0
- package/dist/event-transforms/recorded-events.mjs.map +1 -0
- package/dist/finalize-events.cjs +186 -0
- package/dist/finalize-events.cjs.map +1 -0
- package/dist/finalize-events.d.cts +40 -0
- package/dist/finalize-events.d.cts.map +1 -0
- package/dist/finalize-events.d.mts +40 -0
- package/dist/finalize-events.d.mts.map +1 -0
- package/dist/finalize-events.mjs +184 -0
- package/dist/finalize-events.mjs.map +1 -0
- package/dist/generative-ui/basic-functions.cjs +177 -0
- package/dist/generative-ui/basic-functions.cjs.map +1 -0
- package/dist/generative-ui/basic-functions.d.cts +108 -0
- package/dist/generative-ui/basic-functions.d.cts.map +1 -0
- package/dist/generative-ui/basic-functions.d.mts +108 -0
- package/dist/generative-ui/basic-functions.d.mts.map +1 -0
- package/dist/generative-ui/basic-functions.mjs +167 -0
- package/dist/generative-ui/basic-functions.mjs.map +1 -0
- package/dist/generative-ui/child-refs.cjs +161 -0
- package/dist/generative-ui/child-refs.cjs.map +1 -0
- package/dist/generative-ui/child-refs.d.cts +68 -0
- package/dist/generative-ui/child-refs.d.cts.map +1 -0
- package/dist/generative-ui/child-refs.d.mts +68 -0
- package/dist/generative-ui/child-refs.d.mts.map +1 -0
- package/dist/generative-ui/child-refs.mjs +152 -0
- package/dist/generative-ui/child-refs.mjs.map +1 -0
- package/dist/generative-ui/is-record.cjs +10 -0
- package/dist/generative-ui/is-record.cjs.map +1 -0
- package/dist/generative-ui/is-record.mjs +9 -0
- package/dist/generative-ui/is-record.mjs.map +1 -0
- package/dist/generative-ui/prompt.cjs +91 -0
- package/dist/generative-ui/prompt.cjs.map +1 -0
- package/dist/generative-ui/prompt.d.cts +13 -0
- package/dist/generative-ui/prompt.d.cts.map +1 -0
- package/dist/generative-ui/prompt.d.mts +13 -0
- package/dist/generative-ui/prompt.d.mts.map +1 -0
- package/dist/generative-ui/prompt.mjs +90 -0
- package/dist/generative-ui/prompt.mjs.map +1 -0
- package/dist/generative-ui/render-ui-args.cjs +160 -0
- package/dist/generative-ui/render-ui-args.cjs.map +1 -0
- package/dist/generative-ui/render-ui-args.d.cts +40 -0
- package/dist/generative-ui/render-ui-args.d.cts.map +1 -0
- package/dist/generative-ui/render-ui-args.d.mts +40 -0
- package/dist/generative-ui/render-ui-args.d.mts.map +1 -0
- package/dist/generative-ui/render-ui-args.mjs +159 -0
- package/dist/generative-ui/render-ui-args.mjs.map +1 -0
- package/dist/generative-ui/types.cjs +101 -0
- package/dist/generative-ui/types.cjs.map +1 -0
- package/dist/generative-ui/types.d.cts +270 -0
- package/dist/generative-ui/types.d.cts.map +1 -0
- package/dist/generative-ui/types.d.mts +270 -0
- package/dist/generative-ui/types.d.mts.map +1 -0
- package/dist/generative-ui/types.mjs +86 -0
- package/dist/generative-ui/types.mjs.map +1 -0
- package/dist/generative-ui/validate-operation.cjs +405 -0
- package/dist/generative-ui/validate-operation.cjs.map +1 -0
- package/dist/generative-ui/validate-operation.d.cts +86 -0
- package/dist/generative-ui/validate-operation.d.cts.map +1 -0
- package/dist/generative-ui/validate-operation.d.mts +86 -0
- package/dist/generative-ui/validate-operation.d.mts.map +1 -0
- package/dist/generative-ui/validate-operation.mjs +399 -0
- package/dist/generative-ui/validate-operation.mjs.map +1 -0
- package/dist/index.cjs +233 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +80 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +80 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +78 -123
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +3979 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/intelligence-routing-fields.cjs +35 -0
- package/dist/intelligence-routing-fields.cjs.map +1 -0
- package/dist/intelligence-routing-fields.d.cts +18 -0
- package/dist/intelligence-routing-fields.d.cts.map +1 -0
- package/dist/intelligence-routing-fields.d.mts +18 -0
- package/dist/intelligence-routing-fields.d.mts.map +1 -0
- package/dist/intelligence-routing-fields.mjs +34 -0
- package/dist/intelligence-routing-fields.mjs.map +1 -0
- package/dist/logger.cjs +7 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +5 -0
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +5 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/logger.mjs +6 -0
- package/dist/logger.mjs.map +1 -0
- package/dist/open-generative-ui-prompts.cjs +8 -0
- package/dist/open-generative-ui-prompts.cjs.map +1 -0
- package/dist/open-generative-ui-prompts.d.cts +6 -0
- package/dist/open-generative-ui-prompts.d.cts.map +1 -0
- package/dist/open-generative-ui-prompts.d.mts +6 -0
- package/dist/open-generative-ui-prompts.d.mts.map +1 -0
- package/dist/open-generative-ui-prompts.mjs +7 -0
- package/dist/open-generative-ui-prompts.mjs.map +1 -0
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.mjs +6 -0
- package/dist/package.mjs.map +1 -0
- package/dist/standard-schema.cjs +31 -0
- package/dist/standard-schema.cjs.map +1 -0
- package/dist/standard-schema.d.cts +33 -0
- package/dist/standard-schema.d.cts.map +1 -0
- package/dist/standard-schema.d.mts +33 -0
- package/dist/standard-schema.d.mts.map +1 -0
- package/dist/standard-schema.mjs +30 -0
- package/dist/standard-schema.mjs.map +1 -0
- package/dist/telemetry/events.d.cts +72 -0
- package/dist/telemetry/events.d.cts.map +1 -0
- package/dist/telemetry/events.d.mts +72 -0
- package/dist/telemetry/events.d.mts.map +1 -0
- package/dist/telemetry/index.cjs +18 -0
- package/dist/telemetry/index.d.cts +5 -0
- package/dist/telemetry/index.d.mts +5 -0
- package/dist/telemetry/index.mjs +6 -12
- package/dist/telemetry/lambda-client.cjs +91 -0
- package/dist/telemetry/lambda-client.cjs.map +1 -0
- package/dist/telemetry/lambda-client.d.cts +31 -0
- package/dist/telemetry/lambda-client.d.cts.map +1 -0
- package/dist/telemetry/lambda-client.d.mts +31 -0
- package/dist/telemetry/lambda-client.d.mts.map +1 -0
- package/dist/telemetry/lambda-client.mjs +87 -0
- package/dist/telemetry/lambda-client.mjs.map +1 -0
- package/dist/telemetry/model-host.cjs +104 -0
- package/dist/telemetry/model-host.cjs.map +1 -0
- package/dist/telemetry/model-host.d.cts +26 -0
- package/dist/telemetry/model-host.d.cts.map +1 -0
- package/dist/telemetry/model-host.d.mts +26 -0
- package/dist/telemetry/model-host.d.mts.map +1 -0
- package/dist/telemetry/model-host.mjs +102 -0
- package/dist/telemetry/model-host.mjs.map +1 -0
- package/dist/telemetry/sampling.cjs +50 -0
- package/dist/telemetry/sampling.cjs.map +1 -0
- package/dist/telemetry/sampling.d.cts +57 -0
- package/dist/telemetry/sampling.d.cts.map +1 -0
- package/dist/telemetry/sampling.d.mts +57 -0
- package/dist/telemetry/sampling.d.mts.map +1 -0
- package/dist/telemetry/sampling.mjs +44 -0
- package/dist/telemetry/sampling.mjs.map +1 -0
- package/dist/telemetry/telemetry-client.cjs +165 -0
- package/dist/telemetry/telemetry-client.cjs.map +1 -0
- package/dist/telemetry/telemetry-client.d.cts +87 -0
- package/dist/telemetry/telemetry-client.d.cts.map +1 -0
- package/dist/telemetry/telemetry-client.d.mts +87 -0
- package/dist/telemetry/telemetry-client.d.mts.map +1 -0
- package/dist/telemetry/telemetry-client.mjs +162 -9
- package/dist/telemetry/telemetry-client.mjs.map +1 -1
- package/dist/telemetry/telemetry-disabled.cjs +20 -0
- package/dist/telemetry/telemetry-disabled.cjs.map +1 -0
- package/dist/telemetry/telemetry-disabled.d.cts +16 -0
- package/dist/telemetry/telemetry-disabled.d.cts.map +1 -0
- package/dist/telemetry/telemetry-disabled.d.mts +16 -0
- package/dist/telemetry/telemetry-disabled.d.mts.map +1 -0
- package/dist/telemetry/telemetry-disabled.mjs +19 -0
- package/dist/telemetry/telemetry-disabled.mjs.map +1 -0
- package/dist/telemetry/utils.cjs +14 -0
- package/dist/telemetry/utils.cjs.map +1 -0
- package/dist/telemetry/utils.mjs +12 -8
- package/dist/telemetry/utils.mjs.map +1 -1
- package/dist/transcription-errors.cjs +84 -0
- package/dist/transcription-errors.cjs.map +1 -0
- package/dist/transcription-errors.d.cts +52 -0
- package/dist/transcription-errors.d.cts.map +1 -0
- package/dist/transcription-errors.d.mts +52 -0
- package/dist/transcription-errors.d.mts.map +1 -0
- package/dist/transcription-errors.mjs +82 -0
- package/dist/transcription-errors.mjs.map +1 -0
- package/dist/types/{action.d.ts → action.d.cts} +32 -32
- package/dist/types/action.d.cts.map +1 -0
- package/dist/types/action.d.mts +59 -0
- package/dist/types/action.d.mts.map +1 -0
- package/dist/types/copilot-cloud-config.d.cts +15 -0
- package/dist/types/copilot-cloud-config.d.cts.map +1 -0
- package/dist/types/copilot-cloud-config.d.mts +15 -0
- package/dist/types/copilot-cloud-config.d.mts.map +1 -0
- package/dist/types/error.d.cts +57 -0
- package/dist/types/error.d.cts.map +1 -0
- package/dist/types/error.d.mts +57 -0
- package/dist/types/error.d.mts.map +1 -0
- package/dist/types/message.d.cts +42 -0
- package/dist/types/message.d.cts.map +1 -0
- package/dist/types/message.d.mts +42 -0
- package/dist/types/message.d.mts.map +1 -0
- package/dist/types/openai-assistant.d.cts +55 -0
- package/dist/types/openai-assistant.d.cts.map +1 -0
- package/dist/types/openai-assistant.d.mts +55 -0
- package/dist/types/openai-assistant.d.mts.map +1 -0
- package/dist/types/utility.d.cts +6 -0
- package/dist/types/utility.d.cts.map +1 -0
- package/dist/types/utility.d.mts +6 -0
- package/dist/types/utility.d.mts.map +1 -0
- package/dist/utils/clipboard.cjs +28 -0
- package/dist/utils/clipboard.cjs.map +1 -0
- package/dist/utils/clipboard.d.cts +14 -0
- package/dist/utils/clipboard.d.cts.map +1 -0
- package/dist/utils/clipboard.d.mts +14 -0
- package/dist/utils/clipboard.d.mts.map +1 -0
- package/dist/utils/clipboard.mjs +27 -0
- package/dist/utils/clipboard.mjs.map +1 -0
- package/dist/utils/conditions.cjs +32 -0
- package/dist/utils/conditions.cjs.map +1 -0
- package/dist/utils/{conditions.d.ts → conditions.d.cts} +16 -11
- package/dist/utils/conditions.d.cts.map +1 -0
- package/dist/utils/conditions.d.mts +31 -0
- package/dist/utils/conditions.d.mts.map +1 -0
- package/dist/utils/conditions.mjs +30 -6
- package/dist/utils/conditions.mjs.map +1 -1
- package/dist/utils/console-styling.cjs +91 -0
- package/dist/utils/console-styling.cjs.map +1 -0
- package/dist/utils/console-styling.d.cts +65 -0
- package/dist/utils/console-styling.d.cts.map +1 -0
- package/dist/utils/console-styling.d.mts +65 -0
- package/dist/utils/console-styling.d.mts.map +1 -0
- package/dist/utils/console-styling.mjs +83 -15
- package/dist/utils/console-styling.mjs.map +1 -1
- package/dist/utils/dashboard-url.cjs +19 -0
- package/dist/utils/dashboard-url.cjs.map +1 -0
- package/dist/utils/dashboard-url.mjs +18 -0
- package/dist/utils/dashboard-url.mjs.map +1 -0
- package/dist/utils/errors.cjs +439 -0
- package/dist/utils/errors.cjs.map +1 -0
- package/dist/utils/{errors.d.ts → errors.d.cts} +188 -156
- package/dist/utils/errors.d.cts.map +1 -0
- package/dist/utils/errors.d.mts +312 -0
- package/dist/utils/errors.d.mts.map +1 -0
- package/dist/utils/errors.mjs +416 -63
- package/dist/utils/errors.mjs.map +1 -1
- package/dist/utils/index.cjs +105 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +58 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +58 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +97 -107
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/inspector-learning.cjs +217 -0
- package/dist/utils/inspector-learning.cjs.map +1 -0
- package/dist/utils/inspector-learning.d.cts +104 -0
- package/dist/utils/inspector-learning.d.cts.map +1 -0
- package/dist/utils/inspector-learning.d.mts +104 -0
- package/dist/utils/inspector-learning.d.mts.map +1 -0
- package/dist/utils/inspector-learning.mjs +215 -0
- package/dist/utils/inspector-learning.mjs.map +1 -0
- package/dist/utils/inspector-metadata.cjs +146 -0
- package/dist/utils/inspector-metadata.cjs.map +1 -0
- package/dist/utils/inspector-metadata.d.cts +55 -0
- package/dist/utils/inspector-metadata.d.cts.map +1 -0
- package/dist/utils/inspector-metadata.d.mts +55 -0
- package/dist/utils/inspector-metadata.d.mts.map +1 -0
- package/dist/utils/inspector-metadata.mjs +146 -0
- package/dist/utils/inspector-metadata.mjs.map +1 -0
- package/dist/utils/inspector-visibility.cjs +13 -0
- package/dist/utils/inspector-visibility.cjs.map +1 -0
- package/dist/utils/inspector-visibility.d.cts +18 -0
- package/dist/utils/inspector-visibility.d.cts.map +1 -0
- package/dist/utils/inspector-visibility.d.mts +18 -0
- package/dist/utils/inspector-visibility.d.mts.map +1 -0
- package/dist/utils/inspector-visibility.mjs +12 -0
- package/dist/utils/inspector-visibility.mjs.map +1 -0
- package/dist/utils/json-schema.cjs +215 -0
- package/dist/utils/json-schema.cjs.map +1 -0
- package/dist/utils/{json-schema.d.ts → json-schema.d.cts} +20 -18
- package/dist/utils/json-schema.d.cts.map +1 -0
- package/dist/utils/json-schema.d.mts +36 -0
- package/dist/utils/json-schema.d.mts.map +1 -0
- package/dist/utils/json-schema.mjs +210 -12
- package/dist/utils/json-schema.mjs.map +1 -1
- package/dist/utils/random-id.cjs +38 -0
- package/dist/utils/random-id.cjs.map +1 -0
- package/dist/utils/{random-id.d.ts → random-id.d.cts} +3 -1
- package/dist/utils/random-id.d.cts.map +1 -0
- package/dist/utils/random-id.d.mts +8 -0
- package/dist/utils/random-id.d.mts.map +1 -0
- package/dist/utils/random-id.mjs +33 -12
- package/dist/utils/random-id.mjs.map +1 -1
- package/dist/utils/requests.cjs +58 -0
- package/dist/utils/requests.cjs.map +1 -0
- package/dist/utils/{requests.d.ts → requests.d.cts} +3 -1
- package/dist/utils/requests.d.cts.map +1 -0
- package/dist/utils/requests.d.mts +12 -0
- package/dist/utils/requests.d.mts.map +1 -0
- package/dist/utils/requests.mjs +56 -6
- package/dist/utils/requests.mjs.map +1 -1
- package/dist/utils/row-render-keys.cjs +206 -0
- package/dist/utils/row-render-keys.cjs.map +1 -0
- package/dist/utils/row-render-keys.d.cts +65 -0
- package/dist/utils/row-render-keys.d.cts.map +1 -0
- package/dist/utils/row-render-keys.d.mts +65 -0
- package/dist/utils/row-render-keys.d.mts.map +1 -0
- package/dist/utils/row-render-keys.mjs +201 -0
- package/dist/utils/row-render-keys.mjs.map +1 -0
- package/dist/utils/types.cjs +9 -0
- package/dist/utils/types.cjs.map +1 -0
- package/dist/utils/types.d.cts +122 -0
- package/dist/utils/types.d.cts.map +1 -0
- package/dist/utils/types.d.mts +122 -0
- package/dist/utils/types.d.mts.map +1 -0
- package/dist/utils/types.mjs +6 -1
- package/dist/utils/types.mjs.map +1 -1
- package/package.json +74 -40
- package/scripts/verify-cjs-exports.cjs +16 -0
- package/src/__tests__/a2ui-envelope.test.ts +434 -0
- package/src/__tests__/a2ui-prompts.test.ts +362 -0
- package/src/__tests__/debug.test.ts +116 -0
- package/src/__tests__/license-context.test.ts +253 -0
- package/src/__tests__/root-entry-browser-safety.test.ts +91 -0
- package/src/__tests__/standard-schema-types.test.ts +144 -0
- package/src/__tests__/standard-schema.test.ts +359 -0
- package/src/__tests__/zod-regression.test.ts +319 -0
- package/src/a2ui-envelope.ts +309 -0
- package/src/a2ui-prompts.ts +322 -0
- package/src/attachments/__tests__/utils.test.ts +214 -0
- package/src/attachments/content.test.ts +48 -0
- package/src/attachments/content.ts +16 -0
- package/src/attachments/index.ts +21 -0
- package/src/attachments/types.ts +77 -0
- package/src/attachments/utils.ts +169 -0
- package/src/constants/index.ts +14 -1
- package/src/debug-event-envelope.ts +9 -0
- package/src/debug.ts +55 -0
- package/src/event-transforms/index.ts +5 -0
- package/src/event-transforms/open-generative-ui-middleware.ts +392 -0
- package/src/event-transforms/recorded-events.test.ts +166 -0
- package/src/event-transforms/recorded-events.ts +74 -0
- package/src/finalize-events.test.ts +284 -0
- package/src/finalize-events.ts +260 -0
- package/src/generative-ui/__tests__/render-ui-args.test.ts +175 -0
- package/src/generative-ui/__tests__/validate-operation.test.ts +977 -0
- package/src/generative-ui/basic-functions.ts +282 -0
- package/src/generative-ui/child-refs.ts +210 -0
- package/src/generative-ui/index.ts +6 -0
- package/src/generative-ui/is-record.ts +4 -0
- package/src/generative-ui/prompt.ts +174 -0
- package/src/generative-ui/render-ui-args.ts +199 -0
- package/src/generative-ui/types.ts +314 -0
- package/src/generative-ui/validate-operation.ts +723 -0
- package/src/index.ts +190 -1
- package/src/intelligence-routing-fields.test.ts +51 -0
- package/src/intelligence-routing-fields.ts +40 -0
- package/src/logger.ts +1 -0
- package/src/open-generative-ui-prompts.ts +20 -0
- package/src/standard-schema.ts +82 -0
- package/src/telemetry/events.ts +37 -10
- package/src/telemetry/index.ts +8 -0
- package/src/telemetry/lambda-client.test.ts +446 -0
- package/src/telemetry/lambda-client.ts +194 -0
- package/src/telemetry/model-host.test.ts +145 -0
- package/src/telemetry/model-host.ts +156 -0
- package/src/telemetry/sampling.test.ts +65 -0
- package/src/telemetry/sampling.ts +103 -0
- package/src/telemetry/telemetry-blank-license-identity.test.ts +128 -0
- package/src/telemetry/telemetry-client.test.ts +798 -0
- package/src/telemetry/telemetry-client.ts +223 -37
- package/src/telemetry/telemetry-disabled.ts +22 -0
- package/src/telemetry/utils.ts +0 -24
- package/src/transcription-errors.ts +99 -0
- package/src/types/__tests__/message.test.ts +62 -0
- package/src/types/action.ts +9 -5
- package/src/types/error.ts +11 -2
- package/src/types/message.ts +33 -5
- package/src/types/openai-assistant.ts +6 -2
- package/src/utils/__tests__/clipboard.test.ts +87 -0
- package/src/utils/__tests__/conditions.test.ts +161 -0
- package/src/utils/__tests__/json-schema.test.ts +812 -0
- package/src/utils/__tests__/row-render-keys.test.ts +388 -0
- package/src/utils/clipboard.ts +23 -0
- package/src/utils/conditions.ts +27 -9
- package/src/utils/console-styling.ts +10 -8
- package/src/utils/dashboard-url.ts +17 -0
- package/src/utils/errors.ts +55 -22
- package/src/utils/index.ts +70 -1
- package/src/utils/inspector-learning.test.ts +423 -0
- package/src/utils/inspector-learning.ts +523 -0
- package/src/utils/inspector-metadata.test.ts +743 -0
- package/src/utils/inspector-metadata.ts +263 -0
- package/src/utils/inspector-visibility.test.ts +43 -0
- package/src/utils/inspector-visibility.ts +17 -0
- package/src/utils/json-schema.ts +156 -12
- package/src/utils/random-id.ts +5 -2
- package/src/utils/requests.ts +3 -1
- package/src/utils/row-render-keys.ts +263 -0
- package/src/utils/types.ts +128 -1
- package/src/utils.test.ts +137 -0
- package/tsconfig.json +10 -2
- package/tsdown.config.ts +49 -0
- package/vitest.config.mjs +11 -0
- package/CHANGELOG.md +0 -1817
- package/dist/chunk-2OJ5OJ2D.mjs +0 -1
- package/dist/chunk-2OJ5OJ2D.mjs.map +0 -1
- package/dist/chunk-64DYJ27R.mjs +0 -201
- package/dist/chunk-64DYJ27R.mjs.map +0 -1
- package/dist/chunk-6QGXWNS5.mjs +0 -34
- package/dist/chunk-6QGXWNS5.mjs.map +0 -1
- package/dist/chunk-6W2UEO2M.mjs +0 -94
- package/dist/chunk-6W2UEO2M.mjs.map +0 -1
- package/dist/chunk-7DJDTRNX.mjs +0 -426
- package/dist/chunk-7DJDTRNX.mjs.map +0 -1
- package/dist/chunk-A66772CV.mjs +0 -107
- package/dist/chunk-A66772CV.mjs.map +0 -1
- package/dist/chunk-BOKE4OKY.mjs +0 -41
- package/dist/chunk-BOKE4OKY.mjs.map +0 -1
- package/dist/chunk-FCCOSO5L.mjs +0 -1
- package/dist/chunk-FCCOSO5L.mjs.map +0 -1
- package/dist/chunk-GYZIHHE6.mjs +0 -13
- package/dist/chunk-GYZIHHE6.mjs.map +0 -1
- package/dist/chunk-IAFBVORQ.mjs +0 -1
- package/dist/chunk-IAFBVORQ.mjs.map +0 -1
- package/dist/chunk-JAAUCDUR.mjs +0 -38
- package/dist/chunk-JAAUCDUR.mjs.map +0 -1
- package/dist/chunk-MSUB6DGR.mjs +0 -1
- package/dist/chunk-MSUB6DGR.mjs.map +0 -1
- package/dist/chunk-N5EP5OD5.mjs +0 -1
- package/dist/chunk-N5EP5OD5.mjs.map +0 -1
- package/dist/chunk-NAFEBKSO.mjs +0 -1
- package/dist/chunk-NAFEBKSO.mjs.map +0 -1
- package/dist/chunk-P7STFMPO.mjs +0 -1
- package/dist/chunk-P7STFMPO.mjs.map +0 -1
- package/dist/chunk-PL5WNHFZ.mjs +0 -50
- package/dist/chunk-PL5WNHFZ.mjs.map +0 -1
- package/dist/chunk-UYARLQNA.mjs +0 -1
- package/dist/chunk-UYARLQNA.mjs.map +0 -1
- package/dist/chunk-XEMZTHQZ.mjs +0 -67
- package/dist/chunk-XEMZTHQZ.mjs.map +0 -1
- package/dist/chunk-XTHC46M2.mjs +0 -1
- package/dist/chunk-XTHC46M2.mjs.map +0 -1
- package/dist/constants/index.d.ts +0 -6
- package/dist/constants/index.js +0 -40
- package/dist/constants/index.js.map +0 -1
- package/dist/index.d.ts +0 -25
- package/dist/index.js +0 -1098
- package/dist/index.js.map +0 -1
- package/dist/telemetry/events.d.ts +0 -45
- package/dist/telemetry/events.js +0 -19
- package/dist/telemetry/events.js.map +0 -1
- package/dist/telemetry/events.mjs +0 -1
- package/dist/telemetry/events.mjs.map +0 -1
- package/dist/telemetry/index.d.ts +0 -3
- package/dist/telemetry/index.js +0 -188
- package/dist/telemetry/index.js.map +0 -1
- package/dist/telemetry/index.mjs.map +0 -1
- package/dist/telemetry/scarf-client.d.ts +0 -7
- package/dist/telemetry/scarf-client.js +0 -59
- package/dist/telemetry/scarf-client.js.map +0 -1
- package/dist/telemetry/scarf-client.mjs +0 -7
- package/dist/telemetry/scarf-client.mjs.map +0 -1
- package/dist/telemetry/security-check.d.ts +0 -2
- package/dist/telemetry/security-check.js +0 -2
- package/dist/telemetry/security-check.js.map +0 -1
- package/dist/telemetry/security-check.mjs +0 -1
- package/dist/telemetry/security-check.mjs.map +0 -1
- package/dist/telemetry/telemetry-client.d.ts +0 -40
- package/dist/telemetry/telemetry-client.js +0 -186
- package/dist/telemetry/telemetry-client.js.map +0 -1
- package/dist/telemetry/utils.d.ts +0 -8
- package/dist/telemetry/utils.js +0 -69
- package/dist/telemetry/utils.js.map +0 -1
- package/dist/types/action.js +0 -19
- package/dist/types/action.js.map +0 -1
- package/dist/types/action.mjs +0 -2
- package/dist/types/action.mjs.map +0 -1
- package/dist/types/copilot-cloud-config.d.ts +0 -13
- package/dist/types/copilot-cloud-config.js +0 -19
- package/dist/types/copilot-cloud-config.js.map +0 -1
- package/dist/types/copilot-cloud-config.mjs +0 -2
- package/dist/types/copilot-cloud-config.mjs.map +0 -1
- package/dist/types/error.d.ts +0 -55
- package/dist/types/error.js +0 -19
- package/dist/types/error.js.map +0 -1
- package/dist/types/error.mjs +0 -2
- package/dist/types/error.mjs.map +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.js +0 -19
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -8
- package/dist/types/index.mjs.map +0 -1
- package/dist/types/message.d.ts +0 -26
- package/dist/types/message.js +0 -19
- package/dist/types/message.js.map +0 -1
- package/dist/types/message.mjs +0 -2
- package/dist/types/message.mjs.map +0 -1
- package/dist/types/openai-assistant.d.ts +0 -53
- package/dist/types/openai-assistant.js +0 -19
- package/dist/types/openai-assistant.js.map +0 -1
- package/dist/types/openai-assistant.mjs +0 -2
- package/dist/types/openai-assistant.mjs.map +0 -1
- package/dist/types/utility.d.ts +0 -6
- package/dist/types/utility.js +0 -19
- package/dist/types/utility.js.map +0 -1
- package/dist/types/utility.mjs +0 -2
- package/dist/types/utility.mjs.map +0 -1
- package/dist/utils/conditions.js +0 -74
- package/dist/utils/conditions.js.map +0 -1
- package/dist/utils/console-styling.d.ts +0 -84
- package/dist/utils/console-styling.js +0 -123
- package/dist/utils/console-styling.js.map +0 -1
- package/dist/utils/errors.js +0 -443
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/index.d.ts +0 -32
- package/dist/utils/index.js +0 -927
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/json-schema.js +0 -228
- package/dist/utils/json-schema.js.map +0 -1
- package/dist/utils/random-id.js +0 -68
- package/dist/utils/random-id.js.map +0 -1
- package/dist/utils/requests.js +0 -91
- package/dist/utils/requests.js.map +0 -1
- package/dist/utils/types.d.ts +0 -20
- package/dist/utils/types.js +0 -19
- package/dist/utils/types.js.map +0 -1
- package/jest.config.js +0 -5
- package/src/telemetry/scarf-client.ts +0 -39
- package/src/telemetry/security-check.ts +0 -0
- package/src/utils/json-schema.test.ts +0 -383
- package/tsup.config.ts +0 -11
|
@@ -1,11 +1,164 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { isTelemetryDisabled } from "./telemetry-disabled.mjs";
|
|
2
|
+
import { TELEMETRY_EMITTER_V1, TELEMETRY_SURFACE_V1, UNSAMPLED_RATE, computeSamplingMeta } from "./sampling.mjs";
|
|
3
|
+
import { firstNonBlankTelemetryId, lambdaClient, parseAndWarnTelemetryId } from "./lambda-client.mjs";
|
|
4
|
+
import { flattenObject } from "./utils.mjs";
|
|
5
|
+
import { v4 } from "uuid";
|
|
6
|
+
import { Analytics } from "@segment/analytics-node";
|
|
7
|
+
|
|
8
|
+
//#region src/telemetry/telemetry-client.ts
|
|
9
|
+
var TelemetryClient = class {
|
|
10
|
+
constructor({ packageName, packageVersion, telemetryDisabled, telemetryBaseUrl, sampleRate }) {
|
|
11
|
+
this.globalProperties = {};
|
|
12
|
+
this.cloudConfiguration = null;
|
|
13
|
+
this.licenseToken = null;
|
|
14
|
+
this.telemetryId = null;
|
|
15
|
+
this.licenseTelemetryId = null;
|
|
16
|
+
this.telemetryDisabled = false;
|
|
17
|
+
this.segmentSampleRate = .05;
|
|
18
|
+
this.anonymousId = `anon_${v4()}`;
|
|
19
|
+
this.packageName = packageName;
|
|
20
|
+
this.packageVersion = packageVersion;
|
|
21
|
+
this.telemetryDisabled = telemetryDisabled || isTelemetryDisabled();
|
|
22
|
+
if (this.telemetryDisabled) return;
|
|
23
|
+
this.setSampleRate(sampleRate);
|
|
24
|
+
this.segment = new Analytics({ writeKey: process.env.COPILOTKIT_SEGMENT_WRITE_KEY || "n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja" });
|
|
25
|
+
this.setGlobalProperties({
|
|
26
|
+
"copilotkit.package.name": packageName,
|
|
27
|
+
"copilotkit.package.version": packageVersion
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
shouldSendToSegment() {
|
|
31
|
+
return Math.random() < this.segmentSampleRate;
|
|
32
|
+
}
|
|
33
|
+
async capture(event, properties) {
|
|
34
|
+
return this.captureWithIdentity(event, properties, {
|
|
35
|
+
telemetryId: this.telemetryId,
|
|
36
|
+
licenseToken: this.licenseToken,
|
|
37
|
+
licenseTelemetryId: this.licenseTelemetryId
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async captureWithIdentity(event, properties, identity) {
|
|
41
|
+
if (this.telemetryDisabled || isTelemetryDisabled()) return;
|
|
42
|
+
const sendToSegment = Boolean(identity.licenseTelemetryId) || this.shouldSendToSegment();
|
|
43
|
+
const lambdaSamplingMeta = computeSamplingMeta({
|
|
44
|
+
telemetryId: identity.licenseTelemetryId,
|
|
45
|
+
sampleRate: UNSAMPLED_RATE
|
|
46
|
+
});
|
|
47
|
+
const segmentSamplingMeta = computeSamplingMeta({
|
|
48
|
+
telemetryId: identity.licenseTelemetryId,
|
|
49
|
+
sampleRate: this.segmentSampleRate
|
|
50
|
+
});
|
|
51
|
+
const eventMeta = {
|
|
52
|
+
telemetry_emitter: TELEMETRY_EMITTER_V1,
|
|
53
|
+
telemetry_surface: TELEMETRY_SURFACE_V1,
|
|
54
|
+
telemetry_event_id: v4()
|
|
55
|
+
};
|
|
56
|
+
const flattenedProperties = flattenObject(properties);
|
|
57
|
+
const propertiesWithGlobal = {
|
|
58
|
+
...this.globalProperties,
|
|
59
|
+
...eventMeta,
|
|
60
|
+
...segmentSamplingMeta,
|
|
61
|
+
telemetry_transport: "segment",
|
|
62
|
+
...flattenedProperties
|
|
63
|
+
};
|
|
64
|
+
const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal).sort().reduce((obj, key) => {
|
|
65
|
+
obj[key] = propertiesWithGlobal[key];
|
|
66
|
+
return obj;
|
|
67
|
+
}, {});
|
|
68
|
+
await lambdaClient.send({
|
|
69
|
+
event,
|
|
70
|
+
properties: flattenedProperties,
|
|
71
|
+
globalProperties: {
|
|
72
|
+
...this.globalProperties,
|
|
73
|
+
...eventMeta,
|
|
74
|
+
...lambdaSamplingMeta,
|
|
75
|
+
telemetry_transport: "lambda"
|
|
76
|
+
},
|
|
77
|
+
packageName: this.packageName,
|
|
78
|
+
packageVersion: this.packageVersion,
|
|
79
|
+
telemetryId: identity.telemetryId ?? void 0,
|
|
80
|
+
licenseToken: identity.licenseToken ?? void 0
|
|
81
|
+
});
|
|
82
|
+
if (this.segment && sendToSegment) this.segment.track({
|
|
83
|
+
anonymousId: this.anonymousId,
|
|
84
|
+
event,
|
|
85
|
+
properties: { ...orderedPropertiesWithGlobal }
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
setGlobalProperties(properties) {
|
|
89
|
+
const flattenedProperties = flattenObject(properties);
|
|
90
|
+
this.globalProperties = {
|
|
91
|
+
...this.globalProperties,
|
|
92
|
+
...flattenedProperties
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
setCloudConfiguration(properties) {
|
|
96
|
+
this.cloudConfiguration = properties;
|
|
97
|
+
this.setGlobalProperties({ cloud: {
|
|
98
|
+
publicApiKey: properties.publicApiKey,
|
|
99
|
+
baseUrl: properties.baseUrl
|
|
100
|
+
} });
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Atomically configure standalone, legacy, or anonymous telemetry identity.
|
|
104
|
+
*
|
|
105
|
+
* A standalone id takes transport precedence over a supplied legacy license
|
|
106
|
+
* token, but only a license-derived id grants sampling authority. Neither
|
|
107
|
+
* value is added to event properties.
|
|
108
|
+
*
|
|
109
|
+
* @param identity - One standalone id, one legacy license token, or neither.
|
|
110
|
+
*/
|
|
111
|
+
setTelemetryIdentity(identity) {
|
|
112
|
+
const resolvedIdentity = this.resolveTelemetryIdentity(identity);
|
|
113
|
+
this.telemetryId = resolvedIdentity.telemetryId;
|
|
114
|
+
this.licenseToken = resolvedIdentity.licenseToken;
|
|
115
|
+
this.licenseTelemetryId = resolvedIdentity.licenseTelemetryId;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Configure legacy license-derived telemetry identity.
|
|
119
|
+
*
|
|
120
|
+
* @param licenseToken - License token whose telemetry claim identifies sends.
|
|
121
|
+
*/
|
|
122
|
+
setLicenseToken(licenseToken) {
|
|
123
|
+
this.setTelemetryIdentity({ licenseToken });
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create an immutable capture scope for one runtime.
|
|
127
|
+
*
|
|
128
|
+
* The scope shares this client's sinks, process-wide opt-out, global
|
|
129
|
+
* properties, and Segment sampling rate, but snapshots transport identity and
|
|
130
|
+
* license-derived sampling authority. Constructing another runtime cannot
|
|
131
|
+
* rewrite an existing scope.
|
|
132
|
+
*
|
|
133
|
+
* @param identity - The runtime's construction-time telemetry identity.
|
|
134
|
+
* @returns A capture-only client bound to that identity.
|
|
135
|
+
*/
|
|
136
|
+
createScope(identity) {
|
|
137
|
+
const resolvedIdentity = this.resolveTelemetryIdentity(identity);
|
|
138
|
+
return { capture: (event, properties) => this.captureWithIdentity(event, properties, resolvedIdentity) };
|
|
139
|
+
}
|
|
140
|
+
resolveTelemetryIdentity(identity) {
|
|
141
|
+
const telemetryId = firstNonBlankTelemetryId(identity.telemetryId);
|
|
142
|
+
if (telemetryId !== void 0) return {
|
|
143
|
+
telemetryId,
|
|
144
|
+
licenseToken: null,
|
|
145
|
+
licenseTelemetryId: null
|
|
146
|
+
};
|
|
147
|
+
return {
|
|
148
|
+
telemetryId: null,
|
|
149
|
+
licenseToken: identity.licenseToken ?? null,
|
|
150
|
+
licenseTelemetryId: identity.licenseToken ? parseAndWarnTelemetryId(identity.licenseToken) : null
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
setSampleRate(sampleRate) {
|
|
154
|
+
let _sampleRate;
|
|
155
|
+
_sampleRate = sampleRate ?? .05;
|
|
156
|
+
if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) _sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);
|
|
157
|
+
if (Number.isNaN(_sampleRate) || _sampleRate < 0 || _sampleRate > 1) throw new Error("Sample rate must be between 0 and 1");
|
|
158
|
+
this.segmentSampleRate = _sampleRate;
|
|
159
|
+
}
|
|
10
160
|
};
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
export { TelemetryClient };
|
|
11
164
|
//# sourceMappingURL=telemetry-client.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"file":"telemetry-client.mjs","names":["uuidv4"],"sources":["../../src/telemetry/telemetry-client.ts"],"sourcesContent":["import { Analytics } from \"@segment/analytics-node\";\nimport type { AnalyticsEvents } from \"./events\";\nimport { flattenObject } from \"./utils\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport {\n firstNonBlankTelemetryId,\n lambdaClient,\n parseAndWarnTelemetryId,\n} from \"./lambda-client\";\nimport {\n computeSamplingMeta,\n TELEMETRY_EMITTER_V1,\n TELEMETRY_SURFACE_V1,\n UNSAMPLED_RATE,\n} from \"./sampling\";\nimport { isTelemetryDisabled } from \"./telemetry-disabled\";\n\nexport { isTelemetryDisabled };\n\n/** Transport identity and sampling authority resolved for one runtime. */\nexport interface TelemetryIdentity {\n telemetryId?: string;\n licenseToken?: string;\n}\n\n/** Capture-only telemetry client bound to one runtime identity. */\nexport interface TelemetryCapture {\n capture<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ): Promise<void>;\n}\n\ninterface ResolvedTelemetryIdentity {\n telemetryId: string | null;\n licenseToken: string | null;\n licenseTelemetryId: string | null;\n}\n\nexport class TelemetryClient {\n segment: Analytics | undefined;\n globalProperties: Record<string, any> = {};\n cloudConfiguration: { publicApiKey: string; baseUrl: string } | null = null;\n // EIP / Intelligence license token (Ed25519-signed JWT). The lambda\n // client decodes its payload to extract telemetry_id. Customer API\n // keys are NOT used here — they flow only into Segment.\n private licenseToken: string | null = null;\n // Standalone analytics identity. This stays separate from the effective\n // identity so legacy callers continue sending only their license token to\n // the Lambda transport.\n private telemetryId: string | null = null;\n // License-derived identity used only as sampling authority. A standalone\n // telemetry id remains a transport claim and does not bypass the\n // Segment gate.\n private licenseTelemetryId: string | null = null;\n packageName: string;\n packageVersion: string;\n private telemetryDisabled: boolean = false;\n // Client-side sampling rate for anonymous events on the Segment wire\n // only. The lambda sink is ours and takes every event; Segment is\n // billed per event, so the anonymous population stays capped there.\n // Identified events (those whose license token yielded a telemetry_id)\n // bypass the gate on both wires.\n private segmentSampleRate: number = 0.05;\n private anonymousId = `anon_${uuidv4()}`;\n\n constructor({\n packageName,\n packageVersion,\n telemetryDisabled,\n telemetryBaseUrl,\n sampleRate,\n }: {\n packageName: string;\n packageVersion: string;\n telemetryDisabled?: boolean;\n telemetryBaseUrl?: string;\n // Anonymous sampling rate for the Segment wire. Named without the\n // prefix for backward compatibility; the lambda sink ignores it.\n sampleRate?: number;\n }) {\n this.packageName = packageName;\n this.packageVersion = packageVersion;\n this.telemetryDisabled = telemetryDisabled || isTelemetryDisabled();\n\n if (this.telemetryDisabled) {\n return;\n }\n\n this.setSampleRate(sampleRate);\n\n // eslint-disable-next-line\n const writeKey =\n process.env.COPILOTKIT_SEGMENT_WRITE_KEY ||\n \"n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja\";\n\n this.segment = new Analytics({\n writeKey,\n });\n\n this.setGlobalProperties({\n \"copilotkit.package.name\": packageName,\n \"copilotkit.package.version\": packageVersion,\n });\n }\n\n private shouldSendToSegment() {\n const randomNumber = Math.random();\n return randomNumber < this.segmentSampleRate;\n }\n\n async capture<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ): Promise<void> {\n return this.captureWithIdentity(event, properties, {\n telemetryId: this.telemetryId,\n licenseToken: this.licenseToken,\n licenseTelemetryId: this.licenseTelemetryId,\n });\n }\n\n private async captureWithIdentity<K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n identity: ResolvedTelemetryIdentity,\n ): Promise<void> {\n // Re-read the environment: an opt-out set after import (for example a\n // dotenv call below the imports) must still stop events.\n if (this.telemetryDisabled || isTelemetryDisabled()) {\n return;\n }\n\n // The two wires are gated separately. The lambda sink takes every\n // event: it is CopilotKit-owned, so anonymous volume costs nothing\n // per event there and a real count beats one extrapolated from 5% of\n // the population. Segment is billed per event, so it keeps the gate —\n // callers without license-derived sampling authority are dropped from\n // that copy at segmentSampleRate. Legacy license tokens with a\n // telemetry_id send on both wires: the volume is bounded by\n // paying-customer count and full fidelity per identified customer is\n // worth the marginal cost.\n const sendToSegment =\n Boolean(identity.licenseTelemetryId) || this.shouldSendToSegment();\n\n // Sampling metadata is computed in ./sampling so this client and the\n // v2 runtime client can't drift apart again — see the note there.\n // One call per wire, because the two wires were gated differently and\n // a shared block would overweight the lambda copy by 1/sampleRate.\n const lambdaSamplingMeta = computeSamplingMeta({\n telemetryId: identity.licenseTelemetryId,\n sampleRate: UNSAMPLED_RATE,\n });\n const segmentSamplingMeta = computeSamplingMeta({\n telemetryId: identity.licenseTelemetryId,\n sampleRate: this.segmentSampleRate,\n });\n\n // Everything below travels identically on both copies of this event.\n // The event id is what makes the dual-write dedupable downstream:\n // one capture() produces one id, stamped on the lambda copy and the\n // Segment copy alike, so consumers no longer have to infer the\n // duplication from $lib or from which fields happen to be present\n // (OSS-1019).\n const eventMeta = {\n telemetry_emitter: TELEMETRY_EMITTER_V1,\n telemetry_surface: TELEMETRY_SURFACE_V1,\n telemetry_event_id: uuidv4(),\n };\n\n const flattenedProperties = flattenObject(properties);\n const propertiesWithGlobal: Record<string, any> = {\n ...this.globalProperties,\n ...eventMeta,\n ...segmentSamplingMeta,\n telemetry_transport: \"segment\",\n ...flattenedProperties,\n };\n const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal)\n .sort()\n .reduce(\n (obj, key) => {\n obj[key] = propertiesWithGlobal[key];\n return obj;\n },\n {} as Record<string, any>,\n );\n\n await lambdaClient.send({\n event,\n properties: flattenedProperties,\n globalProperties: {\n ...this.globalProperties,\n ...eventMeta,\n ...lambdaSamplingMeta,\n telemetry_transport: \"lambda\",\n },\n packageName: this.packageName,\n packageVersion: this.packageVersion,\n telemetryId: identity.telemetryId ?? undefined,\n licenseToken: identity.licenseToken ?? undefined,\n });\n\n if (this.segment && sendToSegment) {\n this.segment.track({\n anonymousId: this.anonymousId,\n event,\n properties: { ...orderedPropertiesWithGlobal },\n });\n }\n }\n\n setGlobalProperties(properties: Record<string, any>) {\n const flattenedProperties = flattenObject(properties);\n this.globalProperties = {\n ...this.globalProperties,\n ...flattenedProperties,\n };\n }\n\n setCloudConfiguration(properties: { publicApiKey: string; baseUrl: string }) {\n this.cloudConfiguration = properties;\n\n this.setGlobalProperties({\n cloud: {\n publicApiKey: properties.publicApiKey,\n baseUrl: properties.baseUrl,\n },\n });\n }\n\n /**\n * Atomically configure standalone, legacy, or anonymous telemetry identity.\n *\n * A standalone id takes transport precedence over a supplied legacy license\n * token, but only a license-derived id grants sampling authority. Neither\n * value is added to event properties.\n *\n * @param identity - One standalone id, one legacy license token, or neither.\n */\n setTelemetryIdentity(identity: {\n telemetryId?: string;\n licenseToken?: string;\n }): void {\n const resolvedIdentity = this.resolveTelemetryIdentity(identity);\n this.telemetryId = resolvedIdentity.telemetryId;\n this.licenseToken = resolvedIdentity.licenseToken;\n this.licenseTelemetryId = resolvedIdentity.licenseTelemetryId;\n }\n\n /**\n * Configure legacy license-derived telemetry identity.\n *\n * @param licenseToken - License token whose telemetry claim identifies sends.\n */\n setLicenseToken(licenseToken: string) {\n this.setTelemetryIdentity({ licenseToken });\n }\n\n /**\n * Create an immutable capture scope for one runtime.\n *\n * The scope shares this client's sinks, process-wide opt-out, global\n * properties, and Segment sampling rate, but snapshots transport identity and\n * license-derived sampling authority. Constructing another runtime cannot\n * rewrite an existing scope.\n *\n * @param identity - The runtime's construction-time telemetry identity.\n * @returns A capture-only client bound to that identity.\n */\n createScope(identity: TelemetryIdentity): TelemetryCapture {\n const resolvedIdentity = this.resolveTelemetryIdentity(identity);\n\n return {\n capture: <K extends keyof AnalyticsEvents>(\n event: K,\n properties: AnalyticsEvents[K],\n ) => this.captureWithIdentity(event, properties, resolvedIdentity),\n };\n }\n\n private resolveTelemetryIdentity(\n identity: TelemetryIdentity,\n ): ResolvedTelemetryIdentity {\n const telemetryId = firstNonBlankTelemetryId(identity.telemetryId);\n if (telemetryId !== undefined) {\n return {\n telemetryId,\n licenseToken: null,\n licenseTelemetryId: null,\n };\n }\n\n return {\n telemetryId: null,\n licenseToken: identity.licenseToken ?? null,\n licenseTelemetryId: identity.licenseToken\n ? parseAndWarnTelemetryId(identity.licenseToken)\n : null,\n };\n }\n\n private setSampleRate(sampleRate: number | undefined) {\n let _sampleRate: number;\n\n _sampleRate = sampleRate ?? 0.05;\n\n // eslint-disable-next-line\n if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {\n // eslint-disable-next-line\n _sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);\n }\n\n // Number.isNaN guards against parseFloat(\"nonsense\") slipping past the\n // range check (all NaN comparisons are false), which would silently\n // drop every anonymous Segment event with no signal.\n if (Number.isNaN(_sampleRate) || _sampleRate < 0 || _sampleRate > 1) {\n throw new Error(\"Sample rate must be between 0 and 1\");\n }\n\n this.segmentSampleRate = _sampleRate;\n // Per-event sampling metadata (sampleRate/sampleRateAdjustmentFactor/\n // sampleWeight) is computed per capture() in ./sampling, once per\n // wire. Only license-authorized events get effectiveSampleRate=1 on\n // the Segment copy; standalone transport identity stays in the\n // sampled population there. The lambda copy is always unsampled.\n }\n}\n"],"mappings":";;;;;;;;AAuCA,IAAa,kBAAb,MAA6B;CA2B3B,YAAY,EACV,aACA,gBACA,mBACA,kBACA,cASC;0BAvCqC,EAAE;4BAC6B;sBAIjC;qBAID;4BAIO;2BAGP;2BAMD;qBACd,QAAQA,IAAQ;AAiBpC,OAAK,cAAc;AACnB,OAAK,iBAAiB;AACtB,OAAK,oBAAoB,qBAAqB,qBAAqB;AAEnE,MAAI,KAAK,kBACP;AAGF,OAAK,cAAc,WAAW;AAO9B,OAAK,UAAU,IAAI,UAAU,EAC3B,UAJA,QAAQ,IAAI,gCACZ,oCAID,CAAC;AAEF,OAAK,oBAAoB;GACvB,2BAA2B;GAC3B,8BAA8B;GAC/B,CAAC;;CAGJ,AAAQ,sBAAsB;AAE5B,SADqB,KAAK,QAAQ,GACZ,KAAK;;CAG7B,MAAM,QACJ,OACA,YACe;AACf,SAAO,KAAK,oBAAoB,OAAO,YAAY;GACjD,aAAa,KAAK;GAClB,cAAc,KAAK;GACnB,oBAAoB,KAAK;GAC1B,CAAC;;CAGJ,MAAc,oBACZ,OACA,YACA,UACe;AAGf,MAAI,KAAK,qBAAqB,qBAAqB,CACjD;EAYF,MAAM,gBACJ,QAAQ,SAAS,mBAAmB,IAAI,KAAK,qBAAqB;EAMpE,MAAM,qBAAqB,oBAAoB;GAC7C,aAAa,SAAS;GACtB,YAAY;GACb,CAAC;EACF,MAAM,sBAAsB,oBAAoB;GAC9C,aAAa,SAAS;GACtB,YAAY,KAAK;GAClB,CAAC;EAQF,MAAM,YAAY;GAChB,mBAAmB;GACnB,mBAAmB;GACnB,oBAAoBA,IAAQ;GAC7B;EAED,MAAM,sBAAsB,cAAc,WAAW;EACrD,MAAM,uBAA4C;GAChD,GAAG,KAAK;GACR,GAAG;GACH,GAAG;GACH,qBAAqB;GACrB,GAAG;GACJ;EACD,MAAM,8BAA8B,OAAO,KAAK,qBAAqB,CAClE,MAAM,CACN,QACE,KAAK,QAAQ;AACZ,OAAI,OAAO,qBAAqB;AAChC,UAAO;KAET,EAAE,CACH;AAEH,QAAM,aAAa,KAAK;GACtB;GACA,YAAY;GACZ,kBAAkB;IAChB,GAAG,KAAK;IACR,GAAG;IACH,GAAG;IACH,qBAAqB;IACtB;GACD,aAAa,KAAK;GAClB,gBAAgB,KAAK;GACrB,aAAa,SAAS,eAAe;GACrC,cAAc,SAAS,gBAAgB;GACxC,CAAC;AAEF,MAAI,KAAK,WAAW,cAClB,MAAK,QAAQ,MAAM;GACjB,aAAa,KAAK;GAClB;GACA,YAAY,EAAE,GAAG,6BAA6B;GAC/C,CAAC;;CAIN,oBAAoB,YAAiC;EACnD,MAAM,sBAAsB,cAAc,WAAW;AACrD,OAAK,mBAAmB;GACtB,GAAG,KAAK;GACR,GAAG;GACJ;;CAGH,sBAAsB,YAAuD;AAC3E,OAAK,qBAAqB;AAE1B,OAAK,oBAAoB,EACvB,OAAO;GACL,cAAc,WAAW;GACzB,SAAS,WAAW;GACrB,EACF,CAAC;;;;;;;;;;;CAYJ,qBAAqB,UAGZ;EACP,MAAM,mBAAmB,KAAK,yBAAyB,SAAS;AAChE,OAAK,cAAc,iBAAiB;AACpC,OAAK,eAAe,iBAAiB;AACrC,OAAK,qBAAqB,iBAAiB;;;;;;;CAQ7C,gBAAgB,cAAsB;AACpC,OAAK,qBAAqB,EAAE,cAAc,CAAC;;;;;;;;;;;;;CAc7C,YAAY,UAA+C;EACzD,MAAM,mBAAmB,KAAK,yBAAyB,SAAS;AAEhE,SAAO,EACL,UACE,OACA,eACG,KAAK,oBAAoB,OAAO,YAAY,iBAAiB,EACnE;;CAGH,AAAQ,yBACN,UAC2B;EAC3B,MAAM,cAAc,yBAAyB,SAAS,YAAY;AAClE,MAAI,gBAAgB,OAClB,QAAO;GACL;GACA,cAAc;GACd,oBAAoB;GACrB;AAGH,SAAO;GACL,aAAa;GACb,cAAc,SAAS,gBAAgB;GACvC,oBAAoB,SAAS,eACzB,wBAAwB,SAAS,aAAa,GAC9C;GACL;;CAGH,AAAQ,cAAc,YAAgC;EACpD,IAAI;AAEJ,gBAAc,cAAc;AAG5B,MAAI,QAAQ,IAAI,iCAEd,eAAc,WAAW,QAAQ,IAAI,iCAAiC;AAMxE,MAAI,OAAO,MAAM,YAAY,IAAI,cAAc,KAAK,cAAc,EAChE,OAAM,IAAI,MAAM,sCAAsC;AAGxD,OAAK,oBAAoB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/telemetry/telemetry-disabled.ts
|
|
3
|
+
/**
|
|
4
|
+
* Checks if telemetry is disabled via environment variables.
|
|
5
|
+
* Users can opt out by setting:
|
|
6
|
+
* - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
|
|
7
|
+
* - DO_NOT_TRACK=true or DO_NOT_TRACK=1
|
|
8
|
+
*
|
|
9
|
+
* Lives in its own module so that the browser-facing root entry can
|
|
10
|
+
* re-export it without pulling in `telemetry-client.ts`, whose
|
|
11
|
+
* `@segment/analytics-node` import drags Node built-ins into browser
|
|
12
|
+
* bundler module graphs. See the note in `../index.ts`.
|
|
13
|
+
*/
|
|
14
|
+
function isTelemetryDisabled() {
|
|
15
|
+
return process.env.COPILOTKIT_TELEMETRY_DISABLED === "true" || process.env.COPILOTKIT_TELEMETRY_DISABLED === "1" || process.env.DO_NOT_TRACK === "true" || process.env.DO_NOT_TRACK === "1";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.isTelemetryDisabled = isTelemetryDisabled;
|
|
20
|
+
//# sourceMappingURL=telemetry-disabled.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-disabled.cjs","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"sourcesContent":["/**\n * Checks if telemetry is disabled via environment variables.\n * Users can opt out by setting:\n * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1\n * - DO_NOT_TRACK=true or DO_NOT_TRACK=1\n *\n * Lives in its own module so that the browser-facing root entry can\n * re-export it without pulling in `telemetry-client.ts`, whose\n * `@segment/analytics-node` import drags Node built-ins into browser\n * bundler module graphs. See the note in `../index.ts`.\n */\nexport function isTelemetryDisabled(): boolean {\n return (\n (process.env as Record<string, string | undefined>)\n .COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n (process.env as Record<string, string | undefined>)\n .COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n (process.env as Record<string, string | undefined>).DO_NOT_TRACK ===\n \"true\" ||\n (process.env as Record<string, string | undefined>).DO_NOT_TRACK === \"1\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,sBAA+B;AAC7C,QACG,QAAQ,IACN,kCAAkC,UACpC,QAAQ,IACN,kCAAkC,OACpC,QAAQ,IAA2C,iBAClD,UACD,QAAQ,IAA2C,iBAAiB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/telemetry/telemetry-disabled.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks if telemetry is disabled via environment variables.
|
|
4
|
+
* Users can opt out by setting:
|
|
5
|
+
* - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
|
|
6
|
+
* - DO_NOT_TRACK=true or DO_NOT_TRACK=1
|
|
7
|
+
*
|
|
8
|
+
* Lives in its own module so that the browser-facing root entry can
|
|
9
|
+
* re-export it without pulling in `telemetry-client.ts`, whose
|
|
10
|
+
* `@segment/analytics-node` import drags Node built-ins into browser
|
|
11
|
+
* bundler module graphs. See the note in `../index.ts`.
|
|
12
|
+
*/
|
|
13
|
+
declare function isTelemetryDisabled(): boolean;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { isTelemetryDisabled };
|
|
16
|
+
//# sourceMappingURL=telemetry-disabled.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-disabled.d.cts","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"mappings":";;AAWA;;;;;;;;;;iBAAgB,mBAAA,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/telemetry/telemetry-disabled.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks if telemetry is disabled via environment variables.
|
|
4
|
+
* Users can opt out by setting:
|
|
5
|
+
* - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
|
|
6
|
+
* - DO_NOT_TRACK=true or DO_NOT_TRACK=1
|
|
7
|
+
*
|
|
8
|
+
* Lives in its own module so that the browser-facing root entry can
|
|
9
|
+
* re-export it without pulling in `telemetry-client.ts`, whose
|
|
10
|
+
* `@segment/analytics-node` import drags Node built-ins into browser
|
|
11
|
+
* bundler module graphs. See the note in `../index.ts`.
|
|
12
|
+
*/
|
|
13
|
+
declare function isTelemetryDisabled(): boolean;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { isTelemetryDisabled };
|
|
16
|
+
//# sourceMappingURL=telemetry-disabled.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-disabled.d.mts","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"mappings":";;AAWA;;;;;;;;;;iBAAgB,mBAAA,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/telemetry/telemetry-disabled.ts
|
|
2
|
+
/**
|
|
3
|
+
* Checks if telemetry is disabled via environment variables.
|
|
4
|
+
* Users can opt out by setting:
|
|
5
|
+
* - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
|
|
6
|
+
* - DO_NOT_TRACK=true or DO_NOT_TRACK=1
|
|
7
|
+
*
|
|
8
|
+
* Lives in its own module so that the browser-facing root entry can
|
|
9
|
+
* re-export it without pulling in `telemetry-client.ts`, whose
|
|
10
|
+
* `@segment/analytics-node` import drags Node built-ins into browser
|
|
11
|
+
* bundler module graphs. See the note in `../index.ts`.
|
|
12
|
+
*/
|
|
13
|
+
function isTelemetryDisabled() {
|
|
14
|
+
return process.env.COPILOTKIT_TELEMETRY_DISABLED === "true" || process.env.COPILOTKIT_TELEMETRY_DISABLED === "1" || process.env.DO_NOT_TRACK === "true" || process.env.DO_NOT_TRACK === "1";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { isTelemetryDisabled };
|
|
19
|
+
//# sourceMappingURL=telemetry-disabled.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-disabled.mjs","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"sourcesContent":["/**\n * Checks if telemetry is disabled via environment variables.\n * Users can opt out by setting:\n * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1\n * - DO_NOT_TRACK=true or DO_NOT_TRACK=1\n *\n * Lives in its own module so that the browser-facing root entry can\n * re-export it without pulling in `telemetry-client.ts`, whose\n * `@segment/analytics-node` import drags Node built-ins into browser\n * bundler module graphs. See the note in `../index.ts`.\n */\nexport function isTelemetryDisabled(): boolean {\n return (\n (process.env as Record<string, string | undefined>)\n .COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n (process.env as Record<string, string | undefined>)\n .COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n (process.env as Record<string, string | undefined>).DO_NOT_TRACK ===\n \"true\" ||\n (process.env as Record<string, string | undefined>).DO_NOT_TRACK === \"1\"\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,sBAA+B;AAC7C,QACG,QAAQ,IACN,kCAAkC,UACpC,QAAQ,IACN,kCAAkC,OACpC,QAAQ,IAA2C,iBAClD,UACD,QAAQ,IAA2C,iBAAiB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/telemetry/utils.ts
|
|
3
|
+
function flattenObject(obj, parentKey = "", res = {}) {
|
|
4
|
+
for (let key in obj) {
|
|
5
|
+
const propName = parentKey ? `${parentKey}.${key}` : key;
|
|
6
|
+
if (typeof obj[key] === "object" && obj[key] !== null) flattenObject(obj[key], propName, res);
|
|
7
|
+
else res[propName] = obj[key];
|
|
8
|
+
}
|
|
9
|
+
return res;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.flattenObject = flattenObject;
|
|
14
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":[],"sources":["../../src/telemetry/utils.ts"],"sourcesContent":["export function flattenObject(\n obj: Record<string, any>,\n parentKey = \"\",\n res: Record<string, any> = {},\n): Record<string, any> {\n for (let key in obj) {\n const propName = parentKey ? `${parentKey}.${key}` : key;\n if (typeof obj[key] === \"object\" && obj[key] !== null) {\n flattenObject(obj[key], propName, res);\n } else {\n res[propName] = obj[key];\n }\n }\n return res;\n}\n"],"mappings":";;AAAA,SAAgB,cACd,KACA,YAAY,IACZ,MAA2B,EAAE,EACR;AACrB,MAAK,IAAI,OAAO,KAAK;EACnB,MAAM,WAAW,YAAY,GAAG,UAAU,GAAG,QAAQ;AACrD,MAAI,OAAO,IAAI,SAAS,YAAY,IAAI,SAAS,KAC/C,eAAc,IAAI,MAAM,UAAU,IAAI;MAEtC,KAAI,YAAY,IAAI;;AAGxB,QAAO"}
|
package/dist/telemetry/utils.mjs
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
//#region src/telemetry/utils.ts
|
|
2
|
+
function flattenObject(obj, parentKey = "", res = {}) {
|
|
3
|
+
for (let key in obj) {
|
|
4
|
+
const propName = parentKey ? `${parentKey}.${key}` : key;
|
|
5
|
+
if (typeof obj[key] === "object" && obj[key] !== null) flattenObject(obj[key], propName, res);
|
|
6
|
+
else res[propName] = obj[key];
|
|
7
|
+
}
|
|
8
|
+
return res;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { flattenObject };
|
|
9
13
|
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/telemetry/utils.ts"],"sourcesContent":["export function flattenObject(\n obj: Record<string, any>,\n parentKey = \"\",\n res: Record<string, any> = {},\n): Record<string, any> {\n for (let key in obj) {\n const propName = parentKey ? `${parentKey}.${key}` : key;\n if (typeof obj[key] === \"object\" && obj[key] !== null) {\n flattenObject(obj[key], propName, res);\n } else {\n res[propName] = obj[key];\n }\n }\n return res;\n}\n"],"mappings":";AAAA,SAAgB,cACd,KACA,YAAY,IACZ,MAA2B,EAAE,EACR;AACrB,MAAK,IAAI,OAAO,KAAK;EACnB,MAAM,WAAW,YAAY,GAAG,UAAU,GAAG,QAAQ;AACrD,MAAI,OAAO,IAAI,SAAS,YAAY,IAAI,SAAS,KAC/C,eAAc,IAAI,MAAM,UAAU,IAAI;MAEtC,KAAI,YAAY,IAAI;;AAGxB,QAAO"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/transcription-errors.ts
|
|
3
|
+
/**
|
|
4
|
+
* Error codes for transcription HTTP responses.
|
|
5
|
+
* Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
|
|
6
|
+
* These codes are returned by the runtime and parsed by the client.
|
|
7
|
+
*/
|
|
8
|
+
let TranscriptionErrorCode = /* @__PURE__ */ function(TranscriptionErrorCode) {
|
|
9
|
+
/** Transcription service not configured in runtime */
|
|
10
|
+
TranscriptionErrorCode["SERVICE_NOT_CONFIGURED"] = "service_not_configured";
|
|
11
|
+
/** Audio format not supported */
|
|
12
|
+
TranscriptionErrorCode["INVALID_AUDIO_FORMAT"] = "invalid_audio_format";
|
|
13
|
+
/** Audio file is too long */
|
|
14
|
+
TranscriptionErrorCode["AUDIO_TOO_LONG"] = "audio_too_long";
|
|
15
|
+
/** Audio file is empty or too short */
|
|
16
|
+
TranscriptionErrorCode["AUDIO_TOO_SHORT"] = "audio_too_short";
|
|
17
|
+
/** Rate limited by transcription provider */
|
|
18
|
+
TranscriptionErrorCode["RATE_LIMITED"] = "rate_limited";
|
|
19
|
+
/** Authentication failed with transcription provider */
|
|
20
|
+
TranscriptionErrorCode["AUTH_FAILED"] = "auth_failed";
|
|
21
|
+
/** Transcription provider returned an error */
|
|
22
|
+
TranscriptionErrorCode["PROVIDER_ERROR"] = "provider_error";
|
|
23
|
+
/** Network error during transcription */
|
|
24
|
+
TranscriptionErrorCode["NETWORK_ERROR"] = "network_error";
|
|
25
|
+
/** Invalid request format */
|
|
26
|
+
TranscriptionErrorCode["INVALID_REQUEST"] = "invalid_request";
|
|
27
|
+
return TranscriptionErrorCode;
|
|
28
|
+
}({});
|
|
29
|
+
/**
|
|
30
|
+
* Helper functions to create transcription error responses.
|
|
31
|
+
* Used by the runtime to return consistent error responses.
|
|
32
|
+
*/
|
|
33
|
+
const TranscriptionErrors = {
|
|
34
|
+
serviceNotConfigured: () => ({
|
|
35
|
+
error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,
|
|
36
|
+
message: "Transcription service is not configured",
|
|
37
|
+
retryable: false
|
|
38
|
+
}),
|
|
39
|
+
invalidAudioFormat: (format, supported) => ({
|
|
40
|
+
error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,
|
|
41
|
+
message: `Unsupported audio format: ${format}. Supported: ${supported.join(", ")}`,
|
|
42
|
+
retryable: false
|
|
43
|
+
}),
|
|
44
|
+
invalidRequest: (details) => ({
|
|
45
|
+
error: TranscriptionErrorCode.INVALID_REQUEST,
|
|
46
|
+
message: details,
|
|
47
|
+
retryable: false
|
|
48
|
+
}),
|
|
49
|
+
rateLimited: () => ({
|
|
50
|
+
error: TranscriptionErrorCode.RATE_LIMITED,
|
|
51
|
+
message: "Rate limited. Please try again later.",
|
|
52
|
+
retryable: true
|
|
53
|
+
}),
|
|
54
|
+
authFailed: () => ({
|
|
55
|
+
error: TranscriptionErrorCode.AUTH_FAILED,
|
|
56
|
+
message: "Authentication failed with transcription provider",
|
|
57
|
+
retryable: false
|
|
58
|
+
}),
|
|
59
|
+
providerError: (message) => ({
|
|
60
|
+
error: TranscriptionErrorCode.PROVIDER_ERROR,
|
|
61
|
+
message,
|
|
62
|
+
retryable: true
|
|
63
|
+
}),
|
|
64
|
+
networkError: (message = "Network error during transcription") => ({
|
|
65
|
+
error: TranscriptionErrorCode.NETWORK_ERROR,
|
|
66
|
+
message,
|
|
67
|
+
retryable: true
|
|
68
|
+
}),
|
|
69
|
+
audioTooLong: () => ({
|
|
70
|
+
error: TranscriptionErrorCode.AUDIO_TOO_LONG,
|
|
71
|
+
message: "Audio file is too long",
|
|
72
|
+
retryable: false
|
|
73
|
+
}),
|
|
74
|
+
audioTooShort: () => ({
|
|
75
|
+
error: TranscriptionErrorCode.AUDIO_TOO_SHORT,
|
|
76
|
+
message: "Audio is too short to transcribe",
|
|
77
|
+
retryable: false
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.TranscriptionErrorCode = TranscriptionErrorCode;
|
|
83
|
+
exports.TranscriptionErrors = TranscriptionErrors;
|
|
84
|
+
//# sourceMappingURL=transcription-errors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcription-errors.cjs","names":[],"sources":["../src/transcription-errors.ts"],"sourcesContent":["/**\n * Error codes for transcription HTTP responses.\n * Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.\n * These codes are returned by the runtime and parsed by the client.\n */\nexport enum TranscriptionErrorCode {\n /** Transcription service not configured in runtime */\n SERVICE_NOT_CONFIGURED = \"service_not_configured\",\n /** Audio format not supported */\n INVALID_AUDIO_FORMAT = \"invalid_audio_format\",\n /** Audio file is too long */\n AUDIO_TOO_LONG = \"audio_too_long\",\n /** Audio file is empty or too short */\n AUDIO_TOO_SHORT = \"audio_too_short\",\n /** Rate limited by transcription provider */\n RATE_LIMITED = \"rate_limited\",\n /** Authentication failed with transcription provider */\n AUTH_FAILED = \"auth_failed\",\n /** Transcription provider returned an error */\n PROVIDER_ERROR = \"provider_error\",\n /** Network error during transcription */\n NETWORK_ERROR = \"network_error\",\n /** Invalid request format */\n INVALID_REQUEST = \"invalid_request\",\n}\n\n/**\n * Error response format returned by the transcription endpoint.\n */\nexport interface TranscriptionErrorResponse {\n error: TranscriptionErrorCode;\n message: string;\n retryable?: boolean;\n}\n\n/**\n * Helper functions to create transcription error responses.\n * Used by the runtime to return consistent error responses.\n */\nexport const TranscriptionErrors = {\n serviceNotConfigured: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,\n message: \"Transcription service is not configured\",\n retryable: false,\n }),\n\n invalidAudioFormat: (\n format: string,\n supported: string[],\n ): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,\n message: `Unsupported audio format: ${format}. Supported: ${supported.join(\", \")}`,\n retryable: false,\n }),\n\n invalidRequest: (details: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.INVALID_REQUEST,\n message: details,\n retryable: false,\n }),\n\n rateLimited: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.RATE_LIMITED,\n message: \"Rate limited. Please try again later.\",\n retryable: true,\n }),\n\n authFailed: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUTH_FAILED,\n message: \"Authentication failed with transcription provider\",\n retryable: false,\n }),\n\n providerError: (message: string): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.PROVIDER_ERROR,\n message,\n retryable: true,\n }),\n\n networkError: (\n message: string = \"Network error during transcription\",\n ): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.NETWORK_ERROR,\n message,\n retryable: true,\n }),\n\n audioTooLong: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_LONG,\n message: \"Audio file is too long\",\n retryable: false,\n }),\n\n audioTooShort: (): TranscriptionErrorResponse => ({\n error: TranscriptionErrorCode.AUDIO_TOO_SHORT,\n message: \"Audio is too short to transcribe\",\n retryable: false,\n }),\n};\n"],"mappings":";;;;;;;AAKA,IAAY,0EAAL;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;;;;;;AAgBF,MAAa,sBAAsB;CACjC,6BAAyD;EACvD,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,qBACE,QACA,eACgC;EAChC,OAAO,uBAAuB;EAC9B,SAAS,6BAA6B,OAAO,eAAe,UAAU,KAAK,KAAK;EAChF,WAAW;EACZ;CAED,iBAAiB,aAAiD;EAChE,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,oBAAgD;EAC9C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,mBAA+C;EAC7C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,gBAAgB,aAAiD;EAC/D,OAAO,uBAAuB;EAC9B;EACA,WAAW;EACZ;CAED,eACE,UAAkB,0CACc;EAChC,OAAO,uBAAuB;EAC9B;EACA,WAAW;EACZ;CAED,qBAAiD;EAC/C,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CAED,sBAAkD;EAChD,OAAO,uBAAuB;EAC9B,SAAS;EACT,WAAW;EACZ;CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/transcription-errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Error codes for transcription HTTP responses.
|
|
4
|
+
* Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
|
|
5
|
+
* These codes are returned by the runtime and parsed by the client.
|
|
6
|
+
*/
|
|
7
|
+
declare enum TranscriptionErrorCode {
|
|
8
|
+
/** Transcription service not configured in runtime */
|
|
9
|
+
SERVICE_NOT_CONFIGURED = "service_not_configured",
|
|
10
|
+
/** Audio format not supported */
|
|
11
|
+
INVALID_AUDIO_FORMAT = "invalid_audio_format",
|
|
12
|
+
/** Audio file is too long */
|
|
13
|
+
AUDIO_TOO_LONG = "audio_too_long",
|
|
14
|
+
/** Audio file is empty or too short */
|
|
15
|
+
AUDIO_TOO_SHORT = "audio_too_short",
|
|
16
|
+
/** Rate limited by transcription provider */
|
|
17
|
+
RATE_LIMITED = "rate_limited",
|
|
18
|
+
/** Authentication failed with transcription provider */
|
|
19
|
+
AUTH_FAILED = "auth_failed",
|
|
20
|
+
/** Transcription provider returned an error */
|
|
21
|
+
PROVIDER_ERROR = "provider_error",
|
|
22
|
+
/** Network error during transcription */
|
|
23
|
+
NETWORK_ERROR = "network_error",
|
|
24
|
+
/** Invalid request format */
|
|
25
|
+
INVALID_REQUEST = "invalid_request"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Error response format returned by the transcription endpoint.
|
|
29
|
+
*/
|
|
30
|
+
interface TranscriptionErrorResponse {
|
|
31
|
+
error: TranscriptionErrorCode;
|
|
32
|
+
message: string;
|
|
33
|
+
retryable?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Helper functions to create transcription error responses.
|
|
37
|
+
* Used by the runtime to return consistent error responses.
|
|
38
|
+
*/
|
|
39
|
+
declare const TranscriptionErrors: {
|
|
40
|
+
serviceNotConfigured: () => TranscriptionErrorResponse;
|
|
41
|
+
invalidAudioFormat: (format: string, supported: string[]) => TranscriptionErrorResponse;
|
|
42
|
+
invalidRequest: (details: string) => TranscriptionErrorResponse;
|
|
43
|
+
rateLimited: () => TranscriptionErrorResponse;
|
|
44
|
+
authFailed: () => TranscriptionErrorResponse;
|
|
45
|
+
providerError: (message: string) => TranscriptionErrorResponse;
|
|
46
|
+
networkError: (message?: string) => TranscriptionErrorResponse;
|
|
47
|
+
audioTooLong: () => TranscriptionErrorResponse;
|
|
48
|
+
audioTooShort: () => TranscriptionErrorResponse;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors };
|
|
52
|
+
//# sourceMappingURL=transcription-errors.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcription-errors.d.cts","names":[],"sources":["../src/transcription-errors.ts"],"mappings":";;AAKA;;;;aAAY,sBAAA;EAIV;EAFA,sBAAA;EAMA;EAJA,oBAAA;EAQA;EANA,cAAA;EAUA;EARA,eAAA;EAUe;EARf,YAAA;EAce;EAZf,WAAA;;EAEA,cAAA;EAWA;EATA,aAAA;EAUA;EARA,eAAA;AAAA;;AAgBF;;UAViB,0BAAA;EACf,KAAA,EAAO,sBAAA;EACP,OAAA;EACA,SAAA;AAAA;;;;;cAOW,mBAAA;8BACe,0BAAA;uCAOV,SAAA,eAEb,0BAAA;uCAMgC,0BAAA;qBAMlB,0BAAA;oBAMD,0BAAA;sCAMkB,0BAAA;sCAQ/B,0BAAA;sBAMe,0BAAA;uBAMC,0BAAA;AAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/transcription-errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Error codes for transcription HTTP responses.
|
|
4
|
+
* Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
|
|
5
|
+
* These codes are returned by the runtime and parsed by the client.
|
|
6
|
+
*/
|
|
7
|
+
declare enum TranscriptionErrorCode {
|
|
8
|
+
/** Transcription service not configured in runtime */
|
|
9
|
+
SERVICE_NOT_CONFIGURED = "service_not_configured",
|
|
10
|
+
/** Audio format not supported */
|
|
11
|
+
INVALID_AUDIO_FORMAT = "invalid_audio_format",
|
|
12
|
+
/** Audio file is too long */
|
|
13
|
+
AUDIO_TOO_LONG = "audio_too_long",
|
|
14
|
+
/** Audio file is empty or too short */
|
|
15
|
+
AUDIO_TOO_SHORT = "audio_too_short",
|
|
16
|
+
/** Rate limited by transcription provider */
|
|
17
|
+
RATE_LIMITED = "rate_limited",
|
|
18
|
+
/** Authentication failed with transcription provider */
|
|
19
|
+
AUTH_FAILED = "auth_failed",
|
|
20
|
+
/** Transcription provider returned an error */
|
|
21
|
+
PROVIDER_ERROR = "provider_error",
|
|
22
|
+
/** Network error during transcription */
|
|
23
|
+
NETWORK_ERROR = "network_error",
|
|
24
|
+
/** Invalid request format */
|
|
25
|
+
INVALID_REQUEST = "invalid_request"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Error response format returned by the transcription endpoint.
|
|
29
|
+
*/
|
|
30
|
+
interface TranscriptionErrorResponse {
|
|
31
|
+
error: TranscriptionErrorCode;
|
|
32
|
+
message: string;
|
|
33
|
+
retryable?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Helper functions to create transcription error responses.
|
|
37
|
+
* Used by the runtime to return consistent error responses.
|
|
38
|
+
*/
|
|
39
|
+
declare const TranscriptionErrors: {
|
|
40
|
+
serviceNotConfigured: () => TranscriptionErrorResponse;
|
|
41
|
+
invalidAudioFormat: (format: string, supported: string[]) => TranscriptionErrorResponse;
|
|
42
|
+
invalidRequest: (details: string) => TranscriptionErrorResponse;
|
|
43
|
+
rateLimited: () => TranscriptionErrorResponse;
|
|
44
|
+
authFailed: () => TranscriptionErrorResponse;
|
|
45
|
+
providerError: (message: string) => TranscriptionErrorResponse;
|
|
46
|
+
networkError: (message?: string) => TranscriptionErrorResponse;
|
|
47
|
+
audioTooLong: () => TranscriptionErrorResponse;
|
|
48
|
+
audioTooShort: () => TranscriptionErrorResponse;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { TranscriptionErrorCode, TranscriptionErrorResponse, TranscriptionErrors };
|
|
52
|
+
//# sourceMappingURL=transcription-errors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcription-errors.d.mts","names":[],"sources":["../src/transcription-errors.ts"],"mappings":";;AAKA;;;;aAAY,sBAAA;EAIV;EAFA,sBAAA;EAMA;EAJA,oBAAA;EAQA;EANA,cAAA;EAUA;EARA,eAAA;EAUe;EARf,YAAA;EAce;EAZf,WAAA;;EAEA,cAAA;EAWA;EATA,aAAA;EAUA;EARA,eAAA;AAAA;;AAgBF;;UAViB,0BAAA;EACf,KAAA,EAAO,sBAAA;EACP,OAAA;EACA,SAAA;AAAA;;;;;cAOW,mBAAA;8BACe,0BAAA;uCAOV,SAAA,eAEb,0BAAA;uCAMgC,0BAAA;qBAMlB,0BAAA;oBAMD,0BAAA;sCAMkB,0BAAA;sCAQ/B,0BAAA;sBAMe,0BAAA;uBAMC,0BAAA;AAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region src/transcription-errors.ts
|
|
2
|
+
/**
|
|
3
|
+
* Error codes for transcription HTTP responses.
|
|
4
|
+
* Uses snake_case to align with existing CopilotKitCoreErrorCode pattern.
|
|
5
|
+
* These codes are returned by the runtime and parsed by the client.
|
|
6
|
+
*/
|
|
7
|
+
let TranscriptionErrorCode = /* @__PURE__ */ function(TranscriptionErrorCode) {
|
|
8
|
+
/** Transcription service not configured in runtime */
|
|
9
|
+
TranscriptionErrorCode["SERVICE_NOT_CONFIGURED"] = "service_not_configured";
|
|
10
|
+
/** Audio format not supported */
|
|
11
|
+
TranscriptionErrorCode["INVALID_AUDIO_FORMAT"] = "invalid_audio_format";
|
|
12
|
+
/** Audio file is too long */
|
|
13
|
+
TranscriptionErrorCode["AUDIO_TOO_LONG"] = "audio_too_long";
|
|
14
|
+
/** Audio file is empty or too short */
|
|
15
|
+
TranscriptionErrorCode["AUDIO_TOO_SHORT"] = "audio_too_short";
|
|
16
|
+
/** Rate limited by transcription provider */
|
|
17
|
+
TranscriptionErrorCode["RATE_LIMITED"] = "rate_limited";
|
|
18
|
+
/** Authentication failed with transcription provider */
|
|
19
|
+
TranscriptionErrorCode["AUTH_FAILED"] = "auth_failed";
|
|
20
|
+
/** Transcription provider returned an error */
|
|
21
|
+
TranscriptionErrorCode["PROVIDER_ERROR"] = "provider_error";
|
|
22
|
+
/** Network error during transcription */
|
|
23
|
+
TranscriptionErrorCode["NETWORK_ERROR"] = "network_error";
|
|
24
|
+
/** Invalid request format */
|
|
25
|
+
TranscriptionErrorCode["INVALID_REQUEST"] = "invalid_request";
|
|
26
|
+
return TranscriptionErrorCode;
|
|
27
|
+
}({});
|
|
28
|
+
/**
|
|
29
|
+
* Helper functions to create transcription error responses.
|
|
30
|
+
* Used by the runtime to return consistent error responses.
|
|
31
|
+
*/
|
|
32
|
+
const TranscriptionErrors = {
|
|
33
|
+
serviceNotConfigured: () => ({
|
|
34
|
+
error: TranscriptionErrorCode.SERVICE_NOT_CONFIGURED,
|
|
35
|
+
message: "Transcription service is not configured",
|
|
36
|
+
retryable: false
|
|
37
|
+
}),
|
|
38
|
+
invalidAudioFormat: (format, supported) => ({
|
|
39
|
+
error: TranscriptionErrorCode.INVALID_AUDIO_FORMAT,
|
|
40
|
+
message: `Unsupported audio format: ${format}. Supported: ${supported.join(", ")}`,
|
|
41
|
+
retryable: false
|
|
42
|
+
}),
|
|
43
|
+
invalidRequest: (details) => ({
|
|
44
|
+
error: TranscriptionErrorCode.INVALID_REQUEST,
|
|
45
|
+
message: details,
|
|
46
|
+
retryable: false
|
|
47
|
+
}),
|
|
48
|
+
rateLimited: () => ({
|
|
49
|
+
error: TranscriptionErrorCode.RATE_LIMITED,
|
|
50
|
+
message: "Rate limited. Please try again later.",
|
|
51
|
+
retryable: true
|
|
52
|
+
}),
|
|
53
|
+
authFailed: () => ({
|
|
54
|
+
error: TranscriptionErrorCode.AUTH_FAILED,
|
|
55
|
+
message: "Authentication failed with transcription provider",
|
|
56
|
+
retryable: false
|
|
57
|
+
}),
|
|
58
|
+
providerError: (message) => ({
|
|
59
|
+
error: TranscriptionErrorCode.PROVIDER_ERROR,
|
|
60
|
+
message,
|
|
61
|
+
retryable: true
|
|
62
|
+
}),
|
|
63
|
+
networkError: (message = "Network error during transcription") => ({
|
|
64
|
+
error: TranscriptionErrorCode.NETWORK_ERROR,
|
|
65
|
+
message,
|
|
66
|
+
retryable: true
|
|
67
|
+
}),
|
|
68
|
+
audioTooLong: () => ({
|
|
69
|
+
error: TranscriptionErrorCode.AUDIO_TOO_LONG,
|
|
70
|
+
message: "Audio file is too long",
|
|
71
|
+
retryable: false
|
|
72
|
+
}),
|
|
73
|
+
audioTooShort: () => ({
|
|
74
|
+
error: TranscriptionErrorCode.AUDIO_TOO_SHORT,
|
|
75
|
+
message: "Audio is too short to transcribe",
|
|
76
|
+
retryable: false
|
|
77
|
+
})
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { TranscriptionErrorCode, TranscriptionErrors };
|
|
82
|
+
//# sourceMappingURL=transcription-errors.mjs.map
|