@sazabi/cli 0.27.0-dev.g44b5e47 → 0.27.0-dev.g9d8faac

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8704,7 +8704,7 @@ Connect 1Password so Sazabi agents can work with your vaults and secrets through
8704
8704
  - The 1Password CLI (\`op\`) sandbox preset, since no hosted MCP endpoint is available yet
8705
8705
  `.trim()});import{dirname as _6A,resolve as x6A}from"node:path";import{fileURLToPath as s6A}from"node:url";var q6A,_eA,xeA,d6A,seA,p6A,A8A,t8A,qeA;var Jf=r(()=>{JA();Uw();q6A=x6A(_6A(s6A(import.meta.url)),"../../../skills"),_eA=["airbyte","atlassian","attio","autumn","aws","axiom","better-stack","braintrust","calendly","cekura","checkly","circleback","clay","clerk","cloudflare","composio","context-dev","custom","datadog","deepwiki","elastic-cloud","exa","gcp","google-drive","grafana","granola","happenstance","honeycomb","incident-io","intercom","langfuse","langsmith","linear","logfire","mercury","neon","notion","onepassword","paper","plug","posthog","plain","planetscale","pylon","railway","render","rentahuman","resend","respan","salesforce","secureframe","sentry","signoz","slack","stripe","supabase","superhuman","the-context-company","vercel","x"],xeA=Q.enum(_eA),d6A=Q.object({readOnlyToolNames:Q.array(Q.string()).optional(),blockedToolNames:Q.array(Q.string()).optional(),defaultUnavailableReason:Q.enum(Nw).optional(),allowWriteTools:Q.boolean().optional()}),seA=Q.object({registrationEndpoint:Q.string().url(),tokenEndpointAuthMethod:Q.enum(lw).optional(),includeScopesInRegistration:Q.boolean().optional()}),p6A=Q.object({providerConfigKey:Q.string().min(1),callbackPathSegment:Q.string().min(1),authorizationUrl:Q.string().url().optional(),tokenUrl:Q.string().url().optional(),resourceUrl:Q.string().url().optional(),useServerUrlAsResource:Q.boolean().optional(),omitScopeFromAuthorizationUrl:Q.boolean().optional(),authorizationUrlParams:Q.record(Q.string(),Q.string()).optional(),defaultAccessTokenTtlSeconds:Q.number().int().positive().optional(),dynamicClientRegistration:seA.optional()}),A8A=Q.object({label:Q.string().min(1),serverUrl:Q.string().url(),authorizationUrl:Q.string().url().optional(),tokenUrl:Q.string().url().optional(),resourceUrl:Q.string().url().optional(),dynamicClientRegistration:seA.optional()}),t8A=Q.object({id:Q.string().min(1),title:Q.string().min(1),description:Q.string().optional(),body:Q.string().min(1),fieldKeys:Q.array(Q.string().min(1)).optional(),imageKeys:Q.array(Q.string().min(1)).optional()}),qeA=Q.object({id:Q.string().min(1),label:Q.string().min(1),iconKey:xeA,defaultServerUrl:Q.string().url().nullable(),serverUrlPathSuffixMaxSegments:Q.number().int().positive().optional(),serverUrlHostnameSuffixes:Q.array(Q.string().min(2)).optional(),transport:Q.enum(zk),authMode:Q.enum(mk),availability:Q.enum(VI),oauth:p6A.optional(),regions:Q.array(A8A).optional(),capabilityOverrides:d6A.optional(),helpText:Q.string().optional(),setupGroups:Q.array(t8A).optional(),evidenceHints:Q.array(Q.string().min(1)).optional(),skill:Q.string().min(1).optional(),setupSkill:Q.string().min(1).optional(),scopesUserSelectable:Q.boolean().optional()})});var m=(A)=>{return{...qeA.parse(A),...A.getAvailableScopes?{getAvailableScopes:A.getAvailableScopes}:{},...A.getUrlConfiguration?{getUrlConfiguration:A.getUrlConfiguration}:{},...A.validateCredentials?{validateCredentials:A.validateCredentials}:{},...A.normalizeHeaders?{normalizeHeaders:A.normalizeHeaders}:{}}};var IA=r(()=>{Jf()});var deA;var peA=r(()=>{IA();deA=m({id:"airbyte",label:"Airbyte",iconKey:"airbyte",defaultServerUrl:"https://mcp.airbyte.ai/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"airbyte",callbackPathSegment:"airbyte",authorizationUrl:"https://mcp.airbyte.ai/authorize",tokenUrl:"https://mcp.airbyte.ai/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.airbyte.ai/register",tokenEndpointAuthMethod:"client_secret_post"}},getAvailableScopes:async()=>[],scopesUserSelectable:!1,capabilityOverrides:{defaultUnavailableReason:"write_blocked"},evidenceHints:["Airbyte Agent Engine usage (mcp.airbyte.ai) or embedded agent connectors","AIRBYTE_* environment variables or Airbyte agent/connector client code","README/docs naming Airbyte for agent connectors to CRM, support, or analytics platforms"],helpText:"Read and write records on the third-party platforms (CRM, support desk, analytics, billing, databases) you have connected in your Airbyte Agent Engine workspace. Requires an Airbyte Agent Engine workspace with connectors already configured.",skill:"airbyte",setupSkill:"airbyte-setup"})});var AQA;var tQA=r(()=>{IA();AQA=m({id:"atlassian",label:"Atlassian",iconKey:"atlassian",defaultServerUrl:"https://mcp.atlassian.com/v1/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"atlassian",callbackPathSegment:"atlassian",authorizationUrl:"https://mcp.atlassian.com/v1/authorize",tokenUrl:"https://cf.mcp.atlassian.com/v1/token",dynamicClientRegistration:{registrationEndpoint:"https://cf.mcp.atlassian.com/v1/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["atlassian.com, Jira, Confluence, Jira Service Management, Compass, or Bitbucket links","Jira or Confluence project keys, issue keys, or workspace documentation","ATLASSIAN_* environment variables or scripts that call Atlassian APIs"],helpText:"Search and manage Jira, Confluence, Jira Service Management, Compass, and Bitbucket. During authorization, pick the Atlassian site you want to connect.",skill:"atlassian",setupSkill:"atlassian-setup"})});var gQA;var nQA=r(()=>{IA();gQA=m({id:"attio",label:"Attio",iconKey:"attio",defaultServerUrl:"https://mcp.attio.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"attio",callbackPathSegment:"attio",authorizationUrl:"https://app.attio.com/oidc/authorize",tokenUrl:"https://app.attio.com/oidc/token",dynamicClientRegistration:{registrationEndpoint:"https://app.attio.com/oauth/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"mcp",label:"MCP access",description:"Read and manage Attio CRM records, lists, tasks, notes, and meetings."},{value:"openid",required:!0},{value:"offline_access",required:!0}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["attio.com links, Attio workspace docs, or ATTIO_* environment variables","CRM account/contact workflows that reference Attio objects, lists, or tasks","README/docs naming Attio as the CRM or customer system of record"],helpText:"Search and manage Attio CRM records, lists, tasks, notes, and meetings. During authorization, pick the Attio workspace you want to connect.",skill:"attio",setupSkill:"attio-setup"})});var iQA;var oQA=r(()=>{$t();IA();iQA=m({id:"autumn",label:"Autumn",iconKey:"autumn",defaultServerUrl:"https://mcp.useautumn.com/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["useautumn.com / autumn-js SDK usage, AUTUMN_SECRET_KEY (am_sk_) environment variables, or an api.useautumn.com base URL","Autumn billing/pricing calls such as attach, check, track, or entitlement gating in code","README/docs naming Autumn for pricing, plans, features, credits, or usage-based billing on top of Stripe"],helpText:"Manage Autumn billing and pricing — customers, plans, features, balances, usage, and subscriptions — using an Autumn secret key.",setupGroups:[{id:"api-key",title:"Create an Autumn secret key",description:"Copy the Autumn secret key Sazabi will send to Autumn's hosted MCP endpoint.",body:"In the [Autumn dashboard](https://app.useautumn.com), open **Developer > API Keys** and copy a secret key (`am_sk_...`). Use a sandbox key to explore and a production key for live billing data. Sazabi stores it securely and sends it as `Authorization: Bearer <key>` to Autumn's MCP endpoint.",fieldKeys:["apiKey"]}],validateCredentials:OeA,normalizeHeaders:feA})});var Lb,dMt,eQA;var Fb=r(()=>{IA();Lb=[{value:"us-east-1",label:"US East (N. Virginia) — us-east-1"},{value:"eu-central-1",label:"Europe (Frankfurt) — eu-central-1"}],dMt=new Set(Lb.map((A)=>A.value)),eQA=m({id:"aws",label:"AWS",iconKey:"aws",defaultServerUrl:"https://aws-mcp.us-east-1.api.aws/mcp",transport:"streamable-http",authMode:"aws-sigv4",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["AWS SDK usage, aws-cli, or AWS_* environment variables in code or config","CloudFormation/CDK/Terraform AWS resources, ECS/Lambda/S3/CloudWatch usage","README/runbooks naming AWS as the cloud platform"],helpText:"Query the AWS-managed AWS MCP server (AWS documentation and AWS API operations) using AWS IAM credentials. Sazabi signs each request with SigV4, so no local proxy is required.",setupGroups:[{id:"iam-credentials",title:"Create scoped IAM credentials",description:"Provide IAM credentials whose permissions match exactly what the agent should be able to do.",body:"In the AWS Console, create an IAM user or role with only the permissions Sazabi should use (for example read-only access via `ReadOnlyAccess`, or a scoped custom policy), then generate an access key. Paste the **Access key ID** and **Secret access key** below. For temporary credentials from an assumed role, also paste the **Session token**. Prefer short-lived, least-privilege credentials.",fieldKeys:["accessKeyId","secretAccessKey","sessionToken"]},{id:"region",title:"Choose the AWS region",description:"The AWS MCP server is region-scoped; pick the region to target.",body:"Select the region where AWS hosts the AWS MCP endpoint. AWS currently offers the AWS MCP server in **US East (N. Virginia) — us-east-1** and **Europe (Frankfurt) — eu-central-1** only. Sazabi builds the `https://aws-mcp.<region>.api.aws/mcp` server URL from your choice and scopes SigV4 signing to it. This is the endpoint region, not the AWS region your API operations target.",fieldKeys:["region"]}]})});var QQA;var IQA=r(()=>{IA();QQA=m({id:"axiom",label:"Axiom",iconKey:"axiom",defaultServerUrl:"https://mcp.axiom.co/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"axiom",callbackPathSegment:"axiom",authorizationUrl:"https://mcp.axiom.co/authorize",tokenUrl:"https://mcp.axiom.co/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.axiom.co/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[],scopesUserSelectable:!1,getUrlConfiguration:async()=>({docsUrl:"https://axiom.co/docs/console/intelligence/mcp-server",instructions:"Copy the hosted MCP server URL below. If you belong to more than one Axiom organization, append ?org-id=<id> to target a specific organization.",defaultServerUrl:"https://mcp.axiom.co/mcp",optional:!0}),capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Axiom datasets, APL queries, AXIOM_* environment variables, or axiom CLI usage","Log drains or dashboards documented in Axiom","README/docs naming Axiom as a log or event analytics backend"],helpText:"Query Axiom datasets and logs with APL to investigate production events and incidents."})});var hQA;var BQA=r(()=>{IA();hQA=m({id:"better-stack",label:"Better Stack",iconKey:"better-stack",defaultServerUrl:"https://mcp.betterstack.com",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"better-stack",callbackPathSegment:"better-stack",authorizationUrl:"https://betterstack.com/oauth/authorize",tokenUrl:"https://betterstack.com/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://betterstack.com/oauth/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"read",label:"Read",description:"Read Better Stack incidents, monitors, log sources, and telemetry."},{value:"write",label:"Write",description:"Acknowledge, resolve, and manage Better Stack incidents."}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Better Stack / Better Uptime monitors, heartbeats, or status pages","BETTERSTACK_* or LOGTAIL_* environment variables, or Logtail/Better Stack log drains","README/docs naming Better Stack for uptime monitoring, incidents, or log management"],helpText:"Browse Better Stack incidents, monitors, and log sources, build telemetry queries to investigate production issues, and acknowledge, resolve, and manage incidents."})});var cQA;var CQA=r(()=>{$t();IA();cQA=m({id:"braintrust",label:"Braintrust",iconKey:"braintrust",defaultServerUrl:"https://api.braintrust.dev/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["braintrust or autoevals packages, or BRAINTRUST_API_KEY environment variables","Braintrust eval/logging/tracing usage in code or CI (e.g. braintrust eval)","README/docs naming Braintrust for LLM evals, prompt/experiment tracking, or observability"],helpText:"Query Braintrust experiments, datasets, prompts, and logs using a Braintrust API key.",setupGroups:[{id:"api-key",title:"Create a Braintrust API key",description:"Generate the Braintrust API key the hosted MCP server will use.",body:"In Braintrust, go to **Settings > API keys** (https://www.braintrust.dev/app/settings/api-keys) and create an API key. Copy the generated key.",fieldKeys:["apiKey"]},{id:"data-plane",title:"Choose your Braintrust data plane",description:"Pick the region where your Braintrust data lives so Sazabi connects to the matching endpoint.",body:"Select **US** (`https://api.braintrust.dev/mcp`) or **EU** (`https://api-eu.braintrust.dev/mcp`) to match where your Braintrust data lives.",fieldKeys:["dataPlane"]}],validateCredentials:beA,normalizeHeaders:ueA})});var EQA;var aQA=r(()=>{IA();EQA=m({id:"calendly",label:"Calendly",iconKey:"calendly",defaultServerUrl:"https://mcp.calendly.com",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"calendly",callbackPathSegment:"calendly",authorizationUrl:"https://calendly.com/oauth/authorize",tokenUrl:"https://calendly.com/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://calendly.com/oauth/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["calendly.com scheduling links or Calendly webhook handlers","CALENDLY_* environment variables or API integrations","README/docs naming Calendly for customer calls, interviews, or demos"],helpText:"Check availability, create scheduling links, and manage meetings in Calendly."})});var rQA;var yQA=r(()=>{$t();IA();rQA=m({id:"cekura",label:"Cekura",iconKey:"cekura",defaultServerUrl:"https://api.cekura.ai/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",evidenceHints:["Cekura workflow tests, monitor configs, or CEKURA_* environment variables","Agent evaluation or production monitor docs naming Cekura","Synthetic user-flow tests for AI agents"],helpText:"Test, monitor, and evaluate AI agent workflows with Cekura.",setupGroups:[{id:"api-key",title:"Create an API key",description:"Create or copy the API key Sazabi will send to Cekura's hosted MCP endpoint.",body:"In the Cekura dashboard, open **Settings > API Keys** and create or copy a project-scoped [API key](https://dashboard.cekura.ai/settings/org/api-key), then paste it below.",fieldKeys:["apiKey"]}],validateCredentials:XeA})});var wQA;var DQA=r(()=>{IA();wQA=m({id:"checkly",label:"Checkly MCP",iconKey:"checkly",defaultServerUrl:"https://api.checklyhq.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"disabled",oauth:{providerConfigKey:"checkly",callbackPathSegment:"checkly"},getAvailableScopes:async()=>[{value:"checkly:account:read"},{value:"checkly:account:invite"},{value:"checkly:checks:read"},{value:"checkly:checks:run"},{value:"checkly:incidents:read"},{value:"checkly:incidents:write"},{value:"checkly:environment-variables:read"},{value:"checkly:environment-variables:write"},{value:"checkly:status-pages:read"},{value:"checkly:rca:read"},{value:"checkly:rca:run"},{value:"checkly:test-sessions:read"},{value:"checkly:assets:read"}],scopesUserSelectable:!1,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["checkly.config.ts/js, __checks__ directories, @checkly/cli, or CHECKLY_* environment variables","README/docs naming Checkly for synthetic monitoring, API checks, or browser checks","Runbooks that inspect Checkly check results, test sessions, RCA, status pages, or incidents"],helpText:"Query Checkly synthetic monitoring (checks, check results, test sessions, RCA, status pages, and incidents) over Checkly's official OAuth MCP server. Disabled until Sazabi has a Checkly-approved OAuth client, because Checkly rejects Dynamic Client Registration."})});var uQA;var bQA=r(()=>{IA();uQA=m({id:"circleback",label:"Circleback",iconKey:"circleback",defaultServerUrl:"https://circleback.ai/api/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"circleback",callbackPathSegment:"circleback",authorizationUrl:"https://circleback.ai/api/oauth/authorize",tokenUrl:"https://circleback.ai/api/oauth/access-token",dynamicClientRegistration:{registrationEndpoint:"https://circleback.ai/api/oauth/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["circleback.ai meeting links, Circleback notes exports, or CIRCLEBACK_* environment variables","Incident, customer-call, or product-feedback docs naming Circleback","Operational runbooks that refer to meeting notes or transcripts in Circleback"],helpText:"Search your Circleback meeting notes, transcripts, and action items."})});var lQA;var NQA=r(()=>{IA();lQA=m({id:"clay",label:"Clay",iconKey:"clay",defaultServerUrl:"https://mcp.clay.earth/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"clay",callbackPathSegment:"clay",authorizationUrl:"https://mcp.clay.earth/authorize",tokenUrl:"https://mcp.clay.earth/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.clay.earth/register",tokenEndpointAuthMethod:"client_secret_post"}},getAvailableScopes:async()=>[{value:"openid",required:!0},{value:"read",label:"Read access",description:"Read Clay contacts, interactions, notes, and workspace workflows."},{value:"write",label:"Write access",description:"Create and update Clay records and workspace workflows."}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Clay workflow URLs, clay.earth links, or CLAY_* environment variables","Outbound enrichment, lead routing, or contact workflow docs naming Clay","Code or scripts that sync contacts, notes, or workspace workflows with Clay"],helpText:"Search Clay contacts, interactions, notes, and workspace workflows, and create or update records and workflows."})});var UQA;var SQA=r(()=>{IA();UQA=m({id:"clerk",label:"Clerk",iconKey:"clerk",defaultServerUrl:"https://mcp.clerk.com/mcp",transport:"streamable-http",authMode:"none",availability:"enabled",capabilityOverrides:{readOnlyToolNames:["list_clerk_sdk_snippets","clerk_sdk_snippet"]},evidenceHints:["@clerk/* SDK imports, CLERK_SECRET_KEY / CLERK_PUBLISHABLE_KEY environment variables, or clerk.com URLs","Authentication, session, or organization/user management logic built on Clerk","README/docs naming Clerk for auth, sign-in flows, or user management"],helpText:"Search Clerk's public documentation and SDK implementation snippets via Clerk's hosted MCP server."})});var LQA;var FQA=r(()=>{IA();LQA=m({id:"cloudflare",label:"Cloudflare",iconKey:"cloudflare",defaultServerUrl:"https://mcp.cloudflare.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"cloudflare",callbackPathSegment:"cloudflare",authorizationUrl:"https://mcp.cloudflare.com/authorize",tokenUrl:"https://mcp.cloudflare.com/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.cloudflare.com/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[],scopesUserSelectable:!1,regions:[{label:"Cloudflare API (all products, account-scoped)",serverUrl:"https://mcp.cloudflare.com/mcp"},{label:"Observability (Workers logs & analytics)",serverUrl:"https://observability.mcp.cloudflare.com/mcp",authorizationUrl:"https://observability.mcp.cloudflare.com/oauth/authorize",tokenUrl:"https://observability.mcp.cloudflare.com/token",dynamicClientRegistration:{registrationEndpoint:"https://observability.mcp.cloudflare.com/register",tokenEndpointAuthMethod:"none"}},{label:"Workers Bindings (D1, R2, KV, Workers)",serverUrl:"https://bindings.mcp.cloudflare.com/mcp",authorizationUrl:"https://bindings.mcp.cloudflare.com/oauth/authorize",tokenUrl:"https://bindings.mcp.cloudflare.com/token",dynamicClientRegistration:{registrationEndpoint:"https://bindings.mcp.cloudflare.com/register",tokenEndpointAuthMethod:"none"}},{label:"Workers Builds (CI/CD builds)",serverUrl:"https://builds.mcp.cloudflare.com/mcp",authorizationUrl:"https://builds.mcp.cloudflare.com/oauth/authorize",tokenUrl:"https://builds.mcp.cloudflare.com/token",dynamicClientRegistration:{registrationEndpoint:"https://builds.mcp.cloudflare.com/register",tokenEndpointAuthMethod:"none"}},{label:"Radar (Internet traffic insights)",serverUrl:"https://radar.mcp.cloudflare.com/mcp",authorizationUrl:"https://radar.mcp.cloudflare.com/oauth/authorize",tokenUrl:"https://radar.mcp.cloudflare.com/token",dynamicClientRegistration:{registrationEndpoint:"https://radar.mcp.cloudflare.com/register",tokenEndpointAuthMethod:"none"}}],capabilityOverrides:{allowWriteTools:!0},evidenceHints:["wrangler.toml / wrangler.jsonc, @cloudflare/* packages, or CLOUDFLARE_* environment variables","Cloudflare Workers, Pages, R2, D1, KV, or Durable Objects usage in code or config","README/runbooks naming Cloudflare as the CDN, edge, or Workers platform"],helpText:"By default, use Cloudflare's unified all-products API server (mcp.cloudflare.com), scoped by your account's permissions. Optionally pick a per-product server for observability logs and analytics, bindings (D1, R2, KV), builds, or Radar insights."})});var MQA;var YQA=r(()=>{$t();IA();MQA=m({id:"cloudflare-api-token",label:"Cloudflare (API token)",iconKey:"cloudflare",defaultServerUrl:"https://mcp.cloudflare.com/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["wrangler.toml / wrangler.jsonc, @cloudflare/* packages, or CLOUDFLARE_* environment variables","Cloudflare Workers, Pages, R2, D1, KV, or Durable Objects usage in code or config","README/runbooks naming Cloudflare as the CDN, edge, or Workers platform"],helpText:"Query the Cloudflare API MCP server (Workers, DNS, zones, and more) using a Cloudflare API token instead of OAuth.",setupGroups:[{id:"api-token",title:"Create a Cloudflare API token",description:"Mint an API token scoped to exactly the products and permissions Sazabi should access.",body:"In the Cloudflare dashboard, go to **My Profile > API Tokens > Create Token**, then **Create Custom Token**. Under **Permissions**, add read access for the products you want the agent to use — for example **Account > Workers Observability > Read**, **Zone > DNS > Read**, and **Account > Account Settings > Read** — then copy the generated `cfut_...` token. Tokens with **Client IP Address Filtering** enabled are not supported by the hosted MCP server.",fieldKeys:["apiToken"]}],validateCredentials:aeA,normalizeHeaders:EeA})});var kQA;var $QA=r(()=>{$t();IA();kQA=m({id:"composio",label:"Composio",iconKey:"composio",defaultServerUrl:"https://connect.composio.dev/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Composio MCP, COMPOSIO_API_KEY, or Composio SDK usage","connect.composio.dev/mcp in MCP client configuration","README/docs naming Composio integrations, toolkits, or connected apps"],helpText:"Use tools from the Composio toolkits you have connected, through Composio's hosted Connect MCP server with a Composio API key.",setupGroups:[{id:"connect-toolkits",title:"Connect the toolkits you want to use",description:"Composio's MCP server only exposes tools for the apps you have connected in Composio.",body:"In the [Composio dashboard](https://dashboard.composio.dev), connect the apps (toolkits) you want the agent to use. Composio can also prompt to connect apps on demand at runtime, but connecting them first makes those tools available right away."},{id:"api-key",title:"Create an API key",description:"Create or copy the Composio API key Sazabi will send to Composio's hosted MCP endpoint.",body:"In the [Composio dashboard](https://dashboard.composio.dev), open **Settings > Project Settings** and copy your project API key from the **API Keys** section (or use the AI Clients page). Paste it below. Sazabi stores it securely and sends it as the `x-consumer-api-key` header to Composio's Connect MCP endpoint.",fieldKeys:["apiKey"]}],validateCredentials:$eA,normalizeHeaders:keA})});var GQA;var TQA=r(()=>{$t();IA();GQA=m({id:"context-dev",label:"Context.dev",iconKey:"context-dev",defaultServerUrl:"https://context-dev.stlmcp.com",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Context.dev SDK usage (context.dev on npm/PyPI/RubyGems), CONTEXT_DEV_API_KEY environment variables, or ctxt_secret_ API keys","context.dev-mcp usage or a context-dev.stlmcp.com server URL in MCP client config","README/docs naming Context.dev for brand intelligence, web scraping/crawling, or website change monitors"],helpText:"Resolve brand data, scrape and crawl websites into LLM-ready Markdown, extract structured data, and manage website-change monitors with Context.dev's hosted MCP server using your Context.dev API key.",setupGroups:[{id:"api-key",title:"Create an API key",description:"Create or copy the Context.dev API key Sazabi will send to Context.dev's hosted MCP endpoint.",body:"Create or copy an API key (`ctxt_secret_...`) from your [Context.dev dashboard](https://context.dev), then paste it below. Sazabi stores it securely and sends it as the `x-context-dev-api-key` header to Context.dev's MCP endpoint.",fieldKeys:["apiKey"]}],validateCredentials:PeA,normalizeHeaders:JeA,skill:"context-dev",setupSkill:"context-dev-setup"})});var JQA;var PQA=r(()=>{$t();IA();JQA=m({id:"datadog",label:"Datadog",iconKey:"datadog",defaultServerUrl:"https://mcp.datadoghq.com/api/unstable/mcp-server/mcp?toolsets=core",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Datadog config, DD_* environment variables, or @datadog packages","datadog-agent, dd-trace, monitors, dashboards, or incident docs","README/docs naming Datadog for logs, metrics, traces, APM, or incidents"],helpText:"Browse Datadog metrics, logs, traces, and incidents using your Datadog site URL, API key, and Application Key.",setupGroups:[{id:"site",title:"Find your Datadog site",description:"Use the Datadog site URL for the region where your account lives.",body:"Copy the Datadog site URL from the top of your browser, such as `https://app.datadoghq.com` or `https://us3.datadoghq.com`. Sazabi uses this to build the matching hosted MCP endpoint.",fieldKeys:["siteUrl"]},{id:"keys",title:"Create API credentials",description:"Create or copy the two Datadog keys Sazabi needs for hosted MCP.",imageKeys:["mcp.datadog.api-keys-settings","mcp.datadog.application-keys-settings"],body:"In Datadog, go to **Organization Settings > Access > API Keys** to create or copy your API key. Then go to **Organization Settings > Access > Application Keys** to create or copy your Application Key. Note: an Application Key inherits the permissions of the user who creates it, so create it as a least-privilege user or scope the key down to only what the agent needs.",fieldKeys:["apiKey","applicationKey"]}],validateCredentials:CeA,normalizeHeaders:BeA})});var fQA;var RQA=r(()=>{IA();fQA=m({id:"deepwiki",label:"DeepWiki",iconKey:"deepwiki",defaultServerUrl:"https://mcp.deepwiki.com/mcp",transport:"streamable-http",authMode:"none",availability:"enabled",capabilityOverrides:{readOnlyToolNames:["read_wiki_structure","read_wiki_contents","ask_question"]},evidenceHints:["Questions about how a public GitHub repository or open-source dependency works","deepwiki.com URLs or references to DeepWiki-generated documentation","Investigations needing up-to-date docs/architecture for a third-party OSS project"],helpText:"Query public GitHub repository documentation and ask questions about open-source code via DeepWiki's hosted MCP server."})});var OQA;var vQA=r(()=>{$t();IA();OQA=m({id:"elastic-cloud",label:"Elastic Cloud",iconKey:"elastic-cloud",defaultServerUrl:null,serverUrlHostnameSuffixes:[".elastic.cloud",".cloud.es.io",".elastic-cloud.com"],transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Elasticsearch, Kibana, Elastic Agent, Beats, or Logstash config","ELASTIC_* environment variables or elasticsearch client packages","README/docs naming Elastic Cloud, Elasticsearch, or Kibana"],helpText:"Search Elasticsearch indices and query Elastic Agent Builder tools using your Kibana MCP endpoint and an Elastic API key.",setupGroups:[{id:"deployment",title:"Open Kibana",description:"Find the Kibana URL for the Elastic deployment you want to connect.",body:"Go to [Elastic Cloud deployments](https://cloud.elastic.co/deployments), open the deployment you want to connect, then open Kibana and copy the Kibana base URL from the browser. If your Kibana URL contains `/s/<space>/`, keep that space value for the connect step.",fieldKeys:["kibanaUrl","kibanaSpace"]},{id:"api-key",title:"Create an API key",description:"Create the Elastic API key that the hosted MCP server will use.",body:"In Kibana, go to **Stack Management > API keys** and choose **Create API key**. Restrict its privileges to the Agent Builder MCP server: the `feature_agentBuilder.read` and `feature_actions.read` Kibana privileges, plus read access to the indices your tools query. Copy the generated key.",fieldKeys:["apiKey"]}],validateCredentials:ceA,normalizeHeaders:heA})});var zQA;var mQA=r(()=>{$t();IA();zQA=m({id:"exa",label:"Exa",iconKey:"exa",defaultServerUrl:"https://mcp.exa.ai/mcp?tools=web_search_exa,web_fetch_exa,web_search_advanced_exa,agent_tools",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Exa search, EXA_API_KEY environment variables, or the exa-js / exa-py SDK","exa-mcp-server usage or a mcp.exa.ai server URL in MCP client config","README/docs naming Exa for web search, crawling, or research"],helpText:"Search the web, research companies, crawl pages, and run deep research with Exa's hosted MCP server using your Exa API key.",setupGroups:[{id:"api-key",title:"Create an API key",description:"Create or copy the Exa API key Sazabi will send to Exa's hosted MCP endpoint.",body:"Create or copy an API key from the [Exa dashboard](https://dashboard.exa.ai/api-keys), then paste it below. Sazabi stores it securely and sends it as the `x-api-key` header to Exa's MCP endpoint.",fieldKeys:["apiKey"]}],validateCredentials:YeA,normalizeHeaders:MeA,skill:"exa",setupSkill:"exa-setup"})});var WQA;var ZQA=r(()=>{$t();IA();WQA=m({id:"gcp",label:"Google Cloud (GCP)",iconKey:"gcp",defaultServerUrl:"https://logging.googleapis.com/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["GOOGLE_APPLICATION_CREDENTIALS, GCLOUD_PROJECT, or GOOGLE_CLOUD_PROJECT environment variables","gcloud config, app.yaml, cloudbuild.yaml, or @google-cloud/* packages","README/docs naming Google Cloud, GCP, Cloud Logging, Cloud Monitoring, BigQuery, Cloud Run, or GKE"],helpText:"Query Google Cloud (Cloud Logging, Monitoring, BigQuery, and more) using a Google OAuth 2.0 Bearer access token.",setupGroups:[{id:"server-url",title:"Choose the Google Cloud MCP endpoint",description:"Google exposes a separate remote MCP server per product at https://SERVICE.googleapis.com/mcp.",body:"Sazabi defaults to Cloud Logging (`https://logging.googleapis.com/mcp`). To use a different product, replace the server URL with its endpoint, such as `https://monitoring.googleapis.com/mcp` (Cloud Monitoring) or `https://bigquery.googleapis.com/mcp` (BigQuery). See the [supported products list](https://docs.cloud.google.com/mcp/supported-products)."},{id:"access-token",title:"Create a Google OAuth 2.0 access token",description:"Generate a Google access token scoped by IAM to the resources Sazabi should read.",body:"The hosted servers authenticate with a Google OAuth 2.0 Bearer access token. For a non-interactive token, install the [gcloud CLI](https://docs.cloud.google.com/mcp/authenticate-mcp), configure Application Default Credentials (a user login, service-account key, or impersonation), then run `gcloud auth application-default print-access-token` and copy the token. Paste the raw token into Sazabi — Sazabi adds the `Bearer ` prefix and sends it in the `Authorization` header. Google access tokens are short-lived, so refresh the token when it expires.",fieldKeys:["accessToken"]}],validateCredentials:HeA,normalizeHeaders:VeA})});var VQA;var HQA=r(()=>{IA();VQA=m({id:"google-drive",label:"Google Drive",iconKey:"google-drive",defaultServerUrl:"https://drivemcp.googleapis.com/mcp/v1",transport:"streamable-http",authMode:"oauth",availability:"disabled",oauth:{providerConfigKey:"google-drive",callbackPathSegment:"google-drive",authorizationUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",authorizationUrlParams:{access_type:"offline",prompt:"consent"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"https://www.googleapis.com/auth/drive.readonly",label:"Drive read",description:"Read files and metadata in the user's Google Drive through the hosted MCP server."}],setupGroups:[{id:"google-cloud-oauth-client",title:"Create an OAuth client in Google Cloud",description:"The Google Drive MCP server does not support automatic client registration. An admin must create an OAuth client in a Google Cloud project and provide its credentials to Sazabi.",body:["1. In the Google Cloud console, open **APIs & Services → OAuth consent screen** and configure the consent screen with the Drive scopes.","2. Under **APIs & Services → Credentials**, create an **OAuth client ID** of type **Web application**.","3. Add the Sazabi Google Drive MCP callback URL shown on this page as an **Authorized redirect URI**.","4. Enable both the **Google Drive API** and the **Google Drive MCP API** (`drivemcp.googleapis.com`) for the project. Both are required for the hosted MCP server to be reachable.","5. Provide the generated **Client ID** and **Client Secret** to your Sazabi deployment configuration."].join(`
8706
8706
  `)}],evidenceHints:["drive.google.com / docs.google.com links, or Google Drive file IDs in runbooks","googleapis / google-auth-library packages, or GOOGLE_* / GDRIVE_* environment variables","README/runbooks naming Google Drive as a document or asset store"],helpText:"Search and read files and metadata in a Google Drive through Google's hosted MCP server. Coming soon — requires a Sazabi-provisioned Google OAuth client and isn't self-serve connectable yet."})});var XQA;var jQA=r(()=>{IA();XQA=m({id:"grafana",label:"Grafana Cloud",iconKey:"grafana",defaultServerUrl:"https://mcp.grafana.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"grafana",callbackPathSegment:"grafana",authorizationUrl:"https://mcp.grafana.com/mcp/oauth/authorize",tokenUrl:"https://mcp.grafana.com/mcp/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.grafana.com/mcp/oauth/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"grafana:read",label:"Read",description:"Read Grafana dashboards, panels, metrics, logs, traces, alerts, and incidents."},{value:"grafana:write",label:"Write",description:"Create and modify Grafana resources. Write tools require explicit approval per your organization's tool policy."}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["grafana.net / grafana.com links, Grafana dashboards, or GRAFANA_* environment variables","Prometheus, Loki, Tempo, or Mimir data sources wired into Grafana","README/runbooks naming Grafana for dashboards, metrics, logs, traces, or alerts"],helpText:"Browse Grafana dashboards, metrics, logs, traces, and alerts across your Grafana Cloud stack."})});var KQA;var _QA=r(()=>{IA();KQA=m({id:"granola",label:"Granola",iconKey:"granola",defaultServerUrl:"https://mcp.granola.ai/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"granola",callbackPathSegment:"granola",authorizationUrl:"https://mcp-auth.granola.ai/oauth2/authorize",tokenUrl:"https://mcp-auth.granola.ai/oauth2/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp-auth.granola.ai/oauth2/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"offline_access",required:!0}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["granola.ai meeting links, Granola notes exports, or GRANOLA_* environment variables","Incident, customer-call, or product-feedback docs naming Granola","Operational runbooks that refer to meeting notes or transcripts in Granola"],helpText:"Search and browse Granola meeting notes, transcripts, and folders."})});var xQA;var sQA=r(()=>{IA();xQA=m({id:"happenstance",label:"Happenstance",iconKey:"happenstance",defaultServerUrl:"https://happenstance.ai/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"happenstance",callbackPathSegment:"happenstance",authorizationUrl:"https://happenstance.ai/oauth/authorize",tokenUrl:"https://clerk.happenstance.ai/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://clerk.happenstance.ai/oauth/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"profile",label:"Profile",description:"Read your Happenstance profile."},{value:"email",label:"Email",description:"Read the email associated with your Happenstance account."},{value:"offline_access",label:"Offline access",description:"Keep the connection alive by refreshing access without re-authentication."}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["happenstance.ai links or references to a Happenstance network/graph","HAPPENSTANCE_* environment variables or scripts calling Happenstance APIs","Docs naming Happenstance as the people/relationship search tool"],helpText:"Search your Happenstance network to find and get introduced to people."})});var qQA;var dQA=r(()=>{IA();qQA=m({id:"honeycomb",label:"Honeycomb",iconKey:"honeycomb",defaultServerUrl:"https://mcp.honeycomb.io/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"honeycomb",callbackPathSegment:"honeycomb",authorizationUrl:"https://ui.honeycomb.io/oauth/authorize",tokenUrl:"https://ui.honeycomb.io/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://ui.honeycomb.io/oauth/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"mcp:read",label:"Read",description:"Query Honeycomb environments, datasets, columns, boards, triggers, SLOs, and run queries."},{value:"mcp:write",label:"Write",description:"Create and update Honeycomb boards, triggers, and other resources."}],scopesUserSelectable:!1,regions:[{label:"United States (US)",serverUrl:"https://mcp.honeycomb.io/mcp"},{label:"Europe (EU)",serverUrl:"https://mcp.eu1.honeycomb.io/mcp",authorizationUrl:"https://ui.eu1.honeycomb.io/oauth/authorize",tokenUrl:"https://ui.eu1.honeycomb.io/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://ui.eu1.honeycomb.io/oauth/register",tokenEndpointAuthMethod:"none"}}],capabilityOverrides:{allowWriteTools:!0},evidenceHints:["honeycomb.io URLs, HONEYCOMB_API_KEY / HONEYCOMB_DATASET environment variables, or honeycomb:// dataset URIs","libhoney, @honeycombio packages, or OpenTelemetry exporters pointed at api.honeycomb.io / api.eu1.honeycomb.io","README/runbooks naming Honeycomb as the observability or tracing provider"],helpText:"Query Honeycomb environments, datasets, columns, boards, and triggers, run queries, and create or update boards and triggers. Choose the US or EU region when connecting."})});var pQA;var AIA=r(()=>{IA();pQA=m({id:"incident-io",label:"incident.io",iconKey:"incident-io",defaultServerUrl:"https://mcp.incident.io/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"incident-io",callbackPathSegment:"incident-io",authorizationUrl:"https://app.incident.io/auth/plugin/authorize",tokenUrl:"https://app.incident.io/auth/plugin/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.incident.io/mcp/oauth/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["incident.io alert-source URLs, escalation docs, or incident IDs","INCIDENT_IO_* environment variables or webhooks into incident.io","README/runbooks naming incident.io for incidents, alerts, or on-call"],helpText:"Browse incidents, alerts, and on-call.",skill:"incident-io",setupSkill:"incident-io-setup"})});var tIA;var gIA=r(()=>{$t();IA();tIA=m({id:"intercom",label:"Intercom",iconKey:"intercom",defaultServerUrl:"https://mcp.intercom.com/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Intercom config, INTERCOM_* environment variables, or intercom-client packages","Support inbox, conversations, help center, or customer messaging docs naming Intercom","README/docs naming Intercom for support threads or customer conversations"],helpText:"Read Intercom support conversations, contacts, and help center content using an Intercom API access token. US-hosted Intercom workspaces only.",setupGroups:[{id:"developer-app",title:"Open Intercom developer settings",description:"Use an Intercom app with an access token for the workspace you want to connect.",body:"In Intercom, go to **Settings > Integrations > Developer Hub**, open (or create) an app for your workspace, and confirm it has the permissions you want agents to use. The hosted MCP server lives at `https://mcp.intercom.com/mcp` and currently supports US-hosted Intercom workspaces only."},{id:"access-token",title:"Copy your access token",description:"Copy the Intercom API access token the hosted MCP server will use.",body:"From your Intercom app's **Authentication** section, copy the access token. Paste the raw token into Sazabi — Sazabi adds the `Bearer ` prefix and sends it in the `Authorization` header.",fieldKeys:["accessToken"]}],validateCredentials:NeA,normalizeHeaders:leA})});var nIA;var iIA=r(()=>{$t();IA();nIA=m({id:"langfuse",label:"Langfuse",iconKey:"langfuse",defaultServerUrl:"https://us.cloud.langfuse.com/api/public/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",regions:[{label:"United States (US)",serverUrl:"https://us.cloud.langfuse.com/api/public/mcp"},{label:"Europe (EU)",serverUrl:"https://cloud.langfuse.com/api/public/mcp"},{label:"Asia Pacific (JP)",serverUrl:"https://jp.cloud.langfuse.com/api/public/mcp"}],capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Langfuse SDK usage (langfuse, langfuse-langchain) or @langfuse packages","LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEY / LANGFUSE_HOST environment variables","README/docs naming Langfuse as the LLM tracing, evaluation, or observability provider"],helpText:"Query Langfuse traces, observations, metrics, scores, comments, and prompts using project API keys.",setupGroups:[{id:"region",title:"Pick your Langfuse Cloud region",description:"Select the Langfuse Cloud region that hosts your project (or use the custom connector for a self-hosted deployment).",body:"Langfuse Cloud is region-scoped: US (`https://us.cloud.langfuse.com`), EU (`https://cloud.langfuse.com`), or JP (`https://jp.cloud.langfuse.com`). Choose the region matching your Langfuse account; the hosted MCP server lives at `/api/public/mcp` on that host."},{id:"api-keys",title:"Create project API keys",description:"Generate the Langfuse project API key pair the hosted MCP server will use.",body:"In Langfuse, open **Project settings → API keys** and create a new key pair. Copy the Public key (`pk-lf-...`) and Secret key (`sk-lf-...`). Sazabi combines them into an HTTP Basic `Authorization` header (`Basic base64(publicKey:secretKey)`) and sends it to the MCP server. Paste the combined `Authorization` value into Sazabi.",fieldKeys:["authorization"]}],validateCredentials:veA,normalizeHeaders:ReA})});var oIA;var eIA=r(()=>{IA();oIA=m({id:"langsmith",label:"LangSmith",iconKey:"langsmith",defaultServerUrl:"https://api.smith.langchain.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"langsmith",callbackPathSegment:"langsmith",authorizationUrl:"https://api.smith.langchain.com/oauth/authorize",tokenUrl:"https://api.smith.langchain.com/oauth/token",resourceUrl:"https://api.smith.langchain.com/mcp",dynamicClientRegistration:{registrationEndpoint:"https://api.smith.langchain.com/oauth/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[],scopesUserSelectable:!1,regions:[{label:"GCP United States (US)",serverUrl:"https://api.smith.langchain.com/mcp"},{label:"GCP Europe (EU)",serverUrl:"https://eu.api.smith.langchain.com/mcp",authorizationUrl:"https://eu.api.smith.langchain.com/oauth/authorize",tokenUrl:"https://eu.api.smith.langchain.com/oauth/token",resourceUrl:"https://eu.api.smith.langchain.com/mcp",dynamicClientRegistration:{registrationEndpoint:"https://eu.api.smith.langchain.com/oauth/register",tokenEndpointAuthMethod:"none"}},{label:"GCP Asia Pacific (APAC)",serverUrl:"https://apac.api.smith.langchain.com/mcp",authorizationUrl:"https://apac.api.smith.langchain.com/oauth/authorize",tokenUrl:"https://apac.api.smith.langchain.com/oauth/token",resourceUrl:"https://apac.api.smith.langchain.com/mcp",dynamicClientRegistration:{registrationEndpoint:"https://apac.api.smith.langchain.com/oauth/register",tokenEndpointAuthMethod:"none"}},{label:"AWS United States (US)",serverUrl:"https://aws.api.smith.langchain.com/mcp",authorizationUrl:"https://aws.api.smith.langchain.com/oauth/authorize",tokenUrl:"https://aws.api.smith.langchain.com/oauth/token",resourceUrl:"https://aws.api.smith.langchain.com/mcp",dynamicClientRegistration:{registrationEndpoint:"https://aws.api.smith.langchain.com/oauth/register",tokenEndpointAuthMethod:"none"}}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["LANGSMITH_* or LANGCHAIN_* environment variables, or langsmith SDK usage","LangSmith tracing projects, runs, datasets, or evaluations","README/docs naming LangSmith for LLM tracing, evals, or observability"],helpText:"Query LangSmith tracing projects, runs, datasets, and evaluations to investigate LLM application behavior. Choose the region where your LangSmith organization lives when connecting."})});var QIA;var IIA=r(()=>{IA();QIA=m({id:"linear",label:"Linear",iconKey:"linear",defaultServerUrl:"https://mcp.linear.app/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"linear",callbackPathSegment:"linear",authorizationUrl:"https://mcp.linear.app/authorize",tokenUrl:"https://mcp.linear.app/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.linear.app/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"read",label:"Read",description:"Read Linear issues, projects, teams, comments, and related data."},{value:"write",label:"Write",description:"Create and update Linear issues, comments, and project data."}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},skill:"linear",setupSkill:"linear-setup",evidenceHints:["linear.app URLs, Linear issue keys, or team/project IDs in docs","LINEAR_* environment variables or scripts that call Linear APIs","README/runbooks naming Linear as the issue tracker or planning system"],helpText:"Browse and search Linear issues and projects, and create or update issues, comments, and project data."})});var hIA;var BIA=r(()=>{IA();hIA=m({id:"logfire",label:"Pydantic Logfire",iconKey:"logfire",defaultServerUrl:"https://logfire-us.pydantic.dev/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"logfire",callbackPathSegment:"logfire",authorizationUrl:"https://logfire-us.pydantic.dev/api/oauth/authorize",tokenUrl:"https://logfire-us.pydantic.dev/api/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://logfire-us.pydantic.dev/api/oauth/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"openid",required:!0},{value:"organization:read_channel"},{value:"project:read"},{value:"project:read_alert"},{value:"project:read_dashboard"},{value:"project:read_variables"}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Pydantic Logfire config, LOGFIRE_* environment variables, or logfire SDK packages","Python/Pydantic observability docs naming Logfire","Alerts, dashboards, or traces hosted in Logfire"],helpText:"Query Pydantic Logfire traces, metrics, and exceptions, and browse projects, alerts, and dashboards. Hosted on Logfire's US region (logfire-us.pydantic.dev)."})});var cIA;var CIA=r(()=>{IA();cIA=m({id:"mercury",label:"Mercury",iconKey:"mercury",defaultServerUrl:"https://mcp.mercury.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"mercury",callbackPathSegment:"mercury",authorizationUrl:"https://mcp.mercury.com/authorize",tokenUrl:"https://mcp.mercury.com/token",resourceUrl:"https://mcp.mercury.com/mcp",omitScopeFromAuthorizationUrl:!0,dynamicClientRegistration:{registrationEndpoint:"https://mcp.mercury.com/register",tokenEndpointAuthMethod:"client_secret_basic",includeScopesInRegistration:!0}},getAvailableScopes:async()=>[{value:"read",label:"Read access",description:"Read Mercury accounts, cards, recipients, transactions, treasury, and organization data."},{value:"offline_access",required:!0}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!1},skill:"mercury",setupSkill:"mercury-setup",evidenceHints:["Mercury dashboard links, mercury.com references, or Mercury API usage","MERCURY_* environment variables or docs mentioning Mercury banking","Treasury, card, account, recipient, or transaction workflows backed by Mercury"],helpText:"Search Mercury banking data including accounts, cards, recipients, transactions, treasury, and organization records. Read-only: this connection cannot move money or change your Mercury account."})});var EIA;var aIA=r(()=>{IA();EIA=m({id:"neon",label:"Neon",iconKey:"neon",defaultServerUrl:"https://mcp.neon.tech/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"neon",callbackPathSegment:"neon",authorizationUrl:"https://mcp.neon.tech/api/authorize",tokenUrl:"https://mcp.neon.tech/api/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.neon.tech/api/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"read",label:"Read",description:"Read Neon projects, branches, databases, and run queries."},{value:"write",label:"Write",description:"Create and modify Neon projects, branches, and databases."},{value:"*",label:"Full access",description:"All access - read and manage every Neon resource the connected account can reach."}],getUrlConfiguration:async()=>({docsUrl:"https://neon.com/docs/ai/neon-mcp-server",instructions:"Copy the hosted MCP server URL below. Optional: to narrow access, append ?readonly=true, &projectId=<id>, and/or &category=<groups> (see the Neon MCP docs), then copy the edited URL.",defaultServerUrl:"https://mcp.neon.tech/mcp",optional:!0}),capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Neon connection strings, neon.tech hosts, or @neondatabase/serverless packages","DATABASE_URL/POSTGRES_URL values documented as Neon","README/docs naming Neon as the Postgres provider"],helpText:"Manage Neon projects, branches, databases, and run SQL queries."})});var rIA;var yIA=r(()=>{IA();rIA=m({id:"notion",label:"Notion",iconKey:"notion",defaultServerUrl:"https://mcp.notion.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"notion",callbackPathSegment:"notion",authorizationUrl:"https://mcp.notion.com/authorize",tokenUrl:"https://mcp.notion.com/token",resourceUrl:"https://mcp.notion.com/mcp",dynamicClientRegistration:{registrationEndpoint:"https://mcp.notion.com/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"default",label:"Default",description:"Access Notion pages, databases, and workspace content via MCP."}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},skill:"notion",setupSkill:"notion-setup",evidenceHints:["notion.so URLs, Notion page IDs, or database IDs in docs","NOTION_* environment variables or scripts that call Notion APIs","README/runbooks naming Notion as the wiki or knowledge base"],helpText:"Browse and manage Notion pages, databases, and workspace content. During authorization, choose which pages and databases to share with the connection."})});var wIA;var DIA=r(()=>{IA();wIA=m({id:"1password",label:"1Password",iconKey:"onepassword",defaultServerUrl:"https://developer.1password.com/get-started/secure-ai-access",transport:"streamable-http",authMode:"none",availability:"disabled",getUrlConfiguration:async()=>null,evidenceHints:["1Password service-account tokens (ops_...), op CLI usage, or OP_SERVICE_ACCOUNT_TOKEN","1password.com / *.1password.com references, or op:// secret references","README/docs naming 1Password as the secrets manager or vault"],helpText:"Access 1Password via its documented secure AI access options. A general-purpose hosted MCP server is not available today; use the 1Password CLI (op) sandbox preset instead."})});var uIA;var bIA=r(()=>{IA();uIA=m({id:"paper",label:"Paper MCP",iconKey:"paper",defaultServerUrl:"http://127.0.0.1:29979/mcp",transport:"streamable-http",authMode:"none",availability:"disabled",getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["paper.design URLs, Paper Desktop app references, or PAPER_* environment variables","Design files, component libraries, or design-system docs naming Paper","HTML-to-PDF slide or presentation workflows that reference Paper"],helpText:"Read and write Paper design files, including nodes, selections, text content, and design-system elements. Coming soon — Paper's MCP server runs on desktop localhost and can't be reached by hosted Sazabi agents yet."})});var lIA;var NIA=r(()=>{IA();lIA=m({id:"plain",label:"Plain",iconKey:"plain",defaultServerUrl:"https://mcp.plain.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"plain",callbackPathSegment:"plain",authorizationUrl:"https://signin.auth.plain.com/oauth2/authorize",tokenUrl:"https://signin.auth.plain.com/oauth2/token",dynamicClientRegistration:{registrationEndpoint:"https://signin.auth.plain.com/oauth2/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"openid",required:!0},{value:"offline_access",required:!0}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["plain.com links, Plain customer/thread IDs, or PLAIN_* environment variables","Support inbox, customer thread, or tenant docs naming Plain","Code or scripts syncing customers, tenants, or support threads with Plain"],helpText:"Search and manage Plain support threads, customers, and tenants.",skill:"plain",setupSkill:"plain-setup"})});var UIA;var SIA=r(()=>{IA();UIA=m({id:"planetscale",label:"PlanetScale",iconKey:"planetscale",defaultServerUrl:"https://mcp.pscale.dev/mcp/planetscale",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"planetscale",callbackPathSegment:"planetscale",authorizationUrl:"https://app.planetscale.com/oauth/authorize",tokenUrl:"https://auth.planetscale.com/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://auth.planetscale.com/oauth/registration",tokenEndpointAuthMethod:"client_secret_basic"}},getAvailableScopes:async()=>[{value:"read_databases"},{value:"read_user"},{value:"read_organization"},{value:"write_databases"},{value:"write_organization"}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["PlanetScale connection strings, pscale CLI config, or planetscale.com links","PLANETSCALE_* or DATABASE_URL values documented as PlanetScale","README/docs naming PlanetScale for MySQL, branching, or schema changes"],helpText:"Query PlanetScale databases, inspect schema, and browse Insights data.",skill:"planetscale",setupSkill:"planetscale-setup"})});var LIA;var FIA=r(()=>{IA();LIA=m({id:"posthog",label:"PostHog",iconKey:"posthog",defaultServerUrl:"https://mcp.posthog.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"posthog",callbackPathSegment:"posthog",authorizationUrl:"https://oauth.posthog.com/oauth/authorize/",tokenUrl:"https://oauth.posthog.com/oauth/token/",dynamicClientRegistration:{registrationEndpoint:"https://oauth.posthog.com/oauth/register/",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"query:read"},{value:"insight:read"},{value:"insight:write"},{value:"feature_flag:read"},{value:"feature_flag:write"},{value:"experiment:read"},{value:"experiment:write"},{value:"dashboard:read"},{value:"dashboard:write"},{value:"event_definition:read"},{value:"event_definition:write"},{value:"person:read"},{value:"user:read",required:!0},{value:"user:write"},{value:"organization:read",required:!0},{value:"project:read",required:!0},{value:"project:write"},{value:"survey:read"},{value:"survey:write"},{value:"error_tracking:read"},{value:"logs:read"},{value:"tracing:read"},{value:"error_tracking:write"},{value:"session_recording:read"},{value:"session_recording_playlist:read"},{value:"alert:read"},{value:"activity_log:read"},{value:"annotation:read"},{value:"cohort:read"},{value:"hog_function:read"}],getUrlConfiguration:async()=>({docsUrl:"https://posthog.com/docs/model-context-protocol/faq",instructions:"Copy the hosted MCP server URL below. Optional: to expose only some tools, append ?features=<groups> or ?tools=<names> (see the PostHog MCP docs), then copy the edited URL.",defaultServerUrl:"https://mcp.posthog.com/mcp",optional:!0}),capabilityOverrides:{allowWriteTools:!0},evidenceHints:["posthog-js, posthog-node, POSTHOG_* or NEXT_PUBLIC_POSTHOG_* environment variables","Feature flag, experiment, session replay, or product analytics code using PostHog","README/docs naming PostHog for analytics, flags, experiments, logs, or tracing"],helpText:"Query PostHog analytics, feature flags, and experiments.",skill:"posthog",setupSkill:"posthog-setup"})});var MIA;var YIA=r(()=>{IA();MIA=m({id:"pylon",label:"Pylon",iconKey:"pylon",defaultServerUrl:"https://mcp.usepylon.com",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"pylon",callbackPathSegment:"pylon",authorizationUrl:"https://o.auth.usepylon.com/oauth2/authorize",tokenUrl:"https://o.auth.usepylon.com/oauth2/token",dynamicClientRegistration:{registrationEndpoint:"https://o.auth.usepylon.com/oauth2/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"openid",required:!0},{value:"offline_access",required:!0}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["usepylon.com links, Pylon issue/account IDs, or PYLON_* environment variables","Customer support workflows or account runbooks naming Pylon","Code or scripts syncing support issues, accounts, or contacts with Pylon"],helpText:"Search and manage Pylon support issues, accounts, and contacts.",skill:"pylon",setupSkill:"pylon-setup"})});var kIA;var $IA=r(()=>{IA();kIA=m({id:"railway",label:"Railway",iconKey:"railway",defaultServerUrl:"https://mcp.railway.com",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"railway",callbackPathSegment:"railway",authorizationUrl:"https://backboard.railway.com/oauth/auth",tokenUrl:"https://backboard.railway.com/oauth/token",resourceUrl:"https://mcp.railway.com",dynamicClientRegistration:{registrationEndpoint:"https://backboard.railway.com/oauth/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"openid",required:!0},{value:"profile",required:!0},{value:"email",required:!0},{value:"offline_access",required:!0},{value:"workspace:member",label:"Workspace access",description:"Read and manage Railway projects, services, deployments, variables, and logs in the workspaces the connected account belongs to."}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},skill:"railway",setupSkill:"railway-setup",evidenceHints:["railway.app / railway.com links, RAILWAY_* environment variables, or a railway.json/railway.toml in the repo","Deploy workflows or runbooks naming Railway as the hosting/PaaS provider","Railway project/service/environment IDs referenced in docs or CI"],helpText:"Manage Railway projects, services, deployments, variables, and logs."})});var GIA;var TIA=r(()=>{$t();IA();GIA=m({id:"render",label:"Render",iconKey:"render",defaultServerUrl:"https://mcp.render.com/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["render.com links, RENDER_* environment variables, or a render.yaml in the repo","Deploy workflows or runbooks naming Render as the hosting/PaaS provider","Render service/deploy IDs referenced in docs or CI"],helpText:"Manage Render services, deploys, environment variables, logs, and metrics.",setupGroups:[{id:"api-key",title:"Create an API key",description:"Create or copy the Render API key Sazabi will send to Render's hosted MCP endpoint.",body:"Create a Render [API key](https://dashboard.render.com/settings/api-keys) in **Account Settings > API Keys**, then paste it below. Note: a Render API key is account-wide and can manage and deploy every service in the account, so treat it as a powerful credential.",fieldKeys:["apiKey"]}],validateCredentials:SeA,normalizeHeaders:UeA})});var JIA;var PIA=r(()=>{$t();IA();JIA=m({id:"rentahuman",label:"RentAHuman",iconKey:"rentahuman",defaultServerUrl:"https://rentahuman.ai/api/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["rentahuman.ai, RENTAHUMAN_API_KEY environment variables, or RentAHuman API keys","rentahuman-mcp usage or a rentahuman.ai/api/mcp server URL in MCP client config","README/docs naming RentAHuman for hiring humans or human-in-the-loop work"],helpText:"Hire and coordinate human workers for real-world tasks with RentAHuman's hosted MCP server using an API key.",setupGroups:[{id:"api-key",title:"Create an API key",description:"Create or copy the RentAHuman API key Sazabi will send to its hosted MCP endpoint.",body:"Create or copy an API key from the [RentAHuman API keys page](https://rentahuman.ai/account/api-keys), then paste it below. Sazabi stores it securely and sends it as the `X-API-Key` header. Note: this key can hire workers and trigger payments, so keep the per-connection read-only toggle on unless you intend the agent to act.",fieldKeys:["apiKey"]}],validateCredentials:TeA,normalizeHeaders:GeA,skill:"rentahuman",setupSkill:"rentahuman-setup"})});var fIA;var RIA=r(()=>{$t();IA();fIA=m({id:"resend",label:"Resend",iconKey:"resend",defaultServerUrl:"https://mcp.resend.com/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Resend email API usage, RESEND_API_KEY environment variables, or the resend SDK","resend-mcp usage or a mcp.resend.com server URL in MCP client config","README/docs naming Resend for transactional or marketing email"],helpText:"Send transactional emails and manage domains, contacts, and audiences with Resend's hosted MCP server using your Resend API key.",setupGroups:[{id:"api-key",title:"Create an API key",description:"Create or copy the Resend API key Sazabi will send to Resend's hosted MCP endpoint.",body:"Create or copy an API key from the [Resend dashboard](https://resend.com/api-keys), then paste it below. Choose the key's permission to match what you want the agent to do: **Sending access** (send emails only, the safer choice) or **Full access** (also manage domains, contacts, and audiences). Sazabi stores it securely and sends it as the `Authorization: Bearer` token to Resend's MCP endpoint (`https://mcp.resend.com/mcp`).",fieldKeys:["apiKey"]}],validateCredentials:meA,normalizeHeaders:zeA,skill:"resend",setupSkill:"resend-setup"})});var OIA;var vIA=r(()=>{$t();IA();OIA=m({id:"respan",label:"Respan",iconKey:"respan",defaultServerUrl:"https://mcp.respan.ai/api/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Respan / Keywords AI observability usage, RESPAN_API_KEY environment variables, or the respan-ai / keywordsai SDK","respan-mcp usage or a mcp.respan.ai server URL in MCP client config","README/docs naming Respan or Keywords AI for LLM logs, traces, or prompt management"],helpText:"Query LLM request logs, traces, prompts, and customer data from your Respan account using Respan's hosted MCP server and your Respan API key.",setupGroups:[{id:"api-key",title:"Create an API key",description:"Create or copy the Respan API key Sazabi will send to Respan's hosted MCP endpoint.",body:"Create or copy an API key from the [Respan dashboard](https://platform.respan.ai/platform/api/api-keys), then paste it below. Sazabi stores it securely and sends it as the `Authorization: Bearer` token to Respan's MCP endpoint (`https://mcp.respan.ai/api/mcp`).",fieldKeys:["apiKey"]}],validateCredentials:ZeA,normalizeHeaders:WeA,skill:"respan",setupSkill:"respan-setup"})});var zIA;var mIA=r(()=>{IA();zIA=m({id:"salesforce",label:"Salesforce",iconKey:"salesforce",defaultServerUrl:"https://api.salesforce.com/platform/mcp/v1/platform/sobject-all",transport:"streamable-http",authMode:"oauth",availability:"disabled",oauth:{providerConfigKey:"salesforce",callbackPathSegment:"salesforce",authorizationUrl:"https://login.salesforce.com/services/oauth2/authorize",tokenUrl:"https://login.salesforce.com/services/oauth2/token"},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"mcp_api",label:"MCP API access",description:"Access Salesforce data and metadata (sObjects, Apex invocable actions, Flows) through the hosted MCP server. Salesforce hosted MCP External Client Apps require the MCP-specific `mcp_api` scope."},{value:"refresh_token",label:"Offline access",description:"Refresh the access token without requiring the user to re-authenticate.",required:!0}],capabilityOverrides:{allowWriteTools:!0},setupGroups:[{id:"external-client-app",title:"Register an External Client App in Salesforce",description:"Salesforce hosted MCP servers do not support automatic client registration. An admin must create an External Client App (ECA) in the org and enable it for the hosted MCP server.",body:["1. In Salesforce Setup, open **App Manager** and create a new **External Client App**.","2. Enable OAuth, add the **mcp_api** and **refresh_token (offline access)** scopes, and require PKCE.","3. Set the callback URL to the Sazabi Salesforce MCP callback URL shown on this page.","4. Enable the app for your hosted MCP server under **Setup → MCP Servers**.","5. Provide the generated **Consumer Key (Client ID)** and **Consumer Secret (Client Secret)** to your Sazabi deployment configuration."].join(`
8707
- `)}],evidenceHints:["force.com / my.salesforce.com URLs, SALESFORCE_* or SFDC_* environment variables, or sf/sfdx CLI usage","jsforce, simple-salesforce, or @salesforce packages","README/runbooks naming Salesforce as the CRM or system of record"],helpText:"Query Salesforce data and metadata, and run Apex invocable actions and Flows exposed by a hosted MCP server. Coming soon — a Salesforce admin registers an External Client App in your org and Sazabi provisions its credentials, so it isn't self-serve connectable yet."})});var WIA;var ZIA=r(()=>{IA();WIA=m({id:"secureframe",label:"Secureframe",iconKey:"secureframe",defaultServerUrl:"https://mcp.secureframe.com",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"secureframe",callbackPathSegment:"secureframe",authorizationUrl:"https://mcp.secureframe.com/oauth/authorize",tokenUrl:"https://mcp.secureframe.com/oauth/token",resourceUrl:"https://mcp.secureframe.com",dynamicClientRegistration:{registrationEndpoint:"https://mcp.secureframe.com/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"mcp",label:"MCP Access",description:"Query and manage Secureframe compliance data, controls, tests, vendors, risks, and framework requirements."}],scopesUserSelectable:!1,regions:[{label:"United States (US)",serverUrl:"https://mcp.secureframe.com"},{label:"United Kingdom (UK)",serverUrl:"https://mcp-uk.secureframe.com",authorizationUrl:"https://mcp-uk.secureframe.com/oauth/authorize",tokenUrl:"https://mcp-uk.secureframe.com/oauth/token",resourceUrl:"https://mcp-uk.secureframe.com",dynamicClientRegistration:{registrationEndpoint:"https://mcp-uk.secureframe.com/register",tokenEndpointAuthMethod:"none"}}],capabilityOverrides:{allowWriteTools:!0},evidenceHints:["secureframe.com URLs, SECUREFRAME_API_KEY / SECUREFRAME_API_SECRET environment variables","SOC 2, ISO 27001, HIPAA, PCI DSS, GDPR, or NIST compliance frameworks and controls","README/docs or compliance runbooks naming Secureframe for automated compliance and continuous monitoring"],helpText:"Query and manage Secureframe compliance data, controls, automated tests, vendors, risks, and framework requirements. Choose the US or UK region when connecting.",skill:"secureframe",setupSkill:"secureframe-setup"})});var VIA;var HIA=r(()=>{IA();VIA=m({id:"sentry",label:"Sentry",iconKey:"sentry",defaultServerUrl:"https://mcp.sentry.dev/mcp",serverUrlPathSuffixMaxSegments:2,transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"sentry",callbackPathSegment:"sentry",authorizationUrl:"https://mcp.sentry.dev/oauth/authorize",tokenUrl:"https://mcp.sentry.dev/oauth/token",useServerUrlAsResource:!0,dynamicClientRegistration:{registrationEndpoint:"https://mcp.sentry.dev/oauth/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"org:read"},{value:"project:write"},{value:"team:write"},{value:"event:write"}],getUrlConfiguration:async()=>({docsUrl:"https://mcp.sentry.dev/",instructions:"Copy the hosted MCP server URL below. Optional: to scope this connection to one organization or project, copy a path-scoped URL from the Sentry MCP page (e.g. .../mcp/your-org).",defaultServerUrl:"https://mcp.sentry.dev/mcp",optional:!0}),capabilityOverrides:{allowWriteTools:!0},evidenceHints:["@sentry packages, sentry.properties, SENTRY_* environment variables, or sentry-cli usage","Sentry.init calls, release/deploy automation, or Sentry alert docs","README/docs naming Sentry as the error tracking provider"],helpText:"Browse Sentry organizations, teams, projects, and events."})});var XIA;var jIA=r(()=>{$t();IA();XIA=m({id:"signoz",label:"SigNoz",iconKey:"signoz",defaultServerUrl:"https://mcp.us.signoz.cloud/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["SigNoz config, SIGNOZ_* environment variables, or signoz.io links","OpenTelemetry Collector exporting to SigNoz, or a signoz docker-compose / self-hosted deployment","README/docs naming SigNoz for metrics, logs, traces, alerts, or dashboards"],helpText:"Query SigNoz metrics, logs, traces, alerts, and dashboards to investigate production issues.",setupGroups:[{id:"instance",title:"Find your SigNoz instance",description:"Point Sazabi at the SigNoz instance whose telemetry you want to query.",body:"For SigNoz Cloud, use the regional MCP endpoint for your account, such as `https://mcp.us.signoz.cloud/mcp` (replace the region as needed). For self-hosted SigNoz, use your instance's MCP endpoint and set the SigNoz base URL below so the server knows which instance to target.",fieldKeys:["signozUrl"]},{id:"api-key",title:"Create an API key",description:"Create or copy the SigNoz API key Sazabi will send to SigNoz's MCP endpoint.",body:"In SigNoz, go to **Settings > API Keys** and create or copy an API key. Alert, dashboard, and notification-channel tools require an admin-level key. Paste it below.",fieldKeys:["apiKey"]}],validateCredentials:FeA,normalizeHeaders:LeA})});var KIA;var _IA=r(()=>{IA();KIA=m({id:"slack",label:"Slack",iconKey:"slack",defaultServerUrl:"https://mcp.slack.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"disabled",oauth:{providerConfigKey:"slack",callbackPathSegment:"slack",authorizationUrl:"https://slack.com/oauth/v2_user/authorize",tokenUrl:"https://slack.com/api/oauth.v2.user.access"},getAvailableScopes:async()=>[{value:"search:read.public"},{value:"search:read.private"},{value:"search:read.mpim"},{value:"search:read.im"},{value:"search:read.files"},{value:"search:read.users"},{value:"canvases:read"},{value:"users:read"},{value:"users:read.email"}],getUrlConfiguration:async()=>null,capabilityOverrides:{defaultUnavailableReason:"write_blocked"},evidenceHints:["Slack app manifests, bot/webhook URLs, SLACK_* environment variables, or slack.com links","Runbooks that route incidents, alerts, or deploy notices through Slack","Code or docs naming Slack channels for operational triage"],helpText:"Browse Slack messages, files, and threads. Coming soon — requires backend OAuth plumbing for user_scope and isn't self-serve connectable yet.",skill:"slack",setupSkill:"slack-setup"})});var xIA;var sIA=r(()=>{IA();xIA=m({id:"stripe",label:"Stripe MCP",iconKey:"stripe",defaultServerUrl:"https://mcp.stripe.com",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"stripe",callbackPathSegment:"stripe",authorizationUrl:"https://access.stripe.com/mcp/oauth2/authorize",tokenUrl:"https://access.stripe.com/mcp/oauth2/token",resourceUrl:"https://mcp.stripe.com",dynamicClientRegistration:{registrationEndpoint:"https://access.stripe.com/mcp/oauth2/register",tokenEndpointAuthMethod:"none"},defaultAccessTokenTtlSeconds:21600},getAvailableScopes:async()=>[{value:"mcp",label:"MCP access",description:"Access the Stripe MCP server tools for the connected account.",required:!0}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Stripe dashboard URLs, `sk_`/`rk_`/`pk_` API keys, or Stripe object IDs (cus_, pi_, ch_)","STRIPE_* environment variables or code that imports the `stripe` SDK","README/runbooks naming Stripe for billing, payments, or subscriptions"],helpText:"Query and manage Stripe payments, customers, and billing."})});var qIA;var dIA=r(()=>{IA();qIA=m({id:"supabase",label:"Supabase",iconKey:"supabase",defaultServerUrl:"https://mcp.supabase.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"supabase",callbackPathSegment:"supabase",authorizationUrl:"https://api.supabase.com/v1/oauth/authorize",tokenUrl:"https://api.supabase.com/v1/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://api.supabase.com/platform/oauth/apps/register",tokenEndpointAuthMethod:"client_secret_post"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"analytics:read"},{value:"auth:read"},{value:"auth:write"},{value:"database:read"},{value:"database:write"},{value:"domains:read"},{value:"domains:write"},{value:"edge_functions:read"},{value:"edge_functions:write"},{value:"environment:read"},{value:"environment:write"},{value:"organizations:read"},{value:"projects:read"},{value:"projects:write"},{value:"rest:read"},{value:"rest:write"},{value:"secrets:read"},{value:"secrets:write"},{value:"storage:read"}],getUrlConfiguration:async()=>({docsUrl:"https://supabase.com/docs/guides/getting-started/mcp#step-2-configure-your-ai-tool",instructions:"Choose your project and options in the Supabase configuration panel, then copy the generated Server URL.",defaultServerUrl:"https://mcp.supabase.com/mcp",optional:!0}),capabilityOverrides:{allowWriteTools:!0},evidenceHints:["supabase/ directory, supabase/config.toml, or @supabase packages","SUPABASE_* or NEXT_PUBLIC_SUPABASE_* environment variables","README/docs naming Supabase for Postgres, Auth, Storage, or Edge Functions"],helpText:"Manage Supabase organizations, projects, databases, and run SQL.",skill:"supabase",setupSkill:"supabase-setup"})});var pIA;var AhA=r(()=>{IA();pIA=m({id:"superhuman",label:"Superhuman",iconKey:"superhuman",defaultServerUrl:"https://mcp.mail.superhuman.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"superhuman",callbackPathSegment:"superhuman",authorizationUrl:"https://mcp.auth.mail.superhuman.com/oauth2/authorize",tokenUrl:"https://mcp.auth.mail.superhuman.com/oauth2/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.auth.mail.superhuman.com/oauth2/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"email",required:!0},{value:"offline_access",required:!0},{value:"openid",required:!0},{value:"profile",required:!0}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Superhuman mail links, SUPERHUMAN_* environment variables, or support workflows naming Superhuman","Customer communication runbooks that depend on email search or drafting","Docs naming Superhuman Mail for sales, support, or founder-led customer comms"],helpText:"Search, draft, send, and triage emails in Superhuman Mail."})});var thA;var ghA=r(()=>{$t();IA();thA=m({id:"the-context-company",label:"The Context Company",iconKey:"the-context-company",defaultServerUrl:"https://api.thecontext.company/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!1},evidenceHints:["The Context Company, context company, or context observability references","insight_search, get_agent_runs, or get_agent_sessions tool usage","THE_CONTEXT_COMPANY_API_KEY or api.thecontext.company in MCP configuration"],helpText:"Query agent insights, runs, and sessions through The Context Company's read-only hosted MCP server.",setupGroups:[{id:"api-key",title:"Create a read-only API key",description:"Create the API key The Context Company's hosted MCP server will use.",body:"Generate a read-only API key on The Context Company's [Access Data page](https://www.thecontextcompany.com/prod/mcp-and-api), then paste the raw key below. Sazabi sends it as `Authorization: Bearer <key>` to `https://api.thecontext.company/mcp`.",fieldKeys:["apiKey"]}],validateCredentials:weA,normalizeHeaders:yeA,skill:"the-context-company",setupSkill:"the-context-company-setup"})});var nhA;var ihA=r(()=>{IA();nhA=m({id:"vercel",label:"Vercel",iconKey:"vercel",defaultServerUrl:"https://mcp.vercel.com",transport:"streamable-http",authMode:"oauth",availability:"disabled",oauth:{providerConfigKey:"vercel",callbackPathSegment:"vercel",authorizationUrl:"https://vercel.com/oauth/authorize",tokenUrl:"https://vercel.com/api/login/oauth/token",resourceUrl:"https://mcp.vercel.com",dynamicClientRegistration:{registrationEndpoint:"https://vercel.com/api/login/oauth/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"openid",required:!0},{value:"offline_access",required:!0}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["vercel.com links, VERCEL_* environment variables, or a vercel.json in the repo","Deploy workflows or runbooks naming Vercel as the frontend/hosting provider","Vercel project/deployment IDs or preview URLs referenced in docs or CI"],helpText:"Manage Vercel projects, deployments, and access Vercel platform documentation. Coming soon — Vercel's hosted MCP only authorizes allowlisted clients and Sazabi is pending approval, so it isn't connectable yet."})});var ohA;var ehA=r(()=>{$t();IA();ohA=m({id:"x",label:"X",iconKey:"x",defaultServerUrl:"https://api.x.com/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{readOnlyToolNames:["search_news","get_news","get_trends_by_woeid","get_posts_by_ids","get_posts_counts_recent","search_posts_all","get_posts_by_id","get_posts_liking_users","get_posts_quoted_posts","get_posts_reposted_by","get_users_by_usernames","get_users_by_username","get_users_me","search_users","get_users_by_id","get_users_bookmarks","get_users_bookmark_folders","get_users_bookmarks_by_folder_id","get_users_mentions","get_users_timeline","get_users_posts"]},evidenceHints:["X (Twitter) API usage, X_BEARER_TOKEN, or TWITTER_* environment variables","twitter-api-v2, tweepy, or other X/Twitter API client packages","README/docs naming the X API, X Developer Platform, or tweet automation"],helpText:"Search X posts and access real-time X data using your app's app-only Bearer Token.",setupGroups:[{id:"developer-app",title:"Open the X Developer Portal",description:"Use an X developer project/app with access to the X API v2.",body:"Go to the [X Developer Portal](https://developer.x.com/en/portal/dashboard), open the project and app you want Sazabi to use, and confirm the app has access to the API tiers you need. The hosted MCP server lives at `https://api.x.com/mcp`."},{id:"bearer-token",title:"Copy the app's Bearer Token",description:"Copy the app-only Bearer Token the hosted MCP server will use.",body:"In your app's **Keys and tokens**, find the app-only **Bearer Token** and copy it (regenerate it if you don't have it saved). This is the app-only token, not a user OAuth 2.0 access token. Paste the raw token into Sazabi — Sazabi adds the `Bearer ` prefix and sends it in the `Authorization` header.",fieldKeys:["accessToken"]}],validateCredentials:DeA,normalizeHeaders:reA,skill:"x",setupSkill:"x-setup"})});var IhA,UGt;var hhA=r(()=>{peA();tQA();nQA();oQA();Fb();Fb();IQA();BQA();CQA();aQA();yQA();DQA();bQA();NQA();SQA();FQA();YQA();$QA();TQA();PQA();RQA();vQA();mQA();ZQA();HQA();jQA();_QA();sQA();dQA();AIA();gIA();iIA();eIA();IIA();BIA();CIA();aIA();yIA();DIA();bIA();NIA();SIA();FIA();YIA();$IA();TIA();PIA();RIA();vIA();mIA();ZIA();HIA();jIA();_IA();sIA();dIA();AhA();ghA();ihA();ehA();IhA=[qIA,JQA,fQA,deA,AQA,gQA,iQA,eQA,QQA,hQA,cQA,EQA,rQA,wQA,lQA,UQA,LQA,MQA,uQA,kQA,GQA,OQA,zQA,WQA,VQA,XQA,KQA,xQA,qQA,pQA,tIA,nIA,oIA,QIA,hIA,cIA,EIA,rIA,wIA,uIA,lIA,UIA,LIA,MIA,kIA,JIA,GIA,fIA,OIA,zIA,WIA,VIA,XIA,KIA,xIA,pIA,thA,nhA,ohA],UGt=new Map(IhA.map((A)=>[A.id,A]))});var BhA=()=>{};var chA=()=>{};var ChA=()=>{};var EhA=()=>{};var ahA=()=>{};var rhA=()=>{};var yhA=()=>{};var whA=()=>{};var DhA=()=>{};var uhA=()=>{};var bhA=()=>{};var lhA=()=>{};var NhA=()=>{};var UhA=()=>{};var ShA=()=>{};var LhA=()=>{};var FhA=()=>{};var MhA=()=>{};var YhA=()=>{};var khA=()=>{};var $hA=()=>{};var GhA=()=>{};var ThA=()=>{};var JhA=()=>{};var PhA=()=>{};var fhA=()=>{};var RhA=()=>{};var OhA=()=>{};var vhA=()=>{};var zhA=()=>{};var mhA=()=>{};var WhA=()=>{};var ZhA=()=>{};var VhA=()=>{};var HhA=()=>{};var XhA=()=>{};var jhA=()=>{};var KhA=()=>{};var _hA=()=>{};var xhA=()=>{};var shA=()=>{};var qhA=()=>{};var dhA=()=>{};var phA=()=>{};var ABA=r(()=>{BhA();chA();ChA();EhA();ahA();rhA();yhA();whA();DhA();uhA();bhA();lhA();NhA();UhA();ShA();LhA();FhA();MhA();YhA();khA();$hA();GhA();ThA();JhA();PhA();fhA();RhA();OhA();vhA();zhA();mhA();WhA();ZhA();VhA();HhA();XhA();jhA();KhA();_hA();xhA();shA();qhA();dhA();phA()});var tBA=r(()=>{Fb()});var gBA=()=>{};var nBA=r(()=>{kK();Uw();QeA();$t();jeA();KeA();hhA();Jf();ABA();tBA();gBA()});var iBA,i8A,oBA,o8A,eBA,Pf,QBA,IBA,Ie,hBA,BBA,cBA,QB,CBA,EBA,IB,aBA,rBA,hB,yBA,e8A,wBA,Mb,DBA,uBA,bBA,lBA,BB,NBA,UBA,cB,SBA,LBA,CB,ff,Rf,FBA,MBA,EB,YBA,kBA,aB,$BA,Q8A,rB,GBA,TBA,yB,JBA,PBA,wB,fBA,RBA,DB,I8A;var Of=r(()=>{nBA();JA();KA();iBA=["configured","authorizing","connected","error"],i8A=Q.enum(iBA),oBA=["preset","custom"],o8A=Q.enum(oBA),eBA=["streamable-http","sse"],Pf=Q.enum(eBA),QBA=["none","headers","oauth","aws-sigv4"],IBA=Q.enum(QBA),Ie=Q.object({connectionId:Q.string().uuid().describe("Connection ID."),connectionKey:Q.string().describe("Stable key used to reference this connector in tool calls."),providerId:Q.string().describe('Provider identifier, e.g. "linear".'),displayName:Q.string().describe("Human-readable connector name."),source:o8A.describe("Whether the connector is a built-in preset or a custom server."),installStatus:i8A.describe("Current connection lifecycle status."),authMode:IBA.describe("Authentication mode."),transport:Pf.describe("Transport protocol."),serverUrl:Q.string().describe("MCP server URL."),readOnly:Q.boolean().describe("Whether the connector is restricted to read-only tools."),management:Hk.describe("Lifecycle owner and supported connector mutations."),enabledToolCount:Q.number().int().nonnegative().describe("Number of tools enabled and available for this connector."),connectedAt:Q.string().datetime().nullable().describe("When the connector last became connected, if ever."),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),hBA=Q.object({name:Q.string().describe("Tool name as invoked."),title:Q.string().describe("Human-readable tool title."),description:Q.string().describe("Tool description."),isReadOnly:Q.boolean().describe("Whether the tool is considered read-only."),enabled:Q.boolean().describe("Whether the tool is enabled and available given the connector config.")}),BBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list connectors for. Auto-filled from SDK context when omitted."),connectedOnly:Q.union([Q.boolean(),Q.stringbool()]).optional().describe("When true, only return connectors that are connected.")}),cBA=Q.object({connectors:Q.array(Ie)}),QB=S({operationId:"mcpConnectors.list",description:"List configured MCP connectors within one project with provider, status, and enabled-tool count.",backend:"api",route:{method:"GET",path:"/mcp-connectors",tags:["MCP Connectors"]},input:BBA,output:cBA,pagination:"none",async:"sync"}),CBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to fetch."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),EBA=Q.object({connector:Ie}),IB=S({operationId:"mcpConnectors.get",description:"Get one configured MCP connector by connection ID.",backend:"api",route:{method:"GET",path:"/mcp-connectors/{connectionId}",tags:["MCP Connectors"]},input:CBA,output:EBA,pagination:"none",async:"sync"}),aBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to inspect."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),rBA=Q.object({connector:Ie,tools:Q.array(hBA)}),hB=S({operationId:"mcpConnectors.details",description:"Inspect one MCP connector's tool surface, including each tool's name, description, and read-only status.",backend:"api",route:{method:"GET",path:"/mcp-connectors/{connectionId}/details",tags:["MCP Connectors"]},input:aBA,output:rBA,pagination:"none",async:"sync"}),yBA=Q.object({providerId:Q.string().describe('Provider identifier, e.g. "linear".'),label:Q.string().describe("Human-readable provider name."),authMode:IBA.describe("Authentication mode."),availability:Q.enum(VI).describe("Whether the provider is enabled or coming soon."),setupSkill:Q.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),e8A=Q.object({}),wBA=Q.object({providers:Q.array(yBA)}),Mb=S({operationId:"mcpConnectors.listProviders",description:"List all supported MCP connector providers with their auth mode and setup skill.",backend:"api",route:{method:"GET",path:"/mcp-connectors/providers",tags:["MCP Connectors"]},input:e8A,output:wBA,pagination:"none",async:"sync"}),DBA=Q.object({connectionKey:Q.string().describe("Stable key used to call this connector."),displayName:Q.string().describe("Human-readable connector name."),providerId:Q.string().describe('Provider identifier, e.g. "linear".'),toolCount:Q.number().int().nonnegative().describe("Number of executable tools on this connector.")}),uBA=Q.object({connectionKey:Q.string().describe("Connector that exposes this tool."),toolName:Q.string().describe("Tool name as invoked."),providerId:Q.string().describe('Provider identifier, e.g. "linear".'),displayName:Q.string().describe("Human-readable connector name."),isReadOnly:Q.boolean().describe("Whether the tool is considered read-only."),description:Q.string().describe("Tool description from the stored snapshot."),score:Q.number().describe("BM25 rank score. Zero when enumerating a namespace."),inputSchema:Q.record(Q.string(),Q.unknown()).optional().describe("JSON Schema for the tool's arguments, when requested.")}),bBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to search connectors in. Auto-filled from SDK context when omitted."),query:Q.string().optional().describe("Free-text query over tool names, titles, connector keys, and descriptions. Omit or empty to list connectors, or to enumerate one connector when namespace is set."),namespace:Q.string().min(1).optional().describe("Restrict results to one connectionKey or providerId."),limit:Q.coerce.number().int().min(1).max(100).default(10).describe("Maximum number of connectors or tool hits to return."),offset:Q.coerce.number().int().min(0).default(0).describe("Number of connectors or tool hits to skip."),includeInputSchema:Q.union([Q.boolean(),Q.stringbool()]).optional().describe("When true, tool hits include inputSchema so a caller can execute without a describe round-trip.")}),lBA=Q.object({kind:Q.enum(["connectors","tools"]).describe("connectors when the query is empty and no namespace is set; tools otherwise."),total:Q.number().int().nonnegative().describe("Total matches before limit and offset."),connectors:Q.array(DBA).describe("Connector index. Empty when kind is tools."),tools:Q.array(uBA).describe("Ranked or enumerated tool hits. Empty when kind is connectors.")}),BB=S({operationId:"mcpConnectors.search",description:"Search executable third-party MCP connector tools by free-text query. Empty query lists connectors; empty query plus namespace enumerates that connector. Hits omit input schemas unless includeInputSchema is true.",backend:"api",route:{method:"GET",path:"/mcp-connectors/tools/search",tags:["MCP Connectors"]},input:bBA,output:lBA,pagination:"none",async:"sync"}),NBA=Q.object({projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),connectionKey:Q.string().min(1).describe("Connector key from search or mcpConnectors.list."),toolName:Q.string().min(1).describe("Tool name as invoked.")}),UBA=Q.object({connectionKey:Q.string().describe("Connector that exposes this tool."),toolName:Q.string().describe("Tool name as invoked."),providerId:Q.string().describe('Provider identifier, e.g. "linear".'),displayName:Q.string().describe("Human-readable connector name."),title:Q.string().describe("Human-readable tool title."),description:Q.string().describe("Tool description from the stored snapshot."),isReadOnly:Q.boolean().describe("Whether the tool is considered read-only."),inputSchema:Q.record(Q.string(),Q.unknown()).describe("JSON Schema for the tool's arguments.")}),cB=S({operationId:"mcpConnectors.describe",description:"Load one executable third-party MCP connector tool, including its input schema.",backend:"api",route:{method:"GET",path:"/mcp-connectors/tools/describe",tags:["MCP Connectors"]},input:NBA,output:UBA,pagination:"none",async:"sync"}),SBA=Q.object({projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),connectionKey:Q.string().min(1).describe("Connector key from search or mcpConnectors.list."),toolName:Q.string().min(1).describe("Tool name as invoked."),arguments:Q.record(Q.string(),Q.unknown()).optional().describe("Arguments matching the tool's input schema.")}),LBA=Q.discriminatedUnion("ok",[Q.object({ok:Q.literal(!0),connectionKey:Q.string().describe("Connector that ran the tool."),toolName:Q.string().describe("Tool name as invoked."),result:Q.unknown().describe("Vendor tool result payload."),structuredContent:Q.unknown().optional().describe("Structured content from the vendor when present."),content:Q.array(Q.record(Q.string(),Q.unknown())).describe("Raw MCP content parts from the vendor."),text:Q.string().nullable().describe("Concatenated text content, if any.")}),Q.object({ok:Q.literal(!1),code:Q.enum(["TOOL_NOT_ENABLED","READ_ONLY","MCP_ERROR"]).describe("Why the tool did not run."),message:Q.string().describe("Caller-facing error message.")})]),CB=S({operationId:"mcpConnectors.call",description:"Invoke one executable third-party MCP connector tool using that connection's stored credential.",backend:"api",route:{method:"POST",path:"/mcp-connectors/tools/call",tags:["MCP Connectors"]},input:SBA,output:LBA,pagination:"none",async:"sync"}),ff=Q.object({id:Q.string().min(1).describe("Stable ID for this header (must be unique within the connector)."),name:Q.string().trim().min(1).describe("HTTP header name."),value:Q.string().min(1).describe("HTTP header value (passed verbatim).")}),Rf=Q.object({accessKeyId:Q.string().trim().min(1).describe("AWS access key ID."),secretAccessKey:Q.string().min(1).describe("AWS secret access key."),sessionToken:Q.string().min(1).optional().describe("Optional session token for temporary credentials."),region:Q.string().trim().min(1).describe("AWS region.")}),FBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to create the connector in. Auto-filled from SDK context when omitted."),serverUrl:Q.string().url().describe("MCP server URL (must be https)."),transport:Pf.describe("Transport protocol."),headers:Q.array(ff).optional().describe("HTTP headers to send with each request."),awsSigV4:Rf.optional().describe("AWS SigV4 credentials for AWS MCP servers."),providerId:Q.string().min(1).describe("Built-in preset provider ID (for example, linear or datadog)."),readOnly:Q.boolean().optional().describe("Restrict the connector to read-only tools. Defaults to false.")}),MBA=Q.object({connector:Ie}),EB=S({operationId:"mcpConnectors.create",description:"Create a preset MCP connector with header-based or AWS SigV4 authentication. The server URL must match the selected provider's supported endpoints. Connects immediately and returns the connector with its discovered tool snapshot.",backend:"api",route:{method:"POST",path:"/mcp-connectors",tags:["MCP Connectors"],successStatus:201},input:FBA,output:MBA,pagination:"none",async:"sync"}),YBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to update."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),serverUrl:Q.string().url().optional().describe("New MCP server URL."),transport:Pf.optional().describe("New transport protocol."),headers:Q.array(ff).optional().describe("Complete replacement header set. Replaces all existing headers."),awsSigV4:Rf.optional().describe("Replacement AWS SigV4 credentials. Mutually exclusive with headers.")}),kBA=Q.object({connector:Ie}),aB=S({operationId:"mcpConnectors.update",description:"Deprecated. Preset MCP connector updates are no longer supported via the public API; disconnect and reconnect instead.",backend:"api",route:{method:"PATCH",path:"/mcp-connectors/{connectionId}",tags:["MCP Connectors"]},input:YBA,output:kBA,pagination:"none",async:"sync"}),$BA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to disconnect."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),Q8A=Q.void(),rB=S({operationId:"mcpConnectors.disconnect",description:"Disconnect and permanently remove an MCP connector.",backend:"api",route:{method:"DELETE",path:"/mcp-connectors/{connectionId}",tags:["MCP Connectors"],successStatus:204},input:$BA,output:Q8A,pagination:"none",async:"sync"}),GBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to update."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),readOnly:Q.boolean().describe("True to restrict to read-only tools; false to allow all enabled tools.")}),TBA=Q.object({connector:Ie}),yB=S({operationId:"mcpConnectors.setReadOnly",description:"Toggle the read-only restriction on an MCP connector.",backend:"api",route:{method:"PATCH",path:"/mcp-connectors/{connectionId}/read-only",tags:["MCP Connectors"]},input:GBA,output:TBA,pagination:"none",async:"sync"}),JBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to install into. Auto-filled from SDK context when omitted."),providerId:Q.string().min(1).describe('Provider ID to install, e.g. "linear".'),requestedScopes:Q.array(Q.string()).optional().describe("Scopes to request. Defaults to the provider's recommended scope set."),serverUrl:Q.string().url().optional().describe("Server URL for multi-region providers; defaults to the provider's primary server."),readOnly:Q.boolean().optional().describe("Restrict the connector to read-only tools after install. Defaults to false."),returnTo:Q.string().optional().describe("Path to redirect the user to after OAuth completes.")}),PBA=Q.object({authorizationUrl:Q.string().describe("Authorization URL to open in the user's browser."),connectionId:Q.string().uuid().describe("Connection ID to poll for completion via getMcpOAuthInstallAttempt."),expiresAt:Q.string().datetime().describe("When the OAuth authorization attempt expires.")}),wB=S({operationId:"mcpConnectors.beginOAuthInstall",description:"Begin an OAuth browser flow to install a preset MCP connector. Opens an authorization URL in the user's browser; poll getMcpOAuthInstallAttempt with the returned connectionId to check completion.",backend:"api",route:{method:"POST",path:"/mcp-connectors/oauth/begin",tags:["MCP Connectors"],successStatus:201},input:JBA,output:PBA,pagination:"none",async:"sync"}),fBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID returned by beginMcpOAuthInstall."),projectId:Q.string().uuid().optional().describe("Project the connection belongs to. Auto-filled from SDK context when omitted.")}),RBA=Q.object({status:Q.enum(["authorizing","connected","error"]).describe("Current install status."),connector:Ie.optional().describe("Connector details once connected or in error state.")}),DB=S({operationId:"mcpConnectors.getOAuthInstallAttempt",description:"Poll the status of an in-progress OAuth MCP connector install. Returns authorizing while the user completes the browser flow, connected on success, or error on failure.",backend:"api",route:{method:"GET",path:"/mcp-connectors/oauth/attempts/{connectionId}",tags:["MCP Connectors"]},input:fBA,output:RBA,pagination:"none",async:"sync"}),I8A={list:QB.contract,get:IB.contract,details:hB.contract,listProviders:Mb.contract,search:BB.contract,describe:cB.contract,call:CB.contract,create:EB.contract,update:aB.contract,disconnect:rB.contract,setReadOnly:yB.contract,beginOAuthInstall:wB.contract,getOAuthInstallAttempt:DB.contract}});var he,h8A,B8A,c8A,C8A,E8A,a8A,r8A,vf,cRt;var Yb=r(()=>{JA();KA();he=Q.enum(["admin","member"]),h8A=Q.object({id:Q.string().min(1),name:Q.string(),slug:Q.string(),logo:Q.string().nullable().optional(),role:he}),B8A=Q.object({id:Q.string().min(1),name:Q.string().nullable(),email:Q.string().email()}),c8A=Q.object({credentialType:Q.literal("user"),user:B8A,activeOrganizationId:Q.string().min(1).nullable(),organizations:Q.array(h8A).describe("Organizations the user belongs to, including membership role.")}),C8A=Q.object({credentialType:Q.literal("secret"),organization:Q.object({id:Q.string().min(1),name:Q.string(),slug:Q.string(),logo:Q.string().nullable().optional()}),keyName:Q.string()}),E8A=Q.object({credentialType:Q.literal("partner"),superorganization:Q.object({id:Q.string().uuid(),name:Q.string()})}),a8A=Q.object({}),r8A=Q.discriminatedUnion("credentialType",[c8A,C8A,E8A]),vf=S({operationId:"me.get",description:"Return the identity and available context for the current credential.",backend:"api",route:{method:"GET",path:"/me",tags:["Auth"]},input:a8A,output:r8A,pagination:"none",async:"sync"}),cRt=vf.contract});var OBA,vBA,zBA,y8A,w8A,D8A,u8A,b8A,l8A,zf,mf,Wf,N8A,U8A,S8A,L8A,F8A,M8A,Zf,Vf,Hf,yRt;var mBA=r(()=>{JA();KA();Yb();OBA=Q.object({membershipId:Q.string().min(1).describe("Organization membership record ID."),userId:Q.string().min(1).describe("User ID for the organization member."),name:Q.string().nullable().describe("Display name for the member, when available."),email:Q.string().email().describe("Email address for the member."),imageUrl:Q.string().nullable().describe("Profile image URL for the member, when available."),role:he.describe("Organization role."),createdAt:Q.string().datetime().describe("When the membership was created.")}),vBA=Q.object({id:Q.string().min(1).describe("Invitation ID."),email:Q.string().email().describe("Invited email address."),role:he.describe("Role the invitee will receive when they accept."),status:Q.string().min(1).describe('Invitation status (e.g. "pending").'),createdAt:Q.string().datetime().describe("When the invitation was created."),expiresAt:Q.string().datetime().describe("When the invitation expires.")}),zBA=Q.string().min(1).describe("A user ID, or a URL-encoded email address, of the member."),y8A=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to list members for. Auto-filled from CLI and SDK context when omitted.")}),w8A=Q.object({members:Q.array(OBA).describe("Members visible within the selected organization.")}),D8A=Q.object({organizationId:Q.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted."),member:zBA.describe("User ID, or URL-encoded email address, of the member to update."),role:he.describe("Role to assign.")}),u8A=Q.object({member:OBA.describe("Updated organization member.")}),b8A=Q.object({params:Q.object({member:zBA.describe("User ID, or URL-encoded email address, of the member to remove.")}),query:Q.object({organizationId:Q.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted.")})}).transform(({params:A,query:t})=>({...t,...A})),l8A=Q.object({removedUserId:Q.string().min(1).describe("User ID removed from the organization.")}),zf=S({operationId:"members.list",description:"List members in an organization.",backend:"api",route:{method:"GET",path:"/members",tags:["Members"]},input:y8A,output:w8A,pagination:"none",async:"sync",examples:[{name:"organization-members",input:{organizationId:"organization-123"},output:{members:[{membershipId:"membership-123",userId:"user-123",name:"Alex Admin",email:"alex@example.com",imageUrl:null,role:"admin",createdAt:"2026-01-01T00:00:00.000Z"}]}}]}),mf=S({operationId:"members.updateRole",description:"Update a member's organization role.",backend:"api",route:{method:"PATCH",path:"/members/{member}/role",tags:["Members"]},input:D8A,output:u8A,pagination:"none",async:"sync",examples:[{name:"promote-member",input:{organizationId:"organization-123",member:"user-456",role:"admin"},output:{member:{membershipId:"membership-456",userId:"user-456",name:"Mina Member",email:"mina@example.com",imageUrl:null,role:"admin",createdAt:"2026-01-01T00:00:00.000Z"}}}]}),Wf=S({operationId:"members.remove",description:"Remove a member from an organization.",backend:"api",route:{method:"DELETE",path:"/members/{member}",tags:["Members"],inputStructure:"detailed"},input:b8A,output:l8A,pagination:"none",async:"sync"}),N8A=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to invite into. Auto-filled from CLI and SDK context when omitted."),email:Q.string().email().describe("Email address to invite."),role:he.optional().default("member").describe('Role to grant on acceptance. Defaults to "member".')}),U8A=Q.object({invitation:vBA.describe("The created pending invitation.")}),S8A=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to list invitations for. Auto-filled from CLI and SDK context when omitted.")}),L8A=Q.object({invitations:Q.array(vBA).describe("Pending invitations visible within the selected organization.")}),F8A=Q.object({params:Q.object({invitationId:Q.string().min(1).describe("ID of the invitation to revoke.")}),query:Q.object({organizationId:Q.string().min(1).optional().describe("Organization containing the invitation. Auto-filled from CLI and SDK context when omitted.")})}).transform(({params:A,query:t})=>({...t,...A})),M8A=Q.object({revokedInvitationId:Q.string().min(1).describe("ID of the revoked invitation.")}),Zf=S({operationId:"members.invite",description:"Invite a person to the organization by email.",backend:"api",route:{method:"POST",path:"/members/invitations",tags:["Members"],successStatus:201},input:N8A,output:U8A,pagination:"none",async:"sync",examples:[{name:"invite-member",input:{organizationId:"organization-123",email:"newhire@example.com",role:"member"},output:{invitation:{id:"invitation-123",email:"newhire@example.com",role:"member",status:"pending",createdAt:"2026-01-01T00:00:00.000Z",expiresAt:"2026-01-08T00:00:00.000Z"}}}]}),Vf=S({operationId:"members.listInvitations",description:"List pending invitations for an organization.",backend:"api",route:{method:"GET",path:"/members/invitations",tags:["Members"]},input:S8A,output:L8A,pagination:"none",async:"sync",examples:[{name:"organization-invitations",input:{organizationId:"organization-123"},output:{invitations:[{id:"invitation-123",email:"newhire@example.com",role:"member",status:"pending",createdAt:"2026-01-01T00:00:00.000Z",expiresAt:"2026-01-08T00:00:00.000Z"}]}}]}),Hf=S({operationId:"members.revokeInvitation",description:"Revoke a pending invitation.",backend:"api",route:{method:"DELETE",path:"/members/invitations/{invitationId}",tags:["Members"],inputStructure:"detailed"},input:F8A,output:M8A,pagination:"none",async:"sync"}),yRt={list:zf.contract,updateRole:mf.contract,remove:Wf.contract,invite:Zf.contract,listInvitations:Vf.contract,revokeInvitation:Hf.contract}});var ZBA,VBA,kb,HBA,$b,WBA=4194304,Xf,jf,Y8A=(A)=>{let t=A.split(",").map((i)=>i.trim()).filter(Boolean),g=Q.array(kb).safeParse(t);if(!g.success)throw Error("Kind filter must be a comma-separated list of note, runbook, or change.");return g.data},dE,Kf,_f,XBA,jBA,KBA,_BA,xBA,sBA,qBA,dBA,pBA,AcA,tcA,gcA,uB,bB,lB,NB,UB,k8A;var xf=r(()=>{JA();KA();ZBA=["note","runbook"],VBA=["note","runbook","change"],kb=Q.enum(VBA),HBA=Q.enum(ZBA),$b=Q.string().min(1).max(512).refine((A)=>!A.startsWith("/"),{message:"Path must be relative without a leading slash."}).describe("Relative memory path, for example AGENTS.md or notes/architecture.md."),Xf=Q.string().min(1).refine((A)=>new TextEncoder().encode(A).length<=WBA,{message:`Memory body must be at most ${WBA} bytes (4 MiB).`}).describe("Document body stored in project memory."),jf=Q.string().regex(/^(\d+)(s|m|h|d)$/u,"Duration must use s, m, h, or d units, for example 7d or 30m.").describe("Relative time window, for example 7d or 30m."),dE=Q.string().min(1).transform(Y8A).describe("Comma-separated kinds, for example note,runbook."),Kf=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),kind:kb,managed:Q.boolean(),path:Q.string().nullable(),title:Q.string().nullable(),contentHash:Q.string(),attrs:Q.record(Q.string(),Q.unknown()),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),_f=Kf.extend({body:Xf}),XBA=Q.object({projectId:Q.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),path:$b.describe("Relative path for the curated document."),body:Xf,kind:HBA.default("note").describe("Curated document kind. Only note and runbook may be written through the API."),title:Q.string().max(500).optional().describe("Optional display title. Defaults to the path basename.")}),jBA=Q.object({document:_f}),KBA=Q.object({projectId:Q.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),id:Q.string().uuid().optional().describe("Document id."),path:$b.optional().describe("Relative curated path.")}).superRefine((A,t)=>{let g=A.id!==void 0,i=A.path!==void 0;if(g===i)t.addIssue({code:"custom",message:"Provide exactly one of id or path."})}),_BA=Q.object({document:_f}),xBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list memory for. Auto-filled from CLI and SDK context when omitted."),kind:dE.optional(),since:jf.optional().describe("Only return documents updated within this window, for example 7d."),service:Q.string().min(1).optional().describe("Filter to documents whose attrs.services contains this value."),pathPrefix:Q.string().min(1).optional().describe("Filter to paths starting with this prefix."),managed:Q.coerce.boolean().optional(),cursor:Q.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of documents to return per page.")}),sBA=Q.object({documents:Q.array(Kf),nextCursor:Q.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),qBA=Q.object({documentId:Q.string().uuid(),kind:kb,managed:Q.boolean(),path:Q.string().nullable(),title:Q.string().nullable(),snippet:Q.string(),score:Q.number()}),dBA=Q.object({calibrated:Q.literal(!0),minScoreThreshold:Q.number(),queryTerms:Q.array(Q.string()),message:Q.string()}),pBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to search memory for. Auto-filled from CLI and SDK context when omitted."),query:Q.string().trim().min(1).max(500).describe("Natural-language search query."),kind:dE.optional(),since:jf.optional(),service:Q.string().min(1).optional(),pathPrefix:Q.string().min(1).optional(),managed:Q.coerce.boolean().optional(),limit:Q.coerce.number().int().min(1).max(50).default(10).describe("Maximum ranked search hits to return.")}),AcA=Q.object({hits:Q.array(qBA),emptyVerdict:dBA.nullable()}),tcA=Q.object({projectId:Q.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),id:Q.string().uuid().optional().describe("Document id."),path:$b.optional()}).superRefine((A,t)=>{let g=A.id!==void 0,i=A.path!==void 0;if(g===i)t.addIssue({code:"custom",message:"Provide exactly one of id or path."})}),gcA=Q.object({deleted:Q.boolean()}),uB=S({operationId:"memory.put",description:"Create or replace a curated project memory document. Embeds on success.",backend:"api",route:{method:"PUT",path:"/memory",tags:["Memory"]},input:XBA,output:jBA,pagination:"none",async:"sync"}),bB=S({operationId:"memory.get",description:"Get one project memory document by id or path.",backend:"api",route:{method:"GET",path:"/memory/document",tags:["Memory"]},input:KBA,output:_BA,pagination:"none",async:"sync"}),lB=S({operationId:"memory.list",description:"List project memory catalog rows without embedding search.",backend:"api",route:{method:"GET",path:"/memory",tags:["Memory"]},input:xBA,output:sBA,pagination:"cursor",async:"sync"}),NB=S({operationId:"memory.search",description:"Hybrid semantic and keyword search over project memory documents.",backend:"api",route:{method:"POST",path:"/memory/search",tags:["Memory"]},input:pBA,output:AcA,pagination:"none",async:"sync"}),UB=S({operationId:"memory.delete",description:"Soft-delete a curated project memory document by id or path.",backend:"api",route:{method:"DELETE",path:"/memory/document",successStatus:204,tags:["Memory"]},input:tcA,output:gcA,pagination:"none",async:"sync"}),k8A={put:uB.contract,get:bB.contract,list:lB.contract,search:NB.contract,delete:UB.contract}});var ncA,icA,$8A,G8A,T8A,J8A,P8A,pE,f8A,R8A,O8A,sf,qf,df,pf,URt;var Gb=r(()=>{JA();KA();ncA=Q.enum(["processing","completed","aborted","error"]),icA=Q.object({id:Q.string().uuid(),threadId:Q.string().uuid(),userMessageId:Q.string().uuid().nullable(),assistantMessageId:Q.string().uuid().nullable(),parentRunId:Q.string().uuid().nullable(),workflowRunId:Q.string().nullable(),status:ncA,source:Q.enum(["app","api","mcp","slack","teams","linear","github","agent","cli","web","sdk","bitbucket","system"]),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime(),completedAt:Q.string().datetime().nullable()}),$8A=Q.object({projectId:Q.string().uuid().optional().describe("Project ID to list runs for. Auto-filled from CLI and SDK context when omitted."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:Q.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),G8A=Q.object({runs:Q.array(icA),nextCursor:Q.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),T8A=Q.object({threadId:Q.string().uuid().describe("Thread ID to list runs for."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:Q.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),J8A=Q.object({runs:Q.array(icA),nextCursor:Q.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),P8A=Q.object({runId:Q.string().uuid().describe("Run ID returned by a deferred operation.")}),pE=Q.object({completed:Q.boolean().describe("Whether the run has reached a terminal status."),threadId:Q.string().uuid().describe("Thread ID associated with the run."),runId:Q.string().uuid().describe("Run ID for subsequent polling."),messageId:Q.string().uuid().optional().describe("ID of the user message that triggered this run."),status:ncA.describe("Current run lifecycle status."),response:Q.string().nullable().describe("Assistant response text when the run has completed.")}),f8A=pE.describe("Current run state and, when complete, the assistant response."),R8A=Q.object({runId:Q.string().uuid().describe("Run ID of the in-flight run to request cancellation for.")}),O8A=Q.object({success:Q.literal(!0).describe("Always true when the cancellation request was accepted.")}),sf=S({operationId:"runs.list",description:"List deferred runs within one project.",backend:"api",route:{method:"GET",path:"/runs",tags:["Runs"]},input:$8A,output:G8A,pagination:"cursor",async:"sync"}),qf=S({operationId:"runs.listForThread",summary:"List Runs for a Thread",description:"List deferred runs for one thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/runs",tags:["Runs"]},input:T8A,output:J8A,pagination:"cursor",async:"sync"}),df=S({operationId:"runs.get",description:"Get the current result for a deferred run by run ID.",backend:"api",route:{method:"GET",path:"/runs/{runId}",tags:["Runs"]},input:P8A,output:f8A,pagination:"none",async:"sync",examples:[{name:"processing-run",input:{runId:"33333333-3333-4333-8333-333333333333"},output:{completed:!1,threadId:"22222222-2222-4222-8222-222222222222",runId:"33333333-3333-4333-8333-333333333333",status:"processing",response:null}}]}),pf=S({operationId:"runs.cancel",description:"Request cancellation of an in-flight run. Idempotent and best-effort: returns success even when the run has already reached a terminal status.",backend:"api",route:{method:"POST",path:"/runs/{runId}/cancel",tags:["Runs"]},input:R8A,output:O8A,pagination:"none",async:"sync",examples:[{name:"cancel-processing-run",input:{runId:"33333333-3333-4333-8333-333333333333"},output:{success:!0}}]}),URt={list:sf.contract,listForThread:qf.contract,get:df.contract,cancel:pf.contract}});var Tb=(A,t,g)=>{let i=t?20000:1e4;if(A.length>i)g.addIssue({code:"too_big",maximum:i,type:"string",inclusive:!0,message:`Message cannot exceed ${i} characters`,origin:"string",path:["message"]})},Jb=(A,t,g)=>{if(A&&!t)g.addIssue({code:"custom",message:"ambientServiceRun requires an automationId",path:["ambientServiceRun"]})};var ocA,Aa,v8A,z8A,m8A,W8A,Z8A,V8A,H8A,X8A,j8A,AR,K8A,_8A,x8A,s8A,q8A,d8A,p8A,A5A,t5A,g5A,n5A,i5A,tR,gR,nR,iR,oR,eR,ecA,o5A,e5A,Q5A,I5A,QcA,h5A,B5A,c5A,C5A,E5A,a5A,TQ="22222222-2222-4222-8222-222222222222",IcA="11111111-1111-4111-8111-111111111111",r5A="44444444-4444-4444-8444-444444444444",hcA="55555555-5555-4555-8555-555555555555",QR,IR,hR,BR,cR,$Rt;var CR=r(()=>{JA();KA();Gb();ocA=Q.enum(["slack","teams","linear","github","app","mcp","agent","api","cli","web","sdk","bitbucket","system"]),Aa=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),title:Q.string().nullable(),status:Q.enum(["regular","archived"]),source:ocA.nullable(),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),v8A=Q.object({type:Q.literal("message"),message:Q.string()}),z8A=Q.object({type:Q.literal("reasoning"),reasoning:Q.string(),status:Q.enum(["in_progress","complete"]).optional()}),m8A=Q.object({type:Q.literal("tool_call"),name:Q.string(),params:Q.any().optional(),result:Q.any().optional(),status:Q.enum(["in_progress","success","error","unknown"]).optional(),toolCallId:Q.string().optional(),durationMs:Q.number().nonnegative().optional()}),W8A=Q.object({type:Q.literal("artifact"),name:Q.enum(["timeseries","table","log_detail","integration_required","alert_card","issue_card","mdx"]),data:Q.any(),toolCallId:Q.string().optional()}),Z8A=Q.object({type:Q.literal("fork"),sourceThreadId:Q.string(),sourceMessageId:Q.string(),sourceThreadTitle:Q.string().nullable()}),V8A=Q.object({type:Q.literal("summary"),summary:Q.string()}),H8A=Q.object({type:Q.literal("slack_context"),channelId:Q.string(),isTruncated:Q.boolean().optional(),messages:Q.array(Q.object({timestamp:Q.string(),slackUserId:Q.string().optional(),displayName:Q.string(),text:Q.string(),isBot:Q.boolean(),files:Q.array(Q.object({name:Q.string(),mimetype:Q.string(),size:Q.number().optional(),attachmentId:Q.string().uuid().optional(),ingestionStatus:Q.enum(["attached","unsupported","oversized","skipped","unavailable"]).optional()})).optional()}))}),X8A=Q.object({type:Q.literal("teams_context"),conversationId:Q.string(),isTruncated:Q.boolean().optional(),messages:Q.array(Q.object({activityId:Q.string().optional(),displayName:Q.string(),text:Q.string(),isBot:Q.boolean(),createdDateTime:Q.string().optional()}))}),j8A=Q.union([v8A,z8A,m8A,W8A,Z8A,V8A,H8A,X8A]),AR=Q.object({id:Q.string().uuid(),role:Q.enum(["user","assistant"]),content:Q.array(j8A),source:ocA,createdAt:Q.string().datetime()}),K8A=Q.object({projectId:Q.string().uuid().optional().describe("Project to list threads for. Auto-filled from CLI and SDK context when omitted."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of threads to return per page."),cursor:Q.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:Q.enum(["regular","archived"]).optional().describe("Filter by thread status. 'regular' returns active threads, 'archived' returns archived threads.")}),_8A=Q.object({threads:Q.array(Aa).describe("The page of threads matching the query."),nextCursor:Q.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),x8A=Q.object({threadId:Q.string().uuid().describe("Thread ID returned by threads.list or threads.create.")}),s8A=Q.object({thread:Aa.describe("The requested thread."),messages:Q.array(AR).describe("Messages currently stored on the thread in chronological order.")}),q8A=Q.object({projectId:Q.string().uuid().optional().describe("Project to create the thread in. Auto-filled from CLI and SDK context when omitted."),message:Q.string().min(1,"Message cannot be empty").describe("Initial user message that starts the thread."),wait:Q.boolean().default(!0).describe("Whether the server should wait for the agent run before responding."),timeoutSeconds:Q.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:Q.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:Q.literal(!0).optional().describe("Internal marker for scheduler-originated ambient service work. Honored only for system secret-key requests with matching automation context.")}).superRefine((A,t)=>{Tb(A.message,A.automationId,t),Jb(A.ambientServiceRun,A.automationId,t)}),d8A=pE.describe("Deferred run result for creating a thread."),p8A=Q.object({threadId:Q.string().uuid().describe("Thread ID whose current processing status should be returned.")}),A5A=Q.object({status:Q.enum(["idle","processing"]),lastRunStatus:Q.enum(["error"]).nullable()}),t5A=Q.object({threadId:Q.string().uuid().describe("Thread ID whose active run should be stopped.")}),g5A=Q.object({success:Q.literal(!0).describe("Always true when the stop request was accepted.")}),n5A=Q.object({threadId:Q.string().uuid().describe("Thread ID of the thread to update."),status:Q.enum(["regular","archived"]).describe("New status for the thread. 'archived' hides the thread from the sidebar.")}),i5A=Q.object({thread:Aa.describe("The updated thread.")}),tR=S({operationId:"threads.list",description:"List threads in a project, optionally filtered by status.",backend:"api",route:{method:"GET",path:"/threads",tags:["Threads"]},input:K8A,output:_8A,pagination:"cursor",async:"sync",examples:[{name:"active-threads",input:{projectId:"11111111-1111-4111-8111-111111111111",status:"regular",limit:10},output:{threads:[{id:"22222222-2222-4222-8222-222222222222",projectId:"11111111-1111-4111-8111-111111111111",title:"API returning 500s",status:"regular",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:05:00.000Z"}],nextCursor:null}}]}),gR=S({operationId:"threads.get",description:"Get a thread and its messages.",backend:"api",route:{method:"GET",path:"/threads/{threadId}",tags:["Threads"]},input:x8A,output:s8A,pagination:"none",async:"sync"}),nR=S({operationId:"threads.getStatus",description:"Get the current processing status for a thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/status",tags:["Threads"]},input:p8A,output:A5A,pagination:"none",async:"sync",examples:[{name:"processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{status:"processing",lastRunStatus:null}}]}),iR=S({operationId:"threads.stop",description:"Stop a thread's in-flight run. Idempotent and best-effort: returns success even when the thread has no active run.",backend:"api",route:{method:"POST",path:"/threads/{threadId}/stop",tags:["Threads"]},input:t5A,output:g5A,pagination:"none",async:"sync",examples:[{name:"stop-processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{success:!0}}]}),oR=S({operationId:"threads.create",description:"Create a thread with an initial message and optionally wait for the agent response.",backend:"api",route:{method:"POST",path:"/threads",tags:["Threads"],successStatus:201},input:q8A,output:d8A,pagination:"none",async:"deferred",examples:[{name:"async-handoff",input:{projectId:"11111111-1111-4111-8111-111111111111",message:"Investigate elevated 500s in production.",wait:!1,timeoutSeconds:20},output:{completed:!1,threadId:"22222222-2222-4222-8222-222222222222",runId:"33333333-3333-4333-8333-333333333333",status:"processing",response:null}}]}),eR=S({operationId:"threads.update",description:"Update a thread's status.",backend:"api",route:{method:"PATCH",path:"/threads/{threadId}",tags:["Threads"]},input:n5A,output:i5A,pagination:"none",async:"sync",examples:[{name:"archive-thread",input:{threadId:"22222222-2222-4222-8222-222222222222",status:"archived"},output:{thread:{id:"22222222-2222-4222-8222-222222222222",projectId:"11111111-1111-4111-8111-111111111111",title:"API returning 500s",status:"archived",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:10:00.000Z"}}}]}),ecA=Q.enum(["private","organization"]),o5A=Q.object({threadId:Q.string().uuid().describe("Thread ID of the source thread to fork."),messageId:Q.string().uuid().describe("Message ID in the source thread to fork from. The new thread copies messages up to and including this message.")}),e5A=Q.object({thread:Aa.describe("The newly created forked thread.")}),Q5A=Q.object({threadId:Q.string().uuid().describe("Thread ID of the thread to update."),visibility:ecA.describe("New visibility. 'private' restricts the thread to its owner; 'organization' shares it with the organization.")}),I5A=Q.object({thread:Aa.describe("The updated thread."),visibility:ecA.describe("The thread's resulting visibility.")}),QcA=Q.object({shareId:Q.string().uuid().describe("Unique identifier for the snapshot."),threadId:Q.string().uuid().describe("Thread the snapshot was taken from."),url:Q.string().describe("Public read-only URL for the snapshot."),createdAt:Q.string().datetime()}),h5A=Q.object({threadId:Q.string().uuid().describe("Thread ID to create a public read-only snapshot for.")}),B5A=Q.object({share:QcA.describe("The created share link.")}),c5A=Q.object({threadId:Q.string().uuid().describe("Thread ID the snapshot belongs to."),shareId:Q.string().uuid().describe("Snapshot ID to revoke.")}),C5A=Q.void(),E5A=Q.object({threadId:Q.string().uuid().describe("Thread ID to list public snapshots for.")}),a5A=Q.object({shares:Q.array(QcA).describe("Active share links for the thread.")}),QR=S({operationId:"threads.fork",description:"Fork a thread from a specific message, creating a new thread that copies messages up to that point.",backend:"api",route:{method:"POST",path:"/threads/{threadId}/fork",tags:["Threads"],successStatus:201},input:o5A,output:e5A,pagination:"none",async:"sync",examples:[{name:"fork-from-message",input:{threadId:TQ,messageId:r5A},output:{thread:{id:"66666666-6666-4666-8666-666666666666",projectId:IcA,title:"API returning 500s (fork)",status:"regular",source:"api",createdAt:"2026-01-01T00:20:00.000Z",updatedAt:"2026-01-01T00:20:00.000Z"}}}]}),IR=S({operationId:"threads.setVisibility",description:"Set a thread's visibility to private or organization.",backend:"api",route:{method:"PATCH",path:"/threads/{threadId}/visibility",tags:["Threads"]},input:Q5A,output:I5A,pagination:"none",async:"sync",examples:[{name:"make-private",input:{threadId:TQ,visibility:"private"},output:{thread:{id:TQ,projectId:IcA,title:"API returning 500s",status:"regular",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:30:00.000Z"},visibility:"private"}}]}),hR=S({operationId:"threads.createShareLink",description:"Create a public read-only share link for a thread's current messages.",backend:"api",route:{method:"POST",path:"/threads/{threadId}/share",tags:["Threads"],successStatus:201},input:h5A,output:B5A,pagination:"none",async:"sync",examples:[{name:"create-share-link",input:{threadId:TQ},output:{share:{shareId:hcA,threadId:TQ,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}}}]}),BR=S({operationId:"threads.listShareLinks",description:"List active public share links for a thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/share",tags:["Threads"]},input:E5A,output:a5A,pagination:"none",async:"sync",examples:[{name:"list-share-links",input:{threadId:TQ},output:{shares:[{shareId:hcA,threadId:TQ,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}]}}]}),cR=S({operationId:"threads.revokeShareLink",description:"Revoke a public share link for a thread.",backend:"api",route:{method:"DELETE",path:"/threads/{threadId}/share/{shareId}",successStatus:204,tags:["Threads"]},input:c5A,output:C5A,pagination:"none",async:"sync"}),$Rt={list:tR.contract,get:gR.contract,getStatus:nR.contract,stop:iR.contract,create:oR.contract,update:eR.contract,fork:QR.contract,setVisibility:IR.contract,createShareLink:hR.contract,listShareLinks:BR.contract,revokeShareLink:cR.contract}});var y5A,w5A,D5A,u5A,BcA,ccA;var CcA=r(()=>{JA();KA();Gb();CR();y5A=Q.object({threadId:Q.string().uuid().describe("Thread ID to list messages for."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of messages to return per page."),cursor:Q.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),w5A=Q.object({messages:Q.array(AR),nextCursor:Q.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),D5A=Q.object({threadId:Q.string().uuid().describe("Thread ID to append the message to."),message:Q.string().min(1,"Message cannot be empty").describe("Message body to append to the thread."),wait:Q.boolean().default(!0).describe("Whether the server should wait for the appended message run before responding."),timeoutSeconds:Q.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:Q.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:Q.literal(!0).optional().describe("Internal marker for scheduler-originated ambient service work. Honored only for system secret-key requests with matching automation context.")}).superRefine((A,t)=>{Tb(A.message,A.automationId,t),Jb(A.ambientServiceRun,A.automationId,t)}),u5A=pE.describe("Deferred run result for appending a message to an existing thread."),BcA=S({operationId:"messages.list",description:"List messages in a thread with cursor pagination.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/messages",tags:["Messages"]},input:y5A,output:w5A,pagination:"cursor",async:"sync",examples:[{name:"thread-messages",input:{threadId:"22222222-2222-4222-8222-222222222222",limit:2},output:{messages:[{id:"33333333-3333-4333-8333-333333333333",role:"user",content:[{type:"message",message:"What changed in the intake pipeline?"}],source:"api",createdAt:"2026-01-01T00:00:00.000Z"}],nextCursor:null}}]}),ccA=S({operationId:"messages.append",description:"Append a user message to an existing thread and trigger a deferred run.",backend:"api",route:{method:"POST",path:"/threads/{threadId}/messages",successStatus:201,tags:["Messages"]},input:D5A,output:u5A,pagination:"none",async:"deferred",examples:[{name:"append-processing",input:{threadId:"22222222-2222-4222-8222-222222222222",message:"Follow up on the intake backlog.",wait:!1,timeoutSeconds:20},output:{completed:!1,threadId:"22222222-2222-4222-8222-222222222222",runId:"33333333-3333-4333-8333-333333333333",status:"processing",response:null}}]})});var en,acA,ER,SB,aR,Pb,Be,rcA,EcA;var ta=r(()=>{JA();en={IN_APP:"in_app",SLACK:"slack",SLACK_CHANNEL:"slack_channel",MICROSOFT_TEAMS_CHANNEL:"teams_channel",EMAIL:"email",SMS:"sms",INCIDENT_IO:"incident_io",PAGERDUTY:"pagerduty",ROOTLY:"rootly",WEBHOOK:"webhook"},acA=[en.IN_APP,en.SLACK,en.EMAIL,en.SMS],ER=[en.SLACK_CHANNEL,en.MICROSOFT_TEAMS_CHANNEL,en.INCIDENT_IO,en.PAGERDUTY,en.ROOTLY,en.WEBHOOK],SB=Object.values(en),aR=[...SB,"victorops"],Pb=Q.enum(SB),Be=Q.enum(ER),rcA=[{channel:"in_app",name:"In-app",description:"Show notifications in your Sazabi notification feed.",scope:"personal",destinationManagement:"none",personalSettingsPath:"/settings/notifications"},{channel:"email",name:"Email",description:"Send notifications to your account email address.",scope:"personal",destinationManagement:"none",personalSettingsPath:"/settings/notifications"},{channel:"sms",name:"SMS",description:"Send notifications to your verified phone number.",scope:"personal",destinationManagement:"none",personalSettingsPath:"/settings/account?phone-number=add"},{channel:"slack",name:"Slack DMs",description:"Send personal notifications by Slack DM.",scope:"personal",destinationManagement:"none",personalSettingsPath:"/settings/connected-accounts/slack"},{channel:"slack_channel",name:"Slack",description:"Post this project's alerts to selected Slack channels.",scope:"project",destinationManagement:"slack_channels",projectIntegrationPath:"slack"},{channel:"teams_channel",name:"Microsoft Teams",description:"Post this project's alerts to selected Microsoft Teams channels.",scope:"project",destinationManagement:"teams_channels",projectIntegrationPath:"teams"},{channel:"incident_io",name:"incident.io",description:"Route this project's alerts to incident.io.",scope:"project",destinationManagement:"integration_connections",projectIntegrationPath:"incident-io"},{channel:"pagerduty",name:"PagerDuty",description:"Route this project's alerts to PagerDuty.",scope:"project",destinationManagement:"integration_connections",projectIntegrationPath:"pagerduty"},{channel:"rootly",name:"Rootly",description:"Route this project's alerts to Rootly.",scope:"project",destinationManagement:"integration_connections",projectIntegrationPath:"rootly"},{channel:"webhook",name:"Webhooks",description:"Send this project's alerts to configured HTTPS endpoints.",scope:"project",destinationManagement:"webhook_endpoints",projectSettingsPath:"webhooks"}],EcA=new Set(rcA.map(({channel:A})=>A));if(EcA.size!==SB.length||SB.some((A)=>!EcA.has(A)))throw Error("Notification channel definitions must represent every channel")});var ycA,b5A=(A,t)=>A.value===t.value&&A.label===t.label&&A.scope===t.scope&&A.role===t.role&&A.defaultOff===t.defaultOff&&(A.defaultOffChannels??[]).join(",")===(t.defaultOffChannels??[]).join(",")&&A.email?.template===t.email?.template&&A.email?.ctaLabel===t.email?.ctaLabel&&(A.deliveryConditions??[]).join(",")===(t.deliveryConditions??[]).join(","),Mg=(A)=>{for(let t of Object.values(A)){let g=ycA.get(t.value);if(g&&!b5A(g,t))throw Error(`Notification type registered twice with conflicting definitions: ${t.value}`);if(t.role!==void 0&&t.scope!=="org")throw Error(`Notification type role restrictions require org scope: ${t.value}`);if(t.label.trim().length===0)throw Error(`Notification type needs a display label: ${t.value}`);if(t.email&&t.email.ctaLabel.trim().length===0)throw Error(`Notification email presentation needs a CTA label: ${t.value}`);if(t.defaultOff&&t.defaultOffChannels)throw Error(`Notification type declares both defaultOff and defaultOffChannels: ${t.value}`);ycA.set(t.value,t)}return A};var pi=r(()=>{ycA=new Map});var wcA;var DcA=r(()=>{pi();wcA=Mg({AUTOMATION_FINISHED:{value:"automation_finished",label:"Automation completed",scope:"project",defaultOff:!0},AUTOMATION_RUN_FAILED:{value:"automation_run_failed",label:"Automation run failed",scope:"project"}})});var fb;var rR=r(()=>{pi();fb=Mg({BILLING_PLAN_UPGRADE_APPLIED:{value:"billing_plan_upgrade_applied",label:"Billing upgrade applied",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage billing"}},BILLING_PLAN_DOWNGRADE_SCHEDULED:{value:"billing_plan_downgrade_scheduled",label:"Billing downgrade scheduled",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage billing"}},BILLING_PLAN_DOWNGRADE_APPLIED:{value:"billing_plan_downgrade_applied",label:"Billing downgrade applied",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage billing"}},BILLING_CREDIT_BALANCE_LOW:{value:"billing_credit_balance_low",label:"Billing credits low",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage credits"}},BILLING_CREDIT_BALANCE_DEPLETED:{value:"billing_credit_balance_depleted",label:"Billing credits depleted",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage credits"}},BILLING_AUTO_TOP_UP_SETTINGS_CHANGED:{value:"billing_auto_top_up_settings_changed",label:"Billing auto top-up changed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage auto top-up"}},BILLING_AUTO_TOP_UP_FAILED:{value:"billing_auto_top_up_failed",label:"Billing auto top-up failed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage payment method"}},BILLING_INVOICE_PAID:{value:"billing_invoice_paid",label:"Billing invoice paid",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"View invoice"}},BILLING_INVOICE_PAYMENT_FAILED:{value:"billing_invoice_payment_failed",label:"Billing invoice payment failed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Update payment method"}},BILLING_SUBSCRIPTION_CANCELLATION_SCHEDULED:{value:"billing_subscription_cancellation_scheduled",label:"Billing cancellation scheduled",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage subscription"}},BILLING_SUBSCRIPTION_CANCELED:{value:"billing_subscription_canceled",label:"Billing subscription canceled",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"View billing"}},BILLING_PAYMENT_METHOD_EXPIRING:{value:"billing_payment_method_expiring",label:"Billing payment method expiring",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Update payment method"}},BILLING_PAYMENT_METHOD_CHANGED:{value:"billing_payment_method_changed",label:"Billing payment method changed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Review payment method"}},BILLING_NEGATIVE_BALANCE_COLLECTED:{value:"billing_negative_balance_collected",label:"Billing outstanding balance charged",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"View billing"}},BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED:{value:"billing_negative_balance_collection_failed",label:"Billing outstanding balance charge failed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage payment method"}}})});var ucA;var bcA=r(()=>{pi();ucA=Mg({INTEGRATION_CONNECTED:{value:"integration_connected",label:"Integration connected",scope:"org",defaultOff:!0},INTEGRATION_DISCONNECTED:{value:"integration_disconnected",label:"Integration disconnected",scope:"org"}})});var lcA;var NcA=r(()=>{pi();lcA=Mg({ISSUE_TRIGGERED:{value:"issue_triggered",label:"Issue triggered",scope:"project",deliveryConditions:["component","severity"]},ISSUE_RESOLVED:{value:"issue_resolved",label:"Issue resolved",scope:"project",defaultOffChannels:["email"],deliveryConditions:["component","severity"]},ISSUE_IGNORED:{value:"issue_ignored",label:"Issue ignored",scope:"project",defaultOffChannels:["email"],deliveryConditions:["component","severity"]}})});var UcA;var ScA=r(()=>{pi();UcA=Mg({PROJECT_CREATED:{value:"project_created",label:"Project created",scope:"org",defaultOff:!0},PROJECT_DELETED:{value:"project_deleted",label:"Project deleted",scope:"org",defaultOff:!0},MEMBER_INVITED:{value:"member_invited",label:"Member invited",scope:"org",defaultOff:!0},USER_REMOVED:{value:"user_removed",label:"Member removed",scope:"org",defaultOff:!0},MCP_CONNECTOR_ADDED:{value:"mcp_connector_added",label:"MCP connector added",scope:"org",defaultOff:!0},MCP_CONNECTOR_REMOVED:{value:"mcp_connector_removed",label:"MCP connector removed",scope:"org",defaultOff:!0},SECRET_KEY_CREATED:{value:"secret_key_created",label:"Secret key created",scope:"org",defaultOff:!0},SECRET_KEY_DELETED:{value:"secret_key_deleted",label:"Secret key deleted",scope:"org",defaultOff:!0}})});var LcA;var FcA=r(()=>{pi();LcA=Mg({SANDBOX_CREATED:{value:"sandbox_created",label:"Sandbox connected",scope:"project",defaultOff:!0},SANDBOX_DELETED:{value:"sandbox_deleted",label:"Sandbox disconnected",scope:"project",defaultOff:!0},LOG_SOURCE_CONNECTED:{value:"log_source_connected",label:"Log source connected",scope:"project",defaultOff:!0},LOG_SOURCE_DISCONNECTED:{value:"log_source_disconnected",label:"Log source disconnected",scope:"project"},GITHUB_CONNECTED:{value:"github_connected",label:"GitHub connected",scope:"project",defaultOff:!0},GITHUB_DISCONNECTED:{value:"github_disconnected",label:"GitHub disconnected",scope:"project"},CODE_REPO_CONNECTED:{value:"code_repo_connected",label:"Code repository connected",scope:"project",defaultOff:!0},CODE_REPO_DISCONNECTED:{value:"code_repo_disconnected",label:"Code repository disconnected",scope:"project"},PUBLIC_KEY_DEACTIVATED:{value:"public_key_deactivated",label:"Public key deactivated",scope:"project"}})});var McA;var YcA=r(()=>{pi();McA=Mg({SECURITY_ALERT:{value:"security_alert",label:"Security alert",scope:"org",role:"admin"}})});var yR,St,N5A,wR=(A)=>{let t=N5A.get(A)?.label;if(t)return t;let g=A.replace(/_/g," ").trim();return g?g.charAt(0).toUpperCase()+g.slice(1):A};var ga=r(()=>{DcA();rR();rR();bcA();NcA();ScA();FcA();YcA();pi();yR={...McA,...UcA,...ucA,...wcA,...lcA,...LcA,...fb},St=Object.fromEntries(Object.entries(yR).map(([A,t])=>[A,t.value])),N5A=new Map(Object.values(yR).map((A)=>[A.value,A]))});var Rb,$cA,COt,Fi,EOt;var JQ=r(()=>{ga();ta();ta();Rb=Object.values(St),$cA=[St.BILLING_PLAN_UPGRADE_APPLIED,St.BILLING_PLAN_DOWNGRADE_SCHEDULED,St.BILLING_PLAN_DOWNGRADE_APPLIED,St.BILLING_CREDIT_BALANCE_LOW,St.BILLING_CREDIT_BALANCE_DEPLETED,St.BILLING_AUTO_TOP_UP_SETTINGS_CHANGED,St.BILLING_AUTO_TOP_UP_FAILED,St.BILLING_INVOICE_PAID,St.BILLING_NEGATIVE_BALANCE_COLLECTED,St.BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED,St.BILLING_INVOICE_PAYMENT_FAILED,St.BILLING_SUBSCRIPTION_CANCELLATION_SCHEDULED,St.BILLING_SUBSCRIPTION_CANCELED,St.BILLING_PAYMENT_METHOD_EXPIRING,St.BILLING_PAYMENT_METHOD_CHANGED],COt=new Set($cA),Fi=[St.ISSUE_TRIGGERED,St.ISSUE_RESOLVED,St.ISSUE_IGNORED,St.AUTOMATION_RUN_FAILED],EOt=new Set(Fi)});var na,GcA,TcA=(A)=>typeof A==="string"&&(A in GcA)?GcA[A]:A,S5A;var JcA=r(()=>{ta();JA();JQ();na=Q.enum(Rb),GcA={data_source_connected:"log_source_connected",data_source_disconnected:"log_source_disconnected"},S5A=Q.preprocess(TcA,na)});var L5A;var PcA=r(()=>{ga();JQ();L5A=Fi.map((A)=>({notificationType:A,label:wR(A)}))});var fcA=r(()=>{ga();JQ()});var RcA=r(()=>{ta();ga();JQ();JcA();PcA();fcA()});var OcA=()=>{};var vcA=r(()=>{JQ()});var zcA=r(()=>{JQ()});var DR=r(()=>{OcA();vcA();zcA();RcA()});var k5A,$5A,G5A,T5A,J5A,P5A,f5A,uR,kvt;var mcA=r(()=>{DR();JA();KA();k5A=Q.enum(["ready","missing","degraded","unavailable"]),$5A=Q.object({id:Q.string(),label:Q.string(),status:Q.enum(["active","inactive","degraded"]),statusLabel:Q.string()}),G5A=Q.object({channel:Pb,name:Q.string(),description:Q.string(),scope:Q.enum(["personal","project"]),enabled:Q.boolean().nullable(),preferenceId:Q.string().nullable(),prerequisite:Q.object({status:k5A,statusLabel:Q.string(),message:Q.string()}),action:Q.object({label:Q.string(),href:Q.string()}).nullable(),destinations:Q.array($5A),destinationManagement:Q.enum(["none","slack_channels","teams_channels","integration_connections","webhook_endpoints"]),canCreateDestinations:Q.boolean(),supportedNotificationTypes:Q.array(na)}),T5A=Q.object({channel:Be,enabled:Q.boolean(),preferenceId:Q.string().nullable()}),J5A=Q.object({channel:Be,notificationType:na,enabled:Q.boolean(),preferenceId:Q.string()}),P5A=Q.object({projectId:Q.string().uuid().optional().describe("Project to inspect. Auto-filled from CLI and SDK context when omitted.")}),f5A=Q.object({channelCards:Q.array(G5A).length(10),channels:Q.array(T5A),notificationTypePreferences:Q.array(J5A),issueNotificationMinSeverity:Q.enum(["low","medium","high","critical"])}),uR=S({operationId:"notificationChannels.getProject",summary:"List Project Notification Channels",description:"List a project's notification channels with preferences, prerequisites, connection state, configured destinations, and supported notification types.",backend:"api",route:{method:"GET",path:"/notification-channels",tags:["Notification channels"]},input:P5A,output:f5A,pagination:"none",async:"sync"}),kvt={getProject:uR.contract}});var WcA,lR,ZcA,NR,Pvt,fvt,UR,SR=(A,t)=>{if((A.componentIds?.length||A.componentId)&&"componentIds"in A.condition&&A.condition.componentIds?.length)t.addIssue({code:"custom",path:["condition","componentIds"],message:"Use componentIds instead of legacy condition.componentIds."});if(A.componentIds?.length&&A.componentId)t.addIssue({code:"custom",path:["componentId"],message:"Use componentIds instead of componentId."})},Rvt,VcA,bR,LR,ia,HcA,R5A,O5A,v5A,z5A,m5A,W5A,Z5A,V5A,H5A,FR,MR,YR,kR,$R,Ovt;var XcA=r(()=>{DR();JA();KA();WcA=Q.enum(["low","medium","high","critical"]),lR=Q.object({severities:Q.array(WcA).min(1).optional()}).strict(),ZcA=Q.object({componentIds:Q.array(Q.string().uuid()).min(1).optional(),severities:Q.array(WcA).min(1).optional()}).strict(),NR=Q.object({channel:Be,destinationKey:Q.string().min(1)}),Pvt=Q.object({destinations:Q.array(NR).min(1),notificationTypes:Q.array(Q.enum(Fi)).min(1),componentIds:Q.array(Q.string().uuid()).min(1).optional().describe("Stable component registry IDs matched by this rule."),includeDescendants:Q.boolean().default(!1).describe("Whether the rule also matches descendant components."),condition:lR}),fvt=Q.object({destinations:Q.array(NR).min(1),notificationTypes:Q.array(Q.enum(Fi)).min(1),condition:ZcA}),UR=Q.object({destinations:Q.array(NR).min(1),notificationTypes:Q.array(Q.enum(Fi)).min(1),componentIds:Q.array(Q.string().uuid()).min(1).optional().describe("Stable component registry IDs matched by this rule."),componentId:Q.string().uuid().optional().describe("Deprecated single-component compatibility input."),includeDescendants:Q.boolean().default(!1).describe("Whether the rule also matches descendant components."),condition:Q.union([lR,ZcA])}),Rvt=UR.superRefine(SR),VcA=Q.object({id:Q.string(),channel:Be,destinationKey:Q.string(),displayName:Q.string()}),bR=Q.object({id:Q.string().uuid(),label:Q.string(),lifecycle:Q.enum(["active","retired","merged"])}),LR=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),notificationTypes:Q.array(Q.enum(Fi)),destinations:Q.array(VcA),condition:lR,component:bR.nullable(),componentId:Q.string().uuid().nullable(),includeDescendants:Q.boolean(),suspendedAt:Q.string().datetime().nullable(),suspensionReason:Q.string().nullable(),components:Q.array(bR),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),ia=Q.object({projectId:Q.string().uuid().optional().describe("Project whose notification delivery rules are being managed.")}),HcA=Q.string().uuid().describe("Logical notification delivery rule ID."),R5A=ia,O5A=Q.object({rules:Q.array(LR)}),v5A=Q.object({destinations:Q.array(VcA),notificationTypes:Q.array(Q.object({notificationType:Q.enum(Fi),label:Q.string(),conditions:Q.array(Q.enum(["component","severity"]))})),components:Q.array(bR)}),z5A=ia.extend(UR.shape).superRefine(SR),m5A=LR,W5A=ia.extend({...UR.shape,ruleId:HcA}).superRefine(SR),Z5A=LR,V5A=ia.extend({ruleId:HcA}),H5A=Q.object({removed:Q.boolean()}),FR=S({operationId:"notificationDeliveryRules.list",description:"List the positive delivery rules for a project.",backend:"api",route:{method:"GET",path:"/notification-delivery-rules",tags:["Notification delivery rules"]},input:R5A,output:O5A,pagination:"none",async:"sync"}),MR=S({operationId:"notificationDeliveryRules.options",description:"List available destinations, events, and conditions for project delivery rules.",backend:"api",route:{method:"GET",path:"/notification-delivery-rules/options",tags:["Notification delivery rules"]},input:ia,output:v5A,pagination:"none",async:"sync"}),YR=S({operationId:"notificationDeliveryRules.create",description:"Create a positive project notification delivery rule.",backend:"api",route:{method:"POST",path:"/notification-delivery-rules",tags:["Notification delivery rules"]},input:z5A,output:m5A,pagination:"none",async:"sync"}),kR=S({operationId:"notificationDeliveryRules.update",description:"Replace a positive delivery rule atomically.",backend:"api",route:{method:"PUT",path:"/notification-delivery-rules/{ruleId}",tags:["Notification delivery rules"]},input:W5A,output:Z5A,pagination:"none",async:"sync"}),$R=S({operationId:"notificationDeliveryRules.delete",description:"Delete a positive delivery rule without deleting its reusable destinations.",backend:"api",route:{method:"DELETE",path:"/notification-delivery-rules/{ruleId}",tags:["Notification delivery rules"]},input:V5A,output:H5A,pagination:"none",async:"sync"}),Ovt={list:FR.contract,options:MR.contract,create:YR.contract,update:kR.contract,delete:$R.contract}});var GR,X5A,j5A,K5A,_5A,x5A,s5A,TR,q5A,d5A,JR,p5A,AxA,PR,txA,gxA,fR,nxA,ixA,RR,Wvt;var jcA=r(()=>{JA();KA();GR=Q.enum(["verify-email","accept-invite","create-organization","billing","configure-project","connect-github-account","install-github-app","configure-code-search","install-slack-app","configure-slack-notifications","trigger-issue","confirm-issue","finish"]),X5A=Q.enum(["needs-onboarding","blocked","ready"]),j5A=Q.enum(["incomplete","complete","skipped"]),K5A=Q.object({invitationId:Q.string(),organizationId:Q.string(),organizationName:Q.string(),organizationSlug:Q.string(),organizationImageUrl:Q.string().nullable(),inviterName:Q.string().nullable()}),_5A=Q.object({gate:X5A,canonicalStep:GR.nullable(),organizationId:Q.string().nullable(),projectId:Q.string().nullable(),completionByStep:Q.record(GR,j5A),githubSkipped:Q.boolean(),githubAppSkipped:Q.boolean(),slackSkipped:Q.boolean(),sampleIssueId:Q.string().nullable(),actorRole:Q.enum(["admin","member"]).nullable(),requiredStep:Q.union([GR,Q.literal("select-organization")]).nullable(),isCompleted:Q.boolean(),onboardingRecommendationsThreadId:Q.string().nullable(),hasOrganizations:Q.boolean(),hasPaidBillingSubscription:Q.boolean(),billingStepEnabled:Q.boolean(),pendingInvitations:Q.array(K5A)}),x5A=Q.object({}),s5A=Q.object({onboarding:_5A}),TR=S({operationId:"onboarding.getState",description:"Read onboarding progress for the authenticated user.",backend:"api",route:{method:"GET",path:"/onboarding/state",tags:["Onboarding"]},input:x5A,output:s5A,pagination:"none",async:"sync"}),q5A=Q.object({integration:Q.enum(["github","slack"]).describe("Integration onboarding step to skip.")}),d5A=Q.object({skipped:Q.literal(!0)}),JR=S({operationId:"onboarding.skipIntegration",description:"Skip a GitHub or Slack integration step during onboarding.",backend:"api",route:{method:"POST",path:"/onboarding/skip-integration",tags:["Onboarding"]},input:q5A,output:d5A,pagination:"none",async:"sync"}),p5A=Q.object({}),AxA=Q.object({skipped:Q.literal(!0)}),PR=S({operationId:"onboarding.skipGithubAppInstallation",summary:"Skip GitHub App Installation",description:"Skip GitHub App installation during onboarding.",backend:"api",route:{method:"POST",path:"/onboarding/skip-github-app",tags:["Onboarding"]},input:p5A,output:AxA,pagination:"none",async:"sync"}),txA=Q.object({}),gxA=Q.object({skipped:Q.literal(!0)}),fR=S({operationId:"onboarding.skipSampleIssue",summary:"Skip Test Issue",description:"Skip the optional test issue during onboarding.",backend:"api",route:{method:"POST",path:"/onboarding/skip-sample-issue",tags:["Onboarding"]},input:txA,output:gxA,pagination:"none",async:"sync"}),nxA=Q.object({projectId:Q.string().uuid().describe("Project that completed onboarding.")}),ixA=Q.object({completed:Q.boolean()}),RR=S({operationId:"onboarding.finish",description:"Mark onboarding complete when all prerequisites are satisfied.",backend:"api",route:{method:"POST",path:"/onboarding/finish",tags:["Onboarding"]},input:nxA,output:ixA,pagination:"none",async:"sync"}),Wvt={getState:TR.contract,skipIntegration:JR.contract,skipGithubAppInstallation:PR.contract,skipSampleIssue:fR.contract,finish:RR.contract}});var Ob,oxA,exA,QxA,IxA,hxA,BxA,cxA,CxA,ExA,axA,OR,vR,zR,mR,jvt;var KcA=r(()=>{JA();KA();Yb();Ob=Q.object({id:Q.string().min(1),name:Q.string(),slug:Q.string(),logo:Q.string().nullable().optional()}),oxA=Ob.extend({role:he.optional()}),exA=Q.object({}),QxA=Q.object({organizations:Q.array(oxA).describe("Organizations available to the current credential.")}),IxA=Q.object({organizationId:Q.string().min(1).describe("Organization ID to fetch.")}),hxA=Q.object({organization:Ob}),BxA=Q.object({organizationId:Q.string().min(1).describe("Organization ID to update. SDK and CLI callers can auto-fill this before dispatch."),name:Q.string().trim().min(1).max(100).describe("New organization name.")}),cxA=Q.object({organization:Ob.describe("Updated organization.")}),CxA=Q.string().trim().min(1,"Name is required").max(100,"Name must be 100 characters or less").regex(/^[\p{L}\p{N} _-]+$/u,"Name can only contain letters, numbers, spaces, hyphens, and underscores"),ExA=Q.object({name:CxA.describe("Organization display name.")}),axA=Q.object({organization:Ob}),OR=S({operationId:"organizations.create",description:"Create an organization for the authenticated user.",backend:"api",route:{method:"POST",path:"/organizations",tags:["Organizations"],successStatus:201},input:ExA,output:axA,pagination:"none",async:"sync"}),vR=S({operationId:"organizations.list",description:"List organizations available to the current credential.",backend:"api",route:{method:"GET",path:"/organizations",tags:["Organizations"]},input:exA,output:QxA,pagination:"none",async:"sync"}),zR=S({operationId:"organizations.get",description:"Get one organization by ID.",backend:"api",route:{method:"GET",path:"/organizations/{organizationId}",tags:["Organizations"]},input:IxA,output:hxA,pagination:"none",async:"sync"}),mR=S({operationId:"organizations.update",description:"Update one organization.",backend:"api",route:{method:"PATCH",path:"/organizations/{organizationId}",tags:["Organizations"]},input:BxA,output:cxA,pagination:"none",async:"sync",examples:[{name:"rename-organization",input:{organizationId:"organization-123",name:"Observed Platform"},output:{organization:{id:"organization-123",name:"Observed Platform",slug:"acme",logo:null}}}]}),jvt={list:vR.contract,get:zR.contract,create:OR.contract,update:mR.contract}});var LB,oa,_cA,xcA,scA,qcA,dcA,pcA,ACA,vb,zb,mb,tCA,gCA,Wb,nCA,iCA,Zb,rxA;var WR=r(()=>{JA();KA();LB=Q.enum(["us-east-1","us-east-2","us-west-1","us-west-2","eu-central-1","eu-central-2","eu-north-1","eu-south-1","eu-south-2","eu-west-1","eu-west-2","eu-west-3"]),oa=Q.object({id:Q.string().uuid(),organizationId:Q.string().min(1),name:Q.string(),region:LB}),_cA=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to list projects for. Auto-filled from CLI and SDK context when omitted.")}),xcA=Q.object({projects:Q.array(oa).describe("Projects visible within the selected organization.")}),scA=Q.object({projectId:Q.string().uuid().describe("Project ID to fetch.")}),qcA=Q.string().trim().min(1,"Name is required").max(100,"Name must be 100 characters or less").regex(/^[\p{L}\p{N} _-]+$/u,"Name can only contain letters, numbers, spaces, hyphens, and underscores"),dcA=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to create the project under. Auto-filled from CLI and SDK context when omitted."),name:qcA.describe("Project name."),region:LB.optional().default("us-west-2").describe("AWS region where the new project should be created.")}),pcA=Q.object({project:oa}),ACA=Q.object({project:oa}),vb=S({operationId:"projects.list",description:"List projects in an organization.",backend:"api",route:{method:"GET",path:"/projects",tags:["Projects"]},input:_cA,output:xcA,pagination:"none",async:"sync"}),zb=S({operationId:"projects.get",description:"Get one project by ID.",backend:"api",route:{method:"GET",path:"/projects/{projectId}",tags:["Projects"]},input:scA,output:ACA,pagination:"none",async:"sync"}),mb=S({operationId:"projects.create",description:"Create one project in an organization.",backend:"api",route:{method:"POST",path:"/projects",successStatus:201,tags:["Projects"]},input:dcA,output:pcA,pagination:"none",async:"sync"}),tCA=Q.object({projectId:Q.string().uuid().describe("Project ID to update."),name:qcA.optional().describe("New project name.")}),gCA=Q.object({project:oa}),Wb=S({operationId:"projects.update",description:"Update (rename) one project by ID. User credentials require the `settings:write` organization permission (admin or owner role).",backend:"api",route:{method:"PATCH",path:"/projects/{projectId}",tags:["Projects"]},input:tCA,output:gCA,pagination:"none",async:"sync"}),nCA=Q.object({projectId:Q.string().uuid().describe("Project ID to delete.")}),iCA=Q.void(),Zb=S({operationId:"projects.delete",description:"Delete one project by ID. User credentials require the `settings:write` organization permission (admin or owner role).",backend:"api",route:{method:"DELETE",path:"/projects/{projectId}",successStatus:204,tags:["Projects"]},input:nCA,output:iCA,pagination:"none",async:"sync"}),rxA={list:vb.contract,get:zb.contract,create:mb.contract,update:Wb.contract,delete:Zb.contract}});var oCA,yxA,wxA,DxA,uxA,bxA,ZR,pvt;var eCA=r(()=>{JA();KA();oCA=Q.enum(["open","merged","closed"]),yxA=Q.enum(["review_required","approved","changes_requested"]),wxA=Q.enum(["passing","failing","pending"]),DxA=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),repositoryFullName:Q.string(),pullRequestId:Q.string().describe("Provider-native pull request identifier (GitHub PR number or Bitbucket PR id), serialized as a string."),githubPullRequestId:Q.number().int().describe("Deprecated: use pullRequestId. Numeric form of the provider-native pull request identifier; kept for backward compatibility."),title:Q.string().nullable(),url:Q.string().nullable(),status:oCA.nullable(),reviewState:yxA.nullable(),checksState:wxA.nullable(),requestedByUserId:Q.string().nullable(),authorLogin:Q.string().nullable().describe("Forge login that authored the pull request (often the Sazabi app identity)."),githubAuthorLogin:Q.string().nullable().describe("Deprecated: use authorLogin. Kept for backward compatibility."),threadId:Q.string().uuid().nullable(),runId:Q.string().uuid().nullable(),createdAt:Q.string().datetime(),mergedAt:Q.string().datetime().nullable(),closedAt:Q.string().datetime().nullable()}),uxA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list pull requests for. Auto-filled from CLI and SDK context when omitted."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of pull requests to return per page."),cursor:Q.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:oCA.optional().describe("Filter by pull request status (open, merged, or closed)."),repositoryFullName:Q.string().trim().optional().describe("Filter by repository full name, for example owner/repo. Case-insensitive."),requestedByUserId:Q.string().trim().optional().describe("Filter by the Sazabi user who requested the pull request. Pass 'me' to filter to the authenticated user.")}),bxA=Q.object({pullRequests:Q.array(DxA),nextCursor:Q.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),ZR=S({operationId:"pullRequests.list",description:"List pull requests that Sazabi opened, optionally filtered by status, repository, and requesting user.",backend:"api",route:{method:"GET",path:"/pull-requests",tags:["Pull Requests"]},input:uxA,output:bxA,pagination:"cursor",async:"sync"}),pvt={list:ZR.contract}});var QCA,ICA,hCA,BCA,cCA,ea;var VR=r(()=>{JA();KA();QCA=Q.enum(["log_source","mcp_connector","sandbox_cli","integration"]),ICA=Q.enum(["connected","recommended"]),hCA=Q.object({kind:QCA.describe("What the recommendation targets: a log source, MCP connector, sandbox CLI, or integration."),targetId:Q.string().describe("Exact catalog id for the kind (log source type, MCP provider id, sandbox CLI preset type, or integration provider id)."),status:ICA.describe("Resolved live against current connections: connected (already set up) or recommended (suggested, not yet connected)."),roiScore:Q.number().int().min(0).max(100).describe("Intrinsic ROI score, 0–100 — a normalized blend of how valuable, how easy to connect, and how proven the item is. A pure function of the item; computed live on read, never stored."),priority:Q.number().int().min(1).describe("1-based rank within this list, sorted by roiScore (best first). Items are already returned in priority order; the field lets consumers recover the rank without trusting array position.")}),BCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list recommendations for. Auto-filled from CLI and SDK context when omitted.")}),cCA=Q.object({recommendations:Q.array(hCA).describe("The project's configuration recommendations, deduped by (kind, targetId), with status resolved live and each item's ROI score. Returned in priority order (highest roiScore first).")}),ea=S({operationId:"recommendations.list",description:"List a project's configuration recommendations (data sources, MCP connectors, sandbox CLIs, and integrations) with each item's live connection status.",backend:"api",route:{method:"GET",path:"/recommendations",tags:["Recommendations"]},input:BCA,output:cCA,pagination:"none",async:"sync"})});var CCA,lxA,ECA,Vb,aCA,rCA,yCA,wCA,FB,HR,DCA,uCA,MB,bCA,lCA,YB,NCA,UCA,kB,NxA;var XR=r(()=>{JA();KA();CCA=Q.object({type:Q.string().describe("Preset type identifier."),label:Q.string().describe("Human-readable display name."),executableNames:Q.array(Q.string()).describe("CLI binary names installed by this preset."),envVarKeys:Q.array(Q.string()).describe("Environment variables required for authentication."),setupSkill:Q.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),lxA=Q.object({}),ECA=Q.object({types:Q.array(CCA)}),Vb=S({operationId:"sandboxPresets.listTypes",description:"List all supported sandbox CLI types with their environment variable requirements and setup skills.",backend:"api",route:{method:"GET",path:"/sandbox-presets/types",tags:["Sandbox Presets"]},input:lxA,output:ECA,pagination:"none",async:"sync"}),aCA=Q.enum(["github_app","bitbucket_integration","personal_access_token","stored_credentials"]),rCA=Q.object({presetType:Q.string().describe("Preset type identifier."),credentialSource:aCA.describe("Authoritative credential source for the preset."),isSystemManaged:Q.boolean().describe("Whether the connection follows an integration lifecycle."),fallbackConfigured:Q.boolean().describe("Whether user-provided fallback credentials are stored for this preset."),envVarKeys:Q.array(Q.string()).describe("Stored environment variable names. Secret values are omitted.")}),yCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to inspect. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted.")}),wCA=Q.object({connections:Q.array(rCA)}),FB=S({operationId:"sandboxPresets.listConnections",description:"List a project's stored and integration-backed sandbox CLI connections without returning secret values.",backend:"api",route:{method:"GET",path:"/sandbox-presets/connections",tags:["Sandbox Presets"]},input:yCA,output:wCA,pagination:"none",async:"sync"}),HR=Q.object({key:Q.string().min(1).max(256).regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable keys must match /^[A-Za-z_][A-Za-z0-9_]*$/.").describe("Environment variable name (e.g. KUBECONFIG_CONTENTS)."),value:Q.string().max(10240).describe("Secret value. Encrypted at rest; never returned by any API response.")}),DCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to configure. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:Q.string().min(1).describe("Preset type identifier (e.g. kubectl, aws, github)."),environmentVariables:Q.array(HR).max(100).describe("Full set of env vars for this preset. Replaces any previously stored values for the preset.")}),uCA=Q.object({projectId:Q.string().uuid().describe("Project the preset was written to."),presetType:Q.string().describe("Preset type that was upserted."),envVarKeys:Q.array(Q.string()).describe("Env var key names now stored for this preset. Values are never returned.")}),MB=S({operationId:"sandboxPresets.upsertPreset",summary:"Upsert CLI connection",description:"Set or replace a project's CLI connection credentials (e.g. the kubectl CLI's KUBECONFIG_CONTENTS). Values are encrypted server-side and never returned. Requires write access to the target project.",backend:"api",route:{method:"POST",path:"/sandbox-presets/config",successStatus:200,tags:["Sandbox Presets"]},input:DCA,output:uCA,pagination:"none",async:"sync"}),bCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to update. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:Q.string().min(1).describe("Preset type identifier.")}),lCA=Q.object({projectId:Q.string().uuid().describe("Project the CLI connection belonged to."),presetType:Q.string().describe("Preset type that was disconnected."),deleted:Q.boolean().describe("Whether a stored CLI connection was deleted.")}),YB=S({operationId:"sandboxPresets.deletePreset",summary:"Disconnect CLI",description:"Delete a project's stored CLI connection. Integration-managed access remains available until its owning integration is disconnected.",backend:"api",route:{method:"DELETE",path:"/sandbox-presets/config/{presetType}",tags:["Sandbox Presets"]},input:bCA,output:lCA,pagination:"none",async:"sync"}),NCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to test from. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:Q.string().min(1).describe("Preset type identifier."),environmentVariables:Q.array(HR).max(100).describe("Unsaved credentials to validate in a readonly sandbox.")}),UCA=Q.object({status:Q.enum(["success","failed"]),message:Q.string().nullable(),stdout:Q.string().describe("Truncated command output with submitted credentials redacted."),stderr:Q.string().describe("Truncated command errors with submitted credentials redacted.")}),kB=S({operationId:"sandboxPresets.testPreset",summary:"Test CLI connection",description:"Validate unsaved CLI credentials in a read-only ephemeral sandbox without persisting them.",backend:"api",route:{method:"POST",path:"/sandbox-presets/test",tags:["Sandbox Presets"]},input:NCA,output:UCA,pagination:"none",async:"sync"}),NxA={deletePreset:YB.contract,listConnections:FB.contract,listTypes:Vb.contract,testPreset:kB.contract,upsertPreset:MB.contract}});var Hb,SCA=1048576,jR,LCA,KR,UxA,SxA,LxA,FxA,MxA,YxA,kxA,$xA,GxA,TxA,_R,xR,sR,qR,dR,hzt;var FCA=r(()=>{JA();KA();Hb=Q.string().min(1).max(64).regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/,"Name must start with a letter or digit and contain only letters, digits, underscores, and hyphens (max 64 characters).").describe("Script name. Must be unique within the project among non-deleted scripts."),jR=Q.string().min(1).refine((A)=>new TextEncoder().encode(A).length<=SCA,{message:`Script content must be at most ${SCA} bytes (1 MiB).`}).describe("Bash script body materialized as /home/sazabi/scripts/<name>.sh in the sandbox."),LCA=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),name:Q.string(),description:Q.string().nullable(),contentHash:Q.string().describe("sha256 hex digest of the script content."),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),KR=LCA.extend({content:jR}),UxA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list scripts for. Auto-filled from CLI and SDK context when omitted."),search:Q.string().optional().describe("Case-insensitive partial match on script name."),cursor:Q.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of scripts to return per page.")}),SxA=Q.object({scripts:Q.array(LCA),nextCursor:Q.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),LxA=Q.object({name:Hb.describe("Script name to fetch."),projectId:Q.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),FxA=Q.object({script:KR}),MxA=Q.object({projectId:Q.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),name:Hb.describe("Script name. Must be unique within the project among non-deleted scripts."),content:jR,description:Q.string().max(500).nullable().optional().describe("Optional human-readable description.")}),YxA=Q.object({script:KR}),kxA=Q.object({name:Hb.describe("Script to update."),projectId:Q.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),content:jR.optional().describe("New script body. Omit to leave content unchanged."),description:Q.string().max(500).nullable().optional().describe("New description, or null to clear it. Omit to leave unchanged.")}),$xA=Q.object({script:KR}),GxA=Q.object({name:Hb.describe("Script to delete."),projectId:Q.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),TxA=Q.object({deleted:Q.boolean()}),_R=S({operationId:"scripts.list",description:"List durable bash scripts stored for a project.",backend:"api",route:{method:"GET",path:"/scripts",tags:["Scripts"]},input:UxA,output:SxA,pagination:"cursor",async:"sync"}),xR=S({operationId:"scripts.get",description:"Get a single project script by name, including its body.",backend:"api",route:{method:"GET",path:"/scripts/{name}",tags:["Scripts"]},input:LxA,output:FxA,pagination:"none",async:"sync"}),sR=S({operationId:"scripts.create",description:"Create a durable bash script for a project.",backend:"api",route:{method:"POST",path:"/scripts",successStatus:201,tags:["Scripts"]},input:MxA,output:YxA,pagination:"none",async:"sync"}),qR=S({operationId:"scripts.update",description:"Update a project script's body and/or description.",backend:"api",route:{method:"PATCH",path:"/scripts/{name}",tags:["Scripts"]},input:kxA,output:$xA,pagination:"none",async:"sync"}),dR=S({operationId:"scripts.delete",description:"Soft-delete a project script by name.",backend:"api",route:{method:"DELETE",path:"/scripts/{name}",successStatus:204,tags:["Scripts"]},input:GxA,output:TxA,pagination:"none",async:"sync"}),hzt={list:_R.contract,get:xR.contract,create:sR.contract,update:qR.contract,delete:dR.contract}});var pR,MCA,YCA,kCA,$CA,$B,GB,JxA;var AO=r(()=>{JA();KA();pR=Q.object({projectId:Q.string().uuid().optional().describe("Project to search within. Auto-filled from CLI and SDK context when omitted."),query:Q.string().trim().min(1,"Query must be at least 1 character").max(500,"Query must be at most 500 characters"),limit:Q.coerce.number().min(1).max(100).default(20).describe("Maximum number of search results to return."),page:Q.coerce.number().min(1).default(1).describe("One-based page number.")}),MCA=pR.extend({status:Q.enum(["regular","archived"]).optional().describe("Optional thread status filter.")}),YCA=pR.extend({threadId:Q.string().uuid().optional().describe("Optional thread restriction for message search."),role:Q.enum(["user","assistant"]).optional().describe("Optional message role filter.")}),kCA=Q.object({threads:Q.array(Q.object({id:Q.string().uuid(),projectId:Q.string().uuid().optional(),title:Q.string(),status:Q.enum(["regular","archived"]),labels:Q.array(Q.string()),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime(),highlights:Q.array(Q.string()),score:Q.number().optional()})),pagination:Q.object({page:Q.number(),limit:Q.number(),totalResults:Q.number(),totalPages:Q.number()}).describe("Page-based pagination metadata for the current search result.")}),$CA=Q.object({messages:Q.array(Q.object({id:Q.string().uuid(),threadId:Q.string().uuid(),threadTitle:Q.string(),role:Q.enum(["user","assistant"]),content:Q.string(),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime(),highlights:Q.array(Q.string()),score:Q.number().optional()})),pagination:Q.object({page:Q.number(),limit:Q.number(),totalResults:Q.number(),totalPages:Q.number()}).describe("Page-based pagination metadata for the current search result.")}),$B=S({operationId:"search.threads",description:"Search threads within one project.",backend:"api",route:{method:"GET",path:"/search/threads",tags:["Search"]},input:MCA,output:kCA,pagination:"page",async:"sync",examples:[{name:"search-open-incidents",input:{projectId:"11111111-1111-4111-8111-111111111111",query:"payment timeout",status:"regular",limit:10,page:1},output:{threads:[{id:"22222222-2222-4222-8222-222222222222",projectId:"11111111-1111-4111-8111-111111111111",title:"Payment timeout in us-west-2",status:"regular",labels:["payments","timeout"],createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-02T00:00:00.000Z",highlights:["payment timeout"],score:123.45}],pagination:{page:1,limit:10,totalResults:1,totalPages:1}}}]}),GB=S({operationId:"search.messages",description:"Search messages within one project.",backend:"api",route:{method:"GET",path:"/search/messages",tags:["Search"]},input:YCA,output:$CA,pagination:"page",async:"sync",examples:[{name:"search-assistant-messages",input:{projectId:"11111111-1111-4111-8111-111111111111",query:"rollback",role:"assistant",limit:10,page:1},output:{messages:[{id:"33333333-3333-4333-8333-333333333333",threadId:"22222222-2222-4222-8222-222222222222",threadTitle:"Deployment rollback guidance",role:"assistant",content:"Rollback the ingestion deployment and confirm queue depth.",createdAt:"2026-01-02T00:00:00.000Z",updatedAt:"2026-01-02T00:00:00.000Z",highlights:["Rollback the ingestion deployment"],score:98.76}],pagination:{page:1,limit:10,totalResults:1,totalPages:1}}}]}),JxA={threads:$B.contract,messages:GB.contract}});var GCA;var TCA=r(()=>{GCA=["onboarding","setup"]});var JCA,PCA,fCA,RCA,Qa;var tO=r(()=>{TCA();JA();KA();JCA=Q.enum(GCA),PCA=Q.object({id:Q.string().describe("Unique task identifier (e.g. install_github_app)."),label:Q.string().describe("Short human-readable task name."),description:Q.string().describe("Explanation of what needs to be completed to satisfy this task."),instructions:Q.string().describe("Step-by-step instructions for completing this task."),completed:Q.boolean().describe("Whether the task has been completed."),completedAt:Q.string().datetime().nullable().describe("ISO 8601 timestamp of when the task was completed, or null."),category:JCA.describe("Task category: onboarding (core setup steps) or setup (additional configuration).")}),fCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list tasks for. Auto-filled from CLI and SDK context when omitted.")}),RCA=Q.object({tasks:Q.array(PCA).describe("All onboarding and setup tasks with their current completion status.")}),Qa=S({operationId:"tasks.list",description:"List all onboarding and setup tasks for a project, including their current completion status and a description of what is required to complete each task.",backend:"api",route:{method:"GET",path:"/tasks",tags:["Tasks"]},input:fCA,output:RCA,pagination:"none",async:"sync"})});var PxA,fxA,PQ,RxA,OxA,vxA,zxA,mxA,WxA,ZxA,VxA,HxA,XxA,jxA,KxA,_xA,xxA,gO,nO,iO,oO,eO,QO,IO,lzt;var OCA=r(()=>{JA();KA();PxA=Q.object({id:Q.string().uuid().describe("Team ID."),name:Q.string().describe("Team name, unique among the org's active teams."),description:Q.string().nullable().describe("Optional team description."),createdAt:Q.string().datetime().describe("When the team was created."),memberCount:Q.number().int().nonnegative().describe("Number of active members in the team.")}),fxA=Q.object({userId:Q.string().min(1).describe("User ID of the team member."),name:Q.string().nullable().describe("Display name for the member, when available."),email:Q.string().email().describe("Email address for the member."),addedAt:Q.string().datetime().describe("When the member was added to the team.")}),PQ=Q.string().min(1).optional().describe("Organization to operate on. Auto-filled from CLI and SDK context when omitted."),RxA=Q.object({organizationId:PQ}),OxA=Q.object({teams:Q.array(PxA).describe("Active teams in the organization.")}),vxA=Q.object({organizationId:PQ,name:Q.string().trim().min(1).describe("Team name."),description:Q.string().trim().min(1).optional().describe("Optional team description.")}),zxA=Q.object({id:Q.string().uuid().describe("ID of the created team.")}),mxA=Q.object({organizationId:PQ,teamId:Q.string().uuid().describe("Team to update."),name:Q.string().trim().min(1).optional().describe("New team name."),description:Q.string().trim().min(1).nullable().optional().describe("New team description; null clears it.")}),WxA=Q.object({id:Q.string().uuid().describe("ID of the updated team.")}),ZxA=Q.object({params:Q.object({teamId:Q.string().uuid().describe("Team to delete.")}),query:Q.object({organizationId:PQ})}).transform(({params:A,query:t})=>({...t,...A})),VxA=Q.object({success:Q.literal(!0).describe("The team and its memberships were removed.")}),HxA=Q.object({organizationId:PQ,teamId:Q.string().uuid().describe("Team to add the member to."),userId:Q.string().min(1).describe("User ID of an active organization member to add.")}),XxA=Q.object({id:Q.string().uuid().describe("ID of the team membership.")}),jxA=Q.object({params:Q.object({teamId:Q.string().uuid().describe("Team to remove the member from."),userId:Q.string().min(1).describe("User ID of the member to remove.")}),query:Q.object({organizationId:PQ})}).transform(({params:A,query:t})=>({...t,...A})),KxA=Q.object({success:Q.literal(!0).describe("The membership was removed.")}),_xA=Q.object({organizationId:PQ,teamId:Q.string().uuid().describe("Team to list members for.")}),xxA=Q.object({members:Q.array(fxA).describe("Active members of the team.")}),gO=S({operationId:"teams.list",description:"List teams in an organization.",backend:"api",route:{method:"GET",path:"/teams",tags:["Teams"]},input:RxA,output:OxA,pagination:"none",async:"sync",examples:[{name:"organization-teams",input:{organizationId:"organization-123"},output:{teams:[{id:"5c0f9866-31ab-4237-94cc-a1d0ba2f6de2",name:"Payments",description:"Owns checkout and billing components.",createdAt:"2026-01-01T00:00:00.000Z",memberCount:4}]}}]}),nO=S({operationId:"teams.create",description:"Create a team in an organization.",backend:"api",route:{method:"POST",path:"/teams",tags:["Teams"],successStatus:201},input:vxA,output:zxA,pagination:"none",async:"sync"}),iO=S({operationId:"teams.update",description:"Rename a team or update its description.",backend:"api",route:{method:"PATCH",path:"/teams/{teamId}",tags:["Teams"]},input:mxA,output:WxA,pagination:"none",async:"sync"}),oO=S({operationId:"teams.delete",description:"Delete a team, its memberships, and its component-ownership assignments.",backend:"api",route:{method:"DELETE",path:"/teams/{teamId}",tags:["Teams"],inputStructure:"detailed"},input:ZxA,output:VxA,pagination:"none",async:"sync"}),eO=S({operationId:"teams.addMember",description:"Add an active organization member to a team.",backend:"api",route:{method:"POST",path:"/teams/{teamId}/members",tags:["Teams"],successStatus:201},input:HxA,output:XxA,pagination:"none",async:"sync"}),QO=S({operationId:"teams.removeMember",description:"Remove a member from a team.",backend:"api",route:{method:"DELETE",path:"/teams/{teamId}/members/{userId}",tags:["Teams"],inputStructure:"detailed"},input:jxA,output:KxA,pagination:"none",async:"sync"}),IO=S({operationId:"teams.listMembers",description:"List a team's active members.",backend:"api",route:{method:"GET",path:"/teams/{teamId}/members",tags:["Teams"]},input:_xA,output:xxA,pagination:"none",async:"sync"}),lzt={list:gO.contract,create:nO.contract,update:iO.contract,delete:oO.contract,addMember:eO.contract,removeMember:QO.contract,listMembers:IO.contract}});var sxA,qxA,dxA,hO,pxA,AsA,BO,tsA,gsA,cO,Lzt;var vCA=r(()=>{JA();KA();sxA=Q.object({kind:Q.enum(["user","workspace"]),name:Q.string().optional(),email:Q.string().optional()}),qxA=Q.object({container:Q.string().min(1).describe("The container to create the work item in: its id, short key (e.g. a Linear team key like ENG), or display name."),title:Q.string().min(1),bodyMarkdown:Q.string().optional(),state:Q.string().optional(),itemType:Q.string().optional(),organizationId:Q.string().min(1).optional().describe("Optional organization ID to scope the request to. User credentials must belong to it; a secret key may only reference its own organization. Defaults to the credential's active organization."),clientRequestId:Q.string().min(1).optional().describe("Optional caller-supplied idempotency key. When provided, retrying the same logical create with the same clientRequestId reuses the original result instead of creating a duplicate external work item.")}).strict(),dxA=Q.object({identifier:Q.string(),title:Q.string(),url:Q.string(),state:Q.string(),attribution:sxA.optional(),reused:Q.boolean()}),hO=S({operationId:"work-items.create",description:"Create a work item (e.g. a Linear issue) in a connected issue tracker, attributing the write to the requesting user.",backend:"api",route:{method:"POST",path:"/work-items",tags:["Work Items"],successStatus:201},input:qxA,output:dxA,pagination:"none",async:"sync"}),pxA=Q.object({itemId:Q.string().min(1).describe("The work item to comment on."),bodyMarkdown:Q.string().min(1),organizationId:Q.string().min(1).optional().describe("Optional organization ID to scope the request to. User credentials must belong to it; a secret key may only reference its own organization. Defaults to the credential's active organization.")}).strict(),AsA=Q.object({identifier:Q.string(),url:Q.string()}),BO=S({operationId:"work-items.comment",description:"Add a comment to an existing work item.",backend:"api",route:{method:"POST",path:"/work-items/{itemId}/comment",tags:["Work Items"]},input:pxA,output:AsA,pagination:"none",async:"sync"}),tsA=Q.object({itemId:Q.string().min(1).describe("The work item to transition."),state:Q.string().min(1).describe("The target workflow state."),organizationId:Q.string().min(1).optional().describe("Optional organization ID to scope the request to. User credentials must belong to it; a secret key may only reference its own organization. Defaults to the credential's active organization.")}).strict(),gsA=Q.object({identifier:Q.string(),title:Q.string(),url:Q.string(),state:Q.string(),changed:Q.boolean()}),cO=S({operationId:"work-items.transition",description:"Move a work item to a target workflow state.",backend:"api",route:{method:"POST",path:"/work-items/{itemId}/transition",tags:["Work Items"]},input:tsA,output:gsA,pagination:"none",async:"sync"}),Lzt={create:hO.contract,comment:BO.contract,transition:cO.contract}});var CO;var zCA=r(()=>{yW();bW();NM();YM();VW();iY();QY();Y4();uw();eK();Ok();Of();Yb();mBA();xf();CcA();mcA();XcA();jcA();KcA();WR();eCA();VR();Gb();XR();FCA();AO();tO();OCA();CR();vCA();CO={me:vf.contract,automations:{list:$M.contract,get:GM.contract,create:TM.contract,update:JM.contract,enable:PM.contract,disable:fM.contract,runs:{list:RM.contract,get:OM.contract,logs:vM.contract}},logs:{query:vI.contract,schema:zI.contract,volume:mI.contract,patterns:WI.contract,nativeQuery:ZI.contract},logSources:{listProviders:rw.contract,list:RI.contract,create:OI.contract,get:yw.contract,update:ww.contract,delete:Dw.contract},logStreams:{list:$k.contract,create:Gk.contract,get:Tk.contract,update:Jk.contract,delete:Pk.contract,reassign:fk.contract},connectedAccounts:{beginConnect:SM.contract,getConnectAttempt:LM.contract,list:FM.contract,disconnect:MM.contract},integrations:{listProviders:NW.contract,listConnections:UW.contract,getConnection:SW.contract,createConnection:LW.contract,beginConnect:FW.contract,getConnectAttempt:MW.contract,disconnectConnection:YW.contract,updateConnectionCredentials:kW.contract,getOrganizationExternalIdentityJitPolicy:TW.contract,updateOrganizationExternalIdentityJitPolicy:JW.contract,getConnectionExternalIdentityJitPolicy:PW.contract,updateConnectionExternalIdentityJitPolicy:fW.contract,getSlackConfiguration:OW.contract,updateSlackConfiguration:vW.contract,listSlackChannelProjectMappings:mW.contract,setSlackChannelProjectMapping:WW.contract,deleteSlackChannelProjectMapping:ZW.contract},notificationChannels:{getProject:uR.contract},notificationDeliveryRules:{list:FR.contract,options:MR.contract,create:YR.contract,update:kR.contract,delete:$R.contract},mcpConnectors:{listProviders:Mb.contract,list:QB.contract,get:IB.contract,details:hB.contract,search:BB.contract,describe:cB.contract,call:CB.contract,create:EB.contract,update:aB.contract,disconnect:rB.contract,setReadOnly:yB.contract,beginOAuthInstall:wB.contract,getOAuthInstallAttempt:DB.contract},sandboxPresets:{deletePreset:YB.contract,listConnections:FB.contract,listTypes:Vb.contract,testPreset:kB.contract,upsertPreset:MB.contract},scripts:{list:_R.contract,get:xR.contract,create:sR.contract,update:qR.contract,delete:dR.contract},logMatchExpressions:{list:BY.contract,get:cY.contract,create:CY.contract,update:EY.contract,disable:aY.contract},memory:{put:uB.contract,get:bB.contract,list:lB.contract,search:NB.contract,delete:UB.contract},onboarding:{getState:TR.contract,skipIntegration:JR.contract,skipGithubAppInstallation:PR.contract,skipSampleIssue:fR.contract,finish:RR.contract},organizations:{list:vR.contract,get:zR.contract,create:OR.contract,update:mR.contract},members:{list:zf.contract,updateRole:mf.contract,remove:Wf.contract,invite:Zf.contract,listInvitations:Vf.contract,revokeInvitation:Hf.contract},teams:{list:gO.contract,create:nO.contract,update:iO.contract,delete:oO.contract,addMember:eO.contract,removeMember:QO.contract,listMembers:IO.contract},publicKeys:{list:$I.contract,get:GI.contract,ensureLogForwarding:TI.contract,update:JI.contract,deactivate:PI.contract},secretKeys:{list:ew.contract,get:Qw.contract,create:Iw.contract,update:hw.contract,delete:Bw.contract},projects:{list:vb.contract,get:zb.contract,create:mb.contract,update:Wb.contract,delete:Zb.contract},search:{threads:$B.contract,messages:GB.contract},messages:{list:BcA.contract,append:ccA.contract},threads:{list:tR.contract,get:gR.contract,getStatus:nR.contract,stop:iR.contract,create:oR.contract,update:eR.contract,fork:QR.contract,setVisibility:IR.contract,createShareLink:hR.contract,listShareLinks:BR.contract,revokeShareLink:cR.contract},runs:{list:sf.contract,listForThread:qf.contract,get:df.contract,cancel:pf.contract},pullRequests:{list:ZR.contract},issues:{count:xy.contract,create:kI.contract,list:Ky.contract,search:_y.contract,get:sy.contract,resolve:qy.contract,ignore:dy.contract,reopen:py.contract,reassignAndReopen:Aw.contract,mute:tw.contract,unmute:gw.contract},workItems:{create:hO.contract,comment:BO.contract,transition:cO.contract},billing:{getSummary:mM.contract,getUsage:WM.contract,listTransactions:ZM.contract,retryOutstandingBalance:VM.contract,getAutoTopUp:XM.contract,updateAutoTopUp:jM.contract,purchaseCredits:KM.contract,listPlans:_M.contract,previewPlanChange:xM.contract,changePlan:sM.contract,createCheckoutSession:qM.contract,getCheckoutSessionStatus:dM.contract,createPortalSession:pM.contract,getPaymentMethod:AY.contract},tasks:{list:Qa.contract},recommendations:{list:ea.contract},components:{list:Fy.contract,get:My.contract,register:MI.contract,deregister:Yy.contract,rename:ky.contract,assignTeam:$y.contract,retirementPreview:Gy.contract,retire:Ty.contract,restorationPreview:Jy.contract,restore:Py.contract,mergePreview:my.contract,merge:Wy.contract,relationships:{list:fy.contract,preview:Ry.contract,add:Oy.contract,remove:vy.contract},incidents:{list:Zy.contract},timeline:Vy.contract}}});var fQ=r(()=>{om();NM();YM();zCA();iY();QY();uw();Ok();Of();xf();WR();VR();XR();AO();tO()});var nsA="https://api.sazabi.com",isA="x-sazabi-client-source",WCA=(A)=>{return{streamRun:async(t)=>{return mCA({options:A,path:`/runs/${encodeURIComponent(t.runId)}/stream`,cursor:t.cursor,signal:t.signal})},streamThread:async(t)=>{return mCA({options:A,path:`/threads/${encodeURIComponent(t.threadId)}/stream`,cursor:t.cursor,signal:t.signal})}}},mCA=async(A)=>{let t=A.options.fetch??globalThis.fetch;if(!t)throw Error("Fetch transport is not available in this runtime.");let g=await A.options.credentialProvider.getToken(),i=osA(A.options.apiBaseUrl,A.path,A.cursor);return QsA({url:i,token:g,clientSource:A.options.clientSource,initialCursor:A.cursor,signal:A.signal,fetch:t})},osA=(A,t,g)=>{let i=esA(A??nsA),n=new URL(`${i}${t}`);if(g)n.searchParams.set(QM,g);return n.toString()},esA=(A)=>{let t=A.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},QsA=async(A)=>{let t=[],g=[],i=!1,n=!1,o,e=A.initialCursor,I=new AbortController,h=(w)=>{if(i)return;i=!0,o=w;while(g.length>0)g.shift()?.({value:void 0,done:!0})},B=(w)=>{let l=g.shift();if(l){l({value:w,done:!1});return}t.push(w)},c=(w)=>{if(w.event===hM){let N=CsA(w.data);if(N!==void 0)e=N;return}if(w.data===BM){n=!0,I.abort(),h();return}let l=EsA(w.data);if(l)B(l)},C=()=>{n=!0,I.abort(),h()};if(A.signal)if(A.signal.aborted)n=!0,I.abort();else A.signal.addEventListener("abort",C,{once:!0});let E={[Symbol.asyncIterator](){return E},get cursor(){return e},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(i){if(o)throw o;return{value:void 0,done:!0}}return new Promise((w)=>{g.push(w)}).then((w)=>{if(w.done&&o)throw o;return w})},return:async()=>{return n=!0,I.abort(),h(),{value:void 0,done:!0}},throw:async(w)=>{throw n=!0,I.abort(),h(w instanceof Error?w:Error(String(w))),w},close:async()=>{n=!0,I.abort(),h()}};if(n)return h(),E;let a=await A.fetch(A.url,{method:IM,headers:IsA(A.token,A.clientSource),signal:I.signal});if(await hsA(a))h();else BsA(a,c).then(()=>h()).catch((w)=>{if(rsA(w)||n||A.signal?.aborted){h();return}h(ysA(w))});return E},IsA=(A,t)=>{return{accept:"text/event-stream",authorization:`Bearer ${A}`,...t?{[isA]:t}:{}}},hsA=async(A)=>{if(A.status===204)return!0;if(A.ok&&A.body)return!1;let t=await asA(A);if(A.status===401)throw Error("Authentication failed. Check your credential.");if(A.status===403)throw Error(`Forbidden (403): ${t||"Credential may not have access to this resource"}`);if(A.status===404)throw Error(`Not found (404): ${t||"Run or thread not found"}`);if(A.status===400)throw Error(`Invalid stream cursor (400): ${t||"The provided cursor was rejected"}`);if(A.status>=400&&A.status<500&&A.status!==429)throw Error(`Client error (${A.status}): ${t}`);if(!A.body)throw Error("Agent stream response did not include a body.");throw Error(A.status===429?`Rate limited (429): ${t}`:`Server error (${A.status}): ${t}`)},BsA=async(A,t)=>{let g=A.body?.getReader();if(!g)throw Error("Agent stream response did not include a body.");let i=new TextDecoder,n="",o=csA(t);try{while(!0){let e=await g.read();if(e.done)break;n+=i.decode(e.value,{stream:!0});let I=n.split(/\r\n|\r|\n/);n=I.pop()??"";for(let h of I)o.line(h)}if(n+=i.decode(),n)for(let e of n.split(/\r\n|\r|\n/))o.line(e);o.flush()}finally{g.releaseLock()}},csA=(A)=>{let t="message",g=[],i=()=>{t="message",g=[]},n=()=>{if(g.length===0){i();return}A({event:t,data:g.join(`
8707
+ `)}],evidenceHints:["force.com / my.salesforce.com URLs, SALESFORCE_* or SFDC_* environment variables, or sf/sfdx CLI usage","jsforce, simple-salesforce, or @salesforce packages","README/runbooks naming Salesforce as the CRM or system of record"],helpText:"Query Salesforce data and metadata, and run Apex invocable actions and Flows exposed by a hosted MCP server. Coming soon — a Salesforce admin registers an External Client App in your org and Sazabi provisions its credentials, so it isn't self-serve connectable yet."})});var WIA;var ZIA=r(()=>{IA();WIA=m({id:"secureframe",label:"Secureframe",iconKey:"secureframe",defaultServerUrl:"https://mcp.secureframe.com",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"secureframe",callbackPathSegment:"secureframe",authorizationUrl:"https://mcp.secureframe.com/oauth/authorize",tokenUrl:"https://mcp.secureframe.com/oauth/token",resourceUrl:"https://mcp.secureframe.com",dynamicClientRegistration:{registrationEndpoint:"https://mcp.secureframe.com/register",tokenEndpointAuthMethod:"none"}},getAvailableScopes:async()=>[{value:"mcp",label:"MCP Access",description:"Query and manage Secureframe compliance data, controls, tests, vendors, risks, and framework requirements."}],scopesUserSelectable:!1,regions:[{label:"United States (US)",serverUrl:"https://mcp.secureframe.com"},{label:"United Kingdom (UK)",serverUrl:"https://mcp-uk.secureframe.com",authorizationUrl:"https://mcp-uk.secureframe.com/oauth/authorize",tokenUrl:"https://mcp-uk.secureframe.com/oauth/token",resourceUrl:"https://mcp-uk.secureframe.com",dynamicClientRegistration:{registrationEndpoint:"https://mcp-uk.secureframe.com/register",tokenEndpointAuthMethod:"none"}}],capabilityOverrides:{allowWriteTools:!0},evidenceHints:["secureframe.com URLs, SECUREFRAME_API_KEY / SECUREFRAME_API_SECRET environment variables","SOC 2, ISO 27001, HIPAA, PCI DSS, GDPR, or NIST compliance frameworks and controls","README/docs or compliance runbooks naming Secureframe for automated compliance and continuous monitoring"],helpText:"Query and manage Secureframe compliance data, controls, automated tests, vendors, risks, and framework requirements. Choose the US or UK region when connecting.",skill:"secureframe",setupSkill:"secureframe-setup"})});var VIA;var HIA=r(()=>{IA();VIA=m({id:"sentry",label:"Sentry",iconKey:"sentry",defaultServerUrl:"https://mcp.sentry.dev/mcp",serverUrlPathSuffixMaxSegments:2,transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"sentry",callbackPathSegment:"sentry",authorizationUrl:"https://mcp.sentry.dev/oauth/authorize",tokenUrl:"https://mcp.sentry.dev/oauth/token",useServerUrlAsResource:!0,dynamicClientRegistration:{registrationEndpoint:"https://mcp.sentry.dev/oauth/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"org:read"},{value:"project:write"},{value:"team:write"},{value:"event:write"}],getUrlConfiguration:async()=>({docsUrl:"https://mcp.sentry.dev/",instructions:"Copy the hosted MCP server URL below. Optional: to scope this connection to one organization or project, copy a path-scoped URL from the Sentry MCP page (e.g. .../mcp/your-org).",defaultServerUrl:"https://mcp.sentry.dev/mcp",optional:!0}),capabilityOverrides:{allowWriteTools:!0},evidenceHints:["@sentry packages, sentry.properties, SENTRY_* environment variables, or sentry-cli usage","Sentry.init calls, release/deploy automation, or Sentry alert docs","README/docs naming Sentry as the error tracking provider"],helpText:"Browse Sentry organizations, teams, projects, and events."})});var XIA;var jIA=r(()=>{$t();IA();XIA=m({id:"signoz",label:"SigNoz",iconKey:"signoz",defaultServerUrl:"https://mcp.us.signoz.cloud/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!0},evidenceHints:["SigNoz config, SIGNOZ_* environment variables, or signoz.io links","OpenTelemetry Collector exporting to SigNoz, or a signoz docker-compose / self-hosted deployment","README/docs naming SigNoz for metrics, logs, traces, alerts, or dashboards"],helpText:"Query SigNoz metrics, logs, traces, alerts, and dashboards to investigate production issues.",setupGroups:[{id:"instance",title:"Find your SigNoz instance",description:"Point Sazabi at the SigNoz instance whose telemetry you want to query.",body:"For SigNoz Cloud, use the regional MCP endpoint for your account, such as `https://mcp.us.signoz.cloud/mcp` (replace the region as needed). For self-hosted SigNoz, use your instance's MCP endpoint and set the SigNoz base URL below so the server knows which instance to target.",fieldKeys:["signozUrl"]},{id:"api-key",title:"Create an API key",description:"Create or copy the SigNoz API key Sazabi will send to SigNoz's MCP endpoint.",body:"In SigNoz, go to **Settings > API Keys** and create or copy an API key. Alert, dashboard, and notification-channel tools require an admin-level key. Paste it below.",fieldKeys:["apiKey"]}],validateCredentials:FeA,normalizeHeaders:LeA})});var KIA;var _IA=r(()=>{IA();KIA=m({id:"slack",label:"Slack",iconKey:"slack",defaultServerUrl:"https://mcp.slack.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"disabled",oauth:{providerConfigKey:"slack",callbackPathSegment:"slack",authorizationUrl:"https://slack.com/oauth/v2_user/authorize",tokenUrl:"https://slack.com/api/oauth.v2.user.access"},getAvailableScopes:async()=>[{value:"search:read.public"},{value:"search:read.private"},{value:"search:read.mpim"},{value:"search:read.im"},{value:"search:read.files"},{value:"search:read.users"},{value:"canvases:read"},{value:"users:read"},{value:"users:read.email"}],getUrlConfiguration:async()=>null,capabilityOverrides:{defaultUnavailableReason:"write_blocked"},evidenceHints:["Slack app manifests, bot/webhook URLs, SLACK_* environment variables, or slack.com links","Runbooks that route incidents, alerts, or deploy notices through Slack","Code or docs naming Slack channels for operational triage"],helpText:"Browse Slack messages, files, and threads. Coming soon — requires backend OAuth plumbing for user_scope and isn't self-serve connectable yet.",skill:"slack",setupSkill:"slack-setup"})});var xIA;var sIA=r(()=>{IA();xIA=m({id:"stripe",label:"Stripe MCP",iconKey:"stripe",defaultServerUrl:"https://mcp.stripe.com",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"stripe",callbackPathSegment:"stripe",authorizationUrl:"https://access.stripe.com/mcp/oauth2/authorize",tokenUrl:"https://access.stripe.com/mcp/oauth2/token",resourceUrl:"https://mcp.stripe.com",dynamicClientRegistration:{registrationEndpoint:"https://access.stripe.com/mcp/oauth2/register",tokenEndpointAuthMethod:"none"},defaultAccessTokenTtlSeconds:21600},getAvailableScopes:async()=>[{value:"mcp",label:"MCP access",description:"Access the Stripe MCP server tools for the connected account.",required:!0}],scopesUserSelectable:!1,getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Stripe dashboard URLs, `sk_`/`rk_`/`pk_` API keys, or Stripe object IDs (cus_, pi_, ch_)","STRIPE_* environment variables or code that imports the `stripe` SDK","README/runbooks naming Stripe for billing, payments, or subscriptions"],helpText:"Query and manage Stripe payments, customers, and billing."})});var qIA;var dIA=r(()=>{IA();qIA=m({id:"supabase",label:"Supabase",iconKey:"supabase",defaultServerUrl:"https://mcp.supabase.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"supabase",callbackPathSegment:"supabase",authorizationUrl:"https://api.supabase.com/v1/oauth/authorize",tokenUrl:"https://api.supabase.com/v1/oauth/token",dynamicClientRegistration:{registrationEndpoint:"https://api.supabase.com/platform/oauth/apps/register",tokenEndpointAuthMethod:"client_secret_post"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"analytics:read"},{value:"auth:read"},{value:"auth:write"},{value:"database:read"},{value:"database:write"},{value:"domains:read"},{value:"domains:write"},{value:"edge_functions:read"},{value:"edge_functions:write"},{value:"environment:read"},{value:"environment:write"},{value:"organizations:read"},{value:"projects:read"},{value:"projects:write"},{value:"rest:read"},{value:"rest:write"},{value:"secrets:read"},{value:"secrets:write"},{value:"storage:read"}],getUrlConfiguration:async()=>({docsUrl:"https://supabase.com/docs/guides/getting-started/mcp#step-2-configure-your-ai-tool",instructions:"Choose your project and options in the Supabase configuration panel, then copy the generated Server URL.",defaultServerUrl:"https://mcp.supabase.com/mcp",optional:!0}),capabilityOverrides:{allowWriteTools:!0},evidenceHints:["supabase/ directory, supabase/config.toml, or @supabase packages","SUPABASE_* or NEXT_PUBLIC_SUPABASE_* environment variables","README/docs naming Supabase for Postgres, Auth, Storage, or Edge Functions"],helpText:"Manage Supabase organizations, projects, databases, and run SQL.",skill:"supabase",setupSkill:"supabase-setup"})});var pIA;var AhA=r(()=>{IA();pIA=m({id:"superhuman",label:"Superhuman",iconKey:"superhuman",defaultServerUrl:"https://mcp.mail.superhuman.com/mcp",transport:"streamable-http",authMode:"oauth",availability:"enabled",oauth:{providerConfigKey:"superhuman",callbackPathSegment:"superhuman",authorizationUrl:"https://mcp.auth.mail.superhuman.com/oauth2/authorize",tokenUrl:"https://mcp.auth.mail.superhuman.com/oauth2/token",dynamicClientRegistration:{registrationEndpoint:"https://mcp.auth.mail.superhuman.com/oauth2/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"email",required:!0},{value:"offline_access",required:!0},{value:"openid",required:!0},{value:"profile",required:!0}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["Superhuman mail links, SUPERHUMAN_* environment variables, or support workflows naming Superhuman","Customer communication runbooks that depend on email search or drafting","Docs naming Superhuman Mail for sales, support, or founder-led customer comms"],helpText:"Search, draft, send, and triage emails in Superhuman Mail."})});var thA;var ghA=r(()=>{$t();IA();thA=m({id:"the-context-company",label:"The Context Company",iconKey:"the-context-company",defaultServerUrl:"https://api.thecontext.company/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{allowWriteTools:!1},evidenceHints:["The Context Company, context company, or context observability references","insight_search, get_agent_runs, or get_agent_sessions tool usage","THE_CONTEXT_COMPANY_API_KEY or api.thecontext.company in MCP configuration"],helpText:"Query agent insights, runs, and sessions through The Context Company's read-only hosted MCP server.",setupGroups:[{id:"api-key",title:"Create a read-only API key",description:"Create the API key The Context Company's hosted MCP server will use.",body:"Generate a read-only API key on The Context Company's [Access Data page](https://www.thecontextcompany.com/prod/mcp-and-api), then paste the raw key below. Sazabi sends it as `Authorization: Bearer <key>` to `https://api.thecontext.company/mcp`.",fieldKeys:["apiKey"]}],validateCredentials:weA,normalizeHeaders:yeA,skill:"the-context-company",setupSkill:"the-context-company-setup"})});var nhA;var ihA=r(()=>{IA();nhA=m({id:"vercel",label:"Vercel",iconKey:"vercel",defaultServerUrl:"https://mcp.vercel.com",transport:"streamable-http",authMode:"oauth",availability:"disabled",oauth:{providerConfigKey:"vercel",callbackPathSegment:"vercel",authorizationUrl:"https://vercel.com/oauth/authorize",tokenUrl:"https://vercel.com/api/login/oauth/token",resourceUrl:"https://mcp.vercel.com",dynamicClientRegistration:{registrationEndpoint:"https://vercel.com/api/login/oauth/register",tokenEndpointAuthMethod:"none"}},scopesUserSelectable:!1,getAvailableScopes:async()=>[{value:"openid",required:!0},{value:"offline_access",required:!0}],getUrlConfiguration:async()=>null,capabilityOverrides:{allowWriteTools:!0},evidenceHints:["vercel.com links, VERCEL_* environment variables, or a vercel.json in the repo","Deploy workflows or runbooks naming Vercel as the frontend/hosting provider","Vercel project/deployment IDs or preview URLs referenced in docs or CI"],helpText:"Manage Vercel projects, deployments, and access Vercel platform documentation. Coming soon — Vercel's hosted MCP only authorizes allowlisted clients and Sazabi is pending approval, so it isn't connectable yet."})});var ohA;var ehA=r(()=>{$t();IA();ohA=m({id:"x",label:"X",iconKey:"x",defaultServerUrl:"https://api.x.com/mcp",transport:"streamable-http",authMode:"headers",availability:"enabled",capabilityOverrides:{readOnlyToolNames:["search_news","get_news","get_trends_by_woeid","get_posts_by_ids","get_posts_counts_recent","search_posts_all","get_posts_by_id","get_posts_liking_users","get_posts_quoted_posts","get_posts_reposted_by","get_users_by_usernames","get_users_by_username","get_users_me","search_users","get_users_by_id","get_users_bookmarks","get_users_bookmark_folders","get_users_bookmarks_by_folder_id","get_users_mentions","get_users_timeline","get_users_posts"]},evidenceHints:["X (Twitter) API usage, X_BEARER_TOKEN, or TWITTER_* environment variables","twitter-api-v2, tweepy, or other X/Twitter API client packages","README/docs naming the X API, X Developer Platform, or tweet automation"],helpText:"Search X posts and access real-time X data using your app's app-only Bearer Token.",setupGroups:[{id:"developer-app",title:"Open the X Developer Portal",description:"Use an X developer project/app with access to the X API v2.",body:"Go to the [X Developer Portal](https://developer.x.com/en/portal/dashboard), open the project and app you want Sazabi to use, and confirm the app has access to the API tiers you need. The hosted MCP server lives at `https://api.x.com/mcp`."},{id:"bearer-token",title:"Copy the app's Bearer Token",description:"Copy the app-only Bearer Token the hosted MCP server will use.",body:"In your app's **Keys and tokens**, find the app-only **Bearer Token** and copy it (regenerate it if you don't have it saved). This is the app-only token, not a user OAuth 2.0 access token. Paste the raw token into Sazabi — Sazabi adds the `Bearer ` prefix and sends it in the `Authorization` header.",fieldKeys:["accessToken"]}],validateCredentials:DeA,normalizeHeaders:reA,skill:"x",setupSkill:"x-setup"})});var IhA,UGt;var hhA=r(()=>{peA();tQA();nQA();oQA();Fb();Fb();IQA();BQA();CQA();aQA();yQA();DQA();bQA();NQA();SQA();FQA();YQA();$QA();TQA();PQA();RQA();vQA();mQA();ZQA();HQA();jQA();_QA();sQA();dQA();AIA();gIA();iIA();eIA();IIA();BIA();CIA();aIA();yIA();DIA();bIA();NIA();SIA();FIA();YIA();$IA();TIA();PIA();RIA();vIA();mIA();ZIA();HIA();jIA();_IA();sIA();dIA();AhA();ghA();ihA();ehA();IhA=[qIA,JQA,fQA,deA,AQA,gQA,iQA,eQA,QQA,hQA,cQA,EQA,rQA,wQA,lQA,UQA,LQA,MQA,uQA,kQA,GQA,OQA,zQA,WQA,VQA,XQA,KQA,xQA,qQA,pQA,tIA,nIA,oIA,QIA,hIA,cIA,EIA,rIA,wIA,uIA,lIA,UIA,LIA,MIA,kIA,JIA,GIA,fIA,OIA,zIA,WIA,VIA,XIA,KIA,xIA,pIA,thA,nhA,ohA],UGt=new Map(IhA.map((A)=>[A.id,A]))});var BhA=()=>{};var chA=()=>{};var ChA=()=>{};var EhA=()=>{};var ahA=()=>{};var rhA=()=>{};var yhA=()=>{};var whA=()=>{};var DhA=()=>{};var uhA=()=>{};var bhA=()=>{};var lhA=()=>{};var NhA=()=>{};var UhA=()=>{};var ShA=()=>{};var LhA=()=>{};var FhA=()=>{};var MhA=()=>{};var YhA=()=>{};var khA=()=>{};var $hA=()=>{};var GhA=()=>{};var ThA=()=>{};var JhA=()=>{};var PhA=()=>{};var fhA=()=>{};var RhA=()=>{};var OhA=()=>{};var vhA=()=>{};var zhA=()=>{};var mhA=()=>{};var WhA=()=>{};var ZhA=()=>{};var VhA=()=>{};var HhA=()=>{};var XhA=()=>{};var jhA=()=>{};var KhA=()=>{};var _hA=()=>{};var xhA=()=>{};var shA=()=>{};var qhA=()=>{};var dhA=()=>{};var phA=()=>{};var ABA=r(()=>{BhA();chA();ChA();EhA();ahA();rhA();yhA();whA();DhA();uhA();bhA();lhA();NhA();UhA();ShA();LhA();FhA();MhA();YhA();khA();$hA();GhA();ThA();JhA();PhA();fhA();RhA();OhA();vhA();zhA();mhA();WhA();ZhA();VhA();HhA();XhA();jhA();KhA();_hA();xhA();shA();qhA();dhA();phA()});var tBA=r(()=>{Fb()});var gBA=()=>{};var nBA=r(()=>{kK();Uw();QeA();$t();jeA();KeA();hhA();Jf();ABA();tBA();gBA()});var iBA,i8A,oBA,o8A,eBA,Pf,QBA,IBA,Ie,hBA,BBA,cBA,QB,CBA,EBA,IB,aBA,rBA,hB,yBA,e8A,wBA,Mb,DBA,uBA,bBA,lBA,BB,NBA,UBA,cB,SBA,LBA,CB,ff,Rf,FBA,MBA,EB,YBA,kBA,aB,$BA,Q8A,rB,GBA,TBA,yB,JBA,PBA,wB,fBA,RBA,DB,I8A;var Of=r(()=>{nBA();JA();KA();iBA=["configured","authorizing","connected","error"],i8A=Q.enum(iBA),oBA=["preset","custom"],o8A=Q.enum(oBA),eBA=["streamable-http","sse"],Pf=Q.enum(eBA),QBA=["none","headers","oauth","aws-sigv4"],IBA=Q.enum(QBA),Ie=Q.object({connectionId:Q.string().uuid().describe("Connection ID."),connectionKey:Q.string().describe("Stable key used to reference this connector in tool calls."),providerId:Q.string().describe('Provider identifier, e.g. "linear".'),displayName:Q.string().describe("Human-readable connector name."),source:o8A.describe("Whether the connector is a built-in preset or a custom server."),installStatus:i8A.describe("Current connection lifecycle status."),authMode:IBA.describe("Authentication mode."),transport:Pf.describe("Transport protocol."),serverUrl:Q.string().describe("MCP server URL."),readOnly:Q.boolean().describe("Whether the connector is restricted to read-only tools."),management:Hk.describe("Lifecycle owner and supported connector mutations."),enabledToolCount:Q.number().int().nonnegative().describe("Number of tools enabled and available for this connector."),connectedAt:Q.string().datetime().nullable().describe("When the connector last became connected, if ever."),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),hBA=Q.object({name:Q.string().describe("Tool name as invoked."),title:Q.string().describe("Human-readable tool title."),description:Q.string().describe("Tool description."),isReadOnly:Q.boolean().describe("Whether the tool is considered read-only."),enabled:Q.boolean().describe("Whether the tool is enabled and available given the connector config.")}),BBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list connectors for. Auto-filled from SDK context when omitted."),connectedOnly:Q.union([Q.boolean(),Q.stringbool()]).optional().describe("When true, only return connectors that are connected.")}),cBA=Q.object({connectors:Q.array(Ie)}),QB=S({operationId:"mcpConnectors.list",description:"List configured MCP connectors within one project with provider, status, and enabled-tool count.",backend:"api",route:{method:"GET",path:"/mcp-connectors",tags:["MCP Connectors"]},input:BBA,output:cBA,pagination:"none",async:"sync"}),CBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to fetch."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),EBA=Q.object({connector:Ie}),IB=S({operationId:"mcpConnectors.get",description:"Get one configured MCP connector by connection ID.",backend:"api",route:{method:"GET",path:"/mcp-connectors/{connectionId}",tags:["MCP Connectors"]},input:CBA,output:EBA,pagination:"none",async:"sync"}),aBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to inspect."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),rBA=Q.object({connector:Ie,tools:Q.array(hBA)}),hB=S({operationId:"mcpConnectors.details",description:"Inspect one MCP connector's tool surface, including each tool's name, description, and read-only status.",backend:"api",route:{method:"GET",path:"/mcp-connectors/{connectionId}/details",tags:["MCP Connectors"]},input:aBA,output:rBA,pagination:"none",async:"sync"}),yBA=Q.object({providerId:Q.string().describe('Provider identifier, e.g. "linear".'),label:Q.string().describe("Human-readable provider name."),authMode:IBA.describe("Authentication mode."),availability:Q.enum(VI).describe("Whether the provider is enabled or coming soon."),setupSkill:Q.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),e8A=Q.object({}),wBA=Q.object({providers:Q.array(yBA)}),Mb=S({operationId:"mcpConnectors.listProviders",description:"List all supported MCP connector providers with their auth mode and setup skill.",backend:"api",route:{method:"GET",path:"/mcp-connectors/providers",tags:["MCP Connectors"]},input:e8A,output:wBA,pagination:"none",async:"sync"}),DBA=Q.object({connectionKey:Q.string().describe("Stable key used to call this connector."),displayName:Q.string().describe("Human-readable connector name."),providerId:Q.string().describe('Provider identifier, e.g. "linear".'),toolCount:Q.number().int().nonnegative().describe("Number of executable tools on this connector.")}),uBA=Q.object({connectionKey:Q.string().describe("Connector that exposes this tool."),toolName:Q.string().describe("Tool name as invoked."),providerId:Q.string().describe('Provider identifier, e.g. "linear".'),displayName:Q.string().describe("Human-readable connector name."),isReadOnly:Q.boolean().describe("Whether the tool is considered read-only."),description:Q.string().describe("Tool description from the stored snapshot."),score:Q.number().describe("BM25 rank score. Zero when enumerating a namespace."),inputSchema:Q.record(Q.string(),Q.unknown()).optional().describe("JSON Schema for the tool's arguments, when requested.")}),bBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to search connectors in. Auto-filled from SDK context when omitted."),query:Q.string().optional().describe("Free-text query over tool names, titles, connector keys, and descriptions. Omit or empty to list connectors, or to enumerate one connector when namespace is set."),namespace:Q.string().min(1).optional().describe("Restrict results to one connectionKey or providerId."),limit:Q.coerce.number().int().min(1).max(100).default(10).describe("Maximum number of connectors or tool hits to return."),offset:Q.coerce.number().int().min(0).default(0).describe("Number of connectors or tool hits to skip."),includeInputSchema:Q.union([Q.boolean(),Q.stringbool()]).optional().describe("When true, tool hits include inputSchema so a caller can execute without a describe round-trip.")}),lBA=Q.object({kind:Q.enum(["connectors","tools"]).describe("connectors when the query is empty and no namespace is set; tools otherwise."),total:Q.number().int().nonnegative().describe("Total matches before limit and offset."),connectors:Q.array(DBA).describe("Connector index. Empty when kind is tools."),tools:Q.array(uBA).describe("Ranked or enumerated tool hits. Empty when kind is connectors.")}),BB=S({operationId:"mcpConnectors.search",description:"Search executable third-party MCP connector tools by free-text query. Empty query lists connectors; empty query plus namespace enumerates that connector. Hits omit input schemas unless includeInputSchema is true.",backend:"api",route:{method:"GET",path:"/mcp-connectors/tools/search",tags:["MCP Connectors"]},input:bBA,output:lBA,pagination:"none",async:"sync"}),NBA=Q.object({projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),connectionKey:Q.string().min(1).describe("Connector key from search or mcpConnectors.list."),toolName:Q.string().min(1).describe("Tool name as invoked.")}),UBA=Q.object({connectionKey:Q.string().describe("Connector that exposes this tool."),toolName:Q.string().describe("Tool name as invoked."),providerId:Q.string().describe('Provider identifier, e.g. "linear".'),displayName:Q.string().describe("Human-readable connector name."),title:Q.string().describe("Human-readable tool title."),description:Q.string().describe("Tool description from the stored snapshot."),isReadOnly:Q.boolean().describe("Whether the tool is considered read-only."),inputSchema:Q.record(Q.string(),Q.unknown()).describe("JSON Schema for the tool's arguments.")}),cB=S({operationId:"mcpConnectors.describe",description:"Load one executable third-party MCP connector tool, including its input schema.",backend:"api",route:{method:"GET",path:"/mcp-connectors/tools/describe",tags:["MCP Connectors"]},input:NBA,output:UBA,pagination:"none",async:"sync"}),SBA=Q.object({projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),connectionKey:Q.string().min(1).describe("Connector key from search or mcpConnectors.list."),toolName:Q.string().min(1).describe("Tool name as invoked."),arguments:Q.record(Q.string(),Q.unknown()).optional().describe("Arguments matching the tool's input schema.")}),LBA=Q.discriminatedUnion("ok",[Q.object({ok:Q.literal(!0),connectionKey:Q.string().describe("Connector that ran the tool."),toolName:Q.string().describe("Tool name as invoked."),result:Q.unknown().describe("Vendor tool result payload."),structuredContent:Q.unknown().optional().describe("Structured content from the vendor when present."),content:Q.array(Q.record(Q.string(),Q.unknown())).describe("Raw MCP content parts from the vendor."),text:Q.string().nullable().describe("Concatenated text content, if any.")}),Q.object({ok:Q.literal(!1),code:Q.enum(["TOOL_NOT_ENABLED","READ_ONLY","MCP_ERROR"]).describe("Why the tool did not run."),message:Q.string().describe("Caller-facing error message.")})]),CB=S({operationId:"mcpConnectors.call",description:"Invoke one executable third-party MCP connector tool using that connection's stored credential.",backend:"api",route:{method:"POST",path:"/mcp-connectors/tools/call",tags:["MCP Connectors"]},input:SBA,output:LBA,pagination:"none",async:"sync"}),ff=Q.object({id:Q.string().min(1).describe("Stable ID for this header (must be unique within the connector)."),name:Q.string().trim().min(1).describe("HTTP header name."),value:Q.string().min(1).describe("HTTP header value (passed verbatim).")}),Rf=Q.object({accessKeyId:Q.string().trim().min(1).describe("AWS access key ID."),secretAccessKey:Q.string().min(1).describe("AWS secret access key."),sessionToken:Q.string().min(1).optional().describe("Optional session token for temporary credentials."),region:Q.string().trim().min(1).describe("AWS region.")}),FBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to create the connector in. Auto-filled from SDK context when omitted."),serverUrl:Q.string().url().describe("MCP server URL (must be https)."),transport:Pf.describe("Transport protocol."),headers:Q.array(ff).optional().describe("HTTP headers to send with each request."),awsSigV4:Rf.optional().describe("AWS SigV4 credentials for AWS MCP servers."),providerId:Q.string().min(1).describe("Built-in preset provider ID (for example, linear or datadog)."),readOnly:Q.boolean().optional().describe("Restrict the connector to read-only tools. Defaults to false.")}),MBA=Q.object({connector:Ie}),EB=S({operationId:"mcpConnectors.create",description:"Create a preset MCP connector with header-based or AWS SigV4 authentication. The server URL must match the selected provider's supported endpoints. Connects immediately and returns the connector with its discovered tool snapshot.",backend:"api",route:{method:"POST",path:"/mcp-connectors",tags:["MCP Connectors"],successStatus:201},input:FBA,output:MBA,pagination:"none",async:"sync"}),YBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to update."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),serverUrl:Q.string().url().optional().describe("New MCP server URL."),transport:Pf.optional().describe("New transport protocol."),headers:Q.array(ff).optional().describe("Complete replacement header set. Replaces all existing headers."),awsSigV4:Rf.optional().describe("Replacement AWS SigV4 credentials. Mutually exclusive with headers.")}),kBA=Q.object({connector:Ie}),aB=S({operationId:"mcpConnectors.update",description:"Deprecated. Preset MCP connector updates are no longer supported via the public API; disconnect and reconnect instead.",backend:"api",route:{method:"PATCH",path:"/mcp-connectors/{connectionId}",tags:["MCP Connectors"]},input:YBA,output:kBA,pagination:"none",async:"sync"}),$BA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to disconnect."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),Q8A=Q.void(),rB=S({operationId:"mcpConnectors.disconnect",description:"Disconnect and permanently remove an MCP connector.",backend:"api",route:{method:"DELETE",path:"/mcp-connectors/{connectionId}",tags:["MCP Connectors"],successStatus:204},input:$BA,output:Q8A,pagination:"none",async:"sync"}),GBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID to update."),projectId:Q.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),readOnly:Q.boolean().describe("True to restrict to read-only tools; false to allow all enabled tools.")}),TBA=Q.object({connector:Ie}),yB=S({operationId:"mcpConnectors.setReadOnly",description:"Toggle the read-only restriction on an MCP connector.",backend:"api",route:{method:"PATCH",path:"/mcp-connectors/{connectionId}/read-only",tags:["MCP Connectors"]},input:GBA,output:TBA,pagination:"none",async:"sync"}),JBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to install into. Auto-filled from SDK context when omitted."),providerId:Q.string().min(1).describe('Provider ID to install, e.g. "linear".'),requestedScopes:Q.array(Q.string()).optional().describe("Scopes to request. Defaults to the provider's recommended scope set."),serverUrl:Q.string().url().optional().describe("Server URL for multi-region providers; defaults to the provider's primary server."),readOnly:Q.boolean().optional().describe("Restrict the connector to read-only tools after install. Defaults to false."),returnTo:Q.string().optional().describe("Path to redirect the user to after OAuth completes.")}),PBA=Q.object({authorizationUrl:Q.string().describe("Authorization URL to open in the user's browser."),connectionId:Q.string().uuid().describe("Connection ID to poll for completion via getMcpOAuthInstallAttempt."),expiresAt:Q.string().datetime().describe("When the OAuth authorization attempt expires.")}),wB=S({operationId:"mcpConnectors.beginOAuthInstall",description:"Begin an OAuth browser flow to install a preset MCP connector. Opens an authorization URL in the user's browser; poll getMcpOAuthInstallAttempt with the returned connectionId to check completion.",backend:"api",route:{method:"POST",path:"/mcp-connectors/oauth/begin",tags:["MCP Connectors"],successStatus:201},input:JBA,output:PBA,pagination:"none",async:"sync"}),fBA=Q.object({connectionId:Q.string().uuid().describe("Connection ID returned by beginMcpOAuthInstall."),projectId:Q.string().uuid().optional().describe("Project the connection belongs to. Auto-filled from SDK context when omitted.")}),RBA=Q.object({status:Q.enum(["authorizing","connected","error"]).describe("Current install status."),connector:Ie.optional().describe("Connector details once connected or in error state.")}),DB=S({operationId:"mcpConnectors.getOAuthInstallAttempt",description:"Poll the status of an in-progress OAuth MCP connector install. Returns authorizing while the user completes the browser flow, connected on success, or error on failure.",backend:"api",route:{method:"GET",path:"/mcp-connectors/oauth/attempts/{connectionId}",tags:["MCP Connectors"]},input:fBA,output:RBA,pagination:"none",async:"sync"}),I8A={list:QB.contract,get:IB.contract,details:hB.contract,listProviders:Mb.contract,search:BB.contract,describe:cB.contract,call:CB.contract,create:EB.contract,update:aB.contract,disconnect:rB.contract,setReadOnly:yB.contract,beginOAuthInstall:wB.contract,getOAuthInstallAttempt:DB.contract}});var he,h8A,B8A,c8A,C8A,E8A,a8A,r8A,vf,cRt;var Yb=r(()=>{JA();KA();he=Q.enum(["admin","member"]),h8A=Q.object({id:Q.string().min(1),name:Q.string(),slug:Q.string(),logo:Q.string().nullable().optional(),role:he}),B8A=Q.object({id:Q.string().min(1),name:Q.string().nullable(),email:Q.string().email()}),c8A=Q.object({credentialType:Q.literal("user"),user:B8A,activeOrganizationId:Q.string().min(1).nullable(),authorizedOrganizationId:Q.string().min(1).nullable(),authorizedProjectId:Q.string().min(1).nullable(),organizations:Q.array(h8A).describe("Organizations the user belongs to, including membership role.")}),C8A=Q.object({credentialType:Q.literal("secret"),organization:Q.object({id:Q.string().min(1),name:Q.string(),slug:Q.string(),logo:Q.string().nullable().optional()}),keyName:Q.string()}),E8A=Q.object({credentialType:Q.literal("partner"),superorganization:Q.object({id:Q.string().uuid(),name:Q.string()})}),a8A=Q.object({}),r8A=Q.discriminatedUnion("credentialType",[c8A,C8A,E8A]),vf=S({operationId:"me.get",description:"Return the identity and available context for the current credential.",backend:"api",route:{method:"GET",path:"/me",tags:["Auth"]},input:a8A,output:r8A,pagination:"none",async:"sync"}),cRt=vf.contract});var OBA,vBA,zBA,y8A,w8A,D8A,u8A,b8A,l8A,zf,mf,Wf,N8A,U8A,S8A,L8A,F8A,M8A,Zf,Vf,Hf,yRt;var mBA=r(()=>{JA();KA();Yb();OBA=Q.object({membershipId:Q.string().min(1).describe("Organization membership record ID."),userId:Q.string().min(1).describe("User ID for the organization member."),name:Q.string().nullable().describe("Display name for the member, when available."),email:Q.string().email().describe("Email address for the member."),imageUrl:Q.string().nullable().describe("Profile image URL for the member, when available."),role:he.describe("Organization role."),createdAt:Q.string().datetime().describe("When the membership was created.")}),vBA=Q.object({id:Q.string().min(1).describe("Invitation ID."),email:Q.string().email().describe("Invited email address."),role:he.describe("Role the invitee will receive when they accept."),status:Q.string().min(1).describe('Invitation status (e.g. "pending").'),createdAt:Q.string().datetime().describe("When the invitation was created."),expiresAt:Q.string().datetime().describe("When the invitation expires.")}),zBA=Q.string().min(1).describe("A user ID, or a URL-encoded email address, of the member."),y8A=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to list members for. Auto-filled from CLI and SDK context when omitted.")}),w8A=Q.object({members:Q.array(OBA).describe("Members visible within the selected organization.")}),D8A=Q.object({organizationId:Q.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted."),member:zBA.describe("User ID, or URL-encoded email address, of the member to update."),role:he.describe("Role to assign.")}),u8A=Q.object({member:OBA.describe("Updated organization member.")}),b8A=Q.object({params:Q.object({member:zBA.describe("User ID, or URL-encoded email address, of the member to remove.")}),query:Q.object({organizationId:Q.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted.")})}).transform(({params:A,query:t})=>({...t,...A})),l8A=Q.object({removedUserId:Q.string().min(1).describe("User ID removed from the organization.")}),zf=S({operationId:"members.list",description:"List members in an organization.",backend:"api",route:{method:"GET",path:"/members",tags:["Members"]},input:y8A,output:w8A,pagination:"none",async:"sync",examples:[{name:"organization-members",input:{organizationId:"organization-123"},output:{members:[{membershipId:"membership-123",userId:"user-123",name:"Alex Admin",email:"alex@example.com",imageUrl:null,role:"admin",createdAt:"2026-01-01T00:00:00.000Z"}]}}]}),mf=S({operationId:"members.updateRole",description:"Update a member's organization role.",backend:"api",route:{method:"PATCH",path:"/members/{member}/role",tags:["Members"]},input:D8A,output:u8A,pagination:"none",async:"sync",examples:[{name:"promote-member",input:{organizationId:"organization-123",member:"user-456",role:"admin"},output:{member:{membershipId:"membership-456",userId:"user-456",name:"Mina Member",email:"mina@example.com",imageUrl:null,role:"admin",createdAt:"2026-01-01T00:00:00.000Z"}}}]}),Wf=S({operationId:"members.remove",description:"Remove a member from an organization.",backend:"api",route:{method:"DELETE",path:"/members/{member}",tags:["Members"],inputStructure:"detailed"},input:b8A,output:l8A,pagination:"none",async:"sync"}),N8A=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to invite into. Auto-filled from CLI and SDK context when omitted."),email:Q.string().email().describe("Email address to invite."),role:he.optional().default("member").describe('Role to grant on acceptance. Defaults to "member".')}),U8A=Q.object({invitation:vBA.describe("The created pending invitation.")}),S8A=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to list invitations for. Auto-filled from CLI and SDK context when omitted.")}),L8A=Q.object({invitations:Q.array(vBA).describe("Pending invitations visible within the selected organization.")}),F8A=Q.object({params:Q.object({invitationId:Q.string().min(1).describe("ID of the invitation to revoke.")}),query:Q.object({organizationId:Q.string().min(1).optional().describe("Organization containing the invitation. Auto-filled from CLI and SDK context when omitted.")})}).transform(({params:A,query:t})=>({...t,...A})),M8A=Q.object({revokedInvitationId:Q.string().min(1).describe("ID of the revoked invitation.")}),Zf=S({operationId:"members.invite",description:"Invite a person to the organization by email.",backend:"api",route:{method:"POST",path:"/members/invitations",tags:["Members"],successStatus:201},input:N8A,output:U8A,pagination:"none",async:"sync",examples:[{name:"invite-member",input:{organizationId:"organization-123",email:"newhire@example.com",role:"member"},output:{invitation:{id:"invitation-123",email:"newhire@example.com",role:"member",status:"pending",createdAt:"2026-01-01T00:00:00.000Z",expiresAt:"2026-01-08T00:00:00.000Z"}}}]}),Vf=S({operationId:"members.listInvitations",description:"List pending invitations for an organization.",backend:"api",route:{method:"GET",path:"/members/invitations",tags:["Members"]},input:S8A,output:L8A,pagination:"none",async:"sync",examples:[{name:"organization-invitations",input:{organizationId:"organization-123"},output:{invitations:[{id:"invitation-123",email:"newhire@example.com",role:"member",status:"pending",createdAt:"2026-01-01T00:00:00.000Z",expiresAt:"2026-01-08T00:00:00.000Z"}]}}]}),Hf=S({operationId:"members.revokeInvitation",description:"Revoke a pending invitation.",backend:"api",route:{method:"DELETE",path:"/members/invitations/{invitationId}",tags:["Members"],inputStructure:"detailed"},input:F8A,output:M8A,pagination:"none",async:"sync"}),yRt={list:zf.contract,updateRole:mf.contract,remove:Wf.contract,invite:Zf.contract,listInvitations:Vf.contract,revokeInvitation:Hf.contract}});var ZBA,VBA,kb,HBA,$b,WBA=4194304,Xf,jf,Y8A=(A)=>{let t=A.split(",").map((i)=>i.trim()).filter(Boolean),g=Q.array(kb).safeParse(t);if(!g.success)throw Error("Kind filter must be a comma-separated list of note, runbook, or change.");return g.data},dE,Kf,_f,XBA,jBA,KBA,_BA,xBA,sBA,qBA,dBA,pBA,AcA,tcA,gcA,uB,bB,lB,NB,UB,k8A;var xf=r(()=>{JA();KA();ZBA=["note","runbook"],VBA=["note","runbook","change"],kb=Q.enum(VBA),HBA=Q.enum(ZBA),$b=Q.string().min(1).max(512).refine((A)=>!A.startsWith("/"),{message:"Path must be relative without a leading slash."}).describe("Relative memory path, for example AGENTS.md or notes/architecture.md."),Xf=Q.string().min(1).refine((A)=>new TextEncoder().encode(A).length<=WBA,{message:`Memory body must be at most ${WBA} bytes (4 MiB).`}).describe("Document body stored in project memory."),jf=Q.string().regex(/^(\d+)(s|m|h|d)$/u,"Duration must use s, m, h, or d units, for example 7d or 30m.").describe("Relative time window, for example 7d or 30m."),dE=Q.string().min(1).transform(Y8A).describe("Comma-separated kinds, for example note,runbook."),Kf=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),kind:kb,managed:Q.boolean(),path:Q.string().nullable(),title:Q.string().nullable(),contentHash:Q.string(),attrs:Q.record(Q.string(),Q.unknown()),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),_f=Kf.extend({body:Xf}),XBA=Q.object({projectId:Q.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),path:$b.describe("Relative path for the curated document."),body:Xf,kind:HBA.default("note").describe("Curated document kind. Only note and runbook may be written through the API."),title:Q.string().max(500).optional().describe("Optional display title. Defaults to the path basename.")}),jBA=Q.object({document:_f}),KBA=Q.object({projectId:Q.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),id:Q.string().uuid().optional().describe("Document id."),path:$b.optional().describe("Relative curated path.")}).superRefine((A,t)=>{let g=A.id!==void 0,i=A.path!==void 0;if(g===i)t.addIssue({code:"custom",message:"Provide exactly one of id or path."})}),_BA=Q.object({document:_f}),xBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list memory for. Auto-filled from CLI and SDK context when omitted."),kind:dE.optional(),since:jf.optional().describe("Only return documents updated within this window, for example 7d."),service:Q.string().min(1).optional().describe("Filter to documents whose attrs.services contains this value."),pathPrefix:Q.string().min(1).optional().describe("Filter to paths starting with this prefix."),managed:Q.coerce.boolean().optional(),cursor:Q.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of documents to return per page.")}),sBA=Q.object({documents:Q.array(Kf),nextCursor:Q.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),qBA=Q.object({documentId:Q.string().uuid(),kind:kb,managed:Q.boolean(),path:Q.string().nullable(),title:Q.string().nullable(),snippet:Q.string(),score:Q.number()}),dBA=Q.object({calibrated:Q.literal(!0),minScoreThreshold:Q.number(),queryTerms:Q.array(Q.string()),message:Q.string()}),pBA=Q.object({projectId:Q.string().uuid().optional().describe("Project to search memory for. Auto-filled from CLI and SDK context when omitted."),query:Q.string().trim().min(1).max(500).describe("Natural-language search query."),kind:dE.optional(),since:jf.optional(),service:Q.string().min(1).optional(),pathPrefix:Q.string().min(1).optional(),managed:Q.coerce.boolean().optional(),limit:Q.coerce.number().int().min(1).max(50).default(10).describe("Maximum ranked search hits to return.")}),AcA=Q.object({hits:Q.array(qBA),emptyVerdict:dBA.nullable()}),tcA=Q.object({projectId:Q.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),id:Q.string().uuid().optional().describe("Document id."),path:$b.optional()}).superRefine((A,t)=>{let g=A.id!==void 0,i=A.path!==void 0;if(g===i)t.addIssue({code:"custom",message:"Provide exactly one of id or path."})}),gcA=Q.object({deleted:Q.boolean()}),uB=S({operationId:"memory.put",description:"Create or replace a curated project memory document. Embeds on success.",backend:"api",route:{method:"PUT",path:"/memory",tags:["Memory"]},input:XBA,output:jBA,pagination:"none",async:"sync"}),bB=S({operationId:"memory.get",description:"Get one project memory document by id or path.",backend:"api",route:{method:"GET",path:"/memory/document",tags:["Memory"]},input:KBA,output:_BA,pagination:"none",async:"sync"}),lB=S({operationId:"memory.list",description:"List project memory catalog rows without embedding search.",backend:"api",route:{method:"GET",path:"/memory",tags:["Memory"]},input:xBA,output:sBA,pagination:"cursor",async:"sync"}),NB=S({operationId:"memory.search",description:"Hybrid semantic and keyword search over project memory documents.",backend:"api",route:{method:"POST",path:"/memory/search",tags:["Memory"]},input:pBA,output:AcA,pagination:"none",async:"sync"}),UB=S({operationId:"memory.delete",description:"Soft-delete a curated project memory document by id or path.",backend:"api",route:{method:"DELETE",path:"/memory/document",successStatus:204,tags:["Memory"]},input:tcA,output:gcA,pagination:"none",async:"sync"}),k8A={put:uB.contract,get:bB.contract,list:lB.contract,search:NB.contract,delete:UB.contract}});var ncA,icA,$8A,G8A,T8A,J8A,P8A,pE,f8A,R8A,O8A,sf,qf,df,pf,URt;var Gb=r(()=>{JA();KA();ncA=Q.enum(["processing","completed","aborted","error"]),icA=Q.object({id:Q.string().uuid(),threadId:Q.string().uuid(),userMessageId:Q.string().uuid().nullable(),assistantMessageId:Q.string().uuid().nullable(),parentRunId:Q.string().uuid().nullable(),workflowRunId:Q.string().nullable(),status:ncA,source:Q.enum(["app","api","mcp","slack","teams","linear","github","agent","cli","web","sdk","bitbucket","system"]),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime(),completedAt:Q.string().datetime().nullable()}),$8A=Q.object({projectId:Q.string().uuid().optional().describe("Project ID to list runs for. Auto-filled from CLI and SDK context when omitted."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:Q.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),G8A=Q.object({runs:Q.array(icA),nextCursor:Q.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),T8A=Q.object({threadId:Q.string().uuid().describe("Thread ID to list runs for."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:Q.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),J8A=Q.object({runs:Q.array(icA),nextCursor:Q.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),P8A=Q.object({runId:Q.string().uuid().describe("Run ID returned by a deferred operation.")}),pE=Q.object({completed:Q.boolean().describe("Whether the run has reached a terminal status."),threadId:Q.string().uuid().describe("Thread ID associated with the run."),runId:Q.string().uuid().describe("Run ID for subsequent polling."),messageId:Q.string().uuid().optional().describe("ID of the user message that triggered this run."),status:ncA.describe("Current run lifecycle status."),response:Q.string().nullable().describe("Assistant response text when the run has completed.")}),f8A=pE.describe("Current run state and, when complete, the assistant response."),R8A=Q.object({runId:Q.string().uuid().describe("Run ID of the in-flight run to request cancellation for.")}),O8A=Q.object({success:Q.literal(!0).describe("Always true when the cancellation request was accepted.")}),sf=S({operationId:"runs.list",description:"List deferred runs within one project.",backend:"api",route:{method:"GET",path:"/runs",tags:["Runs"]},input:$8A,output:G8A,pagination:"cursor",async:"sync"}),qf=S({operationId:"runs.listForThread",summary:"List Runs for a Thread",description:"List deferred runs for one thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/runs",tags:["Runs"]},input:T8A,output:J8A,pagination:"cursor",async:"sync"}),df=S({operationId:"runs.get",description:"Get the current result for a deferred run by run ID.",backend:"api",route:{method:"GET",path:"/runs/{runId}",tags:["Runs"]},input:P8A,output:f8A,pagination:"none",async:"sync",examples:[{name:"processing-run",input:{runId:"33333333-3333-4333-8333-333333333333"},output:{completed:!1,threadId:"22222222-2222-4222-8222-222222222222",runId:"33333333-3333-4333-8333-333333333333",status:"processing",response:null}}]}),pf=S({operationId:"runs.cancel",description:"Request cancellation of an in-flight run. Idempotent and best-effort: returns success even when the run has already reached a terminal status.",backend:"api",route:{method:"POST",path:"/runs/{runId}/cancel",tags:["Runs"]},input:R8A,output:O8A,pagination:"none",async:"sync",examples:[{name:"cancel-processing-run",input:{runId:"33333333-3333-4333-8333-333333333333"},output:{success:!0}}]}),URt={list:sf.contract,listForThread:qf.contract,get:df.contract,cancel:pf.contract}});var Tb=(A,t,g)=>{let i=t?20000:1e4;if(A.length>i)g.addIssue({code:"too_big",maximum:i,type:"string",inclusive:!0,message:`Message cannot exceed ${i} characters`,origin:"string",path:["message"]})},Jb=(A,t,g)=>{if(A&&!t)g.addIssue({code:"custom",message:"ambientServiceRun requires an automationId",path:["ambientServiceRun"]})};var ocA,Aa,v8A,z8A,m8A,W8A,Z8A,V8A,H8A,X8A,j8A,AR,K8A,_8A,x8A,s8A,q8A,d8A,p8A,A5A,t5A,g5A,n5A,i5A,tR,gR,nR,iR,oR,eR,ecA,o5A,e5A,Q5A,I5A,QcA,h5A,B5A,c5A,C5A,E5A,a5A,TQ="22222222-2222-4222-8222-222222222222",IcA="11111111-1111-4111-8111-111111111111",r5A="44444444-4444-4444-8444-444444444444",hcA="55555555-5555-4555-8555-555555555555",QR,IR,hR,BR,cR,$Rt;var CR=r(()=>{JA();KA();Gb();ocA=Q.enum(["slack","teams","linear","github","app","mcp","agent","api","cli","web","sdk","bitbucket","system"]),Aa=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),title:Q.string().nullable(),status:Q.enum(["regular","archived"]),source:ocA.nullable(),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),v8A=Q.object({type:Q.literal("message"),message:Q.string()}),z8A=Q.object({type:Q.literal("reasoning"),reasoning:Q.string(),status:Q.enum(["in_progress","complete"]).optional()}),m8A=Q.object({type:Q.literal("tool_call"),name:Q.string(),params:Q.any().optional(),result:Q.any().optional(),status:Q.enum(["in_progress","success","error","unknown"]).optional(),toolCallId:Q.string().optional(),durationMs:Q.number().nonnegative().optional()}),W8A=Q.object({type:Q.literal("artifact"),name:Q.enum(["timeseries","table","log_detail","integration_required","alert_card","issue_card","mdx"]),data:Q.any(),toolCallId:Q.string().optional()}),Z8A=Q.object({type:Q.literal("fork"),sourceThreadId:Q.string(),sourceMessageId:Q.string(),sourceThreadTitle:Q.string().nullable()}),V8A=Q.object({type:Q.literal("summary"),summary:Q.string()}),H8A=Q.object({type:Q.literal("slack_context"),channelId:Q.string(),isTruncated:Q.boolean().optional(),messages:Q.array(Q.object({timestamp:Q.string(),slackUserId:Q.string().optional(),displayName:Q.string(),text:Q.string(),isBot:Q.boolean(),files:Q.array(Q.object({name:Q.string(),mimetype:Q.string(),size:Q.number().optional(),attachmentId:Q.string().uuid().optional(),ingestionStatus:Q.enum(["attached","unsupported","oversized","skipped","unavailable"]).optional()})).optional()}))}),X8A=Q.object({type:Q.literal("teams_context"),conversationId:Q.string(),isTruncated:Q.boolean().optional(),messages:Q.array(Q.object({activityId:Q.string().optional(),displayName:Q.string(),text:Q.string(),isBot:Q.boolean(),createdDateTime:Q.string().optional()}))}),j8A=Q.union([v8A,z8A,m8A,W8A,Z8A,V8A,H8A,X8A]),AR=Q.object({id:Q.string().uuid(),role:Q.enum(["user","assistant"]),content:Q.array(j8A),source:ocA,createdAt:Q.string().datetime()}),K8A=Q.object({projectId:Q.string().uuid().optional().describe("Project to list threads for. Auto-filled from CLI and SDK context when omitted."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of threads to return per page."),cursor:Q.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:Q.enum(["regular","archived"]).optional().describe("Filter by thread status. 'regular' returns active threads, 'archived' returns archived threads.")}),_8A=Q.object({threads:Q.array(Aa).describe("The page of threads matching the query."),nextCursor:Q.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),x8A=Q.object({threadId:Q.string().uuid().describe("Thread ID returned by threads.list or threads.create.")}),s8A=Q.object({thread:Aa.describe("The requested thread."),messages:Q.array(AR).describe("Messages currently stored on the thread in chronological order.")}),q8A=Q.object({projectId:Q.string().uuid().optional().describe("Project to create the thread in. Auto-filled from CLI and SDK context when omitted."),message:Q.string().min(1,"Message cannot be empty").describe("Initial user message that starts the thread."),wait:Q.boolean().default(!0).describe("Whether the server should wait for the agent run before responding."),timeoutSeconds:Q.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:Q.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:Q.literal(!0).optional().describe("Internal marker for scheduler-originated ambient service work. Honored only for system secret-key requests with matching automation context.")}).superRefine((A,t)=>{Tb(A.message,A.automationId,t),Jb(A.ambientServiceRun,A.automationId,t)}),d8A=pE.describe("Deferred run result for creating a thread."),p8A=Q.object({threadId:Q.string().uuid().describe("Thread ID whose current processing status should be returned.")}),A5A=Q.object({status:Q.enum(["idle","processing"]),lastRunStatus:Q.enum(["error"]).nullable()}),t5A=Q.object({threadId:Q.string().uuid().describe("Thread ID whose active run should be stopped.")}),g5A=Q.object({success:Q.literal(!0).describe("Always true when the stop request was accepted.")}),n5A=Q.object({threadId:Q.string().uuid().describe("Thread ID of the thread to update."),status:Q.enum(["regular","archived"]).describe("New status for the thread. 'archived' hides the thread from the sidebar.")}),i5A=Q.object({thread:Aa.describe("The updated thread.")}),tR=S({operationId:"threads.list",description:"List threads in a project, optionally filtered by status.",backend:"api",route:{method:"GET",path:"/threads",tags:["Threads"]},input:K8A,output:_8A,pagination:"cursor",async:"sync",examples:[{name:"active-threads",input:{projectId:"11111111-1111-4111-8111-111111111111",status:"regular",limit:10},output:{threads:[{id:"22222222-2222-4222-8222-222222222222",projectId:"11111111-1111-4111-8111-111111111111",title:"API returning 500s",status:"regular",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:05:00.000Z"}],nextCursor:null}}]}),gR=S({operationId:"threads.get",description:"Get a thread and its messages.",backend:"api",route:{method:"GET",path:"/threads/{threadId}",tags:["Threads"]},input:x8A,output:s8A,pagination:"none",async:"sync"}),nR=S({operationId:"threads.getStatus",description:"Get the current processing status for a thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/status",tags:["Threads"]},input:p8A,output:A5A,pagination:"none",async:"sync",examples:[{name:"processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{status:"processing",lastRunStatus:null}}]}),iR=S({operationId:"threads.stop",description:"Stop a thread's in-flight run. Idempotent and best-effort: returns success even when the thread has no active run.",backend:"api",route:{method:"POST",path:"/threads/{threadId}/stop",tags:["Threads"]},input:t5A,output:g5A,pagination:"none",async:"sync",examples:[{name:"stop-processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{success:!0}}]}),oR=S({operationId:"threads.create",description:"Create a thread with an initial message and optionally wait for the agent response.",backend:"api",route:{method:"POST",path:"/threads",tags:["Threads"],successStatus:201},input:q8A,output:d8A,pagination:"none",async:"deferred",examples:[{name:"async-handoff",input:{projectId:"11111111-1111-4111-8111-111111111111",message:"Investigate elevated 500s in production.",wait:!1,timeoutSeconds:20},output:{completed:!1,threadId:"22222222-2222-4222-8222-222222222222",runId:"33333333-3333-4333-8333-333333333333",status:"processing",response:null}}]}),eR=S({operationId:"threads.update",description:"Update a thread's status.",backend:"api",route:{method:"PATCH",path:"/threads/{threadId}",tags:["Threads"]},input:n5A,output:i5A,pagination:"none",async:"sync",examples:[{name:"archive-thread",input:{threadId:"22222222-2222-4222-8222-222222222222",status:"archived"},output:{thread:{id:"22222222-2222-4222-8222-222222222222",projectId:"11111111-1111-4111-8111-111111111111",title:"API returning 500s",status:"archived",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:10:00.000Z"}}}]}),ecA=Q.enum(["private","organization"]),o5A=Q.object({threadId:Q.string().uuid().describe("Thread ID of the source thread to fork."),messageId:Q.string().uuid().describe("Message ID in the source thread to fork from. The new thread copies messages up to and including this message.")}),e5A=Q.object({thread:Aa.describe("The newly created forked thread.")}),Q5A=Q.object({threadId:Q.string().uuid().describe("Thread ID of the thread to update."),visibility:ecA.describe("New visibility. 'private' restricts the thread to its owner; 'organization' shares it with the organization.")}),I5A=Q.object({thread:Aa.describe("The updated thread."),visibility:ecA.describe("The thread's resulting visibility.")}),QcA=Q.object({shareId:Q.string().uuid().describe("Unique identifier for the snapshot."),threadId:Q.string().uuid().describe("Thread the snapshot was taken from."),url:Q.string().describe("Public read-only URL for the snapshot."),createdAt:Q.string().datetime()}),h5A=Q.object({threadId:Q.string().uuid().describe("Thread ID to create a public read-only snapshot for.")}),B5A=Q.object({share:QcA.describe("The created share link.")}),c5A=Q.object({threadId:Q.string().uuid().describe("Thread ID the snapshot belongs to."),shareId:Q.string().uuid().describe("Snapshot ID to revoke.")}),C5A=Q.void(),E5A=Q.object({threadId:Q.string().uuid().describe("Thread ID to list public snapshots for.")}),a5A=Q.object({shares:Q.array(QcA).describe("Active share links for the thread.")}),QR=S({operationId:"threads.fork",description:"Fork a thread from a specific message, creating a new thread that copies messages up to that point.",backend:"api",route:{method:"POST",path:"/threads/{threadId}/fork",tags:["Threads"],successStatus:201},input:o5A,output:e5A,pagination:"none",async:"sync",examples:[{name:"fork-from-message",input:{threadId:TQ,messageId:r5A},output:{thread:{id:"66666666-6666-4666-8666-666666666666",projectId:IcA,title:"API returning 500s (fork)",status:"regular",source:"api",createdAt:"2026-01-01T00:20:00.000Z",updatedAt:"2026-01-01T00:20:00.000Z"}}}]}),IR=S({operationId:"threads.setVisibility",description:"Set a thread's visibility to private or organization.",backend:"api",route:{method:"PATCH",path:"/threads/{threadId}/visibility",tags:["Threads"]},input:Q5A,output:I5A,pagination:"none",async:"sync",examples:[{name:"make-private",input:{threadId:TQ,visibility:"private"},output:{thread:{id:TQ,projectId:IcA,title:"API returning 500s",status:"regular",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:30:00.000Z"},visibility:"private"}}]}),hR=S({operationId:"threads.createShareLink",description:"Create a public read-only share link for a thread's current messages.",backend:"api",route:{method:"POST",path:"/threads/{threadId}/share",tags:["Threads"],successStatus:201},input:h5A,output:B5A,pagination:"none",async:"sync",examples:[{name:"create-share-link",input:{threadId:TQ},output:{share:{shareId:hcA,threadId:TQ,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}}}]}),BR=S({operationId:"threads.listShareLinks",description:"List active public share links for a thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/share",tags:["Threads"]},input:E5A,output:a5A,pagination:"none",async:"sync",examples:[{name:"list-share-links",input:{threadId:TQ},output:{shares:[{shareId:hcA,threadId:TQ,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}]}}]}),cR=S({operationId:"threads.revokeShareLink",description:"Revoke a public share link for a thread.",backend:"api",route:{method:"DELETE",path:"/threads/{threadId}/share/{shareId}",successStatus:204,tags:["Threads"]},input:c5A,output:C5A,pagination:"none",async:"sync"}),$Rt={list:tR.contract,get:gR.contract,getStatus:nR.contract,stop:iR.contract,create:oR.contract,update:eR.contract,fork:QR.contract,setVisibility:IR.contract,createShareLink:hR.contract,listShareLinks:BR.contract,revokeShareLink:cR.contract}});var y5A,w5A,D5A,u5A,BcA,ccA;var CcA=r(()=>{JA();KA();Gb();CR();y5A=Q.object({threadId:Q.string().uuid().describe("Thread ID to list messages for."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of messages to return per page."),cursor:Q.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),w5A=Q.object({messages:Q.array(AR),nextCursor:Q.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),D5A=Q.object({threadId:Q.string().uuid().describe("Thread ID to append the message to."),message:Q.string().min(1,"Message cannot be empty").describe("Message body to append to the thread."),wait:Q.boolean().default(!0).describe("Whether the server should wait for the appended message run before responding."),timeoutSeconds:Q.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:Q.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:Q.literal(!0).optional().describe("Internal marker for scheduler-originated ambient service work. Honored only for system secret-key requests with matching automation context.")}).superRefine((A,t)=>{Tb(A.message,A.automationId,t),Jb(A.ambientServiceRun,A.automationId,t)}),u5A=pE.describe("Deferred run result for appending a message to an existing thread."),BcA=S({operationId:"messages.list",description:"List messages in a thread with cursor pagination.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/messages",tags:["Messages"]},input:y5A,output:w5A,pagination:"cursor",async:"sync",examples:[{name:"thread-messages",input:{threadId:"22222222-2222-4222-8222-222222222222",limit:2},output:{messages:[{id:"33333333-3333-4333-8333-333333333333",role:"user",content:[{type:"message",message:"What changed in the intake pipeline?"}],source:"api",createdAt:"2026-01-01T00:00:00.000Z"}],nextCursor:null}}]}),ccA=S({operationId:"messages.append",description:"Append a user message to an existing thread and trigger a deferred run.",backend:"api",route:{method:"POST",path:"/threads/{threadId}/messages",successStatus:201,tags:["Messages"]},input:D5A,output:u5A,pagination:"none",async:"deferred",examples:[{name:"append-processing",input:{threadId:"22222222-2222-4222-8222-222222222222",message:"Follow up on the intake backlog.",wait:!1,timeoutSeconds:20},output:{completed:!1,threadId:"22222222-2222-4222-8222-222222222222",runId:"33333333-3333-4333-8333-333333333333",status:"processing",response:null}}]})});var en,acA,ER,SB,aR,Pb,Be,rcA,EcA;var ta=r(()=>{JA();en={IN_APP:"in_app",SLACK:"slack",SLACK_CHANNEL:"slack_channel",MICROSOFT_TEAMS_CHANNEL:"teams_channel",EMAIL:"email",SMS:"sms",INCIDENT_IO:"incident_io",PAGERDUTY:"pagerduty",ROOTLY:"rootly",WEBHOOK:"webhook"},acA=[en.IN_APP,en.SLACK,en.EMAIL,en.SMS],ER=[en.SLACK_CHANNEL,en.MICROSOFT_TEAMS_CHANNEL,en.INCIDENT_IO,en.PAGERDUTY,en.ROOTLY,en.WEBHOOK],SB=Object.values(en),aR=[...SB,"victorops"],Pb=Q.enum(SB),Be=Q.enum(ER),rcA=[{channel:"in_app",name:"In-app",description:"Show notifications in your Sazabi notification feed.",scope:"personal",destinationManagement:"none",personalSettingsPath:"/settings/notifications"},{channel:"email",name:"Email",description:"Send notifications to your account email address.",scope:"personal",destinationManagement:"none",personalSettingsPath:"/settings/notifications"},{channel:"sms",name:"SMS",description:"Send notifications to your verified phone number.",scope:"personal",destinationManagement:"none",personalSettingsPath:"/settings/account?phone-number=add"},{channel:"slack",name:"Slack DMs",description:"Send personal notifications by Slack DM.",scope:"personal",destinationManagement:"none",personalSettingsPath:"/settings/connected-accounts/slack"},{channel:"slack_channel",name:"Slack",description:"Post this project's alerts to selected Slack channels.",scope:"project",destinationManagement:"slack_channels",projectIntegrationPath:"slack"},{channel:"teams_channel",name:"Microsoft Teams",description:"Post this project's alerts to selected Microsoft Teams channels.",scope:"project",destinationManagement:"teams_channels",projectIntegrationPath:"teams"},{channel:"incident_io",name:"incident.io",description:"Route this project's alerts to incident.io.",scope:"project",destinationManagement:"integration_connections",projectIntegrationPath:"incident-io"},{channel:"pagerduty",name:"PagerDuty",description:"Route this project's alerts to PagerDuty.",scope:"project",destinationManagement:"integration_connections",projectIntegrationPath:"pagerduty"},{channel:"rootly",name:"Rootly",description:"Route this project's alerts to Rootly.",scope:"project",destinationManagement:"integration_connections",projectIntegrationPath:"rootly"},{channel:"webhook",name:"Webhooks",description:"Send this project's alerts to configured HTTPS endpoints.",scope:"project",destinationManagement:"webhook_endpoints",projectSettingsPath:"webhooks"}],EcA=new Set(rcA.map(({channel:A})=>A));if(EcA.size!==SB.length||SB.some((A)=>!EcA.has(A)))throw Error("Notification channel definitions must represent every channel")});var ycA,b5A=(A,t)=>A.value===t.value&&A.label===t.label&&A.scope===t.scope&&A.role===t.role&&A.defaultOff===t.defaultOff&&(A.defaultOffChannels??[]).join(",")===(t.defaultOffChannels??[]).join(",")&&A.email?.template===t.email?.template&&A.email?.ctaLabel===t.email?.ctaLabel&&(A.deliveryConditions??[]).join(",")===(t.deliveryConditions??[]).join(","),Mg=(A)=>{for(let t of Object.values(A)){let g=ycA.get(t.value);if(g&&!b5A(g,t))throw Error(`Notification type registered twice with conflicting definitions: ${t.value}`);if(t.role!==void 0&&t.scope!=="org")throw Error(`Notification type role restrictions require org scope: ${t.value}`);if(t.label.trim().length===0)throw Error(`Notification type needs a display label: ${t.value}`);if(t.email&&t.email.ctaLabel.trim().length===0)throw Error(`Notification email presentation needs a CTA label: ${t.value}`);if(t.defaultOff&&t.defaultOffChannels)throw Error(`Notification type declares both defaultOff and defaultOffChannels: ${t.value}`);ycA.set(t.value,t)}return A};var pi=r(()=>{ycA=new Map});var wcA;var DcA=r(()=>{pi();wcA=Mg({AUTOMATION_FINISHED:{value:"automation_finished",label:"Automation completed",scope:"project",defaultOff:!0},AUTOMATION_RUN_FAILED:{value:"automation_run_failed",label:"Automation run failed",scope:"project"}})});var fb;var rR=r(()=>{pi();fb=Mg({BILLING_PLAN_UPGRADE_APPLIED:{value:"billing_plan_upgrade_applied",label:"Billing upgrade applied",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage billing"}},BILLING_PLAN_DOWNGRADE_SCHEDULED:{value:"billing_plan_downgrade_scheduled",label:"Billing downgrade scheduled",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage billing"}},BILLING_PLAN_DOWNGRADE_APPLIED:{value:"billing_plan_downgrade_applied",label:"Billing downgrade applied",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage billing"}},BILLING_CREDIT_BALANCE_LOW:{value:"billing_credit_balance_low",label:"Billing credits low",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage credits"}},BILLING_CREDIT_BALANCE_DEPLETED:{value:"billing_credit_balance_depleted",label:"Billing credits depleted",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage credits"}},BILLING_AUTO_TOP_UP_SETTINGS_CHANGED:{value:"billing_auto_top_up_settings_changed",label:"Billing auto top-up changed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage auto top-up"}},BILLING_AUTO_TOP_UP_FAILED:{value:"billing_auto_top_up_failed",label:"Billing auto top-up failed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage payment method"}},BILLING_INVOICE_PAID:{value:"billing_invoice_paid",label:"Billing invoice paid",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"View invoice"}},BILLING_INVOICE_PAYMENT_FAILED:{value:"billing_invoice_payment_failed",label:"Billing invoice payment failed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Update payment method"}},BILLING_SUBSCRIPTION_CANCELLATION_SCHEDULED:{value:"billing_subscription_cancellation_scheduled",label:"Billing cancellation scheduled",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage subscription"}},BILLING_SUBSCRIPTION_CANCELED:{value:"billing_subscription_canceled",label:"Billing subscription canceled",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"View billing"}},BILLING_PAYMENT_METHOD_EXPIRING:{value:"billing_payment_method_expiring",label:"Billing payment method expiring",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Update payment method"}},BILLING_PAYMENT_METHOD_CHANGED:{value:"billing_payment_method_changed",label:"Billing payment method changed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Review payment method"}},BILLING_NEGATIVE_BALANCE_COLLECTED:{value:"billing_negative_balance_collected",label:"Billing outstanding balance charged",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"View billing"}},BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED:{value:"billing_negative_balance_collection_failed",label:"Billing outstanding balance charge failed",scope:"org",role:"admin",email:{template:"billing",ctaLabel:"Manage payment method"}}})});var ucA;var bcA=r(()=>{pi();ucA=Mg({INTEGRATION_CONNECTED:{value:"integration_connected",label:"Integration connected",scope:"org",defaultOff:!0},INTEGRATION_DISCONNECTED:{value:"integration_disconnected",label:"Integration disconnected",scope:"org"}})});var lcA;var NcA=r(()=>{pi();lcA=Mg({ISSUE_TRIGGERED:{value:"issue_triggered",label:"Issue triggered",scope:"project",deliveryConditions:["component","severity"]},ISSUE_RESOLVED:{value:"issue_resolved",label:"Issue resolved",scope:"project",defaultOffChannels:["email"],deliveryConditions:["component","severity"]},ISSUE_IGNORED:{value:"issue_ignored",label:"Issue ignored",scope:"project",defaultOffChannels:["email"],deliveryConditions:["component","severity"]}})});var UcA;var ScA=r(()=>{pi();UcA=Mg({PROJECT_CREATED:{value:"project_created",label:"Project created",scope:"org",defaultOff:!0},PROJECT_DELETED:{value:"project_deleted",label:"Project deleted",scope:"org",defaultOff:!0},MEMBER_INVITED:{value:"member_invited",label:"Member invited",scope:"org",defaultOff:!0},USER_REMOVED:{value:"user_removed",label:"Member removed",scope:"org",defaultOff:!0},MCP_CONNECTOR_ADDED:{value:"mcp_connector_added",label:"MCP connector added",scope:"org",defaultOff:!0},MCP_CONNECTOR_REMOVED:{value:"mcp_connector_removed",label:"MCP connector removed",scope:"org",defaultOff:!0},SECRET_KEY_CREATED:{value:"secret_key_created",label:"Secret key created",scope:"org",defaultOff:!0},SECRET_KEY_DELETED:{value:"secret_key_deleted",label:"Secret key deleted",scope:"org",defaultOff:!0}})});var LcA;var FcA=r(()=>{pi();LcA=Mg({SANDBOX_CREATED:{value:"sandbox_created",label:"Sandbox connected",scope:"project",defaultOff:!0},SANDBOX_DELETED:{value:"sandbox_deleted",label:"Sandbox disconnected",scope:"project",defaultOff:!0},LOG_SOURCE_CONNECTED:{value:"log_source_connected",label:"Log source connected",scope:"project",defaultOff:!0},LOG_SOURCE_DISCONNECTED:{value:"log_source_disconnected",label:"Log source disconnected",scope:"project"},GITHUB_CONNECTED:{value:"github_connected",label:"GitHub connected",scope:"project",defaultOff:!0},GITHUB_DISCONNECTED:{value:"github_disconnected",label:"GitHub disconnected",scope:"project"},CODE_REPO_CONNECTED:{value:"code_repo_connected",label:"Code repository connected",scope:"project",defaultOff:!0},CODE_REPO_DISCONNECTED:{value:"code_repo_disconnected",label:"Code repository disconnected",scope:"project"},PUBLIC_KEY_DEACTIVATED:{value:"public_key_deactivated",label:"Public key deactivated",scope:"project"}})});var McA;var YcA=r(()=>{pi();McA=Mg({SECURITY_ALERT:{value:"security_alert",label:"Security alert",scope:"org",role:"admin"}})});var yR,St,N5A,wR=(A)=>{let t=N5A.get(A)?.label;if(t)return t;let g=A.replace(/_/g," ").trim();return g?g.charAt(0).toUpperCase()+g.slice(1):A};var ga=r(()=>{DcA();rR();rR();bcA();NcA();ScA();FcA();YcA();pi();yR={...McA,...UcA,...ucA,...wcA,...lcA,...LcA,...fb},St=Object.fromEntries(Object.entries(yR).map(([A,t])=>[A,t.value])),N5A=new Map(Object.values(yR).map((A)=>[A.value,A]))});var Rb,$cA,COt,Fi,EOt;var JQ=r(()=>{ga();ta();ta();Rb=Object.values(St),$cA=[St.BILLING_PLAN_UPGRADE_APPLIED,St.BILLING_PLAN_DOWNGRADE_SCHEDULED,St.BILLING_PLAN_DOWNGRADE_APPLIED,St.BILLING_CREDIT_BALANCE_LOW,St.BILLING_CREDIT_BALANCE_DEPLETED,St.BILLING_AUTO_TOP_UP_SETTINGS_CHANGED,St.BILLING_AUTO_TOP_UP_FAILED,St.BILLING_INVOICE_PAID,St.BILLING_NEGATIVE_BALANCE_COLLECTED,St.BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED,St.BILLING_INVOICE_PAYMENT_FAILED,St.BILLING_SUBSCRIPTION_CANCELLATION_SCHEDULED,St.BILLING_SUBSCRIPTION_CANCELED,St.BILLING_PAYMENT_METHOD_EXPIRING,St.BILLING_PAYMENT_METHOD_CHANGED],COt=new Set($cA),Fi=[St.ISSUE_TRIGGERED,St.ISSUE_RESOLVED,St.ISSUE_IGNORED,St.AUTOMATION_RUN_FAILED],EOt=new Set(Fi)});var na,GcA,TcA=(A)=>typeof A==="string"&&(A in GcA)?GcA[A]:A,S5A;var JcA=r(()=>{ta();JA();JQ();na=Q.enum(Rb),GcA={data_source_connected:"log_source_connected",data_source_disconnected:"log_source_disconnected"},S5A=Q.preprocess(TcA,na)});var L5A;var PcA=r(()=>{ga();JQ();L5A=Fi.map((A)=>({notificationType:A,label:wR(A)}))});var fcA=r(()=>{ga();JQ()});var RcA=r(()=>{ta();ga();JQ();JcA();PcA();fcA()});var OcA=()=>{};var vcA=r(()=>{JQ()});var zcA=r(()=>{JQ()});var DR=r(()=>{OcA();vcA();zcA();RcA()});var k5A,$5A,G5A,T5A,J5A,P5A,f5A,uR,kvt;var mcA=r(()=>{DR();JA();KA();k5A=Q.enum(["ready","missing","degraded","unavailable"]),$5A=Q.object({id:Q.string(),label:Q.string(),status:Q.enum(["active","inactive","degraded"]),statusLabel:Q.string()}),G5A=Q.object({channel:Pb,name:Q.string(),description:Q.string(),scope:Q.enum(["personal","project"]),enabled:Q.boolean().nullable(),preferenceId:Q.string().nullable(),prerequisite:Q.object({status:k5A,statusLabel:Q.string(),message:Q.string()}),action:Q.object({label:Q.string(),href:Q.string()}).nullable(),destinations:Q.array($5A),destinationManagement:Q.enum(["none","slack_channels","teams_channels","integration_connections","webhook_endpoints"]),canCreateDestinations:Q.boolean(),supportedNotificationTypes:Q.array(na)}),T5A=Q.object({channel:Be,enabled:Q.boolean(),preferenceId:Q.string().nullable()}),J5A=Q.object({channel:Be,notificationType:na,enabled:Q.boolean(),preferenceId:Q.string()}),P5A=Q.object({projectId:Q.string().uuid().optional().describe("Project to inspect. Auto-filled from CLI and SDK context when omitted.")}),f5A=Q.object({channelCards:Q.array(G5A).length(10),channels:Q.array(T5A),notificationTypePreferences:Q.array(J5A),issueNotificationMinSeverity:Q.enum(["low","medium","high","critical"])}),uR=S({operationId:"notificationChannels.getProject",summary:"List Project Notification Channels",description:"List a project's notification channels with preferences, prerequisites, connection state, configured destinations, and supported notification types.",backend:"api",route:{method:"GET",path:"/notification-channels",tags:["Notification channels"]},input:P5A,output:f5A,pagination:"none",async:"sync"}),kvt={getProject:uR.contract}});var WcA,lR,ZcA,NR,Pvt,fvt,UR,SR=(A,t)=>{if((A.componentIds?.length||A.componentId)&&"componentIds"in A.condition&&A.condition.componentIds?.length)t.addIssue({code:"custom",path:["condition","componentIds"],message:"Use componentIds instead of legacy condition.componentIds."});if(A.componentIds?.length&&A.componentId)t.addIssue({code:"custom",path:["componentId"],message:"Use componentIds instead of componentId."})},Rvt,VcA,bR,LR,ia,HcA,R5A,O5A,v5A,z5A,m5A,W5A,Z5A,V5A,H5A,FR,MR,YR,kR,$R,Ovt;var XcA=r(()=>{DR();JA();KA();WcA=Q.enum(["low","medium","high","critical"]),lR=Q.object({severities:Q.array(WcA).min(1).optional()}).strict(),ZcA=Q.object({componentIds:Q.array(Q.string().uuid()).min(1).optional(),severities:Q.array(WcA).min(1).optional()}).strict(),NR=Q.object({channel:Be,destinationKey:Q.string().min(1)}),Pvt=Q.object({destinations:Q.array(NR).min(1),notificationTypes:Q.array(Q.enum(Fi)).min(1),componentIds:Q.array(Q.string().uuid()).min(1).optional().describe("Stable component registry IDs matched by this rule."),includeDescendants:Q.boolean().default(!1).describe("Whether the rule also matches descendant components."),condition:lR}),fvt=Q.object({destinations:Q.array(NR).min(1),notificationTypes:Q.array(Q.enum(Fi)).min(1),condition:ZcA}),UR=Q.object({destinations:Q.array(NR).min(1),notificationTypes:Q.array(Q.enum(Fi)).min(1),componentIds:Q.array(Q.string().uuid()).min(1).optional().describe("Stable component registry IDs matched by this rule."),componentId:Q.string().uuid().optional().describe("Deprecated single-component compatibility input."),includeDescendants:Q.boolean().default(!1).describe("Whether the rule also matches descendant components."),condition:Q.union([lR,ZcA])}),Rvt=UR.superRefine(SR),VcA=Q.object({id:Q.string(),channel:Be,destinationKey:Q.string(),displayName:Q.string()}),bR=Q.object({id:Q.string().uuid(),label:Q.string(),lifecycle:Q.enum(["active","retired","merged"])}),LR=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),notificationTypes:Q.array(Q.enum(Fi)),destinations:Q.array(VcA),condition:lR,component:bR.nullable(),componentId:Q.string().uuid().nullable(),includeDescendants:Q.boolean(),suspendedAt:Q.string().datetime().nullable(),suspensionReason:Q.string().nullable(),components:Q.array(bR),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),ia=Q.object({projectId:Q.string().uuid().optional().describe("Project whose notification delivery rules are being managed.")}),HcA=Q.string().uuid().describe("Logical notification delivery rule ID."),R5A=ia,O5A=Q.object({rules:Q.array(LR)}),v5A=Q.object({destinations:Q.array(VcA),notificationTypes:Q.array(Q.object({notificationType:Q.enum(Fi),label:Q.string(),conditions:Q.array(Q.enum(["component","severity"]))})),components:Q.array(bR)}),z5A=ia.extend(UR.shape).superRefine(SR),m5A=LR,W5A=ia.extend({...UR.shape,ruleId:HcA}).superRefine(SR),Z5A=LR,V5A=ia.extend({ruleId:HcA}),H5A=Q.object({removed:Q.boolean()}),FR=S({operationId:"notificationDeliveryRules.list",description:"List the positive delivery rules for a project.",backend:"api",route:{method:"GET",path:"/notification-delivery-rules",tags:["Notification delivery rules"]},input:R5A,output:O5A,pagination:"none",async:"sync"}),MR=S({operationId:"notificationDeliveryRules.options",description:"List available destinations, events, and conditions for project delivery rules.",backend:"api",route:{method:"GET",path:"/notification-delivery-rules/options",tags:["Notification delivery rules"]},input:ia,output:v5A,pagination:"none",async:"sync"}),YR=S({operationId:"notificationDeliveryRules.create",description:"Create a positive project notification delivery rule.",backend:"api",route:{method:"POST",path:"/notification-delivery-rules",tags:["Notification delivery rules"]},input:z5A,output:m5A,pagination:"none",async:"sync"}),kR=S({operationId:"notificationDeliveryRules.update",description:"Replace a positive delivery rule atomically.",backend:"api",route:{method:"PUT",path:"/notification-delivery-rules/{ruleId}",tags:["Notification delivery rules"]},input:W5A,output:Z5A,pagination:"none",async:"sync"}),$R=S({operationId:"notificationDeliveryRules.delete",description:"Delete a positive delivery rule without deleting its reusable destinations.",backend:"api",route:{method:"DELETE",path:"/notification-delivery-rules/{ruleId}",tags:["Notification delivery rules"]},input:V5A,output:H5A,pagination:"none",async:"sync"}),Ovt={list:FR.contract,options:MR.contract,create:YR.contract,update:kR.contract,delete:$R.contract}});var GR,X5A,j5A,K5A,_5A,x5A,s5A,TR,q5A,d5A,JR,p5A,AxA,PR,txA,gxA,fR,nxA,ixA,RR,Wvt;var jcA=r(()=>{JA();KA();GR=Q.enum(["verify-email","accept-invite","create-organization","billing","configure-project","connect-github-account","install-github-app","configure-code-search","install-slack-app","configure-slack-notifications","trigger-issue","confirm-issue","finish"]),X5A=Q.enum(["needs-onboarding","blocked","ready"]),j5A=Q.enum(["incomplete","complete","skipped"]),K5A=Q.object({invitationId:Q.string(),organizationId:Q.string(),organizationName:Q.string(),organizationSlug:Q.string(),organizationImageUrl:Q.string().nullable(),inviterName:Q.string().nullable()}),_5A=Q.object({gate:X5A,canonicalStep:GR.nullable(),organizationId:Q.string().nullable(),projectId:Q.string().nullable(),completionByStep:Q.record(GR,j5A),githubSkipped:Q.boolean(),githubAppSkipped:Q.boolean(),slackSkipped:Q.boolean(),sampleIssueId:Q.string().nullable(),actorRole:Q.enum(["admin","member"]).nullable(),requiredStep:Q.union([GR,Q.literal("select-organization")]).nullable(),isCompleted:Q.boolean(),onboardingRecommendationsThreadId:Q.string().nullable(),hasOrganizations:Q.boolean(),hasPaidBillingSubscription:Q.boolean(),billingStepEnabled:Q.boolean(),pendingInvitations:Q.array(K5A)}),x5A=Q.object({}),s5A=Q.object({onboarding:_5A}),TR=S({operationId:"onboarding.getState",description:"Read onboarding progress for the authenticated user.",backend:"api",route:{method:"GET",path:"/onboarding/state",tags:["Onboarding"]},input:x5A,output:s5A,pagination:"none",async:"sync"}),q5A=Q.object({integration:Q.enum(["github","slack"]).describe("Integration onboarding step to skip.")}),d5A=Q.object({skipped:Q.literal(!0)}),JR=S({operationId:"onboarding.skipIntegration",description:"Skip a GitHub or Slack integration step during onboarding.",backend:"api",route:{method:"POST",path:"/onboarding/skip-integration",tags:["Onboarding"]},input:q5A,output:d5A,pagination:"none",async:"sync"}),p5A=Q.object({}),AxA=Q.object({skipped:Q.literal(!0)}),PR=S({operationId:"onboarding.skipGithubAppInstallation",summary:"Skip GitHub App Installation",description:"Skip GitHub App installation during onboarding.",backend:"api",route:{method:"POST",path:"/onboarding/skip-github-app",tags:["Onboarding"]},input:p5A,output:AxA,pagination:"none",async:"sync"}),txA=Q.object({}),gxA=Q.object({skipped:Q.literal(!0)}),fR=S({operationId:"onboarding.skipSampleIssue",summary:"Skip Test Issue",description:"Skip the optional test issue during onboarding.",backend:"api",route:{method:"POST",path:"/onboarding/skip-sample-issue",tags:["Onboarding"]},input:txA,output:gxA,pagination:"none",async:"sync"}),nxA=Q.object({projectId:Q.string().uuid().describe("Project that completed onboarding.")}),ixA=Q.object({completed:Q.boolean()}),RR=S({operationId:"onboarding.finish",description:"Mark onboarding complete when all prerequisites are satisfied.",backend:"api",route:{method:"POST",path:"/onboarding/finish",tags:["Onboarding"]},input:nxA,output:ixA,pagination:"none",async:"sync"}),Wvt={getState:TR.contract,skipIntegration:JR.contract,skipGithubAppInstallation:PR.contract,skipSampleIssue:fR.contract,finish:RR.contract}});var Ob,oxA,exA,QxA,IxA,hxA,BxA,cxA,CxA,ExA,axA,OR,vR,zR,mR,jvt;var KcA=r(()=>{JA();KA();Yb();Ob=Q.object({id:Q.string().min(1),name:Q.string(),slug:Q.string(),logo:Q.string().nullable().optional()}),oxA=Ob.extend({role:he.optional()}),exA=Q.object({}),QxA=Q.object({organizations:Q.array(oxA).describe("Organizations available to the current credential.")}),IxA=Q.object({organizationId:Q.string().min(1).describe("Organization ID to fetch.")}),hxA=Q.object({organization:Ob}),BxA=Q.object({organizationId:Q.string().min(1).describe("Organization ID to update. SDK and CLI callers can auto-fill this before dispatch."),name:Q.string().trim().min(1).max(100).describe("New organization name.")}),cxA=Q.object({organization:Ob.describe("Updated organization.")}),CxA=Q.string().trim().min(1,"Name is required").max(100,"Name must be 100 characters or less").regex(/^[\p{L}\p{N} _-]+$/u,"Name can only contain letters, numbers, spaces, hyphens, and underscores"),ExA=Q.object({name:CxA.describe("Organization display name.")}),axA=Q.object({organization:Ob}),OR=S({operationId:"organizations.create",description:"Create an organization for the authenticated user.",backend:"api",route:{method:"POST",path:"/organizations",tags:["Organizations"],successStatus:201},input:ExA,output:axA,pagination:"none",async:"sync"}),vR=S({operationId:"organizations.list",description:"List organizations available to the current credential.",backend:"api",route:{method:"GET",path:"/organizations",tags:["Organizations"]},input:exA,output:QxA,pagination:"none",async:"sync"}),zR=S({operationId:"organizations.get",description:"Get one organization by ID.",backend:"api",route:{method:"GET",path:"/organizations/{organizationId}",tags:["Organizations"]},input:IxA,output:hxA,pagination:"none",async:"sync"}),mR=S({operationId:"organizations.update",description:"Update one organization.",backend:"api",route:{method:"PATCH",path:"/organizations/{organizationId}",tags:["Organizations"]},input:BxA,output:cxA,pagination:"none",async:"sync",examples:[{name:"rename-organization",input:{organizationId:"organization-123",name:"Observed Platform"},output:{organization:{id:"organization-123",name:"Observed Platform",slug:"acme",logo:null}}}]}),jvt={list:vR.contract,get:zR.contract,create:OR.contract,update:mR.contract}});var LB,oa,_cA,xcA,scA,qcA,dcA,pcA,ACA,vb,zb,mb,tCA,gCA,Wb,nCA,iCA,Zb,rxA;var WR=r(()=>{JA();KA();LB=Q.enum(["us-east-1","us-east-2","us-west-1","us-west-2","eu-central-1","eu-central-2","eu-north-1","eu-south-1","eu-south-2","eu-west-1","eu-west-2","eu-west-3"]),oa=Q.object({id:Q.string().uuid(),organizationId:Q.string().min(1),name:Q.string(),region:LB}),_cA=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to list projects for. Auto-filled from CLI and SDK context when omitted.")}),xcA=Q.object({projects:Q.array(oa).describe("Projects visible within the selected organization.")}),scA=Q.object({projectId:Q.string().uuid().describe("Project ID to fetch.")}),qcA=Q.string().trim().min(1,"Name is required").max(100,"Name must be 100 characters or less").regex(/^[\p{L}\p{N} _-]+$/u,"Name can only contain letters, numbers, spaces, hyphens, and underscores"),dcA=Q.object({organizationId:Q.string().min(1).optional().describe("Organization to create the project under. Auto-filled from CLI and SDK context when omitted."),name:qcA.describe("Project name."),region:LB.optional().default("us-west-2").describe("AWS region where the new project should be created.")}),pcA=Q.object({project:oa}),ACA=Q.object({project:oa}),vb=S({operationId:"projects.list",description:"List projects in an organization.",backend:"api",route:{method:"GET",path:"/projects",tags:["Projects"]},input:_cA,output:xcA,pagination:"none",async:"sync"}),zb=S({operationId:"projects.get",description:"Get one project by ID.",backend:"api",route:{method:"GET",path:"/projects/{projectId}",tags:["Projects"]},input:scA,output:ACA,pagination:"none",async:"sync"}),mb=S({operationId:"projects.create",description:"Create one project in an organization.",backend:"api",route:{method:"POST",path:"/projects",successStatus:201,tags:["Projects"]},input:dcA,output:pcA,pagination:"none",async:"sync"}),tCA=Q.object({projectId:Q.string().uuid().describe("Project ID to update."),name:qcA.optional().describe("New project name.")}),gCA=Q.object({project:oa}),Wb=S({operationId:"projects.update",description:"Update (rename) one project by ID. User credentials require the `settings:write` organization permission (admin or owner role).",backend:"api",route:{method:"PATCH",path:"/projects/{projectId}",tags:["Projects"]},input:tCA,output:gCA,pagination:"none",async:"sync"}),nCA=Q.object({projectId:Q.string().uuid().describe("Project ID to delete.")}),iCA=Q.void(),Zb=S({operationId:"projects.delete",description:"Delete one project by ID. User credentials require the `settings:write` organization permission (admin or owner role).",backend:"api",route:{method:"DELETE",path:"/projects/{projectId}",successStatus:204,tags:["Projects"]},input:nCA,output:iCA,pagination:"none",async:"sync"}),rxA={list:vb.contract,get:zb.contract,create:mb.contract,update:Wb.contract,delete:Zb.contract}});var oCA,yxA,wxA,DxA,uxA,bxA,ZR,pvt;var eCA=r(()=>{JA();KA();oCA=Q.enum(["open","merged","closed"]),yxA=Q.enum(["review_required","approved","changes_requested"]),wxA=Q.enum(["passing","failing","pending"]),DxA=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),repositoryFullName:Q.string(),pullRequestId:Q.string().describe("Provider-native pull request identifier (GitHub PR number or Bitbucket PR id), serialized as a string."),githubPullRequestId:Q.number().int().describe("Deprecated: use pullRequestId. Numeric form of the provider-native pull request identifier; kept for backward compatibility."),title:Q.string().nullable(),url:Q.string().nullable(),status:oCA.nullable(),reviewState:yxA.nullable(),checksState:wxA.nullable(),requestedByUserId:Q.string().nullable(),authorLogin:Q.string().nullable().describe("Forge login that authored the pull request (often the Sazabi app identity)."),githubAuthorLogin:Q.string().nullable().describe("Deprecated: use authorLogin. Kept for backward compatibility."),threadId:Q.string().uuid().nullable(),runId:Q.string().uuid().nullable(),createdAt:Q.string().datetime(),mergedAt:Q.string().datetime().nullable(),closedAt:Q.string().datetime().nullable()}),uxA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list pull requests for. Auto-filled from CLI and SDK context when omitted."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of pull requests to return per page."),cursor:Q.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:oCA.optional().describe("Filter by pull request status (open, merged, or closed)."),repositoryFullName:Q.string().trim().optional().describe("Filter by repository full name, for example owner/repo. Case-insensitive."),requestedByUserId:Q.string().trim().optional().describe("Filter by the Sazabi user who requested the pull request. Pass 'me' to filter to the authenticated user.")}),bxA=Q.object({pullRequests:Q.array(DxA),nextCursor:Q.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),ZR=S({operationId:"pullRequests.list",description:"List pull requests that Sazabi opened, optionally filtered by status, repository, and requesting user.",backend:"api",route:{method:"GET",path:"/pull-requests",tags:["Pull Requests"]},input:uxA,output:bxA,pagination:"cursor",async:"sync"}),pvt={list:ZR.contract}});var QCA,ICA,hCA,BCA,cCA,ea;var VR=r(()=>{JA();KA();QCA=Q.enum(["log_source","mcp_connector","sandbox_cli","integration"]),ICA=Q.enum(["connected","recommended"]),hCA=Q.object({kind:QCA.describe("What the recommendation targets: a log source, MCP connector, sandbox CLI, or integration."),targetId:Q.string().describe("Exact catalog id for the kind (log source type, MCP provider id, sandbox CLI preset type, or integration provider id)."),status:ICA.describe("Resolved live against current connections: connected (already set up) or recommended (suggested, not yet connected)."),roiScore:Q.number().int().min(0).max(100).describe("Intrinsic ROI score, 0–100 — a normalized blend of how valuable, how easy to connect, and how proven the item is. A pure function of the item; computed live on read, never stored."),priority:Q.number().int().min(1).describe("1-based rank within this list, sorted by roiScore (best first). Items are already returned in priority order; the field lets consumers recover the rank without trusting array position.")}),BCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list recommendations for. Auto-filled from CLI and SDK context when omitted.")}),cCA=Q.object({recommendations:Q.array(hCA).describe("The project's configuration recommendations, deduped by (kind, targetId), with status resolved live and each item's ROI score. Returned in priority order (highest roiScore first).")}),ea=S({operationId:"recommendations.list",description:"List a project's configuration recommendations (data sources, MCP connectors, sandbox CLIs, and integrations) with each item's live connection status.",backend:"api",route:{method:"GET",path:"/recommendations",tags:["Recommendations"]},input:BCA,output:cCA,pagination:"none",async:"sync"})});var CCA,lxA,ECA,Vb,aCA,rCA,yCA,wCA,FB,HR,DCA,uCA,MB,bCA,lCA,YB,NCA,UCA,kB,NxA;var XR=r(()=>{JA();KA();CCA=Q.object({type:Q.string().describe("Preset type identifier."),label:Q.string().describe("Human-readable display name."),executableNames:Q.array(Q.string()).describe("CLI binary names installed by this preset."),envVarKeys:Q.array(Q.string()).describe("Environment variables required for authentication."),setupSkill:Q.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),lxA=Q.object({}),ECA=Q.object({types:Q.array(CCA)}),Vb=S({operationId:"sandboxPresets.listTypes",description:"List all supported sandbox CLI types with their environment variable requirements and setup skills.",backend:"api",route:{method:"GET",path:"/sandbox-presets/types",tags:["Sandbox Presets"]},input:lxA,output:ECA,pagination:"none",async:"sync"}),aCA=Q.enum(["github_app","bitbucket_integration","personal_access_token","stored_credentials"]),rCA=Q.object({presetType:Q.string().describe("Preset type identifier."),credentialSource:aCA.describe("Authoritative credential source for the preset."),isSystemManaged:Q.boolean().describe("Whether the connection follows an integration lifecycle."),fallbackConfigured:Q.boolean().describe("Whether user-provided fallback credentials are stored for this preset."),envVarKeys:Q.array(Q.string()).describe("Stored environment variable names. Secret values are omitted.")}),yCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to inspect. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted.")}),wCA=Q.object({connections:Q.array(rCA)}),FB=S({operationId:"sandboxPresets.listConnections",description:"List a project's stored and integration-backed sandbox CLI connections without returning secret values.",backend:"api",route:{method:"GET",path:"/sandbox-presets/connections",tags:["Sandbox Presets"]},input:yCA,output:wCA,pagination:"none",async:"sync"}),HR=Q.object({key:Q.string().min(1).max(256).regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"Environment variable keys must match /^[A-Za-z_][A-Za-z0-9_]*$/.").describe("Environment variable name (e.g. KUBECONFIG_CONTENTS)."),value:Q.string().max(10240).describe("Secret value. Encrypted at rest; never returned by any API response.")}),DCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to configure. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:Q.string().min(1).describe("Preset type identifier (e.g. kubectl, aws, github)."),environmentVariables:Q.array(HR).max(100).describe("Full set of env vars for this preset. Replaces any previously stored values for the preset.")}),uCA=Q.object({projectId:Q.string().uuid().describe("Project the preset was written to."),presetType:Q.string().describe("Preset type that was upserted."),envVarKeys:Q.array(Q.string()).describe("Env var key names now stored for this preset. Values are never returned.")}),MB=S({operationId:"sandboxPresets.upsertPreset",summary:"Upsert CLI connection",description:"Set or replace a project's CLI connection credentials (e.g. the kubectl CLI's KUBECONFIG_CONTENTS). Values are encrypted server-side and never returned. Requires write access to the target project.",backend:"api",route:{method:"POST",path:"/sandbox-presets/config",successStatus:200,tags:["Sandbox Presets"]},input:DCA,output:uCA,pagination:"none",async:"sync"}),bCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to update. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:Q.string().min(1).describe("Preset type identifier.")}),lCA=Q.object({projectId:Q.string().uuid().describe("Project the CLI connection belonged to."),presetType:Q.string().describe("Preset type that was disconnected."),deleted:Q.boolean().describe("Whether a stored CLI connection was deleted.")}),YB=S({operationId:"sandboxPresets.deletePreset",summary:"Disconnect CLI",description:"Delete a project's stored CLI connection. Integration-managed access remains available until its owning integration is disconnected.",backend:"api",route:{method:"DELETE",path:"/sandbox-presets/config/{presetType}",tags:["Sandbox Presets"]},input:bCA,output:lCA,pagination:"none",async:"sync"}),NCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to test from. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:Q.string().min(1).describe("Preset type identifier."),environmentVariables:Q.array(HR).max(100).describe("Unsaved credentials to validate in a readonly sandbox.")}),UCA=Q.object({status:Q.enum(["success","failed"]),message:Q.string().nullable(),stdout:Q.string().describe("Truncated command output with submitted credentials redacted."),stderr:Q.string().describe("Truncated command errors with submitted credentials redacted.")}),kB=S({operationId:"sandboxPresets.testPreset",summary:"Test CLI connection",description:"Validate unsaved CLI credentials in a read-only ephemeral sandbox without persisting them.",backend:"api",route:{method:"POST",path:"/sandbox-presets/test",tags:["Sandbox Presets"]},input:NCA,output:UCA,pagination:"none",async:"sync"}),NxA={deletePreset:YB.contract,listConnections:FB.contract,listTypes:Vb.contract,testPreset:kB.contract,upsertPreset:MB.contract}});var Hb,SCA=1048576,jR,LCA,KR,UxA,SxA,LxA,FxA,MxA,YxA,kxA,$xA,GxA,TxA,_R,xR,sR,qR,dR,hzt;var FCA=r(()=>{JA();KA();Hb=Q.string().min(1).max(64).regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/,"Name must start with a letter or digit and contain only letters, digits, underscores, and hyphens (max 64 characters).").describe("Script name. Must be unique within the project among non-deleted scripts."),jR=Q.string().min(1).refine((A)=>new TextEncoder().encode(A).length<=SCA,{message:`Script content must be at most ${SCA} bytes (1 MiB).`}).describe("Bash script body materialized as /home/sazabi/scripts/<name>.sh in the sandbox."),LCA=Q.object({id:Q.string().uuid(),projectId:Q.string().uuid(),name:Q.string(),description:Q.string().nullable(),contentHash:Q.string().describe("sha256 hex digest of the script content."),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime()}),KR=LCA.extend({content:jR}),UxA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list scripts for. Auto-filled from CLI and SDK context when omitted."),search:Q.string().optional().describe("Case-insensitive partial match on script name."),cursor:Q.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:Q.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of scripts to return per page.")}),SxA=Q.object({scripts:Q.array(LCA),nextCursor:Q.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),LxA=Q.object({name:Hb.describe("Script name to fetch."),projectId:Q.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),FxA=Q.object({script:KR}),MxA=Q.object({projectId:Q.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),name:Hb.describe("Script name. Must be unique within the project among non-deleted scripts."),content:jR,description:Q.string().max(500).nullable().optional().describe("Optional human-readable description.")}),YxA=Q.object({script:KR}),kxA=Q.object({name:Hb.describe("Script to update."),projectId:Q.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),content:jR.optional().describe("New script body. Omit to leave content unchanged."),description:Q.string().max(500).nullable().optional().describe("New description, or null to clear it. Omit to leave unchanged.")}),$xA=Q.object({script:KR}),GxA=Q.object({name:Hb.describe("Script to delete."),projectId:Q.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),TxA=Q.object({deleted:Q.boolean()}),_R=S({operationId:"scripts.list",description:"List durable bash scripts stored for a project.",backend:"api",route:{method:"GET",path:"/scripts",tags:["Scripts"]},input:UxA,output:SxA,pagination:"cursor",async:"sync"}),xR=S({operationId:"scripts.get",description:"Get a single project script by name, including its body.",backend:"api",route:{method:"GET",path:"/scripts/{name}",tags:["Scripts"]},input:LxA,output:FxA,pagination:"none",async:"sync"}),sR=S({operationId:"scripts.create",description:"Create a durable bash script for a project.",backend:"api",route:{method:"POST",path:"/scripts",successStatus:201,tags:["Scripts"]},input:MxA,output:YxA,pagination:"none",async:"sync"}),qR=S({operationId:"scripts.update",description:"Update a project script's body and/or description.",backend:"api",route:{method:"PATCH",path:"/scripts/{name}",tags:["Scripts"]},input:kxA,output:$xA,pagination:"none",async:"sync"}),dR=S({operationId:"scripts.delete",description:"Soft-delete a project script by name.",backend:"api",route:{method:"DELETE",path:"/scripts/{name}",successStatus:204,tags:["Scripts"]},input:GxA,output:TxA,pagination:"none",async:"sync"}),hzt={list:_R.contract,get:xR.contract,create:sR.contract,update:qR.contract,delete:dR.contract}});var pR,MCA,YCA,kCA,$CA,$B,GB,JxA;var AO=r(()=>{JA();KA();pR=Q.object({projectId:Q.string().uuid().optional().describe("Project to search within. Auto-filled from CLI and SDK context when omitted."),query:Q.string().trim().min(1,"Query must be at least 1 character").max(500,"Query must be at most 500 characters"),limit:Q.coerce.number().min(1).max(100).default(20).describe("Maximum number of search results to return."),page:Q.coerce.number().min(1).default(1).describe("One-based page number.")}),MCA=pR.extend({status:Q.enum(["regular","archived"]).optional().describe("Optional thread status filter.")}),YCA=pR.extend({threadId:Q.string().uuid().optional().describe("Optional thread restriction for message search."),role:Q.enum(["user","assistant"]).optional().describe("Optional message role filter.")}),kCA=Q.object({threads:Q.array(Q.object({id:Q.string().uuid(),projectId:Q.string().uuid().optional(),title:Q.string(),status:Q.enum(["regular","archived"]),labels:Q.array(Q.string()),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime(),highlights:Q.array(Q.string()),score:Q.number().optional()})),pagination:Q.object({page:Q.number(),limit:Q.number(),totalResults:Q.number(),totalPages:Q.number()}).describe("Page-based pagination metadata for the current search result.")}),$CA=Q.object({messages:Q.array(Q.object({id:Q.string().uuid(),threadId:Q.string().uuid(),threadTitle:Q.string(),role:Q.enum(["user","assistant"]),content:Q.string(),createdAt:Q.string().datetime(),updatedAt:Q.string().datetime(),highlights:Q.array(Q.string()),score:Q.number().optional()})),pagination:Q.object({page:Q.number(),limit:Q.number(),totalResults:Q.number(),totalPages:Q.number()}).describe("Page-based pagination metadata for the current search result.")}),$B=S({operationId:"search.threads",description:"Search threads within one project.",backend:"api",route:{method:"GET",path:"/search/threads",tags:["Search"]},input:MCA,output:kCA,pagination:"page",async:"sync",examples:[{name:"search-open-incidents",input:{projectId:"11111111-1111-4111-8111-111111111111",query:"payment timeout",status:"regular",limit:10,page:1},output:{threads:[{id:"22222222-2222-4222-8222-222222222222",projectId:"11111111-1111-4111-8111-111111111111",title:"Payment timeout in us-west-2",status:"regular",labels:["payments","timeout"],createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-02T00:00:00.000Z",highlights:["payment timeout"],score:123.45}],pagination:{page:1,limit:10,totalResults:1,totalPages:1}}}]}),GB=S({operationId:"search.messages",description:"Search messages within one project.",backend:"api",route:{method:"GET",path:"/search/messages",tags:["Search"]},input:YCA,output:$CA,pagination:"page",async:"sync",examples:[{name:"search-assistant-messages",input:{projectId:"11111111-1111-4111-8111-111111111111",query:"rollback",role:"assistant",limit:10,page:1},output:{messages:[{id:"33333333-3333-4333-8333-333333333333",threadId:"22222222-2222-4222-8222-222222222222",threadTitle:"Deployment rollback guidance",role:"assistant",content:"Rollback the ingestion deployment and confirm queue depth.",createdAt:"2026-01-02T00:00:00.000Z",updatedAt:"2026-01-02T00:00:00.000Z",highlights:["Rollback the ingestion deployment"],score:98.76}],pagination:{page:1,limit:10,totalResults:1,totalPages:1}}}]}),JxA={threads:$B.contract,messages:GB.contract}});var GCA;var TCA=r(()=>{GCA=["onboarding","setup"]});var JCA,PCA,fCA,RCA,Qa;var tO=r(()=>{TCA();JA();KA();JCA=Q.enum(GCA),PCA=Q.object({id:Q.string().describe("Unique task identifier (e.g. install_github_app)."),label:Q.string().describe("Short human-readable task name."),description:Q.string().describe("Explanation of what needs to be completed to satisfy this task."),instructions:Q.string().describe("Step-by-step instructions for completing this task."),completed:Q.boolean().describe("Whether the task has been completed."),completedAt:Q.string().datetime().nullable().describe("ISO 8601 timestamp of when the task was completed, or null."),category:JCA.describe("Task category: onboarding (core setup steps) or setup (additional configuration).")}),fCA=Q.object({projectId:Q.string().uuid().optional().describe("Project to list tasks for. Auto-filled from CLI and SDK context when omitted.")}),RCA=Q.object({tasks:Q.array(PCA).describe("All onboarding and setup tasks with their current completion status.")}),Qa=S({operationId:"tasks.list",description:"List all onboarding and setup tasks for a project, including their current completion status and a description of what is required to complete each task.",backend:"api",route:{method:"GET",path:"/tasks",tags:["Tasks"]},input:fCA,output:RCA,pagination:"none",async:"sync"})});var PxA,fxA,PQ,RxA,OxA,vxA,zxA,mxA,WxA,ZxA,VxA,HxA,XxA,jxA,KxA,_xA,xxA,gO,nO,iO,oO,eO,QO,IO,lzt;var OCA=r(()=>{JA();KA();PxA=Q.object({id:Q.string().uuid().describe("Team ID."),name:Q.string().describe("Team name, unique among the org's active teams."),description:Q.string().nullable().describe("Optional team description."),createdAt:Q.string().datetime().describe("When the team was created."),memberCount:Q.number().int().nonnegative().describe("Number of active members in the team.")}),fxA=Q.object({userId:Q.string().min(1).describe("User ID of the team member."),name:Q.string().nullable().describe("Display name for the member, when available."),email:Q.string().email().describe("Email address for the member."),addedAt:Q.string().datetime().describe("When the member was added to the team.")}),PQ=Q.string().min(1).optional().describe("Organization to operate on. Auto-filled from CLI and SDK context when omitted."),RxA=Q.object({organizationId:PQ}),OxA=Q.object({teams:Q.array(PxA).describe("Active teams in the organization.")}),vxA=Q.object({organizationId:PQ,name:Q.string().trim().min(1).describe("Team name."),description:Q.string().trim().min(1).optional().describe("Optional team description.")}),zxA=Q.object({id:Q.string().uuid().describe("ID of the created team.")}),mxA=Q.object({organizationId:PQ,teamId:Q.string().uuid().describe("Team to update."),name:Q.string().trim().min(1).optional().describe("New team name."),description:Q.string().trim().min(1).nullable().optional().describe("New team description; null clears it.")}),WxA=Q.object({id:Q.string().uuid().describe("ID of the updated team.")}),ZxA=Q.object({params:Q.object({teamId:Q.string().uuid().describe("Team to delete.")}),query:Q.object({organizationId:PQ})}).transform(({params:A,query:t})=>({...t,...A})),VxA=Q.object({success:Q.literal(!0).describe("The team and its memberships were removed.")}),HxA=Q.object({organizationId:PQ,teamId:Q.string().uuid().describe("Team to add the member to."),userId:Q.string().min(1).describe("User ID of an active organization member to add.")}),XxA=Q.object({id:Q.string().uuid().describe("ID of the team membership.")}),jxA=Q.object({params:Q.object({teamId:Q.string().uuid().describe("Team to remove the member from."),userId:Q.string().min(1).describe("User ID of the member to remove.")}),query:Q.object({organizationId:PQ})}).transform(({params:A,query:t})=>({...t,...A})),KxA=Q.object({success:Q.literal(!0).describe("The membership was removed.")}),_xA=Q.object({organizationId:PQ,teamId:Q.string().uuid().describe("Team to list members for.")}),xxA=Q.object({members:Q.array(fxA).describe("Active members of the team.")}),gO=S({operationId:"teams.list",description:"List teams in an organization.",backend:"api",route:{method:"GET",path:"/teams",tags:["Teams"]},input:RxA,output:OxA,pagination:"none",async:"sync",examples:[{name:"organization-teams",input:{organizationId:"organization-123"},output:{teams:[{id:"5c0f9866-31ab-4237-94cc-a1d0ba2f6de2",name:"Payments",description:"Owns checkout and billing components.",createdAt:"2026-01-01T00:00:00.000Z",memberCount:4}]}}]}),nO=S({operationId:"teams.create",description:"Create a team in an organization.",backend:"api",route:{method:"POST",path:"/teams",tags:["Teams"],successStatus:201},input:vxA,output:zxA,pagination:"none",async:"sync"}),iO=S({operationId:"teams.update",description:"Rename a team or update its description.",backend:"api",route:{method:"PATCH",path:"/teams/{teamId}",tags:["Teams"]},input:mxA,output:WxA,pagination:"none",async:"sync"}),oO=S({operationId:"teams.delete",description:"Delete a team, its memberships, and its component-ownership assignments.",backend:"api",route:{method:"DELETE",path:"/teams/{teamId}",tags:["Teams"],inputStructure:"detailed"},input:ZxA,output:VxA,pagination:"none",async:"sync"}),eO=S({operationId:"teams.addMember",description:"Add an active organization member to a team.",backend:"api",route:{method:"POST",path:"/teams/{teamId}/members",tags:["Teams"],successStatus:201},input:HxA,output:XxA,pagination:"none",async:"sync"}),QO=S({operationId:"teams.removeMember",description:"Remove a member from a team.",backend:"api",route:{method:"DELETE",path:"/teams/{teamId}/members/{userId}",tags:["Teams"],inputStructure:"detailed"},input:jxA,output:KxA,pagination:"none",async:"sync"}),IO=S({operationId:"teams.listMembers",description:"List a team's active members.",backend:"api",route:{method:"GET",path:"/teams/{teamId}/members",tags:["Teams"]},input:_xA,output:xxA,pagination:"none",async:"sync"}),lzt={list:gO.contract,create:nO.contract,update:iO.contract,delete:oO.contract,addMember:eO.contract,removeMember:QO.contract,listMembers:IO.contract}});var sxA,qxA,dxA,hO,pxA,AsA,BO,tsA,gsA,cO,Lzt;var vCA=r(()=>{JA();KA();sxA=Q.object({kind:Q.enum(["user","workspace"]),name:Q.string().optional(),email:Q.string().optional()}),qxA=Q.object({container:Q.string().min(1).describe("The container to create the work item in: its id, short key (e.g. a Linear team key like ENG), or display name."),title:Q.string().min(1),bodyMarkdown:Q.string().optional(),state:Q.string().optional(),itemType:Q.string().optional(),organizationId:Q.string().min(1).optional().describe("Optional organization ID to scope the request to. User credentials must belong to it; a secret key may only reference its own organization. Defaults to the credential's active organization."),clientRequestId:Q.string().min(1).optional().describe("Optional caller-supplied idempotency key. When provided, retrying the same logical create with the same clientRequestId reuses the original result instead of creating a duplicate external work item.")}).strict(),dxA=Q.object({identifier:Q.string(),title:Q.string(),url:Q.string(),state:Q.string(),attribution:sxA.optional(),reused:Q.boolean()}),hO=S({operationId:"work-items.create",description:"Create a work item (e.g. a Linear issue) in a connected issue tracker, attributing the write to the requesting user.",backend:"api",route:{method:"POST",path:"/work-items",tags:["Work Items"],successStatus:201},input:qxA,output:dxA,pagination:"none",async:"sync"}),pxA=Q.object({itemId:Q.string().min(1).describe("The work item to comment on."),bodyMarkdown:Q.string().min(1),organizationId:Q.string().min(1).optional().describe("Optional organization ID to scope the request to. User credentials must belong to it; a secret key may only reference its own organization. Defaults to the credential's active organization.")}).strict(),AsA=Q.object({identifier:Q.string(),url:Q.string()}),BO=S({operationId:"work-items.comment",description:"Add a comment to an existing work item.",backend:"api",route:{method:"POST",path:"/work-items/{itemId}/comment",tags:["Work Items"]},input:pxA,output:AsA,pagination:"none",async:"sync"}),tsA=Q.object({itemId:Q.string().min(1).describe("The work item to transition."),state:Q.string().min(1).describe("The target workflow state."),organizationId:Q.string().min(1).optional().describe("Optional organization ID to scope the request to. User credentials must belong to it; a secret key may only reference its own organization. Defaults to the credential's active organization.")}).strict(),gsA=Q.object({identifier:Q.string(),title:Q.string(),url:Q.string(),state:Q.string(),changed:Q.boolean()}),cO=S({operationId:"work-items.transition",description:"Move a work item to a target workflow state.",backend:"api",route:{method:"POST",path:"/work-items/{itemId}/transition",tags:["Work Items"]},input:tsA,output:gsA,pagination:"none",async:"sync"}),Lzt={create:hO.contract,comment:BO.contract,transition:cO.contract}});var CO;var zCA=r(()=>{yW();bW();NM();YM();VW();iY();QY();Y4();uw();eK();Ok();Of();Yb();mBA();xf();CcA();mcA();XcA();jcA();KcA();WR();eCA();VR();Gb();XR();FCA();AO();tO();OCA();CR();vCA();CO={me:vf.contract,automations:{list:$M.contract,get:GM.contract,create:TM.contract,update:JM.contract,enable:PM.contract,disable:fM.contract,runs:{list:RM.contract,get:OM.contract,logs:vM.contract}},logs:{query:vI.contract,schema:zI.contract,volume:mI.contract,patterns:WI.contract,nativeQuery:ZI.contract},logSources:{listProviders:rw.contract,list:RI.contract,create:OI.contract,get:yw.contract,update:ww.contract,delete:Dw.contract},logStreams:{list:$k.contract,create:Gk.contract,get:Tk.contract,update:Jk.contract,delete:Pk.contract,reassign:fk.contract},connectedAccounts:{beginConnect:SM.contract,getConnectAttempt:LM.contract,list:FM.contract,disconnect:MM.contract},integrations:{listProviders:NW.contract,listConnections:UW.contract,getConnection:SW.contract,createConnection:LW.contract,beginConnect:FW.contract,getConnectAttempt:MW.contract,disconnectConnection:YW.contract,updateConnectionCredentials:kW.contract,getOrganizationExternalIdentityJitPolicy:TW.contract,updateOrganizationExternalIdentityJitPolicy:JW.contract,getConnectionExternalIdentityJitPolicy:PW.contract,updateConnectionExternalIdentityJitPolicy:fW.contract,getSlackConfiguration:OW.contract,updateSlackConfiguration:vW.contract,listSlackChannelProjectMappings:mW.contract,setSlackChannelProjectMapping:WW.contract,deleteSlackChannelProjectMapping:ZW.contract},notificationChannels:{getProject:uR.contract},notificationDeliveryRules:{list:FR.contract,options:MR.contract,create:YR.contract,update:kR.contract,delete:$R.contract},mcpConnectors:{listProviders:Mb.contract,list:QB.contract,get:IB.contract,details:hB.contract,search:BB.contract,describe:cB.contract,call:CB.contract,create:EB.contract,update:aB.contract,disconnect:rB.contract,setReadOnly:yB.contract,beginOAuthInstall:wB.contract,getOAuthInstallAttempt:DB.contract},sandboxPresets:{deletePreset:YB.contract,listConnections:FB.contract,listTypes:Vb.contract,testPreset:kB.contract,upsertPreset:MB.contract},scripts:{list:_R.contract,get:xR.contract,create:sR.contract,update:qR.contract,delete:dR.contract},logMatchExpressions:{list:BY.contract,get:cY.contract,create:CY.contract,update:EY.contract,disable:aY.contract},memory:{put:uB.contract,get:bB.contract,list:lB.contract,search:NB.contract,delete:UB.contract},onboarding:{getState:TR.contract,skipIntegration:JR.contract,skipGithubAppInstallation:PR.contract,skipSampleIssue:fR.contract,finish:RR.contract},organizations:{list:vR.contract,get:zR.contract,create:OR.contract,update:mR.contract},members:{list:zf.contract,updateRole:mf.contract,remove:Wf.contract,invite:Zf.contract,listInvitations:Vf.contract,revokeInvitation:Hf.contract},teams:{list:gO.contract,create:nO.contract,update:iO.contract,delete:oO.contract,addMember:eO.contract,removeMember:QO.contract,listMembers:IO.contract},publicKeys:{list:$I.contract,get:GI.contract,ensureLogForwarding:TI.contract,update:JI.contract,deactivate:PI.contract},secretKeys:{list:ew.contract,get:Qw.contract,create:Iw.contract,update:hw.contract,delete:Bw.contract},projects:{list:vb.contract,get:zb.contract,create:mb.contract,update:Wb.contract,delete:Zb.contract},search:{threads:$B.contract,messages:GB.contract},messages:{list:BcA.contract,append:ccA.contract},threads:{list:tR.contract,get:gR.contract,getStatus:nR.contract,stop:iR.contract,create:oR.contract,update:eR.contract,fork:QR.contract,setVisibility:IR.contract,createShareLink:hR.contract,listShareLinks:BR.contract,revokeShareLink:cR.contract},runs:{list:sf.contract,listForThread:qf.contract,get:df.contract,cancel:pf.contract},pullRequests:{list:ZR.contract},issues:{count:xy.contract,create:kI.contract,list:Ky.contract,search:_y.contract,get:sy.contract,resolve:qy.contract,ignore:dy.contract,reopen:py.contract,reassignAndReopen:Aw.contract,mute:tw.contract,unmute:gw.contract},workItems:{create:hO.contract,comment:BO.contract,transition:cO.contract},billing:{getSummary:mM.contract,getUsage:WM.contract,listTransactions:ZM.contract,retryOutstandingBalance:VM.contract,getAutoTopUp:XM.contract,updateAutoTopUp:jM.contract,purchaseCredits:KM.contract,listPlans:_M.contract,previewPlanChange:xM.contract,changePlan:sM.contract,createCheckoutSession:qM.contract,getCheckoutSessionStatus:dM.contract,createPortalSession:pM.contract,getPaymentMethod:AY.contract},tasks:{list:Qa.contract},recommendations:{list:ea.contract},components:{list:Fy.contract,get:My.contract,register:MI.contract,deregister:Yy.contract,rename:ky.contract,assignTeam:$y.contract,retirementPreview:Gy.contract,retire:Ty.contract,restorationPreview:Jy.contract,restore:Py.contract,mergePreview:my.contract,merge:Wy.contract,relationships:{list:fy.contract,preview:Ry.contract,add:Oy.contract,remove:vy.contract},incidents:{list:Zy.contract},timeline:Vy.contract}}});var fQ=r(()=>{om();NM();YM();zCA();iY();QY();uw();Ok();Of();xf();WR();VR();XR();AO();tO()});var nsA="https://api.sazabi.com",isA="x-sazabi-client-source",WCA=(A)=>{return{streamRun:async(t)=>{return mCA({options:A,path:`/runs/${encodeURIComponent(t.runId)}/stream`,cursor:t.cursor,signal:t.signal})},streamThread:async(t)=>{return mCA({options:A,path:`/threads/${encodeURIComponent(t.threadId)}/stream`,cursor:t.cursor,signal:t.signal})}}},mCA=async(A)=>{let t=A.options.fetch??globalThis.fetch;if(!t)throw Error("Fetch transport is not available in this runtime.");let g=await A.options.credentialProvider.getToken(),i=osA(A.options.apiBaseUrl,A.path,A.cursor);return QsA({url:i,token:g,clientSource:A.options.clientSource,initialCursor:A.cursor,signal:A.signal,fetch:t})},osA=(A,t,g)=>{let i=esA(A??nsA),n=new URL(`${i}${t}`);if(g)n.searchParams.set(QM,g);return n.toString()},esA=(A)=>{let t=A.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},QsA=async(A)=>{let t=[],g=[],i=!1,n=!1,o,e=A.initialCursor,I=new AbortController,h=(w)=>{if(i)return;i=!0,o=w;while(g.length>0)g.shift()?.({value:void 0,done:!0})},B=(w)=>{let l=g.shift();if(l){l({value:w,done:!1});return}t.push(w)},c=(w)=>{if(w.event===hM){let N=CsA(w.data);if(N!==void 0)e=N;return}if(w.data===BM){n=!0,I.abort(),h();return}let l=EsA(w.data);if(l)B(l)},C=()=>{n=!0,I.abort(),h()};if(A.signal)if(A.signal.aborted)n=!0,I.abort();else A.signal.addEventListener("abort",C,{once:!0});let E={[Symbol.asyncIterator](){return E},get cursor(){return e},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(i){if(o)throw o;return{value:void 0,done:!0}}return new Promise((w)=>{g.push(w)}).then((w)=>{if(w.done&&o)throw o;return w})},return:async()=>{return n=!0,I.abort(),h(),{value:void 0,done:!0}},throw:async(w)=>{throw n=!0,I.abort(),h(w instanceof Error?w:Error(String(w))),w},close:async()=>{n=!0,I.abort(),h()}};if(n)return h(),E;let a=await A.fetch(A.url,{method:IM,headers:IsA(A.token,A.clientSource),signal:I.signal});if(await hsA(a))h();else BsA(a,c).then(()=>h()).catch((w)=>{if(rsA(w)||n||A.signal?.aborted){h();return}h(ysA(w))});return E},IsA=(A,t)=>{return{accept:"text/event-stream",authorization:`Bearer ${A}`,...t?{[isA]:t}:{}}},hsA=async(A)=>{if(A.status===204)return!0;if(A.ok&&A.body)return!1;let t=await asA(A);if(A.status===401)throw Error("Authentication failed. Check your credential.");if(A.status===403)throw Error(`Forbidden (403): ${t||"Credential may not have access to this resource"}`);if(A.status===404)throw Error(`Not found (404): ${t||"Run or thread not found"}`);if(A.status===400)throw Error(`Invalid stream cursor (400): ${t||"The provided cursor was rejected"}`);if(A.status>=400&&A.status<500&&A.status!==429)throw Error(`Client error (${A.status}): ${t}`);if(!A.body)throw Error("Agent stream response did not include a body.");throw Error(A.status===429?`Rate limited (429): ${t}`:`Server error (${A.status}): ${t}`)},BsA=async(A,t)=>{let g=A.body?.getReader();if(!g)throw Error("Agent stream response did not include a body.");let i=new TextDecoder,n="",o=csA(t);try{while(!0){let e=await g.read();if(e.done)break;n+=i.decode(e.value,{stream:!0});let I=n.split(/\r\n|\r|\n/);n=I.pop()??"";for(let h of I)o.line(h)}if(n+=i.decode(),n)for(let e of n.split(/\r\n|\r|\n/))o.line(e);o.flush()}finally{g.releaseLock()}},csA=(A)=>{let t="message",g=[],i=()=>{t="message",g=[]},n=()=>{if(g.length===0){i();return}A({event:t,data:g.join(`
8708
8708
  `)}),i()};return{line:(o)=>{if(o===""){n();return}if(o.startsWith(":"))return;let e=o.indexOf(":"),I=e===-1?o:o.slice(0,e),h=e===-1?"":o.slice(e+1),B=h.startsWith(" ")?h.slice(1):h;if(I==="event"){t=B||"message";return}if(I==="data")g.push(B)},flush:n}},CsA=(A)=>{try{let t=eM.safeParse(JSON.parse(A));return t.success?t.data.streamNextOffset:void 0}catch{return}},EsA=(A)=>{try{let t=oM.safeParse(JSON.parse(A));return t.success?t.data:void 0}catch{return}},asA=async(A)=>{try{return await A.text()}catch{return""}},rsA=(A)=>{return A instanceof Error&&A.name==="AbortError"},ysA=(A)=>{return A instanceof Error?A:Error(String(A))};var ZCA=r(()=>{fQ()});var EO,aO,rO,VCA;var HCA=r(()=>{JA();EO=Q.object({severities:Q.array(Q.string()).optional().describe("Limit results to the listed severities."),services:Q.array(Q.string()).optional().describe("Limit results to the listed service names."),environments:Q.array(Q.string()).optional().describe("Limit results to the listed deployment environments."),searchTerm:Q.string().optional().describe("Case-insensitive substring match against the log body."),traceId:Q.string().optional().describe("Limit results to one trace ID."),attributes:Q.record(Q.string(),Q.string()).optional().describe("Limit results to logs whose attributes contain every listed key with an exactly equal value.")}),aO=Q.object({service:Q.string(),namespace:Q.string(),environment:Q.string(),host:Q.string(),container:Q.string(),pod:Q.string()}),rO=Q.object({id:Q.string(),timestamp:Q.string().datetime(),severity:Q.string(),body:Q.string(),service:Q.string(),traceId:Q.string(),spanId:Q.string(),attributes:Q.record(Q.string(),Q.string()),resource:aO}),VCA=Q.object({type:Q.literal("logs"),timestamp:Q.string().datetime(),data:Q.array(rO)})});var wsA="https://{region}.intake.sazabi.com",DsA="https://{region}.tail.sazabi.com",KCA=500,usA=5000,_CA="sazabi.public_key",bsA="x-sazabi-internal-log-forwarding-secret",lsA="x-sazabi-internal-log-forwarding-source",NsA=(A)=>{return A.startsWith("[")&&A.endsWith("]")?A.slice(1,-1):A},xCA=(A)=>{let t=NsA(A);return t==="localhost"||t==="127.0.0.1"||t==="::1"},UsA,SsA,LsA,sCA=(A)=>{let t=new Map;return{tail:async(g)=>{let i=await OsA(A.credentialProvider,g.projectId,"logs.tail"),n=await vsA(A,t,i,g.region,"logs.tail"),o=YsA({projectId:i,region:n,filters:g.filters,apiBaseUrl:A.apiBaseUrl,tailBaseUrl:A.tailBaseUrl}),e=await A.credentialProvider.getToken(),I=A.fetch??globalThis.fetch;if(!I)throw Error("Fetch transport is not available in this runtime.");return msA({token:e,url:o,signal:g.signal,fetch:I})},forward:async(g)=>{let i=await zsA(A,t,g.projectId??await A.credentialProvider.getProjectId?.(),g.region,"logs.forward"),n=TsA(i,A.intakeBaseUrl),o=A.fetch??globalThis.fetch,e=PsA(g.logs,g.publicKey),I=_sA(e);return await KsA(o,n,e,RsA(g.sazabiInternalForwarding)),{forwardedCount:I,failedCount:0}}}},FsA="3010",MsA,YsA=(A)=>{let t=(A.tailBaseUrl??ksA({region:A.region,apiBaseUrl:A.apiBaseUrl})).replace("{region}",A.region),g=$sA(t);g.searchParams.set("projectId",A.projectId);let i=GsA(A.filters);if(i)g.searchParams.set("filters",i);return g.toString()},ksA=(A)=>{if(A.apiBaseUrl)try{let t=new URL(A.apiBaseUrl).hostname;if(t.endsWith(".sazabi.dev")){let g=t.includes(".staging.")?"staging.sazabi.dev":"development.sazabi.dev";return`https://${A.region}.tail.${g}`}}catch{}return DsA.replace("{region}",A.region)},$sA=(A)=>{let t=(()=>{try{return new URL(A)}catch{return null}})();if(!t)throw Error(`Invalid tail base URL: ${A}`);if(xCA(t.hostname)){if(t.protocol="http:",!t.port||MsA.has(t.port))t.port=FsA;return t.pathname="/v1/tail",t.search="",t.hash="",t}if(t.protocol==="ws:"||t.protocol==="wss:")t.protocol=t.protocol==="wss:"?"https:":"http:";if(t.protocol!=="http:"&&t.protocol!=="https:")throw Error(`Invalid tail base URL protocol: ${t.protocol}. Expected http:, https:, ws:, or wss:.`);return t.pathname="/v1/tail",t.search="",t.hash="",t},GsA=(A)=>{if(!A)return;let t=Object.entries(A).filter(([,g])=>g!==void 0&&(!Array.isArray(g)||g.length>0)&&(typeof g!=="object"||Array.isArray(g)||g===null||Object.keys(g).length>0)&&g!=="");if(t.length===0)return;return JSON.stringify(Object.fromEntries(t))},TsA=(A,t)=>{let g=(t??wsA).replace("{region}",A),i=g.endsWith("/")?g.slice(0,-1):g,n=JsA(i);if(n)return n;let o=i.match(/^https:\/\/([a-z0-9-]+)\.intake\.([a-z0-9.]+)$/);return`${o?`https://otlp.${o[1]}.intake.${o[2]}`:i}/v1/logs`},JsA=(A)=>{let t=(()=>{try{return new URL(A)}catch{return null}})();if(!t)return;if(!xCA(t.hostname))return;return t.pathname="/adapters/otlp",t.toString()},PsA=(A,t)=>{let g=A.resourceLogs;if(!g||g.length===0)return{...A,resourceLogs:[{resource:{attributes:[qCA(t)]},scopeLogs:[]}]};return{...A,resourceLogs:g.map((i)=>({...i,resource:{...i.resource,attributes:fsA(i.resource?.attributes,t)}}))}},fsA=(A,t)=>{return[...(A??[]).filter((i)=>i?.key!==_CA),qCA(t)]},qCA=(A)=>({key:_CA,value:{stringValue:A}}),RsA=(A)=>{if(!A?.secret)return{};return{[bsA]:A.secret,...A.source?{[lsA]:A.source}:{}}},OsA=async(A,t,g)=>{let i=t??await A.getProjectId?.();if(i)return i;throw AEA(g,"Project ID is required",["projectId"])},vsA=async(A,t,g,i,n)=>{return i??await dCA(A,t,g)},zsA=async(A,t,g,i,n)=>{if(i)return i;if(!g)throw AEA(n,"Project ID is required",["projectId"]);return dCA(A,t,g)},dCA=async(A,t,g)=>{let i=t.get(g);if(i)return i;let n=A.raw.projects.get({projectId:g}).then((o)=>o.project.region);t.set(g,n);try{return await n}catch(o){throw t.delete(g),o}},msA=async(A)=>{let t=[],g=[],i=!1,n=!1,o,e=0,I,h,B=(l)=>{if(i)return;i=!0,o=l;while(g.length>0){let N=g.shift();if(N)N({value:void 0,done:!0})}},c=(l)=>{let N=g.shift();if(N){N({value:l,done:!1});return}t.push(l)},C=()=>{h?.abort()},E=(l)=>{if(l.event!=="log"){if(l.id)I=l.id;return}let N=XsA(l.data);for(let Y of N)c(Y);if(l.id)I=l.id},a=async(l)=>{let N=!1;while(!i&&!n){let Y=new AbortController,T=()=>Y.abort();h=Y;let H=!1;A.signal?.addEventListener("abort",T,{once:!0});try{let P=await A.fetch(WsA(A.url,I),{method:"GET",headers:{accept:"text/event-stream",authorization:`Bearer ${A.token}`},signal:Y.signal});await ZsA(P),e=0,N=!0,l(),await VsA(P,E),H=!0}catch(P){if(jCA(P)||A.signal?.aborted)break;let eA=XCA(P);if(!N||jsA(eA))throw eA;H=!0}finally{if(A.signal?.removeEventListener("abort",T),h===Y)h=void 0}if(i||n||A.signal?.aborted)break;if(!H)continue;e+=1,await pCA(Math.min(KCA*2**(e-1),usA),A.signal)}};if(A.signal?.addEventListener("abort",()=>{n=!0,C(),B()},{once:!0}),A.signal?.aborted)n=!0,C(),B();await new Promise((l,N)=>{let Y=!1;a(()=>{if(!Y)Y=!0,l()}).catch((H)=>{let P=XCA(H);if(!Y){Y=!0,N(P);return}if(!jCA(H))B(P)})});let w={[Symbol.asyncIterator](){return w},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(i){if(o)throw o;return{value:void 0,done:!0}}return new Promise((l)=>{g.push(l)}).then((l)=>{if(l.done&&o)throw o;return l})},return:async()=>{return n=!0,C(),B(),{value:void 0,done:!0}},throw:async(l)=>{throw n=!0,C(),B(l instanceof Error?l:Error(String(l))),l}};return w},WsA=(A,t)=>{if(!t)return A;let g=new URL(A);return g.searchParams.set("cursor",t),g.toString()},ZsA=async(A)=>{if(A.ok&&A.body)return;let t=await A.text();if(A.status===401)throw Error("Authentication failed. Check your credential.");if(A.status===403){if(/not served by this region/i.test(t))throw Error(`Wrong region (403): ${t||"Project is not served by this region"}`);throw Error(`Forbidden (403): ${t||"Credential may not have access to this project"}`)}if(A.status>=400&&A.status<500&&A.status!==429)throw Error(`Client error (${A.status}): ${t}`);if(!A.body)throw Error("Tail stream response did not include a body.");throw Error(A.status===429?`Rate limited (429): ${t}`:`Server error (${A.status}): ${t}`)},VsA=async(A,t)=>{let g=A.body?.getReader();if(!g)throw Error("Tail stream response did not include a body.");let i=new TextDecoder,n="",o=HsA(t);try{while(!0){let e=await g.read();if(e.done)break;n+=i.decode(e.value,{stream:!0});let I=n.split(/\r\n|\r|\n/);n=I.pop()??"";for(let h of I)o.line(h)}if(n+=i.decode(),n){let e=n.split(/\r\n|\r|\n/);for(let I of e)o.line(I)}o.flush()}finally{g.releaseLock()}},HsA=(A)=>{let t="message",g,i=[],n=()=>{t="message",g=void 0,i=[]},o=()=>{if(i.length===0&&!g){n();return}A({event:t,data:i.join(`
8709
8709
  `),...g?{id:g}:{}}),n()};return{line:(e)=>{if(e===""){o();return}if(e.startsWith(":"))return;let I=e.indexOf(":"),h=I===-1?e:e.slice(0,I),B=I===-1?"":e.slice(I+1),c=B.startsWith(" ")?B.slice(1):B;if(h==="event"){t=c||"message";return}if(h==="data"){i.push(c);return}if(h==="id"&&!c.includes("\x00"))g=c},flush:o}},XsA=(A)=>{try{let t=VCA.safeParse(JSON.parse(A));if(!t.success)return[];return t.data.data}catch{return[]}},XCA=(A)=>{return A instanceof Error?A:Error(String(A))},jCA=(A)=>{return A instanceof Error&&A.name==="AbortError"},jsA=(A)=>{return A.message.startsWith("Authentication failed")||A.message.startsWith("Forbidden (")||A.message.startsWith("Wrong region (")||A.message.startsWith("Client error (")},KsA=async(A,t,g,i={},n=3,o=1e4)=>{let e;for(let I=0;I<=n;I+=1){let h=new AbortController,B=globalThis.setTimeout(()=>h.abort(),o);try{let c=await A(t,{method:"POST",headers:{"content-type":"application/json",...i},body:JSON.stringify(g),signal:h.signal});if(c.ok)return;let C=await c.text();if(c.status===401||c.status===403)throw Error("Authentication failed. Check your public key.");if(c.status>=400&&c.status<500&&c.status!==429)throw Error(`Client error (${c.status}): ${C}`);e=Error(c.status===429?`Rate limited (429): ${C}`:`Server error (${c.status}): ${C}`)}catch(c){let C=c instanceof Error?c.message:String(c);if(C.startsWith("Authentication failed")||C.startsWith("Client error ("))throw c instanceof Error?c:Error(C);e=c instanceof Error&&c.name==="AbortError"?Error("Request timed out"):c instanceof Error?c:Error(String(c))}finally{globalThis.clearTimeout(B)}if(I<n)await pCA(KCA*2**I)}throw Error(`Failed after ${n+1} attempts: ${e?.message??"Unknown error"}`)},_sA=(A)=>{return A.resourceLogs?.reduce((t,g)=>t+(g.scopeLogs?.reduce((i,n)=>i+(n.logRecords?.length??0),0)??0),0)??0},pCA=async(A,t)=>{if(t?.aborted)return;await new Promise((g)=>{let i=globalThis.setTimeout(g,A);t?.addEventListener("abort",()=>{globalThis.clearTimeout(i),g()},{once:!0})})},AEA=(A,t,g)=>{return new _t("BAD_REQUEST",{message:t,data:{operationId:A,missingContext:g}})};var yO=r(()=>{xQ();HCA();JA();UsA=Q.object({projectId:Q.string().uuid().optional().describe("Project to tail logs for. Auto-filled from CLI and SDK context when omitted."),filters:EO.optional().describe("Optional filters applied by the tail SSE service.")}),SsA=Q.object({publicKey:Q.string().min(1).describe("Public key for intake auth. Create or list one via the public key endpoints."),logs:Q.custom((A)=>typeof A==="object"&&A!==null).describe("OTLP logs export request payload to send to the intake service.")}),LsA=Q.object({forwardedCount:Q.number().int().nonnegative().describe("Number of log records accepted by the intake request."),failedCount:Q.number().int().nonnegative().describe("Number of log records rejected by the intake request.")}),MsA=new Set(["15006","3010"])});var wO="https://api.sazabi.com",gEA="https://api.platform.sazabi.com",nEA="sazabi-cli",xsA="urn:ietf:params:oauth:grant-type:device_code",iEA=(A)=>{let t=xl(new IN(CO,{url:ssA(A.apiBaseUrl??wO),headers:async()=>{let n=new Headers({authorization:`Bearer ${await A.credentialProvider.getToken()}`});if(A.clientSource)n.set("x-sazabi-client-source",A.clientSource);if(A.sandboxActorDescriptor)n.set("x-sazabi-sandbox-actor",A.sandboxActorDescriptor);return n},fetch:A.fetch,customErrorResponseBodyDecoder:(n,o)=>{let e=n3A(n);if(!e)return null;return new _t(e.code,{message:e.message,status:o.status,data:{operationId:e.operationId,missingContext:e.missingContext}})}})),g=sCA({raw:t,credentialProvider:A.credentialProvider,fetch:A.fetch,apiBaseUrl:A.apiBaseUrl??wO,intakeBaseUrl:A.intakeBaseUrl,tailBaseUrl:A.tailBaseUrl}),i=WCA({credentialProvider:A.credentialProvider,fetch:A.fetch,apiBaseUrl:A.apiBaseUrl??wO,clientSource:A.clientSource});return{raw:t,me:async()=>t.me({}),automations:{list:async(n={})=>t.automations.list(await AA(A.credentialProvider,n,"automations.list")),get:async(n)=>t.automations.get(await AA(A.credentialProvider,n,"automations.get")),create:async(n)=>t.automations.create(await AA(A.credentialProvider,n,"automations.create")),update:async(n)=>t.automations.update(await AA(A.credentialProvider,n,"automations.update")),enable:async(n)=>t.automations.enable(await AA(A.credentialProvider,n,"automations.enable")),disable:async(n)=>t.automations.disable(await AA(A.credentialProvider,n,"automations.disable")),runs:{list:async(n)=>t.automations.runs.list(await AA(A.credentialProvider,n,"automations.runs.list")),get:async(n)=>t.automations.runs.get(await AA(A.credentialProvider,n,"automations.runs.get")),logs:async(n)=>t.automations.runs.logs(await AA(A.credentialProvider,n,"automations.runs.logs"))}},logs:{...g,query:async(n={})=>t.logs.query(await AA(A.credentialProvider,n,vI.operationId)),schema:async(n={})=>t.logs.schema(await AA(A.credentialProvider,n,zI.operationId)),volume:async(n)=>t.logs.volume(await AA(A.credentialProvider,n,mI.operationId)),patterns:async(n={})=>t.logs.patterns(await AA(A.credentialProvider,n,WI.operationId)),nativeQuery:async(n)=>t.logs.nativeQuery(await AA(A.credentialProvider,n,ZI.operationId))},organizations:{list:async()=>t.organizations.list({}),get:async(n)=>t.organizations.get(n),update:async(n)=>t.organizations.update(await dsA(A.credentialProvider,n))},members:{list:async(n={})=>t.members.list(await GA(A.credentialProvider,n)),updateRole:async(n)=>t.members.updateRole(await GA(A.credentialProvider,n)),remove:async(n)=>{let o=await GA(A.credentialProvider,n);return t.members.remove({params:{member:o.member},query:{organizationId:o.organizationId}})},invite:async(n)=>t.members.invite(await GA(A.credentialProvider,n)),listInvitations:async(n={})=>t.members.listInvitations(await GA(A.credentialProvider,n)),revokeInvitation:async(n)=>{let o=await GA(A.credentialProvider,n);return t.members.revokeInvitation({params:{invitationId:o.invitationId},query:{organizationId:o.organizationId}})}},teams:{list:async(n={})=>t.teams.list(await GA(A.credentialProvider,n)),create:async(n)=>t.teams.create(await GA(A.credentialProvider,n)),update:async(n)=>t.teams.update(await GA(A.credentialProvider,n)),delete:async(n)=>{let o=await GA(A.credentialProvider,n);return t.teams.delete({params:{teamId:o.teamId},query:{organizationId:o.organizationId}})},addMember:async(n)=>t.teams.addMember(await GA(A.credentialProvider,n)),removeMember:async(n)=>{let o=await GA(A.credentialProvider,n);return t.teams.removeMember({params:{teamId:o.teamId,userId:o.userId},query:{organizationId:o.organizationId}})},listMembers:async(n)=>t.teams.listMembers(await GA(A.credentialProvider,n))},publicKeys:{list:async(n={})=>t.publicKeys.list(await AA(A.credentialProvider,n,$I.operationId)),get:async(n)=>t.publicKeys.get(await AA(A.credentialProvider,n,GI.operationId)),ensureLogForwarding:async(n={})=>t.publicKeys.ensureLogForwarding(await AA(A.credentialProvider,n,TI.operationId)),update:async(n)=>t.publicKeys.update(await AA(A.credentialProvider,n,JI.operationId)),deactivate:async(n)=>{let o=await AA(A.credentialProvider,n,PI.operationId);return t.publicKeys.deactivate({params:{keyId:o.keyId},query:{projectId:o.projectId}})}},secretKeys:{list:async(n={})=>t.secretKeys.list(n),get:async(n)=>t.secretKeys.get(n),create:async(n)=>t.secretKeys.create(n),update:async(n)=>t.secretKeys.update(n),delete:async(n)=>{await t.secretKeys.delete({params:{keyId:n.keyId}})}},search:{threads:async(n)=>t.search.threads(await AA(A.credentialProvider,n,$B.operationId)),messages:async(n)=>t.search.messages(await AA(A.credentialProvider,n,GB.operationId))},projects:{list:async(n={})=>t.projects.list(await qsA(A.credentialProvider,n)),get:async(n)=>t.projects.get(n),create:async(n)=>t.projects.create(await GA(A.credentialProvider,n))},messages:{list:async(n)=>t.messages.list(n),append:async(n)=>tEA(t,await t.messages.append(g3A(n)))},threads:{list:async(n={})=>t.threads.list(await psA(A.credentialProvider,n)),get:async(n)=>t.threads.get(n),getStatus:async(n)=>t.threads.getStatus(n),stop:async(n)=>t.threads.stop(n),create:async(n)=>tEA(t,await t.threads.create(await t3A(A.credentialProvider,n))),update:async(n)=>t.threads.update(n),fork:async(n)=>t.threads.fork(n),setVisibility:async(n)=>t.threads.setVisibility(n),createShareLink:async(n)=>t.threads.createShareLink(n),listShareLinks:async(n)=>t.threads.listShareLinks(n),revokeShareLink:async(n)=>t.threads.revokeShareLink(n),stream:async(n)=>i.streamThread(n)},runs:{list:async(n={})=>t.runs.list(await A3A(A.credentialProvider,n)),listForThread:async(n)=>t.runs.listForThread(n),get:async(n)=>t.runs.get(n),cancel:async(n)=>t.runs.cancel(n),stream:async(n)=>i.streamRun(n)},logSources:{listProviders:async()=>t.logSources.listProviders({}),list:async(n={})=>t.logSources.list(await AA(A.credentialProvider,n,RI.operationId)),get:async(n)=>t.logSources.get(n),create:async(n)=>t.logSources.create(await AA(A.credentialProvider,n,OI.operationId)),update:async(n)=>t.logSources.update(n),delete:async(n)=>t.logSources.delete(n)},logStreams:{list:async(n)=>t.logStreams.list(n),get:async(n)=>t.logStreams.get(n),create:async(n)=>t.logStreams.create(n),update:async(n)=>t.logStreams.update(n),delete:async(n)=>t.logStreams.delete(n),reassign:async(n)=>t.logStreams.reassign(n)},connectedAccounts:{beginConnect:async(n)=>t.connectedAccounts.beginConnect(await GA(A.credentialProvider,n)),getConnectAttempt:async(n)=>t.connectedAccounts.getConnectAttempt(await GA(A.credentialProvider,n)),list:async(n={})=>t.connectedAccounts.list(await GA(A.credentialProvider,n)),disconnect:async(n)=>t.connectedAccounts.disconnect(await GA(A.credentialProvider,n))},integrations:{listProviders:async(n={})=>t.integrations.listProviders(await GA(A.credentialProvider,n)),listConnections:async(n={})=>t.integrations.listConnections(await GA(A.credentialProvider,n)),getConnection:async(n)=>t.integrations.getConnection(await GA(A.credentialProvider,n)),createConnection:async(n)=>t.integrations.createConnection(await GA(A.credentialProvider,n)),beginConnect:async(n)=>t.integrations.beginConnect(await GA(A.credentialProvider,n)),getConnectAttempt:async(n)=>t.integrations.getConnectAttempt(await GA(A.credentialProvider,n)),disconnectConnection:async(n)=>t.integrations.disconnectConnection(await GA(A.credentialProvider,n)),updateConnectionCredentials:async(n)=>t.integrations.updateConnectionCredentials(await GA(A.credentialProvider,n))},mcpConnectors:{list:async(n={})=>t.mcpConnectors.list(await AA(A.credentialProvider,n,QB.operationId)),get:async(n)=>t.mcpConnectors.get(await AA(A.credentialProvider,n,IB.operationId)),details:async(n)=>t.mcpConnectors.details(await AA(A.credentialProvider,n,hB.operationId)),listProviders:async()=>t.mcpConnectors.listProviders({}),search:async(n={})=>t.mcpConnectors.search(await AA(A.credentialProvider,n,BB.operationId)),describe:async(n)=>t.mcpConnectors.describe(await AA(A.credentialProvider,n,cB.operationId)),call:async(n)=>t.mcpConnectors.call(await AA(A.credentialProvider,n,CB.operationId)),create:async(n)=>t.mcpConnectors.create(await AA(A.credentialProvider,n,EB.operationId)),update:async(n)=>t.mcpConnectors.update(await AA(A.credentialProvider,n,aB.operationId)),disconnect:async(n)=>{await t.mcpConnectors.disconnect(await AA(A.credentialProvider,n,rB.operationId))},setReadOnly:async(n)=>t.mcpConnectors.setReadOnly(await AA(A.credentialProvider,n,yB.operationId)),beginOAuthInstall:async(n)=>t.mcpConnectors.beginOAuthInstall(await AA(A.credentialProvider,n,wB.operationId)),getOAuthInstallAttempt:async(n)=>t.mcpConnectors.getOAuthInstallAttempt(await AA(A.credentialProvider,n,DB.operationId))},sandboxPresets:{delete:async(n)=>t.sandboxPresets.deletePreset(await AA(A.credentialProvider,n,YB.operationId)),listConnections:async(n={})=>t.sandboxPresets.listConnections(await AA(A.credentialProvider,n,FB.operationId)),listTypes:async()=>t.sandboxPresets.listTypes({}),test:async(n)=>t.sandboxPresets.testPreset(await AA(A.credentialProvider,n,kB.operationId)),upsert:async(n)=>t.sandboxPresets.upsertPreset(await AA(A.credentialProvider,n,MB.operationId))},memory:{list:async(n={})=>t.memory.list(await AA(A.credentialProvider,n,lB.operationId)),get:async(n)=>t.memory.get(await AA(A.credentialProvider,n,bB.operationId)),put:async(n)=>t.memory.put(await AA(A.credentialProvider,n,uB.operationId)),search:async(n)=>t.memory.search(await AA(A.credentialProvider,n,NB.operationId)),delete:async(n)=>t.memory.delete(await AA(A.credentialProvider,n,UB.operationId))},logMatchExpressions:{list:async(n={})=>t.logMatchExpressions.list(await AA(A.credentialProvider,n,"logMatchExpressions.list")),get:async(n)=>t.logMatchExpressions.get(await AA(A.credentialProvider,n,"logMatchExpressions.get")),create:async(n)=>t.logMatchExpressions.create(await AA(A.credentialProvider,n,"logMatchExpressions.create")),update:async(n)=>t.logMatchExpressions.update(await AA(A.credentialProvider,n,"logMatchExpressions.update")),disable:async(n)=>t.logMatchExpressions.disable(await AA(A.credentialProvider,n,"logMatchExpressions.disable"))},scripts:{list:async(n={})=>t.scripts.list(await AA(A.credentialProvider,n,"scripts.list")),get:async(n)=>t.scripts.get(await AA(A.credentialProvider,n,"scripts.get")),create:async(n)=>t.scripts.create(await AA(A.credentialProvider,n,"scripts.create")),update:async(n)=>t.scripts.update(await AA(A.credentialProvider,n,"scripts.update")),delete:async(n)=>t.scripts.delete(await AA(A.credentialProvider,n,"scripts.delete"))},issues:{count:async(n={})=>t.issues.count(await AA(A.credentialProvider,n,"issues.count")),create:async(n)=>t.issues.create(await AA(A.credentialProvider,n,kI.operationId)),list:async(n={})=>t.issues.list(await AA(A.credentialProvider,n,"issues.list")),search:async(n={})=>t.issues.search(await AA(A.credentialProvider,n,"issues.search")),get:async(n)=>t.issues.get(n),resolve:async(n)=>t.issues.resolve(n),ignore:async(n)=>t.issues.ignore(n),reopen:async(n)=>t.issues.reopen(n),mute:async(n)=>t.issues.mute(n),unmute:async(n)=>t.issues.unmute(n)},workItems:{create:async(n)=>t.workItems.create(n),comment:async(n)=>t.workItems.comment(n),transition:async(n)=>t.workItems.transition(n)},pullRequests:{list:async(n={})=>t.pullRequests.list(await AA(A.credentialProvider,n,"pullRequests.list"))},components:{list:async(n={})=>t.components.list(await AA(A.credentialProvider,n,"components.list")),get:async(n)=>t.components.get(n),register:async(n)=>t.components.register(await AA(A.credentialProvider,n,MI.operationId)),deregister:async(n)=>t.components.deregister({componentId:n.componentId,...n.reason!==void 0?{reason:n.reason}:{}}),rename:async(n)=>t.components.rename(n),assignTeam:async(n)=>t.components.assignTeam(n),retirementPreview:async(n)=>t.components.retirementPreview(n),retire:async(n)=>t.components.retire(n),restorationPreview:async(n)=>t.components.restorationPreview(n),restore:async(n)=>t.components.restore(n),mergePreview:async(n)=>t.components.mergePreview(await AA(A.credentialProvider,n,"components.mergePreview")),merge:async(n)=>t.components.merge(await AA(A.credentialProvider,n,"components.merge")),relationships:{list:async(n={})=>t.components.relationships.list(await AA(A.credentialProvider,n,"components.relationships.list")),preview:async(n)=>t.components.relationships.preview(await AA(A.credentialProvider,n,"components.relationships.preview")),add:async(n)=>t.components.relationships.add(await AA(A.credentialProvider,n,"components.relationships.add")),remove:async(n)=>t.components.relationships.remove(await AA(A.credentialProvider,n,"components.relationships.remove"))},incidents:{list:async(n={})=>t.components.incidents.list(await AA(A.credentialProvider,n,"components.incidents.list"))},timeline:async(n)=>t.components.timeline(n)},billing:{getSummary:async(n={})=>t.billing.getSummary(await GA(A.credentialProvider,n)),getUsage:async(n={})=>t.billing.getUsage(await GA(A.credentialProvider,n)),listTransactions:async(n={})=>t.billing.listTransactions(await GA(A.credentialProvider,n)),retryOutstandingBalance:async(n)=>t.billing.retryOutstandingBalance(await GA(A.credentialProvider,n)),getAutoTopUp:async(n={})=>t.billing.getAutoTopUp(await GA(A.credentialProvider,n)),updateAutoTopUp:async(n)=>t.billing.updateAutoTopUp(await GA(A.credentialProvider,n)),purchaseCredits:async(n)=>t.billing.purchaseCredits(await GA(A.credentialProvider,n)),listPlans:async(n={})=>t.billing.listPlans(await GA(A.credentialProvider,n)),previewPlanChange:async(n)=>t.billing.previewPlanChange(await GA(A.credentialProvider,n)),changePlan:async(n)=>t.billing.changePlan(await GA(A.credentialProvider,n)),createCheckoutSession:async(n)=>t.billing.createCheckoutSession(await GA(A.credentialProvider,n)),getCheckoutSessionStatus:async(n)=>t.billing.getCheckoutSessionStatus(await GA(A.credentialProvider,n)),createPortalSession:async(n={})=>t.billing.createPortalSession(await GA(A.credentialProvider,n)),getPaymentMethod:async(n={})=>t.billing.getPaymentMethod(await GA(A.credentialProvider,n))},tasks:{list:async(n={})=>t.tasks.list(await AA(A.credentialProvider,n,Qa.operationId))},recommendations:{list:async(n={})=>t.recommendations.list(await AA(A.credentialProvider,n,ea.operationId))},notificationDeliveryRules:{list:async(n={})=>t.notificationDeliveryRules.list(await AA(A.credentialProvider,n,"notificationDeliveryRules.list")),options:async(n={})=>t.notificationDeliveryRules.options(await AA(A.credentialProvider,n,"notificationDeliveryRules.options")),create:async(n)=>t.notificationDeliveryRules.create(await AA(A.credentialProvider,n,"notificationDeliveryRules.create")),update:async(n)=>t.notificationDeliveryRules.update(await AA(A.credentialProvider,n,"notificationDeliveryRules.update")),delete:async(n)=>t.notificationDeliveryRules.delete(await AA(A.credentialProvider,n,"notificationDeliveryRules.delete"))},notificationChannels:{getProject:async(n={})=>t.notificationChannels.getProject(await AA(A.credentialProvider,n,"notificationChannels.getProject"))}}},uO=async(A={})=>{let t=await QEA(A.fetch)(oEA(A.apiBaseUrl??gEA,"/device/code"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_id:A.clientId??nEA,...A.scope?{scope:A.scope}:{}})}),g=await t.json();if(!t.ok)throw i3A(g,t.status);let i=g;return{deviceCode:TB(i.device_code,"device_code"),userCode:TB(i.user_code,"user_code"),verificationUri:TB(i.verification_uri,"verification_uri"),verificationUriComplete:TB(i.verification_uri_complete,"verification_uri_complete"),expiresIn:DO(i.expires_in,"expires_in"),interval:DO(i.interval,"interval")}},bO=async(A)=>{let t=await QEA(A.fetch)(oEA(A.apiBaseUrl??gEA,"/device/token"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:xsA,device_code:A.deviceCode,client_id:A.clientId??nEA})}),g=await t.json();if(t.ok){let n=g;return{status:"authorized",accessToken:TB(n.access_token,"access_token"),tokenType:TB(n.token_type,"token_type"),expiresIn:DO(n.expires_in,"expires_in"),scope:typeof n.scope==="string"?n.scope:""}}let i=eEA(g);if(!i)throw Error(`Device authorization failed with status ${t.status}`);if(i.error==="authorization_pending")return{status:"pending"};if(i.error==="slow_down")return{status:"pending",interval:10};if(i.error==="access_denied")return{status:"denied",message:i.errorDescription};if(i.error==="expired_token"||i.error==="invalid_grant")return{status:"expired",message:i.errorDescription};throw Error(i.errorDescription)},ssA=(A)=>{let t=A.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},oEA=(A,t)=>{return`${A.replace(/\/+$/,"")}/api/auth${t}`},qsA=async(A,t)=>{return GA(A,t)},GA=async(A,t)=>{let g=t.organizationId??await A.getOrganizationId?.();return g?{...t,organizationId:g}:t},dsA=async(A,t)=>{let g=t.organizationId??await A.getOrganizationId?.();if(!g)throw new _t("BAD_REQUEST",{message:"Organization ID is required",data:{operationId:"organizations.update",missingContext:["organizationId"]},status:400});return{...t,organizationId:g}},AA=async(A,t,g)=>{let i=t.projectId??await A.getProjectId?.();if(!i)throw new _t("BAD_REQUEST",{message:"Project ID is required",data:{operationId:g,missingContext:["projectId"]},status:400});return{...t,projectId:i}},psA=async(A,t)=>{let g=t.projectId??await A.getProjectId?.();return g?{...t,projectId:g}:t},A3A=async(A,t)=>{let g=t.projectId??await A.getProjectId?.();return g?{...t,projectId:g}:t},t3A=async(A,t)=>{let g=t.projectId??await A.getProjectId?.();return g?{...t,projectId:g}:t},g3A=(A)=>{return{threadId:A.threadId,message:A.message,wait:A.wait??!0,timeoutSeconds:A.timeoutSeconds??20,...A.automationId!==void 0?{automationId:A.automationId}:{}}},n3A=(A)=>{if(!A||typeof A!=="object")return null;let t=A;if(typeof t.code!=="string"||typeof t.message!=="string"||typeof t.operationId!=="string")return null;return{code:t.code,message:t.message,operationId:t.operationId,missingContext:Array.isArray(t.missingContext)?t.missingContext.filter((g)=>typeof g==="string"):[]}},eEA=(A)=>{if(!A||typeof A!=="object")return null;let t=A;if(typeof t.error!=="string"||typeof t.error_description!=="string")return null;return{error:t.error,errorDescription:t.error_description}},i3A=(A,t)=>{let g=eEA(A);return Error(g?.errorDescription??`Device authorization failed with status ${t}`)},QEA=(A)=>{return A??globalThis.fetch},tEA=(A,t)=>({result:t,poll:()=>A.runs.get({runId:t.runId}),waitForCompletion:async(g={})=>o3A(A,t,g)}),o3A=async(A,t,g)=>{if(t.completed)return t;let i=g.intervalMs??2000,n=Date.now(),o=t;while(!o.completed){if(g.timeoutMs!==void 0&&Date.now()-n>=g.timeoutMs)return o;await e3A(i),o=await A.runs.get({runId:o.runId})}return o},e3A=async(A)=>{await new Promise((t)=>globalThis.setTimeout(t,A))},TB=(A,t)=>{if(typeof A==="string")return A;throw Error(`Expected '${t}' to be a string.`)},DO=(A,t)=>{if(typeof A==="number")return A;throw Error(`Expected '${t}' to be a number.`)};var lO=r(()=>{xQ();gz();fQ();ZCA();yO();yO()});var Zt=(A)=>({success:!0,value:A}),Lt=(A,t,g)=>({success:!1,error:A,...t!==void 0&&{statusCode:t},...g!==void 0&&{errorPayload:g}}),b=(A,t,g)=>{if(!A.success){let i=`${t}: ${A.error}`;if(g)return u(A.errorPayload??i);return D(i)}return A.value};var CA=r(()=>{oA()});var Q3A="https://api.sazabi.com",G=async(A)=>{try{return Zt(await A())}catch(t){let g=I3A(t),i=h3A(t),n=t instanceof Error?t.message:String(t);return Lt(n,i,g)}},I3A=(A)=>{if(!A||typeof A!=="object")return;let t=A;if(typeof t.code!=="string"||typeof t.message!=="string"||!t.data||typeof t.data!=="object")return;let g=t.data;if(typeof g.operationId!=="string")return;return{code:t.code,message:t.message,operationId:g.operationId,missingContext:Array.isArray(g.missingContext)?g.missingContext.filter((i)=>typeof i==="string"):[]}},h3A=(A)=>{if(!A||typeof A!=="object")return;let t=A;return typeof t.status==="number"?t.status:void 0},Ao=(A)=>{let t=iEA({apiBaseUrl:A.baseUrl??Q3A,clientSource:"cli",sandboxActorDescriptor:A.sandboxActorDescriptor,credentialProvider:{getToken:()=>A.token,getOrganizationId:()=>A.organizationId,getProjectId:()=>A.projectId},intakeBaseUrl:A.intakeBaseUrl,tailBaseUrl:A.tailBaseUrl});return{me:()=>G(()=>t.me()),automations:{list:(g={})=>G(()=>t.automations.list(g)),get:(g)=>G(()=>t.automations.get({automationId:g})),create:(g)=>G(()=>t.automations.create(g)),update:(g)=>G(()=>t.automations.update(g)),enable:(g)=>G(()=>t.automations.enable({automationId:g})),disable:(g)=>G(()=>t.automations.disable({automationId:g})),runs:{list:(g,i={})=>G(()=>t.automations.runs.list({automationId:g,...i})),get:(g,i)=>G(()=>t.automations.runs.get({automationId:g,runId:i})),logs:(g,i)=>G(()=>t.automations.runs.logs({automationId:g,runId:i}))}},logs:{tail:(g)=>G(()=>t.logs.tail(g)),forward:(g)=>G(()=>t.logs.forward(g)),query:(g={})=>G(()=>t.logs.query(g)),schema:(g={})=>G(()=>t.logs.schema(g)),volume:(g)=>G(()=>t.logs.volume(g)),patterns:(g={})=>G(()=>t.logs.patterns(g)),nativeQuery:(g)=>G(()=>t.logs.nativeQuery(g))},organizations:{list:()=>G(()=>t.organizations.list()),get:(g)=>G(()=>t.organizations.get({organizationId:g})),rename:(g,i)=>G(()=>t.organizations.update({organizationId:i,name:g}))},members:{list:(g={})=>G(()=>t.members.list(g)),updateRole:(g,i,n)=>G(()=>t.members.updateRole({organizationId:n,member:g,role:i})),remove:(g,i)=>G(()=>t.members.remove({organizationId:i,member:g})),invite:(g)=>G(()=>t.members.invite({organizationId:g.organizationId,email:g.email,role:g.role})),listInvitations:(g)=>G(()=>t.members.listInvitations({organizationId:g})),revokeInvitation:(g)=>G(()=>t.members.revokeInvitation({organizationId:g.organizationId,invitationId:g.invitationId}))},teams:{list:(g={})=>G(()=>t.teams.list(g)),create:(g,i,n)=>G(()=>t.teams.create({organizationId:n,name:g,...i!==void 0?{description:i}:{}})),update:(g,i,n)=>G(()=>t.teams.update({organizationId:n,teamId:g,...i.name!==void 0?{name:i.name}:{},...i.description!==void 0?{description:i.description}:{}})),delete:(g,i)=>G(()=>t.teams.delete({organizationId:i,teamId:g})),addMember:(g,i,n)=>G(()=>t.teams.addMember({organizationId:n,teamId:g,userId:i})),removeMember:(g,i,n)=>G(()=>t.teams.removeMember({organizationId:n,teamId:g,userId:i})),listMembers:(g,i)=>G(()=>t.teams.listMembers({organizationId:i,teamId:g}))},projects:{list:(g={})=>G(()=>t.projects.list(g)),get:(g)=>G(()=>t.projects.get({projectId:g})),create:(g)=>G(()=>t.projects.create(g))},threads:{list:(g={})=>G(()=>t.threads.list(g)),get:(g)=>G(()=>t.threads.get({threadId:g})),create:(g)=>G(()=>t.threads.create(g)),getStatus:(g)=>G(()=>t.threads.getStatus({threadId:g})),update:(g,i)=>G(()=>t.threads.update({threadId:g,status:i})),fork:(g,i)=>G(()=>t.threads.fork({threadId:g,messageId:i})),setVisibility:(g,i)=>G(()=>t.threads.setVisibility({threadId:g,visibility:i})),createShareLink:(g)=>G(()=>t.threads.createShareLink({threadId:g})),listShareLinks:(g)=>G(()=>t.threads.listShareLinks({threadId:g})),revokeShareLink:(g,i)=>G(()=>t.threads.revokeShareLink({threadId:g,shareId:i})),stop:(g)=>G(()=>t.threads.stop({threadId:g})),stream:(g)=>G(()=>t.threads.stream(g))},messages:{list:(g,i={})=>G(()=>t.messages.list({threadId:g,...i})),append:(g,i,n,o,e,I)=>G(()=>t.messages.append({threadId:g,message:i,wait:n,timeoutSeconds:o,...e!==void 0?{automationId:e}:{},...I?{ambientServiceRun:I}:{}}))},runs:{get:(g)=>G(()=>t.runs.get({runId:g})),cancel:(g)=>G(()=>t.runs.cancel({runId:g})),stream:(g)=>G(()=>t.runs.stream(g))},search:{threads:(g)=>G(()=>t.search.threads(g)),messages:(g)=>G(()=>t.search.messages(g))},publicKeys:{list:(g)=>G(()=>t.publicKeys.list(g)),get:(g,i)=>G(()=>t.publicKeys.get(i?{keyId:g,projectId:i}:{keyId:g})),ensureLogForwarding:(g)=>G(()=>t.publicKeys.ensureLogForwarding(g)),update:(g)=>G(()=>t.publicKeys.update(g)),deactivate:(g)=>G(()=>t.publicKeys.deactivate(g))},secretKeys:{list:(g)=>G(()=>t.secretKeys.list(g)),get:(g)=>G(()=>t.secretKeys.get({keyId:g})),create:(g)=>G(()=>t.secretKeys.create(g)),update:(g)=>G(()=>t.secretKeys.update(g)),delete:(g)=>G(()=>t.secretKeys.delete(g))},issues:{count:(g={})=>G(()=>t.issues.count(g)),create:(g)=>G(()=>t.issues.create(g)),list:(g={})=>G(()=>t.issues.list(g)),search:(g={})=>G(()=>t.issues.search(g)),get:(g)=>G(()=>t.issues.get({issueId:g})),resolve:(g)=>G(()=>t.issues.resolve({issueId:g})),ignore:(g)=>G(()=>t.issues.ignore({issueId:g})),reopen:(g)=>G(()=>t.issues.reopen({issueId:g})),mute:(g)=>G(()=>t.issues.mute({issueId:g})),unmute:(g)=>G(()=>t.issues.unmute({issueId:g}))},pullRequests:{list:(g={})=>G(()=>t.pullRequests.list(g))},workItems:{create:(g)=>G(()=>t.workItems.create(g)),comment:(g)=>G(()=>t.workItems.comment(g)),transition:(g)=>G(()=>t.workItems.transition(g))},components:{list:(g={})=>G(()=>t.components.list(g)),get:(g)=>G(()=>t.components.get({componentId:g})),register:(g)=>G(()=>t.components.register(g)),deregister:(g,i)=>G(()=>t.components.deregister({componentId:g,...i!==void 0?{reason:i}:{}})),rename:(g)=>G(()=>t.components.rename(g)),retirementPreview:(g)=>G(()=>t.components.retirementPreview(g)),retire:(g)=>G(()=>t.components.retire(g)),restorationPreview:(g)=>G(()=>t.components.restorationPreview(g)),restore:(g)=>G(()=>t.components.restore(g)),mergePreview:(g)=>G(()=>t.components.mergePreview(g)),merge:(g)=>G(()=>t.components.merge(g)),relationships:{list:(g={})=>G(()=>t.components.relationships.list(g)),preview:(g)=>G(()=>t.components.relationships.preview(g)),add:(g)=>G(()=>t.components.relationships.add(g)),remove:(g)=>G(()=>t.components.relationships.remove(g))},incidents:{list:(g={})=>G(()=>t.components.incidents.list(g))},timeline:(g)=>G(()=>t.components.timeline(g))},billing:{getSummary:(g={})=>G(()=>t.billing.getSummary(g)),getUsage:(g={})=>G(()=>t.billing.getUsage(g)),listTransactions:(g={})=>G(()=>t.billing.listTransactions(g)),retryOutstandingBalance:(g)=>G(()=>t.billing.retryOutstandingBalance(g)),getAutoTopUp:(g={})=>G(()=>t.billing.getAutoTopUp(g)),updateAutoTopUp:(g)=>G(()=>t.billing.updateAutoTopUp(g)),purchaseCredits:(g)=>G(()=>t.billing.purchaseCredits(g)),listPlans:(g={})=>G(()=>t.billing.listPlans(g)),previewPlanChange:(g)=>G(()=>t.billing.previewPlanChange(g)),changePlan:(g)=>G(()=>t.billing.changePlan(g)),createCheckoutSession:(g)=>G(()=>t.billing.createCheckoutSession(g)),getCheckoutSessionStatus:(g)=>G(()=>t.billing.getCheckoutSessionStatus(g)),createPortalSession:(g={})=>G(()=>t.billing.createPortalSession(g)),getPaymentMethod:(g={})=>G(()=>t.billing.getPaymentMethod(g))},tasks:{list:(g={})=>G(()=>t.tasks.list(g))},recommendations:{list:(g={})=>G(()=>t.recommendations.list(g))},notificationDeliveryRules:{list:()=>G(()=>t.notificationDeliveryRules.list()),options:()=>G(()=>t.notificationDeliveryRules.options()),create:(g)=>G(()=>t.notificationDeliveryRules.create(g)),update:(g)=>G(()=>t.notificationDeliveryRules.update(g)),delete:(g)=>G(()=>t.notificationDeliveryRules.delete({ruleId:g}))},notificationChannels:{getProject:()=>G(()=>t.notificationChannels.getProject())},logSources:{listProviders:()=>G(()=>t.logSources.listProviders()),list:(g)=>G(()=>t.logSources.list(g)),get:(g)=>G(()=>t.logSources.get({logSourceId:g})),create:(g)=>G(()=>t.logSources.create(g)),update:(g)=>G(()=>t.logSources.update(g)),delete:(g)=>G(()=>t.logSources.delete({logSourceId:g}))},logStreams:{list:(g)=>G(()=>t.logStreams.list({logSourceId:g})),get:(g)=>G(()=>t.logStreams.get({streamId:g})),create:(g)=>G(()=>t.logStreams.create(g)),update:(g)=>G(()=>t.logStreams.update(g)),delete:(g)=>G(()=>t.logStreams.delete({streamId:g})),reassign:(g)=>G(()=>t.logStreams.reassign(g))},integrations:{listProviders:()=>G(()=>t.integrations.listProviders()),listConnections:(g)=>G(()=>t.integrations.listConnections(g)),getConnection:(g)=>G(()=>t.integrations.getConnection({connectionId:g})),createConnection:(g)=>G(()=>t.integrations.createConnection(g)),beginConnect:(g)=>G(()=>t.integrations.beginConnect(g)),getConnectAttempt:(g)=>G(()=>t.integrations.getConnectAttempt({attemptId:g})),disconnectConnection:(g)=>G(()=>t.integrations.disconnectConnection({connectionId:g})),updateConnectionCredentials:(g)=>G(()=>t.integrations.updateConnectionCredentials(g))},connectedAccounts:{beginConnect:(g)=>G(()=>t.connectedAccounts.beginConnect(g)),getConnectAttempt:(g)=>G(()=>t.connectedAccounts.getConnectAttempt({attemptId:g})),list:()=>G(()=>t.connectedAccounts.list({})),disconnect:(g)=>G(()=>t.connectedAccounts.disconnect(g))},mcpConnectors:{list:(g)=>G(()=>t.mcpConnectors.list(g)),get:(g)=>G(()=>t.mcpConnectors.get(g)),details:(g)=>G(()=>t.mcpConnectors.details(g)),listProviders:()=>G(()=>t.mcpConnectors.listProviders()),beginOAuthInstall:(g)=>G(()=>t.mcpConnectors.beginOAuthInstall(g)),getOAuthInstallAttempt:(g)=>G(()=>t.mcpConnectors.getOAuthInstallAttempt(g)),disconnect:(g)=>G(()=>t.mcpConnectors.disconnect(g)),update:(g)=>G(()=>t.mcpConnectors.update(g))},sandboxPresets:{delete:(g)=>G(()=>t.sandboxPresets.delete(g)),listConnections:(g)=>G(()=>t.sandboxPresets.listConnections(g)),listTypes:()=>G(()=>t.sandboxPresets.listTypes()),test:(g)=>G(()=>t.sandboxPresets.test(g)),upsert:(g)=>G(()=>t.sandboxPresets.upsert(g))},memory:{list:(g={})=>G(()=>t.memory.list(g)),get:(g)=>G(()=>t.memory.get(g)),search:(g)=>G(()=>t.memory.search(g)),put:(g)=>G(()=>t.memory.put({kind:"note",...g})),delete:(g)=>G(()=>t.memory.delete(g))},logMatchExpressions:{list:(g={})=>G(()=>t.logMatchExpressions.list(g)),get:(g)=>G(()=>t.logMatchExpressions.get({expressionId:g})),create:(g)=>G(()=>t.logMatchExpressions.create(g)),update:(g,i={})=>G(()=>t.logMatchExpressions.update({expressionId:g,...i})),disable:(g)=>G(()=>t.logMatchExpressions.disable({expressionId:g}))},scripts:{list:(g={})=>G(()=>t.scripts.list(g)),get:(g)=>G(()=>t.scripts.get({name:g})),create:(g)=>G(()=>t.scripts.create(g)),update:(g,i={})=>G(()=>t.scripts.update({name:g,...i})),delete:(g)=>G(()=>t.scripts.delete({name:g}))}}};var Ia=r(()=>{lO();CA()});var IEA;var hEA=r(()=>{IEA={version:2,activeProfile:"default",profiles:{default:{}}}});import*as to from"node:fs";import*as BEA from"node:os";import*as SO from"node:path";var rg=(A)=>{if(A===void 0||A===null)return;if(typeof A==="string")return A.length>0?A:void 0;return},NO,JB,B3A=()=>{if(!to.existsSync(NO))to.mkdirSync(NO,{recursive:!0,mode:448})},UO,cEA=(A)=>{UO=A},CEA=(A)=>({token:rg(A.token),activeOrganizationId:rg(A.activeOrganizationId??A.organizationId),organizationName:rg(A.organizationName),activeProjectId:rg(A.activeProjectId??A.defaultProjectId),apiBaseUrl:rg(A.apiBaseUrl),authBaseUrl:rg(A.authBaseUrl),webBaseUrl:rg(A.webBaseUrl),intakeBaseUrl:rg(A.intakeBaseUrl),tailBaseUrl:rg(A.tailBaseUrl),apiDomain:rg(A.apiDomain),webDomain:rg(A.webDomain),intakeDomain:rg(A.intakeDomain),tailDomain:rg(A.tailDomain),forwardPublicKey:rg(A.forwardPublicKey),forwardPublicKeyProjectId:rg(A.forwardPublicKeyProjectId)}),c3A=(A)=>({version:2,activeProfile:"default",profiles:{default:CEA(A)}}),C3A=(A)=>{let t=rg(A.activeProfile)??"default",g=typeof A.profiles==="object"&&A.profiles!==null?A.profiles:{},i={};for(let[n,o]of Object.entries(g)){if(typeof o!=="object"||o===null)continue;i[n]=CEA(o)}if(!i[t])i[t]={};return{version:2,activeProfile:t,profiles:i}},yt=()=>{try{if(!to.existsSync(JB))return Zt(IEA);let A=to.readFileSync(JB,"utf-8"),t=JSON.parse(A),g=typeof t.version==="number"?t.version:void 0;if(g!==void 0&&g>2)return Lt("Settings file requires a newer CLI version. Upgrade with 'npm install -g @sazabi/cli@latest'.");if(g===2)return Zt(C3A(t));let i=c3A(t),n=Xt(i);if(!n.success)return n;return Zt(i)}catch(A){let t=A instanceof Error?A.message:String(A);return Lt(t)}},Xt=(A)=>{try{return B3A(),to.writeFileSync(JB,JSON.stringify(A,null,2),{encoding:"utf-8",mode:384}),Zt(void 0)}catch(t){let g=t instanceof Error?t.message:String(t);return Lt(g)}},Mi=(A,t)=>{if(t)return t;if(UO)return UO;let g=process.env.SAZABI_PROFILE?.trim();if(g)return g;return A.activeProfile??"default"},Qn=(A,t)=>{let g=Mi(A,t),i=A.profiles[g];if(i)return Zt(i);if(g==="default")return Zt({});return Lt(`Profile '${g}' does not exist. Run 'sazabi profiles create ${g}' first.`)},go=()=>{let A=yt();if(!A.success)return A;return Qn(A.value)},In=(A,t,g)=>{let i=Mi(A,g);if(!A.profiles[i])return Lt(`Profile '${i}' does not exist. Run 'sazabi profiles create ${i}' first.`);return Zt({...A,profiles:{...A.profiles,[i]:{...A.profiles[i],...t}}})},no=(A)=>{if(!A?.forwardPublicKey&&!A?.forwardPublicKeyProjectId)return{};return{forwardPublicKey:void 0,forwardPublicKeyProjectId:void 0}};var Gn=r(()=>{hEA();CA();NO=SO.join(BEA.homedir(),".sazabi"),JB=SO.join(NO,"settings.json")});var Yi=(A)=>{let{cliFlag:t,globalUrl:g,globalDomain:i,buildUrlFromDomain:n,defaultUrl:o}=A;if(t)return t;let e=process.env.SAZABI_API_URL?.trim();if(e)return e;if(g)return g;if(i)return n(i);return o},R=(A)=>{let{tokenFlag:t,organizationIdFlag:g,projectIdFlag:i,jsonMode:n}=A,o=t?.trim(),e=process.env.SAZABI_TOKEN?.trim(),I=process.env.SAZABI_ORGANIZATION_ID?.trim(),h=process.env.SAZABI_PROJECT_ID?.trim(),B=b(go(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",n),c=B.token?.trim(),C=(o&&o.length>0?o:void 0)||(e&&e.length>0?e:void 0)||c,E=o&&o.length>0?"flag":e&&e.length>0?"environment":"settings";if(!C||C.length===0){if(n)return u("Not authenticated. Set SAZABI_TOKEN, pass --token, run 'sazabi auth login', or run 'sazabi auth save <token>'.");return D("Not authenticated. Set SAZABI_TOKEN, pass --token, run 'sazabi auth login', or run 'sazabi auth save <token>'.")}let a,y;if(g)a=g,y="flag";else if(I&&I.length>0)a=I,y="environment";else if(B.activeOrganizationId)a=B.activeOrganizationId,y="settings";let w,l;if(i)w=i,l="flag";else if(h&&h.length>0)w=h,l="environment";else if(B.activeProjectId)w=B.activeProjectId,l="settings";return{token:C,type:"token",projectId:w,organizationId:a,tokenSource:E,organizationSource:y,projectSource:l}},FO=(A)=>{let t=b(go(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",A?.jsonMode);return Yi({cliFlag:A?.apiBaseUrlFlag,globalUrl:t.apiBaseUrl,globalDomain:t.apiDomain,buildUrlFromDomain:(g)=>`https://api.${g}`,defaultUrl:"https://api.sazabi.com"})},O=(A)=>{let t=FO({apiBaseUrlFlag:A.apiBaseUrlFlag,jsonMode:A.jsonMode});return Ao({token:A.token,baseUrl:t,organizationId:A.organizationId,projectId:A.projectId,sandboxActorDescriptor:process.env.SAZABI_SANDBOX_ACTOR})},EEA,LO,jb=async(A)=>{let t=b(go(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",A.jsonMode),g=Yi({cliFlag:A.apiBaseUrlFlag,globalUrl:t.apiBaseUrl,globalDomain:t.apiDomain,buildUrlFromDomain:(h)=>`https://api.${h}`,defaultUrl:"https://api.sazabi.com"}),i=`${A.token}@${g}@${A.projectId??""}`,n=EEA.get(i);if(n)return n;let o=LO.get(i);if(o)return o;if(!A.projectId){if(A.jsonMode)return u("Project ID is required. Run 'sazabi projects use <project-id>' or set SAZABI_PROJECT_ID.");return D("Project ID is required. Run 'sazabi projects use <project-id>' or set SAZABI_PROJECT_ID.")}let e=A.projectId,I=(async()=>{let B=await Ao({token:A.token,baseUrl:g,projectId:e}).projects.get(e),C=b(B,"Couldn't fetch project info (run 'sazabi projects list' to verify the project ID)",A.jsonMode).project;return EEA.set(i,C),C})();LO.set(i,I);try{return await I}finally{LO.delete(i)}},Xb=(A)=>{let t=A.trim().toLowerCase(),g=/^[a-z][a-z0-9+.-]*:\/\//.test(t)?t:`https://${t}`,i=t;try{i=new URL(g).hostname.toLowerCase()}catch{i=t.replace(/^[a-z][a-z0-9+.-]*:\/\//,"").replace(/[/?#].*$/,"").replace(/:\d+$/,"")}return`https://app.${i.replace(/^(?:app\.)+/,"")}`},PB=(A)=>{let t=(i)=>i.replace(/\/+$/,"");if(A)return t(A);let g=b(go(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)");if(g.webBaseUrl)return t(g.webBaseUrl);if(g.webDomain)return Xb(g.webDomain);if(g.apiDomain)return Xb(g.apiDomain);return"https://app.sazabi.com"},Hg=(A,t)=>{if(A&&A.length>0)return A;let g="No project selected. Pass --project-id, set SAZABI_PROJECT_ID, or run 'sazabi projects use <project-id>'.";if(t)return u(g);return D(g)},ce=(A,t)=>{return`${PB(t)}/projects/${A}`},jt=(A,t,g,i)=>{let n=`${PB(g)}/projects/${A}/threads/${t}`;return i?`${n}?messageId=${encodeURIComponent(i)}`:n},aEA=(A,t,g,i)=>{return jt(A,t,g,i)},rEA=(A,t,g)=>{return`${ce(A,g)}/issues/${t}`},yEA=(A,t,g)=>{return`${ce(A,g)}/automations/${t}`},wEA=(A,t)=>{return`${ce(A,t)}/status`},DEA=(A,t,g)=>{return`${ce(A,g)}/settings/log-source-providers/${t}`},uEA=(A,t,g)=>{return`${ce(A,g)}/settings/mcp-connectors/${t}`},Kb=(A,t,g)=>{return`${ce(A,g)}/settings/sandbox/catalog/${t}`},bEA=(A,t)=>{return`https://otlp.${t}.intake.${A}`};var bA=r(()=>{oA();Ia();CA();Gn();EEA=new Map,LO=new Map});var wl,GyA=(A)=>{wl.set(A.name,A)},Dl=(A)=>{return wl.get(A)},La=()=>{return Array.from(wl.values())},TyA=(A)=>{return wl.has(A)};var iv=r(()=>{wl=new Map});async function Iv(A){let t=await A.publicKeys.list({limit:20});if(!t.success)return[];return t.value.publicKeys.map((g)=>({value:g.id,description:g.name}))}async function hv(A){let t=await A.secretKeys.list({limit:20});if(!t.success)return[];return t.value.secretKeys.map((g)=>({value:g.id,description:g.name}))}async function Ma(A){let t=await A.logSources.list();if(!t.success)return[];return t.value.logSources.map((g)=>({value:g.id,description:g.name??g.provider}))}async function fyA(A){let t=await A.members.list();if(!t.success)return[];return t.value.members.map((g)=>({value:g.userId,description:g.name??g.email}))}var Nnt=3000,Unt,RyA=async(A,t,g)=>{try{let i=Unt[A]?.[t];if(!i)return[];let n=go();if(!n.success)return[];let o=n.value,e=process.env.SAZABI_TOKEN?.trim()||o.token?.trim();if(!e)return[];let I=Yi({globalUrl:o.apiBaseUrl,globalDomain:o.apiDomain,buildUrlFromDomain:(c)=>`https://api.${c}`,defaultUrl:"https://api.sazabi.com"}),h=Ao({token:e,baseUrl:I,organizationId:o.activeOrganizationId,projectId:o.activeProjectId});return(await Promise.race([i(h),new Promise((c)=>setTimeout(()=>c([]),Nnt))])).filter((c)=>c.value.startsWith(g))}catch{return[]}};var OyA=r(()=>{Ia();bA();Gn();Unt={threads:{get:async(A)=>{let t=await A.threads.list({limit:20});if(!t.success)return[];return t.value.threads.map((g)=>({value:g.id,description:g.title??void 0}))}},projects:{use:async(A)=>{let t=await A.projects.list();if(!t.success)return[];return t.value.projects.map((g)=>({value:g.id,description:g.name}))}},organizations:{use:async(A)=>{let t=await A.organizations.list();if(!t.success)return[];return t.value.organizations.map((g)=>({value:g.id,description:g.name}))},rename:async(A)=>{let t=await A.organizations.list();if(!t.success)return[];return t.value.organizations.map((g)=>({value:g.id,description:g.name}))}},"public-keys":{get:Iv,update:Iv,deactivate:Iv},"secret-keys":{get:hv,update:hv,delete:hv},"log-sources":{get:Ma,enable:Ma,disable:Ma,delete:Ma,remove:Ma},members:{"update-role":fyA,remove:fyA}}});var zyA={};dn(zyA,{parseCompletionContext:()=>Fnt,getCompletions:()=>Mnt});var Snt,Lnt,Fnt=(A)=>{let t=A.length>0?A:[""],g=t.length-1,i=t[g]??"";return{words:t,currentIndex:g,partial:i}},Mnt=async(A)=>{let{words:t,currentIndex:g,partial:i}=A,n=t[g-1];if(n==="--profile")return Gnt(i);let o=$nt(t),e=Math.max(0,o.length-(t.length-g));if(e===0)return Ynt(i);let I=o[0]??"",h=Dl(I);if(!h)return[];if(e===1&&h.subcommands){if(i.startsWith("-"))return vyA(h.options,o);return knt(h,i)}let B=h.subcommands?o[1]:void 0,C=(B?h.subcommands?.[B]:void 0)?.options??h.options;if(i.startsWith("-"))return vyA(C,o);if(n?.startsWith("--")){let E=n.slice(2);if(C?.[E]?.type==="string"){let y=`${I}:${B??""}`,w=Lnt[y]?.[E]??Snt[E];if(w)return w.filter((l)=>l.startsWith(i)).map((l)=>({value:l}));return[]}}return RyA(I,B??"",i)},Ynt=(A)=>{let g=La().filter((n)=>n.name.startsWith(A)).map((n)=>({value:n.name,description:n.description})),i=[{value:"--help",description:"Show help"},{value:"--version",description:"Show version"},{value:"--profile",description:"Use a named profile"}];for(let n of i)if(n.value.startsWith(A))g.push(n);return g},knt=(A,t)=>{if(!A.subcommands)return[];return Object.values(A.subcommands).filter((g)=>g.name.startsWith(t)).map((g)=>({value:g.name,description:g.description}))},vyA=(A,t)=>{let g=t[t.length-1]??"",i=new Set(t.filter((o)=>o.startsWith("--")).map((o)=>o.replace(/=.*/,""))),n=[];if(!i.has("--help")&&"--help".startsWith(g))n.push({value:"--help",description:"Show help"});if(!i.has("--profile")&&"--profile".startsWith(g))n.push({value:"--profile",description:"Use a named profile"});if(!A)return n;for(let[o,e]of Object.entries(A)){let I=`--${o}`;if(i.has(I))continue;if(!I.startsWith(g))continue;n.push({value:I,description:e.description})}return n},$nt=(A)=>{let t=[];for(let g=0;g<A.length;g++){let i=A[g];if(i==="--profile"&&g+1<A.length)g++;else if(i.startsWith("--profile="));else t.push(i)}return t},Gnt=(A)=>{try{let t=yt();if(!t.success)return[];return Object.keys(t.value.profiles).filter((g)=>g.startsWith(A)).map((g)=>({value:g,description:g===t.value.activeProfile?"active":void 0}))}catch{return[]}};var myA=r(()=>{iv();Gn();OyA();Snt={status:["regular","archived"],format:["json","text"]},Lnt={"members:update-role":{role:["admin","member"]},"messages:search":{role:["user","assistant"]},"messages:list":{role:["user","assistant"]}}});oA();oA();oA();import{parseArgs as awA}from"node:util";var L=(A,t,g={})=>{let i=awA({args:A,options:t,allowPositionals:Boolean(g.allowPositionals),strict:!1,tokens:!0}),n=Object.hasOwn(t,"json")&&i.values.json===!0,o=new Set(Object.keys(t)),e=new Set(Object.entries(t).map(([,h])=>h.short).filter((h)=>Boolean(h))),I=[];if(Array.isArray(i.tokens))for(let h of i.tokens){if(h.kind!=="option")continue;let B=h.name,c=B.length>1;if(!(o.has(B)||!c&&e.has(B))){let E=c?`--${B}`:`-${B}`;if(!I.includes(E))I.push(E)}}for(let h of Object.keys(i.values))if(!o.has(h)){let B=h.length>1?`--${h}`:`-${h}`;if(!I.includes(B))I.push(B)}if(I.length>0){let h=`Unknown option${I.length>1?"s":""}: ${I.join(", ")}. Run the command with -h for usage.`;if(n)u(h);D(h)}for(let[h,B]of Object.entries(t))if(B.type==="string"&&i.values[h]===!0){let c=h.length===1?`-${h}`:`--${h}`,C=`Option ${c} requires a value. Use '${c} <value>'.`;if(n)u(C);D(C)}for(let[h,B]of Object.entries(t)){let c=i.values[h];if(B.type==="string"&&typeof c==="string"){if(c.startsWith("--")||c.length===2&&c[0]==="-"&&/[a-zA-Z]/.test(c.charAt(1))){let a=`Option ${h.length===1?`-${h}`:`--${h}`} received "${c}" as its value. Did you forget to provide a value?`;if(n)u(a);D(a)}}}return{values:i.values,positionals:i.positionals}};var Pa=(A,t)=>{if(A?.json?.type!=="boolean")throw Error(`${t} must include a boolean --json option (enforced by CommandBuilder)`)};class Uv{name;description;handler;subcommands;options;examples;positionalArgs;allowNoJson=!1;constructor(A,t,g){this.name=A,this.description=t,this.handler=g}withOptions(A){return this.options=A,this}withSubcommands(A){return this.subcommands=A,this}withExamples(A){return this.examples=A,this}withPositionalArgs(A){return this.positionalArgs=A,this}build(){if(!this.handler&&!this.subcommands)throw Error(`Subcommand "${this.name}" must have either a handler or subcommands`);if(!this.allowNoJson&&this.handler)Pa(this.options,`Subcommand "${this.name}"`);if(!this.allowNoJson&&this.subcommands){for(let[A,t]of Object.entries(this.subcommands))if(!t.subcommands)Pa(t.options,`Subcommand "${this.name} ${A}"`)}return{name:this.name,description:this.description,handler:this.handler,subcommands:this.subcommands,options:this.options,examples:this.examples,positionalArgs:this.positionalArgs}}allowWithoutJson(){return this.allowNoJson=!0,this}}class Sv{name;description;handler;subcommands;options;examples;positionalArgs;allowNoJson=!1;constructor(A,t){this.name=A,this.description=t}withHandler(A){return this.handler=A,this}withSubcommands(A){return this.subcommands=A,this}withOptions(A){return this.options=A,this}withExamples(A){return this.examples=A,this}withPositionalArgs(A){return this.positionalArgs=A,this}build(){if(!this.handler&&!this.subcommands)throw Error(`Command "${this.name}" must have either a handler or subcommands`);if(!this.allowNoJson){if(this.handler)Pa(this.options,`Command "${this.name}"`);if(this.subcommands)for(let[A,t]of Object.entries(this.subcommands)){if(t.subcommands)continue;Pa(t.options,`Subcommand "${this.name} ${A}"`)}}return{name:this.name,description:this.description,handler:this.handler,subcommands:this.subcommands,options:this.options,examples:this.examples,positionalArgs:this.positionalArgs}}allowWithoutJson(){return this.allowNoJson=!0,this}}var nA=(A,t)=>{return new Sv(A,t)},U=(A,t,g)=>{return new Uv(A,t,g)};oA();var Qg=(A,t,g,i,n)=>{let o=Number.parseInt(A,10);if(Number.isNaN(o)||o<t||o>g){let e=`${i} must be between ${t} and ${g}.`;if(n)return u(e);return D(e)}return o},Kg=(A,t,g,i)=>{if(!t.includes(A)){let n=t.map((e)=>`"${e}"`).join(" or "),o=`${g} must be ${n}.`;if(i)return u(o);return D(o)}return A};oA();bA();CA();var YO=(A)=>{let t=[];for(let g of A){let i=0;for(let n of g.content){if(n.type!=="artifact")continue;t.push({id:`${g.id}:${i}`,messageId:g.id,name:n.name,toolCallId:n.toolCallId??null,createdAt:g.createdAt,data:n.data}),i+=1}}return t},NEA=(A)=>{let t=A.lastIndexOf(":");if(t<=0||t===A.length-1)return null;let g=A.slice(0,t),i=A.slice(t+1);if(!/^\d+$/.test(i))return null;return{messageId:g,index:Number.parseInt(i,10)}},UEA=(A,t)=>{return YO(A).find((g)=>g.id===t)},MO=(A)=>typeof A==="object"&&A!==null&&!Array.isArray(A),lEA=(A)=>{let t=A===null||A===void 0?"":typeof A==="object"?JSON.stringify(A):String(A);if(/[",\n\r]/.test(t))return`"${t.replace(/"/g,'""')}"`;return t},E3A=(A)=>{if(Array.isArray(A)&&A.every(MO))return A;if(MO(A))for(let t of["rows","data","items","points"]){let g=A[t];if(Array.isArray(g)&&g.every(MO))return g}return null},SEA=(A)=>{let t=E3A(A);if(!t||t.length===0)return null;let g=[];for(let n of t)for(let o of Object.keys(n))if(!g.includes(o))g.push(o);if(g.length===0)return null;let i=[g.map(lEA).join(",")];for(let n of t)i.push(g.map((o)=>lEA(n[o])).join(","));return i.join(`
8710
8710
  `)};var a3A=100,LEA=100,r3A=async(A,t,g)=>{let i=[],n;for(let o=0;o<LEA;o++){let e=await A.messages.list(t,{limit:a3A,...n?{cursor:n}:{}}),I=b(e,"Couldn't get artifact (check the thread ID and try again)",g);if(i.push(...I.messages),!I.nextCursor)break;n=I.nextCursor}if(n&&!g)console.error(`Warning: reached the ${LEA}-page limit; the artifact may exist beyond the scanned messages.`);return i},y3A=(A,t,g)=>{if(t)return t;let i=`--thread-id is required to locate artifact '${A}'. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>`;if(g)u(i);else D(i);return},w3A=(A,t)=>{if(t.json){V({id:A.id,messageId:A.messageId,name:A.name,toolCallId:A.toolCallId,createdAt:A.createdAt,data:A.data});return}if(t.format==="csv"){let g=SEA(A.data);if(g===null){D(`Artifact '${A.id}' (${A.name}) has no embedded rows to render as CSV. Built-in table/timeseries artifacts persist query parameters rather than result rows, so only artifacts that embed their data (such as custom artifacts) can be exported as CSV. Use --json or the default output to inspect this artifact.`);return}console.log(g);return}console.log(JSON.stringify(A.data,null,2))},FEA=async(A,t)=>{if(!NEA(A)){let h=`Invalid artifact ID: '${A}'. Expected format '<message-id>:<index>' (from 'sazabi artifacts list').`;if(t.json)return u(h);return D(h)}let i=y3A(A,t.threadId,t.json);if(!i)return;let n=R({tokenFlag:t.token,jsonMode:t.json}),o=O({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),e=await r3A(o,i,t.json),I=UEA(e,A);if(!I){let h=`Artifact '${A}' not found in thread '${i}'. Run 'sazabi artifacts list --thread-id ${i}' to see available artifacts.`;if(t.json)return u(h);return D(h)}w3A(I,t)};oA();bA();CA();var D3A={id:{label:"ID",type:{kind:"string"}},name:{label:"Type",type:{kind:"string"}},toolCallId:{label:"Tool call",type:{kind:"nullable-string",emptyLabel:"(none)"}},createdAt:{label:"Created",type:{kind:"date"}}},u3A={schema:D3A,columns:["id","name","toolCallId","createdAt"],header:"Artifacts",emptyMessage:"No artifacts found in this thread."},b3A=100,MEA=100,l3A=async(A,t,g)=>{let i=[],n;for(let o=0;o<MEA;o++){let e=await A.messages.list(t,{limit:b3A,...n?{cursor:n}:{}}),I=b(e,"Couldn't list artifacts (check the thread ID and try again)",g);if(i.push(...I.messages),!I.nextCursor)break;n=I.nextCursor}if(n&&!g)console.error(`Warning: reached the ${MEA}-page limit; artifact list may be incomplete for this thread.`);return i},YEA=async(A)=>{let t=R({tokenFlag:A.token,jsonMode:A.json}),g=O({token:t.token,projectId:t.projectId,apiBaseUrlFlag:A.apiBaseUrl}),i=await l3A(g,A.threadId,A.json),o=YO(i).map((e)=>({id:e.id,name:e.name,toolCallId:e.toolCallId,createdAt:e.createdAt}));x(u3A,o,{json:A.json})};var kEA=nA("artifacts","Retrieve artifacts produced in a thread").withSubcommands({list:U("list","List artifacts produced in a thread",async(A)=>{let{values:t}=L(A,{token:{type:"string"},"thread-id":{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}}),g=t["thread-id"];if(!g){if(t.json)return u("--thread-id is required. Usage: sazabi artifacts list --thread-id <thread-id>");return D("--thread-id is required. Usage: sazabi artifacts list --thread-id <thread-id>")}await YEA({threadId:g,token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override authentication token"},"thread-id":{type:"string",description:"Thread to list artifacts for (required)"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi artifacts list --thread-id <thread-id> # List artifacts in a thread","sazabi artifacts list --thread-id <thread-id> --json # Output as JSON"]).build(),get:U("get","Get a single artifact's data",async(A)=>{let{values:t,positionals:g}=L(A,{token:{type:"string"},"thread-id":{type:"string"},format:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=g[0];if(!i){if(t.json)return u("Artifact ID is required. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>");return D("Artifact ID is required. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>")}if(g.length>1){let o=g.slice(1).join(", ");if(t.json)return u(`Unexpected arguments: ${o}.`);return D(`Unexpected arguments: ${o}.`)}let n;if(t.format)n=Kg(t.format,["json","csv"],"Format",t.json);await FEA(i,{token:t.token,threadId:t["thread-id"],format:n,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<artifact-id>").withOptions({token:{type:"string",description:"Override authentication token"},"thread-id":{type:"string",description:"Thread the artifact belongs to (required)"},format:{type:"string",description:"Output format for non-JSON mode: json (default) or csv"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi artifacts get <artifact-id> --thread-id <thread-id> # Print artifact data","sazabi artifacts get <artifact-id> --thread-id <thread-id> --format csv # Render table/timeseries as CSV","sazabi artifacts get <artifact-id> --thread-id <thread-id> --json # Output as JSON"]).build()}).withExamples(["sazabi artifacts list --thread-id <thread-id> # List artifacts in a thread","sazabi artifacts get <artifact-id> --thread-id <thread-id> # Get one artifact's data"]).build();oA();lO();import{spawn as N3A}from"node:child_process";var v={token:{type:"string"},"api-base-url":{type:"string"},json:{type:"boolean"}},f={token:{type:"string",description:"Override token"},"api-base-url":{type:"string",description:"Override API base URL"},json:{type:"boolean",description:"Output as JSON"}};bA();CA();Gn();var $EA="sazabi:organization:",GEA="sazabi:project:",TEA=(A)=>{let t=null,g=null;for(let i of(A??"").split(/\s+/).filter(Boolean))try{if(i.startsWith($EA))t=decodeURIComponent(i.slice($EA.length));else if(i.startsWith(GEA))g=decodeURIComponent(i.slice(GEA.length))}catch{return null}return t?{organizationId:t,projectId:g}:null},fB=(A)=>{if(A==="flag")return"from flag";if(A==="environment")return"from environment";return"from settings"},U3A=async(A={})=>{let t=R({jsonMode:A.json}),g=O({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:A.apiBaseUrl,jsonMode:A.json}),i=b(await g.me(),"Couldn't fetch authentication details (run 'sazabi auth login' to sign in again)",A.json);if(A.json){V({credential:i,activeOrganizationId:t.organizationId,activeProjectId:t.projectId,tokenSource:t.tokenSource,organizationSource:t.organizationSource,projectSource:t.projectSource});return}if(LA("Authentication"),i.credentialType==="user"){fA({Type:`User token (${fB(t.tokenSource)})`,User:i.user.name??i.user.email,Email:i.user.email,"Active organization":t.organizationId&&t.organizationSource?`${t.organizationId} (${fB(t.organizationSource)})`:eg("(none)"),"Active project":t.projectId&&t.projectSource?`${t.projectId} (${fB(t.projectSource)})`:eg("(none)"),Organizations:i.organizations.length.toString(),"Dashboard URL":PB()});return}if(i.credentialType==="secret"){fA({Type:`Secret key (${fB(t.tokenSource)})`,Organization:i.organization.name,"Key name":i.keyName,"Active project":t.projectId&&t.projectSource?`${t.projectId} (${fB(t.projectSource)})`:eg("(none)"),"Dashboard URL":PB()});return}fA({Type:`Partner key (${fB(t.tokenSource)})`,Superorganization:i.superorganization.name,"Dashboard URL":PB()})},S3A=async(A,t={})=>{let g=A.trim();if(!g){if(t.json)return u("Token is required.");return D("Token is required.")}let i=b(yt(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json);await kO({token:g,options:t,cliSettings:i,status:"saved"})},JEA=(A)=>{let t=process.platform,g,i;if(t==="darwin")g="open",i=[A];else if(t==="win32")g="cmd",i=["/c","start","",A];else g="xdg-open",i=[A];let n=N3A(g,i,{detached:!0,stdio:"ignore"});n.on("error",()=>{}),n.unref()},PEA=(A)=>new Promise((t)=>setTimeout(t,A)),L3A=async(A={})=>{let t=b(yt(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",A.json),g=Mi(t),i=t.profiles[g]??{},n=$O(i,A.apiBaseUrl),o=fEA(n,A.authBaseUrl??i.authBaseUrl),e;try{e=await uO({apiBaseUrl:o})}catch(E){let a=E instanceof Error?E.message:String(E);if(A.json)return u(`Failed to initiate sign-up: ${a}`);return D(`Failed to initiate sign-up: ${a}`)}let I=OEA({profile:i,publicApiBaseUrl:n,authBaseUrl:o,apiBaseUrlOverride:A.apiBaseUrl,authBaseUrlOverride:A.authBaseUrl,webBaseUrlOverride:A.webBaseUrl,verificationUriComplete:e.verificationUriComplete}),h=`/login/cli?user_code=${encodeURIComponent(e.userCode)}`,B=`${I}/sign-up?returnTo=${encodeURIComponent(h)}`,c=new Date(Date.now()+e.expiresIn*1000),C=e.interval*1000;if(!A.json)yA(),LA("Create a Sazabi account"),yA(),yg(`Opening ${vA.info(B)}`),yA(),JEA(B),iA("Waiting for sign-up to complete...");while(new Date<c){await PEA(C);try{let E=await bO({apiBaseUrl:o,deviceCode:e.deviceCode});if(E.status==="pending"){C=(E.interval??e.interval)*1000;continue}if(E.status==="denied"){if(A.json)return u("Sign-up was denied.");return yA(),D("Sign-up was denied.")}if(E.status==="expired"){if(A.json)return u("Sign-up request expired. Try again.");return yA(),D("Sign-up request expired. Try again.")}await kO({token:E.accessToken,options:A,cliSettings:t,status:"authorized",approvedContext:TEA(E.scope)});return}catch(E){let a=E instanceof Error?E.message:String(E);if(A.json)return u(`Sign-up failed: ${a}`);return yA(),D(`Sign-up failed: ${a}`)}}if(A.json)return u("Sign-up request expired. Try again.");return yA(),D("Sign-up request expired. Try again.")},F3A=async(A={})=>{let t=b(yt(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",A.json),g=Mi(t),i=t.profiles[g]??{},n=$O(i,A.apiBaseUrl),o=fEA(n,A.authBaseUrl??i.authBaseUrl),e;try{e=await uO({apiBaseUrl:o})}catch(C){let E=C instanceof Error?C.message:String(C);if(A.json)return u(`Failed to initiate login: ${E}`);return D(`Failed to initiate login: ${E}`)}let I=OEA({profile:i,publicApiBaseUrl:n,authBaseUrl:o,apiBaseUrlOverride:A.apiBaseUrl,authBaseUrlOverride:A.authBaseUrl,webBaseUrlOverride:A.webBaseUrl,verificationUriComplete:e.verificationUriComplete}),h=P3A(e.verificationUriComplete,I),B=new Date(Date.now()+e.expiresIn*1000),c=e.interval*1000;if(!A.json)yA(),LA("Sign in to Sazabi"),yA(),yg("Enter this code in your browser:"),yA(),yg(vA.bold(e.userCode),4),yA(),yg(`Opening ${vA.info(h)}`),yA(),JEA(h),iA("Waiting for authorization...");while(new Date<B){await PEA(c);try{let C=await bO({apiBaseUrl:o,deviceCode:e.deviceCode});if(C.status==="pending"){c=(C.interval??e.interval)*1000;continue}if(C.status==="denied"){if(A.json)return u("Authorization was denied.");return yA(),D("Authorization was denied.")}if(C.status==="expired"){if(A.json)return u("Authorization request expired. Try again.");return yA(),D("Authorization request expired. Try again.")}await kO({token:C.accessToken,options:A,cliSettings:t,status:"authorized",approvedContext:TEA(C.scope)});return}catch(C){let E=C instanceof Error?C.message:String(C);if(A.json)return u(`Authorization failed: ${E}`);return yA(),D(`Authorization failed: ${E}`)}}if(A.json)return u("Authorization request expired. Try again.");return yA(),D("Authorization request expired. Try again.")},M3A=(A)=>{let t=b(yt(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",A.json),g=b(Qn(t),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",A.json),i=Boolean(g.token),n=b(In(t,{token:void 0,activeOrganizationId:void 0,organizationName:void 0,activeProjectId:void 0,...no(g)}),"Failed to update profile",A.json);if(b(Xt(n),"Failed to remove credentials",A.json),A.json){V({removed:i});return}if(i){j("Signed out.");return}iA("No credentials were saved.")},kO=async({token:A,options:t,cliSettings:g,status:i,approvedContext:n})=>{let o=Mi(g),e=g.profiles[o]??{},I=$O(e,t.apiBaseUrl),h=O({token:A,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),B=b(await h.me(),`Couldn't resolve authenticated context at ${I} (pass --api-base-url to target a different environment)`,t.json);if(i==="authorized"&&B.credentialType!=="user"){if(t.json)return u("Expected a user session from device authorization.");return D("Expected a user session from device authorization.")}if(n&&B.credentialType==="user"&&B.activeOrganizationId!==n.organizationId){if(t.json)return u("The issued session did not match the organization approved in the browser.");return D("The issued session did not match the organization approved in the browser.")}let c=g.profiles[o]?g:{...g,profiles:{...g.profiles,[o]:{}}},C=c.profiles[o],E=await Y3A({client:h,credential:B,currentProjectId:C.activeProjectId,approvedProjectId:n?n.projectId:void 0,jsonMode:t.json}),a=C.token!==A||C.activeOrganizationId!==E.activeOrganizationId||C.activeProjectId!==E.activeProjectId,y=b(In(c,{token:A,activeOrganizationId:E.activeOrganizationId,organizationName:E.activeOrganizationName,activeProjectId:E.activeProjectId,apiBaseUrl:t.apiBaseUrl??C.apiBaseUrl,authBaseUrl:t.authBaseUrl??C.authBaseUrl,webBaseUrl:t.webBaseUrl??C.webBaseUrl,...a&&no(C)}),"Failed to update profile",t.json);if(b(Xt(y),"Failed to save credentials",t.json),t.json){V({status:i,credential:B,activeOrganizationId:E.activeOrganizationId,activeProjectId:E.activeProjectId,projects:E.projects});return}if(yA(),j(i==="authorized"?"Signed in.":"Token saved."),yA(),$3A({credential:B,activeOrganizationName:E.activeOrganizationName,activeProjectId:E.activeProjectId,projects:E.projects}),E.projects.length>0){yA(),LA("Available projects");for(let w of E.projects){let N=w.id===E.activeProjectId?vA.success(" (active)"):"";yg(`${w.name} (${w.region})${N}`)}}},Y3A=async({client:A,credential:t,currentProjectId:g,approvedProjectId:i,jsonMode:n})=>{if(t.credentialType==="partner")return{projects:[]};let o=t.credentialType==="user"?t.activeOrganizationId??t.organizations[0]?.id:t.organization.id,e=t.credentialType==="user"?t.organizations.find((h)=>h.id===o)?.name:t.organization.name,I=o?b(await A.projects.list({organizationId:o}),"Couldn't fetch projects (check your organization access and try again)",n).projects:[];return{activeOrganizationId:o,activeOrganizationName:e,activeProjectId:k3A(I,g,i),projects:I}},k3A=(A,t,g)=>{if(g===null)return;if(g!==void 0)return A.some((i)=>i.id===g)?g:void 0;if(t&&A.some((i)=>i.id===t))return t;return A[0]?.id},$3A=({credential:A,activeOrganizationName:t,activeProjectId:g,projects:i})=>{if(A.credentialType==="user"){fA({Type:"User token",User:A.user.name??A.user.email,Organizations:A.organizations.length.toString(),"Active organization":t??"(none)","Active project":i.find((n)=>n.id===g)?.name??"(none)"});return}if(A.credentialType==="secret"){fA({Type:"Secret key",Organization:A.organization.name,"Key name":A.keyName,"Active project":i.find((n)=>n.id===g)?.name??"(none)"});return}fA({Type:"Partner key",Superorganization:A.superorganization.name})},$O=(A,t)=>{return Yi({cliFlag:t,globalUrl:A.apiBaseUrl,globalDomain:A.apiDomain,buildUrlFromDomain:(g)=>`https://api.${g}`,defaultUrl:"https://api.sazabi.com"})},fEA=(A,t)=>{if(t)return t;try{let g=new URL(A);if(["localhost","127.0.0.1"].includes(g.hostname)&&["15005","15009"].includes(g.port))return g.port="15001",g.toString().replace(/\/$/,"");if(g.hostname==="api.sazabi.com")return g.hostname="api.platform.sazabi.com",g.toString().replace(/\/$/,"");if(g.hostname==="api.staging.sazabi.dev")return g.hostname="api.platform.staging.sazabi.dev",g.toString().replace(/\/$/,"");return g.toString().replace(/\/$/,"")}catch{return A}},REA=(A)=>A.replace(/\/+$/,""),hn=(A)=>(A?.trim().length??0)>0,G3A=(A)=>{if(!hn(A))return;try{let t=new URL(A);return`${t.protocol}//${t.host}`}catch{return}},RB=(A)=>{if(!hn(A))return;try{let g=new URL(A).hostname.toLowerCase();if(["localhost","127.0.0.1"].includes(g))return"https://localhost:5173";if(["api.staging.sazabi.dev","api.platform.staging.sazabi.dev"].includes(g))return"https://app.staging.sazabi.dev";if(["api.sazabi.com","api.platform.sazabi.com"].includes(g))return"https://app.sazabi.com"}catch{return}return},T3A=(A)=>{if(hn(A.webBaseUrl))return REA(A.webBaseUrl);if(hn(A.webDomain))return Xb(A.webDomain);return},J3A=({profile:A,publicApiBaseUrl:t})=>{if(!(hn(A.authBaseUrl)||hn(A.apiBaseUrl)||hn(A.apiDomain)))return;if(hn(A.authBaseUrl)){let i=RB(A.authBaseUrl);if(i)return i}return RB(t)},OEA=({profile:A,publicApiBaseUrl:t,authBaseUrl:g,apiBaseUrlOverride:i,authBaseUrlOverride:n,webBaseUrlOverride:o,verificationUriComplete:e})=>{if(hn(o))return REA(o);let I=process.env.SAZABI_API_URL?.trim(),h=hn(n)||hn(i)||hn(I),B=G3A(e);if(h){let E=hn(n)?RB(g):RB(t);if(E)return E;if(B)return B}let c=T3A(A);if(c)return c;let C=J3A({profile:A,publicApiBaseUrl:t});if(C)return C;if(B)return B;return"https://app.sazabi.com"},P3A=(A,t)=>{if(!t)return A;try{let g=new URL(A),i=new URL(t);return g.protocol=i.protocol,g.host=i.host,g.toString()}catch{return A}},vEA=nA("auth","Manage authentication credentials").withSubcommands({signup:U("signup","Create a new Sazabi account via browser",async(A)=>{let{values:t,positionals:g}=L(A,{...v,"auth-base-url":{type:"string"},"web-base-url":{type:"string"}},{allowPositionals:!0});if(g.length>0){let i=g.join(", ");if(t.json)return u(`Unexpected arguments: ${i}.`);return D(`Unexpected arguments: ${i}.`)}await L3A({json:t.json,apiBaseUrl:t["api-base-url"],authBaseUrl:t["auth-base-url"],webBaseUrl:t["web-base-url"]})}).withOptions({...f,"auth-base-url":{type:"string",description:"Override auth API base URL"},"web-base-url":{type:"string",description:"Override web app base URL"}}).withExamples(["sazabi auth signup # Create a new account via browser"]).build(),login:U("login","Authenticate via browser",async(A)=>{let{values:t,positionals:g}=L(A,{...v,"auth-base-url":{type:"string"},"web-base-url":{type:"string"}},{allowPositionals:!0});if(g.length>0){let i=g.join(", ");if(t.json)return u(`Unexpected arguments: ${i}.`);return D(`Unexpected arguments: ${i}.`)}await F3A({json:t.json,apiBaseUrl:t["api-base-url"],authBaseUrl:t["auth-base-url"],webBaseUrl:t["web-base-url"]})}).withOptions({...f,"auth-base-url":{type:"string",description:"Override auth API base URL"},"web-base-url":{type:"string",description:"Override web app base URL"}}).withExamples(["sazabi auth login # Authenticate via browser"]).build(),save:U("save","Save an existing bearer token",async(A)=>{let{values:t,positionals:g}=L(A,{...v,"web-base-url":{type:"string"}},{allowPositionals:!0}),i=g[0];if(!i){if(t.json)return u("Token is required.");return D("Token is required.")}if(g.length>1){let n=g.slice(1).join(", ");if(t.json)return u(`Unexpected arguments: ${n}.`);return D(`Unexpected arguments: ${n}.`)}await S3A(i,{json:t.json,apiBaseUrl:t["api-base-url"],webBaseUrl:t["web-base-url"]})}).withPositionalArgs("<token>").withOptions({...f,"web-base-url":{type:"string",description:"Override web app base URL"}}).withExamples(["sazabi auth save sazabi_secret_xxx # Save a secret key for future commands"]).build(),logout:U("logout","Remove saved credentials",async(A)=>{let{values:t,positionals:g}=L(A,v,{allowPositionals:!0});if(g.length>0){let i=g.join(", ");if(t.json)return u(`Unexpected arguments: ${i}.`);return D(`Unexpected arguments: ${i}.`)}M3A({json:t.json})}).withOptions(f).withExamples(["sazabi auth logout # Remove saved credentials"]).build(),whoami:U("whoami","Display current authentication context",async(A)=>{let{values:t,positionals:g}=L(A,v,{allowPositionals:!0});if(g.length>0){let i=g.join(", ");if(t.json)return u(`Unexpected arguments: ${i}.`);return D(`Unexpected arguments: ${i}.`)}await U3A({json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions(f).withExamples(["sazabi auth whoami # Show current context","sazabi auth whoami --json # Output as JSON"]).build()}).withExamples(["sazabi auth signup # Create a new account via browser","sazabi auth login # Authenticate via browser","sazabi auth save sazabi_secret_xxx # Save an existing token","sazabi auth logout # Remove saved credentials","sazabi auth whoami # Show current context"]).build();oA();bA();CA();var ha=(A)=>({id:A.id,name:A.name,status:A.enabled?"active":"paused",source:A.source,kind:A.kind,health:A.health,cronExpression:A.cronExpression,timezone:A.timezone,timeoutSeconds:A.timeoutSeconds,successRate:A.successRate,runCount:A.runCount,failedRunCount:A.failedRunCount,lastRunStatus:A.lastRun?.status??null,lastRunAt:A.lastRun?.startedAt??null,scriptIdentifier:"scriptIdentifier"in A?A.scriptIdentifier:null,scriptId:"scriptId"in A?A.scriptId:null,scriptName:"scriptName"in A?A.scriptName:null,canToggle:"canToggle"in A?A.canToggle:null,createdAt:"createdAt"in A?A.createdAt:null,updatedAt:"updatedAt"in A?A.updatedAt:null}),mEA={id:{label:"ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"nullable-string"}},name:{label:"Name",type:{kind:"string"}},status:{label:"Status",type:{kind:"custom",render:(A)=>A==="active"?"Enabled":"Disabled",serialize:(A)=>A}},source:{label:"Source",type:{kind:"string"}},kind:{label:"Kind",type:{kind:"string"}},health:{label:"Health",type:{kind:"string"}},cronExpression:{label:"Cron",type:{kind:"nullable-string",emptyLabel:"(n/a)"}},timezone:{label:"Timezone",type:{kind:"string"}},timeoutSeconds:{label:"Timeout (s)",type:{kind:"custom",render:(A)=>A==null?"(none)":String(A),serialize:(A)=>A}},successRate:{label:"Success rate",type:{kind:"custom",render:(A)=>A==null?"(n/a)":`${Math.round(Number(A)*100)}%`,serialize:(A)=>A}},runCount:{label:"Runs (7d)",type:{kind:"number"}},failedRunCount:{label:"Failures (7d)",type:{kind:"number"}},lastRunStatus:{label:"Last run status",type:{kind:"nullable-string",emptyLabel:"(never)"}},lastRunAt:{label:"Last run",type:{kind:"nullable-date",emptyLabel:"(never)"}},scriptIdentifier:{label:"Script",type:{kind:"nullable-string"}},scriptId:{label:"Script ID",type:{kind:"nullable-string"}},scriptName:{label:"Script name",type:{kind:"nullable-string"}},canToggle:{label:"Can toggle",type:{kind:"custom",render:(A)=>A==null?"(n/a)":A?"yes":"no",serialize:(A)=>A}},createdAt:{label:"Created at",type:{kind:"nullable-date"}},updatedAt:{label:"Updated at",type:{kind:"nullable-date"}}},f3A={schema:mEA,columns:["name","status","health","cronExpression","lastRunAt"],jsonFields:["id","name","status","source","kind","health","cronExpression","timezone","timeoutSeconds","successRate","runCount","failedRunCount","lastRunStatus","lastRunAt"],header:"Automations",emptyMessage:"No automations found."},_b={layout:"field-list",schema:mEA,fields:["id","url","name","status","source","kind","health","cronExpression","timezone","timeoutSeconds","successRate","runCount","failedRunCount","lastRunStatus","lastRunAt","scriptIdentifier","scriptId","scriptName","canToggle","createdAt","updatedAt"],title:"Automation"},WEA=(A)=>({id:A.id,automationRunKey:A.automationRunKey,status:A.status,scheduledAt:A.scheduledAt,dueAt:A.dueAt,startedAt:A.startedAt,completedAt:A.completedAt,durationMs:A.durationMs,exitCode:A.exitCode,errorMessage:A.errorMessage,automationId:"automationId"in A?A.automationId:null}),ZEA={id:{label:"ID",type:{kind:"id"}},automationId:{label:"Automation",type:{kind:"nullable-string"}},automationRunKey:{label:"Run key",type:{kind:"string"}},status:{label:"Status",type:{kind:"string"}},scheduledAt:{label:"Scheduled at",type:{kind:"nullable-date"}},dueAt:{label:"Due at",type:{kind:"nullable-date"}},startedAt:{label:"Started at",type:{kind:"date"}},completedAt:{label:"Completed at",type:{kind:"nullable-date"}},durationMs:{label:"Duration (ms)",type:{kind:"custom",render:(A)=>A==null?"(n/a)":String(A),serialize:(A)=>A}},exitCode:{label:"Exit code",type:{kind:"custom",render:(A)=>A==null?"(n/a)":String(A),serialize:(A)=>A}},errorMessage:{label:"Error",type:{kind:"nullable-string",emptyLabel:"(none)"}}},R3A={schema:ZEA,columns:["status","startedAt","durationMs","exitCode"],jsonFields:["id","automationRunKey","status","scheduledAt","dueAt","startedAt","completedAt","durationMs","exitCode","errorMessage"],header:"Automation runs",emptyMessage:"No automation runs found."},O3A={layout:"field-list",schema:ZEA,fields:["id","automationId","automationRunKey","status","scheduledAt","dueAt","startedAt","completedAt","durationMs","exitCode","errorMessage"],title:"Automation run"},v3A=(A)=>({status:A.status,exitCode:A.exitCode,truncated:A.truncated,durationMs:A.durationMs,startedAt:A.startedAt,completedAt:A.completedAt,stdout:A.stdout,stderr:A.stderr}),z3A={status:{label:"Status",type:{kind:"string"}},exitCode:{label:"Exit code",type:{kind:"custom",render:(A)=>A==null?"(n/a)":String(A),serialize:(A)=>A}},truncated:{label:"Truncated",type:{kind:"custom",render:(A)=>A?"yes":"no",serialize:(A)=>A}},durationMs:{label:"Duration (ms)",type:{kind:"custom",render:(A)=>A==null?"(n/a)":String(A),serialize:(A)=>A}},startedAt:{label:"Started at",type:{kind:"nullable-date"}},completedAt:{label:"Completed at",type:{kind:"nullable-date"}},stdout:{label:"Stdout",type:{kind:"custom",render:(A)=>A?String(A):"(empty)",serialize:(A)=>A}},stderr:{label:"Stderr",type:{kind:"custom",render:(A)=>A?String(A):"(empty)",serialize:(A)=>A}}},m3A={layout:"field-list",schema:z3A,fields:["status","exitCode","truncated","durationMs","startedAt","completedAt","stdout","stderr"],title:"Automation run logs"},Ce=(A)=>{let t=R({tokenFlag:A.token,projectIdFlag:A.projectId,jsonMode:A.json});return{client:O({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:A.apiBaseUrl,jsonMode:A.json}),projectId:t.projectId}},xb=(A,t)=>t?{...A,url:yEA(t,A.id)}:A,W3A=async(A)=>{let{client:t}=Ce(A),g=b(await t.automations.list({search:A.search,status:A.status,source:A.source,health:A.health,sort:A.sort,limit:A.limit,cursor:A.cursor}),"Couldn't list automations (check the active project and try again)",A.json);x(f3A,g.automations.map(ha),{json:A.json,nextCursor:g.nextCursor})},Z3A=async(A,t)=>{let{client:g,projectId:i}=Ce(t),n=b(await g.automations.get(A),"Couldn't get automation (run 'sazabi automations list' to see automation IDs)",t.json);W(_b,xb(ha(n.automation),i),{json:t.json})},V3A=async(A,t)=>{let g=t.scriptId!==void 0,i=t.script!==void 0,n=t.expressionId!==void 0,o=Number(g)+Number(i)+Number(n),e=(c)=>{if(t.json){u(c);return}D(c)};if(o!==1){e("Provide exactly one of --script-id, --script, or --expression-id.");return}if(n){if(t.cronExpression!==void 0||t.timezone!==void 0||t.timeoutSeconds!==void 0){e("Cron and timeout flags are not used with --expression-id log-match automations.");return}if(!t.description?.trim()){e("--description is required for log-match automations (investigation instructions).");return}}let{client:I,projectId:h}=Ce(t),B=b(await I.automations.create({name:A,...t.description!==void 0?{description:t.description}:{},...t.scriptId!==void 0?{scriptId:t.scriptId}:{},...t.script!==void 0?{script:t.script}:{},...t.expressionId!==void 0?{expressionId:t.expressionId}:{},...t.cronExpression!==void 0?{cronExpression:t.cronExpression}:{},...t.timezone!==void 0?{timezone:t.timezone}:{},...t.timeoutSeconds!==void 0?{timeoutSeconds:t.timeoutSeconds}:{},...t.enabled!==void 0?{enabled:t.enabled}:{}}),n?"Couldn't create log-match automation (check the expression ID and description)":"Couldn't create automation (check the script name/ID and try again)",t.json);if(!t.json)j(`Automation "${B.automation.name}" created.`);W(_b,xb(ha(B.automation),h),{json:t.json})},H3A=async(A,t)=>{if(t.name===void 0&&t.description===void 0&&t.clearDescription!==!0&&t.cronExpression===void 0&&t.timezone===void 0&&t.timeoutSeconds===void 0){if(t.json){u("Nothing to update. Provide --name, --description, --clear-description, --cron-expression, --timezone, or --timeout-seconds.");return}D("Nothing to update. Provide --name, --description, --clear-description, --cron-expression, --timezone, or --timeout-seconds.");return}if(t.description!==void 0&&t.clearDescription===!0){if(t.json){u("Use either --description or --clear-description, not both.");return}D("Use either --description or --clear-description, not both.");return}let{client:g,projectId:i}=Ce(t),n=b(await g.automations.update({automationId:A,...t.name!==void 0?{name:t.name}:{},...t.clearDescription?{description:null}:t.description!==void 0?{description:t.description}:{},...t.cronExpression!==void 0?{cronExpression:t.cronExpression}:{},...t.timezone!==void 0?{timezone:t.timezone}:{},...t.timeoutSeconds!==void 0?{timeoutSeconds:t.timeoutSeconds}:{}}),"Couldn't update automation (run 'sazabi automations list' to see automation IDs)",t.json);if(!t.json)j(`Automation "${n.automation.name}" updated.`);W(_b,xb(ha(n.automation),i),{json:t.json})},VEA=async(A,t,g)=>{let{client:i,projectId:n}=Ce(g),o=b(t?await i.automations.enable(A):await i.automations.disable(A),t?"Failed to enable automation":"Failed to disable automation",g.json),e=xb(ha(o.automation),n);if(!g.json)j(`Automation "${e.name}" is now ${t?"enabled":"disabled"}.`);W(_b,e,{json:g.json})},X3A=async(A,t)=>VEA(A,!0,t),j3A=async(A,t)=>VEA(A,!1,t),K3A=async(A,t)=>{let{client:g}=Ce(t),i=b(await g.automations.runs.list(A,{status:t.status,limit:t.limit,cursor:t.cursor}),"Couldn't list automation runs (run 'sazabi automations list' to see automation IDs)",t.json);x(R3A,i.runs.map(WEA),{json:t.json,nextCursor:i.nextCursor})},_3A=async(A,t,g)=>{let{client:i}=Ce(g),n=b(await i.automations.runs.get(A,t),"Couldn't get automation run (run 'sazabi automations runs list <automation-id>' to see run IDs)",g.json);W(O3A,WEA(n.run),{json:g.json})},x3A=async(A,t,g)=>{let{client:i}=Ce(g),n=b(await i.automations.runs.logs(A,t),"Couldn't get automation run logs (run 'sazabi automations runs list <automation-id>' to see run IDs)",g.json);W(m3A,v3A(n.logs),{json:g.json})},io={...v,"project-id":{type:"string"}},oo={...f,"project-id":{type:"string",description:"Override active project ID"}},s3A=(A,t)=>{let g=A[0];if(!g){if(t){u("Automation name is required.");return}D("Automation name is required.");return}return g},RQ=(A,t)=>{let g=A[0];if(!g){if(t){u("Automation ID is required.");return}D("Automation ID is required.");return}return g},zEA=(A,t)=>{let g=A[1];if(!g){if(t){u("Run ID is required.");return}D("Run ID is required.");return}return g},HEA=nA("automations","Manage scheduled automations").withSubcommands({list:U("list","List automations in the active project",async(A)=>{let{values:t}=L(A,{...io,search:{type:"string"},status:{type:"string"},source:{type:"string"},health:{type:"string"},sort:{type:"string"},limit:{type:"string"},cursor:{type:"string"}}),g=(c)=>{if(t.json){u(c);return}D(c)},i=t.status;if(i!==void 0&&i!=="active"&&i!=="paused")return g(`Invalid --status value "${i}". Expected "active" or "paused".`);let n=t.source;if(n!==void 0&&n!=="sazabi_managed"&&n!=="custom")return g(`Invalid --source value "${n}". Expected "sazabi_managed" or "custom".`);let o=t.health,e=["healthy","failing","never_run"];if(o!==void 0&&!e.includes(o))return g(`Invalid --health value "${o}". Expected one of: ${e.join(", ")}.`);let I=t.sort,h=["name","last_run","failures","runs"];if(I!==void 0&&!h.includes(I))return g(`Invalid --sort value "${I}". Expected one of: ${h.join(", ")}.`);let B;if(t.limit!==void 0){if(B=Number(t.limit),!Number.isInteger(B)||B<1||B>100)return g(`Invalid --limit value "${t.limit}". Expected an integer between 1 and 100.`)}await W3A({token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],search:t.search,status:i,source:n,health:o,sort:I,limit:B,cursor:t.cursor})}).withOptions({...oo,search:{type:"string",description:"Filter by automation name (case-insensitive)"},status:{type:"string",description:"Filter by status: active or paused"},source:{type:"string",description:"Filter by source: sazabi_managed or custom"},health:{type:"string",description:"Filter by health: healthy, failing, or never_run"},sort:{type:"string",description:"Sort by: name, last_run, failures, or runs"},limit:{type:"string",description:"Maximum number of automations to return (default: 50, max: 100)"},cursor:{type:"string",description:"Pagination cursor from previous response"}}).withExamples(["sazabi automations list # List all automations","sazabi automations list --status paused # List paused automations"]).build(),get:U("get","Get one automation by ID",async(A)=>{let{values:t,positionals:g}=L(A,io,{allowPositionals:!0}),i=RQ(g,t.json);if(!i)return;await Z3A(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id>").withOptions(oo).withExamples(["sazabi automations get <automation-id> # Get one automation"]).build(),create:U("create","Create an automation",async(A)=>{let{values:t,positionals:g}=L(A,{...io,description:{type:"string"},"script-id":{type:"string"},script:{type:"string"},"expression-id":{type:"string"},"cron-expression":{type:"string"},timezone:{type:"string"},"timeout-seconds":{type:"string"},enabled:{type:"boolean"}},{allowPositionals:!0}),i=s3A(g,t.json);if(!i)return;let n=(e)=>{if(t.json){u(e);return}D(e)},o;if(t["timeout-seconds"]!==void 0){if(o=Number(t["timeout-seconds"]),!Number.isInteger(o)||o<1||o>3600)return n(`Invalid --timeout-seconds value "${t["timeout-seconds"]}". Expected an integer between 1 and 3600.`)}await V3A(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],description:t.description,scriptId:t["script-id"],script:t.script,expressionId:t["expression-id"],cronExpression:t["cron-expression"],timezone:t.timezone,timeoutSeconds:o,enabled:t.enabled})}).withPositionalArgs("<name>").withOptions({...oo,description:{type:"string",description:"Human-readable description (required for log-match automations)"},"script-id":{type:"string",description:"Project script ID to run (cron automations)"},script:{type:"string",description:"Project script name to run (cron automations)"},"expression-id":{type:"string",description:"Log-match expression ID to bind (creates a log-match investigation automation)"},"cron-expression":{type:"string",description:"Cron schedule expression"},timezone:{type:"string",description:"IANA timezone for the schedule"},"timeout-seconds":{type:"string",description:"Run timeout in seconds (1-3600)"},enabled:{type:"boolean",description:"Create the automation enabled"}}).withExamples(["sazabi automations create deploy-nightly --script health --cron-expression '0 3 * * *' # Create from a DB-backed script by name","sazabi automations create deploy-nightly --script-id <script-id> # Create by script ID",'sazabi automations create "Investigate Plain tickets" --expression-id <uuid> --description "When a new Plain ticket is created, investigate …" # Create a log-match investigation automation']).build(),update:U("update","Update an automation",async(A)=>{let{values:t,positionals:g}=L(A,{...io,name:{type:"string"},description:{type:"string"},"clear-description":{type:"boolean"},"cron-expression":{type:"string"},timezone:{type:"string"},"timeout-seconds":{type:"string"}},{allowPositionals:!0}),i=RQ(g,t.json);if(!i)return;let n=(e)=>{if(t.json){u(e);return}D(e)},o;if(t["timeout-seconds"]!==void 0){if(o=Number(t["timeout-seconds"]),!Number.isInteger(o)||o<1||o>3600)return n(`Invalid --timeout-seconds value "${t["timeout-seconds"]}". Expected an integer between 1 and 3600.`)}await H3A(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],name:t.name,description:t.description,clearDescription:t["clear-description"],cronExpression:t["cron-expression"],timezone:t.timezone,timeoutSeconds:o})}).withPositionalArgs("<automation-id>").withOptions({...oo,name:{type:"string",description:"New automation name"},description:{type:"string",description:"New human-readable description"},"clear-description":{type:"boolean",description:"Clear the automation description"},"cron-expression":{type:"string",description:"New cron schedule expression"},timezone:{type:"string",description:"New IANA timezone for the schedule"},"timeout-seconds":{type:"string",description:"New run timeout in seconds (1-3600)"}}).withExamples(["sazabi automations update <automation-id> --cron-expression '0 4 * * *' # Change the schedule"]).build(),enable:U("enable","Enable an automation",async(A)=>{let{values:t,positionals:g}=L(A,io,{allowPositionals:!0}),i=RQ(g,t.json);if(!i)return;await X3A(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id>").withOptions(oo).withExamples(["sazabi automations enable <automation-id> # Enable an automation"]).build(),disable:U("disable","Disable an automation",async(A)=>{let{values:t,positionals:g}=L(A,io,{allowPositionals:!0}),i=RQ(g,t.json);if(!i)return;await j3A(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id>").withOptions(oo).withExamples(["sazabi automations disable <automation-id> # Disable an automation"]).build(),runs:U("runs","Inspect automation runs").withSubcommands({list:U("list","List runs for an automation",async(A)=>{let{values:t,positionals:g}=L(A,{...io,status:{type:"string"},limit:{type:"string"},cursor:{type:"string"}},{allowPositionals:!0}),i=RQ(g,t.json);if(!i)return;let n=(h)=>{if(t.json){u(h);return}D(h)},o=t.status,e=["running","succeeded","failed","timed_out","cancelled"];if(o!==void 0&&!e.includes(o))return n(`Invalid --status value "${o}". Expected one of: ${e.join(", ")}.`);let I;if(t.limit!==void 0){if(I=Number(t.limit),!Number.isInteger(I)||I<1||I>100)return n(`Invalid --limit value "${t.limit}". Expected an integer between 1 and 100.`)}await K3A(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],status:o,limit:I,cursor:t.cursor})}).withPositionalArgs("<automation-id>").withOptions({...oo,status:{type:"string",description:"Filter by run status: running, succeeded, failed, timed_out, or cancelled"},limit:{type:"string",description:"Maximum number of runs to return (default: 50, max: 100)"},cursor:{type:"string",description:"Pagination cursor from previous response"}}).withExamples(["sazabi automations runs list <automation-id> # List runs for an automation","sazabi automations runs list <automation-id> --status failed # List failed runs"]).build(),get:U("get","Get one automation run by ID",async(A)=>{let{values:t,positionals:g}=L(A,io,{allowPositionals:!0}),i=RQ(g,t.json);if(!i)return;let n=zEA(g,t.json);if(!n)return;await _3A(i,n,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id> <run-id>").withOptions(oo).withExamples(["sazabi automations runs get <automation-id> <run-id> # Get one automation run"]).build(),logs:U("logs","Get the captured logs for an automation run",async(A)=>{let{values:t,positionals:g}=L(A,io,{allowPositionals:!0}),i=RQ(g,t.json);if(!i)return;let n=zEA(g,t.json);if(!n)return;await x3A(i,n,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id> <run-id>").withOptions(oo).withExamples(["sazabi automations runs logs <automation-id> <run-id> # Get captured logs for a run"]).build()}).withExamples(["sazabi automations runs list <automation-id> # List runs for an automation","sazabi automations runs get <automation-id> <run-id> # Get one run","sazabi automations runs logs <automation-id> <run-id> # Get captured logs for a run"]).build()}).withExamples(["sazabi automations list # List all automations","sazabi automations get <automation-id> # Get one automation","sazabi automations create deploy-nightly --script health --cron-expression '0 3 * * *' # Create from a DB-backed script by name","sazabi automations update <automation-id> --cron-expression '0 4 * * *' # Change the schedule","sazabi automations enable <automation-id> # Enable an automation","sazabi automations disable <automation-id> # Disable an automation","sazabi automations runs list <automation-id> # List runs for an automation","sazabi automations runs get <automation-id> <run-id> # Get one run","sazabi automations runs logs <automation-id> <run-id> # Get captured logs for a run"]).build();oA();bA();import{spawn as q3A}from"node:child_process";var eo=(A)=>{let t=process.platform,g,i;if(t==="darwin")g="open",i=[A];else if(t==="win32")g="cmd",i=["/c","start","",A];else g="xdg-open",i=[A];let n=q3A(g,i,{detached:!0,stdio:"ignore"});n.on("error",()=>{}),n.unref()},ki=(A)=>new Promise((t)=>setTimeout(t,A));import{randomUUID as d3A}from"node:crypto";import sb from"node:fs";import p3A from"node:os";import XEA from"node:path";var jEA=()=>XEA.join(p3A.homedir(),".sazabi","pending-purchases"),A7A=()=>{sb.mkdirSync(jEA(),{recursive:!0,mode:448})},KEA=(A)=>XEA.join(jEA(),`${encodeURIComponent(A)}.json`),t7A=(A)=>{for(let t=0;t<50;t+=1){let g;try{g=sb.readFileSync(A,"utf-8")}catch(n){if(n.code==="ENOENT")return null;throw n}if(g.trim().length>0)try{let n=JSON.parse(g);if(n?.idempotencyKey&&n.organizationId&&n.amount)return n}catch{}let i=Date.now()+2;while(Date.now()<i);}return null},_EA=({organizationId:A,amount:t,explicitIdempotencyKey:g})=>{A7A();let i=KEA(A);for(let n=0;n<100;n+=1){let o={idempotencyKey:g??d3A(),organizationId:A,amount:t,createdAt:new Date().toISOString()};try{return sb.writeFileSync(i,JSON.stringify(o,null,2),{encoding:"utf-8",mode:384,flag:"wx"}),{kind:"reserved",entry:o}}catch(I){if(I.code!=="EEXIST")throw I}let e=t7A(i);if(!e)continue;if(e.amount!==t)return{kind:"conflict",existing:e,reason:`A pending purchase for ${e.amount} is unresolved. Resolve it before purchasing a different amount.`};if(g&&g!==e.idempotencyKey)return{kind:"conflict",existing:e,reason:"A pending purchase with a different idempotency key is unresolved. Resolve it first."};return{kind:"resumed",entry:e}}throw Error("Could not reserve a pending purchase after repeated attempts.")},GO=(A)=>{try{sb.unlinkSync(KEA(A))}catch(t){if(t.code!=="ENOENT")throw t}};import{createInterface as xEA}from"node:readline";var TO=()=>Boolean(process.stdin.isTTY)&&Boolean(process.stdout.isTTY),sEA=async(A)=>{let t=xEA({input:process.stdin,output:process.stdout});try{let i=(await new Promise((n)=>{t.question(`${A} [y/N] `,n)})).trim().toLowerCase();return i==="y"||i==="yes"}finally{t.close()}},qEA=async(A)=>{let t=xEA({input:process.stdin,output:process.stdout});try{await new Promise((g)=>{t.question(`${A} `,()=>g())})}finally{t.close()}};CA();var Tn=(A)=>{let t=A.json,g=R({tokenFlag:A.token,jsonMode:t});return{client:O({token:g.token,organizationId:g.organizationId,projectId:g.projectId,apiBaseUrlFlag:A["api-base-url"],jsonMode:t}),json:t??!1,credentials:g}},pEA=async({yes:A,json:t,prompt:g})=>{if(A)return!0;if(!TO()){if(t)u("Refusing to run this in a non-interactive shell without --yes.");else D("Refusing to run this in a non-interactive shell without --yes.");return!1}return sEA(g)},AaA=(A)=>A.statusCode===void 0||A.statusCode===408||A.statusCode===425||A.statusCode===429||A.statusCode>=500,taA=(A,t,g)=>{let i=`${t}: ${A.error}`;if(g){u(A.errorPayload??i);return}D(i)},g7A={plan:{label:"Plan",type:{kind:"string"}},status:{label:"Status",type:{kind:"string"}},currency:{label:"Currency",type:{kind:"string"}},balance:{label:"Current balance",type:{kind:"string"}},targetBalance:{label:"Target balance",type:{kind:"string"}},cycle:{label:"Cycle",type:{kind:"string"}},estimate:{label:"Est. total",type:{kind:"string"}},pendingDowngrade:{label:"Pending downgrade",type:{kind:"string"}},collection:{label:"Outstanding balance",type:{kind:"string"}}},n7A={layout:"field-list",schema:g7A,fields:["plan","status","currency","balance","targetBalance","cycle","estimate","pendingDowngrade","collection"]},i7A=(A)=>({plan:A.planName??"—",status:A.status,currency:A.currency??"—",balance:A.currentBalance??"—",targetBalance:A.targetCreditBalance??"—",cycle:A.currentCycle?`${A.currentCycle.startsAt.slice(0,10)} - ${A.currentCycle.endsAt.slice(0,10)}`:"—",estimate:A.currentPeriodEstimate?`${A.currentPeriodEstimate.totalAmount} ${A.currentPeriodEstimate.currency}`:"—",pendingDowngrade:A.pendingDowngrade?`${A.pendingDowngrade.planName??"—"} (effective ${A.pendingDowngrade.effectiveAt.slice(0,10)})`:"—",collection:o7A(A.collection)}),o7A=(A)=>{if(A.status==="current")return"None";let t=A.outstandingAmount!==null&&A.currency!==null?`${A.outstandingAmount} ${A.currency}`:`${A.outstandingCredits??"—"} credits`;if(A.status==="delinquent")return`${t} owed — delinquent, log intake paused until paid`;let g=A.nextRetryAt?`next retry ${A.nextRetryAt.slice(0,10)}`:"retry pending";return`${t} owed — payment retrying (${g})`},e7A=async(A)=>{let{values:t}=L(A,v),{client:g,json:i}=Tn(t),n=b(await g.billing.getSummary(),"Couldn't fetch billing summary (check your organization access and try again)",i);if(!i){if(LA("Billing summary"),!n.billable&&n.nonBillableReason)fA({"Not billable":n.nonBillableReason})}W(n7A,i7A(n),{json:i})},Q7A={logs_ingested_bytes:"Log data (GB)",logs_accepted_bytes:"Log data (GB)",input_tokens:"Input tokens",output_tokens:"Output tokens"},I7A=(A)=>{let t=Number.parseFloat(A);if(Number.isNaN(t))return A;return(t/1e9).toFixed(3)},h7A=(A,t)=>{if(t==="logs_ingested_bytes"||t==="logs_accepted_bytes")return I7A(A);let g=Number.parseInt(A,10);return Number.isNaN(g)?A:g.toLocaleString()},B7A={dimension:{label:"Dimension",type:{kind:"string"}},total:{label:"Total quantity",type:{kind:"string"}},credits:{label:"Credits consumed",type:{kind:"string"}}},c7A={schema:B7A,columns:["dimension","total","credits"],emptyMessage:"No usage recorded for this billing cycle."},C7A=async(A)=>{let{values:t}=L(A,{...v,cycle:{type:"string"}}),{client:g,json:i}=Tn(t);if(t.cycle&&t.cycle!=="current"&&t.cycle!=="previous"){if(i)return u("--cycle must be 'current' or 'previous'.");D("--cycle must be 'current' or 'previous'.");return}let n=t.cycle??"current",o=b(await g.billing.getUsage({cycle:n}),"Couldn't fetch billing usage (check your organization access and try again)",i);if(!i){if(LA(`Billing usage (${n} cycle)`),o.cycle)fA({Cycle:`${o.cycle.startsAt.slice(0,10)} - ${o.cycle.endsAt.slice(0,10)}`})}let e=new Map;for(let h of o.usage){let B=h.dimension,c=Q7A[B]??h.dimension,C=e.get(c),E=(C?.rawTotal??0)+Number.parseFloat(h.totalQuantity||"0");e.set(c,{dimension:c,rawTotal:E,total:h7A(String(E),B),credits:(Number.parseFloat(C?.credits??"0")+Number.parseFloat(h.creditsConsumed||"0")).toString()})}let I=[...e.values()].map(({rawTotal:h,...B})=>B);x(c7A,I,{json:i})},E7A={occurredAt:{label:"Date",type:{kind:"date"}},type:{label:"Type",type:{kind:"string"}},delta:{label:"Credit delta",type:{kind:"string"}},balance:{label:"Balance after",type:{kind:"string"}}},a7A={schema:E7A,columns:["occurredAt","type","delta","balance"],emptyMessage:"No billing transactions found."},r7A=async(A)=>{let{values:t}=L(A,{...v,limit:{type:"string"},page:{type:"string"}}),{client:g,json:i}=Tn(t),n,o;if(t.limit){if(n=Number.parseInt(t.limit,10),Number.isNaN(n)||n<1||n>100){if(i)return u("--limit must be a positive integer (max 100).");D("--limit must be a positive integer (max 100).");return}}if(t.page){if(o=Number.parseInt(t.page,10),Number.isNaN(o)||o<1){if(i)return u("--page must be a positive integer.");D("--page must be a positive integer.");return}}let e=b(await g.billing.listTransactions({limit:n??10,page:o??1}),"Couldn't fetch billing transactions (check your organization access and try again)",i);if(!i)LA("Billing transactions");let I=e.items.map((h)=>({occurredAt:h.occurredAt,type:h.transactionType,delta:h.creditDelta,balance:h.balanceAfter}));if(x(a7A,I,{json:i,count:e.pagination.total}),!i&&e.pagination.hasNext){let h=(o??1)+1;fA({"Next page":`Use --page ${h} for more results.`})}},y7A=async(A)=>{let{values:t}=L(A,v),{client:g,json:i}=Tn(t),n=b(await g.billing.retryOutstandingBalance({idempotencyKey:crypto.randomUUID()}),"Couldn't start the outstanding balance retry (check that a balance is outstanding and you can manage billing)",i);if(i){V(n);return}LA("Outstanding balance retry"),fA({Status:"Started","Workflow ID":n.workflowId,Next:"Run `sazabi billing summary` to see the outcome."})},w7A={enabled:{label:"Enabled",type:{kind:"string"}},triggerBalance:{label:"Trigger balance",type:{kind:"string"}},topUpAmount:{label:"Top-up amount",type:{kind:"string"}},cycleLimit:{label:"Cycle spending limit",type:{kind:"string"}},currency:{label:"Currency",type:{kind:"string"}},status:{label:"Status",type:{kind:"string"}}},gaA={layout:"field-list",schema:w7A,fields:["enabled","triggerBalance","topUpAmount","cycleLimit","currency","status"]},naA=(A)=>({enabled:A.enabled?"Yes":"No",triggerBalance:A.triggerCreditBalance,topUpAmount:A.topUpAmount,cycleLimit:A.cycleSpendingLimit,currency:A.currency.toUpperCase(),status:A.status}),D7A=async(A)=>{let{values:t}=L(A,v),{client:g,json:i}=Tn(t),n=b(await g.billing.getAutoTopUp(),"Couldn't fetch auto top-up settings (check your organization access and that you can manage billing)",i);if(!i)LA("Auto top-up");W(gaA,naA(n),{json:i})},u7A=async(A)=>{let{values:t}=L(A,{...v,enable:{type:"boolean"},disable:{type:"boolean"},"trigger-balance":{type:"string"},amount:{type:"string"},"cycle-limit":{type:"string"}}),{client:g,json:i}=Tn(t);if(t.enable&&t.disable){if(i)return u("Pass either --enable or --disable, not both.");D("Pass either --enable or --disable, not both.");return}let n=b(await g.billing.getAutoTopUp(),"Couldn't load current auto top-up settings",i),o=t.enable?!0:t.disable?!1:n.enabled,e=t["trigger-balance"]??n.triggerCreditBalance,I=t.amount??n.topUpAmount,h=t["cycle-limit"]??n.cycleSpendingLimit,B=b(await g.billing.updateAutoTopUp({enabled:o,triggerCreditBalance:e,topUpAmount:I,cycleSpendingLimit:h}),"Couldn't update auto top-up settings (check the values and that you can manage billing)",i);if(!i)j(o?"Auto top-up enabled.":"Auto top-up disabled."),LA("Auto top-up");W(gaA,naA(B),{json:i})},b7A=async(A)=>{let{values:t}=L(A,{...v,amount:{type:"string"},"idempotency-key":{type:"string"},yes:{type:"boolean"}}),{client:g,json:i,credentials:n}=Tn(t),o=t.amount?.trim();if(!o){if(i)return u("--amount is required (e.g. --amount 50).");D("--amount is required (e.g. --amount 50).");return}if(!/^\d+(?:\.\d{1,2})?$/.test(o)){if(i)return u("--amount must be a dollar amount, e.g. 50 or 50.00.");D("--amount must be a dollar amount, e.g. 50 or 50.00.");return}let e=n.organizationId;if(!e){if(i)return u("No active organization. Run `sazabi organizations use <id>` first.");D("No active organization. Run `sazabi organizations use <id>` first.");return}if(!await pEA({yes:Boolean(t.yes),json:i,prompt:`Purchase ${o} of credits for this organization?`})){if(!i)iA("Cancelled.");return}let h=_EA({organizationId:e,amount:o,explicitIdempotencyKey:t["idempotency-key"]});if(h.kind==="conflict"){let E=`${h.reason} Re-run to resume it, or pass --idempotency-key to control the key.`;if(i)return u(E);D(E);return}if(h.kind==="resumed"&&!i)iA("Resolving a prior purchase attempt (idempotency key reused).");let B=h.entry.idempotencyKey,c=await g.billing.purchaseCredits({amount:o,idempotencyKey:B});if(c.success)GO(e);else if(typeof c.statusCode==="number"&&c.statusCode>=400&&c.statusCode<500)GO(e);let C=b(c,"Couldn't purchase credits (check your payment method with `sazabi billing payment-method update` and that you can manage billing)",i);if(i){V(C);return}j("Credit purchase submitted."),fA({Status:C.status,"Credits granted":C.creditsToGrant,Charged:`${C.topUpAmount} ${C.currency.toUpperCase()}`,Invoice:C.billingInvoiceId})},l7A={current:{label:"",type:{kind:"string"}},slug:{label:"Slug",type:{kind:"string"}},name:{label:"Name",type:{kind:"string"}},price:{label:"Price",type:{kind:"string"}},includedCredits:{label:"Included credits",type:{kind:"string"}}},N7A={schema:l7A,columns:["current","slug","name","price","includedCredits"],emptyMessage:"No self-serve plans are available."},U7A=async(A)=>{let{values:t}=L(A,v),{client:g,json:i}=Tn(t),n=b(await g.billing.listPlans(),"Couldn't fetch plans (check your organization access and that you can manage billing)",i);if(i){V(n);return}LA("Plans");let o=n.plans.map((e)=>({current:e.slug===n.currentPlanSlug?"*":"",slug:e.slug,name:e.name,price:`${e.price} ${e.currency.toUpperCase()}`,includedCredits:e.targetCreditBalance??"—"}));if(x(N7A,o,{json:!1}),n.currentPlanSlug)fA({Current:`* = your current plan (${n.currentPlanSlug})`})},S7A={type:{label:"Change type",type:{kind:"string"}},effectiveAt:{label:"Effective",type:{kind:"string"}},currentPlan:{label:"Current plan",type:{kind:"string"}},targetPlan:{label:"Target plan",type:{kind:"string"}},immediateCharge:{label:"Immediate charge",type:{kind:"string"}},nextCycleCharge:{label:"Next cycle charge",type:{kind:"string"}},targetBalance:{label:"Target credit balance",type:{kind:"string"}}},iaA={layout:"field-list",schema:S7A,fields:["type","effectiveAt","currentPlan","targetPlan","immediateCharge","nextCycleCharge","targetBalance"]},oaA=(A)=>({type:A.type,effectiveAt:A.effectiveAt.slice(0,10),currentPlan:`${A.currentPlanName} (${A.currentPlanPrice} ${A.currency.toUpperCase()})`,targetPlan:`${A.targetPlanName} (${A.targetPlanPrice} ${A.currency.toUpperCase()})`,immediateCharge:`${A.immediateChargeAmount} ${A.currency.toUpperCase()}`,nextCycleCharge:`${A.nextCycleChargeAmount} ${A.currency.toUpperCase()}`,targetBalance:A.targetCreditBalance}),PO=(A,t)=>{let g=A.plan?.trim();if(!g){if(t)u("--plan <slug> is required. Run `sazabi billing plans list`.");else D("--plan <slug> is required. Run `sazabi billing plans list`.");return null}return g},L7A=async(A)=>{let{values:t}=L(A,{...v,plan:{type:"string"}}),{client:g,json:i}=Tn(t),n=PO(t,i);if(!n)return;let o=b(await g.billing.previewPlanChange({planSlug:n}),"Couldn't preview the plan change (check the plan slug and that you can manage billing)",i);if(!i)LA("Plan change preview");W(iaA,oaA(o),{json:i})},F7A=async(A)=>{let{values:t}=L(A,{...v,plan:{type:"string"},yes:{type:"boolean"}}),{client:g,json:i}=Tn(t),n=PO(t,i);if(!n)return;let o=b(await g.billing.previewPlanChange({planSlug:n}),"Couldn't preview the plan change (check the plan slug and that you can manage billing)",i);if(!i)LA("Plan change preview"),W(iaA,oaA(o),{json:!1});if(!await pEA({yes:Boolean(t.yes),json:i,prompt:`Apply this plan change to ${n}?`})){if(!i)iA("Cancelled.");return}let I=b(await g.billing.changePlan({planSlug:n}),"Couldn't change the plan (check that you can manage billing)",i);if(i){V(I);return}j(I.type==="downgrade"?"Plan downgrade scheduled.":"Plan changed."),fA({Type:I.type,Status:I.status,Effective:I.effectiveAt.slice(0,10)})},M7A=3000,Y7A=900000,k7A=async(A)=>{let{values:t}=L(A,{...v,plan:{type:"string"}}),{client:g,json:i}=Tn(t),n=PO(t,i);if(!n)return;let o=b(await g.billing.createCheckoutSession({planSlug:n}),"Couldn't start checkout (sign in with `sazabi auth login` — secret keys can't subscribe)",i);if(!i)yA(),LA("Subscribe to Sazabi"),yA(),yg("Complete checkout in your browser:"),yA(),yg(vA.info(o.checkoutUrl)),yA();if(eo(o.checkoutUrl),!i)iA("Waiting for checkout to complete...");let e=Date.now()+Y7A;while(Date.now()<e){await ki(M7A);let h=await g.billing.getCheckoutSessionStatus({sessionId:o.sessionId});if(!h.success&&AaA(h))continue;if(!h.success){taA(h,"Couldn't check checkout status",i);return}let B=h.value.status;if(B==="active"){if(i){V({status:"active",sessionId:o.sessionId});return}yA(),j("Subscription active."),fA({Next:"Run `sazabi billing summary` to see your plan, or `sazabi billing auto-top-up set` to enable auto top-up."});return}if(B==="expired"){let c=`Checkout ${B}. Run \`sazabi billing setup --plan ${n}\` to try again.`;if(i)return u(c);yA(),D(c);return}}let I="Checkout timed out. If you completed payment, run `sazabi billing summary` to confirm.";if(i)return u(I);yA(),D(I)},dEA=3000,$7A=300000,JO=(A)=>`${A.hasPaymentMethod}:${A.brand??""}:${A.last4??""}`,G7A=async(A)=>{let{values:t}=L(A,v),{client:g,json:i}=Tn(t),n=b(await g.billing.getPaymentMethod(),"Couldn't read the current payment method",i),o=b(await g.billing.createPortalSession(),"Couldn't open the billing portal (sign in with `sazabi auth login` — secret keys can't manage billing)",i);if(!i)yA(),LA("Update payment method"),yA(),yg("Update your payment method in the browser:"),yA(),yg(vA.info(o.portalUrl)),yA();if(eo(o.portalUrl),TO())await qEA("Press Enter when you've finished updating your payment method in the browser...");let e=JO(n),I=Date.now()+$7A,h=n;while(Date.now()<I){let B=await g.billing.getPaymentMethod();if(!B.success&&AaA(B)){await ki(dEA);continue}if(!B.success){taA(B,"Couldn't refresh the payment method",i);return}if(h=B.value,JO(h)!==e)break;await ki(dEA)}if(i){V(h);return}if(JO(h)!==e)j("Payment method updated."),fA({"Payment method":h.display??"on file"});else iA("No change detected. If you replaced your card with one of the same brand and last 4 digits, this is expected.")},T7A=U("summary","Show the billing summary for your organization",async(A)=>{await e7A(A)}).withOptions(f).withExamples(["sazabi billing summary # Show billing summary","sazabi billing summary --json # Output as JSON"]).build(),J7A=U("usage","Show per-dimension usage for the current or previous cycle",async(A)=>{await C7A(A)}).withOptions({...f,cycle:{type:"string",description:"Which cycle to report (current or previous)"}}).withExamples(["sazabi billing usage # Current cycle usage","sazabi billing usage --cycle previous # Previous cycle usage","sazabi billing usage --json # Output as JSON"]).build(),P7A=U("transactions","List recent credit ledger transactions",async(A)=>{await r7A(A)}).withOptions({...f,limit:{type:"string",description:"Max results per page (default 10, max 100)"},page:{type:"string",description:"Page number (1-indexed)"}}).withExamples(["sazabi billing transactions # Recent transactions","sazabi billing transactions --limit 50 # More results","sazabi billing transactions --page 2 # Next page","sazabi billing transactions --json # Output as JSON"]).build(),f7A=U("retry-outstanding-balance","Retry payment of an outstanding negative balance with the saved payment method",async(A)=>{await y7A(A)}).withOptions(f).withExamples(["sazabi billing retry-outstanding-balance # Retry the outstanding balance now","sazabi billing retry-outstanding-balance --json # Output as JSON"]).build(),R7A=U("auto-top-up","View or configure credit auto top-up").withSubcommands({get:U("get","Show the current auto top-up settings",async(A)=>{await D7A(A)}).withOptions(f).withExamples(["sazabi billing auto-top-up get # Show current auto top-up settings"]).build(),set:U("set","Enable/disable and configure auto top-up",async(A)=>{await u7A(A)}).withOptions({...f,enable:{type:"boolean",description:"Enable auto top-up"},disable:{type:"boolean",description:"Disable auto top-up"},"trigger-balance":{type:"string",description:"Credit balance that triggers a top-up"},amount:{type:"string",description:"Amount of credits to add per top-up"},"cycle-limit":{type:"string",description:"Maximum auto top-up spend per cycle"}}).withExamples(["sazabi billing auto-top-up set --enable --trigger-balance 10 --amount 50 --cycle-limit 200 # Enable auto top-up","sazabi billing auto-top-up set --disable # Turn auto top-up off"]).build()}).build(),O7A=U("credits","Purchase credits").withSubcommands({purchase:U("purchase","Buy a one-time amount of credits with the saved payment method",async(A)=>{await b7A(A)}).withOptions({...f,amount:{type:"string",description:"Dollar amount of credits to purchase (e.g. 50)"},"idempotency-key":{type:"string",description:"Explicit idempotency key (advanced; auto-generated otherwise)"},yes:{type:"boolean",description:"Skip the confirmation prompt"}}).withExamples(["sazabi billing credits purchase --amount 50 # Buy $50 of credits (prompts to confirm)","sazabi billing credits purchase --amount 50 --yes # Buy without a prompt"]).build()}).build(),v7A=U("plans","List available plans").withSubcommands({list:U("list","List the self-serve plans available for checkout",async(A)=>{await U7A(A)}).withOptions(f).withExamples(["sazabi billing plans list # List plans available for checkout"]).build()}).build(),z7A=U("plan","Preview or change your plan").withSubcommands({preview:U("preview","Preview the cost of changing to a plan",async(A)=>{await L7A(A)}).withOptions({...f,plan:{type:"string",description:"Target plan slug (see `sazabi billing plans list`)"}}).withExamples(["sazabi billing plan preview --plan team-v1 # See the cost of switching to team-v1"]).build(),change:U("change","Change to a plan (upgrade applies now; downgrade schedules)",async(A)=>{await F7A(A)}).withOptions({...f,plan:{type:"string",description:"Target plan slug (see `sazabi billing plans list`)"},yes:{type:"boolean",description:"Skip the confirmation prompt"}}).withExamples(["sazabi billing plan change --plan team-v1 # Change plan (shows preview, prompts to confirm)","sazabi billing plan change --plan team-v1 --yes # Change plan without a prompt"]).build()}).build(),m7A=U("setup","Subscribe from the terminal (opens a browser for checkout)",async(A)=>{await k7A(A)}).withOptions({...f,plan:{type:"string",description:"Plan slug to subscribe to (see `sazabi billing plans list`)"}}).withExamples(["sazabi billing setup --plan team-v1 # Subscribe via browser checkout"]).build(),W7A=U("payment-method","Manage your saved payment method").withSubcommands({update:U("update","Update your payment method (opens the Stripe Customer Portal)",async(A)=>{await G7A(A)}).withOptions(f).withExamples(["sazabi billing payment-method update # Update your card via the Stripe portal"]).build()}).build(),eaA=nA("billing","View and manage billing — usage, plans, credits, and subscribe").withSubcommands({summary:T7A,usage:J7A,transactions:P7A,"retry-outstanding-balance":f7A,"auto-top-up":R7A,credits:O7A,plans:v7A,plan:z7A,setup:m7A,"payment-method":W7A}).withExamples(["sazabi billing summary # Show billing plan and balance","sazabi billing setup --plan team-v1 # Subscribe from the terminal","sazabi billing credits purchase --amount 50 # Buy credits","sazabi billing auto-top-up set --enable --trigger-balance 10 --amount 50 --cycle-limit 200 # Enable auto top-up"]).build();oA();var QaA=()=>`