Class: ClaudeModelDriver
Defined in: claude/src/driver/claude-model-driver.ts:33
Runtime ModelDriver implementation for the Anthropic /v1/messages HTTP protocol (@paraharness/claude).
Resolves CLI subscription configDir OAuth tokens and EnvRef API keys at turn invocation time, preserves thinking blocks and cryptographic signature fields in rawWireFrame, enforces native output_config.format JSON-schema structured output, and prepares KV-cache-preserving forks.
Implements
Constructors
Constructor
new ClaudeModelDriver(
transport?,
modelNode?,
driverCtx?
): ClaudeModelDriver;Defined in: claude/src/driver/claude-model-driver.ts:58
Initializes a ClaudeModelDriver with an HTTP transport, optional ClaudeModelNode, and runtime context.
Defers all credential and environment variable lookups until invokeTurn() is executed.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
transport? | ClaudeHttpTransport | defaultClaudeHttpTransport | HTTP transport for /v1/messages. |
modelNode? | ClaudeModelNode | undefined | Optional bound ClaudeModelNode. |
driverCtx? | RuntimeDriverContext | undefined | Optional runtime driver context. |
Returns
ClaudeModelDriver
Methods
appendToolResultNotes()
appendToolResultNotes(
frame,
notes,
targetCallId?,
opts?
): Promise<WireFrameRecord>;Defined in: claude/src/driver/claude-model-driver.ts:134
Appends synchronization or recovery notes in-place to an Anthropic role: 'tool' or role: 'user' frame.
Updates both rawWireFrame and frame.canonical without breaking conversation role alternation.
Parameters
| Parameter | Type | Description |
|---|---|---|
frame | WireFrameRecord | Existing tool or user wire frame record. |
notes | readonly string[] | Synchronization note strings to append. |
targetCallId? | string | Optional tool callId to target on a tool frame. |
opts? | AppendToolResultNotesOptions | Optional error status override. |
Returns
Promise<WireFrameRecord>
Updated wire frame record to persist via LedgerStore.replaceMessageFrame().
Implementation of
ModelDriver.appendToolResultNotes
invokeTurn()
invokeTurn(req): Promise<ModelTurnResponse>;Defined in: claude/src/driver/claude-model-driver.ts:80
Invokes a single Anthropic /v1/messages turn over req.history and returns the raw wire frame and canonical projection.
Validates HTTP status codes before parsing bodyText so non-JSON error payloads (502 Bad Gateway) never crash with SyntaxError, and propagates HTTP 429 rate-limit responses with { status: 429, resetAtMs }.
Parameters
| Parameter | Type | Description |
|---|---|---|
req | ModelTurnRequest | Turn request payload, wire prefix, and structured output schema. |
Returns
Promise<ModelTurnResponse>
Raw wire response, canonical message, structured output, and usage metrics.
Throws
On HTTP 429 rate limits, non-2xx statuses, aborted signals, or outputSchema validation failures.
Implementation of
prepareFork()
prepareFork(ctx, target): Promise<readonly WireFrameRecord[]>;Defined in: claude/src/driver/claude-model-driver.ts:118
Synthesizes the initial WireFrameRecord[] chain for a downward fork or cross-model escalation.
Preserves byte-identical rawWireFrame payloads with cache_control: { type: 'ephemeral' } when target.substituteTombstones === false, and re-projects CanonicalMessage frames with compacted tombstones when target.substituteTombstones === true.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | ForkContext | Fork lineage, history mode, and assistant turn-batch pairing metadata. |
target | PrepareForkTarget | Target model configuration and tombstone substitution flag. |
Returns
Promise<readonly WireFrameRecord[]>
Synthesized wire frame chain to persist in LedgerStore.
Implementation of
Properties
vendor
readonly vendor: "anthropic";Defined in: claude/src/driver/claude-model-driver.ts:38
Vendor alias matching vendorId ('anthropic').
Implementation of
vendorId
readonly vendorId: "anthropic";Defined in: claude/src/driver/claude-model-driver.ts:35
Primary vendor identifier ('anthropic').