@equationalapplications/core-llm-wiki 9.12.0 → 9.13.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/{chunk-KB37MGFF.mjs → chunk-4TG7RQF6.mjs} +94 -5
- package/dist/chunk-4TG7RQF6.mjs.map +1 -0
- package/dist/index.d.mts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +93 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-imNjsm-X.d.mts → testing-DkKZcrhE.d.mts} +19 -4
- package/dist/{testing-imNjsm-X.d.ts → testing-DkKZcrhE.d.ts} +19 -4
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +91 -2
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-KB37MGFF.mjs.map +0 -1
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, O as OntologyMode, W as WikiConfig, R as ReadOptions, c as OntologyConfig, S as SQLiteAdapter, d as WikiOptions, e as WikiMemory } from './testing-
|
|
2
|
-
export { C as CLASSIFIER_MAX_CHOICES, f as CheckpointIncompleteError, g as ChunkFailure, h as ClassifierAnswer, i as ClassifierQuestion, j as ClassifyRequest, k as ClassifyResponse, D as DegradedRecord, l as DraftPage, E as EmbedFactResult, m as EmbedFailureKind, n as EmbeddingMarkerKind, o as EntityMaintenanceReport, p as EntityStatus, q as EraseReport, r as EraseStepError, s as ExtractedFact, t as ExtractedFactEdge, u as ExtractedFactWithOntology, v as ExtractedTask, w as ForgetParams, x as ForgetResult, y as GraphTraversalOptions, z as GroundingConfig, H as HEAL_BATCH_SIZE, A as HEAL_RECHECK_MS, B as HOOK_TIMEOUT_MARKER, I as HealResult, J as ImportDumpResult, K as IngestDocumentResult, L as LLMProvider, N as LibrarianConfig, P as LibrarianGateConfig, Q as LockedMaintenanceJob, T as MaintenanceJob, U as MaintenanceStopReason, V as MemoryDumpEntity, X as MigrationPolicy, Y as ONTOLOGY_ABSTAIN_SENTINEL, Z as ONTOLOGY_BACKFILL_BATCH_SIZE, _ as ONTOLOGY_BACKFILL_RECHECK_MS, $ as OntologyBackfillResult, a0 as OntologyEdgeType, a1 as OntologyManifest, a2 as OntologyNodeType, a3 as OntologyPromptContext, a4 as OntologyUpdates, a5 as PendingMaintenance, a6 as PendingMigrationWork, a7 as PendingSourceStatus, a8 as PromptOverrides, a9 as PromptService, aa as PrunePartialFailureError, ab as ReembedResult, ac as RememberInput, ad as RunPendingMaintenanceOptions, ae as RunPendingMaintenanceResult, af as SourcePassage, ag as StoreSourceResult, ah as StoredSource, ai as StoredSourceDump, aj as StoredSourceSummary, ak as SupersedeReplacement, al as SystemOneConfig, am as SystemOneThresholdSite, an as VectorRanker, ao as VectorRankerFallback, ap as VectorRankerRankArgs, aq as VectorRankerSemanticResult, ar as WikiBusyError, as as WikiBusyOperation, at as WikiCheckpoint, au as WikiDiagnostic, av as WikiDiagnosticCode, aw as WikiDiagnosticDetail, ax as WikiDiagnosticOperation, ay as WikiDiagnosticSeverity, az as WikiDiagnosticTrigger, aA as WikiDraftNotFound, aB as WikiDuplicateHashError, aC as WikiEdge, aD as WikiEvent, aE as WikiExternalDeletionError, aF as WikiFact, aG as WikiGraphNodeOwnershipConflict, aH as WikiIngestEmptyError, aI as WikiInstructions, aJ as WikiInvalidReadOptions, aK as WikiLintReport, aL as WikiMemoryTestAccess, aM as WikiMigrationRequiredError, aN as WikiOutboxEvent, aO as WikiParseError, aP as WikiSearchUnavailableError, aQ as WikiSourcePointer, aR as WikiSourceRefHashCollision, aS as WikiStrictOntologyViolation, aT as WikiSupersedeError, aU as WikiSupersedeReason, aV as WikiTask, aW as WikiTransactionError, aX as isReservedAbstainSlug, aY as isWikiSearchUnavailableError, aZ as validateManifest } from './testing-
|
|
1
|
+
import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyMode, W as WikiConfig, R as ReadOptions, c as OntologyConfig, S as SQLiteAdapter, d as WikiOptions, e as WikiMemory } from './testing-DkKZcrhE.mjs';
|
|
2
|
+
export { C as CLASSIFIER_MAX_CHOICES, f as CheckpointIncompleteError, g as ChunkFailure, h as ClassifierAnswer, i as ClassifierQuestion, j as ClassifyRequest, k as ClassifyResponse, D as DegradedRecord, l as DraftPage, E as EmbedFactResult, m as EmbedFailureKind, n as EmbeddingMarkerKind, o as EntityMaintenanceReport, p as EntityStatus, q as EraseReport, r as EraseStepError, s as ExtractedFact, t as ExtractedFactEdge, u as ExtractedFactWithOntology, v as ExtractedTask, w as ForgetParams, x as ForgetResult, y as GraphTraversalOptions, z as GroundingConfig, H as HEAL_BATCH_SIZE, A as HEAL_RECHECK_MS, B as HOOK_TIMEOUT_MARKER, I as HealResult, J as ImportDumpResult, K as IngestDocumentResult, L as LLMProvider, N as LibrarianConfig, P as LibrarianGateConfig, Q as LockedMaintenanceJob, T as MaintenanceJob, U as MaintenanceStopReason, V as MemoryDumpEntity, X as MigrationPolicy, Y as ONTOLOGY_ABSTAIN_SENTINEL, Z as ONTOLOGY_BACKFILL_BATCH_SIZE, _ as ONTOLOGY_BACKFILL_RECHECK_MS, $ as OntologyBackfillResult, a0 as OntologyEdgeType, a1 as OntologyManifest, a2 as OntologyNodeType, a3 as OntologyPromptContext, a4 as OntologyUpdates, a5 as PendingMaintenance, a6 as PendingMigrationWork, a7 as PendingSourceStatus, a8 as PromptOverrides, a9 as PromptService, aa as PrunePartialFailureError, ab as ReembedResult, ac as RememberInput, ad as RunPendingMaintenanceOptions, ae as RunPendingMaintenanceResult, af as SourcePassage, ag as StoreSourceResult, ah as StoredSource, ai as StoredSourceDump, aj as StoredSourceSummary, ak as SupersedeReplacement, al as SystemOneConfig, am as SystemOneThresholdSite, an as VectorRanker, ao as VectorRankerFallback, ap as VectorRankerRankArgs, aq as VectorRankerSemanticResult, ar as WikiBusyError, as as WikiBusyOperation, at as WikiCheckpoint, au as WikiDiagnostic, av as WikiDiagnosticCode, aw as WikiDiagnosticDetail, ax as WikiDiagnosticOperation, ay as WikiDiagnosticSeverity, az as WikiDiagnosticTrigger, aA as WikiDraftNotFound, aB as WikiDuplicateHashError, aC as WikiEdge, aD as WikiEvent, aE as WikiExternalDeletionError, aF as WikiFact, aG as WikiGraphNodeOwnershipConflict, aH as WikiIngestEmptyError, aI as WikiInstructions, aJ as WikiInvalidReadOptions, aK as WikiLintReport, aL as WikiMemoryTestAccess, aM as WikiMigrationRequiredError, aN as WikiOutboxEvent, aO as WikiParseError, aP as WikiSearchUnavailableError, aQ as WikiSourcePointer, aR as WikiSourceRefHashCollision, aS as WikiStrictOntologyViolation, aT as WikiSupersedeError, aU as WikiSupersedeReason, aV as WikiTask, aW as WikiTransactionError, aX as isReservedAbstainSlug, aY as isWikiSearchUnavailableError, aZ as validateManifest } from './testing-DkKZcrhE.mjs';
|
|
3
3
|
import { OkfFile } from '@equationalapplications/core-okf';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -240,6 +240,12 @@ declare function resolveSystemOneTyping(config: WikiConfig | undefined, classifi
|
|
|
240
240
|
* as unset. No legacy chain and no call option.
|
|
241
241
|
*/
|
|
242
242
|
declare function resolveSystemOneEdges(config: WikiConfig | undefined): 'auto' | 'llm';
|
|
243
|
+
/**
|
|
244
|
+
* Resolve-mode resolution (specs/resolution-system-one §2): `systemOne.resolve`
|
|
245
|
+
* → `'llm'`. A present non-`'auto'`/non-`'llm'` value warns once and is treated
|
|
246
|
+
* as unset. No legacy chain and no call option.
|
|
247
|
+
*/
|
|
248
|
+
declare function resolveSystemOneResolve(config: WikiConfig | undefined): 'auto' | 'llm';
|
|
243
249
|
/** Engine default confidence floor for classifier typing. */
|
|
244
250
|
declare const DEFAULT_TYPING_MIN_CONFIDENCE: 0.5;
|
|
245
251
|
/**
|
|
@@ -257,10 +263,19 @@ declare function resolveTypingMinConfidence(config: WikiConfig | undefined): num
|
|
|
257
263
|
* (the site then resolves `'llm'`). Under `'llm'` or unset it reads nothing.
|
|
258
264
|
*/
|
|
259
265
|
declare function resolveEdgesMinConfidence(config: WikiConfig | undefined): number | undefined;
|
|
266
|
+
/**
|
|
267
|
+
* Resolution-screen floor (specs/resolution-system-one §3): returns the
|
|
268
|
+
* `systemOne.minConfidence.resolve` floor only when the resolve mode resolves
|
|
269
|
+
* `'auto'` and the floor is a finite number in [0.5, 1]. There is no default
|
|
270
|
+
* floor: a missing or out-of-domain value warns once and returns `undefined`
|
|
271
|
+
* (the site then resolves `'llm'`). Under `'llm'` or unset it reads nothing.
|
|
272
|
+
* The floor is mandatory because a wrong NOOP drops a live fact.
|
|
273
|
+
*/
|
|
274
|
+
declare function resolveResolveMinConfidence(config: WikiConfig | undefined): number | undefined;
|
|
260
275
|
|
|
261
276
|
declare const ONTOLOGY_BACKFILL_SYSTEM_PROMPT = "You are a knowledge classification agent. You will receive existing memory facts that currently have no ontology type. For each input fact { \"id\", \"title\", \"body\", \"tags\" }, assign the best matching okf_type from the ontology manifest and optionally propose edges to related facts by title.\nReturn ONLY a valid JSON object matching this schema:\n{\n \"classifications\": [\n { \"id\": \"string (input fact id, copied verbatim)\", \"okf_type\": \"string (manifest node type slug)\", \"edges\": [{ \"edge_type\": \"string\", \"target_title\": \"string\" }] }\n ]\n}\nIf no manifest type fits a fact, assign the closest type the fact is an example of; omit that fact from \"classifications\" only when no type applies even broadly. Use the manifest slug EXACTLY as spelled (spelling variants are folded to the manifest form).\nWhen echoing an existing fact's title verbatim into \"target_title\", preserve every JSON escape sequence (\\\", \\n, \\\\, \\/) exactly as it appeared in the input body \u2014 do not strip backslashes, do not add unescaped quotes. Do not return markdown, just raw JSON.";
|
|
262
277
|
|
|
263
278
|
declare function createWiki(db: SQLiteAdapter, options: WikiOptions): WikiMemory;
|
|
264
279
|
|
|
265
|
-
export { DEFAULT_CHUNK_OVERLAP, DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DEFAULT_ONTOLOGY_JOB_BATCH_SIZE, DEFAULT_SETUP_BUDGET_MS, DEFAULT_TYPING_MIN_CONFIDENCE, EMBED_CHARS_CEILING, FormatContextOptions, FormattedMemoryDump, GraphNeighborhood, HEAL_ANCHORS_PER_CANDIDATE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, MemoryBundle, MemoryDump, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, OntologyConfig, OntologyMode, ReadOptions, SQLiteAdapter, WikiConfig, WikiMemory, WikiOptions, buildOntologyPromptAppendix, chunkText, configureRandomSource, createWiki, estimateTokensWith, formatContext, formatGraphContext, formatMemoryDump, formatOkfBundle, hydrateLibrarianPrompt, mapLibrarianOptionsToReadOptions, parseEmbedding, parseOkfBundle, resolveContextBudget, resolveDefaultChunkLength, resolveEdgesMinConfidence, resolveMaxPromptChars, resolveOntologyJobDefaults, resolveSystemOneEdges, resolveSystemOneTyping, resolveTypingMinConfidence, safeSlice, validUsage, validateLibrarianPromptTemplate, warnOnce };
|
|
280
|
+
export { DEFAULT_CHUNK_OVERLAP, DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DEFAULT_ONTOLOGY_JOB_BATCH_SIZE, DEFAULT_SETUP_BUDGET_MS, DEFAULT_TYPING_MIN_CONFIDENCE, EMBED_CHARS_CEILING, FormatContextOptions, FormattedMemoryDump, GraphNeighborhood, HEAL_ANCHORS_PER_CANDIDATE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, MemoryBundle, MemoryDump, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, OntologyConfig, OntologyMode, ReadOptions, SQLiteAdapter, WikiConfig, WikiMemory, WikiOptions, buildOntologyPromptAppendix, chunkText, configureRandomSource, createWiki, estimateTokensWith, formatContext, formatGraphContext, formatMemoryDump, formatOkfBundle, hydrateLibrarianPrompt, mapLibrarianOptionsToReadOptions, parseEmbedding, parseOkfBundle, resolveContextBudget, resolveDefaultChunkLength, resolveEdgesMinConfidence, resolveMaxPromptChars, resolveOntologyJobDefaults, resolveResolveMinConfidence, resolveSystemOneEdges, resolveSystemOneResolve, resolveSystemOneTyping, resolveTypingMinConfidence, safeSlice, validUsage, validateLibrarianPromptTemplate, warnOnce };
|
|
266
281
|
export type { ContextBudget, FormatOkfBundleOptions, LibrarianOptions, LibrarianPromptVariables, OkfFormatProfile, OkfImportOptions };
|
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, O as OntologyMode, W as WikiConfig, R as ReadOptions, c as OntologyConfig, S as SQLiteAdapter, d as WikiOptions, e as WikiMemory } from './testing-
|
|
2
|
-
export { C as CLASSIFIER_MAX_CHOICES, f as CheckpointIncompleteError, g as ChunkFailure, h as ClassifierAnswer, i as ClassifierQuestion, j as ClassifyRequest, k as ClassifyResponse, D as DegradedRecord, l as DraftPage, E as EmbedFactResult, m as EmbedFailureKind, n as EmbeddingMarkerKind, o as EntityMaintenanceReport, p as EntityStatus, q as EraseReport, r as EraseStepError, s as ExtractedFact, t as ExtractedFactEdge, u as ExtractedFactWithOntology, v as ExtractedTask, w as ForgetParams, x as ForgetResult, y as GraphTraversalOptions, z as GroundingConfig, H as HEAL_BATCH_SIZE, A as HEAL_RECHECK_MS, B as HOOK_TIMEOUT_MARKER, I as HealResult, J as ImportDumpResult, K as IngestDocumentResult, L as LLMProvider, N as LibrarianConfig, P as LibrarianGateConfig, Q as LockedMaintenanceJob, T as MaintenanceJob, U as MaintenanceStopReason, V as MemoryDumpEntity, X as MigrationPolicy, Y as ONTOLOGY_ABSTAIN_SENTINEL, Z as ONTOLOGY_BACKFILL_BATCH_SIZE, _ as ONTOLOGY_BACKFILL_RECHECK_MS, $ as OntologyBackfillResult, a0 as OntologyEdgeType, a1 as OntologyManifest, a2 as OntologyNodeType, a3 as OntologyPromptContext, a4 as OntologyUpdates, a5 as PendingMaintenance, a6 as PendingMigrationWork, a7 as PendingSourceStatus, a8 as PromptOverrides, a9 as PromptService, aa as PrunePartialFailureError, ab as ReembedResult, ac as RememberInput, ad as RunPendingMaintenanceOptions, ae as RunPendingMaintenanceResult, af as SourcePassage, ag as StoreSourceResult, ah as StoredSource, ai as StoredSourceDump, aj as StoredSourceSummary, ak as SupersedeReplacement, al as SystemOneConfig, am as SystemOneThresholdSite, an as VectorRanker, ao as VectorRankerFallback, ap as VectorRankerRankArgs, aq as VectorRankerSemanticResult, ar as WikiBusyError, as as WikiBusyOperation, at as WikiCheckpoint, au as WikiDiagnostic, av as WikiDiagnosticCode, aw as WikiDiagnosticDetail, ax as WikiDiagnosticOperation, ay as WikiDiagnosticSeverity, az as WikiDiagnosticTrigger, aA as WikiDraftNotFound, aB as WikiDuplicateHashError, aC as WikiEdge, aD as WikiEvent, aE as WikiExternalDeletionError, aF as WikiFact, aG as WikiGraphNodeOwnershipConflict, aH as WikiIngestEmptyError, aI as WikiInstructions, aJ as WikiInvalidReadOptions, aK as WikiLintReport, aL as WikiMemoryTestAccess, aM as WikiMigrationRequiredError, aN as WikiOutboxEvent, aO as WikiParseError, aP as WikiSearchUnavailableError, aQ as WikiSourcePointer, aR as WikiSourceRefHashCollision, aS as WikiStrictOntologyViolation, aT as WikiSupersedeError, aU as WikiSupersedeReason, aV as WikiTask, aW as WikiTransactionError, aX as isReservedAbstainSlug, aY as isWikiSearchUnavailableError, aZ as validateManifest } from './testing-
|
|
1
|
+
import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyMode, W as WikiConfig, R as ReadOptions, c as OntologyConfig, S as SQLiteAdapter, d as WikiOptions, e as WikiMemory } from './testing-DkKZcrhE.js';
|
|
2
|
+
export { C as CLASSIFIER_MAX_CHOICES, f as CheckpointIncompleteError, g as ChunkFailure, h as ClassifierAnswer, i as ClassifierQuestion, j as ClassifyRequest, k as ClassifyResponse, D as DegradedRecord, l as DraftPage, E as EmbedFactResult, m as EmbedFailureKind, n as EmbeddingMarkerKind, o as EntityMaintenanceReport, p as EntityStatus, q as EraseReport, r as EraseStepError, s as ExtractedFact, t as ExtractedFactEdge, u as ExtractedFactWithOntology, v as ExtractedTask, w as ForgetParams, x as ForgetResult, y as GraphTraversalOptions, z as GroundingConfig, H as HEAL_BATCH_SIZE, A as HEAL_RECHECK_MS, B as HOOK_TIMEOUT_MARKER, I as HealResult, J as ImportDumpResult, K as IngestDocumentResult, L as LLMProvider, N as LibrarianConfig, P as LibrarianGateConfig, Q as LockedMaintenanceJob, T as MaintenanceJob, U as MaintenanceStopReason, V as MemoryDumpEntity, X as MigrationPolicy, Y as ONTOLOGY_ABSTAIN_SENTINEL, Z as ONTOLOGY_BACKFILL_BATCH_SIZE, _ as ONTOLOGY_BACKFILL_RECHECK_MS, $ as OntologyBackfillResult, a0 as OntologyEdgeType, a1 as OntologyManifest, a2 as OntologyNodeType, a3 as OntologyPromptContext, a4 as OntologyUpdates, a5 as PendingMaintenance, a6 as PendingMigrationWork, a7 as PendingSourceStatus, a8 as PromptOverrides, a9 as PromptService, aa as PrunePartialFailureError, ab as ReembedResult, ac as RememberInput, ad as RunPendingMaintenanceOptions, ae as RunPendingMaintenanceResult, af as SourcePassage, ag as StoreSourceResult, ah as StoredSource, ai as StoredSourceDump, aj as StoredSourceSummary, ak as SupersedeReplacement, al as SystemOneConfig, am as SystemOneThresholdSite, an as VectorRanker, ao as VectorRankerFallback, ap as VectorRankerRankArgs, aq as VectorRankerSemanticResult, ar as WikiBusyError, as as WikiBusyOperation, at as WikiCheckpoint, au as WikiDiagnostic, av as WikiDiagnosticCode, aw as WikiDiagnosticDetail, ax as WikiDiagnosticOperation, ay as WikiDiagnosticSeverity, az as WikiDiagnosticTrigger, aA as WikiDraftNotFound, aB as WikiDuplicateHashError, aC as WikiEdge, aD as WikiEvent, aE as WikiExternalDeletionError, aF as WikiFact, aG as WikiGraphNodeOwnershipConflict, aH as WikiIngestEmptyError, aI as WikiInstructions, aJ as WikiInvalidReadOptions, aK as WikiLintReport, aL as WikiMemoryTestAccess, aM as WikiMigrationRequiredError, aN as WikiOutboxEvent, aO as WikiParseError, aP as WikiSearchUnavailableError, aQ as WikiSourcePointer, aR as WikiSourceRefHashCollision, aS as WikiStrictOntologyViolation, aT as WikiSupersedeError, aU as WikiSupersedeReason, aV as WikiTask, aW as WikiTransactionError, aX as isReservedAbstainSlug, aY as isWikiSearchUnavailableError, aZ as validateManifest } from './testing-DkKZcrhE.js';
|
|
3
3
|
import { OkfFile } from '@equationalapplications/core-okf';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -240,6 +240,12 @@ declare function resolveSystemOneTyping(config: WikiConfig | undefined, classifi
|
|
|
240
240
|
* as unset. No legacy chain and no call option.
|
|
241
241
|
*/
|
|
242
242
|
declare function resolveSystemOneEdges(config: WikiConfig | undefined): 'auto' | 'llm';
|
|
243
|
+
/**
|
|
244
|
+
* Resolve-mode resolution (specs/resolution-system-one §2): `systemOne.resolve`
|
|
245
|
+
* → `'llm'`. A present non-`'auto'`/non-`'llm'` value warns once and is treated
|
|
246
|
+
* as unset. No legacy chain and no call option.
|
|
247
|
+
*/
|
|
248
|
+
declare function resolveSystemOneResolve(config: WikiConfig | undefined): 'auto' | 'llm';
|
|
243
249
|
/** Engine default confidence floor for classifier typing. */
|
|
244
250
|
declare const DEFAULT_TYPING_MIN_CONFIDENCE: 0.5;
|
|
245
251
|
/**
|
|
@@ -257,10 +263,19 @@ declare function resolveTypingMinConfidence(config: WikiConfig | undefined): num
|
|
|
257
263
|
* (the site then resolves `'llm'`). Under `'llm'` or unset it reads nothing.
|
|
258
264
|
*/
|
|
259
265
|
declare function resolveEdgesMinConfidence(config: WikiConfig | undefined): number | undefined;
|
|
266
|
+
/**
|
|
267
|
+
* Resolution-screen floor (specs/resolution-system-one §3): returns the
|
|
268
|
+
* `systemOne.minConfidence.resolve` floor only when the resolve mode resolves
|
|
269
|
+
* `'auto'` and the floor is a finite number in [0.5, 1]. There is no default
|
|
270
|
+
* floor: a missing or out-of-domain value warns once and returns `undefined`
|
|
271
|
+
* (the site then resolves `'llm'`). Under `'llm'` or unset it reads nothing.
|
|
272
|
+
* The floor is mandatory because a wrong NOOP drops a live fact.
|
|
273
|
+
*/
|
|
274
|
+
declare function resolveResolveMinConfidence(config: WikiConfig | undefined): number | undefined;
|
|
260
275
|
|
|
261
276
|
declare const ONTOLOGY_BACKFILL_SYSTEM_PROMPT = "You are a knowledge classification agent. You will receive existing memory facts that currently have no ontology type. For each input fact { \"id\", \"title\", \"body\", \"tags\" }, assign the best matching okf_type from the ontology manifest and optionally propose edges to related facts by title.\nReturn ONLY a valid JSON object matching this schema:\n{\n \"classifications\": [\n { \"id\": \"string (input fact id, copied verbatim)\", \"okf_type\": \"string (manifest node type slug)\", \"edges\": [{ \"edge_type\": \"string\", \"target_title\": \"string\" }] }\n ]\n}\nIf no manifest type fits a fact, assign the closest type the fact is an example of; omit that fact from \"classifications\" only when no type applies even broadly. Use the manifest slug EXACTLY as spelled (spelling variants are folded to the manifest form).\nWhen echoing an existing fact's title verbatim into \"target_title\", preserve every JSON escape sequence (\\\", \\n, \\\\, \\/) exactly as it appeared in the input body \u2014 do not strip backslashes, do not add unescaped quotes. Do not return markdown, just raw JSON.";
|
|
262
277
|
|
|
263
278
|
declare function createWiki(db: SQLiteAdapter, options: WikiOptions): WikiMemory;
|
|
264
279
|
|
|
265
|
-
export { DEFAULT_CHUNK_OVERLAP, DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DEFAULT_ONTOLOGY_JOB_BATCH_SIZE, DEFAULT_SETUP_BUDGET_MS, DEFAULT_TYPING_MIN_CONFIDENCE, EMBED_CHARS_CEILING, FormatContextOptions, FormattedMemoryDump, GraphNeighborhood, HEAL_ANCHORS_PER_CANDIDATE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, MemoryBundle, MemoryDump, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, OntologyConfig, OntologyMode, ReadOptions, SQLiteAdapter, WikiConfig, WikiMemory, WikiOptions, buildOntologyPromptAppendix, chunkText, configureRandomSource, createWiki, estimateTokensWith, formatContext, formatGraphContext, formatMemoryDump, formatOkfBundle, hydrateLibrarianPrompt, mapLibrarianOptionsToReadOptions, parseEmbedding, parseOkfBundle, resolveContextBudget, resolveDefaultChunkLength, resolveEdgesMinConfidence, resolveMaxPromptChars, resolveOntologyJobDefaults, resolveSystemOneEdges, resolveSystemOneTyping, resolveTypingMinConfidence, safeSlice, validUsage, validateLibrarianPromptTemplate, warnOnce };
|
|
280
|
+
export { DEFAULT_CHUNK_OVERLAP, DEFAULT_LIBRARIAN_SYNTHESIS_PROMPT, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DEFAULT_ONTOLOGY_JOB_BATCH_SIZE, DEFAULT_SETUP_BUDGET_MS, DEFAULT_TYPING_MIN_CONFIDENCE, EMBED_CHARS_CEILING, FormatContextOptions, FormattedMemoryDump, GraphNeighborhood, HEAL_ANCHORS_PER_CANDIDATE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, MemoryBundle, MemoryDump, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, OntologyConfig, OntologyMode, ReadOptions, SQLiteAdapter, WikiConfig, WikiMemory, WikiOptions, buildOntologyPromptAppendix, chunkText, configureRandomSource, createWiki, estimateTokensWith, formatContext, formatGraphContext, formatMemoryDump, formatOkfBundle, hydrateLibrarianPrompt, mapLibrarianOptionsToReadOptions, parseEmbedding, parseOkfBundle, resolveContextBudget, resolveDefaultChunkLength, resolveEdgesMinConfidence, resolveMaxPromptChars, resolveOntologyJobDefaults, resolveResolveMinConfidence, resolveSystemOneEdges, resolveSystemOneResolve, resolveSystemOneTyping, resolveTypingMinConfidence, safeSlice, validUsage, validateLibrarianPromptTemplate, warnOnce };
|
|
266
281
|
export type { ContextBudget, FormatOkfBundleOptions, LibrarianOptions, LibrarianPromptVariables, OkfFormatProfile, OkfImportOptions };
|
package/dist/index.js
CHANGED
|
@@ -9173,6 +9173,16 @@ function resolveSystemOneEdges(config) {
|
|
|
9173
9173
|
}
|
|
9174
9174
|
return edges ?? "llm";
|
|
9175
9175
|
}
|
|
9176
|
+
function resolveSystemOneResolve(config) {
|
|
9177
|
+
const resolve = config?.systemOne?.resolve;
|
|
9178
|
+
if (resolve !== void 0 && !isTypingMode(resolve)) {
|
|
9179
|
+
warnOnce(
|
|
9180
|
+
`[core-llm-wiki] systemOne: \`systemOne.resolve\` is ${formatConfigValue(resolve)}, which is not 'auto' or 'llm'. The key is treated as unset; the default ('llm') applies.`
|
|
9181
|
+
);
|
|
9182
|
+
return "llm";
|
|
9183
|
+
}
|
|
9184
|
+
return resolve ?? "llm";
|
|
9185
|
+
}
|
|
9176
9186
|
var DEFAULT_SHORTLIST_K = 10;
|
|
9177
9187
|
function resolveShortlistK(config) {
|
|
9178
9188
|
const k = config?.ontology?.shortlistK;
|
|
@@ -9212,6 +9222,15 @@ function resolveEdgesMinConfidence(config) {
|
|
|
9212
9222
|
);
|
|
9213
9223
|
return void 0;
|
|
9214
9224
|
}
|
|
9225
|
+
function resolveResolveMinConfidence(config) {
|
|
9226
|
+
if (resolveSystemOneResolve(config) !== "auto") return void 0;
|
|
9227
|
+
const floor = config?.systemOne?.minConfidence?.resolve;
|
|
9228
|
+
if (isEdgesFloor(floor)) return floor;
|
|
9229
|
+
warnOnce(
|
|
9230
|
+
floor === void 0 ? "[core-llm-wiki] systemOne: `systemOne.minConfidence.resolve` is required when `systemOne.resolve` is 'auto'. A wrong NOOP drops a live fact, so there is no default floor. The resolution screen is off; resolution stays on the generative path." : `[core-llm-wiki] systemOne: \`systemOne.minConfidence.resolve\` is ${formatConfigValue(floor)}, which is not a finite number in [0.5, 1]. A wrong NOOP drops a live fact, so the resolution screen is off; resolution stays on the generative path.`
|
|
9231
|
+
);
|
|
9232
|
+
return void 0;
|
|
9233
|
+
}
|
|
9215
9234
|
|
|
9216
9235
|
// src/repositories/VectorRemovalRepository.ts
|
|
9217
9236
|
var CHUNK2 = 500;
|
|
@@ -10492,6 +10511,46 @@ async function gateCandidates(deps, ctx, candidates, cfg) {
|
|
|
10492
10511
|
}
|
|
10493
10512
|
|
|
10494
10513
|
// src/services/librarian/ops/resolve.ts
|
|
10514
|
+
async function screenResolveCandidates(ambiguous, mode, floor, ask) {
|
|
10515
|
+
const whole = (warnReason) => warnReason ? { settled: /* @__PURE__ */ new Map(), rest: ambiguous, warnReason } : { settled: /* @__PURE__ */ new Map(), rest: ambiguous };
|
|
10516
|
+
if (mode !== "auto") return whole();
|
|
10517
|
+
if (floor === void 0) return whole("no-floor");
|
|
10518
|
+
if (!ask) return whole("no-classifier");
|
|
10519
|
+
const settled = /* @__PURE__ */ new Map();
|
|
10520
|
+
const rest = [];
|
|
10521
|
+
for (const g of ambiguous) {
|
|
10522
|
+
const best = g.neighbours[0];
|
|
10523
|
+
if (!best) {
|
|
10524
|
+
rest.push(g);
|
|
10525
|
+
continue;
|
|
10526
|
+
}
|
|
10527
|
+
const question = {
|
|
10528
|
+
kind: "binary",
|
|
10529
|
+
instructions: `Does this candidate add NO information beyond neighbour ${best.ref} (a pure duplicate: same claims, no new content)?
|
|
10530
|
+
Neighbour ${best.ref} title: ${best.title}
|
|
10531
|
+
Neighbour ${best.ref} body: ${safeSlice(best.body, 0, OPS_NEIGHBOUR_BODY_CHARS)}`
|
|
10532
|
+
};
|
|
10533
|
+
let response;
|
|
10534
|
+
try {
|
|
10535
|
+
response = await ask({
|
|
10536
|
+
state: classifierStateForFact({ title: g.candidate.fact.title, body: g.candidate.fact.body, tags: [] }),
|
|
10537
|
+
questions: { [best.ref]: question }
|
|
10538
|
+
});
|
|
10539
|
+
} catch (err) {
|
|
10540
|
+
if (err instanceof WikiBudgetExhausted) {
|
|
10541
|
+
return { settled: /* @__PURE__ */ new Map(), rest: ambiguous, budgetStop: { requiredEstimate: err.requiredEstimate } };
|
|
10542
|
+
}
|
|
10543
|
+
return whole("classifier-threw");
|
|
10544
|
+
}
|
|
10545
|
+
const checked = validateClassifierAnswer(response, best.ref, question);
|
|
10546
|
+
if (checked.ok && checked.answer.kind === "binary" && checked.answer.probability >= floor) {
|
|
10547
|
+
settled.set(g, { op: "NOOP", targetId: best.id });
|
|
10548
|
+
} else {
|
|
10549
|
+
rest.push(g);
|
|
10550
|
+
}
|
|
10551
|
+
}
|
|
10552
|
+
return { settled, rest };
|
|
10553
|
+
}
|
|
10495
10554
|
function validateOp(raw, aliases) {
|
|
10496
10555
|
if (!raw || typeof raw !== "object") return null;
|
|
10497
10556
|
const r = raw;
|
|
@@ -10511,11 +10570,31 @@ function validateOp(raw, aliases) {
|
|
|
10511
10570
|
}
|
|
10512
10571
|
var aliasMapOf = (g) => new Map(g.neighbours.map((n) => [n.ref, n.id]));
|
|
10513
10572
|
async function runResolve(deps, ctx, ambiguous, budget) {
|
|
10514
|
-
const out = { ops: /* @__PURE__ */ new Map(), rejected: [], failed: [], overflowSkipped: [] };
|
|
10573
|
+
const out = { ops: /* @__PURE__ */ new Map(), rejected: [], failed: [], overflowSkipped: [], classifierSettled: [] };
|
|
10515
10574
|
if (ambiguous.length === 0) return out;
|
|
10516
10575
|
const { entityId, trigger } = ctx;
|
|
10576
|
+
const mode = resolveSystemOneResolve(deps.options.config);
|
|
10577
|
+
const floor = resolveResolveMinConfidence(deps.options.config);
|
|
10578
|
+
const provider = deps.options.llmProvider;
|
|
10579
|
+
const ask = mode === "auto" && typeof provider.classify === "function" ? (request) => callClassify(deps.options, { operation: "librarian", entityId, trigger, meter: ctx.meter }, request) : void 0;
|
|
10580
|
+
const screen = await screenResolveCandidates(ambiguous, mode, floor, ask);
|
|
10581
|
+
if (screen.budgetStop) return { ...out, budgetStop: screen.budgetStop };
|
|
10582
|
+
if (screen.warnReason === "no-classifier") {
|
|
10583
|
+
warnOnce(
|
|
10584
|
+
"[core-llm-wiki] systemOne: `systemOne.resolve` is 'auto' but the provider has no classify(); ambiguous candidates fall through to the generative resolve."
|
|
10585
|
+
);
|
|
10586
|
+
} else if (screen.warnReason === "classifier-threw") {
|
|
10587
|
+
warnOnce(
|
|
10588
|
+
"[core-llm-wiki] systemOne: `systemOne.resolve` is 'auto' but classify() threw during the resolve screen; ambiguous candidates fall through to the generative resolve."
|
|
10589
|
+
);
|
|
10590
|
+
}
|
|
10591
|
+
for (const [g, op] of screen.settled) {
|
|
10592
|
+
out.ops.set(g, op);
|
|
10593
|
+
out.classifierSettled.push(g.candidate.index);
|
|
10594
|
+
}
|
|
10595
|
+
if (screen.rest.length === 0) return out;
|
|
10517
10596
|
const outcome = await runBatched({
|
|
10518
|
-
items:
|
|
10597
|
+
items: screen.rest,
|
|
10519
10598
|
buildPrompt: (batch) => deps.promptService.buildOpsResolvePrompt(
|
|
10520
10599
|
batch.map((g, i) => ({
|
|
10521
10600
|
item: i,
|
|
@@ -10804,6 +10883,16 @@ var runOpsLibrarianPass = async (deps, ctx) => {
|
|
|
10804
10883
|
// (index into the merged extract batch)
|
|
10805
10884
|
});
|
|
10806
10885
|
}
|
|
10886
|
+
for (const itemIndex of res.classifierSettled) {
|
|
10887
|
+
diagnostics.push({
|
|
10888
|
+
entityId,
|
|
10889
|
+
operation: "librarian",
|
|
10890
|
+
trigger,
|
|
10891
|
+
code: "fact_deduplicated",
|
|
10892
|
+
detail: { itemIndex, reason: "classifier" }
|
|
10893
|
+
// (index into the merged extract batch)
|
|
10894
|
+
});
|
|
10895
|
+
}
|
|
10807
10896
|
if (res.budgetStop) {
|
|
10808
10897
|
diagnostics.discard();
|
|
10809
10898
|
return { processedThrough: null, factsWritten: 0, budgetStop: res.budgetStop };
|
|
@@ -18404,7 +18493,9 @@ exports.resolveDefaultChunkLength = resolveDefaultChunkLength;
|
|
|
18404
18493
|
exports.resolveEdgesMinConfidence = resolveEdgesMinConfidence;
|
|
18405
18494
|
exports.resolveMaxPromptChars = resolveMaxPromptChars;
|
|
18406
18495
|
exports.resolveOntologyJobDefaults = resolveOntologyJobDefaults;
|
|
18496
|
+
exports.resolveResolveMinConfidence = resolveResolveMinConfidence;
|
|
18407
18497
|
exports.resolveSystemOneEdges = resolveSystemOneEdges;
|
|
18498
|
+
exports.resolveSystemOneResolve = resolveSystemOneResolve;
|
|
18408
18499
|
exports.resolveSystemOneTyping = resolveSystemOneTyping;
|
|
18409
18500
|
exports.resolveTypingMinConfidence = resolveTypingMinConfidence;
|
|
18410
18501
|
exports.safeSlice = safeSlice;
|