@graphrefly/graphrefly 0.6.0 → 0.8.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.
Files changed (75) hide show
  1. package/README.md +30 -14
  2. package/dist/{chunk-HP7OKEOE.js → chunk-A2AJJOSJ.js} +3 -3
  3. package/dist/chunk-A2AJJOSJ.js.map +1 -0
  4. package/dist/{chunk-CP6MNKAA.js → chunk-E7OH6ZAZ.js} +10 -4
  5. package/dist/{chunk-CP6MNKAA.js.map → chunk-E7OH6ZAZ.js.map} +1 -1
  6. package/dist/chunk-LR2CLSEF.js +106 -0
  7. package/dist/chunk-LR2CLSEF.js.map +1 -0
  8. package/dist/{chunk-5X3LAO3B.js → chunk-QTZSBQGJ.js} +79 -20
  9. package/dist/chunk-QTZSBQGJ.js.map +1 -0
  10. package/dist/{chunk-V3UACY6A.js → chunk-TZLX4KIT.js} +790 -203
  11. package/dist/chunk-TZLX4KIT.js.map +1 -0
  12. package/dist/{chunk-QW7H3ICI.js → chunk-UCW3VWMN.js} +4 -4
  13. package/dist/{chunk-6W5SGIGB.js → chunk-WYI7YW54.js} +142 -30
  14. package/dist/chunk-WYI7YW54.js.map +1 -0
  15. package/dist/chunk-WZ2Z2CRV.js +32 -0
  16. package/dist/chunk-WZ2Z2CRV.js.map +1 -0
  17. package/dist/{chunk-Z4Y4FMQN.js → chunk-XCZPGOVP.js} +7 -7
  18. package/dist/{chunk-KWXPDASV.js → chunk-YWTP2XRJ.js} +2 -2
  19. package/dist/compat/nestjs/index.cjs +268 -61
  20. package/dist/compat/nestjs/index.cjs.map +1 -1
  21. package/dist/compat/nestjs/index.d.cts +4 -4
  22. package/dist/compat/nestjs/index.d.ts +4 -4
  23. package/dist/compat/nestjs/index.js +8 -7
  24. package/dist/core/index.cjs +163 -35
  25. package/dist/core/index.cjs.map +1 -1
  26. package/dist/core/index.d.cts +2 -2
  27. package/dist/core/index.d.ts +2 -2
  28. package/dist/core/index.js +10 -4
  29. package/dist/extra/index.cjs +892 -221
  30. package/dist/extra/index.cjs.map +1 -1
  31. package/dist/extra/index.d.cts +4 -4
  32. package/dist/extra/index.d.ts +4 -4
  33. package/dist/extra/index.js +22 -3
  34. package/dist/graph/index.cjs +268 -61
  35. package/dist/graph/index.cjs.map +1 -1
  36. package/dist/graph/index.d.cts +3 -3
  37. package/dist/graph/index.d.ts +3 -3
  38. package/dist/graph/index.js +4 -4
  39. package/dist/{graph-CL_ZDAj9.d.cts → graph-DqTICAY2.d.cts} +69 -12
  40. package/dist/{graph-D18qmsNm.d.ts → graph-X9uwnD_z.d.ts} +69 -12
  41. package/dist/{index-C3BMRmmp.d.cts → index-3U0WxdD-.d.cts} +3 -3
  42. package/dist/{index-Bk_idZm1.d.cts → index-BP1t_38S.d.cts} +406 -61
  43. package/dist/{index-BtK55IE2.d.ts → index-BPCeYDS4.d.ts} +4 -2
  44. package/dist/{index-Bvy_6CaN.d.ts → index-BVG5pjin.d.ts} +50 -5
  45. package/dist/{index-C5mqLhMX.d.cts → index-BYEgosAX.d.cts} +50 -5
  46. package/dist/{index-D_geH2Bm.d.cts → index-BYa2YMat.d.cts} +3 -3
  47. package/dist/{index-CP_QvbWu.d.ts → index-DLO8wnYU.d.ts} +3 -3
  48. package/dist/{index-B7eOdgEx.d.ts → index-DMv1Etbi.d.ts} +3 -3
  49. package/dist/{index-BvhgZRHK.d.cts → index-DbwgQ4Cw.d.cts} +4 -2
  50. package/dist/{index-B2jmzVxL.d.ts → index-a5gHmH5b.d.ts} +406 -61
  51. package/dist/index.cjs +2966 -1790
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +112 -14
  54. package/dist/index.d.ts +112 -14
  55. package/dist/index.js +385 -20
  56. package/dist/index.js.map +1 -1
  57. package/dist/{meta-BsF6Sag9.d.cts → meta-BJEU8fYz.d.cts} +31 -4
  58. package/dist/{meta-BsF6Sag9.d.ts → meta-BJEU8fYz.d.ts} +31 -4
  59. package/dist/patterns/reactive-layout/index.cjs +268 -61
  60. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  61. package/dist/patterns/reactive-layout/index.d.cts +3 -3
  62. package/dist/patterns/reactive-layout/index.d.ts +3 -3
  63. package/dist/patterns/reactive-layout/index.js +4 -4
  64. package/dist/{reactive-log-BfvfNWQh.d.cts → reactive-log-BfX6bOSZ.d.cts} +2 -2
  65. package/dist/{reactive-log-ohLmTXoZ.d.ts → reactive-log-RhgIog2Z.d.ts} +2 -2
  66. package/package.json +29 -18
  67. package/dist/chunk-5X3LAO3B.js.map +0 -1
  68. package/dist/chunk-6W5SGIGB.js.map +0 -1
  69. package/dist/chunk-HP7OKEOE.js.map +0 -1
  70. package/dist/chunk-O3PI7W45.js +0 -68
  71. package/dist/chunk-O3PI7W45.js.map +0 -1
  72. package/dist/chunk-V3UACY6A.js.map +0 -1
  73. /package/dist/{chunk-QW7H3ICI.js.map → chunk-UCW3VWMN.js.map} +0 -0
  74. /package/dist/{chunk-Z4Y4FMQN.js.map → chunk-XCZPGOVP.js.map} +0 -0
  75. /package/dist/{chunk-KWXPDASV.js.map → chunk-YWTP2XRJ.js.map} +0 -0
