@graphrefly/graphrefly 0.5.0 → 0.7.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/README.md +30 -14
- package/dist/{chunk-5X3LAO3B.js → chunk-3EVXOI5C.js} +50 -5
- package/dist/chunk-3EVXOI5C.js.map +1 -0
- package/dist/chunk-47YJEZUJ.js +106 -0
- package/dist/chunk-47YJEZUJ.js.map +1 -0
- package/dist/{chunk-6W5SGIGB.js → chunk-BLCXEMAD.js} +129 -25
- package/dist/chunk-BLCXEMAD.js.map +1 -0
- package/dist/{chunk-QW7H3ICI.js → chunk-FGLZ5QID.js} +4 -4
- package/dist/{chunk-CP6MNKAA.js → chunk-ISGMZ2T3.js} +10 -4
- package/dist/{chunk-CP6MNKAA.js.map → chunk-ISGMZ2T3.js.map} +1 -1
- package/dist/{chunk-HP7OKEOE.js → chunk-L4J2K2RT.js} +3 -3
- package/dist/chunk-L4J2K2RT.js.map +1 -0
- package/dist/{chunk-ZERWUCGK.js → chunk-ONLYF6GA.js} +866 -206
- package/dist/chunk-ONLYF6GA.js.map +1 -0
- package/dist/{chunk-Z4Y4FMQN.js → chunk-OSR3G3DP.js} +7 -7
- package/dist/{chunk-KWXPDASV.js → chunk-PEBORXRA.js} +2 -2
- package/dist/chunk-WZ2Z2CRV.js +32 -0
- package/dist/chunk-WZ2Z2CRV.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +226 -41
- 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 +8 -7
- package/dist/core/index.cjs +134 -20
- 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 +10 -4
- package/dist/extra/index.cjs +939 -209
- 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 +26 -3
- package/dist/graph/index.cjs +226 -41
- 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 +4 -4
- package/dist/{graph-CL_ZDAj9.d.cts → graph-B3BoJjcb.d.cts} +58 -7
- package/dist/{graph-D18qmsNm.d.ts → graph-CmiUuhaN.d.ts} +58 -7
- package/dist/{index-B7eOdgEx.d.ts → index-Bf2X1YSI.d.ts} +3 -3
- package/dist/{index-BvhgZRHK.d.cts → index-Bl7hJcc3.d.cts} +4 -2
- package/dist/{index-Bvy_6CaN.d.ts → index-BrgtEG-C.d.ts} +47 -4
- package/dist/{index-D_geH2Bm.d.cts → index-BsuKSs4L.d.cts} +3 -3
- package/dist/{index-BtK55IE2.d.ts → index-CsUq2rrK.d.ts} +4 -2
- package/dist/{index-C3BMRmmp.d.cts → index-D0cx-Yht.d.cts} +3 -3
- package/dist/{index-Cz8og7-L.d.cts → index-D1hgSTzr.d.cts} +488 -60
- package/dist/{index-C5mqLhMX.d.cts → index-D8NIq6om.d.cts} +47 -4
- package/dist/{index-CP_QvbWu.d.ts → index-DFFNKYig.d.ts} +3 -3
- package/dist/{index-C3LRU4jB.d.ts → index-Pm68AYPh.d.ts} +488 -60
- package/dist/index.cjs +3005 -1776
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -14
- package/dist/index.d.ts +112 -14
- package/dist/index.js +396 -27
- package/dist/index.js.map +1 -1
- package/dist/{meta-BsF6Sag9.d.cts → meta-BJEU8fYz.d.cts} +31 -4
- package/dist/{meta-BsF6Sag9.d.ts → meta-BJEU8fYz.d.ts} +31 -4
- package/dist/patterns/reactive-layout/index.cjs +226 -41
- 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/dist/{reactive-log-BfvfNWQh.d.cts → reactive-log-CAXzJ7hw.d.cts} +2 -2
- package/dist/{reactive-log-ohLmTXoZ.d.ts → reactive-log-DwNhOe0g.d.ts} +2 -2
- package/package.json +29 -18
- package/dist/chunk-5X3LAO3B.js.map +0 -1
- package/dist/chunk-6W5SGIGB.js.map +0 -1
- package/dist/chunk-HP7OKEOE.js.map +0 -1
- package/dist/chunk-O3PI7W45.js +0 -68
- package/dist/chunk-O3PI7W45.js.map +0 -1
- package/dist/chunk-ZERWUCGK.js.map +0 -1
- /package/dist/{chunk-QW7H3ICI.js.map → chunk-FGLZ5QID.js.map} +0 -0
- /package/dist/{chunk-Z4Y4FMQN.js.map → chunk-OSR3G3DP.js.map} +0 -0
- /package/dist/{chunk-KWXPDASV.js.map → chunk-PEBORXRA.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,19 +43,23 @@ 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,
|
|
54
61
|
fromRedisStream,
|
|
62
|
+
fromSqlite,
|
|
55
63
|
fromStatsD,
|
|
56
64
|
fromSyslog,
|
|
57
65
|
fromWebSocket,
|
|
@@ -60,6 +68,7 @@ import {
|
|
|
60
68
|
interval,
|
|
61
69
|
last,
|
|
62
70
|
linear,
|
|
71
|
+
lru,
|
|
63
72
|
map,
|
|
64
73
|
merge,
|
|
65
74
|
mergeMap,
|
|
@@ -97,6 +106,7 @@ import {
|
|
|
97
106
|
tap,
|
|
98
107
|
throttle,
|
|
99
108
|
throttleTime,
|
|
109
|
+
tieredStorage,
|
|
100
110
|
timeout,
|
|
101
111
|
toCSV,
|
|
102
112
|
toClickHouse,
|
|
@@ -111,6 +121,7 @@ import {
|
|
|
111
121
|
toRedisStream,
|
|
112
122
|
toS3,
|
|
113
123
|
toSSE,
|
|
124
|
+
toSqlite,
|
|
114
125
|
toTempo,
|
|
115
126
|
toWebSocket,
|
|
116
127
|
tokenBucket,
|
|
@@ -126,22 +137,14 @@ import {
|
|
|
126
137
|
workerBridge,
|
|
127
138
|
workerSelf,
|
|
128
139
|
zip
|
|
129
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-ONLYF6GA.js";
|
|
130
141
|
import {
|
|
131
142
|
cqrs_exports,
|
|
132
143
|
nestjs_exports
|
|
133
|
-
} from "./chunk-
|
|
134
|
-
import {
|
|
135
|
-
JsonCodec,
|
|
136
|
-
createDagCborCodec,
|
|
137
|
-
createDagCborZstdCodec,
|
|
138
|
-
graph_exports,
|
|
139
|
-
negotiateCodec,
|
|
140
|
-
replayWAL
|
|
141
|
-
} from "./chunk-HP7OKEOE.js";
|
|
144
|
+
} from "./chunk-FGLZ5QID.js";
|
|
142
145
|
import {
|
|
143
146
|
core_exports
|
|
144
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-ISGMZ2T3.js";
|
|
145
148
|
import {
|
|
146
149
|
cached,
|
|
147
150
|
createWatermarkController,
|
|
@@ -174,19 +177,33 @@ import {
|
|
|
174
177
|
toArray,
|
|
175
178
|
toMessages$,
|
|
176
179
|
toObservable
|
|
177
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-PEBORXRA.js";
|
|
181
|
+
import {
|
|
182
|
+
ResettableTimer
|
|
183
|
+
} from "./chunk-WZ2Z2CRV.js";
|
|
178
184
|
import {
|
|
185
|
+
JsonCodec,
|
|
186
|
+
createDagCborCodec,
|
|
187
|
+
createDagCborZstdCodec,
|
|
188
|
+
graph_exports,
|
|
189
|
+
negotiateCodec,
|
|
190
|
+
replayWAL
|
|
191
|
+
} from "./chunk-L4J2K2RT.js";
|
|
192
|
+
import {
|
|
193
|
+
analyzeAndMeasure,
|
|
194
|
+
computeLineBreaks,
|
|
179
195
|
reactive_layout_exports
|
|
180
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-OSR3G3DP.js";
|
|
181
197
|
import {
|
|
182
198
|
GRAPH_META_SEGMENT,
|
|
183
199
|
Graph,
|
|
184
200
|
reachable
|
|
185
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-BLCXEMAD.js";
|
|
186
202
|
import {
|
|
187
203
|
describeNode,
|
|
188
|
-
metaSnapshot
|
|
189
|
-
|
|
204
|
+
metaSnapshot,
|
|
205
|
+
resolveDescribeFields
|
|
206
|
+
} from "./chunk-47YJEZUJ.js";
|
|
190
207
|
import {
|
|
191
208
|
COMPLETE,
|
|
192
209
|
DATA,
|
|
@@ -228,7 +245,7 @@ import {
|
|
|
228
245
|
propagatesToMeta,
|
|
229
246
|
state,
|
|
230
247
|
wallClockNs
|
|
231
|
-
} from "./chunk-
|
|
248
|
+
} from "./chunk-3EVXOI5C.js";
|
|
232
249
|
|
|
233
250
|
// src/compat/index.ts
|
|
234
251
|
var compat_exports = {};
|
|
@@ -1027,6 +1044,7 @@ var patterns_exports = {};
|
|
|
1027
1044
|
__export(patterns_exports, {
|
|
1028
1045
|
ai: () => ai_exports,
|
|
1029
1046
|
cqrs: () => cqrs_exports,
|
|
1047
|
+
demoShell: () => demo_shell_exports,
|
|
1030
1048
|
layout: () => reactive_layout_exports,
|
|
1031
1049
|
memory: () => memory_exports,
|
|
1032
1050
|
messaging: () => messaging_exports,
|
|
@@ -2347,7 +2365,7 @@ function metaToJsonSchema(meta) {
|
|
|
2347
2365
|
return schema;
|
|
2348
2366
|
}
|
|
2349
2367
|
function knobsAsTools(graph, actor) {
|
|
2350
|
-
const described = graph.describe({ actor });
|
|
2368
|
+
const described = graph.describe({ actor, detail: "full" });
|
|
2351
2369
|
const openai = [];
|
|
2352
2370
|
const mcp = [];
|
|
2353
2371
|
const definitions = [];
|
|
@@ -2355,10 +2373,11 @@ function knobsAsTools(graph, actor) {
|
|
|
2355
2373
|
if (node2.type !== "state") continue;
|
|
2356
2374
|
if (path.includes("::__meta__::")) continue;
|
|
2357
2375
|
if (node2.status === "completed" || node2.status === "errored") continue;
|
|
2358
|
-
const
|
|
2376
|
+
const meta = node2.meta ?? {};
|
|
2377
|
+
const access = meta.access;
|
|
2359
2378
|
if (access === "human" || access === "system") continue;
|
|
2360
|
-
const description =
|
|
2361
|
-
const valueSchema = metaToJsonSchema(
|
|
2379
|
+
const description = meta.description ?? `Set the value of ${path}`;
|
|
2380
|
+
const valueSchema = metaToJsonSchema(meta);
|
|
2362
2381
|
const parameterSchema = {
|
|
2363
2382
|
type: "object",
|
|
2364
2383
|
required: ["value"],
|
|
@@ -2398,14 +2417,15 @@ function knobsAsTools(graph, actor) {
|
|
|
2398
2417
|
return { openai, mcp, definitions };
|
|
2399
2418
|
}
|
|
2400
2419
|
function gaugesAsContext(graph, actor, options) {
|
|
2401
|
-
const described = graph.describe({ actor });
|
|
2420
|
+
const described = graph.describe({ actor, detail: "full" });
|
|
2402
2421
|
const groupByTags = options?.groupByTags ?? true;
|
|
2403
2422
|
const separator = options?.separator ?? "\n";
|
|
2404
2423
|
const entries = [];
|
|
2405
2424
|
const sinceVersion = options?.sinceVersion;
|
|
2406
2425
|
for (const [path, node2] of Object.entries(described.nodes)) {
|
|
2407
|
-
const
|
|
2408
|
-
const
|
|
2426
|
+
const meta = node2.meta ?? {};
|
|
2427
|
+
const desc = meta.description;
|
|
2428
|
+
const format = meta.format;
|
|
2409
2429
|
if (!desc && !format) continue;
|
|
2410
2430
|
if (sinceVersion != null && node2.v != null) {
|
|
2411
2431
|
const lastSeen = sinceVersion.get(path);
|
|
@@ -2414,7 +2434,7 @@ function gaugesAsContext(graph, actor, options) {
|
|
|
2414
2434
|
}
|
|
2415
2435
|
const label = desc ?? path;
|
|
2416
2436
|
const value = node2.value;
|
|
2417
|
-
const unit =
|
|
2437
|
+
const unit = meta.unit;
|
|
2418
2438
|
let formatted;
|
|
2419
2439
|
if (format === "currency" && typeof value === "number") {
|
|
2420
2440
|
formatted = `$${value.toFixed(2)}`;
|
|
@@ -2436,7 +2456,7 @@ function gaugesAsContext(graph, actor, options) {
|
|
|
2436
2456
|
const ungrouped = [];
|
|
2437
2457
|
for (const entry of entries) {
|
|
2438
2458
|
const node2 = described.nodes[entry.path];
|
|
2439
|
-
const tags = node2.meta.tags;
|
|
2459
|
+
const tags = (node2.meta ?? {}).tags;
|
|
2440
2460
|
if (tags && tags.length > 0) {
|
|
2441
2461
|
const tag = tags[0];
|
|
2442
2462
|
let group = tagGroups.get(tag);
|
|
@@ -2624,7 +2644,7 @@ Rules:
|
|
|
2624
2644
|
- Keep changes minimal \u2014 prefer the smallest set of operations that solves the problem.
|
|
2625
2645
|
- Return ONLY valid JSON, no markdown fences or commentary.`;
|
|
2626
2646
|
async function suggestStrategy(graph, problem, adapter, opts) {
|
|
2627
|
-
const described = graph.describe({ actor: opts?.actor });
|
|
2647
|
+
const { expand: _, ...described } = graph.describe({ actor: opts?.actor, detail: "standard" });
|
|
2628
2648
|
const messages = [
|
|
2629
2649
|
{ role: "system", content: SUGGEST_STRATEGY_SYSTEM_PROMPT },
|
|
2630
2650
|
{
|
|
@@ -2668,6 +2688,341 @@ async function suggestStrategy(graph, problem, adapter, opts) {
|
|
|
2668
2688
|
};
|
|
2669
2689
|
}
|
|
2670
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
|
+
|
|
2671
3026
|
// src/patterns/messaging.ts
|
|
2672
3027
|
var messaging_exports = {};
|
|
2673
3028
|
__export(messaging_exports, {
|
|
@@ -3470,8 +3825,10 @@ export {
|
|
|
3470
3825
|
PAUSE,
|
|
3471
3826
|
RESOLVED,
|
|
3472
3827
|
RESUME,
|
|
3828
|
+
ResettableTimer,
|
|
3473
3829
|
SqliteCheckpointAdapter,
|
|
3474
3830
|
TEARDOWN,
|
|
3831
|
+
TimeoutError,
|
|
3475
3832
|
accessHintForGuard,
|
|
3476
3833
|
advanceVersion,
|
|
3477
3834
|
ai_exports as ai,
|
|
@@ -3480,7 +3837,9 @@ export {
|
|
|
3480
3837
|
buffer,
|
|
3481
3838
|
bufferCount,
|
|
3482
3839
|
bufferTime,
|
|
3840
|
+
cache,
|
|
3483
3841
|
cached,
|
|
3842
|
+
cascadingCache,
|
|
3484
3843
|
catchError,
|
|
3485
3844
|
checkpointNodeValue,
|
|
3486
3845
|
checkpointToRedis,
|
|
@@ -3504,6 +3863,7 @@ export {
|
|
|
3504
3863
|
decorrelatedJitter,
|
|
3505
3864
|
defaultHash,
|
|
3506
3865
|
delay,
|
|
3866
|
+
demo_shell_exports as demoShell,
|
|
3507
3867
|
derived,
|
|
3508
3868
|
describeNode,
|
|
3509
3869
|
deserializeError,
|
|
@@ -3518,6 +3878,7 @@ export {
|
|
|
3518
3878
|
exhaustMap,
|
|
3519
3879
|
exponential,
|
|
3520
3880
|
extra_exports as extra,
|
|
3881
|
+
fallback,
|
|
3521
3882
|
fibonacci,
|
|
3522
3883
|
filter,
|
|
3523
3884
|
find,
|
|
@@ -3530,6 +3891,7 @@ export {
|
|
|
3530
3891
|
fromCSV,
|
|
3531
3892
|
fromClickHouseWatch,
|
|
3532
3893
|
fromCron,
|
|
3894
|
+
fromDrizzle,
|
|
3533
3895
|
fromEvent,
|
|
3534
3896
|
fromFSWatch,
|
|
3535
3897
|
fromGitHook,
|
|
@@ -3538,15 +3900,18 @@ export {
|
|
|
3538
3900
|
fromIDBTransaction,
|
|
3539
3901
|
fromIter,
|
|
3540
3902
|
fromKafka,
|
|
3903
|
+
fromKysely,
|
|
3541
3904
|
fromMCP,
|
|
3542
3905
|
fromNATS,
|
|
3543
3906
|
fromNDJSON,
|
|
3544
3907
|
fromOTel,
|
|
3908
|
+
fromPrisma,
|
|
3545
3909
|
fromPrometheus,
|
|
3546
3910
|
fromPromise,
|
|
3547
3911
|
fromPulsar,
|
|
3548
3912
|
fromRabbitMQ,
|
|
3549
3913
|
fromRedisStream,
|
|
3914
|
+
fromSqlite,
|
|
3550
3915
|
fromStatsD,
|
|
3551
3916
|
fromSyslog,
|
|
3552
3917
|
fromTimer,
|
|
@@ -3567,6 +3932,7 @@ export {
|
|
|
3567
3932
|
reactive_layout_exports as layout,
|
|
3568
3933
|
linear,
|
|
3569
3934
|
logSlice,
|
|
3935
|
+
lru,
|
|
3570
3936
|
map,
|
|
3571
3937
|
matchesAnyPattern,
|
|
3572
3938
|
matchesCron,
|
|
@@ -3616,6 +3982,7 @@ export {
|
|
|
3616
3982
|
replayWAL,
|
|
3617
3983
|
rescue,
|
|
3618
3984
|
resolveBackoffPreset,
|
|
3985
|
+
resolveDescribeFields,
|
|
3619
3986
|
restoreGraphCheckpoint,
|
|
3620
3987
|
restoreGraphCheckpointIndexedDb,
|
|
3621
3988
|
retry,
|
|
@@ -3641,6 +4008,7 @@ export {
|
|
|
3641
4008
|
throttle,
|
|
3642
4009
|
throttleTime,
|
|
3643
4010
|
throwError,
|
|
4011
|
+
tieredStorage,
|
|
3644
4012
|
timeout,
|
|
3645
4013
|
toArray,
|
|
3646
4014
|
toCSV,
|
|
@@ -3658,6 +4026,7 @@ export {
|
|
|
3658
4026
|
toRedisStream,
|
|
3659
4027
|
toS3,
|
|
3660
4028
|
toSSE,
|
|
4029
|
+
toSqlite,
|
|
3661
4030
|
toTempo,
|
|
3662
4031
|
toWebSocket,
|
|
3663
4032
|
tokenBucket,
|