@noobdemon/noob-cli 1.9.2 → 1.9.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noobdemon/noob-cli",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/agent.js CHANGED
@@ -522,7 +522,7 @@ async function streamWithRetry({ model, message, system, signal, tokenMeter, onD
522
522
  lastErr = err;
523
523
  if (attempt >= MAX_RETRIES) break;
524
524
  const backoff = Math.min(30000, 1000 * Math.pow(2, attempt));
525
- onStatus?.(`mạng lỗi (${err.message}) — thử lại sau ${(backoff/1000)|0}s [${attempt+1}/${MAX_RETRIES}]`);
525
+ onStatus?.(`Lỗi kết nối — thử lại sau ${(backoff/1000)|0}s [${attempt+1}/${MAX_RETRIES}]…`);
526
526
  await sleep(backoff, signal);
527
527
  }
528
528
  }
package/src/api.js CHANGED
@@ -116,7 +116,7 @@ function hasUnclosedToolBlock(text) {
116
116
  *
117
117
  * @returns {Promise<{text:string, reasoning:string}>}
118
118
  */
119
- export async function stream({ mode = "chat", message, model, system, conversation, effort, signal, onDelta, onReasoning, onStatus, idleMs = 25000, maxContinues = Infinity }) {
119
+ export async function stream({ mode = "chat", message, model, system, conversation, effort, signal, onDelta, onReasoning, onStatus, idleMs = 45000, maxContinues = Infinity }) {
120
120
  const endpoint = mode === "search" ? "/api/search" : mode === "merge" ? "/api/merge" : "/api/chat";
121
121
 
122
122
  let fullText = "";
@@ -209,9 +209,9 @@ async function streamOnce({ endpoint, mode, message, model, system, conversation
209
209
  let warnTimer = null;
210
210
  let probeTimer = null;
211
211
  let probeInFlight = false;
212
- const WARN_MS = Math.min(8000, idleMs / 3);
213
- const PROBE_MS = Math.min(12000, (idleMs * 2) / 3);
214
- const WIRE_MS = idleMs * 2; // socket dead-cứng (mất cả heartbeat) — ngưỡng rộng
212
+ const WARN_MS = Math.min(15000, idleMs / 3);
213
+ const PROBE_MS = Math.min(25000, (idleMs * 2) / 3);
214
+ const WIRE_MS = idleMs * 3; // socket dead-cứng (mất cả heartbeat) — ngưỡng rất rộng
215
215
  const clearContentTimers = () => {
216
216
  clearTimeout(warnTimer); warnTimer = null;
217
217
  clearTimeout(probeTimer); probeTimer = null;
@@ -220,7 +220,7 @@ async function streamOnce({ endpoint, mode, message, model, system, conversation
220
220
  const armContent = () => {
221
221
  clearContentTimers();
222
222
  warnTimer = setTimeout(() => {
223
- if (onStatus) onStatus("Đang chờ proxy phản hồi…");
223
+ if (onStatus) onStatus("Model đang suy nghĩ… (đợi thêm nếu task phức tạp)");
224
224
  }, WARN_MS);
225
225
  probeTimer = setTimeout(async () => {
226
226
  if (probeInFlight || ctrl.signal.aborted) return;
@@ -234,7 +234,7 @@ async function streamOnce({ endpoint, mode, message, model, system, conversation
234
234
  } catch {
235
235
  if (!ctrl.signal.aborted) {
236
236
  timedOut = true;
237
- if (onStatus) onStatus("Proxy không phản hồi — đang gọi lại model…");
237
+ if (onStatus) onStatus("Model không phản hồi — đang kết nối lại…");
238
238
  ctrl.abort();
239
239
  }
240
240
  } finally {
@@ -328,7 +328,7 @@ async function streamOnce({ endpoint, mode, message, model, system, conversation
328
328
  return { text, reasoning, truncated };
329
329
  } catch (err) {
330
330
  if (signal?.aborted) throw err; // người dùng bấm Ctrl+C → huỷ thật, không nối tiếp
331
- if (timedOut) throw new ApiError("Kết nối tới máy chủ quá thời gian chờ (treo).", { code: "timeout" });
331
+ if (timedOut) throw new ApiError("Kết nối tới máy chủ quá thời gian chờ (treo). Đang thử lại…", { code: "timeout" });
332
332
  // Rớt mạng giữa chừng (không phải huỷ, không phải treo): với chat, nếu đã có
333
333
  // chữ thì trả phần đã nhận + cờ truncated để lớp trên nối tiếp.
334
334
  if (mode === "chat" && text) return { text, reasoning, truncated: true };