@tangle-network/sandbox-ui 2.0.20 → 2.0.22
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 +18 -1
- package/dist/{record-Cwyo2oHb.js → AgentTree-KO1TJXBq.js} +203 -313
- package/dist/VirtualList-DLh2JE0F.js +205 -0
- package/dist/{WorkflowGraph-CADReIDl.js → WorkflowGraph-B8cRtVaw.js} +2 -2
- package/dist/event-stream-DNEbvx4s.d.ts +2 -0
- package/dist/globals.css +5910 -240
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +2 -2
- package/dist/{index-ByNsP4VC.d.ts → index-BoKSR0s9.d.ts} +62 -4
- package/dist/{index-BYkigpIM.d.ts → index-gXcuwPOX.d.ts} +13 -7
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -6
- package/dist/record-BGcR48YY.js +47 -0
- package/dist/record.d.ts +66 -0
- package/dist/record.js +2329 -0
- package/dist/report-viewer.js +554 -0
- package/dist/run/live.d.ts +1 -1
- package/dist/run/live.js +26 -28
- package/dist/run/record.d.ts +2 -2
- package/dist/run/record.js +4 -1
- package/dist/run.d.ts +4 -4
- package/dist/run.js +5 -3
- package/dist/runtime-viewer/{AgentGraphCanvas-B74GN1o6-DC3EH_ss.js → AgentGraphCanvas-DDvaU9Rg-DlNZxJ20.js} +187 -168
- package/dist/runtime-viewer/{latest-events-iiWwpIck-BTK0vSlR.js → latest-events-CabhXynX-Dp_vs0Px.js} +705 -691
- package/dist/runtime-viewer/sandbox-ui-CUj4Q1P_.css +2 -0
- package/dist/styles.css +5911 -241
- package/dist/tailwind.css +5677 -5
- package/dist/tokens.css +7 -1
- package/dist/{trace-workspace-C8dHRBDV.js → trace-workspace-DkakKRLV.js} +64 -78
- package/dist/{tree-data-C8CNt4WE.js → tree-data-B_IXAIgg.js} +171 -121
- package/dist/use-follow-tail-Ckx5ZSV2.js +1 -0
- package/dist/vault-tree.js +1 -1
- package/dist/workflows.js +1 -1
- package/dist/{workspace-CzikYt_y.js → workspace--GvnZNpH.js} +1 -1
- package/dist/{workspace-files-pane-DB9Nvwh4.js → workspace-files-pane-C0PeY6rY.js} +12 -12
- package/dist/workspace-viewer.js +9693 -9462
- package/dist/workspace.js +2 -2
- package/package.json +27 -13
- package/dist/agent-stream-CBZ2fXJ2.d.ts +0 -66
- package/dist/runtime-viewer/sandbox-ui-z5RGk327.css +0 -2
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as Fragment$1, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
// src/run/record/VirtualList.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Renders only the rows near the viewport of `scroller`. Row heights are measured as they render; unmeasured
|
|
6
|
+
* rows use `estimate`. Spacers keep the scroll height, so the browser's scroll anchoring holds the reading place.
|
|
7
|
+
*/
|
|
8
|
+
function VirtualList({ items, keyOf, render, scroller, estimate = 96, overscan = 900, target, origin, targetAlign = "start", virtualize = true, keepMounted }) {
|
|
9
|
+
const heights = useRef(/* @__PURE__ */ new Map());
|
|
10
|
+
const [version, setVersion] = useState(0);
|
|
11
|
+
const [viewport, setViewport] = useState({
|
|
12
|
+
top: 0,
|
|
13
|
+
height: 900
|
|
14
|
+
});
|
|
15
|
+
const observer = useRef(null);
|
|
16
|
+
const frame = useRef(0);
|
|
17
|
+
const originTop = () => {
|
|
18
|
+
const element = scroller.current, node = origin?.current;
|
|
19
|
+
return element && node ? node.getBoundingClientRect().top - (element === document.scrollingElement ? 0 : element.getBoundingClientRect().top + element.clientTop) + element.scrollTop : 0;
|
|
20
|
+
};
|
|
21
|
+
const observe = (element) => {
|
|
22
|
+
if (!observer.current && typeof ResizeObserver !== "undefined") observer.current = new ResizeObserver((entries) => {
|
|
23
|
+
let changed = false;
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
const key = entry.target.dataset.virtualKey;
|
|
26
|
+
if (!key) continue;
|
|
27
|
+
const height = Math.ceil(entry.borderBoxSize?.[0]?.blockSize ?? entry.target.offsetHeight);
|
|
28
|
+
if (height > 0 && heights.current.get(key) !== height) {
|
|
29
|
+
heights.current.set(key, height);
|
|
30
|
+
changed = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (changed && !frame.current) frame.current = requestAnimationFrame(() => {
|
|
34
|
+
frame.current = 0;
|
|
35
|
+
setVersion((value) => value + 1);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
observer.current?.observe(element);
|
|
39
|
+
};
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
for (const row of rows.current.values()) observe(row);
|
|
42
|
+
return () => {
|
|
43
|
+
cancelAnimationFrame(frame.current);
|
|
44
|
+
frame.current = 0;
|
|
45
|
+
observer.current?.disconnect();
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const element = scroller.current;
|
|
50
|
+
if (!element) return;
|
|
51
|
+
let frame = 0;
|
|
52
|
+
const update = () => {
|
|
53
|
+
frame = 0;
|
|
54
|
+
const top = element.scrollTop - originTop();
|
|
55
|
+
setViewport((current) => current.top === top && current.height === element.clientHeight ? current : {
|
|
56
|
+
top,
|
|
57
|
+
height: element.clientHeight
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const schedule = () => {
|
|
61
|
+
if (!frame) frame = requestAnimationFrame(update);
|
|
62
|
+
};
|
|
63
|
+
update();
|
|
64
|
+
const source = element === document.scrollingElement ? window : element;
|
|
65
|
+
source.addEventListener("scroll", schedule, { passive: true });
|
|
66
|
+
if (source === window) window.addEventListener("resize", schedule);
|
|
67
|
+
const resize = new ResizeObserver(schedule);
|
|
68
|
+
resize.observe(element);
|
|
69
|
+
return () => {
|
|
70
|
+
cancelAnimationFrame(frame);
|
|
71
|
+
source.removeEventListener("scroll", schedule);
|
|
72
|
+
if (source === window) window.removeEventListener("resize", schedule);
|
|
73
|
+
resize.disconnect();
|
|
74
|
+
};
|
|
75
|
+
}, [scroller, origin]);
|
|
76
|
+
const offsets = useMemo(() => {
|
|
77
|
+
const result = new Float64Array(items.length + 1);
|
|
78
|
+
const guess = typeof estimate === "function" ? estimate : () => estimate;
|
|
79
|
+
for (let i = 0; i < items.length; i++) result[i + 1] = result[i] + (heights.current.get(keyOf(items[i])) ?? guess(items[i]));
|
|
80
|
+
return result;
|
|
81
|
+
}, [
|
|
82
|
+
items,
|
|
83
|
+
keyOf,
|
|
84
|
+
estimate,
|
|
85
|
+
version
|
|
86
|
+
]);
|
|
87
|
+
const find = (y) => {
|
|
88
|
+
let low = 0, high = items.length;
|
|
89
|
+
while (low < high) {
|
|
90
|
+
const mid = low + high >> 1;
|
|
91
|
+
if (offsets[mid + 1] <= y) low = mid + 1;
|
|
92
|
+
else high = mid;
|
|
93
|
+
}
|
|
94
|
+
return low;
|
|
95
|
+
};
|
|
96
|
+
const start = virtualize ? Math.max(0, find(viewport.top - overscan)) : 0;
|
|
97
|
+
const end = virtualize ? Math.min(items.length, find(viewport.top + viewport.height + overscan) + 1) : items.length;
|
|
98
|
+
const scrollTo = (key, align) => {
|
|
99
|
+
const element = scroller.current;
|
|
100
|
+
const index = items.findIndex((item) => keyOf(item) === key);
|
|
101
|
+
if (!element || index < 0) return false;
|
|
102
|
+
const origin = originTop(), top = origin + offsets[index];
|
|
103
|
+
const bottom = origin + offsets[index + 1];
|
|
104
|
+
if (align || top < element.scrollTop) element.scrollTop = Math.max(0, top - 8);
|
|
105
|
+
else if (bottom > element.scrollTop + element.clientHeight) element.scrollTop = Math.max(0, bottom - element.clientHeight);
|
|
106
|
+
return true;
|
|
107
|
+
};
|
|
108
|
+
const pending = useRef(null);
|
|
109
|
+
const rows = useRef(/* @__PURE__ */ new Map());
|
|
110
|
+
const settle = () => {
|
|
111
|
+
const goal = pending.current;
|
|
112
|
+
if (!goal) return;
|
|
113
|
+
if (performance.now() > goal.until) {
|
|
114
|
+
pending.current = null;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (!scrollTo(goal.key, targetAlign === "start")) return;
|
|
118
|
+
const row = rows.current.get(goal.key);
|
|
119
|
+
if (targetAlign === "start" && row?.isConnected) {
|
|
120
|
+
const box = row.getBoundingClientRect();
|
|
121
|
+
if (box.top < 72 || box.top > window.innerHeight - 96) window.scrollBy({ top: box.top - 120 });
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
useLayoutEffect(() => {
|
|
125
|
+
pending.current = target ? {
|
|
126
|
+
key: target,
|
|
127
|
+
until: performance.now() + 2e3
|
|
128
|
+
} : null;
|
|
129
|
+
settle();
|
|
130
|
+
}, [target]);
|
|
131
|
+
useLayoutEffect(settle, [
|
|
132
|
+
version,
|
|
133
|
+
viewport,
|
|
134
|
+
items
|
|
135
|
+
]);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
const element = scroller.current;
|
|
138
|
+
if (!element) return;
|
|
139
|
+
const release = (event) => {
|
|
140
|
+
const key = event instanceof KeyboardEvent && event.target === element && !event.defaultPrevented ? event.key : "";
|
|
141
|
+
pending.current = items.length && (key === "Home" || key === "End") ? {
|
|
142
|
+
key: keyOf(items[key === "Home" ? 0 : items.length - 1]),
|
|
143
|
+
until: performance.now() + 2e3
|
|
144
|
+
} : null;
|
|
145
|
+
if (pending.current) {
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
settle();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const events = [
|
|
151
|
+
"wheel",
|
|
152
|
+
"touchstart",
|
|
153
|
+
"pointerdown",
|
|
154
|
+
"keydown"
|
|
155
|
+
];
|
|
156
|
+
for (const type of events) element.addEventListener(type, release, { passive: type === "wheel" || type === "touchstart" });
|
|
157
|
+
return () => {
|
|
158
|
+
for (const type of events) element.removeEventListener(type, release);
|
|
159
|
+
};
|
|
160
|
+
}, [
|
|
161
|
+
scroller,
|
|
162
|
+
items,
|
|
163
|
+
keyOf,
|
|
164
|
+
offsets
|
|
165
|
+
]);
|
|
166
|
+
const bind = (key) => (element) => {
|
|
167
|
+
const previous = rows.current.get(key);
|
|
168
|
+
if (previous) observer.current?.unobserve(previous);
|
|
169
|
+
if (element) {
|
|
170
|
+
rows.current.set(key, element);
|
|
171
|
+
observe(element);
|
|
172
|
+
} else rows.current.delete(key);
|
|
173
|
+
};
|
|
174
|
+
const indices = Array.from({ length: end - start }, (_, i) => start + i);
|
|
175
|
+
const kept = keepMounted ? items.findIndex((item) => keyOf(item) === keepMounted) : -1;
|
|
176
|
+
if (kept >= 0 && kept < start) indices.unshift(kept);
|
|
177
|
+
else if (kept >= end) indices.push(kept);
|
|
178
|
+
let previous = 0;
|
|
179
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [indices.map((index) => {
|
|
180
|
+
const item = items[index];
|
|
181
|
+
const key = keyOf(item);
|
|
182
|
+
const space = offsets[index] - offsets[previous];
|
|
183
|
+
previous = index + 1;
|
|
184
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [space > 0 && /* @__PURE__ */ jsx("div", {
|
|
185
|
+
style: {
|
|
186
|
+
height: space,
|
|
187
|
+
transitionProperty: "none"
|
|
188
|
+
},
|
|
189
|
+
"aria-hidden": "true"
|
|
190
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
191
|
+
ref: bind(key),
|
|
192
|
+
"data-virtual-key": key,
|
|
193
|
+
className: "virtual-row",
|
|
194
|
+
style: { display: "flow-root" },
|
|
195
|
+
children: render(item, index)
|
|
196
|
+
})] }, key);
|
|
197
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
198
|
+
style: {
|
|
199
|
+
height: offsets[items.length] - offsets[previous],
|
|
200
|
+
transitionProperty: "none"
|
|
201
|
+
},
|
|
202
|
+
"aria-hidden": "true"
|
|
203
|
+
})] });
|
|
204
|
+
}
|
|
205
|
+
export { VirtualList as t };
|
|
@@ -3,7 +3,7 @@ import { n as classifyOutput, t as NodeOutputBody } from "./node-output-DlySTwxr
|
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { Expand, Maximize2, Minimize2, Plus, Shrink, X } from "lucide-react";
|
|
6
|
-
import { SELECTION_OUTLINE, loadElk, motionAllowed, useColorMode } from "@tangle-network/charts/react/agent-graph/presentation";
|
|
6
|
+
import { SELECTION_OUTLINE, loadElk, motionAllowed, useColorMode as useColorMode$1 } from "@tangle-network/charts/react/agent-graph/presentation";
|
|
7
7
|
import { Background, BaseEdge, Controls, EdgeLabelRenderer, Handle, MarkerType, MiniMap, Panel, Position, ReactFlow, ViewportPortal, getSmoothStepPath, getViewportForBounds, useEdgesState, useNodesState, useStore } from "@xyflow/react";
|
|
8
8
|
import "@xyflow/react/dist/style.css";
|
|
9
9
|
// src/workflows/flow-graph.ts
|
|
@@ -1967,7 +1967,7 @@ function WorkflowGraph({ yaml, variant = "full", direction: directionProp, defau
|
|
|
1967
1967
|
]), direction, compact, canvasAspect, !editable);
|
|
1968
1968
|
const shownCompact = structural.compact ?? compact;
|
|
1969
1969
|
const shownDirection = structural.direction ?? direction;
|
|
1970
|
-
const colorMode = useColorMode(wrapperRef, !structural.error && structural.nodes.length > 0);
|
|
1970
|
+
const colorMode = useColorMode$1(wrapperRef, !structural.error && structural.nodes.length > 0);
|
|
1971
1971
|
const nodeBoxes = useMemo(() => structural.nodes.map((node) => ({
|
|
1972
1972
|
x: node.position.x,
|
|
1973
1973
|
y: node.position.y,
|