omnius 1.0.547 → 1.0.549

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.
@@ -633664,6 +633689,237 @@ var init_tool_collapse_store = __esm({
633664
633689
  }
633665
633690
  });
633666
633691
 
633692
+ // packages/cli/src/utils/internal-output.ts
633693
+ function compactForDisplay(text2, max = 170) {
633694
+ const clean5 = text2.replace(/\s+/g, " ").trim();
633695
+ return clean5.length <= max ? clean5 : `${clean5.slice(0, Math.max(0, max - 1)).trimEnd()}…`;
633696
+ }
633697
+ function parseAssignmentMap(line) {
633698
+ const out = {};
633699
+ const assignmentRe = /(\w+)=([^\s]+)/g;
633700
+ let m2;
633701
+ while ((m2 = assignmentRe.exec(line)) !== null) {
633702
+ out[m2[1].toLowerCase()] = m2[2];
633703
+ }
633704
+ return out;
633705
+ }
633706
+ function extractFirstMatch(lines, pattern) {
633707
+ for (const line of lines) {
633708
+ const match = line.match(pattern);
633709
+ if (match?.[1]) return match[1].trim();
633710
+ }
633711
+ return "";
633712
+ }
633713
+ function formatBranchExtractSummary(output) {
633714
+ const lines = output.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
633715
+ if (lines.length === 0) return null;
633716
+ const first2 = lines[0].toLowerCase();
633717
+ const isBranchExtract = first2.startsWith("[branch-extract") || first2.startsWith("[branch-duplicate-blocked]");
633718
+ if (!isBranchExtract) return null;
633719
+ const routingLine = lines.find((line) => line.toLowerCase().startsWith("routing=")) || "";
633720
+ const assignment = parseAssignmentMap(routingLine);
633721
+ const route = assignment.routing ?? "mandatory";
633722
+ const reasons = assignment.reasons?.split(",").map((r2) => r2.trim()).filter(Boolean).join(", ") || "context protection";
633723
+ const projected = assignment.projected_read_tokens || assignment.projectedreadtokens || assignment.projected;
633724
+ const fractionLimit = assignment.fraction_limit_tokens || assignment.fractionlimittokens || assignment.fraction_limit || "";
633725
+ const available = assignment.available_headroom_tokens || assignment.available_headroom;
633726
+ const path16 = extractFirstMatch(
633727
+ lines,
633728
+ /(?:^|\s)path=(\S+)/
633729
+ ) || extractFirstMatch(lines, /\[branch-extract[^\]]*?\]\s*path=([^\s]+)/) || "unknown path";
633730
+ const discoveryStart = lines.findIndex(
633731
+ (line) => /^\[discovery contract\]/i.test(line)
633732
+ );
633733
+ const curatedStart = lines.findIndex(
633734
+ (line) => /^\[curated segments\]/i.test(line)
633735
+ );
633736
+ let goalAnchor = "";
633737
+ let request = "";
633738
+ const required = [];
633739
+ let inRequired = false;
633740
+ let stopCondition = "";
633741
+ if (discoveryStart >= 0) {
633742
+ for (let i2 = discoveryStart + 1; i2 < lines.length; i2 += 1) {
633743
+ const line = lines[i2];
633744
+ if (/^\[curated segments\]/i.test(line)) break;
633745
+ if (/^Goal anchor:/i.test(line)) {
633746
+ goalAnchor = line.replace(/^Goal anchor:\s*/i, "");
633747
+ inRequired = false;
633748
+ continue;
633749
+ }
633750
+ if (/^Request:/i.test(line)) {
633751
+ request = line.replace(/^Request:\s*/i, "");
633752
+ inRequired = false;
633753
+ continue;
633754
+ }
633755
+ if (/^Stop conditions?:/i.test(line)) {
633756
+ stopCondition = line.replace(/^Stop conditions?:\s*/i, "");
633757
+ inRequired = false;
633758
+ continue;
633759
+ }
633760
+ if (/^Required discoveries:/i.test(line)) {
633761
+ inRequired = true;
633762
+ continue;
633763
+ }
633764
+ if (inRequired && line.startsWith("- ")) {
633765
+ required.push(line.replace(/^- /, "").slice(0, 170));
633766
+ }
633767
+ }
633768
+ }
633769
+ let curatedSummary = "";
633770
+ let unresolved = "";
633771
+ let satisfied = "";
633772
+ let provenance = "";
633773
+ if (curatedStart >= 0) {
633774
+ for (let i2 = curatedStart + 1; i2 < lines.length; i2 += 1) {
633775
+ const line = lines[i2];
633776
+ if (/^satisfied=/i.test(line) || /^unresolved=/i.test(line) || /^provenance=/i.test(line)) {
633777
+ if (line.startsWith("satisfied=")) {
633778
+ satisfied = line.replace(/^satisfied=/i, "");
633779
+ } else if (line.startsWith("unresolved=")) {
633780
+ unresolved = line.replace(/^unresolved=/i, "");
633781
+ } else if (line.startsWith("provenance=")) {
633782
+ provenance = line.replace(/^provenance=/i, "");
633783
+ }
633784
+ continue;
633785
+ }
633786
+ if (/^Contract:/i.test(line)) {
633787
+ continue;
633788
+ }
633789
+ if (curatedSummary.length < 240) {
633790
+ curatedSummary = curatedSummary ? `${curatedSummary} ${compactForDisplay(line, 120)}` : compactForDisplay(line, 120);
633791
+ }
633792
+ }
633793
+ }
633794
+ const isDuplicate = /^\[branch-duplicate-blocked\]/i.test(lines[0]);
633795
+ const header = isDuplicate ? "Branch-extract duplicate reuse" : "Branch-extract preempted";
633796
+ const whatHappened = isDuplicate ? "a cache-safe duplicate was detected" : "read was auto-summarized before injecting into context";
633797
+ const out = [
633798
+ `↳ ${header}`,
633799
+ ` ├ what happened: ${whatHappened}`,
633800
+ ` ├ why: ${compactForDisplay(reasons, 140)}`,
633801
+ ` ├ path: ${compactForDisplay(path16, 140)}`,
633802
+ ` ├ decision scope: ${route}`
633803
+ ];
633804
+ if (projected) {
633805
+ const projectedText = fractionLimit ? `${projected} projected → ${fractionLimit} limit` : `${projected} projected`;
633806
+ const availText = available ? `; available headroom ${available}` : "";
633807
+ out.push(` ├ budget: ${projectedText}${availText}`);
633808
+ }
633809
+ if (goalAnchor) out.push(` ├ goal anchor: ${compactForDisplay(goalAnchor, 120)}`);
633810
+ if (request) out.push(` ├ request: ${compactForDisplay(request, 150)}`);
633811
+ if (required.length > 0) {
633812
+ out.push(` ├ required: ${compactForDisplay(required.slice(0, 3).join(", "), 180)}`);
633813
+ }
633814
+ if (stopCondition) {
633815
+ out.push(` ├ stop: ${compactForDisplay(stopCondition, 140)}`);
633816
+ }
633817
+ if (curatedSummary) {
633818
+ out.push(` ├ curated segment: ${compactForDisplay(curatedSummary, 180)}`);
633819
+ }
633820
+ if (satisfied || unresolved) {
633821
+ out.push(
633822
+ ` ├ state: satisfied=${compactForDisplay(satisfied || "none", 90)}; unresolved=${compactForDisplay(unresolved || "none", 90)}`
633823
+ );
633824
+ }
633825
+ if (provenance) {
633826
+ out.push(` ├ provenance: ${compactForDisplay(provenance, 120)}`);
633827
+ }
633828
+ if (out.length > 1) {
633829
+ const last2 = out.length - 1;
633830
+ out[last2] = out[last2]?.replace(/^ ├ /, " └ ") ?? out[last2];
633831
+ }
633832
+ return out.length > 0 ? out : null;
633833
+ }
633834
+ function formatEchoGuardSummary(output) {
633835
+ const lower = output.toLowerCase();
633836
+ const match = output.match(/echo-1:\s*text-only echo\s*#?(\d+)/i);
633837
+ const echoCount = match?.[1] ? `#${match[1]}` : "";
633838
+ const similarityMatch = output.match(/(\d+)% similar/);
633839
+ const similarity3 = similarityMatch?.[1] ? ` (${similarityMatch[1]}% similar to earlier response)` : "";
633840
+ const collapsed = output.match(/collapsed\s+(\d+)\s+duplicate/);
633841
+ const duplicates = collapsed?.[1] ? `${collapsed[1]} duplicate(s) collapsed` : "";
633842
+ return [
633843
+ `↳ ECHO-1 mode-collapse guard${echoCount ? ` ${echoCount}` : ""}${similarity3}`,
633844
+ " ├ what happened: repeated text-only plan was intercepted",
633845
+ " ├ why: duplicate plan text was detected from the model loop",
633846
+ ` ├ action: pattern-breaker${duplicates ? ` (${duplicates})` : ""}`,
633847
+ " └ next action: resume with tool-backed evidence"
633848
+ ];
633849
+ }
633850
+ function formatSupersededPlanSummary() {
633851
+ return [
633852
+ "↳ Mode-collapse guard",
633853
+ " ├ what happened: near-duplicate assistant plan was suppressed",
633854
+ " ├ why: loop prevention to stop re-entering the same plan text",
633855
+ " └ next action: tool call or concrete evidence request before restating the plan"
633856
+ ];
633857
+ }
633858
+ function summarizeInternalControlOutput(output) {
633859
+ if (!output) return null;
633860
+ const firstLine = output.split(/\r?\n/)[0]?.trim().toLowerCase() ?? "";
633861
+ const lower = output.toLowerCase();
633862
+ if (firstLine.includes("[branch-extract") || firstLine.includes("[branch-duplicate-blocked]") || lower.includes("branch-extract preempted")) {
633863
+ return formatBranchExtractSummary(output);
633864
+ }
633865
+ if (firstLine.includes("[echo break") || firstLine.includes("[echo-break") || lower.includes("echo-1:")) {
633866
+ return formatEchoGuardSummary(output);
633867
+ }
633868
+ if (lower.includes("[superseded near-duplicate plan removed")) {
633869
+ return formatSupersededPlanSummary();
633870
+ }
633871
+ return null;
633872
+ }
633873
+ function isRunnerEventLine(line) {
633874
+ const raw = line.trim();
633875
+ if (!raw.startsWith("{") || !raw.endsWith("}")) return false;
633876
+ try {
633877
+ const parsed = JSON.parse(raw);
633878
+ return typeof parsed?.type === "string";
633879
+ } catch {
633880
+ return false;
633881
+ }
633882
+ }
633883
+ function isStatusEchoLine(line) {
633884
+ if (/^i\s+/.test(line)) return true;
633885
+ if (/^E\s+/.test(line)) return true;
633886
+ if (/^⚠\s*(Task incomplete|Task complete)/.test(line)) return true;
633887
+ if (/^▹\s/.test(line)) return true;
633888
+ if (/^User:\s/.test(line)) return true;
633889
+ if (/^Assistant:\s/.test(line)) return true;
633890
+ if (/^Previous conversation:/.test(line)) return true;
633891
+ if (/^omnius \(/.test(line)) return true;
633892
+ return false;
633893
+ }
633894
+ function stripAnsi2(text2) {
633895
+ return text2.replace(/\x1B\[[0-9;]*[A-Za-z]/g, "").replace(/\x1B\].*?\x07/g, "").replace(/\x1B\[[\?]?[0-9;]*[hl]/g, "");
633896
+ }
633897
+ function sanitizeAgentOutputForUser(raw) {
633898
+ if (typeof raw !== "string") return "";
633899
+ const cleaned = stripAnsi2(raw);
633900
+ const summary = summarizeInternalControlOutput(cleaned.trim());
633901
+ if (summary) return summary.join("\n");
633902
+ const out = [];
633903
+ const lines = cleaned.split("\n");
633904
+ for (const rawLine of lines) {
633905
+ const line = rawLine.trim();
633906
+ if (!line) continue;
633907
+ if (isRunnerEventLine(line)) continue;
633908
+ const lineSummary = summarizeInternalControlOutput(line);
633909
+ if (lineSummary) {
633910
+ out.push(...lineSummary);
633911
+ continue;
633912
+ }
633913
+ if (isStatusEchoLine(line)) continue;
633914
+ out.push(line);
633915
+ }
633916
+ return out.join("\n").trim();
633917
+ }
633918
+ var init_internal_output = __esm({
633919
+ "packages/cli/src/utils/internal-output.ts"() {
633920
+ }
633921
+ });
633922
+
633667
633923
  // packages/cli/src/tui/render.ts
633668
633924
  var render_exports = {};
633669
633925
  __export(render_exports, {
@@ -633719,6 +633975,7 @@ __export(render_exports, {
633719
633975
  setContentWriteHook: () => setContentWriteHook,
633720
633976
  setEmojisEnabled: () => setEmojisEnabled,
633721
633977
  stripTrustTierWrapperForTui: () => stripTrustTierWrapperForTui,
633978
+ summarizeInternalControlOutput: () => summarizeInternalControlOutput,
633722
633979
  ui: () => ui
633723
633980
  });
633724
633981
  function stdoutIsTTY() {
@@ -634832,6 +635089,14 @@ function resolveToolOutputMaxLines(verbose) {
634832
635089
  }
634833
635090
  function buildToolResultBody(toolName, success, output, verbose) {
634834
635091
  const debug = loadConfig()?.debug ?? false;
635092
+ const internalControlSummary = summarizeInternalControlOutput(output);
635093
+ if (internalControlSummary && internalControlSummary.length > 0) {
635094
+ return internalControlSummary.map((line) => ({
635095
+ text: line,
635096
+ mode: "wrap",
635097
+ kind: "plain"
635098
+ }));
635099
+ }
634835
635100
  if (toolName === "file_edit" || toolName === "file_patch") {
634836
635101
  if (!success) {
634837
635102
  return [
@@ -635618,6 +635883,7 @@ var init_render = __esm({
635618
635883
  init_model_picker();
635619
635884
  init_secret_redactor();
635620
635885
  init_tool_collapse_store();
635886
+ init_internal_output();
635621
635887
  c3 = {
635622
635888
  bold: (t2) => ansi2("1", t2),
635623
635889
  dim: (t2) => stdoutIsTTY() ? `${dimFg()}${t2}\x1B[0m` : t2,
@@ -644897,11 +645163,11 @@ function truncate4(s2, max) {
644897
645163
  if (s2.length <= max) return s2.padEnd(max, " ");
644898
645164
  return s2.slice(0, Math.max(0, max - 1)) + "…";
644899
645165
  }
644900
- function stripAnsi2(s2) {
645166
+ function stripAnsi3(s2) {
644901
645167
  return s2.replace(/\x1B\[[0-9;]*[A-Za-z]/g, "").replace(/\x1B\][^\x07]*\x07/g, "").replace(/\x1B[()][A-Z0-9]/g, "").replace(/\x1B\[?\??[0-9;]*[a-zA-Z]/g, "").replace(/\x1B/g, "");
644902
645168
  }
644903
645169
  function visualLen(s2) {
644904
- return stripAnsi2(s2).length;
645170
+ return stripAnsi3(s2).length;
644905
645171
  }
644906
645172
  function buildTodoProgressBar(todos, maxWidth) {
644907
645173
  if (maxWidth <= 0 || todos.length === 0) return "";
@@ -652817,7 +653083,7 @@ function ansi3(code8, text2) {
652817
653083
  function fg2563(code8, text2) {
652818
653084
  return isTTY3 ? `\x1B[38;5;${code8}m${text2}\x1B[0m` : text2;
652819
653085
  }
652820
- function stripAnsi3(s2) {
653086
+ function stripAnsi4(s2) {
652821
653087
  return s2.replace(/\x1B\[[0-9;]*m/g, "");
652822
653088
  }
652823
653089
  function stripTerminalControl(s2) {
@@ -652833,15 +653099,15 @@ function renderNonInteractiveSelect(opts, currentTitle, skipSet) {
652833
653099
  const surface = nonInteractiveSelectSurface.getStore();
652834
653100
  const maxItems = Math.max(1, surface?.maxItems ?? 30);
652835
653101
  const lines = [];
652836
- if (currentTitle) lines.push(stripTerminalControl(stripAnsi3(currentTitle)));
653102
+ if (currentTitle) lines.push(stripTerminalControl(stripAnsi4(currentTitle)));
652837
653103
  if (lines.length) lines.push("");
652838
653104
  let idx = 1;
652839
653105
  let shown = 0;
652840
653106
  let omitted = 0;
652841
653107
  for (const item of opts.items) {
652842
653108
  const isSkip = skipSet.has(item.key);
652843
- const labelPlain = stripTerminalControl(stripAnsi3(item.label)).trim();
652844
- const detailPlain = item.detail ? stripTerminalControl(stripAnsi3(item.detail)).trim() : "";
653109
+ const labelPlain = stripTerminalControl(stripAnsi4(item.label)).trim();
653110
+ const detailPlain = item.detail ? stripTerminalControl(stripAnsi4(item.detail)).trim() : "";
652845
653111
  if (isSkip) {
652846
653112
  if (labelPlain) lines.push(labelPlain);
652847
653113
  continue;
@@ -652858,7 +653124,7 @@ function renderNonInteractiveSelect(opts, currentTitle, skipSet) {
652858
653124
  idx++;
652859
653125
  }
652860
653126
  if (omitted > 0) lines.push(` ... ${omitted} more`);
652861
- if (opts.customKeyHint) lines.push("", stripTerminalControl(stripAnsi3(opts.customKeyHint)));
653127
+ if (opts.customKeyHint) lines.push("", stripTerminalControl(stripAnsi4(opts.customKeyHint)));
652862
653128
  lines.push("", surface?.hint ?? "(non-interactive: menu shown as text; open the TUI for selection)");
652863
653129
  process.stdout.write(lines.join("\n").trimEnd() + "\n");
652864
653130
  }
@@ -652873,8 +653139,8 @@ function matchRow(item, focused, isActive) {
652873
653139
  return defaultRenderRow(item, focused, isActive);
652874
653140
  }
652875
653141
  const marker = selectColors.matchLight("○");
652876
- const label = selectColors.matchLight(stripAnsi3(item.label));
652877
- const detail = item.detail ? ` ${selectColors.dim(stripAnsi3(item.detail))}` : "";
653142
+ const label = selectColors.matchLight(stripAnsi4(item.label));
653143
+ const detail = item.detail ? ` ${selectColors.dim(stripAnsi4(item.detail))}` : "";
652878
653144
  return ` ${marker} ${label}${detail}`;
652879
653145
  }
652880
653146
  function tuiSelect(opts) {
@@ -652903,8 +653169,8 @@ function tuiSelect(opts) {
652903
653169
  matchSet = /* @__PURE__ */ new Set();
652904
653170
  for (let i2 = 0; i2 < items.length; i2++) {
652905
653171
  if (isSkippable(i2)) continue;
652906
- const plain = stripAnsi3(items[i2].label).toLowerCase();
652907
- const detailPlain = items[i2].detail ? stripAnsi3(items[i2].detail).toLowerCase() : "";
653172
+ const plain = stripAnsi4(items[i2].label).toLowerCase();
653173
+ const detailPlain = items[i2].detail ? stripAnsi4(items[i2].detail).toLowerCase() : "";
652908
653174
  if (plain.includes(lower) || detailPlain.includes(lower)) {
652909
653175
  matchSet.add(i2);
652910
653176
  }
@@ -653029,7 +653295,7 @@ function tuiSelect(opts) {
653029
653295
  if (deleteConfirmIdx === idx) {
653030
653296
  const yesLabel = deleteConfirmSel ? selectColors.bold(selectColors.green("[Yes]")) : selectColors.dim("[Yes]");
653031
653297
  const noLabel = !deleteConfirmSel ? selectColors.bold(selectColors.blue("[No]")) : selectColors.dim("[No]");
653032
- lines.push(` ${ansi3("31", "✕")} ${ansi3("31", stripAnsi3(item.label))} Delete? ${yesLabel} ${noLabel}`);
653298
+ lines.push(` ${ansi3("31", "✕")} ${ansi3("31", stripAnsi4(item.label))} Delete? ${yesLabel} ${noLabel}`);
653033
653299
  } else if (filter2) {
653034
653300
  lines.push(matchRow(item, focused, isActive));
653035
653301
  } else {
@@ -659015,11 +659281,11 @@ import { extname as extname18, resolve as resolve66 } from "node:path";
659015
659281
  function ansi4(code8, text2) {
659016
659282
  return isTTY4 ? `\x1B[${code8}m${text2}\x1B[0m` : text2;
659017
659283
  }
659018
- function stripAnsi4(s2) {
659284
+ function stripAnsi5(s2) {
659019
659285
  return s2.replace(/\x1B\[[0-9;]*m/g, "");
659020
659286
  }
659021
659287
  function fitToWidth(text2, width) {
659022
- const visible = stripAnsi4(text2);
659288
+ const visible = stripAnsi5(text2);
659023
659289
  if (visible.length >= width) {
659024
659290
  let visCount = 0;
659025
659291
  let i2 = 0;
@@ -686954,11 +687220,11 @@ function normalizeRoot(root) {
686954
687220
  return root;
686955
687221
  }
686956
687222
  }
686957
- function stripAnsi5(text2) {
687223
+ function stripAnsi6(text2) {
686958
687224
  return String(text2 || "").replace(/\u001b\[[0-9;]*[a-zA-Z]/g, "");
686959
687225
  }
686960
687226
  function cleanSessionDisplayLine(line) {
686961
- return stripAnsi5(line).replace(/^[>❯▹∙•*+\-\s]+/, "").replace(/^(?:User|Assistant|You|Open Agent|Omnius)\s*:\s*/i, "").replace(/\s+/g, " ").trim();
687227
+ return stripAnsi6(line).replace(/^[>❯▹∙•*+\-\s]+/, "").replace(/^(?:User|Assistant|You|Open Agent|Omnius)\s*:\s*/i, "").replace(/\s+/g, " ").trim();
686962
687228
  }
686963
687229
  function isNoisySessionDisplayLine(line) {
686964
687230
  const clean5 = cleanSessionDisplayLine(line || "");
@@ -686966,12 +687232,12 @@ function isNoisySessionDisplayLine(line) {
686966
687232
  return /^(?:Previous session found|REST API:|Nexus P2P network connected|No context to restore|Starting fresh|Use \/endpoint|Knowledge graph:|Zettelkasten:|Episodes captured:|Current OMNIUS_HOST:|Loaded TUI session|General session$|Chat tui:sess|\[Imported TUI session transcript\]|Title:|Description:|Project root:|i\s+)/i.test(clean5);
686967
687233
  }
686968
687234
  function bestSessionDisplayLine(text2) {
686969
- const lines = stripAnsi5(text2).split(/\r?\n/);
687235
+ const lines = stripAnsi6(text2).split(/\r?\n/);
686970
687236
  for (const line of lines) {
686971
687237
  const clean5 = cleanSessionDisplayLine(line);
686972
687238
  if (!isNoisySessionDisplayLine(clean5)) return clean5;
686973
687239
  }
686974
- const fallback = stripAnsi5(text2).replace(/\s+/g, " ").trim();
687240
+ const fallback = stripAnsi6(text2).replace(/\s+/g, " ").trim();
686975
687241
  return isNoisySessionDisplayLine(fallback) ? "" : fallback;
686976
687242
  }
686977
687243
  function makeTitle(text2) {
@@ -687172,7 +687438,7 @@ function getSession2(sessionId, model, cwd4) {
687172
687438
  function importTranscriptSession(opts) {
687173
687439
  const projectRoot = normalizeRoot(opts.projectRoot) ?? process.cwd();
687174
687440
  const id2 = opts.id;
687175
- const transcript = opts.transcriptLines.map(stripAnsi5).join("\n").trim();
687441
+ const transcript = opts.transcriptLines.map(stripAnsi6).join("\n").trim();
687176
687442
  const metadataSource = [opts.title, opts.description, transcript].filter(Boolean).join("\n");
687177
687443
  const title = makeTitle(metadataSource || id2);
687178
687444
  const preview = makePreview([opts.description, transcript].filter(Boolean).join("\n") || title);
@@ -701375,11 +701641,29 @@ function isTelegramNoReplySentinel(text2) {
701375
701641
  const lower = compactTelegramVisibleText(text2).toLowerCase();
701376
701642
  return lower === "no_reply" || lower.startsWith("no_reply");
701377
701643
  }
701644
+ function isTelegramInternalControlText(text2) {
701645
+ const compact4 = compactTelegramVisibleText(text2);
701646
+ if (!compact4) return false;
701647
+ const lower = compact4.toLowerCase();
701648
+ const patterns = [
701649
+ /\[superseded near-duplicate plan removed/i,
701650
+ /\[echo break/i,
701651
+ /\[branch-extract\b/i,
701652
+ /\[discovery contract\]/i,
701653
+ /\[curated segments\]/i,
701654
+ /\[branch-duplicate-blocked\]/i,
701655
+ /branch-extract preempted/i,
701656
+ /contract: use these anchors as evidence/i,
701657
+ /\becho break\b/i
701658
+ ];
701659
+ return patterns.some((pattern) => pattern.test(lower));
701660
+ }
701378
701661
  function isTelegramInternalStatusText(text2) {
701379
701662
  const compact4 = compactTelegramVisibleText(text2);
701380
701663
  if (!compact4) return false;
701381
701664
  const lower = compact4.toLowerCase();
701382
701665
  if (isTelegramNoReplySentinel(compact4)) return true;
701666
+ if (isTelegramInternalControlText(compact4)) return true;
701383
701667
  if (lower === "complete" || lower === "completed") return true;
701384
701668
  if (/^memory stage:/i.test(compact4)) return true;
701385
701669
  if (/^\[ppr[-_\s]?skip\]/i.test(compact4)) return true;
@@ -701434,6 +701718,7 @@ function cleanTelegramVisibleReply(text2, options2 = {}) {
701434
701718
  if (!clean5) return "";
701435
701719
  if (options2.suppressPotentialNoReplyPrefix && isTelegramPotentialNoReplyPrefix(clean5))
701436
701720
  return "";
701721
+ if (isTelegramInternalControlText(clean5)) return "";
701437
701722
  if (isTelegramInternalStatusText(clean5)) return "";
701438
701723
  const filtered = stripTelegramStuckSelfTalk(clean5).trim();
701439
701724
  if (!filtered) return "";
@@ -701720,6 +702005,7 @@ function formatTelegramProgressEvent(event) {
701720
702005
  }
701721
702006
  if (event.type === "tool_result") {
701722
702007
  const preview = sanitizeTelegramProgressText(event.content || "", 1500);
702008
+ if (isTelegramInternalControlText(preview)) return null;
701723
702009
  if (isTelegramInternalStatusText(preview)) return null;
701724
702010
  return toolResultBlock(
701725
702011
  event.toolName || "tool",
@@ -701855,6 +702141,7 @@ function applyTelegramAdminLivePanelEvent(state, event) {
701855
702141
  }
701856
702142
  if (event.type === "tool_result" && event.toolName && event.toolName !== "task_complete") {
701857
702143
  const preview = sanitizeTelegramProgressText(event.content || "", 260);
702144
+ if (isTelegramInternalControlText(preview)) return;
701858
702145
  const line = `${event.success ? "✓" : "✗"} ${event.toolName}${preview ? `: ${preview}` : ""}`;
701859
702146
  if (TELEGRAM_ADMIN_LIVE_MUTATION_TOOLS.has(event.toolName)) {
701860
702147
  pushTelegramAdminPanelMutationLine(state, line);
@@ -720266,7 +720553,7 @@ var command_passthrough_exports = {};
720266
720553
  __export(command_passthrough_exports, {
720267
720554
  runCommand: () => runCommand
720268
720555
  });
720269
- function stripAnsi6(s2) {
720556
+ function stripAnsi7(s2) {
720270
720557
  return s2.replace(/\x1B(?:\[[\d;?]*[a-zA-Z]|\][^\x07\x1B]*[\x07\x1B]?|[@-Z\\-_])/g, "");
720271
720558
  }
720272
720559
  async function runCommand(input, opts) {
@@ -720331,7 +720618,7 @@ async function runCommand(input, opts) {
720331
720618
  command: cmdName,
720332
720619
  args: argsStr,
720333
720620
  kind,
720334
- output: stripAnsi6(ansi5).trim(),
720621
+ output: stripAnsi7(ansi5).trim(),
720335
720622
  ansi: ansi5,
720336
720623
  durationMs: Date.now() - start2,
720337
720624
  error: errMsg
@@ -741887,23 +742174,7 @@ async function writeMemoryEpisodes(sessionId, userMessage, assistantContent, too
741887
742174
  }
741888
742175
  }
741889
742176
  function sanitizeChatContent(raw) {
741890
- if (typeof raw !== "string") return "";
741891
- const lines = raw.split("\n");
741892
- const cleaned = [];
741893
- for (const rawLine of lines) {
741894
- const line = rawLine.replace(/\x1B\[[0-9;]*[A-Za-z]/g, "").replace(/\x1B\].*?\x07/g, "").trim();
741895
- if (!line) continue;
741896
- if (/^i\s+/.test(line)) continue;
741897
- if (/^E\s+/.test(line)) continue;
741898
- if (/^⚠\s*(Task incomplete|Task complete)/.test(line)) continue;
741899
- if (/^▹\s/.test(line)) continue;
741900
- if (/^User:\s/.test(line)) continue;
741901
- if (/^Assistant:\s/.test(line)) continue;
741902
- if (/^Previous conversation:/.test(line)) continue;
741903
- if (/^omnius \(/.test(line)) continue;
741904
- cleaned.push(line);
741905
- }
741906
- return cleaned.join("\n").trim();
742177
+ return sanitizeAgentOutputForUser(raw);
741907
742178
  }
741908
742179
  function appendNoThinkDirectivesToMessages(messages2) {
741909
742180
  let lastUserIdx = -1;
@@ -751659,6 +751930,7 @@ var init_serve = __esm({
751659
751930
  init_access_policy();
751660
751931
  init_projects();
751661
751932
  init_project_preferences();
751933
+ init_internal_output();
751662
751934
  init_voice_runtime();
751663
751935
  init_voice();
751664
751936
  init_audit_log();
@@ -752939,6 +753211,11 @@ function writeSubAgentEventForView(statusBar, agentId, event, verbose = false) {
752939
753211
  }
752940
753212
  }
752941
753213
  function formatSubAgentEventForView(event) {
753214
+ const summarizeEventContent = (content) => {
753215
+ const summaryLines = summarizeInternalControlOutput(content);
753216
+ if (!summaryLines || summaryLines.length === 0) return null;
753217
+ return truncateSubAgentViewText(summaryLines.join("\n"), 420);
753218
+ };
752942
753219
  switch (event.type) {
752943
753220
  case "tool_call": {
752944
753221
  let args = "";
@@ -752951,17 +753228,26 @@ function formatSubAgentEventForView(event) {
752951
753228
  }
752952
753229
  case "tool_result": {
752953
753230
  const mark = event.success === false ? "✗" : "✓";
752954
- const body = (event.content ?? "").split("\n").slice(0, 3).join(" ").trim();
753231
+ const output = event.content ?? "";
753232
+ const summary = summarizeEventContent(output);
753233
+ const body = summary ? `${summary}` : output.split("\n").slice(0, 3).join(" ").trim();
753234
+ if (summary) {
753235
+ const compact4 = `${mark} ${event.toolName ?? "tool"}
753236
+ ${summary}`;
753237
+ return truncateSubAgentViewText(compact4, 420);
753238
+ }
752955
753239
  return `${mark} ${event.toolName ?? "tool"}${body ? `: ${truncateSubAgentViewText(body, 300)}` : ""}`;
752956
753240
  }
752957
753241
  case "assistant_text":
752958
753242
  case "model_response": {
752959
- const t2 = (event.content ?? "").trim();
753243
+ const summary = summarizeEventContent(event.content ?? "");
753244
+ const t2 = summary ?? (event.content ?? "").trim();
752960
753245
  return t2 ? truncateSubAgentViewText(t2, 1e3) : null;
752961
753246
  }
752962
753247
  case "status": {
752963
- const t2 = (event.content ?? "").trim();
752964
- return t2 ? ${truncateSubAgentViewText(t2, 300)}` : null;
753248
+ const summary = summarizeEventContent(event.content ?? "");
753249
+ const t2 = summary ?? (event.content ?? "").trim();
753250
+ return t2 ? `· ${truncateSubAgentViewText(t2, 420)}` : null;
752965
753251
  }
752966
753252
  case "trajectory_checkpoint": {
752967
753253
  const assessment = event.trajectory?.assessment ?? "updated";
@@ -755522,12 +755808,14 @@ ${entry.fullContent}`
755522
755808
  break;
755523
755809
  }
755524
755810
  const statusContent = event.content ?? "";
755811
+ const compactStatusLines = summarizeInternalControlOutput(statusContent);
755812
+ const compactStatusContent = compactStatusLines?.length ? compactStatusLines.join("\n") : statusContent;
755525
755813
  const gpuWaitingStatus = /^Waiting for free GPU\.{3,}$/.test(
755526
- statusContent
755814
+ compactStatusContent
755527
755815
  );
755528
- const gpuResumeStatus = statusContent === "GPU Free, Resuming";
755816
+ const gpuResumeStatus = compactStatusContent === "GPU Free, Resuming";
755529
755817
  if (gpuWaitingStatus) {
755530
- const dotCount = statusContent.match(/\.+$/)?.[0]?.length ?? 3;
755818
+ const dotCount = compactStatusContent.match(/\.+$/)?.[0]?.length ?? 3;
755531
755819
  if (startGpuRecoveryBlock(dotCount)) break;
755532
755820
  } else if (gpuResumeStatus && finishGpuRecoveryBlock()) {
755533
755821
  break;
@@ -755536,13 +755824,13 @@ ${entry.fullContent}`
755536
755824
  if (!config.debug && !gpuRecoveryStatus) break;
755537
755825
  if (isNeovimActive()) {
755538
755826
  writeToNeovimOutput(
755539
- `\x1B[38;5;250m${event.content ?? ""}\x1B[0m\r
755827
+ `\x1B[38;5;250m${compactStatusContent}\x1B[0m\r
755540
755828
  `
755541
755829
  );
755542
755830
  } else {
755543
- contentWrite(() => renderInfo(event.content ?? ""));
755544
- if (event.content && event.content.startsWith("Provenance saved: ")) {
755545
- lastProvenancePath = event.content.slice("Provenance saved: ".length).trim();
755831
+ contentWrite(() => renderInfo(compactStatusContent));
755832
+ if (statusContent && statusContent.startsWith("Provenance saved: ")) {
755833
+ lastProvenancePath = statusContent.slice("Provenance saved: ".length).trim();
755546
755834
  }
755547
755835
  }
755548
755836
  break;
@@ -763044,7 +763332,8 @@ async function runJson(task, config, repoPath2) {
763044
763332
  try {
763045
763333
  await runWithTUI(task, config, repoPath2, {
763046
763334
  onAssistantText: (text2) => {
763047
- assistantTexts.push(text2);
763335
+ const sanitized = sanitizeAgentOutputForUser(text2);
763336
+ if (sanitized) assistantTexts.push(sanitized);
763048
763337
  },
763049
763338
  onToolCall: (tool, args) => {
763050
763339
  toolCallLog.push({ tool, args });
@@ -763099,12 +763388,14 @@ async function runJson(task, config, repoPath2) {
763099
763388
  process.stdout.write = origWrite;
763100
763389
  process.stderr.write = origStderr;
763101
763390
  const allCaptured = captured.join("");
763102
- const cleanText2 = allCaptured.replace(/\x1B\[[0-9;]*[A-Za-z]/g, "").replace(/\x1B\].*?\x07/g, "").replace(/\x1B[78]/g, "").replace(/\x1B\[\?[0-9;]*[hl]/g, "");
763391
+ const cleanText2 = sanitizeAgentOutputForUser(allCaptured);
763103
763392
  result.text = cleanText2;
763104
763393
  if (assistantTexts.length > 0) {
763105
- const streamText = assistantTexts[0] || "";
763394
+ const streamText = sanitizeAgentOutputForUser(assistantTexts[0] || "");
763106
763395
  const hasSubstantiveStream = streamText.length > 30;
763107
- result.assistant_text = hasSubstantiveStream ? streamText : assistantTexts[assistantTexts.length - 1];
763396
+ result.assistant_text = hasSubstantiveStream ? streamText : sanitizeAgentOutputForUser(
763397
+ assistantTexts[assistantTexts.length - 1] || ""
763398
+ );
763108
763399
  }
763109
763400
  if (toolCallLog.length > 0) {
763110
763401
  result.tool_calls = toolCallLog;
@@ -763239,6 +763530,7 @@ var init_run = __esm({
763239
763530
  init_dist8();
763240
763531
  init_typed_node_events();
763241
763532
  init_secret_redactor();
763533
+ init_internal_output();
763242
763534
  }
763243
763535
  });
763244
763536
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.547",
3
+ "version": "1.0.549",
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.549",
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.549",
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",