@sortedyuan/maybecode 0.3.2 → 0.5.0

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 (295) hide show
  1. package/README.md +166 -55
  2. package/README.zh-CN.md +267 -0
  3. package/dist/application.d.ts +40 -34
  4. package/dist/application.d.ts.map +1 -1
  5. package/dist/application.js +290 -170
  6. package/dist/application.js.map +1 -1
  7. package/dist/args.d.ts +2 -2
  8. package/dist/args.d.ts.map +1 -1
  9. package/dist/args.js +50 -27
  10. package/dist/args.js.map +1 -1
  11. package/dist/bin.js +82 -71
  12. package/dist/bin.js.map +4 -4
  13. package/dist/cli/chunk-3IORPKBL.js +3572 -0
  14. package/dist/cli/chunk-3IORPKBL.js.map +7 -0
  15. package/dist/cli/{chunk-LVTRXPDS.js → chunk-4B2Z6KW7.js} +1547 -1536
  16. package/dist/cli/chunk-4B2Z6KW7.js.map +7 -0
  17. package/dist/cli/{chunk-JT6VBKOM.js → chunk-4WG6JIJJ.js} +127 -33
  18. package/dist/cli/{chunk-JT6VBKOM.js.map → chunk-4WG6JIJJ.js.map} +3 -3
  19. package/dist/cli/{chunk-K5JWPNSY.js → chunk-5SLWALZK.js} +3521 -16164
  20. package/dist/cli/chunk-5SLWALZK.js.map +7 -0
  21. package/dist/cli/chunk-MNBYXL5Y.js +132 -0
  22. package/dist/cli/chunk-MNBYXL5Y.js.map +7 -0
  23. package/dist/cli/{chunk-F4XRPLUM.js → chunk-SLWLUEHQ.js} +226 -86
  24. package/dist/cli/chunk-SLWLUEHQ.js.map +7 -0
  25. package/dist/cli/chunk-UQDZ55LQ.js +199 -0
  26. package/dist/cli/chunk-UQDZ55LQ.js.map +7 -0
  27. package/dist/cli/{chunk-7ISOHFS7.js → chunk-WMSG5ZTR.js} +717 -388
  28. package/dist/cli/chunk-WMSG5ZTR.js.map +7 -0
  29. package/dist/cli/chunk-WVIRS76R.js +4057 -0
  30. package/dist/cli/chunk-WVIRS76R.js.map +7 -0
  31. package/dist/cli/{chunk-HOU5ITUK.js → chunk-XTEMRAQW.js} +1 -1
  32. package/dist/cli/chunk-XTEMRAQW.js.map +7 -0
  33. package/dist/cli/chunk-Z3BOPBVU.js +91 -0
  34. package/dist/cli/chunk-Z3BOPBVU.js.map +7 -0
  35. package/dist/cli/{configured-WHY3GGAJ.js → configured-ACNM6TRQ.js} +10 -9
  36. package/dist/cli/{file-type-R2T7TBHI.js → file-type-HLHPV7WC.js} +817 -13
  37. package/dist/cli/file-type-HLHPV7WC.js.map +7 -0
  38. package/dist/cli/mcp-auth-XD5U7WCV.js +74 -0
  39. package/dist/cli/mcp-auth-XD5U7WCV.js.map +7 -0
  40. package/dist/cli/onboarding-WQWCPYEO.js +530 -0
  41. package/dist/cli/onboarding-WQWCPYEO.js.map +7 -0
  42. package/dist/cli/onboarding-check-HRRI5OJ7.js +32 -0
  43. package/dist/cli/onboarding-check-HRRI5OJ7.js.map +7 -0
  44. package/dist/cli/{retained-tui-VJ3VX4R3.js → retained-tui-QF5VMYLC.js} +788 -332
  45. package/dist/cli/retained-tui-QF5VMYLC.js.map +7 -0
  46. package/dist/cli/{sixel-LWTCM76G.js → sixel-ISZ4FZ3U.js} +37 -37
  47. package/dist/cli/{sixel-LWTCM76G.js.map → sixel-ISZ4FZ3U.js.map} +1 -1
  48. package/dist/cli/{team-T7G7PPNN.js → team-O2I5BXHM.js} +7 -6
  49. package/dist/cli/{team-v2-JGBBQ7FR.js → team-v2-YYO2G7DJ.js} +816 -390
  50. package/dist/cli/team-v2-YYO2G7DJ.js.map +7 -0
  51. package/dist/cli/{web-server-FOMNPY7Q.js → web-server-SXMH6FGA.js} +55 -19
  52. package/dist/cli/web-server-SXMH6FGA.js.map +7 -0
  53. package/dist/cli/{web-ui-COB6PKC5.js → web-ui-UWQUFE4W.js} +7 -6
  54. package/dist/config-schema.json +337 -0
  55. package/dist/configured.d.ts +18 -11
  56. package/dist/configured.d.ts.map +1 -1
  57. package/dist/configured.js +213 -390
  58. package/dist/configured.js.map +1 -1
  59. package/dist/controller.d.ts +19 -18
  60. package/dist/controller.d.ts.map +1 -1
  61. package/dist/delegation-commands.d.ts +1 -1
  62. package/dist/delegation-commands.d.ts.map +1 -1
  63. package/dist/delegation-commands.js +8 -8
  64. package/dist/delegation-commands.js.map +1 -1
  65. package/dist/errors.d.ts +2 -1
  66. package/dist/errors.d.ts.map +1 -1
  67. package/dist/errors.js +2 -1
  68. package/dist/errors.js.map +1 -1
  69. package/dist/events.d.ts +8 -6
  70. package/dist/events.d.ts.map +1 -1
  71. package/dist/fork-picker.d.ts.map +1 -1
  72. package/dist/fork-picker.js +19 -5
  73. package/dist/fork-picker.js.map +1 -1
  74. package/dist/git-request.d.ts +6 -6
  75. package/dist/git-request.d.ts.map +1 -1
  76. package/dist/git-request.js +28 -15
  77. package/dist/git-request.js.map +1 -1
  78. package/dist/goal-commands.d.ts +1 -1
  79. package/dist/goal-commands.d.ts.map +1 -1
  80. package/dist/goal-commands.js +12 -5
  81. package/dist/goal-commands.js.map +1 -1
  82. package/dist/index.d.ts +5 -37
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +3 -36
  85. package/dist/index.js.map +1 -1
  86. package/dist/instructions.d.ts +2 -7
  87. package/dist/instructions.d.ts.map +1 -1
  88. package/dist/instructions.js +7 -15
  89. package/dist/instructions.js.map +1 -1
  90. package/dist/keymap.d.ts +2 -2
  91. package/dist/keymap.d.ts.map +1 -1
  92. package/dist/keymap.js +2 -2
  93. package/dist/keymap.js.map +1 -1
  94. package/dist/maybecode-config.schema.json +1765 -0
  95. package/dist/mcp-auth.d.ts +1 -1
  96. package/dist/mcp-auth.d.ts.map +1 -1
  97. package/dist/mcp-auth.js +11 -8
  98. package/dist/mcp-auth.js.map +1 -1
  99. package/dist/mcp-commands.d.ts.map +1 -1
  100. package/dist/mcp-commands.js +18 -4
  101. package/dist/mcp-commands.js.map +1 -1
  102. package/dist/mcp-interaction-ui.d.ts.map +1 -1
  103. package/dist/mcp-interaction-ui.js +11 -4
  104. package/dist/mcp-interaction-ui.js.map +1 -1
  105. package/dist/media-history.d.ts +1 -1
  106. package/dist/media-history.d.ts.map +1 -1
  107. package/dist/media-history.js +8 -2
  108. package/dist/media-history.js.map +1 -1
  109. package/dist/model-picker.d.ts.map +1 -1
  110. package/dist/model-picker.js +10 -11
  111. package/dist/model-picker.js.map +1 -1
  112. package/dist/model-transition.d.ts +11 -0
  113. package/dist/model-transition.d.ts.map +1 -0
  114. package/dist/model-transition.js +48 -0
  115. package/dist/model-transition.js.map +1 -0
  116. package/dist/model.d.ts +2 -2
  117. package/dist/model.d.ts.map +1 -1
  118. package/dist/model.js +8 -4
  119. package/dist/model.js.map +1 -1
  120. package/dist/onboarding-check.d.ts +3 -0
  121. package/dist/onboarding-check.d.ts.map +1 -0
  122. package/dist/onboarding-check.js +22 -0
  123. package/dist/onboarding-check.js.map +1 -0
  124. package/dist/onboarding.d.ts +6 -0
  125. package/dist/onboarding.d.ts.map +1 -0
  126. package/dist/onboarding.js +463 -0
  127. package/dist/onboarding.js.map +1 -0
  128. package/dist/plugins/application.d.ts +6 -4
  129. package/dist/plugins/application.d.ts.map +1 -1
  130. package/dist/plugins/application.js +106 -52
  131. package/dist/plugins/application.js.map +1 -1
  132. package/dist/plugins/instructions.d.ts +1 -1
  133. package/dist/plugins/instructions.d.ts.map +1 -1
  134. package/dist/plugins/instructions.js +24 -11
  135. package/dist/plugins/instructions.js.map +1 -1
  136. package/dist/plugins/resources.d.ts +2 -2
  137. package/dist/plugins/resources.d.ts.map +1 -1
  138. package/dist/plugins/resources.js +22 -12
  139. package/dist/plugins/resources.js.map +1 -1
  140. package/dist/policy.d.ts +1 -1
  141. package/dist/policy.d.ts.map +1 -1
  142. package/dist/policy.js +59 -11
  143. package/dist/policy.js.map +1 -1
  144. package/dist/run.d.ts +2 -0
  145. package/dist/run.d.ts.map +1 -1
  146. package/dist/run.js +38 -33
  147. package/dist/run.js.map +1 -1
  148. package/dist/runtime-instructions.d.ts +1 -1
  149. package/dist/runtime-instructions.d.ts.map +1 -1
  150. package/dist/runtime-instructions.js +15 -7
  151. package/dist/runtime-instructions.js.map +1 -1
  152. package/dist/session-navigation.d.ts +6 -0
  153. package/dist/session-navigation.d.ts.map +1 -0
  154. package/dist/session-navigation.js +64 -0
  155. package/dist/session-navigation.js.map +1 -0
  156. package/dist/session-picker.d.ts +1 -1
  157. package/dist/session-picker.d.ts.map +1 -1
  158. package/dist/session-picker.js +23 -32
  159. package/dist/session-picker.js.map +1 -1
  160. package/dist/settings.d.ts +718 -0
  161. package/dist/settings.d.ts.map +1 -0
  162. package/dist/settings.js +14 -0
  163. package/dist/settings.js.map +1 -0
  164. package/dist/skills.d.ts +1 -1
  165. package/dist/skills.d.ts.map +1 -1
  166. package/dist/skills.js +10 -12
  167. package/dist/skills.js.map +1 -1
  168. package/dist/slash-commands.d.ts +2 -2
  169. package/dist/slash-commands.d.ts.map +1 -1
  170. package/dist/slash-commands.js +149 -67
  171. package/dist/slash-commands.js.map +1 -1
  172. package/dist/team-execution.d.ts +10 -0
  173. package/dist/team-execution.d.ts.map +1 -0
  174. package/dist/team-execution.js +29 -0
  175. package/dist/team-execution.js.map +1 -0
  176. package/dist/team-patches.d.ts.map +1 -1
  177. package/dist/team-patches.js +149 -52
  178. package/dist/team-patches.js.map +1 -1
  179. package/dist/team-plan.d.ts +2 -2
  180. package/dist/team-plan.d.ts.map +1 -1
  181. package/dist/team-plan.js +115 -34
  182. package/dist/team-plan.js.map +1 -1
  183. package/dist/team-recovery.d.ts +1 -1
  184. package/dist/team-recovery.d.ts.map +1 -1
  185. package/dist/team-recovery.js +40 -10
  186. package/dist/team-recovery.js.map +1 -1
  187. package/dist/team-v2.d.ts.map +1 -1
  188. package/dist/team-v2.js +335 -104
  189. package/dist/team-v2.js.map +1 -1
  190. package/dist/team-verification.d.ts +4 -2
  191. package/dist/team-verification.d.ts.map +1 -1
  192. package/dist/team-verification.js +300 -97
  193. package/dist/team-verification.js.map +1 -1
  194. package/dist/team.d.ts +2 -2
  195. package/dist/team.d.ts.map +1 -1
  196. package/dist/team.js +172 -62
  197. package/dist/team.js.map +1 -1
  198. package/dist/terminal-web.d.ts +1 -0
  199. package/dist/terminal-web.d.ts.map +1 -1
  200. package/dist/terminal-web.js +28 -10
  201. package/dist/terminal-web.js.map +1 -1
  202. package/dist/ui/actions.d.ts.map +1 -1
  203. package/dist/ui/actions.js.map +1 -1
  204. package/dist/ui/retained-tui.d.ts.map +1 -1
  205. package/dist/ui/retained-tui.js +231 -173
  206. package/dist/ui/retained-tui.js.map +1 -1
  207. package/dist/ui/{prototype-view.d.ts → terminal-view.d.ts} +7 -7
  208. package/dist/ui/terminal-view.d.ts.map +1 -0
  209. package/dist/ui/{prototype-view.js → terminal-view.js} +185 -98
  210. package/dist/ui/terminal-view.js.map +1 -0
  211. package/dist/web-commands.d.ts.map +1 -1
  212. package/dist/web-commands.js +160 -57
  213. package/dist/web-commands.js.map +1 -1
  214. package/dist/web-extension.d.ts.map +1 -1
  215. package/dist/web-extension.js +14 -4
  216. package/dist/web-extension.js.map +1 -1
  217. package/dist/web-server.d.ts.map +1 -1
  218. package/dist/web-server.js +2 -1
  219. package/dist/web-server.js.map +1 -1
  220. package/dist/web-ui.d.ts.map +1 -1
  221. package/dist/web-ui.js +167 -40
  222. package/dist/web-ui.js.map +1 -1
  223. package/dist/workspace-configuration.d.ts +7 -0
  224. package/dist/workspace-configuration.d.ts.map +1 -0
  225. package/dist/workspace-configuration.js +134 -0
  226. package/dist/workspace-configuration.js.map +1 -0
  227. package/dist/workspace-state.d.ts +20 -0
  228. package/dist/workspace-state.d.ts.map +1 -0
  229. package/dist/workspace-state.js +2 -0
  230. package/dist/workspace-state.js.map +1 -0
  231. package/dist/workspace.d.ts +26 -43
  232. package/dist/workspace.d.ts.map +1 -1
  233. package/dist/workspace.js +261 -323
  234. package/dist/workspace.js.map +1 -1
  235. package/package.json +21 -31
  236. package/dist/cli/chunk-7ISOHFS7.js.map +0 -7
  237. package/dist/cli/chunk-F4XRPLUM.js.map +0 -7
  238. package/dist/cli/chunk-H7SNBFO4.js +0 -5522
  239. package/dist/cli/chunk-H7SNBFO4.js.map +0 -7
  240. package/dist/cli/chunk-HOU5ITUK.js.map +0 -7
  241. package/dist/cli/chunk-K5JWPNSY.js.map +0 -7
  242. package/dist/cli/chunk-LVTRXPDS.js.map +0 -7
  243. package/dist/cli/chunk-VAZMCNBB.js +0 -686
  244. package/dist/cli/chunk-VAZMCNBB.js.map +0 -7
  245. package/dist/cli/chunk-WOFEI42C.js +0 -7820
  246. package/dist/cli/chunk-WOFEI42C.js.map +0 -7
  247. package/dist/cli/file-type-R2T7TBHI.js.map +0 -7
  248. package/dist/cli/mcp-auth-UNRHSIKJ.js +0 -63
  249. package/dist/cli/mcp-auth-UNRHSIKJ.js.map +0 -7
  250. package/dist/cli/retained-tui-VJ3VX4R3.js.map +0 -7
  251. package/dist/cli/team-v2-JGBBQ7FR.js.map +0 -7
  252. package/dist/cli/tui-SA74DKMA.js +0 -1705
  253. package/dist/cli/tui-SA74DKMA.js.map +0 -7
  254. package/dist/cli/web-server-FOMNPY7Q.js.map +0 -7
  255. package/dist/delegation.d.ts +0 -2
  256. package/dist/delegation.d.ts.map +0 -1
  257. package/dist/delegation.js +0 -2
  258. package/dist/delegation.js.map +0 -1
  259. package/dist/history-memory.d.ts +0 -2
  260. package/dist/history-memory.d.ts.map +0 -1
  261. package/dist/history-memory.js +0 -2
  262. package/dist/history-memory.js.map +0 -1
  263. package/dist/subagent-budget.d.ts +0 -2
  264. package/dist/subagent-budget.d.ts.map +0 -1
  265. package/dist/subagent-budget.js +0 -2
  266. package/dist/subagent-budget.js.map +0 -1
  267. package/dist/subagent-files.d.ts +0 -2
  268. package/dist/subagent-files.d.ts.map +0 -1
  269. package/dist/subagent-files.js +0 -2
  270. package/dist/subagent-files.js.map +0 -1
  271. package/dist/subagent-host.d.ts +0 -2
  272. package/dist/subagent-host.d.ts.map +0 -1
  273. package/dist/subagent-host.js +0 -2
  274. package/dist/subagent-host.js.map +0 -1
  275. package/dist/subagent-instructions.d.ts +0 -2
  276. package/dist/subagent-instructions.d.ts.map +0 -1
  277. package/dist/subagent-instructions.js +0 -2
  278. package/dist/subagent-instructions.js.map +0 -1
  279. package/dist/subagents.d.ts +0 -2
  280. package/dist/subagents.d.ts.map +0 -1
  281. package/dist/subagents.js +0 -2
  282. package/dist/subagents.js.map +0 -1
  283. package/dist/summarizer.d.ts +0 -2
  284. package/dist/summarizer.d.ts.map +0 -1
  285. package/dist/summarizer.js +0 -2
  286. package/dist/summarizer.js.map +0 -1
  287. package/dist/tui.d.ts +0 -7
  288. package/dist/tui.d.ts.map +0 -1
  289. package/dist/tui.js +0 -1109
  290. package/dist/tui.js.map +0 -1
  291. package/dist/ui/prototype-view.d.ts.map +0 -1
  292. package/dist/ui/prototype-view.js.map +0 -1
  293. /package/dist/cli/{configured-WHY3GGAJ.js.map → configured-ACNM6TRQ.js.map} +0 -0
  294. /package/dist/cli/{team-T7G7PPNN.js.map → team-O2I5BXHM.js.map} +0 -0
  295. /package/dist/cli/{web-ui-COB6PKC5.js.map → web-ui-UWQUFE4W.js.map} +0 -0
