import type { ISessionClient } from "../platform/ports/session-client.ts"; import type { NotificationMessage, NotificationEventType, NotificationEventConfig, NotificationTemplateVars } from "./types.ts"; /** * Simple `{var_name}` template replacement. * * Replaces all `{identifier}` placeholders with their corresponding value * from `vars`. Unknown variables remain as-is in the output. * * @param template - Template string containing `{var_name}` placeholders. * @param vars - Flat key-value map of template variables. * @returns The rendered string with variables substituted. */ export declare function renderTemplate(template: string, vars: NotificationTemplateVars): string; /** * Build a flat `NotificationTemplateVars` record from session and event params. * * Every key is guaranteed to exist (empty string for missing optional fields). * `timestamp` is set to the current time at call time. */ export declare function buildTemplateVars(params: { sessionId: string; eventType: NotificationEventType; agent?: string; roleName?: string; sessionTitle?: string; lastUserMessage?: string; lastAssistantMessage?: string; }): NotificationTemplateVars; /** * Extract text from message parts where `type === "text"`. * Trims each text segment, filters out empty strings, and joins with `\n`. */ export declare function extractMessageText(parts: Array<{ type: string; text?: string; }>): string; /** * Collapse multi-line whitespace into a single line. * Splits by newlines, trims each line, filters empties, and joins with a single space. */ export declare function collapseWhitespace(text: string): string; /** * Get the last non-empty line from a multi-line string. * Splits by newlines, trims each line, filters empties, and returns the last * element, or `""` if there are no non-empty lines. */ export declare function getLastNonEmptyLine(text: string): string; /** * Read session title and last user/assistant messages from the opencode SDK. * * API calls are wrapped in try/catch — failures return an empty object * (never throws). * * The optional `dir` parameter controls which project workspace is queried. * * @param client - The opencode plugin client for SDK API calls. * @param sessionID - The session ID to read. * @param dir - Optional workspace directory (defaults to `process.cwd()`). * @returns Session title, last user message text, and last assistant message text. */ export declare function readSessionInfo(client: ISessionClient, sessionID: string, dir?: string): Promise<{ title?: string; lastUserMessage?: string; lastAssistantMessage?: string; }>; /** * Build a fully populated `NotificationMessage` by reading session info * and rendering event-appropriate templates. * * Default templates: * - Title: `"Rolebox · {event_type}"` * - Body: `"{session_title}"` * * Title is truncated to 256 characters, body to 4000 characters. * On any error, returns a minimal `NotificationMessage` with the raw fields. * * @param params - Parameters including session ID, event type, optional * event config, client, agent, role name, directory, and * any extra template variables (e.g. graph_id / node_id for * structured events) merged over the base vars before rendering. * @returns A fully populated `NotificationMessage`. */ export declare function buildNotificationContent(params: { sessionID: string; eventType: NotificationEventType; eventConfig?: NotificationEventConfig; client: ISessionClient; agent?: string; roleName?: string; dir?: string; extraVars?: NotificationTemplateVars; }): Promise; //# sourceMappingURL=content.d.ts.map