mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
* fix(ssh): say where Orca runs instead of "managed server" in the UI Users read "managed server" as hosting run by someone else, so they declined moving their SSH hosts. Every user-facing string now says "Orca on <host>" or "this host's Orca server", in all six locales; Settings > "Orca on your SSH hosts" and the setup line say the code and files stay where they are and only Orca's list of projects, tabs and terminals moves to the host. CLI command names, logs and identifiers are unchanged. Fixes #30880 Co-Authored-By: Claude <noreply@anthropic.com> * fix(ssh): reassure only when something moves; name the host's label in its row Review follow-ups: the reassurance shows only while Orca sets itself up or moves a host, not on every reconnect; the converting line no longer repeats it; the row names the SSH host's current label; the section description and the Move anyway dialog stop repeating themselves; translate the Restart dialog's buttons; drop "managed" from the remaining raw causes and the external automation refusal. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
71 lines
3.0 KiB
TypeScript
71 lines
3.0 KiB
TypeScript
import {
|
|
isEphemeralVmRuntimeEnvironment,
|
|
type KnownRuntimeEnvironment,
|
|
type RuntimeEnvironmentSource
|
|
} from './runtime-environments'
|
|
import { RuntimeEnvironmentStoreError } from './runtime-environment-store-file'
|
|
|
|
/** Refuses replacing or removing a pairing that SSH access or a managed deployment depends on. */
|
|
export function assertNoIndependentSshAccess(environment: KnownRuntimeEnvironment): void {
|
|
if (environment.orcadDeployment) {
|
|
throw new RuntimeEnvironmentStoreError(
|
|
'invalid_argument',
|
|
'Orca runs this server on an SSH host for you; its pairing cannot be replaced or removed here. To decommission it, run `orca environment stop --environment <name> --yes` or use Settings > Orca on your SSH hosts; for a host that is gone, run `orca environment forget --environment <name> --yes`.'
|
|
)
|
|
}
|
|
if (environment.pendingSshAccessOperation) {
|
|
throw new RuntimeEnvironmentStoreError(
|
|
'invalid_argument',
|
|
"This server's SSH access change didn't finish. Retry or cancel it under Settings > Remote Orca Servers > SSH access for paired servers before replacing its pairing or removing it."
|
|
)
|
|
}
|
|
if (environment.sshAccess) {
|
|
throw new RuntimeEnvironmentStoreError(
|
|
'invalid_argument',
|
|
"Unlink this server's SSH access under Settings > Remote Orca Servers > SSH access for paired servers before replacing its pairing or removing it."
|
|
)
|
|
}
|
|
}
|
|
|
|
/** Refuses folding a new code into a saved server that another flow owns, naming that server. */
|
|
export function assertPairingReplaceableByAdd(
|
|
environment: KnownRuntimeEnvironment,
|
|
source: RuntimeEnvironmentSource | undefined,
|
|
refreshable: boolean
|
|
): void {
|
|
const alreadyPaired = `This server is already paired as "${environment.name}".`
|
|
// Why: a cloud workspace pairs its own server on resume; a hand-made pairing would be swept with it.
|
|
if (isEphemeralVmRuntimeEnvironment(environment)) {
|
|
throw new RuntimeEnvironmentStoreError(
|
|
'invalid_argument',
|
|
`${alreadyPaired} It belongs to a cloud workspace, which pairs it again when it resumes.`
|
|
)
|
|
}
|
|
if (source === 'ephemeral-vm') {
|
|
throw new RuntimeEnvironmentStoreError(
|
|
'invalid_argument',
|
|
`${alreadyPaired} The cloud workspace's server reuses that server's identity, so it was not saved.`
|
|
)
|
|
}
|
|
if (environment.orcadDeployment?.kind === 'wsl') {
|
|
throw new RuntimeEnvironmentStoreError(
|
|
'invalid_argument',
|
|
`${alreadyPaired} Orca manages it as a WSL host, so its pairing cannot be replaced here.`
|
|
)
|
|
}
|
|
try {
|
|
assertNoIndependentSshAccess(environment)
|
|
} catch (error) {
|
|
throw error instanceof RuntimeEnvironmentStoreError
|
|
? new RuntimeEnvironmentStoreError(error.code, `${alreadyPaired} ${error.message}`)
|
|
: error
|
|
}
|
|
// Why: only the app holding this server's connections can switch them to a new pairing.
|
|
if (!refreshable) {
|
|
throw new RuntimeEnvironmentStoreError(
|
|
'invalid_argument',
|
|
`${alreadyPaired} To update its connection, add it again under Settings > Remote Orca Servers.`
|
|
)
|
|
}
|
|
}
|