@miphamai/cli 0.85.4 → 0.85.6

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 (52) hide show
  1. package/bin/mipham.ts +48 -7
  2. package/package.json +2 -2
  3. package/src/agent/agent-context.ts +8 -1
  4. package/src/agent/effectiveness-tracker.ts +16 -2
  5. package/src/agent/sub-agent.ts +25 -17
  6. package/src/agent-view/agents-standalone.tsx +42 -0
  7. package/src/core/autocomplete.ts +30 -2
  8. package/src/core/context.ts +61 -6
  9. package/src/core/dream-engine.ts +17 -2
  10. package/src/core/engine.ts +95 -34
  11. package/src/core/error-signature-db.ts +7 -2
  12. package/src/core/hooks-executor.ts +88 -11
  13. package/src/core/hooks.ts +26 -2
  14. package/src/core/instructions.ts +105 -17
  15. package/src/core/memory/memory-manager.ts +14 -6
  16. package/src/core/permission-classifier.ts +17 -5
  17. package/src/core/permission-rules.ts +1 -1
  18. package/src/core/permission.ts +50 -1
  19. package/src/core/rule-engine.ts +27 -2
  20. package/src/core/self-critique.ts +15 -3
  21. package/src/core/session-log.ts +60 -0
  22. package/src/daemon/index.ts +2 -5
  23. package/src/daemon/launch.ts +69 -2
  24. package/src/daemon/server.ts +19 -14
  25. package/src/i18n-core/locales/en-US.json +86 -143
  26. package/src/i18n-core/locales/zh-CN.json +86 -143
  27. package/src/index.tsx +17 -7
  28. package/src/mcp/client.ts +61 -0
  29. package/src/mcp/instructions.ts +49 -0
  30. package/src/mcp/types.ts +7 -0
  31. package/src/plugin/claude-plugin.ts +12 -2
  32. package/src/plugin/plugin-loader.ts +32 -14
  33. package/src/plugin/plugin-manager.ts +16 -2
  34. package/src/plugin/plugin-validator.ts +183 -1
  35. package/src/providers/anthropic.ts +159 -124
  36. package/src/providers/fetch-utils.ts +65 -34
  37. package/src/providers/openai-compat.ts +121 -106
  38. package/src/security/dangerous-rm.ts +192 -0
  39. package/src/shared/arg-validation.ts +11 -1
  40. package/src/shared/constants.ts +18 -0
  41. package/src/shared/deleted-cwd.ts +46 -1
  42. package/src/shared/package-info.ts +36 -1
  43. package/src/shared/types.ts +8 -0
  44. package/src/shared/update.ts +290 -146
  45. package/src/ui/command-picker.tsx +18 -10
  46. package/src/ui/commands.ts +20 -6
  47. package/src/ui/config-wizard.tsx +22 -19
  48. package/src/ui/graft-status.tsx +35 -6
  49. package/src/ui/input.tsx +7 -2
  50. package/src/ui/picker.tsx +38 -27
  51. package/src/ui/use-key-state.ts +55 -0
  52. package/src/daemon/message-bus.ts +0 -84
@@ -42,129 +42,11 @@
42
42
  "dismiss": "Dismiss",
43
43
  "terminalName": "Mipham Code"
44
44
  },
