恢复 Codex PlanList 并更新发布包

This commit is contained in:
shiyue
2026-09-29 09:58:18 +08:00
parent d70bbf08d9
commit 75989cb4de
7 changed files with 139 additions and 16 deletions

View File

@@ -1539,6 +1539,7 @@ const CCWEB_TITLE_TOOL_INSTRUCTIONS = [
].join('\n');
const CODEX_APP_COLLABORATION_INSTRUCTIONS = [
CCWEB_TITLE_TOOL_INSTRUCTIONS,
'For multi-step work that warrants a progress plan, use the native update_plan tool when it is available. If it is not in the current tool list, use mcp__ccweb__ccweb_update_plan instead; send the full plan and update step statuses as work progresses. Do not use a plan for trivial tasks.',
'Codex sub-agent runtime rules:',
'- Follow the current runtime tool schema and tool descriptions; do not assume optional fields exist.',
'- Do not hard-code version-specific spawn, wait, or completion behavior in prompts.',
@@ -8414,6 +8415,30 @@ function insertJavascriptRunFailureNotice(sourceConversationId, entry = {}) {
return true;
}
function updateCcwebPlan(args = {}, sourceSessionId = '') {
const sessionId = sanitizeId(sourceSessionId);
if (!sessionId || !loadSession(sessionId)) {
return mcpToolError('conversation_not_found', '当前来源对话不存在。');
}
const entries = args.plan;
if (!Array.isArray(entries) || entries.length < 1 || entries.length > 20) {
return mcpToolError('invalid_plan', 'plan 必须包含 1 到 20 个步骤。');
}
const plan = entries.map((entry) => ({
step: typeof entry?.step === 'string' ? entry.step.trim() : '',
status: entry?.status,
}));
if (plan.some((entry) => !entry.step || entry.step.length > 500
|| !['pending', 'in_progress', 'completed'].includes(entry.status))) {
return mcpToolError('invalid_plan', '每个步骤都需要不超过 500 字的 step 和有效的 status。');
}
return {
ok: true,
plan,
progress: { completed: plan.filter((entry) => entry.status === 'completed').length, total: plan.length },
};
}
function callInternalMcpTool(tool, args, sourceSessionId, sourceHopCount, scriptContext = {}) {
switch (tool) {
case 'ccweb_internal_tools_list':
@@ -8430,6 +8455,8 @@ function callInternalMcpTool(tool, args, sourceSessionId, sourceHopCount, script
return listUserInputHistory(args, sourceSessionId);
case 'ccweb_set_title':
return setCurrentConversationTitle(args, sourceSessionId);
case 'ccweb_update_plan':
return updateCcwebPlan(args, sourceSessionId);
case 'ccweb_create_conversation':
return createMcpConversation(args, sourceSessionId, sourceHopCount);
case 'ccweb_send_message':