@ai-setting/roy-agent-core 1.7.52 → 1.7.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/config-component.d.ts +346 -0
- package/dist/config/config-parser.d.ts +45 -0
- package/dist/config/env-key.d.ts +97 -0
- package/dist/config/env-source.d.ts +113 -0
- package/dist/config/file-source.d.ts +90 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/protocol-resolver.d.ts +94 -0
- package/dist/env/agent/agent-component.d.ts +646 -0
- package/dist/env/agent/agent-config-registration.d.ts +18 -0
- package/dist/env/agent/agent-registry.d.ts +500 -0
- package/dist/env/agent/index.d.ts +9 -0
- package/dist/env/agent/index.js +3 -3
- package/dist/env/agent/summary-agent.d.ts +44 -0
- package/dist/env/agent/types.d.ts +503 -0
- package/dist/env/commands/commands-component.d.ts +97 -0
- package/dist/env/commands/commands-config-registration.d.ts +19 -0
- package/dist/env/commands/index.d.ts +7 -0
- package/dist/env/commands/parser.d.ts +18 -0
- package/dist/env/commands/types.d.ts +133 -0
- package/dist/env/component.d.ts +186 -0
- package/dist/env/constants.d.ts +112 -0
- package/dist/env/context/env-context.d.ts +420 -0
- package/dist/env/context/env-event.d.ts +144 -0
- package/dist/env/context/index.d.ts +13 -0
- package/dist/env/debug/debug-component.d.ts +160 -0
- package/dist/env/debug/formatters/index.d.ts +8 -0
- package/dist/env/debug/formatters/repl-formatter.d.ts +80 -0
- package/dist/env/debug/formatters/trace-formatter.d.ts +43 -0
- package/dist/env/debug/formatters/tree-formatter.d.ts +72 -0
- package/dist/env/debug/index.d.ts +15 -0
- package/dist/env/debug/index.js +1 -1
- package/dist/env/debug/parser/regex-parser.d.ts +49 -0
- package/dist/env/debug/parser/span-builder.d.ts +79 -0
- package/dist/env/debug/reader/log-reader.d.ts +55 -0
- package/dist/env/debug/reader/span-db-reader.d.ts +70 -0
- package/dist/env/debug/types.d.ts +145 -0
- package/dist/env/environment.d.ts +185 -0
- package/dist/env/error-reply.d.ts +184 -0
- package/dist/env/errors.d.ts +120 -0
- package/dist/env/event-source/bounty-cli-handler.d.ts +42 -0
- package/dist/env/event-source/bounty-im-handler.d.ts +232 -0
- package/dist/env/event-source/event-source-component.d.ts +177 -0
- package/dist/env/event-source/event-source-config-registration.d.ts +18 -0
- package/dist/env/event-source/event-source-handlers.d.ts +472 -0
- package/dist/env/event-source/event-store.d.ts +110 -0
- package/dist/env/event-source/idempotency-key.d.ts +19 -0
- package/dist/env/event-source/index.d.ts +15 -0
- package/dist/env/event-source/index.js +6 -6
- package/dist/env/event-source/timer-handler.d.ts +74 -0
- package/dist/env/event-source/types.d.ts +803 -0
- package/dist/env/hook/global-hook-manager.d.ts +73 -0
- package/dist/env/hook/hook-manager.d.ts +139 -0
- package/dist/env/hook/index.d.ts +9 -0
- package/dist/env/hook/types.d.ts +107 -0
- package/dist/env/index.d.ts +24 -0
- package/dist/env/index.js +18 -18
- package/dist/env/interface.d.ts +156 -0
- package/dist/env/lark-mention-utils.d.ts +59 -0
- package/dist/env/llm/adapter-ai-sdk.d.ts +10 -0
- package/dist/env/llm/adapter-pi-ai.d.ts +184 -0
- package/dist/env/llm/adapter.d.ts +100 -0
- package/dist/env/llm/factory.d.ts +13 -0
- package/dist/env/llm/hooks.d.ts +150 -0
- package/dist/env/llm/index.d.ts +16 -0
- package/dist/env/llm/index.js +2 -2
- package/dist/env/llm/invoke.d.ts +304 -0
- package/dist/env/llm/llm-cache.d.ts +38 -0
- package/dist/env/llm/llm.d.ts +263 -0
- package/dist/env/llm/opencode-session.d.ts +79 -0
- package/dist/env/llm/provider.d.ts +40 -0
- package/dist/env/llm/reasoning-defense.d.ts +104 -0
- package/dist/env/llm/tool-args-parser.d.ts +77 -0
- package/dist/env/llm/tool-schema.d.ts +54 -0
- package/dist/env/llm/transform.d.ts +57 -0
- package/dist/env/llm/types.d.ts +844 -0
- package/dist/env/log-trace/decorator.d.ts +88 -0
- package/dist/env/log-trace/index.d.ts +14 -0
- package/dist/env/log-trace/log-trace-component.d.ts +268 -0
- package/dist/env/log-trace/log-trace-config-registration.d.ts +25 -0
- package/dist/env/log-trace/logger.d.ts +83 -0
- package/dist/env/log-trace/opentelemetry/cli-propagation.d.ts +105 -0
- package/dist/env/log-trace/opentelemetry/mod.d.ts +24 -0
- package/dist/env/log-trace/opentelemetry/propagation-env.d.ts +81 -0
- package/dist/env/log-trace/opentelemetry/propagation.d.ts +79 -0
- package/dist/env/log-trace/opentelemetry/tracer-provider.d.ts +157 -0
- package/dist/env/log-trace/span-storage.d.ts +37 -0
- package/dist/env/log-trace/trace-context.d.ts +28 -0
- package/dist/env/log-trace/types.d.ts +127 -0
- package/dist/env/mcp/command-resolver.d.ts +12 -0
- package/dist/env/mcp/config.d.ts +103 -0
- package/dist/env/mcp/index.d.ts +13 -0
- package/dist/env/mcp/loader.d.ts +78 -0
- package/dist/env/mcp/mcp-component.d.ts +54 -0
- package/dist/env/mcp/mcp-config-registration.d.ts +19 -0
- package/dist/env/mcp/npm-prefix/index.d.ts +17 -0
- package/dist/env/mcp/scanner.d.ts +38 -0
- package/dist/env/mcp/tool/adapter.d.ts +32 -0
- package/dist/env/mcp/tool/index.d.ts +4 -0
- package/dist/env/mcp/types.d.ts +131 -0
- package/dist/env/memory/built-in/index.d.ts +41 -0
- package/dist/env/memory/built-in/recall-memory.d.ts +29 -0
- package/dist/env/memory/built-in/record-memory.d.ts +44 -0
- package/dist/env/memory/index.d.ts +10 -0
- package/dist/env/memory/memory-component.d.ts +114 -0
- package/dist/env/memory/memory-config-registration.d.ts +18 -0
- package/dist/env/memory/memory-config.d.ts +18 -0
- package/dist/env/memory/plugin/index.d.ts +16 -0
- package/dist/env/memory/plugin/memory-agent.d.ts +126 -0
- package/dist/env/memory/plugin/memory-manager.d.ts +71 -0
- package/dist/env/memory/plugin/memory-plugin.d.ts +103 -0
- package/dist/env/memory/plugin/recall-memory.d.ts +16 -0
- package/dist/env/memory/plugin/types.d.ts +75 -0
- package/dist/env/memory/tools/memory-agent-tools.d.ts +109 -0
- package/dist/env/memory/types.d.ts +80 -0
- package/dist/env/paths.d.ts +46 -0
- package/dist/env/plugin/bounty-cli-notification-channel.d.ts +60 -0
- package/dist/env/plugin/event-bus-notification-channel.d.ts +50 -0
- package/dist/env/plugin/index.d.ts +13 -0
- package/dist/env/plugin/lark-cli-notification-channel.d.ts +61 -0
- package/dist/env/plugin/notification-channel.d.ts +143 -0
- package/dist/env/plugin/plugin-component.d.ts +232 -0
- package/dist/env/plugin/types.d.ts +146 -0
- package/dist/env/prompt/index.d.ts +7 -0
- package/dist/env/prompt/index.js +2 -2
- package/dist/env/prompt/prompt-component.d.ts +194 -0
- package/dist/env/prompt/prompt-config-registration.d.ts +18 -0
- package/dist/env/prompt/prompt-store.d.ts +26 -0
- package/dist/env/prompt/prompts-index.d.ts +146 -0
- package/dist/env/prompt/renderer.d.ts +21 -0
- package/dist/env/prompt/types.d.ts +176 -0
- package/dist/env/session/hooks.d.ts +14 -0
- package/dist/env/session/index.d.ts +19 -0
- package/dist/env/session/index.js +4 -4
- package/dist/env/session/search-query-parser.d.ts +41 -0
- package/dist/env/session/session-component.d.ts +464 -0
- package/dist/env/session/session-config-registration.d.ts +18 -0
- package/dist/env/session/session-id.d.ts +26 -0
- package/dist/env/session/session-message-converter.d.ts +142 -0
- package/dist/env/session/session-store.d.ts +188 -0
- package/dist/env/session/storage/index.d.ts +5 -0
- package/dist/env/session/storage/index.js +3 -3
- package/dist/env/session/storage/memory.d.ts +119 -0
- package/dist/env/session/storage/sqlite.d.ts +108 -0
- package/dist/env/session/types.d.ts +705 -0
- package/dist/env/session-tree-stopper.d.ts +79 -0
- package/dist/env/skill/config.d.ts +13 -0
- package/dist/env/skill/index.d.ts +6 -0
- package/dist/env/skill/parser.d.ts +9 -0
- package/dist/env/skill/scanner.d.ts +25 -0
- package/dist/env/skill/skill-component.d.ts +89 -0
- package/dist/env/skill/skill-config-registration.d.ts +18 -0
- package/dist/env/skill/tool/index.d.ts +1 -0
- package/dist/env/skill/tool/skill-tool.d.ts +15 -0
- package/dist/env/skill/types.d.ts +61 -0
- package/dist/env/task/backend/index.d.ts +24 -0
- package/dist/env/task/backend/index.js +702 -0
- package/dist/env/task/backend/roy-sidecar-task-port.d.ts +148 -0
- package/dist/env/task/backend/sqlite-task-port.d.ts +28 -0
- package/dist/env/task/backend/task-store-backend.d.ts +107 -0
- package/dist/env/task/backend/types.d.ts +282 -0
- package/dist/env/task/delegate/bg-task-id-storage.d.ts +9 -0
- package/dist/env/task/delegate/delegate-tool.d.ts +681 -0
- package/dist/env/task/delegate/index.d.ts +8 -0
- package/dist/env/task/delegate/index.js +2 -2
- package/dist/env/task/delegate/process-registry.d.ts +58 -0
- package/dist/env/task/delegate/stop-tool.d.ts +12 -0
- package/dist/env/task/delegate/subagent-resolver.d.ts +25 -0
- package/dist/env/task/events/index.d.ts +7 -0
- package/dist/env/task/events/task-event-payloads.d.ts +101 -0
- package/dist/env/task/events/task-event-types.d.ts +23 -0
- package/dist/env/task/hooks/contexts.d.ts +191 -0
- package/dist/env/task/hooks/index.d.ts +7 -0
- package/dist/env/task/hooks/task-hook-points.d.ts +42 -0
- package/dist/env/task/index.d.ts +7 -0
- package/dist/env/task/index.js +3 -3
- package/dist/env/task/plugins/auto-task-plugin.d.ts +38 -0
- package/dist/env/task/plugins/card-chat-routing.d.ts +88 -0
- package/dist/env/task/plugins/fake-user-message-helper.d.ts +90 -0
- package/dist/env/task/plugins/index.d.ts +8 -0
- package/dist/env/task/plugins/index.js +4 -4
- package/dist/env/task/plugins/lark-card-action-handler.d.ts +166 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +600 -0
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +231 -0
- package/dist/env/task/plugins/max-iteration-reminder-plugin.d.ts +112 -0
- package/dist/env/task/plugins/per-task-group-chat-plugin.d.ts +561 -0
- package/dist/env/task/plugins/task-tag-plugin.d.ts +70 -0
- package/dist/env/task/plugins/workflow-extractor-agent.d.ts +43 -0
- package/dist/env/task/registry-hook-installer.d.ts +43 -0
- package/dist/env/task/storage/index.d.ts +5 -0
- package/dist/env/task/storage/migrations/001_add_project_path_context.d.ts +14 -0
- package/dist/env/task/storage/migrations/002_add_task_type.d.ts +14 -0
- package/dist/env/task/storage/migrations/003_add_process_description.d.ts +20 -0
- package/dist/env/task/storage/migrations/004_rename_action_to_milestone.d.ts +37 -0
- package/dist/env/task/storage/migrations/005_convert_blob_description_to_text.d.ts +51 -0
- package/dist/env/task/storage/sqlite-task-store.d.ts +241 -0
- package/dist/env/task/tag-service.d.ts +138 -0
- package/dist/env/task/task-child-context.d.ts +70 -0
- package/dist/env/task/task-component.d.ts +270 -0
- package/dist/env/task/task-config-registration.d.ts +19 -0
- package/dist/env/task/task-creation-registry.d.ts +181 -0
- package/dist/env/task/task-reuse-context.d.ts +52 -0
- package/dist/env/task/task-reuse-registry.d.ts +31 -0
- package/dist/env/task/tools/batch-archive-tool.d.ts +9 -0
- package/dist/env/task/tools/batch-delete-tool.d.ts +9 -0
- package/dist/env/task/tools/complete-tool.d.ts +12 -0
- package/dist/env/task/tools/create-tool.d.ts +6 -0
- package/dist/env/task/tools/delete-tool.d.ts +6 -0
- package/dist/env/task/tools/get-tool.d.ts +6 -0
- package/dist/env/task/tools/index.d.ts +13 -0
- package/dist/env/task/tools/list-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/create-tool.d.ts +12 -0
- package/dist/env/task/tools/operation/delete-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/get-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/index.d.ts +8 -0
- package/dist/env/task/tools/operation/list-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/operation-types.d.ts +225 -0
- package/dist/env/task/tools/operation/update-tool.d.ts +6 -0
- package/dist/env/task/tools/search-tool.d.ts +9 -0
- package/dist/env/task/tools/task-tree-tool.d.ts +65 -0
- package/dist/env/task/tools/task-types.d.ts +255 -0
- package/dist/env/task/tools/update-tool.d.ts +6 -0
- package/dist/env/task/types.d.ts +290 -0
- package/dist/env/tool/built-in/bash-effect.d.ts +36 -0
- package/dist/env/tool/built-in/bash.d.ts +16 -0
- package/dist/env/tool/built-in/echo.d.ts +7 -0
- package/dist/env/tool/built-in/edit-file.d.ts +6 -0
- package/dist/env/tool/built-in/glob.d.ts +6 -0
- package/dist/env/tool/built-in/grep.d.ts +6 -0
- package/dist/env/tool/built-in/index.d.ts +39 -0
- package/dist/env/tool/built-in/query-background-process-tool.d.ts +113 -0
- package/dist/env/tool/built-in/read-file.d.ts +5 -0
- package/dist/env/tool/built-in/understand-image.d.ts +59 -0
- package/dist/env/tool/built-in/write-file.d.ts +5 -0
- package/dist/env/tool/index.d.ts +16 -0
- package/dist/env/tool/registry.d.ts +61 -0
- package/dist/env/tool/tool-component.d.ts +242 -0
- package/dist/env/tool/tool-config-registration.d.ts +18 -0
- package/dist/env/tool/types.d.ts +274 -0
- package/dist/env/tool/validator.d.ts +14 -0
- package/dist/env/types.d.ts +184 -0
- package/dist/env/workflow/decorators/decorator-node.d.ts +76 -0
- package/dist/env/workflow/decorators/edge.d.ts +42 -0
- package/dist/env/workflow/decorators/index.d.ts +13 -0
- package/dist/env/workflow/decorators/node-as.d.ts +40 -0
- package/dist/env/workflow/decorators/workflow.d.ts +30 -0
- package/dist/env/workflow/engine/dag-manager.d.ts +176 -0
- package/dist/env/workflow/engine/engine.d.ts +440 -0
- package/dist/env/workflow/engine/event-bus.d.ts +54 -0
- package/dist/env/workflow/engine/executor.d.ts +122 -0
- package/dist/env/workflow/engine/index.d.ts +15 -0
- package/dist/env/workflow/engine/index.js +2 -2
- package/dist/env/workflow/engine/node-registry.d.ts +159 -0
- package/dist/env/workflow/engine/scheduler.d.ts +164 -0
- package/dist/env/workflow/extractor/workflow-converter.d.ts +55 -0
- package/dist/env/workflow/fixtures.d.ts +401 -0
- package/dist/env/workflow/hooks/index.d.ts +4 -0
- package/dist/env/workflow/hooks/workflow-hook-points.d.ts +161 -0
- package/dist/env/workflow/index.d.ts +30 -0
- package/dist/env/workflow/index.js +9 -9
- package/dist/env/workflow/metadata/keys.d.ts +6 -0
- package/dist/env/workflow/nodes/agent-component-adapter.d.ts +175 -0
- package/dist/env/workflow/nodes/agent-node.d.ts +206 -0
- package/dist/env/workflow/nodes/ask-user-node.d.ts +66 -0
- package/dist/env/workflow/nodes/condition-node.d.ts +39 -0
- package/dist/env/workflow/nodes/index.d.ts +8 -0
- package/dist/env/workflow/nodes/index.js +1 -1
- package/dist/env/workflow/nodes/merge-node.d.ts +40 -0
- package/dist/env/workflow/nodes/python-call-node.d.ts +95 -0
- package/dist/env/workflow/nodes/skill-node.d.ts +29 -0
- package/dist/env/workflow/nodes/tool-node.d.ts +64 -0
- package/dist/env/workflow/nodes/workflow-node.d.ts +118 -0
- package/dist/env/workflow/plugins/index.d.ts +6 -0
- package/dist/env/workflow/plugins/index.js +2 -2
- package/dist/env/workflow/plugins/lark-cli-workflow-notify-plugin.d.ts +107 -0
- package/dist/env/workflow/plugins/workflow-json-output-plugin.d.ts +166 -0
- package/dist/env/workflow/runtime/runtime-cancellation-scope.d.ts +121 -0
- package/dist/env/workflow/service/index.d.ts +9 -0
- package/dist/env/workflow/service/registry.d.ts +37 -0
- package/dist/env/workflow/service/workflow-service.d.ts +422 -0
- package/dist/env/workflow/storage/index.d.ts +11 -0
- package/dist/env/workflow/storage/mock-repositories.d.ts +106 -0
- package/dist/env/workflow/storage/safe-json.d.ts +62 -0
- package/dist/env/workflow/storage/sqlite.d.ts +57 -0
- package/dist/env/workflow/storage/tag-repo.d.ts +65 -0
- package/dist/env/workflow/storage/workflow-repo.d.ts +161 -0
- package/dist/env/workflow/tools/ask-user-tool.d.ts +35 -0
- package/dist/env/workflow/tools/index.d.ts +16 -0
- package/dist/env/workflow/tools/index.js +6 -6
- package/dist/env/workflow/tools/run-workflow.d.ts +130 -0
- package/dist/env/workflow/tools/submit-json-output-tool.d.ts +38 -0
- package/dist/env/workflow/tools/workflow-add-tool.d.ts +47 -0
- package/dist/env/workflow/tools/workflow-get-tool.d.ts +29 -0
- package/dist/env/workflow/tools/workflow-list-tool.d.ts +55 -0
- package/dist/env/workflow/tools/workflow-run-status-tool.d.ts +26 -0
- package/dist/env/workflow/tools/workflow-run-stop-tool.d.ts +29 -0
- package/dist/env/workflow/tools/workflow-search-tool.d.ts +33 -0
- package/dist/env/workflow/tools/workflow-tag-list-tool.d.ts +59 -0
- package/dist/env/workflow/tools/workflow-validate-tool.d.ts +69 -0
- package/dist/env/workflow/types/context.d.ts +17 -0
- package/dist/env/workflow/types/decorators-types.d.ts +182 -0
- package/dist/env/workflow/types/edge.d.ts +33 -0
- package/dist/env/workflow/types/event.d.ts +869 -0
- package/dist/env/workflow/types/index.d.ts +16 -0
- package/dist/env/workflow/types/run.d.ts +254 -0
- package/dist/env/workflow/types/workflow-error.d.ts +79 -0
- package/dist/env/workflow/types/workflow-hil.d.ts +57 -0
- package/dist/env/workflow/types/workflow-message.d.ts +193 -0
- package/dist/env/workflow/types/workflow-session.d.ts +17 -0
- package/dist/env/workflow/types/workflow.d.ts +654 -0
- package/dist/env/workflow/types_compat.d.ts +10 -0
- package/dist/env/workflow/utils/agent-session-metadata.d.ts +48 -0
- package/dist/env/workflow/utils/build-agent-node-output.d.ts +11 -0
- package/dist/env/workflow/utils/create-workflow.d.ts +35 -0
- package/dist/env/workflow/utils/dependency-prescan.d.ts +67 -0
- package/dist/env/workflow/utils/execution-state.d.ts +46 -0
- package/dist/env/workflow/utils/extract-agent-json-output.d.ts +6 -0
- package/dist/env/workflow/utils/index.d.ts +14 -0
- package/dist/env/workflow/utils/index.js +1 -1
- package/dist/env/workflow/utils/json-schema-to-zod.d.ts +23 -0
- package/dist/env/workflow/utils/node-id-utils.d.ts +20 -0
- package/dist/env/workflow/utils/node-output-contracts.d.ts +137 -0
- package/dist/env/workflow/utils/node-registry-helper.d.ts +36 -0
- package/dist/env/workflow/utils/output-schema-hint.d.ts +7 -0
- package/dist/env/workflow/utils/parse-agent-output-config.d.ts +9 -0
- package/dist/env/workflow/utils/recovery-validator.d.ts +30 -0
- package/dist/env/workflow/utils/redact-command-secrets.d.ts +70 -0
- package/dist/env/workflow/utils/sensitive-redact.d.ts +37 -0
- package/dist/env/workflow/utils/session-parser.d.ts +23 -0
- package/dist/env/workflow/utils/session-recovery.d.ts +122 -0
- package/dist/env/workflow/utils/shell-dialect-lint.d.ts +75 -0
- package/dist/env/workflow/utils/template-contract-validator.d.ts +87 -0
- package/dist/env/workflow/utils/template-resolver.d.ts +285 -0
- package/dist/env/workflow/utils/validate-workflow-definition.d.ts +79 -0
- package/dist/env/workflow/utils/validation-rules.d.ts +103 -0
- package/dist/env/workflow/utils/workflow-message-metadata.d.ts +20 -0
- package/dist/env/workflow/utils/workflow-sanitize.d.ts +51 -0
- package/dist/env/workflow/workflow-component.d.ts +138 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +21 -21
- package/dist/shared/@ai-setting/{roy-agent-core-stnddvx9.js → roy-agent-core-12d2xap8.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pk1b3kvf.js → roy-agent-core-2b8jtv7m.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-x8n1r7h4.js → roy-agent-core-2bscfrr1.js} +188 -7
- package/dist/shared/@ai-setting/{roy-agent-core-gdsqp6j8.js → roy-agent-core-6masakz4.js} +45 -0
- package/dist/shared/@ai-setting/{roy-agent-core-vvxb9522.js → roy-agent-core-6qxh4xrm.js} +67 -6
- package/dist/shared/@ai-setting/{roy-agent-core-h93v6p6y.js → roy-agent-core-7qy3nffr.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-8eqngasy.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-brwzs8wf.js → roy-agent-core-9h72sk1n.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-na73mym1.js → roy-agent-core-a4vzsn0g.js} +212 -1
- package/dist/shared/@ai-setting/{roy-agent-core-35s1w7tc.js → roy-agent-core-aer5kw1j.js} +142 -70
- package/dist/shared/@ai-setting/{roy-agent-core-j8e92gj8.js → roy-agent-core-b5ew8t0k.js} +0 -59
- package/dist/shared/@ai-setting/{roy-agent-core-rcfewbzr.js → roy-agent-core-cd62e9p1.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-39xejr39.js → roy-agent-core-e2z1etk4.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-pkpkctvf.js → roy-agent-core-g36jevrk.js} +14 -183
- package/dist/shared/@ai-setting/{roy-agent-core-ezgsem94.js → roy-agent-core-j2nvedt6.js} +465 -128
- package/dist/shared/@ai-setting/{roy-agent-core-p2r27era.js → roy-agent-core-mxdc756a.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-p8ak03s0.js → roy-agent-core-w527pcpe.js} +293 -42
- package/dist/shared/@ai-setting/{roy-agent-core-3tv1q6f2.js → roy-agent-core-ytr2w0vb.js} +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-yd21n6c7.js → roy-agent-core-zvemdfx5.js} +1 -1
- package/dist/test-utils/child-process-mock.d.ts +73 -0
- package/dist/util/process/process-tree-killer.d.ts +67 -0
- package/dist/utils/id.d.ts +11 -0
- package/dist/utils/loose-json.d.ts +30 -0
- package/dist/utils/media.d.ts +70 -0
- package/dist/utils/temp-file-manager/index.d.ts +99 -0
- package/package.json +5 -3
- /package/dist/shared/@ai-setting/{roy-agent-core-zy3hqfwg.js → roy-agent-core-0hq21px2.js} +0 -0
- /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Registry Hook Installer — wires TaskCreationRegistry to the
|
|
3
|
+
* TaskComponent hook system so create/update/complete/delete events feed
|
|
4
|
+
* the registry automatically.
|
|
5
|
+
*
|
|
6
|
+
* Use this when you want sub-agent delegate prompts to surface recent
|
|
7
|
+
* task candidates. See docs/design/task-reuse-context.md for the full
|
|
8
|
+
* design rationale.
|
|
9
|
+
*
|
|
10
|
+
* The installer returns a handle with `uninstall()` for clean teardown
|
|
11
|
+
* (tests + plugin shutdown).
|
|
12
|
+
*/
|
|
13
|
+
import type { TaskComponent } from "./task-component";
|
|
14
|
+
import type { TaskCreationRegistry, TaskRecordSource } from "./task-creation-registry";
|
|
15
|
+
export interface InstallOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Returns the sessionId to record as source.sessionId. If omitted, the
|
|
18
|
+
* registry record's source.sessionId will be undefined.
|
|
19
|
+
*
|
|
20
|
+
* Why an explicit provider? Hook contexts don't always carry a sessionId
|
|
21
|
+
* (e.g. AFTER_UPDATE may run from background code paths). The provider
|
|
22
|
+
* lets the caller inject the correct value from the call site where it's
|
|
23
|
+
* known (e.g. delegate-tool's executeWithAbort).
|
|
24
|
+
*/
|
|
25
|
+
sessionIdProvider?: () => string | undefined;
|
|
26
|
+
/** Default: "registry-hook-installer" */
|
|
27
|
+
hookName?: string;
|
|
28
|
+
/** Default: 100 (medium priority — runs after notifications) */
|
|
29
|
+
priority?: number;
|
|
30
|
+
/** Optional metadata to attach (e.g. { subagentType: "roy" }) */
|
|
31
|
+
staticSource?: Omit<TaskRecordSource, "sessionId">;
|
|
32
|
+
}
|
|
33
|
+
export interface InstallHandle {
|
|
34
|
+
uninstall(): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Subscribe a TaskCreationRegistry to a TaskComponent's lifecycle hooks.
|
|
38
|
+
*
|
|
39
|
+
* The registry is observation-only; this installer never mutates tasks.
|
|
40
|
+
* Errors thrown by registry calls are caught and logged so they can never
|
|
41
|
+
* break the host task lifecycle.
|
|
42
|
+
*/
|
|
43
|
+
export declare function installTaskCreationRegistryHooks(taskComponent: TaskComponent, registry: TaskCreationRegistry, options?: InstallOptions): InstallHandle;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Migration: Add project_path and context columns
|
|
3
|
+
*
|
|
4
|
+
* Migration ID: 001_add_project_path_context
|
|
5
|
+
* Description: Add project_path and context columns to task table
|
|
6
|
+
* Date: 2026-05-12
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Run migration to add project_path and context columns
|
|
10
|
+
*
|
|
11
|
+
* This migration is idempotent - safe to run multiple times.
|
|
12
|
+
* Existing databases will have columns added if missing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runMigration(dbPath: string): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Migration: Add type column
|
|
3
|
+
*
|
|
4
|
+
* Migration ID: 002_add_task_type
|
|
5
|
+
* Description: Add type column to task table (normal/cycle/longterm)
|
|
6
|
+
* Date: 2026-06-04
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Run migration to add type column
|
|
10
|
+
*
|
|
11
|
+
* This migration is idempotent - safe to run multiple times.
|
|
12
|
+
* Existing databases will have the column added if missing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runMigration(dbPath: string): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Migration: Add process_description column to task_operation
|
|
3
|
+
*
|
|
4
|
+
* Migration ID: 003_add_process_description
|
|
5
|
+
* Description: Add process_description column to task_operation table.
|
|
6
|
+
* 用于记录达成节点状态所采用的策略 + 工具步骤的过程概要,
|
|
7
|
+
* 区别于 action_description(状态/结果描述)。
|
|
8
|
+
* 字符范围 100-150(应用层 schema 校验,本字段不做 DB 长度约束)。
|
|
9
|
+
* Date: 2026-07-20
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Run migration to add process_description column.
|
|
13
|
+
*
|
|
14
|
+
* Idempotent: 重复执行安全。
|
|
15
|
+
* - 已存在 process_description 列:跳过 ALTER
|
|
16
|
+
* - 不存在:添加 TEXT NOT NULL DEFAULT ''
|
|
17
|
+
*
|
|
18
|
+
* 默认值空字符串且禁止 NULL(与应用层 rowToOperation 的空字符串语义一致)。
|
|
19
|
+
*/
|
|
20
|
+
export declare function runMigration(dbPath: string): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Migration 004: Rename action_* columns to milestone_*
|
|
3
|
+
*
|
|
4
|
+
* Migration ID: 004_rename_action_to_milestone
|
|
5
|
+
* Description: Rename task_operation.action_type/action_title/action_description
|
|
6
|
+
* to milestone_type/milestone_title/milestone_description.
|
|
7
|
+
* 这是 task_operation 状态语义重构的核心 schema 迁移。
|
|
8
|
+
* ActionTypeEnum 包含 create/progress/milestone/problem/solution/
|
|
9
|
+
* decision/review/completed,本身就是里程碑类型枚举;
|
|
10
|
+
* action_* 命名偏"动作/行为层",不能准确表达"这一刻达到的
|
|
11
|
+
* 里程碑/状态"。新命名 milestone_* 与 process_description(过程维度)
|
|
12
|
+
* 形成清晰的"状态/里程碑 + 过程"双维度分工。
|
|
13
|
+
*
|
|
14
|
+
* 数据保留:
|
|
15
|
+
* - SQLite ALTER TABLE RENAME COLUMN 自带数据保留
|
|
16
|
+
* - 迁移完成后原有 action_* 列内容自动落到 milestone_* 列
|
|
17
|
+
*
|
|
18
|
+
* 兼容:
|
|
19
|
+
* - task_operation 行旧字段 action_* 不可再读(已重命名)
|
|
20
|
+
* - 旧 API 调用方仍能通过 rowToOperation 同时拿到 milestone_* + action_* (deprecated alias)
|
|
21
|
+
*
|
|
22
|
+
* Date: 2026-07-21
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Run migration 004 on the given database file.
|
|
26
|
+
*
|
|
27
|
+
* Idempotent:
|
|
28
|
+
* - 重复执行安全:检查 milestone_* 列是否已存在,已存在则跳过。
|
|
29
|
+
*
|
|
30
|
+
* Algorithm:
|
|
31
|
+
* - 对 RENAME_MAP 每对 (oldName, newName):
|
|
32
|
+
* - if oldName exists AND newName does NOT exist → ALTER TABLE RENAME COLUMN
|
|
33
|
+
* - else skip
|
|
34
|
+
*
|
|
35
|
+
* @param dbPath SQLite database file path
|
|
36
|
+
*/
|
|
37
|
+
export declare function runMigration(dbPath: string): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Migration 005: Convert BLOB description to TEXT
|
|
3
|
+
*
|
|
4
|
+
* Migration ID: 005_convert_blob_description_to_text
|
|
5
|
+
* Description: Some tasks (notably Task #2084 with 15619-byte markdown
|
|
6
|
+
* description) had their `description` column stored as BLOB
|
|
7
|
+
* instead of TEXT. SQLite type affinity rules allow this when
|
|
8
|
+
* an INSERT/UPDATE uses a BLOB literal. The result is that
|
|
9
|
+
* better-sqlite3 / bun:sqlite return a Buffer object (truthy,
|
|
10
|
+
* no toLowerCase) instead of a string, crashing
|
|
11
|
+
* searchTasksByKeywords at line 1082.
|
|
12
|
+
*
|
|
13
|
+
* The rowToTask defensive String() coercion (Task #2226) is
|
|
14
|
+
* the load-bearing fix. This migration is a data-hygiene pass
|
|
15
|
+
* that converts any existing BLOB descriptions to TEXT in
|
|
16
|
+
* place so the column's declared type matches the storage
|
|
17
|
+
* class on every row.
|
|
18
|
+
*
|
|
19
|
+
* Data preservation:
|
|
20
|
+
* - CAST(description AS TEXT) decodes the bytes as UTF-8 and stores
|
|
21
|
+
* the result back into the same column. The column's type affinity
|
|
22
|
+
* (TEXT) is then respected for the new value.
|
|
23
|
+
* - Original content is preserved (the Buffer payload was the same UTF-8
|
|
24
|
+
* bytes that a TEXT column would have stored).
|
|
25
|
+
*
|
|
26
|
+
* Idempotent:
|
|
27
|
+
* - WHERE typeof(description) = 'blob' gates the update; re-running the
|
|
28
|
+
* migration on an already-migrated DB is a no-op.
|
|
29
|
+
*
|
|
30
|
+
* Date: 2026-07-21
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Run migration 005 on the given database file.
|
|
34
|
+
*
|
|
35
|
+
* Algorithm:
|
|
36
|
+
* 1. Open DB.
|
|
37
|
+
* 2. Verify the `task` table exists (fresh DBs may not have it yet).
|
|
38
|
+
* 3. Count rows where typeof(description) = 'blob' (BLOB-stored values).
|
|
39
|
+
* 4. If count > 0, run UPDATE task SET description = CAST(description AS TEXT)
|
|
40
|
+
* WHERE typeof(description) = 'blob'.
|
|
41
|
+
* 5. Close DB.
|
|
42
|
+
*
|
|
43
|
+
* @param dbPath SQLite database file path
|
|
44
|
+
* @returns Migration result: { blobCountBefore, blobCountAfter, ran }
|
|
45
|
+
*/
|
|
46
|
+
export interface Migration005Result {
|
|
47
|
+
blobCountBefore: number;
|
|
48
|
+
blobCountAfter: number;
|
|
49
|
+
ran: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare function runMigration(dbPath: string): Migration005Result;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview SQLite Task Store
|
|
3
|
+
*
|
|
4
|
+
* SQLite-based implementation of TaskStore.
|
|
5
|
+
*
|
|
6
|
+
* 根据运行环境自动选择 SQLite 实现:
|
|
7
|
+
* - Bun 运行时:使用 bun:sqlite
|
|
8
|
+
* - Node.js/Electron:使用 better-sqlite3
|
|
9
|
+
*
|
|
10
|
+
* 参考 Session SQLiteStore 实现模式:
|
|
11
|
+
* - 内存缓存提高性能
|
|
12
|
+
* - 默认路径:~/.local/share/roy-agent/tasks.db
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* 创建兼容的 Database 实例
|
|
16
|
+
*
|
|
17
|
+
* bun:sqlite 和 better-sqlite3 的 API 略有不同:
|
|
18
|
+
* - bun:sqlite 有 db.run() 方法
|
|
19
|
+
* - better-sqlite3 没有 db.run(),需要用 db.exec() 或 db.prepare().run()
|
|
20
|
+
*
|
|
21
|
+
* 此函数确保两种实现都有 run() 方法
|
|
22
|
+
*/
|
|
23
|
+
export declare function createCompatibleDatabase(path: string): any;
|
|
24
|
+
import type { Task, TaskOperation, TaskTag, CreateTaskOptions, UpdateTaskOptions, ListTasksOptions, TaskListResult, SearchTasksOptions, CreateOperationOptions, ListOperationsOptions } from "../types";
|
|
25
|
+
import type { ListTagsOptions, SearchTagsOptions } from "../tag-service";
|
|
26
|
+
/**
|
|
27
|
+
* Get default data directory for task storage
|
|
28
|
+
*/
|
|
29
|
+
declare function getDefaultDataDir(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get default database path for task storage
|
|
32
|
+
*/
|
|
33
|
+
declare function getDefaultTaskDbPath(): string;
|
|
34
|
+
export interface TaskStore {
|
|
35
|
+
createTask(options: CreateTaskOptions): Promise<Task>;
|
|
36
|
+
getTask(id: number): Promise<Task | undefined>;
|
|
37
|
+
updateTask(id: number, options: UpdateTaskOptions): Promise<Task | undefined>;
|
|
38
|
+
deleteTask(id: number): Promise<boolean>;
|
|
39
|
+
listTasks(options?: ListTasksOptions): Promise<TaskListResult>;
|
|
40
|
+
/**
|
|
41
|
+
* 按 session_id 反查该 session 里创建的第一个 task(用于 sub-session → task 的
|
|
42
|
+
* 确定性映射:sub-agent 的 task_create 用 sessionId=sub-session id)。
|
|
43
|
+
*/
|
|
44
|
+
getTaskIdBySessionId(sessionId: string): Promise<number | undefined>;
|
|
45
|
+
createOperation(options: CreateOperationOptions): Promise<TaskOperation>;
|
|
46
|
+
getOperation(id: number): Promise<TaskOperation | undefined>;
|
|
47
|
+
updateOperation(id: number, updates: {
|
|
48
|
+
milestoneTitle?: string;
|
|
49
|
+
milestoneDescription?: string;
|
|
50
|
+
processDescription?: string;
|
|
51
|
+
actionTitle?: string;
|
|
52
|
+
actionDescription?: string;
|
|
53
|
+
}): Promise<TaskOperation | undefined>;
|
|
54
|
+
deleteOperation(id: number): Promise<boolean>;
|
|
55
|
+
listOperations(options: ListOperationsOptions): Promise<TaskOperation[]>;
|
|
56
|
+
createTag(name: string): Promise<TaskTag>;
|
|
57
|
+
getTag(id: number): Promise<TaskTag | undefined>;
|
|
58
|
+
getTagByName(name: string): Promise<TaskTag | undefined>;
|
|
59
|
+
listTags(options?: ListTagsOptions): Promise<TaskTag[]>;
|
|
60
|
+
searchTags(options: SearchTagsOptions): Promise<TaskTag[]>;
|
|
61
|
+
deleteTag(id: number): Promise<boolean>;
|
|
62
|
+
addTagsToTask(taskId: number, tagIds: number[]): Promise<void>;
|
|
63
|
+
removeTagsFromTask(taskId: number, tagIds: number[]): Promise<void>;
|
|
64
|
+
getTagsForTask(taskId: number): Promise<TaskTag[]>;
|
|
65
|
+
getTaskIdsByTags(tagNames: string[]): Promise<number[]>;
|
|
66
|
+
updateTaskTags(taskId: number, tagNames: string[]): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Search tasks by keywords (tags, description, goals, operations).
|
|
69
|
+
* Returns { tasks, total } for pagination.
|
|
70
|
+
*
|
|
71
|
+
* 支持 depth 层级检索(参见 SearchTasksOptions.depth)。
|
|
72
|
+
*/
|
|
73
|
+
searchTasksByKeywords(keywords: string[], options?: SearchTasksOptions): Promise<TaskListResult>;
|
|
74
|
+
/** Find similar tasks using new keywords search */
|
|
75
|
+
findSimilarTasksByKeywords(keywords: string[], options?: {
|
|
76
|
+
limit?: number;
|
|
77
|
+
excludeTaskId?: number;
|
|
78
|
+
}): Promise<Task[]>;
|
|
79
|
+
/**
|
|
80
|
+
* 获取任务的子树(包含所有后代)
|
|
81
|
+
*
|
|
82
|
+
* @param taskId 起始任务 ID
|
|
83
|
+
* @param depth 层级深度,-1 表示无限层级(默认)
|
|
84
|
+
* @returns 所有后代任务的扁平列表(不含 taskId 本身)
|
|
85
|
+
*
|
|
86
|
+
* 实现:BFS 逐层展开 children,每层 +1。depth 限制 BFS 展开层数。
|
|
87
|
+
*/
|
|
88
|
+
getTaskTree(taskId: number, depth?: number): Promise<Task[]>;
|
|
89
|
+
/**
|
|
90
|
+
* 获取直接子任务(一层)。
|
|
91
|
+
*/
|
|
92
|
+
getChildTasks(taskId: number, options?: ListTasksOptions): Promise<TaskListResult>;
|
|
93
|
+
findSimilarTasks(taskId: number, limit?: number): Promise<Task[]>;
|
|
94
|
+
searchTasks(query: string, limit?: number): Promise<Task[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Task #4230 follow-up:按 context 里的字符串值反查 task
|
|
97
|
+
*
|
|
98
|
+
* 用途:已知一个飞书 chatId,反查"哪些 task 把这个群写进了自己的 context"
|
|
99
|
+
* (用于判定"这个群是不是某个 task 的专属群")。
|
|
100
|
+
* 只用 LIKE 做粗筛,精确字段名/语义判断交给调用方(card-chat-routing)。
|
|
101
|
+
*/
|
|
102
|
+
findTasksByContextValue(value: string, limit?: number): Promise<Task[]>;
|
|
103
|
+
close(): void;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* SQLite-based Task Store
|
|
107
|
+
*
|
|
108
|
+
* 参考 Session SQLiteStore 实现模式:
|
|
109
|
+
* - 使用 bun:sqlite 内置模块
|
|
110
|
+
* - 内存缓存提高性能
|
|
111
|
+
* - 默认路径:~/.local/share/roy-agent/tasks.db
|
|
112
|
+
*/
|
|
113
|
+
export declare class SQLiteTaskStore implements TaskStore {
|
|
114
|
+
private db;
|
|
115
|
+
private dbPath;
|
|
116
|
+
private initialized;
|
|
117
|
+
private tasksCache;
|
|
118
|
+
private operationsCache;
|
|
119
|
+
constructor(dbPath?: string);
|
|
120
|
+
private initialize;
|
|
121
|
+
createTask(options: CreateTaskOptions): Promise<Task>;
|
|
122
|
+
getTask(id: number): Promise<Task | undefined>;
|
|
123
|
+
updateTask(id: number, options: UpdateTaskOptions): Promise<Task | undefined>;
|
|
124
|
+
deleteTask(id: number): Promise<boolean>;
|
|
125
|
+
listTasks(options?: ListTasksOptions): Promise<TaskListResult>;
|
|
126
|
+
/**
|
|
127
|
+
* 按层级深度检索任务(BFS 展开)
|
|
128
|
+
*
|
|
129
|
+
* - depth === 0:只查根任务(parent_task_id IS NULL)
|
|
130
|
+
* - depth === 1:根 + 一层子任务
|
|
131
|
+
* - depth >= 2:根 + N 层子任务
|
|
132
|
+
*
|
|
133
|
+
* 支持 status / priority / type 过滤(在每层展开时复用)。
|
|
134
|
+
* limit/offset 在合并所有层级结果后应用(注意:total 是展开后的总数)。
|
|
135
|
+
*/
|
|
136
|
+
private listTasksByDepth;
|
|
137
|
+
/**
|
|
138
|
+
* 获取任务的子树(包含所有后代)
|
|
139
|
+
*
|
|
140
|
+
* @param taskId 起始任务 ID
|
|
141
|
+
* @param depth 层级深度,-1 表示无限层级(默认)
|
|
142
|
+
* @returns 所有后代任务的扁平列表(不含 taskId 本身)
|
|
143
|
+
*/
|
|
144
|
+
getTaskTree(taskId: number, depth?: number): Promise<Task[]>;
|
|
145
|
+
/**
|
|
146
|
+
* 获取直接子任务(一层)
|
|
147
|
+
*/
|
|
148
|
+
getChildTasks(taskId: number, options?: ListTasksOptions): Promise<TaskListResult>;
|
|
149
|
+
createOperation(options: CreateOperationOptions): Promise<TaskOperation>;
|
|
150
|
+
getOperation(id: number): Promise<TaskOperation | undefined>;
|
|
151
|
+
updateOperation(id: number, updates: {
|
|
152
|
+
milestoneTitle?: string;
|
|
153
|
+
milestoneDescription?: string;
|
|
154
|
+
processDescription?: string;
|
|
155
|
+
actionTitle?: string;
|
|
156
|
+
actionDescription?: string;
|
|
157
|
+
}): Promise<TaskOperation | undefined>;
|
|
158
|
+
deleteOperation(id: number): Promise<boolean>;
|
|
159
|
+
listOperations(options: ListOperationsOptions): Promise<TaskOperation[]>;
|
|
160
|
+
/**
|
|
161
|
+
* 按 session_id 反查该 session 创建的第一个 task。
|
|
162
|
+
*
|
|
163
|
+
* task 表本身不存 session_id,但 createTask 会写一条 milestone_type='create'
|
|
164
|
+
* 的 task_operation(带 session_id)。sub-agent 的 task_create 用
|
|
165
|
+
* sessionId=sub-session id,所以这里能确定性地把 sub-session 映射回它创建的 task,
|
|
166
|
+
* 不依赖易失的 EnvContext.currentTaskId(会被 task_complete 清空)或结果文本正则。
|
|
167
|
+
*/
|
|
168
|
+
getTaskIdBySessionId(sessionId: string): Promise<number | undefined>;
|
|
169
|
+
private rowToTask;
|
|
170
|
+
/**
|
|
171
|
+
* 安全解析 tags 字段。
|
|
172
|
+
*
|
|
173
|
+
* 历史背景:Bug 修复 Task #4033 — 任务 [HTML 样式重构] v33 → v34 的 tags 字段
|
|
174
|
+
* 被存成了 CSV 字符串 `'html-styling, css-refactor, v34, feishu, slides'` 而非
|
|
175
|
+
* 合法 JSON 数组,导致裸 `JSON.parse` 抛 SyntaxError,`tasks list` 命令
|
|
176
|
+
* `ORDER BY updated_at DESC` 第一条就挂掉,整个 CLI 不显示任何任务。
|
|
177
|
+
*
|
|
178
|
+
* 策略(按优先级 fallback,不抛错):
|
|
179
|
+
* 1. null/undefined/空串 → undefined
|
|
180
|
+
* 2. 合法 JSON 数组 → 原样返回
|
|
181
|
+
* 3. 合法 JSON 但不是数组(如 "tag1" 单字符串)→ 包成单元素数组(向后兼容)
|
|
182
|
+
* 4. 非法 JSON(CSV / 纯文本)→ 当作单个 tag 字符串,包成单元素数组
|
|
183
|
+
* 5. 其他类型(数字、对象等)→ undefined
|
|
184
|
+
*/
|
|
185
|
+
private static parseTagsSafely;
|
|
186
|
+
private rowToOperation;
|
|
187
|
+
createTag(name: string): Promise<TaskTag>;
|
|
188
|
+
getTag(id: number): Promise<TaskTag | undefined>;
|
|
189
|
+
getTagByName(name: string): Promise<TaskTag | undefined>;
|
|
190
|
+
listTags(options?: ListTagsOptions): Promise<TaskTag[]>;
|
|
191
|
+
searchTags(options: SearchTagsOptions): Promise<TaskTag[]>;
|
|
192
|
+
deleteTag(id: number): Promise<boolean>;
|
|
193
|
+
addTagsToTask(taskId: number, tagIds: number[]): Promise<void>;
|
|
194
|
+
removeTagsFromTask(taskId: number, tagIds: number[]): Promise<void>;
|
|
195
|
+
getTagsForTask(taskId: number): Promise<TaskTag[]>;
|
|
196
|
+
getTaskIdsByTags(tagNames: string[]): Promise<number[]>;
|
|
197
|
+
updateTaskTags(taskId: number, tagNames: string[]): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Search tasks by keywords list
|
|
200
|
+
* Searches in: tags (JSON), description, goals_and_expected_deliverables, operations
|
|
201
|
+
*
|
|
202
|
+
* 支持 depth 参数:depth=0 只匹配根任务(AND 关系),depth=1 根+子,依此类推
|
|
203
|
+
*/
|
|
204
|
+
searchTasksByKeywords(keywords: string[], options?: SearchTasksOptions): Promise<TaskListResult>;
|
|
205
|
+
/**
|
|
206
|
+
* 内部方法:BFS 展开根任务到指定深度,返回所有可达任务 ID 集合
|
|
207
|
+
*
|
|
208
|
+
* - depth === 0:只根任务 ID
|
|
209
|
+
* - depth >= 1:根 + 1..N 层所有后代 ID
|
|
210
|
+
*/
|
|
211
|
+
private collectTaskIdsByDepth;
|
|
212
|
+
/**
|
|
213
|
+
* Find similar tasks by keywords
|
|
214
|
+
* Excludes the target task and sorts by relevance
|
|
215
|
+
* Default limit is 5 to keep prompt concise
|
|
216
|
+
*
|
|
217
|
+
* Note: Returns only the tasks array (not {tasks, total}) for backwards
|
|
218
|
+
* compatibility with internal callers (e.g. plugin similar-task injection).
|
|
219
|
+
*/
|
|
220
|
+
findSimilarTasksByKeywords(keywords: string[], options?: {
|
|
221
|
+
limit?: number;
|
|
222
|
+
excludeTaskId?: number;
|
|
223
|
+
}): Promise<Task[]>;
|
|
224
|
+
findSimilarTasks(taskId: number, limit?: number): Promise<Task[]>;
|
|
225
|
+
searchTasks(query: string, limit?: number): Promise<Task[]>;
|
|
226
|
+
/**
|
|
227
|
+
* Task #4230 follow-up:按 context 值反查 task(LIKE 粗筛)
|
|
228
|
+
*
|
|
229
|
+
* 用途:已知一个飞书 chatId,反查"哪些 task 把这个群写进了自己的 context"
|
|
230
|
+
* (用于判定"这个群是不是某个 task 的专属群")。精确的字段名 / 语义判断
|
|
231
|
+
* 交给调用方(card-chat-routing),这里只做粗筛。
|
|
232
|
+
*
|
|
233
|
+
* @param value 目标值(通常是一个 chatId)
|
|
234
|
+
* @param limit 最多返回条数(默认 50)
|
|
235
|
+
*/
|
|
236
|
+
findTasksByContextValue(value: string, limit?: number): Promise<Task[]>;
|
|
237
|
+
private rowToTag;
|
|
238
|
+
private syncTaskTagsJson;
|
|
239
|
+
close(): Promise<void>;
|
|
240
|
+
}
|
|
241
|
+
export { getDefaultTaskDbPath, getDefaultDataDir };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview TagService - Tag 池管理服务
|
|
3
|
+
*
|
|
4
|
+
* 提供 Tag 的 CRUD、Tag 与 Task 关联、类似任务检索能力
|
|
5
|
+
*
|
|
6
|
+
* 设计原则:
|
|
7
|
+
* - Tag 池模式:新 Tag 从池中选取,无合适则新增
|
|
8
|
+
* - 混合存储:Task.tags JSON 快速读取 + Tag 表高效检索
|
|
9
|
+
*/
|
|
10
|
+
import type { Task, TaskTag } from "./types";
|
|
11
|
+
import type { TaskStore } from "./storage/sqlite-task-store";
|
|
12
|
+
export interface ListTagsOptions {
|
|
13
|
+
limit?: number;
|
|
14
|
+
offset?: number;
|
|
15
|
+
orderBy?: "count" | "name" | "created_at";
|
|
16
|
+
}
|
|
17
|
+
export interface SearchTagsOptions {
|
|
18
|
+
query: string;
|
|
19
|
+
limit?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface TagService {
|
|
22
|
+
/**
|
|
23
|
+
* 创建 Tag(如果已存在则返回现有 Tag)
|
|
24
|
+
*/
|
|
25
|
+
createTag(name: string): Promise<TaskTag>;
|
|
26
|
+
/**
|
|
27
|
+
* 获取 Tag by ID
|
|
28
|
+
*/
|
|
29
|
+
getTag(id: number): Promise<TaskTag | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* 获取 Tag by Name
|
|
32
|
+
*/
|
|
33
|
+
getTagByName(name: string): Promise<TaskTag | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* 列出所有 Tag
|
|
36
|
+
*/
|
|
37
|
+
listTags(options?: ListTagsOptions): Promise<TaskTag[]>;
|
|
38
|
+
/**
|
|
39
|
+
* 搜索 Tag(模糊匹配)
|
|
40
|
+
*/
|
|
41
|
+
searchTags(options: SearchTagsOptions): Promise<TaskTag[]>;
|
|
42
|
+
/**
|
|
43
|
+
* 删除 Tag(同时删除所有关联)
|
|
44
|
+
*/
|
|
45
|
+
deleteTag(id: number): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* 给 Task 添加 Tags
|
|
48
|
+
*/
|
|
49
|
+
addTagsToTask(taskId: number, tagIds: number[]): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* 从 Task 移除 Tags
|
|
52
|
+
*/
|
|
53
|
+
removeTagsFromTask(taskId: number, tagIds: number[]): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* 获取 Task 的所有 Tags
|
|
56
|
+
*/
|
|
57
|
+
getTagsForTask(taskId: number): Promise<TaskTag[]>;
|
|
58
|
+
/**
|
|
59
|
+
* 根据 Tag 名称获取关联的 Task IDs
|
|
60
|
+
*/
|
|
61
|
+
getTaskIdsByTags(tagNames: string[]): Promise<number[]>;
|
|
62
|
+
/**
|
|
63
|
+
* 根据关键词列表搜索 Task(检索 tags、description、goals、operations)
|
|
64
|
+
* 这是新的核心检索方法
|
|
65
|
+
*/
|
|
66
|
+
searchTasksByKeywords(keywords: string[], options?: {
|
|
67
|
+
limit?: number;
|
|
68
|
+
excludeTaskId?: number;
|
|
69
|
+
}): Promise<Task[]>;
|
|
70
|
+
/**
|
|
71
|
+
* 根据关键词查找类似 Task(排除自身,按相关性排序)
|
|
72
|
+
* 这是新的核心检索方法
|
|
73
|
+
*/
|
|
74
|
+
findSimilarTasksByKeywords(keywords: string[], options?: {
|
|
75
|
+
limit?: number;
|
|
76
|
+
excludeTaskId?: number;
|
|
77
|
+
}): Promise<Task[]>;
|
|
78
|
+
/**
|
|
79
|
+
* 同步 Tags 到 Task(根据 tag 名称列表)
|
|
80
|
+
* - 查找或创建 Tag
|
|
81
|
+
* - 更新关联关系
|
|
82
|
+
* - 更新 task.tags JSON 字段
|
|
83
|
+
*/
|
|
84
|
+
syncTagsToTask(taskId: number, tagNames: string[]): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* 查找类似 Task(基于 Tag 匹配度)- 原始实现,保留兼容
|
|
87
|
+
* @deprecated 使用 findSimilarTasksByKeywords 代替
|
|
88
|
+
*/
|
|
89
|
+
findSimilarTasks(taskId: number, limit?: number): Promise<Task[]>;
|
|
90
|
+
/**
|
|
91
|
+
* 根据关键词搜索 Task(标题 + 描述)- 原始实现,保留兼容
|
|
92
|
+
* @deprecated 使用 searchTasksByKeywords 代替
|
|
93
|
+
*/
|
|
94
|
+
searchTasks(query: string, limit?: number): Promise<Task[]>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* TagService 实现
|
|
98
|
+
*/
|
|
99
|
+
export declare class DefaultTagService implements TagService {
|
|
100
|
+
private store;
|
|
101
|
+
constructor(store: TaskStore);
|
|
102
|
+
createTag(name: string): Promise<TaskTag>;
|
|
103
|
+
getTag(id: number): Promise<TaskTag | undefined>;
|
|
104
|
+
getTagByName(name: string): Promise<TaskTag | undefined>;
|
|
105
|
+
listTags(options?: ListTagsOptions): Promise<TaskTag[]>;
|
|
106
|
+
searchTags(options: SearchTagsOptions): Promise<TaskTag[]>;
|
|
107
|
+
deleteTag(id: number): Promise<boolean>;
|
|
108
|
+
addTagsToTask(taskId: number, tagIds: number[]): Promise<void>;
|
|
109
|
+
removeTagsFromTask(taskId: number, tagIds: number[]): Promise<void>;
|
|
110
|
+
getTagsForTask(taskId: number): Promise<TaskTag[]>;
|
|
111
|
+
getTaskIdsByTags(tagNames: string[]): Promise<number[]>;
|
|
112
|
+
/**
|
|
113
|
+
* 根据关键词列表搜索 Task
|
|
114
|
+
* @deprecated 使用 findSimilarTasksByKeywords 代替
|
|
115
|
+
*/
|
|
116
|
+
findSimilarTasks(taskId: number, limit?: number): Promise<Task[]>;
|
|
117
|
+
/**
|
|
118
|
+
* 根据关键词搜索 Task(单字符串)- 原始实现
|
|
119
|
+
* @deprecated 使用 searchTasksByKeywords 代替
|
|
120
|
+
*/
|
|
121
|
+
searchTasks(query: string, limit?: number): Promise<Task[]>;
|
|
122
|
+
/**
|
|
123
|
+
* 根据关键词列表搜索 Task
|
|
124
|
+
* 检索范围:tags、description、goals、operations
|
|
125
|
+
*/
|
|
126
|
+
searchTasksByKeywords(keywords: string[], options?: {
|
|
127
|
+
limit?: number;
|
|
128
|
+
excludeTaskId?: number;
|
|
129
|
+
}): Promise<Task[]>;
|
|
130
|
+
/**
|
|
131
|
+
* 根据关键词查找类似 Task
|
|
132
|
+
*/
|
|
133
|
+
findSimilarTasksByKeywords(keywords: string[], options?: {
|
|
134
|
+
limit?: number;
|
|
135
|
+
excludeTaskId?: number;
|
|
136
|
+
}): Promise<Task[]>;
|
|
137
|
+
syncTagsToTask(taskId: number, tagNames: string[]): Promise<void>;
|
|
138
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task Child Context — Pure helper for safely inheriting context
|
|
3
|
+
* from a parent task when creating a child task.
|
|
4
|
+
*
|
|
5
|
+
* Used by `task_create` (and by delegate prompt builders) to suggest a
|
|
6
|
+
* sensible default payload for a child task. The caller may override any
|
|
7
|
+
* field; the helper never silently drops required fields.
|
|
8
|
+
*
|
|
9
|
+
* Inheritance rules (v1):
|
|
10
|
+
*
|
|
11
|
+
* 1. project_path — ALWAYS inherited from parent unless overridden.
|
|
12
|
+
* 2. worktree_path, branch, parent_branch, type — inherited from parent
|
|
13
|
+
* `context` JSON when present and the caller doesn't override.
|
|
14
|
+
* 3. tags — NOT inherited by default (caller may opt in via `inheritTags`).
|
|
15
|
+
* Why: tags often encode the parent feature/iteration; children may
|
|
16
|
+
* want different tagging to track their own scope.
|
|
17
|
+
* 4. prior_context.commit — NEVER copied (security: avoid leaking private
|
|
18
|
+
* commit SHAs). prior_context.prev_task IS preserved (helpful trail).
|
|
19
|
+
* 5. created_at — always auto-injected with current timestamp unless
|
|
20
|
+
* the caller overrides it.
|
|
21
|
+
* 6. Sensitive fields — token redaction is the responsibility of the
|
|
22
|
+
* caller (TaskCreationRegistry already redacts on storage). This
|
|
23
|
+
* helper additionally strips known commit-SHA leakage patterns.
|
|
24
|
+
*
|
|
25
|
+
* If parent.contextJson is malformed, we fall back gracefully:
|
|
26
|
+
* - project_path still inherited
|
|
27
|
+
* - context still produced (as minimal JSON)
|
|
28
|
+
* - all other inherited fields absent
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Snapshot of the parent task's stored context. Sourced from
|
|
32
|
+
* `taskComponent.getTask(parentId)` + `parent.context` JSON.
|
|
33
|
+
*/
|
|
34
|
+
export interface ParentContextSnapshot {
|
|
35
|
+
taskId: number;
|
|
36
|
+
projectPath: string;
|
|
37
|
+
/** Raw JSON string of the parent's context field. */
|
|
38
|
+
contextJson: string;
|
|
39
|
+
tags?: string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Caller-provided overrides. `undefined` = "use inherited value".
|
|
43
|
+
*/
|
|
44
|
+
export interface ChildContextOverrides {
|
|
45
|
+
/** Replace inherited project_path. */
|
|
46
|
+
projectPath?: string;
|
|
47
|
+
/** Replace inherited branch (in context.branch). */
|
|
48
|
+
branch?: string;
|
|
49
|
+
/** Replace inherited worktree_path (in context.worktree_path). */
|
|
50
|
+
worktreePath?: string;
|
|
51
|
+
/** If true, inherit parent's tags. Default false. */
|
|
52
|
+
inheritTags?: boolean;
|
|
53
|
+
/** If false, skip all inherited context fields. Default true. */
|
|
54
|
+
contextInherit?: boolean;
|
|
55
|
+
/** Override auto-injected created_at. */
|
|
56
|
+
createdAt?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface InheritedChildContext {
|
|
59
|
+
/** Resolved project_path to use for the child task. */
|
|
60
|
+
project_path: string;
|
|
61
|
+
/** Serialized JSON `context` field ready for the child task. */
|
|
62
|
+
context: string;
|
|
63
|
+
/** Tags inherited from parent (only populated when `inheritTags=true`). */
|
|
64
|
+
inheritedTags: string[];
|
|
65
|
+
}
|
|
66
|
+
export interface InheritArgs {
|
|
67
|
+
parent: ParentContextSnapshot;
|
|
68
|
+
overrides?: ChildContextOverrides;
|
|
69
|
+
}
|
|
70
|
+
export declare function inheritChildContext(args: InheritArgs): InheritedChildContext;
|