foliko 1.0.86 → 1.0.87

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.
@@ -7,7 +7,7 @@ module.exports = function (Plugin) {
7
7
  constructor(config = {}) {
8
8
  super();
9
9
  this.name = 'marknative';
10
- this.version = '1.0.0';
10
+ this.version = '1.0.1';
11
11
  this.description = 'Markdown 转图片插件 - 将 Markdown 转换为 PNG/SVG';
12
12
  this.priority = 10;
13
13
  this.marknative = null;
@@ -18,12 +18,7 @@ module.exports = function (Plugin) {
18
18
  if (this.checked) return;
19
19
  this.checked = true;
20
20
 
21
- try {
22
- this.marknative = require('marknative');
23
- } catch (error) {
24
- this.marknative = null;
25
- console.error('MarkNative 加载失败:', error.message);
26
- }
21
+ this.marknative = await import('marknative');
27
22
  }
28
23
 
29
24
  tools = {
@@ -1,171 +1,179 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(grep -r \"dotenv\" \"D:/Code/vb-agent/\" --include=\"*.json\" 2>/dev/null | head -20)",
5
- "Bash(cd \"D:/Code/vb-agent\" && pnpm add dotenv)",
6
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('reason'\\) || k.toLowerCase\\(\\).includes\\('split'\\) || k.toLowerCase\\(\\).includes\\('think'\\)\\)\\)\")",
7
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(typeof ai.extractReasoningMiddleware, ai.extractReasoningMiddleware.toString\\(\\).substring\\(0, 500\\)\\)\")",
8
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"\nconst ai = require\\('ai'\\);\nconsole.log\\('=== extractReasoningMiddleware ==='\\);\nconsole.log\\(ai.extractReasoningMiddleware.toString\\(\\)\\);\nconsole.log\\('\\\\n=== isReasoningUIPart ==='\\);\nconsole.log\\(typeof ai.isReasoningUIPart\\);\n\")",
9
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('split'\\)\\)\\)\")",
10
- "Bash(cd \"D:/Code/vb-agent\" && pnpm add ink react)",
11
- "Bash(cd \"D:/Code/vb-agent\" && node cli/bin/foliko.js --help)",
12
- "Bash(cd \"D:/Code/vb-agent\" && timeout 2 node cli/bin/foliko.js chat 2>&1 || true)",
13
- "Bash(cd \"D:/Code/vb-agent\" && node -e \"const mt = require\\('marked-terminal'\\); console.log\\(typeof mt, Object.keys\\(mt\\)\\)\")",
14
- "Bash(cd \"D:/Code/vb-agent\" && timeout 3 node cli/bin/foliko.js chat 2>&1 || true)",
15
- "Bash(echo \"你好\" | node cli/bin/foliko.js chat 2>&1 | head -50)",
16
- "Bash(printf '思考一下1+1等于几\\\\n' | node cli/bin/foliko.js chat 2>&1 | head -100)",
17
- "Bash(printf '1+1等于几\\\\n' | node cli/bin/foliko.js chat 2>&1)",
18
- "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\nconsole.log\\(renderLine\\('🎉 这是一个 emoji'\\)\\)\nconsole.log\\(renderLine\\('**粗体** 和 🎉'\\)\\)\n\")",
19
- "Bash(node -e \"\nconst { render } = require\\('./cli/src/utils/markdown'\\)\nconst text = '🎉 今天是个好日子\\\\n## 标题\\\\n- 列表项1\\\\n- 列表项2'\nconsole.log\\(render\\(text\\)\\)\n\")",
20
- "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\n\n// 模拟emoji被截断的情况\nconst emoji = '🎉'\nconsole.log\\('完整的 emoji:', renderLine\\(emoji\\)\\)\n\n// 模拟截断 - emoji的UTF-8字节是 \\\\xF0\\\\x9F\\\\x8E\\\\x89\nconst partial = '\\\\xF0\\\\x9F' // 不完整的emoji\nconsole.log\\('截断的 emoji:', renderLine\\(partial\\)\\)\n\")",
21
- "Bash(node -e \"\nconst isIncompleteUTF8 = \\(str\\) => {\n if \\(!str || str.length === 0\\) return false\n const lastChar = str.charCodeAt\\(str.length - 1\\)\n if \\(lastChar >= 0x80 && lastChar < 0xC0\\) return true\n return false\n}\n\n// 测试各种emoji\nconst tests = ['🎉', '📁', '⚡', '🛠️', '🔑', '💾', '📝', '⏰', '🔌', '📋']\ntests.forEach\\(e => {\n console.log\\(e, '完整:', !isIncompleteUTF8\\(e\\)\\)\n}\\)\n\n// 测试被截断的emoji \\(只保留第一字节\\)\nconst broken = '🎉'.slice\\(0, 1\\)\nconsole.log\\('截断emoji:', broken, '检测:', isIncompleteUTF8\\(broken\\)\\)\n\")",
22
- "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\nconsole.log\\('测试:', renderLine\\('📁 文件操作:读取、创建'\\)\\)\n\")",
23
- "Bash(node -e \"\nconst hasIncompleteSurrogate = \\(str\\) => {\n if \\(!str || str.length === 0\\) return false\n const lastChar = str.charCodeAt\\(str.length - 1\\)\n console.log\\('检查:', str, 'lastChar:', lastChar.toString\\(16\\), '范围:', \\(lastChar >= 0xD800 && lastChar <= 0xDBFF\\)\\)\n return lastChar >= 0xD800 && lastChar <= 0xDBFF\n}\n\nconst chunk1 = '\\\\xD83C'\nconsole.log\\('结果:', hasIncompleteSurrogate\\(chunk1\\)\\)\n\")",
24
- "Bash(cd D:/Code/vb-agent && node test-stream-emoji.js 2>&1)",
25
- "Read(//d/Date/20260321/app/**)",
26
- "Bash(node -e \":*)",
27
- "Bash(node -e \"\nconst { loadAgentConfig } = require\\('./plugins/default-plugins'\\);\nconst config = loadAgentConfig\\('D:/Date/20260321/app/.agent'\\);\nconsole.log\\('skillsDirs:', config.skillsDirs\\);\n\")",
28
- "Bash(cd D:/Code/vb-agent && pnpm install --shamefully-hoist 2>&1 | head -20)",
29
- "Bash(cd D:/Code/vb-agent && rm -rf node_modules && pnpm install)",
30
- "Bash(cd D:/Code/vb-agent && timeout 8 node test-tg.js 2>&1 || true)",
31
- "Bash(cd D:/Code/vb-agent && timeout 10 node test-tg.js 2>&1 || true)",
32
- "Bash(find /d/Code/vb-agent -name \"*email*\" -type f 2>/dev/null | grep -v node_modules | grep -v .git)",
33
- "Bash(find /d/Code/vb-agent -maxdepth 2 -name \"*.md\" -type f 2>/dev/null | grep -v node_modules)",
34
- "Bash(node -c plugins/default-plugins.js && node -c src/core/plugin-manager.js && echo \"Syntax OK\")",
35
- "Bash(node -c plugins/install-plugin.js && echo \"Syntax OK\")",
36
- "Bash(node -c cli/src/ui/chat-ui.js && echo \"Syntax OK\")",
37
- "Bash(node -c plugins/default-plugins.js && echo \"Syntax OK\")",
38
- "Bash(node -c plugins/scheduler-plugin.js && echo \"Syntax OK\")",
39
- "Bash(node -c plugins/telegram-plugin.js && node -c plugins/scheduler-plugin.js && echo \"Syntax OK\")",
40
- "Bash(node -c plugins/telegram-plugin.js && echo \"Syntax OK\")",
41
- "WebSearch",
42
- "Bash(npm ls:*)",
43
- "Bash(cd node_modules/@chnak/weixin-bot && npm run build 2>&1)",
44
- "Bash(cd node_modules/@chnak/weixin-bot && npx tsc 2>&1)",
45
- "Bash(npm install:*)",
46
- "Bash(cd node_modules/@chnak/weixin-bot && npx typescript --version && npx tsc 2>&1)",
47
- "Bash(npx tsc:*)",
48
- "Bash(node --check /d/Code/vb-agent/plugins/weixin-plugin.js 2>&1)",
49
- "Bash(node --check /d/Code/vb-agent/plugins/telegram-plugin.js && node --check /d/Code/vb-agent/plugins/weixin-plugin.js && echo \"OK\")",
50
- "Bash(node --check /d/Code/vb-agent/cli/src/ui/chat-ui.js && echo \"OK\")",
51
- "Bash(npm uninstall:*)",
52
- "Bash(rm -rf /tmp/weixin-bot && git clone https://github.com/chnak/weixin-bot.git /tmp/weixin-bot 2>&1)",
53
- "Bash(mkdir -p node_modules/@chnak/weixin-bot && cp -r /tmp/weixin-bot/nodejs/* node_modules/@chnak/weixin-bot/ && cd node_modules/@chnak/weixin-bot && npm install 2>&1)",
54
- "Bash(node --check /d/Code/vb-agent/plugins/weixin-plugin.js && echo \"OK\")",
55
- "Bash(node -e \"import\\('@chnak/weixin-bot'\\).then\\(m => console.log\\('OK:', Object.keys\\(m\\)\\)\\).catch\\(e => console.error\\('Error:', e.message\\)\\)\")",
56
- "Bash(npm run:*)",
57
- "Bash(node -e \"const { WeixinBot } = require\\('@chnak/weixin-bot'\\); console.log\\(typeof WeixinBot\\)\" 2>&1)",
58
- "Bash(node -e \"import\\('@chnak/weixin-bot'\\).then\\(m => console.log\\('OK:', typeof m.WeixinBot\\)\\).catch\\(e => console.error\\('Error:', e.message\\)\\)\" 2>&1)",
59
- "Bash(ls -la D:/code/vb-agent/cli/bin/ && cat D:/code/vb-agent/cli/bin/*.js 2>/dev/null | head -50)",
60
- "Bash(npm config:*)",
61
- "Bash(node -c plugins/subagent-plugin.js 2>&1)",
62
- "Bash(node -c plugins/default-plugins.js 2>&1)",
63
- "Bash(node -c plugins/default-plugins.js && node -c src/core/plugin-manager.js && node -c plugins/tools-plugin.js 2>&1)",
64
- "Bash(node -c src/core/plugin-base.js && node -c src/core/plugin-manager.js 2>&1)",
65
- "Bash(node -c plugins/telegram-plugin.js && node -c plugins/weixin-plugin.js 2>&1)",
66
- "Bash(node -c src/core/plugin-manager.js 2>&1)",
67
- "Bash(node -c src/core/plugin-manager.js && node -c src/core/plugin-base.js && node -c plugins/default-plugins.js && node -c plugins/telegram-plugin.js && node -c plugins/weixin-plugin.js 2>&1)",
68
- "Bash(node -e \"require\\('dotenv'\\).config\\(\\); console.log\\('PROVIDER:', process.env.FOLIKO_PROVIDER\\); console.log\\('MODEL:', process.env.FOLIKO_MODEL\\); console.log\\('KEY:', process.env.DEEPSEEK_API_KEY ? 'set' : 'not set'\\)\" 2>&1)",
69
- "Bash(node cli/src/index.js chat 2>&1 | head -30)",
70
- "Bash(node -e 'const { DEFAULT_PROVIDERS } = require\\(\"./src/core/provider\"\\); console.log\\(DEFAULT_PROVIDERS\\);')",
71
- "Bash(node -e \"const dotenv = require\\('dotenv'\\); const result = dotenv.config\\(\\); console.log\\('Result:', result\\); console.log\\('PROVIDER after dotenv:', process.env.FOLIKO_PROVIDER\\);\" 2>&1)",
72
- "Bash(node -c plugins/email.js && node -c plugins/default-plugins.js 2>&1)",
73
- "Bash(node -c plugins/email.js 2>&1)",
74
- "Bash(npm list:*)",
75
- "Bash(node -e \"const {EmailPlugin} = require\\('./plugins/email'\\); const p = new EmailPlugin\\(\\); console.log\\('email plugin loaded ok'\\); console.log\\('enabled:', p.enabled\\); console.log\\('version:', p.version\\);\" 2>&1)",
76
- "Bash(cd D:/Code/vb-agent && node -e \"console.log\\('IMAP_HOST:', process.env.IMAP_HOST\\); console.log\\('IMAP_USER:', process.env.IMAP_USER\\); console.log\\('IMAP_PORT:', process.env.IMAP_PORT\\);\")",
77
- "Bash(node -e \"const sdk = require\\('@larksuiteoapi/node-sdk'\\); console.log\\(Object.keys\\(sdk\\)\\);\")",
78
- "Bash(node -e \"const { WSClient } = require\\('@larksuiteoapi/node-sdk'\\); const sdk = new WSClient\\({}\\); console.log\\(Object.getOwnPropertyNames\\(Object.getPrototypeOf\\(sdk\\)\\)\\);\")",
79
- "Bash(node -c src/core/framework.js 2>&1)",
80
- "Bash(node -c plugins/telegram-plugin.js 2>&1)",
81
- "Bash(node -c src/capabilities/skill-manager.js 2>&1)",
82
- "Bash(node -c plugins/feishu-plugin.js 2>&1)",
83
- "Bash(node debug-skills.js)",
84
- "Bash(node -c src/capabilities/workflow-engine.js 2>&1)",
85
- "Bash(node -c skills/workflow-guide/SKILL.md 2>&1 || head -10 skills/workflow-guide/SKILL.md)",
86
- "Bash(ls plugins/*.js 2>&1)",
87
- "Bash(node -c plugins/web-plugin.js 2>&1)",
88
- "Bash(cd D:/code/vb-agent && node -e \"require\\('./plugins/web-plugin.js'\\)\" 2>&1)",
89
- "Bash(cd D:/code/vb-agent && node -e \"\nconst { WebPlugin } = require\\('./plugins/web-plugin.js'\\);\nconst p = new WebPlugin\\(\\);\nconsole.log\\('Plugin created:', p.name, p.version\\);\n\" 2>&1)",
90
- "Bash(cd D:/code/vb-agent && mkdir -p test-static && echo '<html><body>Hello Static</body></html>' > test-static/index.html)",
91
- "mcp__plugin_context7_context7__resolve-library-id",
92
- "mcp__plugin_context7_context7__query-docs",
93
- "Bash(cd D:/code/vb-agent && rm test-hono.js)",
94
- "Bash(curl -s http://localhost:3000/test 2>&1 || echo \"连接失败\")",
95
- "Bash(cd D:/code/vb-agent && timeout 15 node examples/test-web-plugin.js 2>&1)",
96
- "Bash(cd D:/code/vb-agent && timeout 60 node examples/test-chat.js 2>&1 | head -100)",
97
- "Bash(cd D:/code/vb-agent && timeout 120 node examples/test-chat.js 2>&1 | tail -80)",
98
- "Bash(cd D:/code/vb-agent && timeout 120 node examples/bootstrap.js 2>&1 | tail -100)",
99
- "Bash(cd D:/code/vb-agent && timeout 10 node examples/test-web-plugin.js 2>&1)",
100
- "Bash(curl -s -X POST http://localhost:3000/test-webhook \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test from curl\",\"sessionId\":\"web_test\"}')",
101
- "Bash(curl -s http://localhost:3000/test 2>&1 || echo \"Connection failed\")",
102
- "Bash(curl -s -X POST http://localhost:3000/webhook/test-webhook \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test from curl\",\"sessionId\":\"web_test\"}')",
103
- "Bash(curl -s http://localhost:3000/webui/status)",
104
- "Bash(curl -s http://localhost:3000/test)",
105
- "Bash(curl -s -v -X POST http://localhost:3000/test-webhook \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test\"}' 2>&1 | head -30)",
106
- "Bash(curl -s -X POST \"http://localhost:3000/webhook/test-webhook\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test\"}' 2>&1)",
107
- "Bash(curl -s http://localhost:3000/webui/ 2>&1)",
108
- "Bash(curl -s -X POST http://localhost:3000/webui/list-routes \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{}' 2>&1 || echo \"Endpoint not found\")",
109
- "Bash(curl -s http://localhost:3000/ 2>&1)",
110
- "Bash(curl -s -X POST \"http://localhost:3000/webhook/test-webhook\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test with prefix\"}')",
111
- "Bash(netstat -ano | grep :3000 | head -5)",
112
- "Bash(netstat -ano | grep :3000 | grep LISTENING)",
113
- "Bash(curl -s -X POST http://localhost:3000/test-webhook \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test\",\"sessionId\":\"web_test\"}')",
114
- "Bash(taskkill /F /IM node.exe 2>/dev/null; sleep 1; echo \"Node processes killed\")",
115
- "Bash(netstat -ano | grep :3000)",
116
- "Bash(taskkill //F //PID 19848)",
117
- "Bash(curl -s -X POST \"http://localhost:3000/webhook/075s5s2umn4smn4f\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"test\":\"data\"}' 2>&1)",
118
- "Bash(curl -s http://localhost:3000/api/hello 2>&1)",
119
- "Bash(curl -v -X POST \"http://localhost:3000/webhook/075s5s2umn4smn4f\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"test\":\"data\"}' 2>&1 | head -30)",
120
- "Bash(cd D:/code/vb-agent && timeout 30 node test-compression.js 2>&1)",
121
- "Bash(cd D:/code/vb-agent && node -c src/core/agent-chat.js 2>&1)",
122
- "Bash(cd D:/code/vb-agent && node -e \"require\\('./src/core/agent-chat.js'\\); console.log\\('模块加载成功'\\)\" 2>&1)",
123
- "Bash(cd D:/code/vb-agent && node -e \"require\\('./src/core/agent.js'\\); console.log\\('Agent 加载成功'\\)\" 2>&1)",
124
- "Bash(node -c src/capabilities/skill-manager.js && node -c src/executors/mcp-executor.js && node -c src/capabilities/workflow-engine.js && node -c src/core/plugin-manager.js 2>&1)",
125
- "Bash(node -c src/core/plugin-manager.js && node -c plugins/tools-plugin.js 2>&1)",
126
- "Bash(node -c plugins/default-plugins.js && node -c cli/src/commands/chat.js 2>&1)",
127
- "Bash(node -c plugins/telegram-plugin.js && node -c plugins/feishu-plugin.js && node -c plugins/weixin-plugin.js 2>&1)",
128
- "Bash(node -c src/core/agent.js 2>&1)",
129
- "Bash(cd D:/code/vb-agent && node examples/bootstrap.js 2>&1 | head -50)",
130
- "Bash(node -c plugins/proactive-agent-plugin.js 2>&1)",
131
- "Bash(node -c src/index.js && node -c examples/proactive-example.js && node -c examples/proactive-advanced.js && echo \"All syntax OK\")",
132
- "Bash(node -c plugins/proactive-agent-plugin.js && node -c plugins/default-plugins.js && echo \"All OK\")",
133
- "Bash(node examples/basic.js 2>&1 | head -50)",
134
- "Bash(node examples/ambient-example.js 2>&1 | head -80)",
135
- "Bash(ls -la .agent/data/ambient/ 2>/dev/null && cat .agent/data/ambient/*.json 2>/dev/null | head -50)",
136
- "Bash(node examples/basic.js 2>&1 | head -30)",
137
- "Bash(node examples/bootstrap.js 2>&1 | head -40)",
138
- "Bash(node test-debug.js 2>&1)",
139
- "Bash(ls -la D:/Code/vb-agent/*.md 2>/dev/null || dir D:\\\\Code\\\\vb-agent\\\\*.md /b 2>nul)",
140
- "Bash(node -c src/capabilities/workflow-engine.js && node -c plugins/ambient-agent-plugin.js)",
141
- "Bash(node -c plugins/ambient-agent-plugin.js)",
142
- "Bash(node -c plugins/email.js)",
143
- "Bash(node -e \"require\\('./plugins/ambient-agent-plugin.js'\\)\" 2>&1)",
144
- "Bash(node -e \"\nconst { Framework } = require\\('./src/core/framework'\\);\nconst framework = new Framework\\(\\);\nframework.loadPlugin\\('./plugins/ambient-agent-plugin.js'\\).catch\\(console.error\\);\nsetTimeout\\(\\(\\) => {\n const tools = framework.getTools\\(\\);\n console.log\\('Registered tools:', tools.map\\(t => t.name\\)\\);\n}, 2000\\);\n\" 2>&1)",
145
- "Bash(node -c plugins/scheduler-plugin.js 2>&1)",
146
- "WebFetch(domain:ai-sdk.dev)",
147
- "Bash(node --check src/utils/index.js 2>&1; echo \"Exit: $?\")",
148
- "Bash(node --check src/core/agent-chat.js 2>&1; echo \"Exit: $?\")",
149
- "Bash(node --check plugins/file-system-plugin.js 2>&1; echo \"Exit: $?\")",
150
- "Bash(node --check src/capabilities/workflow-engine.js && node --check src/core/agent-chat.js && node --check src/core/agent.js && node --check src/core/plugin-manager.js && node --check src/core/framework.js && echo \"All OK\")",
151
- "Bash(node --check src/utils/retry.js && echo \"OK\")",
152
- "Bash(git checkout:*)",
153
- "Bash(node --check plugins/default-plugins.js && echo \"OK\")",
154
- "Bash(node --check plugins/subagent-plugin.js && echo \"OK\")",
155
- "Bash(cd D:/Code/vb-agent && pnpm install 2>&1 | tail -10)",
156
- "Bash(mkdir -p \"D:/Code/vb-agent/node_modules/@chanak\" && ln -sf \"../../.pnpm/@chnak+zod-to-markdown@1.0.1/node_modules/@chnak/zod-to-markdown\" \"D:/Code/vb-agent/node_modules/@chnak/zod-to-markdown\")",
157
- "Bash(cd D:/Code/vb-agent && rm -rf node_modules/@chanak && npm install @chnak/zod-to-markdown --legacy-peer-deps 2>&1 | tail -10)",
158
- "Bash(cd D:/Code/vb-agent && npm start 2>&1 | head -30)",
159
- "Bash(cd D:/Code/vb-agent && npm start 2>&1 | head -40)",
160
- "Bash(grep -l \"module.exports\" D:/Code/vb-agent/plugins/*.js 2>/dev/null | head -20)",
161
- "Bash(grep -E \"^module.exports\" D:/Code/vb-agent/plugins/*.js | head -30)",
162
- "Bash(grep -E \"^module.exports\" D:/Code/vb-agent/src/executors/*.js 2>/dev/null)",
163
- "Bash(grep \"module.exports\" D:/Code/vb-agent/plugins/ambient-agent/*.js 2>/dev/null)",
164
- "Bash(grep -E \"^module.exports\" D:/Code/vb-agent/plugins/*.js | head -20)",
165
- "Bash(cd D:/Code/vb-agent && npm start 2>&1 | head -25)",
166
- "Bash(cd D:/Code/vb-agent && timeout 20 npm start 2>&1 | head -35)",
167
- "Bash(node -c D:/Code/vb-agent/plugins/gate-trading.js 2>&1)",
168
- "Bash(cd D:/code/vb-agent && node cli/bin/foliko.js chat 2>&1 | head -30)"
169
- ]
170
- }
171
- }
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(grep -r \"dotenv\" \"D:/Code/vb-agent/\" --include=\"*.json\" 2>/dev/null | head -20)",
5
+ "Bash(cd \"D:/Code/vb-agent\" && pnpm add dotenv)",
6
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('reason'\\) || k.toLowerCase\\(\\).includes\\('split'\\) || k.toLowerCase\\(\\).includes\\('think'\\)\\)\\)\")",
7
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(typeof ai.extractReasoningMiddleware, ai.extractReasoningMiddleware.toString\\(\\).substring\\(0, 500\\)\\)\")",
8
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"\nconst ai = require\\('ai'\\);\nconsole.log\\('=== extractReasoningMiddleware ==='\\);\nconsole.log\\(ai.extractReasoningMiddleware.toString\\(\\)\\);\nconsole.log\\('\\\\n=== isReasoningUIPart ==='\\);\nconsole.log\\(typeof ai.isReasoningUIPart\\);\n\")",
9
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('split'\\)\\)\\)\")",
10
+ "Bash(cd \"D:/Code/vb-agent\" && pnpm add ink react)",
11
+ "Bash(cd \"D:/Code/vb-agent\" && node cli/bin/foliko.js --help)",
12
+ "Bash(cd \"D:/Code/vb-agent\" && timeout 2 node cli/bin/foliko.js chat 2>&1 || true)",
13
+ "Bash(cd \"D:/Code/vb-agent\" && node -e \"const mt = require\\('marked-terminal'\\); console.log\\(typeof mt, Object.keys\\(mt\\)\\)\")",
14
+ "Bash(cd \"D:/Code/vb-agent\" && timeout 3 node cli/bin/foliko.js chat 2>&1 || true)",
15
+ "Bash(echo \"你好\" | node cli/bin/foliko.js chat 2>&1 | head -50)",
16
+ "Bash(printf '思考一下1+1等于几\\\\n' | node cli/bin/foliko.js chat 2>&1 | head -100)",
17
+ "Bash(printf '1+1等于几\\\\n' | node cli/bin/foliko.js chat 2>&1)",
18
+ "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\nconsole.log\\(renderLine\\('🎉 这是一个 emoji'\\)\\)\nconsole.log\\(renderLine\\('**粗体** 和 🎉'\\)\\)\n\")",
19
+ "Bash(node -e \"\nconst { render } = require\\('./cli/src/utils/markdown'\\)\nconst text = '🎉 今天是个好日子\\\\n## 标题\\\\n- 列表项1\\\\n- 列表项2'\nconsole.log\\(render\\(text\\)\\)\n\")",
20
+ "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\n\n// 模拟emoji被截断的情况\nconst emoji = '🎉'\nconsole.log\\('完整的 emoji:', renderLine\\(emoji\\)\\)\n\n// 模拟截断 - emoji的UTF-8字节是 \\\\xF0\\\\x9F\\\\x8E\\\\x89\nconst partial = '\\\\xF0\\\\x9F' // 不完整的emoji\nconsole.log\\('截断的 emoji:', renderLine\\(partial\\)\\)\n\")",
21
+ "Bash(node -e \"\nconst isIncompleteUTF8 = \\(str\\) => {\n if \\(!str || str.length === 0\\) return false\n const lastChar = str.charCodeAt\\(str.length - 1\\)\n if \\(lastChar >= 0x80 && lastChar < 0xC0\\) return true\n return false\n}\n\n// 测试各种emoji\nconst tests = ['🎉', '📁', '⚡', '🛠️', '🔑', '💾', '📝', '⏰', '🔌', '📋']\ntests.forEach\\(e => {\n console.log\\(e, '完整:', !isIncompleteUTF8\\(e\\)\\)\n}\\)\n\n// 测试被截断的emoji \\(只保留第一字节\\)\nconst broken = '🎉'.slice\\(0, 1\\)\nconsole.log\\('截断emoji:', broken, '检测:', isIncompleteUTF8\\(broken\\)\\)\n\")",
22
+ "Bash(node -e \"\nconst { renderLine } = require\\('./cli/src/utils/markdown'\\)\nconsole.log\\('测试:', renderLine\\('📁 文件操作:读取、创建'\\)\\)\n\")",
23
+ "Bash(node -e \"\nconst hasIncompleteSurrogate = \\(str\\) => {\n if \\(!str || str.length === 0\\) return false\n const lastChar = str.charCodeAt\\(str.length - 1\\)\n console.log\\('检查:', str, 'lastChar:', lastChar.toString\\(16\\), '范围:', \\(lastChar >= 0xD800 && lastChar <= 0xDBFF\\)\\)\n return lastChar >= 0xD800 && lastChar <= 0xDBFF\n}\n\nconst chunk1 = '\\\\xD83C'\nconsole.log\\('结果:', hasIncompleteSurrogate\\(chunk1\\)\\)\n\")",
24
+ "Bash(cd D:/Code/vb-agent && node test-stream-emoji.js 2>&1)",
25
+ "Read(//d/Date/20260321/app/**)",
26
+ "Bash(node -e \":*)",
27
+ "Bash(node -e \"\nconst { loadAgentConfig } = require\\('./plugins/default-plugins'\\);\nconst config = loadAgentConfig\\('D:/Date/20260321/app/.agent'\\);\nconsole.log\\('skillsDirs:', config.skillsDirs\\);\n\")",
28
+ "Bash(cd D:/Code/vb-agent && pnpm install --shamefully-hoist 2>&1 | head -20)",
29
+ "Bash(cd D:/Code/vb-agent && rm -rf node_modules && pnpm install)",
30
+ "Bash(cd D:/Code/vb-agent && timeout 8 node test-tg.js 2>&1 || true)",
31
+ "Bash(cd D:/Code/vb-agent && timeout 10 node test-tg.js 2>&1 || true)",
32
+ "Bash(find /d/Code/vb-agent -name \"*email*\" -type f 2>/dev/null | grep -v node_modules | grep -v .git)",
33
+ "Bash(find /d/Code/vb-agent -maxdepth 2 -name \"*.md\" -type f 2>/dev/null | grep -v node_modules)",
34
+ "Bash(node -c plugins/default-plugins.js && node -c src/core/plugin-manager.js && echo \"Syntax OK\")",
35
+ "Bash(node -c plugins/install-plugin.js && echo \"Syntax OK\")",
36
+ "Bash(node -c cli/src/ui/chat-ui.js && echo \"Syntax OK\")",
37
+ "Bash(node -c plugins/default-plugins.js && echo \"Syntax OK\")",
38
+ "Bash(node -c plugins/scheduler-plugin.js && echo \"Syntax OK\")",
39
+ "Bash(node -c plugins/telegram-plugin.js && node -c plugins/scheduler-plugin.js && echo \"Syntax OK\")",
40
+ "Bash(node -c plugins/telegram-plugin.js && echo \"Syntax OK\")",
41
+ "WebSearch",
42
+ "Bash(npm ls:*)",
43
+ "Bash(cd node_modules/@chnak/weixin-bot && npm run build 2>&1)",
44
+ "Bash(cd node_modules/@chnak/weixin-bot && npx tsc 2>&1)",
45
+ "Bash(npm install:*)",
46
+ "Bash(cd node_modules/@chnak/weixin-bot && npx typescript --version && npx tsc 2>&1)",
47
+ "Bash(npx tsc:*)",
48
+ "Bash(node --check /d/Code/vb-agent/plugins/weixin-plugin.js 2>&1)",
49
+ "Bash(node --check /d/Code/vb-agent/plugins/telegram-plugin.js && node --check /d/Code/vb-agent/plugins/weixin-plugin.js && echo \"OK\")",
50
+ "Bash(node --check /d/Code/vb-agent/cli/src/ui/chat-ui.js && echo \"OK\")",
51
+ "Bash(npm uninstall:*)",
52
+ "Bash(rm -rf /tmp/weixin-bot && git clone https://github.com/chnak/weixin-bot.git /tmp/weixin-bot 2>&1)",
53
+ "Bash(mkdir -p node_modules/@chnak/weixin-bot && cp -r /tmp/weixin-bot/nodejs/* node_modules/@chnak/weixin-bot/ && cd node_modules/@chnak/weixin-bot && npm install 2>&1)",
54
+ "Bash(node --check /d/Code/vb-agent/plugins/weixin-plugin.js && echo \"OK\")",
55
+ "Bash(node -e \"import\\('@chnak/weixin-bot'\\).then\\(m => console.log\\('OK:', Object.keys\\(m\\)\\)\\).catch\\(e => console.error\\('Error:', e.message\\)\\)\")",
56
+ "Bash(npm run:*)",
57
+ "Bash(node -e \"const { WeixinBot } = require\\('@chnak/weixin-bot'\\); console.log\\(typeof WeixinBot\\)\" 2>&1)",
58
+ "Bash(node -e \"import\\('@chnak/weixin-bot'\\).then\\(m => console.log\\('OK:', typeof m.WeixinBot\\)\\).catch\\(e => console.error\\('Error:', e.message\\)\\)\" 2>&1)",
59
+ "Bash(ls -la D:/code/vb-agent/cli/bin/ && cat D:/code/vb-agent/cli/bin/*.js 2>/dev/null | head -50)",
60
+ "Bash(npm config:*)",
61
+ "Bash(node -c plugins/subagent-plugin.js 2>&1)",
62
+ "Bash(node -c plugins/default-plugins.js 2>&1)",
63
+ "Bash(node -c plugins/default-plugins.js && node -c src/core/plugin-manager.js && node -c plugins/tools-plugin.js 2>&1)",
64
+ "Bash(node -c src/core/plugin-base.js && node -c src/core/plugin-manager.js 2>&1)",
65
+ "Bash(node -c plugins/telegram-plugin.js && node -c plugins/weixin-plugin.js 2>&1)",
66
+ "Bash(node -c src/core/plugin-manager.js 2>&1)",
67
+ "Bash(node -c src/core/plugin-manager.js && node -c src/core/plugin-base.js && node -c plugins/default-plugins.js && node -c plugins/telegram-plugin.js && node -c plugins/weixin-plugin.js 2>&1)",
68
+ "Bash(node -e \"require\\('dotenv'\\).config\\(\\); console.log\\('PROVIDER:', process.env.FOLIKO_PROVIDER\\); console.log\\('MODEL:', process.env.FOLIKO_MODEL\\); console.log\\('KEY:', process.env.DEEPSEEK_API_KEY ? 'set' : 'not set'\\)\" 2>&1)",
69
+ "Bash(node cli/src/index.js chat 2>&1 | head -30)",
70
+ "Bash(node -e 'const { DEFAULT_PROVIDERS } = require\\(\"./src/core/provider\"\\); console.log\\(DEFAULT_PROVIDERS\\);')",
71
+ "Bash(node -e \"const dotenv = require\\('dotenv'\\); const result = dotenv.config\\(\\); console.log\\('Result:', result\\); console.log\\('PROVIDER after dotenv:', process.env.FOLIKO_PROVIDER\\);\" 2>&1)",
72
+ "Bash(node -c plugins/email.js && node -c plugins/default-plugins.js 2>&1)",
73
+ "Bash(node -c plugins/email.js 2>&1)",
74
+ "Bash(npm list:*)",
75
+ "Bash(node -e \"const {EmailPlugin} = require\\('./plugins/email'\\); const p = new EmailPlugin\\(\\); console.log\\('email plugin loaded ok'\\); console.log\\('enabled:', p.enabled\\); console.log\\('version:', p.version\\);\" 2>&1)",
76
+ "Bash(cd D:/Code/vb-agent && node -e \"console.log\\('IMAP_HOST:', process.env.IMAP_HOST\\); console.log\\('IMAP_USER:', process.env.IMAP_USER\\); console.log\\('IMAP_PORT:', process.env.IMAP_PORT\\);\")",
77
+ "Bash(node -e \"const sdk = require\\('@larksuiteoapi/node-sdk'\\); console.log\\(Object.keys\\(sdk\\)\\);\")",
78
+ "Bash(node -e \"const { WSClient } = require\\('@larksuiteoapi/node-sdk'\\); const sdk = new WSClient\\({}\\); console.log\\(Object.getOwnPropertyNames\\(Object.getPrototypeOf\\(sdk\\)\\)\\);\")",
79
+ "Bash(node -c src/core/framework.js 2>&1)",
80
+ "Bash(node -c plugins/telegram-plugin.js 2>&1)",
81
+ "Bash(node -c src/capabilities/skill-manager.js 2>&1)",
82
+ "Bash(node -c plugins/feishu-plugin.js 2>&1)",
83
+ "Bash(node debug-skills.js)",
84
+ "Bash(node -c src/capabilities/workflow-engine.js 2>&1)",
85
+ "Bash(node -c skills/workflow-guide/SKILL.md 2>&1 || head -10 skills/workflow-guide/SKILL.md)",
86
+ "Bash(ls plugins/*.js 2>&1)",
87
+ "Bash(node -c plugins/web-plugin.js 2>&1)",
88
+ "Bash(cd D:/code/vb-agent && node -e \"require\\('./plugins/web-plugin.js'\\)\" 2>&1)",
89
+ "Bash(cd D:/code/vb-agent && node -e \"\nconst { WebPlugin } = require\\('./plugins/web-plugin.js'\\);\nconst p = new WebPlugin\\(\\);\nconsole.log\\('Plugin created:', p.name, p.version\\);\n\" 2>&1)",
90
+ "Bash(cd D:/code/vb-agent && mkdir -p test-static && echo '<html><body>Hello Static</body></html>' > test-static/index.html)",
91
+ "mcp__plugin_context7_context7__resolve-library-id",
92
+ "mcp__plugin_context7_context7__query-docs",
93
+ "Bash(cd D:/code/vb-agent && rm test-hono.js)",
94
+ "Bash(curl -s http://localhost:3000/test 2>&1 || echo \"连接失败\")",
95
+ "Bash(cd D:/code/vb-agent && timeout 15 node examples/test-web-plugin.js 2>&1)",
96
+ "Bash(cd D:/code/vb-agent && timeout 60 node examples/test-chat.js 2>&1 | head -100)",
97
+ "Bash(cd D:/code/vb-agent && timeout 120 node examples/test-chat.js 2>&1 | tail -80)",
98
+ "Bash(cd D:/code/vb-agent && timeout 120 node examples/bootstrap.js 2>&1 | tail -100)",
99
+ "Bash(cd D:/code/vb-agent && timeout 10 node examples/test-web-plugin.js 2>&1)",
100
+ "Bash(curl -s -X POST http://localhost:3000/test-webhook \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test from curl\",\"sessionId\":\"web_test\"}')",
101
+ "Bash(curl -s http://localhost:3000/test 2>&1 || echo \"Connection failed\")",
102
+ "Bash(curl -s -X POST http://localhost:3000/webhook/test-webhook \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test from curl\",\"sessionId\":\"web_test\"}')",
103
+ "Bash(curl -s http://localhost:3000/webui/status)",
104
+ "Bash(curl -s http://localhost:3000/test)",
105
+ "Bash(curl -s -v -X POST http://localhost:3000/test-webhook \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test\"}' 2>&1 | head -30)",
106
+ "Bash(curl -s -X POST \"http://localhost:3000/webhook/test-webhook\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test\"}' 2>&1)",
107
+ "Bash(curl -s http://localhost:3000/webui/ 2>&1)",
108
+ "Bash(curl -s -X POST http://localhost:3000/webui/list-routes \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{}' 2>&1 || echo \"Endpoint not found\")",
109
+ "Bash(curl -s http://localhost:3000/ 2>&1)",
110
+ "Bash(curl -s -X POST \"http://localhost:3000/webhook/test-webhook\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test with prefix\"}')",
111
+ "Bash(netstat -ano | grep :3000 | head -5)",
112
+ "Bash(netstat -ano | grep :3000 | grep LISTENING)",
113
+ "Bash(curl -s -X POST http://localhost:3000/test-webhook \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"message\":\"test\",\"sessionId\":\"web_test\"}')",
114
+ "Bash(taskkill /F /IM node.exe 2>/dev/null; sleep 1; echo \"Node processes killed\")",
115
+ "Bash(netstat -ano | grep :3000)",
116
+ "Bash(taskkill //F //PID 19848)",
117
+ "Bash(curl -s -X POST \"http://localhost:3000/webhook/075s5s2umn4smn4f\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"test\":\"data\"}' 2>&1)",
118
+ "Bash(curl -s http://localhost:3000/api/hello 2>&1)",
119
+ "Bash(curl -v -X POST \"http://localhost:3000/webhook/075s5s2umn4smn4f\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"test\":\"data\"}' 2>&1 | head -30)",
120
+ "Bash(cd D:/code/vb-agent && timeout 30 node test-compression.js 2>&1)",
121
+ "Bash(cd D:/code/vb-agent && node -c src/core/agent-chat.js 2>&1)",
122
+ "Bash(cd D:/code/vb-agent && node -e \"require\\('./src/core/agent-chat.js'\\); console.log\\('模块加载成功'\\)\" 2>&1)",
123
+ "Bash(cd D:/code/vb-agent && node -e \"require\\('./src/core/agent.js'\\); console.log\\('Agent 加载成功'\\)\" 2>&1)",
124
+ "Bash(node -c src/capabilities/skill-manager.js && node -c src/executors/mcp-executor.js && node -c src/capabilities/workflow-engine.js && node -c src/core/plugin-manager.js 2>&1)",
125
+ "Bash(node -c src/core/plugin-manager.js && node -c plugins/tools-plugin.js 2>&1)",
126
+ "Bash(node -c plugins/default-plugins.js && node -c cli/src/commands/chat.js 2>&1)",
127
+ "Bash(node -c plugins/telegram-plugin.js && node -c plugins/feishu-plugin.js && node -c plugins/weixin-plugin.js 2>&1)",
128
+ "Bash(node -c src/core/agent.js 2>&1)",
129
+ "Bash(cd D:/code/vb-agent && node examples/bootstrap.js 2>&1 | head -50)",
130
+ "Bash(node -c plugins/proactive-agent-plugin.js 2>&1)",
131
+ "Bash(node -c src/index.js && node -c examples/proactive-example.js && node -c examples/proactive-advanced.js && echo \"All syntax OK\")",
132
+ "Bash(node -c plugins/proactive-agent-plugin.js && node -c plugins/default-plugins.js && echo \"All OK\")",
133
+ "Bash(node examples/basic.js 2>&1 | head -50)",
134
+ "Bash(node examples/ambient-example.js 2>&1 | head -80)",
135
+ "Bash(ls -la .agent/data/ambient/ 2>/dev/null && cat .agent/data/ambient/*.json 2>/dev/null | head -50)",
136
+ "Bash(node examples/basic.js 2>&1 | head -30)",
137
+ "Bash(node examples/bootstrap.js 2>&1 | head -40)",
138
+ "Bash(node test-debug.js 2>&1)",
139
+ "Bash(ls -la D:/Code/vb-agent/*.md 2>/dev/null || dir D:\\\\Code\\\\vb-agent\\\\*.md /b 2>nul)",
140
+ "Bash(node -c src/capabilities/workflow-engine.js && node -c plugins/ambient-agent-plugin.js)",
141
+ "Bash(node -c plugins/ambient-agent-plugin.js)",
142
+ "Bash(node -c plugins/email.js)",
143
+ "Bash(node -e \"require\\('./plugins/ambient-agent-plugin.js'\\)\" 2>&1)",
144
+ "Bash(node -e \"\nconst { Framework } = require\\('./src/core/framework'\\);\nconst framework = new Framework\\(\\);\nframework.loadPlugin\\('./plugins/ambient-agent-plugin.js'\\).catch\\(console.error\\);\nsetTimeout\\(\\(\\) => {\n const tools = framework.getTools\\(\\);\n console.log\\('Registered tools:', tools.map\\(t => t.name\\)\\);\n}, 2000\\);\n\" 2>&1)",
145
+ "Bash(node -c plugins/scheduler-plugin.js 2>&1)",
146
+ "WebFetch(domain:ai-sdk.dev)",
147
+ "Bash(node --check src/utils/index.js 2>&1; echo \"Exit: $?\")",
148
+ "Bash(node --check src/core/agent-chat.js 2>&1; echo \"Exit: $?\")",
149
+ "Bash(node --check plugins/file-system-plugin.js 2>&1; echo \"Exit: $?\")",
150
+ "Bash(node --check src/capabilities/workflow-engine.js && node --check src/core/agent-chat.js && node --check src/core/agent.js && node --check src/core/plugin-manager.js && node --check src/core/framework.js && echo \"All OK\")",
151
+ "Bash(node --check src/utils/retry.js && echo \"OK\")",
152
+ "Bash(git checkout:*)",
153
+ "Bash(node --check plugins/default-plugins.js && echo \"OK\")",
154
+ "Bash(node --check plugins/subagent-plugin.js && echo \"OK\")",
155
+ "Bash(cd D:/Code/vb-agent && pnpm install 2>&1 | tail -10)",
156
+ "Bash(mkdir -p \"D:/Code/vb-agent/node_modules/@chanak\" && ln -sf \"../../.pnpm/@chnak+zod-to-markdown@1.0.1/node_modules/@chnak/zod-to-markdown\" \"D:/Code/vb-agent/node_modules/@chnak/zod-to-markdown\")",
157
+ "Bash(cd D:/Code/vb-agent && rm -rf node_modules/@chanak && npm install @chnak/zod-to-markdown --legacy-peer-deps 2>&1 | tail -10)",
158
+ "Bash(cd D:/Code/vb-agent && npm start 2>&1 | head -30)",
159
+ "Bash(cd D:/Code/vb-agent && npm start 2>&1 | head -40)",
160
+ "Bash(grep -l \"module.exports\" D:/Code/vb-agent/plugins/*.js 2>/dev/null | head -20)",
161
+ "Bash(grep -E \"^module.exports\" D:/Code/vb-agent/plugins/*.js | head -30)",
162
+ "Bash(grep -E \"^module.exports\" D:/Code/vb-agent/src/executors/*.js 2>/dev/null)",
163
+ "Bash(grep \"module.exports\" D:/Code/vb-agent/plugins/ambient-agent/*.js 2>/dev/null)",
164
+ "Bash(grep -E \"^module.exports\" D:/Code/vb-agent/plugins/*.js | head -20)",
165
+ "Bash(cd D:/Code/vb-agent && npm start 2>&1 | head -25)",
166
+ "Bash(cd D:/Code/vb-agent && timeout 20 npm start 2>&1 | head -35)",
167
+ "Bash(node -c D:/Code/vb-agent/plugins/gate-trading.js 2>&1)",
168
+ "Bash(cd D:/code/vb-agent && node cli/bin/foliko.js chat 2>&1 | head -30)",
169
+ "Bash(node examples/test-chat-stream-diff.js 2>&1)",
170
+ "Bash(node examples/test-long-chat.js 2>&1)",
171
+ "Bash(node -c src/core/agent-chat.js && node -c src/core/agent.js && node -c plugins/session-plugin.js && echo \"Syntax OK\")",
172
+ "Bash(node examples/test-concurrent-chat.js 2>&1 | head -80)",
173
+ "Bash(node examples/test-session-chat.js 2>&1 | head -80)",
174
+ "Bash(node examples/test-session-chat.js 2>&1 | tail -30)",
175
+ "Bash(node examples/test-session-chat.js 2>&1 | tail -20)",
176
+ "Bash(node examples/test-session-chat.js 2>&1 | grep -E \"跳过|ERROR|Error\" || echo \"No skip logs\")"
177
+ ]
178
+ }
179
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * chat() 持续聊天调试测试
3
+ * 专门测试 chat 方法为什么不返回数据
4
+ */
5
+
6
+ const { Framework } = require('../src');
7
+ const AIPlugin = require('../plugins/ai-plugin');
8
+ require('dotenv').config();
9
+
10
+ async function main() {
11
+ console.log('=== chat() 持续聊天调试测试 ===\n');
12
+
13
+ // 创建框架
14
+ const framework = new Framework({ debug: true });
15
+
16
+ // 使用 MiniMax (Agent SDK)
17
+ await framework.loadPlugin(
18
+ new AIPlugin({
19
+ provider: 'minimax',
20
+ model: 'MiniMax-M2.7',
21
+ apiKey: process.env.MINIMAX_API_KEY || 'your-api-key',
22
+ })
23
+ );
24
+
25
+ // 注册一个简单的测试工具
26
+ const { z } = require('zod');
27
+ framework.registerTool({
28
+ name: 'test_tool',
29
+ description: '测试工具,返回传入的参数',
30
+ inputSchema: z.object({
31
+ msg: z.string().describe('要返回的消息'),
32
+ }),
33
+ execute: async (args) => {
34
+ console.log('[DEBUG] test_tool called with:', args);
35
+ return `工具收到: ${args.msg}`;
36
+ },
37
+ });
38
+
39
+ console.log('[Framework] Ready!');
40
+ console.log('[Tools]', framework.getTools().map((t) => t.name));
41
+
42
+ // 创建 Agent
43
+ const agent = framework.createAgent({
44
+ name: 'DebugAgent',
45
+ systemPrompt: '你是一个有帮助的助手。如果用户要求使用工具,请使用工具。',
46
+ });
47
+
48
+ // 监听所有事件
49
+ agent.on('tool-call', (tool) => {
50
+ console.log('[Event] tool-call:', tool.name, tool.args);
51
+ });
52
+
53
+ agent.on('tool-result', (result) => {
54
+ console.log('[Event] tool-result:', result.name, '->', JSON.stringify(result.result).substring(0, 200));
55
+ });
56
+
57
+ agent.on('error', (err) => {
58
+ console.error('[Event] error:', err.error);
59
+ });
60
+
61
+ // 测试函数
62
+ const testChat = async (question, round) => {
63
+ console.log(`\n========== Round ${round} ==========`);
64
+ console.log(`[User] ${question}`);
65
+
66
+ try {
67
+ // 打印 result 的完整结构
68
+ const result = await agent.chat(question);
69
+ console.log(`\n[DEBUG] result keys:`, Object.keys(result));
70
+ console.log(`[DEBUG] result:`, JSON.stringify(result, null, 2).substring(0, 500));
71
+
72
+ if (result.message) {
73
+ console.log(`\n[Agent] ${result.message}`);
74
+ } else {
75
+ console.log(`\n[WARNING] result.message is empty!`);
76
+ }
77
+
78
+ // 打印当前消息历史长度
79
+ const chatHandler = agent._chatHandler;
80
+ if (chatHandler) {
81
+ console.log(`[DEBUG] _messages.length:`, chatHandler._messages.length);
82
+ console.log(`[DEBUG] compression count:`, chatHandler._compressionCount);
83
+ }
84
+ } catch (err) {
85
+ console.error(`\n[Error]`, err.message);
86
+ console.error(err.stack);
87
+ }
88
+ };
89
+
90
+ // 执行多轮测试
91
+ await testChat('你好,介绍一下你自己', 1);
92
+ await testChat('请用 test_tool 工具返回 "hello world"', 2);
93
+ await testChat('今天天气不错,你觉得呢?', 3);
94
+ await testChat('帮我计算 123 + 456 等于多少', 4);
95
+ await testChat('再说一次你的名字', 5);
96
+
97
+ console.log('\n========== 测试完成 ==========');
98
+
99
+ await framework.destroy();
100
+ }
101
+
102
+ main().catch(console.error);
@@ -0,0 +1,76 @@
1
+ /**
2
+ * 测试 chat() 返回值的完整结构
3
+ */
4
+
5
+ const { Framework } = require('../src');
6
+ const AIPlugin = require('../plugins/ai-plugin');
7
+ require('dotenv').config();
8
+
9
+ async function main() {
10
+ console.log('=== 测试 chat() 返回值结构 ===\n');
11
+
12
+ const framework = new Framework({ debug: true });
13
+
14
+ await framework.loadPlugin(
15
+ new AIPlugin({
16
+ provider: 'minimax',
17
+ model: 'MiniMax-M2.7',
18
+ apiKey: process.env.MINIMAX_API_KEY || 'your-api-key',
19
+ })
20
+ );
21
+
22
+ const { z } = require('zod');
23
+ framework.registerTool({
24
+ name: 'echo',
25
+ description: '返回输入的内容',
26
+ inputSchema: z.object({
27
+ msg: z.string().describe('要返回的消息'),
28
+ }),
29
+ execute: async (args) => {
30
+ return `工具收到: ${args.msg}`;
31
+ },
32
+ });
33
+
34
+ console.log('[Framework] Ready!');
35
+
36
+ const agent = framework.createAgent({
37
+ name: 'TestAgent',
38
+ systemPrompt: '你是一个有帮助的助手。',
39
+ });
40
+
41
+ // 测试 1:简单对话
42
+ console.log('\n--- 测试 1:简单对话 ---');
43
+ try {
44
+ const result = await agent.chat('你好');
45
+ console.log('[DEBUG] result:', JSON.stringify(result, null, 2));
46
+ console.log('[DEBUG] result 顶层 keys:', Object.keys(result));
47
+ } catch (err) {
48
+ console.error('[Error]', err.message);
49
+ }
50
+
51
+ // 测试 2:触发工具调用
52
+ console.log('\n--- 测试 2:触发工具调用 ---');
53
+ try {
54
+ const result = await agent.chat('请用 echo 工具返回 "hello"');
55
+ console.log('[DEBUG] result:', JSON.stringify(result, null, 2));
56
+ console.log('[DEBUG] result 顶层 keys:', Object.keys(result));
57
+ } catch (err) {
58
+ console.error('[Error]', err.message);
59
+ }
60
+
61
+ // 测试 3:多次对话(累积上下文)
62
+ console.log('\n--- 测试 3:多次对话 ---');
63
+ try {
64
+ await agent.chat('你好');
65
+ await agent.chat('今天天气不错');
66
+ const result = await agent.chat('我刚才说什么了?');
67
+ console.log('[DEBUG] result:', JSON.stringify(result, null, 2));
68
+ } catch (err) {
69
+ console.error('[Error]', err.message);
70
+ }
71
+
72
+ await framework.destroy();
73
+ console.log('\n[Done]');
74
+ }
75
+
76
+ main().catch(console.error);