@graphrefly/ts 0.0.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/LICENSE +21 -0
- package/dist/adapters/index.cjs +9015 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.cts +678 -0
- package/dist/adapters/index.d.ts +678 -0
- package/dist/adapters/index.js +2894 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/observe-storage.cjs +260 -0
- package/dist/adapters/observe-storage.cjs.map +1 -0
- package/dist/adapters/observe-storage.d.cts +77 -0
- package/dist/adapters/observe-storage.d.ts +77 -0
- package/dist/adapters/observe-storage.js +161 -0
- package/dist/adapters/observe-storage.js.map +1 -0
- package/dist/append-log-DisvEReb.d.cts +189 -0
- package/dist/append-log-DzKMmjxx.d.ts +189 -0
- package/dist/chunk-2ILL7HQI.js +1189 -0
- package/dist/chunk-2ILL7HQI.js.map +1 -0
- package/dist/chunk-4VLAQHZI.js +330 -0
- package/dist/chunk-4VLAQHZI.js.map +1 -0
- package/dist/chunk-6PHB5CJS.js +229 -0
- package/dist/chunk-6PHB5CJS.js.map +1 -0
- package/dist/chunk-COHO25CZ.js +2449 -0
- package/dist/chunk-COHO25CZ.js.map +1 -0
- package/dist/chunk-D6BG7U6A.js +161 -0
- package/dist/chunk-D6BG7U6A.js.map +1 -0
- package/dist/chunk-DJC4CHLQ.js +818 -0
- package/dist/chunk-DJC4CHLQ.js.map +1 -0
- package/dist/chunk-DK554R7P.js +67 -0
- package/dist/chunk-DK554R7P.js.map +1 -0
- package/dist/chunk-DKP56CSW.js +322 -0
- package/dist/chunk-DKP56CSW.js.map +1 -0
- package/dist/chunk-G4M3NHRJ.js +688 -0
- package/dist/chunk-G4M3NHRJ.js.map +1 -0
- package/dist/chunk-GAJW5I5P.js +1 -0
- package/dist/chunk-GAJW5I5P.js.map +1 -0
- package/dist/chunk-GDL26N2T.js +282 -0
- package/dist/chunk-GDL26N2T.js.map +1 -0
- package/dist/chunk-GTPCOEOZ.js +741 -0
- package/dist/chunk-GTPCOEOZ.js.map +1 -0
- package/dist/chunk-H2HTHFVN.js +1 -0
- package/dist/chunk-H2HTHFVN.js.map +1 -0
- package/dist/chunk-HDRL4VQQ.js +218 -0
- package/dist/chunk-HDRL4VQQ.js.map +1 -0
- package/dist/chunk-I3IHOHCJ.js +2267 -0
- package/dist/chunk-I3IHOHCJ.js.map +1 -0
- package/dist/chunk-JIMUDQN3.js +965 -0
- package/dist/chunk-JIMUDQN3.js.map +1 -0
- package/dist/chunk-JR4IKCR2.js +462 -0
- package/dist/chunk-JR4IKCR2.js.map +1 -0
- package/dist/chunk-K3FXTC3I.js +165 -0
- package/dist/chunk-K3FXTC3I.js.map +1 -0
- package/dist/chunk-OOEN33FB.js +65 -0
- package/dist/chunk-OOEN33FB.js.map +1 -0
- package/dist/chunk-PKVBHGBM.js +554 -0
- package/dist/chunk-PKVBHGBM.js.map +1 -0
- package/dist/chunk-RIIOUTGM.js +1857 -0
- package/dist/chunk-RIIOUTGM.js.map +1 -0
- package/dist/chunk-SCRFRCGR.js +33 -0
- package/dist/chunk-SCRFRCGR.js.map +1 -0
- package/dist/chunk-SWTLEQL6.js +53 -0
- package/dist/chunk-SWTLEQL6.js.map +1 -0
- package/dist/chunk-SZAETNNA.js +1 -0
- package/dist/chunk-SZAETNNA.js.map +1 -0
- package/dist/chunk-TEW47IVR.js +49 -0
- package/dist/chunk-TEW47IVR.js.map +1 -0
- package/dist/chunk-Y3ZLRGHC.js +1482 -0
- package/dist/chunk-Y3ZLRGHC.js.map +1 -0
- package/dist/chunk-Z2ANQ6JW.js +149 -0
- package/dist/chunk-Z2ANQ6JW.js.map +1 -0
- package/dist/codec-BB7p8fJc.d.cts +38 -0
- package/dist/codec-BB7p8fJc.d.ts +38 -0
- package/dist/composition/index.cjs +2505 -0
- package/dist/composition/index.cjs.map +1 -0
- package/dist/composition/index.d.cts +95 -0
- package/dist/composition/index.d.ts +95 -0
- package/dist/composition/index.js +19 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/core/index.cjs +2475 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +25 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/index.js +74 -0
- package/dist/core/index.js.map +1 -0
- package/dist/cqrs/index.cjs +595 -0
- package/dist/cqrs/index.cjs.map +1 -0
- package/dist/cqrs/index.d.cts +200 -0
- package/dist/cqrs/index.d.ts +200 -0
- package/dist/cqrs/index.js +557 -0
- package/dist/cqrs/index.js.map +1 -0
- package/dist/data-structures/index.cjs +4277 -0
- package/dist/data-structures/index.cjs.map +1 -0
- package/dist/data-structures/index.d.cts +22 -0
- package/dist/data-structures/index.d.ts +22 -0
- package/dist/data-structures/index.js +31 -0
- package/dist/data-structures/index.js.map +1 -0
- package/dist/describe-BZb7AS2y.d.ts +57 -0
- package/dist/describe-Ciu8SUnN.d.cts +57 -0
- package/dist/graph/index.cjs +7832 -0
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +251 -0
- package/dist/graph/index.d.ts +251 -0
- package/dist/graph/index.js +131 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph-DfdF9zy4.d.ts +666 -0
- package/dist/graph-s23RbbFO.d.cts +666 -0
- package/dist/index-CAEmLCYF.d.cts +166 -0
- package/dist/index-SnzZu3x7.d.ts +166 -0
- package/dist/index.cjs +15409 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +582 -0
- package/dist/index.js.map +1 -0
- package/dist/messages-BZqrGGm1.d.cts +55 -0
- package/dist/messages-BZqrGGm1.d.ts +55 -0
- package/dist/messaging/index.cjs +818 -0
- package/dist/messaging/index.cjs.map +1 -0
- package/dist/messaging/index.d.cts +235 -0
- package/dist/messaging/index.d.ts +235 -0
- package/dist/messaging/index.js +767 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/observe-event-log-0SVsx7JG.d.cts +88 -0
- package/dist/observe-event-log-Dnm76owp.d.ts +88 -0
- package/dist/operators/index.cjs +3774 -0
- package/dist/operators/index.cjs.map +1 -0
- package/dist/operators/index.d.cts +308 -0
- package/dist/operators/index.d.ts +308 -0
- package/dist/operators/index.js +112 -0
- package/dist/operators/index.js.map +1 -0
- package/dist/orchestration/index.cjs +3541 -0
- package/dist/orchestration/index.cjs.map +1 -0
- package/dist/orchestration/index.d.cts +302 -0
- package/dist/orchestration/index.d.ts +302 -0
- package/dist/orchestration/index.js +1004 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/patterns/index.cjs +1045 -0
- package/dist/patterns/index.cjs.map +1 -0
- package/dist/patterns/index.d.cts +39 -0
- package/dist/patterns/index.d.ts +39 -0
- package/dist/patterns/index.js +33 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/reactive-collection-BxBqtIOE.d.cts +344 -0
- package/dist/reactive-collection-Cb1II1Fi.d.ts +344 -0
- package/dist/reactive-collection-storage-BNiEc-Gd.d.ts +217 -0
- package/dist/reactive-collection-storage-D-KmjE0J.d.cts +217 -0
- package/dist/reactive-map-BcB4KsQR.d.ts +256 -0
- package/dist/reactive-map-D-g3dv8I.d.cts +256 -0
- package/dist/read-through-B1CYPfq_.d.cts +82 -0
- package/dist/read-through-DwyJhGs1.d.ts +82 -0
- package/dist/render/index.cjs +250 -0
- package/dist/render/index.cjs.map +1 -0
- package/dist/render/index.d.cts +58 -0
- package/dist/render/index.d.ts +58 -0
- package/dist/render/index.js +20 -0
- package/dist/render/index.js.map +1 -0
- package/dist/resilience-Dig3Q7n0.d.cts +45 -0
- package/dist/resilience-Dig3Q7n0.d.ts +45 -0
- package/dist/semantic-memory-graph-BYoIlP35.d.cts +356 -0
- package/dist/semantic-memory-graph-CxyXLms3.d.ts +356 -0
- package/dist/solutions/index.cjs +3249 -0
- package/dist/solutions/index.cjs.map +1 -0
- package/dist/solutions/index.d.cts +520 -0
- package/dist/solutions/index.d.ts +520 -0
- package/dist/solutions/index.js +31 -0
- package/dist/solutions/index.js.map +1 -0
- package/dist/sources/browser.cjs +3095 -0
- package/dist/sources/browser.cjs.map +1 -0
- package/dist/sources/browser.d.cts +39 -0
- package/dist/sources/browser.d.ts +39 -0
- package/dist/sources/browser.js +137 -0
- package/dist/sources/browser.js.map +1 -0
- package/dist/sources/index.cjs +3021 -0
- package/dist/sources/index.cjs.map +1 -0
- package/dist/sources/index.d.cts +7 -0
- package/dist/sources/index.d.ts +7 -0
- package/dist/sources/index.js +63 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/node.cjs +675 -0
- package/dist/sources/node.cjs.map +1 -0
- package/dist/sources/node.d.cts +109 -0
- package/dist/sources/node.d.ts +109 -0
- package/dist/sources/node.js +639 -0
- package/dist/sources/node.js.map +1 -0
- package/dist/storage/browser.cjs +777 -0
- package/dist/storage/browser.cjs.map +1 -0
- package/dist/storage/browser.d.cts +40 -0
- package/dist/storage/browser.d.ts +40 -0
- package/dist/storage/browser.js +275 -0
- package/dist/storage/browser.js.map +1 -0
- package/dist/storage/index.cjs +1989 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +92 -0
- package/dist/storage/index.d.ts +92 -0
- package/dist/storage/index.js +161 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/node.cjs +898 -0
- package/dist/storage/node.cjs.map +1 -0
- package/dist/storage/node.d.cts +66 -0
- package/dist/storage/node.d.ts +66 -0
- package/dist/storage/node.js +402 -0
- package/dist/storage/node.js.map +1 -0
- package/dist/testing/index.cjs +95 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +20 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +8 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/types-bNMSWKqF.d.cts +732 -0
- package/dist/types-h12mNYbq.d.ts +732 -0
- package/package.json +250 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Q as StateNode, d as Graph } from './graph-s23RbbFO.cjs';
|
|
2
|
+
import { N as Node } from './types-bNMSWKqF.cjs';
|
|
3
|
+
import { AgenticMemoryStrictJsonValue, AgenticMemoryRecordFrame, AgenticMemoryRecord } from './solutions/index.cjs';
|
|
4
|
+
import { f as KvStorageTier, d as AppendLogStorageTier } from './append-log-DisvEReb.cjs';
|
|
5
|
+
import { b as LoadReactiveCollectionStateOptions, a as IndexRow, n as ReactiveIndexOptions, j as ReactiveIndex, o as ReactiveIndexRestoreState, p as ReactiveListRestoreState, q as ReactiveLogRestoreState, r as ReactiveMapRestoreState } from './reactive-collection-BxBqtIOE.cjs';
|
|
6
|
+
import { b as ReactiveListOptions, d as ReactiveLogOptions, g as ReactiveMapOptions, R as ReactiveList, c as ReactiveLog, e as ReactiveMap } from './reactive-map-D-g3dv8I.cjs';
|
|
7
|
+
|
|
8
|
+
declare const AGENTIC_MEMORY_RECORD_SNAPSHOT_FORMAT: "graphrefly.agenticMemory.records.snapshot";
|
|
9
|
+
declare const AGENTIC_MEMORY_RECORD_CHANGE_FORMAT: "graphrefly.agenticMemory.records.change";
|
|
10
|
+
declare const AGENTIC_MEMORY_RECORD_STORAGE_FRAME_VERSION: 1;
|
|
11
|
+
interface AgenticMemoryRecordSnapshotFrame<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue> {
|
|
12
|
+
readonly format: typeof AGENTIC_MEMORY_RECORD_SNAPSHOT_FORMAT;
|
|
13
|
+
readonly version: typeof AGENTIC_MEMORY_RECORD_STORAGE_FRAME_VERSION;
|
|
14
|
+
readonly changeCursor: number;
|
|
15
|
+
readonly records: readonly AgenticMemoryRecordFrame<TJson>[];
|
|
16
|
+
}
|
|
17
|
+
interface AgenticMemoryRecordChangeFrame<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue> {
|
|
18
|
+
readonly format: typeof AGENTIC_MEMORY_RECORD_CHANGE_FORMAT;
|
|
19
|
+
readonly version: typeof AGENTIC_MEMORY_RECORD_STORAGE_FRAME_VERSION;
|
|
20
|
+
readonly change: {
|
|
21
|
+
readonly kind: "replaceAll";
|
|
22
|
+
readonly records: readonly AgenticMemoryRecordFrame<TJson>[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
interface AgenticMemoryRecordsRestoreState<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue> {
|
|
26
|
+
readonly records: readonly AgenticMemoryRecord<TJson>[];
|
|
27
|
+
readonly source: "empty" | "changes" | "snapshot" | "snapshot+changes";
|
|
28
|
+
readonly snapshot: {
|
|
29
|
+
readonly found: boolean;
|
|
30
|
+
readonly changeCursor: number;
|
|
31
|
+
};
|
|
32
|
+
readonly changes: {
|
|
33
|
+
readonly applied: number;
|
|
34
|
+
readonly cursor: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
interface LoadAgenticMemoryRecordsStateOptions {
|
|
38
|
+
readonly snapshotStore: KvStorageTier<unknown>;
|
|
39
|
+
readonly snapshotKey?: string;
|
|
40
|
+
readonly storagePrefix?: string;
|
|
41
|
+
readonly changeLog?: AppendLogStorageTier<unknown>;
|
|
42
|
+
}
|
|
43
|
+
interface AgenticMemoryRecordsPersistenceCursor {
|
|
44
|
+
readonly kind: "persistence.cursor";
|
|
45
|
+
readonly changeSeq: number;
|
|
46
|
+
readonly snapshotWrites: number;
|
|
47
|
+
readonly changeWrites: number;
|
|
48
|
+
}
|
|
49
|
+
interface AgenticMemoryRecordsPersistenceStatus {
|
|
50
|
+
readonly state: "starting" | "ready" | "flushing" | "errored" | "disposed";
|
|
51
|
+
readonly pending: number;
|
|
52
|
+
readonly writes: number;
|
|
53
|
+
readonly errors: number;
|
|
54
|
+
readonly cursor: AgenticMemoryRecordsPersistenceCursor;
|
|
55
|
+
}
|
|
56
|
+
interface AgenticMemoryRecordsPersistenceError {
|
|
57
|
+
readonly phase: "snapshot" | "change";
|
|
58
|
+
readonly message: string;
|
|
59
|
+
readonly cursor: AgenticMemoryRecordsPersistenceCursor;
|
|
60
|
+
}
|
|
61
|
+
interface PersistAgenticMemoryRecordsOptions {
|
|
62
|
+
readonly name?: string;
|
|
63
|
+
readonly snapshotStore: KvStorageTier<unknown>;
|
|
64
|
+
readonly snapshotKey?: string;
|
|
65
|
+
readonly storagePrefix?: string;
|
|
66
|
+
readonly changeLog?: AppendLogStorageTier<unknown>;
|
|
67
|
+
readonly initialChangeCursor?: number;
|
|
68
|
+
readonly snapshotOnAttach?: boolean;
|
|
69
|
+
readonly snapshotEveryChanges?: number;
|
|
70
|
+
}
|
|
71
|
+
interface AgenticMemoryRecordsPersistenceHandle {
|
|
72
|
+
readonly ready: StateNode<boolean>;
|
|
73
|
+
readonly status: StateNode<AgenticMemoryRecordsPersistenceStatus>;
|
|
74
|
+
readonly error: StateNode<AgenticMemoryRecordsPersistenceError | null>;
|
|
75
|
+
readonly cursor: StateNode<AgenticMemoryRecordsPersistenceCursor>;
|
|
76
|
+
flush(done?: (status: AgenticMemoryRecordsPersistenceStatus) => void): void;
|
|
77
|
+
snapshot(done?: (status: AgenticMemoryRecordsPersistenceStatus) => void): void;
|
|
78
|
+
dispose(done?: (status: AgenticMemoryRecordsPersistenceStatus) => void): void;
|
|
79
|
+
}
|
|
80
|
+
interface OpenPersistentAgenticMemoryRecordsOptions<TJson extends AgenticMemoryStrictJsonValue> extends LoadAgenticMemoryRecordsStateOptions, Omit<PersistAgenticMemoryRecordsOptions, "snapshotStore" | "changeLog" | "initialChangeCursor"> {
|
|
81
|
+
readonly graph: Graph;
|
|
82
|
+
readonly name?: string;
|
|
83
|
+
readonly initial?: readonly AgenticMemoryRecord<TJson>[];
|
|
84
|
+
}
|
|
85
|
+
interface PersistentAgenticMemoryRecords<TJson extends AgenticMemoryStrictJsonValue> {
|
|
86
|
+
readonly records: StateNode<readonly AgenticMemoryRecord<TJson>[]>;
|
|
87
|
+
readonly persistence: AgenticMemoryRecordsPersistenceHandle;
|
|
88
|
+
readonly loaded: AgenticMemoryRecordsRestoreState<TJson>;
|
|
89
|
+
}
|
|
90
|
+
declare function agenticMemoryRecordsSnapshotKey(storagePrefix?: string): string;
|
|
91
|
+
declare function agenticMemoryRecordSnapshotFrame<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue>(records: readonly AgenticMemoryRecord<TJson>[], opts?: {
|
|
92
|
+
readonly changeCursor?: number;
|
|
93
|
+
}): AgenticMemoryRecordSnapshotFrame<TJson>;
|
|
94
|
+
declare function agenticMemoryRecordChangeFrame<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue>(records: readonly AgenticMemoryRecord<TJson>[]): AgenticMemoryRecordChangeFrame<TJson>;
|
|
95
|
+
declare function assertAgenticMemoryRecordSnapshotFrame<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue>(value: unknown): AgenticMemoryRecordSnapshotFrame<TJson>;
|
|
96
|
+
declare function assertAgenticMemoryRecordChangeFrame<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue>(value: unknown): AgenticMemoryRecordChangeFrame<TJson>;
|
|
97
|
+
declare function loadAgenticMemoryRecordsState<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue>(opts: LoadAgenticMemoryRecordsStateOptions): Promise<AgenticMemoryRecordsRestoreState<TJson>>;
|
|
98
|
+
declare function persistAgenticMemoryRecords<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue>(graph: Graph, records: Node<readonly AgenticMemoryRecord<TJson>[]>, opts: PersistAgenticMemoryRecordsOptions): AgenticMemoryRecordsPersistenceHandle;
|
|
99
|
+
declare function openPersistentAgenticMemoryRecords<TJson extends AgenticMemoryStrictJsonValue = AgenticMemoryStrictJsonValue>(opts: OpenPersistentAgenticMemoryRecordsOptions<TJson>): Promise<PersistentAgenticMemoryRecords<TJson>>;
|
|
100
|
+
|
|
101
|
+
type PersistableKind = "reactiveList" | "reactiveLog" | "reactiveMap" | "reactiveIndex";
|
|
102
|
+
type PersistableCollection<T, K extends PersistableKind> = K extends "reactiveList" ? ReactiveList<T> : K extends "reactiveLog" ? ReactiveLog<T> : K extends "reactiveMap" ? ReactiveMap<unknown, T> : ReactiveIndex<unknown, T>;
|
|
103
|
+
/** D161 adapter write-progress cursor; this is not a domain replay or wire-bridge cursor. */
|
|
104
|
+
interface ReactiveCollectionPersistenceCursor {
|
|
105
|
+
readonly kind: "persistence.cursor";
|
|
106
|
+
readonly collection: PersistableKind;
|
|
107
|
+
readonly changeSeq: number;
|
|
108
|
+
readonly snapshotWrites: number;
|
|
109
|
+
readonly changeWrites: number;
|
|
110
|
+
}
|
|
111
|
+
/** D161 graph-visible persistence sidecar status fact. */
|
|
112
|
+
interface ReactiveCollectionPersistenceStatus {
|
|
113
|
+
readonly state: "starting" | "ready" | "flushing" | "errored" | "disposed";
|
|
114
|
+
readonly pending: number;
|
|
115
|
+
readonly writes: number;
|
|
116
|
+
readonly errors: number;
|
|
117
|
+
readonly cursor: ReactiveCollectionPersistenceCursor;
|
|
118
|
+
}
|
|
119
|
+
/** D161 graph-visible persistence sidecar error fact. */
|
|
120
|
+
interface ReactiveCollectionPersistenceError {
|
|
121
|
+
readonly phase: "snapshot" | "change";
|
|
122
|
+
readonly message: string;
|
|
123
|
+
readonly cursor: ReactiveCollectionPersistenceCursor;
|
|
124
|
+
}
|
|
125
|
+
/** Options for the D161 graph-bound persistence sidecar over a reactive collection. */
|
|
126
|
+
interface PersistReactiveCollectionOptions<K extends PersistableKind = PersistableKind> {
|
|
127
|
+
readonly kind: K;
|
|
128
|
+
readonly name?: string;
|
|
129
|
+
readonly snapshotStore: KvStorageTier<unknown>;
|
|
130
|
+
readonly snapshotKey?: string;
|
|
131
|
+
readonly storagePrefix?: string;
|
|
132
|
+
readonly changeLog?: AppendLogStorageTier<unknown>;
|
|
133
|
+
/** Adapter write cursor seed for wrappers that already folded a change log. */
|
|
134
|
+
readonly initialChangeCursor?: number;
|
|
135
|
+
/** Default true: write one durable baseline when the adapter attaches. */
|
|
136
|
+
readonly snapshotOnAttach?: boolean;
|
|
137
|
+
/** Optional snapshot cadence. Manual snapshots remain available via handle.snapshot(). */
|
|
138
|
+
readonly snapshotEveryChanges?: number;
|
|
139
|
+
}
|
|
140
|
+
/** D161 sidecar controls; flush waits for queued storage promises to settle, not fsync. */
|
|
141
|
+
interface ReactiveCollectionPersistenceHandle {
|
|
142
|
+
readonly ready: StateNode<boolean>;
|
|
143
|
+
readonly status: StateNode<ReactiveCollectionPersistenceStatus>;
|
|
144
|
+
readonly error: StateNode<ReactiveCollectionPersistenceError | null>;
|
|
145
|
+
readonly cursor: StateNode<ReactiveCollectionPersistenceCursor>;
|
|
146
|
+
flush(done?: (status: ReactiveCollectionPersistenceStatus) => void): void;
|
|
147
|
+
snapshot(done?: (status: ReactiveCollectionPersistenceStatus) => void): void;
|
|
148
|
+
dispose(done?: (status: ReactiveCollectionPersistenceStatus) => void): void;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* D161 graph-bound sidecar over an existing collection. It writes passive storage frames and
|
|
152
|
+
* exposes adapter progress as graph-visible DATA facts; it never restores or mutates the collection.
|
|
153
|
+
*/
|
|
154
|
+
declare function persistReactiveCollection<T, K extends PersistableKind>(graph: Graph, collection: PersistableCollection<T, K>, opts: PersistReactiveCollectionOptions<K>): ReactiveCollectionPersistenceHandle;
|
|
155
|
+
type CollectionOptionsWithoutGraphName<T> = Omit<T, "graph" | "name">;
|
|
156
|
+
/** Options for D161 load -> restore -> persist composition for reactiveList. */
|
|
157
|
+
interface OpenPersistentReactiveListOptions<T> extends LoadReactiveCollectionStateOptions, Omit<PersistReactiveCollectionOptions<"reactiveList">, "kind" | "snapshotStore" | "changeLog" | "initialChangeCursor"> {
|
|
158
|
+
readonly graph: Graph;
|
|
159
|
+
readonly name?: string;
|
|
160
|
+
readonly initial?: readonly T[];
|
|
161
|
+
readonly collection?: CollectionOptionsWithoutGraphName<ReactiveListOptions>;
|
|
162
|
+
}
|
|
163
|
+
/** Options for D161 load -> restore -> persist composition for reactiveLog. */
|
|
164
|
+
interface OpenPersistentReactiveLogOptions<T> extends LoadReactiveCollectionStateOptions, Omit<PersistReactiveCollectionOptions<"reactiveLog">, "kind" | "snapshotStore" | "changeLog" | "initialChangeCursor"> {
|
|
165
|
+
readonly graph: Graph;
|
|
166
|
+
readonly name?: string;
|
|
167
|
+
readonly initial?: readonly T[];
|
|
168
|
+
readonly collection?: CollectionOptionsWithoutGraphName<ReactiveLogOptions>;
|
|
169
|
+
}
|
|
170
|
+
/** Options for D161 load -> restore -> persist composition for reactiveMap. */
|
|
171
|
+
interface OpenPersistentReactiveMapOptions<K, V> extends LoadReactiveCollectionStateOptions, Omit<PersistReactiveCollectionOptions<"reactiveMap">, "kind" | "snapshotStore" | "changeLog" | "initialChangeCursor"> {
|
|
172
|
+
readonly graph: Graph;
|
|
173
|
+
readonly name?: string;
|
|
174
|
+
readonly initial?: readonly (readonly [K, V])[];
|
|
175
|
+
readonly collection?: CollectionOptionsWithoutGraphName<ReactiveMapOptions<K, V>>;
|
|
176
|
+
}
|
|
177
|
+
/** Options for D161 load -> restore -> persist composition for reactiveIndex. */
|
|
178
|
+
interface OpenPersistentReactiveIndexOptions<K, V> extends LoadReactiveCollectionStateOptions, Omit<PersistReactiveCollectionOptions<"reactiveIndex">, "kind" | "snapshotStore" | "changeLog" | "initialChangeCursor"> {
|
|
179
|
+
readonly graph: Graph;
|
|
180
|
+
readonly name?: string;
|
|
181
|
+
readonly initial?: readonly IndexRow<K, V>[];
|
|
182
|
+
readonly collection?: CollectionOptionsWithoutGraphName<ReactiveIndexOptions>;
|
|
183
|
+
}
|
|
184
|
+
/** Return value for D161 persistent reactiveList composition. */
|
|
185
|
+
interface PersistentReactiveList<T> {
|
|
186
|
+
readonly collection: ReactiveList<T>;
|
|
187
|
+
readonly persistence: ReactiveCollectionPersistenceHandle;
|
|
188
|
+
readonly loaded: ReactiveListRestoreState<T>;
|
|
189
|
+
}
|
|
190
|
+
/** Return value for D161 persistent reactiveLog composition. */
|
|
191
|
+
interface PersistentReactiveLog<T> {
|
|
192
|
+
readonly collection: ReactiveLog<T>;
|
|
193
|
+
readonly persistence: ReactiveCollectionPersistenceHandle;
|
|
194
|
+
readonly loaded: ReactiveLogRestoreState<T>;
|
|
195
|
+
}
|
|
196
|
+
/** Return value for D161 persistent reactiveMap composition. */
|
|
197
|
+
interface PersistentReactiveMap<K, V> {
|
|
198
|
+
readonly collection: ReactiveMap<K, V>;
|
|
199
|
+
readonly persistence: ReactiveCollectionPersistenceHandle;
|
|
200
|
+
readonly loaded: ReactiveMapRestoreState<K, V>;
|
|
201
|
+
}
|
|
202
|
+
/** Return value for D161 persistent reactiveIndex composition. */
|
|
203
|
+
interface PersistentReactiveIndex<K, V> {
|
|
204
|
+
readonly collection: ReactiveIndex<K, V>;
|
|
205
|
+
readonly persistence: ReactiveCollectionPersistenceHandle;
|
|
206
|
+
readonly loaded: ReactiveIndexRestoreState<K, V>;
|
|
207
|
+
}
|
|
208
|
+
/** D161 convenience wrapper: passive load, sync restoreReactiveList, then sidecar persist. */
|
|
209
|
+
declare function openPersistentReactiveList<T = unknown>(opts: OpenPersistentReactiveListOptions<T>): Promise<PersistentReactiveList<T>>;
|
|
210
|
+
/** D161 convenience wrapper: passive load, sync restoreReactiveLog, then sidecar persist. */
|
|
211
|
+
declare function openPersistentReactiveLog<T = unknown>(opts: OpenPersistentReactiveLogOptions<T>): Promise<PersistentReactiveLog<T>>;
|
|
212
|
+
/** D161 convenience wrapper: passive load, sync restoreReactiveMap, then sidecar persist. */
|
|
213
|
+
declare function openPersistentReactiveMap<K = unknown, V = unknown>(opts: OpenPersistentReactiveMapOptions<K, V>): Promise<PersistentReactiveMap<K, V>>;
|
|
214
|
+
/** D161 convenience wrapper: passive load, sync restoreReactiveIndex, then sidecar persist. */
|
|
215
|
+
declare function openPersistentReactiveIndex<K = unknown, V = unknown>(opts: OpenPersistentReactiveIndexOptions<K, V>): Promise<PersistentReactiveIndex<K, V>>;
|
|
216
|
+
|
|
217
|
+
export { AGENTIC_MEMORY_RECORD_CHANGE_FORMAT as A, assertAgenticMemoryRecordSnapshotFrame as B, loadAgenticMemoryRecordsState as C, openPersistentAgenticMemoryRecords as D, openPersistentReactiveIndex as E, openPersistentReactiveList as F, openPersistentReactiveLog as G, openPersistentReactiveMap as H, persistAgenticMemoryRecords as I, persistReactiveCollection as J, type LoadAgenticMemoryRecordsStateOptions as L, type OpenPersistentAgenticMemoryRecordsOptions as O, type PersistAgenticMemoryRecordsOptions as P, type ReactiveCollectionPersistenceCursor as R, AGENTIC_MEMORY_RECORD_SNAPSHOT_FORMAT as a, AGENTIC_MEMORY_RECORD_STORAGE_FRAME_VERSION as b, type AgenticMemoryRecordChangeFrame as c, type AgenticMemoryRecordSnapshotFrame as d, type AgenticMemoryRecordsPersistenceCursor as e, type AgenticMemoryRecordsPersistenceError as f, type AgenticMemoryRecordsPersistenceHandle as g, type AgenticMemoryRecordsPersistenceStatus as h, type AgenticMemoryRecordsRestoreState as i, type OpenPersistentReactiveIndexOptions as j, type OpenPersistentReactiveListOptions as k, type OpenPersistentReactiveLogOptions as l, type OpenPersistentReactiveMapOptions as m, type PersistReactiveCollectionOptions as n, type PersistentAgenticMemoryRecords as o, type PersistentReactiveIndex as p, type PersistentReactiveList as q, type PersistentReactiveLog as r, type PersistentReactiveMap as s, type ReactiveCollectionPersistenceError as t, type ReactiveCollectionPersistenceHandle as u, type ReactiveCollectionPersistenceStatus as v, agenticMemoryRecordChangeFrame as w, agenticMemoryRecordSnapshotFrame as x, agenticMemoryRecordsSnapshotKey as y, assertAgenticMemoryRecordChangeFrame as z };
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { N as Node } from './types-h12mNYbq.js';
|
|
2
|
+
import { J as CollectionCoreOptions, s as ReactiveOpt, L as ListChange, V as ViewCachePolicy, c as LogChange, t as ReactiveView, u as RetentionPolicy, M as MapChange } from './reactive-collection-Cb1II1Fi.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Reactive positional list (CSP-2.8, D54/D60) — the two-port collection template.
|
|
6
|
+
*
|
|
7
|
+
* Shape (D60 + review #2): a mutable array BACKEND (the single materialized state) + the shared
|
|
8
|
+
* {@link collectionCore} two ports — a DELTA stream ({@link ReactiveList.delta}, one event per
|
|
9
|
+
* mutation, O(1)) and a lazy pull SNAPSHOT ({@link ReactiveList.snapshot}, materialized only on a
|
|
10
|
+
* cone-routed RESUME demand). Mutation input is D54 A3 hybrid: ergonomic imperative methods (the
|
|
11
|
+
* external boundary, state-verb-legitimate, D4) + `appendFrom(src)` widening (an in-graph producer
|
|
12
|
+
* drives the list with zero imperative glue). Synchronous quick-reads (`at`/`size`/`toArray`) are
|
|
13
|
+
* the deliberately-non-reactive peek for cold/imperative reads (D60).
|
|
14
|
+
*
|
|
15
|
+
* Per-language (D6/D24, never in parity, no conformance — the substrate pull is already C-16).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
type ReactiveListOpt<T> = ReactiveOpt<T>;
|
|
19
|
+
interface ReactiveListOptions extends CollectionCoreOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Head-trim capacity policy (D72). A static number caps the list locally; a Node-valued maxSize
|
|
22
|
+
* must be graph-bound and becomes a declared policy dep that trims on policy changes.
|
|
23
|
+
*/
|
|
24
|
+
maxSize?: ReactiveListOpt<number>;
|
|
25
|
+
}
|
|
26
|
+
interface ReactiveList<T> {
|
|
27
|
+
/** DELTA stream: one {@link ListChange} per mutation (O(1)). Subscribe to observe events. */
|
|
28
|
+
readonly delta: Node<ListChange<T>>;
|
|
29
|
+
/** SNAPSHOT pull node: demand via `ctx.upNext([[RESUME, pullId]])` → one `readonly T[]` (lazy O(n)). */
|
|
30
|
+
readonly snapshot: Node<readonly T[]>;
|
|
31
|
+
/** The snapshot node's pullId — write it verbatim into the demander's fn (D59). */
|
|
32
|
+
readonly pullId: symbol;
|
|
33
|
+
/** Current entry count (O(1), synchronous non-reactive read). */
|
|
34
|
+
readonly size: number;
|
|
35
|
+
/** Positional access (O(1)); negative indices Python-style; `undefined` out of range. Sync read. */
|
|
36
|
+
at(index: number): T | undefined;
|
|
37
|
+
/** Full current contents (O(n), fresh defensive copy). Sync non-reactive read (cold-start peek). */
|
|
38
|
+
toArray(): readonly T[];
|
|
39
|
+
append(value: T): void;
|
|
40
|
+
/** Append all values; one delta event + one snapshot-arm. No-op if `values` is empty. */
|
|
41
|
+
appendMany(values: readonly T[]): void;
|
|
42
|
+
/** Insert at `index` (0..size). Throws `RangeError` out of range. */
|
|
43
|
+
insert(index: number, value: T): void;
|
|
44
|
+
/** Insert all at `index` as one op. No-op if `values` is empty. Throws out of range. */
|
|
45
|
+
insertMany(index: number, values: readonly T[]): void;
|
|
46
|
+
/** Remove and return the value at `index` (default last; negative Python-style). Throws if empty/out of range. */
|
|
47
|
+
pop(index?: number): T;
|
|
48
|
+
clear(): void;
|
|
49
|
+
/** D54 widening: every value from `src` is appended. Returns a disposer. */
|
|
50
|
+
appendFrom(src: Node<T>): () => void;
|
|
51
|
+
/** Release the widening subscriptions (idempotent). */
|
|
52
|
+
dispose(): void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a reactive list (D54/D60). The DELTA + SNAPSHOT ports + pullId come from the shared
|
|
56
|
+
* {@link collectionCore}; this layer adds the typed list method surface + backend.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const list = reactiveList<number>([1]);
|
|
61
|
+
* // observe events:
|
|
62
|
+
* list.delta.subscribe((m) => { if (m[0] === "DATA") console.log("Δ", m[1]); });
|
|
63
|
+
* list.append(2); // delta: {kind:"append", value:2}
|
|
64
|
+
* // demand the snapshot (a downstream consumer, holding `list.snapshot` upstream, runs):
|
|
65
|
+
* // ctx.upNext([["RESUME", list.pullId]]); → SNAPSHOT delivers [1, 2]
|
|
66
|
+
* list.toArray(); // [1, 2] (synchronous non-reactive read)
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function reactiveList<T>(initial?: readonly T[], options?: ReactiveListOptions): ReactiveList<T>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Reactive append-only log (CSP-2.8, D54/D60) — two-port collection with incremental views.
|
|
73
|
+
*
|
|
74
|
+
* Shape = the shared {@link collectionCore} two ports over an array (or ring-buffer if `maxSize`)
|
|
75
|
+
* BACKEND (D60). Specializations (D60 #5 / review #5):
|
|
76
|
+
* - SNAPSHOT (the full `readonly T[]`) is the lazy pull port like the others, BUT the log's main
|
|
77
|
+
* consumption is INCREMENTAL: `tail()` / `slice()` / `scan()` re-derive on the DELTA backbone
|
|
78
|
+
* (dep=[delta]), folding each appended value as it arrives — NOT re-scanning a pushed full array.
|
|
79
|
+
* - `append(undefined)` throws: `undefined` is the substrate SENTINEL (R-data-payload / R-sentinel),
|
|
80
|
+
* not a valid value.
|
|
81
|
+
* - empty log: the snapshot is `[]` (a real empty array); a never-appended `scan` seeds its initial.
|
|
82
|
+
* There is NO `[[RESOLVED]]`-for-empty dual role (D49 narrowed RESOLVED to undirty-only, D60 #5b).
|
|
83
|
+
* - `attach(upstream)` = the D54 widening (a declared input-fold dep), NOT an imperative subscribe.
|
|
84
|
+
* - {@link mergeReactiveLogs} is a DECLARED-DEP merge (deps=[...delta streams]), NOT the old
|
|
85
|
+
* internal-subscribe island (D45 must-fix, D60 #5e).
|
|
86
|
+
* - storage persistence = D57 (binding-layer observe-sink), out of scope here.
|
|
87
|
+
*
|
|
88
|
+
* Per-language (D6/D24, never in parity, no conformance — the substrate pull is already C-16).
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
interface ReactiveLogOptions extends CollectionCoreOptions {
|
|
92
|
+
/** Ring-buffer cap: appends past `maxSize` evict the oldest (head-trim, append-only-safe). */
|
|
93
|
+
maxSize?: number;
|
|
94
|
+
/** Static D80 memo policy for D121 light views. Eviction does not dispose returned views. */
|
|
95
|
+
viewCache?: ViewCachePolicy;
|
|
96
|
+
}
|
|
97
|
+
interface ReactiveLog<T> {
|
|
98
|
+
readonly delta: Node<LogChange<T>>;
|
|
99
|
+
/** SNAPSHOT pull node: demand → full `readonly T[]` (lazy O(n)). For incremental use {@link tail}, {@link slice}, or {@link scan}. */
|
|
100
|
+
readonly snapshot: Node<readonly T[]>;
|
|
101
|
+
readonly pullId: symbol;
|
|
102
|
+
/** Entry count (O(1)). Sync non-reactive read. */
|
|
103
|
+
readonly size: number;
|
|
104
|
+
/** Positional access (O(1)); negative Python-style; `undefined` out of range. Sync read. */
|
|
105
|
+
at(index: number): T | undefined;
|
|
106
|
+
/** Full contents (O(n) fresh copy). Sync non-reactive read (cold-start peek). */
|
|
107
|
+
toArray(): readonly T[];
|
|
108
|
+
/** Append one value. Throws on `undefined` (substrate SENTINEL, R-data-payload). */
|
|
109
|
+
append(value: T): void;
|
|
110
|
+
/** Append many; one delta event. No-op if empty. Throws if any value is `undefined`. */
|
|
111
|
+
appendMany(values: readonly T[]): void;
|
|
112
|
+
clear(): void;
|
|
113
|
+
/** Remove the first `n` entries (clamped to size). */
|
|
114
|
+
trimHead(n: number): void;
|
|
115
|
+
/**
|
|
116
|
+
* Incremental tail view: a derived node emitting the last `n` entries, recomputed on each delta
|
|
117
|
+
* (dep=[delta], D60 #5a). Memoized per `n` until {@link dispose}; use stable ranges for
|
|
118
|
+
* long-lived logs. Subscribe to keep it live.
|
|
119
|
+
*/
|
|
120
|
+
tail(n: number): Node<readonly T[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Incremental positional view: a derived node emitting `toArray().slice(start, stop)`,
|
|
123
|
+
* recomputed on each delta (dep=[delta], D60 #5a). Memoized per `[start, stop]` until
|
|
124
|
+
* {@link dispose}; use stable ranges for long-lived logs.
|
|
125
|
+
*/
|
|
126
|
+
slice(start: number, stop?: number): Node<readonly T[]>;
|
|
127
|
+
/**
|
|
128
|
+
* D121 light page view: `delta` forwards parent log mutations, and `snapshot` is a pull node
|
|
129
|
+
* that materializes the current page on demand.
|
|
130
|
+
*/
|
|
131
|
+
page(offset: number, limit: number): ReactiveView<LogChange<T>, readonly T[]>;
|
|
132
|
+
/**
|
|
133
|
+
* Incremental running aggregate over appended values (dep=[delta], D60 #5a). O(1) per append —
|
|
134
|
+
* folds only the new values each delta; resets on `clear`/`trimHead` (a non-append delta) via a
|
|
135
|
+
* full re-fold. Emits the current accumulator on every mutation; seeds `initial` on an empty log.
|
|
136
|
+
*/
|
|
137
|
+
scan<A>(initial: A, step: (acc: A, value: T) => A): Node<A>;
|
|
138
|
+
/** D54 widening: every value from `src` is appended. Returns a disposer. */
|
|
139
|
+
attach(src: Node<T>): () => void;
|
|
140
|
+
dispose(): void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Create an append-only reactive log (D54/D60). DELTA + lazy pull SNAPSHOT + pullId via
|
|
144
|
+
* {@link collectionCore}; this layer adds the typed append surface + incremental view/scan.
|
|
145
|
+
*/
|
|
146
|
+
declare function reactiveLog<T>(initial?: readonly T[], options?: ReactiveLogOptions): ReactiveLog<T>;
|
|
147
|
+
/**
|
|
148
|
+
* Fan-in N reactive logs into one merged DELTA stream (D60 #5e — a DECLARED-DEP merge, NOT the old
|
|
149
|
+
* internal-subscribe island). The returned node declares each log's `delta` as a dep (`partial`)
|
|
150
|
+
* and re-emits every change it sees — describe shows `log[i].delta → merged` truthfully (D45).
|
|
151
|
+
* For the merged SNAPSHOT, fold the merged delta with {@link ReactiveLog.scan}-style logic, or
|
|
152
|
+
* demand each source's snapshot independently.
|
|
153
|
+
*/
|
|
154
|
+
declare function mergeReactiveLogs<T>(logs: readonly ReactiveLog<T>[]): Node<LogChange<T>>;
|
|
155
|
+
/**
|
|
156
|
+
* Standalone incremental scan over a reactive log. Equivalent to `log.scan(initial, step)`;
|
|
157
|
+
* provided for pipe-builder and helper-composition call sites.
|
|
158
|
+
*/
|
|
159
|
+
declare function scanLog<T, A>(log: ReactiveLog<T>, initial: A, step: (acc: A, value: T) => A): Node<A>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Reactive key–value map (CSP-2.8, D54/D60/D68) — two-port collection with policy opts.
|
|
163
|
+
*
|
|
164
|
+
* Shape = the shared {@link collectionCore} two ports over a `Map` BACKEND (D60). Specializations
|
|
165
|
+
* (D60 #3 / review #3):
|
|
166
|
+
* - TTL/LRU are node-as-opt policies (D68). Static `maxSize` / `defaultTtl` values become constant
|
|
167
|
+
* policy deps; Node-valued opts are declared deps. The graph-visible `reactiveMap.apply` node is
|
|
168
|
+
* the normal backend mutation path and emits the public delta payloads it materializes.
|
|
169
|
+
* - LAZY TTL (no background timer): expiry is checked at read (`get`/`has`) + at synchronous
|
|
170
|
+
* snapshot materialization (`toMap`/`pruneExpired`). A read/prune that deletes an expired key
|
|
171
|
+
* emits the normal delta `delete{reason:"expired"}` (D61). Snapshot demand uses an internal pull
|
|
172
|
+
* `snapshotPrep` node: it prunes expired entries and reads the backend once, then public
|
|
173
|
+
* `snapshot` and `delta` derive from that declared prep payload. No snapshot fn drives its own
|
|
174
|
+
* dep (D37).
|
|
175
|
+
* - delete-reason enum {expired|lru-evict|archived|explicit} on the delta (D60 #3c).
|
|
176
|
+
* - LRU `maxSize`: an over-cap `set` evicts the oldest, emitting a `delete{reason:"lru-evict"}`.
|
|
177
|
+
* A live-key `get`/`has` touches LRU order WITHOUT a version bump (internal, D60 #3d).
|
|
178
|
+
* - retention (score-archive, D72): `retention.maxSize` is a value-or-Node numeric policy and
|
|
179
|
+
* the static scorer selects archive victims through the normal `reactiveMap.apply` path.
|
|
180
|
+
*
|
|
181
|
+
* Per-language (D6/D24, never in parity, no conformance — the substrate pull is already C-16).
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
type ReactiveMapOpt<T> = ReactiveOpt<T>;
|
|
185
|
+
interface ReactiveMapRetentionEntry<K, V> {
|
|
186
|
+
readonly key: K;
|
|
187
|
+
readonly value: V;
|
|
188
|
+
}
|
|
189
|
+
interface ReactiveMapRetentionPolicy<K, V> extends RetentionPolicy<ReactiveMapRetentionEntry<K, V>> {
|
|
190
|
+
/** Archive capacity. Unlike LRU, zero is allowed and archives every live entry. */
|
|
191
|
+
readonly maxSize?: ReactiveMapOpt<number>;
|
|
192
|
+
/** Higher scores are retained; lowest finite scores are archived first. */
|
|
193
|
+
score(entry: ReactiveMapRetentionEntry<K, V>): number;
|
|
194
|
+
}
|
|
195
|
+
interface ReactiveMapOptions<K = unknown, V = unknown> extends CollectionCoreOptions {
|
|
196
|
+
/**
|
|
197
|
+
* LRU cap as a node-as-opt policy (D68). A static number is a constant policy config; a Node must
|
|
198
|
+
* be graph-bound and becomes a declared dep of `reactiveMap.apply`.
|
|
199
|
+
*/
|
|
200
|
+
maxSize?: ReactiveMapOpt<number>;
|
|
201
|
+
/**
|
|
202
|
+
* Default TTL in milliseconds as a node-as-opt policy (D68). Per-call `set(...,{ttl})` overrides.
|
|
203
|
+
* Lazy expiry only; no active timer in this cut.
|
|
204
|
+
*/
|
|
205
|
+
defaultTtl?: ReactiveMapOpt<number>;
|
|
206
|
+
/**
|
|
207
|
+
* Score-based retention/archive policy (D72). The scorer is static local code; only maxSize can be
|
|
208
|
+
* a Node-valued policy, keeping graph describe data serializable while apply owns the mutation.
|
|
209
|
+
*/
|
|
210
|
+
retention?: ReactiveMapRetentionPolicy<K, V>;
|
|
211
|
+
/** Static D80 memo policy for D121 light views. Eviction does not dispose returned views. */
|
|
212
|
+
viewCache?: ViewCachePolicy;
|
|
213
|
+
/** Injectable monotonic-ish clock for TTL (default `Date.now`). Graph-local clock = follow-up (D26). */
|
|
214
|
+
now?: () => number;
|
|
215
|
+
}
|
|
216
|
+
interface ReactiveMap<K, V> {
|
|
217
|
+
readonly delta: Node<MapChange<K, V>>;
|
|
218
|
+
readonly snapshot: Node<ReadonlyMap<K, V>>;
|
|
219
|
+
readonly pullId: symbol;
|
|
220
|
+
/** Raw entry count (O(1)); may include not-yet-pruned expired entries. Sync non-reactive read. */
|
|
221
|
+
readonly size: number;
|
|
222
|
+
/** Get a live value (prunes the key if expired). Sync read. */
|
|
223
|
+
get(key: K): V | undefined;
|
|
224
|
+
/** Live-key existence (prunes if expired). Sync read. */
|
|
225
|
+
has(key: K): boolean;
|
|
226
|
+
/** Current live (non-expired) entries (fresh copy). Sync non-reactive read (cold-start peek). */
|
|
227
|
+
toMap(): ReadonlyMap<K, V>;
|
|
228
|
+
/**
|
|
229
|
+
* D121 light selected-map view. `delta` forwards parent map mutations, and `snapshot` is a pull
|
|
230
|
+
* node that materializes the currently matching live entries on demand.
|
|
231
|
+
*/
|
|
232
|
+
select(predicate: (value: V, key: K) => boolean): ReactiveView<MapChange<K, V>, ReadonlyMap<K, V>>;
|
|
233
|
+
set(key: K, value: V, opts?: {
|
|
234
|
+
ttl?: number;
|
|
235
|
+
}): void;
|
|
236
|
+
/** Bulk set; one delta event per entry, one snapshot-arm. No-op if empty. */
|
|
237
|
+
setMany(entries: Iterable<readonly [K, V]>, opts?: {
|
|
238
|
+
ttl?: number;
|
|
239
|
+
}): void;
|
|
240
|
+
delete(key: K): void;
|
|
241
|
+
/** Bulk delete; one delta per removed key. No-op if none present. */
|
|
242
|
+
deleteMany(keys: Iterable<K>): void;
|
|
243
|
+
clear(): void;
|
|
244
|
+
/** Explicitly prune expired entries; every removed key emits `delete{reason:"expired"}` (D61). */
|
|
245
|
+
pruneExpired(): void;
|
|
246
|
+
/** D54 widening: every `[key, value]` from `src` is set. Returns a disposer. */
|
|
247
|
+
setFrom(src: Node<readonly [K, V]>): () => void;
|
|
248
|
+
dispose(): void;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Create a reactive map (D54/D60). DELTA stream of {@link MapChange} + lazy pull SNAPSHOT (a
|
|
252
|
+
* `ReadonlyMap`) + pullId via {@link collectionCore}; this layer adds the typed map surface.
|
|
253
|
+
*/
|
|
254
|
+
declare function reactiveMap<K, V>(options?: ReactiveMapOptions<K, V>): ReactiveMap<K, V>;
|
|
255
|
+
|
|
256
|
+
export { type ReactiveList as R, type ReactiveListOpt as a, type ReactiveListOptions as b, type ReactiveLog as c, type ReactiveLogOptions as d, type ReactiveMap as e, type ReactiveMapOpt as f, type ReactiveMapOptions as g, type ReactiveMapRetentionEntry as h, type ReactiveMapRetentionPolicy as i, reactiveLog as j, reactiveMap as k, mergeReactiveLogs as m, reactiveList as r, scanLog as s };
|