@minimax-ai/code 0.4.0 → 0.4.2

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 (26) hide show
  1. package/CHANGELOG.md +93 -48
  2. package/CHANGELOG.zh-CN.md +51 -12
  3. package/README.md +11 -1
  4. package/README.zh-CN.md +39 -2
  5. package/chunks/{azure-openai-responses-OAPIGHCQ.js → azure-openai-responses-HOJR5DNA.js} +1 -1
  6. package/chunks/{chunk-3CBMWQ6F.js → chunk-BEBFQY6O.js} +1 -1
  7. package/chunks/{chunk-WYU2W43S.js → chunk-BEUVALD2.js} +612 -603
  8. package/chunks/{chunk-WSVP72I3.js → chunk-HEAI577S.js} +1 -1
  9. package/chunks/chunk-JCDDI4WJ.js +2 -0
  10. package/chunks/{chunk-ORVAHBJL.js → chunk-OJA2IAQ6.js} +2 -2
  11. package/chunks/chunk-SD6SJL3L.js +11 -0
  12. package/chunks/{chunk-TOORQIFW.js → chunk-VFMQBQ74.js} +442 -442
  13. package/chunks/{dist-UYNXCH7Y.js → dist-QF3JV3LN.js} +1 -1
  14. package/chunks/{launcher-A64GFJG2.js → launcher-TUY2TFYJ.js} +154 -154
  15. package/chunks/{lifecycle-D5KSTWZI.js → lifecycle-6JTTIEH2.js} +1 -1
  16. package/chunks/{main-BATWFEJC.js → main-RHDM3DSB.js} +1 -1
  17. package/chunks/{openai-codex-responses-OKBVUABU.js → openai-codex-responses-5BJTY4II.js} +1 -1
  18. package/chunks/{openai-responses-4ZH3D54Q.js → openai-responses-FRXGNXAR.js} +1 -1
  19. package/chunks/{plugin-command-524JANV6.js → plugin-command-34BQGAX4.js} +1 -1
  20. package/chunks/{provider-command-HHC2RGTN.js → provider-command-XOI6VZ4Z.js} +1 -1
  21. package/chunks/{run-acp-command-GF7NFIY7.js → run-acp-command-BH3V7PS6.js} +3 -3
  22. package/chunks/{run-exec-command-PV4LGXQY.js → run-exec-command-FMHHG5HZ.js} +1 -1
  23. package/cli.js +1 -1
  24. package/package.json +1 -1
  25. package/chunks/chunk-IHFSGO5Y.js +0 -2
  26. package/chunks/chunk-ZA4WKJYS.js +0 -13
package/CHANGELOG.md CHANGED
@@ -7,22 +7,69 @@ This changelog covers important changes that directly affect MCode TUI users. It
7
7
 
8
8
  Internal refactors, test-only changes, and changes limited to other product surfaces are excluded.
9
9
 
10
+ ## 0.4.2 · 2026-09-11
11
+
12
+ ### Added
13
+
14
+ - Automatically load project MCP servers from `.mcp.json` in the session's main working directory,
15
+ with configuration sources and connection status visible in `/mcp`.
16
+ - Switch supported model context sizes, including M3 512K / 1M, with Tab / Shift+Tab in `/model`;
17
+ save the selection for the current session and future use.
18
+ - Where OpenAI Codex login is available, choose browser or device code login, with cancellation and
19
+ retry for expired codes.
20
+
21
+ ### Improved
22
+
23
+ - Refresh a third-party connection's model list in `/provider` with `r`, and edit its API Key, Base
24
+ URL, models, or alias with `e`.
25
+ - Reuse an existing provider connection when adding models without entering the API Key again; add
26
+ another account explicitly when needed.
27
+
28
+ ### Fixed
29
+
30
+ - Fixed mismatched tool arguments when multiple OpenAI Responses tool calls stream concurrently.
31
+ - The side-conversation shortcut now clearly warns when no side conversation exists and directs you
32
+ to run `/btw` first.
33
+
34
+ ## 0.4.1 · 2026-09-11
35
+
36
+ ### Improved
37
+
38
+ - Switching models in an existing conversation warns that prompt cache reuse may be lost and
39
+ additional costs may apply.
40
+ - Goal displays its current wait reason, including result verification.
41
+ - Goal pauses after three consecutive rounds without tool calls to prevent continued idle execution.
42
+
43
+ ### Fixed
44
+
45
+ - Restored the terminal-specific system prompt, with capability instructions following the enabled
46
+ features.
47
+ - Fixed Goal continuation after user intervention and late usage settlement, and allowed queued user
48
+ messages to proceed while a Goal waits on dependencies.
49
+ - Shortcut hints follow custom keybindings, including aliases and disabled bindings.
50
+ - Background task details show the full command and error, wrapping long and multiline content.
51
+
10
52
  ## 0.4.0 · 2026-09-11
11
53
 
12
54
  ### Added
13
55
 
14
- - Review local changes with `/review` or `mcode exec review`, with findings linked to file locations.
15
- - Run Shell commands with `!`, keep results local with `!!`, and use Tab to complete commands and paths.
16
- - Customize the status line interactively with `/statusline`, apply changes immediately, and display output from a custom command.
56
+ - Review local changes with `/review` or `mcode exec review`, with findings linked to file
57
+ locations.
58
+ - Run Shell commands with `!`, keep results local with `!!`, and use Tab to complete commands and
59
+ paths.
60
+ - Customize the status line interactively with `/statusline`, apply changes immediately, and display
61
+ output from a custom command.
17
62
 
18
63
  ### Improved
19
64
 
20
- - Slash commands support argument hints and continued completion; command panels use consistent titles, borders, and action bars.
65
+ - Slash commands support argument hints and continued completion; command panels use consistent
66
+ titles, borders, and action bars.
21
67
  - Headless tasks provide structured output validation and clearer progress and failure diagnostics.
22
68
 
23
69
  ### Fixed
24
70
 
25
- - Improved recovery when context compaction encounters oversized input, and preserved history consistency when forking conversations.
71
+ - Improved recovery when context compaction encounters oversized input, and preserved history
72
+ consistency when forking conversations.
26
73
  - Diagnostic reports retain available files when part of the collection fails.
27
74
 
28
75
  ## 0.3.11 · 2026-09-09
@@ -43,7 +90,8 @@ Internal refactors, test-only changes, and changes limited to other product surf
43
90
  ### Fixed
44
91
 
45
92
  - `/btw` and `/side` sessions now follow the parent session permission mode without an extra
46
- confirmation step. Full access needs no additional approval; other modes retain their normal checks.
93
+ confirmation step. Full access needs no additional approval; other modes retain their normal
94
+ checks.
47
95
  - Draft recovery cleanup skips missing files, preventing repeated no-op deletions from exhausting
48
96
  the safety budget and disrupting later operations.
49
97
 
@@ -51,8 +99,8 @@ Internal refactors, test-only changes, and changes limited to other product surf
51
99
 
52
100
  ### Improved
53
101
 
54
- - `/status` now shows the running version, account and plan, instruction file sources,
55
- Default/Plan mode transitions, and remaining 5-hour and weekly quotas with reset countdowns.
102
+ - `/status` now shows the running version, account and plan, instruction file sources, Default/Plan
103
+ mode transitions, and remaining 5-hour and weekly quotas with reset countdowns.
56
104
  - The compact status panel wraps long paths and keeps local configuration visible while account
57
105
  details load or when the account request fails.
58
106
  - `/logout` and `mcode logout` print a complete browser sign-out link and open the page for the