45
- "web": {
46
- "hero": {
47
- "title": "Mipham Code",
48
- "subtitle": "Multi-model open-core intelligent coding terminal. Built for developers who demand power, speed, and flexibility.",
49
- "company": "Powered by One Mipham Corporation | 北京华安麦逸科技有限公司",
50
- "domains": "International: mipham.ai  |  中国大陆: onemipham.com",
51
- "cta_start": "Get Started",
52
- "cta_docs": "Documentation"
53
- },
54
- "features": {
55
- "title": "Why Mipham Code?",
56
- "multi_model": {
57
- "title": "Multi-Model",
58
- "desc": "Connect to Claude, GPT, DeepSeek, Qwen, Kimi, and more through a unified interface. Switch models on the fly with Ctrl+P."
59
- },
60
- "slash_commands": {
61
- "title": "85 Slash Commands",
62
- "desc": "Full Claude Code parity: /commit, /pr, /simplify, /lint, /loop init, /browse-plugins — all 85 commands with zero learning curve."
63
- },
64
- "plugins": {
65
- "title": "Plugin Marketplace",
66
- "desc": "Install plugins from npm or local paths. Discover community plugins including NotebookLM MCP integration."
67
- },
68
- "loopkit": {
69
- "title": "LoopKit Vault",
70
- "desc": "/loop init scaffolds a complete project structure: .mipham/ config, hooks, agents, 9-domain skills, .mcp.json, and more."
71
- },
72
- "mcp": {
73
- "title": "MCP Protocol",
74
- "desc": "Full Model Context Protocol support with stdio transport. Connect to NotebookLM, filesystem, GitHub, and custom MCP servers."
75
- },
76
- "secure": {
77
- "title": "Open-Core & Secure",
78
- "desc": "Apache 2.0 license. TLS 1.3, AES-256-GCM encryption, comprehensive permission system. Enterprise security out of the box."
79
- }
80
- },
81
- "models": {
82
- "title": "Supported Models",
83
- "status_active": "Active",
84
- "status_upcoming": "Upcoming"
85
- },
86
- "install_section": {
87
- "title": "Install in Seconds",
88
- "subtitle": "Four ways to install — choose what works for your platform.",
89
- "npm_recommended": "npm (recommended)",
90
- "curl_label": "curl (macOS / Linux)",
91
- "powershell_label": "PowerShell (Windows)",
92
- "label_international": "International · 国际站",
93
- "label_china": "中国大陆 · China mainland",
94
- "requirements": "Requires Bun 1.2+ or Node.js 22+. Supports macOS, Linux, Windows.",
95
- "full_guide": "Full installation guide"
96
- },
97
- "footer": {
98
- "copyright": "© {year} One Mipham Corporation. All rights reserved.",
99
- "docs": "Docs",
100
- "dashboard": "Dashboard",
101
- "github": "GitHub"
102
- },
103
- "install_page": {
104
- "title": "Installation",
105
- "current_version": "Current version:",
106
- "choose_platform": "Choose your platform and preferred install method.",
107
- "all_methods_same": "All methods install the same Mipham Code.",
108
- "prerequisites": "Prerequisites",
109
- "prereq_bun": "Bun 1.2+ (recommended) or Node.js 22+",
110
- "prereq_os": "macOS, Linux, or Windows (PowerShell)",
111
- "prereq_api_key": "At least one AI provider API key (e.g., Anthropic, OpenAI)",
112
- "npm_title": "1. npm Install (Recommended)",
113
- "npm_desc": "Works on all platforms — macOS, Linux, Windows.",
114
- "curl_title": "2. curl Install (macOS / Linux)",
115
- "powershell_title": "3. PowerShell Install (Windows)",
116
- "direct_download": "4. Direct Download",
117
- "table_platform": "Platform",
118
- "table_download": "Download",
119
- "platform_mac_arm": "macOS (Apple Silicon)",
120
- "platform_mac_intel": "macOS (Intel)",
121
- "platform_linux": "Linux (x64)",
122
- "platform_windows": "Windows (x64)",
123
- "verify_title": "Verify Installation",
124
- "start_title": "Start Mipham Code",
125
- "first_launch": "On first launch, the interactive setup wizard (/setup) will guide you through provider configuration, model selection, skills installation, and permissions.",
126
- "api_keys_title": "Set API Keys",
127
- "api_keys_desc": "Export your provider API keys as environment variables:",
128
- "international": "International · 国际站",
129
- "china_mainland": "中国大陆 · China mainland"
130
- },
131
- "docs": {
132
- "title": "Documentation",
133
- "quick_start": "Quick Start",
134
- "configuration": "Configuration",
135
- "commands": "Commands",
136
- "help": "Show help",
137
- "model": "Show current model",
138
- "switch": "Switch model",
139
- "clear": "Clear conversation",
140
- "exit": "Exit Mipham Code"
141
- },
142
- "dashboard": {
143
- "title": "Dashboard",
144
- "coming_soon": "Coming Soon",
145
- "description": "The Mipham Code dashboard will show your usage analytics — session history, token consumption, most-used models and tools, and skill activity. We’re building this now.",
146
- "sessions": "Sessions",
147
- "sessions_desc": "Session history & stats",
148
- "tokens": "Tokens",
149
- "tokens_desc": "Usage across providers",
150
- "skills": "Skills",
151
- "skills_desc": "Active skill analytics"
152
- },
153
- "not_found": {
154
- "code": "404",
155
- "title": "Page not found",
156
- "description": "The page you’re looking for doesn’t exist.",
157
- "back": "Back to Mipham Code"
158
- },
159
- "error": {
160
- "title": "Something went wrong",
161
- "fallback_message": "An unexpected error occurred.",
162
- "try_again": "Try again"
163
- }
164
- },
165
45
  "greeting": "Hello {name}",
