@numa-tech/numa 1.11.13 → 1.12.1

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 (102) hide show
  1. package/README.md +197 -25
  2. package/dist/ai-registry/client.d.ts +65 -0
  3. package/dist/ai-registry/client.js +260 -0
  4. package/dist/ai-registry/client.js.map +1 -0
  5. package/dist/ai-registry/commands.d.ts +2 -0
  6. package/dist/ai-registry/commands.js +438 -0
  7. package/dist/ai-registry/commands.js.map +1 -0
  8. package/dist/ai-registry/errors.d.ts +8 -0
  9. package/dist/ai-registry/errors.js +40 -0
  10. package/dist/ai-registry/errors.js.map +1 -0
  11. package/dist/ai-registry/mcp-installer.d.ts +37 -0
  12. package/dist/ai-registry/mcp-installer.js +273 -0
  13. package/dist/ai-registry/mcp-installer.js.map +1 -0
  14. package/dist/ai-registry/schemas.d.ts +86 -0
  15. package/dist/ai-registry/schemas.js +39 -0
  16. package/dist/ai-registry/schemas.js.map +1 -0
  17. package/dist/ai-registry/skill-installer.d.ts +21 -0
  18. package/dist/ai-registry/skill-installer.js +262 -0
  19. package/dist/ai-registry/skill-installer.js.map +1 -0
  20. package/dist/app-config.d.ts +4 -2
  21. package/dist/app-config.js +15 -3
  22. package/dist/app-config.js.map +1 -1
  23. package/dist/cli.js +40 -12
  24. package/dist/cli.js.map +1 -1
  25. package/dist/codex-module.d.ts +8 -0
  26. package/dist/codex-module.js +152 -0
  27. package/dist/codex-module.js.map +1 -0
  28. package/dist/command-catalog.js +170 -64
  29. package/dist/command-catalog.js.map +1 -1
  30. package/dist/config-page.js +17 -0
  31. package/dist/config-page.js.map +1 -1
  32. package/dist/config.d.ts +4 -1
  33. package/dist/config.js +26 -7
  34. package/dist/config.js.map +1 -1
  35. package/dist/media/commands.js +12 -11
  36. package/dist/media/commands.js.map +1 -1
  37. package/dist/oauth.d.ts +2 -30
  38. package/dist/oauth.js +1 -294
  39. package/dist/oauth.js.map +1 -1
  40. package/dist/pipeline/client.d.ts +126 -0
  41. package/dist/pipeline/client.js +105 -0
  42. package/dist/pipeline/client.js.map +1 -0
  43. package/dist/pipeline/commands.d.ts +17 -0
  44. package/dist/pipeline/commands.js +283 -0
  45. package/dist/pipeline/commands.js.map +1 -0
  46. package/dist/pipeline/errors.d.ts +8 -0
  47. package/dist/pipeline/errors.js +37 -0
  48. package/dist/pipeline/errors.js.map +1 -0
  49. package/dist/pipeline/schemas.d.ts +243 -0
  50. package/dist/pipeline/schemas.js +60 -0
  51. package/dist/pipeline/schemas.js.map +1 -0
  52. package/dist/platform-profile.d.ts +75 -0
  53. package/dist/platform-profile.js +169 -0
  54. package/dist/platform-profile.js.map +1 -0
  55. package/dist/types.d.ts +1 -40
  56. package/dist/web-console-page.d.ts +2 -2
  57. package/dist/web-console-page.js +21 -7
  58. package/dist/web-console-page.js.map +1 -1
  59. package/dist/web-console.d.ts +17 -3
  60. package/dist/web-console.js +70 -5
  61. package/dist/web-console.js.map +1 -1
  62. package/examples/claude-desktop-npx.json +1 -1
  63. package/examples/codex-npx.json +1 -1
  64. package/package.json +30 -14
  65. package/skills/numa-ai-registry/SKILL.md +47 -0
  66. package/skills/numa-ai-registry/evals/evals.json +35 -0
  67. package/skills/numa-ai-registry/references/command-contract.md +53 -0
  68. package/assets/codex-shortcut-icon.icns +0 -0
  69. package/assets/codex-shortcut-icon.ico +0 -0
  70. package/dist/chatgpt-console.d.ts +0 -53
  71. package/dist/chatgpt-console.js +0 -105
  72. package/dist/chatgpt-console.js.map +0 -1
  73. package/dist/codex-auth-agent.d.ts +0 -60
  74. package/dist/codex-auth-agent.js +0 -331
  75. package/dist/codex-auth-agent.js.map +0 -1
  76. package/dist/codex-commands.d.ts +0 -13
  77. package/dist/codex-commands.js +0 -571
  78. package/dist/codex-commands.js.map +0 -1
  79. package/dist/codex-legacy-cleanup.d.ts +0 -5
  80. package/dist/codex-legacy-cleanup.js +0 -77
  81. package/dist/codex-legacy-cleanup.js.map +0 -1
  82. package/dist/codex-process.d.ts +0 -13
  83. package/dist/codex-process.js +0 -193
  84. package/dist/codex-process.js.map +0 -1
  85. package/dist/codex-protocol.d.ts +0 -352
  86. package/dist/codex-protocol.js +0 -116
  87. package/dist/codex-protocol.js.map +0 -1
  88. package/dist/codex-quota-cache.d.ts +0 -20
  89. package/dist/codex-quota-cache.js +0 -82
  90. package/dist/codex-quota-cache.js.map +0 -1
  91. package/dist/codex-selection.d.ts +0 -18
  92. package/dist/codex-selection.js +0 -47
  93. package/dist/codex-selection.js.map +0 -1
  94. package/dist/codex-service-client.d.ts +0 -11
  95. package/dist/codex-service-client.js +0 -91
  96. package/dist/codex-service-client.js.map +0 -1
  97. package/dist/codex-shortcuts.d.ts +0 -43
  98. package/dist/codex-shortcuts.js +0 -429
  99. package/dist/codex-shortcuts.js.map +0 -1
  100. package/dist/codex-tui.d.ts +0 -15
  101. package/dist/codex-tui.js +0 -235
  102. package/dist/codex-tui.js.map +0 -1
