foliko 2.0.11 → 2.0.13

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.
@@ -239,7 +239,9 @@
239
239
  "Bash(npm start *)",
240
240
  "Bash(xxd)",
241
241
  "Bash(python fix_ext2.py)",
242
- "Bash(npx vitest *)"
242
+ "Bash(npx vitest *)",
243
+ "Bash(ls node_modules | wc -l && ls -d node_modules/@* 2>/dev/null | head -5)",
244
+ "Bash(node -e \"console.log\\(require.resolve\\('croner'\\)\\)\")"
243
245
  ]
244
246
  }
245
247
  }
package/.editorconfig CHANGED
@@ -1,56 +1,56 @@
1
- # EditorConfig is awesome: https://EditorConfig.org
2
-
3
- # top-most EditorConfig file
4
- root = true
5
-
6
- # 代码文件
7
- [*]
8
- charset = utf-8
9
- end_of_line = lf
10
- insert_final_newline = true
11
- trim_trailing_whitespace = true
12
-
13
- # JavaScript / Node.js
14
- [*.{js,jsx,mjs,cjs}]
15
- indent_style = space
16
- indent_size = 2
17
-
18
- # TypeScript
19
- [*.{ts,tsx}]
20
- indent_style = space
21
- indent_size = 2
22
-
23
- # JSON
24
- [*.json]
25
- indent_style = space
26
- indent_size = 2
27
-
28
- # YAML
29
- [*.{yaml,yml}]
30
- indent_style = space
31
- indent_size = 2
32
-
33
- # Markdown
34
- [*.md]
35
- trim_trailing_whitespace = false
36
- indent_style = space
37
- indent_size = 2
38
-
39
- # Shell
40
- [*.sh]
41
- indent_style = space
42
- indent_size = 2
43
-
44
- # PowerShell
45
- [*.ps1]
46
- indent_style = space
47
- indent_size = 4
48
-
49
- # Dockerfile
50
- [Dockerfile]
51
- indent_style = space
52
- indent_size = 4
53
-
54
- # Makefile
55
- [Makefile]
56
- indent_style = tab
1
+ # EditorConfig is awesome: https://EditorConfig.org
2
+
3
+ # top-most EditorConfig file
4
+ root = true
5
+
6
+ # 代码文件
7
+ [*]
8
+ charset = utf-8
9
+ end_of_line = lf
10
+ insert_final_newline = true
11
+ trim_trailing_whitespace = true
12
+
13
+ # JavaScript / Node.js
14
+ [*.{js,jsx,mjs,cjs}]
15
+ indent_style = space
16
+ indent_size = 2
17
+
18
+ # TypeScript
19
+ [*.{ts,tsx}]
20
+ indent_style = space
21
+ indent_size = 2
22
+
23
+ # JSON
24
+ [*.json]
25
+ indent_style = space
26
+ indent_size = 2
27
+
28
+ # YAML
29
+ [*.{yaml,yml}]
30
+ indent_style = space
31
+ indent_size = 2
32
+
33
+ # Markdown
34
+ [*.md]
35
+ trim_trailing_whitespace = false
36
+ indent_style = space
37
+ indent_size = 2
38
+
39
+ # Shell
40
+ [*.sh]
41
+ indent_style = space
42
+ indent_size = 2
43
+
44
+ # PowerShell
45
+ [*.ps1]
46
+ indent_style = space
47
+ indent_size = 4
48
+
49
+ # Dockerfile
50
+ [Dockerfile]
51
+ indent_style = space
52
+ indent_size = 4
53
+
54
+ # Makefile
55
+ [Makefile]
56
+ indent_style = tab
package/.lintstagedrc CHANGED
@@ -1,7 +1,7 @@
1
- {
2
- "*.{js,jsx,ts,tsx}": ["prettier --write", "git add"],
3
- "*.{json,yaml,yml}": ["prettier --write", "git add"],
4
- "*.{md,mdx}": ["prettier --write", "git add"],
5
- "*.{css,scss,less}": ["prettier --write", "git add"],
6
- "*.{html,svg}": ["prettier --write", "git add"]
7
- }
1
+ {
2
+ "*.{js,jsx,ts,tsx}": ["prettier --write", "git add"],
3
+ "*.{json,yaml,yml}": ["prettier --write", "git add"],
4
+ "*.{md,mdx}": ["prettier --write", "git add"],
5
+ "*.{css,scss,less}": ["prettier --write", "git add"],
6
+ "*.{html,svg}": ["prettier --write", "git add"]
7
+ }
package/.prettierignore CHANGED
@@ -1,29 +1,29 @@
1
- # 依赖
2
- node_modules/
3
- pnpm-lock.yaml
4
- yarn.lock
5
- package-lock.json
6
-
7
- # 构建输出
8
- dist/
9
- build/
10
- out/
11
-
12
- # 插件目录(第三方代码)
13
- plugins/
14
-
15
- # 测试报告
16
- reports/
17
- test_report.md
18
-
19
- # 配置文件(不需要格式化)
20
- .env
21
- .env.example
22
-
23
- # 静态资源
24
- images/
25
- audio/
26
- public/
27
-
28
- # 锁文件
29
- *.lock
1
+ # 依赖
2
+ node_modules/
3
+ pnpm-lock.yaml
4
+ yarn.lock
5
+ package-lock.json
6
+
7
+ # 构建输出
8
+ dist/
9
+ build/
10
+ out/
11
+
12
+ # 插件目录(第三方代码)
13
+ plugins/
14
+
15
+ # 测试报告
16
+ reports/
17
+ test_report.md
18
+
19
+ # 配置文件(不需要格式化)
20
+ .env
21
+ .env.example
22
+
23
+ # 静态资源
24
+ images/
25
+ audio/
26
+ public/
27
+
28
+ # 锁文件
29
+ *.lock
package/.prettierrc CHANGED
@@ -1,11 +1,11 @@
1
- {
2
- "semi": true,
3
- "singleQuote": true,
4
- "tabWidth": 2,
5
- "trailingComma": "es5",
6
- "printWidth": 100,
7
- "bracketSpacing": true,
8
- "arrowParens": "always",
9
- "endOfLine": "lf",
10
- "plugins": []
11
- }
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "trailingComma": "es5",
6
+ "printWidth": 100,
7
+ "bracketSpacing": true,
8
+ "arrowParens": "always",
9
+ "endOfLine": "lf",
10
+ "plugins": []
11
+ }
package/CLAUDE.md CHANGED
@@ -147,7 +147,7 @@ Provider selection via `config.provider` and AI settings in `.foliko/ai.json`.
147
147
  5. **Per-Session Message Storage**: `AgentChatHandler` uses `_sessionMessageStores` Map for Per-Session 消息隔离
