Package com.tnsai.accountability
Interface LiabilitySink
- All Known Implementing Classes:
RecordingLiabilitySink
public interface LiabilitySink
Optional sink for
AgentLiabilityRecords (TNS-298). When explicitly
configured, each agent dispatch publishes a record for later inspection.
Without a sink, the framework does not construct or retain liability records.
Implementations
Default impls ship incom.tnsai.accountability:
RecordingLiabilitySink— in-memory; intended for tests.- Consumer implementations may supply their own retention backend.
The framework supplies neither a filesystem writer nor a no-op fallback.
Retention is an explicit deployment choice through
AgentBuilder.liabilitySink.
Concurrency
Implementations MUST be safe to call concurrently from multiple dispatch threads.record(com.tnsai.accountability.AgentLiabilityRecord) is on the hot path — every action
goes through it — so impls should either be lock-free or hold the
lock briefly.
Append-only contract
Implementations SHOULD enforce write-once semantics — no edits, no deletes. Auditors trust that what they read today is what was written. In-memory implementations can document the looseness; durable backends use object-lock / immutable storage where possible.- Since:
- 0.10.0 (TNS-298)
-
Method Summary
Modifier and TypeMethodDescriptionquery(AuditQuery q) Stream records matchingqin invocation-order (oldest first).voidPersist a record.
-
Method Details
-
record
Persist a record. Returns when the entry is durable in the implementation's backing store. Implementations MUST NOT swallow exceptions — a sink failure under load is an operational incident that needs to surface.- Throws:
NullPointerException- ifrecis null
-
query
Stream records matchingqin invocation-order (oldest first). Stream MUST be closed by the caller — durable sinks may hold a cursor open.- Throws:
NullPointerException- ifqis null
-