feat(ai-workspace): support SEO codex provider bridge
This commit is contained in:
@@ -1962,6 +1962,8 @@ function usesJsonOutput(args) {
|
||||
return Array.isArray(args) && args.includes('--json')
|
||||
}
|
||||
|
||||
const CODEX_ASSISTANT_TEXT_MAX = 250000
|
||||
|
||||
function truncateText(value, max = 1400) {
|
||||
const text = String(value || '').trim()
|
||||
return text.length > max ? `${text.slice(0, max).trim()}...` : text
|
||||
@@ -2209,7 +2211,7 @@ function createActiveMirror(command, payload = {}, meta = {}) {
|
||||
if (kind === 'codex_files') state.currentFiles = markdownText(event.text || text, 3000)
|
||||
if (kind === 'codex_tool') state.currentTool = markdownText(event.text || text, 3000)
|
||||
if (kind === 'codex_todo') state.currentTodo = markdownText(event.text || text, 3000)
|
||||
if (kind === 'codex_message') state.assistantText = markdownText(event.text || text, 12000)
|
||||
if (kind === 'codex_message') state.assistantText = markdownText(event.text || text, CODEX_ASSISTANT_TEXT_MAX)
|
||||
if (kind === 'done' || kind === 'codex_turn_completed') state.status = 'completed'
|
||||
if (kind === 'timeout') state.status = 'timeout'
|
||||
if (kind === 'error' && !/reconnecting/i.test(text)) state.status = 'failed'
|
||||
@@ -2225,7 +2227,7 @@ function createActiveMirror(command, payload = {}, meta = {}) {
|
||||
async complete(status, assistantText = '') {
|
||||
state.status = status
|
||||
state.finishedAt = new Date().toISOString()
|
||||
if (assistantText) state.assistantText = markdownText(assistantText, 12000)
|
||||
if (assistantText) state.assistantText = markdownText(assistantText, CODEX_ASSISTANT_TEXT_MAX)
|
||||
await write({
|
||||
at: state.finishedAt,
|
||||
kind: `mirror_${status}`,
|
||||
@@ -2361,7 +2363,7 @@ function codexJsonEventToBridgeEvent(event, reasoningSummaryState = null) {
|
||||
const text = truncateText(reasoningTextFromItem(item))
|
||||
return text ? { kind: 'codex_reasoning', message: text } : null
|
||||
}
|
||||
if (itemType === 'agent_message') return { kind: 'codex_message', message: 'Assistant response received.', text: truncateText(item.text || '') }
|
||||
if (itemType === 'agent_message') return { kind: 'codex_message', message: 'Assistant response received.', text: markdownText(item.text || '', CODEX_ASSISTANT_TEXT_MAX) }
|
||||
if (itemType === 'command_execution') {
|
||||
const status = item.status ? ` - ${item.status}` : ''
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user