foliko 1.1.68 → 1.1.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/.claude/settings.local.json +19 -10
  2. package/.dockerignore +45 -45
  3. package/.env.example +56 -56
  4. package/CLAUDE.md +2 -2
  5. package/README.md +13 -13
  6. package/SPEC.md +3 -3
  7. package/cli/src/commands/chat.js +2 -20
  8. package/cli/src/commands/list.js +7 -6
  9. package/cli/src/commands/plugin.js +3 -2
  10. package/cli/src/daemon.js +2 -2
  11. package/cli/src/ui/chat-ui-old.js +15 -4
  12. package/cli/src/ui/chat-ui.js +152 -38
  13. package/cli/src/ui/footer-bar.js +13 -14
  14. package/cli/src/utils/config.js +29 -0
  15. package/cli/src/utils/plugin-config.js +1 -1
  16. package/docker-compose.yml +33 -33
  17. package/docs/features.md +120 -120
  18. package/docs/quick-reference.md +160 -160
  19. package/docs/user-manual.md +1391 -1391
  20. package/examples/ambient-example.js +2 -2
  21. package/examples/bootstrap.js +3 -3
  22. package/examples/test-chat.js +1 -1
  23. package/examples/test-reload.js +1 -1
  24. package/examples/test-telegram.js +1 -1
  25. package/examples/test-tg-bot.js +1 -1
  26. package/examples/test-tg-simple.js +2 -2
  27. package/examples/test-tg.js +1 -1
  28. package/examples/test-think.js +1 -1
  29. package/examples/test-weixin-feishu.js +3 -3
  30. package/package.json +3 -1
  31. package/plugins/ambient-agent/index.js +1 -1
  32. package/plugins/audit-plugin.js +75 -24
  33. package/plugins/default-plugins.js +21 -11
  34. package/plugins/email/index.js +1 -1
  35. package/plugins/extension-executor-plugin.js +85 -7
  36. package/plugins/feishu-plugin.js +118 -16
  37. package/plugins/install-plugin.js +4 -4
  38. package/plugins/memory-plugin.js +1 -1
  39. package/plugins/plugin-manager-plugin.js +3 -3
  40. package/plugins/python-executor-plugin.js +1 -1
  41. package/plugins/python-plugin-loader.js +1 -1
  42. package/plugins/qq-plugin.js +143 -16
  43. package/plugins/rules-plugin.js +1 -1
  44. package/plugins/scheduler-plugin.js +2 -2
  45. package/plugins/session-plugin.js +309 -393
  46. package/plugins/storage-plugin.js +235 -176
  47. package/plugins/subagent-plugin.js +4 -4
  48. package/plugins/telegram-plugin.js +116 -17
  49. package/plugins/think-plugin.js +1 -1
  50. package/plugins/web-plugin.js +2 -2
  51. package/plugins/weixin-plugin.js +102 -19
  52. package/skills/find-skills/AGENTS.md +2 -2
  53. package/skills/find-skills/SKILL.md +133 -133
  54. package/skills/foliko-dev/AGENTS.md +236 -236
  55. package/skills/foliko-dev/SKILL.md +19 -19
  56. package/skills/mcp-usage/SKILL.md +200 -200
  57. package/skills/plugin-guide/SKILL.md +4 -4
  58. package/skills/python-plugin-dev/SKILL.md +5 -5
  59. package/skills/skill-guide/SKILL.md +104 -6
  60. package/skills/subagent-guide/SKILL.md +237 -237
  61. package/skills/workflow-guide/SKILL.md +646 -646
  62. package/src/capabilities/skill-manager.js +101 -2
  63. package/src/capabilities/workflow-engine.js +1 -1
  64. package/src/core/agent-chat.js +17 -14
  65. package/src/core/branch-summary-auto.js +206 -0
  66. package/src/core/chat-session.js +38 -8
  67. package/src/core/command-registry.js +200 -0
  68. package/src/core/constants.js +11 -11
  69. package/src/core/context-compressor.js +700 -149
  70. package/src/core/context-manager.js +0 -1
  71. package/src/core/enhanced-context-compressor.js +210 -0
  72. package/src/core/framework.js +140 -83
  73. package/src/core/jsonl-storage.js +253 -0
  74. package/src/core/plugin-manager.js +15 -10
  75. package/src/core/provider-registry.js +159 -0
  76. package/src/core/provider.js +2 -0
  77. package/src/core/session-entry.js +225 -0
  78. package/src/core/session-manager.js +701 -0
  79. package/src/core/storage-manager.js +494 -0
  80. package/src/core/sub-agent-config.js +1 -1
  81. package/src/core/token-counter.js +177 -58
  82. package/src/core/ui-extension-context.js +174 -0
  83. package/src/executors/mcp-executor.js +15 -6
  84. package/src/utils/logger.js +152 -180
  85. package/src/utils/plugin-helpers.js +2 -2
  86. package/website_v2/docs/api.html +1 -1
  87. package/website_v2/docs/configuration.html +2 -2
  88. package/website_v2/docs/plugin-development.html +4 -4
  89. package/website_v2/docs/project-structure.html +2 -2
  90. package/website_v2/docs/skill-development.html +2 -2
  91. package/website_v2/index.html +1 -1
  92. package/website_v2/styles/animations.css +7 -7
  93. package/.agent/agents/backend-dev.md +0 -102
  94. package/.agent/agents/data-analyst.md +0 -117
  95. package/.agent/agents/devops.md +0 -115
  96. package/.agent/agents/frontend-dev.md +0 -94
  97. package/.agent/agents/network-requester.md +0 -44
  98. package/.agent/agents/poster-designer.md +0 -52
  99. package/.agent/agents/product-manager.md +0 -85
  100. package/.agent/agents/qa-engineer.md +0 -100
  101. package/.agent/agents/security-engineer.md +0 -99
  102. package/.agent/agents/team-lead.md +0 -137
  103. package/.agent/agents/ui-designer.md +0 -116
  104. package/.agent/data/default.json +0 -58
  105. package/.agent/data/email/processed-emails.json +0 -1
  106. package/.agent/data/plugins-state.json +0 -207
  107. package/.agent/data/scheduler/tasks.json +0 -1
  108. package/.agent/data/web/web-config.json +0 -5
  109. package/.agent/data/weixin/images/file_1776188148383jpg +0 -0
  110. package/.agent/data/weixin/images/file_1776188458326.jpg +0 -0
  111. package/.agent/data/weixin/images/file_1776188689423.jpg +0 -0
  112. package/.agent/data/weixin/images/file_1776188813604.jpg +0 -0
  113. package/.agent/data/weixin/images/file_1776189097450.jpg +0 -0
  114. package/.agent/data/weixin/videos/file_1776188318431.mp4 +0 -0
  115. package/.agent/data/weixin.json +0 -6
  116. package/.agent/mcp_config.json +0 -14
  117. package/.agent/memory/user/mof6gk94-kneeuh.md +0 -9
  118. package/.agent/package.json +0 -8
  119. package/.agent/plugins/marknative/README.md +0 -134
  120. package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
  121. package/.agent/plugins/marknative/fonts.zip +0 -0
  122. package/.agent/plugins/marknative/index.js +0 -256
  123. package/.agent/plugins/marknative/package.json +0 -12
  124. package/.agent/plugins/test-plugin.py +0 -99
  125. package/.agent/plugins.json +0 -14
  126. package/.agent/python-scripts/test_sample.py +0 -24
  127. package/.agent/sessions/cli_default.json +0 -4121
  128. package/.agent/skills/agent-browser/SKILL.md +0 -311
  129. package/.agent/skills/agent-browser/TEST_PLAN.md +0 -200
  130. package/.agent/skills/sysinfo/SKILL.md +0 -38
  131. package/.agent/skills/sysinfo/system-info.sh +0 -130
  132. package/.agent/skills/workflow/SKILL.md +0 -324
  133. package/.agent/test-agent.js +0 -35
  134. package/.agent/weixin.json +0 -6
  135. package/.agent/workflows/email-digest.json +0 -50
  136. package/.agent/workflows/file-backup.json +0 -21
  137. package/.agent/workflows/get-ip-notify.json +0 -32
  138. package/.agent/workflows/news-aggregator.json +0 -93
  139. package/.agent/workflows/news-dashboard-v2.json +0 -94
  140. package/.agent/workflows/notification-batch.json +0 -32
  141. package/src/core/session-context.js +0 -346
  142. package/src/core/session-storage.js +0 -295