166
46
  "commands": {
167
- "clear": { "confirmed": "✓ Conversation cleared. Context reset." },
47
+ "clear": {
48
+ "confirmed": "✓ Conversation cleared. Context reset."
49
+ },
168
50
  "compact": {
169
51
  "confirmed": "✓ Context compacted.",
170
52
  "tokens": "Tokens: {before} → {after} (saved {saved}%)"
@@ -333,7 +215,9 @@
333
215
  "not_found_content": "No session named \"{name}\".\n\nUse /resume without arguments to list all saved sessions.",
334
216
  "found_content": "Name: {name}\nMessages: {messages}\nProvider: {provider} / {model}\nUpdated: {updated}\n\nTo continue this session, start a new process with:\n mipham --resume \"{target}\""
335
217
  },
336
- "help": { "title": "── Mipham Code Help ──" },
218
+ "help": {
219
+ "title": "── Mipham Code Help ──"
220
+ },
337
221
  "lang": {
338
222
  "current": "Language: {locale}",
339
223
  "set": "Language set to {locale}. Restart Mipham Code to apply."
@@ -433,6 +317,8 @@
433
317
  "update_failed": "✗ Update failed: {reason}{rolledBack}\n Try manually: {command}\n Your config backup is at: {path}",
434
318
  "rolled_back": "\n Your previous install was restored — mipham still works.",
435
319
  "no_rollback": "\n ⚠ Your previous install could not be restored — reinstall it manually (see below).",
320
+ "install_untouched": "\n Your previous install was not touched — mipham still works.",
321
+ "install_unknown": "\n ⚠ Could not locate the global install path — unable to tell whether your install survived.",
436
322
  "unverified": "⚠ Installed, but could not verify the new version: {reason}"
437
323
  },
438
324
  "no_plan": {
@@ -849,9 +735,15 @@
849
735
  "finished": "finished",
850
736
  "status_label": "Agents"
851
737
  },
852
- "system": { "role_label": "System" },
853
- "assistant": { "role_label": "Mipham Code" },
854
- "user": { "role_label": "User" },
738
+ "system": {
739
+ "role_label": "System"
740
+ },
741
+ "assistant": {
742
+ "role_label": "Mipham Code"
743
+ },
744
+ "user": {
745
+ "role_label": "User"
746
+ },
855
747
  "input": {
856
748
  "placeholder": "Type a message (Esc to clear)..."
857
749
  },
@@ -976,28 +868,77 @@
976
868
  }
977
869
  },
978
870
  "tools": {
979
- "bash": { "name": "Bash", "description": "Execute shell commands" },
980
- "read": { "name": "Read", "description": "Read a file from the filesystem" },
981
- "write": { "name": "Write", "description": "Write content to a file" },
982
- "edit": { "name": "Edit", "description": "Edit a file with string replacement" },
983
- "glob": { "name": "Glob", "description": "Find files matching a pattern" },
984
- "grep": { "name": "Grep", "description": "Search file contents with regex" },
985
- "web_fetch": { "name": "WebFetch", "description": "Fetch a URL and parse content" },
986
- "web_search": { "name": "WebSearch", "description": "Search the web" },
987
- "agent": { "name": "Agent", "description": "Launch a sub-agent for complex tasks" },
988
- "task": { "name": "Task", "description": "Create and track tasks" },
989
- "skill": { "name": "Skill", "description": "Invoke a named skill" },
990
- "memory": { "name": "Memory", "description": "Read/write persistent memory" },
991
- "workflow": { "name": "Workflow", "description": "Execute a multi-agent workflow" },
992
- "plan": { "name": "Plan", "description": "Enter plan mode for structured thinking" },
993
- "config": { "name": "Config", "description": "View and modify configuration" },
994
- "mcp": { "name": "MCP", "description": "Manage MCP server connections" }
871
+ "bash": {
872
+ "name": "Bash",
873
+ "description": "Execute shell commands"
874
+ },
875
+ "read": {
876
+ "name": "Read",
877
+ "description": "Read a file from the filesystem"
878
+ },
879
+ "write": {
880
+ "name": "Write",
881
+ "description": "Write content to a file"
882
+ },
883
+ "edit": {
884
+ "name": "Edit",
885
+ "description": "Edit a file with string replacement"
886
+ },
887
+ "glob": {
888
+ "name": "Glob",
889
+ "description": "Find files matching a pattern"
890
+ },
891
+ "grep": {
892
+ "name": "Grep",
893
+ "description": "Search file contents with regex"
894
+ },
895
+ "web_fetch": {
896
+ "name": "WebFetch",
897
+ "description": "Fetch a URL and parse content"
898
+ },
899
+ "web_search": {
900
+ "name": "WebSearch",
901
+ "description": "Search the web"
902
+ },
903
+ "agent": {
904
+ "name": "Agent",
905
+ "description": "Launch a sub-agent for complex tasks"
906
+ },
907
+ "task": {
908
+ "name": "Task",
909
+ "description": "Create and track tasks"
910
+ },
911
+ "skill": {
912
+ "name": "Skill",
913
+ "description": "Invoke a named skill"
914
+ },
915
+ "memory": {
916
+ "name": "Memory",
917
+ "description": "Read/write persistent memory"
918
+ },
919
+ "workflow": {
920
+ "name": "Workflow",
921
+ "description": "Execute a multi-agent workflow"
922
+ },
923
+ "plan": {
924
+ "name": "Plan",
925
+ "description": "Enter plan mode for structured thinking"
926
+ },
927
+ "config": {
928
+ "name": "Config",
929
+ "description": "View and modify configuration"
930
+ },
931
+ "mcp": {
932
+ "name": "MCP",
933
+ "description": "Manage MCP server connections"
934
+ }
995
935
  },
