open-agents-ai 0.187.585 → 0.187.587

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
@@ -591008,31 +591008,81 @@ function formatTelegramProgressEvent(event) {
591008
591008
  if (event.type === "tool_call" && event.toolName === "task_complete") return null;
591009
591009
  if (event.type === "tool_result" && event.toolName === "task_complete") return null;
591010
591010
  if (event.type === "tool_call") {
591011
- return `🔧 Using <code>${escapeTelegramHTML(event.toolName || "tool")}</code>`;
591011
+ return `Using ${escapeTelegramHTML(event.toolName || "tool")}`;
591012
591012
  }
591013
591013
  if (event.type === "tool_result") {
591014
- const icon = event.success ? "✔" : "✘";
591015
591014
  const preview = sanitizeTelegramProgressText(event.content || "", 80);
591016
- const suffix = preview ? `: ${escapeTelegramHTML(preview)}` : "";
591017
- return `${icon} <code>${escapeTelegramHTML(event.toolName || "tool")}</code>${suffix}`;
591015
+ const toolName = escapeTelegramHTML(event.toolName || "tool");
591016
+ if (preview) return `${toolName}: ${escapeTelegramHTML(preview)}`;
591017
+ return event.success ? `${toolName} completed` : `${toolName} failed`;
591018
591018
  }
591019
591019
  if (event.type === "status") {
591020
591020
  const content = sanitizeTelegramProgressText(event.content || "", 120);
591021
- return content ? `⏳ ${escapeTelegramHTML(content)}` : null;
591021
+ return content ? escapeTelegramHTML(content) : null;
591022
591022
  }
591023
591023
  return null;
591024
591024
  }
591025
591025
  function renderTelegramLiveProgressHTML(progressLines, accumulated) {
591026
- const recentProgress = progressLines.slice(-6);
591027
- const progressBlock = recentProgress.length > 0 ? recentProgress.join("\n") : "⏳ Starting...";
591028
- const draft = sanitizeTelegramProgressText(accumulated, 700);
591029
- const draftBlock = draft ? `
591030
-
591031
- <i>Drafting answer...</i>
591032
- ${convertMarkdownToTelegramHTML(draft)}
591033
- <i>▌</i>` : "\n\n<i>Working...</i>";
591034
- return `<b>✈ Working on this...</b>
591035
- ${progressBlock}${draftBlock}`;
591026
+ const draft = stripTelegramHiddenThinking(accumulated).trim();
591027
+ if (draft) {
591028
+ const clipped = draft.length > 2e3 ? `${draft.slice(0, 1997).trimEnd()}...` : draft;
591029
+ return convertMarkdownToTelegramHTML(clipped);
591030
+ }
591031
+ return progressLines.slice(-6).map((line) => line.trim()).filter(Boolean).join("\n");
591032
+ }
591033
+ function telegramSyntheticHelpSignatures() {
591034
+ return [
591035
+ { signature: "/help", description: "Show Telegram command help" },
591036
+ { signature: "/start", description: "Show Telegram bridge status and authentication instructions" },
591037
+ { signature: "/auth <code>", description: "Authenticate this Telegram user as bot admin using the TUI code" }
591038
+ ];
591039
+ }
591040
+ function telegramHelpCommandAllowed(cmd, scope) {
591041
+ if (scope === "admin") return cmd.implementationStatus === "implemented";
591042
+ if (TELEGRAM_PUBLIC_HELP_COMMANDS.has(cmd.name)) return true;
591043
+ return cmd.surfaces.agentTool && !cmd.safety.secretBearing && !cmd.safety.destructive && !cmd.safety.profileGated;
591044
+ }
591045
+ function buildTelegramHelpHTML(scope, maxPublicCommands = 24) {
591046
+ const commands = listCommandRegistry({ includePlanned: false }).filter((cmd) => telegramHelpCommandAllowed(cmd, scope));
591047
+ const signatures = [
591048
+ ...telegramSyntheticHelpSignatures(),
591049
+ ...commands.flatMap((cmd) => cmd.signatures)
591050
+ ];
591051
+ const seen = /* @__PURE__ */ new Set();
591052
+ const unique = signatures.filter((sig) => {
591053
+ if (seen.has(sig.signature)) return false;
591054
+ seen.add(sig.signature);
591055
+ return true;
591056
+ });
591057
+ const visible = scope === "public" ? unique.slice(0, maxPublicCommands) : unique;
591058
+ const lines = [
591059
+ `<b>Commands (${scope === "admin" ? "admin full scope" : "public secure scope"})</b>`,
591060
+ "",
591061
+ ...visible.map(
591062
+ (sig) => `<code>${escapeTelegramHTML(sig.signature)}</code> - ${escapeTelegramHTML(sig.description)}`
591063
+ )
591064
+ ];
591065
+ if (scope === "public" && unique.length > visible.length) {
591066
+ lines.push("");
591067
+ lines.push(`Public scope truncated to ${visible.length} safe commands. Authenticate as admin for full command help.`);
591068
+ }
591069
+ return lines.join("\n");
591070
+ }
591071
+ function splitTelegramHTMLMessage(html, maxLength = 3600) {
591072
+ const chunks = [];
591073
+ let current = "";
591074
+ for (const line of html.split("\n")) {
591075
+ const candidate = current ? `${current}
591076
+ ${line}` : line;
591077
+ if (candidate.length > maxLength && current) {
591078
+ chunks.push(current);
591079
+ current = line;
591080
+ } else {
591081
+ current = candidate;
591082
+ }
591083
+ }
591084
+ if (current.trim()) chunks.push(current);
591085
+ return chunks.length > 0 ? chunks : [html];
591036
591086
  }