package/dist/index.js CHANGED
@@ -6,10 +6,13 @@ import {
6
6
  NS_PER_MS,
7
7
  NS_PER_SEC,
8
8
  SqliteCheckpointAdapter,
9
+ TimeoutError,
9
10
  audit,
10
11
  buffer,
11
12
  bufferCount,
12
13
  bufferTime,
14
+ cache,
15
+ cascadingCache,
13
16
  catchError,
14
17
  checkpointNodeValue,
15
18
  checkpointToRedis,
@@ -32,6 +35,7 @@ import {
32
35
  exhaustMap,
33
36
  exponential,
34
37
  extra_exports,
38
+ fallback,
35
39
  fibonacci,
36
40
  filter,
37
41
  find,
@@ -39,15 +43,18 @@ import {
39
43
  flatMap,
40
44
  fromCSV,
41
45
  fromClickHouseWatch,
46
+ fromDrizzle,
42
47
  fromGitHook,
43
48
  fromHTTP,
44
49
  fromIDBRequest,
45
50
  fromIDBTransaction,
46
51
  fromKafka,
52
+ fromKysely,
47
53
  fromMCP,
48
54
  fromNATS,
49
55
  fromNDJSON,
50
56
  fromOTel,
57
+ fromPrisma,
51
58
  fromPrometheus,
52
59
  fromPulsar,
53
60
  fromRabbitMQ,
@@ -61,6 +68,7 @@ import {
61
68
  interval,
62
69
  last,
63
70
  linear,
71
+ lru,
64
72
  map,
65
73
  merge,
66
74
  mergeMap,
@@ -98,6 +106,7 @@ import {
98
106
  tap,
99
107
  throttle,
100
108
  throttleTime,
109
+ tieredStorage,
101
110
  timeout,
102
111
  toCSV,
103
112
  toClickHouse,
@@ -128,14 +137,14 @@ import {
128
137
  workerBridge,
129
138
  workerSelf,
130
139
  zip
131
- } from "./chunk-V3UACY6A.js";
140
+ } from "./chunk-TZLX4KIT.js";
132
141
  import {
133
142
  cqrs_exports,
134
143
  nestjs_exports
135
- } from "./chunk-QW7H3ICI.js";
144
+ } from "./chunk-UCW3VWMN.js";
136
145
  import {
137
146
  core_exports
138
- } from "./chunk-CP6MNKAA.js";
147
+ } from "./chunk-E7OH6ZAZ.js";
139
148
  import {
140
149
  JsonCodec,
141
150
  createDagCborCodec,
@@ -143,7 +152,7 @@ import {
143
152
  graph_exports,
144
153
  negotiateCodec,
145
154
  replayWAL
146
- } from "./chunk-HP7OKEOE.js";
155
+ } from "./chunk-A2AJJOSJ.js";
147
156
  import {
148
157
  cached,
149
158
  createWatermarkController,
@@ -176,19 +185,25 @@ import {
176
185
  toArray,
177
186
  toMessages$,
178
187
  toObservable
179
- } from "./chunk-KWXPDASV.js";
188
+ } from "./chunk-YWTP2XRJ.js";
180
189
  import {
190
+ ResettableTimer
191
+ } from "./chunk-WZ2Z2CRV.js";
192
+ import {
193
+ analyzeAndMeasure,
194
+ computeLineBreaks,
181
195
  reactive_layout_exports
182
- } from "./chunk-Z4Y4FMQN.js";
196
+ } from "./chunk-XCZPGOVP.js";
183
197
  import {
184
198
  GRAPH_META_SEGMENT,
185
199
  Graph,
186
200
  reachable
187
- } from "./chunk-6W5SGIGB.js";
201
+ } from "./chunk-WYI7YW54.js";
188
202
  import {
189
203
  describeNode,
190
- metaSnapshot
191
- } from "./chunk-O3PI7W45.js";
204
+ metaSnapshot,
205
+ resolveDescribeFields
206
+ } from "./chunk-LR2CLSEF.js";
192
207
  import {
193
208
  COMPLETE,
194
209
  DATA,
@@ -230,7 +245,7 @@ import {
230
245
  propagatesToMeta,
231
246
  state,
232
247
  wallClockNs
233
- } from "./chunk-5X3LAO3B.js";
248
+ } from "./chunk-QTZSBQGJ.js";
234
249
 
