feat(plugins): 依赖互调 + SQLite 存储,契约 0.3.0

This commit is contained in:
Rick Ye
2026-09-11 14:56:30 +08:00
parent e958784d10
commit 1cb2b554c0
14 changed files with 807 additions and 114 deletions
+10
View File
@@ -470,6 +470,16 @@ export function registerIpc(): AgentService {
if (typeof id !== 'string' || typeof enabled !== 'boolean') throw new Error('invalid plugin toggle')
return getPluginHost().setEnabled(id, enabled)
})
// 打开插件私有数据目录(资源管理器中显示;不存在则先建)
handle('plugins:openDataDir', (_e, id: unknown) => {
if (typeof id !== 'string' || !/^[a-z][a-z0-9-]*$/.test(id)) throw new Error('invalid plugin id')
return getPluginHost().openPluginDataDir(id)
})
// 清除插件全部存储数据(设置页二次确认后调用;连接关闭 + 删数据目录)
handle('plugins:clearData', (_e, id: unknown) => {
if (typeof id !== 'string' || !/^[a-z][a-z0-9-]*$/.test(id)) throw new Error('invalid plugin id')
return getPluginHost().clearPluginData(id)
})
handle('plugins:reload', () => getPluginHost().reload())
handle('plugins:openView', (_e, view: unknown, params: unknown) => {
if (typeof view !== 'string' || !view) throw new Error('invalid view')