mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 10:37:35 +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>
89 lines
2.4 KiB
TypeScript
89 lines
2.4 KiB
TypeScript
import type { PairedRuntimeConnection } from '../../shared/paired-runtime-connection'
|
|
import type { RuntimeCapability } from '../../shared/protocol-version'
|
|
import { sendRemoteRuntimeRequest } from '../../shared/remote-runtime-client'
|
|
import type {
|
|
RuntimeOrchestrationEnvelope,
|
|
RuntimeRpcResponse
|
|
} from '../../shared/runtime-rpc-envelope'
|
|
import {
|
|
sendRemoteRuntimeConnectionRequest,
|
|
sendRemoteRuntimeSharedControlRequest
|
|
} from './runtime-environment-request-connections'
|
|
|
|
export function sendRemoteRuntimeRequestAbortable(
|
|
connection: PairedRuntimeConnection,
|
|
method: string,
|
|
params: unknown,
|
|
timeoutMs: number,
|
|
envelope?: RuntimeOrchestrationEnvelope,
|
|
signal?: AbortSignal,
|
|
clientCapabilities: readonly RuntimeCapability[] = []
|
|
): Promise<RuntimeRpcResponse<unknown>> {
|
|
if (signal || clientCapabilities.length > 0) {
|
|
return sendRemoteRuntimeRequest(
|
|
connection,
|
|
method,
|
|
params,
|
|
timeoutMs,
|
|
envelope,
|
|
signal,
|
|
clientCapabilities
|
|
)
|
|
}
|
|
return envelope
|
|
? sendRemoteRuntimeRequest(connection, method, params, timeoutMs, envelope)
|
|
: sendRemoteRuntimeRequest(connection, method, params, timeoutMs)
|
|
}
|
|
|
|
export function sendRemoteRuntimeConnectionRequestAbortable(
|
|
environmentId: string,
|
|
connection: PairedRuntimeConnection,
|
|
method: string,
|
|
params: unknown,
|
|
timeoutMs: number,
|
|
signal?: AbortSignal
|
|
): Promise<RuntimeRpcResponse<unknown>> {
|
|
return signal
|
|
? sendRemoteRuntimeConnectionRequest(
|
|
environmentId,
|
|
connection,
|
|
method,
|
|
params,
|
|
timeoutMs,
|
|
signal
|
|
)
|
|
: sendRemoteRuntimeConnectionRequest(environmentId, connection, method, params, timeoutMs)
|
|
}
|
|
|
|
export function sendRemoteRuntimeSharedControlRequestAbortable(
|
|
environmentId: string,
|
|
connection: PairedRuntimeConnection,
|
|
method: string,
|
|
params: unknown,
|
|
timeoutMs: number,
|
|
envelope?: RuntimeOrchestrationEnvelope,
|
|
signal?: AbortSignal
|
|
): Promise<RuntimeRpcResponse<unknown>> {
|
|
if (signal) {
|
|
return sendRemoteRuntimeSharedControlRequest(
|
|
environmentId,
|
|
connection,
|
|
method,
|
|
params,
|
|
timeoutMs,
|
|
envelope,
|
|
signal
|
|
)
|
|
}
|
|
return envelope
|
|
? sendRemoteRuntimeSharedControlRequest(
|
|
environmentId,
|
|
connection,
|
|
method,
|
|
params,
|
|
timeoutMs,
|
|
envelope
|
|
)
|
|
: sendRemoteRuntimeSharedControlRequest(environmentId, connection, method, params, timeoutMs)
|
|
}
|