Repository navigation
feat(dashboard): web chat client self-declares source='dashboard' - #188
Merged
Merged
Conversation
The in-browser dashboard chat (web/), the Electron desktop app, and the Ink TUI all drive the same tui_gateway JSON-RPC server, which stamps platform='tui' by default. PR #175 taught the Electron app + backend to thread a client 'source' so turns are attributed per-client (desktop/dashboard/mobile) on the token dashboard — but the WEB dashboard client (web/src/lib/gatewayClient.ts) was never updated, so browser-dashboard turns still recorded as 'tui'. Override GatewayClient.request to stamp source:'dashboard' on the session-originating methods (session.create/session.resume) when the caller hasn't set an explicit source (the sidebar sidecar session deliberately sends source:'tool'). Mirrors the Electron app's requestGateway injection exactly. Backend already sanitizes + threads source -> AIAgent(platform=...) (#175); no backend change needed. Test: web/src/lib/gatewayClient.test.ts (4) — stamps create/resume, skips other methods, never overrides an explicit source.
|
| Filename | Overview |
|---|---|
| web/src/lib/gatewayClient.ts | Adds dashboard source tagging for session-originating gateway requests while preserving explicit caller sources. |
| web/src/lib/gatewayClient.test.ts | Adds tests for dashboard source tagging, skipped non-session calls, and explicit source preservation. |
Reviews (3): Last reviewed commit: "ci: re-trigger checks (apps/desktop/node..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The in-browser web dashboard chat (
web/), the Electron desktop app, and the Ink TUI all drive the sametui_gatewayJSON-RPC server, which stampsplatform='tui'by default. PR #175 taught the Electron app + backend to thread a clientsourceso turns are attributed per-client (desktop/dashboard/mobile) on tokens.ace — but the web dashboard client (web/src/lib/gatewayClient.ts) was never updated. So turns from the browser dashboard chat still recorded astui.Ground-truthed live: the user chats via the web dashboard in a browser (not the Electron app); every one of those turns recorded
platform='tui'.Fix
Override
GatewayClient.requestto stampsource:'dashboard'on the session-originating methods (session.create/session.resume) when the caller hasn't set an explicit source — the sidebar sidecar session deliberately sendssource:'tool', which is preserved. Mirrors the Electron app'srequestGatewayinjection exactly. The backend already sanitizes + threadssource→AIAgent(platform=...)(#175), so no backend change is needed.Verification
=\dashboard`,…=new Set(['session.create','session.resume'])`).web/src/lib/gatewayClient.test.ts(4): stamps create/resume, skips non-session-originating methods (prompt.submit), never overrides an explicit source./api/ws→session.create(source='dashboard')→prompt.submit→ confirmed the blackbox recordedplatform='dashboard'. tokens.ace "Token sources by day" now showsdashboard+desktopas distinct sources.