996
936
  "errors": {
997
937
  "tool_denied_deny_rule": "Tool \"{name}\" blocked by a deny rule (\"{pattern}\"). Deny rules override permission mode — try a different approach, or drop the rule with: /permissions remove \"{pattern}\"",
998
938
  "tool_denied_ask_rule": "Tool \"{name}\" requires approval (ask rule: \"{pattern}\"). Approve when prompted, or stop being asked with: /permissions allow \"{pattern}\"",
999
- "tool_denied_mode": "Tool \"{name}\" requires approval under \"{mode}\" mode. Press Shift+Tab to switch permission mode, or stop being asked with: /permissions allow \"{name}\" (or a narrower \"{name}(arg)\")",
1000
- "tool_denied_classifier": "Tool \"{name}\" was blocked in auto mode by the permission classifier ({reason}). This is a policy decision, not a failure — switching modes will not change it, and repeating the identical call returns the same ruling. Change the call so it no longer trips the rule, or allow it outright with: /permissions allow \"{name}\"",
939
+ "tool_denied_mode": "Tool \"{name}\" requires approval under \"{mode}\" mode. Press Shift+Tab to switch permission mode, or stop being asked with: /permissions allow \"{name}\" (or a narrower \"{name}(arg)\") Treat this denial as covering the outcome, not only this exact command.",
940
+ "tool_denied_classifier": "Tool \"{name}\" was blocked in auto mode by the permission classifier ({reason}). This is a policy decision, not a failure — switching modes will not change it, and repeating the identical call returns the same ruling. Change the call so it no longer trips the rule, or allow it outright with: /permissions allow \"{name}\" Treat this denial as covering the outcome, not only this exact command.",
941
+ "tool_denied_dangerous_rm": "Tool \"{name}\" was refused: this is a recursive rm whose target is not a path written in the command (\"{target}\"). The target is produced when the command runs, so neither an allow rule nor the permission mode can bound what it deletes. Name the directory literally instead — `rm -rf node_modules` rather than `rm -rf \"$(pwd)\"` — and treat this refusal as covering the outcome, not only this exact spelling. To turn this check off: MIPHAM_DISABLE_DANGEROUS_RM_PROMPT=1",
1001
942
  "tool_denied_classifier_unavailable": "Tool \"{name}\" was held back because the auto-mode classifier could not be reached or its answer could not be read ({reason}). This is NOT a policy decision — the call was never judged, and retrying is appropriate. If this keeps happening, switch modes with Shift+Tab.",
1002
943
  "tool_blocked": "Tool \"{name}\" blocked by hook",
1003
944
  "user_input_blocked": "User input blocked by hook.",
@@ -1020,6 +961,8 @@
1020
961
  "max_tool_turns": "Max tool-calling turns ({max}) reached. Some tool calls were not executed.",
1021
962
  "max_tool_turns_warning": "You've reached the maximum of {max} tool-calling rounds. {pending} tool call(s) were not executed. Please summarize what you found so far and any next steps the user should take.",
1022
963
  "turn_timeout": "Task produced no substantial output for {minutes} minutes and was stopped. Break the task into smaller steps or clarify the next step, then retry.",
964
+ "turn_truncated": "The response was cut off mid-turn, not finished — the provider stopped at its output limit or the connection closed.",
965
+ "stop_hook_budget_spent": "The Stop hook asked for more work (\"{reason}\"), but this turn has used all {max} of its tool-calling rounds — stopping here. Send another message to continue.",
1023
966
  "mcp_not_connected": "Error: MCP server \"{server}\" not connected",
1024
967
  "mcp_tool_error": "MCP tool error: {error}",
1025
968
  "mcp_no_connection": "No connection for \"{name}\""
@@ -42,129 +42,11 @@
42
42
  "dismiss": "关闭",
43
43
  "terminalName": "Mipham Code"
44
44
  },
