@holmes-lab/holmes-kit 0.35.16 → 0.35.17

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/CHANGELOG.md CHANGED
@@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
  <!-- @implements A-SPEC-209 -->
8
+ ## [0.35.17] - 2026-10-11
9
+
10
+ ### Fixed
11
+
12
+ - **`approval_status` says what to do next and relays the operator's latest hold question** (A-SPEC-768). Measured
13
+ 2026-10-11 in the SWE-bench Sphinx 11510 comparison: a Codex worker read 58 `sealed: true` answers as "pending"
14
+ because the response carried no next action, and never saw the second question of a twice-held request because the
15
+ response reported the spec's seal only. The response now carries `request { id, state, question?, reason?, ts? }`
16
+ (pending / held / granted / consumed / denied / revoked, from the approval queue) and one `nextAction` sentence; the
17
+ pending-approval hint ends with one `Agent:` line beside the unchanged operator lines.
18
+ - **An `@implements` list joined by `;`, `|`, `&`, `/` or `and` is diagnosed, not silently truncated** (A-SPEC-768.1).
19
+ `test_run` returns `anchorDiagnostics [{ file, line, separator, dropped, hint }]` for test files whose anchor list the
20
+ comma grammar does not read; attribution itself is unchanged.
21
+ - **A Codex `apply_patch` update is applied chunk by chunk in file order, as the tool applies it** (A-SPEC-768.2). A
22
+ context line that recurs earlier in the file (`def run(self)`, eight times in the measured case) no longer makes the
23
+ patch "unreadable"; each chunk is sought at or after the previous one (exact, then white-space-loose), `@@ ctx`
24
+ headers are sought first, and a patch that genuinely does not apply is refused by a sentence naming the file and the
25
+ chunk instead of "file_path missing". Supersedes A-SPEC-163.3 rule 4.
26
+ - **A quoted or escaped glob character is not a spelling of the `.ax` store** (A-SPEC-768.3). `rg "… .* …" | … |
27
+ xargs sh -c '… "$0"'` was refused as a protected-path write because the `.*` of a quoted regex counted as a glob that
28
+ could expand to `.ax`; a shell never expands a quoted or escaped glob. `echo .* && sh -c …` stays refused.
29
+ - **The publish playbook proves the GitHub README and badge sync in the release report.** Measured 2026-10-11:
30
+ step 6 had said "sync the badge too" since 0.35.13, yet the GitHub `.ax/badges/traced.svg` still showed v0.27.0's
31
+ figure and the GitHub README stopped at v0.35.10 for six releases — a sentence nobody had to prove. The step now
32
+ requires three lines in the release report (remote sha before → after and re-read match for README and badge, or
33
+ the exact SKIP reason) and carries the one-loop command for both files.
34
+ - **The background refresh child publishes why a lane failed** (A-SPEC-768.4). The freshness receipt gains
35
+ `failure { stage, reason }` (reason bounded to 300 characters) and `refreshSemanticVectors` carries the embedder's
36
+ message as `detail`; a successful run writes no `failure`.
37
+
8
38
  ## [0.35.16] - 2026-10-08
9
39
 
10
40
  ### Added
package/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  <!-- holmes-kit:attest:begin -->
10
10
  ![traced files](.ax/badges/traced.svg)
11
11
 
12
- **448/454** source files (98.6%) trace to an approved spec · **756/819** approved A-SPECs (92.3%) are anchored from code.
13
- Measured at `13ef32c36276` (specs `sha256:613dcd17da1a`) — reproduce with `holmes-kit attest`.
12
+ **438/440** source files (99.5%) trace to an approved spec · **761/824** approved A-SPECs (92.3%) are anchored from code.
13
+ Measured at `70dcb37ccf6b` (specs `sha256:675042379d48`) — reproduce with `holmes-kit attest`.
14
14
  <!-- holmes-kit:attest:end -->
15
15
 
16
16
  ---