@@ -1,77 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { getCodexCliConfigPath } from "codex-multi-auth/cli";
3
- import { writePrivateText } from "./private-file.js";
4
- // These identifiers intentionally retain the former product name so Numa can
5
- // remove configuration written by releases that predate the rename.
6
- const LEGACY_PROVIDER_ID = "mcex-codex";
7
- const PROVIDER_START = "# >>> mcex codex provider (managed; do not edit)";
8
- const PROVIDER_END = "# <<< mcex codex provider";
9
- const APP_BIND_START = "# >>> mcex codex app provider (managed; do not edit)";
10
- const APP_BIND_END = "# <<< mcex codex app provider";
11
- const TOML_TABLE_HEADER = /^\s*\[{1,2}\s*[^\]]+?\s*\]{1,2}\s*(?:#.*)?$/;
12
- async function readConfig(path) {
13
- try {
14
- return await readFile(path, "utf8");
15
- }
16
- catch (error) {
17
- if (error.code === "ENOENT")
18
- return "";
19
- throw error;
20
- }
21
- }
22
- function blockPattern(start, end) {
23
- const escape = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24
- return new RegExp(`${escape(start)}[\\s\\S]*?${escape(end)}\\r?\\n?`, "g");
25
- }
26
- function splitToml(raw) {
27
- const lineEnding = raw.includes("\r\n") ? "\r\n" : "\n";
28
- const lines = raw.length > 0 ? raw.split(/\r?\n/) : [];
29
- if (lines.at(-1) === "")
30
- lines.pop();
31
- return { lines, lineEnding };
32
- }
33
- function topLevelEnd(lines) {
34
- const firstTable = lines.findIndex((line) => TOML_TABLE_HEADER.test(line));
35
- return firstTable < 0 ? lines.length : firstTable;
36
- }
37
- function previousProviderFromAppBlock(block) {
38
- if (!/# previous_model_provider_present = true/.test(block))
39
- return undefined;
40
- const encoded = /# previous_model_provider_base64 = ([A-Za-z0-9+/=]*)/.exec(block)?.[1] ?? "";
41
- const decoded = Buffer.from(encoded, "base64").toString("utf8");
42
- return decoded && !decoded.includes(LEGACY_PROVIDER_ID) ? decoded : undefined;
43
- }
44
- export async function cleanupLegacyCodexProvider(configPath = getCodexCliConfigPath()) {
45
- const current = await readConfig(configPath);
46
- if (!current)
47
- return { changed: false, configPath };
48
- const appPattern = blockPattern(APP_BIND_START, APP_BIND_END);
49
- const appMatch = appPattern.exec(current);
50
- const previousProvider = appMatch
51
- ? previousProviderFromAppBlock(appMatch[0])
52
- : undefined;
53
- let next = current
54
- .replace(blockPattern(APP_BIND_START, APP_BIND_END), "")
55
- .replace(blockPattern(PROVIDER_START, PROVIDER_END), "");
56
- const parsed = splitToml(next);
57
- const topEnd = topLevelEnd(parsed.lines);
58
- const staleIndexes = [];
59
- for (let index = 0; index < topEnd; index += 1) {
60
- if (/^\s*model_provider\s*=\s*["']mcex-codex["']\s*(?:#.*)?$/.test(parsed.lines[index] ?? "")) {
61
- staleIndexes.push(index);
62
- }
63
- }
64
- for (const index of staleIndexes.reverse())
65
- parsed.lines.splice(index, 1);
66
- if (previousProvider &&
67
- !parsed.lines.slice(0, topLevelEnd(parsed.lines)).some((line) => /^\s*model_provider\s*=/.test(line))) {
68
- parsed.lines.splice(topLevelEnd(parsed.lines), 0, previousProvider);
69
- }
70
- next = parsed.lines.join(parsed.lineEnding).trimEnd();
71
- next = next ? `${next}${parsed.lineEnding}` : "";
72
- const changed = next !== current;
73
- if (changed)
74
- await writePrivateText(configPath, next);
75
- return { changed, configPath };
76
- }
77
- //# sourceMappingURL=codex-legacy-cleanup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codex-legacy-cleanup.js","sourceRoot":"","sources":["../src/codex-legacy-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,6EAA6E;AAC7E,oEAAoE;AACpE,MAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,MAAM,cAAc,GAAG,kDAAkD,CAAC;AAC1E,MAAM,YAAY,GAAG,2BAA2B,CAAC;AACjD,MAAM,cAAc,GAAG,sDAAsD,CAAC;AAC9E,MAAM,YAAY,GAAG,+BAA+B,CAAC;AACrD,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;AAExE,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,CAAC;QAClE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAa,EAAE,GAAW;IAC9C,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE,CACvC,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,C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AK,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAC9D,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CACpC,EACD,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACtE,CAAC;IAED,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;IACtD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC;IACjC,IAAI,OAAO;QAAE,MAAM,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACtD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACjC,CAAC"}
@@ -1,13 +0,0 @@
1
- export interface CodexLaunch {
2
- command: string;
3
- args: string[];
4
- source: "override" | "path" | "bundled";
5
- }
6
- export declare class CodexRuntimeError extends Error {
7
- readonly code = "codex_runtime_missing";
8
- constructor(message: string);
9
- }
10
- export declare function resolveDirectCodexLaunch(codexArgs: string[], env?: NodeJS.ProcessEnv): Promise<CodexLaunch>;
11
- export declare function resolveCodexLaunch(codexArgs: string[], env?: NodeJS.ProcessEnv): Promise<CodexLaunch>;
12
- export declare function ensureCodexRuntime(env?: NodeJS.ProcessEnv): Promise<void>;
13
- export declare function runOfficialCodex(codexArgs: string[]): Promise<number>;
@@ -1,193 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { constants } from "node:fs";
3
- import { access, realpath } from "node:fs/promises";
4
- import { createRequire } from "node:module";
5
- import { delimiter, dirname, join } from "node:path";
6
- const require = createRequire(import.meta.url);
7
- const PROBE_TIMEOUT_MS = 5_000;
8
- const MAX_PROBE_OUTPUT = 4_096;
9
- export class CodexRuntimeError extends Error {
10
- code = "codex_runtime_missing";
11
- constructor(message) {
12
- super(message);
13
- this.name = "CodexRuntimeError";
14
- }
15
- }
16
- function bundledCodexLaunch() {
17
- return {
18
- command: process.execPath,
19
- args: [require.resolve("@openai/codex/bin/codex.js")],
20
- source: "bundled"
21
- };
22
- }
23
- function enabled(value) {
24
- return ["1", "true", "yes", "on"].includes(value?.trim().toLowerCase() ?? "");
25
- }
26
- function appendOutput(current, chunk) {
27
- if (current.length >= MAX_PROBE_OUTPUT)
28
- return current;
29
- return (current + chunk).slice(0, MAX_PROBE_OUTPUT);
30
- }
31
- function diagnosticText(stdout, stderr) {
32
- const value = (stderr.trim() || stdout.trim()).replace(/\s+/g, " ");
33
- if (!value)
34
- return undefined;
35
- return value.length > 800 ? `${value.slice(0, 797)}...` : value;
36
- }
37
- async function probeCodexLaunch(launch, env) {
38
- const child = spawn(launch.command, [...launch.args, "--version"], {
39
- env,
40
- stdio: ["ignore", "pipe", "pipe"],
41
- windowsHide: true
42
- });
43
- let stdout = "";
44
- let stderr = "";
45
- child.stdout.setEncoding("utf8").on("data", (chunk) => {
46
- stdout = appendOutput(stdout, chunk);
47
- });
48
- child.stderr.setEncoding("utf8").on("data", (chunk) => {
49
- stderr = appendOutput(stderr, chunk);
50
- });
51
- return new Promise((resolve) => {
52
- let settled = false;
53
- const finish = (result) => {
54
- if (settled)
55
- return;
56
- settled = true;
57
- clearTimeout(timer);
58
- resolve(result);
59
- };
60
- const timer = setTimeout(() => {
61
- child.kill();
62
- finish({ ok: false, detail: `执行 codex --version 超过 ${PROBE_TIMEOUT_MS / 1000} 秒` });
63
- }, PROBE_TIMEOUT_MS);
64
- child.once("error", (error) => {
65
- finish({ ok: false, detail: error.message });
66
- });
67
- child.once("exit", (code, signal) => {
68
- const output = diagnosticText(stdout, stderr);
69
- const detail = output ?? (signal ? `被信号 ${signal} 终止` : `退出码=${code ?? 1}`);
70
- finish({
71
- ok: !signal && code === 0,
72
- ...(code === 0 && !signal && !output ? {} : { detail })
73
- });
74
- });
75
- });
76
- }
77
- async function canonicalPath(path) {
78
- try {
79
- return await realpath(path);
80
- }
81
- catch {
82
- return path;
83
- }
84
- }
85
- async function isExecutable(path) {
86
- try {
87
- await access(path, process.platform === "win32" ? constants.F_OK : constants.X_OK);
88
- return true;
89
- }
90
- catch {
91
- return false;
92
- }
93
- }
94
- async function pathCodexCandidates(env, bundledScript) {
95
- const directories = (env.PATH ?? env.Path ?? env.path ?? "")
96
- .split(delimiter)
97
- .map((value) => value.trim())
98
- .filter(Boolean);
99
- const bundledCanonical = bundledScript
100
- ? await canonicalPath(bundledScript)
101
- : undefined;
102
- const seen = new Set();
103
- const candidates = [];
104
- for (const directory of directories) {
105
- const paths = process.platform === "win32"
106
- ? [
107
- join(directory, "codex.exe"),
108
- join(directory, "node_modules", "@openai", "codex", "bin", "codex.js"),
109
- join(dirname(directory), "@openai", "codex", "bin", "codex.js")
110
- ]
111
- : [join(directory, "codex")];
112
- for (const path of paths) {
113
- if (!(await isExecutable(path)))
114
- continue;
115
- const canonical = await canonicalPath(path);
116
- if ((bundledCanonical && canonical === bundledCanonical) || seen.has(canonical))
117
- continue;
118
- seen.add(canonical);
119
- candidates.push(path.endsWith("codex.js")
120
- ? { command: process.execPath, args: [path], source: "path" }
121
- : { command: path, args: [], source: "path" });
122
- }
123
- }
124
- return candidates;
125
- }
126
- function runtimeError(diagnostics) {
127
- const detail = diagnostics.filter(Boolean).join(";");
128
- return new CodexRuntimeError(`无法启动官方 Codex CLI${detail ? `:${detail}` : ""}。` +
129
- "请运行 npm install -g @openai/codex@latest,或通过 NUMA_CODEX_BIN 指定可用路径。");
130
- }
131
- export async function resolveDirectCodexLaunch(codexArgs, env = process.env) {
132
- const override = env.NUMA_CODEX_BIN?.trim();
133
- if (override) {
134
- const launch = { command: override, args: [], source: "override" };
135
- const probe = await probeCodexLaunch(launch, env);
136
- if (!probe.ok) {
137
- throw runtimeError([`NUMA_CODEX_BIN=${override} 不可用${probe.detail ? ` (${probe.detail})` : ""}`]);
138
- }
139
- return { ...launch, args: codexArgs };
140
- }
141
- let bundled;
142
- let bundledResolutionError;
143
- try {
144
- bundled = bundledCodexLaunch();
145
- }
146
- catch (error) {
147
- bundledResolutionError =
148
- `包内 Codex 入口缺失 (${error instanceof Error ? error.message : String(error)})`;
149
- }
150
- const diagnostics = [];
151
- if (!enabled(env.NUMA_USE_BUNDLED_CODEX)) {
152
- const candidates = await pathCodexCandidates(env, bundled?.args[0]);
153
- for (const candidate of candidates) {
154
- const probe = await probeCodexLaunch(candidate, env);
155
- if (probe.ok)
156
- return { ...candidate, args: [...candidate.args, ...codexArgs] };
157
- diagnostics.push(`PATH 中的 Codex ${candidate.command} 不可用${probe.detail ? ` (${probe.detail})` : ""}`);
158
- }
159
- }
160
- if (bundled) {
161
- const bundledProbe = await probeCodexLaunch(bundled, env);
162
- if (bundledProbe.ok)
163
- return { ...bundled, args: [...bundled.args, ...codexArgs] };
164
- diagnostics.push(`包内 Codex 不可用${bundledProbe.detail ? ` (${bundledProbe.detail})` : ""}`);
165
- }
166
- else if (bundledResolutionError) {
167
- diagnostics.push(bundledResolutionError);
168
- }
169
- throw runtimeError(diagnostics);
170
- }
171
- export async function resolveCodexLaunch(codexArgs, env = process.env) {
172
- return resolveDirectCodexLaunch(codexArgs, env);
173
- }
174
- export async function ensureCodexRuntime(env = process.env) {
175
- await resolveCodexLaunch([], env);
176
- }
177
- export async function runOfficialCodex(codexArgs) {
178
- const launch = await resolveCodexLaunch(codexArgs);
179
- const child = spawn(launch.command, launch.args, {
180
- stdio: "inherit",
181
- env: process.env
182
- });
183
- return new Promise((resolve, reject) => {
184
- child.once("error", (error) => {
185
- reject(new CodexRuntimeError(`无法启动官方 Codex CLI (${launch.command}): ${error.message}。` +
186
- "可通过 NUMA_CODEX_BIN 覆盖路径。"));
187
- });
188
- child.once("exit", (code, signal) => {
189
- resolve(signal ? 128 : (code ?? 1));
190
- });
191
- });
192
- }
193
- //# sourceMappingURL=codex-process.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codex-process.js","sourceRoot":"","sources":["../src/codex-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAa/B,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,GAAG,uBAAuB,CAAC;IAExC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,SAAS,kBAAkB;IACzB,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,QAAQ;QACzB,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;QACrD,MAAM,EAAE,SAAS;KAClB,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAyB;IACxC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,YAAY,CAAC,OAAe,EAAE,KAAa;IA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tC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAEpC,MAAM,kBAAkB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAmB;IACxD,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE;QAC/C,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;IACH,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7C,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,MAAM,CACJ,IAAI,iBAAiB,CACnB,qBAAqB,MAAM,CAAC,OAAO,MAAM,KAAK,CAAC,OAAO,GAAG;gBACzD,0BAA0B,CAC3B,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YAClC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,352 +0,0 @@
1
- import { z } from "zod";
2
- export declare const CODEX_DISTRIBUTION_SCHEMA_VERSION: 1;
3
- export declare const CODEX_ACCOUNTS_PATH = "/v1/codex/accounts";
4
- export declare const CODEX_ACCOUNTS_LIST_PATH = "/v1/codex/accounts";
5
- export interface CodexQuotaWindowLike {
6
- usedPercent?: number | null;
7
- windowMinutes?: number | null;
8
- resetAt?: number | string | null;
9
- }
10
- export declare function codexQuotaWindowHasData(window: CodexQuotaWindowLike | null | undefined): boolean;
11
- export declare const CodexQuotaWindowViewSchema: z.ZodPipe<z.ZodObject<{
12
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
13
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
14
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
15
- }, z.core.$strip>, z.ZodTransform<{
16
- usedPercent?: number | null | undefined;
17
- windowMinutes?: number | null | undefined;
18
- resetAt?: string | number | null | undefined;
19
- } | null, {
20
- usedPercent?: number | null | undefined;
21
- windowMinutes?: number | null | undefined;
22
- resetAt?: string | number | null | undefined;
23
- }>>;
24
- export declare const CodexQuotaSnapshotViewSchema: z.ZodObject<{
25
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
26
- status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
27
- model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
- planType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
- activeLimit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
30
- primary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
31
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
32
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
33
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
34
- }, z.core.$strip>, z.ZodTransform<{
35
- usedPercent?: number | null | undefined;
36
- windowMinutes?: number | null | undefined;
37
- resetAt?: string | number | null | undefined;
38
- } | null, {
39
- usedPercent?: number | null | undefined;
40
- windowMinutes?: number | null | undefined;
41
- resetAt?: string | number | null | undefined;
42
- }>>>>;
43
- secondary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
44
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
45
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
46
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
47
- }, z.core.$strip>, z.ZodTransform<{
48
- usedPercent?: number | null | undefined;
49
- windowMinutes?: number | null | undefined;
50
- resetAt?: string | number | null | undefined;
51
- } | null, {
52
- usedPercent?: number | null | undefined;
53
- windowMinutes?: number | null | undefined;
54
- resetAt?: string | number | null | undefined;
55
- }>>>>;
56
- }, z.core.$strip>;
57
- export declare const CodexAccountSummarySchema: z.ZodObject<{
58
- id: z.ZodString;
59
- accountId: z.ZodString;
60
- label: z.ZodString;
61
- isDefault: z.ZodBoolean;
62
- accessExpiresAt: z.ZodOptional<z.ZodNumber>;
63
- credentialStatus: z.ZodOptional<z.ZodEnum<{
64
- AVAILABLE: "AVAILABLE";
65
- NEEDS_REAUTH: "NEEDS_REAUTH";
66
- TEMPORARILY_UNAVAILABLE: "TEMPORARILY_UNAVAILABLE";
67
- }>>;
68
- quota: z.ZodOptional<z.ZodNullable<z.ZodObject<{
69
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
70
- status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
71
- model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
- planType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
- activeLimit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
74
- primary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
75
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
76
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
77
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
78
- }, z.core.$strip>, z.ZodTransform<{
79
- usedPercent?: number | null | undefined;
80
- windowMinutes?: number | null | undefined;
81
- resetAt?: string | number | null | undefined;
82
- } | null, {
83
- usedPercent?: number | null | undefined;
84
- windowMinutes?: number | null | undefined;
85
- resetAt?: string | number | null | undefined;
86
- }>>>>;
87
- secondary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
88
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
89
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
90
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
91
- }, z.core.$strip>, z.ZodTransform<{
92
- usedPercent?: number | null | undefined;
93
- windowMinutes?: number | null | undefined;
94
- resetAt?: string | number | null | undefined;
95
- } | null, {
96
- usedPercent?: number | null | undefined;
97
- windowMinutes?: number | null | undefined;
98
- resetAt?: string | number | null | undefined;
99
- }>>>>;
100
- }, z.core.$strip>>>;
101
- }, z.core.$strip>;
102
- export declare const CodexAccountListResponseSchema: z.ZodObject<{
103
- schemaVersion: z.ZodLiteral<1>;
104
- accounts: z.ZodArray<z.ZodObject<{
105
- id: z.ZodString;
106
- accountId: z.ZodString;
107
- label: z.ZodString;
108
- isDefault: z.ZodBoolean;
109
- accessExpiresAt: z.ZodOptional<z.ZodNumber>;
110
- credentialStatus: z.ZodOptional<z.ZodEnum<{
111
- AVAILABLE: "AVAILABLE";
112
- NEEDS_REAUTH: "NEEDS_REAUTH";
113
- TEMPORARILY_UNAVAILABLE: "TEMPORARILY_UNAVAILABLE";
114
- }>>;
115
- quota: z.ZodOptional<z.ZodNullable<z.ZodObject<{
116
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
117
- status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
118
- model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
- planType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
120
- activeLimit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
121
- primary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
122
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
123
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
124
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
125
- }, z.core.$strip>, z.ZodTransform<{
126
- usedPercent?: number | null | undefined;
127
- windowMinutes?: number | null | undefined;
128
- resetAt?: string | number | null | undefined;
129
- } | null, {
130
- usedPercent?: number | null | undefined;
131
- windowMinutes?: number | null | undefined;
132
- resetAt?: string | number | null | undefined;
133
- }>>>>;
134
- secondary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
135
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
136
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
137
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
138
- }, z.core.$strip>, z.ZodTransform<{
139
- usedPercent?: number | null | undefined;
140
- windowMinutes?: number | null | undefined;
141
- resetAt?: string | number | null | undefined;
142
- } | null, {
143
- usedPercent?: number | null | undefined;
144
- windowMinutes?: number | null | undefined;
145
- resetAt?: string | number | null | undefined;
146
- }>>>>;
147
- }, z.core.$strip>>>;
148
- }, z.core.$strip>>;
149
- defaultAccountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
150
- }, z.core.$strip>;
151
- export declare const CodexAdminAccountSummarySchema: z.ZodObject<{
152
- publicId: z.ZodString;
153
- accountId: z.ZodString;
154
- label: z.ZodString;
155
- accessExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
156
- quota: z.ZodOptional<z.ZodNullable<z.ZodObject<{
157
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
158
- status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
159
- model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
160
- planType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
161
- activeLimit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
162
- primary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
163
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
164
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
165
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
166
- }, z.core.$strip>, z.ZodTransform<{
167
- usedPercent?: number | null | undefined;
168
- windowMinutes?: number | null | undefined;
169
- resetAt?: string | number | null | undefined;
170
- } | null, {
171
- usedPercent?: number | null | undefined;
172
- windowMinutes?: number | null | undefined;
173
- resetAt?: string | number | null | undefined;
174
- }>>>>;
175
- secondary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
176
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
177
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
178
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
179
- }, z.core.$strip>, z.ZodTransform<{
180
- usedPercent?: number | null | undefined;
181
- windowMinutes?: number | null | undefined;
182
- resetAt?: string | number | null | undefined;
183
- } | null, {
184
- usedPercent?: number | null | undefined;
185
- windowMinutes?: number | null | undefined;
186
- resetAt?: string | number | null | undefined;
187
- }>>>>;
188
- }, z.core.$strip>>>;
189
- }, z.core.$strip>;
190
- export declare const CodexAdminAccountListResponseSchema: z.ZodArray<z.ZodObject<{
191
- publicId: z.ZodString;
192
- accountId: z.ZodString;
193
- label: z.ZodString;
194
- accessExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
- quota: z.ZodOptional<z.ZodNullable<z.ZodObject<{
196
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
197
- status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
198
- model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
- planType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
200
- activeLimit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
201
- primary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
202
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
203
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
204
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
205
- }, z.core.$strip>, z.ZodTransform<{
206
- usedPercent?: number | null | undefined;
207
- windowMinutes?: number | null | undefined;
208
- resetAt?: string | number | null | undefined;
209
- } | null, {
210
- usedPercent?: number | null | undefined;
211
- windowMinutes?: number | null | undefined;
212
- resetAt?: string | number | null | undefined;
213
- }>>>>;
214
- secondary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
215
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
216
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
217
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
218
- }, z.core.$strip>, z.ZodTransform<{
219
- usedPercent?: number | null | undefined;
220
- windowMinutes?: number | null | undefined;
221
- resetAt?: string | number | null | undefined;
222
- } | null, {
223
- usedPercent?: number | null | undefined;
224
- windowMinutes?: number | null | undefined;
225
- resetAt?: string | number | null | undefined;
226
- }>>>>;
227
- }, z.core.$strip>>>;
228
- }, z.core.$strip>>;
229
- export declare const CodexLoginCredentialsResponseSchema: z.ZodObject<{
230
- schemaVersion: z.ZodLiteral<1>;
231
- account: z.ZodObject<{
232
- id: z.ZodString;
233
- accountId: z.ZodString;
234
- label: z.ZodString;
235
- isDefault: z.ZodBoolean;
236
- accessExpiresAt: z.ZodOptional<z.ZodNumber>;
237
- credentialStatus: z.ZodOptional<z.ZodEnum<{
238
- AVAILABLE: "AVAILABLE";
239
- NEEDS_REAUTH: "NEEDS_REAUTH";
240
- TEMPORARILY_UNAVAILABLE: "TEMPORARILY_UNAVAILABLE";
241
- }>>;
242
- quota: z.ZodOptional<z.ZodNullable<z.ZodObject<{
243
- updatedAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
244
- status: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
245
- model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
246
- planType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
247
- activeLimit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
248
- primary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
249
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
250
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
251
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
252
- }, z.core.$strip>, z.ZodTransform<{
253
- usedPercent?: number | null | undefined;
254
- windowMinutes?: number | null | undefined;
255
- resetAt?: string | number | null | undefined;
256
- } | null, {
257
- usedPercent?: number | null | undefined;
258
- windowMinutes?: number | null | undefined;
259
- resetAt?: string | number | null | undefined;
260
- }>>>>;
261
- secondary: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
262
- usedPercent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
263
- windowMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
264
- resetAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
265
- }, z.core.$strip>, z.ZodTransform<{
266
- usedPercent?: number | null | undefined;
267
- windowMinutes?: number | null | undefined;
268
- resetAt?: string | number | null | undefined;
269
- } | null, {
270
- usedPercent?: number | null | undefined;
271
- windowMinutes?: number | null | undefined;
272
- resetAt?: string | number | null | undefined;
273
- }>>>>;
274
- }, z.core.$strip>>>;
275
- }, z.core.$strip>;
276
- accessToken: z.ZodString;
277
- idToken: z.ZodString;
278
- expiresAt: z.ZodNumber;
279
- }, z.core.$strip>;
280
- export declare const CodexUploadAccountSchema: z.ZodObject<{
281
- sourceKey: z.ZodString;
282
- accountId: z.ZodOptional<z.ZodString>;
283
- label: z.ZodString;
284
- email: z.ZodOptional<z.ZodString>;
285
- refreshToken: z.ZodString;
286
- accessToken: z.ZodOptional<z.ZodString>;
287
- idToken: z.ZodOptional<z.ZodString>;
288
- expiresAt: z.ZodOptional<z.ZodNumber>;
289
- enabled: z.ZodBoolean;
290
- quota: z.ZodOptional<z.ZodObject<{
291
- updatedAt: z.ZodNumber;
292
- status: z.ZodNumber;
293
- model: z.ZodString;
294
- planType: z.ZodOptional<z.ZodString>;
295
- activeLimit: z.ZodOptional<z.ZodNumber>;
296
- primary: z.ZodObject<{
297
- usedPercent: z.ZodOptional<z.ZodNumber>;
298
- windowMinutes: z.ZodOptional<z.ZodNumber>;
299
- resetAt: z.ZodOptional<z.ZodNumber>;
300
- }, z.core.$strip>;
301
- secondary: z.ZodObject<{
302
- usedPercent: z.ZodOptional<z.ZodNumber>;
303
- windowMinutes: z.ZodOptional<z.ZodNumber>;
304
- resetAt: z.ZodOptional<z.ZodNumber>;
305
- }, z.core.$strip>;
306
- }, z.core.$strip>>;
307
- }, z.core.$strip>;
308
- export declare const CodexUploadBatchSchema: z.ZodObject<{
309
- source: z.ZodString;
310
- accounts: z.ZodArray<z.ZodObject<{
311
- sourceKey: z.ZodString;
312
- accountId: z.ZodOptional<z.ZodString>;
313
- label: z.ZodString;
314
- email: z.ZodOptional<z.ZodString>;
315
- refreshToken: z.ZodString;
316
- accessToken: z.ZodOptional<z.ZodString>;
317
- idToken: z.ZodOptional<z.ZodString>;
318
- expiresAt: z.ZodOptional<z.ZodNumber>;
319
- enabled: z.ZodBoolean;
320
- quota: z.ZodOptional<z.ZodObject<{
321
- updatedAt: z.ZodNumber;
322
- status: z.ZodNumber;
323
- model: z.ZodString;
324
- planType: z.ZodOptional<z.ZodString>;
325
- activeLimit: z.ZodOptional<z.ZodNumber>;
326
- primary: z.ZodObject<{
327
- usedPercent: z.ZodOptional<z.ZodNumber>;
328
- windowMinutes: z.ZodOptional<z.ZodNumber>;
329
- resetAt: z.ZodOptional<z.ZodNumber>;
330
- }, z.core.$strip>;
331
- secondary: z.ZodObject<{
332
- usedPercent: z.ZodOptional<z.ZodNumber>;
333
- windowMinutes: z.ZodOptional<z.ZodNumber>;
334
- resetAt: z.ZodOptional<z.ZodNumber>;
335
- }, z.core.$strip>;
336
- }, z.core.$strip>>;
337
- }, z.core.$strip>>;
338
- }, z.core.$strip>;
339
- export declare const CodexImportResultSchema: z.ZodObject<{
340
- created: z.ZodNumber;
341
- updated: z.ZodNumber;
342
- accountIds: z.ZodArray<z.ZodString>;
343
- }, z.core.$strip>;
344
- export type CodexAccountSummary = z.infer<typeof CodexAccountSummarySchema>;
345
- export type CodexAdminAccountSummary = z.infer<typeof CodexAdminAccountSummarySchema>;
346
- export type CodexQuotaSnapshotView = z.infer<typeof CodexQuotaSnapshotViewSchema>;
347
- export type CodexAccountListResponse = z.infer<typeof CodexAccountListResponseSchema>;
348
- export type CodexLoginCredentialsResponse = z.infer<typeof CodexLoginCredentialsResponseSchema>;
349
- export type CodexUploadBatch = z.infer<typeof CodexUploadBatchSchema>;
350
- export type CodexImportResult = z.infer<typeof CodexImportResultSchema>;
351
- export declare function codexAccountLoginCredentialsPath(accountId: string): string;
352
- export declare const CODEX_ACCOUNTS_IMPORT_PATH = "/v1/admin/codex/accounts/import";