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
@@ -8,7 +8,7 @@ export interface KeywordMatcher {
8
8
  index: number;
9
9
  text: string;
10
10
  } | undefined;
11
- /** Equality under the exact matcher semantics, rather than case folding. */
11
+ /** Equality under the exact matcher rules, rather than case folding. */
12
12
  equivalent(other: KeywordMatcher): boolean;
13
13
  }
14
14
  export interface PreparedKeywordQuery {
@@ -19,5 +19,5 @@ export interface PreparedKeywordQuery {
19
19
  test(text: string): boolean;
20
20
  }
21
21
  export declare const escapeRegex: (value: string) => string;
22
- /** Prepare the natural-keyword semantics shared by ranking and localization. */
22
+ /** Prepare the natural-keyword rules shared by ranking and localization. */
23
23
  export declare const prepareKeywordQuery: (query: string) => PreparedKeywordQuery;
@@ -29,7 +29,7 @@ const matcher = (term) => {
29
29
  && new RegExp(`^(?:${escapeRegex(other.term)})$`, "i").test(term),
30
30
  };
31
31
  };
32
- /** Prepare the natural-keyword semantics shared by ranking and localization. */
32
+ /** Prepare the natural-keyword rules shared by ranking and localization. */
33
33
  export const prepareKeywordQuery = (query) => {
34
34
  const raw = query.trim().split(/\s+/).filter(Boolean);
35
35
  const meaningful = raw.filter((term) => !STOPWORDS.has(term.toLowerCase()) && term.length > 1);
@@ -26,7 +26,7 @@ const countMatches = (hay, terms) => terms.reduce((count, term) => count + Numbe
26
26
  // ── BM25-lite scoring ──
27
27
  const BM25_K = 1.2;
28
28
  const BM25_B = 0.75;
29
- /** Count non-overlapping literal occurrences with the prepared matcher's semantics. */
29
+ /** Count non-overlapping literal occurrences with the prepared matcher's rules. */
30
30
  const termFreq = (text, matcher) => {
31
31
  let count = 0, offset = 0;
32
32
  for (;;) {
@@ -86,12 +86,12 @@ const TOOL_ARGS_BUDGET = 2000;
86
86
  /**
87
87
  * Tool name of the recall tool itself (src/tools/recall.ts). A search
88
88
  * operation must not match its own query or its own prior output: the
89
- * tuck_recall or tuck_search invocation is persisted as an ordinary assistant toolCall (its
89
+ * lookup invocation is persisted as an ordinary assistant toolCall (its
90
90
  * `{ query }` argument, excluded below in `toolCallArgsText`) followed by an
91
91
  * ordinary toolResult message (its `N matches for "<query>"` text, excluded
92
92
  * in `fullText`) — without both exclusions a repeated query keeps matching
93
93
  * its own prior invocation/output and the hit count grows on every search.
94
- * This is a targeted introspection invariant for the two named history lookup tools, not a
94
+ * This is a targeted introspection invariant for recognized history lookup tools, not a
95
95
  * general allowlist/blocklist over tool names or tool results.
96
96
  */
97
97
  /** Text of every toolCall's arguments in a message's content, for search —
@@ -143,7 +143,7 @@ const fullText = (msg) => {
143
143
  * stopword filtering and case/duplicate normalization (see the
144
144
  * `effectiveTermCount >= 2` gate below `searchEntriesDetailed` uses before
145
145
  * calling `applyRelativeFloor`). Distinct, not raw count: "auth auth" or
146
- * "Auth AUTH" is semantically a single-term query and must bypass the floor
146
+ * "Auth AUTH" is a single-term query after normalization and must bypass the floor
147
147
  * like any other single term — repeating or casing a word doesn't turn it
148
148
  * into the multi-term OR-tail noise this floor targets. The normalization is
149
149
  * gate-only; it doesn't change `terms` or the BM25 scoring itself, which
@@ -226,7 +226,7 @@ export const searchEntriesDetailed = (entries, messages, query, tuning) => {
226
226
  // apply the hard cap.
227
227
  scored.sort((a, b) => b.score - a.score);
228
228
  // Gate on DISTINCT normalized terms, not raw term count: "auth auth" or
229
- // "Auth AUTH" is semantically a single-term query and must bypass the
229
+ // "Auth AUTH" is a single-term query after normalization and must bypass the
230
230
  // floor like any other single term — repeating/casing a word doesn't turn
231
231
  // it into the multi-term OR-tail noise this floor targets. This is a
232
232
  // gate-only normalization; it does not change `terms` itself or the BM25
@@ -44,7 +44,8 @@ export const splitSummary = (summary) => {
44
44
  return undefined;
45
45
  // A summary saved before the rename keeps its records byte for byte (their lengths are checked); only its closing is pointed at the
46
46
  // tools the model has now.
47
- const closing = header === LEGACY_TRANSCRIPT_HEADER ? summary.slice(at).replaceAll("vcc_recall", "tuck_recall").replaceAll("vcc_search", "tuck_search") : summary.slice(at);
47
+ const closing = summary.slice(at).replaceAll("vcc_recall", "tuck_recall").replaceAll("vcc_search", "tuck_recall")
48
+ .replaceAll("tuck_search", "tuck_recall").replaceAll("tuck_recall or tuck_recall", "tuck_recall");
48
49
  return { body: summary.slice(header.length + 1, at), closing, version: header === TRANSCRIPT_HEADER ? 2 : 1 };
49
50
  };
50
51
  const LEGACY_RECEIPT_RANGE_NOTICE = RECEIPT_RANGE_NOTICE.replace("tuck_recall", "vcc_recall");