feat: keep managed SSH prompts running on Hosts

Managed SSH prompts previously depended on Desktop-owned provider and transcript state, so accepted work could stop or become uncertain when the Desktop, network, or power disappeared. The Agent now owns accepted OpenCode prompt execution, model and tool rounds, cancellation, and the durable semantic transcript, while Desktop remains authoritative for permanent projects, conversations, tasks, and messages.

Recovered work attaches to the original conversation without replay. The project switcher also groups managed SSH projects by saved Host and shows live Agent connectivity beside each group without opening a connection merely to read status. Remote project subtitles now show only the path, and the Agent lock advances to 0.11.14 with Runtime ACP v4.

Release note: 托管 SSH 任务在桌面端、网络或电源中断后可继续在主机上运行,并能回到原会话精确恢复;项目菜单现按主机分组并显示实时连接状态。
This commit is contained in:
mesalogo
2026-08-31 11:04:41 +08:00
parent f6f8d5e053
commit 561de29f00
75 changed files with 13439 additions and 1327 deletions
+20 -12
View File
@@ -75,11 +75,11 @@ export interface RuntimeSessionBindingStore {
acpSessionId: string
): Promise<RuntimeSessionBinding>
/**
* Atomically moves an idle durable ACP session onto a newly opened
* transport epoch. Prompt identity and ACP session ownership remain fixed;
* transport cursors restart at zero for the new epoch.
* Atomically moves an idle or actively recovering ACP session onto a newly
* opened transport epoch. Prompt identity and ACP session ownership remain
* fixed; transport cursors restart at zero for the new epoch.
*/
rotateReadyTransport(
rotateTransport(
bindingId: string,
expected: RuntimeSessionTransportIdentity,
next: RuntimeSessionTransportIdentity
@@ -251,7 +251,7 @@ function assertBindingUpdateAllowed(
}
}
function rotateReadyBinding(
function rotateBindingTransport(
current: RuntimeSessionBinding,
bindingId: string,
expected: RuntimeSessionTransportIdentity,
@@ -259,11 +259,19 @@ function rotateReadyBinding(
): RuntimeSessionBinding {
if (
current.bindingId !== bindingId ||
current.state !== 'ready' ||
current.activePromptOperationId !== undefined
!(
(
current.state === 'ready' &&
current.activePromptOperationId === undefined
) ||
(
current.state === 'prompt-running' &&
current.activePromptOperationId !== undefined
)
)
) {
throw new RuntimeSessionBindingConflictError(
'Only an idle ready Runtime binding can rotate transport'
'Only an idle or actively recovering Runtime binding can rotate transport'
)
}
if (
@@ -481,7 +489,7 @@ export class SqliteRuntimeSessionBindingStore
return structuredClone(result)
}
async rotateReadyTransport(
async rotateTransport(
bindingId: string,
expected: RuntimeSessionTransportIdentity,
next: RuntimeSessionTransportIdentity
@@ -495,7 +503,7 @@ export class SqliteRuntimeSessionBindingStore
'Cannot rotate transport for an unknown Runtime binding'
)
}
const rotated = rotateReadyBinding(
const rotated = rotateBindingTransport(
this.decode(row),
bindingId,
expected,
@@ -812,7 +820,7 @@ export class MemoryRuntimeSessionBindingStore
return structuredClone(claimed)
}
async rotateReadyTransport(
async rotateTransport(
bindingId: string,
expected: RuntimeSessionTransportIdentity,
next: RuntimeSessionTransportIdentity
@@ -823,7 +831,7 @@ export class MemoryRuntimeSessionBindingStore
'Cannot rotate transport for an unknown Runtime binding'
)
}
const rotated = rotateReadyBinding(
const rotated = rotateBindingTransport(
current,
bindingId,
expected,