@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,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Registry interface for looking up tools
|
|
3
|
+
* Supports both the full ToolRegistration and simplified Tool interface
|
|
4
|
+
*/
|
|
5
|
+
export interface ToolRegistry {
|
|
6
|
+
getTool?(name: string): ToolRegistration | undefined;
|
|
7
|
+
getToolByName?(name: string): Tool | undefined;
|
|
8
|
+
hasTool?(name: string): boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Tool Registration interface (from ToolComponent)
|
|
12
|
+
*/
|
|
13
|
+
export interface ToolRegistration {
|
|
14
|
+
tool: Tool;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
source?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Tool interface for execution
|
|
20
|
+
*/
|
|
21
|
+
export interface Tool {
|
|
22
|
+
name: string;
|
|
23
|
+
execute(input: any, context?: any): Promise<any>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* ToolNode executes a registered Tool with the provided input.
|
|
27
|
+
*
|
|
28
|
+
* Input can contain template strings like {{nodeId.output.path}} that will be
|
|
29
|
+
* resolved from previousOutputs via TemplateResolver.
|
|
30
|
+
*/
|
|
31
|
+
export declare class ToolNode implements Node {
|
|
32
|
+
private definition;
|
|
33
|
+
private toolRegistry;
|
|
34
|
+
readonly type = "tool";
|
|
35
|
+
readonly id: string;
|
|
36
|
+
constructor(definition: NodeDefinition, toolRegistry: ToolRegistry);
|
|
37
|
+
execute(context: NodeExecutionContext): Promise<NodeExecutionResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Extract the actual output value from wrapper formats.
|
|
40
|
+
* For strings, removes trailing whitespace (especially newlines from bash commands).
|
|
41
|
+
*/
|
|
42
|
+
private extractFromWrapper;
|
|
43
|
+
/**
|
|
44
|
+
* Task #2900 P0-A: Extract error from wrapper format if tool reports failure.
|
|
45
|
+
*
|
|
46
|
+
* Returns the tool's `error` field (string | Error) when `success === false`
|
|
47
|
+
* is present in the wrapper, so that executor.executeWithTimeout() can
|
|
48
|
+
* propagate it as NodeExecutionResult.error. Without this, bash failures
|
|
49
|
+
* silently produced output="" + status=completed in the engine.
|
|
50
|
+
*
|
|
51
|
+
* Returns undefined when:
|
|
52
|
+
* - value is not an object
|
|
53
|
+
* - success === true (or success field is missing)
|
|
54
|
+
* - wrapper has no error string
|
|
55
|
+
*
|
|
56
|
+
* Task #4392 P0-2: when the wrapper signals a non-zero `exit_code` but carries
|
|
57
|
+
* no stderr, the bare `Tool exited with code N` message is useless on its own
|
|
58
|
+
* (#4385 measured 27 such `exit 2` occurrences in the creator sessions, and
|
|
59
|
+
* 291 failed runs whose `session.metadata.error` was null). We therefore append
|
|
60
|
+
* the (redacted, single-line, truncated) command plus a stdout tail.
|
|
61
|
+
*/
|
|
62
|
+
private extractErrorFromWrapper;
|
|
63
|
+
}
|
|
64
|
+
import type { Node, NodeDefinition, NodeExecutionContext, NodeExecutionResult } from '../types';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Node, NodeDefinition, NodeExecutionContext, NodeExecutionResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* WorkflowRunner interface for running sub-workflows
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkflowRunner {
|
|
6
|
+
/**
|
|
7
|
+
* Run a workflow by name
|
|
8
|
+
* @param workflowName - Name of the workflow to run
|
|
9
|
+
* @param input - Optional input to pass to the workflow
|
|
10
|
+
* @returns Promise resolving to the workflow run result
|
|
11
|
+
*/
|
|
12
|
+
run(workflowName: string, input?: any): Promise<WorkflowRunResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the status of a workflow run
|
|
15
|
+
* @param runId - The run ID to check
|
|
16
|
+
* @returns Promise resolving to the run result or null if not found
|
|
17
|
+
*/
|
|
18
|
+
getRun(runId: string): Promise<WorkflowRunResult | null>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Result from a workflow run
|
|
22
|
+
*/
|
|
23
|
+
export interface WorkflowRunResult {
|
|
24
|
+
/** Unique run ID */
|
|
25
|
+
runId: string;
|
|
26
|
+
/** Final status of the run */
|
|
27
|
+
status: 'completed' | 'failed' | 'stopped';
|
|
28
|
+
/** Output from the workflow (if completed) */
|
|
29
|
+
output?: any;
|
|
30
|
+
/** Error message (if failed or stopped) */
|
|
31
|
+
error?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* WorkflowNode configuration
|
|
35
|
+
*/
|
|
36
|
+
export interface WorkflowNodeConfig {
|
|
37
|
+
/** Name of the workflow to invoke */
|
|
38
|
+
workflow_name: string;
|
|
39
|
+
/** Input to pass to the sub-workflow (supports template strings) */
|
|
40
|
+
input?: Record<string, unknown>;
|
|
41
|
+
/** Whether to wait for completion (default: true) */
|
|
42
|
+
wait_complete?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* WorkflowNode executes a nested workflow as a node.
|
|
46
|
+
*
|
|
47
|
+
* This allows one workflow to invoke another workflow as a single node,
|
|
48
|
+
* enabling workflow composition and reusability.
|
|
49
|
+
*
|
|
50
|
+
* Features:
|
|
51
|
+
* - Pass input to sub-workflow (with template resolution)
|
|
52
|
+
* - Wait for completion or fire-and-forget
|
|
53
|
+
* - Handle sub-workflow errors
|
|
54
|
+
* - Track execution duration
|
|
55
|
+
*/
|
|
56
|
+
export declare class WorkflowNode implements Node {
|
|
57
|
+
private definition;
|
|
58
|
+
private workflowRunner;
|
|
59
|
+
readonly type = "workflow";
|
|
60
|
+
readonly id: string;
|
|
61
|
+
constructor(definition: NodeDefinition, workflowRunner: WorkflowRunner);
|
|
62
|
+
execute(context: NodeExecutionContext): Promise<NodeExecutionResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Convert Record<string, NodeExecutionResult> to Map<string, any>
|
|
65
|
+
* for compatibility with resolvePath that expects Map format.
|
|
66
|
+
*
|
|
67
|
+
* In the Record format, the value is NodeExecutionResult (with output field).
|
|
68
|
+
* In the Map format, the value is the raw output directly.
|
|
69
|
+
*/
|
|
70
|
+
private convertToMap;
|
|
71
|
+
/**
|
|
72
|
+
* Resolve input template references.
|
|
73
|
+
* Templates are in the format {{nodeId.output.path}}
|
|
74
|
+
*
|
|
75
|
+
* @param input - The input object that may contain template strings
|
|
76
|
+
* @param previousOutputs - Map of previous node outputs (value is raw output)
|
|
77
|
+
* @returns The input with template references resolved
|
|
78
|
+
*/
|
|
79
|
+
private resolveInput;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve a value that may contain template references.
|
|
82
|
+
*/
|
|
83
|
+
private resolveValue;
|
|
84
|
+
/**
|
|
85
|
+
* Resolve template references in a single string.
|
|
86
|
+
* Supports format: {{nodeId.output.path}}
|
|
87
|
+
*/
|
|
88
|
+
private resolveStringTemplate;
|
|
89
|
+
/**
|
|
90
|
+
* Resolve a dot-notation path from previous outputs.
|
|
91
|
+
* First segment is the node ID, rest is the path within that node's output.
|
|
92
|
+
*/
|
|
93
|
+
private resolvePath;
|
|
94
|
+
/**
|
|
95
|
+
* Extract the actual output value from wrapper formats.
|
|
96
|
+
*
|
|
97
|
+
* Handles:
|
|
98
|
+
* - AgentNode format: { result, metadata } -> returns result
|
|
99
|
+
* - DecoratorNode format: { success, output, ... } -> returns output
|
|
100
|
+
* - Other formats: returns value as-is
|
|
101
|
+
*
|
|
102
|
+
* @param value - The value to extract from
|
|
103
|
+
* @returns The extracted value
|
|
104
|
+
*/
|
|
105
|
+
private extractFromWrapper;
|
|
106
|
+
/**
|
|
107
|
+
* Convert a value to string for template replacement.
|
|
108
|
+
* - If value is undefined, return the original template
|
|
109
|
+
* - If value is a string, return it directly
|
|
110
|
+
* - If value is null, return 'null'
|
|
111
|
+
* - If value is an object or array, serialize to JSON
|
|
112
|
+
*
|
|
113
|
+
* @param value - The value to stringify
|
|
114
|
+
* @param originalTemplate - The original template string (returned if value is undefined)
|
|
115
|
+
* @returns String representation of the value
|
|
116
|
+
*/
|
|
117
|
+
private stringifyValue;
|
|
118
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LarkCliWorkflowNotifyHook,
|
|
3
3
|
createLarkCliWorkflowNotifyHook
|
|
4
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
5
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../../shared/@ai-setting/roy-agent-core-9h72sk1n.js";
|
|
5
|
+
import"../../../shared/@ai-setting/roy-agent-core-b5ew8t0k.js";
|
|
6
6
|
import"../../../shared/@ai-setting/roy-agent-core-9csa89jx.js";
|
|
7
7
|
import"../../../shared/@ai-setting/roy-agent-core-qcspfszy.js";
|
|
8
8
|
import"../../../shared/@ai-setting/roy-agent-core-4z3rq5gw.js";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview LarkCliWorkflowNotifyHook - 把 workflow run 进展同步到飞书群
|
|
3
|
+
*
|
|
4
|
+
* Part 2:在 workflow 生命周期 Hook 上,把「run 进展」渲染成**一张可更新 + 置顶的
|
|
5
|
+
* 飞书卡片** —— 完全复用 task 通知的卡片引擎 `LarkCardPatchNotifier`(同一套
|
|
6
|
+
* 卡片骨架 / lark-cli 参数契约 / pin-unpin 逻辑),不新写 lark-cli 封装。
|
|
7
|
+
*
|
|
8
|
+
* 生命周期映射:
|
|
9
|
+
* - `workflow:before.run` → notifier.startWorkflow(发卡 + pin)
|
|
10
|
+
* - `workflow:before.node` → notifier.updateWorkflow(patch 同一卡片;节流)
|
|
11
|
+
* - `workflow:after.node` → notifier.updateWorkflow(patch 同一卡片;节点里程碑/进度)
|
|
12
|
+
* - `workflow:after.run` → notifier.finishWorkflow(终态 patch + unpin + 清理跟踪)
|
|
13
|
+
*
|
|
14
|
+
* ── 触发群 / 身份(与 task 插件一致)──────────────────────────────────
|
|
15
|
+
* workflow Hook 由 engine 触发,其 ALS 上下文继承自触发它的 agent query
|
|
16
|
+
* (`workflow_run` 工具)—— 因此 `getEnvContextOrEmpty().replyChannel`
|
|
17
|
+
* (chatId / profile / messageId)应该可达。若取不到 chatId → **安全跳过**
|
|
18
|
+
* (不抛错、不发到错误的群)。
|
|
19
|
+
*
|
|
20
|
+
* ── 单卡片语义 ────────────────────────────────────────────────────────
|
|
21
|
+
* 同一 runId 全程只建一张卡(`cardMessageIds` 按 runId 跟踪 messageId),
|
|
22
|
+
* 节点事件只 patch 这张卡(不刷屏);终态后清理跟踪项。
|
|
23
|
+
*
|
|
24
|
+
* ⚠️ 关键契约:`globalHookManager.execute(point, data, metadata)` 会把 data 包进
|
|
25
|
+
* `HookContext` —— hook 收到的第 1 个参数是 **ctx**,载荷在 **ctx.data**。
|
|
26
|
+
*/
|
|
27
|
+
import type { Hook, HookContext } from "../../hook/types";
|
|
28
|
+
import { LarkCardPatchNotifier } from "../../task/plugins/lark-card-patch-notifier";
|
|
29
|
+
export interface WorkflowNotifyConfig {
|
|
30
|
+
/** 是否启用(默认 true) */
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
/** 优先级(默认 5) */
|
|
33
|
+
priority?: number;
|
|
34
|
+
/** 插件名称(用于 pluginEnabled 检查) */
|
|
35
|
+
pluginName?: string;
|
|
36
|
+
/** 事件源 ID(用于 pluginEnabled 检查) */
|
|
37
|
+
sourceId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 节点「开始」事件的节流间隔(毫秒)
|
|
40
|
+
*
|
|
41
|
+
* `workflow:before.node` 在大 DAG 上高频触发,不加节流会频繁 patch 卡片。
|
|
42
|
+
* 默认 3000ms;设为 0 表示不节流。
|
|
43
|
+
*
|
|
44
|
+
* ★ 只节流 `before.node`("开始"),`after.node` / `after.run` 永远 patch ——
|
|
45
|
+
* 节点完成/终态是进度分子与终态卡片的来源,丢了会让卡片停在旧状态。
|
|
46
|
+
*/
|
|
47
|
+
nodeThrottleMs?: number;
|
|
48
|
+
/**
|
|
49
|
+
* LarkCardPatchNotifier 实例
|
|
50
|
+
*
|
|
51
|
+
* 不传 → plugin 自己 new 一个(messageId 由 plugin 的 Map 跟踪)。
|
|
52
|
+
*/
|
|
53
|
+
cardNotifier?: LarkCardPatchNotifier;
|
|
54
|
+
}
|
|
55
|
+
export declare class LarkCliWorkflowNotifyHook implements Hook {
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly priority: number;
|
|
58
|
+
readonly description?: string;
|
|
59
|
+
readonly pluginName?: string;
|
|
60
|
+
readonly sourceId?: string;
|
|
61
|
+
/**
|
|
62
|
+
* 本插件监听的 hook 点(显式声明)
|
|
63
|
+
*
|
|
64
|
+
* ★ `event-source-handlers.getPluginHookPoints()` 会优先读这个字段 —— 让
|
|
65
|
+
* "flat execute" 插件能声明自己的 hook 点,而不是被硬编码成 task 的 4 个点。
|
|
66
|
+
*/
|
|
67
|
+
readonly hookPoints: string[];
|
|
68
|
+
private readonly config;
|
|
69
|
+
/** 卡片引擎(复用 task 卡片实现) */
|
|
70
|
+
private cardNotifier?;
|
|
71
|
+
/** 卡片 messageId 跟踪(key: runId)—— 同一 run 全程复用同一张卡 */
|
|
72
|
+
private cardMessageIds;
|
|
73
|
+
/** 节点「开始」节流状态(key: `node:${runId}` → 上次 patch 时间戳) */
|
|
74
|
+
private lastNodeNotifyTimestamps;
|
|
75
|
+
/** 建卡失败哨兵:后续 update 直接 skip,避免"失败→重试→再失败"风暴 */
|
|
76
|
+
private static readonly CARD_START_FAILED_SENTINEL;
|
|
77
|
+
/** 建卡进行中哨兵:挡住同链路上的重入 update(避免重复建卡) */
|
|
78
|
+
private static readonly CARD_START_INFLIGHT_SENTINEL;
|
|
79
|
+
constructor(config?: WorkflowNotifyConfig);
|
|
80
|
+
execute(ctx: HookContext<unknown>): Promise<void>;
|
|
81
|
+
/** run 开始:建卡(标题含 workflow 名)+ pin */
|
|
82
|
+
private onBeforeRun;
|
|
83
|
+
/** 节点即将执行:patch 同一卡片(节流) */
|
|
84
|
+
private onBeforeNode;
|
|
85
|
+
/** 节点结束:patch 同一卡片(进度 + 过程记录;失败时加里程碑) */
|
|
86
|
+
private onAfterNode;
|
|
87
|
+
/** run 终态:patch 终态(completed 绿 / failed 红 / stopped 灰)+ unpin + 清理 */
|
|
88
|
+
private onAfterRun;
|
|
89
|
+
/** 建卡(+ pin)并缓存 messageId */
|
|
90
|
+
private sendCardStart;
|
|
91
|
+
/** patch 同一张卡(无卡片 / 建卡失败 / 无 chatId 时安全跳过) */
|
|
92
|
+
private patchCard;
|
|
93
|
+
/**
|
|
94
|
+
* 解析卡片目标(chatId / profile)—— 与 task 插件一致,优先 ALS replyChannel
|
|
95
|
+
*
|
|
96
|
+
* workflow 的 hook 由 engine 触发,ALS 上下文继承自触发它的 agent query
|
|
97
|
+
* (`workflow_run` 工具),因此 replyChannel 通常可达。取不到 → 调用方安全跳过。
|
|
98
|
+
*/
|
|
99
|
+
private resolveTarget;
|
|
100
|
+
/** hook 载荷 → 卡片"运行栏位"元信息 */
|
|
101
|
+
private buildWorkflowMeta;
|
|
102
|
+
/** RunStatus → 卡片终态 */
|
|
103
|
+
private mapRunStatus;
|
|
104
|
+
/** 节点「开始」节流(只节流 before.node) */
|
|
105
|
+
private shouldThrottleNodeStart;
|
|
106
|
+
}
|
|
107
|
+
export declare function createLarkCliWorkflowNotifyHook(config?: WorkflowNotifyConfig): LarkCliWorkflowNotifyHook;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow JSON output extraction via agent:after.react + json-extract sub-agent.
|
|
3
|
+
*
|
|
4
|
+
* Architecture (decoupled, sub-agent based + tool self-recording):
|
|
5
|
+
* 1. Main agent runs its normal ReAct loop (plan/execute/verify) — it does NOT
|
|
6
|
+
* know about JSON output. The main agent's tool list is clean.
|
|
7
|
+
* 2. After ReAct finishes, this plugin is invoked on `agent:after.react`.
|
|
8
|
+
* 3. The plugin creates a dynamic `workflow_submit_output` tool bound to
|
|
9
|
+
* `hookCtx` and calls the `json-extract` sub-agent via
|
|
10
|
+
* `agentComponent.run('json-extract', '', { sessionId, extraTools, ... })`.
|
|
11
|
+
* 4. The `json-extract` sub-agent (built-in) has one allowed tool:
|
|
12
|
+
* `workflow_submit_output`. It reads session history and calls the tool
|
|
13
|
+
* with the structured JSON answer.
|
|
14
|
+
* 5. The tool itself (not this plugin) writes the validated JSON to
|
|
15
|
+
* `hookCtx.structuredOutputExtracted`. The plugin just reads it back
|
|
16
|
+
* afterwards — no result.toolCalls inspection, no re-validation.
|
|
17
|
+
*
|
|
18
|
+
* No fallback: if the sub-agent fails to call the tool, we log a warning and
|
|
19
|
+
* return undefined. We do NOT substitute a hardcoded model.
|
|
20
|
+
*/
|
|
21
|
+
import type { AgentComponent } from '../../agent/agent-component';
|
|
22
|
+
import type { HookContext as AgentHookContext } from '../../agent/types';
|
|
23
|
+
export declare const WORKFLOW_JSON_OUTPUT_SOURCE_ID = "workflow";
|
|
24
|
+
export declare const WORKFLOW_JSON_OUTPUT_PLUGIN_NAME = "json-output";
|
|
25
|
+
export declare const WORKFLOW_JSON_OUTPUT_PLUGIN_KEY = "workflow:json-output";
|
|
26
|
+
export declare function isWorkflowJsonOutputEnabled(pluginEnabled?: Record<string, boolean>): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 注册 workflow JSON output plugin
|
|
29
|
+
*
|
|
30
|
+
* @param options.agentComponent — AgentComponent 实例,用于在 hook 中调用
|
|
31
|
+
* json-extract sub-agent
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerWorkflowJsonOutputPlugin(options?: {
|
|
34
|
+
agentComponent: AgentComponent;
|
|
35
|
+
} | void): void;
|
|
36
|
+
export declare function unregisterWorkflowJsonOutputPlugin(): void;
|
|
37
|
+
/**
|
|
38
|
+
* For tests: set the agentComponent reference directly.
|
|
39
|
+
*/
|
|
40
|
+
export declare function __setPluginAgentComponentForTest(agentComponent: AgentComponent | null): void;
|
|
41
|
+
/**
|
|
42
|
+
* Narrow source interface for `resolveProviderToolChoice`.
|
|
43
|
+
*
|
|
44
|
+
* Replaces the unsafe `agentComponent: any` parameter (Task #2177 review
|
|
45
|
+
* finding C-1 + A-1). Any object that exposes a `configComponent.get(key)`
|
|
46
|
+
* satisfies this contract — AgentComponent, mock test doubles, and future
|
|
47
|
+
* first-party wrappers all work.
|
|
48
|
+
*
|
|
49
|
+
* Exported so callers can type-narrow their inputs without `any`-cast.
|
|
50
|
+
*/
|
|
51
|
+
export interface ProviderConfigSource {
|
|
52
|
+
configComponent?: {
|
|
53
|
+
get(key: string): unknown;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolve effective toolChoice for the json-extract sub-agent.
|
|
58
|
+
*
|
|
59
|
+
* Rules (Task #2175):
|
|
60
|
+
* 1. First-party providers (openai/anthropic/google) → "required"
|
|
61
|
+
* 2. OpenAI-compatible providers with `capabilities.reasoning === true`
|
|
62
|
+
* (deepseek / volcengine / qwen-thinking / ...) → "auto" + rely on
|
|
63
|
+
* `maxIterations=5` retry (agent-registry.ts:432).
|
|
64
|
+
* 3. Everything else (unknown / no config) → "required" (back-compat).
|
|
65
|
+
*
|
|
66
|
+
* Anthropic + reasoning rationale (Task #2181, finding A-3 partial — Task #2177
|
|
67
|
+
* review op #16537):
|
|
68
|
+
* Anthropic Claude with extended thinking (`thinking.type=enabled`) is
|
|
69
|
+
* treated as first-party and unconditionally returns `'required'`.
|
|
70
|
+
* This is supported by AI SDK v4+: Claude Sonnet 4.5 / Opus 4 with
|
|
71
|
+
* extended thinking accepts `tool_choice: "required"` (per Anthropic
|
|
72
|
+
* docs: https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking).
|
|
73
|
+
* The provider returns a 400 error if the model rejects
|
|
74
|
+
* `tool_choice: "required"` — it does NOT silently drop the argument.
|
|
75
|
+
* The OpenAI-compatible branch (`'auto'`) is reserved for providers
|
|
76
|
+
* where reasoning silently DROPS `tool_choice` instead of erroring
|
|
77
|
+
* (deepseek / volcengine / qwen-thinking observed behavior in Task #2175).
|
|
78
|
+
* TODO(validation): confirm against real Anthropic SDK behavior in a
|
|
79
|
+
* future R&D Task.
|
|
80
|
+
*
|
|
81
|
+
* Known limitation (Task #2177 review B-3): this function does NOT consult
|
|
82
|
+
* session-level provider overrides (e.g. `hookCtx.context.metadata.llmProvider`).
|
|
83
|
+
* Only the global `llm.defaultProvider` is read. If a future Task needs
|
|
84
|
+
* per-session override, update the EDGE-3 test in
|
|
85
|
+
* `workflow-json-output-plugin-provider-compat.test.ts` and document the
|
|
86
|
+
* override precedence rules.
|
|
87
|
+
*
|
|
88
|
+
* Exported for unit testing.
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolveProviderToolChoice(source: ProviderConfigSource | null | undefined): "required" | "auto";
|
|
91
|
+
/**
|
|
92
|
+
* Workflow JSON output extraction via agent:after.react + json-extract sub-agent.
|
|
93
|
+
*
|
|
94
|
+
* Architecture (v3 — clean extraction, Issue #1694 root-cause fix):
|
|
95
|
+
*
|
|
96
|
+
* 1. Main agent runs its normal ReAct loop. It may produce JSON in any of:
|
|
97
|
+
* - Plain text: {"x": 1, ...}
|
|
98
|
+
* - Markdown code block: ```json\n{"x": 1, ...}\n```
|
|
99
|
+
* - Tool-call input (e.g., echo's message field): {"x": 1, ...}
|
|
100
|
+
* The main agent does NOT know about workflow_submit_output. Its only
|
|
101
|
+
* contract is "produce a JSON object somewhere in its final output".
|
|
102
|
+
*
|
|
103
|
+
* 2. After ReAct finishes, this plugin is invoked on `agent:after.react`.
|
|
104
|
+
*
|
|
105
|
+
* 3. The plugin extracts JSON from the main agent's final output via
|
|
106
|
+
* `extractJsonFromAgentOutput()` (tries multiple patterns + validates
|
|
107
|
+
* against the JSON schema).
|
|
108
|
+
*
|
|
109
|
+
* 4. The plugin constructs a SINGLE user query message containing the
|
|
110
|
+
* pre-extracted JSON and calls the `json-extract` sub-agent with:
|
|
111
|
+
* - `messages: [{ role: "user", content: "Submit this JSON: ..." }]`
|
|
112
|
+
* (Layer 1+2 messages override — bypasses main session history,
|
|
113
|
+
* eliminating pollution risk)
|
|
114
|
+
* - `toolChoice: "required"` (forces LLM to call workflow_submit_output,
|
|
115
|
+
* eliminating the non-deterministic "markdown makes me stop" bug)
|
|
116
|
+
* - `extraTools: [workflow_submit_output]`
|
|
117
|
+
* - `persistSession: false`
|
|
118
|
+
*
|
|
119
|
+
* 5. The submit tool (not this plugin) writes the validated JSON to
|
|
120
|
+
* `hookCtx.structuredOutputExtracted`. The plugin just reads it back.
|
|
121
|
+
*
|
|
122
|
+
* Why this works where the previous design failed:
|
|
123
|
+
* - Previous: sub-agent reuses main session history. The history contains
|
|
124
|
+
* echo tool-calls + markdown code blocks + thinking blocks, all of which
|
|
125
|
+
* pollute the sub-agent's reasoning and cause non-deterministic
|
|
126
|
+
* finishReason=stop (no tool call).
|
|
127
|
+
* - Now: sub-agent sees ONLY one user message with the pre-extracted JSON
|
|
128
|
+
* and the schema prompt. The LLM cannot be confused by polluted history
|
|
129
|
+
* because there is no polluted history.
|
|
130
|
+
*/
|
|
131
|
+
export declare function runWorkflowJsonOutputExtraction(hookCtx: AgentHookContext & {
|
|
132
|
+
structuredOutputExtracted?: Record<string, unknown>;
|
|
133
|
+
}): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Extract a JSON object from the main agent's final output.
|
|
136
|
+
*
|
|
137
|
+
* Tries multiple patterns (in order):
|
|
138
|
+
* 1. `hookCtx.llmOutput.content` (if non-empty)
|
|
139
|
+
* 2. Last assistant message text part
|
|
140
|
+
* 3. Last assistant message tool-call input (string or { message: ... })
|
|
141
|
+
*
|
|
142
|
+
* Within each pattern, tries (in order):
|
|
143
|
+
* 1. Direct JSON.parse
|
|
144
|
+
* 2. Markdown ```json ... ``` code block
|
|
145
|
+
* 3. First {...} substring
|
|
146
|
+
*
|
|
147
|
+
* Returns null if all attempts fail.
|
|
148
|
+
*
|
|
149
|
+
* Exported for testing.
|
|
150
|
+
*/
|
|
151
|
+
export declare function extractJsonFromAgentOutput(hookCtx: AgentHookContext): Record<string, unknown> | null;
|
|
152
|
+
/**
|
|
153
|
+
* Try to parse a JSON object from arbitrary text using 3 strategies:
|
|
154
|
+
* 1. Whole text is JSON
|
|
155
|
+
* 2. Markdown ```json ... ``` code block
|
|
156
|
+
* 3. First {...} substring
|
|
157
|
+
*
|
|
158
|
+
* Returns null if no valid JSON object is found.
|
|
159
|
+
*
|
|
160
|
+
* 2026-10-16:实现已抽到 `src/utils/loose-json`(session 压缩的 checkpoint
|
|
161
|
+
* 降级路径也要用同一个解析器,避免 session → workflow/plugins 反向耦合)。
|
|
162
|
+
* 此处 re-export,历史 import 路径(含测试)不变。
|
|
163
|
+
*/
|
|
164
|
+
import { tryParseJsonFromText } from '../../../utils/loose-json';
|
|
165
|
+
export { tryParseJsonFromText };
|
|
166
|
+
export declare const tracedRunWorkflowJsonOutputExtraction: typeof runWorkflowJsonOutputExtraction;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview RuntimeCancellationScope — structured cancellation contract
|
|
3
|
+
* owned by each workflow session (Task #2275).
|
|
4
|
+
*
|
|
5
|
+
* Why this exists:
|
|
6
|
+
* Before Task #2275, the engine's stop path was a loose combination of
|
|
7
|
+
* metadata update + executor.cancelAll() + cache eviction. The underlying
|
|
8
|
+
* `runWorkflow()` Promise could remain pending, cooperative runners could
|
|
9
|
+
* ignore a graceful signal, retry-backoff timers could survive a stop, and
|
|
10
|
+
* a second ESC had nothing to escalate.
|
|
11
|
+
*
|
|
12
|
+
* `RuntimeCancellationScope` is the single, observable, runtime-owned
|
|
13
|
+
* cancellation surface. The engine creates one scope per active session,
|
|
14
|
+
* every node executor and AgentComponent receives the same scope (via
|
|
15
|
+
* `context.cancellationScope` + `context.abortSignal`), and the engine
|
|
16
|
+
* `stop()` path drives the scope through a deterministic state machine:
|
|
17
|
+
*
|
|
18
|
+
* running ──cancel()──► graceful ──cancel({force:true})──► force
|
|
19
|
+
*
|
|
20
|
+
* Each transition records the reason on its AbortSignal and fires
|
|
21
|
+
* registered cleanup handlers. The engine `waitForCleanup()` resolves
|
|
22
|
+
* once every tracked Promise has settled (or a bounded timeout elapses).
|
|
23
|
+
*
|
|
24
|
+
* Contract:
|
|
25
|
+
* - `signal`: combined "graceful+force" AbortSignal that listeners may
|
|
26
|
+
* use as a single source. Equivalent to `AbortSignal.any([...])`.
|
|
27
|
+
* - `forceSignal`: fires ONLY on `cancel({force:true})`. Useful for
|
|
28
|
+
* real-process kill paths that must not be triggered by a polite stop.
|
|
29
|
+
* - `level`: "running" | "graceful" | "force" — reflects current state.
|
|
30
|
+
* - `track(label, work)`: returns `work`'s settled Promise. Work identity
|
|
31
|
+
* (the Promise instance) is removed from tracking once it settles. Work
|
|
32
|
+
* errors propagate (NOT swallowed).
|
|
33
|
+
* - `onForce(label, handler)`: registers a handler invoked when the scope
|
|
34
|
+
* enters `force`. Returns an unsubscribe function.
|
|
35
|
+
* - `cancel(reason, options?)`: transitions to graceful OR force. Idempotent.
|
|
36
|
+
* Returns a CleanupReport aggregating handler errors.
|
|
37
|
+
* - `waitForCleanup(timeoutMs)`: returns once all tracked work settles or
|
|
38
|
+
* the timeout elapses.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Cancellation level reflects the current escalation stage of a scope.
|
|
42
|
+
* - "running": no cancellation requested yet.
|
|
43
|
+
* - "graceful": `cancel()` was called but no force yet.
|
|
44
|
+
* - "force": `cancel({force:true})` was called.
|
|
45
|
+
*/
|
|
46
|
+
export type CancellationLevel = "running" | "graceful" | "force";
|
|
47
|
+
/**
|
|
48
|
+
* CleanupReport aggregates the outcome of `cancel()` and `waitForCleanup()`.
|
|
49
|
+
* - `completed`: true when every tracked Promise has settled.
|
|
50
|
+
* - `pendingLabels`: labels of work still pending at report time.
|
|
51
|
+
* - `errors`: cleanup-handler errors (NOT tracked-work errors).
|
|
52
|
+
*/
|
|
53
|
+
export interface CleanupReport {
|
|
54
|
+
completed: boolean;
|
|
55
|
+
pendingLabels: string[];
|
|
56
|
+
errors: Array<{
|
|
57
|
+
label: string;
|
|
58
|
+
error: string;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* RuntimeCancellationScope — runtime-owned cancellation/cleanup contract.
|
|
63
|
+
*
|
|
64
|
+
* Thread-safety: single-threaded JavaScript; no concurrent access concerns.
|
|
65
|
+
*
|
|
66
|
+
* Idempotency:
|
|
67
|
+
* - `cancel()` after a graceful cancel is a no-op (no re-fire, no state change).
|
|
68
|
+
* - `cancel({force:true})` after a graceful cancel escalates to force and
|
|
69
|
+
* fires force handlers exactly once.
|
|
70
|
+
* - `cancel({force:true})` after a force cancel is a no-op.
|
|
71
|
+
*/
|
|
72
|
+
export declare class RuntimeCancellationScope {
|
|
73
|
+
/** Graceful AbortController — fires on `cancel()` (any reason). */
|
|
74
|
+
private readonly gracefulController;
|
|
75
|
+
/** Force AbortController — fires only on `cancel({force:true})`. */
|
|
76
|
+
private readonly forceController;
|
|
77
|
+
/** Combined signal — fires on graceful OR force. */
|
|
78
|
+
readonly signal: AbortSignal;
|
|
79
|
+
/** Force-only signal — fires only on `cancel({force:true})`. */
|
|
80
|
+
readonly forceSignal: AbortSignal;
|
|
81
|
+
/** Current cancellation level. */
|
|
82
|
+
private _level;
|
|
83
|
+
/** Tracked cleanup work, keyed by Promise identity. */
|
|
84
|
+
private trackedWork;
|
|
85
|
+
/** Registered force handlers, in registration order. */
|
|
86
|
+
private forceHandlers;
|
|
87
|
+
/** Captured handler errors from the most recent force fire. */
|
|
88
|
+
private forceHandlerErrors;
|
|
89
|
+
constructor();
|
|
90
|
+
get level(): CancellationLevel;
|
|
91
|
+
/**
|
|
92
|
+
* Track a Promise as cleanup work. Returns the work's settled Promise.
|
|
93
|
+
* Work errors propagate (NOT swallowed) — the engine propagates them to
|
|
94
|
+
* its own completedPromise via the existing error path.
|
|
95
|
+
*/
|
|
96
|
+
track<T>(label: string, work: Promise<T>): Promise<T>;
|
|
97
|
+
/**
|
|
98
|
+
* Register a force handler. Handler is invoked when the scope enters
|
|
99
|
+
* `force`. Returns an unsubscribe function that detaches the handler.
|
|
100
|
+
*
|
|
101
|
+
* Handlers run in registration order. If a handler throws, the error is
|
|
102
|
+
* captured into `CleanupReport.errors`; subsequent handlers still run.
|
|
103
|
+
*/
|
|
104
|
+
onForce(label: string, handler: () => void | Promise<void>): () => void;
|
|
105
|
+
/**
|
|
106
|
+
* Cancel the scope. Transitions:
|
|
107
|
+
* running → graceful: on any cancel() call.
|
|
108
|
+
* graceful → force: on cancel({force:true}).
|
|
109
|
+
* force → force: no-op (handlers do not re-fire).
|
|
110
|
+
*
|
|
111
|
+
* Returns a CleanupReport describing handler errors and pending work.
|
|
112
|
+
*/
|
|
113
|
+
cancel(reason: string, options?: {
|
|
114
|
+
force?: boolean;
|
|
115
|
+
}): Promise<CleanupReport>;
|
|
116
|
+
/**
|
|
117
|
+
* Wait until every tracked Promise settles, or the timeout elapses.
|
|
118
|
+
* Returns a CleanupReport.
|
|
119
|
+
*/
|
|
120
|
+
waitForCleanup(timeoutMs: number): Promise<CleanupReport>;
|
|
121
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Index - Session-based Workflow Service
|
|
3
|
+
*
|
|
4
|
+
* After refactoring, RunRepository is removed. Workflow runs are managed via SessionComponent.
|
|
5
|
+
*/
|
|
6
|
+
export { WorkflowService } from './workflow-service';
|
|
7
|
+
export type { WorkflowRepository, WorkflowEngine, CreateOptions, ListOptions, WorkflowUpdates, WorkflowEngineFactory, SessionInfo, WorkflowSessionMetadata, AgentSessionRef, } from './workflow-service';
|
|
8
|
+
export { WorkflowServiceRegistry, getWorkflowService, registerWorkflowService, } from './registry';
|
|
9
|
+
export type { WorkflowDefinition } from '../types/workflow';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry - Singleton registry for accessing WorkflowService
|
|
3
|
+
*/
|
|
4
|
+
import { WorkflowService } from './workflow-service';
|
|
5
|
+
/**
|
|
6
|
+
* Singleton registry for WorkflowService
|
|
7
|
+
* Provides centralized access to the workflow service instance
|
|
8
|
+
*/
|
|
9
|
+
export declare class WorkflowServiceRegistry {
|
|
10
|
+
private static instance;
|
|
11
|
+
private service;
|
|
12
|
+
private constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Get the singleton registry instance
|
|
15
|
+
*/
|
|
16
|
+
static getInstance(): WorkflowServiceRegistry;
|
|
17
|
+
/**
|
|
18
|
+
* Register a WorkflowService instance
|
|
19
|
+
*/
|
|
20
|
+
register(service: WorkflowService): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get the registered WorkflowService instance
|
|
23
|
+
* @throws Error if no service is registered
|
|
24
|
+
*/
|
|
25
|
+
get(): WorkflowService;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a service is registered
|
|
28
|
+
*/
|
|
29
|
+
isRegistered(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Reset the registry (primarily for testing)
|
|
32
|
+
*/
|
|
33
|
+
reset(): void;
|
|
34
|
+
}
|
|
35
|
+
export declare function getWorkflowService(): WorkflowService;
|
|
36
|
+
export declare function registerWorkflowService(service: WorkflowService): void;
|
|
37
|
+
export type { WorkflowService };
|