@seanhogg/builderforce-memory 2026.10.60 → 2026.10.63
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/dist/knowledge/assetFile.d.ts +3 -1
- package/dist/knowledge/assetFile.d.ts.map +1 -1
- package/dist/knowledge/assetFile.js +2 -2
- package/dist/knowledge/assetFile.js.map +1 -1
- package/dist/knowledge/extractFile.d.ts +2 -0
- package/dist/knowledge/extractFile.d.ts.map +1 -1
- package/dist/knowledge/extractFile.js +2 -2
- package/dist/knowledge/extractFile.js.map +1 -1
- package/dist/knowledge/extractJob.d.ts +3 -1
- package/dist/knowledge/extractJob.d.ts.map +1 -1
- package/dist/knowledge/extractJob.js +1 -1
- package/dist/knowledge/extractJob.js.map +1 -1
- package/dist/knowledge/outline.js +1 -1
- package/dist/knowledge/outline.js.map +1 -1
- package/dist/knowledge/owedFiles.d.ts +2 -0
- package/dist/knowledge/owedFiles.d.ts.map +1 -1
- package/dist/knowledge/owedFiles.js +2 -0
- package/dist/knowledge/owedFiles.js.map +1 -1
- package/dist/knowledge/plan.d.ts +4 -1
- package/dist/knowledge/plan.d.ts.map +1 -1
- package/dist/knowledge/plan.js +11 -4
- package/dist/knowledge/plan.js.map +1 -1
- package/dist/knowledge/reviewModel.d.ts +10 -1
- package/dist/knowledge/reviewModel.d.ts.map +1 -1
- package/dist/knowledge/reviewPrefetch.d.ts.map +1 -1
- package/dist/knowledge/reviewPrefetch.js +11 -5
- package/dist/knowledge/reviewPrefetch.js.map +1 -1
- package/dist/knowledge/sources.d.ts +2 -1
- package/dist/knowledge/sources.d.ts.map +1 -1
- package/dist/knowledge/sources.js +3 -1
- package/dist/knowledge/sources.js.map +1 -1
- package/dist/stats/distributions.d.ts +34 -0
- package/dist/stats/distributions.d.ts.map +1 -0
- package/dist/stats/distributions.js +180 -0
- package/dist/stats/distributions.js.map +1 -0
- package/dist/stats/estimators.d.ts +53 -0
- package/dist/stats/estimators.d.ts.map +1 -0
- package/dist/stats/estimators.js +79 -0
- package/dist/stats/estimators.js.map +1 -0
- package/dist/stats/fitting.d.ts +48 -0
- package/dist/stats/fitting.d.ts.map +1 -0
- package/dist/stats/fitting.js +209 -0
- package/dist/stats/fitting.js.map +1 -0
- package/dist/stats/index.d.ts +26 -0
- package/dist/stats/index.d.ts.map +1 -0
- package/dist/stats/index.js +18 -0
- package/dist/stats/index.js.map +1 -0
- package/dist/stats/information.d.ts +9 -0
- package/dist/stats/information.d.ts.map +1 -0
- package/dist/stats/information.js +21 -0
- package/dist/stats/information.js.map +1 -0
- package/dist/stats/multivariate.d.ts +25 -0
- package/dist/stats/multivariate.d.ts.map +1 -0
- package/dist/stats/multivariate.js +89 -0
- package/dist/stats/multivariate.js.map +1 -0
- package/dist/stats/policies.d.ts +19 -0
- package/dist/stats/policies.d.ts.map +1 -0
- package/dist/stats/policies.js +75 -0
- package/dist/stats/policies.js.map +1 -0
- package/dist/stats/prng.d.ts +11 -0
- package/dist/stats/prng.d.ts.map +1 -0
- package/dist/stats/prng.js +41 -0
- package/dist/stats/prng.js.map +1 -0
- package/dist/stats/scores.d.ts +33 -0
- package/dist/stats/scores.d.ts.map +1 -0
- package/dist/stats/scores.js +134 -0
- package/dist/stats/scores.js.map +1 -0
- package/dist/stats/tests.d.ts +48 -0
- package/dist/stats/tests.d.ts.map +1 -0
- package/dist/stats/tests.js +143 -0
- package/dist/stats/tests.js.map +1 -0
- package/dist/stats/timeSeries.d.ts +34 -0
- package/dist/stats/timeSeries.d.ts.map +1 -0
- package/dist/stats/timeSeries.js +71 -0
- package/dist/stats/timeSeries.js.map +1 -0
- package/dist/working/fold.d.ts +51 -0
- package/dist/working/fold.d.ts.map +1 -0
- package/dist/working/fold.js +218 -0
- package/dist/working/fold.js.map +1 -0
- package/dist/working/index.d.ts +1 -0
- package/dist/working/index.d.ts.map +1 -1
- package/dist/working/index.js +1 -0
- package/dist/working/index.js.map +1 -1
- package/package.json +7 -3
- package/src/contract/exports.snapshot.json +41 -0
- package/src/contract/regression.assets.test.ts +41 -1
- package/src/contract/regression.review.test.ts +56 -0
- package/src/contract/types.contract.test.ts +15 -2
- package/src/knowledge/assetFile.ts +4 -4
- package/src/knowledge/extractFile.ts +4 -2
- package/src/knowledge/extractJob.ts +3 -3
- package/src/knowledge/outline.ts +1 -1
- package/src/knowledge/owedFiles.ts +3 -0
- package/src/knowledge/plan.ts +14 -5
- package/src/knowledge/reviewModel.ts +10 -1
- package/src/knowledge/reviewPrefetch.ts +11 -5
- package/src/knowledge/sources.ts +3 -1
- package/src/stats/distributions.ts +180 -0
- package/src/stats/estimators.ts +101 -0
- package/src/stats/fitting.ts +252 -0
- package/src/stats/index.ts +59 -0
- package/src/stats/information.ts +20 -0
- package/src/stats/multivariate.ts +93 -0
- package/src/stats/policies.ts +84 -0
- package/src/stats/prng.ts +45 -0
- package/src/stats/scores.ts +135 -0
- package/src/stats/stats.test.ts +294 -0
- package/src/stats/tests.ts +164 -0
- package/src/stats/timeSeries.ts +92 -0
- package/src/working/fold.test.ts +196 -0
- package/src/working/fold.ts +241 -0
- package/src/working/index.ts +1 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advisory folds of the working transcript (PRD 45 §4.7 B6/B7) — pure post-processing
|
|
3
|
+
* over the messages {@link buildWorkingTranscript} returns, before a host sends them to
|
|
4
|
+
* the model. The folds are COMPRESSION ONLY: the run's own transcript (`state.transcript`)
|
|
5
|
+
* and its trace keep every message at full fidelity; only what the MODEL sees is folded.
|
|
6
|
+
*
|
|
7
|
+
* B6 — fold superseded reads: when an edit/write to path P succeeds at step N, every
|
|
8
|
+
* earlier `read_file` result for P in the model transcript becomes a one-line marker.
|
|
9
|
+
* The stale content leaves the model's window (the edit changed those bytes — anything
|
|
10
|
+
* the model still needs it re-reads), and stays in the trace at full fidelity.
|
|
11
|
+
*
|
|
12
|
+
* B7 — fold repeated narration: assistant text PRECEDING tool calls whose word-set
|
|
13
|
+
* overlaps the previous such text by ≥ {@link NARRATION_OVERLAP} becomes
|
|
14
|
+
* `"(progress note)"`. A final answer and a turn without tool calls are NEVER folded —
|
|
15
|
+
* those carry the run's actual output.
|
|
16
|
+
*
|
|
17
|
+
* A "step" is the index of the assistant message carrying the tool call, in the message
|
|
18
|
+
* list the fold runs over (the model transcript, system prompt included).
|
|
19
|
+
*
|
|
20
|
+
* Pure: no `node:*`, no I/O — runs wherever the `./working` subpath runs.
|
|
21
|
+
*/
|
|
22
|
+
/** B7's fold threshold: |intersection| / |union| of the two texts' word sets (Jaccard). */
|
|
23
|
+
export const NARRATION_OVERLAP = 0.8;
|
|
24
|
+
/** B6's replacement for a read result whose file a later successful edit superseded. */
|
|
25
|
+
export function supersededReadMarker(path, step) {
|
|
26
|
+
return `(read of ${path} superseded by the edit at step ${step} — re-read if needed)`;
|
|
27
|
+
}
|
|
28
|
+
/** B7's replacement for a tool-call turn's narration that merely repeats the previous one. */
|
|
29
|
+
export const PROGRESS_NOTE = '(progress note)';
|
|
30
|
+
function callsOf(m) {
|
|
31
|
+
return Array.isArray(m.tool_calls) ? m.tool_calls : [];
|
|
32
|
+
}
|
|
33
|
+
function nameOf(call) {
|
|
34
|
+
const name = call.function?.name;
|
|
35
|
+
return typeof name === 'string' && name.length > 0 ? name : null;
|
|
36
|
+
}
|
|
37
|
+
/** The `path` argument of a tool call — from the object form or parsed out of a JSON string. */
|
|
38
|
+
function pathOf(call) {
|
|
39
|
+
const raw = call.function?.arguments;
|
|
40
|
+
let parsed = raw;
|
|
41
|
+
if (typeof raw === 'string') {
|
|
42
|
+
try {
|
|
43
|
+
parsed = JSON.parse(raw);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (!parsed || typeof parsed !== 'object')
|
|
50
|
+
return null;
|
|
51
|
+
const path = parsed.path;
|
|
52
|
+
return typeof path === 'string' && path.length > 0 ? path : null;
|
|
53
|
+
}
|
|
54
|
+
/** The tool result answering `call`: by `tool_call_id` when present, else positionally. */
|
|
55
|
+
function resultFor(convo, call, callIndex) {
|
|
56
|
+
const id = typeof call.id === 'string' && call.id.length > 0 ? call.id : null;
|
|
57
|
+
if (id) {
|
|
58
|
+
const byId = convo.find((m) => m.role === 'tool' && m.tool_call_id === id);
|
|
59
|
+
if (byId)
|
|
60
|
+
return byId;
|
|
61
|
+
}
|
|
62
|
+
// No ids (or an unmatched one): the nth tool result answers the nth call.
|
|
63
|
+
const results = convo.filter((m) => m.role === 'tool');
|
|
64
|
+
return results[callIndex];
|
|
65
|
+
}
|
|
66
|
+
/** Did the tool call SUCCEED? An explicit `{ok:false}` / `error` fails; anything else —
|
|
67
|
+
* including a textual error, which is still informative — passes. Absent result fails
|
|
68
|
+
* (a write nobody confirmed changed nothing). */
|
|
69
|
+
function succeeded(m) {
|
|
70
|
+
if (!m)
|
|
71
|
+
return false;
|
|
72
|
+
const content = m.content;
|
|
73
|
+
if (typeof content === 'string')
|
|
74
|
+
return content.trim().length > 0;
|
|
75
|
+
if (!content || typeof content !== 'object')
|
|
76
|
+
return false;
|
|
77
|
+
const r = content;
|
|
78
|
+
if (typeof r.ok === 'boolean')
|
|
79
|
+
return r.ok;
|
|
80
|
+
return r.error == null;
|
|
81
|
+
}
|
|
82
|
+
const EDIT_OR_WRITE = /^(edit|write)/i;
|
|
83
|
+
const READ = /^read/i;
|
|
84
|
+
function wordSet(text) {
|
|
85
|
+
return new Set(text
|
|
86
|
+
.toLowerCase()
|
|
87
|
+
.split(/[^a-z0-9_]+/)
|
|
88
|
+
.filter((w) => w.length > 0));
|
|
89
|
+
}
|
|
90
|
+
/** Jaccard similarity of two texts' word sets. */
|
|
91
|
+
function wordOverlap(a, b) {
|
|
92
|
+
const sa = wordSet(a);
|
|
93
|
+
const sb = wordSet(b);
|
|
94
|
+
if (sa.size === 0 || sb.size === 0)
|
|
95
|
+
return 0;
|
|
96
|
+
let intersection = 0;
|
|
97
|
+
for (const w of sa)
|
|
98
|
+
if (sb.has(w))
|
|
99
|
+
intersection += 1;
|
|
100
|
+
return intersection / (sa.size + sb.size - intersection);
|
|
101
|
+
}
|
|
102
|
+
/** Containment: is every word of the smaller set present in the larger? True when one
|
|
103
|
+
* narration is the other plus a trailing qualifier ("…once more", "…again", "…now") —
|
|
104
|
+
* a repeat Jaccard under-counts because the union grows with the qualifier's words. */
|
|
105
|
+
function wordContained(a, b) {
|
|
106
|
+
const sa = wordSet(a);
|
|
107
|
+
const sb = wordSet(b);
|
|
108
|
+
if (sa.size === 0 || sb.size === 0)
|
|
109
|
+
return false;
|
|
110
|
+
const [small, large] = sa.size <= sb.size ? [sa, sb] : [sb, sa];
|
|
111
|
+
for (const w of small)
|
|
112
|
+
if (!large.has(w))
|
|
113
|
+
return false;
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
/** The narration an assistant turn carries before its tool calls — null when it carries
|
|
117
|
+
* none (an empty-content tool-call turn, or any turn without tool calls). */
|
|
118
|
+
function narrationOf(m) {
|
|
119
|
+
const content = m.content;
|
|
120
|
+
const text = typeof content === 'string' ? content : content == null ? '' : JSON.stringify(content);
|
|
121
|
+
const t = text.trim();
|
|
122
|
+
return callsOf(m).length > 0 && t.length > 0 ? t : null;
|
|
123
|
+
}
|
|
124
|
+
/** Tracks which read CALLS were superseded, so `foldWorkingTranscript`'s B7 pass can
|
|
125
|
+
* skip the narration that introduced a read whose content B6 just replaced. */
|
|
126
|
+
const SUPERSEDED_CALL = new WeakSet();
|
|
127
|
+
/**
|
|
128
|
+
* B6 — fold reads a later successful edit/write superseded. Returns the input unchanged
|
|
129
|
+
* (same reference, no copy) when nothing is superseded; otherwise a new list whose
|
|
130
|
+
* replaced messages are shallow copies with only `content` changed. The caller's
|
|
131
|
+
* transcript is never touched.
|
|
132
|
+
*/
|
|
133
|
+
export function foldSupersededReads(msgs) {
|
|
134
|
+
const edits = [];
|
|
135
|
+
const reads = [];
|
|
136
|
+
let callIndex = 0;
|
|
137
|
+
for (let i = 0; i < msgs.length; i++) {
|
|
138
|
+
const m = msgs[i];
|
|
139
|
+
for (const call of callsOf(m)) {
|
|
140
|
+
const name = nameOf(call);
|
|
141
|
+
if (!name)
|
|
142
|
+
continue;
|
|
143
|
+
const path = pathOf(call);
|
|
144
|
+
const result = resultFor(msgs, call, callIndex);
|
|
145
|
+
if (path && EDIT_OR_WRITE.test(name)) {
|
|
146
|
+
if (succeeded(result))
|
|
147
|
+
edits.push({ path, step: i });
|
|
148
|
+
}
|
|
149
|
+
else if (path && READ.test(name) && result) {
|
|
150
|
+
reads.push({ step: i, path, result, call });
|
|
151
|
+
}
|
|
152
|
+
callIndex += 1;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (edits.length === 0 || reads.length === 0)
|
|
156
|
+
return msgs;
|
|
157
|
+
const superseded = new Map();
|
|
158
|
+
for (const read of reads) {
|
|
159
|
+
// The LATEST successful edit of the same path after the read wins — an earlier read
|
|
160
|
+
// re-made after an edit is not superseded by that edit.
|
|
161
|
+
let step = -1;
|
|
162
|
+
for (const e of edits) {
|
|
163
|
+
if (e.path === read.path && e.step > read.step && e.step > step)
|
|
164
|
+
step = e.step;
|
|
165
|
+
}
|
|
166
|
+
if (step >= 0) {
|
|
167
|
+
superseded.set(read.result, supersededReadMarker(read.path, step));
|
|
168
|
+
SUPERSEDED_CALL.add(read.call);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (superseded.size === 0)
|
|
172
|
+
return msgs;
|
|
173
|
+
return msgs.map((m) => {
|
|
174
|
+
const marker = superseded.get(m);
|
|
175
|
+
return marker == null ? m : { ...m, content: marker };
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* B7 — fold a tool-call turn's narration when it merely repeats the previous one.
|
|
180
|
+
* Only assistant messages WITH tool calls are candidates: a final answer and a turn
|
|
181
|
+
* without tool calls are never folded. The FIRST narration is kept verbatim (it has no
|
|
182
|
+
* predecessor to repeat); each later one folds when its word-set overlap with the most
|
|
183
|
+
* recent kept narration is ≥ {@link NARRATION_OVERLAP}. Once folded, it does not become
|
|
184
|
+
* the comparison text — the model keeps the last thing actually said.
|
|
185
|
+
*/
|
|
186
|
+
export function foldRepeatedNarration(msgs, overlap = NARRATION_OVERLAP) {
|
|
187
|
+
let lastKept = null;
|
|
188
|
+
let changed = false;
|
|
189
|
+
const out = msgs.map((m) => {
|
|
190
|
+
if (m.role !== 'assistant')
|
|
191
|
+
return m;
|
|
192
|
+
const narration = narrationOf(m);
|
|
193
|
+
if (narration == null)
|
|
194
|
+
return m; // no tool calls, or no narration: never folded
|
|
195
|
+
// A narration that introduced a read B6 folded is the model's only record of why it
|
|
196
|
+
// read — it never folds itself, but it IS what a later repeat is compared against.
|
|
197
|
+
if (callsOf(m).some((call) => SUPERSEDED_CALL.has(call))) {
|
|
198
|
+
lastKept = narration;
|
|
199
|
+
return m;
|
|
200
|
+
}
|
|
201
|
+
if (lastKept != null && (wordOverlap(narration, lastKept) >= overlap || wordContained(narration, lastKept))) {
|
|
202
|
+
changed = true;
|
|
203
|
+
return { ...m, content: PROGRESS_NOTE };
|
|
204
|
+
}
|
|
205
|
+
lastKept = narration;
|
|
206
|
+
return m;
|
|
207
|
+
});
|
|
208
|
+
return changed ? out : msgs;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Both folds, B6 then B7, over the working transcript a host is about to send to the
|
|
212
|
+
* model. Pure and advisory: `msgs` is not mutated, and the run's own transcript/trace
|
|
213
|
+
* keep every message at full fidelity.
|
|
214
|
+
*/
|
|
215
|
+
export function foldWorkingTranscript(msgs) {
|
|
216
|
+
return foldRepeatedNarration(foldSupersededReads(msgs));
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=fold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fold.js","sourceRoot":"","sources":["../../src/working/fold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,2FAA2F;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O,IAAI,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;YAC5G,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,aAAa,EAAO,CAAC;QAC/C,CAAC;QACD,QAAQ,GAAG,SAAS,CAAC;QACrB,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAE,IAAY,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAA8B,IAAkB;IACnF,OAAO,qBAAqB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/working/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export { rankByCount } from './rank.js';
|
|
|
29
29
|
export type { Observation, WorkingMemorySnapshot, ConsolidatedMemory, ConsolidateOptions } from './types.js';
|
|
30
30
|
export { HISTORY_WINDOW, HISTORY_TOKEN_BUDGET, COMPACT_TAIL_TOKEN_BUDGET, windowed, stillInWorkingContext, transcriptTokens, buildWorkingTranscript, } from './transcript.js';
|
|
31
31
|
export type { TranscriptMessage, CompactMemo, WorkingTranscriptState, TranscriptFold } from './transcript.js';
|
|
32
|
+
export { NARRATION_OVERLAP, PROGRESS_NOTE, supersededReadMarker, foldSupersededReads, foldRepeatedNarration, foldWorkingTranscript } from './fold.js';
|
|
32
33
|
export { TRANSCRIPT_SUMMARY_PROMPT, TRANSCRIPT_SUMMARY_MAX_TOKENS, TRANSCRIPT_SUMMARY_INPUT_TOKENS, renderForSummary, summaryChunks, summarizeTranscript } from './summary.js';
|
|
33
34
|
export type { SummaryCompletion } from './summary.js';
|
|
34
35
|
export { CONSOLIDATION_META, CONSOLIDATION_MARKER_PREFIX, consolidationMetadata, consolidationMarkerOf, consolidationMarkerContent, isConsolidationMarker, lastConsolidationIndex, scopeToConsolidation, foldKeepFromId, } from './consolidationMarker.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/working/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC7G,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC/K,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|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BAA0B,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/working/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export { consolidate, mergeConsolidated, consolidatedKey, consolidatedFiles, wit
|
|
|
27
27
|
export { CONSOLIDATED_KEY_PREFIX, CONSOLIDATED_ROOT_AREA, MAX_RECALLED_MAPS, areaOfPath, areasNamedIn, areasOfPathsIn, consolidatedArea, consolidatedFactsFor, } from './codemapAreas.js';
|
|
28
28
|
export { rankByCount } from './rank.js';
|
|
29
29
|
export { HISTORY_WINDOW, HISTORY_TOKEN_BUDGET, COMPACT_TAIL_TOKEN_BUDGET, windowed, stillInWorkingContext, transcriptTokens, buildWorkingTranscript, } from './transcript.js';
|
|
30
|
+
export { NARRATION_OVERLAP, PROGRESS_NOTE, supersededReadMarker, foldSupersededReads, foldRepeatedNarration, foldWorkingTranscript } from './fold.js';
|
|
30
31
|
export { TRANSCRIPT_SUMMARY_PROMPT, TRANSCRIPT_SUMMARY_MAX_TOKENS, TRANSCRIPT_SUMMARY_INPUT_TOKENS, renderForSummary, summaryChunks, summarizeTranscript } from './summary.js';
|
|
31
32
|
export { CONSOLIDATION_META, CONSOLIDATION_MARKER_PREFIX, consolidationMetadata, consolidationMarkerOf, consolidationMarkerContent, isConsolidationMarker, lastConsolidationIndex, scopeToConsolidation, foldKeepFromId, } from './consolidationMarker.js';
|
|
32
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/working/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE/K,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/working/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACtJ,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE/K,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seanhogg/builderforce-memory",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.63",
|
|
4
4
|
"description": "BuilderForce Agent Memory — runtime layer. SSM execution, Transformer orchestration, online distillation, enterprise RAG (ingestion pipelines, vector-store adapters, tenant/ACL-scoped hybrid retrieval), multi-agent graph orchestration, LLM telemetry and cost accounting, persistent agent memory, and token-saving agent-run memory (code maps, a prompt-cache-safe working memory, chunked transcript windowing) for BuilderForce.ai agents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"types": "./dist/working/index.d.ts",
|
|
35
35
|
"import": "./dist/working/index.js"
|
|
36
36
|
},
|
|
37
|
+
"./stats": {
|
|
38
|
+
"types": "./dist/stats/index.d.ts",
|
|
39
|
+
"import": "./dist/stats/index.js"
|
|
40
|
+
},
|
|
37
41
|
"./distillation": {
|
|
38
42
|
"types": "./dist/distillation/index.d.ts",
|
|
39
43
|
"import": "./dist/distillation/index.js"
|
|
@@ -117,7 +121,7 @@
|
|
|
117
121
|
},
|
|
118
122
|
"homepage": "https://github.com/SeanHogg/builderforce-memory/tree/main/packages/memory#readme",
|
|
119
123
|
"peerDependencies": {
|
|
120
|
-
"@seanhogg/builderforce-memory-engine": "^2026.10.
|
|
124
|
+
"@seanhogg/builderforce-memory-engine": "^2026.10.62"
|
|
121
125
|
},
|
|
122
126
|
"devDependencies": {
|
|
123
127
|
"@jest/globals": "^29.7.0",
|
|
@@ -131,7 +135,7 @@
|
|
|
131
135
|
"ts-jest": "^29.2.0",
|
|
132
136
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
133
137
|
"typescript-7": "npm:typescript@^7.0.2",
|
|
134
|
-
"@seanhogg/builderforce-memory-engine": "2026.10.
|
|
138
|
+
"@seanhogg/builderforce-memory-engine": "2026.10.62"
|
|
135
139
|
},
|
|
136
140
|
"jest": {
|
|
137
141
|
"preset": "ts-jest/presets/default-esm",
|
|
@@ -527,6 +527,41 @@
|
|
|
527
527
|
"toDecayLambda",
|
|
528
528
|
"tokenize"
|
|
529
529
|
],
|
|
530
|
+
"./stats": [
|
|
531
|
+
"bayesianOnlineChangePoint",
|
|
532
|
+
"betaPosterior",
|
|
533
|
+
"brierScore",
|
|
534
|
+
"chapmanEstimate",
|
|
535
|
+
"createRng",
|
|
536
|
+
"cusum",
|
|
537
|
+
"effortAwareRecall",
|
|
538
|
+
"entropyOfCounts",
|
|
539
|
+
"expectedCalibrationError",
|
|
540
|
+
"fitBayesianLogistic",
|
|
541
|
+
"fitIsotonic",
|
|
542
|
+
"fitPlattScaling",
|
|
543
|
+
"gammaPoissonPosterior",
|
|
544
|
+
"gammaQuantile",
|
|
545
|
+
"garwoodPoissonInterval",
|
|
546
|
+
"goelOkumotoMLE",
|
|
547
|
+
"inverseRegularizedIncompleteBeta",
|
|
548
|
+
"kaplanMeier",
|
|
549
|
+
"ledoitWolfCovariance",
|
|
550
|
+
"lincolnPetersenEstimate",
|
|
551
|
+
"ndcgAtK",
|
|
552
|
+
"normalDraw",
|
|
553
|
+
"pairedBootstrapCi",
|
|
554
|
+
"popt",
|
|
555
|
+
"prAuc",
|
|
556
|
+
"psi",
|
|
557
|
+
"regularizedIncompleteBeta",
|
|
558
|
+
"regularizedIncompleteGamma",
|
|
559
|
+
"shannonEntropy",
|
|
560
|
+
"signTestSprt",
|
|
561
|
+
"thompsonRank",
|
|
562
|
+
"thompsonSample",
|
|
563
|
+
"wilcoxonSignedRank"
|
|
564
|
+
],
|
|
530
565
|
"./telemetry": [
|
|
531
566
|
"ANTHROPIC_PRICE_BOOK",
|
|
532
567
|
"ConsoleSpanExporter",
|
|
@@ -592,6 +627,8 @@
|
|
|
592
627
|
"HISTORY_WINDOW",
|
|
593
628
|
"MAX_RECALLED_MAPS",
|
|
594
629
|
"MIN_CONSOLIDATED_FILES",
|
|
630
|
+
"NARRATION_OVERLAP",
|
|
631
|
+
"PROGRESS_NOTE",
|
|
595
632
|
"TRANSCRIPT_SUMMARY_INPUT_TOKENS",
|
|
596
633
|
"TRANSCRIPT_SUMMARY_MAX_TOKENS",
|
|
597
634
|
"TRANSCRIPT_SUMMARY_PROMPT",
|
|
@@ -609,6 +646,9 @@
|
|
|
609
646
|
"consolidationMarkerOf",
|
|
610
647
|
"consolidationMetadata",
|
|
611
648
|
"foldKeepFromId",
|
|
649
|
+
"foldRepeatedNarration",
|
|
650
|
+
"foldSupersededReads",
|
|
651
|
+
"foldWorkingTranscript",
|
|
612
652
|
"isConsolidationMarker",
|
|
613
653
|
"lastConsolidationIndex",
|
|
614
654
|
"mergeConsolidated",
|
|
@@ -618,6 +658,7 @@
|
|
|
618
658
|
"stillInWorkingContext",
|
|
619
659
|
"summarizeTranscript",
|
|
620
660
|
"summaryChunks",
|
|
661
|
+
"supersededReadMarker",
|
|
621
662
|
"transcriptTokens",
|
|
622
663
|
"windowed",
|
|
623
664
|
"withoutConsolidatedFiles"
|
|
@@ -10,7 +10,8 @@ import { assetExtracted } from '../knowledge/assetFile.js';
|
|
|
10
10
|
import { buildGraph } from '../knowledge/build.js';
|
|
11
11
|
import type { KnowledgePack, KnowledgeParser } from '../knowledge/model.js';
|
|
12
12
|
import { DOCS_PACK } from '../knowledge/packs/docs.js';
|
|
13
|
-
import {
|
|
13
|
+
import { owedCalls } from '../knowledge/owedFiles.js';
|
|
14
|
+
import { planDetail, planReview, refreshPlan } from '../knowledge/plan.js';
|
|
14
15
|
import { srcRef } from '../knowledge/refs.js';
|
|
15
16
|
import { reviewDirectory } from '../knowledge/review.js';
|
|
16
17
|
import { extractJob, type ExtractPool } from '../knowledge/extractJob.js';
|
|
@@ -204,3 +205,42 @@ describe('regression: the asset lifecycle', () => {
|
|
|
204
205
|
expect((await store.getExtracted(hashText(nul)))![0]!.nodes[0]).toMatchObject({ badges: { asset: 1, mediaType: 'text/plain' } });
|
|
205
206
|
});
|
|
206
207
|
});
|
|
208
|
+
|
|
209
|
+
describe('regression: an oversized claimed document stays an asset', () => {
|
|
210
|
+
it('regression: a 3 MB claimed pdf is an asset node, not in skipped, owes no calls, and is extracted once it shrinks below the cap', async () => {
|
|
211
|
+
const big = 'x'.repeat(3 * 1024 * 1024);
|
|
212
|
+
const source = memSource({ 'a.pdf': big });
|
|
213
|
+
const manifest = new InMemoryIngestManifest();
|
|
214
|
+
const store = memStore();
|
|
215
|
+
const plan = await planDetail(source, manifest, [withPdf]);
|
|
216
|
+
expect(plan.plan.skipped).toEqual([]);
|
|
217
|
+
expect(plan.plan.assets).toBe(1);
|
|
218
|
+
expect(plan.files).toMatchObject([{ path: 'a.pdf', asset: true }]);
|
|
219
|
+
expect(owedCalls(plan.extractor, 'a.pdf')).toBe(0);
|
|
220
|
+
const report = await reviewDirectory(args(source, store, manifest, { packs: [withPdf] }));
|
|
221
|
+
expect(report.extracted).toBe(0);
|
|
222
|
+
expect(source.reads).not.toContain('a.pdf');
|
|
223
|
+
expect((await store.getExtracted(hashText(big)))![0]!.nodes[0]).toMatchObject({ kind: 'file', badges: { asset: 1, oversized: 1, mediaType: 'application/pdf' } });
|
|
224
|
+
|
|
225
|
+
// A later shrink below the cap: the content hash moved, so the file is owed and now extracted.
|
|
226
|
+
source.files['a.pdf'] = 'small pdf text';
|
|
227
|
+
const shrunk = await planReview(source, manifest, [withPdf]);
|
|
228
|
+
expect(shrunk).toMatchObject({ changed: ['a.pdf'], assets: 0 });
|
|
229
|
+
const again = await reviewDirectory(args(source, store, manifest, { packs: [withPdf] }));
|
|
230
|
+
expect(again.extracted).toBe(1);
|
|
231
|
+
expect((await store.getExtracted(hashText('small pdf text')))![0]!.nodes[0]!.badges?.asset).toBeUndefined();
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('regression: an oversized claimed pdf still owes no calls after an aborted run and a refreshed (Continue) plan', async () => {
|
|
235
|
+
const source = memSource({ 'big.pdf': 'x'.repeat(3 * 1024 * 1024) });
|
|
236
|
+
const manifest = new InMemoryIngestManifest();
|
|
237
|
+
const store = memStore();
|
|
238
|
+
const detail = await planDetail(source, manifest, [withPdf]);
|
|
239
|
+
const stop = new AbortController();
|
|
240
|
+
stop.abort();
|
|
241
|
+
await reviewDirectory(args(source, store, manifest, { packs: [withPdf], plan: detail, signal: stop.signal }));
|
|
242
|
+
const refreshed = await refreshPlan(detail, manifest);
|
|
243
|
+
expect(owedCalls(refreshed.extractor, 'big.pdf')).toBe(0);
|
|
244
|
+
expect(refreshed.files).toMatchObject([{ path: 'big.pdf', asset: true, oversized: true }]);
|
|
245
|
+
});
|
|
246
|
+
});
|
|
@@ -441,3 +441,59 @@ describe('regression: a binary file is an asset with a node, not a skipped file'
|
|
|
441
441
|
expect((await hosted.getExtracted(hashText('pdf text')))![0]!.nodes[0]!.badges?.asset).toBeUndefined();
|
|
442
442
|
});
|
|
443
443
|
});
|
|
444
|
+
|
|
445
|
+
describe('regression: DirectorySource.hashOf and readTimeoutMs take the path', () => {
|
|
446
|
+
it('regression: hashOf receives the path being checked', async () => {
|
|
447
|
+
const source = memSource({ 'a.md': '# A\nalpha\n' });
|
|
448
|
+
const seen: Array<[string, string]> = [];
|
|
449
|
+
source.hashOf = (text, path) => { seen.push([text, path]); return hashText(text); };
|
|
450
|
+
const report = await reviewDirectory(args(source));
|
|
451
|
+
expect(report.extracted).toBe(1);
|
|
452
|
+
expect(seen).toEqual([['# A\nalpha\n', 'a.md']]);
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
it('regression: readTimeoutMs overrides the default read timeout for one path, and a slow read past the default succeeds when the override is longer', async () => {
|
|
456
|
+
const slowRead = (source: SpySource) => {
|
|
457
|
+
const read = source.read.bind(source);
|
|
458
|
+
source.read = async (path) => { if (path === 'slow.md') await new Promise((r) => setTimeout(r, 120)); return read(path); };
|
|
459
|
+
return source;
|
|
460
|
+
};
|
|
461
|
+
const files = { 'slow.md': '# S\nslow\n', 'fast.md': '# F\nfast\n' };
|
|
462
|
+
// Default (scaled down from 5 s): the slow read times out.
|
|
463
|
+
const base = await reviewDirectory(args(slowRead(memSource({ ...files })), memStore(), new InMemoryIngestManifest(), { timeouts: { readMs: 40 } }));
|
|
464
|
+
expect(base.failures).toEqual([{ path: 'slow.md', phase: 'extract', reason: 'read: timeout' }]);
|
|
465
|
+
// The override applies to slow.md only: it now succeeds.
|
|
466
|
+
const source = slowRead(memSource({ ...files }));
|
|
467
|
+
source.readTimeoutMs = (path) => (path === 'slow.md' ? 2_000 : undefined);
|
|
468
|
+
const report = await reviewDirectory(args(source, memStore(), new InMemoryIngestManifest(), { timeouts: { readMs: 40 } }));
|
|
469
|
+
expect(report.failures).toEqual([]);
|
|
470
|
+
expect(report.extracted).toBe(2);
|
|
471
|
+
// A non-finite or non-positive override keeps the default.
|
|
472
|
+
const bad = slowRead(memSource({ ...files }));
|
|
473
|
+
bad.readTimeoutMs = () => 0;
|
|
474
|
+
const kept = await reviewDirectory(args(bad, memStore(), new InMemoryIngestManifest(), { timeouts: { readMs: 40 } }));
|
|
475
|
+
expect(kept.failures).toEqual([{ path: 'slow.md', phase: 'extract', reason: 'read: timeout' }]);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('regression: with a pool and deferRead, readTimeoutMs lets a job run past extractMs, and the worker is told the override', async () => {
|
|
479
|
+
const files = { 'slow.md': '# S\nslow\n', 'fast.md': '# F\nfast\n' };
|
|
480
|
+
const pooled = (source: SpySource, seen: Array<number | undefined> = []): ExtractPool => async (job) => {
|
|
481
|
+
seen.push((job as { readByPool?: { readMs?: number } }).readByPool?.readMs);
|
|
482
|
+
const doc = await source.read(job.path);
|
|
483
|
+
if (job.path === 'slow.md') await new Promise((r) => setTimeout(r, 120));
|
|
484
|
+
return extractJob({ ...job, doc } as ExtractJob, [DOCS_PACK]);
|
|
485
|
+
};
|
|
486
|
+
const timeouts = { readMs: 40, extractMs: 40 };
|
|
487
|
+
const base = memSource({ ...files });
|
|
488
|
+
const baseReport = await reviewDirectory(args(base, memStore(), new InMemoryIngestManifest(), { extractPool: pooled(base), deferRead: true, timeouts }));
|
|
489
|
+
expect(baseReport.failures.map((f) => f.path)).toEqual(['slow.md']);
|
|
490
|
+
|
|
491
|
+
const source = memSource({ ...files });
|
|
492
|
+
source.readTimeoutMs = (path) => (path === 'slow.md' ? 2_000 : undefined);
|
|
493
|
+
const seen: Array<number | undefined> = [];
|
|
494
|
+
const report = await reviewDirectory(args(source, memStore(), new InMemoryIngestManifest(), { extractPool: pooled(source, seen), deferRead: true, timeouts }));
|
|
495
|
+
expect(report.failures).toEqual([]);
|
|
496
|
+
expect(report.extracted).toBe(2);
|
|
497
|
+
expect(seen.filter((x) => x !== undefined)).toEqual([2_000]);
|
|
498
|
+
});
|
|
499
|
+
});
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
import type { ParsedSection, SourceDocument } from '../ingest/types.js';
|
|
15
15
|
import type {
|
|
16
|
-
Extracted, ExtractJob, ExtractJobResult, GraphApp, GraphOutline, GraphReadSkip, GraphSystem, KEdge, KNode, KnowledgeGraph, KnowledgeStore,
|
|
16
|
+
DirectorySource, Extracted, ExtractJob, ExtractJobResult, GraphApp, GraphOutline, GraphReadSkip, GraphSystem, KEdge, KNode, KnowledgeGraph, KnowledgeStore,
|
|
17
17
|
OutlineFile, OutlineCommunity, NodePlacement, ReviewFailure, ReviewFailureChunks, ReviewPhase, ReviewReport, ReviewRun, ReviewRunPhase, ReviewStep, ScopeRecord,
|
|
18
18
|
StoredFact, StoredRelation, ExtractedLogPersistence, KnowledgeSnapshot, LocalSnapshotStoreOptions, SnapshotPersistence,
|
|
19
19
|
RowChange, RowPersistence,
|
|
20
20
|
} from '../knowledge/index.js';
|
|
21
|
+
import type { PlannedFile } from '../knowledge/index.js';
|
|
21
22
|
import { placementOf } from '../knowledge/index.js';
|
|
22
23
|
import { canonicalDump, ExtractFailed, failuresOf, failureTotal, LocalSnapshotStore, localSnapshotStore, type ExtractorState } from '../knowledge/index.js';
|
|
23
24
|
|
|
@@ -88,7 +89,11 @@ export const jobWithSectionFlags = { ...base, doc: aDocument, needSections: true
|
|
|
88
89
|
export const jobWithBoth: ExtractJob = { ...base, doc: aDocument, readByPool: { path: 'a.md', hash: 'h' } };
|
|
89
90
|
// @ts-expect-error ExtractJob: a job carries one of `doc` / `readByPool`
|
|
90
91
|
export const jobWithNeither: ExtractJob = { ...base };
|
|
91
|
-
|
|
92
|
+
// readByPool gained an OPTIONAL `readMs` (the source's per-path read deadline, for a worker to use instead of its constant); a worker that ignores it is unaffected.
|
|
93
|
+
export type ExtractJob_readByPool_shape = Expect<Equal<NonNullable<Extract<ExtractJob, { readByPool: unknown }>['readByPool']>, { path: string; hash: string; readMs?: number }>>;
|
|
94
|
+
export const jobTheWorkerReadsWithDeadline = { ...base, readByPool: { path: 'a.md', hash: 'h', readMs: 30_000 } } satisfies ExtractJob;
|
|
95
|
+
// PlannedFile.oversized: an asset only because a claimed document is over the size cap; optional, so a hand-built PlannedFile stays valid.
|
|
96
|
+
export type PlannedFile_oversized = Expect<Equal<PlannedFile['oversized'], true | undefined>>;
|
|
92
97
|
export const resultShape = { binary: true, extracted: [anExtract], sections: someSections } satisfies ExtractJobResult;
|
|
93
98
|
export type ExtractJobResult_fields = Expect<Equal<ExtractJobResult, { binary?: true; extracted: Extracted[]; sections?: ParsedSection[] }>>;
|
|
94
99
|
// ExtractFailed: the marker of a PROVEN-final extraction failure (the parser or extractor threw); every other failure is transient.
|
|
@@ -96,6 +101,14 @@ export type ExtractFailed_is_an_Error = Expect<Equal<InstanceType<typeof Extract
|
|
|
96
101
|
export type ExtractFailed_constructor = Expect<Equal<ConstructorParameters<typeof ExtractFailed>, [message: string, options?: { cause?: unknown }]>>;
|
|
97
102
|
// ExtractorState.failures: consecutive transient failures by path at one hash; optional so a hand-built state stays valid.
|
|
98
103
|
export type ExtractorState_failures = Expect<Equal<ExtractorState['failures'], ReadonlyMap<string, { hash: string; count: number }> | undefined>>;
|
|
104
|
+
// ExtractorState.oversized: claimed documents over the size cap, planned as assets; optional so a hand-built state stays valid.
|
|
105
|
+
export type ExtractorState_oversized = Expect<Equal<ExtractorState['oversized'], ReadonlySet<string> | undefined>>;
|
|
106
|
+
|
|
107
|
+
/* ── DirectorySource: optional per-path hooks ──────────────────────────────────────────────────────────────── */
|
|
108
|
+
// hashOf takes the path (a host whose read() transforms bytes returns the listing hash for it); a one-argument hashOf still satisfies it.
|
|
109
|
+
export type DirectorySource_hashOf = Expect<Equal<DirectorySource['hashOf'], ((text: string, path: string) => string) | undefined>>;
|
|
110
|
+
export type DirectorySource_hashOf_legacy_one_arg = Expect<Equal<((text: string) => string) extends NonNullable<DirectorySource['hashOf']> ? true : false, true>>;
|
|
111
|
+
export type DirectorySource_readTimeoutMs = Expect<Equal<DirectorySource['readTimeoutMs'], ((path: string) => number | undefined) | undefined>>;
|
|
99
112
|
|
|
100
113
|
/* ── KnowledgeStore: the port hosts implement ──────────────────────────────────────────────────────────────── */
|
|
101
114
|
export type KnowledgeStore_methods = Expect<Equal<
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* The node is the SAME file node a text file gets (kind `file`, ref `srcRef(rootId, path)`, key = path, the
|
|
8
8
|
* content hash as `sourceHash`), stored in the same extract cache under the file's hash. What marks it is its
|
|
9
|
-
* `badges` (the node's pack-data field): `asset: 1`, `mediaType` (string) and `size` (bytes). A host that finds a
|
|
9
|
+
* `badges` (the node's pack-data field): `asset: 1`, `mediaType` (string) and `size` (bytes), plus `oversized: 1` for a host-claimed document left an asset by the size cap. A host that finds a
|
|
10
10
|
* text-extension file binary on read gets the same node, with the path-derived media type.
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -16,19 +16,19 @@ import { EXTRACTOR_VERSION, mediaTypeOfPath } from './sources.js';
|
|
|
16
16
|
import { putExtract } from './extractFile.js';
|
|
17
17
|
|
|
18
18
|
/** The `Extracted` of one asset: one file node, no edges. Pure: the same inputs give the same bytes. */
|
|
19
|
-
export function assetExtracted(rootId: string, file: { path: string; hash: string; size: number }): Extracted {
|
|
19
|
+
export function assetExtracted(rootId: string, file: { path: string; hash: string; size: number; oversized?: true }): Extracted {
|
|
20
20
|
const ref = srcRef(rootId, file.path);
|
|
21
21
|
return {
|
|
22
22
|
sourceRef: ref, sourceHash: file.hash, extractorVersion: EXTRACTOR_VERSION, edges: [], keys: [{ ref, key: file.path }],
|
|
23
23
|
nodes: [{
|
|
24
24
|
// No pack extracts an asset: it belongs to the generic pack, as a `missing` placeholder does.
|
|
25
25
|
ref, kind: 'file', label: basenameOf(file.path), pack: FALLBACK_PACK_ID, importance: 0, origin: 'extracted', sourceHash: file.hash,
|
|
26
|
-
badges: { asset: 1, mediaType: mediaTypeOfPath(file.path), size: file.size },
|
|
26
|
+
badges: { asset: 1, mediaType: mediaTypeOfPath(file.path), size: file.size, ...(file.oversized ? { oversized: 1 } : {}) },
|
|
27
27
|
}],
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/** Stores the asset node in the extract cache under the file's hash (the entries of other files sharing the hash are kept). */
|
|
32
|
-
export async function putAsset(store: KnowledgeStore, rootId: string, file: { path: string; hash: string; size: number }): Promise<void> {
|
|
32
|
+
export async function putAsset(store: KnowledgeStore, rootId: string, file: { path: string; hash: string; size: number; oversized?: true }): Promise<void> {
|
|
33
33
|
await putExtract(store, file.hash, assetExtracted(rootId, file));
|
|
34
34
|
}
|
|
@@ -42,6 +42,8 @@ export interface ExtractFileArgs {
|
|
|
42
42
|
wantsSections?: (pack: KnowledgePack) => boolean;
|
|
43
43
|
/** The pool reads the file itself: no `doc` (see `ExtractJob.readByPool`). */
|
|
44
44
|
readByPool?: boolean;
|
|
45
|
+
/** With `readByPool`: the read deadline for this path (`DirectorySource.readTimeoutMs`), handed to the worker. */
|
|
46
|
+
readMs?: number;
|
|
45
47
|
/** Told where the time went: the cache lookup and the pool job (PRD 41 A10, so a stall names itself). */
|
|
46
48
|
onTiming?: (t: { lookupMs: number; poolMs: number }) => void;
|
|
47
49
|
/** Leave the extract cache write to the caller (the review writes it in plan order); default: write it. */
|
|
@@ -100,7 +102,7 @@ export async function extractFileDetailed(a: ExtractFileArgs): Promise<FileExtra
|
|
|
100
102
|
if (found) {
|
|
101
103
|
const tSections = Date.now();
|
|
102
104
|
if (a.pool && wants) {
|
|
103
|
-
const out = await a.pool(jobOf({ rootId: a.rootId, path: a.path, hash: a.hash, knownKeys: new Map(), sectionsOnly: true, ...jobSource(a) }), a.signal);
|
|
105
|
+
const out = await a.pool(jobOf({ rootId: a.rootId, path: a.path, hash: a.hash, knownKeys: new Map(), sectionsOnly: true, ...(a.readMs ? { readMs: a.readMs } : {}), ...jobSource(a) }), a.signal);
|
|
104
106
|
if (out.binary) throw new BinaryContent();
|
|
105
107
|
if (!out.sections) throw new Error(`extract pool returned no sections for ${a.path}`);
|
|
106
108
|
sections = out.sections;
|
|
@@ -113,7 +115,7 @@ export async function extractFileDetailed(a: ExtractFileArgs): Promise<FileExtra
|
|
|
113
115
|
let extracted: Extracted;
|
|
114
116
|
if (a.pool) {
|
|
115
117
|
const tPool = Date.now();
|
|
116
|
-
const out = await a.pool(jobOf({ rootId: a.rootId, path: a.path, hash: a.hash, knownKeys, needSections: wants, ...jobSource(a) }), a.signal);
|
|
118
|
+
const out = await a.pool(jobOf({ rootId: a.rootId, path: a.path, hash: a.hash, knownKeys, needSections: wants, ...(a.readMs ? { readMs: a.readMs } : {}), ...jobSource(a) }), a.signal);
|
|
117
119
|
a.onTiming?.({ lookupMs, poolMs: Date.now() - tPool });
|
|
118
120
|
if (out.binary) throw new BinaryContent();
|
|
119
121
|
// Exact match only: a result for another file, or none although the packs accept this one, is a failure.
|
|
@@ -36,7 +36,7 @@ export interface ExtractJobBase {
|
|
|
36
36
|
*/
|
|
37
37
|
export type ExtractJobSource =
|
|
38
38
|
| { doc: SourceDocument; readByPool?: never }
|
|
39
|
-
| { doc?: never; readByPool: { path: string; hash: string } };
|
|
39
|
+
| { doc?: never; readByPool: { path: string; hash: string; /** The read deadline for this path (`DirectorySource.readTimeoutMs`), when the source sets one; a worker may use it in place of its constant. */ readMs?: number } };
|
|
40
40
|
|
|
41
41
|
export type ExtractJob = ExtractJobBase & ExtractJobSource;
|
|
42
42
|
|
|
@@ -92,13 +92,13 @@ export function runExtractor(
|
|
|
92
92
|
export function jobOf(
|
|
93
93
|
f: {
|
|
94
94
|
rootId: string; path: string; hash: string; knownKeys: ReadonlyMap<string, NodeRef>;
|
|
95
|
-
needSections?: boolean; sectionsOnly?: boolean;
|
|
95
|
+
needSections?: boolean; sectionsOnly?: boolean; readMs?: number;
|
|
96
96
|
} & ({ doc: SourceDocument; readByPool?: false } | { doc?: undefined; readByPool: true }),
|
|
97
97
|
): ExtractJob {
|
|
98
98
|
return {
|
|
99
99
|
rootId: f.rootId, path: f.path, hash: f.hash, knownKeys: [...f.knownKeys],
|
|
100
100
|
...(f.needSections ? { needSections: true } : {}), ...(f.sectionsOnly ? { sectionsOnly: true } : {}),
|
|
101
|
-
...(f.readByPool ? { readByPool: { path: f.path, hash: f.hash } } : { doc: f.doc! }),
|
|
101
|
+
...(f.readByPool ? { readByPool: { path: f.path, hash: f.hash, ...(f.readMs ? { readMs: f.readMs } : {}) } } : { doc: f.doc! }),
|
|
102
102
|
} as ExtractJob;
|
|
103
103
|
}
|
|
104
104
|
|
package/src/knowledge/outline.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const OUTLINE_BADGE_KEYS: readonly string[] = [
|
|
|
20
20
|
'entry', 'layerRule', 'unusedDependencies', 'externals', 'added', 'removed', 'changed', 'status',
|
|
21
21
|
'communityId', 'communityConfidence',
|
|
22
22
|
// An asset file (assetFile.ts): a binary file the review stores as a node, never read.
|
|
23
|
-
'asset', 'mediaType', 'size',
|
|
23
|
+
'asset', 'mediaType', 'size', 'oversized',
|
|
24
24
|
];
|
|
25
25
|
/** Verdict codes of a link, least to worst; code 0 is "no verdict". */
|
|
26
26
|
export const OUTLINE_VERDICTS: readonly ('none' | EdgeVerdict)[] = ['none', 'same', 'allowed', 'skips', 'upward'];
|