foliko 1.0.74 → 1.0.76

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.
Files changed (238) hide show
  1. package/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
  2. package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
  3. package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
  4. package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
  5. package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
  6. package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
  7. package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
  8. package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  9. package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  10. package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  11. package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  12. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  13. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  14. package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  15. package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
  16. package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  17. package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  18. package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  19. package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  20. package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
  21. package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
  22. package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  23. package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  24. package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
  25. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
  26. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
  27. package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
  28. package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
  29. package/.agent/.shared/ui-ux-pro-max/scripts/search.py +106 -0
  30. package/.agent/ARCHITECTURE.md +288 -0
  31. package/.agent/agents/ambient-agent.md +57 -0
  32. package/.agent/agents/debugger.md +55 -0
  33. package/.agent/agents/email-assistant.md +49 -0
  34. package/.agent/agents/file-manager.md +42 -0
  35. package/.agent/agents/python-developer.md +60 -0
  36. package/.agent/agents/scheduler.md +59 -0
  37. package/.agent/agents/web-developer.md +45 -0
  38. package/.agent/data/default.json +29 -0
  39. package/.agent/data/plugins-state.json +255 -0
  40. package/.agent/mcp_config.json +4 -0
  41. package/.agent/mcp_config_updated.json +12 -0
  42. package/.agent/plugins.json +5 -0
  43. package/.agent/rules/GEMINI.md +273 -0
  44. package/.agent/rules/allow-rule.md +77 -0
  45. package/.agent/rules/log-rule.md +83 -0
  46. package/.agent/rules/security-rule.md +93 -0
  47. package/.agent/scripts/auto_preview.py +148 -0
  48. package/.agent/scripts/checklist.py +217 -0
  49. package/.agent/scripts/session_manager.py +120 -0
  50. package/.agent/scripts/verify_all.py +327 -0
  51. package/.agent/skills/api-patterns/SKILL.md +81 -0
  52. package/.agent/skills/api-patterns/api-style.md +42 -0
  53. package/.agent/skills/api-patterns/auth.md +24 -0
  54. package/.agent/skills/api-patterns/documentation.md +26 -0
  55. package/.agent/skills/api-patterns/graphql.md +41 -0
  56. package/.agent/skills/api-patterns/rate-limiting.md +31 -0
  57. package/.agent/skills/api-patterns/response.md +37 -0
  58. package/.agent/skills/api-patterns/rest.md +40 -0
  59. package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
  60. package/.agent/skills/api-patterns/security-testing.md +122 -0
  61. package/.agent/skills/api-patterns/trpc.md +41 -0
  62. package/.agent/skills/api-patterns/versioning.md +22 -0
  63. package/.agent/skills/app-builder/SKILL.md +75 -0
  64. package/.agent/skills/app-builder/agent-coordination.md +71 -0
  65. package/.agent/skills/app-builder/feature-building.md +53 -0
  66. package/.agent/skills/app-builder/project-detection.md +34 -0
  67. package/.agent/skills/app-builder/scaffolding.md +118 -0
  68. package/.agent/skills/app-builder/tech-stack.md +40 -0
  69. package/.agent/skills/app-builder/templates/SKILL.md +39 -0
  70. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  71. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  72. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  73. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  74. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  75. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  76. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  77. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
  78. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
  79. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
  80. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
  81. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  82. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
  83. package/.agent/skills/architecture/SKILL.md +55 -0
  84. package/.agent/skills/architecture/context-discovery.md +43 -0
  85. package/.agent/skills/architecture/examples.md +94 -0
  86. package/.agent/skills/architecture/pattern-selection.md +68 -0
  87. package/.agent/skills/architecture/patterns-reference.md +50 -0
  88. package/.agent/skills/architecture/trade-off-analysis.md +77 -0
  89. package/.agent/skills/clean-code/SKILL.md +201 -0
  90. package/.agent/skills/doc.md +177 -0
  91. package/.agent/skills/frontend-design/SKILL.md +418 -0
  92. package/.agent/skills/frontend-design/animation-guide.md +331 -0
  93. package/.agent/skills/frontend-design/color-system.md +311 -0
  94. package/.agent/skills/frontend-design/decision-trees.md +418 -0
  95. package/.agent/skills/frontend-design/motion-graphics.md +306 -0
  96. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  97. package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
  98. package/.agent/skills/frontend-design/typography-system.md +345 -0
  99. package/.agent/skills/frontend-design/ux-psychology.md +1116 -0
  100. package/.agent/skills/frontend-design/visual-effects.md +383 -0
  101. package/.agent/skills/i18n-localization/SKILL.md +154 -0
  102. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  103. package/.agent/skills/mcp-builder/SKILL.md +176 -0
  104. package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
  105. package/.agent/workflows/brainstorm.md +113 -0
  106. package/.agent/workflows/create.md +59 -0
  107. package/.agent/workflows/debug.md +103 -0
  108. package/.agent/workflows/deploy.md +176 -0
  109. package/.agent/workflows/enhance.md +63 -0
  110. package/.agent/workflows/orchestrate.md +237 -0
  111. package/.agent/workflows/plan.md +89 -0
  112. package/.agent/workflows/preview.md +81 -0
  113. package/.agent/workflows/simple-test.md +42 -0
  114. package/.agent/workflows/status.md +86 -0
  115. package/.agent/workflows/structured-orchestrate.md +180 -0
  116. package/.agent/workflows/test.md +144 -0
  117. package/.agent/workflows/ui-ux-pro-max.md +296 -0
  118. package/.claude/settings.local.json +11 -1
  119. package/.editorconfig +56 -0
  120. package/.husky/pre-commit +4 -0
  121. package/.lintstagedrc +7 -0
  122. package/.prettierignore +29 -0
  123. package/.prettierrc +11 -0
  124. package/CLAUDE.md +2 -0
  125. package/README.md +64 -55
  126. package/SPEC.md +102 -61
  127. package/cli/bin/foliko.js +11 -11
  128. package/cli/src/commands/chat.js +143 -141
  129. package/cli/src/commands/list.js +93 -90
  130. package/cli/src/index.js +75 -75
  131. package/cli/src/ui/chat-ui.js +201 -199
  132. package/cli/src/utils/ansi.js +40 -40
  133. package/cli/src/utils/markdown.js +292 -296
  134. package/docker-compose.yml +1 -1
  135. package/docs/ai-sdk-optimization.md +655 -643
  136. package/docs/features.md +80 -80
  137. package/docs/quick-reference.md +49 -46
  138. package/docs/user-manual.md +411 -380
  139. package/examples/ambient-example.js +194 -196
  140. package/examples/basic.js +50 -45
  141. package/examples/bootstrap.js +121 -112
  142. package/examples/mcp-example.js +19 -16
  143. package/examples/skill-example.js +20 -20
  144. package/examples/test-chat.js +137 -135
  145. package/examples/test-mcp.js +85 -79
  146. package/examples/test-reload.js +59 -61
  147. package/examples/test-telegram.js +50 -50
  148. package/examples/test-tg-bot.js +45 -42
  149. package/examples/test-tg-simple.js +47 -46
  150. package/examples/test-tg.js +62 -62
  151. package/examples/test-think.js +43 -37
  152. package/examples/test-web-plugin.js +103 -98
  153. package/examples/test-weixin-feishu.js +103 -100
  154. package/examples/workflow.js +158 -158
  155. package/package.json +37 -3
  156. package/plugins/ai-plugin.js +102 -100
  157. package/plugins/ambient-agent/EventWatcher.js +113 -0
  158. package/plugins/ambient-agent/ExplorerLoop.js +640 -0
  159. package/plugins/ambient-agent/GoalManager.js +197 -0
  160. package/plugins/ambient-agent/Reflector.js +95 -0
  161. package/plugins/ambient-agent/StateStore.js +90 -0
  162. package/plugins/ambient-agent/constants.js +101 -0
  163. package/plugins/ambient-agent/index.js +579 -0
  164. package/plugins/audit-plugin.js +187 -187
  165. package/plugins/default-plugins.js +662 -649
  166. package/plugins/email/constants.js +64 -0
  167. package/plugins/email/handlers.js +461 -0
  168. package/plugins/email/index.js +278 -0
  169. package/plugins/email/monitor.js +269 -0
  170. package/plugins/email/parser.js +138 -0
  171. package/plugins/email/reply.js +151 -0
  172. package/plugins/email/utils.js +124 -0
  173. package/plugins/feishu-plugin.js +481 -477
  174. package/plugins/file-system-plugin.js +826 -476
  175. package/plugins/install-plugin.js +199 -197
  176. package/plugins/python-executor-plugin.js +367 -365
  177. package/plugins/python-plugin-loader.js +481 -479
  178. package/plugins/rules-plugin.js +294 -292
  179. package/plugins/scheduler-plugin.js +691 -689
  180. package/plugins/session-plugin.js +369 -367
  181. package/plugins/shell-executor-plugin.js +197 -197
  182. package/plugins/storage-plugin.js +240 -238
  183. package/plugins/subagent-plugin.js +845 -785
  184. package/plugins/telegram-plugin.js +482 -475
  185. package/plugins/think-plugin.js +345 -343
  186. package/plugins/tools-plugin.js +196 -194
  187. package/plugins/web-plugin.js +606 -604
  188. package/plugins/weixin-plugin.js +545 -538
  189. package/reports/system-health-report-20260401.md +79 -0
  190. package/skills/ambient-agent/SKILL.md +49 -39
  191. package/skills/foliko-dev/AGENTS.md +64 -61
  192. package/skills/foliko-dev/SKILL.md +125 -119
  193. package/skills/mcp-usage/SKILL.md +19 -17
  194. package/skills/python-plugin-dev/SKILL.md +16 -15
  195. package/skills/skill-guide/SKILL.md +12 -12
  196. package/skills/subagent-guide/SKILL.md +237 -0
  197. package/skills/workflow-guide/SKILL.md +90 -45
  198. package/skills/workflow-troubleshooting/DEBUGGING.md +36 -21
  199. package/skills/workflow-troubleshooting/SKILL.md +156 -79
  200. package/src/capabilities/index.js +11 -11
  201. package/src/capabilities/skill-manager.js +609 -595
  202. package/src/capabilities/workflow-engine.js +1109 -1195
  203. package/src/core/agent-chat.js +882 -735
  204. package/src/core/agent.js +892 -688
  205. package/src/core/framework.js +465 -431
  206. package/src/core/index.js +19 -19
  207. package/src/core/plugin-base.js +219 -219
  208. package/src/core/plugin-manager.js +863 -767
  209. package/src/core/provider.js +114 -111
  210. package/src/core/sub-agent-config.js +264 -0
  211. package/src/core/system-prompt-builder.js +120 -0
  212. package/src/core/tool-registry.js +517 -134
  213. package/src/core/tool-router.js +297 -216
  214. package/src/executors/executor-base.js +12 -12
  215. package/src/executors/mcp-executor.js +741 -729
  216. package/src/index.js +25 -37
  217. package/src/utils/circuit-breaker.js +301 -0
  218. package/src/utils/error-boundary.js +363 -0
  219. package/src/utils/error.js +374 -0
  220. package/src/utils/event-emitter.js +97 -97
  221. package/src/utils/id.js +133 -0
  222. package/src/utils/index.js +217 -3
  223. package/src/utils/logger.js +181 -0
  224. package/src/utils/plugin-helpers.js +90 -0
  225. package/src/utils/retry.js +122 -0
  226. package/src/utils/sandbox.js +292 -0
  227. package/test/tool-registry-validation.test.js +218 -0
  228. package/test_report.md +70 -0
  229. package/website/docs/api.html +169 -107
  230. package/website/docs/configuration.html +296 -144
  231. package/website/docs/plugin-development.html +154 -85
  232. package/website/docs/project-structure.html +110 -109
  233. package/website/docs/skill-development.html +117 -61
  234. package/website/index.html +209 -205
  235. package/website/script.js +136 -133
  236. package/website/styles.css +1 -1
  237. package/plugins/ambient-agent-plugin.js +0 -1565
  238. package/plugins/email.js +0 -1142
