pi-braid 0.43.33 → 0.43.35

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
@@ -96,6 +96,33 @@ record; the tag scheme above applies unchanged.
96
96
  note that a clean disable releases it, because a refusal an operator cannot act on
97
97
  is a support ticket.
98
98
 
99
+ ## Core — 0.43.35 (2026-11-08: a merge report that leads with its own verdict)
100
+
101
+ - **Two paths merged nothing and told a reader two different stories.** The refusal family opened with
102
+ `NOT merged:` while the already-contained path opened by naming the worker and buried "Nothing merged"
103
+ mid-sentence, under a `(deleted)` line and a diff summary that follows every outcome. A seat read that
104
+ block as a completion and had merged nothing. Every outcome now opens with one of three tokens —
105
+ `MERGED:`, `NOTHING merged:`, `NOT merged:` — across all eighteen return sites, so the first line says
106
+ which of the three happened.
107
+ - **A no-op names where the work actually is.** When the named branch's tip is the base itself, the report
108
+ reads every other `worker/<id>/*` branch and names any that carries a commit the base does not hold,
109
+ with its tip and the command that merges it. That is the shape a split branch leaves behind: the
110
+ registry row keeps the branch the tool created, the work landed on one the seat made by hand.
111
+ - **Three outcomes, three tokens, one vocabulary**, held by the verify-and-merge verdict fixture: the
112
+ split-branch no-op, the refusal, and a fast-forward twelve commits ahead that must still report
113
+ `MERGED:` first.
114
+
115
+ ## Core — 0.43.34 (2026-11-07: a receipt that names a session file must name one that exists)
116
+
117
+ - **A close receipt is meant to be re-runnable, and a hand-typed path is not.** Three closes in one
118
+ day recorded a session path that had never existed; the string looked exactly like the real thing and
119
+ nothing but a reader noticed. The close-gate reader gains predicate (e): a row that names a `.jsonl`
120
+ file which is not on disk is refused with the path, in shadow mode as a logged line and in enforce
121
+ mode before any write. Outputs a step produces are not references and are not judged, so a command
122
+ that creates a file is untouched.
123
+ - **The recorded instance joins the pinned table**, with its repaired form naming the path through the
124
+ variable the operator actually has.
125
+
99
126
  ## Core — 0.43.33 (2026-11-07: a refusal that names the cell moves the model, not the key)
100
127
 
101
128
  - **The serving cell's capacity is a fact about the model, not about a credential.** Two refusals —
package/build-info.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pi-braid",
3
- "version": "0.43.33",
4
- "sha": "a0a4432ed5510a3b89184583838a314103855a5f",
5
- "shaShort": "a0a4432e",
3
+ "version": "0.43.35",
4
+ "sha": "7c53b109f9d29a3996ea7f02cdafa74b9920c1ff",
5
+ "shaShort": "7c53b109",
6
6
  "branch": "detached",
7
7
  "dirty": false,
8
- "packedAt": "2026-11-07T09:26:18.671Z"
8
+ "packedAt": "2026-11-07T22:07:03.855Z"
9
9
  }
@@ -112,6 +112,36 @@ function censusAt(revision, repoRoot) {
112
112
  return null;
113
113
  return out === "" ? 0 : out.split("\n").length;
114
114
  }