45
- "web": {
46
- "hero": {
47
- "title": "Mipham Code",
48
- "subtitle": "多模型开源智能编程终端。为追求性能、速度和灵活性的开发者而打造。",
49
- "company": "由 One Mipham Corporation 驱动 | 北京华安麦逄科技有限公司",
50
- "domains": "国际站: mipham.ai  |  中国大陆: onemipham.com",
51
- "cta_start": "快速开始",
52
- "cta_docs": "文档"
53
- },
54
- "features": {
55
- "title": "为什么选择 Mipham Code?",
56
- "multi_model": {
57
- "title": "多模型支持",
58
- "desc": "通过统一接口连接 Claude、GPT、DeepSeek、Qwen、Kimi 等。使用 Ctrl+P 实时切换模型。"
59
- },
60
- "slash_commands": {
61
- "title": "85 个 Slash 命令",
62
- "desc": "完全对标 Claude Code:/commit、/pr、/simplify、/lint、/loop init、/browse-plugins — 全部 85 个命令,零学习成本。"
63
- },
64
- "plugins": {
65
- "title": "插件市场",
66
- "desc": "从 npm 或本地路径安装插件。探索社区插件,包括 NotebookLM MCP 集成。"
67
- },
68
- "loopkit": {
69
- "title": "LoopKit Vault",
70
- "desc": "/loop init 初始化完整的项目结构:.mipham/ 配置、钩子、代理、9 领域技能、.mcp.json 等。"
71
- },
72
- "mcp": {
73
- "title": "MCP 协议",
74
- "desc": "完整的 Model Context Protocol 支持,基于 stdio 传输。连接 NotebookLM、文件系统、GitHub 和自定义 MCP 服务器。"
75
- },
76
- "secure": {
77
- "title": "开源核心 · 安全可靠",
78
- "desc": "Apache 2.0 许可证。TLS 1.3、AES-256-GCM 加密,全面的权限系统。开箱即用的企业级安全。"
79
- }
80
- },
81
- "models": {
82
- "title": "支持的模型",
83
- "status_active": "已上线",
84
- "status_upcoming": "即将推出"
85
- },
86
- "install_section": {
87
- "title": "秒级安装",
88
- "subtitle": "四种安装方式 — 选择适合你的平台。",
89
- "npm_recommended": "npm(推荐)",
90
- "curl_label": "curl(macOS / Linux)",
91
- "powershell_label": "PowerShell(Windows)",
92
- "label_international": "International · 国际站",
93
- "label_china": "中国大陆 · China mainland",
94
- "requirements": "需要 Bun 1.2+ 或 Node.js 22+。支持 macOS、Linux、Windows。",
95
- "full_guide": "完整安装指南"
96
- },
97
- "footer": {
98
- "copyright": "© {year} One Mipham Corporation。保留所有权利。",
99
- "docs": "文档",
100
- "dashboard": "控制台",
101
- "github": "GitHub"
102
- },
103
- "install_page": {
104
- "title": "安装指南",
105
- "current_version": "当前版本:",
106
- "choose_platform": "选择适合你的平台和安装方式。",
107
- "all_methods_same": "所有方式安装的是同一个 Mipham Code。",
108
- "prerequisites": "前置要求",
109
- "prereq_bun": "Bun 1.2+(推荐)或 Node.js 22+",
110
- "prereq_os": "macOS、Linux 或 Windows(PowerShell)",
111
- "prereq_api_key": "至少一个 AI 提供商的 API 密钥(如 Anthropic、OpenAI)",
112
- "npm_title": "1. npm 安装(推荐)",
113
- "npm_desc": "适用于所有平台 — macOS、Linux、Windows。",
114
- "curl_title": "2. curl 安装(macOS / Linux)",
115
- "powershell_title": "3. PowerShell 安装(Windows)",
116
- "direct_download": "4. 直接下载",
117
- "table_platform": "平台",
118
- "table_download": "下载",
119
- "platform_mac_arm": "macOS(Apple Silicon)",
120
- "platform_mac_intel": "macOS(Intel)",
121
- "platform_linux": "Linux(x64)",
122
- "platform_windows": "Windows(x64)",
123
- "verify_title": "验证安装",
124
- "start_title": "启动 Mipham Code",
125
- "first_launch": "首次启动时,交互式设置向导(/setup)将引导你完成提供商配置、模型选择、技能安装和权限设置。",
126
- "api_keys_title": "设置 API 密钥",
127
- "api_keys_desc": "将提供商的 API 密钥导出为环境变量:",
128
- "international": "International · 国际站",
129
- "china_mainland": "中国大陆 · China mainland"
130
- },
131
- "docs": {
132
- "title": "文档",
133
- "quick_start": "快速开始",
134
- "configuration": "配置",
135
- "commands": "命令",
136
- "help": "显示帮助",
137
- "model": "显示当前模型",
138
- "switch": "切换模型",
139
- "clear": "清除对话",
140
- "exit": "退出 Mipham Code"
141
- },
142
- "dashboard": {
143
- "title": "控制台",
144
- "coming_soon": "即将推出",
145
- "description": "Mipham Code 控制台将展示你的使用分析 — 会话历史、Token 消耗、最常用的模型和工具以及技能活动。我们正在开发中。",
146
- "sessions": "会话",
147
- "sessions_desc": "会话历史与统计",
148
- "tokens": "Token",
149
- "tokens_desc": "各提供商用量",
150
- "skills": "技能",
151
- "skills_desc": "活跃技能分析"
152
- },
153
- "not_found": {
154
- "code": "404",
155
- "title": "页面未找到",
156
- "description": "你要找的页面不存在。",
157
- "back": "返回 Mipham Code"
158
- },
159
- "error": {
160
- "title": "出了点问题",
161
- "fallback_message": "发生了意外错误。",
162
- "try_again": "重试"
163
- }
164
- },
165
45
  "greeting": "你好 {name}",