@@ -71,8 +119,8 @@ Internal refactors, test-only changes, and changes limited to other product surf
71
119
  fewer history replays during terminal resizing, and clearer tool retry summaries.
72
120
  - The default status line warns when remaining context reaches 25% or less. Explicitly configuring
73
121
  `context-remaining` keeps valid usage visible; narrow terminals prioritize essential status.
74
- - Terminal notifications support focus-aware policies and configurable delivery methods, with improved
75
- compatibility for cmux. Composer keyboard hints follow the current platform.
122
+ - Terminal notifications support focus-aware policies and configurable delivery methods, with
123
+ improved compatibility for cmux. Composer keyboard hints follow the current platform.
76
124
 
77
125
  ### Fixed
78
126
 
@@ -86,19 +134,19 @@ Internal refactors, test-only changes, and changes limited to other product surf
86
134
  ### Fixed
87
135
 
88
136
  - When MCode shares its data directory with MiniMax Desktop, official model endpoints are now
89
- resolved in memory for the current environment: reading configuration or first-run
90
- initialization no longer writes new official endpoints into the shared config file, so older
91
- Desktop versions keep working alongside the TUI. Custom (BYOK) endpoints behave as before.
137
+ resolved in memory for the current environment: reading configuration or first-run initialization
138
+ no longer writes new official endpoints into the shared config file, so older Desktop versions
139
+ keep working alongside the TUI. Custom (BYOK) endpoints behave as before.
92
140
  - Legacy model recovery now also covers numbered model aliases and retired default models, and
93
- applies consistently to the model list, Goal model checks, and login checks: selections
94
- pointing at the legacy official gateway resolve to the same-name official model, then the
95
- configured default model, then the current official default. Shared default models, session
96
- model references, and migration records are preserved; only explicit user selections are
97
- written back to configuration.
98
- - Installing or updating with npm 12 no longer breaks the native SQLite module: install and
99
- update authorize the MCode and `better-sqlite3` lifecycle scripts and keep optional native
100
- dependencies. When native SQLite fails to load, startup prints a repair command matching the
101
- install registry, and early startup errors are reported instead of failing silently.
141
+ applies consistently to the model list, Goal model checks, and login checks: selections pointing
142
+ at the legacy official gateway resolve to the same-name official model, then the configured
143
+ default model, then the current official default. Shared default models, session model references,
144
+ and migration records are preserved; only explicit user selections are written back to
145
+ configuration.
146
+ - Installing or updating with npm 12 no longer breaks the native SQLite module: install and update
147
+ authorize the MCode and `better-sqlite3` lifecycle scripts and keep optional native dependencies.
148
+ When native SQLite fails to load, startup prints a repair command matching the install registry,
149
+ and early startup errors are reported instead of failing silently.
102
150
 
103
151
  ## 0.3.5 · 2026-09-07
104
152
 
@@ -106,58 +154,55 @@ Internal refactors, test-only changes, and changes limited to other product surf
106
154
 
107
155
  - Legacy model repair now also covers resuming sessions and queued messages, not just startup:
108
156
  selections from the legacy custom provider switch to the same model on the official MiniMax
109
- provider, or to the official default model when the same model is unavailable, and the repair
110
- is saved to the session or default configuration. The model list no longer shows legacy
111
- entries.
112
- - After a response fails or is stopped, queued messages that have not run yet are kept and shown
113
- as paused. Run `/queue` and press `c` to continue from the front of the queue; pending
114
- messages can also be edited, restored, or deleted. Sending a new message while paused offers
115
- to send it first and then continue the original queue, or to clear pending messages first;
116
- cancelling keeps your draft. Reopening the session shows the paused queue and waits for you to
117
- continue.
157
+ provider, or to the official default model when the same model is unavailable, and the repair is
158
+ saved to the session or default configuration. The model list no longer shows legacy entries.
159
+ - After a response fails or is stopped, queued messages that have not run yet are kept and shown as
160
+ paused. Run `/queue` and press `c` to continue from the front of the queue; pending messages can
161
+ also be edited, restored, or deleted. Sending a new message while paused offers to send it first
162
+ and then continue the original queue, or to clear pending messages first; cancelling keeps your
163
+ draft. Reopening the session shows the paused queue and waits for you to continue.
118
164
  - In-TUI updates now run npm with MCode's own Node runtime and validate the new version's native
119
165
  modules with that exact runtime before activation, fixing startup failures after updating on
120
166
  machines whose system Node version differs. If validation fails, the previous version stays
121
167
  active.
122
- - The macOS/Linux installer resolves the selected Node to its real path for install, launcher,
123
- and receipt, and re-checks native modules with that runtime on reruns. Broken same-version
168
+ - The macOS/Linux installer resolves the selected Node to its real path for install, launcher, and
169
+ receipt, and re-checks native modules with that runtime on reruns. Broken same-version
124
170
  installations now enter a repair install automatically instead of being reported as healthy.
125
171
 
126
172
  ## 0.3.4 · 2026-09-06
127
173
 
128
174
  ### Improved
129
175
 
130
- - On startup, when the selected model comes from the legacy custom provider, the TUI
131
- automatically switches to the same model on the official MiniMax provider.
176
+ - On startup, when the selected model comes from the legacy custom provider, the TUI automatically
177
+ switches to the same model on the official MiniMax provider.
132
178
 
133
179
  ### Fixed
134
180
 
135
- - `/login` and `/logout` are always available. `/login` refreshes credentials with the server
136
- even when already signed in and keeps you signed in if a transient refresh fails; `/logout`
137
- safely does nothing when already signed out.
181
+ - `/login` and `/logout` are always available. `/login` refreshes credentials with the server even
182
+ when already signed in and keeps you signed in if a transient refresh fails; `/logout` safely does
183
+ nothing when already signed out.
138
184
  - When the server permanently rejects saved credentials, the TUI clears them and falls back to
139
- device authorization instead of looping on `/login` errors. Temporary or configuration errors
140
- no longer discard valid credentials.
141
- - Service or resource failures now report the actual failure instead of asking you to sign in
142
- again; sign-in prompts appear only when signing in is really required.
185
+ device authorization instead of looping on `/login` errors. Temporary or configuration errors no
186
+ longer discard valid credentials.
187
+ - Service or resource failures now report the actual failure instead of asking you to sign in again;
188
+ sign-in prompts appear only when signing in is really required.
143
189
  - Domestic accounts sign in through the updated authentication endpoint.
144
190
  - Draft recovery failures no longer interfere with typing or other user actions.
145
- - Duplicate session history manifests are recovered automatically so session history keeps
146
- loading.
191
+ - Duplicate session history manifests are recovered automatically so session history keeps loading.
147
192
 
148
193
  ## 0.3.3 · 2026-09-05
149
194
 
150
195
  ### Improved
151
196
 
152
- - Side conversation footers now name the view that the switch shortcut opens. Terminal.app on
153
- macOS displays the supported `Ctrl+-` shortcut for switching between main and side views.
197
+ - Side conversation footers now name the view that the switch shortcut opens. Terminal.app on macOS
198
+ displays the supported `Ctrl+-` shortcut for switching between main and side views.
154
199
 
155
200
  ### Fixed
156
201
 
157
202
  - Signing in and out now synchronizes the running session's credentials immediately, including
158
203
  repeated sign-out requests, instead of waiting for background credential notifications.