115
+ /**
116
+ * The branches matching `worker/<id>/*` that carry a commit the base does not
117
+ * hold, excluding the branch just verified. Read when that branch's tip is the
118
+ * base itself: that is the shape a split branch makes — the registry row keeps
119
+ * the branch creation made, the work landed on a second one — and the report
120
+ * has to name where the work is, not only where it is not.
121
+ */
122
+ function unmergedWorkerBranches(workerId, namedBranch, base, repoRoot) {
123
+ // The id sits inside a ref glob; anything git could read as a pattern would
124
+ // widen the census past this worker's own branches.
125
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(workerId))
126
+ return [];
127
+ const out = git(repoRoot, [
128
+ "for-each-ref",
129
+ "--format=%(refname:short) %(objectname)",
130
+ `refs/heads/worker/${workerId}/*`,
131
+ ]);
132
+ if (!out)
133
+ return [];
134
+ const found = [];
135
+ for (const line of out.split("\n")) {
136
+ const [name, tip] = line.trim().split(/\s+/);
137
+ if (!name || !tip || name === namedBranch)
138
+ continue;
139
+ if (isAncestor(tip, base, repoRoot))
140
+ continue;
141
+ found.push({ name, tip });
142
+ }
143
+ return found;
144
+ }
115
145
  /**
116
146
  * The gate rows the merge path reads its population record from. A row that
117
147
  * was already closed carries its recorded gates, and those win; the normal
@@ -140,21 +170,21 @@ function verifyAndMergeBase(workerId, workerBranch, base, repoRoot, population)
140
170
  worktreeBranch: getCurrentBranch(repoRoot),
141
171
  });
142
172
  if (!repoRoot || !gitAvailable(repoRoot)) {
143
- return nothingMerged(`Cannot verify ${workerBranch}: no git repository resolved (pass cwd). No merge performed.`);
173
+ return nothingMerged(`NOT merged: no git repository resolved (pass cwd), so ${workerBranch} cannot be verified. No merge performed.`);
144
174
  }
145
175
  if (!isSafeRef(base) || !isSafeRef(workerBranch)) {
146
- return nothingMerged(`Refusing to merge: unsafe ref name (base="${base}", branch="${workerBranch}").`);
176
+ return nothingMerged(`NOT merged: unsafe ref name (base="${base}", branch="${workerBranch}"); refusing to read it.`);
147
177
  }
148
178
  if (!branchExists(workerBranch, repoRoot)) {
149
- return nothingMerged(`Cannot verify ${workerBranch}: branch does not exist. No merge performed.`);
179
+ return nothingMerged(`NOT merged: branch ${workerBranch} does not exist. No merge performed.`);
150
180
  }
151
181
  const baseBefore = revParse(base, repoRoot);
152
182
  if (!baseBefore) {
153
- return nothingMerged(`Cannot merge into "${base}": base branch not found. No merge performed.`);
183
+ return nothingMerged(`NOT merged: base branch "${base}" not found. No merge performed.`);
154
184
  }
155
185
  const tip = revParse(workerBranch, repoRoot);
156
186
  if (!tip) {
157
- return nothingMerged(`Cannot verify ${workerBranch}: branch has no commit. No merge performed.`);
187
+ return nothingMerged(`NOT merged: branch ${workerBranch} has no commit. No merge performed.`);
158
188
  }
159
189
  const short = (sha) => sha.slice(0, 12);
160
190
  const diff = getDiff(workerBranch, base, repoRoot);
@@ -163,7 +193,7 @@ function verifyAndMergeBase(workerId, workerBranch, base, repoRoot, population)
163
193
  // reason a refusal happened, and on a merge it is the recorded-versus-git
164
194
  // pair the merge claim is certified against.
165
195
  const populationNote = population.lines.length > 0 ? `\n${population.lines.join("\n")}` : "";
166
- const finish = (lead, deletedLead, mergeSha, extraWorktreeNote = "") => {
196
+ const finish = (lead, keptReason, mergeSha, extraWorktreeNote = "", deletedNote = "deleted") => {
167
197
  // Where the caller's tree sits is part of the merge result, not a detail:
168
198
  // this tool never switches the shared worktree's branch, so after a merge
169
199
  // made from a tree parked on the worker branch, the next commit lands on
@@ -183,15 +213,29 @@ function verifyAndMergeBase(workerId, workerBranch, base, repoRoot, population)
183
213
  // what the registry now says.
184
214
  const audit = mergeAuditNote(workerId, mergeSha, repoRoot);
185
215
  return {
186
- report: `${lead}${audit}${populationNote}\nBranch: ${workerBranch} (${deleted ? "deleted" : onWorkerBranch ? "kept: this worktree is on it" : deletedLead})${worktreeNote}${settleBlock}\nDiff summary:\n${diff.slice(0, 2000)}\n${scan}`,
216
+ report: `${lead}${audit}${populationNote}\nBranch: ${workerBranch} (${deleted ? deletedNote : onWorkerBranch ? "kept: this worktree is on it" : keptReason})${worktreeNote}${settleBlock}\nDiff summary:\n${diff.slice(0, 2000)}\n${scan}`,
187
217
  mergeSha,
188
218
  worktreeBranch: head,
189
219
  };
190
220
  };
191
221
  // The base already holds the worker's work: nothing to merge, and saying
192
- // "merged" here would be a false success.
222
+ // "merged" here would be a false success. When the named branch's tip is the
223
+ // base itself the branch carries nothing of its own, so the report also
224
+ // names any other branch for this worker that does hold work the base lacks:
225
+ // a seat that created its own branch leaves exactly that shape behind, and
226
+ // "already contained" alone reads as a completion for work that is not in.
193
227
  if (isAncestor(tip, base, repoRoot)) {
194
- return finish(`Worker ${workerId} already contained in ${base}: ${short(tip)} is an ancestor of ${base} (${short(baseBefore)}). Nothing merged.`, "kept: still checked out", null);
228
+ const elsewhere = tip === baseBefore ? unmergedWorkerBranches(workerId, workerBranch, base, repoRoot) : [];
229
+ const elsewhereNote = elsewhere.length === 0
230
+ ? ""
231
+ : "\n" +
232
+ elsewhere
233
+ .map((b) => `Branch ${b.name} for worker ${workerId} carries work not in ${base}: tip ${short(b.tip)}. Merge it: orchestrate action=verify-and-merge workerId=${workerId} branch=${b.name}`)
234
+ .join("\n");
235
+ const lead = tip === baseBefore
236
+ ? `NOTHING merged: worker ${workerId}'s branch ${workerBranch} is already contained in ${base} at ${short(baseBefore)} itself; the branch carries no work of its own. No merge was performed.${elsewhereNote}`
237
+ : `NOTHING merged: worker ${workerId}'s branch ${workerBranch} at ${short(tip)} is already contained in ${base} (${short(baseBefore)}); no work to merge. No merge was performed.${elsewhereNote}`;
238
+ return finish(lead, "kept: still checked out", null, "", "deleted; no merge was performed");
195
239
  }
196
240
  // A recorded population below the census at its own revision is the claim
197
241
  // this read exists to test: the gate certified fewer tracked entries than
@@ -264,7 +308,7 @@ function verifyAndMergeBase(workerId, workerBranch, base, repoRoot, population)
264
308
  if (!baseAfter || baseAfter === baseBefore) {
265
309
  return nothingMerged(`NOT merged: ${base} did not move (still ${short(baseBefore)}) after the merge attempt. No merge is claimed. Locks and branch kept.`);
266
310
  }
267
- return finish(`Worker ${workerId} merged into ${base} at ${short(baseAfter)} (was ${short(baseBefore)}).`, "kept: branch is checked out in a worktree", baseAfter, settleNote);
311
+ return finish(`MERGED: worker ${workerId}'s branch ${workerBranch} merged into ${base} at ${short(baseAfter)} (was ${short(baseBefore)}).`, "kept: branch is checked out in a worktree", baseAfter, settleNote);
268
312
  }
269
313
  /**
270
314
  * The audit-row half of a merge report, on the line below the merge claim. A
@@ -846,8 +890,8 @@ Register the worker (orchestrate action=register-worker) for a structured verdic
846
890
  const entryBranch = entry?.branch ?? undefined;
847
891
  const workerBranch = branch ?? entryBranch ?? lockBranch;
848
892
  if (!workerBranch) {
849
- return textResult(`Worker ${workerId} has no branch to verify: no branch argument, no branch on its ` +
850
- `registry entry, and no lock rows. Nothing to verify.`);
893
+ return textResult(`NOTHING merged: worker ${workerId} has no branch to verify: no branch argument, no ` +
894
+ `branch on its registry entry, and no lock rows.`);
851
895
  }
852
896
  // The close's population record is read before the merge: the stamped
853
897
  // rows are the reporter's own numbers, and the census they are compared
@@ -409,7 +409,7 @@ export declare function recordWorkerMerge(workerId: string, info: {
409
409
  cwd?: string;
410
410
  }): WorkerEntry | null;
411
411
  /** Predicate letters, in the order the four are evaluated. */
