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