codex-supervisor-mcp 0.7.3 → 0.9.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.en.md +51 -17
- package/README.md +51 -17
- package/package.json +10 -1
- package/skills/codex-supervisor/SKILL.md +43 -11
- package/src/acceptance-baseline.js +64 -0
- package/src/acceptance.js +264 -0
- package/src/cleanup.js +66 -19
- package/src/codex-runner.js +410 -31
- package/src/event-parser.js +68 -10
- package/src/external-output.js +29 -0
- package/src/goal-store.js +10 -7
- package/src/handoff.js +31 -0
- package/src/landing.js +247 -5
- package/src/mcp-server.js +326 -40
- package/src/owned-changes.js +27 -0
- package/src/prompt.js +80 -7
- package/src/status.js +1 -1
- package/src/task-store.js +195 -9
- package/src/tool-guard.js +66 -0
- package/src/truncate.js +13 -0
- package/src/web-app.js +4 -1
- package/src/worker-changes.js +38 -0
- package/src/worker-report.js +15 -0
- package/src/worker-report.schema.json +10 -0
- package/src/worktree.js +53 -1
- package/web/dist/assets/{index-CqG_XY9n.js → index-fJQbspTY.js} +1 -1
- package/web/dist/index.html +1 -1
package/src/worktree.js
CHANGED
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
// so the committed part is read as `git diff --name-only <base> HEAD`, where
|
|
12
12
|
// base is the commit the worktree was created from.
|
|
13
13
|
import { execFileSync } from "node:child_process";
|
|
14
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
14
|
+
import { existsSync, readFileSync, lstatSync } from "node:fs";
|
|
15
15
|
import { join } from "node:path";
|
|
16
16
|
import { truncateMiddleChars } from "./truncate.js";
|
|
17
|
+
import { createHash } from "node:crypto";
|
|
17
18
|
|
|
18
19
|
const defaultGitBin = process.env.GIT_BIN?.trim() || "git";
|
|
19
20
|
|
|
@@ -211,3 +212,54 @@ export function worktreeRef(task) {
|
|
|
211
212
|
export function readTaskChanges(task) {
|
|
212
213
|
return mergeChangedFiles(task.changed_files, readWorktreeChanges(task.worktree_path, worktreeRef(task)));
|
|
213
214
|
}
|
|
215
|
+
|
|
216
|
+
// Compare output at this run's start/end, rather than treating the previous
|
|
217
|
+
// run's committed or uncommitted work as fresh evidence. If the bounded read
|
|
218
|
+
// cannot prove the full state, leave the fingerprint unknown.
|
|
219
|
+
export function snapshotTaskOutput(task) {
|
|
220
|
+
const diff = readWorktreeDiff(task.worktree_path, worktreeRef(task), { maxChars: 2_000_000 });
|
|
221
|
+
if (diff.error || diff.truncated_files > 0 || diff.files.some((file) => file.patch == null)) return null;
|
|
222
|
+
try {
|
|
223
|
+
let remaining = 2_000_000;
|
|
224
|
+
const files = diff.files.map((file) => {
|
|
225
|
+
let content = "deleted";
|
|
226
|
+
if (file.status !== "deleted") {
|
|
227
|
+
const path = join(task.worktree_path, file.path);
|
|
228
|
+
const info = lstatSync(path);
|
|
229
|
+
if (!info.isFile() || info.size > remaining) throw new Error("unknown output");
|
|
230
|
+
remaining -= info.size;
|
|
231
|
+
content = createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
232
|
+
}
|
|
233
|
+
return { path: file.path, from: file.from, status: file.status, patch: file.patch, content };
|
|
234
|
+
});
|
|
235
|
+
return createHash("sha256").update(JSON.stringify(files)).digest("hex");
|
|
236
|
+
} catch { return null; }
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// How far the project has moved since the worktree was cut. Compared with
|
|
240
|
+
// the project directory's HEAD, which is the branch the main thread
|
|
241
|
+
// integrates on. contains_base false means the base was rewritten (an
|
|
242
|
+
// amend or a rebase on the main branch) and the count is of a history the
|
|
243
|
+
// base is not in; every git error is reported as null, never as 0.
|
|
244
|
+
export function baseBehind(projectRoot, baseCommit) {
|
|
245
|
+
if (!projectRoot || !baseCommit || !existsSync(projectRoot)) return { behind: null, contains_base: null, ref: null };
|
|
246
|
+
let ref = null;
|
|
247
|
+
try {
|
|
248
|
+
ref = git(projectRoot, ["symbolic-ref", "--short", "-q", "HEAD"]).trim() || "HEAD";
|
|
249
|
+
} catch {
|
|
250
|
+
ref = "HEAD";
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
const behind = Number(git(projectRoot, ["rev-list", "--count", `${baseCommit}..HEAD`]).trim());
|
|
254
|
+
let containsBase = true;
|
|
255
|
+
try {
|
|
256
|
+
git(projectRoot, ["merge-base", "--is-ancestor", baseCommit, "HEAD"]);
|
|
257
|
+
} catch (error) {
|
|
258
|
+
if (error.status === 1) containsBase = false;
|
|
259
|
+
else return { behind: null, contains_base: null, ref };
|
|
260
|
+
}
|
|
261
|
+
return { behind: Number.isFinite(behind) ? behind : null, contains_base: containsBase, ref };
|
|
262
|
+
} catch {
|
|
263
|
+
return { behind: null, contains_base: null, ref };
|
|
264
|
+
}
|
|
265
|
+
}
|