sunpeak 0.20.35 → 0.20.36
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/bin/commands/inspect.mjs +16 -14
- package/bin/commands/test-init.mjs +57 -44
- package/bin/lib/test/test-fixtures.d.mts +9 -1
- package/bin/lib/test/test-fixtures.mjs +25 -7
- package/dist/chatgpt/index.cjs +1 -1
- package/dist/chatgpt/index.js +1 -1
- package/dist/claude/index.cjs +1 -1
- package/dist/claude/index.js +1 -1
- package/dist/embed.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/inspector/app-types.d.ts +6 -4
- package/dist/inspector/index.cjs +1 -1
- package/dist/inspector/index.js +1 -1
- package/dist/inspector/inspector.d.ts +5 -4
- package/dist/inspector/simple-sidebar.d.ts +20 -6
- package/dist/inspector/use-inspector-state.d.ts +4 -0
- package/dist/{inspector-DQ_vv1wj.cjs → inspector-BNWla95w.cjs} +291 -145
- package/dist/{inspector-DQ_vv1wj.cjs.map → inspector-BNWla95w.cjs.map} +1 -1
- package/dist/{inspector-D0TWNx_T.js → inspector-CiuT_2yA.js} +291 -145
- package/dist/{inspector-D0TWNx_T.js.map → inspector-CiuT_2yA.js.map} +1 -1
- package/dist/style.css +6 -24
- package/package.json +1 -1
- package/template/dist/albums/albums.html +1 -1
- package/template/dist/albums/albums.json +1 -1
- package/template/dist/carousel/carousel.html +1 -1
- package/template/dist/carousel/carousel.json +1 -1
- package/template/dist/map/map.html +1 -1
- package/template/dist/map/map.json +1 -1
- package/template/dist/review/review.html +1 -1
- package/template/dist/review/review.json +1 -1
- package/template/tests/e2e/visual.spec.ts +0 -8
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-linux.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-linux.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-chatgpt-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-chatgpt-linux.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-darwin.png +0 -0
- package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-linux.png +0 -0
|
@@ -6434,6 +6434,7 @@ function IframeResource({ src, scriptSrc, html, hostContext, toolInput, toolInpu
|
|
|
6434
6434
|
var DEFAULT_THEME = "dark";
|
|
6435
6435
|
var DEFAULT_DISPLAY_MODE = "inline";
|
|
6436
6436
|
var DEFAULT_PLATFORM = "desktop";
|
|
6437
|
+
var DEFAULT_SIDEBAR_WIDTH$1 = 260;
|
|
6437
6438
|
/**
|
|
6438
6439
|
* Parse URL params for initial inspector values.
|
|
6439
6440
|
* Supported params:
|
|
@@ -6560,6 +6561,8 @@ function sanitizeStoredPrefs(raw) {
|
|
|
6560
6561
|
if (typeof obj.hover === "boolean") prefs.hover = obj.hover;
|
|
6561
6562
|
if (typeof obj.touch === "boolean") prefs.touch = obj.touch;
|
|
6562
6563
|
if (typeof obj.screenWidth === "string" && VALID_SCREEN_WIDTHS.has(obj.screenWidth)) prefs.screenWidth = obj.screenWidth;
|
|
6564
|
+
if (typeof obj.sidebarWidth === "number" && Number.isFinite(obj.sidebarWidth)) prefs.sidebarWidth = Math.max(DEFAULT_SIDEBAR_WIDTH$1, Math.round(obj.sidebarWidth));
|
|
6565
|
+
if (typeof obj.rightSidebarWidth === "number" && Number.isFinite(obj.rightSidebarWidth)) prefs.rightSidebarWidth = Math.max(DEFAULT_SIDEBAR_WIDTH$1, Math.round(obj.rightSidebarWidth));
|
|
6563
6566
|
return prefs;
|
|
6564
6567
|
}
|
|
6565
6568
|
function readStoredPrefs() {
|
|
@@ -6590,29 +6593,31 @@ function deriveContainerDimensions({ displayMode, containerHeight, containerWidt
|
|
|
6590
6593
|
if (measuredContentWidth != null) return { maxWidth: measuredContentWidth };
|
|
6591
6594
|
}
|
|
6592
6595
|
function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolDataOnSimulationChange = false }) {
|
|
6593
|
-
const simulationNames = Object.keys(simulations).
|
|
6596
|
+
const simulationNames = Object.keys(simulations).sort((a, b) => {
|
|
6594
6597
|
const simA = simulations[a];
|
|
6595
6598
|
const simB = simulations[b];
|
|
6596
|
-
const resourceLabelA = simA.resource.title || simA.resource.name;
|
|
6597
|
-
const resourceLabelB = simB.resource.title || simB.resource.name;
|
|
6598
|
-
const labelA = `${resourceLabelA}
|
|
6599
|
-
const labelB = `${resourceLabelB}
|
|
6599
|
+
const resourceLabelA = simA.resource ? `${simA.resource.title || simA.resource.name}: ` : "";
|
|
6600
|
+
const resourceLabelB = simB.resource ? `${simB.resource.title || simB.resource.name}: ` : "";
|
|
6601
|
+
const labelA = `${resourceLabelA}${simA.tool.title || simA.tool.name}`;
|
|
6602
|
+
const labelB = `${resourceLabelB}${simB.tool.title || simB.tool.name}`;
|
|
6600
6603
|
return labelA.localeCompare(labelB);
|
|
6601
6604
|
});
|
|
6605
|
+
const defaultSimulationName = simulationNames.find((name) => !!simulations[name]?.resource) ?? simulationNames[0] ?? "";
|
|
6602
6606
|
const urlParams = useMemo(() => parseUrlParams(), []);
|
|
6603
6607
|
const autoRun = urlParams.autoRun === true;
|
|
6604
6608
|
const storedPrefs = useMemo(() => autoRun ? {} : readStoredPrefs(), [autoRun]);
|
|
6605
6609
|
const [screenWidth, setScreenWidth] = useState(storedPrefs.screenWidth ?? "full");
|
|
6610
|
+
const [sidebarWidth, setSidebarWidth] = useState(storedPrefs.sidebarWidth ?? DEFAULT_SIDEBAR_WIDTH$1);
|
|
6611
|
+
const [rightSidebarWidth, setRightSidebarWidth] = useState(storedPrefs.rightSidebarWidth ?? DEFAULT_SIDEBAR_WIDTH$1);
|
|
6606
6612
|
const isMobileWidth = (width) => width === "mobile-s" || width === "mobile-l";
|
|
6607
6613
|
const [activeHost, setActiveHost] = useState(urlParams.host ?? storedPrefs.activeHost ?? defaultHost);
|
|
6608
6614
|
const [selectedSimulationName, setSelectedSimulationName] = useState(useMemo(() => {
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
return urlParams.simulation in simulations ? urlParams.simulation : defaultName;
|
|
6615
|
+
if (!urlParams.simulation) return defaultSimulationName;
|
|
6616
|
+
return urlParams.simulation in simulations ? urlParams.simulation : defaultSimulationName;
|
|
6612
6617
|
}, [
|
|
6613
6618
|
urlParams.simulation,
|
|
6614
6619
|
simulations,
|
|
6615
|
-
|
|
6620
|
+
defaultSimulationName
|
|
6616
6621
|
]));
|
|
6617
6622
|
const selectedSim = simulations[selectedSimulationName];
|
|
6618
6623
|
const [theme, setTheme] = useState(urlParams.theme ?? storedPrefs.theme ?? DEFAULT_THEME);
|
|
@@ -6651,7 +6656,9 @@ function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolD
|
|
|
6651
6656
|
platform,
|
|
6652
6657
|
hover,
|
|
6653
6658
|
touch,
|
|
6654
|
-
screenWidth
|
|
6659
|
+
screenWidth,
|
|
6660
|
+
sidebarWidth,
|
|
6661
|
+
rightSidebarWidth
|
|
6655
6662
|
};
|
|
6656
6663
|
localStorage.setItem(PREFS_KEY, JSON.stringify(prefs));
|
|
6657
6664
|
} catch {}
|
|
@@ -6667,7 +6674,9 @@ function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolD
|
|
|
6667
6674
|
platform,
|
|
6668
6675
|
hover,
|
|
6669
6676
|
touch,
|
|
6670
|
-
screenWidth
|
|
6677
|
+
screenWidth,
|
|
6678
|
+
sidebarWidth,
|
|
6679
|
+
rightSidebarWidth
|
|
6671
6680
|
]);
|
|
6672
6681
|
const [measuredContentWidth, setMeasuredContentWidth] = useState(void 0);
|
|
6673
6682
|
const handleContentWidthChange = useCallback((width) => {
|
|
@@ -6752,6 +6761,8 @@ function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolD
|
|
|
6752
6761
|
}
|
|
6753
6762
|
if (editingField !== "modelContext") {
|
|
6754
6763
|
setModelContext(null);
|
|
6764
|
+
setModelAppContext(null);
|
|
6765
|
+
setModelContextJson("null");
|
|
6755
6766
|
setModelContextError("");
|
|
6756
6767
|
}
|
|
6757
6768
|
}, [
|
|
@@ -6828,6 +6839,10 @@ function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolD
|
|
|
6828
6839
|
setActiveHost,
|
|
6829
6840
|
screenWidth,
|
|
6830
6841
|
setScreenWidth,
|
|
6842
|
+
sidebarWidth,
|
|
6843
|
+
setSidebarWidth,
|
|
6844
|
+
rightSidebarWidth,
|
|
6845
|
+
setRightSidebarWidth,
|
|
6831
6846
|
theme,
|
|
6832
6847
|
setTheme,
|
|
6833
6848
|
displayMode,
|
|
@@ -7058,9 +7073,10 @@ var useThemeContext = () => {
|
|
|
7058
7073
|
if (context === void 0) throw new Error("useThemeContext must be used within a ThemeProvider");
|
|
7059
7074
|
return context;
|
|
7060
7075
|
};
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7076
|
+
function clampSidebarWidth(rawWidth, viewportWidth) {
|
|
7077
|
+
const maxWidth = Math.floor(viewportWidth / 3);
|
|
7078
|
+
return Math.max(260, Math.min(maxWidth, rawWidth));
|
|
7079
|
+
}
|
|
7064
7080
|
function ChevronRightIcon() {
|
|
7065
7081
|
return /* @__PURE__ */ jsx("svg", {
|
|
7066
7082
|
width: "1em",
|
|
@@ -7074,19 +7090,34 @@ function ChevronRightIcon() {
|
|
|
7074
7090
|
})
|
|
7075
7091
|
});
|
|
7076
7092
|
}
|
|
7077
|
-
function SimpleSidebar({ children, controls, headerRight, rootRef, fillParent = false }) {
|
|
7093
|
+
function SimpleSidebar({ children, controls, rightControls, sidebarWidth, rightSidebarWidth, onSidebarWidthChange, onRightSidebarWidthChange, headerRight, rootRef, fillParent = false }) {
|
|
7078
7094
|
const [isDrawerOpen, setIsDrawerOpen] = React.useState(false);
|
|
7079
|
-
const [
|
|
7095
|
+
const [internalSidebarWidth, setInternalSidebarWidth] = React.useState(260);
|
|
7096
|
+
const [internalRightSidebarWidth, setInternalRightSidebarWidth] = React.useState(260);
|
|
7080
7097
|
const [isResizing, setIsResizing] = React.useState(false);
|
|
7098
|
+
const [isResizingRight, setIsResizingRight] = React.useState(false);
|
|
7099
|
+
const effectiveSidebarWidth = sidebarWidth ?? internalSidebarWidth;
|
|
7100
|
+
const effectiveRightSidebarWidth = rightSidebarWidth ?? internalRightSidebarWidth;
|
|
7101
|
+
const setSidebarWidth = React.useCallback((width) => {
|
|
7102
|
+
setInternalSidebarWidth(width);
|
|
7103
|
+
onSidebarWidthChange?.(width);
|
|
7104
|
+
}, [onSidebarWidthChange]);
|
|
7105
|
+
const setRightSidebarWidth = React.useCallback((width) => {
|
|
7106
|
+
setInternalRightSidebarWidth(width);
|
|
7107
|
+
onRightSidebarWidthChange?.(width);
|
|
7108
|
+
}, [onRightSidebarWidthChange]);
|
|
7081
7109
|
const handleMouseDown = React.useCallback((e) => {
|
|
7082
7110
|
e.preventDefault();
|
|
7083
7111
|
setIsResizing(true);
|
|
7084
7112
|
}, []);
|
|
7113
|
+
const handleRightMouseDown = React.useCallback((e) => {
|
|
7114
|
+
e.preventDefault();
|
|
7115
|
+
setIsResizingRight(true);
|
|
7116
|
+
}, []);
|
|
7085
7117
|
React.useEffect(() => {
|
|
7086
7118
|
if (!isResizing) return;
|
|
7087
7119
|
const handleMouseMove = (e) => {
|
|
7088
|
-
|
|
7089
|
-
setSidebarWidth(Math.min(maxWidth, Math.max(DEFAULT_SIDEBAR_WIDTH, e.clientX)));
|
|
7120
|
+
setSidebarWidth(clampSidebarWidth(e.clientX, window.innerWidth));
|
|
7090
7121
|
};
|
|
7091
7122
|
const handleMouseUp = () => {
|
|
7092
7123
|
setIsResizing(false);
|
|
@@ -7097,12 +7128,27 @@ function SimpleSidebar({ children, controls, headerRight, rootRef, fillParent =
|
|
|
7097
7128
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
7098
7129
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
7099
7130
|
};
|
|
7100
|
-
}, [isResizing]);
|
|
7131
|
+
}, [isResizing, setSidebarWidth]);
|
|
7132
|
+
React.useEffect(() => {
|
|
7133
|
+
if (!isResizingRight) return;
|
|
7134
|
+
const handleMouseMove = (e) => {
|
|
7135
|
+
setRightSidebarWidth(clampSidebarWidth(window.innerWidth - e.clientX, window.innerWidth));
|
|
7136
|
+
};
|
|
7137
|
+
const handleMouseUp = () => {
|
|
7138
|
+
setIsResizingRight(false);
|
|
7139
|
+
};
|
|
7140
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
7141
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
7142
|
+
return () => {
|
|
7143
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
7144
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
7145
|
+
};
|
|
7146
|
+
}, [isResizingRight, setRightSidebarWidth]);
|
|
7101
7147
|
return /* @__PURE__ */ jsxs("div", {
|
|
7102
7148
|
ref: rootRef,
|
|
7103
7149
|
className: `sunpeak-inspector-root flex ${fillParent ? "h-full w-full" : "h-screen w-full"} overflow-hidden relative`,
|
|
7104
7150
|
children: [
|
|
7105
|
-
isResizing && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-50 cursor-col-resize" }),
|
|
7151
|
+
(isResizing || isResizingRight) && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-50 cursor-col-resize" }),
|
|
7106
7152
|
isDrawerOpen && /* @__PURE__ */ jsx("div", {
|
|
7107
7153
|
className: "md:hidden fixed inset-0 bg-black/50 z-40 pointer-events-auto",
|
|
7108
7154
|
onClick: (e) => {
|
|
@@ -7118,7 +7164,7 @@ function SimpleSidebar({ children, controls, headerRight, rootRef, fillParent =
|
|
|
7118
7164
|
${isDrawerOpen ? "max-md:translate-x-0" : "max-md:-translate-x-full"}
|
|
7119
7165
|
`,
|
|
7120
7166
|
style: {
|
|
7121
|
-
width:
|
|
7167
|
+
width: effectiveSidebarWidth,
|
|
7122
7168
|
borderRight: "1px solid var(--color-border-primary)"
|
|
7123
7169
|
},
|
|
7124
7170
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -7171,19 +7217,69 @@ function SimpleSidebar({ children, controls, headerRight, rootRef, fillParent =
|
|
|
7171
7217
|
"aria-label": "Open sidebar",
|
|
7172
7218
|
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
7173
7219
|
}), children]
|
|
7220
|
+
}),
|
|
7221
|
+
rightControls && /* @__PURE__ */ jsxs("aside", {
|
|
7222
|
+
className: "relative hidden md:flex flex-col bg-sidebar",
|
|
7223
|
+
style: {
|
|
7224
|
+
width: effectiveRightSidebarWidth,
|
|
7225
|
+
borderLeft: "1px solid var(--color-border-primary)"
|
|
7226
|
+
},
|
|
7227
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
7228
|
+
className: "flex-1 min-h-0 overflow-y-auto px-3 pb-3 pt-2",
|
|
7229
|
+
children: rightControls
|
|
7230
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
7231
|
+
onMouseDown: handleRightMouseDown,
|
|
7232
|
+
className: "hidden md:block absolute top-0 left-0 w-1 h-full cursor-col-resize hover:bg-black/10 dark:hover:bg-white/10 active:bg-black/20 dark:active:bg-white/20 transition-colors"
|
|
7233
|
+
})]
|
|
7174
7234
|
})
|
|
7175
7235
|
]
|
|
7176
7236
|
});
|
|
7177
7237
|
}
|
|
7178
7238
|
var DOCS_BASE_URL$1 = "https://sunpeak.ai/docs";
|
|
7179
|
-
function HelpIcon({ tooltip, docsPath }) {
|
|
7239
|
+
function HelpIcon({ tooltip, docsPath, placement = "right" }) {
|
|
7240
|
+
const linkRef = React.useRef(null);
|
|
7241
|
+
const [isTooltipVisible, setIsTooltipVisible] = React.useState(false);
|
|
7242
|
+
const [tooltipPosition, setTooltipPosition] = React.useState({
|
|
7243
|
+
left: 0,
|
|
7244
|
+
top: 0
|
|
7245
|
+
});
|
|
7246
|
+
const tooltipOffset = 8;
|
|
7247
|
+
const tooltipTransform = placement === "left" ? "translate(-100%, -50%)" : "translateY(-50%)";
|
|
7248
|
+
const setTooltipFromPoint = React.useCallback((clientX, clientY) => {
|
|
7249
|
+
setTooltipPosition({
|
|
7250
|
+
left: placement === "left" ? clientX - tooltipOffset : clientX + tooltipOffset,
|
|
7251
|
+
top: clientY
|
|
7252
|
+
});
|
|
7253
|
+
}, [placement]);
|
|
7254
|
+
const setTooltipFromIcon = React.useCallback(() => {
|
|
7255
|
+
const rect = linkRef.current?.getBoundingClientRect();
|
|
7256
|
+
if (!rect) return;
|
|
7257
|
+
setTooltipPosition({
|
|
7258
|
+
left: placement === "left" ? rect.left - tooltipOffset : rect.right + tooltipOffset,
|
|
7259
|
+
top: rect.top + rect.height / 2
|
|
7260
|
+
});
|
|
7261
|
+
}, [placement]);
|
|
7180
7262
|
return /* @__PURE__ */ jsxs("a", {
|
|
7263
|
+
ref: linkRef,
|
|
7181
7264
|
href: `${DOCS_BASE_URL$1}/${docsPath}`,
|
|
7182
7265
|
target: "_blank",
|
|
7183
7266
|
rel: "noopener noreferrer",
|
|
7184
7267
|
"aria-label": tooltip,
|
|
7185
7268
|
className: "group relative inline-flex items-center justify-center no-underline flex-shrink-0 transition-colors",
|
|
7186
7269
|
style: { color: "var(--color-text-tertiary, var(--color-text-secondary))" },
|
|
7270
|
+
onMouseEnter: (e) => {
|
|
7271
|
+
setIsTooltipVisible(true);
|
|
7272
|
+
setTooltipFromPoint(e.clientX, e.clientY);
|
|
7273
|
+
},
|
|
7274
|
+
onMouseMove: (e) => {
|
|
7275
|
+
setTooltipFromPoint(e.clientX, e.clientY);
|
|
7276
|
+
},
|
|
7277
|
+
onMouseLeave: () => setIsTooltipVisible(false),
|
|
7278
|
+
onFocus: () => {
|
|
7279
|
+
setIsTooltipVisible(true);
|
|
7280
|
+
setTooltipFromIcon();
|
|
7281
|
+
},
|
|
7282
|
+
onBlur: () => setIsTooltipVisible(false),
|
|
7187
7283
|
onClick: (e) => e.stopPropagation(),
|
|
7188
7284
|
children: [/* @__PURE__ */ jsxs("svg", {
|
|
7189
7285
|
width: "12",
|
|
@@ -7209,8 +7305,11 @@ function HelpIcon({ tooltip, docsPath }) {
|
|
|
7209
7305
|
})]
|
|
7210
7306
|
}), /* @__PURE__ */ jsx("span", {
|
|
7211
7307
|
"aria-hidden": "true",
|
|
7212
|
-
className:
|
|
7308
|
+
className: `pointer-events-none fixed z-[1000] whitespace-nowrap rounded px-2 py-1 text-[11px] font-normal leading-tight ${isTooltipVisible ? "block" : "hidden"}`,
|
|
7213
7309
|
style: {
|
|
7310
|
+
left: tooltipPosition.left,
|
|
7311
|
+
top: tooltipPosition.top,
|
|
7312
|
+
transform: tooltipTransform,
|
|
7214
7313
|
backgroundColor: "var(--color-text-primary)",
|
|
7215
7314
|
color: "var(--color-background-primary)"
|
|
7216
7315
|
},
|
|
@@ -7218,7 +7317,7 @@ function HelpIcon({ tooltip, docsPath }) {
|
|
|
7218
7317
|
})]
|
|
7219
7318
|
});
|
|
7220
7319
|
}
|
|
7221
|
-
function SidebarControl({ label, children, tooltip, docsPath, "data-testid": testId }) {
|
|
7320
|
+
function SidebarControl({ label, children, tooltip, tooltipPlacement, docsPath, "data-testid": testId }) {
|
|
7222
7321
|
return /* @__PURE__ */ jsxs("div", {
|
|
7223
7322
|
className: "space-y-1",
|
|
7224
7323
|
"data-testid": testId,
|
|
@@ -7227,15 +7326,17 @@ function SidebarControl({ label, children, tooltip, docsPath, "data-testid": tes
|
|
|
7227
7326
|
style: { color: "var(--color-text-secondary)" },
|
|
7228
7327
|
children: [label, tooltip && docsPath && /* @__PURE__ */ jsx(HelpIcon, {
|
|
7229
7328
|
tooltip,
|
|
7230
|
-
docsPath
|
|
7329
|
+
docsPath,
|
|
7330
|
+
placement: tooltipPlacement
|
|
7231
7331
|
})]
|
|
7232
7332
|
}), children]
|
|
7233
7333
|
});
|
|
7234
7334
|
}
|
|
7235
|
-
function SidebarCollapsibleControl({ label, children, defaultCollapsed = true, tooltip, docsPath, "data-testid": testId }) {
|
|
7335
|
+
function SidebarCollapsibleControl({ label, children, defaultCollapsed = true, className, contentClassName, style, tooltip, tooltipPlacement, docsPath, "data-testid": testId }) {
|
|
7236
7336
|
const [isCollapsed, setIsCollapsed] = React.useState(defaultCollapsed);
|
|
7237
7337
|
return /* @__PURE__ */ jsxs("div", {
|
|
7238
|
-
className: "space-y-1",
|
|
7338
|
+
className: className ? `space-y-1 ${className}` : "space-y-1",
|
|
7339
|
+
style: isCollapsed ? void 0 : style,
|
|
7239
7340
|
"data-testid": testId,
|
|
7240
7341
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
7241
7342
|
onClick: () => setIsCollapsed(!isCollapsed),
|
|
@@ -7246,13 +7347,17 @@ function SidebarCollapsibleControl({ label, children, defaultCollapsed = true, t
|
|
|
7246
7347
|
className: "inline-flex items-center gap-1",
|
|
7247
7348
|
children: [label, tooltip && docsPath && /* @__PURE__ */ jsx(HelpIcon, {
|
|
7248
7349
|
tooltip,
|
|
7249
|
-
docsPath
|
|
7350
|
+
docsPath,
|
|
7351
|
+
placement: tooltipPlacement
|
|
7250
7352
|
})]
|
|
7251
7353
|
}), /* @__PURE__ */ jsx("span", {
|
|
7252
7354
|
className: "text-[8px]",
|
|
7253
7355
|
children: isCollapsed ? "▶" : "▼"
|
|
7254
7356
|
})]
|
|
7255
|
-
}), !isCollapsed &&
|
|
7357
|
+
}), !isCollapsed && /* @__PURE__ */ jsx("div", {
|
|
7358
|
+
className: contentClassName,
|
|
7359
|
+
children
|
|
7360
|
+
})]
|
|
7256
7361
|
});
|
|
7257
7362
|
}
|
|
7258
7363
|
var formElementStyle = {
|
|
@@ -7327,7 +7432,7 @@ function SidebarInput({ value, onChange, applyOnBlur = false, autoComplete, plac
|
|
|
7327
7432
|
}
|
|
7328
7433
|
});
|
|
7329
7434
|
}
|
|
7330
|
-
function SidebarCheckbox({ checked, onChange, label, tooltip, docsPath }) {
|
|
7435
|
+
function SidebarCheckbox({ checked, onChange, label, tooltip, tooltipPlacement, docsPath }) {
|
|
7331
7436
|
const id = React.useId();
|
|
7332
7437
|
return /* @__PURE__ */ jsxs("div", {
|
|
7333
7438
|
className: "flex items-center gap-1.5",
|
|
@@ -7347,24 +7452,25 @@ function SidebarCheckbox({ checked, onChange, label, tooltip, docsPath }) {
|
|
|
7347
7452
|
}),
|
|
7348
7453
|
tooltip && docsPath && /* @__PURE__ */ jsx(HelpIcon, {
|
|
7349
7454
|
tooltip,
|
|
7350
|
-
docsPath
|
|
7455
|
+
docsPath,
|
|
7456
|
+
placement: tooltipPlacement
|
|
7351
7457
|
})
|
|
7352
7458
|
]
|
|
7353
7459
|
});
|
|
7354
7460
|
}
|
|
7355
|
-
function SidebarTextarea({ value, onChange, onFocus, onBlur, placeholder, maxRows = 8, error, "data-testid": testId }) {
|
|
7461
|
+
function SidebarTextarea({ value, onChange, onFocus, onBlur, placeholder, maxRows = 8, fill = false, error, "data-testid": testId }) {
|
|
7356
7462
|
const contentRows = value?.split("\n").length ?? 1;
|
|
7357
7463
|
return /* @__PURE__ */ jsxs("div", {
|
|
7358
|
-
className: "space-y-0.5",
|
|
7464
|
+
className: fill ? "flex h-full min-h-0 flex-col gap-0.5" : "space-y-0.5",
|
|
7359
7465
|
children: [/* @__PURE__ */ jsx("textarea", {
|
|
7360
7466
|
value,
|
|
7361
7467
|
onChange: (e) => onChange(e.target.value),
|
|
7362
7468
|
onFocus,
|
|
7363
7469
|
onBlur,
|
|
7364
7470
|
placeholder,
|
|
7365
|
-
rows: Math.min(contentRows, maxRows),
|
|
7471
|
+
rows: fill ? void 0 : Math.min(contentRows, maxRows),
|
|
7366
7472
|
"data-testid": testId,
|
|
7367
|
-
className:
|
|
7473
|
+
className: `w-full text-[10px] font-mono rounded-md px-2 py-1.5 outline-none ${fill ? "h-full min-h-0 flex-1 resize-none" : "resize-y"}`,
|
|
7368
7474
|
style: {
|
|
7369
7475
|
...formElementStyle,
|
|
7370
7476
|
cursor: "text",
|
|
@@ -7453,10 +7559,9 @@ function flattenAppToSimulations(app) {
|
|
|
7453
7559
|
}
|
|
7454
7560
|
for (const appTool of app.tools) {
|
|
7455
7561
|
const uri = getOutputTemplate(appTool.tool._meta);
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
const mcpResource = toMcpResource(resource);
|
|
7562
|
+
const resource = uri ? resourcesByUri.get(uri) : void 0;
|
|
7563
|
+
if (uri && !resource) console.warn(`[Inspector] Tool '${appTool.tool.name}' references unknown resource URI '${uri}'. The tool remains callable but has no UI to render.`);
|
|
7564
|
+
const mcpResource = resource ? toMcpResource(resource) : void 0;
|
|
7460
7565
|
const sims = appTool.simulations && appTool.simulations.length > 0 ? appTool.simulations : [{ name: appTool.tool.name }];
|
|
7461
7566
|
for (const sim of sims) {
|
|
7462
7567
|
const key = `${appTool.tool.name}__${sim.name}`;
|
|
@@ -7464,10 +7569,12 @@ function flattenAppToSimulations(app) {
|
|
|
7464
7569
|
result[key] = {
|
|
7465
7570
|
name: key,
|
|
7466
7571
|
displayName: sim.name,
|
|
7467
|
-
|
|
7572
|
+
...resource ? {
|
|
7573
|
+
resourceHtml: resource.html,
|
|
7574
|
+
resource: mcpResource
|
|
7575
|
+
} : {},
|
|
7468
7576
|
userMessage: sim.userMessage,
|
|
7469
7577
|
tool: appTool.tool,
|
|
7470
|
-
resource: mcpResource,
|
|
7471
7578
|
toolInput: sim.toolInput,
|
|
7472
7579
|
toolResult: sim.toolResult,
|
|
7473
7580
|
serverTools: sim.serverTools
|
|
@@ -7543,7 +7650,6 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
7543
7650
|
const toolMap = React.useMemo(() => {
|
|
7544
7651
|
const map = /* @__PURE__ */ new Map();
|
|
7545
7652
|
for (const [simName, sim] of Object.entries(simulations)) {
|
|
7546
|
-
if (!sim.resource) continue;
|
|
7547
7653
|
const toolName = sim.tool.name;
|
|
7548
7654
|
if (!map.has(toolName)) map.set(toolName, {
|
|
7549
7655
|
tool: sim.tool,
|
|
@@ -7552,6 +7658,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
7552
7658
|
fixtureSimNames: []
|
|
7553
7659
|
});
|
|
7554
7660
|
const info = map.get(toolName);
|
|
7661
|
+
if (!info.resource && sim.resource) info.resource = sim.resource;
|
|
7555
7662
|
info.simNames.push(simName);
|
|
7556
7663
|
if (hasFixtureData(sim)) info.fixtureSimNames.push(simName);
|
|
7557
7664
|
}
|
|
@@ -7564,6 +7671,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
7564
7671
|
const labelB = infoB.tool.title || b;
|
|
7565
7672
|
return labelA.localeCompare(labelB);
|
|
7566
7673
|
}), [toolMap]);
|
|
7674
|
+
const defaultToolName = React.useMemo(() => toolNames.find((name) => !!toolMap.get(name)?.resource) ?? toolNames[0] ?? "", [toolMap, toolNames]);
|
|
7567
7675
|
const initUrlParams = React.useMemo(() => {
|
|
7568
7676
|
if (typeof window === "undefined") return {
|
|
7569
7677
|
tool: null,
|
|
@@ -7584,12 +7692,12 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
7584
7692
|
if (initUrlParams.simulation) {
|
|
7585
7693
|
for (const [toolName, info] of toolMap) if (info.simNames.includes(initUrlParams.simulation)) return toolName;
|
|
7586
7694
|
}
|
|
7587
|
-
return
|
|
7695
|
+
return defaultToolName;
|
|
7588
7696
|
});
|
|
7589
7697
|
const prevToolNamesRef = React.useRef(toolNames);
|
|
7590
7698
|
if (prevToolNamesRef.current !== toolNames) {
|
|
7591
7699
|
prevToolNamesRef.current = toolNames;
|
|
7592
|
-
if (toolNames.length > 0 && !toolMap.has(selectedToolName)) setSelectedToolName(
|
|
7700
|
+
if (toolNames.length > 0 && !toolMap.has(selectedToolName)) setSelectedToolName(defaultToolName);
|
|
7593
7701
|
}
|
|
7594
7702
|
const selectedToolInfo = toolMap.get(selectedToolName);
|
|
7595
7703
|
const [activeSimulationName, setActiveSimulationName] = React.useState(() => {
|
|
@@ -7613,6 +7721,12 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
7613
7721
|
defaultHost,
|
|
7614
7722
|
preserveToolDataOnSimulationChange: isLiveMcpRender
|
|
7615
7723
|
});
|
|
7724
|
+
const resetAppContextForSelectionChange = () => {
|
|
7725
|
+
state.setModelContext(null);
|
|
7726
|
+
state.setModelAppContext(null);
|
|
7727
|
+
state.setModelContextJson("null");
|
|
7728
|
+
state.setModelContextError("");
|
|
7729
|
+
};
|
|
7616
7730
|
const [serverUrl, setServerUrl] = React.useState(mcpServerUrl ?? "");
|
|
7617
7731
|
const [authType, setAuthType] = React.useState("none");
|
|
7618
7732
|
const [bearerToken, setBearerToken] = React.useState("");
|
|
@@ -7628,7 +7742,6 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
7628
7742
|
const [isRunning, setIsRunning] = React.useState(false);
|
|
7629
7743
|
const [hasRun, setHasRun] = React.useState(false);
|
|
7630
7744
|
const [showCheck, setShowCheck] = React.useState(false);
|
|
7631
|
-
const prodResourcesId = React.useId();
|
|
7632
7745
|
const [serverPreviewGeneration, setServerPreviewGeneration] = React.useState(0);
|
|
7633
7746
|
const checkTimerRef = React.useRef(void 0);
|
|
7634
7747
|
const oauthCleanupRef = React.useRef(void 0);
|
|
@@ -7668,7 +7781,14 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
7668
7781
|
const [chatStatus, setChatStatus] = React.useState("");
|
|
7669
7782
|
const currentModelProvider = React.useMemo(() => modelProviderOptions.find((provider) => provider.id === modelProvider), [modelProvider, modelProviderOptions]);
|
|
7670
7783
|
const selectedProviderModelOptions = React.useMemo(() => currentModelProvider?.models ?? [], [currentModelProvider?.models]);
|
|
7671
|
-
const modelCallableTools = React.useMemo(() =>
|
|
7784
|
+
const modelCallableTools = React.useMemo(() => {
|
|
7785
|
+
const map = /* @__PURE__ */ new Map();
|
|
7786
|
+
for (const sim of Object.values(simulations)) {
|
|
7787
|
+
if (!isToolVisibleToModel(sim.tool) || map.has(sim.tool.name)) continue;
|
|
7788
|
+
map.set(sim.tool.name, sim.tool);
|
|
7789
|
+
}
|
|
7790
|
+
return Array.from(map.values());
|
|
7791
|
+
}, [simulations]);
|
|
7672
7792
|
React.useEffect(() => {
|
|
7673
7793
|
setServerUrl(mcpServerUrl ?? "");
|
|
7674
7794
|
}, [mcpServerUrl]);
|
|
@@ -8088,7 +8208,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8088
8208
|
const assistantMessage = {
|
|
8089
8209
|
id: `assistant-${Date.now()}`,
|
|
8090
8210
|
role: "assistant",
|
|
8091
|
-
content: data.text ?? (
|
|
8211
|
+
content: data.text ?? (rendersApp ? "I called the MCP tool and rendered the app below." : toolCalls.length > 0 ? "I called the MCP tool." : "The model returned an empty response."),
|
|
8092
8212
|
toolCalls: toolCalls.map((call) => ({
|
|
8093
8213
|
name: call.name,
|
|
8094
8214
|
arguments: call.arguments,
|
|
@@ -8308,10 +8428,19 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8308
8428
|
children: /* @__PURE__ */ jsx("span", {
|
|
8309
8429
|
className: "text-sm text-center max-w-xs",
|
|
8310
8430
|
style: { color: "var(--color-text-secondary)" },
|
|
8311
|
-
children: isEmbedded ? "No tools
|
|
8431
|
+
children: isEmbedded ? "No tools in this app" : isError ? "Could not connect to MCP server" : isConnected ? "No tools found on this server" : serverUrl ? "Connecting…" : "Enter an MCP server URL to get started"
|
|
8312
8432
|
})
|
|
8313
8433
|
});
|
|
8314
|
-
} else if (
|
|
8434
|
+
} else if (!selectedToolInfo?.resource) content = /* @__PURE__ */ jsx("div", {
|
|
8435
|
+
className: "h-full w-full flex items-center justify-center",
|
|
8436
|
+
style: { background: iframeBg },
|
|
8437
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
8438
|
+
className: "text-sm text-center max-w-xs",
|
|
8439
|
+
style: { color: "var(--color-text-secondary)" },
|
|
8440
|
+
children: "Tool does not render a UI"
|
|
8441
|
+
})
|
|
8442
|
+
});
|
|
8443
|
+
else if (showEmptyState) content = /* @__PURE__ */ jsx("div", {
|
|
8315
8444
|
className: "h-full w-full flex items-center justify-center",
|
|
8316
8445
|
style: { background: iframeBg },
|
|
8317
8446
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -8435,31 +8564,9 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8435
8564
|
children: /* @__PURE__ */ jsx("path", { d: "M0 0L10 6L0 12V0Z" })
|
|
8436
8565
|
}), "Run"]
|
|
8437
8566
|
}) : void 0;
|
|
8438
|
-
const
|
|
8439
|
-
className: "flex
|
|
8440
|
-
|
|
8441
|
-
children: [
|
|
8442
|
-
/* @__PURE__ */ jsx("input", {
|
|
8443
|
-
id: prodResourcesId,
|
|
8444
|
-
type: "checkbox",
|
|
8445
|
-
checked: prodResources,
|
|
8446
|
-
onChange: (event) => setProdResources(event.currentTarget.checked),
|
|
8447
|
-
className: "h-3.5 w-3.5 accent-[var(--color-text-primary)]"
|
|
8448
|
-
}),
|
|
8449
|
-
/* @__PURE__ */ jsx("label", {
|
|
8450
|
-
htmlFor: prodResourcesId,
|
|
8451
|
-
className: "cursor-pointer select-none",
|
|
8452
|
-
children: "Prod Resources"
|
|
8453
|
-
}),
|
|
8454
|
-
/* @__PURE__ */ jsx(HelpIcon, {
|
|
8455
|
-
tooltip: "Load resources from dist/ builds instead of HMR",
|
|
8456
|
-
docsPath: "app-framework/cli/dev#prod-tools-and-prod-resources-flags"
|
|
8457
|
-
})
|
|
8458
|
-
]
|
|
8459
|
-
}) : null;
|
|
8460
|
-
const headerAction = runButton || headerProdResourcesControl ? /* @__PURE__ */ jsxs("div", {
|
|
8461
|
-
className: "flex min-w-0 items-center gap-2",
|
|
8462
|
-
children: [runButton, headerProdResourcesControl]
|
|
8567
|
+
const headerAction = runButton ? /* @__PURE__ */ jsx("div", {
|
|
8568
|
+
className: "flex min-w-0 items-center",
|
|
8569
|
+
children: runButton
|
|
8463
8570
|
}) : void 0;
|
|
8464
8571
|
const conversationContent = ShellConversation ? /* @__PURE__ */ jsx(ShellConversation, {
|
|
8465
8572
|
screenWidth: state.screenWidth,
|
|
@@ -8482,6 +8589,11 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8482
8589
|
children: content
|
|
8483
8590
|
}) : content;
|
|
8484
8591
|
const rootSizing = isEmbedded ? "h-full w-full" : "h-screen w-screen";
|
|
8592
|
+
const getJsonPanelFlexGrow = (value) => {
|
|
8593
|
+
const text = value || "";
|
|
8594
|
+
const lineCount = text.split("\n").length;
|
|
8595
|
+
return Math.max(1, Math.min(8, lineCount + Math.floor(text.length / 500)));
|
|
8596
|
+
};
|
|
8485
8597
|
if (!showSidebar) return /* @__PURE__ */ jsx(ThemeProvider, {
|
|
8486
8598
|
theme: state.theme,
|
|
8487
8599
|
applyTheme,
|
|
@@ -8497,6 +8609,10 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8497
8609
|
children: [/* @__PURE__ */ jsx(SimpleSidebar, {
|
|
8498
8610
|
rootRef,
|
|
8499
8611
|
fillParent: isEmbedded,
|
|
8612
|
+
sidebarWidth: state.sidebarWidth,
|
|
8613
|
+
rightSidebarWidth: state.rightSidebarWidth,
|
|
8614
|
+
onSidebarWidthChange: state.setSidebarWidth,
|
|
8615
|
+
onRightSidebarWidthChange: state.setRightSidebarWidth,
|
|
8500
8616
|
controls: /* @__PURE__ */ jsxs("div", {
|
|
8501
8617
|
className: "space-y-1",
|
|
8502
8618
|
children: [
|
|
@@ -8521,7 +8637,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8521
8637
|
})
|
|
8522
8638
|
}), !demoMode && /* @__PURE__ */ jsx(SidebarCollapsibleControl, {
|
|
8523
8639
|
label: "Authentication",
|
|
8524
|
-
defaultCollapsed:
|
|
8640
|
+
defaultCollapsed: false,
|
|
8525
8641
|
children: /* @__PURE__ */ jsxs("div", {
|
|
8526
8642
|
className: "space-y-1",
|
|
8527
8643
|
children: [
|
|
@@ -8605,70 +8721,6 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8605
8721
|
]
|
|
8606
8722
|
})
|
|
8607
8723
|
}, `auth-${authType === "none" ? "none" : "active"}`)] }),
|
|
8608
|
-
canUseModelChat && /* @__PURE__ */ jsx(SidebarCollapsibleControl, {
|
|
8609
|
-
label: "Model Chat",
|
|
8610
|
-
defaultCollapsed: true,
|
|
8611
|
-
tooltip: "Talk to this MCP server through a model",
|
|
8612
|
-
docsPath: "testing/evals",
|
|
8613
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
8614
|
-
className: "space-y-2",
|
|
8615
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
8616
|
-
className: "grid grid-cols-2 gap-2",
|
|
8617
|
-
children: [/* @__PURE__ */ jsx(SidebarControl, {
|
|
8618
|
-
label: "Provider",
|
|
8619
|
-
children: /* @__PURE__ */ jsx(SidebarSelect, {
|
|
8620
|
-
value: modelProvider,
|
|
8621
|
-
onChange: handleModelProviderChange,
|
|
8622
|
-
options: modelProviderOptions.map((provider) => ({
|
|
8623
|
-
value: provider.id,
|
|
8624
|
-
label: provider.label ?? provider.id
|
|
8625
|
-
}))
|
|
8626
|
-
})
|
|
8627
|
-
}), /* @__PURE__ */ jsx(SidebarControl, {
|
|
8628
|
-
label: "Model",
|
|
8629
|
-
children: selectedProviderModelOptions.length > 0 ? /* @__PURE__ */ jsx(SidebarSelect, {
|
|
8630
|
-
value: modelId,
|
|
8631
|
-
onChange: setModelId,
|
|
8632
|
-
options: selectedProviderModelOptions.map((model) => ({
|
|
8633
|
-
value: model,
|
|
8634
|
-
label: model
|
|
8635
|
-
}))
|
|
8636
|
-
}) : /* @__PURE__ */ jsx(SidebarInput, {
|
|
8637
|
-
value: modelId,
|
|
8638
|
-
onChange: setModelId,
|
|
8639
|
-
applyOnBlur: true,
|
|
8640
|
-
placeholder: getDefaultModelId(modelProvider)
|
|
8641
|
-
})
|
|
8642
|
-
})]
|
|
8643
|
-
}), usesApiKeyUi && /* @__PURE__ */ jsxs(SidebarControl, {
|
|
8644
|
-
label: "API Key",
|
|
8645
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
8646
|
-
className: "flex gap-1",
|
|
8647
|
-
children: [/* @__PURE__ */ jsx(SidebarInput, {
|
|
8648
|
-
type: "password",
|
|
8649
|
-
autoComplete: "new-password",
|
|
8650
|
-
value: apiKeyDraft,
|
|
8651
|
-
onChange: setApiKeyDraft,
|
|
8652
|
-
placeholder: keyStatus.hasKey ? "Saved locally" : `Paste ${modelProvider} key`
|
|
8653
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
8654
|
-
type: "button",
|
|
8655
|
-
onClick: handleSaveApiKey,
|
|
8656
|
-
disabled: isKeyStatusLoading || !apiKeyDraft && !keyStatus.hasKey,
|
|
8657
|
-
className: "h-7 rounded-md px-2 text-xs font-medium transition-opacity disabled:opacity-40",
|
|
8658
|
-
style: {
|
|
8659
|
-
backgroundColor: "var(--color-text-primary)",
|
|
8660
|
-
color: "var(--color-background-primary)"
|
|
8661
|
-
},
|
|
8662
|
-
children: apiKeyDraft ? "Save" : "Clear"
|
|
8663
|
-
})]
|
|
8664
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
8665
|
-
className: "mt-1 text-[9px]",
|
|
8666
|
-
style: { color: "var(--color-text-secondary)" },
|
|
8667
|
-
children: keyMessage || (isKeyStatusLoading ? "Checking saved key..." : keyStatus.hasKey ? `Key saved ${keyStatus.storage ?? "locally"}` : "Paste a key or use one already saved on this machine")
|
|
8668
|
-
})]
|
|
8669
|
-
})]
|
|
8670
|
-
})
|
|
8671
|
-
}),
|
|
8672
8724
|
hasTools && /* @__PURE__ */ jsxs("div", {
|
|
8673
8725
|
className: "grid grid-cols-2 gap-2",
|
|
8674
8726
|
"data-testid": "tool-simulation-row",
|
|
@@ -8681,6 +8733,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8681
8733
|
value: selectedToolName,
|
|
8682
8734
|
onChange: (value) => {
|
|
8683
8735
|
setIsLiveMcpRender(false);
|
|
8736
|
+
resetAppContextForSelectionChange();
|
|
8684
8737
|
setSelectedToolName(value);
|
|
8685
8738
|
},
|
|
8686
8739
|
options: toolNames.map((name) => {
|
|
@@ -8713,6 +8766,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8713
8766
|
onChange: (value) => {
|
|
8714
8767
|
if (value === "__live__") return;
|
|
8715
8768
|
setIsLiveMcpRender(false);
|
|
8769
|
+
resetAppContextForSelectionChange();
|
|
8716
8770
|
setActiveSimulationName(value === "__none__" ? null : value);
|
|
8717
8771
|
},
|
|
8718
8772
|
options: [
|
|
@@ -8774,6 +8828,80 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
8774
8828
|
})
|
|
8775
8829
|
})]
|
|
8776
8830
|
}),
|
|
8831
|
+
!hideInspectorModes && !demoMode && !isEmbedded && /* @__PURE__ */ jsx("div", {
|
|
8832
|
+
className: "py-1",
|
|
8833
|
+
children: /* @__PURE__ */ jsx(SidebarCheckbox, {
|
|
8834
|
+
checked: prodResources,
|
|
8835
|
+
onChange: setProdResources,
|
|
8836
|
+
label: "Prod Resources",
|
|
8837
|
+
tooltip: "Load resources from dist/ builds instead of HMR",
|
|
8838
|
+
docsPath: "app-framework/cli/dev#prod-tools-and-prod-resources-flags"
|
|
8839
|
+
})
|
|
8840
|
+
}),
|
|
8841
|
+
canUseModelChat && /* @__PURE__ */ jsx(SidebarCollapsibleControl, {
|
|
8842
|
+
label: "Model Chat",
|
|
8843
|
+
defaultCollapsed: false,
|
|
8844
|
+
tooltip: "Talk to this MCP server through a model",
|
|
8845
|
+
docsPath: "testing/evals",
|
|
8846
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
8847
|
+
className: "space-y-1",
|
|
8848
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8849
|
+
className: "grid grid-cols-2 gap-2",
|
|
8850
|
+
children: [/* @__PURE__ */ jsx(SidebarControl, {
|
|
8851
|
+
label: "Provider",
|
|
8852
|
+
children: /* @__PURE__ */ jsx(SidebarSelect, {
|
|
8853
|
+
value: modelProvider,
|
|
8854
|
+
onChange: handleModelProviderChange,
|
|
8855
|
+
options: modelProviderOptions.map((provider) => ({
|
|
8856
|
+
value: provider.id,
|
|
8857
|
+
label: provider.label ?? provider.id
|
|
8858
|
+
}))
|
|
8859
|
+
})
|
|
8860
|
+
}), /* @__PURE__ */ jsx(SidebarControl, {
|
|
8861
|
+
label: "Model",
|
|
8862
|
+
children: selectedProviderModelOptions.length > 0 ? /* @__PURE__ */ jsx(SidebarSelect, {
|
|
8863
|
+
value: modelId,
|
|
8864
|
+
onChange: setModelId,
|
|
8865
|
+
options: selectedProviderModelOptions.map((model) => ({
|
|
8866
|
+
value: model,
|
|
8867
|
+
label: model
|
|
8868
|
+
}))
|
|
8869
|
+
}) : /* @__PURE__ */ jsx(SidebarInput, {
|
|
8870
|
+
value: modelId,
|
|
8871
|
+
onChange: setModelId,
|
|
8872
|
+
applyOnBlur: true,
|
|
8873
|
+
placeholder: getDefaultModelId(modelProvider)
|
|
8874
|
+
})
|
|
8875
|
+
})]
|
|
8876
|
+
}), usesApiKeyUi && /* @__PURE__ */ jsxs(SidebarControl, {
|
|
8877
|
+
label: "API Key",
|
|
8878
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8879
|
+
className: "flex gap-1",
|
|
8880
|
+
children: [/* @__PURE__ */ jsx(SidebarInput, {
|
|
8881
|
+
type: "password",
|
|
8882
|
+
autoComplete: "new-password",
|
|
8883
|
+
value: apiKeyDraft,
|
|
8884
|
+
onChange: setApiKeyDraft,
|
|
8885
|
+
placeholder: keyStatus.hasKey ? "Saved locally" : `Paste ${modelProvider} key`
|
|
8886
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
8887
|
+
type: "button",
|
|
8888
|
+
onClick: handleSaveApiKey,
|
|
8889
|
+
disabled: isKeyStatusLoading || !apiKeyDraft && !keyStatus.hasKey,
|
|
8890
|
+
className: "h-7 rounded-md px-2 text-xs font-medium transition-opacity disabled:opacity-40",
|
|
8891
|
+
style: {
|
|
8892
|
+
backgroundColor: "var(--color-text-primary)",
|
|
8893
|
+
color: "var(--color-background-primary)"
|
|
8894
|
+
},
|
|
8895
|
+
children: apiKeyDraft ? "Save" : "Clear"
|
|
8896
|
+
})]
|
|
8897
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
8898
|
+
className: "mt-1 text-[9px]",
|
|
8899
|
+
style: { color: "var(--color-text-secondary)" },
|
|
8900
|
+
children: keyMessage || (isKeyStatusLoading ? "Checking saved key..." : keyStatus.hasKey ? `Key saved ${keyStatus.storage ?? "locally"}` : "Paste a key or use one already saved on this machine")
|
|
8901
|
+
})]
|
|
8902
|
+
})]
|
|
8903
|
+
})
|
|
8904
|
+
}),
|
|
8777
8905
|
/* @__PURE__ */ jsx(SidebarCollapsibleControl, {
|
|
8778
8906
|
label: "Host Context",
|
|
8779
8907
|
defaultCollapsed: false,
|
|
@@ -9036,14 +9164,24 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
9036
9164
|
})
|
|
9037
9165
|
]
|
|
9038
9166
|
})
|
|
9039
|
-
})
|
|
9167
|
+
})
|
|
9168
|
+
]
|
|
9169
|
+
}),
|
|
9170
|
+
rightControls: /* @__PURE__ */ jsxs("div", {
|
|
9171
|
+
className: "flex h-full min-h-0 flex-col gap-3",
|
|
9172
|
+
children: [
|
|
9040
9173
|
/* @__PURE__ */ jsx(SidebarCollapsibleControl, {
|
|
9041
9174
|
label: "App Context",
|
|
9042
|
-
defaultCollapsed:
|
|
9175
|
+
defaultCollapsed: false,
|
|
9043
9176
|
tooltip: "App-provided context shared with the model",
|
|
9044
9177
|
docsPath: "app-framework/hooks/use-app-state",
|
|
9178
|
+
className: "flex min-h-0 flex-col",
|
|
9179
|
+
contentClassName: "min-h-0 flex-1",
|
|
9180
|
+
style: { flex: `${getJsonPanelFlexGrow(state.modelContextJson)} 1 0` },
|
|
9181
|
+
tooltipPlacement: "left",
|
|
9045
9182
|
children: /* @__PURE__ */ jsx(SidebarTextarea, {
|
|
9046
9183
|
value: state.modelContextJson,
|
|
9184
|
+
"data-testid": "app-context-textarea",
|
|
9047
9185
|
onChange: (json) => state.validateJSON(json, state.setModelContextJson, state.setModelContextError),
|
|
9048
9186
|
onFocus: () => state.setEditingField("modelContext"),
|
|
9049
9187
|
onBlur: () => state.commitJSON(state.modelContextJson, state.setModelContextError, (parsed) => {
|
|
@@ -9054,7 +9192,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
9054
9192
|
});
|
|
9055
9193
|
}),
|
|
9056
9194
|
error: state.modelContextError,
|
|
9057
|
-
|
|
9195
|
+
fill: true
|
|
9058
9196
|
})
|
|
9059
9197
|
}),
|
|
9060
9198
|
/* @__PURE__ */ jsx(SidebarCollapsibleControl, {
|
|
@@ -9062,6 +9200,10 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
9062
9200
|
defaultCollapsed: false,
|
|
9063
9201
|
tooltip: "Arguments passed to the tool",
|
|
9064
9202
|
docsPath: "app-framework/hooks/use-tool-data",
|
|
9203
|
+
className: "flex min-h-0 flex-col",
|
|
9204
|
+
contentClassName: "min-h-0 flex-1",
|
|
9205
|
+
style: { flex: `${getJsonPanelFlexGrow(state.toolInputJson)} 1 0` },
|
|
9206
|
+
tooltipPlacement: "left",
|
|
9065
9207
|
children: /* @__PURE__ */ jsx(SidebarTextarea, {
|
|
9066
9208
|
value: state.toolInputJson,
|
|
9067
9209
|
"data-testid": "tool-input-textarea",
|
|
@@ -9069,7 +9211,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
9069
9211
|
onFocus: () => state.setEditingField("toolInput"),
|
|
9070
9212
|
onBlur: () => state.commitJSON(state.toolInputJson, state.setToolInputError, (parsed) => state.setToolInput(parsed ?? {})),
|
|
9071
9213
|
error: state.toolInputError,
|
|
9072
|
-
|
|
9214
|
+
fill: true
|
|
9073
9215
|
})
|
|
9074
9216
|
}),
|
|
9075
9217
|
/* @__PURE__ */ jsx(SidebarCollapsibleControl, {
|
|
@@ -9078,6 +9220,10 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
9078
9220
|
tooltip: "Structured content returned by the tool",
|
|
9079
9221
|
docsPath: "app-framework/hooks/use-tool-data",
|
|
9080
9222
|
"data-testid": "tool-result-section",
|
|
9223
|
+
className: "flex min-h-0 flex-col",
|
|
9224
|
+
contentClassName: "min-h-0 flex-1",
|
|
9225
|
+
style: { flex: `${getJsonPanelFlexGrow(state.toolResultJson)} 1 0` },
|
|
9226
|
+
tooltipPlacement: "left",
|
|
9081
9227
|
children: /* @__PURE__ */ jsx(SidebarTextarea, {
|
|
9082
9228
|
value: state.toolResultJson,
|
|
9083
9229
|
"data-testid": "tool-result-textarea",
|
|
@@ -9095,7 +9241,7 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
9095
9241
|
}
|
|
9096
9242
|
}),
|
|
9097
9243
|
error: state.toolResultError,
|
|
9098
|
-
|
|
9244
|
+
fill: true
|
|
9099
9245
|
})
|
|
9100
9246
|
})
|
|
9101
9247
|
]
|
|
@@ -9114,4 +9260,4 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
|
|
|
9114
9260
|
//#endregion
|
|
9115
9261
|
export { cn as C, registerHostShell as S, extractResourceCSP as _, SidebarCollapsibleControl as a, getHostShell as b, SidebarSelect as c, SimpleSidebar as d, ThemeProvider as f, IframeResource as g, useInspectorState as h, SidebarCheckbox as i, SidebarTextarea as l, useMcpConnection as m, flattenAppToSimulations as n, SidebarControl as o, useThemeContext as p, resolveServerToolResult as r, SidebarInput as s, Inspector as t, SidebarToggle as u, McpAppHost as v, DEFAULT_STYLE_VARIABLES as w, getRegisteredHosts as x, SCREEN_WIDTHS as y };
|
|
9116
9262
|
|
|
9117
|
-
//# sourceMappingURL=inspector-
|
|
9263
|
+
//# sourceMappingURL=inspector-CiuT_2yA.js.map
|