foliko 1.1.67 → 1.1.69

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 (157) hide show
  1. package/.claude/settings.local.json +19 -10
  2. package/.dockerignore +45 -45
  3. package/.env.example +56 -56
  4. package/CLAUDE.md +2 -2
  5. package/README.md +13 -13
  6. package/SPEC.md +3 -3
  7. package/cli/src/commands/chat.js +2 -20
  8. package/cli/src/commands/list.js +7 -6
  9. package/cli/src/commands/plugin.js +3 -2
  10. package/cli/src/daemon.js +2 -2
  11. package/cli/src/ui/chat-ui-old.js +15 -4
  12. package/cli/src/ui/chat-ui.js +236 -203
  13. package/cli/src/ui/footer-bar.js +20 -46
  14. package/cli/src/ui/message-bubble.js +24 -2
  15. package/cli/src/ui/status-bar.js +177 -0
  16. package/cli/src/utils/config.js +29 -0
  17. package/cli/src/utils/plugin-config.js +1 -1
  18. package/docker-compose.yml +33 -33
  19. package/docs/features.md +120 -120
  20. package/docs/quick-reference.md +160 -160
  21. package/docs/user-manual.md +1391 -1391
  22. package/examples/ambient-example.js +2 -2
  23. package/examples/bootstrap.js +3 -3
  24. package/examples/test-chat.js +1 -1
  25. package/examples/test-reload.js +1 -1
  26. package/examples/test-telegram.js +1 -1
  27. package/examples/test-tg-bot.js +1 -1
  28. package/examples/test-tg-simple.js +2 -2
  29. package/examples/test-tg.js +1 -1
  30. package/examples/test-think.js +1 -1
  31. package/examples/test-weixin-feishu.js +3 -3
  32. package/package.json +3 -1
  33. package/plugins/ambient-agent/index.js +1 -1
  34. package/plugins/audit-plugin.js +84 -29
  35. package/plugins/coordinator-plugin.js +14 -12
  36. package/plugins/data-splitter-plugin.js +323 -0
  37. package/plugins/default-plugins.js +23 -12
  38. package/plugins/email/index.js +1 -1
  39. package/plugins/extension-executor-plugin.js +87 -9
  40. package/plugins/feishu-plugin.js +118 -16
  41. package/plugins/file-system-plugin.js +68 -50
  42. package/plugins/gate-trading.js +10 -10
  43. package/plugins/install-plugin.js +7 -7
  44. package/plugins/memory-plugin.js +9 -12
  45. package/plugins/plugin-manager-plugin.js +12 -14
  46. package/plugins/python-executor-plugin.js +1 -1
  47. package/plugins/python-plugin-loader.js +1 -1
  48. package/plugins/qq-plugin.js +151 -24
  49. package/plugins/rules-plugin.js +8 -8
  50. package/plugins/scheduler-plugin.js +24 -20
  51. package/plugins/session-plugin.js +313 -397
  52. package/plugins/storage-plugin.js +235 -175
  53. package/plugins/subagent-plugin.js +17 -13
  54. package/plugins/telegram-plugin.js +116 -17
  55. package/plugins/think-plugin.js +64 -60
  56. package/plugins/tools-plugin.js +8 -8
  57. package/plugins/web-plugin.js +2 -2
  58. package/plugins/weixin-plugin.js +107 -24
  59. package/skills/find-skills/AGENTS.md +2 -2
  60. package/skills/find-skills/SKILL.md +133 -133
  61. package/skills/foliko-dev/AGENTS.md +236 -236
  62. package/skills/foliko-dev/SKILL.md +19 -19
  63. package/skills/mcp-usage/SKILL.md +200 -200
  64. package/skills/plugin-guide/SKILL.md +4 -4
  65. package/skills/python-plugin-dev/SKILL.md +5 -5
  66. package/skills/skill-guide/SKILL.md +104 -6
  67. package/skills/subagent-guide/SKILL.md +237 -237
  68. package/skills/workflow-guide/SKILL.md +646 -646
  69. package/src/capabilities/skill-manager.js +124 -17
  70. package/src/capabilities/workflow-engine.js +3 -3
  71. package/src/core/agent-chat.js +72 -26
  72. package/src/core/agent.js +17 -27
  73. package/src/core/branch-summary-auto.js +206 -0
  74. package/src/core/chat-session.js +45 -169
  75. package/src/core/command-registry.js +200 -0
  76. package/src/core/constants.js +198 -0
  77. package/src/core/context-compressor.js +702 -326
  78. package/src/core/context-manager.js +0 -1
  79. package/src/core/enhanced-context-compressor.js +210 -0
  80. package/src/core/framework.js +260 -84
  81. package/src/core/jsonl-storage.js +253 -0
  82. package/src/core/plugin-base.js +7 -5
  83. package/src/core/plugin-manager.js +15 -10
  84. package/src/core/provider-registry.js +159 -0
  85. package/src/core/provider.js +2 -0
  86. package/src/core/session-entry.js +225 -0
  87. package/src/core/session-manager.js +701 -0
  88. package/src/core/storage-manager.js +494 -0
  89. package/src/core/sub-agent-config.js +1 -1
  90. package/src/core/subagent.js +16 -135
  91. package/src/core/token-counter.js +177 -58
  92. package/src/core/tool-executor.js +2 -70
  93. package/src/core/ui-extension-context.js +174 -0
  94. package/src/executors/mcp-executor.js +27 -16
  95. package/src/utils/chat-queue.js +11 -22
  96. package/src/utils/data-splitter.js +345 -0
  97. package/src/utils/logger.js +152 -180
  98. package/src/utils/message-validator.js +283 -0
  99. package/src/utils/plugin-helpers.js +2 -2
  100. package/src/utils/retry.js +168 -22
  101. package/website_v2/docs/api.html +1 -1
  102. package/website_v2/docs/configuration.html +2 -2
  103. package/website_v2/docs/plugin-development.html +4 -4
  104. package/website_v2/docs/project-structure.html +2 -2
  105. package/website_v2/docs/skill-development.html +2 -2
  106. package/website_v2/index.html +1 -1
  107. package/website_v2/styles/animations.css +7 -7
  108. package/.agent/agents/backend-dev.md +0 -102
  109. package/.agent/agents/data-analyst.md +0 -117
  110. package/.agent/agents/devops.md +0 -115
  111. package/.agent/agents/frontend-dev.md +0 -94
  112. package/.agent/agents/network-requester.md +0 -44
  113. package/.agent/agents/poster-designer.md +0 -52
  114. package/.agent/agents/product-manager.md +0 -85
  115. package/.agent/agents/qa-engineer.md +0 -100
  116. package/.agent/agents/security-engineer.md +0 -99
  117. package/.agent/agents/team-lead.md +0 -137
  118. package/.agent/agents/ui-designer.md +0 -116
  119. package/.agent/data/default.json +0 -58
  120. package/.agent/data/email/processed-emails.json +0 -1
  121. package/.agent/data/plugins-state.json +0 -199
  122. package/.agent/data/scheduler/tasks.json +0 -1
  123. package/.agent/data/web/web-config.json +0 -5
  124. package/.agent/data/weixin/images/file_1776188148383jpg +0 -0
  125. package/.agent/data/weixin/images/file_1776188458326.jpg +0 -0
  126. package/.agent/data/weixin/images/file_1776188689423.jpg +0 -0
  127. package/.agent/data/weixin/images/file_1776188813604.jpg +0 -0
  128. package/.agent/data/weixin/images/file_1776189097450.jpg +0 -0
  129. package/.agent/data/weixin/videos/file_1776188318431.mp4 +0 -0
  130. package/.agent/data/weixin.json +0 -6
  131. package/.agent/mcp_config.json +0 -14
  132. package/.agent/memory/user/mof6gk94-kneeuh.md +0 -9
  133. package/.agent/package.json +0 -8
  134. package/.agent/plugins/marknative/README.md +0 -134
  135. package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
  136. package/.agent/plugins/marknative/fonts.zip +0 -0
  137. package/.agent/plugins/marknative/index.js +0 -256
  138. package/.agent/plugins/marknative/package.json +0 -12
  139. package/.agent/plugins/test-plugin.py +0 -99
  140. package/.agent/plugins.json +0 -14
  141. package/.agent/python-scripts/test_sample.py +0 -24
  142. package/.agent/sessions/cli_default.json +0 -247
  143. package/.agent/skills/agent-browser/SKILL.md +0 -311
  144. package/.agent/skills/agent-browser/TEST_PLAN.md +0 -200
  145. package/.agent/skills/sysinfo/SKILL.md +0 -38
  146. package/.agent/skills/sysinfo/system-info.sh +0 -130
  147. package/.agent/skills/workflow/SKILL.md +0 -324
  148. package/.agent/test-agent.js +0 -35
  149. package/.agent/weixin.json +0 -6
  150. package/.agent/workflows/email-digest.json +0 -50
  151. package/.agent/workflows/file-backup.json +0 -21
  152. package/.agent/workflows/get-ip-notify.json +0 -32
  153. package/.agent/workflows/news-aggregator.json +0 -93
  154. package/.agent/workflows/news-dashboard-v2.json +0 -94
  155. package/.agent/workflows/notification-batch.json +0 -32
  156. package/src/core/session-context.js +0 -346
  157. package/src/core/session-storage.js +0 -295
