import { type MessageMedia } from './registry.js'; import type { JsonObject } from '../shared/types.js'; /** * The durable identity of one agent-initiated (lateral) send. * * Derived from the send's CONTENT — caller, target, message — rather than from * the MCP call's `x-jinn-activity-operation` id, because that id is minted per * `tools/call` inside the MCP server process: a transport replay of the same * pending call re-mints it, so it cannot name the retry it would have to * collapse. Caller, target and message body survive the replay and can. */ export declare function lateralSendDedupeKey(callerSessionId: string, targetSessionId: string, message: string): string; export type IncomingTurnClaim = { deduplicated: true; queueItemId: string; messageId?: string; } | { deduplicated: false; queueItemId?: string; messageId: string; }; export interface IncomingTurn { sessionId: string; sessionKey: string; /** Engine-facing text, queued verbatim so a crash before dispatch replays it. */ prompt: string; /** Notifications queue a durable internal intent; user messages are enqueued * by the caller as a visible queue-panel item instead. */ isNotification: boolean; role: string; /** What the transcript stores — the display banner for a notification. */ content: string; media?: MessageMedia[]; meta?: JsonObject; /** Set only for tool-origin lateral sends; absent means no dedupe at all, so * the operator/UI path is unchanged. */ dedupeKey?: string; /** Preserve this identity after the queue item settles. Used when the caller * has a true operation id (Talk provider call), never for content-derived * lateral-send keys where a later identical sentence is a new intent. */ durableDedupe?: boolean; /** Notifications default to an internal queue row. Talk operator turns are * visible user work and opt into the ordinary queue surface. */ queueVisibility?: 'internal' | 'visible'; } /** * Accept an incoming turn in ONE transaction, so a failed message write can * never leave an orphan queue row behind (or the reverse). * * With a `dedupeKey`, the partial unique index on `queue_items.dedupe_key` is * the concurrency arbiter: a replayed send inserts nothing, writes no second * message, and reuses the winning row's id — the same shape * `claimSessionDelivery` gives the child-callback outbox. */ export declare function claimIncomingTurn(turn: IncomingTurn): IncomingTurnClaim; //# sourceMappingURL=incoming-turn.d.ts.map