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
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentRouter Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for the AgentRouter MCP server.
|
|
5
|
+
* These types define the data structures for configuration, agents,
|
|
6
|
+
* messages, providers, and MCP tools.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Root configuration object for AgentRouter.
|
|
10
|
+
* Loaded from YAML config file with environment variable interpolation.
|
|
11
|
+
*/
|
|
12
|
+
export interface Config {
|
|
13
|
+
/** Configuration schema version (e.g., "1.0") */
|
|
14
|
+
version: string;
|
|
15
|
+
/** Default values applied to all roles unless overridden */
|
|
16
|
+
defaults: DefaultConfig;
|
|
17
|
+
/** Role definitions mapping role names to their configurations */
|
|
18
|
+
roles: Record<string, RoleConfig>;
|
|
19
|
+
/** Provider configurations mapping provider names to their settings */
|
|
20
|
+
providers: Record<string, ProviderConfig>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Default configuration values applied to all roles.
|
|
24
|
+
* Individual roles can override these values.
|
|
25
|
+
*/
|
|
26
|
+
export interface DefaultConfig {
|
|
27
|
+
/** Default temperature for LLM requests (0-2) */
|
|
28
|
+
temperature: number;
|
|
29
|
+
/** Default maximum tokens for LLM responses */
|
|
30
|
+
max_tokens: number;
|
|
31
|
+
/** Default timeout in milliseconds for LLM requests */
|
|
32
|
+
timeout_ms: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for a specific agent role.
|
|
36
|
+
* Defines the provider, model, and optional overrides for a role.
|
|
37
|
+
*/
|
|
38
|
+
export interface RoleConfig {
|
|
39
|
+
/** Provider name (must match a key in config.providers) */
|
|
40
|
+
provider: string;
|
|
41
|
+
/** Model identifier to use with the provider */
|
|
42
|
+
model: string;
|
|
43
|
+
/** System prompt / persona for this role */
|
|
44
|
+
system_prompt?: string;
|
|
45
|
+
/** Temperature override for this role (0-2) */
|
|
46
|
+
temperature?: number;
|
|
47
|
+
/** Max tokens override for this role */
|
|
48
|
+
max_tokens?: number;
|
|
49
|
+
/** Timeout override in milliseconds for this role */
|
|
50
|
+
timeout_ms?: number;
|
|
51
|
+
/** Fallback configuration if primary provider fails */
|
|
52
|
+
fallback?: FallbackConfig;
|
|
53
|
+
/** Whether this role needs an isolated git worktree for file modifications */
|
|
54
|
+
needs_worktree?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Fallback provider configuration.
|
|
58
|
+
* Used when the primary provider fails or is unavailable.
|
|
59
|
+
*/
|
|
60
|
+
export interface FallbackConfig {
|
|
61
|
+
/** Fallback provider name */
|
|
62
|
+
provider: string;
|
|
63
|
+
/** Fallback model identifier */
|
|
64
|
+
model: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Access mode for providers.
|
|
68
|
+
* - "api": Uses API key with pay-per-token pricing
|
|
69
|
+
* - "subscription": Uses CLI tool with subscription (Claude Code, Codex CLI, Gemini CLI, etc.)
|
|
70
|
+
*/
|
|
71
|
+
export type AccessMode = "api" | "subscription";
|
|
72
|
+
/**
|
|
73
|
+
* Provider-specific configuration.
|
|
74
|
+
* Contains credentials and settings for connecting to an LLM provider.
|
|
75
|
+
*/
|
|
76
|
+
export interface ProviderConfig {
|
|
77
|
+
/** Access mode: "api" (pay-per-token) or "subscription" (CLI tools) */
|
|
78
|
+
access_mode?: AccessMode;
|
|
79
|
+
/** API key for authentication (supports ${ENV_VAR} interpolation) */
|
|
80
|
+
api_key?: string;
|
|
81
|
+
/** Base URL for the provider API (for self-hosted or proxy setups) */
|
|
82
|
+
base_url?: string;
|
|
83
|
+
/** Default model for this provider */
|
|
84
|
+
default_model?: string;
|
|
85
|
+
/** Organization ID (OpenAI) */
|
|
86
|
+
organization?: string;
|
|
87
|
+
/** Project ID (Google Cloud / Vertex AI) */
|
|
88
|
+
project?: string;
|
|
89
|
+
/** Region/location (Google Cloud / Vertex AI) */
|
|
90
|
+
location?: string;
|
|
91
|
+
/** Additional headers to include in API requests */
|
|
92
|
+
headers?: Record<string, string>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Predefined agent roles.
|
|
96
|
+
* These represent specialized AI agents with specific capabilities.
|
|
97
|
+
*/
|
|
98
|
+
export type AgentRole = 'coder' | 'critic' | 'designer' | 'researcher' | 'reviewer';
|
|
99
|
+
/**
|
|
100
|
+
* Resolved agent configuration.
|
|
101
|
+
* Created by merging role config with defaults.
|
|
102
|
+
* All optional fields from RoleConfig become required here.
|
|
103
|
+
*/
|
|
104
|
+
export interface AgentConfig {
|
|
105
|
+
/** Provider name */
|
|
106
|
+
provider: string;
|
|
107
|
+
/** Model identifier */
|
|
108
|
+
model: string;
|
|
109
|
+
/** System prompt / persona */
|
|
110
|
+
system_prompt?: string;
|
|
111
|
+
/** Temperature (always resolved, never undefined) */
|
|
112
|
+
temperature: number;
|
|
113
|
+
/** Max tokens (always resolved, never undefined) */
|
|
114
|
+
max_tokens: number;
|
|
115
|
+
/** Timeout in milliseconds (always resolved, never undefined) */
|
|
116
|
+
timeout_ms: number;
|
|
117
|
+
/** Fallback configuration if available */
|
|
118
|
+
fallback?: FallbackConfig;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Input parameters for invoking an agent.
|
|
122
|
+
*/
|
|
123
|
+
export interface InvokeAgentInput {
|
|
124
|
+
/** Role name of the agent to invoke */
|
|
125
|
+
role: string;
|
|
126
|
+
/** Task description or question for the agent */
|
|
127
|
+
task: string;
|
|
128
|
+
/** Optional additional context from the conversation */
|
|
129
|
+
context?: string;
|
|
130
|
+
/** Optional tools to make available to the agent */
|
|
131
|
+
tools?: Tool[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Response from an agent invocation.
|
|
135
|
+
*/
|
|
136
|
+
export interface AgentResponse {
|
|
137
|
+
/** Role that was invoked */
|
|
138
|
+
role: string;
|
|
139
|
+
/** Provider that handled the request */
|
|
140
|
+
provider: string;
|
|
141
|
+
/** Model that generated the response */
|
|
142
|
+
model: string;
|
|
143
|
+
/** Response content blocks */
|
|
144
|
+
content: ContentBlock[];
|
|
145
|
+
/** Token usage information */
|
|
146
|
+
usage?: UsageInfo;
|
|
147
|
+
/** Request metadata */
|
|
148
|
+
metadata: {
|
|
149
|
+
/** Unique trace ID for this request */
|
|
150
|
+
traceId: string;
|
|
151
|
+
/** Total duration in milliseconds */
|
|
152
|
+
durationMs: number;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Chat message in the conversation.
|
|
157
|
+
* Used for building request messages to providers.
|
|
158
|
+
*/
|
|
159
|
+
export interface Message {
|
|
160
|
+
/** Message role: user or assistant */
|
|
161
|
+
role: 'user' | 'assistant';
|
|
162
|
+
/** Message content (string or content blocks) */
|
|
163
|
+
content: string | ContentBlock[];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Content block within a message.
|
|
167
|
+
* Supports text, tool use requests, and tool results.
|
|
168
|
+
*/
|
|
169
|
+
export interface ContentBlock {
|
|
170
|
+
/** Type of content block */
|
|
171
|
+
type: 'text' | 'tool_use' | 'tool_result';
|
|
172
|
+
/** Text content (for type: "text") */
|
|
173
|
+
text?: string;
|
|
174
|
+
/** Tool use ID (for type: "tool_use") */
|
|
175
|
+
id?: string;
|
|
176
|
+
/** Tool name (for type: "tool_use") */
|
|
177
|
+
name?: string;
|
|
178
|
+
/** Tool input parameters (for type: "tool_use") */
|
|
179
|
+
input?: Record<string, unknown>;
|
|
180
|
+
/** Reference to tool_use ID (for type: "tool_result") */
|
|
181
|
+
tool_use_id?: string;
|
|
182
|
+
/** Tool result content (for type: "tool_result") */
|
|
183
|
+
content?: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Tool definition for agent tool use.
|
|
187
|
+
* Follows the Anthropic tool schema format.
|
|
188
|
+
*/
|
|
189
|
+
export interface Tool {
|
|
190
|
+
/** Tool name (must be unique within a request) */
|
|
191
|
+
name: string;
|
|
192
|
+
/** Human-readable description of what the tool does */
|
|
193
|
+
description: string;
|
|
194
|
+
/** JSON Schema for the tool's input parameters */
|
|
195
|
+
input_schema: {
|
|
196
|
+
type: 'object';
|
|
197
|
+
properties: Record<string, unknown>;
|
|
198
|
+
required?: string[];
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Supported LLM provider types.
|
|
203
|
+
*/
|
|
204
|
+
export type ProviderType = 'anthropic' | 'openai' | 'google' | 'deepseek' | 'zai' | 'kimi' | 'ollama' | 'openrouter';
|
|
205
|
+
/**
|
|
206
|
+
* Request to complete a conversation.
|
|
207
|
+
* Sent to providers after translation.
|
|
208
|
+
*/
|
|
209
|
+
export interface CompletionRequest {
|
|
210
|
+
/** Model identifier */
|
|
211
|
+
model: string;
|
|
212
|
+
/** Conversation messages */
|
|
213
|
+
messages: Message[];
|
|
214
|
+
/** Temperature for response generation (0-2) */
|
|
215
|
+
temperature?: number;
|
|
216
|
+
/** Maximum tokens to generate */
|
|
217
|
+
max_tokens?: number;
|
|
218
|
+
/** Timeout in milliseconds for this request */
|
|
219
|
+
timeout_ms?: number;
|
|
220
|
+
/** Tools available for the model to use */
|
|
221
|
+
tools?: Tool[];
|
|
222
|
+
/** Whether to stream the response */
|
|
223
|
+
stream?: boolean;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Response from a completion request.
|
|
227
|
+
* Normalized format returned by all providers.
|
|
228
|
+
*/
|
|
229
|
+
export interface CompletionResponse {
|
|
230
|
+
/** Unique response ID from the provider */
|
|
231
|
+
id: string;
|
|
232
|
+
/** Response content blocks */
|
|
233
|
+
content: ContentBlock[];
|
|
234
|
+
/** Model that generated the response */
|
|
235
|
+
model: string;
|
|
236
|
+
/** Reason the generation stopped (e.g., "end_turn", "tool_use") */
|
|
237
|
+
stop_reason: string;
|
|
238
|
+
/** Token usage information */
|
|
239
|
+
usage?: UsageInfo;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Token usage information for a request/response.
|
|
243
|
+
*/
|
|
244
|
+
export interface UsageInfo {
|
|
245
|
+
/** Number of tokens in the input/prompt */
|
|
246
|
+
input_tokens: number;
|
|
247
|
+
/** Number of tokens in the output/completion */
|
|
248
|
+
output_tokens: number;
|
|
249
|
+
/** Tokens used to create prompt cache (Anthropic) */
|
|
250
|
+
cache_creation_input_tokens?: number;
|
|
251
|
+
/** Tokens read from prompt cache (Anthropic) */
|
|
252
|
+
cache_read_input_tokens?: number;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Provider interface that all provider adapters must implement.
|
|
256
|
+
*/
|
|
257
|
+
export interface Provider {
|
|
258
|
+
/** Provider name identifier */
|
|
259
|
+
name: string;
|
|
260
|
+
/** Execute a completion request and return the full response */
|
|
261
|
+
complete(request: CompletionRequest): Promise<CompletionResponse>;
|
|
262
|
+
/** Execute a streaming completion request */
|
|
263
|
+
completeStream(request: CompletionRequest): AsyncIterable<StreamChunk>;
|
|
264
|
+
/** Check if the provider is available and configured correctly */
|
|
265
|
+
healthCheck(): Promise<void>;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Chunk of a streaming response.
|
|
269
|
+
*/
|
|
270
|
+
export interface StreamChunk {
|
|
271
|
+
/** Type of streaming event */
|
|
272
|
+
type: 'content_block_start' | 'content_block_delta' | 'message_stop';
|
|
273
|
+
/** Index of the content block (for multi-block responses) */
|
|
274
|
+
index?: number;
|
|
275
|
+
/** Content block being started (for content_block_start) */
|
|
276
|
+
content_block?: ContentBlock;
|
|
277
|
+
/** Delta update to content (for content_block_delta) */
|
|
278
|
+
delta?: {
|
|
279
|
+
type: string;
|
|
280
|
+
text?: string;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Input schema for the invoke_agent MCP tool.
|
|
285
|
+
*/
|
|
286
|
+
export interface InvokeAgentToolInput {
|
|
287
|
+
/** The agent role to invoke */
|
|
288
|
+
role: AgentRole | string;
|
|
289
|
+
/** The task description or question for the agent */
|
|
290
|
+
task: string;
|
|
291
|
+
/** Optional additional context from the current conversation */
|
|
292
|
+
context?: string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Input schema for the compare_agents MCP tool.
|
|
296
|
+
*/
|
|
297
|
+
export interface CompareAgentsToolInput {
|
|
298
|
+
/** List of role names to compare */
|
|
299
|
+
roles: string[];
|
|
300
|
+
/** The task to send to all agents */
|
|
301
|
+
task: string;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Input schema for the critique_plan MCP tool.
|
|
305
|
+
* Shorthand for invoking the critic role.
|
|
306
|
+
*/
|
|
307
|
+
export interface CritiquePlanToolInput {
|
|
308
|
+
/** The plan or PRD to critique */
|
|
309
|
+
plan: string;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Input schema for the review_code MCP tool.
|
|
313
|
+
* Shorthand for invoking the reviewer role.
|
|
314
|
+
*/
|
|
315
|
+
export interface ReviewCodeToolInput {
|
|
316
|
+
/** The code to review */
|
|
317
|
+
code: string;
|
|
318
|
+
/** Optional context about the code (language, purpose, etc.) */
|
|
319
|
+
context?: string;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Input schema for the design_feedback MCP tool.
|
|
323
|
+
* Shorthand for invoking the designer role.
|
|
324
|
+
*/
|
|
325
|
+
export interface DesignFeedbackToolInput {
|
|
326
|
+
/** The design to review (description, wireframe, mockup) */
|
|
327
|
+
design: string;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Output schema for the list_agents MCP tool.
|
|
331
|
+
*/
|
|
332
|
+
export interface ListAgentsToolOutput {
|
|
333
|
+
/** List of available agent roles */
|
|
334
|
+
roles: {
|
|
335
|
+
/** Role name */
|
|
336
|
+
name: string;
|
|
337
|
+
/** Provider configured for this role */
|
|
338
|
+
provider: string;
|
|
339
|
+
/** Model configured for this role */
|
|
340
|
+
model: string;
|
|
341
|
+
/** Whether a fallback is configured */
|
|
342
|
+
hasFallback: boolean;
|
|
343
|
+
}[];
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Base error class for AgentRouter errors.
|
|
347
|
+
*/
|
|
348
|
+
export declare class AgentRouterError extends Error {
|
|
349
|
+
readonly code: string;
|
|
350
|
+
constructor(message: string, code: string, cause?: Error);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Error thrown when configuration is invalid.
|
|
354
|
+
*/
|
|
355
|
+
export declare class ConfigurationError extends AgentRouterError {
|
|
356
|
+
constructor(message: string, cause?: Error);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Error thrown when a provider API call fails.
|
|
360
|
+
*/
|
|
361
|
+
export declare class ProviderError extends AgentRouterError {
|
|
362
|
+
readonly provider: string;
|
|
363
|
+
readonly statusCode?: number | undefined;
|
|
364
|
+
constructor(message: string, provider: string, statusCode?: number | undefined, cause?: Error);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Error thrown when hitting rate limits.
|
|
368
|
+
*/
|
|
369
|
+
export declare class RateLimitError extends ProviderError {
|
|
370
|
+
readonly retryAfterMs?: number | undefined;
|
|
371
|
+
constructor(provider: string, retryAfterMs?: number | undefined, cause?: Error);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Error thrown when authentication fails.
|
|
375
|
+
*/
|
|
376
|
+
export declare class AuthenticationError extends ProviderError {
|
|
377
|
+
constructor(provider: string, cause?: Error);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Error thrown when a request times out.
|
|
381
|
+
*/
|
|
382
|
+
export declare class TimeoutError extends ProviderError {
|
|
383
|
+
constructor(provider: string, timeoutMs: number, cause?: Error);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Error thrown when message/tool translation fails.
|
|
387
|
+
*/
|
|
388
|
+
export declare class TranslationError extends AgentRouterError {
|
|
389
|
+
readonly sourceFormat: string;
|
|
390
|
+
readonly targetFormat: string;
|
|
391
|
+
constructor(message: string, sourceFormat: string, targetFormat: string, cause?: Error);
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Execution state for a task being processed by AgentRouter.
|
|
395
|
+
*/
|
|
396
|
+
export interface TaskExecution {
|
|
397
|
+
/** Claude Code task ID */
|
|
398
|
+
taskId: string;
|
|
399
|
+
/** Agent role used for execution */
|
|
400
|
+
role: string;
|
|
401
|
+
/** Unique trace ID for this execution */
|
|
402
|
+
traceId: string;
|
|
403
|
+
/** Execution start timestamp */
|
|
404
|
+
startTime: number;
|
|
405
|
+
/** Execution end timestamp (set on completion/failure) */
|
|
406
|
+
endTime?: number;
|
|
407
|
+
/** Current execution status */
|
|
408
|
+
status: 'running' | 'completed' | 'failed';
|
|
409
|
+
/** Agent response on success */
|
|
410
|
+
result?: AgentResponse;
|
|
411
|
+
/** Error details on failure */
|
|
412
|
+
error?: Error;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Instructions for Claude to execute task lifecycle operations.
|
|
416
|
+
* MCP tools cannot directly call Claude Code tools, so they return
|
|
417
|
+
* instruction strings that Claude must execute.
|
|
418
|
+
*/
|
|
419
|
+
export interface ClaimInstructions {
|
|
420
|
+
/** Instruction to claim the task before execution */
|
|
421
|
+
preExecution: string;
|
|
422
|
+
/** Instruction to mark task complete on success */
|
|
423
|
+
onSuccess: string;
|
|
424
|
+
/** Instruction to release task on failure */
|
|
425
|
+
onFailure: string;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Result of completing a task execution.
|
|
429
|
+
*/
|
|
430
|
+
export interface CompletionResult {
|
|
431
|
+
/** The execution record */
|
|
432
|
+
execution: TaskExecution;
|
|
433
|
+
/** Instruction for Claude to mark task complete */
|
|
434
|
+
instructions: string;
|
|
435
|
+
/** Agent response */
|
|
436
|
+
result: AgentResponse;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Result of a failed task execution.
|
|
440
|
+
*/
|
|
441
|
+
export interface FailureResult {
|
|
442
|
+
/** The execution record */
|
|
443
|
+
execution: TaskExecution;
|
|
444
|
+
/** Instruction for Claude to release the task */
|
|
445
|
+
instructions: string;
|
|
446
|
+
/** Error that caused the failure */
|
|
447
|
+
error: Error;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* A step in a multi-provider pipeline.
|
|
451
|
+
*/
|
|
452
|
+
export interface PipelineStep {
|
|
453
|
+
/** Unique step identifier within the pipeline */
|
|
454
|
+
name: string;
|
|
455
|
+
/** Task subject line (imperative form) */
|
|
456
|
+
subject: string;
|
|
457
|
+
/** Detailed task description */
|
|
458
|
+
description?: string;
|
|
459
|
+
/** AgentRouter role for execution */
|
|
460
|
+
role: AgentRole | string;
|
|
461
|
+
/** Names of steps this step depends on */
|
|
462
|
+
dependsOn?: string[];
|
|
463
|
+
/** Additional context for this step's agent */
|
|
464
|
+
context?: string;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Definition of a multi-step task pipeline.
|
|
468
|
+
*/
|
|
469
|
+
export interface PipelineDefinition {
|
|
470
|
+
/** Pipeline name for identification */
|
|
471
|
+
name: string;
|
|
472
|
+
/** Pipeline steps in declaration order */
|
|
473
|
+
steps: PipelineStep[];
|
|
474
|
+
/** Context passed to all steps */
|
|
475
|
+
globalContext?: string;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Execution state for a pipeline.
|
|
479
|
+
*/
|
|
480
|
+
export interface PipelineExecution {
|
|
481
|
+
/** Unique pipeline execution ID */
|
|
482
|
+
pipelineId: string;
|
|
483
|
+
/** Pipeline definition */
|
|
484
|
+
definition: PipelineDefinition;
|
|
485
|
+
/** Mapping from step name to Claude Code task ID */
|
|
486
|
+
taskIdMap: Map<string, string>;
|
|
487
|
+
/** Overall pipeline status */
|
|
488
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
489
|
+
/** Pipeline start timestamp */
|
|
490
|
+
startTime: number;
|
|
491
|
+
/** Set of completed step names */
|
|
492
|
+
completedSteps: Set<string>;
|
|
493
|
+
/** Results from completed steps */
|
|
494
|
+
results: Map<string, AgentResponse>;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Configuration for a background worker.
|
|
498
|
+
*/
|
|
499
|
+
export interface WorkerConfig {
|
|
500
|
+
/** Worker name for identification and ownership */
|
|
501
|
+
name: string;
|
|
502
|
+
/** Only claim tasks for these roles (empty = any) */
|
|
503
|
+
allowedRoles?: AgentRole[];
|
|
504
|
+
/** Maximum concurrent task executions (default: 1) */
|
|
505
|
+
maxConcurrent?: number;
|
|
506
|
+
/** Heartbeat interval in ms (default: 30000) */
|
|
507
|
+
heartbeatMs?: number;
|
|
508
|
+
/** Shutdown after idle for this duration in ms (default: 300000) */
|
|
509
|
+
idleTimeoutMs?: number;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Current state of a background worker.
|
|
513
|
+
*/
|
|
514
|
+
export interface WorkerState {
|
|
515
|
+
/** Worker name */
|
|
516
|
+
name: string;
|
|
517
|
+
/** Current worker status */
|
|
518
|
+
status: 'idle' | 'working' | 'shutdown';
|
|
519
|
+
/** Currently executing task ID (if working) */
|
|
520
|
+
currentTask?: string;
|
|
521
|
+
/** Count of successfully completed tasks */
|
|
522
|
+
completedCount: number;
|
|
523
|
+
/** Count of failed task attempts */
|
|
524
|
+
failedCount: number;
|
|
525
|
+
/** Last heartbeat timestamp */
|
|
526
|
+
lastHeartbeat: number;
|
|
527
|
+
/** Task IDs to exclude from claiming (failed attempts) */
|
|
528
|
+
excludeTaskIds?: string[];
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Configuration for the tasks integration feature.
|
|
532
|
+
*/
|
|
533
|
+
export interface TasksConfig {
|
|
534
|
+
/** Enable task-aware tools */
|
|
535
|
+
enabled: boolean;
|
|
536
|
+
/** Default behavior settings */
|
|
537
|
+
defaults: {
|
|
538
|
+
/** Automatically mark tasks complete on success */
|
|
539
|
+
autoComplete: boolean;
|
|
540
|
+
/** Automatically release tasks on failure */
|
|
541
|
+
autoRelease: boolean;
|
|
542
|
+
/** Maximum execution time per task in ms */
|
|
543
|
+
timeoutMs: number;
|
|
544
|
+
};
|
|
545
|
+
/** Worker mode settings */
|
|
546
|
+
worker: {
|
|
547
|
+
/** Heartbeat interval in ms */
|
|
548
|
+
heartbeatMs: number;
|
|
549
|
+
/** Shutdown after idle for this duration in ms */
|
|
550
|
+
idleTimeoutMs: number;
|
|
551
|
+
/** Maximum retry attempts for failed tasks */
|
|
552
|
+
maxRetries: number;
|
|
553
|
+
};
|
|
554
|
+
/** Pipeline settings */
|
|
555
|
+
pipeline: {
|
|
556
|
+
/** Maximum concurrent pipeline steps */
|
|
557
|
+
maxParallel: number;
|
|
558
|
+
/** Execute independent steps in parallel by default */
|
|
559
|
+
defaultParallel: boolean;
|
|
560
|
+
/** Maximum context length before truncation */
|
|
561
|
+
maxContextLength: number;
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
export type WorktreeStatus = 'available' | 'assigned' | 'active' | 'completing' | 'conflict' | 'stale';
|
|
565
|
+
export interface Worktree {
|
|
566
|
+
id: string;
|
|
567
|
+
path: string;
|
|
568
|
+
branch: string;
|
|
569
|
+
baseBranch: string;
|
|
570
|
+
status: WorktreeStatus;
|
|
571
|
+
taskId?: string;
|
|
572
|
+
agentId?: string;
|
|
573
|
+
createdAt: number;
|
|
574
|
+
lastActivityAt: number;
|
|
575
|
+
}
|
|
576
|
+
export interface WorktreeInstructions {
|
|
577
|
+
workingDirectory: string;
|
|
578
|
+
branch: string;
|
|
579
|
+
baseBranch: string;
|
|
580
|
+
commitPrefix: string;
|
|
581
|
+
instructions: string;
|
|
582
|
+
}
|
|
583
|
+
export interface WorktreeConfig {
|
|
584
|
+
enabled: boolean;
|
|
585
|
+
baseDir: string;
|
|
586
|
+
limits: {
|
|
587
|
+
maxWorktrees: number;
|
|
588
|
+
maxDiskBytes: number;
|
|
589
|
+
};
|
|
590
|
+
pool: {
|
|
591
|
+
enabled: boolean;
|
|
592
|
+
size: number;
|
|
593
|
+
};
|
|
594
|
+
git: {
|
|
595
|
+
defaultBaseBranch: string;
|
|
596
|
+
branchPattern: string;
|
|
597
|
+
autoMerge: boolean;
|
|
598
|
+
conflictStrategy: 'merge' | 'rebase' | 'ours' | 'theirs' | 'manual';
|
|
599
|
+
};
|
|
600
|
+
cleanup: {
|
|
601
|
+
staleThresholdMs: number;
|
|
602
|
+
autoCleanup: boolean;
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
export interface TaskExecutionWithWorktree {
|
|
606
|
+
taskId: string;
|
|
607
|
+
role: string;
|
|
608
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
609
|
+
worktree?: Worktree;
|
|
610
|
+
requiresWorktree: boolean;
|
|
611
|
+
worktreeInstructions?: WorktreeInstructions;
|
|
612
|
+
startedAt?: number;
|
|
613
|
+
completedAt?: number;
|
|
614
|
+
result?: string;
|
|
615
|
+
error?: string;
|
|
616
|
+
}
|
|
617
|
+
export interface PipelineStepWithWorktree {
|
|
618
|
+
id: string;
|
|
619
|
+
name: string;
|
|
620
|
+
role: string;
|
|
621
|
+
needsWorktree?: boolean;
|
|
622
|
+
autoMerge?: boolean;
|
|
623
|
+
dependsOn?: string[];
|
|
624
|
+
}
|
|
625
|
+
export interface WorktreeAllocationResult {
|
|
626
|
+
success: boolean;
|
|
627
|
+
worktree?: Worktree;
|
|
628
|
+
instructions?: WorktreeInstructions;
|
|
629
|
+
error?: string;
|
|
630
|
+
}
|
|
631
|
+
export interface MergeResult {
|
|
632
|
+
success: boolean;
|
|
633
|
+
conflicted: boolean;
|
|
634
|
+
conflictedFiles?: string[];
|
|
635
|
+
mergeCommit?: string;
|
|
636
|
+
error?: string;
|
|
637
|
+
}
|
|
638
|
+
export interface StepWorktreeAllocation {
|
|
639
|
+
stepId: string;
|
|
640
|
+
worktreeId: string;
|
|
641
|
+
worktreePath: string;
|
|
642
|
+
branch: string;
|
|
643
|
+
status: 'pending' | 'allocated' | 'active' | 'completed' | 'merged' | 'conflict';
|
|
644
|
+
allocatedAt?: number;
|
|
645
|
+
mergedAt?: number;
|
|
646
|
+
}
|
|
647
|
+
export interface PipelineWorktreeState {
|
|
648
|
+
pipelineId: string;
|
|
649
|
+
stepWorktrees: Map<string, StepWorktreeAllocation>;
|
|
650
|
+
mergeOrder: string[][];
|
|
651
|
+
mergeProgress: {
|
|
652
|
+
phase: 'executing' | 'merging' | 'completed' | 'conflict' | 'failed';
|
|
653
|
+
currentBatch: number;
|
|
654
|
+
mergedSteps: string[];
|
|
655
|
+
conflictedSteps: string[];
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
export interface PipelineMergeResult {
|
|
659
|
+
pipelineId: string;
|
|
660
|
+
success: boolean;
|
|
661
|
+
mergedSteps: Array<{
|
|
662
|
+
stepId: string;
|
|
663
|
+
branch: string;
|
|
664
|
+
mergeCommit?: string;
|
|
665
|
+
}>;
|
|
666
|
+
conflicts: Array<{
|
|
667
|
+
stepId: string;
|
|
668
|
+
branch: string;
|
|
669
|
+
conflictedFiles: string[];
|
|
670
|
+
error?: string;
|
|
671
|
+
}>;
|
|
672
|
+
completedAt: number;
|
|
673
|
+
}
|
|
674
|
+
export interface PipelineWorktreeConfig {
|
|
675
|
+
enabled: boolean;
|
|
676
|
+
autoMerge: boolean;
|
|
677
|
+
mergeStrategy: 'sequential' | 'parallel-safe';
|
|
678
|
+
conflictResolution: 'halt' | 'skip' | 'manual';
|
|
679
|
+
cleanupOnSuccess: boolean;
|
|
680
|
+
preserveOnConflict: boolean;
|
|
681
|
+
}
|
|
682
|
+
export type ConflictResolutionStrategy = 'ours' | 'theirs' | 'auto' | 'manual';
|
|
683
|
+
export interface ConflictMarker {
|
|
684
|
+
file: string;
|
|
685
|
+
startLine: number;
|
|
686
|
+
endLine: number;
|
|
687
|
+
oursContent: string;
|
|
688
|
+
theirsContent: string;
|
|
689
|
+
oursLabel: string;
|
|
690
|
+
theirsLabel: string;
|
|
691
|
+
}
|
|
692
|
+
export interface FileConflict {
|
|
693
|
+
file: string;
|
|
694
|
+
conflicts: ConflictMarker[];
|
|
695
|
+
totalConflicts: number;
|
|
696
|
+
}
|
|
697
|
+
export interface ConflictState {
|
|
698
|
+
taskId: string;
|
|
699
|
+
worktreeId: string;
|
|
700
|
+
detectedAt: number;
|
|
701
|
+
files: FileConflict[];
|
|
702
|
+
totalConflicts: number;
|
|
703
|
+
resolved: boolean;
|
|
704
|
+
resolutionStrategy?: ConflictResolutionStrategy;
|
|
705
|
+
resolvedAt?: number;
|
|
706
|
+
}
|
|
707
|
+
export interface ConflictResolutionResult {
|
|
708
|
+
success: boolean;
|
|
709
|
+
strategy: ConflictResolutionStrategy;
|
|
710
|
+
resolvedFiles: string[];
|
|
711
|
+
remainingConflicts: FileConflict[];
|
|
712
|
+
error?: string;
|
|
713
|
+
}
|
|
714
|
+
export interface ManualResolution {
|
|
715
|
+
file: string;
|
|
716
|
+
resolvedContent: string;
|
|
717
|
+
}
|
|
718
|
+
export interface ResourceLimits {
|
|
719
|
+
maxWorktrees: number;
|
|
720
|
+
maxDiskMB: number;
|
|
721
|
+
cleanupThresholdMB: number;
|
|
722
|
+
maxIdleTimeMs: number;
|
|
723
|
+
}
|
|
724
|
+
export interface ResourceUsage {
|
|
725
|
+
currentWorktrees: number;
|
|
726
|
+
availableSlots: number;
|
|
727
|
+
diskUsageMB: number;
|
|
728
|
+
oldestWorktreeAge: number;
|
|
729
|
+
}
|
|
730
|
+
export interface WorktreeMetrics {
|
|
731
|
+
id: string;
|
|
732
|
+
path: string;
|
|
733
|
+
branch: string;
|
|
734
|
+
status: WorktreeStatus;
|
|
735
|
+
taskId?: string;
|
|
736
|
+
createdAt: number;
|
|
737
|
+
lastActivityAt: number;
|
|
738
|
+
diskUsageMB?: number;
|
|
739
|
+
}
|
|
740
|
+
export interface ResourceReport {
|
|
741
|
+
usage: ResourceUsage;
|
|
742
|
+
limits: ResourceLimits;
|
|
743
|
+
worktrees: WorktreeMetrics[];
|
|
744
|
+
staleCount: number;
|
|
745
|
+
shouldCleanup: boolean;
|
|
746
|
+
}
|
|
747
|
+
//# sourceMappingURL=types.d.ts.map
|