Refine codex app controls and message navigation
This commit is contained in:
@@ -235,9 +235,10 @@ function createCodexAppRuntime(deps = {}) {
|
||||
if (!nextText) return '';
|
||||
if (!entry.agentMessageItems) entry.agentMessageItems = new Map();
|
||||
const currentItemText = entry.agentMessageItems.get(itemId) || '';
|
||||
const separator = agentMessageSeparator(entry, itemId, nextText);
|
||||
entry.agentMessageItems.set(itemId, currentItemText + nextText);
|
||||
entry.fullText = (entry.fullText || '') + nextText;
|
||||
return nextText;
|
||||
entry.fullText = (entry.fullText || '') + separator + nextText;
|
||||
return separator + nextText;
|
||||
}
|
||||
|
||||
function appendAgentCompletedText(entry, item) {
|
||||
@@ -252,9 +253,18 @@ function createCodexAppRuntime(deps = {}) {
|
||||
return remainder;
|
||||
}
|
||||
if (currentItemText === text) return '';
|
||||
const separator = agentMessageSeparator(entry, item.id, text);
|
||||
entry.agentMessageItems.set(item.id, text);
|
||||
entry.fullText = (entry.fullText || '') + text;
|
||||
return text;
|
||||
entry.fullText = (entry.fullText || '') + separator + text;
|
||||
return separator + text;
|
||||
}
|
||||
|
||||
function agentMessageSeparator(entry, itemId, nextText) {
|
||||
if (entry.agentMessageItems?.get(itemId)) return '';
|
||||
const currentText = entry.fullText || '';
|
||||
if (!/\S/.test(currentText)) return '';
|
||||
const hasVisualBoundary = /\n\s*(?:---|\*\*\*|___)\s*$/.test(currentText) || /^\s*(?:---|\*\*\*|___)\s*\n/.test(String(nextText || ''));
|
||||
return hasVisualBoundary ? '' : '\n\n---\n\n';
|
||||
}
|
||||
|
||||
function updateToolResult(entry, sessionId, itemId, result, done = false, patch = {}) {
|
||||
|
||||
Reference in New Issue
Block a user