mindbot 0.3.2__tar.gz → 0.3.4__tar.gz

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 (194) hide show
  1. mindbot-0.3.4/.gitignore +66 -0
  2. mindbot-0.3.4/PKG-INFO +417 -0
  3. mindbot-0.3.4/README.md +382 -0
  4. mindbot-0.3.4/benchmark/real-tools/README.md +185 -0
  5. {mindbot-0.3.2 → mindbot-0.3.4}/pyproject.toml +33 -8
  6. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/__init__.py +1 -1
  7. mindbot-0.3.4/src/mindbot/acp/__init__.py +12 -0
  8. mindbot-0.3.4/src/mindbot/acp/channel.py +115 -0
  9. mindbot-0.3.4/src/mindbot/acp/client.py +250 -0
  10. mindbot-0.3.4/src/mindbot/acp/config.py +63 -0
  11. mindbot-0.3.4/src/mindbot/acp/permission.py +77 -0
  12. mindbot-0.3.4/src/mindbot/acp/protocol.py +210 -0
  13. mindbot-0.3.4/src/mindbot/acp/session.py +152 -0
  14. mindbot-0.3.4/src/mindbot/acp/transport.py +127 -0
  15. mindbot-0.3.4/src/mindbot/acp/types.py +425 -0
  16. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/agent.py +1 -1
  17. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/approval.py +1 -2
  18. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/core.py +1 -1
  19. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/input_builder.py +5 -5
  20. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/models.py +1 -2
  21. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/orchestrator.py +1 -3
  22. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/streaming.py +1 -2
  23. mindbot-0.3.4/src/mindbot/auth/__init__.py +5 -0
  24. mindbot-0.3.4/src/mindbot/auth/manager.py +107 -0
  25. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/benchmarking/real_tools.py +0 -1
  26. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/bot.py +0 -4
  27. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/builders/agent_builder.py +1 -1
  28. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/backends/tool_backend.py +0 -1
  29. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/registry.py +0 -1
  30. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/channels/manager.py +55 -1
  31. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/cli/__init__.py +176 -17
  32. mindbot-0.3.4/src/mindbot/cli/config_cmd.py +345 -0
  33. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/config/__init__.py +9 -0
  34. mindbot-0.3.4/src/mindbot/config/bus.py +74 -0
  35. mindbot-0.3.4/src/mindbot/config/integration.py +128 -0
  36. mindbot-0.3.4/src/mindbot/config/persistence.py +107 -0
  37. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/config/schema.py +64 -1
  38. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/config/store.py +1 -1
  39. mindbot-0.3.4/src/mindbot/config/sync.py +115 -0
  40. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/context/manager.py +1 -4
  41. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/registry.py +0 -1
  42. mindbot-0.3.4/src/mindbot/memory/__init__.py +79 -0
  43. mindbot-0.3.4/src/mindbot/memory/embedder/__init__.py +9 -0
  44. mindbot-0.3.4/src/mindbot/memory/embedder/base.py +44 -0
  45. mindbot-0.3.4/src/mindbot/memory/embedder/openai_embedder.py +66 -0
  46. mindbot-0.3.4/src/mindbot/memory/lifecycle/__init__.py +14 -0
  47. mindbot-0.3.4/src/mindbot/memory/lifecycle/forgetter.py +236 -0
  48. mindbot-0.3.4/src/mindbot/memory/lifecycle/promoter.py +181 -0
  49. mindbot-0.3.4/src/mindbot/memory/lifecycle/summarizer.py +118 -0
  50. mindbot-0.3.4/src/mindbot/memory/lifecycle/updater.py +281 -0
  51. mindbot-0.3.4/src/mindbot/memory/manager.py +768 -0
  52. mindbot-0.3.4/src/mindbot/memory/migration/__init__.py +25 -0
  53. mindbot-0.3.4/src/mindbot/memory/migration/exporter.py +206 -0
  54. mindbot-0.3.4/src/mindbot/memory/migration/importer.py +259 -0
  55. mindbot-0.3.4/src/mindbot/memory/migration/legacy_migrator.py +226 -0
  56. mindbot-0.3.4/src/mindbot/memory/migration/package.py +303 -0
  57. mindbot-0.3.4/src/mindbot/memory/retrieval/__init__.py +5 -0
  58. mindbot-0.3.4/src/mindbot/memory/retrieval/searcher.py +192 -0
  59. mindbot-0.3.4/src/mindbot/memory/storage/__init__.py +15 -0
  60. mindbot-0.3.4/src/mindbot/memory/storage/content_store.py +403 -0
  61. mindbot-0.3.4/src/mindbot/memory/storage/index_store.py +482 -0
  62. mindbot-0.3.4/src/mindbot/memory/storage/lance_store.py +243 -0
  63. mindbot-0.3.4/src/mindbot/memory/storage/vector_store.py +61 -0
  64. mindbot-0.3.4/src/mindbot/memory/types/__init__.py +39 -0
  65. mindbot-0.3.4/src/mindbot/memory/types/chunk.py +83 -0
  66. mindbot-0.3.4/src/mindbot/memory/types/cluster.py +99 -0
  67. mindbot-0.3.4/src/mindbot/memory/types/enums.py +51 -0
  68. mindbot-0.3.4/src/mindbot/memory/types/forget.py +40 -0
  69. mindbot-0.3.4/src/mindbot/memory/types/index.py +136 -0
  70. mindbot-0.3.4/src/mindbot/memory/types/profile.py +95 -0
  71. mindbot-0.3.4/src/mindbot/memory/types/shard.py +83 -0
  72. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/multimodal/processor.py +1 -1
  73. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/adapter.py +0 -1
  74. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/ollama/provider.py +32 -16
  75. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/routing/adapter.py +15 -1
  76. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/routing/endpoint.py +1 -1
  77. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/routing/router.py +1 -1
  78. mindbot-0.3.4/src/mindbot/skills/builtin_config.py +261 -0
  79. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/templates/settings.example.json +50 -5
  80. mindbot-0.3.4/src/mindbot/tools/dgcu_web.py +374 -0
  81. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/tools/file_ops.py +0 -1
  82. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/utils/ollama_setup.py +43 -2
  83. mindbot-0.3.4/webchat/README.md +74 -0
  84. mindbot-0.3.2/PKG-INFO +0 -770
  85. mindbot-0.3.2/README.md +0 -742
  86. mindbot-0.3.2/setup.cfg +0 -4
  87. mindbot-0.3.2/src/mindbot/memory/__init__.py +0 -7
  88. mindbot-0.3.2/src/mindbot/memory/manager.py +0 -110
  89. mindbot-0.3.2/src/mindbot.egg-info/PKG-INFO +0 -770
  90. mindbot-0.3.2/src/mindbot.egg-info/SOURCES.txt +0 -139
  91. mindbot-0.3.2/src/mindbot.egg-info/dependency_links.txt +0 -1
  92. mindbot-0.3.2/src/mindbot.egg-info/entry_points.txt +0 -2
  93. mindbot-0.3.2/src/mindbot.egg-info/requires.txt +0 -10
  94. mindbot-0.3.2/src/mindbot.egg-info/top_level.txt +0 -1
  95. {mindbot-0.3.2 → mindbot-0.3.4}/LICENSE +0 -0
  96. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/__main__.py +0 -0
  97. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/__init__.py +0 -0
  98. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/input.py +0 -0
  99. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/interrupt.py +0 -0
  100. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/multi_agent.py +0 -0
  101. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/persistence_writer.py +0 -0
  102. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/scheduler.py +0 -0
  103. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/agent/turn_engine.py +0 -0
  104. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/benchmarking/__init__.py +0 -0
  105. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/benchmarking/toolcall15_adapter.py +0 -0
  106. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/builders/__init__.py +0 -0
  107. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/builders/llm_builder.py +0 -0
  108. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/builders/model_ref.py +0 -0
  109. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/builders/tool_builder.py +0 -0
  110. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/bus/__init__.py +0 -0
  111. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/bus/events.py +0 -0
  112. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/bus/outbound.py +0 -0
  113. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/bus/queue.py +0 -0
  114. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/__init__.py +0 -0
  115. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/backends/__init__.py +0 -0
  116. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/backends/base.py +0 -0
  117. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/backends/tooling/__init__.py +0 -0
  118. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/backends/tooling/executor.py +0 -0
  119. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/backends/tooling/meta_tool.py +0 -0
  120. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/backends/tooling/models.py +0 -0
  121. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/backends/tooling/registry.py +0 -0
  122. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/executor.py +0 -0
  123. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/facade.py +0 -0
  124. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/capability/models.py +0 -0
  125. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/channels/__init__.py +0 -0
  126. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/channels/base.py +0 -0
  127. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/channels/cli.py +0 -0
  128. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/channels/feishu.py +0 -0
  129. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/channels/http.py +0 -0
  130. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/config/approval.py +0 -0
  131. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/config/env_subst.py +0 -0
  132. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/config/loader.py +0 -0
  133. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/config/vision.py +0 -0
  134. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/config/watcher.py +0 -0
  135. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/context/__init__.py +0 -0
  136. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/context/archiver.py +0 -0
  137. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/context/checkpoint.py +0 -0
  138. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/context/compression.py +0 -0
  139. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/context/extraction.py +0 -0
  140. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/context/models.py +0 -0
  141. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/cron/__init__.py +0 -0
  142. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/cron/service.py +0 -0
  143. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/cron/types.py +0 -0
  144. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/__init__.py +0 -0
  145. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/dynamic_manager.py +0 -0
  146. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/events.py +0 -0
  147. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/executor.py +0 -0
  148. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/models.py +0 -0
  149. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/protocols.py +0 -0
  150. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/system_prompt_builder.py +0 -0
  151. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/tool_generator.py +0 -0
  152. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/generation/validator.py +0 -0
  153. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/memory/compaction.py +0 -0
  154. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/memory/indexer.py +0 -0
  155. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/memory/markdown.py +0 -0
  156. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/memory/searcher.py +0 -0
  157. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/memory/storage.py +0 -0
  158. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/memory/types.py +0 -0
  159. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/multimodal/__init__.py +0 -0
  160. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/multimodal/models.py +0 -0
  161. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/__init__.py +0 -0
  162. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/base.py +0 -0
  163. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/factory.py +0 -0
  164. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/ollama/__init__.py +0 -0
  165. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/ollama/param.py +0 -0
  166. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/openai/__init__.py +0 -0
  167. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/openai/param.py +0 -0
  168. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/openai/provider.py +0 -0
  169. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/param.py +0 -0
  170. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/transformers/__init__.py +0 -0
  171. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/transformers/param.py +0 -0
  172. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/providers/transformers/provider.py +0 -0
  173. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/routing/__init__.py +0 -0
  174. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/routing/models.py +0 -0
  175. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/session/__init__.py +0 -0
  176. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/session/store.py +0 -0
  177. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/session/types.py +0 -0
  178. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/skills/__init__.py +0 -0
  179. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/skills/loader.py +0 -0
  180. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/skills/models.py +0 -0
  181. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/skills/registry.py +0 -0
  182. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/skills/render.py +0 -0
  183. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/skills/selector.py +0 -0
  184. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/templates/SYSTEM.md +0 -0
  185. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/templates/skills/mindbot-runtime-inspection/SKILL.md +0 -0
  186. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/templates/skills/mindbot-self-knowledge/SKILL.md +0 -0
  187. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/templates/skills/system-basic-info/SKILL.md +0 -0
  188. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/tools/__init__.py +0 -0
  189. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/tools/builtin.py +0 -0
  190. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/tools/mindbot_ops.py +0 -0
  191. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/tools/path_policy.py +0 -0
  192. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/tools/shell_ops.py +0 -0
  193. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/tools/web_ops.py +0 -0
  194. {mindbot-0.3.2 → mindbot-0.3.4}/src/mindbot/utils/__init__.py +0 -0