166
46
  "commands": {
167
- "clear": { "confirmed": "✓ 对话已清除,上下文已重置。" },
47
+ "clear": {
48
+ "confirmed": "✓ 对话已清除,上下文已重置。"
49
+ },
168
50
  "compact": {
169
51
  "confirmed": "✓ 上下文已压缩。",
170
52
  "tokens": "Tokens: {before} → {after} (节省 {saved}%)"
@@ -333,7 +215,9 @@
333
215
  "not_found_content": "未找到名为 \"{name}\" 的会话。\n\n不带参数运行 /resume 列出所有已保存的会话。",
334
216
  "found_content": "名称: {name}\n消息数: {messages}\n提供商: {provider} / {model}\n更新时间: {updated}\n\n要接着此会话继续,请另起进程运行:\n mipham --resume \"{target}\""
335
217
  },
336
- "help": { "title": "── Mipham Code 帮助 ──" },
218
+ "help": {
219
+ "title": "── Mipham Code 帮助 ──"
220
+ },
337
221
  "lang": {
338
222
  "current": "当前语言: {locale}",
339
223
  "set": "语言已设置为 {locale}。重启 Mipham Code 生效。"
@@ -433,6 +317,8 @@
433
317
  "update_failed": "✗ 更新失败: {reason}{rolledBack}\n 手动尝试: {command}\n 配置备份位于: {path}",
434
318
  "rolled_back": "\n 已恢复原安装 —— mipham 仍可使用。",
435
319
  "no_rollback": "\n ⚠ 原安装未能恢复 —— 请按下方命令手动重装。",
320
+ "install_untouched": "\n 原安装未被改动 —— mipham 仍可使用。",
321
+ "install_unknown": "\n ⚠ 无法定位全局安装路径 —— 无法判断原安装是否完好。",
436
322
  "unverified": "⚠ 已安装,但无法验证新版本: {reason}"
437
323
  },
438
324
  "no_plan": {
@@ -849,9 +735,15 @@
849
735
  "finished": "已完成",
850
736
  "status_label": "代理"
851
737
  },
852
- "system": { "role_label": "系统" },
853
- "assistant": { "role_label": "Mipham Code" },
854
- "user": { "role_label": "用户" },
738
+ "system": {
739
+ "role_label": "系统"
740
+ },
741
+ "assistant": {
742
+ "role_label": "Mipham Code"
743
+ },
744
+ "user": {
745
+ "role_label": "用户"
746
+ },
855
747
  "input": {
856
748
  "placeholder": "输入消息(Esc 清空)..."
857
749
  },
@@ -976,28 +868,77 @@
976
868
  }
977
869
  },
978
870
  "tools": {
979
- "bash": { "name": "Bash", "description": "执行 Shell 命令" },
980
- "read": { "name": "Read", "description": "从文件系统读取文件" },
981
- "write": { "name": "Write", "description": "写入内容到文件" },
982
- "edit": { "name": "Edit", "description": "通过字符串替换编辑文件" },
983
- "glob": { "name": "Glob", "description": "查找匹配模式的文件" },
984
- "grep": { "name": "Grep", "description": "使用正则表达式搜索文件内容" },
985
- "web_fetch": { "name": "WebFetch", "description": "获取 URL 并解析内容" },
986
- "web_search": { "name": "WebSearch", "description": "搜索网页" },
987
- "agent": { "name": "Agent", "description": "启动子代理执行复杂任务" },
988
- "task": { "name": "Task", "description": "创建和跟踪任务" },
989
- "skill": { "name": "Skill", "description": "调用命名技能" },
990
- "memory": { "name": "Memory", "description": "读写持久记忆" },
991
- "workflow": { "name": "Workflow", "description": "执行多代理工作流" },
992
- "plan": { "name": "Plan", "description": "进入计划模式进行结构化思考" },
993
- "config": { "name": "Config", "description": "查看和修改配置" },
994
- "mcp": { "name": "MCP", "description": "管理 MCP 服务器连接" }
871
+ "bash": {
872
+ "name": "Bash",
873
+ "description": "执行 Shell 命令"
874
+ },
875
+ "read": {
876
+ "name": "Read",
877
+ "description": "从文件系统读取文件"
878
+ },
879
+ "write": {
880
+ "name": "Write",
881
+ "description": "写入内容到文件"
882
+ },
883
+ "edit": {
884
+ "name": "Edit",
885
+ "description": "通过字符串替换编辑文件"
886
+ },
887
+ "glob": {
888
+ "name": "Glob",
889
+ "description": "查找匹配模式的文件"
890
+ },
891
+ "grep": {
892
+ "name": "Grep",
893
+ "description": "使用正则表达式搜索文件内容"
894
+ },
895
+ "web_fetch": {
896
+ "name": "WebFetch",
897
+ "description": "获取 URL 并解析内容"
898
+ },
899
+ "web_search": {
900
+ "name": "WebSearch",
901
+ "description": "搜索网页"
902
+ },
903
+ "agent": {
904
+ "name": "Agent",
905
+ "description": "启动子代理执行复杂任务"
906
+ },
907
+ "task": {
908
+ "name": "Task",
909
+ "description": "创建和跟踪任务"
910
+ },
911
+ "skill": {
912
+ "name": "Skill",
913
+ "description": "调用命名技能"
914
+ },
915
+ "memory": {
916
+ "name": "Memory",
917
+ "description": "读写持久记忆"
918
+ },
919
+ "workflow": {
920
+ "name": "Workflow",
921
+ "description": "执行多代理工作流"
922
+ },
923
+ "plan": {
924
+ "name": "Plan",
925
+ "description": "进入计划模式进行结构化思考"
926
+ },
927
+ "config": {
928
+ "name": "Config",
929
+ "description": "查看和修改配置"
930
+ },
931
+ "mcp": {
932
+ "name": "MCP",
933
+ "description": "管理 MCP 服务器连接"
934
+ }
995
935
  },