@@ -24,7 +24,7 @@
24
24
  "Bash(cd D:/Code/vb-agent && node test-stream-emoji.js 2>&1)",
25
25
  "Read(//d/Date/20260321/app/**)",
26
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\")",
27
+ "Bash(node -e \"\nconst { loadAgentConfig } = require\\('./plugins/default-plugins'\\);\nconst config = loadAgentConfig\\('D:/Date/20260321/app/.foliko'\\);\nconsole.log\\('skillsDirs:', config.skillsDirs\\);\n\")",
28
28
  "Bash(cd D:/Code/vb-agent && pnpm install --shamefully-hoist 2>&1 | head -20)",
29
29
  "Bash(cd D:/Code/vb-agent && rm -rf node_modules && pnpm install)",
30
30
  "Bash(cd D:/Code/vb-agent && timeout 8 node test-tg.js 2>&1 || true)",
@@ -132,7 +132,7 @@
132
132
  "Bash(node -c plugins/proactive-agent-plugin.js && node -c plugins/default-plugins.js && echo \"All OK\")",
133
133
  "Bash(node examples/basic.js 2>&1 | head -50)",
134
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)",
135
+ "Bash(ls -la .foliko/data/ambient/ 2>/dev/null && cat .foliko/data/ambient/*.json 2>/dev/null | head -50)",
136
136
  "Bash(node examples/basic.js 2>&1 | head -30)",
137
137
  "Bash(node examples/bootstrap.js 2>&1 | head -40)",
138
138
  "Bash(node test-debug.js 2>&1)",
@@ -172,10 +172,10 @@
172
172
  "Bash(node -c D:/Code/vb-agent/src/utils/index.js && echo \"Syntax OK\")",
173
173
  "Bash(cd \"D:/Code/vb-agent\" && node -c src/core/agent-chat.js 2>&1)",
174
174
  "WebFetch(domain:ai-sdk.google.com)",
