@equationalapplications/core-llm-wiki 7.14.0 → 7.15.1

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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-DbrL569t.mjs';
2
- export { C as ChunkFailure, d as ClassifierAnswer, e as ClassifierQuestion, f as ClassifyRequest, g as ClassifyResponse, D as DegradedRecord, h as DraftPage, E as EmbedFactResult, i as EmbedFailureKind, j as EmbeddingMarkerKind, k as EntityMaintenanceReport, l as EntityStatus, m as ExtractedFact, n as ExtractedFactEdge, o as ExtractedFactWithOntology, p as ExtractedTask, q as GraphTraversalOptions, r as GroundingConfig, H as HEAL_BATCH_SIZE, s as HEAL_RECHECK_MS, t as HOOK_TIMEOUT_MARKER, u as HealResult, I as IngestDocumentResult, L as LLMProvider, v as LibrarianConfig, w as LibrarianGateConfig, x as MaintenanceJob, y as MaintenanceStopReason, z as MigrationPolicy, O as ONTOLOGY_BACKFILL_BATCH_SIZE, A as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, B as ONTOLOGY_BACKFILL_RECHECK_MS, J as OntologyBackfillResult, K as OntologyConfig, N as OntologyEdgeType, P as OntologyManifest, Q as OntologyMode, T as OntologyNodeType, U as OntologyPromptContext, V as OntologyUpdates, X as PendingMaintenance, Y as PendingMigrationWork, Z as PendingSourceStatus, _ as PromptOverrides, $ as PromptService, a0 as PrunePartialFailureError, a1 as ReembedResult, a2 as RunPendingMaintenanceOptions, a3 as RunPendingMaintenanceResult, a4 as SupersedeReplacement, a5 as VectorRanker, a6 as VectorRankerFallback, a7 as VectorRankerRankArgs, a8 as VectorRankerSemanticResult, a9 as WikiBusyError, aa as WikiBusyOperation, ab as WikiCheckpoint, ac as WikiConfig, ad as WikiDiagnostic, ae as WikiDiagnosticCode, af as WikiDiagnosticDetail, ag as WikiDiagnosticOperation, ah as WikiDiagnosticSeverity, ai as WikiDiagnosticTrigger, aj as WikiDraftNotFound, ak as WikiDuplicateHashError, al as WikiEdge, am as WikiEvent, an as WikiFact, ao as WikiGraphNodeOwnershipConflict, ap as WikiIngestEmptyError, aq as WikiInstructions, ar as WikiInvalidReadOptions, as as WikiLintReport, at as WikiMemoryTestAccess, au as WikiMigrationRequiredError, av as WikiOutboxEvent, aw as WikiParseError, ax as WikiSearchUnavailableError, ay as WikiSourceRefHashCollision, az as WikiStrictOntologyViolation, aA as WikiSupersedeError, aB as WikiSupersedeReason, aC as WikiTask, aD as WikiTransactionError, aE as isWikiSearchUnavailableError, aF as validateManifest } from './testing-DbrL569t.mjs';
1
+ import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BlGhilQw.mjs';
2
+ export { C as ChunkFailure, d as ClassifierAnswer, e as ClassifierQuestion, f as ClassifyRequest, g as ClassifyResponse, D as DegradedRecord, h as DraftPage, E as EmbedFactResult, i as EmbedFailureKind, j as EmbeddingMarkerKind, k as EntityMaintenanceReport, l as EntityStatus, m as ExtractedFact, n as ExtractedFactEdge, o as ExtractedFactWithOntology, p as ExtractedTask, q as GraphTraversalOptions, r as GroundingConfig, H as HEAL_BATCH_SIZE, s as HEAL_RECHECK_MS, t as HOOK_TIMEOUT_MARKER, u as HealResult, I as IngestDocumentResult, L as LLMProvider, v as LibrarianConfig, w as LibrarianGateConfig, x as MaintenanceJob, y as MaintenanceStopReason, z as MigrationPolicy, O as ONTOLOGY_BACKFILL_BATCH_SIZE, A as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, B as ONTOLOGY_BACKFILL_RECHECK_MS, J as OntologyBackfillResult, K as OntologyConfig, N as OntologyEdgeType, P as OntologyManifest, Q as OntologyMode, T as OntologyNodeType, U as OntologyPromptContext, V as OntologyUpdates, X as PendingMaintenance, Y as PendingMigrationWork, Z as PendingSourceStatus, _ as PromptOverrides, $ as PromptService, a0 as PrunePartialFailureError, a1 as ReembedResult, a2 as RememberInput, a3 as RunPendingMaintenanceOptions, a4 as RunPendingMaintenanceResult, a5 as SupersedeReplacement, a6 as VectorRanker, a7 as VectorRankerFallback, a8 as VectorRankerRankArgs, a9 as VectorRankerSemanticResult, aa as WikiBusyError, ab as WikiBusyOperation, ac as WikiCheckpoint, ad as WikiConfig, ae as WikiDiagnostic, af as WikiDiagnosticCode, ag as WikiDiagnosticDetail, ah as WikiDiagnosticOperation, ai as WikiDiagnosticSeverity, aj as WikiDiagnosticTrigger, ak as WikiDraftNotFound, al as WikiDuplicateHashError, am as WikiEdge, an as WikiEvent, ao as WikiFact, ap as WikiGraphNodeOwnershipConflict, aq as WikiIngestEmptyError, ar as WikiInstructions, as as WikiInvalidReadOptions, at as WikiLintReport, au as WikiMemoryTestAccess, av as WikiMigrationRequiredError, aw as WikiOutboxEvent, ax as WikiParseError, ay as WikiSearchUnavailableError, az as WikiSourceRefHashCollision, aA as WikiStrictOntologyViolation, aB as WikiSupersedeError, aC as WikiSupersedeReason, aD as WikiTask, aE as WikiTransactionError, aF as isWikiSearchUnavailableError, aG as validateManifest } from './testing-BlGhilQw.mjs';
3
3
  import { OkfFile } from '@equationalapplications/core-okf';
