omnius 1.0.548 → 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
@@ -633689,6 +633689,237 @@ var init_tool_collapse_store = __esm({
633689
633689
  }
633690
633690
  });
633691
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
+
633692
633923
  // packages/cli/src/tui/render.ts
633693
633924
  var render_exports = {};
633694
633925
  __export(render_exports, {
@@ -634399,186 +634630,6 @@ function sanitizeToolBoxContent(text2) {
634399
634630
  }
634400
634631
  return out;
634401
634632
  }
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
- }
634582
634633
  function stripTrustTierWrapperForTui(text2, maxWrapperChars = 400) {
634583
634634
  const trustWrapper = new RegExp(
634584
634635
  `^\\[trust_tier:[^\\]\\n]{0,${Math.max(0, maxWrapperChars)}}\\][ \\t]*(?:\\n)?`,
@@ -635832,6 +635883,7 @@ var init_render = __esm({
635832
635883
  init_model_picker();
635833
635884
  init_secret_redactor();
635834
635885
  init_tool_collapse_store();
635886
+ init_internal_output();
635835
635887
  c3 = {
635836
635888
  bold: (t2) => ansi2("1", t2),
635837
635889
  dim: (t2) => stdoutIsTTY() ? `${dimFg()}${t2}\x1B[0m` : t2,
@@ -645111,11 +645163,11 @@ function truncate4(s2, max) {
645111
645163
  if (s2.length <= max) return s2.padEnd(max, " ");
645112
645164
  return s2.slice(0, Math.max(0, max - 1)) + "…";
645113
645165
  }
645114
- function stripAnsi2(s2) {
645166
+ function stripAnsi3(s2) {
645115
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, "");
645116
645168
  }
645117
645169
  function visualLen(s2) {
645118
- return stripAnsi2(s2).length;
645170
+ return stripAnsi3(s2).length;
645119
645171
  }
645120
645172
  function buildTodoProgressBar(todos, maxWidth) {
645121
645173
  if (maxWidth <= 0 || todos.length === 0) return "";
@@ -653031,7 +653083,7 @@ function ansi3(code8, text2) {
653031
653083
  function fg2563(code8, text2) {
653032
653084
  return isTTY3 ? `\x1B[38;5;${code8}m${text2}\x1B[0m` : text2;
653033
653085
  }
653034
- function stripAnsi3(s2) {
653086
+ function stripAnsi4(s2) {
653035
653087
  return s2.replace(/\x1B\[[0-9;]*m/g, "");
653036
653088
  }
653037
653089
  function stripTerminalControl(s2) {
@@ -653047,15 +653099,15 @@ function renderNonInteractiveSelect(opts, currentTitle, skipSet) {
653047
653099
  const surface = nonInteractiveSelectSurface.getStore();
653048
653100
  const maxItems = Math.max(1, surface?.maxItems ?? 30);
653049
653101
  const lines = [];
653050
- if (currentTitle) lines.push(stripTerminalControl(stripAnsi3(currentTitle)));
653102
+ if (currentTitle) lines.push(stripTerminalControl(stripAnsi4(currentTitle)));
653051
653103
  if (lines.length) lines.push("");
653052
653104
  let idx = 1;
653053
653105
  let shown = 0;
653054
653106
  let omitted = 0;
653055
653107
  for (const item of opts.items) {
653056
653108
  const isSkip = skipSet.has(item.key);
653057
- const labelPlain = stripTerminalControl(stripAnsi3(item.label)).trim();
653058
- 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() : "";
653059
653111
  if (isSkip) {
653060
653112
  if (labelPlain) lines.push(labelPlain);
653061
653113
  continue;
@@ -653072,7 +653124,7 @@ function renderNonInteractiveSelect(opts, currentTitle, skipSet) {
653072
653124
  idx++;
653073
653125
  }
653074
653126
  if (omitted > 0) lines.push(` ... ${omitted} more`);
653075
- if (opts.customKeyHint) lines.push("", stripTerminalControl(stripAnsi3(opts.customKeyHint)));
653127
+ if (opts.customKeyHint) lines.push("", stripTerminalControl(stripAnsi4(opts.customKeyHint)));
653076
653128
  lines.push("", surface?.hint ?? "(non-interactive: menu shown as text; open the TUI for selection)");
653077
653129
  process.stdout.write(lines.join("\n").trimEnd() + "\n");
653078
653130
  }
@@ -653087,8 +653139,8 @@ function matchRow(item, focused, isActive) {
653087
653139
  return defaultRenderRow(item, focused, isActive);
653088
653140
  }
653089
653141
  const marker = selectColors.matchLight("○");
653090
- const label = selectColors.matchLight(stripAnsi3(item.label));
653091
- 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))}` : "";
653092
653144
  return ` ${marker} ${label}${detail}`;
653093
653145
  }
653094
653146
  function tuiSelect(opts) {
@@ -653117,8 +653169,8 @@ function tuiSelect(opts) {
653117
653169
  matchSet = /* @__PURE__ */ new Set();
653118
653170
  for (let i2 = 0; i2 < items.length; i2++) {
653119
653171
  if (isSkippable(i2)) continue;
653120
- const plain = stripAnsi3(items[i2].label).toLowerCase();
653121
- 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() : "";
653122
653174
  if (plain.includes(lower) || detailPlain.includes(lower)) {
653123
653175
  matchSet.add(i2);
653124
653176
  }
@@ -653243,7 +653295,7 @@ function tuiSelect(opts) {
653243
653295
  if (deleteConfirmIdx === idx) {
653244
653296
  const yesLabel = deleteConfirmSel ? selectColors.bold(selectColors.green("[Yes]")) : selectColors.dim("[Yes]");
653245
653297
  const noLabel = !deleteConfirmSel ? selectColors.bold(selectColors.blue("[No]")) : selectColors.dim("[No]");
653246
- 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}`);
653247
653299
  } else if (filter2) {
653248
653300
  lines.push(matchRow(item, focused, isActive));
653249
653301
  } else {
@@ -659229,11 +659281,11 @@ import { extname as extname18, resolve as resolve66 } from "node:path";
659229
659281
  function ansi4(code8, text2) {
659230
659282
  return isTTY4 ? `\x1B[${code8}m${text2}\x1B[0m` : text2;
659231
659283
  }
659232
- function stripAnsi4(s2) {
659284
+ function stripAnsi5(s2) {
659233
659285
  return s2.replace(/\x1B\[[0-9;]*m/g, "");
659234
659286
  }
659235
659287
  function fitToWidth(text2, width) {
659236
- const visible = stripAnsi4(text2);
659288
+ const visible = stripAnsi5(text2);
659237
659289
  if (visible.length >= width) {
659238
659290
  let visCount = 0;
659239
659291
  let i2 = 0;
@@ -687168,11 +687220,11 @@ function normalizeRoot(root) {
687168
687220
  return root;
687169
687221
  }
687170
687222
  }
687171
- function stripAnsi5(text2) {
687223
+ function stripAnsi6(text2) {
687172
687224
  return String(text2 || "").replace(/\u001b\[[0-9;]*[a-zA-Z]/g, "");
687173
687225
  }
687174
687226
  function cleanSessionDisplayLine(line) {
687175
- 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();
687176
687228
  }
687177
687229
  function isNoisySessionDisplayLine(line) {
687178
687230
  const clean5 = cleanSessionDisplayLine(line || "");
@@ -687180,12 +687232,12 @@ function isNoisySessionDisplayLine(line) {
687180
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);
687181
687233
  }
687182
687234
  function bestSessionDisplayLine(text2) {
687183
- const lines = stripAnsi5(text2).split(/\r?\n/);
687235
+ const lines = stripAnsi6(text2).split(/\r?\n/);
687184
687236
  for (const line of lines) {
687185
687237
  const clean5 = cleanSessionDisplayLine(line);
687186
687238
  if (!isNoisySessionDisplayLine(clean5)) return clean5;
687187
687239
  }
687188
- const fallback = stripAnsi5(text2).replace(/\s+/g, " ").trim();
687240
+ const fallback = stripAnsi6(text2).replace(/\s+/g, " ").trim();
687189
687241
  return isNoisySessionDisplayLine(fallback) ? "" : fallback;
687190
687242
  }
687191
687243
  function makeTitle(text2) {
@@ -687386,7 +687438,7 @@ function getSession2(sessionId, model, cwd4) {
687386
687438
  function importTranscriptSession(opts) {
687387
687439
  const projectRoot = normalizeRoot(opts.projectRoot) ?? process.cwd();
687388
687440
  const id2 = opts.id;
687389
- const transcript = opts.transcriptLines.map(stripAnsi5).join("\n").trim();
687441
+ const transcript = opts.transcriptLines.map(stripAnsi6).join("\n").trim();
687390
687442
  const metadataSource = [opts.title, opts.description, transcript].filter(Boolean).join("\n");
687391
687443
  const title = makeTitle(metadataSource || id2);
687392
687444
  const preview = makePreview([opts.description, transcript].filter(Boolean).join("\n") || title);
@@ -720501,7 +720553,7 @@ var command_passthrough_exports = {};
720501
720553
  __export(command_passthrough_exports, {
720502
720554
  runCommand: () => runCommand
720503
720555
  });
720504
- function stripAnsi6(s2) {
720556
+ function stripAnsi7(s2) {
720505
720557
  return s2.replace(/\x1B(?:\[[\d;?]*[a-zA-Z]|\][^\x07\x1B]*[\x07\x1B]?|[@-Z\\-_])/g, "");
720506
720558
  }
720507
720559
  async function runCommand(input, opts) {
@@ -720566,7 +720618,7 @@ async function runCommand(input, opts) {
720566
720618
  command: cmdName,
720567
720619
  args: argsStr,
720568
720620
  kind,
720569
- output: stripAnsi6(ansi5).trim(),
720621
+ output: stripAnsi7(ansi5).trim(),
720570
720622
  ansi: ansi5,
720571
720623
  durationMs: Date.now() - start2,
720572
720624
  error: errMsg
@@ -742122,23 +742174,7 @@ async function writeMemoryEpisodes(sessionId, userMessage, assistantContent, too
742122
742174
  }
742123
742175
  }
742124
742176
  function sanitizeChatContent(raw) {
742125
- if (typeof raw !== "string") return "";
742126
- const lines = raw.split("\n");
742127
- const cleaned = [];
742128
- for (const rawLine of lines) {
742129
- const line = rawLine.replace(/\x1B\[[0-9;]*[A-Za-z]/g, "").replace(/\x1B\].*?\x07/g, "").trim();
742130
- if (!line) continue;
742131
- if (/^i\s+/.test(line)) continue;
742132
- if (/^E\s+/.test(line)) continue;
742133
- if (/^⚠\s*(Task incomplete|Task complete)/.test(line)) continue;
742134
- if (/^▹\s/.test(line)) continue;
742135
- if (/^User:\s/.test(line)) continue;
742136
- if (/^Assistant:\s/.test(line)) continue;
742137
- if (/^Previous conversation:/.test(line)) continue;
742138
- if (/^omnius \(/.test(line)) continue;
742139
- cleaned.push(line);
742140
- }
742141
- return cleaned.join("\n").trim();
742177
+ return sanitizeAgentOutputForUser(raw);
742142
742178
  }
742143
742179
  function appendNoThinkDirectivesToMessages(messages2) {
742144
742180
  let lastUserIdx = -1;
@@ -751894,6 +751930,7 @@ var init_serve = __esm({
751894
751930
  init_access_policy();
751895
751931
  init_projects();
751896
751932
  init_project_preferences();
751933
+ init_internal_output();
751897
751934
  init_voice_runtime();
751898
751935
  init_voice();
751899
751936
  init_audit_log();
@@ -763295,7 +763332,8 @@ async function runJson(task, config, repoPath2) {
763295
763332
  try {
763296
763333
  await runWithTUI(task, config, repoPath2, {
763297
763334
  onAssistantText: (text2) => {
763298
- assistantTexts.push(text2);
763335
+ const sanitized = sanitizeAgentOutputForUser(text2);
763336
+ if (sanitized) assistantTexts.push(sanitized);
763299
763337
  },
763300
763338
  onToolCall: (tool, args) => {
763301
763339
  toolCallLog.push({ tool, args });
@@ -763350,12 +763388,14 @@ async function runJson(task, config, repoPath2) {
763350
763388
  process.stdout.write = origWrite;
763351
763389
  process.stderr.write = origStderr;
763352
763390
  const allCaptured = captured.join("");
763353
- 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);
763354
763392
  result.text = cleanText2;
763355
763393
  if (assistantTexts.length > 0) {
763356
- const streamText = assistantTexts[0] || "";
763394
+ const streamText = sanitizeAgentOutputForUser(assistantTexts[0] || "");
763357
763395
  const hasSubstantiveStream = streamText.length > 30;
763358
- result.assistant_text = hasSubstantiveStream ? streamText : assistantTexts[assistantTexts.length - 1];
763396
+ result.assistant_text = hasSubstantiveStream ? streamText : sanitizeAgentOutputForUser(
763397
+ assistantTexts[assistantTexts.length - 1] || ""
763398
+ );
763359
763399
  }
763360
763400
  if (toolCallLog.length > 0) {
763361
763401
  result.tool_calls = toolCallLog;
@@ -763490,6 +763530,7 @@ var init_run = __esm({
763490
763530
  init_dist8();
763491
763531
  init_typed_node_events();
763492
763532
  init_secret_redactor();
763533
+ init_internal_output();
763493
763534
  }
763494
763535
  });
763495
763536
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.548",
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.548",
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.548",
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",