fix: polish reply threading + tool dedupe (thanks @mneves75) (#326)

This commit is contained in:
Peter Steinberger
2026-01-08 00:50:29 +00:00
parent 33e2d53be3
commit 17d052bcda
16 changed files with 193 additions and 350 deletions

View File

@@ -226,6 +226,8 @@ export type EmbeddedPiRunResult = {
// True if a messaging tool (telegram, whatsapp, discord, slack, sessions_send)
// successfully sent a message. Used to suppress agent's confirmation text.
didSendViaMessagingTool?: boolean;
// Texts successfully sent via messaging tools during the run.
messagingToolSentTexts?: string[];
};
export type EmbeddedPiCompactResult = {
@@ -1253,6 +1255,7 @@ export async function runEmbeddedPiAgent(params: {
toolMetas,
unsubscribe,
waitForCompactionRetry,
getMessagingToolSentTexts,
didSendViaMessagingTool,
} = subscription;
@@ -1536,6 +1539,7 @@ export async function runEmbeddedPiAgent(params: {
aborted,
},
didSendViaMessagingTool: didSendViaMessagingTool(),
messagingToolSentTexts: getMessagingToolSentTexts(),
};
} finally {
restoreSkillEnv?.();

View File

@@ -778,6 +778,7 @@ export function subscribeEmbeddedPiSession(params: {
toolMetas,
unsubscribe,
isCompacting: () => compactionInFlight || pendingCompactionRetry > 0,
getMessagingToolSentTexts: () => messagingToolSentTexts.slice(),
// Returns true if any messaging tool successfully sent a message.
// Used to suppress agent's confirmation text (e.g., "Respondi no Telegram!")
// which is generated AFTER the tool sends the actual answer.