@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/assets/fonts/NotoSans-Bold.ttf +0 -0
- package/assets/fonts/NotoSans-Regular.ttf +0 -0
- package/assets/fonts/OFL.txt +94 -0
- package/dist/chartRender.d.ts +57 -0
- package/dist/chartRender.js +7 -0
- package/dist/googleDocs.d.ts +40 -8
- package/dist/googleDocs.js +16 -6
- package/dist/index.d.ts +4 -2
- package/dist/index.js +165 -152
- package/dist/larkDocs.d.ts +49 -0
- package/dist/larkDocs.js +4 -3
- package/dist/memory.js +2 -13
- package/dist/notion.d.ts +163 -0
- package/dist/notion.js +12 -7
- package/dist/package.json +4 -1
- package/dist/report.d.ts +24 -0
- package/dist/report.js +12 -11
- package/package.json +4 -1
package/dist/report.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import{z as
|
|
2
|
-
`)+"\n```"}function z(s){let e=
|
|
3
|
-
`+e.headline.summary),t.push({type:"section",text:{type:"mrkdwn",text:
|
|
4
|
-
`)+"\n```"}});break}case"table":{t.push({type:"section",text:{type:"mrkdwn",text:
|
|
5
|
-
`)}});break}case"breakdown":{let n
|
|
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?` ${
|
|
8
|
-
`+e.headline.summary),t.push({tag:"div",text:{tag:"lark_md",content:
|
|
9
|
-
`)+"\n```"}});break}case"table":{t.push({tag:"div",text:{tag:"lark_md",content:
|
|
10
|
-
`)}});break}case"breakdown":{let r=
|
|
11
|
-
`)}});break}case"paragraph":{t.push({tag:"div",text:{tag:"lark_md",content:
|
|
12
|
-
`)));break}case"table":{let
|
|
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.
|
|
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
|
},
|