@equationalapplications/core-llm-wiki 9.5.2 → 9.6.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
@@ -30,6 +30,8 @@ var SEVERITY = {
30
30
  grounding_failed: "warn",
31
31
  classification_low_confidence: "info",
32
32
  classification_invalid: "warn",
33
+ classification_abstained: "info",
34
+ node_type_assigned: "info",
33
35
  context_overflow_skipped: "warn",
34
36
  llm_usage: "info",
35
37
  librarian_gate: "info",
@@ -38,6 +40,7 @@ var SEVERITY = {
38
40
  resolve_failed: "warn",
39
41
  read_budget: "info",
40
42
  event_retention_held: "info",
43
+ ontology_backfill_held: "info",
41
44
  prune_checkpoint_incomplete: "warn",
42
45
  erase_secure_delete_off: "error",
43
46
  erase_entity_skipped: "warn",
@@ -76,6 +79,8 @@ var MESSAGE = {
76
79
  grounding_failed: "A fact carried evidence not found in its source and was stored as a draft.",
77
80
  classification_low_confidence: "A classifier answer was below the confidence threshold and was not applied.",
78
81
  classification_invalid: "A classifier answer was invalid and was not applied.",
82
+ classification_abstained: "The typing model declined to classify the fact; it was not typed.",
83
+ node_type_assigned: "A typing run assigned an ontology node type to the fact.",
79
84
  context_overflow_skipped: "An item (fact or event) was skipped because the model input exceeded its context window.",
80
85
  llm_usage: "An LLM call completed; token usage attached.",
81
86
  librarian_gate: "Librarian gate outcome counts for one pass.",
@@ -84,6 +89,7 @@ var MESSAGE = {
84
89
  resolve_failed: "Reconciliation failed for a candidate; it was stored as a draft.",
85
90
  read_budget: "A read was packed to a token budget.",
86
91
  event_retention_held: "Event pruning was held back because the librarian has not processed those events yet.",
92
+ ontology_backfill_held: "Ontology backfill was held because another job held the entity\u2019s lock.",
87
93
  prune_checkpoint_incomplete: "The post-VACUUM WAL checkpoint was incomplete while a prune partial failure was also reported; deleted bytes may remain in the WAL.",
88
94
  erase_secure_delete_off: "secure_delete could not be confirmed ON on the connection; erasure is unverified and the erase was stopped.",
89
95
  erase_retired_vtab_undroppable: "A retired FTS table could not be dropped on a runtime without FTS5; its shadow-table text rows were emptied (fts5 %_config and %_data ids 1 and 10 are intentionally kept) and the name stays listed until an FTS5-capable open drops it.",
@@ -4517,6 +4523,10 @@ function resolveNodeType(raw, manifest) {
4517
4523
  const hit = manifest.node_types.find((n) => n.type.toLowerCase() === slug.toLowerCase());
4518
4524
  return hit?.type ?? null;
4519
4525
  }
4526
+ var ONTOLOGY_ABSTAIN_SENTINEL = "none_of_these";
4527
+ function isReservedAbstainSlug(raw) {
4528
+ return typeof raw === "string" && raw.trim().toLowerCase() === ONTOLOGY_ABSTAIN_SENTINEL;
4529
+ }
4520
4530
  function resolveEdgeDefinitions(rawEdgeType, manifest) {
4521
4531
  const slug = rawEdgeType.trim();
4522
4532
  if (!slug) return [];
@@ -8833,6 +8843,61 @@ function warnChangedDefaultsOnce(config) {
8833
8843
  console.warn(message);
8834
8844
  }
8835
8845
  }
8846
+ function warnOnce(message) {
8847
+ if (warnedDefaults.has(message)) return;
8848
+ warnedDefaults.add(message);
8849
+ console.warn(message);
8850
+ }
8851
+ function formatConfigValue(value) {
8852
+ try {
8853
+ const json = JSON.stringify(value);
8854
+ return json ?? String(value);
8855
+ } catch {
8856
+ return `[unserializable: ${typeof value}]`;
8857
+ }
8858
+ }
8859
+ var isTypingMode = (v) => v === "auto" || v === "llm";
8860
+ var isConfidenceFloor = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 && v <= 1;
8861
+ function resolveSystemOneTyping(config, classifierCallOption) {
8862
+ const systemOne = config?.systemOne;
8863
+ const legacy = config?.ontology?.backfillClassifier;
8864
+ const systemOneValid = isTypingMode(systemOne?.typing);
8865
+ const legacyValid = isTypingMode(legacy);
8866
+ if (systemOne?.typing !== void 0 && !systemOneValid) {
8867
+ warnOnce(
8868
+ `[core-llm-wiki] systemOne: \`systemOne.typing\` is ${formatConfigValue(systemOne.typing)}, which is not 'auto' or 'llm'. The key is treated as unset; the default ('llm') applies.`
8869
+ );
8870
+ }
8871
+ if (legacy !== void 0 && !legacyValid) {
8872
+ warnOnce(
8873
+ `[core-llm-wiki] systemOne: \`ontology.backfillClassifier\` is ${formatConfigValue(legacy)}, which is not 'auto' or 'llm'. The key is treated as unset; the default ('llm') applies.`
8874
+ );
8875
+ }
8876
+ if (systemOneValid && legacyValid && systemOne.typing !== legacy) {
8877
+ warnOnce(
8878
+ `[core-llm-wiki] systemOne: \`systemOne.typing\` (${systemOne.typing}) and \`ontology.backfillClassifier\` (${legacy}) disagree; \`systemOne.typing\` wins. Remove the legacy key to silence this warning.`
8879
+ );
8880
+ }
8881
+ return classifierCallOption ?? (systemOneValid ? systemOne.typing : void 0) ?? (legacyValid ? legacy : void 0) ?? "llm";
8882
+ }
8883
+ var DEFAULT_TYPING_MIN_CONFIDENCE = 0.5;
8884
+ function resolveTypingMinConfidence(config) {
8885
+ const systemOneFloor = config?.systemOne?.minConfidence?.typing;
8886
+ const legacyFloor = config?.ontology?.classifyMinConfidence;
8887
+ const systemOneValid = isConfidenceFloor(systemOneFloor);
8888
+ const legacyValid = isConfidenceFloor(legacyFloor);
8889
+ if (systemOneFloor !== void 0 && !systemOneValid) {
8890
+ warnOnce(
8891
+ `[core-llm-wiki] systemOne: \`systemOne.minConfidence.typing\` is ${formatConfigValue(systemOneFloor)}, which is not a finite number in [0, 1]. The key is treated as unset and the chain continues.`
8892
+ );
8893
+ }
8894
+ if (legacyFloor !== void 0 && !legacyValid) {
8895
+ warnOnce(
8896
+ `[core-llm-wiki] systemOne: \`ontology.classifyMinConfidence\` is ${formatConfigValue(legacyFloor)}, which is not a finite number in [0, 1]. The key is treated as unset and the chain continues.`
8897
+ );
8898
+ }
8899
+ return (systemOneValid ? systemOneFloor : void 0) ?? (legacyValid ? legacyFloor : void 0) ?? DEFAULT_TYPING_MIN_CONFIDENCE;
8900
+ }
8836
8901
 
8837
8902
  // src/repositories/VectorRemovalRepository.ts
8838
8903
  var CHUNK2 = 500;
@@ -9857,15 +9922,29 @@ function mergeOutcomes(a, b) {
9857
9922
  taskItems: a.taskItems + b.taskItems
9858
9923
  };
9859
9924
  }
9860
- async function extractWithOverflowRetry(deps, ctx, ontologyContext, batch) {
9925
+ async function extractWithOverflowRetry(deps, ctx, ontologyContext, batch, probe) {
9861
9926
  try {
9862
9927
  return await extractOnce(deps, ctx, ontologyContext, batch);
9863
9928
  } catch (err) {
9864
9929
  if (!isContextOverflowError(err)) throw err;
9930
+ if (!probe.checked) {
9931
+ probe.checked = true;
9932
+ const probePrompt = deps.promptService.buildOpsExtractPrompt(
9933
+ [{ ...batch[0], event: { ...batch[0].event, summary: "x" } }],
9934
+ ontologyContext,
9935
+ ctx.guidance
9936
+ );
9937
+ try {
9938
+ await callLlm(deps.options, { operation: "librarian", entityId: ctx.entityId, trigger: ctx.trigger, meter: ctx.meter }, probePrompt);
9939
+ } catch (e) {
9940
+ if (!isContextOverflowError(e)) throw e;
9941
+ throw new Error("ops extract: minimal-prompt probe also overflowed (fixed prompt part exceeds the model window?)");
9942
+ }
9943
+ }
9865
9944
  if (batch.length > 1) {
9866
9945
  const mid = Math.ceil(batch.length / 2);
9867
- const a = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch.slice(0, mid));
9868
- const b = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch.slice(mid));
9946
+ const a = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch.slice(0, mid), probe);
9947
+ const b = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch.slice(mid), probe);
9869
9948
  return mergeOutcomes(a, b);
9870
9949
  }
9871
9950
  const lone = batch[0];
@@ -9917,21 +9996,7 @@ async function extractWithOverflowRetry(deps, ctx, ontologyContext, batch) {
9917
9996
  }
9918
9997
  async function runExtract(deps, ctx, batch) {
9919
9998
  const ontologyContext = await deps.ontologyService?.buildPromptContext(ctx.entityId) ?? null;
9920
- const out = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch);
9921
- if (out.skippedEvents > 0 && out.skippedEvents === out.batch.length) {
9922
- const probe = deps.promptService.buildOpsExtractPrompt(
9923
- [{ ...batch[0], event: { ...batch[0].event, summary: "x" } }],
9924
- ontologyContext,
9925
- ctx.guidance
9926
- );
9927
- try {
9928
- await callLlm(deps.options, { operation: "librarian", entityId: ctx.entityId, trigger: ctx.trigger, meter: void 0 }, probe);
9929
- } catch (e) {
9930
- if (!isContextOverflowError(e)) throw e;
9931
- throw new Error(`ops extract: all ${out.skippedEvents} selected events were skipped for context overflow and a minimal probe also overflowed (fixed prompt part exceeds the model window?)`);
9932
- }
9933
- }
9934
- return out;
9999
+ return extractWithOverflowRetry(deps, ctx, ontologyContext, batch, { checked: false });
9935
10000
  }
9936
10001
  async function extractOnce(deps, ctx, ontologyContext, batch) {
9937
10002
  const { entityId, trigger } = ctx;
@@ -10442,6 +10507,7 @@ var CHAIN_TRUNCATED_NOTICE = `includeChain walk stopped at the depth cap (${HIST
10442
10507
  var ONTOLOGY_BACKFILL_BATCH_SIZE = 25;
10443
10508
  var ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS = 4e4;
10444
10509
  var ONTOLOGY_BACKFILL_RECHECK_MS = 7 * 24 * 60 * 60 * 1e3;
10510
+ var CLASSIFIER_MAX_CHOICES = 255;
10445
10511
  var HEAL_ANCHOR_SEARCH_OVERFETCH = 4;
10446
10512
  var HEAL_MAX_PROMPT_CHARS = 4e4;
10447
10513
  var HEAL_BATCH_SIZE = 25;
@@ -11135,6 +11201,35 @@ DROP TRIGGER IF EXISTS ${ad};`);
11135
11201
  this.jobManager.releaseLock("ontologyBackfill", entityId);
11136
11202
  }
