@sudocode-ai/local-server 0.1.7 → 0.1.8
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 +187 -0
- package/dist/execution/worktree/git-sync-cli.d.ts.map +1 -0
- package/dist/execution/worktree/git-sync-cli.js +350 -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 +132 -211
- 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-Bb_W5bUr.css +1 -0
- package/dist/public/assets/index-CFKL113G.js +710 -0
- package/dist/public/assets/index-CFKL113G.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 +506 -54
- 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 +126 -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/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 +92 -0
- package/dist/services/execution-changes-service.d.ts.map +1 -0
- package/dist/services/execution-changes-service.js +546 -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 +50 -58
- package/dist/services/execution-service.d.ts.map +1 -1
- package/dist/services/execution-service.js +433 -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/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 +228 -0
- package/dist/services/worktree-sync-service.d.ts.map +1 -0
- package/dist/services/worktree-sync-service.js +563 -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,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Agent Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements the IAgentAdapter interface for Cursor CLI (cursor-agent).
|
|
5
|
+
* Provides agent-specific configuration building and metadata.
|
|
6
|
+
*
|
|
7
|
+
* Based on agent-execution-engine implementation.
|
|
8
|
+
*/
|
|
9
|
+
import { AgentConfigUtils } from "./shared/index.js";
|
|
10
|
+
/**
|
|
11
|
+
* Cursor agent metadata
|
|
12
|
+
*/
|
|
13
|
+
const CURSOR_METADATA = {
|
|
14
|
+
name: "cursor",
|
|
15
|
+
displayName: "Cursor",
|
|
16
|
+
version: ">=1.0.0",
|
|
17
|
+
supportedModes: ["structured"], // Uses JSONL stream protocol
|
|
18
|
+
supportsStreaming: true,
|
|
19
|
+
supportsStructuredOutput: true, // stream-json format
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Cursor Agent Adapter
|
|
23
|
+
*
|
|
24
|
+
* Provides Cursor-specific configuration building and capabilities.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const adapter = new CursorAdapter();
|
|
29
|
+
* const config = adapter.buildProcessConfig({
|
|
30
|
+
* workDir: '/path/to/project',
|
|
31
|
+
* force: true,
|
|
32
|
+
* model: 'sonnet-4.5',
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* const processManager = createProcessManager(config);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export class CursorAdapter {
|
|
39
|
+
metadata = CURSOR_METADATA;
|
|
40
|
+
/**
|
|
41
|
+
* Build ProcessConfig from Cursor-specific configuration
|
|
42
|
+
*
|
|
43
|
+
* @param config - Cursor configuration
|
|
44
|
+
* @returns Generic ProcessConfig
|
|
45
|
+
*/
|
|
46
|
+
buildProcessConfig(config) {
|
|
47
|
+
const args = this.buildCursorArgs(config);
|
|
48
|
+
return AgentConfigUtils.buildBaseProcessConfig(config.cursorPath || "cursor-agent", args, config);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build Cursor-specific command-line arguments
|
|
52
|
+
*
|
|
53
|
+
* @param config - Cursor configuration
|
|
54
|
+
* @returns Array of command-line arguments
|
|
55
|
+
*/
|
|
56
|
+
buildCursorArgs(config) {
|
|
57
|
+
const args = [];
|
|
58
|
+
// Always use -p (print/non-interactive mode) and stream-json output
|
|
59
|
+
args.push("-p");
|
|
60
|
+
args.push("--output-format=stream-json");
|
|
61
|
+
// Add conditional flags
|
|
62
|
+
args.push(...AgentConfigUtils.buildConditionalArgs([
|
|
63
|
+
{ flag: "--force", condition: !!config.force },
|
|
64
|
+
{ flag: "--model", value: config.model, condition: !!config.model },
|
|
65
|
+
]));
|
|
66
|
+
return args;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validate Cursor configuration
|
|
70
|
+
*
|
|
71
|
+
* @param config - Configuration to validate
|
|
72
|
+
* @returns Array of validation errors (empty if valid)
|
|
73
|
+
*/
|
|
74
|
+
validateConfig(config) {
|
|
75
|
+
const errors = [
|
|
76
|
+
...AgentConfigUtils.validateBaseConfig(config),
|
|
77
|
+
...this.validateCursorSpecific(config),
|
|
78
|
+
];
|
|
79
|
+
return errors;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Validate Cursor-specific configuration
|
|
83
|
+
*
|
|
84
|
+
* @param config - Configuration to validate
|
|
85
|
+
* @returns Array of validation errors
|
|
86
|
+
*/
|
|
87
|
+
validateCursorSpecific(config) {
|
|
88
|
+
const errors = [];
|
|
89
|
+
// Validate model if specified
|
|
90
|
+
const validModels = [
|
|
91
|
+
"auto",
|
|
92
|
+
"sonnet-4.5",
|
|
93
|
+
"sonnet-4.5-thinking",
|
|
94
|
+
"gpt-5",
|
|
95
|
+
"opus-4.1",
|
|
96
|
+
"grok",
|
|
97
|
+
];
|
|
98
|
+
if (config.model && !validModels.includes(config.model)) {
|
|
99
|
+
// Allow custom model strings, just warn
|
|
100
|
+
console.warn(`Unknown model specified: ${config.model}. Known models: ${validModels.join(", ")}`);
|
|
101
|
+
}
|
|
102
|
+
// Validate timeouts
|
|
103
|
+
errors.push(...AgentConfigUtils.validateTimeouts(config.timeout, config.idleTimeout));
|
|
104
|
+
// Validate retry config
|
|
105
|
+
errors.push(...AgentConfigUtils.validateRetryConfig(config.retry));
|
|
106
|
+
return errors;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get default Cursor configuration
|
|
110
|
+
*
|
|
111
|
+
* @returns Default configuration values
|
|
112
|
+
*/
|
|
113
|
+
getDefaultConfig() {
|
|
114
|
+
return {
|
|
115
|
+
cursorPath: "cursor-agent",
|
|
116
|
+
force: true, // Auto-approve for automation
|
|
117
|
+
model: "auto", // Let Cursor choose best model
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=cursor-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-adapter.js","sourceRoot":"","sources":["../../../src/execution/adapters/cursor-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,MAAM,eAAe,GAAkB;IACrC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,CAAC,YAAY,CAAC,EAAE,6BAA6B;IAC7D,iBAAiB,EAAE,IAAI;IACvB,wBAAwB,EAAE,IAAI,EAAE,qBAAqB;CACtD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,aAAa;IACf,QAAQ,GAAG,eAAe,CAAC;IAEpC;;;;;OAKG;IACH,kBAAkB,CAAC,MAAoB;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,gBAAgB,CAAC,sBAAsB,CAC5C,MAAM,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I,CAAC,EAAE,CACpF,CAAC;QACJ,CAAC;QAED,oBAAoB;QACpB,MAAM,CAAC,IAAI,CACT,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CACzE,CAAC;QAEF,wBAAwB;QACxB,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAEnE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,gBAAgB;QACd,OAAO;YACL,UAAU,EAAE,cAAc;YAC1B,KAAK,EAAE,IAAI,EAAE,8BAA8B;YAC3C,KAAK,EAAE,MAAM,EAAE,+BAA+B;SAC/C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Configuration Builder
|
|
3
|
+
*
|
|
4
|
+
* Utility for building ProcessConfig specific to Cursor CLI (cursor-agent).
|
|
5
|
+
* Provides type-safe configuration for Cursor's flags and options.
|
|
6
|
+
*
|
|
7
|
+
* Based on agent-execution-engine cursor executor implementation.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProcessConfig } from "agent-execution-engine/process";
|
|
10
|
+
import type { CursorConfig } from "@sudocode-ai/types/agents";
|
|
11
|
+
/**
|
|
12
|
+
* Build a generic ProcessConfig from Cursor specific configuration
|
|
13
|
+
*
|
|
14
|
+
* @param config - Cursor specific configuration
|
|
15
|
+
* @returns Generic ProcessConfig that can be used with any ProcessManager
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const config = buildCursorConfig({
|
|
20
|
+
* workDir: '/path/to/project',
|
|
21
|
+
* force: true,
|
|
22
|
+
* model: 'sonnet-4.5',
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* const process = await manager.acquireProcess(config);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildCursorConfig(config: CursorConfig): ProcessConfig;
|
|
29
|
+
//# sourceMappingURL=cursor-config-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-config-builder.d.ts","sourceRoot":"","sources":["../../../src/execution/adapters/cursor-config-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CA0BrE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Configuration Builder
|
|
3
|
+
*
|
|
4
|
+
* Utility for building ProcessConfig specific to Cursor CLI (cursor-agent).
|
|
5
|
+
* Provides type-safe configuration for Cursor's flags and options.
|
|
6
|
+
*
|
|
7
|
+
* Based on agent-execution-engine cursor executor implementation.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Build a generic ProcessConfig from Cursor specific configuration
|
|
11
|
+
*
|
|
12
|
+
* @param config - Cursor specific configuration
|
|
13
|
+
* @returns Generic ProcessConfig that can be used with any ProcessManager
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const config = buildCursorConfig({
|
|
18
|
+
* workDir: '/path/to/project',
|
|
19
|
+
* force: true,
|
|
20
|
+
* model: 'sonnet-4.5',
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* const process = await manager.acquireProcess(config);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function buildCursorConfig(config) {
|
|
27
|
+
const args = [];
|
|
28
|
+
// Always use -p (print/non-interactive mode) and stream-json output
|
|
29
|
+
args.push("-p");
|
|
30
|
+
args.push("--output-format=stream-json");
|
|
31
|
+
// Add --force flag for auto-approval
|
|
32
|
+
if (config.force) {
|
|
33
|
+
args.push("--force");
|
|
34
|
+
}
|
|
35
|
+
// Add --model flag if specified
|
|
36
|
+
if (config.model) {
|
|
37
|
+
args.push("--model", config.model);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
executablePath: config.cursorPath || "cursor-agent",
|
|
41
|
+
args,
|
|
42
|
+
workDir: config.workDir,
|
|
43
|
+
env: config.env,
|
|
44
|
+
timeout: config.timeout,
|
|
45
|
+
idleTimeout: config.idleTimeout,
|
|
46
|
+
retry: config.retry,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=cursor-config-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-config-builder.js","sourceRoot":"","sources":["../../../src/execution/adapters/cursor-config-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAoB;IACpD,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,oEAAoE;IACpE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAEzC,qCAAqC;IACrC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;IAED,gCAAgC;IAChC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,OAAO;QACL,cAAc,EAAE,MAAM,CAAC,UAAU,IAAI,cAAc;QACnD,IAAI;QACJ,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Configuration Presets
|
|
3
|
+
*
|
|
4
|
+
* Predefined configuration profiles for common use cases.
|
|
5
|
+
* Makes it easier to configure agents for specific scenarios.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/adapters/shared
|
|
8
|
+
*/
|
|
9
|
+
import type { CodexConfig, CopilotConfig, CursorConfig, ClaudeCodeConfig } from '@sudocode-ai/types/agents';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration profile types
|
|
12
|
+
*/
|
|
13
|
+
export type ConfigProfile = 'safe' | 'automation' | 'development' | 'production';
|
|
14
|
+
/**
|
|
15
|
+
* Safe preset - Maximum safety, minimal permissions
|
|
16
|
+
* Use for untrusted code or when you want maximum control
|
|
17
|
+
*/
|
|
18
|
+
export declare const SAFE_PRESET: {
|
|
19
|
+
readonly autoApprove: false;
|
|
20
|
+
readonly skipPermissions: false;
|
|
21
|
+
readonly fullAuto: false;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Automation preset - Auto-approve everything for CI/CD
|
|
25
|
+
* Use for automated workflows where human approval isn't feasible
|
|
26
|
+
*/
|
|
27
|
+
export declare const AUTOMATION_PRESET: {
|
|
28
|
+
readonly autoApprove: true;
|
|
29
|
+
readonly skipPermissions: true;
|
|
30
|
+
readonly fullAuto: true;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Development preset - Balanced for local development
|
|
34
|
+
* Auto-approve with workspace-level permissions
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEVELOPMENT_PRESET: {
|
|
37
|
+
readonly autoApprove: true;
|
|
38
|
+
readonly skipPermissions: false;
|
|
39
|
+
readonly fullAuto: true;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Production preset - Conservative for production environments
|
|
43
|
+
* Similar to safe but with some automation
|
|
44
|
+
*/
|
|
45
|
+
export declare const PRODUCTION_PRESET: {
|
|
46
|
+
readonly autoApprove: false;
|
|
47
|
+
readonly skipPermissions: false;
|
|
48
|
+
readonly fullAuto: false;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Apply a configuration profile to Cursor config
|
|
52
|
+
*
|
|
53
|
+
* @param config - Base Cursor configuration
|
|
54
|
+
* @param profile - Profile to apply
|
|
55
|
+
* @returns Configuration with profile applied
|
|
56
|
+
*/
|
|
57
|
+
export declare function applyCursorPreset(config: CursorConfig, profile: ConfigProfile): CursorConfig;
|
|
58
|
+
/**
|
|
59
|
+
* Apply a configuration profile to Copilot config
|
|
60
|
+
*
|
|
61
|
+
* @param config - Base Copilot configuration
|
|
62
|
+
* @param profile - Profile to apply
|
|
63
|
+
* @returns Configuration with profile applied
|
|
64
|
+
*/
|
|
65
|
+
export declare function applyCopilotPreset(config: CopilotConfig, profile: ConfigProfile): CopilotConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Apply a configuration profile to Codex config
|
|
68
|
+
*
|
|
69
|
+
* @param config - Base Codex configuration
|
|
70
|
+
* @param profile - Profile to apply
|
|
71
|
+
* @returns Configuration with profile applied
|
|
72
|
+
*/
|
|
73
|
+
export declare function applyCodexPreset(config: CodexConfig, profile: ConfigProfile): CodexConfig;
|
|
74
|
+
/**
|
|
75
|
+
* Apply a configuration profile to Claude Code config
|
|
76
|
+
*
|
|
77
|
+
* @param config - Base Claude Code configuration
|
|
78
|
+
* @param profile - Profile to apply
|
|
79
|
+
* @returns Configuration with profile applied
|
|
80
|
+
*/
|
|
81
|
+
export declare function applyClaudeCodePreset(config: ClaudeCodeConfig, profile: ConfigProfile): ClaudeCodeConfig;
|
|
82
|
+
/**
|
|
83
|
+
* Get recommended timeout values based on profile
|
|
84
|
+
*
|
|
85
|
+
* @param profile - Configuration profile
|
|
86
|
+
* @returns Timeout configuration
|
|
87
|
+
*/
|
|
88
|
+
export declare function getRecommendedTimeouts(profile: ConfigProfile): {
|
|
89
|
+
timeout: number;
|
|
90
|
+
idleTimeout: number;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Get recommended retry configuration based on profile
|
|
94
|
+
*
|
|
95
|
+
* @param profile - Configuration profile
|
|
96
|
+
* @returns Retry configuration
|
|
97
|
+
*/
|
|
98
|
+
export declare function getRecommendedRetry(profile: ConfigProfile): {
|
|
99
|
+
maxAttempts: number;
|
|
100
|
+
backoffMs: number;
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=config-presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-presets.d.ts","sourceRoot":"","sources":["../../../../src/execution/adapters/shared/config-presets.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;CAId,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,aAAa,GACrB,YAAY,CASd;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,aAAa,GACrB,aAAa,CASf;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,aAAa,GACrB,WAAW,CA6Bb;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,aAAa,GACrB,gBAAgB,CA+BlB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAqBA;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAqBA"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Configuration Presets
|
|
3
|
+
*
|
|
4
|
+
* Predefined configuration profiles for common use cases.
|
|
5
|
+
* Makes it easier to configure agents for specific scenarios.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/adapters/shared
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Safe preset - Maximum safety, minimal permissions
|
|
11
|
+
* Use for untrusted code or when you want maximum control
|
|
12
|
+
*/
|
|
13
|
+
export const SAFE_PRESET = {
|
|
14
|
+
autoApprove: false,
|
|
15
|
+
skipPermissions: false,
|
|
16
|
+
fullAuto: false,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Automation preset - Auto-approve everything for CI/CD
|
|
20
|
+
* Use for automated workflows where human approval isn't feasible
|
|
21
|
+
*/
|
|
22
|
+
export const AUTOMATION_PRESET = {
|
|
23
|
+
autoApprove: true,
|
|
24
|
+
skipPermissions: true,
|
|
25
|
+
fullAuto: true,
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Development preset - Balanced for local development
|
|
29
|
+
* Auto-approve with workspace-level permissions
|
|
30
|
+
*/
|
|
31
|
+
export const DEVELOPMENT_PRESET = {
|
|
32
|
+
autoApprove: true,
|
|
33
|
+
skipPermissions: false,
|
|
34
|
+
fullAuto: true,
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Production preset - Conservative for production environments
|
|
38
|
+
* Similar to safe but with some automation
|
|
39
|
+
*/
|
|
40
|
+
export const PRODUCTION_PRESET = {
|
|
41
|
+
autoApprove: false,
|
|
42
|
+
skipPermissions: false,
|
|
43
|
+
fullAuto: false,
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Apply a configuration profile to Cursor config
|
|
47
|
+
*
|
|
48
|
+
* @param config - Base Cursor configuration
|
|
49
|
+
* @param profile - Profile to apply
|
|
50
|
+
* @returns Configuration with profile applied
|
|
51
|
+
*/
|
|
52
|
+
export function applyCursorPreset(config, profile) {
|
|
53
|
+
const presets = {
|
|
54
|
+
safe: { force: false },
|
|
55
|
+
automation: { force: true },
|
|
56
|
+
development: { force: true },
|
|
57
|
+
production: { force: false },
|
|
58
|
+
};
|
|
59
|
+
return { ...config, ...presets[profile] };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Apply a configuration profile to Copilot config
|
|
63
|
+
*
|
|
64
|
+
* @param config - Base Copilot configuration
|
|
65
|
+
* @param profile - Profile to apply
|
|
66
|
+
* @returns Configuration with profile applied
|
|
67
|
+
*/
|
|
68
|
+
export function applyCopilotPreset(config, profile) {
|
|
69
|
+
const presets = {
|
|
70
|
+
safe: { allowAllTools: false },
|
|
71
|
+
automation: { allowAllTools: true },
|
|
72
|
+
development: { allowAllTools: true },
|
|
73
|
+
production: { allowAllTools: false },
|
|
74
|
+
};
|
|
75
|
+
return { ...config, ...presets[profile] };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Apply a configuration profile to Codex config
|
|
79
|
+
*
|
|
80
|
+
* @param config - Base Codex configuration
|
|
81
|
+
* @param profile - Profile to apply
|
|
82
|
+
* @returns Configuration with profile applied
|
|
83
|
+
*/
|
|
84
|
+
export function applyCodexPreset(config, profile) {
|
|
85
|
+
const presets = {
|
|
86
|
+
safe: {
|
|
87
|
+
sandbox: 'read-only',
|
|
88
|
+
askForApproval: 'untrusted',
|
|
89
|
+
fullAuto: false,
|
|
90
|
+
yolo: false,
|
|
91
|
+
},
|
|
92
|
+
automation: {
|
|
93
|
+
sandbox: 'workspace-write',
|
|
94
|
+
askForApproval: 'never',
|
|
95
|
+
fullAuto: true,
|
|
96
|
+
yolo: false,
|
|
97
|
+
},
|
|
98
|
+
development: {
|
|
99
|
+
sandbox: 'workspace-write',
|
|
100
|
+
askForApproval: 'on-failure',
|
|
101
|
+
fullAuto: true,
|
|
102
|
+
yolo: false,
|
|
103
|
+
},
|
|
104
|
+
production: {
|
|
105
|
+
sandbox: 'workspace-write',
|
|
106
|
+
askForApproval: 'untrusted',
|
|
107
|
+
fullAuto: false,
|
|
108
|
+
yolo: false,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
return { ...config, ...presets[profile] };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Apply a configuration profile to Claude Code config
|
|
115
|
+
*
|
|
116
|
+
* @param config - Base Claude Code configuration
|
|
117
|
+
* @param profile - Profile to apply
|
|
118
|
+
* @returns Configuration with profile applied
|
|
119
|
+
*/
|
|
120
|
+
export function applyClaudeCodePreset(config, profile) {
|
|
121
|
+
const presets = {
|
|
122
|
+
safe: {
|
|
123
|
+
dangerouslySkipPermissions: false,
|
|
124
|
+
allowDangerouslySkipPermissions: false,
|
|
125
|
+
permissionMode: 'default',
|
|
126
|
+
// No tool restrictions for safe - let Claude ask for permissions
|
|
127
|
+
},
|
|
128
|
+
automation: {
|
|
129
|
+
dangerouslySkipPermissions: true,
|
|
130
|
+
permissionMode: 'bypassPermissions',
|
|
131
|
+
// For automation, enable all tools by default
|
|
132
|
+
tools: ['default'],
|
|
133
|
+
},
|
|
134
|
+
development: {
|
|
135
|
+
dangerouslySkipPermissions: true,
|
|
136
|
+
permissionMode: 'acceptEdits',
|
|
137
|
+
// Allow common development tools
|
|
138
|
+
allowedTools: ['Bash', 'Edit', 'Read', 'Write', 'Glob', 'Grep'],
|
|
139
|
+
},
|
|
140
|
+
production: {
|
|
141
|
+
dangerouslySkipPermissions: false,
|
|
142
|
+
allowDangerouslySkipPermissions: true, // Allow but don't enable by default
|
|
143
|
+
permissionMode: 'default',
|
|
144
|
+
// Restrict to read-only tools in production
|
|
145
|
+
allowedTools: ['Read', 'Glob', 'Grep'],
|
|
146
|
+
disallowedTools: ['Bash', 'Write'],
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
return { ...config, ...presets[profile] };
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Get recommended timeout values based on profile
|
|
153
|
+
*
|
|
154
|
+
* @param profile - Configuration profile
|
|
155
|
+
* @returns Timeout configuration
|
|
156
|
+
*/
|
|
157
|
+
export function getRecommendedTimeouts(profile) {
|
|
158
|
+
const timeouts = {
|
|
159
|
+
safe: {
|
|
160
|
+
timeout: 5 * 60 * 1000, // 5 minutes
|
|
161
|
+
idleTimeout: 2 * 60 * 1000, // 2 minutes
|
|
162
|
+
},
|
|
163
|
+
automation: {
|
|
164
|
+
timeout: 30 * 60 * 1000, // 30 minutes
|
|
165
|
+
idleTimeout: 10 * 60 * 1000, // 10 minutes
|
|
166
|
+
},
|
|
167
|
+
development: {
|
|
168
|
+
timeout: 15 * 60 * 1000, // 15 minutes
|
|
169
|
+
idleTimeout: 5 * 60 * 1000, // 5 minutes
|
|
170
|
+
},
|
|
171
|
+
production: {
|
|
172
|
+
timeout: 10 * 60 * 1000, // 10 minutes
|
|
173
|
+
idleTimeout: 3 * 60 * 1000, // 3 minutes
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
return timeouts[profile];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get recommended retry configuration based on profile
|
|
180
|
+
*
|
|
181
|
+
* @param profile - Configuration profile
|
|
182
|
+
* @returns Retry configuration
|
|
183
|
+
*/
|
|
184
|
+
export function getRecommendedRetry(profile) {
|
|
185
|
+
const retryConfigs = {
|
|
186
|
+
safe: {
|
|
187
|
+
maxAttempts: 1, // No retries for safety
|
|
188
|
+
backoffMs: 0,
|
|
189
|
+
},
|
|
190
|
+
automation: {
|
|
191
|
+
maxAttempts: 3, // More retries for automation
|
|
192
|
+
backoffMs: 1000,
|
|
193
|
+
},
|
|
194
|
+
development: {
|
|
195
|
+
maxAttempts: 2,
|
|
196
|
+
backoffMs: 500,
|
|
197
|
+
},
|
|
198
|
+
production: {
|
|
199
|
+
maxAttempts: 2,
|
|
200
|
+
backoffMs: 1000,
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
return retryConfigs[profile];
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=config-presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-presets.js","sourceRoot":"","sources":["../../../../src/execution/adapters/shared/config-presets.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,WAAW,EAAE,KAAK;IAClB,eAAe,EAAE,KAAK;IACtB,QAAQ,EAAE,KAAK;CACP,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;IACrB,QAAQ,EAAE,IAAI;CACN,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,KAAK;IACtB,QAAQ,EAAE,IAAI;CACN,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,KAAK;IAClB,eAAe,EAAE,KAAK;IACtB,QAAQ,EAAE,KAAK;CACP,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAoB,EACpB,OAAsB;IAEtB,MAAM,OAAO,GAAG;QACd,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EAAE;YACV,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;YACtC,WAAW,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;SAC3C;QACD,WAAW,EAAE;YACX,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;YACtC,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,YAAY;SACzC;QACD,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa;YACtC,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,YAAY;SACzC;KACF,CAAC;IAEF,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAsB;IAIxD,MAAM,YAAY,GAAG;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,CAAC,EAAE,wBAAwB;YACxC,SAAS,EAAE,CAAC;SACb;QACD,UAAU,EAAE;YACV,WAAW,EAAE,CAAC,EAAE,8BAA8B;YAC9C,SAAS,EAAE,IAAI;SAChB;QACD,WAAW,EAAE;YACX,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,GAAG;SACf;QACD,UAAU,EAAE;YACV,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,IAAI;SAChB;KACF,CAAC;IAEF,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
import type { ProcessConfig } from 'agent-execution-engine/process';
|
|
10
|
+
import type { BaseAgentConfig } from '@sudocode-ai/types/agents';
|
|
11
|
+
/**
|
|
12
|
+
* Utility class for common agent configuration operations
|
|
13
|
+
*/
|
|
14
|
+
export declare class AgentConfigUtils {
|
|
15
|
+
/**
|
|
16
|
+
* Validate base configuration fields required by all agents
|
|
17
|
+
*
|
|
18
|
+
* @param config - Base agent configuration
|
|
19
|
+
* @returns Array of validation error messages (empty if valid)
|
|
20
|
+
*/
|
|
21
|
+
static validateBaseConfig(config: BaseAgentConfig): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Merge configuration with defaults
|
|
24
|
+
*
|
|
25
|
+
* @param config - User-provided configuration
|
|
26
|
+
* @param defaults - Default configuration values
|
|
27
|
+
* @returns Merged configuration with defaults applied
|
|
28
|
+
*/
|
|
29
|
+
static withDefaults<T extends BaseAgentConfig>(config: T, defaults: Partial<T>): T;
|
|
30
|
+
/**
|
|
31
|
+
* Build ProcessConfig from common fields
|
|
32
|
+
*
|
|
33
|
+
* @param executable - Path to executable or command name
|
|
34
|
+
* @param args - Command-line arguments
|
|
35
|
+
* @param config - Agent configuration
|
|
36
|
+
* @returns ProcessConfig for process spawning
|
|
37
|
+
*/
|
|
38
|
+
static buildBaseProcessConfig(executable: string, args: string[], config: BaseAgentConfig): ProcessConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Validate timeout configuration
|
|
41
|
+
*
|
|
42
|
+
* @param timeout - Timeout value in milliseconds
|
|
43
|
+
* @param idleTimeout - Idle timeout value in milliseconds
|
|
44
|
+
* @returns Array of validation errors
|
|
45
|
+
*/
|
|
46
|
+
static validateTimeouts(timeout?: number, idleTimeout?: number): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Validate retry configuration
|
|
49
|
+
*
|
|
50
|
+
* @param retry - Retry configuration object
|
|
51
|
+
* @returns Array of validation errors
|
|
52
|
+
*/
|
|
53
|
+
static validateRetryConfig(retry?: {
|
|
54
|
+
maxAttempts: number;
|
|
55
|
+
backoffMs: number;
|
|
56
|
+
}): string[];
|
|
57
|
+
/**
|
|
58
|
+
* Validate array of paths (for addDir, image, etc.)
|
|
59
|
+
*
|
|
60
|
+
* @param paths - Array of file/directory paths
|
|
61
|
+
* @param fieldName - Name of the field for error messages
|
|
62
|
+
* @returns Array of validation errors
|
|
63
|
+
*/
|
|
64
|
+
static validatePaths(paths: string[] | undefined, fieldName: string): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Validate enum value
|
|
67
|
+
*
|
|
68
|
+
* @param value - Value to validate
|
|
69
|
+
* @param validValues - Array of valid enum values
|
|
70
|
+
* @param fieldName - Name of the field for error messages
|
|
71
|
+
* @returns Array of validation errors
|
|
72
|
+
*/
|
|
73
|
+
static validateEnum<T extends string>(value: T | undefined, validValues: readonly T[], fieldName: string): string[];
|
|
74
|
+
/**
|
|
75
|
+
* Build arguments for conditional flags
|
|
76
|
+
*
|
|
77
|
+
* @param flags - Array of flag configurations
|
|
78
|
+
* @returns Array of command-line arguments
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const args = AgentConfigUtils.buildConditionalArgs([
|
|
83
|
+
* { flag: '--force', condition: config.force },
|
|
84
|
+
* { flag: '--model', value: config.model, condition: !!config.model },
|
|
85
|
+
* { flag: '--verbose', condition: true }, // always add
|
|
86
|
+
* ]);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
static buildConditionalArgs(flags: Array<{
|
|
90
|
+
flag: string;
|
|
91
|
+
value?: string;
|
|
92
|
+
condition: boolean;
|
|
93
|
+
}>): string[];
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=config-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-utils.d.ts","sourceRoot":"","sources":["../../../../src/execution/adapters/shared/config-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,C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