996
936
  "errors": {
997
937
  "tool_denied_deny_rule": "工具 \"{name}\" 被拒绝规则(\"{pattern}\")阻止。拒绝规则优先于权限模式 — 请改用其他方式,或移除该规则:/permissions remove \"{pattern}\"",
998
938
  "tool_denied_ask_rule": "工具 \"{name}\" 需要批准(ask 规则:\"{pattern}\")。请在提示时批准,或不再询问:/permissions allow \"{pattern}\"",
999
- "tool_denied_mode": "工具 \"{name}\" 在 \"{mode}\" 模式下需要批准。按 Shift+Tab 切换权限模式,或不再询问:/permissions allow \"{name}\"(更窄的 \"{name}(arg)\" 亦可)",
1000
- "tool_denied_classifier": "工具 \"{name}\" 在 auto 模式下被权限分类器拦下({reason})。这是策略裁决、不是故障 —— 切换模式不会改变它,把同一次调用原样重发也只会得到同一个裁决。请改变这次调用使其不再触犯该规则,或直接放行:/permissions allow \"{name}\"",
939
+ "tool_denied_mode": "工具 \"{name}\" 在 \"{mode}\" 模式下需要批准。按 Shift+Tab 切换权限模式,或不再询问:/permissions allow \"{name}\"(更窄的 \"{name}(arg)\" 亦可) 请把这次拒绝理解为对结果本身的禁止,而不只是这一条命令。",
940
+ "tool_denied_classifier": "工具 \"{name}\" 在 auto 模式下被权限分类器拦下({reason})。这是策略裁决、不是故障 —— 切换模式不会改变它,把同一次调用原样重发也只会得到同一个裁决。请改变这次调用使其不再触犯该规则,或直接放行:/permissions allow \"{name}\" 请把这次拒绝理解为对结果本身的禁止,而不只是这一条命令。",
941
+ "tool_denied_dangerous_rm": "工具 \"{name}\" 被拒绝:这是一条递归 rm,其目标并非命令里写出的路径(\"{target}\")。该目标要到命令运行时才产生,所以任何放行规则与权限模式都无法界定它会删掉什么。请改为字面写出目录名 —— 用 `rm -rf node_modules` 而不是 `rm -rf \"$(pwd)\"` —— 并把这次拒绝理解为对结果本身的禁止,而不只是这一种写法。关闭此检查:MIPHAM_DISABLE_DANGEROUS_RM_PROMPT=1",
1001
942
  "tool_denied_classifier_unavailable": "工具 \"{name}\" 被暂缓:auto 模式的分类器不可达,或其回复无法解析({reason})。这**不是**策略裁决 —— 该调用从未被裁决,重试是恰当的。若持续发生,按 Shift+Tab 切换模式。",
1002
943
  "tool_blocked": "工具 \"{name}\" 被钩子拦截",
1003
944
  "user_input_blocked": "用户输入被钩子拦截。",
@@ -1020,6 +961,8 @@
1020
961
  "max_tool_turns": "超出最大工具调用轮次({max})。部分工具调用未执行。",
1021
962
  "max_tool_turns_warning": "已达到最大 {max} 轮工具调用。{pending} 个工具调用未执行。请总结当前发现及后续步骤。",
1022
963
  "turn_timeout": "任务已超过 {minutes} 分钟无实质产出,已自动停止。建议拆分任务或明确下一步后重新发起。",
964
+ "turn_truncated": "回复写到一半就断了,不是正常写完 —— 提供商到了输出上限,或连接被关闭。",
965
+ "stop_hook_budget_spent": "Stop 钩子要求继续({reason}),但本轮 {max} 轮工具调用已用尽 —— 就此停下。再发一条消息即可继续。",
1023
966
  "mcp_not_connected": "错误:MCP 服务器 \"{server}\" 未连接",
1024
967
  "mcp_tool_error": "MCP 工具错误:{error}",
1025
968
  "mcp_no_connection": "未找到 \"{name}\" 的连接"
package/src/index.tsx CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  discoverSessions,
22
22
  } from './agent/cross-session/discovery'