package/README.md CHANGED
@@ -1,5 +1,112 @@
1
1
  # MaybeCode
2
2
 
3
+ [简体中文](README.zh-CN.md)
4
+
5
+ MaybeCode is a coding agent for reading projects, searching files and text,
6
+ editing code, running commands, and consulting web documentation. It provides
7
+ a retained terminal interface, a Web UI, resumable sessions, and delegated teams.
8
+
9
+ ## Requirements
10
+
11
+ Use Node.js **22.16 or newer**. Container execution additionally requires
12
+ Docker Desktop or a compatible Docker runtime with a running daemon.
13
+
14
+ ## Installation
15
+
16
+ Install the published package globally with npm or pnpm:
17
+
18
+ ```sh
19
+ npm install --global @sortedyuan/maybecode
20
+ pnpm add --global @sortedyuan/maybecode
21
+ ```
22
+
23
+ ## Configure a model
24
+
25
+ Save this minimal configuration as `may.config.json` in your project. Set
26
+ `DEEPSEEK_API_KEY` in your environment to your provider API key.
27
+
28
+ ```json
29
+ {
30
+ "providers": {
31
+ "deepseek": { "adapter": "deepseek-chat", "apiKeyEnv": "DEEPSEEK_API_KEY" }
32
+ },
33
+ "models": {
34
+ "deepseek": { "provider": "deepseek", "model": "deepseek-chat" }
35
+ },
36
+ "defaultModel": "deepseek"
37
+ }
38
+ ```
39
+
40
+ ## Start
41
+
42
+ ```sh
43
+ maybecode --config may.config.json .
44
+ maybecode --help
45
+ ```
46
+
47
+ `--ui` accepts `retained` (the default) and `web`. Run `/web` from the terminal
48
+ to open a connected browser view. Web-only startup requires
49
+ `MAYBECODE_CONTROL_TOKEN`; see [Web UI](#web-ui-developer-preview).
50
+
51
+ ## Resume a session
52
+
53
+ ```sh
54
+ maybecode --config may.config.json --continue .
55
+ maybecode --config may.config.json --resume <session-id> .
56
+ ```
57
+
58
+ Ordinary startup creates a new session. `/resume` opens the session picker;
59
+ saved sessions remain available across restarts.
60
+
61
+ ## Approval modes
62
+
63
+ Normal mode approves `read`, `glob`, and `grep` automatically. Commands, edits,
64
+ writes, and `fetch` web requests require approval. `fetch` has a separate network
65
+ permission category, including persistent rules when enabled.
66
+ `--yolo` enables automatic approval; `--no-yolo` selects normal mode. Explicit
67
+ policy denials remain enforced. `/yolo on|off|status` controls the running host.
68
+
69
+ ## Execution isolation
70
+
71
+ `apps.maybecode.execution` defaults to `{ "mode": "host" }`. Host commands run
72
+ with your account's permissions. To execute commands in a container, pull an
73
+ image before startup and configure the same image:
74
+
75
+ ```sh
76
+ docker pull nixery.dev/shell/git/ripgrep/util-linux
77
+ ```
78
+
79
+ ```json
80
+ {
81
+ "apps": {
82
+ "maybecode": {
83
+ "execution": {
84
+ "mode": "container",
85
+ "image": "nixery.dev/shell/git/ripgrep/util-linux",
86
+ "network": "none",
87
+ "memoryBytes": 1073741824,
88
+ "cpuCount": 2
89
+ }
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ The image must contain `bash`, `git`, `rg`, and `setsid`. Container execution
96
+ uses a non-root user, a read-only root filesystem, temporary `/tmp` storage,
97
+ disabled networking, and the configured memory and CPU limits. Only the workspace
98
+ is mounted. File tools access the same workspace from the host. Shell, search,
99
+ delegated tools, and authorized team checks use the configured execution environment.
100
+ MCP servers continue to run on the host. Missing Docker service or images stop
101
+ startup. Closing the application waits for its execution resources to terminate.
102
+
103
+ The `fetch` tool accesses public HTTP/HTTPS origins by default. Configure
104
+ `apps.maybecode.fetch.allowedOrigins` to restrict requests to specific origins;
105
+ listed origins may explicitly permit local services. `maxBytes`, `timeoutMs`,
106
+ and `maxRedirects` bound responses. Redirect destinations are checked individually.
107
+
108
+ ## Delegation notifications
109
+
3
110
  Automatic request and task status notices are disabled by default. Use
4
111
  `/delegations notifications on|off|status` to change or inspect the current
5
112
  process setting, including during a run. Set `apps.maybecode.delegationNotifications`
@@ -17,7 +124,7 @@ recreated; MaybeCode refreshes its service references and event subscriptions.
17
124
  Conversation history, paused Goals, active Skills, durable notes and the current
18
125
  permission mode remain available. Shared MCP connections remain open.
19
126
 
20
- Headless hosts can call `MaybeCodeApplication.updateModel()` with a Model,
127
+ Headless hosts can call `controller.application.updateModel()` with a Model,
21
128
  `modelInfo`, and optional `modelRuntimeOptions` and `contextBudget`. A configured
22
129
  Model plugin retains ownership of model selection. `modelUpdateFailed` reports an
23
130
  unsuccessful update; new input remains unavailable until an update succeeds.
@@ -82,11 +189,11 @@ apply to the current workspace host and all its sessions and connected views;
82
189
  they do not update configuration. Restarting uses the current startup settings.
83
190
 
84
191
  The terminal status bar and Web UI header show `YOLO · Auto-approve` while enabled.
85
- Classic terminal mode shows it in the input prompt. Notifications use `YOLO enabled`
192
+ Notifications use `YOLO enabled`
86
193
  and `YOLO disabled`. Explicit policy denials remain enforced. Tool validation,
87
194
  cancellation, execution records, and MCP requests for user-provided input remain
88
- active. Shell commands run with the host account's OS permissions; YOLO provides
89
- no filesystem or network isolation. Team commands retain their own authorization.
195
+ active. Shell commands use the configured execution environment. YOLO changes
196
+ approval behavior. Team commands retain their own authorization.
90
197
 
91
198
  ### Persistent permission rules
92
199
 
@@ -119,7 +226,7 @@ process exit. See [Permission policies](../../docs/en/guides/permission-policy.m
119
226
  and [权限策略](../../docs/zh-CN/guides/permission-policy.md).
120
227
 
121
228
  Image replies retain text/image ordering. Terminal saves embedded images and
122
- supports Kitty/iTerm2/Sixel graphics in both terminal frontends; `/web` provides
229
+ supports Kitty/iTerm2/Sixel graphics in the terminal frontend; `/web` provides
123
230
  image viewing and downloads. Windows Terminal is detected through `WT_SESSION`
124
231
  and queried for Sixel support and cell dimensions. `MAY_IMAGE_PROTOCOL=sixel`
125
232
  explicitly selects Sixel for a compatible terminal.
@@ -128,7 +235,7 @@ See [Image replies](../../docs/en/guides/images.md) /
128
235
 
129
236
  `/goal start [--max-runs N] [--tokens N] [--duration-ms N] -- <objective>` starts a
130
237
  durable goal. Use `/goal status`, `/goal pause`, `/goal resume` and `/goal cancel`
131
- in either terminal frontend or the Web UI. New user input pauses active goals.
238
+ in the terminal frontend or the Web UI. New user input pauses active goals.
132
239
  Run count and active execution time have no default limits; the corresponding
133
240
  flags apply only when specified. Saved goals retain their recorded budgets.
134
241
  See [Goals](../../docs/en/guides/goals.md) and
@@ -136,7 +243,7 @@ See [Goals](../../docs/en/guides/goals.md) and
136
243
 
137
244
  MaybeCode is a coding-agent application assembled from May's Core, application,
138
245
  session, permission, provider, configuration, coding-tool and UI packages.
139
- It offers terminal frontends and a developer-preview Web UI.
246
+ It offers a terminal frontend and a developer-preview Web UI.
140
247
 
141
248
  In the retained TUI, the mouse wheel scrolls the conversation by three rows per
142
249
  event while preserving editor focus and draft text. Scrolling up keeps the
@@ -155,7 +262,7 @@ sessions and for replies longer than the normal scroll buffer.
155
262
 
156
263
  ## Web UI (developer preview)
157
264
 
158
- Type `/web` in either terminal frontend to open the current workspace and Session
265
+ Type `/web` in the terminal frontend to open the current workspace and Session
159
266
  in the default browser. The terminal shares live output, approvals, model selection
160
267
  and Session changes with the Web UI. Repeating `/web` opens the same service with
161
268
  a fresh one-time connection link. No token environment variable is needed. After
@@ -204,8 +311,8 @@ or [简体中文指南](../../docs/zh-CN/guides/web-ui.md) for commands and curr
204
311
 
205
312
  `src/plugins/application.ts` defines application features and service selection;
206
313
  `src/plugins/resources.ts` defines workspace resource ownership and the shared
207
- MCP and tracing providers supplied to each Session. `MaybeCodeApplication.open`
208
- and `openConfiguredMaybeCode` use these factories directly.
314
+ MCP and tracing providers supplied to each Session. `openConfiguredMaybeCode`
315
+ uses these factories directly.
209
316
 
210
317
  MaybeCode selects Model, Context, Permission, Skills, Goals, History Memory,
211
318
  Delegation, and Workspace Files plugins for each application. Optional MCP and
@@ -215,7 +322,7 @@ connections. Each worktree owns its configured MCP connections and stdio working
215
322
  directories; returning to a workspace reuses them. All workspaces share the tracing
216
323
  processor. Closing the host releases every workspace connection and the processor.
217
324
 
218
- `MaybeCodeApplication.open({ plugins, ... })` accepts custom plugins. A selected
325
+ `openConfiguredMaybeCode({ plugins, ... })` accepts custom plugins. A selected
219
326
  plugin replaces a default with the same id or provided service token; the host
220
327
  validates the complete dependency graph. `goals: false`, `subagents: false`, and
221
328
  `skills: false` retain their independent disable controls. Configured MCP and
@@ -245,8 +352,8 @@ continue to re-export history-memory and delegation interfaces.
245
352
  MaybeCode is a product composition layer. Generic lifecycle does not live in
246
353
  the app:
247
354
 
248
- - `@sortedyuan/core`'s instance-scoped `ToolRegistry` composes the coding tools;
249
- - `@sortedyuan/application`'s `defineAgent()` captures reusable behavior, while its
355
+ - `@sortedyuan/may/core`'s instance-scoped `ToolRegistry` composes the coding tools;
356
+ - `@sortedyuan/may`'s `defineAgent()` captures reusable behavior, while its
250
357
  application/workspace layer owns run/retry/cancel, approval relaying,
251
358
  Session history, Context compaction persistence, closing, session switching,
252
359
  and Catalog summaries;
@@ -279,9 +386,9 @@ also requires passing acceptance. `team verify <id>` explicitly runs checks;
279
386
  status and recovery never replay them.
280
387
 
281
388
  `--mode coding` allows explicitly listed editing tools in private task copies.
282
- `--allow-checks` separately authorizes exact configured test processes, not a
283
- general model-controlled Shell. These processes are **not OS-sandboxed**, even
284
- for a read-only team. MCP and model-controlled source application stay disabled.
389
+ `--allow-checks` separately authorizes exact configured test processes. Checks
390
+ inherit `apps.maybecode.execution`, including container restrictions when selected.
391
+ MCP and model-controlled source application stay disabled.
285
392
  `team diff <id> --tasks <task-ids>` exports a reviewable patch; only
286
393
  `team apply <id> --patch <patch-id> --confirm <digest>` can apply it after human
287
394
  review. Another task's passing checks never verify an unchecked patch task.
@@ -295,6 +402,7 @@ resets budgets. Existing v1 teams keep their original read-only
295
402
  `resume`/`status`/`cancel` behavior without a silent authority upgrade.
296
403
 
297
404
  Guides:
405
+
298
406
  - Teams: [English](../../docs/en/guides/maybecode-team.md) / [简体中文](../../docs/zh-CN/guides/maybecode-team.md)
299
407
  - Plans: [English](../../docs/en/guides/maybecode-team-plan.md) / [简体中文](../../docs/zh-CN/guides/maybecode-team-plan.md)
300
408
  - Verification: [English](../../docs/en/guides/maybecode-team-verification.md) / [简体中文](../../docs/zh-CN/guides/maybecode-team-verification.md)
@@ -308,38 +416,40 @@ or remote UI sends user actions through its methods and renders its
308
416
  `AsyncIterable<MaybeCodeEvent>` stream:
309
417
 
310
418
  ```ts
311
- import {
312
- openConfiguredMaybeCode,
313
- type MaybeCodeController,
314
- } from "@sortedyuan/maybecode";
419
+ import { openConfiguredMaybeCode, type MaybeCodeController } from "@sortedyuan/maybecode";
315
420
 
316
- const controller: MaybeCodeController = await openConfiguredMaybeCode();
421
+ const controller: MaybeCodeController = await openConfiguredMaybeCode({
422
+ configPath: "may.config.json",
423
+ });
317
424
 
318
425
  const observation = (async () => {
319
426
  for await (const event of controller.events) {
320
- render(event);
427
+ console.log(event);
321
428
  }
322
429
  })();
323
430
 
324
- await (await controller.submit({ input: "Inspect this workspace." })).result;
325
- await controller.close();
326
- await observation;
431
+ try {
432
+ console.log(controller.application.modelInfo);
433
+ await (
434
+ await controller.submit({ input: "Inspect this workspace." })
435
+ ).result;
436
+ } finally {
437
+ await controller.close();
438
+ await observation;
439
+ }
327
440
  ```
328
441
 
329
- The controller covers submission, cancellation, approvals, sessions, history,
330
- session rename/deletion, and context inspection/compaction.
331
- `MaybeCodeWorkspace` is the default concrete
332
- implementation. `MaybeCodeTerminal` is only the low-level input/output adapter
333
- for the bundled `runTerminalUI`; implementing it changes terminal mechanics but
334
- does not replace the bundled UI's command or rendering policy.
335
-
336
- Custom UIs can reuse the bundled command policy without reusing the terminal
337
- renderer. `MAYBECODE_SLASH_COMMANDS` exposes command metadata,
338
- `createMaybeCodeSlashCommandSuggester(controller)` provides command, compaction
339
- strategy, and session suggestions, and
340
- `executeMaybeCodeSlashCommand(input, controller)` returns a structured result
341
- for the UI to render. Alternatively, a UI can call `MaybeCodeController`
342
- directly and define a completely different command system.
442
+ The controller covers submission, steering, cancellation, approvals, sessions,
443
+ history, session rename/deletion, and context inspection/compaction.
444
+ `controller.application` is the application of the active Session; read its
445
+ state there, for example `application.getGoal()`, `application.modelInfo`,
446
+ `application.instructions`, `application.listSkills()` and
447
+ `application.getDelegationState()`. A Session change replaces it, so read it again
448
+ after switching. `controller.transition(action)` runs a state change on the
449
+ Session queue of the active application. The package exports only
450
+ `runMaybeCode`, `openConfiguredMaybeCode`, `MaybeCodeController` with its event
451
+ types, and `MaybeCodeUsageError`; a custom UI defines its own command system on
452
+ top of the controller.
343
453
 
344
454
  Ordinary input submitted during execution cancels the current operation, waits
345
455
  for its cancellation to finish, and starts the new input in the same Session.
@@ -352,17 +462,15 @@ inputs in order after the active operation finishes.
352
462
  `/stop`, the Web cancel control, and `Ctrl+C` without a text selection cancel the
353
463
  current operation and every queued input. Cancelled steering inputs remain in
354
464
  history and are not submitted again automatically. To use one later, explicitly
355
- send the message again. These rules apply to both terminal frontends, Web UI,
356
- and `MaybeCodeWorkspace.submit()` / `steer()`. General `AgentApplication.submit()`
465
+ send the message again. These rules apply to the terminal frontend, Web UI,
466
+ and `MaybeCodeController.submit()` / `steer()`. General `AgentApplication.submit()`
357
467
  continues to require that the application has no active operation.
358
468
 
359
469
  The bundled SessionPicker uses the optional `@sortedyuan/keybindings` package to map
360
470
  context-specific key sequences to semantic actions. Custom UIs may reuse that
361
471
  resolver or provide their own keyboard and interaction system.
362
472
 
363
- The retained-screen frontend is the default. The previous line-oriented
364
- frontend remains available with `maybecode --ui classic [workspace]`. The
365
- retained frontend supports Slash-command completion and a `/resume` dialog with search (`/`),
473
+ The retained-screen frontend is the default terminal frontend. It supports Slash-command completion and a `/resume` dialog with search (`/`),
366
474
  rename (`r`), delete (`d`), and resume (`Enter`) actions. It also renders safe
367
475
  terminal Markdown and uses specialized, collapsible renderers for `read`,
368
476
  `shell`, `edit`, and `write`.
@@ -676,9 +784,8 @@ See the [instruction composition guide](../../docs/en/guides/maybecode-instructi
676
784
  or its [Chinese version](../../docs/zh-CN/guides/maybecode-instructions.md).
677
785
 
678
786
  Programmatic callers can pass a `ContextFactory` to
679
- `openConfiguredMaybeCode`, `MaybeCodeWorkspace.open`, or
680
- `MaybeCodeApplication.open`. When omitted, MaybeCode uses
681
- `InMemoryContextFactory` from `@sortedyuan/context`. Factories return the Core context
787
+ `openConfiguredMaybeCode`. When omitted, MaybeCode uses
788
+ `InMemoryContextFactory` from `@sortedyuan/may/context`. Factories return the Core context
682
789
  and may also return a `ContextController` for application-level inspection.
683
790
 
684
791
  ## Commands
@@ -697,6 +804,12 @@ their original input; `/recovery resolve <id> <verified finding>` records the
697
804
  result of checking external effects. No tool is replayed by recovery. See
698
805
  [Crash recovery](../../docs/en/guides/recovery.md).
699
806
 
807
+ The retained TUI and Web history display saved recovery findings as user messages.
808
+ Web history search and full-field reads include their complete text. Both views
809
+ preserve denied, not-started, and unknown tool outcomes and interrupted partial
810
+ assistant replies. Web commands validate current execution and Session ownership
811
+ independently from presentation reads such as workspace details and fork points.
812
+
700
813
  In an interactive terminal, suggestions are shown as the first input line is
701
814
  edited. For example, `/re` shows `/resume` and `/retry`; `/compact ` offers
702
815
  `history-reference` and `provider-native`; `/resume ` filters known session IDs;
@@ -833,9 +946,7 @@ Each changed view is persisted as `context.compacted` before the model request
833
946
  and is restored on resume, including a summary that is still above threshold.
834
947
  Programmatic callers select `autoCompactionMode`; an explicit
835
948
  `autoCompactionStrategies` array overrides it, and an empty array disables
836
- automatic compaction. The deprecated `providerNative: true` configuration and
837
- `providerNativeAutoCompaction: true` option now select native-only mode when no
838
- mode is specified; an explicit mode takes precedence.
949
+ automatic compaction.
839
950
 
840
951
  ### History-reference work memory
841
952
 
@@ -872,8 +983,8 @@ so notes can be prepared for manual `/compact history-reference`. Only automatic
872
983
  history-reference mode exposes `new_context` and adds proactive guidance/warnings.
873
984
  Explicit custom strategy arrays keep their existing caller-defined behavior.
874
985
 
875
- The `read` tool runs without approval. `shell`, `edit`, and `write` require an
876
- allow-once, allow-for-session, or deny decision. The shell tool is not a sandbox.
986
+ The `read`, `glob`, and `grep` tools run without approval. `shell`, `edit`, `write`,
987
+ and `fetch` require an allow-once, allow-for-session, or deny decision.
877
988
  The read-only `session_history` tool also runs without approval and returns
878
989
  bounded pages of durable events from only the active session.
879
990
  Allow-for-session grants currently last for the running MaybeCode process and
@@ -907,7 +1018,7 @@ pnpm test:integration:maybecode
907
1018
 
908
1019
  The persistent permission integration check is opt-in. After `pnpm build`, set
909
1020
  `MAYBECODE_PERSISTENT_RULES_LIVE=1` and optionally
910
- `MAYBECODE_PERSISTENT_RULES_MODEL=<configured-profile>`, then run
1021
+ `MAY_LIVE_MODEL=<configured-profile>`, then run
911
1022
  `node --test apps/maybecode/test/integration/persistent-rules.test.mjs`.
912
1023
  It uses the current user configuration and actual provider to write one isolated
913
1024
  file twice, closing and reopening the Session between writes. It verifies one
@@ -924,7 +1035,7 @@ and `complete` preview data; `attach` and `use-prompt` explicitly submit user-le
924
1035
  content; `watch`/`unwatch` manage notification-only subscriptions. See the bilingual
925
1036
  [MCP guide](../../docs/en/guides/mcp.md).
926
1037
 
927
- Both interactive terminal UIs support modern MCP form/URL elicitation, with
1038
+ The terminal UI supports modern MCP form/URL elicitation, with
928
1039
  explicit review/send, decline/cancel, and manual URL navigation/resume. Answers
929
1040
  are not command history. Library hosts must opt in with `mcpInteractions: true`
930
1041
  and consume the controller interaction events; no UI means no advertised
@@ -940,7 +1051,7 @@ Session-bound controls; `task-attach` alone submits a completed result to a new
940
1051
  Stopping local waiting is not remote cancellation. No automatic replay after
941
1052
  restart. See the bilingual [Tasks guide](../../docs/en/guides/mcp-tasks.md).
942
1053
 
943
- `/mcp apps` explicitly reports unsupported HTML in both terminal UIs. App-only
1054
+ `/mcp apps` explicitly reports unsupported HTML in the terminal UI. App-only
944
1055
  tools are hidden even without a graphical Host; model-visible text fallback remains.
945
1056
  Optional custom graphical integration: [Apps guide](../../docs/en/guides/mcp-apps.md).
946
1057
 
@@ -0,0 +1,267 @@
1
+ # MaybeCode
2
+
3
+ [English](README.md)
4
+
5
+ MaybeCode 是一个编程 Agent,可以读取项目、搜索文件和文本、修改代码、执行命令,
6
+ 以及访问网页文档。它提供 retained 终端界面、Web UI、会话恢复和团队委派。
7
+
8
+ ## 环境要求
9
+
10
+ 使用 **Node.js 22.16 或更新版本**。容器执行还需要 Docker Desktop 或兼容的
11
+ Docker 运行时,并启动 Docker 服务。
12
+
13
+ ## 安装
14
+
15
+ 使用 npm 或 pnpm 全局安装公开发布的 package:
16
+
17
+ ```sh
18
+ npm install --global @sortedyuan/maybecode
19
+ pnpm add --global @sortedyuan/maybecode
20
+ ```
21
+
22
+ ## 配置模型
23
+
24
+ 在项目目录创建 `may.config.json`。在环境变量 `DEEPSEEK_API_KEY` 中配置
25
+ provider API key。
26
+
27
+ ```json
28
+ {
29
+ "providers": {
30
+ "deepseek": { "adapter": "deepseek-chat", "apiKeyEnv": "DEEPSEEK_API_KEY" }
31
+ },
32
+ "models": {
33
+ "deepseek": { "provider": "deepseek", "model": "deepseek-chat" }
34
+ },
35
+ "defaultModel": "deepseek"
36
+ }
37
+ ```
38
+
39
+ ## 启动
40
+
41
+ ```sh
42
+ maybecode --config may.config.json .
43
+ maybecode --help
44
+ ```
45
+
46
+ `--ui` 接受 `retained`(默认值)和 `web`。在终端执行 `/web`,可以打开与当前
47
+ 会话连接的浏览器界面。单独启动 Web UI 需要配置 `MAYBECODE_CONTROL_TOKEN`。
48
+
49
+ ## 恢复会话
50
+
51
+ ```sh
52
+ maybecode --config may.config.json --continue .
53
+ maybecode --config may.config.json --resume <session-id> .
54
+ ```
55
+
56
+ 普通启动会创建新会话。`--continue` 恢复工作目录最近的会话,`--resume` 选择指定
57
+ 会话,`/resume` 打开会话选择界面。保存的会话可以在重新启动后继续使用。
58
+
59
+ ## 权限模式
60
+
61
+ 默认模式自动批准 `read`、`glob` 和 `grep`。执行命令、修改文件、写入文件和
62
+ `fetch` 网页请求需要审批。`fetch` 使用单独的网络权限类别,启用持久规则后也可以
63
+ 保存相应规则。
64
+
65
+ `--yolo` 开启自动批准,`--no-yolo` 使用默认模式。明确的策略拒绝仍然有效。
66
+ `/yolo on|off|status` 管理当前宿主的模式;修改模式前需要完成或取消正在执行的操作。
67
+ 模式变化应用于当前宿主的全部会话和界面,重新启动后使用启动配置。
68
+
69
+ 启用 `apps.maybecode.persistentRules` 后,项目的 `.may/permission-rules.json`
70
+ 保存持久规则。`/permissions list`、`revoke`、`allow` 和 `deny` 管理规则。
71
+ 文件编辑审批可以选择允许指定文件;规则使用项目、用户和 Agent 身份范围。
72
+ 详见[权限策略](../../docs/zh-CN/guides/permission-policy.md)。
73
+
74
+ ## 执行隔离
75
+
76
+ `apps.maybecode.execution` 默认使用 `{ "mode": "host" }`,命令拥有当前用户的
77
+ 操作系统权限。容器模式需要提前拉取镜像,并配置相同的镜像名称:
78
+
79
+ ```sh
80
+ docker pull nixery.dev/shell/git/ripgrep/util-linux
81
+ ```
82
+
83
+ ```json
84
+ {
85
+ "apps": {
86
+ "maybecode": {
87
+ "execution": {
88
+ "mode": "container",
89
+ "image": "nixery.dev/shell/git/ripgrep/util-linux",
90
+ "network": "none",
91
+ "memoryBytes": 1073741824,
92
+ "cpuCount": 2
93
+ }
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ 镜像必须包含 `bash`、`git`、`rg` 和 `setsid`。容器使用非 root 用户、只读根目录、
100
+ 临时 `/tmp` 存储、禁用的网络,以及配置的内存和 CPU 限制。容器仅挂载工作目录。
101
+ 文件工具从宿主访问同一份文件。Shell、搜索工具、子 Agent 工具和已授权的团队检查
102
+ 使用配置的执行环境。MCP server 继续在宿主运行。Docker 服务不可用或镜像不存在时,
103
+ 应用启动失败。关闭应用时会等待执行资源终止。
104
+
105
+ `fetch` 默认访问公网 HTTP/HTTPS origin。配置 `apps.maybecode.fetch.allowedOrigins`
106
+ 后,请求仅允许访问列表中的 origin,列表可以明确开放本地服务。`maxBytes`、
107
+ `timeoutMs` 和 `maxRedirects` 限制响应。每个重定向目标都会重新检查。
108
+
109
+ ## 委派通知与模型更新
110
+
111
+ 自动请求和任务状态通知默认关闭。`/delegations notifications on|off|status` 管理
112
+ 当前进程的通知,`apps.maybecode.delegationNotifications: true` 在启动时开启通知。
113
+ 完整任务输出保存在持久记录中。
114
+
115
+ `/model` 选择模型,`/effort` 选择 reasoning effort。更新要求应用空闲,并且没有
116
+ 正在运行的 Goal 或等待处理的 MCP 交互。更新保留会话历史、Goal、Skills、工作笔记
117
+ 和权限模式。程序宿主通过 `controller.application.updateModel()` 更新模型。
118
+ 模型插件保留模型选择的所有权。更新失败后需要成功重试才能继续提交输入。
119
+
120
+ ## 会话分支与项目版本
121
+
122
+ 项目默认使用 Git。已有仓库保留当前分支。首次批准修改项目的工具时,新项目会初始化
123
+ 仓库。修改请求在执行工具前保存文件状态,并在完成修改、检查和委派后保存检查点。
124
+ 失败或取消的请求保留未提交文件。Git 需要预先配置用户身份。
125
+
126
+ `/fork` 根据完整回复创建会话分支,可以使用当前目录或新的 worktree。
127
+ `/worktrees` 查看和管理工作目录。`/changes` 查看当前或指定请求、会话、commit
128
+ 的文件变化。恢复文件需要预览和确认。
129
+
130
+ `apps.maybecode.git.autoCommit: false` 关闭自动提交,`readOnly: true` 限制项目
131
+ 修改,`git: false` 关闭项目 Git 管理。存储目录需要位于项目仓库之外。
132
+ 详见 [MaybeCode 指南](../../docs/zh-CN/guides/maybecode.md)。
133
+
134
+ ## Web UI
135
+
136
+ `/web` 打开当前工作目录和会话的浏览器界面。终端和浏览器共享输出、审批、模型选择
137
+ 和会话变化。连接链接一次有效,刷新或断开后可以重新执行 `/web`。关闭浏览器页面
138
+ 保留运行中的任务;退出终端会关闭应用和 Web 服务。
139
+
140
+ 单独运行 `maybecode --ui web` 时,设置 `MAYBECODE_CONTROL_TOKEN` 为长度
141
+ 32 至 256 的可打印 ASCII 字符串。默认端口为 3940,可以通过 `--port` 修改。
142
+ MCP 表单和 URL 交互提供预览、明确确认以及取消操作。
143
+ 详见 [Web UI 指南](../../docs/zh-CN/guides/web-ui.md)。
144
+
145
+ ## Plugin 组合与产品范围
146
+
147
+ `openConfiguredMaybeCode({ plugins })` 接受自定义插件。Model、Context、Permission、
148
+ Skills、Goals、History Memory、Delegation 和 Workspace Files 组成应用功能。
149
+ MCP 和 tracing 由配置宿主管理,同一工作目录中的会话复用连接。关闭宿主会释放连接
150
+ 和 tracing processor。选定插件按照服务和 identifier 替换默认提供者,并验证依赖。
151
+
152
+ MaybeCode 负责产品提示、工具装配、权限策略、修改预览、模型配置和界面命令。
153
+ May 的通用组件负责执行、取消、审批、会话历史、Context 和资源生命周期。
154
+
155
+ ## 非交互团队
156
+
157
+ `maybecode team run "Inspect this module" --workspace <path>` 默认启动两个只读
158
+ worker 和一个 supervisor。`--preset supervisor|pipeline|parallel` 或 `--plan`
159
+ 选择角色、模型、工具权限和依赖。团队使用独立目录、共享额度和持久任务记录。
160
+
161
+ 执行状态与验收状态分别记录。配置的检查产生 `passed`、`failed` 或 `unverified`
162
+ 验收结果。`--mode coding` 开放明确列出的修改工具,`--allow-checks` 单独授权
163
+ 配置中的检查命令。检查继承 `apps.maybecode.execution`。`team diff` 导出补丁,
164
+ `team apply --confirm <digest>` 在用户审阅后应用补丁。
165
+
166
+ `team status`、`resume`、`cancel`、`retry` 和 `reconcile` 管理状态与恢复。
167
+ 详见[团队指南](../../docs/zh-CN/guides/maybecode-team.md)、
168
+ [验收](../../docs/zh-CN/guides/maybecode-team-verification.md)、
169
+ [编程任务](../../docs/zh-CN/guides/maybecode-team-coding.md)和
170
+ [恢复](../../docs/zh-CN/guides/maybecode-team-recovery.md)。
171
+
172
+ ## 自定义界面与程序调用
173
+
174
+ 自定义界面通过 `MaybeCodeController` 提交操作,读取事件,并通过
175
+ `controller.application` 访问当前会话的应用。切换会话后重新读取该字段。
176
+ 以下示例使用已经配置的模型;在支持 TypeScript 的运行环境中执行:
177
+
178
+ ```ts
179
+ import { openConfiguredMaybeCode, type MaybeCodeController } from "@sortedyuan/maybecode";
180
+
181
+ const controller: MaybeCodeController = await openConfiguredMaybeCode({
182
+ configPath: "may.config.json",
183
+ });
184
+ const observation = (async () => {
185
+ for await (const event of controller.events) {
186
+ console.log(event);
187
+ }
188
+ })();
189
+
190
+ try {
191
+ console.log(controller.application.modelInfo);
192
+ await (
193
+ await controller.submit({ input: "Inspect this workspace." })
194
+ ).result;
195
+ } finally {
196
+ await controller.close();
197
+ await observation;
198
+ }
199
+ ```
200
+
201
+ 控制器支持提交、steering、取消、审批、会话管理、历史以及 Context 管理。
202
+ 执行期间普通输入会取消当前操作并等待终止,然后开始新输入;`/steer` 在当前 Step
203
+ 完成后接收额外输入。`/stop` 取消当前操作和等待中的输入。
204
+
205
+ retained 界面支持鼠标滚动、文本选择、剪贴板和终端 Markdown。`Ctrl+G` 后按 `D`
206
+ 切换工具详情,按 `T` 切换 reasoning 显示,按 `R` 定位当前请求的完整回复。
207
+ `Tab` 切换到会话内容,方向键和 PageUp/PageDown 浏览内容。编辑区方向键管理输入
208
+ 历史,`Ctrl+J` 插入换行,`Enter` 提交。`MAY_TUI_LEADER` 和 `MAY_CLIPBOARD`
209
+ 配置快捷键与剪贴板行为。
210
+
211
+ ## 运行配置
212
+
213
+ 支持 `deepseek-chat`、`zhipu-chat`、`kimi-chat`、`anthropic-messages`、
214
+ `openai-responses` 和 `openai-chat-completions` adapter。模型的
215
+ `contextWindowTokens` 和 `maxOutputTokens` 提供 Context 预算信息。
216
+
217
+ 交互模式默认对暂时性模型请求错误最多尝试三次;`apps.maybecode.retry` 配置次数
218
+ 和等待时间,`false` 关闭重试。Team 模式分别计算每次 provider 请求。
219
+
220
+ `apps.maybecode.observability` 配置不含内容的 JSONL tracing,默认关闭。
221
+ 文件名称包含本地日期,默认保留 60 天。关闭工作目录后刷新并关闭 processor。
222
+
223
+ `apps.maybecode.mcpServers` 配置宿主 stdio 或 Streamable HTTP server。
224
+ `/mcp` 查看连接与工具,`refresh` 更新目录,`reconnect` 重新连接。
225
+ 环境变量引用必须在启动时存在。OAuth 登录使用 `maybecode mcp login`。
226
+ 资源、prompt、采样和长期任务的权限与生命周期见
227
+ [MCP 指南](../../docs/zh-CN/guides/mcp.md)。
228
+
229
+ ## 指令
230
+
231
+ `apps.maybecode.instructionsDirectory` 指定包含非空 UTF-8 `system.md` 的目录,
232
+ 相对路径以配置文件目录为起点。它替换内置系统提示。
233
+ 项目规则从项目根目录到工作目录逐层读取,每层优先使用 `AGENTS.override.md`,
234
+ 其次使用 `AGENTS.md`。每个文件以及合计内容分别受 32 KiB 限制。
235
+ 应用打开、接受输入和每次 Run 前刷新项目规则。`/instructions` 查看有效内容。
236
+ 详见[指令组合](../../docs/zh-CN/guides/maybecode-instructions.md)。
237
+
238
+ ## 命令、Context 与存储
239
+
240
+ `/new` 创建会话,`/resume` 管理历史会话,`/model` 和 `/effort` 管理模型,
241
+ `/retry` 继续失败请求,`/status` 和 `/context` 查看状态,`/help` 查看命令。
242
+ `/skills` 管理 Skills。`/goal start|status|pause|resume|cancel` 管理持久目标。
243
+ `/recovery` 查看需要用户验证结果的中断工具记录。
244
+
245
+ 自动 Context 管理提供 `prune-summary`、`history-reference` 和 `provider-native`
246
+ 三种模式。历史引用模式使用持久工作笔记和历史检索,provider-native 要求模型支持。
247
+ Context 变化写入会话记录,恢复会话时重新使用。`context_notes` 保存当前会话笔记,
248
+ `get_context_remaining` 提供用量估计。详见
249
+ [Context 管理](../../docs/zh-CN/guides/maybecode.md)。
250
+
251
+ 会话记录和目录默认保存在 `~/.may/maybecode`,内容为明文,每个会话需要单个活动
252
+ 写入者。文件修改提供有界 diff 预览,并记录版本化展示事件以支持会话恢复。
253
+
254
+ ## 测试
255
+
256
+ ```sh
257
+ pnpm --filter @sortedyuan/maybecode test
258
+ pnpm test:package:maybecode
259
+ ```
260
+
261
+ 打包检查安装完整依赖到独立消费者目录,编译两个 README 中的 TypeScript 示例,
262
+ 执行安装后的 `maybecode --help`,并验证 Web UI 启动。开发环境使用仓库声明的
263
+ pnpm 版本。外部依赖优先使用缓存,并按需从 registry 下载。
264
+
265
+ `pnpm test:integration:maybecode` 使用用户配置进行真实 DeepSeek 请求。
266
+ 持久权限集成测试需要明确启用 `MAYBECODE_PERSISTENT_RULES_LIVE=1`,使用实际
267
+ provider 创建独立文件并验证规则复用。详情见 [English README](README.md#tests)。