feat: improve BlueBubbles message processing by adding reply context formatting and enhancing message ID extraction from responses

This commit is contained in:
Tyler Yust
2026-01-20 01:34:51 -08:00
committed by Peter Steinberger
parent e5514d4854
commit b0b42b4e14
5 changed files with 66 additions and 9 deletions

View File

@@ -156,9 +156,10 @@ export function buildEmbeddedRunPayloads(params: {
});
}
if (replyItems.length === 0 && params.lastToolError) {
// Check if this is a recoverable/internal tool error that shouldn't be shown to users.
// These include parameter validation errors that the model should have retried.
if (params.lastToolError) {
const hasUserFacingReply = replyItems.length > 0;
// Check if this is a recoverable/internal tool error that shouldn't be shown to users
// when there's already a user-facing reply (the model should have retried).
const errorLower = (params.lastToolError.error ?? "").toLowerCase();
const isRecoverableError =
errorLower.includes("required") ||
@@ -169,8 +170,7 @@ export function buildEmbeddedRunPayloads(params: {
errorLower.includes("needs") ||
errorLower.includes("requires");
// Only show non-recoverable errors to users
if (!isRecoverableError) {
if (!hasUserFacingReply || !isRecoverableError) {
const toolSummary = formatToolAggregate(
params.lastToolError.toolName,
params.lastToolError.meta ? [params.lastToolError.meta] : undefined,
@@ -182,8 +182,8 @@ export function buildEmbeddedRunPayloads(params: {
isError: true,
});
}
// Note: Recoverable errors are already in the model's context as tool_result is_error,
// so the model can see them and should retry. We just don't send them to the user.
// Note: Recoverable errors are already in the model's context as tool_result is_error.
// We only suppress them when a user-facing reply already exists.
}
const hasAudioAsVoiceTag = replyItems.some((item) => item.audioAsVoice);