@tangle-network/agent-knowledge 17.1.10 → 19.0.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.
@@ -3,6 +3,7 @@ import { r as searchKnowledge } from "./search-Cbyj2shJ.js";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm } from "node:fs/promises";
5
5
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
6
+ import { canonicalCandidateBytes, canonicalCandidateDigest, sha256Bytes, sha256DigestSchema } from "@tangle-network/agent-interface";
6
7
  import { contentHash } from "@tangle-network/agent-eval";
7
8
  import { z } from "zod";
8
9
  import { constants } from "node:fs";
@@ -197,7 +198,8 @@ async function openSafeDirectoryTree(root, relativePath, create) {
197
198
  let currentHandle = await openDirectory(resolvedRoot);
198
199
  try {
199
200
  for (const part of normalized.split("/").filter(Boolean)) {
200
- const childPath = resolve(anchoredDirectoryPath(currentHandle, currentPath), part);
201
+ const anchoredParent = anchoredDirectoryPath(currentHandle, currentPath);
202
+ const childPath = resolve(anchoredParent, part);
201
203
  let childHandle;
202
204
  try {
203
205
  childHandle = await openDirectory(childPath);
@@ -234,7 +236,8 @@ async function openDirectory(path) {
234
236
  const entry = await lstat(path);
235
237
  if (entry.isSymbolicLink() || !entry.isDirectory()) throw new Error(`knowledge path has an unsafe directory: ${path}`);
236
238
  }
237
- const handle = await open(path, isKernelDescriptor ? constants.O_RDONLY | constants.O_DIRECTORY : DIRECTORY_FLAGS);
239
+ const flags = isKernelDescriptor ? constants.O_RDONLY | constants.O_DIRECTORY : DIRECTORY_FLAGS;
240
+ const handle = await open(path, flags);
238
241
  if (!(await handle.stat()).isDirectory()) {
239
242
  await handle.close();
240
243
  throw new Error(`knowledge path has an unsafe directory: ${path}`);
@@ -398,6 +401,8 @@ const transactionSchema = z.object({
398
401
  transactionId: z.string().uuid(),
399
402
  purpose: z.string().min(1),
400
403
  recoveryOwner: z.string().min(1).max(256).optional(),
404
+ actorId: z.string().trim().min(1).max(256).nullable().optional(),
405
+ runId: z.string().trim().min(1).max(256).nullable().optional(),
401
406
  pagesDirectory: pagesDirectorySchema.optional(),
402
407
  researchState: z.boolean().optional(),
403
408
  retainHistory: z.boolean().optional(),
@@ -427,6 +432,10 @@ async function prepareKnowledgeFileTransaction(input) {
427
432
  if (mutation.content === null && mutation.mode !== void 0) throw new Error(`deleted knowledge file cannot declare a mode: ${path}`);
428
433
  paths.add(path);
429
434
  const before = await withSafeDescendant(input.root, path, readRegularFile);
435
+ if (mutation.expectedBeforeHash !== void 0) {
436
+ const expected = digestSchema.nullable().parse(mutation.expectedBeforeHash);
437
+ if ((before ? hashBytes(before.bytes) : null) !== expected) throw new Error(`knowledge file changed before transaction: ${path}`);
438
+ }
430
439
  const after = mutation.content === null ? null : Buffer.isBuffer(mutation.content) ? mutation.content : Buffer.from(mutation.content, "utf8");
431
440
  const afterMode = after ? fileModeSchema.parse(mutation.mode ?? before?.mode ?? DEFAULT_FILE_MODE) : void 0;
432
441
  if (!input.includeUnchanged && sameBytes(before?.bytes ?? null, after) && before?.mode === afterMode) return null;
@@ -455,6 +464,8 @@ async function prepareKnowledgeFileTransaction(input) {
455
464
  kind: "knowledge-file-transaction",
456
465
  transactionId: randomUUID(),
457
466
  purpose: input.purpose,
467
+ actorId: input.actorId ?? null,
468
+ runId: input.runId ?? null,
458
469
  ...input.recoveryOwner ? { recoveryOwner: input.recoveryOwner } : {},
459
470
  ...pagesDirectory === void 0 ? {} : { pagesDirectory },
460
471
  ...input.researchState === void 0 ? {} : { researchState: input.researchState },
@@ -492,6 +503,8 @@ async function commitKnowledgeFileMutations(input) {
492
503
  root: input.root,
493
504
  transactionRoot: input.transactionRoot,
494
505
  purpose: input.purpose,
506
+ actorId: input.actorId,
507
+ runId: input.runId,
495
508
  mutations: input.mutations,
496
509
  ...input.researchState === void 0 ? {} : { researchState: input.researchState },
497
510
  ...input.retainHistory === void 0 ? {} : { retainHistory: input.retainHistory },
@@ -812,7 +825,7 @@ function fileMatches(file, hash, mode) {
812
825
  }
813
826
  //#endregion
814
827
  //#region src/mutation-lock.ts
815
- const DEFAULT_STALE_MS = 900 * 1e3;
828
+ const DEFAULT_STALE_MS = 9e5;
816
829
  const DEFAULT_READ_RETRIES = 100;
817
830
  const DEFAULT_READ_WAIT_MS = 25;
818
831
  let lockfileModule;
@@ -3207,7 +3220,7 @@ async function runCheckProcess(args, options) {
3207
3220
  env: options.env ?? {},
3208
3221
  envMode: "replace",
3209
3222
  timeoutMs: options.timeoutMs ?? 3e4,
3210
- maxOutputBytes: options.maxBufferBytes ?? 1024 * 1024,
3223
+ maxOutputBytes: options.maxBufferBytes ?? 1048576,
3211
3224
  signal: options.signal
3212
3225
  });
3213
3226
  return {
@@ -3620,6 +3633,212 @@ function round(value) {
3620
3633
  return Math.round(value * 1e6) / 1e6;
3621
3634
  }
3622
3635
  //#endregion
3636
+ //#region src/knowledge-visibility.ts
3637
+ const KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION = "2.0.0";
3638
+ const KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM = "rfc8785-sha256";
3639
+ /** Stable content identity for one exact knowledge page. */
3640
+ function knowledgePageDigest(page) {
3641
+ validateKnowledgePage(page);
3642
+ return canonicalCandidateDigest({
3643
+ id: page.id,
3644
+ path: page.path,
3645
+ title: page.title,
3646
+ text: page.text,
3647
+ frontmatter: page.frontmatter,
3648
+ sourceIds: [...page.sourceIds],
3649
+ tags: [...page.tags],
3650
+ outLinks: [...page.outLinks],
3651
+ contradicts: [...page.contradicts ?? []],
3652
+ invalidation: page.invalidation ?? null
3653
+ });
3654
+ }
3655
+ /** Snapshot the exact ordered current/ancestor/shared page view. */
3656
+ function createKnowledgeVisibilitySnapshot(visiblePages) {
3657
+ if (!Array.isArray(visiblePages)) throw new TypeError("knowledge visibility must be an array");
3658
+ const identities = /* @__PURE__ */ new Set();
3659
+ const entries = visiblePages.map((entry, position) => {
3660
+ if (!entry || typeof entry !== "object") throw new TypeError(`knowledge visibility[${position}] must be an originated page`);
3661
+ const origin = validateOrigin(entry.origin, `knowledge visibility[${position}].origin`);
3662
+ validateKnowledgePage(entry.page);
3663
+ const identity = visibilityIdentity(origin, entry.page.path);
3664
+ if (identities.has(identity)) throw new Error(`knowledge visibility repeats path '${entry.page.path}' at origin '${origin}'`);
3665
+ identities.add(identity);
3666
+ return Object.freeze({
3667
+ position,
3668
+ pageId: entry.page.id,
3669
+ origin,
3670
+ path: entry.page.path,
3671
+ pageDigest: knowledgePageDigest(entry.page),
3672
+ sourceIds: Object.freeze([...entry.page.sourceIds]),
3673
+ invalidated: entry.page.invalidation !== void 0
3674
+ });
3675
+ });
3676
+ const material = visibilityMaterial(entries);
3677
+ const snapshot = Object.freeze({
3678
+ ...material,
3679
+ snapshotDigest: canonicalCandidateDigest(material),
3680
+ entries: Object.freeze(entries)
3681
+ });
3682
+ visibilityIndexes.set(snapshot, indexVisibility(snapshot));
3683
+ return snapshot;
3684
+ }
3685
+ /**
3686
+ * Verify a snapshot's schema and canonical digest. The check runs once per
3687
+ * snapshot object; later calls with the same object are free.
3688
+ */
3689
+ function verifyKnowledgeVisibilitySnapshot(snapshot) {
3690
+ return visibilityIndexOf(snapshot).snapshot;
3691
+ }
3692
+ /** Canonical bytes of a verified snapshot, for durable storage. */
3693
+ function encodeKnowledgeVisibilitySnapshot(snapshot) {
3694
+ const verified = verifyKnowledgeVisibilitySnapshot(snapshot);
3695
+ return canonicalCandidateBytes({
3696
+ schemaVersion: verified.schemaVersion,
3697
+ digestAlgorithm: verified.digestAlgorithm,
3698
+ snapshotDigest: verified.snapshotDigest,
3699
+ entries: visibilityMaterial(verified.entries).entries
3700
+ });
3701
+ }
3702
+ /** Parse stored snapshot bytes and verify their schema and digest. */
3703
+ function decodeKnowledgeVisibilitySnapshot(bytes) {
3704
+ if (!(bytes instanceof Uint8Array)) throw new TypeError("knowledge visibility snapshot bytes must be a Uint8Array");
3705
+ let parsed;
3706
+ try {
3707
+ parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
3708
+ } catch (error) {
3709
+ throw new Error(`knowledge visibility snapshot bytes are not JSON: ${error instanceof Error ? error.message : String(error)}`);
3710
+ }
3711
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new TypeError("knowledge visibility snapshot must be an object");
3712
+ const candidate = parsed;
3713
+ if (!Array.isArray(candidate.entries)) throw new TypeError("knowledge visibility snapshot entries must be an array");
3714
+ return verifyKnowledgeVisibilitySnapshot(Object.freeze({
3715
+ schemaVersion: candidate.schemaVersion,
3716
+ digestAlgorithm: candidate.digestAlgorithm,
3717
+ snapshotDigest: digest(candidate.snapshotDigest, "knowledge visibility snapshotDigest"),
3718
+ entries: Object.freeze(candidate.entries.map((entry, position) => {
3719
+ if (!entry || typeof entry !== "object") throw new TypeError(`knowledge visibility[${position}] must be an object`);
3720
+ const value = entry;
3721
+ if (!Array.isArray(value.sourceIds)) throw new TypeError(`knowledge visibility[${position}].sourceIds must be an array`);
3722
+ return Object.freeze({
3723
+ position: value.position,
3724
+ pageId: value.pageId,
3725
+ origin: value.origin,
3726
+ path: value.path,
3727
+ pageDigest: value.pageDigest,
3728
+ sourceIds: Object.freeze([...value.sourceIds]),
3729
+ invalidated: value.invalidated
3730
+ });
3731
+ }))
3732
+ }));
3733
+ }
3734
+ /** Locator for snapshot bytes stored at `uri`. */
3735
+ function knowledgeVisibilityArtifactRef(input) {
3736
+ if (!input || typeof input !== "object" || !(input.bytes instanceof Uint8Array)) throw new TypeError("knowledge visibility artifact bytes must be a Uint8Array");
3737
+ if (input.bytes.byteLength === 0) throw new TypeError("knowledge visibility artifact bytes must not be empty");
3738
+ return Object.freeze({
3739
+ uri: nonEmpty(input.uri, "knowledge visibility artifact uri"),
3740
+ digest: sha256Bytes(input.bytes),
3741
+ byteLength: input.bytes.byteLength
3742
+ });
3743
+ }
3744
+ const visibilityIndexes = /* @__PURE__ */ new WeakMap();
3745
+ function visibilityIndexOf(snapshot) {
3746
+ if (!snapshot || typeof snapshot !== "object") throw new TypeError("knowledge visibility snapshot is required");
3747
+ const cached = visibilityIndexes.get(snapshot);
3748
+ if (cached !== void 0) return cached;
3749
+ assertSchemaVersion(snapshot.schemaVersion, "knowledge visibility");
3750
+ if (snapshot.digestAlgorithm !== "rfc8785-sha256") throw new Error(`unsupported knowledge visibility digestAlgorithm '${snapshot.digestAlgorithm}'`);
3751
+ if (!Array.isArray(snapshot.entries)) throw new TypeError("knowledge visibility snapshot entries must be an array");
3752
+ if (canonicalCandidateDigest(visibilityMaterial(snapshot.entries)) !== digest(snapshot.snapshotDigest, "knowledge visibility snapshotDigest")) throw new Error("knowledge visibility snapshot digest mismatch");
3753
+ const index = indexVisibility(snapshot);
3754
+ visibilityIndexes.set(snapshot, index);
3755
+ return index;
3756
+ }
3757
+ function indexVisibility(snapshot) {
3758
+ const byIdentity = /* @__PURE__ */ new Map();
3759
+ for (const entry of snapshot.entries) {
3760
+ const identity = visibilityIdentity(entry.origin, entry.path);
3761
+ if (byIdentity.has(identity)) throw new Error(`knowledge visibility repeats path '${entry.path}' at origin '${entry.origin}'`);
3762
+ byIdentity.set(identity, entry);
3763
+ }
3764
+ return {
3765
+ snapshot,
3766
+ byIdentity
3767
+ };
3768
+ }
3769
+ function visibilityIdentity(origin, path) {
3770
+ return `${origin}\u0000${path}`;
3771
+ }
3772
+ function assertSchemaVersion(value, label) {
3773
+ if (value === "2.0.0") return;
3774
+ throw new Error(`unsupported ${label} schemaVersion '${String(value)}'${value === "1.0.0" ? "; 1.0.0 records embed the visibility snapshot and have no reader, create a 2.0.0 record from the snapshot" : ""}`);
3775
+ }
3776
+ function visibilityMaterial(entries) {
3777
+ return {
3778
+ schemaVersion: KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION,
3779
+ digestAlgorithm: KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM,
3780
+ entries: entries.map((entry, position) => {
3781
+ if (!entry || typeof entry !== "object") throw new TypeError(`knowledge visibility[${position}] must be an object`);
3782
+ if (entry.position !== position) throw new Error(`knowledge visibility position mismatch: expected ${position}, observed ${entry.position}`);
3783
+ if (!Array.isArray(entry.sourceIds)) throw new TypeError(`knowledge visibility[${position}].sourceIds must be an array`);
3784
+ return {
3785
+ position,
3786
+ pageId: nonEmpty(entry.pageId, `knowledge visibility[${position}].pageId`),
3787
+ origin: validateOrigin(entry.origin, `knowledge visibility[${position}].origin`),
3788
+ path: nonEmpty(entry.path, `knowledge visibility[${position}].path`),
3789
+ pageDigest: digest(entry.pageDigest, `knowledge visibility[${position}].pageDigest`),
3790
+ sourceIds: entry.sourceIds.map((sourceId, sourceIndex) => nonEmpty(sourceId, `knowledge visibility[${position}].sourceIds[${sourceIndex}]`)),
3791
+ invalidated: Boolean(entry.invalidated)
3792
+ };
3793
+ })
3794
+ };
3795
+ }
3796
+ function normalizeVisibilityRef(input) {
3797
+ if (!input || typeof input !== "object") throw new TypeError("knowledge retrieval visibility reference is required");
3798
+ if (!Number.isSafeInteger(input.pageCount) || input.pageCount < 0) throw new TypeError("knowledge retrieval visibility pageCount must be a non-negative integer");
3799
+ return Object.freeze({
3800
+ snapshotDigest: digest(input.snapshotDigest, "knowledge retrieval visibility snapshotDigest"),
3801
+ pageCount: input.pageCount,
3802
+ ...input.artifact === void 0 ? {} : { artifact: normalizeVisibilityArtifact(input.artifact, "knowledge retrieval visibility artifact") }
3803
+ });
3804
+ }
3805
+ function normalizeVisibilityArtifact(input, label) {
3806
+ if (!input || typeof input !== "object") throw new TypeError(`${label} must be an object`);
3807
+ if (!Number.isSafeInteger(input.byteLength) || input.byteLength < 1) throw new TypeError(`${label} byteLength must be a positive integer`);
3808
+ return Object.freeze({
3809
+ uri: nonEmpty(input.uri, `${label} uri`),
3810
+ digest: digest(input.digest, `${label} digest`),
3811
+ byteLength: input.byteLength
3812
+ });
3813
+ }
3814
+ function validateKnowledgePage(page) {
3815
+ if (!page || typeof page !== "object") throw new TypeError("knowledge page must be an object");
3816
+ nonEmpty(page.id, "knowledge page id");
3817
+ nonEmpty(page.path, "knowledge page path");
3818
+ nonEmpty(page.title, "knowledge page title");
3819
+ if (typeof page.text !== "string") throw new TypeError("knowledge page text must be a string");
3820
+ if (!page.frontmatter || typeof page.frontmatter !== "object" || Array.isArray(page.frontmatter)) throw new TypeError("knowledge page frontmatter must be an object");
3821
+ for (const [name, values] of [
3822
+ ["sourceIds", page.sourceIds],
3823
+ ["tags", page.tags],
3824
+ ["outLinks", page.outLinks]
3825
+ ]) if (!Array.isArray(values) || values.some((value) => typeof value !== "string")) throw new TypeError(`knowledge page ${name} must be a string array`);
3826
+ }
3827
+ function validateOrigin(value, label) {
3828
+ if (value === "here" || value === "shared") return value;
3829
+ if (typeof value === "string" && value.startsWith("inherited:") && value.slice(10).trim().length > 0) return value;
3830
+ throw new TypeError(`${label} is invalid: ${String(value)}`);
3831
+ }
3832
+ function digest(value, label) {
3833
+ const parsed = sha256DigestSchema.safeParse(value);
3834
+ if (!parsed.success) throw new TypeError(`${label} must be a lowercase sha256 digest`);
3835
+ return parsed.data;
3836
+ }
3837
+ function nonEmpty(value, label) {
3838
+ if (typeof value !== "string" || value.trim().length === 0) throw new TypeError(`${label} must be a non-empty string`);
3839
+ return value.trim();
3840
+ }
3841
+ //#endregion
3623
3842
  //#region src/run-scoped.ts
3624
3843
  /**
3625
3844
  * Run-scoped knowledge stores with lineage-chain reads.
@@ -3959,7 +4178,13 @@ function parseKnowledgeWriteBlocks(text, allowedPrefixes = ["knowledge/"]) {
3959
4178
  async function applyKnowledgeWriteBlocks(root, proposalText, options = {}) {
3960
4179
  const pagesDirectory = normalizePagesDirectory(options.pagesDirectory);
3961
4180
  const parsed = parseKnowledgeWriteBlocks(proposalText, [`${pagesDirectory}/`]);
3962
- const purpose = `knowledge-proposal:${contentHash(parsed.blocks)}`;
4181
+ const identity = options.actorId === void 0 && options.runId === void 0 && options.expectedPageDigests === void 0 ? parsed.blocks : {
4182
+ blocks: parsed.blocks,
4183
+ actorId: options.actorId ?? null,
4184
+ runId: options.runId ?? null,
4185
+ expectedPageDigests: options.expectedPageDigests ?? null
4186
+ };
4187
+ const purpose = "knowledge-proposal:" + contentHash(identity);
3963
4188
  const intake = options.intake;
3964
4189
  return withKnowledgeMutation(root, async (lock) => {
3965
4190
  if (parsed.blocks.length > 0) {
@@ -3967,6 +4192,23 @@ async function applyKnowledgeWriteBlocks(root, proposalText, options = {}) {
3967
4192
  path: block.path,
3968
4193
  content: block.content.endsWith("\n") ? block.content : `${block.content}\n`
3969
4194
  }));
4195
+ if (options.expectedPageDigests !== void 0) {
4196
+ const paths = new Set(mutations.map((mutation) => mutation.path));
4197
+ for (const path of Object.keys(options.expectedPageDigests)) if (!paths.has(path)) throw new Error(`Expected digest has no proposed page: ${path}`);
4198
+ for (const mutation of mutations) {
4199
+ let before;
4200
+ try {
4201
+ before = await readRegularFileWithinRoot(root, mutation.path);
4202
+ } catch (error) {
4203
+ if (!isMissingFile(error)) throw error;
4204
+ }
4205
+ const current = before === void 0 ? null : knowledgePageDigest(knowledgePageFromMarkdown(mutation.path, Buffer.from(before.bytes).toString("utf8"), pagesDirectory));
4206
+ const expected = Object.hasOwn(options.expectedPageDigests, mutation.path) ? options.expectedPageDigests[mutation.path] : null;
4207
+ if (expected !== null && !/^sha256:[a-f0-9]{64}$/.test(expected ?? "")) throw new Error(`Invalid expected page digest: ${mutation.path}`);
4208
+ if (current !== expected && !(!(Object.hasOwn(options.expectedPageDigests, mutation.path) && expected === null) && before !== void 0 && Buffer.from(before.bytes).equals(Buffer.from(mutation.content ?? "")))) throw new Error(`knowledge page changed: ${mutation.path}; current digest: ${current ?? "absent"}. Read the current page before editing it.`);
4209
+ mutation.expectedBeforeHash = before === void 0 ? null : createHash("sha256").update(before.bytes).digest("hex");
4210
+ }
4211
+ }
3970
4212
  if (intake) {
3971
4213
  const { inheritedPages = [], ...settings } = intake;
3972
4214
  const here = await loadKnowledgePages(root, { pagesDirectory });
@@ -3979,6 +4221,8 @@ async function applyKnowledgeWriteBlocks(root, proposalText, options = {}) {
3979
4221
  root,
3980
4222
  transactionRoot: lock.transactionRoot,
3981
4223
  purpose,
4224
+ actorId: options.actorId,
4225
+ runId: options.runId,
3982
4226
  mutations,
3983
4227
  pagesDirectory,
3984
4228
  retainHistory: options.retainHistory,
@@ -4072,6 +4316,6 @@ function explainKnowledgeTarget(index, target) {
4072
4316
  };
4073
4317
  }
4074
4318
  //#endregion
4075
- export { formatKnowledgeCitationReference as $, inspectPendingKnowledgeMutation as $t, addSourceText as A, writeJsonDurableWithinRoot as An, ResearchSourceVersionSchema as At, KB_STORE_DIR as B, claimId as Bt, gradeClaims as C, renameDurable as Cn, KnowledgePageSchema as Ct, buildKnowledgeIndex as D, writeFileDurable as Dn, ResearchClaimEvidenceSchema as Dt, verifyGradeableEvidence as E, withSafeDirectory as En, KnowledgeRelationSchema as Et, ClaimLedgerMigrationRequiredError as F, assertDeepQuestionIntegrity as Ft, KnowledgeCitationAuditError as G, materializeRegisteredClaimEvidence as Gt, assertClaimLedgerId as H, deepQuestionId as Ht, FileSystemKbStore as I, assertResearchClaimEvidenceIntegrity as It, assertKnowledgeCitationAudit as J, normalizeClaimText as Jt, KnowledgeCitationResolutionError as K, mergeClaimLedgers as Kt, KB_CLAIM_LEDGER_DIR as L, assertResearchClaimLedgerIntegrity as Lt, snapshotSourceTextInput as M, textSourceAdapter as Mn, SourceRecordSchema as Mt, sourceRegistryPath as N, KNOWLEDGE_EVENT_TYPES as Nt, writeKnowledgeIndex as O, writeFileDurableWithinRoot as On, ResearchClaimLedgerSchema as Ot, writeSourceRegistry as P, ClaimLedgerGoalConflictError as Pt, auditKnowledgeCitations as Q, acquireDurableFileLock as Qt, KB_EVENTS_PATH as R, assertTrackedClaimIntegrity as Rt, claimCheckKey as S, removeDurable as Sn, KnowledgePageInvalidationSchema as St, verdictFor as T, withSafeDescendant as Tn, KnowledgeRelationNodeSchema as Tt, buildKnowledgeGraph as U, emptyClaimLedger as Ut, MemoryKbStore as V, claimSourceHost as Vt, knowledgePageRelations as W, linkClaimContradictions as Wt, assertRunScopedCitationsResolved as X, formatFrontmatter as Xt, assertKnowledgeCitationsResolved as Y, researchSourceVersionKey as Yt, auditCurrentRunCitations as Z, parseFrontmatter as Zt, lintKnowledgeIndex as _, isMissingFile as _n, KnowledgeBaseCandidateSchema as _t, applyKnowledgeWriteBlocksFile as a, applyKnowledgeFileTransaction as an, SCAFFOLD_PAGE_BASENAMES as at, UncheckableClaimError as b, readRegularFileWithinRoot as bn, KnowledgeGraphNodeSchema as bt, KnowledgeDuplicateIntakeError as c, finishKnowledgeFileTransaction as cn, isScaffoldPath as ct, createFileRunLineageAuthority as d, rollbackKnowledgeFileTransaction as dn, loadKnowledgePages as dt, isKnowledgeMutationHeld as en, parseKnowledgeCitationReference as et, createRunScopedStores as f, DEFAULT_PAGES_DIRECTORY as fn, writeJson as ft, validateKnowledgeIndex as g, isKernelAnchoredPath as gn, DeepQuestionSchema as gt, normalizePageText as h, canonicalRelativeWithinRoot as hn, normalizeLinkTarget as ht, applyKnowledgeWriteBlocks as i, withKnowledgeRead as in, resolveRunScopedCitations as it, loadSourceRegistry as j, mediaTypeFor$1 as jn, SourceAnchorSchema as jt, addSourcePath as k, writeJsonDurable as kn, ResearchClaimRecordSchema as kt, assertKnowledgeWriteIntake as l, knowledgeFileTransactionPlanHash as ln, knowledgePageFromMarkdown as lt, detectNearDuplicatePages as m, canonicalPathsEqual as mn, extractWikilinks as mt, inspectKnowledgeIndex as n, runInKnowledgeMutationScope as nn, resolveKnowledgeCitations as nt, isSafeKnowledgePath as o, assertKnowledgeMutationPath as on, initKnowledgeBase as ot, originatedPages as p, normalizePagesDirectory as pn, WIKILINK_REGEX as pt, assertCurrentRunCitationsResolved as q, mergeTrackedClaims as qt, stringMetadata as r, withKnowledgeMutation as rn, resolveRunScopedCitation as rt, parseKnowledgeWriteBlocks as s, commitKnowledgeFileMutations as sn, isKnowledgePagePath as st, explainKnowledgeTarget as t, recoverPendingKnowledgeMutation as tn, resolveKnowledgeCitation as tt, RUN_LINEAGE_BASENAME as u, prepareKnowledgeFileTransaction as un, layoutFor as ut, CHECKABLE_RUNG_THRESHOLD as v, listRegularFilesWithinRoot as vn, KnowledgeEventSchema as vt, gradeFor as w, syncDirectory as wn, KnowledgeRelationGraphSchema as wt, assertGradeableEvidence as x, relativeWithinRoot as xn, KnowledgeIndexSchema as xt, DEADLINE_EXIT_CODE as y, readRegularFileNoFollow as yn, KnowledgeGraphEdgeSchema as yt, KB_INDEX_PATH as z, claimEvidenceId as zt };
4319
+ export { FileSystemKbStore as $, assertResearchClaimEvidenceIntegrity as $t, visibilityIndexOf as A, normalizePagesDirectory as An, WIKILINK_REGEX as At, gradeClaims as B, renameDurable as Bn, KnowledgePageSchema as Bt, nonEmpty as C, assertKnowledgeMutationPath as Cn, initKnowledgeBase as Ct, validateOrigin as D, prepareKnowledgeFileTransaction as Dn, layoutFor as Dt, validateKnowledgePage as E, knowledgeFileTransactionPlanHash as En, knowledgePageFromMarkdown as Et, CHECKABLE_RUNG_THRESHOLD as F, listRegularFilesWithinRoot as Fn, KnowledgeEventSchema as Ft, writeKnowledgeIndex as G, writeFileDurableWithinRoot as Gn, ResearchClaimLedgerSchema as Gt, verdictFor as H, withSafeDescendant as Hn, KnowledgeRelationNodeSchema as Ht, DEADLINE_EXIT_CODE as I, readRegularFileNoFollow as In, KnowledgeGraphEdgeSchema as It, loadSourceRegistry as J, mediaTypeFor$1 as Jn, SourceAnchorSchema as Jt, addSourcePath as K, writeJsonDurable as Kn, ResearchClaimRecordSchema as Kt, UncheckableClaimError as L, readRegularFileWithinRoot as Ln, KnowledgeGraphNodeSchema as Lt, normalizePageText as M, canonicalRelativeWithinRoot as Mn, normalizeLinkTarget as Mt, validateKnowledgeIndex as N, isKernelAnchoredPath as Nn, DeepQuestionSchema as Nt, verifyKnowledgeVisibilitySnapshot as O, rollbackKnowledgeFileTransaction as On, loadKnowledgePages as Ot, lintKnowledgeIndex as P, isMissingFile as Pn, KnowledgeBaseCandidateSchema as Pt, ClaimLedgerMigrationRequiredError as Q, assertDeepQuestionIntegrity as Qt, assertGradeableEvidence as R, relativeWithinRoot as Rn, KnowledgeIndexSchema as Rt, knowledgeVisibilityArtifactRef as S, applyKnowledgeFileTransaction as Sn, SCAFFOLD_PAGE_BASENAMES as St, normalizeVisibilityRef as T, finishKnowledgeFileTransaction as Tn, isScaffoldPath as Tt, verifyGradeableEvidence as U, withSafeDirectory as Un, KnowledgeRelationSchema as Ut, gradeFor as V, syncDirectory as Vn, KnowledgeRelationGraphSchema as Vt, buildKnowledgeIndex as W, writeFileDurable as Wn, ResearchClaimEvidenceSchema as Wt, sourceRegistryPath as X, KNOWLEDGE_EVENT_TYPES as Xt, snapshotSourceTextInput as Y, textSourceAdapter as Yn, SourceRecordSchema as Yt, writeSourceRegistry as Z, ClaimLedgerGoalConflictError as Zt, createKnowledgeVisibilitySnapshot as _, isKnowledgeMutationHeld as _n, parseKnowledgeCitationReference as _t, applyKnowledgeWriteBlocksFile as a, deepQuestionId as an, assertClaimLedgerId as at, encodeKnowledgeVisibilitySnapshot as b, withKnowledgeMutation as bn, resolveRunScopedCitation as bt, KnowledgeDuplicateIntakeError as c, materializeRegisteredClaimEvidence as cn, KnowledgeCitationAuditError as ct, createFileRunLineageAuthority as d, normalizeClaimText as dn, assertKnowledgeCitationAudit as dt, assertResearchClaimLedgerIntegrity as en, KB_CLAIM_LEDGER_DIR as et, createRunScopedStores as f, researchSourceVersionKey as fn, assertKnowledgeCitationsResolved as ft, assertSchemaVersion as g, inspectPendingKnowledgeMutation as gn, formatKnowledgeCitationReference as gt, KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION as h, acquireDurableFileLock as hn, auditKnowledgeCitations as ht, applyKnowledgeWriteBlocks as i, claimSourceHost as in, MemoryKbStore as it, detectNearDuplicatePages as j, canonicalPathsEqual as jn, extractWikilinks as jt, visibilityIdentity as k, DEFAULT_PAGES_DIRECTORY as kn, writeJson as kt, assertKnowledgeWriteIntake as l, mergeClaimLedgers as ln, KnowledgeCitationResolutionError as lt, KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM as m, parseFrontmatter as mn, auditCurrentRunCitations as mt, inspectKnowledgeIndex as n, claimEvidenceId as nn, KB_INDEX_PATH as nt, isSafeKnowledgePath as o, emptyClaimLedger as on, buildKnowledgeGraph as ot, originatedPages as p, formatFrontmatter as pn, assertRunScopedCitationsResolved as pt, addSourceText as q, writeJsonDurableWithinRoot as qn, ResearchSourceVersionSchema as qt, stringMetadata as r, claimId as rn, KB_STORE_DIR as rt, parseKnowledgeWriteBlocks as s, linkClaimContradictions as sn, knowledgePageRelations as st, explainKnowledgeTarget as t, assertTrackedClaimIntegrity as tn, KB_EVENTS_PATH as tt, RUN_LINEAGE_BASENAME as u, mergeTrackedClaims as un, assertCurrentRunCitationsResolved as ut, decodeKnowledgeVisibilitySnapshot as v, recoverPendingKnowledgeMutation as vn, resolveKnowledgeCitation as vt, normalizeVisibilityArtifact as w, commitKnowledgeFileMutations as wn, isKnowledgePagePath as wt, knowledgePageDigest as x, withKnowledgeRead as xn, resolveRunScopedCitations as xt, digest as y, runInKnowledgeMutationScope as yn, resolveKnowledgeCitations as yt, claimCheckKey as z, removeDurable as zn, KnowledgePageInvalidationSchema as zt };
4076
4320
 
4077
- //# sourceMappingURL=inspect-DrJnvx5Z.js.map
4321
+ //# sourceMappingURL=inspect-C6YK7af7.js.map