@sudocode-ai/local-server 0.1.7 → 0.1.9
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 +6 -0
- package/dist/errors/agent-errors.d.ts +43 -0
- package/dist/errors/agent-errors.d.ts.map +1 -0
- package/dist/errors/agent-errors.js +69 -0
- package/dist/errors/agent-errors.js.map +1 -0
- package/dist/execution/adapters/claude-adapter.d.ts +63 -0
- package/dist/execution/adapters/claude-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/claude-adapter.js +82 -0
- package/dist/execution/adapters/claude-adapter.js.map +1 -0
- package/dist/execution/adapters/codex-adapter.d.ts +67 -0
- package/dist/execution/adapters/codex-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/codex-adapter.js +183 -0
- package/dist/execution/adapters/codex-adapter.js.map +1 -0
- package/dist/execution/adapters/codex-config-builder.d.ts +30 -0
- package/dist/execution/adapters/codex-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/codex-config-builder.js +110 -0
- package/dist/execution/adapters/codex-config-builder.js.map +1 -0
- package/dist/execution/adapters/copilot-adapter.d.ts +94 -0
- package/dist/execution/adapters/copilot-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/copilot-adapter.js +163 -0
- package/dist/execution/adapters/copilot-adapter.js.map +1 -0
- package/dist/execution/adapters/copilot-config-builder.d.ts +48 -0
- package/dist/execution/adapters/copilot-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/copilot-config-builder.js +125 -0
- package/dist/execution/adapters/copilot-config-builder.js.map +1 -0
- package/dist/execution/adapters/cursor-adapter.d.ts +66 -0
- package/dist/execution/adapters/cursor-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/cursor-adapter.js +121 -0
- package/dist/execution/adapters/cursor-adapter.js.map +1 -0
- package/dist/execution/adapters/cursor-config-builder.d.ts +29 -0
- package/dist/execution/adapters/cursor-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/cursor-config-builder.js +49 -0
- package/dist/execution/adapters/cursor-config-builder.js.map +1 -0
- package/dist/execution/adapters/shared/config-presets.d.ts +102 -0
- package/dist/execution/adapters/shared/config-presets.d.ts.map +1 -0
- package/dist/execution/adapters/shared/config-presets.js +205 -0
- package/dist/execution/adapters/shared/config-presets.js.map +1 -0
- package/dist/execution/adapters/shared/config-utils.d.ts +95 -0
- package/dist/execution/adapters/shared/config-utils.d.ts.map +1 -0
- package/dist/execution/adapters/shared/config-utils.js +163 -0
- package/dist/execution/adapters/shared/config-utils.js.map +1 -0
- package/dist/execution/adapters/shared/index.d.ts +8 -0
- package/dist/execution/adapters/shared/index.d.ts.map +1 -0
- package/dist/execution/adapters/shared/index.js +8 -0
- package/dist/execution/adapters/shared/index.js.map +1 -0
- package/dist/execution/executors/agent-executor-wrapper.d.ts +153 -0
- package/dist/execution/executors/agent-executor-wrapper.d.ts.map +1 -0
- package/dist/execution/executors/agent-executor-wrapper.js +652 -0
- package/dist/execution/executors/agent-executor-wrapper.js.map +1 -0
- package/dist/execution/executors/executor-factory.d.ts +95 -0
- package/dist/execution/executors/executor-factory.d.ts.map +1 -0
- package/dist/execution/executors/executor-factory.js +120 -0
- package/dist/execution/executors/executor-factory.js.map +1 -0
- package/dist/execution/output/ag-ui-adapter.d.ts +0 -2
- package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -1
- package/dist/execution/output/ag-ui-adapter.js +0 -2
- package/dist/execution/output/ag-ui-adapter.js.map +1 -1
- package/dist/execution/output/index.d.ts +0 -3
- package/dist/execution/output/index.d.ts.map +1 -1
- package/dist/execution/output/index.js +0 -2
- package/dist/execution/output/index.js.map +1 -1
- package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts +108 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts.map +1 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.js +321 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.js.map +1 -0
- package/dist/execution/process/builders/claude.d.ts +24 -57
- package/dist/execution/process/builders/claude.d.ts.map +1 -1
- package/dist/execution/process/builders/claude.js +153 -19
- package/dist/execution/process/builders/claude.js.map +1 -1
- package/dist/execution/transport/ipc-transport-manager.d.ts +74 -0
- package/dist/execution/transport/ipc-transport-manager.d.ts.map +1 -0
- package/dist/execution/transport/ipc-transport-manager.js +104 -0
- package/dist/execution/transport/ipc-transport-manager.js.map +1 -0
- package/dist/execution/transport/transport-manager.d.ts.map +1 -1
- package/dist/execution/transport/transport-manager.js +3 -0
- package/dist/execution/transport/transport-manager.js.map +1 -1
- package/dist/execution/worktree/conflict-detector.d.ts +85 -0
- package/dist/execution/worktree/conflict-detector.d.ts.map +1 -0
- package/dist/execution/worktree/conflict-detector.js +129 -0
- package/dist/execution/worktree/conflict-detector.js.map +1 -0
- package/dist/execution/worktree/git-cli.d.ts +9 -0
- package/dist/execution/worktree/git-cli.d.ts.map +1 -1
- package/dist/execution/worktree/git-cli.js +10 -0
- package/dist/execution/worktree/git-cli.js.map +1 -1
- package/dist/execution/worktree/git-sync-cli.d.ts +198 -0
- package/dist/execution/worktree/git-sync-cli.d.ts.map +1 -0
- package/dist/execution/worktree/git-sync-cli.js +401 -0
- package/dist/execution/worktree/git-sync-cli.js.map +1 -0
- package/dist/execution/worktree/manager.d.ts +18 -0
- package/dist/execution/worktree/manager.d.ts.map +1 -1
- package/dist/execution/worktree/manager.js +9 -3
- package/dist/execution/worktree/manager.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +124 -229
- package/dist/index.js.map +1 -1
- package/dist/middleware/project-context.d.ts +37 -0
- package/dist/middleware/project-context.d.ts.map +1 -0
- package/dist/middleware/project-context.js +91 -0
- package/dist/middleware/project-context.js.map +1 -0
- package/dist/public/assets/index-DV9Tbujb.css +1 -0
- package/dist/public/assets/index-DcDX9-Ad.js +740 -0
- package/dist/public/assets/index-DcDX9-Ad.js.map +1 -0
- package/dist/public/assets/{react-vendor-ByUx1V_q.js → react-vendor-DiL5hC7l.js} +2 -2
- package/dist/public/assets/{react-vendor-ByUx1V_q.js.map → react-vendor-DiL5hC7l.js.map} +1 -1
- package/dist/public/assets/ui-vendor-B4WMPEfa.js +54 -0
- package/dist/public/assets/ui-vendor-B4WMPEfa.js.map +1 -0
- package/dist/public/index.html +4 -4
- package/dist/routes/agents.d.ts +3 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +62 -0
- package/dist/routes/agents.js.map +1 -0
- package/dist/routes/config.d.ts +3 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +25 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/editors.d.ts +15 -0
- package/dist/routes/editors.d.ts.map +1 -0
- package/dist/routes/editors.js +98 -0
- package/dist/routes/editors.js.map +1 -0
- package/dist/routes/executions-stream.d.ts +8 -5
- package/dist/routes/executions-stream.d.ts.map +1 -1
- package/dist/routes/executions-stream.js +10 -6
- package/dist/routes/executions-stream.js.map +1 -1
- package/dist/routes/executions.d.ts +6 -10
- package/dist/routes/executions.d.ts.map +1 -1
- package/dist/routes/executions.js +792 -37
- package/dist/routes/executions.js.map +1 -1
- package/dist/routes/feedback.d.ts +3 -2
- package/dist/routes/feedback.d.ts.map +1 -1
- package/dist/routes/feedback.js +12 -10
- package/dist/routes/feedback.js.map +1 -1
- package/dist/routes/files.d.ts +18 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/files.js +89 -0
- package/dist/routes/files.js.map +1 -0
- package/dist/routes/issues.d.ts +3 -2
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +19 -18
- package/dist/routes/issues.js.map +1 -1
- package/dist/routes/projects.d.ts +11 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +447 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/relationships.d.ts +3 -2
- package/dist/routes/relationships.d.ts.map +1 -1
- package/dist/routes/relationships.js +12 -10
- package/dist/routes/relationships.js.map +1 -1
- package/dist/routes/repo-info.d.ts +3 -0
- package/dist/routes/repo-info.d.ts.map +1 -0
- package/dist/routes/repo-info.js +203 -0
- package/dist/routes/repo-info.js.map +1 -0
- package/dist/routes/specs.d.ts +3 -2
- package/dist/routes/specs.d.ts.map +1 -1
- package/dist/routes/specs.js +19 -18
- package/dist/routes/specs.js.map +1 -1
- package/dist/routes/version.d.ts +3 -0
- package/dist/routes/version.d.ts.map +1 -0
- package/dist/routes/version.js +25 -0
- package/dist/routes/version.js.map +1 -0
- package/dist/services/agent-registry.d.ts +140 -0
- package/dist/services/agent-registry.d.ts.map +1 -0
- package/dist/services/agent-registry.js +272 -0
- package/dist/services/agent-registry.js.map +1 -0
- package/dist/services/editor-service.d.ts +57 -0
- package/dist/services/editor-service.d.ts.map +1 -0
- package/dist/services/editor-service.js +204 -0
- package/dist/services/editor-service.js.map +1 -0
- package/dist/services/execution-changes-service.d.ts +110 -0
- package/dist/services/execution-changes-service.d.ts.map +1 -0
- package/dist/services/execution-changes-service.js +700 -0
- package/dist/services/execution-changes-service.js.map +1 -0
- package/dist/services/execution-lifecycle.d.ts +1 -0
- package/dist/services/execution-lifecycle.d.ts.map +1 -1
- package/dist/services/execution-lifecycle.js +37 -7
- package/dist/services/execution-lifecycle.js.map +1 -1
- package/dist/services/execution-logs-store.d.ts +75 -0
- package/dist/services/execution-logs-store.d.ts.map +1 -1
- package/dist/services/execution-logs-store.js +142 -2
- package/dist/services/execution-logs-store.js.map +1 -1
- package/dist/services/execution-service.d.ts +82 -59
- package/dist/services/execution-service.d.ts.map +1 -1
- package/dist/services/execution-service.js +514 -469
- package/dist/services/execution-service.js.map +1 -1
- package/dist/services/execution-worker-pool.d.ts +116 -0
- package/dist/services/execution-worker-pool.d.ts.map +1 -0
- package/dist/services/execution-worker-pool.js +326 -0
- package/dist/services/execution-worker-pool.js.map +1 -0
- package/dist/services/executions.d.ts +3 -0
- package/dist/services/executions.d.ts.map +1 -1
- package/dist/services/executions.js +11 -17
- package/dist/services/executions.js.map +1 -1
- package/dist/services/export.d.ts +8 -2
- package/dist/services/export.d.ts.map +1 -1
- package/dist/services/export.js +29 -23
- package/dist/services/export.js.map +1 -1
- package/dist/services/file-search/git-ls-files-strategy.d.ts +72 -0
- package/dist/services/file-search/git-ls-files-strategy.d.ts.map +1 -0
- package/dist/services/file-search/git-ls-files-strategy.js +176 -0
- package/dist/services/file-search/git-ls-files-strategy.js.map +1 -0
- package/dist/services/file-search/index.d.ts +9 -0
- package/dist/services/file-search/index.d.ts.map +1 -0
- package/dist/services/file-search/index.js +10 -0
- package/dist/services/file-search/index.js.map +1 -0
- package/dist/services/file-search/registry.d.ts +97 -0
- package/dist/services/file-search/registry.d.ts.map +1 -0
- package/dist/services/file-search/registry.js +140 -0
- package/dist/services/file-search/registry.js.map +1 -0
- package/dist/services/file-search/strategy.d.ts +58 -0
- package/dist/services/file-search/strategy.d.ts.map +1 -0
- package/dist/services/file-search/strategy.js +8 -0
- package/dist/services/file-search/strategy.js.map +1 -0
- package/dist/services/project-context.d.ts +69 -0
- package/dist/services/project-context.d.ts.map +1 -0
- package/dist/services/project-context.js +113 -0
- package/dist/services/project-context.js.map +1 -0
- package/dist/services/project-manager.d.ts +95 -0
- package/dist/services/project-manager.d.ts.map +1 -0
- package/dist/services/project-manager.js +388 -0
- package/dist/services/project-manager.js.map +1 -0
- package/dist/services/project-registry.d.ts +98 -0
- package/dist/services/project-registry.d.ts.map +1 -0
- package/dist/services/project-registry.js +289 -0
- package/dist/services/project-registry.js.map +1 -0
- package/dist/services/prompt-resolver.d.ts +97 -0
- package/dist/services/prompt-resolver.d.ts.map +1 -0
- package/dist/services/prompt-resolver.js +377 -0
- package/dist/services/prompt-resolver.js.map +1 -0
- package/dist/services/repo-info.d.ts +12 -0
- package/dist/services/repo-info.d.ts.map +1 -1
- package/dist/services/repo-info.js +46 -0
- package/dist/services/repo-info.js.map +1 -1
- package/dist/services/version-service.d.ts +14 -0
- package/dist/services/version-service.d.ts.map +1 -0
- package/dist/services/version-service.js +57 -0
- package/dist/services/version-service.js.map +1 -0
- package/dist/services/watcher.d.ts +3 -4
- package/dist/services/watcher.d.ts.map +1 -1
- package/dist/services/watcher.js +18 -35
- package/dist/services/watcher.js.map +1 -1
- package/dist/services/websocket.d.ts +30 -16
- package/dist/services/websocket.d.ts.map +1 -1
- package/dist/services/websocket.js +102 -37
- package/dist/services/websocket.js.map +1 -1
- package/dist/services/worktree-sync-service.d.ts +326 -0
- package/dist/services/worktree-sync-service.d.ts.map +1 -0
- package/dist/services/worktree-sync-service.js +1091 -0
- package/dist/services/worktree-sync-service.js.map +1 -0
- package/dist/types/editor.d.ts +49 -0
- package/dist/types/editor.d.ts.map +1 -0
- package/dist/types/editor.js +50 -0
- package/dist/types/editor.js.map +1 -0
- package/dist/types/project.d.ts +58 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/types/project.js +10 -0
- package/dist/types/project.js.map +1 -0
- package/dist/utils/executable-check.d.ts +36 -0
- package/dist/utils/executable-check.d.ts.map +1 -0
- package/dist/utils/executable-check.js +79 -0
- package/dist/utils/executable-check.js.map +1 -0
- package/dist/workers/execution-worker.d.ts +18 -0
- package/dist/workers/execution-worker.d.ts.map +1 -0
- package/dist/workers/execution-worker.js +340 -0
- package/dist/workers/execution-worker.js.map +1 -0
- package/dist/workers/worker-ipc.d.ts +84 -0
- package/dist/workers/worker-ipc.d.ts.map +1 -0
- package/dist/workers/worker-ipc.js +29 -0
- package/dist/workers/worker-ipc.js.map +1 -0
- package/package.json +6 -5
- package/dist/execution/output/ag-ui-integration.d.ts +0 -96
- package/dist/execution/output/ag-ui-integration.d.ts.map +0 -1
- package/dist/execution/output/ag-ui-integration.js +0 -96
- package/dist/execution/output/ag-ui-integration.js.map +0 -1
- package/dist/execution/output/claude-code-output-processor.d.ts +0 -321
- package/dist/execution/output/claude-code-output-processor.d.ts.map +0 -1
- package/dist/execution/output/claude-code-output-processor.js +0 -769
- package/dist/execution/output/claude-code-output-processor.js.map +0 -1
- package/dist/public/assets/index-B3SEMufD.js +0 -580
- package/dist/public/assets/index-B3SEMufD.js.map +0 -1
- package/dist/public/assets/index-D2YGL3gX.css +0 -1
- package/dist/public/assets/ui-vendor-CotR6bx9.js +0 -54
- package/dist/public/assets/ui-vendor-CotR6bx9.js.map +0 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Agent Configuration Utilities
|
|
3
|
+
*
|
|
4
|
+
* Common utilities for building and validating agent configurations.
|
|
5
|
+
* Reduces duplication across different agent adapters.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/adapters/shared
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Utility class for common agent configuration operations
|
|
11
|
+
*/
|
|
12
|
+
export class AgentConfigUtils {
|
|
13
|
+
/**
|
|
14
|
+
* Validate base configuration fields required by all agents
|
|
15
|
+
*
|
|
16
|
+
* @param config - Base agent configuration
|
|
17
|
+
* @returns Array of validation error messages (empty if valid)
|
|
18
|
+
*/
|
|
19
|
+
static validateBaseConfig(config) {
|
|
20
|
+
const errors = [];
|
|
21
|
+
if (!config.workDir) {
|
|
22
|
+
errors.push('workDir is required');
|
|
23
|
+
}
|
|
24
|
+
if (config.timeout !== undefined && config.timeout < 0) {
|
|
25
|
+
errors.push('timeout must be a positive number');
|
|
26
|
+
}
|
|
27
|
+
return errors;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Merge configuration with defaults
|
|
31
|
+
*
|
|
32
|
+
* @param config - User-provided configuration
|
|
33
|
+
* @param defaults - Default configuration values
|
|
34
|
+
* @returns Merged configuration with defaults applied
|
|
35
|
+
*/
|
|
36
|
+
static withDefaults(config, defaults) {
|
|
37
|
+
return { ...defaults, ...config };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build ProcessConfig from common fields
|
|
41
|
+
*
|
|
42
|
+
* @param executable - Path to executable or command name
|
|
43
|
+
* @param args - Command-line arguments
|
|
44
|
+
* @param config - Agent configuration
|
|
45
|
+
* @returns ProcessConfig for process spawning
|
|
46
|
+
*/
|
|
47
|
+
static buildBaseProcessConfig(executable, args, config) {
|
|
48
|
+
return {
|
|
49
|
+
executablePath: executable,
|
|
50
|
+
args,
|
|
51
|
+
workDir: config.workDir,
|
|
52
|
+
env: config.env,
|
|
53
|
+
timeout: config.timeout,
|
|
54
|
+
// TypeScript doesn't know about these optional fields,
|
|
55
|
+
// but they're in the extended configs
|
|
56
|
+
idleTimeout: config.idleTimeout,
|
|
57
|
+
retry: config.retry,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Validate timeout configuration
|
|
62
|
+
*
|
|
63
|
+
* @param timeout - Timeout value in milliseconds
|
|
64
|
+
* @param idleTimeout - Idle timeout value in milliseconds
|
|
65
|
+
* @returns Array of validation errors
|
|
66
|
+
*/
|
|
67
|
+
static validateTimeouts(timeout, idleTimeout) {
|
|
68
|
+
const errors = [];
|
|
69
|
+
if (timeout !== undefined && timeout < 0) {
|
|
70
|
+
errors.push('timeout must be a positive number');
|
|
71
|
+
}
|
|
72
|
+
if (idleTimeout !== undefined && idleTimeout < 0) {
|
|
73
|
+
errors.push('idleTimeout must be a positive number');
|
|
74
|
+
}
|
|
75
|
+
if (timeout !== undefined &&
|
|
76
|
+
idleTimeout !== undefined &&
|
|
77
|
+
idleTimeout > timeout) {
|
|
78
|
+
errors.push('idleTimeout cannot be greater than timeout');
|
|
79
|
+
}
|
|
80
|
+
return errors;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Validate retry configuration
|
|
84
|
+
*
|
|
85
|
+
* @param retry - Retry configuration object
|
|
86
|
+
* @returns Array of validation errors
|
|
87
|
+
*/
|
|
88
|
+
static validateRetryConfig(retry) {
|
|
89
|
+
const errors = [];
|
|
90
|
+
if (!retry) {
|
|
91
|
+
return errors;
|
|
92
|
+
}
|
|
93
|
+
if (retry.maxAttempts < 0) {
|
|
94
|
+
errors.push('retry.maxAttempts must be non-negative');
|
|
95
|
+
}
|
|
96
|
+
if (retry.backoffMs < 0) {
|
|
97
|
+
errors.push('retry.backoffMs must be non-negative');
|
|
98
|
+
}
|
|
99
|
+
return errors;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Validate array of paths (for addDir, image, etc.)
|
|
103
|
+
*
|
|
104
|
+
* @param paths - Array of file/directory paths
|
|
105
|
+
* @param fieldName - Name of the field for error messages
|
|
106
|
+
* @returns Array of validation errors
|
|
107
|
+
*/
|
|
108
|
+
static validatePaths(paths, fieldName) {
|
|
109
|
+
const errors = [];
|
|
110
|
+
if (!paths || paths.length === 0) {
|
|
111
|
+
return errors;
|
|
112
|
+
}
|
|
113
|
+
for (const path of paths) {
|
|
114
|
+
if (!path || path.trim() === '') {
|
|
115
|
+
errors.push(`${fieldName} contains empty path`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return errors;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Validate enum value
|
|
122
|
+
*
|
|
123
|
+
* @param value - Value to validate
|
|
124
|
+
* @param validValues - Array of valid enum values
|
|
125
|
+
* @param fieldName - Name of the field for error messages
|
|
126
|
+
* @returns Array of validation errors
|
|
127
|
+
*/
|
|
128
|
+
static validateEnum(value, validValues, fieldName) {
|
|
129
|
+
const errors = [];
|
|
130
|
+
if (value !== undefined && !validValues.includes(value)) {
|
|
131
|
+
errors.push(`${fieldName} must be one of: ${validValues.join(', ')}`);
|
|
132
|
+
}
|
|
133
|
+
return errors;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Build arguments for conditional flags
|
|
137
|
+
*
|
|
138
|
+
* @param flags - Array of flag configurations
|
|
139
|
+
* @returns Array of command-line arguments
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const args = AgentConfigUtils.buildConditionalArgs([
|
|
144
|
+
* { flag: '--force', condition: config.force },
|
|
145
|
+
* { flag: '--model', value: config.model, condition: !!config.model },
|
|
146
|
+
* { flag: '--verbose', condition: true }, // always add
|
|
147
|
+
* ]);
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
static buildConditionalArgs(flags) {
|
|
151
|
+
const args = [];
|
|
152
|
+
for (const { flag, value, condition } of flags) {
|
|
153
|
+
if (condition) {
|
|
154
|
+
args.push(flag);
|
|
155
|
+
if (value !== undefined) {
|
|
156
|
+
args.push(value);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return args;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=config-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-utils.js","sourceRoot":"","sources":["../../../../src/execution/adapters/shared/config-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAuB;QAC/C,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;YACvD,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,MAAS,EACT,QAAoB;QAEpB,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;IACpC,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,sBAAsB,CAC3B,UAAkB,EAClB,IAAc,EACd,MAAuB;QAEvB,OAAO;YACL,cAAc,EAAE,UAAU;YAC1B,IAAI;YACJ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
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared adapter utilities
|
|
3
|
+
*
|
|
4
|
+
* @module execution/adapters/shared
|
|
5
|
+
*/
|
|
6
|
+
export { AgentConfigUtils } from './config-utils.js';
|
|
7
|
+
export { applyCursorPreset, applyCopilotPreset, applyCodexPreset, applyClaudeCodePreset, getRecommendedTimeouts, getRecommendedRetry, type ConfigProfile, } from './config-presets.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/execution/adapters/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared adapter utilities
|
|
3
|
+
*
|
|
4
|
+
* @module execution/adapters/shared
|
|
5
|
+
*/
|
|
6
|
+
export { AgentConfigUtils } from './config-utils.js';
|
|
7
|
+
export { applyCursorPreset, applyCopilotPreset, applyCodexPreset, applyClaudeCodePreset, getRecommendedTimeouts, getRecommendedRetry, } from './config-presets.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/execution/adapters/shared/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentExecutorWrapper - Generic wrapper for any agent adapter
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified execution interface that works with any IAgentAdapter.
|
|
5
|
+
* Supports Claude Code, Codex, Cursor, Copilot, and any future agents.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/executors/agent-executor-wrapper
|
|
8
|
+
*/
|
|
9
|
+
import type { IAgentAdapter } from "agent-execution-engine/agents";
|
|
10
|
+
import type { AgentType, BaseAgentConfig } from "@sudocode-ai/types/agents";
|
|
11
|
+
import type Database from "better-sqlite3";
|
|
12
|
+
import type { ExecutionTask } from "agent-execution-engine/engine";
|
|
13
|
+
import type { ExecutionLifecycleService } from "../../services/execution-lifecycle.js";
|
|
14
|
+
import type { ExecutionLogsStore } from "../../services/execution-logs-store.js";
|
|
15
|
+
import type { TransportManager } from "../transport/transport-manager.js";
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for AgentExecutorWrapper
|
|
18
|
+
*/
|
|
19
|
+
export interface AgentExecutorWrapperConfig<TConfig extends BaseAgentConfig> {
|
|
20
|
+
adapter: IAgentAdapter<TConfig>;
|
|
21
|
+
agentConfig: TConfig;
|
|
22
|
+
/** Agent type for executor selection */
|
|
23
|
+
agentType: AgentType;
|
|
24
|
+
lifecycleService: ExecutionLifecycleService;
|
|
25
|
+
logsStore: ExecutionLogsStore;
|
|
26
|
+
projectId: string;
|
|
27
|
+
db: Database.Database;
|
|
28
|
+
transportManager?: TransportManager;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generic wrapper for any agent adapter
|
|
32
|
+
*
|
|
33
|
+
* Provides basic execution lifecycle management for any agent that implements
|
|
34
|
+
* IAgentAdapter. This is a simplified version compared to ClaudeExecutorWrapper,
|
|
35
|
+
* which has specialized logic for Claude Code's protocol peer.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const wrapper = new AgentExecutorWrapper({
|
|
40
|
+
* adapter: codexAdapter,
|
|
41
|
+
* agentConfig: {
|
|
42
|
+
* workDir: '/path/to/repo',
|
|
43
|
+
* apiKey: 'sk-...',
|
|
44
|
+
* model: 'code-davinci-002',
|
|
45
|
+
* },
|
|
46
|
+
* lifecycleService,
|
|
47
|
+
* logsStore,
|
|
48
|
+
* projectId: 'my-project',
|
|
49
|
+
* db,
|
|
50
|
+
* transportManager,
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* await wrapper.executeWithLifecycle(executionId, task, workDir);
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare class AgentExecutorWrapper<TConfig extends BaseAgentConfig> {
|
|
57
|
+
private adapter;
|
|
58
|
+
private executor;
|
|
59
|
+
/** Agent type used for executor selection and logging */
|
|
60
|
+
private readonly agentType;
|
|
61
|
+
private _agentConfig;
|
|
62
|
+
private logsStore;
|
|
63
|
+
private transportManager?;
|
|
64
|
+
private projectId;
|
|
65
|
+
private db;
|
|
66
|
+
private processConfig;
|
|
67
|
+
private activeExecutions;
|
|
68
|
+
/** Track completion state for Claude Code executions (from protocol peer) */
|
|
69
|
+
private completionState;
|
|
70
|
+
constructor(config: AgentExecutorWrapperConfig<TConfig>);
|
|
71
|
+
/**
|
|
72
|
+
* Create the appropriate executor for the given agent type
|
|
73
|
+
*
|
|
74
|
+
* @param agentType - Type of agent
|
|
75
|
+
* @param agentConfig - Agent configuration
|
|
76
|
+
* @returns Executor instance
|
|
77
|
+
*/
|
|
78
|
+
private createExecutor;
|
|
79
|
+
/**
|
|
80
|
+
* Execute a task with full lifecycle management
|
|
81
|
+
*
|
|
82
|
+
* @param executionId - Unique execution identifier
|
|
83
|
+
* @param task - Task to execute
|
|
84
|
+
* @param workDir - Working directory for execution
|
|
85
|
+
*/
|
|
86
|
+
executeWithLifecycle(executionId: string, task: ExecutionTask, workDir: string): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Resume a task from a previous session
|
|
89
|
+
*
|
|
90
|
+
* @param executionId - Unique execution identifier
|
|
91
|
+
* @param sessionId - Session ID to resume from
|
|
92
|
+
* @param task - Task to resume
|
|
93
|
+
* @param workDir - Working directory for execution
|
|
94
|
+
*/
|
|
95
|
+
resumeWithLifecycle(executionId: string, sessionId: string, task: ExecutionTask, workDir: string): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Cancel a running execution
|
|
98
|
+
*
|
|
99
|
+
* @param executionId - Execution ID to cancel
|
|
100
|
+
*/
|
|
101
|
+
cancel(executionId: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Setup AG-UI system for execution
|
|
104
|
+
*
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
private setupAgUiSystem;
|
|
108
|
+
/**
|
|
109
|
+
* Process normalized output from agent
|
|
110
|
+
*
|
|
111
|
+
* For Claude Code: Also captures session ID from metadata for session resumption
|
|
112
|
+
*
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
private processNormalizedOutput;
|
|
116
|
+
/**
|
|
117
|
+
* Handle successful execution
|
|
118
|
+
*
|
|
119
|
+
* @private
|
|
120
|
+
*/
|
|
121
|
+
private handleSuccess;
|
|
122
|
+
/**
|
|
123
|
+
* Handle execution error
|
|
124
|
+
*
|
|
125
|
+
* @private
|
|
126
|
+
*/
|
|
127
|
+
private handleError;
|
|
128
|
+
/**
|
|
129
|
+
* Create output chunk stream from ManagedProcess
|
|
130
|
+
*
|
|
131
|
+
* For Claude Code: Uses protocol peer to receive messages
|
|
132
|
+
* For other agents: Reads directly from stdout/stderr streams
|
|
133
|
+
*
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
private createOutputChunks;
|
|
137
|
+
/**
|
|
138
|
+
* Convert protocol peer messages to output chunks
|
|
139
|
+
*
|
|
140
|
+
* Used for Claude Code which uses a protocol peer that consumes stdout
|
|
141
|
+
* Updates completion state when result message is received
|
|
142
|
+
*
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
private peerMessagesToOutputChunks;
|
|
146
|
+
/**
|
|
147
|
+
* Convert a readable stream to output chunks
|
|
148
|
+
*
|
|
149
|
+
* @private
|
|
150
|
+
*/
|
|
151
|
+
private streamToChunks;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=agent-executor-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-executor-wrapper.d.ts","sourceRoot":"","sources":["../../../src/execution/executors/agent-executor-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EAEd,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AA8B1E;;GAEG;AACH,MAAM,WAAW,0BAA0B,CAAC,OAAO,SAAS,eAAe;IACzE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,SAAS,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,oBAAoB,CAAC,OAAO,SAA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