175
- "Bash(cd \"D:/Code/foliko/.agent/plugins\" && rm -rf poster-plugin && ln -s \"D:/Code/foliko-plugins/poster-plugin\" poster-plugin)",
176
- "Bash(cd \"D:/Code/foliko/.agent/plugins\" && rm -rf poster-plugin && cmd //c \"mklink /D poster-plugin D:\\\\\\\\Code\\\\\\\\foliko-plugins\\\\\\\\poster-plugin\" 2>&1 || echo \"Trying ln -s again\")",
177
- "Bash(cd \"D:/Code/foliko\" && node -e \"\nconst { Framework } = require\\('./src'\\);\nconst PythonPluginLoader = require\\('./plugins/python-plugin-loader'\\);\nconst ext = require\\('./plugins/extension-executor-plugin'\\);\nconst AIPlugin = require\\('./plugins/ai-plugin'\\);\n\nasync function test\\(\\) {\n const fw = new Framework\\(\\);\n await fw.loadPlugin\\(new ext\\(\\)\\);\n await fw.loadPlugin\\(new PythonPluginLoader\\({ agentDir: '.agent' }\\)\\);\n await fw.loadPlugin\\(new AIPlugin\\({ apiKey: 'test' }\\)\\);\n \n console.log\\('Extensions:', fw.pluginManager.get\\('extension-executor'\\)?._extensions?.keys\\(\\)\\);\n console.log\\('Python plugins:', fw.pluginManager.get\\('python-plugin-loader'\\)?._pythonPlugins?.keys\\(\\)\\);\n}\n\ntest\\(\\).catch\\(console.error\\);\n\" 2>&1 | head -20)",
178
- "Bash(cd \"D:/Code/foliko\" && node -e \"\nconst { Framework } = require\\('./src'\\);\nconst PythonPluginLoader = require\\('./plugins/python-plugin-loader'\\);\nconst ext = require\\('./plugins/extension-executor-plugin'\\);\nconst AIPlugin = require\\('./plugins/ai-plugin'\\);\n\nasync function test\\(\\) {\n const fw = new Framework\\(\\);\n await fw.loadPlugin\\(new ext\\(\\)\\);\n await fw.loadPlugin\\(new PythonPluginLoader\\({ agentDir: '.agent' }\\)\\);\n await fw.loadPlugin\\(new AIPlugin\\({ apiKey: 'test' }\\)\\);\n \n const executor = fw.pluginManager.get\\('extension-executor'\\);\n const extData = executor._extensions.get\\('python'\\);\n console.log\\('Python ext tools:', extData?.tools?.map\\(t => \\({ name: t.name, desc: t.description }\\)\\)\\);\n}\n\ntest\\(\\).catch\\(console.error\\);\n\" 2>&1 | grep -v \"^\\\\[2m\")",
175
+ "Bash(cd \"D:/Code/foliko/.foliko/plugins\" && rm -rf poster-plugin && ln -s \"D:/Code/foliko-plugins/poster-plugin\" poster-plugin)",
176
+ "Bash(cd \"D:/Code/foliko/.foliko/plugins\" && rm -rf poster-plugin && cmd //c \"mklink /D poster-plugin D:\\\\\\\\Code\\\\\\\\foliko-plugins\\\\\\\\poster-plugin\" 2>&1 || echo \"Trying ln -s again\")",
177
+ "Bash(cd \"D:/Code/foliko\" && node -e \"\nconst { Framework } = require\\('./src'\\);\nconst PythonPluginLoader = require\\('./plugins/python-plugin-loader'\\);\nconst ext = require\\('./plugins/extension-executor-plugin'\\);\nconst AIPlugin = require\\('./plugins/ai-plugin'\\);\n\nasync function test\\(\\) {\n const fw = new Framework\\(\\);\n await fw.loadPlugin\\(new ext\\(\\)\\);\n await fw.loadPlugin\\(new PythonPluginLoader\\({ agentDir: '.foliko' }\\)\\);\n await fw.loadPlugin\\(new AIPlugin\\({ apiKey: 'test' }\\)\\);\n \n console.log\\('Extensions:', fw.pluginManager.get\\('extension-executor'\\)?._extensions?.keys\\(\\)\\);\n console.log\\('Python plugins:', fw.pluginManager.get\\('python-plugin-loader'\\)?._pythonPlugins?.keys\\(\\)\\);\n}\n\ntest\\(\\).catch\\(console.error\\);\n\" 2>&1 | head -20)",
178
+ "Bash(cd \"D:/Code/foliko\" && node -e \"\nconst { Framework } = require\\('./src'\\);\nconst PythonPluginLoader = require\\('./plugins/python-plugin-loader'\\);\nconst ext = require\\('./plugins/extension-executor-plugin'\\);\nconst AIPlugin = require\\('./plugins/ai-plugin'\\);\n\nasync function test\\(\\) {\n const fw = new Framework\\(\\);\n await fw.loadPlugin\\(new ext\\(\\)\\);\n await fw.loadPlugin\\(new PythonPluginLoader\\({ agentDir: '.foliko' }\\)\\);\n await fw.loadPlugin\\(new AIPlugin\\({ apiKey: 'test' }\\)\\);\n \n const executor = fw.pluginManager.get\\('extension-executor'\\);\n const extData = executor._extensions.get\\('python'\\);\n console.log\\('Python ext tools:', extData?.tools?.map\\(t => \\({ name: t.name, desc: t.description }\\)\\)\\);\n}\n\ntest\\(\\).catch\\(console.error\\);\n\" 2>&1 | grep -v \"^\\\\[2m\")",
179
179
  "Bash(cd \"D:/Code/foliko\" && node test-python-ext.js 2>&1 | grep -v \"^\\\\[2m\")",
180
180
  "Bash(cd \"D:/Code/foliko\" && node -e \"require\\('./plugins/extension-executor-plugin'\\); console.log\\('OK'\\)\")",
181
181
  "Bash(cd D:/Code/foliko && timeout 8s node cli/bin/foliko.js chat 2>&1 || true)",
@@ -188,10 +188,10 @@
188
188
  "Bash(cd D:/code/vb-agent && node -e \"const { generateText, streamText } = require\\('ai'\\); console.log\\(typeof streamText\\)\" 2>&1)",
189
189
  "Bash(cd D:/code/vb-agent && node -e \"\nconst { createAI, createModel } = require\\('./src/core/provider'\\);\nconst { streamText } = require\\('ai'\\);\n\nconst aiProvider = createAI\\({\n provider: 'minimax',\n model: 'MiniMax-text-01',\n apiKey: process.env.MINIMAX_API_KEY || 'test',\n baseURL: 'https://api.minimaxi.com/v1',\n}\\);\nconst model = createModel\\('MiniMax-text-01', aiProvider\\);\n\nconst result = streamText\\({\n model,\n system: 'You are helpful',\n messages: [{ role: 'user', content: 'hi' }],\n}\\);\n\nconsole.log\\('baseStream type:', typeof result.baseStream\\);\nconsole.log\\('baseStream:', result.baseStream\\);\n\n// 尝试直接遍历\n\\(async \\(\\) => {\n try {\n for await \\(const chunk of result\\) {\n console.log\\('chunk:', chunk\\);\n }\n } catch \\(e\\) {\n console.error\\('error:', e.message\\);\n }\n}\\)\\(\\);\n\" 2>&1)",
190
190
  "Bash(cd D:/code/vb-agent && node -e \"\nrequire\\('dotenv'\\).config\\(\\);\nconsole.log\\('MINIMAX_API_KEY:', process.env.MINIMAX_API_KEY ? 'set \\(' + process.env.MINIMAX_API_KEY.substring\\(0, 10\\) + '...\\)' : 'NOT SET'\\);\nconsole.log\\('DEEPSEEK_API_KEY:', process.env.DEEPSEEK_API_KEY ? 'set \\(' + process.env.DEEPSEEK_API_KEY.substring\\(0, 10\\) + '...\\)' : 'NOT SET'\\);\n\" 2>&1)",
