CompositeSink (composite.ts)

open-multi-agent · infra

Trace sink that fans out records to multiple child sinks, combining their status and statistics while ensuring one child's failure doesn't block others.

// Source: https://github.com/open-multi-agent/open-multi-agent | License: MIT | Copyright Shenzhen YuanASI Technology Co., Ltd. and open-multi-agent contributors
// Provided via justclaw.it.com; keep this notice with the code.
import type { TraceRecord } from './records.js'
import {
  DiagnosticReporter,
  emptyTraceSinkStats,
  type DiagnosticOptions,
  type FlushOptions,
  type FlushResult,
  type TraceSink,
  type TraceSinkStats,
} from './sink.js'

function combineStatus(results: readonly FlushResult[]): FlushResult['status'] {
  if (results.length === 0 || results.every((result) => result.status === 'ok')) return 'ok'
  if (results.every((result) => result.status === 'timeout')) return 'timeout'
  if (results.every((result) => result.status === 'error')) return 'error'
  return 'part

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key