@zibby/skills 2.0.8 → 2.0.9
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/artifact.js +1 -1
- package/dist/chartRender.js +1 -1
- package/dist/chat-notify.js +3 -3
- package/dist/chatProgress.js +3 -3
- package/dist/code-scan.js +1 -1
- package/dist/codeStats.js +2 -2
- package/dist/codebaseMemory.js +1 -1
- package/dist/discord.js +1 -1
- package/dist/figma.js +1 -1
- package/dist/gbrain.js +2 -2
- package/dist/git-write.js +9 -9
- package/dist/github.js +5 -5
- package/dist/gitlab.js +1 -1
- package/dist/googleDocs.js +1 -1
- package/dist/hubspot.js +1 -1
- package/dist/index.js +130 -130
- package/dist/jira.js +7 -7
- package/dist/kvMemory.js +1 -1
- package/dist/lark.js +1 -1
- package/dist/larkAttendance.js +1 -1
- package/dist/larkDocs.js +1 -1
- package/dist/linear.js +1 -1
- package/dist/linkedin.js +2 -2
- package/dist/notion.js +3 -3
- package/dist/opendesign.js +2 -2
- package/dist/package.json +4 -4
- package/dist/reportCheck.js +1 -1
- package/dist/sentry.js +2 -2
- package/dist/slack.js +1 -1
- package/dist/socialCard.js +1 -1
- package/dist/trackers/github-adapter.js +5 -5
- package/dist/trackers/index.js +33 -33
- package/dist/trackers/jira-adapter.js +7 -7
- package/dist/trackers/linear-adapter.js +3 -3
- package/dist/vikunja.js +1 -1
- package/package.json +4 -4
package/dist/linkedin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as N,readFileSync as P}from"fs";import{fileURLToPath as R}from"url";import{dirname as v,resolve as x}from"path";import{resolveIntegrationToken as I,clearTokenCache as U}from"@zibby/core/backend-client.js";var h={api:{knob:"SKILL_API_TIMEOUT_MS",fallback:3e4},transfer:{knob:"SKILL_TRANSFER_TIMEOUT_MS",fallback:12e4},job:{knob:"SKILL_JOB_TIMEOUT_MS",fallback:3e5}};function S(t,e,n=process.env){let o=Number(n?.[t]);return Number.isFinite(o)&&o>0?Math.min(6e5,Math.max(1e3,Math.floor(o))):e}function
|
|
1
|
+
import{existsSync as N,readFileSync as P}from"fs";import{fileURLToPath as R}from"url";import{dirname as v,resolve as x}from"path";import{resolveIntegrationToken as I,clearTokenCache as U}from"@zibby/core/backend-client.js";var h={api:{knob:"SKILL_API_TIMEOUT_MS",fallback:3e4},transfer:{knob:"SKILL_TRANSFER_TIMEOUT_MS",fallback:12e4},job:{knob:"SKILL_JOB_TIMEOUT_MS",fallback:3e5}};function S(t,e,n=process.env){let o=Number(n?.[t]);return Number.isFinite(o)&&o>0?Math.min(6e5,Math.max(1e3,Math.floor(o))):e}function E(t="api",e=process.env){let n=h[t]||h.api;return S(n.knob,n.fallback,e)}function w(t){return t?.name==="TimeoutError"||t?.name==="AbortError"}function A(t){try{return new URL(String(t?.url??t)).host||"unknown host"}catch{return"unknown host"}}function O(t,e){if(!t)return e;let n=new AbortController,o=r=>{n.signal.aborted||n.abort(r)},i=()=>o(t.reason),a=()=>o(e.reason);return n.signal.addEventListener("abort",()=>{t.removeEventListener("abort",i),e.removeEventListener("abort",a)},{once:!0}),t.aborted?o(t.reason):e.aborted?o(e.reason):(t.addEventListener("abort",i,{once:!0}),e.addEventListener("abort",a,{once:!0})),n.signal}async function y(t,e={},n={}){let o=n.kind||"api",i=(h[o]||h.api).knob,a=n.timeoutMs?Math.min(6e5,Math.max(1e3,Math.floor(n.timeoutMs))):E(o),r=e?.signal;if(r?.aborted)throw r.reason??new DOMException("This operation was aborted","AbortError");let s=AbortSignal.timeout(a),c=O(r,s);try{return await fetch(t,{...e,signal:c})}catch(d){throw s.aborted&&w(d)?new Error(`${n.what||"request"} TIMED OUT after ${a}ms against ${A(t)} (${i})`):d}}function D(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let t=v(R(import.meta.url)),e=x(t,"..","bin","mcp-skill.mjs");return N(e)?e:null}function M(){let t=String(process.env.ZIBBY_INJECTED_LINKEDIN_TOKEN||"").trim();if(!t)return null;let e=String(process.env.ZIBBY_INJECTED_LINKEDIN_MEMBER_ID||"").trim();return{token:t,memberId:e}}function B(){return String(process.env.ZIBBY_CHAT_STRICT_PERSONAL||"").trim()==="1"}function C(){return String(process.env.ZIBBY_SENDER_IS_NON_OWNER||"").trim()==="1"}var z="You haven't connected your own LinkedIn account \u2014 connect it at https://studio.zibby.dev/integrations (LinkedIn). For privacy, I can't post or act as anyone else's LinkedIn (including the project owner's) on your behalf.";function b(){let t=M();if(t)return t;if(B()||C())throw new Error(z);return null}var K="202506",F="https://api.linkedin.com";function T(t){if(t==null)return null;let e=String(t).trim();if(!e)return null;let n=e.match(/urn:li:organization:(\d+)/i);return n?n[1]:/^\d+$/.test(e)?e:null}function k(t){if(!t)return"";if(t.localizedName)return String(t.localizedName);let e=t.name&&t.name.localized;if(e&&typeof e=="object"){let n=Object.values(e)[0];if(n)return String(n)}return""}function m(t,e){return t?typeof t.get=="function"?t.get(e):t[e]||t[e.toLowerCase()]||null:null}async function p(t,e={},n="linkedin_business"){let o=async()=>{let i;if(n==="linkedin_personal"){let d=b();d&&(i=d.token)}if(i||({token:i}=await I(n)),typeof i!="string"||!i)throw new Error("LinkedIn is not connected: no access token available. Connect LinkedIn in Integrations.");let a=t.startsWith("https://")?t:`${F}${t}`,r=await y(a,{method:e.method||"GET",headers:{Authorization:`Bearer ${i}`,"LinkedIn-Version":K,"X-Restli-Protocol-Version":"2.0.0",Accept:"application/json",...e.body?{"Content-Type":"application/json"}:{},...e.headers},body:e.body?JSON.stringify(e.body):void 0},{kind:"api",what:`LinkedIn ${e.method||"GET"} ${t}`});if(!r.ok){let d=await r.text().catch(()=>"");throw new Error(`LinkedIn API ${r.status}: ${d.slice(0,300)}`)}let s=await r.text().catch(()=>""),c={};if(s&&s.trim())try{c=JSON.parse(s)}catch{c={raw:s}}return{status:r.status,headers:r.headers,body:c}};try{return await o()}catch(i){let a=String(i?.message||i||"").toLowerCase();if(!(a.includes("token")||a.includes("401")||a.includes("unauthorized")))throw i;return U(n),o()}}async function $(t){let e;if(t==="linkedin_personal"){let n=b();n&&(e=n.token)}if(e||({token:e}=await I(t)),typeof e!="string"||!e)throw new Error("LinkedIn is not connected: no access token available. Connect LinkedIn in Integrations.");return e}function W(t){switch(String(t||"").toLowerCase().match(/\.([a-z0-9]+)$/)?.[1]){case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"webp":return"image/webp";default:return"image/png"}}async function L(t,e,n,o){if(typeof n!="string"||!n.trim())throw new Error("imagePath (a local image file path) is required to upload an image");let{body:i}=await p("/rest/images?action=initializeUpload",{method:"POST",body:{initializeUploadRequest:{owner:e}}},t),a=i?.value?.uploadUrl,r=i?.value?.image;if(!a||!r)throw new Error(`LinkedIn image initializeUpload returned no uploadUrl/image (got: ${JSON.stringify(i).slice(0,200)})`);let s=P(n),c=await $(t),d=await y(a,{method:"PUT",headers:{Authorization:`Bearer ${c}`,"Content-Type":o||W(n)},body:s},{kind:"transfer",what:"LinkedIn image upload"});if(!d.ok){let u=await d.text().catch(()=>"");throw new Error(`LinkedIn image upload ${d.status}: ${u.slice(0,300)}`)}return r}var V={id:"linkedin",callsBackend:!0,serverName:"linkedin",allowedTools:["mcp__linkedin__*"],envKeys:[],description:"LinkedIn \u2014 (business) list admin Organizations + create DRAFT posts on a company Page, and (personal) PUBLISH a post to your own member profile feed",promptFragment:`## LinkedIn
|
|
2
2
|
You can post to LinkedIn two ways \u2014 an ORG company Page (business) and your own member PROFILE (personal). Each path needs its own LinkedIn integration connected.
|
|
3
3
|
|
|
4
4
|
Business (company Page) \u2014 DRAFT only:
|
|
@@ -14,4 +14,4 @@ Attaching an image (optional, both tools):
|
|
|
14
14
|
Notes:
|
|
15
15
|
- Org-page posts are ALWAYS created as a DRAFT; personal-profile posts are ALWAYS published live \u2014 choose the tool accordingly.
|
|
16
16
|
- PUBLISHING IS OUTWARD-FACING AND IRREVERSIBLE. linkedin_publish_post posts live to a real audience the instant you call it \u2014 there is no undo and no draft state for member profiles. Only call it after the human has EXPLICITLY approved publishing THIS specific text in THIS conversation. If you wrote or edited the text, show it and get an explicit "yes, publish" first; if you are unsure, HOLD/draft rather than publish. The org draft tool (linkedin_create_draft_post) is the safe default when a human still needs to review.
|
|
17
|
-
- If the relevant LinkedIn integration is not connected these tools return { ok:false, error }; treat that as "LinkedIn unavailable" and continue.`,resolve(){let t=D();if(!t)return{command:null,args:[],env:{},description:this.description};let e={};for(let n of["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_INJECTED_LINKEDIN_TOKEN","ZIBBY_INJECTED_LINKEDIN_MEMBER_ID","ZIBBY_SENDER_IS_NON_OWNER","ZIBBY_CHAT_STRICT_PERSONAL"])process.env[n]&&(e[n]=process.env[n]);return{type:"stdio",command:"node",args:[t,"../dist/linkedin.js","linkedinSkill"],env:e,description:this.description
|
|
17
|
+
- If the relevant LinkedIn integration is not connected these tools return { ok:false, error }; treat that as "LinkedIn unavailable" and continue.`,resolve(){let t=D();if(!t)return{command:null,args:[],env:{},description:this.description};let e={};for(let n of["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_INJECTED_LINKEDIN_TOKEN","ZIBBY_INJECTED_LINKEDIN_MEMBER_ID","ZIBBY_SENDER_IS_NON_OWNER","ZIBBY_CHAT_STRICT_PERSONAL"])process.env[n]&&(e[n]=process.env[n]);return{type:"stdio",command:"node",args:[t,"../dist/linkedin.js","linkedinSkill"],env:e,description:this.description}},async handleToolCall(t,e){try{switch(t){case"linkedin_list_organizations":{let{body:n}=await p("/rest/organizationAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED",{},"linkedin_business"),o=Array.isArray(n.elements)?n.elements:[],i=[];for(let a of o){let r=a.organizationalTarget||a["organizationalTarget~"]||a.organization,s=T(r);if(!s)continue;let c="",d="";try{let u=(await p(`/rest/organizations/${s}`,{},"linkedin_business")).body;c=k(u),d=u.vanityName||""}catch{}i.push({id:s,urn:`urn:li:organization:${s}`,name:c,vanityName:d})}return JSON.stringify({ok:!0,count:i.length,organizations:i})}case"linkedin_create_draft_post":{let n=e?.organizationUrn||e?.organizationId||e?.organization||e?.orgId,o=T(n);if(!o)return JSON.stringify({ok:!1,error:"A valid organizationId or organizationUrn (urn:li:organization:{id}) is required"});let i=e?.text;if(typeof i!="string"||!i.trim())return JSON.stringify({ok:!1,error:"text (the post commentary) is required"});let a=e?.visibility?String(e.visibility).toUpperCase():"PUBLIC",r=`urn:li:organization:${o}`,s=typeof e?.imagePath=="string"?e.imagePath.trim():"",c=typeof e?.imageAltText=="string"?e.imageAltText:"";if(e?.dry_run===!0)try{let l="";try{let f=(await p(`/rest/organizations/${o}`,{},"linkedin_business")).body;l=k(f)}catch{}return JSON.stringify({dryRun:!0,target:"organization",wouldPostAs:{name:l,id:o,urn:r},visibility:a,textPreview:i,...s?{imageWouldAttach:!0,imagePath:s}:{},note:"DRY RUN \u2014 nothing was posted"})}catch(l){return JSON.stringify({dryRun:!0,ok:!1,error:l.message})}let d={author:r,commentary:i,visibility:a,distribution:{feedDistribution:"MAIN_FEED",targetEntities:[],thirdPartyDistributionChannels:[]},lifecycleState:"DRAFT",isReshareDisabledByAuthor:!1};if(s){let l=await L("linkedin_business",r,s);d.content={media:{id:l,altText:c||""}}}let u=await p("/rest/posts",{method:"POST",body:d},"linkedin_business"),g=m(u.headers,"x-restli-id")||m(u.headers,"x-linkedin-id")||u.body?.id||null;return JSON.stringify({ok:!0,postUrn:g,author:r,lifecycleState:"DRAFT",visibility:a,status:u.status})}case"linkedin_publish_post":{let n=b(),o=n?n.memberId:(await I("linkedin_personal")).memberId;if(!o)return JSON.stringify({ok:!1,error:"LinkedIn (personal) not connected or member id unavailable \u2014 reconnect LinkedIn Personal"});let i=e?.text;if(typeof i!="string"||!i.trim())return JSON.stringify({ok:!1,error:"text (the post body) is required"});let a=e?.visibility?String(e.visibility).toUpperCase():"PUBLIC",r=`urn:li:person:${o}`,s=typeof e?.imagePath=="string"?e.imagePath.trim():"",c=typeof e?.imageAltText=="string"?e.imageAltText:"";if(e?.dry_run===!0)try{let l=(await p("/v2/userinfo",{},"linkedin_personal")).body,f=l?.name||[l?.given_name,l?.family_name].filter(Boolean).join(" ")||"",_=l?.sub?String(l.sub):o;return JSON.stringify({dryRun:!0,target:"member",wouldPostAs:{name:f,id:_,urn:`urn:li:person:${_}`},visibility:a,textPreview:i,...s?{imageWouldAttach:!0,imagePath:s}:{},note:"DRY RUN \u2014 nothing was posted"})}catch(l){return JSON.stringify({dryRun:!0,ok:!1,error:l.message})}let d={author:r,commentary:i,visibility:a,distribution:{feedDistribution:"MAIN_FEED",targetEntities:[],thirdPartyDistributionChannels:[]},lifecycleState:"PUBLISHED",isReshareDisabledByAuthor:!1};if(s){let l=await L("linkedin_personal",r,s);d.content={media:{id:l,altText:c||""}}}let u=await p("/rest/posts",{method:"POST",body:d},"linkedin_personal"),g=m(u.headers,"x-restli-id")||m(u.headers,"x-linkedin-id")||u.body?.id||null;return JSON.stringify({ok:!0,postUrn:g,author:r,lifecycleState:"PUBLISHED",visibility:a,status:u.status})}default:return JSON.stringify({ok:!1,error:`Unknown tool: ${t}`})}}catch(n){return JSON.stringify({ok:!1,error:n.message})}},tools:[{name:"linkedin_list_organizations",description:"List the LinkedIn Organizations (company Pages) the authenticated member ADMINISTERS. Returns [{ id, urn, name, vanityName }]. Call this first to choose the author org for a draft post.",input_schema:{type:"object",properties:{}}},{name:"linkedin_create_draft_post",description:"Create a DRAFT post on a LinkedIn Organization (company Page). The post is created in DRAFT state (never published automatically) so a human can review and publish it in LinkedIn. Returns the created post URN. Optionally ATTACH an image: pass imagePath (a local PNG file path, e.g. one returned by social_card_render) and it is uploaded to LinkedIn and attached to the post. Set dry_run:true to VALIDATE which LinkedIn account/profile the post would go to (and preview the text) WITHOUT posting \u2014 nothing is published or uploaded (a set imagePath is reported as imageWouldAttach:true).",input_schema:{type:"object",properties:{organizationId:{type:"string",description:'The numeric organization id (e.g. "12345"). Alternative to organizationUrn.'},organizationUrn:{type:"string",description:'The organization URN, e.g. "urn:li:organization:12345". Alternative to organizationId.'},text:{type:"string",description:"The post commentary (the body text of the post)."},visibility:{type:"string",enum:["PUBLIC"],description:"Post visibility. Defaults to PUBLIC."},imagePath:{type:"string",description:"Optional. A LOCAL image file path (e.g. a PNG returned by social_card_render). When set, the image is uploaded to LinkedIn and attached to the post as its media. Not uploaded on a dry_run."},imageAltText:{type:"string",description:"Optional alt text for the attached image (accessibility). Only used when imagePath is set."},dry_run:{type:"boolean",description:"Set dry_run:true to VALIDATE which LinkedIn account/profile the post would go to (and preview the text) WITHOUT posting \u2014 nothing is published or uploaded. Returns { dryRun, target, wouldPostAs, visibility, textPreview, imageWouldAttach? }. Defaults to false."}},required:["text"]}},{name:"linkedin_publish_post",description:"PUBLISH a post to the authenticated member's OWN LinkedIn profile feed (personal). UNLIKE linkedin_create_draft_post (which only drafts on a company Page), this PUBLISHES the post IMMEDIATELY \u2014 LinkedIn has no DRAFT state for member profiles, so there is no human review step. Returns the created post URN. Requires the LinkedIn Personal integration connected. Optionally ATTACH an image: pass imagePath (a local PNG file path, e.g. one returned by social_card_render) and it is uploaded to LinkedIn and attached to the post. Set dry_run:true to VALIDATE which LinkedIn account/profile the post would go to (and preview the text) WITHOUT posting \u2014 nothing is published or uploaded (a set imagePath is reported as imageWouldAttach:true).",input_schema:{type:"object",properties:{text:{type:"string",description:"The post body (the commentary text of the post)."},visibility:{type:"string",enum:["PUBLIC","CONNECTIONS"],description:"Post visibility: PUBLIC (anyone) or CONNECTIONS (your connections only). Defaults to PUBLIC."},imagePath:{type:"string",description:"Optional. A LOCAL image file path (e.g. a PNG returned by social_card_render). When set, the image is uploaded to LinkedIn and attached to the post as its media. Not uploaded on a dry_run."},imageAltText:{type:"string",description:"Optional alt text for the attached image (accessibility). Only used when imagePath is set."},dry_run:{type:"boolean",description:"Set dry_run:true to VALIDATE which LinkedIn account/profile the post would go to (and preview the text) WITHOUT posting \u2014 nothing is published or uploaded. Returns { dryRun, target, wouldPostAs, visibility, textPreview, imageWouldAttach? }. Defaults to false."}},required:["text"]}}]};export{z as PERSONAL_REFUSAL,B as chatStrictPersonal,M as injectedPersonalToken,p as linkedinApi,V as linkedinSkill,T as parseOrgId,b as personalTierCredentialGate,C as senderIsNonOwner,L as uploadImage};
|
package/dist/notion.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as L,statSync as M,readFileSync as j}from"fs";import{fileURLToPath as D}from"url";import{basename as q,dirname as C,resolve as B}from"path";import{resolveIntegrationToken as J,clearTokenCache as K}from"@zibby/core/backend-client.js";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"}),te=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 Chat",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark App",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 h={api:{knob:"SKILL_API_TIMEOUT_MS",fallback:3e4},transfer:{knob:"SKILL_TRANSFER_TIMEOUT_MS",fallback:12e4},job:{knob:"SKILL_JOB_TIMEOUT_MS",fallback:3e5}};function P(n,e,t=process.env){let o=Number(t?.[n]);return Number.isFinite(o)&&o>0?Math.min(6e5,Math.max(1e3,Math.floor(o))):e}function E(n="api",e=process.env){let t=h[n]||h.api;return P(t.knob,t.fallback,e)}function U(n){return n?.name==="TimeoutError"||n?.name==="AbortError"}function $(n){try{return new URL(String(n?.url??n)).host||"unknown host"}catch{return"unknown host"}}function v(n,e){if(!n)return e;let t=new AbortController,o=s=>{t.signal.aborted||t.abort(s)},i=()=>o(n.reason),r=()=>o(e.reason);return t.signal.addEventListener("abort",()=>{n.removeEventListener("abort",i),e.removeEventListener("abort",r)},{once:!0}),n.aborted?o(n.reason):e.aborted?o(e.reason):(n.addEventListener("abort",i,{once:!0}),e.addEventListener("abort",r,{once:!0})),t.signal}async function N(n,e={},t={}){let o=t.kind||"api",i=(h[o]||h.api).knob,r=t.timeoutMs?Math.min(6e5,Math.max(1e3,Math.floor(t.timeoutMs))):E(o),s=e?.signal;if(s?.aborted)throw s.reason??new DOMException("This operation was aborted","AbortError");let a=AbortSignal.timeout(r),d=v(s,a);try{return await fetch(n,{...e,signal:d})}catch(c){throw a.aborted&&U(c)?new Error(`${t.what||"request"} TIMED OUT after ${r}ms against ${$(n)} (${i})`):c}}function F(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let n=C(D(import.meta.url)),e=B(n,"..","bin","mcp-skill.mjs");return L(e)?e:null}var G="2022-06-28",H="https://api.notion.com/v1",b=2e4,w=25,z=25,_=100,S=500,Y=20*1024*1024;function u(n){if(!n||typeof n!="string")return null;let t=n.trim().split(/[?#]/)[0],o=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(o)return o[0].toLowerCase();let i=t.match(/[0-9a-fA-F]{32}/g);if(i&&i.length){let r=i[i.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(n,e={}){let t=async()=>{let{token:o}=await J("notion");if(typeof o!="string"||!o)throw new Error(`Invalid notion token type: ${typeof o}`);let i=await N(`${H}${n}`,{method:e.method||"GET",headers:{Authorization:`Bearer ${o}`,"Notion-Version":G,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},{kind:e.formData?"transfer":"api",what:`Notion ${e.method||"GET"} ${n}`});if(!i.ok){let s=await i.text().catch(()=>"");throw new Error(`Notion API ${i.status}: ${s.slice(0,300)}`)}let r=await i.text().catch(()=>"");if(!r||!r.trim())return{};try{return JSON.parse(r)}catch{return{raw:r}}};try{return await t()}catch(o){let i=String(o?.message||o||"").toLowerCase();if(!(i.includes("token")||i.includes("401")||i.includes("unauthorized")))throw o;return K("notion"),t()}}function g(n){if(!Array.isArray(n))return"";let e="";for(let t of n){let o=t?.plain_text??t?.text?.content??"";if(!o)continue;let i=t.annotations||{};i.code&&(o=`\`${o}\``),i.bold&&(o=`**${o}**`),i.italic&&(o=`_${o}_`),i.strikethrough&&(o=`~~${o}~~`);let r=t?.href||t?.text?.link?.url;r&&(o=`[${o}](${r})`),e+=o}return e}function W(n,e,t){let o=n?.type,i=n?.[o]||{},r=" ".repeat(Math.max(0,e)),s=(c="rich_text")=>g(i[c]),a;switch(o){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}- [${i.checked?"x":" "}] ${s()}`;break;case"toggle":a=`${r}- ${s()}`;break;case"quote":a=`> ${s()}`;break;case"callout":{a=`> ${i.icon?.emoji?`${i.icon.emoji} `:""}${s()}`;break}case"code":{a=`\`\`\`${i.language||""}
|
|
2
2
|
${s()}
|
|
3
3
|
\`\`\``;break}case"divider":a="---";break;case"child_page":a=`[child page: ${i.title||""}]`;break;case"child_database":a=`[child database: ${i.title||""}]`;break;case"bookmark":case"embed":case"link_preview":a=i.url?`<${i.url}>`:"";break;case"equation":a=i.expression?`$${i.expression}$`:"";break;case"table":case"column_list":case"column":a="";break;case"table_row":{let c=(i.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
4
|
`)}async function A(n,e,t){let o=[],i,r=0;do{if(t.used>=b)break;let s=new URLSearchParams({page_size:"100"});i&&s.set("start_cursor",i);let a=await p(`/blocks/${n}/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=W(c,e,l);if(m&&(o.push(m),t.used+=m.length+1),t.used>=b)break}i=a.has_more?a.next_cursor:void 0,r+=1}while(i&&r<z);return o.join(`
|
|
5
5
|
`)}function O(n){let e=n?.properties||{};for(let t of Object.values(e))if(t?.type==="title"){let o=g(t.title).trim();if(o)return o}return""}function f(n){let e=String(n??"");if(!e)return[{type:"text",text:{content:""}}];let t=[];for(let o=0;o<e.length;o+=2e3)t.push({type:"text",text:{content:e.slice(o,o+2e3)}});return t}function X(n){return{id:n?.id||"",discussionId:n?.discussion_id||"",text:g(n?.rich_text).trim(),author:n?.created_by?.id||"",createdTime:n?.created_time||""}}function V(n){if(!n||!n.type)return"";switch(n.type){case"title":return g(n.title).trim();case"rich_text":return g(n.rich_text).trim();case"number":return n.number==null?"":String(n.number);case"select":return n.select?.name||"";case"status":return n.status?.name||"";case"multi_select":return(n.multi_select||[]).map(t=>t.name).join(", ");case"checkbox":return n.checkbox?"true":"false";case"url":return n.url||"";case"email":return n.email||"";case"phone_number":return n.phone_number||"";case"date":return n.date?.start||"";case"people":return(n.people||[]).map(t=>t.name||t.id).join(", ");default:return""}}function k(n){return`https://www.notion.so/${String(n||"").replace(/-/g,"")}`}function Z(n){let e=String(n??"").replace(/\r\n/g,`
|
|
6
6
|
`),t=[];for(let o of e.split(`
|
|
7
|
-
`)){let i=o.replace(/\s+$/,"");if(!i.trim())continue;let r=/^(#{1,3})\s+(.*)$/.exec(i),s=/^\s*[-*]\s+(.*)$/.exec(i),a=/^\s*\d+[.)]\s+(.*)$/.exec(i),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=i),t.push({object:"block",type:d,[d]:{rich_text:f(c)}})}return t}function x(n){return Array.isArray(n?.blocks)&&n.blocks.length?n.blocks.slice(0,S):typeof n?.markdown=="string"&&n.markdown.trim()?Z(n.markdown).slice(0,S):null}async function
|
|
7
|
+
`)){let i=o.replace(/\s+$/,"");if(!i.trim())continue;let r=/^(#{1,3})\s+(.*)$/.exec(i),s=/^\s*[-*]\s+(.*)$/.exec(i),a=/^\s*\d+[.)]\s+(.*)$/.exec(i),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=i),t.push({object:"block",type:d,[d]:{rich_text:f(c)}})}return t}function x(n){return Array.isArray(n?.blocks)&&n.blocks.length?n.blocks.slice(0,S):typeof n?.markdown=="string"&&n.markdown.trim()?Z(n.markdown).slice(0,S):null}async function T(n,e){for(let t=0;t<e.length;t+=_)await p(`/blocks/${n}/children`,{method:"PATCH",body:{children:e.slice(t,t+_)}})}function Q(n){let e=typeof n=="string"?n.trim():"";if(!e)throw new Error("imagePath is required");if(!L(e)||!M(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=j(e);if(t.length>Y)throw new Error(`image is ${(t.length/(1024*1024)).toFixed(1)}MB \u2014 max 20MB (Notion single_part upload cap)`);return t}async function ee(n){let e=Q(n),t=q(n.trim()),o=/\.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:o}),t),await p(`/file_uploads/${r}/send`,{method:"POST",formData:s}),r}var le={id:"notion",callsBackend:!0,serverName:"notion",allowedTools:["mcp__notion__*"],requiresIntegration:I.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 n=F();if(!n)return null;let e={};for(let t of this.envKeys)process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[n,"../dist/notion.js","notionSkill"],env:e,description:this.description
|
|
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 n=F();if(!n)return null;let e={};for(let t of this.envKeys)process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[n,"../dist/notion.js","notionSkill"],env:e,description:this.description}},async handleToolCall(n,e){try{switch(n){case"notion_get_page":{let t=e?.pageId||e?.page||e?.url||e?.id,o=u(t);if(!o)return JSON.stringify({ok:!1,error:"A valid Notion page id or URL is required"});let i=await p(`/pages/${o}`),r=O(i),s=i?.url||`https://www.notion.so/${o.replace(/-/g,"")}`,d=await A(o,0,{used:0}),c=!1;return d.length>b&&(d=d.slice(0,b),c=!0),JSON.stringify({ok:!0,id:o,title:r,url:s,text:d,...c?{truncated:!0}:{}})}case"notion_query_database":{let t=e?.databaseId||e?.database||e?.url||e?.id,o=u(t);if(!o)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)||w,w))};e?.filter&&typeof e.filter=="object"&&(r.filter=e.filter);let s=await p(`/databases/${o}/query`,{method:"POST",body:r}),d=(Array.isArray(s.results)?s.results:[]).map(c=>{let l={};for(let[m,R]of Object.entries(c.properties||{})){let y=V(R);y&&(l[m]=y)}return{id:c.id,title:O(c),url:c.url||`https://www.notion.so/${String(c.id||"").replace(/-/g,"")}`,props:l}});return JSON.stringify({ok:!0,id:o,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 o=e?.databaseId?u(e.databaseId):null,i=e?.parentPageId?u(e.parentPageId):u(e?.parent||e?.pageId);if(!o&&!i)return JSON.stringify({ok:!1,error:"A valid parentPageId or databaseId is required"});let r=o?{database_id:o}:{page_id:i},s={title:{title:f(t)}},a=x(e)||[],d=a.slice(0,_),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(_);return m.length&&await T(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 o=x(e);return!o||!o.length?JSON.stringify({ok:!1,error:"markdown or blocks content is required"}):(await T(t,o),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 o=typeof e?.caption=="string"&&e.caption.trim()?f(e.caption.trim()):null,i,r;if(typeof e?.imagePath=="string"&&e.imagePath.trim())r=await ee(e.imagePath),i={type:"file_upload",file_upload:{id:r}};else if(typeof e?.imageUrl=="string"&&e.imageUrl.trim())i={type:"external",external:{url:e.imageUrl.trim()}};else return JSON.stringify({ok:!1,error:"imagePath (local png/jpg) or imageUrl is required"});return o&&(i.caption=o),await p(`/blocks/${t}/children`,{method:"PATCH",body:{children:[{object:"block",type:"image",image:i}]}}),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,o=u(t);if(!o)return JSON.stringify({ok:!1,error:"A valid Notion page/block id or URL is required"});let i=new URLSearchParams({block_id:o,page_size:"100"}),r=await p(`/comments?${i.toString()}`),a=(Array.isArray(r.results)?r.results:[]).map(X);return JSON.stringify({ok:!0,id:o,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 o=e?.discussionId||e?.discussion_id||null,i;if(o)i={discussion_id:String(o),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"});i={parent:{page_id:a},rich_text:f(t)}}let r=await p("/comments",{method:"POST",body:i});return JSON.stringify({ok:!0,id:r?.id||"",discussionId:r?.discussion_id||o||""})}default:return JSON.stringify({ok:!1,error:`Unknown tool: ${n}`})}}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{Z as markdownToNotionBlocks,p as notionApi,le as notionSkill,u as parseNotionId};
|
package/dist/opendesign.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as j}from"fs";import{fileURLToPath as S}from"url";import{dirname as T,resolve as k}from"path";import{resolveIntegrationToken as N}from"@zibby/core/backend-client.js";var h=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"}),
|
|
1
|
+
import{existsSync as j}from"fs";import{fileURLToPath as S}from"url";import{dirname as T,resolve as k}from"path";import{resolveIntegrationToken as N}from"@zibby/core/backend-client.js";var h=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"}),E=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 Chat",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark App",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 g={api:{knob:"SKILL_API_TIMEOUT_MS",fallback:3e4},transfer:{knob:"SKILL_TRANSFER_TIMEOUT_MS",fallback:12e4},job:{knob:"SKILL_JOB_TIMEOUT_MS",fallback:3e5}};function f(t,n,e=process.env){let i=Number(e?.[t]);return Number.isFinite(i)&&i>0?Math.min(6e5,Math.max(1e3,Math.floor(i))):n}function I(t="api",n=process.env){let e=g[t]||g.api;return f(e.knob,e.fallback,n)}function b(t){return t?.name==="TimeoutError"||t?.name==="AbortError"}function y(t){try{return new URL(String(t?.url??t)).host||"unknown host"}catch{return"unknown host"}}function O(t,n){if(!t)return n;let e=new AbortController,i=s=>{e.signal.aborted||e.abort(s)},r=()=>i(t.reason),o=()=>i(n.reason);return e.signal.addEventListener("abort",()=>{t.removeEventListener("abort",r),n.removeEventListener("abort",o)},{once:!0}),t.aborted?i(t.reason):n.aborted?i(n.reason):(t.addEventListener("abort",r,{once:!0}),n.addEventListener("abort",o,{once:!0})),e.signal}async function u(t,n={},e={}){let i=e.kind||"api",r=(g[i]||g.api).knob,o=e.timeoutMs?Math.min(6e5,Math.max(1e3,Math.floor(e.timeoutMs))):I(i),s=n?.signal;if(s?.aborted)throw s.reason??new DOMException("This operation was aborted","AbortError");let a=AbortSignal.timeout(o),d=O(s,a);try{return await fetch(t,{...n,signal:d})}catch(p){throw a.aborted&&b(p)?new Error(`${e.what||"request"} TIMED OUT after ${o}ms against ${y(t)} (${r})`):p}}function v(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let t=T(S(import.meta.url)),n=k(t,"..","bin","mcp-skill.mjs");return j(n)?n:null}async function _(){let t=await N(h.OPEN_DESIGN),n=t?.token,e=t?.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 i=e.replace(/\/+$/,"");return{token:n,baseUrl:i}}async function c(t,n={}){let{token:e,baseUrl:i}=await _(),r=`${i}/api${t}`;if(n.query&&typeof n.query=="object"){let a=new URLSearchParams;for(let[p,l]of Object.entries(n.query))l!=null&&l!==""&&a.set(p,String(l));let d=a.toString();d&&(r+=(r.includes("?")?"&":"?")+d)}let o={Authorization:`Bearer ${e}`,Accept:"application/json",...n.body?{"Content-Type":"application/json"}:{}},s=await u(r,{method:n.method||"GET",headers:o,body:n.body?JSON.stringify(n.body):void 0},{kind:"api",what:`OpenDesign ${n.method||"GET"} ${t}`});return m(s,"OpenDesign")}async function m(t,n){if(!t.ok){let i=await t.text().catch(()=>""),r=i.slice(0,300);try{let o=JSON.parse(i),s=o?.code||o?.error?.code,a=o?.message||o?.error?.message||o?.error;(s||a)&&(r=[s?`[${s}]`:null,a].filter(Boolean).join(" ")||r)}catch{}throw new Error(`${n} API ${t.status}: ${r}`)}let e=await t.text().catch(()=>"");if(!e)return{};try{return JSON.parse(e)}catch{return{raw:e}}}var U={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 t=v();if(!t)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:[t,"../dist/opendesign.js","opendesignSkill"],env:n,description:this.description
|
|
23
|
+
- After opendesign_cli_run, poll opendesign_cli_status with the returned runId until the run is no longer running.`,resolve(){let t=v();if(!t)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:[t,"../dist/opendesign.js","opendesignSkill"],env:n,description:this.description}},async handleToolCall(t,n){try{switch(t){case"opendesign_health":{let{baseUrl:e}=await _(),i=await u(`${e}/api/health`,{method:"GET",headers:{Accept:"application/json"}},{kind:"api",what:"OpenDesign GET /api/health"}),r=await m(i,"OpenDesign");return JSON.stringify({ok:!0,health:r})}case"opendesign_list_projects":{let e=await c("/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 i=await c(`/projects/${encodeURIComponent(e)}`);return JSON.stringify(i)}case"opendesign_list_designs":{let e=n?.projectId;if(!e)return JSON.stringify({error:"projectId is required"});let i=await c("/live-artifacts",{query:{projectId:e}});return JSON.stringify(i)}case"opendesign_get_design":{let e=n?.id,i=n?.projectId;if(!e)return JSON.stringify({error:"id is required"});if(!i)return JSON.stringify({error:"projectId is required"});let r=await c(`/live-artifacts/${encodeURIComponent(e)}`,{query:{projectId:i}});return JSON.stringify(r)}case"opendesign_export_pdf":{let e=n?.projectId||n?.id,{fileName:i,title:r,deck:o}=n||{};if(!e)return JSON.stringify({error:"projectId is required"});if(!i)return JSON.stringify({error:"fileName is required"});let s={fileName:i};r!==void 0&&(s.title=r),o!==void 0&&(s.deck=o);let a=await c(`/projects/${encodeURIComponent(e)}/export/pdf`,{method:"POST",body:s});return JSON.stringify(a)}case"opendesign_export_html":{let e=n?.projectId||n?.id,i=n?.path;if(!e)return JSON.stringify({error:"projectId is required"});if(!i)return JSON.stringify({error:"path is required (the export sub-path)"});let o=String(i).replace(/^\/+/,"").split("/").map(a=>encodeURIComponent(a)).join("/"),s=await c(`/projects/${encodeURIComponent(e)}/export/${o}`,{query:{inline:1}});return JSON.stringify(s)}case"opendesign_cli_run":{let{agentId:e,message:i,projectId:r,conversationId:o,model:s}=n||{};if(!e)return JSON.stringify({error:"agentId is required"});if(!i)return JSON.stringify({error:"message is required"});let a={agentId:e,message:i};r!==void 0&&(a.projectId=r),o!==void 0&&(a.conversationId=o),s!==void 0&&(a.model=s);let d=await c("/runs",{method:"POST",body:a});return JSON.stringify(d)}case"opendesign_cli_status":{let e=n?.id||n?.runId;if(!e)return JSON.stringify({error:"id (runId) is required"});let i=await c(`/runs/${encodeURIComponent(e)}`);return JSON.stringify(i)}default:return JSON.stringify({error:`Unknown tool: ${t}`})}}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{U as opendesignSkill};
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zibby/skills",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "Built-in skill definitions for the Zibby agent-workflow framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -117,10 +117,10 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
119
119
|
"@resvg/resvg-js": "^2.6.2",
|
|
120
|
-
"@zibby/agent-workflow": "2.0.
|
|
120
|
+
"@zibby/agent-workflow": "2.0.9",
|
|
121
121
|
"@zibby/bin-oxlint": "^1.73.0",
|
|
122
122
|
"@zibby/bin-semgrep": "^1.169.0",
|
|
123
|
-
"@zibby/skill-ids": "2.0.
|
|
123
|
+
"@zibby/skill-ids": "2.0.9",
|
|
124
124
|
"echarts": "^6.1.0",
|
|
125
125
|
"mem0ai": "npm:@zibby/mem0ai@^3.0.5",
|
|
126
126
|
"zod": "^3.23.0 || ^4.0.0"
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
"optionalDependencies": {
|
|
138
|
-
"@zibby/mcp-browser": "2.0.
|
|
138
|
+
"@zibby/mcp-browser": "2.0.9",
|
|
139
139
|
"@zibby/mcp-memory": "*"
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
package/dist/reportCheck.js
CHANGED
|
@@ -14,4 +14,4 @@ from the data by itself.
|
|
|
14
14
|
|
|
15
15
|
Then READ the \`checked\` block in the result: it says how many tables, rows and
|
|
16
16
|
bars were actually found. If it reports 0 bars for a page full of bars, the check
|
|
17
|
-
never saw your chart and a clean verdict means nothing.`,resolve(){let t=Oe();return t?{type:"stdio",command:"node",args:[t,"../dist/reportCheck.js","reportCheckSkill"],env:{},description:this.description
|
|
17
|
+
never saw your chart and a clean verdict means nothing.`,resolve(){let t=Oe();return t?{type:"stdio",command:"node",args:[t,"../dist/reportCheck.js","reportCheckSkill"],env:{},description:this.description}:{command:null,args:[],env:{},description:this.description}},async handleToolCall(t,s){if(t!=="report_check")return JSON.stringify({error:`Unknown tool: ${t}`});try{let e=typeof s?.html=="string"?s.html:"";if(!e.trim())return JSON.stringify({error:"html is required \u2014 pass the exact page source you are about to publish."});let n=s?.data;if(typeof n=="string")try{n=JSON.parse(n)}catch{return JSON.stringify({error:"data was a string but not valid JSON \u2014 pass the data as a JSON object."})}return n==null?JSON.stringify({error:"data is required \u2014 pass the tool results the page was built from, unchanged."}):JSON.stringify(ke({html:e,data:n}))}catch(e){return JSON.stringify({error:`report_check failed: ${e.message}`})}},tools:[{name:"report_check",description:'Pre-flight a data page BEFORE publishing it: compares the rendered HTML against the DATA it was built from and reports every place they disagree. Catches what the publish validator structurally cannot \u2014 a table that renders fewer rows than the data has records, a bar drawn at a length that is not proportional to its value, a number printed beside a bar that is not that bar\'s datum, a bar whose width is silently nullified by the CSS cascade, and placeholder residue ([object Object], NaN, an un-substituted ${\u2026}) left in visible text. Pass the data UNCHANGED, exactly as your tools returned it (wrap a bare array as {"rows": [...]}) \u2014 the check discovers the collections and series inside it and derives what must be true on its own. Do NOT write your own expectations. Returns { ok, defects:[{code,line,message,hint}], checked }. Always read `checked`: it reports how many tables, rows and bars were found, so a clean `ok:true` with `bars: 0` on a chart page tells you the check never saw your chart.',input_schema:{type:"object",properties:{html:{type:"string",description:"The exact HTML you are about to publish (the same string you would pass to artifact_publish)."},data:{type:"object",description:'The data the page was built from, as JSON \u2014 the raw tool results. Any shape: arrays of records and label/value series are found automatically. Wrap a bare top-level array as {"rows": [...]}.'}},required:["html","data"]}}]};export{y as REPORT_CODES,Ee as __reportCheckInternals,ke as checkRenderedReport,He as reportCheckSkill};
|
package/dist/sentry.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{existsSync as E}from"fs";import{fileURLToPath as w}from"url";import{dirname as O,resolve as v}from"path";import{resolveIntegrationToken as u}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"}),U=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 Chat",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark App",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 p={api:{knob:"SKILL_API_TIMEOUT_MS",fallback:3e4},transfer:{knob:"SKILL_TRANSFER_TIMEOUT_MS",fallback:12e4},job:{knob:"SKILL_JOB_TIMEOUT_MS",fallback:3e5}};function I(n,e,t=process.env){let r=Number(t?.[n]);return Number.isFinite(r)&&r>0?Math.min(6e5,Math.max(1e3,Math.floor(r))):e}function f(n="api",e=process.env){let t=p[n]||p.api;return I(t.knob,t.fallback,e)}function b(n){return n?.name==="TimeoutError"||n?.name==="AbortError"}function k(n){try{return new URL(String(n?.url??n)).host||"unknown host"}catch{return"unknown host"}}function T(n,e){if(!n)return e;let t=new AbortController,r=o=>{t.signal.aborted||t.abort(o)},i=()=>r(n.reason),s=()=>r(e.reason);return t.signal.addEventListener("abort",()=>{n.removeEventListener("abort",i),e.removeEventListener("abort",s)},{once:!0}),n.aborted?r(n.reason):e.aborted?r(e.reason):(n.addEventListener("abort",i,{once:!0}),e.addEventListener("abort",s,{once:!0})),t.signal}async function c(n,e={},t={}){let r=t.kind||"api",i=(p[r]||p.api).knob,s=t.timeoutMs?Math.min(6e5,Math.max(1e3,Math.floor(t.timeoutMs))):f(r),o=e?.signal;if(o?.aborted)throw o.reason??new DOMException("This operation was aborted","AbortError");let a=AbortSignal.timeout(s),d=T(o,a);try{return await fetch(n,{...e,signal:d})}catch(y){throw a.aborted&&b(y)?new Error(`${t.what||"request"} TIMED OUT after ${s}ms against ${k(n)} (${i})`):y}}function A(){if(process.env.MCP_SENTRY_PATH)return process.env.MCP_SENTRY_PATH;let n=O(w(import.meta.url)),e=v(n,"..","bin","mcp-sentry.mjs");return E(e)?e:null}function l(n){return(n||process.env.SENTRY_URL||"https://sentry.io").trim().replace(/\/+$/,"")}function h(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 S(n,e={}){let{token:t,organizationSlug:r,baseUrl:i}=await u("sentry"),s=`${l(i)}/api/0/organizations/${h(r)}${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 c(s,o,{kind:"api",what:`Sentry ${e.method||"GET"} ${n}`});if(!a.ok){let d=await a.text().catch(()=>"");throw new Error(`Sentry API ${a.status}: ${d.slice(0,300)}`)}return a.json()}async function
|
|
1
|
+
import{existsSync as E}from"fs";import{fileURLToPath as w}from"url";import{dirname as O,resolve as v}from"path";import{resolveIntegrationToken as u}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"}),U=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 Chat",connectPath:"/integrations?provider=lark"},lark_docs:{id:"lark_docs",name:"Lark App",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 p={api:{knob:"SKILL_API_TIMEOUT_MS",fallback:3e4},transfer:{knob:"SKILL_TRANSFER_TIMEOUT_MS",fallback:12e4},job:{knob:"SKILL_JOB_TIMEOUT_MS",fallback:3e5}};function I(n,e,t=process.env){let r=Number(t?.[n]);return Number.isFinite(r)&&r>0?Math.min(6e5,Math.max(1e3,Math.floor(r))):e}function f(n="api",e=process.env){let t=p[n]||p.api;return I(t.knob,t.fallback,e)}function b(n){return n?.name==="TimeoutError"||n?.name==="AbortError"}function k(n){try{return new URL(String(n?.url??n)).host||"unknown host"}catch{return"unknown host"}}function T(n,e){if(!n)return e;let t=new AbortController,r=o=>{t.signal.aborted||t.abort(o)},i=()=>r(n.reason),s=()=>r(e.reason);return t.signal.addEventListener("abort",()=>{n.removeEventListener("abort",i),e.removeEventListener("abort",s)},{once:!0}),n.aborted?r(n.reason):e.aborted?r(e.reason):(n.addEventListener("abort",i,{once:!0}),e.addEventListener("abort",s,{once:!0})),t.signal}async function c(n,e={},t={}){let r=t.kind||"api",i=(p[r]||p.api).knob,s=t.timeoutMs?Math.min(6e5,Math.max(1e3,Math.floor(t.timeoutMs))):f(r),o=e?.signal;if(o?.aborted)throw o.reason??new DOMException("This operation was aborted","AbortError");let a=AbortSignal.timeout(s),d=T(o,a);try{return await fetch(n,{...e,signal:d})}catch(y){throw a.aborted&&b(y)?new Error(`${t.what||"request"} TIMED OUT after ${s}ms against ${k(n)} (${i})`):y}}function A(){if(process.env.MCP_SENTRY_PATH)return process.env.MCP_SENTRY_PATH;let n=O(w(import.meta.url)),e=v(n,"..","bin","mcp-sentry.mjs");return E(e)?e:null}function l(n){return(n||process.env.SENTRY_URL||"https://sentry.io").trim().replace(/\/+$/,"")}function h(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 S(n,e={}){let{token:t,organizationSlug:r,baseUrl:i}=await u("sentry"),s=`${l(i)}/api/0/organizations/${h(r)}${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 c(s,o,{kind:"api",what:`Sentry ${e.method||"GET"} ${n}`});if(!a.ok){let d=await a.text().catch(()=>"");throw new Error(`Sentry API ${a.status}: ${d.slice(0,300)}`)}return a.json()}async function N(){return S("/projects/?per_page=50")}async function L({query:n="is:unresolved",sort:e="date",project:t,limit:r=25}={}){let i=`/issues/?query=${encodeURIComponent(n)}&sort=${e}&per_page=${r}`;return t&&(i+=`&project=${encodeURIComponent(t)}`),S(i)}async function m(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:r,baseUrl:i}=await u("sentry"),s=await c(`${l(i)}/api/0/organizations/${h(r)}/shortids/${encodeURIComponent(e)}/`,{headers:{Authorization:`Bearer ${t}`}},{kind:"api",what:"Sentry GET shortids"});if(!s.ok){let d=await s.text().catch(()=>"");throw new Error(`Sentry API ${s.status} resolving shortId "${e}": ${d.slice(0,200)}`)}let o=await s.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 P(n){if(!n)throw new Error("sentryGetIssue: issueId is required");let e=await m(n),{token:t,baseUrl:r}=await u("sentry"),i=await c(`${l(r)}/api/0/issues/${e}/`,{headers:{Authorization:`Bearer ${t}`}},{kind:"api",what:`Sentry GET issue ${e}`});if(!i.ok){let s=await i.text().catch(()=>"");throw new Error(`Sentry API ${i.status}: ${s.slice(0,300)}`)}return i.json()}async function R(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 r=await m(n),{token:i,baseUrl:s}=await u("sentry"),o=await c(`${l(s)}/api/0/issues/${r}/`,{method:"PUT",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(t)},{kind:"api",what:`Sentry PUT issue ${r}`});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,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 m(n),{token:r,baseUrl:i}=await u("sentry"),s=await c(`${l(i)}/api/0/issues/${t}/comments/`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify({text:String(e)})},{kind:"api",what:`Sentry POST issue ${t} comment`});if(!s.ok){let o=await s.text().catch(()=>"");throw s.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 ${s.status} commenting on issue ${n}: ${o.slice(0,300)}`)}return s.json()}var g={id:"sentry",callsBackend:!0,serverName:"sentry",allowedTools:["mcp__sentry__*"],requiresIntegration:_.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=A();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
|
|
7
|
+
- sentry_add_comment: Post a comment/note on an issue (requires issueId + text; needs write scope)`,resolve(){let n=A();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}},async handleToolCall(n,e={}){try{switch(n){case"sentry_list_projects":{let t=await N();return JSON.stringify({projects:t.map(r=>({slug:r.slug,name:r.name,platform:r.platform}))})}case"sentry_list_issues":{let t=await L({query:e.query,sort:e.sort,project:e.project,limit:e.limit});return JSON.stringify({issues:t.map(r=>({id:r.id,title:r.title,culprit:r.culprit,count:r.count,firstSeen:r.firstSeen,lastSeen:r.lastSeen,level:r.level,status:r.status}))})}case"sentry_get_issue":{let t=await P(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 R(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 $(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"]}}]};g.tools=g.toolsForAssistant;export{m as resolveSentryIssueId,$ as sentryAddComment,S as sentryFetch,P as sentryGetIssue,L as sentryListIssues,N as sentryListProjects,g as sentrySkill,R as sentryUpdateIssue};
|
package/dist/slack.js
CHANGED
|
@@ -4,4 +4,4 @@ You have access to the user's Slack workspace. Use these tools:
|
|
|
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 r=L();if(!r)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:[r],env:t
|
|
7
|
+
- slack_list_usergroups, slack_get_usergroup_members (workspace-defined teams like @oncall, @platform)`,resolve(){let r=L();if(!r)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:[r],env:t}},async handleToolCall(r,t){try{switch(r){case"slack_list_channels":{let e=await o("conversations.list",{types:"public_channel",limit:100});return JSON.stringify({channels:(e.channels||[]).map(n=>({id:n.id,name:n.name,topic:n.topic?.value}))})}case"slack_post_message":{if(!t.channel||!t.text)return JSON.stringify({error:"channel and text are required"});let e=await o("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 o("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 o("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 o("conversations.history",{channel:t.channel,limit:t.limit||20});return JSON.stringify({messages:(e.messages||[]).map(n=>({user:n.user,text:n.text,ts:n.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 o("conversations.replies",{channel:t.channel,ts:t.thread_ts});return JSON.stringify({messages:(e.messages||[]).map(n=>({user:n.user,text:n.text,ts:n.ts}))})}case"slack_get_users":{let e=await o("users.list",{limit:100});return JSON.stringify({users:(e.members||[]).filter(n=>!n.is_bot&&!n.deleted).map(n=>({id:n.id,name:n.real_name||n.name}))})}case"slack_get_user_profile":{if(!t.user_id)return JSON.stringify({error:"user_id is required"});let e=await o("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 o("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 o("usergroups.list",{});return JSON.stringify({usergroups:(e.usergroups||[]).map(n=>({id:n.id,handle:n.handle,name:n.name,description:n.description||"",user_count:Number(n.user_count||0)}))})}case"slack_get_usergroup_members":{if(!t.usergroup)return JSON.stringify({error:"usergroup id is required"});let e=await o("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 n=Math.max(1,Math.min(Number(t.limit)||5,25)),c=[],a,l=5;for(let i=0;i<l;i+=1){let s={limit:200};a&&(s.cursor=a);let u=await o("users.list",s);for(let d of u.members||[])d.deleted||d.is_bot||c.push(d);if(a=u.response_metadata?.next_cursor,!a)break}let p=[];for(let i of c){let s=(i.real_name||"").toLowerCase(),u=(i.profile?.display_name||"").toLowerCase(),d=(i.name||"").toLowerCase(),m=0;s.includes(e)&&(m+=100-Math.abs(s.length-e.length)),u.includes(e)&&(m+=60-Math.abs(u.length-e.length)),d.includes(e)&&(m+=30-Math.abs(d.length-e.length)),(s===e||u===e)&&(m+=200),m>0&&p.push({id:i.id,name:i.real_name||i.profile?.display_name||i.name,email:i.profile?.email||void 0,_score:m})}return p.sort((i,s)=>s._score-i._score),JSON.stringify({ok:!0,matches:p.slice(0,n).map(({_score:i,...s})=>s),scanned:c.length})}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}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{U as slackSkill};
|
package/dist/socialCard.js
CHANGED
|
@@ -16,4 +16,4 @@ fields that capture the ONE key idea of your post:
|
|
|
16
16
|
It renders server-side to a PNG in the run's output folder and returns
|
|
17
17
|
{ ok:true, files:[{ path, format:'png', bytes }] }. Pass the returned \`path\` as
|
|
18
18
|
\`imagePath\` when you draft/publish a LinkedIn post to ATTACH the card as the
|
|
19
|
-
post image. No browser, no external service \u2014 the data never leaves the machine.`,resolve({sessionPath:e,nodeName:t}={}){let n=he();if(!n)return{command:null,args:[],env:{},description:this.description};let h={},a=e&&t?F(e,t):null;a&&(h.ZIBBY_NODE_SESSION_PATH=a),e&&(h.ZIBBY_SESSION_PATH=e);for(let o of["ZIBBY_NODE_SESSION_PATH","ZIBBY_SESSION_PATH"])!h[o]&&process.env[o]&&(h[o]=process.env[o]);return{type:"stdio",command:"node",args:[n,"../dist/socialCard.js","socialCardSkill"],env:h,description:this.description
|
|
19
|
+
post image. No browser, no external service \u2014 the data never leaves the machine.`,resolve({sessionPath:e,nodeName:t}={}){let n=he();if(!n)return{command:null,args:[],env:{},description:this.description};let h={},a=e&&t?F(e,t):null;a&&(h.ZIBBY_NODE_SESSION_PATH=a),e&&(h.ZIBBY_SESSION_PATH=e);for(let o of["ZIBBY_NODE_SESSION_PATH","ZIBBY_SESSION_PATH"])!h[o]&&process.env[o]&&(h[o]=process.env[o]);return{type:"stdio",command:"node",args:[n,"../dist/socialCard.js","socialCardSkill"],env:h,description:this.description}},async handleToolCall(e,t){if(e!=="social_card_render")return JSON.stringify({error:`Unknown tool: ${e}`});try{let n=t?.headline;if(typeof n!="string"||!n.trim())return JSON.stringify({error:"headline (the big bold line) is required and must be a non-empty string."});let h=U(t?.width,K),a=U(t?.height,ae),o=t?.theme==="light"?"light":"dark",r=ge(t?.accent,le),i;try{i=ye({width:h,height:a,theme:o,accent:r,headline:n,eyebrow:t?.eyebrow,subhead:t?.subhead,stat:t?.stat,footer:t?.footer,diagram:t?.diagram})}catch(s){return JSON.stringify({error:`Card layout failed: ${s.message}`})}let f;try{f=be(i)}catch(s){return JSON.stringify({error:`PNG rasterization failed: ${s.message}`})}let m=ue(),y=pe(t?.filename)||`social-card-${Date.now()}`,b=F(m,`${y}.png`);z(b,f);let $=[{path:b,format:"png",bytes:f.length}];if(t?.output==="both"||t?.output==="svg"){let s=F(m,`${y}.svg`);z(s,i,"utf-8"),$.push({path:s,format:"svg",bytes:Buffer.byteLength(i,"utf-8")})}return JSON.stringify({ok:!0,width:h,height:a,theme:o,files:$})}catch(n){return JSON.stringify({error:`social_card_render failed: ${n.message}`})}},tools:[{name:"social_card_render",description:'Render a BRANDED "concept card" PNG LOCALLY (no external service) from structured fields \u2014 the clean LinkedIn concept-card style: bold headline + small uppercase eyebrow + optional supporting subhead, stat, footer, and an A\u2014\u2713\u2014B diagram. Returns { ok:true, files:[{ path, format:"png", bytes }] }. Pass the returned `path` as `imagePath` to a LinkedIn post tool to attach it as the post image. Example: { "headline":"No more copy-paste between AI tools", "eyebrow":"MY WORKFLOW", "stat":"11.8k stars", "footer":"Apache 2.0", "diagram":["Claude Code","Codex"] }.',input_schema:{type:"object",properties:{headline:{type:"string",description:"REQUIRED. The big, bold line \u2014 the single key idea/takeaway. Word-wrapped + auto-sized."},eyebrow:{type:"string",description:'Small uppercase kicker above the headline (e.g. "MY WORKFLOW", "OPEN SOURCE"). Rendered uppercased in the accent color.'},subhead:{type:"string",description:"One supporting line under the headline (muted)."},stat:{type:"string",description:'Optional stat, shown bottom-right in the accent color (e.g. "11.8k stars", "3x faster").'},footer:{type:"string",description:'Optional footer, shown bottom-left (muted) (e.g. "Apache 2.0", a repo name).'},diagram:{type:"array",items:{type:"string"},description:'Optional 2-3 short labels rendered as a chain of pills joined by a checkmark (A \u2014\u2713\u2014 B), e.g. ["Claude Code","Codex"].'},theme:{type:"string",enum:["dark","light"],description:"Card theme (default 'dark' \u2014 near-black bg, off-white text)."},accent:{type:"string",description:'Accent hex color (e.g. "#f97316"). Defaults to a tasteful blue (#3b82f6).'},width:{type:"number",description:"Image width in px (default 1200 \u2014 LinkedIn 1.91:1 link image)."},height:{type:"number",description:"Image height in px (default 627)."},filename:{type:"string",description:"Optional file basename (no extension); defaults to social-card-<timestamp>."},output:{type:"string",enum:["png","both"],description:"Which file(s) to write (default 'png'; 'both' also writes the .svg)."}},required:["headline"]}}]};export{ke as socialCardSkill};
|