MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveProxyLeaseState

Function resolveProxyLeaseState

src/cli/commands/connection-runtime.ts:705–733  ·  view source on GitHub ↗
(options: {
  command: string;
  client: AgentDeviceClient;
  state: RemoteConnectionState;
  flags: CliFlags;
  leaseBackend?: LeaseBackend;
})

Source from the content-addressed store, hash-verified

703}
704
705async function resolveProxyLeaseState(options: {
706 command: string;
707 client: AgentDeviceClient;
708 state: RemoteConnectionState;
709 flags: CliFlags;
710 leaseBackend?: LeaseBackend;
711}): Promise<{ state: RemoteConnectionState; device?: DeviceInfo }> {
712 if (!proxyLeaseAllocatingCommands.has(options.command)) {
713 if (options.state.leaseId && options.state.deviceKey) return { state: options.state };
714 throw new AppError(
715 'INVALID_ARGS',
716 'No active proxy device lease for this session; run open first.',
717 );
718 }
719 const device = await resolveSelectedDevice(options.client, options.flags);
720 const deviceKey = buildProxyDeviceKey(device);
721 return {
722 state: {
723 ...options.state,
724 deviceKey,
725 leaseBackend:
726 options.state.leaseBackend ?? options.leaseBackend ?? leaseBackendForDevice(device),
727 platform: options.state.platform ?? device.platform,
728 target: options.state.target ?? device.target,
729 updatedAt: new Date().toISOString(),
730 },
731 device,
732 };
733}
734
735function applyResolvedDeviceSelector(flags: CliFlags, device: DeviceInfo): void {
736 flags.platform = device.platform;

Callers

nothing calls this directly

Calls 3

resolveSelectedDeviceFunction · 0.85
buildProxyDeviceKeyFunction · 0.85
leaseBackendForDeviceFunction · 0.85

Tested by

no test coverage detected