@shiplightai/mcp 0.1.57 → 0.1.58

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.
@@ -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 Me,c as Kt,d as Jt,l as at,n as it,o as ot}from"./chunk-KG3IU2VV.js";import{a as le}from"./chunk-UBUBM7F7.js";import{h as Xs,l as Vs}from"./chunk-X5NUVPAF.js";import{b as Js,d as zt}from"./chunk-HBXQFJ2K.js";import{createRequire as pa}from"module";import{ZodFirstPartyTypeKind as A}from"zod/v3";import{ZodFirstPartyTypeKind as ya}from"zod/v3";import{ZodFirstPartyTypeKind as De}from"zod/v3";import{z as mt}from"zod";import{z as gt}from"zod";var Eo=pa(import.meta.url),fa=Symbol("Let zodToJsonSchema decide on which parser to use"),Ys={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},ma=e=>typeof e=="string"?{...Ys,name:e}:{...Ys,...e},ga=e=>{let t=ma(e),s=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:s,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function In(e,t,s,n){n?.errorMessages&&s&&(e.errorMessage={...e.errorMessage,[t]:s})}function E(e,t,s,n,r){e[t]=s,In(e,t,n,r)}var Tn=(e,t)=>{let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];s++);return[(e.length-s).toString(),...t.slice(s)].join("/")};function V(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Tn(t,e.currentPath):t.join("/")}}function ba(e,t){let s={type:"array"};return e.type?._def&&e.type?._def?.typeName!==ya.ZodAny&&(s.items=T(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&E(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&E(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(E(s,"minItems",e.exactLength.value,e.exactLength.message,t),E(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}function wa(e,t){let s={type:"integer",format:"int64"};if(!e.checks)return s;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?E(s,"minimum",n.value,n.message,t):E(s,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(s.exclusiveMinimum=!0),E(s,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?E(s,"maximum",n.value,n.message,t):E(s,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(s.exclusiveMaximum=!0),E(s,"maximum",n.value,n.message,t));break;case"multipleOf":E(s,"multipleOf",n.value,n.message,t);break}return s}function _a(){return{type:"boolean"}}function Pn(e,t){return T(e.type._def,t)}var va=(e,t)=>T(e.innerType._def,t);function En(e,t,s){let n=s??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((r,a)=>En(e,t,r))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return xa(e,t)}}var xa=(e,t)=>{let s={type:"integer",format:"unix-time"};if(t.target==="openApi3")return s;for(let n of e.checks)switch(n.kind){case"min":E(s,"minimum",n.value,n.message,t);break;case"max":E(s,"maximum",n.value,n.message,t);break}return s};function Sa(e,t){return{...T(e.innerType._def,t),default:e.defaultValue()}}function Aa(e,t){return t.effectStrategy==="input"?T(e.schema._def,t):V(t)}function ka(e){return{type:"string",enum:Array.from(e.values)}}var $a=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Oa(e,t){let s=[T(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),T(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(a=>!!a),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return s.forEach(a=>{if($a(a))r.push(...a.allOf),a.unevaluatedProperties===void 0&&(n=void 0);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:o,...l}=a;i=l}else n=void 0;r.push(i)}}),r.length?{allOf:r,...n}:void 0}function Ia(e,t){let s=typeof e.value;return s!=="bigint"&&s!=="number"&&s!=="boolean"&&s!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:s==="bigint"?"integer":s,enum:[e.value]}:{type:s==="bigint"?"integer":s,const:e.value}}var Xt,ae={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Xt===void 0&&(Xt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xt),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Rn(e,t){let s={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":E(s,"minLength",typeof s.minLength=="number"?Math.max(s.minLength,n.value):n.value,n.message,t);break;case"max":E(s,"maxLength",typeof s.maxLength=="number"?Math.min(s.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":ie(s,"email",n.message,t);break;case"format:idn-email":ie(s,"idn-email",n.message,t);break;case"pattern:zod":K(s,ae.email,n.message,t);break}break;case"url":ie(s,"uri",n.message,t);break;case"uuid":ie(s,"uuid",n.message,t);break;case"regex":K(s,n.regex,n.message,t);break;case"cuid":K(s,ae.cuid,n.message,t);break;case"cuid2":K(s,ae.cuid2,n.message,t);break;case"startsWith":K(s,RegExp(`^${Vt(n.value,t)}`),n.message,t);break;case"endsWith":K(s,RegExp(`${Vt(n.value,t)}$`),n.message,t);break;case"datetime":ie(s,"date-time",n.message,t);break;case"date":ie(s,"date",n.message,t);break;case"time":ie(s,"time",n.message,t);break;case"duration":ie(s,"duration",n.message,t);break;case"length":E(s,"minLength",typeof s.minLength=="number"?Math.max(s.minLength,n.value):n.value,n.message,t),E(s,"maxLength",typeof s.maxLength=="number"?Math.min(s.maxLength,n.value):n.value,n.message,t);break;case"includes":{K(s,RegExp(Vt(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&ie(s,"ipv4",n.message,t),n.version!=="v4"&&ie(s,"ipv6",n.message,t);break}case"base64url":K(s,ae.base64url,n.message,t);break;case"jwt":K(s,ae.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&K(s,ae.ipv4Cidr,n.message,t),n.version!=="v4"&&K(s,ae.ipv6Cidr,n.message,t);break}case"emoji":K(s,ae.emoji(),n.message,t);break;case"ulid":{K(s,ae.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{ie(s,"binary",n.message,t);break}case"contentEncoding:base64":{E(s,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{K(s,ae.base64,n.message,t);break}}break}case"nanoid":K(s,ae.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return s}function Vt(e,t){return t.patternStrategy==="escape"?Pa(e):e}var Ta=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Pa(e){let t="";for(let s=0;s<e.length;s++)Ta.has(e[s])||(t+="\\"),t+=e[s];return t}function ie(e,t,s,n){e.format||e.anyOf?.some(r=>r.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...s&&n.errorMessages&&{errorMessage:{format:s}}})):E(e,"format",t,s,n)}function K(e,t,s,n){e.pattern||e.allOf?.some(r=>r.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:Gs(t,n),...s&&n.errorMessages&&{errorMessage:{pattern:s}}})):E(e,"pattern",Gs(t,n),s,n)}function Gs(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let s={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=s.i?e.source.toLowerCase():e.source,r="",a=!1,i=!1,o=!1;for(let l=0;l<n.length;l++){if(a){r+=n[l],a=!1;continue}if(s.i){if(i){if(n[l].match(/[a-z]/)){o?(r+=n[l],r+=`${n[l-2]}-${n[l]}`.toUpperCase(),o=!1):n[l+1]==="-"&&n[l+2]?.match(/[a-z]/)?(r+=n[l],o=!0):r+=`${n[l]}${n[l].toUpperCase()}`;continue}}else if(n[l].match(/[a-z]/)){r+=`[${n[l]}${n[l].toUpperCase()}]`;continue}}if(s.m){if(n[l]==="^"){r+=`(^|(?<=[\r
4
+ import{b as Me,c as Kt,d as Jt,l as at,n as it,o as ot}from"./chunk-NEBLFLPV.js";import{a as le}from"./chunk-UBUBM7F7.js";import{h as Xs,l as Vs}from"./chunk-LATEXF4R.js";import{b as Js,d as zt}from"./chunk-HBXQFJ2K.js";import{createRequire as pa}from"module";import{ZodFirstPartyTypeKind as A}from"zod/v3";import{ZodFirstPartyTypeKind as ya}from"zod/v3";import{ZodFirstPartyTypeKind as De}from"zod/v3";import{z as mt}from"zod";import{z as gt}from"zod";var Eo=pa(import.meta.url),fa=Symbol("Let zodToJsonSchema decide on which parser to use"),Ys={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},ma=e=>typeof e=="string"?{...Ys,name:e}:{...Ys,...e},ga=e=>{let t=ma(e),s=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:s,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function In(e,t,s,n){n?.errorMessages&&s&&(e.errorMessage={...e.errorMessage,[t]:s})}function E(e,t,s,n,r){e[t]=s,In(e,t,n,r)}var Tn=(e,t)=>{let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];s++);return[(e.length-s).toString(),...t.slice(s)].join("/")};function V(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Tn(t,e.currentPath):t.join("/")}}function ba(e,t){let s={type:"array"};return e.type?._def&&e.type?._def?.typeName!==ya.ZodAny&&(s.items=T(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&E(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&E(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(E(s,"minItems",e.exactLength.value,e.exactLength.message,t),E(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}function wa(e,t){let s={type:"integer",format:"int64"};if(!e.checks)return s;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?E(s,"minimum",n.value,n.message,t):E(s,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(s.exclusiveMinimum=!0),E(s,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?E(s,"maximum",n.value,n.message,t):E(s,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(s.exclusiveMaximum=!0),E(s,"maximum",n.value,n.message,t));break;case"multipleOf":E(s,"multipleOf",n.value,n.message,t);break}return s}function _a(){return{type:"boolean"}}function Pn(e,t){return T(e.type._def,t)}var va=(e,t)=>T(e.innerType._def,t);function En(e,t,s){let n=s??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((r,a)=>En(e,t,r))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return xa(e,t)}}var xa=(e,t)=>{let s={type:"integer",format:"unix-time"};if(t.target==="openApi3")return s;for(let n of e.checks)switch(n.kind){case"min":E(s,"minimum",n.value,n.message,t);break;case"max":E(s,"maximum",n.value,n.message,t);break}return s};function Sa(e,t){return{...T(e.innerType._def,t),default:e.defaultValue()}}function Aa(e,t){return t.effectStrategy==="input"?T(e.schema._def,t):V(t)}function ka(e){return{type:"string",enum:Array.from(e.values)}}var $a=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Oa(e,t){let s=[T(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),T(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(a=>!!a),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return s.forEach(a=>{if($a(a))r.push(...a.allOf),a.unevaluatedProperties===void 0&&(n=void 0);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:o,...l}=a;i=l}else n=void 0;r.push(i)}}),r.length?{allOf:r,...n}:void 0}function Ia(e,t){let s=typeof e.value;return s!=="bigint"&&s!=="number"&&s!=="boolean"&&s!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:s==="bigint"?"integer":s,enum:[e.value]}:{type:s==="bigint"?"integer":s,const:e.value}}var Xt,ae={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Xt===void 0&&(Xt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xt),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Rn(e,t){let s={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":E(s,"minLength",typeof s.minLength=="number"?Math.max(s.minLength,n.value):n.value,n.message,t);break;case"max":E(s,"maxLength",typeof s.maxLength=="number"?Math.min(s.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":ie(s,"email",n.message,t);break;case"format:idn-email":ie(s,"idn-email",n.message,t);break;case"pattern:zod":K(s,ae.email,n.message,t);break}break;case"url":ie(s,"uri",n.message,t);break;case"uuid":ie(s,"uuid",n.message,t);break;case"regex":K(s,n.regex,n.message,t);break;case"cuid":K(s,ae.cuid,n.message,t);break;case"cuid2":K(s,ae.cuid2,n.message,t);break;case"startsWith":K(s,RegExp(`^${Vt(n.value,t)}`),n.message,t);break;case"endsWith":K(s,RegExp(`${Vt(n.value,t)}$`),n.message,t);break;case"datetime":ie(s,"date-time",n.message,t);break;case"date":ie(s,"date",n.message,t);break;case"time":ie(s,"time",n.message,t);break;case"duration":ie(s,"duration",n.message,t);break;case"length":E(s,"minLength",typeof s.minLength=="number"?Math.max(s.minLength,n.value):n.value,n.message,t),E(s,"maxLength",typeof s.maxLength=="number"?Math.min(s.maxLength,n.value):n.value,n.message,t);break;case"includes":{K(s,RegExp(Vt(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&ie(s,"ipv4",n.message,t),n.version!=="v4"&&ie(s,"ipv6",n.message,t);break}case"base64url":K(s,ae.base64url,n.message,t);break;case"jwt":K(s,ae.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&K(s,ae.ipv4Cidr,n.message,t),n.version!=="v4"&&K(s,ae.ipv6Cidr,n.message,t);break}case"emoji":K(s,ae.emoji(),n.message,t);break;case"ulid":{K(s,ae.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{ie(s,"binary",n.message,t);break}case"contentEncoding:base64":{E(s,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{K(s,ae.base64,n.message,t);break}}break}case"nanoid":K(s,ae.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return s}function Vt(e,t){return t.patternStrategy==="escape"?Pa(e):e}var Ta=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Pa(e){let t="";for(let s=0;s<e.length;s++)Ta.has(e[s])||(t+="\\"),t+=e[s];return t}function ie(e,t,s,n){e.format||e.anyOf?.some(r=>r.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...s&&n.errorMessages&&{errorMessage:{format:s}}})):E(e,"format",t,s,n)}function K(e,t,s,n){e.pattern||e.allOf?.some(r=>r.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:Gs(t,n),...s&&n.errorMessages&&{errorMessage:{pattern:s}}})):E(e,"pattern",Gs(t,n),s,n)}function Gs(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let s={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=s.i?e.source.toLowerCase():e.source,r="",a=!1,i=!1,o=!1;for(let l=0;l<n.length;l++){if(a){r+=n[l],a=!1;continue}if(s.i){if(i){if(n[l].match(/[a-z]/)){o?(r+=n[l],r+=`${n[l-2]}-${n[l]}`.toUpperCase(),o=!1):n[l+1]==="-"&&n[l+2]?.match(/[a-z]/)?(r+=n[l],o=!0):r+=`${n[l]}${n[l].toUpperCase()}`;continue}}else if(n[l].match(/[a-z]/)){r+=`[${n[l]}${n[l].toUpperCase()}]`;continue}}if(s.m){if(n[l]==="^"){r+=`(^|(?<=[\r
5
5
  ]))`;continue}else if(n[l]==="$"){r+=`($|(?=[\r
6
6
  ]))`;continue}}if(s.s&&n[l]==="."){r+=i?`${n[l]}\r
7
7
  `:`[${n[l]}\r
@@ -198,4 +198,4 @@ ${S}
198
198
 
199
199
  Today is ${k}. Current local time is ${I}.
200
200
  Based on the above information, please determine if the statement is true.
201
- `,O=await t.agentServices.retrieveKnowledges(e),P=[{type:"text",text:_}],N=0;if(i&&u&&u.length>0)for(let L of u)P.push({type:"image",image:L}),N++;else P.push({type:"image",image:f}),N=1;if(O&&O.length>0){let L=Ln(O,l);P.push(...L)}P.push({type:"text",text:R});let U=O?ti(O,l):0,G=N+U,$=Jt(a,G),Z=$o(),pe=await ot({model:Kt(a),system:Z,messages:[{role:"user",content:P}],output:it.object({schema:Ao}),temperature:0,providerOptions:$}),{conclusion:ne,explanation:Ae}=pe.output,we=JSON.stringify(pe.output,null,2),Le=[],fe=ua(pe.usage,a);fe&&Le.push(fe);let me=[{role:"user",content:P.map(L=>{if(L.type==="text")return{type:"text",text:L.text};if(L.type==="image"){let H=L.image,z=So(H);if(z)return{type:"image",file:z};let re=typeof H=="string"?H:"";return{type:"image",file:re.startsWith("data:")?re:`data:image/png;base64,${re}`}}return{type:"text",text:"[unknown content type]"}})}],ge={systemPrompt:Z,userPrompt:me,rawLlmResponse:we,screenshotWithSom:f,tokenUsages:Le,retrievedKnowledges:O&&O.length>0?O:void 0,elementTree:h};return{success:ne==="true",explanation:Ae,debugInfo:ge}}catch(i){return{success:!1,error:i.message}}}async function Io(e,t){try{if(!e.action_data)return{success:!1,error:"Action entity missing action_data"};let{action_name:s,kwargs:n}=e.action_data;if(Me.has(s)){let r=await Me.execute(s,n,t),a=r?.success!==!1,i=r?.error||r?.message;return{success:a,error:a?void 0:i}}else{let{page:r,agentServices:a}=t;return await(await To()).execute(r,e,a),{success:!0,error:void 0}}}catch(s){return{success:!1,error:s.message}}}var yt=null;async function To(){if(yt)return yt;let e=await import("./handler-7JPASJ4Y-KWA27ONH.js");return yt=new e.default,yt}async function Zo(e,t,s,n={},r){let a=r||{page:t,agentServices:s,domService:new at(s.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},i=s.replaceVariables(e),o=await da(i,a,n);return o.status==="error"?{status:"error",completed:o.goalAccomplished||!1,actionEntities:[],explanation:o.reasoning,error:o.error,debugInfo:o.debugInfo}:{status:"success",completed:o.goalAccomplished||!1,actionEntities:o.actionEntity?[o.actionEntity]:[],explanation:o.reasoning,debugInfo:o.debugInfo}}async function Ho(e,t,s,n={},r){let a=r||{page:t,agentServices:s,domService:new at(s.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},i=s.replaceVariables(e),o=await da(i,a,n);if(o.status==="error"||!o.actionEntity)return{status:"error",completed:o.goalAccomplished||!1,actionEntities:[],explanation:o.reasoning,error:o.error||"No action generated",debugInfo:o.debugInfo};let{actionEntity:l,reasoning:d,goalAccomplished:h,debugInfo:f}=o,u=await Io(l,a);return u.success?(d&&s.addNote(d),{status:"success",completed:h||!1,actionEntities:[l],explanation:d,debugInfo:f}):{status:"error",completed:!1,actionEntities:[l],error:u.error||"Action execution failed",debugInfo:f}}async function zo(e,t,s,n={}){let r={page:t,agentServices:s,domService:new at(s.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},a=s.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=s.isUseCleanScreenshotForAssertion()),Oo(a,r,n)}async function Ko(e,t,s,n,r={}){let{runTaskLoop:a}=await import("./task-TMX75KZR-MX73VAM2.js"),i=n?l=>{n(l)}:void 0,o=await a(e,{page:t,agentServices:s,domService:void 0,executionHistory:r.executionHistory,variables:r.variables,sensitiveKeys:r.sensitiveKeys},{maxSteps:r.maxSteps,onEvent:i,abortSignal:r.abortSignal});return{status:o.success?"success":"error",completed:o.completed,actionEntities:o.trajectory.actions,explanation:o.summary,error:o.error,tokenUsages:o.metadata.tokenUsages}}export{qo as a,Ga as b,ca as c,Io as d,Zo as e,Ho as f,zo as g,Ko as h};
201
+ `,O=await t.agentServices.retrieveKnowledges(e),P=[{type:"text",text:_}],N=0;if(i&&u&&u.length>0)for(let L of u)P.push({type:"image",image:L}),N++;else P.push({type:"image",image:f}),N=1;if(O&&O.length>0){let L=Ln(O,l);P.push(...L)}P.push({type:"text",text:R});let U=O?ti(O,l):0,G=N+U,$=Jt(a,G),Z=$o(),pe=await ot({model:Kt(a),system:Z,messages:[{role:"user",content:P}],output:it.object({schema:Ao}),temperature:0,providerOptions:$}),{conclusion:ne,explanation:Ae}=pe.output,we=JSON.stringify(pe.output,null,2),Le=[],fe=ua(pe.usage,a);fe&&Le.push(fe);let me=[{role:"user",content:P.map(L=>{if(L.type==="text")return{type:"text",text:L.text};if(L.type==="image"){let H=L.image,z=So(H);if(z)return{type:"image",file:z};let re=typeof H=="string"?H:"";return{type:"image",file:re.startsWith("data:")?re:`data:image/png;base64,${re}`}}return{type:"text",text:"[unknown content type]"}})}],ge={systemPrompt:Z,userPrompt:me,rawLlmResponse:we,screenshotWithSom:f,tokenUsages:Le,retrievedKnowledges:O&&O.length>0?O:void 0,elementTree:h};return{success:ne==="true",explanation:Ae,debugInfo:ge}}catch(i){return{success:!1,error:i.message}}}async function Io(e,t){try{if(!e.action_data)return{success:!1,error:"Action entity missing action_data"};let{action_name:s,kwargs:n}=e.action_data;if(Me.has(s)){let r=await Me.execute(s,n,t),a=r?.success!==!1,i=r?.error||r?.message;return{success:a,error:a?void 0:i}}else{let{page:r,agentServices:a}=t;return await(await To()).execute(r,e,a),{success:!0,error:void 0}}}catch(s){return{success:!1,error:s.message}}}var yt=null;async function To(){if(yt)return yt;let e=await import("./handler-65CN5L7D-IN6OTBXK.js");return yt=new e.default,yt}async function Zo(e,t,s,n={},r){let a=r||{page:t,agentServices:s,domService:new at(s.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},i=s.replaceVariables(e),o=await da(i,a,n);return o.status==="error"?{status:"error",completed:o.goalAccomplished||!1,actionEntities:[],explanation:o.reasoning,error:o.error,debugInfo:o.debugInfo}:{status:"success",completed:o.goalAccomplished||!1,actionEntities:o.actionEntity?[o.actionEntity]:[],explanation:o.reasoning,debugInfo:o.debugInfo}}async function Ho(e,t,s,n={},r){let a=r||{page:t,agentServices:s,domService:new at(s.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},i=s.replaceVariables(e),o=await da(i,a,n);if(o.status==="error"||!o.actionEntity)return{status:"error",completed:o.goalAccomplished||!1,actionEntities:[],explanation:o.reasoning,error:o.error||"No action generated",debugInfo:o.debugInfo};let{actionEntity:l,reasoning:d,goalAccomplished:h,debugInfo:f}=o,u=await Io(l,a);return u.success?(d&&s.addNote(d),{status:"success",completed:h||!1,actionEntities:[l],explanation:d,debugInfo:f}):{status:"error",completed:!1,actionEntities:[l],error:u.error||"Action execution failed",debugInfo:f}}async function zo(e,t,s,n={}){let r={page:t,agentServices:s,domService:new at(s.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},a=s.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=s.isUseCleanScreenshotForAssertion()),Oo(a,r,n)}async function Ko(e,t,s,n,r={}){let{runTaskLoop:a}=await import("./task-ERIJWZDN-6R32Q2PD.js"),i=n?l=>{n(l)}:void 0,o=await a(e,{page:t,agentServices:s,domService:void 0,executionHistory:r.executionHistory,variables:r.variables,sensitiveKeys:r.sensitiveKeys},{maxSteps:r.maxSteps,onEvent:i,abortSignal:r.abortSignal});return{status:o.success?"success":"error",completed:o.completed,actionEntities:o.trajectory.actions,explanation:o.summary,error:o.error,tokenUsages:o.metadata.tokenUsages}}export{qo as a,Ga as b,ca as c,Io as d,Zo as e,Ho as f,zo as g,Ko as h};
@@ -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{a as O,b as P,c as Q,d as R,e as S,f as T,g as U,h as V,i as W,j as X,k as Y,l as Z,m as _,n as $,o as aa,p as ba,q as ca,r as da,s as ea,t as fa,u as ga}from"./chunk-F2VF6EGN.js";import{j as l,k as m,l as n,m as o}from"./chunk-R4J6G5GI.js";import{a as f,c as g,d as h,e as i,f as j,g as k}from"./chunk-2BZVD336.js";import{b as J,e as K,f as L,g as M,h as N}from"./chunk-GTYDC5DF.js";import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as B}from"./chunk-KG3IU2VV.js";import"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import{C as H,E as I}from"./chunk-RONU7WUE.js";import{g as C,h as D,i as E,k as F,l as G}from"./chunk-X5NUVPAF.js";import{a,b,c,d,j as e}from"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{I as ActionHandler,H as ActionHelper,da as Agent,aa as AgentServices,ba as AgentStepEventTypes,ca as AgentTaskFailedError,_ as BrowserManager,w as DEFAULT_EVENT_LISTENER_LIMIT,A as DomService,v as EVENT_LISTENER_CANDIDATE_SELECTORS,B as HistoryTreeProcessor,f as INIT_SCRIPT,u as INTERACTION_EVENT_TYPES,t as INTERACTIVE_ROLES,e as LogLevel,l as LoginType,Y as MCPToolProvider,J as OpenAIToolProvider,ga as SDK_VERSION,p as ToolRegistry,m as TwoFactorAuthType,o as VariableStore,da as WebAgent,a as configureSdk,fa as createAgent,ea as createAgentContext,V as createToolRegistry,W as createToolRegistryWithCapabilities,T as ensureToolsRegistered,M as evaluateStatement,L as executeStep,Z as exportMCPTools,z as filterInteractionListeners,K as generateActionStep,G as getActionEntityLocatorInfo,h as getBrowserCdpUrl,X as getCapabilitySummary,F as getFramePath,r as getModel,j as getPageInfo,i as getPageWsUrl,$ as getPlatformFromDeviceName,s as getProviderOptions,b as getSdkConfig,U as getToolRegistry,O as injectUserFunction,y as isInteractionEventType,x as isInteractiveRole,R as loadKnowledgeMappings,Q as loadKnowledges,P as loadUserFunctions,d as logger,g as newBrowserContext,S as parseSSEStream,c as parseSdkLogLevelFromEnv,C as pickBestLocator,D as pickBestLocatorForElement,E as pickBestLocators,n as replaceVariables,N as runTask,k as setWindowBounds,q as toolRegistry};
4
+ import{a as O,b as P,c as Q,d as R,e as S,f as T,g as U,h as V,i as W,j as X,k as Y,l as Z,m as _,n as $,o as aa,p as ba,q as ca,r as da,s as ea,t as fa,u as ga}from"./chunk-HOPRFIKM.js";import{j as l,k as m,l as n,m as o}from"./chunk-R4J6G5GI.js";import{a as f,c as g,d as h,e as i,f as j,g as k}from"./chunk-2BZVD336.js";import{b as J,e as K,f as L,g as M,h as N}from"./chunk-VTK25XN7.js";import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as B}from"./chunk-NEBLFLPV.js";import"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import{C as H,E as I}from"./chunk-4R7SSOTO.js";import{g as C,h as D,i as E,k as F,l as G}from"./chunk-LATEXF4R.js";import{a,b,c,d,j as e}from"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{I as ActionHandler,H as ActionHelper,da as Agent,aa as AgentServices,ba as AgentStepEventTypes,ca as AgentTaskFailedError,_ as BrowserManager,w as DEFAULT_EVENT_LISTENER_LIMIT,A as DomService,v as EVENT_LISTENER_CANDIDATE_SELECTORS,B as HistoryTreeProcessor,f as INIT_SCRIPT,u as INTERACTION_EVENT_TYPES,t as INTERACTIVE_ROLES,e as LogLevel,l as LoginType,Y as MCPToolProvider,J as OpenAIToolProvider,ga as SDK_VERSION,p as ToolRegistry,m as TwoFactorAuthType,o as VariableStore,da as WebAgent,a as configureSdk,fa as createAgent,ea as createAgentContext,V as createToolRegistry,W as createToolRegistryWithCapabilities,T as ensureToolsRegistered,M as evaluateStatement,L as executeStep,Z as exportMCPTools,z as filterInteractionListeners,K as generateActionStep,G as getActionEntityLocatorInfo,h as getBrowserCdpUrl,X as getCapabilitySummary,F as getFramePath,r as getModel,j as getPageInfo,i as getPageWsUrl,$ as getPlatformFromDeviceName,s as getProviderOptions,b as getSdkConfig,U as getToolRegistry,O as injectUserFunction,y as isInteractionEventType,x as isInteractiveRole,R as loadKnowledgeMappings,Q as loadKnowledges,P as loadUserFunctions,d as logger,g as newBrowserContext,S as parseSSEStream,c as parseSdkLogLevelFromEnv,C as pickBestLocator,D as pickBestLocatorForElement,E as pickBestLocators,n as replaceVariables,N as runTask,k as setWindowBounds,q as toolRegistry};
@@ -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{A as B,B as C,C as D,D as E,E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,V as W,W as X,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"./chunk-JTLVXRYI.js";import"./chunk-7W6YLS2E.js";import"./chunk-VBI4DDSS.js";import{r as a}from"./chunk-F2VF6EGN.js";import"./chunk-R4J6G5GI.js";import"./chunk-2BZVD336.js";import"./chunk-HHCLRZRA.js";import"./chunk-67R4GP2H.js";import"./chunk-GTYDC5DF.js";import"./chunk-KG3IU2VV.js";import"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-RONU7WUE.js";import"./chunk-X5NUVPAF.js";import"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{l as ACT_SUPPORTED_ACTIONS,b as ActionEntitySchema,R as BrowserTools,U as DataTools,S as DebugTools,g as ExtensionRelayServer,X as LocalTestTools,h as PROMPTS,m as RESOURCES,t as RelayTools,e as SessionManager,s as SessionTools,c as StatementSchema,V as TestCaseTools,d as TestFlowSchema,W as TestResultTools,f as TokenApiClient,k as ToolRegistry,a as WebAgent,z as actHandler,x as actSchema,F as clearExecutionHistoryHandler,D as clearExecutionHistorySchema,E as clearExecutionHistoryToolMeta,P as getActSchema,Q as getActToolDefinition,y as getActToolMeta,p as getActionEntitySchemaResource,O as getLocatorsHandler,M as getLocatorsSchema,N as getLocatorsToolMeta,I as getPageInfoHandler,G as getPageInfoSchema,H as getPageInfoToolMeta,i as getPrompt,r as getResource,n as getTestFlowJsonSchemaResource,o as getTestFlowYamlSchemaResource,L as inspectPageHandler,J as inspectPageSchema,K as inspectPageToolMeta,j as listPrompts,q as listResources,T as missingApiTokenError,w as navigateHandler,u as navigateSchema,v as navigateToolMeta,C as updateVariablesHandler,A as updateVariablesSchema,B as updateVariablesToolMeta};
4
+ import{A as B,B as C,C as D,D as E,E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,V as W,W as X,a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p,p as q,q as r,r as s,s as t,t as u,u as v,v as w,w as x,x as y,y as z,z as A}from"./chunk-THUEPEC3.js";import"./chunk-7W6YLS2E.js";import"./chunk-VBI4DDSS.js";import{r as a}from"./chunk-HOPRFIKM.js";import"./chunk-R4J6G5GI.js";import"./chunk-2BZVD336.js";import"./chunk-HHCLRZRA.js";import"./chunk-67R4GP2H.js";import"./chunk-VTK25XN7.js";import"./chunk-NEBLFLPV.js";import"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-4R7SSOTO.js";import"./chunk-LATEXF4R.js";import"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{l as ACT_SUPPORTED_ACTIONS,b as ActionEntitySchema,R as BrowserTools,U as DataTools,S as DebugTools,g as ExtensionRelayServer,X as LocalTestTools,h as PROMPTS,m as RESOURCES,t as RelayTools,e as SessionManager,s as SessionTools,c as StatementSchema,V as TestCaseTools,d as TestFlowSchema,W as TestResultTools,f as TokenApiClient,k as ToolRegistry,a as WebAgent,z as actHandler,x as actSchema,F as clearExecutionHistoryHandler,D as clearExecutionHistorySchema,E as clearExecutionHistoryToolMeta,P as getActSchema,Q as getActToolDefinition,y as getActToolMeta,p as getActionEntitySchemaResource,O as getLocatorsHandler,M as getLocatorsSchema,N as getLocatorsToolMeta,I as getPageInfoHandler,G as getPageInfoSchema,H as getPageInfoToolMeta,i as getPrompt,r as getResource,n as getTestFlowJsonSchemaResource,o as getTestFlowYamlSchemaResource,L as inspectPageHandler,J as inspectPageSchema,K as inspectPageToolMeta,j as listPrompts,q as listResources,T as missingApiTokenError,w as navigateHandler,u as navigateSchema,v as navigateToolMeta,C as updateVariablesHandler,A as updateVariablesSchema,B as updateVariablesToolMeta};
@@ -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{D as r,E as e}from"./chunk-RONU7WUE.js";import"./chunk-X5NUVPAF.js";import"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";import{createRequire as t}from"module";var a=t(import.meta.url);export{r as ActionHandler,e as default};
4
+ import{D as r,E as e}from"./chunk-4R7SSOTO.js";import"./chunk-LATEXF4R.js";import"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";import{createRequire as t}from"module";var a=t(import.meta.url);export{r as ActionHandler,e as default};
package/dist/index.js CHANGED
@@ -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
- var e="0.1.57",o=process.argv[2];if(process.argv.includes("--version")||process.argv.includes("-v")||o==="version"){let s=e==="unknown"||process.argv[1]?.includes("/monots");process.stdout.write(`shiplight-mcp ${s?`${e}-local`:e}
4
+ var e="0.1.58",o=process.argv[2];if(process.argv.includes("--version")||process.argv.includes("-v")||o==="version"){let s=e==="unknown"||process.argv[1]?.includes("/monots");process.stdout.write(`shiplight-mcp ${s?`${e}-local`:e}
5
5
  `),process.exit(0)}if(process.argv.includes("--chrome-extension-path")){let s=new URL("../chrome-extension",import.meta.url).pathname;process.stdout.write(s+`
6
6
  `),process.exit(0)}(process.argv.includes("--help")||process.argv.includes("-h")||o==="help")&&(process.stdout.write(`shiplight-mcp ${e}
7
7
 
@@ -21,4 +21,4 @@ Environment variables:
21
21
  GOOGLE_API_KEY Google API key (for Gemini models)
22
22
  API_BASE_URL Shiplight API base URL (default: https://api.shiplight.ai)
23
23
  TERMINATION_TIMEOUT Session termination timeout in ms
24
- `),process.exit(0));var{startServer:t}=await import("./server-HRQ65FLP.js");await t();
24
+ `),process.exit(0));var{startServer:t}=await import("./server-MMON425X.js");await t();
@@ -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{a as e,b as o,c as t}from"./chunk-VBI4DDSS.js";import"./chunk-F2VF6EGN.js";import"./chunk-R4J6G5GI.js";import"./chunk-2BZVD336.js";import"./chunk-GTYDC5DF.js";import"./chunk-KG3IU2VV.js";import"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-RONU7WUE.js";import"./chunk-X5NUVPAF.js";import"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{e as connectBrowser,o as forceDisconnect,t as getCacheStatus};
4
+ import{a as e,b as o,c as t}from"./chunk-VBI4DDSS.js";import"./chunk-HOPRFIKM.js";import"./chunk-R4J6G5GI.js";import"./chunk-2BZVD336.js";import"./chunk-VTK25XN7.js";import"./chunk-NEBLFLPV.js";import"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-4R7SSOTO.js";import"./chunk-LATEXF4R.js";import"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{e as connectBrowser,o as forceDisconnect,t as getCacheStatus};
@@ -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{U as _,e as S,h as I,i as O,j as A,p as C,q as k}from"./chunk-JTLVXRYI.js";import"./chunk-7W6YLS2E.js";import"./chunk-VBI4DDSS.js";import"./chunk-F2VF6EGN.js";import"./chunk-R4J6G5GI.js";import"./chunk-2BZVD336.js";import"./chunk-HHCLRZRA.js";import"./chunk-67R4GP2H.js";import"./chunk-GTYDC5DF.js";import"./chunk-KG3IU2VV.js";import"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-RONU7WUE.js";import"./chunk-X5NUVPAF.js";import{a as x,d as f}from"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";import{Server as se}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as te}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as oe,ListToolsRequestSchema as re,ListResourcesRequestSchema as ne,ReadResourceRequestSchema as ie,ListPromptsRequestSchema as ae,GetPromptRequestSchema as le,ErrorCode as v,McpError as E}from"@modelcontextprotocol/sdk/types.js";import $ from"axios";import ce from"dotenv";var U=new Set(["click","double_click","right_click","hover"]),V=new Set(["press","send_keys_on_element"]),q=`
4
+ import{U as _,e as S,h as I,i as O,j as A,p as C,q as k}from"./chunk-THUEPEC3.js";import"./chunk-7W6YLS2E.js";import"./chunk-VBI4DDSS.js";import"./chunk-HOPRFIKM.js";import"./chunk-R4J6G5GI.js";import"./chunk-2BZVD336.js";import"./chunk-HHCLRZRA.js";import"./chunk-67R4GP2H.js";import"./chunk-VTK25XN7.js";import"./chunk-NEBLFLPV.js";import"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-4R7SSOTO.js";import"./chunk-LATEXF4R.js";import{a as x,d as f}from"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";import{Server as se}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as te}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as oe,ListToolsRequestSchema as re,ListResourcesRequestSchema as ne,ReadResourceRequestSchema as ie,ListPromptsRequestSchema as ae,GetPromptRequestSchema as le,ErrorCode as v,McpError as E}from"@modelcontextprotocol/sdk/types.js";import $ from"axios";import ce from"dotenv";var U=new Set(["click","double_click","right_click","hover"]),V=new Set(["press","send_keys_on_element"]),q=`
5
5
  @keyframes _sl_ripple {
6
6
  0% { transform: translate(-50%,-50%) scale(1.0); opacity: 1; }
7
7
  60% { transform: translate(-50%,-50%) scale(1.8); opacity: 0.9; }
@@ -19,4 +19,4 @@ import{U as _,e as S,h as I,i as O,j as A,p as C,q as k}from"./chunk-JTLVXRYI.js
19
19
  75% { opacity: 1; transform: scale(1.0); }
20
20
  100% { opacity: 0; transform: scale(0.9); }
21
21
  }
22
- `;async function P(o,s,a,r,e){if(await o.evaluate(t=>{if(document.getElementById("_sl_styles"))return;let n=document.createElement("style");n.id="_sl_styles",n.textContent=t,document.head.appendChild(n)},q).catch(()=>{}),U.has(s)){let t=a.element_index;if(typeof t=="number"){let n=null;if(r){let i=r.selectorMap.get(t),l=i?.viewportCoordinates?.center;if(l)n=l;else if(i?.xpath)try{let p=i.xpath.startsWith("//")?i.xpath:`//${i.xpath}`,u=await o.locator(`xpath=${p}`).first().boundingBox({timeout:2e3});u&&(n={x:u.x+u.width/2,y:u.y+u.height/2})}catch{}}if(n){let{x:i,y:l}=n,p=s==="double_click";f.debug(`[indicator] ${s} at (${Math.round(i)}, ${Math.round(l)})`),await o.evaluate(({x:u,y:b,isDouble:D})=>{let m=window;m._sl_timers&&(m._sl_timers.forEach(c=>clearTimeout(c)),document.querySelectorAll("._sl_indicator").forEach(c=>c.remove())),m._sl_timers=[];function h(c){let T=document.createElement("div");T.className="_sl_indicator",T.style.cssText=["position:fixed",`left:${u}px`,`top:${b}px`,"width:80px","height:80px","border-radius:50%","background:rgba(255,30,30,0.25)","border:5px solid rgba(255,30,30,0.9)","pointer-events:none","z-index:2147483647",`animation:_sl_ripple 0.9s ${c}ms ease-out forwards`].join(";"),document.body.appendChild(T),m._sl_timers.push(setTimeout(()=>T.remove(),1e3+c))}function H(){let c=document.createElement("div");c.className="_sl_indicator",c.style.cssText=["position:fixed",`left:${u}px`,`top:${b}px`,"width:28px","height:28px","border-radius:50%","background:rgba(255,30,30,0.95)","pointer-events:none","z-index:2147483647","animation:_sl_dot 0.8s ease-in forwards"].join(";"),document.body.appendChild(c),m._sl_timers.push(setTimeout(()=>c.remove(),850))}h(0),h(200),H(),D&&(h(400),h(600))},{x:i,y:l,isDouble:p}),e&&await o.waitForTimeout(300)}else f.debug(`[indicator] ${s}: no coords for element_index ${t}`)}}else if(V.has(s)){let t=a.keys;typeof t=="string"&&(f.debug(`[indicator] ${s}: keys="${t}"`),await o.evaluate(({keysText:n})=>{let i=window;i._sl_timers&&(i._sl_timers.forEach(p=>clearTimeout(p)),document.querySelectorAll("._sl_indicator").forEach(p=>p.remove())),i._sl_timers=[];let l=document.createElement("div");l.className="_sl_indicator",l.style.cssText=["position:fixed","bottom:32px","left:0","right:0","width:fit-content","margin:0 auto","background:#1a1a1a","color:#fff","padding:14px 28px","border-radius:12px","font-size:28px","font-family:ui-monospace,monospace","font-weight:800","letter-spacing:0.04em","pointer-events:none","z-index:2147483647","border:3px solid rgba(255,255,255,0.25)","box-shadow:0 4px 32px rgba(0,0,0,0.5)","animation:_sl_key_pop 1.4s ease-out forwards"].join(";"),l.textContent="\u2328\uFE0F "+n,document.body.appendChild(l),i._sl_timers.push(setTimeout(()=>l.remove(),1500))},{keysText:t}),e&&await o.waitForTimeout(300))}}var y=class o{static _instance;_logLevel;constructor(){switch(process.env.LOG_LEVEL?.toUpperCase()){case"ERROR":this._logLevel=1;break;case"WARN":this._logLevel=2;break;case"INFO":this._logLevel=3;break;case"DEBUG":this._logLevel=4;break;default:this._logLevel=3}}static getInstance(){return o._instance||(o._instance=new o),o._instance}setLevel(s){this._logLevel=s}debug(...s){this._logLevel>=4&&console.error("[DEBUG]",...s)}info(...s){this._logLevel>=3&&console.error("[INFO]",...s)}warn(...s){this._logLevel>=2&&console.error("[WARN]",...s)}error(...s){this._logLevel>=1&&console.error("[ERROR]",...s)}log(...s){this.info(...s)}},F=y.getInstance(),d=F;import{createHash as W}from"node:crypto";import{hostname as K,userInfo as Y,platform as M,arch as j}from"node:os";import{PostHog as z}from"posthog-node";var J="phc_5Va2dHamGwJWX9qZqyRka5Lann5ATsg3LL4uyU63qin",X="https://us.i.posthog.com",Z=process.env.SHIPLIGHT_TELEMETRY==="0"||process.env.DO_NOT_TRACK==="1",g=null,G=!1;function Q(){return Z?null:(g||(g=new z(J,{host:X,flushAt:1,flushInterval:3e4})),g)}function ee(){let o=`${K()}:${Y().username}:${M()}:${j()}`;return W("sha256").update(o).digest("hex")}function N(o,s){let a=Q();if(a){G||(d.info("Anonymous usage telemetry enabled. Set SHIPLIGHT_TELEMETRY=0 to disable."),G=!0);try{a.capture({distinctId:ee(),event:"mcp_new_session",properties:{product:"mcp-server",version:o,platform:M(),nodeVersion:process.version,cloudMode:s,$geoip_disable:!0,$ip:null}}),a.flush().catch(()=>{})}catch{}}}process.env.PWDEBUG="console";var R=(...o)=>console.error(...o);console.log=R;console.info=R;console.debug=R;process.on("uncaughtException",o=>{console.error("[MCP] Uncaught exception (non-fatal):",o)});process.on("unhandledRejection",o=>{console.error("[MCP] Unhandled rejection (non-fatal):",o)});ce.config({override:!1});async function w(){let{SessionTools:o,RelayTools:s,BrowserTools:a,DebugTools:r,LocalTestTools:e,SessionManager:t,ExtensionRelayServer:n}=await import("./dist-CT5TSYOS.js");return{SessionTools:o,RelayTools:s,BrowserTools:a,DebugTools:r,LocalTestTools:e,SessionManager:t,ExtensionRelayServer:n}}var pe="SHIPLIGHT_API_TOKEN";function B(){return process.env[pe]||null}var L=class{constructor(s=!1,a=null){this.debugMode=s;this.relayPort=a;x({stderrOnly:!0});let r=process.env.API_BASE_URL||"https://api.shiplight.ai";this.server=new se({name:"shiplight-mcp",version:"1.0.0"},{capabilities:{tools:{},resources:{},prompts:{}}}),this.registry=new A;let e=B();if(this.apiClient=e?new S({apiBaseUrl:r,getApiToken:()=>B()}):null,this.apiClient){let t=new _(this.apiClient);this.testCaseTools=t,this.registry.registerTools(_,t,["getTestCase","getTemplate","getFunction","saveTestCase","saveTestAccount","saveTemplate","saveFunction"])}}server;registry;sessionBackend=null;apiClient;sessionTools=null;browserTools=null;debugTools=null;testCaseTools=null;localTestTools=null;relayTools=null;relayServer=null;async initBrowserTools(){let s=process.env.TERMINATION_TIMEOUT?parseInt(process.env.TERMINATION_TIMEOUT,10):null,{SessionTools:a,BrowserTools:r,DebugTools:e,LocalTestTools:t,SessionManager:n}=await w();this.sessionBackend=new n({terminationTimeout:s,onBeforeAction:process.env.SHIPLIGHT_ACTION_INDICATORS==="1"?P:void 0}),this.sessionTools=new a(this.sessionBackend,this.apiClient),this.browserTools=new r(this.sessionBackend),this.debugTools=new e(this.sessionBackend),this.localTestTools=new t(this.sessionBackend,this.apiClient);let{RelayTools:i}=await w();this.relayTools=new i(this.sessionBackend),this.registry.registerAll(a,this.sessionTools).registerAll(r,this.browserTools).registerAll(e,this.debugTools).registerAll(t,this.localTestTools).registerAll(i,this.relayTools),this.apiClient&&this.registry.registerAll({toolDefinitions:t.cloudToolDefinitions},this.localTestTools)}async startRelayServer(){if(this.relayPort===null)return!1;let s=this.relayPort,{RelayTools:a,ExtensionRelayServer:r}=await w();if(this.relayServer=new r,!this.sessionBackend||!this.relayTools)return d.error("[MCP] Cannot start relay server: session backend not initialized"),!1;try{return await this.relayServer.start(s),d.info(`[MCP] Chrome Extension Relay ready on port ${s}`),this.relayTools.setRelayServer(this.relayServer),this.debugMode&&this.registry.registerAll({toolDefinitions:a.debugToolDefinitions},this.relayTools),!0}catch(e){let t=e;return t.message&&t.message.includes("EADDRINUSE")?d.warn(`[MCP] Port ${s} already in use. Relay disabled for this instance.`):d.error("[MCP] Failed to start relay server:",e),this.relayServer=null,!1}}setupHandlers(){let{tools:s,handleToolCall:a}=this.registry.build();this.server.setRequestHandler(re,async()=>({tools:s})),this.server.setRequestHandler(oe,async r=>{try{let{name:e,arguments:t}=r.params,n=await a(e,t);return e==="new_session"&&N("0.1.57",!!this.apiClient),{content:[{type:"text",text:n}]}}catch(e){let t=e instanceof Error?e.message:String(e);if($.isAxiosError(e)){let n=e.config?.url,i=e.config?.baseURL,l=e.response?.status;t=`${e.code||"AxiosError"}: ${e.message}`,(i||n)&&(t+=` (${i||""}${n||""})`),l&&(t+=` [${l}]`),console.error(`[MCP] API error: ${t}`)}throw $.isAxiosError(e)&&e.response?.status===401&&(t="Authentication required. Contact info@shiplight.ai to get access to cloud services and advanced features."),new E(v.InternalError,t)}}),this.server.setRequestHandler(ne,async()=>({resources:C()})),this.server.setRequestHandler(ie,async r=>{let{uri:e}=r.params,t=await k(e);if(!t)throw new E(v.InvalidRequest,`Unknown resource: ${e}`);return{contents:[{uri:e,mimeType:"text/markdown",text:t}]}}),this.server.setRequestHandler(ae,async()=>({prompts:O().map(e=>({name:e.name,description:e.description}))})),this.server.setRequestHandler(le,async r=>{let{name:e}=r.params,t=I(e);if(!t)throw new E(v.InvalidRequest,`Unknown prompt: ${e}`);return{messages:[{role:"user",content:{type:"text",text:t}}]}})}async run(){await this.initBrowserTools(),await this.startRelayServer(),this.setupHandlers();let s=new te;await this.server.connect(s),d.info("Shiplight MCP Server running on stdio")}};async function Ae(){let o=process.argv.includes("--debug"),s=process.env.SHIPLIGHT_RELAY_PORT&&parseInt(process.env.SHIPLIGHT_RELAY_PORT,10)||null;await new L(o,s).run()}export{Ae as startServer};
22
+ `;async function P(o,s,a,r,e){if(await o.evaluate(t=>{if(document.getElementById("_sl_styles"))return;let n=document.createElement("style");n.id="_sl_styles",n.textContent=t,document.head.appendChild(n)},q).catch(()=>{}),U.has(s)){let t=a.element_index;if(typeof t=="number"){let n=null;if(r){let i=r.selectorMap.get(t),l=i?.viewportCoordinates?.center;if(l)n=l;else if(i?.xpath)try{let p=i.xpath.startsWith("//")?i.xpath:`//${i.xpath}`,u=await o.locator(`xpath=${p}`).first().boundingBox({timeout:2e3});u&&(n={x:u.x+u.width/2,y:u.y+u.height/2})}catch{}}if(n){let{x:i,y:l}=n,p=s==="double_click";f.debug(`[indicator] ${s} at (${Math.round(i)}, ${Math.round(l)})`),await o.evaluate(({x:u,y:b,isDouble:D})=>{let m=window;m._sl_timers&&(m._sl_timers.forEach(c=>clearTimeout(c)),document.querySelectorAll("._sl_indicator").forEach(c=>c.remove())),m._sl_timers=[];function h(c){let T=document.createElement("div");T.className="_sl_indicator",T.style.cssText=["position:fixed",`left:${u}px`,`top:${b}px`,"width:80px","height:80px","border-radius:50%","background:rgba(255,30,30,0.25)","border:5px solid rgba(255,30,30,0.9)","pointer-events:none","z-index:2147483647",`animation:_sl_ripple 0.9s ${c}ms ease-out forwards`].join(";"),document.body.appendChild(T),m._sl_timers.push(setTimeout(()=>T.remove(),1e3+c))}function H(){let c=document.createElement("div");c.className="_sl_indicator",c.style.cssText=["position:fixed",`left:${u}px`,`top:${b}px`,"width:28px","height:28px","border-radius:50%","background:rgba(255,30,30,0.95)","pointer-events:none","z-index:2147483647","animation:_sl_dot 0.8s ease-in forwards"].join(";"),document.body.appendChild(c),m._sl_timers.push(setTimeout(()=>c.remove(),850))}h(0),h(200),H(),D&&(h(400),h(600))},{x:i,y:l,isDouble:p}),e&&await o.waitForTimeout(300)}else f.debug(`[indicator] ${s}: no coords for element_index ${t}`)}}else if(V.has(s)){let t=a.keys;typeof t=="string"&&(f.debug(`[indicator] ${s}: keys="${t}"`),await o.evaluate(({keysText:n})=>{let i=window;i._sl_timers&&(i._sl_timers.forEach(p=>clearTimeout(p)),document.querySelectorAll("._sl_indicator").forEach(p=>p.remove())),i._sl_timers=[];let l=document.createElement("div");l.className="_sl_indicator",l.style.cssText=["position:fixed","bottom:32px","left:0","right:0","width:fit-content","margin:0 auto","background:#1a1a1a","color:#fff","padding:14px 28px","border-radius:12px","font-size:28px","font-family:ui-monospace,monospace","font-weight:800","letter-spacing:0.04em","pointer-events:none","z-index:2147483647","border:3px solid rgba(255,255,255,0.25)","box-shadow:0 4px 32px rgba(0,0,0,0.5)","animation:_sl_key_pop 1.4s ease-out forwards"].join(";"),l.textContent="\u2328\uFE0F "+n,document.body.appendChild(l),i._sl_timers.push(setTimeout(()=>l.remove(),1500))},{keysText:t}),e&&await o.waitForTimeout(300))}}var y=class o{static _instance;_logLevel;constructor(){switch(process.env.LOG_LEVEL?.toUpperCase()){case"ERROR":this._logLevel=1;break;case"WARN":this._logLevel=2;break;case"INFO":this._logLevel=3;break;case"DEBUG":this._logLevel=4;break;default:this._logLevel=3}}static getInstance(){return o._instance||(o._instance=new o),o._instance}setLevel(s){this._logLevel=s}debug(...s){this._logLevel>=4&&console.error("[DEBUG]",...s)}info(...s){this._logLevel>=3&&console.error("[INFO]",...s)}warn(...s){this._logLevel>=2&&console.error("[WARN]",...s)}error(...s){this._logLevel>=1&&console.error("[ERROR]",...s)}log(...s){this.info(...s)}},F=y.getInstance(),d=F;import{createHash as W}from"node:crypto";import{hostname as K,userInfo as Y,platform as M,arch as j}from"node:os";import{PostHog as z}from"posthog-node";var J="phc_5Va2dHamGwJWX9qZqyRka5Lann5ATsg3LL4uyU63qin",X="https://us.i.posthog.com",Z=process.env.SHIPLIGHT_TELEMETRY==="0"||process.env.DO_NOT_TRACK==="1",g=null,G=!1;function Q(){return Z?null:(g||(g=new z(J,{host:X,flushAt:1,flushInterval:3e4})),g)}function ee(){let o=`${K()}:${Y().username}:${M()}:${j()}`;return W("sha256").update(o).digest("hex")}function N(o,s){let a=Q();if(a){G||(d.info("Anonymous usage telemetry enabled. Set SHIPLIGHT_TELEMETRY=0 to disable."),G=!0);try{a.capture({distinctId:ee(),event:"mcp_new_session",properties:{product:"mcp-server",version:o,platform:M(),nodeVersion:process.version,cloudMode:s,$geoip_disable:!0,$ip:null}}),a.flush().catch(()=>{})}catch{}}}process.env.PWDEBUG="console";var R=(...o)=>console.error(...o);console.log=R;console.info=R;console.debug=R;process.on("uncaughtException",o=>{console.error("[MCP] Uncaught exception (non-fatal):",o)});process.on("unhandledRejection",o=>{console.error("[MCP] Unhandled rejection (non-fatal):",o)});ce.config({override:!1});async function w(){let{SessionTools:o,RelayTools:s,BrowserTools:a,DebugTools:r,LocalTestTools:e,SessionManager:t,ExtensionRelayServer:n}=await import("./dist-K3ASWHBE.js");return{SessionTools:o,RelayTools:s,BrowserTools:a,DebugTools:r,LocalTestTools:e,SessionManager:t,ExtensionRelayServer:n}}var pe="SHIPLIGHT_API_TOKEN";function B(){return process.env[pe]||null}var L=class{constructor(s=!1,a=null){this.debugMode=s;this.relayPort=a;x({stderrOnly:!0});let r=process.env.API_BASE_URL||"https://api.shiplight.ai";this.server=new se({name:"shiplight-mcp",version:"1.0.0"},{capabilities:{tools:{},resources:{},prompts:{}}}),this.registry=new A;let e=B();if(this.apiClient=e?new S({apiBaseUrl:r,getApiToken:()=>B()}):null,this.apiClient){let t=new _(this.apiClient);this.testCaseTools=t,this.registry.registerTools(_,t,["getTestCase","getTemplate","getFunction","saveTestCase","saveTestAccount","saveTemplate","saveFunction"])}}server;registry;sessionBackend=null;apiClient;sessionTools=null;browserTools=null;debugTools=null;testCaseTools=null;localTestTools=null;relayTools=null;relayServer=null;async initBrowserTools(){let s=process.env.TERMINATION_TIMEOUT?parseInt(process.env.TERMINATION_TIMEOUT,10):null,{SessionTools:a,BrowserTools:r,DebugTools:e,LocalTestTools:t,SessionManager:n}=await w();this.sessionBackend=new n({terminationTimeout:s,onBeforeAction:process.env.SHIPLIGHT_ACTION_INDICATORS==="1"?P:void 0}),this.sessionTools=new a(this.sessionBackend,this.apiClient),this.browserTools=new r(this.sessionBackend),this.debugTools=new e(this.sessionBackend),this.localTestTools=new t(this.sessionBackend,this.apiClient);let{RelayTools:i}=await w();this.relayTools=new i(this.sessionBackend),this.registry.registerAll(a,this.sessionTools).registerAll(r,this.browserTools).registerAll(e,this.debugTools).registerAll(t,this.localTestTools).registerAll(i,this.relayTools),this.apiClient&&this.registry.registerAll({toolDefinitions:t.cloudToolDefinitions},this.localTestTools)}async startRelayServer(){if(this.relayPort===null)return!1;let s=this.relayPort,{RelayTools:a,ExtensionRelayServer:r}=await w();if(this.relayServer=new r,!this.sessionBackend||!this.relayTools)return d.error("[MCP] Cannot start relay server: session backend not initialized"),!1;try{return await this.relayServer.start(s),d.info(`[MCP] Chrome Extension Relay ready on port ${s}`),this.relayTools.setRelayServer(this.relayServer),this.debugMode&&this.registry.registerAll({toolDefinitions:a.debugToolDefinitions},this.relayTools),!0}catch(e){let t=e;return t.message&&t.message.includes("EADDRINUSE")?d.warn(`[MCP] Port ${s} already in use. Relay disabled for this instance.`):d.error("[MCP] Failed to start relay server:",e),this.relayServer=null,!1}}setupHandlers(){let{tools:s,handleToolCall:a}=this.registry.build();this.server.setRequestHandler(re,async()=>({tools:s})),this.server.setRequestHandler(oe,async r=>{try{let{name:e,arguments:t}=r.params,n=await a(e,t);return e==="new_session"&&N("0.1.58",!!this.apiClient),{content:[{type:"text",text:n}]}}catch(e){let t=e instanceof Error?e.message:String(e);if($.isAxiosError(e)){let n=e.config?.url,i=e.config?.baseURL,l=e.response?.status;t=`${e.code||"AxiosError"}: ${e.message}`,(i||n)&&(t+=` (${i||""}${n||""})`),l&&(t+=` [${l}]`),console.error(`[MCP] API error: ${t}`)}throw $.isAxiosError(e)&&e.response?.status===401&&(t="Authentication required. Contact info@shiplight.ai to get access to cloud services and advanced features."),new E(v.InternalError,t)}}),this.server.setRequestHandler(ne,async()=>({resources:C()})),this.server.setRequestHandler(ie,async r=>{let{uri:e}=r.params,t=await k(e);if(!t)throw new E(v.InvalidRequest,`Unknown resource: ${e}`);return{contents:[{uri:e,mimeType:"text/markdown",text:t}]}}),this.server.setRequestHandler(ae,async()=>({prompts:O().map(e=>({name:e.name,description:e.description}))})),this.server.setRequestHandler(le,async r=>{let{name:e}=r.params,t=I(e);if(!t)throw new E(v.InvalidRequest,`Unknown prompt: ${e}`);return{messages:[{role:"user",content:{type:"text",text:t}}]}})}async run(){await this.initBrowserTools(),await this.startRelayServer(),this.setupHandlers();let s=new te;await this.server.connect(s),d.info("Shiplight MCP Server running on stdio")}};async function Ae(){let o=process.argv.includes("--debug"),s=process.env.SHIPLIGHT_RELAY_PORT&&parseInt(process.env.SHIPLIGHT_RELAY_PORT,10)||null;await new L(o,s).run()}export{Ae as startServer};
@@ -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{h as E}from"./chunk-2BZVD336.js";import{b as _,c as I,d as C,l as N,o as R}from"./chunk-KG3IU2VV.js";import{a as r}from"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import{l as O}from"./chunk-X5NUVPAF.js";import"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";import{createRequire as M}from"module";import{z as x}from"zod";var X=M(import.meta.url);function D(t,s,e){let o=()=>t.stepHistory.length===0?"":`**Recent Steps**:
4
+ import{h as E}from"./chunk-2BZVD336.js";import{b as _,c as I,d as C,l as N,o as R}from"./chunk-NEBLFLPV.js";import{a as r}from"./chunk-UBUBM7F7.js";import"./chunk-B7PRQ6ZM.js";import{l as O}from"./chunk-LATEXF4R.js";import"./chunk-HBXQFJ2K.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";import{createRequire as M}from"module";import{z as x}from"zod";var X=M(import.meta.url);function D(t,s,e){let o=()=>t.stepHistory.length===0?"":`**Recent Steps**:
5
5
  ${t.stepHistory.slice(-3).map(a=>{let n=`${a.outcome.success?"\u2713":"\u2717"} Step ${a.stepNumber}: ${a.goal}`;if(a.actions.length>1)a.actions.forEach((c,l)=>{let h=c.action_description||"Unknown action";n+=`
6
6
  \u2192 Action ${l+1}: ${h}`});else if(a.actions.length===1){let c=a.actions[0]?.action_description||"Unknown action";n+=`
7
7
  \u2192 ${c}`}if(!a.outcome.success&&a.outcome.error){let c=a.outcome.error.substring(0,100);n+=`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shiplightai/mcp",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "type": "module",
5
5
  "description": "Shiplight MCP server for AI-powered test automation",
6
6
  "main": "dist/index.js",