@shiplightai/mcp 0.1.49 → 0.1.50
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/{agentHelpers-242MN5TR-AK52N3RJ.js → agentHelpers-ZEELTQHQ-7LTM7RPI.js} +1 -1
- package/dist/agentLogin-JJ76YIVR-ODLFUWNL.js +4 -0
- package/dist/{chunk-JT3U4KNR.js → chunk-2BZVD336.js} +1 -1
- package/dist/{chunk-HQNPMIQW.js → chunk-4DIUHKFB.js} +2 -2
- package/dist/{chunk-ORSFJVJL.js → chunk-5GG34OWS.js} +3 -3
- package/dist/chunk-HBXQFJ2K.js +4 -0
- package/dist/{chunk-GZSLCYQ7.js → chunk-KI54PAOH.js} +28 -28
- package/dist/chunk-OZ36UVHR.js +3999 -0
- package/dist/{chunk-Z3E7FIDS.js → chunk-UBUBM7F7.js} +1 -1
- package/dist/{chunk-AFEFEPKR.js → chunk-VBI4DDSS.js} +1 -1
- package/dist/{chunk-PFLXO7G4.js → chunk-X5NUVPAF.js} +1 -1
- package/dist/{chunk-KW4N7WFX.js → chunk-XWDTDVL5.js} +4 -4
- package/dist/{chunk-RSM4LZ5P.js → chunk-Y64TKFRF.js} +3203 -3203
- package/dist/dist-FVIJHOEK.js +4 -0
- package/dist/dist-T3EAKPBA.js +4 -0
- package/dist/{handler-2DVP4PMD-IFR4HH7D.js → handler-QSEXJ3YG-BK26HZ5S.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/relayBrowserCache-QL6LD4JJ-RCZSXWM6.js +4 -0
- package/dist/server-SF3CTCCU.js +22 -0
- package/dist/{task-2JIXKMIY-CMX3BD6Z.js → task-5N7K2U7O-UX3BL63L.js} +1 -1
- package/package.json +1 -1
- package/dist/agentLogin-VLDCPI66-52P67BMY.js +0 -4
- package/dist/chunk-34YV5HSR.js +0 -3999
- package/dist/chunk-JKHKVGEC.js +0 -4
- package/dist/dist-VVPHZ43R.js +0 -4
- package/dist/dist-YNN5UBVC.js +0 -4
- package/dist/relayBrowserCache-QL6LD4JJ-TKU47MOI.js +0 -4
- package/dist/server-KGF6BY7H.js +0 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "module";
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{b as i}from"./chunk-
|
|
4
|
+
import{b as i}from"./chunk-HBXQFJ2K.js";import{createRequire as r}from"module";import{appendFileSync as s}from"fs";var $=r(import.meta.url),g=class{constructor(){this.initialized=!1}init(){if(this.initialized)return;let o=i().agentLogPath;if(o)try{s(o,`
|
|
5
5
|
=== Agent Execution Log ===
|
|
6
6
|
Started: ${new Date().toISOString()}
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "module";
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{
|
|
4
|
+
import{d as e}from"./chunk-HBXQFJ2K.js";import{chromium as f}from"playwright";var n=null,t=null;function u(c){return c.replace(/\/$/,"")}async function y(c){let l=u(c);return n?.cdpUrl===l?(e.info("[RelayCache] Reusing cached Browser connection"),n.browser):t?(e.info("[RelayCache] Waiting for in-progress connection..."),await t):(t=(async()=>{let i;for(let r=0;r<3;r++)try{e.info(`[RelayCache] Connecting to CDP (attempt ${r+1})...`);let o=await f.connectOverCDP(l,{timeout:6e4});e.info("[RelayCache] Connected to CDP successfully");let a=()=>{n?.browser===o&&(e.info("[RelayCache] Browser disconnected, clearing cache"),n=null)};return n={browser:o,cdpUrl:l,onDisconnected:a},o.on("disconnected",a),e.info("[RelayCache] Cached Browser connection for future reuse"),o}catch(s){i=s;let o=250+r*250;e.warn(`[RelayCache] Connection attempt ${r+1} failed, retrying in ${o}ms...`),await new Promise(a=>setTimeout(a,o))}throw e.error("[RelayCache] All connection attempts failed:",i),i instanceof Error?i:new Error("CDP connect failed")})().finally(()=>{t=null}),await t)}function w(){if(!n){e.info("[RelayCache] No cached connection to disconnect");return}let c=n;n=null,t=null,c.onDisconnected&&typeof c.browser.off=="function"&&c.browser.off("disconnected",c.onDisconnected),e.info("[RelayCache] Force disconnecting Browser"),c.browser.close().catch(()=>{})}function m(){return{hasCached:n!==null,cdpUrl:n?.cdpUrl}}export{y as a,w as b,m as c};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "module";
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{
|
|
4
|
+
import{d as o,e as h,f as g}from"./chunk-HBXQFJ2K.js";import{createRequire as x}from"module";var S=x(import.meta.url),b={};g(b,{ACTION_TIMEOUT:()=>f,GOTO_TIMEOUT:()=>w,LOCATOR_TIMEOUT:()=>c,getActionTimeoutMs:()=>_,getFrameContext:()=>d,getLocator:()=>O,getMinimalActionEntity:()=>E,getPageLocatorExpression:()=>$,sanitizeForComment:()=>L});function _(e,t){return t??e?.getActionSettings()?.action_timeout_ms??f}function L(e){return e.replace(/\r\n/g," ").replace(/\n/g," ").replace(/\r/g," ").trim()}function O(e,t){let a=$(t);return a?new Function("page",`return ${a}`)(e):null}async function d(e,t=[]){let a=e;for(let l of t){let n=await a.locator(l).elementHandle();if(!n)return null;let r=await n.contentFrame();if(await n.dispose(),!r)return null;a=r}return a}function E(e){let t={action_data:e.action_data};return e.locator&&(t.locator=e.locator),e.xpath&&(t.xpath=e.xpath),e.frame_path&&(t.frame_path=e.frame_path),t}function T(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function W(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function $(e){let t=T(e),a=e.locator;if(typeof a=="string"&&a.trim())return a=a.trim(),a.endsWith("first()")?`${t}.${a}`:`${t}.${a}.first()`;let l=W(e);if(l){let n=JSON.stringify(l);return`${t}.locator(${n}).first()`}return null}var c,f,w,v=h(()=>{c=5e3,f=5e3,w=2e4});v();async function y(e,t,a=[],l=[]){try{let n=await d(e,a);if(!n)return o.warn(`Could not find frame context for xpath: ${t}`),null;let r=null;if(l.length>0){let s=l[0];if(!s)return o.warn(`Missing shadow host xpath for element: ${t}`),null;let u=n.locator(`xpath=${m(s)}`),p=C(t);if(r=await(p?u.locator(`css=${p}`):u.locator(`xpath=${m(t)}`)).elementHandle({timeout:c}),!r)return o.warn(`Could not find shadow DOM element with xpath: ${t}`),null}else if(r=await n.locator(`xpath=${t}`).elementHandle({timeout:c}),!r)return o.warn(`Could not find element with xpath: ${t}`),null;let i=await n.evaluate(s=>typeof playwright<"u"&&playwright.generateLocator?playwright.generateLocator(s):null,r);return await r.dispose(),i?(o.debug(`Generated locator for ${t}: ${i}`),i):(o.debug("playwright.generateLocator is not available (PWDEBUG=console not set), using xpath fallback"),null)}catch(n){return o.error(`Error in pickBestLocator: ${n}`),null}}async function q(e,t){try{let a=await(await t.ownerFrame()??e).evaluate(l=>typeof playwright<"u"&&playwright.generateLocator?playwright.generateLocator(l):null,t);return await t.dispose(),a?(o.debug(`Generated locator: ${a}`),a):(o.debug("playwright.generateLocator is not available (PWDEBUG=console not set), using xpath fallback"),null)}catch(a){return o.error(`Error in pickBestLocator: ${a}`),null}}async function F(e,t){let a=new Map;return await Promise.all(t.map(async l=>{let n=await y(e,l);a.set(l,n)})),a}function m(e){let t=e.trim();return t.startsWith("/")||t.startsWith("(")||t.startsWith(".")?t:`//${t}`}function C(e){let t=e.trim().replace(/^\/+/,"");if(!t)return null;let a=t.split("/").filter(Boolean),l=[];for(let n of a){let r=n.match(/^([a-zA-Z][\w-]*)(?:\[(\d+)\])?$/);if(!r)return null;let i=r[1].toLowerCase(),s=r[2]?`:nth-of-type(${r[2]})`:"";l.push(`${i}${s}`)}return l.join(" > ")}async function H(e,t){if(t<0)return;let{page:a,domService:l}=e;return(e.domState||await l.getClickableElements(a)).selectorMap.get(t)}function M(e){let t=e.split("/").filter(n=>n);if(t.length===0)return"*";let a=t[t.length-1],l=a.match(/^(\w+)(?:\[(\d+)\])?$/);if(l){let[,n,r]=l;return r?`${n}:nth-of-type(${r})`:n}return a}function A(e,t=!0){try{let a=M(e.xpath);if(e.attributes.class&&t){let n=/^[a-zA-Z_][a-zA-Z0-9_-]*$/,r=e.attributes.class.split(/\s+/);for(let i of r)i.trim()&&n.test(i)&&(a+=`.${i}`)}let l=new Set(["id","name","type","placeholder","aria-label","aria-labelledby","aria-describedby","role","for","autocomplete","required","readonly","alt","title","target"]);t&&["data-id","data-qa","data-cy","data-testid","data-handlepos"].forEach(n=>l.add(n));for(let[n,r]of Object.entries(e.attributes)){if(n==="class"||!n.trim()||!l.has(n))continue;let i=n.replace(/:/g,"\\:");if(r==="")a+=`[${i}]`;else if(/["'<>`\n\r\t]/.test(r)){let s=r;r.includes(`
|
|
5
5
|
`)&&(s=r.split(`
|
|
6
6
|
`)[0]),s=s.replace(/\s+/g," ").trim();let u=s.replace(/"/g,'\\"');a+=`[${i}*="${u}"]`}else a+=`[${i}="${r}"]`}return a}catch{return`${e.tagName||"*"}[highlight_index='${e.highlightIndex}']`}}function k(e){let t=e.attributes;if(t.title)return`iframe[title="${t.title.replace(/"/g,'\\"')}"]`;if(t.id)return`iframe#${t.id}`;if(t.name)return`iframe[name="${t.name.replace(/"/g,'\\"')}"]`;if(t.src){try{let a=new URL(t.src);if(a.protocol==="chrome-extension:")return`iframe[src^="${a.origin}"]`}catch{}return`iframe[src="${t.src.replace(/"/g,'\\"')}"]`}return A(e,!1)}function B(e){let t=[],a=e;for(;a&&a.parent!==null;){let r=a.parent;t.push(r),a=r}t.reverse();let l=[],n=t.filter(r=>r.tagName==="iframe");for(let r of n){let i=k(r);o.debug("[frame-path] iframe attrs:",JSON.stringify(r.attributes),"\u2192",i),l.push(i)}return l}async function I(e,t){let a=null,l=B(t);return t.xpath&&(a=await y(e,t.xpath,l,t.shadowHostXPaths??[])),{locator:a||void 0,xpath:t.xpath,frame_path:l}}export{b as a,_ as b,O as c,$ as d,w as e,v as f,y as g,q as h,F as i,H as j,B as k,I as l};
|