@superglue/cli 1.1.73 → 1.1.74

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
  {
2
2
  "name": "superglue",
3
3
  "description": "Build, test, and manage superglue tools via the sg CLI. Use when working with superglue tools, systems, APIs, SDKs, or the sg command.",
4
- "version": "1.1.73",
4
+ "version": "1.1.74",
5
5
  "author": {
6
6
  "name": "superglue",
7
7
  "email": "hello@superglue.cloud"
package/dist/cli.js CHANGED
@@ -868,7 +868,7 @@ WRITING DATA: POST /source/{destinationSourceId}/user and POST /source/{destinat
868
868
 
869
869
  ACTIVITY TYPES: Call GET /activityTypes before posting activities \u2014 the activityType field must match an accepted value for the room.
870
870
 
871
- DEPRECATED ENDPOINTS: GET /user/{email} and GET /members are deprecated; use V2 equivalents instead.`},teamcity:{name:"teamcity",apiUrl:"https://{host}/app/rest",regex:"^.*(teamcity|jetbrains[\\s._-]?teamcity|\\/app\\/rest).*$",icon:"teamcity",docsUrl:"https://www.jetbrains.com/help/teamcity/rest/teamcity-rest-api-documentation.html",preferredAuthType:"api_key",keywords:["builds","projects","agents","artifacts","vcs roots","build configurations","build chains","test reports","deployments"],systemSpecificInstructions:"TeamCity is self-hosted; the API base URL is https://{host}/app/rest where {host} is your TeamCity server hostname. Tokens are personal access tokens created per-user under My Settings & Tools \u2192 Access Tokens \u2014 not a global admin panel. Use as Authorization: Bearer <token>. The OpenAPI spec is available at runtime on the server itself at /app/rest/swagger.json. Basic auth is available via /httpAuth/app/rest/... as a fallback. The API version segment (e.g. /app/rest/2018.1/...) is optional; omitting it uses the latest version."},expensify:{name:"expensify",apiUrl:"https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations",regex:"^.*(expensify|integrations\\.expensify\\.com).*$",icon:"expensify",docsUrl:"https://integrations.expensify.com/Integration-Server/doc/",preferredAuthType:"api_key",keywords:["report","expense","policy","employee","category","tag","card","domain","receipt","transaction","approver","reimbursement"],systemSpecificInstructions:`Expensify uses a non-standard single-endpoint API: all requests are POSTs to https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations with credentials (partnerUserID and partnerUserSecret) embedded in the JSON body under a "credentials" key, not in headers. Obtain partnerUserID and partnerUserSecret exclusively from https://www.expensify.com/tools/integrations/ \u2014 this page is not reachable from the main account settings. Report creation requires explicit enablement by emailing concierge@expensify.com. The card reconciliation export requires the credentials to belong to a domain admin account. To operate on another user's data via the "userEmail" parameter, that user must first grant third-party access to your partner account.`},dhl:{name:"dhl",apiUrl:"https://api-eu.dhl.com/track/shipments",regex:"^.*(dhl|api-eu\\.dhl\\.com|dhl[\\s._-]?tracking).*$",icon:"simpleicons:dhl",docsUrl:"https://developer.dhl.com/api-reference/shipment-tracking",preferredAuthType:"api_key",keywords:["tracking","shipment","trackingNumber","events","status","carrier","parcel","logistics","origin","destination"],systemSpecificInstructions:"Auth header is DHL-API-Key, not a generic Authorization header \u2014 get the key by registering an app on developer.dhl.com (free tier works for tracking). The apiUrl covers the EU region host; other DHL developer-portal products (e.g. Parcel DE Shipping) use different base paths and credentials and are not covered by this template."},weclapp:{name:"weclapp",apiUrl:"https://{tenant}.weclapp.com/webapp/api/v2",regex:"^.*(weclapp).*$",icon:"lucide:building-2",docsUrl:"https://www.weclapp.com/api/",openApiUrl:"https://www.weclapp.com/api/swagger.json",preferredAuthType:"api_key",keywords:["party","customer","supplier","salesOrder","salesInvoice","article","purchaseOrder","shipment","quotation","ticket","warehouseStock","accountingTransaction"],systemSpecificInstructions:"Auth header is AuthenticationToken (not Bearer or Basic) \u2014 generate it in the weclapp UI under user settings. {tenant} is the subdomain of your weclapp instance (e.g. mycompany for mycompany.weclapp.com)."},windchill:{name:"windchill",apiUrl:"https://{host}/Windchill/servlet/odata",regex:"^.*(windchill|ptc[\\s._-]?windchill).*$",icon:"/logos/ptc.svg",docsUrl:"https://support.ptc.com/help/windchill/r13.1.2.0/en/Windchill_Help_Center/middlemap_landingpages/WCRESTServices_LP.html",preferredAuthType:"basic_auth",keywords:["odata","plm","changeMgmt","changeNotices","parts","documents","cadDocuments","productStructure","workflow"],systemSpecificInstructions:"Windchill OData REST Services must be enabled by a Windchill administrator before any endpoint responds. Basic Auth alone works for GET requests; POST/PUT/PATCH/DELETE calls additionally require first fetching a CSRF_NONCE from the GetCSRFToken endpoint and sending it as a request header, or writes fail with 401/403. {host} is the self-hosted Windchill instance; there is no public multi-tenant host or OpenAPI spec."},pinterestAds:{name:"pinterestAds",label:"Pinterest Ads",apiUrl:"https://api.pinterest.com/v5",regex:"^.*(pinterest).*$",icon:"simpleicons:pinterest",docsUrl:"https://developers.pinterest.com/docs/api/v5/",openApiUrl:"https://raw.githubusercontent.com/pinterest/api-description/main/v5/openapi.yaml",preferredAuthType:"oauth2",oauth:{authUrl:"https://www.pinterest.com/oauth/",tokenUrl:"https://api.pinterest.com/v5/oauth/token",scopes:"ads:read user_accounts:read",grant_type:"authorization_code",tokenAuthMethod:"basic_auth",tokenContentType:"form"},keywords:["ad_accounts","campaigns","ad_groups","ads","analytics","audiences","conversion_tags","catalogs","reports","spend","roas"],systemSpecificInstructions:"Requires a registered app in the Pinterest developer portal (with at least one redirect URI) to get a client ID/secret. Token exchange uses HTTP Basic Auth with the client credentials, not body params."},openMeteo:{name:"openMeteo",label:"Open-Meteo",apiUrl:"https://api.open-meteo.com",regex:"^.*(open-meteo|open_meteo|openmeteo).*$",icon:"lucide:cloud-sun",docsUrl:"https://open-meteo.com/en/docs",preferredAuthType:"none",keywords:["forecast","geocoding","temperature","precipitation","wind","humidity","air quality","marine","elevation","hourly","daily"],systemSpecificInstructions:"Free tier needs no auth (rate-limited only). Geocoding lives on a separate host, geocoding-api.open-meteo.com, not under /v1/forecast. A paid commercial tier exists on a different host, customer-api.open-meteo.com, and requires an apikey query parameter \u2014 the base URL itself changes, not just the auth."},openWeatherMap:{name:"openWeatherMap",label:"OpenWeatherMap",apiUrl:"https://api.openweathermap.org",regex:"^.*(openweathermap|openweather).*$",icon:"lucide:cloud-sun",docsUrl:"https://openweathermap.org/api",preferredAuthType:"api_key",keywords:["forecast","current weather","temperature","precipitation","wind","humidity","air pollution","alerts","geocoding","onecall"],systemSpecificInstructions:"API key is passed as the query parameter appid, not a header. New keys can take up to 2 hours to activate and return 401 until then. The premium One Call 3.0 endpoint (/data/3.0/onecall) requires a separate subscription enrollment even for existing account holders; the free key only covers the older /data/2.5 endpoints."}};fe.systemOptions=[{value:"manual",label:"Custom API",icon:"default"},...Object.entries(fe.systems).map(([o,e])=>({value:o,label:o.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()).trim(),icon:e.icon||"default"}))];function F2(o){return Object.entries(gY.contextSourceTemplates).filter(([,e])=>!o||e.category===o).map(([e,t])=>({key:e,template:{...fe.systems[e],contextSource:t}})).sort((e,t)=>e.template.contextSource.onboardingOrder-t.template.contextSource.onboardingOrder)}function M2(o){let e=(o||"").trim();if(!e)return"";try{let t=new URL(e),a=t.pathname.replace(/\/+$/,"");return`${t.protocol.toLowerCase()}//${t.host.toLowerCase()}${a}${t.search}`}catch{return e.replace(/\/+$/,"").toLowerCase()}}function P2(o,e){let t=M2(o);return[e.apiUrl,...e.contextSource.endpointAliases||[]].some(a=>M2(a)===t)}function fY({system:o,sourceTemplate:e}){let{key:t,template:a}=e;if(o.id===a.contextSource.systemId)return"canonical_id";if(o.templateName===t)return"template_name";let i=new Set([t,a.name,a.label].filter(s=>!!s).map(s=>s.trim().toLowerCase())),r=P2(o.url,a);if(o.id===t||r&&i.has((o.name||"").toLowerCase()))return"legacy_identity"}function bY(o,e){return o.some(t=>t.systemId===e&&t.credentialKeys.some(a=>(a.key==="access_token"||a.key==="accessToken")&&a.hasValue))}function yY({systemList:o,credentialSets:e,category:t}){return{sources:F2(t).map(i=>{let r=o.map(A=>({system:A,matchReason:fY({system:A,sourceTemplate:i}),endpointMatches:P2(A.url,i.template),connected:bY(e,A.id)})).filter(A=>!!A.matchReason);if(r.length===0)return{templateName:i.key,status:"missing"};let s=r.filter(({endpointMatches:A})=>A),n=s.length>0?s:r,c=n.filter(({connected:A})=>A),m=c.length>0?c:n,l={canonical_id:3,template_name:2,legacy_identity:1},u=[...m].sort((A,k)=>l[k.matchReason]-l[A.matchReason]||A.system.id.localeCompare(k.system.id))[0],{system:d,matchReason:g,endpointMatches:p,connected:b}=u;return p?{templateName:i.key,status:b?"connected":"system_only",system:d,matchReason:g}:{templateName:i.key,status:"conflict",system:d,matchReason:g,systemIds:[d.id]}})}}function Vu(o){if(o.templateName&&fe.systems[o.templateName])return{key:o.templateName,template:fe.systems[o.templateName]};if(o.id&&fe.systems[o.id])return{key:o.id,template:fe.systems[o.id]};if(o.id){let e=o.id.replace(/-\d+$/,"");if(e!==o.id&&fe.systems[e])return{key:e,template:fe.systems[e]}}if(o.name&&fe.systems[o.name])return{key:o.name,template:fe.systems[o.name]};if(o.url){let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(o.url)?o.url:`https://${o.url}`,t=[];for(let[a,i]of Object.entries(fe.systems))try{if(new RegExp(i.regex).test(e)){let r=i.regex.length+(i.regex.includes("(?!")?100:0);t.push({key:a,template:i,specificity:r})}}catch{console.error(`Invalid regex pattern for system: ${a}`)}if(t.length>0){let a=t.sort((i,r)=>r.specificity-i.specificity)[0];return{key:a.key,template:a.template}}}return null}function kY(o){return!o||o.length===0?[]:[...new Set(o)]}function AY(o){return fe.systems[o]?.oauth||null}function wY(o){let e=bb(o),t=e.type==="oauth2"?e.config||{}:{},a=o.credentials||{},i=Vu(o)?.template.oauth,r=a.tokenAuthMethod,s=t.tokenAuthMethod,n=a.tokenContentType,c=t.tokenContentType,m=i?.extraHeaders,l=i?.extraBodyParams,u=(0,Yu.parseJsonRecord)(t.extraHeaders),d=(0,Yu.parseJsonRecord)(t.extraBodyParams),g=(0,Yu.parseJsonRecord)(a.extraHeaders),p=(0,Yu.parseJsonRecord)(a.extraBodyParams);return g&&(m=g),p&&(l=p),u&&(m=u),d&&(l=d),{tokenAuthMethod:s==="body"||s==="basic_auth"?s:r==="body"||r==="basic_auth"?r:i?.tokenAuthMethod,tokenContentType:c==="form"||c==="json"?c:n==="form"||n==="json"?n:i?.tokenContentType,extraHeaders:m,extraBodyParams:l}}function vY(o){let e=bb(o);if(e.type==="oauth2"&&e.tokenUrl)return e.tokenUrl;let t=Vu(o)?.template.oauth;if(t?.tokenUrl)return t.tokenUrl;if(!o.url)throw new Error(`Cannot determine OAuth token URL for system ${o.id}: no url or token_url provided`);try{return`${new URL(o.url.startsWith("http")?o.url:`https://${o.url}`).origin}/oauth/token`}catch{return`${o.url}/oauth/token`}}});var W2=y(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.KNOWLEDGE_BASE_CHANGE_LABEL=oo.SYSTEM_PLAYGROUND_DRAFT_ID=void 0;oo.normalizeSystemKnowledgeBaseInput=$2;oo.getSystemFieldDisplayLabel=CY;oo.formatSystemChangePreview=$u;oo.formatCredentialDisplayValue=jY;oo.buildMergedSystemPlaygroundConfig=BY;oo.summarizeSystemPlaygroundChanges=QY;oo.convertUploadToClientPayload=SY;var V2=Mc(),Ms=Kt(),xY=yb(),zY=/\.(json|yaml|yml)$|openapi|swagger|\/v[23]\//i;oo.SYSTEM_PLAYGROUND_DRAFT_ID="@playground-draft";oo.KNOWLEDGE_BASE_CHANGE_LABEL="Knowledge base";var qY={name:"Display name",url:"System endpoint",instructions:"Usage instructions",specificinstructions:"Usage instructions",credentialownership:"Credential source",credentialmode:"Credential source"};function EY(o,e){return o==="openapi"||o==="scrape"?o:zY.test(e)?"openapi":"scrape"}function br(o){return Array.isArray(o)?[...new Set(o.map(e=>String(e||"").trim()).filter(Boolean))]:[]}function $2(o){let e=o?.knowledgeBase&&typeof o.knowledgeBase=="object"&&!Array.isArray(o.knowledgeBase)?o.knowledgeBase:null,t=typeof e?.files=="string"&&e.files.trim().length>0?e.files:void 0,a=[];if(Array.isArray(e?.addUrls))for(let s of e.addUrls){if(!s||typeof s!="object")continue;let n=s.url;if(typeof n!="string")continue;let c=n.trim();c&&a.push({url:c,source:EY(s.source,c)})}let i=new Set,r=a.filter(s=>{let n=`${s.source}:${s.url.toLowerCase()}`;return i.has(n)?!1:(i.add(n),!0)});return{...t?{files:t}:{},urls:r,removeDocumentIds:br(e?.removeDocumentIds)}}function IY(o){return o.replace(/^\/+/,"").replace(/\s+/g,"").toLowerCase()}function H2(o){return o.length>240?`${o.slice(0,240)}...`:o}function G2(o){return o?o.type==="api_key"?"API key":o.type==="basic_auth"?"Basic auth":o.type==="connection_string"?"Connection string":o.type==="oauth2"?"OAuth 2.0":"No auth":"None"}function Y2(o){let e=o.authentication;if(e?.type!=="oauth2")return null;let t=o.templateName?xY.systems[o.templateName]?.oauth:void 0,a=(0,V2.resolveOAuthClientMode)({authentication:e,templateClientId:t?.client_id,templateRegistrationUrl:t?.registrationUrl});return a==="managed"?"superglue-managed":a==="dynamic"?"Automatic registration":"Custom"}function CY(o){let e=o.trim();if(!e)return"System";let t="Credential \xB7 ";if(e.startsWith(t))return e.slice(t.length);let a=IY(e);return a==="knowledgebase"?oo.KNOWLEDGE_BASE_CHANGE_LABEL:qY[a]||e}function $u(o,e="(empty)"){if(o==null||o==="")return e;if(typeof o=="string"){let t=o.trim();return t?H2(t):e}return typeof o=="number"||typeof o=="boolean"?String(o):H2((0,Ms.safeStringify)(o,0))}function jY(o,e){return e==null||e===""?"(empty)":(0,Ms.isSensitiveCredentialKey)(o)?typeof e=="object"?"****":(0,Ms.maskCredentialValue)(o,e)||"(empty)":$u(e)}function BY({draft:o,input:e}){let{draftId:t,documentationUrl:a,openApiUrl:i,files:r,knowledgeBase:s,removeDocumentIds:n,removeCredentialKeys:c,scrapeUrl:m,scrapeKeywords:l,endpoint:u,auth:d,credentials:g,requiredCredentialKeys:p,tags:b,...A}=e||{},k=o.system,x=d!==void 0?(0,V2.mergeAgentAuthInput)(k.authentication,d):void 0,v=A.name??k.name,j=v?(0,Ms.slugify)(v):"",I=A.id??(k.id||j),D=!!x||A.authentication!==void 0?x||A.authentication:k.authentication;return{id:I,name:v,url:u??A.url??k.url,templateName:A.templateName??k.templateName,icon:A.icon??k.icon,tags:b!==void 0?br(b):k.tags,specificInstructions:A.specificInstructions??k.specificInstructions,requiredCredentialKeys:p!==void 0?br(p):k.requiredCredentialKeys,authentication:D,tunnel:A.tunnel!==void 0?A.tunnel:k.tunnel}}function QY({previous:o,next:e,input:t}){let a=[],i=(s,n,c)=>{(n||"")!==(c||"")&&a.push({label:s,value:`${$u(n)} -> ${$u(c)}`})};for(let[s,n,c]of[["Display name",o.name,e.name],["System endpoint",o.url,e.url],["Template",o.templateName,e.templateName],["Icon",o.icon,e.icon],["Usage instructions",o.specificInstructions,e.specificInstructions],["Required secrets",br(o.requiredCredentialKeys).join(", "),br(e.requiredCredentialKeys).join(", ")],["Tags",br(o.tags).join(", "),br(e.tags).join(", ")]])i(s,n,c);if((0,Ms.safeStringify)(o.authentication||null,0)!==(0,Ms.safeStringify)(e.authentication||null,0)){let s=Y2(o),n=Y2(e);s&&n&&s!==n&&a.push({label:"OAuth client",value:`${s} -> ${n}`});let c=G2(o.authentication),m=G2(e.authentication);a.push({label:"Authentication configuration",value:c===m?`Updated ${m} settings`:`${c} -> ${m}`})}let r=$2(t);r.files&&a.push({label:oo.KNOWLEDGE_BASE_CHANGE_LABEL,value:"Documentation file uploads staged"});for(let s of r.urls)a.push({label:oo.KNOWLEDGE_BASE_CHANGE_LABEL,value:s.source==="openapi"?`OpenAPI URL staged: ${s.url}`:`Documentation URL staged: ${s.url}`});for(let s of r.removeDocumentIds)a.push({label:oo.KNOWLEDGE_BASE_CHANGE_LABEL,value:`Document removed: ${s}`});return a}async function SY(o){if(o.sourceKind==="resolved-payload"&&o.content!==void 0)return{fileName:o.fileName,content:o.content,contentType:o.contentType,contentLength:o.contentLength};if(o.file)return{fileName:o.fileName,content:o.file,contentType:o.contentType,contentLength:o.contentLength};throw new Error(`Missing upload content for ${o.fileName}`)}});var X2=y(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.PAGINATION_RUNTIME_KEYS=no.RESERVED_RUNTIME_KEYS=void 0;no.getToolDeclaredInputKeys=K2;no.toolHasActivePagination=kb;no.collectToolKeyCollisions=RY;no.formatToolKeyCollisionError=NY;no.getCollidingRuntimePayloadKeys=UY;no.formatPayloadKeyCollisionError=OY;var DY=rt(),J2=Kt();no.RESERVED_RUNTIME_KEYS=["__files__","currentItem","sg_auth_email","sg_auth_jwt","persistedState"];no.PAGINATION_RUNTIME_KEYS=["page","offset","cursor","limit","pageSize"];function TY(o){if(!o)return null;if(typeof o=="string")try{let e=JSON.parse(o);return e&&typeof e=="object"?e:null}catch{return null}return typeof o=="object"?o:null}function K2(o){let t=TY(o)?.properties;if(!t||typeof t!="object")return[];let a=Object.keys(t),i=t.payload;return i&&t.credentials&&a.every(s=>s==="payload"||s==="credentials")?i&&typeof i=="object"&&i.properties&&typeof i.properties=="object"?Object.keys(i.properties):[]:a}function kb(o){return(o.steps||[]).some(e=>(0,DY.isRequestConfig)(e.config)&&e.config.pagination&&e.config.pagination.type!=="disabled")}function Z2(o){return o==="__files__"?"the runtime file map":o==="currentItem"?"the loop iteration variable":o==="sg_auth_email"?"the authenticated user's email":o==="sg_auth_jwt"?"a signed JWT proving the authenticated user's identity":o==="persistedState"?"the persistent tool state object":"a runtime-injected value"}function RY({tool:o}){let e=[],t=K2(o.inputSchema),a=(o.steps||[]).map(u=>u.id).filter(Boolean),i=kb(o),r=new Set(no.RESERVED_RUNTIME_KEYS),s=new Set(no.PAGINATION_RUNTIME_KEYS),n=(0,J2.getToolSystemIds)(o).map(u=>`${u}_`),c=new Set;for(let u of a)c.has(u)&&e.push({key:u,source:"stepId",kind:"duplicate-step-id",message:`Step id "${u}" is used by more than one step. Each step result is stored under its step id, so duplicate ids overwrite each other. Rename one of the steps.`}),c.add(u);let m=(u,d)=>{let g=d==="input"?`Input "${u}"`:`Step id "${u}"`;r.has(u)&&e.push({key:u,source:d,kind:"reserved",message:`${g} collides with ${Z2(u)}, which the runtime injects into sourceData. Choose a different name.`}),i&&s.has(u)&&e.push({key:u,source:d,kind:"pagination",message:`${g} collides with the pagination variable "${u}" and this tool has a paginated step, so the value would override the runtime's pagination counter. Rename it (e.g. "max_results" instead of "limit").`});let p=n.find(b=>u.startsWith(b));p&&e.push({key:u,source:d,kind:"credential",message:`${g} starts with "${p}", the credential namespace of a system this tool uses. Credentials always win over payload values, so this name is reserved even if no such credential exists yet. Choose a name without the system prefix.`})};for(let u of t)m(u,"input");for(let u of c)m(u,"stepId");let l=new Set(a);for(let u of t)l.has(u)&&e.push({key:u,source:"input",kind:"step-id",message:`Input "${u}" has the same name as a step id. The step result overwrites the input value in sourceData after that step runs. Rename the input or the step.`});return e}function NY(o){let e=o.map(t=>`- ${t.message}`);return`Tool has ${o.length} key name collision${o.length===1?"":"s"} with the runtime namespace:
871
+ DEPRECATED ENDPOINTS: GET /user/{email} and GET /members are deprecated; use V2 equivalents instead.`},teamcity:{name:"teamcity",apiUrl:"https://{host}/app/rest",regex:"^.*(teamcity|jetbrains[\\s._-]?teamcity|\\/app\\/rest).*$",icon:"teamcity",docsUrl:"https://www.jetbrains.com/help/teamcity/rest/teamcity-rest-api-documentation.html",preferredAuthType:"api_key",keywords:["builds","projects","agents","artifacts","vcs roots","build configurations","build chains","test reports","deployments"],systemSpecificInstructions:"TeamCity is self-hosted; the API base URL is https://{host}/app/rest where {host} is your TeamCity server hostname. Tokens are personal access tokens created per-user under My Settings & Tools \u2192 Access Tokens \u2014 not a global admin panel. Use as Authorization: Bearer <token>. The OpenAPI spec is available at runtime on the server itself at /app/rest/swagger.json. Basic auth is available via /httpAuth/app/rest/... as a fallback. The API version segment (e.g. /app/rest/2018.1/...) is optional; omitting it uses the latest version."},expensify:{name:"expensify",apiUrl:"https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations",regex:"^.*(expensify|integrations\\.expensify\\.com).*$",icon:"expensify",docsUrl:"https://integrations.expensify.com/Integration-Server/doc/",preferredAuthType:"api_key",keywords:["report","expense","policy","employee","category","tag","card","domain","receipt","transaction","approver","reimbursement"],systemSpecificInstructions:`Expensify uses a non-standard single-endpoint API: all requests are POSTs to https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations with credentials (partnerUserID and partnerUserSecret) embedded in the JSON body under a "credentials" key, not in headers. Obtain partnerUserID and partnerUserSecret exclusively from https://www.expensify.com/tools/integrations/ \u2014 this page is not reachable from the main account settings. Report creation requires explicit enablement by emailing concierge@expensify.com. The card reconciliation export requires the credentials to belong to a domain admin account. To operate on another user's data via the "userEmail" parameter, that user must first grant third-party access to your partner account.`},dhl:{name:"dhl",apiUrl:"https://api-eu.dhl.com/track/shipments",regex:"^.*(dhl|api-eu\\.dhl\\.com|dhl[\\s._-]?tracking).*$",icon:"simpleicons:dhl",docsUrl:"https://developer.dhl.com/api-reference/shipment-tracking",preferredAuthType:"api_key",keywords:["tracking","shipment","trackingNumber","events","status","carrier","parcel","logistics","origin","destination"],systemSpecificInstructions:"Auth header is DHL-API-Key, not a generic Authorization header \u2014 get the key by registering an app on developer.dhl.com (free tier works for tracking). The apiUrl covers the EU region host; other DHL developer-portal products (e.g. Parcel DE Shipping) use different base paths and credentials and are not covered by this template."},weclapp:{name:"weclapp",apiUrl:"https://{tenant}.weclapp.com/webapp/api/v2",regex:"^.*(weclapp).*$",icon:"lucide:building-2",docsUrl:"https://www.weclapp.com/api/",openApiUrl:"https://www.weclapp.com/api/swagger.json",preferredAuthType:"api_key",keywords:["party","customer","supplier","salesOrder","salesInvoice","article","purchaseOrder","shipment","quotation","ticket","warehouseStock","accountingTransaction"],systemSpecificInstructions:"Auth header is AuthenticationToken (not Bearer or Basic) \u2014 generate it in the weclapp UI under user settings. {tenant} is the subdomain of your weclapp instance (e.g. mycompany for mycompany.weclapp.com)."},windchill:{name:"windchill",apiUrl:"https://{host}/Windchill/servlet/odata",regex:"^.*(windchill|ptc[\\s._-]?windchill).*$",icon:"/logos/ptc.svg",docsUrl:"https://support.ptc.com/help/windchill/r13.1.2.0/en/Windchill_Help_Center/middlemap_landingpages/WCRESTServices_LP.html",preferredAuthType:"basic_auth",keywords:["odata","plm","changeMgmt","changeNotices","parts","documents","cadDocuments","productStructure","workflow"],systemSpecificInstructions:"Windchill OData REST Services must be enabled by a Windchill administrator before any endpoint responds. Basic Auth alone works for GET requests; POST/PUT/PATCH/DELETE calls additionally require first fetching a CSRF_NONCE from the GetCSRFToken endpoint and sending it as a request header, or writes fail with 401/403. {host} is the self-hosted Windchill instance; there is no public multi-tenant host or OpenAPI spec."},pinterestAds:{name:"pinterestAds",label:"Pinterest Ads",apiUrl:"https://api.pinterest.com/v5",regex:"^.*(pinterest).*$",icon:"simpleicons:pinterest",docsUrl:"https://developers.pinterest.com/docs/api/v5/",openApiUrl:"https://raw.githubusercontent.com/pinterest/api-description/main/v5/openapi.yaml",preferredAuthType:"oauth2",oauth:{authUrl:"https://www.pinterest.com/oauth/",tokenUrl:"https://api.pinterest.com/v5/oauth/token",scopes:"ads:read user_accounts:read",grant_type:"authorization_code",tokenAuthMethod:"basic_auth",tokenContentType:"form"},keywords:["ad_accounts","campaigns","ad_groups","ads","analytics","audiences","conversion_tags","catalogs","reports","spend","roas"],systemSpecificInstructions:"Requires a registered app in the Pinterest developer portal (with at least one redirect URI) to get a client ID/secret. Token exchange uses HTTP Basic Auth with the client credentials, not body params."},openMeteo:{name:"openMeteo",label:"Open-Meteo",apiUrl:"https://api.open-meteo.com",regex:"^.*(open-meteo|open_meteo|openmeteo).*$",icon:"lucide:cloud-sun",docsUrl:"https://open-meteo.com/en/docs",preferredAuthType:"none",keywords:["forecast","geocoding","temperature","precipitation","wind","humidity","air quality","marine","elevation","hourly","daily"],systemSpecificInstructions:"Free tier needs no auth (rate-limited only). Geocoding lives on a separate host, geocoding-api.open-meteo.com, not under /v1/forecast. A paid commercial tier exists on a different host, customer-api.open-meteo.com, and requires an apikey query parameter \u2014 the base URL itself changes, not just the auth."},openWeatherMap:{name:"openWeatherMap",label:"OpenWeatherMap",apiUrl:"https://api.openweathermap.org",regex:"^.*(openweathermap|openweather).*$",icon:"lucide:cloud-sun",docsUrl:"https://openweathermap.org/api",preferredAuthType:"api_key",keywords:["forecast","current weather","temperature","precipitation","wind","humidity","air pollution","alerts","geocoding","onecall"],systemSpecificInstructions:"API key is passed as the query parameter appid, not a header. New keys can take up to 2 hours to activate and return 401 until then. The premium One Call 3.0 endpoint (/data/3.0/onecall) requires a separate subscription enrollment even for existing account holders; the free key only covers the older /data/2.5 endpoints."}};fe.systemOptions=[{value:"manual",label:"Custom API",icon:"default"},...Object.entries(fe.systems).map(([o,e])=>({value:o,label:o.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()).trim(),icon:e.icon||"default"}))];function F2(o){return Object.entries(gY.contextSourceTemplates).filter(([,e])=>!o||e.category===o).map(([e,t])=>({key:e,template:{...fe.systems[e],contextSource:t}})).sort((e,t)=>e.template.contextSource.onboardingOrder-t.template.contextSource.onboardingOrder)}function M2(o){let e=(o||"").trim();if(!e)return"";try{let t=new URL(e),a=t.pathname.replace(/\/+$/,"");return`${t.protocol.toLowerCase()}//${t.host.toLowerCase()}${a}${t.search}`}catch{return e.replace(/\/+$/,"").toLowerCase()}}function P2(o,e){let t=M2(o);return[e.apiUrl,...e.contextSource.endpointAliases||[]].some(a=>M2(a)===t)}function fY({system:o,sourceTemplate:e}){let{key:t,template:a}=e;if(o.id===a.contextSource.systemId)return"canonical_id";if(o.templateName===t)return"template_name";let i=new Set([t,a.name,a.label].filter(s=>!!s).map(s=>s.trim().toLowerCase())),r=P2(o.url,a);if(o.id===t||r&&i.has((o.name||"").toLowerCase()))return"legacy_identity"}function bY(o,e){return o.some(t=>t.isOwner&&t.systemId===e&&t.credentialKeys.some(a=>(a.key==="access_token"||a.key==="accessToken")&&a.hasValue))}function yY({systemList:o,credentialSets:e,category:t}){return{sources:F2(t).map(i=>{let r=o.map(A=>({system:A,matchReason:fY({system:A,sourceTemplate:i}),endpointMatches:P2(A.url,i.template),connected:bY(e,A.id)})).filter(A=>!!A.matchReason);if(r.length===0)return{templateName:i.key,status:"missing"};let s=r.filter(({endpointMatches:A})=>A),n=s.length>0?s:r,c=n.filter(({connected:A})=>A),m=c.length>0?c:n,l={canonical_id:3,template_name:2,legacy_identity:1},u=[...m].sort((A,k)=>l[k.matchReason]-l[A.matchReason]||A.system.id.localeCompare(k.system.id))[0],{system:d,matchReason:g,endpointMatches:p,connected:b}=u;return p?{templateName:i.key,status:b?"connected":"system_only",system:d,matchReason:g}:{templateName:i.key,status:"conflict",system:d,matchReason:g,systemIds:[d.id]}})}}function Vu(o){if(o.templateName&&fe.systems[o.templateName])return{key:o.templateName,template:fe.systems[o.templateName]};if(o.id&&fe.systems[o.id])return{key:o.id,template:fe.systems[o.id]};if(o.id){let e=o.id.replace(/-\d+$/,"");if(e!==o.id&&fe.systems[e])return{key:e,template:fe.systems[e]}}if(o.name&&fe.systems[o.name])return{key:o.name,template:fe.systems[o.name]};if(o.url){let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(o.url)?o.url:`https://${o.url}`,t=[];for(let[a,i]of Object.entries(fe.systems))try{if(new RegExp(i.regex).test(e)){let r=i.regex.length+(i.regex.includes("(?!")?100:0);t.push({key:a,template:i,specificity:r})}}catch{console.error(`Invalid regex pattern for system: ${a}`)}if(t.length>0){let a=t.sort((i,r)=>r.specificity-i.specificity)[0];return{key:a.key,template:a.template}}}return null}function kY(o){return!o||o.length===0?[]:[...new Set(o)]}function AY(o){return fe.systems[o]?.oauth||null}function wY(o){let e=bb(o),t=e.type==="oauth2"?e.config||{}:{},a=o.credentials||{},i=Vu(o)?.template.oauth,r=a.tokenAuthMethod,s=t.tokenAuthMethod,n=a.tokenContentType,c=t.tokenContentType,m=i?.extraHeaders,l=i?.extraBodyParams,u=(0,Yu.parseJsonRecord)(t.extraHeaders),d=(0,Yu.parseJsonRecord)(t.extraBodyParams),g=(0,Yu.parseJsonRecord)(a.extraHeaders),p=(0,Yu.parseJsonRecord)(a.extraBodyParams);return g&&(m=g),p&&(l=p),u&&(m=u),d&&(l=d),{tokenAuthMethod:s==="body"||s==="basic_auth"?s:r==="body"||r==="basic_auth"?r:i?.tokenAuthMethod,tokenContentType:c==="form"||c==="json"?c:n==="form"||n==="json"?n:i?.tokenContentType,extraHeaders:m,extraBodyParams:l}}function vY(o){let e=bb(o);if(e.type==="oauth2"&&e.tokenUrl)return e.tokenUrl;let t=Vu(o)?.template.oauth;if(t?.tokenUrl)return t.tokenUrl;if(!o.url)throw new Error(`Cannot determine OAuth token URL for system ${o.id}: no url or token_url provided`);try{return`${new URL(o.url.startsWith("http")?o.url:`https://${o.url}`).origin}/oauth/token`}catch{return`${o.url}/oauth/token`}}});var W2=y(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.KNOWLEDGE_BASE_CHANGE_LABEL=oo.SYSTEM_PLAYGROUND_DRAFT_ID=void 0;oo.normalizeSystemKnowledgeBaseInput=$2;oo.getSystemFieldDisplayLabel=CY;oo.formatSystemChangePreview=$u;oo.formatCredentialDisplayValue=jY;oo.buildMergedSystemPlaygroundConfig=BY;oo.summarizeSystemPlaygroundChanges=QY;oo.convertUploadToClientPayload=SY;var V2=Mc(),Ms=Kt(),xY=yb(),zY=/\.(json|yaml|yml)$|openapi|swagger|\/v[23]\//i;oo.SYSTEM_PLAYGROUND_DRAFT_ID="@playground-draft";oo.KNOWLEDGE_BASE_CHANGE_LABEL="Knowledge base";var qY={name:"Display name",url:"System endpoint",instructions:"Usage instructions",specificinstructions:"Usage instructions",credentialownership:"Credential source",credentialmode:"Credential source"};function EY(o,e){return o==="openapi"||o==="scrape"?o:zY.test(e)?"openapi":"scrape"}function br(o){return Array.isArray(o)?[...new Set(o.map(e=>String(e||"").trim()).filter(Boolean))]:[]}function $2(o){let e=o?.knowledgeBase&&typeof o.knowledgeBase=="object"&&!Array.isArray(o.knowledgeBase)?o.knowledgeBase:null,t=typeof e?.files=="string"&&e.files.trim().length>0?e.files:void 0,a=[];if(Array.isArray(e?.addUrls))for(let s of e.addUrls){if(!s||typeof s!="object")continue;let n=s.url;if(typeof n!="string")continue;let c=n.trim();c&&a.push({url:c,source:EY(s.source,c)})}let i=new Set,r=a.filter(s=>{let n=`${s.source}:${s.url.toLowerCase()}`;return i.has(n)?!1:(i.add(n),!0)});return{...t?{files:t}:{},urls:r,removeDocumentIds:br(e?.removeDocumentIds)}}function IY(o){return o.replace(/^\/+/,"").replace(/\s+/g,"").toLowerCase()}function H2(o){return o.length>240?`${o.slice(0,240)}...`:o}function G2(o){return o?o.type==="api_key"?"API key":o.type==="basic_auth"?"Basic auth":o.type==="connection_string"?"Connection string":o.type==="oauth2"?"OAuth 2.0":"No auth":"None"}function Y2(o){let e=o.authentication;if(e?.type!=="oauth2")return null;let t=o.templateName?xY.systems[o.templateName]?.oauth:void 0,a=(0,V2.resolveOAuthClientMode)({authentication:e,templateClientId:t?.client_id,templateRegistrationUrl:t?.registrationUrl});return a==="managed"?"superglue-managed":a==="dynamic"?"Automatic registration":"Custom"}function CY(o){let e=o.trim();if(!e)return"System";let t="Credential \xB7 ";if(e.startsWith(t))return e.slice(t.length);let a=IY(e);return a==="knowledgebase"?oo.KNOWLEDGE_BASE_CHANGE_LABEL:qY[a]||e}function $u(o,e="(empty)"){if(o==null||o==="")return e;if(typeof o=="string"){let t=o.trim();return t?H2(t):e}return typeof o=="number"||typeof o=="boolean"?String(o):H2((0,Ms.safeStringify)(o,0))}function jY(o,e){return e==null||e===""?"(empty)":(0,Ms.isSensitiveCredentialKey)(o)?typeof e=="object"?"****":(0,Ms.maskCredentialValue)(o,e)||"(empty)":$u(e)}function BY({draft:o,input:e}){let{draftId:t,documentationUrl:a,openApiUrl:i,files:r,knowledgeBase:s,removeDocumentIds:n,removeCredentialKeys:c,scrapeUrl:m,scrapeKeywords:l,endpoint:u,auth:d,credentials:g,requiredCredentialKeys:p,tags:b,...A}=e||{},k=o.system,x=d!==void 0?(0,V2.mergeAgentAuthInput)(k.authentication,d):void 0,v=A.name??k.name,j=v?(0,Ms.slugify)(v):"",I=A.id??(k.id||j),D=!!x||A.authentication!==void 0?x||A.authentication:k.authentication;return{id:I,name:v,url:u??A.url??k.url,templateName:A.templateName??k.templateName,icon:A.icon??k.icon,tags:b!==void 0?br(b):k.tags,specificInstructions:A.specificInstructions??k.specificInstructions,requiredCredentialKeys:p!==void 0?br(p):k.requiredCredentialKeys,authentication:D,tunnel:A.tunnel!==void 0?A.tunnel:k.tunnel}}function QY({previous:o,next:e,input:t}){let a=[],i=(s,n,c)=>{(n||"")!==(c||"")&&a.push({label:s,value:`${$u(n)} -> ${$u(c)}`})};for(let[s,n,c]of[["Display name",o.name,e.name],["System endpoint",o.url,e.url],["Template",o.templateName,e.templateName],["Icon",o.icon,e.icon],["Usage instructions",o.specificInstructions,e.specificInstructions],["Required secrets",br(o.requiredCredentialKeys).join(", "),br(e.requiredCredentialKeys).join(", ")],["Tags",br(o.tags).join(", "),br(e.tags).join(", ")]])i(s,n,c);if((0,Ms.safeStringify)(o.authentication||null,0)!==(0,Ms.safeStringify)(e.authentication||null,0)){let s=Y2(o),n=Y2(e);s&&n&&s!==n&&a.push({label:"OAuth client",value:`${s} -> ${n}`});let c=G2(o.authentication),m=G2(e.authentication);a.push({label:"Authentication configuration",value:c===m?`Updated ${m} settings`:`${c} -> ${m}`})}let r=$2(t);r.files&&a.push({label:oo.KNOWLEDGE_BASE_CHANGE_LABEL,value:"Documentation file uploads staged"});for(let s of r.urls)a.push({label:oo.KNOWLEDGE_BASE_CHANGE_LABEL,value:s.source==="openapi"?`OpenAPI URL staged: ${s.url}`:`Documentation URL staged: ${s.url}`});for(let s of r.removeDocumentIds)a.push({label:oo.KNOWLEDGE_BASE_CHANGE_LABEL,value:`Document removed: ${s}`});return a}async function SY(o){if(o.sourceKind==="resolved-payload"&&o.content!==void 0)return{fileName:o.fileName,content:o.content,contentType:o.contentType,contentLength:o.contentLength};if(o.file)return{fileName:o.fileName,content:o.file,contentType:o.contentType,contentLength:o.contentLength};throw new Error(`Missing upload content for ${o.fileName}`)}});var X2=y(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.PAGINATION_RUNTIME_KEYS=no.RESERVED_RUNTIME_KEYS=void 0;no.getToolDeclaredInputKeys=K2;no.toolHasActivePagination=kb;no.collectToolKeyCollisions=RY;no.formatToolKeyCollisionError=NY;no.getCollidingRuntimePayloadKeys=UY;no.formatPayloadKeyCollisionError=OY;var DY=rt(),J2=Kt();no.RESERVED_RUNTIME_KEYS=["__files__","currentItem","sg_auth_email","sg_auth_jwt","persistedState"];no.PAGINATION_RUNTIME_KEYS=["page","offset","cursor","limit","pageSize"];function TY(o){if(!o)return null;if(typeof o=="string")try{let e=JSON.parse(o);return e&&typeof e=="object"?e:null}catch{return null}return typeof o=="object"?o:null}function K2(o){let t=TY(o)?.properties;if(!t||typeof t!="object")return[];let a=Object.keys(t),i=t.payload;return i&&t.credentials&&a.every(s=>s==="payload"||s==="credentials")?i&&typeof i=="object"&&i.properties&&typeof i.properties=="object"?Object.keys(i.properties):[]:a}function kb(o){return(o.steps||[]).some(e=>(0,DY.isRequestConfig)(e.config)&&e.config.pagination&&e.config.pagination.type!=="disabled")}function Z2(o){return o==="__files__"?"the runtime file map":o==="currentItem"?"the loop iteration variable":o==="sg_auth_email"?"the authenticated user's email":o==="sg_auth_jwt"?"a signed JWT proving the authenticated user's identity":o==="persistedState"?"the persistent tool state object":"a runtime-injected value"}function RY({tool:o}){let e=[],t=K2(o.inputSchema),a=(o.steps||[]).map(u=>u.id).filter(Boolean),i=kb(o),r=new Set(no.RESERVED_RUNTIME_KEYS),s=new Set(no.PAGINATION_RUNTIME_KEYS),n=(0,J2.getToolSystemIds)(o).map(u=>`${u}_`),c=new Set;for(let u of a)c.has(u)&&e.push({key:u,source:"stepId",kind:"duplicate-step-id",message:`Step id "${u}" is used by more than one step. Each step result is stored under its step id, so duplicate ids overwrite each other. Rename one of the steps.`}),c.add(u);let m=(u,d)=>{let g=d==="input"?`Input "${u}"`:`Step id "${u}"`;r.has(u)&&e.push({key:u,source:d,kind:"reserved",message:`${g} collides with ${Z2(u)}, which the runtime injects into sourceData. Choose a different name.`}),i&&s.has(u)&&e.push({key:u,source:d,kind:"pagination",message:`${g} collides with the pagination variable "${u}" and this tool has a paginated step, so the value would override the runtime's pagination counter. Rename it (e.g. "max_results" instead of "limit").`});let p=n.find(b=>u.startsWith(b));p&&e.push({key:u,source:d,kind:"credential",message:`${g} starts with "${p}", the credential namespace of a system this tool uses. Credentials always win over payload values, so this name is reserved even if no such credential exists yet. Choose a name without the system prefix.`})};for(let u of t)m(u,"input");for(let u of c)m(u,"stepId");let l=new Set(a);for(let u of t)l.has(u)&&e.push({key:u,source:"input",kind:"step-id",message:`Input "${u}" has the same name as a step id. The step result overwrites the input value in sourceData after that step runs. Rename the input or the step.`});return e}function NY(o){let e=o.map(t=>`- ${t.message}`);return`Tool has ${o.length} key name collision${o.length===1?"":"s"} with the runtime namespace:
872
872
  ${e.join(`
873
873
  `)}`}function UY({payload:o,tool:e}){let t=[],a=new Set(no.RESERVED_RUNTIME_KEYS),i=new Set(no.PAGINATION_RUNTIME_KEYS),r=new Set((e.steps||[]).map(c=>c.id).filter(Boolean)),s=kb(e),n=(0,J2.getToolSystemIds)(e).map(c=>`${c}_`);for(let c of Object.keys(o)){a.has(c)&&t.push({key:c,kind:"reserved",message:`Payload key "${c}" collides with ${Z2(c)}, which the runtime injects into sourceData. Remove or rename it.`}),r.has(c)&&t.push({key:c,kind:"step-id",message:`Payload key "${c}" has the same name as a step id. The step result overwrites the payload value in sourceData after that step runs. Remove or rename it.`}),s&&i.has(c)&&t.push({key:c,kind:"pagination",message:`Payload key "${c}" collides with a pagination variable and this tool has a paginated step, so it would override the runtime's pagination counter. Remove or rename it.`});let m=n.find(l=>c.startsWith(l));m&&t.push({key:c,kind:"credential",message:`Payload key "${c}" starts with "${m}", the credential namespace of a system this tool uses. Credentials always win over payload values. Remove or rename it.`})}return t}function OY(o){let e=o.map(t=>`- ${t.message}`);return`Payload has ${o.length} key name collision${o.length===1?"":"s"} with the runtime namespace:
874
874
  ${e.join(`
@@ -1411,7 +1411,7 @@ ${r}`;break;case"retry":S5(r)&&(t[i]=r);break;case"id":D5(r)&&(t[i]=r);break;cas
1411
1411
  `);o.stack=t?`${t}
1412
1412
  ${r}`:i.stack}Q.exports.fetch=function(e,t=void 0){return rme(e,t).catch(a=>{throw H5?$5(a,H5):a&&typeof a=="object"&&Error.captureStackTrace(a,Q.exports.fetch),a})};Q.exports.Headers=$r().Headers;Q.exports.Response=Fm().Response;Q.exports.Request=An().Request;Q.exports.FormData=hd().FormData;var{setGlobalOrigin:sme,getGlobalOrigin:nme}=qy();Q.exports.setGlobalOrigin=sme;Q.exports.getGlobalOrigin=nme;var{CacheStorage:cme}=B9(),{kConstruct:mme}=de();Q.exports.caches=new cme(mme);var{deleteCookie:lme,getCookies:ume,getSetCookies:dme,setCookie:gme,parseCookie:pme}=F9();Q.exports.deleteCookie=lme;Q.exports.getCookies=ume;Q.exports.getSetCookies=dme;Q.exports.setCookie=gme;Q.exports.parseCookie=pme;var{parseMIMEType:hme,serializeAMimeType:fme}=bt();Q.exports.parseMIMEType=hme;Q.exports.serializeAMimeType=fme;var{CloseEvent:bme,ErrorEvent:yme,MessageEvent:kme}=Tg(),{WebSocket:Ame,ping:wme}=w5();Q.exports.WebSocket=Ame;Q.exports.CloseEvent=bme;Q.exports.ErrorEvent=yme;Q.exports.MessageEvent=kme;Q.exports.ping=wme;Q.exports.WebSocketStream=j5().WebSocketStream;Q.exports.WebSocketError=ov().WebSocketError;Q.exports.request=el(Qn.request);Q.exports.stream=el(Qn.stream);Q.exports.pipeline=el(Qn.pipeline);Q.exports.connect=el(Qn.connect);Q.exports.upgrade=el(Qn.upgrade);Q.exports.MockClient=Vce;Q.exports.MockCallHistory=$ce;Q.exports.MockCallHistoryLog=Wce;Q.exports.MockPool=Kce;Q.exports.MockAgent=Jce;Q.exports.SnapshotAgent=Zce;Q.exports.mockErrors=Xce;var{EventSource:vme}=P5();Q.exports.EventSource=vme;function xme(){globalThis.fetch=Q.exports.fetch,globalThis.Headers=Q.exports.Headers,globalThis.Response=Q.exports.Response,globalThis.Request=Q.exports.Request,globalThis.FormData=Q.exports.FormData,globalThis.WebSocket=Q.exports.WebSocket,globalThis.CloseEvent=Q.exports.CloseEvent,globalThis.ErrorEvent=Q.exports.ErrorEvent,globalThis.MessageEvent=Q.exports.MessageEvent,globalThis.EventSource=Q.exports.EventSource}Q.exports.install=xme});var J5=y(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.SuperglueClient=Dn.SuperglueHttpError=void 0;var Sn=rt(),Va=Jf(),zme=wb(),qme=cI(),Eme=Kt(),$a=Cs(),Ime=wu(),tl=14400*1e3,ol;if(typeof globalThis.process<"u"&&globalThis.process.versions?.node)try{let{Agent:o}=W5();ol=new o({headersTimeout:tl,bodyTimeout:tl})}catch{}var $g=class extends Error{constructor(e,t,a,i){super(e),this.status=t,this.code=a,this.details=i,this.name="SuperglueHttpError"}};Dn.SuperglueHttpError=$g;var nv=class{constructor({apiKey:e,apiEndpoint:t,onInfrastructureError:a,sseTokenProvider:i,tokenProvider:r}){if(!e&&!r)throw new Error("SuperglueClient requires either apiKey or tokenProvider");this.tokenProvider=r??(async()=>e),this.apiEndpoint=t??"https://api.superglue.cloud",this.sseManager=new zme.SSELogSubscriptionManager(this.apiEndpoint,i??this.tokenProvider),this.onInfrastructureError=a}async getApiKey(){return this.tokenProvider()}isInfrastructureError(e){return(0,Eme.isAbortError)(e)?!1:!!(e instanceof TypeError&&e.message.toLowerCase().includes("fetch")||e instanceof Error&&e.name==="TimeoutError")}async restRequest(e,t,a,i,r){let n=await(await this.restResponse({method:e,path:t,body:a,extraHeaders:i,requestInit:r})).text();if(n)return JSON.parse(n)}async restResponse({method:e,path:t,body:a,extraHeaders:i,requestInit:r}){let s=`${this.apiEndpoint.replace(/\/$/,"")}${t}`,n=a!=null,c=typeof FormData<"u"&&a instanceof FormData,l={Authorization:`Bearer ${await this.getApiKey()}`,...i};n&&!c&&e!=="GET"&&(l["Content-Type"]="application/json");let u;try{u=await fetch(s,{...r,method:e,headers:l,body:n?c?a:JSON.stringify(a):void 0,signal:r?.signal??AbortSignal.timeout(tl),...ol?{dispatcher:ol}:{}})}catch(d){throw this.isInfrastructureError(d)&&this.onInfrastructureError?.(),d}if(!u.ok)throw await this.buildHttpError(u);return u}async uploadFiles(e,t){if(typeof t?.process!="boolean")throw new Error("process must be a boolean");if(e.length===0)return[];let a=e.map(l=>({...l,contentLength:l.contentLength??this.getUploadContentLength(l.content)})),r=(await this.restRequest("POST","/v1/files/uploads",{process:t.process,files:a.map(({fileName:l,contentType:u,contentLength:d})=>({fileName:l,contentLength:d,...u?{contentType:u}:{}}))})).data.files;if(r.length!==a.length)throw await Promise.all(r.map(l=>this.deleteFileUpload(l.id).catch(()=>{}))),new Error("Upload response did not match the selected files");let s=await Promise.allSettled(r.map(async(l,u)=>{let d=a[u],g=await fetch(l.uploadUrl,{method:"PUT",body:d.content,headers:d.contentType?{"Content-Type":d.contentType}:void 0,signal:AbortSignal.timeout(Math.min(tl,l.expiresIn*1e3))});if(!g.ok)throw new Error(`Upload failed for ${d.fileName}: ${g.status} ${g.statusText}`);return l.id})),n=s.flatMap(l=>l.status==="fulfilled"?[l.value]:[]),c=new Map;if(n.length>0)try{let l=await this.restRequest("POST","/v1/files/uploads/complete",{fileIds:n});c=new Map(l.data.files.map(u=>[u.id,u]))}catch(l){c=new Map(n.map(u=>[u,{id:u,fileName:a[r.findIndex(d=>d.id===u)]?.fileName||u,contentLength:a[r.findIndex(d=>d.id===u)]?.contentLength||0,status:"failed",error:l instanceof Error?l.message:String(l)}]))}let m=r.map((l,u)=>{let d=s[u],g=a[u];return d.status==="rejected"?{id:l.id,fileName:g.fileName,contentLength:g.contentLength,status:"failed",error:d.reason instanceof Error?d.reason.message:String(d.reason)}:c.get(l.id)||{id:l.id,fileName:g.fileName,contentLength:g.contentLength,status:"failed",error:"Upload completion returned no result"}});return await Promise.all(m.filter(l=>l.status==="failed").map(l=>this.deleteFileUpload(l.id).catch(()=>{}))),m}async deleteFileUpload(e){await this.restRequest("DELETE",`/v1/files/uploads/${encodeURIComponent(e)}`)}getUploadContentLength(e){return typeof e=="string"?new TextEncoder().encode(e).byteLength:e instanceof Uint8Array?e.byteLength:e.size}async buildHttpError(e){e.status>=500&&this.onInfrastructureError?.();let t=await e.text(),a=`HTTP ${e.status}: ${t}`,i,r;try{let s=JSON.parse(t);s&&typeof s=="object"&&!Array.isArray(s)&&(r=s),typeof s?.code=="string"&&(i=s.code);let n=s.error;typeof n=="string"?a=n:n&&typeof n=="object"&&(a=n.message||JSON.stringify(n))}catch{}return new $g(a,e.status,i,r)}async streamRequest(e,t,a){let i=e.includes("?")?"&":"?",r=`${this.apiEndpoint.replace(/\/$/,"")}${e}${i}stream=true`,n={Authorization:`Bearer ${await this.getApiKey()}`,Accept:"text/event-stream","Content-Type":"application/json"},c;try{c=await fetch(r,{method:"POST",headers:n,body:JSON.stringify(t),signal:a??AbortSignal.timeout(tl),...ol?{dispatcher:ol}:{}})}catch(l){throw this.isInfrastructureError(l)&&this.onInfrastructureError?.(),l}if(!c.ok)throw await this.buildHttpError(c);if(!(c.headers.get("content-type")||"").includes("text/event-stream")){let l=await c.text();return l?JSON.parse(l):void 0}try{return await(0,qme.consumeEventStreamResult)(c)}catch(l){throw this.isInfrastructureError(l)&&this.onInfrastructureError?.(),l}}async subscribeToLogsSSE(e={}){return this.sseManager.subscribeToLogs(e)}async disconnect(){await this.sseManager.disconnect()}async getMe(){return this.restRequest("GET","/v1/me")}async completeOnboarding(){return this.restRequest("POST","/v1/me/onboarding/complete")}async runTool(e){let t=await this.restRequest("POST",`/v1/tools/${encodeURIComponent(e.toolId)}/run`,{inputs:e.payload,files:e.files,credentials:e.credentials,includeStepResultData:e.includeStepResultData,options:e.options,runId:e.runId,stateFixture:e.stateFixture},void 0,e.signal?{signal:e.signal}:void 0);return{success:t.status==="success",data:t.data,error:t.error,tool:t.tool,stepResults:t.stepResults?.map(a=>({...a}))||[],...t.fileArtifacts&&t.fileArtifacts.length>0?{fileArtifacts:t.fileArtifacts}:{},...t.metadata?.warnings?.length?{warnings:t.metadata.warnings}:{}}}async runToolConfig(e){let t=e.createRun?"/v1/tools/run?createRun=true":"/v1/tools/run",a=await this.restRequest("POST",t,{tool:e.tool,payload:e.payload,files:e.files,credentials:e.credentials,includeStepResultData:e.includeStepResultData,options:e.options,runId:e.runId,stateFixture:e.stateFixture,executionKind:e.executionKind,parentToolId:e.parentToolId,draftId:e.draftId},e.traceId?{"X-Trace-Id":e.traceId}:void 0,e.signal?{signal:e.signal}:void 0);return{success:a.status?a.status==="success":a.success??!1,data:a.data,error:a.error,tool:a.tool||e.tool,stepResults:a.stepResults?.map(r=>({...r}))||[],...a.fileArtifacts&&a.fileArtifacts.length>0?{fileArtifacts:a.fileArtifacts}:{},...a.metadata?.warnings?.length?{warnings:a.metadata.warnings}:{}}}async abortToolExecution(e){return{success:!0,runId:(await this.restRequest("POST",`/v1/runs/${encodeURIComponent(e)}/cancel`)).runId}}async executeStep({step:e,payload:t,files:a,previousResults:i,credentials:r,options:s,runId:n,systemIds:c,createRun:m,parentToolId:l,stepIndex:u,stepId:d,signal:g,stream:p}){let b={step:e,payload:t,files:a,previousResults:i,credentials:r,options:s,runId:n,systemIds:c,createRun:m,parentToolId:l,stepIndex:u,stepId:d};return p?this.streamRequest("/v1/tools/step/run",b,g):this.restRequest("POST","/v1/tools/step/run",b,void 0,g?{signal:g}:void 0)}async abortStep(e){return this.restRequest("POST","/v1/tools/step/abort",{runId:e})}async executeTransformOnly({outputTransform:e,outputSchema:t,inputSchema:a,payload:i,files:r,stepResults:s,options:n,runId:c,createRun:m,parentToolId:l,stepId:u,signal:d,stream:g}){let p={outputTransform:e,outputSchema:t,inputSchema:a,payload:i,files:r,stepResults:s,options:n,runId:c,createRun:m,parentToolId:l,stepId:u};return g?this.streamRequest("/v1/tools/transform/run",p,d):this.restRequest("POST","/v1/tools/transform/run",p,void 0,d?{signal:d}:void 0)}async createRun({toolId:e,toolConfig:t,toolResult:a,stepResults:i,toolPayload:r,status:s,error:n,startedAt:c,completedAt:m,executionKind:l,parentToolId:u,draftId:d}){return this.restRequest("POST","/v1/runs",{toolId:e,toolConfig:t,toolResult:a,stepResults:i,toolPayload:r,status:s,error:n,startedAt:(0,$a.toUTCISOString)(c,"run.startedAt"),completedAt:(0,$a.toUTCISOString)(m,"run.completedAt"),executionKind:l,parentToolId:u,draftId:d})}async checkRunLimit(){return(await this.restRequest("POST","/v1/runs/check-limit")).data}async extract({file:e,envelope:t}){if(!e)throw new Error("File must be provided for extract.");let a=new FormData;a.append("file",e);let i=t?"/v1/extract?envelope=true":"/v1/extract";return this.restRequest("POST",i,a)}mapOpenAPIRunToRun(e){let t={running:Sn.RunStatus.RUNNING,success:Sn.RunStatus.SUCCESS,failed:Sn.RunStatus.FAILED,aborted:Sn.RunStatus.ABORTED};return{runId:e.runId??e.id,toolId:e.toolId,tool:e.tool,systemIds:e.systemIds,status:t[e.status]??Sn.RunStatus.FAILED,toolPayload:e.toolPayload,data:e.data,toolResult:e.data,error:e.error,stepResults:e.stepResults,options:e.options,requestSource:e.requestSource,traceId:e.traceId,resultStorageUri:e.resultStorageUri,userId:e.userId,userEmail:e.userEmail,userName:e.userName,metadata:{...e.metadata,executionKind:e.metadata?.executionKind??Sn.RunExecutionKind.FULL},fileArtifacts:e.fileArtifacts}}mapOpenAPIScheduleToToolSchedule(e){return{...e,lastRunAt:e.lastRunAt?(0,$a.requireUTCDate)(e.lastRunAt,"schedule.lastRunAt"):void 0,nextRunAt:(0,$a.requireUTCDate)(e.nextRunAt,"schedule.nextRunAt"),createdAt:(0,$a.requireUTCDate)(e.createdAt,"schedule.createdAt"),updatedAt:(0,$a.requireUTCDate)(e.updatedAt,"schedule.updatedAt")}}async listRuns(e={}){let t=(0,Va.createSearchListQueryParams)(e);e.toolId!==void 0&&t.set("toolId",e.toolId),e.searchUserIds?.length&&t.set("searchUserIds",e.searchUserIds.join(",")),e.includeTotal!==void 0&&t.set("includeTotal",String(e.includeTotal)),e.startedAfter!==void 0&&t.set("startedAfter",e.startedAfter instanceof Date?(0,$a.toUTCISOString)(e.startedAfter,"run.startedAfter"):e.startedAfter),e.statuses!==void 0?t.set("status",e.statuses.join(",")):e.status!==void 0&&t.set("status",e.status),e.requestSources!==void 0&&t.set("requestSources",e.requestSources.join(",")),e.executionKinds!==void 0&&t.set("executionKinds",e.executionKinds.join(",")),e.userId!==void 0&&t.set("userId",e.userId),e.systemId!==void 0&&t.set("systemId",e.systemId),e.systemIds!==void 0&&t.set("systemIds",e.systemIds.join(","));let a=t.size>0?`?${t.toString()}`:"",i=await this.restRequest("GET",`/v1/runs${a}`,void 0,void 0,{signal:e.signal});return{data:i.data.map(r=>this.mapOpenAPIRunToRun(r)),total:i.total,page:i.page,limit:i.limit,hasMore:i.hasMore}}async getActivityCounts(e){let t=new URLSearchParams;e?.from&&t.set("from",e.from instanceof Date?(0,$a.toUTCISOString)(e.from,"activity.from"):e.from),e?.to&&t.set("to",e.to instanceof Date?(0,$a.toUTCISOString)(e.to,"activity.to"):e.to);let a=t.toString();return(await this.restRequest("GET",`/v1/activity/counts${a?`?${a}`:""}`,void 0,void 0,{signal:e?.signal})).counts}async getRun(e){try{let t=await this.restRequest("GET",`/v1/runs/${encodeURIComponent(e)}`);return this.mapOpenAPIRunToRun(t)}catch(t){if(t.message?.includes("404")||t.message?.includes("not found"))return null;throw t}}async getTool(e){try{return await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}`)}catch(t){if(t.message?.includes("404")||t.message?.includes("not found")||t.message?.includes("403")||t.message?.includes("not allowed"))return null;throw t}}async getToolState(e){return(await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}/state`)).state}async setToolState(e,t){await this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}/state`,{state:t})}async deleteToolState(e){return(await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}/state`)).deletedKeys}async archiveTool(e,t=!0){return this.updateTool(e,{archived:t})}async bulkArchiveTools(e,t=!0){return this.restRequest("POST","/v1/tools/bulk/archive",{ids:e,archived:t})}async bulkDeleteTools(e){return this.restRequest("POST","/v1/tools/bulk/delete",{ids:e})}async listTools(e={}){let t=(0,Va.createListQueryParams)(e);e.includeArchived!==void 0&&t.set("includeArchived",String(e.includeArchived));let a=t.size>0?`?${t.toString()}`:"";return this.restRequest("GET",`/v1/tools${a}`)}async listAllTools(e={}){return(0,Va.listAllPages)((t,a)=>this.listTools({...e,page:t,limit:a}))}async createTool(e,t){return this.restRequest("POST","/v1/tools",{...t,id:e})}async updateTool(e,t){return this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}`,t)}async deleteTool(e){try{return await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}`),!0}catch(t){if(t.message?.includes("404"))return!1;throw t}}async renameTool(e,t){return this.restRequest("POST",`/v1/tools/${encodeURIComponent(e)}/rename`,{newId:t})}async getWorkflow(e){return this.getTool(e)}async archiveWorkflow(e,t=!0){return this.upsertWorkflow(e,{archived:t})}async createWorkflow(e,t){return this.createTool(e,t)}async updateWorkflow(e,t){return this.updateTool(e,t)}async upsertWorkflow(e,t){return await this.getTool(e)?this.updateTool(e,t):this.createTool(e,t)}async deleteWorkflow(e){return this.deleteTool(e)}async renameWorkflow(e,t){return this.renameTool(e,t)}async listSchedules(e={}){let t=(0,Va.createListQueryParams)(e),a=t.size>0?`?${t.toString()}`:"",i=e.toolId?`/v1/tools/${encodeURIComponent(e.toolId)}/schedules${a}`:`/v1/schedules${a}`,r=await this.restRequest("GET",i);return{...r,data:r.data.map(s=>this.mapOpenAPIScheduleToToolSchedule(s))}}async listAllSchedules(e={}){return(0,Va.listAllPages)((t,a)=>this.listSchedules({...e,page:t,limit:a}))}async getToolSchedule(e,t){try{let a=await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`);return this.mapOpenAPIScheduleToToolSchedule(a)}catch(a){if(a.message?.includes("404")||a.message?.includes("not found"))return null;throw a}}async createToolSchedule(e,t){let a=await this.restRequest("POST",`/v1/tools/${encodeURIComponent(e)}/schedules`,{...t,timezone:t.timezone||(0,Ime.getRuntimeTimezone)()});return this.mapOpenAPIScheduleToToolSchedule(a)}async updateToolSchedule(e,t,a){let i=await this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`,a);return this.mapOpenAPIScheduleToToolSchedule(i)}async deleteToolSchedule(e,t){return await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`),!0}async bulkSetSchedulesEnabled(e,t){return this.restRequest("POST","/v1/schedules/bulk/enable",{ids:e,enabled:t})}async bulkDeleteSchedules(e){return this.restRequest("POST","/v1/schedules/bulk/delete",{ids:e})}async listCredentials(e={}){let t=(0,Va.createListQueryParams)(e);e.systemId!==void 0&&t.set("systemId",e.systemId);let a=t.size>0?`?${t.toString()}`:"";return this.restRequest("GET",`/v1/credentials${a}`)}async listAllCredentials(e={}){return(0,Va.listAllPages)((t,a)=>this.listCredentials({...e,page:t,limit:a}))}async createCredentials(e){return(await this.restRequest("POST","/v1/credentials",e)).data}async replaceCredentials(e,t){return(await this.restRequest("PUT",`/v1/credentials/${encodeURIComponent(e)}`,{credentials:t})).data}async updateCredentials(e,t){return(await this.restRequest("PATCH",`/v1/credentials/${encodeURIComponent(e)}`,t)).data}async deleteCredentials(e){await this.restRequest("DELETE",`/v1/credentials/${encodeURIComponent(e)}`)}async setDefaultCredentials(e){await this.restRequest("POST",`/v1/credentials/${encodeURIComponent(e)}/default`)}async listSystems(e={}){let t=(0,Va.createListQueryParams)(e),a=t.size>0?`?${t.toString()}`:"";return this.restRequest("GET",`/v1/systems${a}`)}async listAllSystems(e={}){return(0,Va.listAllPages)((t,a)=>this.listSystems({...e,page:t,limit:a}))}async getSystem(e){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}`)).data}async createSystem(e){return(await this.restRequest("POST","/v1/systems",e)).data}async updateSystem(e,t){return(await this.restRequest("PATCH",`/v1/systems/${encodeURIComponent(e)}`,t)).data}async deleteSystem(e){return await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}`),!0}async bulkDeleteSystems(e){return this.restRequest("POST","/v1/systems/bulk/delete",{ids:e})}async createOAuthExchange(e){return(await this.restRequest("POST","/v1/oauth/exchanges",e)).data}async completeOAuthExchange(e,t){return(await this.restRequest("POST",`/v1/oauth/exchanges/${encodeURIComponent(e)}/complete`,t)).data}async searchSystemDocumentation(e,t){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/search`,{keywords:t})).data}async triggerSystemDocumentationScrapeJob(e,t){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/scrape`,t)).data}async fetchOpenApiSpec(e,t,a){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/openapi`,{url:t,link:a?.link})).data}async uploadSystemDocumentationFiles(e,t,a){let i=await this.uploadFiles(t,{process:!0}),r=i.flatMap(s=>s.status==="uploaded"?[s.id]:[]);if(r.length>0)try{await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/files`,{fileIds:r,link:a?.link!==!1})}catch(s){throw await Promise.all(r.map(n=>this.deleteFileUpload(n).catch(()=>{}))),s}if(!a?.settle){let s=i.filter(n=>n.status==="failed");if(s.length>0)throw new Error(s.map(n=>n.error).join("; "))}return i}async listSystemDocumentationFiles(e,t){let a=new URLSearchParams;t?.length&&a.set("fileIds",t.join(","));let i=a.size>0?`?${a.toString()}`:"";return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/documentation/files${i}`)).data}async getSystemDocumentationFileContent(e,t,a){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/documentation/files/${encodeURIComponent(t)}/content?processed=${a.processed}`)).data}async deleteSystemDocumentationFile(e,t){await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}/documentation/files/${encodeURIComponent(t)}`)}async generateCredentialsLink(e){try{return{success:!0,credentialsUrl:(await this.restRequest("POST","/v1/authenticate",e||{})).data.credentialsUrl}}catch(t){return{success:!1,error:t.message}}}};Dn.SuperglueClient=nv});var Z5=y(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.UnquotedKeyStrategy=Ce.TripleQuoteStrategy=Ce.TrailingCommaStrategy=Ce.SingleQuoteStrategy=Ce.PythonLiteralStrategy=Ce.CommentStrategy=Ce.ResilientJsonParser=Ce.RepairStrategy=void 0;Ce.parseJsonResilient=Cme;Ce.parseJSON=jme;Ce.isValidJson=Bme;Ce.prettyPrintJson=Qme;Ce.minifyJson=Sme;var Ht=class{validate(e){try{return JSON.parse(e),!0}catch{return!1}}};Ce.RepairStrategy=Ht;var Wg=class extends Ht{constructor(){super(...arguments),this.name="TripleQuoteRepair",this.description="Converts triple-quoted strings to proper JSON, parsing nested JSON content"}canApply(e){return/"""/.test(e)}apply(e){return e.replace(/"""([\s\S]*?)"""/g,(t,a)=>{let i=a.trim();if(i.startsWith("{")&&i.endsWith("}")||i.startsWith("[")&&i.endsWith("]"))try{let s=JSON.parse(i);return JSON.stringify(s)}catch{return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`}return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`})}};Ce.TripleQuoteStrategy=Wg;var Jg=class extends Ht{constructor(){super(...arguments),this.name="PythonLiteralRepair",this.description="Converts Python literals to JavaScript equivalents"}canApply(e){return/\b(None|True|False)\b/.test(e)}apply(e){return e.replace(/\bNone\b/g,"null").replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false")}};Ce.PythonLiteralStrategy=Jg;var Kg=class extends Ht{constructor(){super(...arguments),this.name="TrailingCommaRepair",this.description="Removes trailing commas from objects and arrays"}canApply(e){return/,\s*[}\]]/.test(e)}apply(e){return e.replace(/,(\s*[}\]])/g,"$1")}};Ce.TrailingCommaStrategy=Kg;var Zg=class extends Ht{constructor(){super(...arguments),this.name="SingleQuoteRepair",this.description="Converts single quotes to double quotes"}canApply(e){return/[{,]\s*'[^']*'\s*:/.test(e)||/:\s*'[^']*'/.test(e)}apply(e){let t=e.replace(/([{,]\s*)'([^']+)'(\s*:)/g,'$1"$2"$3');return t=t.replace(/(:\s*)'([^']+)'(\s*[,}])/g,'$1"$2"$3'),t}};Ce.SingleQuoteStrategy=Zg;var Xg=class extends Ht{constructor(){super(...arguments),this.name="UnquotedKeyRepair",this.description="Adds quotes to unquoted object keys"}canApply(e){return/[{,]\s*[a-zA-Z_$][a-zA-Z0-9_$]*\s*:/.test(e)}apply(e){return e.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)(\s*:)/g,'$1"$2"$3')}};Ce.UnquotedKeyStrategy=Xg;var ep=class extends Ht{constructor(){super(...arguments),this.name="CommentRemoval",this.description="Removes JavaScript-style comments"}canApply(e){return/\/\/.*$|\/\*[\s\S]*?\*\//m.test(e)}apply(e){let t=e.replace(/\/\/.*$/gm,"");return t=t.replace(/\/\*[\s\S]*?\*\//g,""),t}};Ce.CommentStrategy=ep;var cv=class extends Ht{constructor(){super(...arguments),this.name="UnescapedControlCharactersRepair",this.description="Escapes unescaped control characters (newlines, tabs, etc.) in JSON strings"}canApply(e){try{return JSON.parse(e),!1}catch(t){let a=t.message||"";return a.includes("control character")||a.includes("Bad control")||a.includes("Unexpected token")&&/[\n\r\t]/.test(e)}}apply(e){let t="",a=!1,i=!1;for(let r=0;r<e.length;r++){let s=e[r],n=r>0?e[r-1]:"";if(i){t+=s,i=!1;continue}if(s==="\\"&&a){t+=s,i=!0;continue}if(s==='"'&&n!=="\\"){a=!a,t+=s;continue}if(a)switch(s){case`
