nagoc-zerowork 1.1.5 → 1.1.6

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -309,14 +309,14 @@ SUMMARY:
309
309
  - Code Expression: Single-line JS. Requires Agent >= 1.1.72.
310
310
  - Code Block: Multi-line JS with imports. Requires Agent >= 1.1.72.
311
311
  - Spintax {opt1|opt2|opt3}: Randomizes text. Any agent version.
312
- `};import Zn from"fs";import jn from"path";import{fileURLToPath as qz}from"url";var Dz=()=>{let t=process.env.ZEROWORK_BOTS;if(!t)return{};try{return JSON.parse(t)}catch{return console.error("Failed to parse ZEROWORK_BOTS environment variable. Must be valid JSON."),{}}},po=new In({name:"nagoc-zerowork",version:"1.1.5"},{capabilities:{tools:{},resources:{}}}),lo=null;function Ha(){if(lo)return lo;let t=[];try{let e=qz(import.meta.url),r=jn.dirname(e),o=jn.resolve(r,".."),n=jn.join(o,"all_subtitles.txt");if(Zn.existsSync(n)){let a=Zn.readFileSync(n,"utf-8").split(/^===\s*(.*?)\s*===\s*$/m);for(let c=1;c<a.length;c+=2){let u=a[c]?a[c].replace(/\.txt$/,"").trim():`Tutorial ${Math.floor(c/2)+1}`,l=a[c+1]?a[c+1].trim():"";u&&l&&t.push({id:`tutorial_${t.length+1}`,title:u,content:l})}}let s=jn.join(o,"Elias Subtitles","WhatsApp Automation for Cold Outreach (Beginner-Friendly Guide).txt");if(Zn.existsSync(s)){let i=Zn.readFileSync(s,"utf-8"),a=i.split(`
312
+ `};import Zn from"fs";import jn from"path";import{fileURLToPath as qz}from"url";var Dz=()=>{let t=process.env.ZEROWORK_BOTS;if(!t)return{};try{return JSON.parse(t)}catch{return console.error("Failed to parse ZEROWORK_BOTS environment variable. Must be valid JSON."),{}}},po=new In({name:"nagoc-zerowork",version:"1.1.6"},{capabilities:{tools:{},resources:{}}}),lo=null;function Ha(){if(lo)return lo;let t=[];try{let e=qz(import.meta.url),r=jn.dirname(e),o=jn.resolve(r,".."),n=jn.join(o,"all_subtitles.txt");if(Zn.existsSync(n)){let a=Zn.readFileSync(n,"utf-8").split(/^===\s*(.*?)\s*===\s*$/m);for(let c=1;c<a.length;c+=2){let u=a[c]?a[c].replace(/\.txt$/,"").trim():`Tutorial ${Math.floor(c/2)+1}`,l=a[c+1]?a[c+1].trim():"";u&&l&&t.push({id:`tutorial_${t.length+1}`,title:u,content:l})}}let s=jn.join(o,"Elias Subtitles","WhatsApp Automation for Cold Outreach (Beginner-Friendly Guide).txt");if(Zn.existsSync(s)){let i=Zn.readFileSync(s,"utf-8"),a=i.split(`
313
313
  `),c=a[0]?a[0].trim():"WhatsApp Automation for Cold Outreach (Beginner-Friendly Guide)";t.push({id:`tutorial_${t.length+1}`,title:c,content:i.trim()})}lo=t}catch(e){console.error("Failed to load tutorials subtitles:",e),lo=[]}return lo}po.setRequestHandler(Ms,async()=>{let e=Ha().map(r=>({uri:`resource://zerowork/tutorials/${r.id}`,name:`ZeroWork Video Tutorial: ${r.title}`,mimeType:"text/plain",description:`Official video masterclass transcript for: ${r.title}`}));return{resources:[{uri:"resource://zerowork/general",name:"ZeroWork General Knowledge",mimeType:"text/plain",description:"General concepts about ZeroWork RPA, TaskBots, and Architecture"},{uri:"resource://zerowork/webhooks",name:"ZeroWork Webhooks Guide",mimeType:"text/plain",description:"How to trigger ZeroWork bots and pass dynamic data via webhooks"},{uri:"resource://zerowork/variables",name:"ZeroWork Variables Guide",mimeType:"text/plain",description:"How variables work in ZeroWork"},{uri:"resource://zerowork/tables",name:"ZeroWork Tables Guide",mimeType:"text/plain",description:"How data tables work in ZeroWork"},{uri:"resource://zerowork/selectors",name:"ZeroWork Selectors Guide",mimeType:"text/plain",description:"How CSS and XPath selectors work in ZeroWork"},{uri:"resource://zerowork/loops",name:"ZeroWork Loops Guide",mimeType:"text/plain",description:"How loops and repeats work in ZeroWork"},{uri:"resource://zerowork/chatgpt",name:"ZeroWork ChatGPT Guide",mimeType:"text/plain",description:"How to integrate ChatGPT via Ask ChatGPT block"},{uri:"resource://zerowork/anti_bot",name:"ZeroWork Anti-Bot Guide",mimeType:"text/plain",description:"Best practices to avoid bot detection and handle dynamic states"},{uri:"resource://zerowork/troubleshooting",name:"ZeroWork Troubleshooting Guide",mimeType:"text/plain",description:"Common problems and troubleshooting steps"},{uri:"resource://zerowork/building_blocks",name:"ZeroWork Building Blocks Guide",mimeType:"text/plain",description:"Comprehensive catalog of all ZeroWork building blocks and their options"},{uri:"resource://zerowork/dynamic_inputs",name:"ZeroWork Dynamic Inputs Guide",mimeType:"text/plain",description:"How to use dynamic inputs: variable/table references, code expressions, code blocks, and spintax in ZeroWork building blocks"},...e]}});po.setRequestHandler(Us,async t=>{let e=t.params.uri,r="";if(e.startsWith("resource://zerowork/tutorials/")){let o=e.replace("resource://zerowork/tutorials/",""),s=Ha().find(i=>i.id===o);if(!s)throw new Error(`Tutorial resource not found: ${e}`);r=`=== ${s.title} ===
