veryfront 0.1.149 → 0.1.150
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/esm/cli/commands/dev/command.js +3 -3
- package/esm/cli/commands/workflow/command-help.js +1 -1
- package/esm/cli/commands/workflow/command.js +2 -2
- package/esm/cli/shared/config.d.ts.map +1 -1
- package/esm/cli/shared/config.js +1 -3
- package/esm/deno.d.ts +5 -11
- package/esm/deno.js +16 -16
- package/esm/src/agent/chat-handler.js +1 -1
- package/esm/src/agent/composition/composition.d.ts +1 -1
- package/esm/src/agent/composition/composition.d.ts.map +1 -1
- package/esm/src/agent/composition/composition.js +2 -2
- package/esm/src/agent/{ai-defaults.d.ts → defaults.d.ts} +1 -1
- package/esm/src/agent/defaults.d.ts.map +1 -0
- package/esm/src/agent/factory.js +1 -1
- package/esm/src/agent/react/index.d.ts +1 -1
- package/esm/src/agent/react/index.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/browser-inference/browser-engine.d.ts +5 -6
- package/esm/src/agent/react/use-chat/browser-inference/browser-engine.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/browser-inference/browser-engine.js +1 -1
- package/esm/src/agent/react/use-chat/index.d.ts +2 -1
- package/esm/src/agent/react/use-chat/index.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/stream-protocol.d.ts +2 -0
- package/esm/src/agent/react/use-chat/stream-protocol.d.ts.map +1 -0
- package/esm/src/agent/react/use-chat/stream-protocol.js +1 -0
- package/esm/src/agent/react/use-chat/streaming/parts-builder.d.ts +2 -2
- package/esm/src/agent/react/use-chat/streaming/parts-builder.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/streaming/types.d.ts +4 -4
- package/esm/src/agent/react/use-chat/streaming/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/types.d.ts +7 -55
- package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts +4 -4
- package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +2 -2
- package/esm/src/agent/react/use-chat/utils.d.ts +2 -2
- package/esm/src/agent/react/use-chat/utils.d.ts.map +1 -1
- package/esm/src/agent/runtime/{ai-stream-handler.d.ts → chat-stream-handler.d.ts} +13 -13
- package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -0
- package/esm/src/agent/runtime/{ai-stream-handler.js → chat-stream-handler.js} +91 -89
- package/esm/src/agent/runtime/constants.js +1 -1
- package/esm/src/agent/runtime/index.d.ts +7 -5
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +67 -30
- package/esm/src/agent/runtime/model-message-converter.d.ts +7 -7
- package/esm/src/agent/runtime/model-message-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-message-converter.js +8 -6
- package/esm/src/agent/runtime/model-runtime-types.d.ts +44 -0
- package/esm/src/agent/runtime/model-runtime-types.d.ts.map +1 -0
- package/esm/src/agent/runtime/model-runtime-types.js +8 -0
- package/esm/src/agent/runtime/model-tool-converter.d.ts +9 -9
- package/esm/src/agent/runtime/model-tool-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-tool-converter.js +10 -22
- package/esm/src/agent/runtime/provider-native-tools.d.ts +3 -0
- package/esm/src/agent/runtime/provider-native-tools.d.ts.map +1 -0
- package/esm/src/agent/runtime/provider-native-tools.js +56 -0
- package/esm/src/agent/runtime/repair-tool-call.d.ts +2 -2
- package/esm/src/agent/runtime/repair-tool-call.d.ts.map +1 -1
- package/esm/src/agent/runtime/repair-tool-call.js +3 -3
- package/esm/src/agent/runtime/runtime-tool-builder.d.ts +48 -0
- package/esm/src/agent/runtime/runtime-tool-builder.d.ts.map +1 -0
- package/esm/src/agent/runtime/runtime-tool-builder.js +28 -0
- package/esm/src/agent/runtime/runtime-tool-errors.d.ts +16 -0
- package/esm/src/agent/runtime/runtime-tool-errors.d.ts.map +1 -0
- package/esm/src/agent/runtime/runtime-tool-errors.js +28 -0
- package/esm/src/agent/runtime/runtime-tool-types.d.ts +104 -0
- package/esm/src/agent/runtime/runtime-tool-types.d.ts.map +1 -0
- package/esm/src/agent/runtime/runtime-tool-types.js +7 -0
- package/esm/src/chat/index.d.ts +9 -9
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +7 -7
- package/esm/src/chat/protocol.d.ts +156 -0
- package/esm/src/chat/protocol.d.ts.map +1 -0
- package/esm/src/chat/protocol.js +7 -0
- package/esm/src/discovery/import-rewriter.d.ts.map +1 -1
- package/esm/src/discovery/import-rewriter.js +1 -14
- package/esm/src/discovery/index.d.ts +1 -1
- package/esm/src/discovery/index.d.ts.map +1 -1
- package/esm/src/discovery/index.js +2 -2
- package/esm/src/discovery/provider-config-validator.d.ts +14 -0
- package/esm/src/discovery/provider-config-validator.d.ts.map +1 -0
- package/esm/src/discovery/{config-validator.js → provider-config-validator.js} +4 -4
- package/esm/src/discovery/transpiler.d.ts.map +1 -1
- package/esm/src/discovery/transpiler.js +0 -3
- package/esm/src/embedding/embedding.d.ts.map +1 -1
- package/esm/src/embedding/embedding.js +1 -1
- package/esm/src/embedding/index.d.ts +3 -3
- package/esm/src/embedding/index.d.ts.map +1 -1
- package/esm/src/embedding/index.js +3 -3
- package/esm/src/embedding/rag-store.d.ts.map +1 -1
- package/esm/src/embedding/rag-store.js +1 -1
- package/esm/src/embedding/resolve.d.ts +5 -7
- package/esm/src/embedding/resolve.d.ts.map +1 -1
- package/esm/src/embedding/resolve.js +6 -9
- package/esm/src/embedding/vector-store.d.ts.map +1 -1
- package/esm/src/embedding/vector-store.js +1 -1
- package/esm/src/embedding/veryfront-cloud/provider.d.ts +2 -2
- package/esm/src/embedding/veryfront-cloud/provider.d.ts.map +1 -1
- package/esm/src/embedding/veryfront-cloud/provider.js +5 -6
- package/esm/src/markdown/index.d.ts +1 -1
- package/esm/src/markdown/index.d.ts.map +1 -1
- package/esm/src/markdown/index.js +1 -1
- package/esm/src/modules/import-map/default-import-map.js +2 -2
- package/esm/src/prompt/registry.d.ts +1 -1
- package/esm/src/prompt/registry.d.ts.map +1 -1
- package/esm/src/prompt/registry.js +2 -2
- package/esm/src/provider/index.d.ts +7 -8
- package/esm/src/provider/index.d.ts.map +1 -1
- package/esm/src/provider/index.js +6 -8
- package/esm/src/provider/local/embedding-runtime-adapter.d.ts +19 -0
- package/esm/src/provider/local/embedding-runtime-adapter.d.ts.map +1 -0
- package/esm/src/provider/local/{local-embedding-adapter.js → embedding-runtime-adapter.js} +5 -5
- package/esm/src/provider/local/model-runtime-adapter.d.ts +18 -0
- package/esm/src/provider/local/model-runtime-adapter.d.ts.map +1 -0
- package/esm/src/provider/local/{ai-sdk-adapter.js → model-runtime-adapter.js} +10 -12
- package/esm/src/provider/model-registry.d.ts +11 -12
- package/esm/src/provider/model-registry.d.ts.map +1 -1
- package/esm/src/provider/model-registry.js +17 -20
- package/esm/src/provider/runtime-inspection.d.ts +6 -0
- package/esm/src/provider/runtime-inspection.d.ts.map +1 -0
- package/esm/src/provider/runtime-inspection.js +19 -0
- package/esm/src/provider/runtime-loader.d.ts +27 -0
- package/esm/src/provider/runtime-loader.d.ts.map +1 -0
- package/esm/src/provider/runtime-loader.js +1307 -0
- package/esm/src/provider/types.d.ts +35 -0
- package/esm/src/provider/types.d.ts.map +1 -0
- package/esm/src/provider/types.js +1 -0
- package/esm/src/provider/veryfront-cloud/provider.d.ts +2 -2
- package/esm/src/provider/veryfront-cloud/provider.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/provider.js +7 -9
- package/esm/src/provider/veryfront-cloud/shared.d.ts +1 -1
- package/esm/src/provider/veryfront-cloud/shared.js +1 -1
- package/esm/src/react/components/chat/agent-card.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/animations.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/branch-picker.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/code-block.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/drop-zone.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/empty-state.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/inference-badge.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/components/inference-badge.js +1 -1
- package/esm/src/react/components/chat/chat/components/inline-citation.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/message-actions.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/message-edit-form.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/message-feedback.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/quick-actions.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/reasoning.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/components/skill-badge.d.ts +3 -3
- package/esm/src/react/components/chat/chat/components/skill-badge.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/components/skill-badge.js +1 -1
- package/esm/src/react/components/chat/chat/components/sources.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/step-indicator.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/tab-switcher.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/components/tool-ui.d.ts +3 -3
- package/esm/src/react/components/chat/chat/components/tool-ui.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/components/tool-ui.js +1 -1
- package/esm/src/react/components/chat/chat/components/upgrade-cta.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/uploads-panel.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/api.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/api.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/api.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-composer.d.ts +3 -3
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-composer.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-empty.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-empty.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-if.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-if.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-if.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-message-list.d.ts +5 -5
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-message-list.js +2 -2
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-root.d.ts +3 -3
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/chat-root.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/composition/error-banner.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/error-banner.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/error-banner.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/composition/message.d.ts +4 -4
- package/esm/src/react/components/chat/chat/composition/message.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/message.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/composition/model-avatar.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/model-avatar.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/composition/model-avatar.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/contexts/chat-context.d.ts +3 -3
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/contexts/chat-context.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/contexts/composer-context.d.ts +1 -1
- package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/contexts/composer-context.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/contexts/index.d.ts +1 -1
- package/esm/src/react/components/chat/chat/contexts/index.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/contexts/index.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/contexts/message-context.d.ts +3 -3
- package/esm/src/react/components/chat/chat/contexts/message-context.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/contexts/message-context.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/contexts/thread-list-context.d.ts +1 -1
- package/esm/src/react/components/chat/chat/contexts/thread-list-context.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/contexts/thread-list-context.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/hooks/use-threads.d.ts +2 -2
- package/esm/src/react/components/chat/chat/hooks/use-threads.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/index.d.ts +5 -5
- package/esm/src/react/components/chat/chat/index.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/index.js +1 -1
- package/esm/src/react/components/chat/chat/utils/export.d.ts +10 -0
- package/esm/src/react/components/chat/chat/utils/export.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/utils/export.js +1 -1
- package/esm/src/react/components/{ai → chat}/chat/utils/message-parts.d.ts +10 -10
- package/esm/src/react/components/chat/chat/utils/message-parts.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat/utils/message-parts.js +2 -2
- package/esm/src/react/components/chat/chat-with-sidebar.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat.d.ts +1 -1
- package/esm/src/react/components/chat/chat.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/chat.js +1 -1
- package/esm/src/react/components/chat/csp-nonce.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/error-boundary.d.ts +6 -6
- package/esm/src/react/components/chat/error-boundary.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/error-boundary.js +5 -5
- package/esm/src/react/components/{ai → chat}/icons/index.d.ts +1 -1
- package/esm/src/react/components/chat/icons/index.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/icons/index.js +1 -1
- package/esm/src/react/components/chat/markdown.d.ts.map +1 -0
- package/esm/src/react/components/{ai → chat}/message.d.ts +8 -8
- package/esm/src/react/components/chat/message.d.ts.map +1 -0
- package/esm/src/react/components/chat/model-selector.d.ts.map +1 -0
- package/esm/src/react/components/chat/theme.d.ts.map +1 -0
- package/esm/src/react/primitives/message-list.d.ts +2 -2
- package/esm/src/react/primitives/message-list.d.ts.map +1 -1
- package/esm/src/react/primitives/tool-primitives.d.ts +3 -3
- package/esm/src/react/primitives/tool-primitives.d.ts.map +1 -1
- package/esm/src/{ai/registry-manager.d.ts → registry/project-scoped-registry-manager.d.ts} +5 -4
- package/esm/src/registry/project-scoped-registry-manager.d.ts.map +1 -0
- package/esm/src/{ai/registry-manager.js → registry/project-scoped-registry-manager.js} +5 -4
- package/esm/src/{ai/registry-facade.d.ts → registry/scoped-registry-facade.d.ts} +2 -2
- package/esm/src/registry/scoped-registry-facade.d.ts.map +1 -0
- package/esm/src/rendering/script-page-handling.d.ts.map +1 -1
- package/esm/src/rendering/script-page-handling.js +0 -2
- package/esm/src/resource/registry.d.ts +1 -1
- package/esm/src/resource/registry.d.ts.map +1 -1
- package/esm/src/resource/registry.js +2 -2
- package/esm/src/routing/api/module-loader/loader.js +3 -19
- package/esm/src/runtime/runtime-bridge.d.ts +82 -0
- package/esm/src/runtime/runtime-bridge.d.ts.map +1 -0
- package/esm/src/runtime/runtime-bridge.js +367 -0
- package/esm/src/server/dev-server/file-watch-setup.d.ts +4 -4
- package/esm/src/server/dev-server/file-watch-setup.d.ts.map +1 -1
- package/esm/src/server/dev-server/file-watch-setup.js +14 -14
- package/esm/src/server/dev-server/server.d.ts +2 -2
- package/esm/src/server/dev-server/server.d.ts.map +1 -1
- package/esm/src/server/dev-server/server.js +20 -18
- package/esm/src/server/dev-ui/manifest.d.ts +1 -1
- package/esm/src/server/dev-ui/manifest.js +2 -2
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +58 -61
- package/esm/src/server/handlers/request/api/api-handler-wrapper.js +1 -1
- package/esm/src/server/handlers/request/api/project-discovery.d.ts +1 -1
- package/esm/src/server/handlers/request/api/project-discovery.d.ts.map +1 -1
- package/esm/src/server/handlers/request/api/project-discovery.js +12 -10
- package/esm/src/server/production-server.js +2 -2
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +2 -2
- package/esm/src/skill/registry.d.ts +1 -1
- package/esm/src/skill/registry.d.ts.map +1 -1
- package/esm/src/skill/registry.js +2 -2
- package/esm/src/tool/registry.d.ts +1 -1
- package/esm/src/tool/registry.d.ts.map +1 -1
- package/esm/src/tool/registry.js +2 -2
- package/esm/src/transforms/npm-import-rewrites.d.ts +1 -1
- package/esm/src/transforms/npm-import-rewrites.d.ts.map +1 -1
- package/esm/src/transforms/npm-import-rewrites.js +5 -13
- package/esm/src/utils/constants/server.d.ts +4 -4
- package/esm/src/utils/constants/server.d.ts.map +1 -1
- package/esm/src/utils/constants/server.js +4 -4
- package/esm/src/utils/id.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/discovery/workflow-discovery.d.ts +3 -3
- package/esm/src/workflow/discovery/workflow-discovery.d.ts.map +1 -1
- package/esm/src/workflow/discovery/workflow-discovery.js +3 -3
- package/esm/src/workflow/registry.d.ts +1 -1
- package/esm/src/workflow/registry.d.ts.map +1 -1
- package/esm/src/workflow/registry.js +2 -2
- package/package.json +4 -5
- package/src/cli/commands/dev/command.ts +3 -3
- package/src/cli/commands/workflow/command-help.ts +1 -1
- package/src/cli/commands/workflow/command.ts +2 -2
- package/src/cli/shared/config.ts +1 -3
- package/src/deno.js +16 -16
- package/src/src/agent/chat-handler.ts +1 -1
- package/src/src/agent/composition/composition.ts +2 -2
- package/src/src/agent/factory.ts +1 -1
- package/src/src/agent/react/index.ts +11 -9
- package/src/src/agent/react/use-chat/browser-inference/browser-engine.ts +9 -10
- package/src/src/agent/react/use-chat/index.ts +10 -9
- package/src/src/agent/react/use-chat/stream-protocol.ts +1 -0
- package/src/src/agent/react/use-chat/streaming/handler.ts +17 -17
- package/src/src/agent/react/use-chat/streaming/parts-builder.ts +5 -5
- package/src/src/agent/react/use-chat/streaming/types.ts +4 -4
- package/src/src/agent/react/use-chat/types.ts +27 -73
- package/src/src/agent/react/use-chat/use-chat.ts +13 -13
- package/src/src/agent/react/use-chat/utils.ts +2 -2
- package/src/src/agent/runtime/{ai-stream-handler.ts → chat-stream-handler.ts} +100 -96
- package/src/src/agent/runtime/constants.ts +1 -1
- package/src/src/agent/runtime/index.ts +88 -40
- package/src/src/agent/runtime/model-message-converter.ts +22 -33
- package/src/src/agent/runtime/model-runtime-types.ts +55 -0
- package/src/src/agent/runtime/model-tool-converter.ts +29 -26
- package/src/src/agent/runtime/provider-native-tools.ts +61 -0
- package/src/src/agent/runtime/repair-tool-call.ts +6 -9
- package/src/src/agent/runtime/runtime-tool-builder.ts +82 -0
- package/src/src/agent/runtime/runtime-tool-errors.ts +46 -0
- package/src/src/agent/runtime/runtime-tool-types.ts +114 -0
- package/src/src/chat/index.ts +22 -20
- package/src/src/chat/protocol.ts +210 -0
- package/src/src/discovery/import-rewriter.ts +1 -14
- package/src/src/discovery/index.ts +2 -2
- package/src/src/discovery/{config-validator.ts → provider-config-validator.ts} +4 -4
- package/src/src/discovery/transpiler.ts +0 -3
- package/src/src/embedding/embedding.ts +1 -1
- package/src/src/embedding/index.ts +3 -3
- package/src/src/embedding/rag-store.ts +1 -1
- package/src/src/embedding/resolve.ts +15 -12
- package/src/src/embedding/vector-store.ts +1 -1
- package/src/src/embedding/veryfront-cloud/provider.ts +10 -8
- package/src/src/markdown/index.ts +1 -1
- package/src/src/modules/import-map/default-import-map.ts +2 -2
- package/src/src/prompt/registry.ts +2 -2
- package/src/src/provider/index.ts +7 -8
- package/src/src/provider/local/{local-embedding-adapter.ts → embedding-runtime-adapter.ts} +8 -8
- package/src/src/provider/local/{ai-sdk-adapter.ts → model-runtime-adapter.ts} +13 -16
- package/src/src/provider/model-registry.ts +31 -26
- package/src/src/provider/runtime-inspection.ts +25 -0
- package/src/src/provider/runtime-loader.ts +1854 -0
- package/src/src/provider/types.ts +38 -0
- package/src/src/provider/veryfront-cloud/provider.ts +13 -11
- package/src/src/provider/veryfront-cloud/shared.ts +1 -1
- package/src/src/react/components/{ai → chat}/chat/components/inference-badge.tsx +1 -1
- package/src/src/react/components/{ai → chat}/chat/components/skill-badge.tsx +3 -3
- package/src/src/react/components/{ai → chat}/chat/components/tool-ui.tsx +3 -3
- package/src/src/react/components/{ai → chat}/chat/composition/api.tsx +1 -1
- package/src/src/react/components/{ai → chat}/chat/composition/chat-composer.tsx +3 -3
- package/src/src/react/components/{ai → chat}/chat/composition/chat-empty.tsx +1 -1
- package/src/src/react/components/{ai → chat}/chat/composition/chat-if.tsx +1 -1
- package/src/src/react/components/{ai → chat}/chat/composition/chat-message-list.tsx +11 -11
- package/src/src/react/components/{ai → chat}/chat/composition/chat-root.tsx +3 -3
- package/src/src/react/components/{ai → chat}/chat/composition/error-banner.tsx +1 -1
- package/src/src/react/components/{ai → chat}/chat/composition/message.tsx +9 -4
- package/src/src/react/components/{ai → chat}/chat/composition/model-avatar.tsx +1 -1
- package/src/src/react/components/{ai → chat}/chat/contexts/chat-context.tsx +3 -3
- package/src/src/react/components/{ai → chat}/chat/contexts/composer-context.tsx +1 -1
- package/src/src/react/components/{ai → chat}/chat/contexts/index.ts +1 -1
- package/src/src/react/components/{ai → chat}/chat/contexts/message-context.tsx +3 -3
- package/src/src/react/components/{ai → chat}/chat/contexts/thread-list-context.tsx +1 -1
- package/src/src/react/components/{ai → chat}/chat/hooks/use-threads.ts +2 -2
- package/src/src/react/components/{ai → chat}/chat/index.tsx +7 -7
- package/src/src/react/components/{ai → chat}/chat/utils/export.ts +4 -4
- package/src/src/react/components/{ai → chat}/chat/utils/message-parts.ts +13 -13
- package/src/src/react/components/{ai → chat}/chat.tsx +1 -1
- package/src/src/react/components/{ai → chat}/error-boundary.tsx +11 -11
- package/src/src/react/components/{ai → chat}/icons/index.ts +1 -1
- package/src/src/react/components/{ai → chat}/message.tsx +11 -11
- package/src/src/react/primitives/message-list.tsx +2 -2
- package/src/src/react/primitives/tool-primitives.tsx +4 -4
- package/src/src/{ai/registry-manager.ts → registry/project-scoped-registry-manager.ts} +5 -4
- package/src/src/{ai/registry-facade.ts → registry/scoped-registry-facade.ts} +1 -1
- package/src/src/rendering/script-page-handling.ts +0 -2
- package/src/src/resource/registry.ts +2 -2
- package/src/src/routing/api/module-loader/loader.ts +3 -19
- package/src/src/runtime/runtime-bridge.ts +608 -0
- package/src/src/server/dev-server/file-watch-setup.ts +14 -14
- package/src/src/server/dev-server/server.ts +20 -18
- package/src/src/server/dev-ui/manifest.js +2 -2
- package/src/src/server/handlers/dev/framework-candidates.generated.ts +58 -61
- package/src/src/server/handlers/request/api/api-handler-wrapper.ts +1 -1
- package/src/src/server/handlers/request/api/project-discovery.ts +12 -10
- package/src/src/server/production-server.ts +2 -2
- package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +2 -2
- package/src/src/skill/registry.ts +2 -2
- package/src/src/tool/registry.ts +2 -2
- package/src/src/transforms/npm-import-rewrites.ts +5 -13
- package/src/src/utils/constants/server.ts +4 -4
- package/src/src/utils/id.ts +1 -1
- package/src/src/utils/version-constant.ts +1 -1
- package/src/src/workflow/discovery/workflow-discovery.ts +4 -4
- package/src/src/workflow/registry.ts +2 -2
- package/esm/src/agent/ai-defaults.d.ts.map +0 -1
- package/esm/src/agent/runtime/ai-stream-handler.d.ts.map +0 -1
- package/esm/src/ai/registry-facade.d.ts.map +0 -1
- package/esm/src/ai/registry-manager.d.ts.map +0 -1
- package/esm/src/discovery/config-validator.d.ts +0 -14
- package/esm/src/discovery/config-validator.d.ts.map +0 -1
- package/esm/src/provider/local/ai-sdk-adapter.d.ts +0 -19
- package/esm/src/provider/local/ai-sdk-adapter.d.ts.map +0 -1
- package/esm/src/provider/local/local-embedding-adapter.d.ts +0 -19
- package/esm/src/provider/local/local-embedding-adapter.d.ts.map +0 -1
- package/esm/src/react/components/ai/agent-card.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/animations.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/attachment-pill.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/branch-picker.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/code-block.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/drop-zone.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/empty-state.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/inference-badge.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/inline-citation.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/message-actions.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/message-edit-form.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/message-feedback.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/quick-actions.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/reasoning.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/sidebar.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/skill-badge.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/sources.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/step-indicator.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/tab-switcher.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/tool-ui.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/upgrade-cta.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/components/uploads-panel.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/api.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/chat-composer.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/chat-empty.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/chat-if.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/chat-message-list.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/chat-root.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/error-banner.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/message.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/composition/model-avatar.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/contexts/chat-context.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/contexts/composer-context.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/contexts/index.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/contexts/message-context.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/contexts/thread-list-context.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/hooks/use-threads.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/index.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/utils/export.d.ts +0 -10
- package/esm/src/react/components/ai/chat/utils/export.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat/utils/message-parts.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat-with-sidebar.d.ts.map +0 -1
- package/esm/src/react/components/ai/chat.d.ts.map +0 -1
- package/esm/src/react/components/ai/csp-nonce.d.ts.map +0 -1
- package/esm/src/react/components/ai/error-boundary.d.ts.map +0 -1
- package/esm/src/react/components/ai/icons/index.d.ts.map +0 -1
- package/esm/src/react/components/ai/markdown.d.ts.map +0 -1
- package/esm/src/react/components/ai/message.d.ts.map +0 -1
- package/esm/src/react/components/ai/model-selector.d.ts.map +0 -1
- package/esm/src/react/components/ai/theme.d.ts.map +0 -1
- /package/esm/src/agent/{ai-defaults.js → defaults.js} +0 -0
- /package/esm/src/react/components/{ai → chat}/agent-card.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/agent-card.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/animations.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/animations.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/attachment-pill.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/attachment-pill.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/branch-picker.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/branch-picker.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/code-block.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/code-block.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/drop-zone.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/drop-zone.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/empty-state.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/empty-state.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/inference-badge.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/inline-citation.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/inline-citation.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/message-actions.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/message-actions.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/message-edit-form.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/message-edit-form.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/message-feedback.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/message-feedback.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/quick-actions.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/quick-actions.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/reasoning.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/reasoning.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/sidebar.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/sidebar.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/sources.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/sources.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/step-indicator.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/step-indicator.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/tab-switcher.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/tab-switcher.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/upgrade-cta.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/upgrade-cta.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/uploads-panel.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/components/uploads-panel.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat/hooks/use-threads.js +0 -0
- /package/esm/src/react/components/{ai → chat}/chat-with-sidebar.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/chat-with-sidebar.js +0 -0
- /package/esm/src/react/components/{ai → chat}/csp-nonce.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/csp-nonce.js +0 -0
- /package/esm/src/react/components/{ai → chat}/markdown.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/markdown.js +0 -0
- /package/esm/src/react/components/{ai → chat}/message.js +0 -0
- /package/esm/src/react/components/{ai → chat}/model-selector.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/model-selector.js +0 -0
- /package/esm/src/react/components/{ai → chat}/theme.d.ts +0 -0
- /package/esm/src/react/components/{ai → chat}/theme.js +0 -0
- /package/esm/src/{ai/registry-facade.js → registry/scoped-registry-facade.js} +0 -0
- /package/src/src/agent/{ai-defaults.ts → defaults.ts} +0 -0
- /package/src/src/react/components/{ai → chat}/agent-card.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/animations.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/attachment-pill.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/branch-picker.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/code-block.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/drop-zone.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/empty-state.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/inline-citation.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/message-actions.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/message-edit-form.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/message-feedback.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/quick-actions.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/reasoning.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/sidebar.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/sources.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/step-indicator.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/tab-switcher.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/upgrade-cta.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat/components/uploads-panel.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/chat-with-sidebar.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/csp-nonce.ts +0 -0
- /package/src/src/react/components/{ai → chat}/markdown.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/model-selector.tsx +0 -0
- /package/src/src/react/components/{ai → chat}/theme.ts +0 -0
|
@@ -18,19 +18,20 @@ import { createMemory } from "../memory/index.js";
|
|
|
18
18
|
import { serverLogger } from "../../utils/index.js";
|
|
19
19
|
import { addSpanEvent, setSpanAttributes, withSpan, } from "../../observability/tracing/index.js";
|
|
20
20
|
import { convertToModelMessages } from "./model-message-converter.js";
|
|
21
|
-
import {
|
|
22
|
-
import { createStreamState, processStream, } from "./
|
|
21
|
+
import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
|
|
22
|
+
import { createStreamState, processStream, } from "./chat-stream-handler.js";
|
|
23
23
|
import { repairToolCall } from "./repair-tool-call.js";
|
|
24
24
|
import { MiddlewareChain } from "../middleware/chain.js";
|
|
25
|
-
import {
|
|
26
|
-
import { AGENT_DEFAULTS } from "../ai-defaults.js";
|
|
25
|
+
import { AGENT_DEFAULTS } from "../defaults.js";
|
|
27
26
|
import { tryGetCacheKeyContext } from "../../cache/cache-key-builder.js";
|
|
27
|
+
import { isLocalModelRuntime } from "../../provider/runtime-inspection.js";
|
|
28
|
+
import { generateText, streamText } from "../../runtime/runtime-bridge.js";
|
|
28
29
|
// Re-export from submodules
|
|
29
30
|
export { closeSSEStream, generateMessageId, sendSSE } from "./sse-utils.js";
|
|
30
31
|
export { RunAlreadyExistsError, RunCancelledError, RunNotActiveError, RunResumeSessionManager, WaitConflictError, WaitNotPendingError, } from "./resume-session.js";
|
|
31
32
|
export { executeConfiguredTool, getAvailableTools, isDynamicTool, parseToolArgs, } from "./tool-helpers.js";
|
|
32
33
|
export { accumulateUsage, getMaxSteps, normalizeInput } from "./input-utils.js";
|
|
33
|
-
export { createStreamState, processStream } from "./
|
|
34
|
+
export { createStreamState, processStream } from "./chat-stream-handler.js";
|
|
34
35
|
export { DEFAULT_MAX_STEPS, DEFAULT_MAX_TOKENS, DEFAULT_TEMPERATURE, MAX_STREAM_BUFFER_SIZE, } from "./constants.js";
|
|
35
36
|
import { DEFAULT_MAX_TOKENS, DEFAULT_TEMPERATURE } from "./constants.js";
|
|
36
37
|
import { closeSSEStream, generateMessageId, sendSSE } from "./sse-utils.js";
|
|
@@ -97,12 +98,25 @@ export function collectPersistedToolResults(messages) {
|
|
|
97
98
|
if (message.role !== "tool") {
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
|
-
for (const part of message.parts
|
|
101
|
+
for (const part of message.parts) {
|
|
102
|
+
if (!isToolResultPart(part)) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
101
105
|
persistedToolResults.set(part.toolCallId, part);
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
return persistedToolResults;
|
|
105
109
|
}
|
|
110
|
+
export function collectGeneratedToolResults(toolResults) {
|
|
111
|
+
const generatedToolResults = new Map();
|
|
112
|
+
for (const toolResult of toolResults ?? []) {
|
|
113
|
+
generatedToolResults.set(toolResult.toolCallId, toolResult);
|
|
114
|
+
}
|
|
115
|
+
return generatedToolResults;
|
|
116
|
+
}
|
|
117
|
+
function isToolResultPart(part) {
|
|
118
|
+
return part.type === "tool-result" && "result" in part;
|
|
119
|
+
}
|
|
106
120
|
/**
|
|
107
121
|
* Extract and validate the skill policy from a load-skill tool result.
|
|
108
122
|
* Returns `[]` (no tools allowed) for invalid/missing policies instead of
|
|
@@ -150,17 +164,6 @@ export function enforceSkillPolicy(toolName, activeSkillPolicy, mustLoadSkillFir
|
|
|
150
164
|
}
|
|
151
165
|
return { allowed: true };
|
|
152
166
|
}
|
|
153
|
-
/**
|
|
154
|
-
* Check whether a resolved LanguageModel is a local inference model.
|
|
155
|
-
* Checks the model object properties rather than the requested string,
|
|
156
|
-
* because resolveModel may internally fall back from cloud to local.
|
|
157
|
-
*/
|
|
158
|
-
function isLocalModel(model) {
|
|
159
|
-
const m = model;
|
|
160
|
-
return !!m._isVfLocalModel ||
|
|
161
|
-
m.provider === "local" ||
|
|
162
|
-
(typeof m.modelId === "string" && m.modelId.startsWith("local/"));
|
|
163
|
-
}
|
|
164
167
|
function getRuntimeAllowedRemoteTools(config) {
|
|
165
168
|
const configWithRuntimeFilters = config;
|
|
166
169
|
if (!Object.hasOwn(configWithRuntimeFilters, "__vfAllowedRemoteTools")) {
|
|
@@ -260,7 +263,7 @@ export class AgentRuntime {
|
|
|
260
263
|
const languageModel = resolveModel(resolvedModelString);
|
|
261
264
|
// Determine inference mode from the resolved model object (not the string),
|
|
262
265
|
// because resolveModel may internally fall back from cloud to local.
|
|
263
|
-
const isLocal =
|
|
266
|
+
const isLocal = isLocalModelRuntime(languageModel);
|
|
264
267
|
// Eagerly verify the model runtime is available. For local models this
|
|
265
268
|
// checks that @huggingface/transformers can be imported. Must happen
|
|
266
269
|
// BEFORE creating the ReadableStream so no_ai_available errors propagate
|
|
@@ -331,7 +334,7 @@ export class AgentRuntime {
|
|
|
331
334
|
const currentMessages = [...messages];
|
|
332
335
|
const totalUsage = { promptTokens: 0, completionTokens: 0, totalTokens: 0 };
|
|
333
336
|
// Local models can't reliably do function calling — skip tools gracefully.
|
|
334
|
-
const isLocal =
|
|
337
|
+
const isLocal = isLocalModelRuntime(languageModel);
|
|
335
338
|
if (isLocal && this.config.tools) {
|
|
336
339
|
logger.warn(`Agent "${this.id}" has tools configured but is using local model "${effectiveModel}". ` +
|
|
337
340
|
"Local models don't support tool calling — tools will be skipped. " +
|
|
@@ -363,7 +366,7 @@ export class AgentRuntime {
|
|
|
363
366
|
model: languageModel,
|
|
364
367
|
system: systemPrompt,
|
|
365
368
|
messages: convertToModelMessages(currentMessages),
|
|
366
|
-
tools:
|
|
369
|
+
tools: convertToolsToRuntimeTools(tools, {
|
|
367
370
|
model: effectiveModel,
|
|
368
371
|
allowedToolNames: allowedRemoteToolNames,
|
|
369
372
|
}),
|
|
@@ -401,7 +404,30 @@ export class AgentRuntime {
|
|
|
401
404
|
};
|
|
402
405
|
currentMessages.push(assistantMessage);
|
|
403
406
|
await this.memory.add(assistantMessage);
|
|
407
|
+
const generatedToolResults = collectGeneratedToolResults(response.toolResults);
|
|
408
|
+
const persistGeneratedToolResult = async (generatedToolResult) => {
|
|
409
|
+
const toolResultMessage = {
|
|
410
|
+
id: `tool_${generatedToolResult.toolCallId}`,
|
|
411
|
+
role: "tool",
|
|
412
|
+
parts: [
|
|
413
|
+
{
|
|
414
|
+
type: "tool-result",
|
|
415
|
+
toolCallId: generatedToolResult.toolCallId,
|
|
416
|
+
toolName: generatedToolResult.toolName,
|
|
417
|
+
result: generatedToolResult.isError === true
|
|
418
|
+
? { error: stringifyToolError(generatedToolResult.result) }
|
|
419
|
+
: generatedToolResult.result,
|
|
420
|
+
},
|
|
421
|
+
],
|
|
422
|
+
timestamp: Date.now(),
|
|
423
|
+
};
|
|
424
|
+
currentMessages.push(toolResultMessage);
|
|
425
|
+
await this.memory.add(toolResultMessage);
|
|
426
|
+
};
|
|
404
427
|
if (!response.toolCalls?.length) {
|
|
428
|
+
for (const generatedToolResult of generatedToolResults.values()) {
|
|
429
|
+
await persistGeneratedToolResult(generatedToolResult);
|
|
430
|
+
}
|
|
405
431
|
this.status = "completed";
|
|
406
432
|
addSpanEvent(loopSpan, "loop_complete");
|
|
407
433
|
return {
|
|
@@ -424,8 +450,19 @@ export class AgentRuntime {
|
|
|
424
450
|
args: tc.input,
|
|
425
451
|
status: "pending",
|
|
426
452
|
};
|
|
453
|
+
const generatedToolResult = generatedToolResults.get(tc.toolCallId);
|
|
427
454
|
await withSpan("agent.tool_execute", async (toolSpan) => {
|
|
428
455
|
setSpanAttributes(toolSpan, { "tool.name": tc.toolName, "tool.id": tc.toolCallId });
|
|
456
|
+
if (generatedToolResult) {
|
|
457
|
+
await persistGeneratedToolResult(generatedToolResult);
|
|
458
|
+
toolCall.status = generatedToolResult.isError === true ? "error" : "completed";
|
|
459
|
+
toolCall.result = generatedToolResult.result;
|
|
460
|
+
toolCall.error = generatedToolResult.isError === true
|
|
461
|
+
? stringifyToolError(generatedToolResult.result)
|
|
462
|
+
: undefined;
|
|
463
|
+
toolCalls.push(toolCall);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
429
466
|
const policyCheck = enforceSkillPolicy(tc.toolName, activeSkillPolicy, mustLoadSkillFirst);
|
|
430
467
|
if (!policyCheck.allowed) {
|
|
431
468
|
toolCall.status = "error";
|
|
@@ -519,7 +556,7 @@ export class AgentRuntime {
|
|
|
519
556
|
/**
|
|
520
557
|
* Execute agent loop with streaming
|
|
521
558
|
* Emits veryfront stream events (message-start/message-finish + step-start/step-end)
|
|
522
|
-
* while consuming
|
|
559
|
+
* while consuming model-runtime `streamText()` parts internally.
|
|
523
560
|
*/
|
|
524
561
|
async executeAgentLoopStreaming(systemPrompt, messages, controller, encoder, callbacks, textPartId, toolContext, modelString, resolvedModel, maxOutputTokensOverride, abortSignal) {
|
|
525
562
|
const { maxAgentSteps } = getPlatformCapabilities();
|
|
@@ -530,7 +567,7 @@ export class AgentRuntime {
|
|
|
530
567
|
const currentMessages = [...messages];
|
|
531
568
|
const totalUsage = { promptTokens: 0, completionTokens: 0, totalTokens: 0 };
|
|
532
569
|
// Local models can't reliably do function calling — skip tools gracefully.
|
|
533
|
-
const isLocalStreaming =
|
|
570
|
+
const isLocalStreaming = isLocalModelRuntime(languageModel);
|
|
534
571
|
if (isLocalStreaming && this.config.tools) {
|
|
535
572
|
logger.warn(`Agent "${this.id}" has tools configured but is using local model "${effectiveModel}". ` +
|
|
536
573
|
"Local models don't support tool calling — tools will be skipped. " +
|
|
@@ -545,7 +582,7 @@ export class AgentRuntime {
|
|
|
545
582
|
for (let step = 0; step < maxSteps; step++) {
|
|
546
583
|
throwIfAborted(abortSignal);
|
|
547
584
|
sendSSE(controller, encoder, { type: "step-start" });
|
|
548
|
-
const
|
|
585
|
+
const currentStepToolResults = new Map();
|
|
549
586
|
let tools = isLocalStreaming ? [] : await getAvailableTools(this.config.tools, {
|
|
550
587
|
includeSkillTools: Boolean(this.config.skills),
|
|
551
588
|
allowedRemoteToolNames,
|
|
@@ -560,7 +597,7 @@ export class AgentRuntime {
|
|
|
560
597
|
model: languageModel,
|
|
561
598
|
system: systemPrompt,
|
|
562
599
|
messages: convertToModelMessages(currentMessages),
|
|
563
|
-
tools:
|
|
600
|
+
tools: convertToolsToRuntimeTools(tools, {
|
|
564
601
|
model: effectiveModel,
|
|
565
602
|
allowedToolNames: allowedRemoteToolNames,
|
|
566
603
|
}),
|
|
@@ -605,7 +642,7 @@ export class AgentRuntime {
|
|
|
605
642
|
await this.memory.add(assistantMessage);
|
|
606
643
|
const finalToolResults = collectFinalStreamToolResults(state);
|
|
607
644
|
const persistToolResult = async (toolResult) => {
|
|
608
|
-
if (
|
|
645
|
+
if (currentStepToolResults.has(toolResult.toolCallId)) {
|
|
609
646
|
return;
|
|
610
647
|
}
|
|
611
648
|
const toolResultMessage = {
|
|
@@ -625,7 +662,7 @@ export class AgentRuntime {
|
|
|
625
662
|
};
|
|
626
663
|
currentMessages.push(toolResultMessage);
|
|
627
664
|
await this.memory.add(toolResultMessage);
|
|
628
|
-
|
|
665
|
+
currentStepToolResults.set(toolResult.toolCallId, toolResultMessage.parts[0]);
|
|
629
666
|
};
|
|
630
667
|
if (state.finishReason !== "tool-calls" || !state.toolCalls.size) {
|
|
631
668
|
for (const toolResult of finalToolResults.values()) {
|
|
@@ -644,7 +681,7 @@ export class AgentRuntime {
|
|
|
644
681
|
const { args, error: argError } = parseToolArgs(tc.arguments);
|
|
645
682
|
const toolCall = { id: tc.id, name: tc.name, args, status: "pending" };
|
|
646
683
|
const matchingResult = finalToolResults.get(tc.id);
|
|
647
|
-
const persistedResult =
|
|
684
|
+
const persistedResult = currentStepToolResults.get(tc.id);
|
|
648
685
|
if (matchingResult) {
|
|
649
686
|
await persistToolResult(matchingResult);
|
|
650
687
|
toolCall.status = matchingResult.error === undefined ? "completed" : "error";
|
|
@@ -721,10 +758,10 @@ export class AgentRuntime {
|
|
|
721
758
|
],
|
|
722
759
|
timestamp: Date.now(),
|
|
723
760
|
};
|
|
724
|
-
if (!
|
|
761
|
+
if (!currentStepToolResults.has(tc.id)) {
|
|
725
762
|
currentMessages.push(toolResultMessage);
|
|
726
763
|
await this.memory.add(toolResultMessage);
|
|
727
|
-
|
|
764
|
+
currentStepToolResults.set(tc.id, toolResultMessage.parts[0]);
|
|
728
765
|
}
|
|
729
766
|
}
|
|
730
767
|
catch (error) {
|
|
@@ -787,7 +824,7 @@ export class AgentRuntime {
|
|
|
787
824
|
return system;
|
|
788
825
|
if (typeof system === "function")
|
|
789
826
|
return system();
|
|
790
|
-
return "You are a helpful
|
|
827
|
+
return "You are a helpful assistant.";
|
|
791
828
|
}
|
|
792
829
|
/**
|
|
793
830
|
* Compute max steps considering edge config and platform limits.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Model Message Converter
|
|
3
3
|
*
|
|
4
|
-
* Converts between veryfront's internal Message format and
|
|
5
|
-
*
|
|
4
|
+
* Converts between veryfront's internal Message format and the current
|
|
5
|
+
* model-runtime message format.
|
|
6
6
|
*
|
|
7
7
|
* @module ai/agent/runtime/model-message-converter
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { ModelRuntimeMessage } from "./model-runtime-types.js";
|
|
10
10
|
import { type Message } from "../types.js";
|
|
11
11
|
/**
|
|
12
|
-
* Convert a veryfront Message to
|
|
12
|
+
* Convert a veryfront Message to the current model-runtime message format.
|
|
13
13
|
*/
|
|
14
|
-
export declare function convertToModelMessage(msg: Message):
|
|
14
|
+
export declare function convertToModelMessage(msg: Message): ModelRuntimeMessage;
|
|
15
15
|
/**
|
|
16
|
-
* Convert an array of veryfront Messages to
|
|
16
|
+
* Convert an array of veryfront Messages to the current model-runtime message format.
|
|
17
17
|
*/
|
|
18
|
-
export declare function convertToModelMessages(messages: Message[]):
|
|
18
|
+
export declare function convertToModelMessages(messages: Message[]): ModelRuntimeMessage[];
|
|
19
19
|
//# sourceMappingURL=model-message-converter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-message-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-message-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"model-message-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-message-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAEV,mBAAmB,EAIpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,OAAO,EAGb,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,CAsEvE;AAgBD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAkCjF"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Model Message Converter
|
|
3
3
|
*
|
|
4
|
-
* Converts between veryfront's internal Message format and
|
|
5
|
-
*
|
|
4
|
+
* Converts between veryfront's internal Message format and the current
|
|
5
|
+
* model-runtime message format.
|
|
6
6
|
*
|
|
7
7
|
* @module ai/agent/runtime/model-message-converter
|
|
8
8
|
*/
|
|
9
9
|
import { getTextFromParts, getToolArguments, } from "../types.js";
|
|
10
10
|
/**
|
|
11
|
-
* Convert a veryfront Message to
|
|
11
|
+
* Convert a veryfront Message to the current model-runtime message format.
|
|
12
12
|
*/
|
|
13
13
|
export function convertToModelMessage(msg) {
|
|
14
14
|
switch (msg.role) {
|
|
@@ -43,7 +43,8 @@ export function convertToModelMessage(msg) {
|
|
|
43
43
|
if (content.length === 0) {
|
|
44
44
|
content.push({ type: "text", text: "" });
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
const assistantMessage = { role: "assistant", content };
|
|
47
|
+
return assistantMessage;
|
|
47
48
|
}
|
|
48
49
|
case "tool": {
|
|
49
50
|
const content = [];
|
|
@@ -58,7 +59,8 @@ export function convertToModelMessage(msg) {
|
|
|
58
59
|
output: { type: "json", value: resultPart.result },
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
const toolMessage = { role: "tool", content };
|
|
63
|
+
return toolMessage;
|
|
62
64
|
}
|
|
63
65
|
default: {
|
|
64
66
|
// Fallback: treat as user message
|
|
@@ -79,7 +81,7 @@ function convertToolResultPart(part) {
|
|
|
79
81
|
};
|
|
80
82
|
}
|
|
81
83
|
/**
|
|
82
|
-
* Convert an array of veryfront Messages to
|
|
84
|
+
* Convert an array of veryfront Messages to the current model-runtime message format.
|
|
83
85
|
*/
|
|
84
86
|
export function convertToModelMessages(messages) {
|
|
85
87
|
const modelMessages = [];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Runtime Types
|
|
3
|
+
*
|
|
4
|
+
* Framework-owned message types for the current text-generation runtime
|
|
5
|
+
* boundary. These describe the subset of message shapes the runtime uses
|
|
6
|
+
* today without exposing SDK-owned message contracts upward.
|
|
7
|
+
*/
|
|
8
|
+
export interface ModelRuntimeTextPart {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ModelRuntimeToolCallPart {
|
|
13
|
+
type: "tool-call";
|
|
14
|
+
toolCallId: string;
|
|
15
|
+
toolName: string;
|
|
16
|
+
input: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface ModelRuntimeToolResultPart {
|
|
19
|
+
type: "tool-result";
|
|
20
|
+
toolCallId: string;
|
|
21
|
+
toolName: string;
|
|
22
|
+
output: {
|
|
23
|
+
type: "json";
|
|
24
|
+
value: unknown;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface ModelRuntimeSystemMessage {
|
|
28
|
+
role: "system";
|
|
29
|
+
content: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ModelRuntimeUserMessage {
|
|
32
|
+
role: "user";
|
|
33
|
+
content: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ModelRuntimeAssistantMessage {
|
|
36
|
+
role: "assistant";
|
|
37
|
+
content: Array<ModelRuntimeTextPart | ModelRuntimeToolCallPart>;
|
|
38
|
+
}
|
|
39
|
+
export interface ModelRuntimeToolMessage {
|
|
40
|
+
role: "tool";
|
|
41
|
+
content: ModelRuntimeToolResultPart[];
|
|
42
|
+
}
|
|
43
|
+
export type ModelRuntimeMessage = ModelRuntimeSystemMessage | ModelRuntimeUserMessage | ModelRuntimeAssistantMessage | ModelRuntimeToolMessage;
|
|
44
|
+
//# sourceMappingURL=model-runtime-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-runtime-types.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-runtime-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC,oBAAoB,GAAG,wBAAwB,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,0BAA0B,EAAE,CAAC;CACvC;AAED,MAAM,MAAM,mBAAmB,GAC3B,yBAAyB,GACzB,uBAAuB,GACvB,4BAA4B,GAC5B,uBAAuB,CAAC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Model Tool Converter
|
|
3
3
|
*
|
|
4
|
-
* Converts veryfront ToolDefinition[] to
|
|
5
|
-
*
|
|
4
|
+
* Converts veryfront ToolDefinition[] to the current model-runtime ToolSet
|
|
5
|
+
* format using framework-owned plain tool/schema objects.
|
|
6
6
|
*
|
|
7
|
-
* @module
|
|
7
|
+
* @module agent/runtime/model-tool-converter
|
|
8
8
|
*/
|
|
9
|
-
import type { ToolSet } from "ai";
|
|
10
9
|
import type { ToolDefinition } from "../../tool/index.js";
|
|
11
|
-
|
|
10
|
+
import type { RuntimeToolSet } from "./runtime-tool-types.js";
|
|
11
|
+
export interface ConvertToolsToRuntimeToolsOptions {
|
|
12
12
|
model?: string;
|
|
13
13
|
allowedToolNames?: string[];
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Convert veryfront tool definitions to
|
|
16
|
+
* Convert veryfront tool definitions to the current model-runtime ToolSet.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* We only provide the schema/metadata the runtime substrate needs here.
|
|
19
|
+
* Tool execution remains owned by the agent runtime.
|
|
20
20
|
*/
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function convertToolsToRuntimeTools(tools: ToolDefinition[], options?: ConvertToolsToRuntimeToolsOptions): RuntimeToolSet | undefined;
|
|
22
22
|
//# sourceMappingURL=model-tool-converter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-tool-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-tool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"model-tool-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-tool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAQ9D,MAAM,WAAW,iCAAiC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AA4BD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,CAAC,EAAE,iCAAiC,GAC1C,cAAc,GAAG,SAAS,CAwB5B"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Converts veryfront ToolDefinition[] to AI SDK ToolSet format.
|
|
5
|
-
* Uses jsonSchema() to pass JSON Schema parameters directly to the AI SDK.
|
|
6
|
-
*
|
|
7
|
-
* @module ai/agent/runtime/model-tool-converter
|
|
8
|
-
*/
|
|
9
|
-
import { jsonSchema, tool } from "ai";
|
|
10
|
-
import { anthropic } from "@ai-sdk/anthropic";
|
|
1
|
+
import { addRuntimeTool, createRuntimeJsonSchema, createRuntimeTool, } from "./runtime-tool-builder.js";
|
|
2
|
+
import { createAnthropicWebSearchToolSet } from "./provider-native-tools.js";
|
|
11
3
|
function resolveHostedProvider(model) {
|
|
12
4
|
if (!model)
|
|
13
5
|
return undefined;
|
|
@@ -26,25 +18,21 @@ function resolveProviderNativeTools(options) {
|
|
|
26
18
|
if (resolveHostedProvider(options.model) !== "anthropic") {
|
|
27
19
|
return undefined;
|
|
28
20
|
}
|
|
29
|
-
return
|
|
30
|
-
web_search: anthropic.tools.webSearch_20250305({
|
|
31
|
-
maxUses: 5,
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
21
|
+
return createAnthropicWebSearchToolSet();
|
|
34
22
|
}
|
|
35
23
|
/**
|
|
36
|
-
* Convert veryfront tool definitions to
|
|
24
|
+
* Convert veryfront tool definitions to the current model-runtime ToolSet.
|
|
37
25
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
26
|
+
* We only provide the schema/metadata the runtime substrate needs here.
|
|
27
|
+
* Tool execution remains owned by the agent runtime.
|
|
40
28
|
*/
|
|
41
|
-
export function
|
|
29
|
+
export function convertToolsToRuntimeTools(tools, options) {
|
|
42
30
|
const toolSet = {};
|
|
43
31
|
for (const def of tools) {
|
|
44
|
-
toolSet
|
|
32
|
+
addRuntimeTool(toolSet, def.name, createRuntimeTool({
|
|
45
33
|
description: def.description,
|
|
46
|
-
inputSchema:
|
|
47
|
-
});
|
|
34
|
+
inputSchema: createRuntimeJsonSchema(def.parameters),
|
|
35
|
+
}));
|
|
48
36
|
}
|
|
49
37
|
const providerNativeTools = resolveProviderNativeTools(options);
|
|
50
38
|
if (providerNativeTools) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-native-tools.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/provider-native-tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AA8C9D,wBAAgB,+BAA+B,IAAI,cAAc,CAYhE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createLazyRuntimeJsonSchema, createRuntimeProviderTool } from "./runtime-tool-builder.js";
|
|
2
|
+
const WEB_SEARCH_INPUT_SCHEMA = {
|
|
3
|
+
type: "object",
|
|
4
|
+
properties: {
|
|
5
|
+
query: {
|
|
6
|
+
type: "string",
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
required: ["query"],
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
};
|
|
12
|
+
const WEB_SEARCH_OUTPUT_SCHEMA = {
|
|
13
|
+
type: "array",
|
|
14
|
+
items: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
url: {
|
|
18
|
+
type: "string",
|
|
19
|
+
},
|
|
20
|
+
title: {
|
|
21
|
+
anyOf: [
|
|
22
|
+
{ type: "string" },
|
|
23
|
+
{ type: "null" },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
pageAge: {
|
|
27
|
+
anyOf: [
|
|
28
|
+
{ type: "string" },
|
|
29
|
+
{ type: "null" },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
encryptedContent: {
|
|
33
|
+
type: "string",
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
type: "string",
|
|
37
|
+
const: "web_search_result",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
required: ["url", "title", "pageAge", "encryptedContent", "type"],
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export function createAnthropicWebSearchToolSet() {
|
|
45
|
+
return {
|
|
46
|
+
web_search: createRuntimeProviderTool({
|
|
47
|
+
id: "anthropic.web_search_20250305",
|
|
48
|
+
args: {
|
|
49
|
+
maxUses: 5,
|
|
50
|
+
},
|
|
51
|
+
inputSchema: createLazyRuntimeJsonSchema(WEB_SEARCH_INPUT_SCHEMA),
|
|
52
|
+
outputSchema: createLazyRuntimeJsonSchema(WEB_SEARCH_OUTPUT_SCHEMA),
|
|
53
|
+
supportsDeferredResults: true,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const repairToolCall:
|
|
1
|
+
import type { RuntimeToolCallRepairFunction } from "./runtime-tool-types.js";
|
|
2
|
+
export declare const repairToolCall: RuntimeToolCallRepairFunction;
|
|
3
3
|
//# sourceMappingURL=repair-tool-call.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repair-tool-call.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/repair-tool-call.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"repair-tool-call.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/repair-tool-call.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAI7E,eAAO,MAAM,cAAc,EAAE,6BA4C5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isInvalidToolInputError, isNoSuchToolError } from "./runtime-tool-errors.js";
|
|
2
2
|
const REPAIRABLE_PROVIDER_TOOL_NAMES = new Set(["web_search"]);
|
|
3
3
|
export const repairToolCall = async ({ toolCall, error, }) => {
|
|
4
|
-
if (
|
|
4
|
+
if (isNoSuchToolError(error)) {
|
|
5
5
|
return null;
|
|
6
6
|
}
|
|
7
7
|
if (!REPAIRABLE_PROVIDER_TOOL_NAMES.has(toolCall.toolName)) {
|
|
@@ -10,7 +10,7 @@ export const repairToolCall = async ({ toolCall, error, }) => {
|
|
|
10
10
|
if (toolCall.providerExecuted !== true) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
|
-
if (!
|
|
13
|
+
if (!isInvalidToolInputError(error) || typeof toolCall.input !== "string") {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
const trimmedInput = toolCall.input.trim();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { JsonSchema } from "../../tool/schema/index.js";
|
|
2
|
+
import type { RuntimeToolSet } from "./runtime-tool-types.js";
|
|
3
|
+
interface RuntimeJsonSchema<T = unknown> {
|
|
4
|
+
readonly jsonSchema: JsonSchema | PromiseLike<JsonSchema>;
|
|
5
|
+
validate?: (value: unknown) => T | PromiseLike<T>;
|
|
6
|
+
}
|
|
7
|
+
type RuntimeLazySchema<T = unknown> = () => RuntimeJsonSchema<T>;
|
|
8
|
+
interface RuntimeToolDefinition {
|
|
9
|
+
description: string;
|
|
10
|
+
inputSchema: RuntimeJsonSchema;
|
|
11
|
+
type?: "function" | "dynamic";
|
|
12
|
+
execute?: (...args: unknown[]) => unknown;
|
|
13
|
+
onInputAvailable?: (...args: unknown[]) => unknown;
|
|
14
|
+
onInputStart?: (...args: unknown[]) => unknown;
|
|
15
|
+
onInputDelta?: (...args: unknown[]) => unknown;
|
|
16
|
+
needsApproval?: (...args: unknown[]) => unknown;
|
|
17
|
+
}
|
|
18
|
+
interface RuntimeProviderToolDefinition {
|
|
19
|
+
type: "provider";
|
|
20
|
+
id: string;
|
|
21
|
+
args: Record<string, unknown>;
|
|
22
|
+
inputSchema: RuntimeLazySchema;
|
|
23
|
+
outputSchema?: RuntimeLazySchema;
|
|
24
|
+
execute?: undefined;
|
|
25
|
+
needsApproval?: undefined;
|
|
26
|
+
toModelOutput?: undefined;
|
|
27
|
+
onInputStart?: undefined;
|
|
28
|
+
onInputDelta?: undefined;
|
|
29
|
+
onInputAvailable?: undefined;
|
|
30
|
+
supportsDeferredResults?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function createRuntimeJsonSchema(json: JsonSchema): RuntimeJsonSchema;
|
|
33
|
+
export declare function createLazyRuntimeJsonSchema(json: JsonSchema): RuntimeLazySchema;
|
|
34
|
+
export declare function createRuntimeTool(definition: {
|
|
35
|
+
description: string;
|
|
36
|
+
inputSchema: RuntimeJsonSchema;
|
|
37
|
+
type?: "function" | "dynamic";
|
|
38
|
+
}): RuntimeToolDefinition;
|
|
39
|
+
export declare function addRuntimeTool(toolSet: RuntimeToolSet, name: string, definition: RuntimeToolDefinition): void;
|
|
40
|
+
export declare function createRuntimeProviderTool(definition: {
|
|
41
|
+
id: string;
|
|
42
|
+
args: Record<string, unknown>;
|
|
43
|
+
inputSchema: RuntimeLazySchema;
|
|
44
|
+
outputSchema?: RuntimeLazySchema;
|
|
45
|
+
supportsDeferredResults?: boolean;
|
|
46
|
+
}): RuntimeProviderToolDefinition;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=runtime-tool-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-tool-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/runtime-tool-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,UAAU,iBAAiB,CAAC,CAAC,GAAG,OAAO;IACrC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;CACnD;AAED,KAAK,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAEjE,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IAC1C,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IACnD,YAAY,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IAC/C,YAAY,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IAC/C,aAAa,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;CACjD;AAED,UAAU,6BAA6B;IACrC,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAI3E;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAE/E;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAC/B,GAAG,qBAAqB,CAMxB;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,qBAAqB,GAChC,IAAI,CAEN;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,GAAG,6BAA6B,CAShC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function createRuntimeJsonSchema(json) {
|
|
2
|
+
return {
|
|
3
|
+
jsonSchema: json,
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
export function createLazyRuntimeJsonSchema(json) {
|
|
7
|
+
return () => createRuntimeJsonSchema(json);
|
|
8
|
+
}
|
|
9
|
+
export function createRuntimeTool(definition) {
|
|
10
|
+
return {
|
|
11
|
+
type: definition.type ?? "function",
|
|
12
|
+
description: definition.description,
|
|
13
|
+
inputSchema: definition.inputSchema,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function addRuntimeTool(toolSet, name, definition) {
|
|
17
|
+
toolSet[name] = definition;
|
|
18
|
+
}
|
|
19
|
+
export function createRuntimeProviderTool(definition) {
|
|
20
|
+
return {
|
|
21
|
+
type: "provider",
|
|
22
|
+
id: definition.id,
|
|
23
|
+
args: definition.args,
|
|
24
|
+
inputSchema: definition.inputSchema,
|
|
25
|
+
outputSchema: definition.outputSchema,
|
|
26
|
+
supportsDeferredResults: definition.supportsDeferredResults,
|
|
27
|
+
};
|
|
28
|
+
}
|