oc-codex-multi-auth 6.22.0 → 6.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 (120) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +793 -729
  3. package/assets/icon.svg +7 -7
  4. package/assets/opencode-logo-ornate-dark.svg +18 -18
  5. package/assets/readme-hero.svg +31 -31
  6. package/config/README.md +197 -177
  7. package/config/minimal-opencode.json +14 -14
  8. package/config/opencode-legacy.json +1346 -1496
  9. package/config/opencode-modern.json +466 -555
  10. package/dist/index.d.ts +7 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +37 -19
  13. package/dist/index.js.map +1 -1
  14. package/dist/lib/accounts/warm-request.d.ts.map +1 -1
  15. package/dist/lib/accounts/warm-request.js +9 -11
  16. package/dist/lib/accounts/warm-request.js.map +1 -1
  17. package/dist/lib/codex-usage.d.ts +35 -0
  18. package/dist/lib/codex-usage.d.ts.map +1 -1
  19. package/dist/lib/codex-usage.js +51 -0
  20. package/dist/lib/codex-usage.js.map +1 -1
  21. package/dist/lib/config.d.ts +5 -3
  22. package/dist/lib/config.d.ts.map +1 -1
  23. package/dist/lib/config.js +2 -0
  24. package/dist/lib/config.js.map +1 -1
  25. package/dist/lib/constants.d.ts +13 -0
  26. package/dist/lib/constants.d.ts.map +1 -1
  27. package/dist/lib/constants.js +13 -0
  28. package/dist/lib/constants.js.map +1 -1
  29. package/dist/lib/context-overflow.js +10 -10
  30. package/dist/lib/desktop-notifications.js +6 -6
  31. package/dist/lib/oauth-success.js +202 -202
  32. package/dist/lib/opencode-v2-provider.d.ts +2 -0
  33. package/dist/lib/opencode-v2-provider.d.ts.map +1 -0
  34. package/dist/lib/opencode-v2-provider.js +4 -0
  35. package/dist/lib/opencode-v2-provider.js.map +1 -0
  36. package/dist/lib/opencode-v2-rpc.d.ts +27 -0
  37. package/dist/lib/opencode-v2-rpc.d.ts.map +1 -0
  38. package/dist/lib/opencode-v2-rpc.js +16 -0
  39. package/dist/lib/opencode-v2-rpc.js.map +1 -0
  40. package/dist/lib/opencode-v2-status.d.ts +17 -0
  41. package/dist/lib/opencode-v2-status.d.ts.map +1 -0
  42. package/dist/lib/opencode-v2-status.js +91 -0
  43. package/dist/lib/opencode-v2-status.js.map +1 -0
  44. package/dist/lib/opencode-v2-tui.d.ts +4 -0
  45. package/dist/lib/opencode-v2-tui.d.ts.map +1 -0
  46. package/dist/lib/opencode-v2-tui.js +105 -0
  47. package/dist/lib/opencode-v2-tui.js.map +1 -0
  48. package/dist/lib/opencode-v2.d.ts +11 -0
  49. package/dist/lib/opencode-v2.d.ts.map +1 -0
  50. package/dist/lib/opencode-v2.js +235 -0
  51. package/dist/lib/opencode-v2.js.map +1 -0
  52. package/dist/lib/prompts/codex-opencode-bridge.js +67 -67
  53. package/dist/lib/prompts/codex.d.ts +12 -2
  54. package/dist/lib/prompts/codex.d.ts.map +1 -1
  55. package/dist/lib/prompts/codex.js +126 -91
  56. package/dist/lib/prompts/codex.js.map +1 -1
  57. package/dist/lib/quota-capacity.d.ts +4 -0
  58. package/dist/lib/quota-capacity.d.ts.map +1 -0
  59. package/dist/lib/quota-capacity.js +45 -0
  60. package/dist/lib/quota-capacity.js.map +1 -0
  61. package/dist/lib/quota-overview.d.ts +13 -27
  62. package/dist/lib/quota-overview.d.ts.map +1 -1
  63. package/dist/lib/quota-overview.js +59 -99
  64. package/dist/lib/quota-overview.js.map +1 -1
  65. package/dist/lib/quota-recovery.d.ts +5 -0
  66. package/dist/lib/quota-recovery.d.ts.map +1 -0
  67. package/dist/lib/quota-recovery.js +66 -0
  68. package/dist/lib/quota-recovery.js.map +1 -0
  69. package/dist/lib/request/fetch-helpers.d.ts +1 -1
  70. package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
  71. package/dist/lib/request/fetch-helpers.js +85 -51
  72. package/dist/lib/request/fetch-helpers.js.map +1 -1
  73. package/dist/lib/request/helpers/model-map.d.ts +10 -0
  74. package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
  75. package/dist/lib/request/helpers/model-map.js +39 -11
  76. package/dist/lib/request/helpers/model-map.js.map +1 -1
  77. package/dist/lib/request/helpers/responses-lite.d.ts.map +1 -1
  78. package/dist/lib/request/helpers/responses-lite.js +4 -1
  79. package/dist/lib/request/helpers/responses-lite.js.map +1 -1
  80. package/dist/lib/request/request-transformer.d.ts.map +1 -1
  81. package/dist/lib/request/request-transformer.js +37 -15
  82. package/dist/lib/request/request-transformer.js.map +1 -1
  83. package/dist/lib/schemas.d.ts +9 -1
  84. package/dist/lib/schemas.d.ts.map +1 -1
  85. package/dist/lib/schemas.js +3 -2
  86. package/dist/lib/schemas.js.map +1 -1
  87. package/dist/lib/storage/state.d.ts +8 -0
  88. package/dist/lib/storage/state.d.ts.map +1 -1
  89. package/dist/lib/storage/state.js +47 -20
  90. package/dist/lib/storage/state.js.map +1 -1
  91. package/dist/lib/tools/codex-limits.d.ts.map +1 -1
  92. package/dist/lib/tools/codex-limits.js +49 -3
  93. package/dist/lib/tools/codex-limits.js.map +1 -1
  94. package/dist/lib/tui-quota-cache.d.ts +1 -0
  95. package/dist/lib/tui-quota-cache.d.ts.map +1 -1
  96. package/dist/lib/tui-quota-cache.js +2 -0
  97. package/dist/lib/tui-quota-cache.js.map +1 -1
  98. package/dist/lib/tui-quota-overview.d.ts.map +1 -1
  99. package/dist/lib/tui-quota-overview.js +4 -0
  100. package/dist/lib/tui-quota-overview.js.map +1 -1
  101. package/dist/lib/tui-status-slot.d.ts +3 -0
  102. package/dist/lib/tui-status-slot.d.ts.map +1 -0
  103. package/dist/lib/tui-status-slot.js +27 -0
  104. package/dist/lib/tui-status-slot.js.map +1 -0
  105. package/dist/lib/tui-status.d.ts +1 -0
  106. package/dist/lib/tui-status.d.ts.map +1 -1
  107. package/dist/lib/tui-status.js +1 -0
  108. package/dist/lib/tui-status.js.map +1 -1
  109. package/dist/tui.d.ts +10 -3
  110. package/dist/tui.d.ts.map +1 -1
  111. package/dist/tui.js +22 -1
  112. package/dist/tui.js.map +1 -1
  113. package/package.json +157 -155
  114. package/scripts/audit-dev-allowlist.js +114 -114
  115. package/scripts/clean-dist.js +27 -27
  116. package/scripts/copy-oauth-success.js +47 -47
  117. package/scripts/install-oc-codex-multi-auth-core.js +2092 -2003
  118. package/scripts/install-oc-codex-multi-auth.js +37 -37
  119. package/scripts/test-all-models.sh +260 -260
  120. package/scripts/validate-model-map.sh +97 -97
