@minimax-ai/code 0.4.7 → 0.4.9
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.
- package/CHANGELOG.md +43 -0
- package/CHANGELOG.zh-CN.md +31 -0
- package/README.md +16 -3
- package/README.zh-CN.md +24 -2
- package/assets/agents/_v2/explore.md.hbs +8 -0
- package/assets/agents/explore/agent.md +1 -0
- package/assets/agents/explore/system-prompt.md.hbs +9 -0
- package/assets/agents/mavis/features/delegation.md.hbs +4 -2
- package/chunks/{anthropic-LCJD7NOY.js → anthropic-MQQCIUHP.js} +1 -1
- package/chunks/{application-OZ6YEJNG.js → application-6MCV7ILB.js} +1 -1
- package/chunks/{auth-command-TP25VHV4.js → auth-command-T5DRRUNT.js} +1 -1
- package/chunks/{chunk-BNU46XHR.js → chunk-2CEKQTMO.js} +1 -1
- package/chunks/{chunk-RPO5CDCP.js → chunk-3V6OPTHM.js} +9 -9
- package/chunks/{chunk-YBZTB54I.js → chunk-AULSFRR7.js} +649 -646
- package/chunks/{chunk-2SW3R5AB.js → chunk-DV5WIEGS.js} +1 -1
- package/chunks/{chunk-SLRPB56L.js → chunk-HJ6CAPCI.js} +1 -1
- package/chunks/{chunk-SYLCIHHV.js → chunk-HMP2XYHW.js} +1 -1
- package/chunks/{chunk-OVLV6FQA.js → chunk-PMTJEVJF.js} +531 -531
- package/chunks/{chunk-W7JHDTPW.js → chunk-VCJI7AJO.js} +1 -1
- package/chunks/{chunk-C2OVBAOI.js → chunk-VOK3LP4U.js} +1 -1
- package/chunks/{chunk-QJWOGW27.js → chunk-VPHVKGPT.js} +1 -1
- package/chunks/{chunk-22LVIQ2T.js → chunk-WAVNKSSE.js} +1 -1
- package/chunks/{chunk-NELAOQAA.js → chunk-X5PAB4UH.js} +2 -2
- package/chunks/chunk-Z44TXDGK.js +50 -0
- package/chunks/{chunk-KVMK6REW.js → chunk-ZCP4JGO4.js} +1 -1
- package/chunks/{chunk-AJSGEEWR.js → chunk-ZRZKBTCU.js} +1 -1
- package/chunks/{data-dir-KTXCGPJZ.js → data-dir-YVQZ5MXP.js} +1 -1
- package/chunks/{dist-MM7GHB2J.js → dist-N5YYFCWT.js} +1 -1
- package/chunks/{dist-XS6VO2LU.js → dist-Z3PYNW6P.js} +1 -1
- package/chunks/{install-source-3CE52ZIN.js → install-source-GWYHWTTG.js} +1 -1
- package/chunks/{launcher-BNIFOBXD.js → launcher-BM4HRRYX.js} +141 -141
- package/chunks/{lifecycle-EKT5LQIE.js → lifecycle-4CWHNXF2.js} +1 -1
- package/chunks/{main-FAPYW7S4.js → main-CU2PB45W.js} +11 -11
- package/chunks/{plugin-command-TD3DWK7U.js → plugin-command-OU7V7644.js} +1 -1
- package/chunks/{provider-command-AQPDCWDR.js → provider-command-GGEFE5SP.js} +1 -1
- package/chunks/{run-acp-command-OPS4CBHL.js → run-acp-command-4J3QAQRK.js} +2 -2
- package/chunks/run-exec-command-KD5OCRTX.js +17 -0
- package/chunks/{update-KWS4AOND.js → update-CG3K6TMW.js} +1 -1
- package/cli.js +2 -2
- package/image-preview-worker.js +1 -1
- package/package.json +1 -1
- package/chunks/chunk-B2NJMA4I.js +0 -50
- package/chunks/run-exec-command-QR3TWWDO.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,49 @@ 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.9 · 2026-09-16
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `mcode exec` and `mcode exec review` support `--effort` to choose reasoning effort for a single run.
|
|
15
|
+
Unsupported levels fail before execution, and the override does not change the session's saved effort.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fixed saving and restoring the default reasoning effort, so new sessions and submitted requests use
|
|
20
|
+
the same level shown in the model picker and status line.
|
|
21
|
+
- Model selection now respects configured effort defaults and fixed levels while preserving the
|
|
22
|
+
Thinking Off setting.
|
|
23
|
+
|
|
24
|
+
## 0.4.8 · 2026-09-16
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Explore subagents can run foreground Bash commands to inspect code and Git state, with a
|
|
29
|
+
read-only filesystem policy when sandboxing is available.
|
|
30
|
+
|
|
31
|
+
### Improved
|
|
32
|
+
|
|
33
|
+
- Improved content review handling with guided response regeneration and fixed replies when
|
|
34
|
+
applicable, while retracting blocked drafts.
|
|
35
|
+
- Improved responsiveness when previewing very long thinking output, while keeping the full text
|
|
36
|
+
available in expanded details.
|
|
37
|
+
- Unified elapsed time in the running status, turn summary, and Goal display using `s`, `min`, and
|
|
38
|
+
`h`, retaining seconds for runs longer than an hour.
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Restored the thinking toggle for capable custom provider models without changing their existing
|
|
43
|
+
effective thinking defaults.
|
|
44
|
+
- Fixed startup failures when custom agents conflict with built-in agent names, preserving custom
|
|
45
|
+
configuration during migration.
|
|
46
|
+
- Improved cancellation of streaming responses from compatible providers so interrupted reads can finish
|
|
47
|
+
promptly.
|
|
48
|
+
- Restored editable image labels when editing a previous message with double Esc or `/edit`.
|
|
49
|
+
Images can be removed, restored with undo, previewed when a local file is available, and resent.
|
|
50
|
+
- Fixed attachment validation errors when sending images or files during an active run, and
|
|
51
|
+
prevented accepted attachments from being lost when temporary draft files are cleaned up.
|
|
52
|
+
|
|
10
53
|
## 0.4.7 · 2026-09-15
|
|
11
54
|
|
|
12
55
|
### Added
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -8,6 +8,37 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
|
|
|
8
8
|
|
|
9
9
|
仅内部重构、测试调整,或只影响其他产品界面且不改变 TUI 行为的变化不记录。
|
|
10
10
|
|
|
11
|
+
## 0.4.9 · 2026-09-16
|
|
12
|
+
|
|
13
|
+
### 新增
|
|
14
|
+
|
|
15
|
+
- `mcode exec` 和 `mcode exec review` 支持通过 `--effort` 指定本次运行的思考强度;不支持的档位会在执行前报错,且不会改写会话已保存的强度。
|
|
16
|
+
|
|
17
|
+
### 修复
|
|
18
|
+
|
|
19
|
+
- 修复默认思考强度的保存与恢复,使新会话和实际请求使用的强度与模型选择器、状态栏显示一致。
|
|
20
|
+
- 模型选择尊重已配置的默认强度和固定档位,并保留关闭思考的设置。
|
|
21
|
+
|
|
22
|
+
## 0.4.8 · 2026-09-16
|
|
23
|
+
|
|
24
|
+
### 新增
|
|
25
|
+
|
|
26
|
+
- Explore 子代理支持使用前台 Bash 检查代码与 Git 状态;沙箱可用时使用只读文件系统策略。
|
|
27
|
+
|
|
28
|
+
### 改进
|
|
29
|
+
|
|
30
|
+
- 改善内容审核后的响应处理,支持按审核引导重新生成或返回适用的固定回复,并撤回被拦截的草稿。
|
|
31
|
+
- 改善超长思考内容预览时的响应速度,展开详情仍可查看完整内容。
|
|
32
|
+
- 运行状态、单轮结束摘要和 Goal 统一使用 `s`、`min`、`h` 显示耗时,超过一小时仍保留秒数。
|
|
33
|
+
|
|
34
|
+
### 修复
|
|
35
|
+
|
|
36
|
+
- 恢复支持思考的自定义 Provider 模型的思考开关,保留已有的实际默认行为。
|
|
37
|
+
- 修复自定义 Agent 与内置 Agent 同名时的启动失败,并在迁移时保留自定义配置。
|
|
38
|
+
- 改善 兼容接口的流式响应取消,避免中断后仍等待数据读取。
|
|
39
|
+
- 双击 Esc 或使用 `/edit` 编辑上一条消息时,恢复可操作的图片标签,支持删除、撤销和重新发送;有可读本地文件时可再次预览。
|
|
40
|
+
- 修复运行中追加图片或文件时的附件校验失败,并避免已接收的附件随草稿临时文件清理而丢失。
|
|
41
|
+
|
|
11
42
|
## 0.4.7 · 2026-09-15
|
|
12
43
|
|
|
13
44
|
### 新增
|
package/README.md
CHANGED
|
@@ -125,10 +125,23 @@ mcode exec --cwd ./repo --file error.log "Find the cause of this build failure."
|
|
|
125
125
|
# Produce machine-readable output
|
|
126
126
|
mcode exec --output-format json "Summarize the current branch."
|
|
127
127
|
|
|
128
|
+
# Raise the reasoning effort for this Run only
|
|
129
|
+
mcode exec --model custom_provider:work/deep-reasoner-1 --effort xhigh "Plan this migration."
|
|
130
|
+
|
|
128
131
|
# Review local changes in a workspace
|
|
129
132
|
mcode exec review --cwd ./repo
|
|
130
133
|
```
|
|
131
134
|
|
|
135
|
+
`--effort` sets the reasoning effort for this Run only and is independent of `--model`. Used alone it
|
|
136
|
+
applies to the Session's current model. The level is validated against the model's advertised effort
|
|
137
|
+
levels before the Turn starts, so an unsupported level or a model without effort support fails with a
|
|
138
|
+
non-zero exit code instead of running at some other strength. The override is never written back to
|
|
139
|
+
the Session, so resuming with `--session` or `--continue` restores the Session's own level.
|
|
140
|
+
|
|
141
|
+
An effort level is not a model variant. `--model provider/model#xhigh` still runs, unchanged, but
|
|
142
|
+
Runtime reads the suffix as part of the model identity and applies its own default strength, so the
|
|
143
|
+
requested level is silently dropped. Use `--effort xhigh` whenever the level has to take effect.
|
|
144
|
+
|
|
132
145
|
For automation, `--output-schema` accepts an inline JSON object or file path and constrains the
|
|
133
146
|
model's final answer for Anthropic Messages, OpenAI Responses, and Chat Completions. The outer
|
|
134
147
|
`--output-format json` value remains a stable `ExecResult`; models without strict Structured Output
|
|
@@ -137,9 +150,9 @@ final answer passes validation and Runtime completes its bounded shutdown. Use
|
|
|
137
150
|
`--output-format stream-json` to stream progress.
|
|
138
151
|
|
|
139
152
|
`mcode exec review` always reviews staged, unstaged, and untracked local changes. It supports
|
|
140
|
-
`--cwd`, `--model`, `--config`, `--permission`, `--timeout`, `--max-steps`,
|
|
141
|
-
`--output-last-message`. Findings exit with code `0`; invocation, Runtime, or
|
|
142
|
-
failures use a non-zero exit code.
|
|
153
|
+
`--cwd`, `--model`, `--effort`, `--config`, `--permission`, `--timeout`, `--max-steps`,
|
|
154
|
+
`--output-format`, and `--output-last-message`. Findings exit with code `0`; invocation, Runtime, or
|
|
155
|
+
invalid Review result failures use a non-zero exit code.
|
|
143
156
|
|
|
144
157
|
Use `--prompt-mode` to select `tui` (default), `coding`, or `work` for a benchmark:
|
|
145
158
|
|
package/README.zh-CN.md
CHANGED
|
@@ -29,6 +29,9 @@ mcode
|
|
|
29
29
|
|
|
30
30
|
MiniMax Code 会检查代码库、完成修改、运行能够执行的验证,并汇总已经确认的结果。
|
|
31
31
|
|
|
32
|
+
运行状态行、单轮结束后的耗时和 Goal 计时统一使用 `s` / `min` / `h`,例如
|
|
33
|
+
`30s`、`9min30s`、`2h9min30s`;超过一小时仍显示秒。运行耗时统计当前轮,Goal 统计累计 active 时间,两者数值可以不同。
|
|
34
|
+
|
|
32
35
|
## 内部包的 Codex 登录
|
|
33
36
|
|
|
34
37
|
在 `/provider` 选择 OpenAI Codex,或在 `/model` 选择 Connect OpenAI Codex,再选择登录方式:
|
|
@@ -90,6 +93,10 @@ MiniMax Code 工作时,按 `Enter` 将输入内容 steer 给当前 Turn;按
|
|
|
90
93
|
标出编号,并在输入框上方显示预览。继续输入或移开光标会收起预览;用左右方向键移回图片标签即可再次查看。`Esc`
|
|
91
94
|
收起;`Enter` 仍按当前状态发送或 steer,不会打开图片。
|
|
92
95
|
|
|
96
|
+
空输入框连续按两次 `Esc` 或使用 `/edit` 编辑上一条消息时,图片会恢复为可操作的
|
|
97
|
+
`[Image #1]` 标签,支持删除、撤销和重新发送。当前进程内最近一次带附件提交会保留原标签位置;
|
|
98
|
+
没有本地编辑快照的历史消息会在正文末尾重建标签。只有资源 ID、没有可读本地文件的图片仍保留标签和元信息。
|
|
99
|
+
|
|
93
100
|
支持 Kitty 图片协议的终端以及 regular 模式的 iTerm2 可以显示图片;其他终端显示格式、尺寸和大小。预览最多读取 20
|
|
94
101
|
MB、处理 2500 万像素,超限、格式不支持或读取失败时保留文字信息和原附件。预览副本不影响原图发送,也不自动去重。
|
|
95
102
|
|
|
@@ -187,15 +194,27 @@ mcode exec --cwd ./repo --file error.log "定位这次构建失败的原因。"
|
|
|
187
194
|
# 输出机器可读 JSON
|
|
188
195
|
mcode exec --output-format json "总结当前分支。"
|
|
189
196
|
|
|
197
|
+
# 只为本次 Run 提高思考强度
|
|
198
|
+
mcode exec --model custom_provider:work/deep-reasoner-1 --effort xhigh "规划这次迁移。"
|
|
199
|
+
|
|
190
200
|
# 审查当前 workspace 的本地改动
|
|
191
201
|
mcode exec review --cwd ./repo
|
|
192
202
|
```
|
|
193
203
|
|
|
204
|
+
`--effort` 只对本次 Run 生效,与 `--model` 相互独立;单独使用时作用于当前 Session 的模型。启动前会用
|
|
205
|
+
模型声明的可选强度校验该取值,因此不支持的强度或不支持强度选择的模型会以非零退出码明确失败,而不会
|
|
206
|
+
退回到别的强度继续执行。该覆盖不会写回 Session,用 `--session` 或 `--continue` 恢复时仍是 Session
|
|
207
|
+
自身的强度。
|
|
208
|
+
|
|
209
|
+
思考强度不是模型变体。`--model provider/model#xhigh` 的行为保持不变,仍然可以正常运行,但 Runtime 会把
|
|
210
|
+
该后缀当成模型身份的一部分并按自身默认强度执行,请求的强度会被静默丢弃。需要强度确实生效时请使用
|
|
211
|
+
`--effort xhigh`。
|
|
212
|
+
|
|
194
213
|
自动化场景还可以使用 `--output-schema` 约束最终回答、使用 `--output-last-message` 写入文件,或通过
|
|
195
214
|
`--output-format stream-json` 流式读取进度。
|
|
196
215
|
|
|
197
216
|
`mcode exec review` 固定审查 staged、unstaged 和 untracked 的本地改动,支持 `--cwd`、`--model`、
|
|
198
|
-
`--config`、`--permission`、`--timeout`、`--max-steps`、`--output-format` 和
|
|
217
|
+
`--effort`、`--config`、`--permission`、`--timeout`、`--max-steps`、`--output-format` 和
|
|
199
218
|
`--output-last-message`。发现问题仍返回退出码
|
|
200
219
|
`0`;只有调用、Runtime 或审查结果协议失败才返回非零退出码。
|
|
201
220
|
|
|
@@ -325,7 +344,10 @@ TUI 启动不再批量迁移历史会话的模型。指向官方网关的 `custo
|
|
|
325
344
|
|
|
326
345
|
在 TUI 中使用 `/model` 选择模型和推理强度。支持多个上下文档位的模型(如 M3 的 512K / 1M)可用 Tab /
|
|
327
346
|
Shift+Tab 切换上下文,左右键仍调整 Thinking /
|
|
328
|
-
effort。Enter
|
|
347
|
+
effort。Enter 同时应用到当前会话并保存模型、上下文和 effort 为默认值,Esc 放弃本次调整;重新启动后会恢复已保存的选择,新会话继承默认 effort,已有会话保留自己的选择。
|
|
348
|
+
默认 effort 保存在当前 profile 配置的 `defaultModelThinking.effort`,与桌面端首页使用同一份配置;桌面端已有会话内的调整仍只作用于该会话。
|
|
349
|
+
未保存选择时优先采用模型目录的 `defaultEffort`,再回退到可选档位的中间值;固定默认 effort 只读显示,不提供档位切换。关闭 Thinking 时不应用 effort。
|
|
350
|
+
1M 等较高用量档位会显示提示。选择
|
|
329
351
|
`Add 3rd-party provider…` 可从 models.dev 搜索已知 Provider 和模型,或配置 Custom Provider。API
|
|
330
352
|
Key 在表单中保持掩码,Runtime 会先测试连通性,成功后才保存并应用所选模型。使用 Provider 命令查看或配置模型来源:
|
|
331
353
|
|
|
@@ -14,6 +14,14 @@ requires creating, editing, or saving any file, stop immediately and return
|
|
|
14
14
|
the file-writing requirement and returning the research in `final_text`.
|
|
15
15
|
Referencing existing files for read-only inspection is allowed.
|
|
16
16
|
|
|
17
|
+
# Read-only Bash
|
|
18
|
+
Use `bash` only to inspect existing code or Git state. Do not modify files, Git
|
|
19
|
+
state, or external systems, and do not run commands with other side effects. If
|
|
20
|
+
the investigation needs a side effect, return `ROLE_MISMATCH`.
|
|
21
|
+
|
|
22
|
+
Explore does not have `task_output`, so do not use `run_in_background` with
|
|
23
|
+
`bash`. Run each Bash command in the foreground and return its result.
|
|
24
|
+
|
|
17
25
|
- Locate relevant files, symbols, configuration, tests, data flow, or
|
|
18
26
|
authoritative sources.
|
|
19
27
|
- Prefer targeted reads and searches. Stop when the bounded evidence needed for
|
|
@@ -10,6 +10,15 @@ requires creating, editing, or saving any file, stop immediately and return
|
|
|
10
10
|
the file-writing requirement and returning the research in `final_text`.
|
|
11
11
|
Referencing existing files for read-only inspection is allowed.
|
|
12
12
|
|
|
13
|
+
## Read-only Bash
|
|
14
|
+
|
|
15
|
+
Use `bash` only to inspect existing code or Git state. Do not modify files, Git
|
|
16
|
+
state, or external systems, and do not run commands with other side effects. If
|
|
17
|
+
the investigation needs a side effect, return `ROLE_MISMATCH`.
|
|
18
|
+
|
|
19
|
+
Explore does not have `task_output`, so do not use `run_in_background` with
|
|
20
|
+
`bash`. Run each Bash command in the foreground and return its result.
|
|
21
|
+
|
|
13
22
|
- Locate relevant files, symbols, configuration, tests, data flow, or
|
|
14
23
|
authoritative sources.
|
|
15
24
|
- Prefer targeted reads and searches. Stop when the bounded evidence needed for
|
|
@@ -24,8 +24,10 @@ Use `task` only for one concrete, bounded subtask:
|
|
|
24
24
|
A user's authorization for the requested work also authorizes internal delegation inside that scope.
|
|
25
25
|
It does not authorize broader edits, new external side effects, or overlapping writers.
|
|
26
26
|
|
|
27
|
-
Use
|
|
28
|
-
|
|
27
|
+
Use Explore for bounded codebase mapping or evidence gathering. It can use
|
|
28
|
+
`bash` for read-only Git and code investigation. When continuing the same
|
|
29
|
+
investigation, reuse the existing task with `task_append` instead of opening a
|
|
30
|
+
new task.
|
|
29
31
|
|
|
30
32
|
### Brief a fresh child
|
|
31
33
|
|
|
@@ -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,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-3V6OPTHM.js";import"./chunk-LOQ4VVEN.js";import"./chunk-2UWBSJDH.js";import"./chunk-GUFBGYOC.js";import"./chunk-CK62QLTS.js";import"./chunk-WFWSBUYD.js";import"./chunk-D76SO2ME.js";export{a as DEFAULT_THINKING_MODEL_IDS,b as isDefaultThinkingModelId,c as streamAnthropic,d as streamSimpleAnthropic};
|
|
@@ -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{c as a}from"./chunk-
|
|
2
|
+
import{c as a}from"./chunk-ZRZKBTCU.js";import"./chunk-C3JRMX7L.js";import"./chunk-ZCP4JGO4.js";import"./chunk-VCJI7AJO.js";import"./chunk-O6RIRKRN.js";import"./chunk-HQ2U4QVQ.js";import"./chunk-Z44TXDGK.js";import"./chunk-CWWDVX6C.js";import"./chunk-D76SO2ME.js";export{a as McodeUpdateApplication};
|
|
@@ -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{a as o,b as l,c as u}from"./chunk-
|
|
2
|
+
import{a as o,b as l,c as u}from"./chunk-2CEKQTMO.js";import"./chunk-VPHVKGPT.js";import{d as p}from"./chunk-HMP2XYHW.js";import"./chunk-WAVNKSSE.js";import"./chunk-DV5WIEGS.js";import"./chunk-ZITT4GJK.js";import"./chunk-2ZG44JU6.js";import"./chunk-Z44TXDGK.js";import"./chunk-CWWDVX6C.js";import"./chunk-D76SO2ME.js";async function A(r={}){let a=r.createApplication?r.createApplication(r.region):await c(r.region,r.prepareDataDir),t=r.writeError??(e=>process.stderr.write(e));return(await a.login(e=>{let n=l(e.verificationUriComplete??e.verificationUri);if(t(`Open: ${n}
|
|
3
3
|
Code: ${e.userCode}
|
|
4
4
|
Waiting for authorization\u2026
|
|
5
5
|
`),r.openBrowser===!1)return;(r.openExternalTarget??o(process.cwd()))(n).catch(()=>{t(`Couldn't open the default browser. Open the authorization URL above manually.
|
|
@@ -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 p}from"./chunk-
|
|
2
|
+
import{a as p}from"./chunk-VPHVKGPT.js";import{e as g,k as d,m as h}from"./chunk-WAVNKSSE.js";import{isAbsolute as f,resolve as A}from"node:path";import{spawn as E}from"node:child_process";import{fileURLToPath as y}from"node:url";function T(e){return t=>R(t,e)}function R(e,t){let i=S(e,t),[o,r]=process.platform==="darwin"?["open",[i]]:process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",i]]:["xdg-open",[i]];return new Promise((s,u)=>{let n=E(o,r,{detached:!0,stdio:"ignore",windowsHide:!0});n.once("error",u),n.once("spawn",()=>{n.unref(),s()})})}function S(e,t){return/^https?:\/\//iu.test(e)?e:/^file:\/\//iu.test(e)?y(e):f(e)?e:A(t,e)}var x="mcode-internal";function k(e){try{let t=new URL(e);return t.searchParams.set("client_surface","tui"),t.searchParams.set("download_source",x),t.toString()}catch{return e}}var w={cn:{dev:"https://agent.minimaxi.com",test:"https://agent.minimaxi.com",staging:"https://agent.minimaxi.com",prod:"https://agent.minimax.cn"},en:{dev:"https://agent.minimax.io",test:"https://agent.minimax.io",staging:"https://agent.minimax.io",prod:"https://agent.minimax.io"}};function m(e){let t=w[e.region][e.buildEnv];return`${t}/auth/logout?logout_redirect_uri=${encodeURIComponent(t)}`}var c=class{constructor(t){this.options=t;let i=d({runtimeRegion:process.env.MAVIS_REGION==="en"?"en":"cn"});this.scope={region:t.region??i.region,buildEnv:t.buildEnv??i.buildEnv}}scope;async login(t,i=this.scope.region){this.track("login_click",{hailuo_user_id:this.hailuoUserId()});try{let o={...this.scope,region:i},r=!P(o,this.scope),s=this.options.sharedAuthCore;if(r){if(!this.options.resolveSharedAuthCore)throw new Error(C(this.scope,o));s=this.options.resolveSharedAuthCore(i)}let u=(await s.getStatus()).status==="authenticated",n=!1;await s.login({onDeviceAuthorization:M=>{n=!0,t?.({state:"device-authorization",...M})}}),this.persistRegionPreference(o);let l=u&&!n,v={state:l?"already-authenticated":"authenticated",message:l?r?`Already signed in with ${a(o.region)}.`:"Already signed in with MiniMax.":r?`Signed in with ${a(o.region)}.`:"Signed in with MiniMax.",...r?{restartRequired:!0}:{}};return this.trackLoginResult("1",""),v}catch(o){throw this.trackLoginResult("2",b(o)),o}}async logout(){this.track("logout_click",{hailuo_user_id:this.hailuoUserId()});let t=await this.options.sharedAuthCore.getStatus(),i=await this.options.sharedAuthCore.logout({revoke:!0}),o=m(this.scope);return t.status==="anonymous"&&i.status==="anonymous"?{state:"already-signed-out",message:"Already signed out of MiniMax.",logoutUrl:o}:{state:"signed-out",logoutUrl:o,message:i.status==="logout_pending"?`Signed out locally from ${a(this.scope.region)} across MCode. Server revocation is pending until the network recovers.`:`Signed out of ${a(this.scope.region)} on Desktop, CLI/TUI, and embedded mcode-tools.`}}trackLoginResult(t,i){this.track("login_result",{hailuo_user_id:this.hailuoUserId(),source:this.options.telemetrySource??"mcode_cli",result_type:t,fail_reason:i,login_type:"minimax_oauth"})}persistRegionPreference(t){try{this.options.writeRegionPreference?.(this.options.dataDir,t)}catch{}}hailuoUserId(){try{return this.options.hailuoUserId?.()?.trim()??""}catch{return""}}track(t,i){try{this.options.telemetry?.track(t,i)}catch{}}};function b(e){let t=e instanceof Error?e.message:String(e);return/cancel/iu.test(t)?"3":/network|offline|fetch|ECONN|ENOTFOUND|ETIMEDOUT/iu.test(t)?"2":/oauth|authorization|login failed|invalid login state/iu.test(t)?"5":/server|HTTP 5\d\d/iu.test(t)?"1":"4"}function P(e,t){return e.region===t.region&&e.buildEnv===t.buildEnv}function C(e,t){return e.region!==t.region?`Signed in to ${a(e.region)}. Run \`mcode logout\` before signing in to ${a(t.region)}.`:`Signed in to another MiniMax ${e.buildEnv} environment. Run \`mcode logout\` before signing in to ${t.buildEnv}.`}function a(e){return e==="cn"?"MiniMax China":"MiniMax Global"}function j(e){let t=d({runtimeRegion:e.region,runtimeBuildEnv:e.buildEnv}),i=e.region??t.region,o=e.buildEnv??t.buildEnv,r={dataDir:e.dataDir,region:i,buildEnv:o,...e.telemetry?{telemetry:e.telemetry}:{},...e.telemetrySource?{telemetrySource:e.telemetrySource}:{},...e.hailuoUserId?{hailuoUserId:e.hailuoUserId}:{},writeRegionPreference:e.writeRegionPreference??h},s=n=>(e.createSharedSession??p)({dataDir:e.dataDir,region:n,buildEnv:o,oauthEndpoints:g(e.oauthEndpointEnvironment??process.env,{buildEnv:o,region:n})}),u=e.sharedAuthCore??s(i);return new c({...r,sharedAuthCore:u,resolveSharedAuthCore:s})}export{T as a,k as b,j as c};
|