agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
37 lines (36 loc) • 1.66 kB
TypeScript
/**
* EmitBridge — forwards footprintjs emits whose name starts with a given
* prefix to the EventDispatcher, enriched with EventMeta.
*
* Pattern: Adapter (GoF) + Pipes & Filters (Hohpe & Woolf, 2003).
* Role: Single reusable translation layer for every "pass-through"
* prefix recorder (StreamRecorder, AgentRecorder, and any
* future domain whose events are emitted via typedEmit()).
* Emits: Any event whose name matches `prefix` — type derived from the
* emit name and validated by the consumer's EventMap subscription.
*/
import type { CombinedRecorder, EmitEvent } from 'footprintjs';
import type { EventDispatcher } from '../../events/dispatcher.js';
import { type RunContext } from '../../bridge/eventMeta.js';
export interface EmitBridgeOptions {
readonly dispatcher: EventDispatcher;
/** Recorder id — must be unique among attached recorders. */
readonly id: string;
/**
* Event-name prefix(es) this bridge forwards (e.g.
* 'agentfootprint.stream.'). An array forwards any event matching ANY
* of them — used when one source domain spans two event families
* (`agentfootprint.fallback.` + `agentfootprint.error.`), or to match
* exact full event names rather than a whole domain.
*/
readonly prefix: string | readonly string[];
readonly getRunContext: () => RunContext;
}
export declare class EmitBridge implements CombinedRecorder {
readonly id: string;
private readonly dispatcher;
private readonly prefixes;
private readonly getRunContext;
constructor(options: EmitBridgeOptions);
onEmit(event: EmitEvent): void;
}