Facade for dump instances with swappable backend. Default backend: DumpMarkdownInstance.
Accepts IDumpContext on every call, constructs a scoped instance per (signalId, bucketName), and delegates with only the dumpId.
Switch backends via:
constructor();
DumpFactory: any
getInstance: any
enable: (() => (...args: any[]) => any) & ISingleshotClearable<() => (...args: any[]) => any>
Activates the adapter by subscribing to signal lifecycle events. Clears memoized instances for a signalId when it is cancelled or closed, preventing stale instances from accumulating in memory. Idempotent — subsequent calls return the same subscription handle. Must be called before any dump method is used.
disable: () => void
Deactivates the adapter by unsubscribing from signal lifecycle events. No-op if enable() was never called.
dumpAgentAnswer: (messages: MessageModel<MessageRole>[], context: IDumpContext) => Promise<void>
Persist the full message history of one agent invocation.
dumpRecord: (record: Record<string, unknown>, context: IDumpContext) => Promise<void>
Persist a flat key-value record.
dumpTable: (rows: Record<string, unknown>[], context: IDumpContext) => Promise<void>
Persist an array of objects as a table.
dumpText: (content: string, context: IDumpContext) => Promise<void>
Persist raw text content.
dumpError: (content: string, context: IDumpContext) => Promise<void>
Persist an error description.
dumpJson: (json: object, context: IDumpContext) => Promise<void>
Persist an arbitrary nested object as a fenced JSON block.
useMarkdown: () => void
Switches to markdown backend (default). Writes one .md file per call to ./dump/agent/{signalId}/{bucketName}/{dumpId}.md
useMemory: () => void
Switches to memory backend. Stores data via Memory.writeMemory.
useDummy: () => void
Switches to dummy backend. All writes are discarded.
useMarkdownMemoryBoth: () => void
Switches to dual-write backend. Writes to both Memory and Markdown simultaneously.
useDumpAdapter: (Ctor: TDumpInstanceCtor) => void
Injects a custom dump adapter implementation. Uses Reflect.construct for ES3/ES6 interop compatibility.
clear: () => void
Clears the memoized instance cache. Call this when process.cwd() changes between strategy iterations so new instances are created with the updated base path.