@zhongqian97-code/ecode 0.3.8 → 0.3.10

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/README.md CHANGED
@@ -68,6 +68,12 @@ export ECODE_API_KEY=sk-ant-...
68
68
  export ECODE_MODEL=claude-sonnet-4-6
69
69
  ecode
70
70
 
71
+ # MiniMax M2.5
72
+ export ECODE_BASE_URL=https://api.minimax.chat/v1
73
+ export ECODE_API_KEY=sk-...
74
+ export ECODE_MODEL=MiniMax-M2.5
75
+ ecode
76
+
71
77
  # Local Ollama
72
78
  export ECODE_BASE_URL=http://localhost:11434/v1
73
79
  export ECODE_API_KEY=ollama
package/dist/index.js CHANGED
@@ -148,6 +148,34 @@ function createOpenAIProvider(profile) {
148
148
  stream(messages, tools, signal) {
149
149
  return {
150
150
  [Symbol.asyncIterator]: async function* () {
151
+ let inThinkBlock = false;
152
+ function stripThinkTags(raw) {
153
+ let text = "";
154
+ let thinking = "";
155
+ let i = 0;
156
+ while (i < raw.length) {
157
+ if (!inThinkBlock) {
158
+ const start = raw.indexOf("<think>", i);
159
+ if (start === -1) {
160
+ text += raw.slice(i);
161
+ break;
162
+ }
163
+ text += raw.slice(i, start);
164
+ inThinkBlock = true;
165
+ i = start + 7;
166
+ } else {
167
+ const end = raw.indexOf("</think>", i);
168
+ if (end === -1) {
169
+ thinking += raw.slice(i);
170
+ break;
171
+ }
172
+ thinking += raw.slice(i, end);
173
+ inThinkBlock = false;
174
+ i = end + 8;
175
+ }
176
+ }
177
+ return { text, thinking };
178
+ }
151
179
  const requestParams = {
152
180
  model: profile.model,
153
181
  messages,
@@ -206,11 +234,16 @@ function createOpenAIProvider(profile) {
206
234
  existing.arguments += tc.function?.arguments ?? "";
207
235
  }
208
236
  }
209
- const isLast = choice.finish_reason !== null;
237
+ const isLast = choice.finish_reason != null;
238
+ const raw = delta.content ?? "";
239
+ const { text: filteredText, thinking: thinkContent } = stripThinkTags(raw);
240
+ if (thinkContent) {
241
+ reasoningAccumulator += thinkContent;
242
+ }
210
243
  if (isLast) {
211
244
  const rawUsage = chunk.usage;
212
245
  yield {
213
- text: delta.content ?? "",
246
+ text: filteredText,
214
247
  done: true,
215
248
  finishReason: choice.finish_reason,
216
249
  // tcAccumulator 为空说明本轮没有工具调用,传 undefined 而非空数组,
@@ -227,10 +260,10 @@ function createOpenAIProvider(profile) {
227
260
  } : void 0
228
261
  };
229
262
  } else {
230
- const incrementalReasoning = delta.reasoning_content ?? (delta.reasoning_details && delta.reasoning_details.length > 0 ? delta.reasoning_details.map((rd) => rd.text ?? "").join("") : void 0);
263
+ const incrementalReasoning = delta.reasoning_content || thinkContent || (delta.reasoning_details && delta.reasoning_details.length > 0 ? delta.reasoning_details.map((rd) => rd.text ?? "").join("") : void 0) || void 0;
231
264
  yield {
232
- text: delta.content ?? "",
233
- reasoning: incrementalReasoning,
265
+ text: filteredText,
266
+ reasoning: incrementalReasoning || void 0,
234
267
  done: false
235
268
  };
236
269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhongqian97-code/ecode",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "A minimal Claude Code clone with REPL interface and bash tool calling",
5
5
  "type": "module",
6
6
  "author": "zhongqian97-code",