4
4
 
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-DbrL569t.js';
2
- export { C as ChunkFailure, d as ClassifierAnswer, e as ClassifierQuestion, f as ClassifyRequest, g as ClassifyResponse, D as DegradedRecord, h as DraftPage, E as EmbedFactResult, i as EmbedFailureKind, j as EmbeddingMarkerKind, k as EntityMaintenanceReport, l as EntityStatus, m as ExtractedFact, n as ExtractedFactEdge, o as ExtractedFactWithOntology, p as ExtractedTask, q as GraphTraversalOptions, r as GroundingConfig, H as HEAL_BATCH_SIZE, s as HEAL_RECHECK_MS, t as HOOK_TIMEOUT_MARKER, u as HealResult, I as IngestDocumentResult, L as LLMProvider, v as LibrarianConfig, w as LibrarianGateConfig, x as MaintenanceJob, y as MaintenanceStopReason, z as MigrationPolicy, O as ONTOLOGY_BACKFILL_BATCH_SIZE, A as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, B as ONTOLOGY_BACKFILL_RECHECK_MS, J as OntologyBackfillResult, K as OntologyConfig, N as OntologyEdgeType, P as OntologyManifest, Q as OntologyMode, T as OntologyNodeType, U as OntologyPromptContext, V as OntologyUpdates, X as PendingMaintenance, Y as PendingMigrationWork, Z as PendingSourceStatus, _ as PromptOverrides, $ as PromptService, a0 as PrunePartialFailureError, a1 as ReembedResult, a2 as RunPendingMaintenanceOptions, a3 as RunPendingMaintenanceResult, a4 as SupersedeReplacement, a5 as VectorRanker, a6 as VectorRankerFallback, a7 as VectorRankerRankArgs, a8 as VectorRankerSemanticResult, a9 as WikiBusyError, aa as WikiBusyOperation, ab as WikiCheckpoint, ac as WikiConfig, ad as WikiDiagnostic, ae as WikiDiagnosticCode, af as WikiDiagnosticDetail, ag as WikiDiagnosticOperation, ah as WikiDiagnosticSeverity, ai as WikiDiagnosticTrigger, aj as WikiDraftNotFound, ak as WikiDuplicateHashError, al as WikiEdge, am as WikiEvent, an as WikiFact, ao as WikiGraphNodeOwnershipConflict, ap as WikiIngestEmptyError, aq as WikiInstructions, ar as WikiInvalidReadOptions, as as WikiLintReport, at as WikiMemoryTestAccess, au as WikiMigrationRequiredError, av as WikiOutboxEvent, aw as WikiParseError, ax as WikiSearchUnavailableError, ay as WikiSourceRefHashCollision, az as WikiStrictOntologyViolation, aA as WikiSupersedeError, aB as WikiSupersedeReason, aC as WikiTask, aD as WikiTransactionError, aE as isWikiSearchUnavailableError, aF as validateManifest } from './testing-DbrL569t.js';
1
+ import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BlGhilQw.js';
2
+ export { C as ChunkFailure, d as ClassifierAnswer, e as ClassifierQuestion, f as ClassifyRequest, g as ClassifyResponse, D as DegradedRecord, h as DraftPage, E as EmbedFactResult, i as EmbedFailureKind, j as EmbeddingMarkerKind, k as EntityMaintenanceReport, l as EntityStatus, m as ExtractedFact, n as ExtractedFactEdge, o as ExtractedFactWithOntology, p as ExtractedTask, q as GraphTraversalOptions, r as GroundingConfig, H as HEAL_BATCH_SIZE, s as HEAL_RECHECK_MS, t as HOOK_TIMEOUT_MARKER, u as HealResult, I as IngestDocumentResult, L as LLMProvider, v as LibrarianConfig, w as LibrarianGateConfig, x as MaintenanceJob, y as MaintenanceStopReason, z as MigrationPolicy, O as ONTOLOGY_BACKFILL_BATCH_SIZE, A as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, B as ONTOLOGY_BACKFILL_RECHECK_MS, J as OntologyBackfillResult, K as OntologyConfig, N as OntologyEdgeType, P as OntologyManifest, Q as OntologyMode, T as OntologyNodeType, U as OntologyPromptContext, V as OntologyUpdates, X as PendingMaintenance, Y as PendingMigrationWork, Z as PendingSourceStatus, _ as PromptOverrides, $ as PromptService, a0 as PrunePartialFailureError, a1 as ReembedResult, a2 as RememberInput, a3 as RunPendingMaintenanceOptions, a4 as RunPendingMaintenanceResult, a5 as SupersedeReplacement, a6 as VectorRanker, a7 as VectorRankerFallback, a8 as VectorRankerRankArgs, a9 as VectorRankerSemanticResult, aa as WikiBusyError, ab as WikiBusyOperation, ac as WikiCheckpoint, ad as WikiConfig, ae as WikiDiagnostic, af as WikiDiagnosticCode, ag as WikiDiagnosticDetail, ah as WikiDiagnosticOperation, ai as WikiDiagnosticSeverity, aj as WikiDiagnosticTrigger, ak as WikiDraftNotFound, al as WikiDuplicateHashError, am as WikiEdge, an as WikiEvent, ao as WikiFact, ap as WikiGraphNodeOwnershipConflict, aq as WikiIngestEmptyError, ar as WikiInstructions, as as WikiInvalidReadOptions, at as WikiLintReport, au as WikiMemoryTestAccess, av as WikiMigrationRequiredError, aw as WikiOutboxEvent, ax as WikiParseError, ay as WikiSearchUnavailableError, az as WikiSourceRefHashCollision, aA as WikiStrictOntologyViolation, aB as WikiSupersedeError, aC as WikiSupersedeReason, aD as WikiTask, aE as WikiTransactionError, aF as isWikiSearchUnavailableError, aG as validateManifest } from './testing-BlGhilQw.js';
3
3
  import { OkfFile } from '@equationalapplications/core-okf';
