server-core/conversation/requirements
packages/server/src/conversation/requirements
Purpose
Conversation-domain requirement helpers.Public surface
authorizeConversationCreate
Function
authorizeConversationCreateCapacityOnly
Function
app/conversation/create. An app minting a conversation on the task’s
behalf has no agent contact-edges of its own; the targets
are already gated by requireAgentsAreInTaskParticipants in the
handler, so the creator contact-policy basis does NOT apply. Only the
group-capacity check runs. Loading owners still validates every target
exists.
guardConversationNotArchived
Function
archived_at IS NULL).
guardReplyTarget
Function
replyToId, verify the
referenced message exists in the conversation (fails MessageNotFound if
absent); a send with no reply target passes with no DB read.
guardTaskActive
Function
closed/failed). Called BEFORE
guardConversationNotArchived so a closed task surfaces TaskClosed
before the auto-archive’s ConversationArchived.
obtainConversationInTask
Function
obtainConversationSendAccess
Function
ConversationSendAccess obtain: prove the caller participates in the
conversation, then do the ONE joined read (conversations ⋈ tasks). The row
it returns is the shared context the send handler guards read from, so the
whole send path costs one joined read. A conversationId that
survives the participant check but vanishes from the join is a true race
(archival/deletion) — surfaced as a defect, not a user error.
TaskAndConversation
Interface
Files
create-authorization.tsin-task.tssend-access.ts