veryfront 0.1.48 → 0.1.49
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/app/components/inline-input.d.ts +1 -4
- package/esm/cli/app/components/inline-input.d.ts.map +1 -1
- package/esm/cli/app/components/inline-input.js +1 -1
- package/esm/cli/app/components/list-select.d.ts +0 -8
- package/esm/cli/app/components/list-select.d.ts.map +1 -1
- package/esm/cli/app/components/list-select.js +0 -13
- package/esm/cli/app/operations/project-creation.d.ts +2 -14
- package/esm/cli/app/operations/project-creation.d.ts.map +1 -1
- package/esm/cli/app/operations/project-creation.js +3 -68
- package/esm/cli/app/shell.js +1 -1
- package/esm/cli/app/utils.d.ts +1 -2
- package/esm/cli/app/utils.d.ts.map +1 -1
- package/esm/cli/app/utils.js +1 -17
- package/esm/cli/app/views/dashboard.d.ts +0 -4
- package/esm/cli/app/views/dashboard.d.ts.map +1 -1
- package/esm/cli/app/views/dashboard.js +0 -15
- package/esm/cli/app/views/startup.d.ts +0 -4
- package/esm/cli/app/views/startup.d.ts.map +1 -1
- package/esm/cli/app/views/startup.js +0 -7
- package/esm/cli/auth/login.d.ts.map +1 -1
- package/esm/cli/auth/login.js +1 -2
- package/esm/cli/auth/token-store.js +1 -1
- package/esm/cli/auth/utils.d.ts +2 -1
- package/esm/cli/auth/utils.d.ts.map +1 -1
- package/esm/cli/commands/generate/integration-generator.js +1 -1
- package/esm/cli/commands/install/types.d.ts +2 -2
- package/esm/cli/help/formatters.d.ts +1 -1
- package/esm/cli/help/formatters.d.ts.map +1 -1
- package/esm/cli/help/formatters.js +8 -4
- package/esm/cli/help/main-help.d.ts.map +1 -1
- package/esm/cli/help/main-help.js +2 -2
- package/esm/cli/mcp/server.d.ts +0 -1
- package/esm/cli/mcp/server.d.ts.map +1 -1
- package/esm/cli/mcp/server.js +2 -5
- package/esm/cli/mcp/tools/dev-tools.d.ts +1 -1
- package/esm/cli/mcp/tools/dev-tools.d.ts.map +1 -1
- package/esm/cli/mcp/tools/dev-tools.js +1 -2
- package/esm/cli/mcp/tools/scaffold-tools.d.ts +2 -2
- package/esm/cli/mcp/tools.d.ts +1 -2
- package/esm/cli/mcp/tools.d.ts.map +1 -1
- package/esm/cli/mcp/tools.js +1 -2
- package/esm/cli/shared/reserve-slug.d.ts.map +1 -1
- package/esm/cli/shared/reserve-slug.js +1 -3
- package/esm/cli/sync/ignore.d.ts +1 -1
- package/esm/cli/sync/ignore.d.ts.map +1 -1
- package/esm/cli/sync/ignore.js +22 -18
- package/esm/cli/ui/colors.d.ts +0 -1
- package/esm/cli/ui/colors.d.ts.map +1 -1
- package/esm/cli/ui/colors.js +0 -10
- package/esm/cli/ui/dot-matrix.d.ts.map +1 -1
- package/esm/cli/ui/dot-matrix.js +2 -5
- package/esm/cli/ui/tui.js +2 -3
- package/esm/cli/utils/index.js +1 -2
- package/esm/cli/utils/package-manager.d.ts.map +1 -1
- package/esm/cli/utils/package-manager.js +3 -4
- package/esm/deno.d.ts +3 -0
- package/esm/deno.js +22 -19
- package/esm/src/agent/chat-handler.d.ts.map +1 -1
- package/esm/src/agent/chat-handler.js +8 -23
- package/esm/src/agent/factory.d.ts +0 -8
- package/esm/src/agent/factory.d.ts.map +1 -1
- package/esm/src/agent/factory.js +50 -1
- package/esm/src/agent/index.d.ts +16 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +16 -1
- package/esm/src/agent/memory/memory.d.ts +2 -2
- package/esm/src/agent/memory/memory.d.ts.map +1 -1
- package/esm/src/agent/memory/memory.js +0 -1
- package/esm/src/agent/react/use-chat/types.d.ts +2 -0
- package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +15 -9
- package/esm/src/agent/runtime/index.d.ts +18 -0
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +167 -36
- package/esm/src/agent/runtime/tool-helpers.d.ts +6 -1
- package/esm/src/agent/runtime/tool-helpers.d.ts.map +1 -1
- package/esm/src/agent/runtime/tool-helpers.js +10 -1
- package/esm/src/agent/schemas/agent.schema.d.ts +4 -4
- package/esm/src/agent/types.d.ts +10 -0
- package/esm/src/agent/types.d.ts.map +1 -1
- package/esm/src/ai/registry-manager.d.ts.map +1 -1
- package/esm/src/ai/registry-manager.js +2 -1
- package/esm/src/build/bundler/code-splitter/manifest-builder.d.ts +0 -2
- package/esm/src/build/bundler/code-splitter/manifest-builder.d.ts.map +1 -1
- package/esm/src/build/bundler/code-splitter/manifest-builder.js +1 -1
- package/esm/src/build/compiler/mdx-compiler/validator.d.ts.map +1 -1
- package/esm/src/build/compiler/mdx-compiler/validator.js +2 -3
- package/esm/src/build/compiler/mdx-to-js.d.ts +0 -2
- package/esm/src/build/compiler/mdx-to-js.d.ts.map +1 -1
- package/esm/src/build/compiler/mdx-to-js.js +0 -81
- package/esm/src/build/index.d.ts +0 -6
- package/esm/src/build/index.d.ts.map +1 -1
- package/esm/src/build/index.js +0 -1
- package/esm/src/build/production-build/build/route-collector.d.ts.map +1 -1
- package/esm/src/build/production-build/build/route-collector.js +2 -3
- package/esm/src/build/production-build/templates.d.ts +5 -9
- package/esm/src/build/production-build/templates.d.ts.map +1 -1
- package/esm/src/build/production-build/templates.js +6 -18
- package/esm/src/build/vendor-cache.d.ts.map +1 -1
- package/esm/src/build/vendor-cache.js +0 -5
- package/esm/src/cache/tokenizing-gateway.d.ts +0 -2
- package/esm/src/cache/tokenizing-gateway.d.ts.map +1 -1
- package/esm/src/cache/tokenizing-gateway.js +1 -3
- package/esm/src/chat/index.d.ts +2 -2
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +1 -1
- package/esm/src/config/define-config.d.ts.map +1 -1
- package/esm/src/config/define-config.js +28 -25
- package/esm/src/config/loader.d.ts.map +1 -1
- package/esm/src/config/loader.js +10 -7
- package/esm/src/config/schemas/config.schema.d.ts +58 -12
- package/esm/src/config/schemas/config.schema.d.ts.map +1 -1
- package/esm/src/config/schemas/config.schema.js +12 -0
- package/esm/src/data/data-fetcher.d.ts +1 -2
- package/esm/src/data/data-fetcher.d.ts.map +1 -1
- package/esm/src/data/data-fetcher.js +14 -15
- package/esm/src/data/server-data-fetcher.d.ts +0 -3
- package/esm/src/data/server-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.js +1 -8
- package/esm/src/data/static-data-fetcher.d.ts +1 -3
- package/esm/src/data/static-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/static-data-fetcher.js +1 -3
- package/esm/src/discovery/discovery-engine.d.ts.map +1 -1
- package/esm/src/discovery/discovery-engine.js +19 -1
- package/esm/src/discovery/discovery-utils.d.ts +0 -4
- package/esm/src/discovery/discovery-utils.d.ts.map +1 -1
- package/esm/src/discovery/discovery-utils.js +0 -6
- package/esm/src/discovery/file-discovery.d.ts +3 -1
- package/esm/src/discovery/file-discovery.d.ts.map +1 -1
- package/esm/src/discovery/file-discovery.js +3 -8
- package/esm/src/discovery/handlers/index.d.ts +1 -0
- package/esm/src/discovery/handlers/index.d.ts.map +1 -1
- package/esm/src/discovery/handlers/index.js +1 -0
- package/esm/src/discovery/handlers/skill-handler.d.ts +26 -0
- package/esm/src/discovery/handlers/skill-handler.d.ts.map +1 -0
- package/esm/src/discovery/handlers/skill-handler.js +87 -0
- package/esm/src/discovery/handlers/task-handler.d.ts.map +1 -1
- package/esm/src/discovery/handlers/task-handler.js +1 -5
- package/esm/src/discovery/transpiler.d.ts.map +1 -1
- package/esm/src/discovery/transpiler.js +7 -4
- package/esm/src/discovery/types.d.ts +3 -0
- package/esm/src/discovery/types.d.ts.map +1 -1
- package/esm/src/embedding/resolve.d.ts.map +1 -1
- package/esm/src/embedding/resolve.js +1 -3
- package/esm/src/embedding/upload-handler.d.ts.map +1 -1
- package/esm/src/embedding/upload-handler.js +4 -3
- package/esm/src/embedding/upload-store.js +4 -4
- package/esm/src/errors/error-registry.d.ts +2 -1
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/errors/http-error.d.ts +1 -2
- package/esm/src/errors/http-error.d.ts.map +1 -1
- package/esm/src/errors/http-error.js +2 -2
- package/esm/src/errors/middleware/cli-error-boundary.d.ts.map +1 -1
- package/esm/src/errors/middleware/cli-error-boundary.js +13 -2
- package/esm/src/errors/middleware/wrap-unknown.d.ts +0 -7
- package/esm/src/errors/middleware/wrap-unknown.d.ts.map +1 -1
- package/esm/src/errors/middleware/wrap-unknown.js +0 -9
- package/esm/src/errors/veryfront-error.d.ts +0 -3
- package/esm/src/errors/veryfront-error.d.ts.map +1 -1
- package/esm/src/errors/veryfront-error.js +0 -5
- package/esm/src/html/schemas/html.schema.d.ts +2 -2
- package/esm/src/html/styles-builder/css-hash-cache.d.ts.map +1 -1
- package/esm/src/html/styles-builder/css-hash-cache.js +1 -2
- package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
- package/esm/src/html/styles-builder/plugin-loader.js +50 -21
- package/esm/src/html/styles-builder/tailwind-compiler-cache.d.ts.map +1 -1
- package/esm/src/html/styles-builder/tailwind-compiler-cache.js +12 -4
- package/esm/src/html/utils.d.ts +0 -7
- package/esm/src/html/utils.d.ts.map +1 -1
- package/esm/src/html/utils.js +0 -25
- package/esm/src/modules/component-registry/registry.d.ts +0 -3
- package/esm/src/modules/component-registry/registry.d.ts.map +1 -1
- package/esm/src/modules/component-registry/registry.js +0 -3
- package/esm/src/oauth/handlers/callback-handler.d.ts +2 -0
- package/esm/src/oauth/handlers/callback-handler.d.ts.map +1 -1
- package/esm/src/oauth/handlers/callback-handler.js +10 -4
- package/esm/src/oauth/providers/common.d.ts.map +1 -1
- package/esm/src/oauth/providers/common.js +0 -23
- package/esm/src/observability/auto-instrument/react-instrumentation.js +2 -1
- package/esm/src/observability/instruments/instruments-factory.d.ts +1 -1
- package/esm/src/observability/instruments/instruments-factory.d.ts.map +1 -1
- package/esm/src/observability/instruments/instruments-factory.js +5 -4
- package/esm/src/observability/metrics/config.js +5 -4
- package/esm/src/observability/metrics/manager.js +1 -1
- package/esm/src/observability/tracing/span-operations.d.ts.map +1 -1
- package/esm/src/observability/tracing/span-operations.js +14 -8
- package/esm/src/platform/compat/console/node.d.ts +0 -1
- package/esm/src/platform/compat/console/node.d.ts.map +1 -1
- package/esm/src/platform/compat/console/node.js +4 -11
- package/esm/src/platform/compat/fs.d.ts.map +1 -1
- package/esm/src/platform/compat/fs.js +4 -2
- package/esm/src/platform/compat/opaque-deps.d.ts +4 -2
- package/esm/src/platform/compat/opaque-deps.d.ts.map +1 -1
- package/esm/src/platform/compat/opaque-deps.js +1 -1
- package/esm/src/platform/compat/path/basic-operations.d.ts.map +1 -1
- package/esm/src/platform/compat/path/basic-operations.js +8 -7
- package/esm/src/platform/compat/path/resolution.d.ts.map +1 -1
- package/esm/src/platform/compat/path/resolution.js +15 -10
- package/esm/src/platform/compat/path/url-conversion.d.ts.map +1 -1
- package/esm/src/platform/compat/path/url-conversion.js +3 -2
- package/esm/src/platform/compat/process.d.ts +2 -14
- package/esm/src/platform/compat/process.d.ts.map +1 -1
- package/esm/src/platform/compat/process.js +92 -70
- package/esm/src/provider/index.d.ts +1 -1
- package/esm/src/provider/index.d.ts.map +1 -1
- package/esm/src/provider/index.js +1 -1
- package/esm/src/provider/local/ai-sdk-adapter.d.ts.map +1 -1
- package/esm/src/provider/local/ai-sdk-adapter.js +18 -18
- package/esm/src/provider/local/env.d.ts.map +1 -1
- package/esm/src/provider/local/env.js +2 -1
- package/esm/src/provider/model-registry.d.ts +10 -0
- package/esm/src/provider/model-registry.d.ts.map +1 -1
- package/esm/src/provider/model-registry.js +43 -0
- package/esm/src/proxy/retry.d.ts +3 -3
- package/esm/src/proxy/retry.d.ts.map +1 -1
- package/esm/src/proxy/retry.js +0 -7
- package/esm/src/proxy/tracing.d.ts +1 -5
- package/esm/src/proxy/tracing.d.ts.map +1 -1
- package/esm/src/proxy/tracing.js +1 -7
- package/esm/src/react/components/ai/chat/components/code-block.js +1 -1
- package/esm/src/react/components/ai/chat/components/skill-badge.d.ts +12 -0
- package/esm/src/react/components/ai/chat/components/skill-badge.d.ts.map +1 -0
- package/esm/src/react/components/ai/chat/components/skill-badge.js +34 -0
- package/esm/src/react/components/ai/chat/components/step-indicator.js +4 -4
- package/esm/src/react/components/ai/chat/composition/chat-message-list.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/composition/chat-message-list.js +8 -2
- package/esm/src/react/components/ai/chat/composition/message.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/composition/message.js +8 -2
- package/esm/src/react/components/ai/chat/index.d.ts +4 -1
- package/esm/src/react/components/ai/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/index.js +4 -3
- package/esm/src/react/components/ai/chat/utils/message-parts.d.ts +2 -0
- package/esm/src/react/components/ai/chat/utils/message-parts.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/utils/message-parts.js +9 -0
- package/esm/src/react/components/ai/chat-with-sidebar.d.ts +1 -0
- package/esm/src/react/components/ai/chat-with-sidebar.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat-with-sidebar.js +1 -0
- package/esm/src/react/components/ai/chat.d.ts +1 -1
- package/esm/src/react/components/ai/chat.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat.js +1 -1
- package/esm/src/rendering/cache/index.d.ts +1 -5
- package/esm/src/rendering/cache/index.d.ts.map +1 -1
- package/esm/src/rendering/cache/index.js +1 -5
- package/esm/src/rendering/orchestrator/pipeline.d.ts +11 -2
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/shared/context-aware-cache.d.ts.map +1 -1
- package/esm/src/rendering/shared/context-aware-cache.js +0 -4
- package/esm/src/repositories/schemas/index.d.ts +1 -1
- package/esm/src/repositories/schemas/index.d.ts.map +1 -1
- package/esm/src/repositories/schemas/index.js +1 -1
- package/esm/src/repositories/schemas/repository.schema.d.ts +0 -11
- package/esm/src/repositories/schemas/repository.schema.d.ts.map +1 -1
- package/esm/src/repositories/schemas/repository.schema.js +0 -13
- package/esm/src/repositories/types.d.ts +1 -1
- package/esm/src/repositories/types.d.ts.map +1 -1
- package/esm/src/routing/api/module-loader/loader.d.ts.map +1 -1
- package/esm/src/routing/api/module-loader/loader.js +63 -7
- package/esm/src/routing/api/openapi/path-utils.d.ts +0 -19
- package/esm/src/routing/api/openapi/path-utils.d.ts.map +1 -1
- package/esm/src/routing/api/openapi/path-utils.js +0 -34
- package/esm/src/routing/api/openapi/spec-generator.d.ts.map +1 -1
- package/esm/src/routing/api/openapi/spec-generator.js +1 -19
- package/esm/src/routing/api/openapi/types.d.ts +1 -0
- package/esm/src/routing/api/openapi/types.d.ts.map +1 -1
- package/esm/src/routing/api/openapi/types.js +18 -0
- package/esm/src/sandbox/sandbox.d.ts +1 -0
- package/esm/src/sandbox/sandbox.d.ts.map +1 -1
- package/esm/src/sandbox/sandbox.js +7 -8
- package/esm/src/security/http/cors/constants.d.ts +0 -2
- package/esm/src/security/http/cors/constants.d.ts.map +1 -1
- package/esm/src/security/http/cors/constants.js +0 -2
- package/esm/src/security/http/response/index.d.ts +3 -4
- package/esm/src/security/http/response/index.d.ts.map +1 -1
- package/esm/src/security/http/response/index.js +2 -3
- package/esm/src/server/context/enriched-context.d.ts +0 -8
- package/esm/src/server/context/enriched-context.d.ts.map +1 -1
- package/esm/src/server/context/enriched-context.js +1 -12
- package/esm/src/server/dev-server/server.d.ts.map +1 -1
- package/esm/src/server/dev-server/server.js +11 -4
- package/esm/src/server/dev-ui/manifest.d.ts +20 -20
- package/esm/src/server/dev-ui/manifest.js +20 -20
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +426 -179
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +14 -24
- package/esm/src/server/shared/renderer/memory/pressure.d.ts +0 -7
- package/esm/src/server/shared/renderer/memory/pressure.d.ts.map +1 -1
- package/esm/src/server/shared/renderer/memory/pressure.js +1 -13
- package/esm/src/server/utils/domain-lookup.d.ts +0 -4
- package/esm/src/server/utils/domain-lookup.d.ts.map +1 -1
- package/esm/src/server/utils/domain-lookup.js +0 -3
- package/esm/src/skill/allowed-tools.d.ts +54 -0
- package/esm/src/skill/allowed-tools.d.ts.map +1 -0
- package/esm/src/skill/allowed-tools.js +87 -0
- package/esm/src/skill/executor.d.ts +28 -0
- package/esm/src/skill/executor.d.ts.map +1 -0
- package/esm/src/skill/executor.js +187 -0
- package/esm/src/skill/index.d.ts +19 -0
- package/esm/src/skill/index.d.ts.map +1 -0
- package/esm/src/skill/index.js +24 -0
- package/esm/src/skill/parser.d.ts +30 -0
- package/esm/src/skill/parser.d.ts.map +1 -0
- package/esm/src/skill/parser.js +162 -0
- package/esm/src/skill/path-safety.d.ts +22 -0
- package/esm/src/skill/path-safety.d.ts.map +1 -0
- package/esm/src/skill/path-safety.js +156 -0
- package/esm/src/skill/prompt-augmentation.d.ts +19 -0
- package/esm/src/skill/prompt-augmentation.d.ts.map +1 -0
- package/esm/src/skill/prompt-augmentation.js +36 -0
- package/esm/src/skill/registry.d.ts +25 -0
- package/esm/src/skill/registry.d.ts.map +1 -0
- package/esm/src/skill/registry.js +42 -0
- package/esm/src/skill/tools.d.ts +27 -0
- package/esm/src/skill/tools.d.ts.map +1 -0
- package/esm/src/skill/tools.js +149 -0
- package/esm/src/skill/types.d.ts +85 -0
- package/esm/src/skill/types.d.ts.map +1 -0
- package/esm/src/skill/types.js +27 -0
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
- package/esm/src/studio/element-selector-injector.d.ts +0 -2
- package/esm/src/studio/element-selector-injector.d.ts.map +1 -1
- package/esm/src/task/runner.d.ts +6 -0
- package/esm/src/task/runner.d.ts.map +1 -1
- package/esm/src/task/runner.js +8 -8
- package/esm/src/tool/factory.js +31 -39
- package/esm/src/transforms/esm/http-cache-helpers.d.ts +0 -8
- package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache-helpers.js +0 -20
- package/esm/src/transforms/esm/path-resolver.d.ts +0 -14
- package/esm/src/transforms/esm/path-resolver.d.ts.map +1 -1
- package/esm/src/transforms/esm/path-resolver.js +1 -92
- package/esm/src/transforms/esm/source-url-embed.d.ts +0 -14
- package/esm/src/transforms/esm/source-url-embed.d.ts.map +1 -1
- package/esm/src/transforms/esm/source-url-embed.js +0 -47
- package/esm/src/transforms/esm/transform-cache.d.ts.map +1 -1
- package/esm/src/transforms/esm/transform-cache.js +2 -6
- package/esm/src/transforms/mdx/index.d.ts +0 -1
- package/esm/src/transforms/mdx/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/index.js +0 -4
- package/esm/src/transforms/pipeline/context.d.ts +0 -1
- package/esm/src/transforms/pipeline/context.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/context.js +0 -1
- package/esm/src/transforms/pipeline/index.d.ts +1 -2
- package/esm/src/transforms/pipeline/index.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/index.js +0 -3
- package/esm/src/transforms/pipeline/stages/ssr-http-cache.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-http-cache.js +0 -1
- package/esm/src/types/entities/getEntityInfo.js +1 -1
- package/esm/src/types/index.d.ts +2 -13
- package/esm/src/types/index.d.ts.map +1 -1
- package/esm/src/types/server.d.ts +2 -1
- package/esm/src/types/server.d.ts.map +1 -1
- package/esm/src/utils/cache-file-ops.d.ts +1 -1
- package/esm/src/utils/cache-file-ops.d.ts.map +1 -1
- package/esm/src/utils/cache-file-ops.js +5 -6
- package/esm/src/utils/lru-wrapper.d.ts.map +1 -1
- package/esm/src/utils/lru-wrapper.js +2 -4
- package/esm/src/workflow/claude-code/event-publisher.d.ts +0 -4
- package/esm/src/workflow/claude-code/event-publisher.d.ts.map +1 -1
- package/esm/src/workflow/claude-code/event-publisher.js +2 -6
- package/esm/src/workflow/executor/workflow-executor.d.ts.map +1 -1
- package/esm/src/workflow/executor/workflow-executor.js +6 -1
- package/esm/src/workflow/react/use-workflow-list.d.ts.map +1 -1
- package/esm/src/workflow/react/use-workflow-list.js +2 -1
- package/esm/src/workflow/schemas/workflow.schema.d.ts +8 -8
- package/package.json +1 -2
- package/src/cli/app/components/inline-input.ts +0 -5
- package/src/cli/app/components/list-select.ts +0 -21
- package/src/cli/app/operations/project-creation.ts +4 -109
- package/src/cli/app/shell.ts +1 -1
- package/src/cli/app/utils.ts +0 -22
- package/src/cli/app/views/dashboard.ts +0 -17
- package/src/cli/app/views/startup.ts +0 -13
- package/src/cli/auth/login.ts +1 -2
- package/src/cli/auth/token-store.ts +1 -1
- package/src/cli/auth/utils.ts +2 -1
- package/src/cli/commands/generate/integration-generator.ts +1 -1
- package/src/cli/help/formatters.ts +11 -4
- package/src/cli/help/main-help.ts +2 -3
- package/src/cli/mcp/server.ts +2 -5
- package/src/cli/mcp/tools/dev-tools.ts +1 -2
- package/src/cli/mcp/tools.ts +8 -2
- package/src/cli/shared/reserve-slug.ts +1 -4
- package/src/cli/sync/ignore.ts +26 -21
- package/src/cli/ui/colors.ts +0 -12
- package/src/cli/ui/dot-matrix.ts +3 -6
- package/src/cli/ui/tui.ts +3 -3
- package/src/cli/utils/index.ts +1 -1
- package/src/cli/utils/package-manager.ts +3 -4
- package/src/deno.js +22 -19
- package/src/src/agent/chat-handler.ts +8 -23
- package/src/src/agent/factory.ts +58 -9
- package/src/src/agent/index.ts +16 -1
- package/src/src/agent/memory/memory.ts +0 -9
- package/src/src/agent/react/use-chat/types.ts +2 -0
- package/src/src/agent/react/use-chat/use-chat.ts +15 -9
- package/src/src/agent/runtime/index.ts +213 -35
- package/src/src/agent/runtime/tool-helpers.ts +9 -0
- package/src/src/agent/types.ts +10 -0
- package/src/src/ai/registry-manager.ts +2 -1
- package/src/src/build/bundler/code-splitter/manifest-builder.ts +1 -1
- package/src/src/build/compiler/mdx-compiler/validator.ts +3 -7
- package/src/src/build/compiler/mdx-to-js.ts +0 -101
- package/src/src/build/index.ts +0 -8
- package/src/src/build/production-build/build/route-collector.ts +2 -4
- package/src/src/build/production-build/templates.ts +9 -18
- package/src/src/build/vendor-cache.ts +0 -6
- package/src/src/cache/tokenizing-gateway.ts +1 -9
- package/src/src/chat/index.ts +3 -0
- package/src/src/config/define-config.ts +30 -29
- package/src/src/config/loader.ts +10 -9
- package/src/src/config/schemas/config.schema.ts +12 -0
- package/src/src/data/data-fetcher.ts +15 -21
- package/src/src/data/server-data-fetcher.ts +1 -8
- package/src/src/data/static-data-fetcher.ts +1 -6
- package/src/src/discovery/discovery-engine.ts +27 -0
- package/src/src/discovery/discovery-utils.ts +0 -7
- package/src/src/discovery/file-discovery.ts +3 -9
- package/src/src/discovery/handlers/index.ts +1 -0
- package/src/src/discovery/handlers/skill-handler.ts +123 -0
- package/src/src/discovery/handlers/task-handler.ts +1 -5
- package/src/src/discovery/transpiler.ts +7 -4
- package/src/src/discovery/types.ts +3 -0
- package/src/src/embedding/resolve.ts +1 -3
- package/src/src/embedding/upload-handler.ts +7 -3
- package/src/src/embedding/upload-store.ts +4 -4
- package/src/src/errors/error-registry.ts +2 -2
- package/src/src/errors/http-error.ts +7 -3
- package/src/src/errors/middleware/cli-error-boundary.ts +28 -2
- package/src/src/errors/middleware/wrap-unknown.ts +0 -10
- package/src/src/errors/veryfront-error.ts +0 -9
- package/src/src/html/styles-builder/css-hash-cache.ts +5 -2
- package/src/src/html/styles-builder/plugin-loader.ts +58 -21
- package/src/src/html/styles-builder/tailwind-compiler-cache.ts +11 -4
- package/src/src/html/utils.ts +0 -33
- package/src/src/modules/component-registry/registry.ts +0 -3
- package/src/src/modules/server/websocket-handler.ts +1 -1
- package/src/src/oauth/handlers/callback-handler.ts +17 -5
- package/src/src/oauth/providers/base.ts +3 -3
- package/src/src/oauth/providers/common.ts +0 -23
- package/src/src/observability/auto-instrument/react-instrumentation.ts +2 -2
- package/src/src/observability/instruments/instruments-factory.ts +6 -6
- package/src/src/observability/metrics/config.ts +5 -5
- package/src/src/observability/metrics/manager.ts +1 -1
- package/src/src/observability/tracing/span-operations.ts +14 -9
- package/src/src/platform/compat/console/node.ts +4 -14
- package/src/src/platform/compat/fs.ts +14 -3
- package/src/src/platform/compat/opaque-deps.ts +10 -5
- package/src/src/platform/compat/path/basic-operations.ts +9 -7
- package/src/src/platform/compat/path/resolution.ts +15 -8
- package/src/src/platform/compat/path/url-conversion.ts +10 -6
- package/src/src/platform/compat/process.ts +133 -76
- package/src/src/provider/index.ts +1 -0
- package/src/src/provider/local/ai-sdk-adapter.ts +40 -37
- package/src/src/provider/local/env.ts +4 -1
- package/src/src/provider/model-registry.ts +47 -0
- package/src/src/proxy/retry.ts +0 -9
- package/src/src/proxy/tracing.ts +1 -9
- package/src/src/react/components/ai/chat/components/code-block.tsx +1 -1
- package/src/src/react/components/ai/chat/components/skill-badge.tsx +51 -0
- package/src/src/react/components/ai/chat/components/step-indicator.tsx +4 -4
- package/src/src/react/components/ai/chat/composition/chat-message-list.tsx +9 -2
- package/src/src/react/components/ai/chat/composition/message.tsx +9 -2
- package/src/src/react/components/ai/chat/index.tsx +6 -1
- package/src/src/react/components/ai/chat/utils/message-parts.ts +11 -0
- package/src/src/react/components/ai/chat-with-sidebar.tsx +2 -0
- package/src/src/react/components/ai/chat.tsx +3 -0
- package/src/src/rendering/cache/index.ts +12 -5
- package/src/src/rendering/orchestrator/pipeline.ts +12 -2
- package/src/src/rendering/renderer.ts +1 -1
- package/src/src/rendering/shared/context-aware-cache.ts +0 -5
- package/src/src/repositories/schemas/index.ts +0 -2
- package/src/src/repositories/schemas/repository.schema.ts +0 -15
- package/src/src/repositories/types.ts +1 -6
- package/src/src/routing/api/module-loader/loader.ts +88 -3
- package/src/src/routing/api/openapi/path-utils.ts +0 -39
- package/src/src/routing/api/openapi/spec-generator.ts +1 -20
- package/src/src/routing/api/openapi/types.ts +20 -0
- package/src/src/sandbox/sandbox.ts +8 -8
- package/src/src/security/http/cors/constants.ts +0 -4
- package/src/src/security/http/response/index.ts +3 -9
- package/src/src/server/context/enriched-context.ts +1 -19
- package/src/src/server/dev-server/server.ts +11 -4
- package/src/src/server/dev-ui/manifest.js +20 -20
- package/src/src/server/handlers/dev/framework-candidates.generated.ts +426 -179
- package/src/src/server/runtime-handler/index.ts +17 -28
- package/src/src/server/shared/renderer/memory/pressure.ts +2 -15
- package/src/src/server/utils/domain-lookup.ts +0 -4
- package/src/src/skill/allowed-tools.ts +107 -0
- package/src/src/skill/executor.ts +215 -0
- package/src/src/skill/index.ts +60 -0
- package/src/src/skill/parser.ts +214 -0
- package/src/src/skill/path-safety.ts +203 -0
- package/src/src/skill/prompt-augmentation.ts +48 -0
- package/src/src/skill/registry.ts +51 -0
- package/src/src/skill/tools.ts +197 -0
- package/src/src/skill/types.ts +107 -0
- package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
- package/src/src/studio/element-selector-injector.ts +0 -2
- package/src/src/task/runner.ts +10 -8
- package/src/src/tool/factory.ts +54 -54
- package/src/src/transforms/esm/http-cache-helpers.ts +0 -20
- package/src/src/transforms/esm/path-resolver.ts +1 -140
- package/src/src/transforms/esm/source-url-embed.ts +0 -53
- package/src/src/transforms/esm/transform-cache.ts +3 -7
- package/src/src/transforms/mdx/index.ts +0 -5
- package/src/src/transforms/pipeline/context.ts +0 -2
- package/src/src/transforms/pipeline/index.ts +0 -4
- package/src/src/transforms/pipeline/stages/ssr-http-cache.ts +0 -1
- package/src/src/types/entities/getEntityInfo.ts +1 -1
- package/src/src/types/index.ts +1 -20
- package/src/src/types/server.ts +1 -1
- package/src/src/utils/cache-file-ops.ts +5 -5
- package/src/src/utils/lru-wrapper.ts +2 -8
- package/src/src/workflow/claude-code/event-publisher.ts +13 -4
- package/src/src/workflow/executor/workflow-executor.ts +7 -2
- package/src/src/workflow/react/use-workflow-list.ts +3 -2
- package/esm/src/transforms/mdx/parser.d.ts +0 -4
- package/esm/src/transforms/mdx/parser.d.ts.map +0 -1
- package/esm/src/transforms/mdx/parser.js +0 -49
- package/src/src/transforms/mdx/parser.ts +0 -65
|
@@ -77,6 +77,7 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
77
77
|
const [data, setData] = useState<unknown>(null);
|
|
78
78
|
const [model, setModel] = useState<string | undefined>(options.model);
|
|
79
79
|
const [inferenceMode, setInferenceMode] = useState<InferenceMode>("cloud");
|
|
80
|
+
const [activeModel, setActiveModel] = useState<string | undefined>(undefined);
|
|
80
81
|
const [browserStatus, setBrowserStatus] = useState<BrowserInferenceStatus | null>(null);
|
|
81
82
|
const abortControllerRef = useRef<AbortController | null>(null);
|
|
82
83
|
const requestIdRef = useRef(0);
|
|
@@ -253,9 +254,6 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
253
254
|
try {
|
|
254
255
|
const body = await response.json();
|
|
255
256
|
if (body.code === "NO_AI_AVAILABLE") {
|
|
256
|
-
if (body.systemPrompt) {
|
|
257
|
-
systemPromptRef.current = body.systemPrompt;
|
|
258
|
-
}
|
|
259
257
|
setInferenceMode("browser");
|
|
260
258
|
setBrowserStatus("idle");
|
|
261
259
|
await doBrowserInference(allMessages);
|
|
@@ -282,12 +280,15 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
282
280
|
const streamingMessageId = generateClientId("msg");
|
|
283
281
|
let hasAddedStreamingMessage = false;
|
|
284
282
|
const currentMessageIdRef = { current: streamingMessageId };
|
|
283
|
+
// Mutable local — updated by onData before onMessage/onUpdate use it.
|
|
284
|
+
let serverModel: string | undefined = model;
|
|
285
|
+
setActiveModel(undefined);
|
|
285
286
|
|
|
286
287
|
await handleStreamingResponse(response.body, {
|
|
287
288
|
onMessage: (assistantMessage) => {
|
|
288
289
|
const withMeta = {
|
|
289
290
|
...assistantMessage,
|
|
290
|
-
metadata: { ...assistantMessage.metadata, model },
|
|
291
|
+
metadata: { ...assistantMessage.metadata, model: serverModel },
|
|
291
292
|
};
|
|
292
293
|
setMessages((prev) => {
|
|
293
294
|
if (!hasAddedStreamingMessage) return [...prev, withMeta];
|
|
@@ -302,15 +303,19 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
302
303
|
},
|
|
303
304
|
onData: (eventData) => {
|
|
304
305
|
setData(eventData);
|
|
305
|
-
// Detect inference mode from server metadata
|
|
306
|
+
// Detect inference mode and resolved model from server metadata
|
|
306
307
|
if (
|
|
307
308
|
eventData &&
|
|
308
309
|
typeof eventData === "object" &&
|
|
309
310
|
"inferenceMode" in eventData
|
|
310
311
|
) {
|
|
311
|
-
const
|
|
312
|
-
if (
|
|
313
|
-
setInferenceMode(
|
|
312
|
+
const d = eventData as { inferenceMode: string; model?: string };
|
|
313
|
+
if (d.inferenceMode === "server-local" || d.inferenceMode === "cloud") {
|
|
314
|
+
setInferenceMode(d.inferenceMode);
|
|
315
|
+
}
|
|
316
|
+
if (d.model) {
|
|
317
|
+
serverModel = d.model;
|
|
318
|
+
setActiveModel(d.model);
|
|
314
319
|
}
|
|
315
320
|
}
|
|
316
321
|
},
|
|
@@ -331,7 +336,7 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
331
336
|
hasAddedStreamingMessage = true;
|
|
332
337
|
setMessages((
|
|
333
338
|
prev,
|
|
334
|
-
) => [...prev, { id, role: "assistant", parts, metadata: { model } }]);
|
|
339
|
+
) => [...prev, { id, role: "assistant", parts, metadata: { model: serverModel } }]);
|
|
335
340
|
return;
|
|
336
341
|
}
|
|
337
342
|
|
|
@@ -549,6 +554,7 @@ export function useChat(options: UseChatOptions): UseChatResult {
|
|
|
549
554
|
isLoading,
|
|
550
555
|
error,
|
|
551
556
|
model,
|
|
557
|
+
activeModel,
|
|
552
558
|
inferenceMode,
|
|
553
559
|
browserStatus,
|
|
554
560
|
setInput,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
type MessagePart,
|
|
22
22
|
type ToolCall,
|
|
23
23
|
} from "../types.js";
|
|
24
|
-
import { ensureModelReady, resolveModel } from "../../provider/index.js";
|
|
24
|
+
import { ensureModelReady, findAvailableCloudModel, resolveModel } from "../../provider/index.js";
|
|
25
25
|
import { executeTool } from "../../tool/index.js";
|
|
26
26
|
import { generateId } from "../../utils/id.js";
|
|
27
27
|
import { detectPlatform, getPlatformCapabilities } from "../../platform/core-platform.js";
|
|
@@ -56,28 +56,117 @@ import { DEFAULT_MAX_TOKENS, DEFAULT_TEMPERATURE } from "./constants.js";
|
|
|
56
56
|
import { generateMessageId, sendSSE } from "./sse-utils.js";
|
|
57
57
|
import { getAvailableTools, isDynamicTool, parseToolArgs } from "./tool-helpers.js";
|
|
58
58
|
import { accumulateUsage, getMaxSteps, normalizeInput } from "./input-utils.js";
|
|
59
|
+
import {
|
|
60
|
+
filterToolsForSkill,
|
|
61
|
+
isToolAllowedBySkill,
|
|
62
|
+
validateAllowedToolPatterns,
|
|
63
|
+
} from "../../skill/allowed-tools.js";
|
|
59
64
|
|
|
60
65
|
const logger = serverLogger.component("agent");
|
|
66
|
+
const LOAD_SKILL_TOOL_ID = "load-skill";
|
|
67
|
+
|
|
68
|
+
function getSkillActivationRequiredError(toolName: string): string {
|
|
69
|
+
return `Tool "${toolName}" cannot run before load-skill succeeds in the same step. ` +
|
|
70
|
+
`Call "${LOAD_SKILL_TOOL_ID}" first to establish the active skill context.`;
|
|
71
|
+
}
|
|
61
72
|
|
|
62
73
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
74
|
+
* Extract and validate the skill policy from a load-skill tool result.
|
|
75
|
+
* Returns `[]` (no tools allowed) for invalid/missing policies instead of
|
|
76
|
+
* `undefined` (no restrictions), preventing accidental policy bypass.
|
|
65
77
|
*/
|
|
66
|
-
function
|
|
67
|
-
if (
|
|
78
|
+
export function extractSkillPolicy(result: unknown): string[] | undefined {
|
|
79
|
+
if (!result || typeof result !== "object") return undefined;
|
|
80
|
+
const skillResult = result as { allowedTools?: unknown };
|
|
81
|
+
|
|
82
|
+
// No allowedTools key means the skill has no restrictions
|
|
83
|
+
if (!("allowedTools" in skillResult) || skillResult.allowedTools === undefined) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Validate the shape: must be a string array
|
|
88
|
+
const raw = skillResult.allowedTools;
|
|
89
|
+
if (!Array.isArray(raw) || !raw.every((v) => typeof v === "string")) {
|
|
90
|
+
// Invalid shape — fail closed (empty policy = no tools allowed)
|
|
91
|
+
logger.warn(
|
|
92
|
+
"load-skill returned invalid allowedTools; falling back to empty policy (no tools)",
|
|
93
|
+
);
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Validate each pattern against the regex
|
|
98
|
+
try {
|
|
99
|
+
return validateAllowedToolPatterns(raw);
|
|
100
|
+
} catch {
|
|
101
|
+
logger.warn(
|
|
102
|
+
"load-skill returned invalid tool patterns; falling back to empty policy (no tools)",
|
|
103
|
+
);
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Result of skill policy enforcement for a single tool call */
|
|
109
|
+
type SkillPolicyResult =
|
|
110
|
+
| { allowed: true }
|
|
111
|
+
| { allowed: false; error: string };
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Enforce skill policy on a single tool call.
|
|
115
|
+
* Shared between generate() and stream() paths.
|
|
116
|
+
*/
|
|
117
|
+
export function enforceSkillPolicy(
|
|
118
|
+
toolName: string,
|
|
119
|
+
activeSkillPolicy: string[] | undefined,
|
|
120
|
+
mustLoadSkillFirst: boolean,
|
|
121
|
+
): SkillPolicyResult {
|
|
122
|
+
// Must load skill before other tools
|
|
123
|
+
if (mustLoadSkillFirst && toolName !== LOAD_SKILL_TOOL_ID) {
|
|
124
|
+
return { allowed: false, error: getSkillActivationRequiredError(toolName) };
|
|
125
|
+
}
|
|
68
126
|
|
|
69
|
-
//
|
|
70
|
-
if (
|
|
127
|
+
// Check tool allowed by active skill policy (Layer 2: execution-time)
|
|
128
|
+
if (activeSkillPolicy && !isToolAllowedBySkill(toolName, activeSkillPolicy)) {
|
|
129
|
+
return {
|
|
130
|
+
allowed: false,
|
|
131
|
+
error: `Tool "${toolName}" is not allowed by the active skill policy. Allowed: ${
|
|
132
|
+
activeSkillPolicy.join(", ")
|
|
133
|
+
}`,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
71
136
|
|
|
72
|
-
|
|
137
|
+
return { allowed: true };
|
|
138
|
+
}
|
|
73
139
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Auto-upgrade a local model string to a cloud provider when API keys are available.
|
|
142
|
+
*
|
|
143
|
+
* Returns the upgraded "provider/model" string, or the original string unchanged
|
|
144
|
+
* if no cloud provider is available. This keeps resolveModel as a pure resolver
|
|
145
|
+
* while the runtime owns the upgrade policy.
|
|
146
|
+
*/
|
|
147
|
+
function maybeUpgradeLocalModel(modelString: string): string {
|
|
148
|
+
if (!modelString.startsWith("local/")) return modelString;
|
|
149
|
+
|
|
150
|
+
const cloud = findAvailableCloudModel();
|
|
151
|
+
if (cloud) {
|
|
152
|
+
logger.info(
|
|
153
|
+
`⚡ Cloud AI API key found — using "${cloud}" instead of local model.`,
|
|
154
|
+
);
|
|
155
|
+
return cloud;
|
|
78
156
|
}
|
|
157
|
+
return modelString;
|
|
158
|
+
}
|
|
79
159
|
|
|
80
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Check whether a resolved LanguageModel is a local inference model.
|
|
162
|
+
* Checks the model object properties rather than the requested string,
|
|
163
|
+
* because resolveModel may internally fall back from cloud to local.
|
|
164
|
+
*/
|
|
165
|
+
function isLocalModel(model: LanguageModel): boolean {
|
|
166
|
+
const m = model as Record<string, unknown>;
|
|
167
|
+
return !!m._isVfLocalModel ||
|
|
168
|
+
m.provider === "local" ||
|
|
169
|
+
(typeof m.modelId === "string" && m.modelId.startsWith("local/"));
|
|
81
170
|
}
|
|
82
171
|
|
|
83
172
|
export class AgentRuntime {
|
|
@@ -102,12 +191,12 @@ export class AgentRuntime {
|
|
|
102
191
|
context?: Record<string, unknown>,
|
|
103
192
|
modelOverride?: string,
|
|
104
193
|
): Promise<AgentResponse> {
|
|
105
|
-
const
|
|
194
|
+
const resolvedModelString = maybeUpgradeLocalModel(modelOverride || this.config.model);
|
|
106
195
|
|
|
107
196
|
return withSpan("agent.generate", async (span) => {
|
|
108
197
|
setSpanAttributes(span, {
|
|
109
198
|
"agent.id": this.id,
|
|
110
|
-
"agent.model":
|
|
199
|
+
"agent.model": resolvedModelString,
|
|
111
200
|
});
|
|
112
201
|
|
|
113
202
|
const inputMessages = normalizeInput(input);
|
|
@@ -118,7 +207,7 @@ export class AgentRuntime {
|
|
|
118
207
|
|
|
119
208
|
const agentContext: AgentContext = {
|
|
120
209
|
agentId: this.id,
|
|
121
|
-
model:
|
|
210
|
+
model: resolvedModelString,
|
|
122
211
|
input: inputMessages,
|
|
123
212
|
data: context,
|
|
124
213
|
platform: detectPlatform(),
|
|
@@ -127,7 +216,7 @@ export class AgentRuntime {
|
|
|
127
216
|
const chain = new MiddlewareChain(this.config.middleware);
|
|
128
217
|
return chain.execute(
|
|
129
218
|
agentContext,
|
|
130
|
-
() => this.executeAgentLoop(systemPrompt, messages,
|
|
219
|
+
() => this.executeAgentLoop(systemPrompt, messages, resolvedModelString),
|
|
131
220
|
);
|
|
132
221
|
});
|
|
133
222
|
}
|
|
@@ -145,8 +234,9 @@ export class AgentRuntime {
|
|
|
145
234
|
},
|
|
146
235
|
modelOverride?: string,
|
|
147
236
|
): Promise<ReadableStream<Uint8Array>> {
|
|
148
|
-
const
|
|
149
|
-
|
|
237
|
+
const requestedModel = modelOverride || this.config.model;
|
|
238
|
+
// Auto-upgrade local/* to a cloud provider when API keys are available.
|
|
239
|
+
const resolvedModelString = maybeUpgradeLocalModel(requestedModel);
|
|
150
240
|
|
|
151
241
|
for (const msg of messages) await this.memory.add(msg);
|
|
152
242
|
|
|
@@ -160,7 +250,11 @@ export class AgentRuntime {
|
|
|
160
250
|
// Resolve model BEFORE creating the ReadableStream — if this throws
|
|
161
251
|
// (e.g., no_ai_available), the error propagates to the caller who can
|
|
162
252
|
// return a proper error response (503) instead of a 200 with an error event.
|
|
163
|
-
const languageModel = resolveModel(
|
|
253
|
+
const languageModel = resolveModel(resolvedModelString);
|
|
254
|
+
|
|
255
|
+
// Determine inference mode from the resolved model object (not the string),
|
|
256
|
+
// because resolveModel may internally fall back from cloud to local.
|
|
257
|
+
const isLocal = isLocalModel(languageModel);
|
|
164
258
|
|
|
165
259
|
// Eagerly verify the model runtime is available. For local models this
|
|
166
260
|
// checks that @huggingface/transformers can be imported. Must happen
|
|
@@ -176,12 +270,17 @@ export class AgentRuntime {
|
|
|
176
270
|
|
|
177
271
|
const messageId = generateMessageId();
|
|
178
272
|
sendSSE(controller, encoder, { type: "message-start", messageId });
|
|
273
|
+
// Report the effective model — when resolveModel falls back from
|
|
274
|
+
// cloud to local (e.g. missing API key), use the resolved object's
|
|
275
|
+
// modelId so the client avatar matches the actual provider.
|
|
276
|
+
const effectiveModel = isLocal && !resolvedModelString.startsWith("local/")
|
|
277
|
+
? `local/${(languageModel as Record<string, unknown>).modelId ?? "unknown"}`
|
|
278
|
+
: resolvedModelString;
|
|
179
279
|
sendSSE(controller, encoder, {
|
|
180
280
|
type: "data",
|
|
181
281
|
data: {
|
|
182
|
-
inferenceMode:
|
|
183
|
-
|
|
184
|
-
: "cloud",
|
|
282
|
+
inferenceMode: isLocal ? "server-local" : "cloud",
|
|
283
|
+
model: effectiveModel,
|
|
185
284
|
},
|
|
186
285
|
});
|
|
187
286
|
sendSSE(controller, encoder, { type: "text-start", id: textPartId });
|
|
@@ -194,7 +293,7 @@ export class AgentRuntime {
|
|
|
194
293
|
callbacks,
|
|
195
294
|
textPartId,
|
|
196
295
|
toolContext,
|
|
197
|
-
|
|
296
|
+
resolvedModelString,
|
|
198
297
|
languageModel,
|
|
199
298
|
);
|
|
200
299
|
|
|
@@ -224,28 +323,38 @@ export class AgentRuntime {
|
|
|
224
323
|
return withSpan("agent.execution_loop", async (loopSpan) => {
|
|
225
324
|
const { maxAgentSteps } = getPlatformCapabilities();
|
|
226
325
|
const maxSteps = this.computeMaxSteps(maxAgentSteps);
|
|
227
|
-
const
|
|
228
|
-
const languageModel = resolveModel(
|
|
326
|
+
const effectiveModel = modelString || this.config.model;
|
|
327
|
+
const languageModel = resolveModel(effectiveModel);
|
|
229
328
|
|
|
230
329
|
const toolCalls: ToolCall[] = [];
|
|
231
330
|
const currentMessages = [...messages];
|
|
232
331
|
const totalUsage = { promptTokens: 0, completionTokens: 0, totalTokens: 0 };
|
|
233
332
|
|
|
234
333
|
// Local models can't reliably do function calling — skip tools gracefully.
|
|
235
|
-
const isLocal =
|
|
334
|
+
const isLocal = isLocalModel(languageModel);
|
|
236
335
|
if (isLocal && this.config.tools) {
|
|
237
336
|
logger.warn(
|
|
238
|
-
`Agent "${this.id}" has tools configured but is using local model "${
|
|
337
|
+
`Agent "${this.id}" has tools configured but is using local model "${effectiveModel}". ` +
|
|
239
338
|
"Local models don't support tool calling — tools will be skipped. " +
|
|
240
339
|
"Set OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY for full tool support.",
|
|
241
340
|
);
|
|
242
341
|
}
|
|
243
342
|
|
|
343
|
+
// Request-scoped skill policy (not class-level mutable state)
|
|
344
|
+
let activeSkillPolicy: string[] | undefined;
|
|
345
|
+
|
|
244
346
|
for (let step = 0; step < maxSteps; step++) {
|
|
245
347
|
this.status = "thinking";
|
|
246
348
|
addSpanEvent(loopSpan, "step_start", { step });
|
|
247
349
|
|
|
248
|
-
|
|
350
|
+
let tools = isLocal ? [] : getAvailableTools(this.config.tools, {
|
|
351
|
+
includeSkillTools: Boolean(this.config.skills),
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// Layer 1: Filter tools based on active skill policy (planning-time)
|
|
355
|
+
if (activeSkillPolicy) {
|
|
356
|
+
tools = filterToolsForSkill(tools, activeSkillPolicy);
|
|
357
|
+
}
|
|
249
358
|
|
|
250
359
|
const response = await withSpan("agent.generate_text", async (span) => {
|
|
251
360
|
setSpanAttributes(span, {
|
|
@@ -308,6 +417,9 @@ export class AgentRuntime {
|
|
|
308
417
|
|
|
309
418
|
this.status = "tool_execution";
|
|
310
419
|
addSpanEvent(loopSpan, "tool_execution_start", { count: response.toolCalls.length });
|
|
420
|
+
let mustLoadSkillFirst = !activeSkillPolicy &&
|
|
421
|
+
Boolean(this.config.skills) &&
|
|
422
|
+
response.toolCalls.some((tc) => tc.toolName === LOAD_SKILL_TOOL_ID);
|
|
311
423
|
|
|
312
424
|
for (const tc of response.toolCalls) {
|
|
313
425
|
const toolCall: ToolCall = {
|
|
@@ -320,6 +432,32 @@ export class AgentRuntime {
|
|
|
320
432
|
await withSpan("agent.tool_execute", async (toolSpan) => {
|
|
321
433
|
setSpanAttributes(toolSpan, { "tool.name": tc.toolName, "tool.id": tc.toolCallId });
|
|
322
434
|
|
|
435
|
+
const policyCheck = enforceSkillPolicy(
|
|
436
|
+
tc.toolName,
|
|
437
|
+
activeSkillPolicy,
|
|
438
|
+
mustLoadSkillFirst,
|
|
439
|
+
);
|
|
440
|
+
if (!policyCheck.allowed) {
|
|
441
|
+
toolCall.status = "error";
|
|
442
|
+
toolCall.error = policyCheck.error;
|
|
443
|
+
|
|
444
|
+
const errorMessage: Message = {
|
|
445
|
+
id: `tool_error_${tc.toolCallId}`,
|
|
446
|
+
role: "tool",
|
|
447
|
+
parts: [{
|
|
448
|
+
type: "tool-result",
|
|
449
|
+
toolCallId: tc.toolCallId,
|
|
450
|
+
toolName: tc.toolName,
|
|
451
|
+
result: { error: policyCheck.error },
|
|
452
|
+
}],
|
|
453
|
+
timestamp: Date.now(),
|
|
454
|
+
};
|
|
455
|
+
currentMessages.push(errorMessage);
|
|
456
|
+
await this.memory.add(errorMessage);
|
|
457
|
+
toolCalls.push(toolCall);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
|
|
323
461
|
try {
|
|
324
462
|
toolCall.status = "executing";
|
|
325
463
|
const startTime = Date.now();
|
|
@@ -330,6 +468,12 @@ export class AgentRuntime {
|
|
|
330
468
|
toolCall.result = result;
|
|
331
469
|
toolCall.executionTime = Date.now() - startTime;
|
|
332
470
|
|
|
471
|
+
// Track skill policy from load-skill results
|
|
472
|
+
if (tc.toolName === LOAD_SKILL_TOOL_ID) {
|
|
473
|
+
activeSkillPolicy = extractSkillPolicy(result);
|
|
474
|
+
mustLoadSkillFirst = false;
|
|
475
|
+
}
|
|
476
|
+
|
|
333
477
|
const toolResultMessage: Message = {
|
|
334
478
|
id: `tool_${tc.toolCallId}`,
|
|
335
479
|
role: "tool",
|
|
@@ -408,27 +552,38 @@ export class AgentRuntime {
|
|
|
408
552
|
): Promise<AgentResponse> {
|
|
409
553
|
const { maxAgentSteps } = getPlatformCapabilities();
|
|
410
554
|
const maxSteps = this.computeMaxSteps(maxAgentSteps);
|
|
411
|
-
const
|
|
412
|
-
const languageModel = resolvedModel ?? resolveModel(
|
|
555
|
+
const effectiveModel = modelString || this.config.model;
|
|
556
|
+
const languageModel = resolvedModel ?? resolveModel(effectiveModel);
|
|
413
557
|
|
|
414
558
|
const toolCalls: ToolCall[] = [];
|
|
415
559
|
const currentMessages = [...messages];
|
|
416
560
|
const totalUsage = { promptTokens: 0, completionTokens: 0, totalTokens: 0 };
|
|
417
561
|
|
|
418
562
|
// Local models can't reliably do function calling — skip tools gracefully.
|
|
419
|
-
const isLocalStreaming =
|
|
563
|
+
const isLocalStreaming = isLocalModel(languageModel);
|
|
420
564
|
if (isLocalStreaming && this.config.tools) {
|
|
421
565
|
logger.warn(
|
|
422
|
-
`Agent "${this.id}" has tools configured but is using local model "${
|
|
566
|
+
`Agent "${this.id}" has tools configured but is using local model "${effectiveModel}". ` +
|
|
423
567
|
"Local models don't support tool calling — tools will be skipped. " +
|
|
424
568
|
"Set OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY for full tool support.",
|
|
425
569
|
);
|
|
426
570
|
}
|
|
427
571
|
|
|
572
|
+
// Request-scoped skill policy (not class-level mutable state)
|
|
573
|
+
let activeSkillPolicy: string[] | undefined;
|
|
574
|
+
|
|
428
575
|
for (let step = 0; step < maxSteps; step++) {
|
|
429
576
|
sendSSE(controller, encoder, { type: "step-start" });
|
|
430
577
|
|
|
431
|
-
|
|
578
|
+
let tools = isLocalStreaming ? [] : getAvailableTools(this.config.tools, {
|
|
579
|
+
includeSkillTools: Boolean(this.config.skills),
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
// Layer 1: Filter tools based on active skill policy (planning-time)
|
|
583
|
+
if (activeSkillPolicy) {
|
|
584
|
+
tools = filterToolsForSkill(tools, activeSkillPolicy);
|
|
585
|
+
}
|
|
586
|
+
|
|
432
587
|
const result = streamText({
|
|
433
588
|
model: languageModel,
|
|
434
589
|
system: systemPrompt,
|
|
@@ -478,8 +633,12 @@ export class AgentRuntime {
|
|
|
478
633
|
}
|
|
479
634
|
|
|
480
635
|
this.status = "tool_execution";
|
|
636
|
+
const streamedToolCalls = Array.from(state.toolCalls.values());
|
|
637
|
+
let mustLoadSkillFirst = !activeSkillPolicy &&
|
|
638
|
+
Boolean(this.config.skills) &&
|
|
639
|
+
streamedToolCalls.some((tc) => tc.name === LOAD_SKILL_TOOL_ID);
|
|
481
640
|
|
|
482
|
-
for (const tc of
|
|
641
|
+
for (const tc of streamedToolCalls) {
|
|
483
642
|
const { args, error: argError } = parseToolArgs(tc.arguments);
|
|
484
643
|
const toolCall: ToolCall = { id: tc.id, name: tc.name, args, status: "pending" };
|
|
485
644
|
|
|
@@ -508,6 +667,19 @@ export class AgentRuntime {
|
|
|
508
667
|
continue;
|
|
509
668
|
}
|
|
510
669
|
|
|
670
|
+
const policyCheck = enforceSkillPolicy(tc.name, activeSkillPolicy, mustLoadSkillFirst);
|
|
671
|
+
if (!policyCheck.allowed) {
|
|
672
|
+
await this.recordToolError(
|
|
673
|
+
toolCall,
|
|
674
|
+
policyCheck.error,
|
|
675
|
+
controller,
|
|
676
|
+
encoder,
|
|
677
|
+
currentMessages,
|
|
678
|
+
toolCalls,
|
|
679
|
+
);
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
|
|
511
683
|
try {
|
|
512
684
|
toolCall.status = "executing";
|
|
513
685
|
const startTime = Date.now();
|
|
@@ -524,6 +696,12 @@ export class AgentRuntime {
|
|
|
524
696
|
toolCall.executionTime = Date.now() - startTime;
|
|
525
697
|
toolCalls.push(toolCall);
|
|
526
698
|
|
|
699
|
+
// Track skill policy from load-skill results
|
|
700
|
+
if (tc.name === LOAD_SKILL_TOOL_ID) {
|
|
701
|
+
activeSkillPolicy = extractSkillPolicy(result);
|
|
702
|
+
mustLoadSkillFirst = false;
|
|
703
|
+
}
|
|
704
|
+
|
|
527
705
|
const dynamic = isDynamicTool(tc.name);
|
|
528
706
|
sendSSE(controller, encoder, {
|
|
529
707
|
type: "tool-output-available",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import type { Tool, ToolDefinition } from "../../tool/index.js";
|
|
10
10
|
import { toolRegistry } from "../../tool/index.js";
|
|
11
11
|
import { toolToProviderDefinition } from "../../tool/registry.js";
|
|
12
|
+
import { SKILL_TOOL_IDS } from "../../skill/types.js";
|
|
12
13
|
import { serverLogger } from "../../utils/index.js";
|
|
13
14
|
|
|
14
15
|
const logger = serverLogger.component("agent");
|
|
@@ -87,9 +88,13 @@ function addToolDefinition(
|
|
|
87
88
|
* Get available tools based on agent configuration.
|
|
88
89
|
* When tools === true, loads all tools from registry.
|
|
89
90
|
* Otherwise loads specific tools from config.
|
|
91
|
+
*
|
|
92
|
+
* @param toolsConfig - Agent tools configuration
|
|
93
|
+
* @param options.includeSkillTools - When true, include skill tools for `tools: true` agents
|
|
90
94
|
*/
|
|
91
95
|
export function getAvailableTools(
|
|
92
96
|
toolsConfig: true | Record<string, ToolConfigEntry> | undefined,
|
|
97
|
+
options?: { includeSkillTools?: boolean },
|
|
93
98
|
): ToolDefinition[] {
|
|
94
99
|
if (!toolsConfig) return [];
|
|
95
100
|
|
|
@@ -101,6 +106,10 @@ export function getAvailableTools(
|
|
|
101
106
|
const def = toolToProviderDefinition(tool);
|
|
102
107
|
logToolDefinition(name, def);
|
|
103
108
|
return def;
|
|
109
|
+
}).filter((def) => {
|
|
110
|
+
// Exclude skill tools unless explicitly included
|
|
111
|
+
if (SKILL_TOOL_IDS.has(def.name) && !options?.includeSkillTools) return false;
|
|
112
|
+
return true;
|
|
104
113
|
});
|
|
105
114
|
}
|
|
106
115
|
|
package/src/src/agent/types.ts
CHANGED
|
@@ -60,6 +60,16 @@ export interface AgentConfig {
|
|
|
60
60
|
};
|
|
61
61
|
/** Restrict runtime model overrides to these "provider/model" strings. */
|
|
62
62
|
allowedModels?: ModelString[];
|
|
63
|
+
/**
|
|
64
|
+
* Enable skills for this agent.
|
|
65
|
+
* - true: include all discovered skills from skills/ directory
|
|
66
|
+
* - string[]: include only specific skill IDs
|
|
67
|
+
*
|
|
68
|
+
* Discovery happens at startup via discoverAll().
|
|
69
|
+
* This controls which skills appear in the agent's prompt
|
|
70
|
+
* and registers the skill tools.
|
|
71
|
+
*/
|
|
72
|
+
skills?: true | string[];
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
// Import for use in AgentMiddleware
|
|
@@ -102,7 +102,8 @@ export class ProjectScopedRegistryManager<T> {
|
|
|
102
102
|
*/
|
|
103
103
|
has(id: string): boolean {
|
|
104
104
|
const projectId = this.getCurrentProjectId();
|
|
105
|
-
return this.registriesByProject.get(projectId)?.has(id) ??
|
|
105
|
+
return (this.registriesByProject.get(projectId)?.has(id) ?? false) ||
|
|
106
|
+
this.sharedRegistry.has(id);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
/**
|
|
@@ -9,21 +9,17 @@ export function validateCompileParams(
|
|
|
9
9
|
content: string,
|
|
10
10
|
options: CompileOptions,
|
|
11
11
|
): void {
|
|
12
|
-
if (!filePath
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
if (!filePath || typeof filePath !== "string") {
|
|
13
|
+
throw new TypeError("filePath must be a non-empty string");
|
|
14
|
+
}
|
|
15
15
|
if (typeof content !== "string") throw new TypeError("content must be a string");
|
|
16
|
-
|
|
17
16
|
if (!options || typeof options !== "object") throw new TypeError("options must be an object");
|
|
18
|
-
|
|
19
17
|
if (!options.projectDir || typeof options.projectDir !== "string") {
|
|
20
18
|
throw new TypeError("options.projectDir must be a non-empty string");
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
if (!options.outputDir || typeof options.outputDir !== "string") {
|
|
24
21
|
throw new TypeError("options.outputDir must be a non-empty string");
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
if (options.mode !== "development" && options.mode !== "production") {
|
|
28
24
|
throw new TypeError('options.mode must be either "development" or "production"');
|
|
29
25
|
}
|