@minimax-ai/code 0.6.7 → 0.6.8

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 CHANGED
@@ -7,6 +7,17 @@ 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.8 · 2026-10-11
11
+
12
+ ### Added
13
+
14
+ - Windows TUI adds `skipWindowsHardSafetyChecks` in `config.yaml` to opt out of command-text and path checks that can reject valid scripts. It defaults to `false` and requires a restart. Enabling it weakens protected-path checks; supported deletions still go to the trash, and other permission checks remain active.
15
+
16
+ ### Fixed
17
+
18
+ - On macOS and Linux, deleting files with `rm` now preserves shell variables, globs, quoting and redirections when moving files to the trash. Successful cleanup allows following commands such as `&& npm run build` to continue.
19
+ - With `rm -f`, missing files, empty arguments and repeated targets no longer incorrectly stop cleanup. Directory deletion still requires `-r`; real failures return a nonzero exit status, and protected directories remain blocked. Dynamic targets still require explicit approval when no sandbox is enabled, unless full permission was explicitly granted.
20
+
10
21
  ## 0.6.7 · 2026-10-10
11
22
 
12
23
  ### Added
@@ -8,6 +8,17 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
8
8
 
9
9
  仅内部重构、测试调整,或只影响其他产品界面且不改变 TUI 行为的变化不记录。
10
10
 
11
+ ## 0.6.8 · 2026-10-11
12
+
13
+ ### 新增功能
14
+
15
+ - Windows TUI 新增 `config.yaml` 配置 `skipWindowsHardSafetyChecks`,可跳过可能误拦有效脚本的命令文本和路径检查。默认关闭,修改后需重启。开启会削弱受保护路径检查;支持的删除命令仍转入回收站,其他权限检查继续生效。
16
+
17
+ ### 问题修复
18
+
19
+ - 修复 macOS / Linux 下 `rm` 转入回收站时变量、通配符、引号和重定向处理错误,清理成功后,`&& npm run build` 等后续命令能够继续执行。
20
+ - 修复 `rm -f` 遇到不存在的文件、空参数或重复目标时错误中断的问题。删除目录仍需 `-r`,真实失败仍返回非零状态,受保护目录仍会被阻止。没有启用沙箱时,动态目标仍需明确批准,显式授予完整权限的情况除外。
21
+
11
22
  ## 0.6.7 · 2026-10-10
12
23
 
13
24
  ### 新增功能
package/README.zh-CN.md CHANGED
@@ -32,6 +32,12 @@ MiniMax Code 会检查代码库、完成修改、运行能够执行的验证,
32
32
  运行状态行、单轮结束后的耗时和 Goal 计时统一使用 `s` / `min` / `h`,例如
33
33
  `30s`、`9min30s`、`2h9min30s`;超过一小时仍显示秒。运行耗时统计当前轮,Goal 统计累计 active 时间,两者数值可以不同。
34
34
 
35
+ ## 清理文件与组合命令
36
+
37
+ 在 macOS / Linux,Agent 的 `rm` 会转交给回收站程序。Shell 仍负责展开通配符和变量、处理引号和重定向;例如 `rm -f "$DIR"/*.png 2>/dev/null && npm run build`,清理成功后才执行构建。`-f` 下不存在的文件、空参数和重复目标不会中断后续命令;真实的移动失败仍返回非零退出码。目录需要 `-r`,当前目录、主目录及其祖先仍受到保护。
38
+
39
+ 没有启用沙箱时,包含变量或通配符的删除需要明确授权;`--permission full` 属于明确授权。命令替换、进程替换等会执行代码的参数继续使用保守检查,不承诺兼容全部 Shell 语法或所有 `rm` 扩展选项。
40
+
35
41
  ## 模型、Provider 与终端设置
36
42
 
37
43
  交互模式支持
@@ -634,6 +640,29 @@ mcode provider test <provider-id>
634
640
 
635
641
  </details>
636
642
 
643
+ ## Windows 硬性安全检查开关
644
+
645
+ Windows 下,Runtime 默认会在 `off` 等权限模式之前检查删除命令、回收站工具可用性及受保护/含糊的路径。
646
+ 首次启动生成的 `config.yaml` 会写入顶层 `skipWindowsHardSafetyChecks: false`,与 `permissionMode` 并列。如果这些检查误判
647
+ Python、XML 或 PowerShell 脚本,可在当前 TUI 数据目录的 `config.yaml` 中把它改为 `true`;已有配置
648
+ 没有该项时手动添加。默认路径为 `~/.minimax/config.yaml`(Windows 为 `%USERPROFILE%\.minimax\config.yaml`);
649
+ 设置数据目录、profile 或启动时 `--config` 参数时,修改实际使用的配置文件:
650
+
651
+ ```yaml
652
+ skipWindowsHardSafetyChecks: true
653
+ ```
654
+
655
+ 默认值为 `false`;缺省或错误类型均不跳过,`"true"` 字符串也不会开启。修改后需重启 `mcode`;改回
656
+ `false` 或删除该项并重启即可恢复。该设置仅作用于 Windows TUI Runtime(包括 `exec` / ACP),不影响
657
+ Desktop、macOS 或 Linux。
658
+
659
+ 开启后会跳过 Windows 命令文本和路径的硬性拦截,包括重复的路径检查;受保护路径写入也可能通过这层检查。
660
+ 删除转入回收站的行为保持不变:即使使用 `permissionMode: off`(或 `--permission off`),已有解析器支持的
661
+ `rm` 和 Windows 原生删除仍重写为 `mavis-trash`。回收站不可用、不可信,或已识别的删除无法安全重写时仍会拦截,
662
+ 不会退回执行原始永久删除命令。该开关不扩展删除解析器,不能保证任意脚本内部的删除都被识别和重写。
663
+ 此配置本身不切换权限模式;`default` / `auto` 等模式的规则、确认、通用安全检查及执行层限制仍生效,仍可能阻止命令。
664
+ 它只能解除这层权限拦截,不能修复后续脚本错误或保证文档任务成功。
665
+
637
666
  ## 更新与卸载
638
667
 
639
668
  ```bash
@@ -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-WQPQHX2N.js";import"./chunk-VCAGMAY5.js";import{d as p}from"./chunk-EGP34E73.js";import"./chunk-52X742AN.js";import"./chunk-EZ7Q2NM4.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-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}
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{b as i,c as n,d as o,h as a,i as r}from"./chunk-52X742AN.js";function s(t){let e=i({dataDir:t.dataDir,buildEnv:t.buildEnv,region:t.region}),u=t.oauthClient??h(t.oauthEndpoints),d=r({authHome:e.namespaceHome});return new a({namespace:e,oauthClient:u,credentialStore:d,initialize:()=>n(e)})}function h(t){if(!t)throw new TypeError("Shared MCode OAuth requires explicit device authorization, token, and revocation endpoints.");return new o(t)}export{s as a};
2
+ import{b as i,c as n,d as o,h as a,i as r}from"./chunk-TJWBPT2F.js";function s(t){let e=i({dataDir:t.dataDir,buildEnv:t.buildEnv,region:t.region}),u=t.oauthClient??h(t.oauthEndpoints),d=r({authHome:e.namespaceHome});return new a({namespace:e,oauthClient:u,credentialStore:d,initialize:()=>n(e)})}function h(t){if(!t)throw new TypeError("Shared MCode OAuth requires explicit device authorization, token, and revocation endpoints.");return new o(t)}export{s as a};
@@ -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-VCAGMAY5.js";import{e as g,k as d,m as h}from"./chunk-52X742AN.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-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};