@namzu/cli 14.0.0 → 14.2.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 +18 -7
- package/dist/integrations/providers/discover.d.ts +18 -0
- package/dist/integrations/providers/discover.d.ts.map +1 -1
- package/dist/integrations/providers/discover.js +79 -37
- package/dist/integrations/providers/discover.js.map +1 -1
- package/dist/integrations/providers/harness-credentials.d.ts +44 -9
- package/dist/integrations/providers/harness-credentials.d.ts.map +1 -1
- package/dist/integrations/providers/harness-credentials.js +140 -11
- package/dist/integrations/providers/harness-credentials.js.map +1 -1
- package/dist/integrations/providers/identity.d.ts +15 -14
- package/dist/integrations/providers/identity.d.ts.map +1 -1
- package/dist/integrations/providers/identity.js +15 -14
- package/dist/integrations/providers/identity.js.map +1 -1
- package/dist/integrations/providers/index.d.ts +1 -1
- package/dist/integrations/providers/index.d.ts.map +1 -1
- package/dist/integrations/providers/index.js +1 -1
- package/dist/integrations/providers/index.js.map +1 -1
- package/dist/integrations/providers/oauth.d.ts +8 -3
- package/dist/integrations/providers/oauth.d.ts.map +1 -1
- package/dist/integrations/providers/oauth.js +37 -11
- package/dist/integrations/providers/oauth.js.map +1 -1
- package/dist/integrations/providers/subscription-login.d.ts.map +1 -1
- package/dist/integrations/providers/subscription-login.js +12 -8
- package/dist/integrations/providers/subscription-login.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 +437 -63
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/ChoicePicker.d.ts +14 -0
- package/dist/tui/ChoicePicker.d.ts.map +1 -0
- package/dist/tui/ChoicePicker.js +15 -0
- package/dist/tui/ChoicePicker.js.map +1 -0
- 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 +8 -1
- package/dist/tui/Picker.d.ts.map +1 -1
- package/dist/tui/Picker.js +24 -11
- package/dist/tui/Picker.js.map +1 -1
- package/dist/tui/StatusBar.d.ts +23 -39
- package/dist/tui/StatusBar.d.ts.map +1 -1
- package/dist/tui/StatusBar.js +67 -105
- package/dist/tui/StatusBar.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 +15 -9
- 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/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 +9 -1
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +21 -16
- package/dist/tui/slashCommands.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ description: >-
|
|
|
6
6
|
you get. Interactive sessions, headless runs that stream structured events,
|
|
7
7
|
and a doctor that reports what the host can actually do.
|
|
8
8
|
tags: [readme, package, cli, agent]
|
|
9
|
-
timestamp: 2026-08-
|
|
9
|
+
timestamp: 2026-08-23T00:00:00Z
|
|
10
10
|
status: active
|
|
11
11
|
diataxis: reference
|
|
12
12
|
-->
|
|
@@ -69,12 +69,23 @@ namzu login codex # create a Namzu-owned ChatGPT subscription session
|
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
On startup, Namzu first reuses usable `Claude` and `Codex` sessions already owned
|
|
72
|
-
by their installed command-line clients
|
|
73
|
-
|
|
74
|
-
are
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
by their installed command-line clients, including the paired Windows home from
|
|
73
|
+
WSL. With no saved choice, one signed-in subscription starts directly; if both
|
|
74
|
+
are available, a narrowed picker asks which one to use and proceeds with its
|
|
75
|
+
default model. Codex credentials remain read-only. If an expired `Claude` session
|
|
76
|
+
must rotate its refresh grant, Namzu preserves the complete owner envelope and
|
|
77
|
+
publishes the successor pair back to that exact file so `Claude` is not logged
|
|
78
|
+
out. A Namzu-owned sign-in is needed only when no usable device session exists
|
|
79
|
+
or when you explicitly want a separate login; its `Claude` route uses direct
|
|
80
|
+
subscription authorization rather than API-usage billing. API keys remain
|
|
81
|
+
optional alternatives through environment variables or the session-only
|
|
82
|
+
credential picker, and detecting one does not hide the subscription sign-in
|
|
83
|
+
action.
|
|
84
|
+
|
|
85
|
+
Bare `/effort` and `/permissions` open finite keyboard choosers; their argument
|
|
86
|
+
forms remain available for scripts. The footer keeps `model effort · cwd` on the
|
|
87
|
+
left and reserves the right edge for the active interaction or durable goal
|
|
88
|
+
state.
|
|
78
89
|
|
|
79
90
|
Repository policy stays live for the whole session. The CLI starts with the
|
|
80
91
|
applicable `AGENTS.md` chain, discovers nested instruction files after
|
|
@@ -120,6 +120,8 @@ export interface DetectedProvider {
|
|
|
120
120
|
readonly refreshToken?: string;
|
|
121
121
|
readonly expiresAt?: number;
|
|
122
122
|
readonly origin?: CredentialOrigin;
|
|
123
|
+
/** Exact Claude owner file admitted by discovery. */
|
|
124
|
+
readonly sourcePath?: string;
|
|
123
125
|
};
|
|
124
126
|
/** Account-routed OAuth metadata for the Codex Responses backend. */
|
|
125
127
|
readonly codex?: {
|
|
@@ -145,7 +147,23 @@ export interface DiscoverOptions {
|
|
|
145
147
|
readonly skipKeychain?: boolean;
|
|
146
148
|
/** Skip namzu's own credential store (tests, and `--no-stored-credential`). */
|
|
147
149
|
readonly skipStored?: boolean;
|
|
150
|
+
/** Explicit paired Windows home for a WSL credential fixture. */
|
|
151
|
+
readonly windowsHome?: string | null;
|
|
148
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Providers backed by a subscription session that is already usable now.
|
|
155
|
+
*
|
|
156
|
+
* This is intentionally narrower than "detected providers". An API key, a
|
|
157
|
+
* custom endpoint, and a local model are all valid optional choices, but none
|
|
158
|
+
* means the operator has already signed in to Claude or Codex. First-run
|
|
159
|
+
* routing uses this distinction to avoid asking for a second credential when
|
|
160
|
+
* the device already owns one.
|
|
161
|
+
*
|
|
162
|
+
* `CLAUDE_CODE_OAUTH_TOKEN` is included because it is the environment form of
|
|
163
|
+
* the same Claude device session. Generic Anthropic token/key variables are
|
|
164
|
+
* not: they are explicit API credentials and remain ordinary picker choices.
|
|
165
|
+
*/
|
|
166
|
+
export declare function signedInSubscriptionProviders(detected: readonly DetectedProvider[]): readonly DetectedProvider[];
|
|
149
167
|
export declare function discoverProviders(opts?: DiscoverOptions): Promise<readonly DetectedProvider[]>;
|
|
150
168
|
/** Resolve a single detected provider by id from the discovered list. */
|
|
151
169
|
export declare function findDetected(list: readonly DetectedProvider[], id: ProviderId): DetectedProvider | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAeH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAE9F,MAAM,MAAM,eAAe,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,GAAG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A;QAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ,CAAA;KACxC,CAAA;IACD,qEAAqE;IACrE,QAAQ,CAAC,YAAY,EAAE,SAAS,eAAe,EAAE,CAAA;CACjD;AAED,MAAM,WAAW,eAAe;IAC/B,wCAAwC;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IAChC,sCAAsC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IAC7B,0CAA0C;IAC1C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,CAC5C,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GACnC,SAAS,gBAAgB,EAAE,CAY7B;AAID,wBAAsB,iBAAiB,CACtC,IAAI,GAAE,eAAoB,GACxB,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CAiMtC;AAsBD,yEAAyE;AACzE,wBAAgB,YAAY,CAC3B,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,EAAE,EAAE,UAAU,GACZ,gBAAgB,GAAG,IAAI,CAEzB"}
|
|
@@ -58,9 +58,33 @@
|
|
|
58
58
|
*/
|
|
59
59
|
import { EnvCredentialProvider } from '@namzu/sdk';
|
|
60
60
|
import { credentialsPath, readStoredCodexCredential, readStoredSubscriptionCredential, } from './credential-store.js';
|
|
61
|
-
import {
|
|
61
|
+
import { preferFresherCredential, readClaudeFileCredentialCandidates, readCodexFileCredentialCandidates, } from './harness-credentials.js';
|
|
62
62
|
import { KEYCHAIN_SERVICE, readAgentKeychainCredential } from './keychain.js';
|
|
63
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
|
+
}
|
|
64
88
|
const DEFAULT_PROBE_TIMEOUT_MS = 500;
|
|
65
89
|
export async function discoverProviders(opts = {}) {
|
|
66
90
|
const env = opts.env ?? process.env;
|
|
@@ -106,12 +130,17 @@ export async function discoverProviders(opts = {}) {
|
|
|
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();
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
133
|
+
const claudeFileCredentials = readClaudeFileCredentialCandidates(opts.home, env, opts.windowsHome);
|
|
134
|
+
const codexFileCredentials = readCodexFileCredentialCandidates(opts.home, env, opts.windowsHome).filter((candidate) => candidate.credential.expiresAt === undefined ||
|
|
135
|
+
candidate.credential.expiresAt - Date.now() > 60_000);
|
|
136
|
+
const usableCodexFileCredential = codexFileCredentials.reduce((current, candidate) => {
|
|
137
|
+
if (!current)
|
|
138
|
+
return candidate;
|
|
139
|
+
return preferFresherCredential(current.credential, candidate.credential) ===
|
|
140
|
+
candidate.credential
|
|
141
|
+
? candidate
|
|
142
|
+
: current;
|
|
143
|
+
}, null);
|
|
115
144
|
for (const id of Object.keys(PROVIDER_REGISTRY)) {
|
|
116
145
|
const entry = PROVIDER_REGISTRY[id];
|
|
117
146
|
const sources = [];
|
|
@@ -119,39 +148,47 @@ export async function discoverProviders(opts = {}) {
|
|
|
119
148
|
let oauth;
|
|
120
149
|
let codex;
|
|
121
150
|
if (id === 'anthropic') {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
const borrowedCandidates = [
|
|
152
|
+
...claudeFileCredentials.map(({ credential, path }) => ({
|
|
153
|
+
credential,
|
|
154
|
+
source: { kind: 'claude-file', path },
|
|
155
|
+
})),
|
|
156
|
+
...(keychainCredential
|
|
157
|
+
? [
|
|
158
|
+
{
|
|
159
|
+
credential: keychainCredential,
|
|
160
|
+
source: { kind: 'keychain', service: KEYCHAIN_SERVICE },
|
|
161
|
+
},
|
|
162
|
+
]
|
|
163
|
+
: []),
|
|
164
|
+
].filter((candidate) => candidate.credential.expiresAt === undefined ||
|
|
165
|
+
candidate.credential.expiresAt - Date.now() > 60_000 ||
|
|
166
|
+
(candidate.source.kind === 'claude-file' &&
|
|
167
|
+
candidate.credential.refreshToken !== undefined));
|
|
168
|
+
const borrowed = borrowedCandidates.reduce((current, candidate) => {
|
|
169
|
+
if (!current)
|
|
170
|
+
return candidate;
|
|
171
|
+
return preferFresherCredential(current.credential, candidate.credential) ===
|
|
172
|
+
candidate.credential
|
|
173
|
+
? candidate
|
|
174
|
+
: current;
|
|
175
|
+
}, null);
|
|
176
|
+
if (borrowed) {
|
|
135
177
|
if (apiKey === undefined) {
|
|
136
|
-
apiKey =
|
|
178
|
+
apiKey = borrowed.credential.accessToken;
|
|
137
179
|
oauth = {
|
|
138
|
-
refreshToken:
|
|
139
|
-
expiresAt:
|
|
140
|
-
origin:
|
|
180
|
+
refreshToken: borrowed.credential.refreshToken,
|
|
181
|
+
expiresAt: borrowed.credential.expiresAt,
|
|
182
|
+
origin: borrowed.source.kind === 'claude-file' ? 'claude-file' : 'keychain',
|
|
183
|
+
...(borrowed.source.kind === 'claude-file' ? { sourcePath: borrowed.source.path } : {}),
|
|
141
184
|
};
|
|
142
185
|
}
|
|
143
|
-
sources.push(
|
|
186
|
+
sources.push(borrowed.source);
|
|
187
|
+
}
|
|
188
|
+
for (const candidate of borrowedCandidates) {
|
|
189
|
+
if (candidate !== borrowed)
|
|
190
|
+
sources.push(candidate.source);
|
|
144
191
|
}
|
|
145
|
-
const otherBorrowedSource = usableBorrowed && usableBorrowed === claudeFileCredential && keychainCredential
|
|
146
|
-
? { kind: 'keychain', service: KEYCHAIN_SERVICE }
|
|
147
|
-
: usableBorrowed && usableBorrowed === keychainCredential && claudeFileCredential
|
|
148
|
-
? {
|
|
149
|
-
kind: 'claude-file',
|
|
150
|
-
path: claudeCredentialsPath(opts.home),
|
|
151
|
-
}
|
|
152
|
-
: undefined;
|
|
153
|
-
if (otherBorrowedSource)
|
|
154
|
-
sources.push(otherBorrowedSource);
|
|
155
192
|
if (storedCredential) {
|
|
156
193
|
if (apiKey === undefined) {
|
|
157
194
|
apiKey = storedCredential.accessToken;
|
|
@@ -168,14 +205,14 @@ export async function discoverProviders(opts = {}) {
|
|
|
168
205
|
}
|
|
169
206
|
}
|
|
170
207
|
if (id === 'codex' && (storedCodexCredential || usableCodexFileCredential)) {
|
|
171
|
-
const credential = usableCodexFileCredential ?? storedCodexCredential;
|
|
208
|
+
const credential = usableCodexFileCredential?.credential ?? storedCodexCredential;
|
|
172
209
|
if (!credential)
|
|
173
210
|
throw new Error('unreachable');
|
|
174
211
|
apiKey = credential.accessToken;
|
|
175
212
|
sources.push({
|
|
176
213
|
kind: usableCodexFileCredential ? 'codex-file' : 'stored',
|
|
177
214
|
path: usableCodexFileCredential
|
|
178
|
-
?
|
|
215
|
+
? usableCodexFileCredential.path
|
|
179
216
|
: credentialsPath(...(opts.home === undefined ? [] : [opts.home])),
|
|
180
217
|
});
|
|
181
218
|
codex = {
|
|
@@ -189,6 +226,11 @@ export async function discoverProviders(opts = {}) {
|
|
|
189
226
|
path: credentialsPath(...(opts.home === undefined ? [] : [opts.home])),
|
|
190
227
|
});
|
|
191
228
|
}
|
|
229
|
+
for (const candidate of codexFileCredentials) {
|
|
230
|
+
if (candidate !== usableCodexFileCredential) {
|
|
231
|
+
sources.push({ kind: 'codex-file', path: candidate.path });
|
|
232
|
+
}
|
|
233
|
+
}
|
|
192
234
|
}
|
|
193
235
|
for (const envName of entry.envVars) {
|
|
194
236
|
// Through the SDK's seam rather than a direct `env[envName]`. The
|
|
@@ -1 +1 @@
|
|
|
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,yBAAyB,EACzB,gCAAgC,GAChC,MAAM,uBAAu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AA;IACxC,MAAM,KAAK,GAAG,UAAU,CACvB,GAAG,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"}
|
|
@@ -1,21 +1,54 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
/** Adapters for credentials owned by co-installed agent harnesses. */
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
10
3
|
import type { AgentOAuthCredential } from './keychain.js';
|
|
11
4
|
export interface CodexOAuthCredential extends AgentOAuthCredential {
|
|
12
5
|
readonly accountId: string;
|
|
13
6
|
}
|
|
7
|
+
export interface HarnessCredentialCandidate<T extends AgentOAuthCredential> {
|
|
8
|
+
readonly path: string;
|
|
9
|
+
readonly credential: T;
|
|
10
|
+
}
|
|
11
|
+
export interface ClaudeCredentialReplaceResult {
|
|
12
|
+
readonly replaced: boolean;
|
|
13
|
+
readonly current: AgentOAuthCredential | null;
|
|
14
|
+
}
|
|
14
15
|
export declare function claudeCredentialsPath(home?: string): string;
|
|
16
|
+
/** Convert an absolute Windows path into the drive mount WSL exposes. */
|
|
17
|
+
export declare function windowsPathToWsl(path: string): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the Windows account paired with this WSL process.
|
|
20
|
+
*
|
|
21
|
+
* The Windows executable is pinned instead of searched through PATH: this
|
|
22
|
+
* lookup decides where a credential may be read, so a project-local `cmd.exe`
|
|
23
|
+
* must not be able to redirect it. Failure is an ordinary "no second home"
|
|
24
|
+
* result; native Linux never starts a process.
|
|
25
|
+
*/
|
|
26
|
+
export declare function wslWindowsHome(env?: NodeJS.ProcessEnv, run?: typeof execFileSync, command?: string): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Usable Claude sessions visible from this process, freshest first.
|
|
29
|
+
*
|
|
30
|
+
* WSL is one device with two home directories in practice. Claude may be
|
|
31
|
+
* installed and signed in on Windows while Namzu runs inside WSL; treating the
|
|
32
|
+
* Linux home as the whole device turns that valid subscription into a missing
|
|
33
|
+
* credential. An explicit `home` remains hermetic for embeds and tests.
|
|
34
|
+
*/
|
|
35
|
+
export declare function readClaudeFileCredentialCandidates(home: string | undefined, env?: NodeJS.ProcessEnv, windowsHome?: string | null | undefined): readonly HarnessCredentialCandidate<AgentOAuthCredential>[];
|
|
15
36
|
export declare function codexCredentialsPath(home?: string, env?: NodeJS.ProcessEnv): string;
|
|
16
37
|
export declare function readClaudeFileCredential(home?: string): AgentOAuthCredential | null;
|
|
17
38
|
/** Read a Claude-owned credential from the exact path discovery admitted. */
|
|
18
39
|
export declare function readClaudeCredentialFile(path: string): AgentOAuthCredential | null;
|
|
40
|
+
/**
|
|
41
|
+
* Publish a refreshed Claude session back to the exact owner file discovered.
|
|
42
|
+
*
|
|
43
|
+
* Claude refresh grants may rotate. Keeping the successor only in Namzu would
|
|
44
|
+
* consume the owner's grant and leave its file unusable, so this preserves the
|
|
45
|
+
* full envelope and atomically replaces only its OAuth fields. The final
|
|
46
|
+
* re-read lets an owner rotation that completed during the network request win.
|
|
47
|
+
* Claude does not participate in Namzu's lock, so this is intentionally not
|
|
48
|
+
* described as a cross-process CAS; it is the strongest owner-compatible
|
|
49
|
+
* publication available for this shared file format.
|
|
50
|
+
*/
|
|
51
|
+
export declare function replaceClaudeCredentialFile(path: string, expected: AgentOAuthCredential, replacement: AgentOAuthCredential): ClaudeCredentialReplaceResult;
|
|
19
52
|
export declare function codexCredentialFromTokens(tokens: {
|
|
20
53
|
readonly accessToken: string;
|
|
21
54
|
readonly refreshToken?: string;
|
|
@@ -29,6 +62,8 @@ export declare function codexCredentialFromTokens(tokens: {
|
|
|
29
62
|
* Codex Responses backend and requires the account id that backend routes on.
|
|
30
63
|
*/
|
|
31
64
|
export declare function readCodexFileCredential(home?: string, env?: NodeJS.ProcessEnv): CodexOAuthCredential | null;
|
|
65
|
+
/** Usable Codex sessions visible from this process, including a paired WSL host. */
|
|
66
|
+
export declare function readCodexFileCredentialCandidates(home: string | undefined, env?: NodeJS.ProcessEnv, windowsHome?: string | null | undefined): readonly HarnessCredentialCandidate<CodexOAuthCredential>[];
|
|
32
67
|
/** Read a Codex-owned credential from the exact path discovery admitted. */
|
|
33
68
|
export declare function readCodexCredentialFile(path: string): CodexOAuthCredential | null;
|
|
34
69
|
/** Prefer the credential whose access token remains valid for longer. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-credentials.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/harness-credentials.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"harness-credentials.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/harness-credentials.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAejD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AWlF;AAWD;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAC1C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,oBAAoB,EAC9B,WAAW,EAAE,oBAAoB,GAC/B,6BAA6B,CAiD/B;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,oFAAoF;AACpF,wBAAgB,iCAAiC,CAChD,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,WAAW,GAAE,MAAM,GAAG,IAAI,GAAG,SAA2D,GACtF,SAAS,0BAA0B,CAAC,oBAAoB,CAAC,EAAE,CAa7D;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"}
|
|
@@ -1,19 +1,66 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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';
|
|
1
|
+
/** Adapters for credentials owned by co-installed agent harnesses. */
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
3
|
+
import { randomBytes } from 'node:crypto';
|
|
4
|
+
import { closeSync, fsyncSync, openSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync, } from 'node:fs';
|
|
11
5
|
import { homedir } from 'node:os';
|
|
12
|
-
import { isAbsolute, join, resolve } from 'node:path';
|
|
6
|
+
import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
|
|
13
7
|
const MAX_CREDENTIAL_FILE_BYTES = 1024 * 1024;
|
|
14
8
|
export function claudeCredentialsPath(home = homedir()) {
|
|
15
9
|
return join(home, '.claude', '.credentials.json');
|
|
16
10
|
}
|
|
11
|
+
/** Convert an absolute Windows path into the drive mount WSL exposes. */
|
|
12
|
+
export function windowsPathToWsl(path) {
|
|
13
|
+
const normalized = path.trim().replaceAll('\\', '/');
|
|
14
|
+
const match = /^([A-Za-z]):\/(.+)$/u.exec(normalized);
|
|
15
|
+
if (!match?.[1] || !match[2] || match[2].split('/').includes('..'))
|
|
16
|
+
return null;
|
|
17
|
+
return `/mnt/${match[1].toLowerCase()}/${match[2]}`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the Windows account paired with this WSL process.
|
|
21
|
+
*
|
|
22
|
+
* The Windows executable is pinned instead of searched through PATH: this
|
|
23
|
+
* lookup decides where a credential may be read, so a project-local `cmd.exe`
|
|
24
|
+
* must not be able to redirect it. Failure is an ordinary "no second home"
|
|
25
|
+
* result; native Linux never starts a process.
|
|
26
|
+
*/
|
|
27
|
+
export function wslWindowsHome(env = process.env, run = execFileSync, command = '/mnt/c/Windows/System32/cmd.exe') {
|
|
28
|
+
if (!env.WSL_DISTRO_NAME && !env.WSL_INTEROP)
|
|
29
|
+
return null;
|
|
30
|
+
try {
|
|
31
|
+
if (!statSync(command).isFile())
|
|
32
|
+
return null;
|
|
33
|
+
const output = run(command, ['/d', '/s', '/c', 'echo', '%USERPROFILE%'], {
|
|
34
|
+
encoding: 'utf8',
|
|
35
|
+
timeout: 1_000,
|
|
36
|
+
windowsHide: true,
|
|
37
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
38
|
+
});
|
|
39
|
+
return windowsPathToWsl(String(output));
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Usable Claude sessions visible from this process, freshest first.
|
|
47
|
+
*
|
|
48
|
+
* WSL is one device with two home directories in practice. Claude may be
|
|
49
|
+
* installed and signed in on Windows while Namzu runs inside WSL; treating the
|
|
50
|
+
* Linux home as the whole device turns that valid subscription into a missing
|
|
51
|
+
* credential. An explicit `home` remains hermetic for embeds and tests.
|
|
52
|
+
*/
|
|
53
|
+
export function readClaudeFileCredentialCandidates(home, env = process.env, windowsHome = home === undefined ? wslWindowsHome(env) : null) {
|
|
54
|
+
const paths = [
|
|
55
|
+
claudeCredentialsPath(home),
|
|
56
|
+
...(windowsHome ? [claudeCredentialsPath(windowsHome)] : []),
|
|
57
|
+
];
|
|
58
|
+
const unique = [...new Set(paths)];
|
|
59
|
+
return unique.flatMap((path) => {
|
|
60
|
+
const credential = readClaudeCredentialFile(path);
|
|
61
|
+
return credential ? [{ path, credential }] : [];
|
|
62
|
+
});
|
|
63
|
+
}
|
|
17
64
|
export function codexCredentialsPath(home = homedir(), env = process.env) {
|
|
18
65
|
const configured = env.CODEX_HOME?.trim();
|
|
19
66
|
const root = configured
|
|
@@ -65,6 +112,73 @@ export function readClaudeCredentialFile(path) {
|
|
|
65
112
|
scopes: optionalStringArray(oauth?.scopes),
|
|
66
113
|
};
|
|
67
114
|
}
|
|
115
|
+
function sameClaudeCredential(left, right) {
|
|
116
|
+
return (left.accessToken === right.accessToken &&
|
|
117
|
+
left.refreshToken === right.refreshToken &&
|
|
118
|
+
left.expiresAt === right.expiresAt &&
|
|
119
|
+
JSON.stringify(left.scopes ?? []) === JSON.stringify(right.scopes ?? []));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Publish a refreshed Claude session back to the exact owner file discovered.
|
|
123
|
+
*
|
|
124
|
+
* Claude refresh grants may rotate. Keeping the successor only in Namzu would
|
|
125
|
+
* consume the owner's grant and leave its file unusable, so this preserves the
|
|
126
|
+
* full envelope and atomically replaces only its OAuth fields. The final
|
|
127
|
+
* re-read lets an owner rotation that completed during the network request win.
|
|
128
|
+
* Claude does not participate in Namzu's lock, so this is intentionally not
|
|
129
|
+
* described as a cross-process CAS; it is the strongest owner-compatible
|
|
130
|
+
* publication available for this shared file format.
|
|
131
|
+
*/
|
|
132
|
+
export function replaceClaudeCredentialFile(path, expected, replacement) {
|
|
133
|
+
const root = record(readCredentialJson(path));
|
|
134
|
+
const oauth = record(root?.claudeAiOauth);
|
|
135
|
+
const current = readClaudeCredentialFile(path);
|
|
136
|
+
if (!root || !oauth || !current)
|
|
137
|
+
return { replaced: false, current };
|
|
138
|
+
if (!sameClaudeCredential(current, expected))
|
|
139
|
+
return { replaced: false, current };
|
|
140
|
+
const updated = {
|
|
141
|
+
...root,
|
|
142
|
+
claudeAiOauth: {
|
|
143
|
+
...oauth,
|
|
144
|
+
accessToken: replacement.accessToken,
|
|
145
|
+
...(replacement.refreshToken === undefined ? {} : { refreshToken: replacement.refreshToken }),
|
|
146
|
+
...(replacement.expiresAt === undefined ? {} : { expiresAt: replacement.expiresAt }),
|
|
147
|
+
...(replacement.scopes === undefined ? {} : { scopes: replacement.scopes }),
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
const tempPath = join(dirname(path), `.${basename(path)}.namzu-${process.pid}-${randomBytes(8).toString('hex')}.tmp`);
|
|
151
|
+
let descriptor;
|
|
152
|
+
try {
|
|
153
|
+
descriptor = openSync(tempPath, 'wx', 0o600);
|
|
154
|
+
writeFileSync(descriptor, `${JSON.stringify(updated, null, 2)}\n`, 'utf8');
|
|
155
|
+
fsyncSync(descriptor);
|
|
156
|
+
closeSync(descriptor);
|
|
157
|
+
descriptor = undefined;
|
|
158
|
+
const beforeCommit = readClaudeCredentialFile(path);
|
|
159
|
+
if (!beforeCommit || !sameClaudeCredential(beforeCommit, expected)) {
|
|
160
|
+
return { replaced: false, current: beforeCommit };
|
|
161
|
+
}
|
|
162
|
+
renameSync(tempPath, path);
|
|
163
|
+
return { replaced: true, current: replacement };
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
if (descriptor !== undefined) {
|
|
167
|
+
try {
|
|
168
|
+
closeSync(descriptor);
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// The primary publication error remains authoritative.
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
unlinkSync(tempPath);
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// A successful rename has already consumed the temporary name.
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
68
182
|
export function codexCredentialFromTokens(tokens) {
|
|
69
183
|
if (tokens.accessToken.length === 0)
|
|
70
184
|
return null;
|
|
@@ -108,6 +222,21 @@ function jwtClaims(token) {
|
|
|
108
222
|
export function readCodexFileCredential(home = homedir(), env = process.env) {
|
|
109
223
|
return readCodexCredentialFile(codexCredentialsPath(home, env));
|
|
110
224
|
}
|
|
225
|
+
/** Usable Codex sessions visible from this process, including a paired WSL host. */
|
|
226
|
+
export function readCodexFileCredentialCandidates(home, env = process.env, windowsHome = home === undefined ? wslWindowsHome(env) : null) {
|
|
227
|
+
// CODEX_HOME is an explicit authority choice. Do not silently add another
|
|
228
|
+
// store beside it, because two owners could then refresh independently.
|
|
229
|
+
const paths = env.CODEX_HOME?.trim()
|
|
230
|
+
? [codexCredentialsPath(home, env)]
|
|
231
|
+
: [
|
|
232
|
+
codexCredentialsPath(home, env),
|
|
233
|
+
...(windowsHome ? [codexCredentialsPath(windowsHome, {})] : []),
|
|
234
|
+
];
|
|
235
|
+
return [...new Set(paths)].flatMap((path) => {
|
|
236
|
+
const credential = readCodexCredentialFile(path);
|
|
237
|
+
return credential ? [{ path, credential }] : [];
|
|
238
|
+
});
|
|
239
|
+
}
|
|
111
240
|
/** Read a Codex-owned credential from the exact path discovery admitted. */
|
|
112
241
|
export function readCodexCredentialFile(path) {
|
|
113
242
|
const root = record(readCredentialJson(path));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-credentials.js","sourceRoot":"","sources":["../../../src/integrations/providers/harness-credentials.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"harness-credentials.js","sourceRoot":"","sources":["../../../src/integrations/providers/harness-credentials.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EACN,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,UAAU,EACV,aAAa,GACb,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAIxE,MAAM,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAAA;AAgB7C,MAAM,UAAU,qBAAqB,CAAC,OAAe,OAAO,EAAE;IAC7D,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAA;AAClD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACpD,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAA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