235
250
  // src/compat/index.ts
236
251
  var compat_exports = {};
@@ -1029,6 +1044,7 @@ var patterns_exports = {};
1029
1044
  __export(patterns_exports, {
1030
1045
  ai: () => ai_exports,
1031
1046
  cqrs: () => cqrs_exports,
1047
+ demoShell: () => demo_shell_exports,
1032
1048
  layout: () => reactive_layout_exports,
1033
1049
  memory: () => memory_exports,
1034
1050
  messaging: () => messaging_exports,
@@ -2349,7 +2365,7 @@ function metaToJsonSchema(meta) {
2349
2365
  return schema;
2350
2366
  }
2351
2367
  function knobsAsTools(graph, actor) {
2352
- const described = graph.describe({ actor });
2368
+ const described = graph.describe({ actor, detail: "full" });
2353
2369
  const openai = [];
2354
2370
  const mcp = [];
2355
2371
  const definitions = [];
@@ -2357,10 +2373,11 @@ function knobsAsTools(graph, actor) {
2357
2373
  if (node2.type !== "state") continue;
2358
2374
  if (path.includes("::__meta__::")) continue;
2359
2375
  if (node2.status === "completed" || node2.status === "errored") continue;
2360
- const access = node2.meta.access;
2376
+ const meta = node2.meta ?? {};
2377
+ const access = meta.access;
2361
2378
  if (access === "human" || access === "system") continue;
2362
- const description = node2.meta.description ?? `Set the value of ${path}`;
2363
- const valueSchema = metaToJsonSchema(node2.meta);
2379
+ const description = meta.description ?? `Set the value of ${path}`;
2380
+ const valueSchema = metaToJsonSchema(meta);
2364
2381
  const parameterSchema = {
2365
2382
  type: "object",
2366
2383
  required: ["value"],
@@ -2400,14 +2417,15 @@ function knobsAsTools(graph, actor) {
2400
2417
  return { openai, mcp, definitions };
2401
2418
  }
2402
2419
  function gaugesAsContext(graph, actor, options) {
2403
- const described = graph.describe({ actor });
2420
+ const described = graph.describe({ actor, detail: "full" });
2404
2421
  const groupByTags = options?.groupByTags ?? true;
2405
2422
  const separator = options?.separator ?? "\n";
2406
2423
  const entries = [];
2407
2424
  const sinceVersion = options?.sinceVersion;
2408
2425
  for (const [path, node2] of Object.entries(described.nodes)) {
2409
- const desc = node2.meta.description;
2410
- const format = node2.meta.format;
2426
+ const meta = node2.meta ?? {};
2427
+ const desc = meta.description;
2428
+ const format = meta.format;
2411
2429
  if (!desc && !format) continue;
2412
2430
  if (sinceVersion != null && node2.v != null) {
2413
2431
  const lastSeen = sinceVersion.get(path);
@@ -2416,7 +2434,7 @@ function gaugesAsContext(graph, actor, options) {
2416
2434
  }
2417
2435
  const label = desc ?? path;
2418
2436
  const value = node2.value;
2419
- const unit = node2.meta.unit;
2437
+ const unit = meta.unit;
2420
2438
  let formatted;
2421
2439
  if (format === "currency" && typeof value === "number") {
2422
2440
  formatted = `$${value.toFixed(2)}`;
@@ -2438,7 +2456,7 @@ function gaugesAsContext(graph, actor, options) {
2438
2456
  const ungrouped = [];
2439
2457
  for (const entry of entries) {
2440
2458
  const node2 = described.nodes[entry.path];
2441
- const tags = node2.meta.tags;
2459
+ const tags = (node2.meta ?? {}).tags;
2442
2460
  if (tags && tags.length > 0) {
2443
2461
  const tag = tags[0];
2444
2462
  let group = tagGroups.get(tag);
@@ -2626,7 +2644,7 @@ Rules:
2626
2644
  - Keep changes minimal \u2014 prefer the smallest set of operations that solves the problem.
2627
2645
  - Return ONLY valid JSON, no markdown fences or commentary.`;
2628
2646
  async function suggestStrategy(graph, problem, adapter, opts) {
2629
- const described = graph.describe({ actor: opts?.actor });
2647
+ const { expand: _, ...described } = graph.describe({ actor: opts?.actor, detail: "standard" });
2630
2648
  const messages = [
2631
2649
  { role: "system", content: SUGGEST_STRATEGY_SYSTEM_PROMPT },
2632
2650
  {
@@ -2670,6 +2688,341 @@ async function suggestStrategy(graph, problem, adapter, opts) {
2670
2688
  };
2671
2689
  }
2672
2690
 
2691
+ // src/patterns/demo-shell.ts
2692
+ var demo_shell_exports = {};
2693
+ __export(demo_shell_exports, {
2694
+ demoShell: () => demoShell
2695
+ });
2696
+ function clamp01(v) {
2697
+ return Math.max(0, Math.min(1, v));
2698
+ }
2699
+ function demoShell(opts) {
2700
+ const mainRatioInit = clamp01(opts?.mainRatio ?? 0.65);
2701
+ const sideSplitInit = clamp01(opts?.sideSplit ?? 0.5);
2702
+ const viewportInit = Math.max(0, opts?.viewportWidth ?? 1280);
2703
+ const registry = opts?.nodeRegistry ?? /* @__PURE__ */ new Map();
2704
+ const adapter = opts?.adapter ?? null;
2705
+ const layoutFont = opts?.layoutFont ?? "14px monospace";
2706
+ const onHighlight = opts?.onHighlight;
2707
+ const g = new Graph("demo-shell");
2708
+ const paneMainRatio = state(mainRatioInit, { name: "pane/main-ratio" });
2709
+ const paneSideSplit = state(sideSplitInit, { name: "pane/side-split" });
2710
+ const paneFullscreen = state(null, {
2711
+ name: "pane/fullscreen"
2712
+ });
2713
+ const viewportWidth = state(viewportInit, { name: "viewport/width" });
2714
+ g.add("pane/main-ratio", paneMainRatio);
2715
+ g.add("pane/side-split", paneSideSplit);
2716
+ g.add("pane/fullscreen", paneFullscreen);
2717
+ g.add("viewport/width", viewportWidth);
2718
+ const paneMainWidth = derived(
2719
+ [paneMainRatio, viewportWidth, paneFullscreen],
2720
+ ([ratio, vw, fs]) => {
2721
+ const r = ratio;
2722
+ const w = vw;
2723
+ const fullscreen = fs;
2724
+ if (fullscreen === "main") return w;
2725
+ if (fullscreen === "graph" || fullscreen === "code") return 0;
2726
+ return Math.round(w * r);
2727
+ },
2728
+ { name: "pane/main-width" }
2729
+ );
2730
+ const paneSideWidth = derived(
2731
+ [paneMainWidth, viewportWidth, paneFullscreen],
2732
+ ([main, vw, fs]) => {
2733
+ const fullscreen = fs;
2734
+ const w = vw;
2735
+ if (fullscreen === "main") return 0;
2736
+ if (fullscreen === "graph" || fullscreen === "code") return w;
2737
+ return w - main;
2738
+ },
2739
+ { name: "pane/side-width" }
2740
+ );
2741
+ const paneGraphHeight = derived(
2742
+ [paneSideSplit, paneFullscreen],
2743
+ ([split, fs]) => {
2744
+ const fullscreen = fs;
2745
+ if (fullscreen === "graph") return 1;
2746
+ if (fullscreen === "code") return 0;
2747
+ if (fullscreen === "main") return 0;
2748
+ return clamp01(split);
2749
+ },
2750
+ { name: "pane/graph-height-ratio" }
2751
+ );
2752
+ const paneCodeHeight = derived(
2753
+ [paneGraphHeight, paneFullscreen],
2754
+ ([graphH, fs]) => {
2755
+ const fullscreen = fs;
2756
+ if (fullscreen === "code") return 1;
2757
+ if (fullscreen === "graph" || fullscreen === "main") return 0;
2758
+ return 1 - graphH;
2759
+ },
2760
+ { name: "pane/code-height-ratio" }
2761
+ );
2762
+ g.add("pane/main-width", paneMainWidth);
2763
+ g.add("pane/side-width", paneSideWidth);
2764
+ g.add("pane/graph-height-ratio", paneGraphHeight);
2765
+ g.add("pane/code-height-ratio", paneCodeHeight);
2766
+ const demoGraphRef = state(null, {
2767
+ name: "demo/graph-ref"
2768
+ });
2769
+ const demoGraphTick = state(0, { name: "demo/graph-tick" });
2770
+ g.add("demo/graph-ref", demoGraphRef);
2771
+ g.add("demo/graph-tick", demoGraphTick);
2772
+ const graphMermaid = derived(
2773
+ [demoGraphRef, demoGraphTick],
2774
+ ([ref, _tick]) => {
2775
+ const demo = ref;
2776
+ if (!demo) return "";
2777
+ return demo.toMermaid();
2778
+ },
2779
+ { name: "graph/mermaid" }
2780
+ );
2781
+ const graphDescribe = derived(
2782
+ [demoGraphRef, demoGraphTick],
2783
+ ([ref, _tick]) => {
2784
+ const demo = ref;
2785
+ if (!demo) return null;
2786
+ const { expand: _, ...snapshot } = demo.describe({ detail: "standard" });
2787
+ return snapshot;
2788
+ },
2789
+ { name: "graph/describe" }
2790
+ );
2791
+ g.add("graph/mermaid", graphMermaid);
2792
+ g.add("graph/describe", graphDescribe);
2793
+ const hoverTarget = state(null, { name: "hover/target" });
2794
+ g.add("hover/target", hoverTarget);
2795
+ const highlightCodeScroll = derived(
2796
+ [hoverTarget],
2797
+ ([target]) => {
2798
+ const t = target;
2799
+ if (!t) return null;
2800
+ const entry = registry.get(t.id);
2801
+ return entry ? entry.codeLine : null;
2802
+ },
2803
+ { name: "highlight/code-scroll" }
2804
+ );
2805
+ const highlightVisual = derived(
2806
+ [hoverTarget],
2807
+ ([target]) => {
2808
+ const t = target;
2809
+ if (!t) return null;
2810
+ const entry = registry.get(t.id);
2811
+ return entry ? entry.visualSelector : null;
2812
+ },
2813
+ { name: "highlight/visual" }
2814
+ );
2815
+ const highlightGraph = derived(
2816
+ [hoverTarget],
2817
+ ([target]) => {
2818
+ const t = target;
2819
+ if (!t) return null;
2820
+ return t.id;
2821
+ },
2822
+ { name: "highlight/graph" }
2823
+ );
2824
+ g.add("highlight/code-scroll", highlightCodeScroll);
2825
+ g.add("highlight/visual", highlightVisual);
2826
+ g.add("highlight/graph", highlightGraph);
2827
+ if (onHighlight?.codeScroll) {
2828
+ const cb = onHighlight.codeScroll;
2829
+ const applyCodeScroll = effect([highlightCodeScroll], ([line]) => {
2830
+ cb(line);
2831
+ });
2832
+ g.add("highlight/apply-code-scroll", applyCodeScroll);
2833
+ g.connect("highlight/code-scroll", "highlight/apply-code-scroll");
2834
+ }
2835
+ if (onHighlight?.visual) {
2836
+ const cb = onHighlight.visual;
2837
+ const applyVisual = effect([highlightVisual], ([selector]) => {
2838
+ cb(selector);
2839
+ });
2840
+ g.add("highlight/apply-visual", applyVisual);
2841
+ g.connect("highlight/visual", "highlight/apply-visual");
2842
+ }
2843
+ if (onHighlight?.graph) {
2844
+ const cb = onHighlight.graph;
2845
+ const applyGraph = effect([highlightGraph], ([nodeId]) => {
2846
+ cb(nodeId);
2847
+ });
2848
+ g.add("highlight/apply-graph", applyGraph);
2849
+ g.connect("highlight/graph", "highlight/apply-graph");
2850
+ }
2851
+ const inspectSelected = state(null, {
2852
+ name: "inspect/selected-node"
2853
+ });
2854
+ g.add("inspect/selected-node", inspectSelected);
2855
+ const standardFields = resolveDescribeFields("standard");
2856
+ const inspectNodeDetail = derived(
2857
+ [inspectSelected, demoGraphRef, demoGraphTick],
2858
+ ([path, ref, _tick]) => {
2859
+ const demo = ref;
2860
+ const p = path;
2861
+ if (!demo || !p) return null;
2862
+ try {
2863
+ const nd = demo.resolve(p);
2864
+ const nodeDesc = describeNode(nd, standardFields);
2865
+ return { path: p, ...nodeDesc, value: nd.get() };
2866
+ } catch {
2867
+ return null;
2868
+ }
2869
+ },
2870
+ { name: "inspect/node-detail" }
2871
+ );
2872
+ const inspectTraceLog = derived(
2873
+ [demoGraphRef, demoGraphTick],
2874
+ ([ref, _tick]) => {
2875
+ const demo = ref;
2876
+ if (!demo) return [];
2877
+ return demo.traceLog();
2878
+ },
2879
+ { name: "inspect/trace-log" }
2880
+ );
2881
+ g.add("inspect/node-detail", inspectNodeDetail);
2882
+ g.add("inspect/trace-log", inspectTraceLog);
2883
+ const metaDebug = state(false, { name: "meta/debug" });
2884
+ g.add("meta/debug", metaDebug);
2885
+ const metaShellMermaid = derived(
2886
+ [metaDebug, demoGraphTick],
2887
+ ([debug, _tick]) => {
2888
+ if (!debug) return "";
2889
+ return g.toMermaid();
2890
+ },
2891
+ { name: "meta/shell-mermaid" }
2892
+ );
2893
+ g.add("meta/shell-mermaid", metaShellMermaid);
2894
+ const codeTextNode = state("", { name: "layout/code-text" });
2895
+ g.add("layout/code-text", codeTextNode);
2896
+ if (adapter) {
2897
+ const measureCache = /* @__PURE__ */ new Map();
2898
+ const graphLabels = derived(
2899
+ [graphDescribe],
2900
+ ([desc]) => {
2901
+ const d = desc;
2902
+ if (!d) return /* @__PURE__ */ new Map();
2903
+ const result = /* @__PURE__ */ new Map();
2904
+ for (const [name] of Object.entries(d.nodes)) {
2905
+ const segments = analyzeAndMeasure(name, layoutFont, adapter, measureCache);
2906
+ const lb = computeLineBreaks(segments, Infinity, adapter, layoutFont, measureCache);
2907
+ const width = lb.lines.reduce((max, l) => Math.max(max, l.width), 0);
2908
+ const height = lb.lineCount * 20;
2909
+ result.set(name, { width, height });
2910
+ }
2911
+ return result;
2912
+ },
2913
+ {
2914
+ name: "layout/graph-labels",
2915
+ equals: (a, b) => {
2916
+ if (a === b) return true;
2917
+ const ma = a;
2918
+ const mb = b;
2919
+ if (ma.size !== mb.size) return false;
2920
+ for (const [k, v] of ma) {
2921
+ const bv = mb.get(k);
2922
+ if (!bv || bv.width !== v.width || bv.height !== v.height) return false;
2923
+ }
2924
+ return true;
2925
+ }
2926
+ }
2927
+ );
2928
+ const codeLines = derived(
2929
+ [codeTextNode, paneSideWidth],
2930
+ ([text, sideW]) => {
2931
+ const t = text;
2932
+ if (!t) return { lineCount: 0, lines: [] };
2933
+ const segments = analyzeAndMeasure(t, layoutFont, adapter, measureCache);
2934
+ const maxW = sideW - 40;
2935
+ return computeLineBreaks(segments, Math.max(100, maxW), adapter, layoutFont, measureCache);
2936
+ },
2937
+ { name: "layout/code-lines" }
2938
+ );
2939
+ const sideWidthHint = derived(
2940
+ [graphLabels],
2941
+ ([labels]) => {
2942
+ const m = labels;
2943
+ if (m.size === 0) return 200;
2944
+ let maxW = 0;
2945
+ for (const { width } of m.values()) {
2946
+ if (width > maxW) maxW = width;
2947
+ }
2948
+ return Math.max(200, Math.round(maxW + 80));
2949
+ },
2950
+ { name: "layout/side-width-hint" }
2951
+ );
2952
+ g.add("layout/graph-labels", graphLabels);
2953
+ g.add("layout/code-lines", codeLines);
2954
+ g.add("layout/side-width-hint", sideWidthHint);
2955
+ g.connect("graph/describe", "layout/graph-labels");
2956
+ g.connect("layout/code-text", "layout/code-lines");
2957
+ g.connect("pane/side-width", "layout/code-lines");
2958
+ g.connect("layout/graph-labels", "layout/side-width-hint");
2959
+ }
2960
+ g.connect("pane/main-ratio", "pane/main-width");
2961
+ g.connect("viewport/width", "pane/main-width");
2962
+ g.connect("pane/fullscreen", "pane/main-width");
2963
+ g.connect("pane/main-width", "pane/side-width");
2964
+ g.connect("viewport/width", "pane/side-width");
2965
+ g.connect("pane/fullscreen", "pane/side-width");
2966
+ g.connect("pane/side-split", "pane/graph-height-ratio");
2967
+ g.connect("pane/fullscreen", "pane/graph-height-ratio");
2968
+ g.connect("pane/graph-height-ratio", "pane/code-height-ratio");
2969
+ g.connect("pane/fullscreen", "pane/code-height-ratio");
2970
+ g.connect("demo/graph-ref", "graph/mermaid");
2971
+ g.connect("demo/graph-tick", "graph/mermaid");
2972
+ g.connect("demo/graph-ref", "graph/describe");
2973
+ g.connect("demo/graph-tick", "graph/describe");
2974
+ g.connect("hover/target", "highlight/code-scroll");
2975
+ g.connect("hover/target", "highlight/visual");
2976
+ g.connect("hover/target", "highlight/graph");
2977
+ g.connect("inspect/selected-node", "inspect/node-detail");
2978
+ g.connect("demo/graph-ref", "inspect/node-detail");
2979
+ g.connect("demo/graph-tick", "inspect/node-detail");
2980
+ g.connect("demo/graph-ref", "inspect/trace-log");
2981
+ g.connect("demo/graph-tick", "inspect/trace-log");
2982
+ g.connect("meta/debug", "meta/shell-mermaid");
2983
+ g.connect("demo/graph-tick", "meta/shell-mermaid");
2984
+ let tickCounter = 0;
2985
+ return {
2986
+ graph: g,
2987
+ setMainRatio(ratio) {
2988
+ g.set("pane/main-ratio", clamp01(ratio));
2989
+ },
2990
+ setSideSplit(ratio) {
2991
+ g.set("pane/side-split", clamp01(ratio));
2992
+ },
2993
+ setFullscreen(pane) {
2994
+ g.set("pane/fullscreen", pane);
2995
+ },
2996
+ setViewportWidth(width) {
2997
+ g.set("viewport/width", Math.max(0, width));
2998
+ },
2999
+ setHoverTarget(target) {
3000
+ g.set("hover/target", target);
3001
+ },
3002
+ setDemoGraph(demo) {
3003
+ g.set("demo/graph-ref", demo);
3004
+ },
3005
+ bumpGraphTick() {
3006
+ g.set("demo/graph-tick", ++tickCounter);
3007
+ },
3008
+ selectNode(path) {
3009
+ g.set("inspect/selected-node", path);
3010
+ },
3011
+ setMetaDebug(on) {
3012
+ g.set("meta/debug", on);
3013
+ },
3014
+ setCodeText(text) {
3015
+ g.set("layout/code-text", text);
3016
+ },
3017
+ batch(fn) {
3018
+ batch(fn);
3019
+ },
3020
+ destroy() {
3021
+ g.destroy();
3022
+ }
3023
+ };
3024
+ }
3025
+
2673
3026
  // src/patterns/messaging.ts
2674
3027
  var messaging_exports = {};
2675
3028
  __export(messaging_exports, {
@@ -3472,8 +3825,10 @@ export {
3472
3825
  PAUSE,
3473
3826
  RESOLVED,
3474
3827
  RESUME,
3828
+ ResettableTimer,
3475
3829
  SqliteCheckpointAdapter,
3476
3830
  TEARDOWN,
3831
+ TimeoutError,
3477
3832
  accessHintForGuard,
3478
3833
  advanceVersion,
3479
3834
  ai_exports as ai,
@@ -3482,7 +3837,9 @@ export {
3482
3837
  buffer,
3483
3838
  bufferCount,
3484
3839
  bufferTime,
3840
+ cache,
3485
3841
  cached,
3842
+ cascadingCache,
3486
3843
  catchError,
3487
3844
  checkpointNodeValue,
3488
3845
  checkpointToRedis,
@@ -3506,6 +3863,7 @@ export {
3506
3863
  decorrelatedJitter,
3507
3864
  defaultHash,
3508
3865
  delay,
3866
+ demo_shell_exports as demoShell,
3509
3867
  derived,
3510
3868
  describeNode,
3511
3869
  deserializeError,
@@ -3520,6 +3878,7 @@ export {
3520
3878
  exhaustMap,
3521
3879
  exponential,
3522
3880
  extra_exports as extra,
3881
+ fallback,
3523
3882
  fibonacci,
3524
3883
  filter,
3525
3884
  find,
@@ -3532,6 +3891,7 @@ export {
3532
3891
  fromCSV,
3533
3892
  fromClickHouseWatch,
3534
3893
  fromCron,
3894
+ fromDrizzle,
3535
3895
  fromEvent,
3536
3896
  fromFSWatch,
3537
3897
  fromGitHook,
@@ -3540,10 +3900,12 @@ export {
3540
3900
  fromIDBTransaction,
3541
3901
  fromIter,
3542
3902
  fromKafka,
3903
+ fromKysely,
3543
3904
  fromMCP,
3544
3905
  fromNATS,
3545
3906
  fromNDJSON,
3546
3907
  fromOTel,
3908
+ fromPrisma,
3547
3909
  fromPrometheus,
3548
3910
  fromPromise,
3549
3911
  fromPulsar,
@@ -3570,6 +3932,7 @@ export {
3570
3932
  reactive_layout_exports as layout,
3571
3933
  linear,
3572
3934
  logSlice,
3935
+ lru,
3573
3936
  map,
3574
3937
  matchesAnyPattern,
3575
3938
  matchesCron,
@@ -3619,6 +3982,7 @@ export {
3619
3982
  replayWAL,
3620
3983
  rescue,
3621
3984
  resolveBackoffPreset,
3985
+ resolveDescribeFields,
3622
3986
  restoreGraphCheckpoint,
3623
3987
  restoreGraphCheckpointIndexedDb,
3624
3988
  retry,
@@ -3644,6 +4008,7 @@ export {
3644
4008
  throttle,
3645
4009
  throttleTime,
3646
4010
  throwError,
4011
+ tieredStorage,
3647
4012
  timeout,
3648
4013
  toArray,
3649
4014
  toCSV,