@namzu/cli 14.2.0 → 14.3.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 (88) hide show
  1. package/README.md +31 -7
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +7 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/login.d.ts +21 -3
  6. package/dist/commands/login.d.ts.map +1 -1
  7. package/dist/commands/login.js +33 -21
  8. package/dist/commands/login.js.map +1 -1
  9. package/dist/commands/prior-messages.d.ts.map +1 -1
  10. package/dist/commands/prior-messages.js +13 -4
  11. package/dist/commands/prior-messages.js.map +1 -1
  12. package/dist/commands/upgrade.d.ts +25 -0
  13. package/dist/commands/upgrade.d.ts.map +1 -0
  14. package/dist/commands/upgrade.js +182 -0
  15. package/dist/commands/upgrade.js.map +1 -0
  16. package/dist/context/runtime-message.d.ts +4 -0
  17. package/dist/context/runtime-message.d.ts.map +1 -0
  18. package/dist/context/runtime-message.js +20 -0
  19. package/dist/context/runtime-message.js.map +1 -0
  20. package/dist/integrations/providers/identity.d.ts +16 -21
  21. package/dist/integrations/providers/identity.d.ts.map +1 -1
  22. package/dist/integrations/providers/identity.js +16 -21
  23. package/dist/integrations/providers/identity.js.map +1 -1
  24. package/dist/integrations/providers/index.d.ts +1 -1
  25. package/dist/integrations/providers/index.d.ts.map +1 -1
  26. package/dist/integrations/providers/index.js +1 -1
  27. package/dist/integrations/providers/index.js.map +1 -1
  28. package/dist/integrations/providers/subscription-login.d.ts +7 -41
  29. package/dist/integrations/providers/subscription-login.d.ts.map +1 -1
  30. package/dist/integrations/providers/subscription-login.js +16 -143
  31. package/dist/integrations/providers/subscription-login.js.map +1 -1
  32. package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
  33. package/dist/integrations/sessions/transcript-export.js +10 -1
  34. package/dist/integrations/sessions/transcript-export.js.map +1 -1
  35. package/dist/integrations/sessions/turn-evidence.d.ts.map +1 -1
  36. package/dist/integrations/sessions/turn-evidence.js +9 -1
  37. package/dist/integrations/sessions/turn-evidence.js.map +1 -1
  38. package/dist/integrations/updates.d.ts +7 -1
  39. package/dist/integrations/updates.d.ts.map +1 -1
  40. package/dist/integrations/updates.js +59 -21
  41. package/dist/integrations/updates.js.map +1 -1
  42. package/dist/tui/App.d.ts +3 -1
  43. package/dist/tui/App.d.ts.map +1 -1
  44. package/dist/tui/App.js +287 -96
  45. package/dist/tui/App.js.map +1 -1
  46. package/dist/tui/Composer.d.ts +15 -5
  47. package/dist/tui/Composer.d.ts.map +1 -1
  48. package/dist/tui/Composer.js +73 -8
  49. package/dist/tui/Composer.js.map +1 -1
  50. package/dist/tui/LiveActivity.d.ts +3 -0
  51. package/dist/tui/LiveActivity.d.ts.map +1 -1
  52. package/dist/tui/LiveActivity.js +4 -1
  53. package/dist/tui/LiveActivity.js.map +1 -1
  54. package/dist/tui/Picker.d.ts +4 -2
  55. package/dist/tui/Picker.d.ts.map +1 -1
  56. package/dist/tui/Picker.js +136 -16
  57. package/dist/tui/Picker.js.map +1 -1
  58. package/dist/tui/StatusBar.d.ts +1 -1
  59. package/dist/tui/StatusBar.d.ts.map +1 -1
  60. package/dist/tui/StatusBar.js +8 -5
  61. package/dist/tui/StatusBar.js.map +1 -1
  62. package/dist/tui/Transcript.d.ts +3 -1
  63. package/dist/tui/Transcript.d.ts.map +1 -1
  64. package/dist/tui/Transcript.js +2 -2
  65. package/dist/tui/Transcript.js.map +1 -1
  66. package/dist/tui/agent.d.ts +15 -0
  67. package/dist/tui/agent.d.ts.map +1 -1
  68. package/dist/tui/agent.js +17 -0
  69. package/dist/tui/agent.js.map +1 -1
  70. package/dist/tui/exit-summary.d.ts +6 -0
  71. package/dist/tui/exit-summary.d.ts.map +1 -0
  72. package/dist/tui/exit-summary.js +8 -0
  73. package/dist/tui/exit-summary.js.map +1 -0
  74. package/dist/tui/index.d.ts.map +1 -1
  75. package/dist/tui/index.js +15 -6
  76. package/dist/tui/index.js.map +1 -1
  77. package/dist/tui/log-pane.d.ts +13 -8
  78. package/dist/tui/log-pane.d.ts.map +1 -1
  79. package/dist/tui/log-pane.js +23 -29
  80. package/dist/tui/log-pane.js.map +1 -1
  81. package/dist/tui/login-prompt.d.ts +0 -1
  82. package/dist/tui/login-prompt.d.ts.map +1 -1
  83. package/dist/tui/login-prompt.js +1 -6
  84. package/dist/tui/login-prompt.js.map +1 -1
  85. package/dist/tui/open-browser.d.ts.map +1 -1
  86. package/dist/tui/open-browser.js +27 -9
  87. package/dist/tui/open-browser.js.map +1 -1
  88. package/package.json +7 -7
