@openagentid/claude-agent/audit
API contract shipped by @openagentid/claude-agent 0.1.1. Exact exports, signatures, dependencies and availability.
All packages · Runnable examples · Start an agent
| Contract | Value |
|---|---|
| Package | @openagentid/claude-agent@0.1.1 |
| Entry point | @openagentid/claude-agent/audit |
| Availability | Earlier SDK compatibility |
| Reference source | Published TypeScript declarations |
| Package engines | node >=20 |
Before integrating
Declares an optional peer on @openagentid/sdk ^0.1.0, which excludes SDK 0.7.2. Reference describes the published contract; do not assume compatibility with the current SDK.
This reference is generated from the integrity-verified npm archive for this exact version. Signatures describe the public contract; they are not standalone programs. Complete examples are checked separately.
Import conditions
Use the public entry point above. The package resolves it to these shipped files; do not import its internal files directly.
| Condition | Published file |
|---|---|
| types | ./dist/audit.d.ts |
| import | ./dist/audit.js |
| require | ./dist/audit.cjs |
Exports
AuditChainConsoleAuditSinkFanOutAuditSinkGENESIS_PREV_HASHhashRecordInMemoryAuditSinkverifyChain
AuditChain
Builds and signs (hash-chains) audit records. The chain is owned by a single session — callers should construct one chain per session.
declare class AuditChain {
constructor(opts: {
sessionId: string;
agentDid: string;
sink: AuditSink;
});
append(input: {
kind: AuditKind;
name?: string;
outcome: AuditRecord["outcome"];
inputHash?: string;
outputHash?: string;
context?: Record<string, unknown>;
}): Promise<AuditRecord>;
head(): string;
}Source: @openagentid/claude-agent@0.1.1, dist/audit.d.ts:24.
ConsoleAuditSink
Audit sink that writes structured JSON to stdout — handy for dev.
declare class ConsoleAuditSink implements AuditSink {
append(record: AuditRecord): void;
}Source: @openagentid/claude-agent@0.1.1, dist/audit.d.ts:62.
FanOutAuditSink
Compose multiple sinks (records are dispatched to all in order).
declare class FanOutAuditSink implements AuditSink {
constructor(sinks: readonly AuditSink[]);
append(record: AuditRecord): Promise<void>;
}Source: @openagentid/claude-agent@0.1.1, dist/audit.d.ts:66.
GENESIS_PREV_HASH
Sentinel for the head of the chain.
declare const GENESIS_PREV_HASH: string;Source: @openagentid/claude-agent@0.1.1, dist/audit.d.ts:19.
hashRecord
Compute the hash of a record (excludes the hash field itself).
declare function hashRecord(record: AuditRecord): string;Source: @openagentid/claude-agent@0.1.1, dist/audit.d.ts:48.
InMemoryAuditSink
In-memory audit sink (handy for tests + dry runs).
declare class InMemoryAuditSink implements AuditSink {
readonly records: AuditRecord[];
append(record: AuditRecord): void;
clear(): void;
}Source: @openagentid/claude-agent@0.1.1, dist/audit.d.ts:55.
verifyChain
Verify that a previously emitted chain has not been tampered with.
declare function verifyChain(records: readonly AuditRecord[]): {
valid: boolean;
brokenAt?: number;
};Source: @openagentid/claude-agent@0.1.1, dist/audit.d.ts:50.
Supporting declarations
These package-owned declarations are referenced by the exports above. Their presence here does not make them importable from this entry point. Import only the names in Exports.
AuditKind
Categories of audit events.
Type-only declaration; it is not a runtime value.
type AuditKind = 'session.start' | 'session.stop' | 'tool.preflight' | 'tool.complete' | 'skill.preflight' | 'skill.complete' | 'message.signed' | 'policy.deny';Source: @openagentid/claude-agent@0.1.1, dist/types-BH6j5Zy9.d.ts:83.
AuditRecord
A single tamper-evident audit record.
Type-only declaration; it is not a runtime value.
interface AuditRecord {
seq: number;
timestamp: string;
sessionId: string;
agentDid: string;
kind: AuditKind;
name?: string;
outcome: 'allow' | 'deny' | 'ok' | 'error';
inputHash?: string;
outputHash?: string;
prevHash: string;
hash: string;
context?: Record<string, unknown>;
}Source: @openagentid/claude-agent@0.1.1, dist/types-BH6j5Zy9.d.ts:56.
AuditSink
Audit sink — receives one record per tool / skill invocation.
Type-only declaration; it is not a runtime value.
interface AuditSink {
append(record: AuditRecord): Promise<void> | void;
}Source: @openagentid/claude-agent@0.1.1, dist/types-BH6j5Zy9.d.ts:51.
Package requirements
Peer dependencies
| Package | Published range | Optional |
|---|---|---|
| @anthropic-ai/claude-agent-sdk | >=0.1.0 | No |
| @openagentid/sdk | ^0.1.0 | Yes |
Archive verification
Pinned integrity:
sha512-kUX3T6aS6PYr0GqQmLG7t2DLeOquNBVAoDkXN1yk09ffh6S5TIuHQgA2jptxjgLetu4n3XXP0AmEFb+jgQ1Dow==