omnius 1.0.184 → 1.0.186

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
@@ -574031,6 +574031,8 @@ var init_command_registry = __esm({
574031
574031
  ["/telegram", "Toggle Telegram bridge on/off (uses saved key)"],
574032
574032
  ["/telegram status", "Show Telegram bridge status"],
574033
574033
  ["/telegram stop", "Disconnect Telegram bridge"],
574034
+ ["/telegram disable", "Persistently disable Telegram long polling"],
574035
+ ["/telegram enable", "Re-enable Telegram long polling"],
574034
574036
  ["/telegram mode auto|chat|action", "Set Telegram interaction routing: auto, fast chat, or action sub-agent"],
574035
574037
  ["/telegram subagents <1-5>", "Set global Telegram work-slot limit across all chats/groups"],
574036
574038
  ["/telegram auth", "Show a TUI-only one-time code for Telegram admin authentication"],
@@ -609279,6 +609281,27 @@ sleep 1
609279
609281
  }
609280
609282
  return "handled";
609281
609283
  }
609284
+ if (parts[0] === "disable" || parts[0] === "disabled") {
609285
+ const hasGlobalFlagDisable = parts.includes("--global");
609286
+ const projectRootDisable = ctx3.repoRoot || process.cwd();
609287
+ const projectHasOmniusDisable = existsSync110(join122(projectRootDisable, ".omnius"));
609288
+ const wantsLocalDisable = hasGlobalFlagDisable ? false : isLocal || projectHasOmniusDisable;
609289
+ if (ctx3.isTelegramActive?.()) ctx3.telegramStop?.();
609290
+ ctx3.saveTelegramSettings?.({ enabled: false, local: wantsLocalDisable });
609291
+ renderInfo(`Telegram polling disabled${wantsLocalDisable ? " (project)" : " (global)"}.`);
609292
+ renderInfo("Use /telegram enable to allow polling again.");
609293
+ return "handled";
609294
+ }
609295
+ if (parts[0] === "enable" || parts[0] === "enabled") {
609296
+ const hasGlobalFlagEnable = parts.includes("--global");
609297
+ const projectRootEnable = ctx3.repoRoot || process.cwd();
609298
+ const projectHasOmniusEnable = existsSync110(join122(projectRootEnable, ".omnius"));
609299
+ const wantsLocalEnable = hasGlobalFlagEnable ? false : isLocal || projectHasOmniusEnable;
609300
+ ctx3.saveTelegramSettings?.({ enabled: true, local: wantsLocalEnable });
609301
+ renderInfo(`Telegram polling enabled${wantsLocalEnable ? " (project)" : " (global)"}.`);
609302
+ renderInfo("Use /telegram to start the bridge.");
609303
+ return "handled";
609304
+ }
609282
609305
  if (parts[0] === "status") {
609283
609306
  ctx3.telegramStatus?.();
609284
609307
  return "handled";
@@ -609633,8 +609656,9 @@ sleep 1
609633
609656
  "No .omnius/ in the current directory; this 'local' setting was written to ./.omnius/settings.json and only applies when omnius is invoked from this folder."
609634
609657
  );
609635
609658
  }
609659
+ const savedTelegramState = ctx3.getTelegramSettings?.(wantsLocal ? "project" : "global");
609636
609660
  if (!ctx3.isTelegramActive?.() && settings.key)
609637
- renderInfo("Use /telegram to start.");
609661
+ renderInfo(savedTelegramState?.enabled === false ? "Telegram polling is disabled; use /telegram enable before starting." : "Use /telegram to start.");
609638
609662
  return "handled";
609639
609663
  }
609640
609664
  if (parts.length === 1 && parts[0] === "--global") {
@@ -609648,6 +609672,11 @@ sleep 1
609648
609672
  renderInfo("Set one with /telegram --key <bot-token> --global, or use /telegram --key <bot-token> for this project.");
609649
609673
  return "handled";
609650
609674
  }
609675
+ if (settings.enabled === false) {
609676
+ renderWarning("Global Telegram polling is disabled.");
609677
+ renderInfo("Use /telegram enable --global before starting the shared bot.");
609678
+ return "handled";
609679
+ }
609651
609680
  try {
609652
609681
  await ctx3.telegramStart?.(settings.key, settings.admin, "global");
609653
609682
  } catch (err) {
@@ -609673,6 +609702,11 @@ sleep 1
609673
609702
  }
