foliko 1.1.93 → 2.0.1

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 (212) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/CLAUDE.md +56 -30
  3. package/REFACTORING_PLAN.md +645 -0
  4. package/docs/architecture.md +131 -0
  5. package/docs/migration.md +57 -0
  6. package/docs/public-api.md +138 -0
  7. package/docs/usage.md +385 -0
  8. package/examples/ambient-example.js +20 -137
  9. package/examples/basic.js +21 -48
  10. package/examples/bootstrap.js +16 -74
  11. package/examples/mcp-example.js +6 -29
  12. package/examples/skill-example.js +6 -19
  13. package/examples/workflow.js +8 -56
  14. package/package.json +8 -4
  15. package/plugins/README.md +49 -0
  16. package/plugins/{ambient-agent → ambient}/EventWatcher.js +1 -1
  17. package/plugins/{ambient-agent → ambient}/ExplorerLoop.js +3 -3
  18. package/plugins/{ambient-agent → ambient}/GoalManager.js +2 -2
  19. package/plugins/ambient/README.md +14 -0
  20. package/plugins/{ambient-agent → ambient}/Reflector.js +1 -1
  21. package/plugins/{ambient-agent → ambient}/StateStore.js +1 -1
  22. package/plugins/{ambient-agent → ambient}/index.js +2 -2
  23. package/plugins/{ai-plugin.js → core/ai/index.js} +14 -30
  24. package/plugins/{audit-plugin.js → core/audit/index.js} +3 -30
  25. package/plugins/{coordinator-plugin.js → core/coordinator/index.js} +3 -35
  26. package/plugins/core/default/bootstrap.js +224 -0
  27. package/plugins/core/default/config.js +222 -0
  28. package/plugins/core/default/index.js +58 -0
  29. package/plugins/core/mcp/index.js +1 -0
  30. package/plugins/{python-plugin-loader.js → core/python-loader/index.js} +7 -187
  31. package/plugins/{rules-plugin.js → core/rules/index.js} +121 -64
  32. package/plugins/{scheduler-plugin.js → core/scheduler/index.js} +12 -114
  33. package/plugins/{session-plugin.js → core/session/index.js} +9 -73
  34. package/{src/capabilities/skill-manager.js → plugins/core/skill-manager/index.js} +64 -18
  35. package/plugins/{storage-plugin.js → core/storage/index.js} +5 -29
  36. package/plugins/{subagent-plugin.js → core/sub-agent/index.js} +10 -171
  37. package/plugins/{think-plugin.js → core/think/index.js} +24 -91
  38. package/{src/capabilities/workflow-engine.js → plugins/core/workflow/index.js} +87 -85
  39. package/plugins/default-plugins.js +6 -720
  40. package/plugins/{data-splitter-plugin.js → executors/data-splitter/index.js} +9 -83
  41. package/plugins/{extension-executor-plugin.js → executors/extension/index.js} +13 -97
  42. package/plugins/{python-executor-plugin.js → executors/python/index.js} +6 -31
  43. package/plugins/{shell-executor-plugin.js → executors/shell/index.js} +2 -5
  44. package/plugins/install/README.md +9 -0
  45. package/plugins/{install-plugin.js → install/index.js} +3 -3
  46. package/plugins/{file-system-plugin.js → io/file-system/index.js} +34 -236
  47. package/plugins/{web-plugin.js → io/web/index.js} +11 -113
  48. package/plugins/memory/README.md +13 -0
  49. package/plugins/{memory-plugin.js → memory/index.js} +4 -18
  50. package/plugins/messaging/email/README.md +19 -0
  51. package/plugins/{email → messaging/email}/index.js +3 -3
  52. package/plugins/{feishu-plugin.js → messaging/feishu/index.js} +4 -4
  53. package/plugins/{qq-plugin.js → messaging/qq/index.js} +6 -17
  54. package/plugins/{telegram-plugin.js → messaging/telegram/index.js} +4 -4
  55. package/plugins/{weixin-plugin.js → messaging/weixin/index.js} +16 -16
  56. package/plugins/{plugin-manager-plugin.js → plugin-manager/index.js} +36 -180
  57. package/plugins/{tools-plugin.js → tools/index.js} +68 -116
  58. package/plugins/trading/README.md +15 -0
  59. package/plugins/{gate-trading.js → trading/index.js} +8 -8
  60. package/{examples → sandbox}/test-concurrent-chat.js +2 -2
  61. package/{examples → sandbox}/test-long-chat.js +2 -2
  62. package/{examples → sandbox}/test-session-chat.js +2 -2
  63. package/{examples → sandbox}/test-web-plugin.js +1 -1
  64. package/{examples → sandbox}/test-weixin-feishu.js +2 -2
  65. package/src/agent/base.js +56 -0
  66. package/src/{core/agent-chat.js → agent/chat.js} +11 -11
  67. package/src/{core/coordinator-manager.js → agent/coordinator.js} +3 -3
  68. package/src/agent/index.js +111 -0
  69. package/src/agent/main.js +337 -0
  70. package/src/agent/prompt.js +78 -0
  71. package/src/agent/sub.js +198 -0
  72. package/src/agent/worker.js +104 -0
  73. package/{cli/bin/foliko.js → src/cli/bin.js} +1 -1
  74. package/{cli/src → src/cli}/commands/chat.js +25 -21
  75. package/{cli/src → src/cli}/index.js +1 -0
  76. package/{cli/src → src/cli}/ui/chat-ui-old.js +40 -178
  77. package/{cli/src → src/cli}/ui/chat-ui.js +3 -3
  78. package/{cli/src → src/cli}/ui/components/footer-bar.js +1 -1
  79. package/src/common/errors.js +402 -0
  80. package/src/{utils → common}/logger.js +33 -0
  81. package/src/{utils/chat-queue.js → common/queue.js} +2 -2
  82. package/src/config/plugin-config.js +50 -0
  83. package/src/context/agent.js +32 -0
  84. package/src/context/compaction-prompts.js +170 -0
  85. package/src/context/compaction-utils.js +191 -0
  86. package/src/context/compressor.js +413 -0
  87. package/src/context/index.js +9 -0
  88. package/src/{core/context-manager.js → context/manager.js} +1 -1
  89. package/src/context/request.js +50 -0
  90. package/src/context/session.js +33 -0
  91. package/src/context/storage.js +30 -0
  92. package/src/executors/mcp-client.js +153 -0
  93. package/src/executors/mcp-desc.js +236 -0
  94. package/src/executors/mcp-executor.js +91 -956
  95. package/src/{core → framework}/command-registry.js +1 -1
  96. package/src/framework/framework.js +300 -0
  97. package/src/framework/index.js +18 -0
  98. package/src/framework/lifecycle.js +203 -0
  99. package/src/framework/loader.js +78 -0
  100. package/src/framework/registry.js +86 -0
  101. package/src/{core/ui-extension-context.js → framework/ui-extension.js} +1 -1
  102. package/src/index.js +130 -15
  103. package/src/llm/index.js +26 -0
  104. package/src/llm/provider.js +212 -0
  105. package/src/llm/registry.js +11 -0
  106. package/src/{core/token-counter.js → llm/tokens.js} +4 -37
  107. package/src/{core/plugin-base.js → plugin/base.js} +10 -136
  108. package/src/plugin/index.js +14 -0
  109. package/src/plugin/loader.js +101 -0
  110. package/src/plugin/manager.js +484 -0
  111. package/src/{core → session}/branch-summary-auto.js +2 -2
  112. package/src/{core/chat-session.js → session/chat.js} +2 -2
  113. package/src/session/index.js +7 -0
  114. package/src/{core/session-manager.js → session/session.js} +2 -2
  115. package/src/session/ttl.js +92 -0
  116. package/src/{core/jsonl-storage.js → storage/jsonl.js} +1 -1
  117. package/src/tool/executor.js +85 -0
  118. package/src/tool/index.js +15 -0
  119. package/src/tool/registry.js +143 -0
  120. package/src/{core/tool-router.js → tool/router.js} +17 -124
  121. package/src/tool/schema.js +108 -0
  122. package/src/utils/data-splitter.js +1 -1
  123. package/src/utils/download.js +1 -1
  124. package/src/utils/index.js +6 -6
  125. package/src/utils/message-validator.js +1 -1
  126. package/tests/core/context-storage.test.js +46 -0
  127. package/tests/core/llm.test.js +54 -0
  128. package/tests/core/plugin.test.js +42 -0
  129. package/tests/core/tool.test.js +60 -0
  130. package/tests/setup.js +10 -0
  131. package/tests/smoke.test.js +58 -0
  132. package/vitest.config.js +9 -0
  133. package/cli/src/daemon.js +0 -149
  134. package/docs/CONTEXT_DESIGN.md +0 -1596
  135. package/docs/ai-sdk-optimization.md +0 -655
  136. package/docs/features.md +0 -120
  137. package/docs/qq-bot.md +0 -976
  138. package/docs/quick-reference.md +0 -160
  139. package/docs/user-manual.md +0 -1391
  140. package/images/geometric_shapes.jpg +0 -0
  141. package/images/sunset_mountain_lake.jpg +0 -0
  142. package/skills/poster-guide/SKILL.md +0 -792
  143. package/src/capabilities/index.js +0 -11
  144. package/src/core/agent.js +0 -808
  145. package/src/core/context-compressor.js +0 -959
  146. package/src/core/enhanced-context-compressor.js +0 -210
  147. package/src/core/framework.js +0 -1422
  148. package/src/core/index.js +0 -30
  149. package/src/core/plugin-manager.js +0 -961
  150. package/src/core/provider-registry.js +0 -159
  151. package/src/core/provider.js +0 -156
  152. package/src/core/request-context.js +0 -98
  153. package/src/core/subagent.js +0 -442
  154. package/src/core/system-prompt-builder.js +0 -120
  155. package/src/core/tool-executor.js +0 -202
  156. package/src/core/tool-registry.js +0 -517
  157. package/src/core/worker-agent.js +0 -192
  158. package/src/executors/executor-base.js +0 -58
  159. package/src/utils/error-boundary.js +0 -363
  160. package/src/utils/error.js +0 -374
  161. package/system.md +0 -1645
  162. package/website_v2/README.md +0 -57
  163. package/website_v2/SPEC.md +0 -1
  164. package/website_v2/docs/api.html +0 -128
  165. package/website_v2/docs/configuration.html +0 -147
  166. package/website_v2/docs/plugin-development.html +0 -129
  167. package/website_v2/docs/project-structure.html +0 -89
  168. package/website_v2/docs/skill-development.html +0 -85
  169. package/website_v2/index.html +0 -489
  170. package/website_v2/scripts/main.js +0 -93
  171. package/website_v2/styles/animations.css +0 -8
  172. package/website_v2/styles/docs.css +0 -83
  173. package/website_v2/styles/main.css +0 -417
  174. package/xhs_auth.json +0 -268
  175. package//346/265/267/346/212/245/346/217/222/344/273/266.md +0 -621
  176. /package/plugins/{ambient-agent → ambient}/constants.js +0 -0
  177. /package/plugins/{email → messaging/email}/constants.js +0 -0
  178. /package/plugins/{email → messaging/email}/handlers.js +0 -0
  179. /package/plugins/{email → messaging/email}/monitor.js +0 -0
  180. /package/plugins/{email → messaging/email}/parser.js +0 -0
  181. /package/plugins/{email → messaging/email}/reply.js +0 -0
  182. /package/plugins/{email → messaging/email}/utils.js +0 -0
  183. /package/{examples → sandbox}/test-chat.js +0 -0
  184. /package/{examples → sandbox}/test-mcp.js +0 -0
  185. /package/{examples → sandbox}/test-reload.js +0 -0
  186. /package/{examples → sandbox}/test-telegram.js +0 -0
  187. /package/{examples → sandbox}/test-tg-bot.js +0 -0
  188. /package/{examples → sandbox}/test-tg-simple.js +0 -0
  189. /package/{examples → sandbox}/test-tg.js +0 -0
  190. /package/{examples → sandbox}/test-think.js +0 -0
  191. /package/src/{core/sub-agent-config.js → agent/sub-config.js} +0 -0
  192. /package/{cli/src → src/cli}/commands/daemon.js +0 -0
  193. /package/{cli/src → src/cli}/commands/list.js +0 -0
  194. /package/{cli/src → src/cli}/commands/plugin.js +0 -0
  195. /package/{cli/src → src/cli}/ui/components/agent-mention-provider.js +0 -0
  196. /package/{cli/src → src/cli}/ui/components/chained-autocomplete-provider.js +0 -0
  197. /package/{cli/src → src/cli}/ui/components/message-bubble.js +0 -0
  198. /package/{cli/src → src/cli}/ui/components/status-bar.js +0 -0
  199. /package/{cli/src → src/cli}/utils/ansi.js +0 -0
  200. /package/{cli/src → src/cli}/utils/config.js +0 -0
  201. /package/{cli/src → src/cli}/utils/markdown.js +0 -0
  202. /package/{cli/src → src/cli}/utils/plugin-config.js +0 -0
  203. /package/{cli/src → src/cli}/utils/render-diff.js +0 -0
  204. /package/src/{utils/circuit-breaker.js → common/circuit.js} +0 -0
  205. /package/src/{core → common}/constants.js +0 -0
  206. /package/src/{utils/edit-diff.js → common/diff.js} +0 -0
  207. /package/src/{utils/event-emitter.js → common/events.js} +0 -0
  208. /package/src/{utils → common}/id.js +0 -0
  209. /package/src/{utils → common}/retry.js +0 -0
  210. /package/src/{core/notification-manager.js → notification/manager.js} +0 -0
  211. /package/src/{core/session-entry.js → session/entry.js} +0 -0
  212. /package/src/{core/storage-manager.js → storage/manager.js} +0 -0
