@equationalapplications/core-llm-wiki 9.5.3 → 9.7.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-QIS2SGUM.mjs → chunk-6UTHJFXH.mjs} +390 -95
- package/dist/chunk-6UTHJFXH.mjs.map +1 -0
- package/dist/index.d.mts +91 -17
- package/dist/index.d.ts +91 -17
- package/dist/index.js +434 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -12
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-BA6CedgZ.d.mts → testing-T0GgG1L6.d.mts} +152 -11
- package/dist/{testing-BA6CedgZ.d.ts → testing-T0GgG1L6.d.ts} +152 -11
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +347 -54
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-QIS2SGUM.mjs.map +0 -1
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import { OkfSource, OkfVerifiedEntry, OkfSourceUsageWindow } from '@equationalapplications/core-okf';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* System-One config surface (specs/system-one-config §1, §10).
|
|
5
|
+
*
|
|
6
|
+
* Boundary: S1-0 owns exactly `typing`, `minConfidence` (with the `'typing'`
|
|
7
|
+
* member), and `onLowConfidence`. Later PRs add more threshold sites
|
|
8
|
+
* (`'edges'`, `'resolve'`, `'healScreen'`) — each as one new line in
|
|
9
|
+
* `SystemOneThresholdSite`, so sibling PRs merge cleanly. Nothing outside
|
|
10
|
+
* that boundary belongs here.
|
|
11
|
+
*/
|
|
12
|
+
/** Sites a System-One threshold can apply to. Exactly one member today (§10 fence). */
|
|
13
|
+
type SystemOneThresholdSite = 'typing';
|
|
14
|
+
interface SystemOneConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Typing mode for ontology backfill. `'auto'` uses
|
|
17
|
+
* `llmProvider.classify` when present (no edges proposed); `'llm'`
|
|
18
|
+
* always uses the generative path. Default `'llm'`.
|
|
19
|
+
*/
|
|
20
|
+
typing?: 'auto' | 'llm';
|
|
21
|
+
/** Per-site minimum confidence. Only the classifier path reads a floor. */
|
|
22
|
+
minConfidence?: Partial<Record<SystemOneThresholdSite, number>>;
|
|
23
|
+
/**
|
|
24
|
+
* Routing for classifier low-confidence outcomes (and abstains).
|
|
25
|
+
* `'leave'` (default) keeps them untyped and cooldown-stamped; `'llm'`
|
|
26
|
+
* escalates them to the generative step of the same pass. A cost and
|
|
27
|
+
* quality setting, not a safety mechanism; a no-op when typing resolves
|
|
28
|
+
* `'llm'`.
|
|
29
|
+
*/
|
|
30
|
+
onLowConfidence?: 'leave' | 'llm';
|
|
31
|
+
}
|
|
32
|
+
|
|
3
33
|
/**
|
|
4
34
|
* Platform-agnostic SQLite driver interface.
|
|
5
35
|
* Each platform package (wiki-expo, wiki-react) provides an adapter
|
|
@@ -53,6 +83,7 @@ interface PromptOverrides {
|
|
|
53
83
|
guidance?: string;
|
|
54
84
|
}
|
|
55
85
|
type OntologyMode = 'strict' | 'emergent' | 'off';
|
|
86
|
+
|
|
56
87
|
interface OntologyNodeType {
|
|
57
88
|
type: string;
|
|
58
89
|
description: string;
|
|
@@ -98,6 +129,13 @@ interface OntologyConfig {
|
|
|
98
129
|
backfillClassifier?: 'auto' | 'llm';
|
|
99
130
|
/** Minimum classifier confidence to apply a node type. Finite, in [0, 1]. Default 0.5. */
|
|
100
131
|
classifyMinConfidence?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Batch size for scheduler-driven (`runPendingMaintenance`) ontology
|
|
134
|
+
* backfill passes. Finite integer >= 1; invalid values fall back to the
|
|
135
|
+
* default. Default 50. Does not change the manual `runOntologyBackfill`
|
|
136
|
+
* default (25).
|
|
137
|
+
*/
|
|
138
|
+
schedulerBatchSize?: number;
|
|
101
139
|
}
|
|
102
140
|
interface ExtractedFactEdge {
|
|
103
141
|
edge_type: string;
|
|
@@ -112,7 +150,7 @@ interface OntologyPromptContext {
|
|
|
112
150
|
ontologyModeInstructions: string;
|
|
113
151
|
}
|
|
114
152
|
/** Result of a single ontology backfill run. Omissions (facts the model declined
|
|
115
|
-
* to classify) are
|
|
153
|
+
* to classify) are carried by `abstained`, not derived from the other counters. */
|
|
116
154
|
interface OntologyBackfillResult {
|
|
117
155
|
/** Untyped facts sent to the model this run. */
|
|
118
156
|
scanned: number;
|
|
@@ -120,6 +158,12 @@ interface OntologyBackfillResult {
|
|
|
120
158
|
typed: number;
|
|
121
159
|
/** Model classifications rejected (unknown/duplicate id, non-manifest type). */
|
|
122
160
|
failedValidation: number;
|
|
161
|
+
/** Untyped facts the typing model declined to classify — classifier abstains under
|
|
162
|
+
* `onLowConfidence: 'leave'`, and generative omissions (facts the model sent no
|
|
163
|
+
* classification for, including the `changes === 0` race). `scanned − typed −
|
|
164
|
+
* failedValidation` no longer pins this down once escalation routes facts
|
|
165
|
+
* between steps (specs/system-one-config §4-§5). */
|
|
166
|
+
abstained: number;
|
|
123
167
|
/** Edges persisted. */
|
|
124
168
|
edgesAdded: number;
|
|
125
169
|
/** Untyped facts still eligible after this run — safe host convergence signal: loop while > 0.
|
|
@@ -285,6 +329,24 @@ interface LibrarianConfig {
|
|
|
285
329
|
guidanceForEntity?: (entityId: string) => string | undefined;
|
|
286
330
|
}
|
|
287
331
|
interface WikiConfig {
|
|
332
|
+
/**
|
|
333
|
+
* Context-budget section (specs/context-budget). Absent, or
|
|
334
|
+
* `budget: 'legacy'`, keeps today's caps byte-identical.
|
|
335
|
+
* `budget: 'declared'` requires `contextWindowTokens` and derives the
|
|
336
|
+
* per-op prompt caps from the host's declared window; invalid values throw
|
|
337
|
+
* at construction (fail-fast, never fall back to legacy).
|
|
338
|
+
*/
|
|
339
|
+
context?: {
|
|
340
|
+
budget: 'legacy' | 'declared';
|
|
341
|
+
/** Required under `budget: 'declared'`. */
|
|
342
|
+
contextWindowTokens?: number;
|
|
343
|
+
/** Chars per token for the host's tokenizer. Default 4. */
|
|
344
|
+
charsPerToken?: number;
|
|
345
|
+
/** Fraction of the derived window usable for prompts. Default 0.9. */
|
|
346
|
+
safetyFraction?: number;
|
|
347
|
+
/** Tokens held back for the model's reply. Default 4000. */
|
|
348
|
+
outputReserveTokens?: number;
|
|
349
|
+
};
|
|
288
350
|
/** Source-store limits (spec source-store section 9). Defaults live in SourceStoreService. */
|
|
289
351
|
sourceStore?: {
|
|
290
352
|
maxCharsPerSource?: number;
|
|
@@ -353,6 +415,13 @@ interface WikiConfig {
|
|
|
353
415
|
*/
|
|
354
416
|
enableOutbox?: boolean;
|
|
355
417
|
ontology?: OntologyConfig;
|
|
418
|
+
/**
|
|
419
|
+
* System-One config surface (specs/system-one-config §1): typing mode,
|
|
420
|
+
* per-site confidence floor, and low-confidence routing. Resolution chains
|
|
421
|
+
* live in `utils/engineDefaults.ts` (`resolveSystemOneTyping`,
|
|
422
|
+
* `resolveTypingMinConfidence`).
|
|
423
|
+
*/
|
|
424
|
+
systemOne?: SystemOneConfig;
|
|
356
425
|
/** Default node cap for traverseGraph(), unless overridden per-call. Default 20. */
|
|
357
426
|
maxTraversalNodes?: number;
|
|
358
427
|
/**
|
|
@@ -873,7 +942,7 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
|
|
|
873
942
|
* Closed for this release series, but new codes are added in minor versions:
|
|
874
943
|
* hosts must tolerate codes they do not recognize.
|
|
875
944
|
*/
|
|
876
|
-
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' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | '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';
|
|
945
|
+
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' | 'classification_abstained' | 'node_type_assigned' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'ontology_backfill_held' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | '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';
|
|
877
946
|
/** The service run that emitted the diagnostic. */
|
|
878
947
|
type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore' | 'erase';
|
|
879
948
|
/** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
|
|
@@ -894,6 +963,10 @@ interface WikiDiagnosticDetail {
|
|
|
894
963
|
itemIndex?: number;
|
|
895
964
|
/** Machine-readable sub-reason, e.g. `'target_not_found'`. */
|
|
896
965
|
reason?: string;
|
|
966
|
+
/** `node_type_assigned` only: the manifest slug applied to the fact. */
|
|
967
|
+
okfType?: string;
|
|
968
|
+
/** Typing receipts only: which path produced the outcome. */
|
|
969
|
+
writer?: 'classifier' | 'llm';
|
|
897
970
|
/** Aggregated `ingest_chunk_failed` only; the first 20 failed chunk indexes. */
|
|
898
971
|
chunkIndexes?: number[];
|
|
899
972
|
/** Aggregated emissions only. */
|
|
@@ -1554,7 +1627,7 @@ interface WikiInstructions {
|
|
|
1554
1627
|
*/
|
|
1555
1628
|
ontologyBackfill: string;
|
|
1556
1629
|
}
|
|
1557
|
-
type MaintenanceJob = 'librarian' | 'heal' | 'reembed' | 'externalDeletions';
|
|
1630
|
+
type MaintenanceJob = 'librarian' | 'heal' | 'reembed' | 'externalDeletions' | 'ontologyBackfill';
|
|
1558
1631
|
/** The jobs that hold a per-entity lock (everything but `externalDeletions`). */
|
|
1559
1632
|
type LockedMaintenanceJob = Exclude<MaintenanceJob, 'externalDeletions'>;
|
|
1560
1633
|
interface PendingMaintenance {
|
|
@@ -1573,6 +1646,13 @@ interface PendingMaintenance {
|
|
|
1573
1646
|
reembedPending: boolean;
|
|
1574
1647
|
/** Removals still owed to the host's vector index for this entity (absent when none). */
|
|
1575
1648
|
pendingExternalDeletions?: number;
|
|
1649
|
+
/**
|
|
1650
|
+
* Untyped facts still eligible for ontology typing (absent when none).
|
|
1651
|
+
* Counts only facts outside the recheck cooldown — `deferred` ones are
|
|
1652
|
+
* waiting, not work the next pass will attempt. Always false-shaped (absent)
|
|
1653
|
+
* while ontology is off for the entity.
|
|
1654
|
+
*/
|
|
1655
|
+
pendingOntologyBackfill?: number;
|
|
1576
1656
|
}
|
|
1577
1657
|
interface RunPendingMaintenanceOptions {
|
|
1578
1658
|
/** Default: every entity with pending work. */
|
|
@@ -1581,7 +1661,7 @@ interface RunPendingMaintenanceOptions {
|
|
|
1581
1661
|
tokenBudget?: number;
|
|
1582
1662
|
/** Wall-clock milliseconds from the call. Checked between units; a unit in flight is never interrupted. */
|
|
1583
1663
|
deadlineMs?: number;
|
|
1584
|
-
/** Default all
|
|
1664
|
+
/** Default all five. `externalDeletions` runs first and is not metered by `tokenBudget`. */
|
|
1585
1665
|
jobs?: MaintenanceJob[];
|
|
1586
1666
|
}
|
|
1587
1667
|
type MaintenanceStopReason = {
|
|
@@ -1592,7 +1672,7 @@ type MaintenanceStopReason = {
|
|
|
1592
1672
|
reason: 'budget_exhausted';
|
|
1593
1673
|
} | {
|
|
1594
1674
|
reason: 'budget_too_small';
|
|
1595
|
-
job: 'librarian' | 'heal';
|
|
1675
|
+
job: 'librarian' | 'heal' | 'ontologyBackfill';
|
|
1596
1676
|
entityId: string;
|
|
1597
1677
|
requiredEstimate: number;
|
|
1598
1678
|
};
|
|
@@ -1602,6 +1682,10 @@ interface EntityMaintenanceReport {
|
|
|
1602
1682
|
factsWritten: number;
|
|
1603
1683
|
healPasses: number;
|
|
1604
1684
|
reembedded: boolean;
|
|
1685
|
+
/** Scheduler-driven ontology-backfill passes run for this entity (0 when the job was off). */
|
|
1686
|
+
ontologyBackfillPasses: number;
|
|
1687
|
+
/** Facts that received an okf_type during this run's ontology-backfill passes. */
|
|
1688
|
+
typed: number;
|
|
1605
1689
|
/** Set when a lock was held elsewhere; nothing ran for that job. */
|
|
1606
1690
|
busy?: LockedMaintenanceJob[];
|
|
1607
1691
|
/**
|
|
@@ -2895,6 +2979,18 @@ declare class JobManager {
|
|
|
2895
2979
|
private _notifyStatusSubscribers;
|
|
2896
2980
|
}
|
|
2897
2981
|
|
|
2982
|
+
/**
|
|
2983
|
+
* Reserved abstain sentinel (specs/system-one-config §5): appended to the
|
|
2984
|
+
* classifier choice question so a classifier can decline every offered
|
|
2985
|
+
* manifest slug. Comparison is case-insensitive and whitespace-trimmed, and
|
|
2986
|
+
* the reservation is enforced on the write paths (`setOntologyManifests`,
|
|
2987
|
+
* `mergeEmergentUpdates`) — per-read `validateManifest` is deliberately
|
|
2988
|
+
* untouched (coordination decree C4), so a legacy manifest carrying the slug
|
|
2989
|
+
* only forecloses the classifier fast path; it never breaks reads.
|
|
2990
|
+
*/
|
|
2991
|
+
declare const ONTOLOGY_ABSTAIN_SENTINEL = "none_of_these";
|
|
2992
|
+
/** True when a raw slug is the reserved abstain sentinel (case/trim-insensitive). */
|
|
2993
|
+
declare function isReservedAbstainSlug(raw: unknown): boolean;
|
|
2898
2994
|
declare function validateManifest(manifest: OntologyManifest): void;
|
|
2899
2995
|
type EdgeDropReason = 'no_source_type' | 'invalid_shape' | 'type_not_in_manifest' | 'target_not_found' | 'target_type_mismatch';
|
|
2900
2996
|
/** A dropped LLM-proposed edge. Slugs only — `target_title` is content and is never recorded. */
|
|
@@ -3849,6 +3945,13 @@ interface LibrarianResult {
|
|
|
3849
3945
|
declare const ONTOLOGY_BACKFILL_BATCH_SIZE = 25;
|
|
3850
3946
|
declare const ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS = 40000;
|
|
3851
3947
|
declare const ONTOLOGY_BACKFILL_RECHECK_MS: number;
|
|
3948
|
+
/**
|
|
3949
|
+
* Upper bound on one classifier choice question (specs/system-one-config §5):
|
|
3950
|
+
* manifest slugs plus the abstain sentinel. A manifest with more slugs than
|
|
3951
|
+
* the cap allows, or carrying the reserved sentinel slug, falls back to the
|
|
3952
|
+
* generative path for the pass.
|
|
3953
|
+
*/
|
|
3954
|
+
declare const CLASSIFIER_MAX_CHOICES: 255;
|
|
3852
3955
|
|
|
3853
3956
|
/**
|
|
3854
3957
|
* Heal candidates fetched per pass. Bounds the pool runBatched draws from, not
|
|
@@ -3994,6 +4097,21 @@ declare class MaintenanceService {
|
|
|
3994
4097
|
classifier?: 'auto' | 'llm';
|
|
3995
4098
|
tokenBudget?: number;
|
|
3996
4099
|
}): Promise<OntologyBackfillResult>;
|
|
4100
|
+
/**
|
|
4101
|
+
* Scheduler read view (specs/system-one-config §8): untyped facts still
|
|
4102
|
+
* eligible for typing this pass — outside the 7-day recheck cooldown — or 0
|
|
4103
|
+
* when ontology is off for the entity (nothing is ever eligible there).
|
|
4104
|
+
* Read-only: never materializes a seed manifest, never writes.
|
|
4105
|
+
*/
|
|
4106
|
+
pendingOntologyBackfill(entityId: string): Promise<number>;
|
|
4107
|
+
/**
|
|
4108
|
+
* Emit `ontology_backfill_held` (severity `info`) when the scheduler found
|
|
4109
|
+
* the entity's `ontologyBackfill` lock held by another job. The lock state
|
|
4110
|
+
* names no content, so the fixed template carries all the information a
|
|
4111
|
+
* host needs; `JobManager.isBlocked` does not identify the blocker and the
|
|
4112
|
+
* diagnostic detail surface stays identifier-typed.
|
|
4113
|
+
*/
|
|
4114
|
+
noteOntologyBackfillHeld(entityId: string): void;
|
|
3997
4115
|
/**
|
|
3998
4116
|
* Re-embed facts, honouring per-row failure markers and exponential backoff.
|
|
3999
4117
|
*
|
|
@@ -4137,12 +4255,33 @@ declare class MaintenanceService {
|
|
|
4137
4255
|
classifier?: 'auto' | 'llm';
|
|
4138
4256
|
tokenBudget?: number;
|
|
4139
4257
|
meter?: UsageMeter;
|
|
4258
|
+
/** Diagnostic trigger stamped on every diagnostic this pass emits. Default `'call'`. */
|
|
4259
|
+
trigger?: WikiDiagnosticTrigger;
|
|
4140
4260
|
}): Promise<OntologyBackfillResult>;
|
|
4141
4261
|
/**
|
|
4142
|
-
*
|
|
4143
|
-
*
|
|
4144
|
-
*
|
|
4145
|
-
*
|
|
4262
|
+
* Low-confidence routing (specs/system-one-config §4): `'leave'` (default)
|
|
4263
|
+
* keeps classifier abstains/low-confidence facts untyped and
|
|
4264
|
+
* cooldown-stamped; `'llm'` escalates them to the generative step. Invalid
|
|
4265
|
+
* config warns once and is treated as unset. Cost/quality setting, not a
|
|
4266
|
+
* safety mechanism — it cannot catch a confidently wrong classifier.
|
|
4267
|
+
*/
|
|
4268
|
+
private resolveSystemOneOnLowConfidence;
|
|
4269
|
+
/**
|
|
4270
|
+
* Generative-mode backfill step: the original `generateText` pass over
|
|
4271
|
+
* `candidates`. Also the escalation target of the classifier step (§4) —
|
|
4272
|
+
* there `candidates` holds only the escalated facts and `batchSize` is
|
|
4273
|
+
* sized to send them in one batch.
|
|
4274
|
+
*/
|
|
4275
|
+
private _runGenerativeBackfill;
|
|
4276
|
+
/**
|
|
4277
|
+
* Classifier-mode backfill (spec §7.3, S1-0 §5): one `choice` question per
|
|
4278
|
+
* untyped fact over the effective manifest's node-type slugs plus the
|
|
4279
|
+
* reserved abstain sentinel. Accepted answers go through
|
|
4280
|
+
* `_applyOntologyBackfillBatch` exactly like LLM classifications. No edges
|
|
4281
|
+
* are proposed. Abstains and low-confidence answers are cooldown-stamped
|
|
4282
|
+
* omissions under `onLowConfidence: 'leave'`; under `'llm'` they are
|
|
4283
|
+
* returned un-stamped in `escalated` for the generative step. Always
|
|
4284
|
+
* returns the `OntologyBackfillResult` for its step plus escalation state.
|
|
4146
4285
|
*/
|
|
4147
4286
|
private _runClassifierBackfill;
|
|
4148
4287
|
/**
|
|
@@ -4193,6 +4332,8 @@ declare class MaintenanceScheduler {
|
|
|
4193
4332
|
private vectorRemovalService;
|
|
4194
4333
|
private vectorRemovalRepo;
|
|
4195
4334
|
constructor(db: SQLiteAdapter, options: WikiOptions, maintenanceService: MaintenanceService, metadataRepo: MetadataRepository, eventRepo: EventRepository, entryRepo: EntryRepository, jobManager: JobManager, vectorRemovalService: VectorRemovalService, vectorRemovalRepo: VectorRemovalRepository);
|
|
4335
|
+
/** Batch size for scheduler-driven ontology passes; resolved once (spec §8). */
|
|
4336
|
+
private readonly schedulerBatchSize;
|
|
4196
4337
|
/**
|
|
4197
4338
|
* Entities with **any** pending work only, sorted by `pendingEvents` desc
|
|
4198
4339
|
* then `entityId` asc. Token estimate is ceil(pending summary chars / 4),
|
|
@@ -5058,5 +5199,5 @@ declare class WikiMemory {
|
|
|
5058
5199
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
5059
5200
|
}
|
|
5060
5201
|
|
|
5061
|
-
export {
|
|
5062
|
-
export type {
|
|
5202
|
+
export { ONTOLOGY_BACKFILL_RECHECK_MS as $, HEAL_RECHECK_MS as A, HOOK_TIMEOUT_MARKER as B, CLASSIFIER_MAX_CHOICES as C, HEAL_BATCH_SIZE as H, ONTOLOGY_ABSTAIN_SENTINEL as Y, ONTOLOGY_BACKFILL_BATCH_SIZE as Z, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as _, EmbeddingService as a$, WikiDraftNotFound as aB, WikiDuplicateHashError as aC, WikiExternalDeletionError as aF, WikiGraphNodeOwnershipConflict as aH, WikiIngestEmptyError as aI, WikiInvalidReadOptions as aK, WikiMigrationRequiredError as aN, WikiParseError as aP, WikiSearchUnavailableError as aQ, WikiSourceRefHashCollision as aS, WikiStrictOntologyViolation as aT, WikiSupersedeError as aU, WikiTransactionError as aX, isReservedAbstainSlug as aY, isWikiSearchUnavailableError as aZ, validateManifest as a_, PromptService as aa, PrunePartialFailureError as ab, WikiBusyError as as, ImportExportService as b0, IngestionService as b1, JobManager as b2, MaintenanceService as b3, RetrievalService as b4, SearchService as b5, WriteService as b6, WikiMemory as e, CheckpointIncompleteError as f, EraseStepError as r };
|
|
5203
|
+
export type { DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, HealResult as I, ImportDumpResult as J, IngestDocumentResult as K, LLMProvider as L, MemoryBundle as M, LibrarianConfig as N, OntologyMode as O, LibrarianGateConfig as P, LockedMaintenanceJob as Q, ReadOptions as R, SQLiteAdapter as S, MaintenanceJob as T, MaintenanceStopReason as U, MemoryDumpEntity as V, WikiConfig as W, MigrationPolicy as X, MemoryDump as a, OntologyBackfillResult as a0, OntologyEdgeType as a1, OntologyManifest as a2, OntologyNodeType as a3, OntologyPromptContext as a4, OntologyUpdates as a5, PendingMaintenance as a6, PendingMigrationWork as a7, PendingSourceStatus as a8, PromptOverrides as a9, WikiDiagnosticTrigger as aA, WikiEdge as aD, WikiEvent as aE, WikiFact as aG, WikiInstructions as aJ, WikiLintReport as aL, WikiMemoryTestAccess as aM, WikiOutboxEvent as aO, WikiSourcePointer as aR, WikiSupersedeReason as aV, WikiTask as aW, ReembedResult as ac, RememberInput as ad, RunPendingMaintenanceOptions as ae, RunPendingMaintenanceResult as af, SourcePassage as ag, StoreSourceResult as ah, StoredSource as ai, StoredSourceDump as aj, StoredSourceSummary as ak, SupersedeReplacement as al, SystemOneConfig as am, SystemOneThresholdSite as an, VectorRanker as ao, VectorRankerFallback as ap, VectorRankerRankArgs as aq, VectorRankerSemanticResult as ar, WikiBusyOperation as at, WikiCheckpoint as au, WikiDiagnostic as av, WikiDiagnosticCode as aw, WikiDiagnosticDetail as ax, WikiDiagnosticOperation as ay, WikiDiagnosticSeverity as az, FormattedMemoryDump as b, OntologyConfig as c, WikiOptions as d, ChunkFailure as g, ClassifierAnswer as h, ClassifierQuestion as i, ClassifyRequest as j, ClassifyResponse as k, DraftPage as l, EmbedFailureKind as m, EmbeddingMarkerKind as n, EntityMaintenanceReport as o, EntityStatus as p, EraseReport as q, ExtractedFact as s, ExtractedFactEdge as t, ExtractedFactWithOntology as u, ExtractedTask as v, ForgetParams as w, ForgetResult as x, GraphTraversalOptions as y, GroundingConfig as z };
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import { OkfSource, OkfVerifiedEntry, OkfSourceUsageWindow } from '@equationalapplications/core-okf';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* System-One config surface (specs/system-one-config §1, §10).
|
|
5
|
+
*
|
|
6
|
+
* Boundary: S1-0 owns exactly `typing`, `minConfidence` (with the `'typing'`
|
|
7
|
+
* member), and `onLowConfidence`. Later PRs add more threshold sites
|
|
8
|
+
* (`'edges'`, `'resolve'`, `'healScreen'`) — each as one new line in
|
|
9
|
+
* `SystemOneThresholdSite`, so sibling PRs merge cleanly. Nothing outside
|
|
10
|
+
* that boundary belongs here.
|
|
11
|
+
*/
|
|
12
|
+
/** Sites a System-One threshold can apply to. Exactly one member today (§10 fence). */
|
|
13
|
+
type SystemOneThresholdSite = 'typing';
|
|
14
|
+
interface SystemOneConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Typing mode for ontology backfill. `'auto'` uses
|
|
17
|
+
* `llmProvider.classify` when present (no edges proposed); `'llm'`
|
|
18
|
+
* always uses the generative path. Default `'llm'`.
|
|
19
|
+
*/
|
|
20
|
+
typing?: 'auto' | 'llm';
|
|
21
|
+
/** Per-site minimum confidence. Only the classifier path reads a floor. */
|
|
22
|
+
minConfidence?: Partial<Record<SystemOneThresholdSite, number>>;
|
|
23
|
+
/**
|
|
24
|
+
* Routing for classifier low-confidence outcomes (and abstains).
|
|
25
|
+
* `'leave'` (default) keeps them untyped and cooldown-stamped; `'llm'`
|
|
26
|
+
* escalates them to the generative step of the same pass. A cost and
|
|
27
|
+
* quality setting, not a safety mechanism; a no-op when typing resolves
|
|
28
|
+
* `'llm'`.
|
|
29
|
+
*/
|
|
30
|
+
onLowConfidence?: 'leave' | 'llm';
|
|
31
|
+
}
|
|
32
|
+
|
|
3
33
|
/**
|
|
4
34
|
* Platform-agnostic SQLite driver interface.
|
|
5
35
|
* Each platform package (wiki-expo, wiki-react) provides an adapter
|
|
@@ -53,6 +83,7 @@ interface PromptOverrides {
|
|
|
53
83
|
guidance?: string;
|
|
54
84
|
}
|
|
55
85
|
type OntologyMode = 'strict' | 'emergent' | 'off';
|
|
86
|
+
|
|
56
87
|
interface OntologyNodeType {
|
|
57
88
|
type: string;
|
|
58
89
|
description: string;
|
|
@@ -98,6 +129,13 @@ interface OntologyConfig {
|
|
|
98
129
|
backfillClassifier?: 'auto' | 'llm';
|
|
99
130
|
/** Minimum classifier confidence to apply a node type. Finite, in [0, 1]. Default 0.5. */
|
|
100
131
|
classifyMinConfidence?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Batch size for scheduler-driven (`runPendingMaintenance`) ontology
|
|
134
|
+
* backfill passes. Finite integer >= 1; invalid values fall back to the
|
|
135
|
+
* default. Default 50. Does not change the manual `runOntologyBackfill`
|
|
136
|
+
* default (25).
|
|
137
|
+
*/
|
|
138
|
+
schedulerBatchSize?: number;
|
|
101
139
|
}
|
|
102
140
|
interface ExtractedFactEdge {
|
|
103
141
|
edge_type: string;
|
|
@@ -112,7 +150,7 @@ interface OntologyPromptContext {
|
|
|
112
150
|
ontologyModeInstructions: string;
|
|
113
151
|
}
|
|
114
152
|
/** Result of a single ontology backfill run. Omissions (facts the model declined
|
|
115
|
-
* to classify) are
|
|
153
|
+
* to classify) are carried by `abstained`, not derived from the other counters. */
|
|
116
154
|
interface OntologyBackfillResult {
|
|
117
155
|
/** Untyped facts sent to the model this run. */
|
|
118
156
|
scanned: number;
|
|
@@ -120,6 +158,12 @@ interface OntologyBackfillResult {
|
|
|
120
158
|
typed: number;
|
|
121
159
|
/** Model classifications rejected (unknown/duplicate id, non-manifest type). */
|
|
122
160
|
failedValidation: number;
|
|
161
|
+
/** Untyped facts the typing model declined to classify — classifier abstains under
|
|
162
|
+
* `onLowConfidence: 'leave'`, and generative omissions (facts the model sent no
|
|
163
|
+
* classification for, including the `changes === 0` race). `scanned − typed −
|
|
164
|
+
* failedValidation` no longer pins this down once escalation routes facts
|
|
165
|
+
* between steps (specs/system-one-config §4-§5). */
|
|
166
|
+
abstained: number;
|
|
123
167
|
/** Edges persisted. */
|
|
124
168
|
edgesAdded: number;
|
|
125
169
|
/** Untyped facts still eligible after this run — safe host convergence signal: loop while > 0.
|
|
@@ -285,6 +329,24 @@ interface LibrarianConfig {
|
|
|
285
329
|
guidanceForEntity?: (entityId: string) => string | undefined;
|
|
286
330
|
}
|
|
287
331
|
interface WikiConfig {
|
|
332
|
+
/**
|
|
333
|
+
* Context-budget section (specs/context-budget). Absent, or
|
|
334
|
+
* `budget: 'legacy'`, keeps today's caps byte-identical.
|
|
335
|
+
* `budget: 'declared'` requires `contextWindowTokens` and derives the
|
|
336
|
+
* per-op prompt caps from the host's declared window; invalid values throw
|
|
337
|
+
* at construction (fail-fast, never fall back to legacy).
|
|
338
|
+
*/
|
|
339
|
+
context?: {
|
|
340
|
+
budget: 'legacy' | 'declared';
|
|
341
|
+
/** Required under `budget: 'declared'`. */
|
|
342
|
+
contextWindowTokens?: number;
|
|
343
|
+
/** Chars per token for the host's tokenizer. Default 4. */
|
|
344
|
+
charsPerToken?: number;
|
|
345
|
+
/** Fraction of the derived window usable for prompts. Default 0.9. */
|
|
346
|
+
safetyFraction?: number;
|
|
347
|
+
/** Tokens held back for the model's reply. Default 4000. */
|
|
348
|
+
outputReserveTokens?: number;
|
|
349
|
+
};
|
|
288
350
|
/** Source-store limits (spec source-store section 9). Defaults live in SourceStoreService. */
|
|
289
351
|
sourceStore?: {
|
|
290
352
|
maxCharsPerSource?: number;
|
|
@@ -353,6 +415,13 @@ interface WikiConfig {
|
|
|
353
415
|
*/
|
|
354
416
|
enableOutbox?: boolean;
|
|
355
417
|
ontology?: OntologyConfig;
|
|
418
|
+
/**
|
|
419
|
+
* System-One config surface (specs/system-one-config §1): typing mode,
|
|
420
|
+
* per-site confidence floor, and low-confidence routing. Resolution chains
|
|
421
|
+
* live in `utils/engineDefaults.ts` (`resolveSystemOneTyping`,
|
|
422
|
+
* `resolveTypingMinConfidence`).
|
|
423
|
+
*/
|
|
424
|
+
systemOne?: SystemOneConfig;
|
|
356
425
|
/** Default node cap for traverseGraph(), unless overridden per-call. Default 20. */
|
|
357
426
|
maxTraversalNodes?: number;
|
|
358
427
|
/**
|
|
@@ -873,7 +942,7 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
|
|
|
873
942
|
* Closed for this release series, but new codes are added in minor versions:
|
|
874
943
|
* hosts must tolerate codes they do not recognize.
|
|
875
944
|
*/
|
|
876
|
-
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' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | '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';
|
|
945
|
+
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' | 'classification_abstained' | 'node_type_assigned' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'ontology_backfill_held' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | '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';
|
|
877
946
|
/** The service run that emitted the diagnostic. */
|
|
878
947
|
type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore' | 'erase';
|
|
879
948
|
/** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
|
|
@@ -894,6 +963,10 @@ interface WikiDiagnosticDetail {
|
|
|
894
963
|
itemIndex?: number;
|
|
895
964
|
/** Machine-readable sub-reason, e.g. `'target_not_found'`. */
|
|
896
965
|
reason?: string;
|
|
966
|
+
/** `node_type_assigned` only: the manifest slug applied to the fact. */
|
|
967
|
+
okfType?: string;
|
|
968
|
+
/** Typing receipts only: which path produced the outcome. */
|
|
969
|
+
writer?: 'classifier' | 'llm';
|
|
897
970
|
/** Aggregated `ingest_chunk_failed` only; the first 20 failed chunk indexes. */
|
|
898
971
|
chunkIndexes?: number[];
|
|
899
972
|
/** Aggregated emissions only. */
|
|
@@ -1554,7 +1627,7 @@ interface WikiInstructions {
|
|
|
1554
1627
|
*/
|
|
1555
1628
|
ontologyBackfill: string;
|
|
1556
1629
|
}
|
|
1557
|
-
type MaintenanceJob = 'librarian' | 'heal' | 'reembed' | 'externalDeletions';
|
|
1630
|
+
type MaintenanceJob = 'librarian' | 'heal' | 'reembed' | 'externalDeletions' | 'ontologyBackfill';
|
|
1558
1631
|
/** The jobs that hold a per-entity lock (everything but `externalDeletions`). */
|
|
1559
1632
|
type LockedMaintenanceJob = Exclude<MaintenanceJob, 'externalDeletions'>;
|
|
1560
1633
|
interface PendingMaintenance {
|
|
@@ -1573,6 +1646,13 @@ interface PendingMaintenance {
|
|
|
1573
1646
|
reembedPending: boolean;
|
|
1574
1647
|
/** Removals still owed to the host's vector index for this entity (absent when none). */
|
|
1575
1648
|
pendingExternalDeletions?: number;
|
|
1649
|
+
/**
|
|
1650
|
+
* Untyped facts still eligible for ontology typing (absent when none).
|
|
1651
|
+
* Counts only facts outside the recheck cooldown — `deferred` ones are
|
|
1652
|
+
* waiting, not work the next pass will attempt. Always false-shaped (absent)
|
|
1653
|
+
* while ontology is off for the entity.
|
|
1654
|
+
*/
|
|
1655
|
+
pendingOntologyBackfill?: number;
|
|
1576
1656
|
}
|
|
1577
1657
|
interface RunPendingMaintenanceOptions {
|
|
1578
1658
|
/** Default: every entity with pending work. */
|
|
@@ -1581,7 +1661,7 @@ interface RunPendingMaintenanceOptions {
|
|
|
1581
1661
|
tokenBudget?: number;
|
|
1582
1662
|
/** Wall-clock milliseconds from the call. Checked between units; a unit in flight is never interrupted. */
|
|
1583
1663
|
deadlineMs?: number;
|
|
1584
|
-
/** Default all
|
|
1664
|
+
/** Default all five. `externalDeletions` runs first and is not metered by `tokenBudget`. */
|
|
1585
1665
|
jobs?: MaintenanceJob[];
|
|
1586
1666
|
}
|
|
1587
1667
|
type MaintenanceStopReason = {
|
|
@@ -1592,7 +1672,7 @@ type MaintenanceStopReason = {
|
|
|
1592
1672
|
reason: 'budget_exhausted';
|
|
1593
1673
|
} | {
|
|
1594
1674
|
reason: 'budget_too_small';
|
|
1595
|
-
job: 'librarian' | 'heal';
|
|
1675
|
+
job: 'librarian' | 'heal' | 'ontologyBackfill';
|
|
1596
1676
|
entityId: string;
|
|
1597
1677
|
requiredEstimate: number;
|
|
1598
1678
|
};
|
|
@@ -1602,6 +1682,10 @@ interface EntityMaintenanceReport {
|
|
|
1602
1682
|
factsWritten: number;
|
|
1603
1683
|
healPasses: number;
|
|
1604
1684
|
reembedded: boolean;
|
|
1685
|
+
/** Scheduler-driven ontology-backfill passes run for this entity (0 when the job was off). */
|
|
1686
|
+
ontologyBackfillPasses: number;
|
|
1687
|
+
/** Facts that received an okf_type during this run's ontology-backfill passes. */
|
|
1688
|
+
typed: number;
|
|
1605
1689
|
/** Set when a lock was held elsewhere; nothing ran for that job. */
|
|
1606
1690
|
busy?: LockedMaintenanceJob[];
|
|
1607
1691
|
/**
|
|
@@ -2895,6 +2979,18 @@ declare class JobManager {
|
|
|
2895
2979
|
private _notifyStatusSubscribers;
|
|
2896
2980
|
}
|
|
2897
2981
|
|
|
2982
|
+
/**
|
|
2983
|
+
* Reserved abstain sentinel (specs/system-one-config §5): appended to the
|
|
2984
|
+
* classifier choice question so a classifier can decline every offered
|
|
2985
|
+
* manifest slug. Comparison is case-insensitive and whitespace-trimmed, and
|
|
2986
|
+
* the reservation is enforced on the write paths (`setOntologyManifests`,
|
|
2987
|
+
* `mergeEmergentUpdates`) — per-read `validateManifest` is deliberately
|
|
2988
|
+
* untouched (coordination decree C4), so a legacy manifest carrying the slug
|
|
2989
|
+
* only forecloses the classifier fast path; it never breaks reads.
|
|
2990
|
+
*/
|
|
2991
|
+
declare const ONTOLOGY_ABSTAIN_SENTINEL = "none_of_these";
|
|
2992
|
+
/** True when a raw slug is the reserved abstain sentinel (case/trim-insensitive). */
|
|
2993
|
+
declare function isReservedAbstainSlug(raw: unknown): boolean;
|
|
2898
2994
|
declare function validateManifest(manifest: OntologyManifest): void;
|
|
2899
2995
|
type EdgeDropReason = 'no_source_type' | 'invalid_shape' | 'type_not_in_manifest' | 'target_not_found' | 'target_type_mismatch';
|
|
2900
2996
|
/** A dropped LLM-proposed edge. Slugs only — `target_title` is content and is never recorded. */
|
|
@@ -3849,6 +3945,13 @@ interface LibrarianResult {
|
|
|
3849
3945
|
declare const ONTOLOGY_BACKFILL_BATCH_SIZE = 25;
|
|
3850
3946
|
declare const ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS = 40000;
|
|
3851
3947
|
declare const ONTOLOGY_BACKFILL_RECHECK_MS: number;
|
|
3948
|
+
/**
|
|
3949
|
+
* Upper bound on one classifier choice question (specs/system-one-config §5):
|
|
3950
|
+
* manifest slugs plus the abstain sentinel. A manifest with more slugs than
|
|
3951
|
+
* the cap allows, or carrying the reserved sentinel slug, falls back to the
|
|
3952
|
+
* generative path for the pass.
|
|
3953
|
+
*/
|
|
3954
|
+
declare const CLASSIFIER_MAX_CHOICES: 255;
|
|
3852
3955
|
|
|
3853
3956
|
/**
|
|
3854
3957
|
* Heal candidates fetched per pass. Bounds the pool runBatched draws from, not
|
|
@@ -3994,6 +4097,21 @@ declare class MaintenanceService {
|
|
|
3994
4097
|
classifier?: 'auto' | 'llm';
|
|
3995
4098
|
tokenBudget?: number;
|
|
3996
4099
|
}): Promise<OntologyBackfillResult>;
|
|
4100
|
+
/**
|
|
4101
|
+
* Scheduler read view (specs/system-one-config §8): untyped facts still
|
|
4102
|
+
* eligible for typing this pass — outside the 7-day recheck cooldown — or 0
|
|
4103
|
+
* when ontology is off for the entity (nothing is ever eligible there).
|
|
4104
|
+
* Read-only: never materializes a seed manifest, never writes.
|
|
4105
|
+
*/
|
|
4106
|
+
pendingOntologyBackfill(entityId: string): Promise<number>;
|
|
4107
|
+
/**
|
|
4108
|
+
* Emit `ontology_backfill_held` (severity `info`) when the scheduler found
|
|
4109
|
+
* the entity's `ontologyBackfill` lock held by another job. The lock state
|
|
4110
|
+
* names no content, so the fixed template carries all the information a
|
|
4111
|
+
* host needs; `JobManager.isBlocked` does not identify the blocker and the
|
|
4112
|
+
* diagnostic detail surface stays identifier-typed.
|
|
4113
|
+
*/
|
|
4114
|
+
noteOntologyBackfillHeld(entityId: string): void;
|
|
3997
4115
|
/**
|
|
3998
4116
|
* Re-embed facts, honouring per-row failure markers and exponential backoff.
|
|
3999
4117
|
*
|
|
@@ -4137,12 +4255,33 @@ declare class MaintenanceService {
|
|
|
4137
4255
|
classifier?: 'auto' | 'llm';
|
|
4138
4256
|
tokenBudget?: number;
|
|
4139
4257
|
meter?: UsageMeter;
|
|
4258
|
+
/** Diagnostic trigger stamped on every diagnostic this pass emits. Default `'call'`. */
|
|
4259
|
+
trigger?: WikiDiagnosticTrigger;
|
|
4140
4260
|
}): Promise<OntologyBackfillResult>;
|
|
4141
4261
|
/**
|
|
4142
|
-
*
|
|
4143
|
-
*
|
|
4144
|
-
*
|
|
4145
|
-
*
|
|
4262
|
+
* Low-confidence routing (specs/system-one-config §4): `'leave'` (default)
|
|
4263
|
+
* keeps classifier abstains/low-confidence facts untyped and
|
|
4264
|
+
* cooldown-stamped; `'llm'` escalates them to the generative step. Invalid
|
|
4265
|
+
* config warns once and is treated as unset. Cost/quality setting, not a
|
|
4266
|
+
* safety mechanism — it cannot catch a confidently wrong classifier.
|
|
4267
|
+
*/
|
|
4268
|
+
private resolveSystemOneOnLowConfidence;
|
|
4269
|
+
/**
|
|
4270
|
+
* Generative-mode backfill step: the original `generateText` pass over
|
|
4271
|
+
* `candidates`. Also the escalation target of the classifier step (§4) —
|
|
4272
|
+
* there `candidates` holds only the escalated facts and `batchSize` is
|
|
4273
|
+
* sized to send them in one batch.
|
|
4274
|
+
*/
|
|
4275
|
+
private _runGenerativeBackfill;
|
|
4276
|
+
/**
|
|
4277
|
+
* Classifier-mode backfill (spec §7.3, S1-0 §5): one `choice` question per
|
|
4278
|
+
* untyped fact over the effective manifest's node-type slugs plus the
|
|
4279
|
+
* reserved abstain sentinel. Accepted answers go through
|
|
4280
|
+
* `_applyOntologyBackfillBatch` exactly like LLM classifications. No edges
|
|
4281
|
+
* are proposed. Abstains and low-confidence answers are cooldown-stamped
|
|
4282
|
+
* omissions under `onLowConfidence: 'leave'`; under `'llm'` they are
|
|
4283
|
+
* returned un-stamped in `escalated` for the generative step. Always
|
|
4284
|
+
* returns the `OntologyBackfillResult` for its step plus escalation state.
|
|
4146
4285
|
*/
|
|
4147
4286
|
private _runClassifierBackfill;
|
|
4148
4287
|
/**
|
|
@@ -4193,6 +4332,8 @@ declare class MaintenanceScheduler {
|
|
|
4193
4332
|
private vectorRemovalService;
|
|
4194
4333
|
private vectorRemovalRepo;
|
|
4195
4334
|
constructor(db: SQLiteAdapter, options: WikiOptions, maintenanceService: MaintenanceService, metadataRepo: MetadataRepository, eventRepo: EventRepository, entryRepo: EntryRepository, jobManager: JobManager, vectorRemovalService: VectorRemovalService, vectorRemovalRepo: VectorRemovalRepository);
|
|
4335
|
+
/** Batch size for scheduler-driven ontology passes; resolved once (spec §8). */
|
|
4336
|
+
private readonly schedulerBatchSize;
|
|
4196
4337
|
/**
|
|
4197
4338
|
* Entities with **any** pending work only, sorted by `pendingEvents` desc
|
|
4198
4339
|
* then `entityId` asc. Token estimate is ceil(pending summary chars / 4),
|
|
@@ -5058,5 +5199,5 @@ declare class WikiMemory {
|
|
|
5058
5199
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
5059
5200
|
}
|
|
5060
5201
|
|
|
5061
|
-
export {
|
|
5062
|
-
export type {
|
|
5202
|
+
export { ONTOLOGY_BACKFILL_RECHECK_MS as $, HEAL_RECHECK_MS as A, HOOK_TIMEOUT_MARKER as B, CLASSIFIER_MAX_CHOICES as C, HEAL_BATCH_SIZE as H, ONTOLOGY_ABSTAIN_SENTINEL as Y, ONTOLOGY_BACKFILL_BATCH_SIZE as Z, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS as _, EmbeddingService as a$, WikiDraftNotFound as aB, WikiDuplicateHashError as aC, WikiExternalDeletionError as aF, WikiGraphNodeOwnershipConflict as aH, WikiIngestEmptyError as aI, WikiInvalidReadOptions as aK, WikiMigrationRequiredError as aN, WikiParseError as aP, WikiSearchUnavailableError as aQ, WikiSourceRefHashCollision as aS, WikiStrictOntologyViolation as aT, WikiSupersedeError as aU, WikiTransactionError as aX, isReservedAbstainSlug as aY, isWikiSearchUnavailableError as aZ, validateManifest as a_, PromptService as aa, PrunePartialFailureError as ab, WikiBusyError as as, ImportExportService as b0, IngestionService as b1, JobManager as b2, MaintenanceService as b3, RetrievalService as b4, SearchService as b5, WriteService as b6, WikiMemory as e, CheckpointIncompleteError as f, EraseStepError as r };
|
|
5203
|
+
export type { DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, HealResult as I, ImportDumpResult as J, IngestDocumentResult as K, LLMProvider as L, MemoryBundle as M, LibrarianConfig as N, OntologyMode as O, LibrarianGateConfig as P, LockedMaintenanceJob as Q, ReadOptions as R, SQLiteAdapter as S, MaintenanceJob as T, MaintenanceStopReason as U, MemoryDumpEntity as V, WikiConfig as W, MigrationPolicy as X, MemoryDump as a, OntologyBackfillResult as a0, OntologyEdgeType as a1, OntologyManifest as a2, OntologyNodeType as a3, OntologyPromptContext as a4, OntologyUpdates as a5, PendingMaintenance as a6, PendingMigrationWork as a7, PendingSourceStatus as a8, PromptOverrides as a9, WikiDiagnosticTrigger as aA, WikiEdge as aD, WikiEvent as aE, WikiFact as aG, WikiInstructions as aJ, WikiLintReport as aL, WikiMemoryTestAccess as aM, WikiOutboxEvent as aO, WikiSourcePointer as aR, WikiSupersedeReason as aV, WikiTask as aW, ReembedResult as ac, RememberInput as ad, RunPendingMaintenanceOptions as ae, RunPendingMaintenanceResult as af, SourcePassage as ag, StoreSourceResult as ah, StoredSource as ai, StoredSourceDump as aj, StoredSourceSummary as ak, SupersedeReplacement as al, SystemOneConfig as am, SystemOneThresholdSite as an, VectorRanker as ao, VectorRankerFallback as ap, VectorRankerRankArgs as aq, VectorRankerSemanticResult as ar, WikiBusyOperation as at, WikiCheckpoint as au, WikiDiagnostic as av, WikiDiagnosticCode as aw, WikiDiagnosticDetail as ax, WikiDiagnosticOperation as ay, WikiDiagnosticSeverity as az, FormattedMemoryDump as b, OntologyConfig as c, WikiOptions as d, ChunkFailure as g, ClassifierAnswer as h, ClassifierQuestion as i, ClassifyRequest as j, ClassifyResponse as k, DraftPage as l, EmbedFailureKind as m, EmbeddingMarkerKind as n, EntityMaintenanceReport as o, EntityStatus as p, EraseReport as q, ExtractedFact as s, ExtractedFactEdge as t, ExtractedFactWithOntology as u, ExtractedTask as v, ForgetParams as w, ForgetResult as x, GraphTraversalOptions as y, GroundingConfig as z };
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a$ as EmbeddingService, b0 as ImportExportService, b1 as IngestionService, b2 as JobManager, b2 as JobManagerType, b3 as MaintenanceService, b4 as RetrievalService, b5 as SearchService, b5 as SearchServiceType, aM as WikiMemoryTestAccess, b6 as WriteService } from './testing-T0GgG1L6.mjs';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a$ as EmbeddingService, b0 as ImportExportService, b1 as IngestionService, b2 as JobManager, b2 as JobManagerType, b3 as MaintenanceService, b4 as RetrievalService, b5 as SearchService, b5 as SearchServiceType, aM as WikiMemoryTestAccess, b6 as WriteService } from './testing-T0GgG1L6.js';
|
|
2
2
|
import '@equationalapplications/core-okf';
|