taskchef 7.25.0 → 7.25.1

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.
@@ -41,6 +41,22 @@ describe("task list usage summary", () => {
41
41
  );
42
42
  });
43
43
 
44
+ test("keeps the known task total visible while an active turn updates usage", () => {
45
+ renderUsage(fixtureTask({
46
+ status: "working",
47
+ turnRef: "turn-two",
48
+ usage: {
49
+ generationTurnRef: "turn-one",
50
+ status: "unavailable",
51
+ reason: "Token usage calculation was interrupted.",
52
+ task: { totalTokens: 1_324_567, estimatedCostUsd: 12.3449 },
53
+ },
54
+ }));
55
+ const summary = screen.getByText("1.32M tokens · est. $12.34 · Updating…");
56
+ expect(summary).toHaveAttribute("data-usage-state", "ready");
57
+ expect(summary).toHaveAccessibleName(/1,324,567 tokens; estimated cost \$12\.34; updating/i);
58
+ });
59
+
44
60
  test("keeps pending and calculating wording distinct and uses the restrained shimmer", () => {
45
61
  const { rerender } = renderUsage();
46
62
  expect(screen.getByText("Token usage pending")).toHaveClass("taskchef-shimmer");
@@ -119,7 +119,8 @@ export function listUsageView(task: Task): ListUsageView {
119
119
  const cost = view.usage.estimatedCostUsd == null
120
120
  ? "cost unavailable"
121
121
  : `est. ${formatEstimatedCost(view.usage.estimatedCostUsd)}`;
122
- const qualifier = view.knownSoFar ? " · known so far" : "";
122
+ const qualifier = view.knownSoFar ? " · Updating…" : "";
123
+ const accessibleQualifier = view.knownSoFar ? "; updating" : "";
123
124
  const freshness = view.usage.sourceUpdatedAt ?? view.usage.sampledAt ?? task.usage?.updatedAt ?? null;
124
125
  const freshnessLabel = freshness && !Number.isNaN(Date.parse(freshness))
125
126
  ? ` Cached usage updated ${new Date(freshness).toLocaleString()}.`
@@ -127,12 +128,12 @@ export function listUsageView(task: Task): ListUsageView {
127
128
  return {
128
129
  accessibleLabel: `${fullTokens} tokens; ${view.usage.estimatedCostUsd == null
129
130
  ? "estimated cost unavailable"
130
- : `estimated cost ${formatEstimatedCost(view.usage.estimatedCostUsd)}`}${view.knownSoFar ? "; known so far" : ""}.${freshnessLabel}`,
131
+ : `estimated cost ${formatEstimatedCost(view.usage.estimatedCostUsd)}`}${accessibleQualifier}.${freshnessLabel}`,
131
132
  kind: "ready",
132
133
  label: `${compactTokens} tokens · ${cost}${qualifier}`,
133
134
  title: `${fullTokens} tokens · ${view.usage.estimatedCostUsd == null
134
135
  ? "estimated cost unavailable"
135
- : `unrounded estimate $${view.usage.estimatedCostUsd}`}${view.knownSoFar ? " · known so far" : ""}.${freshnessLabel}`,
136
+ : `unrounded estimate $${view.usage.estimatedCostUsd}`}${qualifier}.${freshnessLabel}`,
136
137
  };
137
138
  }
138
139
 
package/src/dashboard.js CHANGED
@@ -293,6 +293,7 @@ export function taskListUsageProjection(task, cached, {
293
293
  }
294
294
  if (calculatingUsageIsStale(cached, now, calculatingStaleMs)) {
295
295
  return {
296
+ ...cachedUsageSummary(cached),
296
297
  generationTurnRef: cached.generationTurnRef ?? latestTurnRef,
297
298
  status: "unavailable",
298
299
  reason: "Token usage calculation was interrupted.",