@graphrefly/graphrefly 0.17.0 → 0.19.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-R6OHUUYB.js → chunk-AHRKWMNI.js} +7 -7
- package/dist/chunk-AHRKWMNI.js.map +1 -0
- package/dist/{chunk-2PORF4RP.js → chunk-BER7UYLM.js} +27 -32
- package/dist/chunk-BER7UYLM.js.map +1 -0
- package/dist/{chunk-646OG3PO.js → chunk-IRZAGZUB.js} +51 -52
- package/dist/chunk-IRZAGZUB.js.map +1 -0
- package/dist/{chunk-IHJHBADD.js → chunk-JC2SN46B.js} +385 -197
- package/dist/chunk-JC2SN46B.js.map +1 -0
- package/dist/{chunk-XJ6EMQ22.js → chunk-OO5QOAXI.js} +4 -10
- package/dist/chunk-OO5QOAXI.js.map +1 -0
- package/dist/{chunk-YXROQFXZ.js → chunk-UW77D7SP.js} +3 -3
- package/dist/{chunk-F2ULI3Q3.js → chunk-XUOY3YKN.js} +7 -3
- package/dist/chunk-XUOY3YKN.js.map +1 -0
- package/dist/chunk-YLR5JUJZ.js +111 -0
- package/dist/chunk-YLR5JUJZ.js.map +1 -0
- package/dist/{chunk-BV3TPSBK.js → chunk-YXR3WW3Q.js} +740 -755
- package/dist/chunk-YXR3WW3Q.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +1127 -983
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +4 -4
- package/dist/compat/nestjs/index.d.ts +4 -4
- package/dist/compat/nestjs/index.js +7 -13
- package/dist/core/index.cjs +653 -749
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +7 -7
- package/dist/extra/index.cjs +773 -795
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.d.cts +4 -4
- package/dist/extra/index.d.ts +4 -4
- package/dist/extra/index.js +5 -11
- package/dist/graph/index.cjs +1036 -975
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +3 -3
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +8 -8
- package/dist/{graph-fCsaaVIa.d.cts → graph-KsTe57nI.d.cts} +127 -51
- package/dist/{graph-Dc-P9BVm.d.ts → graph-mILUUqW8.d.ts} +127 -51
- package/dist/{index-DhXznWyH.d.ts → index-8a605sg9.d.ts} +2 -2
- package/dist/{index-D7y9Q8W4.d.ts → index-B2SvPEbc.d.ts} +8 -69
- package/dist/{index-YlOH1Gw6.d.cts → index-BBUYZfJ1.d.cts} +122 -78
- package/dist/{index-ClaKZFPl.d.cts → index-Bjh5C1Tp.d.cts} +38 -35
- package/dist/{index-DWq0P9T6.d.ts → index-BjtlNirP.d.cts} +5 -7
- package/dist/{index-N704txAA.d.ts → index-BnkMgNNa.d.ts} +38 -35
- package/dist/{index-BBVBYPxr.d.cts → index-CgSiUouz.d.ts} +5 -7
- package/dist/{index-BmoUvOGN.d.ts → index-CvKzv0AW.d.ts} +122 -78
- package/dist/{index-4OIX-q0C.d.cts → index-UudxGnzc.d.cts} +8 -69
- package/dist/{index-DlGMf_Qe.d.cts → index-VHA43cGP.d.cts} +2 -2
- package/dist/index.cjs +6146 -5725
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +617 -383
- package/dist/index.d.ts +617 -383
- package/dist/index.js +4401 -4028
- package/dist/index.js.map +1 -1
- package/dist/{meta-BV4pj9ML.d.cts → meta-BnG7XAaE.d.cts} +395 -289
- package/dist/{meta-BV4pj9ML.d.ts → meta-BnG7XAaE.d.ts} +395 -289
- package/dist/observable-C8Kx_O6k.d.cts +36 -0
- package/dist/observable-DcBwQY7t.d.ts +36 -0
- package/dist/patterns/reactive-layout/index.cjs +1037 -857
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +3 -3
- package/dist/patterns/reactive-layout/index.d.ts +3 -3
- package/dist/patterns/reactive-layout/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-2PORF4RP.js.map +0 -1
- package/dist/chunk-646OG3PO.js.map +0 -1
- package/dist/chunk-BV3TPSBK.js.map +0 -1
- package/dist/chunk-EBNKJULL.js +0 -231
- package/dist/chunk-EBNKJULL.js.map +0 -1
- package/dist/chunk-F2ULI3Q3.js.map +0 -1
- package/dist/chunk-IHJHBADD.js.map +0 -1
- package/dist/chunk-R6OHUUYB.js.map +0 -1
- package/dist/chunk-XJ6EMQ22.js.map +0 -1
- package/dist/observable-Cz-AWhwR.d.cts +0 -42
- package/dist/observable-DCqlwGyl.d.ts +0 -42
- /package/dist/{chunk-YXROQFXZ.js.map → chunk-UW77D7SP.js.map} +0 -0
package/dist/graph/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DeltaCheckpoint, E as EvictedSubgraphInfo,
|
|
2
|
-
export { A as AutoCheckpointAdapter, D as DescribeFilter,
|
|
3
|
-
import '../meta-
|
|
1
|
+
export { D as DeltaCheckpoint, E as EvictedSubgraphInfo, a as EvictionPolicy, G as GraphCodec, J as JsonCodec, L as LazyGraphCodec, W as WALEntry, c as createDagCborCodec, b as createDagCborZstdCodec, n as negotiateCodec, r as replayWAL, s as sizeof } from '../index-UudxGnzc.cjs';
|
|
2
|
+
export { A as AutoCheckpointAdapter, D as DescribeFilter, f as GRAPH_META_SEGMENT, G as Graph, g as GraphActorOptions, b as GraphAutoCheckpointHandle, c as GraphAutoCheckpointOptions, h as GraphCheckpointRecord, i as GraphDescribeOptions, j as GraphDescribeOutput, k as GraphDiagramDirection, l as GraphDiagramOptions, m as GraphDiffChange, n as GraphDiffResult, o as GraphDumpOptions, p as GraphFactoryContext, q as GraphNodeFactory, r as GraphObserveAll, s as GraphObserveOne, a as GraphOptions, t as GraphPersistSnapshot, e as GraphProfileOptions, d as GraphProfileResult, N as NodeProfile, O as ObserveDetail, u as ObserveEvent, v as ObserveOptions, w as ObserveResult, x as ObserveTheme, y as ObserveThemeName, R as ReachableDirection, z as ReachableOptions, T as TraceEntry, B as graphProfile, C as reachable } from '../graph-KsTe57nI.cjs';
|
|
3
|
+
import '../meta-BnG7XAaE.cjs';
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DeltaCheckpoint, E as EvictedSubgraphInfo,
|
|
2
|
-
export { A as AutoCheckpointAdapter, D as DescribeFilter,
|
|
3
|
-
import '../meta-
|
|
1
|
+
export { D as DeltaCheckpoint, E as EvictedSubgraphInfo, a as EvictionPolicy, G as GraphCodec, J as JsonCodec, L as LazyGraphCodec, W as WALEntry, c as createDagCborCodec, b as createDagCborZstdCodec, n as negotiateCodec, r as replayWAL, s as sizeof } from '../index-B2SvPEbc.js';
|
|
2
|
+
export { A as AutoCheckpointAdapter, D as DescribeFilter, f as GRAPH_META_SEGMENT, G as Graph, g as GraphActorOptions, b as GraphAutoCheckpointHandle, c as GraphAutoCheckpointOptions, h as GraphCheckpointRecord, i as GraphDescribeOptions, j as GraphDescribeOutput, k as GraphDiagramDirection, l as GraphDiagramOptions, m as GraphDiffChange, n as GraphDiffResult, o as GraphDumpOptions, p as GraphFactoryContext, q as GraphNodeFactory, r as GraphObserveAll, s as GraphObserveOne, a as GraphOptions, t as GraphPersistSnapshot, e as GraphProfileOptions, d as GraphProfileResult, N as NodeProfile, O as ObserveDetail, u as ObserveEvent, v as ObserveOptions, w as ObserveResult, x as ObserveTheme, y as ObserveThemeName, R as ReachableDirection, z as ReachableOptions, T as TraceEntry, B as graphProfile, C as reachable } from '../graph-mILUUqW8.js';
|
|
3
|
+
import '../meta-BnG7XAaE.js';
|
package/dist/graph/index.js
CHANGED
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
JsonCodec,
|
|
3
3
|
createDagCborCodec,
|
|
4
4
|
createDagCborZstdCodec,
|
|
5
|
-
graphProfile,
|
|
6
5
|
negotiateCodec,
|
|
7
|
-
replayWAL
|
|
8
|
-
|
|
9
|
-
} from "../chunk-EBNKJULL.js";
|
|
6
|
+
replayWAL
|
|
7
|
+
} from "../chunk-YLR5JUJZ.js";
|
|
10
8
|
import {
|
|
11
9
|
GRAPH_META_SEGMENT,
|
|
12
10
|
Graph,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
graphProfile,
|
|
12
|
+
reachable,
|
|
13
|
+
sizeof
|
|
14
|
+
} from "../chunk-JC2SN46B.js";
|
|
15
|
+
import "../chunk-XUOY3YKN.js";
|
|
16
|
+
import "../chunk-YXR3WW3Q.js";
|
|
17
17
|
export {
|
|
18
18
|
GRAPH_META_SEGMENT,
|
|
19
19
|
Graph,
|
|
@@ -1,4 +1,67 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as DescribeNodeOutput, g as DescribeDetail, h as DescribeField, N as Node, y as VersioningLevel, A as Actor, l as Messages, o as NodeSink } from './meta-BnG7XAaE.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Graph profiling and inspection utilities.
|
|
5
|
+
*
|
|
6
|
+
* Provides per-node memory estimation, connectivity stats, and hotspot
|
|
7
|
+
* detection. Non-invasive — reads from `describe()` and node internals
|
|
8
|
+
* without modifying state.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Per-node profile entry. */
|
|
14
|
+
interface NodeProfile {
|
|
15
|
+
/** Qualified path within the graph. */
|
|
16
|
+
path: string;
|
|
17
|
+
/** Node type (state, derived, producer, effect). */
|
|
18
|
+
type: string;
|
|
19
|
+
/** Node status (disconnected, dirty, settled, errored, completed). */
|
|
20
|
+
status: string;
|
|
21
|
+
/** Approximate retained bytes for the node's cached value. */
|
|
22
|
+
valueSizeBytes: number;
|
|
23
|
+
/** Number of downstream subscribers (sinks). */
|
|
24
|
+
subscriberCount: number;
|
|
25
|
+
/** Number of upstream dependencies. */
|
|
26
|
+
depCount: number;
|
|
27
|
+
/** True if this is an effect node with no external subscribers (potential leak). */
|
|
28
|
+
isOrphanEffect: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Aggregate graph profile. */
|
|
31
|
+
interface GraphProfileResult {
|
|
32
|
+
/** Total node count. */
|
|
33
|
+
nodeCount: number;
|
|
34
|
+
/** Total edge count. */
|
|
35
|
+
edgeCount: number;
|
|
36
|
+
/** Subgraph count. */
|
|
37
|
+
subgraphCount: number;
|
|
38
|
+
/** All node profiles. */
|
|
39
|
+
nodes: NodeProfile[];
|
|
40
|
+
/** Total approximate value memory across all nodes. */
|
|
41
|
+
totalValueSizeBytes: number;
|
|
42
|
+
/** Nodes sorted by valueSizeBytes descending (top N). */
|
|
43
|
+
hotspots: NodeProfile[];
|
|
44
|
+
/** Effect nodes with no external subscribers (potential leaks). */
|
|
45
|
+
orphanEffects: NodeProfile[];
|
|
46
|
+
}
|
|
47
|
+
/** Options for {@link graphProfile}. */
|
|
48
|
+
interface GraphProfileOptions {
|
|
49
|
+
/** Limit hotspot list (default 10). */
|
|
50
|
+
topN?: number;
|
|
51
|
+
/** Include subgraph nodes recursively (default true). */
|
|
52
|
+
recursive?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Profile a graph's memory and connectivity characteristics.
|
|
56
|
+
*
|
|
57
|
+
* Uses `describe({ detail: "standard" })` for node metadata and direct
|
|
58
|
+
* `NodeImpl` access for subscriber counts and cached values.
|
|
59
|
+
*
|
|
60
|
+
* @param graph - The graph to profile.
|
|
61
|
+
* @param opts - Optional configuration.
|
|
62
|
+
* @returns Aggregate profile with per-node details and hotspots.
|
|
63
|
+
*/
|
|
64
|
+
declare function graphProfile(graph: Graph, opts?: GraphProfileOptions): GraphProfileResult;
|
|
2
65
|
|
|
3
66
|
/**
|
|
4
67
|
* Reserved segment for meta companion paths: `nodeName::__meta__::metaKey` (GRAPHREFLY-SPEC §3.6).
|
|
@@ -165,6 +228,19 @@ type ObserveOptions = {
|
|
|
165
228
|
* `"minimal"` filters to DATA-only events.
|
|
166
229
|
*/
|
|
167
230
|
detail?: ObserveDetail;
|
|
231
|
+
/**
|
|
232
|
+
* When set, auto-enables structured mode and attaches a logger.
|
|
233
|
+
* `"pretty"` renders colored one-line output; `"json"` emits one JSON object per event.
|
|
234
|
+
*/
|
|
235
|
+
format?: "pretty" | "json";
|
|
236
|
+
/** Sink for rendered lines (`console.log` by default). Only used when `format` is set. */
|
|
237
|
+
logger?: (line: string, event: ObserveEvent) => void;
|
|
238
|
+
/** Keep only these event types in formatted output. Only used when `format` is set. */
|
|
239
|
+
includeTypes?: ObserveEvent["type"][];
|
|
240
|
+
/** Exclude these event types from formatted output. Only used when `format` is set. */
|
|
241
|
+
excludeTypes?: ObserveEvent["type"][];
|
|
242
|
+
/** Built-in color preset (`ansi` default) or explicit color tokens. Only used when `format` is set. */
|
|
243
|
+
theme?: ObserveThemeName | ObserveTheme;
|
|
168
244
|
};
|
|
169
245
|
/** Accumulated observation result (structured mode). */
|
|
170
246
|
type ObserveResult<T = unknown> = {
|
|
@@ -176,10 +252,12 @@ type ObserveResult<T = unknown> = {
|
|
|
176
252
|
readonly resolvedCount: number;
|
|
177
253
|
/** All events in order. */
|
|
178
254
|
readonly events: ObserveEvent[];
|
|
179
|
-
/** True if COMPLETE
|
|
180
|
-
readonly
|
|
181
|
-
/** True if ERROR
|
|
182
|
-
readonly
|
|
255
|
+
/** True if any observed node sent COMPLETE without prior ERROR on that node. */
|
|
256
|
+
readonly anyCompletedCleanly: boolean;
|
|
257
|
+
/** True if any observed node sent ERROR. */
|
|
258
|
+
readonly anyErrored: boolean;
|
|
259
|
+
/** True if at least one COMPLETE received and no ERROR from any observed node. */
|
|
260
|
+
readonly completedWithoutErrors: boolean;
|
|
183
261
|
/** Stop observing. */
|
|
184
262
|
dispose(): void;
|
|
185
263
|
/**
|
|
@@ -195,6 +273,8 @@ type ObserveEvent = {
|
|
|
195
273
|
data?: unknown;
|
|
196
274
|
timestamp_ns?: number;
|
|
197
275
|
in_batch?: boolean;
|
|
276
|
+
/** Monotonically increasing counter per subscribe-callback invocation. All events in one delivery share the same id. */
|
|
277
|
+
batch_id?: number;
|
|
198
278
|
trigger_dep_index?: number;
|
|
199
279
|
trigger_dep_name?: string;
|
|
200
280
|
/**
|
|
@@ -208,30 +288,10 @@ type ObserveEvent = {
|
|
|
208
288
|
};
|
|
209
289
|
dep_values?: unknown[];
|
|
210
290
|
};
|
|
211
|
-
/** Built-in color
|
|
212
|
-
type
|
|
213
|
-
/** ANSI/style overrides for
|
|
214
|
-
type
|
|
215
|
-
/** Options for {@link Graph.spy}. */
|
|
216
|
-
type GraphSpyOptions = ObserveOptions & {
|
|
217
|
-
/** Observe one path; omit for graph-wide mode. */
|
|
218
|
-
path?: string;
|
|
219
|
-
/** Keep only these event types in spy output. */
|
|
220
|
-
includeTypes?: ObserveEvent["type"][];
|
|
221
|
-
/** Exclude these event types from spy output. */
|
|
222
|
-
excludeTypes?: ObserveEvent["type"][];
|
|
223
|
-
/** Built-in color preset (`ansi` default) or explicit color tokens. */
|
|
224
|
-
theme?: GraphSpyThemeName | GraphSpyTheme;
|
|
225
|
-
/** One-line `pretty` output (default) or JSON-per-event. */
|
|
226
|
-
format?: "pretty" | "json";
|
|
227
|
-
/** Optional sink for rendered lines (`console.log` by default). */
|
|
228
|
-
logger?: (line: string, event: ObserveEvent) => void;
|
|
229
|
-
};
|
|
230
|
-
/** Handle returned by {@link Graph.spy}. */
|
|
231
|
-
type GraphSpyHandle = {
|
|
232
|
-
readonly result: ObserveResult;
|
|
233
|
-
dispose(): void;
|
|
234
|
-
};
|
|
291
|
+
/** Built-in color preset names for observe `format` rendering. */
|
|
292
|
+
type ObserveThemeName = "none" | "ansi";
|
|
293
|
+
/** ANSI/style overrides for observe `format` event rendering. */
|
|
294
|
+
type ObserveTheme = Partial<Record<ObserveEvent["type"] | "path" | "reset", string>>;
|
|
235
295
|
/** Options for {@link Graph.dumpGraph}. */
|
|
236
296
|
type GraphDumpOptions = {
|
|
237
297
|
actor?: Actor;
|
|
@@ -432,6 +492,14 @@ declare class Graph {
|
|
|
432
492
|
describe(options?: GraphDescribeOptions): GraphDescribeOutput;
|
|
433
493
|
private _collectSubgraphs;
|
|
434
494
|
private _collectAllEdges;
|
|
495
|
+
/**
|
|
496
|
+
* Snapshot-based resource profile: per-node stats, orphan effect detection,
|
|
497
|
+
* memory hotspots. Zero runtime overhead — walks nodes on demand.
|
|
498
|
+
*
|
|
499
|
+
* @param opts - Optional `topN` for hotspot limit (default 10).
|
|
500
|
+
* @returns Aggregate profile with per-node details, hotspots, and orphan effects.
|
|
501
|
+
*/
|
|
502
|
+
resourceProfile(opts?: GraphProfileOptions): GraphProfileResult;
|
|
435
503
|
private _qualifyEdgeEndpoint;
|
|
436
504
|
private _collectObserveTargets;
|
|
437
505
|
private _appendMetaObserveTargets;
|
|
@@ -453,6 +521,9 @@ declare class Graph {
|
|
|
453
521
|
causal?: true;
|
|
454
522
|
derived?: true;
|
|
455
523
|
}): ObserveResult;
|
|
524
|
+
observe(path: string, options: ObserveOptions & {
|
|
525
|
+
format: "pretty" | "json";
|
|
526
|
+
}): ObserveResult;
|
|
456
527
|
observe(path: string, options?: ObserveOptions): GraphObserveOne;
|
|
457
528
|
observe(options: ObserveOptions & {
|
|
458
529
|
structured?: true;
|
|
@@ -460,19 +531,26 @@ declare class Graph {
|
|
|
460
531
|
causal?: true;
|
|
461
532
|
derived?: true;
|
|
462
533
|
}): ObserveResult;
|
|
534
|
+
observe(options: ObserveOptions & {
|
|
535
|
+
format: "pretty" | "json";
|
|
536
|
+
}): ObserveResult;
|
|
463
537
|
observe(options?: ObserveOptions): GraphObserveAll;
|
|
464
538
|
private _createObserveResult;
|
|
465
539
|
private _createObserveResultForAll;
|
|
466
540
|
/**
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
*
|
|
473
|
-
* @returns Disposable handle plus a structured observation accumulator.
|
|
541
|
+
* Fallback ObserveResult for single-node when inspector is disabled but `format` is requested.
|
|
542
|
+
* Subscribes to raw messages and accumulates events with timeline info.
|
|
543
|
+
*/
|
|
544
|
+
private _createFallbackObserveResult;
|
|
545
|
+
/**
|
|
546
|
+
* Fallback ObserveResult for graph-wide when inspector is disabled but `format` is requested.
|
|
474
547
|
*/
|
|
475
|
-
|
|
548
|
+
private _createFallbackObserveResultForAll;
|
|
549
|
+
/**
|
|
550
|
+
* Attaches a format logger to an ObserveResult, rendering events as they arrive.
|
|
551
|
+
* Wraps the result's dispose to flush pending events.
|
|
552
|
+
*/
|
|
553
|
+
private _attachFormatLogger;
|
|
476
554
|
/**
|
|
477
555
|
* CLI/debug-friendly graph dump built on {@link Graph.describe}.
|
|
478
556
|
*
|
|
@@ -552,8 +630,9 @@ declare class Graph {
|
|
|
552
630
|
/**
|
|
553
631
|
* Debounced persistence wired to graph-wide observe stream (spec §3.8 auto-checkpoint).
|
|
554
632
|
*
|
|
555
|
-
* Checkpoint trigger uses {@link messageTier}: only batches containing tier >=
|
|
556
|
-
* schedule a save (`DATA`/`RESOLVED`/terminal/destruction), never pure tier-0/1 control
|
|
633
|
+
* Checkpoint trigger uses {@link messageTier}: only batches containing tier >= 3 messages
|
|
634
|
+
* schedule a save (`DATA`/`RESOLVED`/terminal/destruction), never pure tier-0/1/2 control
|
|
635
|
+
* waves (`START`/`DIRTY`/`INVALIDATE`/`PAUSE`/`RESUME`).
|
|
557
636
|
*/
|
|
558
637
|
autoCheckpoint(adapter: AutoCheckpointAdapter, options?: GraphAutoCheckpointOptions): GraphAutoCheckpointHandle;
|
|
559
638
|
/**
|
|
@@ -576,7 +655,7 @@ declare class Graph {
|
|
|
576
655
|
toD2(options?: GraphDiagramOptions): string;
|
|
577
656
|
/**
|
|
578
657
|
* When `false`, structured observation options (`causal`, `timeline`),
|
|
579
|
-
*
|
|
658
|
+
* and `trace()` writes are no-ops. Raw `observe()` always works.
|
|
580
659
|
*
|
|
581
660
|
* Default: `true` outside production (`process.env.NODE_ENV !== "production"`).
|
|
582
661
|
*/
|
|
@@ -584,20 +663,17 @@ declare class Graph {
|
|
|
584
663
|
private _annotations;
|
|
585
664
|
private _traceRing;
|
|
586
665
|
/**
|
|
587
|
-
*
|
|
666
|
+
* Unified reasoning trace: write annotations or read the ring buffer.
|
|
588
667
|
*
|
|
668
|
+
* Write: `graph.trace("path", "reason")` — attaches a reasoning annotation
|
|
669
|
+
* to a node, capturing *why* an AI agent set a value.
|
|
589
670
|
* No-op when {@link Graph.inspectorEnabled} is `false`.
|
|
590
671
|
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
593
|
-
*/
|
|
594
|
-
annotate(path: string, reason: string): void;
|
|
595
|
-
/**
|
|
596
|
-
* Returns a chronological log of all reasoning annotations (ring buffer).
|
|
597
|
-
*
|
|
598
|
-
* @returns `[]` when {@link Graph.inspectorEnabled} is `false`.
|
|
672
|
+
* Read: `graph.trace()` — returns a chronological log of all annotations.
|
|
673
|
+
* Returns `[]` when {@link Graph.inspectorEnabled} is `false`.
|
|
599
674
|
*/
|
|
600
|
-
|
|
675
|
+
trace(path: string, reason: string): void;
|
|
676
|
+
trace(): readonly TraceEntry[];
|
|
601
677
|
/**
|
|
602
678
|
* Computes structural + value diff between two {@link Graph.describe} snapshots.
|
|
603
679
|
*
|
|
@@ -671,4 +747,4 @@ type ReachableOptions = {
|
|
|
671
747
|
*/
|
|
672
748
|
declare function reachable(described: GraphDescribeOutput, from: string, direction: ReachableDirection, options?: ReachableOptions): string[];
|
|
673
749
|
|
|
674
|
-
export { type AutoCheckpointAdapter as A,
|
|
750
|
+
export { type AutoCheckpointAdapter as A, graphProfile as B, reachable as C, type DescribeFilter as D, Graph as G, type NodeProfile as N, type ObserveDetail as O, type ReachableDirection as R, type TraceEntry as T, type GraphOptions as a, type GraphAutoCheckpointHandle as b, type GraphAutoCheckpointOptions as c, type GraphProfileResult as d, type GraphProfileOptions as e, GRAPH_META_SEGMENT as f, type GraphActorOptions as g, type GraphCheckpointRecord as h, type GraphDescribeOptions as i, type GraphDescribeOutput as j, type GraphDiagramDirection as k, type GraphDiagramOptions as l, type GraphDiffChange as m, type GraphDiffResult as n, type GraphDumpOptions as o, type GraphFactoryContext as p, type GraphNodeFactory as q, type GraphObserveAll as r, type GraphObserveOne as s, type GraphPersistSnapshot as t, type ObserveEvent as u, type ObserveOptions as v, type ObserveResult as w, type ObserveTheme as x, type ObserveThemeName as y, type ReachableOptions as z };
|
|
@@ -1,4 +1,67 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as DescribeNodeOutput, g as DescribeDetail, h as DescribeField, N as Node, y as VersioningLevel, A as Actor, l as Messages, o as NodeSink } from './meta-BnG7XAaE.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Graph profiling and inspection utilities.
|
|
5
|
+
*
|
|
6
|
+
* Provides per-node memory estimation, connectivity stats, and hotspot
|
|
7
|
+
* detection. Non-invasive — reads from `describe()` and node internals
|
|
8
|
+
* without modifying state.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Per-node profile entry. */
|
|
14
|
+
interface NodeProfile {
|
|
15
|
+
/** Qualified path within the graph. */
|
|
16
|
+
path: string;
|
|
17
|
+
/** Node type (state, derived, producer, effect). */
|
|
18
|
+
type: string;
|
|
19
|
+
/** Node status (disconnected, dirty, settled, errored, completed). */
|
|
20
|
+
status: string;
|
|
21
|
+
/** Approximate retained bytes for the node's cached value. */
|
|
22
|
+
valueSizeBytes: number;
|
|
23
|
+
/** Number of downstream subscribers (sinks). */
|
|
24
|
+
subscriberCount: number;
|
|
25
|
+
/** Number of upstream dependencies. */
|
|
26
|
+
depCount: number;
|
|
27
|
+
/** True if this is an effect node with no external subscribers (potential leak). */
|
|
28
|
+
isOrphanEffect: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Aggregate graph profile. */
|
|
31
|
+
interface GraphProfileResult {
|
|
32
|
+
/** Total node count. */
|
|
33
|
+
nodeCount: number;
|
|
34
|
+
/** Total edge count. */
|
|
35
|
+
edgeCount: number;
|
|
36
|
+
/** Subgraph count. */
|
|
37
|
+
subgraphCount: number;
|
|
38
|
+
/** All node profiles. */
|
|
39
|
+
nodes: NodeProfile[];
|
|
40
|
+
/** Total approximate value memory across all nodes. */
|
|
41
|
+
totalValueSizeBytes: number;
|
|
42
|
+
/** Nodes sorted by valueSizeBytes descending (top N). */
|
|
43
|
+
hotspots: NodeProfile[];
|
|
44
|
+
/** Effect nodes with no external subscribers (potential leaks). */
|
|
45
|
+
orphanEffects: NodeProfile[];
|
|
46
|
+
}
|
|
47
|
+
/** Options for {@link graphProfile}. */
|
|
48
|
+
interface GraphProfileOptions {
|
|
49
|
+
/** Limit hotspot list (default 10). */
|
|
50
|
+
topN?: number;
|
|
51
|
+
/** Include subgraph nodes recursively (default true). */
|
|
52
|
+
recursive?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Profile a graph's memory and connectivity characteristics.
|
|
56
|
+
*
|
|
57
|
+
* Uses `describe({ detail: "standard" })` for node metadata and direct
|
|
58
|
+
* `NodeImpl` access for subscriber counts and cached values.
|
|
59
|
+
*
|
|
60
|
+
* @param graph - The graph to profile.
|
|
61
|
+
* @param opts - Optional configuration.
|
|
62
|
+
* @returns Aggregate profile with per-node details and hotspots.
|
|
63
|
+
*/
|
|
64
|
+
declare function graphProfile(graph: Graph, opts?: GraphProfileOptions): GraphProfileResult;
|
|
2
65
|
|
|
3
66
|
/**
|
|
4
67
|
* Reserved segment for meta companion paths: `nodeName::__meta__::metaKey` (GRAPHREFLY-SPEC §3.6).
|
|
@@ -165,6 +228,19 @@ type ObserveOptions = {
|
|
|
165
228
|
* `"minimal"` filters to DATA-only events.
|
|
166
229
|
*/
|
|
167
230
|
detail?: ObserveDetail;
|
|
231
|
+
/**
|
|
232
|
+
* When set, auto-enables structured mode and attaches a logger.
|
|
233
|
+
* `"pretty"` renders colored one-line output; `"json"` emits one JSON object per event.
|
|
234
|
+
*/
|
|
235
|
+
format?: "pretty" | "json";
|
|
236
|
+
/** Sink for rendered lines (`console.log` by default). Only used when `format` is set. */
|
|
237
|
+
logger?: (line: string, event: ObserveEvent) => void;
|
|
238
|
+
/** Keep only these event types in formatted output. Only used when `format` is set. */
|
|
239
|
+
includeTypes?: ObserveEvent["type"][];
|
|
240
|
+
/** Exclude these event types from formatted output. Only used when `format` is set. */
|
|
241
|
+
excludeTypes?: ObserveEvent["type"][];
|
|
242
|
+
/** Built-in color preset (`ansi` default) or explicit color tokens. Only used when `format` is set. */
|
|
243
|
+
theme?: ObserveThemeName | ObserveTheme;
|
|
168
244
|
};
|
|
169
245
|
/** Accumulated observation result (structured mode). */
|
|
170
246
|
type ObserveResult<T = unknown> = {
|
|
@@ -176,10 +252,12 @@ type ObserveResult<T = unknown> = {
|
|
|
176
252
|
readonly resolvedCount: number;
|
|
177
253
|
/** All events in order. */
|
|
178
254
|
readonly events: ObserveEvent[];
|
|
179
|
-
/** True if COMPLETE
|
|
180
|
-
readonly
|
|
181
|
-
/** True if ERROR
|
|
182
|
-
readonly
|
|
255
|
+
/** True if any observed node sent COMPLETE without prior ERROR on that node. */
|
|
256
|
+
readonly anyCompletedCleanly: boolean;
|
|
257
|
+
/** True if any observed node sent ERROR. */
|
|
258
|
+
readonly anyErrored: boolean;
|
|
259
|
+
/** True if at least one COMPLETE received and no ERROR from any observed node. */
|
|
260
|
+
readonly completedWithoutErrors: boolean;
|
|
183
261
|
/** Stop observing. */
|
|
184
262
|
dispose(): void;
|
|
185
263
|
/**
|
|
@@ -195,6 +273,8 @@ type ObserveEvent = {
|
|
|
195
273
|
data?: unknown;
|
|
196
274
|
timestamp_ns?: number;
|
|
197
275
|
in_batch?: boolean;
|
|
276
|
+
/** Monotonically increasing counter per subscribe-callback invocation. All events in one delivery share the same id. */
|
|
277
|
+
batch_id?: number;
|
|
198
278
|
trigger_dep_index?: number;
|
|
199
279
|
trigger_dep_name?: string;
|
|
200
280
|
/**
|
|
@@ -208,30 +288,10 @@ type ObserveEvent = {
|
|
|
208
288
|
};
|
|
209
289
|
dep_values?: unknown[];
|
|
210
290
|
};
|
|
211
|
-
/** Built-in color
|
|
212
|
-
type
|
|
213
|
-
/** ANSI/style overrides for
|
|
214
|
-
type
|
|
215
|
-
/** Options for {@link Graph.spy}. */
|
|
216
|
-
type GraphSpyOptions = ObserveOptions & {
|
|
217
|
-
/** Observe one path; omit for graph-wide mode. */
|
|
218
|
-
path?: string;
|
|
219
|
-
/** Keep only these event types in spy output. */
|
|
220
|
-
includeTypes?: ObserveEvent["type"][];
|
|
221
|
-
/** Exclude these event types from spy output. */
|
|
222
|
-
excludeTypes?: ObserveEvent["type"][];
|
|
223
|
-
/** Built-in color preset (`ansi` default) or explicit color tokens. */
|
|
224
|
-
theme?: GraphSpyThemeName | GraphSpyTheme;
|
|
225
|
-
/** One-line `pretty` output (default) or JSON-per-event. */
|
|
226
|
-
format?: "pretty" | "json";
|
|
227
|
-
/** Optional sink for rendered lines (`console.log` by default). */
|
|
228
|
-
logger?: (line: string, event: ObserveEvent) => void;
|
|
229
|
-
};
|
|
230
|
-
/** Handle returned by {@link Graph.spy}. */
|
|
231
|
-
type GraphSpyHandle = {
|
|
232
|
-
readonly result: ObserveResult;
|
|
233
|
-
dispose(): void;
|
|
234
|
-
};
|
|
291
|
+
/** Built-in color preset names for observe `format` rendering. */
|
|
292
|
+
type ObserveThemeName = "none" | "ansi";
|
|
293
|
+
/** ANSI/style overrides for observe `format` event rendering. */
|
|
294
|
+
type ObserveTheme = Partial<Record<ObserveEvent["type"] | "path" | "reset", string>>;
|
|
235
295
|
/** Options for {@link Graph.dumpGraph}. */
|
|
236
296
|
type GraphDumpOptions = {
|
|
237
297
|
actor?: Actor;
|
|
@@ -432,6 +492,14 @@ declare class Graph {
|
|
|
432
492
|
describe(options?: GraphDescribeOptions): GraphDescribeOutput;
|
|
433
493
|
private _collectSubgraphs;
|
|
434
494
|
private _collectAllEdges;
|
|
495
|
+
/**
|
|
496
|
+
* Snapshot-based resource profile: per-node stats, orphan effect detection,
|
|
497
|
+
* memory hotspots. Zero runtime overhead — walks nodes on demand.
|
|
498
|
+
*
|
|
499
|
+
* @param opts - Optional `topN` for hotspot limit (default 10).
|
|
500
|
+
* @returns Aggregate profile with per-node details, hotspots, and orphan effects.
|
|
501
|
+
*/
|
|
502
|
+
resourceProfile(opts?: GraphProfileOptions): GraphProfileResult;
|
|
435
503
|
private _qualifyEdgeEndpoint;
|
|
436
504
|
private _collectObserveTargets;
|
|
437
505
|
private _appendMetaObserveTargets;
|
|
@@ -453,6 +521,9 @@ declare class Graph {
|
|
|
453
521
|
causal?: true;
|
|
454
522
|
derived?: true;
|
|
455
523
|
}): ObserveResult;
|
|
524
|
+
observe(path: string, options: ObserveOptions & {
|
|
525
|
+
format: "pretty" | "json";
|
|
526
|
+
}): ObserveResult;
|
|
456
527
|
observe(path: string, options?: ObserveOptions): GraphObserveOne;
|
|
457
528
|
observe(options: ObserveOptions & {
|
|
458
529
|
structured?: true;
|
|
@@ -460,19 +531,26 @@ declare class Graph {
|
|
|
460
531
|
causal?: true;
|
|
461
532
|
derived?: true;
|
|
462
533
|
}): ObserveResult;
|
|
534
|
+
observe(options: ObserveOptions & {
|
|
535
|
+
format: "pretty" | "json";
|
|
536
|
+
}): ObserveResult;
|
|
463
537
|
observe(options?: ObserveOptions): GraphObserveAll;
|
|
464
538
|
private _createObserveResult;
|
|
465
539
|
private _createObserveResultForAll;
|
|
466
540
|
/**
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
*
|
|
473
|
-
* @returns Disposable handle plus a structured observation accumulator.
|
|
541
|
+
* Fallback ObserveResult for single-node when inspector is disabled but `format` is requested.
|
|
542
|
+
* Subscribes to raw messages and accumulates events with timeline info.
|
|
543
|
+
*/
|
|
544
|
+
private _createFallbackObserveResult;
|
|
545
|
+
/**
|
|
546
|
+
* Fallback ObserveResult for graph-wide when inspector is disabled but `format` is requested.
|
|
474
547
|
*/
|
|
475
|
-
|
|
548
|
+
private _createFallbackObserveResultForAll;
|
|
549
|
+
/**
|
|
550
|
+
* Attaches a format logger to an ObserveResult, rendering events as they arrive.
|
|
551
|
+
* Wraps the result's dispose to flush pending events.
|
|
552
|
+
*/
|
|
553
|
+
private _attachFormatLogger;
|
|
476
554
|
/**
|
|
477
555
|
* CLI/debug-friendly graph dump built on {@link Graph.describe}.
|
|
478
556
|
*
|
|
@@ -552,8 +630,9 @@ declare class Graph {
|
|
|
552
630
|
/**
|
|
553
631
|
* Debounced persistence wired to graph-wide observe stream (spec §3.8 auto-checkpoint).
|
|
554
632
|
*
|
|
555
|
-
* Checkpoint trigger uses {@link messageTier}: only batches containing tier >=
|
|
556
|
-
* schedule a save (`DATA`/`RESOLVED`/terminal/destruction), never pure tier-0/1 control
|
|
633
|
+
* Checkpoint trigger uses {@link messageTier}: only batches containing tier >= 3 messages
|
|
634
|
+
* schedule a save (`DATA`/`RESOLVED`/terminal/destruction), never pure tier-0/1/2 control
|
|
635
|
+
* waves (`START`/`DIRTY`/`INVALIDATE`/`PAUSE`/`RESUME`).
|
|
557
636
|
*/
|
|
558
637
|
autoCheckpoint(adapter: AutoCheckpointAdapter, options?: GraphAutoCheckpointOptions): GraphAutoCheckpointHandle;
|
|
559
638
|
/**
|
|
@@ -576,7 +655,7 @@ declare class Graph {
|
|
|
576
655
|
toD2(options?: GraphDiagramOptions): string;
|
|
577
656
|
/**
|
|
578
657
|
* When `false`, structured observation options (`causal`, `timeline`),
|
|
579
|
-
*
|
|
658
|
+
* and `trace()` writes are no-ops. Raw `observe()` always works.
|
|
580
659
|
*
|
|
581
660
|
* Default: `true` outside production (`process.env.NODE_ENV !== "production"`).
|
|
582
661
|
*/
|
|
@@ -584,20 +663,17 @@ declare class Graph {
|
|
|
584
663
|
private _annotations;
|
|
585
664
|
private _traceRing;
|
|
586
665
|
/**
|
|
587
|
-
*
|
|
666
|
+
* Unified reasoning trace: write annotations or read the ring buffer.
|
|
588
667
|
*
|
|
668
|
+
* Write: `graph.trace("path", "reason")` — attaches a reasoning annotation
|
|
669
|
+
* to a node, capturing *why* an AI agent set a value.
|
|
589
670
|
* No-op when {@link Graph.inspectorEnabled} is `false`.
|
|
590
671
|
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
593
|
-
*/
|
|
594
|
-
annotate(path: string, reason: string): void;
|
|
595
|
-
/**
|
|
596
|
-
* Returns a chronological log of all reasoning annotations (ring buffer).
|
|
597
|
-
*
|
|
598
|
-
* @returns `[]` when {@link Graph.inspectorEnabled} is `false`.
|
|
672
|
+
* Read: `graph.trace()` — returns a chronological log of all annotations.
|
|
673
|
+
* Returns `[]` when {@link Graph.inspectorEnabled} is `false`.
|
|
599
674
|
*/
|
|
600
|
-
|
|
675
|
+
trace(path: string, reason: string): void;
|
|
676
|
+
trace(): readonly TraceEntry[];
|
|
601
677
|
/**
|
|
602
678
|
* Computes structural + value diff between two {@link Graph.describe} snapshots.
|
|
603
679
|
*
|
|
@@ -671,4 +747,4 @@ type ReachableOptions = {
|
|
|
671
747
|
*/
|
|
672
748
|
declare function reachable(described: GraphDescribeOutput, from: string, direction: ReachableDirection, options?: ReachableOptions): string[];
|
|
673
749
|
|
|
674
|
-
export { type AutoCheckpointAdapter as A,
|
|
750
|
+
export { type AutoCheckpointAdapter as A, graphProfile as B, reachable as C, type DescribeFilter as D, Graph as G, type NodeProfile as N, type ObserveDetail as O, type ReachableDirection as R, type TraceEntry as T, type GraphOptions as a, type GraphAutoCheckpointHandle as b, type GraphAutoCheckpointOptions as c, type GraphProfileResult as d, type GraphProfileOptions as e, GRAPH_META_SEGMENT as f, type GraphActorOptions as g, type GraphCheckpointRecord as h, type GraphDescribeOptions as i, type GraphDescribeOutput as j, type GraphDiagramDirection as k, type GraphDiagramOptions as l, type GraphDiffChange as m, type GraphDiffResult as n, type GraphDumpOptions as o, type GraphFactoryContext as p, type GraphNodeFactory as q, type GraphObserveAll as r, type GraphObserveOne as s, type GraphPersistSnapshot as t, type ObserveEvent as u, type ObserveOptions as v, type ObserveResult as w, type ObserveTheme as x, type ObserveThemeName as y, type ReachableOptions as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as Node } from './meta-
|
|
2
|
-
import { G as Graph } from './graph-
|
|
1
|
+
import { N as Node } from './meta-BnG7XAaE.js';
|
|
2
|
+
import { G as Graph } from './graph-mILUUqW8.js';
|
|
3
3
|
|
|
4
4
|
/** Pluggable measurement backend. */
|
|
5
5
|
interface MeasurementAdapter {
|