@silverprotocol/claude-agent-sdk 0.12.6 → 1.0.0-rc.2

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.
package/README.md CHANGED
@@ -32,15 +32,16 @@ facet's per-field dispositions, including its disclosed `silently-dropped` gaps)
32
32
 
33
33
  | `@anthropic-ai/claude-agent-sdk` | verified | with | evidence |
34
34
  | --- | --- | --- | --- |
35
+ | `0.3.296` | 2026-10-13 | 1.0.0-rc.1 | @anthropic-ai/claude-agent-sdk 0.3.292 -> 0.3.296 (CLI 2.1.296). 0.3.296 adds two SDKStartupFailureReason values: org_config_required_unavailable, which upstream documents as possibly succeeding on retry, joins the facet's retriable set, and org_config_refused stays non-retriable (the facet change landed before this pin). 0.3.293's subagent_type rides the existing whole-frame carry unchanged; 0.3.295's overageEnabled sits on the router-plane rate_limit_event the facet does not emit. A runtime-only field the d.ts does not declare: a tool_result's tool_result_meta entries now carry permission_decision {decision, source, reason_type}, which the facet already carries verbatim on tool.done _meta["anthropic/toolResultMeta"]; the three paths are registered with the census. modelUsage per-model inputTokens is carried derived, folded into the cache-inclusive usage.byModel inputTokens, so the value-matching census now allowlists it. Live: echo-haiku55 (claude-haiku-5-5) captured green at 0.3.296 with replay and census green after those two entries; the committed cassette was kept. modelUsage costBasis for claude-haiku-5-5 now reads "list" ("unknown" at 0.3.292). |
35
36
  | `0.3.292` | 2026-10-07 | 0.12.4 | peer sweep 0.3.280 -> 0.3.292 (bundled CLI 2.1.280 -> 2.1.292) with the facet's @anthropic-ai/sdk devDependency 0.93.0 -> 0.131.0, which alone decides the facet's types (the agent SDK takes it as a peer). SDKStartupFailureReason gains provider_not_allowed, classified not retriable. The newer Anthropic types surface a latent emission defect, fixed in this cohort: a tool_result image with a file source emitted a url source with no url, and now maps to AgSource's file arm. Live: echo-sonnet55 (claude-sonnet-5-5) captured green with the same event shape as echo-sonnet5; system/init permissionMode stays "default". Census: four new 0.3.292 fields (system/init per_turn_effort_active and view_mode; result usage.fallback_credit, first seen null; result safety_stops, first seen 0) are allowlisted with no AgJSON home; carry of the last two is decided when a non-null capture lands. |
