pi-tuck 1.1.2 → 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.
- package/CHANGELOG.md +65 -0
- package/README.md +7 -3
- package/dist/index.d.ts +2 -6
- package/dist/index.js +16 -111
- package/dist/src/build-id.d.ts +1 -1
- package/dist/src/build-id.js +1 -1
- package/dist/src/compaction.d.ts +2 -103
- package/dist/src/compaction.js +29 -146
- package/dist/src/diagnostic-replay.js +2 -2
- package/dist/src/diagnostics.d.ts +3 -2
- package/dist/src/diagnostics.js +30 -9
- package/dist/src/history-tools.js +3 -3
- package/dist/src/kept-reads.d.ts +2 -2
- package/dist/src/kept-reads.js +144 -8
- package/dist/src/ledger.d.ts +1 -1
- package/dist/src/ledger.js +5 -3
- package/dist/src/legacy-cleanup.d.ts +3 -0
- package/dist/src/legacy-cleanup.js +190 -0
- package/dist/src/notify.d.ts +3 -0
- package/dist/src/notify.js +13 -0
- package/dist/src/omissions.d.ts +1 -1
- package/dist/src/omissions.js +3 -3
- package/dist/src/path-key.d.ts +3 -0
- package/dist/src/path-key.js +8 -0
- package/dist/src/request-capacity.js +1 -1
- package/dist/src/run.d.ts +1 -3
- package/dist/src/run.js +3 -5
- package/dist/src/source-export.d.ts +1 -1
- package/dist/src/source-export.js +1 -1
- package/dist/src/status.d.ts +0 -6
- package/dist/src/status.js +1 -6
- package/dist/src/tuck/core/content.js +6 -9
- package/dist/src/tuck/core/keyword-query.d.ts +2 -2
- package/dist/src/tuck/core/keyword-query.js +1 -1
- package/dist/src/tuck/core/search-entries.js +5 -5
- package/dist/src/tuck/core/transcript.js +2 -1
- package/dist/src/tuck.js +390 -394
- package/dist/src/windows-private-storage.d.ts +9 -0
- package/dist/src/windows-private-storage.js +90 -0
- package/index.ts +18 -82
- package/package.json +5 -8
- package/src/build-id.ts +1 -1
- package/src/compaction.ts +28 -113
- package/src/diagnostic-replay.ts +2 -2
- package/src/diagnostics.ts +24 -9
- package/src/history-tools.ts +3 -3
- package/src/kept-reads.ts +78 -10
- package/src/ledger.ts +5 -3
- package/src/legacy-cleanup.ts +134 -0
- package/src/notify.ts +10 -0
- package/src/omissions.ts +3 -3
- package/src/path-key.ts +9 -0
- package/src/request-capacity.ts +1 -1
- package/src/run.ts +4 -6
- package/src/source-export.ts +1 -1
- package/src/status.ts +1 -10
- package/src/tuck/core/content.ts +5 -10
- package/src/tuck/core/keyword-query.ts +2 -2
- package/src/tuck/core/search-entries.ts +5 -5
- package/src/tuck/core/transcript.ts +2 -1
- package/src/tuck.ts +329 -335
- package/src/windows-private-storage.ts +94 -0
- package/dist/src/assets.d.ts +0 -58
- package/dist/src/assets.js +0 -80
- package/dist/src/eligibility-cache.d.ts +0 -19
- package/dist/src/eligibility-cache.js +0 -33
- package/dist/src/semantic-recall.d.ts +0 -422
- package/dist/src/semantic-recall.js +0 -1386
- package/dist/src/setup.d.ts +0 -3
- package/dist/src/setup.js +0 -191
- package/scripts/eg2-runtime.py +0 -307
- package/scripts/provision-eg2.py +0 -139
- package/scripts/semantic-worker.py +0 -234
- package/src/assets.ts +0 -92
- package/src/eligibility-cache.ts +0 -43
- package/src/semantic-recall.ts +0 -592
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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");
|