191
- "Bash(cd D:/code/vb-agent && node -e \"\nrequire\\('dotenv'\\).config\\(\\);\nconst { Framework } = require\\('./src/core/framework'\\);\n\n\\(async \\(\\) => {\n const framework = new Framework\\({ debug: false }\\);\n await framework.bootstrap\\({\n agentDir: 'D:/code/vb-agent/.agent',\n aiConfig: {\n provider: 'minimax',\n model: 'MiniMax-M2.7',\n baseURL: 'https://api.minimaxi.com/v1',\n apiKey: process.env.FOLIKO_API_KEY,\n },\n }\\);\n \n const agent = framework._mainAgent;\n console.log\\('Agent provider:', agent.provider\\);\n console.log\\('Agent apiKey:', agent.apiKey ? agent.apiKey.substring\\(0, 15\\) : 'undefined'\\);\n console.log\\('Agent baseURL:', agent.baseURL\\);\n process.exit\\(0\\);\n}\\)\\(\\);\n\" 2>&1)",
191
+ "Bash(cd D:/code/vb-agent && node -e \"\nrequire\\('dotenv'\\).config\\(\\);\nconst { Framework } = require\\('./src/core/framework'\\);\n\n\\(async \\(\\) => {\n const framework = new Framework\\({ debug: false }\\);\n await framework.bootstrap\\({\n agentDir: 'D:/code/vb-agent/.foliko',\n aiConfig: {\n provider: 'minimax',\n model: 'MiniMax-M2.7',\n baseURL: 'https://api.minimaxi.com/v1',\n apiKey: process.env.FOLIKO_API_KEY,\n },\n }\\);\n \n const agent = framework._mainAgent;\n console.log\\('Agent provider:', agent.provider\\);\n console.log\\('Agent apiKey:', agent.apiKey ? agent.apiKey.substring\\(0, 15\\) : 'undefined'\\);\n console.log\\('Agent baseURL:', agent.baseURL\\);\n process.exit\\(0\\);\n}\\)\\(\\);\n\" 2>&1)",
192
192
  "Bash(cd D:/code/vb-agent && node -e \"const ai = require\\('ai'\\); console.log\\(Object.keys\\(ai\\).filter\\(k => k.toLowerCase\\(\\).includes\\('tool'\\) || k.toLowerCase\\(\\).includes\\('loop'\\)\\)\\)\" 2>&1)",
193
- "Bash(cd D:/code/vb-agent && node -e \"\nrequire\\('dotenv'\\).config\\(\\);\nconst { Framework } = require\\('./src/core/framework'\\);\n\n\\(async \\(\\) => {\n const framework = new Framework\\({ debug: false }\\);\n await framework.bootstrap\\({\n agentDir: 'D:/code/vb-agent/.agent',\n aiConfig: {\n provider: 'minimax',\n model: 'MiniMax-M2.7',\n baseURL: 'https://api.minimaxi.com/v1',\n apiKey: process.env.FOLIKO_API_KEY,\n },\n }\\);\n \n const agent = framework._mainAgent;\n console.log\\('Testing chat...'\\);\n \n try {\n const result = await agent.chat\\('say hi in 3 words', {}\\);\n console.log\\('Result:', result.message?.substring\\(0, 50\\)\\);\n } catch \\(e\\) {\n console.error\\('Error:', e.message\\);\n }\n process.exit\\(0\\);\n}\\)\\(\\);\n\" 2>&1)",
194
- "Bash(cd D:/code/vb-agent && node -e \"\nrequire\\('dotenv'\\).config\\(\\);\nconst { Framework } = require\\('./src/core/framework'\\);\n\n\\(async \\(\\) => {\n const framework = new Framework\\({ debug: false }\\);\n await framework.bootstrap\\({\n agentDir: 'D:/code/vb-agent/.agent',\n aiConfig: {\n provider: 'minimax',\n model: 'MiniMax-M2.7',\n baseURL: 'https://api.minimaxi.com/v1',\n apiKey: process.env.FOLIKO_API_KEY,\n },\n }\\);\n \n const agent = framework._mainAgent;\n let full = '';\n try {\n for await \\(const chunk of agent.chatStream\\('say hi', {}\\)\\) {\n if \\(chunk.type === 'text'\\) {\n full += chunk.text;\n process.stdout.write\\(chunk.text\\);\n }\n }\n console.log\\('\\\\\\\\nFull:', full.length\\);\n } catch \\(e\\) {\n console.error\\('Error:', e.message\\);\n }\n process.exit\\(0\\);\n}\\)\\(\\);\n\" 2>&1)",
193
+ "Bash(cd D:/code/vb-agent && node -e \"\nrequire\\('dotenv'\\).config\\(\\);\nconst { Framework } = require\\('./src/core/framework'\\);\n\n\\(async \\(\\) => {\n const framework = new Framework\\({ debug: false }\\);\n await framework.bootstrap\\({\n agentDir: 'D:/code/vb-agent/.foliko',\n aiConfig: {\n provider: 'minimax',\n model: 'MiniMax-M2.7',\n baseURL: 'https://api.minimaxi.com/v1',\n apiKey: process.env.FOLIKO_API_KEY,\n },\n }\\);\n \n const agent = framework._mainAgent;\n console.log\\('Testing chat...'\\);\n \n try {\n const result = await agent.chat\\('say hi in 3 words', {}\\);\n console.log\\('Result:', result.message?.substring\\(0, 50\\)\\);\n } catch \\(e\\) {\n console.error\\('Error:', e.message\\);\n }\n process.exit\\(0\\);\n}\\)\\(\\);\n\" 2>&1)",
194
+ "Bash(cd D:/code/vb-agent && node -e \"\nrequire\\('dotenv'\\).config\\(\\);\nconst { Framework } = require\\('./src/core/framework'\\);\n\n\\(async \\(\\) => {\n const framework = new Framework\\({ debug: false }\\);\n await framework.bootstrap\\({\n agentDir: 'D:/code/vb-agent/.foliko',\n aiConfig: {\n provider: 'minimax',\n model: 'MiniMax-M2.7',\n baseURL: 'https://api.minimaxi.com/v1',\n apiKey: process.env.FOLIKO_API_KEY,\n },\n }\\);\n \n const agent = framework._mainAgent;\n let full = '';\n try {\n for await \\(const chunk of agent.chatStream\\('say hi', {}\\)\\) {\n if \\(chunk.type === 'text'\\) {\n full += chunk.text;\n process.stdout.write\\(chunk.text\\);\n }\n }\n console.log\\('\\\\\\\\nFull:', full.length\\);\n } catch \\(e\\) {\n console.error\\('Error:', e.message\\);\n }\n process.exit\\(0\\);\n}\\)\\(\\);\n\" 2>&1)",
195
195
  "Bash(node -e \"require\\('./src/core/chat-session.js'\\); require\\('./src/core/agent-chat.js'\\); console.log\\('OK'\\)\" 2>&1)",
