@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,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Codex Configuration Builder
|
|
3
|
+
*
|
|
4
|
+
* Utility for building ProcessConfig specific to OpenAI Codex CLI.
|
|
5
|
+
* Provides type-safe configuration for Codex's flags and options.
|
|
6
|
+
*
|
|
7
|
+
* Based on agent-execution-engine implementation.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Build a generic ProcessConfig from Codex specific configuration
|
|
11
|
+
*
|
|
12
|
+
* @param config - Codex specific configuration
|
|
13
|
+
* @returns Generic ProcessConfig that can be used with any ProcessManager
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const config = buildCodexConfig({
|
|
18
|
+
* workDir: '/path/to/project',
|
|
19
|
+
* exec: true,
|
|
20
|
+
* json: true,
|
|
21
|
+
* fullAuto: true,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* const process = await manager.acquireProcess(config);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function buildCodexConfig(config) {
|
|
28
|
+
const args = [];
|
|
29
|
+
// Add 'exec' subcommand for non-interactive mode
|
|
30
|
+
if (config.exec !== false) {
|
|
31
|
+
args.push('exec');
|
|
32
|
+
// Add '-' to explicitly read prompt from stdin
|
|
33
|
+
// This prevents the "Reading prompt from stdin..." blocking message
|
|
34
|
+
if (!config.prompt) {
|
|
35
|
+
args.push('-');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Add --json flag for structured output
|
|
39
|
+
if (config.json) {
|
|
40
|
+
args.push('--json');
|
|
41
|
+
}
|
|
42
|
+
// Add --experimental-json flag (alternative to --json)
|
|
43
|
+
if (config.experimentalJson) {
|
|
44
|
+
args.push('--experimental-json');
|
|
45
|
+
}
|
|
46
|
+
// Add --output-last-message flag
|
|
47
|
+
if (config.outputLastMessage) {
|
|
48
|
+
args.push('--output-last-message', config.outputLastMessage);
|
|
49
|
+
}
|
|
50
|
+
// Add --model flag
|
|
51
|
+
if (config.model) {
|
|
52
|
+
args.push('--model', config.model);
|
|
53
|
+
}
|
|
54
|
+
// Add --sandbox flag
|
|
55
|
+
if (config.sandbox) {
|
|
56
|
+
args.push('--sandbox', config.sandbox);
|
|
57
|
+
}
|
|
58
|
+
// Add --ask-for-approval flag
|
|
59
|
+
if (config.askForApproval) {
|
|
60
|
+
args.push('--ask-for-approval', config.askForApproval);
|
|
61
|
+
}
|
|
62
|
+
// Add --full-auto flag (shortcut for workspace-write + on-failure)
|
|
63
|
+
if (config.fullAuto) {
|
|
64
|
+
args.push('--full-auto');
|
|
65
|
+
}
|
|
66
|
+
// Add --skip-git-repo-check flag
|
|
67
|
+
if (config.skipGitRepoCheck) {
|
|
68
|
+
args.push('--skip-git-repo-check');
|
|
69
|
+
}
|
|
70
|
+
// Add --color flag
|
|
71
|
+
if (config.color) {
|
|
72
|
+
args.push('--color', config.color);
|
|
73
|
+
}
|
|
74
|
+
// Add --search flag for web browsing
|
|
75
|
+
if (config.search) {
|
|
76
|
+
args.push('--search');
|
|
77
|
+
}
|
|
78
|
+
// Add --image flag(s) for image attachments
|
|
79
|
+
if (config.image && config.image.length > 0) {
|
|
80
|
+
args.push('--image', config.image.join(','));
|
|
81
|
+
}
|
|
82
|
+
// Add --profile flag
|
|
83
|
+
if (config.profile) {
|
|
84
|
+
args.push('--profile', config.profile);
|
|
85
|
+
}
|
|
86
|
+
// Add --add-dir flag(s) for additional directories
|
|
87
|
+
if (config.addDir && config.addDir.length > 0) {
|
|
88
|
+
config.addDir.forEach((dir) => {
|
|
89
|
+
args.push('--add-dir', dir);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// Add --yolo flag (disable all safety checks)
|
|
93
|
+
if (config.yolo) {
|
|
94
|
+
args.push('--dangerously-bypass-approvals-and-sandbox');
|
|
95
|
+
}
|
|
96
|
+
// Add prompt as the last argument (if provided)
|
|
97
|
+
if (config.prompt) {
|
|
98
|
+
args.push(config.prompt);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
executablePath: config.codexPath || 'codex',
|
|
102
|
+
args,
|
|
103
|
+
workDir: config.workDir,
|
|
104
|
+
env: config.env,
|
|
105
|
+
timeout: config.timeout,
|
|
106
|
+
idleTimeout: config.idleTimeout,
|
|
107
|
+
retry: config.retry,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=codex-config-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-config-builder.js","sourceRoot":"","sources":["../../../src/execution/adapters/codex-config-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAClD,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,iDAAiD;IACjD,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAElB,+CAA+C;QAC/C,oEAAoE;QACpE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,wCAAwC;IACxC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC;IAED,uDAAuD;IACvD,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACnC,CAAC;IAED,iCAAiC;IACjC,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC/D,CAAC;IAED,mBAAmB;IACnB,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC,IAA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,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,8CAA8C;IAC9C,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC1D,CAAC;IAED,gDAAgD;IAChD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,cAAc,EAAE,MAAM,CAAC,SAAS,IAAI,OAAO;QAC3C,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,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot Agent Adapter
|
|
3
|
+
*
|
|
4
|
+
* Adapter implementation for GitHub Copilot CLI integration.
|
|
5
|
+
* Uses CopilotExecutor from agent-execution-engine for actual execution.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/adapters/copilot
|
|
8
|
+
*/
|
|
9
|
+
import type { CopilotConfig } from '@sudocode-ai/types/agents';
|
|
10
|
+
import type { IAgentAdapter, AgentMetadata } from 'agent-execution-engine/agents';
|
|
11
|
+
import type { ProcessConfig } from 'agent-execution-engine/process';
|
|
12
|
+
/**
|
|
13
|
+
* GitHub Copilot Agent Adapter
|
|
14
|
+
*
|
|
15
|
+
* Implements the IAgentAdapter interface for GitHub Copilot CLI.
|
|
16
|
+
* Copilot uses a plain text streaming protocol with session ID discovery
|
|
17
|
+
* via log file polling. The CopilotExecutor from agent-execution-engine
|
|
18
|
+
* handles output normalization to NormalizedEntry format.
|
|
19
|
+
*
|
|
20
|
+
* **Key Features:**
|
|
21
|
+
* - Plain text output → NormalizedEntry conversion via PlainTextLogProcessor
|
|
22
|
+
* - Session ID discovery through log directory polling
|
|
23
|
+
* - Native MCP support
|
|
24
|
+
* - Fine-grained tool permissions
|
|
25
|
+
* - Multiple model support (GPT, Claude, etc.)
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const adapter = new CopilotAdapter();
|
|
30
|
+
* const config: CopilotConfig = {
|
|
31
|
+
* workDir: '/path/to/project',
|
|
32
|
+
* model: 'gpt-4o',
|
|
33
|
+
* allowAllTools: true,
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* const processConfig = adapter.buildProcessConfig(config);
|
|
37
|
+
* const errors = adapter.validateConfig(config);
|
|
38
|
+
* if (errors.length === 0) {
|
|
39
|
+
* // Execute with CopilotExecutor
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare class CopilotAdapter implements IAgentAdapter<CopilotConfig> {
|
|
44
|
+
/**
|
|
45
|
+
* Agent metadata
|
|
46
|
+
*/
|
|
47
|
+
readonly metadata: AgentMetadata;
|
|
48
|
+
/**
|
|
49
|
+
* Build ProcessConfig from CopilotConfig
|
|
50
|
+
*
|
|
51
|
+
* Constructs command and arguments for spawning the Copilot CLI process.
|
|
52
|
+
*
|
|
53
|
+
* @param config - Copilot-specific configuration
|
|
54
|
+
* @returns ProcessConfig for process spawning
|
|
55
|
+
*/
|
|
56
|
+
buildProcessConfig(config: CopilotConfig): ProcessConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Build Copilot-specific command-line arguments
|
|
59
|
+
*
|
|
60
|
+
* @param config - Copilot configuration
|
|
61
|
+
* @returns Array of command-line arguments
|
|
62
|
+
*/
|
|
63
|
+
private buildCopilotArgs;
|
|
64
|
+
/**
|
|
65
|
+
* Validate CopilotConfig
|
|
66
|
+
*
|
|
67
|
+
* Checks for required fields, conflicting options, and invalid values.
|
|
68
|
+
*
|
|
69
|
+
* @param config - Configuration to validate
|
|
70
|
+
* @returns Array of validation error messages (empty if valid)
|
|
71
|
+
*/
|
|
72
|
+
validateConfig(config: CopilotConfig): string[];
|
|
73
|
+
/**
|
|
74
|
+
* Validate Copilot-specific configuration
|
|
75
|
+
*
|
|
76
|
+
* @param config - Configuration to validate
|
|
77
|
+
* @returns Array of validation errors
|
|
78
|
+
*/
|
|
79
|
+
private validateCopilotSpecific;
|
|
80
|
+
/**
|
|
81
|
+
* Get default CopilotConfig
|
|
82
|
+
*
|
|
83
|
+
* Returns sensible defaults for Copilot execution.
|
|
84
|
+
* Users should override workDir and other fields as needed.
|
|
85
|
+
*
|
|
86
|
+
* @returns Default configuration
|
|
87
|
+
*/
|
|
88
|
+
getDefaultConfig(): Partial<CopilotConfig>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Singleton instance of CopilotAdapter
|
|
92
|
+
*/
|
|
93
|
+
export declare const copilotAdapter: CopilotAdapter;
|
|
94
|
+
//# sourceMappingURL=copilot-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-adapter.d.ts","sourceRoot":"","sources":["../../../src/execution/adapters/copilot-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAGpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,cAAe,YAAW,aAAa,CAAC,aAAa,CAAC;IACjE;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAO9B;IAEF;;;;;;;OAOG;IACH,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa;IASxD;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAmCxB;;;;;;;OAOG;IACH,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE;IAO/C;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAmC/B;;;;;;;OAOG;IACH,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC;CAO3C;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot Agent Adapter
|
|
3
|
+
*
|
|
4
|
+
* Adapter implementation for GitHub Copilot CLI integration.
|
|
5
|
+
* Uses CopilotExecutor from agent-execution-engine for actual execution.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/adapters/copilot
|
|
8
|
+
*/
|
|
9
|
+
import { AgentConfigUtils } from './shared/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* GitHub Copilot Agent Adapter
|
|
12
|
+
*
|
|
13
|
+
* Implements the IAgentAdapter interface for GitHub Copilot CLI.
|
|
14
|
+
* Copilot uses a plain text streaming protocol with session ID discovery
|
|
15
|
+
* via log file polling. The CopilotExecutor from agent-execution-engine
|
|
16
|
+
* handles output normalization to NormalizedEntry format.
|
|
17
|
+
*
|
|
18
|
+
* **Key Features:**
|
|
19
|
+
* - Plain text output → NormalizedEntry conversion via PlainTextLogProcessor
|
|
20
|
+
* - Session ID discovery through log directory polling
|
|
21
|
+
* - Native MCP support
|
|
22
|
+
* - Fine-grained tool permissions
|
|
23
|
+
* - Multiple model support (GPT, Claude, etc.)
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const adapter = new CopilotAdapter();
|
|
28
|
+
* const config: CopilotConfig = {
|
|
29
|
+
* workDir: '/path/to/project',
|
|
30
|
+
* model: 'gpt-4o',
|
|
31
|
+
* allowAllTools: true,
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* const processConfig = adapter.buildProcessConfig(config);
|
|
35
|
+
* const errors = adapter.validateConfig(config);
|
|
36
|
+
* if (errors.length === 0) {
|
|
37
|
+
* // Execute with CopilotExecutor
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export class CopilotAdapter {
|
|
42
|
+
/**
|
|
43
|
+
* Agent metadata
|
|
44
|
+
*/
|
|
45
|
+
metadata = {
|
|
46
|
+
name: 'copilot',
|
|
47
|
+
displayName: 'GitHub Copilot',
|
|
48
|
+
version: '1.0.0',
|
|
49
|
+
supportedModes: ['structured', 'interactive'],
|
|
50
|
+
supportsStreaming: true,
|
|
51
|
+
supportsStructuredOutput: true, // Via NormalizedEntry conversion
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Build ProcessConfig from CopilotConfig
|
|
55
|
+
*
|
|
56
|
+
* Constructs command and arguments for spawning the Copilot CLI process.
|
|
57
|
+
*
|
|
58
|
+
* @param config - Copilot-specific configuration
|
|
59
|
+
* @returns ProcessConfig for process spawning
|
|
60
|
+
*/
|
|
61
|
+
buildProcessConfig(config) {
|
|
62
|
+
const args = this.buildCopilotArgs(config);
|
|
63
|
+
return AgentConfigUtils.buildBaseProcessConfig(config.copilotPath || config.executablePath || 'copilot', args, config);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build Copilot-specific command-line arguments
|
|
67
|
+
*
|
|
68
|
+
* @param config - Copilot configuration
|
|
69
|
+
* @returns Array of command-line arguments
|
|
70
|
+
*/
|
|
71
|
+
buildCopilotArgs(config) {
|
|
72
|
+
const args = [];
|
|
73
|
+
// Required args for logging (needed for session ID discovery)
|
|
74
|
+
args.push('--no-color');
|
|
75
|
+
args.push('--log-level', 'debug');
|
|
76
|
+
// Note: --log-dir will be added at execution time by the executor
|
|
77
|
+
// Add conditional flags using shared utility
|
|
78
|
+
args.push(...AgentConfigUtils.buildConditionalArgs([
|
|
79
|
+
{ flag: '--model', value: config.model, condition: !!config.model },
|
|
80
|
+
{ flag: '--allow-all-tools', condition: !!config.allowAllTools },
|
|
81
|
+
{ flag: '--allow-tool', value: config.allowTool, condition: !!config.allowTool },
|
|
82
|
+
{ flag: '--deny-tool', value: config.denyTool, condition: !!config.denyTool },
|
|
83
|
+
]));
|
|
84
|
+
// Additional directories
|
|
85
|
+
if (config.addDir) {
|
|
86
|
+
for (const dir of config.addDir) {
|
|
87
|
+
args.push('--add-dir', dir);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// MCP server configuration
|
|
91
|
+
if (config.disableMcpServer) {
|
|
92
|
+
for (const server of config.disableMcpServer) {
|
|
93
|
+
args.push('--disable-mcp-server', server);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return args;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Validate CopilotConfig
|
|
100
|
+
*
|
|
101
|
+
* Checks for required fields, conflicting options, and invalid values.
|
|
102
|
+
*
|
|
103
|
+
* @param config - Configuration to validate
|
|
104
|
+
* @returns Array of validation error messages (empty if valid)
|
|
105
|
+
*/
|
|
106
|
+
validateConfig(config) {
|
|
107
|
+
return [
|
|
108
|
+
...AgentConfigUtils.validateBaseConfig(config),
|
|
109
|
+
...this.validateCopilotSpecific(config),
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Validate Copilot-specific configuration
|
|
114
|
+
*
|
|
115
|
+
* @param config - Configuration to validate
|
|
116
|
+
* @returns Array of validation errors
|
|
117
|
+
*/
|
|
118
|
+
validateCopilotSpecific(config) {
|
|
119
|
+
const errors = [];
|
|
120
|
+
// Check for conflicting tool permissions
|
|
121
|
+
if (config.allowAllTools && config.allowTool) {
|
|
122
|
+
errors.push('allowTool is ignored when allowAllTools is true');
|
|
123
|
+
}
|
|
124
|
+
if (config.allowAllTools && config.denyTool) {
|
|
125
|
+
errors.push('denyTool takes precedence over allowAllTools');
|
|
126
|
+
}
|
|
127
|
+
// Validate addDir paths
|
|
128
|
+
errors.push(...AgentConfigUtils.validatePaths(config.addDir, 'addDir'));
|
|
129
|
+
// Validate disableMcpServer
|
|
130
|
+
if (config.disableMcpServer) {
|
|
131
|
+
for (const server of config.disableMcpServer) {
|
|
132
|
+
if (!server || server.trim() === '') {
|
|
133
|
+
errors.push('disableMcpServer contains empty server name');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Validate timeouts
|
|
138
|
+
errors.push(...AgentConfigUtils.validateTimeouts(config.timeout, config.idleTimeout));
|
|
139
|
+
// Validate retry config
|
|
140
|
+
errors.push(...AgentConfigUtils.validateRetryConfig(config.retry));
|
|
141
|
+
return errors;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get default CopilotConfig
|
|
145
|
+
*
|
|
146
|
+
* Returns sensible defaults for Copilot execution.
|
|
147
|
+
* Users should override workDir and other fields as needed.
|
|
148
|
+
*
|
|
149
|
+
* @returns Default configuration
|
|
150
|
+
*/
|
|
151
|
+
getDefaultConfig() {
|
|
152
|
+
return {
|
|
153
|
+
copilotPath: 'copilot',
|
|
154
|
+
allowAllTools: true, // Auto-approve for automation
|
|
155
|
+
model: undefined, // Use account default
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Singleton instance of CopilotAdapter
|
|
161
|
+
*/
|
|
162
|
+
export const copilotAdapter = new CopilotAdapter();
|
|
163
|
+
//# sourceMappingURL=copilot-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-adapter.js","sourceRoot":"","sources":["../../../src/execution/adapters/copilot-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EAAE,gBAAg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CAAC,CAAC;QAExE,4BAA4B;QAC5B,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC5B,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;gBAC7C,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;oBACpC,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;gBAC7D,CAAC;YACH,CAAC;QACH,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;;;;;;;OAOG;IACH,gBAAgB;QACd,OAAO;YACL,WAAW,EAAE,SAAS;YACtB,aAAa,EAAE,IAAI,EAAE,8BAA8B;YACnD,KAAK,EAAE,SAAS,EAAE,sBAAsB;SACzC,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot Config Builder
|
|
3
|
+
*
|
|
4
|
+
* Builds ProcessConfig from CopilotConfig for CLI-based execution.
|
|
5
|
+
* Handles all Copilot CLI flags and options.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/adapters/copilot
|
|
8
|
+
*/
|
|
9
|
+
import type { CopilotConfig } from '@sudocode-ai/types/agents';
|
|
10
|
+
import type { ProcessConfig } from 'agent-execution-engine/process';
|
|
11
|
+
/**
|
|
12
|
+
* Build ProcessConfig from CopilotConfig
|
|
13
|
+
*
|
|
14
|
+
* Constructs the command and arguments for the Copilot CLI based on configuration.
|
|
15
|
+
*
|
|
16
|
+
* @param config - Copilot configuration
|
|
17
|
+
* @returns ProcessConfig for spawning Copilot process
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const processConfig = buildCopilotProcessConfig({
|
|
22
|
+
* workDir: '/path/to/project',
|
|
23
|
+
* model: 'gpt-4o',
|
|
24
|
+
* allowAllTools: true,
|
|
25
|
+
* });
|
|
26
|
+
* // Command: copilot --no-color --log-level debug --log-dir /tmp/copilot_logs/... --model gpt-4o --allow-all-tools
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildCopilotProcessConfig(config: CopilotConfig): ProcessConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Build default CopilotConfig
|
|
32
|
+
*
|
|
33
|
+
* Provides sensible defaults for Copilot execution.
|
|
34
|
+
*
|
|
35
|
+
* @param workDir - Working directory (required)
|
|
36
|
+
* @returns Default CopilotConfig
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildDefaultCopilotConfig(workDir: string): CopilotConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Validate CopilotConfig
|
|
41
|
+
*
|
|
42
|
+
* Checks for logical conflicts and invalid values.
|
|
43
|
+
*
|
|
44
|
+
* @param config - Configuration to validate
|
|
45
|
+
* @returns Array of validation error messages (empty if valid)
|
|
46
|
+
*/
|
|
47
|
+
export declare function validateCopilotConfig(config: CopilotConfig): string[];
|
|
48
|
+
//# sourceMappingURL=copilot-config-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-config-builder.d.ts","sourceRoot":"","sources":["../../../src/execution/adapters/copilot-config-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAkD9E;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAOxE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAoCrE"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot Config Builder
|
|
3
|
+
*
|
|
4
|
+
* Builds ProcessConfig from CopilotConfig for CLI-based execution.
|
|
5
|
+
* Handles all Copilot CLI flags and options.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/adapters/copilot
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Build ProcessConfig from CopilotConfig
|
|
11
|
+
*
|
|
12
|
+
* Constructs the command and arguments for the Copilot CLI based on configuration.
|
|
13
|
+
*
|
|
14
|
+
* @param config - Copilot configuration
|
|
15
|
+
* @returns ProcessConfig for spawning Copilot process
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const processConfig = buildCopilotProcessConfig({
|
|
20
|
+
* workDir: '/path/to/project',
|
|
21
|
+
* model: 'gpt-4o',
|
|
22
|
+
* allowAllTools: true,
|
|
23
|
+
* });
|
|
24
|
+
* // Command: copilot --no-color --log-level debug --log-dir /tmp/copilot_logs/... --model gpt-4o --allow-all-tools
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function buildCopilotProcessConfig(config) {
|
|
28
|
+
const executable = config.copilotPath || config.executablePath || 'copilot';
|
|
29
|
+
const args = [];
|
|
30
|
+
// Required args for logging (needed for session ID discovery)
|
|
31
|
+
args.push('--no-color');
|
|
32
|
+
args.push('--log-level', 'debug');
|
|
33
|
+
// Note: --log-dir will be added at execution time by the executor
|
|
34
|
+
// Model selection
|
|
35
|
+
if (config.model) {
|
|
36
|
+
args.push('--model', config.model);
|
|
37
|
+
}
|
|
38
|
+
// Tool permissions
|
|
39
|
+
if (config.allowAllTools) {
|
|
40
|
+
args.push('--allow-all-tools');
|
|
41
|
+
}
|
|
42
|
+
if (config.allowTool) {
|
|
43
|
+
args.push('--allow-tool', config.allowTool);
|
|
44
|
+
}
|
|
45
|
+
if (config.denyTool) {
|
|
46
|
+
args.push('--deny-tool', config.denyTool);
|
|
47
|
+
}
|
|
48
|
+
// Additional directories
|
|
49
|
+
if (config.addDir) {
|
|
50
|
+
for (const dir of config.addDir) {
|
|
51
|
+
args.push('--add-dir', dir);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// MCP server configuration
|
|
55
|
+
if (config.disableMcpServer) {
|
|
56
|
+
for (const server of config.disableMcpServer) {
|
|
57
|
+
args.push('--disable-mcp-server', server);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
executablePath: executable,
|
|
62
|
+
args,
|
|
63
|
+
workDir: config.workDir,
|
|
64
|
+
env: config.env,
|
|
65
|
+
timeout: config.timeout,
|
|
66
|
+
idleTimeout: config.idleTimeout,
|
|
67
|
+
retry: config.retry,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build default CopilotConfig
|
|
72
|
+
*
|
|
73
|
+
* Provides sensible defaults for Copilot execution.
|
|
74
|
+
*
|
|
75
|
+
* @param workDir - Working directory (required)
|
|
76
|
+
* @returns Default CopilotConfig
|
|
77
|
+
*/
|
|
78
|
+
export function buildDefaultCopilotConfig(workDir) {
|
|
79
|
+
return {
|
|
80
|
+
workDir,
|
|
81
|
+
copilotPath: 'copilot',
|
|
82
|
+
allowAllTools: true, // Auto-approve for automation workflows
|
|
83
|
+
model: undefined, // Use account default
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Validate CopilotConfig
|
|
88
|
+
*
|
|
89
|
+
* Checks for logical conflicts and invalid values.
|
|
90
|
+
*
|
|
91
|
+
* @param config - Configuration to validate
|
|
92
|
+
* @returns Array of validation error messages (empty if valid)
|
|
93
|
+
*/
|
|
94
|
+
export function validateCopilotConfig(config) {
|
|
95
|
+
const errors = [];
|
|
96
|
+
// workDir is required
|
|
97
|
+
if (!config.workDir) {
|
|
98
|
+
errors.push('workDir is required');
|
|
99
|
+
}
|
|
100
|
+
// Check for conflicting tool permissions
|
|
101
|
+
if (config.allowAllTools && config.allowTool) {
|
|
102
|
+
errors.push('allowTool is ignored when allowAllTools is true');
|
|
103
|
+
}
|
|
104
|
+
if (config.allowAllTools && config.denyTool) {
|
|
105
|
+
errors.push('denyTool takes precedence over allowAllTools');
|
|
106
|
+
}
|
|
107
|
+
// Validate addDir paths (basic check)
|
|
108
|
+
if (config.addDir) {
|
|
109
|
+
for (const dir of config.addDir) {
|
|
110
|
+
if (!dir || dir.trim() === '') {
|
|
111
|
+
errors.push('addDir contains empty path');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Validate disableMcpServer
|
|
116
|
+
if (config.disableMcpServer) {
|
|
117
|
+
for (const server of config.disableMcpServer) {
|
|
118
|
+
if (!server || server.trim() === '') {
|
|
119
|
+
errors.push('disableMcpServer contains empty server name');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return errors;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=copilot-config-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-config-builder.js","sourceRoot":"","sources":["../../../src/execution/adapters/copilot-config-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAqB;IAC7D,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,cAAc,IAAI,SAAS,CAAC;IAC5E,MAAM,IAAI,G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MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;gBACpC,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
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 type { IAgentAdapter, AgentMetadata } from "agent-execution-engine/agents";
|
|
10
|
+
import type { ProcessConfig } from "agent-execution-engine/process";
|
|
11
|
+
import type { CursorConfig } from "@sudocode-ai/types/agents";
|
|
12
|
+
/**
|
|
13
|
+
* Cursor Agent Adapter
|
|
14
|
+
*
|
|
15
|
+
* Provides Cursor-specific configuration building and capabilities.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const adapter = new CursorAdapter();
|
|
20
|
+
* const config = adapter.buildProcessConfig({
|
|
21
|
+
* workDir: '/path/to/project',
|
|
22
|
+
* force: true,
|
|
23
|
+
* model: 'sonnet-4.5',
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const processManager = createProcessManager(config);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class CursorAdapter implements IAgentAdapter<CursorConfig> {
|
|
30
|
+
readonly metadata: AgentMetadata;
|
|
31
|
+
/**
|
|
32
|
+
* Build ProcessConfig from Cursor-specific configuration
|
|
33
|
+
*
|
|
34
|
+
* @param config - Cursor configuration
|
|
35
|
+
* @returns Generic ProcessConfig
|
|
36
|
+
*/
|
|
37
|
+
buildProcessConfig(config: CursorConfig): ProcessConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Build Cursor-specific command-line arguments
|
|
40
|
+
*
|
|
41
|
+
* @param config - Cursor configuration
|
|
42
|
+
* @returns Array of command-line arguments
|
|
43
|
+
*/
|
|
44
|
+
private buildCursorArgs;
|
|
45
|
+
/**
|
|
46
|
+
* Validate Cursor configuration
|
|
47
|
+
*
|
|
48
|
+
* @param config - Configuration to validate
|
|
49
|
+
* @returns Array of validation errors (empty if valid)
|
|
50
|
+
*/
|
|
51
|
+
validateConfig(config: CursorConfig): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Validate Cursor-specific configuration
|
|
54
|
+
*
|
|
55
|
+
* @param config - Configuration to validate
|
|
56
|
+
* @returns Array of validation errors
|
|
57
|
+
*/
|
|
58
|
+
private validateCursorSpecific;
|
|
59
|
+
/**
|
|
60
|
+
* Get default Cursor configuration
|
|
61
|
+
*
|
|
62
|
+
* @returns Default configuration values
|
|
63
|
+
*/
|
|
64
|
+
getDefaultConfig(): Partial<CursorConfig>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=cursor-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-adapter.d.ts","sourceRoot":"","sources":["../../../src/execution/adapters/cursor-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAe9D;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAc,YAAW,aAAa,CAAC,YAAY,CAAC;IAC/D,QAAQ,CAAC,QAAQ,gBAAmB;IAEpC;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa;IASvD;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAkBvB;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE;IAS9C;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IA+B9B;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC;CAO1C"}
|