From cff355d7e636740a52f0b83613789d60fa825bee Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 7 Oct 2026 17:12:24 +0000 Subject: [PATCH] Carry the split usage fields through squad events (N3 WP6) Why: the exec bridge now threads Last*/cache (Agent-Native#39); squad ProcessEvent carries them to hosts (the product's squad runner reads them for usage accounting). Evidence: GOWORK=off go vet green across squad and adapters/native; nested pin at the merged native. Impact: additive event fields. Refs: Agent-Native#39, N3 plan WP6 --- adapters/native/register.go | 2 ++ deps/agent-native | 2 +- squad/port.go | 17 +++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/adapters/native/register.go b/adapters/native/register.go index 2b064c8..d129716 100644 --- a/adapters/native/register.go +++ b/adapters/native/register.go @@ -138,6 +138,8 @@ func toNative(req squad.ExecRequest) exec.Request { prev(squad.ProcessEvent{ Type: ev.Type, Text: ev.Text, Tool: ev.Tool, Detail: ev.Detail, PromptTokens: ev.PromptTokens, CompletionTokens: ev.CompletionTokens, + LastPromptTokens: ev.LastPromptTokens, LastCompletionTokens: ev.LastCompletionTokens, + CacheReadTokens: ev.CacheReadTokens, CacheWriteTokens: ev.CacheWriteTokens, }) } } diff --git a/deps/agent-native b/deps/agent-native index 2eccf3f..1ac21c6 160000 --- a/deps/agent-native +++ b/deps/agent-native @@ -1 +1 @@ -Subproject commit 2eccf3f6f5f2a1c6085fc641df5b4fcb86cc5a12 +Subproject commit 1ac21c68d4e2c2728d92d6db67a30ff06e0066d3 diff --git a/squad/port.go b/squad/port.go index 8662ba0..6a1fff9 100644 --- a/squad/port.go +++ b/squad/port.go @@ -64,12 +64,17 @@ type ExecBudget struct { // ProcessEvent 是过程帧。 type ProcessEvent struct { - Type string - Text string - Tool string - Detail string - PromptTokens int - CompletionTokens int + Type string + Text string + Tool string + Detail string + PromptTokens int + CompletionTokens int + // 以下在 Type=usage 时填写(N3 WP6:上一请求与缓存命中拆分)。 + LastPromptTokens int + LastCompletionTokens int + CacheReadTokens int + CacheWriteTokens int } // ExecResult 是一次步骤执行的终态。