glirastes 0.4.0 → 0.5.1
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/CHANGELOG.md +377 -1
- package/README.md +283 -847
- package/adapter/nextjs/package.json +5 -0
- package/ai-sdk/package.json +5 -0
- package/browser/package.json +5 -0
- package/contracts/package.json +5 -0
- package/dist/agent/git.d.ts +65 -0
- package/dist/agent/git.js +122 -0
- package/dist/agent/git.js.map +1 -0
- package/dist/agent/openrouter.d.ts +56 -0
- package/dist/agent/openrouter.js +74 -0
- package/dist/agent/openrouter.js.map +1 -0
- package/dist/agent/platform-jobs.d.ts +102 -0
- package/dist/agent/platform-jobs.js +122 -0
- package/dist/agent/platform-jobs.js.map +1 -0
- package/dist/agent/runner.d.ts +150 -0
- package/dist/agent/runner.js +250 -0
- package/dist/agent/runner.js.map +1 -0
- package/dist/agent/workspace.d.ts +65 -0
- package/dist/agent/workspace.js +264 -0
- package/dist/agent/workspace.js.map +1 -0
- package/dist/browser/client-actions.d.ts +26 -0
- package/dist/browser/client-actions.js +42 -0
- package/dist/browser/client-actions.js.map +1 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.js +5 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/navigation.d.ts +32 -0
- package/dist/browser/navigation.js +79 -0
- package/dist/browser/navigation.js.map +1 -0
- package/dist/browser/query-filters.d.ts +30 -0
- package/dist/browser/query-filters.js +85 -0
- package/dist/browser/query-filters.js.map +1 -0
- package/dist/browser/ui-action-bus.d.ts +26 -0
- package/dist/browser/ui-action-bus.js +66 -0
- package/dist/browser/ui-action-bus.js.map +1 -0
- package/dist/cjs/browser/client-actions.d.ts +26 -0
- package/dist/cjs/browser/client-actions.js +45 -0
- package/dist/cjs/browser/index.d.ts +4 -0
- package/dist/cjs/browser/index.js +16 -0
- package/dist/cjs/browser/navigation.d.ts +32 -0
- package/dist/cjs/browser/navigation.js +84 -0
- package/dist/cjs/browser/query-filters.d.ts +30 -0
- package/dist/cjs/browser/query-filters.js +87 -0
- package/dist/cjs/browser/ui-action-bus.d.ts +26 -0
- package/dist/cjs/browser/ui-action-bus.js +70 -0
- package/dist/cjs/codegen/execution-inventory.d.ts +63 -0
- package/dist/cjs/codegen/execution-inventory.js +312 -0
- package/dist/cjs/codegen/index.d.ts +4 -13
- package/dist/cjs/codegen/index.js +13 -31
- package/dist/cjs/codegen/inventory-generation.d.ts +104 -0
- package/dist/cjs/codegen/inventory-generation.js +122 -0
- package/dist/cjs/codegen/next-source-generation.d.ts +17 -0
- package/dist/cjs/codegen/next-source-generation.js +51 -0
- package/dist/cjs/codegen/openapi-document.d.ts +53 -0
- package/dist/cjs/codegen/openapi-document.js +127 -0
- package/dist/cjs/codegen/route-exports.d.ts +13 -0
- package/dist/cjs/codegen/route-exports.js +122 -0
- package/dist/cjs/codegen/route-fingerprint.d.ts +2 -0
- package/dist/cjs/codegen/route-fingerprint.js +11 -0
- package/dist/cjs/codegen/route-scanner.d.ts +57 -0
- package/dist/cjs/codegen/route-scanner.js +239 -0
- package/dist/cjs/codegen/tools/canonical.d.ts +12 -0
- package/dist/cjs/codegen/tools/canonical.js +49 -0
- package/dist/cjs/codegen/tools/sources/nest-decorators.d.ts +27 -0
- package/dist/cjs/codegen/tools/sources/nest-decorators.js +73 -0
- package/dist/cjs/contracts/app-setup.d.ts +346 -0
- package/dist/cjs/contracts/app-setup.js +208 -0
- package/dist/cjs/contracts/chat-command.d.ts +65 -0
- package/dist/cjs/contracts/chat-command.js +128 -0
- package/dist/cjs/contracts/chat-interactions.d.ts +126 -0
- package/dist/cjs/contracts/chat-interactions.js +439 -0
- package/dist/cjs/contracts/clarification.d.ts +53 -0
- package/dist/cjs/contracts/clarification.js +91 -0
- package/dist/cjs/contracts/content-boundary.d.ts +3 -0
- package/dist/cjs/contracts/content-boundary.js +95 -0
- package/dist/cjs/contracts/events.d.ts +273 -0
- package/dist/cjs/contracts/events.js +229 -0
- package/dist/cjs/contracts/index.d.ts +18 -0
- package/dist/cjs/contracts/index.js +83 -0
- package/dist/cjs/contracts/plan.d.ts +20 -0
- package/dist/cjs/contracts/plan.js +38 -0
- package/dist/cjs/contracts/platform-connection.d.ts +44 -0
- package/dist/cjs/contracts/platform-connection.js +66 -0
- package/dist/cjs/contracts/platform-prompt-revision.d.ts +27 -0
- package/dist/cjs/contracts/platform-prompt-revision.js +46 -0
- package/dist/cjs/contracts/prompt-bundle.d.ts +46 -0
- package/dist/cjs/contracts/prompt-bundle.js +74 -0
- package/dist/cjs/contracts/revisions.d.ts +716 -0
- package/dist/cjs/contracts/revisions.js +301 -0
- package/dist/cjs/contracts/runtime.d.ts +55 -0
- package/dist/cjs/contracts/runtime.js +67 -0
- package/dist/cjs/contracts/semantic-change.d.ts +27 -0
- package/dist/cjs/contracts/semantic-change.js +103 -0
- package/dist/cjs/contracts/tool-exclude-pattern.d.ts +12 -0
- package/dist/cjs/contracts/tool-exclude-pattern.js +29 -0
- package/dist/cjs/contracts/tool-policy-entry.d.ts +107 -0
- package/dist/cjs/contracts/tool-policy-entry.js +42 -0
- package/dist/cjs/contracts/tool-policy.d.ts +198 -0
- package/dist/cjs/contracts/tool-policy.js +500 -0
- package/dist/cjs/contracts/url.d.ts +2 -0
- package/dist/cjs/contracts/url.js +10 -0
- package/dist/cjs/diagnostics/foundation-diagnostic.d.ts +34 -0
- package/dist/cjs/diagnostics/foundation-diagnostic.js +52 -0
- package/dist/cjs/diagnostics/index.d.ts +2 -0
- package/dist/cjs/diagnostics/index.js +7 -0
- package/dist/cjs/embed/chat-styles.generated.d.ts +1 -0
- package/dist/cjs/embed/chat-styles.generated.js +6 -0
- package/dist/cjs/embed/glirastes-chat-element.d.ts +67 -0
- package/dist/cjs/embed/glirastes-chat-element.js +282 -0
- package/dist/cjs/embed/index.d.ts +4 -0
- package/dist/cjs/embed/index.js +20 -0
- package/dist/cjs/embed/theme.d.ts +10 -0
- package/dist/cjs/embed/theme.js +45 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/react/assistant/assistant-layout.d.ts +55 -0
- package/dist/cjs/react/assistant/assistant-layout.js +107 -0
- package/dist/cjs/react/assistant/assistant-shell.d.ts +132 -0
- package/dist/cjs/react/assistant/assistant-shell.js +267 -0
- package/dist/cjs/react/assistant/assistant-shortcut-list.d.ts +24 -0
- package/dist/cjs/react/assistant/assistant-shortcut-list.js +35 -0
- package/dist/cjs/react/assistant/assistant-workspace.d.ts +31 -0
- package/dist/cjs/react/assistant/assistant-workspace.js +33 -0
- package/dist/cjs/react/completions/completion-search.d.ts +21 -0
- package/dist/cjs/react/completions/completion-search.js +111 -0
- package/dist/cjs/react/completions/ui-tool-command-provider.d.ts +15 -0
- package/dist/cjs/react/completions/ui-tool-command-provider.js +84 -0
- package/dist/cjs/react/components/activity-log.d.ts +17 -0
- package/dist/cjs/react/components/activity-log.js +70 -0
- package/dist/cjs/react/components/ai-chat-panel.js +13 -6
- package/dist/cjs/react/components/ai-trigger-button.d.ts +1 -1
- package/dist/cjs/react/components/ai-trigger-button.js +11 -66
- package/dist/cjs/react/components/approval-card.js +20 -1
- package/dist/cjs/react/components/chat-input.js +6 -4
- package/dist/cjs/react/components/chat-window-visibility.d.ts +3 -0
- package/dist/cjs/react/components/chat-window-visibility.js +7 -0
- package/dist/cjs/react/components/chat-window.d.ts +1 -1
- package/dist/cjs/react/components/chat-window.js +124 -57
- package/dist/cjs/react/components/clarification-card.d.ts +10 -0
- package/dist/cjs/react/components/clarification-card.js +35 -0
- package/dist/cjs/react/components/command-arguments-form.d.ts +10 -0
- package/dist/cjs/react/components/command-arguments-form.js +153 -0
- package/dist/cjs/react/components/confirm-dialog.js +1 -1
- package/dist/cjs/react/components/floating-chat-ui.d.ts +3 -3
- package/dist/cjs/react/components/floating-chat-ui.js +30 -4
- package/dist/cjs/react/components/mention-input.d.ts +5 -4
- package/dist/cjs/react/components/mention-input.js +64 -7
- package/dist/cjs/react/components/message-bubble.js +90 -14
- package/dist/cjs/react/components/plan-checklist.d.ts +14 -0
- package/dist/cjs/react/components/plan-checklist.js +20 -0
- package/dist/cjs/react/components/recording-bar.js +44 -58
- package/dist/cjs/react/components/rich-mention-input.js +197 -45
- package/dist/cjs/react/components/session-switcher.d.ts +3 -1
- package/dist/cjs/react/components/session-switcher.js +26 -11
- package/dist/cjs/react/components/status-icon.d.ts +8 -0
- package/dist/cjs/react/components/status-icon.js +11 -0
- package/dist/cjs/react/components/stream-waveform.d.ts +4 -0
- package/dist/cjs/react/components/stream-waveform.js +49 -0
- package/dist/cjs/react/components/voice-input-addon.d.ts +16 -1
- package/dist/cjs/react/components/voice-input-addon.js +255 -18
- package/dist/cjs/react/components/voice-input-button.js +1 -1
- package/dist/cjs/react/hooks/use-chat-shortcuts.d.ts +33 -0
- package/dist/cjs/react/hooks/use-chat-shortcuts.js +139 -0
- package/dist/cjs/react/hooks/use-deepgram-transcription.d.ts +4 -0
- package/dist/cjs/react/hooks/use-deepgram-transcription.js +31 -321
- package/dist/cjs/react/hooks/use-drag-resize-panel.d.ts +1 -0
- package/dist/cjs/react/hooks/use-drag-resize-panel.js +246 -121
- package/dist/cjs/react/hooks/use-floating-panel.d.ts +57 -0
- package/dist/cjs/react/hooks/use-floating-panel.js +217 -0
- package/dist/cjs/react/hooks/use-keyboard-shortcut.js +2 -1
- package/dist/cjs/react/hooks/use-push-to-talk-hotkey.d.ts +24 -0
- package/dist/cjs/react/hooks/use-push-to-talk-hotkey.js +116 -0
- package/dist/cjs/react/hooks/use-sidebar-resize.d.ts +19 -0
- package/dist/cjs/react/hooks/use-sidebar-resize.js +109 -0
- package/dist/cjs/react/index.d.ts +30 -1
- package/dist/cjs/react/index.js +91 -1
- package/dist/cjs/react/interactions/definitions.d.ts +67 -0
- package/dist/cjs/react/interactions/definitions.js +83 -0
- package/dist/cjs/react/interactions/registry.d.ts +74 -0
- package/dist/cjs/react/interactions/registry.js +250 -0
- package/dist/cjs/react/interactions/use-chat-interactions-data.d.ts +15 -0
- package/dist/cjs/react/interactions/use-chat-interactions-data.js +43 -0
- package/dist/cjs/react/locale-de.d.ts +3 -0
- package/dist/cjs/react/locale-de.js +69 -0
- package/dist/cjs/react/provider/ai-chat-provider.d.ts +1 -1
- package/dist/cjs/react/provider/ai-chat-provider.js +410 -106
- package/dist/cjs/react/provider/chat-context.d.ts +52 -1
- package/dist/cjs/react/stt/controller.d.ts +60 -0
- package/dist/cjs/react/stt/controller.js +268 -0
- package/dist/cjs/react/stt/deepgram.d.ts +30 -0
- package/dist/cjs/react/stt/deepgram.js +204 -0
- package/dist/cjs/react/stt/recorded.d.ts +29 -0
- package/dist/cjs/react/stt/recorded.js +115 -0
- package/dist/cjs/react/stt/segments.d.ts +18 -0
- package/dist/cjs/react/stt/segments.js +32 -0
- package/dist/cjs/react/stt/use-stt.d.ts +17 -0
- package/dist/cjs/react/stt/use-stt.js +41 -0
- package/dist/cjs/react/stt/waveform.d.ts +5 -0
- package/dist/cjs/react/stt/waveform.js +31 -0
- package/dist/cjs/react/styles.css +1555 -0
- package/dist/cjs/react/tool-renderers/registry.d.ts +31 -0
- package/dist/cjs/react/tool-renderers/registry.js +50 -0
- package/dist/cjs/react/tool-renderers/renderer-boundary.d.ts +18 -0
- package/dist/cjs/react/tool-renderers/renderer-boundary.js +15 -0
- package/dist/cjs/react/transports/vercel/vercel-ai-chat.d.ts +1 -1
- package/dist/cjs/react/transports/vercel/vercel-ai-chat.js +2 -2
- package/dist/cjs/react/transports/vercel.d.ts +6 -0
- package/dist/cjs/react/transports/vercel.js +12 -6
- package/dist/cjs/react/types.d.ts +269 -6
- package/dist/cjs/react/ui.d.ts +18 -17
- package/dist/cjs/react/ui.js +50 -45
- package/dist/cjs/react/unstyled.d.ts +7 -0
- package/dist/cjs/react/unstyled.js +10 -0
- package/dist/cjs/react/utils/activity.d.ts +16 -0
- package/dist/cjs/react/utils/activity.js +80 -0
- package/dist/cjs/react/utils/clarification.d.ts +31 -0
- package/dist/cjs/react/utils/clarification.js +104 -0
- package/dist/cjs/react/utils/create-approval-description.d.ts +6 -0
- package/dist/cjs/react/utils/create-approval-description.js +42 -7
- package/dist/cjs/react/utils/create-tool-result-handler.d.ts +1 -1
- package/dist/cjs/react/utils/create-tool-result-handler.js +1 -1
- package/dist/cjs/react/utils/entity-names.d.ts +6 -0
- package/dist/cjs/react/utils/entity-names.js +57 -0
- package/dist/cjs/react/utils/followup-suggestions.d.ts +11 -0
- package/dist/cjs/react/utils/followup-suggestions.js +39 -0
- package/dist/cjs/react/utils/local-session-store.d.ts +30 -0
- package/dist/cjs/react/utils/local-session-store.js +165 -0
- package/dist/cjs/react/utils/mention-markup.d.ts +44 -1
- package/dist/cjs/react/utils/mention-markup.js +144 -10
- package/dist/cjs/react/utils/tool-presentation.d.ts +23 -0
- package/dist/cjs/react/utils/tool-presentation.js +46 -0
- package/dist/cjs/react/utils/tool-result-config.d.ts +10 -0
- package/dist/cjs/react/utils/tool-result-config.js +14 -0
- package/dist/cjs/runtime/ai-sdk/engine.d.ts +66 -0
- package/dist/cjs/runtime/ai-sdk/engine.js +192 -0
- package/dist/cjs/runtime/ai-sdk/index.d.ts +1 -0
- package/dist/cjs/runtime/ai-sdk/index.js +5 -0
- package/dist/cjs/runtime/authorization.d.ts +16 -0
- package/dist/cjs/runtime/authorization.js +35 -0
- package/dist/cjs/runtime/budget.d.ts +39 -0
- package/dist/cjs/runtime/budget.js +100 -0
- package/dist/cjs/runtime/contract-bindings.d.ts +52 -0
- package/dist/cjs/runtime/contract-bindings.js +95 -0
- package/dist/cjs/runtime/engine.d.ts +52 -0
- package/dist/cjs/runtime/engine.js +2 -0
- package/dist/cjs/runtime/fingerprint.d.ts +6 -0
- package/dist/cjs/runtime/fingerprint.js +31 -0
- package/dist/cjs/runtime/glirastes.d.ts +113 -0
- package/dist/cjs/runtime/glirastes.js +289 -0
- package/dist/cjs/runtime/index.d.ts +24 -0
- package/dist/cjs/runtime/index.js +74 -0
- package/dist/cjs/runtime/json-schema.d.ts +13 -0
- package/dist/cjs/runtime/json-schema.js +46 -0
- package/dist/cjs/runtime/local-limits.d.ts +6 -0
- package/dist/cjs/runtime/local-limits.js +26 -0
- package/dist/cjs/runtime/local-runtime-source.d.ts +76 -0
- package/dist/cjs/runtime/local-runtime-source.js +0 -0
- package/dist/cjs/runtime/local-signer.d.ts +17 -0
- package/dist/cjs/runtime/local-signer.js +34 -0
- package/dist/cjs/runtime/local-tool-bindings.d.ts +57 -0
- package/dist/cjs/runtime/local-tool-bindings.js +197 -0
- package/dist/cjs/runtime/managed-turn.d.ts +29 -0
- package/dist/cjs/runtime/managed-turn.js +99 -0
- package/dist/cjs/runtime/metrics/cost.d.ts +64 -0
- package/dist/cjs/runtime/metrics/cost.js +98 -0
- package/dist/cjs/runtime/metrics/sink.d.ts +56 -0
- package/dist/cjs/runtime/metrics/sink.js +217 -0
- package/dist/cjs/runtime/metrics/turn-recorder.d.ts +62 -0
- package/dist/cjs/runtime/metrics/turn-recorder.js +172 -0
- package/dist/cjs/runtime/offline-execution-lease.d.ts +27 -0
- package/dist/cjs/runtime/offline-execution-lease.js +49 -0
- package/dist/cjs/runtime/policy-overlay.d.ts +86 -0
- package/dist/cjs/runtime/policy-overlay.js +122 -0
- package/dist/cjs/runtime/postgres-store.d.ts +111 -0
- package/dist/cjs/runtime/postgres-store.js +368 -0
- package/dist/cjs/runtime/prompt-bundle-store.d.ts +58 -0
- package/dist/cjs/runtime/prompt-bundle-store.js +123 -0
- package/dist/cjs/runtime/runtime-mode.d.ts +23 -0
- package/dist/cjs/runtime/runtime-mode.js +46 -0
- package/dist/cjs/runtime/sdk-version.d.ts +2 -0
- package/dist/cjs/runtime/sdk-version.js +5 -0
- package/dist/cjs/runtime/tool-discovery.d.ts +51 -0
- package/dist/cjs/runtime/tool-discovery.js +141 -0
- package/dist/cjs/runtime/tool-search.d.ts +31 -0
- package/dist/cjs/runtime/tool-search.js +149 -0
- package/dist/cjs/runtime/turn-snapshot.d.ts +44 -0
- package/dist/cjs/runtime/turn-snapshot.js +112 -0
- package/dist/cjs/server/adapters/nextjs/approval-binding.d.ts +334 -0
- package/dist/cjs/server/adapters/nextjs/approval-binding.js +724 -0
- package/dist/cjs/server/adapters/nextjs/chat-interactions-handler.d.ts +26 -0
- package/dist/cjs/server/adapters/nextjs/chat-interactions-handler.js +67 -0
- package/dist/cjs/server/adapters/nextjs/clarification-resume.d.ts +21 -0
- package/dist/cjs/server/adapters/nextjs/clarification-resume.js +112 -0
- package/dist/cjs/server/adapters/nextjs/context-helpers.d.ts +49 -8
- package/dist/cjs/server/adapters/nextjs/context-helpers.js +76 -21
- package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.d.ts +59 -1
- package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.js +648 -94
- package/dist/cjs/server/adapters/nextjs/direct-command.d.ts +75 -0
- package/dist/cjs/server/adapters/nextjs/direct-command.js +322 -0
- package/dist/cjs/server/adapters/nextjs/index.d.ts +10 -2
- package/dist/cjs/server/adapters/nextjs/index.js +24 -1
- package/dist/cjs/server/adapters/nextjs/prepare-model-messages.d.ts +2 -1
- package/dist/cjs/server/adapters/nextjs/prepare-model-messages.js +6 -14
- package/dist/cjs/server/adapters/nextjs/recording-transcription-handler.d.ts +31 -0
- package/dist/cjs/server/adapters/nextjs/recording-transcription-handler.js +58 -0
- package/dist/cjs/server/adapters/nextjs/request-guards.d.ts +41 -0
- package/dist/cjs/server/adapters/nextjs/request-guards.js +112 -0
- package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.js +12 -6
- package/dist/cjs/server/adapters/nextjs/scope-pipeline-tools.d.ts +17 -0
- package/dist/cjs/server/adapters/nextjs/scope-pipeline-tools.js +28 -0
- package/dist/cjs/server/adapters/nextjs/tool-discovery.d.ts +39 -0
- package/dist/cjs/server/adapters/nextjs/tool-discovery.js +50 -0
- package/dist/cjs/server/adapters/nextjs/tool-presentation.d.ts +26 -0
- package/dist/cjs/server/adapters/nextjs/tool-presentation.js +21 -0
- package/dist/cjs/server/adapters/nextjs/types.d.ts +229 -13
- package/dist/cjs/server/adapters/nextjs/with-ai-tool.d.ts +2 -2
- package/dist/cjs/server/core/adaptive-fast-path.d.ts +3 -0
- package/dist/cjs/server/core/adaptive-fast-path.js +188 -0
- package/dist/cjs/server/core/clarification-tool.d.ts +29 -0
- package/dist/cjs/server/core/clarification-tool.js +64 -0
- package/dist/cjs/server/core/generated-ui-tool.d.ts +31 -0
- package/dist/cjs/server/core/generated-ui-tool.js +89 -0
- package/dist/cjs/server/core/index.d.ts +49 -8
- package/dist/cjs/server/core/index.js +208 -17
- package/dist/cjs/server/core/local-guardrails.d.ts +6 -0
- package/dist/cjs/server/core/local-guardrails.js +70 -0
- package/dist/cjs/server/core/module-router.d.ts +3 -1
- package/dist/cjs/server/core/module-router.js +22 -2
- package/dist/cjs/server/core/plan-tool.d.ts +23 -0
- package/dist/cjs/server/core/plan-tool.js +35 -0
- package/dist/cjs/server/core/zod-compact.d.ts +2 -2
- package/dist/cjs/server/core/zod-compact.js +56 -7
- package/dist/cjs/server/index.d.ts +2 -4
- package/dist/cjs/server/index.js +4 -5
- package/dist/cjs/server/lancer/client.js +2 -1
- package/dist/cjs/server/local-pipeline.d.ts +14 -0
- package/dist/cjs/server/local-pipeline.js +154 -0
- package/dist/cjs/server/pii-shield/index.d.ts +1 -0
- package/dist/cjs/server/pii-shield/index.js +3 -1
- package/dist/cjs/server/pii-shield/regex-detector.d.ts +13 -0
- package/dist/cjs/server/pii-shield/regex-detector.js +111 -0
- package/dist/cjs/server/testing/guardrails.js +2 -66
- package/dist/cjs/server/testing/helpers.js +1 -62
- package/dist/cjs/server/testing/index.d.ts +1 -0
- package/dist/cjs/server/testing/index.js +3 -1
- package/dist/cjs/server/testing/registry-parity.d.ts +18 -0
- package/dist/cjs/server/testing/registry-parity.js +40 -0
- package/dist/cjs/server/testing/smoke.d.ts +2 -1
- package/dist/cjs/server/testing/smoke.js +7 -3
- package/dist/cjs/server/testing/types.d.ts +1 -1
- package/dist/cjs/server/testing/zod-introspect.d.ts +1 -1
- package/dist/cjs/server/testing/zod-introspect.js +178 -5
- package/dist/cjs/stt/index.d.ts +5 -0
- package/dist/cjs/stt/index.js +16 -0
- package/dist/cjs/sync/app-setup-client.d.ts +46 -0
- package/dist/cjs/sync/app-setup-client.js +140 -0
- package/dist/cjs/sync/capability-report.d.ts +41 -0
- package/dist/cjs/sync/capability-report.js +52 -0
- package/dist/cjs/sync/connection-lookup.d.ts +19 -0
- package/dist/cjs/sync/connection-lookup.js +58 -0
- package/dist/cjs/sync/control-plane-client.d.ts +69 -0
- package/dist/cjs/sync/control-plane-client.js +186 -0
- package/dist/cjs/sync/deployment-selector.d.ts +9 -0
- package/dist/cjs/sync/deployment-selector.js +29 -0
- package/dist/cjs/sync/fetch-sse-push.d.ts +6 -0
- package/dist/cjs/sync/fetch-sse-push.js +45 -0
- package/dist/cjs/sync/index.d.ts +26 -0
- package/dist/cjs/sync/index.js +43 -0
- package/dist/cjs/sync/jwks-provider.d.ts +14 -0
- package/dist/cjs/sync/jwks-provider.js +56 -0
- package/dist/cjs/sync/local-deployment-validator.d.ts +30 -0
- package/dist/cjs/sync/local-deployment-validator.js +62 -0
- package/dist/cjs/sync/managed-sync.d.ts +40 -0
- package/dist/cjs/sync/managed-sync.js +96 -0
- package/dist/cjs/sync/materialize-deployment.d.ts +7 -0
- package/dist/cjs/sync/materialize-deployment.js +65 -0
- package/dist/cjs/sync/runtime-connect-client.d.ts +23 -0
- package/dist/cjs/sync/runtime-connect-client.js +185 -0
- package/dist/cjs/sync/runtime-setup-client.d.ts +62 -0
- package/dist/cjs/sync/runtime-setup-client.js +157 -0
- package/dist/cjs/sync/signature-verifier.d.ts +39 -0
- package/dist/cjs/sync/signature-verifier.js +102 -0
- package/dist/cjs/sync/state-store.d.ts +24 -0
- package/dist/cjs/sync/state-store.js +51 -0
- package/dist/cjs/sync/sync-manager.d.ts +27 -0
- package/dist/cjs/sync/sync-manager.js +173 -0
- package/dist/cjs/types.d.ts +68 -16
- package/dist/cjs/types.js +30 -2
- package/dist/cli/bin.js +34 -23
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/agent-setup.d.ts +27 -0
- package/dist/cli/commands/agent-setup.js +149 -0
- package/dist/cli/commands/agent-setup.js.map +1 -0
- package/dist/cli/commands/apply-setup-plan.d.ts +21 -0
- package/dist/cli/commands/apply-setup-plan.js +100 -0
- package/dist/cli/commands/apply-setup-plan.js.map +1 -0
- package/dist/cli/commands/atomic-artifact-write.d.ts +19 -0
- package/dist/cli/commands/atomic-artifact-write.js +106 -0
- package/dist/cli/commands/atomic-artifact-write.js.map +1 -0
- package/dist/cli/commands/ci-workflow.d.ts +48 -0
- package/dist/cli/commands/ci-workflow.js +209 -0
- package/dist/cli/commands/ci-workflow.js.map +1 -0
- package/dist/cli/commands/connect.d.ts +47 -0
- package/dist/cli/commands/connect.js +216 -0
- package/dist/cli/commands/connect.js.map +1 -0
- package/dist/cli/commands/connection-descriptor.d.ts +4 -0
- package/dist/cli/commands/connection-descriptor.js +47 -0
- package/dist/cli/commands/connection-descriptor.js.map +1 -0
- package/dist/cli/commands/connection-environment.d.ts +25 -0
- package/dist/cli/commands/connection-environment.js +151 -0
- package/dist/cli/commands/connection-environment.js.map +1 -0
- package/dist/cli/commands/current-setup-manifests.d.ts +7 -0
- package/dist/cli/commands/current-setup-manifests.js +16 -0
- package/dist/cli/commands/current-setup-manifests.js.map +1 -0
- package/dist/cli/commands/doctor-presentation.d.ts +5 -0
- package/dist/cli/commands/doctor-presentation.js +86 -0
- package/dist/cli/commands/doctor-presentation.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +27 -0
- package/dist/cli/commands/doctor.js +220 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init-scaffold.d.ts +25 -0
- package/dist/cli/commands/init-scaffold.js +214 -0
- package/dist/cli/commands/init-scaffold.js.map +1 -0
- package/dist/cli/commands/install-skills.d.ts +26 -4
- package/dist/cli/commands/install-skills.js +165 -80
- package/dist/cli/commands/install-skills.js.map +1 -1
- package/dist/cli/commands/installed-skills-manifest.d.ts +87 -0
- package/dist/cli/commands/installed-skills-manifest.js +124 -0
- package/dist/cli/commands/installed-skills-manifest.js.map +1 -0
- package/dist/cli/commands/installer-parts.d.ts +31 -0
- package/dist/cli/commands/installer-parts.js +94 -0
- package/dist/cli/commands/installer-parts.js.map +1 -0
- package/dist/cli/commands/project-inspection.d.ts +35 -0
- package/dist/cli/commands/project-inspection.js +199 -0
- package/dist/cli/commands/project-inspection.js.map +1 -0
- package/dist/cli/commands/setup-plan.d.ts +65 -0
- package/dist/cli/commands/setup-plan.js +234 -0
- package/dist/cli/commands/setup-plan.js.map +1 -0
- package/dist/cli/commands/setup-profile.d.ts +28 -0
- package/dist/cli/commands/setup-profile.js +152 -0
- package/dist/cli/commands/setup-profile.js.map +1 -0
- package/dist/cli/commands/setup-wizard.d.ts +66 -0
- package/dist/cli/commands/setup-wizard.js +241 -0
- package/dist/cli/commands/setup-wizard.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +58 -0
- package/dist/cli/commands/sync.js +233 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/commands/tools/args.d.ts +14 -0
- package/dist/cli/commands/tools/args.js +33 -0
- package/dist/cli/commands/tools/args.js.map +1 -0
- package/dist/cli/commands/tools/check.d.ts +7 -0
- package/dist/cli/commands/tools/check.js +35 -0
- package/dist/cli/commands/tools/check.js.map +1 -0
- package/dist/cli/commands/tools/describe.d.ts +12 -0
- package/dist/cli/commands/tools/describe.js +43 -0
- package/dist/cli/commands/tools/describe.js.map +1 -0
- package/dist/cli/commands/tools/enrich.d.ts +50 -0
- package/dist/cli/commands/tools/enrich.js +597 -0
- package/dist/cli/commands/tools/enrich.js.map +1 -0
- package/dist/cli/commands/tools/eval.d.ts +13 -0
- package/dist/cli/commands/tools/eval.js +49 -0
- package/dist/cli/commands/tools/eval.js.map +1 -0
- package/dist/cli/commands/tools/format.d.ts +42 -0
- package/dist/cli/commands/tools/format.js +155 -0
- package/dist/cli/commands/tools/format.js.map +1 -0
- package/dist/cli/commands/tools/index.d.ts +26 -0
- package/dist/cli/commands/tools/index.js +107 -0
- package/dist/cli/commands/tools/index.js.map +1 -0
- package/dist/cli/commands/tools/policy.d.ts +11 -0
- package/dist/cli/commands/tools/policy.js +355 -0
- package/dist/cli/commands/tools/policy.js.map +1 -0
- package/dist/cli/commands/tools/refresh.d.ts +6 -0
- package/dist/cli/commands/tools/refresh.js +87 -0
- package/dist/cli/commands/tools/refresh.js.map +1 -0
- package/dist/cli/commands/tools/resolve.d.ts +10 -0
- package/dist/cli/commands/tools/resolve.js +19 -0
- package/dist/cli/commands/tools/resolve.js.map +1 -0
- package/dist/cli/commands/tools/status.d.ts +11 -0
- package/dist/cli/commands/tools/status.js +76 -0
- package/dist/cli/commands/tools/status.js.map +1 -0
- package/dist/cli/commands/tools/verify.d.ts +13 -0
- package/dist/cli/commands/tools/verify.js +168 -0
- package/dist/cli/commands/tools/verify.js.map +1 -0
- package/dist/cli/commands/tools/watch.d.ts +27 -0
- package/dist/cli/commands/tools/watch.js +148 -0
- package/dist/cli/commands/tools/watch.js.map +1 -0
- package/dist/cli/commands/validate-build.d.ts +88 -0
- package/dist/cli/commands/validate-build.js +213 -0
- package/dist/cli/commands/validate-build.js.map +1 -0
- package/dist/cli/commands/workspace-sources.d.ts +27 -0
- package/dist/cli/commands/workspace-sources.js +159 -0
- package/dist/cli/commands/workspace-sources.js.map +1 -0
- package/dist/cli/environment-loading.d.ts +6 -0
- package/dist/cli/environment-loading.js +18 -0
- package/dist/cli/environment-loading.js.map +1 -0
- package/dist/cli/index.d.ts +14 -1
- package/dist/cli/index.js +558 -574
- package/dist/cli/index.js.map +1 -1
- package/dist/codegen/execution-inventory.d.ts +63 -0
- package/dist/codegen/execution-inventory.js +306 -0
- package/dist/codegen/execution-inventory.js.map +1 -0
- package/dist/codegen/index.d.ts +4 -13
- package/dist/codegen/index.js +4 -12
- package/dist/codegen/index.js.map +1 -1
- package/dist/codegen/inventory-generation.d.ts +104 -0
- package/dist/codegen/inventory-generation.js +119 -0
- package/dist/codegen/inventory-generation.js.map +1 -0
- package/dist/codegen/next-source-generation.d.ts +17 -0
- package/dist/codegen/next-source-generation.js +49 -0
- package/dist/codegen/next-source-generation.js.map +1 -0
- package/dist/codegen/openapi-document.d.ts +53 -0
- package/dist/codegen/openapi-document.js +120 -0
- package/dist/codegen/openapi-document.js.map +1 -0
- package/dist/codegen/route-exports.d.ts +13 -0
- package/dist/codegen/route-exports.js +117 -0
- package/dist/codegen/route-exports.js.map +1 -0
- package/dist/codegen/route-fingerprint.d.ts +2 -0
- package/dist/codegen/route-fingerprint.js +9 -0
- package/dist/codegen/route-fingerprint.js.map +1 -0
- package/dist/codegen/route-scanner.d.ts +57 -0
- package/dist/codegen/route-scanner.js +233 -0
- package/dist/codegen/route-scanner.js.map +1 -0
- package/dist/codegen/tools/agentic.d.ts +31 -0
- package/dist/codegen/tools/agentic.js +110 -0
- package/dist/codegen/tools/agentic.js.map +1 -0
- package/dist/codegen/tools/artifact.d.ts +139 -0
- package/dist/codegen/tools/artifact.js +199 -0
- package/dist/codegen/tools/artifact.js.map +1 -0
- package/dist/codegen/tools/canonical.d.ts +12 -0
- package/dist/codegen/tools/canonical.js +41 -0
- package/dist/codegen/tools/canonical.js.map +1 -0
- package/dist/codegen/tools/chat-interactions.d.ts +27 -0
- package/dist/codegen/tools/chat-interactions.js +377 -0
- package/dist/codegen/tools/chat-interactions.js.map +1 -0
- package/dist/codegen/tools/config.d.ts +116 -0
- package/dist/codegen/tools/config.js +172 -0
- package/dist/codegen/tools/config.js.map +1 -0
- package/dist/codegen/tools/contract-tiers.d.ts +64 -0
- package/dist/codegen/tools/contract-tiers.js +518 -0
- package/dist/codegen/tools/contract-tiers.js.map +1 -0
- package/dist/codegen/tools/emit-module.d.ts +13 -0
- package/dist/codegen/tools/emit-module.js +182 -0
- package/dist/codegen/tools/emit-module.js.map +1 -0
- package/dist/codegen/tools/evidence.d.ts +13 -0
- package/dist/codegen/tools/evidence.js +138 -0
- package/dist/codegen/tools/evidence.js.map +1 -0
- package/dist/codegen/tools/exclusions.d.ts +30 -0
- package/dist/codegen/tools/exclusions.js +95 -0
- package/dist/codegen/tools/exclusions.js.map +1 -0
- package/dist/codegen/tools/files.d.ts +195 -0
- package/dist/codegen/tools/files.js +119 -0
- package/dist/codegen/tools/files.js.map +1 -0
- package/dist/codegen/tools/findings.d.ts +7 -0
- package/dist/codegen/tools/findings.js +106 -0
- package/dist/codegen/tools/findings.js.map +1 -0
- package/dist/codegen/tools/handler-analysis.d.ts +49 -0
- package/dist/codegen/tools/handler-analysis.js +375 -0
- package/dist/codegen/tools/handler-analysis.js.map +1 -0
- package/dist/codegen/tools/handler-locator.d.ts +21 -0
- package/dist/codegen/tools/handler-locator.js +152 -0
- package/dist/codegen/tools/handler-locator.js.map +1 -0
- package/dist/codegen/tools/identity.d.ts +18 -0
- package/dist/codegen/tools/identity.js +100 -0
- package/dist/codegen/tools/identity.js.map +1 -0
- package/dist/codegen/tools/input-roles.d.ts +32 -0
- package/dist/codegen/tools/input-roles.js +283 -0
- package/dist/codegen/tools/input-roles.js.map +1 -0
- package/dist/codegen/tools/inputs.d.ts +33 -0
- package/dist/codegen/tools/inputs.js +101 -0
- package/dist/codegen/tools/inputs.js.map +1 -0
- package/dist/codegen/tools/interface-digest.d.ts +14 -0
- package/dist/codegen/tools/interface-digest.js +24 -0
- package/dist/codegen/tools/interface-digest.js.map +1 -0
- package/dist/codegen/tools/mcp-names.d.ts +23 -0
- package/dist/codegen/tools/mcp-names.js +59 -0
- package/dist/codegen/tools/mcp-names.js.map +1 -0
- package/dist/codegen/tools/mode.d.ts +7 -0
- package/dist/codegen/tools/mode.js +27 -0
- package/dist/codegen/tools/mode.js.map +1 -0
- package/dist/codegen/tools/output-inference.d.ts +6 -0
- package/dist/codegen/tools/output-inference.js +99 -0
- package/dist/codegen/tools/output-inference.js.map +1 -0
- package/dist/codegen/tools/pipeline.d.ts +85 -0
- package/dist/codegen/tools/pipeline.js +733 -0
- package/dist/codegen/tools/pipeline.js.map +1 -0
- package/dist/codegen/tools/probe-child.mjs +155 -0
- package/dist/codegen/tools/probe-loader.mjs +105 -0
- package/dist/codegen/tools/program.d.ts +16 -0
- package/dist/codegen/tools/program.js +80 -0
- package/dist/codegen/tools/program.js.map +1 -0
- package/dist/codegen/tools/prose.d.ts +42 -0
- package/dist/codegen/tools/prose.js +211 -0
- package/dist/codegen/tools/prose.js.map +1 -0
- package/dist/codegen/tools/resolutions.d.ts +117 -0
- package/dist/codegen/tools/resolutions.js +195 -0
- package/dist/codegen/tools/resolutions.js.map +1 -0
- package/dist/codegen/tools/routing-eval.d.ts +50 -0
- package/dist/codegen/tools/routing-eval.js +81 -0
- package/dist/codegen/tools/routing-eval.js.map +1 -0
- package/dist/codegen/tools/schema-probe.d.ts +62 -0
- package/dist/codegen/tools/schema-probe.js +209 -0
- package/dist/codegen/tools/schema-probe.js.map +1 -0
- package/dist/codegen/tools/semantics.d.ts +134 -0
- package/dist/codegen/tools/semantics.js +206 -0
- package/dist/codegen/tools/semantics.js.map +1 -0
- package/dist/codegen/tools/sources/app-files.d.ts +35 -0
- package/dist/codegen/tools/sources/app-files.js +109 -0
- package/dist/codegen/tools/sources/app-files.js.map +1 -0
- package/dist/codegen/tools/sources/fastapi-routes.py +177 -0
- package/dist/codegen/tools/sources/nest-decorators.d.ts +27 -0
- package/dist/codegen/tools/sources/nest-decorators.js +65 -0
- package/dist/codegen/tools/sources/nest-decorators.js.map +1 -0
- package/dist/codegen/tools/sources/nest-endpoints.d.ts +10 -0
- package/dist/codegen/tools/sources/nest-endpoints.js +522 -0
- package/dist/codegen/tools/sources/nest-endpoints.js.map +1 -0
- package/dist/codegen/tools/sources/next-endpoints.d.ts +5 -0
- package/dist/codegen/tools/sources/next-endpoints.js +389 -0
- package/dist/codegen/tools/sources/next-endpoints.js.map +1 -0
- package/dist/codegen/tools/sources/next-pages.d.ts +18 -0
- package/dist/codegen/tools/sources/next-pages.js +88 -0
- package/dist/codegen/tools/sources/next-pages.js.map +1 -0
- package/dist/codegen/tools/sources/openapi-endpoints.d.ts +17 -0
- package/dist/codegen/tools/sources/openapi-endpoints.js +395 -0
- package/dist/codegen/tools/sources/openapi-endpoints.js.map +1 -0
- package/dist/codegen/tools/sources/page-tree.d.ts +49 -0
- package/dist/codegen/tools/sources/page-tree.js +152 -0
- package/dist/codegen/tools/sources/page-tree.js.map +1 -0
- package/dist/codegen/tools/sources/react-actions.d.ts +12 -0
- package/dist/codegen/tools/sources/react-actions.js +341 -0
- package/dist/codegen/tools/sources/react-actions.js.map +1 -0
- package/dist/codegen/tools/sources/route-config.d.ts +49 -0
- package/dist/codegen/tools/sources/route-config.js +427 -0
- package/dist/codegen/tools/sources/route-config.js.map +1 -0
- package/dist/codegen/tools/sources/ui-controls.d.ts +41 -0
- package/dist/codegen/tools/sources/ui-controls.js +360 -0
- package/dist/codegen/tools/sources/ui-controls.js.map +1 -0
- package/dist/codegen/tools/sources/ui-tools.d.ts +79 -0
- package/dist/codegen/tools/sources/ui-tools.js +207 -0
- package/dist/codegen/tools/sources/ui-tools.js.map +1 -0
- package/dist/codegen/tools/sources/url-filters.d.ts +41 -0
- package/dist/codegen/tools/sources/url-filters.js +813 -0
- package/dist/codegen/tools/sources/url-filters.js.map +1 -0
- package/dist/codegen/tools/sources/vue-sfc.d.ts +22 -0
- package/dist/codegen/tools/sources/vue-sfc.js +65 -0
- package/dist/codegen/tools/sources/vue-sfc.js.map +1 -0
- package/dist/codegen/tools/state.d.ts +37 -0
- package/dist/codegen/tools/state.js +249 -0
- package/dist/codegen/tools/state.js.map +1 -0
- package/dist/codegen/tools/types.d.ts +137 -0
- package/dist/codegen/tools/types.js +2 -0
- package/dist/codegen/tools/types.js.map +1 -0
- package/dist/codegen/tools/worklist.d.ts +157 -0
- package/dist/codegen/tools/worklist.js +406 -0
- package/dist/codegen/tools/worklist.js.map +1 -0
- package/dist/contracts/app-setup.d.ts +346 -0
- package/dist/contracts/app-setup.js +205 -0
- package/dist/contracts/app-setup.js.map +1 -0
- package/dist/contracts/chat-command.d.ts +65 -0
- package/dist/contracts/chat-command.js +121 -0
- package/dist/contracts/chat-command.js.map +1 -0
- package/dist/contracts/chat-interactions.d.ts +126 -0
- package/dist/contracts/chat-interactions.js +431 -0
- package/dist/contracts/chat-interactions.js.map +1 -0
- package/dist/contracts/clarification.d.ts +53 -0
- package/dist/contracts/clarification.js +86 -0
- package/dist/contracts/clarification.js.map +1 -0
- package/dist/contracts/content-boundary.d.ts +3 -0
- package/dist/contracts/content-boundary.js +91 -0
- package/dist/contracts/content-boundary.js.map +1 -0
- package/dist/contracts/events.d.ts +273 -0
- package/dist/contracts/events.js +227 -0
- package/dist/contracts/events.js.map +1 -0
- package/dist/contracts/index.d.ts +18 -0
- package/dist/contracts/index.js +10 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/plan.d.ts +20 -0
- package/dist/contracts/plan.js +35 -0
- package/dist/contracts/plan.js.map +1 -0
- package/dist/contracts/platform-connection.d.ts +44 -0
- package/dist/contracts/platform-connection.js +64 -0
- package/dist/contracts/platform-connection.js.map +1 -0
- package/dist/contracts/platform-prompt-revision.d.ts +27 -0
- package/dist/contracts/platform-prompt-revision.js +44 -0
- package/dist/contracts/platform-prompt-revision.js.map +1 -0
- package/dist/contracts/prompt-bundle.d.ts +46 -0
- package/dist/contracts/prompt-bundle.js +70 -0
- package/dist/contracts/prompt-bundle.js.map +1 -0
- package/dist/contracts/revisions.d.ts +716 -0
- package/dist/contracts/revisions.js +298 -0
- package/dist/contracts/revisions.js.map +1 -0
- package/dist/contracts/runtime.d.ts +55 -0
- package/dist/contracts/runtime.js +65 -0
- package/dist/contracts/runtime.js.map +1 -0
- package/dist/contracts/semantic-change.d.ts +27 -0
- package/dist/contracts/semantic-change.js +101 -0
- package/dist/contracts/semantic-change.js.map +1 -0
- package/dist/contracts/tool-exclude-pattern.d.ts +12 -0
- package/dist/contracts/tool-exclude-pattern.js +27 -0
- package/dist/contracts/tool-exclude-pattern.js.map +1 -0
- package/dist/contracts/tool-policy-entry.d.ts +107 -0
- package/dist/contracts/tool-policy-entry.js +40 -0
- package/dist/contracts/tool-policy-entry.js.map +1 -0
- package/dist/contracts/tool-policy.d.ts +198 -0
- package/dist/contracts/tool-policy.js +485 -0
- package/dist/contracts/tool-policy.js.map +1 -0
- package/dist/contracts/url.d.ts +2 -0
- package/dist/contracts/url.js +8 -0
- package/dist/contracts/url.js.map +1 -0
- package/dist/diagnostics/foundation-diagnostic.d.ts +34 -0
- package/dist/diagnostics/foundation-diagnostic.js +47 -0
- package/dist/diagnostics/foundation-diagnostic.js.map +1 -0
- package/dist/diagnostics/index.d.ts +2 -0
- package/dist/diagnostics/index.js +2 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/embed/chat-styles.generated.d.ts +1 -0
- package/dist/embed/chat-styles.generated.js +4 -0
- package/dist/embed/chat-styles.generated.js.map +1 -0
- package/dist/embed/glirastes-chat-element.d.ts +67 -0
- package/dist/embed/glirastes-chat-element.js +278 -0
- package/dist/embed/glirastes-chat-element.js.map +1 -0
- package/dist/embed/index.d.ts +4 -0
- package/dist/embed/index.js +11 -0
- package/dist/embed/index.js.map +1 -0
- package/dist/embed/theme.d.ts +10 -0
- package/dist/embed/theme.js +41 -0
- package/dist/embed/theme.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/react/assistant/assistant-layout.d.ts +55 -0
- package/dist/react/assistant/assistant-layout.js +99 -0
- package/dist/react/assistant/assistant-layout.js.map +1 -0
- package/dist/react/assistant/assistant-shell.d.ts +132 -0
- package/dist/react/assistant/assistant-shell.js +262 -0
- package/dist/react/assistant/assistant-shell.js.map +1 -0
- package/dist/react/assistant/assistant-shortcut-list.d.ts +24 -0
- package/dist/react/assistant/assistant-shortcut-list.js +32 -0
- package/dist/react/assistant/assistant-shortcut-list.js.map +1 -0
- package/dist/react/assistant/assistant-workspace.d.ts +31 -0
- package/dist/react/assistant/assistant-workspace.js +31 -0
- package/dist/react/assistant/assistant-workspace.js.map +1 -0
- package/dist/react/completions/completion-search.d.ts +21 -0
- package/dist/react/completions/completion-search.js +109 -0
- package/dist/react/completions/completion-search.js.map +1 -0
- package/dist/react/completions/ui-tool-command-provider.d.ts +15 -0
- package/dist/react/completions/ui-tool-command-provider.js +82 -0
- package/dist/react/completions/ui-tool-command-provider.js.map +1 -0
- package/dist/react/components/activity-log.d.ts +17 -0
- package/dist/react/components/activity-log.js +68 -0
- package/dist/react/components/activity-log.js.map +1 -0
- package/dist/react/components/ai-chat-panel.js +13 -6
- package/dist/react/components/ai-chat-panel.js.map +1 -1
- package/dist/react/components/ai-trigger-button.d.ts +1 -1
- package/dist/react/components/ai-trigger-button.js +13 -68
- package/dist/react/components/ai-trigger-button.js.map +1 -1
- package/dist/react/components/approval-card.js +20 -1
- package/dist/react/components/approval-card.js.map +1 -1
- package/dist/react/components/chat-input.js +7 -5
- package/dist/react/components/chat-input.js.map +1 -1
- package/dist/react/components/chat-window-visibility.d.ts +3 -0
- package/dist/react/components/chat-window-visibility.js +5 -0
- package/dist/react/components/chat-window-visibility.js.map +1 -0
- package/dist/react/components/chat-window.d.ts +1 -1
- package/dist/react/components/chat-window.js +124 -57
- package/dist/react/components/chat-window.js.map +1 -1
- package/dist/react/components/clarification-card.d.ts +10 -0
- package/dist/react/components/clarification-card.js +33 -0
- package/dist/react/components/clarification-card.js.map +1 -0
- package/dist/react/components/command-arguments-form.d.ts +10 -0
- package/dist/react/components/command-arguments-form.js +151 -0
- package/dist/react/components/command-arguments-form.js.map +1 -0
- package/dist/react/components/confirm-dialog.js +1 -1
- package/dist/react/components/confirm-dialog.js.map +1 -1
- package/dist/react/components/floating-chat-ui.d.ts +3 -3
- package/dist/react/components/floating-chat-ui.js +31 -5
- package/dist/react/components/floating-chat-ui.js.map +1 -1
- package/dist/react/components/mention-input.d.ts +5 -4
- package/dist/react/components/mention-input.js +65 -8
- package/dist/react/components/mention-input.js.map +1 -1
- package/dist/react/components/message-bubble.js +90 -14
- package/dist/react/components/message-bubble.js.map +1 -1
- package/dist/react/components/plan-checklist.d.ts +14 -0
- package/dist/react/components/plan-checklist.js +18 -0
- package/dist/react/components/plan-checklist.js.map +1 -0
- package/dist/react/components/recording-bar.js +45 -59
- package/dist/react/components/recording-bar.js.map +1 -1
- package/dist/react/components/rich-mention-input.js +199 -47
- package/dist/react/components/rich-mention-input.js.map +1 -1
- package/dist/react/components/session-switcher.d.ts +3 -1
- package/dist/react/components/session-switcher.js +27 -12
- package/dist/react/components/session-switcher.js.map +1 -1
- package/dist/react/components/status-icon.d.ts +8 -0
- package/dist/react/components/status-icon.js +9 -0
- package/dist/react/components/status-icon.js.map +1 -0
- package/dist/react/components/stream-waveform.d.ts +4 -0
- package/dist/react/components/stream-waveform.js +47 -0
- package/dist/react/components/stream-waveform.js.map +1 -0
- package/dist/react/components/voice-input-addon.d.ts +16 -1
- package/dist/react/components/voice-input-addon.js +256 -19
- package/dist/react/components/voice-input-addon.js.map +1 -1
- package/dist/react/components/voice-input-button.js +1 -1
- package/dist/react/components/voice-input-button.js.map +1 -1
- package/dist/react/hooks/use-chat-shortcuts.d.ts +33 -0
- package/dist/react/hooks/use-chat-shortcuts.js +133 -0
- package/dist/react/hooks/use-chat-shortcuts.js.map +1 -0
- package/dist/react/hooks/use-deepgram-transcription.d.ts +4 -0
- package/dist/react/hooks/use-deepgram-transcription.js +32 -322
- package/dist/react/hooks/use-deepgram-transcription.js.map +1 -1
- package/dist/react/hooks/use-drag-resize-panel.d.ts +1 -0
- package/dist/react/hooks/use-drag-resize-panel.js +246 -121
- package/dist/react/hooks/use-drag-resize-panel.js.map +1 -1
- package/dist/react/hooks/use-floating-panel.d.ts +57 -0
- package/dist/react/hooks/use-floating-panel.js +215 -0
- package/dist/react/hooks/use-floating-panel.js.map +1 -0
- package/dist/react/hooks/use-keyboard-shortcut.js +2 -1
- package/dist/react/hooks/use-keyboard-shortcut.js.map +1 -1
- package/dist/react/hooks/use-push-to-talk-hotkey.d.ts +24 -0
- package/dist/react/hooks/use-push-to-talk-hotkey.js +112 -0
- package/dist/react/hooks/use-push-to-talk-hotkey.js.map +1 -0
- package/dist/react/hooks/use-sidebar-resize.d.ts +19 -0
- package/dist/react/hooks/use-sidebar-resize.js +107 -0
- package/dist/react/hooks/use-sidebar-resize.js.map +1 -0
- package/dist/react/index.d.ts +30 -1
- package/dist/react/index.js +31 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/interactions/definitions.d.ts +67 -0
- package/dist/react/interactions/definitions.js +78 -0
- package/dist/react/interactions/definitions.js.map +1 -0
- package/dist/react/interactions/registry.d.ts +74 -0
- package/dist/react/interactions/registry.js +248 -0
- package/dist/react/interactions/registry.js.map +1 -0
- package/dist/react/interactions/use-chat-interactions-data.d.ts +15 -0
- package/dist/react/interactions/use-chat-interactions-data.js +41 -0
- package/dist/react/interactions/use-chat-interactions-data.js.map +1 -0
- package/dist/react/locale-de.d.ts +3 -0
- package/dist/react/locale-de.js +67 -0
- package/dist/react/locale-de.js.map +1 -0
- package/dist/react/provider/ai-chat-provider.d.ts +1 -1
- package/dist/react/provider/ai-chat-provider.js +411 -107
- package/dist/react/provider/ai-chat-provider.js.map +1 -1
- package/dist/react/provider/chat-context.d.ts +52 -1
- package/dist/react/provider/chat-context.js.map +1 -1
- package/dist/react/stt/controller.d.ts +60 -0
- package/dist/react/stt/controller.js +265 -0
- package/dist/react/stt/controller.js.map +1 -0
- package/dist/react/stt/deepgram.d.ts +30 -0
- package/dist/react/stt/deepgram.js +199 -0
- package/dist/react/stt/deepgram.js.map +1 -0
- package/dist/react/stt/recorded.d.ts +29 -0
- package/dist/react/stt/recorded.js +111 -0
- package/dist/react/stt/recorded.js.map +1 -0
- package/dist/react/stt/segments.d.ts +18 -0
- package/dist/react/stt/segments.js +29 -0
- package/dist/react/stt/segments.js.map +1 -0
- package/dist/react/stt/use-stt.d.ts +17 -0
- package/dist/react/stt/use-stt.js +39 -0
- package/dist/react/stt/use-stt.js.map +1 -0
- package/dist/react/stt/waveform.d.ts +5 -0
- package/dist/react/stt/waveform.js +29 -0
- package/dist/react/stt/waveform.js.map +1 -0
- package/dist/react/styles.css +784 -126
- package/dist/react/tool-renderers/registry.d.ts +31 -0
- package/dist/react/tool-renderers/registry.js +47 -0
- package/dist/react/tool-renderers/registry.js.map +1 -0
- package/dist/react/tool-renderers/renderer-boundary.d.ts +18 -0
- package/dist/react/tool-renderers/renderer-boundary.js +12 -0
- package/dist/react/tool-renderers/renderer-boundary.js.map +1 -0
- package/dist/react/transports/vercel/vercel-ai-chat.d.ts +1 -1
- package/dist/react/transports/vercel/vercel-ai-chat.js +2 -2
- package/dist/react/transports/vercel/vercel-ai-chat.js.map +1 -1
- package/dist/react/transports/vercel.d.ts +6 -0
- package/dist/react/transports/vercel.js +11 -6
- package/dist/react/transports/vercel.js.map +1 -1
- package/dist/react/types.d.ts +269 -6
- package/dist/react/ui.d.ts +18 -17
- package/dist/react/ui.js +46 -43
- package/dist/react/ui.js.map +1 -1
- package/dist/react/unstyled.d.ts +7 -0
- package/dist/react/unstyled.js +8 -0
- package/dist/react/unstyled.js.map +1 -0
- package/dist/react/utils/activity.d.ts +16 -0
- package/dist/react/utils/activity.js +77 -0
- package/dist/react/utils/activity.js.map +1 -0
- package/dist/react/utils/clarification.d.ts +31 -0
- package/dist/react/utils/clarification.js +99 -0
- package/dist/react/utils/clarification.js.map +1 -0
- package/dist/react/utils/create-approval-description.d.ts +6 -0
- package/dist/react/utils/create-approval-description.js +42 -7
- package/dist/react/utils/create-approval-description.js.map +1 -1
- package/dist/react/utils/create-tool-result-handler.d.ts +1 -1
- package/dist/react/utils/create-tool-result-handler.js +1 -1
- package/dist/react/utils/create-tool-result-handler.js.map +1 -1
- package/dist/react/utils/entity-names.d.ts +6 -0
- package/dist/react/utils/entity-names.js +55 -0
- package/dist/react/utils/entity-names.js.map +1 -0
- package/dist/react/utils/followup-suggestions.d.ts +11 -0
- package/dist/react/utils/followup-suggestions.js +37 -0
- package/dist/react/utils/followup-suggestions.js.map +1 -0
- package/dist/react/utils/local-session-store.d.ts +30 -0
- package/dist/react/utils/local-session-store.js +163 -0
- package/dist/react/utils/local-session-store.js.map +1 -0
- package/dist/react/utils/mention-markup.d.ts +44 -1
- package/dist/react/utils/mention-markup.js +140 -10
- package/dist/react/utils/mention-markup.js.map +1 -1
- package/dist/react/utils/tool-presentation.d.ts +23 -0
- package/dist/react/utils/tool-presentation.js +41 -0
- package/dist/react/utils/tool-presentation.js.map +1 -0
- package/dist/react/utils/tool-result-config.d.ts +10 -0
- package/dist/react/utils/tool-result-config.js +12 -0
- package/dist/react/utils/tool-result-config.js.map +1 -0
- package/dist/runtime/ai-sdk/engine.d.ts +66 -0
- package/dist/runtime/ai-sdk/engine.js +188 -0
- package/dist/runtime/ai-sdk/engine.js.map +1 -0
- package/dist/runtime/ai-sdk/index.d.ts +1 -0
- package/dist/runtime/ai-sdk/index.js +2 -0
- package/dist/runtime/ai-sdk/index.js.map +1 -0
- package/dist/runtime/authorization.d.ts +16 -0
- package/dist/runtime/authorization.js +33 -0
- package/dist/runtime/authorization.js.map +1 -0
- package/dist/runtime/budget.d.ts +39 -0
- package/dist/runtime/budget.js +97 -0
- package/dist/runtime/budget.js.map +1 -0
- package/dist/runtime/contract-bindings.d.ts +52 -0
- package/dist/runtime/contract-bindings.js +92 -0
- package/dist/runtime/contract-bindings.js.map +1 -0
- package/dist/runtime/engine.d.ts +52 -0
- package/dist/runtime/engine.js +2 -0
- package/dist/runtime/engine.js.map +1 -0
- package/dist/runtime/fingerprint.d.ts +6 -0
- package/dist/runtime/fingerprint.js +29 -0
- package/dist/runtime/fingerprint.js.map +1 -0
- package/dist/runtime/glirastes.d.ts +113 -0
- package/dist/runtime/glirastes.js +287 -0
- package/dist/runtime/glirastes.js.map +1 -0
- package/dist/runtime/index.d.ts +24 -0
- package/dist/runtime/index.js +24 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/json-schema.d.ts +13 -0
- package/dist/runtime/json-schema.js +41 -0
- package/dist/runtime/json-schema.js.map +1 -0
- package/dist/runtime/local-limits.d.ts +6 -0
- package/dist/runtime/local-limits.js +23 -0
- package/dist/runtime/local-limits.js.map +1 -0
- package/dist/runtime/local-runtime-source.d.ts +76 -0
- package/dist/runtime/local-runtime-source.js +0 -0
- package/dist/runtime/local-runtime-source.js.map +1 -0
- package/dist/runtime/local-signer.d.ts +17 -0
- package/dist/runtime/local-signer.js +32 -0
- package/dist/runtime/local-signer.js.map +1 -0
- package/dist/runtime/local-tool-bindings.d.ts +57 -0
- package/dist/runtime/local-tool-bindings.js +190 -0
- package/dist/runtime/local-tool-bindings.js.map +1 -0
- package/dist/runtime/managed-turn.d.ts +29 -0
- package/dist/runtime/managed-turn.js +97 -0
- package/dist/runtime/managed-turn.js.map +1 -0
- package/dist/runtime/metrics/cost.d.ts +64 -0
- package/dist/runtime/metrics/cost.js +92 -0
- package/dist/runtime/metrics/cost.js.map +1 -0
- package/dist/runtime/metrics/sink.d.ts +56 -0
- package/dist/runtime/metrics/sink.js +214 -0
- package/dist/runtime/metrics/sink.js.map +1 -0
- package/dist/runtime/metrics/turn-recorder.d.ts +62 -0
- package/dist/runtime/metrics/turn-recorder.js +170 -0
- package/dist/runtime/metrics/turn-recorder.js.map +1 -0
- package/dist/runtime/offline-execution-lease.d.ts +27 -0
- package/dist/runtime/offline-execution-lease.js +46 -0
- package/dist/runtime/offline-execution-lease.js.map +1 -0
- package/dist/runtime/policy-overlay.d.ts +86 -0
- package/dist/runtime/policy-overlay.js +117 -0
- package/dist/runtime/policy-overlay.js.map +1 -0
- package/dist/runtime/postgres-store.d.ts +111 -0
- package/dist/runtime/postgres-store.js +363 -0
- package/dist/runtime/postgres-store.js.map +1 -0
- package/dist/runtime/prompt-bundle-store.d.ts +58 -0
- package/dist/runtime/prompt-bundle-store.js +120 -0
- package/dist/runtime/prompt-bundle-store.js.map +1 -0
- package/dist/runtime/runtime-mode.d.ts +23 -0
- package/dist/runtime/runtime-mode.js +42 -0
- package/dist/runtime/runtime-mode.js.map +1 -0
- package/dist/runtime/sdk-version.d.ts +2 -0
- package/dist/runtime/sdk-version.js +3 -0
- package/dist/runtime/sdk-version.js.map +1 -0
- package/dist/runtime/tool-discovery.d.ts +51 -0
- package/dist/runtime/tool-discovery.js +138 -0
- package/dist/runtime/tool-discovery.js.map +1 -0
- package/dist/runtime/tool-search.d.ts +31 -0
- package/dist/runtime/tool-search.js +145 -0
- package/dist/runtime/tool-search.js.map +1 -0
- package/dist/runtime/turn-snapshot.d.ts +44 -0
- package/dist/runtime/turn-snapshot.js +108 -0
- package/dist/runtime/turn-snapshot.js.map +1 -0
- package/dist/server/adapters/nextjs/approval-binding.d.ts +334 -0
- package/dist/server/adapters/nextjs/approval-binding.js +707 -0
- package/dist/server/adapters/nextjs/approval-binding.js.map +1 -0
- package/dist/server/adapters/nextjs/chat-interactions-handler.d.ts +26 -0
- package/dist/server/adapters/nextjs/chat-interactions-handler.js +65 -0
- package/dist/server/adapters/nextjs/chat-interactions-handler.js.map +1 -0
- package/dist/server/adapters/nextjs/clarification-resume.d.ts +21 -0
- package/dist/server/adapters/nextjs/clarification-resume.js +109 -0
- package/dist/server/adapters/nextjs/clarification-resume.js.map +1 -0
- package/dist/server/adapters/nextjs/context-helpers.d.ts +49 -8
- package/dist/server/adapters/nextjs/context-helpers.js +75 -21
- package/dist/server/adapters/nextjs/context-helpers.js.map +1 -1
- package/dist/server/adapters/nextjs/create-ai-chat-handler.d.ts +59 -1
- package/dist/server/adapters/nextjs/create-ai-chat-handler.js +647 -95
- package/dist/server/adapters/nextjs/create-ai-chat-handler.js.map +1 -1
- package/dist/server/adapters/nextjs/direct-command.d.ts +75 -0
- package/dist/server/adapters/nextjs/direct-command.js +316 -0
- package/dist/server/adapters/nextjs/direct-command.js.map +1 -0
- package/dist/server/adapters/nextjs/index.d.ts +10 -2
- package/dist/server/adapters/nextjs/index.js +7 -0
- package/dist/server/adapters/nextjs/index.js.map +1 -1
- package/dist/server/adapters/nextjs/prepare-model-messages.d.ts +2 -1
- package/dist/server/adapters/nextjs/prepare-model-messages.js +7 -15
- package/dist/server/adapters/nextjs/prepare-model-messages.js.map +1 -1
- package/dist/server/adapters/nextjs/recording-transcription-handler.d.ts +31 -0
- package/dist/server/adapters/nextjs/recording-transcription-handler.js +55 -0
- package/dist/server/adapters/nextjs/recording-transcription-handler.js.map +1 -0
- package/dist/server/adapters/nextjs/request-guards.d.ts +41 -0
- package/dist/server/adapters/nextjs/request-guards.js +108 -0
- package/dist/server/adapters/nextjs/request-guards.js.map +1 -0
- package/dist/server/adapters/nextjs/sanitize-model-messages.js +12 -6
- package/dist/server/adapters/nextjs/sanitize-model-messages.js.map +1 -1
- package/dist/server/adapters/nextjs/scope-pipeline-tools.d.ts +17 -0
- package/dist/server/adapters/nextjs/scope-pipeline-tools.js +26 -0
- package/dist/server/adapters/nextjs/scope-pipeline-tools.js.map +1 -0
- package/dist/server/adapters/nextjs/tool-discovery.d.ts +39 -0
- package/dist/server/adapters/nextjs/tool-discovery.js +47 -0
- package/dist/server/adapters/nextjs/tool-discovery.js.map +1 -0
- package/dist/server/adapters/nextjs/tool-presentation.d.ts +26 -0
- package/dist/server/adapters/nextjs/tool-presentation.js +19 -0
- package/dist/server/adapters/nextjs/tool-presentation.js.map +1 -0
- package/dist/server/adapters/nextjs/types.d.ts +229 -13
- package/dist/server/adapters/nextjs/with-ai-tool.d.ts +2 -2
- package/dist/server/core/adaptive-fast-path.d.ts +3 -0
- package/dist/server/core/adaptive-fast-path.js +185 -0
- package/dist/server/core/adaptive-fast-path.js.map +1 -0
- package/dist/server/core/clarification-tool.d.ts +29 -0
- package/dist/server/core/clarification-tool.js +61 -0
- package/dist/server/core/clarification-tool.js.map +1 -0
- package/dist/server/core/generated-ui-tool.d.ts +31 -0
- package/dist/server/core/generated-ui-tool.js +87 -0
- package/dist/server/core/generated-ui-tool.js.map +1 -0
- package/dist/server/core/index.d.ts +49 -8
- package/dist/server/core/index.js +198 -16
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/core/local-guardrails.d.ts +6 -0
- package/dist/server/core/local-guardrails.js +68 -0
- package/dist/server/core/local-guardrails.js.map +1 -0
- package/dist/server/core/module-router.d.ts +3 -1
- package/dist/server/core/module-router.js +22 -2
- package/dist/server/core/module-router.js.map +1 -1
- package/dist/server/core/plan-tool.d.ts +23 -0
- package/dist/server/core/plan-tool.js +32 -0
- package/dist/server/core/plan-tool.js.map +1 -0
- package/dist/server/core/zod-compact.d.ts +2 -2
- package/dist/server/core/zod-compact.js +56 -7
- package/dist/server/core/zod-compact.js.map +1 -1
- package/dist/server/index.d.ts +2 -4
- package/dist/server/index.js +2 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/lancer/client.js +2 -1
- package/dist/server/lancer/client.js.map +1 -1
- package/dist/server/local-pipeline.d.ts +14 -0
- package/dist/server/local-pipeline.js +152 -0
- package/dist/server/local-pipeline.js.map +1 -0
- package/dist/server/pii-shield/index.d.ts +1 -0
- package/dist/server/pii-shield/index.js +1 -0
- package/dist/server/pii-shield/index.js.map +1 -1
- package/dist/server/pii-shield/regex-detector.d.ts +13 -0
- package/dist/server/pii-shield/regex-detector.js +109 -0
- package/dist/server/pii-shield/regex-detector.js.map +1 -0
- package/dist/server/testing/guardrails.js +1 -65
- package/dist/server/testing/guardrails.js.map +1 -1
- package/dist/server/testing/helpers.js +1 -62
- package/dist/server/testing/helpers.js.map +1 -1
- package/dist/server/testing/index.d.ts +1 -0
- package/dist/server/testing/index.js +1 -0
- package/dist/server/testing/index.js.map +1 -1
- package/dist/server/testing/registry-parity.d.ts +18 -0
- package/dist/server/testing/registry-parity.js +38 -0
- package/dist/server/testing/registry-parity.js.map +1 -0
- package/dist/server/testing/smoke.d.ts +2 -1
- package/dist/server/testing/smoke.js +5 -3
- package/dist/server/testing/smoke.js.map +1 -1
- package/dist/server/testing/types.d.ts +1 -1
- package/dist/server/testing/zod-introspect.d.ts +1 -1
- package/dist/server/testing/zod-introspect.js +178 -5
- package/dist/server/testing/zod-introspect.js.map +1 -1
- package/dist/stt/index.d.ts +5 -0
- package/dist/stt/index.js +6 -0
- package/dist/stt/index.js.map +1 -0
- package/dist/sync/app-setup-client.d.ts +46 -0
- package/dist/sync/app-setup-client.js +137 -0
- package/dist/sync/app-setup-client.js.map +1 -0
- package/dist/sync/capability-report.d.ts +41 -0
- package/dist/sync/capability-report.js +48 -0
- package/dist/sync/capability-report.js.map +1 -0
- package/dist/sync/connection-lookup.d.ts +19 -0
- package/dist/sync/connection-lookup.js +56 -0
- package/dist/sync/connection-lookup.js.map +1 -0
- package/dist/sync/control-plane-client.d.ts +69 -0
- package/dist/sync/control-plane-client.js +182 -0
- package/dist/sync/control-plane-client.js.map +1 -0
- package/dist/sync/deployment-selector.d.ts +9 -0
- package/dist/sync/deployment-selector.js +26 -0
- package/dist/sync/deployment-selector.js.map +1 -0
- package/dist/sync/fetch-sse-push.d.ts +6 -0
- package/dist/sync/fetch-sse-push.js +42 -0
- package/dist/sync/fetch-sse-push.js.map +1 -0
- package/dist/sync/index.d.ts +26 -0
- package/dist/sync/index.js +17 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/jwks-provider.d.ts +14 -0
- package/dist/sync/jwks-provider.js +53 -0
- package/dist/sync/jwks-provider.js.map +1 -0
- package/dist/sync/local-deployment-validator.d.ts +30 -0
- package/dist/sync/local-deployment-validator.js +60 -0
- package/dist/sync/local-deployment-validator.js.map +1 -0
- package/dist/sync/managed-sync.d.ts +40 -0
- package/dist/sync/managed-sync.js +94 -0
- package/dist/sync/managed-sync.js.map +1 -0
- package/dist/sync/materialize-deployment.d.ts +7 -0
- package/dist/sync/materialize-deployment.js +63 -0
- package/dist/sync/materialize-deployment.js.map +1 -0
- package/dist/sync/runtime-connect-client.d.ts +23 -0
- package/dist/sync/runtime-connect-client.js +182 -0
- package/dist/sync/runtime-connect-client.js.map +1 -0
- package/dist/sync/runtime-setup-client.d.ts +62 -0
- package/dist/sync/runtime-setup-client.js +153 -0
- package/dist/sync/runtime-setup-client.js.map +1 -0
- package/dist/sync/signature-verifier.d.ts +39 -0
- package/dist/sync/signature-verifier.js +97 -0
- package/dist/sync/signature-verifier.js.map +1 -0
- package/dist/sync/state-store.d.ts +24 -0
- package/dist/sync/state-store.js +47 -0
- package/dist/sync/state-store.js.map +1 -0
- package/dist/sync/sync-manager.d.ts +27 -0
- package/dist/sync/sync-manager.js +170 -0
- package/dist/sync/sync-manager.js.map +1 -0
- package/dist/types.d.ts +68 -16
- package/dist/types.js +30 -2
- package/dist/types.js.map +1 -1
- package/embed/package.json +5 -0
- package/package.json +187 -46
- package/runtime/ai-sdk/package.json +5 -0
- package/runtime/package.json +5 -0
- package/skills/README.md +26 -92
- package/skills/building-glirastes-chat-ui/SKILL.md +358 -343
- package/skills/describing-glirastes-tools/SKILL.md +180 -0
- package/skills/integrating-glirastes-nextjs/SKILL.md +142 -302
- package/skills/integrating-glirastes-web/SKILL.md +165 -0
- package/skills/maintaining-glirastes-tools/SKILL.md +133 -461
- package/skills/migrating-to-glirastes/SKILL.md +112 -0
- package/skills/setting-up-glirastes/SKILL.md +194 -0
- package/skills/setting-up-glirastes/agents/openai.yaml +4 -0
- package/skills/setting-up-glirastes/references/artifact-contract.md +40 -0
- package/skills/setting-up-glirastes/scripts/validate-artifact.ts +23 -0
- package/skills/setting-up-glirastes/templates/interview.md +19 -0
- package/stt/package.json +5 -0
- package/dist/cjs/codegen/asset-sync.d.ts +0 -20
- package/dist/cjs/codegen/asset-sync.js +0 -28
- package/dist/cjs/codegen/coverage.d.ts +0 -66
- package/dist/cjs/codegen/coverage.js +0 -408
- package/dist/cjs/codegen/endpoint-scanner.d.ts +0 -16
- package/dist/cjs/codegen/endpoint-scanner.js +0 -197
- package/dist/cjs/codegen/mcp-generator.d.ts +0 -50
- package/dist/cjs/codegen/mcp-generator.js +0 -803
- package/dist/cjs/codegen/module-generator.d.ts +0 -11
- package/dist/cjs/codegen/module-generator.js +0 -353
- package/dist/cjs/codegen/nestjs-scanner.d.ts +0 -43
- package/dist/cjs/codegen/nestjs-scanner.js +0 -241
- package/dist/cjs/codegen/output-recommender.d.ts +0 -23
- package/dist/cjs/codegen/output-recommender.js +0 -33
- package/dist/cjs/codegen/scaffolder.d.ts +0 -36
- package/dist/cjs/codegen/scaffolder.js +0 -262
- package/dist/cjs/codegen/skill-generator.d.ts +0 -49
- package/dist/cjs/codegen/skill-generator.js +0 -967
- package/dist/cjs/codegen/ui-scanner.d.ts +0 -24
- package/dist/cjs/codegen/ui-scanner.js +0 -202
- package/dist/cjs/codegen/validator.d.ts +0 -35
- package/dist/cjs/codegen/validator.js +0 -292
- package/dist/cjs/openapi/index.d.ts +0 -78
- package/dist/cjs/openapi/index.js +0 -347
- package/dist/cjs/react/components/wavesurfer-loader.d.ts +0 -5
- package/dist/cjs/react/components/wavesurfer-loader.js +0 -36
- package/dist/cjs/react/transports/langgraph/index.d.ts +0 -2
- package/dist/cjs/react/transports/langgraph/index.js +0 -8
- package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.d.ts +0 -62
- package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.js +0 -94
- package/dist/cjs/react/transports/langgraph.d.ts +0 -71
- package/dist/cjs/react/transports/langgraph.js +0 -369
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.d.ts +0 -10
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.js +0 -42
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.d.ts +0 -32
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.js +0 -4
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.d.ts +0 -11
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.js +0 -80
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.d.ts +0 -9
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.js +0 -119
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.d.ts +0 -13
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.js +0 -131
- package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.d.ts +0 -7
- package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js +0 -52
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.d.ts +0 -19
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.js +0 -108
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.d.ts +0 -8
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.js +0 -59
- package/dist/cjs/server/adapters/nestjs/chat/dto/index.d.ts +0 -3
- package/dist/cjs/server/adapters/nestjs/chat/dto/index.js +0 -9
- package/dist/cjs/server/adapters/nestjs/chat/index.d.ts +0 -3
- package/dist/cjs/server/adapters/nestjs/chat/index.js +0 -9
- package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +0 -4
- package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.js +0 -73
- package/dist/cjs/server/adapters/nestjs/chat/ws-loader.d.ts +0 -5
- package/dist/cjs/server/adapters/nestjs/chat/ws-loader.js +0 -72
- package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.d.ts +0 -6
- package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.js +0 -13
- package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.d.ts +0 -5
- package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.js +0 -15
- package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.d.ts +0 -6
- package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.js +0 -22
- package/dist/cjs/server/adapters/nestjs/decorators/constants.d.ts +0 -4
- package/dist/cjs/server/adapters/nestjs/decorators/constants.js +0 -7
- package/dist/cjs/server/adapters/nestjs/index.d.ts +0 -14
- package/dist/cjs/server/adapters/nestjs/index.js +0 -42
- package/dist/cjs/server/adapters/nestjs/metadata.d.ts +0 -39
- package/dist/cjs/server/adapters/nestjs/metadata.js +0 -36
- package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.d.ts +0 -36
- package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.js +0 -159
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.d.ts +0 -37
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.js +0 -44
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.d.ts +0 -28
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.js +0 -41
- package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.d.ts +0 -16
- package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.js +0 -117
- package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.d.ts +0 -26
- package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.js +0 -259
- package/dist/cjs/server/adapters/nestjs/swagger.d.ts +0 -7
- package/dist/cjs/server/adapters/nestjs/swagger.js +0 -39
- package/dist/cli/commands/check-upgrade.d.ts +0 -15
- package/dist/cli/commands/check-upgrade.js +0 -138
- package/dist/cli/commands/check-upgrade.js.map +0 -1
- package/dist/cli/commands/test.d.ts +0 -8
- package/dist/cli/commands/test.js +0 -76
- package/dist/cli/commands/test.js.map +0 -1
- package/dist/cli/utils/changelog-parser.d.ts +0 -13
- package/dist/cli/utils/changelog-parser.js +0 -89
- package/dist/cli/utils/changelog-parser.js.map +0 -1
- package/dist/cli/utils/commit-parser.d.ts +0 -8
- package/dist/cli/utils/commit-parser.js +0 -23
- package/dist/cli/utils/commit-parser.js.map +0 -1
- package/dist/cli/utils/gap-detector.d.ts +0 -14
- package/dist/cli/utils/gap-detector.js +0 -65
- package/dist/cli/utils/gap-detector.js.map +0 -1
- package/dist/cli/utils/get-cli-version.d.ts +0 -2
- package/dist/cli/utils/get-cli-version.js +0 -10
- package/dist/cli/utils/get-cli-version.js.map +0 -1
- package/dist/codegen/asset-sync.d.ts +0 -20
- package/dist/codegen/asset-sync.js +0 -26
- package/dist/codegen/asset-sync.js.map +0 -1
- package/dist/codegen/coverage.d.ts +0 -66
- package/dist/codegen/coverage.js +0 -372
- package/dist/codegen/coverage.js.map +0 -1
- package/dist/codegen/endpoint-scanner.d.ts +0 -16
- package/dist/codegen/endpoint-scanner.js +0 -161
- package/dist/codegen/endpoint-scanner.js.map +0 -1
- package/dist/codegen/mcp-generator.d.ts +0 -50
- package/dist/codegen/mcp-generator.js +0 -801
- package/dist/codegen/mcp-generator.js.map +0 -1
- package/dist/codegen/module-generator.d.ts +0 -11
- package/dist/codegen/module-generator.js +0 -351
- package/dist/codegen/module-generator.js.map +0 -1
- package/dist/codegen/nestjs-scanner.d.ts +0 -43
- package/dist/codegen/nestjs-scanner.js +0 -239
- package/dist/codegen/nestjs-scanner.js.map +0 -1
- package/dist/codegen/output-recommender.d.ts +0 -23
- package/dist/codegen/output-recommender.js +0 -31
- package/dist/codegen/output-recommender.js.map +0 -1
- package/dist/codegen/scaffolder.d.ts +0 -36
- package/dist/codegen/scaffolder.js +0 -259
- package/dist/codegen/scaffolder.js.map +0 -1
- package/dist/codegen/skill-generator.d.ts +0 -49
- package/dist/codegen/skill-generator.js +0 -965
- package/dist/codegen/skill-generator.js.map +0 -1
- package/dist/codegen/ui-scanner.d.ts +0 -24
- package/dist/codegen/ui-scanner.js +0 -197
- package/dist/codegen/ui-scanner.js.map +0 -1
- package/dist/codegen/validator.d.ts +0 -35
- package/dist/codegen/validator.js +0 -256
- package/dist/codegen/validator.js.map +0 -1
- package/dist/openapi/demo-generate.d.ts +0 -1
- package/dist/openapi/demo-generate.js +0 -15
- package/dist/openapi/demo-generate.js.map +0 -1
- package/dist/openapi/index.d.ts +0 -78
- package/dist/openapi/index.js +0 -341
- package/dist/openapi/index.js.map +0 -1
- package/dist/react/components/wavesurfer-loader.d.ts +0 -5
- package/dist/react/components/wavesurfer-loader.js +0 -34
- package/dist/react/components/wavesurfer-loader.js.map +0 -1
- package/dist/react/transports/langgraph/index.d.ts +0 -2
- package/dist/react/transports/langgraph/index.js +0 -3
- package/dist/react/transports/langgraph/index.js.map +0 -1
- package/dist/react/transports/langgraph/langgraph-ai-chat.d.ts +0 -62
- package/dist/react/transports/langgraph/langgraph-ai-chat.js +0 -92
- package/dist/react/transports/langgraph/langgraph-ai-chat.js.map +0 -1
- package/dist/react/transports/langgraph.d.ts +0 -71
- package/dist/react/transports/langgraph.js +0 -366
- package/dist/react/transports/langgraph.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/ai-chat-auth.guard.d.ts +0 -10
- package/dist/server/adapters/nestjs/chat/ai-chat-auth.guard.js +0 -40
- package/dist/server/adapters/nestjs/chat/ai-chat-auth.guard.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/ai-chat-module-options.interface.d.ts +0 -32
- package/dist/server/adapters/nestjs/chat/ai-chat-module-options.interface.js +0 -2
- package/dist/server/adapters/nestjs/chat/ai-chat-module-options.interface.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/ai-chat.controller.d.ts +0 -11
- package/dist/server/adapters/nestjs/chat/ai-chat.controller.js +0 -78
- package/dist/server/adapters/nestjs/chat/ai-chat.controller.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/ai-chat.module.d.ts +0 -9
- package/dist/server/adapters/nestjs/chat/ai-chat.module.js +0 -117
- package/dist/server/adapters/nestjs/chat/ai-chat.module.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/ai-chat.service.d.ts +0 -13
- package/dist/server/adapters/nestjs/chat/ai-chat.service.js +0 -129
- package/dist/server/adapters/nestjs/chat/ai-chat.service.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/dto/ai-chat-request.dto.d.ts +0 -7
- package/dist/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js +0 -49
- package/dist/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/dto/chat-message-part.dto.d.ts +0 -19
- package/dist/server/adapters/nestjs/chat/dto/chat-message-part.dto.js +0 -105
- package/dist/server/adapters/nestjs/chat/dto/chat-message-part.dto.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/dto/chat-message.dto.d.ts +0 -8
- package/dist/server/adapters/nestjs/chat/dto/chat-message.dto.js +0 -56
- package/dist/server/adapters/nestjs/chat/dto/chat-message.dto.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/dto/index.d.ts +0 -3
- package/dist/server/adapters/nestjs/chat/dto/index.js +0 -4
- package/dist/server/adapters/nestjs/chat/dto/index.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/index.d.ts +0 -3
- package/dist/server/adapters/nestjs/chat/index.js +0 -3
- package/dist/server/adapters/nestjs/chat/index.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +0 -4
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js +0 -71
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js.map +0 -1
- package/dist/server/adapters/nestjs/chat/ws-loader.d.ts +0 -5
- package/dist/server/adapters/nestjs/chat/ws-loader.js +0 -37
- package/dist/server/adapters/nestjs/chat/ws-loader.js.map +0 -1
- package/dist/server/adapters/nestjs/decorators/ai-module.decorator.d.ts +0 -6
- package/dist/server/adapters/nestjs/decorators/ai-module.decorator.js +0 -11
- package/dist/server/adapters/nestjs/decorators/ai-module.decorator.js.map +0 -1
- package/dist/server/adapters/nestjs/decorators/ai-param.decorator.d.ts +0 -5
- package/dist/server/adapters/nestjs/decorators/ai-param.decorator.js +0 -13
- package/dist/server/adapters/nestjs/decorators/ai-param.decorator.js.map +0 -1
- package/dist/server/adapters/nestjs/decorators/ai-tool.decorator.d.ts +0 -6
- package/dist/server/adapters/nestjs/decorators/ai-tool.decorator.js +0 -20
- package/dist/server/adapters/nestjs/decorators/ai-tool.decorator.js.map +0 -1
- package/dist/server/adapters/nestjs/decorators/constants.d.ts +0 -4
- package/dist/server/adapters/nestjs/decorators/constants.js +0 -5
- package/dist/server/adapters/nestjs/decorators/constants.js.map +0 -1
- package/dist/server/adapters/nestjs/index.d.ts +0 -14
- package/dist/server/adapters/nestjs/index.js +0 -20
- package/dist/server/adapters/nestjs/index.js.map +0 -1
- package/dist/server/adapters/nestjs/metadata.d.ts +0 -39
- package/dist/server/adapters/nestjs/metadata.js +0 -30
- package/dist/server/adapters/nestjs/metadata.js.map +0 -1
- package/dist/server/adapters/nestjs/module/ai-tools-explorer.service.d.ts +0 -36
- package/dist/server/adapters/nestjs/module/ai-tools-explorer.service.js +0 -156
- package/dist/server/adapters/nestjs/module/ai-tools-explorer.service.js.map +0 -1
- package/dist/server/adapters/nestjs/module/ai-tools.module.d.ts +0 -37
- package/dist/server/adapters/nestjs/module/ai-tools.module.js +0 -42
- package/dist/server/adapters/nestjs/module/ai-tools.module.js.map +0 -1
- package/dist/server/adapters/nestjs/module/ai-tools.service.d.ts +0 -28
- package/dist/server/adapters/nestjs/module/ai-tools.service.js +0 -38
- package/dist/server/adapters/nestjs/module/ai-tools.service.js.map +0 -1
- package/dist/server/adapters/nestjs/scanner/nestjs-scanner.d.ts +0 -16
- package/dist/server/adapters/nestjs/scanner/nestjs-scanner.js +0 -115
- package/dist/server/adapters/nestjs/scanner/nestjs-scanner.js.map +0 -1
- package/dist/server/adapters/nestjs/scanner/schema-builder.d.ts +0 -26
- package/dist/server/adapters/nestjs/scanner/schema-builder.js +0 -255
- package/dist/server/adapters/nestjs/scanner/schema-builder.js.map +0 -1
- package/dist/server/adapters/nestjs/swagger.d.ts +0 -7
- package/dist/server/adapters/nestjs/swagger.js +0 -37
- package/dist/server/adapters/nestjs/swagger.js.map +0 -1
- package/openapi/package.json +0 -5
- package/react/langgraph/package.json +0 -5
- package/server/nestjs/package.json +0 -5
- package/skills/integrating-glirastes-nestjs/SKILL.md +0 -346
- package/skills/integrating-glirastes-nextjs-with-nestjs-backend/SKILL.md +0 -359
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApprovalExecutionRefusedError = exports.ApprovalHistoryError = exports.ApprovalSecretMissingError = exports.MAX_RUNNABLE_APPROVALS_PER_REQUEST = exports.DEFAULT_MEMORY_APPROVAL_STORE_ENTRIES_PER_SCOPE = exports.DEFAULT_MEMORY_APPROVAL_STORE_ENTRIES = exports.APPROVAL_SECRET_ENV = exports.MAX_APPROVAL_MAX_AGE_MS = exports.DEFAULT_APPROVAL_MAX_AGE_MS = void 0;
|
|
4
|
+
exports.assertApprovalMaxAge = assertApprovalMaxAge;
|
|
5
|
+
exports.createMemoryApprovalStore = createMemoryApprovalStore;
|
|
6
|
+
exports.defaultApprovalStore = defaultApprovalStore;
|
|
7
|
+
exports.canonicalJson = canonicalJson;
|
|
8
|
+
exports.approvalScope = approvalScope;
|
|
9
|
+
exports.createApprovalBinder = createApprovalBinder;
|
|
10
|
+
exports.resolveApprovalBinder = resolveApprovalBinder;
|
|
11
|
+
exports.bindApprovalRequests = bindApprovalRequests;
|
|
12
|
+
exports.assertUnambiguousToolHistory = assertUnambiguousToolHistory;
|
|
13
|
+
exports.enforceApprovalBindings = enforceApprovalBindings;
|
|
14
|
+
exports.createApprovalExecutionGate = createApprovalExecutionGate;
|
|
15
|
+
exports.gateApprovalTools = gateApprovalTools;
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
17
|
+
const engine_js_1 = require("../../../runtime/ai-sdk/engine.js");
|
|
18
|
+
/**
|
|
19
|
+
* Approvals the server asked for, bound to the call they were asked for.
|
|
20
|
+
*
|
|
21
|
+
* When a tool call needs the user's approval, the AI SDK ends the turn with an
|
|
22
|
+
* approval request. The browser sends the whole history back with the answer,
|
|
23
|
+
* and the SDK then runs the approved call with the tool name and input *from
|
|
24
|
+
* that history*, which the client wrote. Without a binding, a forged history
|
|
25
|
+
* runs any tool with any input, and an old approved history runs it again.
|
|
26
|
+
*
|
|
27
|
+
* The binding is the approval id itself. The AI SDK sends the id to the
|
|
28
|
+
* client, keeps it through `addToolApprovalResponse`, returns it in the
|
|
29
|
+
* history and passes it on through `convertToModelMessages`; no other field of
|
|
30
|
+
* an approval request survives that round trip (the stream chunk has only
|
|
31
|
+
* `approvalId` and `toolCallId`). The id has the form
|
|
32
|
+
*
|
|
33
|
+
* glirastes-approval.v1.<issuedAtMs>.<expiresAtMs>.<nonce>.<mac>
|
|
34
|
+
*
|
|
35
|
+
* where `mac` is an HMAC-SHA-256, keyed with a server secret, over the issue
|
|
36
|
+
* time, the expiry, the nonce, the scope, the tool call id, the tool name and
|
|
37
|
+
* the canonical JSON of the input. The expiry is the issuing handler's
|
|
38
|
+
* decision and is signed, so a handler with a longer `approvalMaxAgeMs` that
|
|
39
|
+
* shares the secret cannot accept what the issuer would refuse; the verifier
|
|
40
|
+
* applies its own maximum age on top. (The format gained the expiry before
|
|
41
|
+
* 0.5.0 was published, which is why it is still `v1`.)
|
|
42
|
+
*/
|
|
43
|
+
exports.DEFAULT_APPROVAL_MAX_AGE_MS = 15 * 60_000;
|
|
44
|
+
/** The longest `approvalMaxAgeMs` accepted: 24 hours. */
|
|
45
|
+
exports.MAX_APPROVAL_MAX_AGE_MS = 24 * 60 * 60_000;
|
|
46
|
+
/**
|
|
47
|
+
* Throws unless `value` is a usable maximum approval age: a whole number of milliseconds above 0
|
|
48
|
+
* and at most 24 hours. A fractional age would sign an expiry the id format cannot carry.
|
|
49
|
+
*/
|
|
50
|
+
function assertApprovalMaxAge(value) {
|
|
51
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0 || value > exports.MAX_APPROVAL_MAX_AGE_MS) {
|
|
52
|
+
throw new RangeError(`approvalMaxAgeMs must be a whole number above 0 and at most ${exports.MAX_APPROVAL_MAX_AGE_MS} (24 hours)`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.APPROVAL_SECRET_ENV = 'GLIRASTES_APPROVAL_SECRET';
|
|
56
|
+
const ID_PREFIX = 'glirastes-approval.v1.';
|
|
57
|
+
const MIN_SECRET_LENGTH = 16;
|
|
58
|
+
/** Clock differences between processes sharing a secret. */
|
|
59
|
+
const CLOCK_SKEW_MS = 60_000;
|
|
60
|
+
/**
|
|
61
|
+
* Default size of the in-process single-use store (a few MB at most). With
|
|
62
|
+
* the per-scope default, at least 100 scopes must use up their quota before
|
|
63
|
+
* the store is full for everyone.
|
|
64
|
+
*/
|
|
65
|
+
exports.DEFAULT_MEMORY_APPROVAL_STORE_ENTRIES = 20_000;
|
|
66
|
+
/** Default share of the in-process store one scope may hold. */
|
|
67
|
+
exports.DEFAULT_MEMORY_APPROVAL_STORE_ENTRIES_PER_SCOPE = 200;
|
|
68
|
+
/** Approved calls that can run in one request; more is refused (`too_many_approvals`). */
|
|
69
|
+
exports.MAX_RUNNABLE_APPROVALS_PER_REQUEST = 32;
|
|
70
|
+
/**
|
|
71
|
+
* A single-use store in this process's memory. Each id is kept until its
|
|
72
|
+
* approval has expired (plus the allowed clock skew), after which it can no
|
|
73
|
+
* longer verify anyway. The store is bounded: when it holds `maxEntries` live
|
|
74
|
+
* ids, or the approval's scope holds `maxEntriesPerScope`, `consume` throws,
|
|
75
|
+
* which the handler reports as `approval_store_unavailable`, rather than
|
|
76
|
+
* forgetting a live id and letting it run again. The per-scope quota keeps
|
|
77
|
+
* one scope from filling the store for everyone else. The scope is the one
|
|
78
|
+
* `ApprovalStore` describes: the managed tenant and subject, else
|
|
79
|
+
* `approvalScope`, else a key derived from the request's credentials
|
|
80
|
+
* (`caller:<hmac>`), else `''`, which all requests without credentials share.
|
|
81
|
+
* A caller who varies their credentials gets a fresh quota per value; the
|
|
82
|
+
* global `maxEntries` still bounds them, and only consumed genuine approvals
|
|
83
|
+
* create entries.
|
|
84
|
+
*
|
|
85
|
+
* It protects one process only. Instances behind a load balancer each have
|
|
86
|
+
* their own memory, so an approved history replayed to another instance runs
|
|
87
|
+
* there again unless they share an `approvalStore`.
|
|
88
|
+
*/
|
|
89
|
+
function createMemoryApprovalStore(options = {}) {
|
|
90
|
+
const maxEntries = options.maxEntries ?? exports.DEFAULT_MEMORY_APPROVAL_STORE_ENTRIES;
|
|
91
|
+
const maxEntriesPerScope = options.maxEntriesPerScope ?? exports.DEFAULT_MEMORY_APPROVAL_STORE_ENTRIES_PER_SCOPE;
|
|
92
|
+
const now = options.now ?? Date.now;
|
|
93
|
+
const entries = new Map();
|
|
94
|
+
const perScope = new Map();
|
|
95
|
+
const remove = (id, scope) => {
|
|
96
|
+
entries.delete(id);
|
|
97
|
+
const left = (perScope.get(scope) ?? 1) - 1;
|
|
98
|
+
if (left > 0)
|
|
99
|
+
perScope.set(scope, left);
|
|
100
|
+
else
|
|
101
|
+
perScope.delete(scope);
|
|
102
|
+
};
|
|
103
|
+
const purge = (at) => {
|
|
104
|
+
for (const [id, entry] of entries)
|
|
105
|
+
if (entry.keepUntil <= at)
|
|
106
|
+
remove(id, entry.scope);
|
|
107
|
+
};
|
|
108
|
+
const full = (scope) => entries.size >= maxEntries || (perScope.get(scope) ?? 0) >= maxEntriesPerScope;
|
|
109
|
+
return {
|
|
110
|
+
consume: (approvalId, expiresAtMs, context) => {
|
|
111
|
+
const at = now();
|
|
112
|
+
const scope = context?.scope ?? '';
|
|
113
|
+
const existing = entries.get(approvalId);
|
|
114
|
+
if (existing && existing.keepUntil > at)
|
|
115
|
+
return false;
|
|
116
|
+
if (existing)
|
|
117
|
+
remove(approvalId, existing.scope);
|
|
118
|
+
if (full(scope))
|
|
119
|
+
purge(at);
|
|
120
|
+
if (entries.size >= maxEntries)
|
|
121
|
+
throw new Error('The in-process approval store is full');
|
|
122
|
+
if ((perScope.get(scope) ?? 0) >= maxEntriesPerScope) {
|
|
123
|
+
throw new Error('The in-process approval store quota of this scope is used up');
|
|
124
|
+
}
|
|
125
|
+
entries.set(approvalId, { keepUntil: expiresAtMs + CLOCK_SKEW_MS, scope });
|
|
126
|
+
perScope.set(scope, (perScope.get(scope) ?? 0) + 1);
|
|
127
|
+
return true;
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
let processApprovalStore;
|
|
132
|
+
/** The in-process store every handler of this process shares when none is configured. */
|
|
133
|
+
function defaultApprovalStore() {
|
|
134
|
+
processApprovalStore ??= createMemoryApprovalStore();
|
|
135
|
+
return processApprovalStore;
|
|
136
|
+
}
|
|
137
|
+
class ApprovalSecretMissingError extends Error {
|
|
138
|
+
code = 'approval_secret_missing';
|
|
139
|
+
constructor() {
|
|
140
|
+
super(`Tools that ask for approval are registered, but no approval secret is configured. `
|
|
141
|
+
+ `Set ${exports.APPROVAL_SECRET_ENV} (at least ${MIN_SECRET_LENGTH} characters, the same on every instance) `
|
|
142
|
+
+ `or pass approvalSecret to createAiChatHandler. Approvals are refused in production without it.`);
|
|
143
|
+
this.name = 'ApprovalSecretMissingError';
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ApprovalSecretMissingError = ApprovalSecretMissingError;
|
|
147
|
+
const NONCE_BYTES = 16;
|
|
148
|
+
const MAC_BYTES = 32;
|
|
149
|
+
/** A decimal without sign or leading zeros, as `String(Date.now())` writes it. */
|
|
150
|
+
const CANONICAL_TIME = /^(?:0|[1-9]\d{0,15})$/;
|
|
151
|
+
function isCanonicalBase64Url(text, bytes) {
|
|
152
|
+
if (!/^[A-Za-z0-9_-]+$/.test(text))
|
|
153
|
+
return false;
|
|
154
|
+
const decoded = Buffer.from(text, 'base64url');
|
|
155
|
+
return decoded.length === bytes && decoded.toString('base64url') === text;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* JSON with sorted keys, so an input hashes the same after any JSON round
|
|
159
|
+
* trip. A non-finite number (`JSON.parse` turns `1e999` into `Infinity`)
|
|
160
|
+
* throws a RangeError: `JSON.stringify` would write it as `null`, so an
|
|
161
|
+
* approval for `null` would also hold for it.
|
|
162
|
+
*/
|
|
163
|
+
function canonicalJson(value) {
|
|
164
|
+
return JSON.stringify(sortKeys(value)) ?? 'null';
|
|
165
|
+
}
|
|
166
|
+
function sortKeys(value) {
|
|
167
|
+
if (typeof value === 'number' && !Number.isFinite(value)) {
|
|
168
|
+
throw new RangeError('An approval input must contain only finite numbers');
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(value))
|
|
171
|
+
return value.map((item) => sortKeys(item === undefined ? null : item));
|
|
172
|
+
if (typeof value !== 'object' || value === null)
|
|
173
|
+
return value;
|
|
174
|
+
// No prototype: an own `__proto__` key (JSON.parse creates one) must stay a
|
|
175
|
+
// key. On a plain object the assignment would set the prototype and the key
|
|
176
|
+
// would drop out of the JSON, so two different inputs would share a MAC.
|
|
177
|
+
const sorted = Object.create(null);
|
|
178
|
+
for (const key of Object.keys(value).sort()) {
|
|
179
|
+
const entry = value[key];
|
|
180
|
+
if (entry !== undefined)
|
|
181
|
+
sorted[key] = sortKeys(entry);
|
|
182
|
+
}
|
|
183
|
+
return sorted;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The binder scope of a principal. Tenant and subject are encoded as a JSON
|
|
187
|
+
* array, so ids that contain a separator cannot make two principals share a
|
|
188
|
+
* scope (`acme:ops` + `alice` and `acme` + `ops:alice`).
|
|
189
|
+
*/
|
|
190
|
+
function approvalScope(principal) {
|
|
191
|
+
return principal ? JSON.stringify([principal.tenantId, principal.subjectId]) : '';
|
|
192
|
+
}
|
|
193
|
+
function createApprovalBinder(options) {
|
|
194
|
+
if (typeof options.secret !== 'string' || options.secret.length < MIN_SECRET_LENGTH) {
|
|
195
|
+
throw new Error(`The approval secret must be a string of at least ${MIN_SECRET_LENGTH} characters`);
|
|
196
|
+
}
|
|
197
|
+
const maxAgeMs = options.maxAgeMs ?? exports.DEFAULT_APPROVAL_MAX_AGE_MS;
|
|
198
|
+
assertApprovalMaxAge(maxAgeMs);
|
|
199
|
+
const now = options.now ?? Date.now;
|
|
200
|
+
const scope = options.scope ?? '';
|
|
201
|
+
const mac = (issuedAt, expiresAt, nonce, call) => (0, node_crypto_1.createHmac)('sha256', options.secret)
|
|
202
|
+
.update(JSON.stringify(['v1', issuedAt, expiresAt, nonce, scope, call.toolCallId, call.toolName, canonicalJson(call.input)]))
|
|
203
|
+
.digest();
|
|
204
|
+
return {
|
|
205
|
+
maxAgeMs,
|
|
206
|
+
callerQuotaKey: (credentials) => `caller:${(0, node_crypto_1.createHmac)('sha256', options.secret)
|
|
207
|
+
.update('glirastes-approval-quota-key\0')
|
|
208
|
+
.update(credentials)
|
|
209
|
+
.digest('base64url')}`,
|
|
210
|
+
issue: (call) => {
|
|
211
|
+
const issued = now();
|
|
212
|
+
const issuedAt = String(issued);
|
|
213
|
+
const expiresAt = String(issued + maxAgeMs);
|
|
214
|
+
const nonce = (0, node_crypto_1.randomBytes)(NONCE_BYTES).toString('base64url');
|
|
215
|
+
return `${ID_PREFIX}${issuedAt}.${expiresAt}.${nonce}.${mac(issuedAt, expiresAt, nonce, call).toString('base64url')}`;
|
|
216
|
+
},
|
|
217
|
+
verify: (call) => {
|
|
218
|
+
const notIssued = { ok: false, code: 'approval_not_issued' };
|
|
219
|
+
if (typeof call.approvalId !== 'string' || !call.approvalId.startsWith(ID_PREFIX))
|
|
220
|
+
return notIssued;
|
|
221
|
+
const [issuedAt, expiresAt, nonce, presented, ...rest] = call.approvalId.slice(ID_PREFIX.length).split('.');
|
|
222
|
+
// Every segment must be spelled exactly as `issue` spells it: Node's
|
|
223
|
+
// base64url decoder accepts padding, stray characters and changed low
|
|
224
|
+
// bits, which would give one approval many ids.
|
|
225
|
+
if (!issuedAt || !expiresAt || !nonce || !presented || rest.length > 0)
|
|
226
|
+
return notIssued;
|
|
227
|
+
if (!CANONICAL_TIME.test(issuedAt) || !CANONICAL_TIME.test(expiresAt))
|
|
228
|
+
return notIssued;
|
|
229
|
+
if (!isCanonicalBase64Url(nonce, NONCE_BYTES) || !isCanonicalBase64Url(presented, MAC_BYTES))
|
|
230
|
+
return notIssued;
|
|
231
|
+
let expected;
|
|
232
|
+
try {
|
|
233
|
+
expected = mac(issuedAt, expiresAt, nonce, call);
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
return notIssued;
|
|
237
|
+
}
|
|
238
|
+
const actual = Buffer.from(presented, 'base64url');
|
|
239
|
+
if (actual.length !== expected.length || !(0, node_crypto_1.timingSafeEqual)(actual, expected))
|
|
240
|
+
return notIssued;
|
|
241
|
+
const at = now();
|
|
242
|
+
if (at - Number(issuedAt) < -CLOCK_SKEW_MS)
|
|
243
|
+
return notIssued;
|
|
244
|
+
// The issuer's signed expiry, and this handler's own maximum age.
|
|
245
|
+
if (at > Math.min(Number(expiresAt), Number(issuedAt) + maxAgeMs))
|
|
246
|
+
return { ok: false, code: 'approval_expired' };
|
|
247
|
+
return {
|
|
248
|
+
ok: true,
|
|
249
|
+
expiresAtMs: Number(expiresAt),
|
|
250
|
+
key: `${ID_PREFIX}${issuedAt}.${expiresAt}.${nonce}.${expected.toString('base64url')}`,
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
let processSecret;
|
|
256
|
+
let warnedAboutProcessSecret = false;
|
|
257
|
+
/**
|
|
258
|
+
* The binder of a request. The secret is the configured one, else
|
|
259
|
+
* `GLIRASTES_APPROVAL_SECRET`. Without one, and when approvals can occur, a
|
|
260
|
+
* production process refuses to serve them (`ApprovalSecretMissingError`);
|
|
261
|
+
* any other process derives a random secret that lives as long as the process
|
|
262
|
+
* and warns once. Approvals then do not survive a restart or reach another
|
|
263
|
+
* instance, which is why they are refused in production.
|
|
264
|
+
*/
|
|
265
|
+
function resolveApprovalBinder(options) {
|
|
266
|
+
const env = options.env ?? (typeof process !== 'undefined' ? process.env : {});
|
|
267
|
+
const configured = options.secret || env[exports.APPROVAL_SECRET_ENV] || undefined;
|
|
268
|
+
const common = { scope: options.scope, maxAgeMs: options.maxAgeMs, now: options.now };
|
|
269
|
+
if (configured)
|
|
270
|
+
return createApprovalBinder({ secret: configured, ...common });
|
|
271
|
+
if (options.hasApprovalTools && env.NODE_ENV === 'production')
|
|
272
|
+
throw new ApprovalSecretMissingError();
|
|
273
|
+
if (options.hasApprovalTools && !warnedAboutProcessSecret) {
|
|
274
|
+
warnedAboutProcessSecret = true;
|
|
275
|
+
(options.warn ?? ((message) => console.warn(message)))(`[glirastes] No ${exports.APPROVAL_SECRET_ENV} is set. Approvals are signed with a random secret that lives as long as `
|
|
276
|
+
+ `this process, so they do not survive a restart and do not work across instances. `
|
|
277
|
+
+ `Production refuses to serve approvals without the secret.`);
|
|
278
|
+
}
|
|
279
|
+
processSecret ??= (0, node_crypto_1.randomBytes)(32).toString('base64url');
|
|
280
|
+
return createApprovalBinder({ secret: processSecret, ...common });
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Gives every approval request of a UI message stream an id bound to the
|
|
284
|
+
* call it announced (tool name and input come from the preceding
|
|
285
|
+
* `tool-input-available` chunk, which is also what the client stores).
|
|
286
|
+
*/
|
|
287
|
+
function bindApprovalRequests(stream, binder) {
|
|
288
|
+
const calls = new Map();
|
|
289
|
+
return stream.pipeThrough(new TransformStream({
|
|
290
|
+
transform(chunk, controller) {
|
|
291
|
+
const record = chunk;
|
|
292
|
+
if (record.type === 'tool-input-available' && typeof record.toolCallId === 'string') {
|
|
293
|
+
calls.set(record.toolCallId, { toolName: String(record.toolName), input: record.input });
|
|
294
|
+
}
|
|
295
|
+
if (record.type === 'tool-approval-request' && typeof record.toolCallId === 'string') {
|
|
296
|
+
const announced = calls.get(record.toolCallId);
|
|
297
|
+
if (announced) {
|
|
298
|
+
let approvalId;
|
|
299
|
+
try {
|
|
300
|
+
approvalId = binder.issue({ toolCallId: record.toolCallId, ...announced });
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
// An input that cannot be hashed (a non-finite number) gets no
|
|
304
|
+
// bound id; the AI SDK's own id never verifies, so the approval
|
|
305
|
+
// can be answered but never runs.
|
|
306
|
+
}
|
|
307
|
+
if (approvalId) {
|
|
308
|
+
controller.enqueue({ ...chunk, approvalId });
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
controller.enqueue(chunk);
|
|
314
|
+
},
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
318
|
+
const RESULT_STATES = new Set(['output-available', 'output-error', 'output-denied']);
|
|
319
|
+
/** A UI tool part as the AI SDK recognizes one (`isToolUIPart`). */
|
|
320
|
+
function isToolPart(part) {
|
|
321
|
+
return typeof part.type === 'string' && (part.type.startsWith('tool-') || part.type === 'dynamic-tool');
|
|
322
|
+
}
|
|
323
|
+
function toolNameOf(part) {
|
|
324
|
+
if (part.type === 'dynamic-tool')
|
|
325
|
+
return typeof part.toolName === 'string' && part.toolName ? part.toolName : undefined;
|
|
326
|
+
return typeof part.type === 'string' && part.type.startsWith('tool-') ? part.type.slice('tool-'.length) : undefined;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The input of the tool call that `convertToModelMessages` writes for a part,
|
|
330
|
+
* which is what the AI SDK would execute: for `output-error` it falls back to
|
|
331
|
+
* `rawInput`.
|
|
332
|
+
*/
|
|
333
|
+
function modelInputOf(part) {
|
|
334
|
+
return part.state === 'output-error' && part.input == null && 'rawInput' in part ? part.rawInput : part.input;
|
|
335
|
+
}
|
|
336
|
+
/** A history the handler refuses as a whole (HTTP 400) instead of repairing it. */
|
|
337
|
+
class ApprovalHistoryError extends Error {
|
|
338
|
+
code;
|
|
339
|
+
constructor(code, message) {
|
|
340
|
+
super(message);
|
|
341
|
+
this.code = code;
|
|
342
|
+
this.name = 'ApprovalHistoryError';
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
exports.ApprovalHistoryError = ApprovalHistoryError;
|
|
346
|
+
/**
|
|
347
|
+
* Refuses a history that the AI SDK could read in more than one way.
|
|
348
|
+
*
|
|
349
|
+
* - Every tool part has a string tool call id, and a dynamic tool part a
|
|
350
|
+
* tool name that is a non-empty string (`tool_part_malformed`): the AI SDK
|
|
351
|
+
* converts any value and looks the tool up with it.
|
|
352
|
+
* - A tool call id may belong to one tool part only, in the whole history
|
|
353
|
+
* (`duplicate_tool_call_id`). The AI SDK maps an approval response to a
|
|
354
|
+
* tool call by the tool call id alone (`collectToolApprovals` keeps the last
|
|
355
|
+
* tool call of an id, and the model message sanitizer keeps the first one of
|
|
356
|
+
* a message), so a second part with the same id can lend its tool name and
|
|
357
|
+
* input to the approval of the other one.
|
|
358
|
+
* - An approval id may belong to one tool part only, in the whole history
|
|
359
|
+
* (`duplicate_approval_id`). Every part with an `approval` becomes an
|
|
360
|
+
* approval request with that id, and `collectToolApprovals` keeps the last
|
|
361
|
+
* request of an id, so a copy of a genuine id on another part would take
|
|
362
|
+
* over the genuine part's approved answer.
|
|
363
|
+
* - An `approval` is an object with a non-empty string `id`, and its
|
|
364
|
+
* `approved`, when set, is a boolean (`approval_malformed`). The AI SDK
|
|
365
|
+
* turns any value other than `null` / `undefined` into an approval response
|
|
366
|
+
* and treats a truthy one as approved.
|
|
367
|
+
*
|
|
368
|
+
* The AI SDK's own client never writes any of these: its UI message reducer
|
|
369
|
+
* (`updateToolPart` / `updateDynamicToolPart` in `processUIMessageStream`)
|
|
370
|
+
* updates the existing part of a tool call id in place, also for a
|
|
371
|
+
* provider-executed tool whose result arrives later, an approval continuation
|
|
372
|
+
* goes on in the same assistant message, and every approval request carries
|
|
373
|
+
* its own id. There is therefore no legitimate shape with a repeated id, and
|
|
374
|
+
* none is allowed.
|
|
375
|
+
*/
|
|
376
|
+
function assertUnambiguousToolHistory(messages) {
|
|
377
|
+
const toolCallIds = new Set();
|
|
378
|
+
const approvalIds = new Set();
|
|
379
|
+
for (const message of messages) {
|
|
380
|
+
if (!isRecord(message) || !Array.isArray(message.parts))
|
|
381
|
+
continue;
|
|
382
|
+
for (const part of message.parts) {
|
|
383
|
+
if (!isRecord(part) || !isToolPart(part))
|
|
384
|
+
continue;
|
|
385
|
+
if (!toolNameOf(part)) {
|
|
386
|
+
throw new ApprovalHistoryError('tool_part_malformed', 'A dynamic tool part has no tool name.');
|
|
387
|
+
}
|
|
388
|
+
if (typeof part.toolCallId !== 'string') {
|
|
389
|
+
throw new ApprovalHistoryError('tool_part_malformed', 'A tool part has no tool call id.');
|
|
390
|
+
}
|
|
391
|
+
if (toolCallIds.has(part.toolCallId)) {
|
|
392
|
+
throw new ApprovalHistoryError('duplicate_tool_call_id', 'A tool call id appears in more than one tool part.');
|
|
393
|
+
}
|
|
394
|
+
toolCallIds.add(part.toolCallId);
|
|
395
|
+
if (part.approval !== undefined && part.approval !== null) {
|
|
396
|
+
const approval = part.approval;
|
|
397
|
+
if (!isRecord(approval)) {
|
|
398
|
+
throw new ApprovalHistoryError('approval_malformed', 'A tool part carries an approval that is not an object.');
|
|
399
|
+
}
|
|
400
|
+
if (typeof approval.id !== 'string' || approval.id === '') {
|
|
401
|
+
throw new ApprovalHistoryError('approval_malformed', 'An approval has no id.');
|
|
402
|
+
}
|
|
403
|
+
if (approval.approved !== undefined && approval.approved !== null && typeof approval.approved !== 'boolean') {
|
|
404
|
+
throw new ApprovalHistoryError('approval_malformed', 'approval.approved must be true or false.');
|
|
405
|
+
}
|
|
406
|
+
if (approvalIds.has(approval.id)) {
|
|
407
|
+
throw new ApprovalHistoryError('duplicate_approval_id', 'An approval id appears in more than one tool part.');
|
|
408
|
+
}
|
|
409
|
+
approvalIds.add(approval.id);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Checks, before anything runs, every tool part of the request history that
|
|
416
|
+
* carries an approval, whatever its state, its answer and whether or not the
|
|
417
|
+
* provider executed it. The history must first pass
|
|
418
|
+
* `assertUnambiguousToolHistory` (this function calls it and throws
|
|
419
|
+
* `ApprovalHistoryError`).
|
|
420
|
+
*
|
|
421
|
+
* - An approved part that the AI SDK can run in this request (no result yet,
|
|
422
|
+
* or provider-executed, and in the last block of a last assistant message,
|
|
423
|
+
* see `runnableBlockOf`) needs an approval id issued for exactly this tool
|
|
424
|
+
* call id, tool name and input, not older than the maximum age, not used
|
|
425
|
+
* before in this history and not consumed before by the store (with the
|
|
426
|
+
* request's scope). More than `MAX_RUNNABLE_APPROVALS_PER_REQUEST` of them
|
|
427
|
+
* refuse the request (`too_many_approvals`) before any is consumed. A part that
|
|
428
|
+
* fails is rewritten to `output-denied` with the code as its reason, so the
|
|
429
|
+
* model messages carry a denied result for it and the AI SDK runs nothing.
|
|
430
|
+
* The request continues: the model sees the denial and answers.
|
|
431
|
+
* - Every other approved part without a result (an earlier block, an
|
|
432
|
+
* earlier message, a history with any trailing message) is rewritten to
|
|
433
|
+
* `output-denied` with the reason `approval_not_runnable` (or
|
|
434
|
+
* `approval_not_issued` with an id that verifies for nothing, when its id
|
|
435
|
+
* was not issued for it). It is neither consumed nor handed to the gate.
|
|
436
|
+
* - Every other part with an approval (one that holds its result, an
|
|
437
|
+
* unanswered request, a refusal) needs an id issued for this tool call id,
|
|
438
|
+
* tool name and input; age and use do not count. A part that fails loses
|
|
439
|
+
* its approval (an `output-denied` part, which the AI SDK cannot convert
|
|
440
|
+
* without one, gets an id of its own that verifies for nothing). Such parts
|
|
441
|
+
* are not refused, because an honest history holds them after a secret
|
|
442
|
+
* rotation, a restart of a process without a configured secret, or from
|
|
443
|
+
* 0.4.0; they run nothing either way.
|
|
444
|
+
*
|
|
445
|
+
* The invariants this establishes, together with `assertUnambiguousToolHistory`:
|
|
446
|
+
*
|
|
447
|
+
* 1. Every approved part without a result that is left in the history is in
|
|
448
|
+
* `verified`, so it passed binding, age, single use and the cap. Every
|
|
449
|
+
* other approved part either holds its result or is denied. The AI SDK
|
|
450
|
+
* runs an approved call only from a part without a result, so it can run
|
|
451
|
+
* only verified calls, whatever it treats as the last step; this does not
|
|
452
|
+
* depend on predicting which shapes it runs (tested against the installed
|
|
453
|
+
* `ai` for the shapes the reviews found).
|
|
454
|
+
* 2. Every approval id left in the history belongs to exactly one tool part
|
|
455
|
+
* and was issued for that part's tool call id, tool name and model input
|
|
456
|
+
* (the input `convertToModelMessages` writes, `rawInput` for an
|
|
457
|
+
* `output-error` part without input). The AI SDK pairs an approved answer
|
|
458
|
+
* with a call by approval id → the one request with that id, emitted from
|
|
459
|
+
* the same part → its tool call id, which is unique → the tool call
|
|
460
|
+
* emitted from that same part. So an approved answer can only ever pair
|
|
461
|
+
* with the call its id was issued for.
|
|
462
|
+
*/
|
|
463
|
+
async function enforceApprovalBindings(messages, options) {
|
|
464
|
+
if (options.localToolNames)
|
|
465
|
+
messages = withoutLocalProviderExecuted(messages, options.localToolNames);
|
|
466
|
+
assertUnambiguousToolHistory(messages);
|
|
467
|
+
const lastBlock = runnableBlockOf(messages);
|
|
468
|
+
const runnableCount = [...lastBlock].filter((part) => isRunnableApproval(part)).length;
|
|
469
|
+
if (runnableCount > exports.MAX_RUNNABLE_APPROVALS_PER_REQUEST) {
|
|
470
|
+
throw new ApprovalHistoryError('too_many_approvals', `At most ${exports.MAX_RUNNABLE_APPROVALS_PER_REQUEST} approved calls can run in one request.`);
|
|
471
|
+
}
|
|
472
|
+
const denied = [];
|
|
473
|
+
const verified = [];
|
|
474
|
+
const usedIds = new Set();
|
|
475
|
+
const next = [];
|
|
476
|
+
for (const message of messages) {
|
|
477
|
+
if (!isRecord(message) || !Array.isArray(message.parts)) {
|
|
478
|
+
next.push(message);
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
let changed = false;
|
|
482
|
+
const parts = [];
|
|
483
|
+
for (const part of message.parts) {
|
|
484
|
+
const toolName = isRecord(part) && isToolPart(part) ? toolNameOf(part) : undefined;
|
|
485
|
+
const approval = isRecord(part) && isRecord(part.approval) ? part.approval : undefined;
|
|
486
|
+
if (!toolName || !approval) {
|
|
487
|
+
parts.push(part);
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
const record = part;
|
|
491
|
+
const toolCallId = record.toolCallId;
|
|
492
|
+
const approvalId = approval.id;
|
|
493
|
+
const input = modelInputOf(record);
|
|
494
|
+
const runnable = lastBlock.has(part) && isRunnableApproval(record);
|
|
495
|
+
const code = runnable
|
|
496
|
+
? await denialCode({ input, toolName, toolCallId, approvalId, usedIds, ...options })
|
|
497
|
+
: bindingCode({ input, toolName, toolCallId, approvalId, binder: options.binder })
|
|
498
|
+
?? (isUnsettledApproval(record) ? 'approval_not_runnable' : undefined);
|
|
499
|
+
if (!code) {
|
|
500
|
+
if (runnable && record.providerExecuted !== true)
|
|
501
|
+
verified.push({ toolCallId, toolName, input });
|
|
502
|
+
parts.push(part);
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
changed = true;
|
|
506
|
+
if (runnable) {
|
|
507
|
+
denied.push({ toolCallId, code });
|
|
508
|
+
parts.push({ ...record, state: 'output-denied', approval: { id: approvalId, approved: false, reason: code } });
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
if (isUnsettledApproval(record)) {
|
|
512
|
+
// Approved, no result, and not checked for age and single use: denied,
|
|
513
|
+
// so the AI SDK cannot run it, whatever shape the history has.
|
|
514
|
+
denied.push({ toolCallId, code });
|
|
515
|
+
const id = code === 'approval_not_issued' ? `glirastes-approval-unbound.${toolCallId}` : approvalId;
|
|
516
|
+
parts.push({ ...record, state: 'output-denied', approval: { id, approved: false, reason: code } });
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
if (approval.approved === true)
|
|
520
|
+
denied.push({ toolCallId, code });
|
|
521
|
+
if (record.state === 'output-denied') {
|
|
522
|
+
parts.push({ ...record, approval: { ...approval, id: `glirastes-approval-unbound.${toolCallId}`, approved: false } });
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
const { approval: _dropped, ...withoutApproval } = record;
|
|
526
|
+
parts.push(withoutApproval);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
next.push(changed ? { ...message, parts } : message);
|
|
530
|
+
}
|
|
531
|
+
return { messages: next, denied, verified };
|
|
532
|
+
}
|
|
533
|
+
/** The history with `providerExecuted` removed from every part of a local tool. */
|
|
534
|
+
function withoutLocalProviderExecuted(messages, local) {
|
|
535
|
+
return messages.map((message) => {
|
|
536
|
+
if (!isRecord(message) || !Array.isArray(message.parts))
|
|
537
|
+
return message;
|
|
538
|
+
let changed = false;
|
|
539
|
+
const parts = message.parts.map((part) => {
|
|
540
|
+
if (!isRecord(part) || !isToolPart(part) || !('providerExecuted' in part))
|
|
541
|
+
return part;
|
|
542
|
+
const toolName = toolNameOf(part);
|
|
543
|
+
if (toolName === undefined || !local.has(toolName))
|
|
544
|
+
return part;
|
|
545
|
+
changed = true;
|
|
546
|
+
const { providerExecuted: _ignored, ...rest } = part;
|
|
547
|
+
return rest;
|
|
548
|
+
});
|
|
549
|
+
return changed ? { ...message, parts } : message;
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
/** An approved part without a result of any kind: the AI SDK may run it. */
|
|
553
|
+
function isUnsettledApproval(part) {
|
|
554
|
+
return isRecord(part.approval) && part.approval.approved === true && !RESULT_STATES.has(String(part.state));
|
|
555
|
+
}
|
|
556
|
+
/** An approved part without its result: the AI SDK runs it if it is in the runnable block. */
|
|
557
|
+
function isRunnableApproval(part) {
|
|
558
|
+
if (!isRecord(part) || !isToolPart(part) || !isRecord(part.approval) || part.approval.approved !== true)
|
|
559
|
+
return false;
|
|
560
|
+
return !(RESULT_STATES.has(String(part.state)) && part.providerExecuted !== true);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* The parts whose approvals the AI SDK can run in this request.
|
|
564
|
+
* `collectToolApprovals` reads only the last model message, and only when it
|
|
565
|
+
* is a tool message; `convertToModelMessages` writes that message for the
|
|
566
|
+
* last block (the parts after the last `step-start`) of the last UI message,
|
|
567
|
+
* when that message is the assistant's. Only these are checked in full,
|
|
568
|
+
* consumed and handed to the execution gate; an approved part without a
|
|
569
|
+
* result anywhere else is denied (`approval_not_runnable`), so a shape in
|
|
570
|
+
* which the AI SDK would still run it cannot skip age and single use.
|
|
571
|
+
*/
|
|
572
|
+
function runnableBlockOf(messages) {
|
|
573
|
+
const last = messages.at(-1);
|
|
574
|
+
if (!isRecord(last) || last.role !== 'assistant' || !Array.isArray(last.parts))
|
|
575
|
+
return new Set();
|
|
576
|
+
const parts = last.parts;
|
|
577
|
+
let start = 0;
|
|
578
|
+
parts.forEach((part, index) => {
|
|
579
|
+
if (isRecord(part) && part.type === 'step-start')
|
|
580
|
+
start = index + 1;
|
|
581
|
+
});
|
|
582
|
+
return new Set(parts.slice(start));
|
|
583
|
+
}
|
|
584
|
+
function bindingCode(args) {
|
|
585
|
+
const verified = args.binder.verify({
|
|
586
|
+
approvalId: args.approvalId,
|
|
587
|
+
toolCallId: args.toolCallId,
|
|
588
|
+
toolName: args.toolName,
|
|
589
|
+
input: args.input,
|
|
590
|
+
});
|
|
591
|
+
// Only the binding counts here: an executed call may be older than the maximum age.
|
|
592
|
+
return !verified.ok && verified.code === 'approval_not_issued' ? 'approval_not_issued' : undefined;
|
|
593
|
+
}
|
|
594
|
+
async function denialCode(args) {
|
|
595
|
+
const verified = args.binder.verify({
|
|
596
|
+
approvalId: args.approvalId,
|
|
597
|
+
toolCallId: args.toolCallId,
|
|
598
|
+
toolName: args.toolName,
|
|
599
|
+
input: args.input,
|
|
600
|
+
});
|
|
601
|
+
if (!verified.ok)
|
|
602
|
+
return verified.code;
|
|
603
|
+
if (args.usedIds.has(verified.key))
|
|
604
|
+
return 'approval_already_used';
|
|
605
|
+
args.usedIds.add(verified.key);
|
|
606
|
+
if (args.store) {
|
|
607
|
+
try {
|
|
608
|
+
if (!(await args.store.consume(verified.key, verified.expiresAtMs, { scope: args.scope ?? '' })))
|
|
609
|
+
return 'approval_already_used';
|
|
610
|
+
}
|
|
611
|
+
catch {
|
|
612
|
+
return 'approval_store_unavailable';
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return undefined;
|
|
616
|
+
}
|
|
617
|
+
class ApprovalExecutionRefusedError extends Error {
|
|
618
|
+
code;
|
|
619
|
+
constructor(code, toolName) {
|
|
620
|
+
super(`${code}: the call of "${toolName}" was not approved for this tool call and input`);
|
|
621
|
+
this.code = code;
|
|
622
|
+
this.name = 'ApprovalExecutionRefusedError';
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
exports.ApprovalExecutionRefusedError = ApprovalExecutionRefusedError;
|
|
626
|
+
/**
|
|
627
|
+
* The second layer of the binding, checked where the tool executes.
|
|
628
|
+
*
|
|
629
|
+
* The AI SDK never executes a call within the run whose `needsApproval`
|
|
630
|
+
* answered true: it emits the approval request and the run ends (traced in
|
|
631
|
+
* `ai` 6.0: `runToolsTransformation` stops at `isApprovalNeeded`, and only
|
|
632
|
+
* `collectToolApprovals` on the next request's history executes an approved
|
|
633
|
+
* call). So a gated tool executes only
|
|
634
|
+
*
|
|
635
|
+
* - for an approval this request verified, with exactly its tool call id,
|
|
636
|
+
* tool name and canonical input, once; or
|
|
637
|
+
* - for a live call whose `needsApproval` this run answered with false.
|
|
638
|
+
*
|
|
639
|
+
* Everything else, including a call whose `needsApproval` was never asked,
|
|
640
|
+
* is refused.
|
|
641
|
+
*/
|
|
642
|
+
function createApprovalExecutionGate(verified) {
|
|
643
|
+
const approvals = new Map(verified.map((entry) => [entry.toolCallId, {
|
|
644
|
+
toolName: entry.toolName,
|
|
645
|
+
input: canonicalJson(entry.input),
|
|
646
|
+
}]));
|
|
647
|
+
const executed = new Set();
|
|
648
|
+
const liveWithoutApproval = new Map();
|
|
649
|
+
return {
|
|
650
|
+
recordDecision: ({ toolName, toolCallId, needed }) => {
|
|
651
|
+
if (typeof toolCallId !== 'string' || approvals.has(toolCallId))
|
|
652
|
+
return;
|
|
653
|
+
if (needed)
|
|
654
|
+
liveWithoutApproval.delete(toolCallId);
|
|
655
|
+
else
|
|
656
|
+
liveWithoutApproval.set(toolCallId, toolName);
|
|
657
|
+
},
|
|
658
|
+
authorize: ({ toolName, toolCallId, input }) => {
|
|
659
|
+
if (typeof toolCallId !== 'string')
|
|
660
|
+
throw new ApprovalExecutionRefusedError('approval_not_verified', toolName);
|
|
661
|
+
const approval = approvals.get(toolCallId);
|
|
662
|
+
if (approval) {
|
|
663
|
+
if (executed.has(toolCallId))
|
|
664
|
+
throw new ApprovalExecutionRefusedError('approval_already_used', toolName);
|
|
665
|
+
if (approval.toolName !== toolName || approval.input !== canonicalOrUndefined(input)) {
|
|
666
|
+
throw new ApprovalExecutionRefusedError('approval_not_verified', toolName);
|
|
667
|
+
}
|
|
668
|
+
executed.add(toolCallId);
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
if (liveWithoutApproval.get(toolCallId) === toolName) {
|
|
672
|
+
liveWithoutApproval.delete(toolCallId);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
throw new ApprovalExecutionRefusedError('approval_not_verified', toolName);
|
|
676
|
+
},
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
function canonicalOrUndefined(value) {
|
|
680
|
+
try {
|
|
681
|
+
return canonicalJson(value);
|
|
682
|
+
}
|
|
683
|
+
catch {
|
|
684
|
+
return undefined;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Puts the gate on every tool for which `isGated` says it can ask for
|
|
689
|
+
* approval. The gated tool records its own `needsApproval` answers and checks
|
|
690
|
+
* the gate in its own `execute`, so a stream handler that builds AI SDK tools
|
|
691
|
+
* from these objects itself is held to the gate as well; `createAiSdkTools`
|
|
692
|
+
* finds the gate on the tool and checks it with the input before validation.
|
|
693
|
+
*/
|
|
694
|
+
function gateApprovalTools(tools, gate, isGated) {
|
|
695
|
+
const gated = {};
|
|
696
|
+
for (const [toolName, raw] of Object.entries(tools)) {
|
|
697
|
+
const tool = raw;
|
|
698
|
+
if (typeof raw !== 'object' || raw === null || typeof tool.execute !== 'function' || !isGated(toolName, tool)) {
|
|
699
|
+
gated[toolName] = raw;
|
|
700
|
+
continue;
|
|
701
|
+
}
|
|
702
|
+
const original = tool.needsApproval;
|
|
703
|
+
const execute = tool.execute;
|
|
704
|
+
gated[toolName] = {
|
|
705
|
+
...tool,
|
|
706
|
+
[engine_js_1.AI_SDK_APPROVAL_GATE]: gate,
|
|
707
|
+
needsApproval: async (input, options) => {
|
|
708
|
+
const needed = typeof original === 'function'
|
|
709
|
+
? Boolean(await original(input, options))
|
|
710
|
+
: original === true;
|
|
711
|
+
gate.recordDecision({ toolName, toolCallId: options?.toolCallId, needed });
|
|
712
|
+
return needed;
|
|
713
|
+
},
|
|
714
|
+
execute: async (input, options) => {
|
|
715
|
+
const passed = options?.[engine_js_1.AI_SDK_APPROVAL_GATE_PASSED];
|
|
716
|
+
if (passed !== gate) {
|
|
717
|
+
gate.authorize({ toolName, toolCallId: options?.toolCallId, input });
|
|
718
|
+
}
|
|
719
|
+
return execute(input, options);
|
|
720
|
+
},
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
return gated;
|
|
724
|
+
}
|