@@ -0,0 +1,79 @@
1
+ # 系统健康检查报告
2
+
3
+ **生成时间**: 2026-04-01 02:26:37 (北京时间)
4
+
5
+ ---
6
+
7
+ ## 1. 系统概览
8
+
9
+ | 项目 | 值 |
10
+ |------|-----|
11
+ | 主机名 | Foliko |
12
+ | 操作系统 | Windows 11 (10.0.26200) |
13
+ | 架构 | x64 |
14
+ | Node.js 版本 | v25.8.1 |
15
+ | 运行时间 | 12 天 4 小时 58 分钟 36 秒 |
16
+
17
+ ---
18
+
19
+ ## 2. CPU 信息
20
+
21
+ | 项目 | 值 |
22
+ |------|-----|
23
+ | 型号 | 12th Gen Intel(R) Core(TM) i3-1220P |
24
+ | 核心数 | 12 |
25
+ | 当前负载 | 9.63% |
26
+ | 频率 | 1997 MHz |
27
+
28
+ **状态**: 正常 (负载较低)
29
+
30
+ ---
31
+
32
+ ## 3. 内存信息
33
+
34
+ | 项目 | 值 |
35
+ |------|-----|
36
+ | 总内存 | 23.75 GB |
37
+ | 已用 | 14.31 GB |
38
+ | 可用 | 9.44 GB |
39
+ | 使用率 | 60.25% |
40
+
41
+ **状态**: 正常
42
+
43
+ ---
44
+
45
+ ## 4. 网络信息
46
+
47
+ ### 本地网络接口
48
+ | 接口 | IP 地址 | 类型 |
49
+ |------|---------|------|
50
+ | WLAN | 192.168.1.9 | IPv4 |
51
+ | vEthernet (Default Switch) | 172.23.240.1 | IPv4 |
52
+ | Loopback | 127.0.0.1 | IPv4 |
53
+
54
+ ### 公网信息
55
+ | 项目 | 值 |
56
+ |------|-----|
57
+ | 公网 IP | 172.70.46.104 |
58
+ | 位置 | Amsterdam, North Holland, NL |
59
+ | ISP | Cloudflare, Inc. |
60
+ | 时区 | Europe/Amsterdam |
61
+
62
+ ---
63
+
64
+ ## 5. 协同测试总结
65
+
66
+ 本次多 Agent 协同测试成功完成:
67
+
68
+ | 步骤 | 执行 Agent | 任务 |
69
+ |------|------------|------|
70
+ | 1 | system-assistant | 获取系统完整信息 |
71
+ | 2 | web-assistant | 通过代理获取公网 IP |
72
+ | 3 | code-assistant | 汇总数据生成报告 |
73
+ | 4 | file-assistant | 报告保存到文件 |
74
+
75
+ **测试结果**: ✅ 所有协同步骤执行成功
76
+
77
+ ---
78
+
79
+ *此报告由 vb-agent 多子 Agent 协同生成*
@@ -11,7 +11,9 @@ Ambient Agent 是一个持续后台运行的智能代理,监控事件并主动
11
11
  ## 核心概念
