(
args: {
agentPubkey: string;
channelId: string;
content: string;
marker?: string | null;
},
_config: E2eConfig | undefined,
)
| 7063 | } |
| 7064 | |
| 7065 | async function handleSendManagedAgentChannelMessage( |
| 7066 | args: { |
| 7067 | agentPubkey: string; |
| 7068 | channelId: string; |
| 7069 | content: string; |
| 7070 | marker?: string | null; |
| 7071 | }, |
| 7072 | _config: E2eConfig | undefined, |
| 7073 | ): Promise<RawSendChannelMessageResponse> { |
| 7074 | const agent = getMockManagedAgent(args.agentPubkey); |
| 7075 | const marker = args.marker?.trim(); |
| 7076 | if (marker) { |
| 7077 | const existing = getMockMessageStore(args.channelId).find( |
| 7078 | (event) => |
| 7079 | event.pubkey === agent.pubkey && |
| 7080 | event.tags.some((tag) => tag[0] === "client" && tag[1] === marker), |
| 7081 | ); |
| 7082 | if (existing) { |
| 7083 | return { |
| 7084 | event_id: existing.id, |
| 7085 | parent_event_id: null, |
| 7086 | root_event_id: null, |
| 7087 | depth: 0, |
| 7088 | created_at: existing.created_at, |
| 7089 | }; |
| 7090 | } |
| 7091 | } |
| 7092 | |
| 7093 | const createdAt = Math.floor(Date.now() / 1000); |
| 7094 | const event = createMockEvent( |
| 7095 | 9, |
| 7096 | args.content.trim(), |
| 7097 | [["h", args.channelId], ...(marker ? [["client", marker]] : [])], |
| 7098 | agent.pubkey, |
| 7099 | createdAt, |
| 7100 | ); |
| 7101 | recordMockMessage(args.channelId, event); |
| 7102 | emitMockLiveEvent(args.channelId, event); |
| 7103 | |
| 7104 | return { |
| 7105 | event_id: event.id, |
| 7106 | parent_event_id: null, |
| 7107 | root_event_id: null, |
| 7108 | depth: 0, |
| 7109 | created_at: createdAt, |
| 7110 | }; |
| 7111 | } |
| 7112 | |
| 7113 | /** |
| 7114 | * Mock the `delete_message` Tauri command. Removes the event from the |
no test coverage detected