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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatMessagePart, ChatToolPart } from "../types.js";
|
|
2
2
|
import { createAssistantMessage, generateClientId } from "../utils.js";
|
|
3
3
|
import { buildCurrentParts } from "./parts-builder.js";
|
|
4
4
|
import type {
|
|
@@ -14,7 +14,7 @@ interface StreamingState {
|
|
|
14
14
|
toolCalls: Map<string, OrderedToolCall>;
|
|
15
15
|
reasoningBlocks: Map<string, OrderedReasoning>;
|
|
16
16
|
steps: Map<number, OrderedStep>;
|
|
17
|
-
messageParts:
|
|
17
|
+
messageParts: ChatMessagePart[];
|
|
18
18
|
currentTextId: string;
|
|
19
19
|
messageId: string;
|
|
20
20
|
partOrderCounter: number;
|
|
@@ -43,7 +43,7 @@ export async function handleStreamingResponse(
|
|
|
43
43
|
const decoder = new TextDecoder();
|
|
44
44
|
const state = createStreamingState();
|
|
45
45
|
|
|
46
|
-
const getBuildParts = ():
|
|
46
|
+
const getBuildParts = (): ChatMessagePart[] =>
|
|
47
47
|
buildCurrentParts(state.textBlocks, state.reasoningBlocks, state.toolCalls, state.steps);
|
|
48
48
|
|
|
49
49
|
let buffer = "";
|
|
@@ -89,7 +89,7 @@ function processEvent(
|
|
|
89
89
|
parsed: Record<string, unknown>,
|
|
90
90
|
state: StreamingState,
|
|
91
91
|
callbacks: StreamingCallbacks,
|
|
92
|
-
getBuildParts: () =>
|
|
92
|
+
getBuildParts: () => ChatMessagePart[],
|
|
93
93
|
): void {
|
|
94
94
|
const { onMessage, onData, onUpdate, onToolCall } = callbacks;
|
|
95
95
|
|
|
@@ -181,7 +181,7 @@ function handleTextDelta(
|
|
|
181
181
|
parsed: Record<string, unknown>,
|
|
182
182
|
state: StreamingState,
|
|
183
183
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
184
|
-
getBuildParts: () =>
|
|
184
|
+
getBuildParts: () => ChatMessagePart[],
|
|
185
185
|
): void {
|
|
186
186
|
const textId = (parsed.id as string) || state.currentTextId || "default";
|
|
187
187
|
const delta = (parsed.textDelta ?? parsed.delta ?? "") as string;
|
|
@@ -217,7 +217,7 @@ function handleToolInputStart(
|
|
|
217
217
|
parsed: Record<string, unknown>,
|
|
218
218
|
state: StreamingState,
|
|
219
219
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
220
|
-
getBuildParts: () =>
|
|
220
|
+
getBuildParts: () => ChatMessagePart[],
|
|
221
221
|
): void {
|
|
222
222
|
const toolCallId = (parsed.toolCallId as string) || generateClientId("tool");
|
|
223
223
|
const toolCall: OrderedToolCall = {
|
|
@@ -237,7 +237,7 @@ function handleToolInputDelta(
|
|
|
237
237
|
parsed: Record<string, unknown>,
|
|
238
238
|
state: StreamingState,
|
|
239
239
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
240
|
-
getBuildParts: () =>
|
|
240
|
+
getBuildParts: () => ChatMessagePart[],
|
|
241
241
|
): void {
|
|
242
242
|
const toolCallId = parsed.toolCallId as string;
|
|
243
243
|
const toolCall = state.toolCalls.get(toolCallId);
|
|
@@ -252,7 +252,7 @@ function handleToolInputAvailable(
|
|
|
252
252
|
state: StreamingState,
|
|
253
253
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
254
254
|
onToolCall: StreamingCallbacks["onToolCall"],
|
|
255
|
-
getBuildParts: () =>
|
|
255
|
+
getBuildParts: () => ChatMessagePart[],
|
|
256
256
|
): void {
|
|
257
257
|
const toolCallId = parsed.toolCallId as string;
|
|
258
258
|
const toolCall = state.toolCalls.get(toolCallId);
|
|
@@ -287,7 +287,7 @@ function handleToolInputAvailable(
|
|
|
287
287
|
toolName: toolCall.toolName,
|
|
288
288
|
state: "input-available",
|
|
289
289
|
input: toolCall.input,
|
|
290
|
-
} as
|
|
290
|
+
} as ChatToolPart);
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
onUpdate?.(getBuildParts(), state.messageId);
|
|
@@ -297,7 +297,7 @@ function handleToolOutputAvailable(
|
|
|
297
297
|
parsed: Record<string, unknown>,
|
|
298
298
|
state: StreamingState,
|
|
299
299
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
300
|
-
getBuildParts: () =>
|
|
300
|
+
getBuildParts: () => ChatMessagePart[],
|
|
301
301
|
): void {
|
|
302
302
|
const toolCallId = parsed.toolCallId as string;
|
|
303
303
|
const toolCall = state.toolCalls.get(toolCallId);
|
|
@@ -320,7 +320,7 @@ function handleToolError(
|
|
|
320
320
|
parsed: Record<string, unknown>,
|
|
321
321
|
state: StreamingState,
|
|
322
322
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
323
|
-
getBuildParts: () =>
|
|
323
|
+
getBuildParts: () => ChatMessagePart[],
|
|
324
324
|
): void {
|
|
325
325
|
const toolCallId = parsed.toolCallId as string;
|
|
326
326
|
const toolCall = state.toolCalls.get(toolCallId);
|
|
@@ -337,7 +337,7 @@ function handleReasoningStart(
|
|
|
337
337
|
parsed: Record<string, unknown>,
|
|
338
338
|
state: StreamingState,
|
|
339
339
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
340
|
-
getBuildParts: () =>
|
|
340
|
+
getBuildParts: () => ChatMessagePart[],
|
|
341
341
|
): void {
|
|
342
342
|
const reasoningId = (parsed.id as string) || generateClientId("reasoning");
|
|
343
343
|
const reasoning: OrderedReasoning = {
|
|
@@ -355,7 +355,7 @@ function handleReasoningDelta(
|
|
|
355
355
|
parsed: Record<string, unknown>,
|
|
356
356
|
state: StreamingState,
|
|
357
357
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
358
|
-
getBuildParts: () =>
|
|
358
|
+
getBuildParts: () => ChatMessagePart[],
|
|
359
359
|
): void {
|
|
360
360
|
const reasoningId = parsed.id as string;
|
|
361
361
|
const reasoning = state.reasoningBlocks.get(reasoningId);
|
|
@@ -369,7 +369,7 @@ function handleReasoningEnd(
|
|
|
369
369
|
parsed: Record<string, unknown>,
|
|
370
370
|
state: StreamingState,
|
|
371
371
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
372
|
-
getBuildParts: () =>
|
|
372
|
+
getBuildParts: () => ChatMessagePart[],
|
|
373
373
|
): void {
|
|
374
374
|
const reasoningId = parsed.id as string;
|
|
375
375
|
const reasoning = state.reasoningBlocks.get(reasoningId);
|
|
@@ -389,7 +389,7 @@ function handleStepStart(
|
|
|
389
389
|
_parsed: Record<string, unknown>,
|
|
390
390
|
state: StreamingState,
|
|
391
391
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
392
|
-
getBuildParts: () =>
|
|
392
|
+
getBuildParts: () => ChatMessagePart[],
|
|
393
393
|
): void {
|
|
394
394
|
const stepIndex = state.currentStep;
|
|
395
395
|
const step: OrderedStep = {
|
|
@@ -405,7 +405,7 @@ function handleStepEnd(
|
|
|
405
405
|
_parsed: Record<string, unknown>,
|
|
406
406
|
state: StreamingState,
|
|
407
407
|
onUpdate: StreamingCallbacks["onUpdate"],
|
|
408
|
-
getBuildParts: () =>
|
|
408
|
+
getBuildParts: () => ChatMessagePart[],
|
|
409
409
|
): void {
|
|
410
410
|
const step = state.steps.get(state.currentStep);
|
|
411
411
|
if (step) {
|
|
@@ -420,7 +420,7 @@ function handleStepEnd(
|
|
|
420
420
|
function handleFinish(
|
|
421
421
|
state: StreamingState,
|
|
422
422
|
onMessage: StreamingCallbacks["onMessage"],
|
|
423
|
-
getBuildParts: () =>
|
|
423
|
+
getBuildParts: () => ChatMessagePart[],
|
|
424
424
|
): void {
|
|
425
425
|
const finalParts = getBuildParts();
|
|
426
426
|
if (finalParts.length > 0) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatMessagePart, ChatToolPart } from "../types.js";
|
|
2
2
|
import type { OrderedReasoning, OrderedStep, OrderedToolCall, TextBlock } from "./types.js";
|
|
3
3
|
|
|
4
4
|
interface OrderedPart {
|
|
5
5
|
order: number;
|
|
6
|
-
part:
|
|
6
|
+
part: ChatMessagePart;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function buildCurrentParts(
|
|
@@ -11,7 +11,7 @@ export function buildCurrentParts(
|
|
|
11
11
|
reasoningBlocks: Map<string, OrderedReasoning>,
|
|
12
12
|
toolCalls: Map<string, OrderedToolCall>,
|
|
13
13
|
steps?: Map<number, OrderedStep>,
|
|
14
|
-
):
|
|
14
|
+
): ChatMessagePart[] {
|
|
15
15
|
const orderedParts: OrderedPart[] = [];
|
|
16
16
|
|
|
17
17
|
addTextParts(orderedParts, textBlocks);
|
|
@@ -67,9 +67,9 @@ function addToolParts(
|
|
|
67
67
|
errorText: tool.error,
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
const part:
|
|
70
|
+
const part: ChatMessagePart = tool.dynamic
|
|
71
71
|
? { type: "dynamic-tool", ...base }
|
|
72
|
-
: ({ type: `tool-${tool.toolName}`, ...base } as
|
|
72
|
+
: ({ type: `tool-${tool.toolName}`, ...base } as ChatToolPart);
|
|
73
73
|
|
|
74
74
|
orderedParts.push({ order: tool.order, part });
|
|
75
75
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatMessage, ChatMessagePart, ChatToolState, OnToolCallArg } from "../types.js";
|
|
2
2
|
|
|
3
3
|
export interface StreamingCallbacks {
|
|
4
|
-
onMessage: (message:
|
|
4
|
+
onMessage: (message: ChatMessage) => void;
|
|
5
5
|
onData: (data: unknown) => void;
|
|
6
|
-
onUpdate?: (parts:
|
|
6
|
+
onUpdate?: (parts: ChatMessagePart[], messageId: string) => void;
|
|
7
7
|
onToolCall?: (arg: OnToolCallArg) => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ export interface StreamingToolCall {
|
|
|
14
14
|
input?: unknown;
|
|
15
15
|
output?: unknown;
|
|
16
16
|
error?: string;
|
|
17
|
-
state:
|
|
17
|
+
state: ChatToolState;
|
|
18
18
|
/** Whether this is a dynamic tool (MCP, user-defined, etc.) */
|
|
19
19
|
dynamic?: boolean;
|
|
20
20
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
-
type
|
|
2
|
+
import type {
|
|
3
|
+
ChatDynamicToolPart,
|
|
4
|
+
ChatMessage,
|
|
5
|
+
ChatMessagePart,
|
|
6
|
+
ChatReasoningPart,
|
|
7
|
+
ChatStepPart,
|
|
8
|
+
ChatTextPart,
|
|
9
|
+
ChatToolPart,
|
|
10
|
+
ChatToolResultPart,
|
|
11
|
+
ChatToolState,
|
|
12
|
+
} from "../../../chat/protocol.js";
|
|
3
13
|
|
|
4
14
|
/** Where inference is happening */
|
|
5
15
|
export type InferenceMode = "cloud" | "server-local" | "browser";
|
|
@@ -13,73 +23,17 @@ export type BrowserInferenceStatus =
|
|
|
13
23
|
| "generating"
|
|
14
24
|
| "error";
|
|
15
25
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type ToolState =
|
|
29
|
-
| "input-streaming"
|
|
30
|
-
| "input-available"
|
|
31
|
-
| "output-streaming"
|
|
32
|
-
| "output-available"
|
|
33
|
-
| "output-error";
|
|
34
|
-
|
|
35
|
-
export interface ToolUIPart<NAME extends string = string, INPUT = unknown, OUTPUT = unknown> {
|
|
36
|
-
type: `tool-${NAME}`;
|
|
37
|
-
toolCallId: string;
|
|
38
|
-
toolName: NAME;
|
|
39
|
-
state: ToolState;
|
|
40
|
-
input?: INPUT;
|
|
41
|
-
output?: OUTPUT;
|
|
42
|
-
errorText?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface ToolResultUIPart<RESULT = unknown> {
|
|
46
|
-
type: "tool-result";
|
|
47
|
-
toolCallId: string;
|
|
48
|
-
toolName: string;
|
|
49
|
-
result: RESULT;
|
|
50
|
-
isError?: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface DynamicToolUIPart {
|
|
54
|
-
type: "dynamic-tool";
|
|
55
|
-
toolCallId: string;
|
|
56
|
-
toolName: string;
|
|
57
|
-
state: ToolState;
|
|
58
|
-
input?: unknown;
|
|
59
|
-
output?: unknown;
|
|
60
|
-
errorText?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface StepUIPart {
|
|
64
|
-
type: "step-start" | "step-end";
|
|
65
|
-
stepIndex: number;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export type UIMessagePart =
|
|
69
|
-
| TextUIPart
|
|
70
|
-
| ReasoningUIPart
|
|
71
|
-
| ToolUIPart
|
|
72
|
-
| ToolResultUIPart
|
|
73
|
-
| DynamicToolUIPart
|
|
74
|
-
| StepUIPart;
|
|
75
|
-
|
|
76
|
-
export interface UIMessage {
|
|
77
|
-
id: string;
|
|
78
|
-
role: "system" | "user" | "assistant";
|
|
79
|
-
parts: UIMessagePart[];
|
|
80
|
-
metadata?: Record<string, unknown>;
|
|
81
|
-
createdAt?: Date | string;
|
|
82
|
-
}
|
|
26
|
+
export type {
|
|
27
|
+
ChatDynamicToolPart,
|
|
28
|
+
ChatMessage,
|
|
29
|
+
ChatMessagePart,
|
|
30
|
+
ChatReasoningPart,
|
|
31
|
+
ChatStepPart,
|
|
32
|
+
ChatTextPart,
|
|
33
|
+
ChatToolPart,
|
|
34
|
+
ChatToolResultPart,
|
|
35
|
+
ChatToolState,
|
|
36
|
+
};
|
|
83
37
|
|
|
84
38
|
type ToolOutputState = "output-available" | "output-error";
|
|
85
39
|
|
|
@@ -102,7 +56,7 @@ export interface OnToolCallArg {
|
|
|
102
56
|
|
|
103
57
|
export interface UseChatOptions {
|
|
104
58
|
api: string;
|
|
105
|
-
initialMessages?:
|
|
59
|
+
initialMessages?: ChatMessage[];
|
|
106
60
|
body?: Record<string, unknown>;
|
|
107
61
|
headers?: Record<string, string>;
|
|
108
62
|
credentials?: RequestCredentials;
|
|
@@ -110,10 +64,10 @@ export interface UseChatOptions {
|
|
|
110
64
|
model?: string;
|
|
111
65
|
/** System prompt for browser-side inference (server uses agent config) */
|
|
112
66
|
systemPrompt?: string;
|
|
113
|
-
/** Enable/disable browser fallback when server can't provide
|
|
67
|
+
/** Enable/disable browser fallback when server can't provide a runtime. Default: true */
|
|
114
68
|
browserFallback?: boolean;
|
|
115
69
|
onResponse?: (response: dntShim.Response) => void;
|
|
116
|
-
onFinish?: (message:
|
|
70
|
+
onFinish?: (message: ChatMessage) => void;
|
|
117
71
|
onError?: (error: Error) => void;
|
|
118
72
|
onToolCall?: (arg: OnToolCallArg) => void | Promise<void>;
|
|
119
73
|
}
|
|
@@ -124,7 +78,7 @@ export interface BranchInfo {
|
|
|
124
78
|
}
|
|
125
79
|
|
|
126
80
|
export interface UseChatResult {
|
|
127
|
-
messages:
|
|
81
|
+
messages: ChatMessage[];
|
|
128
82
|
input: string;
|
|
129
83
|
isLoading: boolean;
|
|
130
84
|
error: Error | null;
|
|
@@ -148,7 +102,7 @@ export interface UseChatResult {
|
|
|
148
102
|
switchBranch: (messageId: string, branchIndex: number) => void;
|
|
149
103
|
reload: () => Promise<void>;
|
|
150
104
|
stop: () => void;
|
|
151
|
-
setMessages: (messages:
|
|
105
|
+
setMessages: (messages: ChatMessage[]) => void;
|
|
152
106
|
addToolOutput: (output: ToolOutput) => void;
|
|
153
107
|
data?: unknown;
|
|
154
108
|
handleInputChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
@@ -20,10 +20,10 @@ import { handleStreamingResponse } from "./streaming/index.js";
|
|
|
20
20
|
import type {
|
|
21
21
|
BranchInfo,
|
|
22
22
|
BrowserInferenceStatus,
|
|
23
|
+
ChatMessage,
|
|
24
|
+
ChatMessagePart,
|
|
23
25
|
InferenceMode,
|
|
24
26
|
ToolOutput,
|
|
25
|
-
UIMessage,
|
|
26
|
-
UIMessagePart,
|
|
27
27
|
UseChatOptions,
|
|
28
28
|
UseChatResult,
|
|
29
29
|
} from "./types.js";
|
|
@@ -31,14 +31,14 @@ import { generateClientId } from "./utils.js";
|
|
|
31
31
|
|
|
32
32
|
/** A snapshot of messages from a branch point onward */
|
|
33
33
|
interface Branch {
|
|
34
|
-
messages:
|
|
34
|
+
messages: ChatMessage[];
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/** Tracks branches keyed by the message ID where the edit occurred */
|
|
38
38
|
interface BranchState {
|
|
39
39
|
branches: Branch[];
|
|
40
40
|
currentIndex: number;
|
|
41
|
-
baseMessages:
|
|
41
|
+
baseMessages: ChatMessage[];
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export function isLatestRequest(activeRequestId: number, requestId: number): boolean {
|
|
@@ -55,7 +55,7 @@ export function resolveBranchKey(
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export function findBranchUserMessageIndex(
|
|
58
|
-
messages:
|
|
58
|
+
messages: ChatMessage[],
|
|
59
59
|
branchKey: string,
|
|
60
60
|
branchKeyByMessageId: Map<string, string>,
|
|
61
61
|
): number {
|
|
@@ -68,7 +68,7 @@ export function findBranchUserMessageIndex(
|
|
|
68
68
|
* useChat hook for managing chat state with veryfront stream events.
|
|
69
69
|
*/
|
|
70
70
|
export function useChat(options: UseChatOptions): UseChatResult {
|
|
71
|
-
const [messages, setMessages] = useState<
|
|
71
|
+
const [messages, setMessages] = useState<ChatMessage[]>(options.initialMessages ?? []);
|
|
72
72
|
const messagesRef = useRef(messages);
|
|
73
73
|
messagesRef.current = messages;
|
|
74
74
|
const [input, setInput] = useState("");
|
|
@@ -90,7 +90,7 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
90
90
|
|
|
91
91
|
// System prompt for browser fallback (from 503 response or options)
|
|
92
92
|
const systemPromptRef = useRef<string>(
|
|
93
|
-
options.systemPrompt ?? "You are a helpful
|
|
93
|
+
options.systemPrompt ?? "You are a helpful assistant.",
|
|
94
94
|
);
|
|
95
95
|
|
|
96
96
|
// Track pending tool outputs for addToolOutput
|
|
@@ -136,7 +136,7 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
136
136
|
* when server-side inference works fine.
|
|
137
137
|
*/
|
|
138
138
|
const doBrowserInference = useCallback(
|
|
139
|
-
async (allMessages:
|
|
139
|
+
async (allMessages: ChatMessage[]) => {
|
|
140
140
|
browserInferenceActiveRef.current = true;
|
|
141
141
|
|
|
142
142
|
try {
|
|
@@ -149,7 +149,7 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
149
149
|
let hasAddedMessage = false;
|
|
150
150
|
|
|
151
151
|
runBrowserInference(allMessages, systemPromptRef.current, {
|
|
152
|
-
onUpdate: (parts:
|
|
152
|
+
onUpdate: (parts: ChatMessagePart[], messageId: string) => {
|
|
153
153
|
if (!hasAddedMessage) {
|
|
154
154
|
hasAddedMessage = true;
|
|
155
155
|
setMessages((prev) => [
|
|
@@ -165,7 +165,7 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
165
165
|
}
|
|
166
166
|
setMessages((prev) => prev.map((m) => (m.id === messageId ? { ...m, parts } : m)));
|
|
167
167
|
},
|
|
168
|
-
onMessage: (assistantMessage:
|
|
168
|
+
onMessage: (assistantMessage: ChatMessage) => {
|
|
169
169
|
const withMeta = {
|
|
170
170
|
...assistantMessage,
|
|
171
171
|
metadata: { ...assistantMessage.metadata, model: model ?? "browser" },
|
|
@@ -205,13 +205,13 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
205
205
|
* Send a message and stream assistant updates.
|
|
206
206
|
*/
|
|
207
207
|
const sendMessage = useCallback(
|
|
208
|
-
async (message: { text: string; baseMessages?:
|
|
208
|
+
async (message: { text: string; baseMessages?: ChatMessage[]; userMessageId?: string }) => {
|
|
209
209
|
// Abort any in-flight request before starting a new one
|
|
210
210
|
abortControllerRef.current?.abort();
|
|
211
211
|
abortControllerRef.current = null;
|
|
212
212
|
const requestId = ++requestIdRef.current;
|
|
213
213
|
|
|
214
|
-
const userMessage:
|
|
214
|
+
const userMessage: ChatMessage = {
|
|
215
215
|
id: message.userMessageId ?? generateClientId("msg"),
|
|
216
216
|
role: "user",
|
|
217
217
|
parts: [{ type: "text", text: message.text }],
|
|
@@ -249,7 +249,7 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
249
249
|
signal: abortController.signal,
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
-
// Handle 503 — server can't provide
|
|
252
|
+
// Handle 503 — server can't provide a runtime, fall back to browser
|
|
253
253
|
if (response.status === 503 && (options.browserFallback ?? true)) {
|
|
254
254
|
try {
|
|
255
255
|
const body = await response.json();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatMessage, ChatMessagePart } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export function generateClientId(prefix: string): string {
|
|
4
4
|
return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export function createAssistantMessage(messageId: string, parts:
|
|
7
|
+
export function createAssistantMessage(messageId: string, parts: ChatMessagePart[]): ChatMessage {
|
|
8
8
|
return {
|
|
9
9
|
id: messageId || generateClientId("msg"),
|
|
10
10
|
role: "assistant",
|