@equationalapplications/core-llm-wiki 7.2.0 → 7.3.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 +23 -0
- package/dist/{chunk-TTECJ3S3.mjs → chunk-IAYO63DQ.mjs} +346 -41
- package/dist/chunk-IAYO63DQ.mjs.map +1 -0
- package/dist/index.d.mts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +388 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -11
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-DYeMd9d1.d.mts → testing-ht1qOvcD.d.mts} +98 -6
- package/dist/{testing-DYeMd9d1.d.ts → testing-ht1qOvcD.d.ts} +98 -6
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +336 -38
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +5 -5
- package/dist/chunk-TTECJ3S3.mjs.map +0 -1
|
@@ -569,6 +569,48 @@ interface VectorRanker {
|
|
|
569
569
|
* Fallback policy when rankBySimilarity rejects.
|
|
570
570
|
*/
|
|
571
571
|
type VectorRankerFallback = 'js-cosine' | 'keyword' | 'empty' | 'throw';
|
|
572
|
+
/** Severity is fixed per code (spec §4.2.6). */
|
|
573
|
+
type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
|
|
574
|
+
/**
|
|
575
|
+
* Closed for this release series, but new codes are added in minor versions:
|
|
576
|
+
* hosts must tolerate codes they do not recognize.
|
|
577
|
+
*/
|
|
578
|
+
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';
|
|
579
|
+
/** The service run that emitted the diagnostic. */
|
|
580
|
+
type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write';
|
|
581
|
+
/** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
|
|
582
|
+
type WikiDiagnosticTrigger = 'call' | 'auto';
|
|
583
|
+
/** Identifiers only — never titles, bodies, quotes, LLM output, provider messages, or hashes of content. */
|
|
584
|
+
interface WikiDiagnosticDetail {
|
|
585
|
+
factId?: string;
|
|
586
|
+
sourceRef?: string;
|
|
587
|
+
chunkIndex?: number;
|
|
588
|
+
edgeType?: string;
|
|
589
|
+
/** Manifest slug of the edge source, when resolved. */
|
|
590
|
+
sourceNodeType?: string;
|
|
591
|
+
/** Manifest slug of the edge target, when resolved. */
|
|
592
|
+
targetNodeType?: string;
|
|
593
|
+
/** Position of a rejected item in the LLM response array. */
|
|
594
|
+
itemIndex?: number;
|
|
595
|
+
/** Machine-readable sub-reason, e.g. `'target_not_found'`. */
|
|
596
|
+
reason?: string;
|
|
597
|
+
/** Aggregated `ingest_chunk_failed` only; the first 20 failed chunk indexes. */
|
|
598
|
+
chunkIndexes?: number[];
|
|
599
|
+
/** Aggregated emissions only. */
|
|
600
|
+
count?: number;
|
|
601
|
+
}
|
|
602
|
+
interface WikiDiagnostic {
|
|
603
|
+
code: WikiDiagnosticCode;
|
|
604
|
+
severity: WikiDiagnosticSeverity;
|
|
605
|
+
operation: WikiDiagnosticOperation;
|
|
606
|
+
trigger: WikiDiagnosticTrigger;
|
|
607
|
+
entityId: string;
|
|
608
|
+
/** Epoch ms, sampled at emission. */
|
|
609
|
+
at: number;
|
|
610
|
+
/** Fixed template per code. Never contains content. */
|
|
611
|
+
message: string;
|
|
612
|
+
detail?: WikiDiagnosticDetail;
|
|
613
|
+
}
|
|
572
614
|
interface WikiOptions {
|
|
573
615
|
config?: WikiConfig;
|
|
574
616
|
llmProvider: LLMProvider;
|
|
@@ -634,6 +676,14 @@ interface WikiOptions {
|
|
|
634
676
|
* NOT GDPR-safe for live indexes. Default false.
|
|
635
677
|
*/
|
|
636
678
|
forceDeleteIgnoreRankerHook?: boolean;
|
|
679
|
+
/**
|
|
680
|
+
* Receives typed, content-free diagnostics for events core previously
|
|
681
|
+
* dropped silently or only logged (spec §4). Synchronous; a returned promise
|
|
682
|
+
* is ignored. A throwing or rejecting hook never affects the operation that
|
|
683
|
+
* emitted the diagnostic. Existing console output is unchanged whether or
|
|
684
|
+
* not this is set.
|
|
685
|
+
*/
|
|
686
|
+
onDiagnostic?: (diagnostic: WikiDiagnostic) => void;
|
|
637
687
|
}
|
|
638
688
|
interface MemoryBundle {
|
|
639
689
|
facts: WikiFact[];
|
|
@@ -1640,6 +1690,34 @@ declare class JobManager {
|
|
|
1640
1690
|
private _notifyStatusSubscribers;
|
|
1641
1691
|
}
|
|
1642
1692
|
|
|
1693
|
+
declare function validateManifest(manifest: OntologyManifest): void;
|
|
1694
|
+
type EdgeDropReason = 'no_source_type' | 'invalid_shape' | 'type_not_in_manifest' | 'target_not_found' | 'target_type_mismatch';
|
|
1695
|
+
/** A dropped LLM-proposed edge. Slugs only — `target_title` is content and is never recorded. */
|
|
1696
|
+
interface EdgeDrop {
|
|
1697
|
+
reason: EdgeDropReason;
|
|
1698
|
+
/** Source fact id when known; null while validating before the fact has an id. */
|
|
1699
|
+
sourceId: string | null;
|
|
1700
|
+
edgeType: string | null;
|
|
1701
|
+
sourceNodeType: string | null;
|
|
1702
|
+
targetNodeType: string | null;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
/** What a call site supplies; severity, message and timestamp are derived from `code`. */
|
|
1706
|
+
type WikiDiagnosticInput = Omit<WikiDiagnostic, 'severity' | 'message' | 'at'>;
|
|
1707
|
+
type DiagnosticTarget = Pick<WikiOptions, 'onDiagnostic'>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Operation-scoped buffer (spec §4.2.4): push while the operation's
|
|
1710
|
+
* transaction is open, `flush` after it commits, `discard` (or simply drop the
|
|
1711
|
+
* buffer) when the operation throws.
|
|
1712
|
+
*/
|
|
1713
|
+
declare class DiagnosticBuffer {
|
|
1714
|
+
private items;
|
|
1715
|
+
push(input: WikiDiagnosticInput): void;
|
|
1716
|
+
get size(): number;
|
|
1717
|
+
flush(options: DiagnosticTarget): void;
|
|
1718
|
+
discard(): void;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1643
1721
|
interface NeighborhoodQueryOptions {
|
|
1644
1722
|
maxDepth: number;
|
|
1645
1723
|
direction: 'inbound' | 'outbound' | 'both';
|
|
@@ -1690,6 +1768,10 @@ type EmbedFactResult = {
|
|
|
1690
1768
|
ok: false;
|
|
1691
1769
|
kind: EmbedFailureKind;
|
|
1692
1770
|
};
|
|
1771
|
+
interface EmbedDiagnosticContext {
|
|
1772
|
+
operation: WikiDiagnosticOperation;
|
|
1773
|
+
trigger: WikiDiagnosticTrigger;
|
|
1774
|
+
}
|
|
1693
1775
|
declare class EmbeddingService {
|
|
1694
1776
|
private db;
|
|
1695
1777
|
private options;
|
|
@@ -1732,7 +1814,10 @@ declare class EmbeddingService {
|
|
|
1732
1814
|
title: string;
|
|
1733
1815
|
body: string;
|
|
1734
1816
|
tags: string | string[];
|
|
1735
|
-
}): Promise<EmbedFactResult>;
|
|
1817
|
+
}, ctx?: EmbedDiagnosticContext): Promise<EmbedFactResult>;
|
|
1818
|
+
private reportEmbed;
|
|
1819
|
+
/** For callers that invoke `notifyEmbeddingPersisted` directly and catch its failure. */
|
|
1820
|
+
reportHookFailed(ctx: EmbedDiagnosticContext, entityId: string, factId: string): void;
|
|
1736
1821
|
/** Marker writes must never fail the caller. Only marker-eligible kinds reach here. */
|
|
1737
1822
|
private markFailure;
|
|
1738
1823
|
/**
|
|
@@ -1746,7 +1831,7 @@ declare class EmbeddingService {
|
|
|
1746
1831
|
title: string;
|
|
1747
1832
|
body: string;
|
|
1748
1833
|
tags: string | string[];
|
|
1749
|
-
}): Promise<boolean>;
|
|
1834
|
+
}, ctx?: EmbedDiagnosticContext): Promise<boolean>;
|
|
1750
1835
|
notifyEmbeddingPersisted(entityId: string, factId: string, vector: Float32Array | null): Promise<void>;
|
|
1751
1836
|
notifyEmbeddingPersistedOrThrow(entityId: string, factId: string, vector: Float32Array | null): Promise<void>;
|
|
1752
1837
|
}
|
|
@@ -1776,6 +1861,7 @@ declare class OntologyService {
|
|
|
1776
1861
|
validateAndNormalizeFact(fact: ExtractedFactWithOntology, manifest: OntologyManifest, opts?: {
|
|
1777
1862
|
strict?: boolean;
|
|
1778
1863
|
entityId?: string;
|
|
1864
|
+
drops?: EdgeDrop[];
|
|
1779
1865
|
}): {
|
|
1780
1866
|
okf_type: string | null;
|
|
1781
1867
|
edges: ExtractedFactEdge[];
|
|
@@ -1787,7 +1873,7 @@ declare class OntologyService {
|
|
|
1787
1873
|
* writes inside their own transaction (e.g. `IngestionService.ingestDocument`
|
|
1788
1874
|
* when delegating to `upsertGraphCore`).
|
|
1789
1875
|
*/
|
|
1790
|
-
resolveEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, now: number): WikiEdge[];
|
|
1876
|
+
resolveEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, now: number, drops?: EdgeDrop[]): WikiEdge[];
|
|
1791
1877
|
/**
|
|
1792
1878
|
* Backwards-compatible wrapper: resolves edges via {@link resolveEdges},
|
|
1793
1879
|
* then persists each via `edgeRepo.addIgnoreDuplicate` in the supplied
|
|
@@ -1795,7 +1881,7 @@ declare class OntologyService {
|
|
|
1795
1881
|
* want self-contained edge persistence (e.g. MaintenanceService heal /
|
|
1796
1882
|
* backfill callers that do not have a separate edge-write step).
|
|
1797
1883
|
*/
|
|
1798
|
-
resolveAndPersistEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, tx: SQLiteAdapter, now: number): Promise<number>;
|
|
1884
|
+
resolveAndPersistEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, tx: SQLiteAdapter, now: number, drops?: EdgeDrop[]): Promise<number>;
|
|
1799
1885
|
}
|
|
1800
1886
|
|
|
1801
1887
|
declare class PromptService {
|
|
@@ -1943,6 +2029,10 @@ declare class IngestionService {
|
|
|
1943
2029
|
}[];
|
|
1944
2030
|
}, tx: SQLiteAdapter, opts?: {
|
|
1945
2031
|
strict?: boolean;
|
|
2032
|
+
diag?: {
|
|
2033
|
+
buffer: DiagnosticBuffer;
|
|
2034
|
+
operation: 'ingest' | 'upsertGraph';
|
|
2035
|
+
};
|
|
1946
2036
|
}): Promise<{
|
|
1947
2037
|
nodesWritten: number;
|
|
1948
2038
|
edgesWritten: number;
|
|
@@ -2189,7 +2279,7 @@ declare class MaintenanceService {
|
|
|
2189
2279
|
*/
|
|
2190
2280
|
private forgetDryRun;
|
|
2191
2281
|
/** Core librarian pass (locks handled by {@link runLibrarian}). Package-internal orchestration hook. */
|
|
2192
|
-
doRunLibrarian(entityId: string, promptOverride?: string): Promise<void>;
|
|
2282
|
+
doRunLibrarian(entityId: string, promptOverride?: string, trigger?: WikiDiagnosticTrigger): Promise<void>;
|
|
2193
2283
|
/**
|
|
2194
2284
|
* Core heal pass (locks handled by {@link runHeal}). Package-internal orchestration hook.
|
|
2195
2285
|
*
|
|
@@ -2201,6 +2291,7 @@ declare class MaintenanceService {
|
|
|
2201
2291
|
promptOverride?: string;
|
|
2202
2292
|
batchSize?: number;
|
|
2203
2293
|
bodyTruncationChars?: number;
|
|
2294
|
+
trigger?: WikiDiagnosticTrigger;
|
|
2204
2295
|
}): Promise<HealResult>;
|
|
2205
2296
|
/** Core ontology backfill pass (locks handled by {@link runOntologyBackfill}). Package-internal orchestration hook. */
|
|
2206
2297
|
doRunOntologyBackfill(entityId: string, options?: {
|
|
@@ -2319,6 +2410,7 @@ declare class WriteService {
|
|
|
2319
2410
|
* {@link write}) so a partial pass retries on the next write.
|
|
2320
2411
|
*/
|
|
2321
2412
|
private maybeRunHeal;
|
|
2413
|
+
private reportBackgroundFailure;
|
|
2322
2414
|
}
|
|
2323
2415
|
|
|
2324
2416
|
/**
|
|
@@ -2713,4 +2805,4 @@ declare class WikiMemory {
|
|
|
2713
2805
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
2714
2806
|
}
|
|
2715
2807
|
|
|
2716
|
-
export {
|
|
2808
|
+
export { type WikiDiagnosticSeverity as $, type ReembedResult as A, type VectorRankerFallback 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 VectorRankerRankArgs as J, type VectorRankerSemanticResult as K, type LLMProvider as L, type MemoryBundle as M, WikiBusyError as N, ONTOLOGY_BACKFILL_BATCH_SIZE as O, type PromptOverrides as P, type WikiBusyOperation as Q, type ReadOptions as R, type SQLiteAdapter as S, type WikiCheckpoint as T, type WikiConfig as U, type VectorRanker as V, type WikiOptions as W, type WikiDiagnostic as X, type WikiDiagnosticCode as Y, type WikiDiagnosticDetail as Z, type WikiDiagnosticOperation as _, type MemoryDump as a, type WikiDiagnosticTrigger as a0, WikiDuplicateHashError as a1, type WikiEdge as a2, type WikiEvent as a3, type WikiFact as a4, WikiGraphNodeOwnershipConflict as a5, WikiIngestEmptyError as a6, WikiInvalidReadOptions as a7, type WikiMemoryTestAccess as a8, type WikiOutboxEvent as a9, WikiParseError as aa, WikiSourceRefHashCollision as ab, WikiStrictOntologyViolation as ac, type WikiTask as ad, WikiTransactionError as ae, validateManifest as af, EmbeddingService as ag, ImportExportService as ah, IngestionService as ai, JobManager as aj, MaintenanceService as ak, RetrievalService as al, SearchService as am, WriteService as an, type FormattedMemoryDump as b, WikiMemory as c, type EmbedFailureKind as d, type EmbeddingMarkerKind as e, type EntityStatus as f, type ExtractedFact as g, type ExtractedFactEdge as h, type ExtractedFactWithOntology as i, type ExtractedTask as j, type GraphTraversalOptions as k, HEAL_RECHECK_MS as l, HOOK_TIMEOUT_MARKER as m, type HealResult as n, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as o, ONTOLOGY_BACKFILL_RECHECK_MS as p, type OntologyBackfillResult as q, type OntologyConfig as r, type OntologyEdgeType as s, type OntologyManifest as t, type OntologyMode as u, type OntologyNodeType as v, type OntologyPromptContext as w, type OntologyUpdates as x, PromptService as y, PrunePartialFailureError as z };
|
|
@@ -569,6 +569,48 @@ interface VectorRanker {
|
|
|
569
569
|
* Fallback policy when rankBySimilarity rejects.
|
|
570
570
|
*/
|
|
571
571
|
type VectorRankerFallback = 'js-cosine' | 'keyword' | 'empty' | 'throw';
|
|
572
|
+
/** Severity is fixed per code (spec §4.2.6). */
|
|
573
|
+
type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
|
|
574
|
+
/**
|
|
575
|
+
* Closed for this release series, but new codes are added in minor versions:
|
|
576
|
+
* hosts must tolerate codes they do not recognize.
|
|
577
|
+
*/
|
|
578
|
+
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';
|
|
579
|
+
/** The service run that emitted the diagnostic. */
|
|
580
|
+
type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write';
|
|
581
|
+
/** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
|
|
582
|
+
type WikiDiagnosticTrigger = 'call' | 'auto';
|
|
583
|
+
/** Identifiers only — never titles, bodies, quotes, LLM output, provider messages, or hashes of content. */
|
|
584
|
+
interface WikiDiagnosticDetail {
|
|
585
|
+
factId?: string;
|
|
586
|
+
sourceRef?: string;
|
|
587
|
+
chunkIndex?: number;
|
|
588
|
+
edgeType?: string;
|
|
589
|
+
/** Manifest slug of the edge source, when resolved. */
|
|
590
|
+
sourceNodeType?: string;
|
|
591
|
+
/** Manifest slug of the edge target, when resolved. */
|
|
592
|
+
targetNodeType?: string;
|
|
593
|
+
/** Position of a rejected item in the LLM response array. */
|
|
594
|
+
itemIndex?: number;
|
|
595
|
+
/** Machine-readable sub-reason, e.g. `'target_not_found'`. */
|
|
596
|
+
reason?: string;
|
|
597
|
+
/** Aggregated `ingest_chunk_failed` only; the first 20 failed chunk indexes. */
|
|
598
|
+
chunkIndexes?: number[];
|
|
599
|
+
/** Aggregated emissions only. */
|
|
600
|
+
count?: number;
|
|
601
|
+
}
|
|
602
|
+
interface WikiDiagnostic {
|
|
603
|
+
code: WikiDiagnosticCode;
|
|
604
|
+
severity: WikiDiagnosticSeverity;
|
|
605
|
+
operation: WikiDiagnosticOperation;
|
|
606
|
+
trigger: WikiDiagnosticTrigger;
|
|
607
|
+
entityId: string;
|
|
608
|
+
/** Epoch ms, sampled at emission. */
|
|
609
|
+
at: number;
|
|
610
|
+
/** Fixed template per code. Never contains content. */
|
|
611
|
+
message: string;
|
|
612
|
+
detail?: WikiDiagnosticDetail;
|
|
613
|
+
}
|
|
572
614
|
interface WikiOptions {
|
|
573
615
|
config?: WikiConfig;
|
|
574
616
|
llmProvider: LLMProvider;
|
|
@@ -634,6 +676,14 @@ interface WikiOptions {
|
|
|
634
676
|
* NOT GDPR-safe for live indexes. Default false.
|
|
635
677
|
*/
|
|
636
678
|
forceDeleteIgnoreRankerHook?: boolean;
|
|
679
|
+
/**
|
|
680
|
+
* Receives typed, content-free diagnostics for events core previously
|
|
681
|
+
* dropped silently or only logged (spec §4). Synchronous; a returned promise
|
|
682
|
+
* is ignored. A throwing or rejecting hook never affects the operation that
|
|
683
|
+
* emitted the diagnostic. Existing console output is unchanged whether or
|
|
684
|
+
* not this is set.
|
|
685
|
+
*/
|
|
686
|
+
onDiagnostic?: (diagnostic: WikiDiagnostic) => void;
|
|
637
687
|
}
|
|
638
688
|
interface MemoryBundle {
|
|
639
689
|
facts: WikiFact[];
|
|
@@ -1640,6 +1690,34 @@ declare class JobManager {
|
|
|
1640
1690
|
private _notifyStatusSubscribers;
|
|
1641
1691
|
}
|
|
1642
1692
|
|
|
1693
|
+
declare function validateManifest(manifest: OntologyManifest): void;
|
|
1694
|
+
type EdgeDropReason = 'no_source_type' | 'invalid_shape' | 'type_not_in_manifest' | 'target_not_found' | 'target_type_mismatch';
|
|
1695
|
+
/** A dropped LLM-proposed edge. Slugs only — `target_title` is content and is never recorded. */
|
|
1696
|
+
interface EdgeDrop {
|
|
1697
|
+
reason: EdgeDropReason;
|
|
1698
|
+
/** Source fact id when known; null while validating before the fact has an id. */
|
|
1699
|
+
sourceId: string | null;
|
|
1700
|
+
edgeType: string | null;
|
|
1701
|
+
sourceNodeType: string | null;
|
|
1702
|
+
targetNodeType: string | null;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
/** What a call site supplies; severity, message and timestamp are derived from `code`. */
|
|
1706
|
+
type WikiDiagnosticInput = Omit<WikiDiagnostic, 'severity' | 'message' | 'at'>;
|
|
1707
|
+
type DiagnosticTarget = Pick<WikiOptions, 'onDiagnostic'>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Operation-scoped buffer (spec §4.2.4): push while the operation's
|
|
1710
|
+
* transaction is open, `flush` after it commits, `discard` (or simply drop the
|
|
1711
|
+
* buffer) when the operation throws.
|
|
1712
|
+
*/
|
|
1713
|
+
declare class DiagnosticBuffer {
|
|
1714
|
+
private items;
|
|
1715
|
+
push(input: WikiDiagnosticInput): void;
|
|
1716
|
+
get size(): number;
|
|
1717
|
+
flush(options: DiagnosticTarget): void;
|
|
1718
|
+
discard(): void;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1643
1721
|
interface NeighborhoodQueryOptions {
|
|
1644
1722
|
maxDepth: number;
|
|
1645
1723
|
direction: 'inbound' | 'outbound' | 'both';
|
|
@@ -1690,6 +1768,10 @@ type EmbedFactResult = {
|
|
|
1690
1768
|
ok: false;
|
|
1691
1769
|
kind: EmbedFailureKind;
|
|
1692
1770
|
};
|
|
1771
|
+
interface EmbedDiagnosticContext {
|
|
1772
|
+
operation: WikiDiagnosticOperation;
|
|
1773
|
+
trigger: WikiDiagnosticTrigger;
|
|
1774
|
+
}
|
|
1693
1775
|
declare class EmbeddingService {
|
|
1694
1776
|
private db;
|
|
1695
1777
|
private options;
|
|
@@ -1732,7 +1814,10 @@ declare class EmbeddingService {
|
|
|
1732
1814
|
title: string;
|
|
1733
1815
|
body: string;
|
|
1734
1816
|
tags: string | string[];
|
|
1735
|
-
}): Promise<EmbedFactResult>;
|
|
1817
|
+
}, ctx?: EmbedDiagnosticContext): Promise<EmbedFactResult>;
|
|
1818
|
+
private reportEmbed;
|
|
1819
|
+
/** For callers that invoke `notifyEmbeddingPersisted` directly and catch its failure. */
|
|
1820
|
+
reportHookFailed(ctx: EmbedDiagnosticContext, entityId: string, factId: string): void;
|
|
1736
1821
|
/** Marker writes must never fail the caller. Only marker-eligible kinds reach here. */
|
|
1737
1822
|
private markFailure;
|
|
1738
1823
|
/**
|
|
@@ -1746,7 +1831,7 @@ declare class EmbeddingService {
|
|
|
1746
1831
|
title: string;
|
|
1747
1832
|
body: string;
|
|
1748
1833
|
tags: string | string[];
|
|
1749
|
-
}): Promise<boolean>;
|
|
1834
|
+
}, ctx?: EmbedDiagnosticContext): Promise<boolean>;
|
|
1750
1835
|
notifyEmbeddingPersisted(entityId: string, factId: string, vector: Float32Array | null): Promise<void>;
|
|
1751
1836
|
notifyEmbeddingPersistedOrThrow(entityId: string, factId: string, vector: Float32Array | null): Promise<void>;
|
|
1752
1837
|
}
|
|
@@ -1776,6 +1861,7 @@ declare class OntologyService {
|
|
|
1776
1861
|
validateAndNormalizeFact(fact: ExtractedFactWithOntology, manifest: OntologyManifest, opts?: {
|
|
1777
1862
|
strict?: boolean;
|
|
1778
1863
|
entityId?: string;
|
|
1864
|
+
drops?: EdgeDrop[];
|
|
1779
1865
|
}): {
|
|
1780
1866
|
okf_type: string | null;
|
|
1781
1867
|
edges: ExtractedFactEdge[];
|
|
@@ -1787,7 +1873,7 @@ declare class OntologyService {
|
|
|
1787
1873
|
* writes inside their own transaction (e.g. `IngestionService.ingestDocument`
|
|
1788
1874
|
* when delegating to `upsertGraphCore`).
|
|
1789
1875
|
*/
|
|
1790
|
-
resolveEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, now: number): WikiEdge[];
|
|
1876
|
+
resolveEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, now: number, drops?: EdgeDrop[]): WikiEdge[];
|
|
1791
1877
|
/**
|
|
1792
1878
|
* Backwards-compatible wrapper: resolves edges via {@link resolveEdges},
|
|
1793
1879
|
* then persists each via `edgeRepo.addIgnoreDuplicate` in the supplied
|
|
@@ -1795,7 +1881,7 @@ declare class OntologyService {
|
|
|
1795
1881
|
* want self-contained edge persistence (e.g. MaintenanceService heal /
|
|
1796
1882
|
* backfill callers that do not have a separate edge-write step).
|
|
1797
1883
|
*/
|
|
1798
|
-
resolveAndPersistEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, tx: SQLiteAdapter, now: number): Promise<number>;
|
|
1884
|
+
resolveAndPersistEdges(entityId: string, sourceId: string, sourceType: string | null, edges: ExtractedFactEdge[], manifest: OntologyManifest, titleIndex: Map<string, TitleIndexEntry>, tx: SQLiteAdapter, now: number, drops?: EdgeDrop[]): Promise<number>;
|
|
1799
1885
|
}
|
|
1800
1886
|
|
|
1801
1887
|
declare class PromptService {
|
|
@@ -1943,6 +2029,10 @@ declare class IngestionService {
|
|
|
1943
2029
|
}[];
|
|
1944
2030
|
}, tx: SQLiteAdapter, opts?: {
|
|
1945
2031
|
strict?: boolean;
|
|
2032
|
+
diag?: {
|
|
2033
|
+
buffer: DiagnosticBuffer;
|
|
2034
|
+
operation: 'ingest' | 'upsertGraph';
|
|
2035
|
+
};
|
|
1946
2036
|
}): Promise<{
|
|
1947
2037
|
nodesWritten: number;
|
|
1948
2038
|
edgesWritten: number;
|
|
@@ -2189,7 +2279,7 @@ declare class MaintenanceService {
|
|
|
2189
2279
|
*/
|
|
2190
2280
|
private forgetDryRun;
|
|
2191
2281
|
/** Core librarian pass (locks handled by {@link runLibrarian}). Package-internal orchestration hook. */
|
|
2192
|
-
doRunLibrarian(entityId: string, promptOverride?: string): Promise<void>;
|
|
2282
|
+
doRunLibrarian(entityId: string, promptOverride?: string, trigger?: WikiDiagnosticTrigger): Promise<void>;
|
|
2193
2283
|
/**
|
|
2194
2284
|
* Core heal pass (locks handled by {@link runHeal}). Package-internal orchestration hook.
|
|
2195
2285
|
*
|
|
@@ -2201,6 +2291,7 @@ declare class MaintenanceService {
|
|
|
2201
2291
|
promptOverride?: string;
|
|
2202
2292
|
batchSize?: number;
|
|
2203
2293
|
bodyTruncationChars?: number;
|
|
2294
|
+
trigger?: WikiDiagnosticTrigger;
|
|
2204
2295
|
}): Promise<HealResult>;
|
|
2205
2296
|
/** Core ontology backfill pass (locks handled by {@link runOntologyBackfill}). Package-internal orchestration hook. */
|
|
2206
2297
|
doRunOntologyBackfill(entityId: string, options?: {
|
|
@@ -2319,6 +2410,7 @@ declare class WriteService {
|
|
|
2319
2410
|
* {@link write}) so a partial pass retries on the next write.
|
|
2320
2411
|
*/
|
|
2321
2412
|
private maybeRunHeal;
|
|
2413
|
+
private reportBackgroundFailure;
|
|
2322
2414
|
}
|
|
2323
2415
|
|
|
2324
2416
|
/**
|
|
@@ -2713,4 +2805,4 @@ declare class WikiMemory {
|
|
|
2713
2805
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
2714
2806
|
}
|
|
2715
2807
|
|
|
2716
|
-
export {
|
|
2808
|
+
export { type WikiDiagnosticSeverity as $, type ReembedResult as A, type VectorRankerFallback 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 VectorRankerRankArgs as J, type VectorRankerSemanticResult as K, type LLMProvider as L, type MemoryBundle as M, WikiBusyError as N, ONTOLOGY_BACKFILL_BATCH_SIZE as O, type PromptOverrides as P, type WikiBusyOperation as Q, type ReadOptions as R, type SQLiteAdapter as S, type WikiCheckpoint as T, type WikiConfig as U, type VectorRanker as V, type WikiOptions as W, type WikiDiagnostic as X, type WikiDiagnosticCode as Y, type WikiDiagnosticDetail as Z, type WikiDiagnosticOperation as _, type MemoryDump as a, type WikiDiagnosticTrigger as a0, WikiDuplicateHashError as a1, type WikiEdge as a2, type WikiEvent as a3, type WikiFact as a4, WikiGraphNodeOwnershipConflict as a5, WikiIngestEmptyError as a6, WikiInvalidReadOptions as a7, type WikiMemoryTestAccess as a8, type WikiOutboxEvent as a9, WikiParseError as aa, WikiSourceRefHashCollision as ab, WikiStrictOntologyViolation as ac, type WikiTask as ad, WikiTransactionError as ae, validateManifest as af, EmbeddingService as ag, ImportExportService as ah, IngestionService as ai, JobManager as aj, MaintenanceService as ak, RetrievalService as al, SearchService as am, WriteService as an, type FormattedMemoryDump as b, WikiMemory as c, type EmbedFailureKind as d, type EmbeddingMarkerKind as e, type EntityStatus as f, type ExtractedFact as g, type ExtractedFactEdge as h, type ExtractedFactWithOntology as i, type ExtractedTask as j, type GraphTraversalOptions as k, HEAL_RECHECK_MS as l, HOOK_TIMEOUT_MARKER as m, type HealResult as n, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as o, ONTOLOGY_BACKFILL_RECHECK_MS as p, type OntologyBackfillResult as q, type OntologyConfig as r, type OntologyEdgeType as s, type OntologyManifest as t, type OntologyMode as u, type OntologyNodeType as v, type OntologyPromptContext as w, type OntologyUpdates as x, PromptService as y, PrunePartialFailureError as z };
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ag as EmbeddingService, ah as ImportExportService, ai as IngestionService, aj as JobManager, aj as JobManagerType, ak as MaintenanceService, al as RetrievalService, am as SearchService, am as SearchServiceType, a8 as WikiMemoryTestAccess, an as WriteService } from './testing-ht1qOvcD.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 { ag as EmbeddingService, ah as ImportExportService, ai as IngestionService, aj as JobManager, aj as JobManagerType, ak as MaintenanceService, al as RetrievalService, am as SearchService, am as SearchServiceType, a8 as WikiMemoryTestAccess, an as WriteService } from './testing-ht1qOvcD.js';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
|
3
3
|
import 'minisearch';
|