codex-multi-auth 2.23.0 → 2.24.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 (84) hide show
  1. package/.codex-plugin/plugin.json +9 -9
  2. package/LICENSE +21 -21
  3. package/README.md +159 -152
  4. package/assets/codex-multi-auth-icon.svg +39 -39
  5. package/assets/readme-hero.svg +31 -31
  6. package/config/README.md +31 -31
  7. package/config/codex-legacy.json +1021 -1021
  8. package/config/codex-modern.json +347 -347
  9. package/config/minimal-codex.json +15 -15
  10. package/dist/index.js +33 -10
  11. package/dist/lib/account-policy.d.ts +2 -0
  12. package/dist/lib/account-policy.js +3 -1
  13. package/dist/lib/accounts/rate-limits.d.ts +6 -0
  14. package/dist/lib/accounts/rate-limits.js +14 -1
  15. package/dist/lib/accounts.d.ts +6 -1
  16. package/dist/lib/accounts.js +33 -8
  17. package/dist/lib/auth/token-utils.d.ts +5 -0
  18. package/dist/lib/auth/token-utils.js +10 -0
  19. package/dist/lib/codex-manager/commands/account.js +15 -0
  20. package/dist/lib/codex-manager/commands/resets.js +18 -5
  21. package/dist/lib/codex-manager/commands/workspace.d.ts +4 -2
  22. package/dist/lib/codex-manager/commands/workspace.js +33 -2
  23. package/dist/lib/codex-manager/help.js +2 -2
  24. package/dist/lib/codex-manager.js +14 -1
  25. package/dist/lib/constants.d.ts +2 -0
  26. package/dist/lib/constants.js +2 -0
  27. package/dist/lib/context-budget-response.js +8 -8
  28. package/dist/lib/context-overflow.js +10 -10
  29. package/dist/lib/oauth-success.html +125 -125
  30. package/dist/lib/policy/runtime-policy-cache.js +1 -1
  31. package/dist/lib/policy/runtime-policy.d.ts +1 -0
  32. package/dist/lib/policy/runtime-policy.js +4 -0
  33. package/dist/lib/preemptive-quota-scheduler.js +12 -3
  34. package/dist/lib/prompts/codex-host-bridge.js +138 -138
  35. package/dist/lib/prompts/codex.js +79 -79
  36. package/dist/lib/quota-cache.d.ts +4 -0
  37. package/dist/lib/quota-readiness.d.ts +1 -1
  38. package/dist/lib/quota-readiness.js +9 -2
  39. package/dist/lib/request/rate-limit-decision.js +1 -1
  40. package/dist/lib/runtime/account-reset-credits.d.ts +11 -2
  41. package/dist/lib/runtime/account-reset-credits.js +35 -12
  42. package/dist/lib/runtime/automatic-account-checks.js +6 -5
  43. package/dist/lib/runtime/automatic-subscription-checks.js +4 -3
  44. package/dist/lib/runtime/model-discovery-status.js +2 -2
  45. package/dist/lib/runtime/reset-credit-routing.d.ts +11 -3
  46. package/dist/lib/runtime/reset-credit-routing.js +66 -21
  47. package/dist/lib/runtime/reset-credits.d.ts +31 -7
  48. package/dist/lib/runtime/reset-credits.js +135 -28
  49. package/dist/lib/runtime/rotation-proxy-state.d.ts +3 -0
  50. package/dist/lib/runtime/subscription-quota-order.d.ts +1 -0
  51. package/dist/lib/runtime/subscription-quota-order.js +7 -3
  52. package/dist/lib/runtime/workspace-model-scopes.d.ts +2 -0
  53. package/dist/lib/runtime/workspace-model-scopes.js +14 -4
  54. package/dist/lib/runtime-rotation-proxy.js +108 -29
  55. package/dist/lib/storage/snapshot-merge.js +15 -4
  56. package/dist/lib/web-dashboard-html.js +53 -53
  57. package/node_modules/@codex-ai/plugin/dist/index.d.ts +2 -2
  58. package/node_modules/@codex-ai/plugin/dist/index.js +2 -2
  59. package/node_modules/@codex-ai/plugin/dist/tool.d.ts +42 -42
  60. package/node_modules/@codex-ai/plugin/dist/tool.js +29 -29
  61. package/node_modules/@codex-ai/plugin/package.json +9 -9
  62. package/node_modules/@codex-ai/sdk/dist/index.d.ts +4 -4
  63. package/node_modules/@codex-ai/sdk/dist/index.js +2 -2
  64. package/node_modules/@codex-ai/sdk/package.json +8 -8
  65. package/package.json +209 -209
  66. package/scripts/codex-app-launcher.js +653 -653
  67. package/scripts/codex-app-router.js +446 -446
  68. package/scripts/codex-bin-resolver.js +332 -332
  69. package/scripts/codex-multi-auth.js +65 -65
  70. package/scripts/codex-routing.js +63 -63
  71. package/scripts/codex.js +7143 -7143
  72. package/scripts/install-codex-auth-utils.js +213 -213
  73. package/scripts/mcodex.js +367 -367
  74. package/scripts/postinstall.js +114 -114
  75. package/scripts/preuninstall.js +265 -265
  76. package/skills/codex-auth-setup/SKILL.md +73 -73
  77. package/vendor/codex-ai-plugin/dist/index.d.ts +2 -2
  78. package/vendor/codex-ai-plugin/dist/index.js +2 -2
  79. package/vendor/codex-ai-plugin/dist/tool.d.ts +42 -42
  80. package/vendor/codex-ai-plugin/dist/tool.js +29 -29
  81. package/vendor/codex-ai-plugin/package.json +9 -9
  82. package/vendor/codex-ai-sdk/dist/index.d.ts +4 -4
  83. package/vendor/codex-ai-sdk/dist/index.js +2 -2
  84. package/vendor/codex-ai-sdk/package.json +8 -8
