@equationalapplications/core-llm-wiki 7.5.0 → 7.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/README.md +30 -0
- package/dist/{chunk-3P7FAKJA.mjs → chunk-YBWE26XR.mjs} +224 -41
- package/dist/chunk-YBWE26XR.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +225 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-ClpOUiLI.d.mts → testing-d1SrpDvg.d.mts} +52 -3
- package/dist/{testing-ClpOUiLI.d.ts → testing-d1SrpDvg.d.ts} +52 -3
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +221 -38
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-3P7FAKJA.mjs.map +0 -1
|
@@ -215,6 +215,23 @@ interface HealResult {
|
|
|
215
215
|
/** Heal candidates inside the recheck cooldown. */
|
|
216
216
|
deferred: number;
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Opt-in evidence check for LLM-authored facts (spec §6). Default off: 7.x
|
|
220
|
+
* write behavior is unchanged. In `'draft'` mode, writers in `writers` must
|
|
221
|
+
* quote their source; a fact whose quotes are missing or not found is stored
|
|
222
|
+
* as a `draft` instead of being rejected.
|
|
223
|
+
*/
|
|
224
|
+
interface GroundingConfig {
|
|
225
|
+
mode: 'off' | 'draft';
|
|
226
|
+
/** Default `['ingest']`. The librarian and heal synthesize across events; measure their pass rates before opting them in. */
|
|
227
|
+
writers?: Array<'ingest' | 'librarian' | 'heal'>;
|
|
228
|
+
/** Quotes shorter than this (after whitespace normalization) count as absent. Default 20. */
|
|
229
|
+
minEvidenceChars?: number;
|
|
230
|
+
/** Quotes retained per fact. Retention only; every quote is checked. Default 3. */
|
|
231
|
+
maxEvidence?: number;
|
|
232
|
+
/** Characters retained per quote. Default 300. */
|
|
233
|
+
maxEvidenceChars?: number;
|
|
234
|
+
}
|
|
218
235
|
interface WikiConfig {
|
|
219
236
|
/**
|
|
220
237
|
* Prefix applied to every SQL table/index/trigger name. Must match
|
|
@@ -282,6 +299,8 @@ interface WikiConfig {
|
|
|
282
299
|
* `GraphTraversalOptions.excludeDrafts`. Default false (drafts visible).
|
|
283
300
|
*/
|
|
284
301
|
excludeDrafts?: boolean;
|
|
302
|
+
/** Evidence check for LLM-authored facts (spec §6). Default off. */
|
|
303
|
+
grounding?: GroundingConfig;
|
|
285
304
|
}
|
|
286
305
|
interface ReadOptions {
|
|
287
306
|
maxResults?: number;
|
|
@@ -493,6 +512,8 @@ interface ExtractedFact {
|
|
|
493
512
|
body: string;
|
|
494
513
|
tags: string[];
|
|
495
514
|
confidence: 'certain' | 'inferred' | 'tentative';
|
|
515
|
+
/** Quotes the model copied from its source; see `WikiConfig.grounding`. Never persisted. */
|
|
516
|
+
evidence?: string[];
|
|
496
517
|
}
|
|
497
518
|
interface ExtractedFactWithOntology extends ExtractedFact {
|
|
498
519
|
okf_type?: string;
|
|
@@ -1227,10 +1248,14 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1227
1248
|
* fact, not only immutable_document rows, so the source-type restriction has
|
|
1228
1249
|
* to be applied here, after retrieval.
|
|
1229
1250
|
*/
|
|
1230
|
-
findAnchorRowsByIds(entityId: string, ids: readonly string[], tx?: SQLiteAdapter
|
|
1251
|
+
findAnchorRowsByIds(entityId: string, ids: readonly string[], tx?: SQLiteAdapter, opts?: {
|
|
1252
|
+
withBody?: boolean;
|
|
1253
|
+
}): Promise<Array<{
|
|
1231
1254
|
id: string;
|
|
1232
1255
|
title: string;
|
|
1233
1256
|
source_ref: string | null;
|
|
1257
|
+
body?: string;
|
|
1258
|
+
lifecycle_status?: string;
|
|
1234
1259
|
}>>;
|
|
1235
1260
|
/**
|
|
1236
1261
|
* Fetch recent non-deleted entries for an entity (limited), ordered by updated_at DESC.
|
|
@@ -1991,9 +2016,29 @@ declare class OntologyService {
|
|
|
1991
2016
|
resolveAndPersistEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, tx: SQLiteAdapter, now: number, drops?: EdgeDrop[]): Promise<number>;
|
|
1992
2017
|
}
|
|
1993
2018
|
|
|
2019
|
+
type GroundingWriter = 'ingest' | 'librarian' | 'heal';
|
|
2020
|
+
interface ResolvedGrounding {
|
|
2021
|
+
writers: ReadonlySet<GroundingWriter>;
|
|
2022
|
+
minEvidenceChars: number;
|
|
2023
|
+
maxEvidence: number;
|
|
2024
|
+
maxEvidenceChars: number;
|
|
2025
|
+
}
|
|
2026
|
+
/** Insert-time trust fields. Spread onto a new `WikiFact`; `EntryRepository.upsert` writes them on INSERT only. */
|
|
2027
|
+
interface GroundingTrust {
|
|
2028
|
+
lifecycle_status: 'stable' | 'draft';
|
|
2029
|
+
okf_verified?: OkfVerifiedEntry[];
|
|
2030
|
+
last_verified_at?: number;
|
|
2031
|
+
last_verified_by?: string;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
1994
2034
|
declare class PromptService {
|
|
1995
2035
|
private globalOverrides?;
|
|
1996
|
-
|
|
2036
|
+
private grounding;
|
|
2037
|
+
constructor(globalOverrides?: PromptOverrides | undefined, grounding?: ResolvedGrounding | null);
|
|
2038
|
+
/** The resolved grounding config when `writer` is in `grounding.writers`; otherwise null (spec §6.2). */
|
|
2039
|
+
groundingFor(writer: GroundingWriter): ResolvedGrounding | null;
|
|
2040
|
+
/** Appended after any override and after ontology context, so it is always last. */
|
|
2041
|
+
private appendGrounding;
|
|
1997
2042
|
private hydrate;
|
|
1998
2043
|
private hasOntologyPlaceholders;
|
|
1999
2044
|
private buildSystemPrompt;
|
|
@@ -2005,6 +2050,7 @@ declare class PromptService {
|
|
|
2005
2050
|
buildLibrarianPrompt(events: unknown[], currentFacts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
|
|
2006
2051
|
systemPrompt: string;
|
|
2007
2052
|
userPrompt: string;
|
|
2053
|
+
groundingCorpus?: string[];
|
|
2008
2054
|
};
|
|
2009
2055
|
/**
|
|
2010
2056
|
* Heal-prompt level interpretation for the `attemptLevel` ladder.
|
|
@@ -2034,6 +2080,7 @@ declare class PromptService {
|
|
|
2034
2080
|
userPrompt: string;
|
|
2035
2081
|
};
|
|
2036
2082
|
degraded: DegradedRecord[];
|
|
2083
|
+
groundingCorpus?: string[];
|
|
2037
2084
|
};
|
|
2038
2085
|
buildOntologyBackfillPrompt(facts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
|
|
2039
2086
|
systemPrompt: string;
|
|
@@ -2140,6 +2187,8 @@ declare class IngestionService {
|
|
|
2140
2187
|
buffer: DiagnosticBuffer;
|
|
2141
2188
|
operation: 'ingest' | 'upsertGraph';
|
|
2142
2189
|
};
|
|
2190
|
+
/** Insert-time trust by node id. Ingest-only (spec §6.5); the public upsertGraph never passes it, so host nodes are never grounded. */
|
|
2191
|
+
nodeTrust?: ReadonlyMap<string, GroundingTrust>;
|
|
2143
2192
|
}): Promise<{
|
|
2144
2193
|
nodesWritten: number;
|
|
2145
2194
|
edgesWritten: number;
|
|
@@ -2942,4 +2991,4 @@ declare class WikiMemory {
|
|
|
2942
2991
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
2943
2992
|
}
|
|
2944
2993
|
|
|
2945
|
-
export { type
|
|
2994
|
+
export { type WikiCheckpoint as $, type OntologyMode as A, type OntologyNodeType as B, type ChunkFailure as C, type DegradedRecord as D, type EmbedFactResult as E, type FormatContextOptions as F, type GraphNeighborhood as G, HEAL_BATCH_SIZE as H, type IngestDocumentResult as I, type OntologyPromptContext as J, type OntologyUpdates as K, type LLMProvider as L, type MemoryBundle as M, PromptService as N, ONTOLOGY_BACKFILL_BATCH_SIZE as O, type PromptOverrides as P, PrunePartialFailureError as Q, type ReadOptions as R, type SQLiteAdapter as S, type ReembedResult as T, type VectorRankerFallback as U, type VectorRanker as V, type WikiOptions as W, type VectorRankerRankArgs as X, type VectorRankerSemanticResult as Y, WikiBusyError as Z, type WikiBusyOperation as _, type MemoryDump as a, type WikiConfig as a0, type WikiDiagnostic as a1, type WikiDiagnosticCode as a2, type WikiDiagnosticDetail as a3, type WikiDiagnosticOperation as a4, type WikiDiagnosticSeverity as a5, type WikiDiagnosticTrigger as a6, WikiDraftNotFound as a7, WikiDuplicateHashError as a8, type WikiEdge as a9, type WikiEvent as aa, type WikiFact as ab, WikiGraphNodeOwnershipConflict as ac, WikiIngestEmptyError as ad, WikiInvalidReadOptions as ae, type WikiMemoryTestAccess as af, type WikiOutboxEvent as ag, WikiParseError as ah, WikiSourceRefHashCollision as ai, WikiStrictOntologyViolation as aj, type WikiTask as ak, WikiTransactionError as al, validateManifest as am, EmbeddingService as an, ImportExportService as ao, IngestionService as ap, JobManager as aq, MaintenanceService as ar, RetrievalService as as, SearchService as at, WriteService as au, type FormattedMemoryDump as b, WikiMemory as c, type ClassifierAnswer as d, type ClassifierQuestion as e, type ClassifyRequest as f, type ClassifyResponse as g, type DraftPage as h, type EmbedFailureKind as i, type EmbeddingMarkerKind as j, type EntityStatus as k, type ExtractedFact as l, type ExtractedFactEdge as m, type ExtractedFactWithOntology as n, type ExtractedTask as o, type GraphTraversalOptions as p, type GroundingConfig as q, HEAL_RECHECK_MS as r, HOOK_TIMEOUT_MARKER as s, type HealResult as t, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as u, ONTOLOGY_BACKFILL_RECHECK_MS as v, type OntologyBackfillResult as w, type OntologyConfig as x, type OntologyEdgeType as y, type OntologyManifest as z };
|
|
@@ -215,6 +215,23 @@ interface HealResult {
|
|
|
215
215
|
/** Heal candidates inside the recheck cooldown. */
|
|
216
216
|
deferred: number;
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Opt-in evidence check for LLM-authored facts (spec §6). Default off: 7.x
|
|
220
|
+
* write behavior is unchanged. In `'draft'` mode, writers in `writers` must
|
|
221
|
+
* quote their source; a fact whose quotes are missing or not found is stored
|
|
222
|
+
* as a `draft` instead of being rejected.
|
|
223
|
+
*/
|
|
224
|
+
interface GroundingConfig {
|
|
225
|
+
mode: 'off' | 'draft';
|
|
226
|
+
/** Default `['ingest']`. The librarian and heal synthesize across events; measure their pass rates before opting them in. */
|
|
227
|
+
writers?: Array<'ingest' | 'librarian' | 'heal'>;
|
|
228
|
+
/** Quotes shorter than this (after whitespace normalization) count as absent. Default 20. */
|
|
229
|
+
minEvidenceChars?: number;
|
|
230
|
+
/** Quotes retained per fact. Retention only; every quote is checked. Default 3. */
|
|
231
|
+
maxEvidence?: number;
|
|
232
|
+
/** Characters retained per quote. Default 300. */
|
|
233
|
+
maxEvidenceChars?: number;
|
|
234
|
+
}
|
|
218
235
|
interface WikiConfig {
|
|
219
236
|
/**
|
|
220
237
|
* Prefix applied to every SQL table/index/trigger name. Must match
|
|
@@ -282,6 +299,8 @@ interface WikiConfig {
|
|
|
282
299
|
* `GraphTraversalOptions.excludeDrafts`. Default false (drafts visible).
|
|
283
300
|
*/
|
|
284
301
|
excludeDrafts?: boolean;
|
|
302
|
+
/** Evidence check for LLM-authored facts (spec §6). Default off. */
|
|
303
|
+
grounding?: GroundingConfig;
|
|
285
304
|
}
|
|
286
305
|
interface ReadOptions {
|
|
287
306
|
maxResults?: number;
|
|
@@ -493,6 +512,8 @@ interface ExtractedFact {
|
|
|
493
512
|
body: string;
|
|
494
513
|
tags: string[];
|
|
495
514
|
confidence: 'certain' | 'inferred' | 'tentative';
|
|
515
|
+
/** Quotes the model copied from its source; see `WikiConfig.grounding`. Never persisted. */
|
|
516
|
+
evidence?: string[];
|
|
496
517
|
}
|
|
497
518
|
interface ExtractedFactWithOntology extends ExtractedFact {
|
|
498
519
|
okf_type?: string;
|
|
@@ -1227,10 +1248,14 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1227
1248
|
* fact, not only immutable_document rows, so the source-type restriction has
|
|
1228
1249
|
* to be applied here, after retrieval.
|
|
1229
1250
|
*/
|
|
1230
|
-
findAnchorRowsByIds(entityId: string, ids: readonly string[], tx?: SQLiteAdapter
|
|
1251
|
+
findAnchorRowsByIds(entityId: string, ids: readonly string[], tx?: SQLiteAdapter, opts?: {
|
|
1252
|
+
withBody?: boolean;
|
|
1253
|
+
}): Promise<Array<{
|
|
1231
1254
|
id: string;
|
|
1232
1255
|
title: string;
|
|
1233
1256
|
source_ref: string | null;
|
|
1257
|
+
body?: string;
|
|
1258
|
+
lifecycle_status?: string;
|
|
1234
1259
|
}>>;
|
|
1235
1260
|
/**
|
|
1236
1261
|
* Fetch recent non-deleted entries for an entity (limited), ordered by updated_at DESC.
|
|
@@ -1991,9 +2016,29 @@ declare class OntologyService {
|
|
|
1991
2016
|
resolveAndPersistEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, tx: SQLiteAdapter, now: number, drops?: EdgeDrop[]): Promise<number>;
|
|
1992
2017
|
}
|
|
1993
2018
|
|
|
2019
|
+
type GroundingWriter = 'ingest' | 'librarian' | 'heal';
|
|
2020
|
+
interface ResolvedGrounding {
|
|
2021
|
+
writers: ReadonlySet<GroundingWriter>;
|
|
2022
|
+
minEvidenceChars: number;
|
|
2023
|
+
maxEvidence: number;
|
|
2024
|
+
maxEvidenceChars: number;
|
|
2025
|
+
}
|
|
2026
|
+
/** Insert-time trust fields. Spread onto a new `WikiFact`; `EntryRepository.upsert` writes them on INSERT only. */
|
|
2027
|
+
interface GroundingTrust {
|
|
2028
|
+
lifecycle_status: 'stable' | 'draft';
|
|
2029
|
+
okf_verified?: OkfVerifiedEntry[];
|
|
2030
|
+
last_verified_at?: number;
|
|
2031
|
+
last_verified_by?: string;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
1994
2034
|
declare class PromptService {
|
|
1995
2035
|
private globalOverrides?;
|
|
1996
|
-
|
|
2036
|
+
private grounding;
|
|
2037
|
+
constructor(globalOverrides?: PromptOverrides | undefined, grounding?: ResolvedGrounding | null);
|
|
2038
|
+
/** The resolved grounding config when `writer` is in `grounding.writers`; otherwise null (spec §6.2). */
|
|
2039
|
+
groundingFor(writer: GroundingWriter): ResolvedGrounding | null;
|
|
2040
|
+
/** Appended after any override and after ontology context, so it is always last. */
|
|
2041
|
+
private appendGrounding;
|
|
1997
2042
|
private hydrate;
|
|
1998
2043
|
private hasOntologyPlaceholders;
|
|
1999
2044
|
private buildSystemPrompt;
|
|
@@ -2005,6 +2050,7 @@ declare class PromptService {
|
|
|
2005
2050
|
buildLibrarianPrompt(events: unknown[], currentFacts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
|
|
2006
2051
|
systemPrompt: string;
|
|
2007
2052
|
userPrompt: string;
|
|
2053
|
+
groundingCorpus?: string[];
|
|
2008
2054
|
};
|
|
2009
2055
|
/**
|
|
2010
2056
|
* Heal-prompt level interpretation for the `attemptLevel` ladder.
|
|
@@ -2034,6 +2080,7 @@ declare class PromptService {
|
|
|
2034
2080
|
userPrompt: string;
|
|
2035
2081
|
};
|
|
2036
2082
|
degraded: DegradedRecord[];
|
|
2083
|
+
groundingCorpus?: string[];
|
|
2037
2084
|
};
|
|
2038
2085
|
buildOntologyBackfillPrompt(facts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
|
|
2039
2086
|
systemPrompt: string;
|
|
@@ -2140,6 +2187,8 @@ declare class IngestionService {
|
|
|
2140
2187
|
buffer: DiagnosticBuffer;
|
|
2141
2188
|
operation: 'ingest' | 'upsertGraph';
|
|
2142
2189
|
};
|
|
2190
|
+
/** Insert-time trust by node id. Ingest-only (spec §6.5); the public upsertGraph never passes it, so host nodes are never grounded. */
|
|
2191
|
+
nodeTrust?: ReadonlyMap<string, GroundingTrust>;
|
|
2143
2192
|
}): Promise<{
|
|
2144
2193
|
nodesWritten: number;
|
|
2145
2194
|
edgesWritten: number;
|
|
@@ -2942,4 +2991,4 @@ declare class WikiMemory {
|
|
|
2942
2991
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
2943
2992
|
}
|
|
2944
2993
|
|
|
2945
|
-
export { type
|
|
2994
|
+
export { type WikiCheckpoint as $, type OntologyMode as A, type OntologyNodeType as B, type ChunkFailure as C, type DegradedRecord as D, type EmbedFactResult as E, type FormatContextOptions as F, type GraphNeighborhood as G, HEAL_BATCH_SIZE as H, type IngestDocumentResult as I, type OntologyPromptContext as J, type OntologyUpdates as K, type LLMProvider as L, type MemoryBundle as M, PromptService as N, ONTOLOGY_BACKFILL_BATCH_SIZE as O, type PromptOverrides as P, PrunePartialFailureError as Q, type ReadOptions as R, type SQLiteAdapter as S, type ReembedResult as T, type VectorRankerFallback as U, type VectorRanker as V, type WikiOptions as W, type VectorRankerRankArgs as X, type VectorRankerSemanticResult as Y, WikiBusyError as Z, type WikiBusyOperation as _, type MemoryDump as a, type WikiConfig as a0, type WikiDiagnostic as a1, type WikiDiagnosticCode as a2, type WikiDiagnosticDetail as a3, type WikiDiagnosticOperation as a4, type WikiDiagnosticSeverity as a5, type WikiDiagnosticTrigger as a6, WikiDraftNotFound as a7, WikiDuplicateHashError as a8, type WikiEdge as a9, type WikiEvent as aa, type WikiFact as ab, WikiGraphNodeOwnershipConflict as ac, WikiIngestEmptyError as ad, WikiInvalidReadOptions as ae, type WikiMemoryTestAccess as af, type WikiOutboxEvent as ag, WikiParseError as ah, WikiSourceRefHashCollision as ai, WikiStrictOntologyViolation as aj, type WikiTask as ak, WikiTransactionError as al, validateManifest as am, EmbeddingService as an, ImportExportService as ao, IngestionService as ap, JobManager as aq, MaintenanceService as ar, RetrievalService as as, SearchService as at, WriteService as au, type FormattedMemoryDump as b, WikiMemory as c, type ClassifierAnswer as d, type ClassifierQuestion as e, type ClassifyRequest as f, type ClassifyResponse as g, type DraftPage as h, type EmbedFailureKind as i, type EmbeddingMarkerKind as j, type EntityStatus as k, type ExtractedFact as l, type ExtractedFactEdge as m, type ExtractedFactWithOntology as n, type ExtractedTask as o, type GraphTraversalOptions as p, type GroundingConfig as q, HEAL_RECHECK_MS as r, HOOK_TIMEOUT_MARKER as s, type HealResult as t, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as u, ONTOLOGY_BACKFILL_RECHECK_MS as v, type OntologyBackfillResult as w, type OntologyConfig as x, type OntologyEdgeType as y, type OntologyManifest as z };
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { an as EmbeddingService, ao as ImportExportService, ap as IngestionService, aq as JobManager, aq as JobManagerType, ar as MaintenanceService, as as RetrievalService, at as SearchService, at as SearchServiceType, af as WikiMemoryTestAccess, au as WriteService } from './testing-d1SrpDvg.mjs';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
|
3
3
|
import 'minisearch';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { an as EmbeddingService, ao as ImportExportService, ap as IngestionService, aq as JobManager, aq as JobManagerType, ar as MaintenanceService, as as RetrievalService, at as SearchService, at as SearchServiceType, af as WikiMemoryTestAccess, au as WriteService } from './testing-d1SrpDvg.js';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
|
3
3
|
import 'minisearch';
|