@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
24 lines • 1.11 kB
JavaScript
/** A queued itemized message that `clearQueue` removed before it was written: none of its items were delivered. */
export class QueuedDeliveryCleared extends Error {
constructor(itemIds = []) {
super("The queued message was cleared before it was written");
this.name = "QueuedDeliveryCleared";
this.itemIds = itemIds;
}
}
/** The notice an item is stored as when its batch is held: its own payload and details, never the whole batch's. */
export function itemNoticeMessage(message, item) {
return {
role: "custom",
customType: message.customType,
content: item.content ?? message.content ?? [],
display: message.display,
...(item.details === undefined ? {} : { details: item.details }),
timestamp: Date.now(),
};
}
/** One `message_persisted` receipt per item: the batch was delivered as the one message in `entryId`. */
export function deliveredReceipts(items, entryId) {
return items.map((item) => ({ itemId: item.itemId, entryId, disposition: "message_persisted" }));
}
//# sourceMappingURL=itemized-send.js.map