@@ -15,7 +15,7 @@ async function main() {
15
15
 
16
16
  // Bootstrap with default plugins (including ambient)
17
17
  await framework.bootstrap({
18
- agentDir: './.agent',
18
+ agentDir: './.foliko',
19
19
  aiConfig: {
20
20
  provider: 'deepseek',
21
21
  model: 'deepseek-chat',
@@ -181,7 +181,7 @@ async function main() {
181
181
  }
182
182
 
183
183
  console.log('\n=== All Examples Completed ===');
184
- console.log('Check .agent/data/ambient/ for persisted data');
184
+ console.log('Check .foliko/data/ambient/ for persisted data');
185
185
 
186
186
  // Cleanup
187
187
  console.log('\nShutting down...');
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Bootstrap 示例
3
- * 使用 framework.bootstrap() 自动加载 .agent/ 目录配置
3
+ * 使用 framework.bootstrap() 自动加载 .foliko/ 目录配置
4
4
  */
5
5
 
6
6
  const { Framework } = require('../src');
@@ -13,9 +13,9 @@ async function main() {
13
13
  const framework = new Framework({ debug: true });
14
14
 
15
15
  // 使用 bootstrap 自动加载所有默认插件
16
- // 会自动检测 .agent/ 目录下的配置
16
+ // 会自动检测 .foliko/ 目录下的配置
17
17
  await framework.bootstrap({
18
- agentDir: './.agent', // 配置目录
18
+ agentDir: './.foliko', // 配置目录
19
19
  aiConfig: {
20
20
  // 可选:覆盖 AI 配置
21
21
  provider: 'deepseek',
@@ -18,7 +18,7 @@ async function main() {
18
18
 
19
19
  // Bootstrap
20
20
  await framework.bootstrap({
21
- agentDir: './.agent',
21
+ agentDir: './.foliko',
22
22
  aiConfig: {
23
23
  provider: 'minimax',
24
24
  model: 'MiniMax-M2.7',
@@ -37,7 +37,7 @@ async function test() {
37
37
 
38
38
  // 检查配置
39
39
  console.log('\n3. 当前配置文件:');
40
- const configPath = path.resolve('.agent/mcp_config.json');
40
+ const configPath = path.resolve('.foliko/mcp_config.json');
41
41
  if (fs.existsSync(configPath)) {
42
42
  const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
43
43
  console.log(JSON.stringify(config, null, 2));
@@ -5,7 +5,7 @@ async function main() {
5
5
  const framework = new Framework({ debug: false });
6
6
 
7
7
  await framework.bootstrap({
8
- agentDir: process.cwd() + '/.agent',
8
+ agentDir: process.cwd() + '/.foliko',
9
9
  aiConfig: {
10
10
  provider: process.env.FOLIKO_PROVIDER || 'minimax',
11
11
  model: process.env.FOLIKO_MODEL || 'MiniMax-M2.7',
@@ -7,7 +7,7 @@ async function main() {
7
7
  const framework = new Framework({ debug: false });
8
8
 
9
9
  await framework.bootstrap({
10
- agentDir: process.cwd() + '/.agent',
10
+ agentDir: process.cwd() + '/.foliko',
11
11
  aiConfig: {
12
12
  provider: process.env.FOLIKO_PROVIDER || 'minimax',
13
13
  model: process.env.FOLIKO_MODEL || 'MiniMax-M2.7',
@@ -1,8 +1,8 @@
1
1
  require('dotenv').config();
2
2
 
3
- // 添加 .agent/node_modules 到搜索路径
3
+ // 添加 .foliko/node_modules 到搜索路径
4
4
  const path = require('path');
5
- const agentNodeModules = path.join(process.cwd(), '.agent', 'node_modules');
5
+ const agentNodeModules = path.join(process.cwd(), '.foliko', 'node_modules');
6
6
  if (!module.paths.includes(agentNodeModules)) {
7
7
  module.paths.unshift(agentNodeModules);
8
8
  }
@@ -5,7 +5,7 @@ async function main() {
5
5
  const framework = new Framework({ debug: true });
6
6
 
7
7
  await framework.bootstrap({
8
- agentDir: process.cwd() + '/.agent',
8
+ agentDir: process.cwd() + '/.foliko',
9
9
  aiConfig: {
10
10
  provider: process.env.FOLIKO_PROVIDER || 'minimax',
11
11
  model: process.env.FOLIKO_MODEL || 'MiniMax-M2.7',
@@ -5,7 +5,7 @@ async function main() {
5
5
  const framework = new Framework({ debug: false });
6
6
 
7
7
  await framework.bootstrap({
8
- agentDir: process.cwd() + '/.agent',
8
+ agentDir: process.cwd() + '/.foliko',
9
9
  aiConfig: {
10
10
  provider: process.env.FOLIKO_PROVIDER || 'minimax',
11
11
  model: process.env.FOLIKO_MODEL || 'MiniMax-M2.7',
@@ -12,7 +12,7 @@ async function main() {
12
12
 
13
13
  // Bootstrap 加载默认插件
14
14
  await framework.bootstrap({
15
- agentDir: './.agent',
15
+ agentDir: './.foliko',
16
16
  aiConfig: {
17
17
  provider: 'deepseek',
18
18
  model: 'deepseek-chat',
@@ -68,7 +68,7 @@ async function main() {
68
68
 
69
69
  try {
70
70
  // 使用 chat() 而非 chatStream()
71
- const result = await sessionInfo.agent.chat(mockText, {
71
+ const result = await sessionInfo.foliko.chat(mockText, {
72
72
  sessionId: sessionInfo.sessionId,
73
73
  });
74
74
 
@@ -83,7 +83,7 @@ async function main() {
83
83
  console.log('\n--- Test chatStream() for comparison ---');
84
84
  try {
85
85
  let fullResponse = '';
86
- for await (const chunk of sessionInfo.agent.chatStream('今天天气怎么样?', {
86
+ for await (const chunk of sessionInfo.foliko.chatStream('今天天气怎么样?', {
87
87
  sessionId: sessionInfo.sessionId,
88
88
  })) {
89
89
  if (chunk.type === 'text' && chunk.text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foliko",
3
- "version": "1.1.67",
3
+ "version": "1.1.69",
4
4
  "description": "简约的插件化 Agent 框架",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
@@ -81,6 +81,8 @@
81
81
  "node-schedule": "^2.1.1",
82
82
  "node-telegram-bot-api": "^0.67.0",
83
83
  "nodemailer": "^6.10.0",
84
+ "pino": "^10.3.1",
85
+ "pino-pretty": "^13.1.3",
84
86
  "qrcode-terminal": "^0.12.0",
85
87
  "remove-markdown": "^0.6.3",
86
88
  "zod": "^3.25.76"
@@ -32,7 +32,7 @@ class AmbientAgentPlugin extends Plugin {
32
32
  enabled: config.enabled !== false,
33
33
  tickInterval: config.tickInterval || 5000, // tick间隔(毫秒)
34
34
  cooldownPeriod: config.cooldownPeriod || 3000, // 冷却时间(毫秒)
35
- persistencePath: config.persistencePath || '.agent/data/ambient',
35
+ persistencePath: config.persistencePath || '.foliko/data/ambient',
36
36
  defaultGoals: config.defaultGoals || []
37
37
  }
38
38
 
@@ -1,36 +1,72 @@
1
1
  /**
2
2
  * Audit 审计日志插件
3
3
  * 记录所有操作日志,支持日志查询和统计
4
+ * 基于 Pino 日志系统
4
5
  */
5
6
 
6
7
  const { Plugin } = require('../src/core/plugin-base')
8
+ const { logger } = require('../src/utils/logger')
7
9
  const { z } = require('zod')
10
+ const path = require('path')
11
+ const fs = require('fs')
12
+ const os = require('os')
8
13
 
9
14
  class AuditPlugin extends Plugin {
10
15
  constructor(config = {}) {
11
16
  super()
12
17
  this.name = 'audit'
13
- this.version = '1.0.0'
18
+ this.version = '2.0.0'
14
19
  this.description = '审计日志插件,记录工具调用、技能执行、错误信息等操作历史'
15
20
  this.priority = 20
16
- this.system = true
21
+ this.system = true
17
22
 
18
23
  this.config = {
19
24
  maxLogs: config.maxLogs || 1000,
20
25
  retentionDays: config.retentionDays || 30,
21
- logDir: config.logDir || '.agent/logs'
26
+ logDir: config.logDir || path.join(os.homedir(), '.vb-agent', 'logs', 'audit')
22
27
  }
23
28
 
24
29
  this._framework = null
25
- this._logs = []
26
30
  this._logIdCounter = 0
31
+ this._auditLogger = null
32
+ this._auditLogFile = null
33
+ this._queryLogs = [] // 内存缓存用于查询
34
+ this._initAuditLogger()
35
+ }
36
+
37
+ /**
38
+ * 初始化审计日志器
39
+ */
40
+ _initAuditLogger() {
41
+ const pino = require('pino')
42
+
43
+ // 确保目录存在
44
+ if (!fs.existsSync(this.config.logDir)) {
45
+ fs.mkdirSync(this.config.logDir, { recursive: true })
46
+ }
47
+
48
+ // 审计日志文件名
49
+ const date = new Date().toISOString().split('T')[0]
50
+ this._auditLogFile = path.join(this.config.logDir, `audit-${date}.jsonl`)
51
+
52
+ // 创建文件写入流
53
+ const fileStream = fs.createWriteStream(this._auditLogFile, { flags: 'a' })
54
+
55
+ // 创建专门的审计 logger
56
+ this._auditLogger = pino({
57
+ name: 'audit',
58
+ level: 'info',
59
+ timestamp: pino.stdTimeFunctions.isoTime,
60
+ formatters: {
61
+ level: (label) => label.toUpperCase(),
62
+ },
63
+ }, fileStream)
27
64
  }
28
65
 
29
66
  install(framework) {
30
67
  this._framework = framework
31
68
 
32
69
  // 监听框架事件
33
- // tool:call 和 tool-call 两种格式都监听(兼容不同来源)
34
70
  framework.on('tool:call', (data) => this._log('tool_call', data))
35
71
  framework.on('tool-call', (data) => this._log('tool_call', data))
36
72
  framework.on('tool:result', (data) => this._log('tool_result', data))
@@ -51,10 +87,11 @@ class AuditPlugin extends Plugin {
51
87
  offset: z.number().optional().describe('偏移量,默认 0')
52
88
  }),
53
89
  execute: async (args) => {
54
- let logs = this._logs
90
+ const logs = this._queryLogs
55
91
 
92
+ let filtered = logs
56
93
  if (args.type) {
57
- logs = logs.filter(log => log.type === args.type)
94
+ filtered = filtered.filter(log => log.type === args.type)
58
95
  }
59
96
 
60
97
  const offset = args.offset || 0
@@ -62,10 +99,12 @@ class AuditPlugin extends Plugin {
62
99
 
63
100
  return {
64
101
  success: true,
65
- logs: logs.slice(-limit - offset, logs.length - offset),
66
- total: logs.length,
67
- offset,
68
- limit
102
+ data: filtered.slice(-limit - offset, filtered.length - offset),
103
+ metadata: {
104
+ total: filtered.length,
105
+ offset,
106
+ limit
107
+ }
69
108
  }
70
109
  }
71
110
  })
@@ -78,7 +117,7 @@ class AuditPlugin extends Plugin {
78
117
  const stats = this.getStats()
79
118
  return {
80
119
  success: true,
81
- stats
120
+ data: stats
82
121
  }
83
122
  }
84
123
  })
@@ -96,8 +135,10 @@ class AuditPlugin extends Plugin {
96
135
  const result = this.exportLogs(args)
97
136
  return {
98
137
  success: true,
99
- count: result.logs.length,
100
- data: result.logs
138
+ data: result.logs,
139
+ metadata: {
140
+ count: result.logs.length
141
+ }
101
142
  }
102
143
  }
103
144
  })
@@ -107,21 +148,30 @@ class AuditPlugin extends Plugin {
107
148
 
108
149
  /**
109
150
  * 记录日志
110
- * @private
111
151
  */
112
152
  _log(type, data) {
113
153
  const log = {
114
154
  id: ++this._logIdCounter,
115
155
  type,
116
156
  data,
117
- timestamp: new Date()
157
+ timestamp: new Date().toISOString()
118
158
  }
119
159
 
120
- this._logs.push(log)
160
+ // 写入审计日志文件
161
+ if (this._auditLogger) {
162
+ this._auditLogger.info({
163
+ auditId: log.id,
164
+ auditType: log.type,
165
+ auditData: log.data
166
+ }, 'audit event')
167
+ }
121
168
 
122
- // 限制日志数量
123
- if (this._logs.length > this.config.maxLogs) {
124
- this._logs = this._logs.slice(-this.config.maxLogs)
169
+ // 缓存到内存用于查询
170
+ this._queryLogs.push(log)
171
+
172
+ // 限制缓存数量
173
+ if (this._queryLogs.length > this.config.maxLogs) {
174
+ this._queryLogs = this._queryLogs.slice(-this.config.maxLogs)
125
175
  }
126
176
 
127
177
  return log
@@ -132,16 +182,17 @@ class AuditPlugin extends Plugin {
132
182
  */
133
183
  getStats() {
134
184
  const counts = {}
135
- for (const log of this._logs) {
185
+ for (const log of this._queryLogs) {
136
186
  counts[log.type] = (counts[log.type] || 0) + 1
137
187
  }
138
188
 
139
189
  return {
140
- total: this._logs.length,
190
+ total: this._queryLogs.length,
141
191
  maxLogs: this.config.maxLogs,
142
192
  counts,
143
- oldest: this._logs.length > 0 ? this._logs[0].timestamp : null,
144
- newest: this._logs.length > 0 ? this._logs[this._logs.length - 1].timestamp : null
193
+ oldest: this._queryLogs.length > 0 ? this._queryLogs[0].timestamp : null,
194
+ newest: this._queryLogs.length > 0 ? this._queryLogs[this._queryLogs.length - 1].timestamp : null,
195
+ logFile: this._auditLogFile
145
196
  }
146
197
  }
147
198
 
@@ -149,7 +200,7 @@ class AuditPlugin extends Plugin {
149
200
  * 导出日志
150
201
  */
151
202
  exportLogs(options = {}) {
152
- let logs = [...this._logs]
203
+ let logs = [...this._queryLogs]
153
204
 
154
205
  // 按类型过滤
155
206
  if (options.type) {
@@ -159,12 +210,12 @@ class AuditPlugin extends Plugin {
159
210
  // 按日期过滤
160
211
  if (options.startDate) {
161
212
  const start = new Date(options.startDate)
162
- logs = logs.filter(log => log.timestamp >= start)
213
+ logs = logs.filter(log => new Date(log.timestamp) >= start)
163
214
  }
164
215
 
165
216
  if (options.endDate) {
166
217
  const end = new Date(options.endDate)
167
- logs = logs.filter(log => log.timestamp <= end)
218
+ logs = logs.filter(log => new Date(log.timestamp) <= end)
168
219
  }
169
220
 
170
221
  return { logs }
@@ -182,9 +233,13 @@ class AuditPlugin extends Plugin {
182
233
  }
183
234
 
184
235
  uninstall(framework) {
185
- this._logs = []
236
+ this._queryLogs = []
237
+ if (this._auditLogger) {
238
+ // 关闭文件流
239
+ }
240
+ this._auditLogger = null
186
241
  this._framework = null
187
242
  }
188
243
  }
189
244
 
190
- module.exports = AuditPlugin
245
+ module.exports = AuditPlugin
@@ -156,12 +156,14 @@ class CoordinatorPlugin extends Plugin {
156
156
 
157
157
  return {
158
158
  success: true,
159
- workerId: result.workerId,
160
- status: result.status,
161
- result: result.result,
162
- message: result.status === 'completed'
163
- ? `Worker '${args.worker_name}' completed with result`
164
- : `Worker '${args.worker_name}' ${result.status}`,
159
+ data: result.result,
160
+ metadata: {
161
+ workerId: result.workerId,
162
+ status: result.status,
163
+ message: result.status === 'completed'
164
+ ? `Worker '${args.worker_name}' completed with result`
165
+ : `Worker '${args.worker_name}' ${result.status}`,
166
+ },
165
167
  };
166
168
  } catch (err) {
167
169
  return { success: false, error: err.message };
@@ -187,8 +189,8 @@ class CoordinatorPlugin extends Plugin {
187
189
  const result = await coordinatorManager.sendToWorker(args.worker_name, args.message);
188
190
  return {
189
191
  success: true,
190
- workerName: args.worker_name,
191
- result: result.message || result,
192
+ data: result.message || result,
193
+ metadata: { workerName: args.worker_name },
192
194
  };
193
195
  } catch (err) {
194
196
  return { success: false, error: err.message };
@@ -214,7 +216,7 @@ class CoordinatorPlugin extends Plugin {
214
216
  const result = coordinatorManager.stopWorker(args.worker_name, args.reason);
215
217
  return {
216
218
  success: true,
217
- ...result,
219
+ data: result,
218
220
  };
219
221
  } catch (err) {
220
222
  return { success: false, error: err.message };
@@ -236,8 +238,8 @@ class CoordinatorPlugin extends Plugin {
236
238
  const workers = coordinatorManager.listWorkers();
237
239
  return {
238
240
  success: true,
239
- count: workers.length,
240
- workers,
241
+ data: workers,
242
+ metadata: { count: workers.length },
241
243
  };
242
244
  },
243
245
  });
@@ -262,7 +264,7 @@ class CoordinatorPlugin extends Plugin {
262
264
 
263
265
  return {
264
266
  success: true,
265
- worker,
267
+ data: worker,
266
268
  };
267
269
  },
268
270
  });