An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: Plugin existence by plugin.json and cleanup persisted info (#17162)
Jeffrey Chen2e8f6511e8d8
diff --git a/kernel/bazaar/installed.go b/kernel/bazaar/installed.goindex 4314b13124..5b87c7a139 100644--- a/kernel/bazaar/installed.go+++ b/kernel/bazaar/installed.go@@ -190,7 +190,7 @@ func loadBazaarInfo() (ret *BazaarInfo) {return}-// saveBazaarInfo 保存集市持久化信息(调用者需持有写锁)+// saveBazaarInfo 保存集市持久化信息(调用者需持有 bazaarInfoCacheLock 写锁)func saveBazaarInfo() {infoPath := filepath.Join(util.DataDir, "storage", "bazaar.json")diff --git a/kernel/model/plugin.go b/kernel/model/plugin.goindex 7e7c208d59..e514964265 100644--- a/kernel/model/plugin.go+++ b/kernel/model/plugin.go@@ -267,9 +267,12 @@ func getPetals() (ret []*Petal) {var tmp []*PetalpluginsDir := filepath.Join(util.DataDir, "plugins")for _, petal := range ret {- pluginPath := filepath.Join(pluginsDir, petal.Name)- if hasPluginFiles(pluginPath) {+ pluginJSONPath := filepath.Join(pluginsDir, petal.Name, "plugin.json")+ if filelock.IsExist(pluginJSONPath) {tmp = append(tmp, petal)+ } else {+ // 插件不存在时,删除对应的持久化信息+ bazaar.RemovePackageInfo("plugins", petal.Name)}}if len(tmp) != len(ret) {@@ -281,20 +284,3 @@ func getPetals() (ret []*Petal) {}return}--// hasPluginFiles 检查插件安装目录是否存在且包含文件-func hasPluginFiles(pluginPath string) bool {- if !filelock.IsExist(pluginPath) {- return false- }- entries, err := os.ReadDir(pluginPath)- if err != nil {- return false- }- for _, entry := range entries {- if !entry.IsDir() {- return true- }- }- return false-}