4
4
 
5
5
  /**
package/dist/index.js CHANGED
@@ -10804,6 +10804,15 @@ var RetrievalService = class {
10804
10804
  }
10805
10805
  };
10806
10806
 
10807
+ // src/utils/entityId.ts
10808
+ function assertEntityId(entityId) {
10809
+ if (typeof entityId !== "string" || entityId.length === 0 || entityId.length > 200 || entityId.includes("\0")) {
10810
+ throw new TypeError(
10811
+ `Invalid entityId: must be a non-empty string at most 200 chars with no null bytes; got ${JSON.stringify(entityId)}.`
10812
+ );
10813
+ }
10814
+ }
10815
+
10807
10816
  // src/services/WriteService.ts
10808
10817
  var WriteService = class {
10809
10818
  constructor(db, options, entryRepo, eventRepo, metadataRepo, jobManager, maintenanceService) {
@@ -10829,11 +10838,7 @@ var WriteService = class {
10829
10838
  }
10830
10839
  }
10831
10840
  async write(entityId, event) {
10832
- if (typeof entityId !== "string" || entityId.length === 0 || entityId.length > 200 || entityId.includes("\0")) {
10833
- throw new TypeError(
10834
- `Invalid entityId: must be a non-empty string at most 200 chars with no null bytes; got ${JSON.stringify(entityId)}.`
10835
- );
10836
- }
10841
+ assertEntityId(entityId);
10837
10842
  if (event === null || typeof event !== "object" || Array.isArray(event)) {
10838
10843
  throw new TypeError("Invalid event: must be a non-null object.");
10839
10844
  }
@@ -11464,6 +11469,110 @@ var OkfTrustWritesRepository = class {
11464
11469
  }
11465
11470
  };
11466
11471
 
11472
+ // src/utils/rememberInput.ts
11473
+ var CONFIDENCE_VALUES = /* @__PURE__ */ new Set(["certain", "inferred", "tentative"]);
11474
+ var SOURCE_TYPE_VALUES = /* @__PURE__ */ new Set(["user_stated", "user_confirmed"]);
11475
+ function normalizeRememberInput(entityId, input, now) {
11476
+ assertEntityId(entityId);
11477
+ if (input === null || typeof input !== "object" || Array.isArray(input)) {
11478
+ throw new TypeError("remember(): input must be a non-null object.");
11479
+ }
11480
+ if (typeof input.title !== "string" || input.title.trim() === "") {
11481
+ throw new TypeError("remember(): input.title must be a non-empty string.");
11482
+ }
11483
+ if (typeof input.body !== "string") {
11484
+ throw new TypeError("remember(): input.body must be a string.");
11485
+ }
11486
+ let tags = [];
11487
+ if (input.tags !== void 0) {
11488
+ if (!Array.isArray(input.tags)) {
11489
+ throw new TypeError("remember(): input.tags must be an array of strings.");
11490
+ }
11491
+ for (let i = 0; i < input.tags.length; i++) {
11492
+ if (typeof input.tags[i] !== "string") {
11493
+ throw new TypeError("remember(): input.tags must be an array of strings.");
11494
+ }
11495
+ }
11496
+ tags = [...input.tags];
11497
+ }
11498
+ const confidence = input.confidence === void 0 ? "certain" : input.confidence;
11499
+ if (!CONFIDENCE_VALUES.has(confidence)) {
11500
+ throw new TypeError(`remember(): input.confidence must be certain | inferred | tentative; got ${JSON.stringify(input.confidence)}.`);
11501
+ }
11502
+ const sourceType = input.source_type === void 0 ? "user_stated" : input.source_type;
11503
+ if (!SOURCE_TYPE_VALUES.has(sourceType)) {
11504
+ throw new TypeError(`remember(): input.source_type must be user_stated | user_confirmed; got ${JSON.stringify(input.source_type)}.`);
11505
+ }
11506
+ let okfType = null;
11507
+ if (input.okf_type !== void 0 && input.okf_type !== null) {
11508
+ if (typeof input.okf_type !== "string" || input.okf_type.trim() === "") {
11509
+ throw new TypeError("remember(): input.okf_type must be a non-empty string or null.");
11510
+ }
11511
+ okfType = input.okf_type;
11512
+ }
11513
+ const validFrom = input.valid_from === void 0 ? void 0 : assertEpochMs("input.valid_from", input.valid_from);
11514
+ const fact = {
11515
+ id: generateId("fact_"),
11516
+ entity_id: entityId,
11517
+ title: input.title,
11518
+ body: input.body,
11519
+ tags,
11520
+ confidence,
11521
+ source_type: sourceType,
11522
+ source_hash: null,
11523
+ source_ref: null,
11524
+ created_at: now,
11525
+ updated_at: now,
11526
+ last_accessed_at: null,
11527
+ access_count: 0,
11528
+ deleted_at: null,
11529
+ okf_type: null
11530
+ };
11531
+ return { fact, validFrom, okfType };
11532
+ }
11533
+
11534
+ // src/services/RememberService.ts
11535
+ var RememberService = class {
11536
+ constructor(db, entryRepo, ontologyService, searchService, embeddingService) {
11537
+ this.db = db;
11538
+ this.entryRepo = entryRepo;
11539
+ this.ontologyService = ontologyService;
11540
+ this.searchService = searchService;
11541
+ this.embeddingService = embeddingService;
11542
+ }
11543
+ async remember(entityId, input) {
11544
+ const now = Date.now();
11545
+ const { fact, validFrom, okfType } = normalizeRememberInput(entityId, input, now);
11546
+ let stored;
11547
+ await this.db.withTransactionAsync(async (tx) => {
11548
+ if (okfType !== null) {
11549
+ const { mode, manifest } = await this.ontologyService.getEffectiveState(entityId, tx);
11550
+ const factLike = { okf_type: okfType, edges: [] };
11551
+ fact.okf_type = this.ontologyService.validateAndNormalizeFact(factLike, manifest, {
11552
+ strict: mode === "strict",
11553
+ entityId
11554
+ }).okf_type;
11555
+ }
11556
+ await this.entryRepo.upsert(fact, tx);
11557
+ if (validFrom !== void 0) {
11558
+ await this.entryRepo.setTemporal(fact.id, entityId, { valid_from: validFrom }, tx);
11559
+ }
11560
+ const [readBack] = await this.entryRepo.findByIds([fact.id], [entityId], tx);
11561
+ if (!readBack) {
11562
+ throw new Error("remember(): the stored fact could not be read back; the SQLiteAdapter did not perform the write");
11563
+ }
11564
+ stored = readBack;
11565
+ });
11566
+ await this.searchService.syncEntries(entityId, [fact.id]);
11567
+ await this.embeddingService.embedFact(
11568
+ { id: fact.id, entity_id: entityId, title: fact.title, body: fact.body, tags: fact.tags },
11569
+ { operation: "remember", trigger: "call" }
11570
+ );
11571
+ this.searchService.evictCache(entityId);
11572
+ return stored;
11573
+ }
11574
+ };
11575
+
11467
11576
  // src/WikiMemory.ts
