(cwd, options = {})
| 923 | } |
| 924 | |
| 925 | export async function getCodexAuthStatus(cwd, options = {}) { |
| 926 | const availability = getCodexAvailability(cwd); |
| 927 | if (!availability.available) { |
| 928 | return { |
| 929 | available: false, |
| 930 | loggedIn: false, |
| 931 | detail: availability.detail, |
| 932 | source: "availability", |
| 933 | authMethod: null, |
| 934 | verified: null, |
| 935 | requiresOpenaiAuth: null, |
| 936 | provider: null |
| 937 | }; |
| 938 | } |
| 939 | |
| 940 | let client = null; |
| 941 | try { |
| 942 | client = await CodexAppServerClient.connect(cwd, { |
| 943 | env: options.env, |
| 944 | reuseExistingBroker: true |
| 945 | }); |
| 946 | return await getCodexAuthStatusFromClient(client, cwd); |
| 947 | } catch (error) { |
| 948 | return buildAuthStatus({ |
| 949 | loggedIn: false, |
| 950 | detail: error instanceof Error ? error.message : String(error), |
| 951 | source: "app-server" |
| 952 | }); |
| 953 | } finally { |
| 954 | if (client) { |
| 955 | await client.close().catch(() => {}); |
| 956 | } |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | export async function interruptAppServerTurn(cwd, { threadId, turnId }) { |
| 961 | if (!threadId || !turnId) { |
no test coverage detected