196
196
  "Bash(node -e \"require\\('./src/core/chat-session.js'\\); console.log\\('OK'\\)\" 2>&1)",
197
197
  "Bash(node -e \"require\\('./cli/src/ui/chat-ui.js'\\); console.log\\('OK'\\)\" 2>&1)",
@@ -221,7 +221,16 @@
221
221
  "WebFetch(domain:github.com)",
222
222
  "Bash(node -e \"const { codeToANSI } = require\\('@shikijs/cli'\\); console.log\\(typeof codeToANSI\\)\")",
223
223
  "Bash(node -e ' *)",
224
- "Bash(node -e \"const hl = require\\('cli-highlight'\\); console.log\\(hl.highlight\\('const a = 1', { language: 'javascript', theme: 'nord' }\\)\\)\")"
224
+ "Bash(node -e \"const hl = require\\('cli-highlight'\\); console.log\\(hl.highlight\\('const a = 1', { language: 'javascript', theme: 'nord' }\\)\\)\")",
225
+ "Bash(node -e \"require\\('./src/core/session-entry.js'\\); require\\('./src/core/jsonl-storage.js'\\); require\\('./src/core/session-manager.js'\\); require\\('./src/core/token-counter.js'\\); require\\('./src/core/storage-manager.js'\\); require\\('./src/core/context-compressor.js'\\); console.log\\('All modules loaded successfully'\\)\")",
226
+ "Bash(node -e \"require\\('./plugins/session-plugin.js'\\); require\\('./plugins/storage-plugin.js'\\); console.log\\('Plugins loaded successfully'\\)\")",
227
+ "Bash(node -e \"require\\('./plugins/weixin-plugin.js'\\); console.log\\('weixin-plugin loaded'\\)\")",
228
+ "Bash(xargs grep *)",
229
+ "Bash(grep -r \"createLogger\\\\|pino\\\\|winston\\\\|console.log\" D:/date/20260516/pi/packages --include=\"*.ts\" ! -path \"*/node_modules/*\" ! -path \"*/test/*\")",
230
+ "Bash(grep -r \"logger\\\\.\" D:/date/20260516/pi/packages --include=\"*.ts\" ! -path \"*/node_modules/*\" ! -path \"*/test/*\")",
231
+ "Bash(grep *)",
232
+ "Bash(node -e \"require\\('./plugins/audit-plugin.js'\\); console.log\\('audit-plugin loaded'\\)\")",
233
+ "Bash(node -e \"const { createAI, DEFAULT_PROVIDERS } = require\\('./src/core/provider'\\); console.log\\('Providers:', Object.keys\\(DEFAULT_PROVIDERS\\)\\);\")"
225
234
  ]
226
235
  }
227
236
  }