@@ -0,0 +1,182 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { readFileSync } from 'node:fs';
3
+ import { dirname, join, posix, resolve, win32 } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { EXIT_FAIL, EXIT_OK, EXIT_UNAVAILABLE, EXIT_USAGE } from '../exit-codes.js';
6
+ import { compareVersions, latestNamzuVersion } from '../integrations/updates.js';
7
+ const HELP = `namzu upgrade — update the active global Namzu installation
8
+
9
+ Usage:
10
+ namzu upgrade
11
+ namzu upgrade --check
12
+
13
+ Options:
14
+ --check Check the registry without changing the installation
15
+ -h, --help Show this help`;
16
+ /**
17
+ * Derive the prefix owning an npm-global @namzu/cli package.
18
+ *
19
+ * The executing package root is authority. Ambient `npm prefix -g` may point
20
+ * at a different Node installation, especially under version managers, so it
21
+ * is deliberately not consulted.
22
+ */
23
+ export function npmGlobalPrefixFor(packageRoot, platform) {
24
+ const paths = platform === 'win32' ? win32 : posix;
25
+ const root = paths.resolve(packageRoot);
26
+ const expectedTail = platform === 'win32'
27
+ ? paths.join('node_modules', '@namzu', 'cli')
28
+ : paths.join('lib', 'node_modules', '@namzu', 'cli');
29
+ const comparableRoot = platform === 'win32' ? root.toLowerCase() : root;
30
+ const comparableTail = platform === 'win32' ? expectedTail.toLowerCase() : expectedTail;
31
+ const suffix = `${paths.sep}${comparableTail}`;
32
+ if (!comparableRoot.endsWith(suffix))
33
+ return null;
34
+ const prefix = root.slice(0, root.length - suffix.length);
35
+ return prefix.length > 0 ? prefix : paths.parse(root).root;
36
+ }
37
+ function readInstalledVersion(packageRoot) {
38
+ const parsed = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));
39
+ if (parsed.name !== '@namzu/cli') {
40
+ throw new Error('the active package root is not @namzu/cli');
41
+ }
42
+ if (typeof parsed.version !== 'string') {
43
+ throw new Error('the active @namzu/cli package has no readable version');
44
+ }
45
+ return parsed.version;
46
+ }
47
+ function runNpm(request) {
48
+ return new Promise((resolveRun, reject) => {
49
+ const child = spawn(request.executable, [...request.args], {
50
+ cwd: request.prefix,
51
+ env: process.env,
52
+ stdio: 'inherit',
53
+ shell: false,
54
+ });
55
+ child.once('error', reject);
56
+ child.once('exit', (code) => resolveRun(code ?? 1));
57
+ });
58
+ }
59
+ const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');
60
+ const productionDeps = {
61
+ currentVersion: readInstalledVersion(PACKAGE_ROOT),
62
+ packageRoot: PACKAGE_ROOT,
63
+ platform: process.platform,
64
+ latestVersion: latestNamzuVersion,
65
+ runNpm,
66
+ installedVersion: readInstalledVersion,
67
+ };
68
+ function parseArgs(rawArgs) {
69
+ if (rawArgs.length === 0)
70
+ return { check: false };
71
+ if (rawArgs.length === 1 && rawArgs[0] === '--check')
72
+ return { check: true };
73
+ return null;
74
+ }
75
+ export function createUpgradeCommand(deps) {
76
+ return {
77
+ name: 'upgrade',
78
+ description: 'Update the active global Namzu installation',
79
+ passThrough: true,
80
+ help: HELP,
81
+ handler: async ({ ctx, rawArgs }) => {
82
+ const flags = parseArgs(rawArgs);
83
+ if (!flags) {
84
+ ctx.formatter.error({ message: 'Usage: namzu upgrade [--check]' });
85
+ return EXIT_USAGE;
86
+ }
87
+ let latest;
88
+ try {
89
+ latest = await deps.latestVersion();
90
+ }
91
+ catch (error) {
92
+ ctx.formatter.error({
93
+ message: `Could not check the latest Namzu version: ${error instanceof Error ? error.message : String(error)}`,
94
+ });
95
+ return EXIT_UNAVAILABLE;
96
+ }
97
+ if (compareVersions(latest, deps.currentVersion) <= 0) {
98
+ ctx.formatter.print({
99
+ current: deps.currentVersion,
100
+ latest,
101
+ upToDate: true,
102
+ text: `Namzu ${deps.currentVersion} is up to date.`,
103
+ });
104
+ return EXIT_OK;
105
+ }
106
+ if (flags.check) {
107
+ ctx.formatter.print({
108
+ current: deps.currentVersion,
109
+ latest,
110
+ upToDate: false,
111
+ text: `Namzu ${latest} is available (current: ${deps.currentVersion}). Run \`namzu upgrade\` to install it.`,
112
+ });
113
+ return EXIT_OK;
114
+ }
115
+ const prefix = npmGlobalPrefixFor(deps.packageRoot, deps.platform);
116
+ if (!prefix) {
117
+ ctx.formatter.error({
118
+ message: 'This Namzu process is not running from a recognized npm-global installation, so it will not update a different binary by guessing. Reinstall with the same package manager, or use the installer from https://github.com/cogitave/namzu#the-terminal-agent.',
119
+ });
120
+ return EXIT_UNAVAILABLE;
121
+ }
122
+ const executable = deps.platform === 'win32' ? 'npm.cmd' : 'npm';
123
+ const request = {
124
+ executable,
125
+ prefix,
126
+ args: [
127
+ 'install',
128
+ '--global',
129
+ '--prefix',
130
+ prefix,
131
+ '--no-fund',
132
+ '--no-audit',
133
+ '--registry',
134
+ 'https://registry.npmjs.org',
135
+ `@namzu/cli@${latest}`,
136
+ ],
137
+ };
138
+ ctx.formatter.info(`Updating the active npm installation from ${deps.currentVersion} to ${latest}…`);
139
+ let code;
140
+ try {
141
+ code = await deps.runNpm(request);
142
+ }
143
+ catch (error) {
144
+ ctx.formatter.error({
145
+ message: `Could not start npm: ${error instanceof Error ? error.message : String(error)}`,
146
+ });
147
+ return EXIT_FAIL;
148
+ }
149
+ if (code !== 0) {
150
+ ctx.formatter.error({
151
+ message: `npm exited with status ${code}; Namzu was not verified.`,
152
+ });
153
+ return EXIT_FAIL;
154
+ }
155
+ let installed;
156
+ try {
157
+ installed = deps.installedVersion(deps.packageRoot);
158
+ }
159
+ catch (error) {
160
+ ctx.formatter.error({
161
+ message: `npm exited successfully, but the active installation could not be read back: ${error instanceof Error ? error.message : String(error)}`,
162
+ });
163
+ return EXIT_FAIL;
164
+ }
165
+ if (installed !== latest) {
166
+ ctx.formatter.error({
167
+ message: `npm exited successfully, but the active installation still reports ${installed} instead of ${latest}. No update is being claimed.`,
168
+ });
169
+ return EXIT_FAIL;
170
+ }
171
+ ctx.formatter.print({
172
+ previous: deps.currentVersion,
173
+ current: installed,
174
+ updated: true,
175
+ text: `Updated Namzu ${deps.currentVersion} → ${installed}.`,
176
+ });
177
+ return EXIT_OK;
178
+ },
179
+ };
180
+ }
181
+ export const upgradeCommand = createUpgradeCommand(productionDeps);
182
+ //# sourceMappingURL=upgrade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACnF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGhF,MAAM,IAAI,GAAG;;;;;;;;6BAQgB,CAAA;AAiB7B;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB,EAAE,QAAyB;IAChF,MAAM,KAAK,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;IAClD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CA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AA;gBACF,OAAO,SAAS,CAAA;YACjB,CAAC;YACD,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBAChB,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC;oBACnB,OAAO,EAAE,0BAA0B,IAAI,2BAA2B;iBAClE,CAAC,CAAA;gBACF,OAAO,SAAS,CAAA;YACjB,CAAC;YAED,IAAI,SAAiB,CAAA;YACrB,IAAI,CAAC;gBACJ,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YACpD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC;oBACnB,OAAO,EAAE,gFAAgF,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBACjJ,CAAC,CAAA;gBACF,OAAO,SAAS,CAAA;YACjB,CAAC;YACD,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;gBAC1B,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC;oBACnB,OAAO,EAAE,sEAAsE,SAAS,eAAe,MAAM,+BAA+B;iBAC5I,CAAC,CAAA;gBACF,OAAO,SAAS,CAAA;YACjB,CAAC;YAED,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC;gBACnB,QAAQ,EAAE,IAAI,CAAC,cAAc;gBAC7B,OAAO,EAAE,SAAS;gBAClB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,iBAAiB,IAAI,CAAC,cAAc,MAAM,SAAS,GAAG;aAC5D,CAAC,CAAA;YACF,OAAO,OAAO,CAAA;QACf,CAAC;KACD,CAAA;AACF,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAe,oBAAoB,CAAC,cAAc,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { RuntimeContextMessageKind } from '@namzu/sdk';
2
+ /** Human label for provider-user-role context authored by the runtime. */
3
+ export declare function runtimeContextLabel(kind: RuntimeContextMessageKind): string;
4
+ //# sourceMappingURL=runtime-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-message.d.ts","sourceRoot":"","sources":["../../src/context/runtime-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAE3D,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,yBAAyB,GAAG,MAAM,CAiB3E"}
@@ -0,0 +1,20 @@
1
+ /** Human label for provider-user-role context authored by the runtime. */
2
+ export function runtimeContextLabel(kind) {
3
+ switch (kind) {
4
+ case 'advisory':
5
+ return 'Advisor context';
6
+ case 'answer-review':
7
+ return 'Answer review feedback';
8
+ case 'auto-continuation':
9
+ return 'Automatic continuation';
10
+ case 'limit-finalization':
11
+ return 'Limit finalization request';
12
+ case 'steering':
13
+ return 'Runtime steering';
14
+ case 'structured-output':
15
+ return 'Structured-output retry';
16
+ case 'task-completion':
17
+ return 'Task completion context';
18
+ }
19
+ }
20
+ //# sourceMappingURL=runtime-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-message.js","sourceRoot":"","sources":["../../src/context/runtime-message.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CAAC,IAA+B;IAClE,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,UAAU;YACd,OAAO,iBAAiB,CAAA;QACzB,KAAK,eAAe;YACnB,OAAO,wBAAwB,CAAA;QAChC,KAAK,mBAAmB;YACvB,OAAO,wBAAwB,CAAA;QAChC,KAAK,oBAAoB;YACxB,OAAO,4BAA4B,CAAA;QACpC,KAAK,UAAU;YACd,OAAO,kBAAkB,CAAA;QAC1B,KAAK,mBAAmB;YACvB,OAAO,yBAAyB,CAAA;QACjC,KAAK,iBAAiB;YACrB,OAAO,yBAAyB,CAAA;IAClC,CAAC;AACF,CAAC"}
@@ -36,34 +36,29 @@
36
36
  *