12
12
 
13
13
  ### Goal(目标)
14
+
14
15
  目标是对话式 LLM 派发的任务,包含:
16
+
15
17
  - `title` - 目标标题
16
18
  - `description` - 目标描述
17
19
  - `priority` - 优先级 1-10
@@ -20,16 +22,19 @@ Ambient Agent 是一个持续后台运行的智能代理,监控事件并主动
20
22
  - `state` - 状态:`pending` | `active` | `completed` | `failed`
21
23
 
22
24
  ### Action(操作)
25
+
23
26
  操作是目标的最小执行单元,有三种类型:
24
27
 
25
- | 类型 | 说明 | 参数 |
26
- |------|------|------|
27
- | `tool` | 调用工具 | `name` 工具名, `args` 参数 |
28
- | `message` | 发送消息 | `content` 消息内容 |
29
- | `think` | 触发思考 | `topic` 主题, `mode` 模式, `depth` 深度 |
28
+ | 类型 | 说明 | 参数 |
29
+ | --------- | -------- | --------------------------------------- |
30
+ | `tool` | 调用工具 | `name` 工具名, `args` 参数 |
31
+ | `message` | 发送消息 | `content` 消息内容 |
32
+ | `think` | 触发思考 | `topic` 主题, `mode` 模式, `depth` 深度 |
30
33
 