package/.dockerignore CHANGED
@@ -1,45 +1,45 @@
1
- # 依赖
2
- node_modules
3
- .agent/node_modules
4
-
5
- # 日志
6
- *.log
7
- npm-debug.log*
8
-
9
- # 环境变量(包含敏感信息)
10
- .env
11
- .env.local
12
-
13
- # Git
14
- .git
15
- .gitignore
16
-
17
- # IDE
18
- .idea
19
- .vscode
20
- *.swp
21
- *.swo
22
-
23
- # 文档(可选保留)
24
- *.md
25
- !README.md
26
-
27
- # 测试
28
- test
29
- tests
30
- coverage
31
-
32
- # 临时文件
33
- tmp
34
- temp
35
- *.tmp
36
-
37
- # Docker 相关(避免递归)
38
- Dockerfile*
39
- docker-compose*
40
- .dockerignore
41
-
42
- # CI/CD
43
- .github
44
- .gitlab-ci.yml
45
- .travis.yml
1
+ # 依赖
2
+ node_modules
3
+ .foliko/node_modules
4
+
5
+ # 日志
6
+ *.log
7
+ npm-debug.log*
8
+
9
+ # 环境变量(包含敏感信息)
10
+ .env
11
+ .env.local
12
+
13
+ # Git
14
+ .git
15
+ .gitignore
16
+
17
+ # IDE
18
+ .idea
19
+ .vscode
20
+ *.swp
21
+ *.swo
22
+
23
+ # 文档(可选保留)
24
+ *.md
25
+ !README.md
26
+
27
+ # 测试
28
+ test
29
+ tests
30
+ coverage
31
+
32
+ # 临时文件
33
+ tmp
34
+ temp
35
+ *.tmp
36
+
37
+ # Docker 相关(避免递归)
38
+ Dockerfile*
39
+ docker-compose*
40
+ .dockerignore
41
+
42
+ # CI/CD
43
+ .github
44
+ .gitlab-ci.yml
45
+ .travis.yml
package/.env.example CHANGED
@@ -1,56 +1,56 @@
1
- # ========== AI Configuration ==========
2
- # 最大输出 tokens(影响 AI 回复长度)
3
- MAX_OUTPUT_TOKENS=8192
4
- # AI Provider: minimax, deepseek, openai, anthropic 等
5
- FOLIKO_PROVIDER=minimax
6
-
7
- # AI Model(如果未设置,使用 provider 默认值)
8
- # MiniMax: MiniMax-M2.7
9
- # DeepSeek: deepseek-chat, deepseek-coder 等
10
- FOLIKO_MODEL=MiniMax-M2.7
11
-
12
- # API Base URL(如果未设置,使用 provider 默认值)
13
- # MiniMax: https://api.minimaxi.com/v1
14
- # DeepSeek: https://api.deepseek.com/v1
15
- FOLIKO_BASE_URL=https://api.minimaxi.com/v1
16
-
17
- # API Key(通用,如果未设置则尝试 provider 专用 key)
18
- FOLIKO_API_KEY=sk-your-api-key
19
-
20
- # Provider 专用 API Key(可选,如果 FOLIKO_API_KEY 未设置则使用这些)
21
- DEEPSEEK_API_KEY=sk-your-deepseek-api-key
22
- MINIMAX_API_KEY=sk-your-minimax-api-key
23
-
24
- # ========== Email Configuration ==========
25
- # SMTP Settings (for sending emails)
26
- SMTP_HOST=smtp.gmail.com
27
- SMTP_PORT=587
28
- SMTP_SECURE=false
29
- SMTP_USER=your-email@gmail.com
30
- SMTP_PASS=your-app-password
31
-
32
- # IMAP Settings (for reading emails)
33
- IMAP_HOST=imap.gmail.com
34
- IMAP_PORT=993
35
- IMAP_USER=your-email@gmail.com
36
- IMAP_PASS=your-app-password
37
-
38
- # Default sender email address
39
- FROM_EMAIL=your-email@gmail.com
40
-
41
- # ========== Telegram Bot (optional) ==========
42
- TELEGRAM_BOT_TOKEN=your-telegram-bot-token
43
-
44
- # ========== Feishu Bot (optional) ==========
45
- FEISHU_APP_ID=cli_xxxxxxxxxxx
46
- FEISHU_APP_SECRET=app_secret
47
-
48
- # ========== Web Server (optional) ==========
49
- # Web 服务端口,默认 8088
50
- WEB_PORT=3000
51
-
52
- # Web 服务主机,默认 127.0.0.1
53
- WEB_HOST=127.0.0.1
54
-
55
- # 公网访问的 base URL(用于生成 webhook URL 等),不设置则使用 host:port,最好部署在docker中可以暴露自定义域名
56
- WEB_BASE_URL=https://your-domain.com
1
+ # ========== AI Configuration ==========
2
+ # 最大输出 tokens(影响 AI 回复长度)
3
+ MAX_OUTPUT_TOKENS=8192
4
+ # AI Provider: minimax, deepseek, openai, anthropic 等
5
+ FOLIKO_PROVIDER=minimax
6
+
7
+ # AI Model(如果未设置,使用 provider 默认值)
8
+ # MiniMax: MiniMax-M2.7
9
+ # DeepSeek: deepseek-chat, deepseek-coder 等
10
+ FOLIKO_MODEL=MiniMax-M2.7
11
+
12
+ # API Base URL(如果未设置,使用 provider 默认值)
13
+ # MiniMax: https://api.minimaxi.com/v1
14
+ # DeepSeek: https://api.deepseek.com/v1
15
+ FOLIKO_BASE_URL=https://api.minimaxi.com/v1
16
+
17
+ # API Key(通用,如果未设置则尝试 provider 专用 key)
18
+ FOLIKO_API_KEY=sk-your-api-key
19
+
20
+ # Provider 专用 API Key(可选,如果 FOLIKO_API_KEY 未设置则使用这些)
21
+ DEEPSEEK_API_KEY=sk-your-deepseek-api-key
22
+ MINIMAX_API_KEY=sk-your-minimax-api-key
23
+
24
+ # ========== Email Configuration ==========
25
+ # SMTP Settings (for sending emails)
26
+ SMTP_HOST=smtp.gmail.com
27
+ SMTP_PORT=587
28
+ SMTP_SECURE=false
29
+ SMTP_USER=your-email@gmail.com
30
+ SMTP_PASS=your-app-password
31
+
32
+ # IMAP Settings (for reading emails)
33
+ IMAP_HOST=imap.gmail.com
34
+ IMAP_PORT=993
35
+ IMAP_USER=your-email@gmail.com
36
+ IMAP_PASS=your-app-password
37
+
38
+ # Default sender email address
39
+ FROM_EMAIL=your-email@gmail.com
40
+
41
+ # ========== Telegram Bot (optional) ==========
42
+ TELEGRAM_BOT_TOKEN=your-telegram-bot-token
43
+
44
+ # ========== Feishu Bot (optional) ==========
45
+ FEISHU_APP_ID=cli_xxxxxxxxxxx
46
+ FEISHU_APP_SECRET=app_secret
47
+
48
+ # ========== Web Server (optional) ==========
49
+ # Web 服务端口,默认 8088
50
+ WEB_PORT=3000
51
+
52
+ # Web 服务主机,默认 127.0.0.1
53
+ WEB_HOST=127.0.0.1
54
+
55
+ # 公网访问的 base URL(用于生成 webhook URL 等),不设置则使用 host:port,最好部署在docker中可以暴露自定义域名
56
+ WEB_BASE_URL=https://your-domain.com
package/CLAUDE.md CHANGED
@@ -95,7 +95,7 @@ src/
95
95
 
96
96
  plugins/ # Built-in plugins (ai-plugin, tools-plugin, shell/python executors, session, scheduler, etc.)
97
97
  cli/bin/ # CLI entry point
98
- .agent/ # User configuration (plugins, skills, agents, mcp_config.json)
98
+ .foliko/ # User configuration (plugins, skills, agents, mcp_config.json)
99
99
  examples/ # Usage examples
100
100
  ```
101
101
 
@@ -115,7 +115,7 @@ Uses Vercel AI SDK (`ai` package) with support for multiple providers:
115
115
 
116
116
  - Anthropic, DeepSeek, MiniMax, OpenAI, OpenAI-Compatible
117
117
 
118
- Provider selection via `config.provider` and AI settings in `.agent/ai.json`.
118
+ Provider selection via `config.provider` and AI settings in `.foliko/ai.json`.
119
119
 
120
120
  ### Key Patterns
121
121
 
package/README.md CHANGED
@@ -195,10 +195,10 @@ WEB_BASE_URL=https://your-domain.com
195
195
 
196
196
  **配置优先级**:命令行参数 > .env配置 > provider默认值
197
197
 
198
- ### .agent 目录结构
198
+ ### .foliko 目录结构
199
199
 
200
200
  ```
