diff --git a/llmx-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js b/llmx-rs/responses-api-proxy/npm/bin/llmx-responses-api-proxy.js similarity index 95% rename from llmx-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js rename to llmx-rs/responses-api-proxy/npm/bin/llmx-responses-api-proxy.js index e2c3ee7d..b940f3fb 100755 --- a/llmx-rs/responses-api-proxy/npm/bin/codex-responses-api-proxy.js +++ b/llmx-rs/responses-api-proxy/npm/bin/llmx-responses-api-proxy.js @@ -1,5 +1,5 @@ #!/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 path from "path"; @@ -50,7 +50,7 @@ if (!targetTriple) { const vendorRoot = path.join(__dirname, "..", "vendor"); const archRoot = path.join(vendorRoot, targetTriple); -const binaryBaseName = "codex-responses-api-proxy"; +const binaryBaseName = "llmx-responses-api-proxy"; const binaryPath = path.join( archRoot, binaryBaseName, diff --git a/sdk/typescript/samples/basic_streaming.ts b/sdk/typescript/samples/basic_streaming.ts index f9ccbe40..ee7208e4 100755 --- a/sdk/typescript/samples/basic_streaming.ts +++ b/sdk/typescript/samples/basic_streaming.ts @@ -3,12 +3,12 @@ import { createInterface } from "node:readline/promises"; import { stdin as input, stdout as output } from "node:process"; -import { Codex } from "@openai/codex-sdk"; -import type { ThreadEvent, ThreadItem } from "@openai/codex-sdk"; -import { codexPathOverride } from "./helpers.ts"; +import { LLMX } from "@llmx/llmx-sdk"; +import type { ThreadEvent, ThreadItem } from "@llmx/llmx-sdk"; +import { llmxPathOverride } from "./helpers.ts"; -const codex = new Codex({ codexPathOverride: codexPathOverride() }); -const thread = codex.startThread(); +const llmx = new LLMX({ llmxPathOverride: llmxPathOverride() }); +const thread = llmx.startThread(); const rl = createInterface({ input, output }); const handleItemCompleted = (item: ThreadItem): void => { diff --git a/sdk/typescript/samples/helpers.ts b/sdk/typescript/samples/helpers.ts index c4643091..533fd543 100644 --- a/sdk/typescript/samples/helpers.ts +++ b/sdk/typescript/samples/helpers.ts @@ -1,8 +1,8 @@ import path from "node:path"; -export function codexPathOverride() { +export function llmxPathOverride() { return ( process.env.CODEX_EXECUTABLE ?? - path.join(process.cwd(), "..", "..", "codex-rs", "target", "debug", "codex") + path.join(process.cwd(), "..", "..", "llmx-rs", "target", "debug", "llmx") ); } diff --git a/sdk/typescript/samples/structured_output.ts b/sdk/typescript/samples/structured_output.ts index 60063c10..f660835c 100755 --- a/sdk/typescript/samples/structured_output.ts +++ b/sdk/typescript/samples/structured_output.ts @@ -1,12 +1,12 @@ #!/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 = { type: "object", diff --git a/sdk/typescript/samples/structured_output_zod.ts b/sdk/typescript/samples/structured_output_zod.ts index 917bc391..c7f68a6f 100755 --- a/sdk/typescript/samples/structured_output_zod.ts +++ b/sdk/typescript/samples/structured_output_zod.ts @@ -1,12 +1,12 @@ #!/usr/bin/env -S NODE_NO_WARNINGS=1 pnpm ts-node-esm --files -import { Codex } from "@openai/codex-sdk"; -import { codexPathOverride } from "./helpers.ts"; +import { LLMX } from "@llmx/llmx-sdk"; +import { llmxPathOverride } from "./helpers.ts"; import z from "zod"; import zodToJsonSchema from "zod-to-json-schema"; -const codex = new Codex({ codexPathOverride: codexPathOverride() }); -const thread = codex.startThread(); +const llmx = new LLMX({ llmxPathOverride: llmxPathOverride() }); +const thread = llmx.startThread(); const schema = z.object({ summary: z.string(), diff --git a/sdk/typescript/src/codexOptions.ts b/sdk/typescript/src/codexOptions.ts deleted file mode 100644 index 2d22bcf2..00000000 --- a/sdk/typescript/src/codexOptions.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type CodexOptions = { - codexPathOverride?: string; - baseUrl?: string; - apiKey?: string; -}; diff --git a/sdk/typescript/src/events.ts b/sdk/typescript/src/events.ts index b8adcfb4..69d875e3 100644 --- a/sdk/typescript/src/events.ts +++ b/sdk/typescript/src/events.ts @@ -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"; @@ -68,7 +68,7 @@ export type ThreadErrorEvent = { message: string; }; -/** Top-level JSONL events emitted by codex exec. */ +/** Top-level JSONL events emitted by llmx exec. */ export type ThreadEvent = | ThreadStartedEvent | TurnStartedEvent diff --git a/sdk/typescript/src/exec.ts b/sdk/typescript/src/exec.ts index 8086c92a..ce52b99c 100644 --- a/sdk/typescript/src/exec.ts +++ b/sdk/typescript/src/exec.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url"; import { SandboxMode, ModelReasoningEffort, ApprovalMode } from "./threadOptions"; -export type CodexExecArgs = { +export type LLMXExecArgs = { input: string; baseUrl?: string; @@ -35,13 +35,13 @@ export type CodexExecArgs = { const INTERNAL_ORIGINATOR_ENV = "CODEX_INTERNAL_ORIGINATOR_OVERRIDE"; const TYPESCRIPT_SDK_ORIGINATOR = "codex_sdk_ts"; -export class CodexExec { +export class LLMXExec { private executablePath: string; constructor(executablePath: string | null = null) { this.executablePath = executablePath || findCodexPath(); } - async *run(args: CodexExecArgs): AsyncGenerator { + async *run(args: LLMXExecArgs): AsyncGenerator { const commandArgs: string[] = ["exec", "--experimental-json"]; if (args.model) { @@ -147,7 +147,7 @@ export class CodexExec { } else { const stderrBuffer = Buffer.concat(stderrChunks); 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 archRoot = path.join(vendorRoot, targetTriple); - const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex"; - const binaryPath = path.join(archRoot, "codex", codexBinaryName); + const codexBinaryName = process.platform === "win32" ? "llmx.exe" : "llmx"; + const binaryPath = path.join(archRoot, "llmx", codexBinaryName); return binaryPath; } diff --git a/sdk/typescript/src/index.ts b/sdk/typescript/src/index.ts index cfd0dc43..c8f2c86e 100644 --- a/sdk/typescript/src/index.ts +++ b/sdk/typescript/src/index.ts @@ -26,9 +26,9 @@ export type { export { Thread } 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 { ThreadOptions, diff --git a/sdk/typescript/src/items.ts b/sdk/typescript/src/items.ts index 182878f5..36dc7b54 100644 --- a/sdk/typescript/src/items.ts +++ b/sdk/typescript/src/items.ts @@ -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"; diff --git a/sdk/typescript/src/codex.ts b/sdk/typescript/src/llmx.ts similarity index 66% rename from sdk/typescript/src/codex.ts rename to sdk/typescript/src/llmx.ts index 84376e67..98437aed 100644 --- a/sdk/typescript/src/codex.ts +++ b/sdk/typescript/src/llmx.ts @@ -1,19 +1,19 @@ -import { CodexOptions } from "./codexOptions"; -import { CodexExec } from "./exec"; +import { LLMXOptions } from "./llmxOptions"; +import { LLMXExec } from "./exec"; import { Thread } from "./thread"; 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. */ -export class Codex { - private exec: CodexExec; - private options: CodexOptions; +export class LLMX { + private exec: LLMXExec; + private options: LLMXOptions; - constructor(options: CodexOptions = {}) { - this.exec = new CodexExec(options.codexPathOverride); + constructor(options: LLMXOptions = {}) { + this.exec = new LLMXExec(options.llmxPathOverride); this.options = options; } @@ -27,7 +27,7 @@ export class Codex { /** * 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. * @returns A new thread instance. diff --git a/sdk/typescript/src/llmxOptions.ts b/sdk/typescript/src/llmxOptions.ts new file mode 100644 index 00000000..d4146cb3 --- /dev/null +++ b/sdk/typescript/src/llmxOptions.ts @@ -0,0 +1,5 @@ +export type LLMXOptions = { + llmxPathOverride?: string; + baseUrl?: string; + apiKey?: string; +}; diff --git a/sdk/typescript/src/outputSchemaFile.ts b/sdk/typescript/src/outputSchemaFile.ts index 13adb4c7..8ea4d830 100644 --- a/sdk/typescript/src/outputSchemaFile.ts +++ b/sdk/typescript/src/outputSchemaFile.ts @@ -16,7 +16,7 @@ export async function createOutputSchemaFile(schema: unknown): Promise { try { diff --git a/sdk/typescript/src/thread.ts b/sdk/typescript/src/thread.ts index fec63cf4..be36c132 100644 --- a/sdk/typescript/src/thread.ts +++ b/sdk/typescript/src/thread.ts @@ -1,6 +1,6 @@ -import { CodexOptions } from "./codexOptions"; +import { LLMXOptions } from "./llmxOptions"; import { ThreadEvent, ThreadError, Usage } from "./events"; -import { CodexExec } from "./exec"; +import { LLMXExec } from "./exec"; import { ThreadItem } from "./items"; import { ThreadOptions } from "./threadOptions"; 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. */ export class Thread { - private _exec: CodexExec; - private _options: CodexOptions; + private _exec: LLMXExec; + private _options: LLMXOptions; private _id: string | null; private _threadOptions: ThreadOptions; @@ -51,8 +51,8 @@ export class Thread { /* @internal */ constructor( - exec: CodexExec, - options: CodexOptions, + exec: LLMXExec, + options: LLMXOptions, threadOptions: ThreadOptions, id: string | null = null, ) { diff --git a/sdk/typescript/tests/run.test.ts b/sdk/typescript/tests/run.test.ts index f461e166..1e17505e 100644 --- a/sdk/typescript/tests/run.test.ts +++ b/sdk/typescript/tests/run.test.ts @@ -5,7 +5,7 @@ import path from "node:path"; import { codexExecSpy } from "./codexExecSpy"; import { describe, expect, it } from "@jest/globals"; -import { Codex } from "../src/codex"; +import { LLMX } from "../src/llmx"; import { assistantMessage, @@ -16,9 +16,9 @@ import { startResponsesTestProxy, } 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 () => { const { url, close } = await startResponsesTestProxy({ statusCode: 200, @@ -26,7 +26,7 @@ describe("Codex", () => { }); 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 result = await thread.run("Hello, world!"); @@ -68,7 +68,7 @@ describe("Codex", () => { }); 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(); await thread.run("first input"); @@ -111,7 +111,7 @@ describe("Codex", () => { }); 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(); await thread.run("first input"); @@ -155,7 +155,7 @@ describe("Codex", () => { }); 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(); await originalThread.run("first input"); @@ -199,7 +199,7 @@ describe("Codex", () => { const { args: spawnArgs, restore } = codexExecSpy(); 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({ model: "gpt-test-1", @@ -238,7 +238,7 @@ describe("Codex", () => { const { args: spawnArgs, restore } = codexExecSpy(); 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({ modelReasoningEffort: "high", @@ -269,7 +269,7 @@ describe("Codex", () => { const { args: spawnArgs, restore } = codexExecSpy(); 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({ networkAccessEnabled: true, @@ -300,7 +300,7 @@ describe("Codex", () => { const { args: spawnArgs, restore } = codexExecSpy(); 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({ webSearchEnabled: true, @@ -331,7 +331,7 @@ describe("Codex", () => { const { args: spawnArgs, restore } = codexExecSpy(); 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({ approvalPolicy: "on-request", @@ -371,7 +371,7 @@ describe("Codex", () => { } as const; 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(); await thread.run("structured", { outputSchema: schema }); @@ -416,7 +416,7 @@ describe("Codex", () => { }); 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(); await thread.run([ @@ -445,7 +445,7 @@ describe("Codex", () => { }); 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] = [ path.join(tempDir, "first.png"), path.join(tempDir, "second.jpg"), @@ -455,7 +455,7 @@ describe("Codex", () => { }); 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(); await thread.run([ @@ -494,9 +494,9 @@ describe("Codex", () => { const { args: spawnArgs, restore } = codexExecSpy(); try { - const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "codex-working-dir-")); - const client = new Codex({ - codexPathOverride: codexExecPath, + const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "llmx-working-dir-")); + const client = new LLMX({ + llmxPathOverride: codexExecPath, baseUrl: url, apiKey: "test", }); @@ -528,9 +528,9 @@ describe("Codex", () => { }); try { - const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "codex-working-dir-")); - const client = new Codex({ - codexPathOverride: codexExecPath, + const workingDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "llmx-working-dir-")); + const client = new LLMX({ + llmxPathOverride: codexExecPath, baseUrl: url, 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({ statusCode: 200, responseBodies: [sse(responseStarted(), assistantMessage("Hi!"), responseCompleted())], }); 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(); await thread.run("Hello, originator!"); @@ -579,7 +579,7 @@ describe("Codex", () => { }); 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(); await expect(thread.run("fail")).rejects.toThrow("stream disconnected before completion:"); } finally { diff --git a/sdk/typescript/tests/runStreamed.test.ts b/sdk/typescript/tests/runStreamed.test.ts index 6cdf22fe..6d199f43 100644 --- a/sdk/typescript/tests/runStreamed.test.ts +++ b/sdk/typescript/tests/runStreamed.test.ts @@ -2,7 +2,7 @@ import path from "node:path"; import { describe, expect, it } from "@jest/globals"; -import { Codex } from "../src/codex"; +import { LLMX } from "../src/llmx"; import { ThreadEvent } from "../src/index"; import { @@ -13,9 +13,9 @@ import { startResponsesTestProxy, } 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 () => { const { url, close } = await startResponsesTestProxy({ statusCode: 200, @@ -23,7 +23,7 @@ describe("Codex", () => { }); 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 result = await thread.runStreamed("Hello, world!"); @@ -82,7 +82,7 @@ describe("Codex", () => { }); 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 first = await thread.runStreamed("first input"); @@ -128,7 +128,7 @@ describe("Codex", () => { }); 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 first = await originalThread.runStreamed("first input"); @@ -180,7 +180,7 @@ describe("Codex", () => { } as const; 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 streamed = await thread.runStreamed("structured", { outputSchema: schema });