31
34
  ### Event(事件)
35
+
32
36
  目标可以监听框架事件:
37
+
33
38
  - `tool:result` - 工具执行结果
34
39
  - `scheduler:reminder` - 定时提醒
35
40
  - `agent:message` - 代理消息
@@ -76,7 +81,7 @@ await ambient_goals({ action: 'activate', goalId: 'xxx-xxx' })
76
81
  ### ambient_status - 获取状态
77
82
 
78
83
  ```javascript
79
- await ambient_status({})
84
+ await ambient_status({});
80
85
  // 返回: { running, tickCount, activeGoals, pendingGoals, recentActivities }
81
86
  ```
82
87
 
@@ -84,11 +89,11 @@ await ambient_status({})
84
89
 
85
90
  ```javascript
86
91
  await ambient_think({
87
- goalId: 'xxx-xxx', // 可选,关联目标
88
- mode: 'reflect', // reflect | brainstorm | plan | analyze
89
- topic: '反思主题', // 可选
90
- depth: 2 // 可选,1-5
91
- })
92
+ goalId: 'xxx-xxx', // 可选,关联目标
93
+ mode: 'reflect', // reflect | brainstorm | plan | analyze
94
+ topic: '反思主题', // 可选
95
+ depth: 2, // 可选,1-5
96
+ });
92
97
  ```
