AuditRecord
Defined in: audit.ts:17
One audit entry: who did what, as which identity, with what result. Recorded by auditLog() to
whichever Repository<T> the deployment configures as the sink — audit records are themselves
a normal Mantle-shaped record, not a bespoke storage concept.
Indexable
Section titled “Indexable”[
key:string]:unknown
Index signature so AuditRecord satisfies Repository<T extends Record<string, unknown>> (e.g. MemoryRepository).
Properties
Section titled “Properties”agentId?
Section titled “agentId?”
optionalagentId?:string
Defined in: audit.ts:21
Set only when the call was authorized via an agent token (HookContext.agent, see @mantlejs/auth).
agentScope?
Section titled “agentScope?”
optionalagentScope?:CapabilityScope
Defined in: audit.ts:23
The agent token’s capability scope. Present only alongside agentId.
delegatingUserId?
Section titled “delegatingUserId?”
optionaldelegatingUserId?:string
Defined in: audit.ts:25
The user who minted the agent token. Present only alongside agentId.
optionalmcp?:Record<string,unknown>
Defined in: audit.ts:39
ctx.params.mcp — origin metadata for an MCP-originated call. Under @mantlejs/mcp-code’s
code mode this is { mode: "code", executionId, scriptHash, script? }, so every service call
one agent script made shares an executionId (“what did this script do” is one find()).
method
Section titled “method”method:
string
Defined in: audit.ts:27
params?
Section titled “params?”
optionalparams?:Record<string,unknown>
Defined in: audit.ts:33
The caller’s query — ctx.params.query (filters, pagination, sort, select). Deliberately
never ctx.params.headers or the raw ctx.params.user object: those may carry bearer tokens
or other sensitive claims, and identity already has its own field (principal).
path:
string
Defined in: audit.ts:26
principal?
Section titled “principal?”
optionalprincipal?:unknown
Defined in: audit.ts:19
ctx.params.user — undefined for an unauthenticated or internal call.
resultSummary
Section titled “resultSummary”resultSummary:
string
Defined in: audit.ts:42
A short, non-exhaustive description of the outcome — never the full result payload.
status
Section titled “status”status:
"success"|"error"
Defined in: audit.ts:40
timestamp
Section titled “timestamp”timestamp:
string
Defined in: audit.ts:44
ISO 8601 timestamp of when the entry was recorded.