37
37
  * ## The addresses
38
38
  *
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
- *
46
- * The redirect port is fixed and NOT free to change: it is part of what the
47
- * client identity above is registered with, so a different port is simply not
48
- * an accepted redirect. That is why a busy port degrades to the paste flow
49
- * rather than picking another one.
39
+ * Re-verified by capturing the exact URL emitted by the installed owner client
40
+ * (`claude auth login --claudeai`, 2.1.241) on 2026-08-23. Its live production
41
+ * contract uses the CAI authorize endpoint, the platform token endpoint and
42
+ * the platform callback below. That client does not offer a loopback redirect
43
+ * on this flow. A localhost callback may be valid OAuth in general, but it is
44
+ * not registered for this client identity; sending one makes the consent page
45
+ * refuse the request before sign-in.
50
46
  */
51
47
  export declare const OAUTH_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
52
48
  export declare const OAUTH_TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
53
49
  export declare const AUTHORIZE_URL = "https://claude.com/cai/oauth/authorize";
54
- /** Registered with the client identity above; not ours to choose. */
55
- export declare const SUBSCRIPTION_REDIRECT_PORT = 53692;
56
- export declare const REDIRECT_URI = "http://localhost:53692/callback";
57
- /** Browser-to-terminal callback used when no local listener is reachable. */
50
+ /** Registered browser-to-terminal callback; not ours to replace with localhost. */
58
51
  export declare const MANUAL_REDIRECT_URI = "https://platform.claude.com/oauth/code/callback";
