From ad09baa045f8df458da23d4f2fbbbaf770cf8571 Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Mon, 1 Jun 2026 04:17:56 +0200 Subject: [PATCH] feat(agents): add runtime machine filter to Agents tab (MUL-2846) (#3580) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(agents): add runtime machine filter to Agents tab (MUL-2846) Add a dropdown filter to the Agents tab toolbar that lets the user narrow the list to agents bound to a specific runtime machine. The filter reuses `buildRuntimeMachines` from the runtimes package so the machine grouping (Local / Remote / Cloud) matches the Runtimes page sidebar, and the per-machine agent counts respect the current scope (Mine/All) so the numbers reflect what the user would see if they clicked the row. Only rendered in the Active view; the Archived view's toolbar is unchanged. If the selected machine is GC'd while the user is on the page (daemon stopped, runtime deleted), the filter auto-resets to 'All runtimes' instead of leaving the list empty. The no-matches state now surfaces 'No agents on ' when the machine filter is the reason for zero results. Adds new `runtime_filter` and `no_matches.runtime_filtered` / `no_matches.search_runtime_filtered` i18n keys in en, zh-Hans, and ko. 7 new unit tests in `runtime-machine-filter-dropdown.test.tsx`. Co-authored-by: multica-agent * fix(agents): address code review on runtime machine filter - Plumb localDaemonId / localMachineName / hasLocalMachine / currentUserId through AgentsPage → buildRuntimeMachines so the Local section and device-name consolidation match the Runtimes page on both web and Desktop. Adds a DesktopAgentsPage wrapper that bridges daemonAPI the same way DesktopRuntimesPage does. - Make the 'All runtimes' badge use the in-scope total instead of summing per-machine counts, so an agent bound to a GC'd runtime doesn't silently vanish from the count. - Move Date.now() out of the machines useMemo into a useState lazy init so the snapshot stays stable per mount. - Drop unused i18n keys (all_description / this_machine / reset) from runtime_filter in en / zh-Hans / ko. - Add a regression test for the All-runtimes badge divergence. Co-authored-by: multica-agent * fix(agents): machine-scoped availability counts + Base UI menu items Follow-up to the previous code-review round (Emacs review at 1144b6023). #1 (medium) — Availability counts now respect the selected machine. Introduce an inScopeOnMachine memo (inScope narrowed by the selected runtime machine, but NOT by availability chip or search) and use it as the base for both availabilityCounts and the AvailabilityFilterRow's totalCount, so the chips reflect 'agents on this machine' once a machine is selected. filteredAgents is now derived from inScopeOnMachine so the availability chip and search further refine within the machine scope. The dropdown's 'All runtimes' badge still uses inScope.length — it's the count the user would see if they cleared the filter, so it should stay unfiltered. #2 (low) — Dropdown rows now use DropdownMenuItem instead of raw