mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-26 08:52:15 +00:00
The server and the plugin manager start in parallel, so an agent call landing in the first seconds can see an empty plugin list and warn that a correctly configured plugin is unknown - a false alarm made user-visible by the Debug to Warn promotion. Worse, that early result could be cached under a key that never changes when no plugins are installed, permanently suppressing a legitimate typo warning. The plugin manager now reports when its initial load has completed (PluginsLoaded, set when Start returns). Until then the agent resolution skips the cache and logs unknown names at Debug; once loading is done it caches and warns as before. Found by adversarial review of this branch. |
||
|---|---|---|
| .. | ||
| agents.go | ||
| agents_plugin_test.go | ||
| agents_suite_test.go | ||
| agents_test.go | ||
| interfaces.go | ||
| interfaces_test.go | ||
| local_agent.go | ||
| README.md | ||
| session_keys.go | ||
| session_keys_test.go | ||
This folder abstracts metadata lookup into "agents". Each agent can be implemented to get as much info as the external source provides, by using a granular set of interfaces (see interfaces).
A new agent must comply with these simple implementation rules:
- Implement the
AgentName()method. It just returns the name of the agent for logging purposes. - Implement one or more of the
*Retriever()interfaces. That's where the agent's logic resides. - Register itself (in its
init()function).
For an agent to be used it needs to be listed in the Agents config option (default is "deezer,lastfm"). The order dictates the priority of the agents
For a simple Agent example, look at the local_agent agent source code.