Graphorin API reference v0.1.0
Graphorin API reference / @graphorin/tools / audit
audit
Audit-event emitter + counter registry for @graphorin/tools.
Two surfaces:
emitToolAudit(...)/onToolAudit(...)— sanitized audit-event broadcasting, mirroring the discipline used by@graphorin/security.incrementCounter(...)/snapshotCounters(...)— in-process metrics registry exported through CounterSnapshot.
Interfaces
| Interface | Description |
|---|---|
| ToolAuditActor | Lightweight actor descriptor for tool-subsystem audit events. |
| ToolAuditEvent | Sanitized payload emitted by the tool subsystem. Listeners receive only metadata that is safe to log — the actual tool args, the matched bytes, the secret values are NEVER forwarded. |
Type Aliases
| Type Alias | Description |
|---|---|
| ToolAuditAction | Discriminator for the audit-event family emitted by the tools subsystem. |
| ToolAuditDecision | Decision recorded by an audit event. |
Functions
| Function | Description |
|---|---|
| _getToolAuditListenerCountForTesting | Snapshot of currently-registered listener count. Used by tests. |
| _resetToolAuditListenersForTesting | Reset listener registry. Used by tests. |
| createRegisteredEvent | Convenience factory for the tool:registered audit row. Carries the resolved trust class + side-effect class + per-tool fields the downstream cassette / replay layers care about. |
| emitToolAudit | Emit an audit event. Never throws across listener boundaries — a listener that throws is isolated so it cannot tear down the tool execution path. |
| onToolAudit | Subscribe to tool-subsystem audit events. Returns a teardown function that removes the listener; callers must invoke it on shutdown to avoid leaks in long-running server processes. |
References
CounterSnapshot
Re-exports CounterSnapshot
getCounterForTesting
Re-exports getCounterForTesting
getHistogramForTesting
Re-exports getHistogramForTesting
incrementCounter
Re-exports incrementCounter
observeHistogram
Re-exports observeHistogram
resetCountersForTesting
Re-exports resetCountersForTesting
setGauge
Re-exports setGauge
snapshotCounters
Re-exports snapshotCounters