@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,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Component
|
|
3
|
+
*
|
|
4
|
+
* Component for managing task lifecycle including:
|
|
5
|
+
* - Task CRUD operations
|
|
6
|
+
* - Operation record management
|
|
7
|
+
* - Tool registration
|
|
8
|
+
*/
|
|
9
|
+
import { BaseComponent, type ComponentConfig } from "../component";
|
|
10
|
+
import { type TaskConfig, type Task, type TaskOperation, type CreateTaskOptions, type UpdateTaskOptions, type ListTasksOptions, type CreateOperationOptions, type ListOperationsOptions, type TaskListResult, type SearchTasksOptions } from "./types";
|
|
11
|
+
import { BackgroundTaskManager } from "./delegate";
|
|
12
|
+
import type { ConfigComponent } from "../../config/config-component";
|
|
13
|
+
import { type TagService } from "./tag-service";
|
|
14
|
+
import type { Hook } from "../hook/types";
|
|
15
|
+
/**
|
|
16
|
+
* Task #2778 v2: deliverable 在 operation 行的统一格式
|
|
17
|
+
* 同时用于 task.context.deliverable_storage_path 字段和 operation.milestoneDescription 描述。
|
|
18
|
+
* 调用方在 op 列表 / task 列表里都看到一致的 "Deliverable: <path>" 字符串。
|
|
19
|
+
*/
|
|
20
|
+
export declare const DELIVERABLE_OPERATION_PREFIX = "Deliverable: ";
|
|
21
|
+
/**
|
|
22
|
+
* 把 deliverable 路径格式化成 operation.milestoneDescription。
|
|
23
|
+
* - 有 path:返回 "Deliverable: <path>"
|
|
24
|
+
* - 无 path:返回 undefined(避免误写 "Deliverable: undefined")
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatDeliverableForOperation(deliverableStoragePath: string | undefined): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* TaskComponent 配置选项(通过 options 传递)
|
|
29
|
+
*
|
|
30
|
+
* 配置加载顺序(优先级从低到高):
|
|
31
|
+
* 1. File - 配置文件(通过 configPath 指定)
|
|
32
|
+
* 2. Env - 环境变量(通过 envPrefix 配置前缀)
|
|
33
|
+
* 3. Object - 直接传入的 config 对象(最高优先级)
|
|
34
|
+
*/
|
|
35
|
+
export interface TaskComponentOptions {
|
|
36
|
+
/** ConfigComponent 实例(必填) */
|
|
37
|
+
configComponent: ConfigComponent;
|
|
38
|
+
/** 配置文件相对路径(可选,基于 XDG_DATA_HOME) */
|
|
39
|
+
configPath?: string;
|
|
40
|
+
/** 环境变量前缀(可选,默认 "TASK") */
|
|
41
|
+
envPrefix?: string;
|
|
42
|
+
/** 直接传入的配置对象(可选,优先级最高) */
|
|
43
|
+
config?: Partial<TaskConfig>;
|
|
44
|
+
}
|
|
45
|
+
export declare class TaskComponent extends BaseComponent {
|
|
46
|
+
name: string;
|
|
47
|
+
version: string;
|
|
48
|
+
private store;
|
|
49
|
+
private config?;
|
|
50
|
+
private toolComponent?;
|
|
51
|
+
private backgroundTaskManager?;
|
|
52
|
+
private configComponent?;
|
|
53
|
+
private tagService;
|
|
54
|
+
private plugins;
|
|
55
|
+
/**
|
|
56
|
+
* Task #2245 — Codex P1-4: public typed accessor for `backgroundTaskManager`.
|
|
57
|
+
*
|
|
58
|
+
* Replaces the previous `as any` cast pattern (session-tree-stopper.ts)
|
|
59
|
+
* that accessed the private field directly. Returns undefined if the
|
|
60
|
+
* BackgroundTaskManager has not been initialized yet (init pending)
|
|
61
|
+
* or has been disposed.
|
|
62
|
+
*/
|
|
63
|
+
getBackgroundTaskManager(): BackgroundTaskManager | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* 发布 EnvEvent
|
|
66
|
+
*/
|
|
67
|
+
private publishEvent;
|
|
68
|
+
constructor();
|
|
69
|
+
/**
|
|
70
|
+
* Initialize the component
|
|
71
|
+
*
|
|
72
|
+
* 配置加载优先级(从高到低):
|
|
73
|
+
* 1. Object - 直接传入的 config 对象
|
|
74
|
+
* 2. Env - 环境变量(通过 envPrefix 配置前缀)
|
|
75
|
+
* 3. File - 配置文件(通过 configPath 指定)
|
|
76
|
+
*/
|
|
77
|
+
init(config?: ComponentConfig): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* 注册配置到 ConfigComponent
|
|
80
|
+
*
|
|
81
|
+
* 配置加载顺序(优先级从低到高):
|
|
82
|
+
* 1. Defaults - 默认值(最低)
|
|
83
|
+
* 2. FileSource - 从配置文件加载
|
|
84
|
+
* 3. EnvSource - 从环境变量加载
|
|
85
|
+
* 4. config 对象 - 直接传入的配置(最高)
|
|
86
|
+
*/
|
|
87
|
+
private registerConfig;
|
|
88
|
+
/**
|
|
89
|
+
* 根据配置初始化 store
|
|
90
|
+
*/
|
|
91
|
+
private initStore;
|
|
92
|
+
/**
|
|
93
|
+
* 将配置对象展平为点号路径
|
|
94
|
+
*/
|
|
95
|
+
private flattenConfig;
|
|
96
|
+
/**
|
|
97
|
+
* 注册配置热更新监听
|
|
98
|
+
*/
|
|
99
|
+
private registerConfigWatcher;
|
|
100
|
+
/**
|
|
101
|
+
* 处理配置变更
|
|
102
|
+
*/
|
|
103
|
+
protected onConfigChange(event: {
|
|
104
|
+
key: string;
|
|
105
|
+
oldValue?: unknown;
|
|
106
|
+
newValue?: unknown;
|
|
107
|
+
}): void;
|
|
108
|
+
/** 配置变更 watcher 清理函数 */
|
|
109
|
+
private configWatcher?;
|
|
110
|
+
/**
|
|
111
|
+
* Start the component - register tools
|
|
112
|
+
*/
|
|
113
|
+
start(): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Stop the component
|
|
116
|
+
*/
|
|
117
|
+
stop(): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Register task tools to ToolComponent
|
|
120
|
+
*/
|
|
121
|
+
private registerTools;
|
|
122
|
+
/**
|
|
123
|
+
* 执行 Hook
|
|
124
|
+
*/
|
|
125
|
+
private executeHook;
|
|
126
|
+
/**
|
|
127
|
+
* Create a new task
|
|
128
|
+
*/
|
|
129
|
+
createTask(options: CreateTaskOptions): Promise<Task>;
|
|
130
|
+
/**
|
|
131
|
+
* Get task by ID
|
|
132
|
+
*/
|
|
133
|
+
getTask(id: number): Promise<Task | undefined>;
|
|
134
|
+
/**
|
|
135
|
+
* 按 session_id 反查该 session 创建的第一个 task(sub-session → task 确定性映射)。
|
|
136
|
+
*/
|
|
137
|
+
getTaskIdBySessionId(sessionId: string): Promise<number | undefined>;
|
|
138
|
+
/**
|
|
139
|
+
* Get task with operations
|
|
140
|
+
*/
|
|
141
|
+
getTaskWithOperations(id: number): Promise<{
|
|
142
|
+
task: Task;
|
|
143
|
+
operations: TaskOperation[];
|
|
144
|
+
} | undefined>;
|
|
145
|
+
/**
|
|
146
|
+
* Update task
|
|
147
|
+
*/
|
|
148
|
+
updateTask(id: number, options: UpdateTaskOptions): Promise<Task | undefined>;
|
|
149
|
+
/**
|
|
150
|
+
* Delete task
|
|
151
|
+
*/
|
|
152
|
+
deleteTask(id: number): Promise<boolean>;
|
|
153
|
+
/**
|
|
154
|
+
* List tasks
|
|
155
|
+
*
|
|
156
|
+
* @returns `{ tasks, total }` where `total` is the count before pagination.
|
|
157
|
+
*/
|
|
158
|
+
listTasks(options?: ListTasksOptions): Promise<TaskListResult>;
|
|
159
|
+
/**
|
|
160
|
+
* Search tasks by keywords
|
|
161
|
+
*
|
|
162
|
+
* Searches across title, description, goals, tags, and operation records.
|
|
163
|
+
* Returns `{ tasks, total }` for pagination.
|
|
164
|
+
*/
|
|
165
|
+
searchTasksByKeywords(keywords: string[], options?: SearchTasksOptions): Promise<TaskListResult>;
|
|
166
|
+
/**
|
|
167
|
+
* Get task tree (subtree) starting from the given task
|
|
168
|
+
*
|
|
169
|
+
* @param taskId 起始任务 ID
|
|
170
|
+
* @param depth 层级深度,-1 表示无限层级(默认)
|
|
171
|
+
* @returns 所有后代任务的扁平列表(不含 taskId 本身)
|
|
172
|
+
*/
|
|
173
|
+
getTaskTree(taskId: number, depth?: number): Promise<Task[]>;
|
|
174
|
+
/**
|
|
175
|
+
* Get direct children of a task (one level)
|
|
176
|
+
*/
|
|
177
|
+
getChildTasks(taskId: number, options?: ListTasksOptions): Promise<TaskListResult>;
|
|
178
|
+
/**
|
|
179
|
+
* Complete task
|
|
180
|
+
*
|
|
181
|
+
* Task #2778: 新增 deliverableStoragePath 可选参数,调用方传入实际交付物寻址地址,
|
|
182
|
+
* 会被持久化到 task.context.deliverable_storage_path。
|
|
183
|
+
*
|
|
184
|
+
* Task #2778 v2: 同时把 deliverable 写入 task_operation.milestoneDescription(双写),
|
|
185
|
+
* 便于从 operation 列表直接看到交付物地址,无需查 context 字段。
|
|
186
|
+
*
|
|
187
|
+
* @param id 任务 ID
|
|
188
|
+
* @param sessionId 当前 session ID
|
|
189
|
+
* @param deliverableStoragePath 可选,交付物寻址地址(URL / 路径 / 分支名)
|
|
190
|
+
* @returns 更新后的 Task 或 undefined
|
|
191
|
+
*/
|
|
192
|
+
completeTask(id: number, sessionId: string, deliverableStoragePath?: string): Promise<Task | undefined>;
|
|
193
|
+
/**
|
|
194
|
+
* Create operation record
|
|
195
|
+
*/
|
|
196
|
+
createOperation(options: CreateOperationOptions): Promise<TaskOperation>;
|
|
197
|
+
/**
|
|
198
|
+
* Get operation by ID
|
|
199
|
+
*/
|
|
200
|
+
getOperation(id: number): Promise<TaskOperation | undefined>;
|
|
201
|
+
/**
|
|
202
|
+
* Update operation
|
|
203
|
+
*/
|
|
204
|
+
updateOperation(id: number, updates: {
|
|
205
|
+
milestoneTitle?: string;
|
|
206
|
+
milestoneDescription?: string;
|
|
207
|
+
processDescription?: string;
|
|
208
|
+
actionTitle?: string;
|
|
209
|
+
actionDescription?: string;
|
|
210
|
+
}): Promise<TaskOperation | undefined>;
|
|
211
|
+
/**
|
|
212
|
+
* Delete operation
|
|
213
|
+
*/
|
|
214
|
+
deleteOperation(id: number): Promise<boolean>;
|
|
215
|
+
/**
|
|
216
|
+
* List operations for a task
|
|
217
|
+
*/
|
|
218
|
+
listOperations(options: ListOperationsOptions): Promise<TaskOperation[]>;
|
|
219
|
+
/**
|
|
220
|
+
* 获取 TagService
|
|
221
|
+
*/
|
|
222
|
+
getTagService(): TagService;
|
|
223
|
+
/**
|
|
224
|
+
* 注册 Hook(推荐方式)
|
|
225
|
+
*
|
|
226
|
+
* 直接注册 Hook 到 globalHookManager,无需通过 TaskPlugin
|
|
227
|
+
*
|
|
228
|
+
* @param hookPoint Hook 点(如 "task:after.create")
|
|
229
|
+
* @param hook Hook 对象
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* // 直接注册 Hook
|
|
234
|
+
* taskComponent.registerHook("task:after.create", {
|
|
235
|
+
* name: "my-notify",
|
|
236
|
+
* priority: 5,
|
|
237
|
+
* pluginName: "my-notify", // 用于 pluginEnabled 检查
|
|
238
|
+
* sourceId: "lark-cli", // 用于 pluginEnabled 检查
|
|
239
|
+
* execute: async (ctx) => {
|
|
240
|
+
* const env = getEnvContextOrEmpty();
|
|
241
|
+
* // ...
|
|
242
|
+
* },
|
|
243
|
+
* });
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
registerHook(hookPoint: string, hook: Hook): void;
|
|
247
|
+
/**
|
|
248
|
+
* 注册多个 Hook
|
|
249
|
+
*/
|
|
250
|
+
registerHooks(hooks: Array<{
|
|
251
|
+
hookPoint: string;
|
|
252
|
+
hook: Hook;
|
|
253
|
+
}>): void;
|
|
254
|
+
/**
|
|
255
|
+
* 注销 Hook(通过 name)
|
|
256
|
+
*/
|
|
257
|
+
unregisterHook(hookPoint: string, hookName: string): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* 获取所有注册的 Hook
|
|
260
|
+
*/
|
|
261
|
+
listHooks(): Hook[];
|
|
262
|
+
/**
|
|
263
|
+
* 同一个 hook.name 可能挂在不同 hookPoint,复合 key 避免相互覆盖
|
|
264
|
+
*/
|
|
265
|
+
private makePluginKey;
|
|
266
|
+
/**
|
|
267
|
+
* 获取指定 hook 点的 Hook 数量
|
|
268
|
+
*/
|
|
269
|
+
countHooks(hookPoint: string): number;
|
|
270
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Component 配置注册
|
|
3
|
+
*
|
|
4
|
+
* 使用 ConfigComponent.registerComponent() 机制统一管理配置
|
|
5
|
+
*/
|
|
6
|
+
import type { ComponentRegistration } from "../../config/config-component";
|
|
7
|
+
/**
|
|
8
|
+
* Task Component 默认配置值
|
|
9
|
+
*
|
|
10
|
+
* 注意:键使用完整格式(带 "task." 前缀),在 registerConfig 中手动设置
|
|
11
|
+
* 注意:dbPath 的默认值由 SQLiteTaskStore 决定,放在这里是为了让 show-config 能显示
|
|
12
|
+
*/
|
|
13
|
+
export declare const TASK_DEFAULTS: Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Task Component 配置注册常量
|
|
16
|
+
*
|
|
17
|
+
* 定义了所有 Task 相关的配置项和来源
|
|
18
|
+
*/
|
|
19
|
+
export declare const TASK_CONFIG_REGISTRATION: ComponentRegistration;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview TaskCreationRegistry — In-process bounded index of recently
|
|
3
|
+
* created/updated tasks with sanitization, LRU eviction and TTL.
|
|
4
|
+
*
|
|
5
|
+
* The registry is **observation only** — it never writes back to TaskComponent
|
|
6
|
+
* and never deletes/merges tasks. It powers:
|
|
7
|
+
*
|
|
8
|
+
* 1. The "reuse candidate" prompt section injected into sub-agent prompts
|
|
9
|
+
* (see task-reuse-context.ts). The section lists recent candidate tasks so
|
|
10
|
+
* the sub-agent can decide to reuse instead of creating a new Task.
|
|
11
|
+
*
|
|
12
|
+
* 2. Programmatic queries from hooks / debug tools.
|
|
13
|
+
*
|
|
14
|
+
* Design choices (see docs/design/task-reuse-context.md):
|
|
15
|
+
* - **In-process**: hook events fire at runtime; DB fallback is opt-in and
|
|
16
|
+
* intentionally not implemented in MVP. The registry is a "hot path" index.
|
|
17
|
+
* - **LRU + TTL**: maxEntries caps memory; ttlMs drops stale entries from
|
|
18
|
+
* `recent()` (note: TTL only affects queries, not storage, to keep
|
|
19
|
+
* behavior predictable for tests).
|
|
20
|
+
* - **Sanitization**: secrets are redacted before storage so they never leak
|
|
21
|
+
* into a prompt even by accident.
|
|
22
|
+
*
|
|
23
|
+
* Backward compatibility: zero — this is a new module. Caller code
|
|
24
|
+
* (delegate-tool.ts, prompts-index.ts) is updated in subsequent commits.
|
|
25
|
+
*/
|
|
26
|
+
import type { Task, TaskStatus, TaskPriority, TaskType } from "./types";
|
|
27
|
+
/**
|
|
28
|
+
* Provenance info for a task record. Captures which session / bg task /
|
|
29
|
+
* sub-agent type created the task so we can scope "recent" queries.
|
|
30
|
+
*/
|
|
31
|
+
export interface TaskRecordSource {
|
|
32
|
+
/** sessionId under which task_create was invoked (TaskComponent.createTask) */
|
|
33
|
+
sessionId?: string;
|
|
34
|
+
/** parent session id from sessions table (sub-session → main session) */
|
|
35
|
+
parentSessionId?: string;
|
|
36
|
+
/** BackgroundTaskManager task id (process_<ts>_<rand>) if applicable */
|
|
37
|
+
bgTaskId?: string;
|
|
38
|
+
/** Sub-agent type that triggered the task creation (roy / workflow-runner / ...) */
|
|
39
|
+
subagentType?: string;
|
|
40
|
+
/** OS process.pid (Node) of the host process at record time */
|
|
41
|
+
processId?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface TaskRecord {
|
|
44
|
+
taskId: number;
|
|
45
|
+
title: string;
|
|
46
|
+
/** Sanitized + truncated description (never raw user input). */
|
|
47
|
+
description: string;
|
|
48
|
+
/** Sanitized + truncated goals (never raw user input). */
|
|
49
|
+
goals: string;
|
|
50
|
+
tags: string[];
|
|
51
|
+
status: TaskStatus;
|
|
52
|
+
priority: TaskPriority;
|
|
53
|
+
type: TaskType;
|
|
54
|
+
parentTaskId?: number;
|
|
55
|
+
source: TaskRecordSource;
|
|
56
|
+
/** ISO 8601 */
|
|
57
|
+
createdAt: string;
|
|
58
|
+
/** ISO 8601 — bumped on update() / refresh() */
|
|
59
|
+
updatedAt: string;
|
|
60
|
+
/** Approximate operation count for tie-breaking in sort */
|
|
61
|
+
operationCount: number;
|
|
62
|
+
/** Task #2395: cached from task.project_path */
|
|
63
|
+
project_path?: string;
|
|
64
|
+
/** Task #2395: cached from task.context JSON */
|
|
65
|
+
branch?: string;
|
|
66
|
+
/** Task #2395: cached from task.context JSON */
|
|
67
|
+
worktree_path?: string;
|
|
68
|
+
/** Task #2395: cached from task.context JSON */
|
|
69
|
+
parentBranch?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Task #2395: cached parent context object with sensitive fields stripped
|
|
72
|
+
* (e.g. prior_context.commit). Stored only for delegation hints.
|
|
73
|
+
*/
|
|
74
|
+
context?: Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
export interface RecentQueryOptions {
|
|
77
|
+
scope?: {
|
|
78
|
+
sessionId?: string;
|
|
79
|
+
parentSessionId?: string;
|
|
80
|
+
subagentType?: string;
|
|
81
|
+
};
|
|
82
|
+
/** Default: 10 */
|
|
83
|
+
limit?: number;
|
|
84
|
+
/** Default: all non-archived */
|
|
85
|
+
statuses?: TaskStatus[];
|
|
86
|
+
/** IDs to omit (e.g. similar_task_ids) so we don't show duplicates. */
|
|
87
|
+
excludeIds?: number[];
|
|
88
|
+
/** Exclude the subtree rooted at this task id (the task itself + all descendants). */
|
|
89
|
+
excludeAncestorOf?: number;
|
|
90
|
+
/** Task #2395: Exclude this id + its descendants (alias for clearer call-site intent). */
|
|
91
|
+
excludeSelfOrDescendant?: number;
|
|
92
|
+
/** Only return records updated within this window (hours). */
|
|
93
|
+
sinceHours?: number;
|
|
94
|
+
/** Task #2395: Promote candidates whose subtree contains an active child. */
|
|
95
|
+
activeChildFirst?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Task #2395 — Subtree summary used by the reuse-candidate prompt to show
|
|
99
|
+
* `Children: N (active: M, completed: K)` per parent.
|
|
100
|
+
*/
|
|
101
|
+
export interface SubtreeSummary {
|
|
102
|
+
descendantCount: number;
|
|
103
|
+
activeCount: number;
|
|
104
|
+
completedCount: number;
|
|
105
|
+
/** Furthest descendant depth from the root (1 = direct child). 0 when empty. */
|
|
106
|
+
maxDepth: number;
|
|
107
|
+
}
|
|
108
|
+
export interface SubtreeSummaryOptions {
|
|
109
|
+
/** Include archived descendants. Default false (matches recent() default). */
|
|
110
|
+
includeArchived?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface TaskCreationRegistryConfig {
|
|
113
|
+
/** Hard cap on entries; oldest are evicted (LRU) once exceeded. Default: 500 */
|
|
114
|
+
maxEntries?: number;
|
|
115
|
+
/** TTL in ms; entries older than this are skipped by `recent()`. Default: 24h */
|
|
116
|
+
ttlMs?: number;
|
|
117
|
+
/** Max chars for description / goals. Default: 240 */
|
|
118
|
+
maxDescriptionChars?: number;
|
|
119
|
+
}
|
|
120
|
+
export declare class TaskCreationRegistry {
|
|
121
|
+
private readonly maxEntries;
|
|
122
|
+
private readonly ttlMs;
|
|
123
|
+
private readonly maxDescriptionChars;
|
|
124
|
+
/** Map preserves insertion order; we re-insert on update() for LRU. */
|
|
125
|
+
private readonly records;
|
|
126
|
+
/** parent_task_id → list of child taskIds, for excludeAncestorOf traversal */
|
|
127
|
+
private readonly childrenIndex;
|
|
128
|
+
constructor(config?: TaskCreationRegistryConfig);
|
|
129
|
+
/**
|
|
130
|
+
* Insert (or upsert) a task record. Safe to call on existing id — overwrites.
|
|
131
|
+
* Auto-tracks parent/child relationships for excludeAncestorOf.
|
|
132
|
+
*/
|
|
133
|
+
record(task: Task, source?: TaskRecordSource): TaskRecord;
|
|
134
|
+
/**
|
|
135
|
+
* Mutate an existing record. If the id is unknown, returns undefined
|
|
136
|
+
* (callers can choose to follow up with record() if they want upsert
|
|
137
|
+
* semantics — but the standard contract is "update only existing").
|
|
138
|
+
*/
|
|
139
|
+
update(task: Task, source?: TaskRecordSource): TaskRecord | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Remove a record. No-op if id is unknown.
|
|
142
|
+
*/
|
|
143
|
+
remove(id: number): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Get a record by id. Returns undefined if the entry has expired
|
|
146
|
+
* (TTL) so callers don't accidentally resurrect stale state.
|
|
147
|
+
*/
|
|
148
|
+
getById(id: number): TaskRecord | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Like getById but ignores TTL — useful for tests / debugging.
|
|
151
|
+
*/
|
|
152
|
+
peekById(id: number): TaskRecord | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Clear all records. Mainly for tests.
|
|
155
|
+
*/
|
|
156
|
+
clear(): void;
|
|
157
|
+
/** Total stored records (ignores TTL). Useful for tests/debugging. */
|
|
158
|
+
size(): number;
|
|
159
|
+
recent(options?: RecentQueryOptions): TaskRecord[];
|
|
160
|
+
/**
|
|
161
|
+
* Task #2395: Subtree summary used by the reuse-candidate prompt.
|
|
162
|
+
* Returns { descendantCount, activeCount, completedCount, maxDepth } for
|
|
163
|
+
* the given parent task id. Returns all zeros for unknown parent or empty
|
|
164
|
+
* subtree (does not throw).
|
|
165
|
+
*/
|
|
166
|
+
getSubtreeSummary(parentId: number, options?: SubtreeSummaryOptions): SubtreeSummary;
|
|
167
|
+
/**
|
|
168
|
+
* Task #2395: True if any direct child of the given parent is active or todo.
|
|
169
|
+
* Used internally by the activeChildFirst sort.
|
|
170
|
+
*/
|
|
171
|
+
private hasActiveChild;
|
|
172
|
+
private toRecord;
|
|
173
|
+
private safeParseContext;
|
|
174
|
+
private pickString;
|
|
175
|
+
private static STRIPPED_KEYS;
|
|
176
|
+
private stripSensitiveKeys;
|
|
177
|
+
private upsert;
|
|
178
|
+
private indexParentChild;
|
|
179
|
+
private collectSubtree;
|
|
180
|
+
private evictIfNeeded;
|
|
181
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview TaskReuseContext — Build the "reuse candidate" markdown
|
|
3
|
+
* section injected into sub-agent delegate prompts.
|
|
4
|
+
*
|
|
5
|
+
* The section lists recently-active tasks (from TaskCreationRegistry) so the
|
|
6
|
+
* sub-agent can decide whether to:
|
|
7
|
+
* - Reuse the existing task via `task_get` → `task_update` (reopen +
|
|
8
|
+
* append description/goals + create a continuation operation record).
|
|
9
|
+
* - Or — only if clearly different — call `task_create` for a new task.
|
|
10
|
+
*
|
|
11
|
+
* Critical invariants:
|
|
12
|
+
* - Candidates are *suggestions*, never auto-merged.
|
|
13
|
+
* - The section dedupes against the caller's `similar_task_ids` so the
|
|
14
|
+
* sub-agent doesn't see the same task twice in two different sections.
|
|
15
|
+
* - Output is bounded by `maxChars` and `maxDescriptionChars` to avoid
|
|
16
|
+
* consuming the prompt token budget.
|
|
17
|
+
* - Secret-like strings are redacted again at the boundary, as a second
|
|
18
|
+
* line of defense (the registry already sanitizes on write).
|
|
19
|
+
*/
|
|
20
|
+
import type { TaskCreationRegistry, RecentQueryOptions } from "./task-creation-registry";
|
|
21
|
+
import type { TaskStatus } from "./types";
|
|
22
|
+
export interface ReuseCandidatePromptOptions {
|
|
23
|
+
registry: TaskCreationRegistry;
|
|
24
|
+
/** IDs supplied by caller via similar_task_ids — skip in this section. */
|
|
25
|
+
similarTaskIds?: number[];
|
|
26
|
+
/** Scope override (e.g. { subagentType: "roy" }). */
|
|
27
|
+
scope?: RecentQueryOptions["scope"];
|
|
28
|
+
/** Default 5 */
|
|
29
|
+
limit?: number;
|
|
30
|
+
/** Hard cap on total markdown length. Default 2000. */
|
|
31
|
+
maxChars?: number;
|
|
32
|
+
/** Per-candidate description length. Default 240. */
|
|
33
|
+
maxDescriptionChars?: number;
|
|
34
|
+
/** Filter statuses. Default = all non-archived. */
|
|
35
|
+
statuses?: TaskStatus[];
|
|
36
|
+
/** Exclude the subtree rooted at this task id. */
|
|
37
|
+
excludeAncestorOf?: number;
|
|
38
|
+
/** Custom prefix label. Default: "Recent task context (reuse candidates)" */
|
|
39
|
+
heading?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ReuseCandidatePromptSection {
|
|
42
|
+
/** Full markdown block (heading + candidates + instructions). */
|
|
43
|
+
markdown: string;
|
|
44
|
+
/** Candidate task ids actually included (after excludeIds). */
|
|
45
|
+
candidateIds: number[];
|
|
46
|
+
isEmpty: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Build a markdown section listing recent task candidates. Caller is
|
|
50
|
+
* responsible for deciding whether to append it to the prompt.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildReuseCandidateSection(options: ReuseCandidatePromptOptions): ReuseCandidatePromptSection;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview TaskReuseRegistry — process-global singleton + lazy hook install.
|
|
3
|
+
*
|
|
4
|
+
* Provides one TaskCreationRegistry per process. Lazily installs the
|
|
5
|
+
* registry hook on the first call to `getOrCreateTaskReuseRegistry(env)`
|
|
6
|
+
* so callers don't have to wire it manually.
|
|
7
|
+
*
|
|
8
|
+
* The registry is keyed by env instance so two TaskComponents in the same
|
|
9
|
+
* process (rare, but possible in tests) each get their own registry.
|
|
10
|
+
*/
|
|
11
|
+
import type { Environment } from "../interface";
|
|
12
|
+
import { TaskCreationRegistry } from "./task-creation-registry";
|
|
13
|
+
import { type InstallHandle } from "./registry-hook-installer";
|
|
14
|
+
export interface TaskReuseRegistryEntry {
|
|
15
|
+
registry: TaskCreationRegistry;
|
|
16
|
+
installHandle: InstallHandle;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get (and lazily create) the process-global TaskCreationRegistry for the
|
|
20
|
+
* given environment. On first access, installs the registry hook.
|
|
21
|
+
*
|
|
22
|
+
* If the environment doesn't expose a TaskComponent, returns a stub
|
|
23
|
+
* registry that is never updated — callers can still query it but it
|
|
24
|
+
* will always be empty.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getOrCreateTaskReuseRegistry(env: Environment): TaskCreationRegistry;
|
|
27
|
+
/**
|
|
28
|
+
* Uninstall and discard the registry for an environment. Mainly for tests
|
|
29
|
+
* to ensure clean state between runs.
|
|
30
|
+
*/
|
|
31
|
+
export declare function disposeTaskReuseRegistry(env: Environment): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Batch Archive Tool
|
|
3
|
+
*
|
|
4
|
+
* 批量归档任务工具。将多个任务一次性设为 archived 状态。
|
|
5
|
+
* 用于任务整理场景(如 task-organizer agent)快速清理已完成的历史任务。
|
|
6
|
+
*/
|
|
7
|
+
import type { Tool } from "../../tool/types";
|
|
8
|
+
import type { TaskComponent } from "../task-component";
|
|
9
|
+
export declare function batchArchiveTaskTool(taskComponent: TaskComponent): Tool;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Batch Delete Tool
|
|
3
|
+
*
|
|
4
|
+
* 批量删除工具。将多个任务一次性删除。
|
|
5
|
+
* 用于任务整理场景(如 task-organizer agent)快速清理测试/临时任务。
|
|
6
|
+
*/
|
|
7
|
+
import type { Tool } from "../../tool/types";
|
|
8
|
+
import type { TaskComponent } from "../task-component";
|
|
9
|
+
export declare function batchDeleteTaskTool(taskComponent: TaskComponent): Tool;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Complete Tool
|
|
3
|
+
*
|
|
4
|
+
* Task #2778: 新增 deliverable_storage_path 参数 + 增强 description
|
|
5
|
+
*/
|
|
6
|
+
import type { Tool } from "../../tool/types";
|
|
7
|
+
import type { TaskComponent } from "../task-component";
|
|
8
|
+
/**
|
|
9
|
+
* task_complete 工具描述(导出便于单测和未来 reuse)
|
|
10
|
+
*/
|
|
11
|
+
export declare const TASK_COMPLETE_DESCRIPTION: string;
|
|
12
|
+
export declare function completeTaskTool(taskComponent: TaskComponent): Tool;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Tools Index
|
|
3
|
+
*/
|
|
4
|
+
export { createTaskTool } from "./create-tool";
|
|
5
|
+
export { getTaskTool } from "./get-tool";
|
|
6
|
+
export { listTasksTool } from "./list-tool";
|
|
7
|
+
export { searchTasksTool } from "./search-tool";
|
|
8
|
+
export { batchArchiveTaskTool } from "./batch-archive-tool";
|
|
9
|
+
export { batchDeleteTaskTool } from "./batch-delete-tool";
|
|
10
|
+
export { updateTaskTool } from "./update-tool";
|
|
11
|
+
export { deleteTaskTool } from "./delete-tool";
|
|
12
|
+
export { completeTaskTool } from "./complete-tool";
|
|
13
|
+
export { treeTasksTool } from "./task-tree-tool";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Operation Create Tool (Task #2211: milestone_* 主字段 + action_* 兼容)
|
|
3
|
+
*
|
|
4
|
+
* 双维度:
|
|
5
|
+
* - milestone_* 三字段描述达成的状态/里程碑
|
|
6
|
+
* - process_description 描述达成过程(100-150 字符硬约束)
|
|
7
|
+
*
|
|
8
|
+
* 兼容:action_* 自动映射到 milestone_* 并通过返回 _deprecated_warning 提示。
|
|
9
|
+
*/
|
|
10
|
+
import type { Tool } from "../../../tool/types";
|
|
11
|
+
import type { TaskComponent } from "../../task-component";
|
|
12
|
+
export declare function createOperationTool(taskComponent: TaskComponent): Tool;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Operation Tools Index
|
|
3
|
+
*/
|
|
4
|
+
export { createOperationTool } from "./create-tool";
|
|
5
|
+
export { getOperationTool } from "./get-tool";
|
|
6
|
+
export { listOperationsTool } from "./list-tool";
|
|
7
|
+
export { updateOperationTool } from "./update-tool";
|
|
8
|
+
export { deleteOperationTool } from "./delete-tool";
|