@specforge/mcp 2.6.0 → 3.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/README.md +73 -0
- package/bin/{specforge-mcp → specforge} +0 -5
- package/dist/ai-provider/circuit-breaker.d.ts +63 -0
- package/dist/ai-provider/circuit-breaker.d.ts.map +1 -0
- package/dist/ai-provider/circuit-breaker.js +160 -0
- package/dist/ai-provider/circuit-breaker.js.map +1 -0
- package/dist/ai-provider/cli-version.d.ts +50 -0
- package/dist/ai-provider/cli-version.d.ts.map +1 -0
- package/dist/ai-provider/cli-version.js +141 -0
- package/dist/ai-provider/cli-version.js.map +1 -0
- package/dist/ai-provider/config-loader.d.ts +45 -0
- package/dist/ai-provider/config-loader.d.ts.map +1 -0
- package/dist/ai-provider/config-loader.js +106 -0
- package/dist/ai-provider/config-loader.js.map +1 -0
- package/dist/ai-provider/errors.d.ts +48 -0
- package/dist/ai-provider/errors.d.ts.map +1 -0
- package/dist/ai-provider/errors.js +102 -0
- package/dist/ai-provider/errors.js.map +1 -0
- package/dist/ai-provider/events.d.ts +73 -0
- package/dist/ai-provider/events.d.ts.map +1 -0
- package/dist/ai-provider/events.js +75 -0
- package/dist/ai-provider/events.js.map +1 -0
- package/dist/ai-provider/factory.d.ts +31 -0
- package/dist/ai-provider/factory.d.ts.map +1 -0
- package/dist/ai-provider/factory.js +100 -0
- package/dist/ai-provider/factory.js.map +1 -0
- package/dist/ai-provider/index.d.ts +24 -0
- package/dist/ai-provider/index.d.ts.map +1 -0
- package/dist/ai-provider/index.js +46 -0
- package/dist/ai-provider/index.js.map +1 -0
- package/dist/ai-provider/instance-coordinator.d.ts +54 -0
- package/dist/ai-provider/instance-coordinator.d.ts.map +1 -0
- package/dist/ai-provider/instance-coordinator.js +199 -0
- package/dist/ai-provider/instance-coordinator.js.map +1 -0
- package/dist/ai-provider/jsonl-parser.d.ts +43 -0
- package/dist/ai-provider/jsonl-parser.d.ts.map +1 -0
- package/dist/ai-provider/jsonl-parser.js +107 -0
- package/dist/ai-provider/jsonl-parser.js.map +1 -0
- package/dist/ai-provider/lifecycle.d.ts +50 -0
- package/dist/ai-provider/lifecycle.d.ts.map +1 -0
- package/dist/ai-provider/lifecycle.js +145 -0
- package/dist/ai-provider/lifecycle.js.map +1 -0
- package/dist/ai-provider/logger.d.ts +69 -0
- package/dist/ai-provider/logger.d.ts.map +1 -0
- package/dist/ai-provider/logger.js +161 -0
- package/dist/ai-provider/logger.js.map +1 -0
- package/dist/ai-provider/metrics.d.ts +91 -0
- package/dist/ai-provider/metrics.d.ts.map +1 -0
- package/dist/ai-provider/metrics.js +187 -0
- package/dist/ai-provider/metrics.js.map +1 -0
- package/dist/ai-provider/process-manager.d.ts +97 -0
- package/dist/ai-provider/process-manager.d.ts.map +1 -0
- package/dist/ai-provider/process-manager.js +477 -0
- package/dist/ai-provider/process-manager.js.map +1 -0
- package/dist/ai-provider/providers/claude-code.d.ts +64 -0
- package/dist/ai-provider/providers/claude-code.d.ts.map +1 -0
- package/dist/ai-provider/providers/claude-code.js +205 -0
- package/dist/ai-provider/providers/claude-code.js.map +1 -0
- package/dist/ai-provider/retry-executor.d.ts +52 -0
- package/dist/ai-provider/retry-executor.d.ts.map +1 -0
- package/dist/ai-provider/retry-executor.js +138 -0
- package/dist/ai-provider/retry-executor.js.map +1 -0
- package/dist/ai-provider/safe-args.d.ts +58 -0
- package/dist/ai-provider/safe-args.d.ts.map +1 -0
- package/dist/ai-provider/safe-args.js +176 -0
- package/dist/ai-provider/safe-args.js.map +1 -0
- package/dist/ai-provider/semaphore.d.ts +50 -0
- package/dist/ai-provider/semaphore.d.ts.map +1 -0
- package/dist/ai-provider/semaphore.js +97 -0
- package/dist/ai-provider/semaphore.js.map +1 -0
- package/dist/ai-provider/tracer.d.ts +67 -0
- package/dist/ai-provider/tracer.d.ts.map +1 -0
- package/dist/ai-provider/tracer.js +209 -0
- package/dist/ai-provider/tracer.js.map +1 -0
- package/dist/ai-provider/types.d.ts +181 -0
- package/dist/ai-provider/types.d.ts.map +1 -0
- package/dist/ai-provider/types.js +8 -0
- package/dist/ai-provider/types.js.map +1 -0
- package/dist/autopilot/agents/agent-runner.d.ts +109 -0
- package/dist/autopilot/agents/agent-runner.d.ts.map +1 -0
- package/dist/autopilot/agents/agent-runner.js +731 -0
- package/dist/autopilot/agents/agent-runner.js.map +1 -0
- package/dist/autopilot/agents/agent-selector.d.ts +59 -0
- package/dist/autopilot/agents/agent-selector.d.ts.map +1 -0
- package/dist/autopilot/agents/agent-selector.js +234 -0
- package/dist/autopilot/agents/agent-selector.js.map +1 -0
- package/dist/autopilot/agents/model-selector.d.ts +49 -0
- package/dist/autopilot/agents/model-selector.d.ts.map +1 -0
- package/dist/autopilot/agents/model-selector.js +62 -0
- package/dist/autopilot/agents/model-selector.js.map +1 -0
- package/dist/autopilot/agents/profiles/builtin.d.ts +55 -0
- package/dist/autopilot/agents/profiles/builtin.d.ts.map +1 -0
- package/dist/autopilot/agents/profiles/builtin.js +323 -0
- package/dist/autopilot/agents/profiles/builtin.js.map +1 -0
- package/dist/autopilot/agents/profiles/types.d.ts +98 -0
- package/dist/autopilot/agents/profiles/types.d.ts.map +1 -0
- package/dist/autopilot/agents/profiles/types.js +17 -0
- package/dist/autopilot/agents/profiles/types.js.map +1 -0
- package/dist/autopilot/api/autopilot-api-client.d.ts +217 -0
- package/dist/autopilot/api/autopilot-api-client.d.ts.map +1 -0
- package/dist/autopilot/api/autopilot-api-client.js +402 -0
- package/dist/autopilot/api/autopilot-api-client.js.map +1 -0
- package/dist/autopilot/cli/abort.d.ts +20 -0
- package/dist/autopilot/cli/abort.d.ts.map +1 -0
- package/dist/autopilot/cli/abort.js +201 -0
- package/dist/autopilot/cli/abort.js.map +1 -0
- package/dist/autopilot/cli/display.d.ts +63 -0
- package/dist/autopilot/cli/display.d.ts.map +1 -0
- package/dist/autopilot/cli/display.js +260 -0
- package/dist/autopilot/cli/display.js.map +1 -0
- package/dist/autopilot/cli/index.d.ts +24 -0
- package/dist/autopilot/cli/index.d.ts.map +1 -0
- package/dist/autopilot/cli/index.js +79 -0
- package/dist/autopilot/cli/index.js.map +1 -0
- package/dist/autopilot/cli/pause.d.ts +18 -0
- package/dist/autopilot/cli/pause.d.ts.map +1 -0
- package/dist/autopilot/cli/pause.js +110 -0
- package/dist/autopilot/cli/pause.js.map +1 -0
- package/dist/autopilot/cli/resume.d.ts +22 -0
- package/dist/autopilot/cli/resume.d.ts.map +1 -0
- package/dist/autopilot/cli/resume.js +172 -0
- package/dist/autopilot/cli/resume.js.map +1 -0
- package/dist/autopilot/cli/run.d.ts +25 -0
- package/dist/autopilot/cli/run.d.ts.map +1 -0
- package/dist/autopilot/cli/run.js +220 -0
- package/dist/autopilot/cli/run.js.map +1 -0
- package/dist/autopilot/cli/status.d.ts +20 -0
- package/dist/autopilot/cli/status.d.ts.map +1 -0
- package/dist/autopilot/cli/status.js +217 -0
- package/dist/autopilot/cli/status.js.map +1 -0
- package/dist/autopilot/config.d.ts +45 -0
- package/dist/autopilot/config.d.ts.map +1 -0
- package/dist/autopilot/config.js +269 -0
- package/dist/autopilot/config.js.map +1 -0
- package/dist/autopilot/core/dependency-resolver.d.ts +108 -0
- package/dist/autopilot/core/dependency-resolver.d.ts.map +1 -0
- package/dist/autopilot/core/dependency-resolver.js +394 -0
- package/dist/autopilot/core/dependency-resolver.js.map +1 -0
- package/dist/autopilot/core/dispatcher.d.ts +215 -0
- package/dist/autopilot/core/dispatcher.d.ts.map +1 -0
- package/dist/autopilot/core/dispatcher.js +594 -0
- package/dist/autopilot/core/dispatcher.js.map +1 -0
- package/dist/autopilot/core/failure-handler.d.ts +145 -0
- package/dist/autopilot/core/failure-handler.d.ts.map +1 -0
- package/dist/autopilot/core/failure-handler.js +308 -0
- package/dist/autopilot/core/failure-handler.js.map +1 -0
- package/dist/autopilot/core/rate-limit-handler.d.ts +108 -0
- package/dist/autopilot/core/rate-limit-handler.d.ts.map +1 -0
- package/dist/autopilot/core/rate-limit-handler.js +195 -0
- package/dist/autopilot/core/rate-limit-handler.js.map +1 -0
- package/dist/autopilot/core/state-manager.d.ts +160 -0
- package/dist/autopilot/core/state-manager.d.ts.map +1 -0
- package/dist/autopilot/core/state-manager.js +393 -0
- package/dist/autopilot/core/state-manager.js.map +1 -0
- package/dist/autopilot/core/timeout-manager.d.ts +95 -0
- package/dist/autopilot/core/timeout-manager.d.ts.map +1 -0
- package/dist/autopilot/core/timeout-manager.js +188 -0
- package/dist/autopilot/core/timeout-manager.js.map +1 -0
- package/dist/autopilot/git/branch-manager.d.ts +117 -0
- package/dist/autopilot/git/branch-manager.d.ts.map +1 -0
- package/dist/autopilot/git/branch-manager.js +238 -0
- package/dist/autopilot/git/branch-manager.js.map +1 -0
- package/dist/autopilot/git/index.d.ts +9 -0
- package/dist/autopilot/git/index.d.ts.map +1 -0
- package/dist/autopilot/git/index.js +9 -0
- package/dist/autopilot/git/index.js.map +1 -0
- package/dist/autopilot/git/merge-manager.d.ts +118 -0
- package/dist/autopilot/git/merge-manager.d.ts.map +1 -0
- package/dist/autopilot/git/merge-manager.js +304 -0
- package/dist/autopilot/git/merge-manager.js.map +1 -0
- package/dist/autopilot/git/worktree-manager.d.ts +128 -0
- package/dist/autopilot/git/worktree-manager.d.ts.map +1 -0
- package/dist/autopilot/git/worktree-manager.js +298 -0
- package/dist/autopilot/git/worktree-manager.js.map +1 -0
- package/dist/autopilot/index.d.ts +30 -0
- package/dist/autopilot/index.d.ts.map +1 -0
- package/dist/autopilot/index.js +55 -0
- package/dist/autopilot/index.js.map +1 -0
- package/dist/autopilot/sync/index.d.ts +7 -0
- package/dist/autopilot/sync/index.d.ts.map +1 -0
- package/dist/autopilot/sync/index.js +7 -0
- package/dist/autopilot/sync/index.js.map +1 -0
- package/dist/autopilot/sync/sync-manager.d.ts +168 -0
- package/dist/autopilot/sync/sync-manager.d.ts.map +1 -0
- package/dist/autopilot/sync/sync-manager.js +303 -0
- package/dist/autopilot/sync/sync-manager.js.map +1 -0
- package/dist/autopilot/types.d.ts +454 -0
- package/dist/autopilot/types.d.ts.map +1 -0
- package/dist/autopilot/types.js +26 -0
- package/dist/autopilot/types.js.map +1 -0
- package/dist/autopilot/utils/audit-logger.d.ts +176 -0
- package/dist/autopilot/utils/audit-logger.d.ts.map +1 -0
- package/dist/autopilot/utils/audit-logger.js +308 -0
- package/dist/autopilot/utils/audit-logger.js.map +1 -0
- package/dist/autopilot/utils/cost-tracker.d.ts +162 -0
- package/dist/autopilot/utils/cost-tracker.d.ts.map +1 -0
- package/dist/autopilot/utils/cost-tracker.js +269 -0
- package/dist/autopilot/utils/cost-tracker.js.map +1 -0
- package/dist/autopilot/utils/index.d.ts +9 -0
- package/dist/autopilot/utils/index.d.ts.map +1 -0
- package/dist/autopilot/utils/index.js +9 -0
- package/dist/autopilot/utils/index.js.map +1 -0
- package/dist/autopilot/utils/progress-reporter.d.ts +132 -0
- package/dist/autopilot/utils/progress-reporter.d.ts.map +1 -0
- package/dist/autopilot/utils/progress-reporter.js +290 -0
- package/dist/autopilot/utils/progress-reporter.js.map +1 -0
- package/dist/autopilot/worker/worker-pool.d.ts +179 -0
- package/dist/autopilot/worker/worker-pool.d.ts.map +1 -0
- package/dist/autopilot/worker/worker-pool.js +331 -0
- package/dist/autopilot/worker/worker-pool.js.map +1 -0
- package/dist/autopilot/worker/worker-session.d.ts +171 -0
- package/dist/autopilot/worker/worker-session.d.ts.map +1 -0
- package/dist/autopilot/worker/worker-session.js +295 -0
- package/dist/autopilot/worker/worker-session.js.map +1 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +4 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/core/epic.js +1 -1
- package/dist/tools/core/epic.js.map +1 -1
- package/dist/tools/core/lookup.d.ts.map +1 -1
- package/dist/tools/core/lookup.js +3 -2
- package/dist/tools/core/lookup.js.map +1 -1
- package/dist/tools/core/specification.js +1 -1
- package/dist/tools/core/specification.js.map +1 -1
- package/dist/tools/core/ticket.d.ts.map +1 -1
- package/dist/tools/core/ticket.js +4 -6
- package/dist/tools/core/ticket.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +60 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +4 -1
- package/dist/validation/index.js.map +1 -1
- package/package.json +8 -4
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code Provider
|
|
3
|
+
*
|
|
4
|
+
* Main provider implementation for Claude Code CLI mode.
|
|
5
|
+
*/
|
|
6
|
+
import { createProcessManager } from '../process-manager.js';
|
|
7
|
+
import { createLifecycleManager } from '../lifecycle.js';
|
|
8
|
+
import { createLogger } from '../logger.js';
|
|
9
|
+
const logger = createLogger('ClaudeCodeProvider');
|
|
10
|
+
/**
|
|
11
|
+
* Claude Code Provider Implementation.
|
|
12
|
+
*/
|
|
13
|
+
export class ClaudeCodeProvider {
|
|
14
|
+
config;
|
|
15
|
+
processManager;
|
|
16
|
+
lifecycleManager;
|
|
17
|
+
initialized = false;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.config = config;
|
|
20
|
+
this.processManager = createProcessManager({
|
|
21
|
+
maxParallel: config.maxParallelProcesses,
|
|
22
|
+
timeoutMs: config.requestTimeoutSeconds * 1000,
|
|
23
|
+
workingDirectory: config.workingDirectory || process.cwd(),
|
|
24
|
+
maxRetries: config.maxRetries,
|
|
25
|
+
circuitBreakerThreshold: config.circuitBreakerThreshold ?? 5,
|
|
26
|
+
dangerouslySkipPermissions: config.dangerouslySkipPermissions,
|
|
27
|
+
});
|
|
28
|
+
this.lifecycleManager = createLifecycleManager(this.processManager);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Initialize the provider.
|
|
32
|
+
*/
|
|
33
|
+
async initialize() {
|
|
34
|
+
if (this.initialized) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
logger.info('Initializing Claude Code provider', {
|
|
38
|
+
maxParallel: this.config.maxParallelProcesses,
|
|
39
|
+
timeout: this.config.requestTimeoutSeconds,
|
|
40
|
+
});
|
|
41
|
+
// Verify CLI is available and authenticated
|
|
42
|
+
const authCheck = await this.processManager.checkAuth();
|
|
43
|
+
if (!authCheck.authenticated) {
|
|
44
|
+
logger.warn('Claude Code CLI not authenticated', {
|
|
45
|
+
error: authCheck.error,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
logger.info('Claude Code provider initialized', {
|
|
50
|
+
cliVersion: authCheck.cliVersion,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
this.initialized = true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get provider mode.
|
|
57
|
+
*/
|
|
58
|
+
getMode() {
|
|
59
|
+
return 'claude_code';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get provider status.
|
|
63
|
+
*/
|
|
64
|
+
async getStatus() {
|
|
65
|
+
const authCheck = await this.processManager.checkAuth();
|
|
66
|
+
const status = this.processManager.getStatus();
|
|
67
|
+
return {
|
|
68
|
+
mode: 'claude_code',
|
|
69
|
+
isConfigured: true,
|
|
70
|
+
isAuthenticated: authCheck.authenticated,
|
|
71
|
+
isRateLimited: status.isRateLimited,
|
|
72
|
+
rateLimitMessage: status.isRateLimited
|
|
73
|
+
? 'Account usage limit reached'
|
|
74
|
+
: undefined,
|
|
75
|
+
suggestion: !authCheck.authenticated
|
|
76
|
+
? 'Please run: claude login'
|
|
77
|
+
: status.isRateLimited
|
|
78
|
+
? 'Please run: claude login (with a different account)'
|
|
79
|
+
: undefined,
|
|
80
|
+
cliVersion: authCheck.cliVersion,
|
|
81
|
+
activeProcesses: status.activeProcesses,
|
|
82
|
+
maxParallelProcesses: this.config.maxParallelProcesses,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Test the provider connection.
|
|
87
|
+
*/
|
|
88
|
+
async test(options) {
|
|
89
|
+
const prompt = options?.prompt || 'Say "Hello!" and tell me your model name in one sentence.';
|
|
90
|
+
const startTime = Date.now();
|
|
91
|
+
logger.debug('Testing provider', { prompt: prompt.substring(0, 50) });
|
|
92
|
+
// Check authentication first
|
|
93
|
+
const authCheck = await this.processManager.checkAuth();
|
|
94
|
+
if (!authCheck.authenticated) {
|
|
95
|
+
return {
|
|
96
|
+
success: false,
|
|
97
|
+
mode: 'claude_code',
|
|
98
|
+
error: authCheck.error || 'Not authenticated',
|
|
99
|
+
suggestion: 'Please run: claude login',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
// Run the test prompt
|
|
103
|
+
const result = await this.processManager.run(prompt, {
|
|
104
|
+
timeout: 30000, // 30 second timeout for tests
|
|
105
|
+
});
|
|
106
|
+
const durationMs = Date.now() - startTime;
|
|
107
|
+
if (!result.success) {
|
|
108
|
+
return {
|
|
109
|
+
success: false,
|
|
110
|
+
mode: 'claude_code',
|
|
111
|
+
error: result.error,
|
|
112
|
+
suggestion: result.suggestion,
|
|
113
|
+
durationMs,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// Try to extract model name from response
|
|
117
|
+
const modelMatch = result.output?.match(/claude[-\s]?([\w.-]+)/i);
|
|
118
|
+
const model = modelMatch ? `claude-${modelMatch[1]}` : undefined;
|
|
119
|
+
return {
|
|
120
|
+
success: true,
|
|
121
|
+
mode: 'claude_code',
|
|
122
|
+
model,
|
|
123
|
+
durationMs: result.durationMs || durationMs,
|
|
124
|
+
response: result.output,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Run a prompt.
|
|
129
|
+
*/
|
|
130
|
+
async run(prompt, options) {
|
|
131
|
+
logger.debug('Running prompt', {
|
|
132
|
+
promptLength: prompt.length,
|
|
133
|
+
workingDirectory: options?.workingDirectory,
|
|
134
|
+
});
|
|
135
|
+
// Check authentication
|
|
136
|
+
const authCheck = await this.processManager.checkAuth();
|
|
137
|
+
if (!authCheck.authenticated) {
|
|
138
|
+
logger.warn('Auth check failed', { error: authCheck.error });
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
output: '',
|
|
142
|
+
error: 'Not authenticated',
|
|
143
|
+
errorType: 'auth',
|
|
144
|
+
suggestion: 'Please run: claude login',
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
logger.debug('Auth check passed', { cliVersion: authCheck.cliVersion });
|
|
148
|
+
// Run the prompt
|
|
149
|
+
const result = await this.processManager.run(prompt, {
|
|
150
|
+
workingDirectory: options?.workingDirectory,
|
|
151
|
+
timeout: options?.timeout,
|
|
152
|
+
model: options?.model,
|
|
153
|
+
sessionId: options?.sessionId,
|
|
154
|
+
});
|
|
155
|
+
logger.debug('Prompt execution completed', {
|
|
156
|
+
success: result.success,
|
|
157
|
+
outputLength: result.output?.length ?? 0,
|
|
158
|
+
error: result.error,
|
|
159
|
+
durationMs: result.durationMs,
|
|
160
|
+
sessionId: options?.sessionId,
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
success: result.success,
|
|
164
|
+
output: result.output || '',
|
|
165
|
+
model: result.model,
|
|
166
|
+
durationMs: result.durationMs,
|
|
167
|
+
sessionId: options?.sessionId,
|
|
168
|
+
error: result.error,
|
|
169
|
+
errorType: result.errorType,
|
|
170
|
+
suggestion: result.suggestion,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Reset rate limit flag.
|
|
175
|
+
*/
|
|
176
|
+
resetRateLimitFlag() {
|
|
177
|
+
this.processManager.resetRateLimitFlag();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get health check information.
|
|
181
|
+
*/
|
|
182
|
+
async healthCheck() {
|
|
183
|
+
return this.processManager.healthCheck();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get metrics.
|
|
187
|
+
*/
|
|
188
|
+
getMetrics() {
|
|
189
|
+
return this.processManager.getMetrics();
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Shutdown the provider.
|
|
193
|
+
*/
|
|
194
|
+
async shutdown() {
|
|
195
|
+
logger.info('Shutting down Claude Code provider');
|
|
196
|
+
await this.processManager.shutdown();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Create a Claude Code provider.
|
|
201
|
+
*/
|
|
202
|
+
export function createClaudeCodeProvider(config) {
|
|
203
|
+
return new ClaudeCodeProvider(config);
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../src/ai-provider/providers/claude-code.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAA4B,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAA2B,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,MAAM,MAAM,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAKT;IAJZ,cAAc,CAA2B;IACzC,gBAAgB,CAA0B;IAC1C,WAAW,GAAY,KAAK,CAAC;IAErC,YAAoB,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;QAC1C,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC;YACzC,WAAW,EAAE,MAAM,CAAC,oBAAoB;YACxC,SAAS,EAAE,MAAM,CAAC,qBAAqB,GAAG,IAAI;YAC9C,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,EAAE;YAC1D,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,uBAAuB,EAAE,MAAM,CAAC,uBAAuB,IAAI,CAAC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Z,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAwB;IAExB,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry Executor with Exponential Backoff
|
|
3
|
+
*
|
|
4
|
+
* Handles retries with exponential backoff and jitter.
|
|
5
|
+
*/
|
|
6
|
+
import type { RetryConfig } from './types.js';
|
|
7
|
+
export declare class RetryExecutor {
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config: RetryConfig);
|
|
10
|
+
/**
|
|
11
|
+
* Execute a function with retry logic.
|
|
12
|
+
*
|
|
13
|
+
* @param fn - The function to execute
|
|
14
|
+
* @param isRetryable - Function to determine if an error is retryable
|
|
15
|
+
* @returns The result of fn
|
|
16
|
+
* @throws The last error if all retries fail
|
|
17
|
+
*/
|
|
18
|
+
execute<T>(fn: () => Promise<T>, isRetryable: (error: Error) => boolean): Promise<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Execute with a custom abort signal.
|
|
21
|
+
*/
|
|
22
|
+
executeWithAbort<T>(fn: () => Promise<T>, isRetryable: (error: Error) => boolean, signal: AbortSignal): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Calculate delay with exponential backoff and jitter.
|
|
25
|
+
*/
|
|
26
|
+
private calculateDelay;
|
|
27
|
+
/**
|
|
28
|
+
* Sleep for a given duration.
|
|
29
|
+
*/
|
|
30
|
+
private sleep;
|
|
31
|
+
/**
|
|
32
|
+
* Sleep with abort signal support.
|
|
33
|
+
*/
|
|
34
|
+
private sleepWithAbort;
|
|
35
|
+
/**
|
|
36
|
+
* Get the configuration.
|
|
37
|
+
*/
|
|
38
|
+
getConfig(): RetryConfig;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a retry executor with default configuration.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createRetryExecutor(config?: Partial<RetryConfig>): RetryExecutor;
|
|
44
|
+
/**
|
|
45
|
+
* Simple retry wrapper for common use cases.
|
|
46
|
+
*/
|
|
47
|
+
export declare function withRetry<T>(fn: () => Promise<T>, options?: {
|
|
48
|
+
maxRetries?: number;
|
|
49
|
+
baseDelayMs?: number;
|
|
50
|
+
isRetryable?: (error: Error) => boolean;
|
|
51
|
+
}): Promise<T>;
|
|
52
|
+
//# sourceMappingURL=retry-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-executor.d.ts","sourceRoot":"","sources":["../../src/ai-provider/retry-executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAK9C,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEvC;;;;;;;OAOG;IACG,OAAO,CAAC,CAAC,EACb,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,GACrC,OAAO,CAAC,CAAC,CAAC;IAuCb;;OAEG;IACG,gBAAgB,CAAC,CAAC,EACtB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,EACtC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,CAAC,CAAC;IA2Bb;;OAEG;IACH,OAAO,CAAC,cAAc;IAetB;;OAEG;IACH,OAAO,CAAC,KAAK;IAIb;;OAEG;IACH,OAAO,CAAC,cAAc;IAWtB;;OAEG;IACH,SAAS,IAAI,WAAW;CAGzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC5B,aAAa,CAOf;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;CACzC,GACA,OAAO,CAAC,CAAC,CAAC,CAUZ"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry Executor with Exponential Backoff
|
|
3
|
+
*
|
|
4
|
+
* Handles retries with exponential backoff and jitter.
|
|
5
|
+
*/
|
|
6
|
+
import { createLogger } from './logger.js';
|
|
7
|
+
const logger = createLogger('RetryExecutor');
|
|
8
|
+
export class RetryExecutor {
|
|
9
|
+
config;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Execute a function with retry logic.
|
|
15
|
+
*
|
|
16
|
+
* @param fn - The function to execute
|
|
17
|
+
* @param isRetryable - Function to determine if an error is retryable
|
|
18
|
+
* @returns The result of fn
|
|
19
|
+
* @throws The last error if all retries fail
|
|
20
|
+
*/
|
|
21
|
+
async execute(fn, isRetryable) {
|
|
22
|
+
let lastError = null;
|
|
23
|
+
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
|
24
|
+
try {
|
|
25
|
+
return await fn();
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
lastError = error;
|
|
29
|
+
if (attempt >= this.config.maxRetries) {
|
|
30
|
+
logger.warn('All retries exhausted', {
|
|
31
|
+
attempts: attempt + 1,
|
|
32
|
+
error: lastError.message,
|
|
33
|
+
});
|
|
34
|
+
throw lastError;
|
|
35
|
+
}
|
|
36
|
+
if (!isRetryable(lastError)) {
|
|
37
|
+
logger.debug('Error is not retryable', {
|
|
38
|
+
attempt,
|
|
39
|
+
error: lastError.message,
|
|
40
|
+
});
|
|
41
|
+
throw lastError;
|
|
42
|
+
}
|
|
43
|
+
const delay = this.calculateDelay(attempt);
|
|
44
|
+
logger.debug('Retrying after delay', {
|
|
45
|
+
attempt,
|
|
46
|
+
delay,
|
|
47
|
+
error: lastError.message,
|
|
48
|
+
});
|
|
49
|
+
await this.sleep(delay);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
throw lastError;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Execute with a custom abort signal.
|
|
56
|
+
*/
|
|
57
|
+
async executeWithAbort(fn, isRetryable, signal) {
|
|
58
|
+
let lastError = null;
|
|
59
|
+
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
|
60
|
+
if (signal.aborted) {
|
|
61
|
+
throw new Error('Execution aborted');
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
return await fn();
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
lastError = error;
|
|
68
|
+
if (attempt >= this.config.maxRetries || !isRetryable(lastError)) {
|
|
69
|
+
throw lastError;
|
|
70
|
+
}
|
|
71
|
+
const delay = this.calculateDelay(attempt);
|
|
72
|
+
// Wait with abort support
|
|
73
|
+
await this.sleepWithAbort(delay, signal);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
throw lastError;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Calculate delay with exponential backoff and jitter.
|
|
80
|
+
*/
|
|
81
|
+
calculateDelay(attempt) {
|
|
82
|
+
// Exponential backoff: baseDelay * 2^attempt
|
|
83
|
+
const exponentialDelay = this.config.baseDelayMs * Math.pow(2, attempt);
|
|
84
|
+
// Cap at maximum delay
|
|
85
|
+
const cappedDelay = Math.min(exponentialDelay, this.config.maxDelayMs);
|
|
86
|
+
// Add jitter (default 10%)
|
|
87
|
+
const jitter = this.config.jitterFactor ?? 0.1;
|
|
88
|
+
const jitterRange = cappedDelay * jitter;
|
|
89
|
+
const randomJitter = Math.random() * jitterRange - jitterRange / 2;
|
|
90
|
+
return Math.round(cappedDelay + randomJitter);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Sleep for a given duration.
|
|
94
|
+
*/
|
|
95
|
+
sleep(ms) {
|
|
96
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Sleep with abort signal support.
|
|
100
|
+
*/
|
|
101
|
+
sleepWithAbort(ms, signal) {
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
const timeout = setTimeout(resolve, ms);
|
|
104
|
+
signal.addEventListener('abort', () => {
|
|
105
|
+
clearTimeout(timeout);
|
|
106
|
+
reject(new Error('Sleep aborted'));
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get the configuration.
|
|
112
|
+
*/
|
|
113
|
+
getConfig() {
|
|
114
|
+
return { ...this.config };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a retry executor with default configuration.
|
|
119
|
+
*/
|
|
120
|
+
export function createRetryExecutor(config) {
|
|
121
|
+
return new RetryExecutor({
|
|
122
|
+
maxRetries: config?.maxRetries ?? 3,
|
|
123
|
+
baseDelayMs: config?.baseDelayMs ?? 1000,
|
|
124
|
+
maxDelayMs: config?.maxDelayMs ?? 30000,
|
|
125
|
+
jitterFactor: config?.jitterFactor ?? 0.1,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Simple retry wrapper for common use cases.
|
|
130
|
+
*/
|
|
131
|
+
export async function withRetry(fn, options) {
|
|
132
|
+
const executor = createRetryExecutor({
|
|
133
|
+
maxRetries: options?.maxRetries,
|
|
134
|
+
baseDelayMs: options?.baseDelayMs,
|
|
135
|
+
});
|
|
136
|
+
return executor.execute(fn, options?.isRetryable ?? (() => true));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=retry-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-executor.js","sourceRoot":"","sources":["../../src/ai-provider/retry-executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAE7C,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAE3C;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CACX,EAAoB,EACpB,WAAsC;QAEtC,IAAI,SAAS,GAAiB,IAAI,CAAC;QAEnC,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;YACnE,IAAI,CAAC;gBACH,OAAO,MAAM,EAAE,EAAE,CAAC;YACpB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,SAAS,GAAG,KAAc,CAAC;gBAE3B,IAAI,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;oBACtC,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE;wBACnC,QAAQ,EAAE,OAAO,GAAG,CAAC;wBACrB,KAAK,EAAE,SAAS,CAAC,OAAO;qBACzB,CAAC,CAAC;oBACH,MAAM,SAAS,CAAC;gBAClB,CAAC;gBAED,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;oBAC5B,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE;wBACrC,OAAO;wBACP,KAAK,EAAE,SAAS,CAAC,OAAO;qBACzB,CAAC,CAAC;oBACH,MAAM,SAAS,CAAC;gBAClB,CAAC;gBAED,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,O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,WAAW,IAAI,IAAI;QACxC,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,KAAK;QACvC,YAAY,EAAE,MAAM,EAAE,YAAY,IAAI,GAAG;KAC1C,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,EAAoB,EACpB,OAIC;IAED,MAAM,QAAQ,GAAG,mBAAmB,CAAC;QACnC,UAAU,EAAE,OAAO,EAAE,UAAU;QAC/B,WAAW,EAAE,OAAO,EAAE,WAAW;KAClC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,OAAO,CACrB,EAAE,EACF,OAAO,EAAE,WAAW,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe Argument Builder
|
|
3
|
+
*
|
|
4
|
+
* Input sanitization to prevent command injection.
|
|
5
|
+
*/
|
|
6
|
+
export interface BuildOptions {
|
|
7
|
+
print?: boolean;
|
|
8
|
+
outputFormat?: 'json' | 'text' | 'stream-json';
|
|
9
|
+
prompt: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
maxTokens?: number;
|
|
12
|
+
temperature?: number;
|
|
13
|
+
systemPrompt?: string;
|
|
14
|
+
allowedTools?: string[];
|
|
15
|
+
dangerouslySkipPermissions?: boolean;
|
|
16
|
+
/** Session ID for linking to JSONL logs (used for token tracking) */
|
|
17
|
+
sessionId?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class SafeArgumentBuilder {
|
|
20
|
+
/**
|
|
21
|
+
* Build command line arguments for Claude CLI.
|
|
22
|
+
*/
|
|
23
|
+
static build(options: BuildOptions): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Sanitize input string by removing dangerous characters.
|
|
26
|
+
*/
|
|
27
|
+
static sanitize(input: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Validate a simple value (no shell metacharacters).
|
|
30
|
+
*/
|
|
31
|
+
static validateSimpleValue(value: string, fieldName: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Validate a prompt (allows newlines but not shell metacharacters).
|
|
34
|
+
*/
|
|
35
|
+
static validatePrompt(prompt: string, fieldName: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Validate input length.
|
|
38
|
+
*/
|
|
39
|
+
private static validateLength;
|
|
40
|
+
/**
|
|
41
|
+
* Validate working directory path.
|
|
42
|
+
*/
|
|
43
|
+
static validateWorkingDirectory(dir: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Escape a string for safe use in shell (if absolutely necessary).
|
|
46
|
+
* Prefer using spawn with args array instead of shell execution.
|
|
47
|
+
*/
|
|
48
|
+
static escapeForShell(input: string): string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Convenience function to build arguments.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildSafeArgs(options: BuildOptions): string[];
|
|
54
|
+
/**
|
|
55
|
+
* Convenience function to validate working directory.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isValidWorkingDirectory(dir: string): boolean;
|
|
58
|
+
//# sourceMappingURL=safe-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-args.d.ts","sourceRoot":"","sources":["../../src/ai-provider/safe-args.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsBH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,EAAE;IAqE7C;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAatC;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAYlE;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAe9D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAM7B;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAyBrD;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAI7C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,EAAE,CAE7D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe Argument Builder
|
|
3
|
+
*
|
|
4
|
+
* Input sanitization to prevent command injection.
|
|
5
|
+
*/
|
|
6
|
+
import { InputValidationError } from './errors.js';
|
|
7
|
+
/**
|
|
8
|
+
* Dangerous patterns that could lead to command injection.
|
|
9
|
+
*/
|
|
10
|
+
const DANGEROUS_PATTERNS = [
|
|
11
|
+
/[;&|`$(){}[\]<>]/, // Shell metacharacters
|
|
12
|
+
/\0/, // Null bytes
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Maximum allowed input length.
|
|
16
|
+
*/
|
|
17
|
+
const MAX_INPUT_LENGTH = 1_000_000;
|
|
18
|
+
/**
|
|
19
|
+
* Maximum allowed prompt length for CLI.
|
|
20
|
+
*/
|
|
21
|
+
const MAX_PROMPT_LENGTH = 500_000;
|
|
22
|
+
export class SafeArgumentBuilder {
|
|
23
|
+
/**
|
|
24
|
+
* Build command line arguments for Claude CLI.
|
|
25
|
+
*/
|
|
26
|
+
static build(options) {
|
|
27
|
+
const args = [];
|
|
28
|
+
// Print mode (non-interactive)
|
|
29
|
+
if (options.print) {
|
|
30
|
+
args.push('--print');
|
|
31
|
+
}
|
|
32
|
+
// Output format
|
|
33
|
+
if (options.outputFormat) {
|
|
34
|
+
this.validateSimpleValue(options.outputFormat, 'outputFormat');
|
|
35
|
+
args.push('--output-format', options.outputFormat);
|
|
36
|
+
}
|
|
37
|
+
// Model selection
|
|
38
|
+
if (options.model) {
|
|
39
|
+
this.validateSimpleValue(options.model, 'model');
|
|
40
|
+
args.push('--model', options.model);
|
|
41
|
+
}
|
|
42
|
+
// Max tokens
|
|
43
|
+
if (options.maxTokens !== undefined) {
|
|
44
|
+
if (!Number.isInteger(options.maxTokens) || options.maxTokens < 1) {
|
|
45
|
+
throw new InputValidationError('maxTokens must be a positive integer');
|
|
46
|
+
}
|
|
47
|
+
args.push('--max-tokens', String(options.maxTokens));
|
|
48
|
+
}
|
|
49
|
+
// Temperature
|
|
50
|
+
if (options.temperature !== undefined) {
|
|
51
|
+
if (typeof options.temperature !== 'number' || options.temperature < 0 || options.temperature > 2) {
|
|
52
|
+
throw new InputValidationError('temperature must be a number between 0 and 2');
|
|
53
|
+
}
|
|
54
|
+
args.push('--temperature', String(options.temperature));
|
|
55
|
+
}
|
|
56
|
+
// System prompt
|
|
57
|
+
if (options.systemPrompt) {
|
|
58
|
+
this.validatePrompt(options.systemPrompt, 'systemPrompt');
|
|
59
|
+
args.push('--system-prompt', options.systemPrompt);
|
|
60
|
+
}
|
|
61
|
+
// Allowed tools
|
|
62
|
+
if (options.allowedTools && options.allowedTools.length > 0) {
|
|
63
|
+
for (const tool of options.allowedTools) {
|
|
64
|
+
this.validateSimpleValue(tool, 'allowedTools');
|
|
65
|
+
}
|
|
66
|
+
args.push('--allowedTools', options.allowedTools.join(','));
|
|
67
|
+
}
|
|
68
|
+
// Skip permissions (dangerous mode)
|
|
69
|
+
if (options.dangerouslySkipPermissions) {
|
|
70
|
+
args.push('--dangerously-skip-permissions');
|
|
71
|
+
}
|
|
72
|
+
// Session ID for JSONL log linking
|
|
73
|
+
if (options.sessionId) {
|
|
74
|
+
this.validateSimpleValue(options.sessionId, 'sessionId');
|
|
75
|
+
args.push('--session-id', options.sessionId);
|
|
76
|
+
}
|
|
77
|
+
// The prompt itself - validate but don't sanitize (user content)
|
|
78
|
+
// Note: prompt is a positional argument, not --prompt flag
|
|
79
|
+
this.validatePrompt(options.prompt, 'prompt');
|
|
80
|
+
args.push(options.prompt);
|
|
81
|
+
return args;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Sanitize input string by removing dangerous characters.
|
|
85
|
+
*/
|
|
86
|
+
static sanitize(input) {
|
|
87
|
+
this.validateLength(input, 'input');
|
|
88
|
+
// Check for dangerous patterns
|
|
89
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
90
|
+
if (pattern.test(input)) {
|
|
91
|
+
throw new InputValidationError('Input contains potentially dangerous characters');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return input;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Validate a simple value (no shell metacharacters).
|
|
98
|
+
*/
|
|
99
|
+
static validateSimpleValue(value, fieldName) {
|
|
100
|
+
if (!value || typeof value !== 'string') {
|
|
101
|
+
throw new InputValidationError(`${fieldName} must be a non-empty string`);
|
|
102
|
+
}
|
|
103
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
104
|
+
if (pattern.test(value)) {
|
|
105
|
+
throw new InputValidationError(`${fieldName} contains invalid characters`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validate a prompt (allows newlines but not shell metacharacters).
|
|
111
|
+
*/
|
|
112
|
+
static validatePrompt(prompt, fieldName) {
|
|
113
|
+
if (!prompt || typeof prompt !== 'string') {
|
|
114
|
+
throw new InputValidationError(`${fieldName} must be a non-empty string`);
|
|
115
|
+
}
|
|
116
|
+
if (prompt.length > MAX_PROMPT_LENGTH) {
|
|
117
|
+
throw new InputValidationError(`${fieldName} exceeds maximum length of ${MAX_PROMPT_LENGTH} characters`);
|
|
118
|
+
}
|
|
119
|
+
// Check for null bytes only (prompts can have newlines)
|
|
120
|
+
if (/\0/.test(prompt)) {
|
|
121
|
+
throw new InputValidationError(`${fieldName} contains null bytes`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Validate input length.
|
|
126
|
+
*/
|
|
127
|
+
static validateLength(input, fieldName) {
|
|
128
|
+
if (input.length > MAX_INPUT_LENGTH) {
|
|
129
|
+
throw new InputValidationError(`${fieldName} exceeds maximum length of ${MAX_INPUT_LENGTH} characters`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Validate working directory path.
|
|
134
|
+
*/
|
|
135
|
+
static validateWorkingDirectory(dir) {
|
|
136
|
+
if (!dir || typeof dir !== 'string') {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
// Prevent directory traversal
|
|
140
|
+
if (dir.includes('..')) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
// Must be absolute path (Unix or Windows)
|
|
144
|
+
if (!dir.startsWith('/') && !dir.match(/^[A-Z]:\\/i)) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
// Check for dangerous patterns
|
|
148
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
149
|
+
if (pattern.test(dir)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Escape a string for safe use in shell (if absolutely necessary).
|
|
157
|
+
* Prefer using spawn with args array instead of shell execution.
|
|
158
|
+
*/
|
|
159
|
+
static escapeForShell(input) {
|
|
160
|
+
// Replace single quotes with escaped version
|
|
161
|
+
return `'${input.replace(/'/g, "'\\''")}'`;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Convenience function to build arguments.
|
|
166
|
+
*/
|
|
167
|
+
export function buildSafeArgs(options) {
|
|
168
|
+
return SafeArgumentBuilder.build(options);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Convenience function to validate working directory.
|
|
172
|
+
*/
|
|
173
|
+
export function isValidWorkingDirectory(dir) {
|
|
174
|
+
return SafeArgumentBuilder.validateWorkingDirectory(dir);
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=safe-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-args.js","sourceRoot":"","sources":["../../src/ai-provider/safe-args.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,kBAAkB,GAAG;IACzB,kBAAkB,EAAG,uBAAuB;IAC5C,IAAI,EAAkB,aAAa;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAEnC;;GAEG;AACH,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAgBlC,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,OAAqB;QAChC,MAAM,IAAI,GAAa,EAAE,CAAC;QAE1B,+BAA+B;QAC/B,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC;QAED,gBAAgB;QAChB,IAAI,OAAO,CAAC,YAAY,EAAE,C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