🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(database): strip NUL from tool message updates (#20743)
Bryand7b6b4c748b4
diff --git a/packages/database/src/models/message.ts b/packages/database/src/models/message.tsindex 6a4decb0a66..feadf845087 100644--- a/packages/database/src/models/message.ts+++ b/packages/database/src/models/message.ts@@ -4747,7 +4747,7 @@ export class MessageModel {const messageUpdateData: Record<string, any> = {};if (content !== undefined) {- messageUpdateData.content = content;+ messageUpdateData.content = sanitizeNullBytes(content);}if (metadata !== undefined || heterogeneousToolState !== undefined) {@@ -4776,17 +4776,18 @@ export class MessageModel {const pluginUpdateData: Record<string, any> = {};if (pluginState !== undefined) {+ const sanitizedState = sanitizeNullBytes(pluginState);// Snapshot writes replace the whole runtime state. Ordinary patches// own complete top-level keys and merge inside the UPDATE so an// answer write cannot race away an intervention-terminal write.pluginUpdateData.state =heterogeneousToolState || replacePluginState- ? pluginState- : sql`coalesce(${messagePlugins.state}, '{}'::jsonb) || ${JSON.stringify(pluginState)}::jsonb`;+ ? sanitizedState+ : sql`coalesce(${messagePlugins.state}, '{}'::jsonb) || ${JSON.stringify(sanitizedState)}::jsonb`;}if (pluginError !== undefined) {- pluginUpdateData.error = pluginError;+ pluginUpdateData.error = sanitizeNullBytes(pluginError);}const [updatedPlugin] = await trx