mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
Desktop, CLI, web and runtime transports now take a PairedRuntimeConnection (endpoint, pinned host key, credential) instead of a PairingOffer. Offers stay on the pairing input path (codes, QR, links, environment add) and are converted with pairedRuntimeConnectionFromOffer. The credential is token-only today; request envelopes still carry the same deviceToken, so the wire is unchanged. This lets device-key and ticket credentials replace the token later without touching every connect call site again. Co-authored-by: m4air <m4air@Mac.localdomain>
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import type { PairedRuntimeConnection } from '../../shared/paired-runtime-connection'
|
|
import type { KnownRuntimeEnvironment } from '../../shared/runtime-environments'
|
|
import { RemoteRuntimeClientError } from '../../shared/remote-runtime-client-error'
|
|
import {
|
|
getAcceptedRuntimeEnvironmentCapabilityOutcome,
|
|
resetRuntimeEnvironmentCapabilityEvidence,
|
|
type RuntimeEnvironmentCapabilityOutcome
|
|
} from './runtime-environment-capability-evidence'
|
|
import {
|
|
getRuntimeEnvironmentStatusOwner,
|
|
resetRuntimeEnvironmentStatusOwners
|
|
} from './runtime-environment-request-connections'
|
|
|
|
export function resetSharedControlSupport(): void {
|
|
resetRuntimeEnvironmentStatusOwners()
|
|
resetRuntimeEnvironmentCapabilityEvidence()
|
|
}
|
|
|
|
export async function supportsSharedControl(
|
|
userDataPath: string,
|
|
environment: KnownRuntimeEnvironment,
|
|
connection: PairedRuntimeConnection,
|
|
timeoutMs: number
|
|
): Promise<RuntimeEnvironmentCapabilityOutcome> {
|
|
const accepted = getAcceptedRuntimeEnvironmentCapabilityOutcome(
|
|
environment.id,
|
|
connection,
|
|
environment.runtimeId
|
|
)
|
|
if (accepted) {
|
|
return accepted
|
|
}
|
|
const response = await getRuntimeEnvironmentStatusOwner(userDataPath, environment.id).refresh({
|
|
timeoutMs
|
|
})
|
|
if (!response.ok) {
|
|
throw new RemoteRuntimeClientError(response.error.code, response.error.message)
|
|
}
|
|
return (
|
|
getAcceptedRuntimeEnvironmentCapabilityOutcome(
|
|
environment.id,
|
|
connection,
|
|
response._meta.runtimeId
|
|
) ?? { kind: 'stale_incarnation' }
|
|
)
|
|
}
|