codex-multi-auth 0.1.3 → 0.1.5
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/LICENSE +1 -1
- package/README.md +7 -10
- package/assets/readme-hero.svg +31 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -13
- package/dist/index.js.map +1 -1
- package/dist/lib/auth/auth.d.ts +6 -2
- package/dist/lib/auth/auth.d.ts.map +1 -1
- package/dist/lib/auth/auth.js +34 -11
- package/dist/lib/auth/auth.js.map +1 -1
- package/dist/lib/auth/server.d.ts +1 -1
- package/dist/lib/auth/server.js +3 -3
- package/dist/lib/codex-cli/state.d.ts +9 -0
- package/dist/lib/codex-cli/state.d.ts.map +1 -1
- package/dist/lib/codex-cli/state.js +14 -0
- package/dist/lib/codex-cli/state.js.map +1 -1
- package/dist/lib/codex-cli/writer.d.ts.map +1 -1
- package/dist/lib/codex-cli/writer.js +106 -14
- package/dist/lib/codex-cli/writer.js.map +1 -1
- package/dist/lib/codex-manager/settings-hub.d.ts +16 -1
- package/dist/lib/codex-manager/settings-hub.d.ts.map +1 -1
- package/dist/lib/codex-manager/settings-hub.js +28 -2
- package/dist/lib/codex-manager/settings-hub.js.map +1 -1
- package/dist/lib/codex-manager.d.ts +1 -0
- package/dist/lib/codex-manager.d.ts.map +1 -1
- package/dist/lib/codex-manager.js +319 -16
- package/dist/lib/codex-manager.js.map +1 -1
- package/dist/lib/context-overflow.js +10 -10
- package/dist/lib/oauth-success.html +192 -260
- package/dist/lib/parallel-probe.d.ts +7 -0
- package/dist/lib/parallel-probe.d.ts.map +1 -1
- package/dist/lib/parallel-probe.js +37 -9
- package/dist/lib/parallel-probe.js.map +1 -1
- package/dist/lib/prompts/codex.js +2 -2
- package/dist/lib/refresh-queue.d.ts +4 -5
- package/dist/lib/refresh-queue.d.ts.map +1 -1
- package/dist/lib/refresh-queue.js +99 -21
- package/dist/lib/refresh-queue.js.map +1 -1
- package/dist/lib/request/fetch-helpers.d.ts +12 -4
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
- package/dist/lib/request/fetch-helpers.js +53 -25
- package/dist/lib/request/fetch-helpers.js.map +1 -1
- package/dist/lib/request/helpers/tool-utils.d.ts.map +1 -1
- package/dist/lib/request/helpers/tool-utils.js +36 -6
- package/dist/lib/request/helpers/tool-utils.js.map +1 -1
- package/dist/lib/request/rate-limit-backoff.d.ts +7 -0
- package/dist/lib/request/rate-limit-backoff.d.ts.map +1 -1
- package/dist/lib/request/rate-limit-backoff.js +24 -4
- package/dist/lib/request/rate-limit-backoff.js.map +1 -1
- package/dist/lib/request/request-transformer.d.ts +10 -0
- package/dist/lib/request/request-transformer.d.ts.map +1 -1
- package/dist/lib/request/request-transformer.js +61 -37
- package/dist/lib/request/request-transformer.js.map +1 -1
- package/dist/lib/rotation.d.ts +19 -0
- package/dist/lib/rotation.d.ts.map +1 -1
- package/dist/lib/rotation.js +60 -39
- package/dist/lib/rotation.js.map +1 -1
- package/dist/lib/ui/copy.d.ts +1 -1
- package/dist/lib/ui/copy.js +1 -1
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +11 -0
- package/dist/lib/utils.js.map +1 -1
- package/node_modules/@codex-ai/plugin/dist/index.d.ts +1 -1
- package/node_modules/@codex-ai/plugin/dist/tool.d.ts +41 -41
- package/node_modules/@codex-ai/plugin/dist/tool.js +28 -28
- package/package.json +9 -5
- package/scripts/audit-dev-allowlist.js +186 -94
- package/scripts/bench-format/hashline-v2.mjs +642 -642
- package/scripts/bench-format/render.mjs +496 -496
- package/scripts/bench-format/stats.mjs +54 -54
- package/scripts/bench-format/tasks.mjs +151 -151
- package/scripts/benchmark-render-dashboard.mjs +49 -49
- package/scripts/benchmark-runtime-path.mjs +166 -0
- package/scripts/codex-multi-auth.js +1 -1
- package/scripts/codex.js +86 -26
- package/scripts/copy-oauth-success.js +42 -3
- package/scripts/install-codex-auth-utils.js +69 -0
- package/scripts/install-codex-auth.js +23 -14
- package/scripts/test-all-models.sh +7 -7
- package/scripts/test-model-matrix.js +108 -80
- package/scripts/validate-model-map.sh +7 -7
- package/vendor/codex-ai-plugin/dist/index.d.ts +1 -1
- package/vendor/codex-ai-plugin/dist/tool.d.ts +41 -41
- package/vendor/codex-ai-plugin/dist/tool.js +28 -28
- package/vendor/codex-ai-sdk/dist/index.d.ts +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { readFile, writeFile, rm, mkdir } from "node:fs/promises";
|
|
3
|
-
import { spawnSync } from "node:child_process";
|
|
4
|
-
import { dirname, join, resolve } from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
import process from "node:process";
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { readFile, writeFile, rm, mkdir } from "node:fs/promises";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import process from "node:process";
|
|
7
7
|
|
|
8
8
|
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
const repoRoot = resolve(scriptDir, "..");
|
|
@@ -13,21 +13,50 @@ const scenarioTemplates = {
|
|
|
13
13
|
modern: join(repoRoot, "config", "codex-modern.json"),
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
const pluginPackageName = "codex-multi-auth";
|
|
17
|
+
const DEFAULT_MATRIX_TIMEOUT_MS = 120000;
|
|
18
|
+
|
|
19
|
+
function resolveCmdScriptEntry(commandPath) {
|
|
20
|
+
if (!/\.cmd$/i.test(commandPath)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const raw = readFileSync(commandPath, "utf8");
|
|
25
|
+
const match = raw.match(/"%dp0%\\([^"\r\n]+\.js)"/i);
|
|
26
|
+
if (!match || typeof match[1] !== "string") {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const relScriptPath = match[1].replace(/[\\/]+/g, "/");
|
|
30
|
+
const scriptPath = resolve(dirname(commandPath), relScriptPath);
|
|
31
|
+
return existsSync(scriptPath) ? scriptPath : null;
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function buildExecutable(command) {
|
|
38
|
+
const scriptEntry = resolveCmdScriptEntry(command);
|
|
39
|
+
if (scriptEntry) {
|
|
40
|
+
return {
|
|
41
|
+
command: process.execPath,
|
|
42
|
+
shell: false,
|
|
43
|
+
prefixArgs: [scriptEntry],
|
|
44
|
+
displayCommand: command,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return { command, shell: /\.cmd$/i.test(command) };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function resolveCodexExecutable() {
|
|
51
|
+
const envOverride = process.env.CODEX_BIN;
|
|
52
|
+
if (envOverride && envOverride.trim().length > 0) {
|
|
53
|
+
const command = envOverride.trim();
|
|
54
|
+
return buildExecutable(command);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (process.platform !== "win32") {
|
|
58
|
+
return { command: "codex", shell: false };
|
|
59
|
+
}
|
|
31
60
|
|
|
32
61
|
const whereResult = spawnSync("where", ["Codex"], {
|
|
33
62
|
encoding: "utf8",
|
|
@@ -42,27 +71,27 @@ export function resolveCodexExecutable() {
|
|
|
42
71
|
return { command: "codex", shell: false };
|
|
43
72
|
}
|
|
44
73
|
|
|
45
|
-
const exactExe = candidates.find((candidate) =>
|
|
46
|
-
/npm\\Codex\.exe$/i.test(candidate),
|
|
47
|
-
);
|
|
48
|
-
if (exactExe) {
|
|
49
|
-
return { command: exactExe, shell: false };
|
|
74
|
+
const exactExe = candidates.find((candidate) =>
|
|
75
|
+
/npm\\Codex\.exe$/i.test(candidate),
|
|
76
|
+
);
|
|
77
|
+
if (exactExe) {
|
|
78
|
+
return { command: exactExe, shell: false };
|
|
50
79
|
}
|
|
51
80
|
|
|
52
|
-
const exactCmd = candidates.find((candidate) =>
|
|
53
|
-
/npm\\Codex\.cmd$/i.test(candidate),
|
|
54
|
-
);
|
|
55
|
-
if (exactCmd) {
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const anyCmd = candidates.find((candidate) => /\.cmd$/i.test(candidate));
|
|
60
|
-
if (anyCmd) {
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return { command: candidates[0], shell: false };
|
|
65
|
-
}
|
|
81
|
+
const exactCmd = candidates.find((candidate) =>
|
|
82
|
+
/npm\\Codex\.cmd$/i.test(candidate),
|
|
83
|
+
);
|
|
84
|
+
if (exactCmd) {
|
|
85
|
+
return buildExecutable(exactCmd);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const anyCmd = candidates.find((candidate) => /\.cmd$/i.test(candidate));
|
|
89
|
+
if (anyCmd) {
|
|
90
|
+
return buildExecutable(anyCmd);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return { command: candidates[0], shell: false };
|
|
94
|
+
}
|
|
66
95
|
|
|
67
96
|
const CodexExecutable = resolveCodexExecutable();
|
|
68
97
|
|
|
@@ -215,27 +244,28 @@ function enumerateCases(models, smoke, maxCases) {
|
|
|
215
244
|
return selected;
|
|
216
245
|
}
|
|
217
246
|
|
|
218
|
-
function executeModelCase(caseInfo, index
|
|
219
|
-
const token = `MODEL_MATRIX_OK_${index}`;
|
|
220
|
-
const message =
|
|
221
|
-
const args = [
|
|
222
|
-
"
|
|
223
|
-
message,
|
|
224
|
-
"--model",
|
|
225
|
-
|
|
226
|
-
"--
|
|
227
|
-
|
|
228
|
-
];
|
|
229
|
-
if (caseInfo.variant) {
|
|
230
|
-
args.push("
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const timeoutMs = resolveMatrixTimeoutMs();
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
247
|
+
function executeModelCase(caseInfo, index) {
|
|
248
|
+
const token = `MODEL_MATRIX_OK_${index}`;
|
|
249
|
+
const message = token;
|
|
250
|
+
const args = [
|
|
251
|
+
"exec",
|
|
252
|
+
message,
|
|
253
|
+
"--model",
|
|
254
|
+
caseInfo.model,
|
|
255
|
+
"--json",
|
|
256
|
+
"--skip-git-repo-check",
|
|
257
|
+
];
|
|
258
|
+
if (caseInfo.variant) {
|
|
259
|
+
args.push("-c", `model_reasoning_effort="${caseInfo.variant}"`);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const timeoutMs = resolveMatrixTimeoutMs();
|
|
263
|
+
const commandArgs = [...(CodexExecutable.prefixArgs ?? []), ...args];
|
|
264
|
+
const finalized = spawnSync(CodexExecutable.command, commandArgs, {
|
|
265
|
+
cwd: repoRoot,
|
|
266
|
+
encoding: "utf8",
|
|
267
|
+
windowsHide: true,
|
|
268
|
+
shell: CodexExecutable.shell,
|
|
239
269
|
timeout: timeoutMs,
|
|
240
270
|
killSignal: "SIGKILL",
|
|
241
271
|
env: {
|
|
@@ -256,11 +286,10 @@ function executeModelCase(caseInfo, index, port) {
|
|
|
256
286
|
};
|
|
257
287
|
}
|
|
258
288
|
|
|
259
|
-
const combinedOutput = `${finalized.stdout ?? ""}\n${finalized.stderr ?? ""}`.trim();
|
|
260
|
-
const hasToken = combinedOutput.includes(token);
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
const ok = exitCode === 0 && hasToken && !hasFatalError;
|
|
289
|
+
const combinedOutput = `${finalized.stdout ?? ""}\n${finalized.stderr ?? ""}`.trim();
|
|
290
|
+
const hasToken = combinedOutput.includes(token);
|
|
291
|
+
const exitCode = finalized.status ?? 1;
|
|
292
|
+
const ok = exitCode === 0 && hasToken;
|
|
264
293
|
|
|
265
294
|
return {
|
|
266
295
|
...caseInfo,
|
|
@@ -342,12 +371,11 @@ async function runScenario(scenario, options) {
|
|
|
342
371
|
|
|
343
372
|
const results = [];
|
|
344
373
|
for (let i = 0; i < cases.length; i += 1) {
|
|
345
|
-
const caseInfo = cases[i];
|
|
346
|
-
const result = executeModelCase(
|
|
347
|
-
caseInfo,
|
|
348
|
-
i + 1,
|
|
349
|
-
|
|
350
|
-
);
|
|
374
|
+
const caseInfo = cases[i];
|
|
375
|
+
const result = executeModelCase(
|
|
376
|
+
caseInfo,
|
|
377
|
+
i + 1,
|
|
378
|
+
);
|
|
351
379
|
results.push(result);
|
|
352
380
|
const variantLabel = result.variant ? ` [variant=${result.variant}]` : "";
|
|
353
381
|
if (result.ok) {
|
|
@@ -398,10 +426,10 @@ async function main() {
|
|
|
398
426
|
|
|
399
427
|
console.log("Codex Model Matrix Audit");
|
|
400
428
|
console.log(`Repo: ${repoRoot}`);
|
|
401
|
-
console.log(`Scenarios: ${scenarios.join(", ")}`);
|
|
402
|
-
console.log(`Mode: ${smoke ? "smoke" : "full"}`);
|
|
403
|
-
console.log(`Plugin: ${pluginRef}`);
|
|
404
|
-
console.log(`Codex command: ${CodexExecutable.command}`);
|
|
429
|
+
console.log(`Scenarios: ${scenarios.join(", ")}`);
|
|
430
|
+
console.log(`Mode: ${smoke ? "smoke" : "full"}`);
|
|
431
|
+
console.log(`Plugin: ${pluginRef}`);
|
|
432
|
+
console.log(`Codex command: ${CodexExecutable.displayCommand ?? CodexExecutable.command}`);
|
|
405
433
|
|
|
406
434
|
const backups = await backupLocalConfigs();
|
|
407
435
|
const allResults = [];
|
|
@@ -435,10 +463,10 @@ async function main() {
|
|
|
435
463
|
generatedAt: new Date().toISOString(),
|
|
436
464
|
repoRoot,
|
|
437
465
|
scenarios,
|
|
438
|
-
mode: smoke ? "smoke" : "full",
|
|
439
|
-
plugin: pluginRef,
|
|
440
|
-
CodexCommand: CodexExecutable.command,
|
|
441
|
-
totals: {
|
|
466
|
+
mode: smoke ? "smoke" : "full",
|
|
467
|
+
plugin: pluginRef,
|
|
468
|
+
CodexCommand: CodexExecutable.displayCommand ?? CodexExecutable.command,
|
|
469
|
+
totals: {
|
|
442
470
|
total: allResults.length,
|
|
443
471
|
passed,
|
|
444
472
|
failed: failed.length,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
set -euo pipefail
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
-
node "${SCRIPT_DIR}/test-model-matrix.js" --smoke "$@"
|
|
7
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
node "${SCRIPT_DIR}/test-model-matrix.js" --smoke "$@"
|
|
7
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginInput = any;
|
|
1
|
+
export type PluginInput = any;
|
|
2
2
|
export type Plugin = any;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
export interface ToolContext {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
directory: string;
|
|
4
|
-
worktree: string;
|
|
5
|
-
ask: (request: any) => Promise<any> | any;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface ToolDefinition<TArgs = any, TResult = any> {
|
|
9
|
-
description?: string;
|
|
10
|
-
args?: Record<string, any>;
|
|
11
|
-
parameters?: unknown;
|
|
12
|
-
execute: (args: TArgs, context: ToolContext) => Promise<TResult> | TResult;
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface SchemaNode {
|
|
17
|
-
optional: () => SchemaNode;
|
|
18
|
-
describe: (_text: string) => SchemaNode;
|
|
19
|
-
min: (_value: number) => SchemaNode;
|
|
20
|
-
max: (_value: number) => SchemaNode;
|
|
21
|
-
default: (_value: unknown) => SchemaNode;
|
|
22
|
-
int: () => SchemaNode;
|
|
23
|
-
array: (_node?: unknown) => SchemaNode;
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ToolFactory {
|
|
28
|
-
<TArgs = any, TResult = any>(definition: ToolDefinition<TArgs, TResult>): ToolDefinition<TArgs, TResult>;
|
|
29
|
-
schema: {
|
|
30
|
-
string: () => SchemaNode;
|
|
31
|
-
number: () => SchemaNode;
|
|
32
|
-
boolean: () => SchemaNode;
|
|
33
|
-
object: (shape: Record<string, unknown>) => SchemaNode;
|
|
34
|
-
enum: (values: readonly unknown[]) => SchemaNode;
|
|
35
|
-
literal: (value: unknown) => SchemaNode;
|
|
36
|
-
array: (node: unknown) => SchemaNode;
|
|
37
|
-
any: () => SchemaNode;
|
|
38
|
-
unknown: () => SchemaNode;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
1
|
+
export interface ToolContext {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
directory: string;
|
|
4
|
+
worktree: string;
|
|
5
|
+
ask: (request: any) => Promise<any> | any;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ToolDefinition<TArgs = any, TResult = any> {
|
|
9
|
+
description?: string;
|
|
10
|
+
args?: Record<string, any>;
|
|
11
|
+
parameters?: unknown;
|
|
12
|
+
execute: (args: TArgs, context: ToolContext) => Promise<TResult> | TResult;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SchemaNode {
|
|
17
|
+
optional: () => SchemaNode;
|
|
18
|
+
describe: (_text: string) => SchemaNode;
|
|
19
|
+
min: (_value: number) => SchemaNode;
|
|
20
|
+
max: (_value: number) => SchemaNode;
|
|
21
|
+
default: (_value: unknown) => SchemaNode;
|
|
22
|
+
int: () => SchemaNode;
|
|
23
|
+
array: (_node?: unknown) => SchemaNode;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ToolFactory {
|
|
28
|
+
<TArgs = any, TResult = any>(definition: ToolDefinition<TArgs, TResult>): ToolDefinition<TArgs, TResult>;
|
|
29
|
+
schema: {
|
|
30
|
+
string: () => SchemaNode;
|
|
31
|
+
number: () => SchemaNode;
|
|
32
|
+
boolean: () => SchemaNode;
|
|
33
|
+
object: (shape: Record<string, unknown>) => SchemaNode;
|
|
34
|
+
enum: (values: readonly unknown[]) => SchemaNode;
|
|
35
|
+
literal: (value: unknown) => SchemaNode;
|
|
36
|
+
array: (node: unknown) => SchemaNode;
|
|
37
|
+
any: () => SchemaNode;
|
|
38
|
+
unknown: () => SchemaNode;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
42
|
export declare const tool: ToolFactory;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
const chain = {
|
|
2
|
-
optional() { return this; },
|
|
3
|
-
describe() { return this; },
|
|
4
|
-
min() { return this; },
|
|
5
|
-
max() { return this; },
|
|
6
|
-
default() { return this; },
|
|
7
|
-
int() { return this; },
|
|
8
|
-
array() { return this; },
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
function node() {
|
|
12
|
-
return Object.create(chain);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function tool(definition) {
|
|
16
|
-
return definition;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
tool.schema = {
|
|
20
|
-
string: () => node(),
|
|
21
|
-
number: () => node(),
|
|
22
|
-
boolean: () => node(),
|
|
23
|
-
object: () => node(),
|
|
24
|
-
enum: () => node(),
|
|
25
|
-
literal: () => node(),
|
|
26
|
-
array: () => node(),
|
|
27
|
-
any: () => node(),
|
|
28
|
-
unknown: () => node(),
|
|
1
|
+
const chain = {
|
|
2
|
+
optional() { return this; },
|
|
3
|
+
describe() { return this; },
|
|
4
|
+
min() { return this; },
|
|
5
|
+
max() { return this; },
|
|
6
|
+
default() { return this; },
|
|
7
|
+
int() { return this; },
|
|
8
|
+
array() { return this; },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function node() {
|
|
12
|
+
return Object.create(chain);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function tool(definition) {
|
|
16
|
+
return definition;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
tool.schema = {
|
|
20
|
+
string: () => node(),
|
|
21
|
+
number: () => node(),
|
|
22
|
+
boolean: () => node(),
|
|
23
|
+
object: () => node(),
|
|
24
|
+
enum: () => node(),
|
|
25
|
+
literal: () => node(),
|
|
26
|
+
array: () => node(),
|
|
27
|
+
any: () => node(),
|
|
28
|
+
unknown: () => node(),
|
|
29
29
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Auth = any;
|
|
2
|
-
export type Provider = any;
|
|
3
|
-
export type Model = any;
|
|
1
|
+
export type Auth = any;
|
|
2
|
+
export type Provider = any;
|
|
3
|
+
export type Model = any;
|
|
4
4
|
export type CodexClient = any;
|