import { type Database } from "./database.js"; export type InboxItemRow = { id: string; workspaceId: string; sessionId: string; kind: "question" | "approval" | "goal_paused" | "notification" | "reply"; sourceKey: string; title: string; subtitle: string; body: string; facts: Array<{ label: string; value: string; }>; link: { url: string; label: string; } | null; eventSequence: number | null; choices: Array<{ id: string; label: string; }>; /** An approval its tool's MCP server asks a question about (1113); null otherwise. */ serverQuestion: { server: string; kind: "confirm" | "form"; round: number; } | null; urgency: "normal" | "time_sensitive"; status: "open" | "resolved" | "withdrawn" | "dismissed"; unread: boolean; snoozedUntil: string | null; createdAt: string; updatedAt: string; resolvedAt: string | null; /** Another member whose agent sent this notification (0708); null for the person's own. */ sender: { subjectId: string; label: string; } | null; }; /** * A notification about something other than a chat (1503), such as a * subscription account that needs signing in again: no session, and always a * link (a path in the web app, or an https URL). */ export type InboxNoticeRow = Omit & { sessionId: null; kind: "notification"; link: { url: string; label: string; }; }; /** * The person's open items in one account, newest first: items from chats and * notices about something other than a chat (1503). */ export declare function listInboxEntries(db: Database, input: { accountId: string; subjectId: string; }): Promise>; /** The person's open items from chats in one account, newest first. */ export declare function listInboxItems(db: Database, input: { accountId: string; subjectId: string; }): Promise; export type InboxItemRef = { id: string; workspaceId: string; /** Null for a notice about something other than a chat (1503). */ sessionId: string | null; kind: InboxItemRow["kind"]; sourceKey: string; status: InboxItemRow["status"]; }; /** One of the person's items, in any status; null when it is not theirs. */ export declare function getInboxItem(db: Database, input: { itemId: string; accountId: string; subjectId: string; }): Promise; /** * Record the person's attention on one of their items. `snoozedUntil: null` * unsnoozes; omit it to leave the snooze. Returns false when the item is not theirs. */ export declare function updateInboxItemAttention(db: Database, input: { itemId: string; accountId: string; subjectId: string; seen?: boolean; snoozedUntil?: string | null; dismissed?: boolean; }): Promise; /** An agent tidying the person's inbox; only notifications can be dismissed this way. */ export declare function dismissInboxNotification(db: Database, input: { itemId: string; accountId: string; subjectId: string; }): Promise; export type InboxTidyPolicyValue = "own_sessions" | "any_agent" | "full_access"; export declare function getInboxTidyPolicy(db: Database, input: { accountId: string; subjectId: string; }): Promise; export declare function setInboxTidyPolicy(db: Database, input: { accountId: string; subjectId: string; policy: InboxTidyPolicyValue; }): Promise; export type InboxSettingsValue = { tidyPolicy: InboxTidyPolicyValue; pausedGoals: boolean; replies: boolean; /** Question and approval alerts arrive time-sensitive (0718). */ timeSensitiveNeedsYou: boolean; }; /** The person's inbox settings in one account (0663, 0665, 0718). */ export declare function getInboxSettings(db: Database, input: { accountId: string; subjectId: string; }): Promise; /** * Change some of the person's inbox settings; omitted ones stay as they are. * Turning replies off takes the reply items out of the inbox. */ export declare function setInboxSettings(db: Database, input: { accountId: string; subjectId: string; tidyPolicy?: InboxTidyPolicyValue | undefined; pausedGoals?: boolean | undefined; replies?: boolean | undefined; timeSensitiveNeedsYou?: boolean | undefined; }): Promise; /** * A turn works for its initiating human, including an explicitly absent human. * Legacy non-turn inbox operations retain the session recipient convention. * A person is a `user:` subject or an external user (`external_user:`, a * product's own user acting through its organization key), as in the inbox * projection's person rule; the local install's `dev` only in that install. */ export declare function getSessionInboxRecipient(db: Database, workspaceId: string, sessionId: string, turnId?: string): Promise<{ subjectId: string; parentSessionId: string | null; } | null>; /** Titles of sessions in one workspace, read under that workspace's context. */ export declare function getSessionTitles(db: Database, workspaceId: string, sessionIds: readonly string[]): Promise>; /** * Whether this person lets other members' agents notify them in this * workspace (0708). Off unless they turned it on. */ export declare function getMemberNotificationsAllowed(db: Database, input: { workspaceId: string; subjectId: string; }): Promise; /** Turn other members' agent notifications on or off for this person in this workspace. */ export declare function setMemberNotificationsAllowed(db: Database, input: { accountId: string; workspaceId: string; subjectId: string; allowed: boolean; }): Promise; /** * Whether this person muted the session's replies (0678), or null when the * session is not in the workspace. */ export declare function getSessionRepliesMuted(db: Database, input: { workspaceId: string; sessionId: string; subjectId: string; }): Promise; /** * Mute or unmute the session's replies for this person (0678). Muting takes * its current reply out of their inbox. Null when the session is not in the * workspace. */ export declare function setSessionRepliesMuted(db: Database, input: { workspaceId: string; sessionId: string; subjectId: string; muted: boolean; }): Promise; /** * What a mute on this session covers (0915): "schedule" when a schedule that * starts a new session per run started it, so muting covers all its runs; * otherwise "session". */ export declare function getSessionReplyMuteScope(db: Database, input: { workspaceId: string; sessionId: string; }): Promise<"session" | "schedule">;