1413
1413
  `:t+="\\n";break;case"\r":t+="\\r";break;case" ":t+="\\t";break;case"\b":t+="\\b";break;case"\f":t+="\\f";break;default:let c=s.charCodeAt(0);c<32?t+="\\u"+("0000"+c.toString(16)).slice(-4):t+=s}else t+=s}return t}},mv=class extends Ht{constructor(){super(...arguments),this.name="TrailingCharactersRepair",this.description="Removes trailing characters after valid JSON structure"}canApply(e){let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return!1;let a=0,i=0,r=!1,s=!1;for(let n=0;n<t.length;n++){let c=t[n];if(r)s?s=!1:c==="\\"?s=!0:c==='"'&&(r=!1);else if(c==='"')r=!0;else if(c==="{")a++;else if(c==="}"){if(a--,a===0&&i===0&&n>0&&n<t.length-1)return!0}else if(c==="[")i++;else if(c==="]"&&(i--,i===0&&a===0&&n>0&&n<t.length-1))return!0}return!1}apply(e){let t=e.trim(),a=0,i=0,r=!1,s=!1,n=-1;for(let c=0;c<t.length;c++){let m=t[c];if(r)s?s=!1:m==="\\"?s=!0:m==='"'&&(r=!1);else if(m==='"')r=!0;else if(m==="{")a++;else if(m==="}"){if(a--,a===0&&i===0&&c>0){n=c;break}}else if(m==="[")i++;else if(m==="]"&&(i--,i===0&&a===0&&c>0)){n=c;break}}return n>0&&n<t.length-1?t.substring(0,n+1):e}},Tn=class{constructor(e={}){this.strategies=[],this.repairLog=[],this.options={attemptRepair:!0,maxDepth:10,preserveStringsOnFailure:!1,logRepairs:!1,...e},this.initializeDefaultStrategies(),e.customStrategies&&this.strategies.push(...e.customStrategies)}initializeDefaultStrategies(){this.strategies=[new Wg,new Zg,new cv,new mv,new Jg,new Kg,new Xg,new ep]}parse(e){let t=Date.now();this.repairLog=[];let a=e instanceof Buffer?e.toString("utf8"):String(e);try{return{success:!0,data:JSON.parse(a),metadata:{parseTime:Date.now()-t,strategiesApplied:[]}}}catch(s){if(!this.options.attemptRepair)return{success:!1,error:`JSON parse error: ${s}`,metadata:{parseTime:Date.now()-t}}}let i=a,r=[];for(let s of this.strategies)if(s.canApply(i)){let n=i;if(i=s.apply(i),n!==i){r.push(s.name),this.repairLog.push(s.description),this.options.logRepairs&&console.log(`Applied ${s.name}: ${s.description}`);try{return{success:!0,data:JSON.parse(i),repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:r}}}catch{}}}try{return{success:!0,data:JSON.parse(i),repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:r}}}catch(s){let n=this.aggressiveFallback(i);return n.success?{...n,repairs:[...this.repairLog,"Applied aggressive fallback"],metadata:{parseTime:Date.now()-t,strategiesApplied:[...r,"AggressiveFallback"]}}:{success:!1,error:`Failed to parse JSON after applying ${r.length} strategies: ${s}`,repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:r}}}}aggressiveFallback(e){try{let t=e.indexOf("{"),a=e.indexOf("[");if(t===-1&&a===-1)return{success:!1,error:"No JSON-like structure found"};let i=t===-1?a:a===-1?t:Math.min(t,a),r=e.substring(i);for(let n of this.strategies)n.canApply(r)&&(r=n.apply(r));return{success:!0,data:JSON.parse(r)}}catch(t){return{success:!1,error:`Aggressive fallback failed: ${t}`}}}addStrategy(e){this.strategies.push(e)}removeStrategy(e){this.strategies=this.strategies.filter(t=>t.name!==e)}getStrategies(){return this.strategies.map(e=>e.name)}};Ce.ResilientJsonParser=Tn;var K5=new Tn;function Cme(o,e){return(e?new Tn(e):K5).parse(o)}function jme(o){let e=K5.parse(o);if(e.success)return e.repairs&&e.repairs.length>0&&console.log("JSON parsed with repairs:",e.repairs),e.data;throw new Error(`Failed to parse JSON: ${e.error}`)}function Bme(o){try{return JSON.parse(o),!0}catch{return!1}}function Qme(o,e=2){return JSON.stringify(o,null,e)}function Sme(o){let t=new Tn().parse(o);if(t.success)return JSON.stringify(t.data);throw new Error("Cannot minify invalid JSON")}});var tt=y(F=>{"use strict";var Dme=F&&F.__createBinding||(Object.create?(function(o,e,t,a){a===void 0&&(a=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(o,a,i)}):(function(o,e,t,a){a===void 0&&(a=t),o[a]=e[t]})),Z=F&&F.__exportStar||function(o,e){for(var t in o)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Dme(e,o,t)};Object.defineProperty(F,"__esModule",{value:!0});F.SSELogSubscriptionManager=F.SuperglueHttpError=F.SuperglueClient=void 0;Z(r1(),F);Z(h1(),F);Z(f1(),F);Z(w1(),F);Z(q1(),F);Z(Mc(),F);Z(H1(),F);Z(G1(),F);Z(Y1(),F);Z(V1(),F);Z(Jf(),F);Z(W1(),F);Z(J1(),F);Z(K1(),F);Z(X1(),F);Z(e2(),F);Z(t2(),F);Z(Al(),F);Z(i2(),F);Z(r2(),F);Z(n2(),F);Z(l2(),F);Z(d2(),F);Z(y2(),F);Z(A2(),F);Z(v2(),F);Z(D2(),F);Z(R2(),F);Z(lb(),F);Z(W2(),F);Z(yb(),F);Z(X2(),F);Z(aI(),F);Z(rI(),F);Z(rt(),F);Z(Kt(),F);Z(sI(),F);Z(nI(),F);Z(Ru(),F);Z(Cs(),F);Z(wu(),F);var X5=J5();Object.defineProperty(F,"SuperglueClient",{enumerable:!0,get:function(){return X5.SuperglueClient}});Object.defineProperty(F,"SuperglueHttpError",{enumerable:!0,get:function(){return X5.SuperglueHttpError}});var Tme=wb();Object.defineProperty(F,"SSELogSubscriptionManager",{enumerable:!0,get:function(){return Tme.SSELogSubscriptionManager}});Z(Z5(),F)});var Tp=require("commander");var To=W(require("fs")),t6=W(require("os")),Wa=W(require("path")),al=W(tt()),e6=new Set(["runner","builder","admin"]),o6={output:{mode:"stdout",directory:".superglue/output"},preset:"admin"};function Ja(o){let e=Wa.join(process.cwd(),".superglue"),t=t6.homedir();if(!t)return e;let a=Wa.join(t,".superglue");return o===!0?e:o===!1?a:To.existsSync(Wa.join(e,"config.json"))?e:a}function lv(o){return Wa.join(Ja(o),"config.json")}function op(o){let e=lv(o);if(!To.existsSync(e))return{};try{return JSON.parse(To.readFileSync(e,"utf-8"))}catch{return{}}}function Rn(o){let e=op(),t=o.apiKey||(0,al.readProcessEnvironmentValue)("SUPERGLUE_API_KEY")||e.apiKey||"",a=o.endpoint||(0,al.readProcessEnvironmentValue)("SUPERGLUE_API_ENDPOINT")||e.endpoint||"https://api.superglue.cloud",i=(0,al.readProcessEnvironmentValue)("SUPERGLUE_WEB_ENDPOINT")||e.webEndpoint||a.replace(/:3002\b/,":3001").replace(/api\.superglue/,"app.superglue"),r=(0,al.readProcessEnvironmentValue)("SUPERGLUE_CLI_PRESET"),s=r&&e6.has(r)?r:e.preset&&e6.has(e.preset)?e.preset:"admin";return{...o6,...e,apiKey:t,endpoint:a,webEndpoint:i,preset:s,output:{...o6.output,...e.output}}}function tp(o,e){let t=Ja(e);To.existsSync(t)||To.mkdirSync(t,{recursive:!0}),To.writeFileSync(Wa.join(t,"config.json"),JSON.stringify(o,null,2)+`
