OpenAgentIDDocumentation
API referencenpm packages@openagentid/claude-agent
OpenAgentIDAPI reference

@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

ContractValue
Package@openagentid/claude-agent@0.1.1
Entry point@openagentid/claude-agent/audit
AvailabilityEarlier SDK compatibility
Reference sourcePublished TypeScript declarations
Package enginesnode >=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.

ConditionPublished file
types./dist/audit.d.ts
import./dist/audit.js
require./dist/audit.cjs

Exports

AuditChain

Builds and signs (hash-chains) audit records. The chain is owned by a single session — callers should construct one chain per session.

Signature
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.

Signature
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).

Signature
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.

Signature
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).

Signature
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).

Signature
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.

Signature
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.

Signature
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.

Signature
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.

Signature
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

PackagePublished rangeOptional
@anthropic-ai/claude-agent-sdk&gt;=0.1.0No
@openagentid/sdk^0.1.0Yes

Archive verification

Pinned integrity:

SHA-512 integrity
sha512-kUX3T6aS6PYr0GqQmLG7t2DLeOquNBVAoDkXN1yk09ffh6S5TIuHQgA2jptxjgLetu4n3XXP0AmEFb+jgQ1Dow==

Machine-readable API manifest · Coverage

On this page