Files
orca/src/shared/project-host-setup-target.ts
T
Neil c0b2df5d8d fix(ssh): leave an unlinked host disconnected, and name it when a project needs its server (#38746)
Forget and Stop removed the managed server but left the SSH host's transport up with nothing
serving it, so project setup offered the host and then failed with the raw connection id.
The unlink now hangs up the host's transport inside its lifecycle, so every surface offers
Connect (which sets a server up again) and a Connect queued behind the unlink still wins.
The setup error names the host and its toast offers Connect, and the forget/stop help says
the host is disconnected.

Fixes #37767
2026-11-05 16:44:40 -08:00

28 lines
1.0 KiB
TypeScript

import type { ExecutionHostId } from './execution-host'
export const SERVER_SSH_PROJECT_ADD_UNAVAILABLE_MESSAGE =
"This Orca server can't add projects on its SSH hosts. Add the SSH host on your computer to open its projects."
/** Projects on an SSH host live in its Orca server, which only connecting the host sets up. */
export function sshHostWithoutServerMessage(hostLabel: string): string {
return `No Orca server is running on ${hostLabel} yet. Connect the host to set one up, then try again.`
}
/** Repo IDs can repeat across hosts; hostId selects the intended setup, while older clients omit it and retain first-ID matching. */
export type ProjectHostSetupTarget = {
setupId: string
hostId?: ExecutionHostId
}
type SetupIdentity = { id: string; hostId: string }
export function findProjectHostSetup<T extends SetupIdentity>(
setups: readonly T[],
target: ProjectHostSetupTarget
): T | undefined {
return setups.find(
(setup) =>
setup.id === target.setupId && (target.hostId === undefined || setup.hostId === target.hostId)
)
}