build: unify bun quality gate
This commit is contained in:
@@ -102,7 +102,11 @@ export class CodexAppServerClient {
|
||||
if (this.proc) return;
|
||||
|
||||
const codexPackagePath = this.require.resolve('@openai/codex/package.json');
|
||||
const codexBin = path.join(path.dirname(codexPackagePath), 'bin', 'codex.js');
|
||||
const codexBin = path.join(
|
||||
path.dirname(codexPackagePath),
|
||||
'bin',
|
||||
'codex.js',
|
||||
);
|
||||
|
||||
this.proc = spawn(process.execPath, [codexBin, 'app-server'], {
|
||||
cwd: this.cwd,
|
||||
@@ -213,15 +217,17 @@ export class CodexAppServerClient {
|
||||
throw new Error('A Codex app-server turn is already active.');
|
||||
}
|
||||
|
||||
const turnPromise = new Promise<CodexAppServerTurnResult>((resolve, reject) => {
|
||||
this.activeTurn = {
|
||||
threadId,
|
||||
state: createInitialAppServerTurnState(),
|
||||
onProgress: options.onProgress,
|
||||
resolve,
|
||||
reject,
|
||||
};
|
||||
});
|
||||
const turnPromise = new Promise<CodexAppServerTurnResult>(
|
||||
(resolve, reject) => {
|
||||
this.activeTurn = {
|
||||
threadId,
|
||||
state: createInitialAppServerTurnState(),
|
||||
onProgress: options.onProgress,
|
||||
resolve,
|
||||
reject,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
let turnId = '';
|
||||
try {
|
||||
@@ -285,14 +291,16 @@ export class CodexAppServerClient {
|
||||
throw new Error('A Codex app-server turn is already active.');
|
||||
}
|
||||
|
||||
const turnPromise = new Promise<CodexAppServerTurnResult>((resolve, reject) => {
|
||||
this.activeTurn = {
|
||||
threadId,
|
||||
state: createInitialAppServerTurnState(),
|
||||
resolve,
|
||||
reject,
|
||||
};
|
||||
});
|
||||
const turnPromise = new Promise<CodexAppServerTurnResult>(
|
||||
(resolve, reject) => {
|
||||
this.activeTurn = {
|
||||
threadId,
|
||||
state: createInitialAppServerTurnState(),
|
||||
resolve,
|
||||
reject,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
try {
|
||||
await this.request('thread/compact/start', { threadId });
|
||||
|
||||
@@ -37,10 +37,7 @@ export type AppServerTurnEvent =
|
||||
turn?: {
|
||||
id?: string | null;
|
||||
status?: string | null;
|
||||
error?:
|
||||
| { message?: string | null }
|
||||
| string
|
||||
| null;
|
||||
error?: { message?: string | null } | string | null;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -99,10 +99,7 @@ function normalizeStructuredOutput(result: string | null): {
|
||||
const envelope = parsed?.ejclaw;
|
||||
if (envelope && typeof envelope === 'object' && !Array.isArray(envelope)) {
|
||||
if (envelope.visibility === 'silent') {
|
||||
if (
|
||||
envelope.verdict !== undefined &&
|
||||
envelope.verdict !== 'silent'
|
||||
) {
|
||||
if (envelope.verdict !== undefined && envelope.verdict !== 'silent') {
|
||||
return {
|
||||
result,
|
||||
output: { visibility: 'public', text: result },
|
||||
@@ -225,7 +222,10 @@ function drainIpcInput(): string[] {
|
||||
}
|
||||
}
|
||||
|
||||
function extractImagePaths(text: string): { cleanText: string; imagePaths: string[] } {
|
||||
function extractImagePaths(text: string): {
|
||||
cleanText: string;
|
||||
imagePaths: string[];
|
||||
} {
|
||||
/** SSOT: src/agent-protocol.ts — keep in sync */
|
||||
const imagePattern = /\[Image:\s*(\/[^\]]+)\]/g;
|
||||
const imagePaths: string[] = [];
|
||||
@@ -285,24 +285,28 @@ async function executeAppServerTurn(
|
||||
retryCount = 0,
|
||||
): Promise<{ result: string | null; error?: string }> {
|
||||
let lastProgressMessage: string | null = null;
|
||||
const activeTurn = await client.startTurn(threadId, parseAppServerInput(prompt), {
|
||||
cwd: EFFECTIVE_CWD,
|
||||
model: CODEX_MODEL || undefined,
|
||||
effort: CODEX_EFFORT || undefined,
|
||||
onProgress: (message) => {
|
||||
const trimmed = message.trim();
|
||||
if (!trimmed || trimmed === lastProgressMessage) {
|
||||
return;
|
||||
}
|
||||
lastProgressMessage = trimmed;
|
||||
writeOutput({
|
||||
status: 'success',
|
||||
phase: 'progress',
|
||||
...normalizeStructuredOutput(trimmed),
|
||||
newSessionId: threadId,
|
||||
});
|
||||
const activeTurn = await client.startTurn(
|
||||
threadId,
|
||||
parseAppServerInput(prompt),
|
||||
{
|
||||
cwd: EFFECTIVE_CWD,
|
||||
model: CODEX_MODEL || undefined,
|
||||
effort: CODEX_EFFORT || undefined,
|
||||
onProgress: (message) => {
|
||||
const trimmed = message.trim();
|
||||
if (!trimmed || trimmed === lastProgressMessage) {
|
||||
return;
|
||||
}
|
||||
lastProgressMessage = trimmed;
|
||||
writeOutput({
|
||||
status: 'success',
|
||||
phase: 'progress',
|
||||
...normalizeStructuredOutput(trimmed),
|
||||
newSessionId: threadId,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
let elapsedMs = 0;
|
||||
let polling = true;
|
||||
@@ -360,7 +364,8 @@ async function executeAppServerTurn(
|
||||
}
|
||||
return {
|
||||
result,
|
||||
error: state.errorMessage || `Codex turn finished with status ${state.status}`,
|
||||
error:
|
||||
state.errorMessage || `Codex turn finished with status ${state.status}`,
|
||||
};
|
||||
} finally {
|
||||
polling = false;
|
||||
@@ -451,7 +456,11 @@ async function runAppServerSession(
|
||||
}
|
||||
|
||||
log('Starting app-server turn...');
|
||||
const { result, error } = await executeAppServerTurn(client, threadId, prompt);
|
||||
const { result, error } = await executeAppServerTurn(
|
||||
client,
|
||||
threadId,
|
||||
prompt,
|
||||
);
|
||||
|
||||
if (error) {
|
||||
const normalized = normalizeStructuredOutput(result || null);
|
||||
|
||||
@@ -167,7 +167,9 @@ describe('codex reviewer runtime guard', () => {
|
||||
true,
|
||||
);
|
||||
|
||||
expect(() => assertReadonlyWorkspaceRepoConnectivity(env, true)).not.toThrow();
|
||||
expect(() =>
|
||||
assertReadonlyWorkspaceRepoConnectivity(env, true),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it.each([
|
||||
@@ -190,7 +192,9 @@ describe('codex reviewer runtime guard', () => {
|
||||
true,
|
||||
);
|
||||
|
||||
expect(() => assertReadonlyWorkspaceRepoConnectivity(env, true)).not.toThrow();
|
||||
expect(() =>
|
||||
assertReadonlyWorkspaceRepoConnectivity(env, true),
|
||||
).not.toThrow();
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user