mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-09-01 14:53:07 +08:00
9fd7a7f522
When an agent invokes an OAuth-enabled MCP service that the current user has not authorized yet, the tool call now pauses and surfaces an "Authorize" card in the chat instead of failing with an opaque error. After the user completes the per-user OAuth popup, the backend verifies a token exists and resumes the paused tool call automatically. Backend: - Add mcp_oauth_required / mcp_oauth_resolved events and response types. - Add OAuthPendingRequest + Gate.RequestOAuthAndWait, reusing the existing approval waiter, Resolve, Redis cross-instance fan-out and timeout. - MCPTool.Execute pauses on an authorization-required error for OAuth services and retries once (with a fresh ctx and recycled connection) after the user authorizes. - Forward the new events to the SSE stream. - Add ResolveMCPOAuth handler + route; it verifies authorization before unblocking so a premature resolve cannot resume into another failure. Frontend: - Add McpOAuthCard with an Authorize button reusing the popup + status-poll flow, then resolve the paused run. - Handle the new stream events (dedup multiple pending cards per service). - Add resolveMCPOAuth API client and i18n keys (zh/en/ko/ru).