@voightxyz/anthropic 0.1.0-beta.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +49 -20
  3. package/package.json +2 -3
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.0] — 2026-05-16
6
+
7
+ First stable release. Consolidates beta.1 and beta.2.
8
+
9
+ ### Capabilities
10
+
11
+ - `wrapAnthropic(client, options)` — two-layer Proxy (`client → messages → create`). Everything outside `messages.create` passes through untouched.
12
+ - Non-streaming Messages capture: text extracted from `content[].text` blocks, tool calls flattened from `content[].tool_use` blocks (input JSON-stringified to the same `arguments: string` shape `@voightxyz/openai` produces — dashboards render both providers identically).
13
+ - Streaming Messages capture: state machine over the typed event sequence (`message_start` / `content_block_start` / `content_block_delta` / `content_block_stop` / `message_delta` / `message_stop`). Per-index aggregator concatenates text deltas (`text_delta.text`) and tool-use deltas (`input_json_delta.partial_json`). Initial usage from `message_start` carries `input_tokens` + cache fields; final `output_tokens` lands on `message_delta`.
14
+ - Path-A token breakdown: `cache_read_input_tokens` → `metadata.tokens.cache_read`, `cache_creation_input_tokens` → `metadata.tokens.cache_creation`. Both emitted only when strictly positive. `input` + `output` + `total` always present. The backend Anthropic pricing engine applies the 0.10× cache_read and 1.25× cache_creation multipliers automatically.
15
+ - First tool call's name mirrored into top-level `toolExecuted` so the audit-log DETAIL column renders meaningfully for LLM events (same shape used for hook events).
16
+ - `sessionId` emission: each wrapper instance resolves a UUID v4 once (or accepts an explicit override) and stamps it on `metadata.sessionId` for every event. Dashboards group events sharing a sessionId into a single trace timeline.
17
+ - Three-level privacy redaction (`minimal` / `standard` / `full`) over prompts, response text, and tool arguments via a 12-pattern catalogue. Function-call names always survive as tags.
18
+ - Fire-and-forget HTTP ingest to `https://api.voight.xyz/v1/events`. Never throws, never blocks the caller.
19
+ - API key + agent identity resolution: `voightApiKey` option → `VOIGHT_KEY` env → `null`. `agent` option → `VOIGHT_AGENT` env → `HOSTNAME` env → `'unknown-agent'`.
20
+ - Non-fatal failure modes: `enabled: false` and missing API key both return the original client untouched.
21
+
22
+ ### Tests
23
+
24
+ - 65 unit tests across privacy, identity, ingest, messages, and wrap surfaces. All green.
25
+ - End-to-end smoke verified against real Anthropic + real Voight backend: text, streaming text, tool use (both transports), `cache_read` on cached prompts.
26
+
5
27
  ## [0.1.0-beta.2] — 2026-05-16
6
28
 
7
29
  ### Added
package/README.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # @voightxyz/anthropic
2
2
 
