@namzu/cli 14.1.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.
Files changed (39) hide show
  1. package/README.md +18 -9
  2. package/dist/integrations/providers/discover.d.ts +4 -0
  3. package/dist/integrations/providers/discover.d.ts.map +1 -1
  4. package/dist/integrations/providers/discover.js +55 -37
  5. package/dist/integrations/providers/discover.js.map +1 -1
  6. package/dist/integrations/providers/harness-credentials.d.ts +44 -9
  7. package/dist/integrations/providers/harness-credentials.d.ts.map +1 -1
  8. package/dist/integrations/providers/harness-credentials.js +140 -11
  9. package/dist/integrations/providers/harness-credentials.js.map +1 -1
  10. package/dist/integrations/providers/identity.d.ts +15 -14
  11. package/dist/integrations/providers/identity.d.ts.map +1 -1
  12. package/dist/integrations/providers/identity.js +15 -14
  13. package/dist/integrations/providers/identity.js.map +1 -1
  14. package/dist/integrations/providers/oauth.d.ts +8 -3
  15. package/dist/integrations/providers/oauth.d.ts.map +1 -1
  16. package/dist/integrations/providers/oauth.js +37 -11
  17. package/dist/integrations/providers/oauth.js.map +1 -1
  18. package/dist/integrations/providers/subscription-login.d.ts.map +1 -1
  19. package/dist/integrations/providers/subscription-login.js +12 -8
  20. package/dist/integrations/providers/subscription-login.js.map +1 -1
  21. package/dist/tui/App.d.ts.map +1 -1
  22. package/dist/tui/App.js +262 -34
  23. package/dist/tui/App.js.map +1 -1
  24. package/dist/tui/ChoicePicker.d.ts +14 -0
  25. package/dist/tui/ChoicePicker.d.ts.map +1 -0
  26. package/dist/tui/ChoicePicker.js +15 -0
  27. package/dist/tui/ChoicePicker.js.map +1 -0
  28. package/dist/tui/StatusBar.d.ts +23 -39
  29. package/dist/tui/StatusBar.d.ts.map +1 -1
  30. package/dist/tui/StatusBar.js +67 -105
  31. package/dist/tui/StatusBar.js.map +1 -1
  32. package/dist/tui/agent.d.ts.map +1 -1
  33. package/dist/tui/agent.js +10 -8
  34. package/dist/tui/agent.js.map +1 -1
  35. package/dist/tui/slashCommands.d.ts +8 -0
  36. package/dist/tui/slashCommands.d.ts.map +1 -1
  37. package/dist/tui/slashCommands.js +20 -15
  38. package/dist/tui/slashCommands.js.map +1 -1
  39. package/package.json +4 -4
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-22T00:00:00Z
9
+ timestamp: 2026-08-23T00:00:00Z
10
10
  status: active
11
11
  diataxis: reference
12
12
  -->
@@ -69,14 +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. With no saved choice, one signed-in
73
- subscription starts directly; if both are available, a narrowed picker asks
74
- which one to use and proceeds with its default model. These borrowed credentials
75
- remain read-only and are never copied into `~/.namzu`. A Namzu-owned sign-in is
76
- needed only when no usable device session exists or when you explicitly want a
77
- separate login. API keys remain optional alternatives through environment
78
- variables or the session-only credential picker, and detecting one does not hide
79
- the subscription sign-in action.
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.
80
89
 
81
90
  Repository policy stays live for the whole session. The CLI starts with the
82
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,6 +147,8 @@ 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
  }
149
153
  /**
150
154
  * Providers backed by a subscription session that is already usable now.
@@ -1 +1 @@
1
- {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAiBH,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,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AACzD,sEAAsE;GACpE;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,IAAI,E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,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,7 +58,7 @@
58
58
  */
59
59
  import { EnvCredentialProvider } from '@namzu/sdk';
60
60
  import { credentialsPath, readStoredCodexCredential, readStoredSubscriptionCredential, } from './credential-store.js';
