@equationalapplications/core-llm-wiki 9.0.0 → 9.2.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-G2H6TJUC.mjs → chunk-E3JCZMJL.mjs} +916 -24
- package/dist/chunk-E3JCZMJL.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1540 -293
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +577 -224
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-s6DBqXxQ.d.mts → testing-BQScWWSA.d.mts} +224 -17
- package/dist/{testing-s6DBqXxQ.d.ts → testing-BQScWWSA.d.ts} +224 -17
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +737 -33
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-G2H6TJUC.mjs.map +0 -1
|
@@ -278,6 +278,11 @@ interface LibrarianConfig {
|
|
|
278
278
|
guidanceForEntity?: (entityId: string) => string | undefined;
|
|
279
279
|
}
|
|
280
280
|
interface WikiConfig {
|
|
281
|
+
/** Source-store limits (spec source-store section 9). Defaults live in SourceStoreService. */
|
|
282
|
+
sourceStore?: {
|
|
283
|
+
maxCharsPerSource?: number;
|
|
284
|
+
maxTotalChars?: number;
|
|
285
|
+
};
|
|
281
286
|
/**
|
|
282
287
|
* Prefix applied to every SQL table/index/trigger name. Must match
|
|
283
288
|
* `^[A-Za-z][A-Za-z0-9_]{0,30}_$` (letter, then alphanumeric/underscore,
|
|
@@ -414,6 +419,16 @@ interface WikiConfig {
|
|
|
414
419
|
setupBudgetMs?: number;
|
|
415
420
|
}
|
|
416
421
|
interface ReadOptions {
|
|
422
|
+
/**
|
|
423
|
+
* Opt in to stored-source passages (spec source-store section 7). Per entity:
|
|
424
|
+
* at most `maxPassages` (default 8) windows, each at most `charBudget`
|
|
425
|
+
* (default 4,000) UTF-16 code units.
|
|
426
|
+
*/
|
|
427
|
+
sources?: {
|
|
428
|
+
query: string;
|
|
429
|
+
maxPassages?: number;
|
|
430
|
+
charBudget?: number;
|
|
431
|
+
};
|
|
417
432
|
maxResults?: number;
|
|
418
433
|
/**
|
|
419
434
|
* undefined → use WikiConfig.preFilterLimit (or no pre-filter if also unset).
|
|
@@ -471,6 +486,28 @@ interface ReadOptions {
|
|
|
471
486
|
*/
|
|
472
487
|
tokenBudget?: number;
|
|
473
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* A source pointer: the structured reference from a librarian fact to the
|
|
491
|
+
* event it came from, with its supporting quote and its position
|
|
492
|
+
* (specs/source-pointers §The pointer). Stored as JSON in the nullable
|
|
493
|
+
* `source_pointer` column on entries.
|
|
494
|
+
* - `event_id`: the batch event the fact was extracted from (ops strategy),
|
|
495
|
+
* or null when unresolved/unsupported.
|
|
496
|
+
* - `ref`: host-supplied ref slot; no producer exists in this release — always null.
|
|
497
|
+
* - `quote`: a grounding-verified, normalized, length-capped (on the ops
|
|
498
|
+
* write path; import restores verbatim) quote from the named event's
|
|
499
|
+
* own corpus part (ops only), or null.
|
|
500
|
+
* - `position`: offset slot; no producer exists in this release — always null.
|
|
501
|
+
*/
|
|
502
|
+
type WikiSourcePointer = {
|
|
503
|
+
event_id: string | null;
|
|
504
|
+
ref: string | null;
|
|
505
|
+
quote: string | null;
|
|
506
|
+
position: {
|
|
507
|
+
start: number;
|
|
508
|
+
length: number;
|
|
509
|
+
} | null;
|
|
510
|
+
};
|
|
474
511
|
interface WikiFact {
|
|
475
512
|
id: string;
|
|
476
513
|
entity_id: string;
|
|
@@ -552,6 +589,8 @@ interface WikiFact {
|
|
|
552
589
|
superseded_by?: string | null;
|
|
553
590
|
/** Epoch ms the supersession was recorded (transaction time). Audit only. */
|
|
554
591
|
superseded_at?: number | null;
|
|
592
|
+
/** Structured provenance from this librarian fact to its source event, with the verified quote. Null for legacy/heal/ingest facts. */
|
|
593
|
+
source_pointer?: WikiSourcePointer | null;
|
|
555
594
|
}
|
|
556
595
|
interface WikiTask {
|
|
557
596
|
id: string;
|
|
@@ -823,9 +862,9 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
|
|
|
823
862
|
* Closed for this release series, but new codes are added in minor versions:
|
|
824
863
|
* hosts must tolerate codes they do not recognize.
|
|
825
864
|
*/
|
|
826
|
-
type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed';
|
|
865
|
+
type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable';
|
|
827
866
|
/** The service run that emitted the diagnostic. */
|
|
828
|
-
type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion';
|
|
867
|
+
type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore';
|
|
829
868
|
/** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
|
|
830
869
|
type WikiDiagnosticTrigger = 'call' | 'auto';
|
|
831
870
|
/** Identifiers only — never titles, bodies, quotes, LLM output, provider messages, or hashes of content. */
|
|
@@ -977,16 +1016,33 @@ interface WikiOptions {
|
|
|
977
1016
|
*/
|
|
978
1017
|
onDiagnostic?: (diagnostic: WikiDiagnostic) => void;
|
|
979
1018
|
}
|
|
1019
|
+
/** One windowed stored-source passage in a `read()` `sources` group (spec source-store section 7). */
|
|
1020
|
+
interface SourcePassage {
|
|
1021
|
+
entityId: string;
|
|
1022
|
+
sourceRef: string;
|
|
1023
|
+
sourceHash: string;
|
|
1024
|
+
seq: number;
|
|
1025
|
+
/** UTF-16 offset of `text` within the stored source, inclusive. */
|
|
1026
|
+
startOffset: number;
|
|
1027
|
+
/** UTF-16 offset, exclusive: `storedText.slice(startOffset, endOffset) === text`. */
|
|
1028
|
+
endOffset: number;
|
|
1029
|
+
/** True when `text` is a window cut from a larger passage. */
|
|
1030
|
+
truncated: boolean;
|
|
1031
|
+
text: string;
|
|
1032
|
+
}
|
|
980
1033
|
interface MemoryBundle {
|
|
981
1034
|
facts: WikiFact[];
|
|
1035
|
+
/** Present only when `read()` was given the `sources` option. Per-entity groups, never merged. */
|
|
1036
|
+
sources?: SourcePassage[];
|
|
982
1037
|
tasks: WikiTask[];
|
|
983
1038
|
events: WikiEvent[];
|
|
984
1039
|
edges?: WikiEdge[];
|
|
985
1040
|
/** Entity summary prose for OKF profile ≥ 1 round-trip. Omitted = no summary (Clanker default). */
|
|
986
1041
|
summary?: string;
|
|
987
1042
|
/**
|
|
988
|
-
* The
|
|
989
|
-
* trusts events at or before it as consolidated at the
|
|
1043
|
+
* The exporting database's librarian position. Set by export only; the
|
|
1044
|
+
* importer trusts events at or before it as consolidated at the exporting
|
|
1045
|
+
* database. (Not the source text store; spec source-store §8 naming note.)
|
|
990
1046
|
*/
|
|
991
1047
|
librarian_watermark?: {
|
|
992
1048
|
at: number;
|
|
@@ -1001,9 +1057,73 @@ interface MemoryBundle {
|
|
|
1001
1057
|
tierFloors?: Record<string, number>;
|
|
1002
1058
|
};
|
|
1003
1059
|
}
|
|
1060
|
+
/** Result of `storeSource` (spec source-store §7). Refusals return `stored: false` with their diagnostics. */
|
|
1061
|
+
type StoreSourceResult = {
|
|
1062
|
+
stored: true;
|
|
1063
|
+
sourceRef: string;
|
|
1064
|
+
sourceHash: string;
|
|
1065
|
+
charCount: number;
|
|
1066
|
+
passageCount: number;
|
|
1067
|
+
storedAt: number;
|
|
1068
|
+
} | {
|
|
1069
|
+
stored: false;
|
|
1070
|
+
diagnostics: WikiDiagnostic[];
|
|
1071
|
+
};
|
|
1072
|
+
/** A stored source's text and metadata, as returned by `getStoredSource`. */
|
|
1073
|
+
interface StoredSource {
|
|
1074
|
+
sourceRef: string;
|
|
1075
|
+
sourceHash: string;
|
|
1076
|
+
text: string;
|
|
1077
|
+
charCount: number;
|
|
1078
|
+
storedAt: number;
|
|
1079
|
+
}
|
|
1080
|
+
/** One entry of `listStoredSources`. */
|
|
1081
|
+
interface StoredSourceSummary {
|
|
1082
|
+
sourceRef: string;
|
|
1083
|
+
sourceHash: string;
|
|
1084
|
+
charCount: number;
|
|
1085
|
+
passageCount: number;
|
|
1086
|
+
storedAt: number;
|
|
1087
|
+
}
|
|
1088
|
+
/** One stored source in a `MemoryDump` (spec source-store §8). Import re-derives passages and `text_hash` from `text`. */
|
|
1089
|
+
interface StoredSourceDump {
|
|
1090
|
+
sourceRef: string;
|
|
1091
|
+
sourceHash: string;
|
|
1092
|
+
text: string;
|
|
1093
|
+
textHash: string;
|
|
1094
|
+
charCount: number;
|
|
1095
|
+
storedAt: number;
|
|
1096
|
+
/** Fidelity only: import ignores this and re-cuts from `text`. */
|
|
1097
|
+
passages: Array<{
|
|
1098
|
+
seq: number;
|
|
1099
|
+
startOffset: number;
|
|
1100
|
+
endOffset: number;
|
|
1101
|
+
}>;
|
|
1102
|
+
}
|
|
1103
|
+
/** Result of `importDump` (spec source-store §8): sources the import refused. */
|
|
1104
|
+
interface ImportDumpResult {
|
|
1105
|
+
skippedSources: Array<{
|
|
1106
|
+
sourceRef: string;
|
|
1107
|
+
code: WikiDiagnosticCode;
|
|
1108
|
+
}>;
|
|
1109
|
+
}
|
|
1110
|
+
/** A dump entity: the bundle plus its stored sources (dump-only; `MemoryBundle` stays the read shape). */
|
|
1111
|
+
type MemoryDumpEntity = MemoryBundle & {
|
|
1112
|
+
storedSources?: StoredSourceDump[];
|
|
1113
|
+
};
|
|
1004
1114
|
interface MemoryDump {
|
|
1005
1115
|
generatedAt: number;
|
|
1006
|
-
entities: Record<string,
|
|
1116
|
+
entities: Record<string, MemoryDumpEntity>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Source-pointer parse report (specs/source-pointers §Export, import, and OKF).
|
|
1119
|
+
* Present ONLY when `parseOkfBundle` dropped a malformed `source_pointer`
|
|
1120
|
+
* value: entry ids and a reason slug — never raw pointer values, because a
|
|
1121
|
+
* pointer can carry quote text. Export-only metadata; `importDump` ignores it.
|
|
1122
|
+
*/
|
|
1123
|
+
dropped_pointer_values?: Array<{
|
|
1124
|
+
factId: string;
|
|
1125
|
+
reason: string;
|
|
1126
|
+
}>;
|
|
1007
1127
|
}
|
|
1008
1128
|
interface FormattedMemoryDump {
|
|
1009
1129
|
manifest: string;
|
|
@@ -1043,7 +1163,7 @@ interface EntityStatus {
|
|
|
1043
1163
|
* Exhaustive `switch` / narrowing on this type must be updated (or given a
|
|
1044
1164
|
* `default` arm) to compile without errors.
|
|
1045
1165
|
*/
|
|
1046
|
-
type WikiBusyOperation = 'ingest' | 'librarian' | 'heal' | 'prune' | 'reembed' | 'import' | 'forget' | 'ontologyBackfill';
|
|
1166
|
+
type WikiBusyOperation = 'ingest' | 'librarian' | 'heal' | 'prune' | 'reembed' | 'import' | 'forget' | 'ontologyBackfill' | 'store';
|
|
1047
1167
|
/**
|
|
1048
1168
|
* Thrown when a background mutator is already running for the requested entity.
|
|
1049
1169
|
*/
|
|
@@ -1674,7 +1794,7 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1674
1794
|
}>>;
|
|
1675
1795
|
findIdById(id: string, entityId: string, tx?: SQLiteAdapter): Promise<string | null>;
|
|
1676
1796
|
findIdsBySource(entityId: string, sourceRef: string | null, sourceHash: string | null, tx?: SQLiteAdapter, includeDeleted?: boolean): Promise<string[]>;
|
|
1677
|
-
upsertForImport(fact: WikiFact, tx: SQLiteAdapter): Promise<{
|
|
1797
|
+
upsertForImport(fact: WikiFact, tx: SQLiteAdapter, sourcePointerPresent?: boolean): Promise<{
|
|
1678
1798
|
changes: number;
|
|
1679
1799
|
lastInsertRowId: number;
|
|
1680
1800
|
}>;
|
|
@@ -1920,6 +2040,11 @@ declare class EntryRepository extends BaseRepository {
|
|
|
1920
2040
|
sourceHash: string | null;
|
|
1921
2041
|
factCount: number;
|
|
1922
2042
|
lastIngestedAt: number;
|
|
2043
|
+
/** Spec source-store §4 three-state: exact pair / stale hash / nothing stored. */
|
|
2044
|
+
stored?: {
|
|
2045
|
+
charCount: number;
|
|
2046
|
+
staleHash?: true;
|
|
2047
|
+
} | null;
|
|
1923
2048
|
}>>;
|
|
1924
2049
|
/**
|
|
1925
2050
|
* Count live entries for an entity across all source_refs/source_hashes.
|
|
@@ -2188,6 +2313,23 @@ interface IndexSearchResult {
|
|
|
2188
2313
|
*/
|
|
2189
2314
|
entity_id: string;
|
|
2190
2315
|
}
|
|
2316
|
+
/**
|
|
2317
|
+
* One passage hit with everything the read window needs. `text` is the whole
|
|
2318
|
+
* passage, sliced in JS from `source_documents.text` at [start_offset,
|
|
2319
|
+
* end_offset) (spec source-store section 7; never SQL substr).
|
|
2320
|
+
*/
|
|
2321
|
+
interface PassageHit {
|
|
2322
|
+
id: string;
|
|
2323
|
+
entity_id: string;
|
|
2324
|
+
document_id: string;
|
|
2325
|
+
score: number;
|
|
2326
|
+
seq: number;
|
|
2327
|
+
start_offset: number;
|
|
2328
|
+
end_offset: number;
|
|
2329
|
+
source_ref: string;
|
|
2330
|
+
source_hash: string;
|
|
2331
|
+
text: string;
|
|
2332
|
+
}
|
|
2191
2333
|
/** One drain turn's shape (spec #280 Change 3 "drain interface"). */
|
|
2192
2334
|
interface DrainOptions$1 {
|
|
2193
2335
|
/** `monotonicNow()` timestamp, checked between chunk transactions. Full mode only; default now + the strategy's budget. */
|
|
@@ -2287,6 +2429,15 @@ interface IndexStrategy {
|
|
|
2287
2429
|
* transactions.
|
|
2288
2430
|
*/
|
|
2289
2431
|
drain?(opts?: DrainOptions$1): Promise<void>;
|
|
2432
|
+
/**
|
|
2433
|
+
* Best-match-first stored-source passage search (spec source-store section 7),
|
|
2434
|
+
* optional like `drain?`. A strategy without it, or the degraded stand-in,
|
|
2435
|
+
* yields no passages.
|
|
2436
|
+
*/
|
|
2437
|
+
searchPassages?(query: string, options: {
|
|
2438
|
+
entityIds: string[];
|
|
2439
|
+
limit: number;
|
|
2440
|
+
}): Promise<PassageHit[]>;
|
|
2290
2441
|
}
|
|
2291
2442
|
|
|
2292
2443
|
interface ScoredRow {
|
|
@@ -2432,6 +2583,19 @@ declare class SearchService {
|
|
|
2432
2583
|
* Executes a keyword search against the active index strategy.
|
|
2433
2584
|
*/
|
|
2434
2585
|
searchKeyword(query: string, entityIds: string[], limit: number): Promise<IndexSearchResult[]>;
|
|
2586
|
+
/**
|
|
2587
|
+
* Post-commit passage index sync (spec source-store section 6). FTS5: drains the
|
|
2588
|
+
* passage ledger (per document, entity-scoped when given). MiniSearch: reloads
|
|
2589
|
+
* the entity's stored passages (all stored entities when omitted: the open-time
|
|
2590
|
+
* pass). Serialized on the sync chain; never rejects, like sync().
|
|
2591
|
+
*/
|
|
2592
|
+
syncPassages(db: SQLiteAdapter, prefix: string, entityId?: string, deadline?: number): Promise<void>;
|
|
2593
|
+
/**
|
|
2594
|
+
* Stored-source passage search for ONE entity (spec source-store section 7:
|
|
2595
|
+
* ranking and caps are per entity). Rides the active strategy; a strategy
|
|
2596
|
+
* without passage search yields none.
|
|
2597
|
+
*/
|
|
2598
|
+
searchPassages(query: string, entityId: string, limit: number): Promise<PassageHit[]>;
|
|
2435
2599
|
/**
|
|
2436
2600
|
* Pre-fetches keyword scores for candidate hydration, used during hybrid weighting.
|
|
2437
2601
|
*/
|
|
@@ -2461,7 +2625,7 @@ declare class SearchService {
|
|
|
2461
2625
|
private _compareSearchResults;
|
|
2462
2626
|
}
|
|
2463
2627
|
|
|
2464
|
-
type OperationType = 'prune' | 'librarian' | 'heal' | 'ingest' | 'reembed' | 'global_reembed' | 'import' | 'global_import' | 'forget' | 'ontologyBackfill';
|
|
2628
|
+
type OperationType = 'prune' | 'librarian' | 'heal' | 'ingest' | 'reembed' | 'global_reembed' | 'import' | 'global_import' | 'forget' | 'ontologyBackfill' | 'store';
|
|
2465
2629
|
declare class JobManager {
|
|
2466
2630
|
private prefix;
|
|
2467
2631
|
private activeMaintenanceJobs;
|
|
@@ -2513,6 +2677,7 @@ declare class JobManager {
|
|
|
2513
2677
|
private _globalImportKey;
|
|
2514
2678
|
private _forgetKey;
|
|
2515
2679
|
private _librarianKey;
|
|
2680
|
+
private _storeKey;
|
|
2516
2681
|
private _healKey;
|
|
2517
2682
|
private _ontologyBackfillKey;
|
|
2518
2683
|
/**
|
|
@@ -2538,6 +2703,7 @@ declare class JobManager {
|
|
|
2538
2703
|
*/
|
|
2539
2704
|
isAnyReembedActive(): boolean;
|
|
2540
2705
|
private _isImportActiveFor;
|
|
2706
|
+
private _isStoreActiveFor;
|
|
2541
2707
|
private _isForgetActiveFor;
|
|
2542
2708
|
private _isAnyMaintenanceActiveWithSuffix;
|
|
2543
2709
|
private _hasIngestJob;
|
|
@@ -3635,6 +3801,8 @@ declare class MaintenanceService {
|
|
|
3635
3801
|
* as WikiMemory.setup() documents.
|
|
3636
3802
|
*/
|
|
3637
3803
|
private sourceRefIndexPresent;
|
|
3804
|
+
/** A never-set-up store has no source-store tables (#316 recovery); nothing to delete there. */
|
|
3805
|
+
private sourceStorePresent;
|
|
3638
3806
|
/**
|
|
3639
3807
|
* Read-only dry-run preview of {@link forget}. Returns the same shape as a
|
|
3640
3808
|
* real call would, without acquiring the lock, opening a transaction, staging
|
|
@@ -3820,17 +3988,32 @@ declare class ImportExportService {
|
|
|
3820
3988
|
private embeddingService;
|
|
3821
3989
|
private options;
|
|
3822
3990
|
private vectorRemoval?;
|
|
3823
|
-
|
|
3991
|
+
/** Table prefix for the source store; undefined (unit-test mocks) means no store access. */
|
|
3992
|
+
private prefix?;
|
|
3993
|
+
constructor(db: SQLiteAdapter, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, edgeRepo: EdgeRepository, metadataRepo: MetadataRepository, searchService: SearchService, jobManager: JobManager, embeddingService: EmbeddingService, options?: Pick<WikiOptions, 'onDiagnostic' | 'forceDeleteIgnoreRankerHook' | 'config'>, vectorRemoval?: VectorRemovalService | undefined,
|
|
3994
|
+
/** Table prefix for the source store; undefined (unit-test mocks) means no store access. */
|
|
3995
|
+
prefix?: string | undefined);
|
|
3824
3996
|
exportDump(entityIds?: string[]): Promise<MemoryDump>;
|
|
3825
3997
|
importDump(dump: MemoryDump, opts?: {
|
|
3826
3998
|
merge?: boolean;
|
|
3827
|
-
}): Promise<
|
|
3999
|
+
}): Promise<ImportDumpResult>;
|
|
4000
|
+
private storePrefix;
|
|
4001
|
+
private storePresent;
|
|
4002
|
+
/** Spec source-store §8: stored sources for one exported entity; [] when none. */
|
|
4003
|
+
private exportStoredSources;
|
|
4004
|
+
/**
|
|
4005
|
+
* Spec source-store §8/§9 import step, inside the import transaction. One
|
|
4006
|
+
* source at a time; a refusal skips that source only. Uses the
|
|
4007
|
+
* same upsert helper as SourceStoreService.storeSource, inside this transaction. A ref already stored is replaced: the dump is the
|
|
4008
|
+
* truth for that ref (so no hash_mismatch refusal on import).
|
|
4009
|
+
*/
|
|
4010
|
+
private importStoredSources;
|
|
3828
4011
|
getFullBundle(entityId: string, opts?: {
|
|
3829
4012
|
maxEvents?: number;
|
|
3830
4013
|
includeBlobs?: boolean;
|
|
3831
4014
|
}): Promise<MemoryBundle>;
|
|
3832
4015
|
/** Single-entity import transaction + post-processing; package-internal hook for tests. */
|
|
3833
|
-
doImportEntity(entityId: string, bundle:
|
|
4016
|
+
doImportEntity(entityId: string, bundle: MemoryDumpEntity, merge: boolean): Promise<ImportDumpResult['skippedSources']>;
|
|
3834
4017
|
private _warnCrossEntityCollision;
|
|
3835
4018
|
private _normalizeImportedSourceType;
|
|
3836
4019
|
assertNoLegacySourceTypes(): Promise<void>;
|
|
@@ -3845,6 +4028,13 @@ declare class RetrievalService {
|
|
|
3845
4028
|
private searchService;
|
|
3846
4029
|
constructor(options: WikiOptions, entryRepo: EntryRepository, taskRepo: TaskRepository, eventRepo: EventRepository, metadataRepo: MetadataRepository, searchService: SearchService);
|
|
3847
4030
|
read(entityId: string | string[], query: string, options?: ReadOptions): Promise<MemoryBundle>;
|
|
4031
|
+
/**
|
|
4032
|
+
* The `sources` group (spec source-store section 7). One search per entity,
|
|
4033
|
+
* so ranking and caps never cross entities. No model call anywhere.
|
|
4034
|
+
* `charBudget` is per entity: windows are cut in rank order against the
|
|
4035
|
+
* entity's remaining budget, and once it is spent lower-ranked hits are not returned.
|
|
4036
|
+
*/
|
|
4037
|
+
private _readSources;
|
|
3848
4038
|
/**
|
|
3849
4039
|
* Returns entity IDs that will participate in scored retrieval.
|
|
3850
4040
|
* Excludes zero-weight entities unless includeZeroWeightEntities is true.
|
|
@@ -3986,6 +4176,7 @@ declare class WikiMemory {
|
|
|
3986
4176
|
private importExportService;
|
|
3987
4177
|
private retrievalService;
|
|
3988
4178
|
private writeService;
|
|
4179
|
+
private sourceStoreService;
|
|
3989
4180
|
private promptService;
|
|
3990
4181
|
private ontologyService;
|
|
3991
4182
|
private graphTraversalService;
|
|
@@ -4052,9 +4243,13 @@ declare class WikiMemory {
|
|
|
4052
4243
|
* host runs a plain `setup()` outside the lease.
|
|
4053
4244
|
*
|
|
4054
4245
|
* Keyword-index catch-up work is bounded by `config.setupBudgetMs`; anything
|
|
4055
|
-
* left converges on later opens and no-arg `syncSearchIndex()` calls
|
|
4056
|
-
*
|
|
4057
|
-
*
|
|
4246
|
+
* left converges on later opens, and on no-arg `syncSearchIndex()` calls for
|
|
4247
|
+
* the entries ledger. Passage-ledger leftover converges on later opens and on
|
|
4248
|
+
* passage-store writes for the entity (`storeSource`, `forget`,
|
|
4249
|
+
* `importDump`), which drain that entity's rows; no-arg calls do not touch
|
|
4250
|
+
* the passage ledger. Not bounded: an index reset (tokenizer change, re-attach
|
|
4251
|
+
* after detach, a lost or inconsistent index), which runs as one unchunked
|
|
4252
|
+
* transaction.
|
|
4058
4253
|
*/
|
|
4059
4254
|
setup(opts?: {
|
|
4060
4255
|
migrations?: MigrationPolicy;
|
|
@@ -4138,6 +4333,10 @@ declare class WikiMemory {
|
|
|
4138
4333
|
sourceHash: string | null;
|
|
4139
4334
|
factCount: number;
|
|
4140
4335
|
lastIngestedAt: number;
|
|
4336
|
+
stored?: {
|
|
4337
|
+
charCount: number;
|
|
4338
|
+
staleHash?: true;
|
|
4339
|
+
} | null;
|
|
4141
4340
|
}>>;
|
|
4142
4341
|
/**
|
|
4143
4342
|
* Returns the live source_refs for an entity that hold the given source_hash.
|
|
@@ -4310,7 +4509,7 @@ declare class WikiMemory {
|
|
|
4310
4509
|
getEntitySummary(entityId: string): Promise<string | null>;
|
|
4311
4510
|
importDump(dump: MemoryDump, opts?: {
|
|
4312
4511
|
merge?: boolean;
|
|
4313
|
-
}): Promise<
|
|
4512
|
+
}): Promise<ImportDumpResult>;
|
|
4314
4513
|
/**
|
|
4315
4514
|
* Soft-delete facts and tasks by id, by source, or all of them (`clearAll`).
|
|
4316
4515
|
* `clearAll` also deletes the entity's edges and its source-ref index rows.
|
|
@@ -4332,6 +4531,14 @@ declare class WikiMemory {
|
|
|
4332
4531
|
forget(entityId: string, params: ForgetParams, opts?: {
|
|
4333
4532
|
dryRun?: boolean;
|
|
4334
4533
|
}): Promise<ForgetResult>;
|
|
4534
|
+
/** Store a source's text (spec source-store §7). Refusals return `stored: false`; a busy lock throws. */
|
|
4535
|
+
storeSource(entityId: string, params: {
|
|
4536
|
+
sourceRef: string;
|
|
4537
|
+
sourceHash: string;
|
|
4538
|
+
text: string;
|
|
4539
|
+
}): Promise<StoreSourceResult>;
|
|
4540
|
+
getStoredSource(entityId: string, sourceRef: string): Promise<StoredSource | null>;
|
|
4541
|
+
listStoredSources(entityId: string): Promise<StoredSourceSummary[]>;
|
|
4335
4542
|
/**
|
|
4336
4543
|
* End `oldId`'s validity and link it to its replacement (spec §4.3). One
|
|
4337
4544
|
* transaction. Throws `WikiSupersedeError` for missing, foreign, already
|
|
@@ -4558,5 +4765,5 @@ declare class WikiMemory {
|
|
|
4558
4765
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
4559
4766
|
}
|
|
4560
4767
|
|
|
4561
|
-
export { HEAL_BATCH_SIZE as H, ONTOLOGY_BACKFILL_BATCH_SIZE as
|
|
4562
|
-
export type {
|
|
4768
|
+
export { HEAL_BATCH_SIZE as H, ONTOLOGY_BACKFILL_BATCH_SIZE as P, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as Q, ONTOLOGY_BACKFILL_RECHECK_MS as T, PromptService as a4, PrunePartialFailureError as a5, WikiGraphNodeOwnershipConflict as aA, WikiIngestEmptyError as aB, WikiInvalidReadOptions as aD, WikiMigrationRequiredError as aG, WikiParseError as aI, WikiSearchUnavailableError as aJ, WikiSourceRefHashCollision as aL, WikiStrictOntologyViolation as aM, WikiSupersedeError as aN, WikiTransactionError as aQ, isWikiSearchUnavailableError as aR, validateManifest as aS, EmbeddingService as aT, ImportExportService as aU, IngestionService as aV, JobManager as aW, MaintenanceService as aX, RetrievalService as aY, SearchService as aZ, WriteService as a_, WikiBusyError as ak, WikiDraftNotFound as au, WikiDuplicateHashError as av, WikiExternalDeletionError as ay, WikiMemory as c, HEAL_RECHECK_MS as u, HOOK_TIMEOUT_MARKER as v };
|
|
4769
|
+
export type { OntologyUpdates as $, LockedMaintenanceJob as A, MaintenanceJob as B, ChunkFailure as C, DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, ImportDumpResult as I, MaintenanceStopReason as J, MemoryDumpEntity as K, LLMProvider as L, MemoryBundle as M, MigrationPolicy as N, OntologyMode as O, ReadOptions as R, SQLiteAdapter as S, OntologyBackfillResult as U, OntologyConfig as V, WikiOptions as W, OntologyEdgeType as X, OntologyManifest as Y, OntologyNodeType as Z, OntologyPromptContext as _, MemoryDump as a, PendingMaintenance as a0, PendingMigrationWork as a1, PendingSourceStatus as a2, PromptOverrides as a3, ReembedResult as a6, RememberInput as a7, RunPendingMaintenanceOptions as a8, RunPendingMaintenanceResult as a9, WikiInstructions as aC, WikiLintReport as aE, WikiMemoryTestAccess as aF, WikiOutboxEvent as aH, WikiSourcePointer as aK, WikiSupersedeReason as aO, WikiTask as aP, SourcePassage as aa, StoreSourceResult as ab, StoredSource as ac, StoredSourceDump as ad, StoredSourceSummary as ae, SupersedeReplacement as af, VectorRanker as ag, VectorRankerFallback as ah, VectorRankerRankArgs as ai, VectorRankerSemanticResult as aj, WikiBusyOperation as al, WikiCheckpoint as am, WikiConfig as an, WikiDiagnostic as ao, WikiDiagnosticCode as ap, WikiDiagnosticDetail as aq, WikiDiagnosticOperation as ar, WikiDiagnosticSeverity as as, WikiDiagnosticTrigger as at, WikiEdge as aw, WikiEvent as ax, WikiFact as az, FormattedMemoryDump as b, ClassifierAnswer as d, ClassifierQuestion as e, ClassifyRequest as f, ClassifyResponse as g, DraftPage as h, EmbedFailureKind as i, EmbeddingMarkerKind as j, EntityMaintenanceReport as k, EntityStatus as l, ExtractedFact as m, ExtractedFactEdge as n, ExtractedFactWithOntology as o, ExtractedTask as p, ForgetParams as q, ForgetResult as r, GraphTraversalOptions as s, GroundingConfig as t, HealResult as w, IngestDocumentResult as x, LibrarianConfig as y, LibrarianGateConfig as z };
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aT as EmbeddingService, aU as ImportExportService, aV as IngestionService, aW as JobManager, aW as JobManagerType, aX as MaintenanceService, aY as RetrievalService, aZ as SearchService, aZ as SearchServiceType, aF as WikiMemoryTestAccess, a_ as WriteService } from './testing-BQScWWSA.mjs';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aT as EmbeddingService, aU as ImportExportService, aV as IngestionService, aW as JobManager, aW as JobManagerType, aX as MaintenanceService, aY as RetrievalService, aZ as SearchService, aZ as SearchServiceType, aF as WikiMemoryTestAccess, a_ as WriteService } from './testing-BQScWWSA.js';
|
|
2
2
|
import '@equationalapplications/core-okf';
|