@tangle-network/agent-knowledge 22.0.0 → 22.0.2

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.
@@ -1,13 +1,14 @@
1
1
  import { i as textSourceId, n as slugify, r as stableId, t as sha256 } from "./ids-Bevz_pXV.js";
2
- import { r as searchKnowledge } from "./search-BBr5eUyT.js";
2
+ import { r as searchKnowledge } from "./search-aZdP2685.js";
3
3
  import { canonicalCandidateBytes, canonicalCandidateDigest, sha256Bytes, sha256DigestSchema } from "@tangle-network/agent-interface";
4
4
  import { contentHash } from "@tangle-network/agent-eval";
5
5
  import { z } from "zod";
6
6
  import { createHash, randomUUID } from "node:crypto";
7
7
  import { closeSync, constants, fstatSync, lstatSync, openSync, readFileSync } from "node:fs";
8
- import { lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm } from "node:fs/promises";
8
+ import { lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
9
9
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
10
10
  import { AsyncLocalStorage } from "node:async_hooks";
11
+ import { hostname } from "node:os";
11
12
  //#region src/adapters.ts
12
13
  const textSourceAdapter = {
13
14
  id: "text",
@@ -884,8 +885,45 @@ function fileMatches(file, hash, mode) {
884
885
  //#endregion
885
886
  //#region src/mutation-lock.ts
886
887
  const DEFAULT_STALE_MS = 9e5;
887
- const DEFAULT_READ_RETRIES = 100;
888
888
  const DEFAULT_READ_WAIT_MS = 25;
889
+ const MAX_POLL_MS = 250;
890
+ function sleep(ms) {
891
+ return new Promise((resolve) => setTimeout(resolve, ms));
892
+ }
893
+ /**
894
+ * How long a writer waits for the store lock, behind this process's writers and then another
895
+ * process's hold, before it fails naming the holder. It is the default stale window: by then the
896
+ * holder released, or stopped heartbeating and its lock was taken over, or it held the store
897
+ * longer than a crashed holder could wedge it.
898
+ *
899
+ * Holds measured on Discovery's archive USB disk had a median of 30.4 s and reached 92.6 s, and
900
+ * the 60 s same-process admission this replaces failed a queued `knowledge_record` terminally
901
+ * there, losing the write (agent-knowledge#251). On flash the same holds take 58-86 ms.
902
+ */
903
+ const WRITER_WAIT_MS = DEFAULT_STALE_MS;
904
+ /**
905
+ * How long a reader waits out writes before failing, when the caller sets no `retries`. It covers
906
+ * the slowest hold measured (92.6 s); the 2.5 s it replaces failed 18.3% of reads on that disk.
907
+ * A read changes nothing, so failing one loses no work, which is why it waits less than a writer.
908
+ */
909
+ const READER_WAIT_MS = 12e4;
910
+ /** Diagnostic record of the current cross-process holder, read only to name it in a timeout. */
911
+ const LOCK_OWNER_FILE = "mutation.lock.owner.json";
912
+ const holderLabels = new AsyncLocalStorage();
913
+ /**
914
+ * Name the store mutations `body` performs, so a writer or reader that times out behind them can
915
+ * say who held the store. Internal: tools label their writes with the tool and actor.
916
+ */
917
+ function withKnowledgeMutationLabel(label, body) {
918
+ return holderLabels.run(label, body);
919
+ }
920
+ function describeHolder(holder, now = Date.now()) {
921
+ const heldS = Math.max(0, Math.round((now - holder.since) / 1e3));
922
+ return `${holder.label} (pid ${holder.pid} on ${holder.host}, holding since ${new Date(holder.since).toISOString()}, ${heldS} s)`;
923
+ }
924
+ function seconds(ms) {
925
+ return `${Math.round(ms / 100) / 10} s`;
926
+ }
889
927
  let lockfileModule;
890
928
  function loadLockfile() {
891
929
  lockfileModule ??= import("proper-lockfile");
@@ -894,14 +932,13 @@ function loadLockfile() {
894
932
  const activeRoots = new AsyncLocalStorage();
895
933
  const activeReadRoots = new AsyncLocalStorage();
896
934
  const gates = /* @__PURE__ */ new Map();
897
- /** How long a same-process writer waits for admission before failing like a contended lock. */
898
- const WRITER_ADMISSION_MS = 6e4;
899
935
  function gateOf(root) {
900
936
  let gate = gates.get(root);
901
937
  if (!gate) {
902
938
  gate = {
903
939
  readers: 0,
904
940
  writing: false,
941
+ holder: void 0,
905
942
  readersWaiting: [],
906
943
  writersWaiting: []
907
944
  };
@@ -921,34 +958,51 @@ function admitNext(root, gate, afterWrite) {
921
958
  gate.writersWaiting.shift()();
922
959
  } else if (gate.readers === 0) gates.delete(root);
923
960
  }
924
- async function enterGate(root, mode, timeoutMs) {
961
+ /** Who a same-process waiter is waiting behind, for its timeout error. */
962
+ function describeGate(gate) {
963
+ const queued = gate.writersWaiting.length;
964
+ const behind = gate.holder ? describeHolder(gate.holder) : gate.readers > 0 ? `${gate.readers} reader(s) of this process` : "no admitted writer";
965
+ return queued > 0 ? `${behind}; ${queued} writer(s) still queued` : behind;
966
+ }
967
+ async function enterGate(root, mode, timeoutMs, label = "a knowledge mutation") {
925
968
  const gate = gateOf(root);
926
969
  const release = mode === "read" ? () => {
927
970
  gate.readers -= 1;
928
971
  if (gate.readers === 0) admitNext(root, gate, false);
929
972
  } : () => {
930
973
  gate.writing = false;
974
+ gate.holder = void 0;
931
975
  admitNext(root, gate, true);
932
976
  };
977
+ const hold = () => {
978
+ if (mode === "write") gate.holder = {
979
+ label,
980
+ pid: process.pid,
981
+ host: hostname(),
982
+ since: Date.now()
983
+ };
984
+ return once(release);
985
+ };
933
986
  if (mode === "read" ? !gate.writing && gate.writersWaiting.length === 0 : !gate.writing && gate.readers === 0 && gate.writersWaiting.length === 0) {
934
987
  if (mode === "read") gate.readers += 1;
935
988
  else gate.writing = true;
936
- return once(release);
989
+ return hold();
937
990
  }
938
991
  const waiting = mode === "read" ? gate.readersWaiting : gate.writersWaiting;
939
992
  return new Promise((resolve, reject) => {
940
993
  let timer;
941
994
  const admit = () => {
942
995
  if (timer) clearTimeout(timer);
943
- resolve(once(release));
996
+ resolve(hold());
944
997
  };
945
998
  waiting.push(admit);
946
999
  timer = setTimeout(() => {
947
1000
  const position = waiting.indexOf(admit);
948
1001
  if (position < 0) return;
949
1002
  waiting.splice(position, 1);
1003
+ const behind = describeGate(gate);
950
1004
  admitNext(root, gate, mode === "write");
951
- reject(mode === "read" ? /* @__PURE__ */ new Error("knowledge read could not observe a stable mutation epoch") : Object.assign(/* @__PURE__ */ new Error(`knowledge store is locked by this process: ${root}`), { code: "ELOCKED" }));
1005
+ reject(mode === "read" ? /* @__PURE__ */ new Error(`knowledge read could not observe a stable mutation epoch: ${root}; waited ${seconds(timeoutMs)} behind ${behind}`) : Object.assign(/* @__PURE__ */ new Error(`knowledge store is locked by this process: ${root}; waited ${seconds(timeoutMs)} behind ${behind}`), { code: "ELOCKED" }));
952
1006
  }, timeoutMs);
953
1007
  timer.unref?.();
954
1008
  });
@@ -993,21 +1047,17 @@ async function withKnowledgeMutation(root, mutate, options = {}) {
993
1047
  const existing = activeRoots.getStore()?.get(resolvedRoot);
994
1048
  if (existing?.active) return await runInlineMutation(existing.lock, mutate);
995
1049
  if (activeReadRoots.getStore()?.has(resolvedRoot)) throw new Error("a knowledge mutation cannot start inside a read of the same store");
1050
+ const label = holderLabels.getStore() ?? options.resumeTransaction?.purpose ?? "a knowledge mutation";
996
1051
  const started = performance.now();
997
- const leave = await enterGate(resolvedRoot, "write", noRetries(options.retries) ? 0 : WRITER_ADMISSION_MS);
1052
+ const leave = await enterGate(resolvedRoot, "write", noRetries(options.retries) ? 0 : WRITER_WAIT_MS, label);
998
1053
  try {
999
1054
  return await withSafeDirectory(resolvedRoot, ".agent-knowledge", true, async (cacheDir) => {
1000
- const acquired = await acquireDurableFileLock(resolvedRoot, {
1001
- lockfilePath: join(cacheDir, "mutation.lock.durable"),
1055
+ const acquired = await acquireStoreLock(resolvedRoot, cacheDir, {
1002
1056
  staleMs: options.staleMs,
1003
- retries: options.retries ?? {
1004
- retries: 100,
1005
- factor: 1.1,
1006
- minTimeout: 10,
1007
- maxTimeout: 200,
1008
- randomize: true
1009
- }
1057
+ retries: options.retries,
1058
+ started
1010
1059
  });
1060
+ await recordLockOwner(cacheDir, label);
1011
1061
  const held = performance.now();
1012
1062
  try {
1013
1063
  return await runOwnedMutation(resolvedRoot, cacheDir, acquired, options, mutate);
@@ -1026,6 +1076,54 @@ async function withKnowledgeMutation(root, mutate, options = {}) {
1026
1076
  leave();
1027
1077
  }
1028
1078
  }
1079
+ /**
1080
+ * Take the cross-process file lock. A caller that sets `retries` keeps that attempt budget; every
1081
+ * other writer polls until one deadline shared with its in-process wait, so a hold longer than a
1082
+ * fixed number of attempts delays a write instead of failing it.
1083
+ */
1084
+ async function acquireStoreLock(root, cacheDir, options) {
1085
+ const lockfilePath = join(cacheDir, "mutation.lock.durable");
1086
+ const deadline = options.started + WRITER_WAIT_MS;
1087
+ let pause = 10;
1088
+ for (;;) try {
1089
+ return await acquireDurableFileLock(root, {
1090
+ lockfilePath,
1091
+ staleMs: options.staleMs,
1092
+ retries: options.retries ?? 0
1093
+ });
1094
+ } catch (error) {
1095
+ const remaining = deadline - performance.now();
1096
+ if (options.retries !== void 0 || error.code !== "ELOCKED" || remaining <= 0) throw await namedLockError(error, root, cacheDir, performance.now() - options.started);
1097
+ await sleep(Math.min(remaining, pause * (.5 + Math.random())));
1098
+ pause = Math.min(MAX_POLL_MS, pause * 1.5);
1099
+ }
1100
+ }
1101
+ /** A contended file lock, restated with the holder its owner record names. */
1102
+ async function namedLockError(error, root, cacheDir, waitedMs) {
1103
+ if (error?.code !== "ELOCKED") return error;
1104
+ const owner = await readLockOwner(cacheDir);
1105
+ return Object.assign(new Error(`knowledge store is locked by another process: ${root}; waited ${seconds(waitedMs)} for ${owner ? describeHolder(owner) : "a holder that recorded no owner"}`, { cause: error }), { code: "ELOCKED" });
1106
+ }
1107
+ /** Record who holds the file lock, for a waiter's timeout. Diagnostic only, so not fsynced. */
1108
+ async function recordLockOwner(cacheDir, label) {
1109
+ const owner = {
1110
+ label,
1111
+ pid: process.pid,
1112
+ host: hostname(),
1113
+ since: Date.now()
1114
+ };
1115
+ try {
1116
+ await writeFile(join(cacheDir, LOCK_OWNER_FILE), `${JSON.stringify(owner)}\n`);
1117
+ } catch {}
1118
+ }
1119
+ async function readLockOwner(cacheDir) {
1120
+ try {
1121
+ const value = JSON.parse(await readFile(join(cacheDir, LOCK_OWNER_FILE), "utf8"));
1122
+ return typeof value.label === "string" && Number.isSafeInteger(value.pid) && typeof value.host === "string" && Number.isFinite(value.since) ? value : void 0;
1123
+ } catch {
1124
+ return;
1125
+ }
1126
+ }
1029
1127
  function noRetries(retries) {
1030
1128
  return retries === 0 || typeof retries === "object" && !Array.isArray(retries) && retries.retries === 0;
1031
1129
  }
@@ -1172,27 +1270,46 @@ async function withKnowledgeRead(root, read, options = {}) {
1172
1270
  if (activeReadRoots.getStore()?.has(resolvedRoot)) return await read();
1173
1271
  const readRoots = new Set(activeReadRoots.getStore());
1174
1272
  readRoots.add(resolvedRoot);
1175
- const retries = options.retries ?? DEFAULT_READ_RETRIES;
1176
- const leave = await enterGate(resolvedRoot, "read", (retries + 1) * (options.waitMs ?? DEFAULT_READ_WAIT_MS));
1273
+ const started = performance.now();
1274
+ const retries = options.retries;
1275
+ const budgetMs = retries === void 0 ? READER_WAIT_MS : (retries + 1) * (options.waitMs ?? DEFAULT_READ_WAIT_MS);
1276
+ const deadline = started + budgetMs;
1277
+ const leave = await enterGate(resolvedRoot, "read", budgetMs);
1177
1278
  try {
1178
1279
  return await activeReadRoots.run(readRoots, async () => {
1179
- for (let attempt = 0; attempt <= retries; attempt += 1) {
1280
+ let pause = options.waitMs ?? DEFAULT_READ_WAIT_MS;
1281
+ for (let attempt = 0; retries === void 0 || attempt <= retries; attempt += 1) {
1282
+ if (attempt > 0 && retries === void 0 && performance.now() >= deadline) break;
1180
1283
  const before = await readMutationEpoch(resolvedRoot);
1181
- if (isOdd(before)) {
1182
- await waitForActiveMutationEpoch(resolvedRoot, before, options);
1183
- continue;
1284
+ let active = before;
1285
+ if (!isOdd(before)) {
1286
+ const result = await read();
1287
+ const after = await readMutationEpoch(resolvedRoot);
1288
+ if (before === after) return result;
1289
+ if (!isOdd(after)) continue;
1290
+ active = after;
1184
1291
  }
1185
- const result = await read();
1186
- const after = await readMutationEpoch(resolvedRoot);
1187
- if (before === after && !isOdd(after)) return result;
1188
- if (isOdd(after)) await waitForActiveMutationEpoch(resolvedRoot, after, options);
1292
+ await waitForActiveMutationEpoch(resolvedRoot, active, options, pause);
1293
+ if (retries === void 0) pause = Math.min(MAX_POLL_MS, pause * 1.5);
1189
1294
  }
1190
- throw new Error("knowledge read could not observe a stable mutation epoch");
1295
+ throw new Error(`knowledge read could not observe a stable mutation epoch: ${resolvedRoot}; waited ${seconds(performance.now() - started)} for ${await describeWriter(resolvedRoot)}`);
1191
1296
  });
1192
1297
  } finally {
1193
1298
  leave();
1194
1299
  }
1195
1300
  }
1301
+ /** The writer a reader gave up on: this process's admitted writer, else the recorded owner. */
1302
+ async function describeWriter(root) {
1303
+ const local = gates.get(root)?.holder;
1304
+ if (local) return describeHolder(local);
1305
+ let owner;
1306
+ try {
1307
+ owner = await withSafeDirectory(root, ".agent-knowledge", false, readLockOwner);
1308
+ } catch {
1309
+ owner = void 0;
1310
+ }
1311
+ return owner ? describeHolder(owner) : "a writer that recorded no owner";
1312
+ }
1196
1313
  async function acquireDurableFileLock(target, options) {
1197
1314
  const stale = Math.max(5e3, options.staleMs ?? DEFAULT_STALE_MS);
1198
1315
  const update = Math.max(1e3, Math.floor(stale / 3));
@@ -1264,9 +1381,9 @@ async function writeMutationEpoch(cacheDir, epoch) {
1264
1381
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1265
1382
  });
1266
1383
  }
1267
- async function waitForActiveMutationEpoch(root, epoch, options) {
1384
+ async function waitForActiveMutationEpoch(root, epoch, options, pauseMs) {
1268
1385
  if (!await hasActiveMutationLock(root, options)) await healAbandonedMutationEpoch(root, epoch, options);
1269
- await new Promise((resolve) => setTimeout(resolve, options.waitMs ?? DEFAULT_READ_WAIT_MS));
1386
+ await sleep(pauseMs);
1270
1387
  }
1271
1388
  async function healAbandonedMutationEpoch(root, expectedEpoch, options) {
1272
1389
  await withSafeDirectory(root, ".agent-knowledge", false, async (cacheDir) => {
@@ -3833,25 +3950,36 @@ function extractSourceRefs(text) {
3833
3950
  //#endregion
3834
3951
  //#region src/validate.ts
3835
3952
  function validateKnowledgeIndex(index, options = {}) {
3836
- const findings = [...lintKnowledgeIndex(index)];
3953
+ return prepareKnowledgeValidation(index).validate(options);
3954
+ }
3955
+ /** One observation's lint/schema findings; strictness is a caller-owned policy. */
3956
+ function prepareKnowledgeValidation(index) {
3957
+ const lintFindings = lintKnowledgeIndex(index);
3958
+ const findings = [...lintFindings];
3837
3959
  const parsed = KnowledgeIndexSchema.safeParse(index);
3838
3960
  if (!parsed.success) findings.push({
3839
3961
  type: "missing-frontmatter",
3840
3962
  severity: "error",
3841
3963
  message: parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")
3842
3964
  });
3843
- if (options.strict) for (const page of index.pages) {
3844
- if (isScaffoldPath(page.path)) continue;
3845
- if (!page.frontmatter.id || !page.frontmatter.title) findings.push({
3846
- type: "missing-frontmatter",
3847
- severity: "error",
3848
- page: page.path,
3849
- message: "Strict mode requires id and title frontmatter."
3850
- });
3851
- }
3852
3965
  return {
3853
- ok: !findings.some((finding) => finding.severity === "error"),
3854
- findings
3966
+ lintFindings,
3967
+ validate(options = {}) {
3968
+ const result = [...findings];
3969
+ if (options.strict) for (const page of index.pages) {
3970
+ if (isScaffoldPath(page.path)) continue;
3971
+ if (!page.frontmatter.id || !page.frontmatter.title) result.push({
3972
+ type: "missing-frontmatter",
3973
+ severity: "error",
3974
+ page: page.path,
3975
+ message: "Strict mode requires id and title frontmatter."
3976
+ });
3977
+ }
3978
+ return {
3979
+ ok: !result.some((finding) => finding.severity === "error"),
3980
+ findings: result
3981
+ };
3982
+ }
3855
3983
  };
3856
3984
  }
3857
3985
  //#endregion
@@ -4877,6 +5005,6 @@ function explainKnowledgeTarget(index, target) {
4877
5005
  };
4878
5006
  }
4879
5007
  //#endregion
4880
- export { snapshotSourceTextInput as $, ClaimLedgerGoalConflictError as $t, validateKnowledgePage as A, prepareKnowledgeFileTransaction as An, knowledgePageFromMarkdown as At, DEADLINE_EXIT_CODE as B, readRegularFileWithinRoot as Bn, KnowledgeGraphEdgeSchema as Bt, immutablePageDigest as C, withKnowledgeMutation as Cn, resolveKnowledgeCitations as Ct, normalizeVisibilityArtifact as D, commitKnowledgeFileMutations as Dn, initKnowledgeBase as Dt, nonEmpty as E, assertKnowledgeMutationPath as En, SCAFFOLD_PAGE_BASENAMES as Et, detectNearDuplicatePages as F, canonicalRelativeWithinRoot as Fn, extractWikilinks as Ft, gradeFor as G, withSafeDescendant as Gn, KnowledgeRelationSchema as Gt, assertGradeableEvidence as H, removeDurable as Hn, KnowledgeIndexSchema as Ht, normalizePageText as I, isKernelAnchoredPath as In, normalizeLinkTarget as It, buildKnowledgeIndex as J, writeFileDurableWithinRoot as Jn, ResearchClaimRecordSchema as Jt, verdictFor as K, withSafeDirectory as Kn, ResearchClaimEvidenceSchema as Kt, validateKnowledgeIndex as L, isMissingFile as Ln, DeepQuestionSchema as Lt, verifyKnowledgeVisibilitySnapshot as M, DEFAULT_PAGES_DIRECTORY as Mn, loadKnowledgePages as Mt, visibilityIdentity as N, normalizePagesDirectory as Nn, writeJson as Nt, normalizeVisibilityRef as O, finishKnowledgeFileTransaction as On, isKnowledgePagePath as Ot, visibilityIndexOf as P, canonicalPathsEqual as Pn, WIKILINK_REGEX as Pt, loadSourceRegistry as Q, textSourceAdapter as Qn, KNOWLEDGE_EVENT_TYPES as Qt, lintKnowledgeIndex as R, listRegularFilesWithinRoot as Rn, KnowledgeBaseCandidateSchema as Rt, encodeKnowledgeVisibilitySnapshot as S, runInKnowledgeMutationScope as Sn, resolveKnowledgeCitation as St, knowledgeVisibilityArtifactRef as T, applyKnowledgeFileTransaction as Tn, resolveRunScopedCitations as Tt, claimCheckKey as U, renameDurable as Un, KnowledgePageInvalidationSchema as Ut, UncheckableClaimError as V, relativeWithinRoot as Vn, KnowledgeGraphNodeSchema as Vt, gradeClaims as W, syncDirectory as Wn, KnowledgePageSchema as Wt, addSourcePath as X, writeJsonDurableWithinRoot as Xn, SourceAnchorSchema as Xt, writeKnowledgeIndex as Y, writeJsonDurable as Yn, ResearchSourceVersionSchema as Yt, addSourceText as Z, mediaTypeFor$1 as Zn, SourceRecordSchema as Zt, KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION as _, acquireDurableFileLock as _n, assertRunScopedCitationsResolved as _t, applyKnowledgeWriteBlocksFile as a, claimId as an, KB_EVENTS_PATH as at, decodeKnowledgeVisibilitySnapshot as b, measureKnowledgeMutation as bn, formatKnowledgeCitationReference as bt, KnowledgeDuplicateIntakeError as c, emptyClaimLedger as cn, MemoryKbStore as ct, createFileRunLineageAuthority as d, mergeClaimLedgers as dn, knowledgePageRelations as dt, assertDeepQuestionIntegrity as en, sourceRegistryPath as et, createRunScopedStores as f, mergeTrackedClaims as fn, KnowledgeCitationAuditError as ft, KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM as g, parseFrontmatter as gn, assertKnowledgeCitationsResolved as gt, originatedPages as h, formatFrontmatter as hn, assertKnowledgeCitationAudit as ht, applyKnowledgeWriteBlocks as i, claimEvidenceId as in, KB_CLAIM_LEDGER_DIR as it, validateOrigin as j, rollbackKnowledgeFileTransaction as jn, layoutFor as jt, snapshotImmutableVisibility as k, knowledgeFileTransactionPlanHash as kn, isScaffoldPath as kt, assertKnowledgeWriteIntake as l, linkClaimContradictions as ln, assertClaimLedgerId as lt, loadKnowledgeToolChain as m, researchSourceVersionKey as mn, assertCurrentRunCitationsResolved as mt, inspectKnowledgeIndex as n, assertResearchClaimLedgerIntegrity as nn, ClaimLedgerMigrationRequiredError as nt, isSafeKnowledgePath as o, claimSourceHost as on, KB_INDEX_PATH as ot, isKnowledgeToolChain as p, normalizeClaimText as pn, KnowledgeCitationResolutionError as pt, verifyGradeableEvidence as q, writeFileDurable as qn, ResearchClaimLedgerSchema as qt, stringMetadata as r, assertTrackedClaimIntegrity as rn, FileSystemKbStore as rt, parseKnowledgeWriteBlocks as s, deepQuestionId as sn, KB_STORE_DIR as st, explainKnowledgeTarget as t, assertResearchClaimEvidenceIntegrity as tn, writeSourceRegistry as tt, RUN_LINEAGE_BASENAME as u, materializeRegisteredClaimEvidence as un, buildKnowledgeGraph as ut, assertSchemaVersion as v, inspectPendingKnowledgeMutation as vn, auditCurrentRunCitations as vt, knowledgePageDigest as w, withKnowledgeRead as wn, resolveRunScopedCitation as wt, digest as x, recoverPendingKnowledgeMutation as xn, parseKnowledgeCitationReference as xt, createKnowledgeVisibilitySnapshot as y, isKnowledgeMutationHeld as yn, auditKnowledgeCitations as yt, CHECKABLE_RUNG_THRESHOLD as z, readRegularFileNoFollow as zn, KnowledgeEventSchema as zt };
5008
+ export { loadSourceRegistry as $, mediaTypeFor$1 as $n, KNOWLEDGE_EVENT_TYPES as $t, validateKnowledgePage as A, finishKnowledgeFileTransaction as An, isScaffoldPath as At, CHECKABLE_RUNG_THRESHOLD as B, listRegularFilesWithinRoot as Bn, KnowledgeEventSchema as Bt, immutablePageDigest as C, runInKnowledgeMutationScope as Cn, resolveKnowledgeCitation as Ct, normalizeVisibilityArtifact as D, applyKnowledgeFileTransaction as Dn, SCAFFOLD_PAGE_BASENAMES as Dt, nonEmpty as E, withKnowledgeRead as En, resolveRunScopedCitations as Et, detectNearDuplicatePages as F, normalizePagesDirectory as Fn, WIKILINK_REGEX as Ft, gradeClaims as G, renameDurable as Gn, KnowledgePageSchema as Gt, UncheckableClaimError as H, readRegularFileWithinRoot as Hn, KnowledgeGraphNodeSchema as Ht, normalizePageText as I, canonicalPathsEqual as In, extractWikilinks as It, verifyGradeableEvidence as J, withSafeDirectory as Jn, ResearchClaimLedgerSchema as Jt, gradeFor as K, syncDirectory as Kn, KnowledgeRelationSchema as Kt, prepareKnowledgeValidation as L, canonicalRelativeWithinRoot as Ln, normalizeLinkTarget as Lt, verifyKnowledgeVisibilitySnapshot as M, prepareKnowledgeFileTransaction as Mn, layoutFor as Mt, visibilityIdentity as N, rollbackKnowledgeFileTransaction as Nn, loadKnowledgePages as Nt, normalizeVisibilityRef as O, assertKnowledgeMutationPath as On, initKnowledgeBase as Ot, visibilityIndexOf as P, DEFAULT_PAGES_DIRECTORY as Pn, writeJson as Pt, addSourceText as Q, writeJsonDurableWithinRoot as Qn, SourceRecordSchema as Qt, validateKnowledgeIndex as R, isKernelAnchoredPath as Rn, DeepQuestionSchema as Rt, encodeKnowledgeVisibilitySnapshot as S, recoverPendingKnowledgeMutation as Sn, parseKnowledgeCitationReference as St, knowledgeVisibilityArtifactRef as T, withKnowledgeMutationLabel as Tn, resolveRunScopedCitation as Tt, assertGradeableEvidence as U, relativeWithinRoot as Un, KnowledgeIndexSchema as Ut, DEADLINE_EXIT_CODE as V, readRegularFileNoFollow as Vn, KnowledgeGraphEdgeSchema as Vt, claimCheckKey as W, removeDurable as Wn, KnowledgePageInvalidationSchema as Wt, writeKnowledgeIndex as X, writeFileDurableWithinRoot as Xn, ResearchSourceVersionSchema as Xt, buildKnowledgeIndex as Y, writeFileDurable as Yn, ResearchClaimRecordSchema as Yt, addSourcePath as Z, writeJsonDurable as Zn, SourceAnchorSchema as Zt, KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION as _, parseFrontmatter as _n, assertKnowledgeCitationsResolved as _t, applyKnowledgeWriteBlocksFile as a, claimEvidenceId as an, KB_CLAIM_LEDGER_DIR as at, decodeKnowledgeVisibilitySnapshot as b, isKnowledgeMutationHeld as bn, auditKnowledgeCitations as bt, KnowledgeDuplicateIntakeError as c, deepQuestionId as cn, KB_STORE_DIR as ct, createFileRunLineageAuthority as d, materializeRegisteredClaimEvidence as dn, buildKnowledgeGraph as dt, ClaimLedgerGoalConflictError as en, textSourceAdapter as er, snapshotSourceTextInput as et, createRunScopedStores as f, mergeClaimLedgers as fn, knowledgePageRelations as ft, KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM as g, formatFrontmatter as gn, assertKnowledgeCitationAudit as gt, originatedPages as h, researchSourceVersionKey as hn, assertCurrentRunCitationsResolved as ht, applyKnowledgeWriteBlocks as i, assertTrackedClaimIntegrity as in, FileSystemKbStore as it, validateOrigin as j, knowledgeFileTransactionPlanHash as jn, knowledgePageFromMarkdown as jt, snapshotImmutableVisibility as k, commitKnowledgeFileMutations as kn, isKnowledgePagePath as kt, assertKnowledgeWriteIntake as l, emptyClaimLedger as ln, MemoryKbStore as lt, loadKnowledgeToolChain as m, normalizeClaimText as mn, KnowledgeCitationResolutionError as mt, inspectKnowledgeIndex as n, assertResearchClaimEvidenceIntegrity as nn, writeSourceRegistry as nt, isSafeKnowledgePath as o, claimId as on, KB_EVENTS_PATH as ot, isKnowledgeToolChain as p, mergeTrackedClaims as pn, KnowledgeCitationAuditError as pt, verdictFor as q, withSafeDescendant as qn, ResearchClaimEvidenceSchema as qt, stringMetadata as r, assertResearchClaimLedgerIntegrity as rn, ClaimLedgerMigrationRequiredError as rt, parseKnowledgeWriteBlocks as s, claimSourceHost as sn, KB_INDEX_PATH as st, explainKnowledgeTarget as t, assertDeepQuestionIntegrity as tn, sourceRegistryPath as tt, RUN_LINEAGE_BASENAME as u, linkClaimContradictions as un, assertClaimLedgerId as ut, assertSchemaVersion as v, acquireDurableFileLock as vn, assertRunScopedCitationsResolved as vt, knowledgePageDigest as w, withKnowledgeMutation as wn, resolveKnowledgeCitations as wt, digest as x, measureKnowledgeMutation as xn, formatKnowledgeCitationReference as xt, createKnowledgeVisibilitySnapshot as y, inspectPendingKnowledgeMutation as yn, auditCurrentRunCitations as yt, lintKnowledgeIndex as z, isMissingFile as zn, KnowledgeBaseCandidateSchema as zt };
4881
5009
 
4882
- //# sourceMappingURL=inspect-B1VI49Y9.js.map
5010
+ //# sourceMappingURL=inspect-rnlXAb4O.js.map