159
- - Content review can recover from an expired credential and retry once with a new credential.
160
- If recovery fails, the request remains blocked and prompts you to sign in again.
204
+ - Content review can recover from an expired credential and retry once with a new credential. If
205
+ recovery fails, the request remains blocked and prompts you to sign in again.
161
206
 
162
207
  ## 0.3.2 · 2026-09-04
163
208
 
@@ -8,6 +8,41 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
8
8
 
9
9
  仅内部重构、测试调整,或只影响其他产品界面且不改变 TUI 行为的变化不记录。
10
10
 
11
+ ## 0.4.2 · 2026-09-11
12
+
13
+ ### 新增
14
+
15
+ - 自动加载会话主工作目录 `.mcp.json` 中的项目 MCP 服务,可在 `/mcp` 查看配置来源与连接状态。
16
+ - 在 `/model` 中通过 Tab / Shift+Tab 切换模型支持的上下文档位,包括 M3 的 512K /
17
+ 1M,并应用到当前会话、保存为默认值。
18
+ - 已提供 OpenAI
19
+ Codex 登录入口的版本支持选择浏览器登录或设备码登录,可取消授权,并在验证码过期后重试。
20
+
21
+ ### 改进
22
+
23
+ - 在 `/provider` 按 `r` 刷新第三方连接的模型列表,按 `e` 编辑 API Key、Base URL、模型或别名。
24
+ - 添加模型时可复用已有 Provider 连接,无需重新输入 API Key;需要多个账号时可明确添加另一连接。
25
+
26
+ ### 修复
27
+
28
+ - 修复 OpenAI Responses 多个工具调用交错流式返回时,工具参数错配的问题。
29
+ - 尚未创建侧会话时,切换快捷键会明确提示先运行 `/btw`,避免误以为快捷键会创建侧会话。
30
+
31
+ ## 0.4.1 · 2026-09-11
32
+
33
+ ### 改进
34
+
35
+ - 在已有会话中切换模型时,提示可能无法复用提示词缓存并产生额外费用。
36
+ - Goal 展示具体等待原因,包括正在验证结果的状态。
37
+ - Goal 连续三轮未调用工具时自动暂停,避免持续空转。
38
+
39
+ ### 修复
40
+
41
+ - 恢复终端专用系统提示词,能力指令随功能开关生效。
42
+ - 修复 Goal 被用户消息打断后停止续跑、延迟用量结算干扰执行,以及等待依赖时阻塞排队消息的问题。
43
+ - 快捷键提示跟随自定义绑定,正确展示别名和已禁用的按键。
44
+ - 后台任务详情显示完整命令和错误信息,长文本及多行内容自动换行。
45
+
11
46
  ## 0.4.0 · 2026-09-11
12
47
 
13
48
  ### 新增
@@ -43,16 +78,19 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
43
78
 
44
79
  ### 问题修复
45
80
 
46
- - `/btw` 和 `/side` 侧会话沿用主会话的当前权限模式,不再追加独立确认;Full access 下无需额外确认,其他模式仍按正常权限规则处理。
81
+ - `/btw` 和 `/side` 侧会话沿用主会话的当前权限模式,不再追加独立确认;Full
82
+ access 下无需额外确认,其他模式仍按正常权限规则处理。
47
83
  - 草稿恢复清理会跳过不存在的文件,避免反复无效删除耗尽安全预算、干扰后续操作。
48
84
 
49
85
  ## 0.3.8 · 2026-09-07
50
86
 
51
87
  ### 体验改进
52
88
 
53
- - `/status` 补齐运行版本、账号与套餐、指令文件来源、Default/Plan 切换状态,以及 5 小时和每周额度的剩余比例与重置倒计时。
89
+ - `/status`
90
+ 补齐运行版本、账号与套餐、指令文件来源、Default/Plan 切换状态,以及 5 小时和每周额度的剩余比例与重置倒计时。
54
91
  - 状态面板采用紧凑布局,长路径自动换行;账号信息加载中或查询失败时,仍可查看本地配置。
55
- - `/logout` 和 `mcode logout` 会打印完整的浏览器登出链接,并打开当前地区和环境对应的登出页。开发机或无图形界面环境可复制链接手动打开,命令完成无需等待浏览器或页面结果。
92
+ - `/logout` 和 `mcode logout`
93
+ 会打印完整的浏览器登出链接,并打开当前地区和环境对应的登出页。开发机或无图形界面环境可复制链接手动打开,命令完成无需等待浏览器或页面结果。
56
94
 
57
95
  ### 问题修复
58
96
 
@@ -63,23 +101,24 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
63
101
  ### 改进
64
102
 
65
103
  - 长会话搜索和渲染更流畅:缓存搜索索引和稳定的 Markdown 内容,减少调整终端尺寸时的历史重绘,并更清晰地展示工具重试摘要。
66
- - 默认状态栏在剩余上下文不超过 25% 时提示;显式配置 `context-remaining` 可持续显示有效用量,窄屏优先保留关键状态。
104
+ - 默认状态栏在剩余上下文不超过 25% 时提示;显式配置 `context-remaining`
105
+ 可持续显示有效用量,窄屏优先保留关键状态。
67
106
  - 终端通知支持按焦点状态和发送方式配置,改善 cmux 兼容性;输入框快捷键提示适配当前平台。
68
107
 
69
108
  ### 修复
70
109
 
71
110
  - 改善切换账号、取消登录和离线启动时的共享登录恢复,处理并发凭据续期与延迟登出同步。
72
- - 安装和修复指引保留选定的包名、版本和 registry,并说明 npm 12 阻止安装脚本时如何恢复原生 SQLite 依赖。
111
+ - 安装和修复指引保留选定的包名、版本和 registry,并说明 npm
112
+ 12 阻止安装脚本时如何恢复原生 SQLite 依赖。
73
113
 
74
114
  ## 0.3.6 · 2026-09-07
75
115
 
76
116
  ### 问题修复
77
117
 
78
118
  - 与 MiniMax 桌面端共用数据目录时,官方模型地址改为在 TUI 内按当前环境解析:读取配置和首次初始化不再向共享配置文件写入新的官方地址,避免影响旧版桌面端;自定义(BYOK)服务地址行为不变。
79
- - 遗留模型自动恢复扩展到编号模型别名和已下线的默认模型,并统一覆盖模型列表、Goal
80
- 模型校验和登录检查:指向旧官方网关的模型选择依次解析为官方同名模型、配置默认模型和当前官方默认模型;共享默认模型、会话模型引用和迁移记录保持不变,仅用户主动选择模型才会写回配置。
81
- - 修复 npm 12 下安装或更新导致 SQLite 原生模块损坏的问题:安装和更新会授权 MCode 与
82
- `better-sqlite3` 的安装脚本并保留可选原生依赖;原生模块加载失败时,启动会按安装来源给出对应的修复命令,启动早期错误也会如实报告而不是静默失败。
119
+ - 遗留模型自动恢复扩展到编号模型别名和已下线的默认模型,并统一覆盖模型列表、Goal模型校验和登录检查:指向旧官方网关的模型选择依次解析为官方同名模型、配置默认模型和当前官方默认模型;共享默认模型、会话模型引用和迁移记录保持不变,仅用户主动选择模型才会写回配置。
120
+ - 修复 npm 12 下安装或更新导致 SQLite 原生模块损坏的问题:安装和更新会授权 MCode 与 `better-sqlite3`
121
+ 的安装脚本并保留可选原生依赖;原生模块加载失败时,启动会按安装来源给出对应的修复命令,启动早期错误也会如实报告而不是静默失败。
83
122
 
84
123
  ## 0.3.5 · 2026-09-07
