@superglue/cli 1.1.97 → 1.1.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/cli.js +6 -2
- package/package.json +1 -1
|
@@ -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.
|
|
4
|
+
"version": "1.1.98",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "superglue",
|
|
7
7
|
"email": "hello@superglue.cloud"
|
package/dist/cli.js
CHANGED
|
@@ -624,7 +624,11 @@ If the user has no S/4HANA system, offer the free SAP Business Accelerator Hub s
|
|
|
624
624
|
|
|
625
625
|
If the user has no SuccessFactors instance, offer the free SAP Business Accelerator Hub sandbox: base URL https://sandbox.api.sap.com/successfactors/odata/v2/<EntitySet> with the API key sent in the APIKey header (no OAuth needed). A shared test key can be offered: K8reTgiKCCaqvAPWC4cOjqqiLdLE8dqz (read-only demo data, rate-limited; users can create their own free key at api.sap.com).`},sap_ariba:{name:"sap_ariba",apiUrl:"https://openapi.ariba.com/api",regex:"(^|.*\\b)(ariba|openapi\\.ariba\\.com)(\\b.*|$)",icon:"sap",docsUrl:"https://developer.ariba.com/api/",preferredAuthType:"api_key",keywords:["sap","ariba","procurement","sourcing","suppliers","purchase_orders","invoices","requisitions","contracts","spend","operational_reporting","analytics_reporting"],systemSpecificInstructions:"SAP Ariba Open APIs live under https://openapi.ariba.com/api/<api-name>/<version>/... (regional hosts differ, e.g. eu.openapi.ariba.com for EU realms). Production requests need two credentials on every call: an OAuth 2.0 Bearer token in the Authorization header (client_credentials grant against https://api.ariba.com/v2/oauth/token, with client id and secret sent as Basic auth on the token request), plus the application's apiKey header. Most APIs also require the customer realm name as the realm query parameter. Applications and their API keys are created in the SAP Ariba Developer Portal (developer.ariba.com). Unlike other SAP products, Ariba has no public sandbox on the SAP Business Accelerator Hub \u2014 a real realm and developer portal application are required."},sap_concur:{name:"sap_concur",apiUrl:"https://us.api.concursolutions.com",regex:"(^|.*\\b)(concur|concursolutions\\.com)(\\b.*|$)",icon:"sap",docsUrl:"https://developer.concur.com/api-reference/",preferredAuthType:"api_key",keywords:["sap","concur","travel","expense","expense_reports","receipts","invoices","itineraries","trips","reimbursement","spend"],systemSpecificInstructions:`SAP Concur base URLs are geolocation-specific: https://us.api.concursolutions.com or https://us2.api.concursolutions.com (US), https://emea.api.concursolutions.com (EMEA) \u2014 use the geolocation returned with the OAuth token. Production authentication is OAuth 2.0: exchange credentials at /oauth2/v0/token (form-encoded, with client_id, client_secret, and grant_type such as password, client_credentials, or refresh_token), then send Authorization: Bearer <token>. Popular endpoints: /api/v3.0/expense/reports, /api/v3.0/expense/entries, /api/v3.0/common/lists, /profile/v1/me, /travel/trip/v1.1. v3.0 endpoints return XML by default \u2014 send Accept: application/json for JSON \u2014 and list endpoints paginate with limit and offset.
|
|
626
626
|
|
|
627
|
-
If the user has no Concur instance, offer the free SAP Business Accelerator Hub sandbox: base URL https://sandbox.api.sap.com/concur/api/v3.0/... with the API key sent in the APIKey header (no OAuth needed). A shared test key can be offered: K8reTgiKCCaqvAPWC4cOjqqiLdLE8dqz (read-only demo data, rate-limited; users can create their own free key at api.sap.com).`},stripe:{name:"stripe",apiUrl:"https://api.stripe.com",regex:"^.*stripe.*$",icon:"stripe",docsUrl:"https://docs.stripe.com/api",openApiUrl:"https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json",preferredAuthType:"api_key",keywords:["customers","charges","payment_intents","products","prices","subscriptions","invoices","balance_transactions","refunds","checkout_sessions","line_items","payment_methods","issuers","plans","setup_intents","payouts","transfers","balance","users","emails"]},shopify:{name:"shopify",apiUrl:"https://admin.shopify.com",regex:"^.*(shopify|myshopify).*$",icon:"shopify",docsUrl:"https://shopify.dev/docs/api",preferredAuthType:"oauth2",oauth:{authUrl:"https://{shop}.myshopify.com/admin/oauth/authorize",tokenUrl:"https://{shop}.myshopify.com/admin/oauth/access_token",scopes:"read_products write_products read_orders write_orders read_all_orders read_customers write_customers read_inventory write_inventory read_fulfillments write_fulfillments read_shipping write_shipping read_draft_orders write_draft_orders read_content write_content read_themes read_locations read_price_rules write_price_rules read_discounts write_discounts read_gift_cards read_reports read_analytics read_checkouts read_metaobject_definitions read_metaobjects write_metaobjects",extraBodyParams:{expiring:"1"}},keywords:["products","variants","collections","customers","orders","fulfillments","inventory_items","inventory_levels","metafields","price_rules","discount_codes","shipping_zones","locations","gift_cards","product_images"],systemSpecificInstructions:`Shopify OAuth URLs contain {shop} placeholders \u2014 ALWAYS substitute with the store's myshopify subdomain (e.g. "my-store" for my-store.myshopify.com) in both auth_url and token_url when calling authenticate_oauth. Since Jan 2026 legacy admin custom apps are deprecated; all new apps must be created via the Dev Dashboard (dev.shopify.com/dashboard) or Partner Dashboard: create app \u2192 Versions tab \u2192 set scopes, redirect URL (use the superglue OAuth callback), release version, then install on store. The "App URL" can be set to https://shopify.dev/apps/default-app-home for non-embedded integrations. Client ID and secret are under Settings in the Dev Dashboard (https://dev.shopify.com/dashboard). For maximum Admin API access request all needed scopes during version creation; read_all_orders requires separate approval in Partner Dashboard \u2192 API access \u2192 Access requests (gives order history beyond 60 days). Shopify is migrating to GraphQL Admin API \u2014 REST Admin API is legacy since Oct 2024 and new public apps must use GraphQL exclusively since Apr 2025. API base: https://{shop}.myshopify.com/admin/api/{version}/graphql.json \u2014 IMPORTANT: authenticate with header X-Shopify-Access-Token: <<shopify_access_token>>, NOT Authorization: Bearer. Walk the user through the required Shopify app setup and configuration steps before creating the system \u2014 Shopify onboarding is non-trivial and users benefit from understanding the Dev Dashboard app creation, scope selection, and redirect URL setup before proceeding.`},hubspot:{name:"hubspot",apiUrl:"https://api.hubapi.com/crm/v3",regex:"^.*(hubapi|hubspot).*$",icon:"hubspot",docsUrl:"https://developers.hubspot.com/docs/api/overview",openApiUrl:"https://api.hubspot.com/public/api/spec/v1/specs",preferredAuthType:"api_key",oauth:{authUrl:"https://app.hubspot.com/oauth/authorize",tokenUrl:"https://api.hubapi.com/oauth/v1/token",scopes:"crm.objects.contacts.read crm.objects.contacts.write crm.objects.companies.read crm.objects.companies.write crm.objects.deals.read crm.objects.deals.write crm.objects.owners.read forms forms-uploaded-files files sales-email-read crm.objects.quotes.read crm.objects.quotes.write"},keywords:["contacts","companies","deals","tickets","line_items","products","associations","memberships"]},hrworks:{name:"hrworks",apiUrl:"https://api.hrworks.de/v2",regex:"(^|.*\\b)(hr\\s?works|hrworks)(\\b.*|$)",icon:"/logos/hrworks.png",docsUrl:"https://developers.hrworks.de/",preferredAuthType:"api_key",keywords:["hr","employee","absence","vacation","payroll","personnel","time_tracking","human_resources","working_time","attendance","onboarding","applicant_management","travel_expenses","sick_leave"]},gusto:{name:"gusto",apiUrl:"https://api.gusto.com/v1",regex:"(^|.*\\b)(gusto|gusto\\.com|api\\.gusto\\.com)(\\b.*|$)",icon:"gusto",docsUrl:"https://docs.gusto.com/embedded-payroll/reference",preferredAuthType:"oauth2",oauth:{authUrl:"https://api.gusto.com/oauth/authorize",tokenUrl:"https://api.gusto.com/oauth/token"},keywords:["gusto","gusto api","payroll","hr","employees","employee","companies","payrolls","contractors","benefits","time_off","departments","jobs","locations","onboarding","taxes","deductions","pay_schedules","compensation"],systemSpecificInstructions:"Gusto uses OAuth-derived Bearer tokens. Development calls should use https://api.gusto-demo.com/v1; production calls use https://api.gusto.com/v1 after Gusto approval. The URL path stays /v1 while API versioning is controlled by the X-Gusto-API-Version header. Many payroll and benefits endpoints require specific scopes, and benefits containing PHI require stronger scopes."},workday:{name:"workday",apiUrl:"https://{host}/ccx/api/v1/{tenant}",regex:"(^|.*\\b)(workday|workday\\.com|myworkday)(\\b.*|$)",icon:"/logos/workday.svg",docsUrl:"https://community.workday.com/sites/default/files/file-hosting/restapi/index.html",preferredAuthType:"oauth2",oauth:{authUrl:"https://{host}/ccx/oauth2/{tenant}/authorize",tokenUrl:"https://{host}/ccx/oauth2/{tenant}/token"},keywords:["workday","workday api","hr","hcm","payroll","workers","employees","employee","recruiting","benefits","absence","time_tracking","financials","organizations","positions","staffing","reports","raas","business_processes","supervisory_organizations"],systemSpecificInstructions:`{host} is the Workday data-center host, not a tenant subdomain: implementation tenants look like wd2-impl-services1.workday.com and production tenants like wd5-services1.myworkday.com. {tenant} is the tenant name and appears only as a path segment. Read both from the Web Services endpoint URL and the Token Endpoint shown under "View API Clients" in the customer tenant. Workday REST endpoints are tenant, service, and version specific. Do not assume resources live directly under /ccx/api; most REST calls use /ccx/api/{service}/{version}/{tenant}/{resource}. Workday also exposes RaaS/custom report endpoints under /ccx/service/customreport2/{tenant}/... that may use Basic Auth instead of OAuth depending on tenant configuration. Verify the exact REST API endpoint, enabled services, and auth method in the customer's Workday "View API Clients" configuration before creating tools.`},bamboohr:{name:"bamboohr",apiUrl:"https://{companyDomain}.bamboohr.com/api/v1",regex:"(^|.*\\b)(bamboohr|bamboo\\s?hr|bamboohr\\.com)(\\b.*|$)",icon:"/logos/bamboohr.ico",docsUrl:"https://documentation.bamboohr.com/reference",openApiUrl:"https://openapi.bamboohr.io/main/latest/docs/openapi/public-openapi.yaml",preferredAuthType:"basic_auth",keywords:["bamboohr","bamboo hr","bamboohr api","hr","hris","employees","employee","time_off","time_tracking","payroll","reports","fields","applicant_tracking","benefits","company_files","users","webhooks","timesheets","requests"],systemSpecificInstructions:'For API-key auth, use HTTP Basic Auth with the BambooHR API key as the username and any non-empty password such as "x". The companyDomain placeholder is only the subdomain before .bamboohr.com. BambooHR also supports OAuth for many APIs through Developer Portal applications; use OAuth when the customer is building a marketplace or multi-customer app and has client credentials.'},
|
|
627
|
+
If the user has no Concur instance, offer the free SAP Business Accelerator Hub sandbox: base URL https://sandbox.api.sap.com/concur/api/v3.0/... with the API key sent in the APIKey header (no OAuth needed). A shared test key can be offered: K8reTgiKCCaqvAPWC4cOjqqiLdLE8dqz (read-only demo data, rate-limited; users can create their own free key at api.sap.com).`},stripe:{name:"stripe",apiUrl:"https://api.stripe.com",regex:"^.*stripe.*$",icon:"stripe",docsUrl:"https://docs.stripe.com/api",openApiUrl:"https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json",preferredAuthType:"api_key",keywords:["customers","charges","payment_intents","products","prices","subscriptions","invoices","balance_transactions","refunds","checkout_sessions","line_items","payment_methods","issuers","plans","setup_intents","payouts","transfers","balance","users","emails"]},shopify:{name:"shopify",apiUrl:"https://admin.shopify.com",regex:"^.*(shopify|myshopify).*$",icon:"shopify",docsUrl:"https://shopify.dev/docs/api",preferredAuthType:"oauth2",oauth:{authUrl:"https://{shop}.myshopify.com/admin/oauth/authorize",tokenUrl:"https://{shop}.myshopify.com/admin/oauth/access_token",scopes:"read_products write_products read_orders write_orders read_all_orders read_customers write_customers read_inventory write_inventory read_fulfillments write_fulfillments read_shipping write_shipping read_draft_orders write_draft_orders read_content write_content read_themes read_locations read_price_rules write_price_rules read_discounts write_discounts read_gift_cards read_reports read_analytics read_checkouts read_metaobject_definitions read_metaobjects write_metaobjects",extraBodyParams:{expiring:"1"}},keywords:["products","variants","collections","customers","orders","fulfillments","inventory_items","inventory_levels","metafields","price_rules","discount_codes","shipping_zones","locations","gift_cards","product_images"],systemSpecificInstructions:`Shopify OAuth URLs contain {shop} placeholders \u2014 ALWAYS substitute with the store's myshopify subdomain (e.g. "my-store" for my-store.myshopify.com) in both auth_url and token_url when calling authenticate_oauth. Since Jan 2026 legacy admin custom apps are deprecated; all new apps must be created via the Dev Dashboard (dev.shopify.com/dashboard) or Partner Dashboard: create app \u2192 Versions tab \u2192 set scopes, redirect URL (use the superglue OAuth callback), release version, then install on store. The "App URL" can be set to https://shopify.dev/apps/default-app-home for non-embedded integrations. Client ID and secret are under Settings in the Dev Dashboard (https://dev.shopify.com/dashboard). For maximum Admin API access request all needed scopes during version creation; read_all_orders requires separate approval in Partner Dashboard \u2192 API access \u2192 Access requests (gives order history beyond 60 days). Shopify is migrating to GraphQL Admin API \u2014 REST Admin API is legacy since Oct 2024 and new public apps must use GraphQL exclusively since Apr 2025. API base: https://{shop}.myshopify.com/admin/api/{version}/graphql.json \u2014 IMPORTANT: authenticate with header X-Shopify-Access-Token: <<shopify_access_token>>, NOT Authorization: Bearer. Walk the user through the required Shopify app setup and configuration steps before creating the system \u2014 Shopify onboarding is non-trivial and users benefit from understanding the Dev Dashboard app creation, scope selection, and redirect URL setup before proceeding.`},hubspot:{name:"hubspot",apiUrl:"https://api.hubapi.com/crm/v3",regex:"^.*(hubapi|hubspot).*$",icon:"hubspot",docsUrl:"https://developers.hubspot.com/docs/api/overview",openApiUrl:"https://api.hubspot.com/public/api/spec/v1/specs",preferredAuthType:"api_key",oauth:{authUrl:"https://app.hubspot.com/oauth/authorize",tokenUrl:"https://api.hubapi.com/oauth/v1/token",scopes:"crm.objects.contacts.read crm.objects.contacts.write crm.objects.companies.read crm.objects.companies.write crm.objects.deals.read crm.objects.deals.write crm.objects.owners.read forms forms-uploaded-files files sales-email-read crm.objects.quotes.read crm.objects.quotes.write"},keywords:["contacts","companies","deals","tickets","line_items","products","associations","memberships"]},hrworks:{name:"hrworks",apiUrl:"https://api.hrworks.de/v2",regex:"(^|.*\\b)(hr\\s?works|hrworks)(\\b.*|$)",icon:"/logos/hrworks.png",docsUrl:"https://developers.hrworks.de/",preferredAuthType:"api_key",keywords:["hr","employee","absence","vacation","payroll","personnel","time_tracking","human_resources","working_time","attendance","onboarding","applicant_management","travel_expenses","sick_leave"]},gusto:{name:"gusto",apiUrl:"https://api.gusto.com/v1",regex:"(^|.*\\b)(gusto|gusto\\.com|api\\.gusto\\.com)(\\b.*|$)",icon:"gusto",docsUrl:"https://docs.gusto.com/embedded-payroll/reference",preferredAuthType:"oauth2",oauth:{authUrl:"https://api.gusto.com/oauth/authorize",tokenUrl:"https://api.gusto.com/oauth/token"},keywords:["gusto","gusto api","payroll","hr","employees","employee","companies","payrolls","contractors","benefits","time_off","departments","jobs","locations","onboarding","taxes","deductions","pay_schedules","compensation"],systemSpecificInstructions:"Gusto uses OAuth-derived Bearer tokens. Development calls should use https://api.gusto-demo.com/v1; production calls use https://api.gusto.com/v1 after Gusto approval. The URL path stays /v1 while API versioning is controlled by the X-Gusto-API-Version header. Many payroll and benefits endpoints require specific scopes, and benefits containing PHI require stronger scopes."},workday:{name:"workday",apiUrl:"https://{host}/ccx/api/v1/{tenant}",regex:"(^|.*\\b)(workday|workday\\.com|myworkday)(\\b.*|$)",icon:"/logos/workday.svg",docsUrl:"https://community.workday.com/sites/default/files/file-hosting/restapi/index.html",preferredAuthType:"oauth2",oauth:{authUrl:"https://{host}/ccx/oauth2/{tenant}/authorize",tokenUrl:"https://{host}/ccx/oauth2/{tenant}/token"},keywords:["workday","workday api","hr","hcm","payroll","workers","employees","employee","recruiting","benefits","absence","time_tracking","financials","organizations","positions","staffing","reports","raas","business_processes","supervisory_organizations"],systemSpecificInstructions:`{host} is the Workday data-center host, not a tenant subdomain: implementation tenants look like wd2-impl-services1.workday.com and production tenants like wd5-services1.myworkday.com. {tenant} is the tenant name and appears only as a path segment. Read both from the Web Services endpoint URL and the Token Endpoint shown under "View API Clients" in the customer tenant. Workday REST endpoints are tenant, service, and version specific. Do not assume resources live directly under /ccx/api; most REST calls use /ccx/api/{service}/{version}/{tenant}/{resource}. Workday also exposes RaaS/custom report endpoints under /ccx/service/customreport2/{tenant}/... that may use Basic Auth instead of OAuth depending on tenant configuration. Verify the exact REST API endpoint, enabled services, and auth method in the customer's Workday "View API Clients" configuration before creating tools.`},bamboohr:{name:"bamboohr",apiUrl:"https://{companyDomain}.bamboohr.com/api/v1",regex:"(^|.*\\b)(bamboohr|bamboo\\s?hr|bamboohr\\.com)(\\b.*|$)",icon:"/logos/bamboohr.ico",docsUrl:"https://documentation.bamboohr.com/reference",openApiUrl:"https://openapi.bamboohr.io/main/latest/docs/openapi/public-openapi.yaml",preferredAuthType:"basic_auth",keywords:["bamboohr","bamboo hr","bamboohr api","hr","hris","employees","employee","time_off","time_tracking","payroll","reports","fields","applicant_tracking","benefits","company_files","users","webhooks","timesheets","requests"],systemSpecificInstructions:'For API-key auth, use HTTP Basic Auth with the BambooHR API key as the username and any non-empty password such as "x". The companyDomain placeholder is only the subdomain before .bamboohr.com. BambooHR also supports OAuth for many APIs through Developer Portal applications; use OAuth when the customer is building a marketplace or multi-customer app and has client credentials.'},lucca:{name:"lucca",apiUrl:"https://{host}/lucca-api",regex:"(^|.*\\b)(lucca|ilucca|luccasoftware)(\\b.*|$)",icon:"/logos/lucca.svg",docsUrl:"https://developers.luccasoftware.com",openApiUrl:"https://developers.luccasoftware.com/openapi-specs/lucca-api@2024-11-01.json",preferredAuthType:"oauth2",oauth:{tokenUrl:"https://accounts.world.luccasoftware.com/connect/token",grant_type:"client_credentials",tokenAuthMethod:"body",tokenContentType:"form"},keywords:["lucca","hr","hris","employees","employee","employments","departments","legal_entities","business_establishments","job_positions","employee_attributes","working_time_arrangements","leaves","leave_requests","webhooks","files"],systemSpecificInstructions:`{host} is the customer's Lucca account host. Production, test, and demo accounts use {account}.ilucca.net, {account}.ilucca-test.net, and {account}.ilucca-demo.net; Swiss accounts use .ch instead of .net. Sandboxes use {account}-{sandboxName}.sandbox.{server}.luccasoftware.com, where sandboxName is generated at creation and server is eu1, eu2, or ch1. Copy the host from the browser address bar of the account to connect; do not assume production.
|
|
628
|
+
|
|
629
|
+
All environments, including sandboxes, get tokens from the global endpoint https://accounts.world.luccasoftware.com/connect/token with a form-encoded client_credentials request. Tokens expire after 30 minutes. Create the client application at https://{host}/identity/admin/integration-keys with an admin account, and select its OAuth scopes and business establishments there. The client secret is shown only once. Client applications are not copied into sandboxes; create a separate one in each sandbox. Scopes use {resource}.readonly or {resource}.readwrite, such as employees.readonly; a missing scope returns 403.
|
|
630
|
+
|
|
631
|
+
Every /lucca-api request requires an Api-Version date header, such as Api-Version: 2024-11-01. The /lucca-api surface mainly covers organization, employee, and employment data. Leaves and other legacy resources live under https://{host}/api/v3, such as GET /api/v3/leaves, and authenticate with a legacy API key in the header Authorization: lucca application={apiKey} instead of an OAuth token.`},jisr:{name:"jisr",apiUrl:"https://apis.jisr.net/api",regex:"(^|.*\\b)(jisr|jisr\\.net|jisr\\.net\\.sa)(\\b.*|$)",icon:"/logos/jisr.png",docsUrl:"https://openapi.jisr.net/",openApiUrl:"https://openapi.jisr.net/v1/jisr_be/public/openapis.yaml",preferredAuthType:"api_key",keywords:["jisr","hr","payroll","employees","employee","attendance","leave","vacation","time_tracking","human_resources","personnel","onboarding","salary","benefits","accruals","paygroups","lookups","webhooks","departments","business_units"],systemSpecificInstructions:`Jisr Open API has tenant-specific base URLs. AWS-hosted tenants use https://apis.jisr.net/api. If the user's Jisr UI hostname ends with .jisr.net.sa, use the local endpoint https://api.jisr.net.sa/api/ instead.
|
|
628
632
|
|
|
629
633
|
Authentication is not sent as Authorization: Bearer. First call POST /openapi/v1/auth with headers slug, api-key, secret, api-version: 1, and source: open_api unless the user is using an external aggregator. Use the returned data value as the Access-Token header on subsequent requests, along with slug and api-version: 1.
|
|
630
634
|
|
|
@@ -1659,7 +1663,7 @@ ${r}`;break;case"retry":CN(r)&&(t[i]=r);break;case"id":SN(r)&&(t[i]=r);break;cas
|
|
|
1659
1663
|
`);o.stack=t?`${t}
|
|
1660
1664
|
${r}`:i.stack}H.exports.fetch=function(e,t=void 0){return TIe(e,t).catch(a=>{throw LN?HN(a,LN):a&&typeof a=="object"&&Error.captureStackTrace(a,H.exports.fetch),a})};H.exports.Headers=Hs().Headers;H.exports.Response=cd().Response;H.exports.Request=xm().Request;H.exports.FormData=mf().FormData;var{setGlobalOrigin:RIe,getGlobalOrigin:NIe}=ix();H.exports.setGlobalOrigin=RIe;H.exports.getGlobalOrigin=NIe;var{CacheStorage:OIe}=IR(),{kConstruct:UIe}=Ue();H.exports.caches=new OIe(UIe);var{deleteCookie:MIe,getCookies:LIe,getSetCookies:PIe,setCookie:FIe,parseCookie:$Ie}=UR();H.exports.deleteCookie=MIe;H.exports.getCookies=LIe;H.exports.getSetCookies=PIe;H.exports.setCookie=FIe;H.exports.parseCookie=$Ie;var{parseMIMEType:HIe,serializeAMimeType:GIe}=ma();H.exports.parseMIMEType=HIe;H.exports.serializeAMimeType=GIe;var{CloseEvent:VIe,ErrorEvent:YIe,MessageEvent:JIe}=jb(),{WebSocket:WIe,ping:ZIe}=yN();H.exports.WebSocket=WIe;H.exports.CloseEvent=VIe;H.exports.ErrorEvent=YIe;H.exports.MessageEvent=JIe;H.exports.ping=ZIe;H.exports.WebSocketStream=EN().WebSocketStream;H.exports.WebSocketError=Dq().WebSocketError;H.exports.request=Ad(Dm.request);H.exports.stream=Ad(Dm.stream);H.exports.pipeline=Ad(Dm.pipeline);H.exports.connect=Ad(Dm.connect);H.exports.upgrade=Ad(Dm.upgrade);H.exports.MockClient=xIe;H.exports.MockCallHistory=zIe;H.exports.MockCallHistoryLog=qIe;H.exports.MockPool=IIe;H.exports.MockAgent=EIe;H.exports.SnapshotAgent=jIe;H.exports.mockErrors=CIe;var{EventSource:KIe}=MN();H.exports.EventSource=KIe;function XIe(){globalThis.fetch=H.exports.fetch,globalThis.Headers=H.exports.Headers,globalThis.Response=H.exports.Response,globalThis.Request=H.exports.Request,globalThis.FormData=H.exports.FormData,globalThis.WebSocket=H.exports.WebSocket,globalThis.CloseEvent=H.exports.CloseEvent,globalThis.ErrorEvent=H.exports.ErrorEvent,globalThis.MessageEvent=H.exports.MessageEvent,globalThis.EventSource=H.exports.EventSource}H.exports.install=XIe});var VN=f(Rm=>{"use strict";Object.defineProperty(Rm,"__esModule",{value:!0});Rm.SuperglueClient=Rm.SuperglueHttpError=void 0;var Tm=Ht(),Mr=xv(),e2e=ew(),o2e=rQ(),t2e=Fa(),Lr=zc(),a2e=Lg(),wd=14400*1e3,vd;if(typeof globalThis.process<"u"&&globalThis.process.versions?.node)try{let{Agent:o}=GN();vd=new o({headersTimeout:wd,bodyTimeout:wd})}catch{}var Pb=class extends Error{constructor(e,t,a,i){super(e),this.status=t,this.code=a,this.details=i,this.name="SuperglueHttpError"}};Rm.SuperglueHttpError=Pb;var Mq=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 e2e.SSELogSubscriptionManager(this.apiEndpoint,i??this.tokenProvider),this.onInfrastructureError=a}async getApiKey(){return this.tokenProvider()}isInfrastructureError(e){return(0,t2e.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 s=await(await this.restResponse({method:e,path:t,body:a,extraHeaders:i,requestInit:r})).text();if(s)return JSON.parse(s)}async restResponse({method:e,path:t,body:a,extraHeaders:i,requestInit:r}){let n=`${this.apiEndpoint.replace(/\/$/,"")}${t}`,s=a!=null,c=typeof FormData<"u"&&a instanceof FormData,l={Authorization:`Bearer ${await this.getApiKey()}`,...i};s&&!c&&e!=="GET"&&(l["Content-Type"]="application/json");let u;try{u=await fetch(n,{...r,method:e,headers:l,body:s?c?a:JSON.stringify(a):void 0,signal:r?.signal??AbortSignal.timeout(wd),...vd?{dispatcher:vd}:{}})}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 n=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(wd,l.expiresIn*1e3))});if(!g.ok)throw new Error(`Upload failed for ${d.fileName}: ${g.status} ${g.statusText}`);return l.id})),s=n.flatMap(l=>l.status==="fulfilled"?[l.value]:[]),c=new Map;if(s.length>0)try{let l=await this.restRequest("POST","/v1/files/uploads/complete",{fileIds:s});c=new Map(l.data.files.map(u=>[u.id,u]))}catch(l){c=new Map(s.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=n[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 n=JSON.parse(t);n&&typeof n=="object"&&!Array.isArray(n)&&(r=n),typeof n?.code=="string"&&(i=n.code);let s=n.error;typeof s=="string"?a=s:s&&typeof s=="object"&&(a=s.message||JSON.stringify(s))}catch{}return new Pb(a,e.status,i,r)}async streamRequest(e,t,a){let i=e.includes("?")?"&":"?",r=`${this.apiEndpoint.replace(/\/$/,"")}${e}${i}stream=true`,s={Authorization:`Bearer ${await this.getApiKey()}`,Accept:"text/event-stream","Content-Type":"application/json"},c;try{c=await fetch(r,{method:"POST",headers:s,body:JSON.stringify(t),signal:a??AbortSignal.timeout(wd),...vd?{dispatcher:vd}:{}})}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,o2e.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:n,runId:s,systemIds:c,createRun:m,parentToolId:l,stepIndex:u,stepId:d,signal:g,stream:h}){let k={step:e,payload:t,files:a,previousResults:i,credentials:r,options:n,runId:s,systemIds:c,createRun:m,parentToolId:l,stepIndex:u,stepId:d};return h?this.streamRequest("/v1/tools/step/run",k,g):this.restRequest("POST","/v1/tools/step/run",k,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:n,options:s,runId:c,createRun:m,parentToolId:l,stepId:u,signal:d,stream:g}){let h={outputTransform:e,outputSchema:t,inputSchema:a,payload:i,files:r,stepResults:n,options:s,runId:c,createRun:m,parentToolId:l,stepId:u};return g?this.streamRequest("/v1/tools/transform/run",h,d):this.restRequest("POST","/v1/tools/transform/run",h,void 0,d?{signal:d}:void 0)}async createRun({toolId:e,toolConfig:t,toolResult:a,stepResults:i,toolPayload:r,status:n,error:s,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:n,error:s,startedAt:(0,Lr.toUTCISOString)(c,"run.startedAt"),completedAt:(0,Lr.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:Tm.RunStatus.RUNNING,success:Tm.RunStatus.SUCCESS,failed:Tm.RunStatus.FAILED,aborted:Tm.RunStatus.ABORTED};return{runId:e.runId??e.id,toolId:e.toolId,tool:e.tool,systemIds:e.systemIds,status:t[e.status]??Tm.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??Tm.RunExecutionKind.FULL},fileArtifacts:e.fileArtifacts}}mapOpenAPIScheduleToToolSchedule(e){return{...e,lastRunAt:e.lastRunAt?(0,Lr.requireUTCDate)(e.lastRunAt,"schedule.lastRunAt"):void 0,nextRunAt:(0,Lr.requireUTCDate)(e.nextRunAt,"schedule.nextRunAt"),createdAt:(0,Lr.requireUTCDate)(e.createdAt,"schedule.createdAt"),updatedAt:(0,Lr.requireUTCDate)(e.updatedAt,"schedule.updatedAt")}}async listRuns(e={}){let t=(0,Mr.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,Lr.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,Lr.toUTCISOString)(e.from,"activity.from"):e.from),e?.to&&t.set("to",e.to instanceof Date?(0,Lr.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,Mr.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,Mr.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,Mr.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(n=>this.mapOpenAPIScheduleToToolSchedule(n))}}async listAllSchedules(e={}){return(0,Mr.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,a2e.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,Mr.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,Mr.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,Mr.createListQueryParams)(e),a=t.size>0?`?${t.toString()}`:"";return this.restRequest("GET",`/v1/systems${a}`)}async listAllSystems(e={}){return(0,Mr.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(n=>n.status==="uploaded"?[n.id]:[]);if(r.length>0)try{await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/files`,{fileIds:r,link:a?.link!==!1})}catch(n){throw await Promise.all(r.map(s=>this.deleteFileUpload(s).catch(()=>{}))),n}if(!a?.settle){let n=i.filter(s=>s.status==="failed");if(n.length>0)throw new Error(n.map(s=>s.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}}}};Rm.SuperglueClient=Mq});var JN=f(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.UnquotedKeyStrategy=ao.TripleQuoteStrategy=ao.TrailingCommaStrategy=ao.SingleQuoteStrategy=ao.PythonLiteralStrategy=ao.CommentStrategy=ao.ResilientJsonParser=ao.RepairStrategy=void 0;ao.parseJsonResilient=i2e;ao.parseJSON=r2e;ao.isValidJson=n2e;ao.prettyPrintJson=s2e;ao.minifyJson=c2e;var Ra=class{validate(e){try{return JSON.parse(e),!0}catch{return!1}}};ao.RepairStrategy=Ra;var Fb=class extends Ra{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 n=JSON.parse(i);return JSON.stringify(n)}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")}"`})}};ao.TripleQuoteStrategy=Fb;var $b=class extends Ra{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")}};ao.PythonLiteralStrategy=$b;var Hb=class extends Ra{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")}};ao.TrailingCommaStrategy=Hb;var Gb=class extends Ra{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}};ao.SingleQuoteStrategy=Gb;var Vb=class extends Ra{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')}};ao.UnquotedKeyStrategy=Vb;var Yb=class extends Ra{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}};ao.CommentStrategy=Yb;var Lq=class extends Ra{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 n=e[r],s=r>0?e[r-1]:"";if(i){t+=n,i=!1;continue}if(n==="\\"&&a){t+=n,i=!0;continue}if(n==='"'&&s!=="\\"){a=!a,t+=n;continue}if(a)switch(n){case`
|
|
1661
1665
|
`: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=n.charCodeAt(0);c<32?t+="\\u"+("0000"+c.toString(16)).slice(-4):t+=n}else t+=n}return t}},Pq=class extends Ra{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,n=!1;for(let s=0;s<t.length;s++){let c=t[s];if(r)n?n=!1:c==="\\"?n=!0:c==='"'&&(r=!1);else if(c==='"')r=!0;else if(c==="{")a++;else if(c==="}"){if(a--,a===0&&i===0&&s>0&&s<t.length-1)return!0}else if(c==="[")i++;else if(c==="]"&&(i--,i===0&&a===0&&s>0&&s<t.length-1))return!0}return!1}apply(e){let t=e.trim(),a=0,i=0,r=!1,n=!1,s=-1;for(let c=0;c<t.length;c++){let m=t[c];if(r)n?n=!1:m==="\\"?n=!0:m==='"'&&(r=!1);else if(m==='"')r=!0;else if(m==="{")a++;else if(m==="}"){if(a--,a===0&&i===0&&c>0){s=c;break}}else if(m==="[")i++;else if(m==="]"&&(i--,i===0&&a===0&&c>0)){s=c;break}}return s>0&&s<t.length-1?t.substring(0,s+1):e}},Nm=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 Fb,new Gb,new Lq,new Pq,new $b,new Hb,new Vb,new Yb]}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(n){if(!this.options.attemptRepair)return{success:!1,error:`JSON parse error: ${n}`,metadata:{parseTime:Date.now()-t}}}let i=a,r=[];for(let n of this.strategies)if(n.canApply(i)){let s=i;if(i=n.apply(i),s!==i){r.push(n.name),this.repairLog.push(n.description),this.options.logRepairs&&console.log(`Applied ${n.name}: ${n.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(n){let s=this.aggressiveFallback(i);return s.success?{...s,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: ${n}`,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 s of this.strategies)s.canApply(r)&&(r=s.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)}};ao.ResilientJsonParser=Nm;var YN=new Nm;function i2e(o,e){return(e?new Nm(e):YN).parse(o)}function r2e(o){let e=YN.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 n2e(o){try{return JSON.parse(o),!0}catch{return!1}}function s2e(o,e=2){return JSON.stringify(o,null,e)}function c2e(o){let t=new Nm().parse(o);if(t.success)return JSON.stringify(t.data);throw new Error("Cannot minify invalid JSON")}});var Pt=f(oe=>{"use strict";var m2e=oe&&oe.__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]})),he=oe&&oe.__exportStar||function(o,e){for(var t in o)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&m2e(e,o,t)};Object.defineProperty(oe,"__esModule",{value:!0});oe.SSELogSubscriptionManager=oe.SuperglueHttpError=oe.SuperglueClient=void 0;he(NC(),oe);he(VC(),oe);he(u8(),oe);he(f8(),oe);he(A8(),oe);he(iu(),oe);he(M8(),oe);he(L8(),oe);he(P8(),oe);he(F8(),oe);he(xv(),oe);he(H8(),oe);he(G8(),oe);he(V8(),oe);he(Ev(),oe);he(W8(),oe);he(K8(),oe);he(X8(),oe);he(o3(),oe);he(Md(),oe);he(a3(),oe);he(i3(),oe);he(n3(),oe);he(m3(),oe);he(Cv(),oe);he(h3(),oe);he(b3(),oe);he(k3(),oe);he(A3(),oe);he(B3(),oe);he(_3(),oe);he(Fv(),oe);he(G3(),oe);he(Zv(),oe);he(W3(),oe);he(eQ(),oe);he(tQ(),oe);he(Ht(),oe);he(Fa(),oe);he(aQ(),oe);he(iQ(),oe);he(jh(),oe);he(zc(),oe);he(Lg(),oe);var WN=VN();Object.defineProperty(oe,"SuperglueClient",{enumerable:!0,get:function(){return WN.SuperglueClient}});Object.defineProperty(oe,"SuperglueHttpError",{enumerable:!0,get:function(){return WN.SuperglueHttpError}});var l2e=ew();Object.defineProperty(oe,"SSELogSubscriptionManager",{enumerable:!0,get:function(){return l2e.SSELogSubscriptionManager}});he(JN(),oe)});var Cy=require("commander");var kt=pe(require("fs")),XN=pe(require("os")),Pr=pe(require("path")),xd=pe(Pt()),ZN=new Set(["runner","builder","admin"]),KN={output:{mode:"stdout",directory:".superglue/output"},preset:"admin"};function Fr(o){let e=Pr.join(process.cwd(),".superglue"),t=XN.homedir();if(!t)return e;let a=Pr.join(t,".superglue");return o===!0?e:o===!1?a:kt.existsSync(Pr.join(e,"config.json"))?e:a}function Fq(o){return Pr.join(Fr(o),"config.json")}function Jb(o){let e=Fq(o);if(!kt.existsSync(e))return{};try{return JSON.parse(kt.readFileSync(e,"utf-8"))}catch{return{}}}function Om(o){let e=Jb(),t=o.apiKey||(0,xd.readProcessEnvironmentValue)("SUPERGLUE_API_KEY")||e.apiKey||"",a=o.endpoint||(0,xd.readProcessEnvironmentValue)("SUPERGLUE_API_ENDPOINT")||e.endpoint||"https://api.superglue.cloud",i=(0,xd.readProcessEnvironmentValue)("SUPERGLUE_WEB_ENDPOINT")||e.webEndpoint||a.replace(/:3002\b/,":3001").replace(/api\.superglue/,"app.superglue"),r=(0,xd.readProcessEnvironmentValue)("SUPERGLUE_CLI_PRESET"),n=r&&ZN.has(r)?r:e.preset&&ZN.has(e.preset)?e.preset:"admin";return{...KN,...e,apiKey:t,endpoint:a,webEndpoint:i,preset:n,output:{...KN.output,...e.output}}}function Wb(o,e){let t=Fr(e);kt.existsSync(t)||kt.mkdirSync(t,{recursive:!0}),kt.writeFileSync(Pr.join(t,"config.json"),JSON.stringify(o,null,2)+`
|
|
1662
|
-
`,{mode:384})}function Zb(o,e){let t=Pr.join(Fr(e),"drafts");if(kt.existsSync(t)||kt.mkdirSync(t,{recursive:!0}),o.output.mode==="stdout+file"){let a=Pr.resolve(o.output.directory);kt.existsSync(a)||kt.mkdirSync(a,{recursive:!0})}}var Wq=pe(Pt());var $q=pe(require("readline"));var tO=require("child_process"),aO=require("util");var eO={name:"@superglue/cli",version:"1.1.
|
|
1666
|
+
`,{mode:384})}function Zb(o,e){let t=Pr.join(Fr(e),"drafts");if(kt.existsSync(t)||kt.mkdirSync(t,{recursive:!0}),o.output.mode==="stdout+file"){let a=Pr.resolve(o.output.directory);kt.existsSync(a)||kt.mkdirSync(a,{recursive:!0})}}var Wq=pe(Pt());var $q=pe(require("readline"));var tO=require("child_process"),aO=require("util");var eO={name:"@superglue/cli",version:"1.1.98",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 d2e=(0,aO.promisify)(tO.exec),rt=eO.version;function oO(o){let e=o.match(/^(\d+)(?:-(.+))?$/);return e?{numeric:parseInt(e[1],10),prerelease:e[2]||null}:{numeric:0,prerelease:o}}function Xb(o,e){let t=o.split("."),a=e.split("."),i=Math.max(t.length,a.length);for(let r=0;r<i;r++){let n=oO(t[r]||"0"),s=oO(a[r]||"0");if(n.numeric<s.numeric)return-1;if(n.numeric>s.numeric||n.prerelease===null&&s.prerelease!==null)return 1;if(n.prerelease!==null&&s.prerelease===null)return-1;if(n.prerelease!==null&&s.prerelease!==null){if(n.prerelease<s.prerelease)return-1;if(n.prerelease>s.prerelease)return 1}}return 0}async function ey(){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 Kb=null;function iO(){me()&&(Kb=ey())}async function rO(){if(!(!me()||!Kb)){try{let o=new Promise(t=>{setTimeout(()=>t(null),2e3).unref()}),e=await Promise.race([Kb,o]);e&&Xb(rt,e)<0&&(console.error(""),console.error(`${b.cyan}${b.bold} Update available: ${rt} \u2192 ${e}${b.reset}`),console.error(`${b.cyan} Run ${b.bold}sg update${b.reset}${b.cyan} to upgrade${b.reset}`),console.error(""))}catch{}Kb=null}}async function nO(){let o=await ey();if(!o)return{success:!1,message:"Could not fetch latest version from npm"};if(Xb(rt,o)>=0)return{success:!0,message:`Already on latest version (${rt})`};try{return await d2e("npm install -g @superglue/cli@latest"),{success:!0,message:`Updated from ${rt} to ${o}`}}catch(e){return{success:!1,message:`Update failed: ${e.message}. Try manually: npm install -g @superglue/cli@latest`}}}var me=()=>process.argv.includes("--table")&&process.stdout.isTTY,ya=()=>process.argv.includes("--full"),b={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 sO(o,e){let t=e||o;return`\x1B]8;;${o}\x07${b.underline}${b.cyan}${t}${b.reset}\x1B]8;;\x07`}function cO(){if(!me())return;let o=b.reset,e=b.dim,t="\x1B[47;30m",a=[" #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- "," =@@@- @@@@ "," @@@ @@% "," -@@ @@@@= @@@ @@@ @@@@@#@ @@@@@@@ @@@@@@@ @@@@@@ @@@ @@@ @@@ @@@@@@* %@@ "," @@ @@@ *@ @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @% @@@ @@@ @@@ @@* @@# "," #@@ @@@# @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @@@ @@@ @@@ @@* @@ "," @@- @@@@= @@@ @@@ @@@@@@@ @@@@@@ @@@@@@@ @@@ @@% @@@ @@@ @@@ @@@@@. @@."," #@% .@@@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* @@ "," @@ @ @@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* *@@ "," -@@ @@@@= @@@@@@ @@@ @@@@@@@ @@@ -@@ @@@@@@ @@@@@@% @@@@@@. @@@@@@* #@@ "," :@@* @@@ "," %@@@ =@@@. "," :@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% "];console.log(""),a.forEach(i=>{let r=i.search(/\S/),n=i.length-[...i].reverse().join("").search(/\S/)-1;if(r===-1)return console.log(" "+i);let s=i.slice(0,r),c=i.slice(r,n+1).split("").map(l=>l===" "?" ":"\u2588").join(""),m=i.slice(n+1);console.log(` ${s}${t}${c}${o}${m}`)}),console.log(` ${e} CLI v${rt}${o}`),console.log("")}function eo(o){if(!me())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 ${b.cyan}${e[t++%e.length]}${b.reset} ${a}`)},n=setInterval(r,80);return{update:s=>{a=s},log:s=>{i(),console.log(` ${b.dim}\u2502${b.reset} ${s}`),r()},stop:s=>{clearInterval(n),i(),s&&console.log(` ${s}`)}}}function te(o){me()?oy(o):console.log(JSON.stringify(o,null,2))}function qe(o,e){me()?(console.log(` ${b.green}\u2713${b.reset} ${o}`),e&&oy(e,4)):console.log(JSON.stringify({success:!0,message:o,...e&&typeof e=="object"?e:{data:e}}))}function I(o,e){me()?(console.error(` ${b.red}\u2717${b.reset} ${o}`),e&&oy(e,4)):console.error(JSON.stringify({success:!1,error:o,details:e}))}function mO(o){me()&&console.log(` ${b.yellow}\u26A0${b.reset} ${o}`)}function Yo(o){me()&&console.log(` ${b.dim}${o}${b.reset}`)}function $r(o){me()&&(console.log(`
|
|
1663
1667
|
${b.bold}${b.cyan}${o}${b.reset}`),console.log(` ${b.dim}${"\u2500".repeat(o.length)}${b.reset}`))}function ir(o,e,t){if(!me()){console.log(JSON.stringify({success:!0,total:t?.total??o.length,items:o}));return}if(o.length===0){console.log(`
|
|
1664
1668
|
${b.dim}0 results${b.reset}
|
|
1665
1669
|
`);return}let a=e||Object.keys(o[0]),i=ya()?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 n=a.map((l,u)=>`${b.bold}${b.cyan}${l.toUpperCase().padEnd(r[u])}${b.reset}`).join(" ");console.log(` ${n}`);let s=r.map(l=>`${b.dim}${"\u2500".repeat(l)}${b.reset}`).join(`${b.dim}\u2500\u2500${b.reset}`);console.log(` ${s}`);for(let l of o){let u=a.map((d,g)=>{let h=String(l[d]??"").replace(/[\n\r]+/g," ").trim();if(h.length>i){let w=`\u2026 (${h.length})`;h=h.slice(0,Math.max(0,i-w.length))+`${b.dim}${w}${b.reset}`}return d==="status"?`${{success:b.green,running:b.yellow,failed:b.red,aborted:b.red,error:b.red,pending:b.dim}[h.toLowerCase()]||""}${h.padEnd(r[g])}${b.reset}`:h.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(`
|