fix: show full codex submit prompts
This commit is contained in:
@@ -47,6 +47,10 @@ interface CodexSubmitOptions {
|
||||
dryRun: boolean;
|
||||
}
|
||||
|
||||
interface CompactTaskMutationResponseOptions {
|
||||
fullPrompt?: boolean;
|
||||
}
|
||||
|
||||
type CodexRequestInit = { method?: string; body?: unknown };
|
||||
type CodexResponseFetcher = (path: string, init?: CodexRequestInit) => unknown;
|
||||
type AsyncCodexResponseFetcher = (path: string, init?: CodexRequestInit) => Promise<unknown>;
|
||||
@@ -800,9 +804,10 @@ function submitPayload(options: CodexSubmitOptions): Record<string, unknown> {
|
||||
};
|
||||
}
|
||||
|
||||
function compactTaskMutationResponse(task: unknown): Record<string, unknown> {
|
||||
function compactTaskMutationResponse(task: unknown, options: CompactTaskMutationResponseOptions = {}): Record<string, unknown> {
|
||||
const record = asRecord(task) ?? {};
|
||||
const taskId = asString(record.id);
|
||||
const prompt = asString(record.displayPrompt ?? record.basePrompt ?? record.prompt);
|
||||
return {
|
||||
id: taskId || null,
|
||||
queueId: record.queueId ?? null,
|
||||
@@ -820,7 +825,7 @@ function compactTaskMutationResponse(task: unknown): Record<string, unknown> {
|
||||
startedAt: record.startedAt ?? null,
|
||||
updatedAt: record.updatedAt ?? null,
|
||||
finishedAt: record.finishedAt ?? null,
|
||||
prompt: textPreview(asString(record.displayPrompt ?? record.basePrompt ?? record.prompt), 1200),
|
||||
prompt: textView(prompt, options.fullPrompt === true, 1200),
|
||||
commands: taskId.length === 0 ? null : {
|
||||
show: `bun scripts/cli.ts codex task ${taskId}`,
|
||||
trace: `bun scripts/cli.ts codex task ${taskId} --trace --tail --limit ${defaultTraceLimit}`,
|
||||
@@ -852,14 +857,14 @@ function codexSubmitTask(args: string[]): unknown {
|
||||
dryRun: true,
|
||||
request: {
|
||||
...payload,
|
||||
prompt: textPreview(options.prompt, 3000),
|
||||
prompt: textView(options.prompt, true, 3000),
|
||||
},
|
||||
};
|
||||
}
|
||||
const response = unwrapCodexResponse(coreInternalFetch(codeQueueProxyPath("/api/tasks"), { method: "POST", body: payload }));
|
||||
return {
|
||||
upstream: response.upstream,
|
||||
tasks: asArray(response.body.tasks).map(compactTaskMutationResponse),
|
||||
tasks: asArray(response.body.tasks).map((task) => compactTaskMutationResponse(task, { fullPrompt: true })),
|
||||
queue: compactQueueMutationSummary(response.body.queue),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user