()
| 241 | } |
| 242 | |
| 243 | async function handleCodexDeviceLogin() { |
| 244 | const check = await checkExistingConnection("codex") |
| 245 | if (!check.proceed) { |
| 246 | prompts.outro("Cancelled") |
| 247 | return |
| 248 | } |
| 249 | |
| 250 | prompts.log.info("Authorize Codex with your ChatGPT subscription via device login.") |
| 251 | try { |
| 252 | await CodexClient.login() |
| 253 | |
| 254 | const codexAuth = await Auth.get("codex") |
| 255 | if (codexAuth) { |
| 256 | const authKey = check.connectionName ? Auth.formatKey("codex", check.connectionName) : "codex" |
| 257 | if (authKey !== "codex") { |
| 258 | await Auth.set(authKey, codexAuth) |
| 259 | await Auth.remove("codex") |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | prompts.log.success("Codex login successful") |
| 264 | prompts.outro("Done") |
| 265 | } catch (error) { |
| 266 | const message = error instanceof Error ? error.message : String(error) |
| 267 | prompts.log.error(`Codex login failed: ${message}`) |
| 268 | throw error |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | interface OllamaModel { |
| 273 | id: string |
no test coverage detected