cherry-studio/src/main/services
LiuVaayne d792bf7fe0
🐛 fix: resolve tool approval UI and shared workspace plugin inconsistency (#11043)
* fix(ToolPermissionRequestCard): simplify button rendering by removing suggestion handling

*  feat: add CachedPluginsDataSchema for plugin cache file

- Add Zod schema for .claude/plugins.json cache file format
- Schema includes version, lastUpdated timestamp, and plugins array
- Reuses existing InstalledPluginSchema for type safety
- Cache will store metadata for all installed plugins

*  feat: add cache management methods to PluginService

- Add readCacheFile() to read .claude/plugins.json
- Add writeCacheFile() for atomic cache writes (temp + rename)
- Add rebuildCache() to scan filesystem and rebuild cache
- Add listInstalledFromCache() to load plugins from cache with fallback
- Add updateCache() helper for transactional cache updates
- All methods handle missing/corrupt cache gracefully
- Cache auto-regenerates from filesystem if needed

*  feat: integrate cache loading in AgentService.getAgent()

- Add installed_plugins field to GetAgentResponseSchema
- Load plugins from cache via PluginService.listInstalledFromCache()
- Gracefully handle errors by returning empty array
- Use loggerService for error logging

* 🐛 fix: break circular dependency causing infinite loop in cache methods

- Change cache method signatures from agentId to workdir parameter
- Update listInstalledFromCache(workdir) to accept workdir directly
- Update rebuildCache(workdir) to accept workdir directly
- Update updateCache(workdir, updater) to accept workdir directly
- AgentService.getAgent() now passes accessible_paths[0] to cache methods
- Removes AgentService.getAgent() calls from PluginService methods
- Fixes infinite recursion bug where methods called each other endlessly

Breaking the circular dependency:
BEFORE: AgentService.getAgent() → PluginService.listInstalledFromCache(id)
        → AgentService.getAgent(id) [INFINITE LOOP]
AFTER:  AgentService.getAgent() → PluginService.listInstalledFromCache(workdir)
        [NO MORE RECURSION]

* 🐛 fix: update listInstalled() to use agent.installed_plugins

- Change from agent.configuration.installed_plugins (old DB location)
- To agent.installed_plugins (new top-level field from cache)
- Simplify validation logic to use existing plugin structure
- Fixes UI not showing installed plugins correctly

This was causing the UI to show empty plugin lists even though plugins
were correctly loaded in the cache by AgentService.getAgent().

* ♻️ refactor: remove unused updateCache helper

* ♻️ refactor: centralize plugin directory helpers

* feat: Implement Plugin Management System

- Added PluginCacheStore for managing plugin metadata and caching.
- Introduced PluginInstaller for handling installation and uninstallation of plugins.
- Created PluginService to manage plugin lifecycle, including installation, uninstallation, and listing of available plugins.
- Enhanced AgentService to integrate with PluginService for loading installed plugins.
- Implemented validation and sanitization for plugin file names and paths to prevent security issues.
- Added support for skills as a new plugin type, including installation and management.
- Introduced caching mechanism for available plugins to improve performance.

* ♻️ refactor: simplify PluginInstaller and PluginService by removing agent dependency and updating plugin handling
2025-10-31 14:30:50 +08:00
..
__tests__ feat: enhance proxy bypass rules with comprehensive matching (#10817) 2025-10-21 10:39:16 +08:00
agents 🐛 fix: resolve tool approval UI and shared workspace plugin inconsistency (#11043) 2025-10-31 14:30:50 +08:00
mcp/oauth fix: update ESLint configuration and dependencies, replace zod import… (#10645) 2025-10-12 17:15:52 +08:00
memory feat: refactor Knowledge Base (#8384) 2025-09-04 17:23:31 +08:00
ocr feat: new build-in OCR provider -> intel OV(NPU) OCR (#10737) 2025-10-17 15:18:00 +08:00
remotefile chore: migrate from openai to @cherrystudio/openai package (#10802) 2025-10-22 17:34:23 +08:00
urlschema refactor[Logger]: strict type check for Logger (#8363) 2025-07-23 13:24:03 +08:00
AnthropicService.ts feat: add Anthropic OAuth settings UI and logic (#8905) 2025-09-05 17:43:20 +08:00
ApiServerService.ts fix: api server status (#10734) 2025-10-16 12:49:31 +08:00
AppMenuService.ts feat(AppMenuService): enhance application menu with help section and others (#10934) 2025-10-24 13:57:52 +08:00
AppService.ts refactor[Logger]: strict type check for Logger (#8363) 2025-07-23 13:24:03 +08:00
AppUpdater.ts feat: add updating dialog in render (#10569) 2025-10-09 15:58:24 +08:00
BackupManager.ts refactor(bakcup): 单例化S3/WebDAV (#9181) 2025-08-15 01:55:19 +08:00
CacheService.ts feat: add gemini files support 2025-01-07 16:49:11 +08:00
CodeToolsService.ts feat: add GitHub Copilot CLI integration to coding tools (#10403) 2025-09-30 23:43:19 +08:00
ConfigManager.ts feat: add client ID generation and update user agent headers in AppUpdater 2025-09-22 09:55:43 +08:00
ContextMenu.ts fix: support spell check for mini app (#7602) 2025-06-28 08:36:32 +08:00
CopilotService.ts refactor(CopilotService): streamline token file handling and improve error management (#9552) 2025-08-26 14:33:47 +08:00
DxtService.ts refactor[Logger]: strict type check for Logger (#8363) 2025-07-23 13:24:03 +08:00
ExportService.ts feat: use oxlint to speed up lint (#10168) 2025-09-15 19:42:13 +08:00
FileStorage.ts feat(file): improve error handling for openPath operation 2025-09-29 19:53:32 +08:00
FileSystemService.ts feat: ocr image to translate (#9423) 2025-08-26 00:21:26 +08:00
KnowledgeService.ts fix: knowledge base not delete and websearch rag error (#10595) 2025-10-09 22:29:52 +08:00
LoggerService.ts refactor[Logger]: strict type check for Logger (#8363) 2025-07-23 13:24:03 +08:00
MCPService.ts feat: refactor shell environment handling and move to utils 2025-09-23 22:36:14 +08:00
MistralClientManager.ts feat: use oxlint to speed up lint (#10168) 2025-09-15 19:42:13 +08:00
NodeTraceService.ts fix: change jschardet to chardet (#8577) 2025-07-29 17:27:36 +08:00
NotificationService.ts Perf/tsgo (#10188) 2025-09-16 10:16:42 +08:00
NutstoreService.ts refactor: replace axios and node fetch with electron's net module (#9212) 2025-08-15 22:48:22 +08:00
ObsidianVaultService.ts fix: enhance Obsidian vault detection for multiple installation methods (#9821) 2025-09-03 15:08:59 +08:00
OvmsManager.ts feat: add new provider intel OVMS(openvino model server) (#9853) 2025-09-29 18:36:54 +08:00
ProtocolClient.ts refactor[Logger]: strict type check for Logger (#8363) 2025-07-23 13:24:03 +08:00
ProxyManager.ts feat: enhance proxy bypass rules with comprehensive matching (#10817) 2025-10-21 10:39:16 +08:00
PythonService.ts feat: implement Python MCP server using existing Pyodide infrastructure (#7506) 2025-06-25 18:21:10 +08:00
ReduxService.ts feat: Support Cherry Studio as a Service (CSaaS) (#8098) 2025-07-30 12:38:07 +08:00
S3Storage.ts fix(s3): add volces.com to virtual host suffix whitelist (#8824) 2025-08-04 18:20:08 +08:00
SearchService.ts fix: decode Bing redirect URLs in LocalBingProvider (#9593) 2025-08-27 21:34:01 +08:00
SelectionService.ts chore: update electron to 37.4.0 (#9692) 2025-08-30 20:09:02 +08:00
ShortcutService.ts chore: fix typos (#9477) 2025-08-24 17:15:35 +08:00
SpanCacheService.ts refactor[Logger]: strict type check for Logger (#8363) 2025-07-23 13:24:03 +08:00
StoreSyncService.ts feat(SelectionAssistant): shortcut key to toggle on/off (#6983) 2025-06-11 13:32:49 +08:00
ThemeService.ts style: set eol to lf, code formatting (#7923) 2025-07-08 09:50:33 +08:00
TrayService.ts feat: SelectionAssistant macOS version / 划词助手macOS版 (#7561) 2025-07-03 14:31:31 +08:00
VertexAIService.ts Feat/vertex-claude-support (#7564) 2025-07-24 23:46:32 +08:00
WebDav.ts refactor[Logger]: strict type check for Logger (#8363) 2025-07-23 13:24:03 +08:00
WebviewService.ts fix: prevent default behavior for Cmd/Ctrl+F in WebviewService (#10783) 2025-10-17 15:07:19 +08:00
WindowService.ts feat(ipc): add App_Quit channel and update related handlers 2025-09-23 19:49:41 +08:00