1414
- `,{mode:384})}function ap(o,e){let t=Wa.join(Ja(e),"drafts");if(To.existsSync(t)||To.mkdirSync(t,{recursive:!0}),o.output.mode==="stdout+file"){let a=Wa.resolve(o.output.directory);To.existsSync(a)||To.mkdirSync(a,{recursive:!0})}}var bv=W(tt());var uv=W(require("readline"));var r6=require("child_process"),s6=require("util");var a6={name:"@superglue/cli",version:"1.1.73",bin:{sg:"./dist/cli.js"},files:[".claude-plugin/","dist/","skills/","LICENSE"],dependencies:{commander:"15.0.0-0","fast-json-patch":"3.1.1"},devDependencies:{"@superglue/shared":"file:../shared","@types/node":"25.5.0",tsup:"8.5.1",typescript:"5.8.3"},scripts:{build:"tsup && (cp -r skills dist/ 2>/dev/null || true)",dev:"tsup --watch","type-check":"tsc --noEmit",prepublishOnly:"npm run build"},publishConfig:{access:"public"}};var Nme=(0,s6.promisify)(r6.exec),vo=a6.version;function i6(o){let e=o.match(/^(\d+)(?:-(.+))?$/);return e?{numeric:parseInt(e[1],10),prerelease:e[2]||null}:{numeric:0,prerelease:o}}function rp(o,e){let t=o.split("."),a=e.split("."),i=Math.max(t.length,a.length);for(let r=0;r<i;r++){let s=i6(t[r]||"0"),n=i6(a[r]||"0");if(s.numeric<n.numeric)return-1;if(s.numeric>n.numeric||s.prerelease===null&&n.prerelease!==null)return 1;if(s.prerelease!==null&&n.prerelease===null)return-1;if(s.prerelease!==null&&n.prerelease!==null){if(s.prerelease<n.prerelease)return-1;if(s.prerelease>n.prerelease)return 1}}return 0}async function sp(){try{let o=await fetch("https://registry.npmjs.org/@superglue/cli/latest",{signal:AbortSignal.timeout(5e3)});return o.ok&&(await o.json()).version||null}catch{return null}}var ip=null;function n6(){G()&&(ip=sp())}async function c6(){if(!(!G()||!ip)){try{let o=new Promise(t=>{setTimeout(()=>t(null),2e3).unref()}),e=await Promise.race([ip,o]);e&&rp(vo,e)<0&&(console.error(""),console.error(`${h.cyan}${h.bold} Update available: ${vo} \u2192 ${e}${h.reset}`),console.error(`${h.cyan} Run ${h.bold}sg update${h.reset}${h.cyan} to upgrade${h.reset}`),console.error(""))}catch{}ip=null}}async function m6(){let o=await sp();if(!o)return{success:!1,message:"Could not fetch latest version from npm"};if(rp(vo,o)>=0)return{success:!0,message:`Already on latest version (${vo})`};try{return await Nme("npm install -g @superglue/cli@latest"),{success:!0,message:`Updated from ${vo} to ${o}`}}catch(e){return{success:!1,message:`Update failed: ${e.message}. Try manually: npm install -g @superglue/cli@latest`}}}var G=()=>process.argv.includes("--table")&&process.stdout.isTTY,Et=()=>process.argv.includes("--full"),h={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m"};function l6(o,e){let t=e||o;return`\x1B]8;;${o}\x07${h.underline}${h.cyan}${t}${h.reset}\x1B]8;;\x07`}function u6(){if(!G())return;let o=h.reset,e=h.dim,t="\x1B[47;30m",a=[" #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- "," =@@@- @@@@ "," @@@ @@% "," -@@ @@@@= @@@ @@@ @@@@@#@ @@@@@@@ @@@@@@@ @@@@@@ @@@ @@@ @@@ @@@@@@* %@@ "," @@ @@@ *@ @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @% @@@ @@@ @@@ @@* @@# "," #@@ @@@# @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @@@ @@@ @@@ @@* @@ "," @@- @@@@= @@@ @@@ @@@@@@@ @@@@@@ @@@@@@@ @@@ @@% @@@ @@@ @@@ @@@@@. @@."," #@% .@@@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* @@ "," @@ @ @@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* *@@ "," -@@ @@@@= @@@@@@ @@@ @@@@@@@ @@@ -@@ @@@@@@ @@@@@@% @@@@@@. @@@@@@* #@@ "," :@@* @@@ "," %@@@ =@@@. "," :@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% "];console.log(""),a.forEach(i=>{let r=i.search(/\S/),s=i.length-[...i].reverse().join("").search(/\S/)-1;if(r===-1)return console.log(" "+i);let n=i.slice(0,r),c=i.slice(r,s+1).split("").map(l=>l===" "?" ":"\u2588").join(""),m=i.slice(s+1);console.log(` ${n}${t}${c}${o}${m}`)}),console.log(` ${e} CLI v${vo}${o}`),console.log("")}function Ee(o){if(!G())return{stop:()=>{},update:()=>{},log:()=>{}};let e=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],t=0,a=o,i=()=>process.stdout.write("\r\x1B[2K"),r=()=>{process.stdout.write(`\r ${h.cyan}${e[t++%e.length]}${h.reset} ${a}`)},s=setInterval(r,80);return{update:n=>{a=n},log:n=>{i(),console.log(` ${h.dim}\u2502${h.reset} ${n}`),r()},stop:n=>{clearInterval(s),i(),n&&console.log(` ${n}`)}}}function U(o){G()?np(o):console.log(JSON.stringify(o,null,2))}function re(o,e){G()?(console.log(` ${h.green}\u2713${h.reset} ${o}`),e&&np(e,4)):console.log(JSON.stringify({success:!0,message:o,...e&&typeof e=="object"?e:{data:e}}))}function z(o,e){G()?(console.error(` ${h.red}\u2717${h.reset} ${o}`),e&&np(e,4)):console.error(JSON.stringify({success:!1,error:o,details:e}))}function d6(o){G()&&console.log(` ${h.yellow}\u26A0${h.reset} ${o}`)}function uo(o){G()&&console.log(` ${h.dim}${o}${h.reset}`)}function Ka(o){G()&&(console.log(`
1414
+ `,{mode:384})}function ap(o,e){let t=Wa.join(Ja(e),"drafts");if(To.existsSync(t)||To.mkdirSync(t,{recursive:!0}),o.output.mode==="stdout+file"){let a=Wa.resolve(o.output.directory);To.existsSync(a)||To.mkdirSync(a,{recursive:!0})}}var bv=W(tt());var uv=W(require("readline"));var r6=require("child_process"),s6=require("util");var a6={name:"@superglue/cli",version:"1.1.74",bin:{sg:"./dist/cli.js"},files:[".claude-plugin/","dist/","skills/","LICENSE"],dependencies:{commander:"15.0.0-0","fast-json-patch":"3.1.1"},devDependencies:{"@superglue/shared":"file:../shared","@types/node":"25.5.0",tsup:"8.5.1",typescript:"5.8.3"},scripts:{build:"tsup && (cp -r skills dist/ 2>/dev/null || true)",dev:"tsup --watch","type-check":"tsc --noEmit",prepublishOnly:"npm run build"},publishConfig:{access:"public"}};var Nme=(0,s6.promisify)(r6.exec),vo=a6.version;function i6(o){let e=o.match(/^(\d+)(?:-(.+))?$/);return e?{numeric:parseInt(e[1],10),prerelease:e[2]||null}:{numeric:0,prerelease:o}}function rp(o,e){let t=o.split("."),a=e.split("."),i=Math.max(t.length,a.length);for(let r=0;r<i;r++){let s=i6(t[r]||"0"),n=i6(a[r]||"0");if(s.numeric<n.numeric)return-1;if(s.numeric>n.numeric||s.prerelease===null&&n.prerelease!==null)return 1;if(s.prerelease!==null&&n.prerelease===null)return-1;if(s.prerelease!==null&&n.prerelease!==null){if(s.prerelease<n.prerelease)return-1;if(s.prerelease>n.prerelease)return 1}}return 0}async function sp(){try{let o=await fetch("https://registry.npmjs.org/@superglue/cli/latest",{signal:AbortSignal.timeout(5e3)});return o.ok&&(await o.json()).version||null}catch{return null}}var ip=null;function n6(){G()&&(ip=sp())}async function c6(){if(!(!G()||!ip)){try{let o=new Promise(t=>{setTimeout(()=>t(null),2e3).unref()}),e=await Promise.race([ip,o]);e&&rp(vo,e)<0&&(console.error(""),console.error(`${h.cyan}${h.bold} Update available: ${vo} \u2192 ${e}${h.reset}`),console.error(`${h.cyan} Run ${h.bold}sg update${h.reset}${h.cyan} to upgrade${h.reset}`),console.error(""))}catch{}ip=null}}async function m6(){let o=await sp();if(!o)return{success:!1,message:"Could not fetch latest version from npm"};if(rp(vo,o)>=0)return{success:!0,message:`Already on latest version (${vo})`};try{return await Nme("npm install -g @superglue/cli@latest"),{success:!0,message:`Updated from ${vo} to ${o}`}}catch(e){return{success:!1,message:`Update failed: ${e.message}. Try manually: npm install -g @superglue/cli@latest`}}}var G=()=>process.argv.includes("--table")&&process.stdout.isTTY,Et=()=>process.argv.includes("--full"),h={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m"};function l6(o,e){let t=e||o;return`\x1B]8;;${o}\x07${h.underline}${h.cyan}${t}${h.reset}\x1B]8;;\x07`}function u6(){if(!G())return;let o=h.reset,e=h.dim,t="\x1B[47;30m",a=[" #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- "," =@@@- @@@@ "," @@@ @@% "," -@@ @@@@= @@@ @@@ @@@@@#@ @@@@@@@ @@@@@@@ @@@@@@ @@@ @@@ @@@ @@@@@@* %@@ "," @@ @@@ *@ @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @% @@@ @@@ @@@ @@* @@# "," #@@ @@@# @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @@@ @@@ @@@ @@* @@ "," @@- @@@@= @@@ @@@ @@@@@@@ @@@@@@ @@@@@@@ @@@ @@% @@@ @@@ @@@ @@@@@. @@."," #@% .@@@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* @@ "," @@ @ @@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* *@@ "," -@@ @@@@= @@@@@@ @@@ @@@@@@@ @@@ -@@ @@@@@@ @@@@@@% @@@@@@. @@@@@@* #@@ "," :@@* @@@ "," %@@@ =@@@. "," :@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% "];console.log(""),a.forEach(i=>{let r=i.search(/\S/),s=i.length-[...i].reverse().join("").search(/\S/)-1;if(r===-1)return console.log(" "+i);let n=i.slice(0,r),c=i.slice(r,s+1).split("").map(l=>l===" "?" ":"\u2588").join(""),m=i.slice(s+1);console.log(` ${n}${t}${c}${o}${m}`)}),console.log(` ${e} CLI v${vo}${o}`),console.log("")}function Ee(o){if(!G())return{stop:()=>{},update:()=>{},log:()=>{}};let e=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],t=0,a=o,i=()=>process.stdout.write("\r\x1B[2K"),r=()=>{process.stdout.write(`\r ${h.cyan}${e[t++%e.length]}${h.reset} ${a}`)},s=setInterval(r,80);return{update:n=>{a=n},log:n=>{i(),console.log(` ${h.dim}\u2502${h.reset} ${n}`),r()},stop:n=>{clearInterval(s),i(),n&&console.log(` ${n}`)}}}function U(o){G()?np(o):console.log(JSON.stringify(o,null,2))}function re(o,e){G()?(console.log(` ${h.green}\u2713${h.reset} ${o}`),e&&np(e,4)):console.log(JSON.stringify({success:!0,message:o,...e&&typeof e=="object"?e:{data:e}}))}function z(o,e){G()?(console.error(` ${h.red}\u2717${h.reset} ${o}`),e&&np(e,4)):console.error(JSON.stringify({success:!1,error:o,details:e}))}function d6(o){G()&&console.log(` ${h.yellow}\u26A0${h.reset} ${o}`)}function uo(o){G()&&console.log(` ${h.dim}${o}${h.reset}`)}function Ka(o){G()&&(console.log(`
1415
1415
  ${h.bold}${h.cyan}${o}${h.reset}`),console.log(` ${h.dim}${"\u2500".repeat(o.length)}${h.reset}`))}function pa(o,e,t){if(!G()){console.log(JSON.stringify({success:!0,total:t?.total??o.length,items:o}));return}if(o.length===0){console.log(`
