Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(chat): open inspector from slash command

Louis Beaumont6e426acbd712
diff --git a/apps/screenpipe-app-tauri/components/chat/chat-inspector.test.tsx b/apps/screenpipe-app-tauri/components/chat/chat-inspector.test.tsx
index 1886a6f4a..e44d24c6b 100644
--- a/apps/screenpipe-app-tauri/components/chat/chat-inspector.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/chat-inspector.test.tsx
@@ -32,7 +32,40 @@ function InspectorHarness({ onOpenFile }: { onOpenFile: (path: string) => void }
);
}
+function EmptyInspectorCommandHarness() {
+ const [open, setOpen] = useState(false);
+
+ return (
+ <>
+ <button type="button" onClick={() => setOpen(true)}>
+ Run /inspector
+ </button>
+ <ChatInspectorPopover
+ open={open}
+ onOpenChange={setOpen}
+ outputs={[]}
+ sources={[]}
+ onOpenFile={vi.fn()}
+ />
+ </>
+ );
+}
+
describe("ChatInspectorPopover", () => {
+ it("opens from /inspector before the chat has outputs or sources", () => {
+ render(<EmptyInspectorCommandHarness />);
+
+ expect(
+ screen.queryByRole("button", { name: "Toggle pinned summary" }),
+ ).toBeNull();
+
+ fireEvent.click(screen.getByRole("button", { name: "Run /inspector" }));
+
+ expect(screen.getByRole("region", { name: "Pinned summary" })).toBeTruthy();
+ expect(screen.getByText("No outputs yet")).toBeTruthy();
+ expect(screen.getByText("No sources yet")).toBeTruthy();
+ });
+
it("toggles a pinned summary from the toolbar control", () => {
render(<InspectorHarness onOpenFile={vi.fn()} />);
diff --git a/apps/screenpipe-app-tauri/components/chat/chat-inspector.tsx b/apps/screenpipe-app-tauri/components/chat/chat-inspector.tsx
index 33eec0340..a92959e9e 100644
--- a/apps/screenpipe-app-tauri/components/chat/chat-inspector.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/chat-inspector.tsx
@@ -48,6 +48,11 @@ export function ChatInspectorPopover({
sources,
onOpenFile,
}: ChatInspectorPopoverProps) {
+ // Keep the control out of the toolbar until there is something to inspect,
+ // while still mounting it when an explicit action such as `/inspector`
+ // opens the empty state.
+ if (!open && outputs.length === 0 && sources.length === 0) return null;
+
return (
<Popover open={open} onOpenChange={onOpenChange}>
<PopoverTrigger asChild>
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 0925981a6..74bbf70f7 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -1983,7 +1983,9 @@ export function StandaloneChat({
isMac={isMac}
isFullscreen={isFullscreen}
hideInlineHistory={hideInlineHistory}
- hasRightActions={inspectorHasContent || sidePanelHasContent}
+ hasRightActions={
+ inspectorHasContent || inspectorOpen || sidePanelHasContent
+ }
showHistory={showHistory}
settings={settings}
reloadStore={reloadStore}
@@ -2027,17 +2029,15 @@ export function StandaloneChat({
<div className="flex-1 flex min-h-0" data-browser-panel-host>
<div className="relative flex-1 flex flex-col min-w-0" data-firstrun-target="messages">
- {inspectorHasContent ? (
- <div className="absolute -top-8 right-2 z-30">
- <ChatInspectorPopover
- open={inspectorOpen}
- onOpenChange={setInspectorOpen}
- outputs={inspectorOutputs}
- sources={inspectorSources}
- onOpenFile={openFilePreview}
- />
- </div>
- ) : null}
+ <div className="absolute -top-8 right-2 z-30">
+ <ChatInspectorPopover
+ open={inspectorOpen}
+ onOpenChange={setInspectorOpen}
+ outputs={inspectorOutputs}
+ sources={inspectorSources}
+ onOpenFile={openFilePreview}
+ />
+ </div>
<ChatMainPane
firstRunLearningEnabled={firstRunLearningEnabled}
firstRunAiPreset={firstRunAiPreset}