59
52
  /**
60
53
  * The direct Claude Pro/Max scope set used by the current Claude harness.
61
54
  *
62
- * Do not copy every scope a historical client happened to request. Unknown
63
- * scopes make the authorization page reject the whole request before the
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.
55
+ * This looks broader than the inference capability Namzu consumes, but it is
56
+ * the exact set the current owner client sends for `--claudeai`, not its
57
+ * separately selected `--console` flow. The CAI endpoint validates the whole
58
+ * registered request shape; deleting `org:create_api_key` because its name
59
+ * sounds unrelated produces "Invalid request format" before the account can
60
+ * authorize anything. Keep this as one captured protocol value rather than a
61
+ * hand-curated list of what Namzu later uses.
67
62
  */
68
- export declare const OAUTH_SCOPES = "user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";
63
+ export declare const OAUTH_SCOPES = "org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";
69
64
  //# 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,+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"}
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,eAAO,MAAM,eAAe,yCAAyC,CAAA;AACrE,eAAO,MAAM,eAAe,+CAA+C,CAAA;AAC3E,eAAO,MAAM,aAAa,2CAA2C,CAAA;AAErE,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,oDAAoD,CAAA;AAEpF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,+GACoF,CAAA"}
@@ -36,34 +36,29 @@
36
36
  *
