( flags: CliFlags, connectionMetadata: RemoteConnectionRequestMetadata | undefined, )
| 127 | } |
| 128 | |
| 129 | function readRequiredConnectScope( |
| 130 | flags: CliFlags, |
| 131 | connectionMetadata: RemoteConnectionRequestMetadata | undefined, |
| 132 | ): { tenant: string; runId: string } { |
| 133 | if (!flags.tenant) { |
| 134 | throw new AppError( |
| 135 | 'INVALID_ARGS', |
| 136 | 'connect requires tenant in remote config or via --tenant <id>.', |
| 137 | ); |
| 138 | } |
| 139 | if (!flags.runId) { |
| 140 | throw new AppError( |
| 141 | 'INVALID_ARGS', |
| 142 | 'connect requires runId in remote config or via --run-id <id>.', |
| 143 | ); |
| 144 | } |
| 145 | if ( |
| 146 | !flags.daemonBaseUrl && |
| 147 | connectionProviderRequiresRemoteDaemon(connectionMetadata?.leaseProvider) |
| 148 | ) { |
| 149 | throw new AppError( |
| 150 | 'INVALID_ARGS', |
| 151 | 'connect requires daemonBaseUrl in remote config, config, env, or --daemon-base-url.', |
| 152 | ); |
| 153 | } |
| 154 | return { tenant: flags.tenant, runId: flags.runId }; |
| 155 | } |
| 156 | |
| 157 | type ConnectContext = { |
| 158 | session: string; |
no test coverage detected