93
98
 
94
99
  ### ambient_remember - 记忆管理
@@ -98,37 +103,37 @@ await ambient_think({
98
103
  await ambient_remember({
99
104
  action: 'store',
100
105
  key: 'user-preference',
101
- content: '用户喜欢在早上收到摘要'
102
- })
106
+ content: '用户喜欢在早上收到摘要',
107
+ });
103
108
 
104
109
  // 检索最近记忆
105
110
  await ambient_remember({
106
111
  action: 'retrieve',
107
- limit: 10
108
- })
112
+ limit: 10,
113
+ });
109
114
 
110
115
  // 搜索记忆
111
116
  await ambient_remember({
112
117
  action: 'search',
113
- query: '邮件'
114
- })
118
+ query: '邮件',
119
+ });
115
120
  ```
116
121
 
117
122
  ### ambient_control - 控制循环
118
123
 
119
124
  ```javascript
120
125
  // 暂停
121
- await ambient_control({ action: 'pause' })
126
+ await ambient_control({ action: 'pause' });
122
127
 
123
128
  // 恢复
124
- await ambient_control({ action: 'resume' })
129
+ await ambient_control({ action: 'resume' });
125
130
 
126
131
  // 调整参数
127
132
  await ambient_control({
128
133
  action: 'adjust',
129
- tickInterval: 10000, // 新 tick 间隔(毫秒)
130
- cooldownPeriod: 5000 // 新冷却时间(毫秒)
131
- })
134
+ tickInterval: 10000, // 新 tick 间隔(毫秒)
135
+ cooldownPeriod: 5000, // 新冷却时间(毫秒)
136
+ });
132
137
  ```
133
138
 
134
139
  ## action 与 step 的关系
@@ -144,6 +149,7 @@ think → think
144
149
  ```
145
150
 
146
151
  这意味着:
152
+
147
153
  - 变量引用语法一致:`${variableName}`(Ambient Agent 使用 `${}`)
148
154
  - sessionId 传递机制一致
149
155
  - 错误处理方式一致
@@ -154,12 +160,12 @@ think → think
154
160
 
