@zibby/skills 0.2.12 → 0.2.14

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/notion.js CHANGED
@@ -1,10 +1,10 @@
1
- import{existsSync as R,statSync as S,readFileSync as L}from"fs";import{fileURLToPath as $}from"url";import{basename as U,dirname as T,resolve as v}from"path";import{resolveIntegrationToken as E,clearTokenCache as j}from"@zibby/core/backend-client.js";var _=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),Y=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});function q(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let i=T($(import.meta.url)),e=v(i,"..","bin","mcp-skill.mjs");return R(e)?e:null}var B="2022-06-28",C="https://api.notion.com/v1",h=2e4,I=25,D=25,b=100,N=500,J=20*1024*1024;function u(i){if(!i||typeof i!="string")return null;let t=i.trim().split(/[?#]/)[0],n=t.match(/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/);if(n)return n[0].toLowerCase();let o=t.match(/[0-9a-fA-F]{32}/g);if(o&&o.length){let r=o[o.length-1].toLowerCase();return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}return null}async function p(i,e={}){let t=async()=>{let{token:n}=await E("notion");if(typeof n!="string"||!n)throw new Error(`Invalid notion token type: ${typeof n}`);let o=await fetch(`${C}${i}`,{method:e.method||"GET",headers:{Authorization:`Bearer ${n}`,"Notion-Version":B,Accept:"application/json",...e.body&&!e.formData?{"Content-Type":"application/json"}:{},...e.headers},body:e.formData?e.formData:e.body?JSON.stringify(e.body):void 0});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`Notion API ${o.status}: ${s.slice(0,300)}`)}let r=await o.text().catch(()=>"");if(!r||!r.trim())return{};try{return JSON.parse(r)}catch{return{raw:r}}};try{return await t()}catch(n){let o=String(n?.message||n||"").toLowerCase();if(!(o.includes("token")||o.includes("401")||o.includes("unauthorized")))throw n;return j("notion"),t()}}function g(i){if(!Array.isArray(i))return"";let e="";for(let t of i){let n=t?.plain_text??t?.text?.content??"";if(!n)continue;let o=t.annotations||{};o.code&&(n=`\`${n}\``),o.bold&&(n=`**${n}**`),o.italic&&(n=`_${n}_`),o.strikethrough&&(n=`~~${n}~~`);let r=t?.href||t?.text?.link?.url;r&&(n=`[${n}](${r})`),e+=n}return e}function M(i,e,t){let n=i?.type,o=i?.[n]||{},r=" ".repeat(Math.max(0,e)),s=(c="rich_text")=>g(o[c]),a;switch(n){case"paragraph":a=s();break;case"heading_1":a=`# ${s()}`;break;case"heading_2":a=`## ${s()}`;break;case"heading_3":a=`### ${s()}`;break;case"bulleted_list_item":a=`${r}- ${s()}`;break;case"numbered_list_item":a=`${r}1. ${s()}`;break;case"to_do":a=`${r}- [${o.checked?"x":" "}] ${s()}`;break;case"toggle":a=`${r}- ${s()}`;break;case"quote":a=`> ${s()}`;break;case"callout":{a=`> ${o.icon?.emoji?`${o.icon.emoji} `:""}${s()}`;break}case"code":{a=`\`\`\`${o.language||""}
1
+ import{existsSync as R,statSync as S,readFileSync as L}from"fs";import{fileURLToPath as $}from"url";import{basename as U,dirname as v,resolve as T}from"path";import{resolveIntegrationToken as j,clearTokenCache as E}from"@zibby/core/backend-client.js";var y=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",LARK_DOCS:"lark_docs",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",VIKUNJA:"vikunja",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),Y=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark Docs",connectPath:"/integrations?provider=lark_docs"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},vikunja:{id:"vikunja",name:"Vikunja",connectPath:"/integrations?provider=vikunja"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});function q(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let i=v($(import.meta.url)),e=T(i,"..","bin","mcp-skill.mjs");return R(e)?e:null}var B="2022-06-28",C="https://api.notion.com/v1",h=2e4,I=25,D=25,b=100,N=500,J=20*1024*1024;function u(i){if(!i||typeof i!="string")return null;let t=i.trim().split(/[?#]/)[0],n=t.match(/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/);if(n)return n[0].toLowerCase();let o=t.match(/[0-9a-fA-F]{32}/g);if(o&&o.length){let r=o[o.length-1].toLowerCase();return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}return null}async function p(i,e={}){let t=async()=>{let{token:n}=await j("notion");if(typeof n!="string"||!n)throw new Error(`Invalid notion token type: ${typeof n}`);let o=await fetch(`${C}${i}`,{method:e.method||"GET",headers:{Authorization:`Bearer ${n}`,"Notion-Version":B,Accept:"application/json",...e.body&&!e.formData?{"Content-Type":"application/json"}:{},...e.headers},body:e.formData?e.formData:e.body?JSON.stringify(e.body):void 0});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`Notion API ${o.status}: ${s.slice(0,300)}`)}let r=await o.text().catch(()=>"");if(!r||!r.trim())return{};try{return JSON.parse(r)}catch{return{raw:r}}};try{return await t()}catch(n){let o=String(n?.message||n||"").toLowerCase();if(!(o.includes("token")||o.includes("401")||o.includes("unauthorized")))throw n;return E("notion"),t()}}function g(i){if(!Array.isArray(i))return"";let e="";for(let t of i){let n=t?.plain_text??t?.text?.content??"";if(!n)continue;let o=t.annotations||{};o.code&&(n=`\`${n}\``),o.bold&&(n=`**${n}**`),o.italic&&(n=`_${n}_`),o.strikethrough&&(n=`~~${n}~~`);let r=t?.href||t?.text?.link?.url;r&&(n=`[${n}](${r})`),e+=n}return e}function M(i,e,t){let n=i?.type,o=i?.[n]||{},r=" ".repeat(Math.max(0,e)),s=(c="rich_text")=>g(o[c]),a;switch(n){case"paragraph":a=s();break;case"heading_1":a=`# ${s()}`;break;case"heading_2":a=`## ${s()}`;break;case"heading_3":a=`### ${s()}`;break;case"bulleted_list_item":a=`${r}- ${s()}`;break;case"numbered_list_item":a=`${r}1. ${s()}`;break;case"to_do":a=`${r}- [${o.checked?"x":" "}] ${s()}`;break;case"toggle":a=`${r}- ${s()}`;break;case"quote":a=`> ${s()}`;break;case"callout":{a=`> ${o.icon?.emoji?`${o.icon.emoji} `:""}${s()}`;break}case"code":{a=`\`\`\`${o.language||""}
2
2
  ${s()}
3
3
  \`\`\``;break}case"divider":a="---";break;case"child_page":a=`[child page: ${o.title||""}]`;break;case"child_database":a=`[child database: ${o.title||""}]`;break;case"bookmark":case"embed":case"link_preview":a=o.url?`<${o.url}>`:"";break;case"equation":a=o.expression?`$${o.expression}$`:"";break;case"table":case"column_list":case"column":a="";break;case"table_row":{let c=(o.cells||[]).map(l=>g(l).trim());a=`${r}| ${c.join(" | ")} |`;break}default:a=s();break}let d=[];return a&&a.trim()&&d.push(a),t&&t.trim()&&d.push(t),d.join(`
4
- `)}async function O(i,e,t){let n=[],o,r=0;do{if(t.used>=h)break;let s=new URLSearchParams({page_size:"100"});o&&s.set("start_cursor",o);let a=await p(`/blocks/${i}/children?${s.toString()}`),d=Array.isArray(a.results)?a.results:[];for(let c of d){let l="";c.has_children&&(l=await O(c.id,e+1,t));let m=M(c,e,l);if(m&&(n.push(m),t.used+=m.length+1),t.used>=h)break}o=a.has_more?a.next_cursor:void 0,r+=1}while(o&&r<D);return n.join(`
5
- `)}function w(i){let e=i?.properties||{};for(let t of Object.values(e))if(t?.type==="title"){let n=g(t.title).trim();if(n)return n}return""}function f(i){let e=String(i??"");if(!e)return[{type:"text",text:{content:""}}];let t=[];for(let n=0;n<e.length;n+=2e3)t.push({type:"text",text:{content:e.slice(n,n+2e3)}});return t}function G(i){return{id:i?.id||"",discussionId:i?.discussion_id||"",text:g(i?.rich_text).trim(),author:i?.created_by?.id||"",createdTime:i?.created_time||""}}function F(i){if(!i||!i.type)return"";switch(i.type){case"title":return g(i.title).trim();case"rich_text":return g(i.rich_text).trim();case"number":return i.number==null?"":String(i.number);case"select":return i.select?.name||"";case"status":return i.status?.name||"";case"multi_select":return(i.multi_select||[]).map(t=>t.name).join(", ");case"checkbox":return i.checkbox?"true":"false";case"url":return i.url||"";case"email":return i.email||"";case"phone_number":return i.phone_number||"";case"date":return i.date?.start||"";case"people":return(i.people||[]).map(t=>t.name||t.id).join(", ");default:return""}}function y(i){return`https://www.notion.so/${String(i||"").replace(/-/g,"")}`}function H(i){let e=String(i??"").replace(/\r\n/g,`
4
+ `)}async function A(i,e,t){let n=[],o,r=0;do{if(t.used>=h)break;let s=new URLSearchParams({page_size:"100"});o&&s.set("start_cursor",o);let a=await p(`/blocks/${i}/children?${s.toString()}`),d=Array.isArray(a.results)?a.results:[];for(let c of d){let l="";c.has_children&&(l=await A(c.id,e+1,t));let m=M(c,e,l);if(m&&(n.push(m),t.used+=m.length+1),t.used>=h)break}o=a.has_more?a.next_cursor:void 0,r+=1}while(o&&r<D);return n.join(`
5
+ `)}function w(i){let e=i?.properties||{};for(let t of Object.values(e))if(t?.type==="title"){let n=g(t.title).trim();if(n)return n}return""}function f(i){let e=String(i??"");if(!e)return[{type:"text",text:{content:""}}];let t=[];for(let n=0;n<e.length;n+=2e3)t.push({type:"text",text:{content:e.slice(n,n+2e3)}});return t}function G(i){return{id:i?.id||"",discussionId:i?.discussion_id||"",text:g(i?.rich_text).trim(),author:i?.created_by?.id||"",createdTime:i?.created_time||""}}function F(i){if(!i||!i.type)return"";switch(i.type){case"title":return g(i.title).trim();case"rich_text":return g(i.rich_text).trim();case"number":return i.number==null?"":String(i.number);case"select":return i.select?.name||"";case"status":return i.status?.name||"";case"multi_select":return(i.multi_select||[]).map(t=>t.name).join(", ");case"checkbox":return i.checkbox?"true":"false";case"url":return i.url||"";case"email":return i.email||"";case"phone_number":return i.phone_number||"";case"date":return i.date?.start||"";case"people":return(i.people||[]).map(t=>t.name||t.id).join(", ");default:return""}}function k(i){return`https://www.notion.so/${String(i||"").replace(/-/g,"")}`}function K(i){let e=String(i??"").replace(/\r\n/g,`
6
6
  `),t=[];for(let n of e.split(`
7
- `)){let o=n.replace(/\s+$/,"");if(!o.trim())continue;let r=/^(#{1,3})\s+(.*)$/.exec(o),s=/^\s*[-*]\s+(.*)$/.exec(o),a=/^\s*\d+[.)]\s+(.*)$/.exec(o),d,c;r?(d=`heading_${r[1].length}`,c=r[2]):s?(d="bulleted_list_item",c=s[1]):a?(d="numbered_list_item",c=a[1]):(d="paragraph",c=o),t.push({object:"block",type:d,[d]:{rich_text:f(c)}})}return t}function P(i){return Array.isArray(i?.blocks)&&i.blocks.length?i.blocks.slice(0,N):typeof i?.markdown=="string"&&i.markdown.trim()?H(i.markdown).slice(0,N):null}async function x(i,e){for(let t=0;t<e.length;t+=b)await p(`/blocks/${i}/children`,{method:"PATCH",body:{children:e.slice(t,t+b)}})}function K(i){let e=typeof i=="string"?i.trim():"";if(!e)throw new Error("imagePath is required");if(!R(e)||!S(e).isFile())throw new Error(`imagePath not found (or not a file): ${e}`);if(!/\.(png|jpe?g)$/i.test(e))throw new Error("imagePath must be a .png or .jpg/.jpeg file");let t=L(e);if(t.length>J)throw new Error(`image is ${(t.length/(1024*1024)).toFixed(1)}MB \u2014 max 20MB (Notion single_part upload cap)`);return t}async function z(i){let e=K(i),t=U(i.trim()),n=/\.png$/i.test(t)?"image/png":"image/jpeg",r=(await p("/file_uploads",{method:"POST",body:{mode:"single_part",filename:t}}))?.id;if(!r)throw new Error("Notion file upload create returned no id");let s=new FormData;return s.set("file",new Blob([e],{type:n}),t),await p(`/file_uploads/${r}/send`,{method:"POST",formData:s}),r}var te={id:"notion",callsBackend:!0,serverName:"notion",allowedTools:["mcp__notion__*"],requiresIntegration:_.NOTION,envKeys:["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV"],description:"Notion \u2014 read pages/databases as context + create pages, append blocks, and insert images",promptFragment:`## Notion
7
+ `)){let o=n.replace(/\s+$/,"");if(!o.trim())continue;let r=/^(#{1,3})\s+(.*)$/.exec(o),s=/^\s*[-*]\s+(.*)$/.exec(o),a=/^\s*\d+[.)]\s+(.*)$/.exec(o),d,c;r?(d=`heading_${r[1].length}`,c=r[2]):s?(d="bulleted_list_item",c=s[1]):a?(d="numbered_list_item",c=a[1]):(d="paragraph",c=o),t.push({object:"block",type:d,[d]:{rich_text:f(c)}})}return t}function P(i){return Array.isArray(i?.blocks)&&i.blocks.length?i.blocks.slice(0,N):typeof i?.markdown=="string"&&i.markdown.trim()?K(i.markdown).slice(0,N):null}async function x(i,e){for(let t=0;t<e.length;t+=b)await p(`/blocks/${i}/children`,{method:"PATCH",body:{children:e.slice(t,t+b)}})}function H(i){let e=typeof i=="string"?i.trim():"";if(!e)throw new Error("imagePath is required");if(!R(e)||!S(e).isFile())throw new Error(`imagePath not found (or not a file): ${e}`);if(!/\.(png|jpe?g)$/i.test(e))throw new Error("imagePath must be a .png or .jpg/.jpeg file");let t=L(e);if(t.length>J)throw new Error(`image is ${(t.length/(1024*1024)).toFixed(1)}MB \u2014 max 20MB (Notion single_part upload cap)`);return t}async function z(i){let e=H(i),t=U(i.trim()),n=/\.png$/i.test(t)?"image/png":"image/jpeg",r=(await p("/file_uploads",{method:"POST",body:{mode:"single_part",filename:t}}))?.id;if(!r)throw new Error("Notion file upload create returned no id");let s=new FormData;return s.set("file",new Blob([e],{type:n}),t),await p(`/file_uploads/${r}/send`,{method:"POST",formData:s}),r}var te={id:"notion",callsBackend:!0,serverName:"notion",allowedTools:["mcp__notion__*"],requiresIntegration:y.NOTION,envKeys:["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV"],description:"Notion \u2014 read pages/databases as context + create pages, append blocks, and insert images",promptFragment:`## Notion
8
8
  You can read Notion content as context AND write to Notion (create pages, append blocks, insert images).
9
9
  - notion_get_page: pass a Notion page id OR a full Notion URL; returns { id, title, url, text } where text is the page flattened to markdown (truncated to ~20k chars). Use the text as reference context.
10
10
  - notion_query_database: pass a database id/URL; returns a small list of rows ({ id, title, url, props }). Use to find a specific page, then notion_get_page it.
@@ -13,4 +13,4 @@ You can read Notion content as context AND write to Notion (create pages, append
13
13
  - notion_insert_image: append an image block to a page. Pass { pageId, imagePath } for a LOCAL png/jpg file (\u226420MB, uploaded via Notion's File Upload API) or { pageId, imageUrl } for an external, publicly reachable image URL. Optional caption. Returns { ok, pageId, url }.
14
14
  - notion_list_comments: pass a page/block id OR URL; returns the open comment discussions on it ({ id, discussionId, text, author }). Use to read the comment thread you are replying to.
15
15
  - notion_add_comment: post a comment. To REPLY in an existing discussion pass { discussionId, text }; to start a NEW top-level comment on a page pass { pageId, text }. Returns { ok, id, discussionId }. Use this to answer a user who @mentioned Zibby in a Notion comment \u2014 reply in the SAME discussionId.
16
- Do not block the task if Notion is unavailable \u2014 these tools return { ok:false, error } on failure; treat a missing page as "no extra context" / "cannot deliver to Notion" and continue.`,resolve(){let i=q();if(!i)return null;let e={};for(let t of this.envKeys)process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[i,"../dist/notion.js","notionSkill"],env:e,description:this.description,alwaysLoad:!0}},async handleToolCall(i,e){try{switch(i){case"notion_get_page":{let t=e?.pageId||e?.page||e?.url||e?.id,n=u(t);if(!n)return JSON.stringify({ok:!1,error:"A valid Notion page id or URL is required"});let o=await p(`/pages/${n}`),r=w(o),s=o?.url||`https://www.notion.so/${n.replace(/-/g,"")}`,d=await O(n,0,{used:0}),c=!1;return d.length>h&&(d=d.slice(0,h),c=!0),JSON.stringify({ok:!0,id:n,title:r,url:s,text:d,...c?{truncated:!0}:{}})}case"notion_query_database":{let t=e?.databaseId||e?.database||e?.url||e?.id,n=u(t);if(!n)return JSON.stringify({ok:!1,error:"A valid Notion database id or URL is required"});let r={page_size:Math.max(1,Math.min(Number(e?.maxResults)||I,I))};e?.filter&&typeof e.filter=="object"&&(r.filter=e.filter);let s=await p(`/databases/${n}/query`,{method:"POST",body:r}),d=(Array.isArray(s.results)?s.results:[]).map(c=>{let l={};for(let[m,A]of Object.entries(c.properties||{})){let k=F(A);k&&(l[m]=k)}return{id:c.id,title:w(c),url:c.url||`https://www.notion.so/${String(c.id||"").replace(/-/g,"")}`,props:l}});return JSON.stringify({ok:!0,id:n,count:d.length,hasMore:!!s.has_more,rows:d})}case"notion_create_page":{let t=typeof e?.title=="string"&&e.title.trim()?e.title.trim():null;if(!t)return JSON.stringify({ok:!1,error:"title is required"});let n=e?.databaseId?u(e.databaseId):null,o=e?.parentPageId?u(e.parentPageId):u(e?.parent||e?.pageId);if(!n&&!o)return JSON.stringify({ok:!1,error:"A valid parentPageId or databaseId is required"});let r=n?{database_id:n}:{page_id:o},s={title:{title:f(t)}},a=P(e)||[],d=a.slice(0,b),c=await p("/pages",{method:"POST",body:{parent:r,properties:s,...d.length?{children:d}:{}}}),l=c?.id;if(!l)return JSON.stringify({ok:!1,error:"Notion page create returned no id"});let m=a.slice(b);return m.length&&await x(l,m),JSON.stringify({ok:!0,pageId:l,url:c?.url||y(l)})}case"notion_append_blocks":{let t=u(e?.pageId||e?.blockId||e?.url||e?.id);if(!t)return JSON.stringify({ok:!1,error:"A valid Notion page id or URL is required"});let n=P(e);return!n||!n.length?JSON.stringify({ok:!1,error:"markdown or blocks content is required"}):(await x(t,n),JSON.stringify({ok:!0,pageId:t,url:y(t)}))}case"notion_insert_image":{let t=u(e?.pageId||e?.url||e?.id);if(!t)return JSON.stringify({ok:!1,error:"A valid Notion page id or URL is required"});let n=typeof e?.caption=="string"&&e.caption.trim()?f(e.caption.trim()):null,o,r;if(typeof e?.imagePath=="string"&&e.imagePath.trim())r=await z(e.imagePath),o={type:"file_upload",file_upload:{id:r}};else if(typeof e?.imageUrl=="string"&&e.imageUrl.trim())o={type:"external",external:{url:e.imageUrl.trim()}};else return JSON.stringify({ok:!1,error:"imagePath (local png/jpg) or imageUrl is required"});return n&&(o.caption=n),await p(`/blocks/${t}/children`,{method:"PATCH",body:{children:[{object:"block",type:"image",image:o}]}}),JSON.stringify({ok:!0,pageId:t,url:y(t),...r?{fileUploadId:r}:{}})}case"notion_list_comments":{let t=e?.blockId||e?.pageId||e?.block||e?.page||e?.url||e?.id,n=u(t);if(!n)return JSON.stringify({ok:!1,error:"A valid Notion page/block id or URL is required"});let o=new URLSearchParams({block_id:n,page_size:"100"}),r=await p(`/comments?${o.toString()}`),a=(Array.isArray(r.results)?r.results:[]).map(G);return JSON.stringify({ok:!0,id:n,count:a.length,comments:a})}case"notion_add_comment":{let t=typeof e?.text=="string"?e.text:typeof e?.body=="string"?e.body:"";if(!t||!t.trim())return JSON.stringify({ok:!1,error:"text is required"});let n=e?.discussionId||e?.discussion_id||null,o;if(n)o={discussion_id:String(n),rich_text:f(t)};else{let s=e?.pageId||e?.page||e?.url||e?.id,a=u(s);if(!a)return JSON.stringify({ok:!1,error:"Either discussionId (to reply) or a valid pageId (to start a comment) is required"});o={parent:{page_id:a},rich_text:f(t)}}let r=await p("/comments",{method:"POST",body:o});return JSON.stringify({ok:!0,id:r?.id||"",discussionId:r?.discussion_id||n||""})}default:return JSON.stringify({ok:!1,error:`Unknown tool: ${i}`})}}catch(t){return JSON.stringify({ok:!1,error:t.message})}},tools:[{name:"notion_get_page",description:"Fetch a Notion page and its content flattened to markdown, for use as read-only context. Accepts a raw page id OR a full Notion URL. Returns { ok, id, title, url, text }. Text is truncated to ~20k chars.",input_schema:{type:"object",properties:{pageId:{type:"string",description:"Notion page id (dashed UUID or 32-char) OR a full Notion page URL."}},required:["pageId"]}},{name:"notion_query_database",description:"Query a Notion database and return a bounded list of rows (id, title, url, key props). Accepts a database id OR full Notion URL. Optional Notion filter object. Returns at most 25 rows.",input_schema:{type:"object",properties:{databaseId:{type:"string",description:"Notion database id (dashed UUID or 32-char) OR a full Notion database URL."},filter:{type:"object",description:"Optional Notion filter object (Notion query filter syntax).",additionalProperties:!0},maxResults:{type:"number",description:"Max rows to return (default 25, max 25)."}},required:["databaseId"]}},{name:"notion_create_page",description:"Create a new Notion page under a parent page (parentPageId) OR in a database (databaseId) \u2014 exactly one parent is required. Body from markdown (#/##/### headings, - bullets, 1. ordered lists; inline marks kept as literal text) or raw Notion block objects. Long bodies are chunked automatically (Notion caps 100 blocks/request). Returns { ok, pageId, url } \u2014 share the url with the user.",input_schema:{type:"object",properties:{parentPageId:{type:"string",description:"Parent PAGE id/URL to create the page under (used when databaseId is absent)."},databaseId:{type:"string",description:"Parent DATABASE id/URL to create the page in (title goes into the title property)."},title:{type:"string",description:"Page title."},markdown:{type:"string",description:"Page body as markdown (preferred)."},blocks:{type:"array",description:"Raw Notion block objects (advanced; used instead of markdown, max 500).",items:{type:"object",additionalProperties:!0}}},required:["title"]}},{name:"notion_append_blocks",description:"Append markdown (or raw Notion blocks) to the END of an existing Notion page. Accepts a page id or full Notion URL. Chunks automatically at Notion's 100-blocks-per-request cap. Returns { ok, pageId, url }.",input_schema:{type:"object",properties:{pageId:{type:"string",description:"Notion page id (dashed UUID or 32-char) OR a full Notion page URL."},markdown:{type:"string",description:"Content to append, as markdown (preferred)."},blocks:{type:"array",description:"Raw Notion block objects (advanced; used instead of markdown, max 500).",items:{type:"object",additionalProperties:!0}}},required:["pageId"]}},{name:"notion_insert_image",description:"Append an image block to a Notion page. Pass imagePath for a LOCAL .png/.jpg file (max 20MB \u2014 uploaded via Notion's File Upload API, stored by Notion) or imageUrl for an external publicly-reachable image URL. Optional caption. Returns { ok, pageId, url }.",input_schema:{type:"object",properties:{pageId:{type:"string",description:"Notion page id (dashed UUID or 32-char) OR a full Notion page URL."},imagePath:{type:"string",description:"Local filesystem path to a .png or .jpg/.jpeg image (max 20MB). Preferred for locally rendered charts."},imageUrl:{type:"string",description:"External image URL (must be publicly reachable; used when imagePath is absent)."},caption:{type:"string",description:"Optional image caption."}},required:["pageId"]}},{name:"notion_list_comments",description:"List the open comment discussions on a Notion page/block. Accepts a page/block id OR a full Notion URL. Returns { ok, comments:[{ id, discussionId, text, author }] }. Use to read the comment thread you are replying to.",input_schema:{type:"object",properties:{blockId:{type:"string",description:"Notion page or block id (dashed UUID or 32-char) OR a full Notion URL."}},required:["blockId"]}},{name:"notion_add_comment",description:"Post a comment on Notion. To REPLY within an existing discussion, pass { discussionId, text }. To start a NEW top-level comment on a page, pass { pageId, text }. Returns { ok, id, discussionId }. Use this to answer a user who @mentioned Zibby in a Notion comment (reply in the same discussionId).",input_schema:{type:"object",properties:{discussionId:{type:"string",description:"The discussion_id to reply into (from notion_list_comments). Preferred for replies."},pageId:{type:"string",description:"Page id/URL to start a NEW top-level comment on (used when discussionId is absent)."},text:{type:"string",description:"The comment body (plain text)."}},required:["text"]}}]};export{H as markdownToNotionBlocks,p as notionApi,te as notionSkill,u as parseNotionId};
16
+ Do not block the task if Notion is unavailable \u2014 these tools return { ok:false, error } on failure; treat a missing page as "no extra context" / "cannot deliver to Notion" and continue.`,resolve(){let i=q();if(!i)return null;let e={};for(let t of this.envKeys)process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[i,"../dist/notion.js","notionSkill"],env:e,description:this.description,alwaysLoad:!0}},async handleToolCall(i,e){try{switch(i){case"notion_get_page":{let t=e?.pageId||e?.page||e?.url||e?.id,n=u(t);if(!n)return JSON.stringify({ok:!1,error:"A valid Notion page id or URL is required"});let o=await p(`/pages/${n}`),r=w(o),s=o?.url||`https://www.notion.so/${n.replace(/-/g,"")}`,d=await A(n,0,{used:0}),c=!1;return d.length>h&&(d=d.slice(0,h),c=!0),JSON.stringify({ok:!0,id:n,title:r,url:s,text:d,...c?{truncated:!0}:{}})}case"notion_query_database":{let t=e?.databaseId||e?.database||e?.url||e?.id,n=u(t);if(!n)return JSON.stringify({ok:!1,error:"A valid Notion database id or URL is required"});let r={page_size:Math.max(1,Math.min(Number(e?.maxResults)||I,I))};e?.filter&&typeof e.filter=="object"&&(r.filter=e.filter);let s=await p(`/databases/${n}/query`,{method:"POST",body:r}),d=(Array.isArray(s.results)?s.results:[]).map(c=>{let l={};for(let[m,O]of Object.entries(c.properties||{})){let _=F(O);_&&(l[m]=_)}return{id:c.id,title:w(c),url:c.url||`https://www.notion.so/${String(c.id||"").replace(/-/g,"")}`,props:l}});return JSON.stringify({ok:!0,id:n,count:d.length,hasMore:!!s.has_more,rows:d})}case"notion_create_page":{let t=typeof e?.title=="string"&&e.title.trim()?e.title.trim():null;if(!t)return JSON.stringify({ok:!1,error:"title is required"});let n=e?.databaseId?u(e.databaseId):null,o=e?.parentPageId?u(e.parentPageId):u(e?.parent||e?.pageId);if(!n&&!o)return JSON.stringify({ok:!1,error:"A valid parentPageId or databaseId is required"});let r=n?{database_id:n}:{page_id:o},s={title:{title:f(t)}},a=P(e)||[],d=a.slice(0,b),c=await p("/pages",{method:"POST",body:{parent:r,properties:s,...d.length?{children:d}:{}}}),l=c?.id;if(!l)return JSON.stringify({ok:!1,error:"Notion page create returned no id"});let m=a.slice(b);return m.length&&await x(l,m),JSON.stringify({ok:!0,pageId:l,url:c?.url||k(l)})}case"notion_append_blocks":{let t=u(e?.pageId||e?.blockId||e?.url||e?.id);if(!t)return JSON.stringify({ok:!1,error:"A valid Notion page id or URL is required"});let n=P(e);return!n||!n.length?JSON.stringify({ok:!1,error:"markdown or blocks content is required"}):(await x(t,n),JSON.stringify({ok:!0,pageId:t,url:k(t)}))}case"notion_insert_image":{let t=u(e?.pageId||e?.url||e?.id);if(!t)return JSON.stringify({ok:!1,error:"A valid Notion page id or URL is required"});let n=typeof e?.caption=="string"&&e.caption.trim()?f(e.caption.trim()):null,o,r;if(typeof e?.imagePath=="string"&&e.imagePath.trim())r=await z(e.imagePath),o={type:"file_upload",file_upload:{id:r}};else if(typeof e?.imageUrl=="string"&&e.imageUrl.trim())o={type:"external",external:{url:e.imageUrl.trim()}};else return JSON.stringify({ok:!1,error:"imagePath (local png/jpg) or imageUrl is required"});return n&&(o.caption=n),await p(`/blocks/${t}/children`,{method:"PATCH",body:{children:[{object:"block",type:"image",image:o}]}}),JSON.stringify({ok:!0,pageId:t,url:k(t),...r?{fileUploadId:r}:{}})}case"notion_list_comments":{let t=e?.blockId||e?.pageId||e?.block||e?.page||e?.url||e?.id,n=u(t);if(!n)return JSON.stringify({ok:!1,error:"A valid Notion page/block id or URL is required"});let o=new URLSearchParams({block_id:n,page_size:"100"}),r=await p(`/comments?${o.toString()}`),a=(Array.isArray(r.results)?r.results:[]).map(G);return JSON.stringify({ok:!0,id:n,count:a.length,comments:a})}case"notion_add_comment":{let t=typeof e?.text=="string"?e.text:typeof e?.body=="string"?e.body:"";if(!t||!t.trim())return JSON.stringify({ok:!1,error:"text is required"});let n=e?.discussionId||e?.discussion_id||null,o;if(n)o={discussion_id:String(n),rich_text:f(t)};else{let s=e?.pageId||e?.page||e?.url||e?.id,a=u(s);if(!a)return JSON.stringify({ok:!1,error:"Either discussionId (to reply) or a valid pageId (to start a comment) is required"});o={parent:{page_id:a},rich_text:f(t)}}let r=await p("/comments",{method:"POST",body:o});return JSON.stringify({ok:!0,id:r?.id||"",discussionId:r?.discussion_id||n||""})}default:return JSON.stringify({ok:!1,error:`Unknown tool: ${i}`})}}catch(t){return JSON.stringify({ok:!1,error:t.message})}},tools:[{name:"notion_get_page",description:"Fetch a Notion page and its content flattened to markdown, for use as read-only context. Accepts a raw page id OR a full Notion URL. Returns { ok, id, title, url, text }. Text is truncated to ~20k chars.",input_schema:{type:"object",properties:{pageId:{type:"string",description:"Notion page id (dashed UUID or 32-char) OR a full Notion page URL."}},required:["pageId"]}},{name:"notion_query_database",description:"Query a Notion database and return a bounded list of rows (id, title, url, key props). Accepts a database id OR full Notion URL. Optional Notion filter object. Returns at most 25 rows.",input_schema:{type:"object",properties:{databaseId:{type:"string",description:"Notion database id (dashed UUID or 32-char) OR a full Notion database URL."},filter:{type:"object",description:"Optional Notion filter object (Notion query filter syntax).",additionalProperties:!0},maxResults:{type:"number",description:"Max rows to return (default 25, max 25)."}},required:["databaseId"]}},{name:"notion_create_page",description:"Create a new Notion page under a parent page (parentPageId) OR in a database (databaseId) \u2014 exactly one parent is required. Body from markdown (#/##/### headings, - bullets, 1. ordered lists; inline marks kept as literal text) or raw Notion block objects. Long bodies are chunked automatically (Notion caps 100 blocks/request). Returns { ok, pageId, url } \u2014 share the url with the user.",input_schema:{type:"object",properties:{parentPageId:{type:"string",description:"Parent PAGE id/URL to create the page under (used when databaseId is absent)."},databaseId:{type:"string",description:"Parent DATABASE id/URL to create the page in (title goes into the title property)."},title:{type:"string",description:"Page title."},markdown:{type:"string",description:"Page body as markdown (preferred)."},blocks:{type:"array",description:"Raw Notion block objects (advanced; used instead of markdown, max 500).",items:{type:"object",additionalProperties:!0}}},required:["title"]}},{name:"notion_append_blocks",description:"Append markdown (or raw Notion blocks) to the END of an existing Notion page. Accepts a page id or full Notion URL. Chunks automatically at Notion's 100-blocks-per-request cap. Returns { ok, pageId, url }.",input_schema:{type:"object",properties:{pageId:{type:"string",description:"Notion page id (dashed UUID or 32-char) OR a full Notion page URL."},markdown:{type:"string",description:"Content to append, as markdown (preferred)."},blocks:{type:"array",description:"Raw Notion block objects (advanced; used instead of markdown, max 500).",items:{type:"object",additionalProperties:!0}}},required:["pageId"]}},{name:"notion_insert_image",description:"Append an image block to a Notion page. Pass imagePath for a LOCAL .png/.jpg file (max 20MB \u2014 uploaded via Notion's File Upload API, stored by Notion) or imageUrl for an external publicly-reachable image URL. Optional caption. Returns { ok, pageId, url }.",input_schema:{type:"object",properties:{pageId:{type:"string",description:"Notion page id (dashed UUID or 32-char) OR a full Notion page URL."},imagePath:{type:"string",description:"Local filesystem path to a .png or .jpg/.jpeg image (max 20MB). Preferred for locally rendered charts."},imageUrl:{type:"string",description:"External image URL (must be publicly reachable; used when imagePath is absent)."},caption:{type:"string",description:"Optional image caption."}},required:["pageId"]}},{name:"notion_list_comments",description:"List the open comment discussions on a Notion page/block. Accepts a page/block id OR a full Notion URL. Returns { ok, comments:[{ id, discussionId, text, author }] }. Use to read the comment thread you are replying to.",input_schema:{type:"object",properties:{blockId:{type:"string",description:"Notion page or block id (dashed UUID or 32-char) OR a full Notion URL."}},required:["blockId"]}},{name:"notion_add_comment",description:"Post a comment on Notion. To REPLY within an existing discussion, pass { discussionId, text }. To start a NEW top-level comment on a page, pass { pageId, text }. Returns { ok, id, discussionId }. Use this to answer a user who @mentioned Zibby in a Notion comment (reply in the same discussionId).",input_schema:{type:"object",properties:{discussionId:{type:"string",description:"The discussion_id to reply into (from notion_list_comments). Preferred for replies."},pageId:{type:"string",description:"Page id/URL to start a NEW top-level comment on (used when discussionId is absent)."},text:{type:"string",description:"The comment body (plain text)."}},required:["text"]}}]};export{K as markdownToNotionBlocks,p as notionApi,te as notionSkill,u as parseNotionId};
@@ -1,4 +1,4 @@
1
- import{existsSync as m}from"fs";import{fileURLToPath as _}from"url";import{dirname as f,resolve as y}from"path";import{resolveIntegrationToken as I}from"@zibby/core/backend-client.js";var g=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),O=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});function j(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let r=f(_(import.meta.url)),n=y(r,"..","bin","mcp-skill.mjs");return m(n)?n:null}async function l(){let r=await I(g.OPEN_DESIGN),n=r?.token,e=r?.baseUrl;if(!n||typeof n!="string")throw new Error("OpenDesign is not connected: missing token. Connect it in Integrations.");if(!e||typeof e!="string")throw new Error("OpenDesign is not connected: missing baseUrl. Connect it in Integrations.");let t=e.replace(/\/+$/,"");return{token:n,baseUrl:t}}async function d(r,n={}){let{token:e,baseUrl:t}=await l(),i=`${t}/api${r}`;if(n.query&&typeof n.query=="object"){let a=new URLSearchParams;for(let[h,p]of Object.entries(n.query))p!=null&&p!==""&&a.set(h,String(p));let c=a.toString();c&&(i+=(i.includes("?")?"&":"?")+c)}let o={Authorization:`Bearer ${e}`,Accept:"application/json",...n.body?{"Content-Type":"application/json"}:{}},s=await fetch(i,{method:n.method||"GET",headers:o,body:n.body?JSON.stringify(n.body):void 0});return u(s,"OpenDesign")}async function u(r,n){if(!r.ok){let t=await r.text().catch(()=>""),i=t.slice(0,300);try{let o=JSON.parse(t),s=o?.code||o?.error?.code,a=o?.message||o?.error?.message||o?.error;(s||a)&&(i=[s?`[${s}]`:null,a].filter(Boolean).join(" ")||i)}catch{}throw new Error(`${n} API ${r.status}: ${i}`)}let e=await r.text().catch(()=>"");if(!e)return{};try{return JSON.parse(e)}catch{return{raw:e}}}var T={id:"open-design",callsBackend:!0,serverName:"opendesign",allowedTools:["mcp__opendesign__*"],envKeys:["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV"],description:"OpenDesign \u2014 list projects/designs, run the design agent, and export decks to PDF/HTML",promptFragment:`## OpenDesign (optional)
1
+ import{existsSync as _}from"fs";import{fileURLToPath as m}from"url";import{dirname as f,resolve as y}from"path";import{resolveIntegrationToken as I}from"@zibby/core/backend-client.js";var l=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",LARK_DOCS:"lark_docs",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",VIKUNJA:"vikunja",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),O=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark Docs",connectPath:"/integrations?provider=lark_docs"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},vikunja:{id:"vikunja",name:"Vikunja",connectPath:"/integrations?provider=vikunja"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});function j(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let r=f(m(import.meta.url)),n=y(r,"..","bin","mcp-skill.mjs");return _(n)?n:null}async function g(){let r=await I(l.OPEN_DESIGN),n=r?.token,e=r?.baseUrl;if(!n||typeof n!="string")throw new Error("OpenDesign is not connected: missing token. Connect it in Integrations.");if(!e||typeof e!="string")throw new Error("OpenDesign is not connected: missing baseUrl. Connect it in Integrations.");let t=e.replace(/\/+$/,"");return{token:n,baseUrl:t}}async function d(r,n={}){let{token:e,baseUrl:t}=await g(),i=`${t}/api${r}`;if(n.query&&typeof n.query=="object"){let a=new URLSearchParams;for(let[h,p]of Object.entries(n.query))p!=null&&p!==""&&a.set(h,String(p));let c=a.toString();c&&(i+=(i.includes("?")?"&":"?")+c)}let o={Authorization:`Bearer ${e}`,Accept:"application/json",...n.body?{"Content-Type":"application/json"}:{}},s=await fetch(i,{method:n.method||"GET",headers:o,body:n.body?JSON.stringify(n.body):void 0});return u(s,"OpenDesign")}async function u(r,n){if(!r.ok){let t=await r.text().catch(()=>""),i=t.slice(0,300);try{let o=JSON.parse(t),s=o?.code||o?.error?.code,a=o?.message||o?.error?.message||o?.error;(s||a)&&(i=[s?`[${s}]`:null,a].filter(Boolean).join(" ")||i)}catch{}throw new Error(`${n} API ${r.status}: ${i}`)}let e=await r.text().catch(()=>"");if(!e)return{};try{return JSON.parse(e)}catch{return{raw:e}}}var T={id:"open-design",callsBackend:!0,serverName:"opendesign",allowedTools:["mcp__opendesign__*"],envKeys:["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV"],description:"OpenDesign \u2014 list projects/designs, run the design agent, and export decks to PDF/HTML",promptFragment:`## OpenDesign (optional)
2
2
  You may have access to the user's OpenDesign workspace (the Zibby-managed design/deck app) via its REST API. These tools are OPTIONAL \u2014 if OpenDesign is not connected they will return a "not connected" error; reach for them only when the task involves OpenDesign projects, designs, or exports. Tools (mcp__opendesign__*):
3
3
 
4
4
  ### Connectivity
@@ -20,4 +20,4 @@ You may have access to the user's OpenDesign workspace (the Zibby-managed design
20
20
 
21
21
  ### Notes
22
22
  - A design artifact lookup ALWAYS needs its projectId (it scopes the query).
23
- - After opendesign_cli_run, poll opendesign_cli_status with the returned runId until the run is no longer running.`,resolve(){let r=j();if(!r)return{command:null,args:[],env:{},description:this.description};let n={};for(let e of this.envKeys)process.env[e]&&(n[e]=process.env[e]);return{type:"stdio",command:"node",args:[r,"../dist/opendesign.js","opendesignSkill"],env:n,description:this.description,alwaysLoad:!0}},async handleToolCall(r,n){try{switch(r){case"opendesign_health":{let{baseUrl:e}=await l(),t=await fetch(`${e}/api/health`,{method:"GET",headers:{Accept:"application/json"}}),i=await u(t,"OpenDesign");return JSON.stringify({ok:!0,health:i})}case"opendesign_list_projects":{let e=await d("/projects");return JSON.stringify(e)}case"opendesign_get_project":{let e=n?.id||n?.projectId;if(!e)return JSON.stringify({error:"id is required"});let t=await d(`/projects/${encodeURIComponent(e)}`);return JSON.stringify(t)}case"opendesign_list_designs":{let e=n?.projectId;if(!e)return JSON.stringify({error:"projectId is required"});let t=await d("/live-artifacts",{query:{projectId:e}});return JSON.stringify(t)}case"opendesign_get_design":{let e=n?.id,t=n?.projectId;if(!e)return JSON.stringify({error:"id is required"});if(!t)return JSON.stringify({error:"projectId is required"});let i=await d(`/live-artifacts/${encodeURIComponent(e)}`,{query:{projectId:t}});return JSON.stringify(i)}case"opendesign_export_pdf":{let e=n?.projectId||n?.id,{fileName:t,title:i,deck:o}=n||{};if(!e)return JSON.stringify({error:"projectId is required"});if(!t)return JSON.stringify({error:"fileName is required"});let s={fileName:t};i!==void 0&&(s.title=i),o!==void 0&&(s.deck=o);let a=await d(`/projects/${encodeURIComponent(e)}/export/pdf`,{method:"POST",body:s});return JSON.stringify(a)}case"opendesign_export_html":{let e=n?.projectId||n?.id,t=n?.path;if(!e)return JSON.stringify({error:"projectId is required"});if(!t)return JSON.stringify({error:"path is required (the export sub-path)"});let o=String(t).replace(/^\/+/,"").split("/").map(a=>encodeURIComponent(a)).join("/"),s=await d(`/projects/${encodeURIComponent(e)}/export/${o}`,{query:{inline:1}});return JSON.stringify(s)}case"opendesign_cli_run":{let{agentId:e,message:t,projectId:i,conversationId:o,model:s}=n||{};if(!e)return JSON.stringify({error:"agentId is required"});if(!t)return JSON.stringify({error:"message is required"});let a={agentId:e,message:t};i!==void 0&&(a.projectId=i),o!==void 0&&(a.conversationId=o),s!==void 0&&(a.model=s);let c=await d("/runs",{method:"POST",body:a});return JSON.stringify(c)}case"opendesign_cli_status":{let e=n?.id||n?.runId;if(!e)return JSON.stringify({error:"id (runId) is required"});let t=await d(`/runs/${encodeURIComponent(e)}`);return JSON.stringify(t)}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}catch(e){return JSON.stringify({error:e.message})}},tools:[{name:"opendesign_health",description:"Probe the OpenDesign instance (GET /api/health, no auth). Use to confirm connectivity before other calls.",input_schema:{type:"object",properties:{}}},{name:"opendesign_list_projects",description:"List the projects in the OpenDesign workspace.",input_schema:{type:"object",properties:{}}},{name:"opendesign_get_project",description:"Get a single OpenDesign project by id.",input_schema:{type:"object",properties:{id:{type:"string",description:"The project id."}},required:["id"]}},{name:"opendesign_list_designs",description:"List the live design artifacts in an OpenDesign project. Requires the projectId, which scopes the query.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"The project id whose designs to list."}},required:["projectId"]}},{name:"opendesign_get_design",description:"Get a single live design artifact by id. Requires both the design id and its projectId.",input_schema:{type:"object",properties:{id:{type:"string",description:"The live-artifact (design) id."},projectId:{type:"string",description:"The project id the design belongs to (scopes the lookup)."}},required:["id","projectId"]}},{name:"opendesign_export_pdf",description:"Export an OpenDesign project deck to PDF. Returns the export result (e.g. a download URL/path).",input_schema:{type:"object",properties:{projectId:{type:"string",description:"The project id to export."},fileName:{type:"string",description:"The output PDF file name."},title:{type:"string",description:"Optional deck title for the PDF."},deck:{description:"Optional deck payload/override to render instead of the project's current deck."}},required:["projectId","fileName"]}},{name:"opendesign_export_html",description:"Fetch an OpenDesign project's HTML export by sub-path (requested inline). Requires projectId and the export path.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"The project id to export."},path:{type:"string",description:'The export sub-path under /projects/:id/export/ (e.g. "index.html" or a slide path).'}},required:["projectId","path"]}},{name:"opendesign_cli_run",description:"Start an OpenDesign agent run. Returns a runId; poll opendesign_cli_status with it until the run finishes.",input_schema:{type:"object",properties:{agentId:{type:"string",description:"The OpenDesign agent id to run."},message:{type:"string",description:"The instruction/message to send to the agent."},projectId:{type:"string",description:"Optional project id to scope the run to."},conversationId:{type:"string",description:"Optional conversation id to continue an existing thread."},model:{type:"string",description:"Optional model id override for the run."}},required:["agentId","message"]}},{name:"opendesign_cli_status",description:"Poll the status of an OpenDesign agent run by its runId.",input_schema:{type:"object",properties:{id:{type:"string",description:"The runId returned by opendesign_cli_run."}},required:["id"]}}]};export{T as opendesignSkill};
23
+ - After opendesign_cli_run, poll opendesign_cli_status with the returned runId until the run is no longer running.`,resolve(){let r=j();if(!r)return{command:null,args:[],env:{},description:this.description};let n={};for(let e of this.envKeys)process.env[e]&&(n[e]=process.env[e]);return{type:"stdio",command:"node",args:[r,"../dist/opendesign.js","opendesignSkill"],env:n,description:this.description,alwaysLoad:!0}},async handleToolCall(r,n){try{switch(r){case"opendesign_health":{let{baseUrl:e}=await g(),t=await fetch(`${e}/api/health`,{method:"GET",headers:{Accept:"application/json"}}),i=await u(t,"OpenDesign");return JSON.stringify({ok:!0,health:i})}case"opendesign_list_projects":{let e=await d("/projects");return JSON.stringify(e)}case"opendesign_get_project":{let e=n?.id||n?.projectId;if(!e)return JSON.stringify({error:"id is required"});let t=await d(`/projects/${encodeURIComponent(e)}`);return JSON.stringify(t)}case"opendesign_list_designs":{let e=n?.projectId;if(!e)return JSON.stringify({error:"projectId is required"});let t=await d("/live-artifacts",{query:{projectId:e}});return JSON.stringify(t)}case"opendesign_get_design":{let e=n?.id,t=n?.projectId;if(!e)return JSON.stringify({error:"id is required"});if(!t)return JSON.stringify({error:"projectId is required"});let i=await d(`/live-artifacts/${encodeURIComponent(e)}`,{query:{projectId:t}});return JSON.stringify(i)}case"opendesign_export_pdf":{let e=n?.projectId||n?.id,{fileName:t,title:i,deck:o}=n||{};if(!e)return JSON.stringify({error:"projectId is required"});if(!t)return JSON.stringify({error:"fileName is required"});let s={fileName:t};i!==void 0&&(s.title=i),o!==void 0&&(s.deck=o);let a=await d(`/projects/${encodeURIComponent(e)}/export/pdf`,{method:"POST",body:s});return JSON.stringify(a)}case"opendesign_export_html":{let e=n?.projectId||n?.id,t=n?.path;if(!e)return JSON.stringify({error:"projectId is required"});if(!t)return JSON.stringify({error:"path is required (the export sub-path)"});let o=String(t).replace(/^\/+/,"").split("/").map(a=>encodeURIComponent(a)).join("/"),s=await d(`/projects/${encodeURIComponent(e)}/export/${o}`,{query:{inline:1}});return JSON.stringify(s)}case"opendesign_cli_run":{let{agentId:e,message:t,projectId:i,conversationId:o,model:s}=n||{};if(!e)return JSON.stringify({error:"agentId is required"});if(!t)return JSON.stringify({error:"message is required"});let a={agentId:e,message:t};i!==void 0&&(a.projectId=i),o!==void 0&&(a.conversationId=o),s!==void 0&&(a.model=s);let c=await d("/runs",{method:"POST",body:a});return JSON.stringify(c)}case"opendesign_cli_status":{let e=n?.id||n?.runId;if(!e)return JSON.stringify({error:"id (runId) is required"});let t=await d(`/runs/${encodeURIComponent(e)}`);return JSON.stringify(t)}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}catch(e){return JSON.stringify({error:e.message})}},tools:[{name:"opendesign_health",description:"Probe the OpenDesign instance (GET /api/health, no auth). Use to confirm connectivity before other calls.",input_schema:{type:"object",properties:{}}},{name:"opendesign_list_projects",description:"List the projects in the OpenDesign workspace.",input_schema:{type:"object",properties:{}}},{name:"opendesign_get_project",description:"Get a single OpenDesign project by id.",input_schema:{type:"object",properties:{id:{type:"string",description:"The project id."}},required:["id"]}},{name:"opendesign_list_designs",description:"List the live design artifacts in an OpenDesign project. Requires the projectId, which scopes the query.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"The project id whose designs to list."}},required:["projectId"]}},{name:"opendesign_get_design",description:"Get a single live design artifact by id. Requires both the design id and its projectId.",input_schema:{type:"object",properties:{id:{type:"string",description:"The live-artifact (design) id."},projectId:{type:"string",description:"The project id the design belongs to (scopes the lookup)."}},required:["id","projectId"]}},{name:"opendesign_export_pdf",description:"Export an OpenDesign project deck to PDF. Returns the export result (e.g. a download URL/path).",input_schema:{type:"object",properties:{projectId:{type:"string",description:"The project id to export."},fileName:{type:"string",description:"The output PDF file name."},title:{type:"string",description:"Optional deck title for the PDF."},deck:{description:"Optional deck payload/override to render instead of the project's current deck."}},required:["projectId","fileName"]}},{name:"opendesign_export_html",description:"Fetch an OpenDesign project's HTML export by sub-path (requested inline). Requires projectId and the export path.",input_schema:{type:"object",properties:{projectId:{type:"string",description:"The project id to export."},path:{type:"string",description:'The export sub-path under /projects/:id/export/ (e.g. "index.html" or a slide path).'}},required:["projectId","path"]}},{name:"opendesign_cli_run",description:"Start an OpenDesign agent run. Returns a runId; poll opendesign_cli_status with it until the run finishes.",input_schema:{type:"object",properties:{agentId:{type:"string",description:"The OpenDesign agent id to run."},message:{type:"string",description:"The instruction/message to send to the agent."},projectId:{type:"string",description:"Optional project id to scope the run to."},conversationId:{type:"string",description:"Optional conversation id to continue an existing thread."},model:{type:"string",description:"Optional model id override for the run."}},required:["agentId","message"]}},{name:"opendesign_cli_status",description:"Poll the status of an OpenDesign agent run by its runId.",input_schema:{type:"object",properties:{id:{type:"string",description:"The runId returned by opendesign_cli_run."}},required:["id"]}}]};export{T as opendesignSkill};
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/skills",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Built-in skill definitions for the Zibby agent-workflow framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/dist/plane.js CHANGED
@@ -1,4 +1,4 @@
1
- var i=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),t=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});var r={id:"plane",serverName:"plane",allowedTools:["mcp__plane__*"],requiresIntegration:i.PLANE,envKeys:["PLANE_API_KEY","PLANE_WORKSPACE_SLUG","PLANE_BASE_URL"],description:"Plane \u2014 projects, work items, cycles, modules, epics, comments (official MCP, API key)",tools:[],promptFragment:`## Plane
1
+ var i=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",LARK_DOCS:"lark_docs",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",VIKUNJA:"vikunja",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),t=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark Docs",connectPath:"/integrations?provider=lark_docs"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},vikunja:{id:"vikunja",name:"Vikunja",connectPath:"/integrations?provider=vikunja"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});var r={id:"plane",serverName:"plane",allowedTools:["mcp__plane__*"],requiresIntegration:i.PLANE,envKeys:["PLANE_API_KEY","PLANE_WORKSPACE_SLUG","PLANE_BASE_URL"],description:"Plane \u2014 projects, work items, cycles, modules, epics, comments (official MCP, API key)",tools:[],promptFragment:`## Plane
2
2
  You have direct access to the user's Plane workspace via the official Plane MCP server. All Plane tools are available under the mcp__plane__* namespace \u2014 use them proactively to read and write projects, work items (issues), cycles, modules, epics, sub-issues, comments, labels, states, pages, and workspace data.
3
3
 
4
4
  - List/get projects and work items, then create/update/delete or search work items as needed.
package/dist/report.d.ts CHANGED
@@ -37,11 +37,11 @@ export declare const reportObjectSchema: z.ZodObject<{
37
37
  direction: z.ZodOptional<z.ZodEnum<["up", "down", "flat"]>>;
38
38
  severity: z.ZodOptional<z.ZodEnum<["ok", "info", "warn", "critical"]>>;
39
39
  }, "strip", z.ZodTypeAny, {
40
- severity?: "warn" | "info" | "ok" | "critical";
40
+ severity?: "warn" | "info" | "critical" | "ok";
41
41
  value?: string;
42
42
  direction?: "flat" | "up" | "down";
43
43
  }, {
44
- severity?: "warn" | "info" | "ok" | "critical";
44
+ severity?: "warn" | "info" | "critical" | "ok";
45
45
  value?: string;
46
46
  direction?: "flat" | "up" | "down";
47
47
  }>>;
@@ -50,7 +50,7 @@ export declare const reportObjectSchema: z.ZodObject<{
50
50
  summary?: string;
51
51
  primary?: string;
52
52
  delta?: {
53
- severity?: "warn" | "info" | "ok" | "critical";
53
+ severity?: "warn" | "info" | "critical" | "ok";
54
54
  value?: string;
55
55
  direction?: "flat" | "up" | "down";
56
56
  };
@@ -58,7 +58,7 @@ export declare const reportObjectSchema: z.ZodObject<{
58
58
  summary?: string;
59
59
  primary?: string;
60
60
  delta?: {
61
- severity?: "warn" | "info" | "ok" | "critical";
61
+ severity?: "warn" | "info" | "critical" | "ok";
62
62
  value?: string;
63
63
  direction?: "flat" | "up" | "down";
64
64
  };
@@ -73,14 +73,14 @@ export declare const reportObjectSchema: z.ZodObject<{
73
73
  }, "strip", z.ZodTypeAny, {
74
74
  values?: number[];
75
75
  title?: string;
76
- severity?: "warn" | "info" | "ok" | "critical";
76
+ severity?: "warn" | "info" | "critical" | "ok";
77
77
  kind?: "trend";
78
78
  labels?: string[];
79
79
  highlight?: "none" | "last" | "max" | "min";
80
80
  }, {
81
81
  values?: number[];
82
82
  title?: string;
83
- severity?: "warn" | "info" | "ok" | "critical";
83
+ severity?: "warn" | "info" | "critical" | "ok";
84
84
  kind?: "trend";
85
85
  labels?: string[];
86
86
  highlight?: "none" | "last" | "max" | "min";
@@ -107,12 +107,12 @@ export declare const reportObjectSchema: z.ZodObject<{
107
107
  }, "strip", z.ZodTypeAny, {
108
108
  title?: string;
109
109
  kind?: "callouts";
110
- tone?: "warn" | "info" | "ok" | "critical";
110
+ tone?: "warn" | "info" | "critical" | "ok";
111
111
  items?: string[];
112
112
  }, {
113
113
  title?: string;
114
114
  kind?: "callouts";
115
- tone?: "warn" | "info" | "ok" | "critical";
115
+ tone?: "warn" | "info" | "critical" | "ok";
116
116
  items?: string[];
117
117
  }>, z.ZodObject<{
118
118
  kind: z.ZodLiteral<"breakdown">;
@@ -124,12 +124,12 @@ export declare const reportObjectSchema: z.ZodObject<{
124
124
  severity: z.ZodOptional<z.ZodEnum<["ok", "info", "warn", "critical"]>>;
125
125
  }, "strip", z.ZodTypeAny, {
126
126
  sub?: string;
127
- severity?: "warn" | "info" | "ok" | "critical";
127
+ severity?: "warn" | "info" | "critical" | "ok";
128
128
  value?: string;
129
129
  label?: string;
130
130
  }, {
131
131
  sub?: string;
132
- severity?: "warn" | "info" | "ok" | "critical";
132
+ severity?: "warn" | "info" | "critical" | "ok";
133
133
  value?: string;
134
134
  label?: string;
135
135
  }>, "many">;
@@ -138,7 +138,7 @@ export declare const reportObjectSchema: z.ZodObject<{
138
138
  kind?: "breakdown";
139
139
  rows?: {
140
140
  sub?: string;
141
- severity?: "warn" | "info" | "ok" | "critical";
141
+ severity?: "warn" | "info" | "critical" | "ok";
142
142
  value?: string;
143
143
  label?: string;
144
144
  }[];
@@ -147,7 +147,7 @@ export declare const reportObjectSchema: z.ZodObject<{
147
147
  kind?: "breakdown";
148
148
  rows?: {
149
149
  sub?: string;
150
- severity?: "warn" | "info" | "ok" | "critical";
150
+ severity?: "warn" | "info" | "critical" | "ok";
151
151
  value?: string;
152
152
  label?: string;
153
153
  }[];
@@ -166,7 +166,7 @@ export declare const reportObjectSchema: z.ZodObject<{
166
166
  }>]>, "many">>, ({
167
167
  values?: number[];
168
168
  title?: string;
169
- severity?: "warn" | "info" | "ok" | "critical";
169
+ severity?: "warn" | "info" | "critical" | "ok";
170
170
  kind?: "trend";
171
171
  labels?: string[];
172
172
  highlight?: "none" | "last" | "max" | "min";
@@ -178,14 +178,14 @@ export declare const reportObjectSchema: z.ZodObject<{
178
178
  } | {
179
179
  title?: string;
180
180
  kind?: "callouts";
181
- tone?: "warn" | "info" | "ok" | "critical";
181
+ tone?: "warn" | "info" | "critical" | "ok";
182
182
  items?: string[];
183
183
  } | {
184
184
  title?: string;
185
185
  kind?: "breakdown";
186
186
  rows?: {
187
187
  sub?: string;
188
- severity?: "warn" | "info" | "ok" | "critical";
188
+ severity?: "warn" | "info" | "critical" | "ok";
189
189
  value?: string;
190
190
  label?: string;
191
191
  }[];
@@ -196,7 +196,7 @@ export declare const reportObjectSchema: z.ZodObject<{
196
196
  })[], ({
197
197
  values?: number[];
198
198
  title?: string;
199
- severity?: "warn" | "info" | "ok" | "critical";
199
+ severity?: "warn" | "info" | "critical" | "ok";
200
200
  kind?: "trend";
201
201
  labels?: string[];
202
202
  highlight?: "none" | "last" | "max" | "min";
@@ -208,14 +208,14 @@ export declare const reportObjectSchema: z.ZodObject<{
208
208
  } | {
209
209
  title?: string;
210
210
  kind?: "callouts";
211
- tone?: "warn" | "info" | "ok" | "critical";
211
+ tone?: "warn" | "info" | "critical" | "ok";
212
212
  items?: string[];
213
213
  } | {
214
214
  title?: string;
215
215
  kind?: "breakdown";
216
216
  rows?: {
217
217
  sub?: string;
218
- severity?: "warn" | "info" | "ok" | "critical";
218
+ severity?: "warn" | "info" | "critical" | "ok";
219
219
  value?: string;
220
220
  label?: string;
221
221
  }[];
@@ -241,7 +241,7 @@ export declare const reportObjectSchema: z.ZodObject<{
241
241
  summary?: string;
242
242
  primary?: string;
243
243
  delta?: {
244
- severity?: "warn" | "info" | "ok" | "critical";
244
+ severity?: "warn" | "info" | "critical" | "ok";
245
245
  value?: string;
246
246
  direction?: "flat" | "up" | "down";
247
247
  };
@@ -249,7 +249,7 @@ export declare const reportObjectSchema: z.ZodObject<{
249
249
  sections?: ({
250
250
  values?: number[];
251
251
  title?: string;
252
- severity?: "warn" | "info" | "ok" | "critical";
252
+ severity?: "warn" | "info" | "critical" | "ok";
253
253
  kind?: "trend";
254
254
  labels?: string[];
255
255
  highlight?: "none" | "last" | "max" | "min";
@@ -261,14 +261,14 @@ export declare const reportObjectSchema: z.ZodObject<{
261
261
  } | {
262
262
  title?: string;
263
263
  kind?: "callouts";
264
- tone?: "warn" | "info" | "ok" | "critical";
264
+ tone?: "warn" | "info" | "critical" | "ok";
265
265
  items?: string[];
266
266
  } | {
267
267
  title?: string;
268
268
  kind?: "breakdown";
269
269
  rows?: {
270
270
  sub?: string;
271
- severity?: "warn" | "info" | "ok" | "critical";
271
+ severity?: "warn" | "info" | "critical" | "ok";
272
272
  value?: string;
273
273
  label?: string;
274
274
  }[];
@@ -288,7 +288,7 @@ export declare const reportObjectSchema: z.ZodObject<{
288
288
  summary?: string;
289
289
  primary?: string;
290
290
  delta?: {
291
- severity?: "warn" | "info" | "ok" | "critical";
291
+ severity?: "warn" | "info" | "critical" | "ok";
292
292
  value?: string;
293
293
  direction?: "flat" | "up" | "down";
294
294
  };
@@ -296,7 +296,7 @@ export declare const reportObjectSchema: z.ZodObject<{
296
296
  sections?: ({
297
297
  values?: number[];
298
298
  title?: string;
299
- severity?: "warn" | "info" | "ok" | "critical";
299
+ severity?: "warn" | "info" | "critical" | "ok";
300
300
  kind?: "trend";
301
301
  labels?: string[];
302
302
  highlight?: "none" | "last" | "max" | "min";
@@ -308,14 +308,14 @@ export declare const reportObjectSchema: z.ZodObject<{
308
308
  } | {
309
309
  title?: string;
310
310
  kind?: "callouts";
311
- tone?: "warn" | "info" | "ok" | "critical";
311
+ tone?: "warn" | "info" | "critical" | "ok";
312
312
  items?: string[];
313
313
  } | {
314
314
  title?: string;
315
315
  kind?: "breakdown";
316
316
  rows?: {
317
317
  sub?: string;
318
- severity?: "warn" | "info" | "ok" | "critical";
318
+ severity?: "warn" | "info" | "critical" | "ok";
319
319
  value?: string;
320
320
  label?: string;
321
321
  }[];
package/dist/sentry.js CHANGED
@@ -1,7 +1,7 @@
1
- import{existsSync as h}from"fs";import{fileURLToPath as _}from"url";import{dirname as S,resolve as I}from"path";import{resolveIntegrationToken as c}from"@zibby/core/backend-client.js";var l=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),P=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});function f(){if(process.env.MCP_SENTRY_PATH)return process.env.MCP_SENTRY_PATH;let n=S(_(import.meta.url)),e=I(n,"..","bin","mcp-sentry.mjs");return h(e)?e:null}function d(n){return(n||process.env.SENTRY_URL||"https://sentry.io").trim().replace(/\/+$/,"")}function m(n){let e=n||process.env.SENTRY_ORG;if(!e)throw new Error('Sentry organization not resolved \u2014 reconnect Sentry, or set SENTRY_ORG (self-hosted; the default org slug is "sentry").');return e}async function g(n,e={}){let{token:t,organizationSlug:s,baseUrl:i}=await c("sentry"),r=`${d(i)}/api/0/organizations/${m(s)}${n}`,o={method:e.method||"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}};e.body!=null&&(o.body=typeof e.body=="string"?e.body:JSON.stringify(e.body));let a=await fetch(r,o);if(!a.ok){let u=await a.text().catch(()=>"");throw new Error(`Sentry API ${a.status}: ${u.slice(0,300)}`)}return a.json()}async function w(){return g("/projects/?per_page=50")}async function k({query:n="is:unresolved",sort:e="date",project:t,limit:s=25}={}){let i=`/issues/?query=${encodeURIComponent(n)}&sort=${e}&per_page=${s}`;return t&&(i+=`&project=${encodeURIComponent(t)}`),g(i)}async function p(n){let e=String(n??"").trim();if(!e)throw new Error("resolveSentryIssueId: issueRef is required");if(/^\d+$/.test(e))return e;let{token:t,organizationSlug:s,baseUrl:i}=await c("sentry"),r=await fetch(`${d(i)}/api/0/organizations/${m(s)}/shortids/${encodeURIComponent(e)}/`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok){let u=await r.text().catch(()=>"");throw new Error(`Sentry API ${r.status} resolving shortId "${e}": ${u.slice(0,200)}`)}let o=await r.json(),a=o.groupId||o.group&&o.group.id;if(!a)throw new Error(`Sentry shortId "${e}" did not resolve to a numeric issue id`);return String(a)}async function b(n){if(!n)throw new Error("sentryGetIssue: issueId is required");let e=await p(n),{token:t,baseUrl:s}=await c("sentry"),i=await fetch(`${d(s)}/api/0/issues/${e}/`,{headers:{Authorization:`Bearer ${t}`}});if(!i.ok){let r=await i.text().catch(()=>"");throw new Error(`Sentry API ${i.status}: ${r.slice(0,300)}`)}return i.json()}async function v(n,e={}){if(!n)throw new Error("sentryUpdateIssue: issueId is required");let t={};for(let a of["status","statusDetails","assignedTo","isBookmarked","hasSeen"])e[a]!==void 0&&(t[a]=e[a]);if(Object.keys(t).length===0)throw new Error("sentryUpdateIssue: nothing to update (pass status / statusDetails / assignedTo / isBookmarked / hasSeen)");let s=await p(n),{token:i,baseUrl:r}=await c("sentry"),o=await fetch(`${d(r)}/api/0/issues/${s}/`,{method:"PUT",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){let a=await o.text().catch(()=>"");throw o.status===403?new Error(`Sentry API 403 updating issue ${n}: ${a.slice(0,200)}. The connected Sentry integration likely lacks the \`event:write\` scope \u2014 reconnect Sentry with write access to let Zibby resolve/comment on issues.`):new Error(`Sentry API ${o.status} updating issue ${n}: ${a.slice(0,300)}`)}return o.json()}async function N(n,e){if(!n)throw new Error("sentryAddComment: issueId is required");if(!e||!String(e).trim())throw new Error("sentryAddComment: text is required");let t=await p(n),{token:s,baseUrl:i}=await c("sentry"),r=await fetch(`${d(i)}/api/0/issues/${t}/comments/`,{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify({text:String(e)})});if(!r.ok){let o=await r.text().catch(()=>"");throw r.status===403?new Error(`Sentry API 403 commenting on issue ${n}: ${o.slice(0,200)}. The connected Sentry integration likely lacks the \`event:write\` scope \u2014 reconnect Sentry with write access.`):new Error(`Sentry API ${r.status} commenting on issue ${n}: ${o.slice(0,300)}`)}return r.json()}var y={id:"sentry",callsBackend:!0,serverName:"sentry",allowedTools:["mcp__sentry__*"],requiresIntegration:l.SENTRY,description:"Sentry error tracking \u2014 projects, issues, events",envKeys:[],tools:[],promptFragment:`## Sentry
1
+ import{existsSync as h}from"fs";import{fileURLToPath as _}from"url";import{dirname as S,resolve as I}from"path";import{resolveIntegrationToken as c}from"@zibby/core/backend-client.js";var p=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",LARK_DOCS:"lark_docs",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",VIKUNJA:"vikunja",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),N=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark Docs",connectPath:"/integrations?provider=lark_docs"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},vikunja:{id:"vikunja",name:"Vikunja",connectPath:"/integrations?provider=vikunja"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});function f(){if(process.env.MCP_SENTRY_PATH)return process.env.MCP_SENTRY_PATH;let n=S(_(import.meta.url)),e=I(n,"..","bin","mcp-sentry.mjs");return h(e)?e:null}function d(n){return(n||process.env.SENTRY_URL||"https://sentry.io").trim().replace(/\/+$/,"")}function m(n){let e=n||process.env.SENTRY_ORG;if(!e)throw new Error('Sentry organization not resolved \u2014 reconnect Sentry, or set SENTRY_ORG (self-hosted; the default org slug is "sentry").');return e}async function g(n,e={}){let{token:t,organizationSlug:s,baseUrl:i}=await c("sentry"),r=`${d(i)}/api/0/organizations/${m(s)}${n}`,o={method:e.method||"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}};e.body!=null&&(o.body=typeof e.body=="string"?e.body:JSON.stringify(e.body));let a=await fetch(r,o);if(!a.ok){let u=await a.text().catch(()=>"");throw new Error(`Sentry API ${a.status}: ${u.slice(0,300)}`)}return a.json()}async function k(){return g("/projects/?per_page=50")}async function w({query:n="is:unresolved",sort:e="date",project:t,limit:s=25}={}){let i=`/issues/?query=${encodeURIComponent(n)}&sort=${e}&per_page=${s}`;return t&&(i+=`&project=${encodeURIComponent(t)}`),g(i)}async function l(n){let e=String(n??"").trim();if(!e)throw new Error("resolveSentryIssueId: issueRef is required");if(/^\d+$/.test(e))return e;let{token:t,organizationSlug:s,baseUrl:i}=await c("sentry"),r=await fetch(`${d(i)}/api/0/organizations/${m(s)}/shortids/${encodeURIComponent(e)}/`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok){let u=await r.text().catch(()=>"");throw new Error(`Sentry API ${r.status} resolving shortId "${e}": ${u.slice(0,200)}`)}let o=await r.json(),a=o.groupId||o.group&&o.group.id;if(!a)throw new Error(`Sentry shortId "${e}" did not resolve to a numeric issue id`);return String(a)}async function v(n){if(!n)throw new Error("sentryGetIssue: issueId is required");let e=await l(n),{token:t,baseUrl:s}=await c("sentry"),i=await fetch(`${d(s)}/api/0/issues/${e}/`,{headers:{Authorization:`Bearer ${t}`}});if(!i.ok){let r=await i.text().catch(()=>"");throw new Error(`Sentry API ${i.status}: ${r.slice(0,300)}`)}return i.json()}async function b(n,e={}){if(!n)throw new Error("sentryUpdateIssue: issueId is required");let t={};for(let a of["status","statusDetails","assignedTo","isBookmarked","hasSeen"])e[a]!==void 0&&(t[a]=e[a]);if(Object.keys(t).length===0)throw new Error("sentryUpdateIssue: nothing to update (pass status / statusDetails / assignedTo / isBookmarked / hasSeen)");let s=await l(n),{token:i,baseUrl:r}=await c("sentry"),o=await fetch(`${d(r)}/api/0/issues/${s}/`,{method:"PUT",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){let a=await o.text().catch(()=>"");throw o.status===403?new Error(`Sentry API 403 updating issue ${n}: ${a.slice(0,200)}. The connected Sentry integration likely lacks the \`event:write\` scope \u2014 reconnect Sentry with write access to let Zibby resolve/comment on issues.`):new Error(`Sentry API ${o.status} updating issue ${n}: ${a.slice(0,300)}`)}return o.json()}async function P(n,e){if(!n)throw new Error("sentryAddComment: issueId is required");if(!e||!String(e).trim())throw new Error("sentryAddComment: text is required");let t=await l(n),{token:s,baseUrl:i}=await c("sentry"),r=await fetch(`${d(i)}/api/0/issues/${t}/comments/`,{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify({text:String(e)})});if(!r.ok){let o=await r.text().catch(()=>"");throw r.status===403?new Error(`Sentry API 403 commenting on issue ${n}: ${o.slice(0,200)}. The connected Sentry integration likely lacks the \`event:write\` scope \u2014 reconnect Sentry with write access.`):new Error(`Sentry API ${r.status} commenting on issue ${n}: ${o.slice(0,300)}`)}return r.json()}var y={id:"sentry",callsBackend:!0,serverName:"sentry",allowedTools:["mcp__sentry__*"],requiresIntegration:p.SENTRY,description:"Sentry error tracking \u2014 projects, issues, events",envKeys:[],tools:[],promptFragment:`## Sentry
2
2
  You have access to the user's Sentry. Use these tools:
3
3
  - sentry_list_projects: List projects in the organization
4
4
  - sentry_list_issues: List errors/issues (supports Sentry search query, project filter, sort)
5
5
  - sentry_get_issue: Get detailed info about a specific issue (requires issueId)
6
6
  - sentry_update_issue: Change an issue's status (resolved / resolvedInNextRelease / ignored / unresolved / muted), assignment, or bookmark (requires issueId; needs write scope)
7
- - sentry_add_comment: Post a comment/note on an issue (requires issueId + text; needs write scope)`,resolve(){let n=f();if(!n)return null;let e={};for(let t of["PROJECT_API_TOKEN","ZIBBY_USER_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","PROGRESS_API_URL","EXECUTION_ID","PROJECT_ID","STAGE","ZIBBY_SELF_HOST","SENTRY_URL","SENTRY_ORG","SENTRY_AUTH_TOKEN"])process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[n],env:e,alwaysLoad:!0}},async handleToolCall(n,e={}){try{switch(n){case"sentry_list_projects":{let t=await w();return JSON.stringify({projects:t.map(s=>({slug:s.slug,name:s.name,platform:s.platform}))})}case"sentry_list_issues":{let t=await k({query:e.query,sort:e.sort,project:e.project,limit:e.limit});return JSON.stringify({issues:t.map(s=>({id:s.id,title:s.title,culprit:s.culprit,count:s.count,firstSeen:s.firstSeen,lastSeen:s.lastSeen,level:s.level,status:s.status}))})}case"sentry_get_issue":{let t=await b(e.issueId);return JSON.stringify({id:t.id,title:t.title,culprit:t.culprit,metadata:t.metadata,count:t.count,userCount:t.userCount,firstSeen:t.firstSeen,lastSeen:t.lastSeen,level:t.level,status:t.status,project:{slug:t.project?.slug,name:t.project?.name}})}case"sentry_update_issue":{let t=await v(e.issueId,{status:e.status,statusDetails:e.statusDetails,assignedTo:e.assignedTo,isBookmarked:e.isBookmarked,hasSeen:e.hasSeen});return JSON.stringify({ok:!0,id:t.id??e.issueId,status:t.status,assignedTo:t.assignedTo,isBookmarked:t.isBookmarked})}case"sentry_add_comment":{let t=await N(e.issueId,e.text);return JSON.stringify({ok:!0,id:t.id,issueId:e.issueId})}default:return JSON.stringify({error:`Unknown tool: ${n}`})}}catch(t){return JSON.stringify({error:t.message})}},toolsForAssistant:[{name:"sentry_list_projects",description:"List Sentry projects",input_schema:{type:"object",properties:{}}},{name:"sentry_list_issues",description:"List Sentry issues (errors)",input_schema:{type:"object",properties:{project:{type:"string",description:"Project slug (optional)"},query:{type:"string",description:"Sentry search query (default: is:unresolved)"},sort:{type:"string",description:"Sort order: date, new, priority, freq, user (default: date)"},limit:{type:"number",description:"Max issues to return (default 25)"}}}},{name:"sentry_get_issue",description:"Get details of a specific Sentry issue",input_schema:{type:"object",properties:{issueId:{type:"string",description:"Sentry issue ID"}},required:["issueId"]}},{name:"sentry_update_issue",description:"Update a Sentry issue's status, assignment, or bookmark (needs event:write scope)",input_schema:{type:"object",properties:{issueId:{type:"string",description:"Sentry issue ID"},status:{type:"string",description:"resolved | resolvedInNextRelease | unresolved | ignored | muted"},statusDetails:{type:"object",description:'Optional status details, e.g. { "inRelease": "latest" }'},assignedTo:{type:"string",description:'Assignee actor id, e.g. "user:123" or "team:456" (optional)'},isBookmarked:{type:"boolean",description:"Bookmark/unbookmark the issue (optional)"},hasSeen:{type:"boolean",description:"Mark the issue seen/unseen (optional)"}},required:["issueId"]}},{name:"sentry_add_comment",description:"Post a comment/note on a Sentry issue (needs event:write scope)",input_schema:{type:"object",properties:{issueId:{type:"string",description:"Sentry issue ID"},text:{type:"string",description:"Comment body (markdown)"}},required:["issueId","text"]}}]};y.tools=y.toolsForAssistant;export{p as resolveSentryIssueId,N as sentryAddComment,g as sentryFetch,b as sentryGetIssue,k as sentryListIssues,w as sentryListProjects,y as sentrySkill,v as sentryUpdateIssue};
7
+ - sentry_add_comment: Post a comment/note on an issue (requires issueId + text; needs write scope)`,resolve(){let n=f();if(!n)return null;let e={};for(let t of["PROJECT_API_TOKEN","ZIBBY_USER_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","PROGRESS_API_URL","EXECUTION_ID","PROJECT_ID","STAGE","ZIBBY_SELF_HOST","SENTRY_URL","SENTRY_ORG","SENTRY_AUTH_TOKEN"])process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[n],env:e,alwaysLoad:!0}},async handleToolCall(n,e={}){try{switch(n){case"sentry_list_projects":{let t=await k();return JSON.stringify({projects:t.map(s=>({slug:s.slug,name:s.name,platform:s.platform}))})}case"sentry_list_issues":{let t=await w({query:e.query,sort:e.sort,project:e.project,limit:e.limit});return JSON.stringify({issues:t.map(s=>({id:s.id,title:s.title,culprit:s.culprit,count:s.count,firstSeen:s.firstSeen,lastSeen:s.lastSeen,level:s.level,status:s.status}))})}case"sentry_get_issue":{let t=await v(e.issueId);return JSON.stringify({id:t.id,title:t.title,culprit:t.culprit,metadata:t.metadata,count:t.count,userCount:t.userCount,firstSeen:t.firstSeen,lastSeen:t.lastSeen,level:t.level,status:t.status,project:{slug:t.project?.slug,name:t.project?.name}})}case"sentry_update_issue":{let t=await b(e.issueId,{status:e.status,statusDetails:e.statusDetails,assignedTo:e.assignedTo,isBookmarked:e.isBookmarked,hasSeen:e.hasSeen});return JSON.stringify({ok:!0,id:t.id??e.issueId,status:t.status,assignedTo:t.assignedTo,isBookmarked:t.isBookmarked})}case"sentry_add_comment":{let t=await P(e.issueId,e.text);return JSON.stringify({ok:!0,id:t.id,issueId:e.issueId})}default:return JSON.stringify({error:`Unknown tool: ${n}`})}}catch(t){return JSON.stringify({error:t.message})}},toolsForAssistant:[{name:"sentry_list_projects",description:"List Sentry projects",input_schema:{type:"object",properties:{}}},{name:"sentry_list_issues",description:"List Sentry issues (errors)",input_schema:{type:"object",properties:{project:{type:"string",description:"Project slug (optional)"},query:{type:"string",description:"Sentry search query (default: is:unresolved)"},sort:{type:"string",description:"Sort order: date, new, priority, freq, user (default: date)"},limit:{type:"number",description:"Max issues to return (default 25)"}}}},{name:"sentry_get_issue",description:"Get details of a specific Sentry issue",input_schema:{type:"object",properties:{issueId:{type:"string",description:"Sentry issue ID"}},required:["issueId"]}},{name:"sentry_update_issue",description:"Update a Sentry issue's status, assignment, or bookmark (needs event:write scope)",input_schema:{type:"object",properties:{issueId:{type:"string",description:"Sentry issue ID"},status:{type:"string",description:"resolved | resolvedInNextRelease | unresolved | ignored | muted"},statusDetails:{type:"object",description:'Optional status details, e.g. { "inRelease": "latest" }'},assignedTo:{type:"string",description:'Assignee actor id, e.g. "user:123" or "team:456" (optional)'},isBookmarked:{type:"boolean",description:"Bookmark/unbookmark the issue (optional)"},hasSeen:{type:"boolean",description:"Mark the issue seen/unseen (optional)"}},required:["issueId"]}},{name:"sentry_add_comment",description:"Post a comment/note on a Sentry issue (needs event:write scope)",input_schema:{type:"object",properties:{issueId:{type:"string",description:"Sentry issue ID"},text:{type:"string",description:"Comment body (markdown)"}},required:["issueId","text"]}}]};y.tools=y.toolsForAssistant;export{l as resolveSentryIssueId,P as sentryAddComment,g as sentryFetch,v as sentryGetIssue,w as sentryListIssues,k as sentryListProjects,y as sentrySkill,b as sentryUpdateIssue};
package/dist/slack.js CHANGED
@@ -1,7 +1,7 @@
1
- import{existsSync as h}from"fs";import{fileURLToPath as g}from"url";import{dirname as k,resolve as f}from"path";import{resolveIntegrationToken as y}from"@zibby/core/backend-client.js";var _=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),S=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});function b(){if(process.env.MCP_SLACK_PATH)return process.env.MCP_SLACK_PATH;let a=k(g(import.meta.url)),t=f(a,"..","bin","mcp-slack.mjs");return h(t)?t:null}async function n(a,t={}){let{token:e}=await y("slack"),i=["conversations.list","users.list","users.profile.get","users.lookupByEmail","usergroups.list","usergroups.users.list","conversations.history","conversations.replies"].includes(a),c=`https://slack.com/api/${a}`,o={Authorization:`Bearer ${e}`},d;if(i){let s=new URLSearchParams(t).toString();s&&(c+=`?${s}`)}else o["Content-Type"]="application/json; charset=utf-8",d=JSON.stringify(t);let r=await(await fetch(c,{method:i?"GET":"POST",headers:o,body:d})).json();if(!r.ok)throw new Error(`Slack API error: ${r.error}`);return r}var w={id:"slack",callsBackend:!0,serverName:"slack",allowedTools:["mcp__slack__*"],requiresIntegration:_.SLACK,envKeys:["SLACK_BOT_TOKEN","SLACK_TEAM_ID"],description:"Slack MCP Server",promptFragment:`## Slack
1
+ import{existsSync as h}from"fs";import{fileURLToPath as g}from"url";import{dirname as k,resolve as f}from"path";import{resolveIntegrationToken as y}from"@zibby/core/backend-client.js";var _=Object.freeze({SENTRY:"sentry",JIRA:"jira",GITHUB:"github",GITLAB:"gitlab",SLACK:"slack",LARK:"lark",LARK_DOCS:"lark_docs",OPENAI_BILLING:"openai_billing",ANTHROPIC_BILLING:"anthropic_billing",CURSOR_ADMIN:"cursor_admin",NOTION:"notion",GOOGLE:"google",PLANE:"plane",LINEAR:"linear",VIKUNJA:"vikunja",FIGMA:"figma",HUBSPOT:"hubspot",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business",DISCORD:"discord"}),S=Object.freeze({sentry:{id:"sentry",name:"Sentry",connectPath:"/integrations?provider=sentry"},jira:{id:"jira",name:"Jira",connectPath:"/integrations?provider=jira"},github:{id:"github",name:"GitHub",connectPath:"/integrations?provider=github"},gitlab:{id:"gitlab",name:"GitLab",connectPath:"/integrations?provider=gitlab"},slack:{id:"slack",name:"Slack",connectPath:"/integrations?provider=slack"},lark:{id:"lark",name:"Lark",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark Docs",connectPath:"/integrations?provider=lark_docs"},openai_billing:{id:"openai_billing",name:"OpenAI Admin",connectPath:"/integrations?provider=openai_billing"},anthropic_billing:{id:"anthropic_billing",name:"Anthropic Admin",connectPath:"/integrations?provider=anthropic_billing"},cursor_admin:{id:"cursor_admin",name:"Cursor Admin",connectPath:"/integrations?provider=cursor_admin"},notion:{id:"notion",name:"Notion",connectPath:"/integrations?provider=notion"},google:{id:"google",name:"Google Docs",connectPath:"/integrations?provider=google"},plane:{id:"plane",name:"Plane",connectPath:"/integrations?provider=plane"},linear:{id:"linear",name:"Linear",connectPath:"/integrations?provider=linear"},vikunja:{id:"vikunja",name:"Vikunja",connectPath:"/integrations?provider=vikunja"},figma:{id:"figma",name:"Figma",connectPath:"/integrations?provider=figma"},hubspot:{id:"hubspot",name:"HubSpot",connectPath:"/integrations?provider=hubspot"},open_design:{id:"open_design",name:"OpenDesign",connectPath:"/integrations?provider=open_design"},linkedin_personal:{id:"linkedin_personal",name:"LinkedIn (Personal)",connectPath:"/integrations?provider=linkedin_personal"},linkedin_business:{id:"linkedin_business",name:"LinkedIn (Business)",connectPath:"/integrations?provider=linkedin_business"},discord:{id:"discord",name:"Discord",connectPath:"/integrations?provider=discord"}});function b(){if(process.env.MCP_SLACK_PATH)return process.env.MCP_SLACK_PATH;let a=k(g(import.meta.url)),t=f(a,"..","bin","mcp-slack.mjs");return h(t)?t:null}async function s(a,t={}){let{token:e}=await y("slack"),i=["conversations.list","users.list","users.profile.get","users.lookupByEmail","usergroups.list","usergroups.users.list","conversations.history","conversations.replies"].includes(a),c=`https://slack.com/api/${a}`,o={Authorization:`Bearer ${e}`},d;if(i){let n=new URLSearchParams(t).toString();n&&(c+=`?${n}`)}else o["Content-Type"]="application/json; charset=utf-8",d=JSON.stringify(t);let r=await(await fetch(c,{method:i?"GET":"POST",headers:o,body:d})).json();if(!r.ok)throw new Error(`Slack API error: ${r.error}`);return r}var w={id:"slack",callsBackend:!0,serverName:"slack",allowedTools:["mcp__slack__*"],requiresIntegration:_.SLACK,envKeys:["SLACK_BOT_TOKEN","SLACK_TEAM_ID"],description:"Slack MCP Server",promptFragment:`## Slack
2
2
  You have access to the user's Slack workspace. Use these tools:
3
3
  - slack_list_channels, slack_post_message, slack_reply_to_thread
4
4
  - slack_add_reaction, slack_get_channel_history, slack_get_thread_replies
5
5
  - slack_get_users, slack_get_user_profile
6
6
  - slack_lookup_user_by_email (precise email\u2192user_id, prefer this over scanning slack_get_users)
7
- - slack_list_usergroups, slack_get_usergroup_members (workspace-defined teams like @oncall, @platform)`,resolve(){let a=b();if(!a)return null;let t={};for(let e of["PROJECT_API_TOKEN","ZIBBY_USER_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","PROGRESS_API_URL","EXECUTION_ID","PROJECT_ID","STAGE"])process.env[e]&&(t[e]=process.env[e]);for(let e of this.envKeys)process.env[e]&&(t[e]=process.env[e]);return{type:"stdio",command:"node",args:[a],env:t,alwaysLoad:!0}},async handleToolCall(a,t){try{switch(a){case"slack_list_channels":{let e=await n("conversations.list",{types:"public_channel",limit:100});return JSON.stringify({channels:(e.channels||[]).map(i=>({id:i.id,name:i.name,topic:i.topic?.value}))})}case"slack_post_message":{if(!t.channel||!t.text)return JSON.stringify({error:"channel and text are required"});let e=await n("chat.postMessage",{channel:t.channel,text:t.text,...t.blocks?{blocks:t.blocks}:{}});return JSON.stringify({ok:!0,ts:e.ts,channel:e.channel})}case"slack_reply_to_thread":{if(!t.channel||!t.thread_ts||!t.text)return JSON.stringify({error:"channel, thread_ts, and text are required"});let e=await n("chat.postMessage",{channel:t.channel,thread_ts:t.thread_ts,text:t.text});return JSON.stringify({ok:!0,ts:e.ts})}case"slack_add_reaction":return!t.channel||!t.timestamp||!t.reaction?JSON.stringify({error:"channel, timestamp, and reaction are required"}):(await n("reactions.add",{channel:t.channel,timestamp:t.timestamp,name:t.reaction}),JSON.stringify({ok:!0}));case"slack_get_channel_history":{if(!t.channel)return JSON.stringify({error:"channel is required"});let e=await n("conversations.history",{channel:t.channel,limit:t.limit||20});return JSON.stringify({messages:(e.messages||[]).map(i=>({user:i.user,text:i.text,ts:i.ts}))})}case"slack_get_thread_replies":{if(!t.channel||!t.thread_ts)return JSON.stringify({error:"channel and thread_ts are required"});let e=await n("conversations.replies",{channel:t.channel,ts:t.thread_ts});return JSON.stringify({messages:(e.messages||[]).map(i=>({user:i.user,text:i.text,ts:i.ts}))})}case"slack_get_users":{let e=await n("users.list",{limit:100});return JSON.stringify({users:(e.members||[]).filter(i=>!i.is_bot&&!i.deleted).map(i=>({id:i.id,name:i.real_name||i.name}))})}case"slack_get_user_profile":{if(!t.user_id)return JSON.stringify({error:"user_id is required"});let e=await n("users.profile.get",{user:t.user_id});return JSON.stringify({profile:e.profile})}case"slack_lookup_user_by_email":{if(!t.email)return JSON.stringify({error:"email is required"});try{let e=await n("users.lookupByEmail",{email:t.email});return JSON.stringify({ok:!0,user:{id:e.user?.id,name:e.user?.real_name||e.user?.name,email:e.user?.profile?.email||t.email}})}catch(e){if(/users_not_found/.test(e.message))return JSON.stringify({ok:!1,reason:"users_not_found"});throw e}}case"slack_list_usergroups":{let e=await n("usergroups.list",{});return JSON.stringify({usergroups:(e.usergroups||[]).map(i=>({id:i.id,handle:i.handle,name:i.name,description:i.description||"",user_count:Number(i.user_count||0)}))})}case"slack_get_usergroup_members":{if(!t.usergroup)return JSON.stringify({error:"usergroup id is required"});let e=await n("usergroups.users.list",{usergroup:t.usergroup});return JSON.stringify({users:e.users||[]})}case"slack_search_users":{if(!t.query||typeof t.query!="string")return JSON.stringify({error:"query is required"});let e=t.query.trim().toLowerCase();if(!e)return JSON.stringify({ok:!0,matches:[]});let i=Math.max(1,Math.min(Number(t.limit)||5,25)),c=[],o,d=5;for(let r=0;r<d;r+=1){let s={limit:200};o&&(s.cursor=o);let l=await n("users.list",s);for(let p of l.members||[])p.deleted||p.is_bot||c.push(p);if(o=l.response_metadata?.next_cursor,!o)break}let m=[];for(let r of c){let s=(r.real_name||"").toLowerCase(),l=(r.profile?.display_name||"").toLowerCase(),p=(r.name||"").toLowerCase(),u=0;s.includes(e)&&(u+=100-Math.abs(s.length-e.length)),l.includes(e)&&(u+=60-Math.abs(l.length-e.length)),p.includes(e)&&(u+=30-Math.abs(p.length-e.length)),(s===e||l===e)&&(u+=200),u>0&&m.push({id:r.id,name:r.real_name||r.profile?.display_name||r.name,email:r.profile?.email||void 0,_score:u})}return m.sort((r,s)=>s._score-r._score),JSON.stringify({ok:!0,matches:m.slice(0,i).map(({_score:r,...s})=>s),scanned:c.length})}default:return JSON.stringify({error:`Unknown tool: ${a}`})}}catch(e){return JSON.stringify({error:e.message})}},tools:[{name:"slack_list_channels",description:"List public channels in the workspace",input_schema:{type:"object",properties:{}}},{name:"slack_post_message",description:"Post a message to a Slack channel or DM. Pass `blocks` (Block Kit) for a rich card; `text` is the required notification fallback.",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID or name"},text:{type:"string",description:"Notification/fallback text (required)"},blocks:{type:"array",description:"Block Kit blocks for rich formatting (optional). Each block is a Slack Block Kit object (header/section/divider/context). section blocks may carry a button accessory with a url."}},required:["channel","text"]}},{name:"slack_reply_to_thread",description:"Reply to a specific message thread",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},thread_ts:{type:"string",description:"Thread timestamp"},text:{type:"string",description:"Reply text"}},required:["channel","thread_ts","text"]}},{name:"slack_add_reaction",description:"Add an emoji reaction to a message",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},timestamp:{type:"string",description:"Message timestamp"},reaction:{type:"string",description:"Emoji name without colons"}},required:["channel","timestamp","reaction"]}},{name:"slack_get_channel_history",description:"Get recent messages from a channel",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},limit:{type:"number",description:"Number of messages"}},required:["channel"]}},{name:"slack_get_thread_replies",description:"Get all replies in a message thread",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},thread_ts:{type:"string",description:"Thread timestamp"}},required:["channel","thread_ts"]}},{name:"slack_get_users",description:"List workspace users with basic profiles",input_schema:{type:"object",properties:{}}},{name:"slack_get_user_profile",description:"Get detailed profile for a specific user",input_schema:{type:"object",properties:{user_id:{type:"string",description:"Slack user ID"}},required:["user_id"]}},{name:"slack_lookup_user_by_email",description:"Find a Slack user by email. Returns { ok:true, user:{id,name,email} } on hit, { ok:false } when no user has that email. Prefer this over slack_get_users for email-based routing \u2014 single API call, exact match.",input_schema:{type:"object",properties:{email:{type:"string",description:"Email address to look up"}},required:["email"]}},{name:"slack_list_usergroups",description:"List workspace-defined user groups (e.g. @oncall, @platform). Each item has { id, handle, name, description, user_count }. Use the id with slack_get_usergroup_members to expand the membership.",input_schema:{type:"object",properties:{}}},{name:"slack_get_usergroup_members",description:"List user IDs that belong to a Slack usergroup. Pair with slack_post_message to DM each member, or use the group id directly in a channel message as <!subteam^ID> to @-mention.",input_schema:{type:"object",properties:{usergroup:{type:"string",description:"Usergroup id, e.g. S012ABC"}},required:["usergroup"]}},{name:"slack_search_users",description:'Fuzzy-search workspace users by display name or real name. Use when the user said something like "send to Sam" without an email. Returns up to `limit` ranked matches { id, name, email }. Slack has no native name-search API \u2014 this scans paginated users.list + does substring scoring (real_name > display_name > name). For large workspaces consider higher limit + ask the user to confirm if multiple hit.',input_schema:{type:"object",properties:{query:{type:"string",description:"Substring to match against names (case-insensitive)"},limit:{type:"number",description:"Max matches to return (default 5, max 25)"}},required:["query"]}}]};export{w as slackSkill};
7
+ - slack_list_usergroups, slack_get_usergroup_members (workspace-defined teams like @oncall, @platform)`,resolve(){let a=b();if(!a)return null;let t={};for(let e of["PROJECT_API_TOKEN","ZIBBY_USER_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","PROGRESS_API_URL","EXECUTION_ID","PROJECT_ID","STAGE"])process.env[e]&&(t[e]=process.env[e]);for(let e of this.envKeys)process.env[e]&&(t[e]=process.env[e]);return{type:"stdio",command:"node",args:[a],env:t,alwaysLoad:!0}},async handleToolCall(a,t){try{switch(a){case"slack_list_channels":{let e=await s("conversations.list",{types:"public_channel",limit:100});return JSON.stringify({channels:(e.channels||[]).map(i=>({id:i.id,name:i.name,topic:i.topic?.value}))})}case"slack_post_message":{if(!t.channel||!t.text)return JSON.stringify({error:"channel and text are required"});let e=await s("chat.postMessage",{channel:t.channel,text:t.text,...t.blocks?{blocks:t.blocks}:{}});return JSON.stringify({ok:!0,ts:e.ts,channel:e.channel})}case"slack_reply_to_thread":{if(!t.channel||!t.thread_ts||!t.text)return JSON.stringify({error:"channel, thread_ts, and text are required"});let e=await s("chat.postMessage",{channel:t.channel,thread_ts:t.thread_ts,text:t.text});return JSON.stringify({ok:!0,ts:e.ts})}case"slack_add_reaction":return!t.channel||!t.timestamp||!t.reaction?JSON.stringify({error:"channel, timestamp, and reaction are required"}):(await s("reactions.add",{channel:t.channel,timestamp:t.timestamp,name:t.reaction}),JSON.stringify({ok:!0}));case"slack_get_channel_history":{if(!t.channel)return JSON.stringify({error:"channel is required"});let e=await s("conversations.history",{channel:t.channel,limit:t.limit||20});return JSON.stringify({messages:(e.messages||[]).map(i=>({user:i.user,text:i.text,ts:i.ts}))})}case"slack_get_thread_replies":{if(!t.channel||!t.thread_ts)return JSON.stringify({error:"channel and thread_ts are required"});let e=await s("conversations.replies",{channel:t.channel,ts:t.thread_ts});return JSON.stringify({messages:(e.messages||[]).map(i=>({user:i.user,text:i.text,ts:i.ts}))})}case"slack_get_users":{let e=await s("users.list",{limit:100});return JSON.stringify({users:(e.members||[]).filter(i=>!i.is_bot&&!i.deleted).map(i=>({id:i.id,name:i.real_name||i.name}))})}case"slack_get_user_profile":{if(!t.user_id)return JSON.stringify({error:"user_id is required"});let e=await s("users.profile.get",{user:t.user_id});return JSON.stringify({profile:e.profile})}case"slack_lookup_user_by_email":{if(!t.email)return JSON.stringify({error:"email is required"});try{let e=await s("users.lookupByEmail",{email:t.email});return JSON.stringify({ok:!0,user:{id:e.user?.id,name:e.user?.real_name||e.user?.name,email:e.user?.profile?.email||t.email}})}catch(e){if(/users_not_found/.test(e.message))return JSON.stringify({ok:!1,reason:"users_not_found"});throw e}}case"slack_list_usergroups":{let e=await s("usergroups.list",{});return JSON.stringify({usergroups:(e.usergroups||[]).map(i=>({id:i.id,handle:i.handle,name:i.name,description:i.description||"",user_count:Number(i.user_count||0)}))})}case"slack_get_usergroup_members":{if(!t.usergroup)return JSON.stringify({error:"usergroup id is required"});let e=await s("usergroups.users.list",{usergroup:t.usergroup});return JSON.stringify({users:e.users||[]})}case"slack_search_users":{if(!t.query||typeof t.query!="string")return JSON.stringify({error:"query is required"});let e=t.query.trim().toLowerCase();if(!e)return JSON.stringify({ok:!0,matches:[]});let i=Math.max(1,Math.min(Number(t.limit)||5,25)),c=[],o,d=5;for(let r=0;r<d;r+=1){let n={limit:200};o&&(n.cursor=o);let l=await s("users.list",n);for(let p of l.members||[])p.deleted||p.is_bot||c.push(p);if(o=l.response_metadata?.next_cursor,!o)break}let m=[];for(let r of c){let n=(r.real_name||"").toLowerCase(),l=(r.profile?.display_name||"").toLowerCase(),p=(r.name||"").toLowerCase(),u=0;n.includes(e)&&(u+=100-Math.abs(n.length-e.length)),l.includes(e)&&(u+=60-Math.abs(l.length-e.length)),p.includes(e)&&(u+=30-Math.abs(p.length-e.length)),(n===e||l===e)&&(u+=200),u>0&&m.push({id:r.id,name:r.real_name||r.profile?.display_name||r.name,email:r.profile?.email||void 0,_score:u})}return m.sort((r,n)=>n._score-r._score),JSON.stringify({ok:!0,matches:m.slice(0,i).map(({_score:r,...n})=>n),scanned:c.length})}default:return JSON.stringify({error:`Unknown tool: ${a}`})}}catch(e){return JSON.stringify({error:e.message})}},tools:[{name:"slack_list_channels",description:"List public channels in the workspace",input_schema:{type:"object",properties:{}}},{name:"slack_post_message",description:"Post a message to a Slack channel or DM. Pass `blocks` (Block Kit) for a rich card; `text` is the required notification fallback.",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID or name"},text:{type:"string",description:"Notification/fallback text (required)"},blocks:{type:"array",description:"Block Kit blocks for rich formatting (optional). Each block is a Slack Block Kit object (header/section/divider/context). section blocks may carry a button accessory with a url."}},required:["channel","text"]}},{name:"slack_reply_to_thread",description:"Reply to a specific message thread",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},thread_ts:{type:"string",description:"Thread timestamp"},text:{type:"string",description:"Reply text"}},required:["channel","thread_ts","text"]}},{name:"slack_add_reaction",description:"Add an emoji reaction to a message",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},timestamp:{type:"string",description:"Message timestamp"},reaction:{type:"string",description:"Emoji name without colons"}},required:["channel","timestamp","reaction"]}},{name:"slack_get_channel_history",description:"Get recent messages from a channel",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},limit:{type:"number",description:"Number of messages"}},required:["channel"]}},{name:"slack_get_thread_replies",description:"Get all replies in a message thread",input_schema:{type:"object",properties:{channel:{type:"string",description:"Channel ID"},thread_ts:{type:"string",description:"Thread timestamp"}},required:["channel","thread_ts"]}},{name:"slack_get_users",description:"List workspace users with basic profiles",input_schema:{type:"object",properties:{}}},{name:"slack_get_user_profile",description:"Get detailed profile for a specific user",input_schema:{type:"object",properties:{user_id:{type:"string",description:"Slack user ID"}},required:["user_id"]}},{name:"slack_lookup_user_by_email",description:"Find a Slack user by email. Returns { ok:true, user:{id,name,email} } on hit, { ok:false } when no user has that email. Prefer this over slack_get_users for email-based routing \u2014 single API call, exact match.",input_schema:{type:"object",properties:{email:{type:"string",description:"Email address to look up"}},required:["email"]}},{name:"slack_list_usergroups",description:"List workspace-defined user groups (e.g. @oncall, @platform). Each item has { id, handle, name, description, user_count }. Use the id with slack_get_usergroup_members to expand the membership.",input_schema:{type:"object",properties:{}}},{name:"slack_get_usergroup_members",description:"List user IDs that belong to a Slack usergroup. Pair with slack_post_message to DM each member, or use the group id directly in a channel message as <!subteam^ID> to @-mention.",input_schema:{type:"object",properties:{usergroup:{type:"string",description:"Usergroup id, e.g. S012ABC"}},required:["usergroup"]}},{name:"slack_search_users",description:'Fuzzy-search workspace users by display name or real name. Use when the user said something like "send to Sam" without an email. Returns up to `limit` ranked matches { id, name, email }. Slack has no native name-search API \u2014 this scans paginated users.list + does substring scoring (real_name > display_name > name). For large workspaces consider higher limit + ask the user to confirm if multiple hit.',input_schema:{type:"object",properties:{query:{type:"string",description:"Substring to match against names (case-insensitive)"},limit:{type:"number",description:"Max matches to return (default 5, max 25)"}},required:["query"]}}]};export{w as slackSkill};