提前检测Agent是否支持fork会话,避免无效展示和操作
This commit is contained in:
@@ -90,6 +90,7 @@ export interface ConnectionState {
|
||||
agentType: AgentType
|
||||
status: ConnectionStatus
|
||||
promptCapabilities: PromptCapabilitiesInfo
|
||||
supportsFork: boolean
|
||||
selectorsReady: boolean
|
||||
sessionId: string | null
|
||||
modes: SessionModeStateInfo | null
|
||||
@@ -180,6 +181,11 @@ type Action =
|
||||
contextKey: string
|
||||
promptCapabilities: PromptCapabilitiesInfo
|
||||
}
|
||||
| {
|
||||
type: "FORK_SUPPORTED"
|
||||
contextKey: string
|
||||
supported: boolean
|
||||
}
|
||||
| { type: "MODE_CHANGED"; contextKey: string; modeId: string }
|
||||
| {
|
||||
type: "PLAN_UPDATE"
|
||||
@@ -500,6 +506,7 @@ function connectionsReducer(
|
||||
audio: false,
|
||||
embedded_context: false,
|
||||
},
|
||||
supportsFork: false,
|
||||
selectorsReady: false,
|
||||
sessionId: null,
|
||||
modes: null,
|
||||
@@ -889,6 +896,18 @@ function connectionsReducer(
|
||||
return next
|
||||
}
|
||||
|
||||
case "FORK_SUPPORTED": {
|
||||
const conn = state.get(action.contextKey)
|
||||
if (!conn) return state
|
||||
if (conn.supportsFork === action.supported) return state
|
||||
const next = new Map(state)
|
||||
next.set(action.contextKey, {
|
||||
...conn,
|
||||
supportsFork: action.supported,
|
||||
})
|
||||
return next
|
||||
}
|
||||
|
||||
case "MODE_CHANGED": {
|
||||
const conn = state.get(action.contextKey)
|
||||
if (!conn?.modes) return state
|
||||
@@ -1469,6 +1488,14 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) {
|
||||
promptCapabilities: e.prompt_capabilities,
|
||||
})
|
||||
break
|
||||
case "fork_supported":
|
||||
flushStreamingQueue()
|
||||
dispatch({
|
||||
type: "FORK_SUPPORTED",
|
||||
contextKey,
|
||||
supported: e.supported,
|
||||
})
|
||||
break
|
||||
case "mode_changed":
|
||||
flushStreamingQueue()
|
||||
dispatch({
|
||||
|
||||
Reference in New Issue
Block a user