@@ -1,792 +0,0 @@
1
- ---
2
- name: poster-guide
3
- description: 海报设计技能 - 收集优秀设计风格、配色方案和创意灵感,当用户询问"海报制作"、"卡片制作"、"配图制作"时立即调用。
4
- allowed-tools: create_poster_canvas, add_poster_background, add_poster_rectangle, add_poster_circle, add_poster_line, add_poster_polygon, add_poster_text, add_poster_art_text, add_poster_image, add_poster_svg, add_poster_image_frame, add_poster_columns, add_poster_grid, add_poster_card, add_poster_badge, add_poster_cta, add_poster_feature, add_poster_feature_grid, add_poster_divider, add_poster_avatar, add_poster_progress, add_poster_rating, add_poster_quote, add_poster_stat_card, add_poster_tag_cloud, add_poster_stepper, add_poster_timeline, add_poster_list_item, add_poster_notification, add_poster_star, add_poster_arrow, add_poster_progress_circle, add_poster_chip, add_poster_chart, add_poster_watermark, add_poster_table, compose_poster, generate_poster, export_poster_canvas, export_poster_svg, list_poster_components
5
- ---
6
-
7
- # 海报设计技能指南
8
-
9
- > 本技能收集了来自日本优秀设计网站(muuuuu.org、ics.media 等)和国际设计平台(Behance、Dribbble,Pinterest 等)的流行趋势和配色方案。
10
-
11
- ---
12
-
13
- ## 📐 设计尺寸规范
14
-
15
- ### 社交媒体
16
-
17
- | 尺寸 | 用途 |
18
- | --------- | ----------------------- |
19
- | 1080×1080 | Instagram 正方形 |
20
- | 1080×1920 | Instagram Story / Reels |
21
- | 1200×630 | Facebook 封面 |
22
- | 1500×500 | Twitter 封面 |
23
- | 1200×627 | LinkedIn 封面 |
24
- | 2560×1440 | YouTube 封面 |
25
-
26
- ### 营销物料
27
-
28
- | 尺寸 | 用途 |
29
- | --------- | ---------------- |
30
- | 1920×1080 | 16:9 宣传海报 |
31
- | 1080×1920 | 9:16 竖版海报 |
32
- | 2480×3508 | A4 海报 (300dpi) |
33
- | 2000×2000 | 方形海报 |
34
-
35
- ### Banner 广告
36
-
37
- | 尺寸 | 用途 |
38
- | -------- | --------------- |
39
- | 1920×500 | 网站全屏 Banner |
40
- | 1200×400 | 电商 Banner |
41
- | 750×300 | 移动端 Banner |
42
- | 728×90 | PC 端横幅 |
43
-
44
- ---
45
-
46
- ## 🧩 组件速查表(共 35 个组件)
47
-
48
- ### 基础元素 (10)
49
-
50
- | 组件 | 工具名 | 用途 |
51
- | ------ | ------------------------ | ---------------- |
52
- | 背景 | `add_poster_background` | 纯色/渐变背景 |
53
- | 矩形 | `add_poster_rectangle` | 矩形、圆角矩形 |
54
- | 圆形 | `add_poster_circle` | 圆形、椭圆 |
55
- | 线条 | `add_poster_line` | 直线、虚线 |
56
- | 多边形 | `add_poster_polygon` | 三角形、六边形等 |
57
- | 文字 | `add_poster_text` | 普通文字 |
58
- | 艺术字 | `add_poster_art_text` | 渐变文字、描边 |
59
- | 图片 | `add_poster_image` | 插入图片 |
60
- | SVG | `add_poster_svg` | SVG 矢量图 |
61
- | 图片框 | `add_poster_image_frame` | 带装饰边框的图片 |
62
-
63
- ### 布局组件 (2)
64
-
65
- | 组件 | 工具名 | 用途 |
66
- | ---- | -------------------- | ------------------ |
67
- | 分栏 | `add_poster_columns` | 左右分栏、多栏布局 |
68
- | 网格 | `add_poster_grid` | 任意行列网格 |
69
-
70
- ### 装饰组件 (7) ⭐ 新增
71
-
72
- | 组件 | 工具名 | 用途 |
73
- | -------- | ---------------------------- | ---------------- |
74
- | 星形 | `add_poster_star` | 五角星、六角星等 |
75
- | 箭头 | `add_poster_arrow` | 指示箭头 |
76
- | 环形进度 | `add_poster_progress_circle` | 圆环进度条 |
77
- | 标签 | `add_poster_chip` | 小型信息标签 |
78
- | 图表 | `add_poster_chart` | 柱状图、饼图 |
79
- | 水印 | `add_poster_watermark` | 倾斜水印 |
80
- | 表格 | `add_poster_table` | 数据表格 |
81
-
82
- ### 高级组件 (16)
83
-
84
- | 组件 | 工具名 | 用途 |
85
- | -------- | ------------------------- | ------------ |
86
- | 卡片 | `add_poster_card` | 产品卡片 |
87
- | 徽章 | `add_poster_badge` | 标签徽章 |
88
- | 按钮 | `add_poster_cta` | 行动号召按钮 |
89
- | 特性 | `add_poster_feature` | 功能特性展示 |
90
- | 特性网格 | `add_poster_feature_grid` | 特性网格布局 |
91
- | 分隔线 | `add_poster_divider` | 水平分隔线 |
92
- | 头像 | `add_poster_avatar` | 用户头像 |
93
- | 进度条 | `add_poster_progress` | 线性进度条 |
94
- | 评分 | `add_poster_rating` | 星级评分 |
95
- | 引用 | `add_poster_quote` | 引用块 |
96
- | 统计卡 | `add_poster_stat_card` | 数据统计卡片 |
97
- | 标签云 | `add_poster_tag_cloud` | 标签集合 |
98
- | 步骤条 | `add_poster_stepper` | 步骤指示器 |
99
- | 时间线 | `add_poster_timeline` | 时间轴 |
100
- | 列表项 | `add_poster_list_item` | 列表条目 |
101
- | 通知 | `add_poster_notification` | 提示消息 |
102
-
103
- ---
104
-
105
- ## 🆕 新增组件详解
106
-
107
- ### 星形 (star) ⭐
108
-
109
- ```javascript
110
- add_poster_star({
111
- cx: 200, // 中心X坐标
112
- cy: 200, // 中心Y坐标
113
- points: 5, // 星形点数,默认5
114
- outerRadius: 60, // 外半径
115
- innerRadius: 25, // 内半径(可选,默认外半径*0.4)
116
- fill: '#fbbf24', // 填充颜色
117
- stroke: '#000000', // 边框颜色
118
- strokeWidth: 2, // 边框宽度
119
- opacity: 1, // 透明度
120
- rotation: 0, // 旋转角度
121
- });
122
- ```
123
-
124
- ### 箭头 (arrow) ⭐
125
-
126
- ```javascript
127
- add_poster_arrow({
128
- x1: 100, // 起点X
129
- y1: 200, // 起点Y
130
- x2: 300, // 终点X
131
- y2: 200, // 终点Y
132
- color: '#3b82f6', // 箭头颜色
133
- strokeWidth: 3, // 线宽
134
- headSize: 15, // 箭头头部大小
135
- style: 'solid', // solid(实线) / dashed(虚线)
136
- direction: 'end', // end(尾部) / start(头部) / both(双向)
137
- });
138
- ```
139
-
140
- ### 环形进度条 (progressCircle) ⭐
141
-
142
- ```javascript
143
- add_poster_progress_circle({
144
- cx: 200, // 圆心X坐标
145
- cy: 200, // 圆心Y坐标
146
- radius: 60, // 圆环半径
147
- value: 75, // 进度值 0-100
148
- strokeWidth: 12, // 环宽度
149
- trackColor: '#e5e7eb', // 轨道颜色
150
- fillColor: '#3b82f6', // 进度颜色
151
- backgroundColor: '#ffffff', // 背景填充色
152
- showLabel: true, // 显示百分比标签
153
- labelColor: '#3b82f6', // 标签颜色
154
- });
155
- ```
156
-
157
- ### 标签 (chip) ⭐
158
-
159
- ```javascript
160
- add_poster_chip({
161
- x: 200, // X坐标(居中)
162
- y: 150, // Y坐标
163
- text: 'NEW', // 标签文字
164
- background: '#ef4444', // 背景色
165
- color: '#ffffff', // 文字颜色
166
- borderColor: '#dc2626', // 边框颜色
167
- fontSize: 14, // 字体大小
168
- padding: 12, // 内边距
169
- radius: 16, // 圆角
170
- icon: '⭐', // 前置图标(可选)
171
- });
172
- ```
173
-
174
- ### 图表 (chart) ⭐
175
-
176
- ```javascript
177
- // 柱状图
178
- add_poster_chart({
179
- type: 'bar', // 类型:bar / pie
180
- x: 100,
181
- y: 300,
182
- width: 500,
183
- height: 250,
184
- data: [
185
- { label: '一月', value: 120, color: '#3b82f6' },
186
- { label: '二月', value: 90, color: '#10b981' },
187
- { label: '三月', value: 150, color: '#f59e0b' },
188
- { label: '四月', value: 110, color: '#ef4444' },
189
- ],
190
- showLabels: true, // 显示标签
191
- showValues: true, // 显示数值
192
- });
193
-
194
- // 饼图
195
- add_poster_chart({
196
- type: 'pie',
197
- x: 650,
198
- y: 300,
199
- width: 250,
200
- height: 250,
201
- data: [
202
- { label: '桌面端', value: 45, color: '#3b82f6' },
203
- { label: '移动端', value: 35, color: '#10b981' },
204
- { label: '平板', value: 20, color: '#f59e0b' },
205
- ],
206
- showLabels: true,
207
- });
208
- ```
209
-
210
- ### 水印 (watermark) ⭐
211
-
212
- ```javascript
213
- add_poster_watermark({
214
- text: 'VB-Agent', // 水印文字
215
- cx: 960, // 中心X坐标
216
- cy: 540, // 中心Y坐标
217
- color: 'rgba(200,200,200,0.3)', // 水印颜色
218
- fontSize: 120, // 字体大小
219
- fontFamily: 'sans-serif',
220
- opacity: 0.3, // 透明度
221
- rotation: -30, // 旋转角度
222
- align: 'center', // 对齐方式
223
- });
224
- ```
225
-
226
- ### 表格 (table) ⭐
227
-
228
- ```javascript
229
- add_poster_table({
230
- x: 100,
231
- y: 400,
232
- width: 800,
233
- columns: [
234
- { title: '功能', width: 250, align: 'left' },
235
- { title: '状态', width: 200 },
236
- { title: '价格', width: 150 },
237
- ],
238
- rows: [
239
- ['智能对话', '可用', '免费'],
240
- ['图片生成', '可用', '$29'],
241
- ['代码助手', 'Beta', '免费'],
242
- ],
243
- rowHeight: 45,
244
- headerBg: '#1e293b', // 表头背景
245
- headerColor: '#ffffff', // 表头文字色
246
- borderColor: '#e0e0e0',
247
- fontSize: 14,
248
- striped: true, // 斑马纹
249
- });
250
- ```
251
-
252
- ### 分栏布局 (columns) ⭐
253
-
254
- ```javascript
255
- add_poster_columns({
256
- x: 100,
257
- y: 100,
258
- width: 1720,
259
- height: 400,
260
- columns: 3, // 列数,默认2
261
- gap: 30, // 列间距
262
- background: '#fafafa',
263
- borderColor: '#e0e0e0',
264
- radius: 8,
265
- align: 'top', // top / center / bottom
266
- });
267
- ```
268
-
269
- ### 网格布局 (grid) ⭐
270
-
271
- ```javascript
272
- add_poster_grid({
273
- x: 100,
274
- y: 550,
275
- width: 1720,
276
- height: 400,
277
- columns: 4, // 列数,默认3
278
- rows: 2, // 行数,默认2
279
- gapX: 20, // 水平间距
280
- gapY: 20, // 垂直间距
281
- background: '#fafafa',
282
- borderColor: '#d0d0d0',
283
- radius: 0,
284
- direction: 'row', // row(行优先) / column(列优先)
285
- });
286
- ```
287
-
288
- ### 图片框 (imageFrame) ⭐
289
-
290
- ```javascript
291
- add_poster_image_frame({
292
- src: 'image.png', // 图片路径或URL
293
- x: 100,
294
- y: 100,
295
- width: 400,
296
- height: 300,
297
- borderColor: '#ffffff', // 边框颜色
298
- borderWidth: 3, // 边框宽度
299
- outerColor: '#1a1a2e', // 外边框颜色
300
- outerWidth: 6, // 外边框宽度
301
- radius: 8, // 圆角
302
- fit: 'cover', // cover / contain / fill
303
- });
304
- ```
305
-
306
- ---
307
-
308
- ## 🎨 日本设计配色方案(来源:MUUUUU)
309
-
310
- ### 1. 和風・禅意 (Japanese Zen)
311
-
312
- ```
313
- 主色: #1E4D7B (藏蓝 / 藍色)
314
- 强调: #C41E3A (朱红 / 紅色)
315
- 背景: #F5F0E8 (米白 / 白茶)
316
- 文字: #333333 (墨色)
317
- 点缀: #D4A574 (古铜金)
318
- ```
319
-
320
- ### 2. モダン和風 (Modern Japanese)
321
-
322
- ```
323
- 主色: #2C3E50 (墨灰)
324
- 强调: #C0392B (深红)
325
- 背景: #ECE5D8 (浅麻)
326
- 文字: #2C2C2C (浓墨)
327
- 点缀: #D4AF37 (金色)
328
- ```
329
-
330
- ---
331
-
332
- ## 🌸 日本特色设计风格(来源:MUUUUU 分类)
333
-
334
- ### 1. 和風デザイン (Japanese Style)
335
-
336
- ```javascript
337
- compose_poster({
338
- components: [
339
- { type: 'background', color: '#F5F0E8' },
340
- { type: 'rectangle', x: 80, y: 80, width: 920, height: 920, stroke: '#1E4D7B', strokeWidth: 1 },
341
- { type: 'circle', cx: 540, cy: 300, rx: 6, fill: '#C41E3A' },
342
- {
343
- type: 'artText',
344
- text: '花道',
345
- x: 540,
346
- y: 550,
347
- fontSize: 100,
348
- gradient: { colors: ['#1E4D7B', '#333333'] },
349
- },
350
- { type: 'divider', x: 540, y: 750, width: 100, color: '#C41E3A', thickness: 2 },
351
- {
352
- type: 'text',
353
- text: 'Ikebana',
354
- x: 540,
355
- y: 820,
356
- fontSize: 24,
357
- color: '#666666',
358
- align: 'center',
359
- },
360
- ],
361
- });
362
- ```
363
-
364
- ### 2. かわいい系 (Kawaii / Cute)
365
-
366
- ```javascript
367
- compose_poster({
368
- components: [
369
- { type: 'background', color: '#FFF5E6' },
370
- { type: 'circle', cx: 200, cy: 200, rx: 100, fill: '#FFB6C1', opacity: 0.6 },
371
- { type: 'star', cx: 400, cy: 300, points: 5, outerRadius: 60, fill: '#FFB6C1' },
372
- {
373
- type: 'artText',
374
- text: 'HELLO',
375
- x: 540,
376
- y: 450,
377
- fontSize: 120,
378
- gradient: { colors: ['#FF6B9D', '#C44569'] },
379
- },
380
- { type: 'chip', x: 540, y: 550, text: 'NEW', background: '#FF6B9D', color: '#ffffff' },
381
- {
382
- type: 'cta',
383
- x: 540,
384
- y: 700,
385
- text: 'Learn More',
386
- background: '#FF6B9D',
387
- color: '#FFFFFF',
388
- radius: 25,
389
- },
390
- ],
391
- });
392
- ```
393
-
394
- ---
395
-
396
- ## 📊 实用数据可视化示例
397
-
398
- ### 仪表盘卡片
399
-
400
- ```javascript
401
- compose_poster({
402
- components: [
403
- { type: 'background', color: '#0f172a' },
404
- { type: 'text', text: '数据概览', x: 100, y: 80, fontSize: 32, color: '#ffffff' },
405
-
406
- // 环形进度条
407
- {
408
- type: 'progressCircle',
409
- cx: 200,
410
- cy: 250,
411
- radius: 80,
412
- value: 75,
413
- strokeWidth: 15,
414
- fillColor: '#3b82f6',
415
- trackColor: '#334155',
416
- showLabel: true,
417
- },
418
- {
419
- type: 'progressCircle',
420
- cx: 450,
421
- cy: 250,
422
- radius: 80,
423
- value: 60,
424
- strokeWidth: 15,
425
- fillColor: '#10b981',
426
- trackColor: '#334155',
427
- showLabel: true,
428
- },
429
- {
430
- type: 'progressCircle',
431
- cx: 700,
432
- cy: 250,
433
- radius: 80,
434
- value: 45,
435
- strokeWidth: 15,
436
- fillColor: '#f59e0b',
437
- trackColor: '#334155',
438
- showLabel: true,
439
- },
440
-
441
- // 柱状图
442
- {
443
- type: 'chart',
444
- type: 'bar',
445
- x: 100,
446
- y: 400,
447
- width: 600,
448
- height: 300,
449
- data: [
450
- { label: '周一', value: 120, color: '#3b82f6' },
451
- { label: '周二', value: 90, color: '#10b981' },
452
- { label: '周三', value: 150, color: '#f59e0b' },
453
- { label: '周四', value: 110, color: '#ef4444' },
454
- { label: '周五', value: 180, color: '#8b5cf6' },
455
- ],
456
- showLabels: true,
457
- showValues: true,
458
- },
459
-
460
- // 数据表格
461
- {
462
- type: 'table',
463
- x: 750,
464
- y: 400,
465
- width: 400,
466
- columns: [
467
- { title: '指标', width: 150 },
468
- { title: '数值', width: 100 },
469
- ],
470
- rows: [
471
- ['总用户', '10,000'],
472
- ['活跃用户', '7,500'],
473
- ['增长率', '+25%'],
474
- ],
475
- headerBg: '#1e293b',
476
- headerColor: '#ffffff',
477
- },
478
- ],
479
- });
480
- ```
481
-
482
- ### 特性展示海报
483
-
484
- ```javascript
485
- compose_poster({
486
- components: [
487
- { type: 'background', color: '#ffffff' },
488
- {
489
- type: 'text',
490
- text: '产品特性',
491
- x: 960,
492
- y: 80,
493
- fontSize: 48,
494
- color: '#1e293b',
495
- align: 'center',
496
- },
497
-
498
- // 分栏布局
499
- {
500
- type: 'columns',
501
- x: 100,
502
- y: 150,
503
- width: 1720,
504
- height: 400,
505
- columns: 3,
506
- gap: 40,
507
- borderColor: '#e2e8f0',
508
- },
509
-
510
- // 星星装饰
511
- { type: 'star', cx: 200, cy: 200, points: 5, outerRadius: 40, fill: '#fbbf24' },
512
- { type: 'star', cx: 600, cy: 200, points: 6, outerRadius: 35, fill: '#f472b6' },
513
- { type: 'star', cx: 1000, cy: 200, points: 8, outerRadius: 38, fill: '#60a5fa' },
514
-
515
- // 标签
516
- { type: 'chip', x: 200, y: 350, text: 'AI驱动', background: '#dbeafe', color: '#2563eb' },
517
- { type: 'chip', x: 600, y: 350, text: '实时响应', background: '#dcfce7', color: '#16a34a' },
518
- { type: 'chip', x: 1000, y: 350, text: '安全可靠', background: '#fef3c7', color: '#d97706' },
519
-
520
- // CTA按钮
521
- {
522
- type: 'cta',
523
- x: 960,
524
- y: 600,
525
- text: '立即体验 →',
526
- background: '#3b82f6',
527
- color: '#ffffff',
528
- radius: 30,
529
- },
530
- ],
531
- });
532
- ```
533
-
534
- ---
535
-
536
- ## 📋 完整海报示例
537
-
538
- ### AI 产品发布海报
539
-
540
- ```javascript
541
- compose_poster({
542
- components: [
543
- { type: 'background', color: '#0D0D1A' },
544
- { type: 'circle', cx: 900, cy: 100, rx: 200, fill: '#00D9FF', opacity: 0.1 },
545
- { type: 'star', cx: 200, cy: 200, points: 5, outerRadius: 60, fill: '#fbbf24', opacity: 0.8 },
546
- {
547
- type: 'artText',
548
- text: 'FOLIKO',
549
- x: 540,
550
- y: 320,
551
- fontSize: 140,
552
- gradient: { colors: ['#00D9FF', '#00FF88'] },
553
- shadow: { color: '#00D9FF', blur: 40 },
554
- },
555
- {
556
- type: 'text',
557
- text: '简约的插件化 Agent 框架',
558
- x: 540,
559
- y: 420,
560
- fontSize: 36,
561
- color: '#A0AEC0',
562
- align: 'center',
563
- },
564
- { type: 'divider', x: 540, y: 500, width: 200, color: '#00D9FF' },
565
- {
566
- type: 'featureGrid',
567
- x: 90,
568
- y: 560,
569
- columns: 3,
570
- itemWidth: 300,
571
- itemHeight: 150,
572
- items: [
573
- { icon: '⚡', title: '插件化架构', description: '核心简单' },
574
- { icon: '🤖', title: '多 AI 支持', description: '多种大模型' },
575
- { icon: '📡', title: '流式输出', description: '实时响应' },
576
- ],
577
- background: '#1A1A2E',
578
- borderColor: '#00D9FF',
579
- },
580
- {
581
- type: 'cta',
582
- x: 540,
583
- y: 950,
584
- text: 'npm install -g foliko',
585
- background: '#00D9FF',
586
- color: '#0D0D1A',
587
- fontSize: 22,
588
- },
589
- ],
590
- });
591
- ```
592
-
593
- ### 数据仪表盘
594
-
595
- ```javascript
596
- compose_poster({
597
- components: [
598
- { type: 'background', color: '#f8fafc' },
599
- {
600
- type: 'text',
601
- text: '数据概览',
602
- x: 960,
603
- y: 60,
604
- fontSize: 36,
605
- color: '#1e293b',
606
- align: 'center',
607
- },
608
-
609
- // 环形进度
610
- {
611
- type: 'progressCircle',
612
- cx: 200,
613
- cy: 200,
614
- radius: 70,
615
- value: 85,
616
- strokeWidth: 12,
617
- fillColor: '#3b82f6',
618
- showLabel: true,
619
- },
620
- {
621
- type: 'text',
622
- text: '完成率',
623
- x: 200,
624
- y: 300,
625
- fontSize: 14,
626
- color: '#64748b',
627
- align: 'center',
628
- },
629
-
630
- {
631
- type: 'progressCircle',
632
- cx: 450,
633
- cy: 200,
634
- radius: 70,
635
- value: 60,
636
- strokeWidth: 12,
637
- fillColor: '#10b981',
638
- showLabel: true,
639
- },
640
- {
641
- type: 'text',
642
- text: '增长率',
643
- x: 450,
644
- y: 300,
645
- fontSize: 14,
646
- color: '#64748b',
647
- align: 'center',
648
- },
649
-
650
- // 柱状图
651
- {
652
- type: 'chart',
653
- type: 'bar',
654
- x: 700,
655
- y: 100,
656
- width: 500,
657
- height: 250,
658
- data: [
659
- { label: 'Q1', value: 120, color: '#3b82f6' },
660
- { label: 'Q2', value: 150, color: '#10b981' },
661
- { label: 'Q3', value: 180, color: '#f59e0b' },
662
- { label: 'Q4', value: 220, color: '#ef4444' },
663
- ],
664
- showLabels: true,
665
- showValues: true,
666
- },
667
-
668
- // 表格
669
- {
670
- type: 'table',
671
- x: 100,
672
- y: 400,
673
- width: 1720,
674
- columns: [
675
- { title: '产品', width: 400, align: 'left' },
676
- { title: '销量', width: 200 },
677
- { title: '增长率', width: 200 },
678
- ],
679
- rows: [
680
- ['智能助手 Pro', '1,250', '+25%'],
681
- ['图片生成器', '890', '+18%'],
682
- ['代码助手', '2,100', '+42%'],
683
- ],
684
- headerBg: '#1e293b',
685
- headerColor: '#ffffff',
686
- fontSize: 14,
687
- },
688
-
689
- // 水印
690
- {
691
- type: 'watermark',
692
- text: 'FOLIKO',
693
- cx: 960,
694
- cy: 700,
695
- fontSize: 200,
696
- color: 'rgba(0,0,0,0.03)',
697
- rotation: -15,
698
- },
699
- ],
700
- });
701
- ```
702
-
703
- ---
704
-
705
- ## 🛠️ 工具速查
706
-
707
- | 工具 | 用途 |
708
- | ------------------------ | --------------- |
709
- | `list_poster_components` | 列出所有组件 |
710
- | `compose_poster` | 组件化生成海报 |
711
- | `export_poster_canvas` | 导出 PNG |
712
- | `export_poster_svg` | 导出 SVG (矢量) |
713
-
714
- ---
715
-
716
- ## 🔤 Emoji 字体说明
717
-
718
- ### 字体配置
719
-
720
- poster 插件会自动加载 `plugins/poster-plugin/fonts/` 目录下的 emoji 字体文件。
721
-
722
- | 字体文件 | 说明 |
723
- | ------------------- | -------------------------------------- |
724
- | `SegoeUI Emoji.ttf` | Windows Emoji 字体(所有平台统一使用) |
725
-
726
- ### 注意事项
727
-
728
- ⚠️ **node-canvas 限制**:由于 node-canvas 渲染引擎的限制,emoji 会显示为**黑白轮廓**,不支持彩色渲染。如需彩色 emoji,请使用 `add_poster_image()` 插入 PNG 图片。
729
-
730
- ### 推荐的 Emoji 使用方式
731
-
732
- ```javascript
733
- // 方式一:使用 emoji 文字(黑白轮廓)
734
- add_poster_text({
735
- text: '🚀 ⚡ ✨ 🤖 💫',
736
- x: 540,
737
- y: 300,
738
- fontSize: 48,
739
- color: '#ffffff',
740
- align: 'center',
741
- });
742
-
743
- // 方式二:使用组件绘制装饰形状(彩色)
744
- add_poster_star({
745
- cx: 200,
746
- cy: 200,
747
- points: 5,
748
- outerRadius: 60,
749
- fill: '#fbbf24', // 金色五角星
750
- opacity: 0.8,
751
- });
752
- ```
753
-
754
- ### 常用 Emoji 分类
755
-
756
- | 分类 | Emoji |
757
- | ---- | -------------------- |
758
- | 笑脸 | 😀 😃 😄 😁 🤣 😂 😊 |
759
- | 爱心 | ❤️ 🧡 💛 💚 💙 💜 🖤 |
760
- | 星星 | 🌟 ⭐ 💫 ✨ ⚡ |
761
- | 派对 | 🎉 🎊 🥳 🎈 🎁 |
762
- | 科技 | 🤖 🚀 💻 📡 🔌 |
763
- | 动物 | 🐱 🐶 🐰 🦊 🐻 🐼 |
764
-
765
- ---
766
-
767
- ## 📚 参考资源
768
-
769
- ### 日本设计灵感
770
-
771
- | 网站 | URL | 特点 |
772
- | ---------- | ------------------------- | ------------------ |
773
- | MUUUUU | https://muuuuu.org | 卓越Web设计精选 |
774
- | ICS MEDIA | https://ics.media | 前端技术 + CSS设计 |
775
- | Lifehacker | https://www.lifehacker.jp | 生活设计科技 |
776
-
777
- ### 国际设计平台
778
-
779
- | 网站 | URL | 特点 |
780
- | --------- | --------------------- | -------------- |
781
- | Behance | https://behance.net | 专业设计作品集 |
782
- | Dribbble | https://dribbble.com | 设计师社区 |
783
- | Pinterest | https://pinterest.com | 视觉灵感收藏 |
784
- | Awwwards | https://awwwards.com | 最佳网页设计 |
785
-
786
- ### 配色灵感
787
-
788
- | 网站 | URL | 特点 |
789
- | ----------- | ----------------------- | ------------ |
790
- | Coolors | https://coolors.co | 智能配色生成 |
791
- | Color Hunt | https://colorhunt.co | 配色方案分享 |
792
- | Adobe Color | https://color.adobe.com | 配色趋势 |