@nexface/inspector 0.1.8 → 0.1.9-alpha.1

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/panel.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  export interface AgentInspectorProps {
2
3
  defaultOpen?: boolean;
3
4
  offset?: {
@@ -5,4 +6,4 @@ export interface AgentInspectorProps {
5
6
  bottom: number;
6
7
  };
7
8
  }
8
- export declare function AgentInspectorPanel({ defaultOpen, offset, }: AgentInspectorProps): import("react").ReactPortal | null;
9
+ export declare function AgentInspectorPanel({ defaultOpen, offset, }: AgentInspectorProps): React.ReactPortal | null;
package/dist/panel.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import * as React from "react";
2
2
  import { useEffect, useMemo, useRef, useState, } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import { useInternalToolRuntime } from "@nexface/tools/internal/react";
@@ -343,7 +343,11 @@ function RuntimeInspector({ defaultOpen, offset, overlayHost, }) {
343
343
  const owner = ownersById.get(id);
344
344
  if (!owner)
345
345
  return null;
346
- return (_jsxs("div", { children: [_jsxs("button", { "aria-label": `Inspect component ${owner.name}`, className: `component-node${selectedOwnerId === owner.id ? " selected" : ""}`, "data-agent-component": owner.name, style: { "--depth": depth }, onClick: () => setSelectedOwnerId(owner.id), children: [_jsx("span", { className: "component-name", children: owner.name }), _jsx("span", { className: "component-count", children: owner.toolNames.length })] }), owner.children.map((childId) => renderOwner(childId, depth + 1))] }, owner.id));
346
+ return (React.createElement("div", { key: owner.id },
347
+ React.createElement("button", { "aria-label": `Inspect component ${owner.name}`, className: `component-node${selectedOwnerId === owner.id ? " selected" : ""}`, "data-agent-component": owner.name, style: { "--depth": depth }, onClick: () => setSelectedOwnerId(owner.id) },
348
+ React.createElement("span", { className: "component-name" }, owner.name),
349
+ React.createElement("span", { className: "component-count" }, owner.toolNames.length)),
350
+ owner.children.map((childId) => renderOwner(childId, depth + 1))));
347
351
  };
348
352
  const parsedInput = useMemo(() => {
349
353
  try {
@@ -476,65 +480,120 @@ function RuntimeInspector({ defaultOpen, offset, overlayHost, }) {
476
480
  triggerDragRef.current = undefined;
477
481
  suppressTriggerClickRef.current = state.moved;
478
482
  };
479
- return (_jsxs("div", { className: "root", children: [!open ? (_jsx("button", { className: "trigger", ref: triggerRef, style: {
480
- left: anchor.x,
481
- top: anchor.y,
482
- }, onClick: (event) => {
483
- if (suppressTriggerClickRef.current && event.detail !== 0) {
484
- suppressTriggerClickRef.current = false;
485
- return;
486
- }
483
+ return (React.createElement("div", { className: "root" },
484
+ !open ? (React.createElement("button", { className: "trigger", ref: triggerRef, style: {
485
+ left: anchor.x,
486
+ top: anchor.y,
487
+ }, onClick: (event) => {
488
+ if (suppressTriggerClickRef.current && event.detail !== 0) {
487
489
  suppressTriggerClickRef.current = false;
488
- setOpen(true);
489
- }, onPointerDown: startTriggerDrag, onPointerMove: dragTrigger, onPointerUp: endTriggerDrag, onPointerCancel: cancelTriggerDrag, onLostPointerCapture: loseTriggerPointerCapture, children: "Nexface Inspector" })) : null, open ? (_jsxs(_Fragment, { children: [regions
490
- .filter(({ rects }) => rects.length > 0)
491
- .slice()
492
- .sort((left, right) => {
493
- const leftRect = unionRect(left.rects);
494
- const rightRect = unionRect(right.rects);
495
- return rightRect.width * rightRect.height - leftRect.width * leftRect.height;
496
- })
497
- .map((region) => {
498
- const rect = unionRect(region.rects);
499
- const selectedRegion = activeTab === "components"
500
- ? region.ownerIds.includes(selectedOwnerId ?? "")
501
- : region.toolNames.includes(selectedName ?? "");
502
- const color = selectedRegion ? "#1769e0" : "#52a832";
503
- const label = `${region.componentNames.join(", ")} · ${region.toolNames.join(", ")}`;
504
- const title = region.toolNames.map((name) => {
505
- const tool = tools.find((candidate) => candidate.name === name);
506
- return tool ? `${name}: ${tool.description}` : name;
507
- }).join("\n");
508
- return (_jsx("button", { "aria-label": `Inspect ${region.componentNames.join(", ")}`, className: `region${selectedRegion ? " selected" : ""}`, "data-tool-overlay": region.toolNames.join(" "), title: title, style: {
509
- "--color": color,
510
- height: rect.height,
511
- left: rect.left,
512
- top: rect.top,
513
- width: rect.width,
514
- }, onClick: () => {
515
- const name = region.toolNames[0];
516
- if (name)
517
- selectTool(name);
518
- setActiveTab("tools");
519
- }, children: _jsx("span", { className: `region-tag${rect.top < 30 ? " inside" : ""}`, style: {
520
- maxWidth: Math.min(720, window.innerWidth - rect.left - viewportMargin),
521
- }, children: label }) }, region.id));
522
- }), _jsxs("aside", { "aria-label": "Nexface Inspector", className: "panel", style: {
523
- height: size.height,
524
- left: panelPosition.x,
525
- top: panelPosition.y,
526
- width: size.width,
527
- }, children: [_jsxs("header", { className: "header", onPointerDown: startDrag, onPointerMove: drag, onPointerUp: () => {
528
- dragRef.current = undefined;
529
- }, onPointerCancel: () => {
530
- dragRef.current = undefined;
531
- }, children: [_jsx("strong", { children: "Nexface Inspector" }), _jsx("button", { "aria-label": "Close Inspector", className: "close", onClick: () => setOpen(false), children: "\u00D7" })] }), _jsxs("nav", { "aria-label": "Inspector views", className: "tabs", children: [_jsx("button", { className: `tab${activeTab === "tools" ? " active" : ""}`, onClick: () => setActiveTab("tools"), children: "Page Tools" }), _jsx("button", { className: `tab${activeTab === "components" ? " active" : ""}`, onClick: () => setActiveTab("components"), children: "Agent Components" })] }), activeTab === "tools" ? (_jsxs("div", { className: "layout", children: [_jsxs("div", { className: "list", children: [tools.map((tool) => (_jsxs("button", { className: `tool${selectedName === tool.name ? " selected" : ""}`, onClick: () => selectTool(tool.name), children: [_jsx("span", { className: "tool-name", children: tool.name }), _jsx("div", { className: "tool-description", children: tool.description })] }, tool.name))), tools.length === 0 ? (_jsx("div", { className: "empty", children: "\u5F53\u524D\u9875\u9762\u6CA1\u6709\u5DF2\u6CE8\u518C\u80FD\u529B" })) : null] }), _jsx("div", { className: "detail", children: selected ? (_jsxs(_Fragment, { children: [_jsx("h2", { children: selected.name }), _jsx("p", { className: "description", children: selected.description }), _jsxs("section", { className: "section", children: [_jsx("div", { className: "section-title", children: "Registered by" }), _jsxs("div", { className: "owner-list", children: [selectedOwners.map((owner) => (_jsxs("button", { className: "owner-link", onClick: () => selectOwner(owner.id), children: [owner.name, owner.renderless ? " · Renderless" : ""] }, owner.id))), selectedOwners.length === 0 ? (_jsx("div", { className: "description", children: "Component owner is unavailable." })) : null] })] }), _jsxs("section", { className: "section", children: [_jsx("div", { className: "section-title", children: "Input schema" }), _jsx("pre", { children: pretty(selected.inputSchema) })] }), _jsxs("section", { className: "section", children: [_jsx("div", { className: "section-title", children: "Run Tool" }), _jsx("textarea", { value: input, onChange: (event) => setInput(event.target.value) }), parsedInput.error ? (_jsx("div", { className: "error", children: parsedInput.error })) : null, _jsxs("div", { className: "actions", children: [running ? (_jsx("button", { className: "cancel", onClick: () => controllerRef.current?.abort(), children: "Cancel" })) : null, _jsx("button", { className: "run", disabled: running || !("value" in parsedInput), onClick: () => void run(selected), children: "Run Tool" })] }), result !== undefined ? _jsx("pre", { children: pretty(result) }) : null] }), _jsxs("section", { className: "section", children: [_jsx("div", { className: "section-title", children: "Execution history" }), _jsx("div", { className: "history", children: history.filter(({ name }) => name === selected.name).map((event) => (_jsxs("div", { className: "history-row", children: [_jsx("span", { children: event.name }), _jsx("span", { children: event.status })] }, event.id))) })] })] })) : _jsx("div", { className: "empty", children: "Select a capability to inspect it." }) })] })) : (_jsxs("div", { className: "layout", children: [_jsxs("div", { className: "component-tree", children: [componentSnapshot.rootIds.map((id) => renderOwner(id)), componentSnapshot.rootIds.length === 0 ? (_jsx("div", { className: "empty", children: "\u5F53\u524D\u9875\u9762\u6CA1\u6709 Agent Components" })) : null] }), _jsx("div", { className: "detail", children: selectedOwner ? (_jsxs(_Fragment, { children: [_jsxs("div", { children: [_jsx("h2", { children: selectedOwner.name }), selectedOwner.renderless ? (_jsx("span", { className: "renderless", children: "Renderless" })) : null] }), _jsxs("section", { className: "section", children: [_jsx("div", { className: "section-title", children: "Registered Tools" }), _jsx("div", { className: "component-tools", children: selectedOwner.toolNames.map((name) => {
532
- const tool = tools.find((candidate) => candidate.name === name);
533
- return (_jsxs("button", { className: "component-tool", onClick: () => {
534
- selectTool(name);
535
- setActiveTab("tools");
536
- }, children: [_jsx("span", { className: "tool-name", children: name }), tool ? (_jsx("div", { className: "tool-description", children: tool.description })) : null] }, name));
537
- }) })] })] })) : _jsx("div", { className: "empty", children: "Select an Agent Component to inspect it." }) })] }))] })] })) : null] }));
490
+ return;
491
+ }
492
+ suppressTriggerClickRef.current = false;
493
+ setOpen(true);
494
+ }, onPointerDown: startTriggerDrag, onPointerMove: dragTrigger, onPointerUp: endTriggerDrag, onPointerCancel: cancelTriggerDrag, onLostPointerCapture: loseTriggerPointerCapture }, "Nexface Inspector")) : null,
495
+ open ? (React.createElement(React.Fragment, null,
496
+ regions
497
+ .filter(({ rects }) => rects.length > 0)
498
+ .slice()
499
+ .sort((left, right) => {
500
+ const leftRect = unionRect(left.rects);
501
+ const rightRect = unionRect(right.rects);
502
+ return rightRect.width * rightRect.height - leftRect.width * leftRect.height;
503
+ })
504
+ .map((region) => {
505
+ const rect = unionRect(region.rects);
506
+ const selectedRegion = activeTab === "components"
507
+ ? region.ownerIds.includes(selectedOwnerId ?? "")
508
+ : region.toolNames.includes(selectedName ?? "");
509
+ const color = selectedRegion ? "#1769e0" : "#52a832";
510
+ const label = `${region.componentNames.join(", ")} · ${region.toolNames.join(", ")}`;
511
+ const title = region.toolNames.map((name) => {
512
+ const tool = tools.find((candidate) => candidate.name === name);
513
+ return tool ? `${name}: ${tool.description}` : name;
514
+ }).join("\n");
515
+ 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: {
516
+ "--color": color,
517
+ height: rect.height,
518
+ left: rect.left,
519
+ top: rect.top,
520
+ width: rect.width,
521
+ }, onClick: () => {
522
+ const name = region.toolNames[0];
523
+ if (name)
524
+ selectTool(name);
525
+ setActiveTab("tools");
526
+ } },
527
+ React.createElement("span", { className: `region-tag${rect.top < 30 ? " inside" : ""}`, style: {
528
+ maxWidth: Math.min(720, window.innerWidth - rect.left - viewportMargin),
529
+ } }, label)));
530
+ }),
531
+ React.createElement("aside", { "aria-label": "Nexface Inspector", className: "panel", style: {
532
+ height: size.height,
533
+ left: panelPosition.x,
534
+ top: panelPosition.y,
535
+ width: size.width,
536
+ } },
537
+ React.createElement("header", { className: "header", onPointerDown: startDrag, onPointerMove: drag, onPointerUp: () => {
538
+ dragRef.current = undefined;
539
+ }, onPointerCancel: () => {
540
+ dragRef.current = undefined;
541
+ } },
542
+ React.createElement("strong", null, "Nexface Inspector"),
543
+ React.createElement("button", { "aria-label": "Close Inspector", className: "close", onClick: () => setOpen(false) }, "\u00D7")),
544
+ React.createElement("nav", { "aria-label": "Inspector views", className: "tabs" },
545
+ React.createElement("button", { className: `tab${activeTab === "tools" ? " active" : ""}`, onClick: () => setActiveTab("tools") }, "Page Tools"),
546
+ React.createElement("button", { className: `tab${activeTab === "components" ? " active" : ""}`, onClick: () => setActiveTab("components") }, "Agent Components")),
547
+ activeTab === "tools" ? (React.createElement("div", { className: "layout" },
548
+ React.createElement("div", { className: "list" },
549
+ tools.map((tool) => (React.createElement("button", { className: `tool${selectedName === tool.name ? " selected" : ""}`, key: tool.name, onClick: () => selectTool(tool.name) },
550
+ React.createElement("span", { className: "tool-name" }, tool.name),
551
+ React.createElement("div", { className: "tool-description" }, tool.description)))),
552
+ tools.length === 0 ? (React.createElement("div", { className: "empty" }, "\u5F53\u524D\u9875\u9762\u6CA1\u6709\u5DF2\u6CE8\u518C\u80FD\u529B")) : null),
553
+ React.createElement("div", { className: "detail" }, selected ? (React.createElement(React.Fragment, null,
554
+ React.createElement("h2", null, selected.name),
555
+ React.createElement("p", { className: "description" }, selected.description),
556
+ React.createElement("section", { className: "section" },
557
+ React.createElement("div", { className: "section-title" }, "Registered by"),
558
+ React.createElement("div", { className: "owner-list" },
559
+ selectedOwners.map((owner) => (React.createElement("button", { className: "owner-link", key: owner.id, onClick: () => selectOwner(owner.id) },
560
+ owner.name,
561
+ owner.renderless ? " · Renderless" : ""))),
562
+ selectedOwners.length === 0 ? (React.createElement("div", { className: "description" }, "Component owner is unavailable.")) : null)),
563
+ React.createElement("section", { className: "section" },
564
+ React.createElement("div", { className: "section-title" }, "Input schema"),
565
+ React.createElement("pre", null, pretty(selected.inputSchema))),
566
+ React.createElement("section", { className: "section" },
567
+ React.createElement("div", { className: "section-title" }, "Run Tool"),
568
+ React.createElement("textarea", { value: input, onChange: (event) => setInput(event.target.value) }),
569
+ parsedInput.error ? (React.createElement("div", { className: "error" }, parsedInput.error)) : null,
570
+ React.createElement("div", { className: "actions" },
571
+ running ? (React.createElement("button", { className: "cancel", onClick: () => controllerRef.current?.abort() }, "Cancel")) : null,
572
+ React.createElement("button", { className: "run", disabled: running || !("value" in parsedInput), onClick: () => void run(selected) }, "Run Tool")),
573
+ result !== undefined ? React.createElement("pre", null, pretty(result)) : null),
574
+ React.createElement("section", { className: "section" },
575
+ React.createElement("div", { className: "section-title" }, "Execution history"),
576
+ React.createElement("div", { className: "history" }, history.filter(({ name }) => name === selected.name).map((event) => (React.createElement("div", { className: "history-row", key: event.id },
577
+ React.createElement("span", null, event.name),
578
+ React.createElement("span", null, event.status)))))))) : React.createElement("div", { className: "empty" }, "Select a capability to inspect it.")))) : (React.createElement("div", { className: "layout" },
579
+ React.createElement("div", { className: "component-tree" },
580
+ componentSnapshot.rootIds.map((id) => renderOwner(id)),
581
+ componentSnapshot.rootIds.length === 0 ? (React.createElement("div", { className: "empty" }, "\u5F53\u524D\u9875\u9762\u6CA1\u6709 Agent Components")) : null),
582
+ React.createElement("div", { className: "detail" }, selectedOwner ? (React.createElement(React.Fragment, null,
583
+ React.createElement("div", null,
584
+ React.createElement("h2", null, selectedOwner.name),
585
+ selectedOwner.renderless ? (React.createElement("span", { className: "renderless" }, "Renderless")) : null),
586
+ React.createElement("section", { className: "section" },
587
+ React.createElement("div", { className: "section-title" }, "Registered Tools"),
588
+ React.createElement("div", { className: "component-tools" }, selectedOwner.toolNames.map((name) => {
589
+ const tool = tools.find((candidate) => candidate.name === name);
590
+ return (React.createElement("button", { className: "component-tool", key: name, onClick: () => {
591
+ selectTool(name);
592
+ setActiveTab("tools");
593
+ } },
594
+ React.createElement("span", { className: "tool-name" }, name),
595
+ tool ? (React.createElement("div", { className: "tool-description" }, tool.description)) : null));
596
+ }))))) : React.createElement("div", { className: "empty" }, "Select an Agent Component to inspect it."))))))) : null));
538
597
  }
