@minimax-ai/code 0.4.0 → 0.4.1

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,21 @@ 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.1 · 2026-09-11
11
+
12
+ ### Improved
13
+
14
+ - Switching models in an existing conversation warns that prompt cache reuse may be lost and additional costs may apply.
15
+ - Goal displays its current wait reason, including result verification.
16
+ - Goal pauses after three consecutive rounds without tool calls to prevent continued idle execution.
17
+
18
+ ### Fixed
19
+
20
+ - Restored the terminal-specific system prompt, with capability instructions following the enabled features.
21
+ - Fixed Goal continuation after user intervention and late usage settlement, and allowed queued user messages to proceed while a Goal waits on dependencies.
22
+ - Shortcut hints follow custom keybindings, including aliases and disabled bindings.
23
+ - Background task details show the full command and error, wrapping long and multiline content.
24
+
10
25
  ## 0.4.0 · 2026-09-11
11
26
 
12
27
  ### Added
@@ -8,6 +8,21 @@ TUI 正式版中用户能直接感知的重要变化。收录范围以 TUI 用
8
8
 
9
9
  仅内部重构、测试调整,或只影响其他产品界面且不改变 TUI 行为的变化不记录。
10
10
 
11
+ ## 0.4.1 · 2026-09-11
12
+
13
+ ### 改进
14
+
15
+ - 在已有会话中切换模型时,提示可能无法复用提示词缓存并产生额外费用。
16
+ - Goal 展示具体等待原因,包括正在验证结果的状态。
17
+ - Goal 连续三轮未调用工具时自动暂停,避免持续空转。
18
+
19
+ ### 修复
20
+
21
+ - 恢复终端专用系统提示词,能力指令随功能开关生效。
22
+ - 修复 Goal 被用户消息打断后停止续跑、延迟用量结算干扰执行,以及等待依赖时阻塞排队消息的问题。
23
+ - 快捷键提示跟随自定义绑定,正确展示别名和已禁用的按键。
24
+ - 后台任务详情显示完整命令和错误信息,长文本及多行内容自动换行。
25
+
11
26
  ## 0.4.0 · 2026-09-11
12
27
 
13
28
  ### 新增
package/README.md CHANGED
@@ -107,7 +107,9 @@ Composer, so a long-running Session does not lose input space as work accumulate
107
107
  open the unified detail view. It lists every task and its state, opens Agent child transcripts with
108
108
  Enter, retains recent completed Runtime tasks after their results are delivered, and exposes task
109
109
  metadata without taking ownership of task state. Delivered history does not keep the Composer
110
- summary visible. `Ctrl+T` continues to open the Todo plan.
110
+ summary visible. `Ctrl+T` continues to open the Todo plan. Background task details show errors first
111
+ and wrap the full Bash command while preserving source line breaks. Use PgUp/PgDn to scroll and
112
+ Esc to return. Older tasks without stored command source show only their existing Description.
111
113
 
112
114
  ### Headless and CI
113
115
 
@@ -229,6 +231,10 @@ mcode --lane oauth2 exec "Verify the OAuth session"
229
231
 
230
232
  Production builds reject `--lane`, and MCode does not infer it from environment variables.
231
233
 
234
+ When you switch providers or models in an existing conversation, the Transcript shows a yellow
235
+ notice that the existing prompt cache may not be reusable and additional costs may occur. Initial
236
+ selection, reselecting the same model, and reasoning-only changes do not show this notice.
237
+
232
238
  Use `/model` in the TUI to select a model and reasoning level. Select `Add 3rd-party provider…` to
233
239
  search models.dev or configure a Custom Provider. API keys stay masked in the form, and Runtime
234
240
  tests the connection before saving and applying the selected model. Use the Provider commands to
package/README.zh-CN.md CHANGED
@@ -105,7 +105,7 @@ Composer 会把当前输入标记为 `Prompt`、`Command`、`Shell` 或
105
105
  Agent Team 与 Runtime 后台任务会在 Composer 上方合并为一条按严重程度排序的 `Tasks`
106
106
  摘要,避免长程 Session 因任务累积而持续挤占输入空间。使用 `/tasks`
107
107
  可打开统一详情视图,查看当前完整列表和状态;按 Enter 可打开 Agent 子 Session 的 Transcript;近期已完成的 Runtime 任务在结果交付后仍会保留,但不会让 Composer 摘要持续显示。任务状态仍由 Runtime 持有,`Ctrl+T`
108
- 仍用于打开 Todo 计划。
108
+ 仍用于打开 Todo 计划。后台任务详情优先展示失败错误,并按终端宽度换行显示完整 Bash 命令(保留原始换行);可用 PgUp/PgDn 滚动、Esc 返回列表。旧任务若没有保存完整命令,只展示已有 Description 摘要。
109
109
 