3
- > **Beta.** API may change before the 0.1.0 stable release.
3
+ Voight observability for the Anthropic SDK. Wrap your Anthropic client and capture every Messages call — prompts, tokens, cache reads, cache creations, tool use, costs, latency, errors — surfaced live in the [Voight dashboard](https://voight.xyz).
4
4
 
5
- Voight observability for the Anthropic SDK. Wrap your Anthropic client and capture every Messages call prompts, tokens, costs, cache reads, tool use, latency, errors — surfaced live in the [Voight dashboard](https://voight.xyz).
6
-
7
- Same author and same backend as [`@voightxyz/openai`](https://www.npmjs.com/package/@voightxyz/openai). Drop in whichever provider your app uses — the events land side-by-side in your Voight dashboard.
5
+ Same backend and dashboard as [`@voightxyz/openai`](https://www.npmjs.com/package/@voightxyz/openai). Drop in whichever provider your app uses; events from both land side-by-side under the same agent.
8
6
 
9
7
  ## Install
10
8
 
11
9
  ```bash
12
- npm install @anthropic-ai/sdk @voightxyz/anthropic@beta
10
+ npm install @anthropic-ai/sdk @voightxyz/anthropic
13
11
  ```
14
12
 
15
13
  ## Quick start
@@ -24,7 +22,7 @@ const client = wrapAnthropic(new Anthropic(), {
24
22
  })
25
23
 
26
24
  const response = await client.messages.create({
27
- model: 'claude-3-5-sonnet-latest',
25
+ model: 'claude-haiku-4-5',
28
26
  max_tokens: 1024,
29
27
  messages: [{ role: 'user', content: 'Hello' }],
30
28
  })
@@ -32,22 +30,53 @@ const response = await client.messages.create({
32
30
 
33
31
  That's it — every call is captured automatically. Visit your [Voight dashboard](https://voight.xyz) to see them in real time.
34
32
 
35
- ## Status
36
-
37
- Beta scaffold — the public `wrapAnthropic` entrypoint is a pass-through today. The Messages instrument lands in the next release. Track:
33
+ ## What's captured
38
34
 
39
- | Signal | Status |
35
+ | Signal | Where it lands |
40
36
  |---|---|
41
- | Public `wrapAnthropic` surface | scaffolded |
42
- | `messages.create` non-streaming | 🟡 next release |
43
- | `messages.create` streaming (event-based) | 🟡 next release |
44
- | Token counts (input, output, cache_read, cache_creation) | 🟡 next release |
45
- | Tool use capture | 🟡 next release |
46
- | 3-level privacy redaction (minimal / standard / full) | 🟡 next release |
47
- | Embeddings | ⏳ 0.2.0 |
48
- | Vertex / Bedrock clients | ⏳ 0.2.0 |
49
-
50
- See [CHANGELOG.md](./CHANGELOG.md).
37
+ | Model id (with version suffix) | `model` |
38
+ | Prompt messages | `input.messages` |
39
+ | Response text (aggregated from `content[].text` blocks) | `metadata.responseText` |
40
+ | Token counts (input / output / total) | `metadata.tokens` |
41
+ | Cache reads (`cache_read_input_tokens`) | `metadata.tokens.cache_read` |
42
+ | Cache creations (`cache_creation_input_tokens`) | `metadata.tokens.cache_creation` |
43
+ | Tool use (full array) | `metadata.toolCalls` + `toolExecuted` |
44
+ | Streaming flag | `metadata.streaming` |
45
+ | Trace grouping (auto UUID or explicit) | `metadata.sessionId` |
46
+ | Stop reason | `metadata.finishReason` |
47
+ | Latency (ms) | `durationMs` |
48
+ | Errors (re-thrown to the caller) | `errorMessage` + `outcome: 'failed'` |
49
+
50
+ ## Supported endpoints
51
+
52
+ - `client.messages.create` — Messages API (non-streaming + streaming, tool use, cache breakpoints)
53
+
54
+ The wrapper passes everything else through untouched. Bedrock and Vertex clients are on the [0.2.0 roadmap](./CHANGELOG.md).
55
+
56
+ ## Options
57
+
58
+ | Option | Type | Default | Purpose |
59
+ | --- | --- | --- | --- |
60
+ | `voightApiKey` | string | `process.env.VOIGHT_KEY` | Your Voight key from the dashboard |
61
+ | `agent` | string | `process.env.VOIGHT_AGENT` → `HOSTNAME` → `'unknown-agent'` | Stable identifier surfaced in the dashboard |
62
+ | `apiBase` | string | `https://api.voight.xyz` | Override for self-hosted deployments |
63
+ | `privacy` | `'minimal' \| 'standard' \| 'full'` | `'standard'` | Capture aggressiveness |
64
+ | `sessionId` | string | auto UUID v4 | Trace grouping. Stable across calls of one wrapper instance |
65
+ | `enabled` | boolean | `true` | Kill switch — returns the original client untouched |
66
+
67
+ ## Privacy
68
+
69
+ Three levels apply to prompts, response text, and tool-call arguments. The function name in `toolExecuted` always survives as a tag (not user content).
70
+
71
+ | Level | Prompts | Response text | Tool arguments | Tokens / timing / model |
72
+ | --- | --- | --- | --- | --- |
73
+ | `minimal` | dropped | dropped | dropped | kept |
74
+ | `standard` (default) | scrubbed | scrubbed | scrubbed | kept |
75
+ | `full` | verbatim | verbatim | verbatim | kept |
76
+
77
+ Standard scrubs 12 patterns: PEM private keys, JWTs, Anthropic / OpenAI / Stripe live / GitHub / AWS / Slack / Voight API keys, emails, E.164 phones, and Luhn-validated credit cards.
78
+
79
+ See [CHANGELOG.md](./CHANGELOG.md) for release notes.
51
80
 
52
81
  ## License
53
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voightxyz/anthropic",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0",
4
4
  "description": "Voight observability for the Anthropic SDK. Wrap your Anthropic client and capture every Messages call — prompts, tokens, costs, cache reads, tool use, latency, errors — surfaced live in the Voight dashboard.",
5
5
  "keywords": [
6
6
  "anthropic",
@@ -60,7 +60,6 @@
60
60
  "node": ">=18"
61
61
  },
62
62
  "publishConfig": {
63
- "access": "public",
64
- "tag": "beta"
63
+ "access": "public"
65
64
  }
66
65
  }