Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(palette): search Claude transcripts, focus-or-resume on click
enesec718a60a955
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 71477b264..2a9fd6eda 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -84,10 +84,12 @@ import {canRename,canTransferFrom,canContextLink,+ resumeCommand,AGENT_CONFIG,BUILTIN_AGENT_IDS,type AgentId} from '@shared/agents/config'+import { relativeTime } from '../lib/relativeTime'import { AgentIcon } from '../lib/agentIcons'import { branchClaudeSession } from '../lib/claudeBranch'import { useSettings } from '../state/settings'@@ -97,7 +99,7 @@ import { useSshServers } from '../state/sshServers'import { useSshConn } from '../state/sshConn'import { requireProOr } from '../state/upgradeGate'import type { SshServer } from '@shared/ssh'-import type { SshProjectStatus } from '@shared/types'+import type { SshProjectStatus, TranscriptHit } from '@shared/types'import {applyCanvasMutation,claudeLaunchCommand,@@ -140,6 +142,8 @@ export function Canvas() {const [remotePicker, setRemotePicker] = useState<{ x: number; y: number } | null>(null)const [paletteOpen, setPaletteOpen] = useState(false)const [fileIndex, setFileIndex] = useState<QuickOpenIndexedFile[]>([])+ const [transcriptHits, setTranscriptHits] = useState<TranscriptHit[]>([])+ const transcriptQueryRef = useRef('')// Cached visible-buffer text per terminal, for command-palette content search.const [bufferCache, setBufferCache] = useState<Record<string, string>>({})const captureTsRef = useRef<Record<string, number>>({})@@ -1890,6 +1894,48 @@ export function Canvas() {[setNodes, goToNode, switchProject])+ const onPaletteQuery = useCallback((q: string) => {+ transcriptQueryRef.current = q+ if (q.trim().length < 2) {+ setTranscriptHits([])+ return+ }+ const mine = q+ window.nodeTerminal.transcripts.search(q).then((hits) => {+ // Stale-response guard: ignore results for a query the user has moved past.+ if (transcriptQueryRef.current === mine) setTranscriptHits(hits)+ })+ }, [])++ // Map a transcript hit's sessionId to a live node (via agentStatus). If that node still+ // exists anywhere, focus it; otherwise open a new Claude node that resumes the session.+ const openTranscriptHit = useCallback(+ (hit: TranscriptHit) => {+ const byId = useAgentStatus.getState().byId+ const projects = useProjects.getState().projects+ const boundNodeId = Object.entries(byId).find(+ ([nodeId, st]) =>+ st.sessionId === hit.sessionId &&+ (nodesRef.current.some((n) => n.id === nodeId) ||+ projects.some((p) => p.nodes.some((n) => n.id === nodeId)))+ )?.[0]+ if (boundNodeId) {+ focusNodeById(boundNodeId)+ return+ }+ // No live node — open a resume node in the active project, using the transcript's cwd.+ const cmd = resumeCommand('claude', hit.sessionId)+ if (!cmd) return+ const node = createAgentNode('claude', nodesRef.current.length, hit.cwd, viewCenter())+ node.data = { ...node.data, initialCommand: cmd }+ node.selected = true+ setNodes((ns) => [...ns.map((n) => ({ ...n, selected: false })), node])+ markDirty()+ goToNode(node)+ },+ [focusNodeById, setNodes, markDirty, goToNode, viewCenter]+ )+useEffect(() => window.nodeTerminal.onFocusNode(focusNodeById), [focusNodeById])// ---- sessions sidebar actions ----@@ -2333,6 +2379,20 @@ export function Canvas() {[commitActiveToStore, writeDisk])+ const now = Date.now()+ const transcriptCommands = useMemo<Command[]>(+ () =>+ transcriptHits.map((hit) => ({+ id: `transcript:${hit.sessionId}`,+ label: hit.title || hit.sessionId,+ hint: [hit.projectLabel, relativeTime(hit.mtime, now)].filter(Boolean).join(' · '),+ section: 'Conversations',+ icon: <IconJump />,+ run: () => openTranscriptHit(hit)+ })),+ [transcriptHits, openTranscriptHit, now]+ )+const buildCommands = useCallback((): Command[] => {const disabled = useSettings.getState().settings.disabledAgentsconst cmds: Command[] = [@@ -2644,7 +2704,12 @@ export function Canvas() {fileIndex={fileIndex}onOpenFile={openProjectFile}onRevealFile={revealProjectFile}- onClose={() => setPaletteOpen(false)}+ onQueryChange={onPaletteQuery}+ extraCommands={transcriptCommands}+ onClose={() => {+ setPaletteOpen(false)+ setTranscriptHits([])+ }}/>)}diff --git a/src/renderer/components/CommandPalette.tsx b/src/renderer/components/CommandPalette.tsxindex 0d6da9da8..e90f6c89d 100644--- a/src/renderer/components/CommandPalette.tsx+++ b/src/renderer/components/CommandPalette.tsx@@ -27,6 +27,10 @@ interface CommandPaletteProps {onOpenFile?: (relPath: string) => void/** Reveal a file result in the Explorer by its root-relative path. */onRevealFile?: (relPath: string) => void+ /** Called whenever the query input changes (for async result sources). */+ onQueryChange?: (q: string) => void+ /** Pre-filtered commands appended verbatim (NOT re-filtered) — e.g. transcript hits. */+ extraCommands?: Command[]}/** Case-insensitive subsequence match — "ntr" matches "New TeRminal". */@@ -48,7 +52,9 @@ export function CommandPalette({onClose,fileIndex,onOpenFile,- onRevealFile+ onRevealFile,+ onQueryChange,+ extraCommands}: CommandPaletteProps) {const [query, setQuery] = useState('')const [active, setActive] = useState(0)@@ -81,7 +87,10 @@ export function CommandPalette({})}, [fileIndex, onOpenFile, onRevealFile, query])- const items = useMemo(() => [...filtered, ...fileCommands], [filtered, fileCommands])+ const items = useMemo(+ () => [...filtered, ...fileCommands, ...(extraCommands ?? [])],+ [filtered, fileCommands, extraCommands]+ )const run = (cmd?: Command) => {if (!cmd) return@@ -101,6 +110,7 @@ export function CommandPalette({onChange={(e) => {setQuery(e.target.value)setActive(0)+ onQueryChange?.(e.target.value)}}onKeyDown={(e) => {if (e.key === 'ArrowDown') {diff --git a/src/renderer/lib/relativeTime.test.ts b/src/renderer/lib/relativeTime.test.tsnew file mode 100644index 000000000..f44dad851--- /dev/null+++ b/src/renderer/lib/relativeTime.test.ts@@ -0,0 +1,13 @@+import { describe, expect, it } from 'vitest'+import { relativeTime } from './relativeTime'++const NOW = 1_000_000_000_000++describe('relativeTime', () => {+ it('formats recent + past spans', () => {+ expect(relativeTime(NOW, NOW)).toBe('just now')+ expect(relativeTime(NOW - 5 * 60_000, NOW)).toBe('5m ago')+ expect(relativeTime(NOW - 3 * 3_600_000, NOW)).toBe('3h ago')+ expect(relativeTime(NOW - 2 * 86_400_000, NOW)).toBe('2d ago')+ })+})diff --git a/src/renderer/lib/relativeTime.ts b/src/renderer/lib/relativeTime.tsnew file mode 100644index 000000000..51b6d311d--- /dev/null+++ b/src/renderer/lib/relativeTime.ts@@ -0,0 +1,10 @@+// Short relative time label ("just now" / "5m ago" / "3h ago" / "2d ago") for palette hints.+export function relativeTime(ms: number, nowMs: number): string {+ const diff = Math.max(0, nowMs - ms)+ const min = Math.floor(diff / 60_000)+ if (min < 1) return 'just now'+ if (min < 60) return `${min}m ago`+ const hr = Math.floor(min / 60)+ if (hr < 24) return `${hr}h ago`+ return `${Math.floor(hr / 24)}d ago`+}