/** * Notification delivery for parent sessions. * * Re-activated in Phase 16.2 for terminal-state delegation notifications. * Provides fire-and-forget SDK prompt delivery with structured payload. * * Audit: G-01 closed as by-design (2026-04-21) */ import { type OpenCodeClient } from "../../shared/session-api.js"; import type { Delegation } from "../../shared/types.js"; import type { TaskNotification } from "../../shared/types.js"; export declare function buildNotificationMessage(task: TaskNotification): string; export declare function formatToastMessage(task: TaskNotification): string; /** * Reactivate a stopped parent session stream by sending an empty async prompt. * * Reserved for Step 3 (stream reactivation). Uses `sendPromptAsync()` instead of * `sendPrompt()` to avoid blocking and avoid unnecessary response handling. * Best-effort: if reactivation fails, notification is still delivered. */ export declare function reactivateSessionStream(client: OpenCodeClient, sessionID: string): Promise; /** * Deliver a notification to the parent session using two mechanisms: * * 1. **Toast** - `showTuiToast()` — user-visible, transient, agent-invisible * 2. **Context injection** - `sendPromptAsync()` — fire-and-forget message that * agent sees in its context window. Uses `noReply: true` (no AI auto-response). * * Step 1 of the notification redesign (2026-05-23): * - Replaces `appendTuiPrompt()` with `showTuiToast()` — fixes input pollution bug * - Replaces `sendPrompt()` with `sendPromptAsync()` — no blocking, no response wait * - Removes `remove `synthetic: true` — it's a TextPart-level property, not message-level * * @param client - OpenCode SDK client * @param parentSessionID - The parent session to notify * @param task - Notification task payload * @returns `true` when context injection succeeds, `false` on failure */ export declare function notifyParentSession(client: OpenCodeClient, parentSessionID: string, task: TaskNotification): Promise; export declare function replayPendingNotifications(client: OpenCodeClient, parentSessionID: string, notifications: TaskNotification[]): Promise; /** * Fire-and-forget notification of a delegation's terminal state to its parent session. * * P59 C1/C2: Deduplicates completion notifications — if the same notification * message was already delivered for this delegation, skip re-injection. This * prevents the tag from being re-inserted into the parent's * context on consecutive turns, which was the root cause of the agent-looping * behavior (observed: 7 consecutive identical messages within 2 minutes). * * Step 1 implementation: * - Uses `showTuiToast()` for user visibility * - Uses `sendPromptAsync()` for fire-and-forget context injection into parent session * * R-NOTIF-02: Payload contains taskId, terminalState, resultSummary, duration. * R-NOTIF-03: Delivery failure does NOT block the terminal transition. */ export declare function notifyDelegationTerminal(client: OpenCodeClient, delegation: Delegation): Promise; export type { TaskNotification }; //# sourceMappingURL=notification-handler.d.ts.map