591037
591087
  function normalizeTelegramChatId(value2) {
591038
591088
  if (typeof value2 === "number" || typeof value2 === "string") return value2;
@@ -591378,7 +591428,7 @@ function renderTelegramSubAgentError(username, error) {
591378
591428
  process.stdout.write(` ${c3.dim("⎿")} ${c3.red("✘")} @${username}: ${c3.dim(preview)}
591379
591429
  `);
591380
591430
  }
591381
- var TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_ACTION_INTENT_RE, TELEGRAM_CODEBASE_CONTEXT_RE, TELEGRAM_COMMANDISH_RE, TELEGRAM_CHAT_INTENT_RE, MEDIA_CACHE_TTL_MS, TelegramBridge;
591431
+ var TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_ACTION_INTENT_RE, TELEGRAM_CODEBASE_CONTEXT_RE, TELEGRAM_COMMANDISH_RE, TELEGRAM_CHAT_INTENT_RE, TELEGRAM_PUBLIC_HELP_COMMANDS, MEDIA_CACHE_TTL_MS, TelegramBridge;
591382
591432
  var init_telegram_bridge = __esm({
591383
591433
  "packages/cli/src/tui/telegram-bridge.ts"() {
591384
591434
  "use strict";
@@ -591388,6 +591438,7 @@ var init_telegram_bridge = __esm({
591388
591438
  init_render();
591389
591439
  init_tool_policy();
591390
591440
  init_media_routing();
591441
+ init_command_registry();
591391
591442
  TELEGRAM_SAFETY_PROMPT = `
591392
591443
  CRITICAL SAFETY NOTICE — PUBLIC TELEGRAM CHANNEL
591393
591444
 
@@ -591469,6 +591520,7 @@ Telegram response contract:
591469
591520
  TELEGRAM_CODEBASE_CONTEXT_RE = /\b(repo|repository|codebase|workspace|working directory|file|files|folder|directory|src|source|test|tests|package|pnpm|npm|node|git|branch|commit|pr|pull request|issue|shell|terminal|cli|command|function|class|component|endpoint|api)\b/i;
591470
591521
  TELEGRAM_COMMANDISH_RE = /(^|\s)(pnpm|npm|node|git|rg|grep|sed|cat|ls|cd|mkdir|rm|mv|cp|curl|docker|pytest|vitest|tsc)\b/i;
591471
591522
  TELEGRAM_CHAT_INTENT_RE = /\b(hi|hello|hey|thanks|thank you|lol|haha|joke|how are you|what's up|whats up|can you hear|are you there|explain|what is|what are|why|how does|tell me|opinion|quick question)\b/i;
591523
+ TELEGRAM_PUBLIC_HELP_COMMANDS = /* @__PURE__ */ new Set(["help", "start", "auth", "call"]);
591472
591524
  MEDIA_CACHE_TTL_MS = 30 * 60 * 1e3;
591473
591525
  TelegramBridge = class {
591474
591526
  constructor(botToken, onMessage, agentConfig, repoRoot, toolPolicyConfig) {
@@ -591636,6 +591688,15 @@ Telegram response contract:
591636
591688
  if (!canonical || canonical === botless) return input;
591637
591689
  return `/${canonical}${trimmed.slice(first2.length)}`;
591638
591690
  }
591691
+ telegramSlashName(input) {
591692
+ const first2 = input.trim().split(/\s+/)[0] ?? "";
591693
+ if (!first2.startsWith("/")) return "";
591694
+ return first2.slice(1).split("@")[0]?.toLowerCase() ?? "";
591695
+ }
591696
+ isTelegramHelpCommand(input) {
591697
+ const name10 = this.telegramSlashName(input);
591698
+ return name10 === "help" || name10 === "h" || name10 === "commands" || name10 === "cmds";
591699
+ }
591639
591700
  isKnownTelegramSlash(input) {
591640
591701
  const first2 = input.trim().split(/\s+/)[0] ?? "";
591641
591702
  const botless = first2.startsWith("/") ? first2.slice(1).split("@")[0]?.toLowerCase() : "";
@@ -591662,6 +591723,25 @@ Telegram response contract:
591662
591723
  canUseChatActions(msg) {
591663
591724
  return !msg.guestQueryId && (typeof msg.chatId === "number" || String(msg.chatId).startsWith("@"));
591664
591725
  }
591726
+ async replyWithTelegramHelp(msg, isAdmin) {
591727
+ const scope = isAdmin ? "admin" : "public";
591728
+ const chunks = splitTelegramHTMLMessage(buildTelegramHelpHTML(scope));
591729
+ if (msg.guestQueryId) {
591730
+ await this.answerGuestQuery(msg.guestQueryId, chunks[0] ?? "", { parseMode: "HTML" });
591731
+ return;
591732
+ }
591733
+ for (let i2 = 0; i2 < chunks.length; i2++) {
591734
+ const chunk = chunks[i2];
591735
+ if (i2 === 0) {
591736
+ await this.replyToTelegramMessage(msg, chunk, {
591737
+ html: true,
591738
+ replyToMessageId: msg.chatType !== "private" ? msg.messageId : void 0
591739
+ });
591740
+ } else {
591741
+ await this.sendMessageHTML(msg.chatId, chunk);
591742
+ }
591743
+ }
591744
+ }
591665
591745
  recordChatHistory(sessionKey, entry) {
591666
591746
  const existing = this.chatHistory.get(sessionKey) ?? [];
591667
591747
  existing.push({ ...entry, ts: entry.ts ?? Date.now() });
@@ -591942,11 +592022,15 @@ ${TELEGRAM_SAFETY_PROMPT}`);
591942
592022
  if (msg.text.trim().startsWith("/") && await this.handleAdminAuthCommand({ ...msg, text: normalizedCommandText })) {
591943
592023
  return;
591944
592024
  }
592025
+ const isAdmin = this.isAdminUser(msg);
592026
+ if (msg.text.trim().startsWith("/") && this.isTelegramHelpCommand(normalizedCommandText)) {
592027
+ await this.replyWithTelegramHelp(msg, isAdmin);
592028
+ return;
592029
+ }
591945
592030
  if (!this.agentConfig || !this.repoRoot) {
591946
592031
  this.onMessage(msg);
591947
592032
  return;
591948
592033
  }
591949
- const isAdmin = this.isAdminUser(msg);
591950
592034
  const toolContext = this.resolveToolContext(msg, isAdmin);
591951
592035
  const isAdminDM = toolContext === "telegram-admin-dm";
591952
592036
  const sessionKey = this.sessionKeyForMessage(msg);
@@ -592058,6 +592142,7 @@ Join: ${newUrl}`);
592058
592142
  runner: null,
592059
592143
  typingInterval: null,
592060
592144
  liveMessageId: null,
592145
+ liveMessagePromise: null,
592061
592146
  accumulated: "",
592062
592147
  assistantText: "",
592063
592148
  streamText: "",
@@ -592080,14 +592165,6 @@ Join: ${newUrl}`);
592080
592165
  }
592081
592166
  this.tuiWrite(() => renderTelegramSubAgentStart(msg.username, msg.text, isAdminDM));
592082
592167
  try {
592083
- if (!msg.guestQueryId) {
592084
- const msgId = await this.sendLiveMessage(
592085
- msg.chatId,
592086
- renderTelegramLiveProgressHTML([], ""),
592087
- msg.chatType !== "private" ? msg.messageId : void 0
592088
- );
592089
- subAgent.liveMessageId = msgId;
592090
- }
592091
592168
  let mediaContext = "";
592092
592169
  if (msg.media) {
592093
592170
  mediaContext = await this.processMedia(msg);
@@ -592108,6 +592185,10 @@ Join: ${newUrl}`);
592108
592185
  return;
592109
592186
  }
592110
592187
  const finalText = stripTelegramHiddenThinking(result || "").trim() || "I couldn't generate a response. Please try again.";
592188
+ if (subAgent.liveMessagePromise) {
592189
+ await subAgent.liveMessagePromise.catch(() => {
592190
+ });
592191
+ }
592111
592192
  this.recordChatHistory(sessionKey, { role: "user", text: msg.text, mode: "action" });
592112
592193
  this.recordChatHistory(sessionKey, { role: "assistant", text: finalText, mode: "action" });
592113
592194
  const finalHtml = convertMarkdownToTelegramHTML(finalText);
@@ -592132,7 +592213,7 @@ Join: ${newUrl}`);
592132
592213
  this.subAgentViewCallbacks?.onWrite(subAgent.viewId, `error: ${errMsg}`);
592133
592214
  this.subAgentViewCallbacks?.onStatus(subAgent.viewId, "failed");
592134
592215
  if (subAgent.liveMessageId && !msg.guestQueryId) {
592135
- await this.editLiveMessage(msg.chatId, subAgent.liveMessageId, `❌ Error: ${errMsg}`).catch(() => {
592216
+ await this.editLiveMessage(msg.chatId, subAgent.liveMessageId, `Error: ${errMsg}`).catch(() => {
592136
592217
  });
592137
592218
  } else {
592138
592219
  await this.replyToTelegramMessage(msg, "Sorry, I encountered an error processing your message. Please try again.").catch(() => {
@@ -592154,10 +592235,11 @@ Join: ${newUrl}`);
592154
592235
  runner: null,
592155
592236
  typingInterval: null,
592156
592237
  liveMessageId: null,
592238
+ liveMessagePromise: null,
592157
592239
  accumulated: "",
592158
592240
  assistantText: "",
592159
592241
  streamText: "",
592160
- intermediateLines: ["💬 Contextual admin chat"],
592242
+ intermediateLines: [],
592161
592243
  lastEditMs: 0,
592162
592244
  aborted: false,
592163
592245
  toolContext,
@@ -592178,13 +592260,6 @@ Join: ${newUrl}`);
592178
592260
  }
592179
592261
  this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, `admin chat with full context/tools (${this.interactionMode})`));
592180
592262
  try {
592181
- if (!msg.guestQueryId) {
592182
- subAgent.liveMessageId = await this.sendLiveMessage(
592183
- msg.chatId,
592184
- renderTelegramLiveProgressHTML(subAgent.intermediateLines, ""),
592185
- msg.chatType !== "private" ? msg.messageId : void 0
592186
- );
592187
- }
592188
592263
  let mediaContext = "";
592189
592264
  if (msg.media) {
592190
592265
  mediaContext = await this.processMedia(msg);
@@ -592195,6 +592270,10 @@ Join: ${newUrl}`);
592195
592270
  subAgent.typingInterval = null;
592196
592271
  }
592197
592272
  const finalText = stripTelegramHiddenThinking(result || "").trim() || "I heard you.";
592273
+ if (subAgent.liveMessagePromise) {
592274
+ await subAgent.liveMessagePromise.catch(() => {
592275
+ });
592276
+ }
592198
592277
  this.recordChatHistory(sessionKey, { role: "user", text: msg.text, mode: "chat" });
592199
592278
  this.recordChatHistory(sessionKey, { role: "assistant", text: finalText, mode: "chat" });
592200
592279
  const finalHtml = convertMarkdownToTelegramHTML(finalText);
@@ -592218,7 +592297,7 @@ Join: ${newUrl}`);
592218
592297
  this.subAgentViewCallbacks?.onWrite(subAgent.viewId, `error: ${errMsg}`);
592219
592298
  this.subAgentViewCallbacks?.onStatus(subAgent.viewId, "failed");
592220
592299
  if (subAgent.liveMessageId && !msg.guestQueryId) {
592221
- await this.editLiveMessage(msg.chatId, subAgent.liveMessageId, `❌ Error: ${escapeTelegramHTML(errMsg)}`).catch(() => {
592300
+ await this.editLiveMessage(msg.chatId, subAgent.liveMessageId, `Error: ${escapeTelegramHTML(errMsg)}`).catch(() => {
592222
592301
  });
592223
592302
  } else {
592224
592303
  await this.replyToTelegramMessage(msg, "Sorry, I couldn't process that Telegram chat message.").catch(() => {
@@ -592247,7 +592326,8 @@ Join: ${newUrl}`);
592247
592326
  let accumulated = "";
592248
592327
  let lastEditMs = 0;
592249
592328
  let lastViewWriteMs = 0;
592250
- const progressLines = [`💬 Quick chat mode (${this.interactionMode})`];
592329
+ let liveMessagePromise = null;
592330
+ const progressLines = [];
592251
592331
  this.activeChatViews.add(viewId);
592252
592332
  this.refreshActiveTelegramInteractionCount();
592253
592333
  this.subAgentViewCallbacks?.onRegister(
@@ -592263,19 +592343,12 @@ Join: ${newUrl}`);
592263
592343
  }
592264
592344
  this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, `chat-mode fast reply (${this.interactionMode})`));
592265
592345
  try {
592266
- if (!msg.guestQueryId) {
592267
- liveMessageId = await this.sendLiveMessage(
592268
- msg.chatId,
592269
- renderTelegramLiveProgressHTML(progressLines, ""),
592270
- msg.chatType !== "private" ? msg.messageId : void 0
592271
- );
592272
- }
592273
592346
  const mediaContext = msg.media || msg.livePhoto ? "Attachment received. Quick-chat mode does not inspect media; use action mode for media analysis." : "";
592274
592347
  const finalText = await this.runTelegramChatCompletion(
592275
592348
  msg,
592276
592349
  toolContext,
592277
592350
  mediaContext,
592278
- (nextText) => {
592351
+ async (nextText) => {
592279
592352
  accumulated = nextText;
592280
592353
  const now = Date.now();
592281
592354
  if (now - lastViewWriteMs > 900) {
@@ -592284,12 +592357,28 @@ Join: ${newUrl}`);
592284
592357
  }
592285
592358
  if (liveMessageId && !msg.guestQueryId && now - lastEditMs > 900) {
592286
592359
  lastEditMs = now;
592287
- this.editLiveMessage(
592360
+ await this.editLiveMessage(
592288
592361
  msg.chatId,
592289
592362
  liveMessageId,
592290
592363
  renderTelegramLiveProgressHTML(progressLines, accumulated)
592291
592364
  ).catch(() => {
592292
592365
  });
592366
+ } else if (!liveMessageId && !liveMessagePromise && !msg.guestQueryId) {
592367
+ const html = renderTelegramLiveProgressHTML(progressLines, accumulated);
592368
+ if (html.trim()) {
592369
+ liveMessagePromise = this.sendLiveMessage(
592370
+ msg.chatId,
592371
+ html,
592372
+ msg.chatType !== "private" ? msg.messageId : void 0
592373
+ ).then((id) => {
592374
+ liveMessageId = id;
592375
+ lastEditMs = Date.now();
592376
+ }).catch(() => {
592377
+ }).finally(() => {
592378
+ liveMessagePromise = null;
592379
+ });
592380
+ await liveMessagePromise;
592381
+ }
592293
592382
  }
592294
592383
  }
592295
592384
  );
@@ -592298,6 +592387,11 @@ Join: ${newUrl}`);
592298
592387
  typingInterval = null;
592299
592388
  }
592300
592389
  const cleaned = stripTelegramHiddenThinking(finalText || accumulated).trim() || "I heard you.";
592390
+ const pendingLiveMessage = liveMessagePromise;
592391
+ if (pendingLiveMessage) {
592392
+ await pendingLiveMessage.catch(() => {
592393
+ });
592394
+ }
592301
592395
  this.recordChatHistory(sessionKey, { role: "user", text: msg.text, mode: "chat" });
592302
592396
  this.recordChatHistory(sessionKey, { role: "assistant", text: cleaned, mode: "chat" });
592303
592397
  const finalHtml = convertMarkdownToTelegramHTML(cleaned);
@@ -592321,7 +592415,7 @@ Join: ${newUrl}`);
592321
592415
  this.subAgentViewCallbacks?.onWrite(viewId, `error: ${errMsg}`);
592322
592416
  this.subAgentViewCallbacks?.onStatus(viewId, "failed");
592323
592417
  if (liveMessageId && !msg.guestQueryId) {
592324
- await this.editLiveMessage(msg.chatId, liveMessageId, `❌ Error: ${escapeTelegramHTML(errMsg)}`).catch(() => {
592418
+ await this.editLiveMessage(msg.chatId, liveMessageId, `Error: ${escapeTelegramHTML(errMsg)}`).catch(() => {
592325
592419
  });
592326
592420
  } else {
592327
592421
  await this.replyToTelegramMessage(msg, "Sorry, I couldn't process that quick chat message.").catch(() => {
@@ -592391,14 +592485,14 @@ ${mediaContext}` : ""}`
592391
592485
  for await (const chunk of streamable.chatCompletionStream(request)) {
592392
592486
  if (chunk.type === "content" && !chunk.thinking && chunk.content) {
592393
592487
  accumulated += chunk.content;
592394
- onToken(accumulated);
592488
+ await onToken(accumulated);
592395
592489
  }
592396
592490
  }
592397
592491
  }
592398
592492
  if (!accumulated.trim()) {
592399
592493
  const result = await backend.chatCompletion(request);
592400
592494
  accumulated = result.choices[0]?.message?.content ?? "";
592401
- if (accumulated) onToken(accumulated);
592495
+ if (accumulated) await onToken(accumulated);
592402
592496
  }
592403
592497
  return stripTelegramHiddenThinking(accumulated).trim();
592404
592498
  }
@@ -592456,26 +592550,35 @@ ${mediaContext}` : ""}`
592456
592550
  } else if (event.type === "stream_end" && event.content) {
592457
592551
  subAgent.streamText = event.content;
592458
592552
  }
592459
- if (subAgent.liveMessageId && !msg.guestQueryId) {
592460
- if (event.type === "stream_token" && event.streamKind === "content" && event.content) {
592461
- subAgent.accumulated += event.content;
592462
- }
592463
- const intermediateLine = formatTelegramProgressEvent(event);
592464
- if (intermediateLine) {
592465
- subAgent.intermediateLines.push(intermediateLine);
592466
- }
592553
+ if (event.type === "stream_token" && event.streamKind === "content" && event.content) {
592554
+ subAgent.accumulated += event.content;
592555
+ }
592556
+ const intermediateLine = formatTelegramProgressEvent(event);
592557
+ if (intermediateLine) {
592558
+ subAgent.intermediateLines.push(intermediateLine);
592559
+ }
592560
+ if (!msg.guestQueryId) {
592561
+ const html = renderTelegramLiveProgressHTML(subAgent.intermediateLines, subAgent.accumulated);
592562
+ if (!html.trim()) return;
592467
592563
  const now = Date.now();
592468
- if (now - subAgent.lastEditMs > 1e3) {
592469
- const hasContent = subAgent.accumulated.length > 10 || subAgent.intermediateLines.length > 0;
592470
- if (hasContent) {
592564
+ if (subAgent.liveMessageId) {
592565
+ if (now - subAgent.lastEditMs > 1e3) {
592471
592566
  subAgent.lastEditMs = now;
592472
- this.editLiveMessage(
592473
- msg.chatId,
592474
- subAgent.liveMessageId,
592475
- renderTelegramLiveProgressHTML(subAgent.intermediateLines, subAgent.accumulated)
592476
- ).catch(() => {
592567
+ this.editLiveMessage(msg.chatId, subAgent.liveMessageId, html).catch(() => {
592477
592568
  });
592478
592569
  }
592570
+ } else if (!subAgent.liveMessagePromise) {
592571
+ subAgent.liveMessagePromise = this.sendLiveMessage(
592572
+ msg.chatId,
592573
+ html,
592574
+ msg.chatType !== "private" ? msg.messageId : void 0
592575
+ ).then((id) => {
592576
+ subAgent.liveMessageId = id;
592577
+ subAgent.lastEditMs = Date.now();
592578
+ }).catch(() => {
592579
+ }).finally(() => {
592580
+ subAgent.liveMessagePromise = null;
592581
+ });
592479
592582
  }
592480
592583
  }
592481
592584
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.585",
3
+ "version": "0.187.587",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "open-agents-ai",
9
- "version": "0.187.585",
9
+ "version": "0.187.587",
10
10
  "hasInstallScript": true,
11
11
  "license": "CC-BY-NC-4.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.585",
3
+ "version": "0.187.587",
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",