@buoy-gg/mcp 7.0.79 → 7.0.81
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/chunk-2GUL4POJ.mjs +986 -0
- package/dist/{chunk-3FTJ74HL.mjs → chunk-IDYAVQKW.mjs} +1 -1
- package/dist/{chunk-MR4NVULE.mjs → chunk-OHNYG34R.mjs} +1 -1
- package/dist/{chunk-SGVMY5TU.mjs → chunk-TMEMTQ45.mjs} +1 -1
- package/dist/cli.js +161 -155
- package/dist/cli.mjs +4 -4
- package/dist/{flowRun-4VU3KXYX.mjs → flowRun-V4HHLFX2.mjs} +1 -1
- package/dist/index.js +139 -133
- package/dist/index.mjs +1 -1
- package/dist/{init-6ANI6DIF.mjs → init-L5TIZUWZ.mjs} +1 -1
- package/dist/{main-XP2I2BCD.mjs → main-YZO2NLH5.mjs} +2 -2
- package/package.json +4 -4
- package/dist/chunk-HZEASQD3.mjs +0 -980
package/dist/cli.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as S}from"module";const I=S(import.meta.url);import{createMcpServer as R,stopAllHidStreamsNow as B,stopAllRecordingsNow as k}from"./chunk-
|
|
2
|
+
import{createRequire as S}from"module";const I=S(import.meta.url);import{createMcpServer as R,stopAllHidStreamsNow as B,stopAllRecordingsNow as k}from"./chunk-2GUL4POJ.mjs";import"./chunk-DVRR7W22.mjs";import{runInit as O}from"./chunk-IDYAVQKW.mjs";import"./chunk-TMEMTQ45.mjs";import{SyncClient as b,stopNativeProfiles as P}from"./chunk-TMN3LXKB.mjs";import"./chunk-5XATNNKY.mjs";import"./chunk-FYJWWTAC.mjs";import"./chunk-5NOZVPWB.mjs";import"./chunk-D5K6WO6B.mjs";import"./chunk-OP23W722.mjs";import"./chunk-MTTWR4T7.mjs";import{StdioServerTransport as T}from"@modelcontextprotocol/sdk/server/stdio.js";var $=console.log;console.log=(...e)=>console.error(...e);console.info=(...e)=>console.error(...e);console.debug=(...e)=>console.error(...e);async function E(){const e=process.env.BUOY_BROKER_PORT;const r=new b({url:process.env.BUOY_BROKER_URL,port:e?Number(e):void 0,autoSpawnBroker:process.env.BUOY_NO_SPAWN!=="1"});const n=R(r);const t=new T;let c=false;const o=s=>{if(c)return;c=true;process.stderr.write(`[buoy-mcp] shutting down (${s})
|
|
3
3
|
`);k();B();setTimeout(()=>process.exit(0),2e3).unref();void(async()=>{await P();await r.stop().catch(()=>{});await n.close().catch(()=>{});process.exit(0)})()};process.stdin.once("end",()=>o("stdin closed"));process.stdin.once("close",()=>o("stdin closed"));n.server.onclose=()=>o("transport closed");process.on("SIGINT",()=>o("SIGINT"));process.on("SIGTERM",()=>o("SIGTERM"));process.on("SIGHUP",()=>o("SIGHUP"));await n.connect(t);process.stderr.write(`[buoy-mcp] serving MCP over stdio; connecting to broker\u2026
|
|
4
4
|
`);r.start().then(s=>process.stderr.write(`[buoy-mcp] broker ${s}
|
|
5
5
|
`)).catch(s=>process.stderr.write(`[buoy-mcp] broker connection failed: ${s?.message??s} \u2014 tools will report no devices until it recovers
|
|
6
|
-
`))}async function N(){const e=process.env.BUOY_BROKER_PORT;const r=new b({url:process.env.BUOY_BROKER_URL,port:e?Number(e):void 0,autoSpawnBroker:false});const{hasProAccess:n}=await import("./policy-UNODNYFR.mjs");try{const t=await Promise.race([r.start().then(()=>true,()=>false),new Promise(o=>setTimeout(()=>o(false),4e3))]);if(!t)return{account:false,pro:false};let c=r.isAdmitted();for(let o=0;o<10;o++){const s=r.connectedDevices();if(s.some(i=>n(i)))return{account:true,pro:true};c||=s.some(i=>i.tier==="free");await new Promise(i=>setTimeout(i,300))}return{account:c,pro:false}}finally{await Promise.race([r.stop().catch(()=>{}),new Promise(t=>setTimeout(t,2e3))])}}if(process.argv[2]==="web"){void import("./main-
|
|
6
|
+
`))}async function N(){const e=process.env.BUOY_BROKER_PORT;const r=new b({url:process.env.BUOY_BROKER_URL,port:e?Number(e):void 0,autoSpawnBroker:false});const{hasProAccess:n}=await import("./policy-UNODNYFR.mjs");try{const t=await Promise.race([r.start().then(()=>true,()=>false),new Promise(o=>setTimeout(()=>o(false),4e3))]);if(!t)return{account:false,pro:false};let c=r.isAdmitted();for(let o=0;o<10;o++){const s=r.connectedDevices();if(s.some(i=>n(i)))return{account:true,pro:true};c||=s.some(i=>i.tier==="free");await new Promise(i=>setTimeout(i,300))}return{account:c,pro:false}}finally{await Promise.race([r.stop().catch(()=>{}),new Promise(t=>setTimeout(t,2e3))])}}if(process.argv[2]==="web"){void import("./main-YZO2NLH5.mjs").then(e=>e.runWebServer()).catch(e=>{process.stderr.write(`[buoy-web] fatal: ${e?.message??e}
|
|
7
7
|
`);process.exit(1)})}else if(process.argv[2]==="web-bench"){void(async()=>{try{const e=process.argv.slice(3);const r=e.find(a=>!a.startsWith("--"));if(!r)throw new Error("usage: buoy-mcp web-bench <config.json> [--json]");const{readFileSync:n}=await import("fs");const{runWebBench:t,formatWebBenchMarkdown:c}=await import("./webBench-BEMJWKB3.mjs");const{readEntitlement:o,entitlementHasPro:s}=await import("./camera-6HTJDU4Y.mjs");const{freeWebBench:i,lockedLines:y,nothingLocked:h}=await import("./freeView-3LHV3RBG.mjs");const l=o();const m=s(l)?{account:true,pro:true}:await N();const d=s(l)||m.pro;if(!l.admitted&&!m.account){throw new Error("web-bench needs a Buoy account. A free one works. Sign in to Buoy Desktop, or run `npx --package=@buoy-gg/core buoy login` in the project.")}const p=JSON.parse(n(r,"utf8"));if(p.traceDir&&!d)throw new Error("traceDir (Chrome traces) needs Buoy Pro. See https://buoy.gg/pricing.");let w=h();const u=await t({...p,durationMs:p.durationMs??p.perCaseDurationMs,redact:d?void 0:a=>{const v=i(a);w=v.locked;return v.result}},a=>process.stderr.write(`[web-bench] ${a}
|
|
8
8
|
`));const f=y(w);if(f)process.stderr.write(`${f}
|
|
9
9
|
`);const g=u.status==="failed"||u.browserLeftRunning?1:0;const x=(e.includes("--json")?JSON.stringify(u,null,2):c(u))+"\n";setTimeout(()=>process.exit(g),5e3).unref();process.stdout.write(x,()=>process.exit(g))}catch(e){process.stderr.write(`[buoy-mcp] web-bench failed: ${e?.message??e}
|
|
10
|
-
`,()=>process.exit(1));setTimeout(()=>process.exit(1),5e3).unref()}})()}else if(process.argv[2]==="flow"&&process.argv[3]==="run"){void(async()=>{try{const{parseFlowRunArgs:e,runFlows:r,formatFlowResults:n}=await import("./flowRun-
|
|
10
|
+
`,()=>process.exit(1));setTimeout(()=>process.exit(1),5e3).unref()}})()}else if(process.argv[2]==="flow"&&process.argv[3]==="run"){void(async()=>{try{const{parseFlowRunArgs:e,runFlows:r,formatFlowResults:n}=await import("./flowRun-V4HHLFX2.mjs");const t=e(process.argv.slice(4));const c=await r(t);const o=t.json?JSON.stringify(c,null,2):n(c);const s=c.every(i=>i.passed)?0:1;setTimeout(()=>process.exit(s),5e3).unref();process.stdout.write(`${o}
|
|
11
11
|
`,()=>process.exit(s))}catch(e){process.stderr.write(`[buoy-mcp] flow run failed: ${e?.message??e}
|
|
12
12
|
`,()=>process.exit(1));setTimeout(()=>process.exit(1),5e3).unref()}})()}else if(process.argv[2]==="farm"){console.log=$;void import("./src-HRUK7GEE.mjs").then(e=>e.runFarmCommand(process.argv.slice(3),{prog:"npx @buoy-gg/mcp farm",entry:process.argv[1],chromeKeeperArgs:["farm","chrome","keeper"]})).catch(e=>{const r=e;process.stderr.write(`${r?.message??e}${r?.next?`
|
|
13
13
|
${r.next}`:""}
|
|
14
14
|
`);process.exit(1)})}else if(process.argv[2]==="farmd"){void import("./simFarm-AWVHVU6A.mjs").then(e=>e.runFarmd()).catch(e=>{process.stderr.write(`[buoy-mcp] farmd failed: ${e?.message??e}
|
|
15
|
-
`);process.exit(1)})}else if(process.argv[2]==="init"){void(async()=>{try{const e=process.argv.slice(3);let r="auto";if(e.includes("--local"))r="local";else if(e.includes("--npx"))r="npx";const n=e.indexOf("--registry");const t=n!==-1?e[n+1]:void 0;if(e.includes("--web")){const{runWebInit:c}=await import("./init-
|
|
15
|
+
`);process.exit(1)})}else if(process.argv[2]==="init"){void(async()=>{try{const e=process.argv.slice(3);let r="auto";if(e.includes("--local"))r="local";else if(e.includes("--npx"))r="npx";const n=e.indexOf("--registry");const t=n!==-1?e[n+1]:void 0;if(e.includes("--web")){const{runWebInit:c}=await import("./init-L5TIZUWZ.mjs");c({mode:r,registry:t})}else O({mode:r,registry:t});process.exit(0)}catch(e){process.stderr.write(`[buoy-mcp] init failed: ${e?.message??e}
|
|
16
16
|
`);process.exit(1)}})()}else{E().catch(e=>{process.stderr.write(`[buoy-mcp] fatal: ${e?.message??e}
|
|
17
17
|
`);process.exit(1)})}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as v}from"module";const E=v(import.meta.url);import{createMcpServer as y}from"./chunk-
|
|
1
|
+
import{createRequire as v}from"module";const E=v(import.meta.url);import{createMcpServer as y}from"./chunk-2GUL4POJ.mjs";import"./chunk-DVRR7W22.mjs";import"./chunk-TMEMTQ45.mjs";import{SyncClient as R}from"./chunk-TMN3LXKB.mjs";import"./chunk-5XATNNKY.mjs";import"./chunk-FYJWWTAC.mjs";import"./chunk-5NOZVPWB.mjs";import"./chunk-D5K6WO6B.mjs";import"./chunk-OP23W722.mjs";import"./chunk-MTTWR4T7.mjs";import{promises as S}from"fs";import $ from"path";import{Client as _}from"@modelcontextprotocol/sdk/client/index.js";import{InMemoryTransport as B}from"@modelcontextprotocol/sdk/inMemory.js";function I(e){const o={names:[]};for(let n=0;n<e.length;n++){const t=e[n];if(t==="--device")o.deviceId=e[++n];else if(t==="--update-snapshots")o.updateSnapshots=true;else if(t==="--json")o.json=true;else if(t==="--wait")o.waitMs=Number(e[++n])*1e3;else if(t==="--all")continue;else if(!t.startsWith("--"))o.names.push(t);else throw new Error(`Unknown option ${t}.`)}return o}async function P(){const e=$.join(process.cwd(),".buoy","flows");return(await S.readdir(e).catch(()=>[])).filter(o=>o.endsWith(".json")).map(o=>o.replace(/\.json$/,"")).sort()}async function g(e,o=n=>process.stderr.write(`${n}
|
|
2
2
|
`)){const n=e.names.length?e.names:await P();if(n.length===0)throw new Error('No saved flows. Save one with run_flow and save:"name", or pass a flow name.');const t=process.env.BUOY_BROKER_PORT;const s=new R({url:process.env.BUOY_BROKER_URL,port:t?Number(t):void 0,autoSpawnBroker:process.env.BUOY_NO_SPAWN!=="1"});const w=y(s);const[d,f]=B.createLinkedPair();const i=new _({name:"buoy-flow-run",version:"1"});try{await w.connect(f);await i.connect(d);await s.start();const a=Date.now()+(e.waitMs??6e4);while(Date.now()<a&&!s.connectedDevices().some(r=>(r.isPro||r.tier==="free")&&(!e.deviceId||r.deviceId===e.deviceId))){await new Promise(r=>setTimeout(r,500))}if(!s.connectedDevices().some(r=>r.isPro||r.tier==="free")){throw new Error("No app on a Buoy account is connected. Start the app (with Buoy) on a simulator or device, then run again.")}const m=[];for(const r of n){const p=Date.now();o(`\u25B6 ${r}`);const u=await i.callTool({name:"run_flow",arguments:{flow:r,include:"none",...e.deviceId?{deviceId:e.deviceId}:{},...e.updateSnapshots?{updateSnapshots:true}:{}}},void 0,{timeout:10*6e4});const h=(u.content??[]).filter(c=>c.type==="text").map(c=>c.text).join("\n");const l=u.isError!==true;m.push({name:r,passed:l,ms:Date.now()-p,report:h});o(`${l?"\u2713":"\u2717"} ${r} (${((Date.now()-p)/1e3).toFixed(1)}s)`)}return m}finally{await i.close().catch(()=>void 0);await Promise.race([s.stop().catch(()=>void 0),new Promise(a=>setTimeout(a,2e3))])}}function j(e){const o=e.filter(t=>!t.passed);const n=[`${e.length-o.length} of ${e.length} flows passed.`];for(const t of o){n.push("",`\u2717 ${t.name}`,t.report.trim(),` Rerun: npx @buoy-gg/mcp flow run ${t.name}`)}return n.join("\n")}export{j as formatFlowResults,I as parseFlowRunArgs,g as runFlows};
|