11468
11577
  var TABLE_PREFIX_PATTERN = /^[A-Za-z][A-Za-z0-9_]{0,30}_$/;
11469
11578
  var SEARCH_REINIT_COOLDOWN_MS = 5e3;
@@ -11526,6 +11635,7 @@ var WikiMemory = class {
11526
11635
  new MiniSearchIndexStrategy()
11527
11636
  );
11528
11637
  this.temporalService = new TemporalService(this.db, this.options, this.entryRepo, this.searchService, this.embeddingService);
11638
+ this.rememberService = new RememberService(this.db, this.entryRepo, this.ontologyService, this.searchService, this.embeddingService);
11529
11639
  this.jobManager = new JobManager(this.prefix);
11530
11640
  this.promptService = new PromptService(options.config?.prompts, resolveGrounding(options.config?.grounding));
11531
11641
  this.ingestionService = new IngestionService(
@@ -11623,6 +11733,7 @@ var WikiMemory = class {
11623
11733
  promptService: this.promptService,
11624
11734
  graphTraversalService: this.graphTraversalService,
11625
11735
  temporalService: this.temporalService,
11736
+ rememberService: this.rememberService,
11626
11737
  entryRepo: this.entryRepo,
11627
11738
  sourceRefIndexRepo: this.sourceRefIndexRepo,
11628
11739
  metadataRepo: this.metadataRepo,
@@ -11784,7 +11895,7 @@ var WikiMemory = class {
11784
11895
  * in a sparse array), throws a `TypeError` before any SQL runs.
11785
11896
  */
11786
11897
  async pendingSources(entityId, sources) {
11787
- assertEntityId(entityId);
11898
+ assertEntityId2(entityId);
11788
11899
  if (!Array.isArray(sources)) {
11789
11900
  throw new TypeError("Invalid sources: must be an array of { sourceRef, sourceHash } objects.");
11790
11901
  }
@@ -11816,7 +11927,7 @@ var WikiMemory = class {
11816
11927
  }
11817
11928
  /** Read-only maintenance report for one entity (spec §8.1). Reports, never repairs. */
11818
11929
  async lint(entityId) {
11819
- assertEntityId(entityId);
11930
+ assertEntityId2(entityId);
11820
11931
  return this.lintService.lint(entityId);
11821
11932
  }
11822
11933
  /**
@@ -11825,7 +11936,7 @@ var WikiMemory = class {
11825
11936
  * overrides are returned verbatim, so keep secrets out of `WikiConfig.prompts`.
11826
11937
  */
11827
11938
  async getInstructions(entityId) {
11828
- assertEntityId(entityId);
11939
+ assertEntityId2(entityId);
11829
11940
  const ontologyContext = await this.ontologyService.buildPromptContext(entityId);
11830
11941
  return this.promptService.buildInstructionTemplates(ontologyContext);
11831
11942
  }
@@ -12042,7 +12153,7 @@ var WikiMemory = class {
12042
12153
  if (await this.syncDrained(this.searchService.syncStale({ ids }))) this.dropStashedIds(stashed2);
12043
12154
  return;
12044
12155
  }
12045
- assertEntityId(entityId);
12156
+ assertEntityId2(entityId);
12046
12157
  const stashed = this.peekStashedIds(entityId);
12047
12158
  if (await this.syncDrained(this.searchService.syncEntries(entityId, stashed.get(entityId)?.keys() ?? []))) {
12048
12159
  this.dropStashedIds(stashed);
@@ -12081,6 +12192,23 @@ var WikiMemory = class {
12081
12192
  async history(entityId, factId) {
12082
12193
  return this.temporalService.history(entityId, factId);
12083
12194
  }
12195
+ /**
12196
+ * Store one mutable fact directly, with no LLM step (spec
12197
+ * `specs/core-remember/spec.md`). One transaction; resolves with the stored
12198
+ * row read back (`id`, timestamps, defaults, `isStale`, `trustTier`). Never
12199
+ * starts the librarian or heal and writes no event, in `'auto'` and
12200
+ * `'deferred'` mode alike. Embeds through `llmProvider.embed` when present;
12201
+ * keyword-only otherwise. Not idempotent. To replace an existing fact use
12202
+ * `supersede()` so history is kept. Opens its own transaction: do not call
12203
+ * it inside `withTransactionAsync` (the serialized adapter would deadlock).
12204
+ *
12205
+ * Throws `TypeError` on invalid input and `WikiStrictOntologyViolation` for
12206
+ * an `okf_type` the entity's strict manifest does not define; nothing is
12207
+ * written in either case.
12208
+ */
12209
+ async remember(entityId, input) {
12210
+ return this.rememberService.remember(entityId, input);
12211
+ }
12084
12212
  /**
12085
12213
  * Full and partial ingestion both reject foreign-owned generated fact IDs with
12086
12214
  * `WikiGraphNodeOwnershipConflict`. Such collisions are unexpected. Ingestion
@@ -12349,7 +12477,7 @@ var WikiMemory = class {
12349
12477
  _testAccessNonTestEnvWarned = new WeakMap();
12350
12478
  /** Max upsertGraph node ids held for their post-commit sync (spec #280 id threading). */
12351
12479
  WikiMemory.UPSERT_ID_STASH_CAP = 1e4;
12352
- function assertEntityId(entityId) {
12480
+ function assertEntityId2(entityId) {
12353
12481
  if (typeof entityId !== "string" || entityId.length === 0) {
12354
12482
  throw new TypeError("Invalid entityId: must be a non-empty string.");
12355
12483
  }
@@ -12871,7 +12999,7 @@ function formatOkfBundle(dump, options) {
12871
12999
  });
12872
13000
  return { files };
12873
13001
  }
12874
- var CONFIDENCE_VALUES = /* @__PURE__ */ new Set(["certain", "inferred", "tentative"]);
13002
+ var CONFIDENCE_VALUES2 = /* @__PURE__ */ new Set(["certain", "inferred", "tentative"]);
12875
13003
  var SOURCE_TYPES = /* @__PURE__ */ new Set([
12876
13004
  "user_stated",
12877
13005
  "librarian_inferred",
@@ -13017,7 +13145,7 @@ function frontmatterToFact(entityId, id, frontmatter, body, now) {
13017
13145
  title: typeof frontmatter.title === "string" ? frontmatter.title : "",
13018
13146
  body,
13019
13147
  tags: Array.isArray(frontmatter.tags) ? frontmatter.tags.filter((t) => typeof t === "string") : [],
13020
- confidence: CONFIDENCE_VALUES.has(String(frontmatter.confidence)) ? frontmatter.confidence : "tentative",
13148
+ confidence: CONFIDENCE_VALUES2.has(String(frontmatter.confidence)) ? frontmatter.confidence : "tentative",
13021
13149
  source_type: SOURCE_TYPES.has(String(frontmatter.source_type)) ? frontmatter.source_type : "user_stated",
13022
13150
  source_hash: typeof frontmatter.source_hash === "string" ? frontmatter.source_hash : null,
13023
13151
  source_ref: typeof frontmatter.resource === "string" ? frontmatter.resource : null,