@tangle-network/agent-knowledge 6.1.10 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as writeFileDurableWithinRoot, A as loadKnowledgePages, B as withKnowledgeMutation, C as SourceAnchorSchema, D as initKnowledgeBase, E as SCAFFOLD_PAGE_BASENAMES, F as formatFrontmatter, G as knowledgeFileTransactionPlanHash, H as applyKnowledgeFileTransaction, I as parseFrontmatter, J as isMissingFile, K as prepareKnowledgeFileTransaction, L as acquireDurableFileLock, M as WIKILINK_REGEX, N as extractWikilinks, O as isScaffoldPath, P as normalizeLinkTarget, Q as withSafeDirectory, R as inspectPendingKnowledgeMutation, S as KnowledgePageSchema, T as buildKnowledgeGraph, U as assertKnowledgeMutationPath, V as withKnowledgeRead, W as finishKnowledgeFileTransaction, X as readRegularFileWithinRoot, Y as listRegularFilesWithinRoot, Z as renameDurable, _ as KnowledgeBaseCandidateSchema, a as applyKnowledgeWriteBlocksFile, b as KnowledgeGraphNodeSchema, c as validateKnowledgeIndex, d as writeKnowledgeIndex, et as writeJsonDurableWithinRoot, f as addSourcePath, g as writeSourceRegistry, h as sourceRegistryPath, i as applyKnowledgeWriteBlocks, j as writeJson, k as layoutFor, l as lintKnowledgeIndex, m as loadSourceRegistry, n as inspectKnowledgeIndex, nt as textSourceAdapter, o as isSafeKnowledgePath, p as addSourceText, q as rollbackKnowledgeFileTransaction, r as stringMetadata, s as parseKnowledgeWriteBlocks, t as explainKnowledgeTarget, tt as mediaTypeFor, u as buildKnowledgeIndex, v as KnowledgeEventSchema, w as SourceRecordSchema, x as KnowledgeIndexSchema, y as KnowledgeGraphEdgeSchema, z as recoverPendingKnowledgeMutation } from "./inspect-DAXpFyrs.js";
1
+ import { $ as SCAFFOLD_PAGE_BASENAMES, A as KnowledgePageSchema, At as withSafeDirectory, B as assertResearchClaimLedgerIntegrity, C as assertClaimLedgerId, Ct as listRegularFilesWithinRoot, D as KnowledgeGraphEdgeSchema, Dt as renameDurable, E as KnowledgeEventSchema, Et as removeDurable, F as SourceRecordSchema, Ft as mediaTypeFor, G as deepQuestionId, H as claimEvidenceId, I as KNOWLEDGE_EVENT_TYPES, It as textSourceAdapter, J as materializeRegisteredClaimEvidence, K as emptyClaimLedger, L as ClaimLedgerGoalConflictError, M as ResearchClaimLedgerSchema, Mt as writeFileDurableWithinRoot, N as ResearchClaimRecordSchema, Nt as writeJsonDurable, O as KnowledgeGraphNodeSchema, Ot as syncDirectory, P as SourceAnchorSchema, Pt as writeJsonDurableWithinRoot, Q as buildKnowledgeGraph, R as assertDeepQuestionIntegrity, S as MemoryKbStore, St as isMissingFile, T as KnowledgeBaseCandidateSchema, Tt as readRegularFileWithinRoot, U as claimId, V as assertTrackedClaimIntegrity, W as claimSourceHost, X as mergeTrackedClaims, Y as mergeClaimLedgers, Z as normalizeClaimText, _ as FileSystemKbStore, _t as finishKnowledgeFileTransaction, a as applyKnowledgeWriteBlocksFile, at as WIKILINK_REGEX, b as KB_INDEX_PATH, bt as rollbackKnowledgeFileTransaction, c as validateKnowledgeIndex, ct as formatFrontmatter, d as writeKnowledgeIndex, dt as inspectPendingKnowledgeMutation, et as initKnowledgeBase, f as addSourcePath, ft as recoverPendingKnowledgeMutation, g as writeSourceRegistry, gt as assertKnowledgeMutationPath, h as sourceRegistryPath, ht as applyKnowledgeFileTransaction, i as applyKnowledgeWriteBlocks, it as writeJson, j as ResearchClaimEvidenceSchema, jt as writeFileDurable, k as KnowledgeIndexSchema, kt as withSafeDescendant, l as lintKnowledgeIndex, lt as parseFrontmatter, m as loadSourceRegistry, mt as withKnowledgeRead, n as inspectKnowledgeIndex, nt as layoutFor, o as isSafeKnowledgePath, ot as extractWikilinks, p as addSourceText, pt as withKnowledgeMutation, q as linkClaimContradictions, r as stringMetadata, rt as loadKnowledgePages, s as parseKnowledgeWriteBlocks, st as normalizeLinkTarget, t as explainKnowledgeTarget, tt as isScaffoldPath, u as buildKnowledgeIndex, ut as acquireDurableFileLock, v as KB_CLAIM_LEDGER_DIR, vt as knowledgeFileTransactionPlanHash, w as DeepQuestionSchema, wt as readRegularFileNoFollow, x as KB_STORE_DIR, xt as isKernelAnchoredPath, y as KB_EVENTS_PATH, yt as prepareKnowledgeFileTransaction, z as assertResearchClaimEvidenceIntegrity } from "./inspect-LUMkas6A.js";
2
2
  import { n as slugify, r as stableId, t as sha256 } from "./ids-DRqPZ42_.js";
3
3
  import { A as assertImmutableRef, C as resetRetrievalHoldoutRegistry, D as jsonObjectCandidateCodec, E as jsonCandidateCodec, O as runSerializedKnowledgeOptimization, S as emitRetrievalHoldoutBypass, T as toOffPolicyTrajectory, _ as defaultGetMemoryContext, a as createNeo4jAgentMemoryAdapter, b as applySessionStickyRetrievalHoldout, c as runAgentMemoryImprovement, d as runAgentMemoryExperiment, f as agentMemorySequenceJudge, g as forkAgentMemoryBranchSnapshot, h as createAgentMemoryBranch, i as AgentMemoryWriteInputSchema, k as scenarioContentFingerprint, l as createGraphitiMemoryAdapter, m as buildAgentMemorySequencesFromBenchmarkCases, n as AgentMemoryKindSchema, o as createMem0MemoryAdapter, p as buildAgentMemorySequenceScenarios, r as AgentMemoryScopeSchema, s as mem0MemoryAdapterIdentity, t as AgentMemoryHitSchema, u as graphitiMemoryAdapterIdentity, v as renderMemoryContext, w as retrievalHoldoutConfigHash, x as deterministicRng, y as applyRetrievalHoldout } from "./memory-C6KPRhoU.js";
