agent-dag 1.33.87 → 1.33.89

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>agents-deck</title>
7
7
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='84' font-size='84'%3E%E2%97%89%3C/text%3E%3C/svg%3E" />
8
- <script type="module" crossorigin src="/assets/index-qV8K11wl.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-Db1fDcyv.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-dwRx-2y0.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-dag",
3
- "version": "1.33.87",
3
+ "version": "1.33.89",
4
4
  "description": "Live deck of Claude Code and Codex agents — watch parallel subagents fork, call tools, and return on one calm canvas. Also available as npx ccdeck and npx agent-dag.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -154,7 +154,18 @@ const USAGE_FIELD_RE = {
154
154
  output_tokens: /"output_tokens"\s*:\s*(\d+)/,
155
155
  cache_read_input_tokens: /"cache_read_input_tokens"\s*:\s*(\d+)/,
156
156
  cache_creation_input_tokens: /"cache_creation_input_tokens"\s*:\s*(\d+)/,
157
+ ephemeral_1h_input_tokens: /"ephemeral_1h_input_tokens"\s*:\s*(\d+)/,
158
+ ephemeral_5m_input_tokens: /"ephemeral_5m_input_tokens"\s*:\s*(\d+)/,
157
159
  };
160
+ // The flat `cache_creation_input_tokens` says how many tokens were written to
161
+ // cache but not at which TTL, and Anthropic bills a 1-hour write at 2x input
162
+ // against the 5-minute 1.25x — CC writes 1-hour caches for most of its prefix,
163
+ // so pricing the whole lot at the cheaper rate under-reports the bill. The
164
+ // split lives in a `cache_creation` sub-object that USAGE_BLOCK_RE cannot
165
+ // reach: its `[^}]+` stops at the first `}`, which in a real transcript closes
166
+ // `server_tool_use`, several fields earlier. Match the sub-object on the raw
167
+ // line instead of on the extracted blob.
168
+ const CACHE_CREATION_BLOCK_RE = /"cache_creation"\s*:\s*\{([^}]*)\}/g;
158
169
 
159
170
  function grabUsageField(blob, key) {
160
171
  const m = blob.match(USAGE_FIELD_RE[key]);
@@ -181,6 +192,7 @@ function newTranscriptState() {
181
192
  usage: {
182
193
  input_tokens: 0, output_tokens: 0,
183
194
  cache_read_input_tokens: 0, cache_creation_input_tokens: 0,
195
+ ephemeral_1h_input_tokens: 0, ephemeral_5m_input_tokens: 0,
184
196
  },
185
197
  ctx: newContextBreakdown(),
186
198
  };
@@ -231,6 +243,10 @@ function foldTranscriptLine(state, line) {
231
243
  state.usage.cache_read_input_tokens += grabUsageField(blob, "cache_read_input_tokens");
232
244
  state.usage.cache_creation_input_tokens += grabUsageField(blob, "cache_creation_input_tokens");
233
245
  }
246
+ for (const m of line.matchAll(CACHE_CREATION_BLOCK_RE)) {
247
+ state.usage.ephemeral_1h_input_tokens += grabUsageField(m[1], "ephemeral_1h_input_tokens");
248
+ state.usage.ephemeral_5m_input_tokens += grabUsageField(m[1], "ephemeral_5m_input_tokens");
249
+ }
234
250
 
235
251
  // Context counts only what follows the most recent /clear or /compact.
236
252
  let ctxText = line;