omnius 1.0.181 → 1.0.182

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/index.js CHANGED
@@ -563701,7 +563701,7 @@ ${description}`
563701
563701
  const responseText = firstChoice ? String(firstChoice.message?.content ?? "") : "";
563702
563702
  const outcome = this.recordThinkOutcome(responseText, effectiveThink === true);
563703
563703
  const independentOutcome = effectiveThink !== true ? classifyThinkOutcome(responseText) : null;
563704
- const shouldRecoverFromEmpty = responseFormat !== void 0 && independentOutcome !== null && (independentOutcome === "empty_after_strip" || independentOutcome === "unclosed_think");
563704
+ const shouldRecoverFromEmpty = request.disableEmptyContentRecovery !== true && responseFormat !== void 0 && independentOutcome !== null && (independentOutcome === "empty_after_strip" || independentOutcome === "unclosed_think");
563705
563705
  const justSuppressed = this._thinkSuppressed && this._thinkFailStreak === _OllamaAgenticBackend._thinkFailThreshold;
563706
563706
  const shouldRetryThinkGuard = outcome !== null && effectiveThink === true && (justSuppressed || outcome === "empty_after_strip" || outcome === "unclosed_think");
563707
563707
  if (shouldRetryThinkGuard || shouldRecoverFromEmpty) {
@@ -629151,6 +629151,27 @@ function telegramRouterTimeoutMs(configTimeoutMs, minMs = 1e4, maxMs) {
629151
629151
  const requested = Number.isFinite(configTimeoutMs) && (configTimeoutMs ?? 0) > 0 ? configTimeoutMs : cap;
629152
629152
  return Math.max(floor, Math.min(requested, cap));
629153
629153
  }
629154
+ function telegramRouterErrorText(err) {
629155
+ return err instanceof Error ? err.message : String(err);
629156
+ }
629157
+ function compactTelegramRouterDiagnosticText(text, maxLength = 220) {
629158
+ const compact3 = text.replace(/\s+/g, " ").trim();
629159
+ return compact3.length > maxLength ? `${compact3.slice(0, Math.max(0, maxLength - 3))}...` : compact3;
629160
+ }
629161
+ function telegramRouterErrorLooksLikeTimeout(err) {
629162
+ const text = telegramRouterErrorText(err);
629163
+ return /\b(timeout|timed out|ETIMEDOUT)\b|aborted due to timeout|stream timeout/i.test(text);
629164
+ }
629165
+ function telegramRouterErrorLooksLikeBackendLiveness(err) {
629166
+ const text = telegramRouterErrorText(err);
629167
+ return telegramRouterErrorLooksLikeTimeout(err) || /fetch failed|ECONNREFUSED|ECONNRESET|EHOSTUNREACH|ENETUNREACH|ECONNABORTED|socket hang up|terminated|network error/i.test(text);
629168
+ }
629169
+ function telegramRouterDiagnosticAttemptLooksLikeTimeout(attempt) {
629170
+ return attempt.status === "threw" && telegramRouterErrorLooksLikeTimeout(attempt.error ?? "");
629171
+ }
629172
+ function telegramRouterDiagnosticAttemptLooksLikeBackendLiveness(attempt) {
629173
+ return attempt.status === "threw" && telegramRouterErrorLooksLikeBackendLiveness(attempt.error ?? "");
629174
+ }
629154
629175
  function telegramThinkSuppressedRequest(request) {
629155
629176
  const messages2 = Array.isArray(request.messages) ? request.messages.slice() : [];
629156
629177
  let appended = false;
@@ -635251,11 +635272,25 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`,
635251
635272
  async telegramRouterJsonCompletion(backend, request, diagnostics, inferenceKind = "router", sessionKey = "__router__") {
635252
635273
  let jsonModeResult;
635253
635274
  let jsonModeError;
635275
+ const recordAttempt = (attempt) => {
635276
+ if (!diagnostics) return;
635277
+ diagnostics.attempts ??= [];
635278
+ diagnostics.attempts.push({
635279
+ stage: inferenceKind,
635280
+ ...attempt
635281
+ });
635282
+ };
635254
635283
  const suppressed = telegramThinkSuppressedRequest(request);
635284
+ const requestTimeoutMs = Number.isFinite(suppressed.timeoutMs) && (suppressed.timeoutMs ?? 0) > 0 ? suppressed.timeoutMs : void 0;
635285
+ const jsonStartMs = Date.now();
635255
635286
  try {
635256
635287
  jsonModeResult = await this.telegramObservableInference(
635257
635288
  backend,
635258
- { ...suppressed, responseFormat: TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT },
635289
+ {
635290
+ ...suppressed,
635291
+ responseFormat: TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT,
635292
+ disableEmptyContentRecovery: true
635293
+ },
635259
635294
  inferenceKind,
635260
635295
  sessionKey,
635261
635296
  { stream: false, reason: "router-json" }
@@ -635265,16 +635300,49 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`,
635265
635300
  );
635266
635301
  if (visible) {
635267
635302
  if (diagnostics) diagnostics.jsonModeStatus = "visible";
635303
+ recordAttempt({
635304
+ mode: "json-mode",
635305
+ status: "visible",
635306
+ elapsedMs: Date.now() - jsonStartMs,
635307
+ timeoutMs: requestTimeoutMs
635308
+ });
635268
635309
  return jsonModeResult;
635269
635310
  }
635270
635311
  if (diagnostics) diagnostics.jsonModeStatus = "empty-after-strip";
635312
+ recordAttempt({
635313
+ mode: "json-mode",
635314
+ status: "empty-after-strip",
635315
+ elapsedMs: Date.now() - jsonStartMs,
635316
+ timeoutMs: requestTimeoutMs
635317
+ });
635271
635318
  } catch (err) {
635272
635319
  jsonModeError = err;
635273
635320
  if (diagnostics) {
635274
635321
  diagnostics.jsonModeStatus = "threw";
635275
- diagnostics.jsonModeError = err instanceof Error ? err.message : String(err);
635322
+ diagnostics.jsonModeError = telegramRouterErrorText(err);
635323
+ }
635324
+ recordAttempt({
635325
+ mode: "json-mode",
635326
+ status: "threw",
635327
+ error: telegramRouterErrorText(err),
635328
+ elapsedMs: Date.now() - jsonStartMs,
635329
+ timeoutMs: requestTimeoutMs
635330
+ });
635331
+ if (telegramRouterErrorLooksLikeBackendLiveness(err)) {
635332
+ if (diagnostics) {
635333
+ diagnostics.plainStatus = "skipped";
635334
+ diagnostics.plainError = "skipped because json-mode backend liveness failed";
635335
+ }
635336
+ recordAttempt({
635337
+ mode: "plain-retry",
635338
+ status: "skipped",
635339
+ error: "skipped because json-mode backend liveness failed",
635340
+ timeoutMs: requestTimeoutMs
635341
+ });
635342
+ throw err;
635276
635343
  }
635277
635344
  }
635345
+ const plainStartMs = Date.now();
635278
635346
  try {
635279
635347
  const plainResult = await this.telegramObservableInference(
635280
635348
  backend,
@@ -635288,13 +635356,26 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`,
635288
635356
  (choice) => stripTelegramHiddenThinking(choice.message.content ?? "").trim().length > 0
635289
635357
  );
635290
635358
  diagnostics.plainStatus = plainVisible ? "visible" : "empty-after-strip";
635359
+ recordAttempt({
635360
+ mode: "plain-retry",
635361
+ status: plainVisible ? "visible" : "empty-after-strip",
635362
+ elapsedMs: Date.now() - plainStartMs,
635363
+ timeoutMs: requestTimeoutMs
635364
+ });
635291
635365
  }
635292
635366
  return plainResult;
635293
635367
  } catch (err) {
635294
635368
  if (diagnostics) {
635295
635369
  diagnostics.plainStatus = "threw";
635296
- diagnostics.plainError = err instanceof Error ? err.message : String(err);
635370
+ diagnostics.plainError = telegramRouterErrorText(err);
635297
635371
  }
635372
+ recordAttempt({
635373
+ mode: "plain-retry",
635374
+ status: "threw",
635375
+ error: telegramRouterErrorText(err),
635376
+ elapsedMs: Date.now() - plainStartMs,
635377
+ timeoutMs: requestTimeoutMs
635378
+ });
635298
635379
  if (jsonModeError instanceof Error && !(err instanceof Error)) throw jsonModeError;
635299
635380
  throw err;
635300
635381
  }
