@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,344 @@
|
|
|
1
|
+
import { N as Node, D as Dispatcher } from './types-h12mNYbq.js';
|
|
2
|
+
import { d as Graph } from './graph-DfdF9zy4.js';
|
|
3
|
+
import { f as KvStorageTier, d as AppendLogStorageTier } from './append-log-DzKMmjxx.js';
|
|
4
|
+
import { C as Codec } from './codec-BB7p8fJc.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Public policy vocabulary (D80): shared option shapes only.
|
|
8
|
+
*
|
|
9
|
+
* Runtime policy mechanics stay structure-owned: each reactive collection still owns
|
|
10
|
+
* backend mutation, victim application, delta emission, and graph-bound node-as-opt wiring.
|
|
11
|
+
*/
|
|
12
|
+
type ReactiveOpt<T> = T | Node<T>;
|
|
13
|
+
/** Capacity vocabulary shared by structures that bound retained entries. */
|
|
14
|
+
interface CapacityPolicy<Order extends string = never> {
|
|
15
|
+
readonly maxSize: ReactiveOpt<number>;
|
|
16
|
+
readonly order?: Order;
|
|
17
|
+
}
|
|
18
|
+
/** Capacity policy variant for structures whose eviction order must be explicit. */
|
|
19
|
+
type OrderedCapacityPolicy<Order extends string> = CapacityPolicy<Order> & {
|
|
20
|
+
readonly order: Order;
|
|
21
|
+
};
|
|
22
|
+
/** Score-based retention vocabulary; higher scores are retained. */
|
|
23
|
+
interface RetentionPolicy<Entry> {
|
|
24
|
+
readonly maxSize?: ReactiveOpt<number>;
|
|
25
|
+
score(entry: Entry): number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Static view-cache vocabulary for memoized helper nodes.
|
|
29
|
+
*
|
|
30
|
+
* This is intentionally not a release/keepalive API: eviction may drop the structure's
|
|
31
|
+
* memo reference, but externally held Node views remain valid.
|
|
32
|
+
*/
|
|
33
|
+
interface ViewCachePolicy {
|
|
34
|
+
readonly maxEntries?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Delta-event payloads for the reactive data structures (CSP-2.8, D54/D60).
|
|
39
|
+
*
|
|
40
|
+
* Each reactive structure has a DELTA port (an always-on push stream, D60) that emits ONE of
|
|
41
|
+
* these change payloads per mutation (O(1)/mutation). The SNAPSHOT port (a lazy pull-mode node)
|
|
42
|
+
* carries the materialized state instead — see {@link collectionCore}. These are the structure-
|
|
43
|
+
* specific verbs; the delta stream emits the raw payload (no envelope — version/timestamp/audit
|
|
44
|
+
* framing is a storage concern, D57, layered separately if needed).
|
|
45
|
+
*
|
|
46
|
+
* Per-language (D6/D24, never in parity, no conformance). Canonical authority:
|
|
47
|
+
* ~/src/graphrefly/decisions/decisions.jsonl D54/D60.
|
|
48
|
+
*/
|
|
49
|
+
/** List structure delta events. */
|
|
50
|
+
type ListChange<T> = {
|
|
51
|
+
readonly kind: "append";
|
|
52
|
+
readonly value: T;
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: "appendMany";
|
|
55
|
+
readonly values: readonly T[];
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: "insert";
|
|
58
|
+
readonly index: number;
|
|
59
|
+
readonly value: T;
|
|
60
|
+
} | {
|
|
61
|
+
readonly kind: "insertMany";
|
|
62
|
+
readonly index: number;
|
|
63
|
+
readonly values: readonly T[];
|
|
64
|
+
} | {
|
|
65
|
+
readonly kind: "pop";
|
|
66
|
+
readonly index: number;
|
|
67
|
+
readonly value: T;
|
|
68
|
+
} | {
|
|
69
|
+
readonly kind: "trimHead";
|
|
70
|
+
readonly n: number;
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "clear";
|
|
73
|
+
readonly count: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Map structure delta events. `delete.reason` distinguishes the four delete sources (D60 #3c):
|
|
77
|
+
* an explicit `.delete`, a TTL `expired` read-prune, an `lru-evict` under `maxSize`, or an
|
|
78
|
+
* `archived` retention sweep.
|
|
79
|
+
*/
|
|
80
|
+
type MapChange<K, V> = {
|
|
81
|
+
readonly kind: "set";
|
|
82
|
+
readonly key: K;
|
|
83
|
+
readonly value: V;
|
|
84
|
+
} | {
|
|
85
|
+
readonly kind: "delete";
|
|
86
|
+
readonly key: K;
|
|
87
|
+
readonly previous: V;
|
|
88
|
+
readonly reason: "expired" | "lru-evict" | "archived" | "explicit";
|
|
89
|
+
} | {
|
|
90
|
+
readonly kind: "clear";
|
|
91
|
+
readonly count: number;
|
|
92
|
+
};
|
|
93
|
+
/** Dual-key index structure delta events. */
|
|
94
|
+
type IndexChange<K, V> = {
|
|
95
|
+
readonly kind: "upsert";
|
|
96
|
+
readonly primary: K;
|
|
97
|
+
readonly secondary: unknown;
|
|
98
|
+
readonly value: V;
|
|
99
|
+
} | {
|
|
100
|
+
readonly kind: "delete";
|
|
101
|
+
readonly primary: K;
|
|
102
|
+
} | {
|
|
103
|
+
readonly kind: "deleteMany";
|
|
104
|
+
readonly primaries: readonly K[];
|
|
105
|
+
} | {
|
|
106
|
+
readonly kind: "clear";
|
|
107
|
+
readonly count: number;
|
|
108
|
+
};
|
|
109
|
+
/** Append-only log structure delta events. */
|
|
110
|
+
type LogChange<T> = {
|
|
111
|
+
readonly kind: "append";
|
|
112
|
+
readonly value: T;
|
|
113
|
+
} | {
|
|
114
|
+
readonly kind: "appendMany";
|
|
115
|
+
readonly values: readonly T[];
|
|
116
|
+
} | {
|
|
117
|
+
readonly kind: "clear";
|
|
118
|
+
readonly count: number;
|
|
119
|
+
} | {
|
|
120
|
+
readonly kind: "trimHead";
|
|
121
|
+
readonly n: number;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The shared reactiveCollection core (CSP-2.8, D60).
|
|
126
|
+
*
|
|
127
|
+
* Every reactive data structure (list/map/index/log) is `collectionCore(backend) + a typed method
|
|
128
|
+
* surface` (D60 #5). The core owns the TWO output ports and nothing else:
|
|
129
|
+
*
|
|
130
|
+
* - BACKEND — the single materialized state (D60 #1): a plain mutable object with a monotonic
|
|
131
|
+
* `version` + a `snapshot()`. It applies deltas and IS the materialized state; there is NO ACC
|
|
132
|
+
* node and NO effect bridge re-deriving it (the misdesign D60 rejected — the backend already
|
|
133
|
+
* integrates, its cost is intrinsic). The backend is a closure object, not a graph node, so its
|
|
134
|
+
* durability is structural (survives last-subscriber disconnect; node ROM/RAM is moot, D60 #1).
|
|
135
|
+
*
|
|
136
|
+
* - DELTA port (D60 #2a) — an always-on bare source ({@link CollectionCore.delta}); each mutation
|
|
137
|
+
* pushes ONE change payload (O(1)/mutation). Downstream watches events anytime. It is the
|
|
138
|
+
* structure's BACKBONE: the snapshot node declares it as its dep (D60 reactiveList topology).
|
|
139
|
+
*
|
|
140
|
+
* - SNAPSHOT port (D60 #2b) — a pull-mode node ({@link CollectionCore.snapshot}, R-pull/D59) that
|
|
141
|
+
* is QUIET by default and, on a cone-routed RESUME demand, LAZILY reads `backend.snapshot()`
|
|
142
|
+
* (one O(n) materialization) and pushes it once, then re-quiets. The O(n) build happens ONLY on
|
|
143
|
+
* demand — never eagerly per mutation (D60 #2b: lazy is P·O(n), not M·O(n)). It has NO value of
|
|
144
|
+
* its own — its fn reads the backend on demand, so the backend stays the single source of truth
|
|
145
|
+
* (D60 #3). Coalesce-on-no-change is free: the delta-dep's DIRTY/DATA arms the pull node via
|
|
146
|
+
* R-pull's quiet-absorb accounting; a demand with no intervening delta is silent (C-16).
|
|
147
|
+
*
|
|
148
|
+
* Demand path: a downstream consumer issues `ctx.upNext([[RESUME, core.pullId]])` (boundary-deferred
|
|
149
|
+
* self-demand, R-up-routing/D59) — it needs the snapshot node upstream in its declared cone, NOT its
|
|
150
|
+
* reference. Cold-start (a demand before any mutation) is silent by substrate coalesce (C-16); for an
|
|
151
|
+
* initial/imperative read use the structure's synchronous quick-read (the deliberately-non-reactive
|
|
152
|
+
* peek, D60) — the reactive pull serves the watch-delta-then-demand pattern.
|
|
153
|
+
*
|
|
154
|
+
* Per-language (D6/D24, never in parity, no conformance — the substrate pull is already C-16).
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
interface CollectionCoreOptions {
|
|
158
|
+
/** Debug/inspection name; the delta/snapshot nodes derive `${name}.delta` / `${name}.snapshot`. */
|
|
159
|
+
name?: string;
|
|
160
|
+
/** Dispatcher for the core's nodes (default = process-global, D26). */
|
|
161
|
+
dispatcher?: Dispatcher;
|
|
162
|
+
/** Graph funnel for describe-visible input folds (D61). Required by *From/attach methods. */
|
|
163
|
+
graph?: Graph;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Public D121 collection-view surface. A view is a derived surface: `delta` is the pushed update
|
|
167
|
+
* port, `snapshot` is a lazy pull node, and neither port is writable authority.
|
|
168
|
+
*/
|
|
169
|
+
interface ReactiveView<C, S> {
|
|
170
|
+
/** Derived DELTA/update stream for the view. For light views this is recomputed from the parent backend. */
|
|
171
|
+
readonly delta: Node<C>;
|
|
172
|
+
/** Derived SNAPSHOT pull node: demand via `pullId` to materialize the current view. */
|
|
173
|
+
readonly snapshot: Node<S>;
|
|
174
|
+
/** The snapshot node's pullId (R-pull/D59), minted per view instance. */
|
|
175
|
+
readonly pullId: symbol;
|
|
176
|
+
/** Release memoized/light-view resources owned by the parent collection. */
|
|
177
|
+
dispose(): void;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Reactive dual-key index (CSP-2.8, D54/D60) — unique primary key, rows sorted by (secondary, primary).
|
|
182
|
+
*
|
|
183
|
+
* Shape = the shared {@link collectionCore} two ports over a sorted-array + parallel-Map BACKEND
|
|
184
|
+
* (D60). The SNAPSHOT port delivers the ordered `IndexRow[]`. Secondary/reverse lookup = "Z"
|
|
185
|
+
* (review #4): `has`/`get`/`rangeByPrimary` are SYNCHRONOUS point-reads over the backend's parallel
|
|
186
|
+
* Map (NOT topology, like `.cache`); `byPrimary` is an OPTIONAL reactive derived over the delta
|
|
187
|
+
* backbone (a pushed primary→value map), LAZILY created on first access (no default keepalive,
|
|
188
|
+
* R-rom-ram). The two coexist: the derived is the reactive reverse-lookup port; the sync reads are
|
|
189
|
+
* the point query.
|
|
190
|
+
*
|
|
191
|
+
* Per-language (D6/D24, never in parity, no conformance — the substrate pull is already C-16).
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
type ReactiveIndexOpt<T> = ReactiveOpt<T>;
|
|
195
|
+
type ReactiveIndexCapacityOrder = "secondary" | "primary" | "lru";
|
|
196
|
+
interface ReactiveIndexCapacityPolicy extends OrderedCapacityPolicy<ReactiveIndexCapacityOrder> {
|
|
197
|
+
}
|
|
198
|
+
interface ReactiveIndexOptions extends CollectionCoreOptions {
|
|
199
|
+
/**
|
|
200
|
+
* D73 explicit capacity policy: no implicit eviction default.
|
|
201
|
+
* `order` chooses eviction semantics and `maxSize` may be static or node-valued (D68).
|
|
202
|
+
*/
|
|
203
|
+
readonly capacity?: ReactiveIndexCapacityPolicy;
|
|
204
|
+
/** Static D80 memo policy for D121 light views. Eviction does not dispose returned views. */
|
|
205
|
+
readonly viewCache?: ViewCachePolicy;
|
|
206
|
+
}
|
|
207
|
+
interface IndexRow<K, V = unknown> {
|
|
208
|
+
readonly primary: K;
|
|
209
|
+
readonly secondary: unknown;
|
|
210
|
+
readonly value: V;
|
|
211
|
+
}
|
|
212
|
+
interface ReactiveIndex<K, V = unknown> {
|
|
213
|
+
readonly delta: Node<IndexChange<K, V>>;
|
|
214
|
+
/** SNAPSHOT pull node: demand → rows sorted by (secondary, primary) (lazy O(n)). */
|
|
215
|
+
readonly snapshot: Node<readonly IndexRow<K, V>[]>;
|
|
216
|
+
readonly pullId: symbol;
|
|
217
|
+
/** Row count (O(1)). Sync non-reactive read. */
|
|
218
|
+
readonly size: number;
|
|
219
|
+
/** O(1) primary-key existence. Sync read (Z). */
|
|
220
|
+
has(primary: K): boolean;
|
|
221
|
+
/** O(1) value lookup by primary key. Sync read (Z). */
|
|
222
|
+
get(primary: K): V | undefined;
|
|
223
|
+
/** Values whose primary sorts within `[start, end)`, ascending primary order. Sync read (Z). */
|
|
224
|
+
rangeByPrimary(start: K, end: K): V[];
|
|
225
|
+
/**
|
|
226
|
+
* D121 light range view over the primary axis. `delta` forwards parent index mutations, and
|
|
227
|
+
* `snapshot` is a pull node that materializes the current range on demand.
|
|
228
|
+
*/
|
|
229
|
+
range(start: K, end: K): ReactiveView<IndexChange<K, V>, readonly V[]>;
|
|
230
|
+
/** Ordered rows (fresh copy). Sync non-reactive read (cold-start peek). */
|
|
231
|
+
toArray(): readonly IndexRow<K, V>[];
|
|
232
|
+
/** Primary→value map (fresh copy). Sync non-reactive read. */
|
|
233
|
+
toPrimaryMap(): ReadonlyMap<K, V>;
|
|
234
|
+
/**
|
|
235
|
+
* OPTIONAL reactive reverse-lookup port (Z): a derived primary→value map, pushed on every
|
|
236
|
+
* mutation. Lazily created on first access (no keepalive — live only while subscribed). Use the
|
|
237
|
+
* synchronous {@link ReactiveIndex.get} for a one-shot point query.
|
|
238
|
+
*/
|
|
239
|
+
readonly byPrimary: Node<ReadonlyMap<K, V>>;
|
|
240
|
+
/** Insert/replace a row. Returns `true` if a NEW row was inserted (primary was absent). */
|
|
241
|
+
upsert(primary: K, secondary: unknown, value: V): boolean;
|
|
242
|
+
/** Bulk upsert; one delta per row. No-op if empty. */
|
|
243
|
+
upsertMany(rows: Iterable<{
|
|
244
|
+
primary: K;
|
|
245
|
+
secondary: unknown;
|
|
246
|
+
value: V;
|
|
247
|
+
}>): void;
|
|
248
|
+
delete(primary: K): void;
|
|
249
|
+
/** Bulk delete; one delta event. No-op if nothing removed. */
|
|
250
|
+
deleteMany(primaries: Iterable<K>): void;
|
|
251
|
+
clear(): void;
|
|
252
|
+
/** D54 widening: every row from `src` is upserted. Returns a disposer. */
|
|
253
|
+
upsertFrom(src: Node<{
|
|
254
|
+
primary: K;
|
|
255
|
+
secondary: unknown;
|
|
256
|
+
value: V;
|
|
257
|
+
}>): () => void;
|
|
258
|
+
dispose(): void;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Create a reactive dual-key index (D54/D60). DELTA + lazy pull SNAPSHOT + pullId via
|
|
262
|
+
* {@link collectionCore}; this layer adds the sorted backend + Z reverse-lookup surface.
|
|
263
|
+
*/
|
|
264
|
+
declare function reactiveIndex<K, V = unknown>(options?: ReactiveIndexOptions): ReactiveIndex<K, V>;
|
|
265
|
+
|
|
266
|
+
/** D161 strict-JSON snapshot frame format tag for reactive collection persistence. */
|
|
267
|
+
declare const REACTIVE_COLLECTION_SNAPSHOT_FORMAT: "graphrefly.reactive-collection.snapshot.v1";
|
|
268
|
+
/** D161 strict-JSON change frame format tag for reactive collection persistence. */
|
|
269
|
+
declare const REACTIVE_COLLECTION_CHANGE_FORMAT: "graphrefly.reactive-collection.change.v1";
|
|
270
|
+
/** D161 v1 frame version for reactive collection snapshot/change storage. */
|
|
271
|
+
declare const REACTIVE_COLLECTION_FRAME_VERSION: 1;
|
|
272
|
+
/** D161 collection kinds recognized by the unified persistence frame envelope. */
|
|
273
|
+
type ReactiveCollectionStorageKind = "reactiveList" | "reactiveLog" | "reactiveMap" | "reactiveIndex";
|
|
274
|
+
/** D161 durable baseline frame; storage is passive and does not own graph restore. */
|
|
275
|
+
interface ReactiveCollectionSnapshotFrame<K extends ReactiveCollectionStorageKind = ReactiveCollectionStorageKind, S = unknown> {
|
|
276
|
+
readonly format: typeof REACTIVE_COLLECTION_SNAPSHOT_FORMAT;
|
|
277
|
+
readonly version: typeof REACTIVE_COLLECTION_FRAME_VERSION;
|
|
278
|
+
readonly kind: K;
|
|
279
|
+
/** Last append-log seq reflected by this snapshot; -1 means no change-log entry. */
|
|
280
|
+
readonly changeCursor: number;
|
|
281
|
+
readonly snapshot: S;
|
|
282
|
+
}
|
|
283
|
+
/** D161 append-log change frame; change-log replay is collection-state folding, not graph restore. */
|
|
284
|
+
interface ReactiveCollectionChangeFrame<K extends ReactiveCollectionStorageKind = ReactiveCollectionStorageKind, C = unknown> {
|
|
285
|
+
readonly format: typeof REACTIVE_COLLECTION_CHANGE_FORMAT;
|
|
286
|
+
readonly version: typeof REACTIVE_COLLECTION_FRAME_VERSION;
|
|
287
|
+
readonly kind: K;
|
|
288
|
+
readonly change: C;
|
|
289
|
+
}
|
|
290
|
+
/** D161 passive load/fold result consumed by synchronous restoreReactive* helpers. */
|
|
291
|
+
interface ReactiveCollectionRestoreState<K extends ReactiveCollectionStorageKind = ReactiveCollectionStorageKind, S = unknown> {
|
|
292
|
+
readonly kind: K;
|
|
293
|
+
readonly state: S;
|
|
294
|
+
readonly source: "empty" | "changes" | "snapshot" | "snapshot+changes";
|
|
295
|
+
readonly snapshot: {
|
|
296
|
+
readonly found: boolean;
|
|
297
|
+
readonly changeCursor: number;
|
|
298
|
+
};
|
|
299
|
+
readonly changes: {
|
|
300
|
+
readonly applied: number;
|
|
301
|
+
readonly cursor: number;
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
/** D161 restore state for a reactiveList materialized as a strict-JSON array snapshot. */
|
|
305
|
+
type ReactiveListRestoreState<T = unknown> = ReactiveCollectionRestoreState<"reactiveList", readonly T[]>;
|
|
306
|
+
/** D161 restore state for a reactiveLog materialized as a strict-JSON array snapshot. */
|
|
307
|
+
type ReactiveLogRestoreState<T = unknown> = ReactiveCollectionRestoreState<"reactiveLog", readonly T[]>;
|
|
308
|
+
/** D161 passive restore-state shape for reactiveMap; policy-aware restore remains deferred. */
|
|
309
|
+
type ReactiveMapRestoreState<K = unknown, V = unknown> = ReactiveCollectionRestoreState<"reactiveMap", readonly (readonly [K, V])[]>;
|
|
310
|
+
/** D161 passive restore-state shape for reactiveIndex; key-codec restore remains deferred. */
|
|
311
|
+
type ReactiveIndexRestoreState<K = unknown, V = unknown> = ReactiveCollectionRestoreState<"reactiveIndex", readonly IndexRow<K, V>[]>;
|
|
312
|
+
/** D161 passive storage inputs for collection load/fold helpers. */
|
|
313
|
+
interface LoadReactiveCollectionStateOptions {
|
|
314
|
+
readonly snapshotStore: KvStorageTier<unknown>;
|
|
315
|
+
readonly snapshotKey?: string;
|
|
316
|
+
readonly storagePrefix?: string;
|
|
317
|
+
readonly changeLog?: AppendLogStorageTier<unknown>;
|
|
318
|
+
}
|
|
319
|
+
/** Build the default D161 snapshot key for a storage prefix. */
|
|
320
|
+
declare function collectionSnapshotKey(storagePrefix?: string): string;
|
|
321
|
+
/** Build a D161 strict-JSON snapshot frame before validation/encoding. */
|
|
322
|
+
declare function reactiveCollectionSnapshotFrame<K extends ReactiveCollectionStorageKind, S>(kind: K, snapshot: S, opts?: {
|
|
323
|
+
readonly changeCursor?: number;
|
|
324
|
+
}): ReactiveCollectionSnapshotFrame<K, S>;
|
|
325
|
+
/** Build a D161 strict-JSON change frame before validation/encoding. */
|
|
326
|
+
declare function reactiveCollectionChangeFrame<K extends ReactiveCollectionStorageKind, C>(kind: K, change: C): ReactiveCollectionChangeFrame<K, C>;
|
|
327
|
+
/** Validate a D161 snapshot frame and reject non-strict-JSON payloads honestly. */
|
|
328
|
+
declare function assertReactiveCollectionSnapshotFrame<K extends ReactiveCollectionStorageKind, S = unknown>(value: unknown, expectedKind: K): ReactiveCollectionSnapshotFrame<K, S>;
|
|
329
|
+
/** Validate a D161 change frame and reject non-strict-JSON payloads honestly. */
|
|
330
|
+
declare function assertReactiveCollectionChangeFrame<K extends ReactiveCollectionStorageKind, C = unknown>(value: unknown, expectedKind: K): ReactiveCollectionChangeFrame<K, C>;
|
|
331
|
+
/** Codec for D161 snapshot frames with strict JSON validation on both encode and decode. */
|
|
332
|
+
declare function reactiveCollectionSnapshotFrameCodec<K extends ReactiveCollectionStorageKind, S = unknown>(kind: K): Codec<ReactiveCollectionSnapshotFrame<K, S>>;
|
|
333
|
+
/** Codec for D161 change frames with strict JSON validation on both encode and decode. */
|
|
334
|
+
declare function reactiveCollectionChangeFrameCodec<K extends ReactiveCollectionStorageKind, C = unknown>(kind: K): Codec<ReactiveCollectionChangeFrame<K, C>>;
|
|
335
|
+
/** D161 passive load/fold for reactiveList; reads storage but never mutates graph topology. */
|
|
336
|
+
declare function loadReactiveListState<T = unknown>(opts: LoadReactiveCollectionStateOptions): Promise<ReactiveListRestoreState<T>>;
|
|
337
|
+
/** D161 passive load/fold for reactiveLog; reads storage but never mutates graph topology. */
|
|
338
|
+
declare function loadReactiveLogState<T = unknown>(opts: LoadReactiveCollectionStateOptions): Promise<ReactiveLogRestoreState<T>>;
|
|
339
|
+
/** D161 passive load/fold scaffold for reactiveMap; synchronous policy restore is deferred. */
|
|
340
|
+
declare function loadReactiveMapState<K = unknown, V = unknown>(opts: LoadReactiveCollectionStateOptions): Promise<ReactiveMapRestoreState<K, V>>;
|
|
341
|
+
/** D161 passive load/fold scaffold for reactiveIndex; key-codec restore is deferred. */
|
|
342
|
+
declare function loadReactiveIndexState<K = unknown, V = unknown>(opts: LoadReactiveCollectionStateOptions): Promise<ReactiveIndexRestoreState<K, V>>;
|
|
343
|
+
|
|
344
|
+
export { loadReactiveLogState as A, loadReactiveMapState as B, type CapacityPolicy as C, reactiveCollectionChangeFrame as D, reactiveCollectionChangeFrameCodec as E, reactiveCollectionSnapshotFrame as F, reactiveCollectionSnapshotFrameCodec as G, reactiveIndex as H, type IndexChange as I, type CollectionCoreOptions as J, type ListChange as L, type MapChange as M, type OrderedCapacityPolicy as O, REACTIVE_COLLECTION_CHANGE_FORMAT as R, type ViewCachePolicy as V, type IndexRow as a, type LoadReactiveCollectionStateOptions as b, type LogChange as c, REACTIVE_COLLECTION_FRAME_VERSION as d, REACTIVE_COLLECTION_SNAPSHOT_FORMAT as e, type ReactiveCollectionChangeFrame as f, type ReactiveCollectionRestoreState as g, type ReactiveCollectionSnapshotFrame as h, type ReactiveCollectionStorageKind as i, type ReactiveIndex as j, type ReactiveIndexCapacityOrder as k, type ReactiveIndexCapacityPolicy as l, type ReactiveIndexOpt as m, type ReactiveIndexOptions as n, type ReactiveIndexRestoreState as o, type ReactiveListRestoreState as p, type ReactiveLogRestoreState as q, type ReactiveMapRestoreState as r, type ReactiveOpt as s, type ReactiveView as t, type RetentionPolicy as u, assertReactiveCollectionChangeFrame as v, assertReactiveCollectionSnapshotFrame as w, collectionSnapshotKey as x, loadReactiveIndexState as y, loadReactiveListState as z };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Q as StateNode, d as Graph } from './graph-DfdF9zy4.js';
|
|
2
|
+
import { N as Node } from './types-h12mNYbq.js';
|
|
3
|
+
import { AgenticMemoryStrictJsonValue, AgenticMemoryRecordFrame, AgenticMemoryRecord } from './solutions/index.js';
|
|
4
|
+
import { f as KvStorageTier, d as AppendLogStorageTier } from './append-log-DzKMmjxx.js';
|
|
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-Cb1II1Fi.js';
|
|
6
|
+
import { b as ReactiveListOptions, d as ReactiveLogOptions, g as ReactiveMapOptions, R as ReactiveList, c as ReactiveLog, e as ReactiveMap } from './reactive-map-BcB4KsQR.js';
|
|
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 };
|