@minimax-ai/code 0.6.8 → 0.6.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/CHANGELOG.zh-CN.md +16 -0
  3. package/README.md +15 -1
  4. package/README.zh-CN.md +9 -1
  5. package/assets/agents/_default/prompt-base-windows.md +0 -1
  6. package/assets/agents/_default/prompt-base-windows.md.hbs +0 -1
  7. package/chunks/{auth-command-VRPOVPAG.js → auth-command-V2XHLCT4.js} +1 -1
  8. package/chunks/chunk-2BNOPHYG.js +9 -0
  9. package/chunks/chunk-52LBQEEC.js +2 -0
  10. package/chunks/{chunk-F5BJTVSP.js → chunk-55CEUKGL.js} +1 -1
  11. package/chunks/{chunk-G7Q4HUMC.js → chunk-5JU6ZMXS.js} +1 -1
  12. package/chunks/{chunk-HTUJPI64.js → chunk-5URK63JW.js} +712 -708
  13. package/chunks/{chunk-VRCVX3OX.js → chunk-EYZOZ75Y.js} +1 -1
  14. package/chunks/{chunk-3LM4G7WV.js → chunk-F6CPFGSE.js} +1 -1
  15. package/chunks/{chunk-TBUCWZJV.js → chunk-KLBEPNUI.js} +1 -1
  16. package/chunks/{chunk-WROGTDVD.js → chunk-MESLFKP6.js} +1 -1
  17. package/chunks/{chunk-TJWBPT2F.js → chunk-S3AA7ARE.js} +1 -1
  18. package/chunks/{chunk-W2YPWDHA.js → chunk-VF6QBYDX.js} +664 -662
  19. package/chunks/{chunk-RCKQIK7B.js → chunk-YD3QXMMM.js} +1 -1
  20. package/chunks/{data-dir-5RSS75A3.js → data-dir-6QRNHAEN.js} +1 -1
  21. package/chunks/{dist-VUHPFVW3.js → dist-TA4FX7XC.js} +1 -1
  22. package/chunks/{launcher-UXZG5P2R.js → launcher-QGDE2E5R.js} +147 -146
  23. package/chunks/{lifecycle-LWEBNCGO.js → lifecycle-GLENYWF7.js} +1 -1
  24. package/chunks/{main-ZF4GAXGG.js → main-RCN26DGX.js} +2 -2
  25. package/chunks/{plugin-command-DE7EI72Q.js → plugin-command-O4T4MWJK.js} +1 -1
  26. package/chunks/{provider-command-WEUFNCBJ.js → provider-command-ILB6EPHT.js} +1 -1
  27. package/chunks/{run-acp-command-RJGV3PNR.js → run-acp-command-OK6OSA2P.js} +2 -2
  28. package/chunks/{run-exec-command-LDQWWWXK.js → run-exec-command-B6CKVBZL.js} +13 -13
  29. package/cli.js +2 -2
  30. package/package.json +1 -1
  31. package/chunks/chunk-CF3YFDG4.js +0 -2
  32. package/chunks/chunk-K7X2ELVZ.js +0 -9
package/CHANGELOG.md CHANGED
@@ -7,6 +7,22 @@ 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.6.9 · 2026-10-12
11
+
12
+ ### Added
13
+
14
+ - `config.yaml` adds `permission.nativeDelete`, which defaults to `false`. When set to `true`, new Bash calls use the current shell's native delete commands instead of moving files to the trash, so deleted files may not be recoverable. Normal permission modes, sandboxing, root/home recursive-delete protection and network-share blocking remain active; Windows delete commands whose targets cannot be resolved statically are still rejected.
15
+
16
+ ### Improved
17
+
18
+ - The default tool-discovery budget for stdio MCP servers rises from 15 to 30 seconds, so servers that install dependencies on first launch (such as `npx` or `uvx`) are more likely to provide tools in the current turn. The effective budget is still the smaller of this default and the server `timeout` in `mcp.json`; HTTP/SSE discovery stays at 2 seconds and tool-call timeouts are unchanged. A failing stdio server can delay a turn by up to 30 seconds.
19
+
20
+ ### Fixed
21
+
22
+ - A turn no longer ends silently when the model uses the whole output limit while thinking, before producing any text. The cut-off response is discarded (an unfinished tool call in it does not run) and the request is retried with a hint to reason more briefly, up to 3 times; if it still does not finish, a dedicated error message is shown.
23
+ - Images that cannot be decoded (corrupt, truncated, or unsupported) no longer enter the conversation history, fixing a single bad image causing every later request to fail with 400 (2013). Such images in tool results are replaced by a note with their type and size; attached ones keep only their file path.
24
+ - The `agents` / `background` counts in the `tui.statusLine: [build-mode]` status line now follow notification receipts persisted by the Runtime: finished background tasks and sub-agents still count until their results are handed back to the agent, then drop to zero. The counts no longer get stuck or reach zero early because of event ordering or process restarts.
25
+
10
26
  ## 0.6.8 · 2026-10-11
