foliko 1.0.53 → 1.0.54
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 +141 -131
- package/CLAUDE.md +106 -0
- package/Dockerfile +2 -2
- package/cli/src/index.js +6 -3
- package/cli/src/ui/chat-ui.js +1 -1
- package/examples/ambient-example.js +196 -0
- package/package.json +1 -1
- package/plugins/ambient-agent-plugin.js +1097 -0
- package/plugins/default-plugins.js +38 -32
- package/plugins/email.js +304 -5
- package/plugins/file-system-plugin.js +57 -1
- package/plugins/python-executor-plugin.js +1 -1
- package/plugins/python-plugin-loader.js +2 -2
- package/plugins/subagent-plugin.js +25 -25
- package/src/capabilities/skill-manager.js +230 -2
- package/src/core/agent.js +19 -14
- package/src/core/plugin-manager.js +2 -2
- package/src/core/provider.js +0 -1
|
@@ -1,131 +1,141 @@
|
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
**Foliko** is a minimalist plugin-based Agent framework in pure JavaScript (no TypeScript). It provides a lightweight core with extensible plugins for AI conversation, tool execution, workflow automation, and more.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Run basic example
|
|
13
|
+
npm start
|
|
14
|
+
|
|
15
|
+
# CLI chat mode
|
|
16
|
+
npm run chat
|
|
17
|
+
|
|
18
|
+
# Proactive agent examples
|
|
19
|
+
npm run proactive
|
|
20
|
+
npm run proactive:advanced
|
|
21
|
+
|
|
22
|
+
# No test suite yet
|
|
23
|
+
npm test
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Architecture
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
┌─────────────────────────────────────────────────┐
|
|
30
|
+
│ Foliko Framework │
|
|
31
|
+
├─────────────────────────────────────────────────┤
|
|
32
|
+
│ Framework (Container Layer) │
|
|
33
|
+
│ ├── pluginManager - Plugin lifecycle │
|
|
34
|
+
│ ├── toolRegistry - Tool registration │
|
|
35
|
+
│ ├── skillManager - Skill management │
|
|
36
|
+
│ └── eventEmitter - Event bus │
|
|
37
|
+
├─────────────────────────────────────────────────┤
|
|
38
|
+
│ Agent (Dialogue Layer) │
|
|
39
|
+
│ ├── chat() - Send messages │
|
|
40
|
+
│ ├── chatStream() - Streaming responses │
|
|
41
|
+
│ ├── tools - From Framework │
|
|
42
|
+
│ └── events - Message/tool events │
|
|
43
|
+
└─────────────────────────────────────────────────┘
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Core Classes
|
|
47
|
+
|
|
48
|
+
- **Framework** (`src/core/framework.js`) - Container managing plugins, tools, events, and agent creation
|
|
49
|
+
- **Agent** (`src/core/agent.js`) - Handles conversation, tool calls, subAgent delegation, and message queuing
|
|
50
|
+
- **Plugin** (`src/core/plugin-base.js`) - Base class with `install()`, `start()`, `reload()`, `uninstall()` lifecycle
|
|
51
|
+
- **PluginManager** (`src/core/plugin-manager.js`) - Manages plugin loading, priority ordering, and hot reload
|
|
52
|
+
- **ToolRegistry** (`src/core/tool-registry.js`) - Registers and executes tools with Zod schemas
|
|
53
|
+
- **AgentChatHandler** (`src/core/agent-chat.js`) - Handles AI provider communication and tool call loops
|
|
54
|
+
|
|
55
|
+
### Directory Structure
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
src/
|
|
59
|
+
├── core/ # Framework, Agent, PluginManager, ToolRegistry
|
|
60
|
+
├── capabilities/ # SkillManager, WorkflowEngine
|
|
61
|
+
├── executors/ # MCPExecutor for MCP server integration
|
|
62
|
+
└── utils/ # EventEmitter
|
|
63
|
+
|
|
64
|
+
plugins/ # Built-in plugins (ai-plugin, tools-plugin, shell/python executors, session, scheduler, etc.)
|
|
65
|
+
cli/bin/ # CLI entry point
|
|
66
|
+
.agent/ # User configuration (plugins, skills, agents, mcp_config.json)
|
|
67
|
+
examples/ # Usage examples
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Plugin System
|
|
71
|
+
|
|
72
|
+
Plugins are registered via `framework.registerPlugin()` and loaded with `framework.loadPlugin()`. Each plugin:
|
|
73
|
+
- Has a `name`, `version`, `description`, and `priority`
|
|
74
|
+
- Implements `install(framework)` to register tools/events
|
|
75
|
+
- Implements `start(framework)` after initialization
|
|
76
|
+
- Can implement `reload(framework)` for hot reload
|
|
77
|
+
- Can implement `uninstall(framework)` for cleanup
|
|
78
|
+
|
|
79
|
+
### AI Integration
|
|
80
|
+
|
|
81
|
+
Uses Vercel AI SDK (`ai` package) with support for multiple providers:
|
|
82
|
+
- Anthropic, DeepSeek, MiniMax, OpenAI, OpenAI-Compatible
|
|
83
|
+
|
|
84
|
+
Provider selection via `config.provider` and AI settings in `.agent/ai.json`.
|
|
85
|
+
|
|
86
|
+
### Key Patterns
|
|
87
|
+
|
|
88
|
+
1. **Context Isolation**: `framework.runWithContext(context, fn)` uses AsyncLocalStorage for true context isolation
|
|
89
|
+
2. **Tool Execution**: Tools receive `(args, framework)` and return results; errors should be caught and returned as `{error: message}`
|
|
90
|
+
3. **Event System**: Framework emits events like `framework:ready`, `plugin:loaded`, `agent:message`, `tool-call`
|
|
91
|
+
4. **Hot Reload**: Manual only via `framework.reloadPlugin(name)` or `framework.reloadAllPlugins()` - no file watching
|
|
92
|
+
|
|
93
|
+
### Built-in Plugins
|
|
94
|
+
|
|
95
|
+
- **ai-plugin** - AI conversation via Vercel AI SDK
|
|
96
|
+
- **tools-plugin** - Plugin management tools (list, reload, enable/disable)
|
|
97
|
+
- **shell-executor-plugin** - Shell command execution
|
|
98
|
+
- **python-executor-plugin** - Python code/script execution
|
|
99
|
+
- **session-plugin** - Multi-session management
|
|
100
|
+
- **scheduler-plugin** - Cron-based task scheduling
|
|
101
|
+
- **subagent-plugin** - Child agent isolation
|
|
102
|
+
- **email.js** - SMTP/IMAP email
|
|
103
|
+
- **telegram-plugin.js** - Telegram bot integration
|
|
104
|
+
- **audit-plugin.js** - Operation logging
|
|
105
|
+
- **rules-plugin.js** - Permission/content rules
|
|
106
|
+
- **storage-plugin.js** - Key-value persistence
|
package/Dockerfile
CHANGED
|
@@ -49,7 +49,7 @@ ENV PATH="/root/.local/bin:$PATH"
|
|
|
49
49
|
WORKDIR /app
|
|
50
50
|
|
|
51
51
|
# 全局安装 foliko CLI
|
|
52
|
-
RUN npm install -g foliko
|
|
52
|
+
# RUN npm install -g foliko
|
|
53
53
|
|
|
54
54
|
# 暴露端口
|
|
55
55
|
# 3000: Web 服务端口
|
|
@@ -60,4 +60,4 @@ ENV NODE_ENV=production
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
# 默认命令:运行聊天界面
|
|
63
|
-
CMD ["foliko", "chat"]
|
|
63
|
+
# CMD ["foliko", "chat"]
|
package/cli/src/index.js
CHANGED
|
@@ -4,14 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
const { chatCommand } = require('./commands/chat')
|
|
6
6
|
const { listCommand } = require('./commands/list')
|
|
7
|
-
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
8
9
|
/**
|
|
9
10
|
* CLI 主入口
|
|
10
11
|
*/
|
|
11
12
|
async function cli() {
|
|
12
13
|
const args = process.argv.slice(2)
|
|
13
14
|
const command = args[0] || 'chat'
|
|
14
|
-
|
|
15
|
+
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
16
|
+
|
|
15
17
|
switch (command) {
|
|
16
18
|
case 'chat':
|
|
17
19
|
await chatCommand(args.slice(1))
|
|
@@ -31,7 +33,8 @@ async function cli() {
|
|
|
31
33
|
case 'version':
|
|
32
34
|
case '--version':
|
|
33
35
|
case '-v':
|
|
34
|
-
|
|
36
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
37
|
+
console.log(`${packageJson.name} v${packageJson.version}`)
|
|
35
38
|
break
|
|
36
39
|
|
|
37
40
|
default:
|
package/cli/src/ui/chat-ui.js
CHANGED
|
@@ -147,7 +147,7 @@ class ChatUI {
|
|
|
147
147
|
const renderState = { inThink: false, inCodeBlock: false }
|
|
148
148
|
|
|
149
149
|
console.log(colored('● ', GREEN))
|
|
150
|
-
console.log()
|
|
150
|
+
// console.log()
|
|
151
151
|
|
|
152
152
|
const runWithContext = this.agent.framework?.runWithContext.bind(this.agent.framework)
|
|
153
153
|
const { sessionId } = this
|