@ai-setting/roy-agent-core 1.7.52 → 1.7.53
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/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/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 +486 -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 +2 -2
- 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 +4 -4
- 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 +39 -0
- package/dist/env/llm/adapter.d.ts +80 -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/invoke.d.ts +264 -0
- package/dist/env/llm/llm-cache.d.ts +38 -0
- package/dist/env/llm/llm.d.ts +238 -0
- package/dist/env/llm/opencode-session.d.ts +79 -0
- package/dist/env/llm/provider.d.ts +40 -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 +818 -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/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/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/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 +704 -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 +293 -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/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/plugins/auto-task-plugin.d.ts +38 -0
- package/dist/env/task/plugins/card-chat-routing.d.ts +135 -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 +1 -1
- package/dist/env/task/plugins/lark-card-action-handler.d.ts +166 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +651 -0
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +248 -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 +375 -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/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 +1 -1
- 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/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 +58 -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/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/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 +60 -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 +235 -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 +35 -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/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/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/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 +57 -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 +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-rcfewbzr.js → roy-agent-core-4sx6sdb2.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ezgsem94.js → roy-agent-core-ph5qbqcx.js} +1 -1
- 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 +4 -2
- /package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-4vpk40ss.js} +0 -0
- /package/dist/shared/@ai-setting/{roy-agent-core-pkpkctvf.js → roy-agent-core-hch2geta.js} +0 -0
- /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Environment types and interfaces
|
|
3
|
+
*
|
|
4
|
+
* 定义 Environment 的核心类型,包括:
|
|
5
|
+
* - Environment 配置
|
|
6
|
+
* - EnvEvent 事件类型
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Environment Config
|
|
10
|
+
*/
|
|
11
|
+
export interface EnvironmentConfig {
|
|
12
|
+
/** 环境名称 */
|
|
13
|
+
name: string;
|
|
14
|
+
/** 环境版本 */
|
|
15
|
+
version: string;
|
|
16
|
+
/** 是否启用 */
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* BaseEnvironment 配置
|
|
21
|
+
*/
|
|
22
|
+
export interface BaseEnvironmentConfig {
|
|
23
|
+
/** 环境名称 */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** 环境版本 */
|
|
26
|
+
version?: string;
|
|
27
|
+
/** 是否启用 */
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* EnvEvent 元信息
|
|
32
|
+
*/
|
|
33
|
+
export interface EnvEventMetadata {
|
|
34
|
+
/** 触发事件的 session ID */
|
|
35
|
+
trigger_session_id?: string;
|
|
36
|
+
/** 触发事件的 agent ID */
|
|
37
|
+
trigger_agent_id?: string;
|
|
38
|
+
/** Agent 名称 */
|
|
39
|
+
trigger_agent_name?: string;
|
|
40
|
+
/** 环境名称 */
|
|
41
|
+
env_name?: string;
|
|
42
|
+
/** 事件来源(如 "event-source") */
|
|
43
|
+
source?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Task #4042 (ESPlugin v2 Phase 2):trigger event ID
|
|
46
|
+
*
|
|
47
|
+
* 当 event 是由 delegate_task sub-agent 完成触发的 notify event 时,
|
|
48
|
+
* 此字段指向触发整个 delegate_task 调用的原始 event(由 EventStore
|
|
49
|
+
* insertTriggerEvent 返回)。下游 consumer 用此 ID 反查 EventStore
|
|
50
|
+
* 拿到原始 chatId / messageId 等 ES info。
|
|
51
|
+
*
|
|
52
|
+
* 不存在时:notify event 由非 ES 触发的场景,consumer 应 fallback 到
|
|
53
|
+
* lastReplyChannel / metadata.replyChannel。
|
|
54
|
+
*/
|
|
55
|
+
triggerEventId?: string;
|
|
56
|
+
/** 事件源 ID */
|
|
57
|
+
sourceId?: string;
|
|
58
|
+
/** 反馈通道(用于事件处理完成后回复) */
|
|
59
|
+
replyChannel?: {
|
|
60
|
+
/** 渠道类型,如 lark-cli, bounty-im */
|
|
61
|
+
type: string;
|
|
62
|
+
/** 发送目标的 app ID */
|
|
63
|
+
appId?: string;
|
|
64
|
+
/** 发送目标的会话 ID */
|
|
65
|
+
chatId?: string;
|
|
66
|
+
/** 原始消息 ID(用于回复) */
|
|
67
|
+
messageId?: string;
|
|
68
|
+
/** 原始回复指令 */
|
|
69
|
+
rawCommand?: string;
|
|
70
|
+
/** 其他自定义参数 */
|
|
71
|
+
params?: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
/** 启用的插件列表(用于 pluginEnabled 构建) */
|
|
74
|
+
plugins?: string[];
|
|
75
|
+
/** 其他元数据 */
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* EnvEvent
|
|
80
|
+
*
|
|
81
|
+
* 统一的事件机制,用于:
|
|
82
|
+
* - Stream 事件(stream.start, stream.text, stream.completed 等)
|
|
83
|
+
* - 工具调用事件(tool.call, tool.result 等)
|
|
84
|
+
* - 会话事件(session.created, session.updated 等)
|
|
85
|
+
* - Agent 事件(agent.thinking, agent.acting 等)
|
|
86
|
+
*/
|
|
87
|
+
export interface EnvEvent<T = unknown> {
|
|
88
|
+
/** 事件 ID */
|
|
89
|
+
id: string;
|
|
90
|
+
/** 事件类型 */
|
|
91
|
+
type: string;
|
|
92
|
+
/** 时间戳 */
|
|
93
|
+
timestamp: number;
|
|
94
|
+
/** 元信息 */
|
|
95
|
+
metadata: EnvEventMetadata;
|
|
96
|
+
/** 事件负载 */
|
|
97
|
+
payload: T;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* EnvEvent Handler
|
|
101
|
+
*/
|
|
102
|
+
export type EnvEventHandler = (event: EnvEvent) => void | Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* EnvEvent 创建参数(部分属性,可选)
|
|
105
|
+
*
|
|
106
|
+
* 用于 pushEnvEvent 方法,允许传入部分属性,自动补全必填字段
|
|
107
|
+
*/
|
|
108
|
+
export interface EnvEventInput {
|
|
109
|
+
/** 事件类型(必填) */
|
|
110
|
+
type: string;
|
|
111
|
+
/** 事件 ID(可选,自动生成) */
|
|
112
|
+
id?: string;
|
|
113
|
+
/** 时间戳(可选,自动生成) */
|
|
114
|
+
timestamp?: number;
|
|
115
|
+
/** 元信息(可选,自动创建) */
|
|
116
|
+
metadata?: EnvEventMetadata;
|
|
117
|
+
/** 事件负载(可选) */
|
|
118
|
+
payload?: unknown;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Action 类型
|
|
122
|
+
*/
|
|
123
|
+
export interface Action {
|
|
124
|
+
/** Action 类型 */
|
|
125
|
+
type: string;
|
|
126
|
+
/** Action 参数 */
|
|
127
|
+
params?: Record<string, unknown>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Tool Result
|
|
131
|
+
*/
|
|
132
|
+
export interface ToolResult {
|
|
133
|
+
/** 是否成功 */
|
|
134
|
+
success: boolean;
|
|
135
|
+
/** 输出内容 */
|
|
136
|
+
output: string | Record<string, unknown>;
|
|
137
|
+
/** 错误信息 */
|
|
138
|
+
error?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Context
|
|
142
|
+
*/
|
|
143
|
+
export interface Context {
|
|
144
|
+
/** 会话 ID */
|
|
145
|
+
sessionId?: string;
|
|
146
|
+
/** 用户 ID */
|
|
147
|
+
userId?: string;
|
|
148
|
+
/** 工作目录 */
|
|
149
|
+
workdir?: string;
|
|
150
|
+
/** 中断信号 */
|
|
151
|
+
abort?: AbortSignal;
|
|
152
|
+
/** 元数据 */
|
|
153
|
+
metadata?: Record<string, unknown>;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Session Hook 上下文
|
|
157
|
+
*/
|
|
158
|
+
export interface SessionHookContext {
|
|
159
|
+
/** Session 对象 */
|
|
160
|
+
session?: {
|
|
161
|
+
id: string;
|
|
162
|
+
title?: string;
|
|
163
|
+
metadata?: Record<string, unknown>;
|
|
164
|
+
};
|
|
165
|
+
/** 操作选项 */
|
|
166
|
+
options?: Record<string, unknown>;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Log Context(日志上下文)
|
|
170
|
+
*/
|
|
171
|
+
export interface LogContext {
|
|
172
|
+
/** 日志级别 */
|
|
173
|
+
level: string;
|
|
174
|
+
/** 日志类别 */
|
|
175
|
+
category: string;
|
|
176
|
+
/** 日志消息 */
|
|
177
|
+
message: string;
|
|
178
|
+
/** 时间戳 */
|
|
179
|
+
timestamp: number;
|
|
180
|
+
/** 调用位置 */
|
|
181
|
+
callerLocation?: string;
|
|
182
|
+
/** 其他元数据 */
|
|
183
|
+
[key: string]: unknown;
|
|
184
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DecoratorNode - 执行装饰器类方法的节点
|
|
3
|
+
*
|
|
4
|
+
* 实现 Node 接口,用于执行使用 @Workflow/@NodeAs 装饰的类方法
|
|
5
|
+
*/
|
|
6
|
+
import type { Node, NodeDefinition, NodeExecutionContext, NodeExecutionResult } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* DecoratorNode 节点配置
|
|
9
|
+
*/
|
|
10
|
+
export interface DecoratorNodeConfig extends NodeDefinition {
|
|
11
|
+
config: {
|
|
12
|
+
/** 方法名称 */
|
|
13
|
+
_methodName: string;
|
|
14
|
+
/** 类实例 */
|
|
15
|
+
_instance: any;
|
|
16
|
+
/** 用户自定义配置 */
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* DecoratorNode - 执行装饰器类方法的节点
|
|
22
|
+
*
|
|
23
|
+
* 用于执行使用 @Workflow/@NodeAs 装饰器定义的类方法
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const definition: DecoratorNodeConfig = {
|
|
28
|
+
* id: 'myNode',
|
|
29
|
+
* type: 'decorator',
|
|
30
|
+
* config: {
|
|
31
|
+
* _methodName: 'myMethod',
|
|
32
|
+
* _instance: myWorkflowInstance,
|
|
33
|
+
* }
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* const node = new DecoratorNode(definition);
|
|
37
|
+
* const result = await node.execute(context);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class DecoratorNode implements Node {
|
|
41
|
+
readonly type = "decorator";
|
|
42
|
+
readonly id: string;
|
|
43
|
+
private readonly methodName;
|
|
44
|
+
private readonly instance;
|
|
45
|
+
private readonly dependsOn;
|
|
46
|
+
private readonly timeout?;
|
|
47
|
+
private readonly retryConfig?;
|
|
48
|
+
constructor(definition: NodeDefinition);
|
|
49
|
+
/**
|
|
50
|
+
* 执行装饰器方法
|
|
51
|
+
*/
|
|
52
|
+
execute(context: NodeExecutionContext): Promise<NodeExecutionResult>;
|
|
53
|
+
/**
|
|
54
|
+
* 准备输入参数
|
|
55
|
+
*
|
|
56
|
+
* 根据依赖的节点 ID,从 nodeOutputs 中提取对应的输出
|
|
57
|
+
* 返回格式: { [depNodeId]: depOutput }
|
|
58
|
+
*/
|
|
59
|
+
private prepareInput;
|
|
60
|
+
/**
|
|
61
|
+
* 带重试的执行
|
|
62
|
+
*/
|
|
63
|
+
private executeWithRetry;
|
|
64
|
+
/**
|
|
65
|
+
* 带超时的执行
|
|
66
|
+
*/
|
|
67
|
+
private executeWithTimeout;
|
|
68
|
+
/**
|
|
69
|
+
* 计算退避延迟
|
|
70
|
+
*/
|
|
71
|
+
private calculateBackoff;
|
|
72
|
+
/**
|
|
73
|
+
* 睡眠
|
|
74
|
+
*/
|
|
75
|
+
private sleep;
|
|
76
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Edge 和 @WorkflowEdges 装饰器
|
|
3
|
+
*
|
|
4
|
+
* 用于显式声明节点之间的边关系
|
|
5
|
+
*/
|
|
6
|
+
import 'reflect-metadata';
|
|
7
|
+
import type { EdgeMetadata, EdgeOptions } from '../types/decorators-types';
|
|
8
|
+
/**
|
|
9
|
+
* 声明一条边 (from -> to)
|
|
10
|
+
*
|
|
11
|
+
* 这是一个方法装饰器,用于在方法上声明边关系
|
|
12
|
+
*
|
|
13
|
+
* @param from - 起始节点 ID
|
|
14
|
+
* @param to - 目标节点 ID
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* @Edge('nodeA', 'nodeB')
|
|
19
|
+
* static __edge_nodeA_to_nodeB__ = null;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function Edge(from: string, to: string): MethodDecorator;
|
|
23
|
+
/**
|
|
24
|
+
* 类级别装饰器,声明多条边
|
|
25
|
+
*
|
|
26
|
+
* @param edges - 边数组
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* @WorkflowEdges([
|
|
31
|
+
* { from: 'A', to: 'B' },
|
|
32
|
+
* { from: 'B', to: 'C' }
|
|
33
|
+
* ])
|
|
34
|
+
* @Workflow({ name: 'test' })
|
|
35
|
+
* class TestWorkflow { }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function WorkflowEdges(edges: EdgeOptions[]): ClassDecorator;
|
|
39
|
+
/**
|
|
40
|
+
* 获取类上的所有边元数据
|
|
41
|
+
*/
|
|
42
|
+
export declare function getEdgeMetadatas(target: Function): EdgeMetadata[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Workflow Decorators Index
|
|
3
|
+
*
|
|
4
|
+
* 导出所有装饰器相关的 API
|
|
5
|
+
*/
|
|
6
|
+
export { Workflow, getWorkflowMetadata } from './workflow';
|
|
7
|
+
export { NodeAs, getNodeMetadatas } from './node-as';
|
|
8
|
+
export { Edge, WorkflowEdges, getEdgeMetadatas } from './edge';
|
|
9
|
+
export { DecoratorNode } from './decorator-node';
|
|
10
|
+
export type { DecoratorNodeConfig } from './decorator-node';
|
|
11
|
+
export { WorkflowConverter } from '../extractor/workflow-converter';
|
|
12
|
+
export { createWorkflowFromClass } from '../utils/create-workflow';
|
|
13
|
+
export type { WorkflowOptions, NodeAsOptions, EdgeOptions, WorkflowMetadata, NodeMetadata, EdgeMetadata, ValidationResult, ConvertedWorkflowDefinition, ConvertedNodeDefinition, } from '../types/decorators-types';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @NodeAs 装饰器
|
|
3
|
+
*
|
|
4
|
+
* 用于将类方法声明为 Workflow 的 Node
|
|
5
|
+
*/
|
|
6
|
+
import 'reflect-metadata';
|
|
7
|
+
import type { NodeAsOptions, NodeMetadata } from '../types/decorators-types';
|
|
8
|
+
/**
|
|
9
|
+
* 将方法声明为 Workflow 的 Node
|
|
10
|
+
*
|
|
11
|
+
* @param options - Node 配置选项
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* @Workflow({ name: 'my-workflow', entry: 'fetch' })
|
|
16
|
+
* class MyWorkflow {
|
|
17
|
+
* @NodeAs({
|
|
18
|
+
* nodeId: 'fetch',
|
|
19
|
+
* nodeType: 'tool',
|
|
20
|
+
* config: { tool: 'web_search' }
|
|
21
|
+
* })
|
|
22
|
+
* async fetch(input: { query: string }) {
|
|
23
|
+
* return { data: [] };
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* @NodeAs({
|
|
27
|
+
* nodeId: 'process',
|
|
28
|
+
* dependsOn: 'fetch'
|
|
29
|
+
* })
|
|
30
|
+
* async process(input: { data: any }) {
|
|
31
|
+
* return { result: {} };
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function NodeAs(options?: NodeAsOptions): MethodDecorator;
|
|
37
|
+
/**
|
|
38
|
+
* 获取类上所有方法的 Node 元数据
|
|
39
|
+
*/
|
|
40
|
+
export declare function getNodeMetadatas(target: Object): NodeMetadata[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Workflow 装饰器
|
|
3
|
+
*
|
|
4
|
+
* 用于声明一个类为 Workflow 类
|
|
5
|
+
*/
|
|
6
|
+
import 'reflect-metadata';
|
|
7
|
+
import type { WorkflowOptions, WorkflowMetadata } from '../types/decorators-types';
|
|
8
|
+
/**
|
|
9
|
+
* 声明一个类为 Workflow 类
|
|
10
|
+
*
|
|
11
|
+
* @param options - Workflow 配置选项
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* @Workflow({
|
|
16
|
+
* name: 'my-workflow',
|
|
17
|
+
* version: '1.0',
|
|
18
|
+
* entry: 'start'
|
|
19
|
+
* })
|
|
20
|
+
* class MyWorkflow {
|
|
21
|
+
* @NodeAs({ nodeId: 'start' })
|
|
22
|
+
* async start() { }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function Workflow(options: WorkflowOptions): ClassDecorator;
|
|
27
|
+
/**
|
|
28
|
+
* 获取类上的 Workflow 元数据
|
|
29
|
+
*/
|
|
30
|
+
export declare function getWorkflowMetadata(target: Function): WorkflowMetadata | undefined;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type { WorkflowDefinition, NodeDefinition, WorkflowDefinitionExtended, LoopGuardConfig } from '../types';
|
|
2
|
+
import type { EdgeDefinition } from '../types/edge';
|
|
3
|
+
/**
|
|
4
|
+
* DAG Analysis Result
|
|
5
|
+
*/
|
|
6
|
+
export interface DAGAnalysis {
|
|
7
|
+
/** 入口节点(无依赖) */
|
|
8
|
+
entryNodes: string[];
|
|
9
|
+
/** 出口节点(无下游) */
|
|
10
|
+
exitNodes: string[];
|
|
11
|
+
/** 按层级组织的节点,用于并行执行 */
|
|
12
|
+
levels: string[][];
|
|
13
|
+
/** 每个节点的依赖 */
|
|
14
|
+
dependencies: Map<string, string[]>;
|
|
15
|
+
/** 每个节点的下游 */
|
|
16
|
+
dependents: Map<string, string[]>;
|
|
17
|
+
/** 关键路径 */
|
|
18
|
+
criticalPath: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* DAG Manager
|
|
22
|
+
*
|
|
23
|
+
* Manages Directed Acyclic Graph (DAG) operations for workflow execution.
|
|
24
|
+
* Provides analysis, topological sorting, and validation of workflow structures.
|
|
25
|
+
*
|
|
26
|
+
* Supports two modes:
|
|
27
|
+
* - DAG mode (default): enforces acyclic graph, throws on cycles
|
|
28
|
+
* - Loop mode (allowCycles=true): allows cycles for workflow loops
|
|
29
|
+
*/
|
|
30
|
+
export declare class DAGManager {
|
|
31
|
+
private workflow;
|
|
32
|
+
private nodeMap;
|
|
33
|
+
private extendedDefinition;
|
|
34
|
+
private cachedAnalysis;
|
|
35
|
+
/** Allow cycles in the workflow (for loop/cycle support) */
|
|
36
|
+
private allowCycles;
|
|
37
|
+
/**
|
|
38
|
+
* @param workflow - The workflow definition
|
|
39
|
+
* @param options - Options
|
|
40
|
+
* @param options.allowCycles - If true, allows cycles in the workflow (for loop support)
|
|
41
|
+
*/
|
|
42
|
+
constructor(workflow: WorkflowDefinition, options?: {
|
|
43
|
+
allowCycles?: boolean;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Get extended workflow definition with computed properties
|
|
47
|
+
*/
|
|
48
|
+
getExtendedDefinition(): WorkflowDefinitionExtended;
|
|
49
|
+
/**
|
|
50
|
+
* Analyze the DAG structure
|
|
51
|
+
*/
|
|
52
|
+
analyze(): DAGAnalysis;
|
|
53
|
+
/**
|
|
54
|
+
* Build a map of node dependencies
|
|
55
|
+
*/
|
|
56
|
+
private buildDependenciesMap;
|
|
57
|
+
/**
|
|
58
|
+
* Check if 'target' is reachable from 'source' by following existing dependencies (BFS).
|
|
59
|
+
*/
|
|
60
|
+
private isReachable;
|
|
61
|
+
/**
|
|
62
|
+
* Build a map of node dependents (reverse of dependencies)
|
|
63
|
+
*/
|
|
64
|
+
private buildDependentsMap;
|
|
65
|
+
/**
|
|
66
|
+
* Find entry nodes (nodes with no dependencies)
|
|
67
|
+
*/
|
|
68
|
+
private findEntryNodes;
|
|
69
|
+
/**
|
|
70
|
+
* Find exit nodes (nodes with no dependents)
|
|
71
|
+
*/
|
|
72
|
+
private findExitNodes;
|
|
73
|
+
/**
|
|
74
|
+
* Compute levels for parallel execution
|
|
75
|
+
* Nodes at the same level can be executed in parallel
|
|
76
|
+
*/
|
|
77
|
+
private computeLevels;
|
|
78
|
+
/**
|
|
79
|
+
* Find critical path (longest path through the DAG)
|
|
80
|
+
*/
|
|
81
|
+
private findCriticalPath;
|
|
82
|
+
/**
|
|
83
|
+
* Get topological order using Kahn's algorithm
|
|
84
|
+
*/
|
|
85
|
+
getTopologicalOrder(): string[];
|
|
86
|
+
/**
|
|
87
|
+
* Get nodes that are ready to execute (dependencies met and not completed)
|
|
88
|
+
*/
|
|
89
|
+
getReadyNodes(completedNodes: Set<string>): string[];
|
|
90
|
+
/**
|
|
91
|
+
* Check if all dependencies for a node are completed
|
|
92
|
+
* Uses the computed dependency map (which includes edges-derived dependencies)
|
|
93
|
+
*/
|
|
94
|
+
areDependenciesMet(nodeId: string, completedNodes: Set<string>): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Check if the workflow contains a cycle
|
|
97
|
+
*/
|
|
98
|
+
isCyclic(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Internal topological sort that detects cycles
|
|
101
|
+
*/
|
|
102
|
+
private getTopologicalOrderInternal;
|
|
103
|
+
/**
|
|
104
|
+
* Validate the workflow
|
|
105
|
+
* @param options - Validation options
|
|
106
|
+
* @param options.skipCycleCheck - Skip cycle detection (used when allowCycles is enabled)
|
|
107
|
+
*/
|
|
108
|
+
validate(options?: {
|
|
109
|
+
skipCycleCheck?: boolean;
|
|
110
|
+
}): {
|
|
111
|
+
valid: boolean;
|
|
112
|
+
errors: string[];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Add a new node to the workflow dynamically
|
|
116
|
+
*
|
|
117
|
+
* @param node - The node definition to add
|
|
118
|
+
* @throws Error if a node with the same ID already exists
|
|
119
|
+
* @throws Error if the node depends on a non-existent node
|
|
120
|
+
* @throws Error if adding this node would create a cycle
|
|
121
|
+
*/
|
|
122
|
+
addNode(node: NodeDefinition): void;
|
|
123
|
+
/**
|
|
124
|
+
* Remove a node from the workflow dynamically
|
|
125
|
+
*
|
|
126
|
+
* @param nodeId - The ID of the node to remove
|
|
127
|
+
* @throws Error if the node doesn't exist
|
|
128
|
+
* @throws Error if other nodes depend on this node
|
|
129
|
+
*/
|
|
130
|
+
removeNode(nodeId: string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Get direct dependents of a node (nodes that depend on this node)
|
|
133
|
+
*/
|
|
134
|
+
getDependents(nodeId: string): string[];
|
|
135
|
+
/**
|
|
136
|
+
* Get downstream nodes on paths from `fromNodeId` toward `untilNodeId` (inclusive).
|
|
137
|
+
* Used to cascade-reset completed nodes when a back-edge re-enters `fromNodeId`.
|
|
138
|
+
*/
|
|
139
|
+
getDownstreamUntil(fromNodeId: string, untilNodeId: string): string[];
|
|
140
|
+
/**
|
|
141
|
+
* Get the workflow definition (current state)
|
|
142
|
+
*/
|
|
143
|
+
getDefinition(): WorkflowDefinition;
|
|
144
|
+
/**
|
|
145
|
+
* Get a node by ID
|
|
146
|
+
*/
|
|
147
|
+
getNode(nodeId: string): NodeDefinition | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Get the loop_guard config block for a node, or undefined if the node
|
|
150
|
+
* has none. The returned object is the normalized LoopGuardConfig
|
|
151
|
+
* (defaults already applied) that the engine can consume directly.
|
|
152
|
+
*
|
|
153
|
+
* Task #2283 — engine-side back-edge progress guard.
|
|
154
|
+
*
|
|
155
|
+
* Defensive contract: if `config.loop_guard` is missing, malformed, or
|
|
156
|
+
* fails LoopGuardConfigSchema.safeParse, this method returns undefined
|
|
157
|
+
* rather than throwing. Callers can therefore use a simple `if (guard)`
|
|
158
|
+
* check to opt into the guard logic without try/catch.
|
|
159
|
+
*/
|
|
160
|
+
getLoopGuard(nodeId: string): LoopGuardConfig | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Get all node IDs
|
|
163
|
+
*/
|
|
164
|
+
getNodeIds(): string[];
|
|
165
|
+
/**
|
|
166
|
+
* Get the number of nodes in the workflow
|
|
167
|
+
*/
|
|
168
|
+
getNodeCount(): number;
|
|
169
|
+
/**
|
|
170
|
+
* Build explicit edges from nodes with inline condition
|
|
171
|
+
* Also derives implicit edges from depends_on if not already defined
|
|
172
|
+
* @param explicitEdges - Array of explicit edge definitions from workflow
|
|
173
|
+
* @returns Combined array of explicit and derived edges
|
|
174
|
+
*/
|
|
175
|
+
buildEdges(explicitEdges?: EdgeDefinition[]): EdgeDefinition[];
|
|
176
|
+
}
|