Skip to content

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.

feat(claude): REF-style notification content (title + last message)

enes0fcfd69a3b26
diff --git a/src/main/claude-hooks.ts b/src/main/claude-hooks.ts
index 288c7ce90..7f994d10b 100644
--- a/src/main/claude-hooks.ts
+++ b/src/main/claude-hooks.ts
@@ -125,13 +125,15 @@ export function initClaudeHooks(win: BrowserWindow): void {
hook_event_name?: string
session_id?: string
notification_type?: string
+ last_assistant_message?: string
}
if (p.hook_event_name && !win.isDestroyed()) {
win.webContents.send(IPC.claudeStatus, {
nodeId,
event: p.hook_event_name,
sessionId: p.session_id,
- notificationType: p.notification_type
+ notificationType: p.notification_type,
+ lastMessage: p.last_assistant_message
})
}
} catch {
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 5a226d768..1358d51c6 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -800,10 +800,23 @@ export function Canvas() {
// (with consent, throttled) notify.
const notifyCooldownRef = useRef<Record<string, number>>({})
useEffect(() => {
+ // Notification context = the node's folder name (or its title), like REF's worktree label.
+ const contextFor = (nodeId: string): string => {
+ const node = nodesRef.current.find((n) => n.id === nodeId)
+ const cwd = (node?.data.cwd as string) || ''
+ const folder = cwd.replace(/\/+$/, '').split('/').filter(Boolean).pop()
+ const title = node?.data.title as string | undefined
+ return folder || (title && title !== 'Claude Code' ? title : '') || 'workspace'
+ }
+ const clip = (s: string | undefined, max = 180): string => {
+ const t = (s ?? '').replace(/\s+/g, ' ').trim()
+ return t.length <= max ? t : `${t.slice(0, max - 1)}…`
+ }
return window.nodeTerminal.onClaudeStatus((e) => {
const cs = useClaudeStatus.getState()
if (e.sessionId) cs.setSessionId(e.nodeId, e.sessionId)
- const alert = (title: string) => {
+ // REF-style: "<folder> — Claude finished" + last assistant message as the body.
+ const alert = (statusText: string, fallbackBody: string) => {
if (document.hasFocus()) return
cs.markUnread(e.nodeId)
const s = useSettings.getState().settings
@@ -811,10 +824,9 @@ export function Canvas() {
const now = Date.now()
if (now - (notifyCooldownRef.current[e.nodeId] ?? 0) < 5000) return // dedup/cooldown
notifyCooldownRef.current[e.nodeId] = now
- const node = nodesRef.current.find((n) => n.id === e.nodeId)
void window.nodeTerminal.notify({
- title,
- body: (node?.data.title as string) || 'Claude Code',
+ title: `${contextFor(e.nodeId)} — Claude ${statusText}`,
+ body: clip(e.lastMessage) || fallbackBody,
nodeId: e.nodeId
})
}
@@ -824,15 +836,15 @@ export function Canvas() {
break
case 'Stop':
cs.setState(e.nodeId, 'done')
- alert('Claude Code finished')
+ alert('finished', 'Claude finished its turn.')
break
case 'Notification':
if (e.notificationType === 'permission_prompt') {
cs.setState(e.nodeId, 'blocked')
- alert('Claude Code needs permission')
+ alert('needs input', 'Claude needs permission to continue.')
} else {
cs.setState(e.nodeId, 'waiting')
- alert('Claude Code needs you')
+ alert('needs input', 'Claude is waiting for your response.')
}
break
case 'SessionStart':
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 2855a1662..c11f54471 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -313,6 +313,8 @@ export interface ClaudeStatusEvent {
sessionId?: string
/** For Notification events: e.g. 'permission_prompt' | 'idle_prompt'. */
notificationType?: string
+ /** Claude's last assistant message (on Stop) — used as the notification body. */
+ lastMessage?: string
}
export interface NodeTerminalApi {