314
314
 
315
315
  ${s.content}`}else if(e==="resource://zerowork/general")r=Ee.general;else if(e==="resource://zerowork/webhooks")r=Ee.webhooks;else if(e==="resource://zerowork/variables")r=Ee.variables;else if(e==="resource://zerowork/tables")r=Ee.tables;else if(e==="resource://zerowork/selectors")r=Ee.selectors;else if(e==="resource://zerowork/loops")r=Ee.loops;else if(e==="resource://zerowork/chatgpt")r=Ee.chatgpt;else if(e==="resource://zerowork/anti_bot")r=Ee.anti_bot;else if(e==="resource://zerowork/troubleshooting")r=Ee.troubleshooting;else if(e==="resource://zerowork/building_blocks")r=Ee.building_blocks;else if(e==="resource://zerowork/dynamic_inputs")r=Ee.dynamic_inputs;else throw new Error(`Resource not found: ${e}`);return{contents:[{uri:e,mimeType:"text/plain",text:r}]}});po.setRequestHandler(Bs,async()=>({tools:[{name:"list_taskbots",description:"Lists all configured TaskBots and their names that are available to trigger.",inputSchema:{type:"object",properties:{}}},{name:"trigger_taskbot",description:"Triggers a specific ZeroWork TaskBot by its configured name. Does not send data.",inputSchema:{type:"object",properties:{botName:{type:"string",description:"The name of the TaskBot to trigger (must be one from list_taskbots)"}},required:["botName"]}},{name:"trigger_taskbot_with_data",description:"Triggers a specific ZeroWork TaskBot and sends dynamic JSON data to its zw_webhook_data variable.",inputSchema:{type:"object",properties:{botName:{type:"string",description:"The name of the TaskBot to trigger"},payload:{type:"object",description:"The JSON object payload to send to the bot"}},required:["botName","payload"]}},{name:"trigger_webhook_url",description:"Triggers an arbitrary ZeroWork webhook URL directly.",inputSchema:{type:"object",properties:{url:{type:"string",description:"The full ZeroWork webhook URL"},payload:{type:"object",description:"Optional JSON object payload to send to the bot"}},required:["url"]}},{name:"generate_robust_selector",description:"Analyzes an HTML snippet and target requirements to generate robust, non-brittle CSS and XPath selectors tailored for ZeroWork TaskBots.",inputSchema:{type:"object",properties:{htmlSnippet:{type:"string",description:"The raw HTML snippet containing the target element and its surrounding container hierarchy."},targetText:{type:"string",description:"Optional exact or partial visible text of the target element (e.g., 'Connect', 'Follow')."},description:{type:"string",description:"Optional description of what the element is or its context (e.g., 'The experience list container on LinkedIn', 'Submit button on a dynamic form')."}},required:["htmlSnippet"]}},{name:"get_mcp_version",description:"Returns the version of this MCP server package currently running.",inputSchema:{type:"object",properties:{}}},{name:"search_zerowork_docs",description:"Search and query the ENTIRE ZeroWork official documentation at docs.zerowork.io. Use this tool for ANY question about ZeroWork including features, building blocks, dynamic inputs, TaskBots, spintax, variables, code in inputs, agents, triggers, actions, conditions, loops, integrations, webhooks, selectors, device storage, or any how-to guides. ALWAYS use this tool before answering any ZeroWork-related questions.",inputSchema:{type:"object",properties:{question:{type:"string",description:"The natural language question to search the docs for"}},required:["question"]}},{name:"search_zerowork_tutorials",description:"Search and query the complete library of official ZeroWork video masterclasses, tutorial transcripts, and automation guides. Use this tool to find step-by-step video instructions, advanced CSS selector walkthroughs, dynamic loop setups, and WhatsApp outreach guides.",inputSchema:{type:"object",properties:{query:{type:"string",description:"The natural language search query or keywords to find in the video tutorials"}},required:["query"]}}]}));po.setRequestHandler(Or,async t=>{let{name:e,arguments:r}=t.params,o=Dz();try{if(e==="list_taskbots"){let n=Object.keys(o);return n.length===0?{content:[{type:"text",text:'No TaskBots are configured. Please set the ZEROWORK_BOTS environment variable in your Claude config (e.g., {"myBot": "https://hook.zerowork.io/..."}).'}]}:{content:[{type:"text",text:`Configured TaskBots:
