omnius 1.0.661 → 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;
700826
+ }
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;
700745
700874
  }
700746
- this.mode = "suppress";
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>";
@@ -783379,7 +783574,7 @@ function renderTelegramSubAgentError(username, error) {
783379
783574
  `${c3.red("✘")} ${c3.bold(`@${username}`)}: ${c3.dim(linkifyTerminalReferences(preview))}`
783380
783575
  );
783381
783576
  }
783382
- var TELEGRAM_TOOL_ACTION_GROUPS, TELEGRAM_TOOL_ACTION_GROUP, TELEGRAM_TOOL_MUTATING_GROUPS, DEFAULT_TELEGRAM_TOOL_GROUP_POLICY, TELEGRAM_TOOL_BUTTON_LABELS, TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, TELEGRAM_PUBLIC_SOUL_PROFILE, TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT, TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT, TELEGRAM_PUBLIC_VISION_STACK_CONTRACT, TELEGRAM_EVIDENCE_SUFFICIENCY_CONTRACT, GROUP_REPLY_AUTHORIZATION_PROMPT, TELEGRAM_CHAT_STE_COMMUNICATION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_EXTERNAL_ACQUISITION_CONTRACT, TELEGRAM_LINK_INTEGRITY_CONTRACT, TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT, TELEGRAM_GENERIC_JSON_RESPONSE_FORMAT, TELEGRAM_MODERATION_APPROVAL_RESPONSE_FORMAT, TELEGRAM_MODERATION_APPROVAL_TTL_MS, TELEGRAM_MODERATION_APPROVAL_RETENTION_MS, TELEGRAM_MODERATION_APPROVAL_MAX_RECORDS, TELEGRAM_INTERACTION_DECISION_MINIMAL_SCHEMA, TELEGRAM_CHAT_REPLY_RESPONSE_FORMAT, TelegramEmptyInferenceStreamError, TELEGRAM_SPACED_URL_RE, TELEGRAM_HTTP_URL_RE, TELEGRAM_RUNNER_CONTROL_OPEN_MARKERS, TELEGRAM_RUNNER_CONTROL_CLOSE_MARKERS, TELEGRAM_STUCK_SELF_TALK_PREFIXES, TELEGRAM_CHAT_HISTORY_LIMIT, TELEGRAM_CONTEXT_RECENT_DEFAULT, TELEGRAM_CONTEXT_LINE_LIMIT, TELEGRAM_CONTEXT_SAMPLE_LIMIT, TELEGRAM_MEMORY_CARD_LIMIT, TELEGRAM_MEMORY_NOTE_LIMIT, TELEGRAM_ASSOCIATIVE_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_USER_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_ACTION_LIMIT, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT, TELEGRAM_MEMORY_STOPWORDS, TELEGRAM_MEMORY_GENERIC_QUERY_TOKENS, TELEGRAM_SUB_AGENT_BOUNDED_OPTIONS, TELEGRAM_PUBLIC_FAST_OPTIONS, TELEGRAM_ADMIN_EVIDENCE_OPTIONS, TELEGRAM_SUB_AGENT_DEFAULT_LIMIT, TELEGRAM_SUB_AGENT_MAX_LIMIT, TELEGRAM_SUB_AGENT_BURST_CONTEXT_LIMIT, TELEGRAM_ADMIN_LIVE_PANEL_PAGES, TELEGRAM_ADMIN_LIVE_MUTATION_TOOLS, TELEGRAM_PUBLIC_HELP_COMMANDS2, TELEGRAM_REMINDER_SLASH_COMMANDS, TELEGRAM_REFLECTION_SLASH_COMMANDS, TELEGRAM_PUBLIC_BOT_COMMAND_NAMES, TELEGRAM_IMAGE_EXTENSIONS, MEDIA_CACHE_TTL_MS, TELEGRAM_ACQUIRED_MEDIA_BASENAME_RE, TELEGRAM_CHANNEL_DMN_SWEEP_MS, TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS, TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS, TELEGRAM_CHANNEL_DMN_MIN_MESSAGES, TELEGRAM_ALLOWED_UPDATES, TELEGRAM_DEFAULT_LONG_POLL_TIMEOUT_SECONDS, TelegramStartupError, TELEGRAM_PUBLIC_TOOL_QUOTAS, TelegramBridge;
783577
+ var TELEGRAM_TOOL_ACTION_GROUPS, TELEGRAM_TOOL_ACTION_GROUP, TELEGRAM_TOOL_MUTATING_GROUPS, DEFAULT_TELEGRAM_TOOL_GROUP_POLICY, TELEGRAM_TOOL_BUTTON_LABELS, TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, TELEGRAM_PUBLIC_SOUL_PROFILE, TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT, TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT, TELEGRAM_PUBLIC_VISION_STACK_CONTRACT, TELEGRAM_EVIDENCE_SUFFICIENCY_CONTRACT, GROUP_REPLY_AUTHORIZATION_PROMPT, TELEGRAM_CHAT_STE_COMMUNICATION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_EXTERNAL_ACQUISITION_CONTRACT, TELEGRAM_LINK_INTEGRITY_CONTRACT, TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT, TELEGRAM_GENERIC_JSON_RESPONSE_FORMAT, TELEGRAM_MODERATION_APPROVAL_RESPONSE_FORMAT, TELEGRAM_MODERATION_APPROVAL_TTL_MS, TELEGRAM_MODERATION_APPROVAL_RETENTION_MS, TELEGRAM_MODERATION_APPROVAL_MAX_RECORDS, TELEGRAM_INTERACTION_DECISION_MINIMAL_SCHEMA, TELEGRAM_CHAT_REPLY_RESPONSE_FORMAT, TelegramEmptyInferenceStreamError, TelegramBridgeStoppedError, TELEGRAM_SPACED_URL_RE, TELEGRAM_HTTP_URL_RE, TELEGRAM_RUNNER_CONTROL_OPEN_MARKERS, TELEGRAM_RUNNER_CONTROL_CLOSE_MARKERS, TELEGRAM_STUCK_SELF_TALK_PREFIXES, TELEGRAM_CHAT_HISTORY_LIMIT, TELEGRAM_CONTEXT_RECENT_DEFAULT, TELEGRAM_CONTEXT_LINE_LIMIT, TELEGRAM_CONTEXT_SAMPLE_LIMIT, TELEGRAM_MEMORY_CARD_LIMIT, TELEGRAM_MEMORY_NOTE_LIMIT, TELEGRAM_ASSOCIATIVE_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_USER_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_ACTION_LIMIT, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT, TELEGRAM_MEMORY_STOPWORDS, TELEGRAM_MEMORY_GENERIC_QUERY_TOKENS, TELEGRAM_SUB_AGENT_BOUNDED_OPTIONS, TELEGRAM_PUBLIC_FAST_OPTIONS, TELEGRAM_ADMIN_EVIDENCE_OPTIONS, TELEGRAM_SUB_AGENT_DEFAULT_LIMIT, TELEGRAM_SUB_AGENT_MAX_LIMIT, TELEGRAM_SUB_AGENT_BURST_CONTEXT_LIMIT, TELEGRAM_ADMIN_LIVE_PANEL_PAGES, TELEGRAM_ADMIN_LIVE_MUTATION_TOOLS, TELEGRAM_PUBLIC_HELP_COMMANDS2, TELEGRAM_REMINDER_SLASH_COMMANDS, TELEGRAM_REFLECTION_SLASH_COMMANDS, TELEGRAM_PUBLIC_BOT_COMMAND_NAMES, TELEGRAM_IMAGE_EXTENSIONS, MEDIA_CACHE_TTL_MS, TELEGRAM_ACQUIRED_MEDIA_BASENAME_RE, TELEGRAM_CHANNEL_DMN_SWEEP_MS, TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS, TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS, TELEGRAM_CHANNEL_DMN_MIN_MESSAGES, TELEGRAM_ALLOWED_UPDATES, TELEGRAM_DEFAULT_LONG_POLL_TIMEOUT_SECONDS, TelegramStartupError, TELEGRAM_PUBLIC_TOOL_QUOTAS, TelegramBridge;
783383
783578
  var init_telegram_bridge = __esm({
783384
783579
  "packages/cli/src/tui/telegram-bridge.ts"() {
783385
783580
  init_conversation_context();
@@ -783872,6 +784067,12 @@ Telegram link integrity contract:
783872
784067
  this.name = "TelegramEmptyInferenceStreamError";
783873
784068
  }
783874
784069
  };
784070
+ TelegramBridgeStoppedError = class extends Error {
784071
+ constructor(message2 = "Telegram bridge stopped during inference") {
784072
+ super(message2);
784073
+ this.name = "TelegramBridgeStoppedError";
784074
+ }
784075
+ };
783875
784076
  TELEGRAM_SPACED_URL_RE = /\bhttps?:\/\/\s*[A-Za-z0-9-]+(?:\s*\.\s*[A-Za-z0-9-]+)+(?:\s*:\s*\d+)?(?:[/?#][^\s<>"'()[\]{}]*)?/gi;
783876
784077
  TELEGRAM_HTTP_URL_RE = /\bhttps?:\/\/[^\s<>"'()[\]{}]+/gi;
783877
784078
  TELEGRAM_RUNNER_CONTROL_OPEN_MARKERS = [
@@ -790850,6 +791051,7 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
790850
791051
  });
790851
791052
  } catch (err) {
790852
791053
  jsonModeError = err;
791054
+ if (err instanceof TelegramBridgeStoppedError) throw err;
790853
791055
  if (err instanceof TelegramEmptyInferenceStreamError) {
790854
791056
  if (diagnostics) diagnostics.jsonModeStatus = "empty-after-strip";
790855
791057
  recordAttempt({
@@ -790921,6 +791123,7 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
790921
791123
  }
790922
791124
  return plainResult;
790923
791125
  } catch (err) {
791126
+ if (err instanceof TelegramBridgeStoppedError) throw err;
790924
791127
  if (err instanceof TelegramEmptyInferenceStreamError) {
790925
791128
  if (diagnostics) diagnostics.plainStatus = "empty-after-strip";
790926
791129
  recordAttempt({
@@ -790955,8 +791158,7 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
790955
791158
  // operator can SEE what's happening during a long-running router or
790956
791159
  // chat-fast-path call instead of waiting for a router hard-deadline.
790957
791160
  // ─────────────────────────────────────────────────────────────────
790958
- async waitForTelegramBrokerQueueRetry(delayMs) {
790959
- const signal = this.abortController?.signal;
791161
+ async waitForTelegramBrokerQueueRetry(delayMs, signal = this.abortController?.signal) {
790960
791162
  if (!signal) {
790961
791163
  await new Promise((resolve92) => setTimeout(resolve92, delayMs));
790962
791164
  return;
@@ -790995,6 +791197,15 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
790995
791197
  * hard-deadline retire path becomes diagnosable instead of opaque
790996
791198
  */
790997
791199
  async telegramObservableInference(backend, request, kind, sessionKey, options2 = {}) {
791200
+ const lifecycleSignal = this.abortController?.signal;
791201
+ if (lifecycleSignal) {
791202
+ backend.setAbortSignal?.(lifecycleSignal);
791203
+ }
791204
+ const throwIfBridgeRequestStopped = () => {
791205
+ if (!lifecycleSignal?.aborted) return;
791206
+ throw lifecycleSignal.reason instanceof Error ? lifecycleSignal.reason : new TelegramBridgeStoppedError();
791207
+ };
791208
+ throwIfBridgeRequestStopped();
790998
791209
  const model = options2.modelName ?? this.agentConfig?.model ?? "?";
790999
791210
  const promptTokens = estimatePromptTokensFromRequest(request);
791000
791211
  const broker = getModelBroker();
@@ -791037,7 +791248,8 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
791037
791248
  owner: `telegram-bridge/${kind}`,
791038
791249
  sessionKey,
791039
791250
  promptTokens,
791040
- priority: kind === "router" || kind === "router-strict-retry" ? 1 : 0
791251
+ priority: kind === "router" || kind === "router-strict-retry" ? 1 : 0,
791252
+ signal: lifecycleSignal
791041
791253
  });
791042
791254
  this.telegramInferenceBlocks?.handling(
791043
791255
  id2,
@@ -791071,6 +791283,7 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
791071
791283
  const streamAllowed = options2.stream !== false;
791072
791284
  let brokerQueueRetryAttempt = 0;
791073
791285
  for (; ; ) {
791286
+ throwIfBridgeRequestStopped();
791074
791287
  try {
791075
791288
  if (!streamAllowed) {
791076
791289
  result = await backend.chatCompletion(requestWithCtx);
@@ -791112,8 +791325,10 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
791112
791325
  );
791113
791326
  }
791114
791327
  }
791328
+ throwIfBridgeRequestStopped();
791115
791329
  break;
791116
791330
  } catch (attemptErr) {
791331
+ throwIfBridgeRequestStopped();
791117
791332
  const deadline = brokerQueueDeadlineResponse(attemptErr);
791118
791333
  if (!deadline || slot !== null) throw attemptErr;
791119
791334
  brokerQueueRetryAttempt++;
@@ -791130,7 +791345,10 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
791130
791345
  id2,
791131
791346
  `broker queue admission deadline expired for ${deadline.request_id}${queueSummary ? ` (${queueSummary})` : ""}; re-entering after ${(delayMs / 1e3).toFixed(1)}s, attempt ${brokerQueueRetryAttempt}`
791132
791347
  );
791133
- await this.waitForTelegramBrokerQueueRetry(delayMs);
791348
+ await this.waitForTelegramBrokerQueueRetry(
791349
+ delayMs,
791350
+ lifecycleSignal
791351
+ );
791134
791352
  }
791135
791353
  }
791136
791354
  const usage = result.usage;
@@ -791691,6 +791909,7 @@ ${retryText}`,
791691
791909
  mentalNote: validated.mentalNote
791692
791910
  };
791693
791911
  } catch (err) {
791912
+ if (err instanceof TelegramBridgeStoppedError) throw err;
791694
791913
  if (diagnostics) {
791695
791914
  diagnostics.strictRetryStatus = "threw";
791696
791915
  diagnostics.strictRetryError = telegramRouterErrorText(err);
@@ -792322,6 +792541,7 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
792322
792541
  );
792323
792542
  return withRouterTelemetry(fallback);
792324
792543
  } catch (err) {
792544
+ if (err instanceof TelegramBridgeStoppedError) throw err;
792325
792545
  const failureNarrative = this.summarizeTelegramRouterFailure(diagnostics);
792326
792546
  const errMsg = telegramRouterErrorText(err);
792327
792547
  const fallback = this.applyTelegramSilentReflectionNotes(
@@ -793034,8 +793254,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
793034
793254
  stop() {
793035
793255
  this.polling = false;
793036
793256
  this.state.active = false;
793037
- this.abortController?.abort();
793038
- this.abortController = null;
793257
+ this.abortController?.abort(new TelegramBridgeStoppedError());
793039
793258
  this.telegramApiGovernor.stop("Telegram bridge stopped");
793040
793259
  if (this.mediaCacheCleanupTimer) {
793041
793260
  clearInterval(this.mediaCacheCleanupTimer);
@@ -793559,6 +793778,9 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
793559
793778
  }
793560
793779
  updateTelegramAdminLivePanelFromEvent(subAgent, msg, event) {
793561
793780
  const state5 = this.ensureTelegramAdminLivePanel(subAgent, msg);
793781
+ state5.steeringReconciliations = [
793782
+ ...subAgent.steeringReconciliations.values()
793783
+ ];
793562
793784
  applyTelegramAdminLivePanelEvent(state5, event);
793563
793785
  if (event.contextFrame || state5.contextPages.length === 0 && (subAgent.contextFrame || subAgent.promptSnapshot)) {
793564
793786
  this.refreshTelegramAdminLivePanelContextPages(state5, subAgent, msg);
@@ -793582,6 +793804,9 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
793582
793804
  async finalizeTelegramAdminLivePanel(subAgent, msg, replyText, status = "completed", evidenceText = "") {
793583
793805
  const state5 = this.ensureTelegramAdminLivePanel(subAgent, msg);
793584
793806
  state5.status = status;
793807
+ state5.steeringReconciliations = [
793808
+ ...subAgent.steeringReconciliations.values()
793809
+ ];
793585
793810
  state5.responseText = replyText || (status === "failed" ? "I couldn't complete that request." : "Done.");
793586
793811
  if (evidenceText.trim()) {
793587
793812
  state5.evidenceText = evidenceText.trim();
@@ -794592,7 +794817,8 @@ Join: ${newUrl}`
794592
794817
  validatedMediaArtifacts: /* @__PURE__ */ new Set(),
794593
794818
  deliveredArtifacts: [],
794594
794819
  deliveredFileSends: /* @__PURE__ */ new Set(),
794595
- surfacedToolCallFingerprints: /* @__PURE__ */ new Set()
794820
+ surfacedToolCallFingerprints: /* @__PURE__ */ new Set(),
794821
+ steeringReconciliations: /* @__PURE__ */ new Map()
794596
794822
  };
794597
794823
  this.subAgents.set(sessionKey, subAgent);
794598
794824
  for (const intake of work.intakeRecords) {
@@ -794779,7 +795005,10 @@ Join: ${newUrl}`
794779
795005
  }
794780
795006
  const deliveredFinalText = finalText;
794781
795007
  const adminEvidenceText = isAdminDM ? this.telegramAdminCompletionRunText(subAgent, finalText) : "";
794782
- const finalHtml = convertMarkdownToTelegramHTML(deliveredFinalText);
795008
+ const finalHtml = composeTelegramReplyWithSteeringHTML(
795009
+ deliveredFinalText,
795010
+ [...subAgent.steeringReconciliations.values()]
795011
+ );
794783
795012
  const contextExplorerState = !isAdminDM && msg.chatType !== "private" && !msg.guestQueryId ? this.buildTelegramContextExplorerState(
794784
795013
  msg,
794785
795014
  subAgent,
@@ -794943,7 +795172,8 @@ ${errMsg}`
794943
795172
  validatedMediaArtifacts: /* @__PURE__ */ new Set(),
794944
795173
  deliveredArtifacts: [],
794945
795174
  deliveredFileSends: /* @__PURE__ */ new Set(),
794946
- surfacedToolCallFingerprints: /* @__PURE__ */ new Set()
795175
+ surfacedToolCallFingerprints: /* @__PURE__ */ new Set(),
795176
+ steeringReconciliations: /* @__PURE__ */ new Map()
794947
795177
  };
794948
795178
  this.subAgents.set(sessionKey, subAgent);
794949
795179
  const primaryIntake = this.telegramIntakeRecords.get(
@@ -795100,7 +795330,10 @@ ${errMsg}`
795100
795330
  subAgent,
795101
795331
  deliveredFinalText
795102
795332
  );
795103
- const finalHtml = convertMarkdownToTelegramHTML(deliveredFinalText);
795333
+ const finalHtml = composeTelegramReplyWithSteeringHTML(
795334
+ deliveredFinalText,
795335
+ [...subAgent.steeringReconciliations.values()]
795336
+ );
795104
795337
  const sentMessageId = !msg.guestQueryId ? await this.finalizeTelegramAdminLivePanel(
795105
795338
  subAgent,
795106
795339
  msg,
@@ -795657,6 +795890,20 @@ ${creativeWorkspace}` : ""
795657
795890
  // ── WO #03 (Typed Gateway Event Stream): structured event feed ──
795658
795891
  onTypedEvent: (event) => {
795659
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
+ }
795660
795907
  if (event.type === "run_finished") {
795661
795908
  subAgent.runnerCompleted = event.success;
795662
795909
  subAgent.runnerStatus = event.status;
@@ -795720,13 +795967,12 @@ ${creativeWorkspace}` : ""
795720
795967
  );
795721
795968
  }
795722
795969
  runner.registerTools(tools);
795723
- const telegramSteeringFilter = new SteeringReconciliationStreamFilter({
795724
- suppressTrailingContent: true
795725
- });
795970
+ const telegramSteeringFilter = new SteeringReconciliationStreamFilter();
795726
795971
  runner.onEvent((event) => {
795727
795972
  if (subAgent.aborted) return;
795728
795973
  subAgent.lastActivityMs = Date.now();
795729
795974
  let suppressExternalEvent = false;
795975
+ let telegramDisplayEvent = event;
795730
795976
  if (event.contextFrame) {
795731
795977
  subAgent.contextFrame = event.contextFrame;
795732
795978
  }
@@ -795798,6 +796044,7 @@ ${creativeWorkspace}` : ""
795798
796044
  }
795799
796045
  } else if (event.type === "assistant_text" && event.content && event.source !== "task_complete_summary") {
795800
796046
  subAgent.assistantText = cleanTelegramVisibleReply(event.content);
796047
+ telegramDisplayEvent = subAgent.assistantText ? { ...event, content: subAgent.assistantText } : null;
795801
796048
  } else if (event.type === "stream_start") {
795802
796049
  this.retainTelegramVisibleReplyFromCompletedStream(subAgent);
795803
796050
  subAgent.accumulated = "";
@@ -795808,9 +796055,12 @@ ${creativeWorkspace}` : ""
795808
796055
  const finalBuffered = telegramSteeringFilter.flush();
795809
796056
  if (finalBuffered) subAgent.accumulated += finalBuffered;
795810
796057
  subAgent.streamText = cleanTelegramVisibleReply(event.content);
796058
+ telegramDisplayEvent = subAgent.streamText ? { ...event, content: subAgent.streamText } : null;
795811
796059
  }
795812
796060
  if (event.type === "stream_token" && event.streamKind === "content" && event.content) {
795813
- subAgent.accumulated += telegramSteeringFilter.consume(event.content);
796061
+ const visibleChunk = telegramSteeringFilter.consume(event.content);
796062
+ subAgent.accumulated += visibleChunk;
796063
+ telegramDisplayEvent = visibleChunk ? { ...event, content: visibleChunk } : null;
795814
796064
  }
795815
796065
  if (event.type === "stream_token" && event.streamKind === "thinking" && event.content && this.telegramThinkingVisible) {
795816
796066
  const trimmed = event.content.replace(/\s+/g, " ").slice(0, 200);
@@ -795825,12 +796075,19 @@ ${creativeWorkspace}` : ""
795825
796075
  }
795826
796076
  if (!msg.guestQueryId) {
795827
796077
  if (isAdminDM) {
795828
- this.updateTelegramAdminLivePanelFromEvent(subAgent, msg, event);
796078
+ if (telegramDisplayEvent) {
796079
+ this.updateTelegramAdminLivePanelFromEvent(
796080
+ subAgent,
796081
+ msg,
796082
+ telegramDisplayEvent
796083
+ );
796084
+ }
795829
796085
  return;
795830
796086
  }
795831
796087
  const html = renderTelegramLiveProgressHTML(
795832
796088
  subAgent.intermediateLines,
795833
- subAgent.visibleReplyText || subAgent.accumulated
796089
+ subAgent.visibleReplyText || subAgent.accumulated,
796090
+ [...subAgent.steeringReconciliations.values()]
795834
796091
  );
795835
796092
  if (!html.trim()) return;
795836
796093
  const now2 = Date.now();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.661",
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.661",
9
+ "version": "1.0.663",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
@@ -4333,9 +4333,9 @@
4333
4333
  "license": "BSD-3-Clause"
4334
4334
  },
4335
4335
  "node_modules/ignore": {
4336
- "version": "7.0.6",
4337
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz",
4338
- "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==",
4336
+ "version": "7.0.7",
4337
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.7.tgz",
4338
+ "integrity": "sha512-dML0wP6oak21rsNYCJpJB6O1BJIEwNpGrTw0URPfAk4hm0e3pRfCtzkfB6olBcXcVlU2rouCyz7lCyRB0OMVCA==",
4339
4339
  "license": "MIT",
4340
4340
  "engines": {
4341
4341
  "node": ">= 4"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.661",
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",
@@ -16,7 +16,7 @@ Use these rules for an analysis task:
16
16
  For sustained OSINT research, use `osint_search` to get a small candidate set.
17
17
  Use `osint_show` to inspect one selected record.
18
18
  Then, select `web_fetch`, `web_crawl`, or `playwright_browser`.
19
- Treat catalog health as routing data, not source evidence.
19
+ Treat catalog health as archived routing metadata. Do not use it as source evidence.
20
20
  Record the source, retrieval time, and confirmation evidence.
21
21
 
22
22
  Use `web_search` for external research that is not in the OSINT catalog.
@@ -9,4 +9,4 @@ Use these rules for a general task:
9
9
  - Use search tools for research.
10
10
  - Use the shell tool for commands.
11
11
  - Produce clear, complete, and organized output.
12
- - Verify each result before you report completion.
12
+ - Verify results before you report completion.