foliko 1.1.2 → 1.1.4

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 (205) hide show
  1. package/.agent/agents/code-assistant.json +14 -0
  2. package/.agent/agents/email-assistant.json +14 -0
  3. package/.agent/agents/file-assistant.json +15 -0
  4. package/.agent/agents/system-assistant.json +15 -0
  5. package/.agent/agents/web-assistant.json +12 -0
  6. package/.agent/data/ambient/goals.json +50 -0
  7. package/.agent/data/ambient/memories.json +7 -0
  8. package/.agent/data/default.json +3 -412
  9. package/.agent/data/plugins-state.json +174 -173
  10. package/.agent/data/scheduler/tasks.json +1 -0
  11. package/.agent/memory/core.md +1 -0
  12. package/.agent/memory/project/mnn93ogy-ypjn27.md +9 -0
  13. package/.agent/memory/project/mnn98fqy-5nhc1u.md +25 -0
  14. package/.agent/memory/reference/mnq3oenw-46haj6.md +63 -0
  15. package/.agent/memory/reference/mnq5qxm2-mjoooh.md +116 -0
  16. package/.agent/memory/user/mnm67t9m-x8rekk.md +9 -0
  17. package/.agent/memory/user/mnn5mmqh-w6aktx.md +11 -0
  18. package/.agent/memory/user/mnnbfhhn-dk1bd1.md +22 -0
  19. package/.agent/package.json +8 -0
  20. package/.agent/plugins/__pycache__/file_writer.cpython-312.pyc +0 -0
  21. package/.agent/plugins/daytona/README.md +89 -0
  22. package/.agent/plugins/daytona/index.js +377 -0
  23. package/.agent/plugins/daytona/package.json +12 -0
  24. package/.agent/plugins/marknative/README.md +134 -0
  25. package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
  26. package/.agent/plugins/marknative/index.js +256 -0
  27. package/.agent/plugins/marknative/package.json +12 -0
  28. package/.agent/plugins/marknative/update-readme.js +134 -0
  29. package/.agent/plugins/poster-plugin/emojis/rocket.png +1 -0
  30. package/.agent/plugins/poster-plugin/fonts/SegoeUI Emoji.ttf +0 -0
  31. package/.agent/plugins/poster-plugin/src/elements/text.js +3 -1
  32. package/.agent/plugins/poster-plugin/src/fonts.js +10 -0
  33. package/.agent/plugins/poster-plugin/yarn.lock +1007 -0
  34. package/.agent/plugins/system-info/index.js +387 -0
  35. package/.agent/plugins/system-info/package.json +4 -0
  36. package/.agent/plugins/system-info/test.js +40 -0
  37. package/.agent/plugins.json +11 -5
  38. package/.agent/python-scripts/test_sample.py +24 -0
  39. package/.agent/sessions/cli_default.json +1869 -691
  40. package/.agent/skills/agent-browser/SKILL.md +311 -0
  41. package/.agent/skills/agent-browser/TEST_PLAN.md +200 -0
  42. package/.agent/skills/sysinfo/SKILL.md +38 -0
  43. package/.agent/skills/sysinfo/system-info.sh +130 -0
  44. package/.agent/skills/workflow/SKILL.md +324 -0
  45. package/.agent/weixin.json +6 -0
  46. package/.agent/workflows/email-digest.json +50 -0
  47. package/.agent/workflows/file-backup.json +21 -0
  48. package/.agent/workflows/get-ip-notify.json +32 -0
  49. package/.agent/workflows/news-aggregator.json +93 -0
  50. package/.agent/workflows/news-dashboard-v2.json +94 -0
  51. package/.agent/workflows/notification-batch.json +32 -0
  52. package/.claude/settings.local.json +1 -20
  53. package/.env.example +56 -56
  54. package/README.md +441 -441
  55. package/cli/src/commands/chat.js +22 -13
  56. package/cli/src/ui/chat-ui.js +50 -37
  57. package/output/emoji-segoe-test-v2.png +0 -0
  58. package/output/emoji-segoe-test.png +0 -0
  59. package/output/emoji-test.png +0 -0
  60. package/output/emoji-windows-test.png +0 -0
  61. package/output/foliko-emoji-poster.png +0 -0
  62. package/output/foliko-muji-poster-final.png +0 -0
  63. package/output/foliko-muji-poster-v2.png +0 -0
  64. package/output/foliko-muji-poster.png +0 -0
  65. package/output/foliko-share.png +0 -0
  66. package/output/progress-circle-test.png +0 -0
  67. package/output/vb-agent-poster.png +0 -0
  68. package/package.json +1 -2
  69. package/plugins/default-plugins.js +4 -3
  70. package/plugins/extension-executor-plugin.js +12 -91
  71. package/plugins/file-system-plugin.js +19 -4
  72. package/plugins/memory-plugin.js +33 -4
  73. package/plugins/subagent-plugin.js +14 -37
  74. package/plugins/weixin-plugin.js +40 -168
  75. package/skills/find-skills/AGENTS.md +162 -162
  76. package/skills/find-skills/SKILL.md +133 -133
  77. package/skills/poster-guide/SKILL.md +669 -1426
  78. package/src/core/agent-chat.js +439 -269
  79. package/src/core/agent.js +3 -6
  80. package/.agent/.shared/ui-ux-pro-max/data/charts.csv +0 -26
  81. package/.agent/.shared/ui-ux-pro-max/data/colors.csv +0 -97
  82. package/.agent/.shared/ui-ux-pro-max/data/icons.csv +0 -101
  83. package/.agent/.shared/ui-ux-pro-max/data/landing.csv +0 -31
  84. package/.agent/.shared/ui-ux-pro-max/data/products.csv +0 -97
  85. package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +0 -24
  86. package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +0 -45
  87. package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +0 -53
  88. package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -56
  89. package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -53
  90. package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +0 -53
  91. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -51
  92. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -59
  93. package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
  94. package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +0 -54
  95. package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +0 -61
  96. package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +0 -54
  97. package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +0 -51
  98. package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +0 -50
  99. package/.agent/.shared/ui-ux-pro-max/data/styles.csv +0 -59
  100. package/.agent/.shared/ui-ux-pro-max/data/typography.csv +0 -58
  101. package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +0 -101
  102. package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
  103. package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +0 -31
  104. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
  105. package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
  106. package/.agent/.shared/ui-ux-pro-max/scripts/core.py +0 -258
  107. package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +0 -1067
  108. package/.agent/.shared/ui-ux-pro-max/scripts/search.py +0 -106
  109. package/.agent/ARCHITECTURE.md +0 -288
  110. package/.agent/agents/ambient-agent.md +0 -57
  111. package/.agent/agents/debugger.md +0 -55
  112. package/.agent/agents/email-assistant.md +0 -49
  113. package/.agent/agents/file-manager.md +0 -42
  114. package/.agent/agents/python-developer.md +0 -60
  115. package/.agent/agents/scheduler.md +0 -59
  116. package/.agent/agents/web-developer.md +0 -45
  117. package/.agent/data/puppeteer-sessions/undefined.json +0 -6
  118. package/.agent/data/weixin-media/2026-04-08/img_1775618677512.jpg +0 -0
  119. package/.agent/data/weixin-media/2026-04-08/img_1775619073340.jpg +0 -0
  120. package/.agent/data/weixin-media/2026-04-08/img_1775619097536.jpg +0 -0
  121. package/.agent/data/weixin-media/2026-04-08/img_1775619209388.jpg +0 -0
  122. package/.agent/mcp_config_updated.json +0 -12
  123. package/.agent/plugins/poster-plugin/fonts/NotoColorEmoji-Regular.ttf +0 -0
  124. package/.agent/plugins/puppeteer-plugin/README.md +0 -147
  125. package/.agent/plugins/puppeteer-plugin/index.js +0 -1418
  126. package/.agent/plugins/puppeteer-plugin/package.json +0 -9
  127. package/.agent/rules/GEMINI.md +0 -273
  128. package/.agent/rules/allow-rule.md +0 -77
  129. package/.agent/rules/log-rule.md +0 -83
  130. package/.agent/rules/security-rule.md +0 -93
  131. package/.agent/scripts/auto_preview.py +0 -148
  132. package/.agent/scripts/checklist.py +0 -217
  133. package/.agent/scripts/session_manager.py +0 -120
  134. package/.agent/scripts/verify_all.py +0 -327
  135. package/.agent/sessions/weixin_o9cq80zgZqKPA2-s59PN43GdDy1w@im.wechat.json +0 -11097
  136. package/.agent/skills/api-patterns/SKILL.md +0 -81
  137. package/.agent/skills/api-patterns/api-style.md +0 -42
  138. package/.agent/skills/api-patterns/auth.md +0 -24
  139. package/.agent/skills/api-patterns/documentation.md +0 -26
  140. package/.agent/skills/api-patterns/graphql.md +0 -41
  141. package/.agent/skills/api-patterns/rate-limiting.md +0 -31
  142. package/.agent/skills/api-patterns/response.md +0 -37
  143. package/.agent/skills/api-patterns/rest.md +0 -40
  144. package/.agent/skills/api-patterns/scripts/api_validator.py +0 -211
  145. package/.agent/skills/api-patterns/security-testing.md +0 -122
  146. package/.agent/skills/api-patterns/trpc.md +0 -41
  147. package/.agent/skills/api-patterns/versioning.md +0 -22
  148. package/.agent/skills/app-builder/SKILL.md +0 -75
  149. package/.agent/skills/app-builder/agent-coordination.md +0 -71
  150. package/.agent/skills/app-builder/feature-building.md +0 -53
  151. package/.agent/skills/app-builder/project-detection.md +0 -34
  152. package/.agent/skills/app-builder/scaffolding.md +0 -118
  153. package/.agent/skills/app-builder/tech-stack.md +0 -40
  154. package/.agent/skills/app-builder/templates/SKILL.md +0 -39
  155. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +0 -76
  156. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +0 -92
  157. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +0 -88
  158. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +0 -88
  159. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +0 -83
  160. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +0 -90
  161. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +0 -90
  162. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +0 -122
  163. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +0 -122
  164. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +0 -169
  165. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +0 -134
  166. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +0 -83
  167. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +0 -119
  168. package/.agent/skills/architecture/SKILL.md +0 -55
  169. package/.agent/skills/architecture/context-discovery.md +0 -43
  170. package/.agent/skills/architecture/examples.md +0 -94
  171. package/.agent/skills/architecture/pattern-selection.md +0 -68
  172. package/.agent/skills/architecture/patterns-reference.md +0 -50
  173. package/.agent/skills/architecture/trade-off-analysis.md +0 -77
  174. package/.agent/skills/clean-code/SKILL.md +0 -201
  175. package/.agent/skills/doc.md +0 -177
  176. package/.agent/skills/frontend-design/SKILL.md +0 -418
  177. package/.agent/skills/frontend-design/animation-guide.md +0 -331
  178. package/.agent/skills/frontend-design/color-system.md +0 -311
  179. package/.agent/skills/frontend-design/decision-trees.md +0 -418
  180. package/.agent/skills/frontend-design/motion-graphics.md +0 -306
  181. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +0 -183
  182. package/.agent/skills/frontend-design/scripts/ux_audit.py +0 -722
  183. package/.agent/skills/frontend-design/typography-system.md +0 -345
  184. package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
  185. package/.agent/skills/frontend-design/visual-effects.md +0 -383
  186. package/.agent/skills/i18n-localization/SKILL.md +0 -154
  187. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +0 -241
  188. package/.agent/skills/mcp-builder/SKILL.md +0 -176
  189. package/.agent/skills/web-design-guidelines/SKILL.md +0 -57
  190. package/.agent/workflows/brainstorm.md +0 -113
  191. package/.agent/workflows/create.md +0 -59
  192. package/.agent/workflows/debug.md +0 -103
  193. package/.agent/workflows/deploy.md +0 -176
  194. package/.agent/workflows/enhance.md +0 -63
  195. package/.agent/workflows/orchestrate.md +0 -237
  196. package/.agent/workflows/plan.md +0 -89
  197. package/.agent/workflows/preview.md +0 -81
  198. package/.agent/workflows/simple-test.md +0 -42
  199. package/.agent/workflows/status.md +0 -86
  200. package/.agent/workflows/structured-orchestrate.md +0 -180
  201. package/.agent/workflows/test.md +0 -144
  202. package/.agent/workflows/ui-ux-pro-max.md +0 -296
  203. package/output/beef-love-poster.png +0 -0
  204. package/output/international-news-daily.png +0 -0
  205. package/poster-test-2.png +0 -0
