pi-tuck 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/index.d.ts +2 -6
  3. package/dist/index.js +16 -111
  4. package/dist/src/build-id.d.ts +1 -1
  5. package/dist/src/build-id.js +1 -1
  6. package/dist/src/compaction.d.ts +2 -103
  7. package/dist/src/compaction.js +20 -140
  8. package/dist/src/diagnostic-replay.js +2 -2
  9. package/dist/src/diagnostics.d.ts +3 -2
  10. package/dist/src/diagnostics.js +30 -9
  11. package/dist/src/history-tools.js +3 -3
  12. package/dist/src/kept-reads.d.ts +2 -2
  13. package/dist/src/kept-reads.js +144 -8
  14. package/dist/src/ledger.d.ts +1 -1
  15. package/dist/src/ledger.js +5 -3
  16. package/dist/src/legacy-cleanup.d.ts +3 -0
  17. package/dist/src/legacy-cleanup.js +190 -0
  18. package/dist/src/notify.d.ts +3 -0
  19. package/dist/src/notify.js +13 -0
  20. package/dist/src/omissions.d.ts +1 -1
  21. package/dist/src/omissions.js +3 -3
  22. package/dist/src/path-key.d.ts +3 -0
  23. package/dist/src/path-key.js +8 -0
  24. package/dist/src/request-capacity.js +1 -1
  25. package/dist/src/run.d.ts +1 -3
  26. package/dist/src/run.js +3 -5
  27. package/dist/src/source-export.d.ts +1 -1
  28. package/dist/src/source-export.js +1 -1
  29. package/dist/src/status.d.ts +0 -6
  30. package/dist/src/status.js +1 -6
  31. package/dist/src/tuck/core/content.js +6 -9
  32. package/dist/src/tuck/core/keyword-query.d.ts +2 -2
  33. package/dist/src/tuck/core/keyword-query.js +1 -1
  34. package/dist/src/tuck/core/search-entries.js +5 -5
  35. package/dist/src/tuck/core/transcript.js +2 -1
  36. package/dist/src/tuck.js +390 -394
  37. package/dist/src/windows-private-storage.d.ts +9 -0
  38. package/dist/src/windows-private-storage.js +90 -0
  39. package/index.ts +18 -82
  40. package/package.json +5 -8
  41. package/src/build-id.ts +1 -1
  42. package/src/compaction.ts +19 -107
  43. package/src/diagnostic-replay.ts +2 -2
  44. package/src/diagnostics.ts +24 -9
  45. package/src/history-tools.ts +3 -3
  46. package/src/kept-reads.ts +78 -10
  47. package/src/ledger.ts +5 -3
  48. package/src/legacy-cleanup.ts +134 -0
  49. package/src/notify.ts +10 -0
  50. package/src/omissions.ts +3 -3
  51. package/src/path-key.ts +9 -0
  52. package/src/request-capacity.ts +1 -1
  53. package/src/run.ts +4 -6
  54. package/src/source-export.ts +1 -1
  55. package/src/status.ts +1 -10
  56. package/src/tuck/core/content.ts +5 -10
  57. package/src/tuck/core/keyword-query.ts +2 -2
  58. package/src/tuck/core/search-entries.ts +5 -5
  59. package/src/tuck/core/transcript.ts +2 -1
  60. package/src/tuck.ts +329 -335
  61. package/src/windows-private-storage.ts +94 -0
  62. package/dist/src/assets.d.ts +0 -58
  63. package/dist/src/assets.js +0 -80
  64. package/dist/src/eligibility-cache.d.ts +0 -19
  65. package/dist/src/eligibility-cache.js +0 -33
  66. package/dist/src/semantic-recall.d.ts +0 -422
  67. package/dist/src/semantic-recall.js +0 -1386
  68. package/dist/src/setup.d.ts +0 -3
  69. package/dist/src/setup.js +0 -191
  70. package/scripts/eg2-runtime.py +0 -307
  71. package/scripts/provision-eg2.py +0 -139
  72. package/scripts/semantic-worker.py +0 -234
  73. package/src/assets.ts +0 -92
  74. package/src/eligibility-cache.ts +0 -43
  75. package/src/semantic-recall.ts +0 -592
  76. package/src/setup.ts +0 -163
