sweteam 0.8.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -30
- package/dist/adapters/claude-code.d.ts.map +1 -1
- package/dist/adapters/claude-code.js +86 -18
- package/dist/adapters/claude-code.js.map +1 -1
- package/dist/adapters/codex.d.ts.map +1 -1
- package/dist/adapters/codex.js +43 -12
- package/dist/adapters/codex.js.map +1 -1
- package/dist/adapters/custom.d.ts.map +1 -1
- package/dist/adapters/custom.js +75 -45
- package/dist/adapters/custom.js.map +1 -1
- package/dist/adapters/opencode.d.ts.map +1 -1
- package/dist/adapters/opencode.js +43 -12
- package/dist/adapters/opencode.js.map +1 -1
- package/dist/adapters/prompt-detection.d.ts.map +1 -1
- package/dist/adapters/prompt-detection.js +11 -2
- package/dist/adapters/prompt-detection.js.map +1 -1
- package/dist/commands/delete.d.ts +1 -1
- package/dist/commands/delete.d.ts.map +1 -1
- package/dist/commands/delete.js +25 -3
- package/dist/commands/delete.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +1 -1
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/show.d.ts.map +1 -1
- package/dist/commands/show.js +10 -8
- package/dist/commands/show.js.map +1 -1
- package/dist/config/gh-auth.d.ts.map +1 -1
- package/dist/config/gh-auth.js +5 -1
- package/dist/config/gh-auth.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +32 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +51 -16
- package/dist/db/client.js.map +1 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +3 -9
- package/dist/db/schema.js.map +1 -1
- package/dist/git/git.d.ts +1 -1
- package/dist/git/git.d.ts.map +1 -1
- package/dist/git/git.js +94 -29
- package/dist/git/git.js.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +53 -27
- package/dist/lifecycle.js.map +1 -1
- package/dist/orchestrator/build-handler.d.ts.map +1 -1
- package/dist/orchestrator/build-handler.js +40 -16
- package/dist/orchestrator/build-handler.js.map +1 -1
- package/dist/orchestrator/dag.d.ts +2 -0
- package/dist/orchestrator/dag.d.ts.map +1 -1
- package/dist/orchestrator/dag.js +30 -7
- package/dist/orchestrator/dag.js.map +1 -1
- package/dist/orchestrator/feedback-handler.d.ts.map +1 -1
- package/dist/orchestrator/feedback-handler.js +140 -29
- package/dist/orchestrator/feedback-handler.js.map +1 -1
- package/dist/orchestrator/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator/orchestrator.js +160 -79
- package/dist/orchestrator/orchestrator.js.map +1 -1
- package/dist/orchestrator/parallel-runner.d.ts.map +1 -1
- package/dist/orchestrator/parallel-runner.js +53 -9
- package/dist/orchestrator/parallel-runner.js.map +1 -1
- package/dist/orchestrator/reviewer.d.ts.map +1 -1
- package/dist/orchestrator/reviewer.js +54 -15
- package/dist/orchestrator/reviewer.js.map +1 -1
- package/dist/orchestrator/task-runner.d.ts.map +1 -1
- package/dist/orchestrator/task-runner.js +5 -4
- package/dist/orchestrator/task-runner.js.map +1 -1
- package/dist/planner/plan-parser.d.ts.map +1 -1
- package/dist/planner/plan-parser.js +23 -4
- package/dist/planner/plan-parser.js.map +1 -1
- package/dist/planner/planner.d.ts.map +1 -1
- package/dist/planner/planner.js +14 -5
- package/dist/planner/planner.js.map +1 -1
- package/dist/repl/repl.d.ts.map +1 -1
- package/dist/repl/repl.js +121 -110
- package/dist/repl/repl.js.map +1 -1
- package/dist/session/agent-log.d.ts.map +1 -1
- package/dist/session/agent-log.js +18 -3
- package/dist/session/agent-log.js.map +1 -1
- package/dist/session/in-session-commands.d.ts.map +1 -1
- package/dist/session/in-session-commands.js +12 -11
- package/dist/session/in-session-commands.js.map +1 -1
- package/dist/session/interactive.d.ts.map +1 -1
- package/dist/session/interactive.js +93 -28
- package/dist/session/interactive.js.map +1 -1
- package/dist/session/manager.d.ts +1 -1
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +28 -7
- package/dist/session/manager.js.map +1 -1
- package/dist/session/state-machine.d.ts.map +1 -1
- package/dist/session/state-machine.js +14 -3
- package/dist/session/state-machine.js.map +1 -1
- package/dist/ui/agent-panel.d.ts.map +1 -1
- package/dist/ui/agent-panel.js.map +1 -1
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +37 -34
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/markdown.d.ts.map +1 -1
- package/dist/ui/markdown.js +17 -18
- package/dist/ui/markdown.js.map +1 -1
- package/dist/ui/prompt.d.ts.map +1 -1
- package/dist/ui/prompt.js +23 -9
- package/dist/ui/prompt.js.map +1 -1
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +1 -1
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/theme.d.ts.map +1 -1
- package/dist/ui/theme.js +12 -6
- package/dist/ui/theme.js.map +1 -1
- package/dist/utils/time.d.ts.map +1 -1
- package/dist/utils/time.js +2 -0
- package/dist/utils/time.js.map +1 -1
- package/dist/web/server.d.ts +2 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +329 -0
- package/dist/web/server.js.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -89,40 +89,45 @@ The key ideas:
|
|
|
89
89
|
|
|
90
90
|
sweteam doesn't replace your coding agents. It gives them the same structure that makes real engineering teams ship reliable code.
|
|
91
91
|
|
|
92
|
-
##
|
|
92
|
+
## Web Dashboard
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
Monitor all your sessions, tasks, and agent output from a browser-based dashboard:
|
|
95
95
|
|
|
96
|
+
```bash
|
|
97
|
+
npm run web
|
|
98
|
+
# → http://localhost:3847
|
|
96
99
|
```
|
|
97
|
-
╭─── sweteam v0.8.0 ────────────────────────────────────────────╮
|
|
98
|
-
│ │ │
|
|
99
|
-
│ Welcome to sweteam! │ Getting started │
|
|
100
|
-
│ │ /create [repo] Start new │
|
|
101
|
-
│ ┌─────────────────┐ │ /list See all │
|
|
102
|
-
│ │ ◉ ◉ │ │ /enter <id> Resume │
|
|
103
|
-
│ │ ───────── │ │ ──────────────────────────── │
|
|
104
|
-
│ └─────────────────┘ │ Recent sessions │
|
|
105
|
-
│ │ s_a1b2c3d4 Add dark theme │
|
|
106
|
-
│ Orchestrator · v0.8.0 │ s_e5f6g7h8 Fix auth flow │
|
|
107
|
-
│ ~/projects/myrepo │ │
|
|
108
|
-
╰───────────────────────────────────────────────────────────────╯
|
|
109
100
|
|
|
110
|
-
|
|
111
|
-
|
|
101
|
+
### Session list
|
|
102
|
+
|
|
103
|
+
Browse all sessions at a glance — status badges, task progress bars, and timestamps.
|
|
104
|
+
|
|
105
|
+
<p align="center">
|
|
106
|
+
<img src="docs/screenshots/dashboard.png" alt="sweteam web dashboard" width="100%" />
|
|
107
|
+
</p>
|
|
108
|
+
|
|
109
|
+
### Session detail
|
|
112
110
|
|
|
113
|
-
|
|
111
|
+
Click into any session to see the full conversation timeline, task breakdown, progress ring, and PR link.
|
|
112
|
+
|
|
113
|
+
<p align="center">
|
|
114
|
+
<img src="docs/screenshots/session-detail.png" alt="sweteam session detail view" width="100%" />
|
|
115
|
+
</p>
|
|
116
|
+
|
|
117
|
+
### Terminal REPL
|
|
118
|
+
|
|
119
|
+
The CLI also includes an interactive REPL with agent output streaming in real time:
|
|
114
120
|
|
|
115
121
|
```
|
|
116
122
|
▶ Coder ─ task-001: Add ThemeConfig and color definitions
|
|
117
123
|
──────────────────────────────────────────────────────────
|
|
118
124
|
│ Creating src/theme/config.ts with color palette...
|
|
119
125
|
│ Adding ThemeConfig interface with light/dark variants...
|
|
120
|
-
│ Defining CSS custom properties for runtime switching...
|
|
121
126
|
✓ Coder completed
|
|
122
127
|
|
|
123
128
|
▶ Reviewer ─ task-001: Add ThemeConfig and color definitions
|
|
124
129
|
──────────────────────────────────────────────────────────
|
|
125
|
-
│
|
|
130
|
+
│ Reviewing diff against acceptance criteria...
|
|
126
131
|
│ All criteria met. Approving.
|
|
127
132
|
✓ Reviewer completed
|
|
128
133
|
```
|
|
@@ -311,6 +316,7 @@ Attaching to live build output... (press Enter to detach)
|
|
|
311
316
|
| Command | Description |
|
|
312
317
|
| ----------------------------- | -------------------------------------- |
|
|
313
318
|
| `sweteam` | Launch interactive REPL |
|
|
319
|
+
| `sweteam web` | Start the web dashboard (port 3847) |
|
|
314
320
|
| `sweteam init` | Auto-discover CLIs and generate config |
|
|
315
321
|
| `sweteam create [repo]` | Create a new session |
|
|
316
322
|
| `sweteam list` | List all sessions |
|
|
@@ -555,6 +561,7 @@ src/
|
|
|
555
561
|
├── config/ # Config loader and GitHub auth
|
|
556
562
|
├── git/ # Git and GitHub CLI wrappers
|
|
557
563
|
├── ui/ # Terminal UI (banner, prompt, agent panel, sidebar, markdown, theme)
|
|
564
|
+
├── web/ # Web dashboard (HTTP server + single-page UI)
|
|
558
565
|
├── db/ # SQLite schema and client (Drizzle ORM)
|
|
559
566
|
├── utils/ # Utility functions (time formatting)
|
|
560
567
|
└── __tests__/ # Test suite
|
|
@@ -562,17 +569,17 @@ src/
|
|
|
562
569
|
|
|
563
570
|
### Tech stack
|
|
564
571
|
|
|
565
|
-
| Component | Choice
|
|
566
|
-
| ------------- |
|
|
567
|
-
| Language | TypeScript (ESM, Node.js 20+)
|
|
568
|
-
| ORM | Drizzle
|
|
569
|
-
| Database | SQLite via better-sqlite3
|
|
570
|
-
| CLI framework | Commander.js
|
|
571
|
-
| Terminal UI | Custom (chalk, gradient-string, raw-mode prompt)
|
|
572
|
-
| Git | `git` + `gh` CLI (child process)
|
|
573
|
-
| IDs | nanoid
|
|
574
|
-
| Config | TOML
|
|
575
|
-
| Tests | Vitest
|
|
572
|
+
| Component | Choice |
|
|
573
|
+
| ------------- | ------------------------------------------------ |
|
|
574
|
+
| Language | TypeScript (ESM, Node.js 20+) |
|
|
575
|
+
| ORM | Drizzle |
|
|
576
|
+
| Database | SQLite via better-sqlite3 |
|
|
577
|
+
| CLI framework | Commander.js |
|
|
578
|
+
| Terminal UI | Custom (chalk, gradient-string, raw-mode prompt) |
|
|
579
|
+
| Git | `git` + `gh` CLI (child process) |
|
|
580
|
+
| IDs | nanoid |
|
|
581
|
+
| Config | TOML |
|
|
582
|
+
| Tests | Vitest |
|
|
576
583
|
|
|
577
584
|
## Contributing
|
|
578
585
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAwC9D,qBAAa,iBAAkB,YAAW,YAAY;IACpD,IAAI,SAAiB;IAEf,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IASrC,OAAO,CAAC,IAAI,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACnC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;KAChE,GAAG,OAAO,CAAC,WAAW,CAAC;CAwLzB"}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { spawn, execFileSync } from 'child_process';
|
|
2
2
|
import { trackProcess } from '../lifecycle.js';
|
|
3
|
+
/** Return a minimal environment for child processes to avoid leaking secrets. */
|
|
4
|
+
function safeEnv() {
|
|
5
|
+
return {
|
|
6
|
+
PATH: process.env.PATH,
|
|
7
|
+
HOME: process.env.HOME,
|
|
8
|
+
SHELL: process.env.SHELL,
|
|
9
|
+
TERM: process.env.TERM,
|
|
10
|
+
LANG: process.env.LANG,
|
|
11
|
+
// Claude Code may need ANTHROPIC_API_KEY
|
|
12
|
+
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
3
15
|
/**
|
|
4
16
|
* Format a tool_use block into a short progress line for the AgentPanel.
|
|
5
17
|
*/
|
|
@@ -27,7 +39,7 @@ export class ClaudeCodeAdapter {
|
|
|
27
39
|
name = 'claude-code';
|
|
28
40
|
async isAvailable() {
|
|
29
41
|
try {
|
|
30
|
-
execFileSync('which', ['claude'], { encoding: 'utf-8', stdio: 'pipe' });
|
|
42
|
+
execFileSync('which', ['claude'], { encoding: 'utf-8', stdio: 'pipe', timeout: 5000 });
|
|
31
43
|
return true;
|
|
32
44
|
}
|
|
33
45
|
catch {
|
|
@@ -38,7 +50,13 @@ export class ClaudeCodeAdapter {
|
|
|
38
50
|
const timeout = opts.timeout ?? 0;
|
|
39
51
|
const startTime = Date.now();
|
|
40
52
|
return new Promise((resolve, reject) => {
|
|
41
|
-
const args = [
|
|
53
|
+
const args = [
|
|
54
|
+
'-p',
|
|
55
|
+
'--output-format',
|
|
56
|
+
'stream-json',
|
|
57
|
+
'--verbose',
|
|
58
|
+
'--dangerously-skip-permissions',
|
|
59
|
+
];
|
|
42
60
|
if (opts.images) {
|
|
43
61
|
for (const img of opts.images) {
|
|
44
62
|
args.push('--image', img);
|
|
@@ -47,15 +65,21 @@ export class ClaudeCodeAdapter {
|
|
|
47
65
|
const proc = spawn('claude', args, {
|
|
48
66
|
cwd: opts.cwd,
|
|
49
67
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
68
|
+
env: safeEnv(),
|
|
50
69
|
});
|
|
51
70
|
trackProcess(proc, opts.sessionId);
|
|
71
|
+
const MAX_OUTPUT_SIZE = 10 * 1024 * 1024;
|
|
52
72
|
let accumulatedText = '';
|
|
53
73
|
let resultText = null;
|
|
54
74
|
let stderr = '';
|
|
55
75
|
let lineBuffer = '';
|
|
56
76
|
let settled = false;
|
|
57
|
-
//
|
|
58
|
-
proc.stdin.on('error', () => {
|
|
77
|
+
// Silence EPIPE but log other stdin errors
|
|
78
|
+
proc.stdin.on('error', (err) => {
|
|
79
|
+
if (err.code !== 'EPIPE') {
|
|
80
|
+
console.error(`stdin error: ${err.message}`);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
59
83
|
function processLine(line) {
|
|
60
84
|
const trimmed = line.trim();
|
|
61
85
|
if (!trimmed)
|
|
@@ -66,9 +90,23 @@ export class ClaudeCodeAdapter {
|
|
|
66
90
|
}
|
|
67
91
|
catch {
|
|
68
92
|
// Non-JSON line — treat as raw text (backward compat)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
93
|
+
const rawLine = line + '\n';
|
|
94
|
+
const combinedRaw = accumulatedText + rawLine;
|
|
95
|
+
accumulatedText = combinedRaw.length > MAX_OUTPUT_SIZE
|
|
96
|
+
? combinedRaw.slice(combinedRaw.length - MAX_OUTPUT_SIZE)
|
|
97
|
+
: combinedRaw;
|
|
98
|
+
// Log if it looks like an error message
|
|
99
|
+
if (/^(error:|Error:|fatal:|Authentication|not found)/i.test(trimmed)) {
|
|
100
|
+
console.error(`claude-code non-JSON error output: ${trimmed}`);
|
|
101
|
+
}
|
|
102
|
+
if (opts.onOutput) {
|
|
103
|
+
try {
|
|
104
|
+
opts.onOutput(line + '\n');
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
console.warn(`onOutput callback error: ${err instanceof Error ? err.message : String(err)}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
72
110
|
return;
|
|
73
111
|
}
|
|
74
112
|
const type = parsed.type;
|
|
@@ -81,21 +119,33 @@ export class ClaudeCodeAdapter {
|
|
|
81
119
|
return;
|
|
82
120
|
for (const block of content) {
|
|
83
121
|
if (block.type === 'tool_use') {
|
|
84
|
-
const toolName = block.name;
|
|
122
|
+
const toolName = block.name ?? 'unknown';
|
|
85
123
|
const input = (block.input ?? {});
|
|
86
124
|
const progressLine = formatToolProgress(toolName, input);
|
|
87
|
-
if (opts.onOutput)
|
|
88
|
-
|
|
125
|
+
if (opts.onOutput) {
|
|
126
|
+
try {
|
|
127
|
+
opts.onOutput(progressLine + '\n');
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
console.warn(`onOutput callback error: ${err instanceof Error ? err.message : String(err)}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
89
133
|
}
|
|
90
134
|
else if (block.type === 'text') {
|
|
91
135
|
// Accumulate text silently — don't send to panel
|
|
92
|
-
|
|
136
|
+
const blockText = block.text ?? '';
|
|
137
|
+
const combinedBlock = accumulatedText + blockText;
|
|
138
|
+
accumulatedText = combinedBlock.length > MAX_OUTPUT_SIZE
|
|
139
|
+
? combinedBlock.slice(combinedBlock.length - MAX_OUTPUT_SIZE)
|
|
140
|
+
: combinedBlock;
|
|
93
141
|
}
|
|
94
142
|
}
|
|
95
143
|
}
|
|
96
144
|
else if (type === 'result') {
|
|
97
|
-
// Final result —
|
|
98
|
-
resultText
|
|
145
|
+
// Final result — only set if not already captured (preserves first result)
|
|
146
|
+
if (!resultText) {
|
|
147
|
+
resultText = parsed.result ?? '';
|
|
148
|
+
}
|
|
99
149
|
}
|
|
100
150
|
// Ignore system, user, and other event types
|
|
101
151
|
}
|
|
@@ -112,7 +162,11 @@ export class ClaudeCodeAdapter {
|
|
|
112
162
|
});
|
|
113
163
|
proc.stderr.on('data', (chunk) => {
|
|
114
164
|
const text = chunk.toString();
|
|
115
|
-
stderr
|
|
165
|
+
const combinedStderr = stderr + text;
|
|
166
|
+
stderr =
|
|
167
|
+
combinedStderr.length > MAX_OUTPUT_SIZE
|
|
168
|
+
? combinedStderr.slice(combinedStderr.length - MAX_OUTPUT_SIZE)
|
|
169
|
+
: combinedStderr;
|
|
116
170
|
});
|
|
117
171
|
const timer = timeout > 0
|
|
118
172
|
? setTimeout(() => {
|
|
@@ -121,21 +175,35 @@ export class ClaudeCodeAdapter {
|
|
|
121
175
|
reject(new Error(`Claude Code timed out after ${timeout}ms`));
|
|
122
176
|
}, timeout)
|
|
123
177
|
: null;
|
|
124
|
-
proc.on('close', (code) => {
|
|
178
|
+
proc.on('close', (code, signal) => {
|
|
125
179
|
if (timer)
|
|
126
180
|
clearTimeout(timer);
|
|
127
181
|
if (settled)
|
|
128
182
|
return;
|
|
129
183
|
settled = true;
|
|
130
|
-
// Flush remaining line buffer
|
|
184
|
+
// Flush remaining line buffer — try parsing as JSON first,
|
|
185
|
+
// fall back to including as raw text rather than silently dropping
|
|
131
186
|
if (lineBuffer.trim()) {
|
|
132
|
-
|
|
187
|
+
try {
|
|
188
|
+
JSON.parse(lineBuffer.trim());
|
|
189
|
+
// Valid JSON — process normally
|
|
190
|
+
processLine(lineBuffer);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
// Partial/invalid JSON — include as raw text in output
|
|
194
|
+
const rawContent = lineBuffer + '\n';
|
|
195
|
+
const combinedFinal = accumulatedText + rawContent;
|
|
196
|
+
accumulatedText =
|
|
197
|
+
combinedFinal.length > MAX_OUTPUT_SIZE
|
|
198
|
+
? combinedFinal.slice(combinedFinal.length - MAX_OUTPUT_SIZE)
|
|
199
|
+
: combinedFinal;
|
|
200
|
+
}
|
|
133
201
|
lineBuffer = '';
|
|
134
202
|
}
|
|
135
203
|
const finalOutput = resultText ?? (accumulatedText || stderr);
|
|
136
204
|
resolve({
|
|
137
205
|
output: finalOutput,
|
|
138
|
-
exitCode: code ?? 1,
|
|
206
|
+
exitCode: code ?? (signal ? 128 : 1),
|
|
139
207
|
durationMs: Date.now() - startTime,
|
|
140
208
|
});
|
|
141
209
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAAgB,EAAE,KAA8B;IAC1E,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,UAAU,KAAK,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;QAC3C,KAAK,OAAO;YACV,OAAO,WAAW,KAAK,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;QAC5C,KAAK,MAAM;YACT,OAAO,UAAU,KAAK,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;QAC3C,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YACxC,OAAO,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACrE,CAAC;QACD,KAAK,MAAM;YACT,OAAO,UAAU,KAAK,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;QACzC,KAAK,MAAM;YACT,OAAO,UAAU,KAAK,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;QACzC;YACE,OAAO,KAAK,QAAQ,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,MAAM,OAAO,iBAAiB;IAC5B,IAAI,GAAG,aAAa,CAAC;IA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AW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAgB9D,qBAAa,YAAa,YAAW,YAAY;IAC/C,IAAI,SAAW;IAET,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IASrC,OAAO,CAAC,IAAI,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACnC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;KAChE,GAAG,OAAO,CAAC,WAAW,CAAC;CAuHzB"}
|
package/dist/adapters/codex.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { spawn, execFileSync } from 'child_process';
|
|
2
2
|
import { trackProcess } from '../lifecycle.js';
|
|
3
3
|
import { detectInputPrompt, extractPromptText } from './prompt-detection.js';
|
|
4
|
+
/** Return a minimal environment for child processes to avoid leaking secrets. */
|
|
5
|
+
function safeEnv() {
|
|
6
|
+
return {
|
|
7
|
+
PATH: process.env.PATH,
|
|
8
|
+
HOME: process.env.HOME,
|
|
9
|
+
SHELL: process.env.SHELL,
|
|
10
|
+
TERM: process.env.TERM,
|
|
11
|
+
LANG: process.env.LANG,
|
|
12
|
+
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
4
15
|
export class CodexAdapter {
|
|
5
16
|
name = 'codex';
|
|
6
17
|
async isAvailable() {
|
|
7
18
|
try {
|
|
8
|
-
execFileSync('which', ['codex'], { encoding: 'utf-8', stdio: 'pipe' });
|
|
19
|
+
execFileSync('which', ['codex'], { encoding: 'utf-8', stdio: 'pipe', timeout: 5000 });
|
|
9
20
|
return true;
|
|
10
21
|
}
|
|
11
22
|
catch {
|
|
@@ -16,7 +27,7 @@ export class CodexAdapter {
|
|
|
16
27
|
const timeout = opts.timeout ?? 0;
|
|
17
28
|
const startTime = Date.now();
|
|
18
29
|
return new Promise((resolve, reject) => {
|
|
19
|
-
const args = ['-q'
|
|
30
|
+
const args = ['-q'];
|
|
20
31
|
if (opts.images) {
|
|
21
32
|
for (const img of opts.images) {
|
|
22
33
|
args.push('--image', img);
|
|
@@ -25,19 +36,29 @@ export class CodexAdapter {
|
|
|
25
36
|
const proc = spawn('codex', args, {
|
|
26
37
|
cwd: opts.cwd,
|
|
27
38
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
39
|
+
env: safeEnv(),
|
|
28
40
|
});
|
|
29
41
|
trackProcess(proc, opts.sessionId);
|
|
42
|
+
const MAX_OUTPUT_SIZE = 10 * 1024 * 1024;
|
|
30
43
|
let stdout = '';
|
|
31
44
|
let stderr = '';
|
|
32
45
|
let recentOutput = '';
|
|
33
46
|
let debounceTimer = null;
|
|
34
47
|
let waitingForInput = false;
|
|
35
48
|
let settled = false;
|
|
36
|
-
//
|
|
37
|
-
proc.stdin.on('error', () => {
|
|
49
|
+
// Silence EPIPE but log other stdin errors
|
|
50
|
+
proc.stdin.on('error', (err) => {
|
|
51
|
+
if (err.code !== 'EPIPE') {
|
|
52
|
+
console.error(`stdin error: ${err.message}`);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
38
55
|
proc.stdout.on('data', (chunk) => {
|
|
39
56
|
const text = chunk.toString();
|
|
40
|
-
stdout
|
|
57
|
+
const combinedStdout = stdout + text;
|
|
58
|
+
stdout =
|
|
59
|
+
combinedStdout.length > MAX_OUTPUT_SIZE
|
|
60
|
+
? combinedStdout.slice(combinedStdout.length - MAX_OUTPUT_SIZE)
|
|
61
|
+
: combinedStdout;
|
|
41
62
|
if (opts.onOutput) {
|
|
42
63
|
opts.onOutput(text);
|
|
43
64
|
}
|
|
@@ -52,35 +73,42 @@ export class CodexAdapter {
|
|
|
52
73
|
debounceTimer = setTimeout(() => {
|
|
53
74
|
if (waitingForInput || settled)
|
|
54
75
|
return;
|
|
55
|
-
|
|
76
|
+
const captured = recentOutput;
|
|
77
|
+
recentOutput = '';
|
|
78
|
+
if (detectInputPrompt(captured)) {
|
|
56
79
|
waitingForInput = true;
|
|
57
|
-
const promptText = extractPromptText(
|
|
80
|
+
const promptText = extractPromptText(captured);
|
|
58
81
|
opts.onInputNeeded(promptText)
|
|
59
82
|
.then((response) => {
|
|
60
83
|
waitingForInput = false;
|
|
61
84
|
if (response !== null && !proc.killed) {
|
|
62
85
|
proc.stdin.write(response + '\n');
|
|
63
86
|
}
|
|
64
|
-
recentOutput = '';
|
|
65
87
|
})
|
|
66
88
|
.catch(() => {
|
|
67
89
|
waitingForInput = false;
|
|
68
|
-
recentOutput = '';
|
|
69
90
|
});
|
|
70
91
|
}
|
|
71
92
|
}, 2000);
|
|
72
93
|
});
|
|
73
94
|
proc.stderr.on('data', (chunk) => {
|
|
74
|
-
|
|
95
|
+
const errText = chunk.toString();
|
|
96
|
+
const combinedStderr = stderr + errText;
|
|
97
|
+
stderr =
|
|
98
|
+
combinedStderr.length > MAX_OUTPUT_SIZE
|
|
99
|
+
? combinedStderr.slice(combinedStderr.length - MAX_OUTPUT_SIZE)
|
|
100
|
+
: combinedStderr;
|
|
75
101
|
});
|
|
76
102
|
const timer = timeout > 0
|
|
77
103
|
? setTimeout(() => {
|
|
78
104
|
settled = true;
|
|
105
|
+
proc.stdout.removeAllListeners('data');
|
|
106
|
+
proc.stderr.removeAllListeners('data');
|
|
79
107
|
proc.kill('SIGTERM');
|
|
80
108
|
reject(new Error(`Codex timed out after ${timeout}ms`));
|
|
81
109
|
}, timeout)
|
|
82
110
|
: null;
|
|
83
|
-
proc.on('close', (code) => {
|
|
111
|
+
proc.on('close', (code, signal) => {
|
|
84
112
|
if (timer)
|
|
85
113
|
clearTimeout(timer);
|
|
86
114
|
if (debounceTimer)
|
|
@@ -90,7 +118,7 @@ export class CodexAdapter {
|
|
|
90
118
|
settled = true;
|
|
91
119
|
resolve({
|
|
92
120
|
output: stdout || stderr,
|
|
93
|
-
exitCode: code ?? 1,
|
|
121
|
+
exitCode: code ?? (signal ? 128 : 1),
|
|
94
122
|
durationMs: Date.now() - startTime,
|
|
95
123
|
});
|
|
96
124
|
});
|
|
@@ -104,6 +132,9 @@ export class CodexAdapter {
|
|
|
104
132
|
settled = true;
|
|
105
133
|
reject(err);
|
|
106
134
|
});
|
|
135
|
+
// Pass prompt via stdin instead of CLI arg to avoid ARG_MAX overflow
|
|
136
|
+
proc.stdin.write(opts.prompt);
|
|
137
|
+
proc.stdin.end();
|
|
107
138
|
});
|
|
108
139
|
}
|
|
109
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE7E,MAAM,OAAO,YAAY;IACvB,IAAI,GAAG,OAAO,CAAC;IAEf,KAAK,CAAC,WAAW;QACf,IAAI,CAAC;YACH,YAAY,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,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EAAE,EAAE;gBACvB,IAAI,KAAK;oBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC/B,IAAI,aAAa;oBAAE,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC/C,IAAI,OAAO;oBAAE,OAAO;gBACpB,OAAO,GAAG,IAAI,CAAC;gBACf,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;YAEH,qEAAqE;YACrE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/adapters/custom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/adapters/custom.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAgBvD,qBAAa,aAAc,YAAW,YAAY;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,MAAM,CAAc;gBAEhB,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW;IAKvC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAarC,OAAO,CAAC,IAAI,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACnC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;KAChE,GAAG,OAAO,CAAC,WAAW,CAAC;CAgMzB"}
|