omnius 1.0.662 → 1.0.663

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
@@ -663599,6 +663599,7 @@ ${notice}`;
663599
663599
  }
663600
663600
  _emitSteeringLifecycle(record, reason) {
663601
663601
  const receipt2 = this._steeringReceipt(record);
663602
+ const reconciliation = record.state === "reconciled" && this._activeSteering?.input.inputId === record.inputId ? this._activeSteering.reconciliation : void 0;
663602
663603
  this.emit({
663603
663604
  type: "status",
663604
663605
  content: `Steering ${record.inputId} ${record.state}: ${reason}`,
@@ -663613,6 +663614,7 @@ ${notice}`;
663613
663614
  state: record.state,
663614
663615
  taskEpoch: record.taskEpoch,
663615
663616
  summary: reason,
663617
+ ...reconciliation ? { reconciliation: { ...reconciliation } } : {},
663616
663618
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
663617
663619
  });
663618
663620
  appendSteeringLedgerEntry(this._workingDirectory || process.cwd(), {
@@ -663969,43 +663971,55 @@ ${notice}`;
663969
663971
  const active = this._activeSteering;
663970
663972
  if (!active || !active.requiresReconciliation || !content)
663971
663973
  return false;
663972
- const tagged = content.match(/\[STEERING_RECONCILIATION\]([\s\S]*?)(?:\[\/STEERING_RECONCILIATION\]|$)/i);
663973
- if (!tagged)
663974
- return false;
663975
- const candidate = this._firstJsonObject(tagged[1] ?? "");
663976
- if (!candidate)
663974
+ const marker = /\[STEERING_RECONCILIATION(?:\]|(?=[\s{]))/gi;
663975
+ const matches = [...content.matchAll(marker)];
663976
+ let selected = null;
663977
+ for (let index = 0; index < matches.length; index++) {
663978
+ const current = matches[index];
663979
+ const start2 = (current.index ?? 0) + current[0].length;
663980
+ const end = matches[index + 1]?.index ?? content.length;
663981
+ const candidate = this._firstJsonObject(content.slice(start2, end));
663982
+ if (!candidate)
663983
+ continue;
663984
+ try {
663985
+ const parsed = JSON.parse(candidate);
663986
+ const status = parsed["status"];
663987
+ const inputId = parsed["inputId"];
663988
+ if (inputId !== active.input.inputId || status !== "applied" && status !== "not_applicable" && status !== "needs_clarification") {
663989
+ continue;
663990
+ }
663991
+ const changedConstraints = Array.isArray(parsed["changedConstraints"]) ? parsed["changedConstraints"].filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean).slice(0, 12) : [];
663992
+ const revisedNextAction = typeof parsed["revisedNextAction"] === "string" ? parsed["revisedNextAction"].trim().slice(0, 1e3) : "";
663993
+ if (!revisedNextAction)
663994
+ continue;
663995
+ selected = {
663996
+ inputId: active.input.inputId,
663997
+ status,
663998
+ changedConstraints,
663999
+ revisedNextAction
664000
+ };
664001
+ } catch {
664002
+ continue;
664003
+ }
664004
+ }
664005
+ if (!selected)
663977
664006
  return false;
663978
664007
  try {
663979
- const parsed = JSON.parse(candidate);
663980
- const status = parsed["status"];
663981
- const inputId = parsed["inputId"];
663982
- if (inputId !== active.input.inputId || status !== "applied" && status !== "not_applicable" && status !== "needs_clarification") {
663983
- return false;
663984
- }
663985
- const changedConstraints = Array.isArray(parsed["changedConstraints"]) ? parsed["changedConstraints"].filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean).slice(0, 12) : [];
663986
- const revisedNextAction = typeof parsed["revisedNextAction"] === "string" ? parsed["revisedNextAction"].trim().slice(0, 1e3) : "";
663987
- if (!revisedNextAction)
663988
- return false;
663989
- active.reconciliation = {
663990
- inputId: active.input.inputId,
663991
- status,
663992
- changedConstraints,
663993
- revisedNextAction
663994
- };
664008
+ active.reconciliation = selected;
663995
664009
  active.reconciledTurn = turn;
663996
- active.requiresReconciliation = status === "needs_clarification";
663997
- active.gatesOldPlan = status === "needs_clarification";
663998
- this._taskState.nextAction = revisedNextAction;
663999
- if (changedConstraints.length > 0) {
664010
+ active.requiresReconciliation = selected.status === "needs_clarification";
664011
+ active.gatesOldPlan = selected.status === "needs_clarification";
664012
+ this._taskState.nextAction = selected.revisedNextAction;
664013
+ if (selected.changedConstraints.length > 0) {
664000
664014
  this._taskState.steeringConstraints = [
664001
664015
  .../* @__PURE__ */ new Set([
664002
664016
  ...this._taskState.steeringConstraints ?? [],
664003
- ...changedConstraints
664017
+ ...selected.changedConstraints
664004
664018
  ])
664005
664019
  ].slice(-20);
664006
664020
  }
664007
664021
  active.input.state = "reconciled";
664008
- this._emitSteeringLifecycle(active.input, `reconciled by model at turn ${turn}: ${status}`);
664022
+ this._emitSteeringLifecycle(active.input, `reconciled by model at turn ${turn}: ${selected.status}`);
664009
664023
  return true;
664010
664024
  } catch {
664011
664025
  return false;
@@ -700714,50 +700728,181 @@ var init_conversation_context = __esm({
700714
700728
  });
700715
700729
 
700716
700730
  // packages/cli/src/tui/steering-stream-filter.ts
700717
- var OPEN_MARKER, CLOSE_MARKER, SteeringReconciliationStreamFilter;
700731
+ function firstBalancedJsonObject(text3) {
700732
+ const start2 = text3.indexOf("{");
700733
+ if (start2 < 0) return null;
700734
+ let depth = 0;
700735
+ let quoted = false;
700736
+ let escaped = false;
700737
+ for (let index = start2; index < text3.length; index++) {
700738
+ const char = text3[index];
700739
+ if (quoted) {
700740
+ if (escaped) escaped = false;
700741
+ else if (char === "\\") escaped = true;
700742
+ else if (char === '"') quoted = false;
700743
+ continue;
700744
+ }
700745
+ if (char === '"') quoted = true;
700746
+ else if (char === "{") depth++;
700747
+ else if (char === "}") {
700748
+ depth--;
700749
+ if (depth === 0) return { start: start2, end: index + 1 };
700750
+ }
700751
+ }
700752
+ return null;
700753
+ }
700754
+ function parseReconciliation(jsonText) {
700755
+ try {
700756
+ const parsed = JSON.parse(jsonText);
700757
+ const status = parsed["status"];
700758
+ if (status !== "applied" && status !== "not_applicable" && status !== "needs_clarification") {
700759
+ return null;
700760
+ }
700761
+ const revisedNextAction = typeof parsed["revisedNextAction"] === "string" ? parsed["revisedNextAction"].trim().slice(0, 2e3) : "";
700762
+ if (!revisedNextAction) return null;
700763
+ const inputId = typeof parsed["inputId"] === "string" ? parsed["inputId"].trim().slice(0, 500) : "";
700764
+ const changedConstraints = Array.isArray(parsed["changedConstraints"]) ? parsed["changedConstraints"].filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean).slice(0, 24) : [];
700765
+ return {
700766
+ ...inputId ? { inputId } : {},
700767
+ status,
700768
+ changedConstraints,
700769
+ revisedNextAction
700770
+ };
700771
+ } catch {
700772
+ return null;
700773
+ }
700774
+ }
700775
+ function suffixMatchingMarkerPrefix(text3, marker) {
700776
+ const upper = text3.toUpperCase();
700777
+ for (let length4 = Math.min(upper.length, marker.length - 1); length4 > 0; length4--) {
700778
+ if (marker.startsWith(upper.slice(-length4))) return length4;
700779
+ }
700780
+ return 0;
700781
+ }
700782
+ function stripSteeringReconciliationEnvelopes(text3, onReconciliation) {
700783
+ if (!text3) return "";
700784
+ const filter2 = new SteeringReconciliationStreamFilter({ onReconciliation });
700785
+ return `${filter2.consume(text3)}${filter2.flush()}`;
700786
+ }
700787
+ var OPEN_STEM, CLOSE_STEM, SteeringReconciliationStreamFilter;
700718
700788
  var init_steering_stream_filter = __esm({
700719
700789
  "packages/cli/src/tui/steering-stream-filter.ts"() {
700720
- OPEN_MARKER = "[STEERING_RECONCILIATION]";
700721
- CLOSE_MARKER = "[/STEERING_RECONCILIATION]";
700790
+ OPEN_STEM = "[STEERING_RECONCILIATION";
700791
+ CLOSE_STEM = "[/STEERING_RECONCILIATION";
700722
700792
  SteeringReconciliationStreamFilter = class {
700723
700793
  constructor(options2 = {}) {
700724
700794
  this.options = options2;
700725
700795
  }
700726
700796
  options;
700727
- mode = "detect";
700797
+ mode = "scan";
700728
700798
  buffer = "";
700799
+ hasVisibleContent = false;
700800
+ separatorAfterEnvelope = false;
700729
700801
  reset() {
700730
- this.mode = "detect";
700802
+ this.mode = "scan";
700731
700803
  this.buffer = "";
700804
+ this.hasVisibleContent = false;
700805
+ this.separatorAfterEnvelope = false;
700732
700806
  }
700733
700807
  consume(chunk) {
700734
- if (!chunk) return "";
700735
- if (this.mode === "show") return chunk;
700736
- this.buffer += chunk;
700737
- if (this.mode === "detect") {
700738
- const leading = this.buffer.trimStart();
700739
- if (OPEN_MARKER.startsWith(leading)) return "";
700740
- if (!leading.startsWith(OPEN_MARKER)) {
700741
- const visible2 = this.buffer;
700808
+ if (chunk) this.buffer += chunk;
700809
+ return this.drain(false);
700810
+ }
700811
+ drain(final2) {
700812
+ let visible = "";
700813
+ const appendVisible = (text3) => {
700814
+ if (!text3) return;
700815
+ if (this.separatorAfterEnvelope) {
700816
+ if (!/^\s/.test(text3)) visible += " ";
700817
+ this.separatorAfterEnvelope = false;
700818
+ }
700819
+ visible += text3;
700820
+ if (text3.trim()) this.hasVisibleContent = true;
700821
+ };
700822
+ while (this.buffer) {
700823
+ if (this.mode === "discard") {
700742
700824
  this.buffer = "";
700743
- this.mode = "show";
700744
- return visible2;
700825
+ break;
700745
700826
  }
700746
- this.mode = "suppress";
700827
+ if (this.mode === "scan") {
700828
+ const upper2 = this.buffer.toUpperCase();
700829
+ let openAt = -1;
700830
+ let pendingOpenAt = -1;
700831
+ let searchAt = 0;
700832
+ while (searchAt < upper2.length) {
700833
+ const candidateAt = upper2.indexOf(OPEN_STEM, searchAt);
700834
+ if (candidateAt < 0) break;
700835
+ const after = upper2[candidateAt + OPEN_STEM.length];
700836
+ if (after === void 0 && !final2) {
700837
+ pendingOpenAt = candidateAt;
700838
+ break;
700839
+ }
700840
+ if (after === void 0 || after === "]" || after === "{" || /\s/.test(after)) {
700841
+ openAt = candidateAt;
700842
+ break;
700843
+ }
700844
+ searchAt = candidateAt + OPEN_STEM.length;
700845
+ }
700846
+ if (openAt >= 0) {
700847
+ const prefix = this.buffer.slice(0, openAt);
700848
+ if (prefix.trim()) appendVisible(prefix);
700849
+ this.separatorAfterEnvelope = this.hasVisibleContent;
700850
+ this.buffer = this.buffer.slice(openAt + OPEN_STEM.length);
700851
+ if (this.buffer.startsWith("]")) this.buffer = this.buffer.slice(1);
700852
+ this.mode = "capture";
700853
+ continue;
700854
+ }
700855
+ if (pendingOpenAt >= 0) {
700856
+ const prefix = this.buffer.slice(0, pendingOpenAt);
700857
+ if (prefix.trim()) appendVisible(prefix);
700858
+ this.separatorAfterEnvelope = this.hasVisibleContent;
700859
+ this.buffer = this.buffer.slice(pendingOpenAt);
700860
+ break;
700861
+ }
700862
+ const retained = final2 ? 0 : suffixMatchingMarkerPrefix(this.buffer, OPEN_STEM);
700863
+ if (retained > 0) {
700864
+ const prefix = this.buffer.slice(0, -retained);
700865
+ if (prefix.trim()) appendVisible(prefix);
700866
+ this.buffer = this.buffer.slice(-retained);
700867
+ } else {
700868
+ if (!(final2 && OPEN_STEM.startsWith(upper2))) {
700869
+ appendVisible(this.buffer);
700870
+ }
700871
+ this.buffer = "";
700872
+ }
700873
+ break;
700874
+ }
700875
+ if (this.mode === "capture") {
700876
+ const span = firstBalancedJsonObject(this.buffer);
700877
+ if (!span) {
700878
+ if (final2) this.buffer = "";
700879
+ break;
700880
+ }
700881
+ const parsed = parseReconciliation(
700882
+ this.buffer.slice(span.start, span.end)
700883
+ );
700884
+ if (parsed) this.options.onReconciliation?.(parsed);
700885
+ this.buffer = this.buffer.slice(span.end);
700886
+ this.mode = "after-json";
700887
+ continue;
700888
+ }
700889
+ const whitespace = this.buffer.match(/^\s*/)?.[0].length ?? 0;
700890
+ if (whitespace > 0) this.buffer = this.buffer.slice(whitespace);
700891
+ if (!this.buffer) break;
700892
+ const upper = this.buffer.toUpperCase();
700893
+ if (upper.startsWith(CLOSE_STEM)) {
700894
+ this.buffer = this.buffer.slice(CLOSE_STEM.length);
700895
+ if (this.buffer.startsWith("]")) this.buffer = this.buffer.slice(1);
700896
+ this.mode = this.options.suppressTrailingContent ? "discard" : "scan";
700897
+ continue;
700898
+ }
700899
+ if (!final2 && CLOSE_STEM.startsWith(upper)) break;
700900
+ this.mode = this.options.suppressTrailingContent ? "discard" : "scan";
700747
700901
  }
700748
- const closeAt = this.buffer.indexOf(CLOSE_MARKER);
700749
- if (closeAt < 0) return "";
700750
- const visible = this.options.suppressTrailingContent ? "" : this.buffer.slice(closeAt + CLOSE_MARKER.length);
700751
- this.buffer = "";
700752
- this.mode = this.options.suppressTrailingContent ? "suppress" : "show";
700753
700902
  return visible;
700754
700903
  }
700755
700904
  flush() {
700756
- if (this.mode === "suppress") {
700757
- this.reset();
700758
- return "";
700759
- }
700760
- const visible = this.buffer;
700905
+ const visible = this.drain(true);
700761
700906
  this.reset();
700762
700907
  return visible;
700763
700908
  }
@@ -781653,6 +781798,47 @@ function convertMarkdownToTelegramHTML(md) {
781653
781798
  function escapeTelegramHTML(text3) {
781654
781799
  return text3.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
781655
781800
  }
781801
+ function upsertTelegramSteeringReconciliation(target, value2) {
781802
+ const key = value2.inputId.trim();
781803
+ if (!key) return;
781804
+ target.delete(key);
781805
+ target.set(key, {
781806
+ inputId: key.slice(0, 500),
781807
+ status: value2.status,
781808
+ changedConstraints: value2.changedConstraints.map((item) => item.trim()).filter(Boolean).slice(0, 12),
781809
+ revisedNextAction: value2.revisedNextAction.trim().slice(0, 1e3)
781810
+ });
781811
+ while (target.size > 12) {
781812
+ const oldest = target.keys().next().value;
781813
+ if (!oldest) break;
781814
+ target.delete(oldest);
781815
+ }
781816
+ }
781817
+ function formatTelegramSteeringReconciliationHTML(values) {
781818
+ if (values.length === 0) return "";
781819
+ const sections = values.slice(-4).map((value2) => {
781820
+ const status = value2.status.replaceAll("_", " ");
781821
+ const constraints = value2.changedConstraints.length ? [
781822
+ "Changes:",
781823
+ ...value2.changedConstraints.map((item) => `• ${item}`)
781824
+ ] : ["Changes: none"];
781825
+ return [
781826
+ `Status: ${status}`,
781827
+ ...constraints,
781828
+ `Next: ${value2.revisedNextAction}`
781829
+ ].join("\n");
781830
+ });
781831
+ return [
781832
+ "<b>Plan update</b>",
781833
+ `<blockquote expandable>${escapeTelegramHTML(sections.join("\n\n"))}</blockquote>`
781834
+ ].join("\n");
781835
+ }
781836
+ function composeTelegramReplyWithSteeringHTML(replyText, reconciliations) {
781837
+ return [
781838
+ formatTelegramSteeringReconciliationHTML(reconciliations),
781839
+ replyText.trim() ? convertMarkdownToTelegramHTML(replyText) : ""
781840
+ ].filter(Boolean).join("\n\n");
781841
+ }
781656
781842
  function normalizeTelegramOutboundLinks(text3) {
781657
781843
  if (!text3) return text3;
781658
781844
  return text3.replace(
@@ -781763,7 +781949,7 @@ function isTelegramNoReplySentinel(text3) {
781763
781949
  }
781764
781950
  function telegramTextHasRunnerControlMarker(text3) {
781765
781951
  const upper = text3.toUpperCase();
781766
- return TELEGRAM_RUNNER_CONTROL_OPEN_MARKERS.some(
781952
+ return /\[\/?STEERING_RECONCILIATION(?:\]|(?=[\s{\[]))/i.test(text3) || TELEGRAM_RUNNER_CONTROL_OPEN_MARKERS.some(
781767
781953
  (marker) => upper.includes(marker)
781768
781954
  ) || TELEGRAM_RUNNER_CONTROL_CLOSE_MARKERS.some(
781769
781955
  (marker) => upper.includes(marker)
@@ -781771,35 +781957,32 @@ function telegramTextHasRunnerControlMarker(text3) {
781771
781957
  }
781772
781958
  function sanitizeTelegramModelFacingContext(text3) {
781773
781959
  if (!text3) return "";
781960
+ const structurallySanitized = stripSteeringReconciliationEnvelopes(text3);
781774
781961
  const kept = [];
781775
781962
  let insideControlEnvelope = false;
781776
- let quarantineTrailingRationale = false;
781777
- for (const line of text3.split(/\r?\n/)) {
781963
+ let oneLineControlRemainder = 0;
781964
+ for (const line of structurallySanitized.split(/\r?\n/)) {
781778
781965
  const upper = line.toUpperCase();
781779
- const hasOpen = TELEGRAM_RUNNER_CONTROL_OPEN_MARKERS.some(
781780
- (marker) => upper.includes(marker)
781781
- );
781782
- const hasClose = TELEGRAM_RUNNER_CONTROL_CLOSE_MARKERS.some(
781783
- (marker) => upper.includes(marker)
781784
- );
781785
- if (insideControlEnvelope) {
781786
- if (hasClose) {
781787
- insideControlEnvelope = false;
781788
- quarantineTrailingRationale = true;
781789
- }
781966
+ if (oneLineControlRemainder > 0) {
781967
+ oneLineControlRemainder--;
781790
781968
  continue;
781791
781969
  }
781792
- if (quarantineTrailingRationale) {
781793
- if (/^#{2,3}\s+/.test(line.trim())) {
781794
- quarantineTrailingRationale = false;
781795
- } else {
781796
- continue;
781797
- }
781970
+ const hasOpen = upper.includes("[ACTIVE USER STEERING]");
781971
+ const hasClose = upper.includes("[/ACTIVE USER STEERING]");
781972
+ if (insideControlEnvelope) {
781973
+ if (hasClose) insideControlEnvelope = false;
781974
+ continue;
781798
781975
  }
781799
781976
  if (hasOpen) {
781800
781977
  if (!hasClose) insideControlEnvelope = true;
781801
781978
  continue;
781802
781979
  }
781980
+ if (/\[(?:STEERING_RECONCILIATION_REQUIRED|STEERING_REPLAN_TURN_REQUIRED|STEERING_CLARIFICATION_REQUIRED)\]/i.test(
781981
+ line
781982
+ )) {
781983
+ oneLineControlRemainder = 2;
781984
+ continue;
781985
+ }
781803
781986
  if (/["']revisedNextAction["']\s*:/i.test(line) && /["'](?:inputId|status|changedConstraints)["']\s*:/i.test(line)) {
781804
781987
  continue;
781805
781988
  }
@@ -781839,6 +782022,7 @@ function isTelegramInternalStatusText(text3) {
781839
782022
  ))
781840
782023
  return true;
781841
782024
  if (/^no further action needed\b/i.test(compact6)) return true;
782025
+ if (/^no visible reply (?:is|was) warranted\.?$/i.test(compact6)) return true;
781842
782026
  if (/^no action needed\b.{0,120}\b(task|complete|completed|done)\b/i.test(
781843
782027
  compact6
781844
782028
  ))
@@ -781880,7 +782064,7 @@ function stripTelegramStuckSelfTalk(text3) {
781880
782064
  }
781881
782065
  function cleanTelegramVisibleReply(text3, options2 = {}) {
781882
782066
  const clean7 = normalizeTelegramOutboundLinks(
781883
- stripTelegramHiddenThinking(text3)
782067
+ stripSteeringReconciliationEnvelopes(stripTelegramHiddenThinking(text3))
781884
782068
  ).trim();
781885
782069
  if (!clean7) return "";
781886
782070
  if (options2.suppressPotentialNoReplyPrefix && isTelegramPotentialNoReplyPrefix(clean7))
@@ -782190,15 +782374,19 @@ function formatTelegramProgressEvent(event) {
782190
782374
  }
782191
782375
  return null;
782192
782376
  }
782193
- function renderTelegramLiveProgressHTML(progressLines, accumulated) {
782377
+ function renderTelegramLiveProgressHTML(progressLines, accumulated, steeringReconciliations = []) {
782378
+ const steeringHtml = formatTelegramSteeringReconciliationHTML(
782379
+ steeringReconciliations
782380
+ );
782194
782381
  const draft = cleanTelegramVisibleReply(accumulated, {
782195
782382
  suppressPotentialNoReplyPrefix: true
782196
782383
  });
782197
782384
  if (draft) {
782198
782385
  const clipped = draft.length > 2e3 ? `${draft.slice(0, 1997).trimEnd()}...` : draft;
782199
- return convertMarkdownToTelegramHTML(clipped);
782386
+ return [steeringHtml, convertMarkdownToTelegramHTML(clipped)].filter(Boolean).join("\n\n");
782200
782387
  }
782201
- return progressLines.slice(-6).map((line) => line.trim()).filter((line) => !isTelegramInternalStatusText(line)).filter(Boolean).join("\n");
782388
+ const progress = progressLines.slice(-6).map((line) => line.trim()).filter((line) => !isTelegramInternalStatusText(line)).filter(Boolean).join("\n");
782389
+ return [steeringHtml, progress].filter(Boolean).join("\n\n");
782202
782390
  }
782203
782391
  function telegramAdminLivePanelPageLabel(page2) {
782204
782392
  if (page2 === "response") return "Reply";
@@ -782272,6 +782460,7 @@ function createTelegramAdminLivePanelState(args) {
782272
782460
  requestPreview,
782273
782461
  intakeText: telegramAdminLivePanelIntakeText(requestPreview),
782274
782462
  responseText: "",
782463
+ steeringReconciliations: [],
782275
782464
  evidenceText: "",
782276
782465
  toolLines: [],
782277
782466
  mutationLines: [],
@@ -782350,7 +782539,13 @@ function renderTelegramAdminLivePanelPayload(state5) {
782350
782539
  if (state5.activePage === "response") {
782351
782540
  const response = state5.responseText.trim();
782352
782541
  const clipped = response.length > 2600 ? `${response.slice(0, 2597).trimEnd()}...` : response;
782353
- body = clipped ? convertMarkdownToTelegramHTML(clipped) : "<i>Working…</i>";
782542
+ const steeringHtml = formatTelegramSteeringReconciliationHTML(
782543
+ state5.steeringReconciliations
782544
+ );
782545
+ body = [
782546
+ steeringHtml,
782547
+ clipped ? convertMarkdownToTelegramHTML(clipped) : "<i>Working…</i>"
782548
+ ].filter(Boolean).join("\n\n");
782354
782549
  } else if (state5.activePage === "tools") {
782355
782550
  const lines = state5.toolLines.slice(-12);
782356
782551
  body = lines.length > 0 ? `<blockquote>${escapeTelegramHTML(lines.join("\n"))}</blockquote>` : "<i>No tool calls yet.</i>";
@@ -793583,6 +793778,9 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
793583
793778
  }
793584
793779
  updateTelegramAdminLivePanelFromEvent(subAgent, msg, event) {
793585
793780
  const state5 = this.ensureTelegramAdminLivePanel(subAgent, msg);
793781
+ state5.steeringReconciliations = [
793782
+ ...subAgent.steeringReconciliations.values()
793783
+ ];
793586
793784
  applyTelegramAdminLivePanelEvent(state5, event);
793587
793785
  if (event.contextFrame || state5.contextPages.length === 0 && (subAgent.contextFrame || subAgent.promptSnapshot)) {
793588
793786
  this.refreshTelegramAdminLivePanelContextPages(state5, subAgent, msg);
@@ -793606,6 +793804,9 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
793606
793804
  async finalizeTelegramAdminLivePanel(subAgent, msg, replyText, status = "completed", evidenceText = "") {
793607
793805
  const state5 = this.ensureTelegramAdminLivePanel(subAgent, msg);
793608
793806
  state5.status = status;
793807
+ state5.steeringReconciliations = [
793808
+ ...subAgent.steeringReconciliations.values()
793809
+ ];
793609
793810
  state5.responseText = replyText || (status === "failed" ? "I couldn't complete that request." : "Done.");
793610
793811
  if (evidenceText.trim()) {
793611
793812
  state5.evidenceText = evidenceText.trim();
@@ -794616,7 +794817,8 @@ Join: ${newUrl}`
794616
794817
  validatedMediaArtifacts: /* @__PURE__ */ new Set(),
794617
794818
  deliveredArtifacts: [],
794618
794819
  deliveredFileSends: /* @__PURE__ */ new Set(),
794619
- surfacedToolCallFingerprints: /* @__PURE__ */ new Set()
794820
+ surfacedToolCallFingerprints: /* @__PURE__ */ new Set(),
794821
+ steeringReconciliations: /* @__PURE__ */ new Map()
794620
794822
  };
794621
794823
  this.subAgents.set(sessionKey, subAgent);
794622
794824
  for (const intake of work.intakeRecords) {
@@ -794803,7 +795005,10 @@ Join: ${newUrl}`
794803
795005
  }
794804
795006
  const deliveredFinalText = finalText;
794805
795007
  const adminEvidenceText = isAdminDM ? this.telegramAdminCompletionRunText(subAgent, finalText) : "";
794806
- const finalHtml = convertMarkdownToTelegramHTML(deliveredFinalText);
795008
+ const finalHtml = composeTelegramReplyWithSteeringHTML(
795009
+ deliveredFinalText,
795010
+ [...subAgent.steeringReconciliations.values()]
795011
+ );
794807
795012
  const contextExplorerState = !isAdminDM && msg.chatType !== "private" && !msg.guestQueryId ? this.buildTelegramContextExplorerState(
794808
795013
  msg,
794809
795014
  subAgent,
@@ -794967,7 +795172,8 @@ ${errMsg}`
794967
795172
  validatedMediaArtifacts: /* @__PURE__ */ new Set(),
794968
795173
  deliveredArtifacts: [],
794969
795174
  deliveredFileSends: /* @__PURE__ */ new Set(),
794970
- surfacedToolCallFingerprints: /* @__PURE__ */ new Set()
795175
+ surfacedToolCallFingerprints: /* @__PURE__ */ new Set(),
795176
+ steeringReconciliations: /* @__PURE__ */ new Map()
794971
795177
  };
794972
795178
  this.subAgents.set(sessionKey, subAgent);
794973
795179
  const primaryIntake = this.telegramIntakeRecords.get(
@@ -795124,7 +795330,10 @@ ${errMsg}`
795124
795330
  subAgent,
795125
795331
  deliveredFinalText
795126
795332
  );
795127
- const finalHtml = convertMarkdownToTelegramHTML(deliveredFinalText);
795333
+ const finalHtml = composeTelegramReplyWithSteeringHTML(
795334
+ deliveredFinalText,
795335
+ [...subAgent.steeringReconciliations.values()]
795336
+ );
795128
795337
  const sentMessageId = !msg.guestQueryId ? await this.finalizeTelegramAdminLivePanel(
795129
795338
  subAgent,
795130
795339
  msg,
@@ -795681,6 +795890,20 @@ ${creativeWorkspace}` : ""
795681
795890
  // ── WO #03 (Typed Gateway Event Stream): structured event feed ──
795682
795891
  onTypedEvent: (event) => {
795683
795892
  this.forwardTelegramRunnerIntakeLifecycle(event);
795893
+ if (event.type === "steering_lifecycle" && event.reconciliation) {
795894
+ upsertTelegramSteeringReconciliation(
795895
+ subAgent.steeringReconciliations,
795896
+ event.reconciliation
795897
+ );
795898
+ if (isAdminDM) {
795899
+ const state5 = this.ensureTelegramAdminLivePanel(subAgent, msg);
795900
+ state5.steeringReconciliations = [
795901
+ ...subAgent.steeringReconciliations.values()
795902
+ ];
795903
+ if (state5.activePage !== "response")
795904
+ state5.dirtyPages.response = true;
795905
+ }
795906
+ }
795684
795907
  if (event.type === "run_finished") {
795685
795908
  subAgent.runnerCompleted = event.success;
795686
795909
  subAgent.runnerStatus = event.status;
@@ -795744,13 +795967,12 @@ ${creativeWorkspace}` : ""
795744
795967
  );
795745
795968
  }
795746
795969
  runner.registerTools(tools);
795747
- const telegramSteeringFilter = new SteeringReconciliationStreamFilter({
795748
- suppressTrailingContent: true
795749
- });
795970
+ const telegramSteeringFilter = new SteeringReconciliationStreamFilter();
795750
795971
  runner.onEvent((event) => {
795751
795972
  if (subAgent.aborted) return;
795752
795973
  subAgent.lastActivityMs = Date.now();
795753
795974
  let suppressExternalEvent = false;
795975
+ let telegramDisplayEvent = event;
795754
795976
  if (event.contextFrame) {
795755
795977
  subAgent.contextFrame = event.contextFrame;
795756
795978
  }
@@ -795822,6 +796044,7 @@ ${creativeWorkspace}` : ""
795822
796044
  }
795823
796045
  } else if (event.type === "assistant_text" && event.content && event.source !== "task_complete_summary") {
795824
796046
  subAgent.assistantText = cleanTelegramVisibleReply(event.content);
796047
+ telegramDisplayEvent = subAgent.assistantText ? { ...event, content: subAgent.assistantText } : null;
795825
796048
  } else if (event.type === "stream_start") {
795826
796049
  this.retainTelegramVisibleReplyFromCompletedStream(subAgent);
795827
796050
  subAgent.accumulated = "";
@@ -795832,9 +796055,12 @@ ${creativeWorkspace}` : ""
795832
796055
  const finalBuffered = telegramSteeringFilter.flush();
795833
796056
  if (finalBuffered) subAgent.accumulated += finalBuffered;
795834
796057
  subAgent.streamText = cleanTelegramVisibleReply(event.content);
796058
+ telegramDisplayEvent = subAgent.streamText ? { ...event, content: subAgent.streamText } : null;
795835
796059
  }
795836
796060
  if (event.type === "stream_token" && event.streamKind === "content" && event.content) {
795837
- subAgent.accumulated += telegramSteeringFilter.consume(event.content);
796061
+ const visibleChunk = telegramSteeringFilter.consume(event.content);
796062
+ subAgent.accumulated += visibleChunk;
796063
+ telegramDisplayEvent = visibleChunk ? { ...event, content: visibleChunk } : null;
795838
796064
  }
795839
796065
  if (event.type === "stream_token" && event.streamKind === "thinking" && event.content && this.telegramThinkingVisible) {
795840
796066
  const trimmed = event.content.replace(/\s+/g, " ").slice(0, 200);
@@ -795849,12 +796075,19 @@ ${creativeWorkspace}` : ""
795849
796075
  }
795850
796076
  if (!msg.guestQueryId) {
795851
796077
  if (isAdminDM) {
795852
- this.updateTelegramAdminLivePanelFromEvent(subAgent, msg, event);
796078
+ if (telegramDisplayEvent) {
796079
+ this.updateTelegramAdminLivePanelFromEvent(
796080
+ subAgent,
796081
+ msg,
796082
+ telegramDisplayEvent
796083
+ );
796084
+ }
795853
796085
  return;
795854
796086
  }
795855
796087
  const html = renderTelegramLiveProgressHTML(
795856
796088
  subAgent.intermediateLines,
795857
- subAgent.visibleReplyText || subAgent.accumulated
796089
+ subAgent.visibleReplyText || subAgent.accumulated,
796090
+ [...subAgent.steeringReconciliations.values()]
795858
796091
  );
795859
796092
  if (!html.trim()) return;
795860
796093
  const now2 = Date.now();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.662",
3
+ "version": "1.0.663",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.662",
9
+ "version": "1.0.663",
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.662",
3
+ "version": "1.0.663",
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/library.js",