重构会话agent连接、初始化、加载配置流程

This commit is contained in:
xintaofei
2026-03-26 19:55:28 +08:00
parent 484cb3557a
commit d1eaa8f725
17 changed files with 154 additions and 28 deletions

View File

@@ -4,6 +4,7 @@ import { useCallback, useMemo, useSyncExternalStore } from "react"
import {
useAcpActions,
useConnectionStore,
getCachedSelectors,
type ConnectionState,
type ConnectOptions,
type LiveMessage,
@@ -80,8 +81,12 @@ export function useConnection(contextKey: string): UseConnectionReturn {
const supportsFork = connection?.supportsFork ?? false
const selectorsReady = connection?.selectorsReady ?? false
const sessionId = connection?.sessionId ?? null
const modes = connection?.modes ?? null
const configOptions = connection?.configOptions ?? null
const cached = connection?.agentType
? getCachedSelectors(connection.agentType)
: null
const modes = connection?.modes ?? cached?.modes ?? null
const configOptions =
connection?.configOptions ?? cached?.configOptions ?? null
const availableCommands = connection?.availableCommands ?? null
const liveMessage = connection?.liveMessage ?? null
const pendingPermission = connection?.pendingPermission ?? null