@tritard/waterbrother 0.16.80 → 0.16.81
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/package.json +1 -1
- package/src/gateway.js +23 -10
package/package.json
CHANGED
package/src/gateway.js
CHANGED
|
@@ -1926,15 +1926,17 @@ class TelegramGateway {
|
|
|
1926
1926
|
reviewerPid: Number(targetHost.pid || 0)
|
|
1927
1927
|
}
|
|
1928
1928
|
});
|
|
1929
|
-
const
|
|
1929
|
+
const reviewResult = await this.runPromptViaBridge(message, sessionId, reviewPrompt, {
|
|
1930
1930
|
explicitExecution: true,
|
|
1931
|
-
targetHost
|
|
1931
|
+
targetHost,
|
|
1932
|
+
includeSource: true
|
|
1932
1933
|
});
|
|
1933
1934
|
return {
|
|
1934
1935
|
markup: [
|
|
1935
1936
|
"<b>Reviewer response</b>",
|
|
1936
1937
|
`reviewer: <code>${escapeTelegramHtml(continuation.context?.ownerName || "unknown")}</code>`,
|
|
1937
|
-
|
|
1938
|
+
targetHost ? `terminal: <code>${escapeTelegramHtml(formatBridgeHostLabel(targetHost) || targetHost.sessionId || "live terminal")}</code>` : "",
|
|
1939
|
+
renderTelegramChunks(reviewResult?.content || "(no content)").join("\n\n")
|
|
1938
1940
|
].join("\n\n")
|
|
1939
1941
|
};
|
|
1940
1942
|
}
|
|
@@ -2725,7 +2727,10 @@ class TelegramGateway {
|
|
|
2725
2727
|
if (reply.error) {
|
|
2726
2728
|
throw new Error(reply.error);
|
|
2727
2729
|
}
|
|
2728
|
-
|
|
2730
|
+
const content = String(reply.content || "").trim() || "(no content)";
|
|
2731
|
+
return options.includeSource
|
|
2732
|
+
? { content, sourceHost: host }
|
|
2733
|
+
: content;
|
|
2729
2734
|
}
|
|
2730
2735
|
|
|
2731
2736
|
const activeHost = nextBridge.activeHost || {};
|
|
@@ -2836,8 +2841,12 @@ class TelegramGateway {
|
|
|
2836
2841
|
return message || null;
|
|
2837
2842
|
}
|
|
2838
2843
|
|
|
2839
|
-
async deliverPromptResult(chatId, replyToMessageId, previewMessage, content) {
|
|
2840
|
-
const
|
|
2844
|
+
async deliverPromptResult(chatId, replyToMessageId, previewMessage, content, options = {}) {
|
|
2845
|
+
const sourceHost = options.sourceHost && typeof options.sourceHost === "object" ? options.sourceHost : null;
|
|
2846
|
+
const sourcePrefix = sourceHost
|
|
2847
|
+
? `<b>Handled by</b>\n<code>${escapeTelegramHtml(formatBridgeHostLabel(sourceHost) || sourceHost.sessionId || "live terminal")}</code>\n\n`
|
|
2848
|
+
: "";
|
|
2849
|
+
const chunks = renderTelegramChunks(`${sourcePrefix}${String(content || "")}`);
|
|
2841
2850
|
if (!chunks.length) {
|
|
2842
2851
|
if (previewMessage?.message_id) {
|
|
2843
2852
|
await this.editMessage(chatId, previewMessage.message_id, "(no content)");
|
|
@@ -3957,13 +3966,17 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
|
|
|
3957
3966
|
return;
|
|
3958
3967
|
}
|
|
3959
3968
|
previewMessage = await this.sendProgressMessage(message.chat.id, message.message_id);
|
|
3960
|
-
const
|
|
3969
|
+
const result = (await this.runPromptViaBridge(message, sessionId, promptText, {
|
|
3961
3970
|
explicitExecution: shouldExecutePrompt,
|
|
3962
|
-
targetHost: selectedLiveHost || host || null
|
|
3971
|
+
targetHost: selectedLiveHost || host || null,
|
|
3972
|
+
includeSource: true
|
|
3963
3973
|
}))
|
|
3964
3974
|
?? (await this.runPromptFallback(sessionId, promptText));
|
|
3965
|
-
|
|
3966
|
-
await this.
|
|
3975
|
+
const finalContent = typeof result === "string" ? result : String(result?.content || "").trim();
|
|
3976
|
+
await this.deliverPromptResult(message.chat.id, message.message_id, previewMessage, finalContent, {
|
|
3977
|
+
sourceHost: typeof result === "string" ? null : (result?.sourceHost || null)
|
|
3978
|
+
});
|
|
3979
|
+
await this.rememberContinuation(message, finalContent);
|
|
3967
3980
|
} catch (error) {
|
|
3968
3981
|
await this.deliverPromptFailure(message.chat.id, message.message_id, previewMessage, error);
|
|
3969
3982
|
} finally {
|