Skip to content

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs

Comment 1, line 1

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:1

//! ZCode-specific mappings for two usage shapes, moved from root usage_map.rs under V30.

Comment 2, line 2

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:2

//! Shared MappedUsage/finish/sub_checked/contradiction checks remain in cross-product usage_map.rs.

Comment 3, line 3

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:3

//!

Comment 4, line 4

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:4

//! References: m0-agent-fixtures.md native ZCode 3.14.3 model-io JSONL checks.

Comment 5, line 5

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:5

//! One request record contains two usage representations with different input semantics:

Comment 6, line 6

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:6

//!

Comment 7, line 7

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:7

//! - AI SDK camelCase response.usage: inputTokens includes cache read; outputTokens,

Comment 8, line 8

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:8

//! totalTokens, cacheReadTokens and cacheWriteTokens complete its five keys; primary representation.

Comment 9, line 9

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:9

//! - Anthropic snake_case response.providerMetadata.anthropic.usage:

Comment 10, line 10

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:10

//! input_tokens excludes cache; output_tokens, cache_read_input_tokens and

Comment 11, line 11

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:11

//! optional cache_creation_input_tokens form the comparison representation.

Comment 12, line 12

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:12

//!

Comment 13, line 13

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:13

//! Choose one representation without adding them. Contradictions produce diagnostics; retain the primary.

Comment 14, line 19

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:19

/// ZCode AI SDK camelCase inputTokens includes cache read.

Comment 15, line 32

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:32

// Missing exclusive cache components cannot be replaced with zero to derive uncached input.

Comment 16, line 86

desktop/src-tauri/crates/core/src/adapters/zcode/common.rs:86

/// ZCode Anthropic snake_case input_tokens excludes cache, unlike the AI SDK representation.