316
316
  ${n.map(s=>`- ${s}`).join(`
317
- `)}`}]}}if(e==="trigger_taskbot"||e==="trigger_taskbot_with_data"){let n=String(r?.botName),s=o[n];if(!s)throw new Error(`Bot '${n}' not found in configuration. Use list_taskbots to see available bots.`);let i=e==="trigger_taskbot_with_data",a=i?r?.payload:null,c={method:i?"POST":"GET",headers:i?{"Content-Type":"application/json"}:void 0,body:i?JSON.stringify(a):void 0},u=await fetch(s,c),l=await u.text();return{content:[{type:"text",text:`Successfully triggered ${n}.
317
+ `)}`}]}}if(e==="trigger_taskbot"||e==="trigger_taskbot_with_data"){let n=String(r?.botName),s=o[n];if(!s)throw new Error(`Bot '${n}' not found in configuration. Use list_taskbots to see available bots.`);let i=e==="trigger_taskbot_with_data",a=i?r?.payload:null,c={method:i?"POST":"GET",headers:i?{"Content-Type":"application/json"}:void 0,body:i?JSON.stringify(a):void 0,signal:AbortSignal.timeout(15e3)},u=await fetch(s,c),l=await u.text();return{content:[{type:"text",text:`Successfully triggered ${n}.
318
318
  Status: ${u.status}
319
- Response: ${l}`}]}}if(e==="trigger_webhook_url"){let n=String(r?.url),s=r?.payload,i={method:s?"POST":"GET",headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0},a=await fetch(n,i),c=await a.text();return{content:[{type:"text",text:`Successfully triggered webhook.
319
+ Response: ${l}`}]}}if(e==="trigger_webhook_url"){let n=String(r?.url),s=r?.payload;if(!n.startsWith("https://hook.zerowork.io/"))throw new Error("Security Policy Violation: Arbitrary webhook URLs are not permitted. Only official ZeroWork webhooks (https://hook.zerowork.io/...) may be triggered.");let i={method:s?"POST":"GET",headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0,signal:AbortSignal.timeout(15e3)},a=await fetch(n,i),c=await a.text();return{content:[{type:"text",text:`Successfully triggered webhook.
320
320
  Status: ${a.status}
321
321
  Response: ${c}`}]}}if(e==="generate_robust_selector"){let n=String(r?.htmlSnippet||""),s=r?.targetText?String(r.targetText):null,i=r?.description?String(r.description):null,a=`### ZeroWork Robust Selector Analysis
322
322
 
@@ -351,7 +351,7 @@ ${n.slice(0,500)}${n.length>500?`
351
351
  ... (truncated)`:""}
352
352
  \`\`\`
353
353
 
354
- `,a+="*Guidance*: Use the strategies above to construct your selector in ZeroWork. Test the selector in your browser console using `document.querySelectorAll('your-selector')` to verify uniqueness before adding it to your TaskBot.",{content:[{type:"text",text:a}]}}if(e==="get_mcp_version")return{content:[{type:"text",text:"nagoc-zerowork version 1.1.5"}]};if(e==="search_zerowork_tutorials"){let n=String(r?.query||"");if(!n)throw new Error("The 'query' parameter is required.");let s=Ha();if(s.length===0)return{content:[{type:"text",text:"No video tutorial subtitles found. Please check that subtitle files are bundled correctly."}]};let i=n.toLowerCase(),a=i.split(/\s+/).filter(d=>d.length>1),c=s.map(d=>{let p=0,f=d.title.toLowerCase(),m=d.content.toLowerCase();return f.includes(i)&&(p+=10),m.includes(i)&&(p+=5),a.forEach(_=>{f.includes(_)&&(p+=3);let y=m.match(new RegExp(_,"g"));y&&(p+=y.length)}),{tutorial:d,score:p}}).filter(d=>d.score>0).sort((d,p)=>p.score-d.score);if(c.length===0)return{content:[{type:"text",text:`No tutorial subtitles matched the query "${n}". Try searching with different keywords or use search_zerowork_docs for official written documentation.`}]};let u=c.slice(0,5),l=`### \u{1F3AC} ZeroWork Video Tutorial Search Results
354
+ `,a+="*Guidance*: Use the strategies above to construct your selector in ZeroWork. Test the selector in your browser console using `document.querySelectorAll('your-selector')` to verify uniqueness before adding it to your TaskBot.",{content:[{type:"text",text:a}]}}if(e==="get_mcp_version")return{content:[{type:"text",text:"nagoc-zerowork version 1.1.6"}]};if(e==="search_zerowork_tutorials"){let n=String(r?.query||"");if(!n)throw new Error("The 'query' parameter is required.");let s=Ha();if(s.length===0)return{content:[{type:"text",text:"No video tutorial subtitles found. Please check that subtitle files are bundled correctly."}]};let i=n.toLowerCase(),a=i.split(/\s+/).filter(d=>d.length>1),c=s.map(d=>{let p=0,f=d.title.toLowerCase(),m=d.content.toLowerCase();return f.includes(i)&&(p+=10),m.includes(i)&&(p+=5),a.forEach(_=>{f.includes(_)&&(p+=3);let y=m.match(new RegExp(_,"g"));y&&(p+=y.length)}),{tutorial:d,score:p}}).filter(d=>d.score>0).sort((d,p)=>p.score-d.score);if(c.length===0)return{content:[{type:"text",text:`No tutorial subtitles matched the query "${n}". Try searching with different keywords or use search_zerowork_docs for official written documentation.`}]};let u=c.slice(0,5),l=`### \u{1F3AC} ZeroWork Video Tutorial Search Results
355
355
 
356
356
  *Crawled from official video masterclasses and automation guides*
357
357
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nagoc-zerowork",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "An MCP Server for ZeroWork.io — trigger TaskBots, send dynamic data via webhooks, and get full ZeroWork documentation",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",