chore: rebuild release package
This commit is contained in:
@@ -263,6 +263,107 @@ function createCodexAppRuntime(deps = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
function cleanRuntimeText(value) {
|
||||
return value == null ? '' : String(value).trim();
|
||||
}
|
||||
|
||||
function runtimeBasename(value) {
|
||||
const text = cleanRuntimeText(value).replace(/\\/g, '/');
|
||||
if (!text) return '';
|
||||
return text.split('/').filter(Boolean).pop() || text;
|
||||
}
|
||||
|
||||
function normalizeSubAgentActivityStatus(value, done = false) {
|
||||
const normalized = cleanRuntimeText(value).toLowerCase().replace(/[\s_-]/g, '');
|
||||
if (/^(started|interacted|interaction|message|delta|progress|updated|update)$/.test(normalized)) return 'running';
|
||||
if (/^(returned|return)$/.test(normalized)) return 'returned';
|
||||
if (/^(completed|complete|done|finished|finish|success|succeeded)$/.test(normalized)) return 'completed';
|
||||
if (/^(closed|close|closing|stopped|stop)$/.test(normalized)) return 'closed';
|
||||
if (/^(failed|fail|error|errored|cancelled|canceled|aborted|rejected)$/.test(normalized)) return 'failed';
|
||||
return done ? 'completed' : 'running';
|
||||
}
|
||||
|
||||
function firstReceiverThreadId(input = {}) {
|
||||
return Array.isArray(input.receiverThreadIds) && input.receiverThreadIds.length > 0
|
||||
? cleanRuntimeText(input.receiverThreadIds[0])
|
||||
: '';
|
||||
}
|
||||
|
||||
function normalizeSubAgentActivityItem(item = {}, done = false, previousInput = null) {
|
||||
const source = item && typeof item === 'object' ? item : {};
|
||||
const previous = previousInput && typeof previousInput === 'object' ? previousInput : {};
|
||||
const previousThreadId = firstReceiverThreadId(previous);
|
||||
const previousState = previousThreadId && previous.agentsStates && typeof previous.agentsStates === 'object'
|
||||
? previous.agentsStates[previousThreadId] || {}
|
||||
: {};
|
||||
const activityKind = cleanRuntimeText(
|
||||
source.kind
|
||||
|| source.activityKind
|
||||
|| source.activity_kind
|
||||
|| source.status
|
||||
|| (done ? 'completed' : '')
|
||||
|| previous.kind
|
||||
|| previousState.kind
|
||||
|| ''
|
||||
);
|
||||
const agentThreadId = cleanRuntimeText(
|
||||
source.agentThreadId
|
||||
|| source.agent_thread_id
|
||||
|| source.threadId
|
||||
|| source.thread_id
|
||||
|| source.childThreadId
|
||||
|| source.child_thread_id
|
||||
|| previous.agentThreadId
|
||||
|| previousThreadId
|
||||
|| previousState.agentThreadId
|
||||
|| ''
|
||||
);
|
||||
const agentPath = cleanRuntimeText(
|
||||
source.agentPath
|
||||
|| source.agent_path
|
||||
|| previous.agentPath
|
||||
|| previousState.agentPath
|
||||
|| source.agent
|
||||
|| source.name
|
||||
|| ''
|
||||
);
|
||||
const title = runtimeBasename(agentPath);
|
||||
const prompt = cleanRuntimeText(
|
||||
source.prompt
|
||||
|| source.taskDescription
|
||||
|| source.task_description
|
||||
|| previous.prompt
|
||||
|| previousState.taskDescription
|
||||
|| ''
|
||||
);
|
||||
const status = normalizeSubAgentActivityStatus(activityKind, done);
|
||||
const explicitRole = cleanRuntimeText(source.role || source.agentRole || source.agent_role);
|
||||
const state = {
|
||||
type: 'subAgentActivity',
|
||||
kind: activityKind,
|
||||
agentThreadId,
|
||||
agentPath,
|
||||
label: title || cleanRuntimeText(source.label || source.title || source.name || previousState.label || previousState.title || previousState.name || ''),
|
||||
title: title || cleanRuntimeText(source.title || source.label || source.name || previousState.title || previousState.label || previousState.name || ''),
|
||||
name: title || cleanRuntimeText(source.name || source.label || source.title || previousState.name || previousState.label || previousState.title || ''),
|
||||
role: explicitRole || cleanRuntimeText(previousState.role || ''),
|
||||
status,
|
||||
hasReadableSourceTitle: !!title,
|
||||
};
|
||||
if (prompt) state.taskDescription = truncateEnd(prompt, RUNTIME_TOOL_INPUT_MAX_CHARS);
|
||||
return {
|
||||
type: 'subAgentActivity',
|
||||
kind: activityKind,
|
||||
agentThreadId,
|
||||
agentPath,
|
||||
prompt: prompt ? truncateEnd(prompt, RUNTIME_TOOL_INPUT_MAX_CHARS) : null,
|
||||
tool: 'subAgentActivity',
|
||||
status,
|
||||
receiverThreadIds: agentThreadId ? [agentThreadId] : [],
|
||||
agentsStates: agentThreadId ? { [agentThreadId]: state } : {},
|
||||
};
|
||||
}
|
||||
|
||||
function codexAppErrorMessage(value) {
|
||||
if (!value) return '';
|
||||
if (typeof value === 'string') return value;
|
||||
@@ -324,6 +425,8 @@ function createCodexAppRuntime(deps = {}) {
|
||||
return 'dynamic_tool_call';
|
||||
case 'collabAgentToolCall':
|
||||
return 'collab_agent_tool_call';
|
||||
case 'subAgentActivity':
|
||||
return 'collab_agent_tool_call';
|
||||
case 'webSearch':
|
||||
return 'web_search';
|
||||
case 'imageView':
|
||||
@@ -350,6 +453,8 @@ function createCodexAppRuntime(deps = {}) {
|
||||
return item.tool || 'DynamicToolCall';
|
||||
case 'collabAgentToolCall':
|
||||
return item.tool || 'CollabAgentToolCall';
|
||||
case 'subAgentActivity':
|
||||
return 'subAgentActivity';
|
||||
case 'webSearch':
|
||||
return 'WebSearch';
|
||||
case 'imageGeneration':
|
||||
@@ -397,6 +502,8 @@ function createCodexAppRuntime(deps = {}) {
|
||||
receiverThreadIds: limitPreviewValue(item.receiverThreadIds || [], { maxString: 512, maxDepth: 3 }),
|
||||
agentsStates: limitPreviewValue(item.agentsStates || {}, { maxString: RUNTIME_TOOL_INPUT_MAX_CHARS, maxDepth: 5 }),
|
||||
};
|
||||
case 'subAgentActivity':
|
||||
return normalizeSubAgentActivityItem(item);
|
||||
case 'imageGeneration':
|
||||
return {
|
||||
prompt: truncateEnd(item.prompt || item.query || '', RUNTIME_TOOL_INPUT_MAX_CHARS),
|
||||
@@ -467,6 +574,15 @@ function createCodexAppRuntime(deps = {}) {
|
||||
subtitle: reasoningTextFromItem(item).replace(/\s+/g, ' ').slice(0, 120),
|
||||
status: item.status || null,
|
||||
};
|
||||
case 'subAgentActivity': {
|
||||
const activity = normalizeSubAgentActivityItem(item);
|
||||
return {
|
||||
kind: 'collab_agent_tool_call',
|
||||
title: 'subAgentActivity',
|
||||
subtitle: activity.agentPath || activity.agentThreadId || '',
|
||||
status: activity.status,
|
||||
};
|
||||
}
|
||||
default:
|
||||
return {
|
||||
kind: itemKind(item),
|
||||
@@ -513,6 +629,8 @@ function createCodexAppRuntime(deps = {}) {
|
||||
receiverThreadIds: item.receiverThreadIds || [],
|
||||
agentsStates: item.agentsStates || {},
|
||||
}, RUNTIME_TOOL_RESULT_MAX_CHARS);
|
||||
case 'subAgentActivity':
|
||||
return safeStringifyPreview(normalizeSubAgentActivityItem(item, true), RUNTIME_TOOL_RESULT_MAX_CHARS);
|
||||
case 'imageGeneration':
|
||||
return safeStringifyPreview({
|
||||
status: item.status || null,
|
||||
@@ -537,7 +655,11 @@ function createCodexAppRuntime(deps = {}) {
|
||||
toolCall.name = itemName(item);
|
||||
toolCall.kind = kind;
|
||||
toolCall.meta = itemMeta(item) || toolCall.meta || null;
|
||||
if (toolCall.input == null || kind === 'todo_list') toolCall.input = itemInput(item);
|
||||
if (item?.type === 'subAgentActivity') {
|
||||
toolCall.input = normalizeSubAgentActivityItem(item, false, toolCall.input);
|
||||
} else if (toolCall.input == null || kind === 'todo_list') {
|
||||
toolCall.input = itemInput(item);
|
||||
}
|
||||
return toolCall;
|
||||
}
|
||||
|
||||
@@ -815,13 +937,16 @@ function createCodexAppRuntime(deps = {}) {
|
||||
}
|
||||
const toolCall = ensureToolCall(entry, item, sessionId);
|
||||
if (!toolCall) return { done: false };
|
||||
const result = truncateEnd(itemResult(item), RUNTIME_TOOL_RESULT_MAX_CHARS);
|
||||
const result = item.type === 'subAgentActivity'
|
||||
? safeStringifyPreview(toolCall.input, RUNTIME_TOOL_RESULT_MAX_CHARS)
|
||||
: truncateEnd(itemResult(item), RUNTIME_TOOL_RESULT_MAX_CHARS);
|
||||
toolCall.done = true;
|
||||
toolCall.result = result;
|
||||
toolCall.meta = itemMeta(item) || toolCall.meta;
|
||||
sendRuntime(entry, sessionId, {
|
||||
type: 'tool_end',
|
||||
toolUseId: toolCall.id,
|
||||
...(item.type === 'subAgentActivity' ? { name: toolCall.name, input: toolCall.input } : {}),
|
||||
result,
|
||||
kind: toolCall.kind,
|
||||
meta: toolCall.meta,
|
||||
|
||||
Reference in New Issue
Block a user