omnius 1.0.547 → 1.0.548

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
@@ -566228,6 +566228,31 @@ var init_textSanitize = __esm({
566228
566228
  });
566229
566229
 
566230
566230
  // packages/orchestrator/dist/text-echo-guard.js
566231
+ function parseFloatEnv(name10, fallback, min, max) {
566232
+ const raw = process.env[name10];
566233
+ if (raw == null || raw.trim().length === 0)
566234
+ return fallback;
566235
+ const parsed = Number.parseFloat(raw);
566236
+ if (!Number.isFinite(parsed))
566237
+ return fallback;
566238
+ return Math.min(max, Math.max(min, parsed));
566239
+ }
566240
+ function parseIntEnv(name10, fallback, min, max) {
566241
+ const raw = process.env[name10];
566242
+ if (raw == null || raw.trim().length === 0)
566243
+ return fallback;
566244
+ const parsed = Number.parseInt(raw, 10);
566245
+ if (!Number.isFinite(parsed))
566246
+ return fallback;
566247
+ return Math.min(max, Math.max(min, parsed));
566248
+ }
566249
+ function readTextEchoGuardOptionsFromEnv() {
566250
+ return {
566251
+ similarityThreshold: parseFloatEnv("OMNIUS_TEXT_ECHO_SIMILARITY_THRESHOLD", DEFAULTS.similarityThreshold, 0, 1),
566252
+ minLength: parseIntEnv("OMNIUS_TEXT_ECHO_MIN_LENGTH", DEFAULTS.minLength, 1, 8192),
566253
+ window: parseIntEnv("OMNIUS_TEXT_ECHO_WINDOW", DEFAULTS.window, 1, 64)
566254
+ };
566255
+ }
566231
566256
  function normalizeForEcho(text2) {
566232
566257
  return text2.replace(/<think>[\s\S]*?<\/think>/gi, "").replace(/<reasoning>[\s\S]*?<\/reasoning>/gi, "").replace(/```[\s\S]*?```/g, " ").replace(/[*_`#>|-]+/g, " ").toLowerCase().replace(/\s+/g, " ").trim();
566233
566258
  }
@@ -588392,7 +588417,7 @@ var init_agenticRunner = __esm({
588392
588417
  // 0.77–1.00 similarity, zero tool calls). Detects echoes, collapses the
588393
588418
  // earlier duplicates out of the live context (removing the attractor), and
588394
588419
  // requests a one-shot sampling perturbation for the next completion.
588395
- _textEchoGuard = new TextEchoGuard();
588420
+ _textEchoGuard = new TextEchoGuard(readTextEchoGuardOptionsFromEnv());
588396
588421
  // Turns remaining with a temperature floor applied to knock a greedy
588397
588422
  // decoder off a repetition attractor. Set on echo detection; decremented
588398
588423
  // when a request is built.
@@ -633719,6 +633744,7 @@ __export(render_exports, {
633719
633744
  setContentWriteHook: () => setContentWriteHook,
633720
633745
  setEmojisEnabled: () => setEmojisEnabled,
633721
633746
  stripTrustTierWrapperForTui: () => stripTrustTierWrapperForTui,
633747
+ summarizeInternalControlOutput: () => summarizeInternalControlOutput,
633722
633748
  ui: () => ui
633723
633749
  });
633724
633750
  function stdoutIsTTY() {
@@ -634373,6 +634399,186 @@ function sanitizeToolBoxContent(text2) {
634373
634399
  }
634374
634400
  return out;
634375
634401
  }
634402
+ function compactForDisplay(text2, max = 170) {
634403
+ const clean5 = text2.replace(/\s+/g, " ").trim();
634404
+ return clean5.length <= max ? clean5 : `${clean5.slice(0, Math.max(0, max - 1)).trimEnd()}…`;
634405
+ }
634406
+ function parseAssignmentMap(line) {
634407
+ const out = {};
634408
+ const assignmentRe = /(\w+)=([^\s]+)/g;
634409
+ let m2;
634410
+ while ((m2 = assignmentRe.exec(line)) !== null) {
634411
+ out[m2[1].toLowerCase()] = m2[2];
634412
+ }
634413
+ return out;
634414
+ }
634415
+ function extractFirstMatch(lines, pattern) {
634416
+ for (const line of lines) {
634417
+ const match = line.match(pattern);
634418
+ if (match?.[1]) return match[1].trim();
634419
+ }
634420
+ return "";
634421
+ }
634422
+ function formatBranchExtractSummary(output) {
634423
+ const lines = output.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
634424
+ if (lines.length === 0) return null;
634425
+ const first2 = lines[0].toLowerCase();
634426
+ const isBranchExtract = first2.startsWith("[branch-extract") || first2.startsWith("[branch-duplicate-blocked]");
634427
+ if (!isBranchExtract) return null;
634428
+ const routingLine = lines.find((line) => line.toLowerCase().startsWith("routing=")) || "";
634429
+ const assignment = parseAssignmentMap(routingLine);
634430
+ const route = assignment.routing ?? "mandatory";
634431
+ const reasons = assignment.reasons?.split(",").map((r2) => r2.trim()).filter(Boolean).join(", ") || "context protection";
634432
+ const projected = assignment.projected_read_tokens || assignment.projectedreadtokens || assignment.projected;
634433
+ const fractionLimit = assignment.fraction_limit_tokens || assignment.fractionlimittokens || assignment.fraction_limit || "";
634434
+ const available = assignment.available_headroom_tokens || assignment.available_headroom;
634435
+ const path16 = extractFirstMatch(
634436
+ lines,
634437
+ /(?:^|\s)path=(\S+)/
634438
+ ) || extractFirstMatch(lines, /\[branch-extract[^\]]*?\]\s*path=([^\s]+)/) || "unknown path";
634439
+ const discoveryStart = lines.findIndex(
634440
+ (line) => /^\[discovery contract\]/i.test(line)
634441
+ );
634442
+ const curatedStart = lines.findIndex(
634443
+ (line) => /^\[curated segments\]/i.test(line)
634444
+ );
634445
+ let goalAnchor = "";
634446
+ let request = "";
634447
+ const required = [];
634448
+ let inRequired = false;
634449
+ let stopCondition = "";
634450
+ if (discoveryStart >= 0) {
634451
+ for (let i2 = discoveryStart + 1; i2 < lines.length; i2 += 1) {
634452
+ const line = lines[i2];
634453
+ if (/^\[curated segments\]/i.test(line)) break;
634454
+ if (/^Goal anchor:/i.test(line)) {
634455
+ goalAnchor = line.replace(/^Goal anchor:\s*/i, "");
634456
+ continue;
634457
+ }
634458
+ if (/^Request:/i.test(line)) {
634459
+ request = line.replace(/^Request:\s*/i, "");
634460
+ inRequired = false;
634461
+ continue;
634462
+ }
634463
+ if (/^Stop conditions?:/i.test(line)) {
634464
+ stopCondition = line.replace(/^Stop conditions?:\s*/i, "");
634465
+ inRequired = false;
634466
+ continue;
634467
+ }
634468
+ if (/^Required discoveries:/i.test(line)) {
634469
+ inRequired = true;
634470
+ continue;
634471
+ }
634472
+ if (inRequired && line.startsWith("- ")) {
634473
+ required.push(line.replace(/^- /, "").slice(0, 170));
634474
+ }
634475
+ }
634476
+ }
634477
+ let curatedSummary = "";
634478
+ let unresolved = "";
634479
+ let satisfied = "";
634480
+ let provenance = "";
634481
+ if (curatedStart >= 0) {
634482
+ for (let i2 = curatedStart + 1; i2 < lines.length; i2 += 1) {
634483
+ const line = lines[i2];
634484
+ if (/^satisfied=/i.test(line) || /^unresolved=/i.test(line) || /^provenance=/i.test(line)) {
634485
+ if (line.startsWith("satisfied=")) {
634486
+ satisfied = line.replace(/^satisfied=/i, "");
634487
+ } else if (line.startsWith("unresolved=")) {
634488
+ unresolved = line.replace(/^unresolved=/i, "");
634489
+ } else if (line.startsWith("provenance=")) {
634490
+ provenance = line.replace(/^provenance=/i, "");
634491
+ }
634492
+ continue;
634493
+ }
634494
+ if (/^Contract:/i.test(line)) {
634495
+ continue;
634496
+ }
634497
+ if (curatedSummary.length < 240) {
634498
+ curatedSummary = curatedSummary ? `${curatedSummary} ${compactForDisplay(line, 120)}` : compactForDisplay(line, 120);
634499
+ }
634500
+ }
634501
+ }
634502
+ const isDuplicate = /^\[branch-duplicate-blocked\]/i.test(lines[0]);
634503
+ const header = isDuplicate ? "Branch-extract duplicate reuse" : "Branch-extract preempted";
634504
+ const whatHappened = isDuplicate ? "a cache-safe duplicate was detected" : "read was auto-summarized before injecting into context";
634505
+ const out = [
634506
+ `↳ ${header}`,
634507
+ ` ├ what happened: ${whatHappened}`,
634508
+ ` ├ why: ${compactForDisplay(reasons, 140)}`,
634509
+ ` ├ path: ${compactForDisplay(path16, 140)}`,
634510
+ ` ├ decision scope: ${route}`
634511
+ ];
634512
+ if (projected) {
634513
+ const projectedText = fractionLimit ? `${projected} projected → ${fractionLimit} limit` : `${projected} projected`;
634514
+ const availText = available ? `; available headroom ${available}` : "";
634515
+ out.push(` ├ budget: ${projectedText}${availText}`);
634516
+ }
634517
+ if (goalAnchor) out.push(` ├ goal anchor: ${compactForDisplay(goalAnchor, 120)}`);
634518
+ if (request) out.push(` ├ request: ${compactForDisplay(request, 150)}`);
634519
+ if (required.length > 0) {
634520
+ out.push(` ├ required: ${compactForDisplay(required.slice(0, 3).join(", "), 180)}`);
634521
+ }
634522
+ if (stopCondition) {
634523
+ out.push(` ├ stop: ${compactForDisplay(stopCondition, 140)}`);
634524
+ }
634525
+ if (curatedSummary) {
634526
+ out.push(` ├ curated segment: ${compactForDisplay(curatedSummary, 180)}`);
634527
+ }
634528
+ if (satisfied || unresolved) {
634529
+ out.push(
634530
+ ` ├ state: satisfied=${compactForDisplay(satisfied || "none", 90)}; unresolved=${compactForDisplay(unresolved || "none", 90)}`
634531
+ );
634532
+ }
634533
+ if (provenance) {
634534
+ out.push(` ├ provenance: ${compactForDisplay(provenance, 120)}`);
634535
+ }
634536
+ if (out.length > 1) {
634537
+ const last2 = out.length - 1;
634538
+ out[last2] = out[last2]?.replace(/^ ├ /, " └ ") ?? out[last2];
634539
+ }
634540
+ return out.length > 0 ? out : null;
634541
+ }
634542
+ function formatSupersededPlanSummary() {
634543
+ return [
634544
+ "↳ Mode-collapse guard",
634545
+ " ├ what happened: near-duplicate assistant plan was suppressed",
634546
+ " ├ why: loop prevention to stop re-entering the same plan text",
634547
+ " └ next action: tool call or concrete evidence request before restating the plan"
634548
+ ];
634549
+ }
634550
+ function formatEchoGuardSummary(output) {
634551
+ const lower = output.toLowerCase();
634552
+ const match = output.match(/echo-1:\s*text-only echo\s*#?(\d+)/i);
634553
+ const echoCount = match?.[1] ? `#${match[1]}` : "";
634554
+ const similarityMatch = output.match(/(\d+)% similar/);
634555
+ const similarity3 = similarityMatch?.[1] ? ` (${similarityMatch[1]}% similar to earlier response)` : "";
634556
+ const collapsed = output.match(/collapsed\s+(\d+)\s+duplicate/);
634557
+ const duplicates = collapsed?.[1] ? `${collapsed[1]} duplicate(s) collapsed` : "";
634558
+ const out = [
634559
+ `↳ ECHO-1 mode-collapse guard${echoCount ? ` ${echoCount}` : ""}${similarity3}`,
634560
+ " ├ what happened: repeated text-only plan was intercepted",
634561
+ " ├ why: duplicate plan text was detected from the model loop",
634562
+ ` ├ action: pattern-breaker${duplicates ? ` (${duplicates})` : ""}`,
634563
+ " └ next action: resume with tool-backed evidence"
634564
+ ];
634565
+ return out;
634566
+ }
634567
+ function summarizeInternalControlOutput(output) {
634568
+ if (!output) return null;
634569
+ const firstLine = output.split(/\r?\n/)[0]?.trim().toLowerCase() ?? "";
634570
+ const lower = output.toLowerCase();
634571
+ if (firstLine.includes("[branch-extract") || firstLine.includes("[branch-duplicate-blocked]") || lower.includes("branch-extract preempted")) {
634572
+ return formatBranchExtractSummary(output);
634573
+ }
634574
+ if (firstLine.includes("[echo break") || firstLine.includes("[echo-break") || lower.includes("echo-1:")) {
634575
+ return formatEchoGuardSummary(output);
634576
+ }
634577
+ if (lower.includes("[superseded near-duplicate plan removed")) {
634578
+ return formatSupersededPlanSummary();
634579
+ }
634580
+ return null;
634581
+ }
634376
634582
  function stripTrustTierWrapperForTui(text2, maxWrapperChars = 400) {
634377
634583
  const trustWrapper = new RegExp(
634378
634584
  `^\\[trust_tier:[^\\]\\n]{0,${Math.max(0, maxWrapperChars)}}\\][ \\t]*(?:\\n)?`,
@@ -634832,6 +635038,14 @@ function resolveToolOutputMaxLines(verbose) {
634832
635038
  }
634833
635039
  function buildToolResultBody(toolName, success, output, verbose) {
634834
635040
  const debug = loadConfig()?.debug ?? false;
635041
+ const internalControlSummary = summarizeInternalControlOutput(output);
635042
+ if (internalControlSummary && internalControlSummary.length > 0) {
635043
+ return internalControlSummary.map((line) => ({
635044
+ text: line,
635045
+ mode: "wrap",
635046
+ kind: "plain"
635047
+ }));
635048
+ }
634835
635049
  if (toolName === "file_edit" || toolName === "file_patch") {
634836
635050
  if (!success) {
634837
635051
  return [
@@ -701375,11 +701589,29 @@ function isTelegramNoReplySentinel(text2) {
701375
701589
  const lower = compactTelegramVisibleText(text2).toLowerCase();
701376
701590
  return lower === "no_reply" || lower.startsWith("no_reply");
701377
701591
  }
701592
+ function isTelegramInternalControlText(text2) {
701593
+ const compact4 = compactTelegramVisibleText(text2);
701594
+ if (!compact4) return false;
701595
+ const lower = compact4.toLowerCase();
701596
+ const patterns = [
701597
+ /\[superseded near-duplicate plan removed/i,
701598
+ /\[echo break/i,
701599
+ /\[branch-extract\b/i,
701600
+ /\[discovery contract\]/i,
701601
+ /\[curated segments\]/i,
701602
+ /\[branch-duplicate-blocked\]/i,
701603
+ /branch-extract preempted/i,
701604
+ /contract: use these anchors as evidence/i,
701605
+ /\becho break\b/i
701606
+ ];
701607
+ return patterns.some((pattern) => pattern.test(lower));
701608
+ }
701378
701609
  function isTelegramInternalStatusText(text2) {
701379
701610
  const compact4 = compactTelegramVisibleText(text2);
701380
701611
  if (!compact4) return false;
701381
701612
  const lower = compact4.toLowerCase();
701382
701613
  if (isTelegramNoReplySentinel(compact4)) return true;
701614
+ if (isTelegramInternalControlText(compact4)) return true;
701383
701615
  if (lower === "complete" || lower === "completed") return true;
701384
701616
  if (/^memory stage:/i.test(compact4)) return true;
701385
701617
  if (/^\[ppr[-_\s]?skip\]/i.test(compact4)) return true;
@@ -701434,6 +701666,7 @@ function cleanTelegramVisibleReply(text2, options2 = {}) {
701434
701666
  if (!clean5) return "";
701435
701667
  if (options2.suppressPotentialNoReplyPrefix && isTelegramPotentialNoReplyPrefix(clean5))
701436
701668
  return "";
701669
+ if (isTelegramInternalControlText(clean5)) return "";
701437
701670
  if (isTelegramInternalStatusText(clean5)) return "";
701438
701671
  const filtered = stripTelegramStuckSelfTalk(clean5).trim();
701439
701672
  if (!filtered) return "";
@@ -701720,6 +701953,7 @@ function formatTelegramProgressEvent(event) {
701720
701953
  }
701721
701954
  if (event.type === "tool_result") {
701722
701955
  const preview = sanitizeTelegramProgressText(event.content || "", 1500);
701956
+ if (isTelegramInternalControlText(preview)) return null;
701723
701957
  if (isTelegramInternalStatusText(preview)) return null;
701724
701958
  return toolResultBlock(
701725
701959
  event.toolName || "tool",
@@ -701855,6 +702089,7 @@ function applyTelegramAdminLivePanelEvent(state, event) {
701855
702089
  }
701856
702090
  if (event.type === "tool_result" && event.toolName && event.toolName !== "task_complete") {
701857
702091
  const preview = sanitizeTelegramProgressText(event.content || "", 260);
702092
+ if (isTelegramInternalControlText(preview)) return;
701858
702093
  const line = `${event.success ? "✓" : "✗"} ${event.toolName}${preview ? `: ${preview}` : ""}`;
701859
702094
  if (TELEGRAM_ADMIN_LIVE_MUTATION_TOOLS.has(event.toolName)) {
701860
702095
  pushTelegramAdminPanelMutationLine(state, line);
@@ -752939,6 +753174,11 @@ function writeSubAgentEventForView(statusBar, agentId, event, verbose = false) {
752939
753174
  }
752940
753175
  }
752941
753176
  function formatSubAgentEventForView(event) {
753177
+ const summarizeEventContent = (content) => {
753178
+ const summaryLines = summarizeInternalControlOutput(content);
753179
+ if (!summaryLines || summaryLines.length === 0) return null;
753180
+ return truncateSubAgentViewText(summaryLines.join("\n"), 420);
753181
+ };
752942
753182
  switch (event.type) {
752943
753183
  case "tool_call": {
752944
753184
  let args = "";
@@ -752951,17 +753191,26 @@ function formatSubAgentEventForView(event) {
752951
753191
  }
752952
753192
  case "tool_result": {
752953
753193
  const mark = event.success === false ? "✗" : "✓";
752954
- const body = (event.content ?? "").split("\n").slice(0, 3).join(" ").trim();
753194
+ const output = event.content ?? "";
753195
+ const summary = summarizeEventContent(output);
753196
+ const body = summary ? `${summary}` : output.split("\n").slice(0, 3).join(" ").trim();
753197
+ if (summary) {
753198
+ const compact4 = `${mark} ${event.toolName ?? "tool"}
753199
+ ${summary}`;
753200
+ return truncateSubAgentViewText(compact4, 420);
753201
+ }
752955
753202
  return `${mark} ${event.toolName ?? "tool"}${body ? `: ${truncateSubAgentViewText(body, 300)}` : ""}`;
752956
753203
  }
752957
753204
  case "assistant_text":
752958
753205
  case "model_response": {
752959
- const t2 = (event.content ?? "").trim();
753206
+ const summary = summarizeEventContent(event.content ?? "");
753207
+ const t2 = summary ?? (event.content ?? "").trim();
752960
753208
  return t2 ? truncateSubAgentViewText(t2, 1e3) : null;
752961
753209
  }
752962
753210
  case "status": {
752963
- const t2 = (event.content ?? "").trim();
752964
- return t2 ? ${truncateSubAgentViewText(t2, 300)}` : null;
753211
+ const summary = summarizeEventContent(event.content ?? "");
753212
+ const t2 = summary ?? (event.content ?? "").trim();
753213
+ return t2 ? `· ${truncateSubAgentViewText(t2, 420)}` : null;
752965
753214
  }
752966
753215
  case "trajectory_checkpoint": {
752967
753216
  const assessment = event.trajectory?.assessment ?? "updated";
@@ -755522,12 +755771,14 @@ ${entry.fullContent}`
755522
755771
  break;
755523
755772
  }
755524
755773
  const statusContent = event.content ?? "";
755774
+ const compactStatusLines = summarizeInternalControlOutput(statusContent);
755775
+ const compactStatusContent = compactStatusLines?.length ? compactStatusLines.join("\n") : statusContent;
755525
755776
  const gpuWaitingStatus = /^Waiting for free GPU\.{3,}$/.test(
755526
- statusContent
755777
+ compactStatusContent
755527
755778
  );
755528
- const gpuResumeStatus = statusContent === "GPU Free, Resuming";
755779
+ const gpuResumeStatus = compactStatusContent === "GPU Free, Resuming";
755529
755780
  if (gpuWaitingStatus) {
755530
- const dotCount = statusContent.match(/\.+$/)?.[0]?.length ?? 3;
755781
+ const dotCount = compactStatusContent.match(/\.+$/)?.[0]?.length ?? 3;
755531
755782
  if (startGpuRecoveryBlock(dotCount)) break;
755532
755783
  } else if (gpuResumeStatus && finishGpuRecoveryBlock()) {
755533
755784
  break;
@@ -755536,13 +755787,13 @@ ${entry.fullContent}`
755536
755787
  if (!config.debug && !gpuRecoveryStatus) break;
755537
755788
  if (isNeovimActive()) {
755538
755789
  writeToNeovimOutput(
755539
- `\x1B[38;5;250m${event.content ?? ""}\x1B[0m\r
755790
+ `\x1B[38;5;250m${compactStatusContent}\x1B[0m\r
755540
755791
  `
755541
755792
  );
755542
755793
  } else {
755543
- contentWrite(() => renderInfo(event.content ?? ""));
755544
- if (event.content && event.content.startsWith("Provenance saved: ")) {
755545
- lastProvenancePath = event.content.slice("Provenance saved: ".length).trim();
755794
+ contentWrite(() => renderInfo(compactStatusContent));
755795
+ if (statusContent && statusContent.startsWith("Provenance saved: ")) {
755796
+ lastProvenancePath = statusContent.slice("Provenance saved: ".length).trim();
755546
755797
  }
755547
755798
  }
755548
755799
  break;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.547",
3
+ "version": "1.0.548",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.547",
9
+ "version": "1.0.548",
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.547",
3
+ "version": "1.0.548",
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",