110
110
  ### 直接执行终端命令
111
111
 
@@ -251,6 +251,9 @@ TUI 启动不再批量迁移历史会话的模型。指向官方网关的 `custo
251
251
 
252
252
  进入或退出 Plan 的下一条消息也使用上述恢复选择。选择 `Keep my draft` 或按 Esc 后,草稿可继续编辑、重新发送,不会发布本次发送的结果;尚未生效的 Plan 切换会保留。如果恢复发送时会话已经被另一轮占用,草稿会保留并提示失败,由用户再次发送。
253
253
 
254
+ 已有对话中成功切换 Provider 或模型后,Transcript 会显示一次黄色提示,提醒可能无法复用之前的缓存、
255
+ 并产生额外花费,不展示具体金额。初次选择、重复选择同一模型和仅调整推理强度不显示该提示。
256
+
254
257
  在 TUI 中使用 `/model` 选择模型和推理强度。选择 `Add 3rd-party provider…`
255
258
  可从 models.dev 搜索已知 Provider 和模型,或配置 Custom Provider。API
256
259
  Key 在表单中保持掩码,Runtime 会先测试连通性,成功后才保存并应用所选模型。使用 Provider 命令查看或配置模型来源:
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{b as I}from"./chunk-TOORQIFW.js";import{J as $,S as k}from"./chunk-Y27DNFV2.js";import{e as X}from"./chunk-D76SO2ME.js";var _=X(I(),1);import{stripVTControlCharacters as F}from"node:util";function g(e){return F(e).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/gu,"")}var O=1e6,M=1e3,V=32,x=/^(?![A-Za-z]:[\\/])(?![\\/])(?!.*(?:^|[\\/])\.\.(?:[\\/]|$))[^\0]+$/u,L=/^sha256:[a-f0-9]{64}$/u,j=/^git-blob:[a-f0-9]{40,64}$/u;function ue(e){if(!E(e))return;let n=e.reviewOutcome;return n==="pass"||n==="needs_changes"||n==="failed"?n:void 0}function de(e){let n=e.trim();if(!(!n.startsWith("<annotation-result")||!n.endsWith("</annotation-result>")))try{let t=G(n);if(R(t,"annotation-result"),p(t,["version","source","review-run-id","trigger","mode","verdict"]),c(t,"version")!=="2"||c(t,"source")!=="code-review"||c(t,"verdict")!=="needs-changes"||!c(t,"review-run-id"))return;let r=c(t,"trigger"),i=c(t,"mode");if(r!=="slash"&&r!=="natural_language"||i!=="inline"&&i!=="subagent")return;f(t),T(t,["summary","annotations"]);let s=b(m(t,"summary")),o=m(t,"annotations");if(p(o,[]),f(o),o.children.some(u=>u.name!=="annotation"))return;let l=o.children.map(q);return!s||l.length===0?void 0:{schemaVersion:1,type:"review.result",scope:"local_changes",verdict:"needs_changes",summary:s,findings:l,mode:i}}catch{return}}function pe(e){let n=e.trim();if(n)return{schemaVersion:1,type:"review.result",scope:"local_changes",verdict:"pass",summary:n,findings:[]}}function ge(e){return!E(e)||e.schemaVersion!==1||e.type!=="review.result"||e.scope!=="local_changes"||e.verdict!=="pass"&&e.verdict!=="needs_changes"||typeof e.summary!="string"||!e.summary.trim()||!Array.isArray(e.findings)||!e.findings.every(U)||e.mode!==void 0&&e.mode!=="inline"&&e.mode!=="subagent"?!1:e.verdict==="pass"?e.findings.length===0:e.findings.length>0}function me(e){return e.verdict==="pass"?g(e.summary):[g(e.summary),...e.findings.flatMap(n=>["",`[${n.priority}] ${g(n.title)}`,g(W(n)),g(n.content)])].join(`
2
+ import{b as I}from"./chunk-OFHDMZSQ.js";import{J as $,S as k}from"./chunk-Y27DNFV2.js";import{e as X}from"./chunk-D76SO2ME.js";var _=X(I(),1);import{stripVTControlCharacters as F}from"node:util";function g(e){return F(e).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/gu,"")}var O=1e6,M=1e3,V=32,x=/^(?![A-Za-z]:[\\/])(?![\\/])(?!.*(?:^|[\\/])\.\.(?:[\\/]|$))[^\0]+$/u,L=/^sha256:[a-f0-9]{64}$/u,j=/^git-blob:[a-f0-9]{40,64}$/u;function ue(e){if(!E(e))return;let n=e.reviewOutcome;return n==="pass"||n==="needs_changes"||n==="failed"?n:void 0}function de(e){let n=e.trim();if(!(!n.startsWith("<annotation-result")||!n.endsWith("</annotation-result>")))try{let t=G(n);if(R(t,"annotation-result"),p(t,["version","source","review-run-id","trigger","mode","verdict"]),c(t,"version")!=="2"||c(t,"source")!=="code-review"||c(t,"verdict")!=="needs-changes"||!c(t,"review-run-id"))return;let r=c(t,"trigger"),i=c(t,"mode");if(r!=="slash"&&r!=="natural_language"||i!=="inline"&&i!=="subagent")return;f(t),T(t,["summary","annotations"]);let s=b(m(t,"summary")),o=m(t,"annotations");if(p(o,[]),f(o),o.children.some(u=>u.name!=="annotation"))return;let l=o.children.map(q);return!s||l.length===0?void 0:{schemaVersion:1,type:"review.result",scope:"local_changes",verdict:"needs_changes",summary:s,findings:l,mode:i}}catch{return}}function pe(e){let n=e.trim();if(n)return{schemaVersion:1,type:"review.result",scope:"local_changes",verdict:"pass",summary:n,findings:[]}}function ge(e){return!E(e)||e.schemaVersion!==1||e.type!=="review.result"||e.scope!=="local_changes"||e.verdict!=="pass"&&e.verdict!=="needs_changes"||typeof e.summary!="string"||!e.summary.trim()||!Array.isArray(e.findings)||!e.findings.every(U)||e.mode!==void 0&&e.mode!=="inline"&&e.mode!=="subagent"?!1:e.verdict==="pass"?e.findings.length===0:e.findings.length>0}function me(e){return e.verdict==="pass"?g(e.summary):[g(e.summary),...e.findings.flatMap(n=>["",`[${n.priority}] ${g(n.title)}`,g(W(n)),g(n.content)])].join(`
3
3
  `)}function W(e){if(e.targetType==="file")return e.path;let n=e.startLine===e.endLine?String(e.startLine):`${String(e.startLine)}-${String(e.endLine)}`;return`${e.path}:${n}${e.side?` (${e.side})`:""}`}function q(e){if(R(e,"annotation"),p(e,["id","kind","priority"]),c(e,"kind")!=="code-review")throw new Error("annotation kind must be code-review");let n=c(e,"id"),t=c(e,"priority");if(!n||!C(t))throw new Error("annotation identity is invalid");f(e),T(e,["target","title","content"]);let r=z(m(e,"target")),i=b(m(e,"title")),s=b(m(e,"content"));if(!i||!s)throw new Error("annotation text is empty");return{id:n,priority:t,...r,title:i,content:s}}function z(e){R(e,"target");let n=c(e,"uri");if(!x.test(n)||c(e,"type")!=="file")throw new Error("annotation target is invalid");if(f(e),e.attributes.state==="deleted"){if(p(e,["type","uri","state","blob-revision"]),e.children.length>0||!j.test(c(e,"blob-revision")))throw new Error("deleted annotation target is invalid");return{targetType:"file",path:n}}p(e,["type","uri"]),T(e,["selector","related-change"]);let t=m(e,"selector");if(p(t,["type","side","start-line","end-line","anchor-revision","context-before","context-after"]),f(t),t.children.length>0||c(t,"type")!=="line-range")throw new Error("annotation selector is invalid");let r=c(t,"side"),i=y(c(t,"start-line")),s=y(c(t,"end-line")),o=t.attributes["anchor-revision"];if(r!=="old"&&r!=="new"||s<i||o!==void 0&&!L.test(o)||!A(t.attributes["context-before"])||!A(t.attributes["context-after"]))throw new Error("annotation selector is invalid");let l=H(e,"related-change");return l&&B(l),{targetType:"line-range",path:n,side:r,startLine:i,endLine:s}}function B(e){p(e,["path","side","start-line","end-line","revision"]),f(e);let n=c(e,"path"),t=c(e,"side"),r=y(c(e,"start-line")),i=y(c(e,"end-line"));if(e.children.length>0||!x.test(n)||t!=="old"&&t!=="new"||i<r||!L.test(c(e,"revision")))throw new Error("related change is invalid")}function G(e){if(e.length>O)throw new Error("Review result is too large");let n,t=!1,r=0,i="",s=[],o=new _.SaxesParser({xmlns:!1});if(o.on("opentag",l=>{r+=1,(r>M||s.length>=V)&&(t=!0);let u={name:l.name,attributes:Object.fromEntries(Object.entries(l.attributes).map(([d,w])=>[d,String(w)])),children:[],text:""},a=s.at(-1);a?a.children.push(u):n?t=!0:n=u,s.push(u)}),o.on("text",l=>{let u=s.at(-1);u?u.text+=l:i+=l}),o.on("closetag",()=>{s.pop()}),o.on("cdata",()=>{t=!0}),o.on("comment",()=>{t=!0}),o.on("doctype",()=>{t=!0}),o.on("processinginstruction",()=>{t=!0}),o.on("error",()=>{t=!0}),o.write(e).close(),t||!n||s.length>0||i.trim())throw new Error("Review result XML is invalid");return n}function b(e){if(p(e,[]),e.children.length>0)throw new Error(`${e.name} must contain text only`);return e.text.trim()}function R(e,n){if(e.name!==n)throw new Error(`Expected ${n}`)}function p(e,n){let t=[...n].sort().join("\0");if(Object.keys(e.attributes).sort().join("\0")!==t)throw new Error(`${e.name} attributes are invalid`)}function f(e){if(e.text.trim())throw new Error(`${e.name} contains unexpected text`)}function T(e,n){let t=new Set(n);if(e.children.some(r=>!t.has(r.name)))throw new Error(`${e.name} contains an unexpected element`)}function m(e,n){let t=e.children.filter(i=>i.name===n),r=t[0];if(t.length!==1||!r)throw new Error(`${e.name} must contain one ${n}`);return r}function H(e,n){let t=e.children.filter(r=>r.name===n);if(t.length>1)throw new Error(`${e.name} contains duplicate ${n}`);return t[0]}function c(e,n){let t=e.attributes[n];if(t===void 0)throw new Error(`${e.name}.${n} is required`);return t}function y(e){if(!/^[1-9]\d*$/u.test(e))throw new Error("Expected a positive integer");let n=Number(e);if(!Number.isSafeInteger(n))throw new Error("Integer is out of range");return n}function A(e){return e===void 0||/^[0-3]$/u.test(e)}function C(e){return e==="P0"||e==="P1"||e==="P2"||e==="P3"}function U(e){return!E(e)||typeof e.id!="string"||!e.id||typeof e.priority!="string"||!C(e.priority)||typeof e.path!="string"||!x.test(e.path)||typeof e.title!="string"||!e.title.trim()||typeof e.content!="string"||!e.content.trim()?!1:e.targetType==="file"?e.side===void 0&&e.startLine===void 0&&e.endLine===void 0:e.targetType==="line-range"&&(e.side==="old"||e.side==="new")&&typeof e.startLine=="number"&&Number.isSafeInteger(e.startLine)&&e.startLine>0&&typeof e.endLine=="number"&&Number.isSafeInteger(e.endLine)&&e.endLine>=e.startLine}function E(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var N=/<(?:deliver[-_]assets|media|publish[_-]artifact|preview_card|genui-|mavis-widget|mavis-thinking|mavis-progress|think|final|permission-(?:ask|response)|questionnaire-(?:ask|response))\b|^\s*preview_cards?:\s*$/imu;function we(e){let n=Z(e);return n.assets.length===0?n.text:[n.text,se(n.assets)].filter(Boolean).join(`
4
4
 
5
5
  `)}function Z(e){if(!e||!N.test(e))return{text:e,assets:[]};let n=$(e),t=[],r=[],i="\uE000mcode-protected";for(;e.includes(i);)i+="-";let s=!1,o=n.map(a=>{if(a.type==="protected"){let d=t.push(a.content)-1;return`${i}-${d}\uE001`}return N.test(a.content)?(s=!0,J(a.content,r)):a.content}).join("");if(!s)return{text:e,assets:[]};let l=oe(o);t.forEach((a,d)=>{l=l.replace(`${i}-${d}\uE001`,a)});let u=[...new Map(r.map(a=>[a.path.trim(),a])).values()];return{text:l,assets:u.map(a=>({path:a.path.trim(),...a.name?.trim()?{name:a.name.trim()}:{}}))}}function J(e,n){let t=e;return t=h(t,"mavis-thinking"),t=h(t,"think"),t=K(t,"mavis-progress"),t=h(t,"permission-ask"),t=h(t,"permission-response"),t=h(t,"questionnaire-ask"),t=h(t,"questionnaire-response"),t=t.replace(/<\/?final\b[^>]*>/giu,""),t=Q(t),t=Y(t),t=ee(t),t=ne(t),t=re(t,n),t=t.replace(/<\/?(?:deliver-assets|deliver_assets)\b[^>]*>/giu,"file attachment").replace(/<media\b[^>]*\/?>/giu,"file attachment").replace(/<media\b[^>]*$/iu,""),t}function h(e,n){let t=new RegExp(`<${n}\\b[^>]*>((?:(?!<${n}\\b)[\\s\\S])*?)<\\/${n}\\s*>`,"giu"),r=e,i=e.replace(t,"");for(;i!==r;)r=i,i=i.replace(t,"");return i}function K(e,n){let t=new RegExp(`<${n}\\b[^>]*>((?:(?!<${n}\\b)[\\s\\S])*?)<\\/${n}\\s*>`,"giu"),r=e,i=e.replace(t,(s,o)=>o.trim());for(;i!==r;)r=i,i=i.replace(t,(s,o)=>o.trim());return i}function Q(e){let n=/<mavis-widget\b([^>]*)>([\s\S]*?)<\/mavis-widget\s*>/giu,t=e.replace(n,(r,i,s)=>{let o=/<mavis-fallback\b[^>]*>([\s\S]*?)<\/mavis-fallback\s*>/iu.exec(s)?.[1];return o?.trim()?o.trim():S(v(i))});return t=t.replace(/<mavis-widget\b([^>]*)>[\s\S]*$/iu,(r,i)=>S(v(i))),t.replace(/<mavis-widget\b[^>]*$/iu,"Interactive content is loading\u2026")}function S(e){let n=e.kind?.trim(),t=e.title?.trim();return n&&t?`Interactive ${n}: ${t} (open in Desktop).`:t?`Interactive content: ${t} (open in Desktop).`:"Interactive content available in Desktop."}function Y(e){let n=/<genui-([\w-]+)\b([^>]*)>[\s\S]*?<\/genui-\1\s*>/giu,t=/<genui-([\w-]+)\b([^>]*?)\/\s*>/giu,r=e.replace(n,(i,s,o)=>D(s,v(o)));return r=r.replace(t,(i,s,o)=>D(s,v(o))),r.replace(/<genui-[\w-]*\b[^>]*$/iu,"Interactive content is loading\u2026")}function D(e,n){if(e.toLocaleLowerCase()==="mcp-auth"){let t=n.label?.trim()||n["server-id"]?.trim();return t?`MCP authorization required: ${t} (open in Desktop).`:"MCP authorization required (open in Desktop)."}if(e.toLocaleLowerCase()==="agent-team-recommendation"){let t=n.status?.trim().toLocaleLowerCase();return t==="accepted"?"Team recommendation accepted.":t==="skipped"?"Team recommendation skipped.":"Team recommendation available in Desktop."}return"Interactive content available in Desktop."}function v(e){let n={},t=/([\w-]+)\s*=\s*(["'])(.*?)\2/gu,r;for(;(r=t.exec(e))!==null;){let i=r[1],s=r[3];i&&s!==void 0&&(n[i]=te(s))}return n}function ee(e){let n=/<(deliver-assets|deliver_assets)\b[^>]*>\s*<\/\1\s*>/giu,t=e,r=e.replace(n,"");for(;r!==t;)t=r,r=r.replace(n,"");return r}function te(e){return e.replace(/&quot;/gu,'"').replace(/&apos;|&#39;/gu,"'").replace(/&lt;/gu,"<").replace(/&gt;/gu,">").replace(/&amp;/gu,"&")}function ne(e){let n=/<\/?(deliver-assets|deliver_assets)\b[^>]*>/giu,t=[],r;for(;(r=n.exec(e))!==null;)t.push({start:r.index,end:n.lastIndex,name:r[1]?.toLocaleLowerCase()??"",closing:r[0].startsWith("</")});if(t.length===0)return e;let i=[],s=new Set;if(t.forEach((u,a)=>{if(!u.closing){i.push(a);return}for(let d=i.length-1;d>=0;d-=1){let w=i[d];if(!(w===void 0||t[w]?.name!==u.name)){i.splice(d,1),s.add(w),s.add(a);return}}}),s.size===t.length)return e;let o=0,l="";return t.forEach((u,a)=>{l+=e.slice(o,u.start),l+=s.has(a)?e.slice(u.start,u.end):"file attachment",o=u.end}),l+e.slice(o)}function re(e,n){let t=e;for(let r=0;r<3;r+=1){let i=k(t),s=ie(i);if(s.assets.length===0)break;n.push(...s.assets),t=s.text}return t}function ie(e){let n=[],t=[];for(let r of e)r.type==="deliver-assets"||r.type==="image-gallery"?t.push(...r.items):r.content.trim()&&n.push(r.content.trim());return{text:n.join(`