155
161
  ```javascript
156
162
  // context.variables 中可用
157
- context.variables._event // 触发的事件数据(如果有)
158
- context.variables._action // 当前执行的 action 对象
159
- context.variables.loopIndex // 循环索引(如果被 loop 执行)
163
+ context.variables._event; // 触发的事件数据(如果有)
164
+ context.variables._action; // 当前执行的 action 对象
165
+ context.variables.loopIndex; // 循环索引(如果被 loop 执行)
160
166
 
161
167
  // context.input 中可用
162
- context.input // 工作流/目标输入参数
168
+ context.input; // 工作流/目标输入参数
163
169
  ```
164
170
 
165
171
  ## 变量引用语法
@@ -185,6 +191,7 @@ Ambient Agent 使用 `${}` 语法在 action 参数中引用变量:
185
191
  ```
186
192
 
187
193
  **注意**:`email:received` 事件的数据结构:
194
+
188
195
  - `event.from` - 发件人地址
189
196
  - `event.subject` - 邮件主题
190
197
  - `event.text` - 邮件正文(纯文本)
@@ -201,7 +208,7 @@ actions: [
201
208
  id: 'read-email',
202
209
  type: 'tool',
203
210
  name: 'email_read',
204
- args: { limit: 1, unreadOnly: true }
211
+ args: { limit: 1, unreadOnly: true },
205
212
  },
206
213
  {
207
214
  id: 'process',
@@ -209,15 +216,16 @@ actions: [
209
216
  name: 'some_processor',
210
217
  args: {
211
218
  // 引用 read-email 输出的 emails 数组的第一个元素的 from 字段
212
- sender: '${read-email.output.emails[0].from}'
213
- }
214
- }
215
- ]
219
+ sender: '${read-email.output.emails[0].from}',
220
+ },
221
+ },
222
+ ];
216
223
  ```
217
224
 
218
225
  ### 3. 变量解析规则
219
226
 
220
227
  `${}` 语法支持嵌套属性访问:
228
+
221
229
  - `${event.from}` - 直接字段
222
230
  - `${actionId.output.field}` - 嵌套字段
223
231
  - `${event.data.xxx}` - data 对象内的字段(兼容性别名)
@@ -233,6 +241,7 @@ actions: [
233
241
  ## 示例:创建邮件自动回复目标
234
242
 
235
243
  **重要**:`email:received` 事件的数据结构:
244
+
236
245
  - `event.from` - 发件人地址
237
246
  - `event.subject` - 邮件主题
238
247
  - `event.text` - 邮件正文(纯文本)
@@ -255,25 +264,26 @@ await ambient_goals({
255
264
  to: '${event.from}',
256
265
  subject: '${event.subject}',
257
266
  body: '${event.text}',
258
- from: ''
259
- }
267
+ from: '',
268
+ },
260
269
  },
261
270
  {
262
271
  id: 'mark-read',
263
272
  type: 'tool',
264
273
  name: 'email_mark_read',
265
274
  args: {
266
- messageId: '${event.messageId}'
267
- }
268
- }
275
+ messageId: '${event.messageId}',
276
+ },
277
+ },
269
278
  ],
270
279
  conditions: {
271
- events: ['email:received']
272
- }
273
- })
280
+ events: ['email:received'],
281
+ },
282
+ });
274
283
  ```
275
284
 
276
285
  **错误示例**(缺少参数):
286
+
277
287
  ```javascript
278
288
  // ❌ 错误 - 没有传递必需参数
279
289
  { type: 'tool', name: 'email_auto_reply', args: {} }
@@ -24,6 +24,7 @@ User plugins go in `.agent/plugins/` and are **automatically loaded** on bootstr
24
24
  ```
25
25
 
26
26
  **Why folder structure?**
27
+
27
28
  - Supports `package.json` with `main` field for custom entry points
28
29
  - Supports `node_modules` for plugin-private dependencies
29
30
  - Better organization for complex plugins
@@ -52,50 +53,51 @@ Built-in framework plugins are in `plugins/` directory.
52
53
 
53
54
  ```javascript
54
55
  // .agent/plugins/my-plugin/index.js
