veryfront 0.1.149 → 0.1.151
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/ag-ui-handler.d.ts.map +1 -1
- package/esm/src/agent/ag-ui-handler.js +6 -0
- 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/internal-agents/ag-ui-sse.d.ts.map +1 -1
- package/esm/src/internal-agents/ag-ui-sse.js +12 -0
- 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/ag-ui-handler.ts +6 -0
- 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/internal-agents/ag-ui-sse.ts +12 -0
- 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
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime Bridge
|
|
3
|
+
*
|
|
4
|
+
* Centralizes the framework's current runtime edge behind one internal
|
|
5
|
+
* module. Higher-level framework code imports framework-owned runtime
|
|
6
|
+
* types and calls into this bridge at the edge.
|
|
7
|
+
*/
|
|
8
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
9
|
+
|
|
10
|
+
import type { ModelRuntimeMessage } from "../agent/runtime/model-runtime-types.js";
|
|
11
|
+
import type {
|
|
12
|
+
RuntimeGenerateTextResult,
|
|
13
|
+
RuntimeStreamResult,
|
|
14
|
+
RuntimeToolCallRepairFunction,
|
|
15
|
+
RuntimeToolSet,
|
|
16
|
+
} from "../agent/runtime/runtime-tool-types.js";
|
|
17
|
+
import type {
|
|
18
|
+
EmbeddingRuntime,
|
|
19
|
+
ModelRuntime,
|
|
20
|
+
ModelRuntimeGenerateResult,
|
|
21
|
+
} from "../provider/types.js";
|
|
22
|
+
|
|
23
|
+
type GenerateTextOptions = {
|
|
24
|
+
model: ModelRuntime;
|
|
25
|
+
system?: unknown;
|
|
26
|
+
messages: ModelRuntimeMessage[];
|
|
27
|
+
tools?: RuntimeToolSet;
|
|
28
|
+
experimental_repairToolCall?: RuntimeToolCallRepairFunction;
|
|
29
|
+
maxOutputTokens?: number;
|
|
30
|
+
temperature?: number;
|
|
31
|
+
topP?: number;
|
|
32
|
+
topK?: number;
|
|
33
|
+
stopSequences?: string[];
|
|
34
|
+
toolChoice?: unknown;
|
|
35
|
+
seed?: number;
|
|
36
|
+
presencePenalty?: number;
|
|
37
|
+
frequencyPenalty?: number;
|
|
38
|
+
headers?: dntShim.HeadersInit;
|
|
39
|
+
providerOptions?: Record<string, unknown>;
|
|
40
|
+
abortSignal?: AbortSignal;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type StreamTextOptions = {
|
|
44
|
+
model: ModelRuntime;
|
|
45
|
+
system?: unknown;
|
|
46
|
+
messages: ModelRuntimeMessage[];
|
|
47
|
+
tools?: RuntimeToolSet;
|
|
48
|
+
experimental_repairToolCall?: RuntimeToolCallRepairFunction;
|
|
49
|
+
maxOutputTokens?: number;
|
|
50
|
+
temperature?: number;
|
|
51
|
+
topP?: number;
|
|
52
|
+
topK?: number;
|
|
53
|
+
stopSequences?: string[];
|
|
54
|
+
toolChoice?: unknown;
|
|
55
|
+
seed?: number;
|
|
56
|
+
presencePenalty?: number;
|
|
57
|
+
frequencyPenalty?: number;
|
|
58
|
+
headers?: dntShim.HeadersInit;
|
|
59
|
+
providerOptions?: Record<string, unknown>;
|
|
60
|
+
includeRawChunks?: boolean;
|
|
61
|
+
abortSignal?: AbortSignal;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
type EmbedOptions = {
|
|
65
|
+
model: EmbeddingRuntime;
|
|
66
|
+
value: string;
|
|
67
|
+
abortSignal?: AbortSignal;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type EmbedManyOptions = {
|
|
71
|
+
model: EmbeddingRuntime;
|
|
72
|
+
values: string[];
|
|
73
|
+
abortSignal?: AbortSignal;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
type RuntimePromptMessage =
|
|
77
|
+
| { role: "system"; content: string }
|
|
78
|
+
| { role: "user"; content: Array<{ type: "text"; text: string }> }
|
|
79
|
+
| {
|
|
80
|
+
role: "assistant";
|
|
81
|
+
content: Array<
|
|
82
|
+
| { type: "text"; text: string }
|
|
83
|
+
| {
|
|
84
|
+
type: "tool-call";
|
|
85
|
+
toolCallId: string;
|
|
86
|
+
toolName: string;
|
|
87
|
+
input: unknown;
|
|
88
|
+
providerExecuted?: boolean;
|
|
89
|
+
}
|
|
90
|
+
>;
|
|
91
|
+
}
|
|
92
|
+
| {
|
|
93
|
+
role: "tool";
|
|
94
|
+
content: Array<{
|
|
95
|
+
type: "tool-result";
|
|
96
|
+
toolCallId: string;
|
|
97
|
+
toolName: string;
|
|
98
|
+
output: { type: "json"; value: unknown };
|
|
99
|
+
}>;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type DirectGenerateUsage = {
|
|
103
|
+
inputTokens?: number;
|
|
104
|
+
outputTokens?: number;
|
|
105
|
+
totalTokens?: number;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
type DirectGenerateResult = {
|
|
109
|
+
content?: Array<
|
|
110
|
+
| { type: "text"; text: string }
|
|
111
|
+
| { type: "tool-call"; toolCallId: string; toolName: string; input: string }
|
|
112
|
+
| {
|
|
113
|
+
type: "tool-result";
|
|
114
|
+
toolCallId: string;
|
|
115
|
+
toolName: string;
|
|
116
|
+
result: unknown;
|
|
117
|
+
isError?: boolean;
|
|
118
|
+
}
|
|
119
|
+
| Record<string, unknown>
|
|
120
|
+
>;
|
|
121
|
+
finishReason?: string | { unified?: string | null } | null;
|
|
122
|
+
usage?: unknown;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
type DirectStreamResult = {
|
|
126
|
+
stream: ReadableStream<unknown>;
|
|
127
|
+
};
|
|
128
|
+
type DirectToolDefinition =
|
|
129
|
+
| {
|
|
130
|
+
type: "function";
|
|
131
|
+
name: string;
|
|
132
|
+
description?: string;
|
|
133
|
+
inputSchema: unknown;
|
|
134
|
+
}
|
|
135
|
+
| {
|
|
136
|
+
type: "provider";
|
|
137
|
+
name: string;
|
|
138
|
+
id: `${string}.${string}`;
|
|
139
|
+
args: Record<string, unknown>;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
function normalizeSystemPrompt(system: GenerateTextOptions["system"]): string | undefined {
|
|
143
|
+
if (typeof system === "string") {
|
|
144
|
+
return system;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!system || typeof system !== "object") {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if ("content" in system && typeof system.content === "string") {
|
|
152
|
+
return system.content;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (Array.isArray(system)) {
|
|
156
|
+
const parts = system.flatMap((entry) =>
|
|
157
|
+
entry && typeof entry === "object" && "content" in entry && typeof entry.content === "string"
|
|
158
|
+
? [entry.content]
|
|
159
|
+
: []
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
return parts.length > 0 ? parts.join("\n") : undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function toRuntimePrompt(
|
|
169
|
+
system: string | undefined,
|
|
170
|
+
messages: ModelRuntimeMessage[],
|
|
171
|
+
): RuntimePromptMessage[] {
|
|
172
|
+
const prompt: RuntimePromptMessage[] = [];
|
|
173
|
+
|
|
174
|
+
if (system && system.length > 0) {
|
|
175
|
+
prompt.push({ role: "system", content: system });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
for (const message of messages) {
|
|
179
|
+
switch (message.role) {
|
|
180
|
+
case "system":
|
|
181
|
+
prompt.push({ role: "system", content: message.content });
|
|
182
|
+
break;
|
|
183
|
+
case "user":
|
|
184
|
+
prompt.push({
|
|
185
|
+
role: "user",
|
|
186
|
+
content: [{ type: "text", text: message.content }],
|
|
187
|
+
});
|
|
188
|
+
break;
|
|
189
|
+
case "assistant":
|
|
190
|
+
prompt.push({
|
|
191
|
+
role: "assistant",
|
|
192
|
+
content: message.content.map((part) =>
|
|
193
|
+
part.type === "text" ? { type: "text" as const, text: part.text } : {
|
|
194
|
+
type: "tool-call" as const,
|
|
195
|
+
toolCallId: part.toolCallId,
|
|
196
|
+
toolName: part.toolName,
|
|
197
|
+
input: part.input,
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
});
|
|
201
|
+
break;
|
|
202
|
+
case "tool":
|
|
203
|
+
prompt.push({
|
|
204
|
+
role: "tool",
|
|
205
|
+
content: message.content.map((part) => ({
|
|
206
|
+
type: "tool-result" as const,
|
|
207
|
+
toolCallId: part.toolCallId,
|
|
208
|
+
toolName: part.toolName,
|
|
209
|
+
output: part.output,
|
|
210
|
+
})),
|
|
211
|
+
});
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return prompt;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function normalizeUsage(usage: unknown): DirectGenerateUsage | undefined {
|
|
220
|
+
if (!usage || typeof usage !== "object") {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if ("inputTokens" in usage && typeof usage.inputTokens === "object" && usage.inputTokens) {
|
|
225
|
+
const inputTokens = "total" in usage.inputTokens && typeof usage.inputTokens.total === "number"
|
|
226
|
+
? usage.inputTokens.total
|
|
227
|
+
: undefined;
|
|
228
|
+
const outputTokens =
|
|
229
|
+
"outputTokens" in usage && typeof usage.outputTokens === "object" && usage.outputTokens &&
|
|
230
|
+
"total" in usage.outputTokens && typeof usage.outputTokens.total === "number"
|
|
231
|
+
? usage.outputTokens.total
|
|
232
|
+
: undefined;
|
|
233
|
+
return {
|
|
234
|
+
inputTokens,
|
|
235
|
+
outputTokens,
|
|
236
|
+
totalTokens: (inputTokens ?? 0) + (outputTokens ?? 0),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const flatUsage = usage as {
|
|
241
|
+
inputTokens?: number;
|
|
242
|
+
outputTokens?: number;
|
|
243
|
+
totalTokens?: number;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
return {
|
|
247
|
+
inputTokens: flatUsage.inputTokens,
|
|
248
|
+
outputTokens: flatUsage.outputTokens,
|
|
249
|
+
totalTokens: flatUsage.totalTokens,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function normalizeFinishReason(finishReason: unknown): string | null {
|
|
254
|
+
if (typeof finishReason === "string") {
|
|
255
|
+
return finishReason;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (finishReason && typeof finishReason === "object" && "unified" in finishReason) {
|
|
259
|
+
return typeof finishReason.unified === "string" ? finishReason.unified : null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function parseToolCallInput(input: unknown): unknown {
|
|
266
|
+
if (typeof input !== "string") {
|
|
267
|
+
return input;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
try {
|
|
271
|
+
return JSON.parse(input);
|
|
272
|
+
} catch {
|
|
273
|
+
return input;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function isRuntimeProviderToolDefinition(
|
|
278
|
+
value: unknown,
|
|
279
|
+
): value is {
|
|
280
|
+
type: "provider";
|
|
281
|
+
id: `${string}.${string}`;
|
|
282
|
+
args: Record<string, unknown>;
|
|
283
|
+
} {
|
|
284
|
+
return !!value &&
|
|
285
|
+
typeof value === "object" &&
|
|
286
|
+
"type" in value &&
|
|
287
|
+
value.type === "provider" &&
|
|
288
|
+
"id" in value &&
|
|
289
|
+
typeof value.id === "string" &&
|
|
290
|
+
"args" in value &&
|
|
291
|
+
typeof value.args === "object" &&
|
|
292
|
+
value.args !== null &&
|
|
293
|
+
!Array.isArray(value.args);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function isRuntimeFunctionToolDefinition(
|
|
297
|
+
value: unknown,
|
|
298
|
+
): value is {
|
|
299
|
+
description?: string;
|
|
300
|
+
inputSchema: {
|
|
301
|
+
jsonSchema: unknown;
|
|
302
|
+
};
|
|
303
|
+
} {
|
|
304
|
+
return !!value &&
|
|
305
|
+
typeof value === "object" &&
|
|
306
|
+
"inputSchema" in value &&
|
|
307
|
+
!!value.inputSchema &&
|
|
308
|
+
typeof value.inputSchema === "object" &&
|
|
309
|
+
"jsonSchema" in value.inputSchema;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
async function resolveDirectTools(
|
|
313
|
+
tools: RuntimeToolSet | undefined,
|
|
314
|
+
): Promise<DirectToolDefinition[] | undefined> {
|
|
315
|
+
if (!tools) {
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const resolvedTools: DirectToolDefinition[] = [];
|
|
320
|
+
|
|
321
|
+
for (const [name, definition] of Object.entries(tools)) {
|
|
322
|
+
if (isRuntimeProviderToolDefinition(definition)) {
|
|
323
|
+
resolvedTools.push({
|
|
324
|
+
type: "provider",
|
|
325
|
+
name,
|
|
326
|
+
id: definition.id,
|
|
327
|
+
args: definition.args,
|
|
328
|
+
});
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (!isRuntimeFunctionToolDefinition(definition)) {
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const inputSchema = await Promise.resolve(definition.inputSchema.jsonSchema);
|
|
337
|
+
resolvedTools.push({
|
|
338
|
+
type: "function",
|
|
339
|
+
name,
|
|
340
|
+
...(typeof definition.description === "string"
|
|
341
|
+
? { description: definition.description }
|
|
342
|
+
: {}),
|
|
343
|
+
inputSchema,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return resolvedTools.length > 0 ? resolvedTools : undefined;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function isDirectToolCallPart(
|
|
351
|
+
part: unknown,
|
|
352
|
+
): part is { type: "tool-call"; toolCallId: string; toolName: string; input: unknown } {
|
|
353
|
+
return !!part &&
|
|
354
|
+
typeof part === "object" &&
|
|
355
|
+
"type" in part &&
|
|
356
|
+
part.type === "tool-call" &&
|
|
357
|
+
"toolCallId" in part &&
|
|
358
|
+
typeof part.toolCallId === "string" &&
|
|
359
|
+
"toolName" in part &&
|
|
360
|
+
typeof part.toolName === "string";
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function isDirectTextPart(part: unknown): part is { type: "text"; text: string } {
|
|
364
|
+
return !!part &&
|
|
365
|
+
typeof part === "object" &&
|
|
366
|
+
"type" in part &&
|
|
367
|
+
part.type === "text" &&
|
|
368
|
+
"text" in part &&
|
|
369
|
+
typeof part.text === "string";
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function isDirectToolResultPart(
|
|
373
|
+
part: unknown,
|
|
374
|
+
): part is {
|
|
375
|
+
type: "tool-result";
|
|
376
|
+
toolCallId: string;
|
|
377
|
+
toolName: string;
|
|
378
|
+
result: unknown;
|
|
379
|
+
isError?: boolean;
|
|
380
|
+
} {
|
|
381
|
+
return !!part &&
|
|
382
|
+
typeof part === "object" &&
|
|
383
|
+
"type" in part &&
|
|
384
|
+
part.type === "tool-result" &&
|
|
385
|
+
"toolCallId" in part &&
|
|
386
|
+
typeof part.toolCallId === "string" &&
|
|
387
|
+
"toolName" in part &&
|
|
388
|
+
typeof part.toolName === "string" &&
|
|
389
|
+
"result" in part;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function buildDirectGenerateResult(
|
|
393
|
+
result: ModelRuntimeGenerateResult | DirectGenerateResult,
|
|
394
|
+
): RuntimeGenerateTextResult {
|
|
395
|
+
let text = "";
|
|
396
|
+
const toolCalls: RuntimeGenerateTextResult["toolCalls"] = [];
|
|
397
|
+
const toolResults: RuntimeGenerateTextResult["toolResults"] = [];
|
|
398
|
+
|
|
399
|
+
for (const part of result.content ?? []) {
|
|
400
|
+
if (isDirectTextPart(part)) {
|
|
401
|
+
text += part.text;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (isDirectToolCallPart(part)) {
|
|
406
|
+
toolCalls.push({
|
|
407
|
+
toolCallId: part.toolCallId,
|
|
408
|
+
toolName: part.toolName,
|
|
409
|
+
input: parseToolCallInput(part.input),
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (isDirectToolResultPart(part)) {
|
|
414
|
+
toolResults.push({
|
|
415
|
+
toolCallId: part.toolCallId,
|
|
416
|
+
toolName: part.toolName,
|
|
417
|
+
result: part.result,
|
|
418
|
+
...(part.isError === true ? { isError: true } : {}),
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
return {
|
|
424
|
+
text,
|
|
425
|
+
...(toolCalls.length > 0 ? { toolCalls } : {}),
|
|
426
|
+
...(toolResults.length > 0 ? { toolResults } : {}),
|
|
427
|
+
usage: normalizeUsage(result.usage),
|
|
428
|
+
finishReason: normalizeFinishReason(result.finishReason),
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function normalizeStreamPart(part: unknown): unknown {
|
|
433
|
+
if (!part || typeof part !== "object" || !("type" in part)) {
|
|
434
|
+
return part;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (part.type === "text-delta") {
|
|
438
|
+
if ("delta" in part && typeof part.delta === "string") {
|
|
439
|
+
return {
|
|
440
|
+
type: "text-delta",
|
|
441
|
+
text: part.delta,
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return part;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (part.type !== "finish") {
|
|
449
|
+
return part;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const finishPart = part as {
|
|
453
|
+
type: "finish";
|
|
454
|
+
usage?: unknown;
|
|
455
|
+
finishReason?: unknown;
|
|
456
|
+
};
|
|
457
|
+
const usage = normalizeUsage(finishPart.usage);
|
|
458
|
+
|
|
459
|
+
return {
|
|
460
|
+
type: "finish",
|
|
461
|
+
finishReason: normalizeFinishReason(finishPart.finishReason),
|
|
462
|
+
...(usage
|
|
463
|
+
? {
|
|
464
|
+
totalUsage: {
|
|
465
|
+
inputTokens: usage.inputTokens,
|
|
466
|
+
outputTokens: usage.outputTokens,
|
|
467
|
+
},
|
|
468
|
+
}
|
|
469
|
+
: {}),
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
async function* mapReadableStream(stream: ReadableStream<unknown>): AsyncIterable<unknown> {
|
|
474
|
+
for await (const part of stream) {
|
|
475
|
+
yield normalizeStreamPart(part);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
async function* textDeltasFromStream(stream: ReadableStream<unknown>): AsyncIterable<string> {
|
|
480
|
+
for await (const part of stream) {
|
|
481
|
+
if (!part || typeof part !== "object" || !("type" in part) || part.type !== "text-delta") {
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if ("text" in part && typeof part.text === "string") {
|
|
486
|
+
yield part.text;
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if ("delta" in part && typeof part.delta === "string") {
|
|
491
|
+
yield part.delta;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export function generateText(options: GenerateTextOptions): PromiseLike<RuntimeGenerateTextResult> {
|
|
497
|
+
return resolveDirectTools(options.tools).then((tools) =>
|
|
498
|
+
options.model.doGenerate({
|
|
499
|
+
prompt: toRuntimePrompt(normalizeSystemPrompt(options.system), options.messages),
|
|
500
|
+
maxOutputTokens: options.maxOutputTokens,
|
|
501
|
+
temperature: options.temperature,
|
|
502
|
+
topP: options.topP,
|
|
503
|
+
topK: options.topK,
|
|
504
|
+
stopSequences: options.stopSequences,
|
|
505
|
+
...(tools ? { tools } : {}),
|
|
506
|
+
...(options.toolChoice ? { toolChoice: options.toolChoice } : {}),
|
|
507
|
+
...(options.seed !== undefined ? { seed: options.seed } : {}),
|
|
508
|
+
...(options.presencePenalty !== undefined
|
|
509
|
+
? { presencePenalty: options.presencePenalty }
|
|
510
|
+
: {}),
|
|
511
|
+
...(options.frequencyPenalty !== undefined
|
|
512
|
+
? { frequencyPenalty: options.frequencyPenalty }
|
|
513
|
+
: {}),
|
|
514
|
+
...(options.headers ? { headers: options.headers } : {}),
|
|
515
|
+
...(options.providerOptions ? { providerOptions: options.providerOptions } : {}),
|
|
516
|
+
abortSignal: options.abortSignal,
|
|
517
|
+
}).then(buildDirectGenerateResult)
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export function streamText(options: StreamTextOptions): RuntimeStreamResult {
|
|
522
|
+
const directResultPromise = resolveDirectTools(options.tools).then((tools) =>
|
|
523
|
+
options.model.doStream({
|
|
524
|
+
prompt: toRuntimePrompt(normalizeSystemPrompt(options.system), options.messages),
|
|
525
|
+
maxOutputTokens: options.maxOutputTokens,
|
|
526
|
+
temperature: options.temperature,
|
|
527
|
+
topP: options.topP,
|
|
528
|
+
topK: options.topK,
|
|
529
|
+
stopSequences: options.stopSequences,
|
|
530
|
+
...(tools ? { tools } : {}),
|
|
531
|
+
...(options.toolChoice ? { toolChoice: options.toolChoice } : {}),
|
|
532
|
+
...(options.seed !== undefined ? { seed: options.seed } : {}),
|
|
533
|
+
...(options.presencePenalty !== undefined
|
|
534
|
+
? { presencePenalty: options.presencePenalty }
|
|
535
|
+
: {}),
|
|
536
|
+
...(options.frequencyPenalty !== undefined
|
|
537
|
+
? { frequencyPenalty: options.frequencyPenalty }
|
|
538
|
+
: {}),
|
|
539
|
+
...(options.headers ? { headers: options.headers } : {}),
|
|
540
|
+
...(options.providerOptions ? { providerOptions: options.providerOptions } : {}),
|
|
541
|
+
...(options.includeRawChunks !== undefined
|
|
542
|
+
? { includeRawChunks: options.includeRawChunks }
|
|
543
|
+
: {}),
|
|
544
|
+
abortSignal: options.abortSignal,
|
|
545
|
+
})
|
|
546
|
+
);
|
|
547
|
+
const branchedStreamsPromise = directResultPromise.then(({ stream }) => stream.tee());
|
|
548
|
+
|
|
549
|
+
return {
|
|
550
|
+
fullStream: (async function* () {
|
|
551
|
+
const [fullStreamBranch] = await branchedStreamsPromise;
|
|
552
|
+
yield* mapReadableStream(fullStreamBranch);
|
|
553
|
+
})(),
|
|
554
|
+
textStream: (async function* () {
|
|
555
|
+
const [, textStreamBranch] = await branchedStreamsPromise;
|
|
556
|
+
yield* textDeltasFromStream(textStreamBranch);
|
|
557
|
+
})(),
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export function embed(options: EmbedOptions) {
|
|
562
|
+
return options.model.doEmbed({
|
|
563
|
+
values: [options.value],
|
|
564
|
+
abortSignal: options.abortSignal,
|
|
565
|
+
}).then((result) => ({
|
|
566
|
+
embedding: result.embeddings[0] ?? [],
|
|
567
|
+
embeddings: result.embeddings,
|
|
568
|
+
usage: result.usage,
|
|
569
|
+
rawResponse: result.rawResponse,
|
|
570
|
+
warnings: result.warnings ?? [],
|
|
571
|
+
}));
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export function embedMany(options: EmbedManyOptions) {
|
|
575
|
+
return options.model.doEmbed({
|
|
576
|
+
values: options.values,
|
|
577
|
+
abortSignal: options.abortSignal,
|
|
578
|
+
}).then((result) => ({
|
|
579
|
+
embeddings: result.embeddings,
|
|
580
|
+
usage: result.usage,
|
|
581
|
+
rawResponse: result.rawResponse,
|
|
582
|
+
warnings: result.warnings ?? [],
|
|
583
|
+
}));
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export function cosineSimilarity(a: number[], b: number[]): number {
|
|
587
|
+
if (a.length === 0 || b.length === 0 || a.length !== b.length) {
|
|
588
|
+
return 0;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
let dot = 0;
|
|
592
|
+
let normA = 0;
|
|
593
|
+
let normB = 0;
|
|
594
|
+
|
|
595
|
+
for (let i = 0; i < a.length; i++) {
|
|
596
|
+
const av = a[i] ?? 0;
|
|
597
|
+
const bv = b[i] ?? 0;
|
|
598
|
+
dot += av * bv;
|
|
599
|
+
normA += av * av;
|
|
600
|
+
normB += bv * bv;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
if (normA === 0 || normB === 0) {
|
|
604
|
+
return 0;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
return dot / (Math.sqrt(normA) * Math.sqrt(normB));
|
|
608
|
+
}
|
|
@@ -13,8 +13,8 @@ const fileWatchSetupLog = logger.component("file-watch-setup");
|
|
|
13
13
|
|
|
14
14
|
const METRICS_LOG_INTERVAL = 10;
|
|
15
15
|
|
|
16
|
-
/** Default
|
|
17
|
-
const
|
|
16
|
+
/** Default agent/chat primitive directories (used when no custom paths configured) */
|
|
17
|
+
const DEFAULT_PRIMITIVE_DIRS = ["tools", "agents", "workflows", "prompts", "resources"];
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Patterns for paths that should NOT trigger HMR updates.
|
|
@@ -51,7 +51,7 @@ export class FileWatchSetup {
|
|
|
51
51
|
private watcherController?: AbortController;
|
|
52
52
|
private optimizedWatcher?: OptimizedFileWatcher;
|
|
53
53
|
private batchCount = 0;
|
|
54
|
-
private
|
|
54
|
+
private primitiveDirs: Set<string>;
|
|
55
55
|
/** Content hashes to skip re-renders when file content is unchanged */
|
|
56
56
|
private contentHashes = new Map<string, number>();
|
|
57
57
|
|
|
@@ -62,9 +62,9 @@ export class FileWatchSetup {
|
|
|
62
62
|
private debounceMs: number,
|
|
63
63
|
private invalidateHandler: () => void = () => {},
|
|
64
64
|
private devServer?: DevServer,
|
|
65
|
-
|
|
65
|
+
primitiveDirNames?: string[],
|
|
66
66
|
) {
|
|
67
|
-
this.
|
|
67
|
+
this.primitiveDirs = new Set(primitiveDirNames ?? DEFAULT_PRIMITIVE_DIRS);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
async setup(): Promise<void> {
|
|
@@ -105,8 +105,8 @@ export class FileWatchSetup {
|
|
|
105
105
|
join(this.projectDir, "styles"),
|
|
106
106
|
join(this.projectDir, "public"),
|
|
107
107
|
join(this.projectDir, "app"),
|
|
108
|
-
//
|
|
109
|
-
...Array.from(this.
|
|
108
|
+
// Agent/chat primitive directories (from config or defaults)
|
|
109
|
+
...Array.from(this.primitiveDirs).map((dir) => join(this.projectDir, dir)),
|
|
110
110
|
];
|
|
111
111
|
|
|
112
112
|
const watchPaths: string[] = [];
|
|
@@ -175,13 +175,13 @@ export class FileWatchSetup {
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
|
-
* Check if a path is inside
|
|
178
|
+
* Check if a path is inside a configured primitive directory (tools/, agents/, etc.)
|
|
179
179
|
* Uses path segment matching to avoid false positives from substrings.
|
|
180
180
|
*/
|
|
181
|
-
private
|
|
181
|
+
private isPrimitivePath(fullPath: string): boolean {
|
|
182
182
|
const rel = relative(this.projectDir, fullPath);
|
|
183
183
|
const firstSegment = rel.split(sep)[0] ?? "";
|
|
184
|
-
return this.
|
|
184
|
+
return this.primitiveDirs.has(firstSegment);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
@@ -233,10 +233,10 @@ export class FileWatchSetup {
|
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
// Check for
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
239
|
-
await this.devServer.
|
|
236
|
+
// Check for primitive file changes and trigger re-discovery
|
|
237
|
+
const hasPrimitiveChanges = actualChanges.some((p) => this.isPrimitivePath(p));
|
|
238
|
+
if (hasPrimitiveChanges && this.devServer) {
|
|
239
|
+
await this.devServer.rediscoverPrimitives();
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
await this.refreshAndReload(actualChanges, "");
|