Skip to content

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

InterfaceDescription
ToolAuditActorLightweight actor descriptor for tool-subsystem audit events.
ToolAuditEventSanitized 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 AliasDescription
ToolAuditActionDiscriminator for the audit-event family emitted by the tools subsystem.
ToolAuditDecisionDecision recorded by an audit event.

Functions

FunctionDescription
_getToolAuditListenerCountForTestingSnapshot of currently-registered listener count. Used by tests.
_resetToolAuditListenersForTestingReset listener registry. Used by tests.
createRegisteredEventConvenience 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.
emitToolAuditEmit an audit event. Never throws across listener boundaries — a listener that throws is isolated so it cannot tear down the tool execution path.
onToolAuditSubscribe 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