55
- module.exports = function(Plugin) {
56
+ module.exports = function (Plugin) {
56
57
  return class MyPlugin extends Plugin {
57
58
  constructor(config = {}) {
58
- super()
59
- this.name = 'my-plugin'
60
- this.version = '1.0.0'
61
- this.description = '我的插件'
62
- this.priority = 10
59
+ super();
60
+ this.name = 'my-plugin';
61
+ this.version = '1.0.0';
62
+ this.description = '我的插件';
63
+ this.priority = 10;
63
64
  }
64
65
 
65
66
  install(framework) {
66
- const { z } = require('zod')
67
+ const { z } = require('zod');
67
68
  framework.registerTool({
68
69
  name: 'my_tool',
69
70
  description: '工具描述',
70
71
  inputSchema: z.object({
71
- param: z.string().describe('参数描述')
72
+ param: z.string().describe('参数描述'),
72
73
  }),
73
74
  execute: async (args, framework) => {
74
- return { success: true, result: args.param }
75
- }
76
- })
77
- return this
75
+ return { success: true, result: args.param };
76
+ },
77
+ });
78
+ return this;
78
79
  }
79
80
 
80
81
  uninstall(framework) {
81
82
  // cleanup
82
83
  }
83
- }
84
- }
84
+ };
85
+ };
85
86
  ```
86
87
 
87
88
  ### Single-file structure (still supported)
88
89
 
89
90
  ```javascript
90
91
  // .agent/plugins/my-plugin.js
91
- module.exports = function(Plugin) {
92
+ module.exports = function (Plugin) {
92
93
  return class MyPlugin extends Plugin {
93
94
  // ... same as above
94
- }
95
- }
95
+ };
96
+ };
96
97
  ```
97
98
 
98
99
  **Key points:**
100
+
99
101
  - `Plugin` base class passed automatically by system (no require needed)
100
102
  - Factory function returns plugin class
101
103
  - Use `require('zod')` inside methods
@@ -105,16 +107,16 @@ module.exports = function(Plugin) {
105
107
 
106
108
  ```javascript
107
109
  // plugins/my-plugin.js
108
- const { Plugin } = require('../src/core/plugin-base')
109
- const { z } = require('zod')
110
+ const { Plugin } = require('../src/core/plugin-base');
111
+ const { z } = require('zod');
110
112
 
111
113
  class MyPlugin extends Plugin {
112
114
  constructor(config = {}) {
113
- super()
114
- this.name = 'my-plugin'
115
- this.version = '1.0.0'
116
- this.description = '我的插件'
117
- this.priority = 10
115
+ super();
116
+ this.name = 'my-plugin';
117
+ this.version = '1.0.0';
118
+ this.description = '我的插件';
119
+ this.priority = 10;
118
120
  }
119
121
 
120
122
  install(framework) {
@@ -122,37 +124,37 @@ class MyPlugin extends Plugin {
122
124
  name: 'my_tool',
123
125
  description: '工具描述',
124
126
  inputSchema: z.object({
125
- param: z.string().describe('参数描述')
127
+ param: z.string().describe('参数描述'),
126
128
  }),
127
129
  execute: async (args, framework) => {
128
- return { success: true, result: args.param }
129
- }
130
- })
131
- return this
130
+ return { success: true, result: args.param };
131
+ },
132
+ });
133
+ return this;
132
134
  }
133
135
 
134
- uninstall(framework) { }
136
+ uninstall(framework) {}
135
137
  }
136
138
 
