/** * report — universal "rich digest" structured object + per-destination * renderers. * * Why this lives in @zibby/skills (not workflow-templates): * * - The SCHEMA is the contract between any producer (analyze nodes * in digest workflows) and any consumer (notify-slack / * notify-lark / future notify-notion / etc.). Centralizing it here * keeps producer and consumer in lockstep without circular * dependencies between sibling templates. * * - The RENDERERS (reportToBlockKit, reportToLarkCard) are * deterministic functions — pure mapping from report-object to the * destination's native rich-card spec. They can be unit-tested in * isolation; the notify-* templates wire them into their execute * paths. * * - Adding `notify-notion` later means writing a `reportToNotionBlocks` * here, then a thin template node that imports it. No changes to * existing templates or the schema. * * Format: 6 section kinds — headline, trend, table, callouts, * breakdown, paragraph. Each section is rendered to native Slack * Block-Kit / Lark-Card components. NO third-party chart-rendering, * NO image generation — we rely on the IM platform's native UI. */ import { z } from 'zod'; export declare const SEVERITIES: readonly ["ok", "info", "warn", "critical"]; export declare const reportObjectSchema: z.ZodObject<{ title: z.ZodString; subtitle: z.ZodOptional; headline: z.ZodObject<{ primary: z.ZodString; delta: z.ZodOptional>; severity: z.ZodOptional>; }, "strip", z.ZodTypeAny, { severity?: "warn" | "info" | "critical" | "ok"; value?: string; direction?: "flat" | "up" | "down"; }, { severity?: "warn" | "info" | "critical" | "ok"; value?: string; direction?: "flat" | "up" | "down"; }>>; summary: z.ZodOptional; }, "strip", z.ZodTypeAny, { summary?: string; primary?: string; delta?: { severity?: "warn" | "info" | "critical" | "ok"; value?: string; direction?: "flat" | "up" | "down"; }; }, { summary?: string; primary?: string; delta?: { severity?: "warn" | "info" | "critical" | "ok"; value?: string; direction?: "flat" | "up" | "down"; }; }>; sections: z.ZodEffects; title: z.ZodOptional; labels: z.ZodArray; values: z.ZodArray; highlight: z.ZodOptional>>; severity: z.ZodOptional>; }, "strip", z.ZodTypeAny, { values?: number[]; kind?: "trend"; title?: string; severity?: "warn" | "info" | "critical" | "ok"; labels?: string[]; highlight?: "none" | "last" | "max" | "min"; }, { values?: number[]; kind?: "trend"; title?: string; severity?: "warn" | "info" | "critical" | "ok"; labels?: string[]; highlight?: "none" | "last" | "max" | "min"; }>, z.ZodObject<{ kind: z.ZodLiteral<"table">; title: z.ZodOptional; headers: z.ZodArray; rows: z.ZodArray, "many">, "many">; }, "strip", z.ZodTypeAny, { kind?: "table"; title?: string; headers?: string[]; rows?: (string | number)[][]; }, { kind?: "table"; title?: string; headers?: string[]; rows?: (string | number)[][]; }>, z.ZodObject<{ kind: z.ZodLiteral<"callouts">; title: z.ZodOptional; tone: z.ZodOptional>>; items: z.ZodArray; }, "strip", z.ZodTypeAny, { kind?: "callouts"; title?: string; items?: string[]; tone?: "warn" | "info" | "critical" | "ok"; }, { kind?: "callouts"; title?: string; items?: string[]; tone?: "warn" | "info" | "critical" | "ok"; }>, z.ZodObject<{ kind: z.ZodLiteral<"breakdown">; title: z.ZodOptional; rows: z.ZodArray; severity: z.ZodOptional>; }, "strip", z.ZodTypeAny, { label?: string; sub?: string; severity?: "warn" | "info" | "critical" | "ok"; value?: string; }, { label?: string; sub?: string; severity?: "warn" | "info" | "critical" | "ok"; value?: string; }>, "many">; }, "strip", z.ZodTypeAny, { kind?: "breakdown"; title?: string; rows?: { label?: string; sub?: string; severity?: "warn" | "info" | "critical" | "ok"; value?: string; }[]; }, { kind?: "breakdown"; title?: string; rows?: { label?: string; sub?: string; severity?: "warn" | "info" | "critical" | "ok"; value?: string; }[]; }>, z.ZodObject<{ kind: z.ZodLiteral<"paragraph">; title: z.ZodOptional; text: z.ZodString; }, "strip", z.ZodTypeAny, { kind?: "paragraph"; text?: string; title?: string; }, { kind?: "paragraph"; text?: string; title?: string; }>]>, "many">>, ({ values?: number[]; kind?: "trend"; title?: string; severity?: "warn" | "info" | "critical" | "ok"; labels?: string[]; highlight?: "none" | "last" | "max" | "min"; } | { kind?: "table"; title?: string; headers?: string[]; rows?: (string | number)[][]; } | { kind?: "callouts"; title?: string; items?: string[]; tone?: "warn" | "info" | "critical" | "ok"; } | { kind?: "breakdown"; title?: string; rows?: { label?: string; sub?: string; severity?: "warn" | "info" | "critical" | "ok"; value?: string; }[]; } | { kind?: "paragraph"; text?: string; title?: string; })[], ({ values?: number[]; kind?: "trend"; title?: string; severity?: "warn" | "info" | "critical" | "ok"; labels?: string[]; highlight?: "none" | "last" | "max" | "min"; } | { kind?: "table"; title?: string; headers?: string[]; rows?: (string | number)[][]; } | { kind?: "callouts"; title?: string; items?: string[]; tone?: "warn" | "info" | "critical" | "ok"; } | { kind?: "breakdown"; title?: string; rows?: { label?: string; sub?: string; severity?: "warn" | "info" | "critical" | "ok"; value?: string; }[]; } | { kind?: "paragraph"; text?: string; title?: string; })[]>; footer: z.ZodOptional; rerunUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { viewUrl?: string; rerunUrl?: string; }, { viewUrl?: string; rerunUrl?: string; }>>; }, "strip", z.ZodTypeAny, { title?: string; footer?: { viewUrl?: string; rerunUrl?: string; }; subtitle?: string; headline?: { summary?: string; primary?: string; delta?: { severity?: "warn" | "info" | "critical" | "ok"; value?: string; direction?: "flat" | "up" | "down"; }; }; sections?: ({ values?: number[]; kind?: "trend"; title?: string; severity?: "warn" | "info" | "critical" | "ok"; labels?: string[]; highlight?: "none" | "last" | "max" | "min"; } | { kind?: "table"; title?: string; headers?: string[]; rows?: (string | number)[][]; } | { kind?: "callouts"; title?: string; items?: string[]; tone?: "warn" | "info" | "critical" | "ok"; } | { kind?: "breakdown"; title?: string; rows?: { label?: string; sub?: string; severity?: "warn" | "info" | "critical" | "ok"; value?: string; }[]; } | { kind?: "paragraph"; text?: string; title?: string; })[]; }, { title?: string; footer?: { viewUrl?: string; rerunUrl?: string; }; subtitle?: string; headline?: { summary?: string; primary?: string; delta?: { severity?: "warn" | "info" | "critical" | "ok"; value?: string; direction?: "flat" | "up" | "down"; }; }; sections?: ({ values?: number[]; kind?: "trend"; title?: string; severity?: "warn" | "info" | "critical" | "ok"; labels?: string[]; highlight?: "none" | "last" | "max" | "min"; } | { kind?: "table"; title?: string; headers?: string[]; rows?: (string | number)[][]; } | { kind?: "callouts"; title?: string; items?: string[]; tone?: "warn" | "info" | "critical" | "ok"; } | { kind?: "breakdown"; title?: string; rows?: { label?: string; sub?: string; severity?: "warn" | "info" | "critical" | "ok"; value?: string; }[]; } | { kind?: "paragraph"; text?: string; title?: string; })[]; }>; /** * Convert a report-object → Slack Block-Kit `blocks` array. * * Pure function: input → output, no I/O. Throws on invalid input * (zod parse error). Callers should validate before calling if they * want softer error messages. * * @param {z.infer} report * @returns {Object[]} Block Kit blocks suitable for chat.postMessage's * `blocks` field. */ export declare function reportToBlockKit(report: any): any[]; /** * Convert a report-object → Lark interactive-card JSON. * * @param {z.infer} report * @returns {Object} Lark message card payload — use as `card` field on * im/v1/messages with msg_type=interactive. */ export declare function reportToLarkCard(report: any): { config: { wide_screen_mode: boolean; }; header: { title: { tag: string; content: string; }; subtitle: { tag: string; content: string; }; template: string; }; elements: any[]; }; /** * Convert a report-object → Notion blocks payload. * * Returns three things rather than just `blocks` because Notion's * page-create endpoint takes title + icon as page properties (separate * from the children blocks). Callers wire them as: * POST /v1/pages * { parent: { database_id }, properties: { Name: { title: [...] } }, * icon: { type: 'emoji', emoji }, children: blocks } * — or, for append-to-existing-page: * PATCH /v1/blocks/{pageId}/children * { children: blocks } * (the title + icon are dropped when appending). * * Pure function: input → output, no I/O. Throws on invalid input * (zod parse error). Notion's block schema documented at: * https://developers.notion.com/reference/block * * @param {z.infer} report * @returns {{ blocks: Object[], title: string, icon?: string }} * blocks: array of Notion block objects (no `id` / `parent` — those * are server-assigned at create time) * title: string for the page's Name title property * icon: optional severity-mapped emoji for the page icon */ export declare function reportToNotionBlocks(report: any): { blocks: any[]; title: string; icon: "🟢" | "ℹ️" | "⚠️" | "🚨"; }; /** * Convert a report-object → a single markdown string. * * This is the SHARED path for the document channels (Google Docs / Lark * Docs / Notion via their create/append tools, which all accept markdown): * one renderer, three destinations, each destination's own * markdown-to-native converter does the final mapping. Layout mirrors the * chat-card renderers 1:1 so a report reads the same everywhere: * - title as `#`, subtitle as a plain line under it * - headline: bold primary + delta arrow + severity emoji + summary * - trend: fenced code block with the same unicodeBar lines * - table: a real markdown pipe table * - callouts: severity-emoji bullets * - breakdown: bold-label bullets * - paragraph: text as-is * - footer: markdown links * * Pure function: input → output, no I/O. Throws on invalid input * (zod parse error) — same contract as the other renderers. * * @param {z.infer} report * @returns {string} full markdown document */ export declare function reportToMarkdown(report: any): string;