@workit-dev/codex 2.11.0 → 2.12.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/dist/launch-mcp.js
CHANGED
|
@@ -15510,6 +15510,7 @@ var workspaceConfigSchema = object({
|
|
|
15510
15510
|
releaseNotes: unknown().optional().describe("The release notes `workit release finish` publishes on the forge release: `auto` (default: the draft when there is one, else the notes built from the version's changelog section), `off` (no forge release) or `review` (finish refuses until `workit release notes approve`). A release track overrides it."),
|
|
15511
15511
|
trailers: boolean2().optional().describe("Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
|
|
15512
15512
|
deleteBranch: boolean2().optional().describe("Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
|
|
15513
|
+
cleanup: unknown().optional().describe("What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
|
|
15513
15514
|
liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
|
|
15514
15515
|
fanout: object({
|
|
15515
15516
|
tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
|
|
@@ -31544,78 +31545,6 @@ var MUTATING_REMOTE = new Set([
|
|
|
31544
31545
|
"set-branches",
|
|
31545
31546
|
"prune"
|
|
31546
31547
|
]);
|
|
31547
|
-
var GIT_VERBS = {
|
|
31548
|
-
log: "@d@l|@d @l",
|
|
31549
|
-
show: "@d@l|@d @l",
|
|
31550
|
-
diff: "@d|@d cached staged merge-base no-index",
|
|
31551
|
-
"diff-tree": "@drtcm|@d root stdin no-commit-id",
|
|
31552
|
-
"diff-index": "@dm|@d cached merge-base",
|
|
31553
|
-
status: "sbu?zv|short branch porcelain? long untracked-files? ignored? ignore-submodules? show-stash ahead-behind no-ahead-behind renames no-renames find-renames? column? no-column null verbose",
|
|
31554
|
-
"rev-parse": "q|verify short? abbrev-ref? symbolic symbolic-full-name show-toplevel show-prefix git-dir git-common-dir absolute-git-dir is-inside-work-tree is-inside-git-dir is-bare-repository show-cdup quiet all branches? tags? remotes? since= until= default= path-format= sq-quote",
|
|
31555
|
-
"rev-list": "@l|@l count objects? left-only right-only",
|
|
31556
|
-
"ls-files": "cdmoiskuvtzfx:X:|cached deleted modified others ignored stage unmerged killed directory no-empty-directory exclude-standard exclude= exclude-from= full-name abbrev? error-unmatch with-tree= eol deduplicate format= recurse-submodules sparse",
|
|
31557
|
-
"ls-tree": "rdtlz|long name-only name-status object-only full-name full-tree abbrev? format=",
|
|
31558
|
-
"cat-file": "tsepz|batch? batch-check? batch-all-objects follow-symlinks unordered buffer allow-unknown-type mailmap use-mailmap",
|
|
31559
|
-
blame: "L:lstfnepwbcM?C?|porcelain line-porcelain incremental root show-stats show-name show-number show-email abbrev= reverse= first-parent date= ignore-rev= ignore-revs-file= minimal contents=",
|
|
31560
|
-
describe: "|tags all long abbrev= contains always dirty? broken? match= exclude= first-parent exact-match candidates= debug",
|
|
31561
|
-
"merge-base": "a|all octopus independent is-ancestor fork-point",
|
|
31562
|
-
"for-each-ref": "|count= sort= format= color? shell perl python tcl points-at= merged? no-merged? contains? no-contains? ignore-case omit-empty exclude=",
|
|
31563
|
-
shortlog: "@lsnec|@l summary numbered email committer group= format=",
|
|
31564
|
-
"show-ref": "dsq|head verify heads tags branches hash? abbrev? quiet dereference exists",
|
|
31565
|
-
"name-rev": "|tags refs= exclude= all annotate-stdin name-only no-undefined always",
|
|
31566
|
-
grep: "aiIvnhHcEGFPlLzoWqwe:A:B:C:m:f:|cached untracked no-index no-exclude-standard exclude-standard recurse-submodules text ignore-case word-regexp invert-match line-number column count full-name extended-regexp basic-regexp fixed-strings perl-regexp files-with-matches name-only files-without-match null only-matching heading break show-function function-context max-depth= threads= and or not all-match quiet after-context= before-context= context= max-count= color? no-color",
|
|
31567
|
-
"format-patch": "@do:nNks|@d stdout output-directory= numbered no-numbered start-number= subject-prefix= root cover-letter thread? signoff attach? inline? suffix= base=",
|
|
31568
|
-
reflog: "@l|@l all expire= expire-unreachable= rewrite updateref stale-fix dry-run verbose",
|
|
31569
|
-
"count-objects": "vH|verbose human-readable",
|
|
31570
|
-
"check-ignore": "qvnz|quiet verbose stdin non-matching no-index",
|
|
31571
|
-
var: "l|",
|
|
31572
|
-
version: "|build-options",
|
|
31573
|
-
"ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
|
|
31574
|
-
remote: "v|verbose",
|
|
31575
|
-
config: "lz|get get-all get-regexp list local name-only null type= default=",
|
|
31576
|
-
worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
|
|
31577
|
-
branch: "dDmMcCfvraliu:|delete move copy force list all remotes verbose contains? merged? no-merged? points-at= show-current set-upstream-to= unset-upstream track? no-track sort= format= color? column? ignore-case create-reflog",
|
|
31578
|
-
tag: "lam:dfF:n?|list annotate message= file= delete force sort= format= contains? merged? no-merged? points-at= column? create-reflog ignore-case",
|
|
31579
|
-
init: "+qb:|quiet bare initial-branch= object-format= ref-format= shared? separate-git-dir=",
|
|
31580
|
-
add: "+AunNvf|all update intent-to-add force dry-run verbose ignore-errors ignore-removal no-all renormalize chmod= sparse",
|
|
31581
|
-
commit: "+m:aqsnF:C:ouv|message= all amend no-edit allow-empty allow-empty-message author= date= signoff no-verify quiet file= reuse-message= fixup= squash= only include dry-run no-gpg-sign untracked-files? cleanup= reset-author verbose",
|
|
31582
|
-
checkout: "+b:B:fqm|detach force orphan= quiet track? no-track merge ours theirs",
|
|
31583
|
-
switch: "+c:C:dfqm|create= force-create= detach discard-changes force orphan= quiet track? no-track merge",
|
|
31584
|
-
restore: "+s:SWq|source= staged worktree ours theirs merge quiet overlay no-overlay",
|
|
31585
|
-
reset: "+qN|soft mixed hard merge keep quiet no-refresh",
|
|
31586
|
-
rm: "+rfnq|cached force dry-run quiet ignore-unmatch",
|
|
31587
|
-
mv: "+fnkv|force dry-run verbose",
|
|
31588
|
-
merge: "+m:qvnX:|no-ff ff ff-only squash no-squash commit no-commit message= no-edit abort continue quit allow-unrelated-histories stat no-stat quiet verbose no-verify signoff strategy-option=",
|
|
31589
|
-
stash: "+m:ukqa|message= include-untracked keep-index quiet all index staged",
|
|
31590
|
-
apply: "+p:C:R3qv|check stat numstat summary index cached 3way reverse reject allow-empty exclude= include= verbose quiet whitespace= recount",
|
|
31591
|
-
am: "+skq3|signoff keep 3way quiet abort continue skip quit whitespace= reject",
|
|
31592
|
-
fetch: "+fqvptn|all depth= deepen= shallow-since= unshallow tags no-tags prune force quiet verbose dry-run update-shallow refmap=",
|
|
31593
|
-
clone: "+nqlsb:o:|bare no-checkout depth= branch= origin= single-branch no-single-branch no-tags quiet shared local no-local filter= separate-git-dir=",
|
|
31594
|
-
"cherry-pick": "+nm:sxX:|no-commit mainline= signoff abort continue skip quit allow-empty keep-redundant-commits ff strategy-option=",
|
|
31595
|
-
revert: "+nm:sX:|no-commit mainline= signoff abort continue skip quit strategy-option= no-edit",
|
|
31596
|
-
rebase: "+qvfnX:|onto= root abort continue skip quit keep-base no-ff force-rebase autosquash no-autosquash autostash no-autostash update-refs signoff quiet verbose stat no-stat committer-date-is-author-date reset-author-date rebase-merges? no-rebase-merges empty= strategy-option= apply merge",
|
|
31597
|
-
clean: "+dfnqxXe:|dry-run force quiet exclude=",
|
|
31598
|
-
bisect: "+|term-old= term-new= no-checkout first-parent"
|
|
31599
|
-
};
|
|
31600
|
-
var JUDGE_GIT = `a judge runs git ${Object.keys(GIT_VERBS).join(" ")} with the options each documents (no abbreviations), writing only in a scratch repo; no -c, no wrapper but timeout, nice, time, command, no env but PAGER=cat, GIT_PAGER=cat, GIT_OPTIONAL_LOCKS=0, LC_*, LANG, TZ; status outside scratch needs --no-optional-locks`;
|
|
31601
|
-
var JUDGE_VERBS = {
|
|
31602
|
-
check: true,
|
|
31603
|
-
dir: true,
|
|
31604
|
-
help: true,
|
|
31605
|
-
"test-audit": true,
|
|
31606
|
-
ledger: ["verdict", "list", "check", "ruling", "show"],
|
|
31607
|
-
finding: ["record", "list"],
|
|
31608
|
-
pr: ["status"],
|
|
31609
|
-
ci: ["wait", "logs"],
|
|
31610
|
-
fanout: ["status", "brief"],
|
|
31611
|
-
models: ["show"],
|
|
31612
|
-
lock: ["status"],
|
|
31613
|
-
lease: ["status"],
|
|
31614
|
-
grant: ["show"],
|
|
31615
|
-
task: ["show", "list"],
|
|
31616
|
-
doctor: ["--json"]
|
|
31617
|
-
};
|
|
31618
|
-
var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
|
|
31619
31548
|
|
|
31620
31549
|
// packages/workit-core/src/hooks/standing.ts
|
|
31621
31550
|
var DESCRIPTORS = {
|
|
@@ -7351,6 +7351,7 @@ var workspaceConfigSchema = object({
|
|
|
7351
7351
|
releaseNotes: unknown().optional().describe("The release notes `workit release finish` publishes on the forge release: `auto` (default: the draft when there is one, else the notes built from the version's changelog section), `off` (no forge release) or `review` (finish refuses until `workit release notes approve`). A release track overrides it."),
|
|
7352
7352
|
trailers: boolean2().optional().describe("Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
|
|
7353
7353
|
deleteBranch: boolean2().optional().describe("Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
|
|
7354
|
+
cleanup: unknown().optional().describe("What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
|
|
7354
7355
|
liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
|
|
7355
7356
|
fanout: object({
|
|
7356
7357
|
tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
|
|
@@ -20115,8 +20116,10 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
|
|
|
20115
20116
|
return curlOutputs(args);
|
|
20116
20117
|
if (name === "perl")
|
|
20117
20118
|
return inline(/^-[a-zA-Z]*[eE]$/);
|
|
20119
|
+
if (name.startsWith("python") && args.some((arg, at) => arg === "-m" && args[at + 1] !== "json.tool"))
|
|
20120
|
+
return [".", ...args.flatMap(pathsIn)];
|
|
20118
20121
|
if (/^(?:python[\d.]*|node|bun|deno|ruby|php)$/.test(name))
|
|
20119
|
-
return inline(/^-[a-zA-Z]*[
|
|
20122
|
+
return inline(/^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/);
|
|
20120
20123
|
return shellScript2(words) === null ? null : ["."];
|
|
20121
20124
|
};
|
|
20122
20125
|
var CURL_LONG = [
|
|
@@ -20849,7 +20852,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
20849
20852
|
shells.push(...read(named));
|
|
20850
20853
|
shells.push(...preloads.flatMap(read));
|
|
20851
20854
|
} else if (INTERPRETERS.test(verb)) {
|
|
20852
|
-
const code = args.findIndex((arg) => /^-[a-zA-Z]*[
|
|
20855
|
+
const code = args.findIndex((arg) => /^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/.test(arg));
|
|
20853
20856
|
if (code >= 0)
|
|
20854
20857
|
others.push(...expansions(args[code + 1] ?? "", vars, loops));
|
|
20855
20858
|
others.push(...named === undefined ? [...segment.stdin ?? [], ...inputs.flatMap(read), ...piped] : read(named), ...preloads.flatMap(read));
|
|
@@ -22673,50 +22676,38 @@ var shown = (target) => {
|
|
|
22673
22676
|
const named = /^\.workit-(?:live-target$|runs-)/.test(path32.basename(target)) ? path32.dirname(target) : target;
|
|
22674
22677
|
return path32.sep === "\\" ? named.replaceAll("/", "\\") : named;
|
|
22675
22678
|
};
|
|
22676
|
-
var
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
};
|
|
22684
|
-
var outsideDeny = (input, worktree, target) => {
|
|
22679
|
+
var runFrom = (dir, command) => `cd ${dir} && ${command.replace(/^\s*cd\s+\S+\s*(?:&&|;)\s*/, "")}`;
|
|
22680
|
+
var deny2 = (what, unblock) => ({
|
|
22681
|
+
kind: "deny",
|
|
22682
|
+
reason: `${what}.
|
|
22683
|
+
${unblock}`,
|
|
22684
|
+
unblock
|
|
22685
|
+
});
|
|
22686
|
+
var unboundDeny = (input, target) => deny2(`workit worktree confinement: implementer ${input.session.agentId} is not working in a Workit worktree yet, and ${shown(target)} is outside every one`, "Why: work only in your brief's worktree (`workit fanout worktree create <slice>`); with none, tell the lead.");
|
|
22687
|
+
var outsideDeny = (input, worktree, target, command) => {
|
|
22685
22688
|
const runner = runnerAt(target);
|
|
22686
|
-
|
|
22687
|
-
return {
|
|
22688
|
-
kind: "deny",
|
|
22689
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} is bound to the worktree ${worktree}, and ${runner === null ? `${shown(target)} is` : `\`${runner}\` runs in ${shown(target)},`} outside it. ${unblock}`,
|
|
22690
|
-
unblock
|
|
22691
|
-
};
|
|
22692
|
-
};
|
|
22693
|
-
var unknownDirDeny = (input, worktree) => {
|
|
22694
|
-
const wt = worktree ?? "<worktree>";
|
|
22695
|
-
const unblock = `Workit cannot resolve \`cd -\`, \`cd "$X"\` or \`popd\`: write by absolute path, \`git -C ${wt}\` or \`workit <verb> --cwd ${wt}\`.`;
|
|
22696
|
-
return {
|
|
22697
|
-
kind: "deny",
|
|
22698
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} writes after an unknown directory change. ${unblock}`,
|
|
22699
|
-
unblock
|
|
22700
|
-
};
|
|
22689
|
+
return deny2(`workit worktree confinement: implementer ${input.session.agentId} is bound to the worktree ${worktree}, and ${runner === null ? `${shown(target)} is` : `\`${runner}\` runs in ${shown(target)},`} outside it`, runner !== null && command ? `Retry as: ${runFrom(worktree, command)}` : `Why: edit only under ${worktree}, git one verb per call (\`workit git --cwd ${worktree} commit -m … -- <paths>\`); the rest is a follow-up.`);
|
|
22701
22690
|
};
|
|
22691
|
+
var unknownDirDeny = (input, worktree) => deny2(`workit worktree confinement: implementer ${input.session.agentId} writes after a directory change Workit cannot resolve (\`cd -\`, \`cd "$X"\`, \`popd\`)`, `Why: write by absolute path, \`git -C ${worktree ?? "<worktree>"}\` or \`workit <verb> --cwd\`.`);
|
|
22692
|
+
var refsOf = (targets) => [
|
|
22693
|
+
...new Set(targets.flatMap((target) => path32.relative(UNKNOWN_VAR, path32.resolve(target)).split(path32.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
|
|
22694
|
+
];
|
|
22702
22695
|
var literalForm = (command, refs) => {
|
|
22703
22696
|
let text = command;
|
|
22704
|
-
for (const ref of refs) {
|
|
22697
|
+
for (const ref of refs.filter((one) => /^[$`]/.test(one))) {
|
|
22705
22698
|
const placeholder = `<absolute path of ${ref}>`;
|
|
22706
22699
|
const name = /^\$(\w+)$/.exec(ref)?.[1];
|
|
22707
22700
|
text = name ? text.replace(new RegExp(`\\$\\{${name}[^}]*\\}|\\$${name}(?!\\w)`, "g"), placeholder) : text.replaceAll(ref, placeholder);
|
|
22708
22701
|
}
|
|
22709
22702
|
return text.length > 600 ? `${text.slice(0, 600)}…` : text;
|
|
22710
22703
|
};
|
|
22711
|
-
var unknownVarDeny = (input,
|
|
22712
|
-
const refs =
|
|
22713
|
-
...new Set(targets.flatMap((target) => path32.relative(UNKNOWN_VAR, path32.resolve(target)).split(path32.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
|
|
22714
|
-
];
|
|
22704
|
+
var unknownVarDeny = (input, targets, command) => {
|
|
22705
|
+
const refs = refsOf(targets);
|
|
22715
22706
|
let text = command ?? "";
|
|
22716
22707
|
const first = [];
|
|
22717
22708
|
const named = refs.map((ref) => {
|
|
22718
22709
|
const name = /^\$(\w+)$/.exec(ref)?.[1];
|
|
22719
|
-
const set = name ? new RegExp(`(^|[\\s;&|(])${name}=("?)(\\$\\([^()]*\\)|\`[^\`]*\`)\\2[ \\t]*(?:&&|;|\\n)
|
|
22710
|
+
const set = name ? new RegExp(`(^|[\\s;&|(])${name}=("?)(\\$\\([^()]*\\)|\`[^\`]*\`)\\2[ \\t]*(?:&&|;|\\n|$)[ \\t]*`).exec(text) : null;
|
|
22720
22711
|
const sub = set?.[3] ?? (/^(?:\$\(|`)/.test(ref) ? ref : null);
|
|
22721
22712
|
if (sub === null)
|
|
22722
22713
|
return ref;
|
|
@@ -22725,15 +22716,8 @@ var unknownVarDeny = (input, worktree, targets, command) => {
|
|
|
22725
22716
|
first.push(`Run \`${sub.slice(sub.startsWith("`") ? 1 : 2, -1).trim()}\` first, then`);
|
|
22726
22717
|
return sub === ref ? ref : `${ref} (set by \`${sub}\`)`;
|
|
22727
22718
|
});
|
|
22728
|
-
const
|
|
22729
|
-
|
|
22730
|
-
const retry = command === undefined || literal === command ? "" : ` ${first.length ? `${first.join(" ")} retry` : "Retry"} as: \`${literal}\`.`;
|
|
22731
|
-
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.`;
|
|
22732
|
-
return {
|
|
22733
|
-
kind: "deny",
|
|
22734
|
-
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}`,
|
|
22735
|
-
unblock
|
|
22736
|
-
};
|
|
22719
|
+
const literal = literalForm(text, refs);
|
|
22720
|
+
return deny2(`workit worktree confinement: implementer ${input.session.agentId} writes to a path built from ${named.join(", ")}, which Workit cannot resolve`, command === undefined || literal === command ? `Why: spell the path out; Workit follows only \`NAME=<literal>\`, \`$(pwd)\` and literal \`for\` words.` : first.length ? `${first.join(" ")} retry as: \`${literal}\`` : `Retry as: ${literal}`);
|
|
22737
22721
|
};
|
|
22738
22722
|
function confineImplementer(input, targets, command) {
|
|
22739
22723
|
try {
|
|
@@ -22741,7 +22725,7 @@ function confineImplementer(input, targets, command) {
|
|
|
22741
22725
|
return NONE5;
|
|
22742
22726
|
const unresolved = targets.filter((target) => within(path32.resolve(target), UNKNOWN_VAR));
|
|
22743
22727
|
if (unresolved.length > 0)
|
|
22744
|
-
return unknownVarDeny(input,
|
|
22728
|
+
return unknownVarDeny(input, unresolved, command);
|
|
22745
22729
|
if (targets.some((target) => within(path32.resolve(target), UNKNOWN_DIR)))
|
|
22746
22730
|
return unknownDirDeny(input, boundWorktree(input));
|
|
22747
22731
|
const bindings = canonical5(bindingDir());
|
|
@@ -22761,7 +22745,7 @@ function confineImplementer(input, targets, command) {
|
|
|
22761
22745
|
}
|
|
22762
22746
|
const root = canonical5(worktree);
|
|
22763
22747
|
const outside = judged.find(({ real }) => !within(real, root) || within(real, bindings));
|
|
22764
|
-
return outside ? outsideDeny(input, worktree, outside.named) : NONE5;
|
|
22748
|
+
return outside ? outsideDeny(input, worktree, outside.named, command) : NONE5;
|
|
22765
22749
|
} catch {
|
|
22766
22750
|
return NONE5;
|
|
22767
22751
|
}
|
|
@@ -22826,14 +22810,7 @@ var leadOwnedWorkit = (args) => !args.includes("--help") && args.some((_, start)
|
|
|
22826
22810
|
const [verb, sub] = skipWorkitGlobals(args.slice(start)).rest;
|
|
22827
22811
|
return verb === "fanout" && /^(?:plan|worktree)$/.test(sub ?? "");
|
|
22828
22812
|
});
|
|
22829
|
-
var leadOwnedDeny = (input, command) => {
|
|
22830
|
-
const unblock = "Worktrees, branches other than your own, refs, tags, remotes, git config, the shared stash and the fan-out plan belong to the lead: report what you need changed as a follow-up instead.";
|
|
22831
|
-
return {
|
|
22832
|
-
kind: "deny",
|
|
22833
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} may not run \`${command.slice(0, 160)}\`. ${unblock}`,
|
|
22834
|
-
unblock
|
|
22835
|
-
};
|
|
22836
|
-
};
|
|
22813
|
+
var leadOwnedDeny = (input, command) => deny2(`workit worktree confinement: implementer ${input.session.agentId} may not run \`${command.slice(0, 160)}\``, "Why: worktrees, other branches, refs, remotes, git config, the stash and the fan-out plan belong to the lead: a follow-up.");
|
|
22837
22814
|
function confineImplementerShell(input, command, dialect = "posix") {
|
|
22838
22815
|
try {
|
|
22839
22816
|
if (!input.session.agentId || hostIsolated(input.cwd, input.session.agentId))
|
|
@@ -22843,6 +22820,9 @@ function confineImplementerShell(input, command, dialect = "posix") {
|
|
|
22843
22820
|
} catch {}
|
|
22844
22821
|
return confineImplementer(input, shellMutationTargets(input.cwd, command, dialect, true), command);
|
|
22845
22822
|
}
|
|
22823
|
+
var LITERAL_SET = /^\s*([A-Za-z_]\w*)=(['"]?)((?:[\w@%+=:./\\-]|(?<=[^\s:=])~)*)\2[ \t]*(?:;|&&|\n)\s*/;
|
|
22824
|
+
var SPELLED = /^(?:[A-Za-z]|wt|wd|dir|repo|root|base|sha|ref|branch|file|out|scratch|worktree|WT|WD|DIR|REPO|ROOT|BASE|SHA|REF|BRANCH|FILE|OUT|SCRATCH|WORKTREE)$/;
|
|
22825
|
+
var ENV_READ = /^(?:GIT_|LD_|DYLD_|NODE_|PYTHON|PERL|RUBY|BASH|EPOCH|(?:ENV|IFS|CDPATH|PS\d|PWD|OLDPWD|REPLY|OPTARG|OPTIND|MAPFILE|S?RANDOM|SECONDS|LINENO|E?UID|PPID|_|HOSTNAME|HISTCMD)$)/;
|
|
22846
22826
|
var SCRATCH = ".workit-scratch";
|
|
22847
22827
|
var SHELL_NAMES = /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/;
|
|
22848
22828
|
var INTERPRETERS2 = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php)$/;
|
|
@@ -22960,7 +22940,8 @@ var GIT_VERBS = {
|
|
|
22960
22940
|
var: "l|",
|
|
22961
22941
|
version: "|build-options",
|
|
22962
22942
|
"ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
|
|
22963
|
-
remote: "v|verbose",
|
|
22943
|
+
remote: "v|verbose push all",
|
|
22944
|
+
"range-diff": "@d|@d creation-factor= no-dual-color left-only right-only",
|
|
22964
22945
|
config: "lz|get get-all get-regexp list local name-only null type= default=",
|
|
22965
22946
|
worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
|
|
22966
22947
|
branch: "dDmMcCfvraliu:|delete move copy force list all remotes verbose contains? merged? no-merged? points-at= show-current set-upstream-to= unset-upstream track? no-track sort= format= color? column? ignore-case create-reflog",
|
|
@@ -23046,7 +23027,7 @@ var gitKind = (args, local = () => true) => {
|
|
|
23046
23027
|
case "worktree":
|
|
23047
23028
|
return first === "list" ? "read" : /^(?:add|remove)$/.test(first) ? "write" : null;
|
|
23048
23029
|
case "remote":
|
|
23049
|
-
return !first || first === "show" && named.length === 2 && local(second, true) ? "read" : null;
|
|
23030
|
+
return !first || first === "get-url" || first === "show" && named.length === 2 && local(second, true) ? "read" : null;
|
|
23050
23031
|
case "ls-remote":
|
|
23051
23032
|
return local(first || "origin", true) ? "read" : null;
|
|
23052
23033
|
case "bisect":
|
|
@@ -23063,7 +23044,6 @@ var gitKind = (args, local = () => true) => {
|
|
|
23063
23044
|
}
|
|
23064
23045
|
return GIT_VERBS[verb].startsWith("+") ? "write" : "read";
|
|
23065
23046
|
};
|
|
23066
|
-
var JUDGE_GIT = `a judge runs git ${Object.keys(GIT_VERBS).join(" ")} with the options each documents (no abbreviations), writing only in a scratch repo; no -c, no wrapper but timeout, nice, time, command, no env but PAGER=cat, GIT_PAGER=cat, GIT_OPTIONAL_LOCKS=0, LC_*, LANG, TZ; status outside scratch needs --no-optional-locks`;
|
|
23067
23047
|
var remoteIn = (dir, name, repo) => {
|
|
23068
23048
|
const shared = path32.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo, false)?.[1] : undefined;
|
|
23069
23049
|
if (!shared)
|
|
@@ -23106,14 +23086,12 @@ var judgeGit = (command, repo, cwd, depth = 0) => {
|
|
|
23106
23086
|
why ??= `\`${word}\` is not allowed`;
|
|
23107
23087
|
let index = start < 0 ? words.length : start + 1;
|
|
23108
23088
|
let dir = "";
|
|
23109
|
-
let unlocked = lead.includes("GIT_OPTIONAL_LOCKS=0");
|
|
23110
23089
|
for (;!why && words[index]?.startsWith("-") && words[index] !== "--version"; index++) {
|
|
23111
23090
|
const word = words[index];
|
|
23112
23091
|
const flag = /^--(git-dir|work-tree)(?:=([\s\S]*))?$/.exec(word);
|
|
23113
23092
|
const value = flag?.[2] ?? (/^(?:-C|--git-dir|--work-tree)$/.test(word) ? words[++index] : "");
|
|
23114
23093
|
if (word === "-C")
|
|
23115
23094
|
dir = value;
|
|
23116
|
-
unlocked ||= word === "--no-optional-locks";
|
|
23117
23095
|
if (flag ? !literalIn(value, repo) : !/^(?:-C|-P|--no-pager|--no-optional-locks)$/.test(word))
|
|
23118
23096
|
why = `\`${word}\` is not allowed`;
|
|
23119
23097
|
}
|
|
@@ -23125,11 +23103,6 @@ var judgeGit = (command, repo, cwd, depth = 0) => {
|
|
|
23125
23103
|
const fetches = args[0] === "fetch" && plainFetch(args.slice(1)) && home && (home.workit || commonDir(home.root) === repo) && !words.some((word) => /^--[gw]/.test(word));
|
|
23126
23104
|
if (!fetches && !gitKind(args, local))
|
|
23127
23105
|
why = `\`git ${args.slice(0, 2).join(" ")}\` is not allowed`;
|
|
23128
|
-
else if (args[0] === "status" && !unlocked) {
|
|
23129
|
-
const dirs = path32.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
|
|
23130
|
-
if (!dirs?.length || !dirs.every((gitDir) => inScratch(gitDir, repo)))
|
|
23131
|
-
why = "`git status` refreshes the index outside scratch: add --no-optional-locks";
|
|
23132
|
-
}
|
|
23133
23106
|
}
|
|
23134
23107
|
const shell = /^(?:grep|egrep|rg|echo|printf|cat)$/.test(name) ? -1 : words.findIndex((word) => /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/.test(path32.basename(word)));
|
|
23135
23108
|
const scripts = [
|
|
@@ -23195,7 +23168,6 @@ var workitCalls = (command, depth = 0, aliases = new Map) => depth > 4 ? [] : co
|
|
|
23195
23168
|
at++;
|
|
23196
23169
|
return [words.slice(at + 1)];
|
|
23197
23170
|
});
|
|
23198
|
-
var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
|
|
23199
23171
|
var judgeRefusal = (command, fed, depth = 0) => {
|
|
23200
23172
|
let moved = false;
|
|
23201
23173
|
for (const segment of segmentsOf(command)) {
|
|
@@ -23217,6 +23189,9 @@ var judgeRefusal = (command, fed, depth = 0) => {
|
|
|
23217
23189
|
moved = true;
|
|
23218
23190
|
if (name === "eval" || (name === "source" || name === ".") && FED.test(args[0] ?? ""))
|
|
23219
23191
|
return unseen;
|
|
23192
|
+
const set = words.find((word) => /^(?:NODE_OPTIONS|PYTHON(?:STARTUP|PATH|HOME)|PERL5(?:OPT|LIB)|RUBY(?:OPT|LIB)|LD_\w+|DYLD_\w+|REPLY|OPTARG|OPTIND|MAPFILE|READLINE_\w+|S?RANDOM|SECONDS|LINENO|E?UID|PPID|OLDPWD|_|HOSTNAME|HISTCMD|EPOCH\w*)=/.test(word));
|
|
23193
|
+
if (set)
|
|
23194
|
+
return `\`${set.slice(0, 80)}\` sets a loader or shell-set name`;
|
|
23220
23195
|
if (SHELL_NAMES.test(name)) {
|
|
23221
23196
|
let operand;
|
|
23222
23197
|
let stdin = false;
|
|
@@ -23263,7 +23238,7 @@ var judgeRefusal = (command, fed, depth = 0) => {
|
|
|
23263
23238
|
for (const args of workitCalls(command)) {
|
|
23264
23239
|
const call = judgeVerbRefused(args);
|
|
23265
23240
|
if (call)
|
|
23266
|
-
return `\`${call}\` is not a judge's job: a judge runs only
|
|
23241
|
+
return `\`${call}\` is not a judge's job: a judge runs only read-only workit verbs`;
|
|
23267
23242
|
}
|
|
23268
23243
|
return null;
|
|
23269
23244
|
};
|
|
@@ -23285,20 +23260,31 @@ var substitutingHeredoc = (command) => {
|
|
|
23285
23260
|
}
|
|
23286
23261
|
return false;
|
|
23287
23262
|
};
|
|
23288
|
-
var judgeDeny = (input, what, target) => {
|
|
23263
|
+
var judgeDeny = (input, what, target, retry) => {
|
|
23289
23264
|
const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
|
|
23290
23265
|
const root = checkoutOf2(input.cwd)?.root;
|
|
23291
23266
|
const candidate = target ? checkoutOf2(target)?.root : undefined;
|
|
23292
|
-
const
|
|
23293
|
-
const scratch = root ? `${path32.join(root, SCRATCH)}${
|
|
23294
|
-
const
|
|
23267
|
+
const other = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? path32.join(candidate, SCRATCH) : undefined;
|
|
23268
|
+
const scratch = root ? `${path32.join(root, SCRATCH)}${other ? ` or ${other}` : ""}` : `${SCRATCH}/ at the root of the checkout you judge`;
|
|
23269
|
+
const call = root ? retry?.((other ?? path32.join(root, SCRATCH)).replaceAll("\\", "/")) : null;
|
|
23270
|
+
const unblock = call ? `Retry as: ${call}` : "Why: write only there (mkdir -p it); a fix the candidate needs is a finding (`workit finding record`).";
|
|
23295
23271
|
return {
|
|
23296
23272
|
kind: "deny",
|
|
23297
|
-
reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}.
|
|
23273
|
+
reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}.
|
|
23274
|
+
${unblock}`,
|
|
23298
23275
|
unblock
|
|
23299
23276
|
};
|
|
23300
23277
|
};
|
|
23301
|
-
|
|
23278
|
+
var movedInto = (command, cwd, target, dir) => {
|
|
23279
|
+
for (const { words, redirects } of segmentsOf(command))
|
|
23280
|
+
for (const word of [...redirects, ...path32.basename(words[0] ?? "") === "tee" ? words : []])
|
|
23281
|
+
if (path32.resolve(cwd, word) === path32.resolve(cwd, target)) {
|
|
23282
|
+
const moved = command.replace(new RegExp(`((?:>>?\\|?|\\btee(?:\\s+-a)?)\\s*)(['"]?)${word.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")}\\2(?![^\\s;&|)])`), (_, lead) => `${lead}${dir}/${path32.basename(word)}`);
|
|
23283
|
+
return moved === command ? null : moved;
|
|
23284
|
+
}
|
|
23285
|
+
return null;
|
|
23286
|
+
};
|
|
23287
|
+
function confineJudge(input, targets, placeholders = placeholdersOf(targets), command) {
|
|
23302
23288
|
try {
|
|
23303
23289
|
if (!input.session.agentId)
|
|
23304
23290
|
return NONE5;
|
|
@@ -23311,7 +23297,10 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
23311
23297
|
for (const target of targets) {
|
|
23312
23298
|
const resolved = path32.resolve(target);
|
|
23313
23299
|
if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
|
|
23314
|
-
return judgeDeny(input, "it writes to a path Workit cannot resolve
|
|
23300
|
+
return judgeDeny(input, "it writes to a path Workit cannot resolve", undefined, () => {
|
|
23301
|
+
const literal = command && literalForm(command, refsOf([target]));
|
|
23302
|
+
return literal === command ? null : literal;
|
|
23303
|
+
});
|
|
23315
23304
|
const real = canonical5(target);
|
|
23316
23305
|
const runsGit = placeholders.has(target) && /^\.workit-(?:runs-git|live-target)$/.test(path32.basename(target));
|
|
23317
23306
|
const gitDirs = runsGit ? gitDirsAt(path32.dirname(real), repo) : [];
|
|
@@ -23320,17 +23309,43 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
23320
23309
|
if (runsGit ? gitDirs.length > 0 ? gitDirs.every(scratch) : scratch(real) : scratch(real) && !inGitDir(real))
|
|
23321
23310
|
continue;
|
|
23322
23311
|
const runner = runnerAt(target);
|
|
23323
|
-
return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target);
|
|
23312
|
+
return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target, (dir) => !command || runsGit ? null : runner === null ? movedInto(command, input.cwd, target, dir) : runFrom(dir, command));
|
|
23324
23313
|
}
|
|
23325
23314
|
return NONE5;
|
|
23326
23315
|
} catch {
|
|
23327
23316
|
return NONE5;
|
|
23328
23317
|
}
|
|
23329
23318
|
}
|
|
23319
|
+
var spelledIn = (text, name, value) => text.replace(new RegExp(`\\$(?:${name}(?!\\w)|\\{${name}\\})`, "g"), () => value);
|
|
23320
|
+
var variableRefusal = (command) => {
|
|
23321
|
+
let rest = command;
|
|
23322
|
+
const sets = [];
|
|
23323
|
+
for (let set;set = LITERAL_SET.exec(rest); rest = rest.slice(set[0].length))
|
|
23324
|
+
sets.push([set[1], set[3]]);
|
|
23325
|
+
const loop = /^\s*for\s+(\w+)\s+in\s+([\w@%+=:./ \t-]*?)\s*[;\n]\s*do\s([\s\S]*?);?\s*done\s*$/.exec(rest);
|
|
23326
|
+
for (const name of [...sets.map(([one]) => one), ...loop ? [loop[1]] : []])
|
|
23327
|
+
if (new RegExp(`\\$(?:${name}(?!\\w)|\\{${name}(?![\\w}])|\\{${name}\\})(?![\\s/";&|)]|$)`).test(rest))
|
|
23328
|
+
return { why: `\`$${name}\` has a modifier, subscript or suffix Workit does not spell in` };
|
|
23329
|
+
const odd = [...sets.map(([one]) => one), ...loop ? [loop[1]] : []].find((name) => !SPELLED.test(name) || process.env[name] !== undefined || ENV_READ.test(name));
|
|
23330
|
+
const used = sets.filter(([name]) => name === odd || new RegExp(`\\$\\{?${name}(?!\\w)`).test(rest));
|
|
23331
|
+
if (used.length)
|
|
23332
|
+
return {
|
|
23333
|
+
why: odd ? `\`${odd}=\` sets a name the shell, zsh or git reads itself` : `\`$${used[0][0]}\` is a path from a variable, which Workit does not follow for a judge`,
|
|
23334
|
+
retry: used.reduce((text, [name, value]) => spelledIn(text, name, value), rest)
|
|
23335
|
+
};
|
|
23336
|
+
const items = loop?.[2].split(/\s+/).filter(Boolean) ?? [];
|
|
23337
|
+
return loop && (loop[1] === odd || new RegExp(`\\$\\{?${loop[1]}(?!\\w)`).test(loop[3])) ? {
|
|
23338
|
+
why: `\`$${loop[1]}\` is a loop variable, which Workit does not follow for a judge`,
|
|
23339
|
+
retry: items.length > 16 ? undefined : items.map((item) => spelledIn(loop[3].trim(), loop[1], item)).join("; ")
|
|
23340
|
+
} : null;
|
|
23341
|
+
};
|
|
23330
23342
|
function confineJudgeShell(input, command, dialect = "posix") {
|
|
23331
23343
|
try {
|
|
23332
23344
|
if (!input.session.agentId)
|
|
23333
23345
|
return NONE5;
|
|
23346
|
+
const variable = dialect === "posix" ? variableRefusal(command) : null;
|
|
23347
|
+
if (variable)
|
|
23348
|
+
return judgeDeny(input, variable.why, undefined, () => variable.retry);
|
|
23334
23349
|
const fed = [];
|
|
23335
23350
|
let refused;
|
|
23336
23351
|
try {
|
|
@@ -23342,8 +23357,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
23342
23357
|
const judged = checkoutOf2(input.cwd);
|
|
23343
23358
|
try {
|
|
23344
23359
|
const why = judgeGit(command, judged ? commonDir(judged.root) : null, /\b(?:cd|chdir|pushd|popd)\b/.test(command) ? null : input.cwd);
|
|
23345
|
-
|
|
23346
|
-
refused = `${why}: ${JUDGE_GIT}`;
|
|
23360
|
+
refused = why;
|
|
23347
23361
|
} catch {
|
|
23348
23362
|
refused = "Workit cannot read this command: split it into simpler ones";
|
|
23349
23363
|
}
|
|
@@ -23351,7 +23365,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
23351
23365
|
if (refused)
|
|
23352
23366
|
return judgeDeny(input, refused);
|
|
23353
23367
|
if (dialect === "posix" && substitutingHeredoc(command.replaceAll("\\\n", "")))
|
|
23354
|
-
return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')");
|
|
23368
|
+
return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')", undefined, () => command.replace(/<<(-?)[ \t]*(\w+)/g, "<<$1'$2'"));
|
|
23355
23369
|
let git = [];
|
|
23356
23370
|
try {
|
|
23357
23371
|
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)))) ? [
|
|
@@ -23362,7 +23376,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
23362
23376
|
shellMutationTargets(input.cwd, command, dialect, true),
|
|
23363
23377
|
...fed.map((body) => shellMutationTargets(input.cwd, body, "posix", true))
|
|
23364
23378
|
];
|
|
23365
|
-
return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]));
|
|
23379
|
+
return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]), command);
|
|
23366
23380
|
} catch {
|
|
23367
23381
|
return NONE5;
|
|
23368
23382
|
}
|
|
@@ -24448,9 +24462,11 @@ var ytrackGate = (cwd, command, dialect, ask) => {
|
|
|
24448
24462
|
const run = calls.length ? ` Run ${calls.join(", then ")} instead, each as its own plain call: it asks the user first.` : "";
|
|
24449
24463
|
const user = bare.length ? ask ? ` For ${bare.join(", ")}, run it as its own plain call: the host asks the user.` : ` For ${bare.join(", ")}, the user decides: ask the user, and if they agree they run it in their own terminal.` : "";
|
|
24450
24464
|
const rerun = writes.some((write) => write.gap === NOT_PLAIN.gap) ? " To get the named workit youtrack call instead, rerun the ytrack call as one plain command, with no wrapper, loop, substitution or script around it." : "";
|
|
24465
|
+
const retry = writes.find((write) => write.workit)?.workit ?? (rerun ? writes.find((write) => write.gap === NOT_PLAIN.gap)?.command : undefined);
|
|
24451
24466
|
return {
|
|
24452
24467
|
kind: "deny",
|
|
24453
|
-
reason: `${why}${run}${user}${rerun}
|
|
24468
|
+
reason: `${why}${run}${user}${rerun}${retry ? `
|
|
24469
|
+
Retry as: ${retry}` : ""}`,
|
|
24454
24470
|
unblock: writes[0]?.workit ?? null
|
|
24455
24471
|
};
|
|
24456
24472
|
};
|
package/dist/workit-hook.js
CHANGED
|
@@ -101,7 +101,7 @@ if (quiet) {
|
|
|
101
101
|
`);
|
|
102
102
|
} else {
|
|
103
103
|
try {
|
|
104
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
104
|
+
const { runCodexHook } = await import("./workit-hook-cs31z956.js");
|
|
105
105
|
await runCodexHook([payload]);
|
|
106
106
|
} catch (error) {
|
|
107
107
|
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.
|
|
3
|
+
"version": "2.12.0",
|
|
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.
|
|
45
|
-
"@workit-dev/mcp": "^2.
|
|
44
|
+
"@workit-dev/core": "^2.12.0",
|
|
45
|
+
"@workit-dev/mcp": "^2.12.0"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24"
|