@zibby/skills 0.1.57 → 0.1.59

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/skills",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
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/sentry.d.ts CHANGED
@@ -1,12 +1,3 @@
1
- /**
2
- * Low-level Sentry REST helper, scoped to the user's connected org.
3
- * All endpoints under `/api/0/organizations/<slug>/…` route through
4
- * this — auth header + base URL + non-2xx → throw are handled once.
5
- *
6
- * Exported so deterministic workflow nodes can talk to Sentry without
7
- * going through the LLM tool layer. `sentryListIssues / Projects /
8
- * GetIssue` below are thin wrappers — prefer those over raw `sentryFetch`.
9
- */
10
1
  export function sentryFetch(path: any, opts?: {}): Promise<any>;
11
2
  /**
12
3
  * List Sentry projects in the connected organization. Returns raw
package/dist/sentry.js CHANGED
@@ -1,7 +1,7 @@
1
- import{existsSync as l}from"fs";import{fileURLToPath as y}from"url";import{dirname as m,resolve as h}from"path";import{resolveIntegrationToken as a}from"@zibby/core/backend-client.js";var c=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",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business"}),w=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"},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"},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"}});function g(){if(process.env.MCP_SENTRY_PATH)return process.env.MCP_SENTRY_PATH;let s=m(y(import.meta.url)),t=h(s,"..","bin","mcp-sentry.mjs");return l(t)?t:null}async function u(s,t={}){let{token:e,organizationSlug:n}=await a("sentry"),i=`https://sentry.io/api/0/organizations/${n}${s}`,r={method:t.method||"GET",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}};t.body!=null&&(r.body=typeof t.body=="string"?t.body:JSON.stringify(t.body));let o=await fetch(i,r);if(!o.ok){let p=await o.text().catch(()=>"");throw new Error(`Sentry API ${o.status}: ${p.slice(0,300)}`)}return o.json()}async function _(){return u("/projects/?per_page=50")}async function S({query:s="is:unresolved",sort:t="date",project:e,limit:n=25}={}){let i=`/issues/?query=${encodeURIComponent(s)}&sort=${t}&per_page=${n}`;return e&&(i+=`&project=${encodeURIComponent(e)}`),u(i)}async function f(s){if(!s)throw new Error("sentryGetIssue: issueId is required");let{token:t}=await a("sentry"),e=await fetch(`https://sentry.io/api/0/issues/${s}/`,{headers:{Authorization:`Bearer ${t}`}});if(!e.ok){let n=await e.text().catch(()=>"");throw new Error(`Sentry API ${e.status}: ${n.slice(0,300)}`)}return e.json()}async function I(s,t={}){if(!s)throw new Error("sentryUpdateIssue: issueId is required");let e={};for(let r of["status","statusDetails","assignedTo","isBookmarked","hasSeen"])t[r]!==void 0&&(e[r]=t[r]);if(Object.keys(e).length===0)throw new Error("sentryUpdateIssue: nothing to update (pass status / statusDetails / assignedTo / isBookmarked / hasSeen)");let{token:n}=await a("sentry"),i=await fetch(`https://sentry.io/api/0/issues/${s}/`,{method:"PUT",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!i.ok){let r=await i.text().catch(()=>"");throw i.status===403?new Error(`Sentry API 403 updating issue ${s}: ${r.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 ${i.status} updating issue ${s}: ${r.slice(0,300)}`)}return i.json()}async function k(s,t){if(!s)throw new Error("sentryAddComment: issueId is required");if(!t||!String(t).trim())throw new Error("sentryAddComment: text is required");let{token:e}=await a("sentry"),n=await fetch(`https://sentry.io/api/0/issues/${s}/comments/`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({text:String(t)})});if(!n.ok){let i=await n.text().catch(()=>"");throw n.status===403?new Error(`Sentry API 403 commenting on issue ${s}: ${i.slice(0,200)}. The connected Sentry integration likely lacks the \`event:write\` scope \u2014 reconnect Sentry with write access.`):new Error(`Sentry API ${n.status} commenting on issue ${s}: ${i.slice(0,300)}`)}return n.json()}var d={id:"sentry",serverName:"sentry",allowedTools:["mcp__sentry__*"],requiresIntegration:c.SENTRY,description:"Sentry error tracking \u2014 projects, issues, events",envKeys:[],tools:[],promptFragment:`## Sentry (connected)
1
+ import{existsSync as m}from"fs";import{fileURLToPath as _}from"url";import{dirname as g,resolve as h}from"path";import{resolveIntegrationToken as c}from"@zibby/core/backend-client.js";var u=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",PLANE:"plane",LINEAR:"linear",FIGMA:"figma",OPEN_DESIGN:"open_design",LINKEDIN_PERSONAL:"linkedin_personal",LINKEDIN_BUSINESS:"linkedin_business"}),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"},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"},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"}});function S(){if(process.env.MCP_SENTRY_PATH)return process.env.MCP_SENTRY_PATH;let n=g(_(import.meta.url)),t=h(n,"..","bin","mcp-sentry.mjs");return m(t)?t:null}function d(n){return(n||process.env.SENTRY_URL||"https://sentry.io").trim().replace(/\/+$/,"")}function f(n){let t=n||process.env.SENTRY_ORG;if(!t)throw new Error('Sentry organization not resolved \u2014 reconnect Sentry, or set SENTRY_ORG (self-hosted; the default org slug is "sentry").');return t}async function l(n,t={}){let{token:e,organizationSlug:s,baseUrl:r}=await c("sentry"),i=`${d(r)}/api/0/organizations/${f(s)}${n}`,o={method:t.method||"GET",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}};t.body!=null&&(o.body=typeof t.body=="string"?t.body:JSON.stringify(t.body));let a=await fetch(i,o);if(!a.ok){let y=await a.text().catch(()=>"");throw new Error(`Sentry API ${a.status}: ${y.slice(0,300)}`)}return a.json()}async function I(){return l("/projects/?per_page=50")}async function k({query:n="is:unresolved",sort:t="date",project:e,limit:s=25}={}){let r=`/issues/?query=${encodeURIComponent(n)}&sort=${t}&per_page=${s}`;return e&&(r+=`&project=${encodeURIComponent(e)}`),l(r)}async function w(n){if(!n)throw new Error("sentryGetIssue: issueId is required");let{token:t,baseUrl:e}=await c("sentry"),s=await fetch(`${d(e)}/api/0/issues/${n}/`,{headers:{Authorization:`Bearer ${t}`}});if(!s.ok){let r=await s.text().catch(()=>"");throw new Error(`Sentry API ${s.status}: ${r.slice(0,300)}`)}return s.json()}async function b(n,t={}){if(!n)throw new Error("sentryUpdateIssue: issueId is required");let e={};for(let o of["status","statusDetails","assignedTo","isBookmarked","hasSeen"])t[o]!==void 0&&(e[o]=t[o]);if(Object.keys(e).length===0)throw new Error("sentryUpdateIssue: nothing to update (pass status / statusDetails / assignedTo / isBookmarked / hasSeen)");let{token:s,baseUrl:r}=await c("sentry"),i=await fetch(`${d(r)}/api/0/issues/${n}/`,{method:"PUT",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!i.ok){let o=await i.text().catch(()=>"");throw i.status===403?new Error(`Sentry API 403 updating issue ${n}: ${o.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 ${i.status} updating issue ${n}: ${o.slice(0,300)}`)}return i.json()}async function N(n,t){if(!n)throw new Error("sentryAddComment: issueId is required");if(!t||!String(t).trim())throw new Error("sentryAddComment: text is required");let{token:e,baseUrl:s}=await c("sentry"),r=await fetch(`${d(s)}/api/0/issues/${n}/comments/`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({text:String(t)})});if(!r.ok){let i=await r.text().catch(()=>"");throw r.status===403?new Error(`Sentry API 403 commenting on issue ${n}: ${i.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}: ${i.slice(0,300)}`)}return r.json()}var p={id:"sentry",serverName:"sentry",allowedTools:["mcp__sentry__*"],requiresIntegration:u.SENTRY,description:"Sentry error tracking \u2014 projects, issues, events",envKeys:[],tools:[],promptFragment:`## Sentry (connected)
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 s=g();if(!s)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]);return{type:"stdio",command:"node",args:[s],env:t,alwaysLoad:!0}},async handleToolCall(s,t={}){try{switch(s){case"sentry_list_projects":{let e=await _();return JSON.stringify({projects:e.map(n=>({slug:n.slug,name:n.name,platform:n.platform}))})}case"sentry_list_issues":{let e=await S({query:t.query,sort:t.sort,project:t.project,limit:t.limit});return JSON.stringify({issues:e.map(n=>({id:n.id,title:n.title,culprit:n.culprit,count:n.count,firstSeen:n.firstSeen,lastSeen:n.lastSeen,level:n.level,status:n.status}))})}case"sentry_get_issue":{let e=await f(t.issueId);return JSON.stringify({id:e.id,title:e.title,culprit:e.culprit,metadata:e.metadata,count:e.count,userCount:e.userCount,firstSeen:e.firstSeen,lastSeen:e.lastSeen,level:e.level,status:e.status,project:{slug:e.project?.slug,name:e.project?.name}})}case"sentry_update_issue":{let e=await I(t.issueId,{status:t.status,statusDetails:t.statusDetails,assignedTo:t.assignedTo,isBookmarked:t.isBookmarked,hasSeen:t.hasSeen});return JSON.stringify({ok:!0,id:e.id??t.issueId,status:e.status,assignedTo:e.assignedTo,isBookmarked:e.isBookmarked})}case"sentry_add_comment":{let e=await k(t.issueId,t.text);return JSON.stringify({ok:!0,id:e.id,issueId:t.issueId})}default:return JSON.stringify({error:`Unknown tool: ${s}`})}}catch(e){return JSON.stringify({error:e.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"]}}]};d.tools=d.toolsForAssistant;export{k as sentryAddComment,u as sentryFetch,f as sentryGetIssue,S as sentryListIssues,_ as sentryListProjects,d as sentrySkill,I as sentryUpdateIssue};
7
+ - sentry_add_comment: Post a comment/note on an issue (requires issueId + text; needs write scope)`,resolve(){let n=S();if(!n)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","ZIBBY_SELF_HOST","SENTRY_URL","SENTRY_ORG","SENTRY_AUTH_TOKEN"])process.env[e]&&(t[e]=process.env[e]);return{type:"stdio",command:"node",args:[n],env:t,alwaysLoad:!0}},async handleToolCall(n,t={}){try{switch(n){case"sentry_list_projects":{let e=await I();return JSON.stringify({projects:e.map(s=>({slug:s.slug,name:s.name,platform:s.platform}))})}case"sentry_list_issues":{let e=await k({query:t.query,sort:t.sort,project:t.project,limit:t.limit});return JSON.stringify({issues:e.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 e=await w(t.issueId);return JSON.stringify({id:e.id,title:e.title,culprit:e.culprit,metadata:e.metadata,count:e.count,userCount:e.userCount,firstSeen:e.firstSeen,lastSeen:e.lastSeen,level:e.level,status:e.status,project:{slug:e.project?.slug,name:e.project?.name}})}case"sentry_update_issue":{let e=await b(t.issueId,{status:t.status,statusDetails:t.statusDetails,assignedTo:t.assignedTo,isBookmarked:t.isBookmarked,hasSeen:t.hasSeen});return JSON.stringify({ok:!0,id:e.id??t.issueId,status:e.status,assignedTo:e.assignedTo,isBookmarked:e.isBookmarked})}case"sentry_add_comment":{let e=await N(t.issueId,t.text);return JSON.stringify({ok:!0,id:e.id,issueId:t.issueId})}default:return JSON.stringify({error:`Unknown tool: ${n}`})}}catch(e){return JSON.stringify({error:e.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"]}}]};p.tools=p.toolsForAssistant;export{N as sentryAddComment,l as sentryFetch,w as sentryGetIssue,k as sentryListIssues,I as sentryListProjects,p as sentrySkill,b as sentryUpdateIssue};
@@ -0,0 +1,42 @@
1
+ export namespace triggerWorkflowSkill {
2
+ let id: string;
3
+ let serverName: string;
4
+ let allowedTools: string[];
5
+ let envKeys: any[];
6
+ let description: string;
7
+ let promptFragment: string;
8
+ function resolve(): {
9
+ command: any;
10
+ args: any[];
11
+ env: {};
12
+ description: string;
13
+ type?: undefined;
14
+ alwaysLoad?: undefined;
15
+ } | {
16
+ type: string;
17
+ command: string;
18
+ args: any[];
19
+ env: {};
20
+ description: string;
21
+ alwaysLoad: boolean;
22
+ };
23
+ function handleToolCall(name: any, args?: {}): Promise<string>;
24
+ let tools: {
25
+ name: string;
26
+ description: string;
27
+ input_schema: {
28
+ type: string;
29
+ properties: {
30
+ workflowType: {
31
+ type: string;
32
+ description: string;
33
+ };
34
+ input: {
35
+ type: string;
36
+ description: string;
37
+ };
38
+ };
39
+ required: any[];
40
+ };
41
+ }[];
42
+ }
@@ -0,0 +1 @@
1
+ import{dirname as g,resolve as d}from"path";import{fileURLToPath as u}from"url";import{existsSync as w}from"fs";function h(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let r=g(u(import.meta.url)),e=d(r,"..","bin","mcp-skill.mjs");return w(e)?e:null}function T(){return process.env.PROJECT_API_TOKEN||process.env.ZIBBY_USER_TOKEN||null}function _(){return((process.env.PROGRESS_API_URL||"").replace(/\/executions\/?$/,"")||process.env.ZIBBY_ACCOUNT_API_URL||process.env.ZIBBY_PROD_ACCOUNT_API_URL||(process.env.ZIBBY_ENV==="local"?"http://localhost:3001":"https://api-prod.zibby.app")).replace(/\/+$/,"")}var y={name:"trigger_workflow",description:"Trigger another Zibby workflow/agent run in THIS project (fire-and-forget). Call it once per run you want to start \u2014 the agent decides which and how many. Omit workflowType to re-run THIS same agent (self-dispatch, e.g. with a different trigger input). Returns the started run's executionId; does NOT wait for it to finish.",input_schema:{type:"object",properties:{workflowType:{type:"string",description:"Which workflow to trigger (its type/slug in this project). Omit to trigger THIS same agent (self-dispatch)."},input:{type:"object",description:"The trigger payload passed to the target workflow (validated against its state schema)."}},required:[]}},I={id:"trigger-workflow",serverName:"trigger",allowedTools:["mcp__trigger__*"],envKeys:[],description:"Trigger another Zibby workflow/agent run in this project (agent-driven, fire-and-forget; cloud + self-hosted).",promptFragment:"## Trigger another workflow (agent-driven)\nYou can start another Zibby workflow/agent run yourself with the `trigger_workflow`\ntool \u2014 and YOU decide when and how many times to call it. Each call starts ONE\nindependent run (fire-and-forget) and returns its executionId; it does NOT wait for\nthat run to finish.\n- To re-run THIS same agent (self-dispatch) \u2014 e.g. to hand an item to another of\n this agent's scenarios \u2014 OMIT `workflowType` and pass the `input` for that run.\n- To trigger a DIFFERENT agent in the project, pass its `workflowType` + `input`.\nCall it once per run you want to start (loop over your items and call it for each).\nIt never throws \u2014 a failure comes back as { ok:false, error }; log it and move on.",resolve(){let r=h();if(!r)return{command:null,args:[],env:{},description:this.description};let e={};for(let t of["PROJECT_API_TOKEN","PROJECT_ID","WORKFLOW_TYPE","PROGRESS_API_URL","ZIBBY_ACCOUNT_API_URL","ZIBBY_PROD_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_USER_TOKEN"])process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[r,"../dist/triggerWorkflow.js","triggerWorkflowSkill"],env:e,description:this.description,alwaysLoad:!1}},async handleToolCall(r,e={}){if(r!=="trigger_workflow")return JSON.stringify({ok:!1,error:`unknown tool: ${r}`});try{let t=process.env.PROJECT_ID,a=T(),s=typeof e.workflowType=="string"&&e.workflowType.trim()?e.workflowType.trim():(process.env.WORKFLOW_TYPE||"").trim();if(!t)return JSON.stringify({ok:!1,error:"PROJECT_ID not set \u2014 cannot resolve the target project."});if(!a)return JSON.stringify({ok:!1,error:"PROJECT_API_TOKEN not set \u2014 cannot authenticate the trigger."});if(!s)return JSON.stringify({ok:!1,error:"No workflowType given and WORKFLOW_TYPE is unset \u2014 nothing to trigger."});let c=`${_()}/projects/${encodeURIComponent(t)}/workflows/${encodeURIComponent(s)}/trigger`,l=new AbortController,p=setTimeout(()=>l.abort(),2e4),n;try{n=await fetch(c,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${a}`},body:JSON.stringify({input:e.input&&typeof e.input=="object"?e.input:{}}),signal:l.signal})}finally{clearTimeout(p)}let i=await n.text().catch(()=>""),o;try{o=i?JSON.parse(i):{}}catch{o={raw:i}}if(!n.ok)return JSON.stringify({ok:!1,error:`trigger failed (HTTP ${n.status})`,detail:o&&(o.error||o.message)||i.slice(0,300)});let f=o.executionId||o.execution?.id||o.id||null;return JSON.stringify({ok:!0,workflowType:s,executionId:f,note:"run started (fire-and-forget)"})}catch(t){return JSON.stringify({ok:!1,error:`trigger_workflow failed: ${t?.message||String(t)}`})}},tools:[y]};export{I as triggerWorkflowSkill};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/skills",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
4
4
  "description": "Built-in skill definitions for the Zibby agent-workflow framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",