foliko 1.1.91 → 1.1.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -137,26 +137,25 @@ function loadAgentConfig(framework, agentDir = '.foliko') {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
// 添加 .foliko/skills 目录(不存在则创建)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
// 使用相对路径存储,这样 setCwd 时能自动随新 cwd 重新解析
|
|
141
|
+
const projectSkillsRel = path.join(agentDir, 'skills')
|
|
142
|
+
const projectSkillsAbs = path.resolve(cwd, projectSkillsRel)
|
|
143
|
+
if (fs.existsSync(resolvedDir) && !fs.existsSync(projectSkillsAbs)) {
|
|
144
|
+
fs.mkdirSync(projectSkillsAbs, { recursive: true })
|
|
145
|
+
//log.info(` Created skills directory: ${projectSkillsAbs}`)
|
|
144
146
|
}
|
|
145
|
-
if (fs.existsSync(
|
|
146
|
-
config.skillsDirs.push(
|
|
147
|
+
if (fs.existsSync(projectSkillsAbs)) {
|
|
148
|
+
config.skillsDirs.push(projectSkillsRel)
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
// 添加
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// }
|
|
155
|
-
if (fs.existsSync(cmdskillsDir)) {
|
|
156
|
-
config.skillsDirs.push(cmdskillsDir)
|
|
151
|
+
// 添加 cwd 下的 skills/ 目录(相对路径,与 setCwd 联动)
|
|
152
|
+
const cmdskillsRel = 'skills'
|
|
153
|
+
const cmdskillsAbs = path.resolve(cwd, cmdskillsRel)
|
|
154
|
+
if (fs.existsSync(cmdskillsAbs)) {
|
|
155
|
+
config.skillsDirs.push(cmdskillsRel)
|
|
157
156
|
}
|
|
158
157
|
|
|
159
|
-
//
|
|
158
|
+
// 添加框架根目录的 skills/ 目录(绝对路径,与 cwd 无关)
|
|
160
159
|
const parentDir = path.dirname(__dirname)
|
|
161
160
|
const rootSkillsDir = path.join(parentDir, 'skills')
|
|
162
161
|
if (fs.existsSync(rootSkillsDir)) {
|
|
@@ -622,7 +622,9 @@ class ExtensionExecutorPlugin extends Plugin {
|
|
|
622
622
|
this._extensions.clear();
|
|
623
623
|
const plugins = framework.pluginManager.getAll();
|
|
624
624
|
for (const { instance: plugin } of plugins) {
|
|
625
|
-
|
|
625
|
+
// 使用 _rescanPluginTools 以正确处理 skill-manager 的 'skill' extName 映射
|
|
626
|
+
// (_scanPluginTools 不传 extName 时会用 pluginName,对 skill-manager 不正确)
|
|
627
|
+
this._rescanPluginTools(plugin);
|
|
626
628
|
}
|
|
627
629
|
// 重新获取 MCP executor 引用
|
|
628
630
|
this._mcpExecutor = framework.pluginManager?.get('mcp') || null;
|
|
@@ -938,6 +938,8 @@ class SkillManagerPlugin extends Plugin {
|
|
|
938
938
|
reload(framework) {
|
|
939
939
|
// log.info(' Reloading...');
|
|
940
940
|
this._skills.clear();
|
|
941
|
+
// 清空 this.tools,避免旧 skill 命令残留(否则 setCwd 后旧 cwd 的命令会留在 _extensions 中)
|
|
942
|
+
this.tools = {};
|
|
941
943
|
this._loaded = false;
|
|
942
944
|
this._framework = framework;
|
|
943
945
|
this._loadAllSkills();
|