boardx / boardx/workspacex

data-gap(chat): 工具调用无 token 计数真实数据源(D6 后半,需后端采集)

Open
#2,275 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1h 7m
Merged PRs (30d)
969

Description

## 背景

`chat-main-fidelity-rubric.md` D6 要求过程折叠条每行工具调用右侧带 token 计数(参照图「读了 64 条 · 12.4k token」「64 命中」)。调查结论(见 #2274):

- `AgentRunView["steps"]`(`lib/agent-run.ts`)契约里没有任何 token 用量字段。
- 后端执行工具调用的路径(`execute-run.ts` 等)目前不采集/落库单次调用的 token 消耗。

要诚实实现,需要后端:
1. 在工具调用执行处采集 token 用量(依赖模型 provider 是否透传这个数字,不同 provider 可能形状不同);
2. 落库并通过 `AgentRunView["steps"]` 投影出来(新增字段,需过 `packages/contracts` 单源 + 洋葱分层)。

这是一次新的契约面改动,不是纯前端能补的空缺,需要人类/coord-architecture 排期。本 issue 只记录数据缺口,不实现、不伪造。

## 关联

总览:#2268;同批调查:#2274

Contributor guide

No contributing guide indexed for this repository

Research direction

Read lib/agent-run.ts and execute-run.ts, then trace the tool execution path and the AgentRunView["steps"] projection. Review packages/contracts for the single-source contract and layering requirements. Done means provider token usage is collected and persisted where available, exposed through the steps view, and covered across the supported provider shapes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.