codex-supervisor-mcp 0.13.5 → 0.13.6
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/package.json +18 -63
- package/src/{acceptance.js → app/acceptance.js} +54 -68
- package/src/app/cancel.js +60 -0
- package/src/{cleanup-plan.js → app/cleanup-plan.js} +11 -12
- package/src/app/compose.js +7 -0
- package/src/{context-compiler.js → app/context-compiler.js} +7 -13
- package/src/app/dispatch.js +396 -0
- package/src/app/followup.js +98 -0
- package/src/app/land-chain.js +124 -0
- package/src/app/landing.js +357 -0
- package/src/app/ownership.js +57 -0
- package/src/app/rebase.js +216 -0
- package/src/app/resume.js +164 -0
- package/src/app/run-state.js +26 -0
- package/src/app/settled.js +28 -0
- package/src/{side-chat.js → app/side-chat.js} +79 -265
- package/src/app/sse.js +20 -0
- package/src/app/start-run.js +77 -0
- package/src/app/verify-push.js +119 -0
- package/src/app/worktree-setup.js +176 -0
- package/src/{acceptance-baseline.js → domain/acceptance-baseline.js} +2 -1
- package/src/domain/acceptance-spec.js +30 -0
- package/src/domain/command-outcome.js +6 -0
- package/src/{overview-delta.js → domain/overview-delta.js} +5 -1
- package/src/domain/side-turn-view.js +73 -0
- package/src/{worker-preflight.js → domain/worker-preflight.js} +1 -1
- package/src/infra/git.js +30 -0
- package/src/infra/process.js +59 -0
- package/src/{sandbox-roots.js → infra/sandbox-roots.js} +2 -1
- package/src/{skill-sync.js → infra/skill-sync.js} +1 -1
- package/src/infra/store/db.js +265 -0
- package/src/infra/store/events.js +146 -0
- package/src/infra/store/facts.js +338 -0
- package/src/infra/store/reconcile.js +172 -0
- package/src/infra/store/records.js +160 -0
- package/src/infra/store/runner-readers.js +16 -0
- package/src/infra/store/schema.js +306 -0
- package/src/infra/store/sessions.js +138 -0
- package/src/infra/store/tasks.js +307 -0
- package/src/{auto-update-worker.js → infra/update/auto-update-worker.js} +4 -4
- package/src/{auto-update.js → infra/update/auto-update.js} +3 -3
- package/src/{update-check.js → infra/update/update-check.js} +4 -4
- package/src/{workspace-kind.js → infra/workspace-kind.js} +5 -7
- package/src/{worktree.js → infra/worktree.js} +56 -41
- package/src/{acceptance-cli.js → interface/bin/acceptance-cli.js} +7 -3
- package/src/{cleanup.js → interface/bin/cleanup.js} +3 -2
- package/src/{monitor.jsx → interface/bin/monitor.jsx} +4 -1
- package/src/{setup.js → interface/bin/setup.js} +7 -6
- package/src/{stage.js → interface/bin/stage.js} +1 -1
- package/src/{web-server.js → interface/bin/web-server.js} +2 -2
- package/src/interface/mcp/meta.js +7 -0
- package/src/interface/mcp/result.js +34 -0
- package/src/interface/mcp/schemas.js +24 -0
- package/src/interface/mcp/server.js +94 -0
- package/src/interface/mcp/tools/delivery.js +197 -0
- package/src/interface/mcp/tools/dispatch.js +267 -0
- package/src/interface/mcp/tools/facts.js +239 -0
- package/src/interface/mcp/tools/overview.js +202 -0
- package/src/interface/mcp/tools/poll.js +62 -0
- package/src/interface/mcp/tools/results.js +270 -0
- package/src/interface/mcp/tools/review.js +135 -0
- package/src/interface/mcp/tools/wait.js +145 -0
- package/src/interface/mcp/update-state.js +34 -0
- package/src/interface/mcp/views/overview.js +183 -0
- package/src/interface/mcp/views/task.js +223 -0
- package/src/interface/web/app.js +226 -0
- package/src/interface/web/views.js +224 -0
- package/src/mcp-server.js +3 -2223
- package/src/run-host/entry.js +23 -0
- package/src/run-host/finalize.js +236 -0
- package/src/run-host/launch.js +63 -0
- package/src/run-host/live-run.js +73 -0
- package/src/run-host/outcome-facts.js +61 -0
- package/src/run-host/streams.js +76 -0
- package/src/run-host/track.js +128 -0
- package/src/{runner-adapter.js → runners/codex/adapter.js} +6 -6
- package/src/runners/codex/chat-chunks.js +97 -0
- package/src/{event-parser.js → runners/codex/event-parser.js} +57 -55
- package/src/{goal-store.js → runners/codex/goal-store.js} +2 -2
- package/src/{mcp-config.js → runners/codex/mcp-config.js} +1 -1
- package/src/codex-runner.js +0 -1586
- package/src/landing.js +0 -507
- package/src/task-store.js +0 -1800
- package/src/web-app.js +0 -425
- /package/src/{failure-class.js → domain/failure-class.js} +0 -0
- /package/src/{owned-changes.js → domain/owned-changes.js} +0 -0
- /package/src/{prompt.js → domain/prompt.js} +0 -0
- /package/src/{status.js → domain/status.js} +0 -0
- /package/src/{thread-health.js → domain/thread-health.js} +0 -0
- /package/src/{truncate.js → domain/truncate.js} +0 -0
- /package/src/{worker-changes.js → domain/worker-changes.js} +0 -0
- /package/src/{worker-env.js → domain/worker-env.js} +0 -0
- /package/src/{worker-report.js → domain/worker-report.js} +0 -0
- /package/src/{worker-report.schema.json → domain/worker-report.schema.json} +0 -0
- /package/src/{bin-resolver.js → infra/bin-resolver.js} +0 -0
- /package/src/{cleanup-hint.js → infra/cleanup-hint.js} +0 -0
- /package/src/{external-output.js → infra/external-output.js} +0 -0
- /package/src/{handoff.js → infra/handoff.js} +0 -0
- /package/src/{paths.js → infra/paths.js} +0 -0
- /package/src/{stage-store.js → infra/stage-store.js} +0 -0
- /package/src/{tool-guard.js → runners/codex/tool-guard.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defaultBinDirs, findBinaryPath, resolveCommand, shimMessage } from "
|
|
1
|
+
import { runSync, spawnProcess } from "../../infra/process.js";
|
|
2
|
+
import { defaultBinDirs, findBinaryPath, resolveCommand, shimMessage } from "../../infra/bin-resolver.js";
|
|
3
3
|
import { applyCodexEvent } from "./event-parser.js";
|
|
4
4
|
|
|
5
5
|
const CODEX_NPM_ENTRY = { pkg: "@openai/codex", bin: "bin/codex.js" };
|
|
@@ -21,7 +21,7 @@ export class CodexRunnerAdapter {
|
|
|
21
21
|
capabilityPreflight(target = this.resolveTarget()) {
|
|
22
22
|
if (target.error) return { ok: false, error: target.error };
|
|
23
23
|
try {
|
|
24
|
-
const help =
|
|
24
|
+
const help = runSync(target.cmd, [...target.prefixArgs, "exec", "--help"], {
|
|
25
25
|
encoding: "utf8",
|
|
26
26
|
timeout: 15000,
|
|
27
27
|
windowsHide: true,
|
|
@@ -65,7 +65,7 @@ export class CodexRunnerAdapter {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
start(target, args, options) {
|
|
68
|
-
return
|
|
68
|
+
return spawnProcess(target.cmd, [...target.prefixArgs, ...args], options);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
parseEvent(task, event) {
|
|
@@ -75,7 +75,7 @@ export class CodexRunnerAdapter {
|
|
|
75
75
|
cancelChild(child) {
|
|
76
76
|
if (process.platform === "win32" && child.pid) {
|
|
77
77
|
try {
|
|
78
|
-
|
|
78
|
+
runSync("taskkill", ["/PID", String(child.pid), "/T", "/F"], { stdio: "ignore", timeout: 5000, windowsHide: true });
|
|
79
79
|
return;
|
|
80
80
|
} catch {
|
|
81
81
|
// fall through to the process handle
|
|
@@ -86,7 +86,7 @@ export class CodexRunnerAdapter {
|
|
|
86
86
|
|
|
87
87
|
cancelPid(pid) {
|
|
88
88
|
if (process.platform === "win32") {
|
|
89
|
-
|
|
89
|
+
runSync("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", timeout: 5000, windowsHide: true });
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
process.kill(pid, "SIGTERM");
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Codex events -> the UI message stream chunks the board's side chat renders.
|
|
2
|
+
|
|
3
|
+
const OUTPUT_CLIP = 4000;
|
|
4
|
+
|
|
5
|
+
function clip(text, max = OUTPUT_CLIP) {
|
|
6
|
+
if (typeof text !== "string") return text ?? null;
|
|
7
|
+
return text.length <= max ? text : `${text.slice(0, max)}\n…(${text.length - max} more characters)`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function completedItemChunks(item, state) {
|
|
11
|
+
const out = [];
|
|
12
|
+
switch (item.type) {
|
|
13
|
+
case "reasoning": {
|
|
14
|
+
const id = `r-${item.id}`;
|
|
15
|
+
out.push({ type: "reasoning-start", id }, { type: "reasoning-delta", id, delta: item.text ?? "" }, { type: "reasoning-end", id });
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
case "agent_message": {
|
|
19
|
+
const id = `t-${item.id}`;
|
|
20
|
+
out.push({ type: "text-start", id }, { type: "text-delta", id, delta: item.text ?? "" }, { type: "text-end", id });
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
case "command_execution":
|
|
24
|
+
if (!state.toolsSeen.has(item.id)) {
|
|
25
|
+
state.toolsSeen.add(item.id);
|
|
26
|
+
out.push({ type: "tool-input-available", toolCallId: item.id, toolName: "shell", input: { command: item.command ?? "" } });
|
|
27
|
+
}
|
|
28
|
+
out.push({
|
|
29
|
+
type: "tool-output-available",
|
|
30
|
+
toolCallId: item.id,
|
|
31
|
+
output: { exit_code: item.exit_code ?? null, status: item.status ?? null, output: clip(item.aggregated_output ?? "") }
|
|
32
|
+
});
|
|
33
|
+
break;
|
|
34
|
+
case "file_change":
|
|
35
|
+
out.push(
|
|
36
|
+
{ type: "tool-input-available", toolCallId: item.id, toolName: "edit", input: { changes: item.changes ?? [] } },
|
|
37
|
+
{ type: "tool-output-available", toolCallId: item.id, output: { status: item.status ?? "completed" } }
|
|
38
|
+
);
|
|
39
|
+
break;
|
|
40
|
+
case "web_search":
|
|
41
|
+
case "mcp_tool_call":
|
|
42
|
+
out.push(
|
|
43
|
+
{ type: "tool-input-available", toolCallId: item.id, toolName: item.type, input: { ...item, id: undefined, type: undefined } },
|
|
44
|
+
{ type: "tool-output-available", toolCallId: item.id, output: { status: item.status ?? "completed" } }
|
|
45
|
+
);
|
|
46
|
+
break;
|
|
47
|
+
case "error":
|
|
48
|
+
// Startup notices (unknown config keys, missing model metadata) come
|
|
49
|
+
// through as error items. They are not the answer failing.
|
|
50
|
+
out.push({ type: "data-notice", data: { message: item.message ?? item.text ?? "" } });
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function chunksFor(event, state) {
|
|
59
|
+
const item = event.item ?? {};
|
|
60
|
+
const out = [];
|
|
61
|
+
switch (event.type) {
|
|
62
|
+
case "thread.started":
|
|
63
|
+
if (event.thread_id) out.push({ type: "data-session", data: { fork_thread_id: event.thread_id } });
|
|
64
|
+
break;
|
|
65
|
+
case "turn.started":
|
|
66
|
+
out.push({ type: "start-step" });
|
|
67
|
+
break;
|
|
68
|
+
case "item.started":
|
|
69
|
+
case "item.updated":
|
|
70
|
+
if (item.type === "command_execution" && !state.toolsSeen.has(item.id)) {
|
|
71
|
+
state.toolsSeen.add(item.id);
|
|
72
|
+
out.push({ type: "tool-input-available", toolCallId: item.id, toolName: "shell", input: { command: item.command ?? "" } });
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case "item.completed":
|
|
76
|
+
out.push(...completedItemChunks(item, state));
|
|
77
|
+
break;
|
|
78
|
+
case "turn.completed":
|
|
79
|
+
out.push({ type: "finish-step" });
|
|
80
|
+
if (event.usage) {
|
|
81
|
+
out.push({ type: "data-usage", data: event.usage });
|
|
82
|
+
state.usage = event.usage;
|
|
83
|
+
}
|
|
84
|
+
state.completed = true;
|
|
85
|
+
break;
|
|
86
|
+
case "turn.failed":
|
|
87
|
+
out.push({ type: "error", errorText: event.error?.message ?? event.error ?? event.message ?? "Codex turn failed" });
|
|
88
|
+
state.failed = true;
|
|
89
|
+
break;
|
|
90
|
+
case "error":
|
|
91
|
+
out.push({ type: "data-notice", data: { message: event.message ?? event.error ?? "" } });
|
|
92
|
+
break;
|
|
93
|
+
default:
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// Invariant: status is the lifecycle and is only ever assigned queued /
|
|
4
4
|
// running / completed / failed / cancelled / lost. Progress details go to
|
|
5
5
|
// phase, which is only meaningful while the work is running.
|
|
6
|
-
import {
|
|
6
|
+
import { commandFailed } from "../../domain/command-outcome.js";
|
|
7
|
+
import { parseWorkerReport } from "../../domain/worker-report.js";
|
|
7
8
|
|
|
8
9
|
function getEventType(event) {
|
|
9
10
|
return event.type ?? event.event ?? event.msg?.type ?? "unknown";
|
|
@@ -84,6 +85,58 @@ function applyGoalEvent(next, event) {
|
|
|
84
85
|
return next;
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
function applyItemProgress(next, item, itemType) {
|
|
89
|
+
next.status = "running";
|
|
90
|
+
next.phase = ITEM_PHASE.get(itemType);
|
|
91
|
+
if (itemType === "command_execution") {
|
|
92
|
+
next.current_command = inferCommand(item);
|
|
93
|
+
next.current_action = next.current_command ? `Running ${next.current_command}` : "Running command";
|
|
94
|
+
} else if (itemType === "file_change") {
|
|
95
|
+
next.current_action = "Editing files";
|
|
96
|
+
} else if (itemType !== "reasoning" && itemType !== "todo_list") {
|
|
97
|
+
next.current_action = `Processing ${itemType}`;
|
|
98
|
+
}
|
|
99
|
+
return next;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function applyCommandCompleted(next, item, now) {
|
|
103
|
+
const command = inferCommand(item);
|
|
104
|
+
next.phase = "command";
|
|
105
|
+
next.current_command = null;
|
|
106
|
+
const exitCode = item?.exit_code ?? item?.exitCode ?? null;
|
|
107
|
+
const status = item?.status ?? "completed";
|
|
108
|
+
const entry = { command, exit_code: exitCode, status, completed_at: now };
|
|
109
|
+
// The tail of a failing command's output is the one piece of evidence
|
|
110
|
+
// a reviewer needs to tell "the build is broken" from "the network was
|
|
111
|
+
// down". Only failures keep it: the commands column is one row cell.
|
|
112
|
+
if (commandFailed(entry)) {
|
|
113
|
+
const tail = outputTail(item?.aggregated_output ?? item?.output ?? null);
|
|
114
|
+
if (tail) entry.output_tail = tail;
|
|
115
|
+
}
|
|
116
|
+
next.commands = [...(next.commands ?? []), entry];
|
|
117
|
+
return next;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// The row after a completed item, or null for an item type that changes nothing here.
|
|
121
|
+
function applyItemCompleted(next, item, itemType, now) {
|
|
122
|
+
if (itemType === "command_execution") return applyCommandCompleted(next, item, now);
|
|
123
|
+
if (itemType === "file_change") {
|
|
124
|
+
const files = inferChangedFiles(item);
|
|
125
|
+
next.phase = "editing";
|
|
126
|
+
next.changed_files = Array.from(new Set([...(next.changed_files ?? []), ...files]));
|
|
127
|
+
return next;
|
|
128
|
+
}
|
|
129
|
+
if (itemType === "agent_message") {
|
|
130
|
+
const message = inferAgentMessage(item);
|
|
131
|
+
next.phase = "reporting";
|
|
132
|
+
if (message) next.last_message = message;
|
|
133
|
+
return next;
|
|
134
|
+
}
|
|
135
|
+
if (itemType === "error") return appendNotice(next, item?.message ?? item?.text ?? null);
|
|
136
|
+
if (itemType === "reasoning" || itemType === "mcp_tool_call" || itemType === "todo_list") return next;
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
|
|
87
140
|
export function applyCodexEvent(task, event) {
|
|
88
141
|
const now = new Date().toISOString();
|
|
89
142
|
const eventType = getEventType(event);
|
|
@@ -109,56 +162,11 @@ export function applyCodexEvent(task, event) {
|
|
|
109
162
|
return next;
|
|
110
163
|
}
|
|
111
164
|
|
|
112
|
-
if (ITEM_PHASE.has(itemType) && (eventType === "item.started" || eventType === "item.updated"))
|
|
113
|
-
next.status = "running";
|
|
114
|
-
next.phase = ITEM_PHASE.get(itemType);
|
|
115
|
-
if (itemType === "command_execution") {
|
|
116
|
-
next.current_command = inferCommand(item);
|
|
117
|
-
next.current_action = next.current_command ? `Running ${next.current_command}` : "Running command";
|
|
118
|
-
} else if (itemType === "file_change") {
|
|
119
|
-
next.current_action = "Editing files";
|
|
120
|
-
} else if (itemType !== "reasoning" && itemType !== "todo_list") {
|
|
121
|
-
next.current_action = `Processing ${itemType}`;
|
|
122
|
-
}
|
|
123
|
-
return next;
|
|
124
|
-
}
|
|
165
|
+
if (ITEM_PHASE.has(itemType) && (eventType === "item.started" || eventType === "item.updated")) return applyItemProgress(next, item, itemType);
|
|
125
166
|
|
|
126
167
|
if (eventType === "item.completed") {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
next.phase = "command";
|
|
130
|
-
next.current_command = null;
|
|
131
|
-
const exitCode = item?.exit_code ?? item?.exitCode ?? null;
|
|
132
|
-
const status = item?.status ?? "completed";
|
|
133
|
-
const entry = { command, exit_code: exitCode, status, completed_at: now };
|
|
134
|
-
// The tail of a failing command's output is the one piece of evidence
|
|
135
|
-
// a reviewer needs to tell "the build is broken" from "the network was
|
|
136
|
-
// down". Only failures keep it: the commands column is one row cell.
|
|
137
|
-
if (commandFailed(entry)) {
|
|
138
|
-
const tail = outputTail(item?.aggregated_output ?? item?.output ?? null);
|
|
139
|
-
if (tail) entry.output_tail = tail;
|
|
140
|
-
}
|
|
141
|
-
next.commands = [...(next.commands ?? []), entry];
|
|
142
|
-
return next;
|
|
143
|
-
}
|
|
144
|
-
if (itemType === "file_change") {
|
|
145
|
-
const files = inferChangedFiles(item);
|
|
146
|
-
next.phase = "editing";
|
|
147
|
-
next.changed_files = Array.from(new Set([...(next.changed_files ?? []), ...files]));
|
|
148
|
-
return next;
|
|
149
|
-
}
|
|
150
|
-
if (itemType === "agent_message") {
|
|
151
|
-
const message = inferAgentMessage(item);
|
|
152
|
-
next.phase = "reporting";
|
|
153
|
-
if (message) next.last_message = message;
|
|
154
|
-
return next;
|
|
155
|
-
}
|
|
156
|
-
if (itemType === "error") {
|
|
157
|
-
return appendNotice(next, item?.message ?? item?.text ?? null);
|
|
158
|
-
}
|
|
159
|
-
if (itemType === "reasoning" || itemType === "mcp_tool_call" || itemType === "todo_list") {
|
|
160
|
-
return next;
|
|
161
|
-
}
|
|
168
|
+
const completed = applyItemCompleted(next, item, itemType, now);
|
|
169
|
+
if (completed) return completed;
|
|
162
170
|
}
|
|
163
171
|
|
|
164
172
|
if (eventType === "turn.completed") {
|
|
@@ -224,12 +232,6 @@ function outputTail(output) {
|
|
|
224
232
|
|
|
225
233
|
// A sandbox-refused command can come back with no exit code at all, only a
|
|
226
234
|
// failed status, so both are failure.
|
|
227
|
-
export function commandFailed(entry) {
|
|
228
|
-
if (!entry) return false;
|
|
229
|
-
if (entry.status === "failed") return true;
|
|
230
|
-
return entry.exit_code !== null && entry.exit_code !== undefined && entry.exit_code !== 0;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
235
|
function clipText(value, max) {
|
|
234
236
|
const text = String(value ?? "");
|
|
235
237
|
return text.length > max ? `${text.slice(0, max)}…` : text;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// to the goal it recorded at dispatch time.
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { DatabaseSync } from "node:sqlite";
|
|
9
|
-
import { goalsDbPath } from "
|
|
10
|
-
import { mapGoalStatus } from "
|
|
9
|
+
import { goalsDbPath } from "../../infra/paths.js";
|
|
10
|
+
import { mapGoalStatus } from "../../domain/status.js";
|
|
11
11
|
|
|
12
12
|
function toCamelCase(status) {
|
|
13
13
|
return String(status).replace(/_([a-z])/g, (_match, letter) => letter.toUpperCase());
|