feat: complete chat routing and openai onboarding
This commit is contained in:
@@ -6,6 +6,7 @@ import { access, readFile, readdir, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { discoverCodexProjectCandidates } from "./codex-session-discovery.mjs";
|
||||
import { buildCodexTaskExecution } from "./codex-task-runner.mjs";
|
||||
|
||||
async function loadConfig(configPath) {
|
||||
const raw = await readFile(resolve(configPath), "utf8");
|
||||
@@ -298,25 +299,6 @@ async function completeMasterAgentTask(config, runtime, payload) {
|
||||
};
|
||||
}
|
||||
|
||||
function buildCodexArgs(config, outputFile, prompt) {
|
||||
const args = [
|
||||
"exec",
|
||||
"--ephemeral",
|
||||
"--skip-git-repo-check",
|
||||
"-C",
|
||||
config.masterAgentWorkdir || process.cwd(),
|
||||
"-s",
|
||||
config.masterAgentSandbox || "workspace-write",
|
||||
"-o",
|
||||
outputFile,
|
||||
];
|
||||
if (config.masterAgentModel) {
|
||||
args.push("-m", config.masterAgentModel);
|
||||
}
|
||||
args.push(prompt);
|
||||
return args;
|
||||
}
|
||||
|
||||
function parseDispatchExecutionCompletion(rawOutput) {
|
||||
const trimmed = String(rawOutput || "").trim();
|
||||
if (!trimmed) {
|
||||
@@ -363,9 +345,10 @@ async function runMasterAgentTask(config, runtime, task) {
|
||||
};
|
||||
|
||||
try {
|
||||
const codexExecution = buildCodexTaskExecution(config, task, outputFile);
|
||||
await new Promise((resolveTask, rejectTask) => {
|
||||
const child = spawn("codex", buildCodexArgs(config, outputFile, task.executionPrompt), {
|
||||
cwd: config.masterAgentWorkdir || process.cwd(),
|
||||
const child = spawn("codex", codexExecution.args, {
|
||||
cwd: codexExecution.cwd,
|
||||
env: process.env,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user