glirastes 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +361 -1
- package/README.md +304 -853
- 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/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 +66 -0
- package/dist/cjs/react/provider/ai-chat-provider.d.ts +1 -1
- package/dist/cjs/react/provider/ai-chat-provider.js +407 -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 +1529 -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 +264 -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 +32 -3
- 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 +112 -0
- package/dist/cjs/runtime/glirastes.js +287 -0
- package/dist/cjs/runtime/index.d.ts +23 -0
- package/dist/cjs/runtime/index.js +71 -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-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/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/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/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 +64 -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 +408 -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 +758 -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 +264 -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 +32 -3
- 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 +112 -0
- package/dist/runtime/glirastes.js +285 -0
- package/dist/runtime/glirastes.js.map +1 -0
- package/dist/runtime/index.d.ts +23 -0
- package/dist/runtime/index.js +23 -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-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/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/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 +149 -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 +158 -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
|
@@ -2,13 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_SAFETY_MAX_STEPS = void 0;
|
|
4
4
|
exports.resolveStepLimit = resolveStepLimit;
|
|
5
|
+
exports.resolveTurnTimeout = resolveTurnTimeout;
|
|
6
|
+
exports.shouldStopManagedExecution = shouldStopManagedExecution;
|
|
5
7
|
exports.createAiChatHandler = createAiChatHandler;
|
|
6
8
|
const index_js_1 = require("../../core/index.js");
|
|
9
|
+
const clarification_js_1 = require("../../../contracts/clarification.js");
|
|
10
|
+
const plan_js_1 = require("../../../contracts/plan.js");
|
|
11
|
+
/** Handler-created built-ins that stay callable for every tool selection. */
|
|
12
|
+
const ALWAYS_ON_BUILTINS = [clarification_js_1.CLARIFICATION_TOOL_NAME, plan_js_1.PLAN_TOOL_NAME];
|
|
13
|
+
const clarification_resume_js_1 = require("./clarification-resume.js");
|
|
14
|
+
const scope_pipeline_tools_js_1 = require("./scope-pipeline-tools.js");
|
|
15
|
+
const request_guards_js_1 = require("./request-guards.js");
|
|
16
|
+
const approval_binding_js_1 = require("./approval-binding.js");
|
|
17
|
+
const direct_command_js_1 = require("./direct-command.js");
|
|
7
18
|
const types_js_1 = require("../../../types.js");
|
|
8
19
|
const ai_1 = require("ai");
|
|
9
20
|
const context_helpers_js_1 = require("./context-helpers.js");
|
|
10
21
|
const prepare_model_messages_js_1 = require("./prepare-model-messages.js");
|
|
11
22
|
const filter_fallback_error_js_1 = require("./filter-fallback-error.js");
|
|
23
|
+
const tool_presentation_js_1 = require("./tool-presentation.js");
|
|
24
|
+
const index_js_2 = require("../../../contracts/index.js");
|
|
25
|
+
const index_js_3 = require("../../../runtime/index.js");
|
|
26
|
+
const tool_discovery_js_1 = require("./tool-discovery.js");
|
|
12
27
|
/**
|
|
13
28
|
* Default soft cap on reasoning steps when no module-level or explicit
|
|
14
29
|
* `maxSteps` is configured. Acts as a last-line safety against runaway
|
|
@@ -24,18 +39,74 @@ function asPositiveInt(value) {
|
|
|
24
39
|
return normalized > 0 ? normalized : null;
|
|
25
40
|
}
|
|
26
41
|
function resolveStepLimit(options) {
|
|
42
|
+
let resolved;
|
|
27
43
|
const moduleMaxSteps = asPositiveInt(options.moduleMaxSteps);
|
|
28
44
|
if (moduleMaxSteps) {
|
|
29
|
-
|
|
45
|
+
resolved = { maxSteps: moduleMaxSteps, stepLimitSource: 'module' };
|
|
30
46
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
47
|
+
else {
|
|
48
|
+
const configuredMaxSteps = asPositiveInt(options.configuredMaxSteps);
|
|
49
|
+
resolved = configuredMaxSteps
|
|
50
|
+
? { maxSteps: configuredMaxSteps, stepLimitSource: 'explicit' }
|
|
51
|
+
: {
|
|
52
|
+
maxSteps: asPositiveInt(options.safetyMaxSteps)
|
|
53
|
+
?? exports.DEFAULT_SAFETY_MAX_STEPS,
|
|
54
|
+
stepLimitSource: 'safety',
|
|
55
|
+
};
|
|
34
56
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
57
|
+
const runtimeBudgetMaxSteps = asPositiveInt(options.runtimeBudgetMaxSteps);
|
|
58
|
+
return runtimeBudgetMaxSteps && runtimeBudgetMaxSteps < resolved.maxSteps
|
|
59
|
+
? {
|
|
60
|
+
maxSteps: runtimeBudgetMaxSteps,
|
|
61
|
+
stepLimitSource: 'runtime-budget',
|
|
62
|
+
}
|
|
63
|
+
: resolved;
|
|
64
|
+
}
|
|
65
|
+
function resolveTurnTimeout(totalTimeoutMs) {
|
|
66
|
+
if (totalTimeoutMs === undefined)
|
|
67
|
+
return undefined;
|
|
68
|
+
if (!Number.isFinite(totalTimeoutMs) || totalTimeoutMs <= 0) {
|
|
69
|
+
throw new RangeError('totalTimeoutMs must be a positive finite number');
|
|
70
|
+
}
|
|
71
|
+
return { totalMs: totalTimeoutMs };
|
|
72
|
+
}
|
|
73
|
+
function shouldStopManagedExecution(options) {
|
|
74
|
+
return options.stepCount >= options.maxSteps
|
|
75
|
+
|| options.budgetState === 'hard-limit'
|
|
76
|
+
|| (options.lastStepToolNames ?? []).includes(clarification_js_1.CLARIFICATION_TOOL_NAME);
|
|
77
|
+
}
|
|
78
|
+
/** Model id of a finished step; AI SDK 6 versions differ in where they put it. */
|
|
79
|
+
function stepModelId(event) {
|
|
80
|
+
const record = event;
|
|
81
|
+
const modelId = record.model?.modelId ?? record.response?.modelId;
|
|
82
|
+
return typeof modelId === 'string' ? modelId : null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Names of the tool calls of a step that failed: thrown errors and the
|
|
86
|
+
* `{ error }` results SDK tools return. Only names leave this function.
|
|
87
|
+
*/
|
|
88
|
+
function failedToolNames(content) {
|
|
89
|
+
const names = [];
|
|
90
|
+
for (const part of content) {
|
|
91
|
+
const record = part;
|
|
92
|
+
if (typeof record?.toolName !== 'string')
|
|
93
|
+
continue;
|
|
94
|
+
const output = record.output;
|
|
95
|
+
if (record.type === 'tool-error'
|
|
96
|
+
|| (record.type === 'tool-result'
|
|
97
|
+
&& typeof output === 'object'
|
|
98
|
+
&& output !== null
|
|
99
|
+
&& typeof output.error === 'string')) {
|
|
100
|
+
names.push(record.toolName);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return names;
|
|
104
|
+
}
|
|
105
|
+
/** Hands endpoint contract rejections to the turn's metrics, when the app reports metrics. */
|
|
106
|
+
function contractRejectionReporter(turnMetrics) {
|
|
107
|
+
return turnMetrics
|
|
108
|
+
? { onContractRejected: ({ toolName, status }) => { turnMetrics.recordToolContractRejected(toolName, status); } }
|
|
109
|
+
: {};
|
|
39
110
|
}
|
|
40
111
|
function compactToolNames(toolCalls) {
|
|
41
112
|
const unique = new Set();
|
|
@@ -116,34 +187,63 @@ function createPipelineState(options) {
|
|
|
116
187
|
* Converts UI messages → model messages, wraps tools, calls streamText,
|
|
117
188
|
* and returns a UI message stream response.
|
|
118
189
|
*/
|
|
119
|
-
async function defaultStreamHandler(ctx, onFinish) {
|
|
120
|
-
|
|
190
|
+
async function defaultStreamHandler(ctx, onFinish, onStreamError) {
|
|
191
|
+
// SDK built-ins the handler created itself are not manifest tools, so the
|
|
192
|
+
// managed guard would deny them. Everything else stays guarded.
|
|
193
|
+
const builtinNames = new Set(ctx.handlerBuiltinToolNames ?? []);
|
|
194
|
+
const builtinTools = {};
|
|
195
|
+
const domainTools = {};
|
|
196
|
+
for (const [name, tool] of Object.entries(ctx.tools)) {
|
|
197
|
+
(builtinNames.has(name) ? builtinTools : domainTools)[name] = tool;
|
|
198
|
+
}
|
|
199
|
+
const vercelTools = (0, prepare_model_messages_js_1.wrapToolsForVercelAi)(domainTools, ctx.managedTurn
|
|
200
|
+
? {
|
|
201
|
+
beforeToolCall: ctx.managedTurn.beforeToolCall,
|
|
202
|
+
afterToolCall: ctx.managedTurn.afterToolCall,
|
|
203
|
+
onToolError: ctx.managedTurn.onToolError,
|
|
204
|
+
resolveApproval: ctx.managedTurn.resolveApproval,
|
|
205
|
+
toolTimeoutMs: ctx.managedTurn.toolTimeoutMs,
|
|
206
|
+
}
|
|
207
|
+
: undefined);
|
|
208
|
+
if (Object.keys(builtinTools).length > 0) {
|
|
209
|
+
Object.assign(vercelTools, (0, prepare_model_messages_js_1.wrapToolsForVercelAi)(builtinTools));
|
|
210
|
+
}
|
|
121
211
|
const modelMessages = await (0, prepare_model_messages_js_1.prepareModelMessages)(ctx.messages, { maxContextMessages: ctx.maxContextMessages });
|
|
122
212
|
let wasTruncated = false;
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
|
|
213
|
+
// At the runtime budget the turn blocks further tools and gets one bounded
|
|
214
|
+
// final summary, so it still ends with an answer instead of silence.
|
|
215
|
+
let finalSummaryClaimed = false;
|
|
216
|
+
const budgetExhausted = () => ctx.managedTurn?.tracker.evaluate().state === 'hard-limit';
|
|
126
217
|
const shouldStop = (event) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return false;
|
|
218
|
+
const budgetState = ctx.managedTurn?.tracker.evaluate().state;
|
|
219
|
+
const summarize = budgetState === 'hard-limit'
|
|
220
|
+
&& ctx.managedTurn.tracker.claimFinalSummary();
|
|
221
|
+
if (summarize)
|
|
222
|
+
finalSummaryClaimed = true;
|
|
223
|
+
return shouldStopManagedExecution({
|
|
224
|
+
stepCount: event.steps.length,
|
|
225
|
+
maxSteps: ctx.maxSteps,
|
|
226
|
+
budgetState: summarize ? undefined : budgetState,
|
|
227
|
+
lastStepToolNames: event.steps.at(-1)?.toolCalls.map((call) => call.toolName),
|
|
228
|
+
});
|
|
142
229
|
};
|
|
230
|
+
let providerErrorReported = false;
|
|
143
231
|
const stream = (0, ai_1.createUIMessageStream)({
|
|
232
|
+
// A turn can also fail outside the provider call, e.g. on a model object
|
|
233
|
+
// from an unsupported AI SDK version. The client gets the generic text,
|
|
234
|
+
// the app's error callback the cause.
|
|
235
|
+
onError: (error) => {
|
|
236
|
+
if (!providerErrorReported) {
|
|
237
|
+
providerErrorReported = true;
|
|
238
|
+
onStreamError?.(error);
|
|
239
|
+
}
|
|
240
|
+
return 'AI request failed';
|
|
241
|
+
},
|
|
144
242
|
execute: async ({ writer }) => {
|
|
145
243
|
let totalSteps = 0;
|
|
146
244
|
let finalStateWritten = false;
|
|
245
|
+
// Cost of the running model step, read from its raw stream chunks.
|
|
246
|
+
let stepRawCostUsd = null;
|
|
147
247
|
const writePipelineState = (state, transient = false) => {
|
|
148
248
|
writer.write({
|
|
149
249
|
type: 'data-pipeline-state',
|
|
@@ -151,6 +251,11 @@ async function defaultStreamHandler(ctx, onFinish) {
|
|
|
151
251
|
transient,
|
|
152
252
|
});
|
|
153
253
|
};
|
|
254
|
+
// Ahead of the first chunk, so the UI can name a tool the moment it is called.
|
|
255
|
+
const presentation = (0, tool_presentation_js_1.toolPresentationOf)(ctx.managedTurn?.snapshot.manifestRevision);
|
|
256
|
+
if (presentation) {
|
|
257
|
+
writer.write({ type: 'data-tool-presentation', data: presentation, transient: true });
|
|
258
|
+
}
|
|
154
259
|
writePipelineState(createPipelineState({
|
|
155
260
|
status: 'running',
|
|
156
261
|
totalSteps: 0,
|
|
@@ -162,10 +267,66 @@ async function defaultStreamHandler(ctx, onFinish) {
|
|
|
162
267
|
messages: modelMessages,
|
|
163
268
|
system: ctx.systemPrompt,
|
|
164
269
|
tools: vercelTools,
|
|
270
|
+
...(ctx.toolDiscovery
|
|
271
|
+
? { activeTools: [...ctx.toolDiscovery.activeToolNames()] }
|
|
272
|
+
: {}),
|
|
273
|
+
prepareStep: () => {
|
|
274
|
+
if (budgetExhausted()) {
|
|
275
|
+
return { activeTools: [], toolChoice: 'none' };
|
|
276
|
+
}
|
|
277
|
+
return ctx.toolDiscovery
|
|
278
|
+
? { activeTools: [...ctx.toolDiscovery.activeToolNames()] }
|
|
279
|
+
: {};
|
|
280
|
+
},
|
|
165
281
|
maxOutputTokens: ctx.maxOutputTokens,
|
|
166
282
|
temperature: ctx.temperature,
|
|
283
|
+
timeout: resolveTurnTimeout(ctx.managedTurn?.snapshot.budget.totalTimeoutMs),
|
|
167
284
|
stopWhen: shouldStop,
|
|
168
|
-
|
|
285
|
+
// OpenRouter reports `usage.cost` only in the raw final chunk when the
|
|
286
|
+
// OpenAI-compatible provider is used; the UI stream drops raw chunks.
|
|
287
|
+
includeRawChunks: Boolean(ctx.managedTurn || ctx.turnMetrics),
|
|
288
|
+
onChunk: ({ chunk }) => {
|
|
289
|
+
if (chunk.type === 'raw') {
|
|
290
|
+
stepRawCostUsd = (0, index_js_3.rawChunkCostUsd)(chunk.rawValue) ?? stepRawCostUsd;
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
ctx.turnMetrics?.markFirstChunk();
|
|
294
|
+
},
|
|
295
|
+
// AI SDK's default logs the complete provider error, including
|
|
296
|
+
// request/response content. Only the local consumer owns diagnostics.
|
|
297
|
+
onError: ({ error }) => {
|
|
298
|
+
providerErrorReported = true;
|
|
299
|
+
onStreamError?.(error);
|
|
300
|
+
},
|
|
301
|
+
onStepFinish: async (event) => {
|
|
302
|
+
const inputTokens = event.usage.inputTokens ?? 0;
|
|
303
|
+
const outputTokens = event.usage.outputTokens ?? 0;
|
|
304
|
+
const model = stepModelId(event);
|
|
305
|
+
const rawCostUsd = stepRawCostUsd;
|
|
306
|
+
stepRawCostUsd = null;
|
|
307
|
+
const cost = (0, index_js_3.resolveStepCost)({
|
|
308
|
+
model,
|
|
309
|
+
inputTokens,
|
|
310
|
+
outputTokens,
|
|
311
|
+
providerMetadata: event.providerMetadata,
|
|
312
|
+
usageRaw: event.usage.raw,
|
|
313
|
+
rawChunkCostUsd: rawCostUsd,
|
|
314
|
+
}, ctx.modelPricing);
|
|
315
|
+
// A known cost counts against maxEstimatedCostUsd; an unknown one
|
|
316
|
+
// is never recorded as 0.
|
|
317
|
+
await ctx.managedTurn?.afterModelStep({
|
|
318
|
+
inputTokens,
|
|
319
|
+
outputTokens,
|
|
320
|
+
...(cost.usd !== null ? { estimatedCostUsd: cost.usd } : {}),
|
|
321
|
+
});
|
|
322
|
+
ctx.turnMetrics?.recordStep({
|
|
323
|
+
model,
|
|
324
|
+
inputTokens,
|
|
325
|
+
outputTokens,
|
|
326
|
+
cost,
|
|
327
|
+
toolNames: event.toolCalls.map((call) => call.toolName),
|
|
328
|
+
failedToolNames: failedToolNames(event.content),
|
|
329
|
+
});
|
|
169
330
|
const report = buildStepReport({
|
|
170
331
|
stepNumber: event.stepNumber,
|
|
171
332
|
finishReason: event.finishReason,
|
|
@@ -190,6 +351,12 @@ async function defaultStreamHandler(ctx, onFinish) {
|
|
|
190
351
|
ctx.onStepReport?.(report);
|
|
191
352
|
},
|
|
192
353
|
onAbort: (event) => {
|
|
354
|
+
// The runtime time budget is the only abort source of this handler,
|
|
355
|
+
// so an abort at the hard limit is a budget stop, not a user abort.
|
|
356
|
+
const abortedByBudget = ctx.managedTurn?.tracker.evaluate().state === 'hard-limit';
|
|
357
|
+
ctx.turnMetrics?.finish(abortedByBudget
|
|
358
|
+
? { status: 'safety-stop', errorCode: 'budget_exhausted' }
|
|
359
|
+
: { status: 'aborted', errorCode: null });
|
|
193
360
|
if (finalStateWritten)
|
|
194
361
|
return;
|
|
195
362
|
totalSteps = Math.max(totalSteps, event.steps.length);
|
|
@@ -204,18 +371,26 @@ async function defaultStreamHandler(ctx, onFinish) {
|
|
|
204
371
|
finalStateWritten = true;
|
|
205
372
|
},
|
|
206
373
|
onFinish: (event) => {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
374
|
+
const budgetEvaluation = ctx.managedTurn?.tracker.evaluate();
|
|
375
|
+
const stoppedByBudget = budgetEvaluation?.state === 'hard-limit';
|
|
376
|
+
wasTruncated = finalSummaryClaimed || (event.finishReason === 'tool-calls' &&
|
|
377
|
+
(event.steps.length >= ctx.maxSteps || stoppedByBudget));
|
|
210
378
|
totalSteps = Math.max(totalSteps, event.steps.length);
|
|
211
|
-
const isSafetyStop = wasTruncated
|
|
212
|
-
|
|
379
|
+
const isSafetyStop = wasTruncated
|
|
380
|
+
&& (ctx.stepLimitSource === 'safety'
|
|
381
|
+
|| ctx.stepLimitSource === 'runtime-budget'
|
|
382
|
+
|| stoppedByBudget);
|
|
383
|
+
const status = isSafetyStop
|
|
213
384
|
? 'safety-stop'
|
|
214
|
-
:
|
|
215
|
-
? '
|
|
216
|
-
:
|
|
217
|
-
|
|
218
|
-
|
|
385
|
+
: event.finishReason === 'error'
|
|
386
|
+
? 'error'
|
|
387
|
+
: 'completed';
|
|
388
|
+
ctx.turnMetrics?.finish({
|
|
389
|
+
status,
|
|
390
|
+
errorCode: status === 'safety-stop'
|
|
391
|
+
? stoppedByBudget ? 'budget_exhausted' : 'step_limit'
|
|
392
|
+
: status === 'error' ? 'model_error' : null,
|
|
393
|
+
});
|
|
219
394
|
if (!finalStateWritten) {
|
|
220
395
|
writePipelineState(createPipelineState({
|
|
221
396
|
status,
|
|
@@ -223,8 +398,8 @@ async function defaultStreamHandler(ctx, onFinish) {
|
|
|
223
398
|
finishReason: event.finishReason,
|
|
224
399
|
maxSteps: ctx.maxSteps,
|
|
225
400
|
stepLimitSource: ctx.stepLimitSource,
|
|
226
|
-
message:
|
|
227
|
-
?
|
|
401
|
+
message: stoppedByBudget
|
|
402
|
+
? `Stopped at runtime budget: ${budgetEvaluation.reasons.join(', ')}.`
|
|
228
403
|
: wasTruncated
|
|
229
404
|
? isSafetyStop
|
|
230
405
|
? 'Paused at step safety cap. You can continue or stop.'
|
|
@@ -247,11 +422,13 @@ async function defaultStreamHandler(ctx, onFinish) {
|
|
|
247
422
|
});
|
|
248
423
|
},
|
|
249
424
|
});
|
|
250
|
-
|
|
425
|
+
const uiStream = result.toUIMessageStream({ onError: () => 'AI request failed' });
|
|
426
|
+
writer.merge(ctx.bindApprovalRequests ? ctx.bindApprovalRequests(uiStream) : uiStream);
|
|
251
427
|
try {
|
|
252
428
|
await result.response;
|
|
253
429
|
}
|
|
254
430
|
catch (error) {
|
|
431
|
+
ctx.turnMetrics?.finish({ status: 'error', errorCode: 'model_error' });
|
|
255
432
|
if (finalStateWritten)
|
|
256
433
|
return;
|
|
257
434
|
writePipelineState(createPipelineState({
|
|
@@ -263,7 +440,8 @@ async function defaultStreamHandler(ctx, onFinish) {
|
|
|
263
440
|
message: 'Pipeline failed.',
|
|
264
441
|
}));
|
|
265
442
|
finalStateWritten = true;
|
|
266
|
-
|
|
443
|
+
if (!providerErrorReported)
|
|
444
|
+
throw error;
|
|
267
445
|
}
|
|
268
446
|
},
|
|
269
447
|
});
|
|
@@ -289,7 +467,7 @@ async function defaultStreamHandler(ctx, onFinish) {
|
|
|
289
467
|
* checks happen on the backend.
|
|
290
468
|
*/
|
|
291
469
|
function createAiChatHandler(config) {
|
|
292
|
-
const { tools: staticTools, pipeline, followups, loadTools,
|
|
470
|
+
const { tools: staticTools, managedRuntime, pipeline, followups, clarification, planning, loadTools,
|
|
293
471
|
// PII Shield
|
|
294
472
|
piiShield,
|
|
295
473
|
// Audit & Telemetry
|
|
@@ -297,7 +475,29 @@ function createAiChatHandler(config) {
|
|
|
297
475
|
// Lancer (Pro: runtime prompt + model overrides)
|
|
298
476
|
lancer, modelDefaults, modelInstanceFactory,
|
|
299
477
|
// Shared
|
|
300
|
-
model: modelConfig, systemPrompt: systemPromptConfig, locale = 'en-US', uiActionSchema, maxOutputTokens = 600, temperature = 0.2, maxSteps: configuredMaxSteps, safetyMaxSteps = exports.DEFAULT_SAFETY_MAX_STEPS, emitStepReports = true, maxContextMessages = 12, maxConversationHistoryPairs = 4, guardrails, intentRouter, wrapHandler, onError, onToolError, onPipelineResult, onStepReport, onFinish, streamHandler: customStreamHandler, } = config;
|
|
478
|
+
model: modelConfig, systemPrompt: systemPromptConfig, locale = 'en-US', uiActionSchema, maxOutputTokens = 600, temperature = 0.2, maxSteps: configuredMaxSteps, safetyMaxSteps = exports.DEFAULT_SAFETY_MAX_STEPS, emitStepReports = true, maxContextMessages = 12, maxConversationHistoryPairs = 4, guardrails, intentRouter, wrapHandler, onError: onErrorConfig, onToolError, onPipelineResult, onStepReport, onFinish, streamHandler: customStreamHandler, toolDiscovery: enableToolDiscovery = false, toolSemantics, metrics, modelPricing: configuredModelPricing, directCommands = true, trustForwardedHeaders = false, endpointCaller = (request) => (0, context_helpers_js_1.createInternalApiCallerFromRequest)(request, { trustForwardedHeaders }), approvalSecret, approvalMaxAgeMs, approvalStore: configuredApprovalStore, approvalScope: approvalScopeOf, allowedOrigins, crossOriginProtection, maxBodyBytes, } = config;
|
|
479
|
+
if (approvalMaxAgeMs !== undefined)
|
|
480
|
+
(0, approval_binding_js_1.assertApprovalMaxAge)(approvalMaxAgeMs);
|
|
481
|
+
// Without a callback a failed turn would only say "AI request failed" to
|
|
482
|
+
// the user and nothing to the developer. Name only: provider errors can
|
|
483
|
+
// carry request and response content.
|
|
484
|
+
const onError = onErrorConfig ?? ((error) => {
|
|
485
|
+
const name = error instanceof Error ? error.name : typeof error;
|
|
486
|
+
console.error(`[glirastes] AI chat turn failed (${name}). Pass onError to createAiChatHandler to see the cause.`);
|
|
487
|
+
});
|
|
488
|
+
// The Proctor endpoint behind Lancer telemetry is not served by the
|
|
489
|
+
// Foundation control plane and its audit payloads are not content-free;
|
|
490
|
+
// the managed-local path reports through `metrics` instead.
|
|
491
|
+
if (managedRuntime && telemetry) {
|
|
492
|
+
throw new Error('createAiChatHandler: telemetry (legacy Lancer) cannot be combined with '
|
|
493
|
+
+ 'managedRuntime; use metrics for content-free runtime metrics');
|
|
494
|
+
}
|
|
495
|
+
// Single use without configuration: one process's memory. Instances that
|
|
496
|
+
// share a secret need a shared store to refuse a replay across instances.
|
|
497
|
+
const approvalStore = configuredApprovalStore ?? (0, approval_binding_js_1.defaultApprovalStore)();
|
|
498
|
+
const modelPricing = configuredModelPricing
|
|
499
|
+
? index_js_3.RuntimePriceTableSchema.parse(configuredModelPricing)
|
|
500
|
+
: undefined;
|
|
301
501
|
// Report model defaults to Glirastes (fire-and-forget, once)
|
|
302
502
|
let defaultsReported = false;
|
|
303
503
|
function reportDefaultsOnce() {
|
|
@@ -307,7 +507,7 @@ function createAiChatHandler(config) {
|
|
|
307
507
|
lancer.config.reportModels(modelDefaults).catch(() => { });
|
|
308
508
|
}
|
|
309
509
|
// Build stream handler factory — per-request to allow session.ended audit
|
|
310
|
-
function createStreamHandler(auditContext) {
|
|
510
|
+
function createStreamHandler(req, auditContext) {
|
|
311
511
|
const wrappedOnFinish = (event) => {
|
|
312
512
|
onFinish?.(event);
|
|
313
513
|
if (auditContext && (onAudit || telemetry)) {
|
|
@@ -344,23 +544,223 @@ function createAiChatHandler(config) {
|
|
|
344
544
|
};
|
|
345
545
|
return customStreamHandler
|
|
346
546
|
? customStreamHandler
|
|
347
|
-
: (ctx) => defaultStreamHandler(ctx, wrappedOnFinish);
|
|
547
|
+
: (ctx) => defaultStreamHandler(ctx, wrappedOnFinish, (error) => onError?.(error, req));
|
|
348
548
|
}
|
|
349
549
|
if (!staticTools && !loadTools) {
|
|
350
550
|
throw new Error('createAiChatHandler: either tools or loadTools must be provided');
|
|
351
551
|
}
|
|
552
|
+
const clarificationTool = clarification
|
|
553
|
+
? (0, index_js_1.createClarificationTool)(clarification)
|
|
554
|
+
: null;
|
|
555
|
+
const planTool = planning ? (0, index_js_1.createPlanTool)(planning) : null;
|
|
556
|
+
const withAlwaysOnBuiltins = (registry) => {
|
|
557
|
+
let next = registry;
|
|
558
|
+
for (const tool of [clarificationTool, planTool]) {
|
|
559
|
+
if (tool && !next[tool.id])
|
|
560
|
+
next = { ...next, [tool.id]: tool };
|
|
561
|
+
}
|
|
562
|
+
return next;
|
|
563
|
+
};
|
|
564
|
+
/** Keeps the always-on built-ins of `source` next to a scoped selection. */
|
|
565
|
+
const keepAlwaysOn = (scoped, source) => {
|
|
566
|
+
const kept = { ...scoped };
|
|
567
|
+
for (const name of ALWAYS_ON_BUILTINS) {
|
|
568
|
+
if (source[name])
|
|
569
|
+
kept[name] = source[name];
|
|
570
|
+
}
|
|
571
|
+
return kept;
|
|
572
|
+
};
|
|
573
|
+
/**
|
|
574
|
+
* The approval binder of a request, and the history with every approved
|
|
575
|
+
* call that this server did not issue (or that is expired or used) denied.
|
|
576
|
+
* Runs once the registry is known: whether tools can ask for approval
|
|
577
|
+
* decides if a missing secret is an error.
|
|
578
|
+
*/
|
|
579
|
+
/**
|
|
580
|
+
* Who an approval of this request is for: the managed principal, else the
|
|
581
|
+
* app's `approvalScope(req)` (encoded as a one-element JSON array, so it
|
|
582
|
+
* cannot equal a managed scope), else `''`: the approval is then bound to
|
|
583
|
+
* no user, and `storeScopeOf` keeps the quota per caller instead.
|
|
584
|
+
*/
|
|
585
|
+
async function requestApprovalScope(req, managedTurn) {
|
|
586
|
+
if (managedTurn)
|
|
587
|
+
return (0, approval_binding_js_1.approvalScope)(managedTurn.snapshot.principal);
|
|
588
|
+
if (!approvalScopeOf)
|
|
589
|
+
return '';
|
|
590
|
+
const scope = await approvalScopeOf(req);
|
|
591
|
+
if (typeof scope !== 'string')
|
|
592
|
+
throw new TypeError('approvalScope must return a string');
|
|
593
|
+
return JSON.stringify([scope]);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* The scope the approval store counts a request's approvals under. With a
|
|
597
|
+
* managed principal or `approvalScope`, the signed scope. Otherwise a key
|
|
598
|
+
* per caller derived from the request's credentials (`Authorization`, else
|
|
599
|
+
* `Cookie`), HMAC-ed with the approval secret and never kept raw, so one
|
|
600
|
+
* caller with fixed credentials cannot use up everyone's quota (varying
|
|
601
|
+
* them gives a fresh quota; only the store's global limit bounds that).
|
|
602
|
+
* It only partitions the quota: it
|
|
603
|
+
* is not signed into the approval id (a cookie may rotate between the
|
|
604
|
+
* approval request and its answer), and single use is checked by the
|
|
605
|
+
* approval id across all keys. A request without credentials has `''`.
|
|
606
|
+
*/
|
|
607
|
+
function storeScopeOf(req, scope, binder) {
|
|
608
|
+
if (scope !== '')
|
|
609
|
+
return scope;
|
|
610
|
+
const credentials = req.headers.get('authorization') ?? req.headers.get('cookie');
|
|
611
|
+
if (!credentials || !binder.callerQuotaKey)
|
|
612
|
+
return '';
|
|
613
|
+
return binder.callerQuotaKey(credentials);
|
|
614
|
+
}
|
|
615
|
+
async function secureApprovals(req, registry, messages, managedTurn, scope) {
|
|
616
|
+
const binder = (0, approval_binding_js_1.resolveApprovalBinder)({
|
|
617
|
+
secret: approvalSecret,
|
|
618
|
+
maxAgeMs: approvalMaxAgeMs,
|
|
619
|
+
scope,
|
|
620
|
+
// The managed policy and Lancer approvals can ask for approval of a
|
|
621
|
+
// tool that declares none.
|
|
622
|
+
hasApprovalTools: Boolean(managedTurn)
|
|
623
|
+
|| Boolean(lancer?.approvals)
|
|
624
|
+
|| Object.values(registry).some((tool) => Boolean(tool.needsApproval)),
|
|
625
|
+
});
|
|
626
|
+
const storeScope = storeScopeOf(req, scope, binder);
|
|
627
|
+
const checked = await (0, approval_binding_js_1.enforceApprovalBindings)(messages, {
|
|
628
|
+
binder, store: approvalStore, scope: storeScope, localToolNames: new Set(Object.keys(registry)),
|
|
629
|
+
});
|
|
630
|
+
return { binder, storeScope, messages: checked.messages, verified: checked.verified };
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* The tools handed to the stream handler, each one that can ask for
|
|
634
|
+
* approval behind the execution gate of this request: it runs only for an
|
|
635
|
+
* approval verified above (exact tool call id, tool name and input) or for
|
|
636
|
+
* a live call whose `needsApproval` said no. A managed policy can ask for
|
|
637
|
+
* approval of any domain tool, so with a managed turn every domain tool is
|
|
638
|
+
* gated; the handler's own built-ins are not.
|
|
639
|
+
*/
|
|
640
|
+
function gateTools(tools, verified, managedTurn, builtinNames) {
|
|
641
|
+
return (0, approval_binding_js_1.gateApprovalTools)(tools, (0, approval_binding_js_1.createApprovalExecutionGate)(verified), (name, tool) => Boolean(tool.needsApproval) || (Boolean(managedTurn) && !builtinNames.includes(name)));
|
|
642
|
+
}
|
|
352
643
|
async function handler(req) {
|
|
644
|
+
const refused = (0, request_guards_js_1.checkRequestHeaders)(req, { allowedOrigins, crossOriginProtection });
|
|
645
|
+
if (refused)
|
|
646
|
+
return refused;
|
|
353
647
|
reportDefaultsOnce();
|
|
648
|
+
let turnMetrics;
|
|
354
649
|
try {
|
|
355
|
-
const
|
|
356
|
-
if (!
|
|
650
|
+
const body = await (0, request_guards_js_1.readJsonBody)(req, maxBodyBytes);
|
|
651
|
+
if (!body.ok)
|
|
652
|
+
return body.response;
|
|
653
|
+
const { messages: requestMessages, glirastesClientActions } = body.value;
|
|
654
|
+
if (!Array.isArray(requestMessages)) {
|
|
357
655
|
return new Response(JSON.stringify({ error: 'messages must be an array' }), { status: 400, headers: { 'Content-Type': 'application/json' } });
|
|
358
656
|
}
|
|
657
|
+
// A history the AI SDK could read in two ways (a tool call id in two
|
|
658
|
+
// parts, a non-boolean approval answer) is refused before anything else.
|
|
659
|
+
try {
|
|
660
|
+
(0, approval_binding_js_1.assertUnambiguousToolHistory)(requestMessages);
|
|
661
|
+
}
|
|
662
|
+
catch (error) {
|
|
663
|
+
if (error instanceof approval_binding_js_1.ApprovalHistoryError)
|
|
664
|
+
return approvalHistoryRefusal(error);
|
|
665
|
+
throw error;
|
|
666
|
+
}
|
|
667
|
+
// A direct command (`/` command or entity action) runs its tool without
|
|
668
|
+
// the model; the model sees earlier commands only by their label.
|
|
669
|
+
const directCommand = directCommands ? (0, direct_command_js_1.resolveDirectCommand)(requestMessages) : undefined;
|
|
670
|
+
// A clarification answer resumes its original request: routing sees
|
|
671
|
+
// request + answer, the model sees an explicit continuation. The client
|
|
672
|
+
// session keeps the untouched messages.
|
|
673
|
+
const clarificationResume = directCommand ? undefined : (0, clarification_resume_js_1.resolveClarificationResume)(requestMessages);
|
|
674
|
+
const messages = directCommand
|
|
675
|
+
? requestMessages
|
|
676
|
+
: (0, direct_command_js_1.stripChatCommandMessages)(clarificationResume
|
|
677
|
+
? (0, clarification_resume_js_1.applyClarificationResume)(requestMessages, clarificationResume)
|
|
678
|
+
: requestMessages);
|
|
359
679
|
// Build tool context
|
|
360
|
-
const toolContext = (0, context_helpers_js_1.buildToolContext)(req, { locale });
|
|
680
|
+
const toolContext = (0, context_helpers_js_1.buildToolContext)(req, { locale, trustForwardedHeaders });
|
|
681
|
+
const clientActions = readClientActions(glirastesClientActions);
|
|
682
|
+
if (clientActions)
|
|
683
|
+
toolContext.runtime = { ...toolContext.runtime, clientActions };
|
|
361
684
|
const requestStart = Date.now();
|
|
685
|
+
const turnId = deriveSessionId(messages);
|
|
686
|
+
let managedTurn;
|
|
687
|
+
if (managedRuntime) {
|
|
688
|
+
const principalResult = index_js_2.PrincipalSchema.safeParse(await managedRuntime.resolvePrincipal(req));
|
|
689
|
+
if (!principalResult.success) {
|
|
690
|
+
return new Response(JSON.stringify({ error: 'Unauthorized' }), { status: 401, headers: { 'Content-Type': 'application/json' } });
|
|
691
|
+
}
|
|
692
|
+
const snapshot = await managedRuntime.resolveTurnSnapshot({
|
|
693
|
+
request: req,
|
|
694
|
+
turnId,
|
|
695
|
+
principal: principalResult.data,
|
|
696
|
+
});
|
|
697
|
+
if (snapshot.turnId !== turnId
|
|
698
|
+
|| snapshot.principal.subjectId !== principalResult.data.subjectId
|
|
699
|
+
|| snapshot.principal.tenantId !== principalResult.data.tenantId) {
|
|
700
|
+
return new Response(JSON.stringify({ error: 'Turn snapshot identity mismatch' }), { status: 403, headers: { 'Content-Type': 'application/json' } });
|
|
701
|
+
}
|
|
702
|
+
managedTurn = (0, index_js_3.createManagedTurnGuard)({
|
|
703
|
+
snapshot,
|
|
704
|
+
resolvePrincipal: async () => {
|
|
705
|
+
const current = index_js_2.PrincipalSchema.safeParse(await managedRuntime.resolvePrincipal(req));
|
|
706
|
+
return current.success ? current.data : undefined;
|
|
707
|
+
},
|
|
708
|
+
loadRevocations: managedRuntime.loadRevocations
|
|
709
|
+
? () => managedRuntime.loadRevocations({ request: req, snapshot })
|
|
710
|
+
: undefined,
|
|
711
|
+
onBudgetSignal: managedRuntime.onBudgetSignal,
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
turnMetrics = metrics
|
|
715
|
+
? (0, index_js_3.createTurnMetricsRecorder)({
|
|
716
|
+
sink: metrics,
|
|
717
|
+
snapshot: managedTurn?.snapshot,
|
|
718
|
+
startedAtMs: requestStart,
|
|
719
|
+
})
|
|
720
|
+
: undefined;
|
|
721
|
+
const buildDiscovery = async (registry, initialToolNames, handlerBuiltinNames) => {
|
|
722
|
+
if (!enableToolDiscovery)
|
|
723
|
+
return undefined;
|
|
724
|
+
// Handler-created SDK built-ins stay active next to the searchable
|
|
725
|
+
// domain tools: clarification whenever configured, follow-ups when
|
|
726
|
+
// this turn's pipeline selected them. Registry-supplied tools sharing
|
|
727
|
+
// a built-in's name are never listed here and stay discoverable only
|
|
728
|
+
// through the manifest-checked index.
|
|
729
|
+
const builtinToolNames = handlerBuiltinNames.filter((name) => ALWAYS_ON_BUILTINS.includes(name) || initialToolNames.includes(name));
|
|
730
|
+
if (!managedTurn) {
|
|
731
|
+
return (0, tool_discovery_js_1.createHybridToolDiscovery)({
|
|
732
|
+
discovery: (0, index_js_3.createRegistryToolDiscovery)({
|
|
733
|
+
turnId,
|
|
734
|
+
registry,
|
|
735
|
+
excludeNames: tool_discovery_js_1.NON_DOMAIN_TOOL_NAMES,
|
|
736
|
+
semantics: toolSemantics,
|
|
737
|
+
}),
|
|
738
|
+
initialToolNames,
|
|
739
|
+
builtinToolNames,
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
const revocations = managedRuntime?.loadRevocations
|
|
743
|
+
? await managedRuntime.loadRevocations({
|
|
744
|
+
request: req,
|
|
745
|
+
snapshot: managedTurn.snapshot,
|
|
746
|
+
})
|
|
747
|
+
: [];
|
|
748
|
+
const revokedToolIds = managedTurn.snapshot.manifestRevision.tools
|
|
749
|
+
.filter((tool) => (0, index_js_3.isToolRevoked)(managedTurn.snapshot, tool.toolId, revocations))
|
|
750
|
+
.map((tool) => tool.toolId);
|
|
751
|
+
return (0, tool_discovery_js_1.createHybridToolDiscovery)({
|
|
752
|
+
discovery: (0, index_js_3.createTurnToolDiscovery)({
|
|
753
|
+
snapshot: managedTurn.snapshot,
|
|
754
|
+
registry,
|
|
755
|
+
revokedToolIds,
|
|
756
|
+
semantics: toolSemantics,
|
|
757
|
+
}),
|
|
758
|
+
initialToolNames,
|
|
759
|
+
builtinToolNames,
|
|
760
|
+
});
|
|
761
|
+
};
|
|
362
762
|
// Derive session ID — stable per conversation turn (groups approval flows)
|
|
363
|
-
const sessionId = (onAudit || piiShield || telemetry) ?
|
|
763
|
+
const sessionId = (onAudit || piiShield || telemetry) ? turnId : '';
|
|
364
764
|
const toolOptions = {
|
|
365
765
|
uiActionSchema,
|
|
366
766
|
onError: onToolError,
|
|
@@ -393,12 +793,69 @@ function createAiChatHandler(config) {
|
|
|
393
793
|
}
|
|
394
794
|
}
|
|
395
795
|
// ================================================================
|
|
796
|
+
// Direct command: no routing, no guardrails, no model call. The tool
|
|
797
|
+
// runs on the registry and wrappers of a model turn, so authorization,
|
|
798
|
+
// confirmation, revocation, budget, audit, the PII shield and metrics
|
|
799
|
+
// stay the same.
|
|
800
|
+
// ================================================================
|
|
801
|
+
if (directCommand) {
|
|
802
|
+
const callEndpoint = endpointCaller(req);
|
|
803
|
+
const endpointToolContext = {
|
|
804
|
+
...toolContext,
|
|
805
|
+
callEndpoint,
|
|
806
|
+
...(managedTurn
|
|
807
|
+
? { turnSnapshot: managedTurn.snapshot }
|
|
808
|
+
: {}),
|
|
809
|
+
...contractRejectionReporter(turnMetrics),
|
|
810
|
+
};
|
|
811
|
+
const registry = staticTools ?? await loadTools(endpointToolContext);
|
|
812
|
+
const commandScope = await requestApprovalScope(req, managedTurn);
|
|
813
|
+
const { binder: commandBinder, storeScope: commandStoreScope } = await secureApprovals(req, registry, [], managedTurn, commandScope);
|
|
814
|
+
let commandTools = (0, index_js_1.toolsToAiTools)(registry, endpointToolContext, toolOptions);
|
|
815
|
+
// The result stays in the chat history that later model turns send to the model.
|
|
816
|
+
if (piiShield) {
|
|
817
|
+
commandTools = wrapToolsWithShield(commandTools, piiShield, sessionId);
|
|
818
|
+
}
|
|
819
|
+
if (lancer?.approvals) {
|
|
820
|
+
commandTools = wrapToolsWithLancerApprovals(commandTools, lancer.approvals, sessionId);
|
|
821
|
+
}
|
|
822
|
+
return await (0, direct_command_js_1.runDirectCommand)({
|
|
823
|
+
command: directCommand,
|
|
824
|
+
registry,
|
|
825
|
+
tools: commandTools,
|
|
826
|
+
managedTurn,
|
|
827
|
+
turnMetrics,
|
|
828
|
+
approvals: commandBinder,
|
|
829
|
+
approvalStore,
|
|
830
|
+
approvalScope: commandStoreScope,
|
|
831
|
+
onError: (error) => onError?.(error, req),
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
// ================================================================
|
|
396
835
|
// Pipeline mode
|
|
397
836
|
// ================================================================
|
|
837
|
+
// The app's own input check runs first in both modes, without any model call.
|
|
838
|
+
let processedMessages = messages;
|
|
839
|
+
if (guardrails) {
|
|
840
|
+
const check = await guardrails(messages);
|
|
841
|
+
if (!check.ok) {
|
|
842
|
+
return new Response(JSON.stringify({ error: check.reason ?? 'Invalid input' }), { status: 400, headers: { 'Content-Type': 'application/json' } });
|
|
843
|
+
}
|
|
844
|
+
if (check.sanitizedMessages) {
|
|
845
|
+
processedMessages = check.sanitizedMessages;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
398
848
|
if (pipeline) {
|
|
399
849
|
// Create callEndpoint for endpoint tools (needed regardless of static/dynamic)
|
|
400
|
-
const callEndpoint = (
|
|
401
|
-
const endpointToolContext = {
|
|
850
|
+
const callEndpoint = endpointCaller(req);
|
|
851
|
+
const endpointToolContext = {
|
|
852
|
+
...toolContext,
|
|
853
|
+
callEndpoint,
|
|
854
|
+
...(managedTurn
|
|
855
|
+
? { turnSnapshot: managedTurn.snapshot }
|
|
856
|
+
: {}),
|
|
857
|
+
...contractRejectionReporter(turnMetrics),
|
|
858
|
+
};
|
|
402
859
|
// Get tools (static or dynamic)
|
|
403
860
|
let registry;
|
|
404
861
|
if (staticTools) {
|
|
@@ -408,21 +865,24 @@ function createAiChatHandler(config) {
|
|
|
408
865
|
registry = await loadTools(endpointToolContext);
|
|
409
866
|
}
|
|
410
867
|
// Add followup tool if configured
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
registry = { ...registry, [followupTool.id]: followupTool };
|
|
415
|
-
}
|
|
868
|
+
const followupTool = followups ? (0, index_js_1.createFollowupTool)(followups) : null;
|
|
869
|
+
if (followupTool && !registry[followupTool.id]) {
|
|
870
|
+
registry = { ...registry, [followupTool.id]: followupTool };
|
|
416
871
|
}
|
|
872
|
+
registry = withAlwaysOnBuiltins(registry);
|
|
873
|
+
const handlerBuiltinNames = findHandlerBuiltins(registry, [followupTool, clarificationTool, planTool]);
|
|
874
|
+
const pipelineApprovals = await secureApprovals(req, registry, processedMessages, managedTurn, await requestApprovalScope(req, managedTurn));
|
|
875
|
+
processedMessages = pipelineApprovals.messages;
|
|
417
876
|
// Extract user input for pipeline
|
|
418
|
-
let userText =
|
|
877
|
+
let userText = clarificationResume?.routingText
|
|
878
|
+
?? extractLastUserText(processedMessages);
|
|
419
879
|
if (piiShield) {
|
|
420
880
|
userText = await piiShield.outbound(userText, sessionId);
|
|
421
881
|
}
|
|
422
882
|
// Build lightweight conversation history for intent classification.
|
|
423
883
|
// Include the last few user/assistant text exchanges (excluding the
|
|
424
884
|
// current message) so the classifier can understand follow-ups.
|
|
425
|
-
const conversationHistory = extractConversationHistory(
|
|
885
|
+
const conversationHistory = extractConversationHistory(processedMessages, maxConversationHistoryPairs);
|
|
426
886
|
// Run pipeline: guardrails + classification + routing + model selection
|
|
427
887
|
const pipelineResult = await pipeline.process(userText, toolContext, conversationHistory.length > 0 ? conversationHistory : undefined);
|
|
428
888
|
// Notify consumer about pipeline decision
|
|
@@ -470,21 +930,47 @@ function createAiChatHandler(config) {
|
|
|
470
930
|
// Telemetry is fire-and-forget
|
|
471
931
|
}
|
|
472
932
|
}
|
|
933
|
+
const hasExplicitSelection = pipelineResult.toolSelection === 'explicit';
|
|
934
|
+
const initialToolNames = pipelineResult.blocked
|
|
935
|
+
? []
|
|
936
|
+
: hasExplicitSelection || pipelineResult.tools.length > 0
|
|
937
|
+
? pipelineResult.tools
|
|
938
|
+
: Object.keys(registry);
|
|
939
|
+
const discoveryController = pipelineResult.blocked
|
|
940
|
+
? undefined
|
|
941
|
+
: await buildDiscovery(registry, initialToolNames, handlerBuiltinNames);
|
|
473
942
|
// Convert all tools to AI tools
|
|
474
943
|
let aiTools = await (0, index_js_1.toolsToAiTools)(registry, endpointToolContext, toolOptions);
|
|
944
|
+
const unscopedAiTools = aiTools;
|
|
475
945
|
// Scope tools to pipeline selection
|
|
476
946
|
if (pipelineResult.blocked) {
|
|
477
947
|
// Guardrails blocked — no tools allowed
|
|
478
948
|
aiTools = {};
|
|
479
949
|
}
|
|
480
|
-
else if (pipelineResult.tools.length > 0) {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
950
|
+
else if (!discoveryController && (hasExplicitSelection || pipelineResult.tools.length > 0)) {
|
|
951
|
+
aiTools = (0, scope_pipeline_tools_js_1.scopePipelineTools)({
|
|
952
|
+
aiTools,
|
|
953
|
+
registryToolNames: new Set(Object.keys(registry)),
|
|
954
|
+
selected: pipelineResult.tools,
|
|
955
|
+
fallbackToAll: !hasExplicitSelection,
|
|
956
|
+
});
|
|
957
|
+
// Clarification and the plan stay callable, also for an empty
|
|
958
|
+
// focused selection.
|
|
959
|
+
aiTools = keepAlwaysOn(aiTools, unscopedAiTools);
|
|
960
|
+
}
|
|
961
|
+
// An approval verified (and consumed) above answers a call that an
|
|
962
|
+
// earlier request already routed. Routing for this request must not
|
|
963
|
+
// turn that approved call into a tool error, so its tool stays in the
|
|
964
|
+
// set (the AI SDK runs approved calls from `tools`, not `activeTools`).
|
|
965
|
+
// Only tools with a verified approval come back; a new call to one of
|
|
966
|
+
// them still needs its own approval. A guardrail block keeps no tools,
|
|
967
|
+
// so the approved call then ends as a tool error and is not run.
|
|
968
|
+
if (!pipelineResult.blocked) {
|
|
969
|
+
for (const { toolName } of pipelineApprovals.verified) {
|
|
970
|
+
const approvedTool = unscopedAiTools[toolName];
|
|
971
|
+
if (approvedTool && !aiTools[toolName])
|
|
972
|
+
aiTools = { ...aiTools, [toolName]: approvedTool };
|
|
485
973
|
}
|
|
486
|
-
if (Object.keys(scoped).length > 0)
|
|
487
|
-
aiTools = scoped;
|
|
488
974
|
}
|
|
489
975
|
// Resolve model — config callback > pipeline instance > error
|
|
490
976
|
let model;
|
|
@@ -498,6 +984,7 @@ function createAiChatHandler(config) {
|
|
|
498
984
|
model = pipelineResult.model.instance;
|
|
499
985
|
}
|
|
500
986
|
else {
|
|
987
|
+
turnMetrics?.finish({ status: 'error', errorCode: 'pipeline_error' });
|
|
501
988
|
return new Response(JSON.stringify({
|
|
502
989
|
error: 'No model configured. Provide model on handler config or as instance on ModelSelectorConfig.',
|
|
503
990
|
}), { status: 500, headers: { 'Content-Type': 'application/json' } });
|
|
@@ -507,6 +994,7 @@ function createAiChatHandler(config) {
|
|
|
507
994
|
? systemPromptConfig({
|
|
508
995
|
pipelineResult,
|
|
509
996
|
currentDate: new Date(),
|
|
997
|
+
...(managedTurn ? { turnSnapshot: managedTurn.snapshot } : {}),
|
|
510
998
|
})
|
|
511
999
|
: systemPromptConfig;
|
|
512
1000
|
// Track the actual model ID used (may be overridden by Glirastes config)
|
|
@@ -546,10 +1034,11 @@ function createAiChatHandler(config) {
|
|
|
546
1034
|
moduleMaxSteps: pipelineResult.module?.executionDefaults?.maxSteps,
|
|
547
1035
|
configuredMaxSteps,
|
|
548
1036
|
safetyMaxSteps,
|
|
1037
|
+
runtimeBudgetMaxSteps: managedTurn?.snapshot.budget.maxModelSteps,
|
|
549
1038
|
});
|
|
550
1039
|
const contextWindow = pipelineResult.module?.executionDefaults?.contextWindow ??
|
|
551
1040
|
maxContextMessages;
|
|
552
|
-
let recentMessages =
|
|
1041
|
+
let recentMessages = processedMessages.slice(-contextWindow);
|
|
553
1042
|
// PII Shield: anonymize message history + wrap tools
|
|
554
1043
|
if (piiShield) {
|
|
555
1044
|
recentMessages = await anonymizeMessages(recentMessages, piiShield, sessionId);
|
|
@@ -559,13 +1048,16 @@ function createAiChatHandler(config) {
|
|
|
559
1048
|
if (lancer?.approvals) {
|
|
560
1049
|
aiTools = wrapToolsWithLancerApprovals(aiTools, lancer.approvals, sessionId);
|
|
561
1050
|
}
|
|
562
|
-
|
|
1051
|
+
aiTools = gateTools(aiTools, pipelineApprovals.verified, managedTurn, handlerBuiltinNames);
|
|
1052
|
+
const pipelineStreamHandler = createStreamHandler(req, (onAudit || telemetry) ? {
|
|
563
1053
|
sessionId,
|
|
564
1054
|
requestStart,
|
|
565
1055
|
modelId: resolvedModelId,
|
|
566
1056
|
} : undefined);
|
|
567
|
-
return pipelineStreamHandler({
|
|
568
|
-
tools:
|
|
1057
|
+
return await pipelineStreamHandler({
|
|
1058
|
+
tools: discoveryController
|
|
1059
|
+
? { ...aiTools, find_tools: discoveryController.tool }
|
|
1060
|
+
: aiTools,
|
|
569
1061
|
messages: recentMessages,
|
|
570
1062
|
systemPrompt,
|
|
571
1063
|
model,
|
|
@@ -579,25 +1071,29 @@ function createAiChatHandler(config) {
|
|
|
579
1071
|
modelTier: pipelineResult.model.modelId,
|
|
580
1072
|
pipelineResult,
|
|
581
1073
|
piiShield: piiShield ? { shield: piiShield, sessionId } : undefined,
|
|
1074
|
+
managedTurn,
|
|
1075
|
+
turnMetrics,
|
|
1076
|
+
modelPricing,
|
|
1077
|
+
toolDiscovery: discoveryController,
|
|
1078
|
+
handlerBuiltinToolNames: discoveryController
|
|
1079
|
+
? [...handlerBuiltinNames, 'find_tools']
|
|
1080
|
+
: handlerBuiltinNames,
|
|
1081
|
+
bindApprovalRequests: (stream) => (0, approval_binding_js_1.bindApprovalRequests)(stream, pipelineApprovals.binder),
|
|
582
1082
|
});
|
|
583
1083
|
}
|
|
584
1084
|
// ================================================================
|
|
585
1085
|
// Legacy mode (without pipeline)
|
|
586
1086
|
// ================================================================
|
|
587
|
-
// Guardrails
|
|
588
|
-
let processedMessages = messages;
|
|
589
|
-
if (guardrails) {
|
|
590
|
-
const check = await guardrails(messages);
|
|
591
|
-
if (!check.ok) {
|
|
592
|
-
return new Response(JSON.stringify({ error: check.reason ?? 'Invalid input' }), { status: 400, headers: { 'Content-Type': 'application/json' } });
|
|
593
|
-
}
|
|
594
|
-
if (check.sanitizedMessages) {
|
|
595
|
-
processedMessages = check.sanitizedMessages;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
1087
|
// Create callEndpoint for endpoint tools (needed regardless of static/dynamic)
|
|
599
|
-
const callEndpoint = (
|
|
600
|
-
const endpointToolContext = {
|
|
1088
|
+
const callEndpoint = endpointCaller(req);
|
|
1089
|
+
const endpointToolContext = {
|
|
1090
|
+
...toolContext,
|
|
1091
|
+
callEndpoint,
|
|
1092
|
+
...(managedTurn
|
|
1093
|
+
? { turnSnapshot: managedTurn.snapshot }
|
|
1094
|
+
: {}),
|
|
1095
|
+
...contractRejectionReporter(turnMetrics),
|
|
1096
|
+
};
|
|
601
1097
|
// Load tools
|
|
602
1098
|
let registry;
|
|
603
1099
|
if (staticTools) {
|
|
@@ -606,7 +1102,12 @@ function createAiChatHandler(config) {
|
|
|
606
1102
|
else {
|
|
607
1103
|
registry = await loadTools(endpointToolContext);
|
|
608
1104
|
}
|
|
609
|
-
|
|
1105
|
+
registry = withAlwaysOnBuiltins(registry);
|
|
1106
|
+
const handlerBuiltinNames = findHandlerBuiltins(registry, [clarificationTool, planTool]);
|
|
1107
|
+
const legacyApprovals = await secureApprovals(req, registry, processedMessages, managedTurn, await requestApprovalScope(req, managedTurn));
|
|
1108
|
+
processedMessages = legacyApprovals.messages;
|
|
1109
|
+
const allToolNames = Object.keys(registry)
|
|
1110
|
+
.filter((name) => !ALWAYS_ON_BUILTINS.includes(name));
|
|
610
1111
|
// PII Shield: anonymize for legacy mode
|
|
611
1112
|
const legacySessionId = piiShield ? deriveSessionId(processedMessages) : '';
|
|
612
1113
|
if (piiShield) {
|
|
@@ -616,7 +1117,8 @@ function createAiChatHandler(config) {
|
|
|
616
1117
|
// Intent routing
|
|
617
1118
|
let routing;
|
|
618
1119
|
if (intentRouter) {
|
|
619
|
-
const text =
|
|
1120
|
+
const text = clarificationResume?.routingText
|
|
1121
|
+
?? extractLastUserText(processedMessages);
|
|
620
1122
|
routing = await intentRouter(text, allToolNames);
|
|
621
1123
|
}
|
|
622
1124
|
// Convert to AI tools
|
|
@@ -628,11 +1130,19 @@ function createAiChatHandler(config) {
|
|
|
628
1130
|
if (aiTools[name])
|
|
629
1131
|
scoped[name] = aiTools[name];
|
|
630
1132
|
}
|
|
631
|
-
if (Object.keys(scoped).length > 0)
|
|
632
|
-
aiTools = scoped;
|
|
1133
|
+
if (Object.keys(scoped).length > 0) {
|
|
1134
|
+
aiTools = keepAlwaysOn(scoped, aiTools);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
const discoveryController = await buildDiscovery(registry, routing?.toolNames?.length ? routing.toolNames : allToolNames, handlerBuiltinNames);
|
|
1138
|
+
if (discoveryController) {
|
|
1139
|
+
// Discovery needs the full eligible server-side set; `activeTools`
|
|
1140
|
+
// preserves the intent router's fast initial scope.
|
|
1141
|
+
aiTools = await (0, index_js_1.toolsToAiTools)(registry, endpointToolContext, toolOptions);
|
|
633
1142
|
}
|
|
634
1143
|
// Resolve model + system prompt (legacy mode — no pipeline fallback)
|
|
635
1144
|
if (!modelConfig) {
|
|
1145
|
+
turnMetrics?.finish({ status: 'error', errorCode: 'pipeline_error' });
|
|
636
1146
|
return new Response(JSON.stringify({
|
|
637
1147
|
error: 'No model configured. In legacy mode (without pipeline), model is required.',
|
|
638
1148
|
}), { status: 500, headers: { 'Content-Type': 'application/json' } });
|
|
@@ -644,11 +1154,13 @@ function createAiChatHandler(config) {
|
|
|
644
1154
|
? systemPromptConfig({
|
|
645
1155
|
routing,
|
|
646
1156
|
currentDate: new Date(),
|
|
1157
|
+
...(managedTurn ? { turnSnapshot: managedTurn.snapshot } : {}),
|
|
647
1158
|
})
|
|
648
1159
|
: systemPromptConfig;
|
|
649
1160
|
const stepLimit = resolveStepLimit({
|
|
650
1161
|
configuredMaxSteps: routing?.maxSteps ?? configuredMaxSteps,
|
|
651
1162
|
safetyMaxSteps,
|
|
1163
|
+
runtimeBudgetMaxSteps: managedTurn?.snapshot.budget.maxModelSteps,
|
|
652
1164
|
});
|
|
653
1165
|
const contextWindow = routing?.contextWindow ?? maxContextMessages;
|
|
654
1166
|
let recentMessages = processedMessages.slice(-contextWindow);
|
|
@@ -661,13 +1173,16 @@ function createAiChatHandler(config) {
|
|
|
661
1173
|
if (lancer?.approvals) {
|
|
662
1174
|
aiTools = wrapToolsWithLancerApprovals(aiTools, lancer.approvals, legacySessionId || sessionId);
|
|
663
1175
|
}
|
|
664
|
-
|
|
1176
|
+
aiTools = gateTools(aiTools, legacyApprovals.verified, managedTurn, handlerBuiltinNames);
|
|
1177
|
+
const legacyStreamHandler = createStreamHandler(req, (onAudit || telemetry) ? {
|
|
665
1178
|
sessionId: legacySessionId || sessionId,
|
|
666
1179
|
requestStart,
|
|
667
1180
|
} : undefined);
|
|
668
1181
|
// Delegate streaming to consumer's handler
|
|
669
|
-
return legacyStreamHandler({
|
|
670
|
-
tools:
|
|
1182
|
+
return await legacyStreamHandler({
|
|
1183
|
+
tools: discoveryController
|
|
1184
|
+
? { ...aiTools, find_tools: discoveryController.tool }
|
|
1185
|
+
: aiTools,
|
|
671
1186
|
messages: recentMessages,
|
|
672
1187
|
systemPrompt,
|
|
673
1188
|
model,
|
|
@@ -681,10 +1196,26 @@ function createAiChatHandler(config) {
|
|
|
681
1196
|
modelTier: routing?.modelTier,
|
|
682
1197
|
routing,
|
|
683
1198
|
piiShield: piiShield ? { shield: piiShield, sessionId: legacySessionId } : undefined,
|
|
1199
|
+
managedTurn,
|
|
1200
|
+
turnMetrics,
|
|
1201
|
+
modelPricing,
|
|
1202
|
+
toolDiscovery: discoveryController,
|
|
1203
|
+
handlerBuiltinToolNames: discoveryController
|
|
1204
|
+
? [...handlerBuiltinNames, 'find_tools']
|
|
1205
|
+
: handlerBuiltinNames,
|
|
1206
|
+
bindApprovalRequests: (stream) => (0, approval_binding_js_1.bindApprovalRequests)(stream, legacyApprovals.binder),
|
|
684
1207
|
});
|
|
685
1208
|
}
|
|
686
1209
|
catch (error) {
|
|
1210
|
+
if (error instanceof approval_binding_js_1.ApprovalHistoryError) {
|
|
1211
|
+
turnMetrics?.finish({ status: 'error', errorCode: 'pipeline_error' });
|
|
1212
|
+
return approvalHistoryRefusal(error);
|
|
1213
|
+
}
|
|
1214
|
+
turnMetrics?.finish({ status: 'error', errorCode: 'pipeline_error' });
|
|
687
1215
|
onError?.(error, req);
|
|
1216
|
+
if (error instanceof approval_binding_js_1.ApprovalSecretMissingError) {
|
|
1217
|
+
return new Response(JSON.stringify({ error: error.code, message: error.message }), { status: 500, headers: { 'Content-Type': 'application/json' } });
|
|
1218
|
+
}
|
|
688
1219
|
return new Response(JSON.stringify({ error: 'AI request failed' }), { status: 500, headers: { 'Content-Type': 'application/json' } });
|
|
689
1220
|
}
|
|
690
1221
|
}
|
|
@@ -693,6 +1224,14 @@ function createAiChatHandler(config) {
|
|
|
693
1224
|
}
|
|
694
1225
|
return handler;
|
|
695
1226
|
}
|
|
1227
|
+
/**
|
|
1228
|
+
* SDK built-ins whose tool instance the handler itself put into the registry.
|
|
1229
|
+
* Instance identity decides, not the name: a registry- or manifest-supplied
|
|
1230
|
+
* tool that shares a built-in's name is never listed and stays fully guarded.
|
|
1231
|
+
*/
|
|
1232
|
+
function findHandlerBuiltins(registry, created) {
|
|
1233
|
+
return tool_discovery_js_1.NON_DOMAIN_TOOL_NAMES.filter((name) => created.some((tool) => tool !== null && registry[name] === tool));
|
|
1234
|
+
}
|
|
696
1235
|
// ============================================================================
|
|
697
1236
|
// PII Shield Helpers
|
|
698
1237
|
// ============================================================================
|
|
@@ -705,7 +1244,10 @@ function deriveSessionId(messages) {
|
|
|
705
1244
|
return `ai-${msg.id}`;
|
|
706
1245
|
}
|
|
707
1246
|
}
|
|
708
|
-
return `ai-${
|
|
1247
|
+
return `ai-${globalThis.crypto.randomUUID()}`;
|
|
1248
|
+
}
|
|
1249
|
+
function approvalHistoryRefusal(error) {
|
|
1250
|
+
return new Response(JSON.stringify({ error: error.code, message: error.message }), { status: 400, headers: { 'Content-Type': 'application/json' } });
|
|
709
1251
|
}
|
|
710
1252
|
async function anonymizeMessages(messages, shield, sessionId) {
|
|
711
1253
|
const result = [];
|
|
@@ -715,9 +1257,10 @@ async function anonymizeMessages(messages, shield, sessionId) {
|
|
|
715
1257
|
continue;
|
|
716
1258
|
}
|
|
717
1259
|
const record = msg;
|
|
718
|
-
// Only anonymize
|
|
1260
|
+
// Only user messages carry text to anonymize; of the others, only the
|
|
1261
|
+
// arguments of a direct command's tool call are the user's own words.
|
|
719
1262
|
if (record.role !== 'user') {
|
|
720
|
-
result.push(
|
|
1263
|
+
result.push(await (0, direct_command_js_1.pseudonymizeCommandToolInputs)(record, shield, sessionId));
|
|
721
1264
|
continue;
|
|
722
1265
|
}
|
|
723
1266
|
// Anonymize string content
|
|
@@ -963,3 +1506,14 @@ function extractTextFromMessage(msg) {
|
|
|
963
1506
|
}
|
|
964
1507
|
return texts.join(' ');
|
|
965
1508
|
}
|
|
1509
|
+
/**
|
|
1510
|
+
* The client actions the chat reported for the open page, or undefined when
|
|
1511
|
+
* the report is missing or malformed (then client-action tools run as before).
|
|
1512
|
+
*/
|
|
1513
|
+
function readClientActions(value) {
|
|
1514
|
+
if (!Array.isArray(value) || value.length > 500)
|
|
1515
|
+
return undefined;
|
|
1516
|
+
if (!value.every((id) => typeof id === 'string' && id.length > 0 && id.length <= 200))
|
|
1517
|
+
return undefined;
|
|
1518
|
+
return value;
|
|
1519
|
+
}
|