codex-multi-auth 2.19.1 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +9 -9
- package/LICENSE +21 -21
- package/README.md +149 -148
- package/assets/codex-multi-auth-icon.svg +39 -39
- package/assets/readme-hero.svg +31 -31
- package/config/README.md +31 -31
- package/config/codex-legacy.json +1021 -1021
- package/config/codex-modern.json +347 -347
- package/config/minimal-codex.json +15 -15
- package/dist/index.js +1 -1
- package/dist/lib/accounts/rate-limits.js +5 -0
- package/dist/lib/accounts.js +5 -4
- package/dist/lib/auth/account-access.js +2 -2
- package/dist/lib/codex-cli/version.d.ts +22 -0
- package/dist/lib/codex-cli/version.js +78 -0
- package/dist/lib/codex-manager/commands/limits.d.ts +2 -0
- package/dist/lib/codex-manager/commands/limits.js +31 -0
- package/dist/lib/codex-manager/commands/status.js +1 -1
- package/dist/lib/codex-manager.js +2 -0
- package/dist/lib/constants.d.ts +2 -0
- package/dist/lib/constants.js +2 -0
- package/dist/lib/context-budget/model-context-windows.d.ts +1 -1
- package/dist/lib/context-budget/model-context-windows.js +4 -0
- package/dist/lib/context-budget-response.js +8 -8
- package/dist/lib/context-overflow.js +10 -10
- package/dist/lib/luna-reserve.d.ts +26 -0
- package/dist/lib/luna-reserve.js +68 -0
- package/dist/lib/oauth-success.html +125 -125
- package/dist/lib/policy/runtime-policy.js +14 -0
- package/dist/lib/prompts/codex-host-bridge.js +138 -138
- package/dist/lib/prompts/codex.js +79 -79
- package/dist/lib/request/helpers/model-map.d.ts +1 -1
- package/dist/lib/request/helpers/model-map.js +12 -0
- package/dist/lib/request/response-outcome.d.ts +1 -1
- package/dist/lib/request/response-outcome.js +4 -1
- package/dist/lib/runtime/account-status.js +2 -1
- package/dist/lib/runtime/luna-reserve-usage.d.ts +9 -0
- package/dist/lib/runtime/luna-reserve-usage.js +68 -0
- package/dist/lib/runtime/model-discovery-status.d.ts +6 -2
- package/dist/lib/runtime/model-discovery-status.js +13 -5
- package/dist/lib/runtime/reset-credit-routing.js +4 -1
- package/dist/lib/runtime/rotation-server-types.d.ts +2 -0
- package/dist/lib/runtime/runtime-observability.d.ts +2 -0
- package/dist/lib/runtime/runtime-observability.js +1 -0
- package/dist/lib/runtime-rotation-proxy.js +200 -32
- package/dist/lib/usage/pricing.d.ts +1 -1
- package/dist/lib/usage/pricing.js +4 -0
- package/dist/lib/usage/usage-extraction.d.ts +2 -0
- package/dist/lib/usage/usage-extraction.js +25 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/node_modules/@codex-ai/plugin/dist/index.d.ts +2 -2
- package/node_modules/@codex-ai/plugin/dist/index.js +2 -2
- package/node_modules/@codex-ai/plugin/dist/tool.d.ts +42 -42
- package/node_modules/@codex-ai/plugin/dist/tool.js +29 -29
- package/node_modules/@codex-ai/plugin/package.json +9 -9
- package/node_modules/@codex-ai/sdk/dist/index.d.ts +4 -4
- package/node_modules/@codex-ai/sdk/dist/index.js +2 -2
- package/node_modules/@codex-ai/sdk/package.json +8 -8
- package/package.json +207 -207
- package/scripts/codex-app-launcher.js +653 -653
- package/scripts/codex-app-router.js +374 -373
- package/scripts/codex-bin-resolver.js +332 -332
- package/scripts/codex-multi-auth.js +65 -65
- package/scripts/codex-routing.js +62 -62
- package/scripts/codex.js +7006 -7005
- package/scripts/install-codex-auth-utils.js +213 -213
- package/scripts/mcodex.js +367 -367
- package/scripts/postinstall.js +114 -114
- package/scripts/preuninstall.js +265 -265
- package/skills/codex-auth-setup/SKILL.md +73 -73
- package/vendor/codex-ai-plugin/dist/index.d.ts +2 -2
- package/vendor/codex-ai-plugin/dist/index.js +2 -2
- package/vendor/codex-ai-plugin/dist/tool.d.ts +42 -42
- package/vendor/codex-ai-plugin/dist/tool.js +29 -29
- package/vendor/codex-ai-plugin/package.json +9 -9
- package/vendor/codex-ai-sdk/dist/index.d.ts +4 -4
- package/vendor/codex-ai-sdk/dist/index.js +2 -2
- package/vendor/codex-ai-sdk/package.json +8 -8
package/scripts/postinstall.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// @ts-check
|
|
4
|
-
|
|
5
|
-
// Thin, CI-aware install notice (audit roadmap §4.5.4).
|
|
6
|
-
//
|
|
7
|
-
// All app detection, Codex app bind self-heal, and launcher routing that used
|
|
8
|
-
// to run here now run lazily on the first CLI invocation — see
|
|
9
|
-
// lib/runtime/first-run.ts (ensureFirstRunSetup). This script performs no
|
|
10
|
-
// detection and no filesystem mutation: it exits 0 silently in CI/non-TTY
|
|
11
|
-
// contexts and otherwise prints a short notice to stderr.
|
|
12
|
-
|
|
13
|
-
import process from "node:process";
|
|
14
|
-
import { resolve } from "node:path";
|
|
15
|
-
import { fileURLToPath } from "node:url";
|
|
16
|
-
|
|
17
|
-
const TRUE_VALUES = new Set(["1", "true", "yes"]);
|
|
18
|
-
const FALSE_VALUES = new Set(["0", "false", "no"]);
|
|
19
|
-
const CI_ENV_KEYS = [
|
|
20
|
-
"CI",
|
|
21
|
-
"GITHUB_ACTIONS",
|
|
22
|
-
"GITLAB_CI",
|
|
23
|
-
"CIRCLECI",
|
|
24
|
-
"BUILDKITE",
|
|
25
|
-
"TF_BUILD",
|
|
26
|
-
"TEAMCITY_VERSION",
|
|
27
|
-
"JENKINS_URL",
|
|
28
|
-
"TRAVIS",
|
|
29
|
-
"APPVEYOR",
|
|
30
|
-
"BITBUCKET_BUILD_NUMBER",
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
export const INSTALL_NOTICE = [
|
|
34
|
-
"codex-multi-auth installed. Run `codex-multi-auth --help` to get started.",
|
|
35
|
-
"App integration (Codex app bind + launcher shortcuts) completes automatically on first run.",
|
|
36
|
-
"To remove it later, run `codex-multi-auth uninstall`, then `npm uninstall -g codex-multi-auth`.",
|
|
37
|
-
"`@ndycode/codex-multi-auth` is the legacy scoped package name; it does not remove this package.",
|
|
38
|
-
].join("\n");
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @param {string | undefined} value
|
|
42
|
-
*/
|
|
43
|
-
export function readOptionalBoolean(value) {
|
|
44
|
-
if (value === undefined || value.trim().length === 0) return null;
|
|
45
|
-
const normalized = value.trim().toLowerCase();
|
|
46
|
-
if (TRUE_VALUES.has(normalized)) return true;
|
|
47
|
-
if (FALSE_VALUES.has(normalized)) return false;
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @param {NodeJS.ProcessEnv} env
|
|
53
|
-
* @param {string} key
|
|
54
|
-
*/
|
|
55
|
-
function isEnabledEnvFlag(env, key) {
|
|
56
|
-
const value = env[key];
|
|
57
|
-
if (value === undefined || value.trim().length === 0) return false;
|
|
58
|
-
const parsed = readOptionalBoolean(value);
|
|
59
|
-
return parsed !== false;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @param {NodeJS.ProcessEnv} [env]
|
|
64
|
-
*/
|
|
65
|
-
export function isCiEnvironment(env = process.env) {
|
|
66
|
-
if (readOptionalBoolean(env.npm_config_ignore_scripts) === true) return true;
|
|
67
|
-
return CI_ENV_KEYS.some((key) => isEnabledEnvFlag(env, key));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @param {NodeJS.ProcessEnv} [env]
|
|
72
|
-
* @param {boolean} [isTty]
|
|
73
|
-
*/
|
|
74
|
-
export function shouldPrintInstallNotice(
|
|
75
|
-
env = process.env,
|
|
76
|
-
isTty = process.stderr.isTTY === true,
|
|
77
|
-
) {
|
|
78
|
-
if (isCiEnvironment(env)) return false;
|
|
79
|
-
return isTty === true;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @param {{
|
|
84
|
-
* env?: NodeJS.ProcessEnv,
|
|
85
|
-
* isTty?: boolean,
|
|
86
|
-
* log?: (message: string) => void,
|
|
87
|
-
* }} [options]
|
|
88
|
-
* @returns {number} always 0 — an install notice must never fail an install
|
|
89
|
-
*/
|
|
90
|
-
export function runPostinstall(options = {}) {
|
|
91
|
-
try {
|
|
92
|
-
const env = options.env ?? process.env;
|
|
93
|
-
const isTty = options.isTty ?? process.stderr.isTTY === true;
|
|
94
|
-
if (shouldPrintInstallNotice(env, isTty)) {
|
|
95
|
-
const log = options.log ?? ((message) => console.error(message));
|
|
96
|
-
log(INSTALL_NOTICE);
|
|
97
|
-
}
|
|
98
|
-
} catch {
|
|
99
|
-
// Best-effort notice only.
|
|
100
|
-
}
|
|
101
|
-
return 0;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const isDirectRun = (() => {
|
|
105
|
-
try {
|
|
106
|
-
return resolve(process.argv[1] ?? "") === fileURLToPath(import.meta.url);
|
|
107
|
-
} catch {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
})();
|
|
111
|
-
|
|
112
|
-
if (isDirectRun) {
|
|
113
|
-
process.exitCode = runPostinstall();
|
|
114
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// @ts-check
|
|
4
|
+
|
|
5
|
+
// Thin, CI-aware install notice (audit roadmap §4.5.4).
|
|
6
|
+
//
|
|
7
|
+
// All app detection, Codex app bind self-heal, and launcher routing that used
|
|
8
|
+
// to run here now run lazily on the first CLI invocation — see
|
|
9
|
+
// lib/runtime/first-run.ts (ensureFirstRunSetup). This script performs no
|
|
10
|
+
// detection and no filesystem mutation: it exits 0 silently in CI/non-TTY
|
|
11
|
+
// contexts and otherwise prints a short notice to stderr.
|
|
12
|
+
|
|
13
|
+
import process from "node:process";
|
|
14
|
+
import { resolve } from "node:path";
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
16
|
+
|
|
17
|
+
const TRUE_VALUES = new Set(["1", "true", "yes"]);
|
|
18
|
+
const FALSE_VALUES = new Set(["0", "false", "no"]);
|
|
19
|
+
const CI_ENV_KEYS = [
|
|
20
|
+
"CI",
|
|
21
|
+
"GITHUB_ACTIONS",
|
|
22
|
+
"GITLAB_CI",
|
|
23
|
+
"CIRCLECI",
|
|
24
|
+
"BUILDKITE",
|
|
25
|
+
"TF_BUILD",
|
|
26
|
+
"TEAMCITY_VERSION",
|
|
27
|
+
"JENKINS_URL",
|
|
28
|
+
"TRAVIS",
|
|
29
|
+
"APPVEYOR",
|
|
30
|
+
"BITBUCKET_BUILD_NUMBER",
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export const INSTALL_NOTICE = [
|
|
34
|
+
"codex-multi-auth installed. Run `codex-multi-auth --help` to get started.",
|
|
35
|
+
"App integration (Codex app bind + launcher shortcuts) completes automatically on first run.",
|
|
36
|
+
"To remove it later, run `codex-multi-auth uninstall`, then `npm uninstall -g codex-multi-auth`.",
|
|
37
|
+
"`@ndycode/codex-multi-auth` is the legacy scoped package name; it does not remove this package.",
|
|
38
|
+
].join("\n");
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {string | undefined} value
|
|
42
|
+
*/
|
|
43
|
+
export function readOptionalBoolean(value) {
|
|
44
|
+
if (value === undefined || value.trim().length === 0) return null;
|
|
45
|
+
const normalized = value.trim().toLowerCase();
|
|
46
|
+
if (TRUE_VALUES.has(normalized)) return true;
|
|
47
|
+
if (FALSE_VALUES.has(normalized)) return false;
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {NodeJS.ProcessEnv} env
|
|
53
|
+
* @param {string} key
|
|
54
|
+
*/
|
|
55
|
+
function isEnabledEnvFlag(env, key) {
|
|
56
|
+
const value = env[key];
|
|
57
|
+
if (value === undefined || value.trim().length === 0) return false;
|
|
58
|
+
const parsed = readOptionalBoolean(value);
|
|
59
|
+
return parsed !== false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
64
|
+
*/
|
|
65
|
+
export function isCiEnvironment(env = process.env) {
|
|
66
|
+
if (readOptionalBoolean(env.npm_config_ignore_scripts) === true) return true;
|
|
67
|
+
return CI_ENV_KEYS.some((key) => isEnabledEnvFlag(env, key));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {NodeJS.ProcessEnv} [env]
|
|
72
|
+
* @param {boolean} [isTty]
|
|
73
|
+
*/
|
|
74
|
+
export function shouldPrintInstallNotice(
|
|
75
|
+
env = process.env,
|
|
76
|
+
isTty = process.stderr.isTTY === true,
|
|
77
|
+
) {
|
|
78
|
+
if (isCiEnvironment(env)) return false;
|
|
79
|
+
return isTty === true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @param {{
|
|
84
|
+
* env?: NodeJS.ProcessEnv,
|
|
85
|
+
* isTty?: boolean,
|
|
86
|
+
* log?: (message: string) => void,
|
|
87
|
+
* }} [options]
|
|
88
|
+
* @returns {number} always 0 — an install notice must never fail an install
|
|
89
|
+
*/
|
|
90
|
+
export function runPostinstall(options = {}) {
|
|
91
|
+
try {
|
|
92
|
+
const env = options.env ?? process.env;
|
|
93
|
+
const isTty = options.isTty ?? process.stderr.isTTY === true;
|
|
94
|
+
if (shouldPrintInstallNotice(env, isTty)) {
|
|
95
|
+
const log = options.log ?? ((message) => console.error(message));
|
|
96
|
+
log(INSTALL_NOTICE);
|
|
97
|
+
}
|
|
98
|
+
} catch {
|
|
99
|
+
// Best-effort notice only.
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const isDirectRun = (() => {
|
|
105
|
+
try {
|
|
106
|
+
return resolve(process.argv[1] ?? "") === fileURLToPath(import.meta.url);
|
|
107
|
+
} catch {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
})();
|
|
111
|
+
|
|
112
|
+
if (isDirectRun) {
|
|
113
|
+
process.exitCode = runPostinstall();
|
|
114
|
+
}
|