mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-17 13:33:45 +00:00
* refactor: Move Subagent Progress State and Content Folding Into @librechat/chat * refactor: Attach the Subagent Activity Feed Through the Chat Transport * test: Tag the Subagent Activity Panel E2E Specs With Scenarios * test: Pin Replay, Ready and Live Steer Ordering Across an Activity Reconnect * fix: Stop the Subagent Activity Feed on Refusals and Bound Idle Reconnects * fix: Keep Attaching the Subagent Feed While the Child Thread Is Still Reserved * test: Read Steer Order the Same While the Child Turn Streams and Once It Settles
27 lines
1,019 B
TypeScript
27 lines
1,019 B
TypeScript
import type { SubagentUpdateEvent } from 'librechat-data-provider';
|
|
import type { SubagentContentPart, SubagentTickerLine } from '@librechat/chat';
|
|
import {
|
|
foldSubagentEvent,
|
|
initSubagentTickerState,
|
|
foldSubagentEventIntoTicker,
|
|
initSubagentAggregatorState,
|
|
} from '@librechat/chat';
|
|
|
|
/** Folds a whole event stream through the incremental aggregator the live UI uses. */
|
|
export function aggregateSubagentContent(events: SubagentUpdateEvent[]): SubagentContentPart[] {
|
|
let parts: SubagentContentPart[] = [];
|
|
let state = initSubagentAggregatorState();
|
|
for (const event of events) {
|
|
({ parts, state } = foldSubagentEvent(parts, state, event));
|
|
}
|
|
return parts;
|
|
}
|
|
|
|
/** Folds a whole event stream through the incremental ticker the live UI uses. */
|
|
export function buildSubagentTickerLines(events: SubagentUpdateEvent[]): SubagentTickerLine[] {
|
|
let state = initSubagentTickerState();
|
|
for (const event of events) {
|
|
state = foldSubagentEventIntoTicker(state, event);
|
|
}
|
|
return state.lines;
|
|
}
|