@workit-dev/codex 2.18.1 → 2.20.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.
@@ -15511,6 +15511,7 @@ var workspaceConfigSchema = object({
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
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`."),
15514
+ feedback: unknown().optional().describe('`workit feedback` for this workspace: `off` hides its contract line and makes the verb refuse; `{ "account": "<login>" }` names the GitHub login it posts with; workspaces inside this one inherit it.'),
15514
15515
  liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
15515
15516
  fanout: object({
15516
15517
  tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
@@ -15553,7 +15554,10 @@ var workspaceConfigSchema = object({
15553
15554
  });
15554
15555
  var workspacesFileSchema = object({
15555
15556
  workspaces: array(workspaceConfigSchema).optional().describe("Workspace entries, each mapping a path glob to its forge, policies and grants."),
15556
- models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
15557
+ models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false)."),
15558
+ feedback: object({
15559
+ account: nonBlank.optional().describe("The GitHub login `workit feedback --post` uses when no workspace names one; never the workspace's work account by default.")
15560
+ }).passthrough().optional().describe("`workit feedback` defaults for every workspace.")
15557
15561
  }).passthrough().superRefine((file, context) => {
15558
15562
  const names = new Set;
15559
15563
  for (const [index, workspace] of (file.workspaces ?? []).entries()) {
@@ -20927,6 +20931,203 @@ function generatedByAttributes(files, paths) {
20927
20931
  return out;
20928
20932
  }
20929
20933
 
20934
+ // packages/workit-core/src/core/policy/dep-bump.ts
20935
+ var MANIFESTS = new Set(["package.json", "go.mod", "Cargo.toml", "pyproject.toml"]);
20936
+ var basename = (file) => file.slice(file.lastIndexOf("/") + 1);
20937
+ var isManifest = (file) => MANIFESTS.has(basename(file));
20938
+ var refused = (why) => ({ pins: false, bumped: 0, scripts: [], why });
20939
+ var pinned = (bumped, scripts = []) => ({
20940
+ pins: true,
20941
+ bumped,
20942
+ scripts,
20943
+ why: ""
20944
+ });
20945
+ var DEP_FIELDS = new Set([
20946
+ "dependencies",
20947
+ "devDependencies",
20948
+ "peerDependencies",
20949
+ "optionalDependencies"
20950
+ ]);
20951
+ var NPM_COMPARATOR = /^(?:[~^]|[<>]=?|=)?v?\d+(?:\.(?:\d+|x|\*)){0,2}(?:-[\da-z.-]+)?(?:\+[\da-z.-]+)?$/iu;
20952
+ function npmVersion(spec) {
20953
+ if (spec.length > 256)
20954
+ return false;
20955
+ return spec.split("||").every((set) => {
20956
+ const tokens = set.trim().replace(/([<>]=?|=|[~^])\s+/gu, "$1").split(/\s+/u);
20957
+ if (tokens.length === 3 && tokens[1] === "-")
20958
+ return NPM_COMPARATOR.test(tokens[0] ?? "") && NPM_COMPARATOR.test(tokens[2] ?? "");
20959
+ return tokens.every((token) => NPM_COMPARATOR.test(token));
20960
+ });
20961
+ }
20962
+ var HOOK_SCRIPT = /^(?:pre|post)|^(?:install|uninstall|prepare|publish|pack|version|dependencies|start|stop|restart|test)$/u;
20963
+ var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
20964
+ var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
20965
+ function packageJson(before, after) {
20966
+ let old;
20967
+ let now;
20968
+ try {
20969
+ old = JSON.parse(before);
20970
+ now = JSON.parse(after);
20971
+ } catch {
20972
+ return refused("does not parse");
20973
+ }
20974
+ if (!isRecord3(old) || !isRecord3(now))
20975
+ return refused("is no JSON object");
20976
+ let bumped = 0;
20977
+ const scripts = [];
20978
+ for (const field of new Set([...Object.keys(old), ...Object.keys(now)])) {
20979
+ const a = old[field];
20980
+ const b = now[field];
20981
+ if (same(a, b))
20982
+ continue;
20983
+ if (DEP_FIELDS.has(field)) {
20984
+ if (!isRecord3(a) || !isRecord3(b))
20985
+ return refused(`changes ${field}`);
20986
+ for (const name of new Set([...Object.keys(a), ...Object.keys(b)])) {
20987
+ if (a[name] === b[name])
20988
+ continue;
20989
+ if (!(name in a))
20990
+ return refused(`adds the dependency ${name}`);
20991
+ if (!(name in b))
20992
+ return refused(`removes the dependency ${name}`);
20993
+ const from = a[name];
20994
+ const to = b[name];
20995
+ if (typeof from !== "string" || typeof to !== "string")
20996
+ return refused(`changes ${field}.${name}`);
20997
+ if (!npmVersion(from.trim()) || !npmVersion(to.trim()))
20998
+ return refused(`changes the source of ${name}`);
20999
+ bumped += 1;
21000
+ }
21001
+ } else if (field === "scripts") {
21002
+ if (!isRecord3(a) || !isRecord3(b))
21003
+ return refused("changes scripts");
21004
+ for (const name of Object.keys(a))
21005
+ if (a[name] !== b[name])
21006
+ return refused(`changes the script ${name}`);
21007
+ for (const name of Object.keys(b)) {
21008
+ if (name in a)
21009
+ continue;
21010
+ if (HOOK_SCRIPT.test(name))
21011
+ return refused(`adds the lifecycle script ${name}`);
21012
+ if (name.startsWith("pnpm:"))
21013
+ return refused(`adds the pnpm: script ${name}`);
21014
+ const runner = Object.entries(a).find(([, command]) => typeof command === "string" && runsByGlob(command, name));
21015
+ if (runner)
21016
+ return refused(`adds the script ${name}, which the script ${runner[0]} runs by glob`);
21017
+ scripts.push(name);
21018
+ }
21019
+ } else
21020
+ return refused(`changes ${field}`);
21021
+ }
21022
+ return pinned(bumped, scripts);
21023
+ }
21024
+ function runsByGlob(command, name) {
21025
+ const tokens = command.split(/\s+/u).map((token) => token.replace(/^--filter=/u, "").replaceAll(/^["']|["']$/gu, "").replace(/^(?:npm|pnpm|yarn|bun):/u, ""));
21026
+ if (/\bpnpm\b/u.test(command) && tokens.some((token) => /^\/.+\/$/u.test(token)))
21027
+ return true;
21028
+ return tokens.filter((token) => token.includes("*")).some((glob) => new RegExp(`^${glob.split(/\*+/u).map((part) => part.replaceAll(/[.+?^${}()|[\]\\]/gu, "\\$&")).join(".*")}$`, "u").test(name));
21029
+ }
21030
+ function goDirectives(text) {
21031
+ const out = [];
21032
+ let block = null;
21033
+ for (const raw of text.split(`
21034
+ `)) {
21035
+ const indirect = /\/\/\s*indirect\s*$/u.test(raw);
21036
+ const line = raw.replace(/\/\/.*$/u, "").trim();
21037
+ if (!line)
21038
+ continue;
21039
+ if (block !== null) {
21040
+ if (line === ")")
21041
+ block = null;
21042
+ else
21043
+ out.push({ verb: block, args: line.replace(/\s+/gu, " "), indirect });
21044
+ continue;
21045
+ }
21046
+ const match = /^(\S+)\s*(.*)$/u.exec(line);
21047
+ if (!match)
21048
+ return null;
21049
+ const [, verb = "", rest = ""] = match;
21050
+ if (rest === "(")
21051
+ block = verb;
21052
+ else
21053
+ out.push({ verb, args: rest.replace(/\s+/gu, " "), indirect });
21054
+ }
21055
+ return block === null ? out : null;
21056
+ }
21057
+ var GO_VERSION = /^v\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+incompatible)?$/u;
21058
+ function goMod(before, after) {
21059
+ const old = goDirectives(before);
21060
+ const now = goDirectives(after);
21061
+ if (!old || !now)
21062
+ return refused("does not parse");
21063
+ if (old.length !== now.length)
21064
+ return refused("adds or removes a directive");
21065
+ let bumped = 0;
21066
+ for (const [index, a] of old.entries()) {
21067
+ const b = now[index];
21068
+ if (a.verb === b.verb && a.args === b.args && a.indirect === b.indirect)
21069
+ continue;
21070
+ if (a.verb !== "require" || b.verb !== "require" || a.indirect !== b.indirect)
21071
+ return refused(`changes ${a.verb}`);
21072
+ const [module, from, extra] = a.args.split(" ");
21073
+ const [moduleAfter, to, extraAfter] = b.args.split(" ");
21074
+ if (module !== moduleAfter || extra !== undefined || extraAfter !== undefined)
21075
+ return refused(`changes require ${module ?? ""}`);
21076
+ if (!GO_VERSION.test(from ?? "") || !GO_VERSION.test(to ?? ""))
21077
+ return refused(`changes the source of ${module ?? ""}`);
21078
+ bumped += 1;
21079
+ }
21080
+ return pinned(bumped);
21081
+ }
21082
+ var CARGO_TABLE = /^(?:workspace\.)?(?:target\..+\.)?(?:dev-|build-)?dependencies(?:\.[^.]+)?$/u;
21083
+ var PYPROJECT_TABLE = /^(?:project\.optional-dependencies|dependency-groups|tool\.poetry\.(?:dev-)?dependencies|tool\.poetry\.group\.[^.]+\.dependencies)$/u;
21084
+ var OTHER_SOURCE = /\b(?:git|rev|branch|tag|path|url|registry|package)\s*=|@|:\/\//u;
21085
+ var VERSION_TOKEN = /(?<=[\s"'=<>~^!,*v])\d+(?:\.\d+)*(?:[a-z]+\d*)?(?:\.(?:post|dev)\d+)?/giu;
21086
+ function tomlPins(before, after, cargo) {
21087
+ const old = before.split(`
21088
+ `);
21089
+ const now = after.split(`
21090
+ `);
21091
+ if (old.length !== now.length)
21092
+ return refused("adds or removes lines");
21093
+ let table = "";
21094
+ let inArray = false;
21095
+ let bumped = 0;
21096
+ for (const [index, a] of old.entries()) {
21097
+ const b = now[index] ?? "";
21098
+ const header = /^\s*\[\[?([^\]]+)\]\]?\s*(?:#.*)?$/u.exec(a);
21099
+ if (header) {
21100
+ table = (header[1] ?? "").replace(/\s+/gu, "");
21101
+ inArray = false;
21102
+ } else if (!cargo && table === "project" && /^\s*dependencies\s*=\s*\[\s*(?:#.*)?$/u.test(a))
21103
+ inArray = true;
21104
+ else if (inArray && /^\s*\]/u.test(a))
21105
+ inArray = false;
21106
+ if (a === b)
21107
+ continue;
21108
+ const listed = cargo ? CARGO_TABLE.test(table) : PYPROJECT_TABLE.test(table) || inArray || table === "project" && /^\s*dependencies\s*=/u.test(a);
21109
+ if (header || !listed)
21110
+ return refused(`changes line ${index + 1} outside a dependency table`);
21111
+ if (OTHER_SOURCE.test(a) || OTHER_SOURCE.test(b))
21112
+ return refused(`changes a dependency source on line ${index + 1}`);
21113
+ const key = (line) => /^\s*("?[\w.[\],-]+"?)/u.exec(line)?.[1] ?? "";
21114
+ const versionless = (line) => line.replace(VERSION_TOKEN, "V");
21115
+ const names = (line) => cargo ? "" : [...line.matchAll(/"([A-Za-z_][\w.-]*)/gu)].map((match) => match[1]).join(",");
21116
+ if (key(a) !== key(b) || names(a) !== names(b) || versionless(a) !== versionless(b))
21117
+ return refused(`changes more than a version on line ${index + 1}`);
21118
+ bumped += 1;
21119
+ }
21120
+ return pinned(bumped);
21121
+ }
21122
+ function manifestEdit(file, before, after) {
21123
+ const name = basename(file);
21124
+ if (name === "package.json")
21125
+ return packageJson(before, after);
21126
+ if (name === "go.mod")
21127
+ return goMod(before, after);
21128
+ return tomlPins(before, after, name === "Cargo.toml");
21129
+ }
21130
+
20930
21131
  // packages/workit-core/src/core/policy/substance.ts
20931
21132
  var SLASH_BLOCK = [["/*", "*/"]];
20932
21133
  var C_LIKE = { line: ["//"], block: SLASH_BLOCK, quotes: `"'` };
@@ -21245,6 +21446,483 @@ function cosmeticChange(file, before, after) {
21245
21446
  return a !== null && a === substanceOf(file, right);
21246
21447
  }
21247
21448
 
21449
+ // packages/workit-core/src/core/policy/workflow-edit.ts
21450
+ class Unparsed extends Error {
21451
+ }
21452
+ var refuse = (why) => {
21453
+ throw new Unparsed(why);
21454
+ };
21455
+ var NON_STRING = /^(?:~|null|true|false|yes|no|on|off|y|n|[-+]?(?:\d[\d_]*(?:\.\d*)?|\.\d+)(?:e[-+]?\d+)?|0x[\da-f]+|0o[0-7]+|[-+]?\.inf|\.nan)$/iu;
21456
+ var HEX_DIGITS = { x: 2, u: 4, U: 8 };
21457
+ var ESCAPES = {
21458
+ n: `
21459
+ `,
21460
+ t: "\t",
21461
+ r: "\r",
21462
+ "0": "\x00",
21463
+ '"': '"',
21464
+ "\\": "\\",
21465
+ "/": "/",
21466
+ " ": " "
21467
+ };
21468
+ var scalar = (text, string, folded = false) => ({
21469
+ kind: "scalar",
21470
+ text,
21471
+ string,
21472
+ folded
21473
+ });
21474
+ function quoted(text, start) {
21475
+ const quote = text[start];
21476
+ let out = "";
21477
+ for (let index = start + 1;index < text.length; index += 1) {
21478
+ const char = text[index] ?? "";
21479
+ if (quote === "'" && char === "'") {
21480
+ if (text[index + 1] !== "'")
21481
+ return { value: out, end: index + 1 };
21482
+ out += "'";
21483
+ index += 1;
21484
+ } else if (quote === '"' && char === '"')
21485
+ return { value: out, end: index + 1 };
21486
+ else if (quote === '"' && char === "\\") {
21487
+ const next = text[index + 1] ?? "";
21488
+ const hex = HEX_DIGITS[next];
21489
+ if (hex) {
21490
+ const digits = text.slice(index + 2, index + 2 + hex);
21491
+ if (!/^[\da-f]+$/iu.test(digits) || digits.length !== hex)
21492
+ refuse("a bad escape");
21493
+ out += String.fromCodePoint(Number.parseInt(digits, 16));
21494
+ index += 1 + hex;
21495
+ } else {
21496
+ out += ESCAPES[next] ?? refuse("an unknown escape");
21497
+ index += 1;
21498
+ }
21499
+ } else
21500
+ out += char;
21501
+ }
21502
+ return refuse("a quoted scalar spans lines");
21503
+ }
21504
+ function trailing(text, end) {
21505
+ const rest = text.slice(end);
21506
+ if (rest.trim() && !/^\s+#/u.test(rest))
21507
+ refuse("text after a value");
21508
+ }
21509
+ var INDICATOR = /^[&*!%@`|>,[\]{}?:#-]/u;
21510
+ function plain(text) {
21511
+ const value = text.replace(/\s+#.*$/u, "").trimEnd();
21512
+ if (INDICATOR.test(value) && !/^-[^\s]/u.test(value))
21513
+ refuse("an indicator starts a scalar");
21514
+ if (/:\s|:$/u.test(value))
21515
+ refuse("a mapping inside a scalar");
21516
+ return scalar(value, !NON_STRING.test(value));
21517
+ }
21518
+ function flow(text, start) {
21519
+ const close = text[start] === "[" ? "]" : "}";
21520
+ const items = [];
21521
+ const entries = new Map;
21522
+ let index = start + 1;
21523
+ const skip = () => {
21524
+ while (text[index] === " ")
21525
+ index += 1;
21526
+ };
21527
+ const element = (stops) => {
21528
+ skip();
21529
+ const char = text[index];
21530
+ if (char === '"' || char === "'") {
21531
+ const read = quoted(text, index);
21532
+ index = read.end;
21533
+ return scalar(read.value, true);
21534
+ }
21535
+ if (char === "[" || char === "{") {
21536
+ const read = flow(text, index);
21537
+ index = read.end;
21538
+ return read.node;
21539
+ }
21540
+ let end = index;
21541
+ while (end < text.length && !stops.test(text[end] ?? ""))
21542
+ end += 1;
21543
+ const value = text.slice(index, end).trim();
21544
+ index = end;
21545
+ if (!value || value.includes("#"))
21546
+ refuse("an empty or commented flow element");
21547
+ return plain(value);
21548
+ };
21549
+ for (;; ) {
21550
+ skip();
21551
+ if (index >= text.length)
21552
+ refuse("a flow collection spans lines");
21553
+ if (text[index] === close)
21554
+ return {
21555
+ node: close === "]" ? { kind: "seq", items } : { kind: "map", entries },
21556
+ end: index + 1
21557
+ };
21558
+ if (close === "]")
21559
+ items.push(element(/[,\]]/u));
21560
+ else {
21561
+ const key = element(/[:,}]/u);
21562
+ skip();
21563
+ if (text[index] !== ":" || key.kind !== "scalar")
21564
+ refuse("a flow mapping without a value");
21565
+ index += 1;
21566
+ const value = element(/[,}]/u);
21567
+ const name = key.kind === "scalar" ? key.text : "";
21568
+ if (entries.has(name))
21569
+ refuse("a duplicate key");
21570
+ entries.set(name, value);
21571
+ }
21572
+ skip();
21573
+ if (text[index] === ",")
21574
+ index += 1;
21575
+ else if (text[index] !== close)
21576
+ refuse("a malformed flow collection");
21577
+ }
21578
+ }
21579
+ var isItem = (text) => text === "-" || text.startsWith("- ");
21580
+ function splitKey(text) {
21581
+ if (text[0] === '"' || text[0] === "'") {
21582
+ const read = quoted(text, 0);
21583
+ const after = text.slice(read.end);
21584
+ const match = /^\s*:(?:\s+|$)/u.exec(after);
21585
+ return match ? { key: read.value, rest: after.slice(match[0].length) } : null;
21586
+ }
21587
+ const match = /:(?:\s|$)/u.exec(text);
21588
+ if (!match || INDICATOR.test(text))
21589
+ return null;
21590
+ const key = text.slice(0, match.index).trimEnd();
21591
+ if (!key || key.includes(" #"))
21592
+ return null;
21593
+ return { key, rest: text.slice(match.index + 1).trimStart() };
21594
+ }
21595
+
21596
+ class Reader {
21597
+ lines;
21598
+ pos = 0;
21599
+ constructor(text) {
21600
+ const normal = text.replace(/\r\n/gu, `
21601
+ `);
21602
+ if (normal.includes("\r") || normal.charCodeAt(0) === 65279)
21603
+ refuse("an odd line break or BOM");
21604
+ this.lines = normal.split(`
21605
+ `);
21606
+ const first = this.lines.findIndex((line) => line.trim() && !line.trimStart().startsWith("#"));
21607
+ if (first >= 0 && /^---\s*(?:#.*)?$/u.test(this.lines[first] ?? ""))
21608
+ this.lines[first] = "";
21609
+ }
21610
+ next() {
21611
+ while (this.pos < this.lines.length) {
21612
+ const raw = this.lines[this.pos] ?? "";
21613
+ const text = raw.trimStart();
21614
+ if (text === "" || text.startsWith("#")) {
21615
+ this.pos += 1;
21616
+ continue;
21617
+ }
21618
+ const indent = raw.length - text.length;
21619
+ if (raw.slice(0, indent).includes("\t"))
21620
+ refuse("a tab indents a line");
21621
+ if (indent === 0 && /^(?:---|\.\.\.)(?:\s|$)|^%/u.test(text))
21622
+ refuse("several documents");
21623
+ return { indent, text: text.trimEnd() };
21624
+ }
21625
+ return null;
21626
+ }
21627
+ document() {
21628
+ const root = this.block(0);
21629
+ if (this.next())
21630
+ refuse("content after the document");
21631
+ return root;
21632
+ }
21633
+ block(min) {
21634
+ const line = this.next();
21635
+ if (!line || line.indent < min)
21636
+ return scalar("", false);
21637
+ return isItem(line.text) ? this.sequence(line.indent) : this.mapping(line.indent);
21638
+ }
21639
+ mapping(indent) {
21640
+ const entries = new Map;
21641
+ for (let line = this.next();line && line.indent >= indent; line = this.next()) {
21642
+ if (line.indent > indent || isItem(line.text))
21643
+ refuse("bad indentation");
21644
+ const split = splitKey(line.text) ?? refuse("a line that is no mapping entry");
21645
+ if (entries.has(split.key))
21646
+ refuse("a duplicate key");
21647
+ this.pos += 1;
21648
+ entries.set(split.key, this.value(split.rest, indent, true));
21649
+ }
21650
+ return { kind: "map", entries };
21651
+ }
21652
+ sequence(indent) {
21653
+ const items = [];
21654
+ for (let line = this.next();line && line.indent === indent && isItem(line.text); line = this.next()) {
21655
+ const rest = line.text.slice(1).trimStart();
21656
+ const offset = indent + line.text.length - rest.length;
21657
+ if (isItem(rest))
21658
+ refuse("a sequence inside a sequence item");
21659
+ if (rest && !/^[|>[{]/u.test(rest) && splitKey(rest)) {
21660
+ this.lines[this.pos] = " ".repeat(offset) + rest;
21661
+ items.push(this.mapping(offset));
21662
+ } else {
21663
+ this.pos += 1;
21664
+ items.push(this.value(rest, indent, false));
21665
+ }
21666
+ }
21667
+ const line = this.next();
21668
+ if (line && line.indent > indent)
21669
+ refuse("bad indentation");
21670
+ return { kind: "seq", items };
21671
+ }
21672
+ value(rest, indent, inMapping) {
21673
+ if (rest === "" || rest.startsWith("#")) {
21674
+ const line = this.next();
21675
+ if (line && line.indent > indent)
21676
+ return this.block(line.indent);
21677
+ if (inMapping && line?.indent === indent && isItem(line.text))
21678
+ return this.sequence(indent);
21679
+ return scalar("", false);
21680
+ }
21681
+ let node;
21682
+ if (rest[0] === "|" || rest[0] === ">")
21683
+ return this.blockScalar(rest, indent);
21684
+ if (rest[0] === '"' || rest[0] === "'") {
21685
+ const read = quoted(rest, 0);
21686
+ trailing(rest, read.end);
21687
+ node = scalar(read.value, true);
21688
+ } else if (rest[0] === "[" || rest[0] === "{") {
21689
+ const read = flow(rest, 0);
21690
+ trailing(rest, read.end);
21691
+ node = read.node;
21692
+ } else
21693
+ node = plain(rest);
21694
+ const line = this.next();
21695
+ if (line && line.indent > indent)
21696
+ refuse("a value continues on the next line");
21697
+ return node;
21698
+ }
21699
+ blockScalar(header, indent) {
21700
+ const match = /^([|>])(?:([-+])([1-9])?|([1-9])([-+])?)?\s*(?:#.*)?$/u.exec(header);
21701
+ if (!match)
21702
+ return refuse("a bad block scalar header");
21703
+ const chomp = match[2] ?? match[5] ?? "";
21704
+ const indicator = match[3] ?? match[4];
21705
+ let column = indicator ? indent + Number(indicator) : null;
21706
+ const body = [];
21707
+ while (this.pos < this.lines.length) {
21708
+ const raw = this.lines[this.pos] ?? "";
21709
+ if (raw.trim() === "") {
21710
+ body.push(column !== null && raw.length > column ? raw.slice(column) : "");
21711
+ this.pos += 1;
21712
+ continue;
21713
+ }
21714
+ const lead = raw.length - raw.trimStart().length;
21715
+ if (column === null) {
21716
+ if (lead <= indent)
21717
+ break;
21718
+ column = lead;
21719
+ }
21720
+ if (lead < column) {
21721
+ if (lead > indent)
21722
+ refuse("an under-indented block line");
21723
+ break;
21724
+ }
21725
+ if (raw.slice(0, column).includes("\t"))
21726
+ refuse("a tab indents a line");
21727
+ body.push(raw.slice(column));
21728
+ this.pos += 1;
21729
+ }
21730
+ let end = body.length;
21731
+ while (end > 0 && body[end - 1] === "")
21732
+ end -= 1;
21733
+ const content = body.slice(0, end).join(`
21734
+ `);
21735
+ const text = chomp === "+" ? `${body.join(`
21736
+ `)}
21737
+ ` : chomp === "-" || !content ? content : `${content}
21738
+ `;
21739
+ return scalar(text, true, match[1] === ">");
21740
+ }
21741
+ }
21742
+ function parseWorkflowYaml(text) {
21743
+ try {
21744
+ return new Reader(text).document();
21745
+ } catch (error) {
21746
+ if (error instanceof Unparsed)
21747
+ return null;
21748
+ throw error;
21749
+ }
21750
+ }
21751
+ var isWorkflowFile = (file) => /^\.github\/workflows\/[^/]+\.ya?ml$/u.test(file);
21752
+ var GUARDED = new Set(["permissions", "secrets", "on", "uses", "environment", "if"]);
21753
+ var pathText = (keys) => keys.join(".").replaceAll(".[", "[");
21754
+ var WORD2 = /[\w./:@=+,-]+/uy;
21755
+ var QUOTED = /"[^"$`\\]*"/uy;
21756
+ var COMMAND = /^[\w.+][\w./+-]*$/u;
21757
+ var SHELL_STATE = new Set(". alias bg bind break builtin call caller case cd command compgen complete compopt continue coproc declare dirs disown do done elif else enable esac eval exec exit export fc fg fi for function getopts goto hash help history if in jobs kill let local logout mapfile popd pushd read readarray readonly return select set shift shopt source suspend then time times trap type typeset ulimit umask unalias unset until wait while".split(" "));
21758
+ var FALLBACK = new Set(["echo", "true"]);
21759
+ var FORM = 'more than && <command> or && (<command> || echo "<text>")';
21760
+ var OUTSIDE = '(outside plain words and "double-quoted text")';
21761
+ var COMMAND_INPUT = /(?:^|[-_])(?:commands?|cmd|script)$/iu;
21762
+ function tokens2(text) {
21763
+ const out = [];
21764
+ let index = 0;
21765
+ while (index < text.length) {
21766
+ const char = text[index] ?? "";
21767
+ if (char === " " || char === "\t")
21768
+ index += 1;
21769
+ else if (char === "(" || char === ")") {
21770
+ out.push({ op: char });
21771
+ index += 1;
21772
+ } else if ((char === "&" || char === "|") && text[index + 1] === char) {
21773
+ out.push({ op: char + char });
21774
+ index += 2;
21775
+ } else {
21776
+ const pattern = char === '"' ? QUOTED : WORD2;
21777
+ pattern.lastIndex = index;
21778
+ const match = pattern.exec(text);
21779
+ if (!match)
21780
+ return char === '"' ? 'a "quoted text" left open or holding $, a backtick or a backslash' : `the character ${char} ${OUTSIDE}`;
21781
+ index += match[0].length;
21782
+ const next = text[index] ?? " ";
21783
+ if (!" \t)&|".includes(next))
21784
+ return `the character ${next} ${OUTSIDE}`;
21785
+ out.push(char === '"' ? { quoted: match[0] } : { word: match[0] });
21786
+ }
21787
+ }
21788
+ return out;
21789
+ }
21790
+ function masking(before, appended) {
21791
+ if (appended.includes("${{"))
21792
+ return "an expression";
21793
+ if (/[\n\r]/u.test(appended))
21794
+ return "a new line";
21795
+ if (!before.trim())
21796
+ return "a command where none ran before";
21797
+ if (before.endsWith("\\"))
21798
+ return "a command after a trailing backslash";
21799
+ if (!appended.trimStart().startsWith("&&"))
21800
+ return "a command not chained with a leading &&";
21801
+ const list = tokens2(appended);
21802
+ if (typeof list === "string")
21803
+ return list;
21804
+ let index = 0;
21805
+ const op = (text) => {
21806
+ const token = list[index];
21807
+ if (!token || !("op" in token) || token.op !== text)
21808
+ return false;
21809
+ index += 1;
21810
+ return true;
21811
+ };
21812
+ const command = (names) => {
21813
+ const name = list[index];
21814
+ if (!name || !("word" in name) || !COMMAND.test(name.word))
21815
+ return FORM;
21816
+ if (names ? !names.has(name.word) : SHELL_STATE.has(name.word.toLowerCase()))
21817
+ return names ? FORM : `the shell command ${name.word}`;
21818
+ index += 1;
21819
+ for (let token = list[index];token && !("op" in token); token = list[index])
21820
+ index += 1;
21821
+ return null;
21822
+ };
21823
+ while (index < list.length) {
21824
+ if (!op("&&"))
21825
+ return FORM;
21826
+ const group = op("(");
21827
+ const bad = command() ?? (group && op("||") ? command(FALLBACK) : null);
21828
+ if (bad)
21829
+ return bad;
21830
+ if (group && !op(")"))
21831
+ return FORM;
21832
+ }
21833
+ return null;
21834
+ }
21835
+ function compare(before, after, at, room, out) {
21836
+ if (before.kind === "scalar" && after.kind === "scalar") {
21837
+ if (before.text === after.text && before.string === after.string)
21838
+ return;
21839
+ const grown = room !== null && before.string && after.string && before.folded === after.folded && after.text.length > before.text.length && after.text.startsWith(before.text);
21840
+ const masks = grown ? masking(before.text, after.text.slice(before.text.length)) : null;
21841
+ if (masks)
21842
+ out.refused.push({ path: at, what: `appends ${masks} to ${pathText(at)}` });
21843
+ else if (grown)
21844
+ out.allowed.push(`${pathText(at)} appended`);
21845
+ else
21846
+ out.refused.push({ path: at, what: `changes ${pathText(at)}` });
21847
+ return;
21848
+ }
21849
+ if (before.kind === "seq" && after.kind === "seq") {
21850
+ if (before.items.length !== after.items.length) {
21851
+ const fewer = after.items.length < before.items.length;
21852
+ const noun = at.at(-1) === "steps" ? "a step" : "an item";
21853
+ out.refused.push({
21854
+ path: at,
21855
+ what: `${fewer ? "removes" : "adds"} ${noun} ${fewer ? "from" : "to"} ${pathText(at)}`
21856
+ });
21857
+ return;
21858
+ }
21859
+ before.items.forEach((item, index) => compare(item, after.items[index], [...at, `[${index}]`], null, out));
21860
+ return;
21861
+ }
21862
+ if (before.kind === "map" && after.kind === "map") {
21863
+ const step = at.at(-2) === "steps";
21864
+ const job = at.length === 2 && at[0] === "jobs";
21865
+ const usesBoth = before.entries.has("uses") && after.entries.has("uses");
21866
+ for (const [key, value] of before.entries) {
21867
+ const next = after.entries.get(key);
21868
+ if (!next) {
21869
+ out.refused.push({
21870
+ path: [...at, key],
21871
+ what: at.length === 1 && at[0] === "jobs" ? `removes the job ${key}` : `removes ${pathText([...at, key])}`
21872
+ });
21873
+ continue;
21874
+ }
21875
+ if (key === "with" && job && usesBoth && value.kind === "map" && next.kind === "map")
21876
+ compareInputs(value, next, [...at, key], out);
21877
+ else
21878
+ compare(value, next, [...at, key], key === "run" && step ? "run" : null, out);
21879
+ }
21880
+ for (const [key] of after.entries)
21881
+ if (!before.entries.has(key))
21882
+ out.refused.push({ path: [...at, key], what: `adds ${pathText([...at, key])}` });
21883
+ return;
21884
+ }
21885
+ out.refused.push({ path: at, what: `changes the shape of ${pathText(at) || "the file"}` });
21886
+ }
21887
+ function compareInputs(before, after, at, out) {
21888
+ for (const [key, value] of before.entries) {
21889
+ const next = after.entries.get(key);
21890
+ if (next)
21891
+ compare(value, next, [...at, key], COMMAND_INPUT.test(key) ? "with" : null, out);
21892
+ else
21893
+ out.refused.push({ path: [...at, key], what: `removes ${pathText([...at, key])}` });
21894
+ }
21895
+ for (const [key] of after.entries)
21896
+ if (!before.entries.has(key))
21897
+ out.refused.push({ path: [...at, key], what: `adds the input ${pathText([...at, key])}` });
21898
+ }
21899
+ function decisive(refused) {
21900
+ for (const change of refused) {
21901
+ const key = change.path.find((part) => GUARDED.has(part));
21902
+ if (key === "uses")
21903
+ return `moves a uses: ref (${pathText(change.path)})`;
21904
+ if (key)
21905
+ return `changes ${key}: (${pathText(change.path)})`;
21906
+ }
21907
+ return (refused.find((change) => change.what.startsWith("removes")) ?? refused[0])?.what ?? "changes it";
21908
+ }
21909
+ function workflowEdit(before, after) {
21910
+ const old = parseWorkflowYaml(before);
21911
+ const now = parseWorkflowYaml(after);
21912
+ if (!old || !now)
21913
+ return { additive: false, detail: "does not parse as plain workflow YAML" };
21914
+ const out = { allowed: [], refused: [] };
21915
+ compare(old, now, [], null, out);
21916
+ if (out.refused.length)
21917
+ return { additive: false, detail: decisive(out.refused) };
21918
+ if (!out.allowed.length)
21919
+ return { additive: false, detail: "changes only comments or layout, read as code" };
21920
+ return {
21921
+ additive: true,
21922
+ detail: out.allowed.slice(0, 3).join(", ") + (out.allowed.length > 3 ? ", …" : "")
21923
+ };
21924
+ }
21925
+
21248
21926
  // packages/workit-core/src/core/policy/lane.ts
21249
21927
  var LANE_THRESHOLDS = {
21250
21928
  selfMaxLines: 100,
@@ -21305,15 +21983,16 @@ var DOC_EXT = /\.(?:md|mdx|markdown|rst|adoc)$/iu;
21305
21983
  var DOC_NAMES = /^(?:license|licence|notice|authors|changelog|changes|contributors)$/iu;
21306
21984
  var INSTRUCTIONS = /(?:^|\/)(?:AGENTS|CLAUDE|GEMINI|SKILL)\.md$|(?:^|\/)(?:skills|agents|commands|rules|prompts)\/[^/]+/iu;
21307
21985
  var TEST_PATH = /(?:^|\/)(?:test|tests|__tests__)\/|\.(?:test|spec)\.[^/]+$|_test\.[^/]+$/iu;
21986
+ var DEPENDENCY_BUMP_EVIDENCE = "green CI on the head";
21308
21987
  var plural = (count, noun) => `${count} ${noun}${count === 1 ? "" : "s"}`;
21309
- var basename = (file) => file.slice(file.lastIndexOf("/") + 1);
21310
- var isDoc = (file) => !INSTRUCTIONS.test(file) && (DOC_EXT.test(file) || DOC_NAMES.test(basename(file)));
21988
+ var basename2 = (file) => file.slice(file.lastIndexOf("/") + 1);
21989
+ var isDoc = (file) => !INSTRUCTIONS.test(file) && (DOC_EXT.test(file) || DOC_NAMES.test(basename2(file)));
21311
21990
  function kindOf(file) {
21312
21991
  if (file.binary)
21313
21992
  return "behavior";
21314
21993
  if (file.generated)
21315
21994
  return "generated";
21316
- if (LOCKFILES.has(basename(file.path)))
21995
+ if (LOCKFILES.has(basename2(file.path)))
21317
21996
  return "lockfile";
21318
21997
  if (isDoc(file.path))
21319
21998
  return "doc";
@@ -21346,7 +22025,7 @@ function globMatch(pattern, file) {
21346
22025
  function isRiskPath(file, extra = []) {
21347
22026
  if (extra.some((pattern) => globMatch(pattern, file)))
21348
22027
  return true;
21349
- if (RISK_FILES.has(file) || RISK_NAMES.has(basename(file)))
22028
+ if (RISK_FILES.has(file) || RISK_NAMES.has(basename2(file)))
21350
22029
  return true;
21351
22030
  if (TEST_PATH.test(file) || isDoc(file))
21352
22031
  return false;
@@ -21354,8 +22033,41 @@ function isRiskPath(file, extra = []) {
21354
22033
  }
21355
22034
  var parseRiskPaths = (text) => text.split(`
21356
22035
  `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map((line) => line.replace(/^\//u, ""));
22036
+ function additiveWorkflow(file, extra) {
22037
+ if (file.workflow?.additive !== true || file.binary || !isWorkflowFile(file.path))
22038
+ return false;
22039
+ if (extra.some((pattern) => globMatch(pattern, file.path)))
22040
+ return false;
22041
+ return !isRiskPath(file.path.replace(/^\.github\/workflows\//u, ".github/"), extra);
22042
+ }
22043
+ var ADDITIVE_CI_FLOOR = "an additive workflow edit needs a non-author verdict unless it rides a dependency bump";
22044
+ var CHANGELOG = /^(?:changelog|changes)(?:\.[^.]+)?$/iu;
22045
+ function dependencyBump(files, additive) {
22046
+ const manifests = files.filter((file) => file.manifest?.pins && !file.binary);
22047
+ if (!manifests.some((file) => (file.manifest?.bumped ?? 0) > 0))
22048
+ return null;
22049
+ const locks = [];
22050
+ for (const file of files) {
22051
+ if (additive.has(file.path) || manifests.includes(file))
22052
+ continue;
22053
+ if (LOCKFILES.has(basename2(file.path)))
22054
+ locks.push(file.path);
22055
+ else if (file.binary || !(isDoc(file.path) && CHANGELOG.test(basename2(file.path))))
22056
+ return null;
22057
+ }
22058
+ const bumped = manifests.reduce((sum, file) => sum + (file.manifest?.bumped ?? 0), 0);
22059
+ const scripts = manifests.flatMap((file) => file.manifest?.scripts ?? []);
22060
+ const list = (paths) => `${paths.slice(0, 3).join(", ")}${paths.length > 3 ? ", …" : ""}`;
22061
+ return `dependency-bump: ${plural(bumped, "version pin")} in ${list(manifests.map((file) => file.path))}${scripts.length ? `, ${plural(scripts.length, "new script")} (${list(scripts)})` : ""}${locks.length ? `, lockfile ${list(locks)}` : ""}; ${DEPENDENCY_BUMP_EVIDENCE} is its evidence`;
22062
+ }
21357
22063
  function computeLane(input) {
21358
- const riskFiles = input.files.filter((file) => isRiskPath(file.path, input.riskPaths)).map((file) => file.path);
22064
+ const extra = input.riskPaths ?? [];
22065
+ const additive = input.files.filter((file) => additiveWorkflow(file, extra));
22066
+ const relaxed = new Set(additive.map((file) => file.path));
22067
+ const workflowNote = additive.length ? [
22068
+ `additive workflow edit: ${additive.slice(0, 3).map((file) => `${file.path} (${file.workflow?.detail ?? ""})`).join(", ")}${additive.length > 3 ? ", …" : ""}`
22069
+ ] : [];
22070
+ const riskFiles = input.files.filter((file) => isRiskPath(file.path, extra) && !relaxed.has(file.path)).map((file) => file.path);
21359
22071
  const risky = new Set(riskFiles);
21360
22072
  const kinds = input.files.map((file) => ({
21361
22073
  file,
@@ -21366,20 +22078,30 @@ function computeLane(input) {
21366
22078
  const opaque = behavior.filter((entry) => entry.kind === "lockfile" || entry.file.binary);
21367
22079
  const diffLines = input.files.reduce((sum, file) => sum + file.added + file.deleted, 0);
21368
22080
  const counted = diffLines === lines && input.files.length === behavior.length ? "" : ` counted (the whole diff is ${plural(diffLines, "line")} in ${plural(input.files.length, "file")}; docs, comments, formatting, generated copies and lockfile lines are not counted)`;
21369
- const result = (lane, reasons) => ({
21370
- lane,
21371
- reasons,
21372
- lines,
21373
- files: behavior.length,
21374
- riskFiles
21375
- });
22081
+ const result = (lane, reasons, classification) => {
22082
+ const floor = additive.length > 0 && !classification && (lane === "none" || lane === "self");
22083
+ return {
22084
+ lane: floor ? "focused" : lane,
22085
+ reasons: [...floor ? [ADDITIVE_CI_FLOOR] : [], ...reasons, ...workflowNote],
22086
+ lines,
22087
+ files: behavior.length,
22088
+ riskFiles,
22089
+ ...classification ? { classification } : {}
22090
+ };
22091
+ };
21376
22092
  const { selfMaxLines, selfMaxFiles, fullMinLines } = LANE_THRESHOLDS;
21377
22093
  if (input.riskTier === "high")
21378
22094
  return result("full", ["the task judgment records high risk"]);
21379
22095
  if (riskFiles.length)
21380
22096
  return result("full", [
21381
- `touches a risk path: ${riskFiles.slice(0, 3).join(", ")}${riskFiles.length > 3 ? ", …" : ""}`
22097
+ `touches a risk path: ${riskFiles.slice(0, 3).map((file) => {
22098
+ const refused = input.files.find((entry) => entry.path === file)?.workflow;
22099
+ return refused && !refused.additive ? `${file} (${refused.detail})` : file;
22100
+ }).join(", ")}${riskFiles.length > 3 ? ", …" : ""}`
21382
22101
  ]);
22102
+ const bump = dependencyBump(input.files, relaxed);
22103
+ if (bump && lines < fullMinLines)
22104
+ return result("self", [bump], "dependency-bump");
21383
22105
  if (!behavior.length)
21384
22106
  return result("none", [
21385
22107
  input.files.length ? "only docs, comments, formatting or generated copies changed" : "no changes"
@@ -21426,6 +22148,7 @@ function cosmeticFiles(cwd, fork, head) {
21426
22148
  return null;
21427
22149
  const out = new Set;
21428
22150
  const opaque = new Set;
22151
+ const facts = new Map;
21429
22152
  for (const entry of candidates) {
21430
22153
  const before = blobs.get(entry.oldBlob);
21431
22154
  let after = blobs.get(entry.newBlob);
@@ -21435,12 +22158,20 @@ function cosmeticFiles(cwd, fork, head) {
21435
22158
  } catch {
21436
22159
  after = undefined;
21437
22160
  }
22161
+ if (before && after && isWorkflowFile(entry.path))
22162
+ facts.set(entry.path, {
22163
+ workflow: workflowEdit(before.toString("utf8"), after.toString("utf8"))
22164
+ });
22165
+ else if (before && after && isManifest(entry.path))
22166
+ facts.set(entry.path, {
22167
+ manifest: manifestEdit(entry.path, before.toString("utf8"), after.toString("utf8"))
22168
+ });
21438
22169
  if (before && after && cosmeticChange(entry.path, before, after))
21439
22170
  out.add(entry.path);
21440
22171
  else if ([before, after].some((bytes) => bytes && hasOpaqueLineBreak(bytes.toString("utf8"))))
21441
22172
  opaque.add(entry.path);
21442
22173
  }
21443
- return { cosmetic: out, opaque };
22174
+ return { cosmetic: out, opaque, facts };
21444
22175
  }
21445
22176
  function generatedAt(cwd, fork, paths) {
21446
22177
  const files = treeFilesNamed(cwd, fork, ".gitattributes");
@@ -21465,7 +22196,8 @@ function laneFiles(cwd, fork, head, attributesAt = fork) {
21465
22196
  ...stats.map((entry) => ({
21466
22197
  ...entry,
21467
22198
  ...cosmetic.opaque.has(entry.path) ? { binary: true } : {},
21468
- cosmetic: !entry.binary && cosmetic.cosmetic.has(entry.path)
22199
+ cosmetic: !entry.binary && cosmetic.cosmetic.has(entry.path),
22200
+ ...cosmetic.facts.get(entry.path)
21469
22201
  })),
21470
22202
  ...head === null ? untrackedFiles(cwd).map((file) => untrackedStat(cwd, file)) : []
21471
22203
  ];
@@ -21928,10 +22660,10 @@ function observedRowBytes(row) {
21928
22660
  function appendObserved(cwd, row, options = {}) {
21929
22661
  return appendRaw(cwd, { ...row, observer: "workit_cli" }, options);
21930
22662
  }
21931
- var isRecord3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
22663
+ var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
21932
22664
  var str2 = (value) => typeof value === "string" ? value : null;
21933
22665
  var normalizeActor = (value) => {
21934
- const actor = isRecord3(value) ? value : {};
22666
+ const actor = isRecord4(value) ? value : {};
21935
22667
  return {
21936
22668
  host: str2(actor.host) ?? "unknown",
21937
22669
  session: str2(actor.session),
@@ -21995,7 +22727,7 @@ function readLedgerAt(cwd, file, options) {
21995
22727
  skipped += 1;
21996
22728
  continue;
21997
22729
  }
21998
- if (!isRecord3(parsed) || !str2(parsed.id) || !str2(parsed.type) || !str2(parsed.at)) {
22730
+ if (!isRecord4(parsed) || !str2(parsed.id) || !str2(parsed.type) || !str2(parsed.at)) {
21999
22731
  skipped += 1;
22000
22732
  continue;
22001
22733
  }
@@ -23901,6 +24633,7 @@ effect before a retry.
23901
24633
  Mid-task: never silently drop or resume an objective (workit-continue).
23902
24634
  Notes, drafts, logs, resume files: \`workit dir notes|handoffs\` (outside the
23903
24635
  repo), never the repo tree.
24636
+ FEEDBACK_LINE
23904
24637
 
23905
24638
  Skills: load the skill, never act from memory.
23906
24639
  - brainstorm, plan, spec, grill, should we: workit-shape
@@ -30567,7 +31300,8 @@ var WORKIT_USER_ONLY = [
30567
31300
  ["install"],
30568
31301
  ["workspace", "seal"]
30569
31302
  ];
30570
- var USER_ONLY_WORD = new RegExp(`\\b(?:${[...new Set(WORKIT_USER_ONLY.map((words) => words[0]))].join("|")})\\b`);
31303
+ var WORKIT_ASKED_VERBS = ["feedback"];
31304
+ var USER_ONLY_WORD = new RegExp(`\\b(?:${[...new Set([...WORKIT_USER_ONLY.map((words) => words[0]), ...WORKIT_ASKED_VERBS])].join("|")})\\b`);
30571
31305
  var ALLOWED = new Set(WORKIT_ALLOWED_VERBS);
30572
31306
  // packages/workit-core/src/core/heavy-rules.ts
30573
31307
  var EFFECTS = new Set(["allow", "ask", "deny"]);
@@ -30860,7 +31594,7 @@ var READERS = new Set("cat sed head tail less more bat nl get-content gc type".s
30860
31594
  // packages/workit-core/src/hooks/hosts/fields.ts
30861
31595
  import { existsSync as existsSync16, realpathSync as realpathSync11, statSync as statSync5 } from "node:fs";
30862
31596
  import path35 from "node:path";
30863
- var isRecord4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
31597
+ var isRecord5 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
30864
31598
  var nonEmpty2 = (value) => typeof value === "string" && value.trim() !== "";
30865
31599
  var optionalText = (value) => typeof value === "string" ? value : null;
30866
31600
  var existingDirectory = (value) => {
@@ -30917,7 +31651,7 @@ var isWriteTool = (name) => typeof name === "string" && WRITE_TOOLS.has(name.toL
30917
31651
  var PATH_KEYS = ["file_path", "filePath", "notebook_path", "path", "target_file", "file"];
30918
31652
  var PATCH_HEADER = /^[ \t]*\*\*\* (?:(?:Add|Update|Delete) File|Move to): (.+)$/gm;
30919
31653
  var writePaths = (input) => {
30920
- if (!isRecord4(input))
31654
+ if (!isRecord5(input))
30921
31655
  return [];
30922
31656
  const paths = PATH_KEYS.map((key) => input[key]).filter(nonEmpty2);
30923
31657
  for (const value of Object.values(input))
@@ -31178,7 +31912,7 @@ var SHELL_TOOLS2 = new Set(["bash", "unified-exec"]);
31178
31912
  var isShellTool = (name) => SHELL_TOOLS2.has(String(name).toLowerCase());
31179
31913
  var SOURCES2 = new Set(["startup", "resume", "clear", "compact", "fork"]);
31180
31914
  var parseCodexHookInput = (value) => {
31181
- if (!isRecord4(value) || !Object.hasOwn(EVENTS, String(value.hook_event_name)))
31915
+ if (!isRecord5(value) || !Object.hasOwn(EVENTS, String(value.hook_event_name)))
31182
31916
  return { ok: false, error: "hook_event_name is required" };
31183
31917
  const event = value.hook_event_name;
31184
31918
  const cwd = existingDirectory(value.cwd);
@@ -31187,7 +31921,7 @@ var parseCodexHookInput = (value) => {
31187
31921
  const toolEvent = event === "PreToolUse" || event === "PostToolUse";
31188
31922
  if (toolEvent && !nonEmpty2(value.tool_name))
31189
31923
  return { ok: false, error: "tool_name is required" };
31190
- const command = isRecord4(value.tool_input) ? commandText(value.tool_input.command) : null;
31924
+ const command = isRecord5(value.tool_input) ? commandText(value.tool_input.command) : null;
31191
31925
  if (toolEvent && isShellTool(value.tool_name) && !command)
31192
31926
  return { ok: false, error: "tool_input.command is required for shell tools" };
31193
31927
  if (event === "SubagentStart" && !nonEmpty2(value.agent_id))
@@ -31302,7 +32036,7 @@ var codexAdapter = {
31302
32036
  const host = detectCodexSurface(env);
31303
32037
  const parsed = parseCodexHookInput(raw);
31304
32038
  if (!parsed.ok) {
31305
- const native = isRecord4(raw) && Object.hasOwn(EVENTS, String(raw.hook_event_name)) ? raw.hook_event_name : null;
32039
+ const native = isRecord5(raw) && Object.hasOwn(EVENTS, String(raw.hook_event_name)) ? raw.hook_event_name : null;
31306
32040
  return { ok: false, error: parsed.error, native, event: native ? EVENTS[native] : null };
31307
32041
  }
31308
32042
  const input = parsed.data;