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
@@ -60,6 +60,7 @@ export class SelectedRuntimeManager implements SelectedRuntimeResolver {
Promise<RuntimeNativeSnapshot>
>()
private useSequence = 0
private applicationExitDetachment?: Promise<void>
constructor(
private readonly createRuntime: (
@@ -252,6 +253,10 @@ export class SelectedRuntimeManager implements SelectedRuntimeResolver {
}
async dispose(): Promise<void> {
if (this.applicationExitDetachment) {
await this.applicationExitDetachment
return
}
this.disposed = true
const entries = [...this.entries.values()]
this.entries.clear()
@@ -268,6 +273,33 @@ export class SelectedRuntimeManager implements SelectedRuntimeResolver {
await Promise.allSettled([...this.retiring])
}
detachForApplicationExit(): Promise<void> {
if (this.applicationExitDetachment) {
return this.applicationExitDetachment
}
this.disposed = true
const entries = [...this.entries.values()]
this.entries.clear()
const operation = (async () => {
const controllers = await Promise.allSettled(
entries.map(({ operation }) => operation)
)
const current = controllers.flatMap((result) =>
result.status === 'fulfilled' ? [result.value] : []
)
await Promise.allSettled(
[...new Set([...current, ...this.retiringControllers])].map(
(controller) =>
controller.detachForApplicationExit()
)
)
await Promise.allSettled([...this.tests])
await Promise.allSettled([...this.snapshots])
})()
this.applicationExitDetachment = operation
return operation
}
private async runConnectionTest(
selection: AgentRuntimeSelection
): Promise<AgentRuntimeStatus> {