@@ -23,6 +23,7 @@ Measured at `13ef32c36276` (specs `sha256:613dcd17da1a`) — reproduce with `hol
23
23
 
24
24
  ### 🛡️ Currently Supported Features (Production Features)
25
25
 
26
+ - **An agent is told what to do after an approval, and a patch is judged the way the tool applies it** *(new in 0.35.17)*: five repairs measured on a Codex worker in a SWE-bench comparison. `approval_status` now carries `request { id, state, question?, reason?, ts? }` (pending / held / granted / consumed / denied / revoked, read from the approval queue, with the operator's LATEST hold question) and one `nextAction` sentence — a sealed spec says "stop polling", a held request relays the question; the pending-approval hint ends with an `Agent:` line beside the unchanged operator lines. `test_run` reports `anchorDiagnostics` for an `@implements` list joined by `;`, `|`, `&`, `/` or `and` (the comma grammar does not read them; attribution is unchanged, the omission is named). A Codex `apply_patch` update is applied chunk by chunk from the previous chunk's position, as the tool does, so a context line that recurs earlier in the file no longer makes it "unreadable", and a patch that does not apply is refused by a sentence naming the file and the chunk. A quoted or escaped glob (`rg ".*"`) is no longer read as a spelling of the `.ax` store (an unquoted `.*` still is). The background refresh child records `failure { stage, reason }` on its freshness receipt instead of failing silently.
26
27
  - **The analysis names the unchanged files a change has broken** *(new in 0.35.16)*: with `changedFiles` given, `maintenance_analyze` reports under `impacts.removedNameUsers` every unchanged file that imports a changed file and still uses a top-level name that file no longer defines (removed or renamed), and the files still importing a deleted TypeScript/JavaScript file. Deterministic and read-only; TypeScript/JavaScript and Python. Measured on public repositories: every file named was one the commit did change (22 of 22, 21 of 21). It fires rarely — 2–7% of the files an incomplete change set was missing. Member names and changed signatures are not read.
27
28
  - **The analysis names the file a change still has to create** *(new in 0.35.15)*: with `changedFiles` given, `maintenance_analyze` reports under `impacts.missingNewFiles` every relative import a changed TypeScript/JavaScript file newly introduces that resolves to nothing — the importing file, the specifier and the candidate paths. Deterministic and read-only. On two unseen windows of a public TypeScript monorepo every naming was a file the change did create (precision 1.000), covering 78–86% of the not-yet-existing files an incomplete change set was missing. Only uncommitted changes in a git repository; other languages, bare package names and path aliases are not read.
28
29
  - **ES-module TypeScript projects get their import graph** *(new in 0.35.14 — fix)*: a specifier written `./x.js` for a `x.ts` source (the ESM convention) now resolves, where it used to emit no edge at all — on a public TypeScript monorepo the graph went from 3 import edges to 4,628 of 6,854 import relations. Extensionless projects are unchanged. The cycle ratchet sees the same edges. Workspace package names are still unresolved, and the graded impact list does not yet use import edges.
package/dist/.build-id CHANGED
@@ -1 +1 @@
1
- 68181d77-muyuet0q
1
+ e14712a6-mv3zqox3
@@ -105,6 +105,24 @@ export declare function patchTargetsOf(text: string): PatchTarget[];
105
105
  * rule (below): its one place in the file, or no result.
106
106
  */
107
107
  export declare function applyPatchUpdate(original: string, hunk: string): string | null;
108
+ /**
109
+ * @implements A-SPEC-768.2
110
+ * The same application, with the reason when there is no result. Measured 2026-10-11 (SWE-bench Sphinx 11510, H0
111
+ * arm): a four-chunk Codex patch — two chunks context-only, one context line (`def run(self) -> list[Node]:`) occurring
112
+ * eight times earlier in the file — got no result under rule 4's "exactly once in the whole file", and the refusal
113
+ * said a file path was missing. The tool applies each chunk from where the previous one ended; so does this now:
114
+ * exact first, then white-space-loose, the FIRST match at or after the previous chunk. A `@@ ctx` header first seeks
115
+ * `ctx` the same way; an add-only chunk under such a header inserts directly after it. A kept line stays as the file
116
+ * has it. Supersedes A-SPEC-163.3 rule 4.
117
+ *
118
+ * @implements A-SPEC-163.3 (rules 1-3, 5-7: chunk grammar, ops, end-of-file, size), A-SPEC-163.4 — their rule 4 (one
119
+ * place in the whole file) is the part A-SPEC-768.2 replaces; everything else they pin still holds here.
120
+ */
121
+ export declare function applyPatchUpdateDetailed(original: string, hunk: string): {
122
+ result: string;
123
+ } | {
124
+ failure: string;
125
+ };
108
126
  /**
109
127
  * The file a raw path actually names.
110
128
  *
@@ -43,6 +43,7 @@ exports.patchAmbiguous = patchAmbiguous;
43
43
  exports.canonicalPatch = canonicalPatch;
44
44
  exports.patchTargetsOf = patchTargetsOf;
45
45
  exports.applyPatchUpdate = applyPatchUpdate;
46
+ exports.applyPatchUpdateDetailed = applyPatchUpdateDetailed;
46
47
  exports.pathFlavorFor = pathFlavorFor;
47
48
  exports.resolveTarget = resolveTarget;
48
49
  exports.isProtectedTarget = isProtectedTarget;
@@ -66,7 +67,7 @@ exports.joinShellText = joinShellText;
66
67
  exports.commandBases = commandBases;
67
68
  exports.shellSegments = shellSegments;
68
69
  exports.resolvesInside = resolvesInside;
69
- // @implements A-SPEC-728, A-SPEC-733, A-SPEC-163, A-SPEC-627
70
+ // @implements A-SPEC-728, A-SPEC-733, A-SPEC-163, A-SPEC-627, A-SPEC-768.2, A-SPEC-768.3
70
71
  const fs = __importStar(require("node:fs"));
71
72
  const path = __importStar(require("node:path"));
72
73
  const os = __importStar(require("node:os"));
@@ -367,6 +368,23 @@ function patchTargetsOf(text) {
367
368
  * rule (below): its one place in the file, or no result.
368
369
  */
369
370
  function applyPatchUpdate(original, hunk) {
371
+ const r = applyPatchUpdateDetailed(original, hunk);
372
+ return 'result' in r ? r.result : null;
373
+ }
374
+ /**
375
+ * @implements A-SPEC-768.2
376
+ * The same application, with the reason when there is no result. Measured 2026-10-11 (SWE-bench Sphinx 11510, H0
377
+ * arm): a four-chunk Codex patch — two chunks context-only, one context line (`def run(self) -> list[Node]:`) occurring
378
+ * eight times earlier in the file — got no result under rule 4's "exactly once in the whole file", and the refusal
379
+ * said a file path was missing. The tool applies each chunk from where the previous one ended; so does this now:
380
+ * exact first, then white-space-loose, the FIRST match at or after the previous chunk. A `@@ ctx` header first seeks
381
+ * `ctx` the same way; an add-only chunk under such a header inserts directly after it. A kept line stays as the file
382
+ * has it. Supersedes A-SPEC-163.3 rule 4.
383
+ *
384
+ * @implements A-SPEC-163.3 (rules 1-3, 5-7: chunk grammar, ops, end-of-file, size), A-SPEC-163.4 — their rule 4 (one
385
+ * place in the whole file) is the part A-SPEC-768.2 replaces; everything else they pin still holds here.
386
+ */
387
+ function applyPatchUpdateDetailed(original, hunk) {
370
388
  const endsWithNewline = original.endsWith('\n');
371
389
  const lines = original.split('\n');
372
390
  if (endsWithNewline)
@@ -396,17 +414,38 @@ function applyPatchUpdate(original, hunk) {
396
414
  else if (head === ' ' || head === '-' || head === '+')
397
415
  current.ops.push({ kind: head, text: line.slice(1) });
398
416
  else
399
- return null;
417
+ return { failure: `chunk ${chunks.length}: a line is not a patch line` };
400
418
  }
401
- // @implements A-SPEC-163.3 (rule 4) — a chunk is applied only where its old text is found exactly once in the whole
402
- // file, compared with surrounding white space ignored (the loosest comparison any parser uses), and in file order.
403
- // Then exact-first, `@@` seeking and end-of-file anchoring all choose the same place, so the result does not depend
404
- // on which parser applies it. No old text (an add-only chunk), none found, or two found: no one result.
405
419
  // The loose reading of each file line is computed once and spliced beside `lines`: per chunk it would be
406
420
  // chunks x lines regex passes inside a hook with a deadline.
407
421
  const loose = lines.map(patchLoose);
422
+ // The first index at or after `from` where `exact` matches the file, else where `looseOld` matches, else -1.
423
+ const seekFrom = (from, exact, looseOld) => {
424
+ for (const [source, want] of [[lines, exact], [loose, looseOld]]) {
425
+ for (let i = from; i + want.length <= source.length; i++) {
426
+ let ok = true;
427
+ for (let j = 0; j < want.length; j++)
428
+ if (source[i + j] !== want[j]) {
429
+ ok = false;
430
+ break;
431
+ }
432
+ if (ok)
433
+ return i;
434
+ }
435
+ }
436
+ return -1;
437
+ };
408
438
  let pos = 0;
409
- for (const chunk of chunks) {
439
+ for (const [index, chunk] of chunks.entries()) {
440
+ const n = index + 1;
441
+ let from = pos;
442
+ if (chunk.seek !== null) {
443
+ const at = seekFrom(pos, [chunk.seek], [patchLoose(chunk.seek)]);
444
+ if (at === -1)
445
+ return { failure: `chunk ${n}: the @@ context line was not found at or after the previous chunk` };
446
+ from = at + 1;
447
+ pos = from;
448
+ }
410
449
  const blank = (o) => o.empty === true;
411
450
  const ops = chunk.ops.slice();
412
451
  while (ops.length > 0 && blank(ops[0]))
@@ -416,30 +455,18 @@ function applyPatchUpdate(original, hunk) {
416
455
  if (ops.length === 0)
417
456
  continue;
418
457
  const oldExact = ops.filter((o) => o.kind !== '+').map((o) => o.text);
419
- if (oldExact.length === 0)
420
- return null;
421
- const old = oldExact.map(patchLoose);
422
- let at = -1;
423
- for (let i = 0; i + old.length <= lines.length; i++) {
424
- let ok = true;
425
- for (let j = 0; j < old.length; j++)
426
- if (loose[i + j] !== old[j]) {
427
- ok = false;
428
- break;
429
- }
430
- if (!ok)
431
- continue;
432
- if (at !== -1)
433
- return null;
434
- at = i;
435
- }
436
- if (at === -1 || at < pos)
437
- return null;
438
- // @implements A-SPEC-163.4 (rule 4) — the one loose place must also be an exact one: then the lines the patch
439
- // keeps are the same text in the file and in the patch, whichever of the two a tool writes back.
440
- for (let j = 0; j < oldExact.length; j++)
441
- if (lines[at + j] !== oldExact[j])
442
- return null;
458
+ if (oldExact.length === 0) {
459
+ if (chunk.seek === null)
460
+ return { failure: `chunk ${n}: adds lines with no place to add them` };
461
+ const added = ops.map((o) => o.text);
462
+ lines.splice(from, 0, ...added);
463
+ loose.splice(from, 0, ...added.map(patchLoose));
464
+ pos = from + added.length;
465
+ continue;
466
+ }
467
+ const at = seekFrom(from, oldExact, oldExact.map(patchLoose));
468
+ if (at === -1)
469
+ return { failure: `chunk ${n}: its old lines were not found at or after the previous chunk` };
443
470
  const replacement = [];
444
471
  let k = at;
445
472
  for (const op of ops) {
@@ -450,11 +477,11 @@ function applyPatchUpdate(original, hunk) {
450
477
  else
451
478
  replacement.push(op.text);
452
479
  }
453
- lines.splice(at, old.length, ...replacement);
454
- loose.splice(at, old.length, ...replacement.map(patchLoose));
480
+ lines.splice(at, oldExact.length, ...replacement);
481
+ loose.splice(at, oldExact.length, ...replacement.map(patchLoose));
455
482
  pos = at + replacement.length;
456
483
  }
457
- return lines.join('\n') + (endsWithNewline ? '\n' : '');
484
+ return { result: lines.join('\n') + (endsWithNewline ? '\n' : '') };
458
485
  }
459
486
  /**
460
487
  * The file a raw path actually names.
@@ -2105,8 +2132,82 @@ function mentionsAxSpelling(command) {
2105
2132
  axSpellingMemo = { command, answer };
2106
2133
  return answer;
2107
2134
  }
2135
+ /**
2136
+ * @implements A-SPEC-768.3
2137
+ * The command with every glob character the shell would NOT expand replaced by a literal placeholder: inside single
2138
+ * quotes (`$'…'` included), inside double quotes outside any `$(…)`/backtick substitution, or directly after an
2139
+ * unescaped backslash. Measured 2026-10-11 (SWE-bench Sphinx 11510, HG arm): the `.*` of a quoted regex was read as a
2140
+ * glob that could spell `.ax`, and with an uncertain base every segment of a read-only command was judged under the
2141
+ * store. A shell never globs a quoted or escaped character, so such a character cannot spell the store. An unterminated
2142
+ * quote leaves the text as written (conservative: the glob still counts).
2143
+ */
2144
+ function literalGlobsNeutralized(command) {
2145
+ const GLOB = /[*?[]/;
2146
+ let out = '';
2147
+ let quote = null;
2148
+ let subDepth = 0;
2149
+ let tick = false;
2150
+ for (let i = 0; i < command.length; i++) {
2151
+ const c = command[i];
2152
+ if (quote === "'") {
2153
+ out += c === "'" ? c : GLOB.test(c) ? '_' : c;
2154
+ if (c === "'")
2155
+ quote = null;
2156
+ continue;
2157
+ }
2158
+ if (c === '\\' && i + 1 < command.length) {
2159
+ const n = command[i + 1];
2160
+ out += quote === null && GLOB.test(n) ? '\\_' : c + n;
2161
+ i++;
2162
+ continue;
2163
+ }
2164
+ if (quote === '"') {
2165
+ if (c === '"' && subDepth === 0 && !tick) {
2166
+ quote = null;
2167
+ out += c;
2168
+ continue;
2169
+ }
2170
+ if (c === '$' && command[i + 1] === '(') {
2171
+ subDepth++;
2172
+ out += '$(';
2173
+ i++;
2174
+ continue;
2175
+ }
2176
+ if (c === ')' && subDepth > 0) {
2177
+ subDepth--;
2178
+ out += c;
2179
+ continue;
2180
+ }
2181
+ if (c === '`') {
2182
+ tick = !tick;
2183
+ out += c;
2184
+ continue;
2185
+ }
2186
+ out += subDepth === 0 && !tick && GLOB.test(c) ? '_' : c;
2187
+ continue;
2188
+ }
2189
+ if (c === "'") {
2190
+ quote = "'";
2191
+ out += c;
2192
+ continue;
2193
+ }
2194
+ if (c === '$' && command[i + 1] === "'") {
2195
+ quote = "'";
2196
+ out += "$'";
2197
+ i++;
2198
+ continue;
2199
+ }
2200
+ if (c === '"') {
2201
+ quote = '"';
2202
+ out += c;
2203
+ continue;
2204
+ }
2205
+ out += c;
2206
+ }
2207
+ return quote === null ? out : command;
2208
+ }
2108
2209
  function mentionsAxSpellingUncached(command) {
2109
- const decoded = command
2210
+ const decoded = literalGlobsNeutralized(command)
2110
2211
  .replace(/\\\n/g, '')
2111
2212
  .replace(/\\(?:x([0-9A-Fa-f]{1,2})|u([0-9A-Fa-f]{1,4})|U([0-9A-Fa-f]{1,8})|([0-7]{1,3}))/g, (_w, x, u, U, o) => {
2112
2213
  const cp = x !== undefined ? parseInt(x, 16) : u !== undefined ? parseInt(u, 16) : U !== undefined ? parseInt(U, 16) : parseInt(o ?? '0', 8);
@@ -48,7 +48,7 @@ exports.gateErrorDecision = gateErrorDecision;
48
48
  exports.wiredSpecsDir = wiredSpecsDir;
49
49
  exports.evaluateHook = evaluateHook;
50
50
  exports.readSpecsSync = readSpecsSync;
51
- // @implements A-SPEC-753.3, A-SPEC-134.2, A-SPEC-278, A-SPEC-733, A-SPEC-734, A-SPEC-747, A-SPEC-477.1, A-SPEC-753, A-SPEC-163.7
51
+ // @implements A-SPEC-753.3, A-SPEC-134.2, A-SPEC-278, A-SPEC-733, A-SPEC-734, A-SPEC-747, A-SPEC-477.1, A-SPEC-753, A-SPEC-163.7, A-SPEC-768.2
52
52
  const shell_argument_roles_1 = require("../guardrail/shell-argument-roles");
53
53
  // @implements A-SPEC-549.3 — the hook's deny reasons are English here; hooks-english.test.ts drives
54
54
  // evaluateHook in this file to prove it.
@@ -952,6 +952,9 @@ const PATCH_STRINGS_MAX = 256;
952
952
  /** A file an update hunk is applied to; a larger one is not judged by its result. */
953
953
  const PATCH_UPDATE_BYTES_MAX = 8 * 1024 * 1024;
954
954
  const PATCH_UNREADABLE_REASON = '[Holmes-Kit] cannot read the edit target path, so it cannot be judged (file_path missing or not a string)';
955
+ // @implements A-SPEC-768.2 — a patch the tool could not apply is told so, by file and chunk; measured 2026-10-11 (H0 arm)
956
+ // the path-missing sentence above was returned for a readable file whose patch simply did not apply.
957
+ const patchNotAppliedReason = (file, why) => `[Holmes-Kit] the patch does not apply to ${file} as it stands (${why}), so the result cannot be judged`;
955
958
  // @implements A-SPEC-163.7 — the refusal of A-SPEC-163.6 rule 3 in its own words (each refusal names its channel, A-SPEC-737).
956
959
  const SHELL_MARKED_REASON = '[Holmes-Kit] this shell command mentions the patch tool or a patch marker and is not one plain read, so it is not judged — '
957
960
  + 'search with the harness\'s own search tool, or run one plain grep, egrep, fgrep, rg, cat, head, tail, wc or ls with literal words (no pipe, redirect or substitution)';
@@ -1244,18 +1247,20 @@ function evaluateHook(input, specsDir, opts) {
1244
1247
  const workdir = isShell ? input.tool_input.workdir : undefined;
1245
1248
  const base = workdir === undefined ? outer : (path.isAbsolute(workdir) ? workdir : outer.replace(/\/+$/, '') + '/' + workdir);
1246
1249
  const at = (p) => (path.isAbsolute(p) ? p : base.replace(/\/+$/, '') + '/' + p);
1250
+ // @implements A-SPEC-768.2 — null: the file cannot be read (unreadable target); `failure`: readable, patch not applicable.
1247
1251
  const resultOf = (source, hunk) => {
1248
1252
  try {
1249
1253
  // @implements A-SPEC-163.3 (rule 7) — only a regular file is read: a FIFO or a device would hold the hook.
1250
1254
  const stat = fs.statSync(source);
1251
1255
  if (!stat.isFile() || stat.size > PATCH_UPDATE_BYTES_MAX)
1252
1256
  return null;
1253
- return (0, write_target_1.applyPatchUpdate)(fs.readFileSync(source, 'utf8'), hunk);
1257
+ return (0, write_target_1.applyPatchUpdateDetailed)(fs.readFileSync(source, 'utf8'), hunk);
1254
1258
  }
1255
1259
  catch {
1256
1260
  return null;
1257
1261
  }
1258
1262
  };
1263
+ const judged = (file, r) => r === null ? { deny: PATCH_UNREADABLE_REASON } : 'failure' in r ? { deny: patchNotAppliedReason(file, r.failure) } : { content: r.result };
1259
1264
  // @implements A-SPEC-163.3 (rule 1), A-SPEC-163.4 (rule 5) — two targets on one file have no one result: the tool
1260
1265
  // applies them in sequence, the gate reads the disk once. One file is one key whatever link or letter case names it.
1261
1266
  // (What a shell could rewrite is settled before this point: only the one quoted-heredoc form reaches here.)
@@ -1271,16 +1276,16 @@ function evaluateHook(input, specsDir, opts) {
1271
1276
  if (t.kind === 'add')
1272
1277
  content = t.content;
1273
1278
  else if (t.kind === 'update' && t.movedTo === undefined) {
1274
- const result = resultOf(at(t.path), t.hunk ?? '');
1275
- if (result === null)
1276
- return { permissionDecision: 'deny', permissionDecisionReason: PATCH_UNREADABLE_REASON };
1277
- content = result;
1279
+ const j = judged(at(t.path), resultOf(at(t.path), t.hunk ?? ''));
1280
+ if ('deny' in j)
1281
+ return { permissionDecision: 'deny', permissionDecisionReason: j.deny };
1282
+ content = j.content;
1278
1283
  }
1279
1284
  else if (t.kind === 'move') {
1280
- const result = t.from === undefined ? null : resultOf(at(t.from), t.hunk ?? '');
1281
- if (result === null)
1282
- return { permissionDecision: 'deny', permissionDecisionReason: PATCH_UNREADABLE_REASON };
1283
- content = result;
1285
+ const j = judged(at(t.from ?? t.path), t.from === undefined ? null : resultOf(at(t.from), t.hunk ?? ''));
1286
+ if ('deny' in j)
1287
+ return { permissionDecision: 'deny', permissionDecisionReason: j.deny };
1288
+ content = j.content;
1284
1289
  }
1285
1290
  // Judged as a patch tool's write whichever tool carried the patch, so the shell branch below is not re-entered.
1286
1291
  const verdict = evaluateHook({ tool_name: 'apply_patch', tool_input: { file_path: at(t.path), ...(content === undefined ? {} : { content }) },
@@ -1,11 +1,16 @@
1
- import { FreshnessLane, FreshnessReceipt } from '../refresh/freshness-coordinator';
1
+ import { FreshnessLane, FreshnessReceipt, RefreshFailure } from '../refresh/freshness-coordinator';
2
+ /** The error as a bounded reason: its message (never a stack), at most REFRESH_FAILURE_REASON_MAX characters. */
3
+ export declare function failureReason(error: unknown): string;
2
4
  /** The detached worker must publish its own failure; the parent is intentionally non-blocking. */
3
- export declare function recordRefreshFailure(root: string, generation: string, head: string | null, now: Date): FreshnessReceipt | null;
5
+ export declare function recordRefreshFailure(root: string, generation: string, head: string | null, now: Date, failure?: RefreshFailure): FreshnessReceipt | null;
4
6
  export interface RefreshChildDeps {
5
7
  head: (root: string) => string | null;
6
8
  refreshGraph: (root: string) => Promise<unknown>;
9
+ /** @implements A-SPEC-768.4 — a failed lane may carry `detail` (the embedder's message) beside its reason. */
7
10
  refreshSource: (root: string) => Promise<{
8
11
  lane: FreshnessLane;
12
+ reason?: string;
13
+ detail?: string;
9
14
  }>;
10
15
  refreshRequirement: (root: string) => Promise<{
11
16
  status: string;
@@ -16,6 +21,11 @@ export interface RefreshChildDeps {
16
21
  * so a superseded worker, or one whose root was removed, stops without writing (A-SPEC-724). Any
17
22
  * failure — synchronous module load included — is published as bounded retry for this generation
18
23
  * rather than left as a `refreshing` lease that only expiry can clear (A-SPEC-719).
24
+ *
25
+ * @implements A-SPEC-768.4 — and the receipt says WHY. Measured 2026-10-11 (SWE-bench Sphinx 11510, HG arm):
26
+ * generation 77968db7 recorded both semantic lanes `failed` while direct probes of the same endpoint returned HTTP
27
+ * 200; every error was swallowed here, so the cause was unknowable. The stage that threw and the error's message
28
+ * now ride the receipt; a source lane that returns `failed` carries the embedder's detail.
19
29
  */
20
30
  export declare function runRefreshChild(root: string, generation: string, deps: RefreshChildDeps): Promise<void>;
21
31
  /** The production phases: the scan/build machinery, loaded only inside the detached child. */
@@ -33,11 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.failureReason = failureReason;
36
37
  exports.recordRefreshFailure = recordRefreshFailure;
37
38
  exports.runRefreshChild = runRefreshChild;
38
39
  exports.defaultRefreshChildDeps = defaultRefreshChildDeps;
39
40
  // @implements A-SPEC-719, A-SPEC-734
40
41
  // @implements A-SPEC-566.4
42
+ // @implements A-SPEC-768.4
41
43
  /**
42
44
  * The detached refresh child — the ONLY place this slice touches the scan/build machinery. Spawned
43
45
  * by `maybeSpawnRtmRefresh` (rtm-refresh.ts) outside any turn; nothing in the hook path imports
@@ -56,10 +58,17 @@ const currentHead = (root) => {
56
58
  return null;
57
59
  }
58
60
  };
61
+ // @implements A-SPEC-768.4
62
+ /** The error as a bounded reason: its message (never a stack), at most REFRESH_FAILURE_REASON_MAX characters. */
63
+ function failureReason(error) {
64
+ const message = error instanceof Error ? error.message : String(error);
65
+ return message.slice(0, freshness_coordinator_1.REFRESH_FAILURE_REASON_MAX);
66
+ }
59
67
  /** The detached worker must publish its own failure; the parent is intentionally non-blocking. */
60
- function recordRefreshFailure(root, generation, head, now) {
68
+ function recordRefreshFailure(root, generation, head, now, failure) {
61
69
  return (0, freshness_coordinator_1.completeRefresh)(root, generation, {
62
70
  graph: 'failed', sourceSemantic: 'failed', requirementSemantic: 'failed', head,
71
+ ...(failure ? { failure } : {}), // A-SPEC-768.4
63
72
  }, now);
64
73
  }
65
74
  /**
@@ -67,12 +76,18 @@ function recordRefreshFailure(root, generation, head, now) {
67
76
  * so a superseded worker, or one whose root was removed, stops without writing (A-SPEC-724). Any
68
77
  * failure — synchronous module load included — is published as bounded retry for this generation
69
78
  * rather than left as a `refreshing` lease that only expiry can clear (A-SPEC-719).
79
+ *
80
+ * @implements A-SPEC-768.4 — and the receipt says WHY. Measured 2026-10-11 (SWE-bench Sphinx 11510, HG arm):
81
+ * generation 77968db7 recorded both semantic lanes `failed` while direct probes of the same endpoint returned HTTP
82
+ * 200; every error was swallowed here, so the cause was unknowable. The stage that threw and the error's message
83
+ * now ride the receipt; a source lane that returns `failed` carries the embedder's detail.
70
84
  */
71
85
  async function runRefreshChild(root, generation, deps) {
72
86
  if (!fs.existsSync(path.join(root, '.ax')))
73
87
  return;
74
88
  if (!(0, freshness_coordinator_1.ownsLease)(root, generation))
75
89
  return; // spawned late behind a newer lease: not even the graph
90
+ let stage = 'graph';
76
91
  try {
77
92
  await deps.refreshGraph(root);
78
93
  // @implements A-SPEC-683 — the vectors ride the channel that already refreshes the graph.
@@ -80,15 +95,21 @@ async function runRefreshChild(root, generation, deps) {
80
95
  // stayed current.
81
96
  if (!(0, freshness_coordinator_1.ownsLease)(root, generation))
82
97
  return;
98
+ stage = 'source';
83
99
  const source = await deps.refreshSource(root);
84
100
  if (!(0, freshness_coordinator_1.ownsLease)(root, generation))
85
101
  return;
102
+ let failure;
103
+ if (source.lane === 'failed')
104
+ failure = { stage: 'source', reason: (source.detail ?? source.reason ?? 'failed').slice(0, freshness_coordinator_1.REFRESH_FAILURE_REASON_MAX) };
105
+ stage = 'requirement';
86
106
  let requirement;
87
107
  try {
88
108
  requirement = await deps.refreshRequirement(root);
89
109
  }
90
- catch {
110
+ catch (error) {
91
111
  requirement = { status: 'unavailable' };
112
+ failure ??= { stage: 'requirement', reason: failureReason(error) };
92
113
  }
93
114
  (0, freshness_coordinator_1.completeRefresh)(root, generation, {
94
115
  graph: 'current',
@@ -97,11 +118,12 @@ async function runRefreshChild(root, generation, deps) {
97
118
  : requirement.status === 'not-applicable' ? 'not-adopted'
98
119
  : requirement.status === 'suppressed' ? 'suppressed' : 'failed',
99
120
  head: deps.head(root),
121
+ ...(failure ? { failure } : {}),
100
122
  }, new Date());
101
123
  }
102
- catch {
124
+ catch (error) {
103
125
  try {
104
- recordRefreshFailure(root, generation, deps.head(root), new Date());
126
+ recordRefreshFailure(root, generation, deps.head(root), new Date(), { stage, reason: failureReason(error) });
105
127
  }
106
128
  catch { /* fail-soft */ }
107
129
  }
@@ -55,6 +55,7 @@ export type SourceSemanticRefreshOutcome = {
55
55
  } | {
56
56
  lane: 'failed';
57
57
  reason: 'unavailable' | 'failed';
58
+ detail?: string;
58
59
  };
59
60
  /**
60
61
  * @implements A-SPEC-478 — the semantic cache WARMING lives in explicit heavy operations, so the
@@ -184,11 +184,11 @@ async function refreshSemanticVectors(root, env = process.env, warm = warmSemant
184
184
  try {
185
185
  outcome = await warm(root, scanned);
186
186
  }
187
- catch {
188
- return { lane: 'failed', reason: 'failed' };
189
- }
187
+ catch (error) {
188
+ return { lane: 'failed', reason: 'failed', detail: error instanceof Error ? error.message : String(error) };
189
+ } // A-SPEC-768.4
190
190
  if (outcome.status !== 'discharged')
191
- return { lane: 'failed', reason: 'unavailable' };
191
+ return { lane: 'failed', reason: 'unavailable', detail: `warm status: ${outcome.status}` };
192
192
  // What LANDED, not what was attempted. Measured 2026-09-19 the warm answered `computed: 603`
193
193
  // while 26 vectors were never stored; a count of attempts reported as a success is the same
194
194
  // class of dishonesty as a tier that says PASS while covering nothing.
@@ -1,6 +1,29 @@
1
1
  import { Spec } from '../../spec/spec-parser';
2
2
  import { SpecStore } from '../../spec/spec-store';
3
3
  import type { Approval } from '../../guardrail/risk-gate';
4
+ import type { ApprovalStatus } from '../../spec/approval-status';
5
+ /** The spec-approve request for one spec as the queue holds it now: its state and, when held, the operator's LATEST question. */
6
+ export interface ApprovalRequestState {
7
+ id: string;
8
+ state: 'pending' | 'held' | 'granted' | 'consumed' | 'denied' | 'revoked';
9
+ question?: string;
10
+ reason?: string;
11
+ ts?: string;
12
+ }
13
+ /**
14
+ * @implements A-SPEC-768
15
+ * Measured 2026-10-11 (SWE-bench Sphinx 11510, H0 arm): the operator held one request twice with two different
16
+ * questions; the worker polled `approval_status` eleven times and never saw the second, because the response reported
17
+ * the spec's seal only. The queue fold already keeps the latest `held` question (`pending[].question`, `holds[id]`);
18
+ * this reads it. Read-only; an unreadable queue is no request.
19
+ */
20
+ export declare function approvalRequestOf(root: string, specId: string): ApprovalRequestState | undefined;
21
+ /**
22
+ * @implements A-SPEC-768
23
+ * One sentence an agent can act on. Measured 2026-10-11 (HG arm): 58 `sealed: true` answers were read as "pending"
24
+ * because nothing in the response said what to do once the seal was there.
25
+ */
26
+ export declare function nextActionOf(described: Pick<ApprovalStatus, 'sealed' | 'blockers'>, request: ApprovalRequestState | undefined): string;
4
27
  export interface OperatorInspectionContext {
5
28
  listSpecs(): Promise<Spec[]>;
6
29
  readSpec: SpecStore['read'];
@@ -71,6 +94,8 @@ export declare function createOperatorInspectionHandlers(context: OperatorInspec
71
94
  };
72
95
  unavailable?: "empty" | "unreadable";
73
96
  } | undefined;
97
+ nextAction: string;
98
+ request?: ApprovalRequestState | undefined;
74
99
  id: string;
75
100
  type?: string;
76
101
  status: string;
@@ -33,10 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.approvalRequestOf = approvalRequestOf;
37
+ exports.nextActionOf = nextActionOf;
36
38
  exports.createOperatorInspectionHandlers = createOperatorInspectionHandlers;
37
39
  // @implements A-SPEC-605, A-SPEC-605.1
38
40
  // @implements A-SPEC-642
39
41
  // @implements A-SPEC-631
42
+ // @implements A-SPEC-768
40
43
  const fs = __importStar(require("node:fs"));
41
44
  const path = __importStar(require("node:path"));
42
45
  const spec_store_1 = require("../../spec/spec-store");
@@ -46,6 +49,58 @@ const ledger_timeline_1 = require("../../governance/ledger-timeline");
46
49
  const provenance_ledger_1 = require("../../governance/provenance-ledger");
47
50
  const provenance_chain_1 = require("../../governance/provenance-chain");
48
51
  const approval_grants_1 = require("../../governance/approval-grants");
52
+ const approval_queue_1 = require("../../governance/approval-queue");
53
+ /**
54
+ * @implements A-SPEC-768
55
+ * Measured 2026-10-11 (SWE-bench Sphinx 11510, H0 arm): the operator held one request twice with two different
56
+ * questions; the worker polled `approval_status` eleven times and never saw the second, because the response reported
57
+ * the spec's seal only. The queue fold already keeps the latest `held` question (`pending[].question`, `holds[id]`);
58
+ * this reads it. Read-only; an unreadable queue is no request.
59
+ */
60
+ function approvalRequestOf(root, specId) {
61
+ try {
62
+ const id = (0, approval_queue_1.approvalRequestId)('spec-approve', specId);
63
+ const q = (0, approval_queue_1.readQueue)(root);
64
+ const pending = q.pending.find((p) => p.id === id);
65
+ const hold = q.holds[id];
66
+ if (pending?.hold || hold) {
67
+ const question = (pending?.hold ? pending.question : undefined) ?? hold?.question;
68
+ return { id, state: 'held', ...(question !== undefined ? { question } : {}), ...(hold?.ts ? { ts: hold.ts } : pending ? { ts: pending.lastTs } : {}) };
69
+ }
70
+ if (pending)
71
+ return { id, state: 'pending', ts: pending.lastTs };
72
+ const d = q.decisions[id];
73
+ if (!d)
74
+ return undefined;
75
+ if (d.event === 'granted')
76
+ return { id, state: d.consumedTs ? 'consumed' : 'granted', ts: d.consumedTs ?? d.ts };
77
+ return { id, state: d.event, ...(d.reason ? { reason: d.reason } : {}), ts: d.ts };
78
+ }
79
+ catch {
80
+ return undefined;
81
+ }
82
+ }
83
+ /**
84
+ * @implements A-SPEC-768
85
+ * One sentence an agent can act on. Measured 2026-10-11 (HG arm): 58 `sealed: true` answers were read as "pending"
86
+ * because nothing in the response said what to do once the seal was there.
87
+ */
88
+ function nextActionOf(described, request) {
89
+ if (described.sealed)
90
+ return 'sealed — stop polling this id; call spec_slice_approve or spec_approve for the next unsealed spec of the chain (spec_next names it).';
91
+ switch (request?.state) {
92
+ case 'held': return `held — the operator asks: ${request.question ?? '(no question recorded)'}. Resolve it in the spec or tests, then call spec_approve again.`;
93
+ case 'denied': return `denied — ${request.reason ?? 'no reason recorded'}. Do not re-request the same act; report it to the user.`;
94
+ case 'revoked': return `revoked — ${request.reason ?? 'no reason recorded'}. Do not re-request the same act; report it to the user.`;
95
+ case 'granted': return 'granted — call spec_approve now; the grant seals it.';
96
+ case 'consumed': return 'the grant was consumed but this spec is not sealed — call spec_approve again, and report its refusal to the user if it refuses.';
97
+ case 'pending': return "pending the operator's decision — wait, then call approval_status again; when sealed is true, retry spec_approve immediately.";
98
+ default: break;
99
+ }
100
+ if (described.blockers.length > 0)
101
+ return 'fix the blockers listed, then call spec_approve; no request is filed while they stand.';
102
+ return 'no approval request on file — call spec_approve to file one.';
103
+ }
49
104
  function createOperatorInspectionHandlers(context) {
50
105
  return {
51
106
  /**
@@ -261,7 +316,11 @@ function createOperatorInspectionHandlers(context) {
261
316
  advisoryIds = undefined;
262
317
  advisoryHistory = undefined;
263
318
  }
264
- return { ok: true, ...(0, approval_status_1.describeApproval)(cur.spec, context.resolver(all)), ...(graphPreview ? { graphPreview } : {}),
319
+ // @implements A-SPEC-768 — the request's state and the next action ride beside the seal state.
320
+ const described = (0, approval_status_1.describeApproval)(cur.spec, context.resolver(all));
321
+ const request = typeof a.root === 'string' && a.root !== '' ? approvalRequestOf(a.root, a.id) : undefined;
322
+ const nextAction = nextActionOf(described, request);
323
+ return { ok: true, ...described, ...(request ? { request } : {}), nextAction, ...(graphPreview ? { graphPreview } : {}),
265
324
  ...(fttFulfilment ? { fttFulfilment } : {}), ...(killsAdvisory ? { killsAdvisory } : {}),
266
325
  ...(advisoryIds ? { advisoryIds } : {}), ...(advisoryHistory ? { advisoryHistory } : {}) };
267
326
  },
@@ -50,6 +50,13 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
50
50
  }[];
51
51
  };
52
52
  } | {
53
+ anchorDiagnostics?: {
54
+ hint: string;
55
+ file: string;
56
+ line: number;
57
+ separator: string;
58
+ dropped: string[];
59
+ }[] | undefined;
53
60
  calibrationClosed?: string[] | undefined;
54
61
  baselineRecorded?: string | undefined;
55
62
  scopeFallback?: "full" | undefined;
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.createTestExecutionHandlers = createTestExecutionHandlers;
37
- // @implements A-SPEC-616, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-121.2, A-SPEC-121.3, A-SPEC-128, A-SPEC-130, A-SPEC-189, A-SPEC-233, A-SPEC-419, A-SPEC-433, A-SPEC-534.5, A-SPEC-534.8, A-SPEC-578.4, A-SPEC-614, A-SPEC-734
37
+ // @implements A-SPEC-616, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-121.2, A-SPEC-121.3, A-SPEC-128, A-SPEC-130, A-SPEC-189, A-SPEC-233, A-SPEC-419, A-SPEC-433, A-SPEC-534.5, A-SPEC-534.8, A-SPEC-578.4, A-SPEC-614, A-SPEC-734, A-SPEC-768.1
38
38
  const fs = __importStar(require("node:fs"));
39
39
  const path = __importStar(require("node:path"));
40
40
  const node_child_process_1 = require("node:child_process");
@@ -55,6 +55,8 @@ const test_evidence_1 = require("../../review/test-evidence");
55
55
  const test_outcomes_1 = require("../../review/test-outcomes");
56
56
  const maintenance_evidence_1 = require("../maintenance-evidence");
57
57
  const bounded_io_1 = require("../../project/bounded-io");
58
+ // @implements A-SPEC-768.1 — the one sentence every anchor-separator diagnostic carries.
59
+ const ANCHOR_SEPARATOR_HINT = 'only a comma-separated list is an anchor list; ids after the separator are not attributed — write `@' + 'implements A, B` or one marker per line';
58
60
  // @implements A-SPEC-534.8
59
61
  // The governed source file a `kills` mutation targets: one that @implements the A-SPEC AND contains
60
62
  // the `where` literal. Bounded walk, skips vendored/test/hidden dirs. null when none qualifies.
@@ -168,6 +170,10 @@ function createTestExecutionHandlers(context) {
168
170
  const result = (0, test_runner_1.runTestScope)(testScope, root);
169
171
  const anchors = (0, test_scope_1.scanTestAnchors)(root);
170
172
  const executedByAspec = (0, test_evidence_1.computeExecutedByAspec)(result.executedByFile ?? {}, anchors);
173
+ // @implements A-SPEC-768.1 — an anchor list the grammar does not read is named beside the attribution it could
174
+ // not make (measured 2026-10-11: `A-SPEC-107; A-SPEC-122` counted A-SPEC-107 only, silently). Diagnosis only:
175
+ // `executedByAspec` is exactly what the grammar read.
176
+ const anchorDiagnostics = (0, test_scope_1.scanTestAnchorDiagnostics)(root).map((d) => ({ ...d, hint: ANCHOR_SEPARATOR_HINT }));
171
177
  let head = '';
172
178
  try {
173
179
  head = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'rev-parse', 'HEAD'], { timeout: bounded_io_1.GIT_TIMEOUT_MS, maxBuffer: bounded_io_1.GIT_MAX_BUFFER, encoding: 'utf8', env: (0, root_1.cleanSubprocessEnv)(), stdio: ['ignore', 'pipe', 'pipe'] }).trim();
@@ -218,7 +224,8 @@ function createTestExecutionHandlers(context) {
218
224
  // @implements A-SPEC-130 — the remediation rides in the answer: these are the files to anchor.
219
225
  unresolvedFiles: testScope.unresolvedFiles,
220
226
  changeSource, ...(scopeFallback ? { scopeFallback } : {}), ...(baseline ? { baselineRecorded: baseline } : {}),
221
- ...(calibrationClosed ? { calibrationClosed } : {}) };
227
+ ...(calibrationClosed ? { calibrationClosed } : {}),
228
+ ...(anchorDiagnostics.length > 0 ? { anchorDiagnostics } : {}) };
222
229
  },
223
230
  };
224
231
  }
@@ -1205,6 +1205,8 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1205
1205
  };
1206
1206
  unavailable?: "empty" | "unreadable";
1207
1207
  } | undefined;
1208
+ nextAction: string;
1209
+ request?: import("./handlers/operator-inspection").ApprovalRequestState | undefined;
1208
1210
  id: string;
1209
1211
  type?: string;
1210
1212
  status: string;
@@ -1541,6 +1543,13 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1541
1543
  }[];
1542
1544
  };
1543
1545
  } | {
1546
+ anchorDiagnostics?: {
1547
+ hint: string;
1548
+ file: string;
1549
+ line: number;
1550
+ separator: string;
1551
+ dropped: string[];
1552
+ }[] | undefined;
1544
1553
  calibrationClosed?: string[] | undefined;
1545
1554
  baselineRecorded?: string | undefined;
1546
1555
  scopeFallback?: "full" | undefined;
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.operatorRecovery = operatorRecovery;
37
- // @implements A-SPEC-754, A-SPEC-532.3
37
+ // @implements A-SPEC-754, A-SPEC-532.3, A-SPEC-768
38
38
  const path = __importStar(require("node:path"));
39
39
  const unsafeDisplay = /[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/;
40
40
  function literal(value, platform) {
@@ -58,9 +58,12 @@ function operatorRecovery(root, target, operation, options) {
58
58
  return `\n[승인 대기 ${id}] The request was recorded. Use the installed approval UI; a path exceeds the safe command display limit. No truncated command is provided.`;
59
59
  // @implements A-SPEC-532.3 — the resident surface is offered beside the one-off command (owner, 2026-10-04:
60
60
  // "why am I still pasting commands"): one key per arriving request.
61
+ // @implements A-SPEC-768 — the three lines above are the operator's; measured 2026-10-11 (HG arm) the agent read
62
+ // "keep the approval surface open" as its own instruction and polled a sealed spec 58 times. One line is the agent's.
61
63
  return `\n[승인 대기 ${id}] 운영자: ${command} --grant ${literal(id, platform)}`
62
64
  + `\nOr keep the approval surface open and decide each arriving request with one key: ${command} --watch`
63
- + `\nAfter official approval, retry ${operation ? display(operation) : 'the original MCP operation'} for target ${display(target)} in the same workspace. Do not retry until approval is available.`;
65
+ + `\nAfter official approval, retry ${operation ? display(operation) : 'the original MCP operation'} for target ${display(target)} in the same workspace. Do not retry until approval is available.`
66
+ + '\nAgent: check approval_status for the target; sealed:true or request.state granted means retry now — polling a sealed spec is wasted; request.state held carries the operator\'s question.';
64
67
  },
65
68
  };
66
69
  }
@@ -1,4 +1,10 @@
1
1
  export type FreshnessLane = 'current' | 'refreshing' | 'retry-at' | 'failed' | 'suppressed' | 'not-adopted' | 'stale';
2
+ /** Why a lane failed, as the worker saw it: the stage that failed and the error's message, bounded to 300 characters. */
3
+ export interface RefreshFailure {
4
+ stage: 'graph' | 'source' | 'requirement' | 'child';
5
+ reason: string;
6
+ }
7
+ export declare const REFRESH_FAILURE_REASON_MAX = 300;
2
8
  export interface FreshnessReceipt {
3
9
  schema: 'fresh-evidence/1';
4
10
  workspaceId: string;
@@ -12,6 +18,8 @@ export interface FreshnessReceipt {
12
18
  graph: FreshnessLane;
13
19
  sourceSemantic: FreshnessLane;
14
20
  requirementSemantic: FreshnessLane;
21
+ /** @implements A-SPEC-768.4 — present only on a completion that failed; never carried into the next lease. */
22
+ failure?: RefreshFailure;
15
23
  }
16
24
  export interface RefreshRequest {
17
25
  workspaceId: string;
@@ -23,6 +31,7 @@ export interface RefreshCompletion {
23
31
  sourceSemantic: FreshnessLane;
24
32
  requirementSemantic: FreshnessLane;
25
33
  head: string | null;
34
+ failure?: RefreshFailure;
26
35
  }
27
36
  export declare const FRESHNESS_RECEIPT_FILE: string;
28
37
  export declare const FRESHNESS_LEASE_MS: number;
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.FRESHNESS_REREFRESH_MS = exports.FRESHNESS_RETRY_MS = exports.FRESHNESS_LEASE_MS = exports.FRESHNESS_RECEIPT_FILE = void 0;
36
+ exports.FRESHNESS_REREFRESH_MS = exports.FRESHNESS_RETRY_MS = exports.FRESHNESS_LEASE_MS = exports.FRESHNESS_RECEIPT_FILE = exports.REFRESH_FAILURE_REASON_MAX = void 0;
37
37
  exports.intakeUsable = intakeUsable;
38
38
  exports.lexicalOnly = lexicalOnly;
39
39
  exports.readFreshnessReceipt = readFreshnessReceipt;
@@ -41,7 +41,7 @@ exports.requestRefresh = requestRefresh;
41
41
  exports.ownsLease = ownsLease;
42
42
  exports.completeRefresh = completeRefresh;
43
43
  exports.workspaceIdFor = workspaceIdFor;
44
- // @implements A-SPEC-719
44
+ // @implements A-SPEC-719, A-SPEC-768.4
45
45
  /**
46
46
  * The durable source of truth for refresh work. A receipt names the workspace and
47
47
  * commit it describes, so an old detached worker cannot make a newer tree look
@@ -51,6 +51,7 @@ const crypto = __importStar(require("node:crypto"));
51
51
  const fs = __importStar(require("node:fs"));
52
52
  const path = __importStar(require("node:path"));
53
53
  const workspace_identity_1 = require("../project/workspace-identity");
54
+ exports.REFRESH_FAILURE_REASON_MAX = 300;
54
55
  exports.FRESHNESS_RECEIPT_FILE = path.join('.ax', 'state', 'fresh-evidence.json');
55
56
  // A crashed detached child becomes eligible quickly. This is intentionally much
56
57
  // shorter than the former 30-minute marker window, while still bounding spawn bursts.
@@ -93,7 +94,9 @@ function isReceipt(value) {
93
94
  && typeof r.requirementSemantic === 'string' && lanes.has(r.requirementSemantic)
94
95
  && (r.startedAt === undefined || typeof r.startedAt === 'string')
95
96
  && (r.completedAt === undefined || typeof r.completedAt === 'string')
96
- && (r.retryAt === undefined || typeof r.retryAt === 'string');
97
+ && (r.retryAt === undefined || typeof r.retryAt === 'string')
98
+ // @implements A-SPEC-768.4 — a receipt without the field is still a receipt (older builds wrote none).
99
+ && (r.failure === undefined || (!!r.failure && typeof r.failure === 'object' && typeof r.failure.stage === 'string' && typeof r.failure.reason === 'string'));
97
100
  }
98
101
  function storedReceipt(root) {
99
102
  try {
@@ -202,9 +205,16 @@ function completeRefresh(root, generation, completion, now) {
202
205
  : judged.includes('suppressed') ? 'suppressed'
203
206
  : judged.includes('not-adopted') ? 'not-adopted'
204
207
  : retry ? 'retry-at' : 'failed';
208
+ // @implements A-SPEC-768.4 — `failure` comes from THIS completion only, bounded; a lease never inherits the last one.
209
+ const { failure: _previousFailure, ...base } = previous;
210
+ const failure = completion.failure
211
+ ? { stage: completion.failure.stage, reason: String(completion.failure.reason).slice(0, exports.REFRESH_FAILURE_REASON_MAX) }
212
+ : undefined;
213
+ const { failure: _completionFailure, ...completed } = completion;
205
214
  const receipt = {
206
- ...previous, ...completion, state, completedAt: now.toISOString(),
215
+ ...base, ...completed, state, completedAt: now.toISOString(),
207
216
  ...(retry ? { retryAt: new Date(now.getTime() + exports.FRESHNESS_RETRY_MS).toISOString() } : {}),
217
+ ...(failure ? { failure } : {}),
208
218
  };
209
219
  writeReceipt(root, receipt);
210
220
  return receipt;
@@ -34,3 +34,18 @@ export declare function anchorSpecSites(text: string): Array<{
34
34
  }>;
35
35
  /** Flattened wrong-kind ids (a governed id anchored where only A-SPEC belongs) — anywhere in a list. */
36
36
  export declare function wrongKindAnchorIds(text: string): string[];
37
+ /** A list the comma grammar does not read: the first non-comma joiner after a list, and every id the join drops. */
38
+ export interface AnchorListDiagnostic {
39
+ line: number;
40
+ separator: string;
41
+ dropped: string[];
42
+ }
43
+ /**
44
+ * @implements A-SPEC-768.1
45
+ * Measured 2026-10-11 (SWE-bench Sphinx 11510, HB arm): `# @implements A-SPEC-107; A-SPEC-122` attributed the file
46
+ * to A-SPEC-107 only and nothing said so — the C12 shape again, with a new separator. The grammar above stays the ONE
47
+ * grammar; this names what it does not read, per marker: the first `;`, `|`, `&`, `/` or `and` that follows the comma
48
+ * chain and is itself followed by a governed id, with every id of the chain after it. String literals are stripped the
49
+ * same way the anchor readers strip them, so a diagnostic never names text some code merely holds.
50
+ */
51
+ export declare function anchorListDiagnostics(text: string): AnchorListDiagnostic[];
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  // @implements A-SPEC-503.1
3
+ // @implements A-SPEC-768.1
3
4
  /**
4
5
  * The ONE comma-list grammar for anchor lines — C12, dogfooded: four parsers each captured only
5
6
  * the first id of a comma-listed anchor (`… <marker> A-SPEC-…110, …219`), so every id after the
@@ -15,6 +16,7 @@ exports.implementsIdLists = implementsIdLists;
15
16
  exports.anchorSpecIds = anchorSpecIds;
16
17
  exports.anchorSpecSites = anchorSpecSites;
17
18
  exports.wrongKindAnchorIds = wrongKindAnchorIds;
19
+ exports.anchorListDiagnostics = anchorListDiagnostics;
18
20
  // @implements A-SPEC-504.1
19
21
  // The ONE string-literal preprocessing every anchor-judging surface shares. Measured 2026-09-01:
20
22
  // the coverage scanner stripped literals while the claim gate judged raw text, so a legitimate
@@ -123,3 +125,46 @@ function anchorSpecSites(text) {
123
125
  function wrongKindAnchorIds(text) {
124
126
  return [...new Set(implementsIdLists(text).flat().filter((id) => !id.startsWith('A-SPEC-')))];
125
127
  }
128
+ const ID_RE = new RegExp(ID, 'g');
129
+ const DROPPED_TAIL_RE = new RegExp(String.raw `^[ \t]*(?:([;|&/])[ \t]*|(and)[ \t]+)(${ID})`);
130
+ const DROPPED_COMMA_RE = new RegExp(String.raw `^(?:[ \t]*,[ \t]*${ID})+`);
131
+ /**
132
+ * @implements A-SPEC-768.1
133
+ * Measured 2026-10-11 (SWE-bench Sphinx 11510, HB arm): `# @implements A-SPEC-107; A-SPEC-122` attributed the file
134
+ * to A-SPEC-107 only and nothing said so — the C12 shape again, with a new separator. The grammar above stays the ONE
135
+ * grammar; this names what it does not read, per marker: the first `;`, `|`, `&`, `/` or `and` that follows the comma
136
+ * chain and is itself followed by a governed id, with every id of the chain after it. String literals are stripped the
137
+ * same way the anchor readers strip them, so a diagnostic never names text some code merely holds.
138
+ */
139
+ function anchorListDiagnostics(text) {
140
+ const stripped = stripStringLiterals(text);
141
+ const out = [];
142
+ let line = 1;
143
+ let lineAt = 0;
144
+ for (const m of stripped.matchAll(LIST_RE)) {
145
+ const at = m.index ?? 0;
146
+ for (; lineAt < at; lineAt++)
147
+ if (stripped.charCodeAt(lineAt) === 10)
148
+ line++;
149
+ let pos = at + m[0].length;
150
+ let separator = null;
151
+ const dropped = [];
152
+ for (;;) {
153
+ const tail = DROPPED_TAIL_RE.exec(stripped.slice(pos));
154
+ if (!tail)
155
+ break;
156
+ separator ??= tail[1] ?? tail[2];
157
+ dropped.push(tail[3]);
158
+ pos += tail[0].length;
159
+ const chain = DROPPED_COMMA_RE.exec(stripped.slice(pos));
160
+ if (chain) {
161
+ for (const id of chain[0].matchAll(ID_RE))
162
+ dropped.push(id[0]);
163
+ pos += chain[0].length;
164
+ }
165
+ }
166
+ if (separator !== null)
167
+ out.push({ line, separator, dropped });
168
+ }
169
+ return out;
170
+ }
@@ -135,4 +135,16 @@ export declare function extractAnchors(source: string): string[];
135
135
  * paths → the impacted-spec ids they anchor. Pure-ish (fs read only); resilient to unreadable files.
136
136
  */
137
137
  export declare function scanTestAnchors(root: string): Record<string, string[]>;
138
+ /**
139
+ * @implements A-SPEC-768.1
140
+ * The anchor lists in test files that the comma grammar does not read (`A; B`, `A | B`, `A and B`): the same files
141
+ * `scanTestAnchors` attributes, the same string stripping, and only lines that are anchor lines (a comment with the
142
+ * marker) — so a diagnostic names exactly an attribution the scan above could not make.
143
+ */
144
+ export declare function scanTestAnchorDiagnostics(root: string): Array<{
145
+ file: string;
146
+ line: number;
147
+ separator: string;
148
+ dropped: string[];
149
+ }>;
138
150
  export declare function computeTestScope(impactedSpecsRaw: string[], testAnchors: Record<string, string[]>, specs: Spec[], coverageGaps?: string[], cfg?: TestScopeThresholds, extras?: TestScopeExtras): TestScope;
@@ -40,8 +40,9 @@ exports.stripCode = stripCode;
40
40
  exports.countTestCases = countTestCases;
41
41
  exports.extractAnchors = extractAnchors;
42
42
  exports.scanTestAnchors = scanTestAnchors;
43
+ exports.scanTestAnchorDiagnostics = scanTestAnchorDiagnostics;
43
44
  exports.computeTestScope = computeTestScope;
44
- // @implements A-SPEC-121.2, A-SPEC-734, A-SPEC-750, A-SPEC-750.1
45
+ // @implements A-SPEC-121.2, A-SPEC-734, A-SPEC-750, A-SPEC-750.1, A-SPEC-768.1
45
46
  const anchor_ids_1 = require("./anchor-ids");
46
47
  const fs = __importStar(require("node:fs"));
47
48
  const path = __importStar(require("node:path"));
@@ -618,6 +619,15 @@ function describeUnresolved(entries) {
618
619
  */
619
620
  function scanTestAnchors(root) {
620
621
  const out = {};
622
+ forEachTestFile(root, (rel, text) => {
623
+ const ids = extractAnchors(text);
624
+ if (ids.length)
625
+ out[rel] = ids;
626
+ });
627
+ return out;
628
+ }
629
+ /** The one walk `scanTestAnchors` and `scanTestAnchorDiagnostics` share: every readable regular test file under `root`. */
630
+ function forEachTestFile(root, visit) {
621
631
  const walk = (dir) => {
622
632
  let entries;
623
633
  try {
@@ -647,12 +657,27 @@ function scanTestAnchors(root) {
647
657
  catch {
648
658
  continue;
649
659
  }
650
- const ids = extractAnchors(text);
651
- if (ids.length)
652
- out[rel] = ids;
660
+ visit(rel, text);
653
661
  }
654
662
  };
655
663
  walk(root);
664
+ }
665
+ /**
666
+ * @implements A-SPEC-768.1
667
+ * The anchor lists in test files that the comma grammar does not read (`A; B`, `A | B`, `A and B`): the same files
668
+ * `scanTestAnchors` attributes, the same string stripping, and only lines that are anchor lines (a comment with the
669
+ * marker) — so a diagnostic names exactly an attribution the scan above could not make.
670
+ */
671
+ function scanTestAnchorDiagnostics(root) {
672
+ const out = [];
673
+ forEachTestFile(root, (rel, text) => {
674
+ const lines = (0, anchor_ids_1.stripStringLiterals)(text).split('\n');
675
+ for (const d of (0, anchor_ids_1.anchorListDiagnostics)(text)) {
676
+ IMPL_LINE_RE.lastIndex = 0;
677
+ if (IMPL_LINE_RE.test(lines[d.line - 1] ?? ''))
678
+ out.push({ file: rel, ...d });
679
+ }
680
+ });
656
681
  return out;
657
682
  }
658
683
  function computeTestScope(impactedSpecsRaw, testAnchors, specs, coverageGaps = [], cfg, extras) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "@implements A-SPEC-209",
3
3
  "name": "@holmes-lab/holmes-kit",
4
- "version": "0.35.16",
4
+ "version": "0.35.17",
5
5
  "description": "Holmes-Kit — deterministic Agentic Software Engineering (ASE) harness with causal traceability (spec chain + D-CPG + RTM + phase guardrail)",
6
6
  "main": "dist/holmes/mcp/server.js",
7
7
  "types": "dist/holmes/mcp/server.d.ts",
@@ -137,12 +137,33 @@ npm publish --access public
137
137
 
138
138
  ### 6단계: 외부 문서 표면 (External Docs Reach) — 발행이 닿는 곳까지 정직하게
139
139
 
140
- npm 만 갱신하고 끝나면, 사람들이 실제로 읽는 문서는 낡은 채로 남는다. **사고 이력**: 이 저장소에는
140
+ npm 만 갱신하고 끝나면, 사람들이 실제로 읽는 문서는 낡은 채로 남는다. **사고 이력 1**: 이 저장소에는
141
141
  GitHub 리모트가 없어(origin 이 로컬 gitea) 0.16.0·0.17.0·0.18.0 **세 릴리스 동안** GitHub README 가
142
- 한 번도 갱신되지 않았고, `package.json` 의 `homepage` 가 바로 그 문서를 가리킨다.
142
+ 한 번도 갱신되지 않았고, `package.json` 의 `homepage` 가 바로 그 문서를 가리킨다. **사고 이력 2
143
+ (2026-10-11 측정)**: 아래 4a 가 0.35.13 에 쓰인 뒤에도 GitHub 의 `.ax/badges/traced.svg` 는 **v0.27.0
144
+ (2026-09-20) 의 숫자 그대로**였고, GitHub README 는 v0.35.10 에서 멈춰 0.35.11–0.35.16 **여섯 릴리스**가
145
+ 올라가지 않았다 — 문장은 있었지만 **한 것을 증명하라는 요구가 없어서** 매번 조용히 건너뛰어졌다.
143
146
 
144
147
  **발행이 성공한 뒤에만** 실행한다 — 실패한 릴리스의 문서를 최신이라고 주장하지 않는다.
145
148
 
149
+ > [!IMPORTANT]
150
+ > **이 단계는 릴리스의 일부이고, 보고로 증명한다.** 릴리스 완료 보고(5단계 뒤)에는 다음 세 줄이 **반드시**
151
+ > 있어야 하며, 하나라도 비어 있으면 그 릴리스는 끝나지 않은 것이다:
152
+ > `README: 원격 sha <전> → <후>, 재조회 일치 yes/no` · `badge: 원격 sha <전> → <후>, 재조회 일치 yes/no` ·
153
+ > `SKIP 사유: <없음 | 정확한 사유>`. "동기화했다"는 문장은 이 세 줄이 아니다.
154
+
155
+ 가장 짧은 실행 경로(두 파일을 같은 방식으로; `<owner>/<repo>` 는 1 에서 파생한 값):
156
+
157
+ ```bash
158
+ for f in README.md .ax/badges/traced.svg; do
159
+ before=$(gh api "repos/<owner>/<repo>/contents/$f" --jq .sha)
160
+ gh api --method PUT "repos/<owner>/<repo>/contents/$f" \
161
+ -f message="docs: sync $f with vX.Y.Z" -f sha="$before" \
162
+ -f content="$(base64 < "$f" | tr -d '\n')" --jq .content.sha
163
+ gh api "repos/<owner>/<repo>/contents/$f" --jq .content | tr -d '\n' | base64 -d | cmp - "$f" && echo "$f: 재조회 일치"
164
+ done
165
+ ```
166
+
146
167
  1. **대상 파생 (하드코딩 금지)**: `package.json` 의 `repository` 에서 `<owner>/<repo>` 를 얻는다
147
168
  (`repoTargetFrom`). 이 플레이북은 **소비 프로젝트에도 설치**되므로 특정 저장소를 박아 두면 남의
148
169
  릴리스가 그 저장소를 덮어쓴다. 파생 실패 → **SKIP(사유: `repository` 필드 없음/비-GitHub)**.
@@ -152,10 +173,12 @@ GitHub 리모트가 없어(origin 이 로컬 gitea) 0.16.0·0.17.0·0.18.0 **세
152
173
  3. **동기화**: 로컬 `README.md` 를 `gh api --method PUT` 으로 올린다(`sha` 는 2 에서 읽은 값).
153
174
  4. **재조회 검증**: 다시 읽어 로컬과 일치하는지 확인한다. **쓴 것과 남은 것은 다를 수 있다** —
154
175
  검증 없는 "갱신했다"는 주장이지 사실이 아니다.
155
- 4a. **추적 배지도 같은 표면이다**: 로컬에 `.ax/badges/traced.svg` 가 있으면 README 와 **같은 대상
156
- `<owner>/<repo>`** 의 같은 경로를 2~4 와 똑같이 다룬다 — 원격을 먼저 읽어 차이를 보고하고, 올리고,
157
- **배지도 다시 읽어** 로컬과 일치하는지 확인한다. README 만 올리면 원격 README 는 새 숫자를 말하고
158
- 그림은 옛 숫자를 보여 준다. 배지 파일이 없으면 **SKIP(사유: 배지를 쓰지 않는 프로젝트)**.
176
+ 4a. **추적 배지도 같은 표면이다 — README 와 한 쌍으로, 같은 루프 안에서**: 로컬에 `.ax/badges/traced.svg` 가
177
+ 있으면 README 와 **같은 대상 `<owner>/<repo>`** 의 같은 경로를 2~4 와 똑같이 다룬다 — 원격을 먼저 읽어
178
+ 차이를 보고하고, 올리고, **배지도 다시 읽어** 로컬과 일치하는지 확인한다. README 만 올리면 원격 README 는
179
+ 새 숫자를 말하고 그림은 옛 숫자를 보여 준다(사고 이력 2: 그림이 **스물한 릴리스** 전 숫자였다). 배지
180
+ 파일이 없으면 **SKIP(사유: 배지를 쓰지 않는 프로젝트)**. 2.55단계의 재측정은 **로컬** 배지를 고치는
181
+ 것이고, 이 항목은 **원격** 배지를 고치는 것이다 — 둘은 서로를 대신하지 않는다.
159
182
  5. **profile README drift 감지 (자동 수정 금지)**: `<owner>/.github` 의 `profile/README.md` 를 읽어
160
183
  `profileDriftFindings` 로 주장-현실 불일치를 **보고만** 한다. 포지셔닝 문안은 오너 결정이며
161
184
  릴리스 절차가 정할 것이 아니다.
@@ -1,13 +0,0 @@
1
- /**
2
- * Whether `text` names one of `verbs` as a shell word, rather than as letters inside another word.
3
- *
4
- * Measured 2026-10-04: `\bverb\b` matched `install` in `docs/install-guide.md` and `ln` in `grep -ln`, so read-only
5
- * commands were refused as file writes. A verb occurrence still counts in every spelling a shell runs it under
6
- * (`cp`, `/usr/bin/install`, `'cp'`, `cp.exe`, `--to-command=tee`, `rsync-ssl`); only two shapes do not:
7
- * a. the word is a single-dash option cluster of letters and digits (`-ln`, `-rm1`);
8
- * b. inside the word the verb is followed by `/`, or the word ends in a file extension other than `.exe`.
9
- * Callers keep their own matching for what the verb targets — this answers only "is there such a verb at all", so a
10
- * caller's verdict is removed only when the whole text holds no counting occurrence. One pass: a word's shape is read
11
- * once however many occurrences it holds.
12
- */
13
- export declare function namesWriteVerb(text: string, verbs: RegExp): boolean;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.namesWriteVerb = namesWriteVerb;
4
- // @implements A-SPEC-747.1
5
- /** A shell word ends at white space or at one of `;|&()<>`. */
6
- function isBreak(code) {
7
- return code === 32 || code === 9 || code === 10 || code === 13 || code === 11 || code === 12
8
- || code === 59 || code === 124 || code === 38 || code === 40 || code === 41 || code === 60 || code === 62;
9
- }
10
- /**
11
- * Whether `text` names one of `verbs` as a shell word, rather than as letters inside another word.
12
- *
13
- * Measured 2026-10-04: `\bverb\b` matched `install` in `docs/install-guide.md` and `ln` in `grep -ln`, so read-only
14
- * commands were refused as file writes. A verb occurrence still counts in every spelling a shell runs it under
15
- * (`cp`, `/usr/bin/install`, `'cp'`, `cp.exe`, `--to-command=tee`, `rsync-ssl`); only two shapes do not:
16
- * a. the word is a single-dash option cluster of letters and digits (`-ln`, `-rm1`);
17
- * b. inside the word the verb is followed by `/`, or the word ends in a file extension other than `.exe`.
18
- * Callers keep their own matching for what the verb targets — this answers only "is there such a verb at all", so a
19
- * caller's verdict is removed only when the whole text holds no counting occurrence. One pass: a word's shape is read
20
- * once however many occurrences it holds.
21
- */
22
- function namesWriteVerb(text, verbs) {
23
- const re = new RegExp(verbs.source, verbs.flags.includes('g') ? verbs.flags : `${verbs.flags}g`);
24
- let wordStart = -1;
25
- let wordEnd = -1;
26
- let cluster = false;
27
- let extension = false;
28
- for (let m = re.exec(text); m !== null; m = re.exec(text)) {
29
- if (m[0].length === 0) {
30
- re.lastIndex++;
31
- continue;
32
- }
33
- const at = m.index;
34
- if (at < wordStart || at >= wordEnd) {
35
- let s = at;
36
- while (s > 0 && !isBreak(text.charCodeAt(s - 1)))
37
- s--;
38
- let e = at;
39
- while (e < text.length && !isBreak(text.charCodeAt(e)))
40
- e++;
41
- wordStart = s;
42
- wordEnd = e;
43
- const raw = text.slice(s, e);
44
- cluster = /^-[A-Za-z0-9]+$/.test(raw);
45
- const ext = /\.([A-Za-z0-9]{1,8})$/.exec(raw.replace(/["'\\]/g, ''));
46
- extension = ext !== null && ext[1].toLowerCase() !== 'exe';
47
- }
48
- if (cluster || extension)
49
- continue;
50
- if (text.charCodeAt(at + m[0].length) === 47)
51
- continue; // the verb is a directory name inside a path
52
- return true;
53
- }
54
- return false;
55
- }