MCPcopy Create free account
hub / github.com/electric-sql/electric / readCodexAccessToken

Function readCodexAccessToken

packages/agents-runtime/src/model-runner.ts:45–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45export function readCodexAccessToken(): string | undefined {
46 const explicit = process.env.ELECTRIC_CODEX_ACCESS_TOKEN?.trim()
47 if (explicit) return explicit
48 if (process.env.ELECTRIC_CODEX_REQUIRE_OPT_IN === `1`) return undefined
49 try {
50 const raw = readFileSync(codexAuthPath(), `utf-8`)
51 const data = JSON.parse(raw) as {
52 auth_mode?: string
53 tokens?: { access_token?: string }
54 }
55 if (data.auth_mode !== `chatgpt`) return undefined
56 return data.tokens?.access_token?.trim() || undefined
57 } catch {
58 return undefined
59 }
60}
61
62export type AvailableProvider =
63 | `anthropic`

Callers 3

detectAvailableProvidersFunction · 0.85
resolveLowCostApiKeyFunction · 0.85

Calls 2

codexAuthPathFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected