fix: make managed SSH sessions fast and resilient
GoodBuddy Agents / Validate Agent source (push) Canceled after 0s
GoodBuddy Agents / Build Linux arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build Linux x64 Agent (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
GoodBuddy Agents / Validate Agent source (push) Canceled after 0s
GoodBuddy Agents / Build Linux arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build Linux x64 Agent (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
Managed SSH project selection repeatedly activated the remote Host and could leave idle ACP bindings rejected as stale-controller after a controller generation change. Host environment updates also coupled project state to component installation evidence and presented a crowded control surface. Project selection is now local-only, one Host connection serves compatible project and conversation callers, idle bindings are safely replaced only after proven controller takeover, and active prompts keep exact resume/replay. Remote environment setup now uses explicit signed compound package preparation with bounded transfer, rollback, recovery, and clearer settings. Managed Hosts must be updated to separately distributed Agent 0.11.6 before the daemon-side controller recovery fix takes effect. Desktop packages do not embed the Agent or remote Runtime, and existing project data is preserved. Release note: 托管 SSH 项目切换不再重复连接,同一 Host 可顺畅承载多个项目和对话;同时修复重连后的 stale-controller,并优化远程环境安装、更新与状态布局。
This commit is contained in:
+39
-33
@@ -227,9 +227,11 @@ import {
|
||||
sshHostDraftInspectionRequestSchema,
|
||||
sshHostRequestSchema,
|
||||
remoteEnvironmentUpdateProgressSchema,
|
||||
remoteEnvironmentUpdateRequestSchema,
|
||||
sshHostRemoteEnvironmentSchema,
|
||||
sshHostValidationRequestSchema,
|
||||
type RemoteEnvironmentUpdateProgress
|
||||
type RemoteEnvironmentUpdateProgress,
|
||||
type SshHostProjectReference
|
||||
} from '../shared/ssh-host-contracts'
|
||||
import type { SshHostService } from './ssh/ssh-host-service'
|
||||
import type { SshHostDirectoryBrowser } from './ssh/ssh-host-directory-browser'
|
||||
@@ -241,9 +243,9 @@ import {
|
||||
remoteProjectSaveRequestSchema,
|
||||
type RemoteProjectSaveProgress
|
||||
} from '../shared/remote-project-candidate-contracts'
|
||||
import type {
|
||||
RemoteProjectSaveOwner,
|
||||
RemoteProjectSaveService
|
||||
import {
|
||||
type RemoteProjectSaveOwner,
|
||||
type RemoteProjectSaveService
|
||||
} from './remote-agent/remote-project-save-service'
|
||||
import type {
|
||||
RemoteEnvironmentUpdateOwner,
|
||||
@@ -326,7 +328,6 @@ import {
|
||||
ExecutionSpaceResolver,
|
||||
REMOTE_EXECUTION_SPACE_UNAVAILABLE
|
||||
} from './execution-space'
|
||||
import { assertRemoteRuntimeRequestValidated } from './execution-space/remote-runtime-request-validation'
|
||||
|
||||
const requestIdSchema = z.string().uuid()
|
||||
const BACKGROUND_QUESTION_REJECTION_TIMEOUT_MS = 1_000
|
||||
@@ -1133,9 +1134,6 @@ export function registerIpcHandlers(
|
||||
selection
|
||||
)
|
||||
}
|
||||
if (executionSpace?.kind === 'ssh') {
|
||||
assertRemoteRuntimeRequestValidated(executionSpace)
|
||||
}
|
||||
return selectedRuntimes.getRuntime(selection, executionSpace)
|
||||
}
|
||||
const channels = Object.values(ipcChannels).filter(
|
||||
@@ -4112,7 +4110,24 @@ export function registerIpcHandlers(
|
||||
if (!sshHostService) {
|
||||
throw new Error('SSH 主机设置服务不可用')
|
||||
}
|
||||
return sshHostService.getSnapshot()
|
||||
const snapshot = await sshHostService.getSnapshot()
|
||||
const projectReferences: Record<
|
||||
string,
|
||||
SshHostProjectReference[]
|
||||
> = {}
|
||||
for (const reference of
|
||||
assistantDatabase.listSshHostProjectReferences()) {
|
||||
const projects = projectReferences[reference.hostId] ?? []
|
||||
projects.push({
|
||||
id: reference.id,
|
||||
name: reference.name
|
||||
})
|
||||
projectReferences[reference.hostId] = projects
|
||||
}
|
||||
return {
|
||||
...snapshot,
|
||||
projectReferences
|
||||
}
|
||||
})
|
||||
|
||||
registerHandler(
|
||||
@@ -4222,12 +4237,15 @@ export function registerIpcHandlers(
|
||||
throw new Error('SSH 主机设置服务不可用')
|
||||
}
|
||||
const hostId = sshHostRequestSchema.parse(input).hostId
|
||||
const referencingProjectIds =
|
||||
assistantDatabase.listProjectIdsReferencingSshHost(hostId)
|
||||
if (referencingProjectIds.length > 0) {
|
||||
throw new Error('SSH 主机仍被项目引用,无法删除')
|
||||
const deletedProjects = await sshHostService.remove(
|
||||
hostId,
|
||||
() =>
|
||||
assistantDatabase.deleteProjectsReferencingSshHost(hostId)
|
||||
)
|
||||
return {
|
||||
hostId,
|
||||
deletedProjects
|
||||
}
|
||||
return sshHostService.remove(hostId)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -4296,10 +4314,11 @@ export function registerIpcHandlers(
|
||||
if (!remoteEnvironmentUpdateService) {
|
||||
throw new Error('SSH 远端运行环境更新服务不可用')
|
||||
}
|
||||
const hostId = sshHostRequestSchema.parse(input).hostId
|
||||
const request =
|
||||
remoteEnvironmentUpdateRequestSchema.parse(input)
|
||||
await remoteEnvironmentUpdateService.update(
|
||||
event.sender,
|
||||
hostId,
|
||||
request,
|
||||
(progress) =>
|
||||
sendRemoteEnvironmentUpdateProgress(
|
||||
event.sender,
|
||||
@@ -5175,22 +5194,6 @@ export function registerIpcHandlers(
|
||||
}
|
||||
)
|
||||
|
||||
registerHandler(
|
||||
ipcChannels.remoteProjectActivate,
|
||||
async (event, input: unknown) => {
|
||||
assertTrustedSender(event, window)
|
||||
await requireRemoteProjectsEnabled()
|
||||
if (!remoteProjectSaveService) {
|
||||
throw new Error('远程项目验证服务不可用')
|
||||
}
|
||||
const result = await remoteProjectSaveService.activate(
|
||||
event.sender,
|
||||
assistantIdSchema.parse(input)
|
||||
)
|
||||
return result
|
||||
}
|
||||
)
|
||||
|
||||
registerHandler(
|
||||
ipcChannels.remoteProjectSave,
|
||||
async (event, input: unknown) => {
|
||||
@@ -5262,7 +5265,10 @@ export function registerIpcHandlers(
|
||||
}
|
||||
assistantDatabase.deleteProject(
|
||||
value.projectId,
|
||||
value.confirmation
|
||||
value.confirmation,
|
||||
{
|
||||
allowActiveTasks: project.executionSpace?.kind === 'ssh'
|
||||
}
|
||||
)
|
||||
await selectedRuntimes?.reset?.()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user