Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Simplify Assistant token usage footer

rcourtmandd445445d938
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index e983940c9f..a179077a40 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -6819,21 +6819,7 @@
],
"coverage_gaps": [],
"candidate_lanes": [],
- "work_claims": [
- {
- "id": "codex-lane-followup-architecture-post-rc-canonicalization",
- "agent_id": "codex",
- "summary": "Align Assistant live tool progress with OpenCode source workflow",
- "target_id": "v6-product-lane-expansion",
- "claimed_at": "2026-06-06T04:02:24Z",
- "heartbeat_at": "2026-06-06T04:46:07Z",
- "expires_at": "2026-06-06T12:46:07Z",
- "work_item": {
- "kind": "lane-followup",
- "id": "architecture-post-rc-canonicalization"
- }
- }
- ],
+ "work_claims": [],
"open_decisions": [],
"source_of_truth_file": "docs/release-control/v6/internal/SOURCE_OF_TRUTH.md",
"resolved_decisions": [
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 8f4ae59507..2d66459da9 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -821,9 +821,12 @@ runtime cost control, and shared AI transport surfaces.
lines 246-264 and renders it in the prompt footer at lines 1652-1667. Pulse
adapts that source-backed contract by deriving the latest completed
`ChatMessage.tokens` with positive output tokens and rendering only the
- backend-proven total/input/output counts in the Assistant composer footer;
- cost and context-limit percentages stay absent until the runtime exposes
- those values through a governed contract.
+ backend-proven total token count as low-priority Assistant composer chrome.
+ The input/output split remains in the footer title/accessibility text, not
+ the visible transcript or composer copy, so shorthand such as `4358 in · 943
+ out` cannot read like assistant output. Cost and context-limit percentages
+ stay absent until the runtime exposes those values through a governed
+ contract.
7. Keep AI chat presentation helpers aligned through `frontend-modern/src/components/AI/Chat/` and the shared `frontend-modern/src/utils/textPresentation.ts`
8. Keep assistant drawer context, session, and org-switch reset state aligned through the shared `frontend-modern/src/stores/aiChat.ts` boundary instead of letting `frontend-modern/src/App.tsx`, `frontend-modern/src/AppLayout.tsx`, or feature callers fork their own assistant shell state
That shared drawer ownership also covers passive resource reads while the
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
index a5598530e8..4d4232627f 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -3420,8 +3420,13 @@ describe('AIChat', () => {
renderChat();
const usage = screen.getByLabelText(/Last assistant turn usage/);
- expect(usage).toHaveTextContent('700 tokens');
- expect(usage).toHaveTextContent('500 in / 200 out');
+ expect(usage).toHaveTextContent('Last turn: 700 tokens');
+ expect(usage).not.toHaveTextContent('500 in');
+ expect(usage).not.toHaveTextContent('200 out');
+ expect(usage).toHaveAttribute(
+ 'title',
+ 'Last assistant turn usage: 700 total, 500 input, 200 output',
+ );
});
it('uses the latest completed assistant turn with output tokens', () => {
@@ -3448,8 +3453,9 @@ describe('AIChat', () => {
renderChat();
const usage = screen.getByLabelText(/Last assistant turn usage/);
- expect(usage).toHaveTextContent('150 tokens');
- expect(usage).toHaveTextContent('100 in / 50 out');
+ expect(usage).toHaveTextContent('Last turn: 150 tokens');
+ expect(usage).not.toHaveTextContent('100 in');
+ expect(usage).not.toHaveTextContent('50 out');
expect(usage).not.toHaveTextContent('1,700 tokens');
});
diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsx
index 11628efc99..6f375dbd37 100644
--- a/frontend-modern/src/components/AI/Chat/index.tsx
+++ b/frontend-modern/src/components/AI/Chat/index.tsx
@@ -130,7 +130,6 @@ interface ComposerDraftStash {
}
interface AssistantUsageSummary {
- detail: string;
label: string;
title: string;
}
@@ -168,8 +167,6 @@ const getAssistantUsageSummary = (message: ChatMessage): AssistantUsageSummary |
const total = input + output;
const totalLabel = `${formatAssistantTokenCount(total)} ${total === 1 ? 'token' : 'tokens'}`;
- const inputLabel = `${formatAssistantTokenCount(input)} in`;
- const outputLabel = `${formatAssistantTokenCount(output)} out`;
const titleDetail = [
`${formatAssistantTokenCount(total)} total`,
`${formatAssistantTokenCount(input)} input`,
@@ -177,8 +174,7 @@ const getAssistantUsageSummary = (message: ChatMessage): AssistantUsageSummary |
].join(', ');
return {
- label: totalLabel,
- detail: `${inputLabel} / ${outputLabel}`,
+ label: `Last turn: ${totalLabel}`,
title: `${AI_CHAT_LAST_TURN_USAGE_LABEL}: ${titleDetail}`,
};
};
@@ -2845,13 +2841,11 @@ export const AIChat: Component<AIChatProps> = (props) => {
<Show when={lastAssistantUsage()}>
{(usage) => (
<div
- class="flex min-h-4 min-w-0 items-center justify-end gap-1.5 text-[10px] font-medium text-muted"
+ class="flex min-h-4 min-w-0 items-center justify-end text-[10px] font-medium text-muted"
aria-label={usage().title}
title={usage().title}
>
<span class="truncate">{usage().label}</span>
- <span class="h-1 w-1 shrink-0 rounded-full bg-border" aria-hidden="true" />
- <span class="shrink-0">{usage().detail}</span>
</div>
)}
</Show>