feat: add AskUserQuestion tool, migrate frontend to WebSocket #87
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/ask-user-question"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a new
AskUserQuestiontool that lets the model ask users structured questions and wait for answers. Also migrates frontend communication from SSE + HTTP POST to pure WebSocket.What changed
AskUserQuestion tool:
WebSocket migration:
approvalstore sends via WS instead of HTTP POSTws.tsconnection manager with auto-reconnectFiles
Backend:
internal/question/,internal/tools/ask_user_question.go,internal/api/handler.go,internal/daemon/pool.go,internal/types/events.go,internal/agent/system.go,internal/session/session.goFrontend:
web/src/lib/ws.ts,web/src/runtime/stream.ts,web/src/store/approval.ts,web/src/store/question.ts,web/src/components/QuestionDialog.tsx,web/src/lib/types.tsTesting
Replaces the mixed SSE+HTTP approach with a pure WebSocket protocol: - Request-response: every wsMessage has action + request_id + body, server replies {ok, data} or {ok, error} paired by request_id - WSBridge: single class managing connection + request() / fire() / event$, exposed via BridgeProvider + useBridge() React Context - api/client.ts: useAPI() hook returns typed request functions that use WSBridge.request() underneath — components never touch WS raw - Removed all HTTP fetch calls and the entire web/src/api/ directory (agent.ts, sessions.ts, fs.ts, config.ts, traces.ts, background.ts, health.ts, client.ts) - Runtime layer (stream.ts, approvalStore, questionStore, ChatStore) receives bridge instance via dependency injection