mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:38:27 +00:00
fix(discord): add media dedup production code for messaging tool pipeline
Wire media URL tracking through the embedded agent pipeline so that media already sent via messaging tools is not delivered again by the reply dispatcher. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
Peter Steinberger
parent
c7681c3cff
commit
838259331f
@@ -70,9 +70,11 @@ export type EmbeddedPiSubscribeState = {
|
||||
messagingToolSentTexts: string[];
|
||||
messagingToolSentTextsNormalized: string[];
|
||||
messagingToolSentTargets: MessagingToolSend[];
|
||||
messagingToolSentMediaUrls: string[];
|
||||
pendingMessagingTexts: Map<string, string>;
|
||||
pendingMessagingTargets: Map<string, MessagingToolSend>;
|
||||
successfulCronAdds: number;
|
||||
pendingMessagingMediaUrls: Map<string, string>;
|
||||
lastAssistant?: AgentMessage;
|
||||
};
|
||||
|
||||
@@ -122,6 +124,44 @@ export type EmbeddedPiSubscribeContext = {
|
||||
getCompactionCount: () => number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Minimal context type for tool execution handlers. Allows
|
||||
* tests provide only the fields they exercise
|
||||
* without needing the full `EmbeddedPiSubscribeContext`.
|
||||
*/
|
||||
export type ToolHandlerParams = Pick<
|
||||
SubscribeEmbeddedPiSessionParams,
|
||||
"runId" | "onBlockReplyFlush" | "onAgentEvent" | "onToolResult"
|
||||
>;
|
||||
|
||||
export type ToolHandlerState = Pick<
|
||||
EmbeddedPiSubscribeState,
|
||||
| "toolMetaById"
|
||||
| "toolMetas"
|
||||
| "toolSummaryById"
|
||||
| "lastToolError"
|
||||
| "pendingMessagingTargets"
|
||||
| "pendingMessagingTexts"
|
||||
| "pendingMessagingMediaUrls"
|
||||
| "messagingToolSentTexts"
|
||||
| "messagingToolSentTextsNormalized"
|
||||
| "messagingToolSentMediaUrls"
|
||||
| "messagingToolSentTargets"
|
||||
>;
|
||||
|
||||
export type ToolHandlerContext = {
|
||||
params: ToolHandlerParams;
|
||||
state: ToolHandlerState;
|
||||
log: EmbeddedSubscribeLogger;
|
||||
hookRunner?: HookRunner;
|
||||
flushBlockReplyBuffer: () => void;
|
||||
shouldEmitToolResult: () => boolean;
|
||||
shouldEmitToolOutput: () => boolean;
|
||||
emitToolSummary: (toolName?: string, meta?: string) => void;
|
||||
emitToolOutput: (toolName?: string, meta?: string, output?: string) => void;
|
||||
trimMessagingToolSent: () => void;
|
||||
};
|
||||
|
||||
export type EmbeddedPiSubscribeEvent =
|
||||
| AgentEvent
|
||||
| { type: string; [k: string]: unknown }
|
||||
|
||||
Reference in New Issue
Block a user