mocode-ai 1.3.0 → 1.3.2

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/dist/ui/theme.js CHANGED
@@ -33,7 +33,6 @@ const DEFAULT = {
33
33
  // diff 行底色:One Dark bg #282c34 上加 ~14% 亮度的对应色,够辨识但不刺眼
34
34
  addBg: '\x1B[48;2;44;62;42m', // 偏暗绿(One Dark green(152,195,121)暗化)
35
35
  delBg: '\x1B[48;2;62;38;42m', // 偏暗红(One Dark red(224,108,117)暗化)
36
- terminalBg: 'rgb:28/2c/34', // One Dark 经典深底,偏蓝灰的黑
37
36
  };
38
37
  /**
39
38
  * 内建主题表。default=One Dark、light=Solarized Light、solarized=Solarized Dark、
@@ -59,7 +58,6 @@ const THEMES = {
59
58
  // 比直接用 base1 更柔,跟深 fg(red/green)对比充足
60
59
  addBg: '\x1B[48;2;220;235;205m',
61
60
  delBg: '\x1B[48;2;245;218;215m',
62
- terminalBg: 'rgb:1a/1e/24', // 深黑底带微蓝,与 light 主题文字反差大
63
61
  },
64
62
  solarized: {
65
63
  red: '\x1B[38;2;220;50;47m',
@@ -76,7 +74,6 @@ const THEMES = {
76
74
  // diff 行底色:Solarized Dark base03(0,43,54)上加对应色族暗 tint
77
75
  addBg: '\x1B[48;2;20;50;38m',
78
76
  delBg: '\x1B[48;2;55;30;30m',
79
- terminalBg: 'rgb:00/2b/36', // Solarized Dark base03,深青黑
80
77
  },
81
78
  gruvbox: {
82
79
  red: '\x1B[38;2;251;73;52m',
@@ -93,7 +90,6 @@ const THEMES = {
93
90
  // diff 行底色:Gruvbox dark bg(40,40,40)上贴暗 bg0_a 风格
94
91
  addBg: '\x1B[48;2;40;55;30m',
95
92
  delBg: '\x1B[48;2;70;35;30m',
96
- terminalBg: 'rgb:28/28/28', // Gruvbox 深黑底,带微暖色调
97
93
  },
98
94
  nord: {
99
95
  red: '\x1B[38;2;191;97;106m',
@@ -110,7 +106,6 @@ const THEMES = {
110
106
  // diff 行底色:Nord polar night(46,52,64)上贴对应色族暗 tint
111
107
  addBg: '\x1B[48;2;46;66;52m',
112
108
  delBg: '\x1B[48;2;72;46;52m',
113
- terminalBg: 'rgb:2e/34/40', // Nord Polar Night 深灰蓝
114
109
  },
115
110
  orange: {
116
111
  // 秋季/南瓜橙:深暖底(#231c16 系)+ accent 主强调走橙色;yellow 槽也偏橙
@@ -130,7 +125,6 @@ const THEMES = {
130
125
  // diff 行底色:暖深棕底上贴对应色族暗 tint,跟 fg 配对柔和可辨
131
126
  addBg: '\x1B[48;2;55;70;35m',
132
127
  delBg: '\x1B[48;2;78;42;32m',
133
- terminalBg: 'rgb:23/1c/16', // 深暖棕黑,带橙色调
134
128
  },
135
129
  rose: {
136
130
  // 玫红:深紫底 + accent 玫粉作主强调;magenta 槽与 accent 同源(主题色),
@@ -149,7 +143,6 @@ const THEMES = {
149
143
  // diff 行底色:深紫底贴对应色族暗 tint,绿暗化偏橄榄、红暗化偏紫红
150
144
  addBg: '\x1B[48;2;50;60;42m',
151
145
  delBg: '\x1B[48;2;75;40;52m',
152
- terminalBg: 'rgb:1e/14/1c', // 深紫黑底,带玫红暖调
153
146
  },
154
147
  emerald: {
155
148
  // 翡翠绿:深绿底 + accent 翡翠绿作主强调;green 槽与 accent 同源(主题色),
@@ -168,7 +161,6 @@ const THEMES = {
168
161
  // diff 行底色:深绿底贴对应色族暗 tint,绿暗化偏深绿、红暗化偏暗红
169
162
  addBg: '\x1B[48;2;30;55;40m',
170
163
  delBg: '\x1B[48;2;60;40;40m',
171
- terminalBg: 'rgb:10/1e/18', // 深绿黑底,翡翠色调
172
164
  },
173
165
  amber: {
174
166
  // 琥珀金黄:深棕底 + accent 琥珀金黄作主强调;yellow 槽与 accent 同源(主题色),
@@ -187,7 +179,6 @@ const THEMES = {
187
179
  // diff 行底色:深棕底贴对应色族暗 tint,绿暗化偏橄榄、红暗化偏暗棕红
188
180
  addBg: '\x1B[48;2;50;55;25m',
189
181
  delBg: '\x1B[48;2;70;40;28m',
190
- terminalBg: 'rgb:1e/18/0e', // 深棕黑底,琥珀金黄调
191
182
  },
192
183
  lavender: {
193
184
  // 薰衣草淡紫:深紫底 + accent 淡紫作主强调;magenta 槽与 accent 同源(主题色),
@@ -206,7 +197,6 @@ const THEMES = {
206
197
  // diff 行底色:深紫底贴对应色族暗 tint,绿暗化偏冷绿、红暗化偏冷紫红
207
198
  addBg: '\x1B[48;2;38;46;42m',
208
199
  delBg: '\x1B[48;2;60;40;55m',
209
- terminalBg: 'rgb:18/14/24', // 深紫黑底,薰衣草冷调
210
200
  },
211
201
  sunset: {
212
202
  // 日落珊瑚:深棕红底 + accent 珊瑚红作主强调;red 槽与 accent 同源(主题色);
@@ -225,7 +215,6 @@ const THEMES = {
225
215
  // diff 行底色:深棕红底贴对应色族暗 tint,绿暗化偏橄榄、红暗化偏暗棕红
226
216
  addBg: '\x1B[48;2;50;55;30m',
227
217
  delBg: '\x1B[48;2;75;32;30m',
228
- terminalBg: 'rgb:20/12/10', // 深棕红黑底,珊瑚暖调
229
218
  },
230
219
  };
231
220
  let currentName = 'default';
@@ -233,13 +222,13 @@ let version = 0;
233
222
  function currentPalette() {
234
223
  return THEMES[currentName] ?? DEFAULT;
235
224
  }
236
- /** Apply the active theme's dark background to the terminal window (OSC 11). */
237
- export function applyTerminalBackground() {
238
- if (!isTTY)
239
- return;
240
- stdout.write(`\x1B]11;${currentPalette().terminalBg}\x07`);
241
- }
242
- /** Ask the terminal to restore its default background color. */
225
+ /**
226
+ * 请终端还原自身默认背景(OSC 111)
227
+ *
228
+ * 我们从不主动设背景(见 Palette 上的注释),这条只作**善后**:agent 跑 run_command
229
+ * 时子进程可能自己下发 OSC 11 改了窗口底色,退出 alt screen 时拉回默认,免得把改动
230
+ * 留在用户终端里。终端不支持 OSC 111 时该序列被忽略,无副作用。
231
+ */
243
232
  export function resetTerminalBackground() {
244
233
  if (!isTTY)
245
234
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocode-ai",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "终端编码 agent:LLM + tool-call 循环 + 流式输出(含思考)+ 16 个工具,接任意 OpenAI 兼容后端。",
5
5
  "type": "module",
6
6
  "bin": {