From b8913dca6afcff84cdf04a2833d885e35635b635 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 7 Oct 2026 17:41:21 +0000 Subject: [PATCH] Add the usage split fields to the TypeScript contract authority (N3 WP6) Why: frontend and ui contracts.ts are generated from this file by make contracts; editing the generated copies directly gets reverted by the next codegen run (the Dev CI build step proves it regenerates). Evidence: GOWORK=off go test green; the shape matches the Go Usage fields added earlier. Impact: additive to the contract mirror. Refs: Agent-System-Core#2, Agent-System-Frontend#48 --- ts/types.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ts/types.ts b/ts/types.ts index 60936d3..8f2f2cc 100644 --- a/ts/types.ts +++ b/ts/types.ts @@ -59,6 +59,12 @@ export interface Usage { promptTokens: number; completionTokens: number; totalTokens: number; durationMs: number; toolCalls: number; model?: string; + // N3 计费拆分(additive;旧记录缺省为 0): + // Last* 是最近一次请求的用量,Cache* 是缓存命中累计。 + lastPromptTokens?: number; + lastCompletionTokens?: number; + cacheReadTokens?: number; + cacheWriteTokens?: number; } export interface Run {