mcp-agent-foundry 1.0.0
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/LICENSE +21 -0
- package/README.md +477 -0
- package/dist/cli/install-skills.d.ts +11 -0
- package/dist/cli/install-skills.d.ts.map +1 -0
- package/dist/cli/install-skills.js +143 -0
- package/dist/cli/install-skills.js.map +1 -0
- package/dist/cli/recovery-commands.d.ts +41 -0
- package/dist/cli/recovery-commands.d.ts.map +1 -0
- package/dist/cli/recovery-commands.js +241 -0
- package/dist/cli/recovery-commands.js.map +1 -0
- package/dist/cli/setup-wizard.d.ts +25 -0
- package/dist/cli/setup-wizard.d.ts.map +1 -0
- package/dist/cli/setup-wizard.js +1417 -0
- package/dist/cli/setup-wizard.js.map +1 -0
- package/dist/cli/test-connection.d.ts +45 -0
- package/dist/cli/test-connection.d.ts.map +1 -0
- package/dist/cli/test-connection.js +317 -0
- package/dist/cli/test-connection.js.map +1 -0
- package/dist/cli.d.ts +75 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +704 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/defaults.d.ts +57 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +99 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +22 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/manager.d.ts +184 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +347 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/merger.d.ts +76 -0
- package/dist/config/merger.d.ts.map +1 -0
- package/dist/config/merger.js +189 -0
- package/dist/config/merger.js.map +1 -0
- package/dist/config/schema.d.ts +20 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +20 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validator.d.ts +254 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +363 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/config/worktree-defaults.d.ts +23 -0
- package/dist/config/worktree-defaults.d.ts.map +1 -0
- package/dist/config/worktree-defaults.js +78 -0
- package/dist/config/worktree-defaults.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/tools/compare-agents.d.ts +25 -0
- package/dist/mcp/tools/compare-agents.d.ts.map +1 -0
- package/dist/mcp/tools/compare-agents.js +177 -0
- package/dist/mcp/tools/compare-agents.js.map +1 -0
- package/dist/mcp/tools/critique-plan.d.ts +26 -0
- package/dist/mcp/tools/critique-plan.d.ts.map +1 -0
- package/dist/mcp/tools/critique-plan.js +162 -0
- package/dist/mcp/tools/critique-plan.js.map +1 -0
- package/dist/mcp/tools/design-feedback.d.ts +26 -0
- package/dist/mcp/tools/design-feedback.d.ts.map +1 -0
- package/dist/mcp/tools/design-feedback.js +216 -0
- package/dist/mcp/tools/design-feedback.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +50 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +191 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/invoke-agent.d.ts +25 -0
- package/dist/mcp/tools/invoke-agent.d.ts.map +1 -0
- package/dist/mcp/tools/invoke-agent.js +141 -0
- package/dist/mcp/tools/invoke-agent.js.map +1 -0
- package/dist/mcp/tools/review-code.d.ts +25 -0
- package/dist/mcp/tools/review-code.d.ts.map +1 -0
- package/dist/mcp/tools/review-code.js +170 -0
- package/dist/mcp/tools/review-code.js.map +1 -0
- package/dist/mcp/tools/tasks/claim-next-task.d.ts +22 -0
- package/dist/mcp/tools/tasks/claim-next-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/claim-next-task.js +203 -0
- package/dist/mcp/tools/tasks/claim-next-task.js.map +1 -0
- package/dist/mcp/tools/tasks/create-routed-task.d.ts +17 -0
- package/dist/mcp/tools/tasks/create-routed-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/create-routed-task.js +178 -0
- package/dist/mcp/tools/tasks/create-routed-task.js.map +1 -0
- package/dist/mcp/tools/tasks/execute-pipeline.d.ts +22 -0
- package/dist/mcp/tools/tasks/execute-pipeline.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/execute-pipeline.js +401 -0
- package/dist/mcp/tools/tasks/execute-pipeline.js.map +1 -0
- package/dist/mcp/tools/tasks/execute-task.d.ts +32 -0
- package/dist/mcp/tools/tasks/execute-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/execute-task.js +284 -0
- package/dist/mcp/tools/tasks/execute-task.js.map +1 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.d.ts +26 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.js +460 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.js.map +1 -0
- package/dist/mcp/tools/tasks/index.d.ts +36 -0
- package/dist/mcp/tools/tasks/index.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/index.js +66 -0
- package/dist/mcp/tools/tasks/index.js.map +1 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.d.ts +17 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.js +147 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.js.map +1 -0
- package/dist/mcp/tools/worktree/get-worktree-status.d.ts +17 -0
- package/dist/mcp/tools/worktree/get-worktree-status.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/get-worktree-status.js +123 -0
- package/dist/mcp/tools/worktree/get-worktree-status.js.map +1 -0
- package/dist/mcp/tools/worktree/index.d.ts +41 -0
- package/dist/mcp/tools/worktree/index.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/index.js +69 -0
- package/dist/mcp/tools/worktree/index.js.map +1 -0
- package/dist/mcp/tools/worktree/list-worktrees.d.ts +17 -0
- package/dist/mcp/tools/worktree/list-worktrees.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/list-worktrees.js +136 -0
- package/dist/mcp/tools/worktree/list-worktrees.js.map +1 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.d.ts +19 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.js +228 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.js.map +1 -0
- package/dist/mcp/transport/stdio.d.ts +13 -0
- package/dist/mcp/transport/stdio.d.ts.map +1 -0
- package/dist/mcp/transport/stdio.js +15 -0
- package/dist/mcp/transport/stdio.js.map +1 -0
- package/dist/observability/logger.d.ts +137 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +235 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/observability/metrics.d.ts +250 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +364 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/persistence/index.d.ts +9 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +9 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/persistence/state-schema.d.ts +116 -0
- package/dist/persistence/state-schema.d.ts.map +1 -0
- package/dist/persistence/state-schema.js +28 -0
- package/dist/persistence/state-schema.js.map +1 -0
- package/dist/persistence/state-store.d.ts +111 -0
- package/dist/persistence/state-store.d.ts.map +1 -0
- package/dist/persistence/state-store.js +291 -0
- package/dist/persistence/state-store.js.map +1 -0
- package/dist/providers/anthropic.d.ts +164 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +500 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/base.d.ts +151 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +227 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/gemini.d.ts +85 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +414 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/kimi.d.ts +19 -0
- package/dist/providers/kimi.d.ts.map +1 -0
- package/dist/providers/kimi.js +20 -0
- package/dist/providers/kimi.js.map +1 -0
- package/dist/providers/manager.d.ts +160 -0
- package/dist/providers/manager.d.ts.map +1 -0
- package/dist/providers/manager.js +264 -0
- package/dist/providers/manager.js.map +1 -0
- package/dist/providers/ollama.d.ts +83 -0
- package/dist/providers/ollama.d.ts.map +1 -0
- package/dist/providers/ollama.js +453 -0
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/openai.d.ts +96 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +457 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/zai.d.ts +19 -0
- package/dist/providers/zai.d.ts.map +1 -0
- package/dist/providers/zai.js +20 -0
- package/dist/providers/zai.js.map +1 -0
- package/dist/router/context-manager.d.ts +2 -0
- package/dist/router/context-manager.d.ts.map +1 -0
- package/dist/router/context-manager.js +3 -0
- package/dist/router/context-manager.js.map +1 -0
- package/dist/router/engine.d.ts +169 -0
- package/dist/router/engine.d.ts.map +1 -0
- package/dist/router/engine.js +435 -0
- package/dist/router/engine.js.map +1 -0
- package/dist/router/pattern-executor.d.ts +317 -0
- package/dist/router/pattern-executor.d.ts.map +1 -0
- package/dist/router/pattern-executor.js +571 -0
- package/dist/router/pattern-executor.js.map +1 -0
- package/dist/router/role-resolver.d.ts +59 -0
- package/dist/router/role-resolver.d.ts.map +1 -0
- package/dist/router/role-resolver.js +95 -0
- package/dist/router/role-resolver.js.map +1 -0
- package/dist/server.d.ts +32 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +223 -0
- package/dist/server.js.map +1 -0
- package/dist/startup.d.ts +78 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +107 -0
- package/dist/startup.js.map +1 -0
- package/dist/tasks/coordinator.d.ts +141 -0
- package/dist/tasks/coordinator.d.ts.map +1 -0
- package/dist/tasks/coordinator.js +331 -0
- package/dist/tasks/coordinator.js.map +1 -0
- package/dist/tasks/index.d.ts +13 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +13 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/persistent-state-coordinator.d.ts +89 -0
- package/dist/tasks/persistent-state-coordinator.d.ts.map +1 -0
- package/dist/tasks/persistent-state-coordinator.js +371 -0
- package/dist/tasks/persistent-state-coordinator.js.map +1 -0
- package/dist/tasks/pipeline-manager.d.ts +103 -0
- package/dist/tasks/pipeline-manager.d.ts.map +1 -0
- package/dist/tasks/pipeline-manager.js +358 -0
- package/dist/tasks/pipeline-manager.js.map +1 -0
- package/dist/tasks/state-coordinator.d.ts +79 -0
- package/dist/tasks/state-coordinator.d.ts.map +1 -0
- package/dist/tasks/state-coordinator.js +200 -0
- package/dist/tasks/state-coordinator.js.map +1 -0
- package/dist/tasks/worker-mode.d.ts +65 -0
- package/dist/tasks/worker-mode.d.ts.map +1 -0
- package/dist/tasks/worker-mode.js +208 -0
- package/dist/tasks/worker-mode.js.map +1 -0
- package/dist/translation/errors.d.ts +203 -0
- package/dist/translation/errors.d.ts.map +1 -0
- package/dist/translation/errors.js +477 -0
- package/dist/translation/errors.js.map +1 -0
- package/dist/translation/index.d.ts +12 -0
- package/dist/translation/index.d.ts.map +1 -0
- package/dist/translation/index.js +32 -0
- package/dist/translation/index.js.map +1 -0
- package/dist/translation/messages.d.ts +295 -0
- package/dist/translation/messages.d.ts.map +1 -0
- package/dist/translation/messages.js +557 -0
- package/dist/translation/messages.js.map +1 -0
- package/dist/translation/streaming.d.ts +226 -0
- package/dist/translation/streaming.d.ts.map +1 -0
- package/dist/translation/streaming.js +520 -0
- package/dist/translation/streaming.js.map +1 -0
- package/dist/translation/tools.d.ts +209 -0
- package/dist/translation/tools.d.ts.map +1 -0
- package/dist/translation/tools.js +331 -0
- package/dist/translation/tools.js.map +1 -0
- package/dist/types.d.ts +747 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +86 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/circuit-breaker.d.ts +175 -0
- package/dist/utils/circuit-breaker.d.ts.map +1 -0
- package/dist/utils/circuit-breaker.js +315 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/dist/utils/env.d.ts +2 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +3 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/git.d.ts +58 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +197 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/merge-ordering.d.ts +45 -0
- package/dist/utils/merge-ordering.d.ts.map +1 -0
- package/dist/utils/merge-ordering.js +128 -0
- package/dist/utils/merge-ordering.js.map +1 -0
- package/dist/utils/retry.d.ts +106 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +188 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/worktrees/branch-manager.d.ts +55 -0
- package/dist/worktrees/branch-manager.d.ts.map +1 -0
- package/dist/worktrees/branch-manager.js +129 -0
- package/dist/worktrees/branch-manager.js.map +1 -0
- package/dist/worktrees/conflict-handler.d.ts +72 -0
- package/dist/worktrees/conflict-handler.d.ts.map +1 -0
- package/dist/worktrees/conflict-handler.js +287 -0
- package/dist/worktrees/conflict-handler.js.map +1 -0
- package/dist/worktrees/conflict-parser.d.ts +28 -0
- package/dist/worktrees/conflict-parser.d.ts.map +1 -0
- package/dist/worktrees/conflict-parser.js +140 -0
- package/dist/worktrees/conflict-parser.js.map +1 -0
- package/dist/worktrees/index.d.ts +20 -0
- package/dist/worktrees/index.d.ts.map +1 -0
- package/dist/worktrees/index.js +20 -0
- package/dist/worktrees/index.js.map +1 -0
- package/dist/worktrees/instructions.d.ts +20 -0
- package/dist/worktrees/instructions.d.ts.map +1 -0
- package/dist/worktrees/instructions.js +84 -0
- package/dist/worktrees/instructions.js.map +1 -0
- package/dist/worktrees/manager.d.ts +76 -0
- package/dist/worktrees/manager.d.ts.map +1 -0
- package/dist/worktrees/manager.js +277 -0
- package/dist/worktrees/manager.js.map +1 -0
- package/dist/worktrees/pipeline-merge-orchestrator.d.ts +55 -0
- package/dist/worktrees/pipeline-merge-orchestrator.d.ts.map +1 -0
- package/dist/worktrees/pipeline-merge-orchestrator.js +221 -0
- package/dist/worktrees/pipeline-merge-orchestrator.js.map +1 -0
- package/dist/worktrees/pool.d.ts +95 -0
- package/dist/worktrees/pool.d.ts.map +1 -0
- package/dist/worktrees/pool.js +271 -0
- package/dist/worktrees/pool.js.map +1 -0
- package/dist/worktrees/recovery.d.ts +94 -0
- package/dist/worktrees/recovery.d.ts.map +1 -0
- package/dist/worktrees/recovery.js +371 -0
- package/dist/worktrees/recovery.js.map +1 -0
- package/dist/worktrees/resource-manager.d.ts +74 -0
- package/dist/worktrees/resource-manager.d.ts.map +1 -0
- package/dist/worktrees/resource-manager.js +228 -0
- package/dist/worktrees/resource-manager.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Coordinator
|
|
3
|
+
*
|
|
4
|
+
* Bridges AgentRouter execution with Claude Code Tasks.
|
|
5
|
+
* Since MCP tools cannot directly invoke Claude Code tools,
|
|
6
|
+
* the coordinator returns INSTRUCTIONS for Claude to execute.
|
|
7
|
+
*
|
|
8
|
+
* Enhanced with worktree allocation support for coding agents
|
|
9
|
+
* that need isolated git workspaces for file modifications.
|
|
10
|
+
*/
|
|
11
|
+
import type { Logger } from "../observability/logger.js";
|
|
12
|
+
import type { ConfigManager } from "../config/manager.js";
|
|
13
|
+
import type { StateCoordinator } from "./state-coordinator.js";
|
|
14
|
+
import type { WorktreeManager } from "../worktrees/manager.js";
|
|
15
|
+
import type { AgentResponse, ClaimInstructions, CompletionResult, FailureResult, TaskExecution, WorktreeConfig, Worktree, WorktreeInstructions } from "../types.js";
|
|
16
|
+
/**
|
|
17
|
+
* Options for TaskCoordinator construction
|
|
18
|
+
*/
|
|
19
|
+
export interface TaskCoordinatorOptions {
|
|
20
|
+
/** Logger instance */
|
|
21
|
+
logger: Logger;
|
|
22
|
+
/** Optional StateCoordinator for unified state management */
|
|
23
|
+
stateCoordinator?: StateCoordinator;
|
|
24
|
+
/** Optional WorktreeManager for worktree allocation */
|
|
25
|
+
worktreeManager?: WorktreeManager;
|
|
26
|
+
/** Optional ConfigManager to check role configurations */
|
|
27
|
+
configManager?: ConfigManager;
|
|
28
|
+
/** Optional worktree config to check if worktrees are enabled */
|
|
29
|
+
worktreeConfig?: WorktreeConfig;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Result of starting an execution with optional worktree allocation
|
|
33
|
+
*/
|
|
34
|
+
export interface ExecutionStartResult {
|
|
35
|
+
/** The task execution record */
|
|
36
|
+
execution: TaskExecution;
|
|
37
|
+
/** Worktree allocated for this task (if applicable) */
|
|
38
|
+
worktree?: Worktree;
|
|
39
|
+
/** Worktree instructions to inject (if applicable) */
|
|
40
|
+
worktreeInstructions?: WorktreeInstructions;
|
|
41
|
+
/** Modified task prompt with worktree context injected */
|
|
42
|
+
modifiedPrompt?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare class TaskCoordinator {
|
|
45
|
+
private activeExecutions;
|
|
46
|
+
private logger;
|
|
47
|
+
private stateCoordinator?;
|
|
48
|
+
private worktreeManager?;
|
|
49
|
+
private configManager?;
|
|
50
|
+
private worktreeConfig?;
|
|
51
|
+
constructor(options: TaskCoordinatorOptions);
|
|
52
|
+
/** @deprecated Use options object instead */
|
|
53
|
+
constructor(logger: Logger);
|
|
54
|
+
/**
|
|
55
|
+
* Generate instructions for Claude to claim a task before execution.
|
|
56
|
+
*/
|
|
57
|
+
generateClaimInstructions(taskId: string, workerName: string): ClaimInstructions;
|
|
58
|
+
/**
|
|
59
|
+
* Check if a role needs an isolated worktree for execution.
|
|
60
|
+
* Checks role config override first, then falls back to default role list.
|
|
61
|
+
*/
|
|
62
|
+
private taskNeedsWorktree;
|
|
63
|
+
/**
|
|
64
|
+
* Start tracking a task execution.
|
|
65
|
+
*/
|
|
66
|
+
startExecution(taskId: string, role: string, traceId?: string): TaskExecution;
|
|
67
|
+
/**
|
|
68
|
+
* Start a task execution with optional worktree allocation.
|
|
69
|
+
*
|
|
70
|
+
* This enhanced method:
|
|
71
|
+
* 1. Creates task state via StateCoordinator (if available)
|
|
72
|
+
* 2. Checks if the role needs a worktree
|
|
73
|
+
* 3. Allocates worktree and generates instructions (if needed)
|
|
74
|
+
* 4. Links task to worktree in state coordinator
|
|
75
|
+
* 5. Returns modified prompt with worktree context injected
|
|
76
|
+
*
|
|
77
|
+
* @param taskId - Claude Code task ID
|
|
78
|
+
* @param role - Agent role to execute
|
|
79
|
+
* @param originalPrompt - Original task prompt/description
|
|
80
|
+
* @param agentId - Optional agent ID for worktree allocation
|
|
81
|
+
* @param traceId - Optional trace ID for correlation
|
|
82
|
+
*/
|
|
83
|
+
startExecutionWithWorktree(taskId: string, role: string, originalPrompt: string, agentId?: string, traceId?: string): Promise<ExecutionStartResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Get an active execution by task ID.
|
|
86
|
+
*/
|
|
87
|
+
getExecution(taskId: string): TaskExecution | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Mark execution complete and generate completion instructions.
|
|
90
|
+
*/
|
|
91
|
+
completeExecution(taskId: string, result: AgentResponse): CompletionResult;
|
|
92
|
+
/**
|
|
93
|
+
* Mark execution complete with worktree cleanup.
|
|
94
|
+
* This is an async version that handles worktree release.
|
|
95
|
+
*/
|
|
96
|
+
completeExecutionWithWorktree(taskId: string, result: AgentResponse): Promise<CompletionResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Mark execution failed and generate failure instructions.
|
|
99
|
+
*/
|
|
100
|
+
failExecution(taskId: string, error: Error): FailureResult;
|
|
101
|
+
/**
|
|
102
|
+
* Mark execution failed with worktree cleanup.
|
|
103
|
+
* This is an async version that handles worktree release.
|
|
104
|
+
*/
|
|
105
|
+
failExecutionWithWorktree(taskId: string, error: Error): Promise<FailureResult>;
|
|
106
|
+
/**
|
|
107
|
+
* Cleanup worktree associated with a task.
|
|
108
|
+
* Releases the worktree and unlinks from state coordinator.
|
|
109
|
+
*/
|
|
110
|
+
cleanupWorktree(taskId: string): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Clear a completed/failed execution from tracking.
|
|
113
|
+
*/
|
|
114
|
+
clearExecution(taskId: string): void;
|
|
115
|
+
/**
|
|
116
|
+
* Get all active executions.
|
|
117
|
+
*/
|
|
118
|
+
getActiveExecutions(): TaskExecution[];
|
|
119
|
+
/**
|
|
120
|
+
* Check if there are any active executions.
|
|
121
|
+
*/
|
|
122
|
+
hasActiveExecutions(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Get worktree information for a task.
|
|
125
|
+
* Returns undefined if no worktree is allocated.
|
|
126
|
+
*/
|
|
127
|
+
getWorktreeForTask(taskId: string): Worktree | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Check if worktree support is available and enabled.
|
|
130
|
+
*/
|
|
131
|
+
isWorktreeSupportEnabled(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Get the state coordinator instance (if configured).
|
|
134
|
+
*/
|
|
135
|
+
getStateCoordinator(): StateCoordinator | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Get the worktree manager instance (if configured).
|
|
138
|
+
*/
|
|
139
|
+
getWorktreeManager(): WorktreeManager | undefined;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceR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AAkB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAOxD;;OAEG;IACH,wBAAwB,IAAI,OAAO;IAOnC;;OAEG;IACH,mBAAmB,IAAI,gBAAgB,GAAG,SAAS;IAInD;;OAEG;IACH,kBAAkB,IAAI,eAAe,GAAG,SAAS;CAGlD"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Coordinator
|
|
3
|
+
*
|
|
4
|
+
* Bridges AgentRouter execution with Claude Code Tasks.
|
|
5
|
+
* Since MCP tools cannot directly invoke Claude Code tools,
|
|
6
|
+
* the coordinator returns INSTRUCTIONS for Claude to execute.
|
|
7
|
+
*
|
|
8
|
+
* Enhanced with worktree allocation support for coding agents
|
|
9
|
+
* that need isolated git workspaces for file modifications.
|
|
10
|
+
*/
|
|
11
|
+
import { randomUUID } from "node:crypto";
|
|
12
|
+
import { roleNeedsWorktree } from "../config/worktree-defaults.js";
|
|
13
|
+
import { injectWorktreeContext } from "../worktrees/instructions.js";
|
|
14
|
+
export class TaskCoordinator {
|
|
15
|
+
activeExecutions = new Map();
|
|
16
|
+
logger;
|
|
17
|
+
stateCoordinator;
|
|
18
|
+
worktreeManager;
|
|
19
|
+
configManager;
|
|
20
|
+
worktreeConfig;
|
|
21
|
+
constructor(optionsOrLogger) {
|
|
22
|
+
if ('logger' in optionsOrLogger && typeof optionsOrLogger.logger === 'object') {
|
|
23
|
+
// New options-based constructor
|
|
24
|
+
const options = optionsOrLogger;
|
|
25
|
+
this.logger = options.logger;
|
|
26
|
+
this.stateCoordinator = options.stateCoordinator;
|
|
27
|
+
this.worktreeManager = options.worktreeManager;
|
|
28
|
+
this.configManager = options.configManager;
|
|
29
|
+
this.worktreeConfig = options.worktreeConfig;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// Legacy constructor for backward compatibility
|
|
33
|
+
this.logger = optionsOrLogger;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generate instructions for Claude to claim a task before execution.
|
|
38
|
+
*/
|
|
39
|
+
generateClaimInstructions(taskId, workerName) {
|
|
40
|
+
return {
|
|
41
|
+
preExecution: `TaskUpdate({ taskId: "${taskId}", status: "in_progress", owner: "${workerName}" })`,
|
|
42
|
+
onSuccess: `TaskUpdate({ taskId: "${taskId}", status: "completed" })`,
|
|
43
|
+
onFailure: `TaskUpdate({ taskId: "${taskId}", status: "pending", owner: null })`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check if a role needs an isolated worktree for execution.
|
|
48
|
+
* Checks role config override first, then falls back to default role list.
|
|
49
|
+
*/
|
|
50
|
+
taskNeedsWorktree(role) {
|
|
51
|
+
// Check if worktrees are enabled globally
|
|
52
|
+
if (this.worktreeConfig && !this.worktreeConfig.enabled) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
// Check if worktree manager is available
|
|
56
|
+
if (!this.worktreeManager) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
// Check role-specific config override
|
|
60
|
+
if (this.configManager) {
|
|
61
|
+
const roleConfig = this.configManager.getRole(role);
|
|
62
|
+
if (roleConfig?.needs_worktree !== undefined) {
|
|
63
|
+
return roleConfig.needs_worktree;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Fall back to default role list
|
|
67
|
+
return roleNeedsWorktree(role);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Start tracking a task execution.
|
|
71
|
+
*/
|
|
72
|
+
startExecution(taskId, role, traceId) {
|
|
73
|
+
const execution = {
|
|
74
|
+
taskId,
|
|
75
|
+
role,
|
|
76
|
+
traceId: traceId ?? randomUUID(),
|
|
77
|
+
startTime: Date.now(),
|
|
78
|
+
status: "running",
|
|
79
|
+
};
|
|
80
|
+
this.activeExecutions.set(taskId, execution);
|
|
81
|
+
this.logger.debug("Task execution started", { taskId, role, traceId: execution.traceId });
|
|
82
|
+
return execution;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Start a task execution with optional worktree allocation.
|
|
86
|
+
*
|
|
87
|
+
* This enhanced method:
|
|
88
|
+
* 1. Creates task state via StateCoordinator (if available)
|
|
89
|
+
* 2. Checks if the role needs a worktree
|
|
90
|
+
* 3. Allocates worktree and generates instructions (if needed)
|
|
91
|
+
* 4. Links task to worktree in state coordinator
|
|
92
|
+
* 5. Returns modified prompt with worktree context injected
|
|
93
|
+
*
|
|
94
|
+
* @param taskId - Claude Code task ID
|
|
95
|
+
* @param role - Agent role to execute
|
|
96
|
+
* @param originalPrompt - Original task prompt/description
|
|
97
|
+
* @param agentId - Optional agent ID for worktree allocation
|
|
98
|
+
* @param traceId - Optional trace ID for correlation
|
|
99
|
+
*/
|
|
100
|
+
async startExecutionWithWorktree(taskId, role, originalPrompt, agentId, traceId) {
|
|
101
|
+
const executionTraceId = traceId ?? randomUUID();
|
|
102
|
+
// Create task in state coordinator if available
|
|
103
|
+
if (this.stateCoordinator) {
|
|
104
|
+
this.stateCoordinator.createTask(taskId, role);
|
|
105
|
+
}
|
|
106
|
+
// Start the basic execution tracking
|
|
107
|
+
const execution = this.startExecution(taskId, role, executionTraceId);
|
|
108
|
+
// Mark task as started in state coordinator
|
|
109
|
+
if (this.stateCoordinator) {
|
|
110
|
+
this.stateCoordinator.startTask(taskId);
|
|
111
|
+
}
|
|
112
|
+
// Check if this role needs a worktree
|
|
113
|
+
if (!this.taskNeedsWorktree(role)) {
|
|
114
|
+
this.logger.debug("Role does not need worktree", { taskId, role });
|
|
115
|
+
return { execution };
|
|
116
|
+
}
|
|
117
|
+
// Allocate worktree
|
|
118
|
+
const effectiveAgentId = agentId ?? `agent-${executionTraceId.slice(0, 8)}`;
|
|
119
|
+
try {
|
|
120
|
+
const allocationResult = await this.worktreeManager.allocate(taskId, effectiveAgentId);
|
|
121
|
+
if (!allocationResult.success || !allocationResult.worktree) {
|
|
122
|
+
this.logger.warn("Failed to allocate worktree, proceeding without isolation", {
|
|
123
|
+
taskId,
|
|
124
|
+
role,
|
|
125
|
+
error: allocationResult.error,
|
|
126
|
+
});
|
|
127
|
+
return { execution };
|
|
128
|
+
}
|
|
129
|
+
const worktree = allocationResult.worktree;
|
|
130
|
+
const worktreeInstructions = allocationResult.instructions;
|
|
131
|
+
// Link task to worktree in state coordinator
|
|
132
|
+
if (this.stateCoordinator) {
|
|
133
|
+
this.stateCoordinator.linkTaskToWorktree(taskId, worktree.id);
|
|
134
|
+
}
|
|
135
|
+
// Inject worktree instructions into prompt
|
|
136
|
+
const modifiedPrompt = injectWorktreeContext(originalPrompt, worktree, "full");
|
|
137
|
+
this.logger.info("Task execution started with worktree", {
|
|
138
|
+
taskId,
|
|
139
|
+
role,
|
|
140
|
+
worktreeId: worktree.id,
|
|
141
|
+
worktreePath: worktree.path,
|
|
142
|
+
branch: worktree.branch,
|
|
143
|
+
});
|
|
144
|
+
return {
|
|
145
|
+
execution,
|
|
146
|
+
worktree,
|
|
147
|
+
worktreeInstructions,
|
|
148
|
+
modifiedPrompt,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
this.logger.error("Error allocating worktree", {
|
|
153
|
+
taskId,
|
|
154
|
+
role,
|
|
155
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
156
|
+
});
|
|
157
|
+
// Proceed without worktree on allocation failure
|
|
158
|
+
return { execution };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get an active execution by task ID.
|
|
163
|
+
*/
|
|
164
|
+
getExecution(taskId) {
|
|
165
|
+
return this.activeExecutions.get(taskId);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Mark execution complete and generate completion instructions.
|
|
169
|
+
*/
|
|
170
|
+
completeExecution(taskId, result) {
|
|
171
|
+
const execution = this.activeExecutions.get(taskId);
|
|
172
|
+
if (!execution) {
|
|
173
|
+
throw new Error(`No active execution for task ${taskId}`);
|
|
174
|
+
}
|
|
175
|
+
execution.status = "completed";
|
|
176
|
+
execution.endTime = Date.now();
|
|
177
|
+
execution.result = result;
|
|
178
|
+
const durationMs = execution.endTime - execution.startTime;
|
|
179
|
+
this.logger.info("Task execution completed", {
|
|
180
|
+
taskId,
|
|
181
|
+
role: execution.role,
|
|
182
|
+
durationMs,
|
|
183
|
+
provider: result.provider,
|
|
184
|
+
model: result.model,
|
|
185
|
+
});
|
|
186
|
+
// Update state coordinator
|
|
187
|
+
if (this.stateCoordinator) {
|
|
188
|
+
this.stateCoordinator.completeTask(taskId);
|
|
189
|
+
}
|
|
190
|
+
// Cleanup worktree is done asynchronously via cleanupWorktree method
|
|
191
|
+
// to avoid blocking the completion response
|
|
192
|
+
return {
|
|
193
|
+
execution,
|
|
194
|
+
instructions: `TaskUpdate({ taskId: "${taskId}", status: "completed" })`,
|
|
195
|
+
result,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Mark execution complete with worktree cleanup.
|
|
200
|
+
* This is an async version that handles worktree release.
|
|
201
|
+
*/
|
|
202
|
+
async completeExecutionWithWorktree(taskId, result) {
|
|
203
|
+
const completionResult = this.completeExecution(taskId, result);
|
|
204
|
+
// Cleanup worktree
|
|
205
|
+
await this.cleanupWorktree(taskId);
|
|
206
|
+
return completionResult;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Mark execution failed and generate failure instructions.
|
|
210
|
+
*/
|
|
211
|
+
failExecution(taskId, error) {
|
|
212
|
+
const execution = this.activeExecutions.get(taskId);
|
|
213
|
+
if (!execution) {
|
|
214
|
+
throw new Error(`No active execution for task ${taskId}`);
|
|
215
|
+
}
|
|
216
|
+
execution.status = "failed";
|
|
217
|
+
execution.endTime = Date.now();
|
|
218
|
+
execution.error = error;
|
|
219
|
+
const durationMs = execution.endTime - execution.startTime;
|
|
220
|
+
this.logger.error("Task execution failed", {
|
|
221
|
+
taskId,
|
|
222
|
+
role: execution.role,
|
|
223
|
+
durationMs,
|
|
224
|
+
error,
|
|
225
|
+
});
|
|
226
|
+
// Update state coordinator
|
|
227
|
+
if (this.stateCoordinator) {
|
|
228
|
+
this.stateCoordinator.failTask(taskId, error.message);
|
|
229
|
+
}
|
|
230
|
+
// Cleanup worktree is done asynchronously via cleanupWorktree method
|
|
231
|
+
// Release the task so it can be retried
|
|
232
|
+
return {
|
|
233
|
+
execution,
|
|
234
|
+
instructions: `TaskUpdate({ taskId: "${taskId}", status: "pending", owner: null })`,
|
|
235
|
+
error,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Mark execution failed with worktree cleanup.
|
|
240
|
+
* This is an async version that handles worktree release.
|
|
241
|
+
*/
|
|
242
|
+
async failExecutionWithWorktree(taskId, error) {
|
|
243
|
+
const failureResult = this.failExecution(taskId, error);
|
|
244
|
+
// Cleanup worktree
|
|
245
|
+
await this.cleanupWorktree(taskId);
|
|
246
|
+
return failureResult;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Cleanup worktree associated with a task.
|
|
250
|
+
* Releases the worktree and unlinks from state coordinator.
|
|
251
|
+
*/
|
|
252
|
+
async cleanupWorktree(taskId) {
|
|
253
|
+
// Check if task has a worktree
|
|
254
|
+
let worktreeId;
|
|
255
|
+
if (this.stateCoordinator) {
|
|
256
|
+
worktreeId = this.stateCoordinator.getWorktreeForTask(taskId);
|
|
257
|
+
}
|
|
258
|
+
if (!worktreeId && this.worktreeManager) {
|
|
259
|
+
// Try to find worktree by task ID directly
|
|
260
|
+
const worktree = this.worktreeManager.getByTaskId(taskId);
|
|
261
|
+
worktreeId = worktree?.id;
|
|
262
|
+
}
|
|
263
|
+
if (!worktreeId || !this.worktreeManager) {
|
|
264
|
+
return; // No worktree to cleanup
|
|
265
|
+
}
|
|
266
|
+
try {
|
|
267
|
+
// Release the worktree
|
|
268
|
+
await this.worktreeManager.release(worktreeId);
|
|
269
|
+
// Unlink from state coordinator
|
|
270
|
+
if (this.stateCoordinator) {
|
|
271
|
+
this.stateCoordinator.unlinkTaskFromWorktree(taskId);
|
|
272
|
+
}
|
|
273
|
+
this.logger.info("Worktree cleaned up for task", { taskId, worktreeId });
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
this.logger.warn("Failed to cleanup worktree", {
|
|
277
|
+
taskId,
|
|
278
|
+
worktreeId,
|
|
279
|
+
error: error instanceof Error ? error.message : String(error),
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Clear a completed/failed execution from tracking.
|
|
285
|
+
*/
|
|
286
|
+
clearExecution(taskId) {
|
|
287
|
+
this.activeExecutions.delete(taskId);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Get all active executions.
|
|
291
|
+
*/
|
|
292
|
+
getActiveExecutions() {
|
|
293
|
+
return Array.from(this.activeExecutions.values());
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Check if there are any active executions.
|
|
297
|
+
*/
|
|
298
|
+
hasActiveExecutions() {
|
|
299
|
+
return this.activeExecutions.size > 0;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Get worktree information for a task.
|
|
303
|
+
* Returns undefined if no worktree is allocated.
|
|
304
|
+
*/
|
|
305
|
+
getWorktreeForTask(taskId) {
|
|
306
|
+
if (this.worktreeManager) {
|
|
307
|
+
return this.worktreeManager.getByTaskId(taskId);
|
|
308
|
+
}
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Check if worktree support is available and enabled.
|
|
313
|
+
*/
|
|
314
|
+
isWorktreeSupportEnabled() {
|
|
315
|
+
return !!(this.worktreeManager &&
|
|
316
|
+
(!this.worktreeConfig || this.worktreeConfig.enabled));
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Get the state coordinator instance (if configured).
|
|
320
|
+
*/
|
|
321
|
+
getStateCoordinator() {
|
|
322
|
+
return this.stateCoordinator;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Get the worktree manager instance (if configured).
|
|
326
|
+
*/
|
|
327
|
+
getWorktreeManager() {
|
|
328
|
+
return this.worktreeManager;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/tasks/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AA0CrE,MAAM,OAAO,eAAe;IAClB,gBAAgB,GAA+B,IAAI,GAAG,EAAE,CAAC;IACzD,MAAM,CAAS;IACf,gBAAgB,CAAoB;IACpC,eAAe,CAAmB;IAClC,aAAa,CAAiB;IAC9B,cAAc,CAAkB;IAKxC,YAAY,eAAgD;QAC1D,IAAI,QAAQ,IAAI,eAAe,IAAI,OAAO,eAAe,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC9E,gCAAgC;YAChC,MAAM,OAAO,GAAG,eAAyC,CAAC;YAC1D,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC7B,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;YACjD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;YAC/C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;YAC3C,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,gDAAgD;YAChD,IAAI,CAAC,MAAM,GAAG,eAAyB,CAAC;QAC1C,CAAC;IACH,CAAC;IAED;;OAEG;IACH,yBAAyB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IACpD,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACH,kBAAkB,CAAC,MAAc;QAC/B,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,wBAAwB;QACtB,OAAO,CAAC,CAAC,CACP,IAAI,CAAC,eAAe;YACpB,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CACtD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tasks Module
|
|
3
|
+
*
|
|
4
|
+
* Provides integration with Claude Code's Tasks system.
|
|
5
|
+
* Exports the core classes for task coordination, pipeline management,
|
|
6
|
+
* worker mode execution, and unified state management.
|
|
7
|
+
*/
|
|
8
|
+
export { TaskCoordinator } from "./coordinator.js";
|
|
9
|
+
export { PipelineManager } from "./pipeline-manager.js";
|
|
10
|
+
export { WorkerMode } from "./worker-mode.js";
|
|
11
|
+
export { StateCoordinator, type TaskState, type StateEvents } from "./state-coordinator.js";
|
|
12
|
+
export { PersistentStateCoordinator } from "./persistent-state-coordinator.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tasks Module
|
|
3
|
+
*
|
|
4
|
+
* Provides integration with Claude Code's Tasks system.
|
|
5
|
+
* Exports the core classes for task coordination, pipeline management,
|
|
6
|
+
* worker mode execution, and unified state management.
|
|
7
|
+
*/
|
|
8
|
+
export { TaskCoordinator } from "./coordinator.js";
|
|
9
|
+
export { PipelineManager } from "./pipeline-manager.js";
|
|
10
|
+
export { WorkerMode } from "./worker-mode.js";
|
|
11
|
+
export { StateCoordinator } from "./state-coordinator.js";
|
|
12
|
+
export { PersistentStateCoordinator } from "./persistent-state-coordinator.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAoC,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent State Coordinator
|
|
3
|
+
*
|
|
4
|
+
* Extends StateCoordinator to automatically persist all state changes
|
|
5
|
+
* to disk using StateStore. Supports state restoration on initialization.
|
|
6
|
+
*/
|
|
7
|
+
import { StateCoordinator } from './state-coordinator.js';
|
|
8
|
+
import { StateStore } from '../persistence/state-store.js';
|
|
9
|
+
/**
|
|
10
|
+
* PersistentStateCoordinator extends StateCoordinator with automatic
|
|
11
|
+
* state persistence. All state changes are automatically saved to disk
|
|
12
|
+
* via the StateStore, and state is restored on initialization.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const stateStore = new StateStore({ stateDir: '.agent-foundry' });
|
|
17
|
+
* const coordinator = new PersistentStateCoordinator(stateStore, '/path/to/repo');
|
|
18
|
+
*
|
|
19
|
+
* await coordinator.initialize();
|
|
20
|
+
*
|
|
21
|
+
* // All state changes are automatically persisted
|
|
22
|
+
* coordinator.createTask('task-1', 'coder');
|
|
23
|
+
* coordinator.startTask('task-1');
|
|
24
|
+
*
|
|
25
|
+
* // Clean shutdown ensures all pending writes complete
|
|
26
|
+
* await coordinator.shutdown();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class PersistentStateCoordinator extends StateCoordinator {
|
|
30
|
+
private readonly stateStore;
|
|
31
|
+
private readonly repoPath;
|
|
32
|
+
private initialized;
|
|
33
|
+
constructor(stateStore: StateStore, repoPath: string);
|
|
34
|
+
/**
|
|
35
|
+
* Initialize the coordinator - load persisted state and restore it.
|
|
36
|
+
*/
|
|
37
|
+
initialize(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Check if the coordinator has been initialized.
|
|
40
|
+
*/
|
|
41
|
+
isInitialized(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Setup event listeners to persist state changes.
|
|
44
|
+
* Called in constructor before initialize.
|
|
45
|
+
*/
|
|
46
|
+
private setupPersistenceHooks;
|
|
47
|
+
/**
|
|
48
|
+
* Restore in-memory state from persisted state.
|
|
49
|
+
* Handles stale/orphaned entries gracefully.
|
|
50
|
+
*/
|
|
51
|
+
private restoreFromPersistedState;
|
|
52
|
+
/**
|
|
53
|
+
* Persist a newly created task.
|
|
54
|
+
*/
|
|
55
|
+
private persistTaskCreated;
|
|
56
|
+
/**
|
|
57
|
+
* Persist a task status update.
|
|
58
|
+
*/
|
|
59
|
+
private persistTaskUpdated;
|
|
60
|
+
/**
|
|
61
|
+
* Persist a worktree link.
|
|
62
|
+
*/
|
|
63
|
+
private persistWorktreeLink;
|
|
64
|
+
/**
|
|
65
|
+
* Persist a worktree unlink.
|
|
66
|
+
*/
|
|
67
|
+
private persistWorktreeUnlink;
|
|
68
|
+
/**
|
|
69
|
+
* Persist a conflict detection.
|
|
70
|
+
*/
|
|
71
|
+
private persistConflictDetected;
|
|
72
|
+
/**
|
|
73
|
+
* Persist a conflict resolution.
|
|
74
|
+
*/
|
|
75
|
+
private persistConflictResolved;
|
|
76
|
+
/**
|
|
77
|
+
* Convert TaskState to PersistedTaskState.
|
|
78
|
+
*/
|
|
79
|
+
private toPersistedTask;
|
|
80
|
+
/**
|
|
81
|
+
* Shutdown the coordinator and ensure all state is persisted.
|
|
82
|
+
*/
|
|
83
|
+
shutdown(): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Force an immediate save of all pending state changes.
|
|
86
|
+
*/
|
|
87
|
+
saveNow(): Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=persistent-state-coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistent-state-coordinator.d.ts","sourceRoot":"","sources":["../../src/tasks/persistent-state-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAkB,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAY3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,0BAA2B,SAAQ,gBAAgB;IAC9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,WAAW,CAAkB;gBAEzB,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAOpD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBjC;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAqC7B;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAoGjC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiC3B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAqB7B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAwB/B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAmB/B;;OAEG;IACH,OAAO,CAAC,eAAe;IAgBvB;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAW/B;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|