@@ -0,0 +1,66 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ *.egg-info/
8
+ .eggs/
9
+ *.egg
10
+
11
+ # 虚拟环境
12
+ venv/
13
+ env/
14
+ ENV/
15
+ .venv/
16
+
17
+ # 依赖
18
+ node_modules/
19
+ .pnpm-store/
20
+
21
+ # 构建输出
22
+ build/
23
+ dist/
24
+ *.tsbuildinfo
25
+ site/
26
+
27
+ # 环境变量
28
+ .env
29
+ .env.local
30
+ .env.*.local
31
+
32
+ # IDE
33
+ .idea/
34
+ .vscode/
35
+ *.swp
36
+ *.swo
37
+
38
+ # 系统文件
39
+ .DS_Store
40
+
41
+ # 日志
42
+ *.log
43
+ logs/
44
+
45
+ # 开发计划
46
+ plan/
47
+
48
+ # 测试覆盖率
49
+ coverage/
50
+
51
+ # 测试文件
52
+
53
+ # AI 助手配置
54
+ /.agent
55
+ /.claude
56
+ /.cursor
57
+ /.gemini
58
+ /.trae
59
+ /.iflow
60
+ /.specify
61
+ /specs
62
+
63
+ IFLOW.md
64
+
65
+ # 第三方库
66
+ lib/
mindbot-0.3.4/PKG-INFO ADDED
@@ -0,0 +1,417 @@
1
+ Metadata-Version: 2.4
2
+ Name: mindbot
3
+ Version: 0.3.4
4
+ Summary: 基于 **Python + asyncio** 的模块化 AI Agent 框架,支持多 Provider、动态路由、流式响应和工具确认机制。
5
+ Author: MindBot Team
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: aiohttp>=3.9
17
+ Requires-Dist: croniter>=1.4
18
+ Requires-Dist: lancedb>=0.27
19
+ Requires-Dist: loguru>=0.7
20
+ Requires-Dist: openai
21
+ Requires-Dist: prompt-toolkit>=3.0
22
+ Requires-Dist: pyarrow>=21.0
23
+ Requires-Dist: pydantic-settings>=2.0
24
+ Requires-Dist: pydantic>=2.0
25
+ Requires-Dist: rich>=13.0
26
+ Requires-Dist: typer>=0.12
27
+ Requires-Dist: watchfiles>=0.20
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
30
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
31
+ Requires-Dist: pytest>=7.0; extra == 'dev'
32
+ Provides-Extra: feishu
33
+ Requires-Dist: lark-oapi>=1.0; extra == 'feishu'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # MindBot
37
+
38
+ <div align="center">
39
+ <img src="docs/assets/mindbot_logo.png" alt="MindBot" width="400" />
40
+ </div>
41
+
42
+ <p align="center">
43
+ <a href="https://github.com/SyJarvis/mindbot"><img src="https://img.shields.io/badge/Version-0.3.4-blue.svg" alt="Version"></a>
44
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.10+-blue?logo=python" alt="Python"></a>
45
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License"></a>
46
+ </p>
47
+
48
+ <p align="center">基于 <strong>Python + asyncio</strong> 的模块化 AI Agent 框架,支持多 Provider、动态路由、流式响应和工具确认机制。</p>
49
+
50
+ <p align="center"><a href="docs/index.md">📖 文档</a> · <a href="docs/guide/quickstart.md">🚀 快速开始</a> · <a href="docs/architecture/overview.md">🧱 架构</a> · <a href="docs/guide/examples.md">📝 示例</a></p>
51
+
52
+ ---
53
+
54
+ ## 📢 News
55
+
56
+ - **2026-04-21** 📦 **uv 包管理** — 迁移到 uv 管理依赖,更快的安装和锁定
57
+ - **2026-04-20** 🧠 **Memory 重构** — 四级向量记忆系统,支持语义检索和智能遗忘
58
+ - **2026-04-10** 🚀 **实时配置系统** — ConfigBus 事件总线、AuthManager 授权管理
59
+ - **2026-04-09** 🏗️ **ACP 协议支持** — Agent Client Protocol 通道,支持 Claude Code、Codex 等外部 Agent
60
+ - **2026-04-02** 📊 **Agent Benchmark** — ToolCall-15 和 Real-Tools benchmark 框架
61
+
62
+ <details>
63
+ <summary>Earlier news</summary>
64
+
65
+ - **2026-03-05** 🔧 **v0.3.0** — 多 Agent 编排、Skills 机制、会话 Journal
66
+ - **2026-02-27** 🧠 **记忆系统** — 短期/长期记忆,向量检索
67
+ - **2026-02-20** 💬 **多通道支持** — 飞书、Telegram、HTTP
68
+ - **2026-02-10** 🎉 **MindBot 发布** — 基于 Python + asyncio 的模块化 Agent 框架
69
+
70
+ </details>
71
+
72
+ ---
73
+
74
+ ## 特性
75
+
76
+ - 🪶 **轻量高效** — 纯 Python + asyncio,五层架构设计
77
+ - 🧠 **长期记忆** — Markdown 存储,向量检索,自动归档
78
+ - 🎯 **智能路由** — 根据内容类型/复杂度/关键词自动选择模型
79
+ - 🔒 **工具确认** — 多级安全确认机制(白名单、危险工具检测)
80
+ - 🛡️ **路径安全** — 文件工具路径策略 + Shell 执行边界控制
81
+ - 💬 **多通道** — CLI、HTTP、飞书、Telegram
82
+ - 🔌 **Skills 机制** — `SKILL.md` 技能包按需注入 prompt
83
+ - ⚙️ **实时配置** — ConfigBus 热更新,授权实时生效
84
+
85
+ ---
86
+
87
+ ## 安装
88
+
89
+ ```bash
90
+ git clone https://github.com/SyJarvis/mindbot.git
91
+ cd mindbot
92
+
93
+ # 使用 uv(推荐)
94
+ uv sync # 安装核心依赖
95
+ uv sync --extra dev # 安装开发依赖(测试等)
96
+ uv sync --extra feishu # 安装飞书通道依赖
97
+
98
+ # 或使用 pip
99
+ pip install -e .
100
+ pip install -e ".[dev]" # 开发依赖
101
+ ```
102
+
103
+ ---
104
+
105
+ ## 快速开始
106
+
107
+ ### 1. 配置 LLM
108
+
109
+ MindBot 支持四种 LLM 适配器:
110
+
111
+ | 适配器 | 说明 | 适用场景 |
112
+ |--------|------|----------|
113
+ | `ollama` | 本地运行,无需 API Key | 开发测试、私有部署 |
114
+ | `openai` | OpenAI API 或兼容服务 | 云服务、生产环境 |
115
+ | `llama_cpp` | llama.cpp 本地推理 | 低资源环境 |
116
+ | `transformers` | HuggingFace 模型 | 研究实验 |
117
+
118
+ #### Ollama(本地运行)
119
+
120
+ ```bash
121
+ # 安装并启动 Ollama
122
+ ollama pull qwen3
123
+
124
+ # 配置 ~/.mindbot/settings.json
125
+ {
126
+ "providers": {
127
+ "local-ollama": {
128
+ "type": "ollama",
129
+ "endpoints": [{
130
+ "base_url": "http://localhost:11434",
131
+ "models": [{ "id": "qwen3", "role": "chat", "level": "medium" }]
132
+ }]
133
+ }
134
+ },
135
+ "agent": {
136
+ "model": "local-ollama/qwen3"
137
+ }
138
+ }
139
+ ```
140
+
141
+ #### OpenAI / 兼容服务
142
+
143
+ ```bash
144
+ # 设置 API Key
145
+ export OPENAI_API_KEY=your-api-key
146
+
147
+ # 配置 ~/.mindbot/settings.json
148
+ {
149
+ "providers": {
150
+ "openai": {
151
+ "type": "openai",
152
+ "endpoints": [{
153
+ "base_url": "https://api.openai.com/v1",
154
+ "api_key": "{env:OPENAI_API_KEY}",
155
+ "models": [{ "id": "gpt-4o", "role": "chat", "level": "high" }]
156
+ }]
157
+ }
158
+ },
159
+ "agent": {
160
+ "model": "openai/gpt-4o"
161
+ }
162
+ }
163
+ ```
164
+
165
+ **兼容服务**(如 DeepSeek、Moonshot、GLM)只需修改 `base_url`:
166
+
167
+ ```json
168
+ {
169
+ "providers": {
170
+ "deepseek": {
171
+ "type": "openai",
172
+ "endpoints": [{
173
+ "base_url": "https://api.deepseek.com/v1",
174
+ "api_key": "{env:DEEPSEEK_API_KEY}",
175
+ "models": [{ "id": "deepseek-chat", "role": "chat", "level": "high" }]
176
+ }]
177
+ }
178
+ },
179
+ "agent": {
180
+ "model": "deepseek/deepseek-chat"
181
+ }
182
+ }
183
+ ```
184
+
185
+ ### 2. 初始化配置
186
+
187
+ ```bash
188
+ mindbot generate-config
189
+ ```
190
+
191
+ 这会创建 `~/.mindbot/settings.json` 和 `~/.mindbot/SYSTEM.md`。
192
+
193
+ ### 3. 开始对话
194
+
195
+ ```python
196
+ import asyncio
197
+ from mindbot import MindBot
198
+
199
+ async def main():
200
+ bot = MindBot()
201
+ response = await bot.chat("你好,请介绍一下自己", session_id="user123")
202
+ print(response.content)
203
+
204
+ asyncio.run(main())
205
+ ```
206
+
207
+ ---
208
+
209
+ ## CLI 命令
210
+
211
+ ```bash
212
+ mindbot <command> [options]
213
+
214
+ Commands:
215
+ generate-config 初始化配置(别名: onboard)
216
+ serve 启动服务(多通道)
217
+ shell 进入交互式 shell
218
+ chat 发送单条消息
219
+ status 显示状态
220
+
221
+ config show 显示当前配置
222
+ config validate 验证配置
223
+
224
+ Options:
225
+ -c, --config <path> 配置文件路径
226
+ -v, --verbose 详细日志模式
227
+ ```
228
+
229
+ ### 交互式 Shell
230
+
231
+ ```bash
232
+ mindbot shell
233
+ ```
234
+
235
+ 进入 Shell 后可使用 slash 命令:
236
+
237
+ | 命令 | 说明 |
238
+ |------|------|
239
+ | `/model` | 列出所有可用模型 |
240
+ | `/model <name>` | 切换到指定模型(如 `/model local-ollama/qwen3`)|
241
+ | `/config` | 实时配置命令(授权、设置)|
242
+ | `/status` | 显示当前状态 |
243
+ | `/help` | 显示帮助 |
244
+ | `exit` / `quit` / `bye` | 退出 Shell |
245
+
246
+ > 使用向上/向下方向键可浏览历史输入,历史存储在 `~/.mindbot/history/`
247
+
248
+ ---
249
+
250
+ ## 多通道支持
251
+
252
+ ### 启动服务
253
+
254
+ ```bash
255
+ mindbot serve
256
+ ```
257
+
258
+ 根据配置中 `enabled: true` 的通道自动启动。
259
+
260
+ ### 飞书机器人
261
+
262
+ **1. 创建飞书应用**
263
+
264
+ - 访问 [飞书开放平台](https://open.feishu.cn/app)
265
+ - 创建新应用 → 启用 **机器人** 能力
266
+ - **权限配置**:添加 `im:message`(发送消息)、`im:message.p2p_msg:readonly`(接收消息)
267
+ - **事件订阅**:添加 `im.message.receive_v1`,选择「使用长连接接收事件」
268
+ - 获取 **App ID** 和 **App Secret**
269
+
270
+ **2. 配置**
271
+
272
+ ```json
273
+ {
274
+ "channels": {
275
+ "feishu": {
276
+ "enabled": true,
277
+ "app_id": "cli_xxx",
278
+ "app_secret": "xxx",
279
+ "encrypt_key": "",
280
+ "verification_token": ""
281
+ }
282
+ }
283
+ }
284
+ ```
285
+
286
+ > 长连接模式无需公网 IP,飞书通过 WebSocket 推送消息。
287
+
288
+ **3. 启动**
289
+
290
+ ```bash
291
+ mindbot serve
292
+ ```
293
+
294
+ ### Telegram
295
+
296
+ ```bash
297
+ # 从 @BotFather 获取 Token
298
+ export TELEGRAM_BOT_TOKEN=your-token
299
+
300
+ # 配置
301
+ {
302
+ "channels": {
303
+ "telegram": {
304
+ "enabled": true,
305
+ "token": "{env:TELEGRAM_BOT_TOKEN}"
306
+ }
307
+ }
308
+ }
309
+ ```
310
+
311
+ ---
312
+
313
+ ## 文档导航
314
+
315
+ | 主题 | 链接 |
316
+ |------|------|
317
+ | 快速开始 | [docs/guide/quickstart.md](docs/guide/quickstart.md) |
318
+ | 配置参考 | [docs/configuration/index.md](docs/configuration/index.md) |
319
+ | 架构文档 | [docs/architecture/overview.md](docs/architecture/overview.md) |
320
+ | 示例代码 | [docs/guide/examples.md](docs/guide/examples.md) |
321
+ | CLI 命令 | [docs/guide/cli-reference.md](docs/guide/cli-reference.md) |
322
+ | Skills 机制 | [docs/guide/skills.md](docs/guide/skills.md) |
323
+ | Benchmark | [docs/testing/toolcall15.md](docs/testing/toolcall15.md) |
324
+
325
+ ---
326
+
327
+ ## 项目结构
328
+
329
+ ```
330
+ mindbot/
331
+ ├── src/mindbot/
332
+ │ ├── bot.py # 对外主入口
333
+ │ ├── agent/ # Agent 编排与执行
334
+ │ ├── providers/ # LLM 提供商适配
335
+ │ ├── routing/ # 模型路由
336
+ │ ├── memory/ # 记忆系统
337
+ │ ├── capability/ # 能力层
338
+ │ ├── channels/ # 多通道支持
339
+ │ ├── config/ # 配置管理
340
+ │ └── tools/ # 内置工具
341
+ ├── docs/ # 文档
342
+ ├── tests/ # 测试
343
+ └── examples/ # 示例代码
344
+ ```
345
+
346
+ ---
347
+
348
+ ## 架构设计
349
+
350
+ MindBot 采用 **五层分层架构**,各层之间通过明确的边界规则和单向依赖关系进行解耦。
351
+
352
+ ```
353
+ ┌─────────────────────────────────────────────────────────────┐
354
+ │ L1 接口/传输层 │
355
+ │ channels/* + bus/* + cli/* │
356
+ │ 接入外部通道(CLI、HTTP、飞书),通过 MessageBus 解耦 │
357
+ ├─────────────────────────────────────────────────────────────┤
358
+ │ L2 应用/编排层 │
359
+ │ bot.py + agent/core.py + agent/agent.py + turn_engine.py │
360
+ │ 对话主链路编排:组装输入、驱动 TurnEngine 循环、持久化提交 │
361
+ ├─────────────────────────────────────────────────────────────┤
362
+ │ L3 对话领域层 │
363
+ │ context/manager.py + context/models.py + compression.py │
364
+ │ 7 块上下文管理、消息模型、token 预算分配 │
365
+ ├─────────────────────────────────────────────────────────────┤
366
+ │ L4 能力与记忆层 │
367
+ │ capability/* + memory/* + generation/* + skills/* │
368
+ │ 工具执行、记忆检索、动态工具生成、技能注册与渲染 │
369
+ ├─────────────────────────────────────────────────────────────┤
370
+ │ L5 基础设施适配层 │
371
+ │ providers/* + routing/* + config/* │
372
+ │ LLM Provider 适配、模型路由选择、配置加载与热更新 │
373
+ └─────────────────────────────────────────────────────────────┘
374
+ ```
375
+
376
+ | 层级 | 核心职责 | 关键模块 |
377
+ |------|---------|---------|
378
+ | L1 | 接入外部通道,消息解耦 | `channels/*`, `bus/*`, `cli/*` |
379
+ | L2 | 对话主链路编排 | `bot.py`, `agent/core.py`, `agent/turn_engine.py` |
380
+ | L3 | 上下文管理、token 预算 | `context/manager.py`, `context/models.py` |
381
+ | L4 | 工具执行、记忆检索 | `capability/*`, `memory/*`, `skills/*` |
382
+ | L5 | LLM Provider、模型路由 | `providers/*`, `routing/*`, `config/*` |
383
+
384
+ ### 核心设计原则
385
+
386
+ - **仅两个聊天接口**:`chat()` 和 `chat_stream()`,所有通道必须通过这两个方法进入主链路
387
+ - **全异步架构**:所有 I/O 操作均为 `async`,不阻塞事件循环
388
+ - **7 块上下文管理**:system_identity、skills_overview、skills_detail、memory、conversation、intent_state、user_input
389
+ - **CapabilityFacade 统一调度**:所有工具执行通过统一入口
390
+
391
+ ---
392
+
393
+ ## 内置工具
394
+
395
+ | 工具 | 类别 | 说明 |
396
+ |------|------|------|
397
+ | `read_file` | 文件 | 读取文件内容,支持 offset/limit 分页 |
398
+ | `write_file` | 文件 | 创建或覆盖文件,自动创建父目录 |
399
+ | `edit_file` | 文件 | 精确文本替换,支持 replace_all |
400
+ | `list_directory` | 文件 | 列出目录内容,支持 glob 模式匹配 |
401
+ | `file_info` | 文件 | 获取文件/目录基本信息(大小、类型) |
402
+ | `exec_command` | Shell | 执行 Shell 命令,带超时和安全检查 |
403
+ | `get_mindbot_runtime_info` | 系统 | 获取运行时状态(配置、内存、日志) |
404
+ | `fetch_url` | Web | 获取 URL 内容,自动去除 HTML 标签 |
405
+
406
+ ### 路径安全策略
407
+
408
+ - **workspace**: 默认工作目录,所有相对路径以此解析
409
+ - **restrict_to_workspace**: 启用时,文件工具只能在允许根目录内运行
410
+ - **system_path_whitelist**: 额外允许的系统路径(如 `~/.mindbot`)
411
+ - **shell_execution.policy**: Shell 执行策略(`cwd_guard` 或 `sandboxed`)
412
+
413
+ ---
414
+
415
+ ## License
416
+
417
+ MIT