37
37
  * ## The addresses
38
38
  *
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
- *
46
- * The redirect port is fixed and NOT free to change: it is part of what the
47
- * client identity above is registered with, so a different port is simply not
48
- * an accepted redirect. That is why a busy port degrades to the paste flow
49
- * rather than picking another one.
39
+ * Re-verified by capturing the exact URL emitted by the installed owner client
40
+ * (`claude auth login --claudeai`, 2.1.241) on 2026-08-23. Its live production
41
+ * contract uses the CAI authorize endpoint, the platform token endpoint and
42
+ * the platform callback below. That client does not offer a loopback redirect
43
+ * on this flow. A localhost callback may be valid OAuth in general, but it is
44
+ * not registered for this client identity; sending one makes the consent page
45
+ * refuse the request before sign-in.
50
46
  */
51
47
  export const OAUTH_CLIENT_ID = '9d1c250a-e61b-44d9-88ed-5944d1962f5e';
52
48
  export const OAUTH_TOKEN_URL = 'https://platform.claude.com/v1/oauth/token';
53
49
  export const AUTHORIZE_URL = 'https://claude.com/cai/oauth/authorize';
54
- /** Registered with the client identity above; not ours to choose. */
55
- export const SUBSCRIPTION_REDIRECT_PORT = 53692;
56
- export const REDIRECT_URI = `http://localhost:${SUBSCRIPTION_REDIRECT_PORT}/callback`;
57
- /** Browser-to-terminal callback used when no local listener is reachable. */
50
+ /** Registered browser-to-terminal callback; not ours to replace with localhost. */
58
51
  export const MANUAL_REDIRECT_URI = 'https://platform.claude.com/oauth/code/callback';