@@ -1,65 +1,65 @@
1
- #!/usr/bin/env node
2
-
3
- // @ts-check
4
-
5
- import { createRequire } from "node:module";
6
- import { AUTH_SUBCOMMANDS } from "./codex-routing.js";
7
-
8
- const versionFlags = new Set(["--version", "-v"]);
9
-
10
- function resolveCliVersion() {
11
- const require = createRequire(import.meta.url);
12
- try {
13
- const pkg = require("../package.json");
14
- const version = typeof pkg?.version === "string" ? pkg.version.trim() : "";
15
- if (version.length > 0) {
16
- return version;
17
- }
18
- } catch {
19
- // Best effort only.
20
- }
21
- return "";
22
- }
23
-
24
- /**
25
- * @param {string[]} args
26
- * @returns {string[]}
27
- */
28
- function normalizeStandaloneArgs(args) {
29
- if (args[0] === "auth") return args;
30
- const firstArg = args[0] ?? "";
31
- if (AUTH_SUBCOMMANDS.has(firstArg)) {
32
- // Keep this exhaustive: generic names here are reserved for auth routing.
33
- return ["auth", ...args];
34
- }
35
- return args;
36
- }
37
-
38
- const args = normalizeStandaloneArgs(process.argv.slice(2));
39
- const version = resolveCliVersion();
40
-
41
- if (version.length > 0) {
42
- process.env.CODEX_MULTI_AUTH_CLI_VERSION = version;
43
- }
44
-
45
- const firstArg = args[0] ?? "";
46
-
47
- if (args.length === 1 && versionFlags.has(firstArg)) {
48
- if (version.length > 0) {
49
- process.stdout.write(`${version}\n`);
50
- process.exitCode = 0;
51
- } else {
52
- process.stderr.write("codex-multi-auth version is unavailable.\n");
53
- process.exitCode = 1;
54
- }
55
- } else {
56
- // The specifier lives in a variable so `tsc -p tsconfig.scripts.json` can
57
- // check this file without a prior `npm run build`: a literal
58
- // "../dist/lib/codex-manager.js" specifier forces module resolution against
59
- // dist/. The imported surface is guarded by Number.isInteger below, so the
60
- // erased type information costs nothing here.
61
- const managerModuleSpecifier = "../dist/lib/codex-manager.js";
62
- const { runCodexMultiAuthCli } = await import(managerModuleSpecifier);
63
- const exitCode = await runCodexMultiAuthCli(args);
64
- process.exitCode = Number.isInteger(exitCode) ? exitCode : 1;
65
- }
1
+ #!/usr/bin/env node
2
+
3
+ // @ts-check
4
+
5
+ import { createRequire } from "node:module";
6
+ import { AUTH_SUBCOMMANDS } from "./codex-routing.js";
7
+
8
+ const versionFlags = new Set(["--version", "-v"]);
9
+
10
+ function resolveCliVersion() {
11
+ const require = createRequire(import.meta.url);
12
+ try {
13
+ const pkg = require("../package.json");
14
+ const version = typeof pkg?.version === "string" ? pkg.version.trim() : "";
15
+ if (version.length > 0) {
16
+ return version;
17
+ }
18
+ } catch {
19
+ // Best effort only.
20
+ }
21
+ return "";
22
+ }
23
+
24
+ /**
25
+ * @param {string[]} args
26
+ * @returns {string[]}
27
+ */
28
+ function normalizeStandaloneArgs(args) {
29
+ if (args[0] === "auth") return args;
30
+ const firstArg = args[0] ?? "";
31
+ if (AUTH_SUBCOMMANDS.has(firstArg)) {
32
+ // Keep this exhaustive: generic names here are reserved for auth routing.
33
+ return ["auth", ...args];
34
+ }
35
+ return args;
36
+ }
37
+
38
+ const args = normalizeStandaloneArgs(process.argv.slice(2));
39
+ const version = resolveCliVersion();
40
+
41
+ if (version.length > 0) {
42
+ process.env.CODEX_MULTI_AUTH_CLI_VERSION = version;
43
+ }
44
+
45
+ const firstArg = args[0] ?? "";
46
+
47
+ if (args.length === 1 && versionFlags.has(firstArg)) {
48
+ if (version.length > 0) {
49
+ process.stdout.write(`${version}\n`);
50
+ process.exitCode = 0;
51
+ } else {
52
+ process.stderr.write("codex-multi-auth version is unavailable.\n");
53
+ process.exitCode = 1;
54
+ }
55
+ } else {
56
+ // The specifier lives in a variable so `tsc -p tsconfig.scripts.json` can
57
+ // check this file without a prior `npm run build`: a literal
58
+ // "../dist/lib/codex-manager.js" specifier forces module resolution against
59
+ // dist/. The imported surface is guarded by Number.isInteger below, so the
60
+ // erased type information costs nothing here.
61
+ const managerModuleSpecifier = "../dist/lib/codex-manager.js";
62
+ const { runCodexMultiAuthCli } = await import(managerModuleSpecifier);
63
+ const exitCode = await runCodexMultiAuthCli(args);
64
+ process.exitCode = Number.isInteger(exitCode) ? exitCode : 1;
65
+ }
@@ -1,63 +1,63 @@
1
- const AUTH_SUBCOMMANDS = new Set([
2
- "login",
3
- "list",
4
- "status",
5
- "web",
6
- "limits",
7
- "switch",
8
- "unpin",
9
- "workspace",
10
- "best",
11
- "check",
12
- "features",
13
- "usage",
14
- "resets",
15
- "verify-flagged",
16
- "verify",
17
- "forecast",
18
- "report",
19
- "fix",
20
- "doctor",
21
- "uninstall",
22
- "account",
23
- "budget",
24
- "bridge",
25
- "integrations",
26
- "models",
27
- "monitor",
28
- "rotation",
29
- "why-selected",
30
- "history",
31
- "config",
32
- "init-config",
33
- "debug",
34
- ]);
35
-
36
- /**
37
- * @param {string[]} args
38
- * @returns {string[]}
39
- */
40
- export function normalizeAuthAlias(args) {
41
- if (args.length >= 2 && args[0] === "multi" && args[1] === "auth") {
42
- return ["auth", ...args.slice(2)];
43
- }
44
- if (args.length >= 1 && (args[0] === "multi-auth" || args[0] === "multiauth")) {
45
- return ["auth", ...args.slice(1)];
46
- }
47
- return args;
48
- }
49
-
50
- /**
51
- * @param {string[]} args
52
- * @returns {boolean}
53
- */
54
- export function shouldHandleMultiAuthAuth(args) {
55
- if (args[0] !== "auth") return false;
56
- if (args.length === 1) return true;
57
- const subcommand = args[1];
58
- if (typeof subcommand !== "string") return false;
59
- if (subcommand.startsWith("-")) return true;
60
- return AUTH_SUBCOMMANDS.has(subcommand);
61
- }
62
-
63
- export { AUTH_SUBCOMMANDS };
1
+ const AUTH_SUBCOMMANDS = new Set([
2
+ "login",
3
+ "list",
4
+ "status",
5
+ "web",
6
+ "limits",
7
+ "switch",
8
+ "unpin",
9
+ "workspace",
10
+ "best",
11
+ "check",
12
+ "features",
13
+ "usage",
14
+ "resets",
15
+ "verify-flagged",
16
+ "verify",
17
+ "forecast",
18
+ "report",
19
+ "fix",
20
+ "doctor",
21
+ "uninstall",
22
+ "account",
23
+ "budget",
24
+ "bridge",
25
+ "integrations",
26
+ "models",
27
+ "monitor",
28
+ "rotation",
29
+ "why-selected",
30
+ "history",
31
+ "config",
32
+ "init-config",
33
+ "debug",
34
+ ]);
35
+
36
+ /**
37
+ * @param {string[]} args
38
+ * @returns {string[]}
39
+ */
40
+ export function normalizeAuthAlias(args) {
41
+ if (args.length >= 2 && args[0] === "multi" && args[1] === "auth") {
42
+ return ["auth", ...args.slice(2)];
43
+ }
44
+ if (args.length >= 1 && (args[0] === "multi-auth" || args[0] === "multiauth")) {
45
+ return ["auth", ...args.slice(1)];
46
+ }
47
+ return args;
48
+ }
49
+
50
+ /**
51
+ * @param {string[]} args
52
+ * @returns {boolean}
53
+ */
54
+ export function shouldHandleMultiAuthAuth(args) {
55
+ if (args[0] !== "auth") return false;
56
+ if (args.length === 1) return true;
57
+ const subcommand = args[1];
58
+ if (typeof subcommand !== "string") return false;
59
+ if (subcommand.startsWith("-")) return true;
60
+ return AUTH_SUBCOMMANDS.has(subcommand);
61
+ }
62
+
63
+ export { AUTH_SUBCOMMANDS };