@workit-dev/codex 2.7.0 → 2.7.2
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.
|
@@ -18,7 +18,7 @@ account. Follow the workit-review skill (`$workit-review`).
|
|
|
18
18
|
(hunk, test or output), concrete fix.
|
|
19
19
|
5. Record the verdict:
|
|
20
20
|
start from the exact verdict command the SubagentStart hook gave you (it names no --session or --token: your shell already acts as your own session); it names `--kind review`:
|
|
21
|
-
`workit ledger verdict verified|failed|blocked --kind review --branch <b> --how "<what you read and ran>"`
|
|
21
|
+
`workit ledger verdict verified|failed|blocked --cwd <candidate worktree> --kind review --branch <b> --how "<what you read and ran>"`
|
|
22
22
|
(`verified`: no blocker or major left).
|
|
23
23
|
Record a design choice as `workit ledger ruling`.
|
|
24
24
|
|
|
@@ -26,8 +26,8 @@ Before your final report, wait for or stop every background command you started
|
|
|
26
26
|
(the host shows you running while one lives); never report with one still running.
|
|
27
27
|
|
|
28
28
|
Never commit, push, merge or edit. Write only in the candidate
|
|
29
|
-
worktree's `.workit-scratch
|
|
30
|
-
(`<<'EOF'`), never run by the shell. If the ledger refuses you as an author, report that instead of a verdict.
|
|
29
|
+
worktree's `.workit-scratch/` or your session's scratchpad: test cases go into files there via a quoted heredoc
|
|
30
|
+
(`<<'EOF'`), never run by the shell. A `node -e` or `python3 -c` that only reads runs anywhere. If the ledger refuses you as an author, report that instead of a verdict.
|
|
31
31
|
|
|
32
32
|
Codex runs you in a read-only sandbox. `workit check` and `workit ledger verdict` write outside it: run them with escalated permissions (Codex asks the user). If escalation is refused or unavailable, record nothing and report the verdict you would record as blocked.
|
|
33
33
|
'''
|
|
@@ -21,7 +21,7 @@ the goal is unmet until you observe it.
|
|
|
21
21
|
you observed. Label every claim measured, inferred or guess.
|
|
22
22
|
6. Record the verdict, then report it:
|
|
23
23
|
start from the exact verdict command the SubagentStart hook put in your context (it names no --session or --token: your shell already acts as your own session, never set WORKIT_SESSION_ID) and pick its `--kind <live|unit>`:
|
|
24
|
-
`workit ledger verdict verified|tests-verified|type-check-only|failed|blocked --kind <live|unit> --branch <b> --how "<what you ran and saw>"`.
|
|
24
|
+
`workit ledger verdict verified|tests-verified|type-check-only|failed|blocked --cwd <candidate worktree> --kind <live|unit> --branch <b> --how "<what you ran and saw>"`.
|
|
25
25
|
`verified` means the change was seen working on its real surface
|
|
26
26
|
(verify-<app>, `--kind live`); `tests-verified` means only tests ran. If the ledger refuses you as an author, report that;
|
|
27
27
|
never pass `--self`.
|
|
@@ -29,8 +29,10 @@ the goal is unmet until you observe it.
|
|
|
29
29
|
Before your final report, wait for or stop every background command you started
|
|
30
30
|
(the host shows you running while one lives); never report with one still running.
|
|
31
31
|
|
|
32
|
-
Write only in the candidate worktree's `.workit-scratch
|
|
33
|
-
file there via a quoted heredoc (`<<'EOF'`),
|
|
32
|
+
Write only in the candidate worktree's `.workit-scratch/` or your session's
|
|
33
|
+
scratchpad: a test case goes in a file there via a quoted heredoc (`<<'EOF'`),
|
|
34
|
+
never run by the shell. Reads (`git fetch -q origin`, a `node -e` or `python3 -c`
|
|
35
|
+
that only reads) run anywhere.
|
|
34
36
|
|
|
35
37
|
Report: candidate SHA, each check with its exit code, each acceptance line,
|
|
36
38
|
the verdict row you recorded. Fix nothing: a failing check is a verdict.
|
package/dist/launch-mcp.js
CHANGED
|
@@ -31572,12 +31572,17 @@ var JUDGE_VERBS = {
|
|
|
31572
31572
|
dir: true,
|
|
31573
31573
|
help: true,
|
|
31574
31574
|
"test-audit": true,
|
|
31575
|
-
ledger: ["verdict", "
|
|
31575
|
+
ledger: ["verdict", "list", "check", "ruling", "show"],
|
|
31576
|
+
finding: ["record", "list"],
|
|
31576
31577
|
pr: ["status"],
|
|
31577
31578
|
ci: ["wait", "logs"],
|
|
31578
31579
|
fanout: ["status", "brief"],
|
|
31579
31580
|
models: ["show"],
|
|
31580
|
-
lock: ["status"]
|
|
31581
|
+
lock: ["status"],
|
|
31582
|
+
lease: ["status"],
|
|
31583
|
+
grant: ["show"],
|
|
31584
|
+
task: ["show", "list"],
|
|
31585
|
+
doctor: ["--json"]
|
|
31581
31586
|
};
|
|
31582
31587
|
var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
|
|
31583
31588
|
|
|
@@ -19815,6 +19815,12 @@ var isConfigDir = (file) => configDirs().some((dir) => canonical4(dir) === canon
|
|
|
19815
19815
|
var isRoot = (file) => isConfigDir(file) || /^(?:issued[^\\/]*|approvals)$/.test(path29.relative(canonical4(resolveStateDir()), canonical4(file)));
|
|
19816
19816
|
var READ_CALLS = /^(?:print|log|info|warn|error|debug|puts|readdir(?:Sync)?|listdir|scandir|iterdir|glob|l?stat(?:Sync)?|exists(?:Sync)?|isdir|isfile|is_dir|is_file|access(?:Sync)?|realpath(?:Sync)?|dirname|basename|relative|str|repr|len)$/;
|
|
19817
19817
|
var MUTATING_CALLS = /^(?:renames?(?:Sync)?|move|copy(?:2|file|tree|File)?(?:Sync)?|cp(?:Sync)?|rm(?:tree|dir|Sync|dirSync)?|unlink(?:Sync)?|remove(?:dirs)?|mkdirs?(?:Sync)?|makedirs|mkdtemp(?:Sync)?|(?:sym|hard)?link(?:Sync|_to)?|write\w*|append\w*|truncate(?:Sync)?|ch(?:mod|own)(?:Sync)?|touch|open(?:Sync)?|dump|save|extractall|unpack_archive|put_contents|mv|FileUtils)$/;
|
|
19818
|
+
var SPAWNS = /subprocess|child_process|WriteStream|tempfile|sqlite|inplace|getattr|spawn|\bvm\b|Function\s*\(|FileIO|ZipFile|tarfile|shelve|FileHandler|filename\s*=|savefig|utime|ch(?:mod|own)|mkfifo|mknod|\.(?:delete|to_\w+)\s*\(|Path\b.*\.replace\(|Bun\.\$|O_(?:WR|RDW|CR|AP|TR)|(?:PYTHON|NODE_)\w*=|-r\b|--(?:require|import|[\w-]*loader)|\bos\.replace|\b(?:system|popen|exec\w*|fork|eval|shutil|(?:unlink|rename|remove)\w*)\b|\]\s*\(|\brequire\s*\(\s*(?!(['"])(?:(?![a-zA-Z]:)[\w@][^'"]*|[^'"]*\.json)\1)/;
|
|
19819
|
+
var FREE_OPEN = /\bopen\w*\s*\(\s*(?:(['"])(?![rbtUwax+]*\1)[^'"]*\1|[\w.]+)?\s*(?:,\s*(?:(['"])[rbt]*\2|encoding\s*=\s*(['"])[\w-]+\3)\s*)*\)/g;
|
|
19820
|
+
var writesIn = (text) => {
|
|
19821
|
+
const bare = text.replace(FREE_OPEN, "").replace(/std(?:out|err)\.write|(?<![fF][rR]?)(['"])(?:\\.|(?!\1)[^\\\n])*\1/g, "");
|
|
19822
|
+
return SPAWNS.test(text) || /['"]/.test(bare) || /\$\{|\\[ux]|(?:^|[(,=:;!&|?{}[\s])\/(?![/*])[^/\n]*['"]/.test(text) || [...bare.matchAll(/[\w$]+/g)].some(([word]) => !/^(?:append|copy)$/.test(word) && MUTATING_CALLS.test(word));
|
|
19823
|
+
};
|
|
19818
19824
|
var PATH_CALLS = /^(?:join|resolve|normalize|abspath|expanduser|expandvars|Path|PurePath|fspath)$/;
|
|
19819
19825
|
var rootUse = (text, at) => {
|
|
19820
19826
|
let call;
|
|
@@ -19889,11 +19895,14 @@ var shellScript2 = (words) => {
|
|
|
19889
19895
|
};
|
|
19890
19896
|
var XARGS_VALUE = /^-[IinLPdsEa]$/;
|
|
19891
19897
|
var runsWriter = (words) => {
|
|
19892
|
-
const filled = [
|
|
19898
|
+
const filled = [
|
|
19899
|
+
...words.filter((word) => word !== ";" && word !== "+").map((word) => word.includes("{}") ? "eval" : word),
|
|
19900
|
+
"eval"
|
|
19901
|
+
];
|
|
19893
19902
|
const edits = editsOf(filled);
|
|
19894
19903
|
return edits === null || edits.length > 0 || opaqueWrites(filled) !== null;
|
|
19895
19904
|
};
|
|
19896
|
-
var opaqueWrites = (input, scriptOf = (index) => input[index]) => {
|
|
19905
|
+
var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
|
|
19897
19906
|
let words = input;
|
|
19898
19907
|
while (words.length && (PREFIXES2.has(words[0]) || /^\w+=/.test(words[0]))) {
|
|
19899
19908
|
if (words[0] === "xargs") {
|
|
@@ -19950,17 +19959,17 @@ var opaqueWrites = (input, scriptOf = (index) => input[index]) => {
|
|
|
19950
19959
|
}
|
|
19951
19960
|
const inline = (flag) => {
|
|
19952
19961
|
const at = args.findIndex((arg) => flag.test(arg));
|
|
19953
|
-
if (at < 0)
|
|
19962
|
+
if (at < 0 && (fed === undefined || !/^(?:-|\/dev\/stdin)?$/.test(scriptArgs(name, args).named ?? "")))
|
|
19954
19963
|
return null;
|
|
19955
19964
|
const runs = input.length - args.length - 1;
|
|
19956
|
-
|
|
19965
|
+
const texts = input.map((word, index) => index === runs || index < runs && !/^\w+=/.test(word) ? "" : scriptOf(index));
|
|
19966
|
+
return /^(?:python[\d.]*|node|bun)$/.test(name) && [
|
|
19967
|
+
at < 0 ? fed : texts[runs + at + 2],
|
|
19968
|
+
...texts.slice(0, runs + 1 + (at < 0 ? args.length : at))
|
|
19969
|
+
].every((text) => text !== undefined && text !== null && !writesIn(text)) ? null : [
|
|
19957
19970
|
".",
|
|
19958
|
-
...
|
|
19959
|
-
|
|
19960
|
-
return [];
|
|
19961
|
-
const text = scriptOf(index);
|
|
19962
|
-
return text === undefined ? [unknownVarTarget(word)] : pathsIn(text);
|
|
19963
|
-
})
|
|
19971
|
+
...pathsIn(fed ?? ""),
|
|
19972
|
+
...texts.flatMap((text, index) => text === undefined ? [unknownVarTarget(input[index])] : pathsIn(text))
|
|
19964
19973
|
];
|
|
19965
19974
|
};
|
|
19966
19975
|
if (name === "curl")
|
|
@@ -20083,6 +20092,7 @@ var configWrites = (rest) => {
|
|
|
20083
20092
|
named++;
|
|
20084
20093
|
return named > 1;
|
|
20085
20094
|
};
|
|
20095
|
+
var plainFetch = (rest) => /^(?:\w[\w.-]*(?: [^-+:\s][^:\s]*)?)?$/.test(rest.filter((arg) => !/^-[qv]$|^--(?:quiet|verbose)$/.test(arg)).join(" "));
|
|
20086
20096
|
var GIT_VALUE = /^(?:-[Ccbouj]|--(?:git-dir|work-tree|namespace|config-env|branch|origin|config|depth|reference(?:-if-able)?|template|separate-git-dir|upload-pack|jobs|filter|initial-branch|object-format))$/;
|
|
20087
20097
|
var gitOutputs = (args) => {
|
|
20088
20098
|
let at = 0;
|
|
@@ -20124,7 +20134,7 @@ var gitOutputs = (args) => {
|
|
|
20124
20134
|
if (sub === "config" && configWrites(rest))
|
|
20125
20135
|
files.push(has(/^--global$/) ? "~/.gitconfig" : has(/^--system$/) ? "/etc/gitconfig" : valueOf(rest, /^(?:-f|--file=?)(.*)$/s) ?? ".");
|
|
20126
20136
|
const branchWrite = has(/^-[a-zA-Z]*[dDfmMcCu]|^--(?:delete|force|move|copy|set-upstream|unset-upstream|edit)/) || names.length > 0 && !has(/^-[a-zA-Z]*[lavr]|^--(?:list|all|remotes|verbose|show|contains|no-contains|merged|no-merged|points-at|format|sort)/);
|
|
20127
|
-
if (sub === "fetch" || sub === "gc" || sub === "branch" && branchWrite)
|
|
20137
|
+
if (sub === "fetch" && !plainFetch(rest) || sub === "gc" || sub === "branch" && branchWrite)
|
|
20128
20138
|
files.push(".");
|
|
20129
20139
|
if (base === undefined)
|
|
20130
20140
|
return files.length ? files : null;
|
|
@@ -20553,6 +20563,8 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
20553
20563
|
const made = mktempPath(value, dir);
|
|
20554
20564
|
if (made !== null)
|
|
20555
20565
|
return made;
|
|
20566
|
+
if (/^(?:\$\(\s*pwd\s*\)|`pwd`)$/.test(value) && !redefined && dir !== UNKNOWN_DIR)
|
|
20567
|
+
return dir ?? null;
|
|
20556
20568
|
const all = expansions(value, vars, loops).map(homeExpanded);
|
|
20557
20569
|
return all.length === 1 && unresolvedRefs(all[0]).length === 0 ? all[0] : null;
|
|
20558
20570
|
};
|
|
@@ -20739,6 +20751,8 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
20739
20751
|
for (const sub of depth < 4 ? segment.subs ?? [] : [])
|
|
20740
20752
|
targets.push(...segmentTargets(runIn, sub, dialect, depth + 1, strict, vars));
|
|
20741
20753
|
const expanding = new Set(segment.expands ?? []);
|
|
20754
|
+
const stdin = segment.stdin?.join(`
|
|
20755
|
+
`);
|
|
20742
20756
|
const scriptOf = (index) => {
|
|
20743
20757
|
const word = body[index];
|
|
20744
20758
|
if (word === undefined || !expanding.has(keywords + index))
|
|
@@ -20747,7 +20761,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
20747
20761
|
return all.some((text) => unresolvedRefs(text).some(unescaped)) ? undefined : all.join(`
|
|
20748
20762
|
`);
|
|
20749
20763
|
};
|
|
20750
|
-
const opaque = segment.unanalyzable ? ["."] : inner === null ? opaqueWrites(body, scriptOf) : null;
|
|
20764
|
+
const opaque = segment.unanalyzable ? ["."] : inner === null ? opaqueWrites(body, scriptOf, stdin && (/[$`]/.test(stdin) && /<<-?[ \t]*[^'"\\\s]/.test(command.replaceAll("\\\n", "")) ? null : stdin)) : null;
|
|
20751
20765
|
const ran = words.findIndex((word) => word === "xargs" || !PREFIXES2.has(word));
|
|
20752
20766
|
const runner = words[ran];
|
|
20753
20767
|
if (runner !== undefined && expanding.has(keywords + lead + ran) && unresolvedRefs(homeExpanded(runner)).length > 0)
|
|
@@ -20763,15 +20777,13 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
20763
20777
|
if (ln >= 0 && words.slice(0, ln).every((word) => PREFIXES2.has(word)) && (strict !== "registry" || !lnArgs.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg))))
|
|
20764
20778
|
targets.push(...linkSources(lnArgs, at));
|
|
20765
20779
|
}
|
|
20766
|
-
for (const file of segment.redirects)
|
|
20767
|
-
if (!/^\/dev\/(?:null|stdout|stderr|tty)$/.test(file))
|
|
20768
|
-
targets.push(...atAll(file));
|
|
20769
20780
|
const edits = editsOf(body);
|
|
20770
20781
|
if (edits === null) {
|
|
20771
20782
|
if (dir !== undefined)
|
|
20772
20783
|
targets.push(placeholderIn(dir, DIR_TARGET));
|
|
20773
|
-
}
|
|
20774
|
-
|
|
20784
|
+
}
|
|
20785
|
+
for (const file of [...segment.redirects, ...edits ?? []])
|
|
20786
|
+
if (!/^\/dev\/(?:null|stdout|stderr|tty)$/.test(file))
|
|
20775
20787
|
targets.push(...atAll(file));
|
|
20776
20788
|
if (dir !== undefined)
|
|
20777
20789
|
for (const invocation of workitInvocations(body.map(quoteWord2).join(" "), "posix")) {
|
|
@@ -22385,6 +22397,7 @@ function neededChecks(lane, configured) {
|
|
|
22385
22397
|
// packages/workit-core/src/hooks/worktree-confine.ts
|
|
22386
22398
|
import { createHash as createHash16 } from "node:crypto";
|
|
22387
22399
|
import fs21 from "node:fs";
|
|
22400
|
+
import os9 from "node:os";
|
|
22388
22401
|
import path32 from "node:path";
|
|
22389
22402
|
var FANOUT_TOKEN_FILE = "workit-fanout-token";
|
|
22390
22403
|
var NONE5 = { kind: "none" };
|
|
@@ -22576,10 +22589,10 @@ var unknownVarDeny = (input, worktree, targets, command) => {
|
|
|
22576
22589
|
const wt = worktree ?? "<worktree>";
|
|
22577
22590
|
const literal = literalForm(text, refs.filter((ref) => /^[$`]/.test(ref)));
|
|
22578
22591
|
const retry = command === undefined || literal === command ? "" : ` ${first.length ? `${first.join(" ")} retry` : "Retry"} as: \`${literal}\`.`;
|
|
22579
|
-
const unblock = `Spell the path out instead of ${refs.join(", ")}: Workit follows only
|
|
22592
|
+
const unblock = `Spell the path out instead of ${refs.join(", ")}: Workit follows only \`NAME=<literal>\`, \`$(mktemp …)\`, \`$(pwd)\`, \`$PWD\` after a literal \`cd\` and a \`for\` over literal words.${retry} Write under ${wt} or a temp dir.`;
|
|
22580
22593
|
return {
|
|
22581
22594
|
kind: "deny",
|
|
22582
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} writes to a path built from ${named.join(", ")}, which Workit cannot resolve
|
|
22595
|
+
reason: `workit worktree confinement: implementer ${input.session.agentId} writes to a path built from ${named.join(", ")}, which Workit cannot resolve, so it cannot tell whether the write stays in its worktree. ${unblock}`,
|
|
22583
22596
|
unblock
|
|
22584
22597
|
};
|
|
22585
22598
|
};
|
|
@@ -22705,7 +22718,8 @@ var inScratch = (real, repo) => {
|
|
|
22705
22718
|
if (path32.basename(dir) !== SCRATCH)
|
|
22706
22719
|
continue;
|
|
22707
22720
|
const root = path32.dirname(dir);
|
|
22708
|
-
|
|
22721
|
+
const checkout = checkoutOf2(root);
|
|
22722
|
+
if (checkout?.root === root && (repo === null || checkout.workit || commonDir(root) === repo))
|
|
22709
22723
|
return true;
|
|
22710
22724
|
}
|
|
22711
22725
|
return false;
|
|
@@ -22918,7 +22932,7 @@ var remoteIn = (dir, name, repo) => {
|
|
|
22918
22932
|
const url = configEntries(fs21.readFileSync(path32.join(shared, "config"), "utf8")).find(([key]) => key === `remote.${name}.url`.toLowerCase())?.[1];
|
|
22919
22933
|
return url !== undefined && literalIn(url, repo, true);
|
|
22920
22934
|
};
|
|
22921
|
-
var judgeGit = (command, repo, depth = 0) => {
|
|
22935
|
+
var judgeGit = (command, repo, cwd, depth = 0) => {
|
|
22922
22936
|
const runsGit = /\bgit\b/.test(command);
|
|
22923
22937
|
for (const segment of segmentsOf(command)) {
|
|
22924
22938
|
const words = segment.words;
|
|
@@ -22967,7 +22981,10 @@ var judgeGit = (command, repo, depth = 0) => {
|
|
|
22967
22981
|
const args = words[index] === "--version" ? ["version"] : words.slice(index);
|
|
22968
22982
|
if (!why && start >= 0) {
|
|
22969
22983
|
const local = (source, remote) => remote && /^[\w-][\w.-]*$/.test(source) ? remoteIn(dir, source, repo) : literalIn(source, repo, true);
|
|
22970
|
-
|
|
22984
|
+
const runsIn = path32.isAbsolute(dir) ? dir : cwd && path32.resolve(cwd, dir);
|
|
22985
|
+
const home = runsIn && checkoutOf2(runsIn);
|
|
22986
|
+
const fetches = args[0] === "fetch" && plainFetch(args.slice(1)) && home && (home.workit || commonDir(home.root) === repo) && !words.some((word) => /^--[gw]/.test(word));
|
|
22987
|
+
if (!fetches && !gitKind(args, local))
|
|
22971
22988
|
why = `\`git ${args.slice(0, 2).join(" ")}\` is not allowed`;
|
|
22972
22989
|
else if (args[0] === "status" && !unlocked) {
|
|
22973
22990
|
const dirs = path32.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
|
|
@@ -22983,7 +23000,7 @@ var judgeGit = (command, repo, depth = 0) => {
|
|
|
22983
23000
|
if (shell > at && scripts.some((script) => /git/.test(script)) && (!/^(?:timeout|nice|time|command)$/.test(name) || words.slice(at + 1, shell).some((word) => !/^(?:-[\w-]+|\d[\w.]*)$/.test(word))))
|
|
22984
23001
|
why ??= `\`${name}\` runs git`;
|
|
22985
23002
|
for (const script of [...segment.subs ?? [], ...scripts])
|
|
22986
|
-
why ??= depth < 4 ? judgeGit(script, repo, depth + 1) : "scripts nest too deep for Workit to read";
|
|
23003
|
+
why ??= depth < 4 ? judgeGit(script, repo, cwd, depth + 1) : "scripts nest too deep for Workit to read";
|
|
22987
23004
|
if (why)
|
|
22988
23005
|
return why;
|
|
22989
23006
|
}
|
|
@@ -22994,12 +23011,17 @@ var JUDGE_VERBS = {
|
|
|
22994
23011
|
dir: true,
|
|
22995
23012
|
help: true,
|
|
22996
23013
|
"test-audit": true,
|
|
22997
|
-
ledger: ["verdict", "
|
|
23014
|
+
ledger: ["verdict", "list", "check", "ruling", "show"],
|
|
23015
|
+
finding: ["record", "list"],
|
|
22998
23016
|
pr: ["status"],
|
|
22999
23017
|
ci: ["wait", "logs"],
|
|
23000
23018
|
fanout: ["status", "brief"],
|
|
23001
23019
|
models: ["show"],
|
|
23002
|
-
lock: ["status"]
|
|
23020
|
+
lock: ["status"],
|
|
23021
|
+
lease: ["status"],
|
|
23022
|
+
grant: ["show"],
|
|
23023
|
+
task: ["show", "list"],
|
|
23024
|
+
doctor: ["--json"]
|
|
23003
23025
|
};
|
|
23004
23026
|
var HELP = /^(?:--help|-h)$/;
|
|
23005
23027
|
var judgeVerbRefused = (args) => {
|
|
@@ -23010,8 +23032,7 @@ var judgeVerbRefused = (args) => {
|
|
|
23010
23032
|
if (verb === undefined || verb === "--version" || HELP.test(verb) || HELP.test(sub))
|
|
23011
23033
|
return null;
|
|
23012
23034
|
const allowed = Object.hasOwn(JUDGE_VERBS, verb) ? JUDGE_VERBS[verb] : [];
|
|
23013
|
-
|
|
23014
|
-
return ok ? null : `workit ${call.join(" ")}`;
|
|
23035
|
+
return (allowed === true || allowed.includes(sub)) && (verb !== "doctor" || call.length < 3) && !call.some((arg) => /^--(?:mutate|fix)\b/.test(arg)) ? null : `workit ${call.join(" ")}`;
|
|
23015
23036
|
};
|
|
23016
23037
|
var CLI_RUNNERS = /^(?:npx|bunx|pnpx|npm|pnpm|yarn|bun|node|nodejs|deno|tsx|ts-node)$/;
|
|
23017
23038
|
var CLI_ENTRY = /(?:^|[=\\/])(?:workit(?:\.(?:exe|cmd|[cm]?js))?|@workit-dev\/cli(?:@\S*)?)$|(?:workit-cli|@workit-dev[\\/]cli)[\\/](?:src[\\/](?:index|main)|dist[\\/]index)\.[cm]?[jt]sx?$/;
|
|
@@ -23090,7 +23111,7 @@ var judgeRefusal = (command, fed, depth = 0) => {
|
|
|
23090
23111
|
}
|
|
23091
23112
|
if (INTERPRETERS2.test(name) && !args.some((arg) => INLINE.test(arg))) {
|
|
23092
23113
|
const operand = args.find((arg, index) => (arg === "-" || !arg.startsWith("-")) && !VALUED.test(args[index - 1] ?? ""));
|
|
23093
|
-
if (FED.test(operand ?? "") || operand === undefined && !/^(?:bun|deno)$/.test(name))
|
|
23114
|
+
if ((FED.test(operand ?? "") || operand === undefined && !/^(?:bun|deno)$/.test(name)) && !(segment.stdin?.length && /^(?:-|\/dev\/stdin)?$/.test(operand ?? "")))
|
|
23094
23115
|
return unseen;
|
|
23095
23116
|
}
|
|
23096
23117
|
const tail = workitCheckTail(words.slice(at));
|
|
@@ -23131,7 +23152,7 @@ var judgeDeny = (input, what, target) => {
|
|
|
23131
23152
|
const candidate = target ? checkoutOf2(target)?.root : undefined;
|
|
23132
23153
|
const also = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? ` or ${path32.join(candidate, SCRATCH)}` : "";
|
|
23133
23154
|
const scratch = root ? `${path32.join(root, SCRATCH)}${also}` : `${SCRATCH}/ at the root of the checkout you judge`;
|
|
23134
|
-
const unblock = `Write only under ${scratch} (mkdir -p it): put a generated case in a file there with a quoted heredoc (<<'EOF') and never run it in the shell. Reads, \`workit check\` and \`workit
|
|
23155
|
+
const unblock = `Write only under ${scratch} (mkdir -p it): put a generated case in a file there with a quoted heredoc (<<'EOF') and never run it in the shell. Reads, \`workit check\`, \`workit ledger verdict\` and \`workit finding record\` stay allowed; a change the candidate needs is a finding, not an edit.`;
|
|
23135
23156
|
return {
|
|
23136
23157
|
kind: "deny",
|
|
23137
23158
|
reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}. ${unblock}`,
|
|
@@ -23144,6 +23165,10 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
23144
23165
|
return NONE5;
|
|
23145
23166
|
const judged = checkoutOf2(input.cwd);
|
|
23146
23167
|
const repo = judged ? commonDir(judged.root) : null;
|
|
23168
|
+
const scratch = (real) => inScratch(real, repo) || [os9.tmpdir(), "/tmp"].some((dir) => {
|
|
23169
|
+
const [host, , session] = path32.relative(canonical5(dir), real).split(path32.sep);
|
|
23170
|
+
return /^claude-\d+$/.test(host) && session === input.session.id;
|
|
23171
|
+
});
|
|
23147
23172
|
for (const target of targets) {
|
|
23148
23173
|
const resolved = path32.resolve(target);
|
|
23149
23174
|
if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
|
|
@@ -23153,7 +23178,7 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
23153
23178
|
const gitDirs = runsGit ? gitDirsAt(path32.dirname(real), repo) : [];
|
|
23154
23179
|
if (gitDirs === null)
|
|
23155
23180
|
return judgeDeny(input, `git in ${shown(target)} uses a git dir or config Workit cannot check`);
|
|
23156
|
-
if (runsGit ? gitDirs.length > 0 ? gitDirs.every(
|
|
23181
|
+
if (runsGit ? gitDirs.length > 0 ? gitDirs.every(scratch) : scratch(real) : scratch(real) && !inGitDir(real))
|
|
23157
23182
|
continue;
|
|
23158
23183
|
const runner = runnerAt(target);
|
|
23159
23184
|
return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target);
|
|
@@ -23177,7 +23202,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
23177
23202
|
if (!refused && dialect === "posix") {
|
|
23178
23203
|
const judged = checkoutOf2(input.cwd);
|
|
23179
23204
|
try {
|
|
23180
|
-
const why = judgeGit(command, judged ? commonDir(judged.root) : null);
|
|
23205
|
+
const why = judgeGit(command, judged ? commonDir(judged.root) : null, /\b(?:cd|chdir|pushd|popd)\b/.test(command) ? null : input.cwd);
|
|
23181
23206
|
if (why)
|
|
23182
23207
|
refused = `${why}: ${JUDGE_GIT}`;
|
|
23183
23208
|
} catch {
|
|
@@ -23186,11 +23211,11 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
23186
23211
|
}
|
|
23187
23212
|
if (refused)
|
|
23188
23213
|
return judgeDeny(input, refused);
|
|
23189
|
-
if (dialect === "posix" && substitutingHeredoc(command))
|
|
23214
|
+
if (dialect === "posix" && substitutingHeredoc(command.replaceAll("\\\n", "")))
|
|
23190
23215
|
return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')");
|
|
23191
23216
|
let git = [];
|
|
23192
23217
|
try {
|
|
23193
|
-
git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args) || gitKind(args) === "write" && !/^(?:init|clone)$/.test(args[0])) ? [
|
|
23218
|
+
git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args) || gitKind(args) === "write" && !/^(?:init|clone)$/.test(args[0]) && !(args[0] === "fetch" && plainFetch(args.slice(1)))) ? [
|
|
23194
23219
|
path32.join(dir === undefined ? UNKNOWN_DIR : path32.resolve(input.cwd, dir ?? "."), `${OPAQUE_TARGET}git`)
|
|
23195
23220
|
] : []);
|
|
23196
23221
|
} catch {}
|
|
@@ -23456,7 +23481,7 @@ var cdWorkitSplit = (command) => {
|
|
|
23456
23481
|
|
|
23457
23482
|
// packages/workit-core/src/hooks/model-limit.ts
|
|
23458
23483
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4, readSync, statSync as statSync5 } from "node:fs";
|
|
23459
|
-
import
|
|
23484
|
+
import os10 from "node:os";
|
|
23460
23485
|
import path34 from "node:path";
|
|
23461
23486
|
var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
|
|
23462
23487
|
var WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
@@ -23662,7 +23687,7 @@ var listDir = (dir) => {
|
|
|
23662
23687
|
};
|
|
23663
23688
|
var SCAN_MS = 30 * 60000;
|
|
23664
23689
|
var scanClaudeTranscripts = (cwd, env, now = new Date) => {
|
|
23665
|
-
const projects = path34.join(env.CLAUDE_CONFIG_DIR || path34.join(env.HOME ||
|
|
23690
|
+
const projects = path34.join(env.CLAUDE_CONFIG_DIR || path34.join(env.HOME || os10.homedir(), ".claude"), "projects");
|
|
23666
23691
|
const project = path34.join(projects, claudeProjectSlug(cwd));
|
|
23667
23692
|
const notes = [];
|
|
23668
23693
|
const files = listDir(project).flatMap((entry) => entry.endsWith(".jsonl") ? [{ file: entry, worker: false }] : listDir(path34.join(entry, "subagents")).filter((file) => file.endsWith(".jsonl")).map((file) => ({ file, worker: true })));
|
|
@@ -24313,6 +24338,7 @@ var usageLimitOnStop = (input, agentId, text) => {
|
|
|
24313
24338
|
};
|
|
24314
24339
|
var subagentSession = (session, agentId) => [session, agentId].filter((part) => Boolean(part)).join(":").replace(/[^A-Za-z0-9_.:@/+-]/g, "-").slice(0, 128);
|
|
24315
24340
|
var isolatedGit = (cwd) => `Run git as plain, separate commands inside your worktree (\`git switch -c <branch> <base>\`, ${workspaceTrailers(cwd).enabled ? '`git commit --trailer "Workit-Session=<your session>"`, `git push`; `workit doctor --fix` can install a prepare-commit-msg hook that adds the trailer' : "`git commit` (this workspace sets trailers: false: add no Workit-Session trailer), `git push`"}; add Co-Authored-By with \`git commit --trailer\` in the same commit, never by amending), never \`workit git …\`: Claude Code's worktree isolation refuses a command that wraps git and cannot be turned off (https://code.claude.com/docs/en/worktrees#how-claude-code-enforces-isolation). Never dodge that check by renaming or re-wrapping git. Use workit for the non-git verbs (\`workit check\`, \`workit ledger\`, \`workit pr\`).`;
|
|
24341
|
+
var JUDGE_CWD = " Add `--cwd <candidate worktree>` when your shell is elsewhere.";
|
|
24316
24342
|
var subagentStartText = (input, descriptor, event) => {
|
|
24317
24343
|
const session = input.session.id ?? null;
|
|
24318
24344
|
const { role, isolated, git } = agentSteering(descriptor, input.cwd, {
|
|
@@ -24339,12 +24365,12 @@ ${subagentStartText({ ...input, cwd: "" }, descriptor, event)}`;
|
|
|
24339
24365
|
const checks = judgeChecksLine(cwd);
|
|
24340
24366
|
const checksText = checks ? ` ${checks}` : "";
|
|
24341
24367
|
if (descriptor.host === "codex_cli" || descriptor.host === "codex_desktop")
|
|
24342
|
-
return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge })}
|
|
24368
|
+
return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge })}\`.${JUDGE_CWD} Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
|
|
24343
24369
|
const token = session ? recordIssuedSession(cwd, session, own) : null;
|
|
24344
24370
|
if (session && !token)
|
|
24345
24371
|
return `${readOnly} ${own} was already issued to an earlier subagent, so no token is handed out again and a verdict under it would be refused (unbound_session). Record no verdict as ${own}: spawn a fresh verifier or reviewer, which gets its own session and token.`;
|
|
24346
24372
|
const line = verdictCommand({ branch, judge, session: own, token });
|
|
24347
|
-
return `${readOnly} Its own Workit session is ${own}, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${line}\`.${token ? " The token is this subagent's alone: never write it into a report, a file or a commit. --token needs a workit CLI at least as new as this plugin; if the CLI answers that --token is an unknown option, update the workit CLI (workit upgrade --cli) and record again." : ""}${checksText}`;
|
|
24373
|
+
return `${readOnly} Its own Workit session is ${own}, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${line}\`.${JUDGE_CWD}${token ? " The token is this subagent's alone: never write it into a report, a file or a commit. --token needs a workit CLI at least as new as this plugin; if the CLI answers that --token is an unknown option, update the workit CLI (workit upgrade --cli) and record again." : ""}${checksText}`;
|
|
24348
24374
|
};
|
|
24349
24375
|
var PRE_TOOL = new Set(["shell.pre", "write.pre", "tool.pre"]);
|
|
24350
24376
|
function handleHook(input, deps) {
|
package/dist/workit-hook.js
CHANGED
|
@@ -98,7 +98,7 @@ if (quiet) {
|
|
|
98
98
|
`);
|
|
99
99
|
} else {
|
|
100
100
|
try {
|
|
101
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
101
|
+
const { runCodexHook } = await import("./workit-hook-10n413q9.js");
|
|
102
102
|
await runCodexHook([payload]);
|
|
103
103
|
} catch (error) {
|
|
104
104
|
const { answerRuntimeFailure } = await import("./workit-hook-9k8dtngs.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/codex",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, method skills, and verifier/reviewer/implementer agents",
|
|
6
6
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"build": "bun scripts/build.ts"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@workit-dev/core": "^2.7.
|
|
45
|
-
"@workit-dev/mcp": "^2.7.
|
|
44
|
+
"@workit-dev/core": "^2.7.2",
|
|
45
|
+
"@workit-dev/mcp": "^2.7.2"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24"
|