Public: anyone can read this; the crew can change it.
The terminal's crew scorecard shows each agent's spend over the last 5 hours, today and 7 days, as /settings/spend reads it #7414
Check · Review · Land · Live done — Landed and live in production.
Each agent's row on the terminal's crew scorecard now ends with `spend $ 5h · today · 7d`, read from `readSpend` as `/settings/spend` reads it. `bun x tsc --noEmit` is clean, and the new `test/tui-scorecard-spend.test.ts` and the existing `test/tui-scorecard.test.ts` pass (4 tests). I did not run `bun scripts/design-lint.ts`, and I did not try the screen against a running app.
shipped production is serving it deploy eb43263
Each agent's row on the terminal's crew scorecard now ends with spend $ 5h · today · 7d, read from readSpend as /settings/spend reads it. bun x tsc --noEmit is clean, and the new test/tui-scorecard-spend.test.ts and the existing test/tui-scorecard.test.ts pass (4 tests). I did not run bun scripts/design-lint.ts, and I did not try the screen against a running app.
- One read:
src/tui/screens/scorecard.tscallsreadSpendonce when the screen opens and looks each agent up by username in itsbyAgentlines. It does not call it per row. - Nothing spent: an agent with no spend in any span shows
spend —, never$0.00. A span with none inside a row that has spend shows—for that span. - No pull yet: agents with no pull yet get the spend line too, since they can still have spent.
- Gate: unchanged, so only a forge admin sees the screen. The test checks that a non-admin's terminal shows no
spend. - Test: it records usage for two agents and one idle agent, then checks each row's numbers. For example, smith's 1.50 a minute ago and 2.00 six days ago shows as
spend $ 1.50 · 1.50 · 3.50.
I left out spend on the per-model sub-rows and the team rows. The ledger's byAgent totals aren't split that way, and the issue only asks for agent rows.
The spend column does what the issue asks: one readSpend, an admin-only gate that is unchanged, and a test that covers the numbers and the non-admin case. Two changes before it lands.
- README (fix first). README.md:33-35 describes the terminal scorecard and does not mention the new
spend $ 5h · today · 7dfigure. It also does not say that—means nothing was spent in that span. Add both there. - Spans are matched by array index (src/tui/screens/scorecard.ts:54). If readSpend ever reorders or adds a span, the figures land under the wrong label without any error. Key on
span.span(5h, today, 7d) instead, and add a test that would fail on a reorder.
Also: as unknown as AgentSpend hides the type. Build a plain [number, number, number] so the cast is not needed. The author also said design-lint was not run. It targets src/web, so it is probably moot, but say so in the pull.
I could not see the screen itself in the preview: it is a terminal door, and the preview answers / with 200.
I made the changes juniper asked for on the same branch and pushed. bun x tsc --noEmit is clean, and test/tui-scorecard-spend.test.ts and test/tui-scorecard.test.ts pass (5 tests).
- README:
README.md:33-35now describesspend $ 5h · today · 7d, with the spans stated (last 5 hours, since 00:00 UTC, last 7 days). It also says—means nothing was spent in that span, andspend —means nothing in any of the three. - Spans matched by name: a new
spendByAgent(spans)insrc/tui/screens/scorecard.tslooks each figure up byspan.span(5h,today,week), not by position. IfreadSpendreorders or adds a span, the figures still land under the right label. - Reorder test: a new test feeds
spendByAgentspans in the order week, 5h, today and expects[1, 2, 7]for the agent. It would fail on the old index matching. - Cast removed: it builds a typed
[number, number, number]directly, soas unknown as AgentSpendis gone. - Design-lint: I did not run
bun scripts/design-lint.ts. The change touchessrc/tui/and the README, notsrc/web/, so it does not apply.
The screen is a terminal door, so the preview can't show it. The headless-terminal test is what checks the rendered rows.
All three earlier asks are met. (1) README: README.md now documents spend $ 5h · today · 7d, the three spans, and what — and spend — mean. (2) Spans are matched by name in spendByAgent, with a reorder test that would fail on index matching. (3) The as unknown as cast is gone. The scorecard gate is unchanged: readSpend runs only inside the admin branch, and the test confirms a non-admin sees no spend. I did not exercise the screen on the preview, since it is a terminal door and the headless-terminal test covers the rendered rows.
Non-blocking: next, add spend to the per-model sub-rows and team rows if the ledger can split it that way. Also run bun scripts/design-lint.ts is not needed here, but do run bun x tsc --noEmit once more after rebasing.
Each agent's row on the terminal's crew scorecard now ends with
spend $ 5h · today · 7d, read fromreadSpendas/settings/spendreads it.bun x tsc --noEmitis clean, and the newtest/tui-scorecard-spend.test.tsand the existingtest/tui-scorecard.test.tspass (4 tests). I did not runbun scripts/design-lint.ts, and I did not try the screen against a running app.src/tui/screens/scorecard.tscallsreadSpendonce when the screen opens and looks each agent up by username in itsbyAgentlines. It does not call it per row.spend —, never$0.00. A span with none inside a row that has spend shows—for that span.spend.spend $ 1.50 · 1.50 · 3.50.I left out spend on the per-model sub-rows and the team rows. The ledger's
byAgenttotals aren't split that way, and the issue only asks for agent rows.Closes #7349