mycode-coding-agent 0.1.0__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 (206) hide show
  1. mycode_coding_agent-0.1.0/.env.example +38 -0
  2. mycode_coding_agent-0.1.0/.github/workflows/ci.yml +33 -0
  3. mycode_coding_agent-0.1.0/.github/workflows/deploy.yml +48 -0
  4. mycode_coding_agent-0.1.0/.gitignore +34 -0
  5. mycode_coding_agent-0.1.0/.python-version +1 -0
  6. mycode_coding_agent-0.1.0/LICENSE +21 -0
  7. mycode_coding_agent-0.1.0/PKG-INFO +244 -0
  8. mycode_coding_agent-0.1.0/README.md +223 -0
  9. mycode_coding_agent-0.1.0/mycode/__init__.py +0 -0
  10. mycode_coding_agent-0.1.0/mycode/adapters/__init__.py +21 -0
  11. mycode_coding_agent-0.1.0/mycode/adapters/jsonl.py +692 -0
  12. mycode_coding_agent-0.1.0/mycode/agent/__init__.py +25 -0
  13. mycode_coding_agent-0.1.0/mycode/agent/events.py +111 -0
  14. mycode_coding_agent-0.1.0/mycode/agent/outcome.py +103 -0
  15. mycode_coding_agent-0.1.0/mycode/agent/progress.py +373 -0
  16. mycode_coding_agent-0.1.0/mycode/agent/runner.py +1481 -0
  17. mycode_coding_agent-0.1.0/mycode/application/__init__.py +38 -0
  18. mycode_coding_agent-0.1.0/mycode/application/agent_session.py +367 -0
  19. mycode_coding_agent-0.1.0/mycode/application/events.py +59 -0
  20. mycode_coding_agent-0.1.0/mycode/application/runtime.py +211 -0
  21. mycode_coding_agent-0.1.0/mycode/application/sessions.py +180 -0
  22. mycode_coding_agent-0.1.0/mycode/cli.py +840 -0
  23. mycode_coding_agent-0.1.0/mycode/config.py +355 -0
  24. mycode_coding_agent-0.1.0/mycode/context/__init__.py +1 -0
  25. mycode_coding_agent-0.1.0/mycode/context/artifacts.py +672 -0
  26. mycode_coding_agent-0.1.0/mycode/context/budget.py +752 -0
  27. mycode_coding_agent-0.1.0/mycode/context/builder.py +112 -0
  28. mycode_coding_agent-0.1.0/mycode/context/compact.py +795 -0
  29. mycode_coding_agent-0.1.0/mycode/context/tool_result_format.py +199 -0
  30. mycode_coding_agent-0.1.0/mycode/context/tool_result_retention.py +261 -0
  31. mycode_coding_agent-0.1.0/mycode/conversation.py +78 -0
  32. mycode_coding_agent-0.1.0/mycode/error_handling.py +481 -0
  33. mycode_coding_agent-0.1.0/mycode/event_format.py +147 -0
  34. mycode_coding_agent-0.1.0/mycode/instructions.py +285 -0
  35. mycode_coding_agent-0.1.0/mycode/llm.py +771 -0
  36. mycode_coding_agent-0.1.0/mycode/mcp/__init__.py +41 -0
  37. mycode_coding_agent-0.1.0/mycode/mcp/client.py +44 -0
  38. mycode_coding_agent-0.1.0/mycode/mcp/config.py +207 -0
  39. mycode_coding_agent-0.1.0/mycode/mcp/errors.py +302 -0
  40. mycode_coding_agent-0.1.0/mycode/mcp/manager.py +339 -0
  41. mycode_coding_agent-0.1.0/mycode/mcp/models.py +20 -0
  42. mycode_coding_agent-0.1.0/mycode/mcp/result_adapter.py +58 -0
  43. mycode_coding_agent-0.1.0/mycode/mcp/tool_adapter.py +145 -0
  44. mycode_coding_agent-0.1.0/mycode/mcp/trust.py +313 -0
  45. mycode_coding_agent-0.1.0/mycode/memory.py +570 -0
  46. mycode_coding_agent-0.1.0/mycode/memory_context.py +245 -0
  47. mycode_coding_agent-0.1.0/mycode/messages.py +63 -0
  48. mycode_coding_agent-0.1.0/mycode/observability.py +28 -0
  49. mycode_coding_agent-0.1.0/mycode/permissions.py +262 -0
  50. mycode_coding_agent-0.1.0/mycode/persistence/__init__.py +1 -0
  51. mycode_coding_agent-0.1.0/mycode/persistence/filesystem.py +291 -0
  52. mycode_coding_agent-0.1.0/mycode/persistence/project_storage.py +208 -0
  53. mycode_coding_agent-0.1.0/mycode/persistence/session_lock.py +138 -0
  54. mycode_coding_agent-0.1.0/mycode/persistence/session_store.py +503 -0
  55. mycode_coding_agent-0.1.0/mycode/presentation/__init__.py +1 -0
  56. mycode_coding_agent-0.1.0/mycode/presentation/cli/__init__.py +14 -0
  57. mycode_coding_agent-0.1.0/mycode/presentation/cli/confirmer.py +116 -0
  58. mycode_coding_agent-0.1.0/mycode/presentation/cli/mcp_trust.py +61 -0
  59. mycode_coding_agent-0.1.0/mycode/presentation/cli/presenter.py +320 -0
  60. mycode_coding_agent-0.1.0/mycode/presentation/cli/session_menu.py +146 -0
  61. mycode_coding_agent-0.1.0/mycode/presentation/cli/subagent_observer.py +124 -0
  62. mycode_coding_agent-0.1.0/mycode/presentation/command_format.py +90 -0
  63. mycode_coding_agent-0.1.0/mycode/presentation/commands.py +95 -0
  64. mycode_coding_agent-0.1.0/mycode/presentation/tui/__init__.py +6 -0
  65. mycode_coding_agent-0.1.0/mycode/presentation/tui/app.py +1351 -0
  66. mycode_coding_agent-0.1.0/mycode/presentation/tui/interactions.py +253 -0
  67. mycode_coding_agent-0.1.0/mycode/presentation/tui/presenter.py +266 -0
  68. mycode_coding_agent-0.1.0/mycode/presentation/tui/screens.py +305 -0
  69. mycode_coding_agent-0.1.0/mycode/presentation/tui/widgets.py +214 -0
  70. mycode_coding_agent-0.1.0/mycode/project.py +22 -0
  71. mycode_coding_agent-0.1.0/mycode/prompts.py +181 -0
  72. mycode_coding_agent-0.1.0/mycode/reasoning.py +40 -0
  73. mycode_coding_agent-0.1.0/mycode/session.py +86 -0
  74. mycode_coding_agent-0.1.0/mycode/skills/__init__.py +27 -0
  75. mycode_coding_agent-0.1.0/mycode/skills/builtin/database-recovery/SKILL.md +138 -0
  76. mycode_coding_agent-0.1.0/mycode/skills/builtin/database-recovery/references/sqlite.md +235 -0
  77. mycode_coding_agent-0.1.0/mycode/skills/registry.py +295 -0
  78. mycode_coding_agent-0.1.0/mycode/skills/state.py +68 -0
  79. mycode_coding_agent-0.1.0/mycode/subagents/__init__.py +1 -0
  80. mycode_coding_agent-0.1.0/mycode/subagents/audit.py +212 -0
  81. mycode_coding_agent-0.1.0/mycode/subagents/concurrency.py +124 -0
  82. mycode_coding_agent-0.1.0/mycode/subagents/contracts.py +421 -0
  83. mycode_coding_agent-0.1.0/mycode/subagents/delegate.py +80 -0
  84. mycode_coding_agent-0.1.0/mycode/subagents/delegation.py +128 -0
  85. mycode_coding_agent-0.1.0/mycode/subagents/lifecycle.py +86 -0
  86. mycode_coding_agent-0.1.0/mycode/subagents/limits.py +7 -0
  87. mycode_coding_agent-0.1.0/mycode/subagents/observability.py +150 -0
  88. mycode_coding_agent-0.1.0/mycode/subagents/persistence.py +152 -0
  89. mycode_coding_agent-0.1.0/mycode/subagents/profiles.py +184 -0
  90. mycode_coding_agent-0.1.0/mycode/subagents/prompts.py +67 -0
  91. mycode_coding_agent-0.1.0/mycode/subagents/results.py +178 -0
  92. mycode_coding_agent-0.1.0/mycode/subagents/runtime.py +528 -0
  93. mycode_coding_agent-0.1.0/mycode/subagents/snapshots.py +211 -0
  94. mycode_coding_agent-0.1.0/mycode/subagents/tool_batch.py +260 -0
  95. mycode_coding_agent-0.1.0/mycode/tools/__init__.py +81 -0
  96. mycode_coding_agent-0.1.0/mycode/tools/base.py +222 -0
  97. mycode_coding_agent-0.1.0/mycode/tools/bounds.py +14 -0
  98. mycode_coding_agent-0.1.0/mycode/tools/command_executor.py +167 -0
  99. mycode_coding_agent-0.1.0/mycode/tools/command_output.py +166 -0
  100. mycode_coding_agent-0.1.0/mycode/tools/command_risk.py +596 -0
  101. mycode_coding_agent-0.1.0/mycode/tools/defaults.py +59 -0
  102. mycode_coding_agent-0.1.0/mycode/tools/edit_file.py +524 -0
  103. mycode_coding_agent-0.1.0/mycode/tools/file_mutation.py +30 -0
  104. mycode_coding_agent-0.1.0/mycode/tools/glob.py +247 -0
  105. mycode_coding_agent-0.1.0/mycode/tools/grep.py +324 -0
  106. mycode_coding_agent-0.1.0/mycode/tools/ignore.py +122 -0
  107. mycode_coding_agent-0.1.0/mycode/tools/inspect_changes.py +269 -0
  108. mycode_coding_agent-0.1.0/mycode/tools/load_skill.py +92 -0
  109. mycode_coding_agent-0.1.0/mycode/tools/memory.py +264 -0
  110. mycode_coding_agent-0.1.0/mycode/tools/path_permissions.py +78 -0
  111. mycode_coding_agent-0.1.0/mycode/tools/patterns.py +48 -0
  112. mycode_coding_agent-0.1.0/mycode/tools/permission_metadata.py +27 -0
  113. mycode_coding_agent-0.1.0/mycode/tools/process_tree.py +166 -0
  114. mycode_coding_agent-0.1.0/mycode/tools/read_file.py +242 -0
  115. mycode_coding_agent-0.1.0/mycode/tools/read_skill_resource.py +93 -0
  116. mycode_coding_agent-0.1.0/mycode/tools/registry.py +279 -0
  117. mycode_coding_agent-0.1.0/mycode/tools/run_command.py +237 -0
  118. mycode_coding_agent-0.1.0/mycode/tools/run_skill_script.py +206 -0
  119. mycode_coding_agent-0.1.0/mycode/tools/run_validation.py +107 -0
  120. mycode_coding_agent-0.1.0/mycode/tools/submit_result.py +93 -0
  121. mycode_coding_agent-0.1.0/mycode/tools/text.py +15 -0
  122. mycode_coding_agent-0.1.0/mycode/tools/validation_command.py +377 -0
  123. mycode_coding_agent-0.1.0/mycode/tools/workspace.py +33 -0
  124. mycode_coding_agent-0.1.0/mycode/tools/write_file.py +169 -0
  125. mycode_coding_agent-0.1.0/pyproject.toml +50 -0
  126. mycode_coding_agent-0.1.0/tests/fixtures/mcp_test_server.py +80 -0
  127. mycode_coding_agent-0.1.0/tests/test_agent.py +140 -0
  128. mycode_coding_agent-0.1.0/tests/test_agent_application_session.py +321 -0
  129. mycode_coding_agent-0.1.0/tests/test_application.py +112 -0
  130. mycode_coding_agent-0.1.0/tests/test_application_boundary.py +95 -0
  131. mycode_coding_agent-0.1.0/tests/test_artifacts.py +975 -0
  132. mycode_coding_agent-0.1.0/tests/test_builtin_skills.py +104 -0
  133. mycode_coding_agent-0.1.0/tests/test_cli.py +2143 -0
  134. mycode_coding_agent-0.1.0/tests/test_command_executor.py +27 -0
  135. mycode_coding_agent-0.1.0/tests/test_command_risk.py +217 -0
  136. mycode_coding_agent-0.1.0/tests/test_commands.py +65 -0
  137. mycode_coding_agent-0.1.0/tests/test_compact_persistence.py +165 -0
  138. mycode_coding_agent-0.1.0/tests/test_config.py +514 -0
  139. mycode_coding_agent-0.1.0/tests/test_confirmers.py +190 -0
  140. mycode_coding_agent-0.1.0/tests/test_context_budget.py +841 -0
  141. mycode_coding_agent-0.1.0/tests/test_context_compact.py +1010 -0
  142. mycode_coding_agent-0.1.0/tests/test_conversation.py +224 -0
  143. mycode_coding_agent-0.1.0/tests/test_error_handling.py +372 -0
  144. mycode_coding_agent-0.1.0/tests/test_event_format.py +82 -0
  145. mycode_coding_agent-0.1.0/tests/test_filesystem.py +196 -0
  146. mycode_coding_agent-0.1.0/tests/test_instructions.py +362 -0
  147. mycode_coding_agent-0.1.0/tests/test_jsonl.py +734 -0
  148. mycode_coding_agent-0.1.0/tests/test_llm.py +907 -0
  149. mycode_coding_agent-0.1.0/tests/test_main_agent_validation.py +149 -0
  150. mycode_coding_agent-0.1.0/tests/test_mcp_cli.py +236 -0
  151. mycode_coding_agent-0.1.0/tests/test_mcp_config.py +345 -0
  152. mycode_coding_agent-0.1.0/tests/test_mcp_errors.py +194 -0
  153. mycode_coding_agent-0.1.0/tests/test_mcp_manager.py +398 -0
  154. mycode_coding_agent-0.1.0/tests/test_mcp_result_adapter.py +37 -0
  155. mycode_coding_agent-0.1.0/tests/test_mcp_stdio_integration.py +43 -0
  156. mycode_coding_agent-0.1.0/tests/test_mcp_streamable_http_integration.py +128 -0
  157. mycode_coding_agent-0.1.0/tests/test_mcp_tool_adapter.py +200 -0
  158. mycode_coding_agent-0.1.0/tests/test_mcp_trust.py +785 -0
  159. mycode_coding_agent-0.1.0/tests/test_memory.py +268 -0
  160. mycode_coding_agent-0.1.0/tests/test_memory_context.py +197 -0
  161. mycode_coding_agent-0.1.0/tests/test_messages.py +92 -0
  162. mycode_coding_agent-0.1.0/tests/test_path_permissions.py +120 -0
  163. mycode_coding_agent-0.1.0/tests/test_permissions.py +402 -0
  164. mycode_coding_agent-0.1.0/tests/test_project_storage.py +151 -0
  165. mycode_coding_agent-0.1.0/tests/test_prompts.py +211 -0
  166. mycode_coding_agent-0.1.0/tests/test_read_bound_normalization.py +215 -0
  167. mycode_coding_agent-0.1.0/tests/test_run_outcome.py +50 -0
  168. mycode_coding_agent-0.1.0/tests/test_run_progress.py +337 -0
  169. mycode_coding_agent-0.1.0/tests/test_runner.py +2564 -0
  170. mycode_coding_agent-0.1.0/tests/test_session.py +213 -0
  171. mycode_coding_agent-0.1.0/tests/test_session_acceptance.py +159 -0
  172. mycode_coding_agent-0.1.0/tests/test_session_commit_marker.py +203 -0
  173. mycode_coding_agent-0.1.0/tests/test_session_deletion.py +45 -0
  174. mycode_coding_agent-0.1.0/tests/test_session_lock.py +82 -0
  175. mycode_coding_agent-0.1.0/tests/test_session_menu.py +162 -0
  176. mycode_coding_agent-0.1.0/tests/test_session_runtime.py +71 -0
  177. mycode_coding_agent-0.1.0/tests/test_session_store.py +154 -0
  178. mycode_coding_agent-0.1.0/tests/test_skill_context.py +334 -0
  179. mycode_coding_agent-0.1.0/tests/test_skill_tools.py +393 -0
  180. mycode_coding_agent-0.1.0/tests/test_skills_registry.py +266 -0
  181. mycode_coding_agent-0.1.0/tests/test_subagent_concurrency.py +133 -0
  182. mycode_coding_agent-0.1.0/tests/test_subagent_contracts.py +199 -0
  183. mycode_coding_agent-0.1.0/tests/test_subagent_delegation.py +948 -0
  184. mycode_coding_agent-0.1.0/tests/test_subagent_persistence.py +232 -0
  185. mycode_coding_agent-0.1.0/tests/test_subagent_profiles.py +146 -0
  186. mycode_coding_agent-0.1.0/tests/test_subagent_results.py +140 -0
  187. mycode_coding_agent-0.1.0/tests/test_subagent_runtime.py +1139 -0
  188. mycode_coding_agent-0.1.0/tests/test_subagent_snapshots.py +140 -0
  189. mycode_coding_agent-0.1.0/tests/test_tool_result_retention.py +296 -0
  190. mycode_coding_agent-0.1.0/tests/test_tools_base.py +321 -0
  191. mycode_coding_agent-0.1.0/tests/test_tools_defaults.py +510 -0
  192. mycode_coding_agent-0.1.0/tests/test_tools_edit_file.py +437 -0
  193. mycode_coding_agent-0.1.0/tests/test_tools_glob.py +225 -0
  194. mycode_coding_agent-0.1.0/tests/test_tools_grep.py +313 -0
  195. mycode_coding_agent-0.1.0/tests/test_tools_ignore.py +80 -0
  196. mycode_coding_agent-0.1.0/tests/test_tools_inspect_changes.py +166 -0
  197. mycode_coding_agent-0.1.0/tests/test_tools_memory.py +142 -0
  198. mycode_coding_agent-0.1.0/tests/test_tools_read_file.py +220 -0
  199. mycode_coding_agent-0.1.0/tests/test_tools_registry.py +405 -0
  200. mycode_coding_agent-0.1.0/tests/test_tools_run_command.py +777 -0
  201. mycode_coding_agent-0.1.0/tests/test_tools_run_validation.py +382 -0
  202. mycode_coding_agent-0.1.0/tests/test_tools_submit_result.py +102 -0
  203. mycode_coding_agent-0.1.0/tests/test_tools_workspace.py +69 -0
  204. mycode_coding_agent-0.1.0/tests/test_tools_write_file.py +258 -0
  205. mycode_coding_agent-0.1.0/tests/test_tui.py +2099 -0
  206. mycode_coding_agent-0.1.0/uv.lock +1148 -0
