@superglue/cli 1.1.43 → 1.1.44
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 +2 -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.44",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "superglue",
|
|
7
7
|
"email": "hello@superglue.cloud"
|
package/dist/cli.js
CHANGED
|
@@ -358,7 +358,7 @@ attempted value: ${r}
|
|
|
358
358
|
renderState();
|
|
359
359
|
renderSubmissionState("idle");
|
|
360
360
|
post("ready", {});
|
|
361
|
-
})();`});var BE=y(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.DeploymentConfigError=void 0;Dc.buildDeploymentConfig=iH;var XP=["pro","team","enterprise"],wu={pro:"prod_UjB46ulzKsQ1Ef",team:"prod_UiMeaL02tN4BMg",enterprise:"prod_UapuUIQQuluzUV"},vu=["openai","anthropic","gemini","azure","bedrock","vertex"],eH=["tavily","model_provider","searxng","disabled"],oH=["openai","anthropic","azure"],tH=["cloud","enterprise"],aH=["aws","minio"],QE=["email_password","google","github","okta"],Nf=class{constructor(e){this.raw=e,this.issues=[]}build(){let e=this.requiredPort("API_PORT",3002,"runtime.apiPort"),t=this.requiredPort("WEB_PORT",3001,"runtime.webPort"),a=this.requiredUrl("PUBLIC_API_URL",`http://localhost:${e}`,"runtime.publicApiUrl"),i=this.url("INTERNAL_API_URL",a,"runtime.internalApiUrl"),s=this.requiredUrl("PUBLIC_APP_URL","https://app.superglue.cloud","runtime.publicAppUrl"),r=this.url("INTERNAL_APP_URL",s,"runtime.internalAppUrl"),n=this.deploymentMode(),c=this.requiredBoolean("BLOCK_LOCAL_REQUESTS",!1,"security.blockLocalRequests"),m=this.llm(this.choice("PRIMARY_LLM_PROVIDER",vu,"openai","llm.primary.provider"),this.required("PRIMARY_LLM_MODEL","llm.primary.model"),"llm.primary"),l=this.llm(this.choice("SUMMARIZE_LLM_PROVIDER",vu,"openai","llm.summarize.provider"),this.required("SUMMARIZE_LLM_MODEL","llm.summarize.model"),"llm.summarize"),u={deployment:{mode:n,orgConcurrencyLimits:n==="enterprise"?"disabled":"tier_config"},runtime:{apiPort:e,webPort:t,publicApiUrl:a,internalApiUrl:i,publicAppUrl:s,internalAppUrl:r,scheduler:this.scheduler()},website:{contactFormToEmail:this.optional("WEBSITE_CONTACT_FORM_TO_EMAIL")??null},security:{jwtSecret:this.required("JWT_AUTH_SECRET","security.jwtSecret"),internalApiToken:this.required("INTERNAL_API_TOKEN","security.internalApiToken"),credentialsEncryptionKey:this.required("MASTER_ENCRYPTION_KEY","security.credentialsEncryptionKey"),blockLocalRequests:c},storage:{postgres:{host:this.required("POSTGRES_HOST","storage.postgres.host"),port:this.requiredPort("POSTGRES_PORT",5432,"storage.postgres.port"),username:this.required("POSTGRES_USERNAME","storage.postgres.username"),password:this.required("POSTGRES_PASSWORD","storage.postgres.password"),database:this.required("POSTGRES_DB","storage.postgres.database"),ssl:this.requiredBoolean("POSTGRES_SSL",!0,"storage.postgres.ssl")},objectStorage:this.objectStorage()},llm:{primary:m,summarize:l},externalProviders:{posthog:this.posthog(),langfuse:this.langfuse(),resend:this.resend(),loops:this.loops(),webSearch:this.webSearch(m.provider)},billing:this.billing(n),auth:this.auth()};if(this.issues.length>0)throw new xu(this.issues);return u}optional(e){let t=this.raw[e]?.trim();return t||void 0}required(e,t){let a=this.optional(e);return a||(this.issues.push({path:t,message:`${e} is required.`}),"")}requiredOptional(e,t){let a=this.optional(e);return a||this.issues.push({path:t,message:`${e} is required.`}),a}boolean(e,t,a){let i=this.optional(e);return i?i==="true"?!0:i==="false"?!1:(this.issues.push({path:a,message:`${e} must be "true" or "false".`}),t):t}requiredBoolean(e,t,a){let i=this.requiredOptional(e,a);return i?i==="true"?!0:i==="false"?!1:(this.issues.push({path:a,message:`${e} must be "true" or "false".`}),t):t}port(e,t,a){let i=this.optional(e);if(!i)return t;let s=Number(i);return!Number.isInteger(s)||s<1||s>65535?(this.issues.push({path:a,message:`${e} must be a TCP port between 1 and 65535.`}),t):s}requiredPort(e,t,a){return this.requiredOptional(e,a)?this.port(e,t,a):t}url(e,t,a){let i=this.optional(e)||t;try{return new URL(i).toString().replace(/\/$/,"")}catch{return this.issues.push({path:a,message:`${e} must be a valid URL.`}),t}}requiredUrl(e,t,a){return this.requiredOptional(e,a)?this.url(e,t,a):t}choice(e,t,a,i){let s=this.requiredOptional(e,i)?.toLowerCase();return s?t.includes(s)?s:(this.issues.push({path:i,message:`${e} must be one of: ${t.join(", ")}.`}),a):a}listChoice(e,t,a){let i=this.requiredOptional(e,a);if(!i)return[];let s=[],r=new Set;for(let n of i.split(",")){let c=n.trim().toLowerCase();if(!(!c||r.has(c))){if(r.add(c),t.includes(c)){s.push(c);continue}this.issues.push({path:a,message:`${e} contains unsupported value "${c}". Use one of: ${t.join(", ")}.`})}}return s.length===0&&this.issues.push({path:a,message:`${e} must include at least one provider.`}),s}deploymentMode(){return this.choice("DEPLOYMENT_MODE",tH,"cloud","deployment.mode")}scheduler(){return this.requiredBoolean("START_SCHEDULER_SERVER",!1,"runtime.scheduler.mode")?{mode:"in_process"}:{mode:"disabled"}}objectStorage(){if(this.choice("S3_PROVIDER",aH,"aws","storage.objectStorage.provider")==="minio")return{provider:"minio",endpoint:this.required("S3_ENDPOINT","storage.objectStorage.endpoint"),publicEndpoint:this.optional("S3_PUBLIC_ENDPOINT")??null,bucketName:this.required("MINIO_BUCKET_NAME","storage.objectStorage.bucketName"),bucketPrefix:this.bucketPrefix(this.optional("MINIO_BUCKET_PREFIX")||this.optional("AWS_BUCKET_PREFIX")),accessKeyId:this.required("MINIO_ROOT_USER","storage.objectStorage.accessKeyId"),secretAccessKey:this.required("MINIO_ROOT_PASSWORD","storage.objectStorage.secretAccessKey")};let t=this.optional("AWS_S3_ACCESS_KEY_ID"),a=this.optional("AWS_S3_SECRET_ACCESS_KEY");return(t&&!a||!t&&a)&&this.issues.push({path:"storage.objectStorage.credentials",message:"AWS_S3_ACCESS_KEY_ID and AWS_S3_SECRET_ACCESS_KEY must be set together."}),{provider:"aws",region:this.required("AWS_S3_REGION","storage.objectStorage.region"),bucketName:this.required("AWS_BUCKET_NAME","storage.objectStorage.bucketName"),bucketPrefix:this.bucketPrefix(this.optional("AWS_BUCKET_PREFIX")),...t&&a?{accessKeyId:t,secretAccessKey:a,...this.optional("AWS_S3_SESSION_TOKEN")&&{sessionToken:this.optional("AWS_S3_SESSION_TOKEN")}}:{}}}bucketPrefix(e){let t=e?.replace(/^\/+|\/+$/g,"");return t?`${t}/`:""}llm(e,t,a){let i=e.toLowerCase();if(!vu.includes(i))return this.issues.push({path:`${a}.provider`,message:`${a} provider must be one of: ${vu.join(", ")}.`}),{provider:"openai",apiKey:this.optional("OPENAI_API_KEY")||"",model:t};switch(i){case"openai":return this.openai(t,a);case"anthropic":return this.anthropic(t,a);case"gemini":return this.gemini(t,a);case"azure":return this.azure(t,a);case"bedrock":return this.bedrock(t,a);case"vertex":return this.vertex(t,a)}}openai(e,t){return{provider:"openai",apiKey:this.required("OPENAI_API_KEY",`${t}.apiKey`),model:e,...this.optional("OPENAI_BASE_URL")&&{baseUrl:this.optional("OPENAI_BASE_URL")}}}anthropic(e,t){return{provider:"anthropic",apiKey:this.required("ANTHROPIC_API_KEY",`${t}.apiKey`),model:e,...this.optional("ANTHROPIC_BASE_URL")&&{baseUrl:this.optional("ANTHROPIC_BASE_URL")}}}gemini(e,t){return{provider:"gemini",apiKey:this.required("GEMINI_API_KEY",`${t}.apiKey`),model:e,...this.optional("GEMINI_BASE_URL")&&{baseUrl:this.optional("GEMINI_BASE_URL")}}}azure(e,t){let a=this.optional("AZURE_RESOURCE_NAME"),i=this.optional("AZURE_BASE_URL");return!a&&!i&&this.issues.push({path:t,message:"AZURE_RESOURCE_NAME or AZURE_BASE_URL is required when using Azure."}),{provider:"azure",apiKey:this.required("AZURE_API_KEY",`${t}.apiKey`),model:e,...a&&{resourceName:a},...i&&{baseUrl:i},...this.optional("AZURE_API_VERSION")&&{apiVersion:this.optional("AZURE_API_VERSION")},useDeploymentBasedUrls:this.boolean("AZURE_USE_DEPLOYMENT_BASED_URLS",!1,`${t}.useDeploymentBasedUrls`)}}bedrock(e,t){let a=this.optional("BEDROCK_AWS_ACCESS_KEY_ID"),i=this.optional("BEDROCK_AWS_SECRET_ACCESS_KEY");return(a&&!i||!a&&i)&&this.issues.push({path:`${t}.credentials`,message:"BEDROCK_AWS_ACCESS_KEY_ID and BEDROCK_AWS_SECRET_ACCESS_KEY must be set together."}),{provider:"bedrock",model:e,region:this.required("AWS_BEDROCK_REGION",`${t}.region`),...this.optional("AWS_BASE_URL")&&{baseUrl:this.optional("AWS_BASE_URL")},...a&&i&&{accessKeyId:a,secretAccessKey:i,...this.optional("BEDROCK_AWS_SESSION_TOKEN")&&{sessionToken:this.optional("BEDROCK_AWS_SESSION_TOKEN")}}}}vertex(e,t){let a=this.optional("VERTEX_API_KEY"),i=this.optional("VERTEX_CLIENT_EMAIL"),s=this.optional("VERTEX_PRIVATE_KEY"),r=this.optional("GOOGLE_APPLICATION_CREDENTIALS"),n=i&&s?{type:"service_account",clientEmail:i,privateKey:s}:r?{type:"credentials_file",path:r}:a?{type:"api_key",apiKey:a}:null;return n||this.issues.push({path:`${t}.auth`,message:"VERTEX_API_KEY, VERTEX_CLIENT_EMAIL plus VERTEX_PRIVATE_KEY, or GOOGLE_APPLICATION_CREDENTIALS is required when using Vertex."}),e.startsWith("claude")&&n?.type==="api_key"&&this.issues.push({path:`${t}.auth`,message:"Vertex Claude models require service account or credentials-file auth."}),{provider:"vertex",model:e,...this.optional("VERTEX_PROJECT")&&{project:this.optional("VERTEX_PROJECT")},...this.optional("VERTEX_LOCATION")&&{location:this.optional("VERTEX_LOCATION")},auth:n||{type:"api_key",apiKey:""}}}webSearch(e){let t=this.choice("WEB_SEARCH_PROVIDER",eH,"disabled","externalProviders.webSearch.provider"),a=this.optional("WEB_SEARCH_API_KEY"),i=oH.includes(e)?e:null;return t==="disabled"?{provider:"disabled"}:t==="model_provider"?i?{provider:"model_provider",llmProvider:i}:(this.issues.push({path:"externalProviders.webSearch",message:"WEB_SEARCH_PROVIDER=model_provider requires OpenAI, Anthropic, or Azure."}),{provider:"disabled"}):t==="tavily"?a?{provider:"tavily",apiKey:a}:(this.issues.push({path:"externalProviders.webSearch.apiKey",message:"WEB_SEARCH_API_KEY is required when WEB_SEARCH_PROVIDER=tavily."}),{provider:"disabled"}):t==="searxng"?this.searxng(a):{provider:"disabled"}}searxng(e){return{provider:"searxng",endpoint:this.required("WEB_SEARCH_ENDPOINT","externalProviders.webSearch.endpoint"),...e&&{apiKey:e}}}posthog(){return this.boolean("POSTHOG_ENABLED",!1,"externalProviders.posthog.enabled")?{enabled:!0,apiKey:this.required("POSTHOG_KEY","externalProviders.posthog.apiKey"),serverHost:this.required("POSTHOG_HOST","externalProviders.posthog.serverHost")}:{enabled:!1}}langfuse(){return this.boolean("LANGFUSE_ENABLED",!1,"externalProviders.langfuse.enabled")?{enabled:!0,publicKey:this.required("LANGFUSE_PUBLIC_KEY","externalProviders.langfuse.publicKey"),secretKey:this.required("LANGFUSE_SECRET_KEY","externalProviders.langfuse.secretKey"),baseUrl:this.required("LANGFUSE_BASE_URL","externalProviders.langfuse.baseUrl"),tracingEnvironment:this.required("LANGFUSE_TRACING_ENVIRONMENT","externalProviders.langfuse.tracingEnvironment")}:{enabled:!1}}resend(){return this.boolean("RESEND_ENABLED",!1,"externalProviders.resend.enabled")?{enabled:!0,apiKey:this.required("RESEND_API_KEY","externalProviders.resend.apiKey"),fromEmail:this.required("RESEND_FROM_EMAIL","externalProviders.resend.fromEmail")}:{enabled:!1}}loops(){return this.boolean("LOOPS_ENABLED",!1,"externalProviders.loops.enabled")?{enabled:!0,apiKey:this.required("LOOPS_API_KEY","externalProviders.loops.apiKey")}:{enabled:!1}}billing(e){return e==="enterprise"?{provider:"disabled"}:{provider:"stripe",secretKey:this.required("STRIPE_SECRET_KEY","billing.secretKey"),webhookSecret:this.required("STRIPE_WEBHOOK_SECRET","billing.webhookSecret"),productIds:this.stripeProductIds()}}stripeProductIds(){let e=this.optional("STRIPE_PRODUCT_IDS");if(!e)return wu;try{let t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return this.issues.push({path:"billing.productIds",message:"STRIPE_PRODUCT_IDS must be a JSON object."}),wu;let a={...wu};for(let i of XP){let s=t[i];typeof s=="string"&&s.trim()&&(a[i]=s.trim())}return a}catch{return this.issues.push({path:"billing.productIds",message:"STRIPE_PRODUCT_IDS must be valid JSON."}),wu}}auth(){let e=this.listChoice("AUTH_PROVIDERS",QE,"auth.providers"),t=new Map,a=this.configuredOAuthProvider("google","GOOGLE"),i=this.configuredOAuthProvider("github","GITHUB"),s=this.configuredOktaProvider();a&&t.set("google",a),i&&t.set("github",i),s&&t.set("okta",s);for(let l of e)switch(l){case"email_password":t.set(l,{provider:l});break;case"google":t.set(l,this.oauthProvider(l,"GOOGLE","auth.providers.google"));break;case"github":t.set(l,this.oauthProvider(l,"GITHUB","auth.providers.github"));break;case"okta":t.set(l,this.oktaProvider());break}let r=QE.flatMap(l=>{let u=t.get(l);return u?[u]:[]}),n=this.requiredBoolean("AUTH_DISABLE_SIGNUP",!1,"auth.disableSignup"),c=this.requiredBoolean("AUTH_DISABLE_INVITES",!1,"auth.disableInvites"),m=t.has("okta");return n&&c&&!m&&this.issues.push({path:"auth",message:"AUTH_DISABLE_SIGNUP and AUTH_DISABLE_INVITES cannot both be true without an Okta provider \u2014 no account creation path would remain."}),{providers:r,visibleProviders:e,disableSignup:n,disableInvites:c}}configuredOAuthProvider(e,t){let a=this.optional(`${t}_CLIENT_ID`),i=this.optional(`${t}_CLIENT_SECRET`);if(!(!a||!i))return{provider:e,clientId:a,clientSecret:i}}configuredOktaProvider(){let e=this.optional("OKTA_CLIENT_ID"),t=this.optional("OKTA_CLIENT_SECRET"),a=this.optional("OKTA_ISSUER"),i=this.optional("OKTA_ORG_ID");if(!(!e||!t||!a||!i))return{provider:"okta",clientId:e,clientSecret:t,issuer:a.replace(/\/$/,""),organizationId:i}}oauthProvider(e,t,a){return{provider:e,clientId:this.required(`${t}_CLIENT_ID`,`${a}.clientId`),clientSecret:this.required(`${t}_CLIENT_SECRET`,`${a}.clientSecret`)}}oktaProvider(){return{provider:"okta",clientId:this.required("OKTA_CLIENT_ID","auth.providers.okta.clientId"),clientSecret:this.required("OKTA_CLIENT_SECRET","auth.providers.okta.clientSecret"),issuer:this.required("OKTA_ISSUER","auth.providers.okta.issuer").replace(/\/$/,""),organizationId:this.required("OKTA_ORG_ID","auth.providers.okta.organizationId")}}},xu=class extends Error{constructor(e){super(`Invalid deployment environment:
|
|
361
|
+
})();`});var BE=y(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.DeploymentConfigError=void 0;Dc.buildDeploymentConfig=iH;var XP=["pro","team","enterprise"],wu={pro:"prod_UjB46ulzKsQ1Ef",team:"prod_UiMeaL02tN4BMg",enterprise:"prod_UapuUIQQuluzUV"},vu=["openai","anthropic","gemini","azure","bedrock","vertex"],eH=["tavily","model_provider","searxng","disabled"],oH=["openai","anthropic","azure"],tH=["cloud","enterprise"],aH=["aws","minio"],QE=["email_password","google","github","okta"],Nf=class{constructor(e){this.raw=e,this.issues=[]}build(){let e=this.requiredPort("API_PORT",3002,"runtime.apiPort"),t=this.requiredPort("WEB_PORT",3001,"runtime.webPort"),a=this.requiredUrl("PUBLIC_API_URL",`http://localhost:${e}`,"runtime.publicApiUrl"),i=this.url("INTERNAL_API_URL",a,"runtime.internalApiUrl"),s=this.requiredUrl("PUBLIC_APP_URL","https://app.superglue.cloud","runtime.publicAppUrl"),r=this.url("INTERNAL_APP_URL",s,"runtime.internalAppUrl"),n=this.deploymentMode(),c=this.requiredBoolean("BLOCK_LOCAL_REQUESTS",!1,"security.blockLocalRequests"),m=this.llm(this.choice("PRIMARY_LLM_PROVIDER",vu,"openai","llm.primary.provider"),this.required("PRIMARY_LLM_MODEL","llm.primary.model"),"llm.primary"),l=this.llm(this.choice("SUMMARIZE_LLM_PROVIDER",vu,"openai","llm.summarize.provider"),this.required("SUMMARIZE_LLM_MODEL","llm.summarize.model"),"llm.summarize"),u={deployment:{mode:n,orgConcurrencyLimits:n==="enterprise"?"disabled":"tier_config"},runtime:{apiPort:e,webPort:t,publicApiUrl:a,internalApiUrl:i,publicAppUrl:s,internalAppUrl:r,scheduler:this.scheduler()},website:{contactFormToEmail:this.optional("WEBSITE_CONTACT_FORM_TO_EMAIL")??null},security:{jwtSecret:this.required("JWT_AUTH_SECRET","security.jwtSecret"),internalApiToken:this.required("INTERNAL_API_TOKEN","security.internalApiToken"),credentialsEncryptionKey:this.required("MASTER_ENCRYPTION_KEY","security.credentialsEncryptionKey"),blockLocalRequests:c},storage:{postgres:{host:this.required("POSTGRES_HOST","storage.postgres.host"),port:this.requiredPort("POSTGRES_PORT",5432,"storage.postgres.port"),username:this.required("POSTGRES_USERNAME","storage.postgres.username"),password:this.required("POSTGRES_PASSWORD","storage.postgres.password"),database:this.required("POSTGRES_DB","storage.postgres.database"),ssl:this.requiredBoolean("POSTGRES_SSL",!0,"storage.postgres.ssl")},objectStorage:this.objectStorage()},llm:{primary:m,summarize:l},externalProviders:{posthog:this.posthog(),langfuse:this.langfuse(),resend:this.resend(),loops:this.loops(),webSearch:this.webSearch(m.provider)},billing:this.billing(n),auth:this.auth()};if(this.issues.length>0)throw new xu(this.issues);return u}optional(e){let t=this.raw[e]?.trim();return t||void 0}required(e,t){let a=this.optional(e);return a||(this.issues.push({path:t,message:`${e} is required.`}),"")}requiredOptional(e,t){let a=this.optional(e);return a||this.issues.push({path:t,message:`${e} is required.`}),a}boolean(e,t,a){let i=this.optional(e);return i?i==="true"?!0:i==="false"?!1:(this.issues.push({path:a,message:`${e} must be "true" or "false".`}),t):t}requiredBoolean(e,t,a){let i=this.requiredOptional(e,a);return i?i==="true"?!0:i==="false"?!1:(this.issues.push({path:a,message:`${e} must be "true" or "false".`}),t):t}port(e,t,a){let i=this.optional(e);if(!i)return t;let s=Number(i);return!Number.isInteger(s)||s<1||s>65535?(this.issues.push({path:a,message:`${e} must be a TCP port between 1 and 65535.`}),t):s}requiredPort(e,t,a){return this.requiredOptional(e,a)?this.port(e,t,a):t}url(e,t,a){let i=this.optional(e)||t;try{return new URL(i).toString().replace(/\/$/,"")}catch{return this.issues.push({path:a,message:`${e} must be a valid URL.`}),t}}requiredUrl(e,t,a){return this.requiredOptional(e,a)?this.url(e,t,a):t}choice(e,t,a,i){let s=this.requiredOptional(e,i)?.toLowerCase();return s?t.includes(s)?s:(this.issues.push({path:i,message:`${e} must be one of: ${t.join(", ")}.`}),a):a}listChoice(e,t,a){let i=this.requiredOptional(e,a);if(!i)return[];let s=[],r=new Set;for(let n of i.split(",")){let c=n.trim().toLowerCase();if(!(!c||r.has(c))){if(r.add(c),t.includes(c)){s.push(c);continue}this.issues.push({path:a,message:`${e} contains unsupported value "${c}". Use one of: ${t.join(", ")}.`})}}return s.length===0&&this.issues.push({path:a,message:`${e} must include at least one provider.`}),s}deploymentMode(){return this.choice("DEPLOYMENT_MODE",tH,"cloud","deployment.mode")}scheduler(){return this.requiredBoolean("START_SCHEDULER_SERVER",!1,"runtime.scheduler.mode")?{mode:"in_process"}:{mode:"disabled"}}objectStorage(){if(this.choice("S3_PROVIDER",aH,"aws","storage.objectStorage.provider")==="minio")return{provider:"minio",endpoint:this.required("S3_ENDPOINT","storage.objectStorage.endpoint"),publicEndpoint:this.optional("S3_PUBLIC_ENDPOINT")??null,bucketName:this.required("MINIO_BUCKET_NAME","storage.objectStorage.bucketName"),bucketPrefix:this.bucketPrefix(this.optional("MINIO_BUCKET_PREFIX")||this.optional("AWS_BUCKET_PREFIX")),accessKeyId:this.required("MINIO_ROOT_USER","storage.objectStorage.accessKeyId"),secretAccessKey:this.required("MINIO_ROOT_PASSWORD","storage.objectStorage.secretAccessKey")};let t=this.optional("AWS_S3_ACCESS_KEY_ID"),a=this.optional("AWS_S3_SECRET_ACCESS_KEY");return(t&&!a||!t&&a)&&this.issues.push({path:"storage.objectStorage.credentials",message:"AWS_S3_ACCESS_KEY_ID and AWS_S3_SECRET_ACCESS_KEY must be set together."}),{provider:"aws",region:this.required("AWS_S3_REGION","storage.objectStorage.region"),bucketName:this.required("AWS_BUCKET_NAME","storage.objectStorage.bucketName"),bucketPrefix:this.bucketPrefix(this.optional("AWS_BUCKET_PREFIX")),...t&&a?{accessKeyId:t,secretAccessKey:a,...this.optional("AWS_S3_SESSION_TOKEN")&&{sessionToken:this.optional("AWS_S3_SESSION_TOKEN")}}:{}}}bucketPrefix(e){let t=e?.replace(/^\/+|\/+$/g,"");return t?`${t}/`:""}llm(e,t,a){let i=e.toLowerCase();if(!vu.includes(i))return this.issues.push({path:`${a}.provider`,message:`${a} provider must be one of: ${vu.join(", ")}.`}),{provider:"openai",apiKey:this.optional("OPENAI_API_KEY")||"",model:t};switch(i){case"openai":return this.openai(t,a);case"anthropic":return this.anthropic(t,a);case"gemini":return this.gemini(t,a);case"azure":return this.azure(t,a);case"bedrock":return this.bedrock(t,a);case"vertex":return this.vertex(t,a)}}openai(e,t){return{provider:"openai",apiKey:this.required("OPENAI_API_KEY",`${t}.apiKey`),model:e,...this.optional("OPENAI_BASE_URL")&&{baseUrl:this.optional("OPENAI_BASE_URL")}}}anthropic(e,t){return{provider:"anthropic",apiKey:this.required("ANTHROPIC_API_KEY",`${t}.apiKey`),model:e,...this.optional("ANTHROPIC_BASE_URL")&&{baseUrl:this.optional("ANTHROPIC_BASE_URL")}}}gemini(e,t){return{provider:"gemini",apiKey:this.required("GEMINI_API_KEY",`${t}.apiKey`),model:e,...this.optional("GEMINI_BASE_URL")&&{baseUrl:this.optional("GEMINI_BASE_URL")}}}azure(e,t){let a=this.optional("AZURE_RESOURCE_NAME"),i=this.optional("AZURE_BASE_URL");return!a&&!i&&this.issues.push({path:t,message:"AZURE_RESOURCE_NAME or AZURE_BASE_URL is required when using Azure."}),{provider:"azure",apiKey:this.required("AZURE_API_KEY",`${t}.apiKey`),model:e,...a&&{resourceName:a},...i&&{baseUrl:i},...this.optional("AZURE_API_VERSION")&&{apiVersion:this.optional("AZURE_API_VERSION")},useDeploymentBasedUrls:this.boolean("AZURE_USE_DEPLOYMENT_BASED_URLS",!1,`${t}.useDeploymentBasedUrls`)}}bedrock(e,t){let a=this.optional("BEDROCK_AWS_ACCESS_KEY_ID"),i=this.optional("BEDROCK_AWS_SECRET_ACCESS_KEY");return(a&&!i||!a&&i)&&this.issues.push({path:`${t}.credentials`,message:"BEDROCK_AWS_ACCESS_KEY_ID and BEDROCK_AWS_SECRET_ACCESS_KEY must be set together."}),{provider:"bedrock",model:e,region:this.required("AWS_BEDROCK_REGION",`${t}.region`),...this.optional("AWS_BASE_URL")&&{baseUrl:this.optional("AWS_BASE_URL")},...a&&i&&{accessKeyId:a,secretAccessKey:i,...this.optional("BEDROCK_AWS_SESSION_TOKEN")&&{sessionToken:this.optional("BEDROCK_AWS_SESSION_TOKEN")}}}}vertex(e,t){let a=this.optional("VERTEX_API_KEY"),i=this.optional("VERTEX_CLIENT_EMAIL"),s=this.optional("VERTEX_PRIVATE_KEY"),r=this.optional("GOOGLE_APPLICATION_CREDENTIALS"),n=i&&s?{type:"service_account",clientEmail:i,privateKey:s}:r?{type:"credentials_file",path:r}:a?{type:"api_key",apiKey:a}:null;return n||this.issues.push({path:`${t}.auth`,message:"VERTEX_API_KEY, VERTEX_CLIENT_EMAIL plus VERTEX_PRIVATE_KEY, or GOOGLE_APPLICATION_CREDENTIALS is required when using Vertex."}),e.startsWith("claude")&&n?.type==="api_key"&&this.issues.push({path:`${t}.auth`,message:"Vertex Claude models require service account or credentials-file auth."}),{provider:"vertex",model:e,...this.optional("VERTEX_PROJECT")&&{project:this.optional("VERTEX_PROJECT")},...this.optional("VERTEX_LOCATION")&&{location:this.optional("VERTEX_LOCATION")},auth:n||{type:"api_key",apiKey:""}}}webSearch(e){let t=this.choice("WEB_SEARCH_PROVIDER",eH,"disabled","externalProviders.webSearch.provider"),a=this.optional("WEB_SEARCH_API_KEY"),i=oH.includes(e)?e:null;return t==="disabled"?{provider:"disabled"}:t==="model_provider"?i?{provider:"model_provider",llmProvider:i}:(this.issues.push({path:"externalProviders.webSearch",message:"WEB_SEARCH_PROVIDER=model_provider requires OpenAI, Anthropic, or Azure."}),{provider:"disabled"}):t==="tavily"?a?{provider:"tavily",apiKey:a}:(this.issues.push({path:"externalProviders.webSearch.apiKey",message:"WEB_SEARCH_API_KEY is required when WEB_SEARCH_PROVIDER=tavily."}),{provider:"disabled"}):t==="searxng"?this.searxng(a):{provider:"disabled"}}searxng(e){return{provider:"searxng",endpoint:this.required("WEB_SEARCH_ENDPOINT","externalProviders.webSearch.endpoint"),...e&&{apiKey:e}}}posthog(){return this.boolean("POSTHOG_ENABLED",!1,"externalProviders.posthog.enabled")?{enabled:!0,apiKey:this.required("POSTHOG_KEY","externalProviders.posthog.apiKey"),serverHost:this.required("POSTHOG_HOST","externalProviders.posthog.serverHost")}:{enabled:!1}}langfuse(){return this.boolean("LANGFUSE_ENABLED",!1,"externalProviders.langfuse.enabled")?{enabled:!0,publicKey:this.required("LANGFUSE_PUBLIC_KEY","externalProviders.langfuse.publicKey"),secretKey:this.required("LANGFUSE_SECRET_KEY","externalProviders.langfuse.secretKey"),baseUrl:this.required("LANGFUSE_BASE_URL","externalProviders.langfuse.baseUrl"),tracingEnvironment:this.required("LANGFUSE_TRACING_ENVIRONMENT","externalProviders.langfuse.tracingEnvironment")}:{enabled:!1}}resend(){return this.boolean("RESEND_ENABLED",!1,"externalProviders.resend.enabled")?{enabled:!0,apiKey:this.required("RESEND_API_KEY","externalProviders.resend.apiKey"),fromEmail:this.required("RESEND_FROM_EMAIL","externalProviders.resend.fromEmail")}:{enabled:!1}}loops(){return this.boolean("LOOPS_ENABLED",!1,"externalProviders.loops.enabled")?{enabled:!0,apiKey:this.required("LOOPS_API_KEY","externalProviders.loops.apiKey")}:{enabled:!1}}billing(e){return e==="enterprise"?{provider:"disabled"}:{provider:"stripe",secretKey:this.required("STRIPE_SECRET_KEY","billing.secretKey"),webhookSecret:this.required("STRIPE_WEBHOOK_SECRET","billing.webhookSecret"),productIds:this.stripeProductIds()}}stripeProductIds(){let e=this.optional("STRIPE_PRODUCT_IDS");if(!e)return wu;try{let t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return this.issues.push({path:"billing.productIds",message:"STRIPE_PRODUCT_IDS must be a JSON object."}),wu;let a={...wu};for(let i of XP){let s=t[i];typeof s=="string"&&s.trim()&&(a[i]=s.trim())}return a}catch{return this.issues.push({path:"billing.productIds",message:"STRIPE_PRODUCT_IDS must be valid JSON."}),wu}}auth(){let e=this.optional("OKTA_SCIM_TOKEN");e&&e.length<32&&this.issues.push({path:"auth.providers.okta.scimToken",message:"OKTA_SCIM_TOKEN must contain at least 32 characters."});let t=this.listChoice("AUTH_PROVIDERS",QE,"auth.providers"),a=new Map,i=this.configuredOAuthProvider("google","GOOGLE"),s=this.configuredOAuthProvider("github","GITHUB"),r=this.configuredOktaProvider();i&&a.set("google",i),s&&a.set("github",s),r&&a.set("okta",r);for(let u of t)switch(u){case"email_password":a.set(u,{provider:u});break;case"google":a.set(u,this.oauthProvider(u,"GOOGLE","auth.providers.google"));break;case"github":a.set(u,this.oauthProvider(u,"GITHUB","auth.providers.github"));break;case"okta":a.set(u,this.oktaProvider());break}let n=QE.flatMap(u=>{let d=a.get(u);return d?[d]:[]}),c=this.requiredBoolean("AUTH_DISABLE_SIGNUP",!1,"auth.disableSignup"),m=this.requiredBoolean("AUTH_DISABLE_INVITES",!1,"auth.disableInvites"),l=a.has("okta");return c&&m&&!l&&this.issues.push({path:"auth",message:"AUTH_DISABLE_SIGNUP and AUTH_DISABLE_INVITES cannot both be true without an Okta provider \u2014 no account creation path would remain."}),{providers:n,visibleProviders:t,disableSignup:c,disableInvites:m}}configuredOAuthProvider(e,t){let a=this.optional(`${t}_CLIENT_ID`),i=this.optional(`${t}_CLIENT_SECRET`);if(!(!a||!i))return{provider:e,clientId:a,clientSecret:i}}configuredOktaProvider(){let e=this.optional("OKTA_CLIENT_ID"),t=this.optional("OKTA_CLIENT_SECRET"),a=this.optional("OKTA_ISSUER"),i=this.optional("OKTA_ORG_ID"),s=this.optional("OKTA_SCIM_TOKEN");if(!(!e||!t||!a||!i))return{provider:"okta",clientId:e,clientSecret:t,issuer:a.replace(/\/$/,""),organizationId:i,...s?{scimToken:s}:{}}}oauthProvider(e,t,a){return{provider:e,clientId:this.required(`${t}_CLIENT_ID`,`${a}.clientId`),clientSecret:this.required(`${t}_CLIENT_SECRET`,`${a}.clientSecret`)}}oktaProvider(){let e=this.optional("OKTA_SCIM_TOKEN");return{provider:"okta",clientId:this.required("OKTA_CLIENT_ID","auth.providers.okta.clientId"),clientSecret:this.required("OKTA_CLIENT_SECRET","auth.providers.okta.clientSecret"),issuer:this.required("OKTA_ISSUER","auth.providers.okta.issuer").replace(/\/$/,""),organizationId:this.required("OKTA_ORG_ID","auth.providers.okta.organizationId"),...e?{scimToken:e}:{}}}},xu=class extends Error{constructor(e){super(`Invalid deployment environment:
|
|
362
362
|
${e.map(t=>`- ${t.path}: ${t.message}`).join(`
|
|
363
363
|
`)}`),this.issues=e,this.name="DeploymentConfigError"}};Dc.DeploymentConfigError=xu;function iH(o){return new Nf(o).build()}});var SE=y(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.readProcessDeploymentEnvironment=sH;ms.readProcessEnvironmentValue=Uf;ms.writeProcessEnvironmentValue=rH;ms.isProcessEnvironmentValue=nH;ms.readProcessEnvironmentSnapshot=cH;function sH(){return process.env}function Uf(o){return process.env[o]}function rH(o,e){process.env[o]=e}function nH(o,e){return Uf(o)===e}function cH(o){return Object.fromEntries(o.map(e=>[e,Uf(e)]))}});var RE=y(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0})});var NE=y(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.ADD_VALID_INVITE_MESSAGE=void 0;Me.normalizeInvitationEmail=ni;Me.isValidInvitationEmail=Of;Me.isOrganizationInviteRole=TE;Me.parseOrganizationInviteRole=uH;Me.getInvitationTimestamp=dH;Me.createInviteRow=gH;Me.isInviteRowEmpty=_f;Me.isInviteRowEmailInvalid=pH;Me.validateInviteRows=hH;Me.getInviteValidationMessage=fH;Me.getInviteRowsForInvitations=bH;Me.getInviteRowsForEmails=yH;Me.mapInvitationsToRows=kH;Me.formatEmailList=Mf;Me.isStaleInvitationError=AH;var mH=wr();Me.ADD_VALID_INVITE_MESSAGE="Add at least one valid invite.";var lH=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ni(o){return o.trim().toLowerCase()}function Of(o){return lH.test(ni(o))}function TE(o){return o==="member"||o==="admin"}function uH(o){return o?TE(o)?o:null:"member"}function dH(o){if(!o)return 0;let e=(0,mH.getUTCTimestampMs)(o);return Number.isFinite(e)?e:0}function gH(o,e){return{id:o,email:"",role:"member",...e?.length?{targetOrgIds:e}:{}}}function _f(o){return!o.email.trim()&&o.role==="member"}function pH(o,e){let t=ni(o.email);return t?Of(t)?e.filter(a=>ni(a.email)===t).length>1:!0:!_f(o)}function hH(o){let e=new Set,t=[],a=[],i=[],s=0;for(let r of o){let n=ni(r.email);if(!n){_f(r)||(s+=1);continue}if(!Of(n)){a.push(n);continue}if(e.has(n)){i.push(n);continue}if(e.add(n),r.targetOrgIds?.length)for(let c of r.targetOrgIds)t.push({email:n,role:r.role,targetOrgId:c});else t.push({email:n,role:r.role})}return{invitations:t,invalidEmails:a,duplicateEmails:i,incompleteRows:s}}function fH(o){return o.invalidEmails.length>0?`Fix invalid email: ${Mf(o.invalidEmails)}`:o.duplicateEmails.length>0?`Remove duplicate email: ${Mf(o.duplicateEmails)}`:o.incompleteRows>0?"Check invite rows.":o.invitations.length===0?Me.ADD_VALID_INVITE_MESSAGE:null}function bH(o,e){let t=new Set(e.map(a=>a.email));return o.filter(a=>t.has(ni(a.email)))}function yH(o,e){let t=new Set(e.map(ni));return o.filter(a=>t.has(ni(a.email)))}function kH(o,e){let t=new Map;for(let a of o){let i=t.get(a.email);if(i){a.targetOrgId&&!i.targetOrgIds?.includes(a.targetOrgId)&&(i.targetOrgIds=[...i.targetOrgIds??[],a.targetOrgId]);continue}t.set(a.email,{id:e(),email:a.email,role:a.role,...a.targetOrgId?{targetOrgIds:[a.targetOrgId]}:{}})}return[...t.values()]}function Mf(o){return o.length<=3?o.join(", "):`${o.slice(0,3).join(", ")} and ${o.length-3} more`}function AH(o){if(!(o instanceof Error))return!1;let e=o.message.toLowerCase();return e.includes("pending invitation not found")||e.includes("invitation has expired")}});var UE=y(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.UPLOADED_LOGO_TOKEN=void 0;ls.isLibraryIconToken=vH;ls.isUploadedLogoToken=xH;ls.UPLOADED_LOGO_TOKEN="upload:custom";var wH=["lucide:","simpleicons:"];function vH(o){return!!o&&wH.some(e=>o.startsWith(e))}function xH(o){return o===ls.UPLOADED_LOGO_TOKEN}});var OE=y(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.MCP_SERVER_NAME_MAX_LENGTH=Uo.MCP_SERVER_NAME_MIN_LENGTH=void 0;Uo.sanitizeMcpServerNameInput=ME;Uo.slugifyMcpServerName=EH;Uo.validateMcpServerName=IH;Uo.MCP_SERVER_NAME_MIN_LENGTH=2;Uo.MCP_SERVER_NAME_MAX_LENGTH=63;var zH=/^[a-z0-9][a-z0-9-]*[a-z0-9]$/,qH=new Set([".well-known","oauth","health","register"]);function ME(o){return o.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-")}function EH(o){return ME(o).replace(/^-|-$/g,"")}function IH(o){return!o||o.length<Uo.MCP_SERVER_NAME_MIN_LENGTH||o.length>Uo.MCP_SERVER_NAME_MAX_LENGTH?`Name must be between ${Uo.MCP_SERVER_NAME_MIN_LENGTH} and ${Uo.MCP_SERVER_NAME_MAX_LENGTH} characters`:zH.test(o)?qH.has(o)?`Name '${o}' is reserved`:null:"Name must contain only lowercase letters, numbers, and hyphens, and must start and end with a letter or number"}});var zu=y(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.parseJsonRecord=CH;Ir.buildAuthCodeExchangeRequest=jH;Ir.buildClientCredentialsExchangeRequest=QH;Ir.buildRefreshTokenExchangeRequest=BH;function CH(o){if(o)try{return typeof o=="string"?JSON.parse(o):o}catch{return}}function Ff(o,e,t){let a=o.tokenContentType==="json",i=o.tokenAuthMethod==="basic_auth",s={"Content-Type":a?"application/json":"application/x-www-form-urlencoded",Accept:"application/json",...o.extraHeaders};if(i&&t){let r=Buffer.from(`${encodeURIComponent(e)}:${encodeURIComponent(t)}`).toString("base64");s.Authorization=`Basic ${r}`}return s}function Lf(o,e){return e?JSON.stringify(o):new URLSearchParams(o).toString()}function Pf(o,e,t,a){(!(e.tokenAuthMethod==="basic_auth")||!a)&&(o.client_id=t,a&&(o.client_secret=a))}function jH(o){let e=o.config||{},t=e.tokenContentType==="json",a={grant_type:"authorization_code",code:o.code,redirect_uri:o.redirectUri,...e.extraBodyParams};return Pf(a,e,o.clientId,o.clientSecret),o.codeVerifier&&(a.code_verifier=o.codeVerifier),{url:o.tokenUrl,headers:Ff(e,o.clientId,o.clientSecret),body:Lf(a,t)}}function QH(o){let e=o.config||{},t=e.tokenContentType==="json",a={grant_type:"client_credentials",...o.scopes&&{scope:o.scopes},...e.extraBodyParams};return Pf(a,e,o.clientId,o.clientSecret),{url:o.tokenUrl,headers:Ff(e,o.clientId,o.clientSecret),body:Lf(a,t)}}function BH(o){let e=o.config||{},t=e.tokenContentType==="json",a={grant_type:"refresh_token",refresh_token:o.refreshToken,...e.extraBodyParams};return Pf(a,e,o.clientId,o.clientSecret),{url:o.tokenUrl,headers:Ff(e,o.clientId,o.clientSecret),body:Lf(a,t)}}});var LE=y(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.resolveOAuthConfig=void 0;var _E=zu(),SH=Qc(),FE=(o,e,t)=>{let a=(0,_E.parseJsonRecord)(o);return a||((0,_E.parseJsonRecord)(e)??t)},DH=(o,e,t)=>{let a=(0,SH.resolveOAuthConfigFromAuthentication)({input:o,authentication:t,templateOAuth:e});return Object.fromEntries(Object.entries({...a,extraHeaders:FE(o.extraHeaders,a.extraHeaders,e?.extraHeaders),extraBodyParams:FE(o.extraBodyParams,a.extraBodyParams,e?.extraBodyParams)}).filter(([,i])=>i!=null))};qu.resolveOAuthConfig=DH});var WE=y(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.ORGANIZATION_BILLING_METADATA_KEYS=J.ORG_TIER_CONFIG_DEFAULTS=J.ORG_FEATURE_METADATA=J.ORG_FEATURES=J.SELF_SERVE_BILLING_TIERS=J.PAID_ORG_TIERS=J.BILLING_CURRENCIES=J.ORG_NAME_MAX_LENGTH=void 0;J.validateOrgName=NH;J.isSuperglueInternalEmail=UH;J.isBillingCurrency=PE;J.isOrgTier=HE;J.parseOrgTier=YE;J.normalizeOrgTier=MH;J.isPaidOrgTier=OH;J.isSelfServeBillingTier=GE;J.isSelfServeBillingPlan=_H;J.getOrgFeatureMetadata=FH;J.createOrgFeatureFlags=Yf;J.cloneOrgFeatureFlags=Gf;J.getOrganizationTierConfigDefaults=VE;J.resolveOrgFeatureFlagsForTier=LH;J.mapOrganizationMetadataToBillingMetadata=PH;J.mapBillingMetadataPatchToOrganizationMetadata=HH;J.ORG_NAME_MAX_LENGTH=20;var RH=["@superglue.ai","@superglue.cloud"],TH=/[\x00-\x1f\x7f]/;function NH(o){if(typeof o!="string")return{valid:!1,name:"",error:"Organization name is required"};let e=o.trim();return e.length===0?{valid:!1,name:e,error:"Organization name cannot be empty"}:e.length>J.ORG_NAME_MAX_LENGTH?{valid:!1,name:e,error:`Organization name must be at most ${J.ORG_NAME_MAX_LENGTH} characters`}:TH.test(e)?{valid:!1,name:e,error:"Organization name contains invalid characters"}:{valid:!0,name:e}}function UH(o){let e=o?.trim().toLowerCase();return e?RH.some(t=>e.endsWith(t)):!1}J.BILLING_CURRENCIES=["eur","usd"];function PE(o){return typeof o=="string"&&J.BILLING_CURRENCIES.includes(o)}J.PAID_ORG_TIERS=["pro","team","enterprise"];J.SELF_SERVE_BILLING_TIERS=["pro","team"];J.ORG_FEATURES=["activity_tracking","access_control","organization_management","custom_timeouts","sub_organizations"];function HE(o){return o==="trial"||o==="pro"||o==="team"||o==="enterprise"}function YE(o){return HE(o)?o:null}function MH(o){return YE(o)??"trial"}function OH(o){return J.PAID_ORG_TIERS.includes(o)}function GE(o){return J.SELF_SERVE_BILLING_TIERS.includes(o)}function _H(o){return GE(o.tier)}J.ORG_FEATURE_METADATA={activity_tracking:{name:"Activity Tracking",description:"Track superglue usage events over time. Includes runs, tool building, system creation and tool sharing.",requiredTier:"team",gateMessage:"Activity tracking requires team tier superglue access."},access_control:{name:"Role-based Access Control",description:"Configure custom roles and manage system and tool access in your organization.",requiredTier:"enterprise",gateMessage:"Role-based access control requires enterprise tier superglue access."},organization_management:{name:"Organization management",description:"Invite team members to collaborate on superglue systems and tools.",requiredTier:"team",gateMessage:"Organization management requires team tier superglue access."},custom_timeouts:{name:"Custom Timeouts",description:"Configure organization-level execution, protocol, and connection timeouts from settings.",requiredTier:"enterprise",gateMessage:"Custom timeouts require enterprise tier superglue access."},sub_organizations:{name:"Sub-organizations",description:"Create fully separated client organizations that are managed and billed through this organization.",requiredTier:"enterprise",gateMessage:"Sub-organizations require enterprise tier superglue access."}};function FH(o){return J.ORG_FEATURE_METADATA[o]}function Yf(o){return J.ORG_FEATURES.reduce((e,t)=>(e[t]=o,e),{})}function Gf(o){return{...o}}J.ORG_TIER_CONFIG_DEFAULTS={trial:{tokenLimitPerUser:1e6,tokenLimitPeriod:"lifetime",runLimitPerUser:100,runLimitPeriod:"lifetime",maximumConcurrentRuns:1,maxSubOrganizations:null,features:Yf(!1)},pro:{tokenLimitPerUser:3e6,tokenLimitPeriod:"calendar_month",runLimitPerUser:3e3,runLimitPeriod:"calendar_month",maximumConcurrentRuns:3,maxSubOrganizations:null,features:{activity_tracking:!1,access_control:!1,organization_management:!1,custom_timeouts:!1,sub_organizations:!1}},team:{tokenLimitPerUser:5e6,tokenLimitPeriod:"calendar_month",runLimitPerUser:5e3,runLimitPeriod:"calendar_month",maximumConcurrentRuns:null,maxSubOrganizations:null,features:{activity_tracking:!0,access_control:!1,organization_management:!0,custom_timeouts:!1,sub_organizations:!1}},enterprise:{tokenLimitPerUser:null,tokenLimitPeriod:"calendar_month",runLimitPerUser:null,runLimitPeriod:"calendar_month",maximumConcurrentRuns:null,maxSubOrganizations:null,features:Yf(!0)}};function VE(o){let e=J.ORG_TIER_CONFIG_DEFAULTS[o];return{...e,features:Gf(e.features)}}function LH(o){return o.configuredFeatures?Gf(o.configuredFeatures):VE(o.tier).features}J.ORGANIZATION_BILLING_METADATA_KEYS={customerId:"stripe_customer_id",subscriptionId:"stripe_subscription_id",subscriptionItemId:"stripe_subscription_item_id",currency:"stripe_currency"};function Hf(o){return typeof o=="string"&&o.trim()?o:null}function PH(o){let e=J.ORGANIZATION_BILLING_METADATA_KEYS,t=o[e.currency];return{customerId:Hf(o[e.customerId]),subscriptionId:Hf(o[e.subscriptionId]),subscriptionItemId:Hf(o[e.subscriptionItemId]),currency:PE(t)?t:null}}function HH(o){let e=J.ORGANIZATION_BILLING_METADATA_KEYS,t={};return o.customerId!==void 0&&(t[e.customerId]=o.customerId),o.subscriptionId!==void 0&&(t[e.subscriptionId]=o.subscriptionId),o.subscriptionItemId!==void 0&&(t[e.subscriptionItemId]=o.subscriptionItemId),o.currency!==void 0&&(t[e.currency]=o.currency),t}});var JE=y(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.OUTBOUND_JWT_KID=Mo.OUTBOUND_JWKS_ROUTE_PATH=Mo.OUTBOUND_JWT_TTL_SECONDS=Mo.SG_OUTBOUND_IDENTITY_TOKEN_USE=void 0;Mo.deriveOutboundJwtSigningKey=$E;Mo.getOutboundJwtPublicJwk=VH;Mo.SG_OUTBOUND_IDENTITY_TOKEN_USE="sg_outbound_identity";Mo.OUTBOUND_JWT_TTL_SECONDS=3600;Mo.OUTBOUND_JWKS_ROUTE_PATH="/api/auth/outbound-jwks";Mo.OUTBOUND_JWT_KID="sg-outbound-identity-v1";var YH="superglue:outbound-identity-signing-key:v1",Vf=Uint8Array.from([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]);async function GH(o){let e=new TextEncoder,t=await crypto.subtle.importKey("raw",e.encode(o),"HKDF",!1,["deriveBits"]),a=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(32),info:e.encode(YH)},t,256);return new Uint8Array(a)}async function $E(o){let e=await GH(o),t=new Uint8Array(Vf.length+e.length);return t.set(Vf),t.set(e,Vf.length),crypto.subtle.importKey("pkcs8",t,{name:"Ed25519"},!0,["sign"])}async function VH(o){let e=await $E(o),t=await crypto.subtle.exportKey("jwk",e);return{kty:t.kty,crv:t.crv,x:t.x,kid:Mo.OUTBOUND_JWT_KID,alg:"EdDSA",use:"sig"}}});var ZE=y(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.compilePlaybookMarkdown=$H;var KE=wt();function WH(o,e){return["|-",...o.replace(/\r\n/g,`
|
|
364
364
|
`).split(`
|
|
@@ -1398,7 +1398,7 @@ ${s}`;break;case"retry":s5(s)&&(t[i]=s);break;case"id":r5(s)&&(t[i]=s);break;cas
|
|
|
1398
1398
|
`);o.stack=t?`${t}
|
|
1399
1399
|
${s}`:i.stack}B.exports.fetch=function(e,t=void 0){return dce(e,t).catch(a=>{throw b5?w5(a,b5):a&&typeof a=="object"&&Error.captureStackTrace(a,B.exports.fetch),a})};B.exports.Headers=Ls().Headers;B.exports.Response=Sm().Response;B.exports.Request=un().Request;B.exports.FormData=ad().FormData;var{setGlobalOrigin:gce,getGlobalOrigin:pce}=my();B.exports.setGlobalOrigin=gce;B.exports.getGlobalOrigin=pce;var{CacheStorage:hce}=a9(),{kConstruct:fce}=de();B.exports.caches=new hce(fce);var{deleteCookie:bce,getCookies:yce,getSetCookies:kce,setCookie:Ace,parseCookie:wce}=h9();B.exports.deleteCookie=bce;B.exports.getCookies=yce;B.exports.getSetCookies=kce;B.exports.setCookie=Ace;B.exports.parseCookie=wce;var{parseMIMEType:vce,serializeAMimeType:xce}=mt();B.exports.parseMIMEType=vce;B.exports.serializeAMimeType=xce;var{CloseEvent:zce,ErrorEvent:qce,MessageEvent:Ece}=vg(),{WebSocket:Ice,ping:Cce}=W9();B.exports.WebSocket=Ice;B.exports.CloseEvent=zce;B.exports.ErrorEvent=qce;B.exports.MessageEvent=Ece;B.exports.ping=Cce;B.exports.WebSocketStream=t5().WebSocketStream;B.exports.WebSocketError=Ow().WebSocketError;B.exports.request=Hm(vn.request);B.exports.stream=Hm(vn.stream);B.exports.pipeline=Hm(vn.pipeline);B.exports.connect=Hm(vn.connect);B.exports.upgrade=Hm(vn.upgrade);B.exports.MockClient=ece;B.exports.MockCallHistory=oce;B.exports.MockCallHistoryLog=tce;B.exports.MockPool=ice;B.exports.MockAgent=ace;B.exports.SnapshotAgent=sce;B.exports.mockErrors=rce;var{EventSource:jce}=f5();B.exports.EventSource=jce;function Qce(){globalThis.fetch=B.exports.fetch,globalThis.Headers=B.exports.Headers,globalThis.Response=B.exports.Response,globalThis.Request=B.exports.Request,globalThis.FormData=B.exports.FormData,globalThis.WebSocket=B.exports.WebSocket,globalThis.CloseEvent=B.exports.CloseEvent,globalThis.ErrorEvent=B.exports.ErrorEvent,globalThis.MessageEvent=B.exports.MessageEvent,globalThis.EventSource=B.exports.EventSource}B.exports.install=Qce});var x5=y(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.SuperglueClient=zn.SuperglueHttpError=void 0;var xn=wt(),Bce=sb(),Sce=T2(),Dce=Ht(),Oa=wr(),Rce=lu(),Ng=14400*1e3,Ym;if(typeof globalThis.process<"u"&&globalThis.process.versions?.node)try{let{Agent:o}=v5();Ym=new o({headersTimeout:Ng,bodyTimeout:Ng})}catch{}var Ug=class extends Error{constructor(e,t,a,i){super(e),this.status=t,this.code=a,this.details=i,this.name="SuperglueHttpError"}};zn.SuperglueHttpError=Ug;var Yw=class{constructor({apiKey:e,apiEndpoint:t,onInfrastructureError:a,sseTokenProvider:i,tokenProvider:s}){if(!e&&!s)throw new Error("SuperglueClient requires either apiKey or tokenProvider");this.tokenProvider=s??(async()=>e),this.apiEndpoint=t??"https://api.superglue.cloud",this.sseManager=new Bce.SSELogSubscriptionManager(this.apiEndpoint,i??this.tokenProvider),this.onInfrastructureError=a}async getApiKey(){return this.tokenProvider()}isInfrastructureError(e){return(0,Dce.isAbortError)(e)?!1:!!(e instanceof TypeError&&e.message.toLowerCase().includes("fetch")||e instanceof Error&&e.name==="TimeoutError")}async restRequest(e,t,a,i,s){let n=await(await this.restResponse({method:e,path:t,body:a,extraHeaders:i,requestInit:s})).text();if(n)return JSON.parse(n)}async restResponse({method:e,path:t,body:a,extraHeaders:i,requestInit:s}){let r=`${this.apiEndpoint.replace(/\/$/,"")}${t}`,c={Authorization:`Bearer ${await this.getApiKey()}`,...i};a&&e!=="GET"&&(c["Content-Type"]="application/json");let m;try{m=await fetch(r,{...s,method:e,headers:c,body:a?JSON.stringify(a):void 0,signal:s?.signal??AbortSignal.timeout(Ng),...Ym?{dispatcher:Ym}:{}})}catch(l){throw this.isInfrastructureError(l)&&this.onInfrastructureError?.(),l}if(!m.ok)throw await this.buildHttpError(m);return m}async buildHttpError(e){e.status>=500&&this.onInfrastructureError?.();let t=await e.text(),a=`HTTP ${e.status}: ${t}`,i,s;try{let r=JSON.parse(t);r&&typeof r=="object"&&!Array.isArray(r)&&(s=r),typeof r?.code=="string"&&(i=r.code);let n=r.error;typeof n=="string"?a=n:n&&typeof n=="object"&&(a=n.message||JSON.stringify(n))}catch{}return new Ug(a,e.status,i,s)}async streamRequest(e,t,a){let i=e.includes("?")?"&":"?",s=`${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(s,{method:"POST",headers:n,body:JSON.stringify(t),signal:a??AbortSignal.timeout(Ng),...Ym?{dispatcher:Ym}:{}})}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,Sce.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 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(s=>({...s}))||[],...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:s,options:r,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:s,options:r,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:s,stepResults:r,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:s,stepResults:r,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:s,status:r,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:s,status:r,error:n,startedAt:(0,Oa.toUTCISOString)(c,"run.startedAt"),completedAt:(0,Oa.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=new URL(`${this.apiEndpoint.replace(/\/$/,"")}/v1/extract`);t&&i.searchParams.set("envelope","true");let s=i.toString(),r=await this.getApiKey(),n=await fetch(s,{method:"POST",headers:{Authorization:`Bearer ${r}`},body:a});if(!n.ok){let c=await n.text(),m=`HTTP ${n.status}: ${c}`;try{let l=JSON.parse(c);l.error&&(m=l.error)}catch{}throw new Error(m)}return n.json()}mapOpenAPIRunToRun(e){let t={running:xn.RunStatus.RUNNING,success:xn.RunStatus.SUCCESS,failed:xn.RunStatus.FAILED,aborted:xn.RunStatus.ABORTED};return{runId:e.runId??e.id,toolId:e.toolId,tool:e.tool,systemIds:e.systemIds,status:t[e.status]??xn.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??xn.RunExecutionKind.FULL},fileArtifacts:e.fileArtifacts}}mapOpenAPIScheduleToToolSchedule(e){return{...e,lastRunAt:e.lastRunAt?(0,Oa.requireUTCDate)(e.lastRunAt,"schedule.lastRunAt"):void 0,nextRunAt:(0,Oa.requireUTCDate)(e.nextRunAt,"schedule.nextRunAt"),createdAt:(0,Oa.requireUTCDate)(e.createdAt,"schedule.createdAt"),updatedAt:(0,Oa.requireUTCDate)(e.updatedAt,"schedule.updatedAt")}}async listRuns(e){let{limit:t=100,page:a=1,toolId:i,search:s,searchUserIds:r,includeTotal:n=!0,startedAfter:c,status:m,requestSources:l,executionKinds:u,userId:d,systemId:g,signal:p}=e??{},b=new URLSearchParams({limit:String(t),page:String(a)});i&&b.set("toolId",i),s?.trim()&&b.set("search",s.trim()),r&&r.length>0&&b.set("searchUserIds",r.join(",")),n||b.set("includeTotal","false"),c&&b.set("startedAfter",c instanceof Date?(0,Oa.toUTCISOString)(c,"run.startedAfter"):c),m&&b.set("status",m),l&&l.length>0&&b.set("requestSources",l.join(",")),u&&u.length>0&&b.set("executionKinds",u.join(",")),d&&b.set("userId",d),g&&b.set("systemId",g);let w=await this.restRequest("GET",`/v1/runs?${b.toString()}`,void 0,void 0,{signal:p});return{items:w.data.map(k=>this.mapOpenAPIRunToRun(k)),total:w.total,page:w.page,limit:w.limit,hasMore:w.hasMore}}async getActivityCounts(e){let t=new URLSearchParams;e?.from&&t.set("from",e.from instanceof Date?(0,Oa.toUTCISOString)(e.from,"activity.from"):e.from),e?.to&&t.set("to",e.to instanceof Date?(0,Oa.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=10,t=0,a=!1){let i=Math.floor(t/e)+1,s=a?"&includeArchived=true":"",r=await this.restRequest("GET",`/v1/tools?limit=${e}&page=${i}${s}`);return{items:r.data,total:r.total}}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 listWorkflows(e=10,t=0,a=!1){return this.listTools(e,t,a)}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 listToolSchedules(e){if(e&&typeof e=="object")return this.listToolSchedulesPage(e);let t=[],a=typeof e=="string"?e:void 0,i=1;for(;;){let s=await this.listToolSchedulesPage({toolId:a,limit:1e3,page:i});if(t.push(...s.items),!s.hasMore||s.items.length===0)break;i+=1}return t}async listToolSchedulesPage(e){let{toolId:t,limit:a=100,page:i=1}=e??{},s=new URLSearchParams({limit:String(a),page:String(i)}),r=t?`/v1/tools/${encodeURIComponent(t)}/schedules?${s.toString()}`:`/v1/schedules?${s.toString()}`,n=await this.restRequest("GET",r);return{items:n.data.map(c=>this.mapOpenAPIScheduleToToolSchedule(c)),total:n.total,page:n.page,limit:n.limit,hasMore:n.hasMore}}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,Rce.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=new URLSearchParams;e?.systemId&&t.set("systemId",e.systemId);let a=t.toString();return(await this.restRequest("GET",`/v1/credentials${a?`?${a}`:""}`)).data.items}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=10,t=1){let a=new URLSearchParams({limit:String(e),page:String(t)}),i=await this.restRequest("GET",`/v1/systems?${a.toString()}`);return{items:i.data,total:i.total}}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 createSystemFileUploadUrls(e,t,a){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/file-references`,{files:t.map(s=>({fileName:s.fileName,metadata:{contentType:s.contentType,contentLength:s.contentLength}})),link:a?.link})).data.files}async uploadSystemFileReferences(e,t,a){if(t.length===0)return[];let i=await this.createSystemFileUploadUrls(e,t.map(n=>({fileName:n.fileName,contentType:n.contentType,contentLength:n.contentLength})),{link:a?.link}),r=(await Promise.allSettled(i.map(async(n,c)=>{let m=t[c],l=await fetch(n.uploadUrl,{method:"PUT",body:m.content,headers:m.contentType?{"Content-Type":m.contentType}:void 0});if(!l.ok)throw new Error(`Upload failed for ${m.fileName}: ${l.status} ${l.statusText}`);return this.processFileReference(n.id).catch(()=>{}),n.id}))).map((n,c)=>{let m=t[c],l=i[c].id;return n.status==="fulfilled"?{id:l,fileName:m.fileName,contentLength:m.contentLength,status:"uploaded"}:(this.deleteSystemFileReference(e,l).catch(()=>{}),{id:l,fileName:m.fileName,contentLength:m.contentLength,status:"failed",error:n.reason instanceof Error?n.reason.message:"Upload failed"})});if(!a?.settle){let n=r.filter(c=>c.status==="failed");if(n.length>0)throw new Error(n.map(c=>c.error).join("; "))}return r}async processFileReference(e){return this.restRequest("POST",`/v1/file-references/${encodeURIComponent(e)}/process`)}async listSystemFileReferences(e){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/file-references`)).data}async listFileReferences(e){if(e.length===0)return{files:[],total:0};let t=new URLSearchParams;t.set("fileIds",e.join(",")),t.set("limit",String(e.length));let a=await this.restRequest("GET",`/v1/file-references?${t.toString()}`);return{files:a.items,total:a.total}}async deleteSystemFileReference(e,t){await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}/file-references/${encodeURIComponent(t)}`)}async getFileReferenceContent(e){return(await this.restRequest("GET",`/v1/file-references/${encodeURIComponent(e)}?includeContent=true`)).data.content??null}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}}}};zn.SuperglueClient=Yw});var q5=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=Tce;Ce.parseJSON=Nce;Ce.isValidJson=Uce;Ce.prettyPrintJson=Mce;Ce.minifyJson=Oce;var Ut=class{validate(e){try{return JSON.parse(e),!0}catch{return!1}}};Ce.RepairStrategy=Ut;var Mg=class extends Ut{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 r=JSON.parse(i);return JSON.stringify(r)}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=Mg;var Og=class extends Ut{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=Og;var _g=class extends Ut{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=_g;var Fg=class extends Ut{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=Fg;var Lg=class extends Ut{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=Lg;var Pg=class extends Ut{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=Pg;var Gw=class extends Ut{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 s=0;s<e.length;s++){let r=e[s],n=s>0?e[s-1]:"";if(i){t+=r,i=!1;continue}if(r==="\\"&&a){t+=r,i=!0;continue}if(r==='"'&&n!=="\\"){a=!a,t+=r;continue}if(a)switch(r){case`
|
|
1400
1400
|
`: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=r.charCodeAt(0);c<32?t+="\\u"+("0000"+c.toString(16)).slice(-4):t+=r}else t+=r}return t}},Vw=class extends Ut{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,s=!1,r=!1;for(let n=0;n<t.length;n++){let c=t[n];if(s)r?r=!1:c==="\\"?r=!0:c==='"'&&(s=!1);else if(c==='"')s=!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,s=!1,r=!1,n=-1;for(let c=0;c<t.length;c++){let m=t[c];if(s)r?r=!1:m==="\\"?r=!0:m==='"'&&(s=!1);else if(m==='"')s=!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}},qn=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 Mg,new Fg,new Gw,new Vw,new Og,new _g,new Lg,new Pg]}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(r){if(!this.options.attemptRepair)return{success:!1,error:`JSON parse error: ${r}`,metadata:{parseTime:Date.now()-t}}}let i=a,s=[];for(let r of this.strategies)if(r.canApply(i)){let n=i;if(i=r.apply(i),n!==i){s.push(r.name),this.repairLog.push(r.description),this.options.logRepairs&&console.log(`Applied ${r.name}: ${r.description}`);try{return{success:!0,data:JSON.parse(i),repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:s}}}catch{}}}try{return{success:!0,data:JSON.parse(i),repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:s}}}catch(r){let n=this.aggressiveFallback(i);return n.success?{...n,repairs:[...this.repairLog,"Applied aggressive fallback"],metadata:{parseTime:Date.now()-t,strategiesApplied:[...s,"AggressiveFallback"]}}:{success:!1,error:`Failed to parse JSON after applying ${s.length} strategies: ${r}`,repairs:this.repairLog,metadata:{parseTime:Date.now()-t,strategiesApplied:s}}}}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),s=e.substring(i);for(let n of this.strategies)n.canApply(s)&&(s=n.apply(s));return{success:!0,data:JSON.parse(s)}}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=qn;var z5=new qn;function Tce(o,e){return(e?new qn(e):z5).parse(o)}function Nce(o){let e=z5.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 Uce(o){try{return JSON.parse(o),!0}catch{return!1}}function Mce(o,e=2){return JSON.stringify(o,null,e)}function Oce(o){let t=new qn().parse(o);if(t.success)return JSON.stringify(t.data);throw new Error("Cannot minify invalid JSON")}});var yt=y(H=>{"use strict";var _ce=H&&H.__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]})),ee=H&&H.__exportStar||function(o,e){for(var t in o)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&_ce(e,o,t)};Object.defineProperty(H,"__esModule",{value:!0});H.SSELogSubscriptionManager=H.SuperglueHttpError=H.SuperglueClient=void 0;ee(P1(),H);ee(K1(),H);ee(tE(),H);ee(rE(),H);ee(Qc(),H);ee(vE(),H);ee(xE(),H);ee(zE(),H);ee(qE(),H);ee(EE(),H);ee(CE(),H);ee(jE(),H);ee(BE(),H);ee(SE(),H);ee(RE(),H);ee(ml(),H);ee(NE(),H);ee(UE(),H);ee(OE(),H);ee(LE(),H);ee(WE(),H);ee(JE(),H);ee(ZE(),H);ee(l2(),H);ee(d2(),H);ee($f(),H);ee(v2(),H);ee(tb(),H);ee(E2(),H);ee(Q2(),H);ee(S2(),H);ee(wt(),H);ee(Ht(),H);ee(D2(),H);ee(R2(),H);ee(zu(),H);ee(wr(),H);ee(lu(),H);var E5=x5();Object.defineProperty(H,"SuperglueClient",{enumerable:!0,get:function(){return E5.SuperglueClient}});Object.defineProperty(H,"SuperglueHttpError",{enumerable:!0,get:function(){return E5.SuperglueHttpError}});var Fce=sb();Object.defineProperty(H,"SSELogSubscriptionManager",{enumerable:!0,get:function(){return Fce.SSELogSubscriptionManager}});ee(q5(),H)});var wp=require("commander");var Qo=$(require("fs")),j5=$(require("os")),_a=$(require("path")),Gm=$(yt()),I5=new Set(["runner","builder","admin"]),C5={output:{mode:"stdout",directory:".superglue/output"},preset:"admin"};function Fa(o){let e=_a.join(process.cwd(),".superglue"),t=j5.homedir();if(!t)return e;let a=_a.join(t,".superglue");return o===!0?e:o===!1?a:Qo.existsSync(_a.join(e,"config.json"))?e:a}function Ww(o){return _a.join(Fa(o),"config.json")}function Hg(o){let e=Ww(o);if(!Qo.existsSync(e))return{};try{return JSON.parse(Qo.readFileSync(e,"utf-8"))}catch{return{}}}function En(o){let e=Hg(),t=o.apiKey||(0,Gm.readProcessEnvironmentValue)("SUPERGLUE_API_KEY")||e.apiKey||"",a=o.endpoint||(0,Gm.readProcessEnvironmentValue)("SUPERGLUE_API_ENDPOINT")||e.endpoint||"https://api.superglue.cloud",i=(0,Gm.readProcessEnvironmentValue)("SUPERGLUE_WEB_ENDPOINT")||e.webEndpoint||a.replace(/:3002\b/,":3001").replace(/api\.superglue/,"app.superglue"),s=(0,Gm.readProcessEnvironmentValue)("SUPERGLUE_CLI_PRESET"),r=s&&I5.has(s)?s:e.preset&&I5.has(e.preset)?e.preset:"admin";return{...C5,...e,apiKey:t,endpoint:a,webEndpoint:i,preset:r,output:{...C5.output,...e.output}}}function Yg(o,e){let t=Fa(e);Qo.existsSync(t)||Qo.mkdirSync(t,{recursive:!0}),Qo.writeFileSync(_a.join(t,"config.json"),JSON.stringify(o,null,2)+`
|
|
1401
|
-
`,{mode:384})}function Gg(o,e){let t=_a.join(Fa(e),"drafts");if(Qo.existsSync(t)||Qo.mkdirSync(t,{recursive:!0}),o.output.mode==="stdout+file"){let a=_a.resolve(o.output.directory);Qo.existsSync(a)||Qo.mkdirSync(a,{recursive:!0})}}var ov=$(yt());var $w=$(require("readline"));var S5=require("child_process"),D5=require("util");var Q5={name:"@superglue/cli",version:"1.1.
|
|
1401
|
+
`,{mode:384})}function Gg(o,e){let t=_a.join(Fa(e),"drafts");if(Qo.existsSync(t)||Qo.mkdirSync(t,{recursive:!0}),o.output.mode==="stdout+file"){let a=_a.resolve(o.output.directory);Qo.existsSync(a)||Qo.mkdirSync(a,{recursive:!0})}}var ov=$(yt());var $w=$(require("readline"));var S5=require("child_process"),D5=require("util");var Q5={name:"@superglue/cli",version:"1.1.44",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 Pce=(0,D5.promisify)(S5.exec),yo=Q5.version;function B5(o){let e=o.match(/^(\d+)(?:-(.+))?$/);return e?{numeric:parseInt(e[1],10),prerelease:e[2]||null}:{numeric:0,prerelease:o}}function Wg(o,e){let t=o.split("."),a=e.split("."),i=Math.max(t.length,a.length);for(let s=0;s<i;s++){let r=B5(t[s]||"0"),n=B5(a[s]||"0");if(r.numeric<n.numeric)return-1;if(r.numeric>n.numeric||r.prerelease===null&&n.prerelease!==null)return 1;if(r.prerelease!==null&&n.prerelease===null)return-1;if(r.prerelease!==null&&n.prerelease!==null){if(r.prerelease<n.prerelease)return-1;if(r.prerelease>n.prerelease)return 1}}return 0}async function $g(){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 Vg=null;function R5(){Y()&&(Vg=$g())}async function T5(){if(!(!Y()||!Vg)){try{let o=new Promise(t=>{setTimeout(()=>t(null),2e3).unref()}),e=await Promise.race([Vg,o]);e&&Wg(yo,e)<0&&(console.error(""),console.error(`${h.cyan}${h.bold} Update available: ${yo} \u2192 ${e}${h.reset}`),console.error(`${h.cyan} Run ${h.bold}sg update${h.reset}${h.cyan} to upgrade${h.reset}`),console.error(""))}catch{}Vg=null}}async function N5(){let o=await $g();if(!o)return{success:!1,message:"Could not fetch latest version from npm"};if(Wg(yo,o)>=0)return{success:!0,message:`Already on latest version (${yo})`};try{return await Pce("npm install -g @superglue/cli@latest"),{success:!0,message:`Updated from ${yo} to ${o}`}}catch(e){return{success:!1,message:`Update failed: ${e.message}. Try manually: npm install -g @superglue/cli@latest`}}}var Y=()=>process.argv.includes("--table")&&process.stdout.isTTY,kt=()=>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 U5(o,e){let t=e||o;return`\x1B]8;;${o}\x07${h.underline}${h.cyan}${t}${h.reset}\x1B]8;;\x07`}function M5(){if(!Y())return;let o=h.reset,e=h.dim,t="\x1B[47;30m",a=[" #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- "," =@@@- @@@@ "," @@@ @@% "," -@@ @@@@= @@@ @@@ @@@@@#@ @@@@@@@ @@@@@@@ @@@@@@ @@@ @@@ @@@ @@@@@@* %@@ "," @@ @@@ *@ @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @% @@@ @@@ @@@ @@* @@# "," #@@ @@@# @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @@@ @@@ @@@ @@* @@ "," @@- @@@@= @@@ @@@ @@@@@@@ @@@@@@ @@@@@@@ @@@ @@% @@@ @@@ @@@ @@@@@. @@."," #@% .@@@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* @@ "," @@ @ @@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* *@@ "," -@@ @@@@= @@@@@@ @@@ @@@@@@@ @@@ -@@ @@@@@@ @@@@@@% @@@@@@. @@@@@@* #@@ "," :@@* @@@ "," %@@@ =@@@. "," :@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% "];console.log(""),a.forEach(i=>{let s=i.search(/\S/),r=i.length-[...i].reverse().join("").search(/\S/)-1;if(s===-1)return console.log(" "+i);let n=i.slice(0,s),c=i.slice(s,r+1).split("").map(l=>l===" "?" ":"\u2588").join(""),m=i.slice(r+1);console.log(` ${n}${t}${c}${o}${m}`)}),console.log(` ${e} CLI v${yo}${o}`),console.log("")}function Ee(o){if(!Y())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"),s=()=>{process.stdout.write(`\r ${h.cyan}${e[t++%e.length]}${h.reset} ${a}`)},r=setInterval(s,80);return{update:n=>{a=n},log:n=>{i(),console.log(` ${h.dim}\u2502${h.reset} ${n}`),s()},stop:n=>{clearInterval(r),i(),n&&console.log(` ${n}`)}}}function U(o){Y()?Jg(o):console.log(JSON.stringify(o,null,2))}function ie(o,e){Y()?(console.log(` ${h.green}\u2713${h.reset} ${o}`),e&&Jg(e,4)):console.log(JSON.stringify({success:!0,message:o,...e&&typeof e=="object"?e:{data:e}}))}function z(o,e){Y()?(console.error(` ${h.red}\u2717${h.reset} ${o}`),e&&Jg(e,4)):console.error(JSON.stringify({success:!1,error:o,details:e}))}function O5(o){Y()&&console.log(` ${h.yellow}\u26A0${h.reset} ${o}`)}function co(o){Y()&&console.log(` ${h.dim}${o}${h.reset}`)}function La(o){Y()&&(console.log(`
|
|
1402
1402
|
${h.bold}${h.cyan}${o}${h.reset}`),console.log(` ${h.dim}${"\u2500".repeat(o.length)}${h.reset}`))}function na(o,e,t){if(!Y()){console.log(JSON.stringify({success:!0,total:t?.total??o.length,items:o}));return}if(o.length===0){console.log(`
|
|
1403
1403
|
${h.dim}0 results${h.reset}
|
|
1404
1404
|
`);return}let a=e||Object.keys(o[0]),i=kt()?1/0:60,s=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 r=a.map((l,u)=>`${h.bold}${h.cyan}${l.toUpperCase().padEnd(s[u])}${h.reset}`).join(" ");console.log(` ${r}`);let n=s.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 w=`\u2026 (${p.length})`;p=p.slice(0,Math.max(0,i-w.length))+`${h.dim}${w}${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(s[g])}${h.reset}`:p.padEnd(s[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(`
|