mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-03 01:27:09 +01:00
Reviewed and verified at bc22051c56.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
19 lines
1.1 KiB
TypeScript
19 lines
1.1 KiB
TypeScript
import { notifyMergeConfirmationWork } from "./merged-pr-confirmation-notifications.js";
|
|
import { DELIVERY_QUEUES, notifyDeliveryWork } from "./delivery-work-notifications.js";
|
|
|
|
export type ChatConfirmationScope = { companyId: string; issueId?: string };
|
|
|
|
export async function notifyChatConfirmationWork(tx: object, scope: ChatConfirmationScope) {
|
|
await notifyDeliveryWork(tx, DELIVERY_QUEUES.chatTerminalConfirmations,
|
|
JSON.stringify({ companyId: scope.companyId, issueId: scope.issueId }));
|
|
}
|
|
|
|
/** Interaction resolution can release a callback parked while its human input
|
|
* was pending. Register on the owning transaction before its resolution write. */
|
|
export async function notifyChatConfirmationResolution(tx: object, interaction: ChatConfirmationScope & { kind: string }) {
|
|
if (interaction.kind === "request_confirmation") await notifyMergeConfirmationWork(tx, interaction);
|
|
if (["request_confirmation", "request_checkbox_confirmation", "suggest_tasks", "connection_intent"].includes(interaction.kind)) {
|
|
await notifyChatConfirmationWork(tx, interaction);
|
|
}
|
|
}
|