@@ -0,0 +1,38 @@
1
+ # MyCode Agent 支持用户级和项目级配置:
2
+ # 用户级(Windows):%USERPROFILE%\.mycode\.env
3
+ # 项目级:<workspace>\.mycode\.env
4
+ # 优先级:process environment > project > user > defaults。
5
+ # 项目根目录的 <workspace>\.env 不会读取。
6
+ # 可将本文件复制到任一配置位置;项目级文件只需填写需要覆盖的字段。
7
+ # .mycode/.env 不应提交到 Git,也不要提交真实密钥。
8
+
9
+ # 以下三项均为必填,请替换所有占位值。
10
+ # 模型服务需要支持 OpenAI-compatible Chat Completions。
11
+ # 缺少任意一项时,MyCode 将拒绝启动并指出缺少的配置。
12
+ MYCODE_API_KEY=your-api-key
13
+ MYCODE_BASE_URL=https://your-provider.example/v1
14
+ MYCODE_MODEL=your-chat-completions-model
15
+
16
+ # 可选:角色模型留空时使用 MYCODE_MODEL。
17
+ MYCODE_COMPACT_MODEL=
18
+ MYCODE_SUBAGENT_MODEL=
19
+
20
+ # 上下文预算。请根据模型支持的上下文窗口和输出限制进行设置。
21
+ LLM_CONTEXT_WINDOW_TOKENS=128000
22
+ LLM_RESERVED_OUTPUT_TOKENS=8192
23
+ LLM_CONTEXT_SAFETY_MARGIN_TOKENS=4096
24
+ LLM_MEMORY_CONTEXT_TOKENS=2048
25
+
26
+ # 要求兼容的流式模型服务返回 token 用量。
27
+ LLM_STREAM_INCLUDE_USAGE=true
28
+
29
+ # 可选的推理配置。如果模型服务不支持,请保持留空。
30
+ # LLM_REASONING_EFFORT 只接受 high 或 max,并且必须同时启用 thinking。
31
+ LLM_THINKING_ENABLED=
32
+ LLM_REASONING_EFFORT=
33
+ LLM_MAX_OUTPUT_TOKENS=
34
+
35
+ # 可选:MCP secret 放在用户级或项目级本文件中,并从对应 mcp.json 以 ${ENV_VAR} 引用。
36
+ # secret 同样遵循 process > project > user 优先级。
37
+ # MCP_LOCAL_TOKEN=
38
+ # MCP_REMOTE_TOKEN=
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up uv
21
+ uses: astral-sh/setup-uv@v6
22
+ with:
23
+ version: "0.9.21"
24
+ enable-cache: true
25
+
26
+ - name: Set up Python
27
+ run: uv python install 3.11
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --locked
31
+
32
+ - name: Run tests
33
+ run: uv run pytest
@@ -0,0 +1,48 @@
1
+ name: CD
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: [CI]
6
+ types: [completed]
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: production-deploy
14
+ cancel-in-progress: false
15
+
16
+ jobs:
17
+ deploy:
18
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 20
21
+
22
+ steps:
23
+ - name: Configure SSH
24
+ shell: bash
25
+ env:
26
+ DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
27
+ DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
28
+ run: |
29
+ install -d -m 700 "$HOME/.ssh"
30
+ printf '%s\n' "$DEPLOY_SSH_KEY" > "$HOME/.ssh/id_ed25519"
31
+ chmod 600 "$HOME/.ssh/id_ed25519"
32
+ printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts"
33
+ chmod 600 "$HOME/.ssh/known_hosts"
34
+
35
+ - name: Deploy to production
36
+ shell: bash
37
+ env:
38
+ DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
39
+ DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
40
+ run: |
41
+ ssh -T \
42
+ -i "$HOME/.ssh/id_ed25519" \
43
+ -o BatchMode=yes \
44
+ -o IdentitiesOnly=yes \
45
+ -o StrictHostKeyChecking=yes \
46
+ -o UserKnownHostsFile="$HOME/.ssh/known_hosts" \
47
+ -o ConnectTimeout=15 \
48
+ "$DEPLOY_USER@$DEPLOY_HOST"
@@ -0,0 +1,34 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Environment variables / secrets
13
+ .env
14
+ .env.*
15
+ !.env.example
16
+
17
+ # Test / coverage artifacts
18
+ .pytest_cache/
19
+ .coverage
20
+ htmlcov/
21
+
22
+ # Type checker / linter caches
23
+ .mypy_cache/
24
+ .ruff_cache/
25
+
26
+ # Logs
27
+ *.log
28
+
29
+ # External reference materials
30
+ 参考资料/
31
+ docs/参考资料/
32
+
33
+ # Misc personal notes (not tracked)
34
+ docs/杂/
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mmc-cloud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.5
2
+ Name: mycode-coding-agent
3
+ Version: 0.1.0
4
+ Summary: A terminal coding agent with tool calling, context management, subagents, MCP, and skills.
5
+ Author: mmc-cloud
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: ai-agent,cli,coding-agent,mcp,tui
9
+ Requires-Python: >=3.11
10
+ Requires-Dist: editables~=0.3
11
+ Requires-Dist: httpx2<3,>=2.5.0
12
+ Requires-Dist: httpx<1,>=0.28.1
13
+ Requires-Dist: jsonschema<5,>=4.25.1
14
+ Requires-Dist: mcp<3,>=2.1.1
15
+ Requires-Dist: openai<3,>=2.43.0
16
+ Requires-Dist: pydantic>=2.13.4
17
+ Requires-Dist: python-dotenv>=1.2.2
18
+ Requires-Dist: pyyaml<7,>=6.0.2
19
+ Requires-Dist: textual>=8.2.8
20
+ Description-Content-Type: text/markdown
21
+
22
+ # MyCode
23
+
24
+ MyCode 是一个使用 Python 实现、面向个人开发者的可扩展终端 Coding Agent。
25
+
26
+ An extensible terminal coding agent built with Python.
27
+
28
+ 它以启动命令时的当前目录作为工作区,通过 OpenAI-compatible Chat Completions 模型完成代码理解、文件修改、命令执行、会话管理和受控的 SubAgent 协作。这是一个个人项目,按“能力依赖 + 风险边界”逐步实现,不建议未经审查直接用于生产环境。
29
+
30
+ ## Features / 主要能力
31
+
32
+ - Agent Loop 与结构化 Tool Calling
33
+ - 工作区内的文件查找、读取、写入和编辑
34
+ - 受路径边界和风险分级约束的命令执行
35
+ - Permission 与人工确认
36
+ - 上下文预算、历史压缩、会话持久化与跨会话记忆
37
+ - SubAgent 委派:explorer / tester / reviewer
38
+ - 通过 MCP 接入外部工具
39
+ - Skill:可复用的任务流程包
40
+ - CLI 与 Textual 终端界面
41
+
42
+ ## Installation / 安装
43
+
44
+ 要求:
45
+
46
+ - Python 3.11 或更高版本
47
+ - [uv](https://docs.astral.sh/uv/)
48
+ - 一个支持 OpenAI-compatible Chat Completions 的模型服务及其 API Key
49
+
50
+ 使用 uv 安装:
51
+
52
+ ```powershell
53
+ uv tool install mycode-coding-agent
54
+ ```
55
+
56
+ 安装后 `mycode` 可以在任意目录使用。从源码安装见 [Development](#development--开发与测试)。
57
+
58
+ ## Quick Start / 快速开始
59
+
60
+ MyCode 以启动命令时的当前目录作为 Agent 工作区,所以先进入你想让 Agent 操作的项目:
61
+
62
+ ```powershell
63
+ cd D:\path\to\your-project
64
+ ```
65
+
66
+ 配置模型连接,这三项必填,取值见 [Configuration](#configuration--配置):
67
+
68
+ ```dotenv
69
+ MYCODE_API_KEY=your-api-key
70
+ MYCODE_BASE_URL=https://your-provider.example/v1
71
+ MYCODE_MODEL=your-chat-completions-model
72
+ ```
73
+
74
+ 启动:
75
+
76
+ ```powershell
77
+ mycode agent
78
+ ```
79
+
80
+ 当前 CLI 没有 `--workspace PATH` 参数,切换工作区需要先进入目标目录再启动。建议只在受信任、并且已经用 Git 管理的项目中运行。
81
+
82
+ ## Usage / 常用命令
83
+
84
+ | 命令 | 说明 |
85
+ | -------------------------- | ------------------------------------------------------------------------ |
86
+ | `mycode agent` | 在当前目录启动 coding agent |
87
+ | `mycode chat` | 启动不带 coding tools 的普通模型对话 |
88
+ | `mycode tui` | 启动 Textual 终端界面 |
89
+ | `mycode runtime --jsonl` | 启动机器可消费的 JSONL runtime;stdout 只输出 JSONL,诊断信息写到 stderr |
90
+ | `mycode --help` | 查看命令列表;`mycode <子命令> --help` 查看子命令帮助 |
91
+
92
+ `mycode agent` 的会话选项(三者互斥):
93
+
94
+ - `--new`:跳过菜单,直接创建新会话。
95
+ - `--continue`:跳过菜单,续接当前项目最近使用的会话;没有历史会话时新建。
96
+ - `--resume SESSION_ID`:跳过菜单,续接指定的未删除会话。已永久删除的会话无法恢复。
97
+
98
+ 输出选项同样互斥:`--verbose` 显示更完整的运行信息,`--debug` 显示调试级运行信息。
99
+
100
+ 不指定会话选项时,如果当前项目已有历史会话,CLI 会显示交互式菜单,可以选择历史会话、新建会话、永久删除会话或退出;没有历史会话时直接新建,不显示空菜单。
101
+
102
+ 在 `agent` 和 `tui` 的交互会话里可以使用 slash command:`/help`、`/new`、`/sessions`、`/resume <session_id>`、`/context`、`/compact`、`/exit`(别名 `/quit`)。
103
+
104
+ 会话和记忆保存在用户目录下的 `.mycode`,并按工作区路径区分项目,同名目录不会互相覆盖:
105
+
106
+ ```text
107
+ %USERPROFILE%\.mycode\projects\<workspace-basename>-<12-char-hash>\sessions\<session-id>\
108
+ %USERPROFILE%\.mycode\projects\<workspace-basename>-<12-char-hash>\MEMORY.md
109
+ %USERPROFILE%\.mycode\MEMORY.md
110
+ ```
111
+
112
+ ## Configuration / 配置
113
+
114
+ 模型连接写在 `.env` 文件中,支持用户级和项目级两级:
115
+
116
+ ```text
117
+ 用户级(Windows):%USERPROFILE%\.mycode\.env
118
+ 项目级:<workspace>\.mycode\.env
119
+ ```
120
+
121
+ 逐字段优先级为 `process environment > project > user > defaults`,空字符串不构成有效覆盖。项目级只需要写要覆盖的字段,其余回退到用户级配置;临时覆盖用进程环境变量。项目根目录的 `<workspace>\.env` 不会被读取。
122
+
123
+ Windows PowerShell 首次配置:
124
+
125
+ ```powershell
126
+ $mycodeConfigDir = Join-Path $env:USERPROFILE ".mycode"
127
+ $mycodeConfigFile = Join-Path $mycodeConfigDir ".env"
128
+ New-Item -ItemType Directory -Path $mycodeConfigDir -Force | Out-Null
129
+ if (-not (Test-Path $mycodeConfigFile)) {
130
+ Copy-Item .env.example $mycodeConfigFile
131
+ }
132
+ ```
133
+
134
+ 然后编辑该文件。必填三项:`MYCODE_API_KEY`、`MYCODE_BASE_URL`、`MYCODE_MODEL`。缺少任意一项时 MyCode 会拒绝启动并指出缺少的配置。
135
+
136
+ 常用可选项:
137
+
138
+ - `MYCODE_COMPACT_MODEL`、`MYCODE_SUBAGENT_MODEL`:Compact 和 SubAgent 使用的模型,留空时继承 `MYCODE_MODEL`。
139
+ - `LLM_CONTEXT_WINDOW_TOKENS`、`LLM_RESERVED_OUTPUT_TOKENS`、`LLM_CONTEXT_SAFETY_MARGIN_TOKENS`、`LLM_MEMORY_CONTEXT_TOKENS`:上下文预算,需要按模型实际的上下文窗口和输出上限设置。
140
+ - `LLM_STREAM_INCLUDE_USAGE`:要求兼容的流式模型服务返回 token 用量。
141
+ - `LLM_THINKING_ENABLED`、`LLM_REASONING_EFFORT`、`LLM_MAX_OUTPUT_TOKENS`:可选的推理配置,模型服务不支持时保持留空。
142
+
143
+ 完整字段和注释见 [`.env.example`](.env.example)。
144
+
145
+ `mycode chat` 没有 workspace 语义,只使用进程环境、用户级配置和默认值。
146
+
147
+ 项目级 secret 放在 `<workspace>\.mycode\.env`,该文件已被 `.env` 的 Git ignore 规则排除;不要提交真实 API Key 或 token。
148
+
149
+ ## MCP / Skills
150
+
151
+ ### MCP
152
+
153
+ MCP 用于把外部工具接入同一个 Agent Loop,支持 `stdio` 和 `streamable_http` 两种 transport,配置分用户级和项目级:
154
+
155
+ ```text
156
+ 用户级:%USERPROFILE%\.mycode\mcp.json
157
+ 项目级:<workspace>\.mycode\mcp.json
158
+ ```
159
+
160
+ ```json
161
+ {
162
+ "mcpServers": {
163
+ "local": {
164
+ "transport": "stdio",
165
+ "command": "python",
166
+ "args": ["D:\\path\\to\\server.py"],
167
+ "env": {"TOKEN": "${MCP_LOCAL_TOKEN}"}
168
+ },
169
+ "remote": {
170
+ "transport": "streamable_http",
171
+ "url": "https://example.com/mcp",
172
+ "headers": {"Authorization": "Bearer ${MCP_REMOTE_TOKEN}"}
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ secret 不写进 `mcp.json`,而是放在 `.mycode\.env` 里用 `${ENV_VAR}` 引用。用户级配置视为你本人的主动配置;项目级 MCP 会在启动时要求一次信任确认,确认前不会建立连接。MCP 工具注册后仍然走 MyCode 的 JSON Schema 校验、Permission 和确认链,与内置工具一致。
179
+
180
+ ### Skills
181
+
182
+ Skill 是可复用的任务流程包,由 `SKILL.md` 和可选的参考文件、脚本组成,按 `builtin -> user -> project` 顺序发现,同名时项目级覆盖用户级、用户级覆盖内置。内置 Skill 目前是 `database-recovery`。
183
+
184
+ ```text
185
+ 用户级:%USERPROFILE%\.mycode\skills\
186
+ 项目级:<workspace>\.mycode\skills\
187
+ ```
188
+
189
+ ## Safety / 安全说明
190
+
191
+ MyCode 能够修改文件和执行命令,使用前请注意:
192
+
193
+ - 先提交或备份重要修改,并确认当前目录就是目标工作区。
194
+ - 路径和命令策略会允许、拒绝或要求人工确认工具调用,但不能替代系统级沙箱。
195
+ - 命令执行使用结构化参数、不经过 shell;需要人工确认的操作会明确提示。
196
+ - Agent 完成后用 `git status` 和 `git diff` 检查实际改动。
197
+ - MCP Server、文件和网页内容都按不可信外部输入处理,其中的指令不能覆盖 System Prompt、Permission 规则和运行时控制。
198
+ - 不要在源码、测试、提示词或 Git 历史中写入真实密钥。
199
+
200
+ ## Development / 开发与测试
201
+
202
+ 从源码运行:
203
+
204
+ ```powershell
205
+ git clone https://github.com/mmc-cloud/mycode.git
206
+ cd mycode
207
+ uv sync
208
+ uv run mycode agent
209
+ ```
210
+
211
+ 把本地 checkout 安装成全局命令:
212
+
213
+ ```powershell
214
+ uv tool install .
215
+ ```
216
+
217
+ 运行测试:
218
+
219
+ ```powershell
220
+ uv run pytest
221
+ ```
222
+
223
+ 项目结构:
224
+
225
+ ```text
226
+ mycode/ 核心 Agent、CLI/TUI、工具、会话、上下文、MCP、Skill 和 SubAgent 实现
227
+ tests/ 核心测试
228
+ .env.example 用户级或项目级模型配置模板
229
+ pyproject.toml 包信息、依赖、CLI 入口和测试配置
230
+ uv.lock 锁定的依赖版本
231
+ ```
232
+
233
+ ## Current Limitations / 当前限制
234
+
235
+ - 主要验证环境是 Windows + PowerShell;macOS/Linux 尚未充分实际验证,目前不作为受支持平台。
236
+ - 需要 Python 3.11 或更高版本。
237
+ - 不同 OpenAI-compatible Provider 对流式 usage、thinking 和 reasoning 字段的支持可能存在差异,协议行为不完全一致。
238
+ - Agent 可以修改文件和执行命令,建议在 Git 管理的项目中运行并检查 diff;输出和工具决策仍需人工审查。
239
+ - MCP 第一版不支持 OAuth、Resources、Prompts、Sampling、热加载或原生 Image/Audio ToolResult。
240
+ - 当前以终端交互为主,不包含 IDE 插件或图形界面。
241
+
242
+ ## License
243
+
244
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,223 @@
1
+ # MyCode
2
+
3
+ MyCode 是一个使用 Python 实现、面向个人开发者的可扩展终端 Coding Agent。
4
+
5
+ An extensible terminal coding agent built with Python.
6
+
7
+ 它以启动命令时的当前目录作为工作区,通过 OpenAI-compatible Chat Completions 模型完成代码理解、文件修改、命令执行、会话管理和受控的 SubAgent 协作。这是一个个人项目,按“能力依赖 + 风险边界”逐步实现,不建议未经审查直接用于生产环境。
8
+
9
+ ## Features / 主要能力
10
+
11
+ - Agent Loop 与结构化 Tool Calling
12
+ - 工作区内的文件查找、读取、写入和编辑
13
+ - 受路径边界和风险分级约束的命令执行
14
+ - Permission 与人工确认
15
+ - 上下文预算、历史压缩、会话持久化与跨会话记忆
16
+ - SubAgent 委派:explorer / tester / reviewer
17
+ - 通过 MCP 接入外部工具
18
+ - Skill:可复用的任务流程包
19
+ - CLI 与 Textual 终端界面
20
+
21
+ ## Installation / 安装
22
+
23
+ 要求:
24
+
25
+ - Python 3.11 或更高版本
26
+ - [uv](https://docs.astral.sh/uv/)
27
+ - 一个支持 OpenAI-compatible Chat Completions 的模型服务及其 API Key
28
+
29
+ 使用 uv 安装:
30
+
31
+ ```powershell
32
+ uv tool install mycode-coding-agent
33
+ ```
34
+
35
+ 安装后 `mycode` 可以在任意目录使用。从源码安装见 [Development](#development--开发与测试)。
36
+
37
+ ## Quick Start / 快速开始
38
+
39
+ MyCode 以启动命令时的当前目录作为 Agent 工作区,所以先进入你想让 Agent 操作的项目:
40
+
41
+ ```powershell
42
+ cd D:\path\to\your-project
43
+ ```
44
+
45
+ 配置模型连接,这三项必填,取值见 [Configuration](#configuration--配置):
46
+
47
+ ```dotenv
48
+ MYCODE_API_KEY=your-api-key
49
+ MYCODE_BASE_URL=https://your-provider.example/v1
50
+ MYCODE_MODEL=your-chat-completions-model
51
+ ```
52
+
53
+ 启动:
54
+
55
+ ```powershell
56
+ mycode agent
57
+ ```
58
+
59
+ 当前 CLI 没有 `--workspace PATH` 参数,切换工作区需要先进入目标目录再启动。建议只在受信任、并且已经用 Git 管理的项目中运行。
60
+
61
+ ## Usage / 常用命令
62
+
63
+ | 命令 | 说明 |
64
+ | -------------------------- | ------------------------------------------------------------------------ |
65
+ | `mycode agent` | 在当前目录启动 coding agent |
66
+ | `mycode chat` | 启动不带 coding tools 的普通模型对话 |
67
+ | `mycode tui` | 启动 Textual 终端界面 |
68
+ | `mycode runtime --jsonl` | 启动机器可消费的 JSONL runtime;stdout 只输出 JSONL,诊断信息写到 stderr |
69
+ | `mycode --help` | 查看命令列表;`mycode <子命令> --help` 查看子命令帮助 |
70
+
71
+ `mycode agent` 的会话选项(三者互斥):
72
+
73
+ - `--new`:跳过菜单,直接创建新会话。
74
+ - `--continue`:跳过菜单,续接当前项目最近使用的会话;没有历史会话时新建。
75
+ - `--resume SESSION_ID`:跳过菜单,续接指定的未删除会话。已永久删除的会话无法恢复。
76
+
77
+ 输出选项同样互斥:`--verbose` 显示更完整的运行信息,`--debug` 显示调试级运行信息。
78
+
79
+ 不指定会话选项时,如果当前项目已有历史会话,CLI 会显示交互式菜单,可以选择历史会话、新建会话、永久删除会话或退出;没有历史会话时直接新建,不显示空菜单。
80
+
81
+ 在 `agent` 和 `tui` 的交互会话里可以使用 slash command:`/help`、`/new`、`/sessions`、`/resume <session_id>`、`/context`、`/compact`、`/exit`(别名 `/quit`)。
82
+
83
+ 会话和记忆保存在用户目录下的 `.mycode`,并按工作区路径区分项目,同名目录不会互相覆盖:
84
+
85
+ ```text
86
+ %USERPROFILE%\.mycode\projects\<workspace-basename>-<12-char-hash>\sessions\<session-id>\
87
+ %USERPROFILE%\.mycode\projects\<workspace-basename>-<12-char-hash>\MEMORY.md
88
+ %USERPROFILE%\.mycode\MEMORY.md
89
+ ```
90
+
91
+ ## Configuration / 配置
92
+
93
+ 模型连接写在 `.env` 文件中,支持用户级和项目级两级:
94
+
95
+ ```text
96
+ 用户级(Windows):%USERPROFILE%\.mycode\.env
97
+ 项目级:<workspace>\.mycode\.env
98
+ ```
99
+
100
+ 逐字段优先级为 `process environment > project > user > defaults`,空字符串不构成有效覆盖。项目级只需要写要覆盖的字段,其余回退到用户级配置;临时覆盖用进程环境变量。项目根目录的 `<workspace>\.env` 不会被读取。
101
+
102
+ Windows PowerShell 首次配置:
103
+
104
+ ```powershell
105
+ $mycodeConfigDir = Join-Path $env:USERPROFILE ".mycode"
106
+ $mycodeConfigFile = Join-Path $mycodeConfigDir ".env"
107
+ New-Item -ItemType Directory -Path $mycodeConfigDir -Force | Out-Null
108
+ if (-not (Test-Path $mycodeConfigFile)) {
109
+ Copy-Item .env.example $mycodeConfigFile
110
+ }
111
+ ```
112
+
113
+ 然后编辑该文件。必填三项:`MYCODE_API_KEY`、`MYCODE_BASE_URL`、`MYCODE_MODEL`。缺少任意一项时 MyCode 会拒绝启动并指出缺少的配置。
114
+
115
+ 常用可选项:
116
+
117
+ - `MYCODE_COMPACT_MODEL`、`MYCODE_SUBAGENT_MODEL`:Compact 和 SubAgent 使用的模型,留空时继承 `MYCODE_MODEL`。
118
+ - `LLM_CONTEXT_WINDOW_TOKENS`、`LLM_RESERVED_OUTPUT_TOKENS`、`LLM_CONTEXT_SAFETY_MARGIN_TOKENS`、`LLM_MEMORY_CONTEXT_TOKENS`:上下文预算,需要按模型实际的上下文窗口和输出上限设置。
119
+ - `LLM_STREAM_INCLUDE_USAGE`:要求兼容的流式模型服务返回 token 用量。
120
+ - `LLM_THINKING_ENABLED`、`LLM_REASONING_EFFORT`、`LLM_MAX_OUTPUT_TOKENS`:可选的推理配置,模型服务不支持时保持留空。
121
+
122
+ 完整字段和注释见 [`.env.example`](.env.example)。
123
+
124
+ `mycode chat` 没有 workspace 语义,只使用进程环境、用户级配置和默认值。
125
+
126
+ 项目级 secret 放在 `<workspace>\.mycode\.env`,该文件已被 `.env` 的 Git ignore 规则排除;不要提交真实 API Key 或 token。
127
+
128
+ ## MCP / Skills
129
+
130
+ ### MCP
131
+
132
+ MCP 用于把外部工具接入同一个 Agent Loop,支持 `stdio` 和 `streamable_http` 两种 transport,配置分用户级和项目级:
133
+
134
+ ```text
135
+ 用户级:%USERPROFILE%\.mycode\mcp.json
136
+ 项目级:<workspace>\.mycode\mcp.json
137
+ ```
138
+
139
+ ```json
140
+ {
141
+ "mcpServers": {
142
+ "local": {
143
+ "transport": "stdio",
144
+ "command": "python",
145
+ "args": ["D:\\path\\to\\server.py"],
146
+ "env": {"TOKEN": "${MCP_LOCAL_TOKEN}"}
147
+ },
148
+ "remote": {
149
+ "transport": "streamable_http",
150
+ "url": "https://example.com/mcp",
151
+ "headers": {"Authorization": "Bearer ${MCP_REMOTE_TOKEN}"}
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
157
+ secret 不写进 `mcp.json`,而是放在 `.mycode\.env` 里用 `${ENV_VAR}` 引用。用户级配置视为你本人的主动配置;项目级 MCP 会在启动时要求一次信任确认,确认前不会建立连接。MCP 工具注册后仍然走 MyCode 的 JSON Schema 校验、Permission 和确认链,与内置工具一致。
158
+
159
+ ### Skills
160
+
161
+ Skill 是可复用的任务流程包,由 `SKILL.md` 和可选的参考文件、脚本组成,按 `builtin -> user -> project` 顺序发现,同名时项目级覆盖用户级、用户级覆盖内置。内置 Skill 目前是 `database-recovery`。
162
+
163
+ ```text
164
+ 用户级:%USERPROFILE%\.mycode\skills\
165
+ 项目级:<workspace>\.mycode\skills\
166
+ ```
167
+
168
+ ## Safety / 安全说明
169
+
170
+ MyCode 能够修改文件和执行命令,使用前请注意:
171
+
172
+ - 先提交或备份重要修改,并确认当前目录就是目标工作区。
173
+ - 路径和命令策略会允许、拒绝或要求人工确认工具调用,但不能替代系统级沙箱。
174
+ - 命令执行使用结构化参数、不经过 shell;需要人工确认的操作会明确提示。
175
+ - Agent 完成后用 `git status` 和 `git diff` 检查实际改动。
176
+ - MCP Server、文件和网页内容都按不可信外部输入处理,其中的指令不能覆盖 System Prompt、Permission 规则和运行时控制。
177
+ - 不要在源码、测试、提示词或 Git 历史中写入真实密钥。
178
+
179
+ ## Development / 开发与测试
180
+
181
+ 从源码运行:
182
+
183
+ ```powershell
184
+ git clone https://github.com/mmc-cloud/mycode.git
185
+ cd mycode
186
+ uv sync
187
+ uv run mycode agent
188
+ ```
189
+
190
+ 把本地 checkout 安装成全局命令:
191
+
192
+ ```powershell
193
+ uv tool install .
194
+ ```
195
+
196
+ 运行测试:
197
+
198
+ ```powershell
199
+ uv run pytest
200
+ ```
201
+
202
+ 项目结构:
203
+
204
+ ```text
205
+ mycode/ 核心 Agent、CLI/TUI、工具、会话、上下文、MCP、Skill 和 SubAgent 实现
206
+ tests/ 核心测试
207
+ .env.example 用户级或项目级模型配置模板
208
+ pyproject.toml 包信息、依赖、CLI 入口和测试配置
209
+ uv.lock 锁定的依赖版本
210
+ ```
211
+
212
+ ## Current Limitations / 当前限制
213
+
214
+ - 主要验证环境是 Windows + PowerShell;macOS/Linux 尚未充分实际验证,目前不作为受支持平台。
215
+ - 需要 Python 3.11 或更高版本。
216
+ - 不同 OpenAI-compatible Provider 对流式 usage、thinking 和 reasoning 字段的支持可能存在差异,协议行为不完全一致。
217
+ - Agent 可以修改文件和执行命令,建议在 Git 管理的项目中运行并检查 diff;输出和工具决策仍需人工审查。
218
+ - MCP 第一版不支持 OAuth、Resources、Prompts、Sampling、热加载或原生 Image/Audio ToolResult。
219
+ - 当前以终端交互为主,不包含 IDE 插件或图形界面。
220
+
221
+ ## License
222
+
223
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
File without changes
@@ -0,0 +1,21 @@
1
+ """Adapters for external runtime protocols."""
2
+
3
+ from mycode.adapters.jsonl import (
4
+ JSONL_PROTOCOL_VERSION,
5
+ JsonlChannel,
6
+ JsonlConfirmer,
7
+ JsonlMCPTrustConfirmer,
8
+ run_jsonl_runtime,
9
+ serialize_agent_event,
10
+ serialize_runtime_event,
11
+ )
12
+
13
+ __all__ = [
14
+ "JSONL_PROTOCOL_VERSION",
15
+ "JsonlChannel",
16
+ "JsonlConfirmer",
17
+ "JsonlMCPTrustConfirmer",
18
+ "run_jsonl_runtime",
19
+ "serialize_agent_event",
20
+ "serialize_runtime_event",
21
+ ]