11
27
 
12
28
  ### Added
@@ -8,6 +8,22 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
8
8
 
9
9
  仅内部重构、测试调整,或只影响其他产品界面且不改变 TUI 行为的变化不记录。
10
10
 
11
+ ## 0.6.9 · 2026-10-12
12
+
13
+ ### 新增功能
14
+
15
+ - `config.yaml` 新增 `permission.nativeDelete`,默认 `false`。设为 `true` 后,新的 Bash 调用使用当前 shell 的原生删除命令,不再改写为移入回收站,删除的文件可能无法恢复。普通权限模式、沙箱、root/home 递归删除保护和网络共享拦截继续生效;无法静态确定目标的 Windows 删除命令仍会被拒绝。
16
+
17
+ ### 体验改进
18
+
19
+ - stdio MCP Server 的工具发现默认时限从 15 秒提高到 30 秒,首次启动需要安装依赖的 Server(如 `npx`、`uvx`)更容易在本轮拿到工具。实际时限仍取该默认值与 `mcp.json` 中 Server `timeout` 的较小值;HTTP/SSE 仍为 2 秒,工具调用超时不变。故障的 stdio Server 最多可能让一轮等待 30 秒。
20
+
21
+ ### 问题修复
22
+
23
+ - 模型思考用完单次输出上限、没有输出任何文字时,本轮不再静默结束。被截断的回复会被丢弃(其中未写完的工具调用不会执行),并提示模型缩短思考后自动重试,最多 3 次;仍未完成时显示专门的错误说明。
24
+ - 无法解码的图片(损坏、截断或格式不支持)不再进入对话历史,修复一张坏图导致之后每轮请求都返回 400(2013)的问题。工具结果中的这类图片替换为写明类型和大小的说明,附加的这类图片只保留文件路径。
25
+ - `tui.statusLine: [build-mode]` 状态栏的 `agents` / `background` 计数改为以 Runtime 持久记录的通知回执为准:已结束但结果尚未交回 Agent 的后台任务和子 Agent 继续计入,结果交回后归零。计数不再因事件顺序、进程重启而卡住或提前归零。
26
+
11
27
  ## 0.6.8 · 2026-10-11
12
28
 
13
29
  ### 新增功能
package/README.md CHANGED
@@ -272,7 +272,10 @@ This is the only resize: the Read tool, attached images and browser screenshots
272
272
  image, so an image within the limits is sent unchanged and a scaled-down one carries a single note.
273
273
  A screenshot taken after a browser action stays within 1280 px and 1 MiB, or these limits when
274
274
  smaller. If the image processor cannot load, a tool result image over the limits is replaced with a
275
- note saying so.
275
+ note saying so. An image it cannot decode (corrupt, truncated or in an unsupported format) never
276
+ enters the conversation, because every later request would carry it and fail: a tool result image is
277
+ replaced with a note giving its type and size, and an attached one is not sent inline and keeps only
278
+ its file path.
276
279
 
277
280
  Deterministic provider rejections, such as an image count, size or dimension limit, a 413 reported
278
281
  in the error, or an HTTP 400 `invalid_request_error`, are not retried; size and image rejections go
@@ -350,6 +353,17 @@ CPU rendering can verify visuals and interactions, but is unsuitable for measuri
350
353
  It does not additionally disable Chrome's process sandbox. An image that already includes a
351
354
  SwiftShader-capable Chrome needs neither an image change nor a separate renderer installation.
352
355
 
356
+ ### MCP cold-start discovery budget
357
+
358
+ The default stdio MCP turn discovery budget is 30,000 ms, allowing more time for servers
359
+ that install dependencies on first launch. It covers connection preparation, process startup,
360
+ initialize and tools/list. The effective budget is the minimum of this default and each server's
361
+ `mcp.json` `timeout` (milliseconds, default 120,000).
362
+ Remote HTTP/SSE discovery remains at 2,000 ms. Tool-call timeouts and the existing empty-list
363
+ fallback on discovery failure are unchanged. A broken stdio server can therefore delay a turn
364
+ for up to 30 seconds. This default requires a build containing the change; no new environment
365
+ variable is needed.
366
+
353
367
  ### ACP clients
354
368
 
355
369
  Start the Agent Client Protocol server over stdin/stdout:
package/README.zh-CN.md CHANGED
@@ -397,7 +397,7 @@ requestMedia:
397
397
  max_base64_bytes: 4718592 # 单张图片的 base64 字节数,默认 4.5 MiB,最大 5 MiB