201
- .agent/
201
+ .foliko/
202
202
  ├── config # 配置文件
203
203
  ├── ai.json # AI 配置
204
204
  ├── mcp_config.json # MCP 服务器配置
@@ -208,12 +208,12 @@ WEB_BASE_URL=https://your-domain.com
208
208
  └── data/ # 数据目录
209
209
  ```
210
210
 
211
- ### 子 Agent 配置 (.agent/agents/)
211
+ ### 子 Agent 配置 (.foliko/agents/)
212
212
 
213
- 在 `.agent/agents/` 目录下放置子 Agent 配置文件,支持 `.js`、`.json`、`.md` 格式:
213
+ 在 `.foliko/agents/` 目录下放置子 Agent 配置文件,支持 `.js`、`.json`、`.md` 格式:
214
214
 
215
215
  ```
216
- .agent/agents/
216
+ .foliko/agents/
217
217
  ├── backend-specialist.md
218
218
  ├── frontend-specialist.md
219
219
  └── database-architect.md
@@ -273,14 +273,14 @@ WEB_BASE_URL=https://your-domain.com
273
273
 
274
274
  ## 开发插件
275
275
 
276
- ### 用户插件(.agent/plugins/)
276
+ ### 用户插件(.foliko/plugins/)
277
277
 
278
278
  插件支持两种结构:**文件夹结构**(推荐)和**单文件结构**。
279
279
 
280
280
  #### 文件夹结构(推荐)
281
281
 
282
282
  ```
283
- .agent/plugins/my-plugin/
283
+ .foliko/plugins/my-plugin/
284
284
  ├── package.json # 可选,main 字段指定入口
285
285
  ├── index.js # 默认入口
286
286
  └── node_modules/ # 可选,插件私有依赖
@@ -295,7 +295,7 @@ WEB_BASE_URL=https://your-domain.com
295
295
  ```
296
296
 
297
297
  ```javascript
298
- // .agent/plugins/my-plugin/index.js
298
+ // .foliko/plugins/my-plugin/index.js
299
299
  module.exports = function (Plugin) {
300
300
  return class MyPlugin extends Plugin {
301
301
  constructor(config = {}) {
@@ -327,7 +327,7 @@ module.exports = function (Plugin) {
327
327
  #### 单文件结构(兼容)
328
328
 
329
329
  ```
330
- .agent/plugins/my-plugin.js
330
+ .foliko/plugins/my-plugin.js
331
331
  ```
332
332
 
333
333
  如果同时存在文件夹和同名 `.js` 文件,**文件夹优先**。
@@ -340,10 +340,10 @@ module.exports = function (Plugin) {
340
340
 
341
341
  ### 技能开发
342
342
 
343
- 在 `.agent/skills/` 下创建技能:
343
+ 在 `.foliko/skills/` 下创建技能:
344
344
 
345
345
  ```
346
- .agent/skills/my-skill/
346
+ .foliko/skills/my-skill/
347
347
  └── SKILL.md
348
348
  ```
349
349
 
@@ -433,8 +433,8 @@ allowed-tools: tool1,tool2
433
433
 
434
434
  CLI 工作目录默认使用执行命令的目录。
435
435
 
436
- - `.agent/` 目录会创建在工作目录下
437
- - 配置文件、插件、技能等都放在工作目录的 `.agent/` 下
436
+ - `.foliko/` 目录会创建在工作目录下
437
+ - 配置文件、插件、技能等都放在工作目录的 `.foliko/` 下
438
438
 
439
439
  ## 许可证
440
440
 
package/SPEC.md CHANGED
@@ -174,7 +174,7 @@ D:\code\foliko\
174
174
  │ ├── basic.js # 基础示例
175
175
  │ ├── bootstrap.js # Bootstrap示例
176
176
  │ └── workflow.js # 工作流示例
177
- ├── .agent/ # Agent 配置目录
177
+ ├── .foliko/ # Agent 配置目录
178
178
  │ ├── config # 配置文件
179
179
  │ ├── ai.json # AI 配置
180
180
  │ ├── plugins.json # 插件列表
@@ -188,7 +188,7 @@ D:\code\foliko\
188
188
 
189
189
  ### 4.5 插件配置持久化
190
190
 
191
- 插件状态和配置自动保存到 `.agent/data/plugins-state.json`
191
+ 插件状态和配置自动保存到 `.foliko/data/plugins-state.json`
192
192
 
193
193
  ```javascript
194
194
  // 更新插件配置
@@ -538,7 +538,7 @@ agent.chat('请重载 my-plugin 插件');
538
538
 
539
539
  **持久化**:
540
540
 
541
- - 任务自动保存到 `.agent/data/scheduler/tasks.json`
541
+ - 任务自动保存到 `.foliko/data/scheduler/tasks.json`
542
542
  - 重启后自动恢复 Cron 任务和未执行的一次性任务
543
543
 
544
544
  **通知**:
