@seanhogg/builderforce-memory 2026.10.28 → 2026.10.30
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/ingest/IngestionPipeline.d.ts +1 -8
- package/dist/ingest/IngestionPipeline.d.ts.map +1 -1
- package/dist/ingest/IngestionPipeline.js +3 -15
- package/dist/ingest/IngestionPipeline.js.map +1 -1
- package/dist/ingest/docsExtract.d.ts +30 -0
- package/dist/ingest/docsExtract.d.ts.map +1 -0
- package/dist/ingest/docsExtract.js +221 -0
- package/dist/ingest/docsExtract.js.map +1 -0
- package/dist/ingest/hash.d.ts +15 -0
- package/dist/ingest/hash.d.ts.map +1 -0
- package/dist/ingest/hash.js +22 -0
- package/dist/ingest/hash.js.map +1 -0
- package/dist/ingest/parsers.d.ts.map +1 -1
- package/dist/ingest/parsers.js +4 -0
- package/dist/ingest/parsers.js.map +1 -1
- package/dist/ingest/types.d.ts +7 -0
- package/dist/ingest/types.d.ts.map +1 -1
- package/dist/ingest/types.js.map +1 -1
- package/dist/knowledge/build.d.ts +24 -0
- package/dist/knowledge/build.d.ts.map +1 -0
- package/dist/knowledge/build.js +263 -0
- package/dist/knowledge/build.js.map +1 -0
- package/dist/knowledge/cards.d.ts +17 -0
- package/dist/knowledge/cards.d.ts.map +1 -0
- package/dist/knowledge/cards.js +118 -0
- package/dist/knowledge/cards.js.map +1 -0
- package/dist/knowledge/findings.d.ts +24 -0
- package/dist/knowledge/findings.d.ts.map +1 -0
- package/dist/knowledge/findings.js +152 -0
- package/dist/knowledge/findings.js.map +1 -0
- package/dist/knowledge/importance.d.ts +21 -0
- package/dist/knowledge/importance.d.ts.map +1 -0
- package/dist/knowledge/importance.js +70 -0
- package/dist/knowledge/importance.js.map +1 -0
- package/dist/knowledge/index.d.ts +31 -0
- package/dist/knowledge/index.d.ts.map +1 -0
- package/dist/knowledge/index.js +26 -0
- package/dist/knowledge/index.js.map +1 -0
- package/dist/knowledge/judge.d.ts +86 -0
- package/dist/knowledge/judge.d.ts.map +1 -0
- package/dist/knowledge/judge.js +213 -0
- package/dist/knowledge/judge.js.map +1 -0
- package/dist/knowledge/model.d.ts +333 -0
- package/dist/knowledge/model.d.ts.map +1 -0
- package/dist/knowledge/model.js +13 -0
- package/dist/knowledge/model.js.map +1 -0
- package/dist/knowledge/packs/docs.d.ts +17 -0
- package/dist/knowledge/packs/docs.d.ts.map +1 -0
- package/dist/knowledge/packs/docs.js +89 -0
- package/dist/knowledge/packs/docs.js.map +1 -0
- package/dist/knowledge/partitions.d.ts +31 -0
- package/dist/knowledge/partitions.d.ts.map +1 -0
- package/dist/knowledge/partitions.js +135 -0
- package/dist/knowledge/partitions.js.map +1 -0
- package/dist/knowledge/plan.d.ts +33 -0
- package/dist/knowledge/plan.d.ts.map +1 -0
- package/dist/knowledge/plan.js +89 -0
- package/dist/knowledge/plan.js.map +1 -0
- package/dist/knowledge/refs.d.ts +40 -0
- package/dist/knowledge/refs.d.ts.map +1 -0
- package/dist/knowledge/refs.js +102 -0
- package/dist/knowledge/refs.js.map +1 -0
- package/dist/knowledge/resolve.d.ts +35 -0
- package/dist/knowledge/resolve.d.ts.map +1 -0
- package/dist/knowledge/resolve.js +67 -0
- package/dist/knowledge/resolve.js.map +1 -0
- package/dist/knowledge/review.d.ts +23 -0
- package/dist/knowledge/review.d.ts.map +1 -0
- package/dist/knowledge/review.js +233 -0
- package/dist/knowledge/review.js.map +1 -0
- package/dist/knowledge/sources.d.ts +47 -0
- package/dist/knowledge/sources.d.ts.map +1 -0
- package/dist/knowledge/sources.js +136 -0
- package/dist/knowledge/sources.js.map +1 -0
- package/dist/knowledge/stores/localSnapshotStore.d.ts +50 -0
- package/dist/knowledge/stores/localSnapshotStore.d.ts.map +1 -0
- package/dist/knowledge/stores/localSnapshotStore.js +125 -0
- package/dist/knowledge/stores/localSnapshotStore.js.map +1 -0
- package/dist/knowledge/trace.d.ts +32 -0
- package/dist/knowledge/trace.d.ts.map +1 -0
- package/dist/knowledge/trace.js +102 -0
- package/dist/knowledge/trace.js.map +1 -0
- package/dist/knowledge/truncate.d.ts +24 -0
- package/dist/knowledge/truncate.d.ts.map +1 -0
- package/dist/knowledge/truncate.js +128 -0
- package/dist/knowledge/truncate.js.map +1 -0
- package/dist/memory/SemanticRecall.d.ts.map +1 -1
- package/dist/memory/SemanticRecall.js +3 -1
- package/dist/memory/SemanticRecall.js.map +1 -1
- package/dist/retrieval/HybridRetriever.d.ts.map +1 -1
- package/dist/retrieval/HybridRetriever.js +3 -1
- package/dist/retrieval/HybridRetriever.js.map +1 -1
- package/dist/retrieval/bm25.d.ts +3 -2
- package/dist/retrieval/bm25.d.ts.map +1 -1
- package/dist/retrieval/bm25.js +5 -3
- package/dist/retrieval/bm25.js.map +1 -1
- package/dist/retrieval/fusion.d.ts +2 -1
- package/dist/retrieval/fusion.d.ts.map +1 -1
- package/dist/retrieval/fusion.js +4 -2
- package/dist/retrieval/fusion.js.map +1 -1
- package/dist/retrieval/hnsw.d.ts +49 -11
- package/dist/retrieval/hnsw.d.ts.map +1 -1
- package/dist/retrieval/hnsw.js +57 -29
- package/dist/retrieval/hnsw.js.map +1 -1
- package/dist/retrieval/index.d.ts +7 -3
- package/dist/retrieval/index.d.ts.map +1 -1
- package/dist/retrieval/index.js +5 -2
- package/dist/retrieval/index.js.map +1 -1
- package/dist/retrieval/knowledge-index/bytes.d.ts +43 -0
- package/dist/retrieval/knowledge-index/bytes.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/bytes.js +151 -0
- package/dist/retrieval/knowledge-index/bytes.js.map +1 -0
- package/dist/retrieval/knowledge-index/cascade.d.ts +39 -0
- package/dist/retrieval/knowledge-index/cascade.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/cascade.js +125 -0
- package/dist/retrieval/knowledge-index/cascade.js.map +1 -0
- package/dist/retrieval/knowledge-index/compact.d.ts +22 -0
- package/dist/retrieval/knowledge-index/compact.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/compact.js +72 -0
- package/dist/retrieval/knowledge-index/compact.js.map +1 -0
- package/dist/retrieval/knowledge-index/csr.d.ts +41 -0
- package/dist/retrieval/knowledge-index/csr.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/csr.js +76 -0
- package/dist/retrieval/knowledge-index/csr.js.map +1 -0
- package/dist/retrieval/knowledge-index/digest.d.ts +22 -0
- package/dist/retrieval/knowledge-index/digest.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/digest.js +52 -0
- package/dist/retrieval/knowledge-index/digest.js.map +1 -0
- package/dist/retrieval/knowledge-index/embeddings.d.ts +32 -0
- package/dist/retrieval/knowledge-index/embeddings.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/embeddings.js +78 -0
- package/dist/retrieval/knowledge-index/embeddings.js.map +1 -0
- package/dist/retrieval/knowledge-index/expand.d.ts +19 -0
- package/dist/retrieval/knowledge-index/expand.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/expand.js +49 -0
- package/dist/retrieval/knowledge-index/expand.js.map +1 -0
- package/dist/retrieval/knowledge-index/index.d.ts +44 -0
- package/dist/retrieval/knowledge-index/index.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/index.js +136 -0
- package/dist/retrieval/knowledge-index/index.js.map +1 -0
- package/dist/retrieval/knowledge-index/lexical.d.ts +26 -0
- package/dist/retrieval/knowledge-index/lexical.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/lexical.js +76 -0
- package/dist/retrieval/knowledge-index/lexical.js.map +1 -0
- package/dist/retrieval/knowledge-index/pairs.d.ts +24 -0
- package/dist/retrieval/knowledge-index/pairs.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/pairs.js +65 -0
- package/dist/retrieval/knowledge-index/pairs.js.map +1 -0
- package/dist/retrieval/knowledge-index/prune.d.ts +21 -0
- package/dist/retrieval/knowledge-index/prune.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/prune.js +43 -0
- package/dist/retrieval/knowledge-index/prune.js.map +1 -0
- package/dist/retrieval/knowledge-index/quantize.d.ts +37 -0
- package/dist/retrieval/knowledge-index/quantize.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/quantize.js +77 -0
- package/dist/retrieval/knowledge-index/quantize.js.map +1 -0
- package/dist/retrieval/knowledge-index/scan.d.ts +39 -0
- package/dist/retrieval/knowledge-index/scan.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/scan.js +104 -0
- package/dist/retrieval/knowledge-index/scan.js.map +1 -0
- package/dist/retrieval/knowledge-index/serialize.d.ts +23 -0
- package/dist/retrieval/knowledge-index/serialize.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/serialize.js +135 -0
- package/dist/retrieval/knowledge-index/serialize.js.map +1 -0
- package/dist/retrieval/knowledge-index/sha256.d.ts +30 -0
- package/dist/retrieval/knowledge-index/sha256.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/sha256.js +130 -0
- package/dist/retrieval/knowledge-index/sha256.js.map +1 -0
- package/dist/retrieval/knowledge-index/state.d.ts +59 -0
- package/dist/retrieval/knowledge-index/state.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/state.js +72 -0
- package/dist/retrieval/knowledge-index/state.js.map +1 -0
- package/dist/retrieval/knowledge-index/tokenize.d.ts +20 -0
- package/dist/retrieval/knowledge-index/tokenize.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/tokenize.js +42 -0
- package/dist/retrieval/knowledge-index/tokenize.js.map +1 -0
- package/dist/retrieval/knowledge-index/traverse.d.ts +30 -0
- package/dist/retrieval/knowledge-index/traverse.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/traverse.js +90 -0
- package/dist/retrieval/knowledge-index/traverse.js.map +1 -0
- package/dist/retrieval/knowledge-index/types.d.ts +94 -0
- package/dist/retrieval/knowledge-index/types.d.ts.map +1 -0
- package/dist/retrieval/knowledge-index/types.js +9 -0
- package/dist/retrieval/knowledge-index/types.js.map +1 -0
- package/dist/retrieval/mmr.d.ts +11 -4
- package/dist/retrieval/mmr.d.ts.map +1 -1
- package/dist/retrieval/mmr.js +28 -8
- package/dist/retrieval/mmr.js.map +1 -1
- package/dist/retrieval/order.d.ts +41 -0
- package/dist/retrieval/order.d.ts.map +1 -0
- package/dist/retrieval/order.js +54 -0
- package/dist/retrieval/order.js.map +1 -0
- package/dist/retrieval/weightedFusion.d.ts +2 -1
- package/dist/retrieval/weightedFusion.d.ts.map +1 -1
- package/dist/retrieval/weightedFusion.js +7 -5
- package/dist/retrieval/weightedFusion.js.map +1 -1
- package/dist/vectorstore/MemoryVectorStore.d.ts.map +1 -1
- package/dist/vectorstore/MemoryVectorStore.js +2 -1
- package/dist/vectorstore/MemoryVectorStore.js.map +1 -1
- package/package.json +8 -3
- package/src/ingest/IngestionPipeline.ts +3 -15
- package/src/ingest/docsExtract.ts +219 -0
- package/src/ingest/hash.ts +22 -0
- package/src/ingest/parsers.ts +4 -0
- package/src/ingest/types.ts +7 -0
- package/src/knowledge/build.test.ts +150 -0
- package/src/knowledge/build.ts +266 -0
- package/src/knowledge/cards.ts +130 -0
- package/src/knowledge/docs.test.ts +118 -0
- package/src/knowledge/findings.ts +159 -0
- package/src/knowledge/importance.ts +72 -0
- package/src/knowledge/index.ts +53 -0
- package/src/knowledge/judge.ts +231 -0
- package/src/knowledge/model.ts +312 -0
- package/src/knowledge/packs/docs.ts +91 -0
- package/src/knowledge/partitions.test.ts +98 -0
- package/src/knowledge/partitions.ts +119 -0
- package/src/knowledge/plan.ts +115 -0
- package/src/knowledge/refs.ts +108 -0
- package/src/knowledge/resolve.ts +78 -0
- package/src/knowledge/review.test.ts +180 -0
- package/src/knowledge/review.ts +235 -0
- package/src/knowledge/sources.ts +146 -0
- package/src/knowledge/stores/localSnapshotStore.test.ts +82 -0
- package/src/knowledge/stores/localSnapshotStore.ts +159 -0
- package/src/knowledge/testkit.test-util.ts +92 -0
- package/src/knowledge/trace.test.ts +91 -0
- package/src/knowledge/trace.ts +111 -0
- package/src/knowledge/truncate.ts +118 -0
- package/src/memory/SemanticRecall.ts +3 -1
- package/src/retrieval/HybridRetriever.ts +3 -1
- package/src/retrieval/bm25.ts +5 -3
- package/src/retrieval/fusion.ts +5 -2
- package/src/retrieval/hnsw.ts +82 -35
- package/src/retrieval/index.ts +17 -3
- package/src/retrieval/knowledge-index/bytes.ts +166 -0
- package/src/retrieval/knowledge-index/cascade.ts +139 -0
- package/src/retrieval/knowledge-index/compact.ts +76 -0
- package/src/retrieval/knowledge-index/csr.ts +102 -0
- package/src/retrieval/knowledge-index/digest.ts +56 -0
- package/src/retrieval/knowledge-index/embeddings.ts +85 -0
- package/src/retrieval/knowledge-index/expand.ts +55 -0
- package/src/retrieval/knowledge-index/index.ts +166 -0
- package/src/retrieval/knowledge-index/lexical.ts +78 -0
- package/src/retrieval/knowledge-index/pairs.ts +72 -0
- package/src/retrieval/knowledge-index/prune.ts +48 -0
- package/src/retrieval/knowledge-index/quantize.ts +78 -0
- package/src/retrieval/knowledge-index/scan.ts +101 -0
- package/src/retrieval/knowledge-index/serialize.ts +136 -0
- package/src/retrieval/knowledge-index/sha256.ts +122 -0
- package/src/retrieval/knowledge-index/state.ts +116 -0
- package/src/retrieval/knowledge-index/tokenize.ts +41 -0
- package/src/retrieval/knowledge-index/traverse.ts +95 -0
- package/src/retrieval/knowledge-index/types.ts +88 -0
- package/src/retrieval/mmr.ts +35 -10
- package/src/retrieval/order.ts +68 -0
- package/src/retrieval/weightedFusion.ts +8 -5
- package/src/vectorstore/MemoryVectorStore.ts +2 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge/plan.ts — `planReview`: the confirm chip's numbers (PRD 38 §4.3).
|
|
3
|
+
*
|
|
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 (`.gitignore`, `.builderforce/ignore`)
|
|
6
|
+
* when the listing has them. Binary files (by extension), oversized files and files no
|
|
7
|
+
* pack accepts are skipped with a reason.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { IngestManifest } from '../ingest/types.js';
|
|
11
|
+
import type { DirectorySource, KnowledgePack, ReviewPlan } from './model.js';
|
|
12
|
+
import {
|
|
13
|
+
composePacks, DEFAULT_MAX_FILE_BYTES, filesManifestKey, IGNORE_FILES, ignoreMatcher, isBinaryPath,
|
|
14
|
+
manifestMap, stubSource,
|
|
15
|
+
} from './sources.js';
|
|
16
|
+
import { compareStr, sortBy } from './refs.js';
|
|
17
|
+
|
|
18
|
+
/** ≈ bytes per judged section, for the estimate (the plan does not read changed files). */
|
|
19
|
+
export const AVG_SECTION_BYTES = 1500;
|
|
20
|
+
/** ≈ one compare call per this many judged sections when contradictions are asked for. */
|
|
21
|
+
const SECTIONS_PER_COMPARE = 10;
|
|
22
|
+
|
|
23
|
+
export interface PlanOptions {
|
|
24
|
+
/** Per-file size cap in bytes. Default 2 MB. */
|
|
25
|
+
maxFileBytes?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PlannedFile {
|
|
29
|
+
path: string;
|
|
30
|
+
hash: string;
|
|
31
|
+
size: number;
|
|
32
|
+
pack: string;
|
|
33
|
+
changed: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface PlanDetail {
|
|
37
|
+
plan: ReviewPlan;
|
|
38
|
+
/** Every included file (changed and unchanged), sorted by path. */
|
|
39
|
+
files: PlannedFile[];
|
|
40
|
+
/** The manifest's prior `path → hash`. */
|
|
41
|
+
prior: Map<string, string>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export async function planReview(
|
|
45
|
+
source: DirectorySource,
|
|
46
|
+
manifest: IngestManifest,
|
|
47
|
+
packs: KnowledgePack[],
|
|
48
|
+
opts: PlanOptions = {},
|
|
49
|
+
): Promise<ReviewPlan> {
|
|
50
|
+
return (await planDetail(source, manifest, packs, opts)).plan;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export async function planDetail(
|
|
54
|
+
source: DirectorySource,
|
|
55
|
+
manifest: IngestManifest,
|
|
56
|
+
packs: readonly KnowledgePack[],
|
|
57
|
+
opts: PlanOptions = {},
|
|
58
|
+
): Promise<PlanDetail> {
|
|
59
|
+
const maxBytes = opts.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES;
|
|
60
|
+
const listed: Array<{ path: string; hash: string; size: number }> = [];
|
|
61
|
+
for await (const entry of source.list()) listed.push({ ...entry, path: entry.path.replace(/\\/g, '/').replace(/^\.?\//, '') });
|
|
62
|
+
const entries = sortBy(listed, (e) => e.path);
|
|
63
|
+
|
|
64
|
+
const ignoreTexts: string[] = [];
|
|
65
|
+
for (const name of IGNORE_FILES) {
|
|
66
|
+
if (!entries.some((e) => e.path === name)) continue;
|
|
67
|
+
const doc = await source.read(name);
|
|
68
|
+
if (doc.content.kind === 'text') ignoreTexts.push(doc.content.text);
|
|
69
|
+
}
|
|
70
|
+
const ignored = ignoreMatcher(ignoreTexts);
|
|
71
|
+
const composed = composePacks(packs);
|
|
72
|
+
const prior = await manifestMap(manifest, filesManifestKey(source.rootId));
|
|
73
|
+
const packById = new Map(packs.map((p) => [p.id, p] as const));
|
|
74
|
+
|
|
75
|
+
const files: PlannedFile[] = [];
|
|
76
|
+
const skipped: ReviewPlan['skipped'] = [];
|
|
77
|
+
const byPack: Record<string, number> = {};
|
|
78
|
+
let estimatedSections = 0;
|
|
79
|
+
let compareSections = 0;
|
|
80
|
+
for (const e of entries) {
|
|
81
|
+
if (ignored(e.path)) { skipped.push({ path: e.path, reason: 'ignored' }); continue; }
|
|
82
|
+
if (isBinaryPath(e.path)) { skipped.push({ path: e.path, reason: 'binary' }); continue; }
|
|
83
|
+
if (e.size > maxBytes) { skipped.push({ path: e.path, reason: 'too-large' }); continue; }
|
|
84
|
+
const hit = composed.resolve(stubSource(e.path));
|
|
85
|
+
if (!hit) { skipped.push({ path: e.path, reason: 'no-pack' }); continue; }
|
|
86
|
+
const changed = prior.get(e.path) !== e.hash;
|
|
87
|
+
files.push({ path: e.path, hash: e.hash, size: e.size, pack: hit.pack.id, changed });
|
|
88
|
+
byPack[hit.pack.id] = (byPack[hit.pack.id] ?? 0) + 1;
|
|
89
|
+
const spec = packById.get(hit.pack.id)?.judgement;
|
|
90
|
+
if (changed && spec && (spec.claims || spec.entities)) {
|
|
91
|
+
const sections = Math.max(1, Math.ceil(e.size / AVG_SECTION_BYTES));
|
|
92
|
+
estimatedSections += sections;
|
|
93
|
+
if (spec.contradictions) compareSections += sections;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const present = new Set(entries.map((e) => e.path));
|
|
98
|
+
const removed = [...prior.keys()].filter((p) => !present.has(p)).sort(compareStr);
|
|
99
|
+
const changed = files.filter((f) => f.changed).map((f) => f.path);
|
|
100
|
+
const sortedByPack = Object.fromEntries(Object.keys(byPack).sort(compareStr).map((k) => [k, byPack[k]!]));
|
|
101
|
+
return {
|
|
102
|
+
plan: {
|
|
103
|
+
rootId: source.rootId,
|
|
104
|
+
files: files.length,
|
|
105
|
+
byPack: sortedByPack,
|
|
106
|
+
unchanged: files.length - changed.length,
|
|
107
|
+
changed,
|
|
108
|
+
removed,
|
|
109
|
+
skipped,
|
|
110
|
+
estimatedModelCalls: estimatedSections + Math.ceil(compareSections / SECTIONS_PER_COMPARE),
|
|
111
|
+
},
|
|
112
|
+
files,
|
|
113
|
+
prior,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge/refs.ts — the NodeRef grammar and the deterministic primitives every
|
|
3
|
+
* knowledge module shares (ordering, canonical JSON, entity keys).
|
|
4
|
+
*
|
|
5
|
+
* Pure and import-free of `ingest` runtime code, so ingest's extractors can use it
|
|
6
|
+
* without an import cycle.
|
|
7
|
+
*
|
|
8
|
+
* src:${rootId}::${path} a source file (or an area: a directory path)
|
|
9
|
+
* src:${rootId}::${path}#${slug} a section of a source
|
|
10
|
+
* ent:${pack}:${normalizedName} an entity (also its project_facts key)
|
|
11
|
+
* fact:${key} any other fact (claims: fact:claim:${hash})
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { NodeRef } from './model.js';
|
|
15
|
+
|
|
16
|
+
/** Code-unit ordering — never `localeCompare`, whose result depends on the host's ICU. */
|
|
17
|
+
export function compareStr(a: string, b: string): number {
|
|
18
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function srcRef(rootId: string, path: string): NodeRef {
|
|
22
|
+
return `src:${rootId}::${path}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The root-relative path of a `src:` ref (the section suffix dropped), else undefined. */
|
|
26
|
+
export function pathOfRef(ref: string): string | undefined {
|
|
27
|
+
if (!ref.startsWith('src:')) return undefined;
|
|
28
|
+
const at = ref.indexOf('::');
|
|
29
|
+
if (at < 0) return undefined;
|
|
30
|
+
const rest = ref.slice(at + 2);
|
|
31
|
+
const hash = rest.indexOf('#');
|
|
32
|
+
return hash < 0 ? rest : rest.slice(0, hash);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The ref of the file a `src:` ref belongs to (itself for a file). */
|
|
36
|
+
export function fileRefOf(ref: NodeRef): NodeRef {
|
|
37
|
+
const hash = ref.startsWith('src:') ? ref.indexOf('#', ref.indexOf('::')) : -1;
|
|
38
|
+
return hash < 0 ? ref : (ref.slice(0, hash) as NodeRef);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The node ref of a stored fact key: `ent:` keys are refs already; the rest are `fact:`. */
|
|
42
|
+
export function factRef(key: string): NodeRef {
|
|
43
|
+
return key.startsWith('ent:') ? (key as NodeRef) : `fact:${key}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The stored fact key of a fact/entity ref (inverse of {@link factRef}). */
|
|
47
|
+
export function factKeyOf(ref: NodeRef): string | undefined {
|
|
48
|
+
if (ref.startsWith('ent:')) return ref;
|
|
49
|
+
if (ref.startsWith('fact:')) return ref.slice(5);
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The normalized key of a name: NFKC, case-folded, punctuation stripped (dashes,
|
|
55
|
+
* underscores and slashes read as spaces so `run-store` and `run store` agree),
|
|
56
|
+
* whitespace collapsed.
|
|
57
|
+
*/
|
|
58
|
+
export function normalizeKey(name: string): string {
|
|
59
|
+
return name
|
|
60
|
+
.normalize('NFKC')
|
|
61
|
+
.toLowerCase()
|
|
62
|
+
.replace(/[\p{Pd}\p{Pc}/\\]+/gu, ' ')
|
|
63
|
+
.replace(/[\p{P}\p{S}]+/gu, '')
|
|
64
|
+
.replace(/\s+/g, ' ')
|
|
65
|
+
.trim();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** A heading slug: the normalized key with spaces as dashes. */
|
|
69
|
+
export function slugOf(text: string): string {
|
|
70
|
+
return normalizeKey(text).replace(/ /g, '-') || 'section';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function basenameOf(path: string): string {
|
|
74
|
+
const i = path.lastIndexOf('/');
|
|
75
|
+
return i < 0 ? path : path.slice(i + 1);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Rounds to 6 decimals so floating noise never reaches the JSON. */
|
|
79
|
+
export function round6(n: number): number {
|
|
80
|
+
return Math.round(n * 1e6) / 1e6;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** JSON with object keys sorted and `undefined` members dropped — the canonical form for digests. */
|
|
84
|
+
export function canonicalJson(value: unknown): string {
|
|
85
|
+
return JSON.stringify(sortKeys(value));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function sortKeys(value: unknown): unknown {
|
|
89
|
+
if (Array.isArray(value)) return value.map(sortKeys);
|
|
90
|
+
if (value === null || typeof value !== 'object') return value;
|
|
91
|
+
const out: Record<string, unknown> = {};
|
|
92
|
+
for (const key of Object.keys(value as Record<string, unknown>).sort(compareStr)) {
|
|
93
|
+
const v = (value as Record<string, unknown>)[key];
|
|
94
|
+
if (v !== undefined) out[key] = sortKeys(v);
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Sorts a copy by the given string keys, in order. */
|
|
100
|
+
export function sortBy<T>(items: readonly T[], ...keys: Array<(t: T) => string>): T[] {
|
|
101
|
+
return [...items].sort((a, b) => {
|
|
102
|
+
for (const key of keys) {
|
|
103
|
+
const c = compareStr(key(a), key(b));
|
|
104
|
+
if (c !== 0) return c;
|
|
105
|
+
}
|
|
106
|
+
return 0;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge/resolve.ts — deterministic entity resolution (PRD 38 §4.3).
|
|
3
|
+
*
|
|
4
|
+
* • Exact: names whose normalized keys ({@link normalizeKey}) are equal are ONE entity.
|
|
5
|
+
* • Near: pairs the knowledge index calls similar become `possible-same` findings for a
|
|
6
|
+
* person to judge. They are never merged automatically.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Finding, NodeRef } from './model.js';
|
|
10
|
+
import type { SimilarPair } from '../retrieval/knowledge-index/types.js';
|
|
11
|
+
import { hashText } from '../ingest/hash.js';
|
|
12
|
+
import { compareStr, normalizeKey, round6 } from './refs.js';
|
|
13
|
+
|
|
14
|
+
export { normalizeKey };
|
|
15
|
+
|
|
16
|
+
export interface ResolvedEntity {
|
|
17
|
+
key: string;
|
|
18
|
+
/** The canonical ref (the smallest of the group). */
|
|
19
|
+
ref: NodeRef;
|
|
20
|
+
/** Every ref with this key, sorted. */
|
|
21
|
+
refs: NodeRef[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Groups refs by exact normalized key. Empty keys are ignored. Sorted by key. */
|
|
25
|
+
export function resolveEntities(entries: ReadonlyArray<{ ref: NodeRef; key: string }>): ResolvedEntity[] {
|
|
26
|
+
const groups = new Map<string, Set<NodeRef>>();
|
|
27
|
+
for (const { ref, key } of entries) {
|
|
28
|
+
const k = normalizeKey(key);
|
|
29
|
+
if (!k) continue;
|
|
30
|
+
let g = groups.get(k);
|
|
31
|
+
if (!g) groups.set(k, (g = new Set()));
|
|
32
|
+
g.add(ref);
|
|
33
|
+
}
|
|
34
|
+
return [...groups.keys()].sort(compareStr).map((key) => {
|
|
35
|
+
const refs = [...groups.get(key)!].sort(compareStr);
|
|
36
|
+
return { key, ref: refs[0]!, refs };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Normalized key → canonical ref, for an extractor's `ctx.knownKeys`. */
|
|
41
|
+
export function knownKeysOf(resolved: readonly ResolvedEntity[]): Map<string, NodeRef> {
|
|
42
|
+
return new Map(resolved.map((r) => [r.key, r.ref] as const));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* `possible-same` findings from near-duplicate pairs between two DIFFERENT entities (pairs
|
|
47
|
+
* already merged by key, or naming a non-entity, are not reported).
|
|
48
|
+
*/
|
|
49
|
+
export function possibleSameFindings(pairs: readonly SimilarPair[], pack = 'memory'): Finding[] {
|
|
50
|
+
const seen = new Set<string>();
|
|
51
|
+
const out: Finding[] = [];
|
|
52
|
+
for (const p of pairs) {
|
|
53
|
+
if (!p.a.startsWith('ent:') || !p.b.startsWith('ent:') || p.a === p.b) continue;
|
|
54
|
+
const [a, b] = compareStr(p.a, p.b) <= 0 ? [p.a, p.b] : [p.b, p.a];
|
|
55
|
+
if (normalizeKey(entityName(a)) === normalizeKey(entityName(b))) continue;
|
|
56
|
+
const id = `possible-same:${hashText(`${a}\u0000${b}`)}`;
|
|
57
|
+
if (seen.has(id)) continue;
|
|
58
|
+
seen.add(id);
|
|
59
|
+
out.push({
|
|
60
|
+
id, kind: 'possible-same', pack, nodes: [a as NodeRef, b as NodeRef], severity: 'info',
|
|
61
|
+
params: { similarity: round6(p.similarity) },
|
|
62
|
+
requestKey: 'knowledgeGraph.fix.possibleSame',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return out.sort((x, y) => compareStr(x.id, y.id));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The name part of `ent:<pack>:<name>`. */
|
|
69
|
+
export function entityName(ref: string): string {
|
|
70
|
+
const rest = ref.startsWith('ent:') ? ref.slice(4) : ref;
|
|
71
|
+
const colon = rest.indexOf(':');
|
|
72
|
+
return colon < 0 ? rest : rest.slice(colon + 1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The stored key of an entity named `name` in `pack`. */
|
|
76
|
+
export function entityKey(pack: string, name: string): NodeRef {
|
|
77
|
+
return `ent:${pack}:${normalizeKey(name)}`;
|
|
78
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/knowledge/review.test.ts
|
|
3
|
+
* planReview / reviewDirectory with fake ports: unchanged files are never read, extracted
|
|
4
|
+
* output is never written as memory, a changed hash marks only that source stale, the
|
|
5
|
+
* budget stops judgement (and counts the rest), invalid judgement is dropped and counted,
|
|
6
|
+
* and abort keeps what was written consistent per file.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { InMemoryIngestManifest } from '../ingest/IngestionPipeline.js';
|
|
10
|
+
import { hashText } from '../ingest/hash.js';
|
|
11
|
+
import { buildGraph } from './build.js';
|
|
12
|
+
import type { Extracted, JudgementRequest, KnowledgeStore, ReviewArgs, StoredFact, StoredRelation } from './model.js';
|
|
13
|
+
import { DOCS_PACK } from './packs/docs.js';
|
|
14
|
+
import { planReview } from './plan.js';
|
|
15
|
+
import { assertStoredBatch, reviewDirectory } from './review.js';
|
|
16
|
+
import { fakeJudge, memSource, memStore, ROOT, type SpySource } from './testkit.test-util.js';
|
|
17
|
+
|
|
18
|
+
const BUDGET = { modelCalls: 200, ms: 60_000 };
|
|
19
|
+
|
|
20
|
+
function args(source: SpySource, store: KnowledgeStore, manifest: InMemoryIngestManifest, extra: Partial<ReviewArgs> = {}): ReviewArgs {
|
|
21
|
+
return { source, store, manifest, packs: [DOCS_PACK], budget: BUDGET, ...extra };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function graphOf(source: SpySource, store: KnowledgeStore) {
|
|
25
|
+
const extracted: Extracted[] = [];
|
|
26
|
+
for await (const f of source.list()) {
|
|
27
|
+
const hit = (await store.getExtracted!(f.hash))?.find((e) => e.sourceRef === `src:${ROOT}::${f.path}`);
|
|
28
|
+
if (hit) extracted.push(hit);
|
|
29
|
+
}
|
|
30
|
+
return buildGraph({
|
|
31
|
+
rootId: ROOT, extracted, packs: [DOCS_PACK],
|
|
32
|
+
facts: await store.facts({ rootId: ROOT }), relations: await store.relations({ rootId: ROOT }),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const anchoredTo = (facts: StoredFact[], path: string) => facts.filter((f) => f.fileAnchors.some((a) => a.path === path));
|
|
37
|
+
|
|
38
|
+
describe('planReview', () => {
|
|
39
|
+
it('reads only the ignore files — never an unchanged file — and reports skips', async () => {
|
|
40
|
+
const source = memSource({
|
|
41
|
+
'.gitignore': 'skip/\n', 'a.md': '# A\nalpha\n', 'b.md': '# B\nbeta\n', 'img.png': 'x', 'skip/x.md': '# X\n',
|
|
42
|
+
});
|
|
43
|
+
const manifest = new InMemoryIngestManifest();
|
|
44
|
+
await reviewDirectory(args(source, memStore(), manifest));
|
|
45
|
+
|
|
46
|
+
source.files['a.md'] = '# A\nalpha changed\n';
|
|
47
|
+
source.reads.length = 0;
|
|
48
|
+
const plan = await planReview(source, manifest, [DOCS_PACK]);
|
|
49
|
+
expect(source.reads).toEqual(['.gitignore']);
|
|
50
|
+
expect(plan.changed).toEqual(['a.md']);
|
|
51
|
+
expect(plan.unchanged).toBe(1);
|
|
52
|
+
expect(plan.byPack).toEqual({ docs: 2 });
|
|
53
|
+
expect(plan.estimatedModelCalls).toBeGreaterThan(0);
|
|
54
|
+
expect(plan.skipped).toEqual(expect.arrayContaining([
|
|
55
|
+
{ path: '.gitignore', reason: 'ignored' }, { path: 'img.png', reason: 'binary' }, { path: 'skip/x.md', reason: 'ignored' },
|
|
56
|
+
]));
|
|
57
|
+
|
|
58
|
+
source.reads.length = 0;
|
|
59
|
+
await reviewDirectory(args(source, memStore(), manifest));
|
|
60
|
+
expect(source.reads).toEqual(['.gitignore', 'a.md']);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('enforces the size cap and lists removed files', async () => {
|
|
64
|
+
const source = memSource({ 'a.md': '# A\nalpha\n', 'big.md': 'x'.repeat(50) });
|
|
65
|
+
const manifest = new InMemoryIngestManifest();
|
|
66
|
+
await reviewDirectory(args(source, memStore(), manifest));
|
|
67
|
+
delete source.files['a.md'];
|
|
68
|
+
const plan = await planReview(source, manifest, [DOCS_PACK], { maxFileBytes: 10 });
|
|
69
|
+
expect(plan.removed).toEqual(['a.md']);
|
|
70
|
+
expect(plan.skipped).toContainEqual({ path: 'big.md', reason: 'too-large' });
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('reviewDirectory', () => {
|
|
75
|
+
it('never writes extracted output as memory; caches it by content hash instead', async () => {
|
|
76
|
+
const source = memSource({ 'a.md': '# A\nalpha\n', 'b.md': '# B\nbeta\n' });
|
|
77
|
+
const store = memStore();
|
|
78
|
+
const batches: Array<{ facts: StoredFact[]; relations: StoredRelation[] }> = [];
|
|
79
|
+
const write = store.write.bind(store);
|
|
80
|
+
store.write = (b) => { batches.push(b); return write(b); };
|
|
81
|
+
const judge = fakeJudge();
|
|
82
|
+
const report = await reviewDirectory(args(source, store, new InMemoryIngestManifest(), {
|
|
83
|
+
judgement: judge,
|
|
84
|
+
similar: async (ids) => (ids.length >= 2 ? [{ a: ids[0]!, b: ids[1]!, similarity: 0.9 }] : []),
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
const written = batches.flatMap((b) => [...b.facts, ...b.relations]);
|
|
88
|
+
expect(written.length).toBeGreaterThan(0);
|
|
89
|
+
expect(written.every((x) => x.origin === 'model')).toBe(true);
|
|
90
|
+
expect(report.extracted).toBe(2);
|
|
91
|
+
expect(report.judged).toBe(3); // two sections + one compare
|
|
92
|
+
expect(report.factsWritten).toBeGreaterThan(0);
|
|
93
|
+
expect(await store.getExtracted(hashText('# A\nalpha\n'))).toHaveLength(1);
|
|
94
|
+
expect(await store.relations({ rootId: ROOT })).toContainEqual(expect.objectContaining({ kind: 'contradicts', confidence: 0.9 }));
|
|
95
|
+
expect((await store.scopes())[0]).toMatchObject({ rootId: ROOT, lastDigest: report.digest, packs: ['docs'] });
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('the store guard rejects extracted items', async () => {
|
|
99
|
+
const bad = { from: 'src:r::a', to: 'src:r::b', kind: 'links', weight: 1, origin: 'extracted' } as unknown as StoredRelation;
|
|
100
|
+
expect(() => assertStoredBatch({ facts: [], relations: [bad] })).toThrow();
|
|
101
|
+
await expect(memStore().write({ scope: { rootId: ROOT, title: 't', packs: [] }, facts: [], relations: [bad] })).rejects.toThrow();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('a changed hash marks only that source stale; unchanged sections are re-anchored, not re-judged', async () => {
|
|
105
|
+
const source = memSource({ 'a.md': '# A\nalpha\n# A2\nsame\n', 'b.md': '# B\nbeta\n' });
|
|
106
|
+
const store = memStore();
|
|
107
|
+
const manifest = new InMemoryIngestManifest();
|
|
108
|
+
await reviewDirectory(args(source, store, manifest, { judgement: fakeJudge() }));
|
|
109
|
+
|
|
110
|
+
source.files['a.md'] = '# A\nalpha two\n# A2\nsame\n';
|
|
111
|
+
await reviewDirectory(args(source, store, manifest)); // extracted-only: no model
|
|
112
|
+
let g = await graphOf(source, store);
|
|
113
|
+
const facts = await store.facts({ rootId: ROOT });
|
|
114
|
+
const claimsA = anchoredTo(facts, 'a.md').filter((f) => f.key.startsWith('claim:'));
|
|
115
|
+
const claimsB = anchoredTo(facts, 'b.md').filter((f) => f.key.startsWith('claim:'));
|
|
116
|
+
expect(claimsA).toHaveLength(2);
|
|
117
|
+
for (const c of claimsA) expect(g.nodes.find((n) => n.ref === `fact:${c.key}`)?.stale).toBe(true);
|
|
118
|
+
for (const c of claimsB) expect(g.nodes.find((n) => n.ref === `fact:${c.key}`)?.stale).toBeUndefined();
|
|
119
|
+
const rels = await store.relations({ rootId: ROOT });
|
|
120
|
+
expect(rels.filter((r) => r.to.startsWith(`src:${ROOT}::a.md#`) && r.kind === 'about').every((r) => r.staleAt)).toBe(true);
|
|
121
|
+
expect(rels.filter((r) => r.to.startsWith(`src:${ROOT}::b.md#`)).every((r) => !r.staleAt)).toBe(true);
|
|
122
|
+
|
|
123
|
+
// Re-judging: only the changed section costs a call; the unchanged one is fresh again.
|
|
124
|
+
source.files['a.md'] = '# A\nalpha three\n# A2\nsame\n';
|
|
125
|
+
const judge = fakeJudge();
|
|
126
|
+
await reviewDirectory(args(source, store, manifest, { judgement: judge }));
|
|
127
|
+
expect(judge.requests.filter((r) => r.kind === 'extract').map((r) => r.items[0]!.text)).toEqual(['alpha three']);
|
|
128
|
+
g = await graphOf(source, store);
|
|
129
|
+
const same = (await store.facts({ rootId: ROOT })).find((f) => f.key.startsWith('claim:') && f.content.startsWith('Lease ends same'))!;
|
|
130
|
+
expect(g.nodes.find((n) => n.ref === `fact:${same.key}`)?.stale).toBeUndefined();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('the budget stops judgement; the rest is counted unjudged and stays changed', async () => {
|
|
134
|
+
const source = memSource({ 'a.md': '# A\nalpha\n# B\nbeta\n', 'b.md': '# C\ngamma\n' });
|
|
135
|
+
const manifest = new InMemoryIngestManifest();
|
|
136
|
+
const judge = fakeJudge();
|
|
137
|
+
const report = await reviewDirectory(args(source, memStore(), manifest, { judgement: judge, budget: { modelCalls: 1, ms: 60_000 } }));
|
|
138
|
+
expect(judge.requests).toHaveLength(1);
|
|
139
|
+
expect(report.judged).toBe(1);
|
|
140
|
+
expect(report.unjudged).toBe(2);
|
|
141
|
+
expect(report.extracted).toBe(2);
|
|
142
|
+
expect((await planReview(source, manifest, [DOCS_PACK])).changed).toEqual(['a.md', 'b.md']);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('drops invalid judgement output and counts it', async () => {
|
|
146
|
+
const judge = fakeJudge((req: JudgementRequest) => ({
|
|
147
|
+
extract: [{
|
|
148
|
+
ref: req.items[0]!.ref,
|
|
149
|
+
claims: [
|
|
150
|
+
{ subject: 'Lease', predicate: 'ends', object: '2027', quote: 'ends 2027' },
|
|
151
|
+
{ subject: 'Lease', object: 'x', quote: '' } as never,
|
|
152
|
+
],
|
|
153
|
+
entities: [{ name: '', type: 'thing' }, { name: 'Lease', type: 'contract' }],
|
|
154
|
+
}],
|
|
155
|
+
invalid: 1,
|
|
156
|
+
}));
|
|
157
|
+
const store = memStore();
|
|
158
|
+
const report = await reviewDirectory(args(memSource({ 'a.md': '# A\nalpha\n' }), store, new InMemoryIngestManifest(), { judgement: judge }));
|
|
159
|
+
expect(report.invalidJudgements).toBe(3);
|
|
160
|
+
const facts = await store.facts({ rootId: ROOT });
|
|
161
|
+
expect(facts.filter((f) => f.key.startsWith('claim:'))).toHaveLength(1);
|
|
162
|
+
expect(facts.map((f) => f.key)).toContain('ent:docs:lease');
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('abort between files keeps the written file whole and stops before the next', async () => {
|
|
166
|
+
const source = memSource({ 'a.md': '# A\nalpha\n', 'b.md': '# B\nbeta\n' });
|
|
167
|
+
const store = memStore();
|
|
168
|
+
const controller = new AbortController();
|
|
169
|
+
const report = await reviewDirectory(args(source, store, new InMemoryIngestManifest(), {
|
|
170
|
+
judgement: fakeJudge(),
|
|
171
|
+
signal: controller.signal,
|
|
172
|
+
onProgress: (p) => { if (p.phase === 'write') controller.abort(); },
|
|
173
|
+
}));
|
|
174
|
+
expect(report.aborted).toBe(true);
|
|
175
|
+
const facts = await store.facts({ rootId: ROOT });
|
|
176
|
+
expect(anchoredTo(facts, 'a.md').length).toBeGreaterThan(0);
|
|
177
|
+
expect(anchoredTo(facts, 'b.md')).toHaveLength(0);
|
|
178
|
+
expect(source.reads).not.toContain('b.md');
|
|
179
|
+
});
|
|
180
|
+
});
|