open-agents-ai 0.52.0 → 0.53.0
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 +25 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27456,6 +27456,8 @@ with summary "no_reply" to silently skip without responding.
|
|
|
27456
27456
|
commandHandler = null;
|
|
27457
27457
|
/** Callback to get active call session URL (wired from interactive.ts) */
|
|
27458
27458
|
callUrlGetter = null;
|
|
27459
|
+
/** Callback to write content into the scrollable TUI waterfall area (wired from interactive.ts) */
|
|
27460
|
+
writeContent = null;
|
|
27459
27461
|
/** Media cache — fileUniqueId → cache entry */
|
|
27460
27462
|
mediaCache = /* @__PURE__ */ new Map();
|
|
27461
27463
|
/** Media cache directory */
|
|
@@ -27493,6 +27495,10 @@ with summary "no_reply" to silently skip without responding.
|
|
|
27493
27495
|
setCallUrlGetter(getter) {
|
|
27494
27496
|
this.callUrlGetter = getter;
|
|
27495
27497
|
}
|
|
27498
|
+
/** Register callback to write content into the scrollable TUI area (status bar guard) */
|
|
27499
|
+
setWriteContent(fn) {
|
|
27500
|
+
this.writeContent = fn;
|
|
27501
|
+
}
|
|
27496
27502
|
/** Register event handler for sub-agent activity (waterfall view) */
|
|
27497
27503
|
setOnSubAgentEvent(handler) {
|
|
27498
27504
|
this.onSubAgentEvent = handler;
|
|
@@ -27506,6 +27512,14 @@ with summary "no_reply" to silently skip without responding.
|
|
|
27506
27512
|
get botUsername() {
|
|
27507
27513
|
return this.state.botUsername;
|
|
27508
27514
|
}
|
|
27515
|
+
/** Write to the scrollable TUI waterfall area (respects status bar scroll region) */
|
|
27516
|
+
tuiWrite(fn) {
|
|
27517
|
+
if (this.writeContent) {
|
|
27518
|
+
this.writeContent(fn);
|
|
27519
|
+
} else {
|
|
27520
|
+
fn();
|
|
27521
|
+
}
|
|
27522
|
+
}
|
|
27509
27523
|
/** Start polling for Telegram messages */
|
|
27510
27524
|
async start() {
|
|
27511
27525
|
if (this.polling)
|
|
@@ -27655,7 +27669,7 @@ with summary "no_reply" to silently skip without responding.
|
|
|
27655
27669
|
if (isAdminDM && msg.text.startsWith("/") && this.commandHandler) {
|
|
27656
27670
|
const cmdName = msg.text.split(/\s+/)[0].slice(1).toLowerCase();
|
|
27657
27671
|
if (cmdName !== "start") {
|
|
27658
|
-
renderTelegramSubAgentEvent(msg.username, `command: ${msg.text}`);
|
|
27672
|
+
this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, `command: ${msg.text}`));
|
|
27659
27673
|
try {
|
|
27660
27674
|
const result = await this.commandHandler(msg.text);
|
|
27661
27675
|
if (result) {
|
|
@@ -27675,7 +27689,7 @@ with summary "no_reply" to silently skip without responding.
|
|
|
27675
27689
|
const existing = this.subAgents.get(msg.chatId);
|
|
27676
27690
|
if (existing && !existing.aborted) {
|
|
27677
27691
|
existing.runner.injectUserMessage(msg.text);
|
|
27678
|
-
renderTelegramSubAgentEvent(msg.username, "mid-conversation steering injected");
|
|
27692
|
+
this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, "mid-conversation steering injected"));
|
|
27679
27693
|
return;
|
|
27680
27694
|
}
|
|
27681
27695
|
const subAgent = {
|
|
@@ -27693,7 +27707,7 @@ with summary "no_reply" to silently skip without responding.
|
|
|
27693
27707
|
this.subAgents.set(msg.chatId, subAgent);
|
|
27694
27708
|
this.state.activeSubAgents = this.subAgents.size;
|
|
27695
27709
|
subAgent.typingInterval = this.startTypingIndicator(msg.chatId);
|
|
27696
|
-
renderTelegramSubAgentStart(msg.username, msg.text, isAdminDM);
|
|
27710
|
+
this.tuiWrite(() => renderTelegramSubAgentStart(msg.username, msg.text, isAdminDM));
|
|
27697
27711
|
try {
|
|
27698
27712
|
if (isAdminDM) {
|
|
27699
27713
|
const msgId = await this.sendLiveMessage(msg.chatId, "<i>\u23F3 Processing...</i>");
|
|
@@ -27709,7 +27723,7 @@ with summary "no_reply" to silently skip without responding.
|
|
|
27709
27723
|
subAgent.typingInterval = null;
|
|
27710
27724
|
}
|
|
27711
27725
|
if (result === "no_reply" || result === "") {
|
|
27712
|
-
renderTelegramSubAgentEvent(msg.username, "discretion: skipped reply");
|
|
27726
|
+
this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, "discretion: skipped reply"));
|
|
27713
27727
|
return;
|
|
27714
27728
|
}
|
|
27715
27729
|
const finalText = result || "I couldn't generate a response. Please try again.";
|
|
@@ -27720,14 +27734,14 @@ with summary "no_reply" to silently skip without responding.
|
|
|
27720
27734
|
} else {
|
|
27721
27735
|
await this.sendMessageHTML(msg.chatId, finalHtml, msg.chatType !== "private" ? msg.messageId : void 0);
|
|
27722
27736
|
}
|
|
27723
|
-
renderTelegramSubAgentComplete(msg.username, finalText);
|
|
27737
|
+
this.tuiWrite(() => renderTelegramSubAgentComplete(msg.username, finalText));
|
|
27724
27738
|
} catch (err) {
|
|
27725
27739
|
if (subAgent.typingInterval) {
|
|
27726
27740
|
clearInterval(subAgent.typingInterval);
|
|
27727
27741
|
subAgent.typingInterval = null;
|
|
27728
27742
|
}
|
|
27729
27743
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
27730
|
-
renderTelegramSubAgentError(msg.username, errMsg);
|
|
27744
|
+
this.tuiWrite(() => renderTelegramSubAgentError(msg.username, errMsg));
|
|
27731
27745
|
if (isAdminDM && subAgent.liveMessageId) {
|
|
27732
27746
|
await this.editLiveMessage(msg.chatId, subAgent.liveMessageId, `\u274C Error: ${errMsg}`).catch(() => {
|
|
27733
27747
|
});
|
|
@@ -28054,7 +28068,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
|
|
|
28054
28068
|
this.state.messagesSent++;
|
|
28055
28069
|
return result.result?.message_id ?? null;
|
|
28056
28070
|
} catch (err) {
|
|
28057
|
-
renderWarning(`Failed to send Telegram message: ${err instanceof Error ? err.message : String(err)}`);
|
|
28071
|
+
this.tuiWrite(() => renderWarning(`Failed to send Telegram message: ${err instanceof Error ? err.message : String(err)}`));
|
|
28058
28072
|
return null;
|
|
28059
28073
|
}
|
|
28060
28074
|
}
|
|
@@ -28075,7 +28089,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
|
|
|
28075
28089
|
this.state.messagesSent++;
|
|
28076
28090
|
return result.result?.message_id ?? null;
|
|
28077
28091
|
} catch (err) {
|
|
28078
|
-
renderWarning(`Failed to send call button: ${err instanceof Error ? err.message : String(err)}`);
|
|
28092
|
+
this.tuiWrite(() => renderWarning(`Failed to send call button: ${err instanceof Error ? err.message : String(err)}`));
|
|
28079
28093
|
return null;
|
|
28080
28094
|
}
|
|
28081
28095
|
}
|
|
@@ -28157,7 +28171,7 @@ ${caption}\r
|
|
|
28157
28171
|
}
|
|
28158
28172
|
return null;
|
|
28159
28173
|
} catch (err) {
|
|
28160
|
-
renderWarning(`Failed to send voice message: ${err instanceof Error ? err.message : String(err)}`);
|
|
28174
|
+
this.tuiWrite(() => renderWarning(`Failed to send voice message: ${err instanceof Error ? err.message : String(err)}`));
|
|
28161
28175
|
return null;
|
|
28162
28176
|
}
|
|
28163
28177
|
}
|
|
@@ -28294,7 +28308,7 @@ ${caption}\r
|
|
|
28294
28308
|
};
|
|
28295
28309
|
if (this.agentConfig && this.repoRoot) {
|
|
28296
28310
|
this.handleMessageWithSubAgent(msg).catch((err) => {
|
|
28297
|
-
renderWarning(`Telegram sub-agent error: ${err instanceof Error ? err.message : String(err)}`);
|
|
28311
|
+
this.tuiWrite(() => renderWarning(`Telegram sub-agent error: ${err instanceof Error ? err.message : String(err)}`));
|
|
28298
28312
|
});
|
|
28299
28313
|
} else {
|
|
28300
28314
|
this.onMessage(msg);
|
|
@@ -30758,6 +30772,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
30758
30772
|
if (adminId) {
|
|
30759
30773
|
telegramBridge.setAdmin(adminId);
|
|
30760
30774
|
}
|
|
30775
|
+
telegramBridge.setWriteContent(writeContent);
|
|
30761
30776
|
telegramBridge.setOnSubAgentEvent((chatId, username, event) => {
|
|
30762
30777
|
if (event.type === "tool_call" && event.toolName) {
|
|
30763
30778
|
const argsPreview = event.toolArgs ? JSON.stringify(event.toolArgs).slice(0, 60) : "";
|
package/package.json
CHANGED