import { useWorkspace, type PluginWorkspacePanelProps } from "@getpaseo/plugin/client"; import { useState, type ReactNode } from "react"; import { Text, View } from "react-native"; import { agentState, agentTone, errorMessage, formatMiB, operationLabel, plural, sandboxStatus, shortRef } from "./format"; import { DownloadConsentPrompt, useDownloadConsent } from "./consent"; import { Column, Columns, Empty, Frame, Needs, StatusChip, Tabbed, type Tab } from "./frame"; import { Actions, Button, ConfirmButton, Dot, FadeIn, ListRow, Meter, Note, Pill, Pulse, Section, figures, kicker, mono, text, tint, toneColor, } from "./kit"; import { McpTab } from "./mcp"; import { panelBadges, panelNeeds, type PanelTab, type PanelTabProps } from "./panel"; import { MountsTab, ResourcesTab, VariablesTab } from "./panel-config"; import { ServicesTab } from "./panel-services"; import { TemplateTab } from "./panel-template"; import { useArchiveAgent, useSandboxAction, useSandboxDescription, useStatus, type Description } from "./queries"; const TAB_LABELS: Record = { overview: "Overview", services: "Services", template: "Template", resources: "Resources", mounts: "Mounts", variables: "Variables", mcp: "MCP", }; export function WorkspacePanel({ theme, layout, workspaceId, navigation }: PluginWorkspacePanelProps) { const directory = useWorkspace(workspaceId, (workspace) => workspace.directory); const description = useSandboxDescription(workspaceId, directory); const [panelWidth, setPanelWidth] = useState(null); const [selection, setSelection] = useState<{ workspaceId: string; tab: PanelTab }>({ workspaceId, tab: "overview" }); const compact = layout.compact || (panelWidth !== null && panelWidth < 720); const tab = selection.workspaceId === workspaceId ? selection.tab : "overview"; const go = (next: PanelTab) => setSelection({ workspaceId, tab: next }); const data = description.data; const refresh = (