4
4
  import { n as searchKnowledge, r as tokenizeQuery, t as reciprocalRankFusion } from "./search-CP0QtBJZ.js";
@@ -546,7 +546,7 @@ function triageSource(source, options) {
546
546
  triage: "drop",
547
547
  reason: `thin body (${bodyLen} < ${options.minBodyChars} chars)`
548
548
  };
549
- const host = hostOf$1(source.uri);
549
+ const host = hostOf(source.uri);
550
550
  if (host.length > 0 && options.authoritativeHosts.some((suffix) => hostMatches(host, suffix)) && bodyLen >= options.substantialBodyChars) return {
551
551
  triage: "keep",
552
552
  reason: `authoritative host ${host} + substantial body (${bodyLen})`
@@ -556,7 +556,7 @@ function triageSource(source, options) {
556
556
  reason: `unknown host ${host || "(none)"}, body ${bodyLen} chars`
557
557
  };
558
558
  }
559
- function hostOf$1(uri) {
559
+ function hostOf(uri) {
560
560
  try {
561
561
  return new URL(uri.trim()).hostname.toLowerCase().replace(/^www\./, "");
562
562
  } catch {
@@ -5082,8 +5082,10 @@ async function materialFactsSurfaced(kb, checklist) {
5082
5082
  async function runVerifiedResearchLoop(options) {
5083
5083
  const maxRounds = Math.max(1, options.maxRounds ?? 3);
5084
5084
  await initKnowledgeBase(options.root);
5085
+ const store = new FileSystemKbStore({ root: options.root });
5085
5086
  const steps = [];
5086
5087
  let index = await buildKnowledgeIndex(options.root);
5088
+ await confirmRegisteredSources(options.driver, index.sources);
5087
5089
  let readiness = readinessFor(options, index);
5088
5090
  let ready = isReady(readiness?.report);
5089
5091
  let steer;
@@ -5127,6 +5129,7 @@ async function runVerifiedResearchLoop(options) {
5127
5129
  });
5128
5130
  }
5129
5131
  const acceptedWorkerSources = await registerSources(options, accepted);
5132
+ await confirmRegisteredSources(options.driver, acceptedWorkerSources);
5130
5133
  const writtenPages = [];
5131
5134
  writtenPages.push(...await applyPages(options.root, workerContribution, acceptedWorkerSources));
5132
5135
  index = await buildKnowledgeIndex(options.root);
@@ -5146,13 +5149,18 @@ async function runVerifiedResearchLoop(options) {
5146
5149
  });
5147
5150
  driverNotes = driverContribution.notes;
5148
5151
  driverSources = await registerSources(options, driverContribution.sources ?? []);
5152
+ await confirmRegisteredSources(options.driver, driverSources);
5149
5153
  writtenPages.push(...await applyPages(options.root, driverContribution, driverSources));
5150
5154
  index = await buildKnowledgeIndex(options.root);
5151
5155
  readiness = readinessFor(options, index);
5152
5156
  }
5153
5157
  ready = isReady(readiness?.report);
5154
5158
  const remainingGaps = gapsFromReadiness(readiness);
5155
- steer = ready ? void 0 : foldGaps(options.driver, remainingGaps);
5159
+ if (ready || remainingGaps.length === 0) steer = void 0;
5160
+ else {
5161
+ await options.driver.prepareFold?.();
5162
+ steer = foldGaps(options.driver, remainingGaps);
5163
+ }
5156
5164
  const step = {
5157
5165
  round,
5158
5166
  gaps,
@@ -5182,6 +5190,8 @@ async function runVerifiedResearchLoop(options) {
5182
5190
  driver: driverNotes
5183
5191
  }
5184
5192
  };
5193
+ await options.driver.checkpoint?.();
5194
+ await store.putEvent(step.event);
5185
5195
  steps.push(step);
5186
5196
  await options.onRound?.(step);
5187
5197
  }
@@ -5228,6 +5238,12 @@ async function registerSources(options, sources) {
5228
5238
  for (const source of sources) records.push(await addSourceText(options.root, source, options.sourceOptions));
5229
5239
  return records;
5230
5240
  }
