Files
llmx/llmx-rs/responses-api-proxy/npm/bin/llmx-responses-api-proxy.js
Sebastian Krüger 0c2c36e14e 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>
2025-11-11 14:43:58 +01:00

98 lines
2.2 KiB
JavaScript
Executable File

#!/usr/bin/env node
// Entry point for the LLMX responses API proxy binary.
import { spawn } from "node:child_process";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
function determineTargetTriple(platform, arch) {
switch (platform) {
case "linux":
case "android":
if (arch === "x64") {
return "x86_64-unknown-linux-musl";
}
if (arch === "arm64") {
return "aarch64-unknown-linux-musl";
}
break;
case "darwin":
if (arch === "x64") {
return "x86_64-apple-darwin";
}
if (arch === "arm64") {
return "aarch64-apple-darwin";
}
break;
case "win32":
if (arch === "x64") {
return "x86_64-pc-windows-msvc";
}
if (arch === "arm64") {
return "aarch64-pc-windows-msvc";
}
break;
default:
break;
}
return null;
}
const targetTriple = determineTargetTriple(process.platform, process.arch);
if (!targetTriple) {
throw new Error(
`Unsupported platform: ${process.platform} (${process.arch})`,
);
}
const vendorRoot = path.join(__dirname, "..", "vendor");
const archRoot = path.join(vendorRoot, targetTriple);
const binaryBaseName = "llmx-responses-api-proxy";
const binaryPath = path.join(
archRoot,
binaryBaseName,
process.platform === "win32" ? `${binaryBaseName}.exe` : binaryBaseName,
);
const child = spawn(binaryPath, process.argv.slice(2), {
stdio: "inherit",
});
child.on("error", (err) => {
console.error(err);
process.exit(1);
});
const forwardSignal = (signal) => {
if (!child.killed) {
try {
child.kill(signal);
} catch {
/* ignore */
}
}
};
["SIGINT", "SIGTERM", "SIGHUP"].forEach((sig) => {
process.on(sig, () => forwardSignal(sig));
});
const childResult = await new Promise((resolve) => {
child.on("exit", (code, signal) => {
if (signal) {
resolve({ type: "signal", signal });
} else {
resolve({ type: "code", exitCode: code ?? 1 });
}
});
});
if (childResult.type === "signal") {
process.kill(process.pid, childResult.signal);
} else {
process.exit(childResult.exitCode);
}