137
- module.exports = { MyPlugin }
139
+ module.exports = { MyPlugin };
138
140
  ```
139
141
 
140
142
  ## Plugin Properties
141
143
 
142
- | Property | Type | Required | Description |
143
- |----------|------|----------|-------------|
144
- | `name` | string | ✅ | Unique name |
145
- | `version` | string | ❌ | Version, default '1.0.0' |
146
- | `description` | string | ❌ | Description |
147
- | `priority` | number | ❌ | Load priority, default 10 |
144
+ | Property | Type | Required | Description |
145
+ | ------------- | ------ | -------- | ------------------------- |
146
+ | `name` | string | ✅ | Unique name |
147
+ | `version` | string | ❌ | Version, default '1.0.0' |
148
+ | `description` | string | ❌ | Description |
149
+ | `priority` | number | ❌ | Load priority, default 10 |
148
150
 
149
151
  ## Lifecycle Methods
150
152
 
151
- | Method | Called When | Required |
152
- |--------|-------------|----------|
153
- | `install(framework)` | Plugin installed | ✅ |
154
- | `start(framework)` | Plugin started | Recommended |
155
- | `reload(framework)` | Hot reload | Optional |
153
+ | Method | Called When | Required |
154
+ | ---------------------- | ------------------ | ----------- |
155
+ | `install(framework)` | Plugin installed | ✅ |
156
+ | `start(framework)` | Plugin started | Recommended |
157
+ | `reload(framework)` | Hot reload | Optional |
156
158
  | `uninstall(framework)` | Plugin uninstalled | Recommended |
157
159
 
158
160
  ## Tool Registration
@@ -180,45 +182,46 @@ install(framework) {
180
182
 
181
183
  The framework object provides:
182
184
 
183
- | Method | Description |
184
- |--------|-------------|
185
- | `framework.registerTool(tool)` | Register tool |
186
- | `framework.getTools()` | Get all tools |
187
- | `framework.executeTool(name, args)` | Execute tool |
188
- | `framework.callTool(name, args)` | Call tool (for installing deps) |
189
- | `framework.createAgent(config)` | Create Agent |
190
- | `framework.reloadPlugin(name)` | Reload single plugin |
191
- | `framework.reloadAllPlugins()` | Reload all plugins |
185
+ | Method | Description |
186
+ | ----------------------------------- | ------------------------------- |
187
+ | `framework.registerTool(tool)` | Register tool |
188
+ | `framework.getTools()` | Get all tools |
189
+ | `framework.executeTool(name, args)` | Execute tool |
190
+ | `framework.callTool(name, args)` | Call tool (for installing deps) |
191
+ | `framework.createAgent(config)` | Create Agent |
192
+ | `framework.reloadPlugin(name)` | Reload single plugin |
193
+ | `framework.reloadAllPlugins()` | Reload all plugins |
192
194
 
193
195
  ## Dependency Management
194
196
 
195
197
  Use the `install` tool to install npm packages:
196
198
 
197
- | Plugin Type | Install Location | Command |
198
- |-------------|------------------|---------|
199
- | **Folder plugin** | `.agent/plugins/plugin-name/node_modules/` | `install({ package: "pkg", path: ".agent/plugins/plugin-name" })` |
200
- | **Single-file plugin** | `.agent/node_modules/` | `install({ package: "pkg" })` |
199
+ | Plugin Type | Install Location | Command |
200
+ | ---------------------- | ------------------------------------------ | ----------------------------------------------------------------- |
201
+ | **Folder plugin** | `.agent/plugins/plugin-name/node_modules/` | `install({ package: "pkg", path: ".agent/plugins/plugin-name" })` |
202
+ | **Single-file plugin** | `.agent/node_modules/` | `install({ package: "pkg" })` |
201
203
 
202
204
  ```javascript
203
205
  // Folder plugin - install to plugin directory
204
206
  await framework.callTool('install', {
205
207
  package: 'axios',
206
- path: '.agent/plugins/my-plugin'
207
- })
208
+ path: '.agent/plugins/my-plugin',
209
+ });
208
210
 
209
211
  // Single-file plugin - install to .agent
210
212
  await framework.callTool('install', {
211
- package: 'zod'
212
- })
213
+ package: 'zod',
214
+ });
213
215
 
214
216
  // Install from package.json
215
217
  await framework.callTool('install', {
216
218
  file: './my-plugin/package.json',
217
- path: '.agent/plugins/my-plugin'
218
- })
219
+ path: '.agent/plugins/my-plugin',
220
+ });
219
221
  ```
220
222
 
221
223
  **When encountering `Cannot find module 'xxx'` error:**
224
+
222
225
  1. Identify plugin directory
223
226
  2. Call `install` tool with `path` parameter for folder plugins
224
227
  3. Reload plugin