85
124
 
@@ -88,8 +127,7 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
88
127
  - 旧版自定义渠道模型的自动修复从启动时扩展到恢复会话和排队消息:遗留模型选择会切换为官方渠道同名模型,同名模型不可用时使用官方默认模型,并保存到对应会话或默认配置;模型列表不再显示遗留渠道入口。
89
128
  - 响应失败或被停止后,尚未执行的排队消息会保留并显示暂停状态。运行 `/queue` 后按 `c`
90
129
  可从队首继续,也可以编辑、恢复或删除待发送消息;暂停期间发送新消息时,可选择先发送新消息再继续原队列,或先清空待发送消息,取消则保留草稿。重新打开会话会显示暂停队列,等待主动继续。
91
- - TUI 内更新改用 MCode 自带的 Node 运行 npm,并在激活前用同一运行时校验新版本的原生模块,修复系统
92
- Node 版本不同导致更新后无法启动的问题;校验失败时保持旧版本可用。
130
+ - TUI 内更新改用 MCode 自带的 Node 运行 npm,并在激活前用同一运行时校验新版本的原生模块,修复系统 Node 版本不同导致更新后无法启动的问题;校验失败时保持旧版本可用。
93
131
  - macOS/Linux 安装器将所选 Node 解析为真实路径,统一用于安装、启动器和安装回执,重跑时按该运行时检查原生模块;同版本安装损坏时自动进入修复安装,无需手动清理安装目录。
94
132
 
95
133
  ## 0.3.4 · 2026-09-06
@@ -100,7 +138,8 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
100
138
 
101
139
  ### 问题修复
102
140
 
103
- - `/login` 和 `/logout` 命令始终可用:`/login` 在已登录时也会向服务端换取新凭据,瞬时刷新失败则保持已登录状态;`/logout` 在已登出时安全跳过。
141
+ - `/login` 和 `/logout` 命令始终可用:`/login`
142
+ 在已登录时也会向服务端换取新凭据,瞬时刷新失败则保持已登录状态;`/logout` 在已登出时安全跳过。
104
143
  - 登录凭据被服务端永久拒绝时,自动清除失效凭据并回退到设备授权流程重新登录,修复 `/login`
105
144
  反复报错的死循环;临时错误或配置错误不再误清除有效凭据。
106
145
  - 服务或资源故障时如实报告失败原因,仅在确实需要登录时才提示重新登录。
package/README.md CHANGED
@@ -107,7 +107,9 @@ Composer, so a long-running Session does not lose input space as work accumulate
107
107
  open the unified detail view. It lists every task and its state, opens Agent child transcripts with
108
108
  Enter, retains recent completed Runtime tasks after their results are delivered, and exposes task
109
109
  metadata without taking ownership of task state. Delivered history does not keep the Composer
110
- summary visible. `Ctrl+T` continues to open the Todo plan.
110
+ summary visible. `Ctrl+T` continues to open the Todo plan. Background task details show errors first
111
+ and wrap the full Bash command while preserving source line breaks. Use PgUp/PgDn to scroll and
112
+ Esc to return. Older tasks without stored command source show only their existing Description.
111
113
 
112
114
  ### Headless and CI
113
115
 
@@ -229,6 +231,10 @@ mcode --lane oauth2 exec "Verify the OAuth session"
229
231
 
230
232
  Production builds reject `--lane`, and MCode does not infer it from environment variables.
231
233
 
234
+ When you switch providers or models in an existing conversation, the Transcript shows a yellow
235
+ notice that the existing prompt cache may not be reusable and additional costs may occur. Initial
236
+ selection, reselecting the same model, and reasoning-only changes do not show this notice.
237
+
232
238
  Use `/model` in the TUI to select a model and reasoning level. Select `Add 3rd-party provider…` to
233
239
  search models.dev or configure a Custom Provider. API keys stay masked in the form, and Runtime
234
240
  tests the connection before saving and applying the selected model. Use the Provider commands to
@@ -382,3 +388,7 @@ npm uninstall -g @minimax-ai/code
382
388
  ## License
383
389
 
384
390
  MIT
391
+
392
+ ## 项目级 MCP
393
+
394
+ Runtime 自动加载会话主工作目录的 `.mcp.json`,与 Desktop、exec、ACP 共用配置规则;详见[项目级 MCP 配置](../local-runtime-v2/docs/project-mcp.md)。
package/README.zh-CN.md CHANGED
@@ -27,6 +27,18 @@ mcode
27
27
 
28
28
  MiniMax Code 会检查代码库、完成修改、运行能够执行的验证,并汇总已经确认的结果。
29
29
 
30
+ ## 内部包的 Codex 登录
31
+
32
+ 在 `/provider` 选择 OpenAI Codex,或在 `/model` 选择 Connect OpenAI Codex,再选择登录方式:
33
+
34
+ - **Browser login**:在当前电脑的浏览器完成登录。
35
+ - **Device code
36
+ login**:适用于 SSH、远程开发机。终端显示授权地址和一次性验证码,在自己电脑的浏览器打开地址并输入验证码。开发机会自动完成登录并刷新模型列表。
37
+
38
+ Device
39
+ code 需要在 ChatGPT 安全设置或工作区权限中开启。浏览器无法自动打开时,可手动访问终端里的地址。按
40
+ `Esc` 取消本次授权;验证码过期后可按 `Enter` 重试。
41
+
30
42
  ## 为什么选择 MiniMax Code
31
43
 
32
44
  | 能力 | 你可以获得什么 |
@@ -38,6 +50,19 @@ MiniMax Code 会检查代码库、完成修改、运行能够执行的验证,
38
50
  | 适配工作流 | 使用交互式 TUI、结构化 Headless 输出或 ACP 集成 |
39
51
  | 灵活扩展 | 选择模型和 Provider,并通过 Plugin 增加新能力 |
40
52
 
53
+ ### 刷新第三方模型与编辑连接
54
+
55
+ 在 `/provider` 选中第三方连接,按 `r` 使用已保存的 API Key 从该连接的模型列表接口获取最新模型。
56
+ 刷新只补充新模型,保留 provider ID、Key、已有模型的开关与自定义参数,也不会切换当前模型。
57
+ 完成后在 `/model` 选择新模型。查询失败时原配置不变;如果连接在刷新期间被其他窗口修改,请重新打开
58
+ `/provider` 后再刷新。
59
+
60
+ 按 `e` 可以修改第三方连接的 API Key、Base URL、模型 ID 列表或别名。修改先通过连接测试再保存,
61
+ 测试或保存失败时继续使用原配置;更换 Key 成功后,该连接下所有模型使用新 Key。
62
+
63
+ 在 `/model` 的“添加第三方”选择已配置的服务商时,默认提供“使用已有连接”,无需重新输入 Key,
64
+ 可选择或补充模型。只有明确选择“添加另一个账号”才创建新连接,并要求填写用于区分账号的别名。
65
+
41
66
  ## 按你的方式使用
42
67
 
43
68
  ### 交互式 TUI
@@ -94,6 +119,9 @@ TUI 启动层通过内部 `reviewPromptDir` 参数提供唯一资源目录;npm
94
119
  `Ctrl+C` 会关闭并丢弃侧会话。回到主视图后再次执行 `/btw`,会丢弃旧侧会话并从当前边界重新
95
120
  fork。侧会话是临时的:不会出现在 `/sessions` 或 `/resume` 中,切换到其他 Session 时会被自动清理。
96
121
 