1416
1416
  ${h.dim}0 results${h.reset}
1417
1417
  `);return}let a=e||Object.keys(o[0]),i=Et()?1/0:60,r=a.map(l=>Math.min(i,Math.max(l.length,...o.map(u=>String(u[l]??"").replace(/[\n\r]+/g," ").trim().length))));console.log("");let s=a.map((l,u)=>`${h.bold}${h.cyan}${l.toUpperCase().padEnd(r[u])}${h.reset}`).join(" ");console.log(` ${s}`);let n=r.map(l=>`${h.dim}${"\u2500".repeat(l)}${h.reset}`).join(`${h.dim}\u2500\u2500${h.reset}`);console.log(` ${n}`);for(let l of o){let u=a.map((d,g)=>{let p=String(l[d]??"").replace(/[\n\r]+/g," ").trim();if(p.length>i){let A=`\u2026 (${p.length})`;p=p.slice(0,Math.max(0,i-A.length))+`${h.dim}${A}${h.reset}`}return d==="status"?`${{success:h.green,running:h.yellow,failed:h.red,aborted:h.red,error:h.red,pending:h.dim}[p.toLowerCase()]||""}${p.padEnd(r[g])}${h.reset}`:p.padEnd(r[g])}).join(" ");console.log(` ${u}`)}let c=t?.total??o.length,m=c===o.length?`${o.length} result${o.length===1?"":"s"}`:`${o.length} of ${c} result${c===1?"":"s"}`;console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superglue/cli",
3
- "version": "1.1.73",
3
+ "version": "1.1.74",
4
4
  "bin": {
5
5
  "sg": "./dist/cli.js"
6
6
  },