5241
+ async function confirmRegisteredSources(driver, sources) {
5242
+ if (!driver.commitSources) return;
5243
+ const originalUris = sources.flatMap((source) => typeof source.metadata?.originalUri === "string" ? [source.metadata.originalUri] : []);
5244
+ if (originalUris.length === 0) return;
5245
+ await driver.commitSources([...new Set(originalUris)].sort());
5246
+ }
5231
5247
  /**
5232
5248
  * Apply a contribution's curated pages. Static `proposalText` plus a
5233
5249
  * `buildPages(acceptedSources)` result are concatenated and run through the safe
@@ -5248,11 +5264,11 @@ function requireReadiness(readiness, options) {
5248
5264
  return buildEvalKnowledgeBundle({
5249
5265
  ...options.readiness ?? {},
5250
5266
  taskId: options.readinessTaskId ?? options.goal,
5251
- index: emptyIndex$1(options.root),
5267
+ index: emptyIndex(options.root),
5252
5268
  specs: []
5253
5269
  });
5254
5270
  }
5255
- function emptyIndex$1(root) {
5271
+ function emptyIndex(root) {
5256
5272
  return {
5257
5273
  root,
5258
5274
  generatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
@@ -5436,159 +5452,6 @@ async function runInvestmentThesisTask(input, options) {
5436
5452
  };
5437
5453
  }
5438
5454
  //#endregion
5439
- //#region src/kb-store.ts
5440
- var MemoryKbStore = class {
5441
- sources = /* @__PURE__ */ new Map();
5442
- pages = /* @__PURE__ */ new Map();
5443
- events = [];
5444
- index = null;
5445
- async putSource(source) {
5446
- this.sources.set(source.id, clone(source));
5447
- }
5448
- async getSource(id) {
5449
- return clone(this.sources.get(id) ?? null);
5450
- }
5451
- async listSources() {
5452
- return [...this.sources.values()].map(clone);
5453
- }
5454
- async putPage(page) {
5455
- this.pages.set(page.id, clone(page));
5456
- }
5457
- async getPage(idOrPath) {
5458
- return clone(this.pages.get(idOrPath) ?? [...this.pages.values()].find((page) => page.path === idOrPath) ?? null);
5459
- }
5460
- async listPages() {
5461
- return [...this.pages.values()].map(clone);
5462
- }
5463
- async putIndex(index) {
5464
- this.index = clone(index);
5465
- }
5466
- async getIndex() {
5467
- if (this.index) return clone(this.index);
5468
- const pages = await this.listPages();
5469
- const sources = await this.listSources();
5470
- return {
5471
- root: "memory",
5472
- generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
5473
- sources,
5474
- pages,
5475
- graph: buildKnowledgeGraph(pages)
5476
- };
5477
- }
5478
- async putEvent(event) {
5479
- this.events.push(clone(event));
5480
- }
5481
- async listEvents(query = {}) {
5482
- let out = this.events;
5483
- if (query.type) out = out.filter((event) => event.type === query.type);
5484
- if (query.target) out = out.filter((event) => event.target === query.target);
5485
- out = [...out].sort((a, b) => a.createdAt.localeCompare(b.createdAt));
5486
- return out.slice(-(query.limit ?? out.length)).map(clone);
5487
- }
5488
- };
5489
- const knowledgeEventsSchema = z.array(KnowledgeEventSchema);
5490
- var FileSystemKbStore = class {
5491
- dir;
5492
- constructor(dir) {
5493
- this.dir = dir;
5494
- }
5495
- async putSource(source) {
5496
- const parsed = SourceRecordSchema.parse(source);
5497
- await this.updateIndex((index) => ({
5498
- ...index,
5499
- generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
5500
- sources: [parsed, ...index.sources.filter((entry) => entry.id !== parsed.id)]
5501
- }));
5502
- }
5503
- async getSource(id) {
5504
- return withKnowledgeRead(this.dir, async () => {
5505
- return clone((await this.readIndex())?.sources.find((source) => source.id === id) ?? null);
5506
- });
5507
- }
5508
- async listSources() {
5509
- return withKnowledgeRead(this.dir, async () => clone((await this.readIndex())?.sources ?? []));
5510
- }
5511
- async putPage(page) {
5512
- const parsed = KnowledgePageSchema.parse(page);
5513
- await this.updateIndex((index) => {
5514
- const pages = [parsed, ...index.pages.filter((entry) => entry.id !== parsed.id)];
5515
- return {
5516
- ...index,
5517
- generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
5518
- pages,
5519
- graph: buildKnowledgeGraph(pages)
5520
- };
5521
- });
5522
- }
5523
- async getPage(idOrPath) {
5524
- return withKnowledgeRead(this.dir, async () => {
5525
- return clone((await this.readIndex())?.pages.find((page) => page.id === idOrPath || page.path === idOrPath) ?? null);
5526
- });
5527
- }
5528
- async listPages() {
5529
- return withKnowledgeRead(this.dir, async () => clone((await this.readIndex())?.pages ?? []));
5530
- }
5531
- async putIndex(index) {
5532
- const parsed = KnowledgeIndexSchema.parse(index);
5533
- await withKnowledgeMutation(this.dir, () => writeJsonDurableWithinRoot(this.dir, "index.json", parsed));
5534
- }
5535
- async getIndex() {
5536
- return withKnowledgeRead(this.dir, () => this.readIndex());
5537
- }
5538
- async putEvent(event) {
5539
- const parsed = KnowledgeEventSchema.parse(event);
5540
- await withKnowledgeMutation(this.dir, async () => {
5541
- const next = [...(await this.readEvents()).filter((entry) => entry.id !== parsed.id), parsed].sort((a, b) => a.createdAt.localeCompare(b.createdAt));
5542
- await writeJsonDurableWithinRoot(this.dir, "events.json", next);
5543
- });
5544
- }
5545
- async listEvents(query = {}) {
5546
- return withKnowledgeRead(this.dir, async () => {
5547
- let events = await this.readEvents();
5548
- if (query.type) events = events.filter((event) => event.type === query.type);
5549
- if (query.target) events = events.filter((event) => event.target === query.target);
5550
- return clone(events.slice(-(query.limit ?? events.length)));
5551
- });
5552
- }
5553
- async updateIndex(change) {
5554
- await withKnowledgeMutation(this.dir, async () => {
5555
- const current = await this.readIndex() ?? emptyIndex(this.dir);
5556
- const next = KnowledgeIndexSchema.parse(change(current));
5557
- await writeJsonDurableWithinRoot(this.dir, "index.json", next);
5558
- });
5559
- }
5560
- async readIndex() {
5561
- return readJsonFile(this.dir, "index.json", KnowledgeIndexSchema);
5562
- }
5563
- async readEvents() {
5564
- return await readJsonFile(this.dir, "events.json", knowledgeEventsSchema) ?? [];
5565
- }
5566
- };
5567
- function emptyIndex(root) {
5568
- return {
5569
- root,
5570
- generatedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
5571
- sources: [],
5572
- pages: [],
5573
- graph: {
5574
- nodes: [],
5575
- edges: []
5576
- }
5577
- };
5578
- }
5579
- async function readJsonFile(root, relativePath, schema) {
5580
- try {
5581
- const file = await readRegularFileWithinRoot(root, relativePath);
5582
- return schema.parse(JSON.parse(file.bytes.toString("utf8")));
5583
- } catch (error) {
5584
- if (error?.code === "ENOENT") return null;
5585
- throw error;
5586
- }
5587
- }
5588
- function clone(value) {
5589
- return value == null ? value : JSON.parse(JSON.stringify(value));
5590
- }
5591
- //#endregion
5592
5455
  //#region src/propose-from-finding.ts