61
- import { claudeCredentialsPath, codexCredentialsPath, preferFresherCredential, readClaudeFileCredential, readCodexFileCredential, } from './harness-credentials.js';
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
64
  /**
@@ -130,12 +130,17 @@ export async function discoverProviders(opts = {}) {
130
130
  // macOS-only: the OAuth credential a co-installed tool keeps in the login
131
131
  // Keychain.
132
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;
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);
139
144
  for (const id of Object.keys(PROVIDER_REGISTRY)) {
140
145
  const entry = PROVIDER_REGISTRY[id];
141
146
  const sources = [];
@@ -143,39 +148,47 @@ export async function discoverProviders(opts = {}) {
143
148
  let oauth;
144
149
  let codex;
145
150
  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) {
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) {
159
177
  if (apiKey === undefined) {
160
- apiKey = usableBorrowed.accessToken;
178
+ apiKey = borrowed.credential.accessToken;
161
179
  oauth = {
162
- refreshToken: usableBorrowed.refreshToken,
163
- expiresAt: usableBorrowed.expiresAt,
164
- origin: borrowedSource.kind === 'claude-file' ? 'claude-file' : 'keychain',
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 } : {}),
165
184
  };
166
185
  }
167
- sources.push(borrowedSource);
186
+ sources.push(borrowed.source);
187
+ }
188
+ for (const candidate of borrowedCandidates) {
189
+ if (candidate !== borrowed)
190
+ sources.push(candidate.source);
168
191
  }
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
192
  if (storedCredential) {
180
193
  if (apiKey === undefined) {
181
194
  apiKey = storedCredential.accessToken;
@@ -192,14 +205,14 @@ export async function discoverProviders(opts = {}) {
192
205
  }
193
206
  }
194
207
  if (id === 'codex' && (storedCodexCredential || usableCodexFileCredential)) {
195
- const credential = usableCodexFileCredential ?? storedCodexCredential;
208
+ const credential = usableCodexFileCredential?.credential ?? storedCodexCredential;
196
209
  if (!credential)
197
210
  throw new Error('unreachable');
198
211
  apiKey = credential.accessToken;
199
212
  sources.push({
200
213
  kind: usableCodexFileCredential ? 'codex-file' : 'stored',
201
214
  path: usableCodexFileCredential
202
- ? codexCredentialsPath(opts.home, env)
215
+ ? usableCodexFileCredential.path
203
216
  : credentialsPath(...(opts.home === undefined ? [] : [opts.home])),
204
217
  });
205
218
  codex = {
@@ -213,6 +226,11 @@ export async function discoverProviders(opts = {}) {
213
226
  path: credentialsPath(...(opts.home === undefined ? [] : [opts.home])),
214
227
  });
215
228
  }
229
+ for (const candidate of codexFileCredentials) {
230
+ if (candidate !== usableCodexFileCredential) {
231
+ sources.push({ kind: 'codex-file', path: candidate.path });
232
+ }
233
+ }
216
234
  }
217
235
  for (const envName of entry.envVars) {
218
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,uBAAuB,CAAA;AAC9B,OAAO,EACN,qBAAqB,E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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;;;;;;;;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"}
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,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAIzD,MAAM,WAAW,oBAAqB,SAAQ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AQ,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
- * 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';
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;;;;;;;;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,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UAAU;QAAE,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;IAC7D,OAAO,UAAU,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;AAChD,CAAC"}
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,IAAI,CAAC,UAAU,CAAC,CAAA;IACrD,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE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ACxC,CAAC,CAAC,EAAE,YAAY,EAAE,cAAc,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE;YACzD,CAAC,CAAC,EAAE,CAAC;QACN,SAAS;KACT,CAAC,CAAA;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,uBAAuB,CACtC,IAAc,EACd,KAAe,EACf,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAEhB,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IACvB,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,iBAAiB,CAAA;IAC7D,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,IAAI,MAAM,CAAC,iBAAiB,CAAA;IAC/D,MAAM,SAAS,GAAG,UAAU,GAAG,GAAG,GAAG,MAAM,CAAA;IAC3C,MAAM,UAAU,GAAG,WAAW,GAAG,GAAG,GAAG,MAAM,CAAA;IAC7C,IAAI,SAAS,KAAK,UAAU;QAAE,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;IAC7D,OAAO,UAAU,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;AAChD,CAAC"}
@@ -36,12 +36,12 @@
36
36
  *
37
37
  * ## The addresses
38
38
  *
39
- * Verified 2026-08-09 rather than assumed. Two hosts serve this token
40
- * endpoint — the one below and `platform.claude.com` on the same path — and
41
- * both answer an `authorization_code` grant identically (`400 invalid_grant`
42
- * for a bogus code, from the same handler). namzu keeps the address its
43
- * existing refresh path has always used, because there was no behaviour to
44
- * gain by moving and a live refresh to lose by guessing.
39
+ * Re-verified against the installed owner client on 2026-08-23. Its live
40
+ * production contract uses the platform token endpoint, the direct Claude
41
+ * subscription authorize endpoint, a local callback when reachable and the
42
+ * platform callback for manual paste. Keeping these together matters: mixing
43
+ * the older console authorize flow with subscription scopes makes the browser
44
+ * classify the attempt as API billing or reject the scope entirely.
45
45
  *
46
46
  * The redirect port is fixed and NOT free to change: it is part of what the
47
47
  * client identity above is registered with, so a different port is simply not
@@ -49,20 +49,21 @@
49
49
  * rather than picking another one.
50
50
  */
51
51
  export declare const OAUTH_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
52
- export declare const OAUTH_TOKEN_URL = "https://console.anthropic.com/v1/oauth/token";
53
- export declare const AUTHORIZE_URL = "https://claude.ai/oauth/authorize";
52
+ export declare const OAUTH_TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
53
+ export declare const AUTHORIZE_URL = "https://claude.com/cai/oauth/authorize";
54
54
  /** Registered with the client identity above; not ours to choose. */
55
55
  export declare const SUBSCRIPTION_REDIRECT_PORT = 53692;
56
56
  export declare const REDIRECT_URI = "http://localhost:53692/callback";
57
+ /** Browser-to-terminal callback used when no local listener is reachable. */
58
+ export declare const MANUAL_REDIRECT_URI = "https://platform.claude.com/oauth/code/callback";
57
59
  /**
58
- * The smallest source-verified scope set used by the current Claude harness.
60
+ * The direct Claude Pro/Max scope set used by the current Claude harness.
59
61
  *
60
62
  * Do not copy every scope a historical client happened to request. Unknown
61
63
  * 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.
64
+ * operator can sign in. `org:create_api_key` belongs to the platform/API
65
+ * billing login and is intentionally absent: Namzu is borrowing the person's
66
+ * Claude subscription session, not asking to create a separately billed key.
66
67
  */
67
- export declare const OAUTH_SCOPES = "org:create_api_key user:profile user:inference";
68
+ export declare const OAUTH_SCOPES = "user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";
68
69
  //# 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;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,mDAAmD,CAAA"}
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,+CAA+C,CAAA;AAC3E,eAAO,MAAM,aAAa,2CAA2C,CAAA;AAErE,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,QAAQ,CAAA;AAC/C,eAAO,MAAM,YAAY,oCAA4D,CAAA;AACrF,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,oDAAoD,CAAA;AAEpF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,4FACiE,CAAA"}