feat(vscode): codex 命令统一组装,模型/思考级别可在设置面板配置

新增 cc/codexCommand.ts 作为 codex 调用的唯一出口(buildCodexArgs /
buildCodexCommandString),把 exec-review / resume / interactive 三种形态
的 flag 拼装收敛到一处;模型与思考级别作为自由文本项写入全局设置并贯穿
webview 消息通道,空值则不传 -c,沿用 codex config.toml 默认。
This commit is contained in:
2026-07-13 06:43:58 +08:00
parent aff99c57f3
commit 5188c23765
11 changed files with 225 additions and 12 deletions
+22 -3
View File
@@ -9,6 +9,7 @@ import * as path from 'node:path'
import { window, workspace } from 'vscode'
import { getToken } from '../../auth/secrets'
import { buildCcCommand } from '../../cc/ccCommand'
import { buildCodexCommandString } from '../../cc/codexCommand'
import { watchForNewCodexSession } from '../../cc/codexSessionWatcher'
import { getBrainstormContinuePrompt, getImplementPlanPrompt } from '../../cc/prompts'
import { projectsDirFor, watchForNewSession } from '../../cc/sessionWatcher'
@@ -287,7 +288,13 @@ export async function handleResumeReviewSession(panel: KanbanWebviewPanel, sessi
panel.reviewTerminals.set(sessionId, terminal)
panel.trackSessionTerminal(terminal, issueNumber, 'review')
terminal.show(false)
terminal.sendText(`codex resume -c model_reasoning_effort=xhigh --dangerously-bypass-approvals-and-sandbox ${sessionId}`)
const settings = getSettings(panel.context)
terminal.sendText(buildCodexCommandString({
mode: 'resume',
sessionId,
model: settings.codexModel,
reasoningEffort: settings.codexReasoningEffort,
}))
logger.add({
level: 'info',
source: 'terminal',
@@ -418,7 +425,13 @@ export async function triggerAutoReviewTab(panel: KanbanWebviewPanel, opts: {
panel.reviewTerminals.set(existingSessionId, terminal)
panel.trackSessionTerminal(terminal, opts.issueNumber, 'review')
terminal.show(false)
terminal.sendText(`codex resume -c model_reasoning_effort=xhigh --dangerously-bypass-approvals-and-sandbox ${existingSessionId}`)
const settings = getSettings(panel.context)
terminal.sendText(buildCodexCommandString({
mode: 'resume',
sessionId: existingSessionId,
model: settings.codexModel,
reasoningEffort: settings.codexReasoningEffort,
}))
// codex resume rebuilds the conversation from the jsonl rollout
// before the TUI accepts input — empirically much slower than the
// 250ms gap the reuse path uses. 8s is a conservative guess that
@@ -494,7 +507,13 @@ export async function triggerAutoReviewTab(panel: KanbanWebviewPanel, opts: {
// the terminal alive after the run so users can follow up with codex,
// mirroring how claude implementation/brainstorm sessions stay open.
// 提示词模板自带 /review 前缀,不在这里再拼。
const cmd = `codex -c model_reasoning_effort=xhigh --dangerously-bypass-approvals-and-sandbox '${opts.prompt}'`
const settings = getSettings(panel.context)
const cmd = buildCodexCommandString({
mode: 'interactive',
prompt: opts.prompt,
model: settings.codexModel,
reasoningEffort: settings.codexReasoningEffort,
})
terminal.sendText(cmd)
logger.add({
level: 'info',