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:
@@ -98,6 +98,10 @@ class DrainableTestRuntime extends TestRuntime {
|
||||
}
|
||||
}
|
||||
|
||||
class DetachableTestRuntime extends DrainableTestRuntime {
|
||||
readonly detachForApplicationExit = vi.fn(() => undefined)
|
||||
}
|
||||
|
||||
describe('AgentRuntimeController', () => {
|
||||
it('fails retired runtime requests and disposes them after exit', async () => {
|
||||
const previous = new TestRuntime(true, true)
|
||||
@@ -397,6 +401,35 @@ describe('AgentRuntimeController', () => {
|
||||
await stream.return()
|
||||
})
|
||||
|
||||
it('detaches a remote runtime on application exit without draining or disposing it', async () => {
|
||||
const runtime = new DetachableTestRuntime()
|
||||
const controller = new AgentRuntimeController(runtime, 1)
|
||||
const stream = controller.run(
|
||||
{
|
||||
requestId: '1c608898-ecb7-4081-8174-2b6a52f53b17',
|
||||
conversationId: 'conversation-application-exit',
|
||||
prompt: 'keep running remotely',
|
||||
workMode: 'execute'
|
||||
},
|
||||
new AbortController().signal
|
||||
)
|
||||
const pendingEvent = stream.next()
|
||||
await runtime.started
|
||||
|
||||
await controller.detachForApplicationExit()
|
||||
|
||||
expect(runtime.detachForApplicationExit).toHaveBeenCalledOnce()
|
||||
expect(runtime.beginDrain).not.toHaveBeenCalled()
|
||||
expect(runtime.forceShutdown).not.toHaveBeenCalled()
|
||||
expect(runtime.dispose).not.toHaveBeenCalled()
|
||||
|
||||
runtime.finish()
|
||||
await expect(pendingEvent).resolves.toMatchObject({
|
||||
value: { type: 'text' }
|
||||
})
|
||||
await stream.return()
|
||||
})
|
||||
|
||||
it('denies tool authorization in Ask mode without prompting the user', async () => {
|
||||
const runtime = new TestRuntime(false, false, true)
|
||||
const controller = new AgentRuntimeController(runtime)
|
||||
|
||||
Reference in New Issue
Block a user