mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:30:43 +00:00
30 lines
706 B
TypeScript
30 lines
706 B
TypeScript
import type {
|
|
CliBackendPreparedExecution,
|
|
CliBackendPrepareExecutionContext,
|
|
} from "openclaw/plugin-sdk/cli-backend";
|
|
import { prepareCodexAuthBridge } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
|
|
export async function prepareOpenAICodexCliExecution(
|
|
ctx: CliBackendPrepareExecutionContext,
|
|
): Promise<CliBackendPreparedExecution | null> {
|
|
if (!ctx.agentDir || !ctx.authProfileId) {
|
|
return null;
|
|
}
|
|
|
|
const bridge = await prepareCodexAuthBridge({
|
|
agentDir: ctx.agentDir,
|
|
bridgeDir: "cli-auth",
|
|
profileId: ctx.authProfileId,
|
|
});
|
|
if (!bridge) {
|
|
return null;
|
|
}
|
|
|
|
return {
|
|
env: {
|
|
CODEX_HOME: bridge.codexHome,
|
|
},
|
|
clearEnv: bridge.clearEnv,
|
|
};
|
|
}
|