5593
5456
  var KnowledgeProposalParseError = class extends Error {
5594
5457
  findingId;
@@ -5941,29 +5804,132 @@ function knowledgeReleaseReport(input) {
5941
5804
  * contested IS.
5942
5805
  *
5943
5806
  * It reuses `runVerifiedResearchLoop` (it is a plain `ResearchDriver`), the web
5944
- * worker, `sha256` (claim identity), `canonicalizeUrl` (independent-source
5945
- * identity), and the `RouterClient` chat surface; it reinvents none of them.
5807
+ * worker, `claim-ledger.ts` (claim identity, independent-source identity, and
5808
+ * the merge rule), and the `RouterClient` chat surface; it reinvents none of
5809
+ * them.
5810
+ */
5811
+ /**
5812
+ * The in-memory driver. Its belief state lives for exactly as long as the
5813
+ * process does — use `createPersistentResearchDrivingDriver` when the run must
5814
+ * survive a crash or resume.
5946
5815
  */
5947
5816
  function createResearchDrivingDriver(options = {}) {
5817
+ return buildDriver(options);
5818
+ }
5819
+ /**
5820
+ * The durable driver: same behaviour, plus its claim ledger is read from the
5821
+ * store at construction and written back after every claim and every round.
5822
+ *
5823
+ * Construction is asynchronous because loading is I/O, and loading has to happen
5824
+ * before the caller can read `researchState()` or `isComplete()` — a driver that
5825
+ * loaded lazily would answer "nothing researched, not complete" for a run that
5826
+ * had already corroborated everything.
5827
+ */
5828
+ async function createPersistentResearchDrivingDriver(options) {
5829
+ const ledgerId = assertClaimLedgerId(options.ledgerId);
5830
+ const existing = await options.store.getClaimLedger(ledgerId);
5831
+ const driver = buildDriver(options, {
5832
+ store: options.store,
5833
+ ledgerId
5834
+ }, existing ?? void 0);
5835
+ if (existing && (existing.preparedRounds ?? existing.rounds) > existing.rounds) await driver.checkpoint();
5836
+ return driver;
5837
+ }
5838
+ function buildDriver(options, persistence, restored) {
5948
5839
  const minIndependentSources = Math.max(2, options.minIndependentSources ?? 2);
5949
5840
  const maxQuestionsPerRound = Math.max(1, options.maxQuestionsPerRound ?? 6);
5950
5841
  const maxClaimsPerSource = Math.max(1, options.maxClaimsPerSource ?? 3);
5951
5842
  const deterministicFallback = options.deterministicFallback ?? true;
5952
- const claims = /* @__PURE__ */ new Map();
5953
- const questions = /* @__PURE__ */ new Map();
5954
- let rounds = 0;
5843
+ const claims = new Map((restored?.claims ?? []).map((claim) => [claim.id, fromRecord(claim)]));
5844
+ const claimEvidence = new Map((restored?.claimEvidence ?? []).map((evidence) => [evidence.id, evidence]));
5845
+ const registeredSourceUris = new Set(restored?.registeredSourceUris ?? []);
5846
+ const questions = new Map((restored?.questions ?? []).map((question) => [question.id, question]));
5847
+ let rounds = restored?.rounds ?? 0;
5848
+ let preparedRounds = Math.max(rounds, restored?.preparedRounds ?? rounds);
5849
+ let goal = restored?.goal;
5955
5850
  let lastSteer;
5851
+ if (preparedRounds > rounds) {
5852
+ for (let round = rounds + 1; round <= preparedRounds; round += 1) for (const question of synthesizeDeepQuestions([...claims.values()], round).slice(0, maxQuestionsPerRound)) if (!questions.has(question.id)) questions.set(question.id, question);
5853
+ rounds = preparedRounds;
5854
+ }
5855
+ function toLedger() {
5856
+ return {
5857
+ id: persistence?.ledgerId ?? "in-memory",
5858
+ ...goal === void 0 ? {} : { goal },
5859
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
5860
+ rounds,
5861
+ ...preparedRounds > rounds ? { preparedRounds } : {},
5862
+ claimEvidence: [...claimEvidence.values()].sort((left, right) => left.id.localeCompare(right.id)),
5863
+ registeredSourceUris: [...registeredSourceUris].sort(),
5864
+ claims: [...claims.values()].map((claim) => ({
5865
+ ...claim,
5866
+ supportingHosts: [...new Set(claim.supportingHosts)].sort(),
5867
+ supportingUris: [...new Set(claim.supportingUris)].sort(),
5868
+ contradicts: [...new Set(claim.contradicts)].sort()
5869
+ })).sort((a, b) => a.id.localeCompare(b.id)),
5870
+ questions: [...questions.values()].map((question) => ({
5871
+ ...question,
5872
+ claimIds: [...new Set(question.claimIds)].sort()
5873
+ })).sort((a, b) => a.id.localeCompare(b.id))
5874
+ };
5875
+ }
5876
+ /**
5877
+ * Write this driver's belief state into the stored ledger and adopt the
5878
+ * result.
5879
+ *
5880
+ * It merges rather than overwrites, and then rehydrates from the merged
5881
+ * record, which is the whole of what makes knowledge compound across
5882
+ * workers. Two drivers on one ledger id — a resumed run beside a still-live
5883
+ * one, or two workers researching one goal in parallel — would otherwise each
5884
+ * write a whole record built from what it read before the other wrote, and
5885
+ * the later write would erase the earlier writer's claims. Rehydrating means
5886
+ * a claim another worker corroborated counts toward THIS driver's completion
5887
+ * oracle from the next round onward.
5888
+ */
5889
+ async function persist() {
5890
+ if (!persistence) return;
5891
+ const mine = toLedger();
5892
+ const merged = await persistence.store.mergeClaimLedger(persistence.ledgerId, (current) => current === null ? mine : mergeClaimLedgers(current, mine));
5893
+ claims.clear();
5894
+ for (const claim of merged.claims) claims.set(claim.id, fromRecord(claim));
5895
+ claimEvidence.clear();
5896
+ for (const evidence of merged.claimEvidence) claimEvidence.set(evidence.id, evidence);
5897
+ registeredSourceUris.clear();
5898
+ for (const sourceUri of merged.registeredSourceUris) registeredSourceUris.add(sourceUri);
5899
+ questions.clear();
5900
+ for (const question of merged.questions) questions.set(question.id, question);
5901
+ rounds = Math.max(rounds, merged.rounds);
5902
+ preparedRounds = Math.max(rounds, merged.preparedRounds ?? merged.rounds);
5903
+ goal = merged.goal ?? goal;
5904
+ }
5905
+ async function prepareFold() {
5906
+ if (!persistence) return;
5907
+ preparedRounds = Math.max(preparedRounds, rounds + 1);
5908
+ await persist();
5909
+ }
5910
+ /**
5911
+ * A ledger accumulates evidence FOR a goal. Reusing one id across two goals
5912
+ * merges two runs' beliefs into one corroboration count, which is worse than
5913
+ * losing them, so it fails rather than merging.
5914
+ */
5915
+ function bindGoal(nextGoal) {
5916
+ if (goal === void 0) {
5917
+ goal = nextGoal;
5918
+ return;
5919
+ }
5920
+ if (goal !== nextGoal) throw new Error(`claim ledger '${persistence?.ledgerId ?? "in-memory"}' accumulated evidence for goal '${goal}' and cannot be reused for '${nextGoal}'`);
5921
+ }
5956
5922
  function resolveRouter() {
5957
5923
  return options.router ?? createTangleRouterClient(options.router_options);
5958
5924
  }
5959
5925
  /** Record a claim from a source, growing its independent-source support. */
5960
5926
  function recordClaim(extracted, sourceUri, round) {
5961
5927
  const id = claimId(extracted.text);
5962
- const host = hostOf(sourceUri);
5928
+ const host = claimSourceHost(sourceUri);
5963
5929
  const existing = claims.get(id);
5964
5930
  if (existing) {
5965
5931
  if (host) existing.supportingHosts.add(host);
5966
- if (!existing.supportingUris.includes(sourceUri)) existing.supportingUris.push(sourceUri);
5932
+ addUnique(existing.supportingUris, sourceUri);
5967
5933
  linkContradiction(existing, extracted.contradictsExistingId);
5968
5934
  return existing;
5969
5935
  }
@@ -5980,6 +5946,62 @@ function createResearchDrivingDriver(options = {}) {
5980
5946
  claims.set(id, tracked);
5981
5947
  return tracked;
5982
5948
  }
5949
+ /** Persist an extraction observation without treating its source as registered. */
5950
+ function recordEvidence(extracted, sourceUri, round) {
5951
+ const text = extracted.text.trim();
5952
+ const observedClaimId = claimId(text);
5953
+ const contradictsClaimId = extracted.contradictsExistingId === observedClaimId ? void 0 : extracted.contradictsExistingId;
5954
+ const evidence = {
5955
+ id: claimEvidenceId({
5956
+ claimId: observedClaimId,
5957
+ sourceUri,
5958
+ contradictsClaimId
5959
+ }),
5960
+ claimId: observedClaimId,
5961
+ text,
5962
+ sourceUri,
5963
+ ...contradictsClaimId === void 0 ? {} : { contradictsClaimId },
5964
+ firstSeenRound: round
5965
+ };
5966
+ const existing = claimEvidence.get(evidence.id);
5967
+ if (!existing) {
5968
+ claimEvidence.set(evidence.id, evidence);
5969
+ return evidence;
5970
+ }
5971
+ const merged = {
5972
+ ...evidence.firstSeenRound < existing.firstSeenRound || evidence.firstSeenRound === existing.firstSeenRound && evidence.text < existing.text ? evidence : existing,
5973
+ firstSeenRound: Math.min(existing.firstSeenRound, evidence.firstSeenRound)
5974
+ };
5975
+ claimEvidence.set(merged.id, merged);
5976
+ return merged;
5977
+ }
5978
+ /** Materialize evidence for newly confirmed source URIs into live claims. */
5979
+ function materializeEvidenceFor(sourceUris) {
5980
+ const evidence = [...claimEvidence.values()].filter((item) => sourceUris.has(item.sourceUri));
5981
+ const texts = [];
5982
+ for (const item of evidence) {
5983
+ recordClaim({
5984
+ text: item.text,
5985
+ contradictsExistingId: item.contradictsClaimId
5986
+ }, item.sourceUri, item.firstSeenRound);
5987
+ texts.push(item.text);
5988
+ }
5989
+ for (const item of evidence) {
5990
+ const claim = claims.get(item.claimId);
5991
+ if (claim) linkContradiction(claim, item.contradictsClaimId);
5992
+ }
5993
+ return texts;
5994
+ }
5995
+ async function commitSources(sourceUris) {
5996
+ const newlyRegistered = /* @__PURE__ */ new Set();
5997
+ for (const sourceUri of sourceUris) {
5998
+ if (registeredSourceUris.has(sourceUri)) continue;
5999
+ registeredSourceUris.add(sourceUri);
6000
+ newlyRegistered.add(sourceUri);
6001
+ }
6002
+ if (newlyRegistered.size > 0) markAddressed(materializeEvidenceFor(newlyRegistered));
6003
+ await persist();
6004
+ }
5983
6005
  /** Wire a bidirectional contradiction edge and mark BOTH claims contested. */
5984
6006
  function linkContradiction(claim, otherId) {
5985
6007
  if (!otherId || otherId === claim.id) return;
@@ -6049,17 +6071,18 @@ function createResearchDrivingDriver(options = {}) {
6049
6071
  * because such a source cannot drive the research and pollutes the KB.
6050
6072
  */
6051
6073
  async verifySource(source, ctx) {
6074
+ bindGoal(ctx.goal);
6052
6075
  const extracted = await extractClaims(source, ctx);
6053
6076
  if (extracted.length === 0) return {
6054
6077
  accept: false,
6055
6078
  reason: "no extractable claim: source yields nothing to drive the research deeper"
6056
6079
  };
6057
- const newTexts = [];
6058
- for (const claim of extracted) {
6059
- recordClaim(claim, source.uri, ctx.round);
6060
- newTexts.push(claim.text);
6061
- }
6062
- markAddressed(newTexts);
6080
+ for (const claim of extracted) recordEvidence(claim, source.uri, ctx.round);
6081
+ if (!persistence) {
6082
+ registeredSourceUris.add(source.uri);
6083
+ markAddressed(materializeEvidenceFor(/* @__PURE__ */ new Set([source.uri])));
6084
+ } else if (registeredSourceUris.has(source.uri)) markAddressed(materializeEvidenceFor(/* @__PURE__ */ new Set([source.uri])));
6085
+ await persist();
6063
6086
  return { accept: true };
6064
6087
  },
6065
6088
  /**
@@ -6069,6 +6092,7 @@ function createResearchDrivingDriver(options = {}) {
6069
6092
  * (3) INVALIDATION challenges for weakly-supported / contradicted claims.
6070
6093
  */
6071
6094
  foldGaps(gaps) {
6095
+ if (persistence && preparedRounds <= rounds) throw new Error("persistent research driver must prepareFold before foldGaps");
6072
6096
  rounds += 1;
6073
6097
  const round = rounds;
6074
6098
  const ledger = [...claims.values()];
@@ -6096,14 +6120,34 @@ function createResearchDrivingDriver(options = {}) {
6096
6120
  },
6097
6121
  lastSteer() {
6098
6122
  return lastSteer;
6099
- }
6123
+ },
6124
+ checkpoint: persist,
6125
+ prepareFold,
6126
+ commitSources,
6127
+ toLedger
6100
6128
  };
6101
6129
  async function extractClaims(source, ctx) {
6102
- const fromLlm = await extractClaimsWithLlm(source, ctx, [...claims.values()]);
6130
+ const fromLlm = await extractClaimsWithLlm(source, ctx, claimsForExtraction());
6103
6131
  if (fromLlm.length > 0) return fromLlm.slice(0, maxClaimsPerSource);
6104
6132
  if (deterministicFallback) return deterministicClaims(source).slice(0, maxClaimsPerSource);
6105
6133
  return [];
6106
6134
  }
6135
+ function claimsForExtraction() {
6136
+ const known = new Map(claims);
6137
+ for (const evidence of claimEvidence.values()) {
6138
+ if (known.has(evidence.claimId)) continue;
6139
+ known.set(evidence.claimId, {
6140
+ id: evidence.claimId,
6141
+ text: evidence.text,
6142
+ supportingHosts: /* @__PURE__ */ new Set(),
6143
+ supportingUris: [],
6144
+ contradicts: /* @__PURE__ */ new Set(),
6145
+ contested: false,
6146
+ firstSeenRound: evidence.firstSeenRound
6147
+ });
6148
+ }
6149
+ return [...known.values()];
6150
+ }
6107
6151
  async function extractClaimsWithLlm(source, ctx, ledger) {
6108
6152
  let router;
6109
6153
  try {
@@ -6177,25 +6221,26 @@ function makeQuestion(kind, text, claimIds, raisedRound) {
6177
6221
  return {
6178
6222
  kind,
6179
6223
  text,
6180
- id: `q_${sha256(`${kind}:${text}`).slice(0, 16)}`,
6181
- claimIds,
6224
+ id: deepQuestionId(kind, text),
6225
+ claimIds: [...new Set(claimIds)].sort(),
6182
6226
  addressed: false,
6183
6227
  raisedRound
6184
6228
  };
6185
6229
  }
6186
- /** Claim identity = sha256 of the normalized claim text (same words ⇒ same claim). */
6187
- function claimId(text) {
6188
- return `c_${sha256(normalizeText(text)).slice(0, 16)}`;
6189
- }
6190
- function hostOf(uri) {
6191
- try {
6192
- return new URL(uri.trim()).hostname.toLowerCase().replace(/^www\./, "");
6193
- } catch {
6194
- return canonicalizeUrl(uri);
6195
- }
6230
+ function fromRecord(claim) {
6231
+ return {
6232
+ ...claim,
6233
+ supportingHosts: new Set(claim.supportingHosts),
6234
+ supportingUris: [...claim.supportingUris],
6235
+ contradicts: new Set(claim.contradicts)
6236
+ };
6196
6237
  }
6197
- function normalizeText(text) {
6198
- return text.toLowerCase().replace(/[^\p{L}\p{N}\s]+/gu, " ").replace(/\s+/g, " ").trim();
6238
+ /**
6239
+ * Set-like insert into the array form. The ledger's collections are arrays so
6240
+ * they survive `JSON.stringify`; dedup is enforced here instead of by the type.
6241
+ */
6242
+ function addUnique(values, value) {
6243
+ if (!values.includes(value)) values.push(value);
6199
6244
  }
6200
6245
  const stopwords = /* @__PURE__ */ new Set([
6201
6246
  "the",
@@ -6249,7 +6294,7 @@ const stopwords = /* @__PURE__ */ new Set([
6249
6294
  "them"
6250
6295
  ]);
6251
6296
  function contentWordSet(text) {
6252
- return new Set(normalizeText(text).split(" ").filter((word) => word.length >= 3 && !stopwords.has(word)));
6297
+ return new Set(normalizeClaimText(text).split(" ").filter((word) => word.length >= 3 && !stopwords.has(word)));
6253
6298
  }
6254
6299
  function overlapFraction(a, b) {
6255
6300
  if (a.size === 0) return 0;
@@ -6326,6 +6371,6 @@ function buildSteerText(gaps, deepQuestions, invalidationTargets, minIndependent
6326
6371
  return lines.join("\n");
6327
6372
  }
6328
6373
  //#endregion
6329
- export { AgentMemoryHitSchema, AgentMemoryKindSchema, AgentMemoryLifecycleTimeoutError, AgentMemoryLifecycleUnsafeError, AgentMemoryScopeSchema, AgentMemoryWriteInputSchema, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, FileSystemKbStore, FileSystemSearchProvider, INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, IRS_DIMENSION_HINTS, KnowledgeBaseCandidateSchema, KnowledgeEventSchema, KnowledgeGraphEdgeSchema, KnowledgeGraphNodeSchema, KnowledgeImprovementCandidateRefSchema, KnowledgeImprovementEvidenceSchema, KnowledgeImprovementRunStateSchema, KnowledgeIndexSchema, KnowledgePageSchema, KnowledgeProposalParseError, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, MemoryKbStore, POLITE_USER_AGENT, READINESS_SPEC_DEFAULTS, RouterError, SCAFFOLD_PAGE_BASENAMES, SourceAnchorSchema, SourceRecordSchema, WIKILINK_REGEX, __resetHttpThrottle, acquireAgentMemoryRunLease, addSourcePath, addSourceText, agentMemorySequenceJudge, applyKnowledgeWriteBlocks, applyKnowledgeWriteBlocksFile, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, buildAgentMemorySequenceScenarios, buildAgentMemorySequencesFromBenchmarkCases, buildEvalKnowledgeBundle, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildKnowledgeGraph, buildKnowledgeIndex, buildRetrievalBenchmarkCasesFromQrels, buildRetrievalEvalDispatch, calibrateRagAnswerJudge, canonicalizeUrl, chunkMarkdown, citedClaimKey, citedClaimOf, contentKey, createAdaptiveResearchDriver, createAgentMemoryBranch, createClaimDecorator, createClaimGroundingVerifier, createCollectionResearchDriver, createCornellLiiSource, createD1FreshnessStoreStub, createFileSystemFreshnessStore, createFileSystemSearchProvider, createGraphitiMemoryAdapter, createInMemoryBenchmarkAdapter, createIrsPublicationsSource, createKnowledgeControlLoopAdapter, createKnowledgeEvent, createLocalDiscoveryDispatcher, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, createNoopMemoryBenchmarkAdapter, createRagAnswerQualityHook, createResearchDrivingDriver, createStateSosSource, createTangleRouterClient, createVerifyingResearchDriver, createWebResearchWorker, defaultGetMemoryContext, defineReadinessSpec, detectChanges, deterministicRng, diagnoseRagAnswerFailure, emitRetrievalHoldoutBypass, evaluateKnowledgeBaseReadiness, explainKnowledgeTarget, extractLinks, extractWikilinks, firstMatch, forkAgentMemoryBranchSnapshot, formatFrontmatter, fromAgentCandidateKnowledgeRef, gradeCompanyAgainstText, gradeFactAgainstText, graphitiMemoryAdapterIdentity, groundClaimInText, hashKnowledgeBase, htmlToText, improveKnowledgeBase, initKnowledgeBase, innerHtmlById, inspectKnowledgeIndex, inspectPendingKnowledgeMutation, investmentThesisSet, isKnowledgeMemoryBenchmarkCase, isSafeKnowledgePath, isScaffoldPath, jsonCandidateCodec, jsonObjectCandidateCodec, kbIndexToText, knowledgeBenchmarkJudge, knowledgeImprovementCandidateRef, knowledgeImprovementRunDir, knowledgeImprovementRunId, knowledgeReleaseReport, layoutFor, lensDistribution, lintKnowledgeIndex, loadKnowledgeImprovementActivationResult, loadKnowledgeImprovementEvents, loadKnowledgeImprovementState, loadKnowledgePages, loadSourceRegistry, looksLikeBlockPage, materialFactsSurfaced, materialFactsSurfacedInText, mediaTypeFor, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, normalizeExternalRagScores, normalizeLinkTarget, optimizeKnowledgeBasePolicy, parseFrontmatter, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, parseKnowledgeWriteBlocks, partitionRetrievalScenarios, politeFetch, promoteKnowledgeCandidate, proposeFromFinding, proposeFromFindings, ragAnswerQualityJudge, reciprocalRankFusion, recoverPendingKnowledgeMutation, renderKnowledgeBenchmarkReportMarkdown, renderMemoryContext, resetRetrievalHoldoutRegistry, resolveMemoryCleanupTimeoutMs, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, restoreKnowledgeCandidateBaseline, retrievalConfigFromSurface, retrievalConfigSurface, retrievalHoldoutConfigHash, retrievalRecallJudge, runAgentMemoryExperiment, runAgentMemoryImprovement, runBoundedMemoryLifecycle, runDiscoveryLoop, runInvestmentThesisTask, runKnowledgeBenchmarkSuite, runKnowledgeResearchLoop, runMemoryAdapterBenchmark, runRagKnowledgeImprovementLoop, runRagOptimization, runRetrievalImprovementLoop, runSerializedKnowledgeOptimization, runVerifiedResearchLoop, scenarioContentFingerprint, scoreKnowledgeBaseIndex, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, scoreRagAnswerArtifact, scoreRetrievalArtifact, searchKnowledge, sha256, sleepForMemoryRecovery, slugify, sourceMatchesGaps, sourceRegistryPath, stableId, stripFrontmatter, summarizeKnowledgeBenchmarkCampaign, textSourceAdapter, thesisReadinessSpecs, toAgentCandidateKnowledgeRef, toDeepEvalTestCases, toOffPolicyTrajectory, toRagCheckerRecords, toRagasEvaluationRows, toTruLensRecords, tokenizeQuery, totalMaterialFacts, triageSource, validateKnowledgeIndex, withCitedClaim, withKnowledgeImprovementCandidate, withKnowledgeImprovementComparison, writeJson, writeKnowledgeIndex, writeSourceRegistry };
6374
+ export { AgentMemoryHitSchema, AgentMemoryKindSchema, AgentMemoryLifecycleTimeoutError, AgentMemoryLifecycleUnsafeError, AgentMemoryScopeSchema, AgentMemoryWriteInputSchema, ClaimLedgerGoalConflictError, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, DeepQuestionSchema, FileSystemKbStore, FileSystemSearchProvider, INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, IRS_DIMENSION_HINTS, KB_CLAIM_LEDGER_DIR, KB_EVENTS_PATH, KB_INDEX_PATH, KB_STORE_DIR, KNOWLEDGE_EVENT_TYPES, KnowledgeBaseCandidateSchema, KnowledgeEventSchema, KnowledgeGraphEdgeSchema, KnowledgeGraphNodeSchema, KnowledgeImprovementCandidateRefSchema, KnowledgeImprovementEvidenceSchema, KnowledgeImprovementRunStateSchema, KnowledgeIndexSchema, KnowledgePageSchema, KnowledgeProposalParseError, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, MemoryKbStore, POLITE_USER_AGENT, READINESS_SPEC_DEFAULTS, ResearchClaimEvidenceSchema, ResearchClaimLedgerSchema, ResearchClaimRecordSchema, RouterError, SCAFFOLD_PAGE_BASENAMES, SourceAnchorSchema, SourceRecordSchema, WIKILINK_REGEX, __resetHttpThrottle, acquireAgentMemoryRunLease, addSourcePath, addSourceText, agentMemorySequenceJudge, applyKnowledgeWriteBlocks, applyKnowledgeWriteBlocksFile, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, assertClaimLedgerId, assertDeepQuestionIntegrity, assertResearchClaimEvidenceIntegrity, assertResearchClaimLedgerIntegrity, assertTrackedClaimIntegrity, buildAgentMemorySequenceScenarios, buildAgentMemorySequencesFromBenchmarkCases, buildEvalKnowledgeBundle, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildKnowledgeGraph, buildKnowledgeIndex, buildRetrievalBenchmarkCasesFromQrels, buildRetrievalEvalDispatch, calibrateRagAnswerJudge, canonicalizeUrl, chunkMarkdown, citedClaimKey, citedClaimOf, claimEvidenceId, claimId, claimSourceHost, contentKey, createAdaptiveResearchDriver, createAgentMemoryBranch, createClaimDecorator, createClaimGroundingVerifier, createCollectionResearchDriver, createCornellLiiSource, createD1FreshnessStoreStub, createFileSystemFreshnessStore, createFileSystemSearchProvider, createGraphitiMemoryAdapter, createInMemoryBenchmarkAdapter, createIrsPublicationsSource, createKnowledgeControlLoopAdapter, createKnowledgeEvent, createLocalDiscoveryDispatcher, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, createNoopMemoryBenchmarkAdapter, createPersistentResearchDrivingDriver, createRagAnswerQualityHook, createResearchDrivingDriver, createStateSosSource, createTangleRouterClient, createVerifyingResearchDriver, createWebResearchWorker, deepQuestionId, defaultGetMemoryContext, defineReadinessSpec, detectChanges, deterministicRng, diagnoseRagAnswerFailure, emitRetrievalHoldoutBypass, emptyClaimLedger, evaluateKnowledgeBaseReadiness, explainKnowledgeTarget, extractLinks, extractWikilinks, firstMatch, forkAgentMemoryBranchSnapshot, formatFrontmatter, fromAgentCandidateKnowledgeRef, gradeCompanyAgainstText, gradeFactAgainstText, graphitiMemoryAdapterIdentity, groundClaimInText, hashKnowledgeBase, htmlToText, improveKnowledgeBase, initKnowledgeBase, innerHtmlById, inspectKnowledgeIndex, inspectPendingKnowledgeMutation, investmentThesisSet, isKernelAnchoredPath, isKnowledgeMemoryBenchmarkCase, isMissingFile, isSafeKnowledgePath, isScaffoldPath, jsonCandidateCodec, jsonObjectCandidateCodec, kbIndexToText, knowledgeBenchmarkJudge, knowledgeImprovementCandidateRef, knowledgeImprovementRunDir, knowledgeImprovementRunId, knowledgeReleaseReport, layoutFor, lensDistribution, linkClaimContradictions, lintKnowledgeIndex, listRegularFilesWithinRoot, loadKnowledgeImprovementActivationResult, loadKnowledgeImprovementEvents, loadKnowledgeImprovementState, loadKnowledgePages, loadSourceRegistry, looksLikeBlockPage, materialFactsSurfaced, materialFactsSurfacedInText, materializeRegisteredClaimEvidence, mediaTypeFor, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, mergeClaimLedgers, mergeTrackedClaims, normalizeClaimText, normalizeExternalRagScores, normalizeLinkTarget, optimizeKnowledgeBasePolicy, parseFrontmatter, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, parseKnowledgeWriteBlocks, partitionRetrievalScenarios, politeFetch, promoteKnowledgeCandidate, proposeFromFinding, proposeFromFindings, ragAnswerQualityJudge, readRegularFileNoFollow, readRegularFileWithinRoot, reciprocalRankFusion, recoverPendingKnowledgeMutation, removeDurable, renameDurable, renderKnowledgeBenchmarkReportMarkdown, renderMemoryContext, resetRetrievalHoldoutRegistry, resolveMemoryCleanupTimeoutMs, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, restoreKnowledgeCandidateBaseline, retrievalConfigFromSurface, retrievalConfigSurface, retrievalHoldoutConfigHash, retrievalRecallJudge, runAgentMemoryExperiment, runAgentMemoryImprovement, runBoundedMemoryLifecycle, runDiscoveryLoop, runInvestmentThesisTask, runKnowledgeBenchmarkSuite, runKnowledgeResearchLoop, runMemoryAdapterBenchmark, runRagKnowledgeImprovementLoop, runRagOptimization, runRetrievalImprovementLoop, runSerializedKnowledgeOptimization, runVerifiedResearchLoop, scenarioContentFingerprint, scoreKnowledgeBaseIndex, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, scoreRagAnswerArtifact, scoreRetrievalArtifact, searchKnowledge, sha256, sleepForMemoryRecovery, slugify, sourceMatchesGaps, sourceRegistryPath, stableId, stripFrontmatter, summarizeKnowledgeBenchmarkCampaign, syncDirectory, textSourceAdapter, thesisReadinessSpecs, toAgentCandidateKnowledgeRef, toDeepEvalTestCases, toOffPolicyTrajectory, toRagCheckerRecords, toRagasEvaluationRows, toTruLensRecords, tokenizeQuery, totalMaterialFacts, triageSource, validateKnowledgeIndex, withCitedClaim, withKnowledgeImprovementCandidate, withKnowledgeImprovementComparison, withSafeDescendant, withSafeDirectory, writeFileDurable, writeFileDurableWithinRoot, writeJson, writeJsonDurable, writeJsonDurableWithinRoot, writeKnowledgeIndex, writeSourceRegistry };
6330
6375
 
6331
6376
  //# sourceMappingURL=index.js.map