Files
agent-ui/server/routes/claude-status.ts
josedario87 47f5524416 feat: Introduce Nucleo as the main AI agent identity
- Add Nucleo atom logo with animated orbiting electrons
- Redesign FAB with glassmorphism effect and purple gradient
- Add connection indicator (green dot) when terminal is open
- Update FloatingTerminal header with Nucleo branding
- Add PermissionRequest hook support with red alert animation
- Document Nucleo in README with visual states table
- Create official Nucleo logo SVG in docs/
2026-02-14 02:56:50 -06:00

54 lines
2.0 KiB
TypeScript

import { jsonResponse, errorResponse } from '../utils/cors'
import { PORT_TERMINAL } from '../config'
type ClaudeStatus =
| 'idle'
| 'processing' // UserPromptSubmit - Claude is processing user input
| 'toolUse' // PreToolUse - Using a tool (generic)
| 'toolDone' // PostToolUse - Tool finished
| 'reading' // PreToolUse(Read/Glob/Grep) - Reading files
| 'writing' // PreToolUse(Edit/Write) - Writing files
| 'sessionStart' // SessionStart - Session just started
| 'subagentStart' // SubagentStart - Spawning subagent
| 'subagentStop' // SubagentStop - Subagent finished
| 'notification' // Notification - Claude sent notification
| 'permissionRequest' // PermissionRequest - Waiting for user permission
| 'thinking' // Legacy support
interface ClaudeStatusPayload {
status: ClaudeStatus
tool?: string
}
export async function handleClaudeStatus(req: Request): Promise<Response | null> {
if (req.method !== 'POST') return null
try {
const body = await req.json() as ClaudeStatusPayload
const validStatuses: ClaudeStatus[] = [
'idle', 'processing', 'toolUse', 'toolDone', 'reading', 'writing',
'sessionStart', 'subagentStart', 'subagentStop', 'notification',
'permissionRequest', 'thinking'
]
if (!body.status || !validStatuses.includes(body.status)) {
return errorResponse(`Invalid status. Must be one of: ${validStatuses.join(', ')}`, 400)
}
// Forward to terminal server for WebSocket broadcast
try {
await fetch(`http://localhost:${PORT_TERMINAL}/claude-status`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
})
} catch (e) {
console.error('[claude-status] Failed to forward to terminal server:', e)
}
return jsonResponse({ success: true, status: body.status })
} catch (e) {
return errorResponse('Invalid JSON body', 400)
}
}