refactor: unify hook notification system, remove duplicate broadcasts
- Replace forward-hook.ps1 with notify.ps1 (now accepts optional agent param) - Remove ejecutor settings.local.json (redundant status hooks, deriveStatus covers it) - Remove legacy claude-permission system (route, store methods, terminal broadcast) - Remove redundant deriveStatus + /claude-status POST from claude-hook.ts (broadcastClaudeHook → processHookEvent already handles status derivation) - Clean up HookNotifications.vue permission buttons (dead code)
This commit is contained in:
@@ -257,6 +257,7 @@ export async function startAgentInSession(agentId: string, force = false): Promi
|
||||
|
||||
export function startTerminalServer() {
|
||||
const server = Bun.serve({
|
||||
hostname: '0.0.0.0',
|
||||
port: PORT_TERMINAL,
|
||||
async fetch(req, server) {
|
||||
const url = new URL(req.url)
|
||||
@@ -316,17 +317,6 @@ export function startTerminalServer() {
|
||||
}
|
||||
}
|
||||
|
||||
// Claude permission request broadcast endpoint
|
||||
if (url.pathname === '/claude-permission' && req.method === 'POST') {
|
||||
try {
|
||||
const body = await req.json()
|
||||
broadcastPermissionRequest(body)
|
||||
return Response.json({ success: true }, { headers: corsHeaders })
|
||||
} catch {
|
||||
return Response.json({ error: 'Invalid JSON' }, { status: 400, headers: corsHeaders })
|
||||
}
|
||||
}
|
||||
|
||||
// Agent sessions info
|
||||
if (url.pathname === '/agent-sessions' && req.method === 'GET') {
|
||||
const result: Record<string, any> = {}
|
||||
@@ -762,8 +752,6 @@ export function broadcastClaudeStatus(status: ClaudeStatus, tool?: string, agent
|
||||
console.log(`[Terminal] Claude status broadcast: ${status}${tool ? ` (${tool})` : ''} → ${clientCount} clients`)
|
||||
|
||||
// Note: session state is updated via broadcastClaudeHook which has full payload context.
|
||||
// Direct /claude-status POSTs (from ejecutor's settings.local.json) are lightweight
|
||||
// and don't carry enough context to update full session state.
|
||||
}
|
||||
|
||||
// Broadcast full Claude hook data to ALL clients
|
||||
@@ -783,18 +771,6 @@ export function broadcastClaudeHook(data: Record<string, unknown>) {
|
||||
console.log(`[Terminal] Claude hook broadcast: ${data.hook_event_name || 'unknown'}${data.tool_name ? ` (${data.tool_name})` : ''} → ${clientCount} clients`)
|
||||
}
|
||||
|
||||
// Broadcast permission request to ALL clients
|
||||
export function broadcastPermissionRequest(data: Record<string, unknown>) {
|
||||
const message = JSON.stringify({
|
||||
type: 'claude-permission',
|
||||
...data,
|
||||
timestamp: Date.now()
|
||||
})
|
||||
|
||||
const clientCount = broadcastToAll(message)
|
||||
console.log(`[Terminal] Permission request broadcast: ${data.tool_name || 'unknown'} (${data.requestId}) → ${clientCount} clients`)
|
||||
}
|
||||
|
||||
// Broadcast transcript updates to ALL clients
|
||||
export function broadcastTranscriptUpdate(data: Record<string, unknown>) {
|
||||
const message = JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user