mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Signed-off-by: Wes <wesbillman@users.noreply.github.com> Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
38 lines
1017 B
TypeScript
38 lines
1017 B
TypeScript
import type { SendChannelMessageResult } from "@/shared/api/types";
|
|
import { invokeTauri } from "@/shared/api/tauri";
|
|
|
|
type RawSendChannelMessageResult = {
|
|
event_id: string;
|
|
parent_event_id: string | null;
|
|
root_event_id: string | null;
|
|
depth: number;
|
|
created_at: number;
|
|
};
|
|
|
|
export async function sendManagedAgentChannelMessage(input: {
|
|
agentPubkey: string;
|
|
channelId: string;
|
|
content: string;
|
|
marker?: string;
|
|
markerScope?: "agent" | "channel";
|
|
}): Promise<SendChannelMessageResult> {
|
|
const response = await invokeTauri<RawSendChannelMessageResult>(
|
|
"send_managed_agent_channel_message",
|
|
{
|
|
agentPubkey: input.agentPubkey,
|
|
channelId: input.channelId,
|
|
content: input.content,
|
|
marker: input.marker ?? null,
|
|
markerScope: input.markerScope ?? null,
|
|
},
|
|
);
|
|
|
|
return {
|
|
eventId: response.event_id,
|
|
parentEventId: response.parent_event_id,
|
|
rootEventId: response.root_event_id,
|
|
depth: response.depth,
|
|
createdAt: response.created_at,
|
|
};
|
|
}
|