foliko 1.0.62 → 1.0.64
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.
- package/.claude/settings.local.json +142 -142
- package/cli/src/commands/chat.js +16 -0
- package/package.json +1 -1
- package/plugins/email.js +103 -17
- package/plugins/file-system-plugin.js +30 -0
- package/plugins/scheduler-plugin.js +11 -11
|
@@ -1,142 +1,142 @@
|
|
|
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
|
-
]
|
|
141
|
-
}
|
|
142
|
-
}
|
|
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
|
+
]
|
|
141
|
+
}
|
|
142
|
+
}
|
package/cli/src/commands/chat.js
CHANGED
|
@@ -115,6 +115,22 @@ async function chatCommand(args) {
|
|
|
115
115
|
// 初始化 UI
|
|
116
116
|
const ui = new ChatUI(agent)
|
|
117
117
|
|
|
118
|
+
// 监听通知事件,在 CLI 中显示
|
|
119
|
+
// 显示当前会话的通知,以及没有指定 sessionId 的广播通知
|
|
120
|
+
framework.on('notification', (data) => {
|
|
121
|
+
const { title, message, source, timestamp, sessionId } = data
|
|
122
|
+
// 如果通知指定了 sessionId 且不匹配 CLI 会话,跳过
|
|
123
|
+
if (sessionId && sessionId !== ui.sessionId) {
|
|
124
|
+
return
|
|
125
|
+
}
|
|
126
|
+
const time = timestamp ? new Date(timestamp).toLocaleTimeString('zh-CN') : ''
|
|
127
|
+
console.log('\n' + '='.repeat(50))
|
|
128
|
+
console.log(`🔔 [${source}] ${title}`)
|
|
129
|
+
console.log(message)
|
|
130
|
+
if (time) console.log(`时间: ${time}`)
|
|
131
|
+
console.log('='.repeat(50) + '\n')
|
|
132
|
+
})
|
|
133
|
+
|
|
118
134
|
// 启动聊天
|
|
119
135
|
ui.start()
|
|
120
136
|
}
|
package/package.json
CHANGED
package/plugins/email.js
CHANGED
|
@@ -44,19 +44,19 @@ class EmailPlugin extends Plugin {
|
|
|
44
44
|
return this
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
if (process.env.IMAP_USER && process.env.IMAP_PASS) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} else {
|
|
58
|
-
|
|
59
|
-
}
|
|
47
|
+
// if (process.env.IMAP_USER && process.env.IMAP_PASS) {
|
|
48
|
+
// console.log('[Email] Auto-starting email watch...')
|
|
49
|
+
// this._startEmailWatch({
|
|
50
|
+
// interval: 60,
|
|
51
|
+
// host: process.env.IMAP_HOST,
|
|
52
|
+
// port: parseInt(process.env.IMAP_PORT) || 993,
|
|
53
|
+
// user: process.env.IMAP_USER,
|
|
54
|
+
// password: process.env.IMAP_PASS,
|
|
55
|
+
// box: 'INBOX'
|
|
56
|
+
// })
|
|
57
|
+
// } else {
|
|
58
|
+
// console.log('[Email] IMAP credentials not configured, skipping auto-start')
|
|
59
|
+
// }
|
|
60
60
|
return this
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -148,6 +148,19 @@ class EmailPlugin extends Plugin {
|
|
|
148
148
|
}
|
|
149
149
|
})
|
|
150
150
|
|
|
151
|
+
// 删除邮件
|
|
152
|
+
this._framework.registerTool({
|
|
153
|
+
name: 'email_delete',
|
|
154
|
+
description: '删除邮件(标记为已删除,然后永久删除)',
|
|
155
|
+
inputSchema: z.object({
|
|
156
|
+
messageId: z.string().describe('邮件UID或序列号'),
|
|
157
|
+
box: z.string().optional().describe('邮箱文件夹,默认INBOX')
|
|
158
|
+
}),
|
|
159
|
+
execute: async (args) => {
|
|
160
|
+
return this._deleteEmail(args)
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
|
|
151
164
|
// 配置邮箱连接
|
|
152
165
|
this._framework.registerTool({
|
|
153
166
|
name: 'email_configure',
|
|
@@ -196,11 +209,12 @@ class EmailPlugin extends Plugin {
|
|
|
196
209
|
async _handleEmailWatch(args) {
|
|
197
210
|
args={
|
|
198
211
|
...args,
|
|
199
|
-
host: process.env.IMAP_HOST,
|
|
200
|
-
port: parseInt(process.env.IMAP_PORT) || 993,
|
|
201
|
-
user: process.env.IMAP_USER,
|
|
202
|
-
password: process.env.IMAP_PASS
|
|
212
|
+
host: config.host || process.env.IMAP_HOST,
|
|
213
|
+
port: config.port || parseInt(process.env.IMAP_PORT) || 993,
|
|
214
|
+
user: config.user || process.env.IMAP_USER,
|
|
215
|
+
password: config.password || process.env.IMAP_PASS
|
|
203
216
|
}
|
|
217
|
+
|
|
204
218
|
const { action, interval, host, port, user, password, box } = args
|
|
205
219
|
|
|
206
220
|
switch (action) {
|
|
@@ -636,6 +650,40 @@ class EmailPlugin extends Plugin {
|
|
|
636
650
|
}
|
|
637
651
|
}
|
|
638
652
|
|
|
653
|
+
async _deleteEmail(args) {
|
|
654
|
+
try {
|
|
655
|
+
const Imap = require('imap-mkl')
|
|
656
|
+
|
|
657
|
+
const imapConfig = {
|
|
658
|
+
user: args.user || process.env.IMAP_USER,
|
|
659
|
+
password: args.password || process.env.IMAP_PASS,
|
|
660
|
+
host: args.host || process.env.IMAP_HOST,
|
|
661
|
+
port: args.port || parseInt(process.env.IMAP_PORT) || 993,
|
|
662
|
+
tls: true,
|
|
663
|
+
tlsOptions: { rejectUnauthorized: false },
|
|
664
|
+
id: {
|
|
665
|
+
name: process.env.IMAP_CLIENT_NAME || 'FolikoAgent',
|
|
666
|
+
version: process.env.IMAP_CLIENT_VERSION || '1.0.0',
|
|
667
|
+
vendor: process.env.IMAP_CLIENT_VENDOR || 'Foliko',
|
|
668
|
+
'support-email': process.env.IMAP_CLIENT_SUPPORT_EMAIL || 'unknown@example.com'
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
const box = args.box || 'INBOX'
|
|
673
|
+
await this._moveToTrash(imapConfig, box, args.messageId)
|
|
674
|
+
|
|
675
|
+
return {
|
|
676
|
+
success: true,
|
|
677
|
+
message: '邮件已删除'
|
|
678
|
+
}
|
|
679
|
+
} catch (error) {
|
|
680
|
+
return {
|
|
681
|
+
success: false,
|
|
682
|
+
error: error.message
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
639
687
|
_fetchEmails(imapConfig, box, limit, unreadOnly, searchCriteria) {
|
|
640
688
|
return new Promise((resolve, reject) => {
|
|
641
689
|
const Imap = require('imap-mkl')
|
|
@@ -803,6 +851,44 @@ class EmailPlugin extends Plugin {
|
|
|
803
851
|
})
|
|
804
852
|
}
|
|
805
853
|
|
|
854
|
+
_moveToTrash(imapConfig, box, messageId) {
|
|
855
|
+
return new Promise((resolve, reject) => {
|
|
856
|
+
const Imap = require('imap-mkl')
|
|
857
|
+
const imap = new Imap(imapConfig)
|
|
858
|
+
|
|
859
|
+
const cleanup = () => {
|
|
860
|
+
try { imap.end() } catch (e) {}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
imap.on('ready', () => {
|
|
864
|
+
imap.openBox(box, true, (err) => {
|
|
865
|
+
if (err) {
|
|
866
|
+
cleanup()
|
|
867
|
+
return reject(err)
|
|
868
|
+
}
|
|
869
|
+
// 标记邮件为已删除
|
|
870
|
+
imap.addFlags(messageId, '\\Deleted', (err) => {
|
|
871
|
+
if (err) {
|
|
872
|
+
cleanup()
|
|
873
|
+
return reject(err)
|
|
874
|
+
}
|
|
875
|
+
// 执行 expunge 永久删除
|
|
876
|
+
imap.expunge((err) => {
|
|
877
|
+
cleanup()
|
|
878
|
+
if (err) reject(err)
|
|
879
|
+
else resolve()
|
|
880
|
+
})
|
|
881
|
+
})
|
|
882
|
+
})
|
|
883
|
+
})
|
|
884
|
+
|
|
885
|
+
imap.on('error', (err) => reject(err))
|
|
886
|
+
imap.on('end', () => {})
|
|
887
|
+
|
|
888
|
+
imap.connect()
|
|
889
|
+
})
|
|
890
|
+
}
|
|
891
|
+
|
|
806
892
|
uninstall(framework) {
|
|
807
893
|
// 停止邮件监控
|
|
808
894
|
if (this._watchInterval) {
|
|
@@ -394,6 +394,36 @@ class FileSystemPlugin extends Plugin {
|
|
|
394
394
|
}
|
|
395
395
|
})
|
|
396
396
|
|
|
397
|
+
// 发送通知
|
|
398
|
+
framework.registerTool({
|
|
399
|
+
name: 'notification_send',
|
|
400
|
+
description: '发送系统通知,仅发送给当前聊天会话,通知会显示给用户或在下次对话时呈现',
|
|
401
|
+
inputSchema: z.object({
|
|
402
|
+
title: z.string().describe('通知标题'),
|
|
403
|
+
message: z.string().describe('通知内容'),
|
|
404
|
+
source: z.string().optional().describe('通知来源标识,默认 file-system')
|
|
405
|
+
}),
|
|
406
|
+
execute: async (args, framework) => {
|
|
407
|
+
const { title, message, source = 'file-system' } = args
|
|
408
|
+
try {
|
|
409
|
+
// 获取当前执行上下文中的 sessionId,只发送到当前会话
|
|
410
|
+
const ctx = framework.getExecutionContext()
|
|
411
|
+
const sessionId = ctx?.sessionId || null
|
|
412
|
+
|
|
413
|
+
framework.emit('notification', {
|
|
414
|
+
title,
|
|
415
|
+
message,
|
|
416
|
+
source,
|
|
417
|
+
sessionId,
|
|
418
|
+
timestamp: new Date().toISOString()
|
|
419
|
+
})
|
|
420
|
+
return { success: true, message: '通知已发送' }
|
|
421
|
+
} catch (error) {
|
|
422
|
+
return { success: false, error: error.message }
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
})
|
|
426
|
+
|
|
397
427
|
return this
|
|
398
428
|
}
|
|
399
429
|
}
|
|
@@ -203,7 +203,7 @@ class SchedulerPlugin extends Plugin {
|
|
|
203
203
|
return bTime - aTime
|
|
204
204
|
})
|
|
205
205
|
targetSessionId = sessions[0].id
|
|
206
|
-
console.log(`[Scheduler] Auto-detected active session: ${targetSessionId}`)
|
|
206
|
+
//console.log(`[Scheduler] Auto-detected active session: ${targetSessionId}`)
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
}
|
|
@@ -534,12 +534,12 @@ class SchedulerPlugin extends Plugin {
|
|
|
534
534
|
* 执行任务
|
|
535
535
|
*/
|
|
536
536
|
async _executeTask(task) {
|
|
537
|
-
console.log(`[Scheduler] Executing task: ${task.name} (${task.id})`)
|
|
538
|
-
console.log(`[Scheduler] Message: ${task.message}`)
|
|
539
|
-
if (task.sessionId) {
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
console.log(`[Scheduler] LLM mode: ${task.llm ? 'enabled' : 'disabled'}`)
|
|
537
|
+
// console.log(`[Scheduler] Executing task: ${task.name} (${task.id})`)
|
|
538
|
+
// console.log(`[Scheduler] Message: ${task.message}`)
|
|
539
|
+
// if (task.sessionId) {
|
|
540
|
+
// console.log(`[Scheduler] Target session: ${task.sessionId}`)
|
|
541
|
+
// }
|
|
542
|
+
// console.log(`[Scheduler] LLM mode: ${task.llm ? 'enabled' : 'disabled'}`)
|
|
543
543
|
|
|
544
544
|
task.lastRun = new Date()
|
|
545
545
|
task.runCount++
|
|
@@ -569,9 +569,9 @@ class SchedulerPlugin extends Plugin {
|
|
|
569
569
|
responseText = result.text
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
-
if (responseText) {
|
|
573
|
-
|
|
574
|
-
}
|
|
572
|
+
// if (responseText) {
|
|
573
|
+
// console.log(`\n🔔 [定时提醒] ${responseText}\n`)
|
|
574
|
+
// }
|
|
575
575
|
|
|
576
576
|
// 发送统一的通知事件
|
|
577
577
|
this._framework.emit('notification', {
|
|
@@ -584,7 +584,7 @@ class SchedulerPlugin extends Plugin {
|
|
|
584
584
|
})
|
|
585
585
|
} else {
|
|
586
586
|
// 直接显示模式:只显示提醒,不发 LLM
|
|
587
|
-
console.log(`\n🔔 [定时提醒] ${task.message}\n`)
|
|
587
|
+
//console.log(`\n🔔 [定时提醒] ${task.message}\n`)
|
|
588
588
|
|
|
589
589
|
// 发送统一的通知事件
|
|
590
590
|
this._framework.emit('notification', {
|