Skip to content

Conversation

usnavy13
Copy link
Contributor

@usnavy13 usnavy13 commented Sep 6, 2025

Summary

agents.mp4

Addresses the request for Marketplace agents to persist in the Model dropdown across sessions without listing all public agents. #9482

This PR introduces a per-user “Favorites” mechanism:

  • Users can favorite/unfavorite agents from:
    • The Marketplace (star icon on agent cards)
    • The Model dropdown (star icon next to each agent)
  • Favorite agents persist per user across sessions and appear in the Model dropdown even if the user lacks EDIT permissions for them.
  • Dropdown composition:
    • Owner/Editor agents remain as-is.
    • Favorite agents are merged in and ordered first in the agents submenu.
  • Permissions are respected; we only include favorites the user can VIEW.
  • Minimal schema/API/UI changes, no migration required (optional user field with defaults).

Endpoints added:

  • GET /api/user/favorites/agents
  • POST /api/user/favorites/agents { agent_id }
  • DELETE /api/user/favorites/agents/:agent_id

Agents listing now supports filtering by IDs:

  • GET /api/agents?requiredPermission=1&ids=agent_...,agent_...

Change Type

  • New feature (non-breaking change which adds functionality)

Testing

  1. Marketplace favorites
  • Go to Marketplace.
  • Click the star on a public agent to favorite it.
  • Log out, log back in, open the Model dropdown → the favorited agent appears under the agents endpoint (favorites are listed first).
  • Unfavorite the agent from either the Marketplace or the dropdown and confirm it’s removed from the dropdown.
  1. Owner/Editor behavior unchanged
  • Ensure agents you own or can edit still appear as before.
  • Confirm no non-favorited public agents are added to the dropdown.
  1. Search and ordering
  • Use search in the Model selector; both owned and favorited agents should be searchable.
  • Favorites should be ordered first within the agents submenu.
  1. Permissions checks
  • Verify that only agents with VIEW access can be favorited and included.
  1. API checks
  • GET /api/user/favorites/agents returns the user’s favorite IDs.
  • POST/DELETE update that list.
  • GET /api/agents?requiredPermission=1&ids=... returns the specified agents (if viewable).

Test Configuration:

  • Ensure Marketplace permission is enabled for the user role.
  • Seed a mix of public agents and user-owned agents.
  • No DB migration required; personalization.favoriteAgents defaults to [].

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.

Impact summary:

  • Backend: optional user field personalization.favoriteAgents; user favorites routes; agents list ids filter.
  • Client: data-provider favorites endpoints/hook; merged favorites into dropdown; star toggles in Marketplace and dropdown.
  • Backwards compatible; minimal UI changes; no migration needed.

* Added endpoints for managing favorite agents: getFavoriteAgents, addFavoriteAgent, and removeFavoriteAgent in UserController.
* Updated user routes to include favorite agents operations.
* Enhanced AgentCard and EndpointModelItem components to support favoriting agents with UI toggle.
* Introduced hooks for fetching and managing favorite agents in the data provider.
* Updated user schema to include favoriteAgents field for user personalization.
* Implemented logic to handle favorite agents in the agents list and model selector context.
* Refactored UserController to streamline favorite agent responses.
* Updated AgentCard and EndpointModelItem components to manage favorite state with local component state.
* Implemented useEffect hooks to synchronize favorite agent state with server data.
* Added event listeners for marketplace updates to refresh favorite agents list.
* Improved error handling in favorite agent operations.
* Updated AgentCard and EndpointModelItem components to include error handling with ignored errors.
* Reformatted code for better readability in ModelSelectorContext by adjusting query options.
* Ensured consistent error handling across components managing favorite agents.
* Replaced Star icon with SVG in AgentCard and EndpointModelItem for improved performance and consistency.
* Enhanced accessibility by adding role and aria attributes to favorite toggle buttons.
* Streamlined favorite agent toggle functionality across components.
…tModelItem

* Removed dynamic imports of dataService in favor of direct imports for improved performance and consistency.
* Streamlined favorite agent toggle logic to enhance readability and maintainability across components.
…tModelItem

* Updated favorite agent data retrieval to use a consistent query format.
* Removed unnecessary dynamic imports of dataService for improved performance.
* Enhanced readability of favorite agent toggle logic across components.
… windows

* Updated chunking logic in vite.config.ts to normalize paths by replacing backslashes with forward slashes.
* Ensured consistent checks for module inclusion across various libraries to improve chunking efficiency.
@usnavy13
Copy link
Contributor Author

usnavy13 commented Sep 6, 2025

@danny-avila I really didn’t want to touch the Vite config, but the Windows CI builds were treating Rollup module IDs with Windows path separators, so our manualChunks checks (which assumed POSIX-style paths) didn’t match. That meant key splits like src/locales weren’t applied on Windows, the main bundle grew, and the PWA precache step failed.

To fix this without raising the Workbox limit, I normalized the Rollup ID inside manualChunks (replace backslashes with forward slashes) and updated the src/locales check to use the normalized path. This keeps behavior identical on Linux/macOS, enables the same chunking on Windows, and unblocks the CI build.

If there’s a preferred alternative to path normalization in manualChunks, I’m happy to switch.

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.

1 participant