11137
11203
  }
11204
+ /**
11205
+ * Scheduler read view (specs/system-one-config §8): untyped facts still
11206
+ * eligible for typing this pass — outside the 7-day recheck cooldown — or 0
11207
+ * when ontology is off for the entity (nothing is ever eligible there).
11208
+ * Read-only: never materializes a seed manifest, never writes.
11209
+ */
11210
+ async pendingOntologyBackfill(entityId) {
11211
+ const ontologyService = this.ontologyService;
11212
+ if (!ontologyService) return 0;
11213
+ const { mode } = await ontologyService.getEffectiveState(entityId);
11214
+ if (mode === "off") return 0;
11215
+ const counts = await this.entryRepo.countUntypedByEntityId(entityId, Date.now() - ONTOLOGY_BACKFILL_RECHECK_MS);
11216
+ return counts.eligible;
11217
+ }
11218
+ /**
11219
+ * Emit `ontology_backfill_held` (severity `info`) when the scheduler found
11220
+ * the entity's `ontologyBackfill` lock held by another job. The lock state
11221
+ * names no content, so the fixed template carries all the information a
11222
+ * host needs; `JobManager.isBlocked` does not identify the blocker and the
11223
+ * diagnostic detail surface stays identifier-typed.
11224
+ */
11225
+ noteOntologyBackfillHeld(entityId) {
11226
+ emitDiagnostic(this.options, {
11227
+ code: "ontology_backfill_held",
11228
+ operation: "ontologyBackfill",
11229
+ trigger: "call",
11230
+ entityId
11231
+ });
11232
+ }
11138
11233
  /**
11139
11234
  * Re-embed facts, honouring per-row failure markers and exponential backoff.
11140
11235
  *
@@ -11881,45 +11976,120 @@ DROP TRIGGER IF EXISTS ${ad};`);
11881
11976
  if (!Number.isInteger(batchSize) || batchSize < 1) {
11882
11977
  throw new Error("Invalid batchSize: must be an integer >= 1");
11883
11978
  }
11979
+ if (options?.classifier !== void 0 && options.classifier !== "auto" && options.classifier !== "llm") {
11980
+ throw new TypeError(`Invalid classifier option: ${JSON.stringify(options.classifier)} \u2014 must be 'auto' or 'llm'`);
11981
+ }
11982
+ const trigger = options?.trigger ?? "call";
11884
11983
  const now = Date.now();
11885
11984
  const recheckCutoff = now - ONTOLOGY_BACKFILL_RECHECK_MS;
11886
- const zeroed = { scanned: 0, typed: 0, failedValidation: 0, edgesAdded: 0, skipped: 0 };
11985
+ const zeroed = { scanned: 0, typed: 0, failedValidation: 0, edgesAdded: 0, skipped: 0, abstained: 0 };
11887
11986
  const ontologyService = this.ontologyService;
11888
11987
  if (!ontologyService) {
11889
11988
  return { ...zeroed, remaining: 0, deferred: 0 };
11890
11989
  }
11891
11990
  const { mode, manifest: effectiveManifest } = await ontologyService.getEffectiveState(entityId);
11892
11991
  if (mode === "off") {
11893
- const counts2 = await this.entryRepo.countUntypedByEntityId(entityId, recheckCutoff);
11894
- return { ...zeroed, remaining: 0, deferred: counts2.deferred };
11992
+ const counts = await this.entryRepo.countUntypedByEntityId(entityId, recheckCutoff);
11993
+ return { ...zeroed, remaining: 0, deferred: counts.deferred };
11895
11994
  }
11896
11995
  const candidates = await this.entryRepo.findUntypedByEntityId(entityId, batchSize, recheckCutoff);
11897
11996
  if (candidates.length === 0) {
11898
- const counts2 = await this.entryRepo.countUntypedByEntityId(entityId, recheckCutoff);
11899
- return { ...zeroed, remaining: counts2.eligible, deferred: counts2.deferred };
11997
+ const counts = await this.entryRepo.countUntypedByEntityId(entityId, recheckCutoff);
11998
+ return { ...zeroed, remaining: counts.eligible, deferred: counts.deferred };
11900
11999
  }
11901
- const classifierMode = options?.classifier ?? this.options.config?.ontology?.backfillClassifier ?? "llm";
12000
+ const classifierMode = resolveSystemOneTyping(this.options.config, options?.classifier);
11902
12001
  const classify = this.options.llmProvider.classify;
11903
12002
  if (classifierMode === "auto" && typeof classify === "function") {
11904
12003
  const slugs = effectiveManifest.node_types.map((n) => n.type);
11905
- if (slugs.length > 0 && slugs.length <= 255) {
11906
- return this._runClassifierBackfill(entityId, candidates, effectiveManifest, now, recheckCutoff, options?.meter);
12004
+ if (slugs.length > 0 && slugs.length + 1 <= CLASSIFIER_MAX_CHOICES && !slugs.some((s) => isReservedAbstainSlug(s))) {
12005
+ const classifierRun = await this._runClassifierBackfill(
12006
+ entityId,
12007
+ candidates,
12008
+ effectiveManifest,
12009
+ now,
12010
+ recheckCutoff,
12011
+ options?.meter,
12012
+ trigger
12013
+ );
12014
+ if (classifierRun.abortedOntologyOff || classifierRun.result.budgetStop) {
12015
+ return classifierRun.result;
12016
+ }
12017
+ if (classifierRun.escalated.length > 0 && this.resolveSystemOneOnLowConfidence() === "llm") {
12018
+ const { mode: liveMode } = await ontologyService.getEffectiveState(entityId);
12019
+ if (liveMode === "off") {
12020
+ const counts = await this.entryRepo.countUntypedByEntityId(entityId, recheckCutoff);
12021
+ return { ...zeroed, remaining: 0, deferred: counts.deferred };
12022
+ }
12023
+ const escalated = classifierRun.escalated;
12024
+ const generative = await this._runGenerativeBackfill(entityId, escalated, {
12025
+ promptOverride: options?.promptOverride,
12026
+ meter: options?.meter,
12027
+ trigger,
12028
+ batchSize: escalated.length
12029
+ });
12030
+ return {
12031
+ scanned: classifierRun.result.scanned,
12032
+ typed: classifierRun.result.typed + generative.typed,
12033
+ failedValidation: classifierRun.result.failedValidation + generative.failedValidation,
12034
+ edgesAdded: classifierRun.result.edgesAdded + generative.edgesAdded,
12035
+ abstained: classifierRun.result.abstained + generative.abstained,
12036
+ skipped: classifierRun.result.skipped + generative.skipped,
12037
+ remaining: generative.remaining,
12038
+ deferred: generative.deferred,
12039
+ ...generative.budgetStop ? { budgetStop: generative.budgetStop } : {}
12040
+ };
12041
+ }
12042
+ return classifierRun.result;
11907
12043
  }
11908
12044
  }
12045
+ return this._runGenerativeBackfill(entityId, candidates, {
12046
+ promptOverride: options?.promptOverride,
12047
+ meter: options?.meter,
12048
+ trigger
12049
+ });
12050
+ }
12051
+ /**
12052
+ * Low-confidence routing (specs/system-one-config §4): `'leave'` (default)
12053
+ * keeps classifier abstains/low-confidence facts untyped and
12054
+ * cooldown-stamped; `'llm'` escalates them to the generative step. Invalid
12055
+ * config warns once and is treated as unset. Cost/quality setting, not a
12056
+ * safety mechanism — it cannot catch a confidently wrong classifier.
12057
+ */
12058
+ resolveSystemOneOnLowConfidence() {
12059
+ const raw = this.options.config?.systemOne?.onLowConfidence;
12060
+ if (raw !== void 0 && raw !== "leave" && raw !== "llm") {
12061
+ warnOnce(
12062
+ `[core-llm-wiki] systemOne: \`systemOne.onLowConfidence\` is ${formatConfigValue(raw)}, which is not 'leave' or 'llm'. The key is treated as unset; the default ('leave') applies.`
12063
+ );
12064
+ return "leave";
12065
+ }
12066
+ return raw ?? "leave";
12067
+ }
12068
+ /**
12069
+ * Generative-mode backfill step: the original `generateText` pass over
12070
+ * `candidates`. Also the escalation target of the classifier step (§4) —
12071
+ * there `candidates` holds only the escalated facts and `batchSize` is
12072
+ * sized to send them in one batch.
12073
+ */
12074
+ async _runGenerativeBackfill(entityId, candidates, runOpts) {
12075
+ runOpts.batchSize ?? ONTOLOGY_BACKFILL_BATCH_SIZE;
12076
+ const ontologyService = this.ontologyService;
12077
+ const now = Date.now();
12078
+ const recheckCutoff = now - ONTOLOGY_BACKFILL_RECHECK_MS;
11909
12079
  const ontologyContext = await ontologyService.buildPromptContext(entityId);
11910
12080
  const titleRows = await this.entryRepo.findTitleIndexByEntityId(entityId);
11911
12081
  const titleCatalog = buildTitleCatalogBlock(titleRows);
11912
12082
  const toPromptShape = (f) => ({ id: f.id, title: f.title, body: f.body, tags: f.tags });
11913
12083
  const buildPrompt = (facts) => this.promptService.buildOntologyBackfillPrompt(
11914
12084
  facts.map(toPromptShape),
11915
- options?.promptOverride,
12085
+ runOpts.promptOverride,
11916
12086
  ontologyContext,
11917
12087
  titleCatalog
11918
12088
  );
11919
12089
  const outcome = await runBatched({
11920
12090
  items: candidates,
11921
12091
  buildPrompt,
11922
- call: (prompts) => callLlm(this.options, { operation: "ontologyBackfill", entityId, trigger: "call", meter: options?.meter }, prompts),
12092
+ call: (prompts) => callLlm(this.options, { operation: "ontologyBackfill", entityId, trigger: runOpts.trigger, meter: runOpts.meter }, prompts),
11923
12093
  parse: (responseText, batch) => {
11924
12094
  const parsed = parseJsonResponse(responseText);
11925
12095
  return {
@@ -11935,7 +12105,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
11935
12105
  emitDiagnostic(this.options, {
11936
12106
  entityId,
11937
12107
  operation: "ontologyBackfill",
11938
- trigger: "call",
12108
+ trigger: runOpts.trigger,
11939
12109
  code: "context_overflow_skipped",
11940
12110
  detail: { factId: fact.id }
11941
12111
  });
@@ -11950,9 +12120,12 @@ DROP TRIGGER IF EXISTS ${ad};`);
11950
12120
  let failedValidation = 0;
11951
12121
  let edgesAdded = 0;
11952
12122
  let scanned = 0;
12123
+ let abstained = 0;
11953
12124
  let abortedOntologyOff = false;
12125
+ const diagBuffer = new DiagnosticBuffer();
12126
+ const diagBase = { entityId, operation: "ontologyBackfill", trigger: runOpts.trigger };
11954
12127
  for (const batchResult of outcome.results) {
11955
- const applied = await this._applyOntologyBackfillBatch(entityId, batchResult, now);
12128
+ const applied = await this._applyOntologyBackfillBatch(entityId, batchResult, now, "llm", runOpts.trigger);
11956
12129
  if (applied.abortedOntologyOff) {
11957
12130
  abortedOntologyOff = true;
11958
12131
  break;
@@ -11960,8 +12133,17 @@ DROP TRIGGER IF EXISTS ${ad};`);
11960
12133
  typed += applied.typed;
11961
12134
  failedValidation += applied.failedValidation;
11962
12135
  edgesAdded += applied.edgesAdded;
12136
+ for (const factId of applied.omittedIds) {
12137
+ abstained += 1;
12138
+ diagBuffer.push({
12139
+ ...diagBase,
12140
+ code: "classification_abstained",
12141
+ detail: { factId, writer: "llm" }
12142
+ });
12143
+ }
11963
12144
  scanned += batchResult.batch.length;
11964
12145
  }
12146
+ diagBuffer.flush(this.options);
11965
12147
  if (abortedOntologyOff) {
11966
12148
  const counts2 = await this.entryRepo.countUntypedByEntityId(entityId, recheckCutoff);
11967
12149
  return {
@@ -11969,6 +12151,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
11969
12151
  typed,
11970
12152
  failedValidation,
11971
12153
  edgesAdded,
12154
+ abstained,
11972
12155
  skipped: outcome.skipped.length,
11973
12156
  remaining: 0,
11974
12157
  deferred: counts2.deferred,
@@ -11993,6 +12176,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
11993
12176
  typed,
11994
12177
  failedValidation,
11995
12178
  edgesAdded,
12179
+ abstained,
11996
12180
  skipped: outcome.skipped.length,
11997
12181
  remaining: counts.eligible,
11998
12182
  deferred: counts.deferred,
@@ -12000,20 +12184,24 @@ DROP TRIGGER IF EXISTS ${ad};`);
12000
12184
  };
12001
12185
  }
12002
12186
  /**
12003
- * Classifier-mode backfill (spec §7.3): one `choice` question per untyped
12004
- * fact over the effective manifest's node-type slugs. Accepted answers go
12005
- * through `_applyOntologyBackfillBatch` exactly like LLM classifications.
12006
- * No edges are proposed.
12187
+ * Classifier-mode backfill (spec §7.3, S1-0 §5): one `choice` question per
12188
+ * untyped fact over the effective manifest's node-type slugs plus the
12189
+ * reserved abstain sentinel. Accepted answers go through
12190
+ * `_applyOntologyBackfillBatch` exactly like LLM classifications. No edges
12191
+ * are proposed. Abstains and low-confidence answers are cooldown-stamped
12192
+ * omissions under `onLowConfidence: 'leave'`; under `'llm'` they are
12193
+ * returned un-stamped in `escalated` for the generative step. Always
12194
+ * returns the `OntologyBackfillResult` for its step plus escalation state.
12007
12195
  */
12008
- async _runClassifierBackfill(entityId, candidates, manifest, now, recheckCutoff, meter) {
12009
- const rawMin = this.options.config?.ontology?.classifyMinConfidence;
12010
- const minConfidence = typeof rawMin === "number" && Number.isFinite(rawMin) && rawMin >= 0 && rawMin <= 1 ? rawMin : 0.5;
12196
+ async _runClassifierBackfill(entityId, candidates, manifest, now, recheckCutoff, meter, trigger) {
12197
+ const minConfidence = resolveTypingMinConfidence(this.options.config);
12011
12198
  const rawConcurrency = this.options.config?.chunkConcurrency ?? 1;
12012
12199
  const concurrency = Number.isFinite(rawConcurrency) && rawConcurrency >= 1 ? Math.floor(rawConcurrency) : 1;
12013
12200
  const question = {
12014
12201
  kind: "choice",
12015
- options: manifest.node_types.map((n) => n.type),
12016
- instructions: "Choose the ontology node type that best describes this fact.\n" + manifest.node_types.map((n) => `- ${n.type}: ${n.description}`).join("\n")
12202
+ options: [...manifest.node_types.map((n) => n.type), ONTOLOGY_ABSTAIN_SENTINEL],
12203
+ instructions: `Choose the ontology node type that best describes this fact, or choose "${ONTOLOGY_ABSTAIN_SENTINEL}" if none of the listed types fits.
12204
+ ` + manifest.node_types.map((n) => `- ${n.type}: ${n.description}`).join("\n")
12017
12205
  };
12018
12206
  let stopped;
12019
12207
  const outcomes = await withConcurrency(
@@ -12023,7 +12211,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
12023
12211
  try {
12024
12212
  response = await callClassify(
12025
12213
  this.options,
12026
- { operation: "ontologyBackfill", entityId, trigger: "call", meter },
12214
+ { operation: "ontologyBackfill", entityId, trigger, meter },
12027
12215
  { state: classifierStateForFact(fact), questions: { okf_type: question } }
12028
12216
  );
12029
12217
  } catch (err) {
@@ -12037,37 +12225,47 @@ DROP TRIGGER IF EXISTS ${ad};`);
12037
12225
  const checked = validateClassifierAnswer(response, "okf_type", question);
12038
12226
  if (!checked.ok) return { fact, kind: "invalid", reason: checked.reason };
12039
12227
  if (checked.answer.kind !== "choice") return { fact, kind: "invalid", reason: "kind_mismatch" };
12228
+ if (isReservedAbstainSlug(checked.answer.choice)) return { fact, kind: "abstain" };
12040
12229
  if (checked.answer.confidence < minConfidence) return { fact, kind: "low_confidence" };
12041
12230
  return { fact, kind: "accepted", okfType: checked.answer.choice };
12042
12231
  }),
12043
12232
  concurrency
12044
12233
  );
12045
- const attempted = outcomes.filter((o) => o.kind !== "threw" && o.kind !== "unattempted").map((o) => o.fact);
12234
+ const escalate = this.resolveSystemOneOnLowConfidence() === "llm";
12235
+ const escalated = escalate ? outcomes.filter((o) => o.kind === "abstain" || o.kind === "low_confidence").map((o) => o.fact) : [];
12236
+ const isEscalated = (o) => escalate && (o.kind === "abstain" || o.kind === "low_confidence");
12237
+ const attempted = outcomes.filter((o) => o.kind !== "threw" && o.kind !== "unattempted" && !isEscalated(o)).map((o) => o.fact);
12046
12238
  const unattemptedCount = outcomes.filter((o) => o.kind === "unattempted").length;
12047
12239
  const skipped = outcomes.filter((o) => o.kind === "threw" || o.kind === "overflow_skip").length;
12048
12240
  const classifications = outcomes.filter((o) => o.kind === "accepted").map((o) => ({ id: o.fact.id, okf_type: o.okfType }));
12049
12241
  const invalidCount = outcomes.filter((o) => o.kind === "invalid").length;
12242
+ const abstainCount = outcomes.filter((o) => o.kind === "abstain" && !isEscalated(o)).length;
12050
12243
  let typed = 0;
12051
12244
  let failedValidation = 0;
12052
12245
  let edgesAdded = 0;
12053
- let aborted = false;
12246
+ let abortedOntologyOff = false;
12054
12247
  if (attempted.length > 0) {
12055
12248
  const applied = await this._applyOntologyBackfillBatch(
12056
12249
  entityId,
12057
12250
  { batch: attempted, classifications, ontologyUpdates: void 0 },
12058
- now
12251
+ now,
12252
+ "classifier",
12253
+ trigger
12059
12254
  );
12060
- aborted = applied.abortedOntologyOff;
12061
- if (!aborted) {
12255
+ abortedOntologyOff = applied.abortedOntologyOff;
12256
+ if (!abortedOntologyOff) {
12062
12257
  typed = applied.typed;
12063
12258
  failedValidation = invalidCount + applied.failedValidation;
12064
12259
  edgesAdded = applied.edgesAdded;
12065
12260
  }
12066
12261
  }
12067
12262
  const diagBuffer = new DiagnosticBuffer();
12068
- const diagBase = { entityId, operation: "ontologyBackfill", trigger: "call" };
12263
+ const diagBase = { entityId, operation: "ontologyBackfill", trigger };
12069
12264
  for (const o of outcomes) {
12070
- if (o.kind === "low_confidence") {
12265
+ if (o.kind === "abstain") {
12266
+ if (isEscalated(o)) continue;
12267
+ diagBuffer.push({ ...diagBase, code: "classification_abstained", detail: { factId: o.fact.id, writer: "classifier" } });
12268
+ } else if (o.kind === "low_confidence") {
12071
12269
  diagBuffer.push({ ...diagBase, code: "classification_low_confidence", detail: { factId: o.fact.id, reason: "below_threshold" } });
12072
12270
  } else if (o.kind === "invalid") {
12073
12271
  diagBuffer.push({ ...diagBase, code: "classification_invalid", detail: { factId: o.fact.id, reason: o.reason } });
@@ -12079,19 +12277,29 @@ DROP TRIGGER IF EXISTS ${ad};`);
12079
12277
  }
12080
12278
  diagBuffer.flush(this.options);
12081
12279
  const counts = await this.entryRepo.countUntypedByEntityId(entityId, recheckCutoff);
12082
- if (aborted) {
12083
- return { scanned: 0, typed: 0, failedValidation: 0, edgesAdded: 0, skipped, remaining: 0, deferred: counts.deferred, ...stopped ? { budgetStop: { requiredEstimate: stopped.requiredEstimate } } : {} };
12280
+ const budgetStop = stopped ? { requiredEstimate: stopped.requiredEstimate } : void 0;
12281
+ if (abortedOntologyOff) {
12282
+ return {
12283
+ result: { scanned: 0, typed: 0, failedValidation: 0, edgesAdded: 0, abstained: 0, skipped, remaining: 0, deferred: counts.deferred, ...budgetStop ? { budgetStop } : {} },
12284
+ escalated: [],
12285
+ abortedOntologyOff
12286
+ };
12084
12287
  }
12085
12288
  this.searchService.evictCache(entityId);
12086
12289
  return {
12087
- scanned: candidates.length - unattemptedCount,
12088
- typed,
12089
- failedValidation,
12090
- edgesAdded,
12091
- skipped,
12092
- remaining: counts.eligible,
12093
- deferred: counts.deferred,
12094
- ...stopped ? { budgetStop: { requiredEstimate: stopped.requiredEstimate } } : {}
12290
+ result: {
12291
+ scanned: candidates.length - unattemptedCount,
12292
+ typed,
12293
+ failedValidation,
12294
+ edgesAdded,
12295
+ abstained: abstainCount,
12296
+ skipped,
12297
+ remaining: counts.eligible,
12298
+ deferred: counts.deferred,
12299
+ ...budgetStop ? { budgetStop } : {}
12300
+ },
12301
+ escalated,
12302
+ abortedOntologyOff: false
12095
12303
  };
12096
12304
  }
12097
12305
  /**
@@ -12100,15 +12308,18 @@ DROP TRIGGER IF EXISTS ${ad};`);
12100
12308
  * the mid-flight `mode === 'off'` abort check keep the shape they had when a
12101
12309
  * pass was a single call.
12102
12310
  */
12103
- async _applyOntologyBackfillBatch(entityId, batchResult, now) {
12311
+ async _applyOntologyBackfillBatch(entityId, batchResult, now, writer, trigger) {
12104
12312
  const ontologyService = this.ontologyService;
12105
12313
  const { batch, classifications, ontologyUpdates } = batchResult;
12106
12314
  let typed = 0;
12107
12315
  let failedValidation = 0;
12108
12316
  let edgesAdded = 0;
12109
12317
  let abortedOntologyOff = false;
12318
+ const typedIds = [];
12319
+ const omittedIds = [];
12320
+ const classifiedIds = /* @__PURE__ */ new Set();
12110
12321
  const diagBuffer = new DiagnosticBuffer();
12111
- const diagBase = { entityId, operation: "ontologyBackfill", trigger: "call" };
12322
+ const diagBase = { entityId, operation: "ontologyBackfill", trigger };
12112
12323
  await this.db.withTransactionAsync(async (tx) => {
12113
12324
  let { mode: txMode, manifest } = await ontologyService.getEffectiveState(entityId, tx);
12114
12325
  if (txMode === "off") {
@@ -12133,6 +12344,7 @@ DROP TRIGGER IF EXISTS ${ad};`);
12133
12344
  continue;
12134
12345
  }
12135
12346
  applied.add(fact.id);
12347
+ classifiedIds.add(fact.id);
12136
12348
  const validationDrops = [];
12137
12349
  const normalized = ontologyService.validateAndNormalizeFact(
12138
12350
  {
@@ -12154,8 +12366,17 @@ DROP TRIGGER IF EXISTS ${ad};`);
12154
12366
  continue;
12155
12367
  }
12156
12368
  const result = await this.entryRepo.updateOkfType(fact.id, entityId, normalized.okf_type, tx);
12157
- if (result.changes === 0) continue;
12369
+ if (result.changes === 0) {
12370
+ omittedIds.push(fact.id);
12371
+ continue;
12372
+ }
12158
12373
  typed++;
12374
+ typedIds.push(fact.id);
12375
+ diagBuffer.push({
12376
+ ...diagBase,
12377
+ code: "node_type_assigned",
12378
+ detail: { factId: fact.id, okfType: normalized.okf_type, writer }
12379
+ });
12159
12380
  titleIndex.set(normalizeTitleKey(fact.title), { id: fact.id, okf_type: normalized.okf_type });
12160
12381
  if (normalized.edges.length > 0) {
12161
12382
  pendingEdges.push({ sourceId: fact.id, sourceType: normalized.okf_type, edges: normalized.edges });
@@ -12181,8 +12402,13 @@ DROP TRIGGER IF EXISTS ${ad};`);
12181
12402
  }
12182
12403
  await this.entryRepo.markOntologyChecked(batch.map((f) => f.id), entityId, now, tx);
12183
12404
  });
12405
+ if (!abortedOntologyOff) {
12406
+ for (const fact of batch) {
12407
+ if (!classifiedIds.has(fact.id)) omittedIds.push(fact.id);
12408
+ }
12409
+ }
12184
12410
  diagBuffer.flush(this.options);
12185
- return { typed, failedValidation, edgesAdded, abortedOntologyOff };
12411
+ return { typed, failedValidation, edgesAdded, abortedOntologyOff, typedIds, omittedIds };
12186
12412
  }
12187
12413
  _validatePruneDuration(value, name) {
12188
12414
  if (value !== null && value !== void 0 && (typeof value !== "number" || !isFinite(value) || value < 0)) {
@@ -12242,6 +12468,14 @@ DROP TRIGGER IF EXISTS ${ad};`);
12242
12468
  _MaintenanceService.FTS_SHADOW_SUFFIXES = ["_content", "_data", "_idx", "_docsize", "_config"];
12243
12469
  var MaintenanceService = _MaintenanceService;
12244
12470
 
12471
+ // src/utils/config/ontologyJobDefaults.ts
12472
+ var DEFAULT_ONTOLOGY_JOB_BATCH_SIZE = 50;
12473
+ function resolveOntologyJobDefaults(ontology) {
12474
+ const raw = ontology?.schedulerBatchSize;
12475
+ const batchSize = typeof raw === "number" && Number.isInteger(raw) && raw >= 1 ? raw : DEFAULT_ONTOLOGY_JOB_BATCH_SIZE;
12476
+ return { batchSize };
12477
+ }
12478
+
12245
12479
  // src/services/MaintenanceScheduler.ts
12246
12480
  var MaintenanceScheduler = class {
12247
12481
  constructor(db, options, maintenanceService, metadataRepo, eventRepo, entryRepo, jobManager, vectorRemovalService, vectorRemovalRepo) {
@@ -12254,6 +12488,8 @@ var MaintenanceScheduler = class {
12254
12488
  this.jobManager = jobManager;
12255
12489
  this.vectorRemovalService = vectorRemovalService;
12256
12490
  this.vectorRemovalRepo = vectorRemovalRepo;
12491
+ /** Batch size for scheduler-driven ontology passes; resolved once (spec §8). */
12492
+ this.schedulerBatchSize = resolveOntologyJobDefaults(this.options.config?.ontology).batchSize;
12257
12493
  }
12258
12494
  /**
12259
12495
  * Entities with **any** pending work only, sorted by `pendingEvents` desc
@@ -12286,14 +12522,16 @@ var MaintenanceScheduler = class {
12286
12522
  const healDue = eventCount - healCheckpoint >= autoHealThreshold;
12287
12523
  const reembedPending = canEmbed && await this.entryRepo.countReembedPending(entityId, MAX_EMBED_ATTEMPTS) > 0;
12288
12524
  const owedCount = owed.get(entityId) ?? 0;
12289
- if (pendingEvents > 0 || healDue || reembedPending || owedCount > 0) {
12525
+ const ontologyBackfillPending = await this.maintenanceService.pendingOntologyBackfill(entityId);
12526
+ if (pendingEvents > 0 || healDue || reembedPending || owedCount > 0 || ontologyBackfillPending > 0) {
12290
12527
  out.push({
12291
12528
  entityId,
12292
12529
  pendingEvents,
12293
12530
  pendingTokensEstimate: Math.ceil(chars / 4),
12294
12531
  healDue,
12295
12532
  reembedPending,
12296
- ...owedCount > 0 ? { pendingExternalDeletions: owedCount } : {}
12533
+ ...owedCount > 0 ? { pendingExternalDeletions: owedCount } : {},
12534
+ ...ontologyBackfillPending > 0 ? { pendingOntologyBackfill: ontologyBackfillPending } : {}
12297
12535
  });
12298
12536
  }
12299
12537
  }
@@ -12320,15 +12558,16 @@ var MaintenanceScheduler = class {
12320
12558
  const meter = new UsageMeter(opts.tokenBudget);
12321
12559
  const budget = opts.tokenBudget;
12322
12560
  const deadline = opts.deadlineMs !== void 0 ? Date.now() + Math.max(0, opts.deadlineMs) : Infinity;
12323
- const jobs = new Set(opts.jobs ?? ["librarian", "heal", "reembed", "externalDeletions"]);
12561
+ const jobs = new Set(opts.jobs ?? ["librarian", "heal", "reembed", "externalDeletions", "ontologyBackfill"]);
12324
12562
  const externalDeletions = await this.runExternalDeletions(opts.entityIds, jobs.has("externalDeletions"), deadline);
12325
- const pending = (await this.getPending(opts.entityIds)).filter((p) => p.pendingEvents > 0 || p.healDue || p.reembedPending);
12563
+ const pending = (await this.getPending(opts.entityIds)).filter((p) => p.pendingEvents > 0 || p.healDue || p.reembedPending || (p.pendingOntologyBackfill ?? 0) > 0);
12326
12564
  const states = pending.map((p) => ({
12327
12565
  p,
12328
- report: { entityId: p.entityId, librarianPasses: 0, factsWritten: 0, healPasses: 0, reembedded: false },
12566
+ report: { entityId: p.entityId, librarianPasses: 0, factsWritten: 0, healPasses: 0, reembedded: false, ontologyBackfillPasses: 0, typed: 0 },
12329
12567
  librarian: jobs.has("librarian") && p.pendingEvents > 0,
12330
12568
  heal: jobs.has("heal") && p.healDue,
12331
- reembed: jobs.has("reembed") && p.reembedPending
12569
+ reembed: jobs.has("reembed") && p.reembedPending,
12570
+ ontology: jobs.has("ontologyBackfill") && (p.pendingOntologyBackfill ?? 0) > 0
12332
12571
  }));
12333
12572
  let stopped = { reason: "complete" };
12334
12573
  let tooSmall = null;
@@ -12348,12 +12587,12 @@ var MaintenanceScheduler = class {
12348
12587
  var _a;
12349
12588
  ((_a = st.report).searchUnavailable ?? (_a.searchUnavailable = [])).push(job);
12350
12589
  };
12351
- const openJobs = () => states.reduce((n, s) => n + +s.librarian + +s.heal + +s.reembed, 0);
12590
+ const openJobs = () => states.reduce((n, s) => n + +s.librarian + +s.heal + +s.reembed + +s.ontology, 0);
12352
12591
  rounds: for (; ; ) {
12353
12592
  let progressed = false;
12354
12593
  const openAtStart = openJobs();
12355
12594
  for (const st of states) {
12356
- if (!st.librarian && !st.heal && !st.reembed) continue;
12595
+ if (!st.librarian && !st.heal && !st.reembed && !st.ontology) continue;
12357
12596
  if (Date.now() >= deadline) {
12358
12597
  stopped = { reason: "deadline" };
12359
12598
  break rounds;
@@ -12445,6 +12684,42 @@ var MaintenanceScheduler = class {
12445
12684
  else throw err;
12446
12685
  }
12447
12686
  }
12687
+ if (st.ontology) {
12688
+ if (Date.now() >= deadline) {
12689
+ stopped = { reason: "deadline" };
12690
+ break rounds;
12691
+ }
12692
+ st.ontology = false;
12693
+ if (this.jobManager.isBlocked("ontologyBackfill", entityId)) {
12694
+ markBusy(st, "ontologyBackfill");
12695
+ this.maintenanceService.noteOntologyBackfillHeld(entityId);
12696
+ progressed = true;
12697
+ continue;
12698
+ }
12699
+ this.jobManager.acquireLock("ontologyBackfill", entityId);
12700
+ let r;
12701
+ try {
12702
+ r = await this.maintenanceService.doRunOntologyBackfill(entityId, {
12703
+ meter,
12704
+ batchSize: this.schedulerBatchSize
12705
+ });
12706
+ } finally {
12707
+ this.jobManager.releaseLock("ontologyBackfill", entityId);
12708
+ }
12709
+ st.report.ontologyBackfillPasses++;
12710
+ st.report.typed += r.typed;
12711
+ progressed = true;
12712
+ if (r.budgetStop) {
12713
+ if (classify("ontologyBackfill", entityId, r.budgetStop.requiredEstimate) === "exhausted") {
12714
+ stopped = exhaustedStop();
12715
+ break rounds;
12716
+ }
12717
+ continue;
12718
+ }
12719
+ if (r.remaining === 0 || r.typed === 0) {
12720
+ continue;
12721
+ }
12722
+ }
12448
12723
  }
12449
12724
  if (!progressed && openJobs() === openAtStart) break;
12450
12725
  }
@@ -14739,7 +15014,8 @@ var OntologyService = class {
14739
15014
  return buildOntologyPromptAppendix(mode, manifestJson);
14740
15015
  }
14741
15016
  async mergeEmergentUpdates(entityId, updates, tx) {
14742
- const merged = await this.metadataRepo.mergeManifestUpdates(entityId, updates, tx);
15017
+ const filtered = updates.node_types ? { ...updates, node_types: updates.node_types.filter((nt) => !isReservedAbstainSlug(nt.type)) } : updates;
15018
+ const merged = await this.metadataRepo.mergeManifestUpdates(entityId, filtered, tx);
14743
15019
  this.invalidateCache(entityId);
14744
15020
  return merged;
14745
15021
  }
@@ -16334,6 +16610,13 @@ var WikiMemory = class {
16334
16610
  }
16335
16611
  for (const entry of entries) {
16336
16612
  validateManifest(entry.manifest);
16613
+ for (const nodeType of entry.manifest.node_types ?? []) {
16614
+ if (isReservedAbstainSlug(nodeType.type)) {
16615
+ throw new Error(
16616
+ `Invalid node type '${nodeType.type}': '${ONTOLOGY_ABSTAIN_SENTINEL}' is reserved for classifier abstention and cannot be declared in a manifest`
16617
+ );
16618
+ }
16619
+ }
16337
16620
  }
16338
16621
  const written = [];
16339
16622
  const skipped = [];
@@ -17447,12 +17730,15 @@ function createWiki(db, options) {
17447
17730
  return new WikiMemory(db, options);
17448
17731
  }
17449
17732
 
17733
+ exports.CLASSIFIER_MAX_CHOICES = CLASSIFIER_MAX_CHOICES;
17450
17734
  exports.CheckpointIncompleteError = CheckpointIncompleteError;
17451
17735
  exports.DEFAULT_CHUNK_OVERLAP = DEFAULT_CHUNK_OVERLAP;
17452
17736
  exports.DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT = DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT;
17453
17737
  exports.DEFAULT_MAX_CHUNK_LENGTH = DEFAULT_MAX_CHUNK_LENGTH;
17454
17738
  exports.DEFAULT_MAX_EMBED_CHARS = DEFAULT_MAX_EMBED_CHARS;
17739
+ exports.DEFAULT_ONTOLOGY_JOB_BATCH_SIZE = DEFAULT_ONTOLOGY_JOB_BATCH_SIZE;
17455
17740
  exports.DEFAULT_SETUP_BUDGET_MS = DEFAULT_SETUP_BUDGET_MS;
17741
+ exports.DEFAULT_TYPING_MIN_CONFIDENCE = DEFAULT_TYPING_MIN_CONFIDENCE;
17456
17742
  exports.EMBED_CHARS_CEILING = EMBED_CHARS_CEILING;
17457
17743
  exports.EraseStepError = EraseStepError;
17458
17744
  exports.HEAL_ANCHORS_PER_CANDIDATE = HEAL_ANCHORS_PER_CANDIDATE;
@@ -17461,6 +17747,7 @@ exports.HEAL_MAX_FACT_BODY_CHARS_L3 = HEAL_MAX_FACT_BODY_CHARS_L3;
17461
17747
  exports.HEAL_MAX_TASKS = HEAL_MAX_TASKS;
17462
17748
  exports.HEAL_RECHECK_MS = HEAL_RECHECK_MS;
17463
17749
  exports.HOOK_TIMEOUT_MARKER = HOOK_TIMEOUT_MARKER;
17750
+ exports.ONTOLOGY_ABSTAIN_SENTINEL = ONTOLOGY_ABSTAIN_SENTINEL;
17464
17751
  exports.ONTOLOGY_BACKFILL_BATCH_SIZE = ONTOLOGY_BACKFILL_BATCH_SIZE;
17465
17752
  exports.ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS = ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS;
17466
17753
  exports.ONTOLOGY_BACKFILL_RECHECK_MS = ONTOLOGY_BACKFILL_RECHECK_MS;
@@ -17491,13 +17778,18 @@ exports.formatGraphContext = formatGraphContext;
17491
17778
  exports.formatMemoryDump = formatMemoryDump;
17492
17779
  exports.formatOkfBundle = formatOkfBundle;
17493
17780
  exports.hydrateLibrarianPrompt = hydrateLibrarianPrompt;
17781
+ exports.isReservedAbstainSlug = isReservedAbstainSlug;
17494
17782
  exports.isWikiSearchUnavailableError = isWikiSearchUnavailableError;
17495
17783
  exports.mapLibrarianOptionsToReadOptions = mapLibrarianOptionsToReadOptions;
17496
17784
  exports.parseEmbedding = parseEmbedding;
17497
17785
  exports.parseOkfBundle = parseOkfBundle;
17786
+ exports.resolveOntologyJobDefaults = resolveOntologyJobDefaults;
17787
+ exports.resolveSystemOneTyping = resolveSystemOneTyping;
17788
+ exports.resolveTypingMinConfidence = resolveTypingMinConfidence;
17498
17789
  exports.safeSlice = safeSlice;
17499
17790
  exports.validUsage = validUsage;
17500
17791
  exports.validateLibrarianPromptTemplate = validateLibrarianPromptTemplate;
17501
17792
  exports.validateManifest = validateManifest;
17793
+ exports.warnOnce = warnOnce;
17502
17794
  //# sourceMappingURL=index.js.map
17503
17795
  //# sourceMappingURL=index.js.map