Skip to content

[front] feat: wire Agents tab of the usage filter panel to real, period-scoped data - #30166

Merged
avervaet merged 8 commits into
mainfrom
avervaet/wiring-usage-filter-component-agents-tab
Aug 11, 2026
Merged

[front] feat: wire Agents tab of the usage filter panel to real, period-scoped data#30166
avervaet merged 8 commits into
mainfrom
avervaet/wiring-usage-filter-component-agents-tab

Conversation

@avervaet

@avervaet avervaet commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

This PR wires the Agents tab of the usage filter panel to real workspace data, replacing the previous static mock list with a live fetch via useAgentConfigurations.

Until now, the Agents tab was populated from a hardcoded list in usageFilterMockData.ts (SupportBot, SalesAssistant, etc.) that was period-unaware and bore no relation to actual workspace agents. Agent selection was also a no-op in the consumption scope filter sent to the analytics backend.

This PR makes three connected changes:

  1. Live agent list. UsageFilterPanel now calls useAgentConfigurations({ agentsGetView: "all" }) lazily (only when the Agents tab is open) and maps the results to UsageFilterAgentOption[], including the agent's pictureUrl as the new image field. The agent key is removed from the categoryOptions prop, mirroring the pattern already used for members and groups.

  2. Correct scope enum. The local USAGE_FILTER_SCOPES = ["company", "shared", "private"] constant is replaced with AGENT_CONFIGURATION_SCOPES from @app/types/assistant/agent. The scope labels are updated accordingly (global → "Company", visible → "Shared", hidden → "Private"). UsageFilterScope becomes an alias for AgentConfigurationScope directly.

  3. Agent filter forwarded to backend. toConsumptionScopeFilter is extended to include selected agent sIds under the agents key in the ConsumptionScopeFilter, alongside the existing users key. Previously only members were forwarded.

As a visual side-effect, agent entries in the filter list now render an Avatar (name-initials or picture) consistent with member entries, replacing the previous null icon.

Models, tools, skills, and sources remain on mock data. The mock agent names and buildAgentOptions helper are removed.

Tests

Risk

Low. The change is purely additive on the consumption filter side (an extra optional field). The agent list is fetched from the same useAgentConfigurations endpoint already used across the app. Reverting to mock data would require re-adding the agent key to categoryOptions callers and restoring the mock entries, but no data is mutated. The scope label remapping (company/shared/privateglobal/visible/hidden) is a display-layer alignment with the canonical enum and has no backend effect.

Deploy Plan

  • Deploy front

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
playground Ignored Ignored Preview Aug 11, 2026 7:17am
storybook Ignored Ignored Preview Aug 11, 2026 7:17am

Request Review

@dust-agent dust-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coding Rules LGTM \o/

@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 6a375c0 to 2f387e8 Compare August 7, 2026 10:10
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 3cf9361 to cefe50f Compare August 7, 2026 10:10
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 2f387e8 to 8ce32e5 Compare August 7, 2026 11:03
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from cefe50f to d07144c Compare August 7, 2026 11:03
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 8ce32e5 to d57fe4a Compare August 7, 2026 13:56
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from d07144c to 8eafb82 Compare August 7, 2026 13:56
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from d57fe4a to 3418019 Compare August 7, 2026 15:22
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 8eafb82 to fa3b961 Compare August 7, 2026 15:22
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 3418019 to 684c627 Compare August 7, 2026 15:39
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from fa3b961 to 943d84b Compare August 7, 2026 15:39
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 943d84b to c53d9f0 Compare August 7, 2026 16:02
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from e3b3e3a to b78e388 Compare August 10, 2026 07:21
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 3c48aec to e35ebf6 Compare August 10, 2026 07:21
export function toConsumptionScopeFilter(
filter: UsageFilter
): ConsumptionScopeFilter {
const scopeFilter: ConsumptionScopeFilter = {};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is uniformized in the last wiring pr when every categories are properly linked to real data

@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from b78e388 to 3df4875 Compare August 10, 2026 08:35
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from e35ebf6 to 63d51c8 Compare August 10, 2026 08:35
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 3df4875 to 29acbab Compare August 10, 2026 09:04
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 63d51c8 to c8b286d Compare August 10, 2026 09:04
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from bdb9d6f to 0fcaaf2 Compare August 10, 2026 09:53
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 5ac24fc to 516e948 Compare August 10, 2026 10:00
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 0fcaaf2 to 6d9b509 Compare August 10, 2026 10:00
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 516e948 to 7ee187b Compare August 10, 2026 12:09
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 6d9b509 to 71f4f78 Compare August 10, 2026 12:09
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 7ee187b to 878cd0e Compare August 10, 2026 12:22
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 71f4f78 to 0c4c9c3 Compare August 10, 2026 12:22
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-members-tab branch from 1834153 to 2003783 Compare August 10, 2026 13:14
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch 4 times, most recently from 4a03be3 to 43d56a1 Compare August 10, 2026 15:34
Comment on lines +180 to +182
const { agentConfigurations } = useAgentConfigurations({
workspaceId: owner.sId,
agentsGetView: "all",

@avervaet avervaet Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current implementation admins won't be able to see users private agents as only super users can. Is this intended or should we allow admins to see users private agents ? @flvndvd

Base automatically changed from avervaet/wiring-usage-filter-component-members-tab to main August 10, 2026 15:55
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 63c7275 to c989aa8 Compare August 10, 2026 15:59
Comment thread front/components/workspace/analytics/usageFilter.ts Outdated
disabled: !isMemberCategoryActive,
});

const { agentConfigurations } = useAgentConfigurations({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to move forward, but let's make sure that we create a dedicated endpoint to get all facets in one call.

@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 657b7ec to 3b9ec16 Compare August 10, 2026 17:16
…od-scoped data

Agents now come from the same period-ranked consumption data the
Attribution table uses (useConsumptionTop), instead of the mock,
period-unaware list. The Scope quick-filter (Company/Shared/Private) is
also real now, derived from the agent's actual scope (global/visible/
hidden) via resolveAnalyticsAgentLabels, and no longer a random mock
value.

Also wires the page's UsageFilter state into the actual consumption
queries for the "agent" dimension, which it never did before.
…lter agent scope

Drop the intermediate AgentVisibilityScope vocabulary in favor of matching
the usage filter's scope buttons directly against the real
AgentConfigurationScope values, and make ConsumptionTopRow a discriminated
union so `scope` is only assignable/readable on agent rows.
… period's top 100

The Agents tab was built on the same period-ranked top-N data as the
Attribution table, so an agent outside the top 100 by credits for the
selected period couldn't be searched or filtered on at all. Switch it to
useAgentConfigurations (view=all), the same workspace-wide agent listing
used elsewhere in the app, so every agent is listable and searchable
regardless of the period.
@avervaet
avervaet force-pushed the avervaet/wiring-usage-filter-component-agents-tab branch from 3b9ec16 to aa09612 Compare August 11, 2026 07:06
@avervaet
avervaet merged commit c220fa5 into main Aug 11, 2026
41 checks passed
@avervaet
avervaet deleted the avervaet/wiring-usage-filter-component-agents-tab branch August 11, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants