@equationalapplications/core-llm-wiki 9.16.2 → 9.18.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-64ZKSSY6.mjs → chunk-FX4J6MLA.mjs} +192 -51
- package/dist/chunk-FX4J6MLA.mjs.map +1 -0
- package/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +282 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +94 -24
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-DNSqIkkv.d.mts → testing-CI0n5qQk.d.mts} +111 -12
- package/dist/{testing-DNSqIkkv.d.ts → testing-CI0n5qQk.d.ts} +111 -12
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +850 -724
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-64ZKSSY6.mjs.map +0 -1
|
@@ -9,8 +9,9 @@ import { OkfSource, OkfVerifiedEntry, OkfSourceUsageWindow } from '@equationalap
|
|
|
9
9
|
* the heal-screen step added the `'healScreen'` member. Each landed as one
|
|
10
10
|
* new line in
|
|
11
11
|
* `SystemOneThresholdSite`, so sibling PRs merged cleanly. The type-on-write
|
|
12
|
-
* step landed the `typeOnWrite` key
|
|
13
|
-
*
|
|
12
|
+
* step landed the `typeOnWrite` key and the ingest-time typing step landed
|
|
13
|
+
* `typeOnIngest`; both reuse the `'typing'` floor and added no
|
|
14
|
+
* `SystemOneThresholdSite` member. Nothing outside that boundary belongs
|
|
14
15
|
* here.
|
|
15
16
|
*/
|
|
16
17
|
/** Sites a System-One threshold can apply to. Exactly four members today: `'typing'`, `'edges'`, `'resolve'` and `'healScreen'` (§10 fence). */
|
|
@@ -72,9 +73,24 @@ interface SystemOneConfig {
|
|
|
72
73
|
* classifier does not type are written untyped exactly as today and stay
|
|
73
74
|
* eligible for backfill. Engages only when a classifier is present and the
|
|
74
75
|
* manifest is representable. Facts typed this way carry no
|
|
75
|
-
* manifest-drawn edges. There is no `'off'`.
|
|
76
|
+
* manifest-drawn edges. There is no `'off'`. Librarian only;
|
|
77
|
+
* `typeOnIngest` governs ingest.
|
|
76
78
|
*/
|
|
77
79
|
typeOnWrite?: 'auto' | 'llm';
|
|
80
|
+
/**
|
|
81
|
+
* Ingest-time typing for `ingestDocument()`. `'llm'` (default) keeps today's
|
|
82
|
+
* ingest path exactly: every chunk prompt carries the ontology block and the
|
|
83
|
+
* model types each fact inline, or leaves it for backfill. `'auto'` asks
|
|
84
|
+
* `llmProvider.classify` to type every extracted fact the call is about to
|
|
85
|
+
* insert, and the ontology block leaves the ingest prompt for that call.
|
|
86
|
+
* The classify calls are as metered as the call's generative chunk calls:
|
|
87
|
+
* `ingestDocument()` carries no token budget. Facts the classifier does
|
|
88
|
+
* not type are written untyped exactly as today and stay eligible for
|
|
89
|
+
* backfill. Engages only when a classifier is present and the manifest is
|
|
90
|
+
* representable. Facts typed this way carry no manifest-drawn edges.
|
|
91
|
+
* Independent of `typeOnWrite`. There is no `'off'`.
|
|
92
|
+
*/
|
|
93
|
+
typeOnIngest?: 'auto' | 'llm';
|
|
78
94
|
/** Per-site minimum confidence. Only the classifier path reads a floor. */
|
|
79
95
|
minConfidence?: Partial<Record<SystemOneThresholdSite, number>>;
|
|
80
96
|
/**
|
|
@@ -222,6 +238,23 @@ interface WriteOntologyPromptContext {
|
|
|
222
238
|
ontologyManifest: string;
|
|
223
239
|
ontologyModeInstructions: string;
|
|
224
240
|
}
|
|
241
|
+
/** Ingest-time typing counters (specs/ingest-time-typing §9), on `IngestDocumentResult.typing`.
|
|
242
|
+
* Only the fields ingest fills: there is no `unattempted` because `ingestDocument()` has no
|
|
243
|
+
* token budget to run out. */
|
|
244
|
+
interface IngestTypingCounters {
|
|
245
|
+
/** Classify calls made (one per kept winner whose own slug did not already resolve). */
|
|
246
|
+
asked: number;
|
|
247
|
+
/** Classifier types that reached a stored row. */
|
|
248
|
+
typed: number;
|
|
249
|
+
/** Facts the classifier declined (abstain sentinel). */
|
|
250
|
+
abstained: number;
|
|
251
|
+
/** Answers below the `systemOne.minConfidence.typing` floor. */
|
|
252
|
+
lowConfidence: number;
|
|
253
|
+
/** Invalid answers and thrown `classify` calls. */
|
|
254
|
+
invalid: number;
|
|
255
|
+
/** Calls skipped for context overflow. */
|
|
256
|
+
skipped: number;
|
|
257
|
+
}
|
|
225
258
|
/** Result of a single ontology backfill run. Omissions (facts the model declined
|
|
226
259
|
* to classify) are carried by `abstained`, not derived from the other counters. */
|
|
227
260
|
interface OntologyBackfillResult {
|
|
@@ -814,6 +847,14 @@ interface WikiEvent {
|
|
|
814
847
|
created_at: number;
|
|
815
848
|
/** Real-world time of the event (epoch ms). `created_at` stays ingestion time and remains the ordering key. */
|
|
816
849
|
occurred_at?: number | null;
|
|
850
|
+
/**
|
|
851
|
+
* Epoch ms the host forgot this event with `forget({ eventId })`; absent
|
|
852
|
+
* (never null on a read) while the event is live. A forgotten event is no
|
|
853
|
+
* longer raw material: no librarian pass, heal prompt, `read()` bundle or
|
|
854
|
+
* non-backup export carries it, and prune then `erase()` hard-delete it
|
|
855
|
+
* (specs/forget-event-exclusion).
|
|
856
|
+
*/
|
|
857
|
+
forgotten_at?: number | null;
|
|
817
858
|
}
|
|
818
859
|
interface WikiEdge {
|
|
819
860
|
id: string;
|
|
@@ -1518,7 +1559,11 @@ interface ForgetParams {
|
|
|
1518
1559
|
* merged this event's text into is deleted whole; entity-scoped; exact match, no normalization — event ids are
|
|
1519
1560
|
* engine-generated). Mutually exclusive with every other selector;
|
|
1520
1561
|
* `clearAll` excludes it. Removal reports through the return value and the
|
|
1521
|
-
* per-row outbox DELETE events.
|
|
1562
|
+
* per-row outbox DELETE events. The event row itself is also marked
|
|
1563
|
+
* forgotten (`forgotten_at`), so no librarian pass, heal prompt, `read()`
|
|
1564
|
+
* bundle or non-backup export carries its text again; prune then `erase()`
|
|
1565
|
+
* hard-delete it. See `specs/forget-by-event-id/` (issue #386) and
|
|
1566
|
+
* `specs/forget-event-exclusion/` (issue #472).
|
|
1522
1567
|
*/
|
|
1523
1568
|
eventId?: string;
|
|
1524
1569
|
/** Soft-delete every fact and task of the entity, delete its edges, and delete its source-ref index rows. */
|
|
@@ -1530,7 +1575,11 @@ interface ForgetParams {
|
|
|
1530
1575
|
*/
|
|
1531
1576
|
includeEvents?: boolean;
|
|
1532
1577
|
}
|
|
1533
|
-
/**
|
|
1578
|
+
/**
|
|
1579
|
+
* Result of {@link WikiMemory.forget}. `deleted.events` is present with
|
|
1580
|
+
* `includeEvents` (rows hard-deleted) and with the `eventId` selector (`0 | 1`:
|
|
1581
|
+
* whether the event row itself was marked forgotten).
|
|
1582
|
+
*/
|
|
1534
1583
|
interface ForgetResult {
|
|
1535
1584
|
deleted: {
|
|
1536
1585
|
entries: number;
|
|
@@ -1602,6 +1651,10 @@ interface IngestDocumentResult {
|
|
|
1602
1651
|
failedChunks: number;
|
|
1603
1652
|
duplicateOf?: string;
|
|
1604
1653
|
parseFailures?: ChunkFailure[];
|
|
1654
|
+
/** Ingest-time typing counters (specs/ingest-time-typing §9). Present only when
|
|
1655
|
+
* `systemOne.typeOnIngest: 'auto'` engaged for this call. There is no `unattempted`
|
|
1656
|
+
* field: `ingestDocument()` carries no token budget. */
|
|
1657
|
+
typing?: IngestTypingCounters;
|
|
1605
1658
|
}
|
|
1606
1659
|
/**
|
|
1607
1660
|
* Thrown by `parseJsonResponse` when both the strict scanner pass and the
|
|
@@ -2596,6 +2649,12 @@ declare class MetadataRepository extends BaseRepository {
|
|
|
2596
2649
|
*/
|
|
2597
2650
|
checkpointTruncateVerified(): Promise<void>;
|
|
2598
2651
|
vacuum(): Promise<void>;
|
|
2652
|
+
/**
|
|
2653
|
+
* True when `table` has `column`. A never-set-up or not-yet-migrated store
|
|
2654
|
+
* (the #316 recovery path) lacks columns later migrations add; callers that
|
|
2655
|
+
* must run there probe first.
|
|
2656
|
+
*/
|
|
2657
|
+
columnExists(table: string, column: string, tx?: SQLiteAdapter): Promise<boolean>;
|
|
2599
2658
|
/**
|
|
2600
2659
|
* Returns the set of distinct `entity_id` values across entries/tasks/events.
|
|
2601
2660
|
*
|
|
@@ -2606,7 +2665,7 @@ declare class MetadataRepository extends BaseRepository {
|
|
|
2606
2665
|
* is `entity_id COLLATE BINARY` for stable, locale-independent ordering.
|
|
2607
2666
|
*
|
|
2608
2667
|
* With `opts.softDeletedAtOrBefore` the walk is narrowed to entities holding
|
|
2609
|
-
* at least one soft-deleted entry or
|
|
2668
|
+
* at least one soft-deleted entry, task or forgotten event with `deleted_at` at or before
|
|
2610
2669
|
* that cutoff (erase's hard-delete walk, forget-erasure spec §2). Without
|
|
2611
2670
|
* the option the host-facing semantics above are unchanged.
|
|
2612
2671
|
*/
|
|
@@ -3755,8 +3814,9 @@ declare class PromptService {
|
|
|
3755
3814
|
backfillContext?: BackfillOntologyContext | null,
|
|
3756
3815
|
/**
|
|
3757
3816
|
* The ingest write context. Omitted: `writeContext`. `getInstructions`
|
|
3758
|
-
* passes the
|
|
3759
|
-
*
|
|
3817
|
+
* passes the context that follows `systemOne.typeOnIngest`: `null` when
|
|
3818
|
+
* ingest-time typing is engaged, the un-engaged context otherwise
|
|
3819
|
+
* (specs/ingest-time-typing §5).
|
|
3760
3820
|
*/
|
|
3761
3821
|
ingestContext?: OntologyPromptContext | null): WikiInstructions;
|
|
3762
3822
|
}
|
|
@@ -3988,8 +4048,13 @@ declare class EventRepository extends BaseRepository {
|
|
|
3988
4048
|
* The subset of `ids` that exist as events of `entityId` (specs/
|
|
3989
4049
|
* inplace-update-provenance §3). Chunked so a large batch stays under the
|
|
3990
4050
|
* bound-variable limit. Pass `tx` to read inside the caller's transaction.
|
|
4051
|
+
* `liveOnly` (default false) also requires `forgotten_at IS NULL`.
|
|
3991
4052
|
*/
|
|
4053
|
+
private findIds;
|
|
4054
|
+
/** Events that exist as rows, forgotten or not (apply re-check's gone-vs-forgotten probe, specs/forget-event-exclusion §4). */
|
|
3992
4055
|
findExistingIds(entityId: string, ids: readonly string[], tx?: SQLiteAdapter): Promise<Set<string>>;
|
|
4056
|
+
/** Events that exist and are not forgotten (specs/forget-event-exclusion §4). */
|
|
4057
|
+
findLiveIds(entityId: string, ids: readonly string[], tx?: SQLiteAdapter): Promise<Set<string>>;
|
|
3993
4058
|
/**
|
|
3994
4059
|
* Return the most recent events for an entity, newest first.
|
|
3995
4060
|
* Defaults to a limit of 50.
|
|
@@ -4042,7 +4107,9 @@ declare class EventRepository extends BaseRepository {
|
|
|
4042
4107
|
* Return all events for an entity in chronological (ASC) order.
|
|
4043
4108
|
* When limit is provided, fetches newest-first then reverses to preserve chronological order.
|
|
4044
4109
|
*/
|
|
4045
|
-
getByEntityId(entityId: string, limit?: number
|
|
4110
|
+
getByEntityId(entityId: string, limit?: number, opts?: {
|
|
4111
|
+
includeDeleted?: boolean;
|
|
4112
|
+
}): Promise<WikiEvent[]>;
|
|
4046
4113
|
/**
|
|
4047
4114
|
* Return events for `entityId` strictly after the watermark `(at, id)` in
|
|
4048
4115
|
* chronological (ASC, id-ASC tie-break) order. Pass `wm = null` to read
|
|
@@ -4074,6 +4141,38 @@ declare class EventRepository extends BaseRepository {
|
|
|
4074
4141
|
* (PR-C). SQLite's `LENGTH` returns character count for UTF-8 text input.
|
|
4075
4142
|
*/
|
|
4076
4143
|
sumSummaryCharsAfter(entityId: string, wm: LibrarianWatermark | null, tx?: SQLiteAdapter): Promise<number>;
|
|
4144
|
+
/**
|
|
4145
|
+
* Mark one event forgotten (specs/forget-event-exclusion §2). Entity scoped
|
|
4146
|
+
* (rule 3) and idempotent: an unknown id, another entity's id or an already
|
|
4147
|
+
* forgotten row changes nothing and reports 0.
|
|
4148
|
+
*/
|
|
4149
|
+
markForgotten(entityId: string, eventId: string, now: number, tx?: SQLiteAdapter): Promise<0 | 1>;
|
|
4150
|
+
/** 1 when the event exists for the entity and is not yet forgotten, else 0 (the forget dry run). */
|
|
4151
|
+
countForgettable(entityId: string, eventId: string): Promise<0 | 1>;
|
|
4152
|
+
/** True when `deleteForgotten` with the same arguments would delete at least one row. */
|
|
4153
|
+
hasDeletableForgotten(entityId: string, cutoff: number, tx: SQLiteAdapter, opts?: {
|
|
4154
|
+
noCutoff?: boolean;
|
|
4155
|
+
}): Promise<boolean>;
|
|
4156
|
+
/**
|
|
4157
|
+
* How many of the entity's first `n` events, in `(created_at, id)` order,
|
|
4158
|
+
* `deleteForgotten` with the same arguments would delete. The memory and
|
|
4159
|
+
* heal checkpoints count rows in that order, so this is exactly how far a
|
|
4160
|
+
* checkpoint must drop (specs/forget-event-exclusion §5). Call before the delete.
|
|
4161
|
+
*/
|
|
4162
|
+
countForgottenInPrefix(entityId: string, n: number, cutoff: number, tx: SQLiteAdapter, opts?: {
|
|
4163
|
+
noCutoff?: boolean;
|
|
4164
|
+
}): Promise<number>;
|
|
4165
|
+
/**
|
|
4166
|
+
* Hard-delete the entity's forgotten events (specs/forget-event-exclusion
|
|
4167
|
+
* §5). No watermark guard and no `retainEventsFor`: a forgotten row is never
|
|
4168
|
+
* read. `noCutoff` drops the age predicate (erase) so a non-numeric or
|
|
4169
|
+
* future `forgotten_at` cannot escape.
|
|
4170
|
+
*/
|
|
4171
|
+
deleteForgotten(entityId: string, cutoff: number, tx: SQLiteAdapter, opts?: {
|
|
4172
|
+
noCutoff?: boolean;
|
|
4173
|
+
}): Promise<{
|
|
4174
|
+
changes: number;
|
|
4175
|
+
}>;
|
|
4077
4176
|
}
|
|
4078
4177
|
|
|
4079
4178
|
interface UsageRecord {
|
|
@@ -4125,7 +4224,7 @@ declare class UsageMeter {
|
|
|
4125
4224
|
* and the write site cannot drift; `MaintenanceService` re-exports it.
|
|
4126
4225
|
*/
|
|
4127
4226
|
declare const CLASSIFIER_MAX_CHOICES: 255;
|
|
4128
|
-
/** Per-pass typing counters (specs/type-on-write §8). */
|
|
4227
|
+
/** Per-pass typing counters (specs/type-on-write §8). Internal: the librarian's report carries them. */
|
|
4129
4228
|
interface TypingCounters {
|
|
4130
4229
|
asked: number;
|
|
4131
4230
|
typed: number;
|
|
@@ -5489,5 +5588,5 @@ declare class WikiMemory {
|
|
|
5489
5588
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
5490
5589
|
}
|
|
5491
5590
|
|
|
5492
|
-
export { HEAL_RECHECK_MS as A, HOOK_TIMEOUT_MARKER as B, CLASSIFIER_MAX_CHOICES as C, HEAL_BATCH_SIZE as H, ONTOLOGY_ABSTAIN_SENTINEL as
|
|
5493
|
-
export type {
|
|
5591
|
+
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 Z, ONTOLOGY_BACKFILL_BATCH_SIZE as _, validateManifest 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 aZ, isWikiSearchUnavailableError as a_, PromptService as aa, PrunePartialFailureError as ab, WikiBusyError as as, EmbeddingService as b0, ImportExportService as b1, IngestionService as b2, JobManager as b3, MaintenanceService as b4, RetrievalService as b5, SearchService as b6, WriteService as b7, WikiMemory as e, CheckpointIncompleteError as f, EraseStepError as r };
|
|
5592
|
+
export type { DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, HealResult as I, ImportDumpResult as J, IngestDocumentResult as K, IngestTypingCounters as L, MemoryBundle as M, LLMProvider as N, OntologyMode as O, LibrarianConfig as P, LibrarianGateConfig as Q, ReadOptions as R, SQLiteAdapter as S, LockedMaintenanceJob as T, MaintenanceJob as U, MaintenanceStopReason as V, WikiConfig as W, MemoryDumpEntity as X, MigrationPolicy as Y, 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, WriteOntologyPromptContext as aY, 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 };
|
|
@@ -9,8 +9,9 @@ import { OkfSource, OkfVerifiedEntry, OkfSourceUsageWindow } from '@equationalap
|
|
|
9
9
|
* the heal-screen step added the `'healScreen'` member. Each landed as one
|
|
10
10
|
* new line in
|
|
11
11
|
* `SystemOneThresholdSite`, so sibling PRs merged cleanly. The type-on-write
|
|
12
|
-
* step landed the `typeOnWrite` key
|
|
13
|
-
*
|
|
12
|
+
* step landed the `typeOnWrite` key and the ingest-time typing step landed
|
|
13
|
+
* `typeOnIngest`; both reuse the `'typing'` floor and added no
|
|
14
|
+
* `SystemOneThresholdSite` member. Nothing outside that boundary belongs
|
|
14
15
|
* here.
|
|
15
16
|
*/
|
|
16
17
|
/** Sites a System-One threshold can apply to. Exactly four members today: `'typing'`, `'edges'`, `'resolve'` and `'healScreen'` (§10 fence). */
|
|
@@ -72,9 +73,24 @@ interface SystemOneConfig {
|
|
|
72
73
|
* classifier does not type are written untyped exactly as today and stay
|
|
73
74
|
* eligible for backfill. Engages only when a classifier is present and the
|
|
74
75
|
* manifest is representable. Facts typed this way carry no
|
|
75
|
-
* manifest-drawn edges. There is no `'off'`.
|
|
76
|
+
* manifest-drawn edges. There is no `'off'`. Librarian only;
|
|
77
|
+
* `typeOnIngest` governs ingest.
|
|
76
78
|
*/
|
|
77
79
|
typeOnWrite?: 'auto' | 'llm';
|
|
80
|
+
/**
|
|
81
|
+
* Ingest-time typing for `ingestDocument()`. `'llm'` (default) keeps today's
|
|
82
|
+
* ingest path exactly: every chunk prompt carries the ontology block and the
|
|
83
|
+
* model types each fact inline, or leaves it for backfill. `'auto'` asks
|
|
84
|
+
* `llmProvider.classify` to type every extracted fact the call is about to
|
|
85
|
+
* insert, and the ontology block leaves the ingest prompt for that call.
|
|
86
|
+
* The classify calls are as metered as the call's generative chunk calls:
|
|
87
|
+
* `ingestDocument()` carries no token budget. Facts the classifier does
|
|
88
|
+
* not type are written untyped exactly as today and stay eligible for
|
|
89
|
+
* backfill. Engages only when a classifier is present and the manifest is
|
|
90
|
+
* representable. Facts typed this way carry no manifest-drawn edges.
|
|
91
|
+
* Independent of `typeOnWrite`. There is no `'off'`.
|
|
92
|
+
*/
|
|
93
|
+
typeOnIngest?: 'auto' | 'llm';
|
|
78
94
|
/** Per-site minimum confidence. Only the classifier path reads a floor. */
|
|
79
95
|
minConfidence?: Partial<Record<SystemOneThresholdSite, number>>;
|
|
80
96
|
/**
|
|
@@ -222,6 +238,23 @@ interface WriteOntologyPromptContext {
|
|
|
222
238
|
ontologyManifest: string;
|
|
223
239
|
ontologyModeInstructions: string;
|
|
224
240
|
}
|
|
241
|
+
/** Ingest-time typing counters (specs/ingest-time-typing §9), on `IngestDocumentResult.typing`.
|
|
242
|
+
* Only the fields ingest fills: there is no `unattempted` because `ingestDocument()` has no
|
|
243
|
+
* token budget to run out. */
|
|
244
|
+
interface IngestTypingCounters {
|
|
245
|
+
/** Classify calls made (one per kept winner whose own slug did not already resolve). */
|
|
246
|
+
asked: number;
|
|
247
|
+
/** Classifier types that reached a stored row. */
|
|
248
|
+
typed: number;
|
|
249
|
+
/** Facts the classifier declined (abstain sentinel). */
|
|
250
|
+
abstained: number;
|
|
251
|
+
/** Answers below the `systemOne.minConfidence.typing` floor. */
|
|
252
|
+
lowConfidence: number;
|
|
253
|
+
/** Invalid answers and thrown `classify` calls. */
|
|
254
|
+
invalid: number;
|
|
255
|
+
/** Calls skipped for context overflow. */
|
|
256
|
+
skipped: number;
|
|
257
|
+
}
|
|
225
258
|
/** Result of a single ontology backfill run. Omissions (facts the model declined
|
|
226
259
|
* to classify) are carried by `abstained`, not derived from the other counters. */
|
|
227
260
|
interface OntologyBackfillResult {
|
|
@@ -814,6 +847,14 @@ interface WikiEvent {
|
|
|
814
847
|
created_at: number;
|
|
815
848
|
/** Real-world time of the event (epoch ms). `created_at` stays ingestion time and remains the ordering key. */
|
|
816
849
|
occurred_at?: number | null;
|
|
850
|
+
/**
|
|
851
|
+
* Epoch ms the host forgot this event with `forget({ eventId })`; absent
|
|
852
|
+
* (never null on a read) while the event is live. A forgotten event is no
|
|
853
|
+
* longer raw material: no librarian pass, heal prompt, `read()` bundle or
|
|
854
|
+
* non-backup export carries it, and prune then `erase()` hard-delete it
|
|
855
|
+
* (specs/forget-event-exclusion).
|
|
856
|
+
*/
|
|
857
|
+
forgotten_at?: number | null;
|
|
817
858
|
}
|
|
818
859
|
interface WikiEdge {
|
|
819
860
|
id: string;
|
|
@@ -1518,7 +1559,11 @@ interface ForgetParams {
|
|
|
1518
1559
|
* merged this event's text into is deleted whole; entity-scoped; exact match, no normalization — event ids are
|
|
1519
1560
|
* engine-generated). Mutually exclusive with every other selector;
|
|
1520
1561
|
* `clearAll` excludes it. Removal reports through the return value and the
|
|
1521
|
-
* per-row outbox DELETE events.
|
|
1562
|
+
* per-row outbox DELETE events. The event row itself is also marked
|
|
1563
|
+
* forgotten (`forgotten_at`), so no librarian pass, heal prompt, `read()`
|
|
1564
|
+
* bundle or non-backup export carries its text again; prune then `erase()`
|
|
1565
|
+
* hard-delete it. See `specs/forget-by-event-id/` (issue #386) and
|
|
1566
|
+
* `specs/forget-event-exclusion/` (issue #472).
|
|
1522
1567
|
*/
|
|
1523
1568
|
eventId?: string;
|
|
1524
1569
|
/** Soft-delete every fact and task of the entity, delete its edges, and delete its source-ref index rows. */
|
|
@@ -1530,7 +1575,11 @@ interface ForgetParams {
|
|
|
1530
1575
|
*/
|
|
1531
1576
|
includeEvents?: boolean;
|
|
1532
1577
|
}
|
|
1533
|
-
/**
|
|
1578
|
+
/**
|
|
1579
|
+
* Result of {@link WikiMemory.forget}. `deleted.events` is present with
|
|
1580
|
+
* `includeEvents` (rows hard-deleted) and with the `eventId` selector (`0 | 1`:
|
|
1581
|
+
* whether the event row itself was marked forgotten).
|
|
1582
|
+
*/
|
|
1534
1583
|
interface ForgetResult {
|
|
1535
1584
|
deleted: {
|
|
1536
1585
|
entries: number;
|
|
@@ -1602,6 +1651,10 @@ interface IngestDocumentResult {
|
|
|
1602
1651
|
failedChunks: number;
|
|
1603
1652
|
duplicateOf?: string;
|
|
1604
1653
|
parseFailures?: ChunkFailure[];
|
|
1654
|
+
/** Ingest-time typing counters (specs/ingest-time-typing §9). Present only when
|
|
1655
|
+
* `systemOne.typeOnIngest: 'auto'` engaged for this call. There is no `unattempted`
|
|
1656
|
+
* field: `ingestDocument()` carries no token budget. */
|
|
1657
|
+
typing?: IngestTypingCounters;
|
|
1605
1658
|
}
|
|
1606
1659
|
/**
|
|
1607
1660
|
* Thrown by `parseJsonResponse` when both the strict scanner pass and the
|
|
@@ -2596,6 +2649,12 @@ declare class MetadataRepository extends BaseRepository {
|
|
|
2596
2649
|
*/
|
|
2597
2650
|
checkpointTruncateVerified(): Promise<void>;
|
|
2598
2651
|
vacuum(): Promise<void>;
|
|
2652
|
+
/**
|
|
2653
|
+
* True when `table` has `column`. A never-set-up or not-yet-migrated store
|
|
2654
|
+
* (the #316 recovery path) lacks columns later migrations add; callers that
|
|
2655
|
+
* must run there probe first.
|
|
2656
|
+
*/
|
|
2657
|
+
columnExists(table: string, column: string, tx?: SQLiteAdapter): Promise<boolean>;
|
|
2599
2658
|
/**
|
|
2600
2659
|
* Returns the set of distinct `entity_id` values across entries/tasks/events.
|
|
2601
2660
|
*
|
|
@@ -2606,7 +2665,7 @@ declare class MetadataRepository extends BaseRepository {
|
|
|
2606
2665
|
* is `entity_id COLLATE BINARY` for stable, locale-independent ordering.
|
|
2607
2666
|
*
|
|
2608
2667
|
* With `opts.softDeletedAtOrBefore` the walk is narrowed to entities holding
|
|
2609
|
-
* at least one soft-deleted entry or
|
|
2668
|
+
* at least one soft-deleted entry, task or forgotten event with `deleted_at` at or before
|
|
2610
2669
|
* that cutoff (erase's hard-delete walk, forget-erasure spec §2). Without
|
|
2611
2670
|
* the option the host-facing semantics above are unchanged.
|
|
2612
2671
|
*/
|
|
@@ -3755,8 +3814,9 @@ declare class PromptService {
|
|
|
3755
3814
|
backfillContext?: BackfillOntologyContext | null,
|
|
3756
3815
|
/**
|
|
3757
3816
|
* The ingest write context. Omitted: `writeContext`. `getInstructions`
|
|
3758
|
-
* passes the
|
|
3759
|
-
*
|
|
3817
|
+
* passes the context that follows `systemOne.typeOnIngest`: `null` when
|
|
3818
|
+
* ingest-time typing is engaged, the un-engaged context otherwise
|
|
3819
|
+
* (specs/ingest-time-typing §5).
|
|
3760
3820
|
*/
|
|
3761
3821
|
ingestContext?: OntologyPromptContext | null): WikiInstructions;
|
|
3762
3822
|
}
|
|
@@ -3988,8 +4048,13 @@ declare class EventRepository extends BaseRepository {
|
|
|
3988
4048
|
* The subset of `ids` that exist as events of `entityId` (specs/
|
|
3989
4049
|
* inplace-update-provenance §3). Chunked so a large batch stays under the
|
|
3990
4050
|
* bound-variable limit. Pass `tx` to read inside the caller's transaction.
|
|
4051
|
+
* `liveOnly` (default false) also requires `forgotten_at IS NULL`.
|
|
3991
4052
|
*/
|
|
4053
|
+
private findIds;
|
|
4054
|
+
/** Events that exist as rows, forgotten or not (apply re-check's gone-vs-forgotten probe, specs/forget-event-exclusion §4). */
|
|
3992
4055
|
findExistingIds(entityId: string, ids: readonly string[], tx?: SQLiteAdapter): Promise<Set<string>>;
|
|
4056
|
+
/** Events that exist and are not forgotten (specs/forget-event-exclusion §4). */
|
|
4057
|
+
findLiveIds(entityId: string, ids: readonly string[], tx?: SQLiteAdapter): Promise<Set<string>>;
|
|
3993
4058
|
/**
|
|
3994
4059
|
* Return the most recent events for an entity, newest first.
|
|
3995
4060
|
* Defaults to a limit of 50.
|
|
@@ -4042,7 +4107,9 @@ declare class EventRepository extends BaseRepository {
|
|
|
4042
4107
|
* Return all events for an entity in chronological (ASC) order.
|
|
4043
4108
|
* When limit is provided, fetches newest-first then reverses to preserve chronological order.
|
|
4044
4109
|
*/
|
|
4045
|
-
getByEntityId(entityId: string, limit?: number
|
|
4110
|
+
getByEntityId(entityId: string, limit?: number, opts?: {
|
|
4111
|
+
includeDeleted?: boolean;
|
|
4112
|
+
}): Promise<WikiEvent[]>;
|
|
4046
4113
|
/**
|
|
4047
4114
|
* Return events for `entityId` strictly after the watermark `(at, id)` in
|
|
4048
4115
|
* chronological (ASC, id-ASC tie-break) order. Pass `wm = null` to read
|
|
@@ -4074,6 +4141,38 @@ declare class EventRepository extends BaseRepository {
|
|
|
4074
4141
|
* (PR-C). SQLite's `LENGTH` returns character count for UTF-8 text input.
|
|
4075
4142
|
*/
|
|
4076
4143
|
sumSummaryCharsAfter(entityId: string, wm: LibrarianWatermark | null, tx?: SQLiteAdapter): Promise<number>;
|
|
4144
|
+
/**
|
|
4145
|
+
* Mark one event forgotten (specs/forget-event-exclusion §2). Entity scoped
|
|
4146
|
+
* (rule 3) and idempotent: an unknown id, another entity's id or an already
|
|
4147
|
+
* forgotten row changes nothing and reports 0.
|
|
4148
|
+
*/
|
|
4149
|
+
markForgotten(entityId: string, eventId: string, now: number, tx?: SQLiteAdapter): Promise<0 | 1>;
|
|
4150
|
+
/** 1 when the event exists for the entity and is not yet forgotten, else 0 (the forget dry run). */
|
|
4151
|
+
countForgettable(entityId: string, eventId: string): Promise<0 | 1>;
|
|
4152
|
+
/** True when `deleteForgotten` with the same arguments would delete at least one row. */
|
|
4153
|
+
hasDeletableForgotten(entityId: string, cutoff: number, tx: SQLiteAdapter, opts?: {
|
|
4154
|
+
noCutoff?: boolean;
|
|
4155
|
+
}): Promise<boolean>;
|
|
4156
|
+
/**
|
|
4157
|
+
* How many of the entity's first `n` events, in `(created_at, id)` order,
|
|
4158
|
+
* `deleteForgotten` with the same arguments would delete. The memory and
|
|
4159
|
+
* heal checkpoints count rows in that order, so this is exactly how far a
|
|
4160
|
+
* checkpoint must drop (specs/forget-event-exclusion §5). Call before the delete.
|
|
4161
|
+
*/
|
|
4162
|
+
countForgottenInPrefix(entityId: string, n: number, cutoff: number, tx: SQLiteAdapter, opts?: {
|
|
4163
|
+
noCutoff?: boolean;
|
|
4164
|
+
}): Promise<number>;
|
|
4165
|
+
/**
|
|
4166
|
+
* Hard-delete the entity's forgotten events (specs/forget-event-exclusion
|
|
4167
|
+
* §5). No watermark guard and no `retainEventsFor`: a forgotten row is never
|
|
4168
|
+
* read. `noCutoff` drops the age predicate (erase) so a non-numeric or
|
|
4169
|
+
* future `forgotten_at` cannot escape.
|
|
4170
|
+
*/
|
|
4171
|
+
deleteForgotten(entityId: string, cutoff: number, tx: SQLiteAdapter, opts?: {
|
|
4172
|
+
noCutoff?: boolean;
|
|
4173
|
+
}): Promise<{
|
|
4174
|
+
changes: number;
|
|
4175
|
+
}>;
|
|
4077
4176
|
}
|
|
4078
4177
|
|
|
4079
4178
|
interface UsageRecord {
|
|
@@ -4125,7 +4224,7 @@ declare class UsageMeter {
|
|
|
4125
4224
|
* and the write site cannot drift; `MaintenanceService` re-exports it.
|
|
4126
4225
|
*/
|
|
4127
4226
|
declare const CLASSIFIER_MAX_CHOICES: 255;
|
|
4128
|
-
/** Per-pass typing counters (specs/type-on-write §8). */
|
|
4227
|
+
/** Per-pass typing counters (specs/type-on-write §8). Internal: the librarian's report carries them. */
|
|
4129
4228
|
interface TypingCounters {
|
|
4130
4229
|
asked: number;
|
|
4131
4230
|
typed: number;
|
|
@@ -5489,5 +5588,5 @@ declare class WikiMemory {
|
|
|
5489
5588
|
setGeneratedByTask(taskId: string, entityId: string, actor: string): Promise<void>;
|
|
5490
5589
|
}
|
|
5491
5590
|
|
|
5492
|
-
export { HEAL_RECHECK_MS as A, HOOK_TIMEOUT_MARKER as B, CLASSIFIER_MAX_CHOICES as C, HEAL_BATCH_SIZE as H, ONTOLOGY_ABSTAIN_SENTINEL as
|
|
5493
|
-
export type {
|
|
5591
|
+
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 Z, ONTOLOGY_BACKFILL_BATCH_SIZE as _, validateManifest 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 aZ, isWikiSearchUnavailableError as a_, PromptService as aa, PrunePartialFailureError as ab, WikiBusyError as as, EmbeddingService as b0, ImportExportService as b1, IngestionService as b2, JobManager as b3, MaintenanceService as b4, RetrievalService as b5, SearchService as b6, WriteService as b7, WikiMemory as e, CheckpointIncompleteError as f, EraseStepError as r };
|
|
5592
|
+
export type { DegradedRecord as D, EmbedFactResult as E, FormatContextOptions as F, GraphNeighborhood as G, HealResult as I, ImportDumpResult as J, IngestDocumentResult as K, IngestTypingCounters as L, MemoryBundle as M, LLMProvider as N, OntologyMode as O, LibrarianConfig as P, LibrarianGateConfig as Q, ReadOptions as R, SQLiteAdapter as S, LockedMaintenanceJob as T, MaintenanceJob as U, MaintenanceStopReason as V, WikiConfig as W, MemoryDumpEntity as X, MigrationPolicy as Y, 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, WriteOntologyPromptContext as aY, 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 { b0 as EmbeddingService, b1 as ImportExportService, b2 as IngestionService, b3 as JobManager, b3 as JobManagerType, b4 as MaintenanceService, b5 as RetrievalService, b6 as SearchService, b6 as SearchServiceType, aM as WikiMemoryTestAccess, b7 as WriteService } from './testing-CI0n5qQk.mjs';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b0 as EmbeddingService, b1 as ImportExportService, b2 as IngestionService, b3 as JobManager, b3 as JobManagerType, b4 as MaintenanceService, b5 as RetrievalService, b6 as SearchService, b6 as SearchServiceType, aM as WikiMemoryTestAccess, b7 as WriteService } from './testing-CI0n5qQk.js';
|
|
2
2
|
import '@equationalapplications/core-okf';
|