@namzu/cli 13.0.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +79 -21
- package/dist/commands/login.js.map +1 -1
- package/dist/doctor/checks/credentials.d.ts.map +1 -1
- package/dist/doctor/checks/credentials.js +7 -1
- package/dist/doctor/checks/credentials.js.map +1 -1
- package/dist/integrations/providers/codex-device-login.d.ts +27 -0
- package/dist/integrations/providers/codex-device-login.d.ts.map +1 -0
- package/dist/integrations/providers/codex-device-login.js +195 -0
- package/dist/integrations/providers/codex-device-login.js.map +1 -0
- package/dist/integrations/providers/codex-oauth.d.ts +10 -0
- package/dist/integrations/providers/codex-oauth.d.ts.map +1 -0
- package/dist/integrations/providers/codex-oauth.js +95 -0
- package/dist/integrations/providers/codex-oauth.js.map +1 -0
- package/dist/integrations/providers/credential-store.d.ts +23 -4
- package/dist/integrations/providers/credential-store.d.ts.map +1 -1
- package/dist/integrations/providers/credential-store.js +125 -19
- package/dist/integrations/providers/credential-store.js.map +1 -1
- package/dist/integrations/providers/discover.d.ts +39 -13
- package/dist/integrations/providers/discover.d.ts.map +1 -1
- package/dist/integrations/providers/discover.js +122 -44
- package/dist/integrations/providers/discover.js.map +1 -1
- package/dist/integrations/providers/harness-credentials.d.ts +36 -0
- package/dist/integrations/providers/harness-credentials.d.ts.map +1 -0
- package/dist/integrations/providers/harness-credentials.js +146 -0
- package/dist/integrations/providers/harness-credentials.js.map +1 -0
- package/dist/integrations/providers/identity.d.ts +8 -15
- package/dist/integrations/providers/identity.d.ts.map +1 -1
- package/dist/integrations/providers/identity.js +8 -15
- package/dist/integrations/providers/identity.js.map +1 -1
- package/dist/integrations/providers/index.d.ts +6 -3
- package/dist/integrations/providers/index.d.ts.map +1 -1
- package/dist/integrations/providers/index.js +5 -2
- package/dist/integrations/providers/index.js.map +1 -1
- package/dist/integrations/providers/oauth.d.ts +2 -2
- package/dist/integrations/providers/oauth.d.ts.map +1 -1
- package/dist/integrations/providers/oauth.js +8 -5
- package/dist/integrations/providers/oauth.js.map +1 -1
- package/dist/integrations/providers/register.d.ts.map +1 -1
- package/dist/integrations/providers/register.js +9 -1
- package/dist/integrations/providers/register.js.map +1 -1
- package/dist/integrations/providers/registry.d.ts +8 -1
- package/dist/integrations/providers/registry.d.ts.map +1 -1
- package/dist/integrations/providers/registry.js +29 -0
- package/dist/integrations/providers/registry.js.map +1 -1
- package/dist/tui/App.d.ts +5 -5
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +257 -98
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/CopyPicker.d.ts +8 -0
- package/dist/tui/CopyPicker.d.ts.map +1 -0
- package/dist/tui/CopyPicker.js +20 -0
- package/dist/tui/CopyPicker.js.map +1 -0
- package/dist/tui/Picker.d.ts +12 -3
- package/dist/tui/Picker.d.ts.map +1 -1
- package/dist/tui/Picker.js +88 -27
- package/dist/tui/Picker.js.map +1 -1
- package/dist/tui/agent.d.ts +2 -5
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +112 -17
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/copy-targets.d.ts +23 -0
- package/dist/tui/copy-targets.d.ts.map +1 -0
- package/dist/tui/copy-targets.js +189 -0
- package/dist/tui/copy-targets.js.map +1 -0
- package/dist/tui/login-prompt.d.ts +5 -0
- package/dist/tui/login-prompt.d.ts.map +1 -1
- package/dist/tui/login-prompt.js +14 -0
- package/dist/tui/login-prompt.js.map +1 -1
- package/dist/tui/model-choices.d.ts.map +1 -1
- package/dist/tui/model-choices.js +6 -1
- package/dist/tui/model-choices.js.map +1 -1
- package/dist/tui/slashCommands.d.ts +1 -1
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +2 -2
- package/dist/tui/slashCommands.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Credential discoverer for LLM provider clients.
|
|
3
3
|
*
|
|
4
|
-
* For each entry in `PROVIDER_REGISTRY`, ask four questions
|
|
5
|
-
* 1. Is
|
|
6
|
-
* 2. Is there a subscription credential in namzu's own store
|
|
7
|
-
*
|
|
8
|
-
* 3. Is there an OAuth credential in the login Keychain? (macOS only, and
|
|
9
|
-
* only `anthropic` consumes it.)
|
|
4
|
+
* For each entry in `PROVIDER_REGISTRY`, ask four questions:
|
|
5
|
+
* 1. Is there a usable session owned by an installed Claude or Codex harness?
|
|
6
|
+
* 2. Is there a subscription credential in namzu's own store?
|
|
7
|
+
* 3. Is one of its optional API-key env vars set in `process.env`?
|
|
10
8
|
* 4. Is the probe URL (if any) reachable right now?
|
|
11
9
|
*
|
|
12
10
|
* The header used to say "three" and list two, and the one it omitted was the
|
|
@@ -19,14 +17,12 @@
|
|
|
19
17
|
* hole.** `readAgentKeychainCredential` returns `null` on any other platform
|
|
20
18
|
* before it looks at anything; it reads a credential belonging to a
|
|
21
19
|
* co-installed tool, so it can only ever help someone who has that tool, on
|
|
22
|
-
* that operating system. namzu's own store
|
|
23
|
-
*
|
|
24
|
-
* namzu useful on a machine that has neither.
|
|
20
|
+
* that operating system. namzu's own store works everywhere, which is what
|
|
21
|
+
* makes signing in from inside namzu useful on a machine that has neither.
|
|
25
22
|
*
|
|
26
|
-
* Order
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* ineffective on precisely the machine where they bothered to run it.
|
|
23
|
+
* Order matters when both answer. A current device-harness session wins; a
|
|
24
|
+
* Namzu-owned sign-in is the fallback for a machine that has no usable harness
|
|
25
|
+
* session. API-key/env sources remain optional alternatives after both.
|
|
30
26
|
*
|
|
31
27
|
* The first positive answer per provider wins; subsequent sources are
|
|
32
28
|
* recorded as "also available from" so the picker can show alternatives
|
|
@@ -61,9 +57,34 @@
|
|
|
61
57
|
* picker can render immediately and refine if discovery completes later.
|
|
62
58
|
*/
|
|
63
59
|
import { EnvCredentialProvider } from '@namzu/sdk';
|
|
64
|
-
import { credentialsPath, readStoredSubscriptionCredential } from './credential-store.js';
|
|
60
|
+
import { credentialsPath, readStoredCodexCredential, readStoredSubscriptionCredential, } from './credential-store.js';
|
|
61
|
+
import { claudeCredentialsPath, codexCredentialsPath, preferFresherCredential, readClaudeFileCredential, readCodexFileCredential, } from './harness-credentials.js';
|
|
65
62
|
import { KEYCHAIN_SERVICE, readAgentKeychainCredential } from './keychain.js';
|
|
66
63
|
import { PROVIDER_REGISTRY } from './registry.js';
|
|
64
|
+
/**
|
|
65
|
+
* Providers backed by a subscription session that is already usable now.
|
|
66
|
+
*
|
|
67
|
+
* This is intentionally narrower than "detected providers". An API key, a
|
|
68
|
+
* custom endpoint, and a local model are all valid optional choices, but none
|
|
69
|
+
* means the operator has already signed in to Claude or Codex. First-run
|
|
70
|
+
* routing uses this distinction to avoid asking for a second credential when
|
|
71
|
+
* the device already owns one.
|
|
72
|
+
*
|
|
73
|
+
* `CLAUDE_CODE_OAUTH_TOKEN` is included because it is the environment form of
|
|
74
|
+
* the same Claude device session. Generic Anthropic token/key variables are
|
|
75
|
+
* not: they are explicit API credentials and remain ordinary picker choices.
|
|
76
|
+
*/
|
|
77
|
+
export function signedInSubscriptionProviders(detected) {
|
|
78
|
+
return detected.filter((provider) => {
|
|
79
|
+
if (provider.entry.subscriptionLogin === undefined)
|
|
80
|
+
return false;
|
|
81
|
+
return [provider.source, ...provider.alternatives].some((source) => source.kind === 'claude-file' ||
|
|
82
|
+
source.kind === 'codex-file' ||
|
|
83
|
+
source.kind === 'keychain' ||
|
|
84
|
+
source.kind === 'stored' ||
|
|
85
|
+
(source.kind === 'env' && source.envName === 'CLAUDE_CODE_OAUTH_TOKEN'));
|
|
86
|
+
});
|
|
87
|
+
}
|
|
67
88
|
const DEFAULT_PROBE_TIMEOUT_MS = 500;
|
|
68
89
|
export async function discoverProviders(opts = {}) {
|
|
69
90
|
const env = opts.env ?? process.env;
|
|
@@ -103,14 +124,96 @@ export async function discoverProviders(opts = {}) {
|
|
|
103
124
|
const storedCredential = opts.skipStored
|
|
104
125
|
? null
|
|
105
126
|
: readStoredSubscriptionCredential(...(opts.home === undefined ? [] : [opts.home]));
|
|
127
|
+
const storedCodexCredential = opts.skipStored
|
|
128
|
+
? null
|
|
129
|
+
: readStoredCodexCredential(...(opts.home === undefined ? [] : [opts.home]));
|
|
106
130
|
// macOS-only: the OAuth credential a co-installed tool keeps in the login
|
|
107
131
|
// Keychain.
|
|
108
132
|
const keychainCredential = opts.skipKeychain ? null : readAgentKeychainCredential();
|
|
133
|
+
const claudeFileCredential = readClaudeFileCredential(opts.home);
|
|
134
|
+
const codexFileCredential = readCodexFileCredential(opts.home, env);
|
|
135
|
+
const usableCodexFileCredential = codexFileCredential?.expiresAt === undefined ||
|
|
136
|
+
codexFileCredential.expiresAt - Date.now() > 60_000
|
|
137
|
+
? codexFileCredential
|
|
138
|
+
: null;
|
|
109
139
|
for (const id of Object.keys(PROVIDER_REGISTRY)) {
|
|
110
140
|
const entry = PROVIDER_REGISTRY[id];
|
|
111
141
|
const sources = [];
|
|
112
142
|
let apiKey;
|
|
113
143
|
let oauth;
|
|
144
|
+
let codex;
|
|
145
|
+
if (id === 'anthropic') {
|
|
146
|
+
const borrowed = preferFresherCredential(claudeFileCredential, keychainCredential);
|
|
147
|
+
const usableBorrowed = borrowed?.expiresAt === undefined || borrowed.expiresAt - Date.now() > 60_000
|
|
148
|
+
? borrowed
|
|
149
|
+
: null;
|
|
150
|
+
const borrowedSource = usableBorrowed === claudeFileCredential && usableBorrowed
|
|
151
|
+
? {
|
|
152
|
+
kind: 'claude-file',
|
|
153
|
+
path: claudeCredentialsPath(opts.home),
|
|
154
|
+
}
|
|
155
|
+
: usableBorrowed
|
|
156
|
+
? { kind: 'keychain', service: KEYCHAIN_SERVICE }
|
|
157
|
+
: undefined;
|
|
158
|
+
if (usableBorrowed && borrowedSource) {
|
|
159
|
+
if (apiKey === undefined) {
|
|
160
|
+
apiKey = usableBorrowed.accessToken;
|
|
161
|
+
oauth = {
|
|
162
|
+
refreshToken: usableBorrowed.refreshToken,
|
|
163
|
+
expiresAt: usableBorrowed.expiresAt,
|
|
164
|
+
origin: borrowedSource.kind === 'claude-file' ? 'claude-file' : 'keychain',
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
sources.push(borrowedSource);
|
|
168
|
+
}
|
|
169
|
+
const otherBorrowedSource = usableBorrowed && usableBorrowed === claudeFileCredential && keychainCredential
|
|
170
|
+
? { kind: 'keychain', service: KEYCHAIN_SERVICE }
|
|
171
|
+
: usableBorrowed && usableBorrowed === keychainCredential && claudeFileCredential
|
|
172
|
+
? {
|
|
173
|
+
kind: 'claude-file',
|
|
174
|
+
path: claudeCredentialsPath(opts.home),
|
|
175
|
+
}
|
|
176
|
+
: undefined;
|
|
177
|
+
if (otherBorrowedSource)
|
|
178
|
+
sources.push(otherBorrowedSource);
|
|
179
|
+
if (storedCredential) {
|
|
180
|
+
if (apiKey === undefined) {
|
|
181
|
+
apiKey = storedCredential.accessToken;
|
|
182
|
+
oauth = {
|
|
183
|
+
refreshToken: storedCredential.refreshToken,
|
|
184
|
+
expiresAt: storedCredential.expiresAt,
|
|
185
|
+
origin: 'stored',
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
sources.push({
|
|
189
|
+
kind: 'stored',
|
|
190
|
+
path: credentialsPath(...(opts.home === undefined ? [] : [opts.home])),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (id === 'codex' && (storedCodexCredential || usableCodexFileCredential)) {
|
|
195
|
+
const credential = usableCodexFileCredential ?? storedCodexCredential;
|
|
196
|
+
if (!credential)
|
|
197
|
+
throw new Error('unreachable');
|
|
198
|
+
apiKey = credential.accessToken;
|
|
199
|
+
sources.push({
|
|
200
|
+
kind: usableCodexFileCredential ? 'codex-file' : 'stored',
|
|
201
|
+
path: usableCodexFileCredential
|
|
202
|
+
? codexCredentialsPath(opts.home, env)
|
|
203
|
+
: credentialsPath(...(opts.home === undefined ? [] : [opts.home])),
|
|
204
|
+
});
|
|
205
|
+
codex = {
|
|
206
|
+
accountId: credential.accountId,
|
|
207
|
+
expiresAt: credential.expiresAt,
|
|
208
|
+
origin: usableCodexFileCredential ? 'codex-file' : 'stored',
|
|
209
|
+
};
|
|
210
|
+
if (storedCodexCredential && usableCodexFileCredential) {
|
|
211
|
+
sources.push({
|
|
212
|
+
kind: 'stored',
|
|
213
|
+
path: credentialsPath(...(opts.home === undefined ? [] : [opts.home])),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
114
217
|
for (const envName of entry.envVars) {
|
|
115
218
|
// Through the SDK's seam rather than a direct `env[envName]`. The
|
|
116
219
|
// read is identical; what changes is that a host embedding the SDK
|
|
@@ -124,35 +227,6 @@ export async function discoverProviders(opts = {}) {
|
|
|
124
227
|
sources.push({ kind: 'env', envName });
|
|
125
228
|
}
|
|
126
229
|
}
|
|
127
|
-
if (id === 'anthropic' && storedCredential) {
|
|
128
|
-
if (apiKey === undefined)
|
|
129
|
-
apiKey = storedCredential.accessToken;
|
|
130
|
-
sources.push({
|
|
131
|
-
kind: 'stored',
|
|
132
|
-
path: credentialsPath(...(opts.home === undefined ? [] : [opts.home])),
|
|
133
|
-
});
|
|
134
|
-
// Only carry refresh metadata when this token is the one we'll
|
|
135
|
-
// actually use (an env/secrets token has no refresh path).
|
|
136
|
-
if (apiKey === storedCredential.accessToken) {
|
|
137
|
-
oauth = {
|
|
138
|
-
refreshToken: storedCredential.refreshToken,
|
|
139
|
-
expiresAt: storedCredential.expiresAt,
|
|
140
|
-
origin: 'stored',
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (id === 'anthropic' && keychainCredential) {
|
|
145
|
-
if (apiKey === undefined)
|
|
146
|
-
apiKey = keychainCredential.accessToken;
|
|
147
|
-
sources.push({ kind: 'keychain', service: KEYCHAIN_SERVICE });
|
|
148
|
-
if (apiKey === keychainCredential.accessToken) {
|
|
149
|
-
oauth = {
|
|
150
|
-
refreshToken: keychainCredential.refreshToken,
|
|
151
|
-
expiresAt: keychainCredential.expiresAt,
|
|
152
|
-
origin: 'keychain',
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
230
|
if (sources.length === 0 && entry.probeUrl && !opts.skipProbes) {
|
|
157
231
|
const reachable = await probe(entry.probeUrl, opts);
|
|
158
232
|
if (reachable) {
|
|
@@ -166,6 +240,7 @@ export async function discoverProviders(opts = {}) {
|
|
|
166
240
|
apiKey,
|
|
167
241
|
baseUrl: entry.defaultBaseUrl,
|
|
168
242
|
...(oauth ? { oauth } : {}),
|
|
243
|
+
...(codex ? { codex } : {}),
|
|
169
244
|
alternatives: sources.slice(1),
|
|
170
245
|
});
|
|
171
246
|
}
|
|
@@ -177,7 +252,10 @@ async function probe(url, opts) {
|
|
|
177
252
|
const controller = new AbortController();
|
|
178
253
|
const timer = setTimeout(() => controller.abort(), opts.probeTimeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS);
|
|
179
254
|
try {
|
|
180
|
-
const res = await fetchFn(url, {
|
|
255
|
+
const res = await fetchFn(url, {
|
|
256
|
+
method: 'GET',
|
|
257
|
+
signal: controller.signal,
|
|
258
|
+
});
|
|
181
259
|
return res.ok;
|
|
182
260
|
}
|
|
183
261
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../../src/integrations/providers/discover.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../../src/integrations/providers/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAElD,OAAO,EACN,eAAe,EACf,yBA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G,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EACxB,IAAI,CAAC,cAAc,IAAI,wBAAwB,CAC/C,CAAA;IACD,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE;YAC9B,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,UAAU,CAAC,MAAM;SACzB,CAAC,CAAA;QACF,OAAO,GAAG,CAAC,EAAE,CAAA;IACd,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAA;IACb,CAAC;YAAS,CAAC;QACV,YAAY,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;AACF,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,YAAY,CAC3B,IAAiC,EACjC,EAAc;IAEd,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only adapters for credentials owned by co-installed agent harnesses.
|
|
3
|
+
*
|
|
4
|
+
* These files are authorities, not migration inputs. Namzu reads the whole
|
|
5
|
+
* record, validates only the fields its provider wire needs, and never writes
|
|
6
|
+
* either file. In particular, refresh tokens remain owned by the harness that
|
|
7
|
+
* obtained them; consuming a single-use refresh grant here would race that
|
|
8
|
+
* owner and could log it out.
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentOAuthCredential } from './keychain.js';
|
|
11
|
+
export interface CodexOAuthCredential extends AgentOAuthCredential {
|
|
12
|
+
readonly accountId: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function claudeCredentialsPath(home?: string): string;
|
|
15
|
+
export declare function codexCredentialsPath(home?: string, env?: NodeJS.ProcessEnv): string;
|
|
16
|
+
export declare function readClaudeFileCredential(home?: string): AgentOAuthCredential | null;
|
|
17
|
+
/** Read a Claude-owned credential from the exact path discovery admitted. */
|
|
18
|
+
export declare function readClaudeCredentialFile(path: string): AgentOAuthCredential | null;
|
|
19
|
+
export declare function codexCredentialFromTokens(tokens: {
|
|
20
|
+
readonly accessToken: string;
|
|
21
|
+
readonly refreshToken?: string;
|
|
22
|
+
readonly accountId?: string;
|
|
23
|
+
}): CodexOAuthCredential | null;
|
|
24
|
+
/**
|
|
25
|
+
* Read the ChatGPT subscription record produced by Codex CLI.
|
|
26
|
+
*
|
|
27
|
+
* `OPENAI_API_KEY` is intentionally ignored: it belongs to the ordinary
|
|
28
|
+
* OpenAI provider. This reader admits only the `tokens` envelope used by the
|
|
29
|
+
* Codex Responses backend and requires the account id that backend routes on.
|
|
30
|
+
*/
|
|
31
|
+
export declare function readCodexFileCredential(home?: string, env?: NodeJS.ProcessEnv): CodexOAuthCredential | null;
|
|
32
|
+
/** Read a Codex-owned credential from the exact path discovery admitted. */
|
|
33
|
+
export declare function readCodexCredentialFile(path: string): CodexOAuthCredential | null;
|
|
34
|
+
/** Prefer the credential whose access token remains valid for longer. */
|
|
35
|
+
export declare function preferFresherCredential<T extends AgentOAuthCredential>(left: T | null, right: T | null, now?: number): T | null;
|
|
36
|
+
//# sourceMappingURL=harness-credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-credentials.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/harness-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAIzD,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IACjE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC1B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAEtE;AAED,wBAAgB,oBAAoB,CACnC,IAAI,GAAE,MAAkB,EACxB,GAAG,GAAE,MAAM,CAAC,UAAwB,GAClC,MAAM,CAQR;AA6BD,wBAAgB,wBAAwB,CAAC,IAAI,GAAE,MAAkB,GAAG,oBAAoB,GAAG,IAAI,CAE9F;AAED,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAWlF;AAOD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B,GAAG,oBAAoB,GAAG,IAAI,CAW9B;AAoBD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACtC,IAAI,GAAE,MAAkB,EACxB,GAAG,GAAE,MAAM,CAAC,UAAwB,GAClC,oBAAoB,GAAG,IAAI,CAE7B;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAkBjF;AAED,yEAAyE;AACzE,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,oBAAoB,EACrE,IAAI,EAAE,CAAC,GAAG,IAAI,EACd,KAAK,EAAE,CAAC,GAAG,IAAI,EACf,GAAG,SAAa,GACd,CAAC,GAAG,IAAI,CASV"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only adapters for credentials owned by co-installed agent harnesses.
|
|
3
|
+
*
|
|
4
|
+
* These files are authorities, not migration inputs. Namzu reads the whole
|
|
5
|
+
* record, validates only the fields its provider wire needs, and never writes
|
|
6
|
+
* either file. In particular, refresh tokens remain owned by the harness that
|
|
7
|
+
* obtained them; consuming a single-use refresh grant here would race that
|
|
8
|
+
* owner and could log it out.
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync, statSync } from 'node:fs';
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import { isAbsolute, join, resolve } from 'node:path';
|
|
13
|
+
const MAX_CREDENTIAL_FILE_BYTES = 1024 * 1024;
|
|
14
|
+
export function claudeCredentialsPath(home = homedir()) {
|
|
15
|
+
return join(home, '.claude', '.credentials.json');
|
|
16
|
+
}
|
|
17
|
+
export function codexCredentialsPath(home = homedir(), env = process.env) {
|
|
18
|
+
const configured = env.CODEX_HOME?.trim();
|
|
19
|
+
const root = configured
|
|
20
|
+
? isAbsolute(configured)
|
|
21
|
+
? configured
|
|
22
|
+
: resolve(configured)
|
|
23
|
+
: join(home, '.codex');
|
|
24
|
+
return join(root, 'auth.json');
|
|
25
|
+
}
|
|
26
|
+
function readCredentialJson(path) {
|
|
27
|
+
try {
|
|
28
|
+
const stat = statSync(path);
|
|
29
|
+
if (!stat.isFile() || stat.size <= 0 || stat.size > MAX_CREDENTIAL_FILE_BYTES)
|
|
30
|
+
return null;
|
|
31
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function record(value) {
|
|
38
|
+
return typeof value === 'object' && value !== null ? value : null;
|
|
39
|
+
}
|
|
40
|
+
function optionalString(value) {
|
|
41
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
42
|
+
}
|
|
43
|
+
function optionalFiniteNumber(value) {
|
|
44
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
45
|
+
}
|
|
46
|
+
function optionalStringArray(value) {
|
|
47
|
+
if (!Array.isArray(value) || value.some((item) => typeof item !== 'string'))
|
|
48
|
+
return undefined;
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
export function readClaudeFileCredential(home = homedir()) {
|
|
52
|
+
return readClaudeCredentialFile(claudeCredentialsPath(home));
|
|
53
|
+
}
|
|
54
|
+
/** Read a Claude-owned credential from the exact path discovery admitted. */
|
|
55
|
+
export function readClaudeCredentialFile(path) {
|
|
56
|
+
const root = record(readCredentialJson(path));
|
|
57
|
+
const oauth = record(root?.claudeAiOauth);
|
|
58
|
+
const accessToken = optionalString(oauth?.accessToken);
|
|
59
|
+
if (!accessToken)
|
|
60
|
+
return null;
|
|
61
|
+
return {
|
|
62
|
+
accessToken,
|
|
63
|
+
refreshToken: optionalString(oauth?.refreshToken),
|
|
64
|
+
expiresAt: optionalFiniteNumber(oauth?.expiresAt),
|
|
65
|
+
scopes: optionalStringArray(oauth?.scopes),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function codexCredentialFromTokens(tokens) {
|
|
69
|
+
if (tokens.accessToken.length === 0)
|
|
70
|
+
return null;
|
|
71
|
+
const claims = jwtClaims(tokens.accessToken);
|
|
72
|
+
const accountId = tokens.accountId ?? claims.accountId;
|
|
73
|
+
if (!accountId)
|
|
74
|
+
return null;
|
|
75
|
+
return {
|
|
76
|
+
accessToken: tokens.accessToken,
|
|
77
|
+
...(tokens.refreshToken ? { refreshToken: tokens.refreshToken } : {}),
|
|
78
|
+
accountId,
|
|
79
|
+
...(claims.expiresAt === undefined ? {} : { expiresAt: claims.expiresAt }),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function jwtClaims(token) {
|
|
83
|
+
const parts = token.split('.');
|
|
84
|
+
if (parts.length !== 3 || !parts[1])
|
|
85
|
+
return {};
|
|
86
|
+
try {
|
|
87
|
+
const payload = record(JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8')));
|
|
88
|
+
const auth = record(payload?.['https://api.openai.com/auth']);
|
|
89
|
+
const exp = optionalFiniteNumber(payload?.exp);
|
|
90
|
+
return {
|
|
91
|
+
...(exp === undefined ? {} : { expiresAt: exp * 1000 }),
|
|
92
|
+
...(optionalString(auth?.chatgpt_account_id)
|
|
93
|
+
? { accountId: optionalString(auth?.chatgpt_account_id) }
|
|
94
|
+
: {}),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return {};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Read the ChatGPT subscription record produced by Codex CLI.
|
|
103
|
+
*
|
|
104
|
+
* `OPENAI_API_KEY` is intentionally ignored: it belongs to the ordinary
|
|
105
|
+
* OpenAI provider. This reader admits only the `tokens` envelope used by the
|
|
106
|
+
* Codex Responses backend and requires the account id that backend routes on.
|
|
107
|
+
*/
|
|
108
|
+
export function readCodexFileCredential(home = homedir(), env = process.env) {
|
|
109
|
+
return readCodexCredentialFile(codexCredentialsPath(home, env));
|
|
110
|
+
}
|
|
111
|
+
/** Read a Codex-owned credential from the exact path discovery admitted. */
|
|
112
|
+
export function readCodexCredentialFile(path) {
|
|
113
|
+
const root = record(readCredentialJson(path));
|
|
114
|
+
const tokens = record(root?.tokens);
|
|
115
|
+
const accessToken = optionalString(tokens?.access_token);
|
|
116
|
+
if (!accessToken)
|
|
117
|
+
return null;
|
|
118
|
+
const accessClaims = jwtClaims(accessToken);
|
|
119
|
+
const idToken = optionalString(tokens?.id_token);
|
|
120
|
+
const idClaims = idToken ? jwtClaims(idToken) : {};
|
|
121
|
+
const accountId = optionalString(tokens?.account_id) ?? accessClaims.accountId ?? idClaims.accountId;
|
|
122
|
+
if (!accountId)
|
|
123
|
+
return null;
|
|
124
|
+
return codexCredentialFromTokens({
|
|
125
|
+
accessToken,
|
|
126
|
+
...(optionalString(tokens?.refresh_token)
|
|
127
|
+
? { refreshToken: optionalString(tokens?.refresh_token) }
|
|
128
|
+
: {}),
|
|
129
|
+
accountId,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** Prefer the credential whose access token remains valid for longer. */
|
|
133
|
+
export function preferFresherCredential(left, right, now = Date.now()) {
|
|
134
|
+
if (!left)
|
|
135
|
+
return right;
|
|
136
|
+
if (!right)
|
|
137
|
+
return left;
|
|
138
|
+
const leftExpiry = left.expiresAt ?? Number.POSITIVE_INFINITY;
|
|
139
|
+
const rightExpiry = right.expiresAt ?? Number.POSITIVE_INFINITY;
|
|
140
|
+
const leftFresh = leftExpiry > now + 60_000;
|
|
141
|
+
const rightFresh = rightExpiry > now + 60_000;
|
|
142
|
+
if (leftFresh !== rightFresh)
|
|
143
|
+
return leftFresh ? left : right;
|
|
144
|
+
return leftExpiry >= rightExpiry ? left : right;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=harness-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-credentials.js","sourceRoot":"","sources":["../../../src/integrations/providers/harness-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAIrD,MAAM,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAAA;AAM7C,MAAM,UAAU,qBAAqB,CAAC,OAAe,OAAO,EAAE;IAC7D,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,oBAAoB,CACnC,OAAe,OAAO,EAAE,EACxB,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,CAAA;IACzC,MAAM,IAAI,GAAG,UAAU;QACtB,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;YACvB,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QACtB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACvB,OAAO,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;AAC/B,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACvC,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;QAC3B,IAAI,CAAC,IAAI,C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AC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;IAC7D,OAAO,UAAU,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;AAChD,CAAC"}
|
|
@@ -55,21 +55,14 @@ export declare const AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
|
|
|
55
55
|
export declare const SUBSCRIPTION_REDIRECT_PORT = 53692;
|
|
56
56
|
export declare const REDIRECT_URI = "http://localhost:53692/callback";
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* The smallest source-verified scope set used by the current Claude harness.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* account to try it against. Guessing narrow fails in the worst place: the
|
|
67
|
-
* sign-in succeeds, and inference is refused afterwards with an error about
|
|
68
|
-
* scope that the operator cannot act on.
|
|
69
|
-
*
|
|
70
|
-
* So it is recorded as debt with the measurement that would settle it: sign
|
|
71
|
-
* in with `user:profile user:inference` alone and send one message. If that
|
|
72
|
-
* works, this shrinks to those two.
|
|
60
|
+
* Do not copy every scope a historical client happened to request. Unknown
|
|
61
|
+
* scopes make the authorization page reject the whole request before the
|
|
62
|
+
* operator can sign in, and key creation is not inference authority. These
|
|
63
|
+
* three are the live harness contract: identify the account, run inference,
|
|
64
|
+
* and retain the ability to create an API key from that harness when the
|
|
65
|
+
* account permits it.
|
|
73
66
|
*/
|
|
74
|
-
export declare const OAUTH_SCOPES = "org:create_api_key user:profile user:inference
|
|
67
|
+
export declare const OAUTH_SCOPES = "org:create_api_key user:profile user:inference";
|
|
75
68
|
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,eAAO,MAAM,eAAe,yCAAyC,CAAA;AACrE,eAAO,MAAM,eAAe,iDAAiD,CAAA;AAC7E,eAAO,MAAM,aAAa,sCAAsC,CAAA;AAEhE,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,QAAQ,CAAA;AAC/C,eAAO,MAAM,YAAY,oCAA4D,CAAA;AAErF
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,eAAO,MAAM,eAAe,yCAAyC,CAAA;AACrE,eAAO,MAAM,eAAe,iDAAiD,CAAA;AAC7E,eAAO,MAAM,aAAa,sCAAsC,CAAA;AAEhE,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,QAAQ,CAAA;AAC/C,eAAO,MAAM,YAAY,oCAA4D,CAAA;AAErF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,mDAAmD,CAAA"}
|
|
@@ -55,21 +55,14 @@ export const AUTHORIZE_URL = 'https://claude.ai/oauth/authorize';
|
|
|
55
55
|
export const SUBSCRIPTION_REDIRECT_PORT = 53692;
|
|
56
56
|
export const REDIRECT_URI = `http://localhost:${SUBSCRIPTION_REDIRECT_PORT}/callback`;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* The smallest source-verified scope set used by the current Claude harness.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* account to try it against. Guessing narrow fails in the worst place: the
|
|
67
|
-
* sign-in succeeds, and inference is refused afterwards with an error about
|
|
68
|
-
* scope that the operator cannot act on.
|
|
69
|
-
*
|
|
70
|
-
* So it is recorded as debt with the measurement that would settle it: sign
|
|
71
|
-
* in with `user:profile user:inference` alone and send one message. If that
|
|
72
|
-
* works, this shrinks to those two.
|
|
60
|
+
* Do not copy every scope a historical client happened to request. Unknown
|
|
61
|
+
* scopes make the authorization page reject the whole request before the
|
|
62
|
+
* operator can sign in, and key creation is not inference authority. These
|
|
63
|
+
* three are the live harness contract: identify the account, run inference,
|
|
64
|
+
* and retain the ability to create an API key from that harness when the
|
|
65
|
+
* account permits it.
|
|
73
66
|
*/
|
|
74
|
-
export const OAUTH_SCOPES = 'org:create_api_key user:profile user:inference
|
|
67
|
+
export const OAUTH_SCOPES = 'org:create_api_key user:profile user:inference';
|
|
75
68
|
//# sourceMappingURL=identity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/integrations/providers/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,sCAAsC,CAAA;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,8CAA8C,CAAA;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,mCAAmC,CAAA;AAEhE,qEAAqE;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAA;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,0BAA0B,WAAW,CAAA;AAErF
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/integrations/providers/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,sCAAsC,CAAA;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,8CAA8C,CAAA;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,mCAAmC,CAAA;AAEhE,qEAAqE;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAA;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,0BAA0B,WAAW,CAAA;AAErF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gDAAgD,CAAA"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
export { type DetectedProvider, type DetectionSource, type DiscoverOptions, discoverProviders, findDetected, } from './discover.js';
|
|
1
|
+
export { type DetectedProvider, type DetectionSource, type DiscoverOptions, discoverProviders, findDetected, signedInSubscriptionProviders, } from './discover.js';
|
|
2
|
+
export { type CodexOAuthCredential, claudeCredentialsPath, codexCredentialsPath, readClaudeCredentialFile, readClaudeFileCredential, readCodexCredentialFile, readCodexFileCredential, } from './harness-credentials.js';
|
|
2
3
|
export { type AgentOAuthCredential, isAnthropicOAuthToken, readAgentKeychainCredential, } from './keychain.js';
|
|
3
|
-
export {
|
|
4
|
+
export { beginCodexDeviceLogin, CODEX_AUTH_ORIGIN, CODEX_OAUTH_CLIENT_ID, type CodexDeviceLogin, type CodexDeviceLoginOptions, type CodexDeviceLoginOutcome, } from './codex-device-login.js';
|
|
5
|
+
export { clearAllStoredCredentials, clearStoredSubscriptionCredential, clearStoredCodexCredential, CREDENTIALS_FILE_VERSION, CredentialStoreError, credentialsPath, readStoredSubscriptionCredential, readStoredCodexCredential, replaceStoredCodexCredential, type StoredCodexCredential, writeStoredSubscriptionCredential, writeStoredCodexCredential, } from './credential-store.js';
|
|
6
|
+
export { ensureFreshStoredCodexCredential, type StoredCodexRefreshOptions, } from './codex-oauth.js';
|
|
4
7
|
export { OAUTH_SCOPES, REDIRECT_URI } from './identity.js';
|
|
5
8
|
export { CredentialPublicationError, CredentialRefreshRejectedError, CredentialWithdrawnError, type CredentialOrigin, ensureFreshAnthropicToken, type OAuthMetadata, readSubscriptionCredential, refreshAgentOAuthToken, sameOAuthCredential, } from './oauth.js';
|
|
6
9
|
export { beginSubscriptionLogin, type LoginOutcome, parsePastedInput, type SubscriptionLogin, type SubscriptionLoginOptions, subscriptionDetectedProvider, } from './subscription-login.js';
|
|
7
10
|
export { type CapabilityDisagreement, chainCapabilityDisagreements, describeAcceptedMismatch, describeCapabilityRefusal, type MemberCapabilities, unresolvedMembers, } from './chain-capabilities.js';
|
|
8
11
|
export { chainPositionName, type Preferences, PREFERENCES_FILE_VERSION, PreferencesError, preferencesPath, primaryProvider, type ProviderChoice, type ReadResult, readPreferences, writePreferences, } from './preferences.js';
|
|
9
|
-
export { ALL_PROVIDER_IDS, missingCredentialMessage, PROVIDER_REGISTRY, type ProviderId, type ProviderRegistryEntry, type SdkProviderType, unsupportedProviderMessage, } from './registry.js';
|
|
12
|
+
export { ALL_PROVIDER_IDS, missingCredentialMessage, PROVIDER_REGISTRY, type ProviderId, type ProviderRegistryEntry, type SubscriptionProviderId, type SdkProviderType, unsupportedProviderMessage, } from './registry.js';
|
|
10
13
|
export { ensureRegistered, isRegistered, resolveChainCapabilities, } from './register.js';
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,iBAAiB,EACjB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,GAC7B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACN,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eA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AAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,0BAA0B,GAC1B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,GACxB,MAAM,eAAe,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export { discoverProviders, findDetected, } from './discover.js';
|
|
1
|
+
export { discoverProviders, findDetected, signedInSubscriptionProviders, } from './discover.js';
|
|
2
|
+
export { claudeCredentialsPath, codexCredentialsPath, readClaudeCredentialFile, readClaudeFileCredential, readCodexCredentialFile, readCodexFileCredential, } from './harness-credentials.js';
|
|
2
3
|
export { isAnthropicOAuthToken, readAgentKeychainCredential, } from './keychain.js';
|
|
3
|
-
export {
|
|
4
|
+
export { beginCodexDeviceLogin, CODEX_AUTH_ORIGIN, CODEX_OAUTH_CLIENT_ID, } from './codex-device-login.js';
|
|
5
|
+
export { clearAllStoredCredentials, clearStoredSubscriptionCredential, clearStoredCodexCredential, CREDENTIALS_FILE_VERSION, CredentialStoreError, credentialsPath, readStoredSubscriptionCredential, readStoredCodexCredential, replaceStoredCodexCredential, writeStoredSubscriptionCredential, writeStoredCodexCredential, } from './credential-store.js';
|
|
6
|
+
export { ensureFreshStoredCodexCredential, } from './codex-oauth.js';
|
|
4
7
|
export { OAUTH_SCOPES, REDIRECT_URI } from './identity.js';
|
|
5
8
|
export { CredentialPublicationError, CredentialRefreshRejectedError, CredentialWithdrawnError, ensureFreshAnthropicToken, readSubscriptionCredential, refreshAgentOAuthToken, sameOAuthCredential, } from './oauth.js';
|
|
6
9
|
export { beginSubscriptionLogin, parsePastedInput, subscriptionDetectedProvider, } from './subscription-login.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,iBAAiB,EACjB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["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M,eAAe,CAAA;AACtB,OAAO,EACN,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,GACxB,MAAM,eAAe,CAAA"}
|
|
@@ -52,7 +52,7 @@ import { type AgentOAuthCredential } from './keychain.js';
|
|
|
52
52
|
*/
|
|
53
53
|
export declare function readSubscriptionCredential(origin: CredentialOrigin): AgentOAuthCredential | null;
|
|
54
54
|
/** Which store a subscription credential came from and therefore who owns publication. */
|
|
55
|
-
export type CredentialOrigin = 'stored' | 'keychain';
|
|
55
|
+
export type CredentialOrigin = 'stored' | 'keychain' | 'claude-file';
|
|
56
56
|
export interface OAuthMetadata {
|
|
57
57
|
readonly refreshToken?: string;
|
|
58
58
|
readonly expiresAt?: number;
|
|
@@ -63,7 +63,7 @@ export interface OAuthMetadata {
|
|
|
63
63
|
/** The credential that authorized a refresh was removed before publication. */
|
|
64
64
|
export declare class CredentialWithdrawnError extends Error {
|
|
65
65
|
readonly name = "CredentialWithdrawnError";
|
|
66
|
-
constructor();
|
|
66
|
+
constructor(message?: string);
|
|
67
67
|
}
|
|
68
68
|
/** The store could not prove whether the refresh still owned publication. */
|
|
69
69
|
export declare class CredentialPublicationError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAYH,OAAO,EAAE,KAAK,oBAAoB,EAA+B,MAAM,eAAe,CAAA;AAsCtF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,GAAG,IAAI,CAGhG;AAED,0FAA0F;AAC1F,MAAM,MAAM,gB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