539
598
  export function AgentInspectorPanel({ defaultOpen = false, offset = { right: 24, bottom: 88 }, }) {
540
599
  const [portal, setPortal] = useState();
@@ -553,6 +612,6 @@ export function AgentInspectorPanel({ defaultOpen = false, offset = { right: 24,
553
612
  }, []);
554
613
  if (!portal)
555
614
  return null;
556
- return createPortal(_jsx(RuntimeInspector, { defaultOpen: defaultOpen, offset: offset, overlayHost: portal.host }), portal.root);
615
+ return createPortal(React.createElement(RuntimeInspector, { defaultOpen: defaultOpen, offset: offset, overlayHost: portal.host }), portal.root);
557
616
  }
558
617
  //# sourceMappingURL=panel.js.map
package/dist/panel.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"panel.js","sourceRoot":"","sources":["../src/panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAMvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,GAIvB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,MAAM,GAAG;;;;;;;;;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vC,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC9C,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC;QAC3B,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC3B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,YAAY,CACjB,KAAC,gBAAgB,IACf,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,CAAC,IAAI,GACxB,EACF,MAAM,CAAC,IAAI,CACZ,CAAC;AACJ,CAAC","sourcesContent":["import {\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useInternalToolRuntime } from \"@nexface/tools/internal/react\";\nimport type {\n AgentToolExecutionEvent,\n} from \"@nexface/tools/internal\";\nimport type { AgentToolDefinition } from \"@nexface/tools\";\n\nimport { getNexfaceDevtoolsStore } from \"./react-devtools-store.js\";\nimport {\n collectRuntimeToolSnapshot,\n reactDevtoolsRoots,\n runtimeToolRegionRects,\n type RuntimeToolComponentSnapshot,\n type RuntimeToolOwner,\n type RuntimeToolRegion,\n} from \"./react-tree.js\";\n\nexport interface AgentInspectorProps {\n defaultOpen?: boolean;\n offset?: { right: number; bottom: number };\n}\n\nconst styles = `\n:host { all: initial; }\n* { box-sizing: border-box; }\nbutton, textarea { font: inherit; }\n.root { color: #202124; font: 13px/1.45 -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; }\n.region { position: fixed; z-index: 2147482998; padding: 0; border: 3px solid var(--color); border-radius: 8px; background: color-mix(in srgb, var(--color) 9%, transparent); box-shadow: 0 0 0 1px rgba(255,255,255,.85); cursor: pointer; }\n.region:hover, .region.selected { z-index: 2147483000; border-width: 4px; background: color-mix(in srgb, var(--color) 16%, transparent); }\n.region-tag { position: absolute; top: -27px; left: -3px; max-width: min(720px, calc(100vw - 32px)); padding: 3px 8px; border-radius: 6px 6px 6px 0; background: var(--color); color: #fff; font: 700 12px/19px ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.region-tag.inside { top: 3px; left: 3px; border-radius: 5px; }\n.trigger { position: fixed; z-index: 2147483002; max-width: calc(100vw - 32px); height: 42px; padding: 0 16px; transform: translate(-100%, -100%); overflow: hidden; border: 1px solid #d9dde5; border-radius: 22px; background: #fff; color: #1769e0; box-shadow: 0 8px 24px rgba(31,35,41,.18); cursor: grab; font-weight: 700; text-overflow: ellipsis; touch-action: none; user-select: none; white-space: nowrap; }\n.trigger:active { cursor: grabbing; }\n.panel { position: fixed; z-index: 2147483001; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #dfe3ea; border-radius: 14px; background: #fff; box-shadow: 0 18px 52px rgba(31,35,41,.25); }\n.header { display: flex; min-height: 56px; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid #e6e9ef; cursor: grab; user-select: none; touch-action: none; }\n.header:active { cursor: grabbing; }\n.header strong { font-size: 17px; }\n.close { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: #5f6673; cursor: pointer; font-size: 20px; }\n.close:hover { background: #f2f4f7; }\n.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid #e6e9ef; }\n.tab { position: relative; padding: 11px 9px 10px; border: 0; background: transparent; color: #646b78; cursor: pointer; font-weight: 700; }\n.tab.active { color: #1769e0; }\n.tab.active::after { position: absolute; right: 8px; bottom: -1px; left: 8px; height: 2px; background: #1769e0; content: \"\"; }\n.layout { display: grid; min-height: 0; flex: 1; grid-template-columns: 280px minmax(0, 1fr); }\n.list { min-height: 0; overflow: auto; padding: 14px; border-right: 1px solid #e6e9ef; }\n.tool { display: block; width: 100%; margin-bottom: 8px; padding: 11px; border: 1px solid #e2e6ed; border-radius: 9px; background: #fff; text-align: left; cursor: pointer; }\n.tool:hover, .tool.selected { border-color: #91b9f6; background: #f8fbff; }\n.tool-name { font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }\n.tool-description { margin-top: 5px; color: #646b78; }\n.detail { min-width: 0; overflow: auto; padding: 18px; }\n.detail h2 { margin: 0; font: 750 17px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }\n.description { margin: 8px 0 0; color: #646b78; }\n.owner-list { display: grid; gap: 7px; margin-top: 9px; }\n.owner-link { width: 100%; padding: 8px 10px; border: 1px solid #dfe4ec; border-radius: 8px; background: #fff; color: #1769e0; text-align: left; cursor: pointer; font: 700 12px ui-monospace, SFMono-Regular, Menlo, monospace; }\n.owner-link:hover { border-color: #91b9f6; background: #f8fbff; }\n.component-tree { min-height: 0; overflow: auto; padding: 14px; border-right: 1px solid #e6e9ef; }\n.component-node { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 7px; margin-bottom: 5px; padding: 7px 9px 7px calc(9px + var(--depth) * 18px); border: 0; border-radius: 7px; background: transparent; color: #202124; text-align: left; cursor: pointer; }\n.component-node:hover, .component-node.selected { background: #eef5ff; }\n.component-name { min-width: 0; flex: 1; overflow: hidden; font: 700 12px ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }\n.component-count { flex: none; color: #737b88; font-size: 11px; }\n.component-tools { display: grid; gap: 8px; margin-top: 10px; }\n.component-tool { width: 100%; padding: 10px; border: 1px solid #e2e6ed; border-radius: 8px; background: #fff; text-align: left; cursor: pointer; }\n.component-tool:hover { border-color: #91b9f6; background: #f8fbff; }\n.renderless { margin-left: 8px; padding: 2px 7px; border-radius: 999px; background: #f1ebff; color: #6f42c1; font-size: 11px; font-weight: 700; }\n.section { margin-top: 18px; padding-top: 16px; border-top: 1px solid #eceef2; }\n.section-title { font-weight: 750; }\npre { max-height: 180px; margin: 9px 0 0; overflow: auto; padding: 10px; border-radius: 8px; background: #f6f7f9; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }\ntextarea { width: 100%; min-height: 96px; margin-top: 9px; padding: 9px; border: 1px solid #d9dde5; border-radius: 7px; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }\n.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }\n.run, .cancel { min-width: 92px; height: 36px; border-radius: 8px; cursor: pointer; font-weight: 700; }\n.run { border: 0; background: #1769e0; color: #fff; }\n.run:disabled { background: #b6c9e8; cursor: not-allowed; }\n.cancel { border: 1px solid #d84a4a; background: #fff; color: #c62828; }\n.error { margin-top: 8px; color: #c62828; }\n.history { display: grid; gap: 6px; margin-top: 9px; }\n.history-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 9px; border-radius: 7px; background: #f6f7f9; }\n.empty { display: grid; min-height: 120px; place-items: center; color: #8a919d; text-align: center; }\n@media (max-width: 620px) { .layout { grid-template-columns: 1fr; } .list { max-height: 190px; border-right: 0; border-bottom: 1px solid #e6e9ef; } }\n`;\n\nfunction pretty(value: unknown): string {\n if (value instanceof Error) {\n return JSON.stringify({\n name: value.name,\n message: value.message,\n ...(\"code\" in value ? { code: value.code } : {}),\n }, null, 2);\n }\n try {\n return JSON.stringify(value, null, 2) ?? String(value);\n } catch {\n return String(value);\n }\n}\n\nconst viewportMargin = 16;\n\nfunction panelSize() {\n return {\n width: Math.min(760, Math.max(0, window.innerWidth - viewportMargin * 2)),\n height: Math.min(620, Math.max(0, window.innerHeight - 112)),\n };\n}\n\nfunction clampPosition(position: { x: number; y: number }) {\n const { width, height } = panelSize();\n return {\n x: Math.min(\n Math.max(viewportMargin, position.x),\n Math.max(viewportMargin, window.innerWidth - width - viewportMargin),\n ),\n y: Math.min(\n Math.max(viewportMargin, position.y),\n Math.max(viewportMargin, window.innerHeight - height - viewportMargin),\n ),\n };\n}\n\nfunction initialAnchor(offset: { right: number; bottom: number }) {\n return {\n x: window.innerWidth - offset.right,\n y: window.innerHeight - offset.bottom,\n };\n}\n\nfunction clampTriggerAnchor(\n anchor: { x: number; y: number },\n size: { width: number; height: number },\n) {\n return {\n x: Math.min(\n Math.max(viewportMargin + size.width, anchor.x),\n Math.max(viewportMargin + size.width, window.innerWidth - viewportMargin),\n ),\n y: Math.min(\n Math.max(viewportMargin + size.height, anchor.y),\n Math.max(viewportMargin + size.height, window.innerHeight - viewportMargin),\n ),\n };\n}\n\nfunction unionRect(rects: readonly DOMRect[]): DOMRect {\n const left = Math.min(...rects.map((rect) => rect.left));\n const top = Math.min(...rects.map((rect) => rect.top));\n const right = Math.max(...rects.map((rect) => rect.right));\n const bottom = Math.max(...rects.map((rect) => rect.bottom));\n return new DOMRect(left, top, right - left, bottom - top);\n}\n\nfunction sameRect(left: DOMRect, right: DOMRect): boolean {\n return left.left === right.left && left.top === right.top &&\n left.width === right.width && left.height === right.height;\n}\n\nfunction sameRegions(\n left: readonly RuntimeToolRegion[],\n right: readonly RuntimeToolRegion[],\n): boolean {\n return left.length === right.length && left.every((region, index) => {\n const candidate = right[index];\n return candidate?.id === region.id &&\n candidate.ownerIds.length === region.ownerIds.length &&\n candidate.ownerIds.every((id, ownerIndex) => id === region.ownerIds[ownerIndex]) &&\n candidate.componentNames.length === region.componentNames.length &&\n candidate.componentNames.every(\n (name, nameIndex) => name === region.componentNames[nameIndex],\n ) &&\n candidate.toolNames.length === region.toolNames.length &&\n candidate.toolNames.every((name, nameIndex) => name === region.toolNames[nameIndex]) &&\n candidate.elements.length === region.elements.length &&\n candidate.elements.every((element, elementIndex) => element === region.elements[elementIndex]) &&\n candidate.rects.length === region.rects.length &&\n candidate.rects.every((rect, rectIndex) => sameRect(rect, region.rects[rectIndex]!));\n });\n}\n\nconst emptyComponentSnapshot: RuntimeToolComponentSnapshot = {\n owners: [],\n rootIds: [],\n};\n\nconst dragThreshold = 6;\n\nfunction sameOwners(left: readonly RuntimeToolOwner[], right: readonly RuntimeToolOwner[]) {\n return left.length === right.length && left.every((owner, index) => {\n const candidate = right[index];\n return candidate?.id === owner.id && candidate.name === owner.name &&\n candidate.parentId === owner.parentId && candidate.renderless === owner.renderless &&\n candidate.children.length === owner.children.length &&\n candidate.children.every((id, childIndex) => id === owner.children[childIndex]) &&\n candidate.toolNames.length === owner.toolNames.length &&\n candidate.toolNames.every((name, toolIndex) => name === owner.toolNames[toolIndex]);\n });\n}\n\nfunction sameComponentSnapshots(\n left: RuntimeToolComponentSnapshot,\n right: RuntimeToolComponentSnapshot,\n) {\n return left.rootIds.length === right.rootIds.length &&\n left.rootIds.every((id, index) => id === right.rootIds[index]) &&\n sameOwners(left.owners, right.owners);\n}\n\nfunction RuntimeInspector({\n defaultOpen,\n offset,\n overlayHost,\n}: Required<AgentInspectorProps> & { overlayHost: HTMLElement }) {\n const runtime = useInternalToolRuntime();\n const [open, setOpen] = useState(defaultOpen);\n const [activeTab, setActiveTab] = useState<\"tools\" | \"components\">(\"tools\");\n const [tools, setTools] = useState(() => runtime.getApplicationTools());\n const [selectedName, setSelectedName] = useState<string>();\n const [selectedOwnerId, setSelectedOwnerId] = useState<string>();\n const [input, setInput] = useState(\"{}\");\n const [result, setResult] = useState<unknown>();\n const [running, setRunning] = useState(false);\n const [history, setHistory] = useState<AgentToolExecutionEvent[]>([]);\n const [regions, setRegions] = useState<RuntimeToolRegion[]>([]);\n const [componentSnapshot, setComponentSnapshot] = useState<RuntimeToolComponentSnapshot>(\n emptyComponentSnapshot,\n );\n const controllerRef = useRef<AbortController | undefined>(undefined);\n const runtimeRef = useRef(runtime);\n const [anchor, setAnchor] = useState(() => initialAnchor(offset));\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const triggerSizeRef = useRef({ width: 0, height: 42 });\n const dragRef = useRef<{\n pointerId: number;\n dx: number;\n dy: number;\n } | undefined>(undefined);\n const triggerDragRef = useRef<{\n pointerId: number;\n startX: number;\n startY: number;\n startAnchor: { x: number; y: number };\n triggerSize: { width: number; height: number };\n moved: boolean;\n } | undefined>(undefined);\n const suppressTriggerClickRef = useRef(false);\n const suppressTriggerClickTimerRef = useRef<number | undefined>(undefined);\n\n useEffect(() => {\n runtimeRef.current = runtime;\n controllerRef.current?.abort(new DOMException(\"Active Tool Runtime changed.\", \"AbortError\"));\n controllerRef.current = undefined;\n setTools(runtime.getApplicationTools());\n setSelectedName(undefined);\n setSelectedOwnerId(undefined);\n setInput(\"{}\");\n setResult(undefined);\n setRunning(false);\n setHistory([]);\n setRegions([]);\n setComponentSnapshot(emptyComponentSnapshot);\n }, [runtime]);\n\n useEffect(() => {\n const update = () => setTools(runtime.getApplicationTools());\n update();\n return runtime.on(\"toolchange\", update);\n }, [runtime]);\n useEffect(() => {\n const update = (event: Event) => {\n const execution = (event as Event & { detail: AgentToolExecutionEvent }).detail;\n setHistory((current) => {\n const next = current.filter(({ id }) => id !== execution.id);\n return [execution, ...next].slice(0, 20);\n });\n };\n runtime.addEventListener(\"toolexecution\", update);\n return () => runtime.removeEventListener(\"toolexecution\", update);\n }, [runtime]);\n useEffect(() => {\n if (selectedName && !tools.some(({ name }) => name === selectedName)) {\n setSelectedName(undefined);\n setResult(undefined);\n controllerRef.current?.abort(new Error(\"Tool unregistered.\"));\n }\n }, [selectedName, tools]);\n useEffect(() => {\n if (\n selectedOwnerId &&\n !componentSnapshot.owners.some(({ id }) => id === selectedOwnerId)\n ) {\n setSelectedOwnerId(undefined);\n }\n }, [componentSnapshot.owners, selectedOwnerId]);\n useEffect(() => () => controllerRef.current?.abort(), []);\n useEffect(() => () => {\n if (suppressTriggerClickTimerRef.current !== undefined) {\n window.clearTimeout(suppressTriggerClickTimerRef.current);\n }\n }, []);\n useEffect(() => {\n const resize = () => {\n if (!open && triggerRef.current) {\n const { width, height } = triggerRef.current.getBoundingClientRect();\n if (width > 0 && height > 0) triggerSizeRef.current = { width, height };\n }\n setAnchor((current) => {\n if (!open) return clampTriggerAnchor(current, triggerSizeRef.current);\n const size = panelSize();\n const position = clampPosition({\n x: current.x - size.width,\n y: current.y - size.height,\n });\n return {\n x: position.x + size.width,\n y: position.y + size.height,\n };\n });\n };\n window.addEventListener(\"resize\", resize);\n return () => window.removeEventListener(\"resize\", resize);\n }, [open]);\n useEffect(() => {\n if (open || !triggerRef.current) return;\n const { width, height } = triggerRef.current.getBoundingClientRect();\n if (width <= 0 || height <= 0) return;\n const size = { width, height };\n triggerSizeRef.current = size;\n setAnchor((current) => clampTriggerAnchor(current, size));\n }, [open]);\n useEffect(() => {\n if (!open) {\n setRegions([]);\n setComponentSnapshot(emptyComponentSnapshot);\n return;\n }\n let scheduled: number | undefined;\n let usesAnimationFrame = false;\n const resizeObserver = typeof ResizeObserver === \"undefined\"\n ? undefined\n : new ResizeObserver(() => refreshRects());\n const rebuild = () => {\n scheduled = undefined;\n const next = collectRuntimeToolSnapshot(\n reactDevtoolsRoots(),\n tools,\n overlayHost,\n );\n setRegions((current) => sameRegions(current, next.regions) ? current : next.regions);\n setComponentSnapshot((current) => {\n const components = { owners: next.owners, rootIds: next.rootIds };\n return sameComponentSnapshots(current, components) ? current : components;\n });\n resizeObserver?.disconnect();\n for (const element of new Set(next.regions.flatMap(({ elements }) => elements))) {\n resizeObserver?.observe(element);\n }\n };\n const scheduleRebuild = () => {\n if (scheduled !== undefined) return;\n if (typeof window.requestAnimationFrame === \"function\") {\n usesAnimationFrame = true;\n scheduled = window.requestAnimationFrame(rebuild);\n } else {\n usesAnimationFrame = false;\n scheduled = window.setTimeout(rebuild, 0);\n }\n };\n const refreshRects = () => {\n setRegions((current) => {\n const next = current.map((region) => ({\n ...region,\n rects: runtimeToolRegionRects(region.elements),\n }));\n return sameRegions(current, next) ? current : next;\n });\n };\n const unsubscribe = getNexfaceDevtoolsStore().subscribe(scheduleRebuild);\n const mutationObserver = new MutationObserver(scheduleRebuild);\n mutationObserver.observe(document.body, {\n attributes: true,\n childList: true,\n subtree: true,\n });\n window.addEventListener(\"resize\", refreshRects);\n window.addEventListener(\"scroll\", refreshRects, true);\n scheduleRebuild();\n return () => {\n unsubscribe();\n mutationObserver.disconnect();\n resizeObserver?.disconnect();\n window.removeEventListener(\"resize\", refreshRects);\n window.removeEventListener(\"scroll\", refreshRects, true);\n if (scheduled !== undefined) {\n if (usesAnimationFrame) window.cancelAnimationFrame(scheduled);\n else window.clearTimeout(scheduled);\n }\n };\n }, [open, overlayHost, tools]);\n\n const selected = tools.find(({ name }) => name === selectedName);\n const ownersById = useMemo(\n () => new Map(componentSnapshot.owners.map((owner) => [owner.id, owner])),\n [componentSnapshot.owners],\n );\n const selectedOwners = selectedName\n ? componentSnapshot.owners.filter(({ toolNames }) => toolNames.includes(selectedName))\n : [];\n const selectedOwner = selectedOwnerId ? ownersById.get(selectedOwnerId) : undefined;\n const selectTool = (name: string) => {\n setSelectedName(name);\n setInput(\"{}\");\n setResult(undefined);\n };\n const selectOwner = (id: string) => {\n setSelectedOwnerId(id);\n setActiveTab(\"components\");\n };\n const renderOwner = (id: string, depth = 0): ReactNode => {\n const owner = ownersById.get(id);\n if (!owner) return null;\n return (\n <div key={owner.id}>\n <button\n aria-label={`Inspect component ${owner.name}`}\n className={`component-node${selectedOwnerId === owner.id ? \" selected\" : \"\"}`}\n data-agent-component={owner.name}\n style={{ \"--depth\": depth } as CSSProperties}\n onClick={() => setSelectedOwnerId(owner.id)}\n >\n <span className=\"component-name\">{owner.name}</span>\n <span className=\"component-count\">{owner.toolNames.length}</span>\n </button>\n {owner.children.map((childId) => renderOwner(childId, depth + 1))}\n </div>\n );\n };\n const parsedInput = useMemo(() => {\n try {\n const value = JSON.parse(input) as unknown;\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return { error: \"Tool input must be a JSON object.\" };\n }\n return { value };\n } catch (error) {\n return { error: error instanceof Error ? error.message : \"Invalid JSON.\" };\n }\n }, [input]);\n\n const run = async (tool: AgentToolDefinition) => {\n if (!(\"value\" in parsedInput)) return;\n const controller = new AbortController();\n controllerRef.current = controller;\n setRunning(true);\n setResult(undefined);\n try {\n const nextResult = await runtime.executeApplicationTool(tool.name, parsedInput.value, {\n signal: controller.signal,\n });\n if (controllerRef.current === controller && runtimeRef.current === runtime) {\n setResult(nextResult);\n }\n } catch (error) {\n if (controllerRef.current === controller && runtimeRef.current === runtime) {\n setResult(error);\n }\n } finally {\n if (controllerRef.current === controller && runtimeRef.current === runtime) {\n controllerRef.current = undefined;\n setRunning(false);\n }\n }\n };\n\n const size = panelSize();\n const panelPosition = clampPosition({\n x: anchor.x - size.width,\n y: anchor.y - size.height,\n });\n const startDrag = (event: ReactPointerEvent<HTMLElement>) => {\n if ((event.target as Element).closest(\"button\")) return;\n event.currentTarget.setPointerCapture?.(event.pointerId);\n dragRef.current = {\n pointerId: event.pointerId,\n dx: event.clientX - panelPosition.x,\n dy: event.clientY - panelPosition.y,\n };\n };\n const drag = (event: ReactPointerEvent<HTMLElement>) => {\n const state = dragRef.current;\n if (!state || state.pointerId !== event.pointerId) return;\n const position = clampPosition({\n x: event.clientX - state.dx,\n y: event.clientY - state.dy,\n });\n setAnchor({\n x: position.x + size.width,\n y: position.y + size.height,\n });\n };\n const startTriggerDrag = (event: ReactPointerEvent<HTMLButtonElement>) => {\n if (!event.isPrimary || event.button !== 0) return;\n event.currentTarget.setPointerCapture?.(event.pointerId);\n if (suppressTriggerClickTimerRef.current !== undefined) {\n window.clearTimeout(suppressTriggerClickTimerRef.current);\n suppressTriggerClickTimerRef.current = undefined;\n }\n suppressTriggerClickRef.current = false;\n const { width, height } = event.currentTarget.getBoundingClientRect();\n const triggerSize = {\n width: width > 0 ? width : triggerSizeRef.current.width,\n height: height > 0 ? height : triggerSizeRef.current.height,\n };\n triggerSizeRef.current = triggerSize;\n triggerDragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n startY: event.clientY,\n startAnchor: anchor,\n triggerSize,\n moved: false,\n };\n };\n const dragTrigger = (event: ReactPointerEvent<HTMLButtonElement>) => {\n const state = triggerDragRef.current;\n if (!state || state.pointerId !== event.pointerId) return;\n const dx = event.clientX - state.startX;\n const dy = event.clientY - state.startY;\n if (!state.moved && dx * dx + dy * dy < dragThreshold * dragThreshold) return;\n state.moved = true;\n setAnchor(clampTriggerAnchor({\n x: state.startAnchor.x + dx,\n y: state.startAnchor.y + dy,\n }, state.triggerSize));\n };\n const endTriggerDrag = (event: ReactPointerEvent<HTMLButtonElement>) => {\n const state = triggerDragRef.current;\n if (!state || state.pointerId !== event.pointerId) return;\n suppressTriggerClickRef.current = state.moved;\n triggerDragRef.current = undefined;\n if (state.moved) {\n suppressTriggerClickTimerRef.current = window.setTimeout(() => {\n suppressTriggerClickRef.current = false;\n suppressTriggerClickTimerRef.current = undefined;\n }, 0);\n }\n };\n const cancelTriggerDrag = () => {\n if (!triggerDragRef.current) return;\n triggerDragRef.current = undefined;\n suppressTriggerClickRef.current = false;\n };\n const loseTriggerPointerCapture = () => {\n const state = triggerDragRef.current;\n if (!state) return;\n triggerDragRef.current = undefined;\n suppressTriggerClickRef.current = state.moved;\n };\n\n return (\n <div className=\"root\">\n {!open ? (\n <button\n className=\"trigger\"\n ref={triggerRef}\n style={{\n left: anchor.x,\n top: anchor.y,\n }}\n onClick={(event) => {\n if (suppressTriggerClickRef.current && event.detail !== 0) {\n suppressTriggerClickRef.current = false;\n return;\n }\n suppressTriggerClickRef.current = false;\n setOpen(true);\n }}\n onPointerDown={startTriggerDrag}\n onPointerMove={dragTrigger}\n onPointerUp={endTriggerDrag}\n onPointerCancel={cancelTriggerDrag}\n onLostPointerCapture={loseTriggerPointerCapture}\n >\n Nexface Inspector\n </button>\n ) : null}\n {open ? (\n <>\n {regions\n .filter(({ rects }) => rects.length > 0)\n .slice()\n .sort((left, right) => {\n const leftRect = unionRect(left.rects);\n const rightRect = unionRect(right.rects);\n return rightRect.width * rightRect.height - leftRect.width * leftRect.height;\n })\n .map((region) => {\n const rect = unionRect(region.rects);\n const selectedRegion = activeTab === \"components\"\n ? region.ownerIds.includes(selectedOwnerId ?? \"\")\n : region.toolNames.includes(selectedName ?? \"\");\n const color = selectedRegion ? \"#1769e0\" : \"#52a832\";\n const label = `${region.componentNames.join(\", \")} · ${region.toolNames.join(\", \")}`;\n const title = region.toolNames.map((name) => {\n const tool = tools.find((candidate) => candidate.name === name);\n return tool ? `${name}: ${tool.description}` : name;\n }).join(\"\\n\");\n return (\n <button\n aria-label={`Inspect ${region.componentNames.join(\", \")}`}\n className={`region${selectedRegion ? \" selected\" : \"\"}`}\n data-tool-overlay={region.toolNames.join(\" \")}\n key={region.id}\n title={title}\n style={{\n \"--color\": color,\n height: rect.height,\n left: rect.left,\n top: rect.top,\n width: rect.width,\n } as CSSProperties}\n onClick={() => {\n const name = region.toolNames[0];\n if (name) selectTool(name);\n setActiveTab(\"tools\");\n }}\n >\n <span\n className={`region-tag${rect.top < 30 ? \" inside\" : \"\"}`}\n style={{\n maxWidth: Math.min(\n 720,\n window.innerWidth - rect.left - viewportMargin,\n ),\n }}\n >\n {label}\n </span>\n </button>\n );\n })}\n <aside\n aria-label=\"Nexface Inspector\"\n className=\"panel\"\n style={{\n height: size.height,\n left: panelPosition.x,\n top: panelPosition.y,\n width: size.width,\n }}\n >\n <header\n className=\"header\"\n onPointerDown={startDrag}\n onPointerMove={drag}\n onPointerUp={() => {\n dragRef.current = undefined;\n }}\n onPointerCancel={() => {\n dragRef.current = undefined;\n }}\n >\n <strong>Nexface Inspector</strong>\n <button\n aria-label=\"Close Inspector\"\n className=\"close\"\n onClick={() => setOpen(false)}\n >\n ×\n </button>\n </header>\n <nav aria-label=\"Inspector views\" className=\"tabs\">\n <button\n className={`tab${activeTab === \"tools\" ? \" active\" : \"\"}`}\n onClick={() => setActiveTab(\"tools\")}\n >\n Page Tools\n </button>\n <button\n className={`tab${activeTab === \"components\" ? \" active\" : \"\"}`}\n onClick={() => setActiveTab(\"components\")}\n >\n Agent Components\n </button>\n </nav>\n {activeTab === \"tools\" ? (\n <div className=\"layout\">\n <div className=\"list\">\n {tools.map((tool) => (\n <button\n className={`tool${selectedName === tool.name ? \" selected\" : \"\"}`}\n key={tool.name}\n onClick={() => selectTool(tool.name)}\n >\n <span className=\"tool-name\">{tool.name}</span>\n <div className=\"tool-description\">{tool.description}</div>\n </button>\n ))}\n {tools.length === 0 ? (\n <div className=\"empty\">当前页面没有已注册能力</div>\n ) : null}\n </div>\n <div className=\"detail\">\n {selected ? (\n <>\n <h2>{selected.name}</h2>\n <p className=\"description\">{selected.description}</p>\n <section className=\"section\">\n <div className=\"section-title\">Registered by</div>\n <div className=\"owner-list\">\n {selectedOwners.map((owner) => (\n <button\n className=\"owner-link\"\n key={owner.id}\n onClick={() => selectOwner(owner.id)}\n >\n {owner.name}\n {owner.renderless ? \" · Renderless\" : \"\"}\n </button>\n ))}\n {selectedOwners.length === 0 ? (\n <div className=\"description\">Component owner is unavailable.</div>\n ) : null}\n </div>\n </section>\n <section className=\"section\">\n <div className=\"section-title\">Input schema</div>\n <pre>{pretty(selected.inputSchema)}</pre>\n </section>\n <section className=\"section\">\n <div className=\"section-title\">Run Tool</div>\n <textarea value={input} onChange={(event) => setInput(event.target.value)} />\n {parsedInput.error ? (\n <div className=\"error\">{parsedInput.error}</div>\n ) : null}\n <div className=\"actions\">\n {running ? (\n <button\n className=\"cancel\"\n onClick={() => controllerRef.current?.abort()}\n >\n Cancel\n </button>\n ) : null}\n <button\n className=\"run\"\n disabled={running || !(\"value\" in parsedInput)}\n onClick={() => void run(selected)}\n >\n Run Tool\n </button>\n </div>\n {result !== undefined ? <pre>{pretty(result)}</pre> : null}\n </section>\n <section className=\"section\">\n <div className=\"section-title\">Execution history</div>\n <div className=\"history\">\n {history.filter(({ name }) => name === selected.name).map((event) => (\n <div className=\"history-row\" key={event.id}>\n <span>{event.name}</span>\n <span>{event.status}</span>\n </div>\n ))}\n </div>\n </section>\n </>\n ) : <div className=\"empty\">Select a capability to inspect it.</div>}\n </div>\n </div>\n ) : (\n <div className=\"layout\">\n <div className=\"component-tree\">\n {componentSnapshot.rootIds.map((id) => renderOwner(id))}\n {componentSnapshot.rootIds.length === 0 ? (\n <div className=\"empty\">当前页面没有 Agent Components</div>\n ) : null}\n </div>\n <div className=\"detail\">\n {selectedOwner ? (\n <>\n <div>\n <h2>{selectedOwner.name}</h2>\n {selectedOwner.renderless ? (\n <span className=\"renderless\">Renderless</span>\n ) : null}\n </div>\n <section className=\"section\">\n <div className=\"section-title\">Registered Tools</div>\n <div className=\"component-tools\">\n {selectedOwner.toolNames.map((name) => {\n const tool = tools.find((candidate) => candidate.name === name);\n return (\n <button\n className=\"component-tool\"\n key={name}\n onClick={() => {\n selectTool(name);\n setActiveTab(\"tools\");\n }}\n >\n <span className=\"tool-name\">{name}</span>\n {tool ? (\n <div className=\"tool-description\">{tool.description}</div>\n ) : null}\n </button>\n );\n })}\n </div>\n </section>\n </>\n ) : <div className=\"empty\">Select an Agent Component to inspect it.</div>}\n </div>\n </div>\n )}\n </aside>\n </>\n ) : null}\n </div>\n );\n}\n\nexport function AgentInspectorPanel({\n defaultOpen = false,\n offset = { right: 24, bottom: 88 },\n}: AgentInspectorProps) {\n const [portal, setPortal] = useState<{\n host: HTMLDivElement;\n root: HTMLDivElement;\n }>();\n useEffect(() => {\n const host = document.createElement(\"div\");\n host.dataset.nexfaceInspector = \"true\";\n host.setAttribute(\"data-nexface-ignore\", \"\");\n const shadow = host.attachShadow({ mode: \"open\" });\n const style = document.createElement(\"style\");\n style.textContent = styles;\n const root = document.createElement(\"div\");\n shadow.append(style, root);\n document.body.append(host);\n setPortal({ host, root });\n return () => host.remove();\n }, []);\n if (!portal) return null;\n return createPortal(\n <RuntimeInspector\n defaultOpen={defaultOpen}\n offset={offset}\n overlayHost={portal.host}\n />,\n portal.root,\n );\n}\n"]}
1
+ {"version":3,"file":"panel.js","sourceRoot":"","sources":["../src/panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAMvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,GAIvB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDd,CAAC;AAEF,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjD,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,C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CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,YAAY,CACjB,oBAAC,gBAAgB,IACf,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,CAAC,IAAI,GACxB,EACF,MAAM,CAAC,IAAI,CACZ,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"react\";\nimport {\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { useInternalToolRuntime } from \"@nexface/tools/internal/react\";\nimport type {\n AgentToolExecutionEvent,\n} from \"@nexface/tools/internal\";\nimport type { AgentToolDefinition } from \"@nexface/tools\";\n\nimport { getNexfaceDevtoolsStore } from \"./react-devtools-store.js\";\nimport {\n collectRuntimeToolSnapshot,\n reactDevtoolsRoots,\n runtimeToolRegionRects,\n type RuntimeToolComponentSnapshot,\n type RuntimeToolOwner,\n type RuntimeToolRegion,\n} from \"./react-tree.js\";\n\nexport interface AgentInspectorProps {\n defaultOpen?: boolean;\n offset?: { right: number; bottom: number };\n}\n\nconst styles = `\n:host { all: initial; }\n* { box-sizing: border-box; }\nbutton, textarea { font: inherit; }\n.root { color: #202124; font: 13px/1.45 -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; }\n.region { position: fixed; z-index: 2147482998; padding: 0; border: 3px solid var(--color); border-radius: 8px; background: color-mix(in srgb, var(--color) 9%, transparent); box-shadow: 0 0 0 1px rgba(255,255,255,.85); cursor: pointer; }\n.region:hover, .region.selected { z-index: 2147483000; border-width: 4px; background: color-mix(in srgb, var(--color) 16%, transparent); }\n.region-tag { position: absolute; top: -27px; left: -3px; max-width: min(720px, calc(100vw - 32px)); padding: 3px 8px; border-radius: 6px 6px 6px 0; background: var(--color); color: #fff; font: 700 12px/19px ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.region-tag.inside { top: 3px; left: 3px; border-radius: 5px; }\n.trigger { position: fixed; z-index: 2147483002; max-width: calc(100vw - 32px); height: 42px; padding: 0 16px; transform: translate(-100%, -100%); overflow: hidden; border: 1px solid #d9dde5; border-radius: 22px; background: #fff; color: #1769e0; box-shadow: 0 8px 24px rgba(31,35,41,.18); cursor: grab; font-weight: 700; text-overflow: ellipsis; touch-action: none; user-select: none; white-space: nowrap; }\n.trigger:active { cursor: grabbing; }\n.panel { position: fixed; z-index: 2147483001; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #dfe3ea; border-radius: 14px; background: #fff; box-shadow: 0 18px 52px rgba(31,35,41,.25); }\n.header { display: flex; min-height: 56px; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid #e6e9ef; cursor: grab; user-select: none; touch-action: none; }\n.header:active { cursor: grabbing; }\n.header strong { font-size: 17px; }\n.close { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: #5f6673; cursor: pointer; font-size: 20px; }\n.close:hover { background: #f2f4f7; }\n.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid #e6e9ef; }\n.tab { position: relative; padding: 11px 9px 10px; border: 0; background: transparent; color: #646b78; cursor: pointer; font-weight: 700; }\n.tab.active { color: #1769e0; }\n.tab.active::after { position: absolute; right: 8px; bottom: -1px; left: 8px; height: 2px; background: #1769e0; content: \"\"; }\n.layout { display: grid; min-height: 0; flex: 1; grid-template-columns: 280px minmax(0, 1fr); }\n.list { min-height: 0; overflow: auto; padding: 14px; border-right: 1px solid #e6e9ef; }\n.tool { display: block; width: 100%; margin-bottom: 8px; padding: 11px; border: 1px solid #e2e6ed; border-radius: 9px; background: #fff; text-align: left; cursor: pointer; }\n.tool:hover, .tool.selected { border-color: #91b9f6; background: #f8fbff; }\n.tool-name { font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }\n.tool-description { margin-top: 5px; color: #646b78; }\n.detail { min-width: 0; overflow: auto; padding: 18px; }\n.detail h2 { margin: 0; font: 750 17px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }\n.description { margin: 8px 0 0; color: #646b78; }\n.owner-list { display: grid; gap: 7px; margin-top: 9px; }\n.owner-link { width: 100%; padding: 8px 10px; border: 1px solid #dfe4ec; border-radius: 8px; background: #fff; color: #1769e0; text-align: left; cursor: pointer; font: 700 12px ui-monospace, SFMono-Regular, Menlo, monospace; }\n.owner-link:hover { border-color: #91b9f6; background: #f8fbff; }\n.component-tree { min-height: 0; overflow: auto; padding: 14px; border-right: 1px solid #e6e9ef; }\n.component-node { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 7px; margin-bottom: 5px; padding: 7px 9px 7px calc(9px + var(--depth) * 18px); border: 0; border-radius: 7px; background: transparent; color: #202124; text-align: left; cursor: pointer; }\n.component-node:hover, .component-node.selected { background: #eef5ff; }\n.component-name { min-width: 0; flex: 1; overflow: hidden; font: 700 12px ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }\n.component-count { flex: none; color: #737b88; font-size: 11px; }\n.component-tools { display: grid; gap: 8px; margin-top: 10px; }\n.component-tool { width: 100%; padding: 10px; border: 1px solid #e2e6ed; border-radius: 8px; background: #fff; text-align: left; cursor: pointer; }\n.component-tool:hover { border-color: #91b9f6; background: #f8fbff; }\n.renderless { margin-left: 8px; padding: 2px 7px; border-radius: 999px; background: #f1ebff; color: #6f42c1; font-size: 11px; font-weight: 700; }\n.section { margin-top: 18px; padding-top: 16px; border-top: 1px solid #eceef2; }\n.section-title { font-weight: 750; }\npre { max-height: 180px; margin: 9px 0 0; overflow: auto; padding: 10px; border-radius: 8px; background: #f6f7f9; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }\ntextarea { width: 100%; min-height: 96px; margin-top: 9px; padding: 9px; border: 1px solid #d9dde5; border-radius: 7px; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }\n.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }\n.run, .cancel { min-width: 92px; height: 36px; border-radius: 8px; cursor: pointer; font-weight: 700; }\n.run { border: 0; background: #1769e0; color: #fff; }\n.run:disabled { background: #b6c9e8; cursor: not-allowed; }\n.cancel { border: 1px solid #d84a4a; background: #fff; color: #c62828; }\n.error { margin-top: 8px; color: #c62828; }\n.history { display: grid; gap: 6px; margin-top: 9px; }\n.history-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 9px; border-radius: 7px; background: #f6f7f9; }\n.empty { display: grid; min-height: 120px; place-items: center; color: #8a919d; text-align: center; }\n@media (max-width: 620px) { .layout { grid-template-columns: 1fr; } .list { max-height: 190px; border-right: 0; border-bottom: 1px solid #e6e9ef; } }\n`;\n\nfunction pretty(value: unknown): string {\n if (value instanceof Error) {\n return JSON.stringify({\n name: value.name,\n message: value.message,\n ...(\"code\" in value ? { code: value.code } : {}),\n }, null, 2);\n }\n try {\n return JSON.stringify(value, null, 2) ?? String(value);\n } catch {\n return String(value);\n }\n}\n\nconst viewportMargin = 16;\n\nfunction panelSize() {\n return {\n width: Math.min(760, Math.max(0, window.innerWidth - viewportMargin * 2)),\n height: Math.min(620, Math.max(0, window.innerHeight - 112)),\n };\n}\n\nfunction clampPosition(position: { x: number; y: number }) {\n const { width, height } = panelSize();\n return {\n x: Math.min(\n Math.max(viewportMargin, position.x),\n Math.max(viewportMargin, window.innerWidth - width - viewportMargin),\n ),\n y: Math.min(\n Math.max(viewportMargin, position.y),\n Math.max(viewportMargin, window.innerHeight - height - viewportMargin),\n ),\n };\n}\n\nfunction initialAnchor(offset: { right: number; bottom: number }) {\n return {\n x: window.innerWidth - offset.right,\n y: window.innerHeight - offset.bottom,\n };\n}\n\nfunction clampTriggerAnchor(\n anchor: { x: number; y: number },\n size: { width: number; height: number },\n) {\n return {\n x: Math.min(\n Math.max(viewportMargin + size.width, anchor.x),\n Math.max(viewportMargin + size.width, window.innerWidth - viewportMargin),\n ),\n y: Math.min(\n Math.max(viewportMargin + size.height, anchor.y),\n Math.max(viewportMargin + size.height, window.innerHeight - viewportMargin),\n ),\n };\n}\n\nfunction unionRect(rects: readonly DOMRect[]): DOMRect {\n const left = Math.min(...rects.map((rect) => rect.left));\n const top = Math.min(...rects.map((rect) => rect.top));\n const right = Math.max(...rects.map((rect) => rect.right));\n const bottom = Math.max(...rects.map((rect) => rect.bottom));\n return new DOMRect(left, top, right - left, bottom - top);\n}\n\nfunction sameRect(left: DOMRect, right: DOMRect): boolean {\n return left.left === right.left && left.top === right.top &&\n left.width === right.width && left.height === right.height;\n}\n\nfunction sameRegions(\n left: readonly RuntimeToolRegion[],\n right: readonly RuntimeToolRegion[],\n): boolean {\n return left.length === right.length && left.every((region, index) => {\n const candidate = right[index];\n return candidate?.id === region.id &&\n candidate.ownerIds.length === region.ownerIds.length &&\n candidate.ownerIds.every((id, ownerIndex) => id === region.ownerIds[ownerIndex]) &&\n candidate.componentNames.length === region.componentNames.length &&\n candidate.componentNames.every(\n (name, nameIndex) => name === region.componentNames[nameIndex],\n ) &&\n candidate.toolNames.length === region.toolNames.length &&\n candidate.toolNames.every((name, nameIndex) => name === region.toolNames[nameIndex]) &&\n candidate.elements.length === region.elements.length &&\n candidate.elements.every((element, elementIndex) => element === region.elements[elementIndex]) &&\n candidate.rects.length === region.rects.length &&\n candidate.rects.every((rect, rectIndex) => sameRect(rect, region.rects[rectIndex]!));\n });\n}\n\nconst emptyComponentSnapshot: RuntimeToolComponentSnapshot = {\n owners: [],\n rootIds: [],\n};\n\nconst dragThreshold = 6;\n\nfunction sameOwners(left: readonly RuntimeToolOwner[], right: readonly RuntimeToolOwner[]) {\n return left.length === right.length && left.every((owner, index) => {\n const candidate = right[index];\n return candidate?.id === owner.id && candidate.name === owner.name &&\n candidate.parentId === owner.parentId && candidate.renderless === owner.renderless &&\n candidate.children.length === owner.children.length &&\n candidate.children.every((id, childIndex) => id === owner.children[childIndex]) &&\n candidate.toolNames.length === owner.toolNames.length &&\n candidate.toolNames.every((name, toolIndex) => name === owner.toolNames[toolIndex]);\n });\n}\n\nfunction sameComponentSnapshots(\n left: RuntimeToolComponentSnapshot,\n right: RuntimeToolComponentSnapshot,\n) {\n return left.rootIds.length === right.rootIds.length &&\n left.rootIds.every((id, index) => id === right.rootIds[index]) &&\n sameOwners(left.owners, right.owners);\n}\n\nfunction RuntimeInspector({\n defaultOpen,\n offset,\n overlayHost,\n}: Required<AgentInspectorProps> & { overlayHost: HTMLElement }) {\n const runtime = useInternalToolRuntime();\n const [open, setOpen] = useState(defaultOpen);\n const [activeTab, setActiveTab] = useState<\"tools\" | \"components\">(\"tools\");\n const [tools, setTools] = useState(() => runtime.getApplicationTools());\n const [selectedName, setSelectedName] = useState<string>();\n const [selectedOwnerId, setSelectedOwnerId] = useState<string>();\n const [input, setInput] = useState(\"{}\");\n const [result, setResult] = useState<unknown>();\n const [running, setRunning] = useState(false);\n const [history, setHistory] = useState<AgentToolExecutionEvent[]>([]);\n const [regions, setRegions] = useState<RuntimeToolRegion[]>([]);\n const [componentSnapshot, setComponentSnapshot] = useState<RuntimeToolComponentSnapshot>(\n emptyComponentSnapshot,\n );\n const controllerRef = useRef<AbortController | undefined>(undefined);\n const runtimeRef = useRef(runtime);\n const [anchor, setAnchor] = useState(() => initialAnchor(offset));\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const triggerSizeRef = useRef({ width: 0, height: 42 });\n const dragRef = useRef<{\n pointerId: number;\n dx: number;\n dy: number;\n } | undefined>(undefined);\n const triggerDragRef = useRef<{\n pointerId: number;\n startX: number;\n startY: number;\n startAnchor: { x: number; y: number };\n triggerSize: { width: number; height: number };\n moved: boolean;\n } | undefined>(undefined);\n const suppressTriggerClickRef = useRef(false);\n const suppressTriggerClickTimerRef = useRef<number | undefined>(undefined);\n\n useEffect(() => {\n runtimeRef.current = runtime;\n controllerRef.current?.abort(new DOMException(\"Active Tool Runtime changed.\", \"AbortError\"));\n controllerRef.current = undefined;\n setTools(runtime.getApplicationTools());\n setSelectedName(undefined);\n setSelectedOwnerId(undefined);\n setInput(\"{}\");\n setResult(undefined);\n setRunning(false);\n setHistory([]);\n setRegions([]);\n setComponentSnapshot(emptyComponentSnapshot);\n }, [runtime]);\n\n useEffect(() => {\n const update = () => setTools(runtime.getApplicationTools());\n update();\n return runtime.on(\"toolchange\", update);\n }, [runtime]);\n useEffect(() => {\n const update = (event: Event) => {\n const execution = (event as Event & { detail: AgentToolExecutionEvent }).detail;\n setHistory((current) => {\n const next = current.filter(({ id }) => id !== execution.id);\n return [execution, ...next].slice(0, 20);\n });\n };\n runtime.addEventListener(\"toolexecution\", update);\n return () => runtime.removeEventListener(\"toolexecution\", update);\n }, [runtime]);\n useEffect(() => {\n if (selectedName && !tools.some(({ name }) => name === selectedName)) {\n setSelectedName(undefined);\n setResult(undefined);\n controllerRef.current?.abort(new Error(\"Tool unregistered.\"));\n }\n }, [selectedName, tools]);\n useEffect(() => {\n if (\n selectedOwnerId &&\n !componentSnapshot.owners.some(({ id }) => id === selectedOwnerId)\n ) {\n setSelectedOwnerId(undefined);\n }\n }, [componentSnapshot.owners, selectedOwnerId]);\n useEffect(() => () => controllerRef.current?.abort(), []);\n useEffect(() => () => {\n if (suppressTriggerClickTimerRef.current !== undefined) {\n window.clearTimeout(suppressTriggerClickTimerRef.current);\n }\n }, []);\n useEffect(() => {\n const resize = () => {\n if (!open && triggerRef.current) {\n const { width, height } = triggerRef.current.getBoundingClientRect();\n if (width > 0 && height > 0) triggerSizeRef.current = { width, height };\n }\n setAnchor((current) => {\n if (!open) return clampTriggerAnchor(current, triggerSizeRef.current);\n const size = panelSize();\n const position = clampPosition({\n x: current.x - size.width,\n y: current.y - size.height,\n });\n return {\n x: position.x + size.width,\n y: position.y + size.height,\n };\n });\n };\n window.addEventListener(\"resize\", resize);\n return () => window.removeEventListener(\"resize\", resize);\n }, [open]);\n useEffect(() => {\n if (open || !triggerRef.current) return;\n const { width, height } = triggerRef.current.getBoundingClientRect();\n if (width <= 0 || height <= 0) return;\n const size = { width, height };\n triggerSizeRef.current = size;\n setAnchor((current) => clampTriggerAnchor(current, size));\n }, [open]);\n useEffect(() => {\n if (!open) {\n setRegions([]);\n setComponentSnapshot(emptyComponentSnapshot);\n return;\n }\n let scheduled: number | undefined;\n let usesAnimationFrame = false;\n const resizeObserver = typeof ResizeObserver === \"undefined\"\n ? undefined\n : new ResizeObserver(() => refreshRects());\n const rebuild = () => {\n scheduled = undefined;\n const next = collectRuntimeToolSnapshot(\n reactDevtoolsRoots(),\n tools,\n overlayHost,\n );\n setRegions((current) => sameRegions(current, next.regions) ? current : next.regions);\n setComponentSnapshot((current) => {\n const components = { owners: next.owners, rootIds: next.rootIds };\n return sameComponentSnapshots(current, components) ? current : components;\n });\n resizeObserver?.disconnect();\n for (const element of new Set(next.regions.flatMap(({ elements }) => elements))) {\n resizeObserver?.observe(element);\n }\n };\n const scheduleRebuild = () => {\n if (scheduled !== undefined) return;\n if (typeof window.requestAnimationFrame === \"function\") {\n usesAnimationFrame = true;\n scheduled = window.requestAnimationFrame(rebuild);\n } else {\n usesAnimationFrame = false;\n scheduled = window.setTimeout(rebuild, 0);\n }\n };\n const refreshRects = () => {\n setRegions((current) => {\n const next = current.map((region) => ({\n ...region,\n rects: runtimeToolRegionRects(region.elements),\n }));\n return sameRegions(current, next) ? current : next;\n });\n };\n const unsubscribe = getNexfaceDevtoolsStore().subscribe(scheduleRebuild);\n const mutationObserver = new MutationObserver(scheduleRebuild);\n mutationObserver.observe(document.body, {\n attributes: true,\n childList: true,\n subtree: true,\n });\n window.addEventListener(\"resize\", refreshRects);\n window.addEventListener(\"scroll\", refreshRects, true);\n scheduleRebuild();\n return () => {\n unsubscribe();\n mutationObserver.disconnect();\n resizeObserver?.disconnect();\n window.removeEventListener(\"resize\", refreshRects);\n window.removeEventListener(\"scroll\", refreshRects, true);\n if (scheduled !== undefined) {\n if (usesAnimationFrame) window.cancelAnimationFrame(scheduled);\n else window.clearTimeout(scheduled);\n }\n };\n }, [open, overlayHost, tools]);\n\n const selected = tools.find(({ name }) => name === selectedName);\n const ownersById = useMemo(\n () => new Map(componentSnapshot.owners.map((owner) => [owner.id, owner])),\n [componentSnapshot.owners],\n );\n const selectedOwners = selectedName\n ? componentSnapshot.owners.filter(({ toolNames }) => toolNames.includes(selectedName))\n : [];\n const selectedOwner = selectedOwnerId ? ownersById.get(selectedOwnerId) : undefined;\n const selectTool = (name: string) => {\n setSelectedName(name);\n setInput(\"{}\");\n setResult(undefined);\n };\n const selectOwner = (id: string) => {\n setSelectedOwnerId(id);\n setActiveTab(\"components\");\n };\n const renderOwner = (id: string, depth = 0): ReactNode => {\n const owner = ownersById.get(id);\n if (!owner) return null;\n return (\n <div key={owner.id}>\n <button\n aria-label={`Inspect component ${owner.name}`}\n className={`component-node${selectedOwnerId === owner.id ? \" selected\" : \"\"}`}\n data-agent-component={owner.name}\n style={{ \"--depth\": depth } as CSSProperties}\n onClick={() => setSelectedOwnerId(owner.id)}\n >\n <span className=\"component-name\">{owner.name}</span>\n <span className=\"component-count\">{owner.toolNames.length}</span>\n </button>\n {owner.children.map((childId) => renderOwner(childId, depth + 1))}\n </div>\n );\n };\n const parsedInput = useMemo(() => {\n try {\n const value = JSON.parse(input) as unknown;\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return { error: \"Tool input must be a JSON object.\" };\n }\n return { value };\n } catch (error) {\n return { error: error instanceof Error ? error.message : \"Invalid JSON.\" };\n }\n }, [input]);\n\n const run = async (tool: AgentToolDefinition) => {\n if (!(\"value\" in parsedInput)) return;\n const controller = new AbortController();\n controllerRef.current = controller;\n setRunning(true);\n setResult(undefined);\n try {\n const nextResult = await runtime.executeApplicationTool(tool.name, parsedInput.value, {\n signal: controller.signal,\n });\n if (controllerRef.current === controller && runtimeRef.current === runtime) {\n setResult(nextResult);\n }\n } catch (error) {\n if (controllerRef.current === controller && runtimeRef.current === runtime) {\n setResult(error);\n }\n } finally {\n if (controllerRef.current === controller && runtimeRef.current === runtime) {\n controllerRef.current = undefined;\n setRunning(false);\n }\n }\n };\n\n const size = panelSize();\n const panelPosition = clampPosition({\n x: anchor.x - size.width,\n y: anchor.y - size.height,\n });\n const startDrag = (event: ReactPointerEvent<HTMLElement>) => {\n if ((event.target as Element).closest(\"button\")) return;\n event.currentTarget.setPointerCapture?.(event.pointerId);\n dragRef.current = {\n pointerId: event.pointerId,\n dx: event.clientX - panelPosition.x,\n dy: event.clientY - panelPosition.y,\n };\n };\n const drag = (event: ReactPointerEvent<HTMLElement>) => {\n const state = dragRef.current;\n if (!state || state.pointerId !== event.pointerId) return;\n const position = clampPosition({\n x: event.clientX - state.dx,\n y: event.clientY - state.dy,\n });\n setAnchor({\n x: position.x + size.width,\n y: position.y + size.height,\n });\n };\n const startTriggerDrag = (event: ReactPointerEvent<HTMLButtonElement>) => {\n if (!event.isPrimary || event.button !== 0) return;\n event.currentTarget.setPointerCapture?.(event.pointerId);\n if (suppressTriggerClickTimerRef.current !== undefined) {\n window.clearTimeout(suppressTriggerClickTimerRef.current);\n suppressTriggerClickTimerRef.current = undefined;\n }\n suppressTriggerClickRef.current = false;\n const { width, height } = event.currentTarget.getBoundingClientRect();\n const triggerSize = {\n width: width > 0 ? width : triggerSizeRef.current.width,\n height: height > 0 ? height : triggerSizeRef.current.height,\n };\n triggerSizeRef.current = triggerSize;\n triggerDragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n startY: event.clientY,\n startAnchor: anchor,\n triggerSize,\n moved: false,\n };\n };\n const dragTrigger = (event: ReactPointerEvent<HTMLButtonElement>) => {\n const state = triggerDragRef.current;\n if (!state || state.pointerId !== event.pointerId) return;\n const dx = event.clientX - state.startX;\n const dy = event.clientY - state.startY;\n if (!state.moved && dx * dx + dy * dy < dragThreshold * dragThreshold) return;\n state.moved = true;\n setAnchor(clampTriggerAnchor({\n x: state.startAnchor.x + dx,\n y: state.startAnchor.y + dy,\n }, state.triggerSize));\n };\n const endTriggerDrag = (event: ReactPointerEvent<HTMLButtonElement>) => {\n const state = triggerDragRef.current;\n if (!state || state.pointerId !== event.pointerId) return;\n suppressTriggerClickRef.current = state.moved;\n triggerDragRef.current = undefined;\n if (state.moved) {\n suppressTriggerClickTimerRef.current = window.setTimeout(() => {\n suppressTriggerClickRef.current = false;\n suppressTriggerClickTimerRef.current = undefined;\n }, 0);\n }\n };\n const cancelTriggerDrag = () => {\n if (!triggerDragRef.current) return;\n triggerDragRef.current = undefined;\n suppressTriggerClickRef.current = false;\n };\n const loseTriggerPointerCapture = () => {\n const state = triggerDragRef.current;\n if (!state) return;\n triggerDragRef.current = undefined;\n suppressTriggerClickRef.current = state.moved;\n };\n\n return (\n <div className=\"root\">\n {!open ? (\n <button\n className=\"trigger\"\n ref={triggerRef}\n style={{\n left: anchor.x,\n top: anchor.y,\n }}\n onClick={(event) => {\n if (suppressTriggerClickRef.current && event.detail !== 0) {\n suppressTriggerClickRef.current = false;\n return;\n }\n suppressTriggerClickRef.current = false;\n setOpen(true);\n }}\n onPointerDown={startTriggerDrag}\n onPointerMove={dragTrigger}\n onPointerUp={endTriggerDrag}\n onPointerCancel={cancelTriggerDrag}\n onLostPointerCapture={loseTriggerPointerCapture}\n >\n Nexface Inspector\n </button>\n ) : null}\n {open ? (\n <>\n {regions\n .filter(({ rects }) => rects.length > 0)\n .slice()\n .sort((left, right) => {\n const leftRect = unionRect(left.rects);\n const rightRect = unionRect(right.rects);\n return rightRect.width * rightRect.height - leftRect.width * leftRect.height;\n })\n .map((region) => {\n const rect = unionRect(region.rects);\n const selectedRegion = activeTab === \"components\"\n ? region.ownerIds.includes(selectedOwnerId ?? \"\")\n : region.toolNames.includes(selectedName ?? \"\");\n const color = selectedRegion ? \"#1769e0\" : \"#52a832\";\n const label = `${region.componentNames.join(\", \")} · ${region.toolNames.join(\", \")}`;\n const title = region.toolNames.map((name) => {\n const tool = tools.find((candidate) => candidate.name === name);\n return tool ? `${name}: ${tool.description}` : name;\n }).join(\"\\n\");\n return (\n <button\n aria-label={`Inspect ${region.componentNames.join(\", \")}`}\n className={`region${selectedRegion ? \" selected\" : \"\"}`}\n data-tool-overlay={region.toolNames.join(\" \")}\n key={region.id}\n title={title}\n style={{\n \"--color\": color,\n height: rect.height,\n left: rect.left,\n top: rect.top,\n width: rect.width,\n } as CSSProperties}\n onClick={() => {\n const name = region.toolNames[0];\n if (name) selectTool(name);\n setActiveTab(\"tools\");\n }}\n >\n <span\n className={`region-tag${rect.top < 30 ? \" inside\" : \"\"}`}\n style={{\n maxWidth: Math.min(\n 720,\n window.innerWidth - rect.left - viewportMargin,\n ),\n }}\n >\n {label}\n </span>\n </button>\n );\n })}\n <aside\n aria-label=\"Nexface Inspector\"\n className=\"panel\"\n style={{\n height: size.height,\n left: panelPosition.x,\n top: panelPosition.y,\n width: size.width,\n }}\n >\n <header\n className=\"header\"\n onPointerDown={startDrag}\n onPointerMove={drag}\n onPointerUp={() => {\n dragRef.current = undefined;\n }}\n onPointerCancel={() => {\n dragRef.current = undefined;\n }}\n >\n <strong>Nexface Inspector</strong>\n <button\n aria-label=\"Close Inspector\"\n className=\"close\"\n onClick={() => setOpen(false)}\n >\n ×\n </button>\n </header>\n <nav aria-label=\"Inspector views\" className=\"tabs\">\n <button\n className={`tab${activeTab === \"tools\" ? \" active\" : \"\"}`}\n onClick={() => setActiveTab(\"tools\")}\n >\n Page Tools\n </button>\n <button\n className={`tab${activeTab === \"components\" ? \" active\" : \"\"}`}\n onClick={() => setActiveTab(\"components\")}\n >\n Agent Components\n </button>\n </nav>\n {activeTab === \"tools\" ? (\n <div className=\"layout\">\n <div className=\"list\">\n {tools.map((tool) => (\n <button\n className={`tool${selectedName === tool.name ? \" selected\" : \"\"}`}\n key={tool.name}\n onClick={() => selectTool(tool.name)}\n >\n <span className=\"tool-name\">{tool.name}</span>\n <div className=\"tool-description\">{tool.description}</div>\n </button>\n ))}\n {tools.length === 0 ? (\n <div className=\"empty\">当前页面没有已注册能力</div>\n ) : null}\n </div>\n <div className=\"detail\">\n {selected ? (\n <>\n <h2>{selected.name}</h2>\n <p className=\"description\">{selected.description}</p>\n <section className=\"section\">\n <div className=\"section-title\">Registered by</div>\n <div className=\"owner-list\">\n {selectedOwners.map((owner) => (\n <button\n className=\"owner-link\"\n key={owner.id}\n onClick={() => selectOwner(owner.id)}\n >\n {owner.name}\n {owner.renderless ? \" · Renderless\" : \"\"}\n </button>\n ))}\n {selectedOwners.length === 0 ? (\n <div className=\"description\">Component owner is unavailable.</div>\n ) : null}\n </div>\n </section>\n <section className=\"section\">\n <div className=\"section-title\">Input schema</div>\n <pre>{pretty(selected.inputSchema)}</pre>\n </section>\n <section className=\"section\">\n <div className=\"section-title\">Run Tool</div>\n <textarea value={input} onChange={(event) => setInput(event.target.value)} />\n {parsedInput.error ? (\n <div className=\"error\">{parsedInput.error}</div>\n ) : null}\n <div className=\"actions\">\n {running ? (\n <button\n className=\"cancel\"\n onClick={() => controllerRef.current?.abort()}\n >\n Cancel\n </button>\n ) : null}\n <button\n className=\"run\"\n disabled={running || !(\"value\" in parsedInput)}\n onClick={() => void run(selected)}\n >\n Run Tool\n </button>\n </div>\n {result !== undefined ? <pre>{pretty(result)}</pre> : null}\n </section>\n <section className=\"section\">\n <div className=\"section-title\">Execution history</div>\n <div className=\"history\">\n {history.filter(({ name }) => name === selected.name).map((event) => (\n <div className=\"history-row\" key={event.id}>\n <span>{event.name}</span>\n <span>{event.status}</span>\n </div>\n ))}\n </div>\n </section>\n </>\n ) : <div className=\"empty\">Select a capability to inspect it.</div>}\n </div>\n </div>\n ) : (\n <div className=\"layout\">\n <div className=\"component-tree\">\n {componentSnapshot.rootIds.map((id) => renderOwner(id))}\n {componentSnapshot.rootIds.length === 0 ? (\n <div className=\"empty\">当前页面没有 Agent Components</div>\n ) : null}\n </div>\n <div className=\"detail\">\n {selectedOwner ? (\n <>\n <div>\n <h2>{selectedOwner.name}</h2>\n {selectedOwner.renderless ? (\n <span className=\"renderless\">Renderless</span>\n ) : null}\n </div>\n <section className=\"section\">\n <div className=\"section-title\">Registered Tools</div>\n <div className=\"component-tools\">\n {selectedOwner.toolNames.map((name) => {\n const tool = tools.find((candidate) => candidate.name === name);\n return (\n <button\n className=\"component-tool\"\n key={name}\n onClick={() => {\n selectTool(name);\n setActiveTab(\"tools\");\n }}\n >\n <span className=\"tool-name\">{name}</span>\n {tool ? (\n <div className=\"tool-description\">{tool.description}</div>\n ) : null}\n </button>\n );\n })}\n </div>\n </section>\n </>\n ) : <div className=\"empty\">Select an Agent Component to inspect it.</div>}\n </div>\n </div>\n )}\n </aside>\n </>\n ) : null}\n </div>\n );\n}\n\nexport function AgentInspectorPanel({\n defaultOpen = false,\n offset = { right: 24, bottom: 88 },\n}: AgentInspectorProps) {\n const [portal, setPortal] = useState<{\n host: HTMLDivElement;\n root: HTMLDivElement;\n }>();\n useEffect(() => {\n const host = document.createElement(\"div\");\n host.dataset.nexfaceInspector = \"true\";\n host.setAttribute(\"data-nexface-ignore\", \"\");\n const shadow = host.attachShadow({ mode: \"open\" });\n const style = document.createElement(\"style\");\n style.textContent = styles;\n const root = document.createElement(\"div\");\n shadow.append(style, root);\n document.body.append(host);\n setPortal({ host, root });\n return () => host.remove();\n }, []);\n if (!portal) return null;\n return createPortal(\n <RuntimeInspector\n defaultOpen={defaultOpen}\n offset={offset}\n overlayHost={portal.host}\n />,\n portal.root,\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexface/inspector",
3
- "version": "0.1.8",
3
+ "version": "0.1.9-alpha.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -13,9 +13,9 @@
13
13
  }
14
14
  },
15
15
  "peerDependencies": {
16
- "@nexface/tools": "0.1.8",
17
- "react": ">=18",
18
- "react-dom": ">=18"
16
+ "@nexface/tools": "0.1.9-alpha.1",
17
+ "react": ">=17",
18
+ "react-dom": ">=17"
19
19
  },
20
20
  "files": [
21
21
  "dist"