codex-supervisor-mcp 0.5.7 → 0.5.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.en.md +208 -286
- package/README.md +206 -284
- package/package.json +1 -1
- package/src/mcp-server.js +5 -2
- package/src/task-store.js +15 -1
- package/src/worktree.js +11 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-supervisor-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server that dispatches and supervises parallel Codex CLI workers, one isolated Git worktree each, with a persisted work state machine.",
|
|
6
6
|
"license": "MIT",
|
package/src/mcp-server.js
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
readTasks,
|
|
21
21
|
readTasksBySession,
|
|
22
22
|
reconcileDetachedActiveTasks,
|
|
23
|
+
recordTerminalChangedFiles,
|
|
23
24
|
searchTasks,
|
|
24
25
|
upsertSession,
|
|
25
26
|
upsertTask
|
|
@@ -771,8 +772,10 @@ server.registerTool(
|
|
|
771
772
|
const task = await getTask(task_id);
|
|
772
773
|
if (!task) return textResult({ error: "task_not_found", task_id });
|
|
773
774
|
const summary = buildWorkerSummary(task, readNativeGoal(task.thread_id));
|
|
774
|
-
|
|
775
|
-
|
|
775
|
+
// Cache the worktree diff on the row once the worker is done, so the
|
|
776
|
+
// overview's count stops lagging. A running row is the runner's to write.
|
|
777
|
+
if (TERMINAL_STATUSES.has(task.status) && summary.changed_files.length !== (task.changed_files ?? []).length) {
|
|
778
|
+
await recordTerminalChangedFiles(task.id, summary.changed_files);
|
|
776
779
|
}
|
|
777
780
|
return textResult(summary);
|
|
778
781
|
}
|
package/src/task-store.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join } from "node:path";
|
|
|
3
3
|
import { DatabaseSync } from "node:sqlite";
|
|
4
4
|
import { dataDir, dbPath, runsDir } from "./paths.js";
|
|
5
5
|
import { extractAgentMessage } from "./event-parser.js";
|
|
6
|
-
import { ACTIVE_STATUSES, PHASES } from "./status.js";
|
|
6
|
+
import { ACTIVE_STATUSES, PHASES, TERMINAL_STATUSES } from "./status.js";
|
|
7
7
|
|
|
8
8
|
let db;
|
|
9
9
|
|
|
@@ -395,6 +395,20 @@ export async function readTasksBySession(sessionId) {
|
|
|
395
395
|
return rows.map(rowToTask);
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
+
// Record the files a terminal worker changed, and nothing else. The summary
|
|
399
|
+
// read used to upsert the whole row, which on a running worker put stale
|
|
400
|
+
// copies of every live field (phase, current_action, exit_code) back over
|
|
401
|
+
// what the runner had just written. A terminal row has no writer left, and
|
|
402
|
+
// even then only this one column is touched.
|
|
403
|
+
export async function recordTerminalChangedFiles(taskId, changedFiles) {
|
|
404
|
+
await ensureFilesystem();
|
|
405
|
+
const terminal = Array.from(TERMINAL_STATUSES).map((s) => `'${s}'`).join(", ");
|
|
406
|
+
const result = openDb()
|
|
407
|
+
.prepare(`UPDATE tasks SET changed_files = @files WHERE id = @id AND status IN (${terminal})`)
|
|
408
|
+
.run({ id: taskId, files: encodeJson(changedFiles) });
|
|
409
|
+
return result.changes > 0;
|
|
410
|
+
}
|
|
411
|
+
|
|
398
412
|
export async function upsertSession({ id, title = null, note = null }) {
|
|
399
413
|
if (!id) throw new Error("session id is required");
|
|
400
414
|
await ensureFilesystem();
|
package/src/worktree.js
CHANGED
|
@@ -16,12 +16,20 @@ import { join } from "node:path";
|
|
|
16
16
|
|
|
17
17
|
const defaultGitBin = process.env.GIT_BIN?.trim() || "git";
|
|
18
18
|
|
|
19
|
+
// Two global flags on every read here.
|
|
20
|
+
//
|
|
19
21
|
// core.quotePath is on by default and turns every non-ASCII path into an
|
|
20
22
|
// octal-escaped, double-quoted string ("\344\270\255..."). The projects
|
|
21
|
-
// this runs against have Chinese directory names, so it is switched off
|
|
22
|
-
//
|
|
23
|
+
// this runs against have Chinese directory names, so it is switched off and
|
|
24
|
+
// paths come back as written.
|
|
25
|
+
//
|
|
26
|
+
// --no-optional-locks keeps `git status` from taking index.lock to refresh
|
|
27
|
+
// the index. These reads run while the worker is still working in the same
|
|
28
|
+
// worktree, from status polls and the board, and on Windows a status poll
|
|
29
|
+
// holding index.lock made the worker's own `git add` fail and the worker
|
|
30
|
+
// exit non-zero. An observer must never lock what it observes.
|
|
23
31
|
function git(worktreePath, args) {
|
|
24
|
-
return execFileSync(defaultGitBin, ["-C", worktreePath, "-c", "core.quotePath=false", ...args], {
|
|
32
|
+
return execFileSync(defaultGitBin, ["--no-optional-locks", "-C", worktreePath, "-c", "core.quotePath=false", ...args], {
|
|
25
33
|
encoding: "utf8",
|
|
26
34
|
timeout: 15000,
|
|
27
35
|
stdio: ["ignore", "pipe", "ignore"]
|