@@ -151,21 +151,9 @@ async function chatCommand(args) {
151
151
  // 初始化框架
152
152
  const framework = new Framework({ debug: false });
153
153
 
154
- // 保存原始 emit 函数,用于事件发送
155
- const emitLog = (...args) => framework.emit('console:log', args);
156
- const emitWarn = (...args) => framework.emit('console:warn', args);
157
- const emitInfo = (...args) => framework.emit('console:info', args);
158
- const emitDebug = (...args) => framework.emit('console:debug', args);
159
- const emitError = (...args) => framework.emit('console:error', args);
160
-
161
- console.log = emitLog;
162
- console.warn = emitWarn;
163
- console.info = emitInfo;
164
- console.debug = emitDebug;
165
- console.error = emitError;
166
- //framework.logger.setSilent(true);
154
+
167
155
  await framework.bootstrap({
168
- agentDir: process.cwd() + '/.agent',
156
+ agentDir: process.cwd() + '/.foliko',
169
157
  aiConfig: {
170
158
  provider: options.provider,
171
159
  model: options.model,
@@ -203,12 +191,6 @@ async function chatCommand(args) {
203
191
  - 例如:npx skills add xxx 应该执行为 npx skills add xxx -a openclaw -y`);
204
192
 
205
193
  // 静默模式:抑制控制台打印,但保持事件发送(让 ChatUI 能收到日志显示到 tooler)
206
- if (options.quiet) {
207
- // 保持事件发送,只是不打印到原始控制台
208
- console.log = emitLog;
209
- console.warn = emitWarn;
210
- console.info = emitInfo;
211
- }
212
194
 
213
195
  // 持续测试模式
214
196
  if (options.continuous) {
@@ -5,16 +5,17 @@
5
5
 
6
6
  const fs = require('fs');
7
7
  const path = require('path');
8
+ const { AGENT_DIR_NAME } = require('../utils/config');
8
9
 
9
10
  /**
10
- * 列出 .agent/agents 目录下的所有 Agent 配置
11
+ * 列出 .foliko/agents 目录下的所有 Agent 配置
11
12
  */
12
13
  async function listCommand() {
13
- const agentsDir = path.resolve(process.cwd(), '.agent', 'agents');
14
+ const agentsDir = path.resolve(process.cwd(), AGENT_DIR_NAME, 'agents');
14
15
 
15
16
  if (!fs.existsSync(agentsDir)) {
16
- console.log('No .agent/agents directory found.');
17
- console.log('Create agents by adding files to: .agent/agents/');
17
+ console.log('No .foliko/agents directory found.');
18
+ console.log('Create agents by adding files to: .foliko/agents/');
18
19
  return;
19
20
  }
20
21
 
@@ -72,11 +73,11 @@ async function listCommand() {
72
73
  }
73
74
 
74
75
  if (agents.length === 0) {
75
- console.log('No agents found in .agent/agents/');
76
+ console.log('No agents found in .foliko/agents/');
76
77
  return;
77
78
  }
78
79
 
79
- console.log(`\nFound ${agents.length} agent(s) in .agent/agents/:\n`);
80
+ console.log(`\nFound ${agents.length} agent(s) in .foliko/agents/:\n`);
80
81
  console.log('Name Role Description');
81
82
  console.log('---------------- ------------------ ------------------------------------------');
82
83
 
@@ -9,6 +9,7 @@ const { execSync } = require('child_process');
9
9
  const https = require('https');
10
10
  const http = require('http');
11
11
  const { DEFAULT_REPO, shouldIgnore } = require('../utils/plugin-config');
12
+ const { AGENT_DIR_NAME } = require('../utils/config');
12
13
 
13
14
  /**
14
15
  * 递归复制目录(带过滤)
@@ -109,8 +110,8 @@ function downloadFile(url, dest) {
109
110
  * 发布插件到 Git
110
111
  */
111
112
  async function publishCommand(pluginName, options) {
112
- // 支持 .agent/plugins 和 plugins 两个目录
113
- const agentPluginsDir = path.resolve(process.cwd(), '.agent', 'plugins');
113
+ // 支持 .foliko/plugins 和 plugins 两个目录
114
+ const agentPluginsDir = path.resolve(process.cwd(), AGENT_DIR_NAME, 'plugins');
114
115
  const localPluginsDir = path.resolve(process.cwd(), 'plugins');
115
116
  const pluginsDir = fs.existsSync(agentPluginsDir) ? agentPluginsDir : localPluginsDir;
116
117
  const pluginPath = path.join(pluginsDir, `${pluginName}.js`);
package/cli/src/daemon.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Foliko 后台服务入口
3
- * 使用 framework.bootstrap() 自动加载 .agent/ 目录配置
3
+ * 使用 framework.bootstrap() 自动加载 .foliko/ 目录配置
4
4
  * 持续运行,不退出
5
5
  */
6
6
 
@@ -118,7 +118,7 @@ async function main(args = process.argv.slice(2)) {
118
118
 
119
119
  // 使用 bootstrap 自动加载所有默认插件
120
120
  await framework.bootstrap({
121
- agentDir: './.agent',
121
+ agentDir: './.foliko',
122
122
  aiConfig: {
123
123
  provider: options.provider,
124
124
  model: options.model,
@@ -156,6 +156,9 @@ class ChatUI {
156
156
  if (input.toLowerCase() === '/clean' || input.toLowerCase() === '/clear') {
157
157
  const { sessionId } = this;
158
158
  // 清除 AgentChatHandler 的消息存储(需要传 sessionId)
159
+ if (this.agent._chatSession) {
160
+ this.agent._chatSession.clearSessionMessages(sessionId, true);
161
+ }
159
162
  if (this.agent._chatHandler) {
160
163
  this.agent._chatHandler.clearHistory(sessionId);
161
164
  }
@@ -164,15 +167,23 @@ class ChatUI {
164
167
  const sessionCtx = this.agent.framework.getSessionContext(sessionId);
165
168
  if (sessionCtx) {
166
169
  sessionCtx.clearMessages();
167
- sessionCtx.compressionState.count = 0;
168
- sessionCtx.metadata.compressionCount = 0;
170
+ if (sessionCtx.compressionState) {
171
+ sessionCtx.compressionState.count = 0;
172
+ }
173
+ if (sessionCtx.metadata) {
174
+ sessionCtx.metadata.compressionCount = 0;
175
+ }
169
176
  }
170
177
  // 同步清除 framework 缓存的 sessionContexts
171
178
  const cachedCtx = this.agent.framework._sessionContexts?.get(sessionId);
172
179
  if (cachedCtx) {
173
180
  cachedCtx.clearMessages();
174
- cachedCtx.compressionState.count = 0;
175
- cachedCtx.metadata.compressionCount = 0;
181
+ if (cachedCtx.compressionState) {
182
+ cachedCtx.compressionState.count = 0;
183
+ }
184
+ if (cachedCtx.metadata) {
185
+ cachedCtx.metadata.compressionCount = 0;
186
+ }
176
187
  }
177
188
  }
178
189
  console.log(`${colored('[提示]', CYAN)} 对话上下文已清除\n`);