Phase 4: TypeScript/Node.js Components
Updated all TypeScript and JavaScript source files: - Renamed sdk/typescript/src/codex.ts → llmx.ts - Renamed sdk/typescript/src/codexOptions.ts → llmxOptions.ts - Updated class names: Codex → LLMX, CodexExec → LLMXExec, CodexOptions → LLMXOptions - Updated property names: codexPathOverride → llmxPathOverride - Updated package imports: @openai/codex-sdk → @llmx/llmx-sdk - Updated all references in sample files and tests - Renamed responses-api-proxy binary: codex-responses-api-proxy.js → llmx-responses-api-proxy.js - Updated comments referencing Codex → LLMX - Updated session path references: ~/.codex → ~/.llmx Files changed: 16 TypeScript/JavaScript files across SDK, samples, and tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
// Entry point for the Codex responses API proxy binary.
|
// Entry point for the LLMX responses API proxy binary.
|
||||||
|
|
||||||
import { spawn } from "node:child_process";
|
import { spawn } from "node:child_process";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
@@ -50,7 +50,7 @@ if (!targetTriple) {
|
|||||||
|
|
||||||
const vendorRoot = path.join(__dirname, "..", "vendor");
|
const vendorRoot = path.join(__dirname, "..", "vendor");
|
||||||
const archRoot = path.join(vendorRoot, targetTriple);
|
const archRoot = path.join(vendorRoot, targetTriple);
|
||||||
const binaryBaseName = "codex-responses-api-proxy";
|
const binaryBaseName = "llmx-responses-api-proxy";
|
||||||
const binaryPath = path.join(
|
const binaryPath = path.join(
|
||||||
archRoot,
|
archRoot,
|
||||||
binaryBaseName,
|
binaryBaseName,
|
||||||
@@ -3,12 +3,12 @@
|
|||||||
import { createInterface } from "node:readline/promises";
|
import { createInterface } from "node:readline/promises";
|
||||||
import { stdin as input, stdout as output } from "node:process";
|
import { stdin as input, stdout as output } from "node:process";
|
||||||
|
|
||||||
import { Codex } from "@openai/codex-sdk";
|
import { LLMX } from "@llmx/llmx-sdk";
|
||||||
import type { ThreadEvent, ThreadItem } from "@openai/codex-sdk";
|
import type { ThreadEvent, ThreadItem } from "@llmx/llmx-sdk";
|
||||||
import { codexPathOverride } from "./helpers.ts";
|
import { llmxPathOverride } from "./helpers.ts";
|
||||||
|
|
||||||
const codex = new Codex({ codexPathOverride: codexPathOverride() });
|
const llmx = new LLMX({ llmxPathOverride: llmxPathOverride() });
|
||||||
const thread = codex.startThread();
|
const thread = llmx.startThread();
|
||||||
const rl = createInterface({ input, output });
|
const rl = createInterface({ input, output });
|
||||||
|
|
||||||
const handleItemCompleted = (item: ThreadItem): void => {
|
const handleItemCompleted = (item: ThreadItem): void => {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
export function codexPathOverride() {
|
export function llmxPathOverride() {
|
||||||
return (
|
return (
|
||||||
process.env.CODEX_EXECUTABLE ??
|
process.env.CODEX_EXECUTABLE ??
|
||||||
path.join(process.cwd(), "..", "..", "codex-rs", "target", "debug", "codex")
|
path.join(process.cwd(), "..", "..", "llmx-rs", "target", "debug", "llmx")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env -S NODE_NO_WARNINGS=1 pnpm ts-node-esm --files
|
#!/usr/bin/env -S NODE_NO_WARNINGS=1 pnpm ts-node-esm --files
|
||||||
|
|
||||||
import { Codex } from "@openai/codex-sdk";
|
import { LLMX } from "@llmx/llmx-sdk";
|
||||||
|
|
||||||
import { codexPathOverride } from "./helpers.ts";
|
import { llmxPathOverride } from "./helpers.ts";
|
||||||
|
|
||||||
const codex = new Codex({ codexPathOverride: codexPathOverride() });
|
const llmx = new LLMX({ llmxPathOverride: llmxPathOverride() });
|
||||||
|
|
||||||
const thread = codex.startThread();
|
const thread = llmx.startThread();
|
||||||
|
|
||||||
const schema = {
|
const schema = {
|
||||||
type: "object",
|
type: "object",
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env -S NODE_NO_WARNINGS=1 pnpm ts-node-esm --files
|
#!/usr/bin/env -S NODE_NO_WARNINGS=1 pnpm ts-node-esm --files
|
||||||
|
|
||||||
import { Codex } from "@openai/codex-sdk";
|
import { LLMX } from "@llmx/llmx-sdk";
|
||||||
import { codexPathOverride } from "./helpers.ts";
|
import { llmxPathOverride } from "./helpers.ts";
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
import zodToJsonSchema from "zod-to-json-schema";
|
import zodToJsonSchema from "zod-to-json-schema";
|
||||||
|
|
||||||
const codex = new Codex({ codexPathOverride: codexPathOverride() });
|
const llmx = new LLMX({ llmxPathOverride: llmxPathOverride() });
|
||||||
const thread = codex.startThread();
|
const thread = llmx.startThread();
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
summary: z.string(),
|
summary: z.string(),
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
export type CodexOptions = {
|
|
||||||
codexPathOverride?: string;
|
|
||||||
baseUrl?: string;
|
|
||||||
apiKey?: string;
|
|
||||||
};
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// based on event types from codex-rs/exec/src/exec_events.rs
|
// based on event types from llmx-rs/exec/src/exec_events.rs
|
||||||
|
|
||||||
import type { ThreadItem } from "./items";
|
import type { ThreadItem } from "./items";
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ export type ThreadErrorEvent = {
|
|||||||
message: string;
|
message: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Top-level JSONL events emitted by codex exec. */
|
/** Top-level JSONL events emitted by llmx exec. */
|
||||||
export type ThreadEvent =
|
export type ThreadEvent =
|
||||||
| ThreadStartedEvent
|
| ThreadStartedEvent
|
||||||
| TurnStartedEvent
|
| TurnStartedEvent
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
|
|||||||
|
|
||||||
import { SandboxMode, ModelReasoningEffort, ApprovalMode } from "./threadOptions";
|
import { SandboxMode, ModelReasoningEffort, ApprovalMode } from "./threadOptions";
|
||||||
|
|
||||||
export type CodexExecArgs = {
|
export type LLMXExecArgs = {
|
||||||
input: string;
|
input: string;
|
||||||
|
|
||||||
baseUrl?: string;
|
baseUrl?: string;
|
||||||
@@ -35,13 +35,13 @@ export type CodexExecArgs = {
|
|||||||
const INTERNAL_ORIGINATOR_ENV = "CODEX_INTERNAL_ORIGINATOR_OVERRIDE";
|
const INTERNAL_ORIGINATOR_ENV = "CODEX_INTERNAL_ORIGINATOR_OVERRIDE";
|
||||||
const TYPESCRIPT_SDK_ORIGINATOR = "codex_sdk_ts";
|
const TYPESCRIPT_SDK_ORIGINATOR = "codex_sdk_ts";
|
||||||
|
|
||||||
export class CodexExec {
|
export class LLMXExec {
|
||||||
private executablePath: string;
|
private executablePath: string;
|
||||||
constructor(executablePath: string | null = null) {
|
constructor(executablePath: string | null = null) {
|
||||||
this.executablePath = executablePath || findCodexPath();
|
this.executablePath = executablePath || findCodexPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
async *run(args: CodexExecArgs): AsyncGenerator<string> {
|
async *run(args: LLMXExecArgs): AsyncGenerator<string> {
|
||||||
const commandArgs: string[] = ["exec", "--experimental-json"];
|
const commandArgs: string[] = ["exec", "--experimental-json"];
|
||||||
|
|
||||||
if (args.model) {
|
if (args.model) {
|
||||||
@@ -147,7 +147,7 @@ export class CodexExec {
|
|||||||
} else {
|
} else {
|
||||||
const stderrBuffer = Buffer.concat(stderrChunks);
|
const stderrBuffer = Buffer.concat(stderrChunks);
|
||||||
reject(
|
reject(
|
||||||
new Error(`Codex Exec exited with code ${code}: ${stderrBuffer.toString("utf8")}`),
|
new Error(`LLMX Exec exited with code ${code}: ${stderrBuffer.toString("utf8")}`),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -222,8 +222,8 @@ function findCodexPath() {
|
|||||||
|
|
||||||
const vendorRoot = path.join(scriptDirName, "..", "vendor");
|
const vendorRoot = path.join(scriptDirName, "..", "vendor");
|
||||||
const archRoot = path.join(vendorRoot, targetTriple);
|
const archRoot = path.join(vendorRoot, targetTriple);
|
||||||
const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
|
const codexBinaryName = process.platform === "win32" ? "llmx.exe" : "llmx";
|
||||||
const binaryPath = path.join(archRoot, "codex", codexBinaryName);
|
const binaryPath = path.join(archRoot, "llmx", codexBinaryName);
|
||||||
|
|
||||||
return binaryPath;
|
return binaryPath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ export type {
|
|||||||
export { Thread } from "./thread";
|
export { Thread } from "./thread";
|
||||||
export type { RunResult, RunStreamedResult, Input, UserInput } from "./thread";
|
export type { RunResult, RunStreamedResult, Input, UserInput } from "./thread";
|
||||||
|
|
||||||
export { Codex } from "./codex";
|
export { LLMX } from "./llmx";
|
||||||
|
|
||||||
export type { CodexOptions } from "./codexOptions";
|
export type { LLMXOptions } from "./llmxOptions";
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
ThreadOptions,
|
ThreadOptions,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// based on item types from codex-rs/exec/src/exec_events.rs
|
// based on item types from llmx-rs/exec/src/exec_events.rs
|
||||||
|
|
||||||
import type { ContentBlock as McpContentBlock } from "@modelcontextprotocol/sdk/types.js";
|
import type { ContentBlock as McpContentBlock } from "@modelcontextprotocol/sdk/types.js";
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { CodexOptions } from "./codexOptions";
|
import { LLMXOptions } from "./llmxOptions";
|
||||||
import { CodexExec } from "./exec";
|
import { LLMXExec } from "./exec";
|
||||||
import { Thread } from "./thread";
|
import { Thread } from "./thread";
|
||||||
import { ThreadOptions } from "./threadOptions";
|
import { ThreadOptions } from "./threadOptions";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Codex is the main class for interacting with the Codex agent.
|
* LLMX is the main class for interacting with the LLMX agent.
|
||||||
*
|
*
|
||||||
* Use the `startThread()` method to start a new thread or `resumeThread()` to resume a previously started thread.
|
* Use the `startThread()` method to start a new thread or `resumeThread()` to resume a previously started thread.
|
||||||
*/
|
*/
|
||||||
export class Codex {
|
export class LLMX {
|
||||||
private exec: CodexExec;
|
private exec: LLMXExec;
|
||||||
private options: CodexOptions;
|
private options: LLMXOptions;
|
||||||
|
|
||||||
constructor(options: CodexOptions = {}) {
|
constructor(options: LLMXOptions = {}) {
|
||||||
this.exec = new CodexExec(options.codexPathOverride);
|
this.exec = new LLMXExec(options.llmxPathOverride);
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ export class Codex {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Resumes a conversation with an agent based on the thread id.
|
* Resumes a conversation with an agent based on the thread id.
|
||||||
* Threads are persisted in ~/.codex/sessions.
|
* Threads are persisted in ~/.llmx/sessions.
|
||||||
*
|
*
|
||||||
* @param id The id of the thread to resume.
|
* @param id The id of the thread to resume.
|
||||||
* @returns A new thread instance.
|
* @returns A new thread instance.
|
||||||
5
sdk/typescript/src/llmxOptions.ts
Normal file
5
sdk/typescript/src/llmxOptions.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export type LLMXOptions = {
|
||||||
|
llmxPathOverride?: string;
|
||||||
|
baseUrl?: string;
|
||||||
|
apiKey?: string;
|
||||||
|
};
|
||||||
@@ -16,7 +16,7 @@ export async function createOutputSchemaFile(schema: unknown): Promise<OutputSch
|
|||||||
throw new Error("outputSchema must be a plain JSON object");
|
throw new Error("outputSchema must be a plain JSON object");
|
||||||
}
|
}
|
||||||
|
|
||||||
const schemaDir = await fs.mkdtemp(path.join(os.tmpdir(), "codex-output-schema-"));
|
const schemaDir = await fs.mkdtemp(path.join(os.tmpdir(), "llmx-output-schema-"));
|
||||||
const schemaPath = path.join(schemaDir, "schema.json");
|
const schemaPath = path.join(schemaDir, "schema.json");
|
||||||
const cleanup = async () => {
|
const cleanup = async () => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CodexOptions } from "./codexOptions";
|
import { LLMXOptions } from "./llmxOptions";
|
||||||
import { ThreadEvent, ThreadError, Usage } from "./events";
|
import { ThreadEvent, ThreadError, Usage } from "./events";
|
||||||
import { CodexExec } from "./exec";
|
import { LLMXExec } from "./exec";
|
||||||
import { ThreadItem } from "./items";
|
import { ThreadItem } from "./items";
|
||||||
import { ThreadOptions } from "./threadOptions";
|
import { ThreadOptions } from "./threadOptions";
|
||||||
import { TurnOptions } from "./turnOptions";
|
import { TurnOptions } from "./turnOptions";
|
||||||
@@ -39,8 +39,8 @@ export type Input = string | UserInput[];
|
|||||||
|
|
||||||
/** Respesent a thread of conversation with the agent. One thread can have multiple consecutive turns. */
|
/** Respesent a thread of conversation with the agent. One thread can have multiple consecutive turns. */
|
||||||
export class Thread {
|
export class Thread {
|
||||||
private _exec: CodexExec;
|
private _exec: LLMXExec;
|
||||||
private _options: CodexOptions;
|
private _options: LLMXOptions;
|
||||||
private _id: string | null;
|
private _id: string | null;
|
||||||
private _threadOptions: ThreadOptions;
|
private _threadOptions: ThreadOptions;
|
||||||
|
|
||||||
@@ -51,8 +51,8 @@ export class Thread {
|
|||||||
|
|
||||||
/* @internal */
|
/* @internal */
|
||||||
constructor(
|
constructor(
|
||||||
exec: CodexExec,
|
exec: LLMXExec,
|
||||||
options: CodexOptions,
|
options: LLMXOptions,
|
||||||
threadOptions: ThreadOptions,
|
threadOptions: ThreadOptions,
|
||||||
id: string | null = null,
|
id: string | null = null,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import path from "node:path";
|
|||||||
import { codexExecSpy } from "./codexExecSpy";
|
import { codexExecSpy } from "./codexExecSpy";
|
||||||
import { describe, expect, it } from "@jest/globals";
|
import { describe, expect, it } from "@jest/globals";
|
||||||
|
|
||||||
import { Codex } from "../src/codex";
|
import { LLMX } from "../src/llmx";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
assistantMessage,
|
assistantMessage,
|
||||||
@@ -16,9 +16,9 @@ import {
|
|||||||
startResponsesTestProxy,
|
startResponsesTestProxy,
|
||||||
} from "./responsesProxy";
|
} from "./responsesProxy";
|
||||||
|
|
||||||
const codexExecPath = path.join(process.cwd(), "..", "..", "codex-rs", "target", "debug", "codex");
|
const codexExecPath = path.join(process.cwd(), "..", "..", "llmx-rs", "target", "debug", "llmx");
|
||||||
|
|
||||||
describe("Codex", () => {
|
describe("LLMX", () => {
|
||||||
it("returns thread events", async () => {
|
it("returns thread events", async () => {
|
||||||
const { url, close } = await startResponsesTestProxy({
|
const { url, close } = await startResponsesTestProxy({
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
@@ -26,7 +26,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
const result = await thread.run("Hello, world!");
|
const result = await thread.run("Hello, world!");
|
||||||
@@ -68,7 +68,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
await thread.run("first input");
|
await thread.run("first input");
|
||||||
@@ -111,7 +111,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
await thread.run("first input");
|
await thread.run("first input");
|
||||||
@@ -155,7 +155,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const originalThread = client.startThread();
|
const originalThread = client.startThread();
|
||||||
await originalThread.run("first input");
|
await originalThread.run("first input");
|
||||||
@@ -199,7 +199,7 @@ describe("Codex", () => {
|
|||||||
const { args: spawnArgs, restore } = codexExecSpy();
|
const { args: spawnArgs, restore } = codexExecSpy();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread({
|
const thread = client.startThread({
|
||||||
model: "gpt-test-1",
|
model: "gpt-test-1",
|
||||||
@@ -238,7 +238,7 @@ describe("Codex", () => {
|
|||||||
const { args: spawnArgs, restore } = codexExecSpy();
|
const { args: spawnArgs, restore } = codexExecSpy();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread({
|
const thread = client.startThread({
|
||||||
modelReasoningEffort: "high",
|
modelReasoningEffort: "high",
|
||||||
@@ -269,7 +269,7 @@ describe("Codex", () => {
|
|||||||
const { args: spawnArgs, restore } = codexExecSpy();
|
const { args: spawnArgs, restore } = codexExecSpy();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread({
|
const thread = client.startThread({
|
||||||
networkAccessEnabled: true,
|
networkAccessEnabled: true,
|
||||||
@@ -300,7 +300,7 @@ describe("Codex", () => {
|
|||||||
const { args: spawnArgs, restore } = codexExecSpy();
|
const { args: spawnArgs, restore } = codexExecSpy();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread({
|
const thread = client.startThread({
|
||||||
webSearchEnabled: true,
|
webSearchEnabled: true,
|
||||||
@@ -331,7 +331,7 @@ describe("Codex", () => {
|
|||||||
const { args: spawnArgs, restore } = codexExecSpy();
|
const { args: spawnArgs, restore } = codexExecSpy();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread({
|
const thread = client.startThread({
|
||||||
approvalPolicy: "on-request",
|
approvalPolicy: "on-request",
|
||||||
@@ -371,7 +371,7 @@ describe("Codex", () => {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
await thread.run("structured", { outputSchema: schema });
|
await thread.run("structured", { outputSchema: schema });
|
||||||
@@ -416,7 +416,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
await thread.run([
|
await thread.run([
|
||||||
@@ -445,7 +445,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { args: spawnArgs, restore } = codexExecSpy();
|
const { args: spawnArgs, restore } = codexExecSpy();
|
||||||
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "codex-images-"));
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "llmx-images-"));
|
||||||
const imagesDirectoryEntries: [string, string] = [
|
const imagesDirectoryEntries: [string, string] = [
|
||||||
path.join(tempDir, "first.png"),
|
path.join(tempDir, "first.png"),
|
||||||
path.join(tempDir, "second.jpg"),
|
path.join(tempDir, "second.jpg"),
|
||||||
@@ -455,7 +455,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
await thread.run([
|
await thread.run([
|
||||||
@@ -494,9 +494,9 @@ describe("Codex", () => {
|
|||||||
const { args: spawnArgs, restore } = codexExecSpy();
|
const { args: spawnArgs, restore } = codexExecSpy();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "codex-working-dir-"));
|
const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "llmx-working-dir-"));
|
||||||
const client = new Codex({
|
const client = new LLMX({
|
||||||
codexPathOverride: codexExecPath,
|
llmxPathOverride: codexExecPath,
|
||||||
baseUrl: url,
|
baseUrl: url,
|
||||||
apiKey: "test",
|
apiKey: "test",
|
||||||
});
|
});
|
||||||
@@ -528,9 +528,9 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "codex-working-dir-"));
|
const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "llmx-working-dir-"));
|
||||||
const client = new Codex({
|
const client = new LLMX({
|
||||||
codexPathOverride: codexExecPath,
|
llmxPathOverride: codexExecPath,
|
||||||
baseUrl: url,
|
baseUrl: url,
|
||||||
apiKey: "test",
|
apiKey: "test",
|
||||||
});
|
});
|
||||||
@@ -546,14 +546,14 @@ describe("Codex", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sets the codex sdk originator header", async () => {
|
it("sets the llmx sdk originator header", async () => {
|
||||||
const { url, close, requests } = await startResponsesTestProxy({
|
const { url, close, requests } = await startResponsesTestProxy({
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
responseBodies: [sse(responseStarted(), assistantMessage("Hi!"), responseCompleted())],
|
responseBodies: [sse(responseStarted(), assistantMessage("Hi!"), responseCompleted())],
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
await thread.run("Hello, originator!");
|
await thread.run("Hello, originator!");
|
||||||
@@ -579,7 +579,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
await expect(thread.run("fail")).rejects.toThrow("stream disconnected before completion:");
|
await expect(thread.run("fail")).rejects.toThrow("stream disconnected before completion:");
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import path from "node:path";
|
|||||||
|
|
||||||
import { describe, expect, it } from "@jest/globals";
|
import { describe, expect, it } from "@jest/globals";
|
||||||
|
|
||||||
import { Codex } from "../src/codex";
|
import { LLMX } from "../src/llmx";
|
||||||
import { ThreadEvent } from "../src/index";
|
import { ThreadEvent } from "../src/index";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -13,9 +13,9 @@ import {
|
|||||||
startResponsesTestProxy,
|
startResponsesTestProxy,
|
||||||
} from "./responsesProxy";
|
} from "./responsesProxy";
|
||||||
|
|
||||||
const codexExecPath = path.join(process.cwd(), "..", "..", "codex-rs", "target", "debug", "codex");
|
const codexExecPath = path.join(process.cwd(), "..", "..", "llmx-rs", "target", "debug", "llmx");
|
||||||
|
|
||||||
describe("Codex", () => {
|
describe("LLMX", () => {
|
||||||
it("returns thread events", async () => {
|
it("returns thread events", async () => {
|
||||||
const { url, close } = await startResponsesTestProxy({
|
const { url, close } = await startResponsesTestProxy({
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
@@ -23,7 +23,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
const result = await thread.runStreamed("Hello, world!");
|
const result = await thread.runStreamed("Hello, world!");
|
||||||
@@ -82,7 +82,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
const first = await thread.runStreamed("first input");
|
const first = await thread.runStreamed("first input");
|
||||||
@@ -128,7 +128,7 @@ describe("Codex", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const originalThread = client.startThread();
|
const originalThread = client.startThread();
|
||||||
const first = await originalThread.runStreamed("first input");
|
const first = await originalThread.runStreamed("first input");
|
||||||
@@ -180,7 +180,7 @@ describe("Codex", () => {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const client = new Codex({ codexPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
const client = new LLMX({ llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test" });
|
||||||
|
|
||||||
const thread = client.startThread();
|
const thread = client.startThread();
|
||||||
const streamed = await thread.runStreamed("structured", { outputSchema: schema });
|
const streamed = await thread.runStreamed("structured", { outputSchema: schema });
|
||||||
|
|||||||
Reference in New Issue
Block a user