@ai-setting/roy-agent-core 1.7.52 → 1.7.55
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/dist/config/config-component.d.ts +346 -0
- package/dist/config/config-parser.d.ts +45 -0
- package/dist/config/env-key.d.ts +97 -0
- package/dist/config/env-source.d.ts +113 -0
- package/dist/config/file-source.d.ts +90 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/protocol-resolver.d.ts +94 -0
- package/dist/env/agent/agent-component.d.ts +646 -0
- package/dist/env/agent/agent-config-registration.d.ts +18 -0
- package/dist/env/agent/agent-registry.d.ts +500 -0
- package/dist/env/agent/index.d.ts +9 -0
- package/dist/env/agent/index.js +3 -3
- package/dist/env/agent/summary-agent.d.ts +44 -0
- package/dist/env/agent/types.d.ts +503 -0
- package/dist/env/commands/commands-component.d.ts +97 -0
- package/dist/env/commands/commands-config-registration.d.ts +19 -0
- package/dist/env/commands/index.d.ts +7 -0
- package/dist/env/commands/parser.d.ts +18 -0
- package/dist/env/commands/types.d.ts +133 -0
- package/dist/env/component.d.ts +186 -0
- package/dist/env/constants.d.ts +112 -0
- package/dist/env/context/env-context.d.ts +420 -0
- package/dist/env/context/env-event.d.ts +144 -0
- package/dist/env/context/index.d.ts +13 -0
- package/dist/env/debug/debug-component.d.ts +160 -0
- package/dist/env/debug/formatters/index.d.ts +8 -0
- package/dist/env/debug/formatters/repl-formatter.d.ts +80 -0
- package/dist/env/debug/formatters/trace-formatter.d.ts +43 -0
- package/dist/env/debug/formatters/tree-formatter.d.ts +72 -0
- package/dist/env/debug/index.d.ts +15 -0
- package/dist/env/debug/index.js +1 -1
- package/dist/env/debug/parser/regex-parser.d.ts +49 -0
- package/dist/env/debug/parser/span-builder.d.ts +79 -0
- package/dist/env/debug/reader/log-reader.d.ts +55 -0
- package/dist/env/debug/reader/span-db-reader.d.ts +70 -0
- package/dist/env/debug/types.d.ts +145 -0
- package/dist/env/environment.d.ts +185 -0
- package/dist/env/error-reply.d.ts +184 -0
- package/dist/env/errors.d.ts +120 -0
- package/dist/env/event-source/bounty-cli-handler.d.ts +42 -0
- package/dist/env/event-source/bounty-im-handler.d.ts +232 -0
- package/dist/env/event-source/event-source-component.d.ts +177 -0
- package/dist/env/event-source/event-source-config-registration.d.ts +18 -0
- package/dist/env/event-source/event-source-handlers.d.ts +472 -0
- package/dist/env/event-source/event-store.d.ts +110 -0
- package/dist/env/event-source/idempotency-key.d.ts +19 -0
- package/dist/env/event-source/index.d.ts +15 -0
- package/dist/env/event-source/index.js +6 -6
- package/dist/env/event-source/timer-handler.d.ts +74 -0
- package/dist/env/event-source/types.d.ts +803 -0
- package/dist/env/hook/global-hook-manager.d.ts +73 -0
- package/dist/env/hook/hook-manager.d.ts +139 -0
- package/dist/env/hook/index.d.ts +9 -0
- package/dist/env/hook/types.d.ts +107 -0
- package/dist/env/index.d.ts +24 -0
- package/dist/env/index.js +18 -18
- package/dist/env/interface.d.ts +156 -0
- package/dist/env/lark-mention-utils.d.ts +59 -0
- package/dist/env/llm/adapter-ai-sdk.d.ts +10 -0
- package/dist/env/llm/adapter-pi-ai.d.ts +184 -0
- package/dist/env/llm/adapter.d.ts +100 -0
- package/dist/env/llm/factory.d.ts +13 -0
- package/dist/env/llm/hooks.d.ts +150 -0
- package/dist/env/llm/index.d.ts +16 -0
- package/dist/env/llm/index.js +2 -2
- package/dist/env/llm/invoke.d.ts +304 -0
- package/dist/env/llm/llm-cache.d.ts +38 -0
- package/dist/env/llm/llm.d.ts +263 -0
- package/dist/env/llm/opencode-session.d.ts +79 -0
- package/dist/env/llm/provider.d.ts +40 -0
- package/dist/env/llm/reasoning-defense.d.ts +104 -0
- package/dist/env/llm/tool-args-parser.d.ts +77 -0
- package/dist/env/llm/tool-schema.d.ts +54 -0
- package/dist/env/llm/transform.d.ts +57 -0
- package/dist/env/llm/types.d.ts +844 -0
- package/dist/env/log-trace/decorator.d.ts +88 -0
- package/dist/env/log-trace/index.d.ts +14 -0
- package/dist/env/log-trace/log-trace-component.d.ts +268 -0
- package/dist/env/log-trace/log-trace-config-registration.d.ts +25 -0
- package/dist/env/log-trace/logger.d.ts +83 -0
- package/dist/env/log-trace/opentelemetry/cli-propagation.d.ts +105 -0
- package/dist/env/log-trace/opentelemetry/mod.d.ts +24 -0
- package/dist/env/log-trace/opentelemetry/propagation-env.d.ts +81 -0
- package/dist/env/log-trace/opentelemetry/propagation.d.ts +79 -0
- package/dist/env/log-trace/opentelemetry/tracer-provider.d.ts +157 -0
- package/dist/env/log-trace/span-storage.d.ts +37 -0
- package/dist/env/log-trace/trace-context.d.ts +28 -0
- package/dist/env/log-trace/types.d.ts +127 -0
- package/dist/env/mcp/command-resolver.d.ts +12 -0
- package/dist/env/mcp/config.d.ts +103 -0
- package/dist/env/mcp/index.d.ts +13 -0
- package/dist/env/mcp/loader.d.ts +78 -0
- package/dist/env/mcp/mcp-component.d.ts +54 -0
- package/dist/env/mcp/mcp-config-registration.d.ts +19 -0
- package/dist/env/mcp/npm-prefix/index.d.ts +17 -0
- package/dist/env/mcp/scanner.d.ts +38 -0
- package/dist/env/mcp/tool/adapter.d.ts +32 -0
- package/dist/env/mcp/tool/index.d.ts +4 -0
- package/dist/env/mcp/types.d.ts +131 -0
- package/dist/env/memory/built-in/index.d.ts +41 -0
- package/dist/env/memory/built-in/recall-memory.d.ts +29 -0
- package/dist/env/memory/built-in/record-memory.d.ts +44 -0
- package/dist/env/memory/index.d.ts +10 -0
- package/dist/env/memory/memory-component.d.ts +114 -0
- package/dist/env/memory/memory-config-registration.d.ts +18 -0
- package/dist/env/memory/memory-config.d.ts +18 -0
- package/dist/env/memory/plugin/index.d.ts +16 -0
- package/dist/env/memory/plugin/memory-agent.d.ts +126 -0
- package/dist/env/memory/plugin/memory-manager.d.ts +71 -0
- package/dist/env/memory/plugin/memory-plugin.d.ts +103 -0
- package/dist/env/memory/plugin/recall-memory.d.ts +16 -0
- package/dist/env/memory/plugin/types.d.ts +75 -0
- package/dist/env/memory/tools/memory-agent-tools.d.ts +109 -0
- package/dist/env/memory/types.d.ts +80 -0
- package/dist/env/paths.d.ts +46 -0
- package/dist/env/plugin/bounty-cli-notification-channel.d.ts +60 -0
- package/dist/env/plugin/event-bus-notification-channel.d.ts +50 -0
- package/dist/env/plugin/index.d.ts +13 -0
- package/dist/env/plugin/lark-cli-notification-channel.d.ts +61 -0
- package/dist/env/plugin/notification-channel.d.ts +143 -0
- package/dist/env/plugin/plugin-component.d.ts +232 -0
- package/dist/env/plugin/types.d.ts +146 -0
- package/dist/env/prompt/index.d.ts +7 -0
- package/dist/env/prompt/index.js +2 -2
- package/dist/env/prompt/prompt-component.d.ts +194 -0
- package/dist/env/prompt/prompt-config-registration.d.ts +18 -0
- package/dist/env/prompt/prompt-store.d.ts +26 -0
- package/dist/env/prompt/prompts-index.d.ts +146 -0
- package/dist/env/prompt/renderer.d.ts +21 -0
- package/dist/env/prompt/types.d.ts +176 -0
- package/dist/env/session/hooks.d.ts +14 -0
- package/dist/env/session/index.d.ts +19 -0
- package/dist/env/session/index.js +4 -4
- package/dist/env/session/search-query-parser.d.ts +41 -0
- package/dist/env/session/session-component.d.ts +464 -0
- package/dist/env/session/session-config-registration.d.ts +18 -0
- package/dist/env/session/session-id.d.ts +26 -0
- package/dist/env/session/session-message-converter.d.ts +142 -0
- package/dist/env/session/session-store.d.ts +188 -0
- package/dist/env/session/storage/index.d.ts +5 -0
- package/dist/env/session/storage/index.js +3 -3
- package/dist/env/session/storage/memory.d.ts +119 -0
- package/dist/env/session/storage/sqlite.d.ts +108 -0
- package/dist/env/session/types.d.ts +705 -0
- package/dist/env/session-tree-stopper.d.ts +79 -0
- package/dist/env/skill/config.d.ts +13 -0
- package/dist/env/skill/index.d.ts +6 -0
- package/dist/env/skill/parser.d.ts +9 -0
- package/dist/env/skill/scanner.d.ts +25 -0
- package/dist/env/skill/skill-component.d.ts +89 -0
- package/dist/env/skill/skill-config-registration.d.ts +18 -0
- package/dist/env/skill/tool/index.d.ts +1 -0
- package/dist/env/skill/tool/skill-tool.d.ts +15 -0
- package/dist/env/skill/types.d.ts +61 -0
- package/dist/env/task/backend/index.d.ts +24 -0
- package/dist/env/task/backend/index.js +702 -0
- package/dist/env/task/backend/roy-sidecar-task-port.d.ts +148 -0
- package/dist/env/task/backend/sqlite-task-port.d.ts +28 -0
- package/dist/env/task/backend/task-store-backend.d.ts +107 -0
- package/dist/env/task/backend/types.d.ts +282 -0
- package/dist/env/task/delegate/bg-task-id-storage.d.ts +9 -0
- package/dist/env/task/delegate/delegate-tool.d.ts +681 -0
- package/dist/env/task/delegate/index.d.ts +8 -0
- package/dist/env/task/delegate/index.js +2 -2
- package/dist/env/task/delegate/process-registry.d.ts +58 -0
- package/dist/env/task/delegate/stop-tool.d.ts +12 -0
- package/dist/env/task/delegate/subagent-resolver.d.ts +25 -0
- package/dist/env/task/events/index.d.ts +7 -0
- package/dist/env/task/events/task-event-payloads.d.ts +101 -0
- package/dist/env/task/events/task-event-types.d.ts +23 -0
- package/dist/env/task/hooks/contexts.d.ts +191 -0
- package/dist/env/task/hooks/index.d.ts +7 -0
- package/dist/env/task/hooks/task-hook-points.d.ts +42 -0
- package/dist/env/task/index.d.ts +7 -0
- package/dist/env/task/index.js +3 -3
- package/dist/env/task/plugins/auto-task-plugin.d.ts +38 -0
- package/dist/env/task/plugins/card-chat-routing.d.ts +88 -0
- package/dist/env/task/plugins/fake-user-message-helper.d.ts +90 -0
- package/dist/env/task/plugins/index.d.ts +8 -0
- package/dist/env/task/plugins/index.js +4 -4
- package/dist/env/task/plugins/lark-card-action-handler.d.ts +166 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +600 -0
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +231 -0
- package/dist/env/task/plugins/max-iteration-reminder-plugin.d.ts +112 -0
- package/dist/env/task/plugins/per-task-group-chat-plugin.d.ts +561 -0
- package/dist/env/task/plugins/task-tag-plugin.d.ts +70 -0
- package/dist/env/task/plugins/workflow-extractor-agent.d.ts +43 -0
- package/dist/env/task/registry-hook-installer.d.ts +43 -0
- package/dist/env/task/storage/index.d.ts +5 -0
- package/dist/env/task/storage/migrations/001_add_project_path_context.d.ts +14 -0
- package/dist/env/task/storage/migrations/002_add_task_type.d.ts +14 -0
- package/dist/env/task/storage/migrations/003_add_process_description.d.ts +20 -0
- package/dist/env/task/storage/migrations/004_rename_action_to_milestone.d.ts +37 -0
- package/dist/env/task/storage/migrations/005_convert_blob_description_to_text.d.ts +51 -0
- package/dist/env/task/storage/sqlite-task-store.d.ts +241 -0
- package/dist/env/task/tag-service.d.ts +138 -0
- package/dist/env/task/task-child-context.d.ts +70 -0
- package/dist/env/task/task-component.d.ts +270 -0
- package/dist/env/task/task-config-registration.d.ts +19 -0
- package/dist/env/task/task-creation-registry.d.ts +181 -0
- package/dist/env/task/task-reuse-context.d.ts +52 -0
- package/dist/env/task/task-reuse-registry.d.ts +31 -0
- package/dist/env/task/tools/batch-archive-tool.d.ts +9 -0
- package/dist/env/task/tools/batch-delete-tool.d.ts +9 -0
- package/dist/env/task/tools/complete-tool.d.ts +12 -0
- package/dist/env/task/tools/create-tool.d.ts +6 -0
- package/dist/env/task/tools/delete-tool.d.ts +6 -0
- package/dist/env/task/tools/get-tool.d.ts +6 -0
- package/dist/env/task/tools/index.d.ts +13 -0
- package/dist/env/task/tools/list-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/create-tool.d.ts +12 -0
- package/dist/env/task/tools/operation/delete-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/get-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/index.d.ts +8 -0
- package/dist/env/task/tools/operation/list-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/operation-types.d.ts +225 -0
- package/dist/env/task/tools/operation/update-tool.d.ts +6 -0
- package/dist/env/task/tools/search-tool.d.ts +9 -0
- package/dist/env/task/tools/task-tree-tool.d.ts +65 -0
- package/dist/env/task/tools/task-types.d.ts +255 -0
- package/dist/env/task/tools/update-tool.d.ts +6 -0
- package/dist/env/task/types.d.ts +290 -0
- package/dist/env/tool/built-in/bash-effect.d.ts +36 -0
- package/dist/env/tool/built-in/bash.d.ts +16 -0
- package/dist/env/tool/built-in/echo.d.ts +7 -0
- package/dist/env/tool/built-in/edit-file.d.ts +6 -0
- package/dist/env/tool/built-in/glob.d.ts +6 -0
- package/dist/env/tool/built-in/grep.d.ts +6 -0
- package/dist/env/tool/built-in/index.d.ts +39 -0
- package/dist/env/tool/built-in/query-background-process-tool.d.ts +113 -0
- package/dist/env/tool/built-in/read-file.d.ts +5 -0
- package/dist/env/tool/built-in/understand-image.d.ts +59 -0
- package/dist/env/tool/built-in/write-file.d.ts +5 -0
- package/dist/env/tool/index.d.ts +16 -0
- package/dist/env/tool/registry.d.ts +61 -0
- package/dist/env/tool/tool-component.d.ts +242 -0
- package/dist/env/tool/tool-config-registration.d.ts +18 -0
- package/dist/env/tool/types.d.ts +274 -0
- package/dist/env/tool/validator.d.ts +14 -0
- package/dist/env/types.d.ts +184 -0
- package/dist/env/workflow/decorators/decorator-node.d.ts +76 -0
- package/dist/env/workflow/decorators/edge.d.ts +42 -0
- package/dist/env/workflow/decorators/index.d.ts +13 -0
- package/dist/env/workflow/decorators/node-as.d.ts +40 -0
- package/dist/env/workflow/decorators/workflow.d.ts +30 -0
- package/dist/env/workflow/engine/dag-manager.d.ts +176 -0
- package/dist/env/workflow/engine/engine.d.ts +440 -0
- package/dist/env/workflow/engine/event-bus.d.ts +54 -0
- package/dist/env/workflow/engine/executor.d.ts +122 -0
- package/dist/env/workflow/engine/index.d.ts +15 -0
- package/dist/env/workflow/engine/index.js +2 -2
- package/dist/env/workflow/engine/node-registry.d.ts +159 -0
- package/dist/env/workflow/engine/scheduler.d.ts +164 -0
- package/dist/env/workflow/extractor/workflow-converter.d.ts +55 -0
- package/dist/env/workflow/fixtures.d.ts +401 -0
- package/dist/env/workflow/hooks/index.d.ts +4 -0
- package/dist/env/workflow/hooks/workflow-hook-points.d.ts +161 -0
- package/dist/env/workflow/index.d.ts +30 -0
- package/dist/env/workflow/index.js +9 -9
- package/dist/env/workflow/metadata/keys.d.ts +6 -0
- package/dist/env/workflow/nodes/agent-component-adapter.d.ts +175 -0
- package/dist/env/workflow/nodes/agent-node.d.ts +206 -0
- package/dist/env/workflow/nodes/ask-user-node.d.ts +66 -0
- package/dist/env/workflow/nodes/condition-node.d.ts +39 -0
- package/dist/env/workflow/nodes/index.d.ts +8 -0
- package/dist/env/workflow/nodes/index.js +1 -1
- package/dist/env/workflow/nodes/merge-node.d.ts +40 -0
- package/dist/env/workflow/nodes/python-call-node.d.ts +95 -0
- package/dist/env/workflow/nodes/skill-node.d.ts +29 -0
- package/dist/env/workflow/nodes/tool-node.d.ts +64 -0
- package/dist/env/workflow/nodes/workflow-node.d.ts +118 -0
- package/dist/env/workflow/plugins/index.d.ts +6 -0
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/plugins/lark-cli-workflow-notify-plugin.d.ts +107 -0
- package/dist/env/workflow/plugins/workflow-json-output-plugin.d.ts +166 -0
- package/dist/env/workflow/runtime/runtime-cancellation-scope.d.ts +121 -0
- package/dist/env/workflow/service/index.d.ts +9 -0
- package/dist/env/workflow/service/registry.d.ts +37 -0
- package/dist/env/workflow/service/workflow-service.d.ts +422 -0
- package/dist/env/workflow/storage/index.d.ts +11 -0
- package/dist/env/workflow/storage/mock-repositories.d.ts +106 -0
- package/dist/env/workflow/storage/safe-json.d.ts +62 -0
- package/dist/env/workflow/storage/sqlite.d.ts +57 -0
- package/dist/env/workflow/storage/tag-repo.d.ts +65 -0
- package/dist/env/workflow/storage/workflow-repo.d.ts +161 -0
- package/dist/env/workflow/tools/ask-user-tool.d.ts +35 -0
- package/dist/env/workflow/tools/index.d.ts +16 -0
- package/dist/env/workflow/tools/index.js +6 -6
- package/dist/env/workflow/tools/run-workflow.d.ts +130 -0
- package/dist/env/workflow/tools/submit-json-output-tool.d.ts +38 -0
- package/dist/env/workflow/tools/workflow-add-tool.d.ts +47 -0
- package/dist/env/workflow/tools/workflow-get-tool.d.ts +29 -0
- package/dist/env/workflow/tools/workflow-list-tool.d.ts +55 -0
- package/dist/env/workflow/tools/workflow-run-status-tool.d.ts +26 -0
- package/dist/env/workflow/tools/workflow-run-stop-tool.d.ts +29 -0
- package/dist/env/workflow/tools/workflow-search-tool.d.ts +33 -0
- package/dist/env/workflow/tools/workflow-tag-list-tool.d.ts +59 -0
- package/dist/env/workflow/tools/workflow-validate-tool.d.ts +69 -0
- package/dist/env/workflow/types/context.d.ts +17 -0
- package/dist/env/workflow/types/decorators-types.d.ts +182 -0
- package/dist/env/workflow/types/edge.d.ts +33 -0
- package/dist/env/workflow/types/event.d.ts +869 -0
- package/dist/env/workflow/types/index.d.ts +16 -0
- package/dist/env/workflow/types/run.d.ts +254 -0
- package/dist/env/workflow/types/workflow-error.d.ts +79 -0
- package/dist/env/workflow/types/workflow-hil.d.ts +57 -0
- package/dist/env/workflow/types/workflow-message.d.ts +193 -0
- package/dist/env/workflow/types/workflow-session.d.ts +17 -0
- package/dist/env/workflow/types/workflow.d.ts +654 -0
- package/dist/env/workflow/types_compat.d.ts +10 -0
- package/dist/env/workflow/utils/agent-session-metadata.d.ts +48 -0
- package/dist/env/workflow/utils/build-agent-node-output.d.ts +11 -0
- package/dist/env/workflow/utils/create-workflow.d.ts +35 -0
- package/dist/env/workflow/utils/dependency-prescan.d.ts +67 -0
- package/dist/env/workflow/utils/execution-state.d.ts +46 -0
- package/dist/env/workflow/utils/extract-agent-json-output.d.ts +6 -0
- package/dist/env/workflow/utils/index.d.ts +14 -0
- package/dist/env/workflow/utils/index.js +1 -1
- package/dist/env/workflow/utils/json-schema-to-zod.d.ts +23 -0
- package/dist/env/workflow/utils/node-id-utils.d.ts +20 -0
- package/dist/env/workflow/utils/node-output-contracts.d.ts +137 -0
- package/dist/env/workflow/utils/node-registry-helper.d.ts +36 -0
- package/dist/env/workflow/utils/output-schema-hint.d.ts +7 -0
- package/dist/env/workflow/utils/parse-agent-output-config.d.ts +9 -0
- package/dist/env/workflow/utils/recovery-validator.d.ts +30 -0
- package/dist/env/workflow/utils/redact-command-secrets.d.ts +70 -0
- package/dist/env/workflow/utils/sensitive-redact.d.ts +37 -0
- package/dist/env/workflow/utils/session-parser.d.ts +23 -0
- package/dist/env/workflow/utils/session-recovery.d.ts +122 -0
- package/dist/env/workflow/utils/shell-dialect-lint.d.ts +75 -0
- package/dist/env/workflow/utils/template-contract-validator.d.ts +87 -0
- package/dist/env/workflow/utils/template-resolver.d.ts +285 -0
- package/dist/env/workflow/utils/validate-workflow-definition.d.ts +79 -0
- package/dist/env/workflow/utils/validation-rules.d.ts +103 -0
- package/dist/env/workflow/utils/workflow-message-metadata.d.ts +20 -0
- package/dist/env/workflow/utils/workflow-sanitize.d.ts +51 -0
- package/dist/env/workflow/workflow-component.d.ts +138 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +21 -21
- package/dist/shared/@ai-setting/{roy-agent-core-stnddvx9.js → roy-agent-core-12d2xap8.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pk1b3kvf.js → roy-agent-core-2b8jtv7m.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-x8n1r7h4.js → roy-agent-core-2bscfrr1.js} +188 -7
- package/dist/shared/@ai-setting/{roy-agent-core-gdsqp6j8.js → roy-agent-core-6masakz4.js} +45 -0
- package/dist/shared/@ai-setting/{roy-agent-core-vvxb9522.js → roy-agent-core-6qxh4xrm.js} +67 -6
- package/dist/shared/@ai-setting/{roy-agent-core-h93v6p6y.js → roy-agent-core-7qy3nffr.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-8eqngasy.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-brwzs8wf.js → roy-agent-core-9h72sk1n.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-na73mym1.js → roy-agent-core-a4vzsn0g.js} +212 -1
- package/dist/shared/@ai-setting/{roy-agent-core-35s1w7tc.js → roy-agent-core-aer5kw1j.js} +142 -70
- package/dist/shared/@ai-setting/{roy-agent-core-j8e92gj8.js → roy-agent-core-b5ew8t0k.js} +0 -59
- package/dist/shared/@ai-setting/{roy-agent-core-rcfewbzr.js → roy-agent-core-cd62e9p1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-39xejr39.js → roy-agent-core-e2z1etk4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pkpkctvf.js → roy-agent-core-g36jevrk.js} +14 -183
- package/dist/shared/@ai-setting/{roy-agent-core-ezgsem94.js → roy-agent-core-j2nvedt6.js} +465 -128
- package/dist/shared/@ai-setting/{roy-agent-core-p2r27era.js → roy-agent-core-mxdc756a.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-p8ak03s0.js → roy-agent-core-w527pcpe.js} +293 -42
- package/dist/shared/@ai-setting/{roy-agent-core-3tv1q6f2.js → roy-agent-core-ytr2w0vb.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-yd21n6c7.js → roy-agent-core-zvemdfx5.js} +1 -1
- package/dist/test-utils/child-process-mock.d.ts +73 -0
- package/dist/util/process/process-tree-killer.d.ts +67 -0
- package/dist/utils/id.d.ts +11 -0
- package/dist/utils/loose-json.d.ts +30 -0
- package/dist/utils/media.d.ts +70 -0
- package/dist/utils/temp-file-manager/index.d.ts +99 -0
- package/package.json +5 -3
- /package/dist/shared/@ai-setting/{roy-agent-core-zy3hqfwg.js → roy-agent-core-0hq21px2.js} +0 -0
- /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Recovery Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utilities for inferring the next execution point from session messages.
|
|
5
|
+
* This is the core of the unified run/resume mechanism.
|
|
6
|
+
*
|
|
7
|
+
* Message types:
|
|
8
|
+
* - workflow.node.start: Node execution started (对应 tool-call)
|
|
9
|
+
* - workflow.node.interrupt: Node waiting for user input
|
|
10
|
+
* - workflow.node.end: Node execution completed (对应 tool-result)
|
|
11
|
+
* - workflow.node.resume: Node resumed after user response
|
|
12
|
+
*/
|
|
13
|
+
import type { SessionMessage } from '../../session/types';
|
|
14
|
+
import type { AgentSessionRef } from '../types/workflow-message';
|
|
15
|
+
/**
|
|
16
|
+
* Represents a resume point - where to continue execution from
|
|
17
|
+
*/
|
|
18
|
+
export interface ResumePoint {
|
|
19
|
+
/** Type of resume point */
|
|
20
|
+
type: 'entry_node' | 'resume_node' | 'ask_user' | 'next_nodes';
|
|
21
|
+
/** Node ID (for single node resume) */
|
|
22
|
+
nodeId?: string;
|
|
23
|
+
/** Node IDs (for multiple next nodes) */
|
|
24
|
+
nodeIds?: string[];
|
|
25
|
+
/** Agent sub-session ID (for agent node resume) */
|
|
26
|
+
agentSessionId?: string;
|
|
27
|
+
/** Input for the node */
|
|
28
|
+
input?: unknown;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Infer the next node to execute based on session messages
|
|
32
|
+
*
|
|
33
|
+
* Decision logic:
|
|
34
|
+
* - No messages → execute entry node
|
|
35
|
+
* - Last = workflow.node.start → resume this node (incomplete/interrupted)
|
|
36
|
+
* - Last = workflow.node.interrupt → resume this node (ask_user)
|
|
37
|
+
* - Last = workflow.node.end → execute next nodes from DAG
|
|
38
|
+
* - Unknown → find last start, resume it, or fallback to entry
|
|
39
|
+
*/
|
|
40
|
+
export declare function inferNextNode(messages: SessionMessage[], definition: {
|
|
41
|
+
entryNode?: string;
|
|
42
|
+
edges?: Array<{
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
}>;
|
|
46
|
+
}): ResumePoint;
|
|
47
|
+
/**
|
|
48
|
+
* Find the last interrupt message in the session
|
|
49
|
+
*/
|
|
50
|
+
export declare function findLastInterruptMessage(messages: SessionMessage[]): SessionMessage | null;
|
|
51
|
+
/**
|
|
52
|
+
* Find the last start message in the session
|
|
53
|
+
*/
|
|
54
|
+
export declare function findLastStartMessage(messages: SessionMessage[]): SessionMessage | null;
|
|
55
|
+
/**
|
|
56
|
+
* Find the last call message (workflow.node.call) in the session
|
|
57
|
+
*/
|
|
58
|
+
export declare function findLastCallMessage(messages: SessionMessage[]): SessionMessage | null;
|
|
59
|
+
/**
|
|
60
|
+
* Parse node outputs from session messages
|
|
61
|
+
*
|
|
62
|
+
* Extracts outputs by matching:
|
|
63
|
+
* - workflow.node.start with workflow.node.end pairs
|
|
64
|
+
* - workflow.node.call with workflow.node.result pairs
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseNodeOutputs(messages: SessionMessage[]): Map<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* Check if session has pending ask_user interrupt
|
|
69
|
+
*/
|
|
70
|
+
export declare function hasPendingAskUser(messages: SessionMessage[]): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Get agent session ID from last interrupt message
|
|
73
|
+
*/
|
|
74
|
+
export declare function getAgentSessionIdFromInterrupt(messages: SessionMessage[]): string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve agent sub-session ID for a pending node.
|
|
77
|
+
* Prefers explicit agentSessionId from messages; falls back to workflow metadata.agentSessions.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveAgentSessionId(nodeId: string | undefined, agentSessionId: string | undefined, agentSessions?: AgentSessionRef[]): string | undefined;
|
|
80
|
+
export declare function enrichResumeInfoWithAgentSessions(resumeInfo: ResumeInfo, agentSessions?: AgentSessionRef[]): ResumeInfo;
|
|
81
|
+
export declare function enrichResumePointWithAgentSessions(resumePoint: ResumePoint, agentSessions?: AgentSessionRef[]): ResumePoint;
|
|
82
|
+
/**
|
|
83
|
+
* Complete resume information extracted from session messages
|
|
84
|
+
*/
|
|
85
|
+
export interface ResumeInfo {
|
|
86
|
+
/** Pending node ID (if any node was interrupted) */
|
|
87
|
+
pendingNodeId: string | undefined;
|
|
88
|
+
/** Agent sub-session ID for the pending node */
|
|
89
|
+
agentSessionId: string | undefined;
|
|
90
|
+
/** Whether there is a pending interrupt (ask_user) */
|
|
91
|
+
hasInterrupt: boolean;
|
|
92
|
+
/** Node outputs from completed nodes */
|
|
93
|
+
nodeOutputs: Map<string, unknown>;
|
|
94
|
+
/** Last interrupt message content (query) */
|
|
95
|
+
lastInterruptQuery?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Extract complete resume information from session messages
|
|
99
|
+
*
|
|
100
|
+
* This function consolidates the logic that was previously scattered across
|
|
101
|
+
* engine.ts and other places. It extracts all information needed to resume
|
|
102
|
+
* a workflow from its session messages.
|
|
103
|
+
*
|
|
104
|
+
* The key insight is:
|
|
105
|
+
* - If the last message is an interrupt, use its metadata for resume
|
|
106
|
+
* - No need for complex userResponse distinction
|
|
107
|
+
* - agentSessionId comes from interrupt message metadata
|
|
108
|
+
* - userQuery comes from the input provided during resume
|
|
109
|
+
*
|
|
110
|
+
* @param messages - Session messages to analyze
|
|
111
|
+
* @returns Complete resume information
|
|
112
|
+
*/
|
|
113
|
+
export declare function extractResumeInfo(messages: SessionMessage[]): ResumeInfo;
|
|
114
|
+
/**
|
|
115
|
+
* Split ephemeral resume userQuery from durable workflow input.
|
|
116
|
+
* userQuery is only valid for the node being resumed and must not persist
|
|
117
|
+
* in workflowInput for subsequent nodes.
|
|
118
|
+
*/
|
|
119
|
+
export declare function stripEphemeralResumeInput(input?: Record<string, unknown>): {
|
|
120
|
+
workflowInput?: Record<string, unknown>;
|
|
121
|
+
userQuery?: unknown;
|
|
122
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shell dialect lint for workflow `tool` node commands
|
|
3
|
+
* (Task #4392 P0-3; root cause proven in Task #4385 §3.2.1).
|
|
4
|
+
*
|
|
5
|
+
* ## Why this exists
|
|
6
|
+
*
|
|
7
|
+
* The built-in `bash` tool spawns its command with Node's
|
|
8
|
+
* `child_process.spawn(command, [], { shell: true })`
|
|
9
|
+
* (see `env/tool/built-in/bash-effect.ts`). On POSIX, `shell: true` resolves to
|
|
10
|
+
* **`/bin/sh`**, which on Debian/Ubuntu is a symlink to **dash** — *not* bash.
|
|
11
|
+
*
|
|
12
|
+
* Every bash-only construct therefore fails inside a workflow tool node. Worse,
|
|
13
|
+
* half of them fail **silently**:
|
|
14
|
+
*
|
|
15
|
+
* | construct | dash behaviour | exit | loud? |
|
|
16
|
+
* | -------------------- | ----------------------------- | ---- | ----- |
|
|
17
|
+
* | `set -o pipefail` | `Illegal option -o pipefail` | 2 | ✅ |
|
|
18
|
+
* | `${PIPESTATUS[0]}` | `Bad substitution` | 2 | ✅ |
|
|
19
|
+
* | `${V//a/b}` | `Bad substitution` | 2 | ✅ |
|
|
20
|
+
* | `${BASH_SOURCE[0]}` | `Bad substitution` | 2 | ✅ |
|
|
21
|
+
* | `A=(1 2 3)` | `Syntax error: "(" unexpected`| 2 | ✅ |
|
|
22
|
+
* | `function f() {}` | `Syntax error: "(" unexpected`| 2 | ✅ |
|
|
23
|
+
* | `[[ ... ]]` | `[[: not found` | 127 | ✅ |
|
|
24
|
+
* | `source <file>` | `source: not found` | 0 | ❌ |
|
|
25
|
+
* | `echo -e "a\tb"` | prints a literal `-e` | 0 | ❌ |
|
|
26
|
+
* | `$RANDOM` | empty string | 0 | ❌ |
|
|
27
|
+
*
|
|
28
|
+
* Task #4385 measured **63** `/bin/sh:` signature hits across 45 sessions, and
|
|
29
|
+
* these account for 27 of the workflow-creator's `exit 2` failures.
|
|
30
|
+
*
|
|
31
|
+
* ## Severity policy
|
|
32
|
+
*
|
|
33
|
+
* These findings are **warnings, never errors**. The 76 workflows already in
|
|
34
|
+
* `workflows.db` must keep validating cleanly, and a `dash`-safe workflow can
|
|
35
|
+
* legitimately contain the *string* `pipefail` inside an embedded heredoc that
|
|
36
|
+
* is executed by `bash -c` on purpose. Blocking on a heuristic regex would be
|
|
37
|
+
* wrong; surfacing it loudly for the author to judge is right.
|
|
38
|
+
*
|
|
39
|
+
* ## What is deliberately NOT flagged
|
|
40
|
+
*
|
|
41
|
+
* - `. <file>` (POSIX dot-command) — the correct replacement for `source`.
|
|
42
|
+
* - `$?`, `$0`, `$1`… — POSIX.
|
|
43
|
+
* - `[ ... ]` — POSIX test.
|
|
44
|
+
* - `sed 's/a/b/'` — no `${...}` involved.
|
|
45
|
+
* - Text inside shell **comments** (`# ...`) — cannot fail at runtime.
|
|
46
|
+
*/
|
|
47
|
+
/** A single detected bash-ism. */
|
|
48
|
+
export interface ShellDialectFinding {
|
|
49
|
+
/** Stable rule name, e.g. `pipefail`. Used in machine-readable output. */
|
|
50
|
+
name: string;
|
|
51
|
+
/** Actionable replacement hint written for an LLM/tool author to act on. */
|
|
52
|
+
fix: string;
|
|
53
|
+
/** Short excerpt of the offending command (surrounding context). */
|
|
54
|
+
excerpt: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Detect bash-only constructs in a shell command intended for the `bash` tool.
|
|
58
|
+
*
|
|
59
|
+
* @param command - The raw command string (from `config.command`).
|
|
60
|
+
* @returns One finding per *distinct* rule that matched. Repeated occurrences of
|
|
61
|
+
* the same rule are collapsed (a 50-line script using `$RANDOM` ten
|
|
62
|
+
* times should produce one warning, not ten).
|
|
63
|
+
*/
|
|
64
|
+
export declare function lintShellDialect(command: string): ShellDialectFinding[];
|
|
65
|
+
/**
|
|
66
|
+
* Render findings as one actionable line each, prefixed with the node id.
|
|
67
|
+
*
|
|
68
|
+
* Format is deliberately stable so it can be asserted in tests and grepped in
|
|
69
|
+
* logs:
|
|
70
|
+
* `[shell-dialect] node "build-x" uses bash-only "pipefail": <fix> | near: <excerpt>`
|
|
71
|
+
*
|
|
72
|
+
* @param nodeId - The workflow node id that owns the command.
|
|
73
|
+
* @param findings - Output of `lintShellDialect`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function formatShellDialectFindings(nodeId: string, findings: ShellDialectFinding[]): string[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Static **template-reference contract** validation for workflow
|
|
3
|
+
* definitions (Task #4298).
|
|
4
|
+
*
|
|
5
|
+
* ## The problem
|
|
6
|
+
*
|
|
7
|
+
* `workflow_validate` (and `workflow_add`) historically only ran DAG-structure
|
|
8
|
+
* checks (duplicate IDs / missing deps / cycles / empty IDs). It could not
|
|
9
|
+
* notice that a node's prompt referenced a field its upstream node can never
|
|
10
|
+
* produce — which is exactly how `wheels-validate-v1` v1.3.0 shipped a
|
|
11
|
+
* workflow whose `report-results` agent received an *empty string* for
|
|
12
|
+
* `{{nodes.run-validation-tests.result}}` (a **tool** node has no `result`)
|
|
13
|
+
* and then reported `completed` anyway.
|
|
14
|
+
*
|
|
15
|
+
* ## What this module does
|
|
16
|
+
*
|
|
17
|
+
* Walks every node's `config`, extracts *pure* `{{ ... }}` template paths, and
|
|
18
|
+
* checks each one against:
|
|
19
|
+
*
|
|
20
|
+
* 1. **R1** — the referenced source node actually exists → error
|
|
21
|
+
* 2. **R2** — `.result` is an **agent-only** idiom; using it on a data
|
|
22
|
+
* node (tool / python_call / skill / condition / merge / askUser)
|
|
23
|
+
* is the canonical bug above → error
|
|
24
|
+
* 3. **R3** — a first-level field that is not in the source node's
|
|
25
|
+
* *closed* contract field set (may still resolve if the node's
|
|
26
|
+
* `output` happens to be an object carrying that key) → warning
|
|
27
|
+
* 4. **R4** — a deep path (`.output.<x>`) into a `tool` node whose
|
|
28
|
+
* output is usually a plain string → info
|
|
29
|
+
* 5. **R5** — a field that contradicts an agent's **declared JSON
|
|
30
|
+
* schema** (`config.output.schema.properties`) → warning
|
|
31
|
+
* 6. **R6** — the source node is not upstream of the consumer
|
|
32
|
+
* (loops / forward refs legitimately consume prior-round output) → info
|
|
33
|
+
*
|
|
34
|
+
* Severity policy: only R1/R2 are `error` (blocking). R3/R5 are `warning`
|
|
35
|
+
* (advisory). R4/R6 are `info` (hint). This keeps the existing corpus clean —
|
|
36
|
+
* a scan of all 75 registered workflows yields **2 errors, both in
|
|
37
|
+
* `wheels-validate-v1`**, i.e. precisely the bug we set out to catch.
|
|
38
|
+
*
|
|
39
|
+
* ## Parsing rules (deliberately conservative)
|
|
40
|
+
*
|
|
41
|
+
* A `{{ ... }}` body is only considered a node reference when it is a *pure dot
|
|
42
|
+
* path* (`^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z0-9_-]+|\\[-?\\d+\\])*$`). This
|
|
43
|
+
* excludes, in one stroke:
|
|
44
|
+
* - scoped refs: `{{input.x}}` / `{{inputs.x}}` / `{{config.x}}` / `{{env.X}}`
|
|
45
|
+
* - docker Go-templates: `{{index .RepoDigests 0}}`
|
|
46
|
+
* - handlebars-ish conditionals: `{{#if input.x}}` / `{{/if}}`
|
|
47
|
+
* - documentation placeholders: `{{nodes.<source-id>.<field>}}`
|
|
48
|
+
* - shell parameter expansions and any prose containing a space
|
|
49
|
+
*
|
|
50
|
+
* It also explicitly ignores the `{{X | default ''}}` filter suffix used by a
|
|
51
|
+
* few workflows (the path is taken up to the first space or `|`).
|
|
52
|
+
*/
|
|
53
|
+
export type TemplateContractSeverity = "error" | "warning" | "info";
|
|
54
|
+
export type TemplateContractRule = "R1-node-not-found" | "R2-result-on-non-agent" | "R3-unknown-field-on-closed" | "R4-deep-path-into-tool" | "R5-agent-schema-field" | "R6-not-upstream";
|
|
55
|
+
export interface TemplateContractFinding {
|
|
56
|
+
/** `error` blocks `workflow_add`; `warning` / `info` are advisory. */
|
|
57
|
+
severity: TemplateContractSeverity;
|
|
58
|
+
rule: TemplateContractRule;
|
|
59
|
+
/** The node whose config contains the reference. */
|
|
60
|
+
nodeId: string;
|
|
61
|
+
/** The verbatim template, e.g. `{{nodes.run-validation-tests.result}}`. */
|
|
62
|
+
template: string;
|
|
63
|
+
/** The referenced source node id. */
|
|
64
|
+
sourceNodeId?: string;
|
|
65
|
+
/** The referenced source node type (when it exists). */
|
|
66
|
+
sourceNodeType?: string;
|
|
67
|
+
/** Human-readable, actionable explanation. */
|
|
68
|
+
message: string;
|
|
69
|
+
/** Suggested replacement template (when we can compute one). */
|
|
70
|
+
suggestion?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate every template reference in a workflow definition against the
|
|
74
|
+
* source node's output contract.
|
|
75
|
+
*
|
|
76
|
+
* Never throws — malformed input yields `[]`.
|
|
77
|
+
*
|
|
78
|
+
* @param definition - Workflow definition (needs a `nodes` array)
|
|
79
|
+
* @returns Findings, in node-declaration order
|
|
80
|
+
*/
|
|
81
|
+
export declare function validateTemplateContracts(definition: unknown): TemplateContractFinding[];
|
|
82
|
+
/** Convenience: only the blocking findings. */
|
|
83
|
+
export declare function getTemplateContractErrors(definition: unknown): TemplateContractFinding[];
|
|
84
|
+
/** Convenience: only the advisory findings. */
|
|
85
|
+
export declare function getTemplateContractWarnings(definition: unknown): TemplateContractFinding[];
|
|
86
|
+
/** Render findings as `string[]` for the `{ valid, errors }` callers. */
|
|
87
|
+
export declare function formatTemplateContractFindings(findings: TemplateContractFinding[]): string[];
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Template Resolver - Unified template resolution for workflow nodes
|
|
3
|
+
*
|
|
4
|
+
* This module provides a unified template resolution system for workflow nodes.
|
|
5
|
+
* Templates are in the format {{path}} where path can reference:
|
|
6
|
+
*
|
|
7
|
+
* - Input variables: {{input.key}} or {{input.key.nested}}
|
|
8
|
+
* - Node outputs: {{nodeId}} or {{nodeId.output}} or {{nodeId.output.path}}
|
|
9
|
+
* - With prefix: {{nodes.nodeId}} or {{nodes.nodeId.output.path}}
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const resolver = new TemplateResolver({
|
|
14
|
+
* input: { query: 'weather' },
|
|
15
|
+
* previousOutputs: new Map([
|
|
16
|
+
* ['fetch', { data: { temp: 25, condition: 'sunny' } }]
|
|
17
|
+
* ])
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* resolver.resolve('Weather in {{input.query}}: {{nodes.fetch.data.condition}}');
|
|
21
|
+
* // => 'Weather in weather: sunny'
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
import type { NodeExecutionContext } from '../types';
|
|
25
|
+
/**
|
|
26
|
+
* Template resolution options
|
|
27
|
+
*/
|
|
28
|
+
export interface TemplateResolverOptions {
|
|
29
|
+
/** Input passed to the workflow/node */
|
|
30
|
+
input?: Record<string, unknown>;
|
|
31
|
+
/** Map of previous node outputs */
|
|
32
|
+
previousOutputs?: Map<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Result of template resolution
|
|
36
|
+
*/
|
|
37
|
+
export interface ResolvedValue {
|
|
38
|
+
/** Whether the value was resolved */
|
|
39
|
+
resolved: boolean;
|
|
40
|
+
/** The resolved value */
|
|
41
|
+
value: unknown;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Result of resolveAndValidate operation
|
|
45
|
+
*/
|
|
46
|
+
export interface ResolveResult {
|
|
47
|
+
/** The resolved value (with templates replaced) */
|
|
48
|
+
resolved: unknown;
|
|
49
|
+
/** List of template strings that could not be resolved */
|
|
50
|
+
unresolved: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* TemplateResolver
|
|
54
|
+
*
|
|
55
|
+
* Resolves template strings that reference workflow inputs and node outputs.
|
|
56
|
+
*/
|
|
57
|
+
export declare class TemplateResolver {
|
|
58
|
+
private input;
|
|
59
|
+
private previousOutputs;
|
|
60
|
+
constructor(options?: TemplateResolverOptions);
|
|
61
|
+
/**
|
|
62
|
+
* Create a TemplateResolver from NodeExecutionContext
|
|
63
|
+
*
|
|
64
|
+
* @param context - Node execution context
|
|
65
|
+
* @returns TemplateResolver instance
|
|
66
|
+
*/
|
|
67
|
+
static fromContext(context: NodeExecutionContext): TemplateResolver;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve template references in an input value.
|
|
70
|
+
*
|
|
71
|
+
* Handles:
|
|
72
|
+
* - Primitive values (returned as-is)
|
|
73
|
+
* - Objects (recursively resolved)
|
|
74
|
+
* - Arrays (recursively resolved)
|
|
75
|
+
* - Strings (template resolution)
|
|
76
|
+
*
|
|
77
|
+
* Key behavior for template strings:
|
|
78
|
+
* - If the string is a pure template reference (e.g., "{{nodes.fetch}}"),
|
|
79
|
+
* the resolved value is returned as-is (preserving objects/arrays)
|
|
80
|
+
* - If the string contains text + templates (e.g., "Hello {{name}}"),
|
|
81
|
+
* returns a string with interpolated values
|
|
82
|
+
*
|
|
83
|
+
* @param input - Input value that may contain template strings
|
|
84
|
+
* @returns Input with template references resolved
|
|
85
|
+
*/
|
|
86
|
+
resolveValue(input: unknown): unknown;
|
|
87
|
+
/**
|
|
88
|
+
* Check if a string is a pure template reference (starts with {{ and ends with }})
|
|
89
|
+
* @param str - String to check
|
|
90
|
+
* @returns The template content if pure, null otherwise
|
|
91
|
+
*/
|
|
92
|
+
private extractPureTemplate;
|
|
93
|
+
/**
|
|
94
|
+
* Resolve a pure template reference and return the value as-is.
|
|
95
|
+
* @param templateContent - Content between {{ and }}
|
|
96
|
+
* @returns The resolved value (may be object, array, or primitive)
|
|
97
|
+
*/
|
|
98
|
+
private resolvePureTemplate;
|
|
99
|
+
/**
|
|
100
|
+
* Resolve a path-style template reference and return the value.
|
|
101
|
+
*
|
|
102
|
+
* Task #2283 — added so the engine can read any previous-progress
|
|
103
|
+
* signal (e.g. `{{nodes.tdd-implement.commits[-1]}}`) inside
|
|
104
|
+
* loop_guard checks without having to re-parse the template.
|
|
105
|
+
*
|
|
106
|
+
* Supports:
|
|
107
|
+
* - `{{input.foo}}` / `{{input.foo.bar}}`
|
|
108
|
+
* - `{{nodes.X}}` / `{{nodes.X.Y}}` / `{{nodes.X.Y.Z}}`
|
|
109
|
+
* - Array indexing: `{{nodes.X.list[0]}}`, `{{nodes.X.list[-1]}}`
|
|
110
|
+
* (-1 means "last element"; -2 means "second to last", etc.)
|
|
111
|
+
* - `.length` accessor on arrays
|
|
112
|
+
*
|
|
113
|
+
* The `{{` and `}}` wrappers are optional — a bare path string
|
|
114
|
+
* (`nodes.X.Y`) is also accepted.
|
|
115
|
+
*
|
|
116
|
+
* Returns `undefined` if any segment is missing, an array index is
|
|
117
|
+
* out of range, or the input is empty.
|
|
118
|
+
*/
|
|
119
|
+
resolvePath(path: string): unknown;
|
|
120
|
+
/**
|
|
121
|
+
* Tokenize a path string into segments, respecting bracket notation
|
|
122
|
+
* `foo[0]`, `foo[-1]`, and the `.length` accessor.
|
|
123
|
+
*
|
|
124
|
+
* Examples:
|
|
125
|
+
* "nodes.x.y" -> ["nodes", "x", "y"]
|
|
126
|
+
* "nodes.x.list[0]" -> ["nodes", "x", "list", 0]
|
|
127
|
+
* "nodes.x.list[-1]" -> ["nodes", "x", "list", -1]
|
|
128
|
+
* "nodes.x.l.length" -> ["nodes", "x", "l", "length"]
|
|
129
|
+
*/
|
|
130
|
+
private tokenizePath;
|
|
131
|
+
/**
|
|
132
|
+
* Navigate `tokens` (mix of string keys and integer indices) into
|
|
133
|
+
* `root`, returning the value at the end of the path or undefined.
|
|
134
|
+
*
|
|
135
|
+
* For negative indices, the engine resolves them as offset from the
|
|
136
|
+
* end of the array (-1 = last, -2 = second to last, ...).
|
|
137
|
+
*/
|
|
138
|
+
private navigateTokens;
|
|
139
|
+
/**
|
|
140
|
+
* Resolve template content (the part inside {{ }}) and return the value.
|
|
141
|
+
* @param templateContent - The path to resolve (e.g., "input.key", "nodes.fetch.data")
|
|
142
|
+
* @returns The resolved value
|
|
143
|
+
*/
|
|
144
|
+
private resolveTemplateContent;
|
|
145
|
+
/**
|
|
146
|
+
* Auto-unwrap AgentNode output format `{ result, metadata, ... }` when
|
|
147
|
+
* the caller asked for the bare node (no further path). Preserves the
|
|
148
|
+
* pre-tokenizer behavior where `{{nodeId}}` returns the result field
|
|
149
|
+
* rather than the whole wrapper object.
|
|
150
|
+
*
|
|
151
|
+
* Only unwraps when the value LOOKS like an AgentNode result wrapper
|
|
152
|
+
* (has `result` and not `nodes`); this guards against false positives
|
|
153
|
+
* on plain objects that happen to have a `result` key.
|
|
154
|
+
*/
|
|
155
|
+
private unwrapAgentNodeResult;
|
|
156
|
+
/**
|
|
157
|
+
* Resolve a single template string.
|
|
158
|
+
*
|
|
159
|
+
* Supports patterns:
|
|
160
|
+
* - {{input.key}} - Input variable
|
|
161
|
+
* - {{nodeId}} - Node's entire output
|
|
162
|
+
* - {{nodeId.output}} - Node's output property
|
|
163
|
+
* - {{nodeId.output.path}} - Node's nested output property
|
|
164
|
+
* - {{nodes.nodeId}} - Node's entire output (with prefix)
|
|
165
|
+
* - {{nodes.nodeId.output.path}} - Node's nested property (with prefix)
|
|
166
|
+
*
|
|
167
|
+
* @param template - Template string to resolve
|
|
168
|
+
* @returns Resolved string
|
|
169
|
+
*/
|
|
170
|
+
resolveString(template: string): string;
|
|
171
|
+
/**
|
|
172
|
+
* Resolve a node output path.
|
|
173
|
+
*
|
|
174
|
+
* @param path - Path like "nodeId" or "nodeId.output" or "nodeId.output.path"
|
|
175
|
+
* @returns The resolved value or undefined
|
|
176
|
+
*/
|
|
177
|
+
private resolveNodePath;
|
|
178
|
+
/**
|
|
179
|
+
* Get a nested value from an object using dot notation.
|
|
180
|
+
*
|
|
181
|
+
* @param obj - Object to traverse
|
|
182
|
+
* @param path - Dot-separated path
|
|
183
|
+
* @returns The nested value or undefined
|
|
184
|
+
*/
|
|
185
|
+
private getNestedValue;
|
|
186
|
+
/**
|
|
187
|
+
* Convert a value to string for template substitution.
|
|
188
|
+
*
|
|
189
|
+
* Task #2912: when value is undefined, return empty string instead of
|
|
190
|
+
* the original template. Returning the original template caused downstream
|
|
191
|
+
* bash guards (e.g. `[ -n "$SID_COOKIE_RAW" ]`) to evaluate as truthy
|
|
192
|
+
* on the template literal like `{{input.sidCookie}}`, which misrouted
|
|
193
|
+
* workflows into fallback paths when an input field was simply absent.
|
|
194
|
+
* null still returns the sentinel string "null" for backward compatibility.
|
|
195
|
+
*/
|
|
196
|
+
private stringify;
|
|
197
|
+
/**
|
|
198
|
+
* Check if a string contains template references.
|
|
199
|
+
*
|
|
200
|
+
* @param str - String to check
|
|
201
|
+
* @returns True if the string contains template references
|
|
202
|
+
*/
|
|
203
|
+
containsTemplates(str: string): boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Extract all template references from a string.
|
|
206
|
+
*
|
|
207
|
+
* @param str - String to extract from
|
|
208
|
+
* @returns Array of template references
|
|
209
|
+
*/
|
|
210
|
+
extractTemplates(str: string): string[];
|
|
211
|
+
/**
|
|
212
|
+
* Resolve and validate input, tracking unresolved templates.
|
|
213
|
+
*
|
|
214
|
+
* This method resolves all template references in the input and returns
|
|
215
|
+
* both the resolved value and a list of templates that could not be resolved.
|
|
216
|
+
*
|
|
217
|
+
* @param input - Input value that may contain template strings
|
|
218
|
+
* @returns Object containing resolved value and list of unresolved templates
|
|
219
|
+
*/
|
|
220
|
+
resolveAndValidate(input: unknown): ResolveResult;
|
|
221
|
+
/**
|
|
222
|
+
* Internal method to resolve values while tracking unresolved templates.
|
|
223
|
+
*/
|
|
224
|
+
private resolveValueWithTracking;
|
|
225
|
+
/**
|
|
226
|
+
* Resolve string templates while tracking unresolved ones.
|
|
227
|
+
*/
|
|
228
|
+
private resolveStringWithTracking;
|
|
229
|
+
/**
|
|
230
|
+
* Resolve templates strictly, throwing on unresolved templates.
|
|
231
|
+
*
|
|
232
|
+
* This is useful when you want to ensure all templates are resolved
|
|
233
|
+
* before proceeding, and treat any unresolved templates as an error.
|
|
234
|
+
*
|
|
235
|
+
* Uses factory methods to create meaningful error messages with nodeId and reason.
|
|
236
|
+
*
|
|
237
|
+
* @param input - Input value that may contain template strings
|
|
238
|
+
* @param nodeId - Optional node ID for better error context
|
|
239
|
+
* @returns The resolved value
|
|
240
|
+
* @throws TemplateUnresolvedError if any templates could not be resolved
|
|
241
|
+
*/
|
|
242
|
+
resolveStrict(input: unknown, nodeId?: string): unknown;
|
|
243
|
+
/**
|
|
244
|
+
* Evaluate a condition expression and return boolean result
|
|
245
|
+
* Supports operators: ==, !=, >, <, >=, <=, &&, ||, !
|
|
246
|
+
*
|
|
247
|
+
* @param condition - Condition expression with template references
|
|
248
|
+
* @returns Boolean result of the condition
|
|
249
|
+
* @throws Error if condition cannot be evaluated
|
|
250
|
+
*/
|
|
251
|
+
evaluateCondition(condition: string): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Parse and evaluate a condition string
|
|
254
|
+
* Handles operator precedence: ! > && > ||
|
|
255
|
+
*/
|
|
256
|
+
private parseCondition;
|
|
257
|
+
/**
|
|
258
|
+
* Split a string by an operator, respecting quoted strings
|
|
259
|
+
*/
|
|
260
|
+
private splitByOperator;
|
|
261
|
+
/**
|
|
262
|
+
* Evaluate a value (handles strings, numbers, booleans)
|
|
263
|
+
*/
|
|
264
|
+
private evaluateValue;
|
|
265
|
+
/**
|
|
266
|
+
* Compare two values with the given operator
|
|
267
|
+
*/
|
|
268
|
+
private compare;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Resolve template references in input using context.
|
|
272
|
+
*
|
|
273
|
+
* @param input - Input value with potential templates
|
|
274
|
+
* @param context - Node execution context
|
|
275
|
+
* @returns Resolved input
|
|
276
|
+
*/
|
|
277
|
+
export declare function resolveTemplates(input: unknown, context: NodeExecutionContext): unknown;
|
|
278
|
+
/**
|
|
279
|
+
* Resolve a template string using context.
|
|
280
|
+
*
|
|
281
|
+
* @param template - Template string
|
|
282
|
+
* @param context - Node execution context
|
|
283
|
+
* @returns Resolved string
|
|
284
|
+
*/
|
|
285
|
+
export declare function resolveTemplateString(template: string, context: NodeExecutionContext): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared validateWorkflowDefinition helper.
|
|
3
|
+
*
|
|
4
|
+
* Single entry point for validating a workflow definition:
|
|
5
|
+
*
|
|
6
|
+
* Layer 1 — DAG structure (delegated to DAGManager.validate()):
|
|
7
|
+
* duplicate node IDs, missing dependencies, cycles, empty node IDs.
|
|
8
|
+
*
|
|
9
|
+
* Layer 2 — Template-reference **contracts** (Task #4298, see
|
|
10
|
+
* `template-contract-validator.ts`): does a `{{nodes.X.<field>}}`
|
|
11
|
+
* reference actually match the output shape of node `X`? This is what
|
|
12
|
+
* catches the `wheels-validate-v1` class of bug where an agent prompt
|
|
13
|
+
* read `.result` off a **tool** node (which has no such field) and the
|
|
14
|
+
* engine silently substituted an empty string.
|
|
15
|
+
*
|
|
16
|
+
* Layer 3 — **Shell dialect lint** (Task #4392 P0-3, see
|
|
17
|
+
* `shell-dialect-lint.ts`): the `bash` tool spawns with `shell: true`,
|
|
18
|
+
* i.e. `/bin/sh` = dash. bash-only constructs (`set -o pipefail`,
|
|
19
|
+
* `${PIPESTATUS[0]}`, `[[ ]]`, `source`, arrays, `$RANDOM`, `echo -e`, ...)
|
|
20
|
+
* either fail loudly or -- worse -- silently no-op. Reported as **warning**
|
|
21
|
+
* only: existing registered workflows must not be invalidated by a
|
|
22
|
+
* heuristic regex.
|
|
23
|
+
*
|
|
24
|
+
* Wraps everything in a defensive try/catch so callers (workflow_add tool,
|
|
25
|
+
* `workflow add` CLI, workflow_validate tool, TaskTagPlugin.extractWorkflow)
|
|
26
|
+
* always get a consistent `{ valid, errors, warnings, infos }` shape — even
|
|
27
|
+
* when the input is garbage.
|
|
28
|
+
*
|
|
29
|
+
* Backward compatibility: the original `{ valid, errors }` shape is preserved;
|
|
30
|
+
* `warnings` / `infos` are additive. Only `error`-severity findings affect
|
|
31
|
+
* `valid`.
|
|
32
|
+
*/
|
|
33
|
+
import { type TemplateContractFinding } from "./template-contract-validator";
|
|
34
|
+
export interface ValidateWorkflowResult {
|
|
35
|
+
valid: boolean;
|
|
36
|
+
/** Blocking problems. Non-empty ⟺ `valid === false`. */
|
|
37
|
+
errors: string[];
|
|
38
|
+
/**
|
|
39
|
+
* Advisory problems (Task #4298). These do NOT make the definition invalid,
|
|
40
|
+
* but the workflow-creator loop is expected to address them.
|
|
41
|
+
*/
|
|
42
|
+
warnings?: string[];
|
|
43
|
+
/** Informational hints (e.g. references to non-upstream nodes). */
|
|
44
|
+
infos?: string[];
|
|
45
|
+
/** Structured findings, for callers that want machine-readable detail. */
|
|
46
|
+
findings?: TemplateContractFinding[];
|
|
47
|
+
}
|
|
48
|
+
export interface ValidateWorkflowOptions {
|
|
49
|
+
/**
|
|
50
|
+
* Skip the Layer-2 template-contract checks. Defaults to `false`.
|
|
51
|
+
*
|
|
52
|
+
* Provided for callers that only care about structural validity (e.g. a
|
|
53
|
+
* pre-flight DAG sanity check while a definition is still being authored
|
|
54
|
+
* incrementally).
|
|
55
|
+
*/
|
|
56
|
+
skipTemplateContracts?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Skip the Layer-3 shell-dialect lint. Defaults to `false`.
|
|
59
|
+
*
|
|
60
|
+
* Layer 3 emits **warnings only**, so there is rarely a reason to disable it;
|
|
61
|
+
* this switch exists for corpus/regression tests that pin the exact warning
|
|
62
|
+
* set of already-registered workflows.
|
|
63
|
+
*/
|
|
64
|
+
lintShellDialect?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate a workflow definition (structure + template contracts).
|
|
68
|
+
*
|
|
69
|
+
* @param definition - The workflow definition object (must have a `nodes` array).
|
|
70
|
+
* @param options - Optional behaviour switches.
|
|
71
|
+
* @returns `{ valid, errors, warnings, infos, findings }` — never throws.
|
|
72
|
+
*/
|
|
73
|
+
export declare function validateWorkflowDefinition(definition: unknown, options?: ValidateWorkflowOptions): ValidateWorkflowResult;
|
|
74
|
+
/**
|
|
75
|
+
* Walk every `tool` node of a definition and lint its shell command(s).
|
|
76
|
+
*
|
|
77
|
+
* @returns Formatted, actionable warning lines (empty when clean).
|
|
78
|
+
*/
|
|
79
|
+
export declare function collectShellDialectWarnings(definition: unknown): string[];
|