pi-tuck 1.0.32 → 1.0.33

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
@@ -3,6 +3,22 @@
3
3
  All notable changes to pi-tuck. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
4
4
  [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [1.0.33] - 2026-11-13
7
+
8
+ ### Fixed
9
+
10
+ - **A file read's recall number pointed at the read call, not at what the read returned.** The summary lists each file the session read
11
+ with a tuck_recall number. That number brought back the call's arguments instead of the file's contents, so recalling a read cost a
12
+ turn and showed nothing useful. It now brings back the read's output.
13
+
14
+ ### Release gates
15
+
16
+ - **Shipped without a live gate under the defect rule.** Replay against 1.0.31, with the read numbers set aside: 13,946 requests, 13,855
17
+ identical, 51 differing only in what the summary had room for, 40 noise, 0 unexplained, 0 lost or dead tasks, clips 17 → 17. The
18
+ fix also ran, inside a larger candidate, through 4 live tasks with no breakage.
19
+ - **Strict stress, 313 cells:** 0 findings on Pi 1.2.0 and the newest Pi. Tests and CI. The packed tarball loaded in the real installed
20
+ Pi 1.5.2.
21
+
6
22
  ## [1.0.32] - 2026-11-13
7
23
 
8
24
  ### Changed
@@ -1 +1 @@
1
- export declare const BUILD_ID = "e221c8f3d2154596f83256c799882e6ff8ac9c954aa63709379a993518932a25";
1
+ export declare const BUILD_ID = "ca81d2cebd530b421127fa0090adc48f14b9532bc7195141dcc4ced449c8f791";
@@ -1 +1 @@
1
- export const BUILD_ID = "e221c8f3d2154596f83256c799882e6ff8ac9c954aa63709379a993518932a25";
1
+ export const BUILD_ID = "ca81d2cebd530b421127fa0090adc48f14b9532bc7195141dcc4ced449c8f791";
@@ -1,6 +1,6 @@
1
1
  import { type RecallPolicy } from './recall.js';
2
2
  import type { SessionEntry } from '@earendil-works/pi-coding-agent';
3
- export declare const DIAGNOSTIC_BUILD = "e221c8f3d2154596f83256c799882e6ff8ac9c954aa63709379a993518932a25";
3
+ export declare const DIAGNOSTIC_BUILD = "ca81d2cebd530b421127fa0090adc48f14b9532bc7195141dcc4ced449c8f791";
4
4
  export interface Receipt {
5
5
  id: string;
6
6
  build: string;
@@ -5,12 +5,15 @@ export declare const MAX_LEDGER_LINES = 60;
5
5
  export declare const LEDGER_HEADING = "Files touched by read, write and edit before this summary, newest first, with the last operation:";
6
6
  /** Never ends inside a surrogate pair, so the head is an exact prefix of whole code points. */
7
7
  export declare const head: (text: string, max: number) => string;
8
- /** One distinct path and its last recorded operation. `sourceIndex` is the entry holding that call;
9
- * `resolvable` says tuck_recall {index} reads it, so only then is the index shown as a locator. */
8
+ /** One distinct path and its last recorded operation. `sourceIndex` is the entry holding that call (the line's own index, so a native
9
+ * omission of the call removes the line). `locatorIndex` is the entry an agent wants back: for a read, the one holding its result (what
10
+ * the file showed; a live check, 2026-11-12: an agent asked for "#13" and got the call); for a write or edit, the call (what was written).
11
+ * `resolvable` says tuck_recall {index} reads the locator, so only then is it shown. A read whose result is missing points at its call. */
10
12
  export interface LedgerItem {
11
13
  path: string;
12
14
  operation: "wrote/edited" | "read";
13
15
  sourceIndex?: number;
16
+ locatorIndex?: number;
14
17
  resolvable: boolean;
15
18
  }
16
19
  /** Paths exactly as recorded in read/write/edit tool-call arguments before the cut, newest last operation first. Nothing is inferred.
@@ -15,6 +15,10 @@ export const head = (text, max) => {
15
15
  /** Paths exactly as recorded in read/write/edit tool-call arguments before the cut, newest last operation first. Nothing is inferred.
16
16
  * A call from a failed or aborted response, a write/edit whose result is an error, and a path with a line break are not listed. */
17
17
  export function ledgerItems(entries, indices, resolvable, failedCalls) {
18
+ const results = new Map();
19
+ for (const entry of entries)
20
+ if (entry.type === "message" && entry.message.role === "toolResult")
21
+ results.set(entry.message.toolCallId, entry);
18
22
  const last = new Map();
19
23
  for (const entry of entries) {
20
24
  if (entry.type !== "message" || entry.message.role !== "assistant")
@@ -29,14 +33,14 @@ export function ledgerItems(entries, indices, resolvable, failedCalls) {
29
33
  if (!operation || !path || /[\r\n]/u.test(path) || operation === "wrote/edited" && failedCalls.has(block.id))
30
34
  continue;
31
35
  last.delete(path);
32
- last.set(path, { path, operation, entry });
36
+ last.set(path, { path, operation, entry, target: operation === "read" ? results.get(block.id) ?? entry : entry });
33
37
  }
34
38
  }
35
39
  // Only listed lines show a locator, so resolvability (which renders the entry) is checked for those alone.
36
- return [...last.values()].reverse().map(({ path, operation, entry }, rank) => {
37
- const sourceIndex = indices.get(entry.id);
38
- return { path, operation, ...(sourceIndex !== undefined ? { sourceIndex } : {}),
39
- resolvable: rank < MAX_LEDGER_LINES && sourceIndex !== undefined && resolvable(entry) };
40
+ return [...last.values()].reverse().map(({ path, operation, entry, target }, rank) => {
41
+ const sourceIndex = indices.get(entry.id), locatorIndex = indices.get(target.id);
42
+ return { path, operation, ...(sourceIndex !== undefined ? { sourceIndex } : {}), ...(locatorIndex !== undefined ? { locatorIndex } : {}),
43
+ resolvable: rank < MAX_LEDGER_LINES && sourceIndex !== undefined && locatorIndex !== undefined && resolvable(target) };
40
44
  });
41
45
  }
42
46
  /** The ledger: a heading, one record per listed path (at most `keep` and the line cap, newest first), then a count of the older ones.
@@ -45,7 +49,7 @@ export function ledgerRecords(items, keep = items.length) {
45
49
  const listed = items.slice(0, Math.max(0, Math.min(keep, MAX_LEDGER_LINES)));
46
50
  const line = (text, sourceIndex) => ({ kind: "section", title: LEDGER_TITLE, text, ...(sourceIndex !== undefined ? { sourceIndex } : {}) });
47
51
  return [line(LEDGER_HEADING),
48
- ...listed.map(item => line(`- ${item.operation} ${item.path}` + (item.resolvable ? ` (tuck_recall {"index":${item.sourceIndex}})` : ""), item.sourceIndex)),
52
+ ...listed.map(item => line(`- ${item.operation} ${item.path}` + (item.resolvable ? ` (tuck_recall {"index":${item.locatorIndex}})` : ""), item.sourceIndex)),
49
53
  ...(items.length ? [] : [line("(none)")]),
50
54
  ...(listed.length < items.length ? [line(`+${items.length - listed.length} older files: use tuck_recall`)] : [])];
51
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-tuck",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "Deterministic compaction for Pi with no model call, plus exact recall of earlier history. Search by meaning on Apple silicon.",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/build-id.ts CHANGED
@@ -1 +1 @@
1
- export const BUILD_ID = "e221c8f3d2154596f83256c799882e6ff8ac9c954aa63709379a993518932a25";
1
+ export const BUILD_ID = "ca81d2cebd530b421127fa0090adc48f14b9532bc7195141dcc4ced449c8f791";
package/src/ledger.ts CHANGED
@@ -16,15 +16,19 @@ export const head = (text: string, max: number): string => {
16
16
  return text.slice(0, /[\uD800-\uDBFF]/u.test(text[max - 1]!) ? max - 1 : max);
17
17
  };
18
18
 
19
- /** One distinct path and its last recorded operation. `sourceIndex` is the entry holding that call;
20
- * `resolvable` says tuck_recall {index} reads it, so only then is the index shown as a locator. */
21
- export interface LedgerItem { path: string; operation: "wrote/edited" | "read"; sourceIndex?: number; resolvable: boolean }
19
+ /** One distinct path and its last recorded operation. `sourceIndex` is the entry holding that call (the line's own index, so a native
20
+ * omission of the call removes the line). `locatorIndex` is the entry an agent wants back: for a read, the one holding its result (what
21
+ * the file showed; a live check, 2026-11-12: an agent asked for "#13" and got the call); for a write or edit, the call (what was written).
22
+ * `resolvable` says tuck_recall {index} reads the locator, so only then is it shown. A read whose result is missing points at its call. */
23
+ export interface LedgerItem { path: string; operation: "wrote/edited" | "read"; sourceIndex?: number; locatorIndex?: number; resolvable: boolean }
22
24
 
23
25
  /** Paths exactly as recorded in read/write/edit tool-call arguments before the cut, newest last operation first. Nothing is inferred.
24
26
  * A call from a failed or aborted response, a write/edit whose result is an error, and a path with a line break are not listed. */
25
27
  export function ledgerItems(entries: readonly SessionEntry[], indices: ReadonlyMap<string, number>, resolvable: (entry: SessionEntry) => boolean,
26
28
  failedCalls: ReadonlySet<string>): LedgerItem[] {
27
- const last = new Map<string, { path: string; operation: LedgerItem["operation"]; entry: SessionEntry }>();
29
+ const results = new Map<string, SessionEntry>();
30
+ for (const entry of entries) if (entry.type === "message" && entry.message.role === "toolResult") results.set(entry.message.toolCallId, entry);
31
+ const last = new Map<string, { path: string; operation: LedgerItem["operation"]; entry: SessionEntry; target: SessionEntry }>();
28
32
  for (const entry of entries) {
29
33
  if (entry.type !== "message" || entry.message.role !== "assistant") continue;
30
34
  if (isDiscardedResponse(entry.message)) continue;
@@ -34,14 +38,14 @@ export function ledgerItems(entries: readonly SessionEntry[], indices: ReadonlyM
34
38
  const path = operation && extractPath(block.arguments as Record<string, unknown>);
35
39
  if (!operation || !path || /[\r\n]/u.test(path) || operation === "wrote/edited" && failedCalls.has(block.id)) continue;
36
40
  last.delete(path);
37
- last.set(path, { path, operation, entry });
41
+ last.set(path, { path, operation, entry, target: operation === "read" ? results.get(block.id) ?? entry : entry });
38
42
  }
39
43
  }
40
44
  // Only listed lines show a locator, so resolvability (which renders the entry) is checked for those alone.
41
- return [...last.values()].reverse().map(({ path, operation, entry }, rank) => {
42
- const sourceIndex = indices.get(entry.id);
43
- return { path, operation, ...(sourceIndex !== undefined ? { sourceIndex } : {}),
44
- resolvable: rank < MAX_LEDGER_LINES && sourceIndex !== undefined && resolvable(entry) };
45
+ return [...last.values()].reverse().map(({ path, operation, entry, target }, rank) => {
46
+ const sourceIndex = indices.get(entry.id), locatorIndex = indices.get(target.id);
47
+ return { path, operation, ...(sourceIndex !== undefined ? { sourceIndex } : {}), ...(locatorIndex !== undefined ? { locatorIndex } : {}),
48
+ resolvable: rank < MAX_LEDGER_LINES && sourceIndex !== undefined && locatorIndex !== undefined && resolvable(target) };
45
49
  });
46
50
  }
47
51
 
@@ -51,7 +55,7 @@ export function ledgerRecords(items: readonly LedgerItem[], keep = items.length)
51
55
  const listed = items.slice(0, Math.max(0, Math.min(keep, MAX_LEDGER_LINES)));
52
56
  const line = (text: string, sourceIndex?: number): TranscriptRecord => ({ kind: "section", title: LEDGER_TITLE, text, ...(sourceIndex !== undefined ? { sourceIndex } : {}) });
53
57
  return [line(LEDGER_HEADING),
54
- ...listed.map(item => line(`- ${item.operation} ${item.path}` + (item.resolvable ? ` (tuck_recall {"index":${item.sourceIndex}})` : ""), item.sourceIndex)),
58
+ ...listed.map(item => line(`- ${item.operation} ${item.path}` + (item.resolvable ? ` (tuck_recall {"index":${item.locatorIndex}})` : ""), item.sourceIndex)),
55
59
  ...(items.length ? [] : [line("(none)")]),
56
60
  ...(listed.length < items.length ? [line(`+${items.length - listed.length} older files: use tuck_recall`)] : [])];
57
61
  }