MCPcopy
hub / github.com/simstudioai/sim / trimConsoleEntries

Function trimConsoleEntries

apps/sim/stores/terminal/console/utils.ts:300–319  ·  view source on GitHub ↗
(entries: ConsoleEntry[])

Source from the content-addressed store, hash-verified

298 * Applies workflow-level trimming while preserving newest-first order.
299 */
300export function trimConsoleEntries(entries: ConsoleEntry[]): ConsoleEntry[] {
301 const workflowGroups = new Map<string, ConsoleEntry[]>()
302
303 for (const entry of entries) {
304 const workflowEntries = workflowGroups.get(entry.workflowId)
305 if (workflowEntries) {
306 workflowEntries.push(entry)
307 } else {
308 workflowGroups.set(entry.workflowId, [entry])
309 }
310 }
311
312 const keptEntryIds = new Set<string>()
313
314 for (const workflowEntries of workflowGroups.values()) {
315 trimWorkflowConsoleEntries(workflowEntries).forEach((entry) => keptEntryIds.add(entry.id))
316 }
317
318 return entries.filter((entry) => keptEntryIds.has(entry.id))
319}

Callers 1

utils.test.tsFile · 0.90

Calls 5

getMethod · 0.65
setMethod · 0.65
pushMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected