@seanhogg/builderforce-memory 2026.10.31 → 2026.10.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/dist/agent/SSMAgent.d.ts.map +1 -1
- package/dist/agent/SSMAgent.js.map +1 -1
- package/dist/bridges/AnthropicBridge.d.ts.map +1 -1
- package/dist/bridges/AnthropicBridge.js.map +1 -1
- package/dist/bridges/CachingBridge.d.ts.map +1 -1
- package/dist/bridges/CachingBridge.js.map +1 -1
- package/dist/bridges/FetchBridge.d.ts.map +1 -1
- package/dist/bridges/OpenAIBridge.d.ts.map +1 -1
- package/dist/bridges/OpenAIBridge.js.map +1 -1
- package/dist/bridges/ResponseCache.d.ts.map +1 -1
- package/dist/bridges/ResponseCache.js.map +1 -1
- package/dist/bridges/SemanticCachingBridge.d.ts.map +1 -1
- package/dist/bridges/SemanticCachingBridge.js.map +1 -1
- package/dist/bridges/VertexAIBridge.d.ts.map +1 -1
- package/dist/bridges/VertexAIBridge.js.map +1 -1
- package/dist/cache/FetchSemanticCacheBackend.d.ts.map +1 -1
- package/dist/cache/SemanticCache.d.ts.map +1 -1
- package/dist/cognition/EvermindCognition.d.ts.map +1 -1
- package/dist/cognition/EvermindCognition.js.map +1 -1
- package/dist/diagnostics/stack-diagnostic.js.map +1 -1
- package/dist/distillation/DistillationEngine.d.ts.map +1 -1
- package/dist/distillation/DistillationEngine.js.map +1 -1
- package/dist/errors/SSMError.d.ts +2 -2
- package/dist/errors/SSMError.d.ts.map +1 -1
- package/dist/errors/SSMError.js.map +1 -1
- package/dist/eval/EvalHarness.d.ts.map +1 -1
- package/dist/eval/EvalHarness.js.map +1 -1
- package/dist/evermind/runtime.js.map +1 -1
- package/dist/evermind/textCoherence.js.map +1 -1
- package/dist/evermind/toolCall.js.map +1 -1
- package/dist/handoff/pack.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/ingest/IngestionPipeline.d.ts.map +1 -1
- package/dist/ingest/docsExtract.d.ts +9 -3
- package/dist/ingest/docsExtract.d.ts.map +1 -1
- package/dist/ingest/docsExtract.js +73 -20
- package/dist/ingest/docsExtract.js.map +1 -1
- package/dist/ingest/index.d.ts +1 -1
- package/dist/ingest/index.d.ts.map +1 -1
- package/dist/ingest/index.js +1 -1
- package/dist/ingest/index.js.map +1 -1
- package/dist/ingest/parserSupport.d.ts +16 -0
- package/dist/ingest/parserSupport.d.ts.map +1 -0
- package/dist/ingest/parserSupport.js +18 -0
- package/dist/ingest/parserSupport.js.map +1 -0
- package/dist/ingest/parsers.d.ts +3 -3
- package/dist/ingest/parsers.d.ts.map +1 -1
- package/dist/ingest/parsers.js +3 -92
- package/dist/ingest/parsers.js.map +1 -1
- package/dist/ingest/textParsers.d.ts +9 -0
- package/dist/ingest/textParsers.d.ts.map +1 -0
- package/dist/ingest/textParsers.js +99 -0
- package/dist/ingest/textParsers.js.map +1 -0
- package/dist/knowledge/build.d.ts +2 -0
- package/dist/knowledge/build.d.ts.map +1 -1
- package/dist/knowledge/build.js +46 -12
- package/dist/knowledge/build.js.map +1 -1
- package/dist/knowledge/cards.js.map +1 -1
- package/dist/knowledge/extractFile.d.ts +51 -0
- package/dist/knowledge/extractFile.d.ts.map +1 -0
- package/dist/knowledge/extractFile.js +59 -0
- package/dist/knowledge/extractFile.js.map +1 -0
- package/dist/knowledge/findings.d.ts +6 -0
- package/dist/knowledge/findings.d.ts.map +1 -1
- package/dist/knowledge/findings.js +9 -7
- package/dist/knowledge/findings.js.map +1 -1
- package/dist/knowledge/importance.js.map +1 -1
- package/dist/knowledge/index.d.ts +10 -7
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +8 -7
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/judge.d.ts +34 -2
- package/dist/knowledge/judge.d.ts.map +1 -1
- package/dist/knowledge/judge.js +86 -16
- package/dist/knowledge/judge.js.map +1 -1
- package/dist/knowledge/model.d.ts +13 -62
- package/dist/knowledge/model.d.ts.map +1 -1
- package/dist/knowledge/owedFiles.d.ts +68 -0
- package/dist/knowledge/owedFiles.d.ts.map +1 -0
- package/dist/knowledge/owedFiles.js +86 -0
- package/dist/knowledge/owedFiles.js.map +1 -0
- package/dist/knowledge/packs/docs.d.ts +5 -2
- package/dist/knowledge/packs/docs.d.ts.map +1 -1
- package/dist/knowledge/packs/docs.js +33 -5
- package/dist/knowledge/packs/docs.js.map +1 -1
- package/dist/knowledge/plan.d.ts +37 -3
- package/dist/knowledge/plan.d.ts.map +1 -1
- package/dist/knowledge/plan.js +66 -19
- package/dist/knowledge/plan.js.map +1 -1
- package/dist/knowledge/refs.d.ts +22 -1
- package/dist/knowledge/refs.d.ts.map +1 -1
- package/dist/knowledge/refs.js +52 -0
- package/dist/knowledge/refs.js.map +1 -1
- package/dist/knowledge/review.d.ts +10 -4
- package/dist/knowledge/review.d.ts.map +1 -1
- package/dist/knowledge/review.js +125 -109
- package/dist/knowledge/review.js.map +1 -1
- package/dist/knowledge/reviewCompare.d.ts +39 -0
- package/dist/knowledge/reviewCompare.d.ts.map +1 -0
- package/dist/knowledge/reviewCompare.js +70 -0
- package/dist/knowledge/reviewCompare.js.map +1 -0
- package/dist/knowledge/reviewModel.d.ts +86 -0
- package/dist/knowledge/reviewModel.d.ts.map +1 -0
- package/dist/knowledge/reviewModel.js +6 -0
- package/dist/knowledge/reviewModel.js.map +1 -0
- package/dist/knowledge/reviewStored.d.ts +23 -0
- package/dist/knowledge/reviewStored.d.ts.map +1 -0
- package/dist/knowledge/reviewStored.js +62 -0
- package/dist/knowledge/reviewStored.js.map +1 -0
- package/dist/knowledge/sources.d.ts +34 -4
- package/dist/knowledge/sources.d.ts.map +1 -1
- package/dist/knowledge/sources.js +92 -26
- package/dist/knowledge/sources.js.map +1 -1
- package/dist/knowledge/stores/localSnapshotStore.d.ts.map +1 -1
- package/dist/knowledge/stores/localSnapshotStore.js.map +1 -1
- package/dist/knowledge/trace.js.map +1 -1
- package/dist/knowledge/truncate.d.ts +4 -4
- package/dist/knowledge/truncate.d.ts.map +1 -1
- package/dist/knowledge/truncate.js +9 -13
- package/dist/knowledge/truncate.js.map +1 -1
- package/dist/limbic/LimbicSession.d.ts.map +1 -1
- package/dist/limbic/LimbicSession.js.map +1 -1
- package/dist/memory/MemoryStore.d.ts.map +1 -1
- package/dist/memory/MemoryStore.js.map +1 -1
- package/dist/memory/SemanticRecall.d.ts.map +1 -1
- package/dist/memory/SemanticRecall.js.map +1 -1
- package/dist/memory/ttlSweeper.d.ts.map +1 -1
- package/dist/orchestration/AgentGraph.d.ts.map +1 -1
- package/dist/orchestration/AgentGraph.js.map +1 -1
- package/dist/orchestration/checkpoint.d.ts.map +1 -1
- package/dist/orchestration/checkpoint.js.map +1 -1
- package/dist/publish/huggingface.js.map +1 -1
- package/dist/rag/EnterpriseRetriever.d.ts.map +1 -1
- package/dist/rag/EnterpriseRetriever.js.map +1 -1
- package/dist/retrieval/HybridRetriever.js.map +1 -1
- package/dist/retrieval/bm25.js.map +1 -1
- package/dist/retrieval/chunk.js.map +1 -1
- package/dist/retrieval/fusion.js.map +1 -1
- package/dist/retrieval/hnsw.d.ts.map +1 -1
- package/dist/retrieval/hnsw.js.map +1 -1
- package/dist/retrieval/knowledge-index/bytes.d.ts.map +1 -1
- package/dist/retrieval/knowledge-index/bytes.js.map +1 -1
- package/dist/retrieval/knowledge-index/cascade.js.map +1 -1
- package/dist/retrieval/knowledge-index/embeddings.d.ts.map +1 -1
- package/dist/retrieval/knowledge-index/embeddings.js.map +1 -1
- package/dist/retrieval/knowledge-index/expand.js.map +1 -1
- package/dist/retrieval/knowledge-index/index.js.map +1 -1
- package/dist/retrieval/knowledge-index/lexical.d.ts.map +1 -1
- package/dist/retrieval/knowledge-index/sha256.d.ts.map +1 -1
- package/dist/retrieval/order.js.map +1 -1
- package/dist/router/InferenceRouter.d.ts.map +1 -1
- package/dist/router/InferenceRouter.js.map +1 -1
- package/dist/runtime/SSMRuntime.d.ts.map +1 -1
- package/dist/runtime/SSMRuntime.js.map +1 -1
- package/dist/session/errors.d.ts +2 -2
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/errors.js.map +1 -1
- package/dist/session/session.d.ts.map +1 -1
- package/dist/session/session.js.map +1 -1
- package/dist/session/streaming.js.map +1 -1
- package/dist/storage/ScopedFactRepository.d.ts.map +1 -1
- package/dist/storage/ScopedFactRepository.js.map +1 -1
- package/dist/storage/fileLock.d.ts.map +1 -1
- package/dist/storage/fileLock.js.map +1 -1
- package/dist/storage/fileTransaction.d.ts.map +1 -1
- package/dist/storage/fileTransaction.js.map +1 -1
- package/dist/storage/idbAdapter.d.ts +1 -1
- package/dist/storage/idbAdapter.d.ts.map +1 -1
- package/dist/storage/idbAdapter.js.map +1 -1
- package/dist/storage/nodeFileAdapter.d.ts +1 -1
- package/dist/storage/nodeFileAdapter.d.ts.map +1 -1
- package/dist/storage/nodeFileAdapter.js.map +1 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/telemetry/InstrumentedBridge.d.ts.map +1 -1
- package/dist/telemetry/InstrumentedBridge.js.map +1 -1
- package/dist/telemetry/MetricsRegistry.d.ts.map +1 -1
- package/dist/telemetry/MetricsRegistry.js.map +1 -1
- package/dist/telemetry/Tracer.d.ts.map +1 -1
- package/dist/telemetry/Tracer.js.map +1 -1
- package/dist/telemetry/exporters.d.ts.map +1 -1
- package/dist/telemetry/exporters.js.map +1 -1
- package/dist/telemetry/pricing.js.map +1 -1
- package/dist/vectorstore/MemoryVectorStore.d.ts.map +1 -1
- package/dist/vectorstore/MemoryVectorStore.js.map +1 -1
- package/dist/vectorstore/RestVectorStore.d.ts.map +1 -1
- package/dist/vectorstore/dialects.js.map +1 -1
- package/dist/vectorstore/filter.js.map +1 -1
- package/dist/wire/chatClient.d.ts +5 -0
- package/dist/wire/chatClient.d.ts.map +1 -1
- package/dist/wire/chatClient.js +6 -0
- package/dist/wire/chatClient.js.map +1 -1
- package/dist/wire/usage.d.ts.map +1 -1
- package/dist/workflow/registry.d.ts.map +1 -1
- package/dist/workflow/run.js.map +1 -1
- package/dist/workflow/templates.js.map +1 -1
- package/dist/working/codemapAreas.js.map +1 -1
- package/dist/working/consolidate.js.map +1 -1
- package/dist/working/workingMemory.d.ts.map +1 -1
- package/dist/working/workingMemory.js.map +1 -1
- package/package.json +8 -9
- package/src/ingest/docsExtract.ts +68 -18
- package/src/ingest/index.ts +1 -0
- package/src/ingest/parserSupport.ts +24 -0
- package/src/ingest/parsers.ts +4 -102
- package/src/ingest/textParsers.ts +107 -0
- package/src/knowledge/build.ts +43 -11
- package/src/knowledge/extractFile.ts +86 -0
- package/src/knowledge/findings.ts +12 -5
- package/src/knowledge/index.ts +15 -8
- package/src/knowledge/judge.clamp.test.ts +61 -0
- package/src/knowledge/judge.ts +88 -19
- package/src/knowledge/model.ts +15 -57
- package/src/knowledge/owedFiles.ts +108 -0
- package/src/knowledge/packs/docs.ts +34 -5
- package/src/knowledge/plan.ts +93 -19
- package/src/knowledge/refs.ts +49 -1
- package/src/knowledge/review.details.test.ts +93 -0
- package/src/knowledge/review.estimate.test.ts +112 -0
- package/src/knowledge/review.fixes.test.ts +235 -0
- package/src/knowledge/review.gaps.test.ts +167 -0
- package/src/knowledge/review.owed.test.ts +379 -0
- package/src/knowledge/review.test.ts +2 -15
- package/src/knowledge/review.ts +114 -117
- package/src/knowledge/review.upgrade.test.ts +257 -0
- package/src/knowledge/reviewCompare.ts +80 -0
- package/src/knowledge/reviewModel.ts +81 -0
- package/src/knowledge/reviewStored.ts +62 -0
- package/src/knowledge/sources.ts +97 -20
- package/src/knowledge/testkit.test-util.ts +39 -1
- package/src/knowledge/truncate.ts +8 -11
- package/src/wire/chatClient.ts +13 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* (cached by content hash) and are NEVER written to a KnowledgeStore; `model`/`human`/`agent`
|
|
10
10
|
* ones are stored with the content hash they were judged from and go stale when it changes.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { SourceDocument, ParsedSection } from '../ingest/types.js';
|
|
13
13
|
import type { IndexDoc, SimilarPair } from '../retrieval/knowledge-index/types.js';
|
|
14
14
|
/** `src:${rootId}::${path}` · `ent:${pack}:${normalizedName}` · `fact:${key}` (claims are `fact:claim:${hash}`). */
|
|
15
15
|
export type NodeRef = `src:${string}` | `ent:${string}` | `fact:${string}`;
|
|
@@ -43,11 +43,21 @@ export interface KEdge {
|
|
|
43
43
|
confidence?: number;
|
|
44
44
|
verdict?: EdgeVerdict;
|
|
45
45
|
cycle?: boolean;
|
|
46
|
+
/** A stored relation whose source changed since it was judged (§5.2): shown, never treated as current. */
|
|
47
|
+
stale?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Extracted edges only: the `[[Name]]` this link was written with. `buildGraph` re-points
|
|
50
|
+
* the edge to the one present file of that name (else it keeps its beside-the-file
|
|
51
|
+
* target) — so the cached extract never depends on which other files exist. Never emitted.
|
|
52
|
+
*/
|
|
53
|
+
byName?: string;
|
|
46
54
|
}
|
|
47
55
|
/** Output of a pack's deterministic extractor (or analyzer) for one source. Never stored. */
|
|
48
56
|
export interface Extracted {
|
|
49
57
|
sourceRef: NodeRef;
|
|
50
58
|
sourceHash: string;
|
|
59
|
+
/** The extractor version (`EXTRACTOR_VERSION`) that produced it; a cached entry of another version is ignored. */
|
|
60
|
+
extractorVersion?: number;
|
|
51
61
|
nodes: KNode[];
|
|
52
62
|
edges: KEdge[];
|
|
53
63
|
/** Exact keys for entity resolution and the index's exact tier. */
|
|
@@ -210,18 +220,6 @@ export interface KnowledgeStore {
|
|
|
210
220
|
getExtracted?(hash: string): Promise<Extracted[] | undefined>;
|
|
211
221
|
putExtracted?(hash: string, extracted: Extracted[]): Promise<void>;
|
|
212
222
|
}
|
|
213
|
-
/** Where files come from: one adapter per host. */
|
|
214
|
-
export interface DirectorySource {
|
|
215
|
-
rootId: string;
|
|
216
|
-
title: string;
|
|
217
|
-
list(): AsyncIterable<{
|
|
218
|
-
path: string;
|
|
219
|
-
hash: string;
|
|
220
|
-
size: number;
|
|
221
|
-
}>;
|
|
222
|
-
read(path: string): Promise<SourceDocument>;
|
|
223
|
-
watch?(cb: (paths: string[]) => void): () => void;
|
|
224
|
-
}
|
|
225
223
|
export interface LiveOverlay {
|
|
226
224
|
changes: Array<{
|
|
227
225
|
path: string;
|
|
@@ -249,55 +247,6 @@ export interface KnowledgeGraph {
|
|
|
249
247
|
truncated: boolean;
|
|
250
248
|
};
|
|
251
249
|
}
|
|
252
|
-
export interface ReviewPlan {
|
|
253
|
-
rootId: string;
|
|
254
|
-
files: number;
|
|
255
|
-
byPack: Record<string, number>;
|
|
256
|
-
unchanged: number;
|
|
257
|
-
changed: string[];
|
|
258
|
-
removed: string[];
|
|
259
|
-
skipped: Array<{
|
|
260
|
-
path: string;
|
|
261
|
-
reason: 'ignored' | 'binary' | 'too-large' | 'no-pack';
|
|
262
|
-
}>;
|
|
263
|
-
/** ≈ judgement calls for changed files (sections of judged kinds). */
|
|
264
|
-
estimatedModelCalls: number;
|
|
265
|
-
}
|
|
266
|
-
export interface ReviewProgress {
|
|
267
|
-
phase: 'plan' | 'extract' | 'resolve' | 'judge' | 'write' | 'index' | 'done';
|
|
268
|
-
done: number;
|
|
269
|
-
total: number;
|
|
270
|
-
path?: string;
|
|
271
|
-
}
|
|
272
|
-
export interface ReviewReport {
|
|
273
|
-
rootId: string;
|
|
274
|
-
digest: string;
|
|
275
|
-
extracted: number;
|
|
276
|
-
judged: number;
|
|
277
|
-
/** Sections left extracted-only because the budget ran out. */
|
|
278
|
-
unjudged: number;
|
|
279
|
-
invalidJudgements: number;
|
|
280
|
-
factsWritten: number;
|
|
281
|
-
relationsWritten: number;
|
|
282
|
-
staleMarked: number;
|
|
283
|
-
aborted: boolean;
|
|
284
|
-
durationMs: number;
|
|
285
|
-
}
|
|
286
|
-
export interface ReviewArgs {
|
|
287
|
-
source: DirectorySource;
|
|
288
|
-
store: KnowledgeStore;
|
|
289
|
-
packs: KnowledgePack[];
|
|
290
|
-
manifest: IngestManifest;
|
|
291
|
-
judgement?: JudgementPort;
|
|
292
|
-
/** Near-duplicate claim pairs to compare / possible-same entities; from the knowledge index. */
|
|
293
|
-
similar?: (ids: string[]) => Promise<SimilarPair[]>;
|
|
294
|
-
budget: {
|
|
295
|
-
modelCalls: number;
|
|
296
|
-
ms: number;
|
|
297
|
-
};
|
|
298
|
-
signal?: AbortSignal;
|
|
299
|
-
onProgress?(p: ReviewProgress): void;
|
|
300
|
-
}
|
|
301
250
|
export interface BuildGraphInput {
|
|
302
251
|
rootId: string;
|
|
303
252
|
extracted: Extracted[];
|
|
@@ -330,4 +279,6 @@ export interface Trace {
|
|
|
330
279
|
}
|
|
331
280
|
/** Re-exported for card consumers. */
|
|
332
281
|
export type { IndexDoc };
|
|
282
|
+
/** The review's ports and reports live beside it (reviewModel.ts); re-exported so one import serves. */
|
|
283
|
+
export type { DirectorySource, ReviewPlan, ReviewProgress, ReviewReport, ReviewArgs, } from './reviewModel.js';
|
|
333
284
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/knowledge/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/knowledge/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEnF,oHAAoH;AACpH,MAAM,MAAM,OAAO,GAAG,OAAO,MAAM,EAAE,GAAG,OAAO,MAAM,EAAE,GAAG,QAAQ,MAAM,EAAE,CAAC;AAE3E,MAAM,MAAM,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,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M,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,qDAAqD;IACrD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,sCAAsC;AACtC,YAAY,EAAE,QAAQ,EAAE,CAAC;AACzB,wGAAwG;AACxG,YAAY,EACR,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,GACxE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge/owedFiles.ts — the extractor entry of a root's manifest (PRD 38 §4.3): the
|
|
3
|
+
* extractor version the files were last reviewed with, and the files still OWED a
|
|
4
|
+
* re-extraction under it. Planning reads it, every run writes it — aborted or not.
|
|
5
|
+
*
|
|
6
|
+
* A file is owed when the stored version is not {@link EXTRACTOR_VERSION} (every file, once),
|
|
7
|
+
* or when an earlier run left it unfinished (a read error, an abort before it, the budget, a
|
|
8
|
+
* failed judge call). Owed is independent of the file's content: a content-changed file left
|
|
9
|
+
* unfinished is recorded too — under any version — so its debt survives the bytes reverting
|
|
10
|
+
* to the manifest hash. A path the plan no longer lists (ignored, claimed by no pack, a run
|
|
11
|
+
* that aborted before retiring it) stays owed while the files manifest still holds it; once
|
|
12
|
+
* retired it drops out.
|
|
13
|
+
*
|
|
14
|
+
* Stored under {@link extractorManifestKey} as fingerprints: `{ id: 'version', hash: '<version>' }`
|
|
15
|
+
* plus one `{ id: 'owed:<path>', hash: '<calls>' }` per owed file, where `<calls>` is the
|
|
16
|
+
* decimal number of model calls the file is still expected to cost (the plan's estimate):
|
|
17
|
+
* • a file the run reached but did not finish: the sections the budget or a failed call left
|
|
18
|
+
* unjudged; for a content-changed file, every section it had to judge plus what it was
|
|
19
|
+
* already owed (a revert to the manifest bytes re-judges them all);
|
|
20
|
+
* • a file not reached (an abort) or unreadable: what it was already owed at, {@link owedCalls}
|
|
21
|
+
* — the recorded count, plus the one new section a re-extraction may add while the stored
|
|
22
|
+
* version is not today's. A read error learns nothing about the file, so a permanently
|
|
23
|
+
* unreadable file is the only file re-read and its known debt is neither erased nor invented.
|
|
24
|
+
* An old `[{ id: 'version', … }]` value is `{ version, owed: none }`; a missing or empty value
|
|
25
|
+
* is an upgrade — every file owed one call.
|
|
26
|
+
*/
|
|
27
|
+
import type { IngestManifest } from '../ingest/types.js';
|
|
28
|
+
export interface ExtractorState {
|
|
29
|
+
/** The version the files were last reviewed with; undefined when never recorded. */
|
|
30
|
+
version: number | undefined;
|
|
31
|
+
/** Paths a previous run left unfinished under that version → model calls each still costs. */
|
|
32
|
+
owed: ReadonlyMap<string, number>;
|
|
33
|
+
}
|
|
34
|
+
export declare function loadExtractorState(manifest: IngestManifest, rootId: string): Promise<ExtractorState>;
|
|
35
|
+
/** True when `path` is owed a re-extraction: another extractor version than today's, or left unfinished before. */
|
|
36
|
+
export declare const isOwed: (state: ExtractorState, path: string) => boolean;
|
|
37
|
+
/** Model calls an owed `path` is expected to cost: its recorded count, plus one while an upgrade is pending. */
|
|
38
|
+
export declare const owedCalls: (state: ExtractorState, path: string) => number;
|
|
39
|
+
/**
|
|
40
|
+
* Paths in the files manifest that the plan does not list yet are owed: ignored, claimed by
|
|
41
|
+
* no pack, or missing from an older plan handed to *Continue*. A removed path is among them
|
|
42
|
+
* until the run retires it; the run saves only those still in the manifest.
|
|
43
|
+
*/
|
|
44
|
+
export declare function carriedOwed(state: ExtractorState, prior: ReadonlyMap<string, string>, planned: Iterable<string>): string[];
|
|
45
|
+
/**
|
|
46
|
+
* The owed record a run leaves: its unfinished files that are owed or content-changed (at the
|
|
47
|
+
* cost it measured, else the one it was owed at), and the carried paths the files manifest
|
|
48
|
+
* still holds (`live`). A forced run's unchanged, not-owed files are neither, so it never
|
|
49
|
+
* widens the set.
|
|
50
|
+
*/
|
|
51
|
+
export declare function owedAfterRun(a: {
|
|
52
|
+
state: ExtractorState;
|
|
53
|
+
changed: ReadonlyArray<{
|
|
54
|
+
path: string;
|
|
55
|
+
hash: string;
|
|
56
|
+
owed: boolean;
|
|
57
|
+
}>;
|
|
58
|
+
/** The files manifest as the plan read it: a hash that differs from the file's is a content change. */
|
|
59
|
+
prior: ReadonlyMap<string, string>;
|
|
60
|
+
finished: ReadonlySet<string>;
|
|
61
|
+
carried: readonly string[];
|
|
62
|
+
live: ReadonlyMap<string, string>;
|
|
63
|
+
/** Calls a file this run reached but did not finish still costs. */
|
|
64
|
+
measured: ReadonlyMap<string, number>;
|
|
65
|
+
}): Map<string, number>;
|
|
66
|
+
/** Records today's version and exactly the files still owed after this run. */
|
|
67
|
+
export declare function saveExtractorState(manifest: IngestManifest, rootId: string, owed: ReadonlyMap<string, number>): Promise<void>;
|
|
68
|
+
//# sourceMappingURL=owedFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owedFiles.d.ts","sourceRoot":"","sources":["../../src/knowledge/owedFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AASzD,MAAM,WAAW,cAAc;IAC3B,oFAAoF;IACpF,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,8FAA8F;IAC9F,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAa1G;AAED,mHAAmH;AACnH,eAAO,MAAM,MAAM,UAAW,cAAc,QAAQ,MAAM,KAAG,OACE,CAAC;AAEhE,gHAAgH;AAChH,eAAO,MAAM,SAAS,UAAW,cAAc,QAAQ,MAAM,KAAG,MAC2B,CAAC;AAE5F;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAG1H;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE;IAC5B,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACtE,uGAAuG;IACvG,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,oEAAoE;IACpE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAOtB;AAED,+EAA+E;AAC/E,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAKnI"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge/owedFiles.ts — the extractor entry of a root's manifest (PRD 38 §4.3): the
|
|
3
|
+
* extractor version the files were last reviewed with, and the files still OWED a
|
|
4
|
+
* re-extraction under it. Planning reads it, every run writes it — aborted or not.
|
|
5
|
+
*
|
|
6
|
+
* A file is owed when the stored version is not {@link EXTRACTOR_VERSION} (every file, once),
|
|
7
|
+
* or when an earlier run left it unfinished (a read error, an abort before it, the budget, a
|
|
8
|
+
* failed judge call). Owed is independent of the file's content: a content-changed file left
|
|
9
|
+
* unfinished is recorded too — under any version — so its debt survives the bytes reverting
|
|
10
|
+
* to the manifest hash. A path the plan no longer lists (ignored, claimed by no pack, a run
|
|
11
|
+
* that aborted before retiring it) stays owed while the files manifest still holds it; once
|
|
12
|
+
* retired it drops out.
|
|
13
|
+
*
|
|
14
|
+
* Stored under {@link extractorManifestKey} as fingerprints: `{ id: 'version', hash: '<version>' }`
|
|
15
|
+
* plus one `{ id: 'owed:<path>', hash: '<calls>' }` per owed file, where `<calls>` is the
|
|
16
|
+
* decimal number of model calls the file is still expected to cost (the plan's estimate):
|
|
17
|
+
* • a file the run reached but did not finish: the sections the budget or a failed call left
|
|
18
|
+
* unjudged; for a content-changed file, every section it had to judge plus what it was
|
|
19
|
+
* already owed (a revert to the manifest bytes re-judges them all);
|
|
20
|
+
* • a file not reached (an abort) or unreadable: what it was already owed at, {@link owedCalls}
|
|
21
|
+
* — the recorded count, plus the one new section a re-extraction may add while the stored
|
|
22
|
+
* version is not today's. A read error learns nothing about the file, so a permanently
|
|
23
|
+
* unreadable file is the only file re-read and its known debt is neither erased nor invented.
|
|
24
|
+
* An old `[{ id: 'version', … }]` value is `{ version, owed: none }`; a missing or empty value
|
|
25
|
+
* is an upgrade — every file owed one call.
|
|
26
|
+
*/
|
|
27
|
+
import { compareStr } from './refs.js';
|
|
28
|
+
import { EXTRACTOR_VERSION, extractorManifestKey } from './sources.js';
|
|
29
|
+
const VERSION_ID = 'version';
|
|
30
|
+
const OWED_PREFIX = 'owed:';
|
|
31
|
+
/** What a version upgrade costs per file: the one new section a re-extraction may add (an upper bound). */
|
|
32
|
+
const UPGRADE_CALLS = 1;
|
|
33
|
+
export async function loadExtractorState(manifest, rootId) {
|
|
34
|
+
let version;
|
|
35
|
+
const owed = new Map();
|
|
36
|
+
for (const { id, hash } of (await manifest.get(extractorManifestKey(rootId))) ?? []) {
|
|
37
|
+
if (id === VERSION_ID) {
|
|
38
|
+
const v = Number(hash);
|
|
39
|
+
if (Number.isFinite(v))
|
|
40
|
+
version = v;
|
|
41
|
+
}
|
|
42
|
+
else if (id.startsWith(OWED_PREFIX)) {
|
|
43
|
+
const calls = Number(hash);
|
|
44
|
+
owed.set(id.slice(OWED_PREFIX.length), Number.isFinite(calls) && calls >= 0 ? calls : UPGRADE_CALLS);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { version, owed };
|
|
48
|
+
}
|
|
49
|
+
/** True when `path` is owed a re-extraction: another extractor version than today's, or left unfinished before. */
|
|
50
|
+
export const isOwed = (state, path) => state.version !== EXTRACTOR_VERSION || state.owed.has(path);
|
|
51
|
+
/** Model calls an owed `path` is expected to cost: its recorded count, plus one while an upgrade is pending. */
|
|
52
|
+
export const owedCalls = (state, path) => (state.version !== EXTRACTOR_VERSION ? UPGRADE_CALLS : 0) + (state.owed.get(path) ?? 0);
|
|
53
|
+
/**
|
|
54
|
+
* Paths in the files manifest that the plan does not list yet are owed: ignored, claimed by
|
|
55
|
+
* no pack, or missing from an older plan handed to *Continue*. A removed path is among them
|
|
56
|
+
* until the run retires it; the run saves only those still in the manifest.
|
|
57
|
+
*/
|
|
58
|
+
export function carriedOwed(state, prior, planned) {
|
|
59
|
+
const listed = new Set(planned);
|
|
60
|
+
return [...prior.keys()].filter((p) => !listed.has(p) && isOwed(state, p)).sort(compareStr);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The owed record a run leaves: its unfinished files that are owed or content-changed (at the
|
|
64
|
+
* cost it measured, else the one it was owed at), and the carried paths the files manifest
|
|
65
|
+
* still holds (`live`). A forced run's unchanged, not-owed files are neither, so it never
|
|
66
|
+
* widens the set.
|
|
67
|
+
*/
|
|
68
|
+
export function owedAfterRun(a) {
|
|
69
|
+
const out = new Map();
|
|
70
|
+
for (const f of a.changed) {
|
|
71
|
+
if ((f.owed || a.prior.get(f.path) !== f.hash) && !a.finished.has(f.path))
|
|
72
|
+
out.set(f.path, a.measured.get(f.path) ?? owedCalls(a.state, f.path));
|
|
73
|
+
}
|
|
74
|
+
for (const p of a.carried)
|
|
75
|
+
if (a.live.has(p))
|
|
76
|
+
out.set(p, owedCalls(a.state, p));
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
/** Records today's version and exactly the files still owed after this run. */
|
|
80
|
+
export async function saveExtractorState(manifest, rootId, owed) {
|
|
81
|
+
await manifest.set(extractorManifestKey(rootId), [
|
|
82
|
+
{ id: VERSION_ID, hash: String(EXTRACTOR_VERSION) },
|
|
83
|
+
...[...owed].sort((a, b) => compareStr(a[0], b[0])).map(([path, calls]) => ({ id: `${OWED_PREFIX}${path}`, hash: String(calls) })),
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=owedFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owedFiles.js","sourceRoot":"","sources":["../../src/knowledge/owedFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,2GAA2G;AAC3G,MAAM,aAAa,GAAG,CAAC,CAAC;AASxB,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAwB,EAAE,MAAc;IAC7E,IAAI,OAA2B,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,KAAK,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,QAAQ,CAAC,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C,MAAM,CAAC,EAAE;QAC7C,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAAE;QACnD,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KACrI,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Parsers are the ONE builtin ingest parsers (markdown, HTML, plain text); their `extract`
|
|
5
5
|
* lives in `ingest/docsExtract.ts`. Partitions: one plane per top-level folder, no `allow`
|
|
6
|
-
* (so no verdicts). Findings: broken links
|
|
7
|
-
*
|
|
6
|
+
* (so no verdicts). Findings: broken links, orphan documents and contradictions (the
|
|
7
|
+
* generic rules add near-duplicate sections and stale claims). Judgement: claims, entities
|
|
8
|
+
* and contradictions per section.
|
|
8
9
|
*/
|
|
9
10
|
import { DOCS_PACK_ID } from '../../ingest/docsExtract.js';
|
|
10
11
|
import type { FindingRule, KnowledgePack } from '../model.js';
|
|
@@ -13,5 +14,7 @@ export { DOCS_PACK_ID };
|
|
|
13
14
|
export declare const brokenLinkRule: FindingRule;
|
|
14
15
|
/** Documents no other document links to (entry documents aside), as one finding. */
|
|
15
16
|
export declare const orphanDocumentRule: FindingRule;
|
|
17
|
+
/** Two claims a model judged `contradicts`: one finding per pair, naming both sources to reconcile. */
|
|
18
|
+
export declare const contradictionRule: FindingRule;
|
|
16
19
|
export declare const DOCS_PACK: KnowledgePack;
|
|
17
20
|
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/knowledge/packs/docs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/knowledge/packs/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAW,WAAW,EAAkB,aAAa,EAAW,MAAM,aAAa,CAAC;AAKhG,OAAO,EAAE,YAAY,EAAE,CAAC;AAWxB,kFAAkF;AAClF,eAAO,MAAM,cAAc,EAAE,WAyB5B,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,EAAE,WAqBhC,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,iBAAiB,EAAE,WAyB/B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,aAWvB,CAAC"}
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Parsers are the ONE builtin ingest parsers (markdown, HTML, plain text); their `extract`
|
|
5
5
|
* lives in `ingest/docsExtract.ts`. Partitions: one plane per top-level folder, no `allow`
|
|
6
|
-
* (so no verdicts). Findings: broken links
|
|
7
|
-
*
|
|
6
|
+
* (so no verdicts). Findings: broken links, orphan documents and contradictions (the
|
|
7
|
+
* generic rules add near-duplicate sections and stale claims). Judgement: claims, entities
|
|
8
|
+
* and contradictions per section.
|
|
8
9
|
*/
|
|
9
10
|
import { htmlParser, markdownParser, plainTextParser } from '../../ingest/parsers.js';
|
|
10
11
|
import { DOCS_PACK_ID } from '../../ingest/docsExtract.js';
|
|
11
|
-
import { findingId, MAX_FINDING_NODES, requestKeyFor } from '../findings.js';
|
|
12
|
+
import { finding, findingId, MAX_FINDING_NODES, requestKeyFor } from '../findings.js';
|
|
12
13
|
import { TOP_LEVEL_FOLDER } from '../partitions.js';
|
|
13
|
-
import { basenameOf, compareStr, fileRefOf, pathOfRef } from '../refs.js';
|
|
14
|
+
import { aboutTargets, basenameOf, compareStr, fileRefOf, pathOfRef } from '../refs.js';
|
|
14
15
|
export { DOCS_PACK_ID };
|
|
15
16
|
/** Targets with these extensions (or none) are documents; a link to anything else is not judged broken. */
|
|
16
17
|
const DOC_TARGET = /(?:\.(?:md|markdown|mdx|html?|txt|rst|adoc)|\/[^./]*|^[^./]*)$/i;
|
|
@@ -74,6 +75,33 @@ export const orphanDocumentRule = {
|
|
|
74
75
|
}];
|
|
75
76
|
},
|
|
76
77
|
};
|
|
78
|
+
/** Two claims a model judged `contradicts`: one finding per pair, naming both sources to reconcile. */
|
|
79
|
+
export const contradictionRule = {
|
|
80
|
+
id: 'docs.contradiction',
|
|
81
|
+
find(g) {
|
|
82
|
+
const label = new Map(g.nodes.map((n) => [n.ref, n.label]));
|
|
83
|
+
// The section (else file) a claim is `about`: the most specific source it was judged from.
|
|
84
|
+
const source = aboutTargets(g.edges, { preferSection: true });
|
|
85
|
+
const where = (claim) => {
|
|
86
|
+
const at = source.get(claim);
|
|
87
|
+
const file = at ? fileRefOf(at) : undefined;
|
|
88
|
+
return {
|
|
89
|
+
file: (file && pathOfRef(file)) ?? '',
|
|
90
|
+
section: at && at !== file ? label.get(at) ?? '' : '',
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
return g.edges
|
|
94
|
+
.filter((e) => e.kind === 'contradicts')
|
|
95
|
+
.map((e) => {
|
|
96
|
+
const a = where(e.from), b = where(e.to);
|
|
97
|
+
const sources = [source.get(e.from), source.get(e.to)].filter((r) => !!r);
|
|
98
|
+
return finding('contradiction', DOCS_PACK_ID, [e.from, e.to, ...sources], e.stale ? 'info' : 'warn', {
|
|
99
|
+
fileA: a.file, sectionA: a.section, fileB: b.file, sectionB: b.section,
|
|
100
|
+
confidence: Math.round((e.confidence ?? e.weight) * 100),
|
|
101
|
+
}, [e.from, e.to]);
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
};
|
|
77
105
|
export const DOCS_PACK = {
|
|
78
106
|
id: DOCS_PACK_ID,
|
|
79
107
|
parsers: [markdownParser, htmlParser, plainTextParser],
|
|
@@ -83,7 +111,7 @@ export const DOCS_PACK = {
|
|
|
83
111
|
{ id: '(root)', order: 0, match: ['*'] },
|
|
84
112
|
],
|
|
85
113
|
},
|
|
86
|
-
findings: [brokenLinkRule, orphanDocumentRule],
|
|
114
|
+
findings: [brokenLinkRule, orphanDocumentRule, contradictionRule],
|
|
87
115
|
judgement: { nodeKinds: ['section'], claims: true, entities: true, contradictions: true },
|
|
88
116
|
};
|
|
89
117
|
//# sourceMappingURL=docs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/knowledge/packs/docs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/knowledge/packs/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,2GAA2G;AAC3G,MAAM,UAAU,GAAG,iEAAiE,CAAC;AACrF,6DAA6D;AAC7D,MAAM,SAAS,GAAG,+CAA+C,CAAC;AAElE,SAAS,MAAM,CAAC,CAAiB;IAC7B,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,K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bers (PRD 38 §4.3).
|
|
3
3
|
*
|
|
4
4
|
* A walk plus a manifest diff by hash, nothing more: a file whose hash is unchanged is
|
|
5
|
-
* never read. The only reads are the ignore files (`.
|
|
6
|
-
* when the listing has them. Binary files
|
|
7
|
-
*
|
|
5
|
+
* never read. The only reads are the ignore files (`.builderforce/ignore` and every
|
|
6
|
+
* `.gitignore`, a nested one scoped to its folder) when the listing has them. Binary files
|
|
7
|
+
* (by extension — pdf/office only when a host parser claims their media type), oversized
|
|
8
|
+
* files and files no pack accepts are skipped with a reason.
|
|
8
9
|
*/
|
|
9
10
|
import type { IngestManifest } from '../ingest/types.js';
|
|
10
11
|
import type { DirectorySource, KnowledgePack, ReviewPlan } from './model.js';
|
|
12
|
+
import { type ExtractorState } from './owedFiles.js';
|
|
11
13
|
/** ≈ bytes per judged section, for the estimate (the plan does not read changed files). */
|
|
12
14
|
export declare const AVG_SECTION_BYTES = 1500;
|
|
13
15
|
export interface PlanOptions {
|
|
14
16
|
/** Per-file size cap in bytes. Default 2 MB. */
|
|
15
17
|
maxFileBytes?: number;
|
|
18
|
+
/**
|
|
19
|
+
* *Re-review all*: every file is `changed`, whatever its hash — but `removed` still comes
|
|
20
|
+
* from the real prior manifest, and the estimate still counts only files whose content
|
|
21
|
+
* changed (sections whose text was judged before are re-anchored, not judged again), plus
|
|
22
|
+
* one call per file owed a re-extraction.
|
|
23
|
+
* A forced run cut short is forced again, not continued: *Continue* re-derives what is
|
|
24
|
+
* left from content hashes.
|
|
25
|
+
*/
|
|
26
|
+
force?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the run will compare near-duplicate claims, which needs a `similar` port (and a
|
|
29
|
+
* judgement port). Default true. A host that will not pass `similar` MUST pass `false`:
|
|
30
|
+
* otherwise the estimate counts compare calls — including the awaiting backlog a run
|
|
31
|
+
* without ports keeps, up to 2000 claims — that it will never spend. (*Continue* keeps the
|
|
32
|
+
* estimate of the plan it continues; it is not recomputed.)
|
|
33
|
+
*/
|
|
34
|
+
compare?: boolean;
|
|
16
35
|
}
|
|
17
36
|
export interface PlannedFile {
|
|
18
37
|
path: string;
|
|
@@ -20,6 +39,11 @@ export interface PlannedFile {
|
|
|
20
39
|
size: number;
|
|
21
40
|
pack: string;
|
|
22
41
|
changed: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Owed a re-extraction (another extractor version, or left unfinished by an earlier run),
|
|
44
|
+
* whether or not its content moved. See owedFiles.ts.
|
|
45
|
+
*/
|
|
46
|
+
owed: boolean;
|
|
23
47
|
}
|
|
24
48
|
export interface PlanDetail {
|
|
25
49
|
plan: ReviewPlan;
|
|
@@ -27,7 +51,17 @@ export interface PlanDetail {
|
|
|
27
51
|
files: PlannedFile[];
|
|
28
52
|
/** The manifest's prior `path → hash`. */
|
|
29
53
|
prior: Map<string, string>;
|
|
54
|
+
/** The extractor entry the plan was made against. */
|
|
55
|
+
extractor: ExtractorState;
|
|
56
|
+
/** Owed paths the manifest holds that `files` does not list (ignored, no pack, an older plan, removed). */
|
|
57
|
+
carried: string[];
|
|
30
58
|
}
|
|
31
59
|
export declare function planReview(source: DirectorySource, manifest: IngestManifest, packs: KnowledgePack[], opts?: PlanOptions): Promise<ReviewPlan>;
|
|
32
60
|
export declare function planDetail(source: DirectorySource, manifest: IngestManifest, packs: readonly KnowledgePack[], opts?: PlanOptions): Promise<PlanDetail>;
|
|
61
|
+
/**
|
|
62
|
+
* *Continue*: the confirmed plan without a re-walk. Only `changed` is re-read — against the
|
|
63
|
+
* manifest and owed list as the last run left them — so files finished since are not reviewed
|
|
64
|
+
* again, and files it left owed (an upgrade cut short, a failed read) are picked up.
|
|
65
|
+
*/
|
|
66
|
+
export declare function refreshPlan(detail: PlanDetail, manifest: IngestManifest): Promise<PlanDetail>;
|
|
33
67
|
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/knowledge/plan.ts"],"names":[],"mappings":"AAAA
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