WeKnora/internal/handler/session
wizardchen 9fd7a7f522 feat(mcp): prompt and resume OAuth authorization mid-conversation
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).
2026-06-29 23:22:28 +08:00
..
agent_stream_handler.go feat(mcp): prompt and resume OAuth authorization mid-conversation 2026-06-29 23:22:28 +08:00
attachment_processor.go feat: add EPUB and MHTML document support 2026-06-16 11:25:27 +08:00
handler.go feat(system): consolidate system admin and settings into one Settings panel 2026-05-26 21:13:56 +08:00
helpers.go fix(agent): harden @mention scope and simplify must_use hints 2026-06-29 18:09:44 +08:00
helpers_test.go fix(agent): harden @mention scope and simplify must_use hints 2026-06-29 18:09:44 +08:00
image_upload.go feat(video): update ASR terminology and file type labels for improved clarity 2026-04-14 22:59:14 +08:00
qa.go fix(agent): harden @mention scope and simplify must_use hints 2026-06-29 18:09:44 +08:00
stream.go fix(session): map ErrSessionNotFound to 404 across all handlers 2026-05-14 16:47:36 +08:00
title.go feat: 支持知识库选择模式和标题生成模型配置 2025-12-29 14:35:13 +08:00
types.go feat(chat): add @Skill/@MCP mentions with scoped agent runtime 2026-06-29 18:09:44 +08:00
wiki_fixer_scope.go fix(session): scope wiki fixer to shared KB tenant 2026-05-21 11:19:19 +08:00
wiki_fixer_scope_test.go fix(session): scope wiki fixer to shared KB tenant 2026-05-21 11:19:19 +08:00