Anthropic Client

_archivesourcetypescript
Path: _archive/loom-stale-pre-sprint-snapshot/src/execution/anthropic-client.tsRelative: loom-stale-pre-sprint-snapshot/src/execution/anthropic-client.tsSubproject: _archiveCategory: archived
Lines: 92Bytes: 3,295Imports: 3Exports: 2

Content Preview

  1. import { withRetry } from "../lib/retry";
  2. import { LoomError } from "../types/errors";
  3. import type { AssistantBlock, ModelClient, ModelRequest, ModelTurn, StopReason } from "./ports";
  4. /**
  5. * Anthropic Messages API client (fetch-based, workerd-native).
  6. * Shapes per current docs (verified 2026-06): POST /v1/messages with
  7. * x-api-key + anthropic-version headers; response carries content blocks
  8. * (text | tool_use), stop_reason, and usage.{input,output}_tokens.
  9. * Retry policy (HC-6): 429/5xx/net