-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(desktop): add per-agent usage dashboard #3068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ import { | |
| saveCustomHarness, | ||
| updateManagedAgent, | ||
| } from "@/shared/api/tauri"; | ||
| import { getAgentUsageDashboard } from "@/shared/api/tauriAgentUsage"; | ||
| import type { HarnessDefinitionInput } from "@/shared/api/tauri"; | ||
| import { | ||
| setManagedAgentAutoRestart, | ||
|
|
@@ -110,6 +111,7 @@ export const personasQueryKey = ["personas"] as const; | |
| export const acpRuntimesQueryKey = ["acp-runtimes"] as const; | ||
| export const acpAuthMethodsQueryKey = ["acp-auth-methods"] as const; | ||
| export const managedAgentPrereqsQueryKey = ["managed-agent-prereqs"] as const; | ||
| export const agentUsageDashboardQueryKey = ["agent-usage-dashboard"] as const; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a user creates, updates, starts, stops, or deletes an agent while this view is mounted, the existing mutation callbacks invalidate only the managed/relay-agent queries and never this new query key. Because each usage row also contains the agent's name, model, worker count, and running state, the dashboard can show obsolete metadata—or a deleted agent—for up to the 30-second polling interval unless the user manually refreshes it; include this query in the managed-agent mutation invalidation paths. Useful? React with 👍 / 👎. |
||
| export const backendProvidersQueryKey = ["backend-providers"] as const; | ||
| export const gitBashPrerequisiteQueryKey = ["git-bash-prerequisite"] as const; | ||
|
|
||
|
|
@@ -898,6 +900,16 @@ export function useManagedAgentLogQuery( | |
| }); | ||
| } | ||
|
|
||
| export function useAgentUsageDashboardQuery() { | ||
| return useQuery({ | ||
| queryKey: agentUsageDashboardQueryKey, | ||
| queryFn: getAgentUsageDashboard, | ||
| retry: false, | ||
| staleTime: 10_000, | ||
| refetchInterval: 30_000, | ||
| }); | ||
| } | ||
|
|
||
| export const agentConfigSurfaceQueryKey = (pubkey: string) => | ||
| ["agent-config-surface", pubkey] as const; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.