59
52
  /**
60
53
  * The direct Claude Pro/Max scope set used by the current Claude harness.
61
54
  *
62
- * Do not copy every scope a historical client happened to request. Unknown
63
- * scopes make the authorization page reject the whole request before the
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.
55
+ * This looks broader than the inference capability Namzu consumes, but it is
56
+ * the exact set the current owner client sends for `--claudeai`, not its
57
+ * separately selected `--console` flow. The CAI endpoint validates the whole
58
+ * registered request shape; deleting `org:create_api_key` because its name
59
+ * sounds unrelated produces "Invalid request format" before the account can
60
+ * authorize anything. Keep this as one captured protocol value rather than a
61
+ * hand-curated list of what Namzu later uses.
67
62
  */
68
- export const OAUTH_SCOPES = 'user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload';
63
+ export const OAUTH_SCOPES = 'org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload';
69
64
  //# 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,4CAA4C,CAAA;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,wCAAwC,CAAA;AAErE,qEAAqE;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAA;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,0BAA0B,WAAW,CAAA;AACrF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,iDAAiD,CAAA;AAEpF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GACxB,yFAAyF,CAAA"}
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/integrations/providers/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,sCAAsC,CAAA;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,4CAA4C,CAAA;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,wCAAwC,CAAA;AAErE,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,iDAAiD,CAAA;AAEpF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GACxB,4GAA4G,CAAA"}
@@ -4,7 +4,7 @@ export { type AgentOAuthCredential, isAnthropicOAuthToken, readAgentKeychainCred
4
4
  export { beginCodexDeviceLogin, CODEX_AUTH_ORIGIN, CODEX_OAUTH_CLIENT_ID, type CodexDeviceLogin, type CodexDeviceLoginOptions, type CodexDeviceLoginOutcome, } from './codex-device-login.js';
5
5
  export { clearAllStoredCredentials, clearStoredSubscriptionCredential, clearStoredCodexCredential, CREDENTIALS_FILE_VERSION, CredentialStoreError, credentialsPath, readStoredSubscriptionCredential, readStoredCodexCredential, replaceStoredCodexCredential, type StoredCodexCredential, writeStoredSubscriptionCredential, writeStoredCodexCredential, } from './credential-store.js';
6
6
  export { ensureFreshStoredCodexCredential, type StoredCodexRefreshOptions, } from './codex-oauth.js';
7
- export { OAUTH_SCOPES, REDIRECT_URI } from './identity.js';
7
+ export { MANUAL_REDIRECT_URI, OAUTH_SCOPES } from './identity.js';
8
8
  export { CredentialPublicationError, CredentialRefreshRejectedError, CredentialWithdrawnError, type CredentialOrigin, ensureFreshAnthropicToken, type OAuthMetadata, readSubscriptionCredential, refreshAgentOAuthToken, sameOAuthCredential, } from './oauth.js';
9
9
  export { beginSubscriptionLogin, type LoginOutcome, parsePastedInput, type SubscriptionLogin, type SubscriptionLoginOptions, subscriptionDetectedProvider, } from './subscription-login.js';
10
10
  export { type CapabilityDisagreement, chainCapabilityDisagreements, describeAcceptedMismatch, describeCapabilityRefusal, type MemberCapabilities, unresolvedMembers, } from './chain-capabilities.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAA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wBAAwB,EACxB,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,iBAAiB,GACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,iBAAiB,EACjB,KAAK,WAAW,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,eAAe,EACf,gBAAgB,GAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,qBAAqB,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
+ {"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,eAAe,CAAA;AACtB,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC5B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,yBAAyB,EACzB,iCAAiC,EACjC,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,gCAAgC,EAChC,yBAAyB,EACzB,4BAA4B,EAC5B,KAAK,qBAAqB,EAC1B,iCAAiC,EACjC,0BAA0B,GAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,gCAAgC,EAChC,KAAK,yBAAyB,GAC9B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EACN,0BAA0B,EAC1B,8BAA8B,EAC9B,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,yBAAyB,EACzB,KAAK,aAAa,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EACN,sBAAsB,EACtB,KAAK,YAAY,EACjB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,4BAA4B,GAC5B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,iBAAiB,GACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,iBAAiB,EACjB,KAAK,WAAW,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,eAAe,EACf,gBAAgB,GAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,0BAA0B,GAC1B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,GACxB,MAAM,eAAe,CAAA"}
@@ -4,7 +4,7 @@ export { isAnthropicOAuthToken, readAgentKeychainCredential, } from './keychain.
4
4
  export { beginCodexDeviceLogin, CODEX_AUTH_ORIGIN, CODEX_OAUTH_CLIENT_ID, } from './codex-device-login.js';
5
5
  export { clearAllStoredCredentials, clearStoredSubscriptionCredential, clearStoredCodexCredential, CREDENTIALS_FILE_VERSION, CredentialStoreError, credentialsPath, readStoredSubscriptionCredential, readStoredCodexCredential, replaceStoredCodexCredential, writeStoredSubscriptionCredential, writeStoredCodexCredential, } from './credential-store.js';
6
6
  export { ensureFreshStoredCodexCredential, } from './codex-oauth.js';
7
- export { OAUTH_SCOPES, REDIRECT_URI } from './identity.js';
7
+ export { MANUAL_REDIRECT_URI, OAUTH_SCOPES } from './identity.js';
8
8
  export { CredentialPublicationError, CredentialRefreshRejectedError, CredentialWithdrawnError, ensureFreshAnthropicToken, readSubscriptionCredential, refreshAgentOAuthToken, sameOAuthCredential, } from './oauth.js';
9
9
  export { beginSubscriptionLogin, parsePastedInput, subscriptionDetectedProvider, } from './subscription-login.js';
10
10
  export { chainCapabilityDisagreements, describeAcceptedMismatch, describeCapabilityRefusal, unresolvedMembers, } from './chain-capabilities.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,GAC7B,MAAM,eAAe,CAAA;AACtB,OAAO,EAEN,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAEN,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,GAIrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,yBAAyB,EACzB,iCAAiC,EACjC,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,gCAAgC,EAChC,yBAAyB,EACzB,4BAA4B,EAE5B,iCAAiC,EACjC,0BAA0B,GAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,gCAAgC,GAEhC,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EACN,0BAA0B,EAC1B,8BAA8B,EAC9B,wBAAwB,EAExB,yBAAyB,EAEzB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EACN,sBAAsB,EAEtB,gBAAgB,EAGhB,4BAA4B,GAC5B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAEN,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EAEzB,iBAAiB,GACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,iBAAiB,EAEjB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,eAAe,EAGf,eAAe,EACf,gBAAgB,GAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EAKjB,0BAA0B,GAC1B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,GACxB,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,GAC7B,MAAM,eAAe,CAAA;AACtB,OAAO,EAEN,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GACvB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAEN,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,GAIrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,yBAAyB,EACzB,iCAAiC,EACjC,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,gCAAgC,EAChC,yBAAyB,EACzB,4BAA4B,EAE5B,iCAAiC,EACjC,0BAA0B,GAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,gCAAgC,GAEhC,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EACN,0BAA0B,EAC1B,8BAA8B,EAC9B,wBAAwB,EAExB,yBAAyB,EAEzB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EACN,sBAAsB,EAEtB,gBAAgB,EAGhB,4BAA4B,GAC5B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAEN,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EAEzB,iBAAiB,GACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,iBAAiB,EAEjB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,eAAe,EAGf,eAAe,EACf,gBAAgB,GAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EAKjB,0BAA0B,GAC1B,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,GACxB,MAAM,eAAe,CAAA"}
@@ -10,21 +10,11 @@
10
10
  *
11
11
  * ## The flow
12
12
  *
13
- * Authorization code with PKCE (RFC 7636, S256), redirected to a loopback
14
- * address (RFC 8252 §7.3). Two ways to finish, and BOTH are always offered:
15
- *
16
- * 1. **Loopback.** A one-request server on `127.0.0.1` at the port the
17
- * redirect is registered under. The browser lands on it and the code
18
- * never touches a screen.
19
- * 2. **Paste.** The operator copies the code — or the whole redirect URL —
20
- * out of a browser and hands it back.
21
- *
22
- * The second is not a consolation prize. A container, a remote shell over
23
- * SSH, a machine with no graphical session: none of them can be redirected
24
- * to, and on all of them the loopback server is either unreachable from
25
- * wherever the browser actually is or cannot bind at all. `start()` says
26
- * which of the two it managed to arrange (`loopback`), and the paste path
27
- * works whether or not it did.
13
+ * Authorization code with PKCE (RFC 7636, S256), redirected to the platform
14
+ * callback registered for the owner client's public identity. The operator
15
+ * copies the code — or the whole finished address — back to the initiating
16
+ * surface. This flow deliberately does not invent a localhost redirect: the
17
+ * authorization server rejects an unregistered callback before sign-in.
28
18
  *
29
19
  * ## What never happens here
30
20
  *
@@ -51,26 +41,9 @@ export interface SubscriptionLogin {
51
41
  /** The page to open. Safe to print — it carries a challenge, never a secret. */
52
42
  readonly url: string;
53
43
  readonly redirectUri: string;
54
- /**
55
- * Whether the loopback listener came up.
56
- *
57
- * `false` is not a failure: the port was busy, or the environment forbids
58
- * listening. The paste path is unaffected, and a surface should say so
59
- * rather than imply the login is broken.
60
- */
61
- readonly loopback: boolean;
62
- /**
63
- * Resolve when the browser reaches the loopback listener, or never.
64
- *
65
- * `null` when `loopback` is false, so a caller cannot await a promise that
66
- * has no way to settle. Racing this against `completeWithPastedCode` is the
67
- * intended use; whichever finishes first wins and `cancel()` releases the
68
- * other.
69
- */
70
- waitForCallback(): Promise<LoginOutcome> | null;
71
44
  /** Finish from a pasted redirect URL, `code#state`, or a bare code. */
72
45
  completeWithPastedCode(input: string): Promise<LoginOutcome>;
73
- /** Release the listener. Safe to call twice, and safe to call after success. */
46
+ /** Withdraw the attempt. Safe to call twice, and safe to call after success. */
74
47
  cancel(): void;
75
48
  }
76
49
  export interface SubscriptionLoginOptions {
@@ -78,18 +51,11 @@ export interface SubscriptionLoginOptions {
78
51
  readonly home?: string;
79
52
  /** Override the token-exchange transport (tests inject a stub). */
80
53
  readonly fetch?: typeof fetch;
81
- /**
82
- * Try to listen on the loopback redirect. Default true.
83
- *
84
- * A caller that knows there is no browser here — `--no-browser`, a
85
- * container — passes false and skips a bind that would only ever time out.
86
- */
87
- readonly loopback?: boolean;
88
54
  /** Authority of the surface that started this attempt. */
89
55
  readonly signal?: AbortSignal;
90
56
  }
91
57
  /**
92
- * Begin a login. Returns the page to open plus the two ways to finish it.
58
+ * Begin a login. Returns the page to open plus the paste-completion handle.
93
59
  *
94
60
  * Deliberately does NOT open a browser. Which of `open`, `xdg-open` or a
95
61
  * Windows protocol handler to spawn — and whether spawning anything is even
@@ -1 +1 @@
1
- {"version":3,"file":"subscription-login.d.ts","sourceRoot":"","sources":["../../../src/integrations/providers/subscription-login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAUrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAGzD,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GACrB;IACA,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;IACjB,kFAAkF;IAClF,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAA;IACzC,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CACxB,GACD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAElD,MAAM,WAAW,iBAAiB;IACjC,gFAAgF;IAChF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B;;;;;;;OAOG;IACH,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAA;IAC/C,uEAAuE;IACvE,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;IAC5D,gFAAgF;IAChF,MAAM,IAAI,IAAI,CAAA;CACd;AAED,MAAM,WAAW,wBAAw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