412
- export type GateRowPredicate = "a" | "b" | "c" | "d";
412
+ export type GateRowPredicate = "a" | "b" | "c" | "d" | "e";
413
413
  export interface GateRowViolation {
414
414
  predicate: GateRowPredicate;
415
415
  detail: string;
@@ -864,6 +864,33 @@ export function findGateRowViolation(cmd, exit, outcome) {
864
864
  if (outcome === "completed" && exit !== 0) {
865
865
  return { predicate: "d", detail: `exit ${exit} recorded under a completed outcome` };
866
866
  }
867
+ // (e) A row that names a session file is a receipt for a command someone can
868
+ // re-run. A path that does not exist cannot be re-run at all, and a hand-typed
869
+ // near-copy of a real name reads exactly like the real thing: three closes in
870
+ // one day recorded a session path that had never existed, and nothing but the
871
+ // reader noticed. Only `.jsonl` references are read, because that is what a
872
+ // recorded check names; outputs a step writes are not references and are not
873
+ // judged.
874
+ const missing = missingSessionPathIn(cmd);
875
+ if (missing !== null) {
876
+ return {
877
+ predicate: "e",
878
+ detail: `refers to a session file that does not exist: ${missing}`,
879
+ };
880
+ }
881
+ return null;
882
+ }
883
+ /** Absolute-ish `.jsonl` references in a row that are not on disk. */
884
+ function missingSessionPathIn(cmd) {
885
+ for (const raw of cmd.split(/\s+/u)) {
886
+ const token = raw.replace(/^["']|["',;)]+$/gu, "");
887
+ if (!token.endsWith(".jsonl"))
888
+ continue;
889
+ if (!token.includes("/"))
890
+ continue;
891
+ if (!existsSync(token))
892
+ return token;
893
+ }
867
894
  return null;
868
895
  }
869
896
  /** Where close-gate refusals land: one JSONL line per failing row. */
package/docs/LOCAL_DEV.md CHANGED
@@ -138,7 +138,7 @@ before and after a full run. A non-zero delta is the leak this rule prevents.
138
138
  ### New fixtures: use `node:test`
139
139
 
140
140
  A new fixture is written on `node:test`. The runner does not care which style a
141
- file uses - 111 of the core suite's 345 fixtures already use `node:test` - so the
141
+ file uses - 112 of the core suite's 346 fixtures already use `node:test` - so the
142
142
  reason is the failure the other style produces. A hand-rolled helper that calls
143
143
  `fn()` without awaiting it discards the case's promise, so an `async` case runs
144
144
  detached and the file can print its green tally before that case settles, with
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-braid",
3
- "version": "0.43.33",
3
+ "version": "0.43.35",
4
4
  "description": "🥨 Braid - Metacognitive extension suite for pi coding agent: Adds memory, plan tracking, structured cognitive signals and completion checks on top of pi core loop, so long sessions keep their context and stop claiming unfinished work.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -175,6 +175,38 @@ function censusAt(revision: string, repoRoot: string | undefined): number | null
175
175
  return out === "" ? 0 : out.split("\n").length;
176
176
  }
177
177
 
178
+ /**
179
+ * The branches matching `worker/<id>/*` that carry a commit the base does not
180
+ * hold, excluding the branch just verified. Read when that branch's tip is the
181
+ * base itself: that is the shape a split branch makes — the registry row keeps
182
+ * the branch creation made, the work landed on a second one — and the report
183
+ * has to name where the work is, not only where it is not.
184
+ */
185
+ function unmergedWorkerBranches(
186
+ workerId: string,
187
+ namedBranch: string,
188
+ base: string,
189
+ repoRoot: string,
190
+ ): Array<{ name: string; tip: string }> {
191
+ // The id sits inside a ref glob; anything git could read as a pattern would
192
+ // widen the census past this worker's own branches.
193
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(workerId)) return [];
194
+ const out = git(repoRoot, [
195
+ "for-each-ref",
196
+ "--format=%(refname:short) %(objectname)",
197
+ `refs/heads/worker/${workerId}/*`,
198
+ ]);
199
+ if (!out) return [];
200
+ const found: Array<{ name: string; tip: string }> = [];
201
+ for (const line of out.split("\n")) {
202
+ const [name, tip] = line.trim().split(/\s+/);
203
+ if (!name || !tip || name === namedBranch) continue;
204
+ if (isAncestor(tip, base, repoRoot)) continue;
205
+ found.push({ name, tip });
206
+ }
207
+ return found;
208
+ }
209
+
178
210
  /**
179
211
  * The gate rows the merge path reads its population record from. A row that
180
212
  * was already closed carries its recorded gates, and those win; the normal
@@ -224,29 +256,25 @@ function verifyAndMergeBase(
224
256
 
225
257
  if (!repoRoot || !gitAvailable(repoRoot)) {
226
258
  return nothingMerged(
227
- `Cannot verify ${workerBranch}: no git repository resolved (pass cwd). No merge performed.`,
259
+ `NOT merged: no git repository resolved (pass cwd), so ${workerBranch} cannot be verified. No merge performed.`,
228
260
  );
229
261
  }
230
262
  if (!isSafeRef(base) || !isSafeRef(workerBranch)) {
231
263
  return nothingMerged(
232
- `Refusing to merge: unsafe ref name (base="${base}", branch="${workerBranch}").`,
264
+ `NOT merged: unsafe ref name (base="${base}", branch="${workerBranch}"); refusing to read it.`,
233
265
  );
234
266
  }
235
267
  if (!branchExists(workerBranch, repoRoot)) {
236
- return nothingMerged(
237
- `Cannot verify ${workerBranch}: branch does not exist. No merge performed.`,
238
- );
268
+ return nothingMerged(`NOT merged: branch ${workerBranch} does not exist. No merge performed.`);
239
269
  }
240
270
 
241
271
  const baseBefore = revParse(base, repoRoot);
242
272
  if (!baseBefore) {
243
- return nothingMerged(`Cannot merge into "${base}": base branch not found. No merge performed.`);
273
+ return nothingMerged(`NOT merged: base branch "${base}" not found. No merge performed.`);
244
274
  }
245
275
  const tip = revParse(workerBranch, repoRoot);
246
276
  if (!tip) {
247
- return nothingMerged(
248
- `Cannot verify ${workerBranch}: branch has no commit. No merge performed.`,
249
- );
277
+ return nothingMerged(`NOT merged: branch ${workerBranch} has no commit. No merge performed.`);
250
278
  }
251
279
 
252
280
  const short = (sha: string) => sha.slice(0, 12);
@@ -260,9 +288,10 @@ function verifyAndMergeBase(
260
288
 
261
289
  const finish = (
262
290
  lead: string,
263
- deletedLead: string,
291
+ keptReason: string,
264
292
  mergeSha: string | null,
265
293
  extraWorktreeNote = "",
294
+ deletedNote = "deleted",
266
295
  ): MergeOutcome => {
267
296
  // Where the caller's tree sits is part of the merge result, not a detail:
268
297
  // this tool never switches the shared worktree's branch, so after a merge
@@ -286,7 +315,7 @@ function verifyAndMergeBase(
286
315
  const audit = mergeAuditNote(workerId, mergeSha, repoRoot);
287
316
  return {
288
317
  report: `${lead}${audit}${populationNote}\nBranch: ${workerBranch} (${
289
- deleted ? "deleted" : onWorkerBranch ? "kept: this worktree is on it" : deletedLead
318
+ deleted ? deletedNote : onWorkerBranch ? "kept: this worktree is on it" : keptReason
290
319
  })${worktreeNote}${settleBlock}\nDiff summary:\n${diff.slice(0, 2000)}\n${scan}`,
291
320
  mergeSha,
292
321
  worktreeBranch: head,
@@ -294,13 +323,37 @@ function verifyAndMergeBase(
294
323
  };
295
324
 
296
325
  // The base already holds the worker's work: nothing to merge, and saying
297
- // "merged" here would be a false success.
326
+ // "merged" here would be a false success. When the named branch's tip is the
327
+ // base itself the branch carries nothing of its own, so the report also
328
+ // names any other branch for this worker that does hold work the base lacks:
329
+ // a seat that created its own branch leaves exactly that shape behind, and
330
+ // "already contained" alone reads as a completion for work that is not in.
298
331
  if (isAncestor(tip, base, repoRoot)) {
299
- return finish(
300
- `Worker ${workerId} already contained in ${base}: ${short(tip)} is an ancestor of ${base} (${short(baseBefore)}). Nothing merged.`,
301
- "kept: still checked out",
302
- null,
303
- );
332
+ const elsewhere =
333
+ tip === baseBefore ? unmergedWorkerBranches(workerId, workerBranch, base, repoRoot) : [];
334
+ const elsewhereNote =
335
+ elsewhere.length === 0
336
+ ? ""
337
+ : "\n" +
338
+ elsewhere
339
+ .map(
340
+ (b) =>
341
+ `Branch ${b.name} for worker ${workerId} carries work not in ${base}: tip ${short(
342
+ b.tip,
343
+ )}. Merge it: orchestrate action=verify-and-merge workerId=${workerId} branch=${b.name}`,
344
+ )
345
+ .join("\n");
346
+ const lead =
347
+ tip === baseBefore
348
+ ? `NOTHING merged: worker ${workerId}'s branch ${workerBranch} is already contained in ${base} at ${short(
349
+ baseBefore,
350
+ )} itself; the branch carries no work of its own. No merge was performed.${elsewhereNote}`
351
+ : `NOTHING merged: worker ${workerId}'s branch ${workerBranch} at ${short(
352
+ tip,
353
+ )} is already contained in ${base} (${short(
354
+ baseBefore,
355
+ )}); no work to merge. No merge was performed.${elsewhereNote}`;
356
+ return finish(lead, "kept: still checked out", null, "", "deleted; no merge was performed");
304
357
  }
305
358
 
306
359
  // A recorded population below the census at its own revision is the claim
@@ -399,7 +452,9 @@ function verifyAndMergeBase(
399
452
  }
400
453
 
401
454
  return finish(
402
- `Worker ${workerId} merged into ${base} at ${short(baseAfter)} (was ${short(baseBefore)}).`,
455
+ `MERGED: worker ${workerId}'s branch ${workerBranch} merged into ${base} at ${short(
456
+ baseAfter,
457
+ )} (was ${short(baseBefore)}).`,
403
458
  "kept: branch is checked out in a worktree",
404
459
  baseAfter,
405
460
  settleNote,
@@ -1208,8 +1263,8 @@ Register the worker (orchestrate action=register-worker) for a structured verdic
1208
1263
 
1209
1264
  if (!workerBranch) {
1210
1265
  return textResult(
1211
- `Worker ${workerId} has no branch to verify: no branch argument, no branch on its ` +
1212
- `registry entry, and no lock rows. Nothing to verify.`,
1266
+ `NOTHING merged: worker ${workerId} has no branch to verify: no branch argument, no ` +
1267
+ `branch on its registry entry, and no lock rows.`,
1213
1268
  );
1214
1269
  }
1215
1270
 
@@ -1076,7 +1076,7 @@ function assertGateEvidence(
1076
1076
  // cmd, `sh -n` parses only and `command -v` only looks a token up.
1077
1077
 
1078
1078
  /** Predicate letters, in the order the four are evaluated. */
1079
- export type GateRowPredicate = "a" | "b" | "c" | "d";
1079
+ export type GateRowPredicate = "a" | "b" | "c" | "d" | "e";
1080
1080
 
1081
1081
  export interface GateRowViolation {
1082
1082
  predicate: GateRowPredicate;
@@ -1261,6 +1261,31 @@ export function findGateRowViolation(
1261
1261
  if (outcome === "completed" && exit !== 0) {
1262
1262
  return { predicate: "d", detail: `exit ${exit} recorded under a completed outcome` };
1263
1263
  }
1264
+ // (e) A row that names a session file is a receipt for a command someone can
1265
+ // re-run. A path that does not exist cannot be re-run at all, and a hand-typed
1266
+ // near-copy of a real name reads exactly like the real thing: three closes in
1267
+ // one day recorded a session path that had never existed, and nothing but the
1268
+ // reader noticed. Only `.jsonl` references are read, because that is what a
1269
+ // recorded check names; outputs a step writes are not references and are not
1270
+ // judged.
1271
+ const missing = missingSessionPathIn(cmd);
1272
+ if (missing !== null) {
1273
+ return {
1274
+ predicate: "e",
1275
+ detail: `refers to a session file that does not exist: ${missing}`,
1276
+ };
1277
+ }
1278
+ return null;
1279
+ }
1280
+
1281
+ /** Absolute-ish `.jsonl` references in a row that are not on disk. */
1282
+ function missingSessionPathIn(cmd: string): string | null {
1283
+ for (const raw of cmd.split(/\s+/u)) {
1284
+ const token = raw.replace(/^["']|["',;)]+$/gu, "");
1285
+ if (!token.endsWith(".jsonl")) continue;
1286
+ if (!token.includes("/")) continue;
1287
+ if (!existsSync(token)) return token;
1288
+ }
1264
1289
  return null;
1265
1290
  }
1266
1291