23
23
  import { bootstrapProviders } from './providers/bootstrap'
24
- import { InstructionsLoader } from './core/instructions'
24
+ import { InstructionsLoader, formatInstructionSizeNotice } from './core/instructions'
25
25
  import { loadSessionMemories, getMemoryManager } from './core/memory/memory-loader'
26
26
  import { ContextManager } from './core/context'
27
27
  import { PrefixCacheTracker } from './core/context-token'
@@ -44,6 +44,7 @@ import { mountLlm, LLM_KEY } from './providers/llm'
44
44
  import { mountConstitution, createConstitution } from './core/constitution-seam'
45
45
  import { ConstitutionLoader } from './core/constitution-loader'
46
46
  import { McpClient } from './mcp/client'
47
+ import { buildMcpInstructionsBlock } from './mcp/instructions'
47
48
  import { registerMcpServerTools, syncMcpToolsOnChange } from './mcp/registry'
48
49
  import { formatMcpConnectFailures, type McpConnectFailure } from './mcp/connect-failures'
49
50
  import { AgentRegistry } from './agent/agent-registry'
@@ -58,7 +59,7 @@ import { getWorkspaceTrust, warnProjectHooksSkipped } from './core/workspace-tru
58
59
  import { ARTIFACT_PORT, MIPHAM_DIR } from './shared/constants'
59
60
  import { artifactsRoot } from './artifacts/paths'
60
61
  import { AgentViewManager } from './agent-view/agent-view-manager'
61
- import { AgentViewDashboard } from './agent-view/dashboard'
62
+ import { AgentsStandalone } from './agent-view/agents-standalone'
62
63
  import { createT } from './i18n-core/t'
63
64
  import { detectLocale } from './i18n-core/detect'
64
65
  import { I18nProvider } from './i18n-context'
@@ -380,11 +381,7 @@ export async function runApp(options: RunOptions): Promise<void> {
380
381
  if (args[0] === 'agents') {
381
382
  const agentViewManager = new AgentViewManager()
382
383
  const { waitUntilExit } = render(
383
- <AgentViewDashboard
384
- manager={agentViewManager}
385
- onAttach={() => {}}
386
- onExit={() => process.exit(0)}
387
- />,
384
+ <AgentsStandalone manager={agentViewManager} onExit={() => process.exit(0)} />,
388
385
  { exitOnCtrlC: false },
389
386
  )
390
387
  await waitUntilExit()
@@ -476,6 +473,11 @@ export async function runApp(options: RunOptions): Promise<void> {
476
473
  const instructions = new InstructionsLoader()
477
474
  instructions.loadAll(process.cwd())
478
475
 
476
+ // 指令体积提示:**按总量**说话(单文件都不大也可能一起挤占上下文)。
477
+ // 计数读的是真正会被发出去的那份投影(见 `instructionPartText`),不是磁盘上的字节。
478
+ const sizeNotice = formatInstructionSizeNotice(instructions.sizeReport())
479
+ if (sizeNotice) console.log(`\n${sizeNotice}\n`)
480
+
479
481
  // 空目录提示:愣建文件夹时温和提醒走 mipham init,而非默默开始(寒暄克制——一句即可)
480
482
  const { isEmptyProject } = await import('./core/project-scaffold')
481
483
  if (isEmptyProject(process.cwd())) {
@@ -555,6 +557,14 @@ export async function runApp(options: RunOptions): Promise<void> {
555
557
  // 这里接的是 live `permission` —— 同一实例也交给引擎去执行,故下一次请求就与新档一致。
556
558
  context.setPermissionContextSource(() => instructions.buildPermissionBlock(permission.getMode()))
557
559
 
560
+ // MCP server 自带的 `instructions` 走同一条读时派生的路,理由比权限段更硬:server 是**启动后
561
+ // 异步连上**的(见下方 `connectMcpServers`),而提示在这一刻就建好了。组装时烘进去的话,
562
+ // 本次会话里后连上的 server 永远进不了提示 —— 用户只能重启。读 `/listConnections()` 是
563
+ // live 的,连上一个下一次请求就带上。
564
+ context.setMcpInstructionsSource(() =>
565
+ buildMcpInstructionsBlock(McpClient.getInstance().listConnections()),
566
+ )
567
+
558
568
  // Adaptive memory budget: scale with model's context window
559
569
  getMemoryManager().setContextWindow(modelContextWindow)
560
570