398
398
  ```
399
399
 
400
- 这是唯一一次缩放:Read 工具、附加的图片和 Browser 截图都交出原图,在上限内的图片原样发送,被缩小的图片只带一条说明。Browser 操作后自动截取的截图不超过 1280 px 和 1 MiB,上面的上限更小时以其为准。图片处理组件无法加载时,超过上限的工具结果图片会替换为一条说明。
400
+ 这是唯一一次缩放:Read 工具、附加的图片和 Browser 截图都交出原图,在上限内的图片原样发送,被缩小的图片只带一条说明。Browser 操作后自动截取的截图不超过 1280 px 和 1 MiB,上面的上限更小时以其为准。图片处理组件无法加载时,超过上限的工具结果图片会替换为一条说明。图片处理组件无法解码的图片(损坏、截断或格式不支持)不会进入对话,否则之后每次请求都会带上它并失败:工具结果里的这类图片替换为一条写明类型和大小的说明,你附加的这类图片不内联发送,只保留文件路径。
401
401
 
402
402
  图片数量、体积或尺寸超限、报错中带有 413、HTTP 400 `invalid_request_error` 等确定性拒绝不再重试;体积和图片类拒绝直接走上面的图片恢复。
403
403
 
@@ -463,6 +463,14 @@ Use。SwiftShader 开关只接受
463
463
  `--use-gl=angle --use-angle=swiftshader --enable-unsafe-swiftshader`,仅用于受信任的本地页面测试;Chrome 的说明见
464
464
  [SwiftShader 文档](https://chromium.googlesource.com/chromium/src/+/main/docs/gpu/swiftshader.md)。它用 CPU 绘图,适合验证画面和交互,不适合测游戏帧率;不会额外关闭 Chrome 进程沙箱。镜像已包含支持 SwiftShader 的 Chrome 时,不需要更换镜像或安装独立渲染库。
465
465
 
466
+ ### MCP 冷启动发现预算
467
+
468
+ stdio MCP 在 turn 工具发现阶段的默认总预算为 30,000 ms,为首次启动需要安装依赖的 Server
469
+ 预留更多时间。预算包括连接准备、进程启动、initialize 和 tools/list;实际预算仍为该默认值与
470
+ 单个 Server 的 `mcp.json` `timeout` 的较小值(毫秒,Server 默认 120,000)。
471
+ 远程 HTTP/SSE 的发现预算仍为 2,000 ms,工具调用超时及发现失败时返回空列表的既有行为不变。
472
+ 故障 stdio Server 因此最多可能使 turn 等待 30 秒。需使用包含此改动的构建,无需新增环境变量。
473
+
466
474
  ### ACP 客户端
467
475
 
468
476
  通过 stdin/stdout 启动 Agent Client Protocol 服务:
@@ -3,4 +3,3 @@
3
3
  - Use the shell identified by the current Bash tool and follow its syntax and encoding guidance.
4
4
  - The tool already launches the selected shell. Use non-interactive CLI flags and avoid redundant `powershell -Command` or `cmd /c` wrappers.
5
5
  - Prefer dedicated `read`, `write`, `edit`, `grep`, and `glob` tools. For unavoidable shell file I/O, follow the selected shell's UTF-8 guidance; PowerShell 5.1 `-Encoding UTF8` writes a BOM. Avoid `Get-Content | ... | Set-Content` editing pipelines.
6
- - Recoverable deletion uses one top-level `rm -- "<target1>" "<target2>"`; Runtime routes it through the trusted launcher. If it fails, report the failure. Never bypass it with permanent deletion or another script. Permission checks still apply.
@@ -3,4 +3,3 @@
3
3
  - Use the shell identified by the current Bash tool and follow its syntax and encoding guidance.
4
4
  - The tool already launches the selected shell. Use non-interactive CLI flags and avoid redundant `powershell -Command` or `cmd /c` wrappers.
5
5
  - Prefer dedicated `read`, `write`, `edit`, `grep`, and `glob` tools. For unavoidable shell file I/O, follow the selected shell's UTF-8 guidance; PowerShell 5.1 `-Encoding UTF8` writes a BOM. Avoid `Get-Content | ... | Set-Content` editing pipelines.
6
- - Recoverable deletion uses one top-level `rm -- "<target1>" "<target2>"`; Runtime routes it through the trusted launcher. If it fails, report the failure. Never bypass it with permanent deletion or another script. Permission checks still apply.
@@ -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-F5BJTVSP.js";import"./chunk-3LM4G7WV.js";import{d as p}from"./chunk-RCKQIK7B.js";import"./chunk-TJWBPT2F.js";import"./chunk-VRCVX3OX.js";import"./chunk-3FETZOUF.js";import"./chunk-CWWDVX6C.js";import"./chunk-ZITT4GJK.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}
2
+ import{a as o,b as l,c as u}from"./chunk-55CEUKGL.js";import"./chunk-F6CPFGSE.js";import{d as p}from"./chunk-YD3QXMMM.js";import"./chunk-S3AA7ARE.js";import"./chunk-EYZOZ75Y.js";import"./chunk-3FETZOUF.js";import"./chunk-CWWDVX6C.js";import"./chunk-ZITT4GJK.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.
@@ -0,0 +1,9 @@
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
+ var N=["local-task:","local-background-task:","team-plan:"],x=new Set(["explore","worker","verifier"]);function h(e){return e.sessionKind==="task"||N.some(n=>e.purpose?.startsWith(n))}function C(e){return e.sessionType!=="branch"||!e.parentSessionId?!1:h(e)}function v(e){let n=e.agentName?.trim().toLocaleLowerCase();return n!==void 0&&x.has(n)}function ke(e){return h(e)||v(e)}function we(e,n){let r=[],t=new Set,i=new Set([n]),s=!0;for(;s;){s=!1;for(let o of e)t.has(o.sessionId)||!C(o)||!i.has(o.parentSessionId)||(r.push(o),t.add(o.sessionId),i.add(o.sessionId),s=!0)}return r}function he(e){return{sessionId:e.sessionId,parentSessionId:e.parentSessionId,...e.agentName?{agentName:e.agentName}:{},...e.title?{task:e.title}:{},status:D(e.status),...w("createdAtMs",e.createdAt),...w("updatedAtMs",e.updatedAt),...e.errorMessage?{errorMessage:e.errorMessage}:{}}}function Se(e){return e.status==="queued"||e.status==="running"}function D(e){let n=e?.trim().toLocaleLowerCase().replaceAll("-","_");return n?n==="queued"||n==="pending"||n==="created"?"queued":n==="running"||n==="started"||n==="active"||n==="busy"||n==="processing"||n==="in_progress"?"running":n==="finished"||n==="completed"||n==="succeeded"||n==="success"||n==="idle"?"completed":n==="error"||n==="failed"||n==="lost"?"failed":n==="aborted"||n==="interrupted"||n==="cancelled"||n==="canceled"||n==="stopped"?"stopped":"unknown":"unknown"}function w(e,n){if(typeof n=="number"&&Number.isFinite(n))return{[e]:n};if(typeof n!="string")return{};let r=Number(n);if(Number.isFinite(r))return{[e]:r};let t=Date.parse(n);return Number.isFinite(t)?{[e]:t}:{}}var Me="mavis";function M(e){let n=q(e.toolName),r=p(e.input);if(!n)return;let t=F(e.status,e.error),i=J(n)?O(r??{},e.output):V(n)?r?B(r):[]:[];if(i.length!==0)return{schemaVersion:1,state:t,blocks:i}}function O(e,n){let r=g(e,["path","filePath","file_path"]),t=z(n);return t?[t.omitted===void 0?S(r,t.diff):L(r,t.diff,t.omitted)]:j(e).map(({oldText:i,newText:s})=>{let o=[...i.split(`
3
+ `).map(d=>`- ${d}`),...s.split(`
4
+ `).map(d=>`+ ${d}`)].join(`
5
+ `);return S(r,o)})}function B(e){let n=g(e,["path","filePath","file_path"]),r=g(e,["content","fileContent","file_content"]);if(r===void 0)return[];let t=m(r);return r.includes("\0")?[{kind:"summary",...n?{path:n}:{},message:"Binary content cannot be previewed safely.",reason:"binary",byteCount:t}]:t>65536?[{kind:"summary",...n?{path:n}:{},message:`File preview omitted because it is ${$(t)}.`,reason:"too-large",byteCount:t}]:[{kind:"file",...n?{path:n}:{},content:r,lineCount:r.split(`
6
+ `).length,truncated:!1}]}function S(e,n){let r=n.split(`
7
+ `),t=m(n),i=r.slice(0,400),s=t>65536,o=i.join(`
8
+ `);s&&(o=K(o,65536));let d=Math.max(0,r.length-o.split(`
9
+ `).length);return{kind:"diff",...e?{path:e}:{},diff:o,addedLines:b(r,"+"),removedLines:b(r,"-"),truncated:d>0||s,...d>0?{omittedLines:d}:{}}}function L(e,n,r){return{kind:"summary",...e?{path:e}:{},message:n,reason:r==="timeout"?"unavailable":"too-large"}}function z(e){let n=p(e);if(!n)return;let r=[n,p(n.result),p(n.output)].filter(t=>t!==void 0);for(let t of r){let i=p(t.details),s=i?g(i,["diff","previewDiff","preview_diff"]):void 0;if(s){let o=i?g(i,["diffOmitted","diff_omitted"]):void 0;return o===void 0?{diff:s}:{diff:s,omitted:o}}}}function j(e){let r=(G(e.edits)??[]).flatMap(s=>{let o=p(s),d=o?g(o,["oldText","old_text"]):void 0,f=o?g(o,["newText","new_text"]):void 0;return d!==void 0&&f!==void 0?[{oldText:d,newText:f}]:[]}),t=g(e,["oldText","old_text"]),i=g(e,["newText","new_text"]);return t!==void 0&&i!==void 0&&r.push({oldText:t,newText:i}),r}function F(e,n){return X(n)||W(e)?"not-applied":U(e)?"applied":"proposed"}function U(e){return e===2||e==="2"||e==="completed"||e==="complete"||e==="done"||e==="finished"||e==="succeeded"||e==="success"}function W(e){return e===3||e==="3"||e==="failed"||e==="error"}function X(e){return e!=null&&e!==""}function q(e){return e?.trim().toLocaleLowerCase().replace(/[^a-z0-9]/gu,"")||void 0}function J(e){return e==="edit"||e==="editfile"||e==="replace"}function V(e){return e==="write"||e==="writefile"||e==="createfile"}function p(e){let n=I(e);return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:void 0}function G(e){let n=I(e);return Array.isArray(n)?n:void 0}function I(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return}}function g(e,n){for(let r of n){let t=e[r];if(typeof t=="string")return t}}function b(e,n){return e.filter(r=>r.startsWith(n)&&!r.startsWith(n.repeat(3))).length}function m(e){return new TextEncoder().encode(e).byteLength}function K(e,n){if(m(e)<=n)return e;let r=0,t=e.length;for(;r<t;){let i=Math.ceil((r+t)/2);m(e.slice(0,i))<=n?r=i:t=i-1}return e.slice(0,r)}function $(e){return e<1024?`${e} B`:`${(e/1024).toFixed(e<10*1024?1:0)} KiB`}var Y=2,H=6,Q=10,Z=3,ee=4;function Pe(e,n){let r=e.dataJson?.trim();if(!r)return;if(r==="[DONE]")return E({type:"done",turnId:n},e);let t;try{t=JSON.parse(r)}catch{return}let i=a(t);if(!i)return;let s=u(i,["turn_id","turnId"])??n,o=i.type,d;if(o===Q||o==="heartbeat")d={type:"heartbeat",turnId:s};else if(o===Y||o==="agent_message"){let f=a(i.agent_message)??a(i.agentMessage);d=f?te(f,s):void 0}else if(ne(i)){let f=a(i.agent_message_chunk)??a(i.agentMessageChunk);d=f?re(f,s):void 0}else if(o==="error")d={type:"error",message:u(i,["error","message"])??"Runtime stream failed",turnId:s};else if(o==="session_status")d=oe(i,s);else if(o===Z||o===ee)d=se(i,s);else if(o==="resume_overflow")d={type:"resync-required",turnId:s};else if(typeof o=="string"){let f={...i};delete f.type,delete f.turnId,d={type:"generic",eventType:o,data:f,turnId:s}}return d?E(d,e):void 0}function ne(e){return e.type===H&&("agent_message_chunk"in e||"agentMessageChunk"in e)||e.type==="agent_message_chunk"}function te(e,n){let r=ie(e,n);if(r)return r;let t=P(e,n);if(t.role!=="unknown")return t.role==="assistant"&&t.finishReason==="error"?{type:"error",message:t.content?.trim()||"Runtime stream failed",turnId:n}:{type:"message",message:t}}function re(e,n){let r=P(e,n);if(r.role==="assistant")return l({type:"delta",messageId:r.id,turnId:r.turnId??n,role:r.role,content:r.content,thinking:r.thinking,toolCalls:r.toolCalls,timestamp:r.timestamp,chunkIndex:c(e,["chunk_index","chunkIndex"]),finish:e.finish===!0?!0:void 0})}function ie(e,n){let r=u(e,["msg_content","msgContent","content"]);if(!r)return;let t;try{t=a(JSON.parse(r))}catch{return}let i=t?u(t,["eventType"]):void 0;if(!t||!i||!(c(e,["msg_type","msgType","message_type","messageType"])===3)&&!["session.spawned","communication.message","delegation.message","todo_updated"].includes(i))return;let o={...t};return delete o.eventType,l({type:"generic",eventType:i,data:o,turnId:u(e,["turn_id","turnId"])??n,messageId:u(e,["msg_id","msgId","id"]),timestamp:c(e,["timestamp"])})}function oe(e,n){let r=a(e.session_status)??{},t=ue(u(r,["type","status"]));return t?l({type:"session-status",status:t,message:u(r,["message"]),turnId:n}):void 0}function se(e,n){let r=a(e.payload)??{},t=de(c(r,["status"]));if(!t)return;let i=a(r.error);return l({type:"session-status",status:t,message:u(i??r,["message","detail"]),turnId:n})}function ue(e){if(e==="idle"||e==="started"||e==="finished"||e==="error"||e==="aborted"||e==="interrupted")return e}function de(e){if(e===1||e===2)return"started";if(e===3)return"idle";if(e===4)return"error";if(e===5)return"aborted";if(e===6)return"finished"}function E(e,n){return n.cursor?{...e,cursor:n.cursor}:e}function P(e,n){return ae(a(e)??{},n)}function ae(e,n){let r=a(T(e.rawJson??e.raw_json))??{};return l({id:u(e,["msg_id","msgId","id"]),turnId:u(e,["turn_id","turnId"])??n,role:Te(u(e,["role"]))??"unknown",kind:ge(u(e,["kind"])),source:u(e,["source"]),origin:T(e.origin??e.originJson??e.origin_json),error:u(e,["error"]),tokensBefore:c(e,["tokensBefore","tokens_before"]),tokensAfter:c(e,["tokensAfter","tokens_after"]),content:u(e,["msg_content","msgContent","content"]),editContent:u(e,["editContent"])??u(r,["editContent"]),thinking:u(e,["thinking_content","thinkingContent","thinking"]),thinkingDurationMs:c(e,["thinking_duration_ms","thinkingDurationMs"]),toolCalls:A(_(e,["tool_calls","toolCalls"])),toolResult:fe(a(e.toolResult??e.tool_result)),parts:pe(_(e,["parts"])),attachments:me(_(e,["attachments"])),timestamp:c(e,["timestamp","createdAt","created_at"]),finishReason:u(e,["finish_reason","finishReason"]),usage:le(a(e.usage)),actions:ce(a(e.actions))})}function ce(e){if(!e)return;let n=l({fork:R(e,["fork"]),rewind:R(e,["rewind"])});return Object.keys(n).length>0?n:void 0}function le(e){if(!e)return;let n=l({totalTokens:c(e,["total_tokens","totalTokens"]),inputTokens:c(e,["input_tokens","inputTokens"]),outputTokens:c(e,["output_tokens","outputTokens"]),reasoningTokens:c(e,["reasoning","reasoning_tokens","reasoningTokens"]),requestDurationMs:c(e,["request_duration_ms","requestDurationMs"]),decodeDurationMs:c(e,["decode_duration_ms","decodeDurationMs"]),cacheReadTokens:c(e,["cache_read","cacheRead","cache_read_tokens"]),cacheWriteTokens:c(e,["cache_write","cacheWrite","cache_write_tokens"])});return Object.keys(n).length>0?n:void 0}function fe(e){if(!e)return;let n=u(e,["toolCallId","tool_call_id"]);if(!n)return;let r=a(e.details),t=r?l({taskId:u(r,["taskId","task_id"]),subSessionId:u(r,["subSessionId","sub_session_id"]),subTurnId:u(r,["subTurnId","sub_turn_id"])}):void 0;return l({toolCallId:n,toolName:u(e,["toolName","tool_name"]),details:t&&Object.keys(t).length>0?t:void 0})}function ge(e){if(e==="preamble"||e==="final"||e==="compaction_start"||e==="compaction"||e==="compaction_failed"||e==="review_start"||e==="review_result"||e==="review_failed"||e==="review_aborted"||e==="review_interrupted")return e}function Ae(e){return e.parts?.length?[...e.parts]:[...e.thinking?.trim()?[l({type:"thinking",content:e.thinking,durationMs:e.thinkingDurationMs})]:[],...e.content?.trim()?[{type:"text",content:e.content}]:[],...(e.toolCalls??[]).map(n=>({type:"tool",toolCall:n}))]}function pe(e){if(!e)return;let n=e.flatMap(r=>{let t=a(r);if(!t)return[];let i=u(t,["id","part_id","partId"]),s=u(t,["type","kind"]);if(s==="thinking"||s==="cognitive_text"){let o=u(t,["content","text","thinking"]);return o===void 0?[]:[l({id:i,type:"thinking",content:o,durationMs:c(t,["durationMs","duration_ms"])})]}if(s==="text"){let o=u(t,["content","text"]);return o===void 0?[]:[l({id:i,type:"text",content:o})]}if(s==="tool"||s==="tool_call"||s==="toolCall"){let o=a(t.toolCall??t.tool_call)??t,[d]=A([o])??[];return d?[l({id:i,type:"tool",toolCall:d})]:[]}return[]});return n.length>0?n:void 0}function me(e){if(!e)return;let n=e.flatMap(r=>{let t=a(r);if(!t)return[];let i=a(t.meta)??t,s=a(t.local),o=a(t.cloud),d=u(i,["mimeType","mime_type"])??u(t,["mimeType","mime_type"])??"application/octet-stream",f=u(i,["attachmentType","attachment_type","type"])??u(t,["attachmentType","attachment_type","type"]);return[l({type:f==="image"||d.startsWith("image/")?"image":"file",fileName:u(i,["fileName","file_name"])??u(t,["fileName","file_name"])??"attachment",mimeType:d,sizeBytes:c(i,["sizeBytes","size_bytes"]),filePath:(s?u(s,["filePath","file_path"]):void 0)??u(t,["filePath","file_path"]),assetId:s?u(s,["assetId","asset_id"]):void 0,previewUrl:u(t,["previewUrl","preview_url"])??(o?u(o,["url"]):void 0)})]});return n.length>0?n:void 0}function A(e){if(!e)return;let n=e.flatMap(r=>{let t=a(r);if(!t)return[];let i=u(t,["tool_name","tool_call_name","toolName","name"]);if(!i)return[];let s=l({id:u(t,["tool_call_id","toolCallId","id"]),name:i,status:u(t,["tool_call_status","toolCallStatus","status"])??c(t,["tool_call_status","toolCallStatus","status"]),input:T(k(t,["tool_call_args","toolCallArgs","args","arguments","input"])),output:T(k(t,["tool_call_result_data","toolCallResultData","tool_call_result","toolCallResult","result","output"])),error:k(t,["tool_call_error","toolCallError","error"]),durationMs:c(t,["tool_call_duration_ms","toolCallDurationMs","durationMs","duration_ms"])}),o=M({toolName:s.name,status:s.status,input:s.input,output:s.output,error:s.error});return[{...s,...o?{structuredPreview:o}:{}}]});return n.length>0?n:void 0}function Te(e){return e==="user"||e==="assistant"||e==="system"?e:e===void 0?void 0:"unknown"}function a(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function u(e,n){for(let r of n)if(typeof e[r]=="string")return e[r]}function c(e,n){for(let r of n){let t=e[r];if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&t.trim()){let i=Number(t);if(Number.isFinite(i))return i}}}function R(e,n){for(let r of n)if(typeof e[r]=="boolean")return e[r]}function _(e,n){for(let r of n)if(Array.isArray(e[r]))return e[r]}function k(e,n){for(let r of n)if(Object.prototype.hasOwnProperty.call(e,r))return e[r]}function T(e){if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}}function l(e){return Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))}var y=["default","auto","bypassPermissions"],ye={default:"Ask",auto:"Auto",bypassPermissions:"Full access",off:"Off"},_e={default:"ASK",auto:"AUTO",bypassPermissions:"FULL",off:"OFF"};function xe(e){return y.find(n=>n===e)}function Ce(e){return ye[e]}function ve(e){return _e[e]}function De(e){return e==="bypassPermissions"}function Oe(e){if(e==="off")return"default";let n=y.indexOf(e);return y[(n+1)%y.length]}export{C as a,v as b,ke as c,we as d,he as e,Se as f,M as g,Pe as h,P as i,Ae as j,y as k,xe as l,Ce as m,ve as n,De as o,Oe as p,Me as q};
@@ -0,0 +1,2 @@
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{stripVTControlCharacters as f}from"node:util";var c=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/gu;function T(e,t){let r=[t.summary,t.nextStep,t.preservation].map(i=>i?.trim()).filter(i=>!!i).join(" "),n=a(e);return{message:r,...n&&n!==r?{diagnostic:n}:{}}}function _(e,t){let r=t.summary.trim(),n=a(e);return[n?`${r.replace(/[.:;!?]+$/u,"")}: ${n}`:r,t.nextStep,t.preservation].map(s=>s?.trim()).filter(s=>!!s).map(l).join(" ")}var d="output_limit_exhausted",h="The model ran out of output space while still thinking and did not finish after several automatic retries.";function E(e){return e?.trim()===d}function a(e){if(e==null)return"";let t=e instanceof Error?e.message:String(e);return p(t).trim()}function p(e){return f(e).replace(c,"").replace(/-----BEGIN (?:[A-Z0-9 ]+ )?PRIVATE KEY-----[\s\S]*?-----END (?:[A-Z0-9 ]+ )?PRIVATE KEY-----/giu,"[redacted private key]").replace(/\bsk-[A-Za-z0-9._-]{8,}\b/gu,"sk-[redacted]").replace(/\b(?:sk|pk|ghp|github_pat|xox[baprs])[-_][A-Za-z0-9_-]{12,}\b/giu,"[redacted]").replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/gu,"[redacted]").replace(/\bBearer\s+[^\s,;]+/giu,"Bearer [redacted]").replace(/\b(Authorization)(\s*[:=]\s*)((?:Bearer|Basic|Token)\s+)?(?:"[^"]*"|'[^']*'|[^\s,;]+)/giu,"$1$2$3[redacted]").replace(/\b(api[-_ ]?key|access[-_ ]?token|refresh[-_ ]?token|token|password|secret)(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;]+)/giu,"$1$2[redacted]")}function l(e){return/[.!?…]$/u.test(e)?e:`${e}.`}function u(e){return e?.length?Array.from(new Set(e.map(t=>t.trim()).filter(t=>t.length>0))):[]}function x(e){return u(e?.effortOptions).length>0}var g="thinking";function k(e,t){let r=e?.variant;if(e?.thinkingConfig?.mode==="forced_off"||r===""||r==="none-thinking")return;let n=u(e?.effortOptions),i=e?.defaultEffort?.trim(),s=n.length>0?n:i?[i]:[],o=(t??(e?.selected?e.thinking?.effort:void 0))?.trim();if(o&&s.includes(o))return o;if(!(r!==void 0&&r!==g))return i&&s.includes(i)?i:n[Math.floor(n.length/2)]}export{u as a,x as b,k as c,T as d,_ as e,h as f,E as g,a as h,p as i};
@@ -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-3LM4G7WV.js";import{e as g,k as d,m as h}from"./chunk-TJWBPT2F.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};
2
+ import{a as p}from"./chunk-F6CPFGSE.js";import{e as g,k as d,m as h}from"./chunk-S3AA7ARE.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};
@@ -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 U}from"./chunk-CF3YFDG4.js";import{a as G}from"./chunk-PRXIML4F.js";import{a as w,c as C,e as le}from"./chunk-D76SO2ME.js";var E=C(V=>{var x=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},H=class extends x{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};V.CommanderError=x;V.InvalidArgumentError=H});var $=C(P=>{var{InvalidArgumentError:pe}=E(),k=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new pe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function fe(o){let e=o.name()+(o.variadic===!0?"...":"");return o.required?"<"+e+">":"["+e+"]"}P.Argument=k;P.humanReadableArgName=fe});var T=C(K=>{var{humanReadableArgName:ge}=$(),I=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,r)=>n.name().localeCompare(r.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),r=i.long&&e._findOption(i.long);!n&&!r?t.push(i):i.long&&!r?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(r=>!r.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>ge(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,r=2,s=2;function l(m,O){if(O){let S=`${m.padEnd(i+s)}${O}`;return t.wrap(S,n-r,i+s)}return m}function a(m){return m.join(`
2
+ import{a as U}from"./chunk-52LBQEEC.js";import{a as G}from"./chunk-PRXIML4F.js";import{a as w,c as C,e as le}from"./chunk-D76SO2ME.js";var E=C(V=>{var x=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},H=class extends x{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};V.CommanderError=x;V.InvalidArgumentError=H});var $=C(P=>{var{InvalidArgumentError:pe}=E(),k=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new pe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function fe(o){let e=o.name()+(o.variadic===!0?"...":"");return o.required?"<"+e+">":"["+e+"]"}P.Argument=k;P.humanReadableArgName=fe});var T=C(K=>{var{humanReadableArgName:ge}=$(),I=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,r)=>n.name().localeCompare(r.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),r=i.long&&e._findOption(i.long);!n&&!r?t.push(i):i.long&&!r?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(r=>!r.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>ge(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,r=2,s=2;function l(m,O){if(O){let S=`${m.padEnd(i+s)}${O}`;return t.wrap(S,n-r,i+s)}return m}function a(m){return m.join(`
3
3
  `).replace(/^/gm," ".repeat(r))}let u=[`Usage: ${t.commandUsage(e)}`,""],h=t.commandDescription(e);h.length>0&&(u=u.concat([t.wrap(h,n,0),""]));let c=t.visibleArguments(e).map(m=>l(t.argumentTerm(m),t.argumentDescription(m)));c.length>0&&(u=u.concat(["Arguments:",a(c),""]));let p=t.visibleOptions(e).map(m=>l(t.optionTerm(m),t.optionDescription(m)));if(p.length>0&&(u=u.concat(["Options:",a(p),""])),this.showGlobalOptions){let m=t.visibleGlobalOptions(e).map(O=>l(t.optionTerm(O),t.optionDescription(O)));m.length>0&&(u=u.concat(["Global Options:",a(m),""]))}let b=t.visibleCommands(e).map(m=>l(t.subcommandTerm(m),t.subcommandDescription(m)));return b.length>0&&(u=u.concat(["Commands:",a(b),""])),u.join(`
4
4
  `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,n=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",s=new RegExp(`[\\n][${r}]+`);if(e.match(s))return e;let l=t-i;if(l<n)return e;let a=e.slice(0,i),u=e.slice(i).replace(`\r
5
5
  `,`