122
+ 切换快捷键只切换已创建的侧会话,不会创建侧会话。尚未执行 `/btw` 时按切换快捷键,
123
+ Composer 会用黄色警告提示先运行 `/btw`。
124
+
97
125
  无参数的 TUI
98
126
  slash 命令只在命令名后没有正文时执行(允许尾随空白);如果继续输入正文,整句会作为普通提示词发送。接受参数的命令仍按命令处理。
99
127
 
@@ -105,7 +133,7 @@ Composer 会把当前输入标记为 `Prompt`、`Command`、`Shell` 或
105
133
  Agent Team 与 Runtime 后台任务会在 Composer 上方合并为一条按严重程度排序的 `Tasks`
106
134
  摘要,避免长程 Session 因任务累积而持续挤占输入空间。使用 `/tasks`
107
135
  可打开统一详情视图,查看当前完整列表和状态;按 Enter 可打开 Agent 子 Session 的 Transcript;近期已完成的 Runtime 任务在结果交付后仍会保留,但不会让 Composer 摘要持续显示。任务状态仍由 Runtime 持有,`Ctrl+T`
108
- 仍用于打开 Todo 计划。
136
+ 仍用于打开 Todo 计划。后台任务详情优先展示失败错误,并按终端宽度换行显示完整 Bash 命令(保留原始换行);可用 PgUp/PgDn 滚动、Esc 返回列表。旧任务若没有保存完整命令,只展示已有 Description 摘要。
109
137
 
110
138
  ### 直接执行终端命令
111
139
 
