@workit-dev/codex 2.25.1 → 2.25.3

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "2.25.1",
3
+ "version": "2.25.3",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -32137,6 +32137,9 @@ var PIDS = new Map;
32137
32137
  var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
32138
32138
  var PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs", "busybox"]);
32139
32139
  var SCRIPT_SHELLS = new Set(["sh", "bash", "zsh", "dash", "ksh"]);
32140
+ var PY_WHOLE = new Set("json re math collections itertools functools datetime time hashlib base64 glob fnmatch csv io string textwrap statistics difflib shlex pprint typing ast tomllib configparser pathlib urllib.parse xml.etree.ElementTree os.path".split(" "));
32141
+ var NODE_WHOLE = new Set("path os url util crypto assert zlib querystring readline buffer".split(" "));
32142
+ var REASONS = new WeakMap;
32140
32143
  var cache3 = new Map;
32141
32144
  var MUTATING_GIT = new Set([
32142
32145
  "add",
@@ -10965,7 +10965,7 @@ function verdictCommand(options) {
10965
10965
  const kind = options.judge === "verifier" ? "<live|unit>" : options.judge === "reviewer" ? "review" : "<live|unit|review>";
10966
10966
  return [
10967
10967
  "workit ledger verdict <verified|failed|blocked>",
10968
- options.cwd ? `--cwd ${shellQuote(options.cwd)}` : null,
10968
+ `--cwd ${options.cwd ? shellQuote(options.cwd) : "<candidate worktree>"}`,
10969
10969
  `--kind ${kind}`,
10970
10970
  `--branch ${options.branch ?? "<branch>"}`,
10971
10971
  options.session ? `--session ${options.session}` : null,
@@ -14258,6 +14258,10 @@ var segmentsOf = (command, dialect = "posix") => {
14258
14258
  return [{ words: [], redirects: [], unanalyzable: why }];
14259
14259
  }
14260
14260
  };
14261
+ var afterEnv = (words) => {
14262
+ const at = words.map((word) => word.split(/[\\/]/).at(-1)).lastIndexOf("env");
14263
+ return at >= 0 && words.slice(at + 1).every((word, index, rest) => /^-|=/.test(word) || /^-[^-]*[uCS]$|^--(?:unset|chdir|split-string)$/.test(rest[index - 1] ?? ""));
14264
+ };
14261
14265
  var tokenize = (command, dialect) => {
14262
14266
  const posix = dialect === "posix";
14263
14267
  const segments = [];
@@ -14285,6 +14289,8 @@ var tokenize = (command, dialect) => {
14285
14289
  (current.inputs ??= []).push(text);
14286
14290
  else {
14287
14291
  const at = current.words.length;
14292
+ if (/^[^=-][^=]*=/.test(word) && afterEnv(current.words))
14293
+ word = word.replace(/^[^=]*/, (name) => name.replace(/\W/g, "_"));
14288
14294
  current.words.push(...MARKERS.test(word) ? expandBraces(word) : [word]);
14289
14295
  if (expanding || !posix && word.startsWith("@"))
14290
14296
  (current.expands ??= []).push(...current.words.slice(at).map((_, i) => at + i));
@@ -14547,7 +14553,7 @@ var stripPrefixes = (input) => {
14547
14553
  const first = words[0];
14548
14554
  if (first === undefined)
14549
14555
  return { words, env };
14550
- const assignment = ASSIGNMENT2.exec(first);
14556
+ const assignment = ASSIGNMENT2.exec(first.replace(/^(\w+)\+=/, "$1="));
14551
14557
  if (assignment) {
14552
14558
  if (GIT_CONFIG_ENV.test(assignment[1]))
14553
14559
  env[assignment[1]] = assignment[2];
@@ -15073,7 +15079,7 @@ function simpleCommand(command, dialect = "posix", depth = 0, shaped = false) {
15073
15079
  function workitInvocations(command, dialect = "posix", depth = 0) {
15074
15080
  const found = [];
15075
15081
  for (const { words } of segmentsOf(command, dialect)) {
15076
- const at = words.findIndex((word) => !/^\w+=/.test(word) && !LAUNCHERS.has(word));
15082
+ const at = words.findIndex((word) => !/^\w+\+?=/.test(word) && !LAUNCHERS.has(word));
15077
15083
  if (at < 0)
15078
15084
  continue;
15079
15085
  if (WORKIT_BIN.test(words[at])) {
@@ -17493,6 +17499,7 @@ import {
17493
17499
  realpathSync as realpathSync8,
17494
17500
  statSync as statSync3
17495
17501
  } from "node:fs";
17502
+ import { builtinModules } from "node:module";
17496
17503
  import os9 from "node:os";
17497
17504
  import path30 from "node:path";
17498
17505
 
@@ -17747,10 +17754,45 @@ var exempt = (cwd, root, file, plans) => {
17747
17754
  var PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs", "busybox"]);
17748
17755
  var operands = (words) => words.filter((item) => !item.startsWith("-"));
17749
17756
  var SCRIPT_SHELLS = new Set(["sh", "bash", "zsh", "dash", "ksh"]);
17757
+ var pastOptions = (words, at, takes, assigns = false) => {
17758
+ for (let operand = !takes.includes("#");; at++) {
17759
+ for (;at < words.length && /^-|^\d[\w.,-]*$|^\w+\+?=/.test(words[at]); ) {
17760
+ if (/^\w+\+?=/.test(words[at]) && !assigns)
17761
+ break;
17762
+ operand ||= /^\d/.test(words[at]);
17763
+ at += words[at].length === 2 && words[at][0] === "-" && takes.includes(words[at][1]) ? 2 : 1;
17764
+ }
17765
+ if (operand || at >= words.length)
17766
+ return at;
17767
+ operand = true;
17768
+ }
17769
+ };
17770
+ var pastLead = (input) => {
17771
+ let words = [...input];
17772
+ for (let env = false;words.length && words[0] !== "xargs"; ) {
17773
+ const [word, next = ""] = words;
17774
+ const name = word.split(/[\\/]/).at(-1) ?? "";
17775
+ const split = env ? /^(?:-[^-S]*S|--split-string=?)(.*)$/s.exec(word) : null;
17776
+ let at = 1;
17777
+ if (split)
17778
+ words = [
17779
+ ...(split[1] || next).split(/\s+/).filter(Boolean),
17780
+ ...words.slice(split[1] ? 1 : 2)
17781
+ ];
17782
+ else if (env && word.startsWith("-"))
17783
+ words = words.slice(/^-[^-]*[uC]$|^--(?:unset|chdir)$/.test(word) ? 2 : 1);
17784
+ else if (name !== "env" && WRAPPERS3[name] !== undefined)
17785
+ words = words.slice(pastOptions(words, at, WRAPPERS3[name]));
17786
+ else if (PREFIXES2.has(word) || /^\w+\+?=/.test(word))
17787
+ words = words.slice(1);
17788
+ else
17789
+ break;
17790
+ env = name === "env" || env && word.startsWith("-");
17791
+ }
17792
+ return words;
17793
+ };
17750
17794
  var wrappedScript = (input) => {
17751
- let words = input;
17752
- while (words.length && (PREFIXES2.has(words[0]) || /^\w+=/.test(words[0])))
17753
- words = words.slice(1);
17795
+ const words = pastLead(input);
17754
17796
  const tail = workitCheckTail(words);
17755
17797
  if (!tail)
17756
17798
  return null;
@@ -17762,9 +17804,7 @@ var wrappedScript = (input) => {
17762
17804
  return tail.argv.map(quoteWord2).join(" ");
17763
17805
  };
17764
17806
  var editsOf = (input) => {
17765
- let words = input;
17766
- while (words.length && (PREFIXES2.has(words[0]) || /^\w+=/.test(words[0])))
17767
- words = words.slice(1);
17807
+ const words = pastLead(input);
17768
17808
  const [verb, ...args] = words;
17769
17809
  const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase();
17770
17810
  if (!name || name === "workit" || name === "npx" && args.some((item) => /workit/.test(item)))
@@ -17844,7 +17884,9 @@ var WRAPPERS3 = {
17844
17884
  env: "uCS",
17845
17885
  nice: "n",
17846
17886
  ionice: "cnp",
17847
- timeout: "sk",
17887
+ timeout: "#sk",
17888
+ chrt: "#TPD",
17889
+ taskset: "#",
17848
17890
  stdbuf: "ioe",
17849
17891
  time: "fo",
17850
17892
  nohup: "",
@@ -17857,16 +17899,154 @@ var WRAPPERS3 = {
17857
17899
  bunx: "p"
17858
17900
  };
17859
17901
  var INTERPRETERS = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php|tsx|ts-node)$/;
17902
+ var INLINE_CODE = /^-[a-zA-Z]*[cep]$|^--(?:eval|print)(?:=|$)/;
17860
17903
  var isConfigDir = (file) => configDirs().some((dir) => canonical5(dir) === canonical5(file));
17861
17904
  var isRoot = (file) => isConfigDir(file) || /^(?:issued[^\\/]*|approvals|verdicts)$/.test(path30.relative(canonical5(resolveStateDir()), canonical5(file)));
17862
17905
  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)$/;
17863
- 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)$/;
17864
- 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)/;
17865
- var FREE_OPEN = /\bopen\w*\s*\(\s*(?:(['"])(?![rbtUwax+]*\1)[^'"]*\1|[\w.]+)?\s*(?:,\s*(?:(['"])[rbt]*\2|encoding\s*=\s*(['"])[\w-]+\3)\s*)*\)/g;
17866
- var writesIn = (text) => {
17867
- const bare = text.replace(FREE_OPEN, "").replace(/std(?:out|err)\.write|(?<![fF][rR]?)(['"])(?:\\.|(?!\1)[^\\\n])*\1/g, "");
17868
- 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));
17869
- };
17906
+ var MUTATING_CALLS = /^(?:renames?(?:Sync)?|move(?:_into)?|copy(?:2|file|tree|File|_into)?(?: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*|f?truncate(?:Sync)?|ch(?:mod|own)(?:Sync)?|touch|open(?:Sync)?|dump|save|extractall|unpack_archive|put_contents|mv|FileUtils)$/;
17907
+ var SPAWNS = /getattr|Reflect|getOwnPropertyDescriptor|FileIO|\.copy\s*\((?!\s*\))|utime|ch(?:mod|own)|\.delete\s*\(\s*\)|(?:PYTHON|NODE_)\w*\+?=|-r\b|--(?:require|import|env-file|[\w-]*loader)|\b(?:exec\w*|eval|(?:unlink|rename|remove)\w*)\b|\]\s*\(/;
17908
+ var TOKENS = /^[ \t]*(#.*|\/\/.*|\/\*[\s\S]*?\*\/)|\bopen\w*\s*\(\s*(?:(['"])(?![rbtUwax+]*\2)[^'"\\\n]*\2|[\w.]+)?\s*(?:,\s*(?:(['"])[rbt]*\3|encoding\s*=\s*(['"])[\w-]+\4)\s*)*\)|std(?:out|err)\.write|([rRbBuUfF]{0,2})('''|""")(?:\\[\s\S]|(?!\6)[\s\S])*?\6|`((?:\\[\s\S]|\$\{[^{}`]*\}|[^\\`$]|\$(?!\{))*)`|[rR]?[fF][rR]?(['"])((?:\\.|\{[^{}\n]*\}|(?!\8)[^\\\n{}])*)\8|(?<![fF][rR]?)(['"])(?:\\.|(?!\10)[^\\\n])*\10|(?<=(?:^|[^\w$.\]'"`\s]|\b(?:return|typeof|void|delete|case|in|yield|await|else|do))\s*)\/(?![*/])(?:\\.|\[(?:\\.|[^\]\\\n])*\]|[^/\\\n[])+\//gm;
17909
+ var strip = (text, python, modules = []) => text.replace(TOKENS, (token, comment, _path, _mode, _encoding, prefix, triple, template, _quote, fstring, string, at) => {
17910
+ const code = template ?? fstring;
17911
+ if (comment)
17912
+ return python || comment[0] !== "#" ? token.replace(/['"`]/g, "") : token;
17913
+ if (code !== undefined)
17914
+ return `
17915
+ ${strip(code.match(/\{[^{}]*\}/g)?.join(`
17916
+ `) ?? "", python, modules)}
17917
+ `;
17918
+ if (string && /^[\w@.:/-]+$/.test(token.slice(1, -1)) && /(?:\b(?:require|import)\s*\(\s*|\b(?:from|import)\s*)$/.test(text.slice(Math.max(0, at - 24), at)))
17919
+ return `«${modules.push(token.slice(1, -1)) - 1}»`;
17920
+ if (string || triple && !/f/i.test(prefix ?? ""))
17921
+ return "0";
17922
+ return token[0] === "o" ? "" : token[0] === "s" ? token.slice(0, 6) : token;
17923
+ });
17924
+ var PY_WHOLE = new Set("json re math collections itertools functools datetime time hashlib base64 glob fnmatch csv io string textwrap statistics difflib shlex pprint typing ast tomllib configparser pathlib urllib.parse xml.etree.ElementTree os.path".split(" "));
17925
+ var NODE_WHOLE = new Set("path os url util crypto assert zlib querystring readline buffer".split(" "));
17926
+ var FS_READS = "readFileSync readFile readdirSync readdir statSync lstatSync stat lstat existsSync accessSync realpathSync readlinkSync createReadStream promises constants";
17927
+ var MEMBERS = {
17928
+ "py os": "path getcwd listdir scandir walk stat environ getenv sep linesep",
17929
+ "py sys": "argv stdin stdout stderr exit version version_info platform path maxsize",
17930
+ "py yaml": "safe_load safe_load_all safe_dump safe_dump_all YAMLError",
17931
+ fs: FS_READS,
17932
+ "fs/promises": FS_READS,
17933
+ process: "argv env cwd exit exitCode stdout stderr stdin platform version versions hrtime",
17934
+ Bun: "file argv env version inspect"
17935
+ };
17936
+ var AMBIENT = {
17937
+ py: /__\w+__|\.\s*_|(?<![\w.])(?:compile|globals|locals|vars|setattr|delattr|breakpoint|help)(?!\w)|get_type_hints|ForwardRef|\.\s*(?:os|sys|subprocess|shutil|builtins|importlib|ctypes|posix|codecs)(?!\w)/,
17938
+ js: /__\w+__|\.\s*_|(?<![\w$.])(?:globalThis|global|module|Function|WebAssembly|Worker|Deno)(?![\w$])|[{,]\s*\[[^\]]*\]\s*:/,
17939
+ raw: /constructor|[gs]etPrototypeOf|getOwnPropertyNames|\bflags?\b/
17940
+ };
17941
+ var OUTSIDE2 = " is outside the modules Workit reads in inline code (json, re, pathlib, os.path, fs reads…)";
17942
+ var unread = (bare, modules, python, text) => {
17943
+ let why = null;
17944
+ const refuse = (what) => {
17945
+ why ??= `\`${what.trim().replace(/«(\d+)»/g, (_, at) => `'${modules[at]}'`)}\`${OUTSIDE2}`;
17946
+ return " ";
17947
+ };
17948
+ const bound = new Map;
17949
+ const members = (module) => python ? PY_WHOLE.has(module) ? "" : MEMBERS[`py ${module}`] : NODE_WHOLE.has(module) || module.endsWith(".json") ? "" : MEMBERS[module];
17950
+ const allows = (list, member) => !list || list.split(" ").includes(member);
17951
+ let rest = bare.replace(python ? /^[ \t]*#.*/gm : /^[ \t]*(?:\/\/.*|\/\*[\s\S]*?\*\/)/gm, " ");
17952
+ if (python) {
17953
+ rest = rest.replace(/(?<![\w.])from\s+([\w.]+)\s+import\s+(\*|\([\w\s,]*\)|\w+(?:\s+as\s+\w+)?(?:\s*,\s*\w+(?:\s+as\s+\w+)?)*)/g, (statement, module, list) => {
17954
+ for (const item of list.replace(/[()]/g, "").split(",")) {
17955
+ const [name, alias = name] = item.trim().split(/\s+as\s+/);
17956
+ const of = members(module);
17957
+ if (members(`${module}.${name}`) !== undefined)
17958
+ bound.set(alias, members(`${module}.${name}`));
17959
+ else if (name === "*" || of === undefined || name && !allows(of, name))
17960
+ return refuse(statement);
17961
+ }
17962
+ return " ";
17963
+ }).replace(/(?<![\w.])import\s+([\w.]+(?:\s+as\s+\w+)?(?:\s*,\s*[\w.]+(?:\s+as\s+\w+)?)*)/g, (statement, list) => {
17964
+ for (const item of list.split(",")) {
17965
+ const [module, alias] = item.trim().split(/\s+as\s+/);
17966
+ const of = members(module);
17967
+ if (of === undefined)
17968
+ return refuse(statement);
17969
+ const [top, next] = module.split(".");
17970
+ if (alias)
17971
+ bound.set(alias, of);
17972
+ else
17973
+ bound.set(top, members(top) ?? next);
17974
+ }
17975
+ return " ";
17976
+ });
17977
+ } else {
17978
+ const use = (statement, at, names, list, member) => {
17979
+ const module = modules[Number(at)].replace(/^node:/, "");
17980
+ const of = members(module);
17981
+ if (of === undefined)
17982
+ return refuse(statement);
17983
+ if (member !== undefined)
17984
+ return allows(of, member) ? " " : refuse(statement);
17985
+ for (const name of names)
17986
+ if (name && !module.endsWith(".json"))
17987
+ bound.set(name, of);
17988
+ for (const item of list?.split(",") ?? []) {
17989
+ const key = item.trim().split(/\s*(?::|\bas\b|=)\s*/)[0];
17990
+ if (key && (!/^[\w$]+$/.test(key) || !allows(of, key)))
17991
+ return refuse(statement);
17992
+ }
17993
+ return of && !names.some(Boolean) && list === undefined ? refuse(statement) : " ";
17994
+ };
17995
+ rest = rest.replace(/(?<![\w$.])import\s*(?:([\w$]+)\s*,?\s*)?(?:\*\s*as\s+([\w$]+)\s*|\{([^{}]*)\}\s*)?(?:from\s*)?«(\d+)»/g, (statement, name, all, list, at = "") => use(statement, at, [name, all], list)).replace(/(?:(?<![\w$.])(?:(?:const|let|var)\s+)?(?:([\w$]+)|\{([^{}]*)\})\s*=\s*(?:await\s+)?)?(?<![\w$.])(?:require|import)\s*\(\s*«(\d+)»\s*\)(?:\s*\.\s*([\w$]+))?/g, (statement, name, list, at = "", member) => use(statement, at, [name], list, member));
17996
+ }
17997
+ const left = /(?<![\w$.])(?:require|import|__import__)(?![\w$])[^;\n]{0,24}/.exec(rest);
17998
+ if (left)
17999
+ refuse(left[0]);
18000
+ const ambient = python ? AMBIENT.py.exec(rest) : AMBIENT.js.exec(rest) ?? AMBIENT.raw.exec(text);
18001
+ if (ambient)
18002
+ refuse(ambient[0]);
18003
+ if (!python) {
18004
+ for (const name of [...builtinModules, "Bun"])
18005
+ if (/^[A-Za-z_]\w*$/.test(name) && name !== "console" && !bound.has(name) && !NODE_WHOLE.has(name))
18006
+ bound.set(name, MEMBERS[name] ?? "-");
18007
+ }
18008
+ for (const [name, of] of bound)
18009
+ for (const use of rest.matchAll(new RegExp(`(?<![\\w$.])${name.replaceAll("$", "\\$")}(?![\\w$])(?:\\s*\\.\\s*([\\w$]+))?`, "g")))
18010
+ if (use[1] === undefined || !allows(of, use[1]))
18011
+ refuse(use[0]);
18012
+ return why;
18013
+ };
18014
+ var renames = (code) => [...code.matchAll(/\.replace\s*\(/g)].some(({ index, 0: call }) => {
18015
+ const given = [""];
18016
+ for (let at = index + call.length, depth = 0;at < code.length; at++) {
18017
+ const char = code[at];
18018
+ if (!depth && char === ")")
18019
+ break;
18020
+ if (!depth && char === ",")
18021
+ given.push("");
18022
+ else {
18023
+ depth += "([{".includes(char) ? 1 : ")]}".includes(char) ? -1 : 0;
18024
+ given[given.length - 1] += char;
18025
+ }
18026
+ }
18027
+ const used = given.map((text) => text.trim());
18028
+ if (used.length > 1 && !used.at(-1))
18029
+ used.pop();
18030
+ return !(used.length >= 2 && used.length <= 3 && used.every((text, at) => text && !text.startsWith("*") && (!/^\w+\s*=(?![=>])/.test(text) || at === 2 && /^count\s*=/.test(text))));
18031
+ });
18032
+ var callsResult = (code) => [...code.matchAll(/\)\s*\(/g)].some(({ index }) => {
18033
+ let at = index;
18034
+ for (let depth = 0;at >= 0; at--) {
18035
+ depth += code[at] === ")" ? 1 : code[at] === "(" ? -1 : 0;
18036
+ if (!depth)
18037
+ break;
18038
+ }
18039
+ return /[\w$\])]\s*$/.test(code.slice(0, Math.max(at, 0))) || !/^\(\s*(?:async\b|function\b|lambda\b|\(?[\w$,\s]*\)?\s*=>)/.test(code.slice(at));
18040
+ });
18041
+ var writesIn = (text, python = false, code = true) => {
18042
+ const modules = [];
18043
+ const bare = strip(text, python, modules);
18044
+ const spawns = SPAWNS.exec(text)?.[0];
18045
+ const word = [...bare.matchAll(/[\w$]+/g)].find(([name]) => !/^(?:append|copy)$/.test(name) && MUTATING_CALLS.test(name))?.[0];
18046
+ return spawns !== undefined ? `\`${spawns}\` may run code or change files` : /['"`]/.test(bare) || /\\[ux]/.test(text) || callsResult(bare) ? "Workit cannot read its strings or a call on a returned value" : (code ? unread(bare, modules, python, text) : null) ?? (renames(bare) ? "`.replace(` may rename a path" : word === undefined ? null : `\`${word}\` may change files`);
18047
+ };
18048
+ var REASONS = new WeakMap;
18049
+ var noted;
17870
18050
  var PATH_CALLS = /^(?:join|resolve|normalize|abspath|expanduser|expandvars|Path|PurePath|fspath)$/;
17871
18051
  var rootUse = (text, at) => {
17872
18052
  let call;
@@ -17918,11 +18098,8 @@ var scriptArgs = (verb, args) => {
17918
18098
  };
17919
18099
  var unwrapped2 = (words) => {
17920
18100
  let at = 0;
17921
- for (let takes;(takes = WRAPPERS3[words[at]?.split(/[\\/]/).at(-1) ?? ""]) !== undefined; ) {
17922
- at++;
17923
- while (at < words.length && /^-|^\w+=|^\d[\w.]*$/.test(words[at]))
17924
- at += words[at].length === 2 && words[at][0] === "-" && takes.includes(words[at][1]) ? 2 : 1;
17925
- }
18101
+ for (let takes;(takes = WRAPPERS3[words[at]?.split(/[\\/]/).at(-1) ?? ""]) !== undefined; )
18102
+ at = pastOptions(words, at + 1, takes, true);
17926
18103
  return at ? words.slice(at) : null;
17927
18104
  };
17928
18105
  var shellScript3 = (words) => {
@@ -17948,19 +18125,18 @@ var runsWriter = (words) => {
17948
18125
  const edits = editsOf(filled);
17949
18126
  return edits === null || edits.length > 0 || opaqueWrites(filled) !== null;
17950
18127
  };
17951
- var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
17952
- let words = input;
17953
- while (words.length && (PREFIXES2.has(words[0]) || /^\w+=/.test(words[0]))) {
17954
- if (words[0] === "xargs") {
17955
- let at = 1;
17956
- while (words[at]?.startsWith("-"))
17957
- at += XARGS_VALUE.test(words[at]) ? 2 : 1;
17958
- return runsWriter(words.slice(at)) ? ["."] : null;
17959
- }
17960
- words = words.slice(1);
18128
+ var opaqueWrites = (input, scriptOf = (index) => input[index], fed, loads = false) => {
18129
+ const words = pastLead(input);
18130
+ if (words[0] === "xargs") {
18131
+ let at = 1;
18132
+ while (words[at]?.startsWith("-"))
18133
+ at += XARGS_VALUE.test(words[at]) ? 2 : 1;
18134
+ return runsWriter(words.slice(at)) ? ["."] : null;
17961
18135
  }
17962
18136
  const [verb, ...args] = words;
17963
18137
  const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase();
18138
+ if (/^(?:flock|watch|ssh|parallel|script|su|runuser|strace)$/.test(name))
18139
+ return ["."];
17964
18140
  const files = operands(args);
17965
18141
  const has = (pattern) => args.some((arg) => pattern.test(arg));
17966
18142
  const listed = (named) => named.length ? named : ["."];
@@ -17987,32 +18163,70 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
17987
18163
  const end = args.findIndex((arg) => /^[-(!]/.test(arg));
17988
18164
  return writes ? listed(end < 0 ? args : args.slice(0, end)) : null;
17989
18165
  }
17990
- if (/^g?awk$/.test(name)) {
17991
- if (!has(/^-i|^--include/))
17992
- return null;
18166
+ if (/^[gmn]?awk$/.test(name)) {
17993
18167
  const named = [];
17994
- let program = !has(/^-f$|^--file/);
18168
+ const file = has(/^-f$|^--file/);
18169
+ let program;
17995
18170
  for (let index = 0;index < args.length; index++)
17996
- if (/^(?:-[ifvF]|--(?:include|file|assign|field-separator))$/.test(args[index]))
17997
- index++;
18171
+ if (/^(?:-[ifvFe]|--(?:include|file|assign|field-separator|source))$/.test(args[index]))
18172
+ program = /^-e$|^--source$/.test(args[index++]) ? args[index] : program;
17998
18173
  else if (args[index].startsWith("-"))
17999
18174
  continue;
18000
- else if (program)
18001
- program = false;
18175
+ else if (program === undefined && !file)
18176
+ program = args[index];
18002
18177
  else
18003
18178
  named.push(args[index]);
18004
- return listed(named);
18179
+ if (has(/^-i|^--include/))
18180
+ return listed(named);
18181
+ return file || /system|printf?[^;}\n]*[>|]|\|&?\s*getline/.test(program ?? "") ? [".", ...pathsIn(program ?? "")] : null;
18182
+ }
18183
+ if (name === "sed") {
18184
+ const scripts = [];
18185
+ let first;
18186
+ for (let index = 0;index < args.length; index++) {
18187
+ const arg = args[index];
18188
+ if (/^-[nErsuz]*f|^--file/.test(arg))
18189
+ return ["."];
18190
+ if (/^-[nErsuz]*e$|^--expression$/.test(arg))
18191
+ scripts.push(args[++index] ?? "");
18192
+ else if (arg.startsWith("--expression="))
18193
+ scripts.push(arg.slice(13));
18194
+ else if (/^-l$|^--line-length$/.test(arg))
18195
+ index++;
18196
+ else if (!arg.startsWith("-"))
18197
+ first ??= arg;
18198
+ }
18199
+ if (!scripts.length && first !== undefined)
18200
+ scripts.push(first);
18201
+ const writes = scripts.some((script) => /[wWe]/.test(script.replace(/s(.)(?:\\.|(?!\1)[^\\\n])*\1(?:\\.|(?!\1)[^\\\n])*\1([^;}\n]*)/g, (_, _at, flags) => /[we]/.test(flags) ? "w" : "").replace(/y(.)(?:\\.|(?!\1)[^\\\n])*\1(?:\\.|(?!\1)[^\\\n])*\1/g, "").replace(/\\(.)(?:\\.|(?!\1)[^\\\n])*\1|\/(?:\\.|[^/\\\n])*\//g, "")));
18202
+ if (writes)
18203
+ return [".", ...scripts.flatMap(pathsIn)];
18005
18204
  }
18006
18205
  const inline = (flag) => {
18007
- const at = args.findIndex((arg) => flag.test(arg));
18206
+ const codes = args.flatMap((arg, at) => flag.test(arg) ? [at] : []);
18207
+ const at = codes[0] ?? -1;
18008
18208
  if (at < 0 && (fed === undefined || !/^(?:-|\/dev\/stdin)?$/.test(scriptArgs(name, args).named ?? "")))
18009
18209
  return null;
18010
18210
  const runs = input.length - args.length - 1;
18011
- const texts = input.map((word, index) => index === runs || index < runs && !/^\w+=/.test(word) ? "" : scriptOf(index));
18012
- return /^(?:python[\d.]*|node|bun)$/.test(name) && [
18013
- at < 0 ? fed : texts[runs + at + 2],
18014
- ...texts.slice(0, runs + 1 + (at < 0 ? args.length : at))
18015
- ].every((text) => text !== undefined && text !== null && !writesIn(text)) ? null : [
18211
+ const texts = input.map((word, index) => index === runs || index < runs && !/^\w+\+?=/.test(word) ? "" : scriptOf(index));
18212
+ const joined = (index) => args[index].includes("=");
18213
+ const code = new Set(codes.map((index) => runs + index + (joined(index) ? 1 : 2)));
18214
+ const python = name.startsWith("py");
18215
+ let why = null;
18216
+ if (loads || !/^(?:python[\d.]*|node|bun)$/.test(name))
18217
+ why = "";
18218
+ const given = [
18219
+ ...at < 0 ? [fed] : [],
18220
+ ...codes.map((index) => joined(index) ? texts[runs + index + 1]?.replace(/^[^=]*=/, "") : texts[runs + index + 2])
18221
+ ];
18222
+ for (const [index, text] of [
18223
+ ...given,
18224
+ ...texts.slice(0, runs + 1 + (at < 0 || !python ? args.length : at)).filter((_, place) => !code.has(place))
18225
+ ].entries())
18226
+ why ??= text === undefined || text === null ? "Workit cannot read its code" : writesIn(text, python, index < given.length);
18227
+ if (why)
18228
+ noted ??= why;
18229
+ return why === null ? null : [
18016
18230
  ".",
18017
18231
  ...pathsIn(fed ?? ""),
18018
18232
  ...texts.flatMap((text, index) => text === undefined ? [unknownVarTarget(input[index])] : pathsIn(text))
@@ -18022,10 +18236,12 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
18022
18236
  return curlOutputs(args);
18023
18237
  if (name === "perl")
18024
18238
  return inline(/^-[a-zA-Z]*[eE]$/);
18025
- if (name.startsWith("python") && args.some((arg, at) => arg === "-m" && args[at + 1] !== "json.tool"))
18239
+ if (name.startsWith("python") && args.some((arg, at) => /^-[^-m]*m/.test(arg) && ((arg.replace(/^-[^-m]*m/, "") || args[at + 1]) !== "json.tool" || operands(args.slice(at + (arg.length > 2 ? 1 : 2))).filter((word) => !/^\d+$/.test(word)).length > 1)))
18026
18240
  return [".", ...args.flatMap(pathsIn)];
18027
- if (/^(?:python[\d.]*|node|bun|deno|ruby|php)$/.test(name))
18028
- return inline(/^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/);
18241
+ if (name === "deno" && operands(args)[0] === "eval")
18242
+ return ["."];
18243
+ if (/^(?:python[\d.]*|node|bun|deno|ruby|php|tsx|ts-node)$/.test(name))
18244
+ return inline(INLINE_CODE);
18029
18245
  return shellScript3(words) === null ? null : ["."];
18030
18246
  };
18031
18247
  var CURL_LONG = [
@@ -18351,19 +18567,25 @@ var placeholderIn = (dir, name) => {
18351
18567
  };
18352
18568
  var recording = (make) => {
18353
18569
  const outer = collecting;
18570
+ const before = noted;
18354
18571
  const found = new Set;
18355
18572
  collecting = found;
18573
+ noted = undefined;
18356
18574
  try {
18357
18575
  const targets = make();
18358
18576
  PLACEHOLDERS.set(targets, found);
18577
+ if (noted !== undefined)
18578
+ REASONS.set(targets, noted);
18359
18579
  for (const target of found)
18360
18580
  outer?.add(target);
18361
18581
  return targets;
18362
18582
  } finally {
18363
18583
  collecting = outer;
18584
+ noted = before ?? noted;
18364
18585
  }
18365
18586
  };
18366
18587
  var placeholdersOf = (targets) => PLACEHOLDERS.get(targets) ?? new Set;
18588
+ var inlineWhy = (targets) => REASONS.get(targets);
18367
18589
  var OPAQUE_TARGET = ".workit-runs-";
18368
18590
  var UNRESOLVED_TARGET = ".workit-unresolved-target";
18369
18591
  var LINK_SOURCE = ".workit-link-source";
@@ -18411,7 +18633,7 @@ var expandVars = (text, vars) => vars.size === 0 || !text.includes("$") ? text :
18411
18633
  });
18412
18634
  var DECLARERS = new Set(["export", "declare", "typeset", "local", "readonly"]);
18413
18635
  var assignmentsOf = (words) => {
18414
- const first = words.findIndex((word) => !/^\w+=/.test(word));
18636
+ const first = words.findIndex((word) => !/^\w+\+?=/.test(word));
18415
18637
  const named = first < 0 ? words : first === 0 && DECLARERS.has(words[0]) ? words.slice(1).filter((word) => !word.startsWith("-")) : [];
18416
18638
  return named.flatMap((word) => {
18417
18639
  const match = /^(\w+)=(.*)$/s.exec(word);
@@ -18497,7 +18719,7 @@ var untrustedVars = (segments) => {
18497
18719
  depth = Math.max(0, depth - 1);
18498
18720
  }
18499
18721
  const words = segment.words.slice(start);
18500
- const at = words.findIndex((word) => !/^\w+=/.test(word));
18722
+ const at = words.findIndex((word) => !/^\w+\+?=/.test(word));
18501
18723
  const ifs = (word) => /\bIFS\b/.test(word);
18502
18724
  if (segment.subs?.some(ifs) || words.some((w, i) => ifs(w) && !(i < at && words[at] === "read")))
18503
18725
  all = true;
@@ -18706,7 +18928,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18706
18928
  loops.delete(name);
18707
18929
  continue;
18708
18930
  }
18709
- const lead = body.findIndex((word) => !/^\w+=/.test(word));
18931
+ const lead = body.findIndex((word) => !/^\w+\+?=/.test(word));
18710
18932
  const words = lead < 0 ? [] : body.slice(lead);
18711
18933
  if (!segment.conditional && !untrusted.all) {
18712
18934
  for (const [key, value] of assignmentsOf(segment.words))
@@ -18761,7 +18983,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18761
18983
  moved(plain);
18762
18984
  continue;
18763
18985
  }
18764
- const literal = depth < 4 ? wrappedScript(words) ?? (strict ? shellScript3(words) : null) : null;
18986
+ const literal = depth < 4 ? wrappedScript(words) ?? (strict ? shellScript3(pastLead(words)) : null) : null;
18765
18987
  const held = literal !== null && strict === "registry" ? expansions(literal, vars, loops) : [];
18766
18988
  const inner = held.length === 1 ? held[0] : literal;
18767
18989
  const unPwd = () => new Map([...vars].filter(([key]) => key !== "PWD"));
@@ -18772,7 +18994,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18772
18994
  `)) : null;
18773
18995
  if (windows !== null && dir !== undefined)
18774
18996
  targets.push(...segmentTargets(dir, windows, "powershell", depth + 1, strict, vars));
18775
- const bare = strict === "registry" && depth < 4 ? unwrapped2(words) : null;
18997
+ const bare = strict && depth < 4 ? unwrapped2(words) : null;
18776
18998
  if (bare?.length && dir !== undefined)
18777
18999
  targets.push(...segmentTargets(dir, bare.flatMap((word) => expansions(word, vars, loops)).map(quoteWord2).join(" "), "posix", depth + 1, strict, vars));
18778
19000
  if (strict === "registry" && dir !== undefined && depth < 4) {
@@ -18815,9 +19037,9 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18815
19037
  shells.push(...read(named));
18816
19038
  shells.push(...preloads.flatMap(read));
18817
19039
  } else if (INTERPRETERS.test(verb)) {
18818
- const code = args.findIndex((arg) => /^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/.test(arg));
19040
+ const code = args.findIndex((arg) => INLINE_CODE.test(arg));
18819
19041
  if (code >= 0)
18820
- others.push(...expansions(args[code + 1] ?? "", vars, loops));
19042
+ others.push(...expansions(args[code].includes("=") ? args[code] : args[code + 1] ?? "", vars, loops));
18821
19043
  others.push(...named === undefined ? [...segment.stdin ?? [], ...inputs.flatMap(read), ...piped] : read(named), ...preloads.flatMap(read));
18822
19044
  } else if (/[\\/]/.test(run[0] ?? ""))
18823
19045
  for (const text of read(run[0]))
@@ -18868,7 +19090,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18868
19090
  return all.some((text) => unresolvedRefs(text).some(unescaped)) ? undefined : all.join(`
18869
19091
  `);
18870
19092
  };
18871
- const opaque = segment.unanalyzable ? ["."] : inner === null ? opaqueWrites(body, scriptOf, stdin && (/[$`]/.test(stdin) && /<<-?[ \t]*[^'"\\\s]/.test(command.replaceAll("\\\n", "")) ? null : stdin)) : null;
19093
+ const opaque = segment.unanalyzable ? ["."] : inner === null ? opaqueWrites(body, scriptOf, stdin && (/<<-?[ \t]*[^'"\\\s]/.test(command.replaceAll("\\\n", "")) ? /[$`]/.test(stdin) ? null : stdin.replaceAll("\\\n", "") : stdin), /\b(?:NODE_OPTIONS|PYTHON[A-Z]+)\b/.test(command)) : null;
18872
19094
  const ran = words.findIndex((word) => word === "xargs" || !PREFIXES2.has(word));
18873
19095
  const runner = words[ran];
18874
19096
  if (runner !== undefined && expanding.has(keywords + lead + ran) && unresolvedRefs(homeExpanded(runner)).length > 0)
@@ -18879,6 +19101,16 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18879
19101
  for (const resolved of atAll(file))
18880
19102
  if (!quiet || !isRoot(resolved))
18881
19103
  targets.push(file === "." ? placeholderIn(resolved, here) : path30.basename(resolved).startsWith(OPAQUE_TARGET) ? placeholderIn(path30.dirname(resolved), path30.basename(resolved)) : resolved);
19104
+ const [shell = "", ...shellArgs] = pastLead(words);
19105
+ const verb = (shell.split(/[\\/]/).at(-1) ?? "").toLowerCase();
19106
+ const named = (SCRIPT_SHELLS.has(verb) || verb === "source" || verb === ".") && shellScript3([verb, ...shellArgs]) === null ? scriptArgs(verb, shellArgs).named ?? "" : null;
19107
+ if (depth < 4 && verb === "eval")
19108
+ targets.push(...segmentTargets(runIn, shellArgs.join(" "), dialect, depth + 1, strict, vars));
19109
+ else if (named !== null && /^<\(|^\/dev\/fd\/[1-9]/.test(named))
19110
+ targets.push(placeholderIn(runIn, `${OPAQUE_TARGET}${verb}`));
19111
+ else if (depth < 4 && segment.stdin && named !== null && /^(?:-|\/dev\/stdin|\/dev\/fd\/0|\/proc\/self\/fd\/0)?$/.test(named))
19112
+ for (const script of segment.stdin)
19113
+ targets.push(...segmentTargets(runIn, script, dialect, depth + 1, strict, vars));
18882
19114
  const ln = words.findIndex((word) => /^ln$/i.test(word.split(/[\\/]/).at(-1) ?? ""));
18883
19115
  const lnArgs = words.slice(ln + 1);
18884
19116
  if (ln >= 0 && words.slice(0, ln).every((word) => PREFIXES2.has(word)) && (strict !== "registry" || !lnArgs.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg))))
@@ -20870,9 +21102,9 @@ var SCRATCH = ".workit-scratch";
20870
21102
  var SHELL_NAMES = /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/;
20871
21103
  var INTERPRETERS2 = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php)$/;
20872
21104
  var FED = /^(?:-|\/dev\/stdin|\/dev\/fd\/0|\/proc\/self\/fd\/0)$|^<\(/;
20873
- var LEADS = /^(?:sudo|doas|env|command|builtin|exec|nohup|time|nice|timeout|stdbuf|xargs|busybox|!|\{|if|then|else|elif|do|while|until|\w+=.*|[-\d].*)$/s;
21105
+ var LEADS = /^(?:sudo|doas|env|command|builtin|exec|nohup|time|nice|ionice|chrt|taskset|setsid|timeout|stdbuf|npx|bunx|xargs|busybox|!|\{|if|then|else|elif|do|while|until|\w+\+?=.*|[-\d].*)$/s;
20874
21106
  var RUNS = /^(?:sh|bash|zsh|dash|ksh|mksh|ash|python[\d.]*|node|bun|deno|ruby|perl|php|eval|source|\.|workit)$/;
20875
- var INLINE = /^-[a-zA-Z]*[ceEpm]$|^--(?:eval|print|test|version|help)$|^-[hvV]$/;
21107
+ var INLINE = /^-[a-zA-Z]*[ceEpm]$|^--(?:eval|print)(?:=|$)|^--(?:test|version|help)$|^-[hvV]$/;
20876
21108
  var VALUED2 = /^-[WXIrC]$|^--(?:require|import|loader|conditions|input-type)$/;
20877
21109
  var commonDir = (root) => gitDirsAt(root, null, false)?.[1] ?? "";
20878
21110
  var inScratch = (real, repo) => {
@@ -21232,7 +21464,7 @@ var judgeRefusal = (command, fed, depth = 0) => {
21232
21464
  moved = true;
21233
21465
  if (name === "eval" || (name === "source" || name === ".") && FED.test(args[0] ?? ""))
21234
21466
  return unseen;
21235
- 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));
21467
+ 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));
21236
21468
  if (set)
21237
21469
  return `\`${set.slice(0, 80)}\` sets a loader or shell-set name`;
21238
21470
  if (SHELL_NAMES.test(name)) {
@@ -21303,14 +21535,14 @@ var substitutingHeredoc = (command) => {
21303
21535
  }
21304
21536
  return false;
21305
21537
  };
21306
- var judgeDeny = (input, what, target, retry) => {
21538
+ var judgeDeny = (input, what, target, retry, why = "write only there (mkdir -p it); a fix the candidate needs is a finding (`workit finding record`).") => {
21307
21539
  const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
21308
21540
  const root = checkoutOf2(input.cwd)?.root;
21309
21541
  const candidate = target ? checkoutOf2(target)?.root : undefined;
21310
21542
  const other = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? path34.join(candidate, SCRATCH) : undefined;
21311
21543
  const scratch = root ? `${path34.join(root, SCRATCH)}${other ? ` or ${other}` : ""}` : `${SCRATCH}/ at the root of the checkout you judge`;
21312
21544
  const call = root ? retry?.((other ?? path34.join(root, SCRATCH)).replaceAll("\\", "/")) : null;
21313
- const unblock = call ? `Retry as: ${call}` : "Why: write only there (mkdir -p it); a fix the candidate needs is a finding (`workit finding record`).";
21545
+ const unblock = call ? `Retry as: ${call}` : `Why: ${why.replaceAll("<scratch>", other ?? (root ? path34.join(root, SCRATCH) : SCRATCH))}`;
21314
21546
  return {
21315
21547
  kind: "deny",
21316
21548
  reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}.
@@ -21327,7 +21559,7 @@ var movedInto = (command, cwd, target, dir) => {
21327
21559
  }
21328
21560
  return null;
21329
21561
  };
21330
- function confineJudge(input, targets, placeholders = placeholdersOf(targets), command) {
21562
+ function confineJudge(input, targets, placeholders = placeholdersOf(targets), command, why = inlineWhy(targets)) {
21331
21563
  try {
21332
21564
  if (!input.session.agentId)
21333
21565
  return NONE5;
@@ -21352,7 +21584,9 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets), co
21352
21584
  if (runsGit ? gitDirs.length > 0 ? gitDirs.every(scratch) : scratch(real) : scratch(real) && !inGitDir(real))
21353
21585
  continue;
21354
21586
  const runner = runnerAt(target);
21355
- 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));
21587
+ const inline = runner !== null && INTERPRETERS2.test(runner) && why ? why : undefined;
21588
+ const relative = inline !== undefined && /(?<![\w/~$.-])(?:\.{1,2}\/|[\w-]+(?:\/[\w.-]+)*\.(?:json|[cm]?[jt]sx?|py|ya?ml|toml|txt|md|lock|cfg|ini|csv|xml|html?)(?![\w(]))/.test(command ?? "");
21589
+ return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it${inline ? `, and ${inline}` : ""}`, target, (dir) => !command || runsGit || relative ? null : runner === null ? movedInto(command, input.cwd, target, dir) : runFrom(dir, command), relative ? "read with cat, jq, grep or the Read tool, or keep to json/re/pathlib/fs reads; a script that needs more goes in a file in <scratch>." : undefined);
21356
21590
  }
21357
21591
  return NONE5;
21358
21592
  } catch {
@@ -21419,7 +21653,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
21419
21653
  shellMutationTargets(input.cwd, command, dialect, true),
21420
21654
  ...fed.map((body) => shellMutationTargets(input.cwd, body, "posix", true))
21421
21655
  ];
21422
- return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]), command);
21656
+ return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]), command, lists.map(inlineWhy).find(Boolean));
21423
21657
  } catch {
21424
21658
  return NONE5;
21425
21659
  }
@@ -22893,7 +23127,6 @@ var usageLimitOnStop = (input, agentId, text) => {
22893
23127
  };
22894
23128
  var subagentSession = (session, agentId) => [session, agentId].filter((part) => Boolean(part)).join(":").replace(/[^A-Za-z0-9_.:@/+-]/g, "-").slice(0, 128);
22895
23129
  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\`).`;
22896
- var JUDGE_CWD = " Add `--cwd <candidate worktree>` when your shell is elsewhere.";
22897
23130
  var subagentStartText = (input, descriptor, event) => {
22898
23131
  const session = input.session.id ?? null;
22899
23132
  const { role, isolated, git } = agentSteering(descriptor, input.cwd, {
@@ -22921,12 +23154,12 @@ ${subagentStartText({ ...input, cwd: "" }, descriptor, event)}`;
22921
23154
  const checks = judgeChecksLine(cwd);
22922
23155
  const checksText = checks ? ` ${checks}` : "";
22923
23156
  if (descriptor.host === "codex_cli" || descriptor.host === "codex_desktop")
22924
- 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, cwd: at })}\`.${JUDGE_CWD} Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
23157
+ 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, cwd: at })}\`. Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
22925
23158
  const token = session ? recordIssuedSession(cwd, session, own) : null;
22926
23159
  if (session && !token)
22927
23160
  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.`;
22928
23161
  const line = verdictCommand({ branch, judge, session: own, token, cwd: at });
22929
- 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}`;
23162
+ 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}`;
22930
23163
  };
22931
23164
  var PRE_TOOL = new Set(["shell.pre", "write.pre", "tool.pre"]);
22932
23165
  function handleHook(input, deps) {
@@ -101,7 +101,7 @@ if (quiet) {
101
101
  `);
102
102
  } else {
103
103
  try {
104
- const { runCodexHook } = await import("./workit-hook-2et385jj.js");
104
+ const { runCodexHook } = await import("./workit-hook-sbgw8r70.js");
105
105
  await runCodexHook([payload]);
106
106
  } catch (error) {
107
107
  const { answerRuntimeFailure } = await import("./workit-hook-2j7nwxvz.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/codex",
3
- "version": "2.25.1",
3
+ "version": "2.25.3",
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.25.1",
45
- "@workit-dev/mcp": "^2.25.1"
44
+ "@workit-dev/core": "^2.25.3",
45
+ "@workit-dev/mcp": "^2.25.3"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"