148
148
  6. **Unified Extension Call**: 扩展工具(普通扩展 / `mcp:<server>` / `skill:<name>`)通过 `ext_skill` + `ext_call` 统一调度
149
149
  - `ext_skill({ plugin })` 查询参数 → `ext_call({ plugin, tool, args })` 调用
150
- - 普通扩展/MCP/Python:`args` 是结构化对象;Skill 命令:`args: { command: "..." }` 命令行字符串
150
+ - 扩展调用:`args` 是结构化对象,参数名对应工具定义的字段(camelCase)
151
151
 
152
152
  ### Built-in Plugins
153
153
 
package/Dockerfile CHANGED
@@ -1,63 +1,63 @@
1
- # ========== Foliko - 插件化 Agent 框架 ==========
2
- # 基于 Node.js 20 LTS
3
-
4
- FROM node:25-slim
5
-
6
- # 安装无头浏览器(Chromium)和构建工具
7
- RUN apt-get update && apt-get install -y --no-install-recommends \
8
- build-essential \
9
- python3 \
10
- python3-pip \
11
- curl \
12
- git \
13
- wget \
14
- gnupg \
15
- # Chromium 及依赖
16
- chromium \
17
- chromium-sandbox \
18
- libnss3 \
19
- libatk1.0-0 \
20
- libatk-bridge2.0-0 \
21
- libcups2 \
22
- libdrm2 \
23
- libxkbcommon0 \
24
- libxcomposite1 \
25
- libxdamage1 \
26
- libxfixes3 \
27
- libxrandr2 \
28
- libgbm1 \
29
- libasound2 \
30
- libpango-1.0-0 \
31
- libpangocairo-1.0-0 \
32
- libgtk-3-0 \
33
- fonts-liberation \
34
- xdg-utils \
35
- && rm -rf /var/lib/apt/lists/* \
36
- && ln -sf /usr/bin/python3 /usr/bin/python \
37
- && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
38
-
39
- # 设置 Chromium 环境变量(无头模式运行)
40
- ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
41
- ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
42
- ENV CHROME_BIN=/usr/bin/chromium
43
-
44
- # 安装 uv(快速的 Python 包管理器)
45
- RUN curl -LsSf https://astral.sh/uv/install.sh | sh
46
- ENV PATH="/root/.local/bin:$PATH"
47
-
48
- # 设置工作目录
49
- WORKDIR /app
50
-
51
- # 全局安装 foliko CLI
52
- # RUN npm install -g foliko
53
-
54
- # 暴露端口
55
- # 3000: Web 服务端口
56
- EXPOSE 3000
57
-
58
- # 环境变量(可以在 docker-compose 或运行时覆盖)
59
- ENV NODE_ENV=production
60
-
61
-
62
- # 默认命令:运行聊天界面
63
- # CMD ["foliko", "chat"]
1
+ # ========== Foliko - 插件化 Agent 框架 ==========
2
+ # 基于 Node.js 20 LTS
3
+
4
+ FROM node:25-slim
5
+
6
+ # 安装无头浏览器(Chromium)和构建工具
7
+ RUN apt-get update && apt-get install -y --no-install-recommends \
8
+ build-essential \
9
+ python3 \
10
+ python3-pip \
11
+ curl \
12
+ git \
13
+ wget \
14
+ gnupg \
15
+ # Chromium 及依赖
16
+ chromium \
17
+ chromium-sandbox \
18
+ libnss3 \
19
+ libatk1.0-0 \
20
+ libatk-bridge2.0-0 \
21
+ libcups2 \
22
+ libdrm2 \
23
+ libxkbcommon0 \
24
+ libxcomposite1 \
25
+ libxdamage1 \
26
+ libxfixes3 \
27
+ libxrandr2 \
28
+ libgbm1 \
29
+ libasound2 \
30
+ libpango-1.0-0 \
31
+ libpangocairo-1.0-0 \
32
+ libgtk-3-0 \
33
+ fonts-liberation \
34
+ xdg-utils \
35
+ && rm -rf /var/lib/apt/lists/* \
36
+ && ln -sf /usr/bin/python3 /usr/bin/python \
37
+ && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
38
+
39
+ # 设置 Chromium 环境变量(无头模式运行)
40
+ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
41
+ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
42
+ ENV CHROME_BIN=/usr/bin/chromium
43
+
44
+ # 安装 uv(快速的 Python 包管理器)
45
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
46
+ ENV PATH="/root/.local/bin:$PATH"
47
+
48
+ # 设置工作目录
49
+ WORKDIR /app
50
+
51
+ # 全局安装 foliko CLI
52
+ # RUN npm install -g foliko
53
+
54
+ # 暴露端口
55
+ # 3000: Web 服务端口
56
+ EXPOSE 3000
57
+
58
+ # 环境变量(可以在 docker-compose 或运行时覆盖)
59
+ ENV NODE_ENV=production
60
+
61
+
62
+ # 默认命令:运行聊天界面
63
+ # CMD ["foliko", "chat"]
package/README.md CHANGED
@@ -391,9 +391,9 @@ allowed-tools: tool1,tool2
391
391
  > **统一扩展调用模式**:
392
392
  > - 普通扩展:`ext_call({ plugin: "<name>", tool: "<tool>", args: {...} })`
393
393
  > - MCP 服务器:`ext_call({ plugin: "mcp:<servername>", tool: "<tool>", args: {...} })`
394
- > - Skill 命令:`ext_call({ plugin: "skill:<skillname>", tool: "<command>", args: { command: "..." } })`
394
+ > - Skill 命令:`ext_call({ plugin: "skill:<skillname>", tool: "<command>", args: { name: "...", lang: "..." } })`
395
395
  > - 调用前先 `ext_skill({ plugin: "<name>" })` 查看参数结构
396
- > - 普通扩展/MCP/Python:`args` 是结构化对象;Skill 命令:`args: { command: "..." }`
396
+ > - 扩展调用:`args` 是结构化对象,参数名对应工具定义的字段(camelCase)
397
397
 
398
398
  ### 子 Agent 管理工具
399
399
 
@@ -45,8 +45,7 @@ ext_call({
45
45
 
46
46
  | 扩展类型 | args 格式 |
47
47
  |---|---|
48
- | 普通扩展 / MCP / Python | `args: {...}` 结构化对象 |
49
- | Skill 命令 | `args: { command: "..." }` 命令行字符串 |
48
+ | 普通扩展 / MCP / Python / Skill | `args: {...}` 结构化对象,参数名对应工具定义的字段(camelCase) |
50
49
 
51
50
  ## 3. MCP 服务器自动注册
52
51
 
@@ -118,11 +117,11 @@ module.exports = {
118
117
  ext_call({
119
118
  plugin: 'skill:my-skill',
120
119
  tool: 'greet',
121
- args: { command: "-n Claude -l en -s" }
120
+ args: { name: "Claude", lang: "en", shout: true }
122
121
  })
123
122
  ```
124
123
 
125
- **args 传 `command` 字符串**,commander.js 解析后 handler 收到 `{ name: 'Claude', lang: 'en', shout: true }`。
124
+ **args 直接传结构化对象**,handler 收到 `{ name: 'Claude', lang: 'en', shout: true }`。
126
125
 
127
126
  ## 5. Plugin 基类:`this.skill` accessor
128
127
 
package/docs/migration.md CHANGED
@@ -84,15 +84,15 @@ Skill 命令通过 `skill:<name>` 命名空间调用:
84
84
  ext_call({
85
85
  plugin: "skill:my-skill", // skill:<name>
86
86
  tool: "cmd", // 命令名(不是 <skill>:<cmd>)
87
- args: { command: "-n x -v" }
87
+ args: { name: "x", verbose: true }
88
88
  })
89
89
  ```
90
90
 
91
91
  **要点**:
92
92
  - 每个 skill 是独立扩展 `skill:<name>`
93
93
  - 命令是该扩展下的 tool
94
- - `args: { command: "..." }` 传命令行字符串
95
- - Commander.js 解析后传给 handler
94
+ - `args` 直接传结构化对象,参数名对应 `options` 中定义的字段(camelCase)
95
+ - 不再需要命令行字符串解析
96
96
 
97
97
  #### 3. ext_skill 返回内容
98
98
 
package/docs/usage.md CHANGED
@@ -198,17 +198,17 @@ module.exports = {
198
198
  // 1. 查询参数
199
199
  ext_skill({ plugin: "skill:<skillname>" })
200
200
 
201
- // 2. 调用(传命令行字符串)
201
+ // 2. 调用(传结构化参数)
202
202
  ext_call({
203
203
  plugin: "skill:<skillname>",
204
204
  tool: "greet",
205
- args: { command: "-n Claude -l en --shout" },
205
+ args: { name: "Claude", lang: "en", shout: true },
206
206
  })
207
207
  ```
208
208
 
209
209
  #### 参数传递
210
210
 
211
- Skill 命令参数通过 `args: { command: "..." }` 传递命令行字符串,由 Commander.js 解析后传给 handler:
211
+ Skill 命令参数直接通过 `args` 对象传递,无需解析命令行字符串:
212
212
 
213
213
  | flags | 解析后 args 字段 |
214
214
  |---|---|