609674
609703
  return "handled";
609675
609704
  }
609705
+ if (settings.enabled === false) {
609706
+ renderWarning("Telegram polling is disabled.");
609707
+ renderInfo("Use /telegram enable to allow polling again.");
609708
+ return "handled";
609709
+ }
609676
609710
  try {
609677
609711
  const startProjectRoot = ctx3.repoRoot || process.cwd();
609678
609712
  if (existsSync110(join122(startProjectRoot, ".omnius"))) {
@@ -609707,6 +609741,8 @@ sleep 1
609707
609741
  renderInfo("Usage:");
609708
609742
  renderInfo(" /telegram --key <token> Save bot token (project-local when .omnius/ exists)");
609709
609743
  renderInfo(" /telegram --admin <id> Set admin filter (project-local by default)");
609744
+ renderInfo(" /telegram disable Disable long polling persistently");
609745
+ renderInfo(" /telegram enable Re-enable long polling");
609710
609746
  renderInfo(" /telegram revoke [--global] Revoke saved admin access");
609711
609747
  renderInfo(" /telegram Toggle on/off");
609712
609748
  renderInfo(" /telegram --global Start/stop legacy shared global token explicitly");
@@ -610513,7 +610549,9 @@ async function showPlatformOnboardingMenu(ctx3, id) {
610513
610549
  { key: "telegram-admin", label: "Set admin user id", detail: "Restricts remote admin controls" },
610514
610550
  { key: "telegram-mode", label: "Interaction mode", detail: ctx3.getTelegramSettings?.()?.mode ?? "auto" },
610515
610551
  { key: "telegram-start", label: "Start bridge", detail: "Uses saved token" },
610516
- { key: "telegram-stop", label: "Stop bridge", detail: "Disconnect long polling" }
610552
+ { key: "telegram-stop", label: "Stop bridge", detail: "Disconnect long polling" },
610553
+ { key: "telegram-disable", label: "Disable polling", detail: "Persistently block getUpdates" },
610554
+ { key: "telegram-enable", label: "Enable polling", detail: "Allow getUpdates again" }
610517
610555
  ] : [
610518
610556
  { key: "enable", label: "Enable adapter", detail: current.enabled ? "currently enabled" : "currently disabled" },
610519
610557
  { key: "disable", label: "Disable adapter", detail: current.enabled ? "currently enabled" : "currently disabled" },
@@ -610599,11 +610637,20 @@ async function showPlatformOnboardingMenu(ctx3, id) {
610599
610637
  } else if (result.key === "telegram-start") {
610600
610638
  const settings = ctx3.getTelegramSettings?.() ?? {};
610601
610639
  if (!settings.key) renderWarning("No Telegram bot token configured.");
610602
- else if (ctx3.isTelegramActive?.()) {
610640
+ else if (settings.enabled === false) {
610641
+ renderWarning("Telegram polling is disabled. Use /telegram enable first.");
610642
+ } else if (ctx3.isTelegramActive?.()) {
610603
610643
  renderWarning("Telegram bridge already active. Use /telegram stop before restarting.");
610604
610644
  } else await ctx3.telegramStart?.(settings.key, settings.admin, settings.keyScope ?? "project");
610605
610645
  } else if (result.key === "telegram-stop") {
610606
610646
  ctx3.telegramStop?.();
610647
+ } else if (result.key === "telegram-disable") {
610648
+ if (ctx3.isTelegramActive?.()) ctx3.telegramStop?.();
610649
+ ctx3.saveTelegramSettings?.({ enabled: false });
610650
+ renderInfo("Telegram polling disabled.");
610651
+ } else if (result.key === "telegram-enable") {
610652
+ ctx3.saveTelegramSettings?.({ enabled: true });
610653
+ renderInfo("Telegram polling enabled.");
610607
610654
  }
610608
610655
  return;
610609
610656
  }
@@ -630060,7 +630107,19 @@ function previewTelegramAdminArgs(args, maxLength = 220) {
630060
630107
  }
630061
630108
  }
630062
630109
  function telegramAdminLivePanelIntakeText(requestPreview) {
630063
- return requestPreview ? "I'm here. Reading this message in context and checking the live workspace state before answering." : "I'm here. Reading the current Telegram context and live workspace state before answering.";
630110
+ void requestPreview;
630111
+ return "";
630112
+ }
630113
+ function renderTelegramHalftoneProgressBar(elapsedSec, width = 12) {
630114
+ const safeWidth = Math.max(1, Math.floor(width));
630115
+ const phase = Math.max(0, elapsedSec) % 60 / 60 * safeWidth;
630116
+ const filled = Math.max(0, Math.min(safeWidth, Math.floor(phase)));
630117
+ const hasLead = filled < safeWidth;
630118
+ return [
630119
+ "█".repeat(filled),
630120
+ hasLead ? "▒" : "",
630121
+ "░".repeat(Math.max(0, safeWidth - filled - (hasLead ? 1 : 0)))
630122
+ ].join("");
630064
630123
  }
630065
630124
  function createTelegramAdminLivePanelState(args) {
630066
630125
  const now = args.now ?? Date.now();
@@ -630144,9 +630203,9 @@ function renderTelegramAdminLivePanelPayload(state) {
630144
630203
  ].filter(Boolean).join("\n");
630145
630204
  let body;
630146
630205
  if (state.activePage === "response") {
630147
- const response = state.responseText || state.intakeText;
630206
+ const response = state.responseText.trim();
630148
630207
  const clipped = response.length > 2600 ? `${response.slice(0, 2597).trimEnd()}...` : response;
630149
- body = convertMarkdownToTelegramHTML(clipped);
630208
+ body = clipped ? convertMarkdownToTelegramHTML(clipped) : "";
630150
630209
  } else if (state.activePage === "tools") {
630151
630210
  const lines = state.toolLines.slice(-12);
630152
630211
  body = lines.length > 0 ? `<blockquote>${escapeTelegramHTML(lines.join("\n"))}</blockquote>` : "<i>No tool calls yet.</i>";
@@ -633327,6 +633386,16 @@ ${mediaContext}` : ""
633327
633386
  return void 0;
633328
633387
  }
633329
633388
  }
633389
+ telegramPollingDebugEnabled() {
633390
+ return process.env["OMNIUS_TELEGRAM_DEBUG_POLLING"] === "1";
633391
+ }
633392
+ telegramSendFailureIsExpectedCapabilityError(reason) {
633393
+ return /not enough rights to send text messages|can't send messages|cannot send messages|bot was blocked|chat not found/i.test(reason);
633394
+ }
633395
+ shouldLogTelegramSendFailure(reason) {
633396
+ if (process.env["OMNIUS_TELEGRAM_DEBUG_SEND_FAILURES"] === "1") return true;
633397
+ return !this.telegramSendFailureIsExpectedCapabilityError(reason);
633398
+ }
633330
633399
  formatTelegramDeliveryCapabilityContext(sessionKey, msg) {
633331
633400
  const capability = this.telegramTextDeliveryCapability(sessionKey, msg.chatId, msg.messageThreadId);
633332
633401
  if (!capability) return "Telegram text delivery raw warning stream for this chat: none recorded.";
@@ -637404,7 +637473,9 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
637404
637473
  return result.result?.message_id ?? null;
637405
637474
  } catch (err) {
637406
637475
  const errStr = err instanceof Error ? err.message : String(err);
637407
- this.tuiWrite(() => renderWarning(`Failed to send Telegram live message: ${errStr}`));
637476
+ if (this.shouldLogTelegramSendFailure(errStr)) {
637477
+ this.tuiWrite(() => renderWarning(`Failed to send Telegram live message: ${errStr}`));
637478
+ }
637408
637479
  this.updateTelegramTextDeliveryCapability(chatId, {
637409
637480
  status: "failed",
637410
637481
  reason: errStr,
@@ -637463,9 +637534,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
637463
637534
  const sessionKey = this.sessionKeyForMessage(msg);
637464
637535
  const activeInference = this.getTelegramActiveInferences().find((inf) => inf.sessionKey === sessionKey);
637465
637536
  const status = activeInference ? activeInference.ttfbSec === void 0 ? `model request active; waiting for first token (${activeInference.kind}, ${activeInference.elapsedSec.toFixed(1)}s)` : `streaming ${activeInference.kind}; content=${activeInference.contentTokens}t thinking=${activeInference.thinkingTokens}t` : phase;
637466
- const width = 12;
637467
- const filled = Math.min(width, Math.floor(elapsedSec % 60 / 60 * width));
637468
- const bar = `[${"#".repeat(filled)}${"-".repeat(width - filled)}]`;
637537
+ const bar = renderTelegramHalftoneProgressBar(elapsedSec, 12);
637469
637538
  return [
637470
637539
  `<b>Working</b>`,
637471
637540
  `<code>${bar}</code> ${elapsedSec}s`,
@@ -637546,6 +637615,9 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
637546
637615
  updateTelegramAdminLivePanelFromEvent(subAgent, msg, event) {
637547
637616
  const state = this.ensureTelegramAdminLivePanel(subAgent, msg);
637548
637617
  applyTelegramAdminLivePanelEvent(state, event);
637618
+ if (state.messageId === void 0 && !state.responseText.trim()) {
637619
+ return;
637620
+ }
637549
637621
  const now = Date.now();
637550
637622
  if (state.messageId !== void 0 && now - subAgent.lastEditMs <= 900) return;
637551
637623
  subAgent.lastEditMs = now;
@@ -641391,8 +641463,10 @@ ${text}`.trim());
641391
641463
  ts: Date.now()
641392
641464
  });
641393
641465
  } catch (err) {
641394
- this.tuiWrite(() => renderWarning(`Failed to send Telegram message: ${err instanceof Error ? err.message : String(err)}`));
641395
641466
  const errStr = err instanceof Error ? err.message : String(err);
641467
+ if (this.shouldLogTelegramSendFailure(errStr)) {
641468
+ this.tuiWrite(() => renderWarning(`Failed to send Telegram message: ${errStr}`));
641469
+ }
641396
641470
  this.updateTelegramTextDeliveryCapability(chatId, {
641397
641471
  status: "failed",
641398
641472
  reason: errStr,
@@ -642086,13 +642160,15 @@ ${caption}\r
642086
642160
  this.stopTelegramPollingAfterFatal(reason);
642087
642161
  return;
642088
642162
  }
642089
- this.tuiWrite(() => renderWarning(`Telegram polling warning: ${reason}`));
642163
+ if (this.telegramPollingDebugEnabled()) {
642164
+ this.tuiWrite(() => renderWarning(`Telegram polling warning: ${reason}`));
642165
+ }
642090
642166
  await new Promise((r2) => setTimeout(r2, 5e3));
642091
642167
  }
642092
642168
  } catch (err) {
642093
642169
  if (this.polling) {
642094
642170
  const now = Date.now();
642095
- if (now - this.telegramPollWarningLastAtMs > 3e4) {
642171
+ if (this.telegramPollingDebugEnabled() && now - this.telegramPollWarningLastAtMs > 3e4) {
642096
642172
  this.telegramPollWarningLastAtMs = now;
642097
642173
  this.tuiWrite(() => renderWarning(
642098
642174
  `Telegram polling warning: getUpdates failed (${err instanceof Error ? err.message : String(err)}); long_poll_timeout=${longPollTimeoutSeconds}s client_deadline_ms=${this.telegramLongPollClientTimeoutMs(longPollTimeoutSeconds) ?? "none"}; retrying`
@@ -663234,6 +663310,7 @@ async function handlePatchConfig(req2, res) {
663234
663310
  settingsUpdate.voiceMode = updates["voiceMode"];
663235
663311
  }
663236
663312
  if (typeof updates["telegramKey"] === "string") settingsUpdate.telegramKey = updates["telegramKey"];
663313
+ if (typeof updates["telegramEnabled"] === "boolean") settingsUpdate.telegramEnabled = updates["telegramEnabled"];
663237
663314
  if (typeof updates["telegramAdmin"] === "string") settingsUpdate.telegramAdmin = updates["telegramAdmin"];
663238
663315
  if (typeof updates["cohere"] === "boolean") settingsUpdate.cohere = updates["cohere"];
663239
663316
  if (updates["commandsMode"] === "auto" || updates["commandsMode"] === "manual") {
@@ -673099,6 +673176,7 @@ Log: ${nexusLogPath}`)
673099
673176
  const subAgents = typeof source.telegramSubAgents === "number" ? source.telegramSubAgents : typeof savedSettings.telegramSubAgents === "number" ? savedSettings.telegramSubAgents : 2;
673100
673177
  return {
673101
673178
  key: nonEmptyTelegramSetting(source.telegramKey),
673179
+ enabled: source.telegramEnabled ?? savedSettings.telegramEnabled ?? true,
673102
673180
  admin: nonEmptyTelegramSetting(source.telegramAdmin),
673103
673181
  mode,
673104
673182
  subAgents,
@@ -673680,6 +673758,20 @@ The user pasted a clipboard image saved at ${relPath}. Use the OCR, vision analy
673680
673758
  },
673681
673759
  // Telegram bridge
673682
673760
  async telegramStart(token, adminId, scope = "project") {
673761
+ if (process.env["OMNIUS_TELEGRAM_DISABLED"] === "1") {
673762
+ writeContent(
673763
+ () => renderWarning("Telegram bridge disabled by OMNIUS_TELEGRAM_DISABLED=1.")
673764
+ );
673765
+ showPrompt();
673766
+ return;
673767
+ }
673768
+ if (telegramSettingsForScope(scope).enabled === false) {
673769
+ writeContent(
673770
+ () => renderWarning(`Telegram polling disabled in ${scope} settings. Use /telegram enable${scope === "global" ? " --global" : ""} to allow it.`)
673771
+ );
673772
+ showPrompt();
673773
+ return;
673774
+ }
673683
673775
  if (telegramBridge?.isActive) {
673684
673776
  writeContent(
673685
673777
  () => renderWarning("Telegram bridge already active. Use /telegram stop before restarting.")
@@ -673888,6 +673980,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
673888
673980
  if (settings.key !== void 0) {
673889
673981
  target.telegramKey = settings.key;
673890
673982
  }
673983
+ if (settings.enabled !== void 0) {
673984
+ target.telegramEnabled = settings.enabled;
673985
+ }
673891
673986
  if (settings.admin !== void 0) {
673892
673987
  target.telegramAdmin = settings.admin === null ? "" : settings.admin;
673893
673988
  }
@@ -673899,6 +673994,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
673899
673994
  }
673900
673995
  const payload = {
673901
673996
  ...settings.key !== void 0 ? { telegramKey: settings.key } : {},
673997
+ ...settings.enabled !== void 0 ? { telegramEnabled: settings.enabled } : {},
673902
673998
  ...settings.admin !== void 0 ? { telegramAdmin: settings.admin === null ? "" : settings.admin } : {},
673903
673999
  ...settings.mode !== void 0 ? { telegramMode: settings.mode } : {},
673904
674000
  ...settings.subAgents !== void 0 ? { telegramSubAgents: settings.subAgents } : {}
@@ -673953,6 +674049,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
673953
674049
  queuedSubAgents
673954
674050
  )
673955
674051
  );
674052
+ const effectiveTelegramSettings = telegramSettingsForScope(activeTelegramSettingsScope ?? "project");
674053
+ if (effectiveTelegramSettings.enabled === false || process.env["OMNIUS_TELEGRAM_DISABLED"] === "1") {
674054
+ writeContent(() => renderInfo("Telegram polling is disabled; auto-start and manual start are blocked."));
674055
+ }
673956
674056
  },
673957
674057
  telegramBeginAdminAuth() {
673958
674058
  if (!telegramBridge?.isActive) return null;
@@ -675338,7 +675438,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
675338
675438
  }
675339
675439
  }
675340
675440
  const autoTelegramSettings = telegramSettingsForScope("project");
675341
- if (!isResumed && autoTelegramSettings.key) {
675441
+ if (!isResumed && autoTelegramSettings.key && autoTelegramSettings.enabled !== false && process.env["OMNIUS_TELEGRAM_DISABLED"] !== "1") {
675342
675442
  setTimeout(async () => {
675343
675443
  try {
675344
675444
  await commandCtx.telegramStart(
@@ -677569,6 +677669,7 @@ var init_config6 = __esm({
677569
677669
  updateMode: "Update behaviour: auto (after task completion) or manual (/update only)",
677570
677670
  // -- Integrations --
677571
677671
  telegramKey: "Telegram bot API token for /telegram bridge",
677672
+ telegramEnabled: "Enable Telegram long polling / bridge auto-start (true/false)",
677572
677673
  telegramAdmin: "Telegram admin user ID — only this user can interact with the bot"
677573
677674
  };
677574
677675
  SENSITIVE_KEYS = /* @__PURE__ */ new Set(["apiKey", "api_key", "secret", "password", "token", "telegramKey"]);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.184",
3
+ "version": "1.0.186",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.184",
9
+ "version": "1.0.186",
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.184",
3
+ "version": "1.0.186",
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",