(options: {
command: string;
client: AgentDeviceClient;
state: RemoteConnectionState;
flags: CliFlags;
leaseBackend?: LeaseBackend;
})
| 703 | } |
| 704 | |
| 705 | async 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 | |
| 735 | function applyResolvedDeviceSelector(flags: CliFlags, device: DeviceInfo): void { |
| 736 | flags.platform = device.platform; |
nothing calls this directly
no test coverage detected