| 188 | const cliPromptLock = Semaphore.makeUnsafe(1); |
| 189 | |
| 190 | const cliEnv = (auth: ResolvedAuth): Record<string, string | undefined> => { |
| 191 | const env: Record<string, string | undefined> = { ...process.env }; |
| 192 | // An inherited token would override `--account` and silently route a |
| 193 | // desktop-app call to whatever service account the parent process carries. |
| 194 | delete env["OP_SERVICE_ACCOUNT_TOKEN"]; |
| 195 | if (auth.kind === "service-account") env["OP_SERVICE_ACCOUNT_TOKEN"] = auth.token; |
| 196 | return env; |
| 197 | }; |
| 198 | |
| 199 | const cliArgs = (auth: ResolvedAuth, base: readonly string[]): readonly string[] => |
| 200 | auth.kind === "desktop-app" ? [...base, `--account=${auth.accountName}`] : base; |