36
- | `0.3.280` | 2026-09-23 | 0.6.3 | peer sweep 0.3.272 -> 0.3.280 (SEVEN published versions 0.3.273-0.3.278 and 0.3.280; 0.3.279 has an upstream CHANGELOG entry but was never published to npm; bundled CLI 2.1.272 -> 2.1.280). SDKMessage union UNCHANGED at 39 members and SDKAssistantMessageError unchanged at 13; sdk.d.ts diff 900 lines; agentSdkTypes.d.ts and extractFromBunfs.d.ts byte-identical. claude-opus-5-5 REQUIRES this version: older CLIs still send the id to the API but canonicalise it to claude-opus-5, so they price it at Opus 5 rates, default its effort to high instead of medium and report canonicalModel claude-opus-5. HEADLINE - CL-09, a wrong mapping that predates the cohort, LIVE-CONFIRMED with a deliberately invalid key: query() yielded an assistant frame with error authentication_failed and then a success result with is_error:true and api_error_status 401. Through 0.6.2 that pair produced turn.error AND THEN turn.done{success} on the same turnId, violating the one-close invariant, and reduce() folded the turn as a SUCCESS whose result was 'Failed to authenticate. API Error: 401 API key is invalid.' From 0.6.3 the assistant error frame stashes its close and the result frame emits exactly one turn.error, now carrying the result's usage (so a long agentic turn that fails on round N keeps the cost of its earlier rounds), on either result arm - which also removes a second double close, assistant error followed by an error-subtype result. A success result with is_error:true and NO preceding assistant error frame, which 0.6.2 closed as turn.done{success}, now closes as turn.error {code: api_error_code ?? 'api_error', retriable only for status 429 or >= 500, usage}; a stored 0.6.2 turn of that shape cannot be recovered from the AgJSON alone (its result is the error text). Flush emits a stashed close with no usage if no result arrives; the first error frame wins. Folding the same live frames: 0.6.2 -> [turn.error, turn.done{success}], folded success; 0.6.3 -> [turn.error authentication_failed, retriable false], folded error. CARRIES: usage_report (fixture-only), the undeclared api_error / api_error_params / api_error_code triad, result-meta apiErrorCode and startupFailureReason (retriable false except worktree_unverified), and the undeclared decision_reason_code on permission denials. 0.3.277 changed a carried value without a marker: total_cost_usd and modelUsage now continue across resume and fork (see the SDKResultMessage note). THINKING: with thinking.display unset, CLI 2.1.280 runs its connector_text selector, in which the API returns only between-tool narration and never a thinking summary; at most an empty thinking block carrying only its signature reaches the stream (the same selector exists in CLI 2.1.272, first-party path only). The 0.6.2 refresh of partials-fable51 therefore lost the corpus's only live thinking_delta frames - two EMPTY ones: no capture had ever carried summary text - and three 0.6.3 re-captures confirmed it is systematic, not chance. A new scenario knob (thinkingDisplay) sets thinking {type: adaptive, display: summarized}, and the new thinking-fable51 seed provides streamed summary text for the first time, deterministically: 13 thinking_delta frames, all with summary text, plus a signature_delta. The SDK typed a third display value, 'highlights', but only on setMaxThinkingTokens and its control request, where the API accepts it for Anthropic-hosted sessions only. LIVE at 0.3.280: echo-, partials- and app-update-sonnet5 and echo- and partials-fable51 refreshed; app-update-fable51 DELIBERATELY HELD at its 0.3.272 capture, as the corpus's only live narration_block_indexes evidence (three 0.3.280 re-captures produced no narration); NEW thinking-fable51, echo-, partials- and app-update-opus55, and echo-opus5 (Opus 5 is also a Claude Code 2.1.280 refusal-fallback target: bio and frontier_llm refusals fall back to it, cyber refusals to claude-opus-4-8). Census, after registering init mcp_servers[].source and plugins[], the stream-event cache_creation twins and the claude-opus-5-5 modelUsage family: ZERO drops / ZERO new fields on every claude seed. A replay surface guard now fails a refresh of any of the six single-surface seeds it names (thinking-fable51, app-update-fable51, thinking-gemini38, tool-error-gemini38, echo-gpt6sol/openai, app-spec-structured-result/openai) that drops the surface the seed exists for. Facet tests 168 -> 204. |
37
+ | `0.3.280` | 2026-09-23 | 0.6.3 | peer sweep 0.3.272 -> 0.3.280 (SEVEN published versions 0.3.273-0.3.278 and 0.3.280; 0.3.279 has an upstream CHANGELOG entry but was never published to npm; bundled CLI 2.1.272 -> 2.1.280). SDKMessage union UNCHANGED at 39 members and SDKAssistantMessageError unchanged at 13; sdk.d.ts diff 900 lines; agentSdkTypes.d.ts and extractFromBunfs.d.ts byte-identical. claude-opus-5-5 REQUIRES this version: older CLIs still send the id to the API but canonicalise it to claude-opus-5, so they price it at Opus 5 rates, default its effort to high instead of medium and report canonicalModel claude-opus-5. HEADLINE - the API-error turn mapping, wrong since before the cohort, LIVE-CONFIRMED with a deliberately invalid key: query() yielded an assistant frame with error authentication_failed and then a success result with is_error:true and api_error_status 401. Through 0.6.2 that pair produced turn.error AND THEN turn.done{success} on the same turnId, violating the one-close invariant, and reduce() folded the turn as a SUCCESS whose result was 'Failed to authenticate. API Error: 401 API key is invalid.' From 0.6.3 the assistant error frame stashes its close and the result frame emits exactly one turn.error, now carrying the result's usage (so a long agentic turn that fails on round N keeps the cost of its earlier rounds), on either result arm - which also removes a second double close, assistant error followed by an error-subtype result. A success result with is_error:true and NO preceding assistant error frame, which 0.6.2 closed as turn.done{success}, now closes as turn.error {code: api_error_code ?? 'api_error', retriable only for status 429 or >= 500, usage}; a stored 0.6.2 turn of that shape cannot be recovered from the AgJSON alone (its result is the error text). Flush emits a stashed close with no usage if no result arrives; the first error frame wins. Folding the same live frames: 0.6.2 -> [turn.error, turn.done{success}], folded success; 0.6.3 -> [turn.error authentication_failed, retriable false], folded error. CARRIES: usage_report (fixture-only), the undeclared api_error / api_error_params / api_error_code triad, result-meta apiErrorCode and startupFailureReason (retriable false except worktree_unverified), and the undeclared decision_reason_code on permission denials. 0.3.277 changed a carried value without a marker: total_cost_usd and modelUsage now continue across resume and fork (see the SDKResultMessage note). THINKING: with thinking.display unset, CLI 2.1.280 runs its connector_text selector, in which the API returns only between-tool narration and never a thinking summary; at most an empty thinking block carrying only its signature reaches the stream (the same selector exists in CLI 2.1.272, first-party path only). The 0.6.2 refresh of partials-fable51 therefore lost the corpus's only live thinking_delta frames - two EMPTY ones: no capture had ever carried summary text - and three 0.6.3 re-captures confirmed it is systematic, not chance. A new scenario knob (thinkingDisplay) sets thinking {type: adaptive, display: summarized}, and the new thinking-fable51 seed provides streamed summary text for the first time, deterministically: 13 thinking_delta frames, all with summary text, plus a signature_delta. The SDK typed a third display value, 'highlights', but only on setMaxThinkingTokens and its control request, where the API accepts it for Anthropic-hosted sessions only. LIVE at 0.3.280: echo-, partials- and app-update-sonnet5 and echo- and partials-fable51 refreshed; app-update-fable51 DELIBERATELY HELD at its 0.3.272 capture, as the corpus's only live narration_block_indexes evidence (three 0.3.280 re-captures produced no narration); NEW thinking-fable51, echo-, partials- and app-update-opus55, and echo-opus5 (Opus 5 is also a Claude Code 2.1.280 refusal-fallback target: bio and frontier_llm refusals fall back to it, cyber refusals to claude-opus-4-8). Census, after registering init mcp_servers[].source and plugins[], the stream-event cache_creation twins and the claude-opus-5-5 modelUsage family: ZERO drops / ZERO new fields on every claude seed. A replay surface guard now fails a refresh of any of the six single-surface seeds it names (thinking-fable51, app-update-fable51, thinking-gemini38, tool-error-gemini38, echo-gpt6sol/openai, app-spec-structured-result/openai) that drops the surface the seed exists for. Facet tests 168 -> 204. |
37
38
  | `0.3.272` | 2026-09-15 | 0.6.2 | peer sweep 0.3.261->0.3.272 (NINE published versions: 0.3.263/265/266/267/268/269/270/271/272; 0.3.262 and 0.3.264 were never published to npm; bundled CLI 2.1.261->2.1.272). 0.3.271->0.3.272 is .d.ts-byte-identical across all four declaration files, so the type audit was derived against 0.3.271 and carries forward unchanged. SDKMessage union UNCHANGED at 39 members (drift-gate-verified); sdk.d.ts diff 610 lines, independently re-derived from both tarballs; agentSdkTypes.d.ts and bridge.d.ts byte-identical. DECLARED stream-scope additions, all three now CARRIED: resume_reason (0.3.268) on SDKAssistantMessage, SDKPartialAssistantMessage and BOTH result arms -> the THIRD leg of the user_message_uuid turn-binding family, which 0.3.269 stamps under ONE rule ('first complete assistant message as well as first stream event when partial messages are on'), so it rides the SAME bag under the SAME once-per-message flag (renamed userMessageUuidCarried -> turnBindingCarried); written outside that guard it would double-emit message.metadata on every streamed lifecycle, and a regression test pins the single emission. result_index (0.3.268, both result arms) -> ext.anthropic.result-meta.resultIndex, guarded typeof==='number' because 0 is the first result of every run; a gap in the sequence is how a consumer detects a LOST result, which is why it is carried rather than allowlisted. local_command (0.3.268, SUCCESS arm only, undocumented upstream) -> result-meta.localCommand, read through the JSON boundary because the union declares no such property; its PRESENCE is the signal (it is the only thing separating a zero-round-trip slash-command success from an empty turn) while its value is deliberately coarse upstream (any user/project/third-party command slugs to 'custom', any MCP command to 'mcp'). SDKAssistantMessageError widened 11 -> 13 members (verification_required, cloud_credential_error): both are correctly NON-retriable (one needs an out-of-band human step, the other is a credential/billing-class failure re-sending cannot clear), so the expression is unchanged, but the decision is now recorded explicitly in the same false-by-omission voice as model_not_found / account_on_hold and pinned by an exhaustive 13-member set-invariance test. UNDECLARED runtime additions, found ONLY by live capture (absent from sdk.d.ts, so no type diff could have seen them): narration_block_indexes on the assistant wrapper -> CARRIED verbatim (it names which of this frame's content blocks are user-facing narration rather than private reasoning, i.e. Anthropic's thinking.display:'updates' progress updates; a rendering decision, so lossless carry over allowlist; a per-frame content fact like `aborted`, so deliberately NOT under the turn-binding flag, and it has no stream-event twin so it cannot double-carry); wire_tool_inputs, the verbatim wire copy of each tool call's input keyed by tool_use_id; and five null-only leaves (event.message.container, event.message.context_management, event.delta.container, usage.iterations[*].model, event.usage.iterations[*].model) allowlisted null-only as stream-event twins of already-allowlisted complete-frame siblings. CENSUS MACHINERY: wire_tool_inputs' keys are per-capture tool ids, so every capture minted a brand-new norm-path and the newFields gate could never be satisfied; normalizePath now collapses the key directly under an explicit ID_KEYED_CONTAINERS list to {id}, the same way it collapses [n] to [*]. The list is explicit, not a key-shape heuristic, precisely so meaningful map keys such as modelUsage.claude-sonnet-5 keep their own registry entries. LIVE at 0.3.272: all six claude seeds refreshed (echo-sonnet5, partials-sonnet5, app-update-sonnet5, echo-fable51, partials-fable51, app-update-fable51) - census ZERO drops / ZERO new fields on all six after triage. Facet tests 147 -> 168. WATCH ITEM CLOSED in part: narration_block_indexes is the first live evidence of the thinking-display 'updates' mode reaching this SDK's wire; the Agent SDK still types display as 'summarized'\|'omitted'. |