@@ -635667,7 +635748,7 @@ ${repairedText}`,
635667
635748
  } catch (err) {
635668
635749
  if (diagnostics) {
635669
635750
  diagnostics.repairStatus = "threw";
635670
- diagnostics.repairError = err instanceof Error ? err.message : String(err);
635751
+ diagnostics.repairError = telegramRouterErrorText(err);
635671
635752
  }
635672
635753
  return null;
635673
635754
  }
@@ -635733,7 +635814,7 @@ ${retryText}`,
635733
635814
  } catch (err) {
635734
635815
  if (diagnostics) {
635735
635816
  diagnostics.strictRetryStatus = "threw";
635736
- diagnostics.strictRetryError = err instanceof Error ? err.message : String(err);
635817
+ diagnostics.strictRetryError = telegramRouterErrorText(err);
635737
635818
  }
635738
635819
  return null;
635739
635820
  }
@@ -636221,20 +636302,21 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
636221
636302
  }
636222
636303
  const invalidRouterPreview = telegramRouterRawPreview(text);
636223
636304
  const failureNarrative = this.summarizeTelegramRouterFailure(diagnostics);
636305
+ const backendLivenessFailure = (diagnostics.attempts ?? []).some(telegramRouterDiagnosticAttemptLooksLikeBackendLiveness) || telegramRouterErrorLooksLikeBackendLiveness(diagnostics.repairError ?? "") || telegramRouterErrorLooksLikeBackendLiveness(diagnostics.strictRetryError ?? "");
636224
636306
  const fallback = this.applyTelegramSilentReflectionNotes(this.buildTelegramRouterUnavailableDecision(msg, toolContext, {
636225
- reason: "router output was not valid decision JSON after repair/retry; no model-derived reply decision",
636307
+ reason: backendLivenessFailure ? "router recovery hit a backend liveness failure; no model-derived reply decision" : "router output was not valid decision JSON after repair/retry; no model-derived reply decision",
636226
636308
  silentDisposition: reflectionNotes.silentDisposition,
636227
636309
  diagnosticNote: this.composeTelegramRouterDiagnosticNote(
636228
636310
  invalidRouterPreview,
636229
636311
  failureNarrative,
636230
- invalidRouterPreview ? "router produced an invalid attention decision payload; repair and strict retry did not recover it" : "router produced an empty attention decision payload; strict retry did not recover it"
636312
+ backendLivenessFailure ? "router backend failed during attention-decision recovery; no usable router decision was available" : invalidRouterPreview ? "router produced an invalid attention decision payload; repair and strict retry did not recover it" : "router produced an empty attention decision payload; strict retry did not recover it"
636231
636313
  ),
636232
636314
  raw: text
636233
636315
  }), reflectionNotes);
