feat: improve agent collaboration observability

This commit is contained in:
2026-06-15 11:33:08 +08:00
parent 7b7c82309c
commit d5f1a4510f
13 changed files with 593 additions and 36 deletions
@@ -172,6 +172,7 @@ export function useEventHandler(config: EventHandlerConfig) {
const buildReasoningMeta = (event: StreamEvent): Partial<ReasoningStep> => {
const collaboration = event.collaboration || {};
const communication = event.communication || {};
return {
branch_id: event.branch_id,
branch_label: event.branch_label,
@@ -187,6 +188,7 @@ export function useEventHandler(config: EventHandlerConfig) {
collaboration_role:
collaboration.collaboration_role || collaboration.role || event.collaboration_role,
collaboration_mode: event.collaboration_mode || collaboration.collaboration_mode,
communication,
};
};
@@ -230,6 +232,35 @@ export function useEventHandler(config: EventHandlerConfig) {
break;
}
case 'annotation_reply':
case 'knowledge_retrieval':
case 'observation':
case 'thought':
case 'tool_call':
case 'tool_result': {
currentSteps.value.push({
type: event.type as ReasoningStep['type'],
content:
event.content ||
event.message ||
event.tool ||
event.type,
tool: event.tool,
params: event.params,
result: event.result,
node_id: event.node_id,
node_type: event.node_type,
...buildReasoningMeta(event),
status: 'completed',
timestamp: new Date().toISOString(),
});
updateAssistantMessage(msgId, {
reasoning_steps: [...currentSteps.value],
...buildMessageMeta(event),
});
break;
}
case 'answer': {
const initialMsg = messages.value.find((m) => m.id === msgId);
if (initialMsg && !initialMsg.content?.trim()) {