@@ -0,0 +1,387 @@
1
+ /**
2
+ * System Info Plugin - 获取系统信息插件
3
+ * 提供 CPU、内存、操作系统、磁盘、网络等系统信息查询功能
4
+ */
5
+
6
+ const { Plugin } = require('../../../src/core/plugin-base')
7
+ const { z } = require('zod')
8
+ const os = require('os')
9
+ const { execSync } = require('child_process')
10
+
11
+ class SystemInfoPlugin extends Plugin {
12
+ constructor(config = {}) {
13
+ super()
14
+ this.name = 'system-info'
15
+ this.version = '1.0.0'
16
+ this.description = '获取系统信息插件 - 提供 CPU、内存、操作系统、磁盘、网络等系统信息查询功能'
17
+ this.priority = 10
18
+ }
19
+
20
+ install(framework) {
21
+ super.install(framework)
22
+ this._registerTools()
23
+ return this
24
+ }
25
+
26
+ _registerTools() {
27
+ const framework = this._framework
28
+
29
+ // 获取简略系统信息
30
+ framework.registerTool({
31
+ name: 'get_basic_info',
32
+ description: '获取简略系统信息,包括主机名、操作系统、平台、架构、运行时间等基本信息',
33
+ inputSchema: z.object({}),
34
+ execute: async (args, framework) => {
35
+ const uptime = os.uptime()
36
+ const uptimeStr = this.formatUptime(uptime)
37
+
38
+ return {
39
+ success: true,
40
+ data: {
41
+ hostname: os.hostname(),
42
+ platform: os.platform(),
43
+ osType: os.type(),
44
+ osRelease: os.release(),
45
+ arch: os.arch(),
46
+ nodeVersion: process.version,
47
+ processUptime: uptimeStr,
48
+ totalMemory: this.formatBytes(os.totalmem()),
49
+ cpuCount: os.cpus().length,
50
+ cpuModel: os.cpus()[0]?.model || 'Unknown'
51
+ }
52
+ }
53
+ }
54
+ })
55
+
56
+ // 获取 CPU 详细信息
57
+ framework.registerTool({
58
+ name: 'get_cpu_info',
59
+ description: '获取 CPU 详细信息,包括每个核心的频率、使用率等',
60
+ inputSchema: z.object({}),
61
+ execute: async (args, framework) => {
62
+ const cpus = os.cpus()
63
+ const cpuInfo = cpus.map((cpu, index) => ({
64
+ core: index,
65
+ model: cpu.model,
66
+ speed: `${cpu.speed} MHz`,
67
+ times: {
68
+ user: this.formatMs(cpu.times.user),
69
+ nice: this.formatMs(cpu.times.nice),
70
+ sys: this.formatMs(cpu.times.sys),
71
+ idle: this.formatMs(cpu.times.idle),
72
+ irq: this.formatMs(cpu.times.irq)
73
+ }
74
+ }))
75
+
76
+ // 计算平均 CPU 使用率
77
+ const avgUsage = this.calculateCpuUsage(cpus)
78
+
79
+ return {
80
+ success: true,
81
+ data: {
82
+ cpuCount: cpus.length,
83
+ totalCores: cpus.length,
84
+ averageUsage: avgUsage,
85
+ cores: cpuInfo
86
+ }
87
+ }
88
+ }
89
+ })
90
+
91
+ // 获取内存信息
92
+ framework.registerTool({
93
+ name: 'get_memory_info',
94
+ description: '获取内存使用信息,包括总内存、已用内存、可用内存、使用率等',
95
+ inputSchema: z.object({}),
96
+ execute: async (args, framework) => {
97
+ const totalMem = os.totalmem()
98
+ const freeMem = os.freemem()
99
+ const usedMem = totalMem - freeMem
100
+ const usagePercent = ((usedMem / totalMem) * 100).toFixed(2)
101
+
102
+ return {
103
+ success: true,
104
+ data: {
105
+ total: this.formatBytes(totalMem),
106
+ free: this.formatBytes(freeMem),
107
+ used: this.formatBytes(usedMem),
108
+ usagePercent: `${usagePercent}%`,
109
+ details: {
110
+ totalBytes: totalMem,
111
+ freeBytes: freeMem,
112
+ usedBytes: usedMem
113
+ }
114
+ }
115
+ }
116
+ }
117
+ })
118
+
119
+ // 获取网络接口信息
120
+ framework.registerTool({
121
+ name: 'get_network_info',
122
+ description: '获取网络接口信息,包括 IP 地址、MAC 地址、网络类型等',
123
+ inputSchema: z.object({}),
124
+ execute: async (args, framework) => {
125
+ const interfaces = os.networkInterfaces()
126
+ const networkInfo = {}
127
+
128
+ for (const [name, addrs] of Object.entries(interfaces)) {
129
+ const addrList = addrs.map(addr => ({
130
+ address: addr.address,
131
+ family: addr.family,
132
+ mac: addr.mac,
133
+ internal: addr.internal,
134
+ netmask: addr.netmask
135
+ }))
136
+ networkInfo[name] = addrList
137
+ }
138
+
139
+ return {
140
+ success: true,
141
+ data: {
142
+ interfaces: networkInfo,
143
+ hostname: os.hostname()
144
+ }
145
+ }
146
+ }
147
+ })
148
+
149
+ // 获取磁盘信息
150
+ framework.registerTool({
151
+ name: 'get_disk_info',
152
+ description: '获取磁盘使用信息,包括各磁盘的总容量、已用空间、可用空间、使用率',
153
+ inputSchema: z.object({
154
+ platform: z.enum(['windows', 'linux', 'darwin', 'auto']).optional().describe('操作系统平台,auto 为自动检测')
155
+ }),
156
+ execute: async (args, framework) => {
157
+ const diskInfo = []
158
+ const currentPlatform = args.platform === 'auto' ? os.platform() : (args.platform || os.platform())
159
+
160
+ try {
161
+ if (currentPlatform === 'win32') {
162
+ // Windows 系统
163
+ const output = execSync('wmic logicaldisk get size,freespace,caption', { encoding: 'utf8', timeout: 5000 })
164
+ const lines = output.trim().split('\n').slice(1)
165
+
166
+ for (const line of lines) {
167
+ const parts = line.trim().split(/\s+/)
168
+ if (parts.length >= 3) {
169
+ const caption = parts[0]
170
+ const freeSpace = parseInt(parts[1]) || 0
171
+ const size = parseInt(parts[2]) || 0
172
+ const used = size - freeSpace
173
+ const usagePercent = size > 0 ? ((used / size) * 100).toFixed(2) : 0
174
+
175
+ diskInfo.push({
176
+ filesystem: caption,
177
+ total: this.formatBytes(size),
178
+ used: this.formatBytes(used),
179
+ free: this.formatBytes(freeSpace),
180
+ usagePercent: `${usagePercent}%`,
181
+ details: {
182
+ totalBytes: size,
183
+ usedBytes: used,
184
+ freeBytes: freeSpace
185
+ }
186
+ })
187
+ }
188
+ }
189
+ } else if (currentPlatform === 'linux') {
190
+ // Linux 系统
191
+ const output = execSync('df -B1 --output=source,size,used,avail -x tmpfs -x devtmpfs -x squashfs 2>/dev/null || df -B1', { encoding: 'utf8', timeout: 5000 })
192
+ const lines = output.trim().split('\n').slice(1)
193
+
194
+ for (const line of lines) {
195
+ const parts = line.trim().split(/\s+/)
196
+ if (parts.length >= 4) {
197
+ const filesystem = parts[0]
198
+ const size = parseInt(parts[1]) || 0
199
+ const used = parseInt(parts[2]) || 0
200
+ const free = parseInt(parts[3]) || 0
201
+ const usagePercent = size > 0 ? ((used / size) * 100).toFixed(2) : 0
202
+
203
+ // 过滤掉虚拟文件系统
204
+ if (!filesystem.startsWith('/dev') && !filesystem.startsWith('/sys') && !filesystem.startsWith('/proc')) {
205
+ continue
206
+ }
207
+
208
+ diskInfo.push({
209
+ filesystem,
210
+ total: this.formatBytes(size),
211
+ used: this.formatBytes(used),
212
+ free: this.formatBytes(free),
213
+ usagePercent: `${usagePercent}%`,
214
+ details: {
215
+ totalBytes: size,
216
+ usedBytes: used,
217
+ freeBytes: free
218
+ }
219
+ })
220
+ }
221
+ }
222
+ } else if (currentPlatform === 'darwin') {
223
+ // macOS 系统
224
+ const output = execSync('df -B1', { encoding: 'utf8', timeout: 5000 })
225
+ const lines = output.trim().split('\n').slice(1)
226
+
227
+ for (const line of lines) {
228
+ const parts = line.trim().split(/\s+/)
229
+ if (parts.length >= 6) {
230
+ const filesystem = parts[0]
231
+ const size = parseInt(parts[1]) || 0
232
+ const used = parseInt(parts[2]) || 0
233
+ const free = parseInt(parts[3]) || 0
234
+ const usagePercent = size > 0 ? ((used / size) * 100).toFixed(2) : 0
235
+
236
+ diskInfo.push({
237
+ filesystem,
238
+ total: this.formatBytes(size),
239
+ used: this.formatBytes(used),
240
+ free: this.formatBytes(free),
241
+ usagePercent: `${usagePercent}%`,
242
+ details: {
243
+ totalBytes: size,
244
+ usedBytes: used,
245
+ freeBytes: free
246
+ }
247
+ })
248
+ }
249
+ }
250
+ }
251
+ } catch (error) {
252
+ return {
253
+ success: false,
254
+ error: `获取磁盘信息失败: ${error.message}`,
255
+ data: []
256
+ }
257
+ }
258
+
259
+ return {
260
+ success: true,
261
+ platform: currentPlatform,
262
+ data: diskInfo
263
+ }
264
+ }
265
+ })
266
+
267
+ // 获取完整系统信息(综合)
268
+ framework.registerTool({
269
+ name: 'get_full_system_info',
270
+ description: '获取完整的系统信息,包括 CPU、内存、磁盘、网络等所有信息',
271
+ inputSchema: z.object({}),
272
+ execute: async (args, framework) => {
273
+ const uptime = os.uptime()
274
+
275
+ // CPU 信息
276
+ const cpus = os.cpus()
277
+ const avgUsage = this.calculateCpuUsage(cpus)
278
+
279
+ // 内存信息
280
+ const totalMem = os.totalmem()
281
+ const freeMem = os.freemem()
282
+ const usedMem = totalMem - freeMem
283
+ const memUsagePercent = ((usedMem / totalMem) * 100).toFixed(2)
284
+
285
+ // 网络信息
286
+ const networkInterfaces = os.networkInterfaces()
287
+
288
+ // 磁盘信息
289
+ let diskInfo = []
290
+ try {
291
+ const diskResult = await framework.callTool('get_disk_info', {})
292
+ diskInfo = diskResult.data || []
293
+ } catch (e) {
294
+ diskInfo = []
295
+ }
296
+
297
+ return {
298
+ success: true,
299
+ data: {
300
+ system: {
301
+ hostname: os.hostname(),
302
+ platform: os.platform(),
303
+ osType: os.type(),
304
+ osRelease: os.release(),
305
+ arch: os.arch(),
306
+ nodeVersion: process.version,
307
+ uptime: this.formatUptime(uptime)
308
+ },
309
+ cpu: {
310
+ count: cpus.length,
311
+ model: cpus[0]?.model || 'Unknown',
312
+ averageUsage: avgUsage,
313
+ speed: `${cpus[0]?.speed || 'N/A'} MHz`
314
+ },
315
+ memory: {
316
+ total: this.formatBytes(totalMem),
317
+ free: this.formatBytes(freeMem),
318
+ used: this.formatBytes(usedMem),
319
+ usagePercent: `${memUsagePercent}%`
320
+ },
321
+ disk: diskInfo,
322
+ network: {
323
+ interfacesCount: Object.keys(networkInterfaces).length,
324
+ interfaces: Object.keys(networkInterfaces)
325
+ }
326
+ }
327
+ }
328
+ }
329
+ })
330
+ }
331
+
332
+ // 格式化字节数
333
+ formatBytes(bytes) {
334
+ if (bytes === 0) return '0 Bytes'
335
+ const k = 1024
336
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']
337
+ const i = Math.floor(Math.log(bytes) / Math.log(k))
338
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
339
+ }
340
+
341
+ // 格式化毫秒
342
+ formatMs(ms) {
343
+ return `${(ms / 1000).toFixed(2)}s`
344
+ }
345
+
346
+ // 格式化运行时间
347
+ formatUptime(seconds) {
348
+ const days = Math.floor(seconds / 86400)
349
+ const hours = Math.floor((seconds % 86400) / 3600)
350
+ const minutes = Math.floor((seconds % 3600) / 60)
351
+ const secs = Math.floor(seconds % 60)
352
+
353
+ const parts = []
354
+ if (days > 0) parts.push(`${days} 天`)
355
+ if (hours > 0) parts.push(`${hours} 小时`)
356
+ if (minutes > 0) parts.push(`${minutes} 分钟`)
357
+ if (secs > 0 || parts.length === 0) parts.push(`${secs} 秒`)
358
+
359
+ return parts.join(' ')
360
+ }
361
+
362
+ // 计算 CPU 使用率
363
+ calculateCpuUsage(cpus) {
364
+ let totalIdle = 0
365
+ let totalTick = 0
366
+
367
+ cpus.forEach(cpu => {
368
+ for (const type in cpu.times) {
369
+ totalTick += cpu.times[type]
370
+ }
371
+ totalIdle += cpu.times.idle
372
+ })
373
+
374
+ const idle = totalIdle / cpus.length
375
+ const total = totalTick / cpus.length
376
+ const usage = ((total - idle) / total * 100).toFixed(2)
377
+
378
+ return `${usage}%`
379
+ }
380
+
381
+ uninstall(framework) {
382
+ // 清理资源
383
+ this._framework = null
384
+ }
385
+ }
386
+
387
+ module.exports =SystemInfoPlugin
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "system-info",
3
+ "main": "index.js"
4
+ }
@@ -0,0 +1,40 @@
1
+ // 测试系统信息插件
2
+ const os = require('os');
3
+
4
+ // 模拟插件安装
5
+ const plugin = require('./index.js');
6
+ const mockPlugin = plugin({});
7
+ const registeredTools = [];
8
+
9
+ const mockFramework = {
10
+ registerTool: (tool) => {
11
+ registeredTools.push(tool.name);
12
+ console.log('✓ Registered tool:', tool.name);
13
+ },
14
+ callTool: async (name, args) => {
15
+ if (name === 'get_disk_info') {
16
+ // 模拟磁盘信息获取
17
+ return { success: true, data: [] };
18
+ }
19
+ }
20
+ };
21
+
22
+ console.log('\n=== Testing System Info Plugin ===\n');
23
+ mockPlugin.install(mockFramework);
24
+
25
+ console.log('\n✓ Plugin name:', mockPlugin.name);
26
+ console.log('✓ Plugin version:', mockPlugin.version);
27
+ console.log('✓ Plugin description:', mockPlugin.description);
28
+
29
+ console.log('\n✓ Total tools registered:', registeredTools.length);
30
+ console.log('✓ Tools:', registeredTools.join(', '));
31
+
32
+ console.log('\n=== System Information Preview ===\n');
33
+ console.log('Hostname:', os.hostname());
34
+ console.log('Platform:', os.platform());
35
+ console.log('OS Type:', os.type());
36
+ console.log('CPU Count:', os.cpus().length);
37
+ console.log('Total Memory:', (os.totalmem() / 1024 / 1024 / 1024).toFixed(2), 'GB');
38
+ console.log('Node Version:', process.version);
39
+
40
+ console.log('\n✓ All tests passed!');
@@ -1,8 +1,14 @@
1
1
  {
2
- "weixin": {
3
- "enabled": true
4
- },
5
- "poster-plugin": {
6
- "enabled": true
2
+ "email": {
3
+ "enabled": true,
4
+ "smtp": {
5
+ "host": "smtp.gmail.com",
6
+ "port": 587,
7
+ "secure": false
8
+ },
9
+ "imap": {
10
+ "host": "imap.gmail.com",
11
+ "port": 993
12
+ }
7
13
  }
8
14
  }
@@ -0,0 +1,24 @@
1
+ """
2
+ 测试模块 - 2026-04-02 02:52:12
3
+ """
4
+
5
+ import unittest
6
+
7
+
8
+
9
+ class TestMath(unittest.TestCase):
10
+ """TestMath 测试类"""
11
+
12
+ def test_add(self):
13
+ """测试用例: test_add"""
14
+ # TODO: 实现测试逻辑
15
+ self.assertTrue(True)
16
+
17
+ def test_subtract(self):
18
+ """测试用例: test_subtract"""
19
+ # TODO: 实现测试逻辑
20
+ self.assertTrue(True)
21
+
22
+
23
+ if __name__ == "__main__":
24
+ unittest.main()