pi-braid 0.43.32 → 0.43.34

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.34 (2026-11-07: a receipt that names a session file must name one that exists)
100
+
101
+ - **A close receipt is meant to be re-runnable, and a hand-typed path is not.** Three closes in one
102
+ day recorded a session path that had never existed; the string looked exactly like the real thing and
103
+ nothing but a reader noticed. The close-gate reader gains predicate (e): a row that names a `.jsonl`
104
+ file which is not on disk is refused with the path, in shadow mode as a logged line and in enforce
105
+ mode before any write. Outputs a step produces are not references and are not judged, so a command
106
+ that creates a file is untouched.
107
+ - **The recorded instance joins the pinned table**, with its repaired form naming the path through the
108
+ variable the operator actually has.
109
+
110
+ ## Core — 0.43.33 (2026-11-07: a refusal that names the cell moves the model, not the key)
111
+
112
+ - **The serving cell's capacity is a fact about the model, not about a credential.** Two refusals —
113
+ `prefill_cap_refused`, `the cell is at capacity` — were unclassified; the ring read the status beside
114
+ them and spent a key, then rotated onto a second route that refused the same turn identically, burning
115
+ that quota too. `classifyFailure` now answers `capacity` before the key test, `isKeyRotationError`
116
+ refuses the vocabulary, and the route the turn lands on is chosen by model id through the route
117
+ table's own translation.
118
+ - **A per-model death, and it is short.** When no other route serves the id the walk records a
119
+ `model-capacity` death scoped to that id with its own freshness bound, so the diagnostic names the cell
120
+ and the minutes instead of asking an operator to fix a credential.
121
+ - **The structural harvest ships beside it.** `mechanism-harvest.mjs` reads pi's session JSONL and emits
122
+ repair-shaped windows — a failing tool result, then a mutation naming the same file or token — with a
123
+ census that adds up (7,933 windows over the corpus, 417 of them file-backed). It is repo-only and never
124
+ published. Its known blind edge is pinned by a fixture rather than rounded off.
125
+
99
126
  ## Core — 0.43.32 (2026-11-06: the identity says what makes a sentence noise)
100
127
 
101
128
  - **Four rules, one of them a test.** The writing block now carries what the reader pays for: a
package/build-info.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pi-braid",
3
- "version": "0.43.32",
4
- "sha": "5a4b393d0c2808282d6422e519bebca2a78feccf",
5
- "shaShort": "5a4b393d",
3
+ "version": "0.43.34",
4
+ "sha": "df1a367634966b692b53c47eab975ee5d88038f0",
5
+ "shaShort": "df1a3676",
6
6
  "branch": "detached",
7
7
  "dirty": false,
8
- "packedAt": "2026-11-06T17:54:09.031Z"
8
+ "packedAt": "2026-11-07T15:12:01.126Z"
9
9
  }
@@ -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 - 110 of the core suite's 344 fixtures already use `node:test` - so the
141
+ file uses - 111 of the core suite's 345 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.32",
3
+ "version": "0.43.34",
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",
@@ -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