Files
agent-ui/frontend/src/services/tools/handlers/responseHandlers.ts
josedario87 abe6766a85 refactor: remove legacy chat/agent implementations, keep transcript-debug
Remove FloatingTerminal (#1), AgentBar/FloatBubble (#2), and all related
components, composables, types, handlers, routes, and CSS. Clean up orphaned
references in ToolsDropdown, whisperSocket, and claude-hook comments.
Transcript-debug is now the sole chat/agent system.

Deleted: 15 files (~3500 lines)
Edited: 12 files (-717 lines net)
2026-02-20 13:41:19 -06:00

59 lines
1.8 KiB
TypeScript

/**
* Floating Response handlers
* Controls the FloatingResponse component for agent UI responses
*/
import type { ToolConfig } from './index'
export interface ResponseControls {
addMessage: (message: string, type?: 'info' | 'success' | 'warning' | 'error') => string
removeMessage: (id: string) => void
clearAll: () => void
getMessages: () => Array<{ id: string; message: string; type: string; timestamp: number }>
}
// Global reference to response controls (set by App.vue)
let responseControls: ResponseControls | null = null
export function setResponseControls(controls: ResponseControls) {
responseControls = controls
;(window as any).__responseControls = controls
}
export function getResponseControls(): ResponseControls | null {
return responseControls
}
export function createResponseHandlers(): ToolConfig[] {
return [
{
name: 'bubbleResponse',
description: 'Responde al usuario mostrando un mensaje en la UI (terminal flotante) en lugar de en Claude Code',
category: 'global',
schema: {
type: 'object',
properties: {
message: {
type: 'string',
description: 'El mensaje a mostrar al usuario en la UI'
},
type: {
type: 'string',
enum: ['info', 'success', 'warning', 'error'],
description: 'Tipo de mensaje: info (default), success, warning, error'
}
},
required: ['message']
},
handler: (args: { message: string; type?: 'info' | 'success' | 'warning' | 'error' }) => {
if (!responseControls) return 'Error: Response controls not initialized'
const type = args.type || 'info'
const id = responseControls.addMessage(args.message, type)
return `Mensaje mostrado en UI (id: ${id}, tipo: ${type})`
}
}
]
}