636234
636316
  return withRouterTelemetry(fallback);
636235
636317
  } catch (err) {
636236
636318
  const failureNarrative = this.summarizeTelegramRouterFailure(diagnostics);
636237
- const errMsg = err instanceof Error ? err.message : String(err);
636319
+ const errMsg = telegramRouterErrorText(err);
636238
636320
  const fallback = this.applyTelegramSilentReflectionNotes(this.buildTelegramRouterUnavailableDecision(msg, toolContext, {
636239
636321
  reason: `router inference failed; no model-derived reply decision (${errMsg.slice(0, 160)})`,
636240
636322
  silentDisposition: reflectionNotes.silentDisposition,
@@ -636247,46 +636329,93 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
636247
636329
  return withRouterTelemetry(fallback);
636248
636330
  }
636249
636331
  }
636332
+ formatTelegramRouterAttemptTrace(attempt) {
636333
+ const elapsed = Number.isFinite(attempt.elapsedMs) ? ` elapsedMs=${Math.max(0, Math.round(attempt.elapsedMs ?? 0))}` : "";
636334
+ const timeout2 = Number.isFinite(attempt.timeoutMs) ? ` timeoutMs=${Math.max(0, Math.round(attempt.timeoutMs ?? 0))}` : "";
636335
+ const error = attempt.error ? ` (${compactTelegramRouterDiagnosticText(attempt.error, 180)})` : "";
636336
+ return `${attempt.stage}/${attempt.mode}: ${attempt.status}${error}${elapsed}${timeout2}`;
636337
+ }
636338
+ telegramRouterBackendLivenessHint(timeoutSeen) {
636339
+ const backendType = this.agentConfig?.backendType ?? "backend";
636340
+ if (backendType === "ollama") {
636341
+ return timeoutSeen ? "local Ollama did not return router tokens within the liveness window; likely queue backlog, cold model load, GPU/RAM contention, or a wedged runner. JSON repair cannot recover until the backend responds" : "local Ollama request failed before router content was available; check Ollama reachability, model availability, and runner health";
636342
+ }
636343
+ return timeoutSeen ? `${backendType} backend did not return router tokens within the liveness window; check provider latency, rate limits, and request queue depth` : `${backendType} backend request failed before router content was available; check provider reachability and rate limits`;
636344
+ }
636250
636345
  /**
636251
636346
  * Reduce captured per-step diagnostics into:
636252
636347
  * - `summary`: a short outcome-level diagnostic
636253
636348
  * - `detail`: a longer ordered trace for operator debugging
636254
- * - `operatorHint`: an operational hint (e.g. "ollama backend appears to be injecting <think> tags despite think:false")
636349
+ * - `operatorHint`: an operational hint with backend/model context
636255
636350
  */
636256
636351
  summarizeTelegramRouterFailure(diag) {
636257
636352
  const parts = [];
636258
636353
  const detailParts = [];
636259
636354
  let thinkInjectionSuspected = false;
636260
636355
  let networkErrorSeen = false;
636261
- if (diag.jsonModeStatus === "threw") {
636262
- parts.push(`json-mode call threw`);
636263
- detailParts.push(`json-mode: threw (${diag.jsonModeError ?? "no detail"})`);
636264
- networkErrorSeen = true;
636265
- } else if (diag.jsonModeStatus === "empty-after-strip") {
636266
- parts.push(`json-mode returned empty content (likely <think>-only)`);
636267
- detailParts.push(`json-mode: empty-after-strip`);
636268
- thinkInjectionSuspected = true;
636269
- } else if (diag.jsonModeStatus === "visible") {
636270
- detailParts.push(`json-mode: visible`);
636271
- }
636272
- if (diag.plainStatus === "threw") {
636273
- parts.push(`plain call threw`);
636274
- detailParts.push(`plain: threw (${diag.plainError ?? "no detail"})`);
636275
- networkErrorSeen = true;
636276
- } else if (diag.plainStatus === "empty-after-strip") {
636277
- parts.push(`plain call returned empty content`);
636278
- detailParts.push(`plain: empty-after-strip`);
636279
- thinkInjectionSuspected = true;
636280
- } else if (diag.plainStatus === "visible") {
636281
- detailParts.push(`plain: visible-but-unparseable`);
636356
+ let timeoutSeen = false;
636357
+ const attempts = diag.attempts ?? [];
636358
+ if (attempts.length > 0) {
636359
+ const livenessAttempts = attempts.filter(telegramRouterDiagnosticAttemptLooksLikeBackendLiveness);
636360
+ const timeoutAttempts = attempts.filter(telegramRouterDiagnosticAttemptLooksLikeTimeout);
636361
+ const emptyAttempts = attempts.filter((attempt) => attempt.status === "empty-after-strip");
636362
+ const visibleAttempts = attempts.filter((attempt) => attempt.status === "visible");
636363
+ const skippedAttempts = attempts.filter((attempt) => attempt.status === "skipped");
636364
+ networkErrorSeen = livenessAttempts.length > 0;
636365
+ timeoutSeen = timeoutAttempts.length > 0;
636366
+ thinkInjectionSuspected = emptyAttempts.length > 0;
636367
+ if (livenessAttempts.length > 0) {
636368
+ const affected = livenessAttempts.map((attempt) => `${attempt.stage}/${attempt.mode}`).join(", ");
636369
+ parts.push(timeoutSeen ? `backend timeout/liveness failure during ${affected}` : `backend liveness failure during ${affected}`);
636370
+ }
636371
+ if (emptyAttempts.length > 0) {
636372
+ const affected = emptyAttempts.map((attempt) => `${attempt.stage}/${attempt.mode}`).join(", ");
636373
+ parts.push(`empty visible content after <think> strip during ${affected}`);
636374
+ }
636375
+ if (visibleAttempts.length > 0 && diag.repairStatus !== "recovered" && diag.strictRetryStatus !== "recovered") {
636376
+ parts.push(`visible router text remained unparseable`);
636377
+ }
636378
+ if (skippedAttempts.length > 0) {
636379
+ const affected = skippedAttempts.map((attempt) => `${attempt.stage}/${attempt.mode}`).join(", ");
636380
+ parts.push(`fallback attempt skipped during ${affected}`);
636381
+ }
636382
+ detailParts.push(...attempts.map((attempt) => this.formatTelegramRouterAttemptTrace(attempt)));
636383
+ } else {
636384
+ if (diag.jsonModeStatus === "threw") {
636385
+ parts.push(`json-mode call threw`);
636386
+ detailParts.push(`json-mode: threw (${diag.jsonModeError ?? "no detail"})`);
636387
+ networkErrorSeen = true;
636388
+ timeoutSeen = telegramRouterErrorLooksLikeTimeout(diag.jsonModeError ?? "");
636389
+ } else if (diag.jsonModeStatus === "empty-after-strip") {
636390
+ parts.push(`json-mode returned empty content (likely <think>-only)`);
636391
+ detailParts.push(`json-mode: empty-after-strip`);
636392
+ thinkInjectionSuspected = true;
636393
+ } else if (diag.jsonModeStatus === "visible") {
636394
+ detailParts.push(`json-mode: visible`);
636395
+ }
636396
+ if (diag.plainStatus === "threw") {
636397
+ parts.push(`plain call threw`);
636398
+ detailParts.push(`plain: threw (${diag.plainError ?? "no detail"})`);
636399
+ networkErrorSeen = true;
636400
+ timeoutSeen ||= telegramRouterErrorLooksLikeTimeout(diag.plainError ?? "");
636401
+ } else if (diag.plainStatus === "empty-after-strip") {
636402
+ parts.push(`plain call returned empty content`);
636403
+ detailParts.push(`plain: empty-after-strip`);
636404
+ thinkInjectionSuspected = true;
636405
+ } else if (diag.plainStatus === "visible") {
636406
+ detailParts.push(`plain: visible-but-unparseable`);
636407
+ }
636282
636408
  }
636283
636409
  if (diag.repairStatus === "skipped") {
636284
636410
  detailParts.push(`repair: skipped (${diag.repairError ?? "no recoverable input"})`);
636411
+ } else if (diag.repairStatus === "skipped-truncation-rerun") {
636412
+ detailParts.push(`repair: skipped for truncation rerun`);
636285
636413
  } else if (diag.repairStatus === "no-recoverable-output") {
636286
636414
  detailParts.push(`repair: returned non-recoverable JSON`);
636287
636415
  } else if (diag.repairStatus === "threw") {
636288
636416
  detailParts.push(`repair: threw (${diag.repairError ?? "no detail"})`);
636289
636417
  networkErrorSeen = true;
636418
+ timeoutSeen ||= telegramRouterErrorLooksLikeTimeout(diag.repairError ?? "");
636290
636419
  } else if (diag.repairStatus === "recovered") {
636291
636420
  detailParts.push(`repair: recovered`);
636292
636421
  }
@@ -636298,14 +636427,15 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
636298
636427
  } else if (diag.strictRetryStatus === "threw") {
636299
636428
  detailParts.push(`strict-retry: threw (${diag.strictRetryError ?? "no detail"})`);
636300
636429
  networkErrorSeen = true;
636430
+ timeoutSeen ||= telegramRouterErrorLooksLikeTimeout(diag.strictRetryError ?? "");
636301
636431
  } else if (diag.strictRetryStatus === "recovered") {
636302
636432
  detailParts.push(`strict-retry: recovered`);
636303
636433
  }
636304
636434
  let operatorHint;
636305
636435
  if (networkErrorSeen) {
636306
- operatorHint = "router backend appears unreachable or rate-limited; continued conversation depends on recovery";
636436
+ operatorHint = this.telegramRouterBackendLivenessHint(timeoutSeen);
636307
636437
  } else if (thinkInjectionSuspected) {
636308
- operatorHint = "router model emitted <think>-only or unclosed-think output; conversation continuity preserved but inference is degraded";
636438
+ operatorHint = "router model emitted <think>-only or unclosed-think output despite think suppression; visible decision content was empty after stripping hidden reasoning";
636309
636439
  }
636310
636440
  return {
636311
636441
  summary: parts.join("; "),
@@ -636321,7 +636451,7 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
636321
636451
  if (invalidRouterPreview) segments.push(`invalid router output preview: ${invalidRouterPreview}`);
636322
636452
  if (failureNarrative.detail) segments.push(`router-failure trace: ${failureNarrative.detail}`);
636323
636453
  if (failureNarrative.operatorHint) segments.push(failureNarrative.operatorHint);
636324
- return segments.join(" | ").slice(0, 900);
636454
+ return segments.join(" | ").slice(0, 1400);
636325
636455
  }
636326
636456
  buildTelegramWorkspaceContext(modelTier, budget = 14e3) {
636327
636457
  if (!this.repoRoot) return "";
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.181",
3
+ "version": "1.0.182",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.181",
9
+ "version": "1.0.182",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.181",
3
+ "version": "1.0.182",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",