@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
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
BackgroundTaskManager,
|
|
4
4
|
createDelegateTool,
|
|
5
5
|
createStopTool
|
|
6
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../../shared/@ai-setting/roy-agent-core-mxdc756a.js";
|
|
7
7
|
import"../../../shared/@ai-setting/roy-agent-core-tbrn9wdm.js";
|
|
8
8
|
import"../../../shared/@ai-setting/roy-agent-core-yhsssn86.js";
|
|
9
9
|
import"../../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
10
|
-
import"../../../shared/@ai-setting/roy-agent-core-
|
|
10
|
+
import"../../../shared/@ai-setting/roy-agent-core-6masakz4.js";
|
|
11
11
|
import"../../../shared/@ai-setting/roy-agent-core-rx16h2m1.js";
|
|
12
12
|
import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
13
13
|
import"../../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-task ProcessRegistry
|
|
3
|
+
*
|
|
4
|
+
* 每个 delegate_task 持有一个 ProcessRegistry,跟踪该 task 派生的子进程 PID。
|
|
5
|
+
* bash 工具 spawn 子进程后立即 register,子进程 `exit` 时立即 unregister。
|
|
6
|
+
* 当 task 超时/stop 时,调用 killAll() 遍历所有剩余 PID,调用 killProcessTree。
|
|
7
|
+
*
|
|
8
|
+
* AsyncLocalStorage 隔离:
|
|
9
|
+
* - runWithProcessRegistryAsync(reg, fn) 把 reg 推到 ALS 栈,进入 fn
|
|
10
|
+
* - getCurrentProcessRegistry() 在 fn 内返回 reg,外部返回 undefined
|
|
11
|
+
* - 这样 bash 工具不感知任务边界,只需要 "我这里有个当前 registry 吗?有就注册"
|
|
12
|
+
*
|
|
13
|
+
* 设计原则:
|
|
14
|
+
* - 不影响非 delegate_task 场景(ALS 拿不到 registry 时 bash 不注册,行为零变化)
|
|
15
|
+
* - 不误杀其他 delegate_task(每个 task 一个独立 registry)
|
|
16
|
+
* - killAll 带验证+重试:每个 PID 最多杀 3 次,间隔 500ms,杀不掉记录 error 日志
|
|
17
|
+
*/
|
|
18
|
+
export declare class ProcessRegistry {
|
|
19
|
+
private readonly pids;
|
|
20
|
+
/**
|
|
21
|
+
* 注册一个 PID 到当前 registry。
|
|
22
|
+
* - 重复 register 同一 PID:幂等
|
|
23
|
+
* - 非正整数 / NaN:静默忽略(避免脏数据)
|
|
24
|
+
*/
|
|
25
|
+
register(pid: number): void;
|
|
26
|
+
/**
|
|
27
|
+
* 反注册一个 PID(子进程 exit 时调用)。
|
|
28
|
+
* 不存在时不报错(幂等)。
|
|
29
|
+
*/
|
|
30
|
+
unregister(pid: number): void;
|
|
31
|
+
/** 当前注册的 PID 数量(测试 + debug 用途) */
|
|
32
|
+
size(): number;
|
|
33
|
+
/**
|
|
34
|
+
* 杀掉所有仍注册在本 registry 的进程树(POSIX 杀进程组 / Windows taskkill /T)。
|
|
35
|
+
*
|
|
36
|
+
* 验证 + 重试机制:
|
|
37
|
+
* - 每次 kill 后等待 500ms,验证进程是否真的被干掉
|
|
38
|
+
* - 没干掉则重试,最多 3 次
|
|
39
|
+
* - 3 次还干不掉:记录 error 日志
|
|
40
|
+
*
|
|
41
|
+
* Task #2245 — BL-4:保留 `stillAlive` PID 以便后续强杀可重试。
|
|
42
|
+
* - 旧实现:成功杀掉的 PID 仍被无差别 `clear()`,与 stillAlive 一起丢失。
|
|
43
|
+
* - 新实现:仅 `delete` 真正被杀死的 PID,stillAlive PID 保留供下次重试。
|
|
44
|
+
* - 调用方(如 forceStopAll)可以多次调用 killAll 重试残留 PID。
|
|
45
|
+
* - 内部不 throw — 单个 PID 的 ESRCH/EPERM 不会阻断其他 PID 的清理。
|
|
46
|
+
*/
|
|
47
|
+
killAll(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 在异步作用域内暴露给定的 ProcessRegistry。
|
|
51
|
+
* 适合用在 executeWithAbort 包裹 env.handle_query 之处。
|
|
52
|
+
*/
|
|
53
|
+
export declare function runWithProcessRegistryAsync<T>(registry: ProcessRegistry, fn: () => Promise<T>): Promise<T>;
|
|
54
|
+
/**
|
|
55
|
+
* 当前 ALS 栈顶的 ProcessRegistry(如果存在)。
|
|
56
|
+
* 在 bash 工具中调用:若返回 undefined 则退化为不注册(保持非 delegate_task 场景的行为)。
|
|
57
|
+
*/
|
|
58
|
+
export declare function getCurrentProcessRegistry(): ProcessRegistry | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview stop_task Tool
|
|
3
|
+
*
|
|
4
|
+
* 基于 agent-core 的 stop_task 实现
|
|
5
|
+
* 参考: packages/core/src/core/environment/expend/task/stop-task-tool.ts
|
|
6
|
+
*
|
|
7
|
+
* 功能:
|
|
8
|
+
* - 停止正在运行的后台任务
|
|
9
|
+
*/
|
|
10
|
+
import type { Tool } from "../../tool/types";
|
|
11
|
+
import type { BackgroundTaskManager } from "./delegate-tool";
|
|
12
|
+
export declare function createStopTool(taskManager: BackgroundTaskManager): Tool;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Subagent resolution — built-in specs + AgentRegistry
|
|
3
|
+
*/
|
|
4
|
+
import { AgentRegistry } from "../../agent/agent-registry";
|
|
5
|
+
import type { SubAgentSpec } from "./delegate-tool";
|
|
6
|
+
export interface ResolvedSubAgentConfig {
|
|
7
|
+
subagentType: string;
|
|
8
|
+
description: string;
|
|
9
|
+
basePrompt: string;
|
|
10
|
+
allowedTools?: string[];
|
|
11
|
+
deniedTools: string[];
|
|
12
|
+
fromRegistry: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function isKnownSubagentType(subagentType: string, registry?: AgentRegistry): boolean;
|
|
15
|
+
export declare function resolveSubAgentConfig(subagentType: string, options?: {
|
|
16
|
+
registry?: AgentRegistry;
|
|
17
|
+
getBuiltIn?: (id: string) => SubAgentSpec | undefined;
|
|
18
|
+
}): Promise<ResolvedSubAgentConfig | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* 获取可用的 subagent 描述列表
|
|
21
|
+
*
|
|
22
|
+
* @param registry AgentRegistry 实例,用于获取自定义 agents
|
|
23
|
+
* @returns 格式化的 agent 描述列表(英文,与 delegate_task tool description 一致)
|
|
24
|
+
*/
|
|
25
|
+
export declare function listKnownSubagentDescriptions(registry?: AgentRegistry): string;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Event Payloads
|
|
3
|
+
*
|
|
4
|
+
* 定义所有 Task 相关事件的 Payload 结构
|
|
5
|
+
*/
|
|
6
|
+
import type { Task, TaskOperation } from "../types";
|
|
7
|
+
/**
|
|
8
|
+
* task.created 事件负载
|
|
9
|
+
*/
|
|
10
|
+
export interface TaskCreatedPayload {
|
|
11
|
+
task: Task;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* task.updated 事件负载
|
|
16
|
+
*/
|
|
17
|
+
export interface TaskUpdatedPayload {
|
|
18
|
+
task: Task;
|
|
19
|
+
changes: Partial<Task>;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* task.completed 事件负载
|
|
24
|
+
*/
|
|
25
|
+
export interface TaskCompletedPayload {
|
|
26
|
+
task: Task;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* task.deleted 事件负载
|
|
31
|
+
*/
|
|
32
|
+
export interface TaskDeletedPayload {
|
|
33
|
+
taskId: number;
|
|
34
|
+
sessionId: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* task.operation_added 事件负载
|
|
38
|
+
*/
|
|
39
|
+
export interface TaskOperationAddedPayload {
|
|
40
|
+
operation: TaskOperation;
|
|
41
|
+
taskId: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* task.delegated 事件负载
|
|
45
|
+
*/
|
|
46
|
+
export interface TaskDelegatedPayload {
|
|
47
|
+
taskId: number;
|
|
48
|
+
backgroundTaskId: string;
|
|
49
|
+
subSessionId: string;
|
|
50
|
+
parentSessionId: string;
|
|
51
|
+
description: string;
|
|
52
|
+
subagentType: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* task.background.started 事件负载
|
|
56
|
+
*/
|
|
57
|
+
export interface BackgroundTaskStartedPayload {
|
|
58
|
+
taskId: string;
|
|
59
|
+
subSessionId: string;
|
|
60
|
+
parentSessionId: string;
|
|
61
|
+
description: string;
|
|
62
|
+
subagentType: string;
|
|
63
|
+
associatedTaskId?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* task.background.progress 事件负载
|
|
67
|
+
*/
|
|
68
|
+
export interface BackgroundTaskProgressPayload {
|
|
69
|
+
taskId: string;
|
|
70
|
+
subSessionId: string;
|
|
71
|
+
parentSessionId: string;
|
|
72
|
+
status: string;
|
|
73
|
+
progress?: number;
|
|
74
|
+
progressMessage?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
subagentType?: string;
|
|
77
|
+
associatedTaskId?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* task.background.completed/failed/timeout/stopped 事件负载
|
|
81
|
+
*/
|
|
82
|
+
export interface BackgroundTaskCompletedPayload {
|
|
83
|
+
taskId: string;
|
|
84
|
+
subSessionId: string;
|
|
85
|
+
parentSessionId: string;
|
|
86
|
+
status: "completed" | "failed" | "timeout" | "stopped";
|
|
87
|
+
result?: string;
|
|
88
|
+
error?: string;
|
|
89
|
+
executionTimeMs: number;
|
|
90
|
+
associatedTaskId?: number;
|
|
91
|
+
description?: string;
|
|
92
|
+
subagentType?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 所有 Task Entity 事件负载的联合类型
|
|
96
|
+
*/
|
|
97
|
+
export type TaskEntityEventPayload = TaskCreatedPayload | TaskUpdatedPayload | TaskCompletedPayload | TaskDeletedPayload | TaskOperationAddedPayload | TaskDelegatedPayload;
|
|
98
|
+
/**
|
|
99
|
+
* 所有 Background Task 事件负载的联合类型
|
|
100
|
+
*/
|
|
101
|
+
export type BackgroundTaskEventPayload = BackgroundTaskStartedPayload | BackgroundTaskProgressPayload | BackgroundTaskCompletedPayload;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Entity Event Types
|
|
3
|
+
*
|
|
4
|
+
* 定义 TaskComponent 相关的 EnvEvent 类型
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Task Entity 事件类型枚举
|
|
8
|
+
*/
|
|
9
|
+
export declare const TaskEntityEventTypes: {
|
|
10
|
+
/** Task 创建 */
|
|
11
|
+
readonly CREATED: "task.created";
|
|
12
|
+
/** Task 更新 */
|
|
13
|
+
readonly UPDATED: "task.updated";
|
|
14
|
+
/** Task 完成 */
|
|
15
|
+
readonly COMPLETED: "task.completed";
|
|
16
|
+
/** Task 删除 */
|
|
17
|
+
readonly DELETED: "task.deleted";
|
|
18
|
+
/** Operation 记录添加 */
|
|
19
|
+
readonly OPERATION_ADDED: "task.operation_added";
|
|
20
|
+
/** Task 被委托 */
|
|
21
|
+
readonly DELEGATED: "task.delegated";
|
|
22
|
+
};
|
|
23
|
+
export type TaskEntityEventType = (typeof TaskEntityEventTypes)[keyof typeof TaskEntityEventTypes];
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Hook Contexts - Hook 上下文类型定义
|
|
3
|
+
*/
|
|
4
|
+
import type { CreateTaskOptions, UpdateTaskOptions, Task, TaskOperation, CreateOperationOptions } from "../types";
|
|
5
|
+
import type { TagService } from "../tag-service";
|
|
6
|
+
import type { DelegateToolResult } from "../delegate/delegate-tool";
|
|
7
|
+
/**
|
|
8
|
+
* Task Create Hook Context
|
|
9
|
+
*
|
|
10
|
+
* 触发时机:createTask() 方法调用后,实际创建前
|
|
11
|
+
*
|
|
12
|
+
* Plugin 可直接修改 options 来干预创建行为
|
|
13
|
+
*/
|
|
14
|
+
export interface TaskCreateContext {
|
|
15
|
+
/** 创建选项(Plugin 可直接修改) */
|
|
16
|
+
options: CreateTaskOptions;
|
|
17
|
+
/** Session ID */
|
|
18
|
+
sessionId: string;
|
|
19
|
+
/** Tag 服务引用 */
|
|
20
|
+
tagService: TagService;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Task Create Result Hook Context
|
|
24
|
+
*
|
|
25
|
+
* 触发时机:Task 创建成功后
|
|
26
|
+
*
|
|
27
|
+
* Plugin 可在此 Hook 中:
|
|
28
|
+
* - 同步 Tag 到数据库
|
|
29
|
+
* - 创建关联资源
|
|
30
|
+
* - 发送通知
|
|
31
|
+
*/
|
|
32
|
+
export interface TaskCreateResultContext {
|
|
33
|
+
/** 创建后的 Task(已包含生成 ID) */
|
|
34
|
+
task: Task;
|
|
35
|
+
/** Session ID */
|
|
36
|
+
sessionId: string;
|
|
37
|
+
/** Tag 服务引用 */
|
|
38
|
+
tagService: TagService;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Task Update Hook Context
|
|
42
|
+
*
|
|
43
|
+
* 触发时机:updateTask() 方法调用后,实际更新前
|
|
44
|
+
*
|
|
45
|
+
* Plugin 可直接修改 options 来干预更新行为
|
|
46
|
+
*/
|
|
47
|
+
export interface TaskUpdateContext {
|
|
48
|
+
/** Task ID */
|
|
49
|
+
id: number;
|
|
50
|
+
/** 更新选项(Plugin 可直接修改) */
|
|
51
|
+
options: UpdateTaskOptions;
|
|
52
|
+
/** Tag 服务引用 */
|
|
53
|
+
tagService: TagService;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Task Update Result Hook Context
|
|
57
|
+
*
|
|
58
|
+
* 触发时机:Task 更新成功后
|
|
59
|
+
*/
|
|
60
|
+
export interface TaskUpdateResultContext {
|
|
61
|
+
/** 更新后的 Task */
|
|
62
|
+
task: Task;
|
|
63
|
+
/** 变更的字段 */
|
|
64
|
+
changes: Partial<UpdateTaskOptions>;
|
|
65
|
+
/** Tag 服务引用 */
|
|
66
|
+
tagService: TagService;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Task Delete Hook Context
|
|
70
|
+
*
|
|
71
|
+
* 触发时机:deleteTask() 方法调用后,实际删除前
|
|
72
|
+
*/
|
|
73
|
+
export interface TaskDeleteContext {
|
|
74
|
+
/** Task ID */
|
|
75
|
+
id: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Task Delete Result Hook Context
|
|
79
|
+
*
|
|
80
|
+
* 触发时机:Task 删除成功后
|
|
81
|
+
*
|
|
82
|
+
* 注意:删除成功后无法获取 Task 的详细信息
|
|
83
|
+
*/
|
|
84
|
+
export interface TaskDeleteResultContext {
|
|
85
|
+
/** 被删除的 Task ID */
|
|
86
|
+
id: number;
|
|
87
|
+
/** 是否成功删除 */
|
|
88
|
+
deleted: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Delegate Before Hook Context
|
|
92
|
+
*
|
|
93
|
+
* 触发时机:delegate_task 工具执行前
|
|
94
|
+
*
|
|
95
|
+
* Plugin 可直接修改 prompt 来注入上下文
|
|
96
|
+
*/
|
|
97
|
+
export interface TaskDelegateContext {
|
|
98
|
+
/** 关联的 Task ID */
|
|
99
|
+
taskId?: number;
|
|
100
|
+
/** 执行提示词(Plugin 可直接修改以注入上下文) */
|
|
101
|
+
prompt: string;
|
|
102
|
+
/** SubAgent 类型 */
|
|
103
|
+
subagentType: string;
|
|
104
|
+
/** 超时时间 */
|
|
105
|
+
timeout?: number;
|
|
106
|
+
/** 清理策略 */
|
|
107
|
+
cleanup?: "delete" | "keep";
|
|
108
|
+
/** 执行原因 */
|
|
109
|
+
reason?: string;
|
|
110
|
+
/** Tag 服务引用 */
|
|
111
|
+
tagService: TagService;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Delegate After Hook Context
|
|
115
|
+
*
|
|
116
|
+
* 触发时机:delegate_task 工具执行后
|
|
117
|
+
*/
|
|
118
|
+
export interface TaskDelegateResultContext {
|
|
119
|
+
/** 关联的 Task ID */
|
|
120
|
+
taskId?: number;
|
|
121
|
+
/** 执行结果 */
|
|
122
|
+
result: DelegateToolResult;
|
|
123
|
+
/** Tag 服务引用 */
|
|
124
|
+
tagService: TagService;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Terminal Status Set — 触发 AFTER_COMPLETE 的 status 集合
|
|
128
|
+
*
|
|
129
|
+
* 仅 `completed` 是用户预期的"任务完成"事件,但 `failed` / `cancelled` /
|
|
130
|
+
* `timeout` 也算 task 终结(不应继续等待结果)。
|
|
131
|
+
*/
|
|
132
|
+
export declare const TASK_COMPLETE_TERMINAL_STATUSES: readonly ["completed", "failed", "cancelled", "timeout"];
|
|
133
|
+
export type TaskCompleteTerminalStatus = typeof TASK_COMPLETE_TERMINAL_STATUSES[number];
|
|
134
|
+
/**
|
|
135
|
+
* Task Complete Result Hook Context
|
|
136
|
+
*
|
|
137
|
+
* 触发时机:task 进入 terminal status (completed / failed / cancelled / timeout)
|
|
138
|
+
*
|
|
139
|
+
* 与 AFTER_UPDATE 的区别:AFTER_UPDATE 在每次 update 后触发,AFTER_COMPLETE 仅在
|
|
140
|
+
* status 进入 terminal 集合内时触发,语义更精确。
|
|
141
|
+
*/
|
|
142
|
+
export interface TaskCompleteResultContext {
|
|
143
|
+
/** Task 更新后的最终状态 */
|
|
144
|
+
task: Task;
|
|
145
|
+
/** 触发完成的 status 变更 (例如 { status: "completed" }) */
|
|
146
|
+
changes: Partial<UpdateTaskOptions>;
|
|
147
|
+
/** 进入的 terminal status */
|
|
148
|
+
terminalStatus: TaskCompleteTerminalStatus;
|
|
149
|
+
/** 触发 session ID (例如发起 complete task 的 agent session) */
|
|
150
|
+
sessionId: string;
|
|
151
|
+
/** Tag 服务引用 */
|
|
152
|
+
tagService: TagService;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Operation Create Hook Context
|
|
156
|
+
*
|
|
157
|
+
* 触发时机:createOperation() 方法调用后,实际创建前
|
|
158
|
+
*
|
|
159
|
+
* Plugin 可直接修改 options 来干预操作记录创建
|
|
160
|
+
*/
|
|
161
|
+
export interface TaskOperationCreateContext {
|
|
162
|
+
/** 创建选项(Plugin 可直接修改) */
|
|
163
|
+
options: CreateOperationOptions;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Operation Create Result Hook Context
|
|
167
|
+
*
|
|
168
|
+
* 触发时机:操作记录创建成功后
|
|
169
|
+
*/
|
|
170
|
+
export interface TaskOperationCreateResultContext {
|
|
171
|
+
/** 创建后的操作记录 */
|
|
172
|
+
operation: TaskOperation;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* TaskHookContextMap - Hook 点与 Context 类型的映射
|
|
176
|
+
*
|
|
177
|
+
* 用于 Hook 执行时类型安全的 Context 获取
|
|
178
|
+
*/
|
|
179
|
+
export interface TaskHookContextMap {
|
|
180
|
+
"task:before.create": TaskCreateContext;
|
|
181
|
+
"task:after.create": TaskCreateResultContext;
|
|
182
|
+
"task:before.update": TaskUpdateContext;
|
|
183
|
+
"task:after.update": TaskUpdateResultContext;
|
|
184
|
+
"task:before.delete": TaskDeleteContext;
|
|
185
|
+
"task:after.delete": TaskDeleteResultContext;
|
|
186
|
+
"task:after.complete": TaskCompleteResultContext;
|
|
187
|
+
"task:delegate:before": TaskDelegateContext;
|
|
188
|
+
"task:delegate:after": TaskDelegateResultContext;
|
|
189
|
+
"task:operation:before.create": TaskOperationCreateContext;
|
|
190
|
+
"task:operation:after.create": TaskOperationCreateResultContext;
|
|
191
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Hooks Module
|
|
3
|
+
*
|
|
4
|
+
* 提供 Task Component 的 Hook 机制
|
|
5
|
+
*/
|
|
6
|
+
export { TaskHookPoints, type TaskHookPoint } from "./task-hook-points";
|
|
7
|
+
export type { TaskCreateContext, TaskCreateResultContext, TaskUpdateContext, TaskUpdateResultContext, TaskDeleteContext, TaskDeleteResultContext, TaskDelegateContext, TaskDelegateResultContext, TaskOperationCreateContext, TaskOperationCreateResultContext, TaskHookContextMap, } from "./contexts";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Hook Points - Hook 点常量定义
|
|
3
|
+
*
|
|
4
|
+
* 定义 Task Component 生命周期中的所有 Hook 点
|
|
5
|
+
*/
|
|
6
|
+
export declare const TaskHookPoints: {
|
|
7
|
+
/** 创建 Task 前 - 可干预 options */
|
|
8
|
+
readonly BEFORE_CREATE: "task:before.create";
|
|
9
|
+
/** 创建 Task 后 - 观察或触发副作用 */
|
|
10
|
+
readonly AFTER_CREATE: "task:after.create";
|
|
11
|
+
/** 更新 Task 前 - 可干预 options */
|
|
12
|
+
readonly BEFORE_UPDATE: "task:before.update";
|
|
13
|
+
/** 更新 Task 后 - 观察变更 */
|
|
14
|
+
readonly AFTER_UPDATE: "task:after.update";
|
|
15
|
+
/** 删除 Task 前 - 观察 */
|
|
16
|
+
readonly BEFORE_DELETE: "task:before.delete";
|
|
17
|
+
/** 删除 Task 后 - 清理关联资源 */
|
|
18
|
+
readonly AFTER_DELETE: "task:after.delete";
|
|
19
|
+
/**
|
|
20
|
+
* Task 完成 hook —— 仅当任务状态变为 terminal (completed / failed / cancelled / timeout)
|
|
21
|
+
* 时触发。语义级别比 AFTER_UPDATE 更精确,plugin 可用于实现"任务完成时"的副作用
|
|
22
|
+
* (例如发送通知、刷新看板、上传结果等)。
|
|
23
|
+
*
|
|
24
|
+
* 注意:AFTER_COMPLETE 与 AFTER_UPDATE 不互斥。
|
|
25
|
+
* - AFTER_UPDATE 在每一次 update 成功后触发,包括 status 变更、progress 变更等
|
|
26
|
+
* - AFTER_COMPLETE 仅在 status 进入 terminal 状态时触发
|
|
27
|
+
* 一个更新操作可能同时触发两个 hook。
|
|
28
|
+
*/
|
|
29
|
+
readonly AFTER_COMPLETE: "task:after.complete";
|
|
30
|
+
/** 委派任务前 - 可干预 prompt、参数 */
|
|
31
|
+
readonly DELEGATE_BEFORE: "task:delegate:before";
|
|
32
|
+
/** 委派任务后 - 观察结果 */
|
|
33
|
+
readonly DELEGATE_AFTER: "task:delegate:after";
|
|
34
|
+
/** 创建操作记录前 - 可干预 options */
|
|
35
|
+
readonly OPERATION_BEFORE_CREATE: "task:operation:before.create";
|
|
36
|
+
/** 创建操作记录后 - 观察或触发副作用 */
|
|
37
|
+
readonly OPERATION_AFTER_CREATE: "task:operation:after.create";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Task Hook 点类型
|
|
41
|
+
*/
|
|
42
|
+
export type TaskHookPoint = typeof TaskHookPoints[keyof typeof TaskHookPoints];
|
package/dist/env/task/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
TaskPriorityEnum,
|
|
6
6
|
TaskStatusEnum,
|
|
7
7
|
TaskTypeEnum
|
|
8
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../shared/@ai-setting/roy-agent-core-e2z1etk4.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
|
|
10
10
|
import {
|
|
11
11
|
SQLiteTaskStore,
|
|
@@ -16,11 +16,11 @@ import"../../shared/@ai-setting/roy-agent-core-rn57psp0.js";
|
|
|
16
16
|
import {
|
|
17
17
|
TaskEntityEventTypes
|
|
18
18
|
} from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
19
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
19
|
+
import"../../shared/@ai-setting/roy-agent-core-mxdc756a.js";
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-tbrn9wdm.js";
|
|
21
21
|
import"../../shared/@ai-setting/roy-agent-core-yhsssn86.js";
|
|
22
22
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
23
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
23
|
+
import"../../shared/@ai-setting/roy-agent-core-6masakz4.js";
|
|
24
24
|
import"../../shared/@ai-setting/roy-agent-core-rx16h2m1.js";
|
|
25
25
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
26
26
|
import"../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview AutoTaskPlugin v5.2 — uses shared meta-protocol helper
|
|
3
|
+
*
|
|
4
|
+
* 在 ReAct 循环达到 iteration 阈值(默认 20)时,在 agent:after.tool hook 中:
|
|
5
|
+
* 1. 检测 iteration === threshold && agent.name === agentName
|
|
6
|
+
* 2. per-query 去重(通过 traceId)
|
|
7
|
+
* 3. 调用 `enqueueToAddFakeUserMessage(ctx.toolResult, msg, "delegate")`:
|
|
8
|
+
* 设置 hookCtx.toolResult.result.metadata.toAddFakeUserMessage = {role:"user", ...}
|
|
9
|
+
* 与 MaxIterReminderPlugin 共享同一字段,确定性合并
|
|
10
|
+
* 4. React 循环在 pushMessage(tool result) 之后读取此 metadata 并 push user message
|
|
11
|
+
* 5. 保证 messages 顺序:[assistant(tool_calls), tool(result), user(reminder)] ✅
|
|
12
|
+
* 满足 AI SDK 要求 tool_call 与 tool_result 必须相邻
|
|
13
|
+
*
|
|
14
|
+
* v5.2 相比 v5.1 的核心改进(Task #2580 round 2):
|
|
15
|
+
* - ✅ 不再直接设置 `metadata.toAddFakeUserMessage = msg`(可能覆盖其他 plugin)
|
|
16
|
+
* - ✅ 改用共享 helper `enqueueToAddFakeUserMessage`,确定性合并多个 reminder
|
|
17
|
+
* - ✅ 在同一边界(如 threshold === maxIter-1)与 MaxIterReminderPlugin 协同工作
|
|
18
|
+
*/
|
|
19
|
+
import type { Plugin } from "../../agent/types";
|
|
20
|
+
export interface AutoTaskPluginConfig {
|
|
21
|
+
/**
|
|
22
|
+
* ReAct iteration 阈值(达到该 iteration 时触发提醒;默认 20)
|
|
23
|
+
*
|
|
24
|
+
* 如果你的场景是「永不提醒」,请传 `threshold: Infinity`(或在注册时关闭插件)。
|
|
25
|
+
*/
|
|
26
|
+
threshold?: number;
|
|
27
|
+
/** 仅在该 agent name 下触发(默认 "default") */
|
|
28
|
+
agentName?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 创建 AutoTaskPlugin v5.2
|
|
32
|
+
*
|
|
33
|
+
* 在 agent:after.tool hook 中,检测 iteration 达到阈值时:
|
|
34
|
+
* 1. 通过共享 helper 设置 hookCtx.toolResult.result.metadata.toAddFakeUserMessage
|
|
35
|
+
* 2. React 循环在 pushMessage(tool result) 之后读取此 metadata 并 push user message
|
|
36
|
+
* 3. 下一轮 LLM 调用会看到 user reminder,agent 自主决定调用 delegate_task
|
|
37
|
+
*/
|
|
38
|
+
export declare function createAutoTaskPlugin(config?: AutoTaskPluginConfig): Plugin;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 任务卡片「该发到哪个群」的路由决策(Task #4230 / #4394)
|
|
3
|
+
*
|
|
4
|
+
* ## 现行规则(用户 2026-10-20 明令,Task #4394)
|
|
5
|
+
*
|
|
6
|
+
* > 去掉专属群卡片逻辑,只保留**触发群的进度卡片**(可用户点击建群)
|
|
7
|
+
*
|
|
8
|
+
* 决策优先级:
|
|
9
|
+
* 1. **有触发群 → 就用触发群**。无条件,不判断它是不是"别的 task 的专属群"。
|
|
10
|
+
* 2. 没有触发群 → 用本 task(其次最近祖先)自己已有的专属群兜底(卡片不能丢)。
|
|
11
|
+
* 3. 两者都没有 → `none`(调用方静默 skip)。
|
|
12
|
+
*
|
|
13
|
+
* ## 已删除的历史逻辑(Task #4394)
|
|
14
|
+
*
|
|
15
|
+
* 旧实现(Task #4230)会在"触发群被判定为别的 task 的专属群"时把卡片**改投**到
|
|
16
|
+
* 本 task / 祖先的 lineage 群,并在触发群补一张「📂 任务卡片已改投专属群 /
|
|
17
|
+
* 这里不是本任务的群,进展请看专属群」的指路卡。
|
|
18
|
+
*
|
|
19
|
+
* 用户实测(Task #4393)该行为是干扰:
|
|
20
|
+
* ```
|
|
21
|
+
* 触发群 oc_8947d9e2…(task 4377 的专属群)
|
|
22
|
+
* → 卡片被改投到 oc_d27157ac…(lineage 群)
|
|
23
|
+
* → 用户在触发群只看到一张"这里不是本任务的群"的灰卡
|
|
24
|
+
* ```
|
|
25
|
+
* 用户的诉求是「在哪聊就在哪看到进展」。**跨任务污染不再是需要解决的问题**,
|
|
26
|
+
* 因此整套「专属群归属判定 + 改投 + 指路卡」链路已彻底删除:
|
|
27
|
+
* - 删除 `ChatOwnership` / `mergeChatOwnership` / `analyzeContextOwnership`
|
|
28
|
+
* - 删除 `CardChatDecision.reroutedFrom`
|
|
29
|
+
* - 删除 `new-group` / `fallback-to-trigger` 两种 source(不再自动建群)
|
|
30
|
+
*
|
|
31
|
+
* ## 建群能力仍在(**用户主动点击**才建)
|
|
32
|
+
*
|
|
33
|
+
* 卡片顶部按钮 `create_group` / `disband_group` 由
|
|
34
|
+
* `lark-card-action-handler.ts` 处理,与本文档的路由决策**完全解耦**:
|
|
35
|
+
* ```
|
|
36
|
+
* 用户点「为这个任务建群」
|
|
37
|
+
* → card.action.trigger 事件
|
|
38
|
+
* → handleCardAction → ports.createGroupChat (lark-cli im +chat-create)
|
|
39
|
+
* → 回写 task.context.larkPerTaskChatId
|
|
40
|
+
* → patch 卡片(按钮翻成「解散该群」+ 出现「进入专属群」链接)
|
|
41
|
+
* ```
|
|
42
|
+
* 建群后下一张进度卡会走本文件的优先级 1(仍进触发群),
|
|
43
|
+
* 但卡片上多了「进入专属群」链接 —— 这是用户可选的入口,不是自动改投。
|
|
44
|
+
*
|
|
45
|
+
* 本模块是**纯函数**(不碰 IO),便于单测覆盖所有分支。
|
|
46
|
+
*/
|
|
47
|
+
/** 群名里隐含的 task id("Task 3999 - xxx" / "#3999 TMO 提取跟进") */
|
|
48
|
+
export declare const GROUP_NAME_TASK_ID_RE: RegExp;
|
|
49
|
+
/** 会把 chatId 记进 context 的字段名(用于 DB LIKE 反查) */
|
|
50
|
+
export declare const CTX_FIELD_LARK_PER_TASK_CHAT_ID = "larkPerTaskChatId";
|
|
51
|
+
export type CardChatSource = "trigger-chat" | "own-group" | "ancestor-group" | "none";
|
|
52
|
+
export interface CardChatDecision {
|
|
53
|
+
chatId?: string;
|
|
54
|
+
profile?: string;
|
|
55
|
+
/** 目标群名(诊断用) */
|
|
56
|
+
chatName?: string;
|
|
57
|
+
source: CardChatSource;
|
|
58
|
+
/** 人类可读的决策原因(写进 span / debug 日志) */
|
|
59
|
+
reason: string;
|
|
60
|
+
}
|
|
61
|
+
/** 从 task.context JSON 解析专属群 id(larkPerTaskChatId) */
|
|
62
|
+
export declare function extractPerTaskChatId(contextStr?: string): string | undefined;
|
|
63
|
+
/** 从 task.context JSON 解析专属群名(larkPerTaskChatName) */
|
|
64
|
+
export declare function extractPerTaskChatName(contextStr?: string): string | undefined;
|
|
65
|
+
/** 从 task.context JSON 解析专属群 profile(larkPerTaskChatProfile) */
|
|
66
|
+
export declare function extractPerTaskChatProfile(contextStr?: string): string | undefined;
|
|
67
|
+
/** 从 task.context JSON 解析记录下来的群名(含 `#3999` / `Task 3999` 模式) */
|
|
68
|
+
export declare function extractRecordedChatNames(contextStr?: string): string[];
|
|
69
|
+
/**
|
|
70
|
+
* 决定卡片该发到哪个群(Task #4394 简化版)
|
|
71
|
+
*
|
|
72
|
+
* 规则只有两条:
|
|
73
|
+
* 1. **有触发群 → 触发群**(无条件,不做任何"是不是别人的群"判定)
|
|
74
|
+
* 2. 没触发群 → 用本 task / 祖先已有的专属群兜底
|
|
75
|
+
*
|
|
76
|
+
* @param input.lineageChat lineage 上找到的专属群(自己优先,其次最近祖先)
|
|
77
|
+
*/
|
|
78
|
+
export declare function decideCardChatTarget(input: {
|
|
79
|
+
taskId?: number;
|
|
80
|
+
lineageIds?: number[];
|
|
81
|
+
lineageChat?: {
|
|
82
|
+
chatId: string;
|
|
83
|
+
profile?: string;
|
|
84
|
+
isSelf: boolean;
|
|
85
|
+
};
|
|
86
|
+
triggerChatId?: string;
|
|
87
|
+
triggerProfile?: string;
|
|
88
|
+
}): CardChatDecision;
|