Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(oauth-mcp): surface connect_required consent in desktop projections

Diego Zacariasc1b1d9c8e06f
diff --git a/desktop-app/src/__tests__/rpcProxyClient.test.ts b/desktop-app/src/__tests__/rpcProxyClient.test.ts
index 7777003cc..ecf52e8e8 100644
--- a/desktop-app/src/__tests__/rpcProxyClient.test.ts
+++ b/desktop-app/src/__tests__/rpcProxyClient.test.ts
@@ -404,6 +404,67 @@ describe('RpcProxyClient.listSessions', () => {
})
})
+ it('surfaces U5 connect_required pendingApproval fields (reason/mcpServerName/provider)', async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn().mockResolvedValue({
+ ok: true,
+ status: 200,
+ json: async () => ({
+ agent: 'agent-a',
+ chatId: 'chat-a',
+ state: 'awaiting_approval',
+ pendingApproval: {
+ requestId: 'req-1',
+ displayName: 'clickup: create task',
+ reason: 'connect_required',
+ mcpServerName: 'mcp-clickup',
+ provider: 'clickup',
+ },
+ turns: [],
+ }),
+ })
+ )
+
+ await expect(
+ client.loadSessionMessages('token', 'host', 'agent-a', 'chat-a')
+ ).resolves.toMatchObject({
+ pendingApproval: {
+ requestId: 'req-1',
+ displayName: 'clickup: create task',
+ reason: 'connect_required',
+ mcpServerName: 'mcp-clickup',
+ provider: 'clickup',
+ },
+ })
+ })
+
+ it('keeps generic pendingApproval byte-identical when the U5 fields are absent (back-compat)', async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn().mockResolvedValue({
+ ok: true,
+ status: 200,
+ json: async () => ({
+ agent: 'agent-a',
+ chatId: 'chat-a',
+ state: 'awaiting_approval',
+ pendingApproval: {
+ requestId: 'req-1',
+ displayName: 'Search',
+ },
+ turns: [],
+ }),
+ })
+ )
+
+ const result = await client.loadSessionMessages('token', 'host', 'agent-a', 'chat-a')
+ expect(result.pendingApproval).toEqual({
+ requestId: 'req-1',
+ displayName: 'Search',
+ })
+ })
+
it.each([
['oldestTurnNumber', -1],
['oldestTurnNumber', 0.5],
diff --git a/desktop-app/src/rpcProxyClient.ts b/desktop-app/src/rpcProxyClient.ts
index 940d523c7..4caf9ef95 100644
--- a/desktop-app/src/rpcProxyClient.ts
+++ b/desktop-app/src/rpcProxyClient.ts
@@ -80,9 +80,21 @@ function parseSessionState(value: unknown, label: string): SessionLifecycleState
function parsePendingApproval(value: unknown, label: string): PendingApprovalLite | undefined {
if (value === undefined || value === null) return undefined
const record = wireObject(value, label)
+ // U5 (mcp-oauth reactive consent): `reason`/`mcpServerName`/`provider` are
+ // additive. They ride the same REST wire as the generic approval descriptor
+ // and MUST be surfaced so the renderer can branch a `connect_required`
+ // suspension into an OAuth "Connect <provider>" affordance instead of a
+ // generic tool approval. An absent `reason` (or any value other than
+ // `connect_required`) keeps the byte-identical generic-approval flow.
+ const reason = optionalWireString(record.reason, `${label}.reason`)
+ const mcpServerName = optionalWireString(record.mcpServerName, `${label}.mcpServerName`)
+ const provider = optionalWireString(record.provider, `${label}.provider`)
return {
requestId: wireString(record.requestId, `${label}.requestId`),
displayName: wireString(record.displayName, `${label}.displayName`),
+ ...(reason !== undefined ? { reason } : {}),
+ ...(mcpServerName !== undefined ? { mcpServerName } : {}),
+ ...(provider !== undefined ? { provider } : {}),
}
}
diff --git a/desktop-app/ui/src/hooks/domain/useAgentChatController.ts b/desktop-app/ui/src/hooks/domain/useAgentChatController.ts
index a817dac4e..9fee63fcb 100644
--- a/desktop-app/ui/src/hooks/domain/useAgentChatController.ts
+++ b/desktop-app/ui/src/hooks/domain/useAgentChatController.ts
@@ -2336,11 +2336,25 @@ export function useAgentChatController({
? {
requestId: state.pendingApproval.requestId,
displayName: state.pendingApproval.displayName || 'Unknown Tool',
+ // U5: carry the connect_required discriminator (+ server/provider) so the
+ // live message ProgressStepper renders "Connect <server>" instead of a
+ // generic Approve/Deny prompt. Absent on ordinary approval suspensions.
+ reason: state.pendingApproval.reason,
+ mcpServerName: state.pendingApproval.mcpServerName,
+ provider: state.pendingApproval.provider,
}
: activeFsmApproval
? {
requestId: activeFsmApproval.requestId,
displayName: activeFsmApproval.displayName || 'Unknown Tool',
+ // U5 — the optimistic-paint fallback (rejoin, SERVER_SNAPSHOT before the
+ // sticky `suspended` SSE replays) must ALSO carry the connect_required
+ // discriminator so the live-message stepper renders "Connect <server>",
+ // not a generic Approve/Deny, during that window. Mirrors the tracker
+ // branch above and InFlightAssistantPlaceholder's fallback.
+ reason: activeFsmApproval.reason,
+ mcpServerName: activeFsmApproval.mcpServerName,
+ provider: activeFsmApproval.provider,
}
: undefined
updateMessageProgress(selectedAgent, state.userMessageId, () => ({
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index ef637436a..be772b741 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.244",
+ "version": "0.1.245",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.244",
+ "version": "0.1.245",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index 579114d46..96ac29d9f 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.244",
+ "version": "0.1.245",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/__tests__/messageHandler.test.ts b/mcp-host/src/__tests__/messageHandler.test.ts
index d716a9024..826b5afd9 100644
--- a/mcp-host/src/__tests__/messageHandler.test.ts
+++ b/mcp-host/src/__tests__/messageHandler.test.ts
@@ -1,5 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { EventEmitter } from 'events'
+import { buildConnectRequiredApproval } from '../core/extensions/mcpApprovalGateController'
import { TaskLifecycle } from '../lifecycle/taskLifecycle'
import { IncomingMessageHandler, PendingTaskEntry } from '../messageHandler'
import { progressReporterRegistry } from '../progress/sseProgressReporter'
@@ -124,6 +125,66 @@ describe('IncomingMessageHandler', () => {
expect(result.approval?.notification).toBe('Approve shell_exec?')
})
+ // U5 — a connect_required suspension must reach the polling wire with its
+ // discriminator so the desktop renders "Connect <server>", matching the SSE
+ // path. Event connect fields are taken from the REAL producer (T1).
+ it('resolves waiting_approval carrying the connect_required discriminator (sync path)', async () => {
+ const deps = createMockDeps()
+ const handler = new IncomingMessageHandler(createTestMessage(), deps)
+
+ const resultPromise = handler.execute()
+ await new Promise(r => setTimeout(r, 10))
+ const task = deps.messageQueue.dequeue()!
+
+ const approval = buildConnectRequiredApproval(
+ { id: 'tc_1', name: 'monday__list_boards', arguments: { limit: 5 } },
+ { mcpServerName: 'monday', provider: 'monday' }
+ )
+ deps.agent.emit('tool:approval_needed', {
+ data: {
+ taskId: task.id,
+ requestId: approval.request_id,
+ userId: 'user-1',
+ notification: 'Connect monday to continue',
+ reason: approval.reason,
+ mcpServerName: approval.mcpServerName,
+ provider: approval.provider,
+ },
+ })
+
+ const result = await resultPromise
+ expect(result.status).toBe('waiting_approval')
+ expect(result.approval).toMatchObject({
+ reason: 'connect_required',
+ mcpServerName: 'monday',
+ provider: 'monday',
+ })
+ })
+
+ it('resolves a generic waiting_approval without connect fields (back-compat, sync path)', async () => {
+ const deps = createMockDeps()
+ const handler = new IncomingMessageHandler(createTestMessage(), deps)
+
+ const resultPromise = handler.execute()
+ await new Promise(r => setTimeout(r, 10))
+ const task = deps.messageQueue.dequeue()!
+
+ deps.agent.emit('tool:approval_needed', {
+ data: {
+ taskId: task.id,
+ requestId: 'req-generic',
+ userId: 'user-1',
+ notification: 'Approve shell_exec?',
+ },
+ })
+
+ const result = await resultPromise
+ expect(result.approval).toBeDefined()
+ expect(result.approval).not.toHaveProperty('reason')
+ expect(result.approval).not.toHaveProperty('mcpServerName')
+ expect(result.approval).not.toHaveProperty('provider')
+ })
+
it('should store subsequent responses in pendingTaskResults', async () => {
const deps = createMockDeps()
const handler = new IncomingMessageHandler(createTestMessage(), deps)
@@ -223,6 +284,71 @@ describe('IncomingMessageHandler', () => {
expect(stored!.approval?.requestId).toBe('req-async-1')
expect(stored!.approval?.notification).toBe('Approve async tool?')
})
+
+ // U5 — the stored async approval entry (polled via GET /tasks/:id/result →
+ // handleTaskResult) must carry the connect_required discriminator so a
+ // reconnecting desktop rebuilds the connect suspension. Event connect fields
+ // taken from the REAL producer (T1).
+ it('stores the connect_required discriminator in pendingTaskResults (async path)', async () => {
+ const deps = createMockDeps()
+ const handler = new IncomingMessageHandler(createTestMessage(), deps)
+
+ const result = handler.executeAsync()
+ const taskId = result.taskId!
+ const task = deps.messageQueue.dequeue()!
+
+ const approval = buildConnectRequiredApproval(
+ { id: 'tc_1', name: 'monday__list_boards', arguments: { limit: 5 } },
+ { mcpServerName: 'monday', provider: 'monday' }
+ )
+ deps.agent.emit('tool:approval_needed', {
+ data: {
+ taskId: task.id,
+ requestId: approval.request_id,
+ userId: 'user-1',
+ notification: 'Connect monday to continue',
+ reason: approval.reason,
+ mcpServerName: approval.mcpServerName,
+ provider: approval.provider,
+ },
+ })
+
+ await new Promise(r => setTimeout(r, 10))
+
+ const stored = deps.pendingTaskResults.get(taskId)
+ expect(stored).toBeDefined()
+ expect(stored!.approval).toMatchObject({
+ reason: 'connect_required',
+ mcpServerName: 'monday',
+ provider: 'monday',
+ })
+ })
+
+ it('stores a generic async approval without connect fields (back-compat)', async () => {
+ const deps = createMockDeps()
+ const handler = new IncomingMessageHandler(createTestMessage(), deps)
+
+ const result = handler.executeAsync()
+ const taskId = result.taskId!
+ const task = deps.messageQueue.dequeue()!
+
+ deps.agent.emit('tool:approval_needed', {
+ data: {
+ taskId: task.id,
+ requestId: 'req-async-generic',
+ userId: 'user-1',
+ notification: 'Approve async tool?',
+ },
+ })
+
+ await new Promise(r => setTimeout(r, 10))
+
+ const stored = deps.pendingTaskResults.get(taskId)
+ expect(stored!.approval).toBeDefined()
+ expect(stored!.approval).not.toHaveProperty('reason')
+ expect(stored!.approval).not.toHaveProperty('mcpServerName')
+ expect(stored!.approval).not.toHaveProperty('provider')
+ })
})
describe('approval cache invalidation', () => {
diff --git a/mcp-host/src/agent/__tests__/concurrentExecution.test.ts b/mcp-host/src/agent/__tests__/concurrentExecution.test.ts
index 450940c3c..96fa4f9e4 100644
--- a/mcp-host/src/agent/__tests__/concurrentExecution.test.ts
+++ b/mcp-host/src/agent/__tests__/concurrentExecution.test.ts
@@ -1,4 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { buildConnectRequiredApproval } from '../../core/extensions/mcpApprovalGateController'
import { runToolUseLoop } from '../../core/orchestration/toolUseLoop'
import { TaskLifecycle } from '../../lifecycle/taskLifecycle'
import { MessageQueue } from '../../queue/messageQueue'
@@ -133,6 +134,79 @@ describe('AgentStateMachine -- concurrent execution', () => {
expect(pending[0].userId).toBe('user-1')
})
+ // U5 — the polling projection of a connect_required suspension must carry the
+ // same discriminator the SSE `suspended` event does, so the desktop renders
+ // "Connect <server>" instead of a generic approval. Fixture built by the REAL
+ // producer (buildConnectRequiredApproval), never hand-shaped (T1).
+ it('getPendingApprovals surfaces reason/mcpServerName/provider for a connect_required suspension', async () => {
+ const approval = buildConnectRequiredApproval(
+ { id: 'tc_connect', name: 'monday__list_boards', arguments: { limit: 5 } },
+ { mcpServerName: 'monday', provider: 'monday' }
+ )
+ ;(runToolUseLoop as ReturnType<typeof vi.fn>).mockResolvedValueOnce({
+ type: 'need_approval',
+ approval,
+ })
+
+ const { agent } = setupAgent()
+ await agent.executeTask(createTestTask('list boards'))
+
+ const pending = agent.getPendingApprovals()
+ expect(pending).toHaveLength(1)
+ expect(pending[0]).toMatchObject({
+ reason: 'connect_required',
+ mcpServerName: 'monday',
+ provider: 'monday',
+ })
+ })
+
+ it('getPendingApprovals leaves a generic approval free of connect fields (back-compat)', async () => {
+ ;(runToolUseLoop as ReturnType<typeof vi.fn>).mockResolvedValueOnce({
+ type: 'need_approval',
+ approval: {
+ request_id: 'req-generic-1',
+ tool_name: 'shell_exec',
+ parameters: { command: 'ls' },
+ description: 'List files',
+ tool_call_id: 'tc_1',
+ context_snapshot: [],
+ },
+ })
+
+ const { agent } = setupAgent()
+ await agent.executeTask(createTestTask('run a command'))
+
+ const pending = agent.getPendingApprovals()
+ expect(pending).toHaveLength(1)
+ expect(pending[0]).not.toHaveProperty('reason')
+ expect(pending[0]).not.toHaveProperty('mcpServerName')
+ expect(pending[0]).not.toHaveProperty('provider')
+ })
+
+ it('emits tool:approval_needed carrying the connect_required discriminator', async () => {
+ const approval = buildConnectRequiredApproval(
+ { id: 'tc_connect', name: 'monday__list_boards', arguments: { limit: 5 } },
+ { mcpServerName: 'monday', provider: 'monday' }
+ )
+ ;(runToolUseLoop as ReturnType<typeof vi.fn>).mockResolvedValueOnce({
+ type: 'need_approval',
+ approval,
+ })
+
+ const { agent } = setupAgent()
+ const events: Array<{ data: Record<string, unknown> }> = []
+ agent.on('tool:approval_needed', (e: { data: Record<string, unknown> }) => events.push(e))
+
+ await agent.executeTask(createTestTask('list boards'))
+
+ expect(events).toHaveLength(1)
+ expect(events[0].data).toMatchObject({
+ reason: 'connect_required',
+ mcpServerName: 'monday',
+ provider: 'monday',
+ })
+ })
+
it('should resolve approval by requestId and resume execution', async () => {
// First call returns need_approval
;(runToolUseLoop as ReturnType<typeof vi.fn>)
diff --git a/mcp-host/src/agent/stateMachine.ts b/mcp-host/src/agent/stateMachine.ts
index 1c6a3b52d..c2ae3adae 100644
--- a/mcp-host/src/agent/stateMachine.ts
+++ b/mcp-host/src/agent/stateMachine.ts
@@ -70,6 +70,13 @@ export interface PendingApprovalInfo {
parameters: Record<string, unknown>
description: string
since: string
+ // U5 — suspension discriminator, mirrored from the underlying PendingApproval
+ // so the polling projections match the SSE `suspended` event. Absent reason ⇒
+ // generic HITL approval (back-compat). mcpServerName/provider set iff
+ // reason==='connect_required' (oauth connect flow).
+ reason?: 'approval_required' | 'connect_required'
+ mcpServerName?: string
+ provider?: string
}
/**
@@ -894,13 +901,26 @@ export class AgentStateMachine extends EventEmitter {
if (executor.executorState === 'waiting_approval' && executor.pendingApproval) {
const msg = executor.sourceTask.sourceMessage
const entry = this.approvalMap.get(executor.pendingApproval.request_id)
+ const approval = executor.pendingApproval
approvals.push({
- requestId: executor.pendingApproval.request_id,
+ requestId: approval.request_id,
userId: msg?.sender || 'anonymous',
- toolName: executor.pendingApproval.tool_name,
- parameters: executor.pendingApproval.parameters,
- description: executor.pendingApproval.description,
+ toolName: approval.tool_name,
+ parameters: approval.parameters,
+ description: approval.description,
since: entry?.registeredAt?.toISOString() ?? new Date().toISOString(),
+ // U5 — thread the connect_required discriminator; omitted for generic
+ // approvals so the legacy shape is byte-identical (back-compat).
+ // mcpServerName/provider ride ONLY connect_required, matching the SSE
+ // producer and the other polling projections (no stray field on a
+ // corrupt/legacy row whose reason normalized away).
+ ...(approval.reason ? { reason: approval.reason } : {}),
+ ...(approval.reason === 'connect_required' && approval.mcpServerName
+ ? { mcpServerName: approval.mcpServerName }
+ : {}),
+ ...(approval.reason === 'connect_required' && approval.provider
+ ? { provider: approval.provider }
+ : {}),
})
}
}
@@ -968,6 +988,20 @@ export class AgentStateMachine extends EventEmitter {
requestId: approval.request_id,
userId,
notification: notificationMsg,
+ // U5 — carry the connect_required discriminator down the polling chain
+ // (messageHandler → pendingTaskResults → handleTaskResult) so a REST poll
+ // reconstructs the connect suspension, matching the SSE `suspended` event.
+ // Omitted for generic approvals (back-compat).
+ ...(approval.reason ? { reason: approval.reason } : {}),
+ // mcpServerName/provider ride ONLY the connect_required discriminator, matching
+ // the SSE producer (sseProgressReporter) — so corrupt/legacy rows can never emit
+ // a stray field without its reason.
+ ...(approval.reason === 'connect_required' && approval.mcpServerName
+ ? { mcpServerName: approval.mcpServerName }
+ : {}),
+ ...(approval.reason === 'connect_required' && approval.provider
+ ? { provider: approval.provider }
+ : {}),
})
}
diff --git a/mcp-host/src/main.ts b/mcp-host/src/main.ts
index ee90f4ff2..9aa43190d 100644
--- a/mcp-host/src/main.ts
+++ b/mcp-host/src/main.ts
@@ -1782,6 +1782,17 @@ async function handleTaskResult(
requestId: result.approval.requestId,
userId: result.approval.userId,
notification: result.approval.notification,
+ // U5 — surface the connect_required discriminator on the REST poll so a
+ // reconnecting desktop rebuilds a "Connect <server>" suspension, not a
+ // generic approval. Omitted for generic approvals (back-compat).
+ ...(result.approval.reason ? { reason: result.approval.reason } : {}),
+ // mcpServerName/provider ride ONLY connect_required, matching the SSE producer.
+ ...(result.approval.reason === 'connect_required' && result.approval.mcpServerName
+ ? { mcpServerName: result.approval.mcpServerName }
+ : {}),
+ ...(result.approval.reason === 'connect_required' && result.approval.provider
+ ? { provider: result.approval.provider }
+ : {}),
},
model: result.model,
}
diff --git a/mcp-host/src/messageHandler.ts b/mcp-host/src/messageHandler.ts
index 3a092f9fb..8a3a901d4 100644
--- a/mcp-host/src/messageHandler.ts
+++ b/mcp-host/src/messageHandler.ts
@@ -45,6 +45,39 @@ export interface PendingTaskEntry {
requestId: string
userId: string
notification: string
+ // U5 — connect_required discriminator carried from the tool:approval_needed
+ // event so a REST poll rebuilds the connect suspension. Absent reason ⇒
+ // generic approval (back-compat).
+ reason?: 'approval_required' | 'connect_required'
+ mcpServerName?: string
+ provider?: string
+ }
+}
+
+/**
+ * U5 — pick the connect_required discriminator off a `tool:approval_needed`
+ * event payload for the polling `approval` projections (both the inline
+ * MessageResponse and the stored PendingTaskEntry). Returns an empty object for
+ * a generic approval so the legacy wire shape stays byte-identical
+ * (back-compat). Pure field propagation — the decision already happened
+ * upstream (buildConnectRequiredApproval); nothing is inferred here.
+ */
+function connectApprovalFields(data: Record<string, unknown>): {
+ reason?: 'approval_required' | 'connect_required'
+ mcpServerName?: string
+ provider?: string
+} {
+ const reason = data.reason as 'approval_required' | 'connect_required' | undefined
+ const isConnect = reason === 'connect_required'
+ return {
+ ...(reason ? { reason } : {}),
+ // mcpServerName/provider ride ONLY connect_required, matching the SSE producer.
+ // Runtime typeof guard: never pass a non-string through the blind cast even if
+ // an upstream contract ever regressed.
+ ...(isConnect && typeof data.mcpServerName === 'string'
+ ? { mcpServerName: data.mcpServerName }
+ : {}),
+ ...(isConnect && typeof data.provider === 'string' ? { provider: data.provider } : {}),
}
}
@@ -208,6 +241,7 @@ export class IncomingMessageHandler {
requestId: data.requestId as string,
userId: data.userId as string,
notification: data.notification as string,
+ ...connectApprovalFields(data),
},
})
}
@@ -413,6 +447,7 @@ export class IncomingMessageHandler {
requestId: data.requestId as string,
userId: data.userId as string,
notification: data.notification as string,
+ ...connectApprovalFields(data),
},
model: this.deps.getModel(),
})
@@ -433,6 +468,7 @@ export class IncomingMessageHandler {
requestId: data.requestId as string,
userId: data.userId as string,
notification: data.notification as string,
+ ...connectApprovalFields(data),
},
})
}
diff --git a/mcp-host/src/server/types.ts b/mcp-host/src/server/types.ts
index 4d688bb87..ad65fb7a6 100644
--- a/mcp-host/src/server/types.ts
+++ b/mcp-host/src/server/types.ts
@@ -83,6 +83,13 @@ export interface MessageResponse {
requestId: string
userId: string
notification: string
+ // U5 — connect_required discriminator, mirrored from the SSE `suspended`
+ // event so a REST poll rebuilds the connect suspension. Absent reason ⇒
+ // generic approval (back-compat). mcpServerName/provider set iff
+ // reason==='connect_required'.
+ reason?: 'approval_required' | 'connect_required'
+ mcpServerName?: string
+ provider?: string
}
}
@@ -109,6 +116,11 @@ export interface StatusResponse {
parameters: Record<string, unknown>
description: string
since: string
+ // U5 — connect_required discriminator, mirrored from the underlying
+ // PendingApproval. Absent reason ⇒ generic approval (back-compat).
+ reason?: 'approval_required' | 'connect_required'
+ mcpServerName?: string
+ provider?: string
}>
/**
* Per-MCP-server health snapshot (spec §4.2). Omitted by older mcp-host
@@ -474,7 +486,16 @@ export interface SessionTokensWire {
export interface SessionStateWire {
state: 'idle' | 'processing' | 'awaiting_approval'
activeTaskId?: string
- pendingApproval?: { requestId: string; displayName: string }
+ pendingApproval?: {
+ requestId: string
+ displayName: string
+ // U5 — connect_required discriminator, projected on the REST rejoin snapshot
+ // so a reconnecting desktop rebuilds a "Connect <server>" suspension. Absent
+ // reason ⇒ generic approval (back-compat). Set by `sessionRouteHandlers`.
+ reason?: 'approval_required' | 'connect_required'
+ mcpServerName?: string
+ provider?: string
+ }
/** Lifetime token totals; omitted when the session has had no LLM call yet. */
tokens?: SessionTokensWire
}