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 +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";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<string> {
|
||||
async *run(args: LLMXExecArgs): AsyncGenerator<string> {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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.
|
||||
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");
|
||||
}
|
||||
|
||||
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 cleanup = async () => {
|
||||
try {
|
||||
|
||||
@@ -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,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user