You've already forked agentic-coding-workflow
改动
This commit is contained in:
@@ -16,6 +16,7 @@ export interface UseAcpStreamReturn {
|
||||
sessionStatus: Ref<SessionStatus>
|
||||
events: Ref<AcpEvent[]>
|
||||
pendingPermissions: Ref<PermissionRequest[]>
|
||||
errorMsg: Ref<string | null>
|
||||
prompt: (text: string, agentSessionID: string) => void
|
||||
cancel: (agentSessionID: string) => void
|
||||
reconnect: () => void
|
||||
@@ -49,6 +50,7 @@ export function useAcpStream(sessionId: string): UseAcpStreamReturn {
|
||||
const sessionStatus = ref<SessionStatus>('starting')
|
||||
const events = ref<AcpEvent[]>([])
|
||||
const pendingPermissions = ref<PermissionRequest[]>([])
|
||||
const errorMsg = ref<string | null>(null)
|
||||
const lastEventID = ref(0)
|
||||
|
||||
function upsertPermission(p: PermissionRequest) {
|
||||
@@ -118,6 +120,13 @@ export function useAcpStream(sessionId: string): UseAcpStreamReturn {
|
||||
return
|
||||
}
|
||||
|
||||
// 客户端错误帧(bad json / 无权限 / 方法不允许 / 转发失败)——单独提示,不进 events 流。
|
||||
if (obj.kind === 'client_error') {
|
||||
const msg = typeof obj.message === 'string' ? obj.message : 'client error'
|
||||
errorMsg.value = msg
|
||||
return
|
||||
}
|
||||
|
||||
// Initial state event from server
|
||||
if (obj.kind === 'state') {
|
||||
const s = (parsed as ServerStateEvent).status
|
||||
@@ -209,5 +218,5 @@ export function useAcpStream(sessionId: string): UseAcpStreamReturn {
|
||||
connect()
|
||||
onScopeDispose(close)
|
||||
|
||||
return { status, sessionStatus, events, pendingPermissions, prompt, cancel, reconnect, close }
|
||||
return { status, sessionStatus, events, pendingPermissions, errorMsg, prompt, cancel, reconnect, close }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user