feat(websocket): integrate A2UI message handling and answer callback registration

This commit is contained in:
catlog22
2026-02-03 21:18:19 +08:00
parent bb4cd0529e
commit 9bb50a13fa
4 changed files with 30 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ import type {
AskQuestionResult,
PendingQuestion,
} from '../core/a2ui/A2UITypes.js';
import { a2uiWebSocketHandler } from '../core/a2ui/A2UIWebSocketHandler.js';
// ========== Constants ==========
@@ -332,8 +333,9 @@ export async function execute(params: AskQuestionParams): Promise<ToolResult<Ask
}, params.timeout || DEFAULT_TIMEOUT_MS);
});
// TODO: Send A2UI surface via WebSocket
// This will be handled by A2UIWebSocketHandler
// Send A2UI surface via WebSocket to frontend
const a2uiSurface = createA2UISurface(question, surfaceId);
a2uiWebSocketHandler.sendSurface(a2uiSurface.surfaceUpdate);
// Wait for answer
const result = await resultPromise;

View File

@@ -26,6 +26,7 @@ import * as readFileMod from './read-file.js';
import * as coreMemoryMod from './core-memory.js';
import * as contextCacheMod from './context-cache.js';
import * as skillContextLoaderMod from './skill-context-loader.js';
import * as askQuestionMod from './ask-question.js';
import type { ProgressInfo } from './codex-lens.js';
// Import legacy JS tools
@@ -366,6 +367,7 @@ registerTool(toLegacyTool(readFileMod));
registerTool(toLegacyTool(coreMemoryMod));
registerTool(toLegacyTool(contextCacheMod));
registerTool(toLegacyTool(skillContextLoaderMod));
registerTool(toLegacyTool(askQuestionMod));
// Register legacy JS tools
registerTool(uiGeneratePreviewTool);