diff --git a/dist-exe/cc-web-bun-linux-x64-baseline.tar.gz b/dist-exe/cc-web-bun-linux-x64-baseline.tar.gz index 191fc6c..95de5b3 100644 Binary files a/dist-exe/cc-web-bun-linux-x64-baseline.tar.gz and b/dist-exe/cc-web-bun-linux-x64-baseline.tar.gz differ diff --git a/lib/codex-app-runtime.js b/lib/codex-app-runtime.js index 41e8068..c07d2c0 100644 --- a/lib/codex-app-runtime.js +++ b/lib/codex-app-runtime.js @@ -235,6 +235,19 @@ function createCodexAppRuntime(deps = {}) { }; } + function isTodoListPlanDone(item, todoList) { + const status = normalizeIdentifier(item?.status || item?.state); + if (['completed', 'complete', 'done', 'success', 'succeeded', 'failed', 'error', 'cancelled', 'canceled'].includes(status)) { + return true; + } + return Array.isArray(todoList?.items) && todoList.items.length > 0 && todoList.items.every((planItem) => planItem.completed); + } + + function todoListPlanStatus(item, todoList) { + if (isTodoListPlanDone(item, todoList)) return 'completed'; + return item?.status || 'inProgress'; + } + function planUpdateItemFromParams(params = {}) { const item = params.item && typeof params.item === 'object' ? { ...params.item } : {}; return { @@ -415,12 +428,13 @@ function createCodexAppRuntime(deps = {}) { function itemMeta(item) { if (!item) return null; - if (normalizeTodoListFromPlanItem(item)) { + const todoList = normalizeTodoListFromPlanItem(item); + if (todoList) { return { kind: 'todo_list', title: 'Plan List', subtitle: item.explanation || item.title || item.tool || '', - status: item.status || null, + status: todoListPlanStatus(item, todoList), }; } switch (item.type) { @@ -748,7 +762,7 @@ function createCodexAppRuntime(deps = {}) { const item = planUpdateItemFromParams(params); const todoList = normalizeTodoListFromPlanItem(item); if (!todoList) return { done: false }; - updateToolResult(entry, sessionId, todoList.id, JSON.stringify(todoList, null, 2), false, { + updateToolResult(entry, sessionId, todoList.id, JSON.stringify(todoList, null, 2), isTodoListPlanDone(item, todoList), { name: 'PlanList', kind: 'todo_list', input: todoList,