@@ -251,7 +279,12 @@ TUI 启动不再批量迁移历史会话的模型。指向官方网关的 `custo
251
279
 
252
280
  进入或退出 Plan 的下一条消息也使用上述恢复选择。选择 `Keep my draft` 或按 Esc 后,草稿可继续编辑、重新发送,不会发布本次发送的结果;尚未生效的 Plan 切换会保留。如果恢复发送时会话已经被另一轮占用,草稿会保留并提示失败,由用户再次发送。
253
281
 
254
- 在 TUI 中使用 `/model` 选择模型和推理强度。选择 `Add 3rd-party provider…`
282
+ 已有对话中成功切换 Provider 或模型后,Transcript 会显示一次黄色提示,提醒可能无法复用之前的缓存、
283
+ 并产生额外花费,不展示具体金额。初次选择、重复选择同一模型和仅调整推理强度不显示该提示。
284
+
285
+ 在 TUI 中使用 `/model` 选择模型和推理强度。支持多个上下文档位的模型(如 M3 的 512K / 1M)
286
+ 可用 Tab / Shift+Tab 切换上下文,左右键仍调整 Thinking / effort。Enter 同时应用到当前会话
287
+ 并保存为默认值,Esc 放弃本次调整;再次打开会恢复已保存的上下文。1M 等较高用量档位会显示提示。选择 `Add 3rd-party provider…`
255
288
  可从 models.dev 搜索已知 Provider 和模型,或配置 Custom Provider。API
256
289
  Key 在表单中保持掩码,Runtime 会先测试连通性,成功后才保存并应用所选模型。使用 Provider 命令查看或配置模型来源:
257
290
 
@@ -393,3 +426,7 @@ npm uninstall -g @minimax-ai/code
393
426
  ## License
394
427
 
395
428
  MIT
429
+
430
+ ## 项目级 MCP
431
+
432
+ Runtime 自动加载会话主工作目录的 `.mcp.json`,与 Desktop、exec、ACP 共用配置规则;详见[项目级 MCP 配置](../local-runtime-v2/docs/project-mcp.md)。
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{a as R,b as g,c as h}from"./chunk-ZA4WKJYS.js";import"./chunk-PWQHCWDV.js";import{a as y}from"./chunk-SHXPTUWI.js";import{b as f}from"./chunk-IIHJNKC3.js";import"./chunk-2UWBSJDH.js";import{f as d,i as l,k as A,m as E}from"./chunk-GUFBGYOC.js";import{a as m}from"./chunk-CK62QLTS.js";import"./chunk-WFWSBUYD.js";import"./chunk-D76SO2ME.js";var w="v1",U=new Set(["openai","openai-codex","opencode","azure-openai-responses"]);function O(r){let t=new Map;if(!r)return t;for(let e of r.split(",")){let s=e.trim();if(!s)continue;let[a,n]=s.split("=",2);!a||!n||t.set(a.trim(),n.trim())}return t}function I(r,t){return t?.azureDeploymentName?t.azureDeploymentName:O(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(r.id)||r.id}function z(r){if(r instanceof Error){let t=r.status,e=typeof t=="number"?t:void 0;return e!==void 0?`Azure OpenAI API error (${e}): ${r.message}`:r.message}try{return JSON.stringify(r)}catch{return String(r)}}var N=(r,t,e)=>{let s=new l;return(async()=>{let a=I(r,e),n={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let o=e?.apiKey;if(!o)throw new Error(`No API key for provider: ${r.provider}`);let i=L(r,o,e),u=M(r,t,e,a),c=await e?.onPayload?.(u,r);c!==void 0&&(u=c);let _={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:e?.maxRetries??0},{data:v,response:p}=await i.responses.create(u,_).withResponse();if(await e?.onResponse?.({status:p.status,headers:m(p.headers)},r),s.push({type:"start",partial:n}),await h(v,n,s,r),e?.signal?.aborted)throw new Error("Request was aborted");if(n.stopReason==="aborted"||n.stopReason==="error")throw new Error("An unknown error occurred");s.push({type:"done",reason:n.stopReason,message:n}),s.end()}catch(o){A(e?.onProviderError,o,r);for(let i of n.content)delete i.index,delete i.partialJson;n.stopReason=e?.signal?.aborted?"aborted":"error",n.errorMessage=z(o),s.push({type:"error",reason:n.stopReason,error:n}),s.end()}})(),s},V=(r,t,e)=>{let s=e?.apiKey;if(!s)throw new Error(`No API key for provider: ${r.provider}`);let a=E(r,e,s),n=e?.reasoning?d(r,e.reasoning):void 0;return N(r,t,{...a,reasoningEffort:n==="off"?void 0:n})};function P(r){let t=r.trim().replace(/\/+$/,""),e;try{e=new URL(t)}catch{throw new Error(`Invalid Azure OpenAI base URL: ${r}`)}let s=e.hostname.endsWith(".openai.azure.com")||e.hostname.endsWith(".cognitiveservices.azure.com"),a=e.pathname.replace(/\/+$/,"");return s&&(a===""||a==="/"||a==="/openai")&&(e.pathname="/openai/v1",e.search=""),e.toString().replace(/\/+$/,"")}function b(r){return`https://${r}.openai.azure.com/openai/v1`}function S(r,t){let e=t?.azureApiVersion||process.env.AZURE_OPENAI_API_VERSION||w,s=t?.azureBaseUrl?.trim()||process.env.AZURE_OPENAI_BASE_URL?.trim()||void 0,a=t?.azureResourceName||process.env.AZURE_OPENAI_RESOURCE_NAME,n=s;if(!n&&a&&(n=b(a)),!n&&r.baseUrl&&(n=r.baseUrl),!n)throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:P(n),apiVersion:e}}function L(r,t,e){let s={...r.headers};e?.headers&&Object.assign(s,e.headers);let{baseUrl:a,apiVersion:n}=S(r,e);return new f({apiKey:t,apiVersion:n,dangerouslyAllowBrowser:!0,defaultHeaders:s,baseURL:a})}function M(r,t,e,s){let a=R(r,t,U),n={model:s,input:a,stream:!0,prompt_cache_key:y(e?.sessionId),store:!1};if(e?.maxTokens&&(n.max_output_tokens=e?.maxTokens),e?.temperature!==void 0&&(n.temperature=e?.temperature),t.tools&&t.tools.length>0&&(n.tools=g(t.tools)),r.reasoning)if(e?.reasoningEffort||e?.reasoningSummary){let o=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:"medium";n.reasoning={effort:o,summary:e?.reasoningSummary||"auto"},n.include=["reasoning.encrypted_content"]}else r.thinkingLevelMap?.off!==null&&(n.reasoning={effort:r.thinkingLevelMap?.off??"none"});return n}export{N as streamAzureOpenAIResponses,V as streamSimpleAzureOpenAIResponses};
2
+ import{a as R,b as g,c as h}from"./chunk-SD6SJL3L.js";import"./chunk-PWQHCWDV.js";import{a as y}from"./chunk-SHXPTUWI.js";import{b as f}from"./chunk-IIHJNKC3.js";import"./chunk-2UWBSJDH.js";import{f as d,i as l,k as A,m as E}from"./chunk-GUFBGYOC.js";import{a as m}from"./chunk-CK62QLTS.js";import"./chunk-WFWSBUYD.js";import"./chunk-D76SO2ME.js";var w="v1",U=new Set(["openai","openai-codex","opencode","azure-openai-responses"]);function O(r){let t=new Map;if(!r)return t;for(let e of r.split(",")){let s=e.trim();if(!s)continue;let[a,n]=s.split("=",2);!a||!n||t.set(a.trim(),n.trim())}return t}function I(r,t){return t?.azureDeploymentName?t.azureDeploymentName:O(process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(r.id)||r.id}function z(r){if(r instanceof Error){let t=r.status,e=typeof t=="number"?t:void 0;return e!==void 0?`Azure OpenAI API error (${e}): ${r.message}`:r.message}try{return JSON.stringify(r)}catch{return String(r)}}var N=(r,t,e)=>{let s=new l;return(async()=>{let a=I(r,e),n={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let o=e?.apiKey;if(!o)throw new Error(`No API key for provider: ${r.provider}`);let i=L(r,o,e),u=M(r,t,e,a),c=await e?.onPayload?.(u,r);c!==void 0&&(u=c);let _={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:e?.maxRetries??0},{data:v,response:p}=await i.responses.create(u,_).withResponse();if(await e?.onResponse?.({status:p.status,headers:m(p.headers)},r),s.push({type:"start",partial:n}),await h(v,n,s,r),e?.signal?.aborted)throw new Error("Request was aborted");if(n.stopReason==="aborted"||n.stopReason==="error")throw new Error("An unknown error occurred");s.push({type:"done",reason:n.stopReason,message:n}),s.end()}catch(o){A(e?.onProviderError,o,r);for(let i of n.content)delete i.index,delete i.partialJson;n.stopReason=e?.signal?.aborted?"aborted":"error",n.errorMessage=z(o),s.push({type:"error",reason:n.stopReason,error:n}),s.end()}})(),s},V=(r,t,e)=>{let s=e?.apiKey;if(!s)throw new Error(`No API key for provider: ${r.provider}`);let a=E(r,e,s),n=e?.reasoning?d(r,e.reasoning):void 0;return N(r,t,{...a,reasoningEffort:n==="off"?void 0:n})};function P(r){let t=r.trim().replace(/\/+$/,""),e;try{e=new URL(t)}catch{throw new Error(`Invalid Azure OpenAI base URL: ${r}`)}let s=e.hostname.endsWith(".openai.azure.com")||e.hostname.endsWith(".cognitiveservices.azure.com"),a=e.pathname.replace(/\/+$/,"");return s&&(a===""||a==="/"||a==="/openai")&&(e.pathname="/openai/v1",e.search=""),e.toString().replace(/\/+$/,"")}function b(r){return`https://${r}.openai.azure.com/openai/v1`}function S(r,t){let e=t?.azureApiVersion||process.env.AZURE_OPENAI_API_VERSION||w,s=t?.azureBaseUrl?.trim()||process.env.AZURE_OPENAI_BASE_URL?.trim()||void 0,a=t?.azureResourceName||process.env.AZURE_OPENAI_RESOURCE_NAME,n=s;if(!n&&a&&(n=b(a)),!n&&r.baseUrl&&(n=r.baseUrl),!n)throw new Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:P(n),apiVersion:e}}function L(r,t,e){let s={...r.headers};e?.headers&&Object.assign(s,e.headers);let{baseUrl:a,apiVersion:n}=S(r,e);return new f({apiKey:t,apiVersion:n,dangerouslyAllowBrowser:!0,defaultHeaders:s,baseURL:a})}function M(r,t,e,s){let a=R(r,t,U),n={model:s,input:a,stream:!0,prompt_cache_key:y(e?.sessionId),store:!1};if(e?.maxTokens&&(n.max_output_tokens=e?.maxTokens),e?.temperature!==void 0&&(n.temperature=e?.temperature),t.tools&&t.tools.length>0&&(n.tools=g(t.tools)),r.reasoning)if(e?.reasoningEffort||e?.reasoningSummary){let o=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:"medium";n.reasoning={effort:o,summary:e?.reasoningSummary||"auto"},n.include=["reasoning.encrypted_content"]}else r.thinkingLevelMap?.off!==null&&(n.reasoning={effort:r.thinkingLevelMap?.off??"none"});return n}export{N as streamAzureOpenAIResponses,V as streamSimpleAzureOpenAIResponses};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{b as I}from"./chunk-TOORQIFW.js";import{J as $,S as k}from"./chunk-Y27DNFV2.js";import{e as X}from"./chunk-D76SO2ME.js";var _=X(I(),1);import{stripVTControlCharacters as F}from"node:util";function g(e){return F(e).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/gu,"")}var O=1e6,M=1e3,V=32,x=/^(?![A-Za-z]:[\\/])(?![\\/])(?!.*(?:^|[\\/])\.\.(?:[\\/]|$))[^\0]+$/u,L=/^sha256:[a-f0-9]{64}$/u,j=/^git-blob:[a-f0-9]{40,64}$/u;function ue(e){if(!E(e))return;let n=e.reviewOutcome;return n==="pass"||n==="needs_changes"||n==="failed"?n:void 0}function de(e){let n=e.trim();if(!(!n.startsWith("<annotation-result")||!n.endsWith("</annotation-result>")))try{let t=G(n);if(R(t,"annotation-result"),p(t,["version","source","review-run-id","trigger","mode","verdict"]),c(t,"version")!=="2"||c(t,"source")!=="code-review"||c(t,"verdict")!=="needs-changes"||!c(t,"review-run-id"))return;let r=c(t,"trigger"),i=c(t,"mode");if(r!=="slash"&&r!=="natural_language"||i!=="inline"&&i!=="subagent")return;f(t),T(t,["summary","annotations"]);let s=b(m(t,"summary")),o=m(t,"annotations");if(p(o,[]),f(o),o.children.some(u=>u.name!=="annotation"))return;let l=o.children.map(q);return!s||l.length===0?void 0:{schemaVersion:1,type:"review.result",scope:"local_changes",verdict:"needs_changes",summary:s,findings:l,mode:i}}catch{return}}function pe(e){let n=e.trim();if(n)return{schemaVersion:1,type:"review.result",scope:"local_changes",verdict:"pass",summary:n,findings:[]}}function ge(e){return!E(e)||e.schemaVersion!==1||e.type!=="review.result"||e.scope!=="local_changes"||e.verdict!=="pass"&&e.verdict!=="needs_changes"||typeof e.summary!="string"||!e.summary.trim()||!Array.isArray(e.findings)||!e.findings.every(U)||e.mode!==void 0&&e.mode!=="inline"&&e.mode!=="subagent"?!1:e.verdict==="pass"?e.findings.length===0:e.findings.length>0}function me(e){return e.verdict==="pass"?g(e.summary):[g(e.summary),...e.findings.flatMap(n=>["",`[${n.priority}] ${g(n.title)}`,g(W(n)),g(n.content)])].join(`
2
+ import{b as I}from"./chunk-VFMQBQ74.js";import{J as $,S as k}from"./chunk-Y27DNFV2.js";import{e as X}from"./chunk-D76SO2ME.js";var _=X(I(),1);import{stripVTControlCharacters as F}from"node:util";function g(e){return F(e).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/gu,"")}var O=1e6,M=1e3,V=32,x=/^(?![A-Za-z]:[\\/])(?![\\/])(?!.*(?:^|[\\/])\.\.(?:[\\/]|$))[^\0]+$/u,L=/^sha256:[a-f0-9]{64}$/u,j=/^git-blob:[a-f0-9]{40,64}$/u;function ue(e){if(!E(e))return;let n=e.reviewOutcome;return n==="pass"||n==="needs_changes"||n==="failed"?n:void 0}function de(e){let n=e.trim();if(!(!n.startsWith("<annotation-result")||!n.endsWith("</annotation-result>")))try{let t=G(n);if(R(t,"annotation-result"),p(t,["version","source","review-run-id","trigger","mode","verdict"]),c(t,"version")!=="2"||c(t,"source")!=="code-review"||c(t,"verdict")!=="needs-changes"||!c(t,"review-run-id"))return;let r=c(t,"trigger"),i=c(t,"mode");if(r!=="slash"&&r!=="natural_language"||i!=="inline"&&i!=="subagent")return;f(t),T(t,["summary","annotations"]);let s=b(m(t,"summary")),o=m(t,"annotations");if(p(o,[]),f(o),o.children.some(u=>u.name!=="annotation"))return;let l=o.children.map(q);return!s||l.length===0?void 0:{schemaVersion:1,type:"review.result",scope:"local_changes",verdict:"needs_changes",summary:s,findings:l,mode:i}}catch{return}}function pe(e){let n=e.trim();if(n)return{schemaVersion:1,type:"review.result",scope:"local_changes",verdict:"pass",summary:n,findings:[]}}function ge(e){return!E(e)||e.schemaVersion!==1||e.type!=="review.result"||e.scope!=="local_changes"||e.verdict!=="pass"&&e.verdict!=="needs_changes"||typeof e.summary!="string"||!e.summary.trim()||!Array.isArray(e.findings)||!e.findings.every(U)||e.mode!==void 0&&e.mode!=="inline"&&e.mode!=="subagent"?!1:e.verdict==="pass"?e.findings.length===0:e.findings.length>0}function me(e){return e.verdict==="pass"?g(e.summary):[g(e.summary),...e.findings.flatMap(n=>["",`[${n.priority}] ${g(n.title)}`,g(W(n)),g(n.content)])].join(`
3
3
  `)}function W(e){if(e.targetType==="file")return e.path;let n=e.startLine===e.endLine?String(e.startLine):`${String(e.startLine)}-${String(e.endLine)}`;return`${e.path}:${n}${e.side?` (${e.side})`:""}`}function q(e){if(R(e,"annotation"),p(e,["id","kind","priority"]),c(e,"kind")!=="code-review")throw new Error("annotation kind must be code-review");let n=c(e,"id"),t=c(e,"priority");if(!n||!C(t))throw new Error("annotation identity is invalid");f(e),T(e,["target","title","content"]);let r=z(m(e,"target")),i=b(m(e,"title")),s=b(m(e,"content"));if(!i||!s)throw new Error("annotation text is empty");return{id:n,priority:t,...r,title:i,content:s}}function z(e){R(e,"target");let n=c(e,"uri");if(!x.test(n)||c(e,"type")!=="file")throw new Error("annotation target is invalid");if(f(e),e.attributes.state==="deleted"){if(p(e,["type","uri","state","blob-revision"]),e.children.length>0||!j.test(c(e,"blob-revision")))throw new Error("deleted annotation target is invalid");return{targetType:"file",path:n}}p(e,["type","uri"]),T(e,["selector","related-change"]);let t=m(e,"selector");if(p(t,["type","side","start-line","end-line","anchor-revision","context-before","context-after"]),f(t),t.children.length>0||c(t,"type")!=="line-range")throw new Error("annotation selector is invalid");let r=c(t,"side"),i=y(c(t,"start-line")),s=y(c(t,"end-line")),o=t.attributes["anchor-revision"];if(r!=="old"&&r!=="new"||s<i||o!==void 0&&!L.test(o)||!A(t.attributes["context-before"])||!A(t.attributes["context-after"]))throw new Error("annotation selector is invalid");let l=H(e,"related-change");return l&&B(l),{targetType:"line-range",path:n,side:r,startLine:i,endLine:s}}function B(e){p(e,["path","side","start-line","end-line","revision"]),f(e);let n=c(e,"path"),t=c(e,"side"),r=y(c(e,"start-line")),i=y(c(e,"end-line"));if(e.children.length>0||!x.test(n)||t!=="old"&&t!=="new"||i<r||!L.test(c(e,"revision")))throw new Error("related change is invalid")}function G(e){if(e.length>O)throw new Error("Review result is too large");let n,t=!1,r=0,i="",s=[],o=new _.SaxesParser({xmlns:!1});if(o.on("opentag",l=>{r+=1,(r>M||s.length>=V)&&(t=!0);let u={name:l.name,attributes:Object.fromEntries(Object.entries(l.attributes).map(([d,w])=>[d,String(w)])),children:[],text:""},a=s.at(-1);a?a.children.push(u):n?t=!0:n=u,s.push(u)}),o.on("text",l=>{let u=s.at(-1);u?u.text+=l:i+=l}),o.on("closetag",()=>{s.pop()}),o.on("cdata",()=>{t=!0}),o.on("comment",()=>{t=!0}),o.on("doctype",()=>{t=!0}),o.on("processinginstruction",()=>{t=!0}),o.on("error",()=>{t=!0}),o.write(e).close(),t||!n||s.length>0||i.trim())throw new Error("Review result XML is invalid");return n}function b(e){if(p(e,[]),e.children.length>0)throw new Error(`${e.name} must contain text only`);return e.text.trim()}function R(e,n){if(e.name!==n)throw new Error(`Expected ${n}`)}function p(e,n){let t=[...n].sort().join("\0");if(Object.keys(e.attributes).sort().join("\0")!==t)throw new Error(`${e.name} attributes are invalid`)}function f(e){if(e.text.trim())throw new Error(`${e.name} contains unexpected text`)}function T(e,n){let t=new Set(n);if(e.children.some(r=>!t.has(r.name)))throw new Error(`${e.name} contains an unexpected element`)}function m(e,n){let t=e.children.filter(i=>i.name===n),r=t[0];if(t.length!==1||!r)throw new Error(`${e.name} must contain one ${n}`);return r}function H(e,n){let t=e.children.filter(r=>r.name===n);if(t.length>1)throw new Error(`${e.name} contains duplicate ${n}`);return t[0]}function c(e,n){let t=e.attributes[n];if(t===void 0)throw new Error(`${e.name}.${n} is required`);return t}function y(e){if(!/^[1-9]\d*$/u.test(e))throw new Error("Expected a positive integer");let n=Number(e);if(!Number.isSafeInteger(n))throw new Error("Integer is out of range");return n}function A(e){return e===void 0||/^[0-3]$/u.test(e)}function C(e){return e==="P0"||e==="P1"||e==="P2"||e==="P3"}function U(e){return!E(e)||typeof e.id!="string"||!e.id||typeof e.priority!="string"||!C(e.priority)||typeof e.path!="string"||!x.test(e.path)||typeof e.title!="string"||!e.title.trim()||typeof e.content!="string"||!e.content.trim()?!1:e.targetType==="file"?e.side===void 0&&e.startLine===void 0&&e.endLine===void 0:e.targetType==="line-range"&&(e.side==="old"||e.side==="new")&&typeof e.startLine=="number"&&Number.isSafeInteger(e.startLine)&&e.startLine>0&&typeof e.endLine=="number"&&Number.isSafeInteger(e.endLine)&&e.endLine>=e.startLine}function E(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var N=/<(?:deliver[-_]assets|media|publish[_-]artifact|preview_card|genui-|mavis-widget|mavis-thinking|mavis-progress|think|final|permission-(?:ask|response)|questionnaire-(?:ask|response))\b|^\s*preview_cards?:\s*$/imu;function we(e){let n=Z(e);return n.assets.length===0?n.text:[n.text,se(n.assets)].filter(Boolean).join(`
4
4
 
5
5
  `)}function Z(e){if(!e||!N.test(e))return{text:e,assets:[]};let n=$(e),t=[],r=[],i="\uE000mcode-protected";for(;e.includes(i);)i+="-";let s=!1,o=n.map(a=>{if(a.type==="protected"){let d=t.push(a.content)-1;return`${i}-${d}\uE001`}return N.test(a.content)?(s=!0,J(a.content,r)):a.content}).join("");if(!s)return{text:e,assets:[]};let l=oe(o);t.forEach((a,d)=>{l=l.replace(`${i}-${d}\uE001`,a)});let u=[...new Map(r.map(a=>[a.path.trim(),a])).values()];return{text:l,assets:u.map(a=>({path:a.path.trim(),...a.name?.trim()?{name:a.name.trim()}:{}}))}}function J(e,n){let t=e;return t=h(t,"mavis-thinking"),t=h(t,"think"),t=K(t,"mavis-progress"),t=h(t,"permission-ask"),t=h(t,"permission-response"),t=h(t,"questionnaire-ask"),t=h(t,"questionnaire-response"),t=t.replace(/<\/?final\b[^>]*>/giu,""),t=Q(t),t=Y(t),t=ee(t),t=ne(t),t=re(t,n),t=t.replace(/<\/?(?:deliver-assets|deliver_assets)\b[^>]*>/giu,"file attachment").replace(/<media\b[^>]*\/?>/giu,"file attachment").replace(/<media\b[^>]*$/iu,""),t}function h(e,n){let t=new RegExp(`<${n}\\b[^>]*>((?:(?!<${n}\\b)[\\s\\S])*?)<\\/${n}\\s*>`,"giu"),r=e,i=e.replace(t,"");for(;i!==r;)r=i,i=i.replace(t,"");return i}function K(e,n){let t=new RegExp(`<${n}\\b[^>]*>((?:(?!<${n}\\b)[\\s\\S])*?)<\\/${n}\\s*>`,"giu"),r=e,i=e.replace(t,(s,o)=>o.trim());for(;i!==r;)r=i,i=i.replace(t,(s,o)=>o.trim());return i}function Q(e){let n=/<mavis-widget\b([^>]*)>([\s\S]*?)<\/mavis-widget\s*>/giu,t=e.replace(n,(r,i,s)=>{let o=/<mavis-fallback\b[^>]*>([\s\S]*?)<\/mavis-fallback\s*>/iu.exec(s)?.[1];return o?.trim()?o.trim():S(v(i))});return t=t.replace(/<mavis-widget\b([^>]*)>[\s\S]*$/iu,(r,i)=>S(v(i))),t.replace(/<mavis-widget\b[^>]*$/iu,"Interactive content is loading\u2026")}function S(e){let n=e.kind?.trim(),t=e.title?.trim();return n&&t?`Interactive ${n}: ${t} (open in Desktop).`:t?`Interactive content: ${t} (open in Desktop).`:"Interactive content available in Desktop."}function Y(e){let n=/<genui-([\w-]+)\b([^>]*)>[\s\S]*?<\/genui-\1\s*>/giu,t=/<genui-([\w-]+)\b([^>]*?)\/\s*>/giu,r=e.replace(n,(i,s,o)=>D(s,v(o)));return r=r.replace(t,(i,s,o)=>D(s,v(o))),r.replace(/<genui-[\w-]*\b[^>]*$/iu,"Interactive content is loading\u2026")}function D(e,n){if(e.toLocaleLowerCase()==="mcp-auth"){let t=n.label?.trim()||n["server-id"]?.trim();return t?`MCP authorization required: ${t} (open in Desktop).`:"MCP authorization required (open in Desktop)."}if(e.toLocaleLowerCase()==="agent-team-recommendation"){let t=n.status?.trim().toLocaleLowerCase();return t==="accepted"?"Team recommendation accepted.":t==="skipped"?"Team recommendation skipped.":"Team recommendation available in Desktop."}return"Interactive content available in Desktop."}function v(e){let n={},t=/([\w-]+)\s*=\s*(["'])(.*?)\2/gu,r;for(;(r=t.exec(e))!==null;){let i=r[1],s=r[3];i&&s!==void 0&&(n[i]=te(s))}return n}function ee(e){let n=/<(deliver-assets|deliver_assets)\b[^>]*>\s*<\/\1\s*>/giu,t=e,r=e.replace(n,"");for(;r!==t;)t=r,r=r.replace(n,"");return r}function te(e){return e.replace(/&quot;/gu,'"').replace(/&apos;|&#39;/gu,"'").replace(/&lt;/gu,"<").replace(/&gt;/gu,">").replace(/&amp;/gu,"&")}function ne(e){let n=/<\/?(deliver-assets|deliver_assets)\b[^>]*>/giu,t=[],r;for(;(r=n.exec(e))!==null;)t.push({start:r.index,end:n.lastIndex,name:r[1]?.toLocaleLowerCase()??"",closing:r[0].startsWith("</")});if(t.length===0)return e;let i=[],s=new Set;if(t.forEach((u,a)=>{if(!u.closing){i.push(a);return}for(let d=i.length-1;d>=0;d-=1){let w=i[d];if(!(w===void 0||t[w]?.name!==u.name)){i.splice(d,1),s.add(w),s.add(a);return}}}),s.size===t.length)return e;let o=0,l="";return t.forEach((u,a)=>{l+=e.slice(o,u.start),l+=s.has(a)?e.slice(u.start,u.end):"file attachment",o=u.end}),l+e.slice(o)}function re(e,n){let t=e;for(let r=0;r<3;r+=1){let i=k(t),s=ie(i);if(s.assets.length===0)break;n.push(...s.assets),t=s.text}return t}function ie(e){let n=[],t=[];for(let r of e)r.type==="deliver-assets"||r.type==="image-gallery"?t.push(...r.items):r.content.trim()&&n.push(r.content.trim());return{text:n.join(`