// — the swarm terminal tab's full page, mounted at // `/agents/:name/terminal`. The MVP `AgentTermPreview` (below `AgentsPage`'s // detail panel) is explicitly capped and read-only; this is that same // component's `fullHeight` mount — no 12em cap, floating header badges // shown (there's no detail-panel `
` here to duplicate them). Sending // input back to the agent is still explicit follow-up scope, same as the // preview's own file comment says — this page doesn't change that. // // Registers itself in the dynamic-tabs row on mount (not just when opened // via the preview's expand trigger) — a bookmark, a shared link, or a // plain page reload should all re-open the tab instead of landing on a // page with no way back into the tab row. `useDynamicTabs().open()` is // idempotent (dedupes by href), so this is safe to call every mount. import { useEffect } from "preact/hooks"; import type { RouteComponentProps } from "wouter-preact"; import { AgentTermPreview } from "./AgentTermPreview.js"; import { useDynamicTabs } from "../../shell/useDynamicTabs.js"; import "./AgentTerminalPage.css"; export function AgentTerminalPage({ params, }: RouteComponentProps<{ name: string }>) { const { open } = useDynamicTabs(); const name = decodeURIComponent(params.name); // Runs once per mounted agent name — re-registering on every render // would just be redundant work against an already-deduped list, but // there's no reason to pay it more than once per identity. useEffect(() => { open({ href: `/agents/${encodeURIComponent(name)}/terminal`, label: name }); // eslint-disable-next-line react-hooks/exhaustive-deps -- `open` is a // fresh function identity every render (`useDynamicTabs` doesn't // memoize it); including it would re-fire this effect every render // instead of once per agent `name`. }, [name]); return (
); }