38
39
  | `0.3.261` | 2026-09-05 | 0.6.1 | peer sweep 0.3.258->0.3.261 (three patches; bundled CLI 2.1.258->2.1.261) - SDKMessage union unchanged (39 members, drift-gate-verified); sdk.d.ts diff 358 lines / 30 hunks, independently re-derived. Stream-scope field additions: user_message_uuids?: string[] on SDKAssistantMessage (first reply frame), SDKPartialAssistantMessage (first non-ping event) and both result arms (0.3.259) -> carried on the SAME three channels as the singular (wrapperMetaRaw first-block providerMetadata / block-less message.metadata; the stream arm's single message.metadata emit; result-meta.userMessageUuids camelCase) under the shared once-per-message flag - a CONSISTENCY carry: the string-prompt capture path supplies no client uuid, so no cassette has ever exercised the singular or the plural; SDKThinkingTokensMessage.user_message_uuid (0.3.260) rides the existing whole-frame carry; SDKResultSuccess first_content_frame_ms / first_stream_post_ms / first_stream_post_ack_ms / first_stream_post_wall_ms (0.3.260, remote-session latency) and SDKAPIRetryMessage.no_response {waited_ms, retry_wait_ms} (0.3.261) are router-plane (allowlisted + registered); the stale ttft_ms allowlist reason corrected (the facet DOES read it off the partial envelope). Control-plane only: permissionPrompts 'none', pluginDelivery 'initialize', reload_output_styles control subtype, initialize plugins/plugins_applied, get_usage skip_behaviors, settings shapes, Artifact tool schema. @anthropic-ai/sdk 0.124.0 is Admin-API/compliance only; the facet devDep ^0.93.0 provably cannot float (only 0.93.0 exists in >=0.93.0 <0.94.0). LIVE at 0.3.261 (CC 2.1.261): echo-sonnet5, partials-sonnet5, echo-fable51, partials-fable51, app-update-fable51 refreshed and the lagging app-update-sonnet5 (0.3.217) refreshed - census ZERO drops / ZERO new fields on all six; agjson byte-identical after regen except capture-time value drift. 8 unit tests added. Watch item: the Agent SDK still types thinking display 'summarized'\|'omitted' while @anthropic-ai/sdk 0.121.0+ types a third 'updates' mode - adoption would change thinking_delta text semantics under Fable's omitted display. |
39
40
  | `0.3.258` | 2026-09-02 | 0.5.4 | peer sweep 0.3.233->0.3.258 (20 npm versions; 17 GitHub releases) - SDKMessage union unchanged (39 members, drift-gate-verified) but SIX field-level stream additions the name-only gate cannot see (full d.ts diff, independently re-derived): ModelUsage.costBasis (0.3.246) + ModelUsage.thinkingTokens (0.3.257, subset of outputTokens) -> costBasis joins the per-model identity in ext.anthropic.result-meta, thinkingTokens -> usage.byModel[m].reasoningTokens; usage.output_tokens_details.thinking_tokens (real since the 0.3.257 fix; the old reviewed-any allowlist entry that would have masked it is DELETED) -> usage.reasoningTokens on message.end/turn.done (runtime-guarded; undeclared on the resolved @anthropic-ai/sdk 0.93.0 BetaUsage); user_message_uuid on assistant (first frame), stream_event (first non-ping) and both result arms -> wrapperMetaRaw / message.metadata / result-meta.userMessageUuid; queued_turn_count (both result arms, 0 real) -> result-meta.queuedTurnCount; tool_use_result.resourceLinks (0.3.257, runtime-only) -> tool.done providerMetadata.resourceLinks; SDKAssistantMessageError += account_on_hold (non-retriable, test); system/init effort (router-plane, allowlisted); Task* ambient/is_backgrounded/spawn_depth/resource_links ride the existing whole-frame carry. LIVE CAPTURES at 0.3.258 (Claude Code 2.1.258): echo-sonnet5 + partials-sonnet5 REFRESHED, and the FIRST claude-fable-5-1 seed trio echo-fable51 / partials-fable51 / app-update-fable51 (model GA 2026-09-01; Fable 5.1 requires CC >=2.1.257) - census caught FOUR runtime-only surfaces undeclared in the d.ts: result.subagent_stats (carried whole as result-meta.subagentStats), init.messaging_socket_path (allowlisted), thinking_delta.estimated_tokens (carried on reasoning.delta providerMetadata; core assembler gained the slot), and the first live system/thinking_tokens frames (SDKThinkingTokensMessage promoted router-plane -> carried whole-frame: the only thinking-progress signal under Fable's display:omitted), plus first observation of the typed init.terminal_slash_commands[] (allowlisted). partials-fable51 is the corpus's first live thinking_delta/signature_delta coverage (66 thinking tokens on the result frame, real non-zero reasoningTokens). Out of stream scope: PreModelSwitch/PostModelSwitch hooks, systemPrompt custom/snapshot, perTaskStopAffordance, SDK MCP server timeout, update_settings control, settings shapes, sdk-tools schemas, origin.fromMode/'projects-relay' growth inside the disclosed unread origin. Peer @anthropic-ai/sdk stays >=0.93.0 (facet devDep ^0.93.0 resolves 0.93.0; 0.123.0's BetaFallbackBlock/fallback_credit/output_tokens_details are typed-only additions - a runtime fallback block already lands as provider-raw). Pin + 9 platform-binary exclusions bumped; facet devDep ^0.3.258; 8 unit tests + 3 seeds added; full gate suite green. |
40
41
  | `0.3.233` | 2026-08-15 | 0.4.4 | peer sweep: 0.3.229->0.3.233 (four patches) - SDKMessage union unchanged (39 members, drift-gate-verified); ONE stream-wire addition: SDKAssistantMessage gained the wrapper sibling context_usage (structured twin of the /context report) - now carried verbatim via the 0.3.217 first-block providerMetadata channel (JsonValue-validated; block-less frames ride message.metadata; tests added). Everything else in the .d.ts diff is out of stream scope: SDKControlInitializeResponse fast_mode_state (control-plane init response), settings shapes (marketplaces/policyHelpers), doc comments. Pin + platform-binary exclusions bumped; facet devDep ^0.3.233. |
41
42
  | `0.3.229` | 2026-08-13 | 0.4.2 | peer sweep: 0.3.226->0.3.229 (three patches) — SDKMessage union unchanged (39 members, drift-gate-verified), wire-no-op; pin + platform-binary exclusions bumped, full gate suite green (949 workspace tests). |
42
43
  | `0.3.226` | 2026-08-09 | 0.4.1 | peer sweep: 0.3.221->0.3.226 (five patches) — SDKMessage union unchanged (39 members, drift-gate-verified in sync), wire-no-op. Pin bumped exact with platform-binary exclusion refresh; full gate suite green (109 facet tests incl. the stream_event partials suite, 949 workspace). |
43
- | `0.3.221` | 2026-08-07 | 0.3.10 | workspace#7 stream_event support: SDKPartialAssistantMessage router-plane->handled (token-granular partials mapped to first-class lifecycles under the complete arm's own ids; complete-frame dedupe via content suppression; INV-MSG preserved — live capture corpus/partials-sonnet5, claude-sonnet-5, 28 native frames incl. mid-stream complete frames and tool_result-before-message_stop ordering). SDKStatusMessage router-plane->carried (census-caught in the same capture: system/status{status:'requesting'} — agent-state signal, guuey#91's status vocabulary). Scenario enrolled in CLAUDE_SEEDS + regen targets; 109 facet tests incl. reducer-state equivalence + byte-parity; corpus-wide fold gates green. |
44
+ | `0.3.221` | 2026-08-07 | 0.3.10 | workspace#7 stream_event support: SDKPartialAssistantMessage router-plane->handled (token-granular partials mapped to first-class lifecycles under the complete arm's own ids; complete-frame dedupe via content suppression; INV-MSG preserved — live capture corpus/partials-sonnet5, claude-sonnet-5, 28 native frames incl. mid-stream complete frames and tool_result-before-message_stop ordering). SDKStatusMessage router-plane->carried (census-caught in the same capture: system/status{status:'requesting'} — agent-state signal, a reference host's status vocabulary). Scenario enrolled in CLAUDE_SEEDS + regen targets; 109 facet tests incl. reducer-state equivalence + byte-parity; corpus-wide fold gates green. |
44
45
  | `0.3.221` | 2026-08-04 | 0.3.9 | 0.3.220→0.3.221 verified a Node-stream wire no-op by full sdk.d.ts tarball diff (181 lines / 11 hunks, all accounted): SDKMessage union (38 arms), stream_event, and control types untouched; the deltas are sandbox credentials config-input widening (mode 'mask', extract/onExtractNoMatch/maskDuplicates/injectHosts), quote-style const rewrites, and two NEW browser-sdk.d.ts exports (G4_TEXT_ENVELOPE_ARM_PORTED, getSseDropCounts — flag-gated SSE frame-drop machinery, relevant only if a browser-SSE facet ever exists). Release notes (skills validation, external mcpServers pre-first-turn connect fix) alter no schema. Pin bumped; live re-capture in this cohort's capture step. |
45
46
  | `0.3.220` | 2026-07-29 | 0.3.7 | Live capture landed (echo-sonnet5 @ claude-sonnet-5, sdk 0.3.220): the result frame live-populates ALL THREE carried fields — fast_mode_disabled_reason='sdk_opt_in_required' plus canonicalModel/provider on BOTH modelUsage entries (claude-sonnet-5→{claude-sonnet-5, firstParty}; claude-haiku-4-5-20251001→{claude-haiku-4-5, firstParty}) — confirming the ext.anthropic.result-meta carry against real wire, not just synthetic frames. Census: 5 new norm-paths classified (1 value-verifying transform [*].fast_mode_disabled_reason→[*].fastModeDisabledReason + registry entries using the {*} dynamic-key wildcard for the per-model paths — [*].modelUsage.{*}.canonicalModel/provider, the wildcard's first production use); replay + census gates green, zero drops. |
46
47
  | `0.3.220` | 2026-07-29 | | fixture suite + drift gate + full 0.3.217->0.3.220 sdk.d.ts diff audit (SDKMessage union membership unchanged, no removals): every wire delta is a field addition, triaged and CARRIED in the same slice — fast_mode_disabled_reason (FastModeDisabledReason enum, on BOTH result arms) + ModelUsage canonicalModel/provider (billing rate-table selection) now ride ONE structured ext event `ext.anthropic.result-meta` emitted before the turn close (turn.done/turn.error carry no providerMetadata slot and AgUsage is a closed schema — first-class core slots are a spec-process decision, disclosed in the member notes); init's own fast_mode_disabled_reason copy stays inside the router-plane init no-op (same enum, redundant with the terminal result-frame copy this slice carries); value-level notes: result api_error_status now populates 429/529 where it was null (unread telemetry, unchanged disposition), init capabilities[] may contain 'interrupt_cancel_queued_v1' (open-set string[]; the facet never enum-gates it — init is a blanket no-op); five fixture tests added (success carry, identity-only carry, error-arm carry, absent-fields negative control, Reducer fold) |
@@ -159,7 +160,30 @@ Usage follows the AgJSON draft.5 accounting rules (spec §4):
159
160
  closes the turn as `turn.done` or, on an API error, as `turn.error`. An
160
161
  error-subtype result (`error_max_turns`, `error_during_execution`, …) carries
161
162
  its usage only when an API-error assistant message had already ended the
162
- turn; otherwise its `turn.error` carries none.
163
+ turn; otherwise its `turn.error` carries none. (A refusal: see Refusals.)
164
+
165
+ ### Refusals
166
+
167
+ The CLI sends a refusal it does not retry as an API-error assistant message
168
+ (`error: "invalid_request"`, `stop_reason: "refusal"`), then a success result
169
+ with `is_error: true`. The result closes the turn as `turn.done` with
170
+ `finishReason: "refusal"` and `safety: [{ category: "refusal", blocked: true }]`,
171
+ and keeps the error the CLI reports as its outcome
172
+ (`{ type: "error", code: "invalid_request", … }`). The refusal's
173
+ `stop_details`, with any provider credit token removed, rides
174
+ `message.metadata` on the refused message and the `turn.done`'s
175
+ `messageMetadata`. The marker is that message's `stop_reason: "refusal"`:
176
+ claude-agent-sdk sets it from 0.3.199 or earlier (the first version is not
177
+ pinned) through at least 0.3.283. The oldest supported peers, such as 0.2.76,
178
+ do not set it, so a refusal there still closes as `turn.error`.
179
+
180
+ - A result that reports the refusal by itself (`is_error: true`,
181
+ `stop_reason: "refusal"`, no error message before it) closes the same way,
182
+ with the code and message the result carries.
183
+ - A subagent's refusal whose run ends closes the nested turn as `turn.done`
184
+ with `finishReason: "refusal"` and no usage.
185
+ - A stream that ends before the result closes the turn as `turn.error`, and so
186
+ does a subagent's refusal whose run is still open at the end of the stream.
163
187
 
164
188
  ### Turn trigger
165
189
 
@@ -183,4 +207,4 @@ and subagent turns never carry it.
183
207
 
184
208
  Spec: [silverprotocol.io/AgJSON](https://silverprotocol.io/AgJSON) — canonical
185
209
  in [silverprotocol/AgJSON](https://github.com/silverprotocol/AgJSON); wire
186
- version `1.0.0-draft.8`.
210
+ version `1.0.0-rc.2`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAGL,KAAK,cAAc,EASnB,KAAK,UAAU,EAKhB,MAAM,sBAAsB,CAAC;AAO9B,KAAK,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC;AAE/D,KAAK,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AAE5C,KAAK,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;AAiC/D,iBAAS,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,cAAc,CAwB3E;AAstCD,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAqpED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,UAAU,CAIxF;AAED,eAAe,sBAAsB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAGL,KAAK,cAAc,EASnB,KAAK,UAAU,EAKhB,MAAM,sBAAsB,CAAC;AAO9B,KAAK,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC;AAE/D,KAAK,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AAE5C,KAAK,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;AAiC/D,iBAAS,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,cAAc,CAwB3E;AA4uCD,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAguED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,UAAU,CAIxF;eAEc,sBAAsB;AACrC,OAAO,EAAE,aAAa,EAAE,CAAC"}