@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
package/README.md
CHANGED
|
@@ -17,3 +17,9 @@ Run the sudocode companion app with `sudocode server`. You can specify a port wi
|
|
|
17
17
|
|
|
18
18
|
The server will start on `http://localhost:3000` by default.
|
|
19
19
|
|
|
20
|
+
### Environment Variables
|
|
21
|
+
|
|
22
|
+
The server supports the following environment variables (all prefixed with `SUDOCODE_` to avoid conflicts with project environments):
|
|
23
|
+
|
|
24
|
+
- `SUDOCODE_PORT` - Server port (default: 3000)
|
|
25
|
+
- `SUDOCODE_WATCH` - Enable/disable file watching (default: enabled, set to `false` to disable)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for agent-specific errors
|
|
3
|
+
*
|
|
4
|
+
* These errors provide structured error information for multi-agent execution scenarios,
|
|
5
|
+
* including error codes and details for frontend consumption.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base class for agent-related errors
|
|
9
|
+
*/
|
|
10
|
+
export declare class AgentError extends Error {
|
|
11
|
+
readonly code: string;
|
|
12
|
+
readonly details: Record<string, unknown>;
|
|
13
|
+
constructor(message: string, code: string, details?: Record<string, unknown>);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error thrown when an agent is not found in the registry
|
|
17
|
+
* HTTP Status: 400 Bad Request
|
|
18
|
+
*/
|
|
19
|
+
export declare class AgentNotFoundError extends AgentError {
|
|
20
|
+
constructor(agentType: string, availableAgents: string[]);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when an agent is registered but not yet implemented (stub)
|
|
24
|
+
* HTTP Status: 501 Not Implemented
|
|
25
|
+
*/
|
|
26
|
+
export declare class AgentNotImplementedError extends AgentError {
|
|
27
|
+
constructor(agentType: string);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown when agent configuration fails validation
|
|
31
|
+
* HTTP Status: 400 Bad Request
|
|
32
|
+
*/
|
|
33
|
+
export declare class AgentConfigValidationError extends AgentError {
|
|
34
|
+
constructor(agentType: string, validationErrors: string[]);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Error thrown when agent execution fails
|
|
38
|
+
* HTTP Status: 500 Internal Server Error
|
|
39
|
+
*/
|
|
40
|
+
export declare class AgentExecutionError extends AgentError {
|
|
41
|
+
constructor(agentType: string, message: string, details?: Record<string, unknown>);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=agent-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-errors.d.ts","sourceRoot":"","sources":["../../src/errors/agent-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAErC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;CAOjF;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,UAAU;gBACpC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE;CAUzD;AAED;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,UAAU;gBAC1C,SAAS,EAAE,MAAM;CAU9B;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,UAAU;gBAC5C,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE;CAU1D;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;CAUtF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for agent-specific errors
|
|
3
|
+
*
|
|
4
|
+
* These errors provide structured error information for multi-agent execution scenarios,
|
|
5
|
+
* including error codes and details for frontend consumption.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base class for agent-related errors
|
|
9
|
+
*/
|
|
10
|
+
export class AgentError extends Error {
|
|
11
|
+
code;
|
|
12
|
+
details;
|
|
13
|
+
constructor(message, code, details = {}) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.details = details;
|
|
18
|
+
Error.captureStackTrace(this, this.constructor);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Error thrown when an agent is not found in the registry
|
|
23
|
+
* HTTP Status: 400 Bad Request
|
|
24
|
+
*/
|
|
25
|
+
export class AgentNotFoundError extends AgentError {
|
|
26
|
+
constructor(agentType, availableAgents) {
|
|
27
|
+
super(`Agent '${agentType}' not found in registry`, 'AGENT_NOT_FOUND', {
|
|
28
|
+
agentType,
|
|
29
|
+
availableAgents,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Error thrown when an agent is registered but not yet implemented (stub)
|
|
35
|
+
* HTTP Status: 501 Not Implemented
|
|
36
|
+
*/
|
|
37
|
+
export class AgentNotImplementedError extends AgentError {
|
|
38
|
+
constructor(agentType) {
|
|
39
|
+
super(`Agent '${agentType}' is not yet implemented`, 'AGENT_NOT_IMPLEMENTED', {
|
|
40
|
+
agentType,
|
|
41
|
+
message: 'This agent is registered but not yet fully implemented. Check back in a future release.',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Error thrown when agent configuration fails validation
|
|
47
|
+
* HTTP Status: 400 Bad Request
|
|
48
|
+
*/
|
|
49
|
+
export class AgentConfigValidationError extends AgentError {
|
|
50
|
+
constructor(agentType, validationErrors) {
|
|
51
|
+
super('Agent configuration validation failed', 'AGENT_CONFIG_VALIDATION_ERROR', {
|
|
52
|
+
agentType,
|
|
53
|
+
errors: validationErrors,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Error thrown when agent execution fails
|
|
59
|
+
* HTTP Status: 500 Internal Server Error
|
|
60
|
+
*/
|
|
61
|
+
export class AgentExecutionError extends AgentError {
|
|
62
|
+
constructor(agentType, message, details = {}) {
|
|
63
|
+
super(message, 'AGENT_EXECUTION_ERROR', {
|
|
64
|
+
agentType,
|
|
65
|
+
...details,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=agent-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-errors.js","sourceRoot":"","sources":["../../src/errors/agent-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnB,IAAI,CAAS;IACb,OAAO,CAA0B;IAEjD,YAAY,OAAe,EAAE,IAAY,EAAE,UAAmC,EAAE;QAC9E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAChD,YAAY,SAAiB,EAAE,eAAyB;QACtD,KAAK,CACH,UAAU,SAAS,yBAAyB,EAC5C,iBAAiB,EACjB;YACE,SAAS;YACT,eAAe;SAChB,CACF,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IACtD,YAAY,SAAiB;QAC3B,KAAK,CACH,UAAU,SAAS,0BAA0B,EAC7C,uBAAuB,EACvB;YACE,SAAS;YACT,OAAO,EAAE,yFAAyF;SACnG,CACF,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,UAAU;IACxD,YAAY,SAAiB,EAAE,gBAA0B;QACvD,KAAK,CACH,uCAAuC,EACvC,+BAA+B,EAC/B;YACE,SAAS;YACT,MAAM,EAAE,gBAAgB;SACzB,CACF,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,YAAY,SAAiB,EAAE,OAAe,EAAE,UAAmC,EAAE;QACnF,KAAK,CACH,OAAO,EACP,uBAAuB,EACvB;YACE,SAAS;YACT,GAAG,OAAO;SACX,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code Agent Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements the IAgentAdapter interface for Claude Code CLI.
|
|
5
|
+
* Provides agent-specific configuration building and metadata using
|
|
6
|
+
* the expanded ClaudeCodeConfig from @sudocode-ai/types.
|
|
7
|
+
*
|
|
8
|
+
* @module execution/adapters/claude-adapter
|
|
9
|
+
*/
|
|
10
|
+
import type { IAgentAdapter, AgentMetadata } from "agent-execution-engine/agents";
|
|
11
|
+
import type { ProcessConfig } from "agent-execution-engine/process";
|
|
12
|
+
import type { ClaudeCodeConfig } from "@sudocode-ai/types/agents";
|
|
13
|
+
/**
|
|
14
|
+
* Claude Code Adapter
|
|
15
|
+
*
|
|
16
|
+
* Provides configuration building and validation for Claude Code CLI.
|
|
17
|
+
* Uses the expanded ClaudeCodeConfig which supports model selection,
|
|
18
|
+
* tool permissions, system prompts, MCP configuration, and more.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const adapter = new ClaudeCodeAdapter();
|
|
23
|
+
*
|
|
24
|
+
* const processConfig = adapter.buildProcessConfig({
|
|
25
|
+
* workDir: '/path/to/project',
|
|
26
|
+
* print: true,
|
|
27
|
+
* outputFormat: 'stream-json',
|
|
28
|
+
* model: 'sonnet',
|
|
29
|
+
* allowedTools: ['Bash(git:*)', 'Edit', 'Read'],
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class ClaudeCodeAdapter implements IAgentAdapter<ClaudeCodeConfig> {
|
|
34
|
+
/**
|
|
35
|
+
* Agent metadata
|
|
36
|
+
*/
|
|
37
|
+
readonly metadata: AgentMetadata;
|
|
38
|
+
/**
|
|
39
|
+
* Build ProcessConfig from Claude Code configuration
|
|
40
|
+
*
|
|
41
|
+
* @param config - Claude Code configuration
|
|
42
|
+
* @returns Generic ProcessConfig for process spawning
|
|
43
|
+
*/
|
|
44
|
+
buildProcessConfig(config: ClaudeCodeConfig): ProcessConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Validate Claude Code configuration
|
|
47
|
+
*
|
|
48
|
+
* @param config - Configuration to validate
|
|
49
|
+
* @returns Array of validation errors (empty if valid)
|
|
50
|
+
*/
|
|
51
|
+
validateConfig(config: ClaudeCodeConfig): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Get default configuration values
|
|
54
|
+
*
|
|
55
|
+
* @returns Default Claude Code configuration
|
|
56
|
+
*/
|
|
57
|
+
getDefaultConfig(): Partial<ClaudeCodeConfig>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Singleton instance of Claude Code adapter
|
|
61
|
+
*/
|
|
62
|
+
export declare const claudeCodeAdapter: ClaudeCodeAdapter;
|
|
63
|
+
//# sourceMappingURL=claude-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-adapter.d.ts","sourceRoot":"","sources":["../../../src/execution/adapters/claude-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAOlE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,iBAAkB,YAAW,aAAa,CAAC,gBAAgB,CAAC;IACvE;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAO9B;IAEF;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa;IAU3D;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE;IAIlD;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAS9C;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code Agent Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements the IAgentAdapter interface for Claude Code CLI.
|
|
5
|
+
* Provides agent-specific configuration building and metadata using
|
|
6
|
+
* the expanded ClaudeCodeConfig from @sudocode-ai/types.
|
|
7
|
+
*
|
|
8
|
+
* @module execution/adapters/claude-adapter
|
|
9
|
+
*/
|
|
10
|
+
import { AgentConfigUtils } from "./shared/index.js";
|
|
11
|
+
import { buildClaudeArgs, validateClaudeConfig, } from "../process/builders/claude.js";
|
|
12
|
+
/**
|
|
13
|
+
* Claude Code Adapter
|
|
14
|
+
*
|
|
15
|
+
* Provides configuration building and validation for Claude Code CLI.
|
|
16
|
+
* Uses the expanded ClaudeCodeConfig which supports model selection,
|
|
17
|
+
* tool permissions, system prompts, MCP configuration, and more.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const adapter = new ClaudeCodeAdapter();
|
|
22
|
+
*
|
|
23
|
+
* const processConfig = adapter.buildProcessConfig({
|
|
24
|
+
* workDir: '/path/to/project',
|
|
25
|
+
* print: true,
|
|
26
|
+
* outputFormat: 'stream-json',
|
|
27
|
+
* model: 'sonnet',
|
|
28
|
+
* allowedTools: ['Bash(git:*)', 'Edit', 'Read'],
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export class ClaudeCodeAdapter {
|
|
33
|
+
/**
|
|
34
|
+
* Agent metadata
|
|
35
|
+
*/
|
|
36
|
+
metadata = {
|
|
37
|
+
name: "claude-code",
|
|
38
|
+
displayName: "Claude",
|
|
39
|
+
version: "1.0.0",
|
|
40
|
+
supportedModes: ["structured", "interactive", "hybrid"],
|
|
41
|
+
supportsStreaming: true,
|
|
42
|
+
supportsStructuredOutput: true,
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Build ProcessConfig from Claude Code configuration
|
|
46
|
+
*
|
|
47
|
+
* @param config - Claude Code configuration
|
|
48
|
+
* @returns Generic ProcessConfig for process spawning
|
|
49
|
+
*/
|
|
50
|
+
buildProcessConfig(config) {
|
|
51
|
+
const args = buildClaudeArgs(config);
|
|
52
|
+
return AgentConfigUtils.buildBaseProcessConfig(config.claudePath || "claude", args, config);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Validate Claude Code configuration
|
|
56
|
+
*
|
|
57
|
+
* @param config - Configuration to validate
|
|
58
|
+
* @returns Array of validation errors (empty if valid)
|
|
59
|
+
*/
|
|
60
|
+
validateConfig(config) {
|
|
61
|
+
return validateClaudeConfig(config);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get default configuration values
|
|
65
|
+
*
|
|
66
|
+
* @returns Default Claude Code configuration
|
|
67
|
+
*/
|
|
68
|
+
getDefaultConfig() {
|
|
69
|
+
return {
|
|
70
|
+
claudePath: "claude",
|
|
71
|
+
print: true,
|
|
72
|
+
outputFormat: "stream-json",
|
|
73
|
+
verbose: true, // Required for stream-json with print
|
|
74
|
+
dangerouslySkipPermissions: false,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Singleton instance of Claude Code adapter
|
|
80
|
+
*/
|
|
81
|
+
export const claudeCodeAdapter = new ClaudeCodeAdapter();
|
|
82
|
+
//# sourceMappingURL=claude-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-adapter.js","sourceRoot":"","sources":["../../../src/execution/adapters/claude-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,eAAe,EACf,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;OAEG;IACM,QAAQ,GAAkB;QACjC,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,QAAQ;QACrB,OAAO,EAAE,OAAO;QAChB,cAAc,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,QAAQ,CAAC;QACvD,iBAAiB,EAAE,IAAI;QACvB,wBAAwB,EAAE,IAAI;KAC/B,CAAC;IAEF;;;;;OAKG;IACH,kBAAkB,CAAC,MAAwB;QACzC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QAErC,OAAO,gBAAgB,CAAC,sBAAsB,CAC5C,MAAM,CAAC,UAAU,IAAI,QAAQ,EAC7B,IAAI,EACJ,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,MAAwB;QACrC,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,gBAAgB;QACd,OAAO;YACL,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE,IAAI,EAAE,sCAAsC;YACrD,0BAA0B,EAAE,KAAK;SAClC,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Codex Agent Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements the IAgentAdapter interface for OpenAI Codex CLI.
|
|
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 { CodexConfig } from "@sudocode-ai/types/agents";
|
|
12
|
+
/**
|
|
13
|
+
* OpenAI Codex Agent Adapter
|
|
14
|
+
*
|
|
15
|
+
* Provides Codex-specific configuration building and capabilities.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const adapter = new CodexAdapter();
|
|
20
|
+
* const config = adapter.buildProcessConfig({
|
|
21
|
+
* workDir: '/path/to/project',
|
|
22
|
+
* exec: true,
|
|
23
|
+
* json: true,
|
|
24
|
+
* fullAuto: true,
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* const processManager = createProcessManager(config);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class CodexAdapter implements IAgentAdapter<CodexConfig> {
|
|
31
|
+
readonly metadata: AgentMetadata;
|
|
32
|
+
/**
|
|
33
|
+
* Build ProcessConfig from Codex-specific configuration
|
|
34
|
+
*
|
|
35
|
+
* @param config - Codex configuration
|
|
36
|
+
* @returns Generic ProcessConfig
|
|
37
|
+
*/
|
|
38
|
+
buildProcessConfig(config: CodexConfig): ProcessConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Build Codex-specific command-line arguments
|
|
41
|
+
*
|
|
42
|
+
* @param config - Codex configuration
|
|
43
|
+
* @returns Array of command-line arguments
|
|
44
|
+
*/
|
|
45
|
+
private buildCodexArgs;
|
|
46
|
+
/**
|
|
47
|
+
* Validate Codex configuration
|
|
48
|
+
*
|
|
49
|
+
* @param config - Configuration to validate
|
|
50
|
+
* @returns Array of validation errors (empty if valid)
|
|
51
|
+
*/
|
|
52
|
+
validateConfig(config: CodexConfig): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Validate Codex-specific configuration
|
|
55
|
+
*
|
|
56
|
+
* @param config - Configuration to validate
|
|
57
|
+
* @returns Array of validation errors
|
|
58
|
+
*/
|
|
59
|
+
private validateCodexSpecific;
|
|
60
|
+
/**
|
|
61
|
+
* Get default Codex configuration
|
|
62
|
+
*
|
|
63
|
+
* @returns Default configuration values
|
|
64
|
+
*/
|
|
65
|
+
getDefaultConfig(): Partial<CodexConfig>;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=codex-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-adapter.d.ts","sourceRoot":"","sources":["../../../src/execution/adapters/codex-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,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAe7D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAa,YAAW,aAAa,CAAC,WAAW,CAAC;IAC7D,QAAQ,CAAC,QAAQ,gBAAkB;IAEnC;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa;IAStD;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAuEtB;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;IAO7C;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAiE7B;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,WAAW,CAAC;CAazC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Codex Agent Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements the IAgentAdapter interface for OpenAI Codex CLI.
|
|
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
|
+
* OpenAI Codex agent metadata
|
|
12
|
+
*/
|
|
13
|
+
const CODEX_METADATA = {
|
|
14
|
+
name: "codex",
|
|
15
|
+
displayName: "Codex",
|
|
16
|
+
version: ">=1.0.0",
|
|
17
|
+
supportedModes: ["structured", "interactive"],
|
|
18
|
+
supportsStreaming: true,
|
|
19
|
+
supportsStructuredOutput: true,
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* OpenAI Codex Agent Adapter
|
|
23
|
+
*
|
|
24
|
+
* Provides Codex-specific configuration building and capabilities.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const adapter = new CodexAdapter();
|
|
29
|
+
* const config = adapter.buildProcessConfig({
|
|
30
|
+
* workDir: '/path/to/project',
|
|
31
|
+
* exec: true,
|
|
32
|
+
* json: true,
|
|
33
|
+
* fullAuto: true,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* const processManager = createProcessManager(config);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export class CodexAdapter {
|
|
40
|
+
metadata = CODEX_METADATA;
|
|
41
|
+
/**
|
|
42
|
+
* Build ProcessConfig from Codex-specific configuration
|
|
43
|
+
*
|
|
44
|
+
* @param config - Codex configuration
|
|
45
|
+
* @returns Generic ProcessConfig
|
|
46
|
+
*/
|
|
47
|
+
buildProcessConfig(config) {
|
|
48
|
+
const args = this.buildCodexArgs(config);
|
|
49
|
+
return AgentConfigUtils.buildBaseProcessConfig(config.codexPath || "codex", args, config);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build Codex-specific command-line arguments
|
|
53
|
+
*
|
|
54
|
+
* @param config - Codex configuration
|
|
55
|
+
* @returns Array of command-line arguments
|
|
56
|
+
*/
|
|
57
|
+
buildCodexArgs(config) {
|
|
58
|
+
const args = [];
|
|
59
|
+
// Add 'exec' subcommand for non-interactive mode
|
|
60
|
+
if (config.exec !== false) {
|
|
61
|
+
args.push("exec");
|
|
62
|
+
// Add '-' to explicitly read prompt from stdin
|
|
63
|
+
// This prevents the "Reading prompt from stdin..." blocking message
|
|
64
|
+
if (!config.prompt) {
|
|
65
|
+
args.push("-");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Add conditional flags using shared utility
|
|
69
|
+
args.push(...AgentConfigUtils.buildConditionalArgs([
|
|
70
|
+
{ flag: "--json", condition: !!config.json },
|
|
71
|
+
{ flag: "--experimental-json", condition: !!config.experimentalJson },
|
|
72
|
+
{
|
|
73
|
+
flag: "--output-last-message",
|
|
74
|
+
value: config.outputLastMessage,
|
|
75
|
+
condition: !!config.outputLastMessage,
|
|
76
|
+
},
|
|
77
|
+
{ flag: "--model", value: config.model, condition: !!config.model },
|
|
78
|
+
{
|
|
79
|
+
flag: "--sandbox",
|
|
80
|
+
value: config.sandbox,
|
|
81
|
+
condition: !!config.sandbox,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
flag: "--ask-for-approval",
|
|
85
|
+
value: config.askForApproval,
|
|
86
|
+
condition: !!config.askForApproval,
|
|
87
|
+
},
|
|
88
|
+
{ flag: "--full-auto", condition: !!config.fullAuto },
|
|
89
|
+
{ flag: "--skip-git-repo-check", condition: !!config.skipGitRepoCheck },
|
|
90
|
+
{ flag: "--color", value: config.color, condition: !!config.color },
|
|
91
|
+
{ flag: "--search", condition: !!config.search },
|
|
92
|
+
{
|
|
93
|
+
flag: "--profile",
|
|
94
|
+
value: config.profile,
|
|
95
|
+
condition: !!config.profile,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
flag: "--dangerously-bypass-approvals-and-sandbox",
|
|
99
|
+
condition: !!config.yolo,
|
|
100
|
+
},
|
|
101
|
+
]));
|
|
102
|
+
// Add --image flag(s) for image attachments
|
|
103
|
+
if (config.image && config.image.length > 0) {
|
|
104
|
+
args.push("--image", config.image.join(","));
|
|
105
|
+
}
|
|
106
|
+
// Add --add-dir flag(s) for additional directories
|
|
107
|
+
if (config.addDir && config.addDir.length > 0) {
|
|
108
|
+
config.addDir.forEach((dir) => {
|
|
109
|
+
args.push("--add-dir", dir);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
// Add prompt as the last argument (if provided)
|
|
113
|
+
if (config.prompt) {
|
|
114
|
+
args.push(config.prompt);
|
|
115
|
+
}
|
|
116
|
+
return args;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Validate Codex configuration
|
|
120
|
+
*
|
|
121
|
+
* @param config - Configuration to validate
|
|
122
|
+
* @returns Array of validation errors (empty if valid)
|
|
123
|
+
*/
|
|
124
|
+
validateConfig(config) {
|
|
125
|
+
return [
|
|
126
|
+
...AgentConfigUtils.validateBaseConfig(config),
|
|
127
|
+
...this.validateCodexSpecific(config),
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Validate Codex-specific configuration
|
|
132
|
+
*
|
|
133
|
+
* @param config - Configuration to validate
|
|
134
|
+
* @returns Array of validation errors
|
|
135
|
+
*/
|
|
136
|
+
validateCodexSpecific(config) {
|
|
137
|
+
const errors = [];
|
|
138
|
+
// Validate mutually exclusive JSON flags
|
|
139
|
+
if (config.json && config.experimentalJson) {
|
|
140
|
+
errors.push("Cannot use both json and experimentalJson flags");
|
|
141
|
+
}
|
|
142
|
+
// Validate fullAuto conflicts
|
|
143
|
+
if (config.fullAuto && (config.sandbox || config.askForApproval)) {
|
|
144
|
+
errors.push("fullAuto cannot be used with sandbox or askForApproval flags");
|
|
145
|
+
}
|
|
146
|
+
// Validate yolo conflicts
|
|
147
|
+
if (config.yolo &&
|
|
148
|
+
(config.sandbox || config.askForApproval || config.fullAuto)) {
|
|
149
|
+
errors.push("yolo flag cannot be used with sandbox, askForApproval, or fullAuto flags");
|
|
150
|
+
}
|
|
151
|
+
// Validate enum values using shared utility
|
|
152
|
+
errors.push(...AgentConfigUtils.validateEnum(config.sandbox, ["read-only", "workspace-write", "danger-full-access"], "sandbox"));
|
|
153
|
+
errors.push(...AgentConfigUtils.validateEnum(config.askForApproval, ["untrusted", "on-failure", "on-request", "never"], "askForApproval"));
|
|
154
|
+
errors.push(...AgentConfigUtils.validateEnum(config.color, ["always", "never", "auto"], "color"));
|
|
155
|
+
// Validate paths
|
|
156
|
+
errors.push(...AgentConfigUtils.validatePaths(config.addDir, "addDir"));
|
|
157
|
+
errors.push(...AgentConfigUtils.validatePaths(config.image, "image"));
|
|
158
|
+
// Validate timeouts
|
|
159
|
+
errors.push(...AgentConfigUtils.validateTimeouts(config.timeout, config.idleTimeout));
|
|
160
|
+
// Validate retry config
|
|
161
|
+
errors.push(...AgentConfigUtils.validateRetryConfig(config.retry));
|
|
162
|
+
return errors;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get default Codex configuration
|
|
166
|
+
*
|
|
167
|
+
* @returns Default configuration values
|
|
168
|
+
*/
|
|
169
|
+
getDefaultConfig() {
|
|
170
|
+
return {
|
|
171
|
+
codexPath: "codex",
|
|
172
|
+
exec: true, // Use non-interactive mode by default for automation
|
|
173
|
+
json: true, // Enable structured output
|
|
174
|
+
experimentalJson: false,
|
|
175
|
+
fullAuto: true, // Auto-approve workspace changes
|
|
176
|
+
skipGitRepoCheck: false,
|
|
177
|
+
color: "auto",
|
|
178
|
+
search: true, // Enable web browsing
|
|
179
|
+
yolo: false,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=codex-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-adapter.js","sourceRoot":"","sources":["../../../src/execution/adapters/codex-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,MAAM,cAAc,GAAkB;IACpC,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;IAC7C,iBAAiB,EAAE,IAAI;IACvB,wBAAwB,EAAE,IAAI;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,YAAY;IACd,QAAQ,GAAG,cAAc,CAAC;IAEnC;;;;;OAKG;IACH,kBAAkB,CAAC,MAAmB;QACpC,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACzC,OAAO,gBAAgB,CAAC,sBAAsB,CAC5C,MAAM,CAAC,SAAS,IAAI,OAAO,EAC3B,IAAI,EACJ,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACK,cAAc,CAAC,MAAmB;QACxC,MAAM,IAAI,GAAa,EAAE,CAAC;QAE1B,iDAAiD;QACjD,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAElB,+CAA+C;YAC/C,oEAAoE;YACpE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACnB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;QAED,6CAA6C;QAC7C,IAAI,CAAC,IAAI,CACP,GAAG,gBAAgB,CAAC,oBAAoB,CAAC;YACvC,EAAE,IAA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CAAC,CAAC,CAAC;QAEnE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,gBAAgB;QACd,OAAO;YACL,SAAS,EAAE,OAAO;YAClB,IAAI,EAAE,IAAI,EAAE,qDAAqD;YACjE,IAAI,EAAE,IAAI,EAAE,2BAA2B;YACvC,gBAAgB,EAAE,KAAK;YACvB,QAAQ,EAAE,IAAI,EAAE,iCAAiC;YACjD,gBAAgB,EAAE,KAAK;YACvB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,IAAI,EAAE,sBAAsB;YACpC,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
import type { ProcessConfig } from 'agent-execution-engine/process';
|
|
10
|
+
import type { CodexConfig } from '@sudocode-ai/types/agents';
|
|
11
|
+
/**
|
|
12
|
+
* Build a generic ProcessConfig from Codex specific configuration
|
|
13
|
+
*
|
|
14
|
+
* @param config - Codex specific configuration
|
|
15
|
+
* @returns Generic ProcessConfig that can be used with any ProcessManager
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const config = buildCodexConfig({
|
|
20
|
+
* workDir: '/path/to/project',
|
|
21
|
+
* exec: true,
|
|
22
|
+
* json: true,
|
|
23
|
+
* fullAuto: true,
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const process = await manager.acquireProcess(config);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildCodexConfig(config: CodexConfig): ProcessConfig;
|
|
30
|
+
//# sourceMappingURL=codex-config-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-config-builder.d.ts","sourceRoot":"","sources":["../../../src/execution/adapters/codex-config-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAoGnE"}
|