@@ -1,114 +1,114 @@
1
- #!/usr/bin/env node
2
-
3
- import { execSync } from "node:child_process";
4
-
5
- const ALLOWED_HIGH_OR_CRITICAL_PACKAGES = new Set([
6
- "eslint",
7
- "ajv",
8
- "@eslint-community/eslint-utils",
9
- "@typescript-eslint/eslint-plugin",
10
- "@typescript-eslint/parser",
11
- "@typescript-eslint/type-utils",
12
- "@typescript-eslint/typescript-estree",
13
- "@typescript-eslint/utils",
14
- "minimatch",
15
- ]);
16
-
17
- function summarizeVia(via) {
18
- if (!Array.isArray(via)) return [];
19
- return via
20
- .map((item) => {
21
- if (typeof item === "string") return item;
22
- if (!item || typeof item !== "object") return "unknown";
23
- const name = typeof item.name === "string" ? item.name : "unknown";
24
- const range = typeof item.range === "string" ? item.range : "";
25
- return range ? `${name}:${range}` : name;
26
- })
27
- .slice(0, 5);
28
- }
29
-
30
- let rawAuditOutput = "";
31
- try {
32
- rawAuditOutput = execSync("npm audit --json", {
33
- encoding: "utf8",
34
- stdio: ["ignore", "pipe", "pipe"],
35
- }).trim();
36
- } catch (error) {
37
- const execError = error;
38
- const stdout =
39
- execError &&
40
- typeof execError === "object" &&
41
- "stdout" in execError &&
42
- typeof execError.stdout === "string"
43
- ? execError.stdout
44
- : "";
45
- const stderr =
46
- execError &&
47
- typeof execError === "object" &&
48
- "stderr" in execError &&
49
- typeof execError.stderr === "string"
50
- ? execError.stderr
51
- : "";
52
- rawAuditOutput = stdout.trim() || stderr.trim();
53
- }
54
-
55
- if (!rawAuditOutput) {
56
- console.error("Failed to read npm audit JSON output.");
57
- process.exit(1);
58
- }
59
-
60
- let auditJson;
61
- try {
62
- auditJson = JSON.parse(rawAuditOutput.replace(/^\uFEFF/, ""));
63
- } catch (error) {
64
- console.error("Failed to parse npm audit JSON output.");
65
- console.error(error instanceof Error ? error.message : String(error));
66
- process.exit(1);
67
- }
68
-
69
- const vulnerabilities =
70
- auditJson && typeof auditJson === "object" && auditJson.vulnerabilities && typeof auditJson.vulnerabilities === "object"
71
- ? auditJson.vulnerabilities
72
- : {};
73
-
74
- const unexpected = [];
75
- const allowlisted = [];
76
-
77
- for (const [name, details] of Object.entries(vulnerabilities)) {
78
- if (!details || typeof details !== "object") continue;
79
- const severity = typeof details.severity === "string" ? details.severity : "unknown";
80
- if (severity !== "high" && severity !== "critical") continue;
81
-
82
- const entry = {
83
- name,
84
- severity,
85
- via: summarizeVia(details.via),
86
- fixAvailable: details.fixAvailable ?? false,
87
- };
88
-
89
- if (ALLOWED_HIGH_OR_CRITICAL_PACKAGES.has(name)) {
90
- allowlisted.push(entry);
91
- continue;
92
- }
93
- unexpected.push(entry);
94
- }
95
-
96
- if (unexpected.length > 0) {
97
- console.error("Unexpected high/critical vulnerabilities detected in dev dependency audit:");
98
- for (const entry of unexpected) {
99
- console.error(
100
- `- ${entry.name} (${entry.severity}) via ${entry.via.join(", ") || "unknown"} fixAvailable=${String(entry.fixAvailable)}`,
101
- );
102
- }
103
- process.exit(1);
104
- }
105
-
106
- if (allowlisted.length > 0) {
107
- console.warn("Allowlisted high/critical dev vulnerabilities detected:");
108
- for (const entry of allowlisted) {
109
- console.warn(
110
- `- ${entry.name} (${entry.severity}) via ${entry.via.join(", ") || "unknown"} fixAvailable=${String(entry.fixAvailable)}`,
111
- );
112
- }
113
- console.warn("No unexpected high/critical vulnerabilities found.");
114
- }
1
+ #!/usr/bin/env node
2
+
3
+ import { execSync } from "node:child_process";
4
+
5
+ const ALLOWED_HIGH_OR_CRITICAL_PACKAGES = new Set([
6
+ "eslint",
7
+ "ajv",
8
+ "@eslint-community/eslint-utils",
9
+ "@typescript-eslint/eslint-plugin",
10
+ "@typescript-eslint/parser",
11
+ "@typescript-eslint/type-utils",
12
+ "@typescript-eslint/typescript-estree",
13
+ "@typescript-eslint/utils",
14
+ "minimatch",
15
+ ]);
16
+
17
+ function summarizeVia(via) {
18
+ if (!Array.isArray(via)) return [];
19
+ return via
20
+ .map((item) => {
21
+ if (typeof item === "string") return item;
22
+ if (!item || typeof item !== "object") return "unknown";
23
+ const name = typeof item.name === "string" ? item.name : "unknown";
24
+ const range = typeof item.range === "string" ? item.range : "";
25
+ return range ? `${name}:${range}` : name;
26
+ })
27
+ .slice(0, 5);
28
+ }
29
+
30
+ let rawAuditOutput = "";
31
+ try {
32
+ rawAuditOutput = execSync("npm audit --json", {
33
+ encoding: "utf8",
34
+ stdio: ["ignore", "pipe", "pipe"],
35
+ }).trim();
36
+ } catch (error) {
37
+ const execError = error;
38
+ const stdout =
39
+ execError &&
40
+ typeof execError === "object" &&
41
+ "stdout" in execError &&
42
+ typeof execError.stdout === "string"
43
+ ? execError.stdout
44
+ : "";
45
+ const stderr =
46
+ execError &&
47
+ typeof execError === "object" &&
48
+ "stderr" in execError &&
49
+ typeof execError.stderr === "string"
50
+ ? execError.stderr
51
+ : "";
52
+ rawAuditOutput = stdout.trim() || stderr.trim();
53
+ }
54
+
55
+ if (!rawAuditOutput) {
56
+ console.error("Failed to read npm audit JSON output.");
57
+ process.exit(1);
58
+ }
59
+
60
+ let auditJson;
61
+ try {
62
+ auditJson = JSON.parse(rawAuditOutput.replace(/^\uFEFF/, ""));
63
+ } catch (error) {
64
+ console.error("Failed to parse npm audit JSON output.");
65
+ console.error(error instanceof Error ? error.message : String(error));
66
+ process.exit(1);
67
+ }
68
+
69
+ const vulnerabilities =
70
+ auditJson && typeof auditJson === "object" && auditJson.vulnerabilities && typeof auditJson.vulnerabilities === "object"
71
+ ? auditJson.vulnerabilities
72
+ : {};
73
+
74
+ const unexpected = [];
75
+ const allowlisted = [];
76
+
77
+ for (const [name, details] of Object.entries(vulnerabilities)) {
78
+ if (!details || typeof details !== "object") continue;
79
+ const severity = typeof details.severity === "string" ? details.severity : "unknown";
80
+ if (severity !== "high" && severity !== "critical") continue;
81
+
82
+ const entry = {
83
+ name,
84
+ severity,
85
+ via: summarizeVia(details.via),
86
+ fixAvailable: details.fixAvailable ?? false,
87
+ };
88
+
89
+ if (ALLOWED_HIGH_OR_CRITICAL_PACKAGES.has(name)) {
90
+ allowlisted.push(entry);
91
+ continue;
92
+ }
93
+ unexpected.push(entry);
94
+ }
95
+
96
+ if (unexpected.length > 0) {
97
+ console.error("Unexpected high/critical vulnerabilities detected in dev dependency audit:");
98
+ for (const entry of unexpected) {
99
+ console.error(
100
+ `- ${entry.name} (${entry.severity}) via ${entry.via.join(", ") || "unknown"} fixAvailable=${String(entry.fixAvailable)}`,
101
+ );
102
+ }
103
+ process.exit(1);
104
+ }
105
+
106
+ if (allowlisted.length > 0) {
107
+ console.warn("Allowlisted high/critical dev vulnerabilities detected:");
108
+ for (const entry of allowlisted) {
109
+ console.warn(
110
+ `- ${entry.name} (${entry.severity}) via ${entry.via.join(", ") || "unknown"} fixAvailable=${String(entry.fixAvailable)}`,
111
+ );
112
+ }
113
+ console.warn("No unexpected high/critical vulnerabilities found.");
114
+ }
@@ -1,27 +1,27 @@
1
- import { promises as fs } from "node:fs";
2
- import { dirname, relative, resolve } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
-
8
- function normalizeRelativePath(path) {
9
- return path.replaceAll("\\", "/");
10
- }
11
-
12
- export async function cleanDist(options = {}) {
13
- const repoRoot = resolve(options.repoRoot ?? resolve(__dirname, ".."));
14
- const distDir = resolve(options.distDir ?? resolve(repoRoot, "dist"));
15
- const relativeDist = normalizeRelativePath(relative(repoRoot, distDir));
16
-
17
- if (relativeDist !== "dist") {
18
- throw new Error(`Refusing to clean non-dist path: ${distDir}`);
19
- }
20
-
21
- await fs.rm(distDir, { recursive: true, force: true });
22
- return { distDir };
23
- }
24
-
25
- if (process.argv[1] && resolve(process.argv[1]) === __filename) {
26
- await cleanDist();
27
- }
1
+ import { promises as fs } from "node:fs";
2
+ import { dirname, relative, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ function normalizeRelativePath(path) {
9
+ return path.replaceAll("\\", "/");
10
+ }
11
+
12
+ export async function cleanDist(options = {}) {
13
+ const repoRoot = resolve(options.repoRoot ?? resolve(__dirname, ".."));
14
+ const distDir = resolve(options.distDir ?? resolve(repoRoot, "dist"));
15
+ const relativeDist = normalizeRelativePath(relative(repoRoot, distDir));
16
+
17
+ if (relativeDist !== "dist") {
18
+ throw new Error(`Refusing to clean non-dist path: ${distDir}`);
19
+ }
20
+
21
+ await fs.rm(distDir, { recursive: true, force: true });
22
+ return { distDir };
23
+ }
24
+
25
+ if (process.argv[1] && resolve(process.argv[1]) === __filename) {
26
+ await cleanDist();
27
+ }
@@ -1,47 +1,47 @@
1
- import { promises as fs } from "node:fs";
2
- import { dirname, join, resolve } from "node:path";
3
- import { fileURLToPath, pathToFileURL } from "node:url";
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
-
8
- function normalizePathForCompare(path) {
9
- const resolved = resolve(path);
10
- return process.platform === "win32" ? resolved.toLowerCase() : resolved;
11
- }
12
-
13
- function getDefaultPaths() {
14
- const modulePath = join(__dirname, "..", "dist", "lib", "oauth-success.js");
15
- const dest = join(__dirname, "..", "dist", "lib", "oauth-success.html");
16
- return { modulePath, dest };
17
- }
18
-
19
- async function loadOAuthSuccessHtml(modulePath) {
20
- const moduleUrl = pathToFileURL(modulePath).href;
21
- const mod = await import(moduleUrl);
22
- if (typeof mod.oauthSuccessHtml !== "string") {
23
- throw new TypeError(`Expected oauthSuccessHtml string export from ${modulePath}`);
24
- }
25
- return mod.oauthSuccessHtml;
26
- }
27
-
28
- export async function copyOAuthSuccessHtml(options = {}) {
29
- const defaults = getDefaultPaths();
30
- const modulePath = options.modulePath ?? defaults.modulePath;
31
- const dest = options.dest ?? defaults.dest;
32
- const html = options.html ?? (await loadOAuthSuccessHtml(modulePath));
33
-
34
- await fs.mkdir(dirname(dest), { recursive: true });
35
- await fs.writeFile(dest, html, "utf-8");
36
-
37
- return { modulePath, dest };
38
- }
39
-
40
- const isDirectRun = (() => {
41
- if (!process.argv[1]) return false;
42
- return normalizePathForCompare(process.argv[1]) === normalizePathForCompare(__filename);
43
- })();
44
-
45
- if (isDirectRun) {
46
- await copyOAuthSuccessHtml();
47
- }
1
+ import { promises as fs } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ function normalizePathForCompare(path) {
9
+ const resolved = resolve(path);
10
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
11
+ }
12
+
13
+ function getDefaultPaths() {
14
+ const modulePath = join(__dirname, "..", "dist", "lib", "oauth-success.js");
15
+ const dest = join(__dirname, "..", "dist", "lib", "oauth-success.html");
16
+ return { modulePath, dest };
17
+ }
18
+
19
+ async function loadOAuthSuccessHtml(modulePath) {
20
+ const moduleUrl = pathToFileURL(modulePath).href;
21
+ const mod = await import(moduleUrl);
22
+ if (typeof mod.oauthSuccessHtml !== "string") {
23
+ throw new TypeError(`Expected oauthSuccessHtml string export from ${modulePath}`);
24
+ }
25
+ return mod.oauthSuccessHtml;
26
+ }
27
+
28
+ export async function copyOAuthSuccessHtml(options = {}) {
29
+ const defaults = getDefaultPaths();
30
+ const modulePath = options.modulePath ?? defaults.modulePath;
31
+ const dest = options.dest ?? defaults.dest;
32
+ const html = options.html ?? (await loadOAuthSuccessHtml(modulePath));
33
+
34
+ await fs.mkdir(dirname(dest), { recursive: true });
35
+ await fs.writeFile(dest, html, "utf-8");
36
+
37
+ return { modulePath, dest };
38
+ }
39
+
40
+ const isDirectRun = (() => {
41
+ if (!process.argv[1]) return false;
42
+ return normalizePathForCompare(process.argv[1]) === normalizePathForCompare(__filename);
43
+ })();
44
+
45
+ if (isDirectRun) {
46
+ await copyOAuthSuccessHtml();
47
+ }