@@ -53,7 +53,7 @@ const countMatches = (hay: string, terms: readonly KeywordMatcher[]): number =>
53
53
  const BM25_K = 1.2;
54
54
  const BM25_B = 0.75;
55
55
 
56
- /** Count non-overlapping literal occurrences with the prepared matcher's semantics. */
56
+ /** Count non-overlapping literal occurrences with the prepared matcher's rules. */
57
57
  const termFreq = (text: string, matcher: KeywordMatcher): number => {
58
58
  let count = 0, offset = 0;
59
59
  for (;;) {
@@ -126,12 +126,12 @@ const TOOL_ARGS_BUDGET = 2000;
126
126
  /**
127
127
  * Tool name of the recall tool itself (src/tools/recall.ts). A search
128
128
  * operation must not match its own query or its own prior output: the
129
- * tuck_recall or tuck_search invocation is persisted as an ordinary assistant toolCall (its
129
+ * lookup invocation is persisted as an ordinary assistant toolCall (its
130
130
  * `{ query }` argument, excluded below in `toolCallArgsText`) followed by an
131
131
  * ordinary toolResult message (its `N matches for "<query>"` text, excluded
132
132
  * in `fullText`) — without both exclusions a repeated query keeps matching
133
133
  * its own prior invocation/output and the hit count grows on every search.
134
- * This is a targeted introspection invariant for the two named history lookup tools, not a
134
+ * This is a targeted introspection invariant for recognized history lookup tools, not a
135
135
  * general allowlist/blocklist over tool names or tool results.
136
136
  */
137
137
 
@@ -186,7 +186,7 @@ const fullText = (msg: Message): string => {
186
186
  * stopword filtering and case/duplicate normalization (see the
187
187
  * `effectiveTermCount >= 2` gate below `searchEntriesDetailed` uses before
188
188
  * calling `applyRelativeFloor`). Distinct, not raw count: "auth auth" or
189
- * "Auth AUTH" is semantically a single-term query and must bypass the floor
189
+ * "Auth AUTH" is a single-term query after normalization and must bypass the floor
190
190
  * like any other single term — repeating or casing a word doesn't turn it
191
191
  * into the multi-term OR-tail noise this floor targets. The normalization is
192
192
  * gate-only; it doesn't change `terms` or the BM25 scoring itself, which
@@ -292,7 +292,7 @@ export const searchEntriesDetailed = (
292
292
  // apply the hard cap.
293
293
  scored.sort((a, b) => b.score - a.score);
294
294
  // Gate on DISTINCT normalized terms, not raw term count: "auth auth" or
295
- // "Auth AUTH" is semantically a single-term query and must bypass the
295
+ // "Auth AUTH" is a single-term query after normalization and must bypass the
296
296
  // floor like any other single term — repeating/casing a word doesn't turn
297
297
  // it into the multi-term OR-tail noise this floor targets. This is a
298
298
  // gate-only normalization; it does not change `terms` itself or the BM25
@@ -69,7 +69,8 @@ export const splitSummary = (summary: string): { body: string; closing: string;
69
69
  if (at < 0) return undefined;
70
70
  // A summary saved before the rename keeps its records byte for byte (their lengths are checked); only its closing is pointed at the
71
71
  // tools the model has now.
72
- const closing = header === LEGACY_TRANSCRIPT_HEADER ? summary.slice(at).replaceAll("vcc_recall", "tuck_recall").replaceAll("vcc_search", "tuck_search") : summary.slice(at);
72
+ const closing = summary.slice(at).replaceAll("vcc_recall", "tuck_recall").replaceAll("vcc_search", "tuck_recall")
73
+ .replaceAll("tuck_search", "tuck_recall").replaceAll("tuck_recall or tuck_recall", "tuck_recall");
73
74
  return { body: summary.slice(header.length + 1, at), closing, version: header === TRANSCRIPT_HEADER ? 2 : 1 };
74
75
  };
75
76
  const LEGACY_RECEIPT_RANGE_NOTICE = RECEIPT_RANGE_NOTICE.replace("tuck_recall", "vcc_recall");