@nexface/inspector 0.1.13-alpha.3 → 0.1.13-alpha.5
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/bootstrap.js +1 -3
- package/dist/panel.js +69 -49
- package/dist/react-tree.js +16 -9
- package/dist/shared/errors.d.ts +1 -1
- package/dist/use-execution-history.js +27 -9
- package/package.json +2 -2
package/dist/bootstrap.js
CHANGED
|
@@ -20,9 +20,7 @@ function installNexfaceDevtoolsBootstrap() {
|
|
|
20
20
|
const originalCommit = existing.onCommitFiberRoot;
|
|
21
21
|
const originalUnmount = existing.onCommitFiberUnmount;
|
|
22
22
|
existing.inject = function inject(renderer) {
|
|
23
|
-
const id = originalInject
|
|
24
|
-
? originalInject.call(this, renderer)
|
|
25
|
-
: ++fallbackRendererId;
|
|
23
|
+
const id = originalInject ? originalInject.call(this, renderer) : ++fallbackRendererId;
|
|
26
24
|
store.publishRenderer(id, renderer);
|
|
27
25
|
return id;
|
|
28
26
|
};
|
package/dist/panel.js
CHANGED
|
@@ -7,10 +7,11 @@ import { collectRuntimeToolSnapshot, reactDevtoolsRoots, runtimeToolRegionRects,
|
|
|
7
7
|
import { useExecutionHistory } from "./use-execution-history.js";
|
|
8
8
|
const pageToolNames = new Set(["nxf_getSnapshot", "nxf_executeAction", "nxf_applyAction"]);
|
|
9
9
|
function applicationTools(runtime) {
|
|
10
|
-
return getRuntimeController(runtime)
|
|
10
|
+
return getRuntimeController(runtime)
|
|
11
|
+
.getRegisteredTools()
|
|
11
12
|
.map((tool) => tool.definition)
|
|
12
13
|
.filter((tool) => !pageToolNames.has(tool.name))
|
|
13
|
-
.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
14
|
+
.sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));
|
|
14
15
|
}
|
|
15
16
|
const styles = `
|
|
16
17
|
:host { all: initial; }
|
|
@@ -70,9 +71,15 @@ textarea { width: 100%; min-height: 96px; margin-top: 9px; padding: 9px; border:
|
|
|
70
71
|
@media (max-width: 620px) { .layout { grid-template-columns: 1fr; } .list { max-height: 190px; border-right: 0; border-bottom: 1px solid #e6e9ef; } }
|
|
71
72
|
`;
|
|
72
73
|
function executionStatus(record) {
|
|
73
|
-
return record.status === "running"
|
|
74
|
+
return record.status === "running"
|
|
75
|
+
? "执行中"
|
|
76
|
+
: record.status === "success"
|
|
77
|
+
? "成功"
|
|
78
|
+
: record.cancelled
|
|
79
|
+
? "已取消"
|
|
80
|
+
: "失败";
|
|
74
81
|
}
|
|
75
|
-
function ExecutionValue({ title, snapshot }) {
|
|
82
|
+
function ExecutionValue({ title, snapshot, }) {
|
|
76
83
|
const [feedback, setFeedback] = useState("");
|
|
77
84
|
const copy = async () => {
|
|
78
85
|
try {
|
|
@@ -87,7 +94,7 @@ function ExecutionValue({ title, snapshot }) {
|
|
|
87
94
|
React.createElement("div", { className: "record-heading" },
|
|
88
95
|
React.createElement("span", { className: "section-title" }, title),
|
|
89
96
|
React.createElement("button", { className: "copy", "aria-label": `复制${title}`, onClick: () => void copy() }, "\u590D\u5236")),
|
|
90
|
-
snapshot.truncated ? React.createElement("div", { className: "description" }, "\u5185\u5BB9\u5DF2\u622A\u65AD\uFF0C\u590D\u5236\u4EC5\u5305\u542B\u5DF2\u4FDD\u5B58\u7684\u6587\u672C\u3002") : null,
|
|
97
|
+
snapshot.truncated ? (React.createElement("div", { className: "description" }, "\u5185\u5BB9\u5DF2\u622A\u65AD\uFF0C\u590D\u5236\u4EC5\u5305\u542B\u5DF2\u4FDD\u5B58\u7684\u6587\u672C\u3002")) : null,
|
|
91
98
|
feedback ? React.createElement("div", { role: "status" }, feedback) : null,
|
|
92
99
|
React.createElement("pre", null, snapshot.text)));
|
|
93
100
|
}
|
|
@@ -140,24 +147,27 @@ function unionRect(rects) {
|
|
|
140
147
|
return new DOMRect(left, top, right - left, bottom - top);
|
|
141
148
|
}
|
|
142
149
|
function sameRect(left, right) {
|
|
143
|
-
return left.left === right.left &&
|
|
144
|
-
left.
|
|
150
|
+
return (left.left === right.left &&
|
|
151
|
+
left.top === right.top &&
|
|
152
|
+
left.width === right.width &&
|
|
153
|
+
left.height === right.height);
|
|
145
154
|
}
|
|
146
155
|
function sameRegions(left, right) {
|
|
147
|
-
return left.length === right.length &&
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
candidate
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
return (left.length === right.length &&
|
|
157
|
+
left.every((region, index) => {
|
|
158
|
+
const candidate = right[index];
|
|
159
|
+
return (candidate?.id === region.id &&
|
|
160
|
+
candidate.ownerIds.length === region.ownerIds.length &&
|
|
161
|
+
candidate.ownerIds.every((id, ownerIndex) => id === region.ownerIds[ownerIndex]) &&
|
|
162
|
+
candidate.componentNames.length === region.componentNames.length &&
|
|
163
|
+
candidate.componentNames.every((name, nameIndex) => name === region.componentNames[nameIndex]) &&
|
|
164
|
+
candidate.toolNames.length === region.toolNames.length &&
|
|
165
|
+
candidate.toolNames.every((name, nameIndex) => name === region.toolNames[nameIndex]) &&
|
|
166
|
+
candidate.elements.length === region.elements.length &&
|
|
167
|
+
candidate.elements.every((element, elementIndex) => element === region.elements[elementIndex]) &&
|
|
168
|
+
candidate.rects.length === region.rects.length &&
|
|
169
|
+
candidate.rects.every((rect, rectIndex) => sameRect(rect, region.rects[rectIndex])));
|
|
170
|
+
}));
|
|
161
171
|
}
|
|
162
172
|
const emptyComponentSnapshot = {
|
|
163
173
|
owners: [],
|
|
@@ -165,20 +175,23 @@ const emptyComponentSnapshot = {
|
|
|
165
175
|
};
|
|
166
176
|
const dragThreshold = 6;
|
|
167
177
|
function sameOwners(left, right) {
|
|
168
|
-
return left.length === right.length &&
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
return (left.length === right.length &&
|
|
179
|
+
left.every((owner, index) => {
|
|
180
|
+
const candidate = right[index];
|
|
181
|
+
return (candidate?.id === owner.id &&
|
|
182
|
+
candidate.name === owner.name &&
|
|
183
|
+
candidate.parentId === owner.parentId &&
|
|
184
|
+
candidate.renderless === owner.renderless &&
|
|
185
|
+
candidate.children.length === owner.children.length &&
|
|
186
|
+
candidate.children.every((id, childIndex) => id === owner.children[childIndex]) &&
|
|
187
|
+
candidate.toolNames.length === owner.toolNames.length &&
|
|
188
|
+
candidate.toolNames.every((name, toolIndex) => name === owner.toolNames[toolIndex]));
|
|
189
|
+
}));
|
|
177
190
|
}
|
|
178
191
|
function sameComponentSnapshots(left, right) {
|
|
179
|
-
return left.rootIds.length === right.rootIds.length &&
|
|
192
|
+
return (left.rootIds.length === right.rootIds.length &&
|
|
180
193
|
left.rootIds.every((id, index) => id === right.rootIds[index]) &&
|
|
181
|
-
sameOwners(left.owners, right.owners);
|
|
194
|
+
sameOwners(left.owners, right.owners));
|
|
182
195
|
}
|
|
183
196
|
function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHost, }) {
|
|
184
197
|
const [open, setOpen] = useState(defaultOpen);
|
|
@@ -227,8 +240,7 @@ function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHo
|
|
|
227
240
|
}
|
|
228
241
|
}, [selectedName, tools]);
|
|
229
242
|
useEffect(() => {
|
|
230
|
-
if (selectedOwnerId &&
|
|
231
|
-
!componentSnapshot.owners.some(({ id }) => id === selectedOwnerId)) {
|
|
243
|
+
if (selectedOwnerId && !componentSnapshot.owners.some(({ id }) => id === selectedOwnerId)) {
|
|
232
244
|
setSelectedOwnerId(undefined);
|
|
233
245
|
}
|
|
234
246
|
}, [componentSnapshot.owners, selectedOwnerId]);
|
|
@@ -280,13 +292,11 @@ function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHo
|
|
|
280
292
|
}
|
|
281
293
|
let scheduled;
|
|
282
294
|
let usesAnimationFrame = false;
|
|
283
|
-
const resizeObserver = typeof ResizeObserver === "undefined"
|
|
284
|
-
? undefined
|
|
285
|
-
: new ResizeObserver(() => refreshRects());
|
|
295
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(() => refreshRects());
|
|
286
296
|
const rebuild = () => {
|
|
287
297
|
scheduled = undefined;
|
|
288
298
|
const next = collectRuntimeToolSnapshot(reactDevtoolsRoots(), tools, overlayHost);
|
|
289
|
-
setRegions((current) => sameRegions(current, next.regions) ? current : next.regions);
|
|
299
|
+
setRegions((current) => (sameRegions(current, next.regions) ? current : next.regions));
|
|
290
300
|
setComponentSnapshot((current) => {
|
|
291
301
|
const components = { owners: next.owners, rootIds: next.rootIds };
|
|
292
302
|
return sameComponentSnapshots(current, components) ? current : components;
|
|
@@ -386,7 +396,9 @@ function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHo
|
|
|
386
396
|
setRunning(true);
|
|
387
397
|
setResult(undefined);
|
|
388
398
|
try {
|
|
389
|
-
const currentTool = getRuntimeController(runtime)
|
|
399
|
+
const currentTool = getRuntimeController(runtime)
|
|
400
|
+
.getRegisteredTools()
|
|
401
|
+
.find((candidate) => candidate.definition === tool && !pageToolNames.has(candidate.definition.name));
|
|
390
402
|
if (!currentTool)
|
|
391
403
|
throw new Error(`Tool "${tool.name}" is no longer registered.`);
|
|
392
404
|
const nextResult = await runtime.execute(currentTool, parsedInput.value, {
|
|
@@ -528,10 +540,12 @@ function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHo
|
|
|
528
540
|
: region.toolNames.includes(selectedName ?? "");
|
|
529
541
|
const color = selectedRegion ? "#1769e0" : "#52a832";
|
|
530
542
|
const label = `${region.componentNames.join(", ")} · ${region.toolNames.join(", ")}`;
|
|
531
|
-
const title = region.toolNames
|
|
543
|
+
const title = region.toolNames
|
|
544
|
+
.map((name) => {
|
|
532
545
|
const tool = tools.find((candidate) => candidate.name === name);
|
|
533
546
|
return tool ? `${name}: ${tool.description}` : name;
|
|
534
|
-
})
|
|
547
|
+
})
|
|
548
|
+
.join("\n");
|
|
535
549
|
return (React.createElement("button", { "aria-label": `Inspect ${region.componentNames.join(", ")}`, className: `region${selectedRegion ? " selected" : ""}`, "data-tool-overlay": region.toolNames.join(" "), key: region.id, title: title, style: {
|
|
536
550
|
"--color": color,
|
|
537
551
|
height: rect.height,
|
|
@@ -570,7 +584,7 @@ function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHo
|
|
|
570
584
|
tools.map((tool) => (React.createElement("button", { className: `tool${selectedName === tool.name ? " selected" : ""}`, key: tool.name, onClick: () => selectTool(tool.name) },
|
|
571
585
|
React.createElement("span", { className: "tool-name" }, tool.name),
|
|
572
586
|
React.createElement("div", { className: "tool-description" }, tool.description)))),
|
|
573
|
-
tools.length === 0 ?
|
|
587
|
+
tools.length === 0 ? React.createElement("div", { className: "empty" }, "\u5F53\u524D\u9875\u9762\u6CA1\u6709\u5DF2\u6CE8\u518C\u80FD\u529B") : null),
|
|
574
588
|
React.createElement("div", { className: "detail" }, selected ? (React.createElement(React.Fragment, null,
|
|
575
589
|
React.createElement("h2", null, selected.name),
|
|
576
590
|
React.createElement("p", { className: "description" }, selected.description),
|
|
@@ -591,7 +605,7 @@ function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHo
|
|
|
591
605
|
React.createElement("div", { className: "actions" },
|
|
592
606
|
running ? (React.createElement("button", { className: "cancel", onClick: () => controllerRef.current?.abort() }, "Cancel")) : null,
|
|
593
607
|
React.createElement("button", { className: "run", disabled: running || !("value" in parsedInput), onClick: () => void run(selected) }, "Run Tool")),
|
|
594
|
-
result !== undefined ? React.createElement("pre", null, pretty(result)) : null))) : React.createElement("div", { className: "empty" }, "Select a capability to inspect it.")))) : activeTab === "executions" ? (React.createElement("div", { className: "layout" },
|
|
608
|
+
result !== undefined ? React.createElement("pre", null, pretty(result)) : null))) : (React.createElement("div", { className: "empty" }, "Select a capability to inspect it."))))) : activeTab === "executions" ? (React.createElement("div", { className: "layout" },
|
|
595
609
|
React.createElement("div", { className: "list" },
|
|
596
610
|
React.createElement("div", { className: "record-heading" },
|
|
597
611
|
React.createElement("span", { className: "section-title" }, "\u8C03\u7528\u8BB0\u5F55"),
|
|
@@ -600,19 +614,25 @@ function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHo
|
|
|
600
614
|
React.createElement("span", { className: "tool-name" }, record.name),
|
|
601
615
|
React.createElement("div", { className: "tool-description" },
|
|
602
616
|
new Date(record.startedAt).toLocaleTimeString(),
|
|
603
|
-
" \u00B7
|
|
617
|
+
" \u00B7",
|
|
618
|
+
" ",
|
|
604
619
|
executionStatus(record),
|
|
605
|
-
record.finishedAt !== undefined
|
|
620
|
+
record.finishedAt !== undefined
|
|
621
|
+
? ` · ${Math.max(0, record.finishedAt - record.startedAt)}ms`
|
|
622
|
+
: "")))),
|
|
606
623
|
history.records.length === 0 ? (React.createElement("div", { className: "empty" }, "\u6682\u65E0\u6267\u884C\u8BB0\u5F55\u3002Inspector \u6302\u8F7D\u540E\uFF0C\u7ECF\u8FC7\u672C\u5730 Runtime \u7684 Tool \u8C03\u7528\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002")) : null),
|
|
607
624
|
React.createElement("div", { className: "detail" }, history.selected ? (React.createElement(React.Fragment, null,
|
|
608
625
|
React.createElement("h2", null, history.selected.name),
|
|
609
626
|
React.createElement("p", { className: "description" },
|
|
610
627
|
executionStatus(history.selected),
|
|
611
|
-
" \u00B7
|
|
628
|
+
" \u00B7",
|
|
629
|
+
" ",
|
|
612
630
|
new Date(history.selected.startedAt).toLocaleTimeString(),
|
|
613
|
-
history.selected.finishedAt !== undefined
|
|
631
|
+
history.selected.finishedAt !== undefined
|
|
632
|
+
? ` · ${Math.max(0, history.selected.finishedAt - history.selected.startedAt)}ms`
|
|
633
|
+
: ""),
|
|
614
634
|
React.createElement(ExecutionValue, { key: `${history.selected.id}:input`, title: "\u5165\u53C2", snapshot: history.selected.input }),
|
|
615
|
-
history.selected.output ? (React.createElement(ExecutionValue, { key: `${history.selected.id}:output`, title: history.selected.status === "success" ? "返回值" : "错误", snapshot: history.selected.output })) : null)) : React.createElement("div", { className: "empty" }, "\u9009\u62E9\u4E00\u6761\u8C03\u7528\u67E5\u770B\u8BE6\u60C5\u3002")))) : (React.createElement("div", { className: "layout" },
|
|
635
|
+
history.selected.output ? (React.createElement(ExecutionValue, { key: `${history.selected.id}:output`, title: history.selected.status === "success" ? "返回值" : "错误", snapshot: history.selected.output })) : null)) : (React.createElement("div", { className: "empty" }, "\u9009\u62E9\u4E00\u6761\u8C03\u7528\u67E5\u770B\u8BE6\u60C5\u3002"))))) : (React.createElement("div", { className: "layout" },
|
|
616
636
|
React.createElement("div", { className: "component-tree" },
|
|
617
637
|
componentSnapshot.rootIds.map((id) => renderOwner(id)),
|
|
618
638
|
componentSnapshot.rootIds.length === 0 ? (React.createElement("div", { className: "empty" }, "\u5F53\u524D\u9875\u9762\u6CA1\u6709 Agent Components")) : null),
|
|
@@ -630,7 +650,7 @@ function RuntimeInspector({ toolRuntime: runtime, defaultOpen, offset, overlayHo
|
|
|
630
650
|
} },
|
|
631
651
|
React.createElement("span", { className: "tool-name" }, name),
|
|
632
652
|
tool ? (React.createElement("div", { className: "tool-description" }, tool.description)) : null));
|
|
633
|
-
}))))) : React.createElement("div", { className: "empty" }, "Select an Agent Component to inspect it."))))))) : null));
|
|
653
|
+
}))))) : (React.createElement("div", { className: "empty" }, "Select an Agent Component to inspect it.")))))))) : null));
|
|
634
654
|
}
|
|
635
655
|
export function AgentInspectorPanel({ toolRuntime, defaultOpen = false, offset = { right: 24, bottom: 88 }, }) {
|
|
636
656
|
const [portal, setPortal] = useState();
|
package/dist/react-tree.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNexfaceDevtoolsStore
|
|
1
|
+
import { getNexfaceDevtoolsStore } from "./react-devtools-store.js";
|
|
2
2
|
const fiberIds = new WeakMap();
|
|
3
3
|
let nextFiberId = 0;
|
|
4
4
|
function fiberId(fiber) {
|
|
@@ -88,11 +88,14 @@ function sameElements(left, right) {
|
|
|
88
88
|
return left.length === right.length && left.every((element, index) => element === right[index]);
|
|
89
89
|
}
|
|
90
90
|
function sameRects(left, right) {
|
|
91
|
-
return left.length === right.length &&
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
candidate
|
|
95
|
-
|
|
91
|
+
return (left.length === right.length &&
|
|
92
|
+
left.every((rect, index) => {
|
|
93
|
+
const candidate = right[index];
|
|
94
|
+
return (candidate?.left === rect.left &&
|
|
95
|
+
candidate.top === rect.top &&
|
|
96
|
+
candidate.width === rect.width &&
|
|
97
|
+
candidate.height === rect.height);
|
|
98
|
+
}));
|
|
96
99
|
}
|
|
97
100
|
function sameBounds(left, right) {
|
|
98
101
|
if (!left.length || !right.length)
|
|
@@ -105,8 +108,10 @@ function sameBounds(left, right) {
|
|
|
105
108
|
});
|
|
106
109
|
const leftBounds = bounds(left);
|
|
107
110
|
const rightBounds = bounds(right);
|
|
108
|
-
return leftBounds.left === rightBounds.left &&
|
|
109
|
-
leftBounds.
|
|
111
|
+
return (leftBounds.left === rightBounds.left &&
|
|
112
|
+
leftBounds.top === rightBounds.top &&
|
|
113
|
+
leftBounds.right === rightBounds.right &&
|
|
114
|
+
leftBounds.bottom === rightBounds.bottom);
|
|
110
115
|
}
|
|
111
116
|
function visibleRect(element) {
|
|
112
117
|
const style = getComputedStyle(element);
|
|
@@ -128,7 +133,9 @@ export function runtimeToolRegionRects(elements) {
|
|
|
128
133
|
if (rect)
|
|
129
134
|
visible.set(element, rect);
|
|
130
135
|
}
|
|
131
|
-
return [...visible]
|
|
136
|
+
return [...visible]
|
|
137
|
+
.filter(([element]) => ![...visible.keys()].some((candidate) => candidate !== element && candidate.contains(element)))
|
|
138
|
+
.map(([, rect]) => rect);
|
|
132
139
|
}
|
|
133
140
|
export function collectRuntimeToolSnapshot(roots, tools, overlayHost) {
|
|
134
141
|
const toolsByDefinition = new Map(tools.map((tool) => [tool, tool.name]));
|
package/dist/shared/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const TOOL_ERROR_CODES: readonly ["EXECUTION_OUTCOME_UNKNOWN", "ACTION_IN_FLIGHT", "ACTION_NOT_HANDLED", "ACTION_TARGET_UNAVAILABLE", "BROWSER_EXECUTION_FAILED", "BROWSER_SNAPSHOT_REQUIRED", "BROWSER_TOOLS_UNAVAILABLE", "CONTRACT_MISMATCH", "DUPLICATE_BINDING", "INVALID_INPUT", "INVALID_TOOL_RUNTIME", "OPERATION_BUSY", "TOOL_CANCELLED", "TOOL_CONFIRMATION_INVALIDATED", "TOOL_CONFIRMATION_REJECTED", "TOOL_ERROR", "TOOL_REGISTRATION_TIMEOUT", "TOOL_SKIPPED", "TOOL_UNAVAILABLE", "UNKNOWN_TOOL"];
|
|
2
|
-
type AgentToolErrorCode = typeof TOOL_ERROR_CODES[number];
|
|
2
|
+
type AgentToolErrorCode = (typeof TOOL_ERROR_CODES)[number];
|
|
3
3
|
export declare class AgentToolError extends Error {
|
|
4
4
|
readonly code: AgentToolErrorCode;
|
|
5
5
|
readonly details?: unknown | undefined;
|
|
@@ -59,7 +59,9 @@ export function executionSnapshot(value) {
|
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
if (item instanceof Date) {
|
|
62
|
-
quote(Number.isNaN(Date.prototype.getTime.call(item))
|
|
62
|
+
quote(Number.isNaN(Date.prototype.getTime.call(item))
|
|
63
|
+
? "Invalid Date"
|
|
64
|
+
: Date.prototype.toISOString.call(item));
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
65
67
|
if (ancestors.has(item)) {
|
|
@@ -139,7 +141,9 @@ export function useExecutionHistory(runtime) {
|
|
|
139
141
|
if (!active)
|
|
140
142
|
return;
|
|
141
143
|
const input = event.status === "running" ? executionSnapshot(event.input) : undefined;
|
|
142
|
-
const output = event.status === "running"
|
|
144
|
+
const output = event.status === "running"
|
|
145
|
+
? undefined
|
|
146
|
+
: executionSnapshot(event.status === "success" ? event.result : event.error);
|
|
143
147
|
setState((current) => {
|
|
144
148
|
if (current.runtime !== runtime)
|
|
145
149
|
return current;
|
|
@@ -148,18 +152,32 @@ export function useExecutionHistory(runtime) {
|
|
|
148
152
|
return current;
|
|
149
153
|
const previous = current.records[index];
|
|
150
154
|
const record = {
|
|
151
|
-
id: event.id,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
id: event.id,
|
|
156
|
+
operationId: event.operationId,
|
|
157
|
+
name: event.name,
|
|
158
|
+
status: event.status,
|
|
159
|
+
cancelled: event.cancelled,
|
|
160
|
+
startedAt: event.startedAt,
|
|
161
|
+
finishedAt: event.finishedAt,
|
|
162
|
+
input: previous?.input ?? input,
|
|
163
|
+
...(output ? { output } : {}),
|
|
155
164
|
};
|
|
156
165
|
const records = index < 0
|
|
157
166
|
? [record, ...current.records].slice(0, 100)
|
|
158
|
-
: current.records.map((item, position) => position === index ? record : item);
|
|
159
|
-
return {
|
|
167
|
+
: current.records.map((item, position) => (position === index ? record : item));
|
|
168
|
+
return {
|
|
169
|
+
runtime,
|
|
170
|
+
records,
|
|
171
|
+
selectedId: records.some(({ id }) => id === current.selectedId)
|
|
172
|
+
? current.selectedId
|
|
173
|
+
: undefined,
|
|
174
|
+
};
|
|
160
175
|
});
|
|
161
176
|
});
|
|
162
|
-
return () => {
|
|
177
|
+
return () => {
|
|
178
|
+
active = false;
|
|
179
|
+
unsubscribe();
|
|
180
|
+
};
|
|
163
181
|
}, [runtime]);
|
|
164
182
|
const records = state.runtime === runtime ? state.records : [];
|
|
165
183
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexface/inspector",
|
|
3
|
-
"version": "0.1.13-alpha.
|
|
3
|
+
"version": "0.1.13-alpha.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@nexface/tools": "0.1.13-alpha.
|
|
16
|
+
"@nexface/tools": "0.1.13-alpha.5",
|
|
17
17
|
"react": ">=17",
|
|
18
18
|
"react-dom": ">=17"
|
|
19
19
|
},
|