@zibby/skills 0.1.72 → 0.1.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/report.js CHANGED
@@ -1,12 +1,13 @@
1
- import{z as a}from"zod";var g=["ok","info","warn","critical"],R=a.object({primary:a.string().min(1).max(200).describe('Headline number or phrase (e.g. "$8,240"). Rendered in large/bold.'),delta:a.object({value:a.string().max(40).describe('Delta vs baseline (e.g. "+12% wow"). Free-form string.'),direction:a.enum(["up","down","flat"]).optional(),severity:a.enum(g).optional().describe("Color severity for the delta (warn/critical highlights regressions).")}).optional().describe("Optional comparison vs baseline. Renders inline next to primary."),summary:a.string().max(800).optional().describe('One-sentence narrative ("why this number"). Plain prose.')}),U=a.object({kind:a.literal("trend"),title:a.string().max(120).optional(),labels:a.array(a.string().max(60)).min(2).max(20).describe('Bucket labels (e.g. ["Week-3", "Week-2", "Week-1", "This wk"]).'),values:a.array(a.number()).min(2).max(20).describe("Numeric values, one per label. Must match labels.length."),highlight:a.enum(["last","max","min","none"]).default("last").optional().describe("Which bucket to visually highlight in the rendered card."),severity:a.enum(g).optional()}),E=a.object({kind:a.literal("table"),title:a.string().max(120).optional(),headers:a.array(a.string().max(40)).min(1).max(8),rows:a.array(a.array(a.union([a.string().max(200),a.number()])).min(1).max(8)).max(40).describe("2D matrix. Each inner array must have headers.length entries.")}),O=a.object({kind:a.literal("callouts"),title:a.string().max(120).optional(),tone:a.enum(g).default("info").optional(),items:a.array(a.string().min(1).max(600)).min(1).max(10).describe("Each item renders as a bullet with a severity emoji.")}),T=a.object({kind:a.literal("breakdown"),title:a.string().max(120).optional(),rows:a.array(a.object({label:a.string().min(1).max(80),value:a.string().min(1).max(80),sub:a.string().max(120).optional(),severity:a.enum(g).optional()})).min(1).max(20)}),M=a.object({kind:a.literal("paragraph"),title:a.string().max(120).optional(),text:a.string().min(1).max(3e3)}),I=a.discriminatedUnion("kind",[U,E,O,T,M]),k=a.object({title:a.string().min(1).max(200).describe('Card title (e.g. "Weekly AI Spend Report").'),subtitle:a.string().max(200).optional().describe('Date range or smaller header (e.g. "May 13 \u2014 May 20").'),headline:R,sections:a.array(I).max(20).default([]).superRefine((s,e)=>{s.forEach((t,l)=>{t.kind==="trend"&&t.labels.length!==t.values.length&&e.addIssue({code:a.ZodIssueCode.custom,path:[l,"values"],message:"labels.length must equal values.length"}),t.kind==="table"&&!t.rows.every(c=>c.length===t.headers.length)&&e.addIssue({code:a.ZodIssueCode.custom,path:[l,"rows"],message:"every row must have headers.length entries"})})}),footer:a.object({viewUrl:a.string().url().optional().describe('Optional "View in Zibby" button URL.'),rerunUrl:a.string().url().optional().describe('Optional "Run again" button URL.')}).optional()}),p=Object.freeze({ok:"\u{1F7E2}",info:"\u{1F535}",warn:"\u{1F7E0}",critical:"\u{1F534}"}),w=Object.freeze({up:"\u2191",down:"\u2193",flat:"\u2192"}),L=Object.freeze({ok:"green",info:"blue",warn:"orange",critical:"red"});function _(s,e,t=12){if(!Number.isFinite(s)||!Number.isFinite(e)||e<=0)return"";let l=Math.max(0,Math.min(1,s/e)),c=Math.round(l*t);return"\u2593".repeat(c)+"\u2591".repeat(t-c)}function y(s,e){let t=String(s);return t.length>=e?t:t+" ".repeat(e-t.length)}function $(s,e){let t=String(s);return t.length>=e?t:" ".repeat(e-t.length)+t}function S({headers:s,rows:e}){let t=s.map((n,r)=>{let o=Math.max(String(n).length,...e.map(h=>String(h[r]??"").length));return Math.min(o,32)}),l=n=>n.map((r,o)=>y(r,t[o])).join(" "),c=t.map(n=>"\u2500".repeat(n)).join(" ");return"```\n"+[l(s),c,...e.map(n=>l(n))].join(`
2
- `)+"\n```"}function z(s){let e=k.parse(s),t=[];t.push({type:"header",text:{type:"plain_text",text:e.title.slice(0,150),emoji:!0}}),e.subtitle&&t.push({type:"context",elements:[{type:"mrkdwn",text:e.subtitle}]});let l=[`*${e.headline.primary}*`];if(e.headline.delta){let i=w[e.headline.delta.direction]||"",n=e.headline.delta.severity?p[e.headline.delta.severity]:"";l.push(`${i} ${e.headline.delta.value} ${n}`.trim())}let c=l.join(" ");e.headline.summary&&(c+=`
3
- `+e.headline.summary),t.push({type:"section",text:{type:"mrkdwn",text:c}});for(let i of e.sections)switch(t.push({type:"divider"}),i.title&&t.push({type:"section",text:{type:"mrkdwn",text:`*${i.title}*`}}),i.kind){case"trend":{let n=Math.max(...i.values),r=i.labels.map((o,h)=>{let d=i.values[h],u=_(d,n),x=(i.highlight==="last"&&h===i.labels.length-1||i.highlight==="max"&&d===n||i.highlight==="min"&&d===Math.min(...i.values))&&i.severity?` ${p[i.severity]}`:"";return`${y(o,10)} ${$(d.toLocaleString(),8)} ${u}${x}`});t.push({type:"section",text:{type:"mrkdwn",text:"```\n"+r.join(`
4
- `)+"\n```"}});break}case"table":{t.push({type:"section",text:{type:"mrkdwn",text:S(i)}});break}case"callouts":{let n=p[i.tone||"info"];t.push({type:"section",text:{type:"mrkdwn",text:i.items.map(r=>`${n} ${r}`).join(`
5
- `)}});break}case"breakdown":{let n=i.rows.map(r=>({type:"mrkdwn",text:`*${r.label}*
1
+ import{z as i}from"zod";var y=["ok","info","warn","critical"],R=i.object({primary:i.string().min(1).max(200).describe('Headline number or phrase (e.g. "$8,240"). Rendered in large/bold.'),delta:i.object({value:i.string().max(40).describe('Delta vs baseline (e.g. "+12% wow"). Free-form string.'),direction:i.enum(["up","down","flat"]).optional(),severity:i.enum(y).optional().describe("Color severity for the delta (warn/critical highlights regressions).")}).optional().describe("Optional comparison vs baseline. Renders inline next to primary."),summary:i.string().max(800).optional().describe('One-sentence narrative ("why this number"). Plain prose.')}),M=i.object({kind:i.literal("trend"),title:i.string().max(120).optional(),labels:i.array(i.string().max(60)).min(2).max(20).describe('Bucket labels (e.g. ["Week-3", "Week-2", "Week-1", "This wk"]).'),values:i.array(i.number()).min(2).max(20).describe("Numeric values, one per label. Must match labels.length."),highlight:i.enum(["last","max","min","none"]).default("last").optional().describe("Which bucket to visually highlight in the rendered card."),severity:i.enum(y).optional()}),T=i.object({kind:i.literal("table"),title:i.string().max(120).optional(),headers:i.array(i.string().max(40)).min(1).max(8),rows:i.array(i.array(i.union([i.string().max(200),i.number()])).min(1).max(8)).max(40).describe("2D matrix. Each inner array must have headers.length entries.")}),E=i.object({kind:i.literal("callouts"),title:i.string().max(120).optional(),tone:i.enum(y).default("info").optional(),items:i.array(i.string().min(1).max(600)).min(1).max(10).describe("Each item renders as a bullet with a severity emoji.")}),O=i.object({kind:i.literal("breakdown"),title:i.string().max(120).optional(),rows:i.array(i.object({label:i.string().min(1).max(80),value:i.string().min(1).max(80),sub:i.string().max(120).optional(),severity:i.enum(y).optional()})).min(1).max(20)}),I=i.object({kind:i.literal("paragraph"),title:i.string().max(120).optional(),text:i.string().min(1).max(3e3)}),L=i.discriminatedUnion("kind",[M,T,E,O,I]),x=i.object({title:i.string().min(1).max(200).describe('Card title (e.g. "Weekly AI Spend Report").'),subtitle:i.string().max(200).optional().describe('Date range or smaller header (e.g. "May 13 \u2014 May 20").'),headline:R,sections:i.array(L).max(20).default([]).superRefine((s,e)=>{s.forEach((t,c)=>{t.kind==="trend"&&t.labels.length!==t.values.length&&e.addIssue({code:i.ZodIssueCode.custom,path:[c,"values"],message:"labels.length must equal values.length"}),t.kind==="table"&&!t.rows.every(o=>o.length===t.headers.length)&&e.addIssue({code:i.ZodIssueCode.custom,path:[c,"rows"],message:"every row must have headers.length entries"})})}),footer:i.object({viewUrl:i.string().url().optional().describe('Optional "View in Zibby" button URL.'),rerunUrl:i.string().url().optional().describe('Optional "Run again" button URL.')}).optional()}),d=Object.freeze({ok:"\u{1F7E2}",info:"\u{1F535}",warn:"\u{1F7E0}",critical:"\u{1F534}"}),v=Object.freeze({up:"\u2191",down:"\u2193",flat:"\u2192"}),V=Object.freeze({ok:"green",info:"blue",warn:"orange",critical:"red"});function k(s,e,t=12){if(!Number.isFinite(s)||!Number.isFinite(e)||e<=0)return"";let c=Math.max(0,Math.min(1,s/e)),o=Math.round(c*t);return"\u2593".repeat(o)+"\u2591".repeat(t-o)}function f(s,e){let t=String(s);return t.length>=e?t:t+" ".repeat(e-t.length)}function $(s,e){let t=String(s);return t.length>=e?t:" ".repeat(e-t.length)+t}function U({headers:s,rows:e}){let t=s.map((a,r)=>{let l=Math.max(String(a).length,...e.map(h=>String(h[r]??"").length));return Math.min(l,32)}),c=a=>a.map((r,l)=>f(r,t[l])).join(" "),o=t.map(a=>"\u2500".repeat(a)).join(" ");return"```\n"+[c(s),o,...e.map(a=>c(a))].join(`
2
+ `)+"\n```"}function z(s){let e=x.parse(s),t=[];t.push({type:"header",text:{type:"plain_text",text:e.title.slice(0,150),emoji:!0}}),e.subtitle&&t.push({type:"context",elements:[{type:"mrkdwn",text:e.subtitle}]});let c=[`*${e.headline.primary}*`];if(e.headline.delta){let n=v[e.headline.delta.direction]||"",a=e.headline.delta.severity?d[e.headline.delta.severity]:"";c.push(`${n} ${e.headline.delta.value} ${a}`.trim())}let o=c.join(" ");e.headline.summary&&(o+=`
3
+ `+e.headline.summary),t.push({type:"section",text:{type:"mrkdwn",text:o}});for(let n of e.sections)switch(t.push({type:"divider"}),n.title&&t.push({type:"section",text:{type:"mrkdwn",text:`*${n.title}*`}}),n.kind){case"trend":{let a=Math.max(...n.values),r=n.labels.map((l,h)=>{let u=n.values[h],p=k(u,a),g=(n.highlight==="last"&&h===n.labels.length-1||n.highlight==="max"&&u===a||n.highlight==="min"&&u===Math.min(...n.values))&&n.severity?` ${d[n.severity]}`:"";return`${f(l,10)} ${$(u.toLocaleString(),8)} ${p}${g}`});t.push({type:"section",text:{type:"mrkdwn",text:"```\n"+r.join(`
4
+ `)+"\n```"}});break}case"table":{t.push({type:"section",text:{type:"mrkdwn",text:U(n)}});break}case"callouts":{let a=d[n.tone||"info"];t.push({type:"section",text:{type:"mrkdwn",text:n.items.map(r=>`${a} ${r}`).join(`
5
+ `)}});break}case"breakdown":{let a=n.rows.map(r=>({type:"mrkdwn",text:`*${r.label}*
6
6
  ${r.value}${r.sub?`
7
- _${r.sub}_`:""}${r.severity?` ${p[r.severity]}`:""}`}));for(let r=0;r<n.length;r+=10)t.push({type:"section",fields:n.slice(r,r+10)});break}case"paragraph":{t.push({type:"section",text:{type:"mrkdwn",text:i.text}});break}}if(e.footer&&(e.footer.viewUrl||e.footer.rerunUrl)){let i=[];e.footer.viewUrl&&i.push({type:"button",text:{type:"plain_text",text:"View in Zibby"},url:e.footer.viewUrl,style:"primary"}),e.footer.rerunUrl&&i.push({type:"button",text:{type:"plain_text",text:"Run again"},url:e.footer.rerunUrl}),t.push({type:"divider"}),t.push({type:"actions",elements:i})}return t}function A(s){let e=k.parse(s),t=[],l=[`**${e.headline.primary}**`];if(e.headline.delta){let n=w[e.headline.delta.direction]||"",r=e.headline.delta.severity?p[e.headline.delta.severity]:"";l.push(`${n} ${e.headline.delta.value} ${r}`.trim())}let c=l.join(" ");e.headline.summary&&(c+=`
8
- `+e.headline.summary),t.push({tag:"div",text:{tag:"lark_md",content:c}});for(let n of e.sections)switch(t.push({tag:"hr"}),n.title&&t.push({tag:"div",text:{tag:"lark_md",content:`**${n.title}**`}}),n.kind){case"trend":{let r=Math.max(...n.values),o=n.labels.map((h,d)=>{let u=n.values[d],b=_(u,r),f=(n.highlight==="last"&&d===n.labels.length-1||n.highlight==="max"&&u===r||n.highlight==="min"&&u===Math.min(...n.values))&&n.severity?` ${p[n.severity]}`:"";return`${y(h,10)} ${$(u.toLocaleString(),8)} ${b}${f}`});t.push({tag:"div",text:{tag:"lark_md",content:"```\n"+o.join(`
9
- `)+"\n```"}});break}case"table":{t.push({tag:"div",text:{tag:"lark_md",content:S(n)}});break}case"callouts":{let r=p[n.tone||"info"];t.push({tag:"div",text:{tag:"lark_md",content:n.items.map(o=>`${r} ${o}`).join(`
10
- `)}});break}case"breakdown":{let r=n.rows.map(o=>{let h=o.severity?` ${p[o.severity]}`:"",d=o.sub?` *${o.sub}*`:"";return`**${o.label}** ${o.value}${d}${h}`});t.push({tag:"div",text:{tag:"lark_md",content:r.join(`
11
- `)}});break}case"paragraph":{t.push({tag:"div",text:{tag:"lark_md",content:n.text}});break}}if(e.footer&&(e.footer.viewUrl||e.footer.rerunUrl)){let n=[];e.footer.viewUrl&&n.push({tag:"button",text:{tag:"plain_text",content:"View in Zibby"},url:e.footer.viewUrl,type:"primary"}),e.footer.rerunUrl&&n.push({tag:"button",text:{tag:"plain_text",content:"Run again"},url:e.footer.rerunUrl,type:"default"}),t.push({tag:"hr"}),t.push({tag:"action",actions:n})}let i="blue";return e.headline.delta?.severity&&(i=L[e.headline.delta.severity]||"blue"),{config:{wide_screen_mode:!0},header:{title:{tag:"plain_text",content:e.title.slice(0,200)},subtitle:e.subtitle?{tag:"plain_text",content:e.subtitle.slice(0,200)}:void 0,template:i},elements:t}}var N=Object.freeze({ok:"green_background",info:"blue_background",warn:"orange_background",critical:"red_background"}),j=Object.freeze({ok:"\u{1F7E2}",info:"\u2139\uFE0F",warn:"\u26A0\uFE0F",critical:"\u{1F6A8}"});function m(s,e={}){let t={type:"text",text:{content:String(s).slice(0,2e3)}};return e.annotations&&(t.annotations=e.annotations),[t]}function v(s,e){let t={object:"block",type:"paragraph",paragraph:{rich_text:m(s)}};return e&&(t.paragraph.color=e),t}function V(s){return{object:"block",type:"code",code:{rich_text:m(s),language:"plain text"}}}function W(s){let e=k.parse(s),t=[];t.push({object:"block",type:"heading_1",heading_1:{rich_text:m(e.title.slice(0,200))}}),e.subtitle&&t.push(v(e.subtitle,"gray_background"));let l=[{type:"text",text:{content:e.headline.primary.slice(0,200)},annotations:{bold:!0}}];if(e.headline.delta){let i=w[e.headline.delta.direction]||"",n=e.headline.delta.severity?p[e.headline.delta.severity]:"",r=` ${i} ${e.headline.delta.value} ${n}`.trimEnd();l.push({type:"text",text:{content:r}})}t.push({object:"block",type:"paragraph",paragraph:{rich_text:l}}),e.headline.summary&&t.push(v(e.headline.summary));for(let i of e.sections)switch(t.push({object:"block",type:"divider",divider:{}}),i.title&&t.push({object:"block",type:"heading_2",heading_2:{rich_text:m(i.title)}}),i.kind){case"trend":{let n=Math.max(...i.values),r=Math.min(...i.values),o=i.labels.map((h,d)=>{let u=i.values[d],b=_(u,n),f=(i.highlight==="last"&&d===i.labels.length-1||i.highlight==="max"&&u===n||i.highlight==="min"&&u===r)&&i.severity?` ${p[i.severity]}`:"";return`${y(h,10)} ${$(u.toLocaleString(),8)} ${b}${f}`});t.push(V(o.join(`
12
- `)));break}case"table":{let n={object:"block",type:"table_row",table_row:{cells:i.headers.map(o=>m(o))}},r=i.rows.map(o=>({object:"block",type:"table_row",table_row:{cells:o.map(h=>m(String(h)))}}));t.push({object:"block",type:"table",table:{table_width:i.headers.length,has_column_header:!0,has_row_header:!1,children:[n,...r]}});break}case"callouts":{let n=i.tone||"info",r=j[n],o=N[n];for(let h of i.items)t.push({object:"block",type:"callout",callout:{rich_text:m(h),icon:{type:"emoji",emoji:r},color:o}});break}case"breakdown":{for(let n of i.rows){let r=[{type:"text",text:{content:`${n.label}: `},annotations:{bold:!0}},{type:"text",text:{content:String(n.value)}}];n.sub&&r.push({type:"text",text:{content:` (${n.sub})`},annotations:{italic:!0}}),n.severity&&r.push({type:"text",text:{content:` ${p[n.severity]}`}}),t.push({object:"block",type:"bulleted_list_item",bulleted_list_item:{rich_text:r}})}break}case"paragraph":{t.push(v(i.text));break}}e.footer&&(e.footer.viewUrl||e.footer.rerunUrl)&&(t.push({object:"block",type:"divider",divider:{}}),e.footer.viewUrl&&t.push({object:"block",type:"embed",embed:{url:e.footer.viewUrl}}),e.footer.rerunUrl&&t.push({object:"block",type:"embed",embed:{url:e.footer.rerunUrl}}));let c=e.headline.delta?.severity?j[e.headline.delta.severity]:void 0;return{blocks:t,title:e.title.slice(0,200),icon:c}}export{g as SEVERITIES,k as reportObjectSchema,z as reportToBlockKit,A as reportToLarkCard,W as reportToNotionBlocks};
7
+ _${r.sub}_`:""}${r.severity?` ${d[r.severity]}`:""}`}));for(let r=0;r<a.length;r+=10)t.push({type:"section",fields:a.slice(r,r+10)});break}case"paragraph":{t.push({type:"section",text:{type:"mrkdwn",text:n.text}});break}}if(e.footer&&(e.footer.viewUrl||e.footer.rerunUrl)){let n=[];e.footer.viewUrl&&n.push({type:"button",text:{type:"plain_text",text:"View in Zibby"},url:e.footer.viewUrl,style:"primary"}),e.footer.rerunUrl&&n.push({type:"button",text:{type:"plain_text",text:"Run again"},url:e.footer.rerunUrl}),t.push({type:"divider"}),t.push({type:"actions",elements:n})}return t}function A(s){let e=x.parse(s),t=[],c=[`**${e.headline.primary}**`];if(e.headline.delta){let a=v[e.headline.delta.direction]||"",r=e.headline.delta.severity?d[e.headline.delta.severity]:"";c.push(`${a} ${e.headline.delta.value} ${r}`.trim())}let o=c.join(" ");e.headline.summary&&(o+=`
8
+ `+e.headline.summary),t.push({tag:"div",text:{tag:"lark_md",content:o}});for(let a of e.sections)switch(t.push({tag:"hr"}),a.title&&t.push({tag:"div",text:{tag:"lark_md",content:`**${a.title}**`}}),a.kind){case"trend":{let r=Math.max(...a.values),l=a.labels.map((h,u)=>{let p=a.values[u],b=k(p,r),w=(a.highlight==="last"&&u===a.labels.length-1||a.highlight==="max"&&p===r||a.highlight==="min"&&p===Math.min(...a.values))&&a.severity?` ${d[a.severity]}`:"";return`${f(h,10)} ${$(p.toLocaleString(),8)} ${b}${w}`});t.push({tag:"div",text:{tag:"lark_md",content:"```\n"+l.join(`
9
+ `)+"\n```"}});break}case"table":{t.push({tag:"div",text:{tag:"lark_md",content:U(a)}});break}case"callouts":{let r=d[a.tone||"info"];t.push({tag:"div",text:{tag:"lark_md",content:a.items.map(l=>`${r} ${l}`).join(`
10
+ `)}});break}case"breakdown":{let r=a.rows.map(l=>{let h=l.severity?` ${d[l.severity]}`:"",u=l.sub?` *${l.sub}*`:"";return`**${l.label}** ${l.value}${u}${h}`});t.push({tag:"div",text:{tag:"lark_md",content:r.join(`
11
+ `)}});break}case"paragraph":{t.push({tag:"div",text:{tag:"lark_md",content:a.text}});break}}if(e.footer&&(e.footer.viewUrl||e.footer.rerunUrl)){let a=[];e.footer.viewUrl&&a.push({tag:"button",text:{tag:"plain_text",content:"View in Zibby"},url:e.footer.viewUrl,type:"primary"}),e.footer.rerunUrl&&a.push({tag:"button",text:{tag:"plain_text",content:"Run again"},url:e.footer.rerunUrl,type:"default"}),t.push({tag:"hr"}),t.push({tag:"action",actions:a})}let n="blue";return e.headline.delta?.severity&&(n=V[e.headline.delta.severity]||"blue"),{config:{wide_screen_mode:!0},header:{title:{tag:"plain_text",content:e.title.slice(0,200)},subtitle:e.subtitle?{tag:"plain_text",content:e.subtitle.slice(0,200)}:void 0,template:n},elements:t}}var C=Object.freeze({ok:"green_background",info:"blue_background",warn:"orange_background",critical:"red_background"}),j=Object.freeze({ok:"\u{1F7E2}",info:"\u2139\uFE0F",warn:"\u26A0\uFE0F",critical:"\u{1F6A8}"});function m(s,e={}){let t={type:"text",text:{content:String(s).slice(0,2e3)}};return e.annotations&&(t.annotations=e.annotations),[t]}function _(s,e){let t={object:"block",type:"paragraph",paragraph:{rich_text:m(s)}};return e&&(t.paragraph.color=e),t}function N(s){return{object:"block",type:"code",code:{rich_text:m(s),language:"plain text"}}}function W(s){let e=x.parse(s),t=[];t.push({object:"block",type:"heading_1",heading_1:{rich_text:m(e.title.slice(0,200))}}),e.subtitle&&t.push(_(e.subtitle,"gray_background"));let c=[{type:"text",text:{content:e.headline.primary.slice(0,200)},annotations:{bold:!0}}];if(e.headline.delta){let n=v[e.headline.delta.direction]||"",a=e.headline.delta.severity?d[e.headline.delta.severity]:"",r=` ${n} ${e.headline.delta.value} ${a}`.trimEnd();c.push({type:"text",text:{content:r}})}t.push({object:"block",type:"paragraph",paragraph:{rich_text:c}}),e.headline.summary&&t.push(_(e.headline.summary));for(let n of e.sections)switch(t.push({object:"block",type:"divider",divider:{}}),n.title&&t.push({object:"block",type:"heading_2",heading_2:{rich_text:m(n.title)}}),n.kind){case"trend":{let a=Math.max(...n.values),r=Math.min(...n.values),l=n.labels.map((h,u)=>{let p=n.values[u],b=k(p,a),w=(n.highlight==="last"&&u===n.labels.length-1||n.highlight==="max"&&p===a||n.highlight==="min"&&p===r)&&n.severity?` ${d[n.severity]}`:"";return`${f(h,10)} ${$(p.toLocaleString(),8)} ${b}${w}`});t.push(N(l.join(`
12
+ `)));break}case"table":{let a={object:"block",type:"table_row",table_row:{cells:n.headers.map(l=>m(l))}},r=n.rows.map(l=>({object:"block",type:"table_row",table_row:{cells:l.map(h=>m(String(h)))}}));t.push({object:"block",type:"table",table:{table_width:n.headers.length,has_column_header:!0,has_row_header:!1,children:[a,...r]}});break}case"callouts":{let a=n.tone||"info",r=j[a],l=C[a];for(let h of n.items)t.push({object:"block",type:"callout",callout:{rich_text:m(h),icon:{type:"emoji",emoji:r},color:l}});break}case"breakdown":{for(let a of n.rows){let r=[{type:"text",text:{content:`${a.label}: `},annotations:{bold:!0}},{type:"text",text:{content:String(a.value)}}];a.sub&&r.push({type:"text",text:{content:` (${a.sub})`},annotations:{italic:!0}}),a.severity&&r.push({type:"text",text:{content:` ${d[a.severity]}`}}),t.push({object:"block",type:"bulleted_list_item",bulleted_list_item:{rich_text:r}})}break}case"paragraph":{t.push(_(n.text));break}}e.footer&&(e.footer.viewUrl||e.footer.rerunUrl)&&(t.push({object:"block",type:"divider",divider:{}}),e.footer.viewUrl&&t.push({object:"block",type:"embed",embed:{url:e.footer.viewUrl}}),e.footer.rerunUrl&&t.push({object:"block",type:"embed",embed:{url:e.footer.rerunUrl}}));let o=e.headline.delta?.severity?j[e.headline.delta.severity]:void 0;return{blocks:t,title:e.title.slice(0,200),icon:o}}function S(s){return String(s??"").replace(/\|/g,"\\|")}function Z(s){let e=x.parse(s),t=[];t.push(`# ${e.title}`),e.subtitle&&t.push("",e.subtitle);let c=[`**${e.headline.primary}**`];if(e.headline.delta){let o=v[e.headline.delta.direction]||"",n=e.headline.delta.severity?d[e.headline.delta.severity]:"";c.push(`${o} ${e.headline.delta.value} ${n}`.trim())}t.push("",c.join(" ")),e.headline.summary&&t.push("",e.headline.summary);for(let o of e.sections)switch(t.push("","---",""),o.title&&t.push(`## ${o.title}`,""),o.kind){case"trend":{let n=Math.max(...o.values),a=Math.min(...o.values),r=o.labels.map((l,h)=>{let u=o.values[h],p=k(u,n),g=(o.highlight==="last"&&h===o.labels.length-1||o.highlight==="max"&&u===n||o.highlight==="min"&&u===a)&&o.severity?` ${d[o.severity]}`:"";return`${f(l,10)} ${$(u.toLocaleString(),8)} ${p}${g}`});t.push("```",...r,"```");break}case"table":{t.push(`| ${o.headers.map(S).join(" | ")} |`),t.push(`| ${o.headers.map(()=>"---").join(" | ")} |`);for(let n of o.rows)t.push(`| ${n.map(S).join(" | ")} |`);break}case"callouts":{let n=d[o.tone||"info"];for(let a of o.items)t.push(`- ${n} ${a}`);break}case"breakdown":{for(let n of o.rows){let a=n.sub?` _${n.sub}_`:"",r=n.severity?` ${d[n.severity]}`:"";t.push(`- **${n.label}**: ${n.value}${a}${r}`)}break}case"paragraph":{t.push(o.text);break}}if(e.footer&&(e.footer.viewUrl||e.footer.rerunUrl)){let o=[];e.footer.viewUrl&&o.push(`[View in Zibby](${e.footer.viewUrl})`),e.footer.rerunUrl&&o.push(`[Run again](${e.footer.rerunUrl})`),t.push("","---","",o.join(" \xB7 "))}return t.join(`
13
+ `)}export{y as SEVERITIES,x as reportObjectSchema,z as reportToBlockKit,A as reportToLarkCard,Z as reportToMarkdown,W as reportToNotionBlocks};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/skills",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "Built-in skill definitions for the Zibby agent-workflow framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -104,6 +104,7 @@
104
104
  "files": [
105
105
  "dist/",
106
106
  "bin/",
107
+ "assets/",
107
108
  "docs/",
108
109
  "README.md",
109
110
  "LICENSE"
@@ -113,7 +114,9 @@
113
114
  },
114
115
  "dependencies": {
115
116
  "@modelcontextprotocol/sdk": "^1.29.0",
117
+ "@resvg/resvg-js": "^2.6.2",
116
118
  "@zibby/agent-workflow": "^0.4.0",
119
+ "echarts": "^6.1.0",
117
120
  "mem0ai": "npm:@zibby/mem0ai@^3.0.5",
118
121
  "zod": "^3.23.0 || ^4.0.0"
119
122
  },