@sazabi/cli 0.20.0-dev.g0850dc6 → 0.20.0-dev.g166d3e4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8551,7 +8551,7 @@ Connect 1Password so Sazabi agents can work with your vaults and secrets through
|
|
|
8551
8551
|
- The 1Password CLI (\`op\`) sandbox preset, since no hosted MCP endpoint is available yet
|
|
8552
8552
|
`.trim()});import{dirname as Zhe,resolve as Xhe}from"node:path";import{fileURLToPath as Yhe}from"node:url";var Fhe,SJ,$J,Qhe,IJ,Vhe,eue,tue,TJ;var C$=g(()=>{be();wu();Fhe=Xhe(Zhe(Yhe(import.meta.url)),"../../../skills"),SJ=["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","sentry","signoz","slack","stripe","supabase","superhuman","the-context-company","vercel","x"],$J=a.enum(SJ),Qhe=a.object({readOnlyToolNames:a.array(a.string()).optional(),blockedToolNames:a.array(a.string()).optional(),defaultUnavailableReason:a.enum(pu).optional(),allowWriteTools:a.boolean().optional()}),IJ=a.object({registrationEndpoint:a.string().url(),tokenEndpointAuthMethod:a.enum(mu).optional(),includeScopesInRegistration:a.boolean().optional()}),Vhe=a.object({providerConfigKey:a.string().min(1),callbackPathSegment:a.string().min(1),authorizationUrl:a.string().url().optional(),tokenUrl:a.string().url().optional(),resourceUrl:a.string().url().optional(),useServerUrlAsResource:a.boolean().optional(),omitScopeFromAuthorizationUrl:a.boolean().optional(),authorizationUrlParams:a.record(a.string(),a.string()).optional(),dynamicClientRegistration:IJ.optional()}),eue=a.object({label:a.string().min(1),serverUrl:a.string().url(),authorizationUrl:a.string().url().optional(),tokenUrl:a.string().url().optional(),resourceUrl:a.string().url().optional(),dynamicClientRegistration:IJ.optional()}),tue=a.object({id:a.string().min(1),title:a.string().min(1),description:a.string().optional(),body:a.string().min(1),fieldKeys:a.array(a.string().min(1)).optional(),imageKeys:a.array(a.string().min(1)).optional()}),TJ=a.object({id:a.string().min(1),label:a.string().min(1),iconKey:$J,defaultServerUrl:a.string().url().nullable(),serverUrlPathSuffixMaxSegments:a.number().int().positive().optional(),transport:a.enum($P),authMode:a.enum(IP),availability:a.enum(ri),oauth:Vhe.optional(),regions:a.array(eue).optional(),capabilityOverrides:Qhe.optional(),helpText:a.string().optional(),setupGroups:a.array(tue).optional(),evidenceHints:a.array(a.string().min(1)).optional(),skill:a.string().min(1).optional(),setupSkill:a.string().min(1).optional(),scopesUserSelectable:a.boolean().optional()})});var D=(e)=>{return{...TJ.parse(e),...e.getAvailableScopes?{getAvailableScopes:e.getAvailableScopes}:{},...e.getUrlConfiguration?{getUrlConfiguration:e.getUrlConfiguration}:{},...e.validateCredentials?{validateCredentials:e.validateCredentials}:{},...e.normalizeHeaders?{normalizeHeaders:e.normalizeHeaders}:{}}};var ne=g(()=>{C$()});var AJ;var OJ=g(()=>{ne();AJ=D({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 LJ;var CJ=g(()=>{ne();LJ=D({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 DJ;var zJ=g(()=>{ne();DJ=D({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 _J;var jJ=g(()=>{ne();_J=D({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:dJ,normalizeHeaders:uJ})});var D$,TGe,NJ;var z$=g(()=>{ne();D$=[{value:"us-east-1",label:"US East (N. Virginia) — us-east-1"},{value:"eu-central-1",label:"Europe (Frankfurt) — eu-central-1"}],TGe=new Set(D$.map((e)=>e.value)),NJ=D({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 xJ;var RJ=g(()=>{ne();xJ=D({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 UJ;var MJ=g(()=>{ne();UJ=D({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 KJ;var GJ=g(()=>{ne();KJ=D({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:YG,normalizeHeaders:XG})});var JJ;var BJ=g(()=>{ne();JJ=D({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 qJ;var HJ=g(()=>{ne();qJ=D({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:vJ})});var EJ;var WJ=g(()=>{ne();EJ=D({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 ZJ;var XJ=g(()=>{ne();ZJ=D({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 YJ;var FJ=g(()=>{ne();YJ=D({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 QJ;var VJ=g(()=>{ne();QJ=D({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 eB;var tB=g(()=>{ne();eB=D({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 nB;var oB=g(()=>{ne();nB=D({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:qG,normalizeHeaders:BG})});var rB;var iB=g(()=>{ne();rB=D({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:aJ,normalizeHeaders:iJ})});var aB;var cB=g(()=>{ne();aB=D({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:hJ,normalizeHeaders:lJ,skill:"context-dev",setupSkill:"context-dev-setup"})});var sB;var lB=g(()=>{ne();sB=D({id:"custom",label:"Custom",iconKey:"plug",defaultServerUrl:null,transport:"streamable-http",authMode:"headers",availability:"custom-only",capabilityOverrides:{allowWriteTools:!0},helpText:"Connect any MCP server."})});var hB;var uB=g(()=>{ne();hB=D({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:JG,normalizeHeaders:KG})});var gB;var dB=g(()=>{ne();gB=D({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 yB;var bB=g(()=>{ne();yB=D({id:"elastic-cloud",label:"Elastic Cloud",iconKey:"elastic-cloud",defaultServerUrl:null,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:GG,normalizeHeaders:MG})});var mB;var pB=g(()=>{ne();mB=D({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:rJ,normalizeHeaders:oJ,skill:"exa",setupSkill:"exa-setup"})});var wB;var fB=g(()=>{ne();wB=D({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:kJ,normalizeHeaders:fJ})});var kB;var vB=g(()=>{ne();kB=D({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(`
|
|
8553
8553
|
`)}],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 PB;var SB=g(()=>{ne();PB=D({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 $B;var IB=g(()=>{ne();$B=D({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 TB;var AB=g(()=>{ne();TB=D({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 OB;var LB=g(()=>{ne();OB=D({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 CB;var DB=g(()=>{ne();CB=D({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 zB;var _B=g(()=>{ne();zB=D({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:QG,normalizeHeaders:FG})});var jB;var NB=g(()=>{ne();jB=D({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:yJ,normalizeHeaders:gJ})});var xB;var RB=g(()=>{ne();xB=D({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 UB;var MB=g(()=>{ne();UB=D({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 KB;var GB=g(()=>{ne();KB=D({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 JB;var BB=g(()=>{ne();JB=D({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 qB;var HB=g(()=>{ne();qB=D({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 EB;var WB=g(()=>{ne();EB=D({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 ZB;var XB=g(()=>{ne();ZB=D({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 YB;var FB=g(()=>{ne();YB=D({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 QB;var VB=g(()=>{ne();QB=D({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 eq;var tq=g(()=>{ne();eq=D({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 nq;var oq=g(()=>{ne();nq=D({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 rq;var iq=g(()=>{ne();rq=D({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 aq;var cq=g(()=>{ne();aq=D({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 sq;var lq=g(()=>{ne();sq=D({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:eJ,normalizeHeaders:VG})});var hq;var uq=g(()=>{ne();hq=D({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:sJ,normalizeHeaders:cJ,skill:"rentahuman",setupSkill:"rentahuman-setup"})});var gq;var dq=g(()=>{ne();gq=D({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:mJ,normalizeHeaders:bJ,skill:"resend",setupSkill:"resend-setup"})});var yq;var bq=g(()=>{ne();yq=D({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:wJ,normalizeHeaders:pJ,skill:"respan",setupSkill:"respan-setup"})});var mq;var pq=g(()=>{ne();mq=D({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(`
|
|
8554
|
-
`)}],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 wq;var fq=g(()=>{ne();wq=D({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 kq;var vq=g(()=>{ne();kq=D({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:nJ,normalizeHeaders:tJ})});var Pq;var Sq=g(()=>{ne();Pq=D({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"}},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 $q;var Iq=g(()=>{ne();$q=D({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 Tq;var Aq=g(()=>{ne();Tq=D({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 Oq;var Lq=g(()=>{ne();Oq=D({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:WG,normalizeHeaders:EG,skill:"the-context-company",setupSkill:"the-context-company-setup"})});var Cq;var Dq=g(()=>{ne();Cq=D({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 zq;var _q=g(()=>{ne();zq=D({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:ZG,normalizeHeaders:HG,skill:"x",setupSkill:"x-setup"})});var jq,Zqe;var Nq=g(()=>{OJ();CJ();zJ();jJ();z$();z$();RJ();MJ();GJ();BJ();HJ();WJ();XJ();FJ();VJ();tB();oB();iB();cB();lB();uB();dB();bB();pB();fB();vB();SB();IB();AB();LB();DB();_B();NB();RB();MB();GB();BB();HB();WB();XB();FB();VB();tq();oq();iq();cq();lq();uq();dq();bq();pq();fq();vq();Sq();Iq();Aq();Lq();Dq();_q();jq=[$q,hB,gB,AJ,LJ,DJ,_J,NJ,xJ,UJ,KJ,JJ,qJ,EJ,YJ,QJ,eB,nB,ZJ,rB,aB,yB,mB,wB,kB,PB,$B,TB,OB,CB,zB,jB,xB,UB,KB,JB,qB,EB,ZB,YB,QB,eq,nq,rq,aq,hq,sq,gq,yq,mq,wq,kq,Pq,Tq,Oq,Cq,zq,sB],Zqe=new Map(jq.map((e)=>[e.id,e]))});var xq=()=>{};var Rq=()=>{};var Uq=()=>{};var Mq=()=>{};var Kq=()=>{};var Gq=()=>{};var Jq=()=>{};var Bq=()=>{};var qq=()=>{};var Hq=()=>{};var Eq=()=>{};var Wq=()=>{};var Zq=()=>{};var Xq=()=>{};var Yq=()=>{};var Fq=()=>{};var Qq=()=>{};var Vq=()=>{};var eH=()=>{};var tH=()=>{};var nH=()=>{};var oH=()=>{};var rH=()=>{};var iH=()=>{};var aH=()=>{};var cH=()=>{};var sH=()=>{};var lH=()=>{};var hH=()=>{};var uH=()=>{};var gH=()=>{};var dH=()=>{};var yH=()=>{};var bH=()=>{};var mH=()=>{};var pH=()=>{};var wH=()=>{};var fH=()=>{};var kH=()=>{};var vH=()=>{};var PH=g(()=>{xq();Rq();Uq();Mq();Kq();Gq();Jq();Bq();qq();Hq();Eq();Wq();Zq();Xq();Yq();Fq();Qq();Vq();eH();tH();nH();oH();rH();iH();aH();cH();sH();lH();hH();uH();gH();dH();yH();bH();mH();pH();wH();fH();kH();vH()});var SH=()=>{};var $H=()=>{};var IH=g(()=>{Hx();wu();UG();PJ();Nq();C$();PH();SH();$H()});var TH,iue,AH,aue,OH,cue,LH,CH,_g,DH,zH,_H,Pi,jH,NH,Si,xH,RH,$i,UH,sue,MH,jg,KH,GH,JH,BH,Ii,qH,HH,Ti,EH,WH,Ai,lue;var _$=g(()=>{IH();be();Te();TH=["configured","authorizing","connected","error"],iue=a.enum(TH),AH=["preset","custom"],aue=a.enum(AH),OH=["streamable-http","sse"],cue=a.enum(OH),LH=["none","headers","oauth","aws-sigv4"],CH=a.enum(LH),_g=a.object({connectionId:a.string().uuid().describe("Connection ID."),connectionKey:a.string().describe("Stable key used to reference this connector in tool calls."),providerId:a.string().describe('Provider identifier, e.g. "linear".'),displayName:a.string().describe("Human-readable connector name."),source:aue.describe("Whether the connector is a built-in preset or a custom server."),installStatus:iue.describe("Current connection lifecycle status."),authMode:CH.describe("Authentication mode."),transport:cue.describe("Transport protocol."),serverUrl:a.string().describe("MCP server URL."),readOnly:a.boolean().describe("Whether the connector is restricted to read-only tools."),management:LP.describe("Lifecycle owner and supported connector mutations."),enabledToolCount:a.number().int().nonnegative().describe("Number of tools enabled and available for this connector."),connectedAt:a.string().datetime().nullable().describe("When the connector last became connected, if ever."),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),DH=a.object({name:a.string().describe("Tool name as invoked."),title:a.string().describe("Human-readable tool title."),description:a.string().describe("Tool description."),isReadOnly:a.boolean().describe("Whether the tool is considered read-only."),enabled:a.boolean().describe("Whether the tool is enabled and available given the connector config.")}),zH=a.object({projectId:a.string().uuid().optional().describe("Project to list connectors for. Auto-filled from SDK context when omitted."),connectedOnly:a.boolean().optional().describe("When true, only return connectors that are connected.")}),_H=a.object({connectors:a.array(_g)}),Pi=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:zH,output:_H,pagination:"none",async:"sync"}),jH=a.object({connectionId:a.string().uuid().describe("Connection ID to fetch."),projectId:a.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),NH=a.object({connector:_g}),Si=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:jH,output:NH,pagination:"none",async:"sync"}),xH=a.object({connectionId:a.string().uuid().describe("Connection ID to inspect."),projectId:a.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),RH=a.object({connector:_g,tools:a.array(DH)}),$i=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:xH,output:RH,pagination:"none",async:"sync"}),UH=a.object({providerId:a.string().describe('Provider identifier, e.g. "linear".'),label:a.string().describe("Human-readable provider name."),authMode:CH.describe("Authentication mode."),availability:a.enum(ri).describe("Whether the provider is enabled or coming soon."),setupSkill:a.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),sue=a.object({}),MH=a.object({providers:a.array(UH)}),jg=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:sue,output:MH,pagination:"none",async:"sync"}),KH=a.object({connectionKey:a.string().describe("Stable key used to call this connector."),displayName:a.string().describe("Human-readable connector name."),providerId:a.string().describe('Provider identifier, e.g. "linear".'),toolCount:a.number().int().nonnegative().describe("Number of executable tools on this connector.")}),GH=a.object({connectionKey:a.string().describe("Connector that exposes this tool."),toolName:a.string().describe("Tool name as invoked."),providerId:a.string().describe('Provider identifier, e.g. "linear".'),displayName:a.string().describe("Human-readable connector name."),isReadOnly:a.boolean().describe("Whether the tool is considered read-only."),description:a.string().describe("Tool description from the stored snapshot."),score:a.number().describe("BM25 rank score. Zero when enumerating a namespace."),inputSchema:a.record(a.string(),a.unknown()).optional().describe("JSON Schema for the tool's arguments, when requested.")}),JH=a.object({projectId:a.string().uuid().optional().describe("Project to search connectors in. Auto-filled from SDK context when omitted."),query:a.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:a.string().min(1).optional().describe("Restrict results to one connectionKey or providerId."),limit:a.coerce.number().int().min(1).max(100).default(10).describe("Maximum number of connectors or tool hits to return."),offset:a.coerce.number().int().min(0).default(0).describe("Number of connectors or tool hits to skip."),includeInputSchema:a.union([a.boolean(),a.stringbool()]).optional().describe("When true, tool hits include inputSchema so a caller can execute without a describe round-trip.")}),BH=a.object({kind:a.enum(["connectors","tools"]).describe("connectors when the query is empty and no namespace is set; tools otherwise."),total:a.number().int().nonnegative().describe("Total matches before limit and offset."),connectors:a.array(KH).describe("Connector index. Empty when kind is tools."),tools:a.array(GH).describe("Ranked or enumerated tool hits. Empty when kind is connectors.")}),Ii=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:JH,output:BH,pagination:"none",async:"sync"}),qH=a.object({projectId:a.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),connectionKey:a.string().min(1).describe("Connector key from search or mcpConnectors.list."),toolName:a.string().min(1).describe("Tool name as invoked.")}),HH=a.object({connectionKey:a.string().describe("Connector that exposes this tool."),toolName:a.string().describe("Tool name as invoked."),providerId:a.string().describe('Provider identifier, e.g. "linear".'),displayName:a.string().describe("Human-readable connector name."),title:a.string().describe("Human-readable tool title."),description:a.string().describe("Tool description from the stored snapshot."),isReadOnly:a.boolean().describe("Whether the tool is considered read-only."),inputSchema:a.record(a.string(),a.unknown()).describe("JSON Schema for the tool's arguments.")}),Ti=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:qH,output:HH,pagination:"none",async:"sync"}),EH=a.object({projectId:a.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),connectionKey:a.string().min(1).describe("Connector key from search or mcpConnectors.list."),toolName:a.string().min(1).describe("Tool name as invoked."),arguments:a.record(a.string(),a.unknown()).optional().describe("Arguments matching the tool's input schema.")}),WH=a.discriminatedUnion("ok",[a.object({ok:a.literal(!0),connectionKey:a.string().describe("Connector that ran the tool."),toolName:a.string().describe("Tool name as invoked."),result:a.unknown().describe("Vendor tool result payload."),structuredContent:a.unknown().optional().describe("Structured content from the vendor when present."),content:a.array(a.record(a.string(),a.unknown())).describe("Raw MCP content parts from the vendor."),text:a.string().nullable().describe("Concatenated text content, if any.")}),a.object({ok:a.literal(!1),code:a.enum(["TOOL_NOT_ENABLED","READ_ONLY","MCP_ERROR"]).describe("Why the tool did not run."),message:a.string().describe("Caller-facing error message.")})]),Ai=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:EH,output:WH,pagination:"none",async:"sync"}),lue={list:Pi.contract,get:Si.contract,details:$i.contract,listProviders:jg.contract,search:Ii.contract,describe:Ti.contract,call:Ai.contract}});var Oi,hue,uue,gue,due,yue,bue,mue,j$,kXe;var Ng=g(()=>{be();Te();Oi=a.enum(["admin","member"]),hue=a.object({id:a.string().min(1),name:a.string(),slug:a.string(),logo:a.string().nullable().optional(),role:Oi}),uue=a.object({id:a.string().min(1),name:a.string().nullable(),email:a.string().email()}),gue=a.object({credentialType:a.literal("user"),user:uue,activeOrganizationId:a.string().min(1).nullable(),organizations:a.array(hue).describe("Organizations the user belongs to, including membership role.")}),due=a.object({credentialType:a.literal("secret"),organization:a.object({id:a.string().min(1),name:a.string(),slug:a.string(),logo:a.string().nullable().optional()}),keyName:a.string()}),yue=a.object({credentialType:a.literal("partner"),superorganization:a.object({id:a.string().uuid(),name:a.string()})}),bue=a.object({}),mue=a.discriminatedUnion("credentialType",[gue,due,yue]),j$=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:bue,output:mue,pagination:"none",async:"sync"}),kXe=j$.contract});var ZH,pue,wue,fue,kue,vue,Pue,N$,x$,R$,IXe;var XH=g(()=>{be();Te();Ng();ZH=a.object({membershipId:a.string().min(1).describe("Organization membership record ID."),userId:a.string().min(1).describe("User ID for the organization member."),name:a.string().nullable().describe("Display name for the member, when available."),email:a.string().email().describe("Email address for the member."),imageUrl:a.string().nullable().describe("Profile image URL for the member, when available."),role:Oi.describe("Organization role."),createdAt:a.string().datetime().describe("When the membership was created.")}),pue=a.object({organizationId:a.string().min(1).optional().describe("Organization to list members for. Auto-filled from CLI and SDK context when omitted.")}),wue=a.object({members:a.array(ZH).describe("Members visible within the selected organization.")}),fue=a.object({organizationId:a.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted."),userId:a.string().min(1).describe("User ID of the member to update."),role:Oi.describe("Role to assign.")}),kue=a.object({member:ZH.describe("Updated organization member.")}),vue=a.object({params:a.object({userId:a.string().min(1).describe("User ID of the member to remove.")}),query:a.object({organizationId:a.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted.")})}).transform(({params:e,query:t})=>({...t,...e})),Pue=a.object({removedUserId:a.string().min(1).describe("User ID removed from the organization.")}),N$=S({operationId:"members.list",description:"List members in an organization.",backend:"api",route:{method:"GET",path:"/members",tags:["Members"]},input:pue,output:wue,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"}]}}]}),x$=S({operationId:"members.updateRole",description:"Update a member's organization role.",backend:"api",route:{method:"PATCH",path:"/members/{userId}/role",tags:["Members"]},input:fue,output:kue,pagination:"none",async:"sync",examples:[{name:"promote-member",input:{organizationId:"organization-123",userId:"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"}}}]}),R$=S({operationId:"members.remove",description:"Remove a member from an organization.",backend:"api",route:{method:"DELETE",path:"/members/{userId}",tags:["Members"],inputStructure:"detailed"},input:vue,output:Pue,pagination:"none",async:"sync"}),IXe={list:N$.contract,updateRole:x$.contract,remove:R$.contract}});var FH,QH,xg,VH,Rg,YH=4194304,U$,M$,Sue=(e)=>{let t=e.split(",").map((r)=>r.trim()).filter(Boolean),n=a.array(xg).safeParse(t);if(!n.success)throw Error("Kind filter must be a comma-separated list of note, runbook, or change.");return n.data},Fc,K$,G$,eE,tE,nE,oE,rE,iE,aE,cE,sE,lE,hE,uE,Li,Ci,Di,zi,_i,$ue;var J$=g(()=>{be();Te();FH=["note","runbook"],QH=["note","runbook","change"],xg=a.enum(QH),VH=a.enum(FH),Rg=a.string().min(1).max(512).refine((e)=>!e.startsWith("/"),{message:"Path must be relative without a leading slash."}).describe("Relative memory path, for example AGENTS.md or notes/architecture.md."),U$=a.string().min(1).refine((e)=>new TextEncoder().encode(e).length<=YH,{message:`Memory body must be at most ${YH} bytes (4 MiB).`}).describe("Document body stored in project memory."),M$=a.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."),Fc=a.string().min(1).transform(Sue).describe("Comma-separated kinds, for example note,runbook."),K$=a.object({id:a.string().uuid(),projectId:a.string().uuid(),kind:xg,managed:a.boolean(),path:a.string().nullable(),title:a.string().nullable(),contentHash:a.string(),attrs:a.record(a.string(),a.unknown()),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),G$=K$.extend({body:U$}),eE=a.object({projectId:a.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),path:Rg.describe("Relative path for the curated document."),body:U$,kind:VH.default("note").describe("Curated document kind. Only note and runbook may be written through the API."),title:a.string().max(500).optional().describe("Optional display title. Defaults to the path basename.")}),tE=a.object({document:G$}),nE=a.object({projectId:a.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),id:a.string().uuid().optional().describe("Document id."),path:Rg.optional().describe("Relative curated path.")}).superRefine((e,t)=>{let n=e.id!==void 0,r=e.path!==void 0;if(n===r)t.addIssue({code:"custom",message:"Provide exactly one of id or path."})}),oE=a.object({document:G$}),rE=a.object({projectId:a.string().uuid().optional().describe("Project to list memory for. Auto-filled from CLI and SDK context when omitted."),kind:Fc.optional(),since:M$.optional().describe("Only return documents updated within this window, for example 7d."),service:a.string().min(1).optional().describe("Filter to documents whose attrs.services contains this value."),pathPrefix:a.string().min(1).optional().describe("Filter to paths starting with this prefix."),managed:a.coerce.boolean().optional(),cursor:a.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of documents to return per page.")}),iE=a.object({documents:a.array(K$),nextCursor:a.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),aE=a.object({documentId:a.string().uuid(),kind:xg,managed:a.boolean(),path:a.string().nullable(),title:a.string().nullable(),snippet:a.string(),score:a.number()}),cE=a.object({calibrated:a.literal(!0),minScoreThreshold:a.number(),queryTerms:a.array(a.string()),message:a.string()}),sE=a.object({projectId:a.string().uuid().optional().describe("Project to search memory for. Auto-filled from CLI and SDK context when omitted."),query:a.string().trim().min(1).max(500).describe("Natural-language search query."),kind:Fc.optional(),since:M$.optional(),service:a.string().min(1).optional(),pathPrefix:a.string().min(1).optional(),managed:a.coerce.boolean().optional(),limit:a.coerce.number().int().min(1).max(50).default(10).describe("Maximum ranked search hits to return.")}),lE=a.object({hits:a.array(aE),emptyVerdict:cE.nullable()}),hE=a.object({projectId:a.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),id:a.string().uuid().optional().describe("Document id."),path:Rg.optional()}).superRefine((e,t)=>{let n=e.id!==void 0,r=e.path!==void 0;if(n===r)t.addIssue({code:"custom",message:"Provide exactly one of id or path."})}),uE=a.object({deleted:a.boolean()}),Li=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:eE,output:tE,pagination:"none",async:"sync"}),Ci=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:nE,output:oE,pagination:"none",async:"sync"}),Di=S({operationId:"memory.list",description:"List project memory catalog rows without embedding search.",backend:"api",route:{method:"GET",path:"/memory",tags:["Memory"]},input:rE,output:iE,pagination:"cursor",async:"sync"}),zi=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:sE,output:lE,pagination:"none",async:"sync"}),_i=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:hE,output:uE,pagination:"none",async:"sync"}),$ue={put:Li.contract,get:Ci.contract,list:Di.contract,search:zi.contract,delete:_i.contract}});var gE,dE,Iue,Tue,Aue,Oue,Lue,Qc,Cue,Due,zue,B$,q$,H$,E$,zXe;var Ug=g(()=>{be();Te();gE=a.enum(["processing","completed","aborted","error"]),dE=a.object({id:a.string().uuid(),threadId:a.string().uuid(),userMessageId:a.string().uuid().nullable(),assistantMessageId:a.string().uuid().nullable(),parentRunId:a.string().uuid().nullable(),workflowRunId:a.string().nullable(),status:gE,source:a.enum(["app","api","mcp","slack","teams","linear","github","agent","cli"]),createdAt:a.string().datetime(),updatedAt:a.string().datetime(),completedAt:a.string().datetime().nullable()}),Iue=a.object({projectId:a.string().uuid().optional().describe("Project ID to list runs for. Auto-filled from CLI and SDK context when omitted."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:a.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),Tue=a.object({runs:a.array(dE),nextCursor:a.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),Aue=a.object({threadId:a.string().uuid().describe("Thread ID to list runs for."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:a.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),Oue=a.object({runs:a.array(dE),nextCursor:a.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),Lue=a.object({runId:a.string().uuid().describe("Run ID returned by a deferred operation.")}),Qc=a.object({completed:a.boolean().describe("Whether the run has reached a terminal status."),threadId:a.string().uuid().describe("Thread ID associated with the run."),runId:a.string().uuid().describe("Run ID for subsequent polling."),messageId:a.string().uuid().optional().describe("ID of the user message that triggered this run."),status:gE.describe("Current run lifecycle status."),response:a.string().nullable().describe("Assistant response text when the run has completed.")}),Cue=Qc.describe("Current run state and, when complete, the assistant response."),Due=a.object({runId:a.string().uuid().describe("Run ID of the in-flight run to request cancellation for.")}),zue=a.object({success:a.literal(!0).describe("Always true when the cancellation request was accepted.")}),B$=S({operationId:"runs.list",description:"List deferred runs within one project.",backend:"api",route:{method:"GET",path:"/runs",tags:["Runs"]},input:Iue,output:Tue,pagination:"cursor",async:"sync"}),q$=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:Aue,output:Oue,pagination:"cursor",async:"sync"}),H$=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:Lue,output:Cue,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}}]}),E$=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:Due,output:zue,pagination:"none",async:"sync",examples:[{name:"cancel-processing-run",input:{runId:"33333333-3333-4333-8333-333333333333"},output:{success:!0}}]}),zXe={list:B$.contract,listForThread:q$.contract,get:H$.contract,cancel:E$.contract}});var Mg=(e,t,n)=>{let r=t?20000:1e4;if(e.length>r)n.addIssue({code:"too_big",maximum:r,type:"string",inclusive:!0,message:`Message cannot exceed ${r} characters`,origin:"string",path:["message"]})},Kg=(e,t,n)=>{if(e&&!t)n.addIssue({code:"custom",message:"ambientServiceRun requires an automationId",path:["ambientServiceRun"]})};var yE,Vc,_ue,jue,Nue,xue,Rue,Uue,Mue,Kue,Gue,W$,Jue,Bue,que,Hue,Eue,Wue,Zue,Xue,Yue,Fue,Que,Vue,Z$,X$,Y$,F$,Q$,V$,bE,ege,tge,nge,oge,mE,rge,ige,age,cge,sge,lge,Xo="22222222-2222-4222-8222-222222222222",pE="11111111-1111-4111-8111-111111111111",hge="44444444-4444-4444-8444-444444444444",wE="55555555-5555-4555-8555-555555555555",eI,tI,nI,oI,rI,MXe;var iI=g(()=>{be();Te();Ug();yE=a.enum(["slack","teams","linear","github","app","mcp","agent","api","cli"]),Vc=a.object({id:a.string().uuid(),projectId:a.string().uuid(),title:a.string().nullable(),status:a.enum(["regular","archived"]),source:yE.nullable(),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),_ue=a.object({type:a.literal("message"),message:a.string()}),jue=a.object({type:a.literal("reasoning"),reasoning:a.string(),status:a.enum(["in_progress","complete"]).optional()}),Nue=a.object({type:a.literal("tool_call"),name:a.string(),params:a.any().optional(),result:a.any().optional(),status:a.enum(["in_progress","success","error","unknown"]).optional(),toolCallId:a.string().optional(),durationMs:a.number().nonnegative().optional()}),xue=a.object({type:a.literal("artifact"),name:a.enum(["timeseries","table","log_detail","integration_required","alert_card","issue_card","mdx"]),data:a.any(),toolCallId:a.string().optional()}),Rue=a.object({type:a.literal("fork"),sourceThreadId:a.string(),sourceMessageId:a.string(),sourceThreadTitle:a.string().nullable()}),Uue=a.object({type:a.literal("summary"),summary:a.string()}),Mue=a.object({type:a.literal("slack_context"),channelId:a.string(),isTruncated:a.boolean().optional(),messages:a.array(a.object({timestamp:a.string(),slackUserId:a.string().optional(),displayName:a.string(),text:a.string(),isBot:a.boolean(),files:a.array(a.object({name:a.string(),mimetype:a.string(),size:a.number().optional(),attachmentId:a.string().uuid().optional(),ingestionStatus:a.enum(["attached","unsupported","oversized","skipped","unavailable"]).optional()})).optional()}))}),Kue=a.object({type:a.literal("teams_context"),conversationId:a.string(),isTruncated:a.boolean().optional(),messages:a.array(a.object({activityId:a.string().optional(),displayName:a.string(),text:a.string(),isBot:a.boolean(),createdDateTime:a.string().optional()}))}),Gue=a.union([_ue,jue,Nue,xue,Rue,Uue,Mue,Kue]),W$=a.object({id:a.string().uuid(),role:a.enum(["user","assistant"]),content:a.array(Gue),source:yE,createdAt:a.string().datetime()}),Jue=a.object({projectId:a.string().uuid().optional().describe("Project to list threads for. Auto-filled from CLI and SDK context when omitted."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of threads to return per page."),cursor:a.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:a.enum(["regular","archived"]).optional().describe("Filter by thread status. 'regular' returns active threads, 'archived' returns archived threads.")}),Bue=a.object({threads:a.array(Vc).describe("The page of threads matching the query."),nextCursor:a.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),que=a.object({threadId:a.string().uuid().describe("Thread ID returned by threads.list or threads.create.")}),Hue=a.object({thread:Vc.describe("The requested thread."),messages:a.array(W$).describe("Messages currently stored on the thread in chronological order.")}),Eue=a.object({projectId:a.string().uuid().optional().describe("Project to create the thread in. Auto-filled from CLI and SDK context when omitted."),message:a.string().min(1,"Message cannot be empty").describe("Initial user message that starts the thread."),wait:a.boolean().default(!0).describe("Whether the server should wait for the agent run before responding."),timeoutSeconds:a.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:a.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:a.literal(!0).optional().describe("Internal marker for scheduler-originated ambient service work. Honored only for system secret-key requests with matching automation context.")}).superRefine((e,t)=>{Mg(e.message,e.automationId,t),Kg(e.ambientServiceRun,e.automationId,t)}),Wue=Qc.describe("Deferred run result for creating a thread."),Zue=a.object({threadId:a.string().uuid().describe("Thread ID whose current processing status should be returned.")}),Xue=a.object({status:a.enum(["idle","processing"]),lastRunStatus:a.enum(["error"]).nullable()}),Yue=a.object({threadId:a.string().uuid().describe("Thread ID whose active run should be stopped.")}),Fue=a.object({success:a.literal(!0).describe("Always true when the stop request was accepted.")}),Que=a.object({threadId:a.string().uuid().describe("Thread ID of the thread to update."),status:a.enum(["regular","archived"]).describe("New status for the thread. 'archived' hides the thread from the sidebar.")}),Vue=a.object({thread:Vc.describe("The updated thread.")}),Z$=S({operationId:"threads.list",description:"List threads in a project, optionally filtered by status.",backend:"api",route:{method:"GET",path:"/threads",tags:["Threads"]},input:Jue,output:Bue,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}}]}),X$=S({operationId:"threads.get",description:"Get a thread and its messages.",backend:"api",route:{method:"GET",path:"/threads/{threadId}",tags:["Threads"]},input:que,output:Hue,pagination:"none",async:"sync"}),Y$=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:Zue,output:Xue,pagination:"none",async:"sync",examples:[{name:"processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{status:"processing",lastRunStatus:null}}]}),F$=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:Yue,output:Fue,pagination:"none",async:"sync",examples:[{name:"stop-processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{success:!0}}]}),Q$=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:Eue,output:Wue,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}}]}),V$=S({operationId:"threads.update",description:"Update a thread's status.",backend:"api",route:{method:"PATCH",path:"/threads/{threadId}",tags:["Threads"]},input:Que,output:Vue,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"}}}]}),bE=a.enum(["private","organization"]),ege=a.object({threadId:a.string().uuid().describe("Thread ID of the source thread to fork."),messageId:a.string().uuid().describe("Message ID in the source thread to fork from. The new thread copies messages up to and including this message.")}),tge=a.object({thread:Vc.describe("The newly created forked thread.")}),nge=a.object({threadId:a.string().uuid().describe("Thread ID of the thread to update."),visibility:bE.describe("New visibility. 'private' restricts the thread to its owner; 'organization' shares it with the organization.")}),oge=a.object({thread:Vc.describe("The updated thread."),visibility:bE.describe("The thread's resulting visibility.")}),mE=a.object({shareId:a.string().uuid().describe("Unique identifier for the snapshot."),threadId:a.string().uuid().describe("Thread the snapshot was taken from."),url:a.string().describe("Public read-only URL for the snapshot."),createdAt:a.string().datetime()}),rge=a.object({threadId:a.string().uuid().describe("Thread ID to create a public read-only snapshot for.")}),ige=a.object({share:mE.describe("The created share link.")}),age=a.object({threadId:a.string().uuid().describe("Thread ID the snapshot belongs to."),shareId:a.string().uuid().describe("Snapshot ID to revoke.")}),cge=a.void(),sge=a.object({threadId:a.string().uuid().describe("Thread ID to list public snapshots for.")}),lge=a.object({shares:a.array(mE).describe("Active share links for the thread.")}),eI=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:ege,output:tge,pagination:"none",async:"sync",examples:[{name:"fork-from-message",input:{threadId:Xo,messageId:hge},output:{thread:{id:"66666666-6666-4666-8666-666666666666",projectId:pE,title:"API returning 500s (fork)",status:"regular",source:"api",createdAt:"2026-01-01T00:20:00.000Z",updatedAt:"2026-01-01T00:20:00.000Z"}}}]}),tI=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:nge,output:oge,pagination:"none",async:"sync",examples:[{name:"make-private",input:{threadId:Xo,visibility:"private"},output:{thread:{id:Xo,projectId:pE,title:"API returning 500s",status:"regular",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:30:00.000Z"},visibility:"private"}}]}),nI=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:rge,output:ige,pagination:"none",async:"sync",examples:[{name:"create-share-link",input:{threadId:Xo},output:{share:{shareId:wE,threadId:Xo,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}}}]}),oI=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:sge,output:lge,pagination:"none",async:"sync",examples:[{name:"list-share-links",input:{threadId:Xo},output:{shares:[{shareId:wE,threadId:Xo,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}]}}]}),rI=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:age,output:cge,pagination:"none",async:"sync"}),MXe={list:Z$.contract,get:X$.contract,getStatus:Y$.contract,stop:F$.contract,create:Q$.contract,update:V$.contract,fork:eI.contract,setVisibility:tI.contract,createShareLink:nI.contract,listShareLinks:oI.contract,revokeShareLink:rI.contract}});var uge,gge,dge,yge,fE,kE;var vE=g(()=>{be();Te();Ug();iI();uge=a.object({threadId:a.string().uuid().describe("Thread ID to list messages for."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of messages to return per page."),cursor:a.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),gge=a.object({messages:a.array(W$),nextCursor:a.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),dge=a.object({threadId:a.string().uuid().describe("Thread ID to append the message to."),message:a.string().min(1,"Message cannot be empty").describe("Message body to append to the thread."),wait:a.boolean().default(!0).describe("Whether the server should wait for the appended message run before responding."),timeoutSeconds:a.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:a.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:a.literal(!0).optional().describe("Internal marker for scheduler-originated ambient service work. Honored only for system secret-key requests with matching automation context.")}).superRefine((e,t)=>{Mg(e.message,e.automationId,t),Kg(e.ambientServiceRun,e.automationId,t)}),yge=Qc.describe("Deferred run result for appending a message to an existing thread."),fE=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:uge,output:gge,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}}]}),kE=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:dge,output:yge,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 xt,SE,aI,ji,cI,Gg,po,$E,PE;var es=g(()=>{be();xt={IN_APP:"in_app",SLACK:"slack",SLACK_CHANNEL:"slack_channel",TEAMS_CHANNEL:"teams_channel",EMAIL:"email",SMS:"sms",INCIDENT_IO:"incident_io",PAGERDUTY:"pagerduty",ROOTLY:"rootly",WEBHOOK:"webhook"},SE=[xt.IN_APP,xt.SLACK,xt.EMAIL,xt.SMS],aI=[xt.SLACK_CHANNEL,xt.TEAMS_CHANNEL,xt.INCIDENT_IO,xt.PAGERDUTY,xt.ROOTLY,xt.WEBHOOK],ji=Object.values(xt),cI=[...ji,"victorops"],Gg=a.enum(ji),po=a.enum(aI),$E=[{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"}],PE=new Set($E.map(({channel:e})=>e));if(PE.size!==ji.length||ji.some((e)=>!PE.has(e)))throw Error("Notification channel definitions must represent every channel")});var IE,bge=(e,t)=>e.value===t.value&&e.label===t.label&&e.scope===t.scope&&e.role===t.role&&e.defaultOff===t.defaultOff&&(e.deliveryConditions??[]).join(",")===(t.deliveryConditions??[]).join(","),ft=(e)=>{for(let t of Object.values(e)){let n=IE.get(t.value);if(n&&!bge(n,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}`);IE.set(t.value,t)}return e};var Gn=g(()=>{IE=new Map});var TE;var AE=g(()=>{Gn();TE=ft({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 OE;var LE=g(()=>{Gn();OE=ft({BILLING_PLAN_UPGRADE_APPLIED:{value:"billing_plan_upgrade_applied",label:"Billing upgrade applied",scope:"org",role:"admin"},BILLING_PLAN_DOWNGRADE_SCHEDULED:{value:"billing_plan_downgrade_scheduled",label:"Billing downgrade scheduled",scope:"org",role:"admin"},BILLING_PLAN_DOWNGRADE_APPLIED:{value:"billing_plan_downgrade_applied",label:"Billing downgrade applied",scope:"org",role:"admin"},BILLING_CREDIT_BALANCE_LOW:{value:"billing_credit_balance_low",label:"Billing credits low",scope:"org",role:"admin"},BILLING_CREDIT_BALANCE_DEPLETED:{value:"billing_credit_balance_depleted",label:"Billing credits depleted",scope:"org",role:"admin"},BILLING_AUTO_TOP_UP_SETTINGS_CHANGED:{value:"billing_auto_top_up_settings_changed",label:"Billing auto top-up changed",scope:"org",role:"admin"},BILLING_AUTO_TOP_UP_FAILED:{value:"billing_auto_top_up_failed",label:"Billing auto top-up failed",scope:"org",role:"admin"},BILLING_INVOICE_PAID:{value:"billing_invoice_paid",label:"Billing invoice paid",scope:"org",role:"admin"},BILLING_NEGATIVE_BALANCE_COLLECTED:{value:"billing_negative_balance_collected",label:"Billing outstanding balance charged",scope:"org",role:"admin"},BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED:{value:"billing_negative_balance_collection_failed",label:"Billing outstanding balance charge failed",scope:"org",role:"admin"}})});var CE;var DE=g(()=>{Gn();CE=ft({INTEGRATION_CONNECTED:{value:"integration_connected",label:"Integration connected",scope:"org",defaultOff:!0},INTEGRATION_DISCONNECTED:{value:"integration_disconnected",label:"Integration disconnected",scope:"org"}})});var zE;var _E=g(()=>{Gn();zE=ft({ISSUE_TRIGGERED:{value:"issue_triggered",label:"Issue triggered",scope:"project",deliveryConditions:["component","severity"]},ISSUE_RESOLVED:{value:"issue_resolved",label:"Issue resolved",scope:"project",deliveryConditions:["component","severity"]},ISSUE_IGNORED:{value:"issue_ignored",label:"Issue ignored",scope:"project",deliveryConditions:["component","severity"]}})});var jE;var NE=g(()=>{Gn();jE=ft({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 xE;var RE=g(()=>{Gn();xE=ft({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 UE;var ME=g(()=>{Gn();UE=ft({SECURITY_ALERT:{value:"security_alert",label:"Security alert",scope:"org",role:"admin"}})});var sI,at,pge,lI=(e)=>{let t=pge.get(e)?.label;if(t)return t;let n=e.replace(/_/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):e};var ts=g(()=>{AE();LE();DE();_E();NE();RE();ME();Gn();sI={...UE,...jE,...CE,...TE,...zE,...xE,...OE},at=Object.fromEntries(Object.entries(sI).map(([e,t])=>[e,t.value])),pge=new Map(Object.values(sI).map((e)=>[e.value,e]))});var Jg,GE,kYe,$n,vYe;var Yo=g(()=>{ts();es();es();Jg=Object.values(at),GE=[at.BILLING_PLAN_UPGRADE_APPLIED,at.BILLING_PLAN_DOWNGRADE_SCHEDULED,at.BILLING_PLAN_DOWNGRADE_APPLIED,at.BILLING_CREDIT_BALANCE_LOW,at.BILLING_CREDIT_BALANCE_DEPLETED,at.BILLING_AUTO_TOP_UP_SETTINGS_CHANGED,at.BILLING_AUTO_TOP_UP_FAILED,at.BILLING_INVOICE_PAID,at.BILLING_NEGATIVE_BALANCE_COLLECTED,at.BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED],kYe=new Set(GE),$n=[at.ISSUE_TRIGGERED,at.ISSUE_RESOLVED,at.ISSUE_IGNORED,at.AUTOMATION_RUN_FAILED],vYe=new Set($n)});var ns,JE,BE=(e)=>typeof e==="string"&&(e in JE)?JE[e]:e,fge;var qE=g(()=>{es();be();Yo();ns=a.enum(Jg),JE={data_source_connected:"log_source_connected",data_source_disconnected:"log_source_disconnected"},fge=a.preprocess(BE,ns)});var kge;var HE=g(()=>{ts();Yo();kge=$n.map((e)=>({notificationType:e,label:lI(e)}))});var EE=g(()=>{ts();Yo()});var WE=g(()=>{es();ts();Yo();qE();HE();EE()});var ZE=()=>{};var XE=g(()=>{Yo()});var YE=g(()=>{Yo()});var hI=g(()=>{ZE();XE();YE();WE()});var Sge,$ge,Ige,Tge,Age,Oge,Lge,uI,RFe;var FE=g(()=>{hI();be();Te();Sge=a.enum(["ready","missing","degraded","unavailable"]),$ge=a.object({id:a.string(),label:a.string(),status:a.enum(["active","inactive","degraded"]),statusLabel:a.string()}),Ige=a.object({channel:Gg,name:a.string(),description:a.string(),scope:a.enum(["personal","project"]),enabled:a.boolean().nullable(),preferenceId:a.string().nullable(),prerequisite:a.object({status:Sge,statusLabel:a.string(),message:a.string()}),action:a.object({label:a.string(),href:a.string()}).nullable(),destinations:a.array($ge),destinationManagement:a.enum(["none","slack_channels","teams_channels","integration_connections","webhook_endpoints"]),canCreateDestinations:a.boolean(),supportedNotificationTypes:a.array(ns)}),Tge=a.object({channel:po,enabled:a.boolean(),preferenceId:a.string().nullable()}),Age=a.object({channel:po,notificationType:ns,enabled:a.boolean(),preferenceId:a.string()}),Oge=a.object({projectId:a.string().uuid().optional().describe("Project to inspect. Auto-filled from CLI and SDK context when omitted.")}),Lge=a.object({channelCards:a.array(Ige).length(10),channels:a.array(Tge),notificationTypePreferences:a.array(Age),issueNotificationMinSeverity:a.enum(["low","medium","high","critical"])}),uI=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:Oge,output:Lge,pagination:"none",async:"sync"}),RFe={getProject:uI.contract}});var QE,dI,VE,yI,JFe,BFe,bI,mI=(e,t)=>{if((e.componentIds?.length||e.componentId)&&"componentIds"in e.condition&&e.condition.componentIds?.length)t.addIssue({code:"custom",path:["condition","componentIds"],message:"Use componentIds instead of legacy condition.componentIds."});if(e.componentIds?.length&&e.componentId)t.addIssue({code:"custom",path:["componentId"],message:"Use componentIds instead of componentId."})},qFe,eW,gI,pI,os,tW,Cge,Dge,zge,_ge,jge,Nge,xge,Rge,Uge,wI,fI,kI,vI,PI,HFe;var nW=g(()=>{hI();be();Te();QE=a.enum(["low","medium","high","critical"]),dI=a.object({severities:a.array(QE).min(1).optional()}).strict(),VE=a.object({componentIds:a.array(a.string().uuid()).min(1).optional(),severities:a.array(QE).min(1).optional()}).strict(),yI=a.object({channel:po,destinationKey:a.string().min(1)}),JFe=a.object({destinations:a.array(yI).min(1),notificationTypes:a.array(a.enum($n)).min(1),componentIds:a.array(a.string().uuid()).min(1).optional().describe("Stable component registry IDs matched by this rule."),includeDescendants:a.boolean().default(!1).describe("Whether the rule also matches descendant components."),condition:dI}),BFe=a.object({destinations:a.array(yI).min(1),notificationTypes:a.array(a.enum($n)).min(1),condition:VE}),bI=a.object({destinations:a.array(yI).min(1),notificationTypes:a.array(a.enum($n)).min(1),componentIds:a.array(a.string().uuid()).min(1).optional().describe("Stable component registry IDs matched by this rule."),componentId:a.string().uuid().optional().describe("Deprecated single-component compatibility input."),includeDescendants:a.boolean().default(!1).describe("Whether the rule also matches descendant components."),condition:a.union([dI,VE])}),qFe=bI.superRefine(mI),eW=a.object({id:a.string(),channel:po,destinationKey:a.string(),displayName:a.string()}),gI=a.object({id:a.string().uuid(),label:a.string(),lifecycle:a.enum(["active","retired","merged"])}),pI=a.object({id:a.string().uuid(),projectId:a.string().uuid(),notificationTypes:a.array(a.enum($n)),destinations:a.array(eW),condition:dI,component:gI.nullable(),componentId:a.string().uuid().nullable(),includeDescendants:a.boolean(),suspendedAt:a.string().datetime().nullable(),suspensionReason:a.string().nullable(),components:a.array(gI),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),os=a.object({projectId:a.string().uuid().optional().describe("Project whose notification delivery rules are being managed.")}),tW=a.string().uuid().describe("Logical notification delivery rule ID."),Cge=os,Dge=a.object({rules:a.array(pI)}),zge=a.object({destinations:a.array(eW),notificationTypes:a.array(a.object({notificationType:a.enum($n),label:a.string(),conditions:a.array(a.enum(["component","severity"]))})),components:a.array(gI)}),_ge=os.extend(bI.shape).superRefine(mI),jge=pI,Nge=os.extend({...bI.shape,ruleId:tW}).superRefine(mI),xge=pI,Rge=os.extend({ruleId:tW}),Uge=a.object({removed:a.boolean()}),wI=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:Cge,output:Dge,pagination:"none",async:"sync"}),fI=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:os,output:zge,pagination:"none",async:"sync"}),kI=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:_ge,output:jge,pagination:"none",async:"sync"}),vI=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:Nge,output:xge,pagination:"none",async:"sync"}),PI=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:Rge,output:Uge,pagination:"none",async:"sync"}),HFe={list:wI.contract,options:fI.contract,create:kI.contract,update:vI.contract,delete:PI.contract}});var SI,Mge,Kge,Gge,Jge,Bge,qge,$I,Hge,Ege,II,Wge,Zge,TI,Xge,Yge,AI,Fge,Qge,OI,XFe;var oW=g(()=>{be();Te();SI=a.enum(["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"]),Mge=a.enum(["needs-onboarding","blocked","ready"]),Kge=a.enum(["incomplete","complete","skipped"]),Gge=a.object({invitationId:a.string(),organizationId:a.string(),organizationName:a.string(),organizationSlug:a.string(),organizationImageUrl:a.string().nullable(),inviterName:a.string().nullable()}),Jge=a.object({gate:Mge,canonicalStep:SI.nullable(),organizationId:a.string().nullable(),projectId:a.string().nullable(),completionByStep:a.record(SI,Kge),githubSkipped:a.boolean(),githubAppSkipped:a.boolean(),slackSkipped:a.boolean(),sampleIssueId:a.string().nullable(),actorRole:a.enum(["admin","member"]).nullable(),requiredStep:a.union([SI,a.literal("select-organization")]).nullable(),isCompleted:a.boolean(),onboardingRecommendationsThreadId:a.string().nullable(),hasOrganizations:a.boolean(),hasPaidBillingSubscription:a.boolean(),billingStepEnabled:a.boolean(),pendingInvitations:a.array(Gge)}),Bge=a.object({}),qge=a.object({onboarding:Jge}),$I=S({operationId:"onboarding.getState",description:"Read onboarding progress for the authenticated user.",backend:"api",route:{method:"GET",path:"/onboarding/state",tags:["Onboarding"]},input:Bge,output:qge,pagination:"none",async:"sync"}),Hge=a.object({integration:a.enum(["github","slack"]).describe("Integration onboarding step to skip.")}),Ege=a.object({skipped:a.literal(!0)}),II=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:Hge,output:Ege,pagination:"none",async:"sync"}),Wge=a.object({}),Zge=a.object({skipped:a.literal(!0)}),TI=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:Wge,output:Zge,pagination:"none",async:"sync"}),Xge=a.object({}),Yge=a.object({skipped:a.literal(!0)}),AI=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:Xge,output:Yge,pagination:"none",async:"sync"}),Fge=a.object({projectId:a.string().uuid().describe("Project that completed onboarding.")}),Qge=a.object({completed:a.boolean()}),OI=S({operationId:"onboarding.finish",description:"Mark onboarding complete when all prerequisites are satisfied.",backend:"api",route:{method:"POST",path:"/onboarding/finish",tags:["Onboarding"]},input:Fge,output:Qge,pagination:"none",async:"sync"}),XFe={getState:$I.contract,skipIntegration:II.contract,skipGithubAppInstallation:TI.contract,skipSampleIssue:AI.contract,finish:OI.contract}});var Bg,Vge,ede,tde,nde,ode,rde,ide,ade,cde,sde,LI,CI,DI,zI,eQe;var rW=g(()=>{be();Te();Ng();Bg=a.object({id:a.string().min(1),name:a.string(),slug:a.string(),logo:a.string().nullable().optional()}),Vge=Bg.extend({role:Oi.optional()}),ede=a.object({}),tde=a.object({organizations:a.array(Vge).describe("Organizations available to the current credential.")}),nde=a.object({organizationId:a.string().min(1).describe("Organization ID to fetch.")}),ode=a.object({organization:Bg}),rde=a.object({organizationId:a.string().min(1).describe("Organization ID to update. SDK and CLI callers can auto-fill this before dispatch."),name:a.string().trim().min(1).max(100).describe("New organization name.")}),ide=a.object({organization:Bg.describe("Updated organization.")}),ade=a.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"),cde=a.object({name:ade.describe("Organization display name.")}),sde=a.object({organization:Bg}),LI=S({operationId:"organizations.create",description:"Create an organization for the authenticated user.",backend:"api",route:{method:"POST",path:"/organizations",tags:["Organizations"],successStatus:201},input:cde,output:sde,pagination:"none",async:"sync"}),CI=S({operationId:"organizations.list",description:"List organizations available to the current credential.",backend:"api",route:{method:"GET",path:"/organizations",tags:["Organizations"]},input:ede,output:tde,pagination:"none",async:"sync"}),DI=S({operationId:"organizations.get",description:"Get one organization by ID.",backend:"api",route:{method:"GET",path:"/organizations/{organizationId}",tags:["Organizations"]},input:nde,output:ode,pagination:"none",async:"sync"}),zI=S({operationId:"organizations.update",description:"Update one organization.",backend:"api",route:{method:"PATCH",path:"/organizations/{organizationId}",tags:["Organizations"]},input:rde,output:ide,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}}}]}),eQe={list:CI.contract,get:DI.contract,create:LI.contract,update:zI.contract}});var Ni,rs,iW,aW,cW,sW,lW,hW,uW,qg,Hg,Eg,gW,dW,Wg,yW,bW,Zg,lde;var _I=g(()=>{be();Te();Ni=a.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"]),rs=a.object({id:a.string().uuid(),organizationId:a.string().min(1),name:a.string(),region:Ni}),iW=a.object({organizationId:a.string().min(1).optional().describe("Organization to list projects for. Auto-filled from CLI and SDK context when omitted.")}),aW=a.object({projects:a.array(rs).describe("Projects visible within the selected organization.")}),cW=a.object({projectId:a.string().uuid().describe("Project ID to fetch.")}),sW=a.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"),lW=a.object({organizationId:a.string().min(1).optional().describe("Organization to create the project under. Auto-filled from CLI and SDK context when omitted."),name:sW.describe("Project name."),region:Ni.optional().default("us-west-2").describe("AWS region where the new project should be created.")}),hW=a.object({project:rs}),uW=a.object({project:rs}),qg=S({operationId:"projects.list",description:"List projects in an organization.",backend:"api",route:{method:"GET",path:"/projects",tags:["Projects"]},input:iW,output:aW,pagination:"none",async:"sync"}),Hg=S({operationId:"projects.get",description:"Get one project by ID.",backend:"api",route:{method:"GET",path:"/projects/{projectId}",tags:["Projects"]},input:cW,output:uW,pagination:"none",async:"sync"}),Eg=S({operationId:"projects.create",description:"Create one project in an organization.",backend:"api",route:{method:"POST",path:"/projects",successStatus:201,tags:["Projects"]},input:lW,output:hW,pagination:"none",async:"sync"}),gW=a.object({projectId:a.string().uuid().describe("Project ID to update."),name:sW.optional().describe("New project name.")}),dW=a.object({project:rs}),Wg=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:gW,output:dW,pagination:"none",async:"sync"}),yW=a.object({projectId:a.string().uuid().describe("Project ID to delete.")}),bW=a.void(),Zg=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:yW,output:bW,pagination:"none",async:"sync"}),lde={list:qg.contract,get:Hg.contract,create:Eg.contract,update:Wg.contract,delete:Zg.contract}});var mW,hde,ude,gde,dde,yde,jI,cQe;var pW=g(()=>{be();Te();mW=a.enum(["open","merged","closed"]),hde=a.enum(["review_required","approved","changes_requested"]),ude=a.enum(["passing","failing","pending"]),gde=a.object({id:a.string().uuid(),projectId:a.string().uuid(),repositoryFullName:a.string(),pullRequestId:a.string().describe("Provider-native pull request identifier (GitHub PR number or Bitbucket PR id), serialized as a string."),githubPullRequestId:a.number().int().describe("Deprecated: use pullRequestId. Numeric form of the provider-native pull request identifier; kept for backward compatibility."),title:a.string().nullable(),url:a.string().nullable(),status:mW.nullable(),reviewState:hde.nullable(),checksState:ude.nullable(),requestedByUserId:a.string().nullable(),authorLogin:a.string().nullable().describe("Forge login that authored the pull request (often the Sazabi app identity)."),githubAuthorLogin:a.string().nullable().describe("Deprecated: use authorLogin. Kept for backward compatibility."),threadId:a.string().uuid().nullable(),runId:a.string().uuid().nullable(),createdAt:a.string().datetime(),mergedAt:a.string().datetime().nullable(),closedAt:a.string().datetime().nullable()}),dde=a.object({projectId:a.string().uuid().optional().describe("Project to list pull requests for. Auto-filled from CLI and SDK context when omitted."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of pull requests to return per page."),cursor:a.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:mW.optional().describe("Filter by pull request status (open, merged, or closed)."),repositoryFullName:a.string().trim().optional().describe("Filter by repository full name, for example owner/repo. Case-insensitive."),requestedByUserId:a.string().trim().optional().describe("Filter by the Sazabi user who requested the pull request. Pass 'me' to filter to the authenticated user.")}),yde=a.object({pullRequests:a.array(gde),nextCursor:a.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),jI=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:dde,output:yde,pagination:"cursor",async:"sync"}),cQe={list:jI.contract}});var wW,fW,kW,vW,PW,is;var NI=g(()=>{be();Te();wW=a.enum(["data_source","mcp_connector","sandbox_cli","integration"]),fW=a.enum(["connected","recommended"]),kW=a.object({kind:wW.describe("What the recommendation targets: a data source, MCP connector, sandbox CLI, or integration."),targetId:a.string().describe("Exact catalog id for the kind (data source type, MCP provider id, sandbox CLI preset type, or integration provider id)."),status:fW.describe("Resolved live against current connections: connected (already set up) or recommended (suggested, not yet connected)."),roiScore:a.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:a.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.")}),vW=a.object({projectId:a.string().uuid().optional().describe("Project to list recommendations for. Auto-filled from CLI and SDK context when omitted.")}),PW=a.object({recommendations:a.array(kW).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).")}),is=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:vW,output:PW,pagination:"none",async:"sync"})});var SW,bde,$W,Xg,IW,TW,AW,OW,xi,LW,CW,DW,Yg,mde;var xI=g(()=>{be();Te();SW=a.object({type:a.string().describe("Preset type identifier."),label:a.string().describe("Human-readable display name."),executableNames:a.array(a.string()).describe("CLI binary names installed by this preset."),envVarKeys:a.array(a.string()).describe("Environment variables required for authentication."),setupSkill:a.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),bde=a.object({}),$W=a.object({types:a.array(SW)}),Xg=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:bde,output:$W,pagination:"none",async:"sync"}),IW=a.enum(["github_app","bitbucket_integration","personal_access_token","stored_credentials"]),TW=a.object({presetType:a.string().describe("Preset type identifier."),credentialSource:IW.describe("Authoritative credential source for the preset."),isSystemManaged:a.boolean().describe("Whether the connection follows an integration lifecycle."),fallbackConfigured:a.boolean().describe("Whether user-provided fallback credentials are stored for this preset."),envVarKeys:a.array(a.string()).describe("Stored environment variable names. Secret values are omitted.")}),AW=a.object({projectId:a.string().uuid().optional().describe("Project to inspect. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted.")}),OW=a.object({connections:a.array(TW)}),xi=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:AW,output:OW,pagination:"none",async:"sync"}),LW=a.object({key:a.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:a.string().max(10240).describe("Secret value. Encrypted at rest; never returned by any API response.")}),CW=a.object({projectId:a.string().uuid().optional().describe("Project to configure. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:a.string().min(1).describe("Preset type identifier (e.g. kubectl, aws, github)."),environmentVariables:a.array(LW).max(100).describe("Full set of env vars for this preset. Replaces any previously stored values for the preset.")}),DW=a.object({projectId:a.string().uuid().describe("Project the preset was written to."),presetType:a.string().describe("Preset type that was upserted."),envVarKeys:a.array(a.string()).describe("Env var key names now stored for this preset. Values are never returned.")}),Yg=S({operationId:"sandboxPresets.upsertPreset",summary:"Upsert CLI Connection",description:"Set or replace a project's sandbox CLI connection environment variables (e.g. the kubectl CLI's KUBECONFIG_CONTENTS). Values are encrypted server-side and never returned. Requires a secret key scoped to the target project's organization.",backend:"api",route:{method:"POST",path:"/sandbox-presets/config",successStatus:200,tags:["Sandbox Presets"]},input:CW,output:DW,pagination:"none",async:"sync"}),mde={listConnections:xi.contract,listTypes:Xg.contract,upsertPreset:Yg.contract}});var Fg,zW=1048576,RI,_W,UI,pde,wde,fde,kde,vde,Pde,Sde,$de,Ide,Tde,MI,KI,GI,JI,BI,pQe;var jW=g(()=>{be();Te();Fg=a.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."),RI=a.string().min(1).refine((e)=>new TextEncoder().encode(e).length<=zW,{message:`Script content must be at most ${zW} bytes (1 MiB).`}).describe("Bash script body materialized as /home/sazabi/scripts/<name>.sh in the sandbox."),_W=a.object({id:a.string().uuid(),projectId:a.string().uuid(),name:a.string(),description:a.string().nullable(),contentHash:a.string().describe("sha256 hex digest of the script content."),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),UI=_W.extend({content:RI}),pde=a.object({projectId:a.string().uuid().optional().describe("Project to list scripts for. Auto-filled from CLI and SDK context when omitted."),search:a.string().optional().describe("Case-insensitive partial match on script name."),cursor:a.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of scripts to return per page.")}),wde=a.object({scripts:a.array(_W),nextCursor:a.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),fde=a.object({name:Fg.describe("Script name to fetch."),projectId:a.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),kde=a.object({script:UI}),vde=a.object({projectId:a.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),name:Fg.describe("Script name. Must be unique within the project among non-deleted scripts."),content:RI,description:a.string().max(500).nullable().optional().describe("Optional human-readable description.")}),Pde=a.object({script:UI}),Sde=a.object({name:Fg.describe("Script to update."),projectId:a.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),content:RI.optional().describe("New script body. Omit to leave content unchanged."),description:a.string().max(500).nullable().optional().describe("New description, or null to clear it. Omit to leave unchanged.")}),$de=a.object({script:UI}),Ide=a.object({name:Fg.describe("Script to delete."),projectId:a.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),Tde=a.object({deleted:a.boolean()}),MI=S({operationId:"scripts.list",description:"List durable bash scripts stored for a project.",backend:"api",route:{method:"GET",path:"/scripts",tags:["Scripts"]},input:pde,output:wde,pagination:"cursor",async:"sync"}),KI=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:fde,output:kde,pagination:"none",async:"sync"}),GI=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:vde,output:Pde,pagination:"none",async:"sync"}),JI=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:Sde,output:$de,pagination:"none",async:"sync"}),BI=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:Ide,output:Tde,pagination:"none",async:"sync"}),pQe={list:MI.contract,get:KI.contract,create:GI.contract,update:JI.contract,delete:BI.contract}});var qI,NW,xW,RW,UW,Ri,Ui,Ade;var HI=g(()=>{be();Te();qI=a.object({projectId:a.string().uuid().optional().describe("Project to search within. Auto-filled from CLI and SDK context when omitted."),query:a.string().trim().min(1,"Query must be at least 1 character").max(500,"Query must be at most 500 characters"),limit:a.coerce.number().min(1).max(100).default(20).describe("Maximum number of search results to return."),page:a.coerce.number().min(1).default(1).describe("One-based page number.")}),NW=qI.extend({status:a.enum(["regular","archived"]).optional().describe("Optional thread status filter.")}),xW=qI.extend({threadId:a.string().uuid().optional().describe("Optional thread restriction for message search."),role:a.enum(["user","assistant"]).optional().describe("Optional message role filter.")}),RW=a.object({threads:a.array(a.object({id:a.string().uuid(),projectId:a.string().uuid().optional(),title:a.string(),status:a.enum(["regular","archived"]),labels:a.array(a.string()),createdAt:a.string().datetime(),updatedAt:a.string().datetime(),highlights:a.array(a.string()),score:a.number().optional()})),pagination:a.object({page:a.number(),limit:a.number(),totalResults:a.number(),totalPages:a.number()}).describe("Page-based pagination metadata for the current search result.")}),UW=a.object({messages:a.array(a.object({id:a.string().uuid(),threadId:a.string().uuid(),threadTitle:a.string(),role:a.enum(["user","assistant"]),content:a.string(),createdAt:a.string().datetime(),updatedAt:a.string().datetime(),highlights:a.array(a.string()),score:a.number().optional()})),pagination:a.object({page:a.number(),limit:a.number(),totalResults:a.number(),totalPages:a.number()}).describe("Page-based pagination metadata for the current search result.")}),Ri=S({operationId:"search.threads",description:"Search threads within one project.",backend:"api",route:{method:"GET",path:"/search/threads",tags:["Search"]},input:NW,output:RW,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}}}]}),Ui=S({operationId:"search.messages",description:"Search messages within one project.",backend:"api",route:{method:"GET",path:"/search/messages",tags:["Search"]},input:xW,output:UW,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}}}]}),Ade={threads:Ri.contract,messages:Ui.contract}});var MW;var KW=g(()=>{MW=["onboarding","setup"]});var GW,JW,BW,qW,as;var EI=g(()=>{KW();be();Te();GW=a.enum(MW),JW=a.object({id:a.string().describe("Unique task identifier (e.g. install_github_app)."),label:a.string().describe("Short human-readable task name."),description:a.string().describe("Explanation of what needs to be completed to satisfy this task."),instructions:a.string().describe("Step-by-step instructions for completing this task."),completed:a.boolean().describe("Whether the task has been completed."),completedAt:a.string().datetime().nullable().describe("ISO 8601 timestamp of when the task was completed, or null."),category:GW.describe("Task category: onboarding (core setup steps) or setup (additional configuration).")}),BW=a.object({projectId:a.string().uuid().optional().describe("Project to list tasks for. Auto-filled from CLI and SDK context when omitted.")}),qW=a.object({tasks:a.array(JW).describe("All onboarding and setup tasks with their current completion status.")}),as=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:BW,output:qW,pagination:"none",async:"sync"})});var Ode,Lde,Fo,Cde,Dde,zde,_de,jde,Nde,xde,Rde,Ude,Mde,Kde,Gde,Jde,Bde,WI,ZI,XI,YI,FI,QI,VI,LQe;var HW=g(()=>{be();Te();Ode=a.object({id:a.string().uuid().describe("Team ID."),name:a.string().describe("Team name, unique among the org's active teams."),description:a.string().nullable().describe("Optional team description."),createdAt:a.string().datetime().describe("When the team was created."),memberCount:a.number().int().nonnegative().describe("Number of active members in the team.")}),Lde=a.object({userId:a.string().min(1).describe("User ID of the team member."),name:a.string().nullable().describe("Display name for the member, when available."),email:a.string().email().describe("Email address for the member."),addedAt:a.string().datetime().describe("When the member was added to the team.")}),Fo=a.string().min(1).optional().describe("Organization to operate on. Auto-filled from CLI and SDK context when omitted."),Cde=a.object({organizationId:Fo}),Dde=a.object({teams:a.array(Ode).describe("Active teams in the organization.")}),zde=a.object({organizationId:Fo,name:a.string().trim().min(1).describe("Team name."),description:a.string().trim().min(1).optional().describe("Optional team description.")}),_de=a.object({id:a.string().uuid().describe("ID of the created team.")}),jde=a.object({organizationId:Fo,teamId:a.string().uuid().describe("Team to update."),name:a.string().trim().min(1).optional().describe("New team name."),description:a.string().trim().min(1).nullable().optional().describe("New team description; null clears it.")}),Nde=a.object({id:a.string().uuid().describe("ID of the updated team.")}),xde=a.object({params:a.object({teamId:a.string().uuid().describe("Team to delete.")}),query:a.object({organizationId:Fo})}).transform(({params:e,query:t})=>({...t,...e})),Rde=a.object({success:a.literal(!0).describe("The team and its memberships were removed.")}),Ude=a.object({organizationId:Fo,teamId:a.string().uuid().describe("Team to add the member to."),userId:a.string().min(1).describe("User ID of an active organization member to add.")}),Mde=a.object({id:a.string().uuid().describe("ID of the team membership.")}),Kde=a.object({params:a.object({teamId:a.string().uuid().describe("Team to remove the member from."),userId:a.string().min(1).describe("User ID of the member to remove.")}),query:a.object({organizationId:Fo})}).transform(({params:e,query:t})=>({...t,...e})),Gde=a.object({success:a.literal(!0).describe("The membership was removed.")}),Jde=a.object({organizationId:Fo,teamId:a.string().uuid().describe("Team to list members for.")}),Bde=a.object({members:a.array(Lde).describe("Active members of the team.")}),WI=S({operationId:"teams.list",description:"List teams in an organization.",backend:"api",route:{method:"GET",path:"/teams",tags:["Teams"]},input:Cde,output:Dde,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}]}}]}),ZI=S({operationId:"teams.create",description:"Create a team in an organization.",backend:"api",route:{method:"POST",path:"/teams",tags:["Teams"],successStatus:201},input:zde,output:_de,pagination:"none",async:"sync"}),XI=S({operationId:"teams.update",description:"Rename a team or update its description.",backend:"api",route:{method:"PATCH",path:"/teams/{teamId}",tags:["Teams"]},input:jde,output:Nde,pagination:"none",async:"sync"}),YI=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:xde,output:Rde,pagination:"none",async:"sync"}),FI=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:Ude,output:Mde,pagination:"none",async:"sync"}),QI=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:Kde,output:Gde,pagination:"none",async:"sync"}),VI=S({operationId:"teams.listMembers",description:"List a team's active members.",backend:"api",route:{method:"GET",path:"/teams/{teamId}/members",tags:["Teams"]},input:Jde,output:Bde,pagination:"none",async:"sync"}),LQe={list:WI.contract,create:ZI.contract,update:XI.contract,delete:YI.contract,addMember:FI.contract,removeMember:QI.contract,listMembers:VI.contract}});var eT;var EW=g(()=>{ED();ZD();Ak();oz();Bk();Ek();Jz();yu();kx();PP();_$();Ng();XH();J$();vE();FE();nW();oW();rW();_I();pW();NI();Ug();xI();jW();HI();EI();HW();iI();eT={me:j$.contract,automations:{list:Lk.contract,get:Ck.contract,create:Dk.contract,update:zk.contract,enable:_k.contract,disable:jk.contract,runs:{list:Nk.contract,get:xk.contract,logs:Rk.contract}},logs:{query:Vr.contract,schema:ei.contract,volume:ti.contract,patterns:ni.contract,nativeQuery:oi.contract,searchNatural:bu.contract},logSources:{listProviders:hu.contract,list:Fr.contract,create:Qr.contract,get:uu.contract,update:gu.contract,delete:du.contract},logStreams:{list:bP.contract,create:mP.contract,get:pP.contract,update:wP.contract,delete:fP.contract,reassign:kP.contract},integrations:{listProviders:XD.contract,listConnections:YD.contract,getConnection:FD.contract,createConnection:QD.contract,beginConnect:VD.contract,getConnectAttempt:ez.contract,disconnectConnection:tz.contract,updateConnectionCredentials:nz.contract},notificationChannels:{getProject:uI.contract},notificationDeliveryRules:{list:wI.contract,options:fI.contract,create:kI.contract,update:vI.contract,delete:PI.contract},mcpConnectors:{listProviders:jg.contract,list:Pi.contract,get:Si.contract,details:$i.contract,search:Ii.contract,describe:Ti.contract,call:Ai.contract},sandboxPresets:{listConnections:xi.contract,listTypes:Xg.contract,upsertPreset:Yg.contract},scripts:{list:MI.contract,get:KI.contract,create:GI.contract,update:JI.contract,delete:BI.contract},logMatchExpressions:{list:Xk.contract,get:Yk.contract,create:Fk.contract,update:Qk.contract,disable:Vk.contract},memory:{put:Li.contract,get:Ci.contract,list:Di.contract,search:zi.contract,delete:_i.contract},onboarding:{getState:$I.contract,skipIntegration:II.contract,skipGithubAppInstallation:TI.contract,skipSampleIssue:AI.contract,finish:OI.contract},organizations:{list:CI.contract,get:DI.contract,create:LI.contract,update:zI.contract},members:{list:N$.contract,updateRole:x$.contract,remove:R$.contract},teams:{list:WI.contract,create:ZI.contract,update:XI.contract,delete:YI.contract,addMember:FI.contract,removeMember:QI.contract,listMembers:VI.contract},publicKeys:{list:Hr.contract,get:Er.contract,ensureLogForwarding:Wr.contract,update:Zr.contract,deactivate:Xr.contract},secretKeys:{list:tu.contract,get:nu.contract,create:ou.contract,update:ru.contract,delete:iu.contract},projects:{list:qg.contract,get:Hg.contract,create:Eg.contract,update:Wg.contract,delete:Zg.contract},search:{threads:Ri.contract,messages:Ui.contract},messages:{list:fE.contract,append:kE.contract},threads:{list:Z$.contract,get:X$.contract,getStatus:Y$.contract,stop:F$.contract,create:Q$.contract,update:V$.contract,fork:eI.contract,setVisibility:tI.contract,createShareLink:nI.contract,listShareLinks:oI.contract,revokeShareLink:rI.contract},runs:{list:B$.contract,listForThread:q$.contract,get:H$.contract,cancel:E$.contract},pullRequests:{list:jI.contract},issues:{count:qh.contract,create:qr.contract,list:Jh.contract,search:Bh.contract,get:Hh.contract,resolve:Eh.contract,ignore:Wh.contract,reopen:Zh.contract,reassignAndReopen:Xh.contract,mute:Yh.contract,unmute:Fh.contract},billing:{getSummary:Uk.contract,getUsage:Mk.contract,listTransactions:Kk.contract},tasks:{list:as.contract},recommendations:{list:is.contract},components:{list:Ph.contract,get:Sh.contract,register:Jr.contract,deregister:$h.contract,rename:Ih.contract,assignTeam:Th.contract,retirementPreview:Ah.contract,retire:Oh.contract,restorationPreview:Lh.contract,restore:Ch.contract,mergePreview:xh.contract,merge:Rh.contract,relationships:{list:Dh.contract,preview:zh.contract,add:_h.contract,remove:jh.contract},incidents:{list:Uh.contract},timeline:Mh.contract}}});var Mi=g(()=>{HC();Ak();EW();Bk();Ek();yu();PP();_$();J$();_I();NI();xI();HI();EI()});var qde="https://api.sazabi.com",Hde="x-sazabi-client-source",ZW=(e)=>{return{streamRun:async(t)=>{return WW({options:e,path:`/runs/${encodeURIComponent(t.runId)}/stream`,cursor:t.cursor,signal:t.signal})},streamThread:async(t)=>{return WW({options:e,path:`/threads/${encodeURIComponent(t.threadId)}/stream`,cursor:t.cursor,signal:t.signal})}}},WW=async(e)=>{let t=e.options.fetch??globalThis.fetch;if(!t)throw Error("Fetch transport is not available in this runtime.");let n=await e.options.credentialProvider.getToken(),r=Ede(e.options.apiBaseUrl,e.path,e.cursor);return Zde({url:r,token:n,clientSource:e.options.clientSource,initialCursor:e.cursor,signal:e.signal,fetch:t})},Ede=(e,t,n)=>{let r=Wde(e??qde),o=new URL(`${r}${t}`);if(n)o.searchParams.set(gk,n);return o.toString()},Wde=(e)=>{let t=e.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},Zde=async(e)=>{let t=[],n=[],r=!1,o=!1,i,c=e.initialCursor,s=new AbortController,l=(k)=>{if(r)return;r=!0,i=k;while(n.length>0)n.shift()?.({value:void 0,done:!0})},h=(k)=>{let T=n.shift();if(T){T({value:k,done:!1});return}t.push(k)},u=(k)=>{if(k.event===yk){let L=Vde(k.data);if(L!==void 0)c=L;return}if(k.data===bk){o=!0,s.abort(),l();return}let T=eye(k.data);if(T)h(T)},d=()=>{o=!0,s.abort(),l()};if(e.signal)if(e.signal.aborted)o=!0,s.abort();else e.signal.addEventListener("abort",d,{once:!0});let y={[Symbol.asyncIterator](){return y},get cursor(){return c},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(r){if(i)throw i;return{value:void 0,done:!0}}return new Promise((k)=>{n.push(k)}).then((k)=>{if(k.done&&i)throw i;return k})},return:async()=>{return o=!0,s.abort(),l(),{value:void 0,done:!0}},throw:async(k)=>{throw o=!0,s.abort(),l(k instanceof Error?k:Error(String(k))),k},close:async()=>{o=!0,s.abort(),l()}};if(o)return l(),y;let b=await e.fetch(e.url,{method:dk,headers:Xde(e.token,e.clientSource),signal:s.signal});if(await Yde(b))l();else Fde(b,u).then(()=>l()).catch((k)=>{if(nye(k)||o||e.signal?.aborted){l();return}l(oye(k))});return y},Xde=(e,t)=>{return{accept:"text/event-stream",authorization:`Bearer ${e}`,...t?{[Hde]:t}:{}}},Yde=async(e)=>{if(e.status===204)return!0;if(e.ok&&e.body)return!1;let t=await tye(e);if(e.status===401)throw Error("Authentication failed. Check your credential.");if(e.status===403)throw Error(`Forbidden (403): ${t||"Credential may not have access to this resource"}`);if(e.status===404)throw Error(`Not found (404): ${t||"Run or thread not found"}`);if(e.status===400)throw Error(`Invalid stream cursor (400): ${t||"The provided cursor was rejected"}`);if(e.status>=400&&e.status<500&&e.status!==429)throw Error(`Client error (${e.status}): ${t}`);if(!e.body)throw Error("Agent stream response did not include a body.");throw Error(e.status===429?`Rate limited (429): ${t}`:`Server error (${e.status}): ${t}`)},Fde=async(e,t)=>{let n=e.body?.getReader();if(!n)throw Error("Agent stream response did not include a body.");let r=new TextDecoder,o="",i=Qde(t);try{while(!0){let c=await n.read();if(c.done)break;o+=r.decode(c.value,{stream:!0});let s=o.split(/\r\n|\r|\n/);o=s.pop()??"";for(let l of s)i.line(l)}if(o+=r.decode(),o)for(let c of o.split(/\r\n|\r|\n/))i.line(c);i.flush()}finally{n.releaseLock()}},Qde=(e)=>{let t="message",n=[],r=()=>{t="message",n=[]},o=()=>{if(n.length===0){r();return}e({event:t,data:n.join(`
|
|
8554
|
+
`)}],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 wq;var fq=g(()=>{ne();wq=D({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 kq;var vq=g(()=>{ne();kq=D({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:nJ,normalizeHeaders:tJ})});var Pq;var Sq=g(()=>{ne();Pq=D({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"}},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 $q;var Iq=g(()=>{ne();$q=D({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 Tq;var Aq=g(()=>{ne();Tq=D({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 Oq;var Lq=g(()=>{ne();Oq=D({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:WG,normalizeHeaders:EG,skill:"the-context-company",setupSkill:"the-context-company-setup"})});var Cq;var Dq=g(()=>{ne();Cq=D({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 zq;var _q=g(()=>{ne();zq=D({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:ZG,normalizeHeaders:HG,skill:"x",setupSkill:"x-setup"})});var jq,Zqe;var Nq=g(()=>{OJ();CJ();zJ();jJ();z$();z$();RJ();MJ();GJ();BJ();HJ();WJ();XJ();FJ();VJ();tB();oB();iB();cB();lB();uB();dB();bB();pB();fB();vB();SB();IB();AB();LB();DB();_B();NB();RB();MB();GB();BB();HB();WB();XB();FB();VB();tq();oq();iq();cq();lq();uq();dq();bq();pq();fq();vq();Sq();Iq();Aq();Lq();Dq();_q();jq=[$q,hB,gB,AJ,LJ,DJ,_J,NJ,xJ,UJ,KJ,JJ,qJ,EJ,YJ,QJ,eB,nB,ZJ,rB,aB,yB,mB,wB,kB,PB,$B,TB,OB,CB,zB,jB,xB,UB,KB,JB,qB,EB,ZB,YB,QB,eq,nq,rq,aq,hq,sq,gq,yq,mq,wq,kq,Pq,Tq,Oq,Cq,zq,sB],Zqe=new Map(jq.map((e)=>[e.id,e]))});var xq=()=>{};var Rq=()=>{};var Uq=()=>{};var Mq=()=>{};var Kq=()=>{};var Gq=()=>{};var Jq=()=>{};var Bq=()=>{};var qq=()=>{};var Hq=()=>{};var Eq=()=>{};var Wq=()=>{};var Zq=()=>{};var Xq=()=>{};var Yq=()=>{};var Fq=()=>{};var Qq=()=>{};var Vq=()=>{};var eH=()=>{};var tH=()=>{};var nH=()=>{};var oH=()=>{};var rH=()=>{};var iH=()=>{};var aH=()=>{};var cH=()=>{};var sH=()=>{};var lH=()=>{};var hH=()=>{};var uH=()=>{};var gH=()=>{};var dH=()=>{};var yH=()=>{};var bH=()=>{};var mH=()=>{};var pH=()=>{};var wH=()=>{};var fH=()=>{};var kH=()=>{};var vH=()=>{};var PH=g(()=>{xq();Rq();Uq();Mq();Kq();Gq();Jq();Bq();qq();Hq();Eq();Wq();Zq();Xq();Yq();Fq();Qq();Vq();eH();tH();nH();oH();rH();iH();aH();cH();sH();lH();hH();uH();gH();dH();yH();bH();mH();pH();wH();fH();kH();vH()});var SH=()=>{};var $H=()=>{};var IH=g(()=>{Hx();wu();UG();PJ();Nq();C$();PH();SH();$H()});var TH,iue,AH,aue,OH,cue,LH,CH,_g,DH,zH,_H,Pi,jH,NH,Si,xH,RH,$i,UH,sue,MH,jg,KH,GH,JH,BH,Ii,qH,HH,Ti,EH,WH,Ai,lue;var _$=g(()=>{IH();be();Te();TH=["configured","authorizing","connected","error"],iue=a.enum(TH),AH=["preset","custom"],aue=a.enum(AH),OH=["streamable-http","sse"],cue=a.enum(OH),LH=["none","headers","oauth","aws-sigv4"],CH=a.enum(LH),_g=a.object({connectionId:a.string().uuid().describe("Connection ID."),connectionKey:a.string().describe("Stable key used to reference this connector in tool calls."),providerId:a.string().describe('Provider identifier, e.g. "linear".'),displayName:a.string().describe("Human-readable connector name."),source:aue.describe("Whether the connector is a built-in preset or a custom server."),installStatus:iue.describe("Current connection lifecycle status."),authMode:CH.describe("Authentication mode."),transport:cue.describe("Transport protocol."),serverUrl:a.string().describe("MCP server URL."),readOnly:a.boolean().describe("Whether the connector is restricted to read-only tools."),management:LP.describe("Lifecycle owner and supported connector mutations."),enabledToolCount:a.number().int().nonnegative().describe("Number of tools enabled and available for this connector."),connectedAt:a.string().datetime().nullable().describe("When the connector last became connected, if ever."),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),DH=a.object({name:a.string().describe("Tool name as invoked."),title:a.string().describe("Human-readable tool title."),description:a.string().describe("Tool description."),isReadOnly:a.boolean().describe("Whether the tool is considered read-only."),enabled:a.boolean().describe("Whether the tool is enabled and available given the connector config.")}),zH=a.object({projectId:a.string().uuid().optional().describe("Project to list connectors for. Auto-filled from SDK context when omitted."),connectedOnly:a.boolean().optional().describe("When true, only return connectors that are connected.")}),_H=a.object({connectors:a.array(_g)}),Pi=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:zH,output:_H,pagination:"none",async:"sync"}),jH=a.object({connectionId:a.string().uuid().describe("Connection ID to fetch."),projectId:a.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),NH=a.object({connector:_g}),Si=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:jH,output:NH,pagination:"none",async:"sync"}),xH=a.object({connectionId:a.string().uuid().describe("Connection ID to inspect."),projectId:a.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),RH=a.object({connector:_g,tools:a.array(DH)}),$i=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:xH,output:RH,pagination:"none",async:"sync"}),UH=a.object({providerId:a.string().describe('Provider identifier, e.g. "linear".'),label:a.string().describe("Human-readable provider name."),authMode:CH.describe("Authentication mode."),availability:a.enum(ri).describe("Whether the provider is enabled or coming soon."),setupSkill:a.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),sue=a.object({}),MH=a.object({providers:a.array(UH)}),jg=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:sue,output:MH,pagination:"none",async:"sync"}),KH=a.object({connectionKey:a.string().describe("Stable key used to call this connector."),displayName:a.string().describe("Human-readable connector name."),providerId:a.string().describe('Provider identifier, e.g. "linear".'),toolCount:a.number().int().nonnegative().describe("Number of executable tools on this connector.")}),GH=a.object({connectionKey:a.string().describe("Connector that exposes this tool."),toolName:a.string().describe("Tool name as invoked."),providerId:a.string().describe('Provider identifier, e.g. "linear".'),displayName:a.string().describe("Human-readable connector name."),isReadOnly:a.boolean().describe("Whether the tool is considered read-only."),description:a.string().describe("Tool description from the stored snapshot."),score:a.number().describe("BM25 rank score. Zero when enumerating a namespace."),inputSchema:a.record(a.string(),a.unknown()).optional().describe("JSON Schema for the tool's arguments, when requested.")}),JH=a.object({projectId:a.string().uuid().optional().describe("Project to search connectors in. Auto-filled from SDK context when omitted."),query:a.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:a.string().min(1).optional().describe("Restrict results to one connectionKey or providerId."),limit:a.coerce.number().int().min(1).max(100).default(10).describe("Maximum number of connectors or tool hits to return."),offset:a.coerce.number().int().min(0).default(0).describe("Number of connectors or tool hits to skip."),includeInputSchema:a.union([a.boolean(),a.stringbool()]).optional().describe("When true, tool hits include inputSchema so a caller can execute without a describe round-trip.")}),BH=a.object({kind:a.enum(["connectors","tools"]).describe("connectors when the query is empty and no namespace is set; tools otherwise."),total:a.number().int().nonnegative().describe("Total matches before limit and offset."),connectors:a.array(KH).describe("Connector index. Empty when kind is tools."),tools:a.array(GH).describe("Ranked or enumerated tool hits. Empty when kind is connectors.")}),Ii=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:JH,output:BH,pagination:"none",async:"sync"}),qH=a.object({projectId:a.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),connectionKey:a.string().min(1).describe("Connector key from search or mcpConnectors.list."),toolName:a.string().min(1).describe("Tool name as invoked.")}),HH=a.object({connectionKey:a.string().describe("Connector that exposes this tool."),toolName:a.string().describe("Tool name as invoked."),providerId:a.string().describe('Provider identifier, e.g. "linear".'),displayName:a.string().describe("Human-readable connector name."),title:a.string().describe("Human-readable tool title."),description:a.string().describe("Tool description from the stored snapshot."),isReadOnly:a.boolean().describe("Whether the tool is considered read-only."),inputSchema:a.record(a.string(),a.unknown()).describe("JSON Schema for the tool's arguments.")}),Ti=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:qH,output:HH,pagination:"none",async:"sync"}),EH=a.object({projectId:a.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted."),connectionKey:a.string().min(1).describe("Connector key from search or mcpConnectors.list."),toolName:a.string().min(1).describe("Tool name as invoked."),arguments:a.record(a.string(),a.unknown()).optional().describe("Arguments matching the tool's input schema.")}),WH=a.discriminatedUnion("ok",[a.object({ok:a.literal(!0),connectionKey:a.string().describe("Connector that ran the tool."),toolName:a.string().describe("Tool name as invoked."),result:a.unknown().describe("Vendor tool result payload."),structuredContent:a.unknown().optional().describe("Structured content from the vendor when present."),content:a.array(a.record(a.string(),a.unknown())).describe("Raw MCP content parts from the vendor."),text:a.string().nullable().describe("Concatenated text content, if any.")}),a.object({ok:a.literal(!1),code:a.enum(["TOOL_NOT_ENABLED","READ_ONLY","MCP_ERROR"]).describe("Why the tool did not run."),message:a.string().describe("Caller-facing error message.")})]),Ai=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:EH,output:WH,pagination:"none",async:"sync"}),lue={list:Pi.contract,get:Si.contract,details:$i.contract,listProviders:jg.contract,search:Ii.contract,describe:Ti.contract,call:Ai.contract}});var Oi,hue,uue,gue,due,yue,bue,mue,j$,kXe;var Ng=g(()=>{be();Te();Oi=a.enum(["admin","member"]),hue=a.object({id:a.string().min(1),name:a.string(),slug:a.string(),logo:a.string().nullable().optional(),role:Oi}),uue=a.object({id:a.string().min(1),name:a.string().nullable(),email:a.string().email()}),gue=a.object({credentialType:a.literal("user"),user:uue,activeOrganizationId:a.string().min(1).nullable(),organizations:a.array(hue).describe("Organizations the user belongs to, including membership role.")}),due=a.object({credentialType:a.literal("secret"),organization:a.object({id:a.string().min(1),name:a.string(),slug:a.string(),logo:a.string().nullable().optional()}),keyName:a.string()}),yue=a.object({credentialType:a.literal("partner"),superorganization:a.object({id:a.string().uuid(),name:a.string()})}),bue=a.object({}),mue=a.discriminatedUnion("credentialType",[gue,due,yue]),j$=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:bue,output:mue,pagination:"none",async:"sync"}),kXe=j$.contract});var ZH,pue,wue,fue,kue,vue,Pue,N$,x$,R$,IXe;var XH=g(()=>{be();Te();Ng();ZH=a.object({membershipId:a.string().min(1).describe("Organization membership record ID."),userId:a.string().min(1).describe("User ID for the organization member."),name:a.string().nullable().describe("Display name for the member, when available."),email:a.string().email().describe("Email address for the member."),imageUrl:a.string().nullable().describe("Profile image URL for the member, when available."),role:Oi.describe("Organization role."),createdAt:a.string().datetime().describe("When the membership was created.")}),pue=a.object({organizationId:a.string().min(1).optional().describe("Organization to list members for. Auto-filled from CLI and SDK context when omitted.")}),wue=a.object({members:a.array(ZH).describe("Members visible within the selected organization.")}),fue=a.object({organizationId:a.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted."),userId:a.string().min(1).describe("User ID of the member to update."),role:Oi.describe("Role to assign.")}),kue=a.object({member:ZH.describe("Updated organization member.")}),vue=a.object({params:a.object({userId:a.string().min(1).describe("User ID of the member to remove.")}),query:a.object({organizationId:a.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted.")})}).transform(({params:e,query:t})=>({...t,...e})),Pue=a.object({removedUserId:a.string().min(1).describe("User ID removed from the organization.")}),N$=S({operationId:"members.list",description:"List members in an organization.",backend:"api",route:{method:"GET",path:"/members",tags:["Members"]},input:pue,output:wue,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"}]}}]}),x$=S({operationId:"members.updateRole",description:"Update a member's organization role.",backend:"api",route:{method:"PATCH",path:"/members/{userId}/role",tags:["Members"]},input:fue,output:kue,pagination:"none",async:"sync",examples:[{name:"promote-member",input:{organizationId:"organization-123",userId:"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"}}}]}),R$=S({operationId:"members.remove",description:"Remove a member from an organization.",backend:"api",route:{method:"DELETE",path:"/members/{userId}",tags:["Members"],inputStructure:"detailed"},input:vue,output:Pue,pagination:"none",async:"sync"}),IXe={list:N$.contract,updateRole:x$.contract,remove:R$.contract}});var FH,QH,xg,VH,Rg,YH=4194304,U$,M$,Sue=(e)=>{let t=e.split(",").map((r)=>r.trim()).filter(Boolean),n=a.array(xg).safeParse(t);if(!n.success)throw Error("Kind filter must be a comma-separated list of note, runbook, or change.");return n.data},Fc,K$,G$,eE,tE,nE,oE,rE,iE,aE,cE,sE,lE,hE,uE,Li,Ci,Di,zi,_i,$ue;var J$=g(()=>{be();Te();FH=["note","runbook"],QH=["note","runbook","change"],xg=a.enum(QH),VH=a.enum(FH),Rg=a.string().min(1).max(512).refine((e)=>!e.startsWith("/"),{message:"Path must be relative without a leading slash."}).describe("Relative memory path, for example AGENTS.md or notes/architecture.md."),U$=a.string().min(1).refine((e)=>new TextEncoder().encode(e).length<=YH,{message:`Memory body must be at most ${YH} bytes (4 MiB).`}).describe("Document body stored in project memory."),M$=a.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."),Fc=a.string().min(1).transform(Sue).describe("Comma-separated kinds, for example note,runbook."),K$=a.object({id:a.string().uuid(),projectId:a.string().uuid(),kind:xg,managed:a.boolean(),path:a.string().nullable(),title:a.string().nullable(),contentHash:a.string(),attrs:a.record(a.string(),a.unknown()),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),G$=K$.extend({body:U$}),eE=a.object({projectId:a.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),path:Rg.describe("Relative path for the curated document."),body:U$,kind:VH.default("note").describe("Curated document kind. Only note and runbook may be written through the API."),title:a.string().max(500).optional().describe("Optional display title. Defaults to the path basename.")}),tE=a.object({document:G$}),nE=a.object({projectId:a.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),id:a.string().uuid().optional().describe("Document id."),path:Rg.optional().describe("Relative curated path.")}).superRefine((e,t)=>{let n=e.id!==void 0,r=e.path!==void 0;if(n===r)t.addIssue({code:"custom",message:"Provide exactly one of id or path."})}),oE=a.object({document:G$}),rE=a.object({projectId:a.string().uuid().optional().describe("Project to list memory for. Auto-filled from CLI and SDK context when omitted."),kind:Fc.optional(),since:M$.optional().describe("Only return documents updated within this window, for example 7d."),service:a.string().min(1).optional().describe("Filter to documents whose attrs.services contains this value."),pathPrefix:a.string().min(1).optional().describe("Filter to paths starting with this prefix."),managed:a.coerce.boolean().optional(),cursor:a.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of documents to return per page.")}),iE=a.object({documents:a.array(K$),nextCursor:a.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),aE=a.object({documentId:a.string().uuid(),kind:xg,managed:a.boolean(),path:a.string().nullable(),title:a.string().nullable(),snippet:a.string(),score:a.number()}),cE=a.object({calibrated:a.literal(!0),minScoreThreshold:a.number(),queryTerms:a.array(a.string()),message:a.string()}),sE=a.object({projectId:a.string().uuid().optional().describe("Project to search memory for. Auto-filled from CLI and SDK context when omitted."),query:a.string().trim().min(1).max(500).describe("Natural-language search query."),kind:Fc.optional(),since:M$.optional(),service:a.string().min(1).optional(),pathPrefix:a.string().min(1).optional(),managed:a.coerce.boolean().optional(),limit:a.coerce.number().int().min(1).max(50).default(10).describe("Maximum ranked search hits to return.")}),lE=a.object({hits:a.array(aE),emptyVerdict:cE.nullable()}),hE=a.object({projectId:a.string().uuid().optional().describe("Project that owns the document. Auto-filled from CLI and SDK context when omitted."),id:a.string().uuid().optional().describe("Document id."),path:Rg.optional()}).superRefine((e,t)=>{let n=e.id!==void 0,r=e.path!==void 0;if(n===r)t.addIssue({code:"custom",message:"Provide exactly one of id or path."})}),uE=a.object({deleted:a.boolean()}),Li=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:eE,output:tE,pagination:"none",async:"sync"}),Ci=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:nE,output:oE,pagination:"none",async:"sync"}),Di=S({operationId:"memory.list",description:"List project memory catalog rows without embedding search.",backend:"api",route:{method:"GET",path:"/memory",tags:["Memory"]},input:rE,output:iE,pagination:"cursor",async:"sync"}),zi=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:sE,output:lE,pagination:"none",async:"sync"}),_i=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:hE,output:uE,pagination:"none",async:"sync"}),$ue={put:Li.contract,get:Ci.contract,list:Di.contract,search:zi.contract,delete:_i.contract}});var gE,dE,Iue,Tue,Aue,Oue,Lue,Qc,Cue,Due,zue,B$,q$,H$,E$,zXe;var Ug=g(()=>{be();Te();gE=a.enum(["processing","completed","aborted","error"]),dE=a.object({id:a.string().uuid(),threadId:a.string().uuid(),userMessageId:a.string().uuid().nullable(),assistantMessageId:a.string().uuid().nullable(),parentRunId:a.string().uuid().nullable(),workflowRunId:a.string().nullable(),status:gE,source:a.enum(["app","api","mcp","slack","teams","linear","github","agent","cli","web","sdk","bitbucket","system"]),createdAt:a.string().datetime(),updatedAt:a.string().datetime(),completedAt:a.string().datetime().nullable()}),Iue=a.object({projectId:a.string().uuid().optional().describe("Project ID to list runs for. Auto-filled from CLI and SDK context when omitted."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:a.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),Tue=a.object({runs:a.array(dE),nextCursor:a.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),Aue=a.object({threadId:a.string().uuid().describe("Thread ID to list runs for."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:a.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),Oue=a.object({runs:a.array(dE),nextCursor:a.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),Lue=a.object({runId:a.string().uuid().describe("Run ID returned by a deferred operation.")}),Qc=a.object({completed:a.boolean().describe("Whether the run has reached a terminal status."),threadId:a.string().uuid().describe("Thread ID associated with the run."),runId:a.string().uuid().describe("Run ID for subsequent polling."),messageId:a.string().uuid().optional().describe("ID of the user message that triggered this run."),status:gE.describe("Current run lifecycle status."),response:a.string().nullable().describe("Assistant response text when the run has completed.")}),Cue=Qc.describe("Current run state and, when complete, the assistant response."),Due=a.object({runId:a.string().uuid().describe("Run ID of the in-flight run to request cancellation for.")}),zue=a.object({success:a.literal(!0).describe("Always true when the cancellation request was accepted.")}),B$=S({operationId:"runs.list",description:"List deferred runs within one project.",backend:"api",route:{method:"GET",path:"/runs",tags:["Runs"]},input:Iue,output:Tue,pagination:"cursor",async:"sync"}),q$=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:Aue,output:Oue,pagination:"cursor",async:"sync"}),H$=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:Lue,output:Cue,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}}]}),E$=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:Due,output:zue,pagination:"none",async:"sync",examples:[{name:"cancel-processing-run",input:{runId:"33333333-3333-4333-8333-333333333333"},output:{success:!0}}]}),zXe={list:B$.contract,listForThread:q$.contract,get:H$.contract,cancel:E$.contract}});var Mg=(e,t,n)=>{let r=t?20000:1e4;if(e.length>r)n.addIssue({code:"too_big",maximum:r,type:"string",inclusive:!0,message:`Message cannot exceed ${r} characters`,origin:"string",path:["message"]})},Kg=(e,t,n)=>{if(e&&!t)n.addIssue({code:"custom",message:"ambientServiceRun requires an automationId",path:["ambientServiceRun"]})};var yE,Vc,_ue,jue,Nue,xue,Rue,Uue,Mue,Kue,Gue,W$,Jue,Bue,que,Hue,Eue,Wue,Zue,Xue,Yue,Fue,Que,Vue,Z$,X$,Y$,F$,Q$,V$,bE,ege,tge,nge,oge,mE,rge,ige,age,cge,sge,lge,Xo="22222222-2222-4222-8222-222222222222",pE="11111111-1111-4111-8111-111111111111",hge="44444444-4444-4444-8444-444444444444",wE="55555555-5555-4555-8555-555555555555",eI,tI,nI,oI,rI,MXe;var iI=g(()=>{be();Te();Ug();yE=a.enum(["slack","teams","linear","github","app","mcp","agent","api","cli","web","sdk","bitbucket","system"]),Vc=a.object({id:a.string().uuid(),projectId:a.string().uuid(),title:a.string().nullable(),status:a.enum(["regular","archived"]),source:yE.nullable(),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),_ue=a.object({type:a.literal("message"),message:a.string()}),jue=a.object({type:a.literal("reasoning"),reasoning:a.string(),status:a.enum(["in_progress","complete"]).optional()}),Nue=a.object({type:a.literal("tool_call"),name:a.string(),params:a.any().optional(),result:a.any().optional(),status:a.enum(["in_progress","success","error","unknown"]).optional(),toolCallId:a.string().optional(),durationMs:a.number().nonnegative().optional()}),xue=a.object({type:a.literal("artifact"),name:a.enum(["timeseries","table","log_detail","integration_required","alert_card","issue_card","mdx"]),data:a.any(),toolCallId:a.string().optional()}),Rue=a.object({type:a.literal("fork"),sourceThreadId:a.string(),sourceMessageId:a.string(),sourceThreadTitle:a.string().nullable()}),Uue=a.object({type:a.literal("summary"),summary:a.string()}),Mue=a.object({type:a.literal("slack_context"),channelId:a.string(),isTruncated:a.boolean().optional(),messages:a.array(a.object({timestamp:a.string(),slackUserId:a.string().optional(),displayName:a.string(),text:a.string(),isBot:a.boolean(),files:a.array(a.object({name:a.string(),mimetype:a.string(),size:a.number().optional(),attachmentId:a.string().uuid().optional(),ingestionStatus:a.enum(["attached","unsupported","oversized","skipped","unavailable"]).optional()})).optional()}))}),Kue=a.object({type:a.literal("teams_context"),conversationId:a.string(),isTruncated:a.boolean().optional(),messages:a.array(a.object({activityId:a.string().optional(),displayName:a.string(),text:a.string(),isBot:a.boolean(),createdDateTime:a.string().optional()}))}),Gue=a.union([_ue,jue,Nue,xue,Rue,Uue,Mue,Kue]),W$=a.object({id:a.string().uuid(),role:a.enum(["user","assistant"]),content:a.array(Gue),source:yE,createdAt:a.string().datetime()}),Jue=a.object({projectId:a.string().uuid().optional().describe("Project to list threads for. Auto-filled from CLI and SDK context when omitted."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of threads to return per page."),cursor:a.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:a.enum(["regular","archived"]).optional().describe("Filter by thread status. 'regular' returns active threads, 'archived' returns archived threads.")}),Bue=a.object({threads:a.array(Vc).describe("The page of threads matching the query."),nextCursor:a.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),que=a.object({threadId:a.string().uuid().describe("Thread ID returned by threads.list or threads.create.")}),Hue=a.object({thread:Vc.describe("The requested thread."),messages:a.array(W$).describe("Messages currently stored on the thread in chronological order.")}),Eue=a.object({projectId:a.string().uuid().optional().describe("Project to create the thread in. Auto-filled from CLI and SDK context when omitted."),message:a.string().min(1,"Message cannot be empty").describe("Initial user message that starts the thread."),wait:a.boolean().default(!0).describe("Whether the server should wait for the agent run before responding."),timeoutSeconds:a.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:a.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:a.literal(!0).optional().describe("Internal marker for scheduler-originated ambient service work. Honored only for system secret-key requests with matching automation context.")}).superRefine((e,t)=>{Mg(e.message,e.automationId,t),Kg(e.ambientServiceRun,e.automationId,t)}),Wue=Qc.describe("Deferred run result for creating a thread."),Zue=a.object({threadId:a.string().uuid().describe("Thread ID whose current processing status should be returned.")}),Xue=a.object({status:a.enum(["idle","processing"]),lastRunStatus:a.enum(["error"]).nullable()}),Yue=a.object({threadId:a.string().uuid().describe("Thread ID whose active run should be stopped.")}),Fue=a.object({success:a.literal(!0).describe("Always true when the stop request was accepted.")}),Que=a.object({threadId:a.string().uuid().describe("Thread ID of the thread to update."),status:a.enum(["regular","archived"]).describe("New status for the thread. 'archived' hides the thread from the sidebar.")}),Vue=a.object({thread:Vc.describe("The updated thread.")}),Z$=S({operationId:"threads.list",description:"List threads in a project, optionally filtered by status.",backend:"api",route:{method:"GET",path:"/threads",tags:["Threads"]},input:Jue,output:Bue,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}}]}),X$=S({operationId:"threads.get",description:"Get a thread and its messages.",backend:"api",route:{method:"GET",path:"/threads/{threadId}",tags:["Threads"]},input:que,output:Hue,pagination:"none",async:"sync"}),Y$=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:Zue,output:Xue,pagination:"none",async:"sync",examples:[{name:"processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{status:"processing",lastRunStatus:null}}]}),F$=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:Yue,output:Fue,pagination:"none",async:"sync",examples:[{name:"stop-processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{success:!0}}]}),Q$=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:Eue,output:Wue,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}}]}),V$=S({operationId:"threads.update",description:"Update a thread's status.",backend:"api",route:{method:"PATCH",path:"/threads/{threadId}",tags:["Threads"]},input:Que,output:Vue,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"}}}]}),bE=a.enum(["private","organization"]),ege=a.object({threadId:a.string().uuid().describe("Thread ID of the source thread to fork."),messageId:a.string().uuid().describe("Message ID in the source thread to fork from. The new thread copies messages up to and including this message.")}),tge=a.object({thread:Vc.describe("The newly created forked thread.")}),nge=a.object({threadId:a.string().uuid().describe("Thread ID of the thread to update."),visibility:bE.describe("New visibility. 'private' restricts the thread to its owner; 'organization' shares it with the organization.")}),oge=a.object({thread:Vc.describe("The updated thread."),visibility:bE.describe("The thread's resulting visibility.")}),mE=a.object({shareId:a.string().uuid().describe("Unique identifier for the snapshot."),threadId:a.string().uuid().describe("Thread the snapshot was taken from."),url:a.string().describe("Public read-only URL for the snapshot."),createdAt:a.string().datetime()}),rge=a.object({threadId:a.string().uuid().describe("Thread ID to create a public read-only snapshot for.")}),ige=a.object({share:mE.describe("The created share link.")}),age=a.object({threadId:a.string().uuid().describe("Thread ID the snapshot belongs to."),shareId:a.string().uuid().describe("Snapshot ID to revoke.")}),cge=a.void(),sge=a.object({threadId:a.string().uuid().describe("Thread ID to list public snapshots for.")}),lge=a.object({shares:a.array(mE).describe("Active share links for the thread.")}),eI=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:ege,output:tge,pagination:"none",async:"sync",examples:[{name:"fork-from-message",input:{threadId:Xo,messageId:hge},output:{thread:{id:"66666666-6666-4666-8666-666666666666",projectId:pE,title:"API returning 500s (fork)",status:"regular",source:"api",createdAt:"2026-01-01T00:20:00.000Z",updatedAt:"2026-01-01T00:20:00.000Z"}}}]}),tI=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:nge,output:oge,pagination:"none",async:"sync",examples:[{name:"make-private",input:{threadId:Xo,visibility:"private"},output:{thread:{id:Xo,projectId:pE,title:"API returning 500s",status:"regular",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:30:00.000Z"},visibility:"private"}}]}),nI=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:rge,output:ige,pagination:"none",async:"sync",examples:[{name:"create-share-link",input:{threadId:Xo},output:{share:{shareId:wE,threadId:Xo,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}}}]}),oI=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:sge,output:lge,pagination:"none",async:"sync",examples:[{name:"list-share-links",input:{threadId:Xo},output:{shares:[{shareId:wE,threadId:Xo,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}]}}]}),rI=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:age,output:cge,pagination:"none",async:"sync"}),MXe={list:Z$.contract,get:X$.contract,getStatus:Y$.contract,stop:F$.contract,create:Q$.contract,update:V$.contract,fork:eI.contract,setVisibility:tI.contract,createShareLink:nI.contract,listShareLinks:oI.contract,revokeShareLink:rI.contract}});var uge,gge,dge,yge,fE,kE;var vE=g(()=>{be();Te();Ug();iI();uge=a.object({threadId:a.string().uuid().describe("Thread ID to list messages for."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of messages to return per page."),cursor:a.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),gge=a.object({messages:a.array(W$),nextCursor:a.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),dge=a.object({threadId:a.string().uuid().describe("Thread ID to append the message to."),message:a.string().min(1,"Message cannot be empty").describe("Message body to append to the thread."),wait:a.boolean().default(!0).describe("Whether the server should wait for the appended message run before responding."),timeoutSeconds:a.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:a.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:a.literal(!0).optional().describe("Internal marker for scheduler-originated ambient service work. Honored only for system secret-key requests with matching automation context.")}).superRefine((e,t)=>{Mg(e.message,e.automationId,t),Kg(e.ambientServiceRun,e.automationId,t)}),yge=Qc.describe("Deferred run result for appending a message to an existing thread."),fE=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:uge,output:gge,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}}]}),kE=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:dge,output:yge,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 xt,SE,aI,ji,cI,Gg,po,$E,PE;var es=g(()=>{be();xt={IN_APP:"in_app",SLACK:"slack",SLACK_CHANNEL:"slack_channel",TEAMS_CHANNEL:"teams_channel",EMAIL:"email",SMS:"sms",INCIDENT_IO:"incident_io",PAGERDUTY:"pagerduty",ROOTLY:"rootly",WEBHOOK:"webhook"},SE=[xt.IN_APP,xt.SLACK,xt.EMAIL,xt.SMS],aI=[xt.SLACK_CHANNEL,xt.TEAMS_CHANNEL,xt.INCIDENT_IO,xt.PAGERDUTY,xt.ROOTLY,xt.WEBHOOK],ji=Object.values(xt),cI=[...ji,"victorops"],Gg=a.enum(ji),po=a.enum(aI),$E=[{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"}],PE=new Set($E.map(({channel:e})=>e));if(PE.size!==ji.length||ji.some((e)=>!PE.has(e)))throw Error("Notification channel definitions must represent every channel")});var IE,bge=(e,t)=>e.value===t.value&&e.label===t.label&&e.scope===t.scope&&e.role===t.role&&e.defaultOff===t.defaultOff&&(e.deliveryConditions??[]).join(",")===(t.deliveryConditions??[]).join(","),ft=(e)=>{for(let t of Object.values(e)){let n=IE.get(t.value);if(n&&!bge(n,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}`);IE.set(t.value,t)}return e};var Gn=g(()=>{IE=new Map});var TE;var AE=g(()=>{Gn();TE=ft({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 OE;var LE=g(()=>{Gn();OE=ft({BILLING_PLAN_UPGRADE_APPLIED:{value:"billing_plan_upgrade_applied",label:"Billing upgrade applied",scope:"org",role:"admin"},BILLING_PLAN_DOWNGRADE_SCHEDULED:{value:"billing_plan_downgrade_scheduled",label:"Billing downgrade scheduled",scope:"org",role:"admin"},BILLING_PLAN_DOWNGRADE_APPLIED:{value:"billing_plan_downgrade_applied",label:"Billing downgrade applied",scope:"org",role:"admin"},BILLING_CREDIT_BALANCE_LOW:{value:"billing_credit_balance_low",label:"Billing credits low",scope:"org",role:"admin"},BILLING_CREDIT_BALANCE_DEPLETED:{value:"billing_credit_balance_depleted",label:"Billing credits depleted",scope:"org",role:"admin"},BILLING_AUTO_TOP_UP_SETTINGS_CHANGED:{value:"billing_auto_top_up_settings_changed",label:"Billing auto top-up changed",scope:"org",role:"admin"},BILLING_AUTO_TOP_UP_FAILED:{value:"billing_auto_top_up_failed",label:"Billing auto top-up failed",scope:"org",role:"admin"},BILLING_INVOICE_PAID:{value:"billing_invoice_paid",label:"Billing invoice paid",scope:"org",role:"admin"},BILLING_NEGATIVE_BALANCE_COLLECTED:{value:"billing_negative_balance_collected",label:"Billing outstanding balance charged",scope:"org",role:"admin"},BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED:{value:"billing_negative_balance_collection_failed",label:"Billing outstanding balance charge failed",scope:"org",role:"admin"}})});var CE;var DE=g(()=>{Gn();CE=ft({INTEGRATION_CONNECTED:{value:"integration_connected",label:"Integration connected",scope:"org",defaultOff:!0},INTEGRATION_DISCONNECTED:{value:"integration_disconnected",label:"Integration disconnected",scope:"org"}})});var zE;var _E=g(()=>{Gn();zE=ft({ISSUE_TRIGGERED:{value:"issue_triggered",label:"Issue triggered",scope:"project",deliveryConditions:["component","severity"]},ISSUE_RESOLVED:{value:"issue_resolved",label:"Issue resolved",scope:"project",deliveryConditions:["component","severity"]},ISSUE_IGNORED:{value:"issue_ignored",label:"Issue ignored",scope:"project",deliveryConditions:["component","severity"]}})});var jE;var NE=g(()=>{Gn();jE=ft({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 xE;var RE=g(()=>{Gn();xE=ft({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 UE;var ME=g(()=>{Gn();UE=ft({SECURITY_ALERT:{value:"security_alert",label:"Security alert",scope:"org",role:"admin"}})});var sI,at,pge,lI=(e)=>{let t=pge.get(e)?.label;if(t)return t;let n=e.replace(/_/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):e};var ts=g(()=>{AE();LE();DE();_E();NE();RE();ME();Gn();sI={...UE,...jE,...CE,...TE,...zE,...xE,...OE},at=Object.fromEntries(Object.entries(sI).map(([e,t])=>[e,t.value])),pge=new Map(Object.values(sI).map((e)=>[e.value,e]))});var Jg,GE,kYe,$n,vYe;var Yo=g(()=>{ts();es();es();Jg=Object.values(at),GE=[at.BILLING_PLAN_UPGRADE_APPLIED,at.BILLING_PLAN_DOWNGRADE_SCHEDULED,at.BILLING_PLAN_DOWNGRADE_APPLIED,at.BILLING_CREDIT_BALANCE_LOW,at.BILLING_CREDIT_BALANCE_DEPLETED,at.BILLING_AUTO_TOP_UP_SETTINGS_CHANGED,at.BILLING_AUTO_TOP_UP_FAILED,at.BILLING_INVOICE_PAID,at.BILLING_NEGATIVE_BALANCE_COLLECTED,at.BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED],kYe=new Set(GE),$n=[at.ISSUE_TRIGGERED,at.ISSUE_RESOLVED,at.ISSUE_IGNORED,at.AUTOMATION_RUN_FAILED],vYe=new Set($n)});var ns,JE,BE=(e)=>typeof e==="string"&&(e in JE)?JE[e]:e,fge;var qE=g(()=>{es();be();Yo();ns=a.enum(Jg),JE={data_source_connected:"log_source_connected",data_source_disconnected:"log_source_disconnected"},fge=a.preprocess(BE,ns)});var kge;var HE=g(()=>{ts();Yo();kge=$n.map((e)=>({notificationType:e,label:lI(e)}))});var EE=g(()=>{ts();Yo()});var WE=g(()=>{es();ts();Yo();qE();HE();EE()});var ZE=()=>{};var XE=g(()=>{Yo()});var YE=g(()=>{Yo()});var hI=g(()=>{ZE();XE();YE();WE()});var Sge,$ge,Ige,Tge,Age,Oge,Lge,uI,RFe;var FE=g(()=>{hI();be();Te();Sge=a.enum(["ready","missing","degraded","unavailable"]),$ge=a.object({id:a.string(),label:a.string(),status:a.enum(["active","inactive","degraded"]),statusLabel:a.string()}),Ige=a.object({channel:Gg,name:a.string(),description:a.string(),scope:a.enum(["personal","project"]),enabled:a.boolean().nullable(),preferenceId:a.string().nullable(),prerequisite:a.object({status:Sge,statusLabel:a.string(),message:a.string()}),action:a.object({label:a.string(),href:a.string()}).nullable(),destinations:a.array($ge),destinationManagement:a.enum(["none","slack_channels","teams_channels","integration_connections","webhook_endpoints"]),canCreateDestinations:a.boolean(),supportedNotificationTypes:a.array(ns)}),Tge=a.object({channel:po,enabled:a.boolean(),preferenceId:a.string().nullable()}),Age=a.object({channel:po,notificationType:ns,enabled:a.boolean(),preferenceId:a.string()}),Oge=a.object({projectId:a.string().uuid().optional().describe("Project to inspect. Auto-filled from CLI and SDK context when omitted.")}),Lge=a.object({channelCards:a.array(Ige).length(10),channels:a.array(Tge),notificationTypePreferences:a.array(Age),issueNotificationMinSeverity:a.enum(["low","medium","high","critical"])}),uI=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:Oge,output:Lge,pagination:"none",async:"sync"}),RFe={getProject:uI.contract}});var QE,dI,VE,yI,JFe,BFe,bI,mI=(e,t)=>{if((e.componentIds?.length||e.componentId)&&"componentIds"in e.condition&&e.condition.componentIds?.length)t.addIssue({code:"custom",path:["condition","componentIds"],message:"Use componentIds instead of legacy condition.componentIds."});if(e.componentIds?.length&&e.componentId)t.addIssue({code:"custom",path:["componentId"],message:"Use componentIds instead of componentId."})},qFe,eW,gI,pI,os,tW,Cge,Dge,zge,_ge,jge,Nge,xge,Rge,Uge,wI,fI,kI,vI,PI,HFe;var nW=g(()=>{hI();be();Te();QE=a.enum(["low","medium","high","critical"]),dI=a.object({severities:a.array(QE).min(1).optional()}).strict(),VE=a.object({componentIds:a.array(a.string().uuid()).min(1).optional(),severities:a.array(QE).min(1).optional()}).strict(),yI=a.object({channel:po,destinationKey:a.string().min(1)}),JFe=a.object({destinations:a.array(yI).min(1),notificationTypes:a.array(a.enum($n)).min(1),componentIds:a.array(a.string().uuid()).min(1).optional().describe("Stable component registry IDs matched by this rule."),includeDescendants:a.boolean().default(!1).describe("Whether the rule also matches descendant components."),condition:dI}),BFe=a.object({destinations:a.array(yI).min(1),notificationTypes:a.array(a.enum($n)).min(1),condition:VE}),bI=a.object({destinations:a.array(yI).min(1),notificationTypes:a.array(a.enum($n)).min(1),componentIds:a.array(a.string().uuid()).min(1).optional().describe("Stable component registry IDs matched by this rule."),componentId:a.string().uuid().optional().describe("Deprecated single-component compatibility input."),includeDescendants:a.boolean().default(!1).describe("Whether the rule also matches descendant components."),condition:a.union([dI,VE])}),qFe=bI.superRefine(mI),eW=a.object({id:a.string(),channel:po,destinationKey:a.string(),displayName:a.string()}),gI=a.object({id:a.string().uuid(),label:a.string(),lifecycle:a.enum(["active","retired","merged"])}),pI=a.object({id:a.string().uuid(),projectId:a.string().uuid(),notificationTypes:a.array(a.enum($n)),destinations:a.array(eW),condition:dI,component:gI.nullable(),componentId:a.string().uuid().nullable(),includeDescendants:a.boolean(),suspendedAt:a.string().datetime().nullable(),suspensionReason:a.string().nullable(),components:a.array(gI),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),os=a.object({projectId:a.string().uuid().optional().describe("Project whose notification delivery rules are being managed.")}),tW=a.string().uuid().describe("Logical notification delivery rule ID."),Cge=os,Dge=a.object({rules:a.array(pI)}),zge=a.object({destinations:a.array(eW),notificationTypes:a.array(a.object({notificationType:a.enum($n),label:a.string(),conditions:a.array(a.enum(["component","severity"]))})),components:a.array(gI)}),_ge=os.extend(bI.shape).superRefine(mI),jge=pI,Nge=os.extend({...bI.shape,ruleId:tW}).superRefine(mI),xge=pI,Rge=os.extend({ruleId:tW}),Uge=a.object({removed:a.boolean()}),wI=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:Cge,output:Dge,pagination:"none",async:"sync"}),fI=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:os,output:zge,pagination:"none",async:"sync"}),kI=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:_ge,output:jge,pagination:"none",async:"sync"}),vI=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:Nge,output:xge,pagination:"none",async:"sync"}),PI=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:Rge,output:Uge,pagination:"none",async:"sync"}),HFe={list:wI.contract,options:fI.contract,create:kI.contract,update:vI.contract,delete:PI.contract}});var SI,Mge,Kge,Gge,Jge,Bge,qge,$I,Hge,Ege,II,Wge,Zge,TI,Xge,Yge,AI,Fge,Qge,OI,XFe;var oW=g(()=>{be();Te();SI=a.enum(["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"]),Mge=a.enum(["needs-onboarding","blocked","ready"]),Kge=a.enum(["incomplete","complete","skipped"]),Gge=a.object({invitationId:a.string(),organizationId:a.string(),organizationName:a.string(),organizationSlug:a.string(),organizationImageUrl:a.string().nullable(),inviterName:a.string().nullable()}),Jge=a.object({gate:Mge,canonicalStep:SI.nullable(),organizationId:a.string().nullable(),projectId:a.string().nullable(),completionByStep:a.record(SI,Kge),githubSkipped:a.boolean(),githubAppSkipped:a.boolean(),slackSkipped:a.boolean(),sampleIssueId:a.string().nullable(),actorRole:a.enum(["admin","member"]).nullable(),requiredStep:a.union([SI,a.literal("select-organization")]).nullable(),isCompleted:a.boolean(),onboardingRecommendationsThreadId:a.string().nullable(),hasOrganizations:a.boolean(),hasPaidBillingSubscription:a.boolean(),billingStepEnabled:a.boolean(),pendingInvitations:a.array(Gge)}),Bge=a.object({}),qge=a.object({onboarding:Jge}),$I=S({operationId:"onboarding.getState",description:"Read onboarding progress for the authenticated user.",backend:"api",route:{method:"GET",path:"/onboarding/state",tags:["Onboarding"]},input:Bge,output:qge,pagination:"none",async:"sync"}),Hge=a.object({integration:a.enum(["github","slack"]).describe("Integration onboarding step to skip.")}),Ege=a.object({skipped:a.literal(!0)}),II=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:Hge,output:Ege,pagination:"none",async:"sync"}),Wge=a.object({}),Zge=a.object({skipped:a.literal(!0)}),TI=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:Wge,output:Zge,pagination:"none",async:"sync"}),Xge=a.object({}),Yge=a.object({skipped:a.literal(!0)}),AI=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:Xge,output:Yge,pagination:"none",async:"sync"}),Fge=a.object({projectId:a.string().uuid().describe("Project that completed onboarding.")}),Qge=a.object({completed:a.boolean()}),OI=S({operationId:"onboarding.finish",description:"Mark onboarding complete when all prerequisites are satisfied.",backend:"api",route:{method:"POST",path:"/onboarding/finish",tags:["Onboarding"]},input:Fge,output:Qge,pagination:"none",async:"sync"}),XFe={getState:$I.contract,skipIntegration:II.contract,skipGithubAppInstallation:TI.contract,skipSampleIssue:AI.contract,finish:OI.contract}});var Bg,Vge,ede,tde,nde,ode,rde,ide,ade,cde,sde,LI,CI,DI,zI,eQe;var rW=g(()=>{be();Te();Ng();Bg=a.object({id:a.string().min(1),name:a.string(),slug:a.string(),logo:a.string().nullable().optional()}),Vge=Bg.extend({role:Oi.optional()}),ede=a.object({}),tde=a.object({organizations:a.array(Vge).describe("Organizations available to the current credential.")}),nde=a.object({organizationId:a.string().min(1).describe("Organization ID to fetch.")}),ode=a.object({organization:Bg}),rde=a.object({organizationId:a.string().min(1).describe("Organization ID to update. SDK and CLI callers can auto-fill this before dispatch."),name:a.string().trim().min(1).max(100).describe("New organization name.")}),ide=a.object({organization:Bg.describe("Updated organization.")}),ade=a.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"),cde=a.object({name:ade.describe("Organization display name.")}),sde=a.object({organization:Bg}),LI=S({operationId:"organizations.create",description:"Create an organization for the authenticated user.",backend:"api",route:{method:"POST",path:"/organizations",tags:["Organizations"],successStatus:201},input:cde,output:sde,pagination:"none",async:"sync"}),CI=S({operationId:"organizations.list",description:"List organizations available to the current credential.",backend:"api",route:{method:"GET",path:"/organizations",tags:["Organizations"]},input:ede,output:tde,pagination:"none",async:"sync"}),DI=S({operationId:"organizations.get",description:"Get one organization by ID.",backend:"api",route:{method:"GET",path:"/organizations/{organizationId}",tags:["Organizations"]},input:nde,output:ode,pagination:"none",async:"sync"}),zI=S({operationId:"organizations.update",description:"Update one organization.",backend:"api",route:{method:"PATCH",path:"/organizations/{organizationId}",tags:["Organizations"]},input:rde,output:ide,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}}}]}),eQe={list:CI.contract,get:DI.contract,create:LI.contract,update:zI.contract}});var Ni,rs,iW,aW,cW,sW,lW,hW,uW,qg,Hg,Eg,gW,dW,Wg,yW,bW,Zg,lde;var _I=g(()=>{be();Te();Ni=a.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"]),rs=a.object({id:a.string().uuid(),organizationId:a.string().min(1),name:a.string(),region:Ni}),iW=a.object({organizationId:a.string().min(1).optional().describe("Organization to list projects for. Auto-filled from CLI and SDK context when omitted.")}),aW=a.object({projects:a.array(rs).describe("Projects visible within the selected organization.")}),cW=a.object({projectId:a.string().uuid().describe("Project ID to fetch.")}),sW=a.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"),lW=a.object({organizationId:a.string().min(1).optional().describe("Organization to create the project under. Auto-filled from CLI and SDK context when omitted."),name:sW.describe("Project name."),region:Ni.optional().default("us-west-2").describe("AWS region where the new project should be created.")}),hW=a.object({project:rs}),uW=a.object({project:rs}),qg=S({operationId:"projects.list",description:"List projects in an organization.",backend:"api",route:{method:"GET",path:"/projects",tags:["Projects"]},input:iW,output:aW,pagination:"none",async:"sync"}),Hg=S({operationId:"projects.get",description:"Get one project by ID.",backend:"api",route:{method:"GET",path:"/projects/{projectId}",tags:["Projects"]},input:cW,output:uW,pagination:"none",async:"sync"}),Eg=S({operationId:"projects.create",description:"Create one project in an organization.",backend:"api",route:{method:"POST",path:"/projects",successStatus:201,tags:["Projects"]},input:lW,output:hW,pagination:"none",async:"sync"}),gW=a.object({projectId:a.string().uuid().describe("Project ID to update."),name:sW.optional().describe("New project name.")}),dW=a.object({project:rs}),Wg=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:gW,output:dW,pagination:"none",async:"sync"}),yW=a.object({projectId:a.string().uuid().describe("Project ID to delete.")}),bW=a.void(),Zg=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:yW,output:bW,pagination:"none",async:"sync"}),lde={list:qg.contract,get:Hg.contract,create:Eg.contract,update:Wg.contract,delete:Zg.contract}});var mW,hde,ude,gde,dde,yde,jI,cQe;var pW=g(()=>{be();Te();mW=a.enum(["open","merged","closed"]),hde=a.enum(["review_required","approved","changes_requested"]),ude=a.enum(["passing","failing","pending"]),gde=a.object({id:a.string().uuid(),projectId:a.string().uuid(),repositoryFullName:a.string(),pullRequestId:a.string().describe("Provider-native pull request identifier (GitHub PR number or Bitbucket PR id), serialized as a string."),githubPullRequestId:a.number().int().describe("Deprecated: use pullRequestId. Numeric form of the provider-native pull request identifier; kept for backward compatibility."),title:a.string().nullable(),url:a.string().nullable(),status:mW.nullable(),reviewState:hde.nullable(),checksState:ude.nullable(),requestedByUserId:a.string().nullable(),authorLogin:a.string().nullable().describe("Forge login that authored the pull request (often the Sazabi app identity)."),githubAuthorLogin:a.string().nullable().describe("Deprecated: use authorLogin. Kept for backward compatibility."),threadId:a.string().uuid().nullable(),runId:a.string().uuid().nullable(),createdAt:a.string().datetime(),mergedAt:a.string().datetime().nullable(),closedAt:a.string().datetime().nullable()}),dde=a.object({projectId:a.string().uuid().optional().describe("Project to list pull requests for. Auto-filled from CLI and SDK context when omitted."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of pull requests to return per page."),cursor:a.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:mW.optional().describe("Filter by pull request status (open, merged, or closed)."),repositoryFullName:a.string().trim().optional().describe("Filter by repository full name, for example owner/repo. Case-insensitive."),requestedByUserId:a.string().trim().optional().describe("Filter by the Sazabi user who requested the pull request. Pass 'me' to filter to the authenticated user.")}),yde=a.object({pullRequests:a.array(gde),nextCursor:a.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),jI=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:dde,output:yde,pagination:"cursor",async:"sync"}),cQe={list:jI.contract}});var wW,fW,kW,vW,PW,is;var NI=g(()=>{be();Te();wW=a.enum(["data_source","mcp_connector","sandbox_cli","integration"]),fW=a.enum(["connected","recommended"]),kW=a.object({kind:wW.describe("What the recommendation targets: a data source, MCP connector, sandbox CLI, or integration."),targetId:a.string().describe("Exact catalog id for the kind (data source type, MCP provider id, sandbox CLI preset type, or integration provider id)."),status:fW.describe("Resolved live against current connections: connected (already set up) or recommended (suggested, not yet connected)."),roiScore:a.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:a.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.")}),vW=a.object({projectId:a.string().uuid().optional().describe("Project to list recommendations for. Auto-filled from CLI and SDK context when omitted.")}),PW=a.object({recommendations:a.array(kW).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).")}),is=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:vW,output:PW,pagination:"none",async:"sync"})});var SW,bde,$W,Xg,IW,TW,AW,OW,xi,LW,CW,DW,Yg,mde;var xI=g(()=>{be();Te();SW=a.object({type:a.string().describe("Preset type identifier."),label:a.string().describe("Human-readable display name."),executableNames:a.array(a.string()).describe("CLI binary names installed by this preset."),envVarKeys:a.array(a.string()).describe("Environment variables required for authentication."),setupSkill:a.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),bde=a.object({}),$W=a.object({types:a.array(SW)}),Xg=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:bde,output:$W,pagination:"none",async:"sync"}),IW=a.enum(["github_app","bitbucket_integration","personal_access_token","stored_credentials"]),TW=a.object({presetType:a.string().describe("Preset type identifier."),credentialSource:IW.describe("Authoritative credential source for the preset."),isSystemManaged:a.boolean().describe("Whether the connection follows an integration lifecycle."),fallbackConfigured:a.boolean().describe("Whether user-provided fallback credentials are stored for this preset."),envVarKeys:a.array(a.string()).describe("Stored environment variable names. Secret values are omitted.")}),AW=a.object({projectId:a.string().uuid().optional().describe("Project to inspect. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted.")}),OW=a.object({connections:a.array(TW)}),xi=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:AW,output:OW,pagination:"none",async:"sync"}),LW=a.object({key:a.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:a.string().max(10240).describe("Secret value. Encrypted at rest; never returned by any API response.")}),CW=a.object({projectId:a.string().uuid().optional().describe("Project to configure. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:a.string().min(1).describe("Preset type identifier (e.g. kubectl, aws, github)."),environmentVariables:a.array(LW).max(100).describe("Full set of env vars for this preset. Replaces any previously stored values for the preset.")}),DW=a.object({projectId:a.string().uuid().describe("Project the preset was written to."),presetType:a.string().describe("Preset type that was upserted."),envVarKeys:a.array(a.string()).describe("Env var key names now stored for this preset. Values are never returned.")}),Yg=S({operationId:"sandboxPresets.upsertPreset",summary:"Upsert CLI Connection",description:"Set or replace a project's sandbox CLI connection environment variables (e.g. the kubectl CLI's KUBECONFIG_CONTENTS). Values are encrypted server-side and never returned. Requires a secret key scoped to the target project's organization.",backend:"api",route:{method:"POST",path:"/sandbox-presets/config",successStatus:200,tags:["Sandbox Presets"]},input:CW,output:DW,pagination:"none",async:"sync"}),mde={listConnections:xi.contract,listTypes:Xg.contract,upsertPreset:Yg.contract}});var Fg,zW=1048576,RI,_W,UI,pde,wde,fde,kde,vde,Pde,Sde,$de,Ide,Tde,MI,KI,GI,JI,BI,pQe;var jW=g(()=>{be();Te();Fg=a.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."),RI=a.string().min(1).refine((e)=>new TextEncoder().encode(e).length<=zW,{message:`Script content must be at most ${zW} bytes (1 MiB).`}).describe("Bash script body materialized as /home/sazabi/scripts/<name>.sh in the sandbox."),_W=a.object({id:a.string().uuid(),projectId:a.string().uuid(),name:a.string(),description:a.string().nullable(),contentHash:a.string().describe("sha256 hex digest of the script content."),createdAt:a.string().datetime(),updatedAt:a.string().datetime()}),UI=_W.extend({content:RI}),pde=a.object({projectId:a.string().uuid().optional().describe("Project to list scripts for. Auto-filled from CLI and SDK context when omitted."),search:a.string().optional().describe("Case-insensitive partial match on script name."),cursor:a.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:a.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of scripts to return per page.")}),wde=a.object({scripts:a.array(_W),nextCursor:a.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),fde=a.object({name:Fg.describe("Script name to fetch."),projectId:a.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),kde=a.object({script:UI}),vde=a.object({projectId:a.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),name:Fg.describe("Script name. Must be unique within the project among non-deleted scripts."),content:RI,description:a.string().max(500).nullable().optional().describe("Optional human-readable description.")}),Pde=a.object({script:UI}),Sde=a.object({name:Fg.describe("Script to update."),projectId:a.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),content:RI.optional().describe("New script body. Omit to leave content unchanged."),description:a.string().max(500).nullable().optional().describe("New description, or null to clear it. Omit to leave unchanged.")}),$de=a.object({script:UI}),Ide=a.object({name:Fg.describe("Script to delete."),projectId:a.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),Tde=a.object({deleted:a.boolean()}),MI=S({operationId:"scripts.list",description:"List durable bash scripts stored for a project.",backend:"api",route:{method:"GET",path:"/scripts",tags:["Scripts"]},input:pde,output:wde,pagination:"cursor",async:"sync"}),KI=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:fde,output:kde,pagination:"none",async:"sync"}),GI=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:vde,output:Pde,pagination:"none",async:"sync"}),JI=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:Sde,output:$de,pagination:"none",async:"sync"}),BI=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:Ide,output:Tde,pagination:"none",async:"sync"}),pQe={list:MI.contract,get:KI.contract,create:GI.contract,update:JI.contract,delete:BI.contract}});var qI,NW,xW,RW,UW,Ri,Ui,Ade;var HI=g(()=>{be();Te();qI=a.object({projectId:a.string().uuid().optional().describe("Project to search within. Auto-filled from CLI and SDK context when omitted."),query:a.string().trim().min(1,"Query must be at least 1 character").max(500,"Query must be at most 500 characters"),limit:a.coerce.number().min(1).max(100).default(20).describe("Maximum number of search results to return."),page:a.coerce.number().min(1).default(1).describe("One-based page number.")}),NW=qI.extend({status:a.enum(["regular","archived"]).optional().describe("Optional thread status filter.")}),xW=qI.extend({threadId:a.string().uuid().optional().describe("Optional thread restriction for message search."),role:a.enum(["user","assistant"]).optional().describe("Optional message role filter.")}),RW=a.object({threads:a.array(a.object({id:a.string().uuid(),projectId:a.string().uuid().optional(),title:a.string(),status:a.enum(["regular","archived"]),labels:a.array(a.string()),createdAt:a.string().datetime(),updatedAt:a.string().datetime(),highlights:a.array(a.string()),score:a.number().optional()})),pagination:a.object({page:a.number(),limit:a.number(),totalResults:a.number(),totalPages:a.number()}).describe("Page-based pagination metadata for the current search result.")}),UW=a.object({messages:a.array(a.object({id:a.string().uuid(),threadId:a.string().uuid(),threadTitle:a.string(),role:a.enum(["user","assistant"]),content:a.string(),createdAt:a.string().datetime(),updatedAt:a.string().datetime(),highlights:a.array(a.string()),score:a.number().optional()})),pagination:a.object({page:a.number(),limit:a.number(),totalResults:a.number(),totalPages:a.number()}).describe("Page-based pagination metadata for the current search result.")}),Ri=S({operationId:"search.threads",description:"Search threads within one project.",backend:"api",route:{method:"GET",path:"/search/threads",tags:["Search"]},input:NW,output:RW,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}}}]}),Ui=S({operationId:"search.messages",description:"Search messages within one project.",backend:"api",route:{method:"GET",path:"/search/messages",tags:["Search"]},input:xW,output:UW,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}}}]}),Ade={threads:Ri.contract,messages:Ui.contract}});var MW;var KW=g(()=>{MW=["onboarding","setup"]});var GW,JW,BW,qW,as;var EI=g(()=>{KW();be();Te();GW=a.enum(MW),JW=a.object({id:a.string().describe("Unique task identifier (e.g. install_github_app)."),label:a.string().describe("Short human-readable task name."),description:a.string().describe("Explanation of what needs to be completed to satisfy this task."),instructions:a.string().describe("Step-by-step instructions for completing this task."),completed:a.boolean().describe("Whether the task has been completed."),completedAt:a.string().datetime().nullable().describe("ISO 8601 timestamp of when the task was completed, or null."),category:GW.describe("Task category: onboarding (core setup steps) or setup (additional configuration).")}),BW=a.object({projectId:a.string().uuid().optional().describe("Project to list tasks for. Auto-filled from CLI and SDK context when omitted.")}),qW=a.object({tasks:a.array(JW).describe("All onboarding and setup tasks with their current completion status.")}),as=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:BW,output:qW,pagination:"none",async:"sync"})});var Ode,Lde,Fo,Cde,Dde,zde,_de,jde,Nde,xde,Rde,Ude,Mde,Kde,Gde,Jde,Bde,WI,ZI,XI,YI,FI,QI,VI,LQe;var HW=g(()=>{be();Te();Ode=a.object({id:a.string().uuid().describe("Team ID."),name:a.string().describe("Team name, unique among the org's active teams."),description:a.string().nullable().describe("Optional team description."),createdAt:a.string().datetime().describe("When the team was created."),memberCount:a.number().int().nonnegative().describe("Number of active members in the team.")}),Lde=a.object({userId:a.string().min(1).describe("User ID of the team member."),name:a.string().nullable().describe("Display name for the member, when available."),email:a.string().email().describe("Email address for the member."),addedAt:a.string().datetime().describe("When the member was added to the team.")}),Fo=a.string().min(1).optional().describe("Organization to operate on. Auto-filled from CLI and SDK context when omitted."),Cde=a.object({organizationId:Fo}),Dde=a.object({teams:a.array(Ode).describe("Active teams in the organization.")}),zde=a.object({organizationId:Fo,name:a.string().trim().min(1).describe("Team name."),description:a.string().trim().min(1).optional().describe("Optional team description.")}),_de=a.object({id:a.string().uuid().describe("ID of the created team.")}),jde=a.object({organizationId:Fo,teamId:a.string().uuid().describe("Team to update."),name:a.string().trim().min(1).optional().describe("New team name."),description:a.string().trim().min(1).nullable().optional().describe("New team description; null clears it.")}),Nde=a.object({id:a.string().uuid().describe("ID of the updated team.")}),xde=a.object({params:a.object({teamId:a.string().uuid().describe("Team to delete.")}),query:a.object({organizationId:Fo})}).transform(({params:e,query:t})=>({...t,...e})),Rde=a.object({success:a.literal(!0).describe("The team and its memberships were removed.")}),Ude=a.object({organizationId:Fo,teamId:a.string().uuid().describe("Team to add the member to."),userId:a.string().min(1).describe("User ID of an active organization member to add.")}),Mde=a.object({id:a.string().uuid().describe("ID of the team membership.")}),Kde=a.object({params:a.object({teamId:a.string().uuid().describe("Team to remove the member from."),userId:a.string().min(1).describe("User ID of the member to remove.")}),query:a.object({organizationId:Fo})}).transform(({params:e,query:t})=>({...t,...e})),Gde=a.object({success:a.literal(!0).describe("The membership was removed.")}),Jde=a.object({organizationId:Fo,teamId:a.string().uuid().describe("Team to list members for.")}),Bde=a.object({members:a.array(Lde).describe("Active members of the team.")}),WI=S({operationId:"teams.list",description:"List teams in an organization.",backend:"api",route:{method:"GET",path:"/teams",tags:["Teams"]},input:Cde,output:Dde,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}]}}]}),ZI=S({operationId:"teams.create",description:"Create a team in an organization.",backend:"api",route:{method:"POST",path:"/teams",tags:["Teams"],successStatus:201},input:zde,output:_de,pagination:"none",async:"sync"}),XI=S({operationId:"teams.update",description:"Rename a team or update its description.",backend:"api",route:{method:"PATCH",path:"/teams/{teamId}",tags:["Teams"]},input:jde,output:Nde,pagination:"none",async:"sync"}),YI=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:xde,output:Rde,pagination:"none",async:"sync"}),FI=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:Ude,output:Mde,pagination:"none",async:"sync"}),QI=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:Kde,output:Gde,pagination:"none",async:"sync"}),VI=S({operationId:"teams.listMembers",description:"List a team's active members.",backend:"api",route:{method:"GET",path:"/teams/{teamId}/members",tags:["Teams"]},input:Jde,output:Bde,pagination:"none",async:"sync"}),LQe={list:WI.contract,create:ZI.contract,update:XI.contract,delete:YI.contract,addMember:FI.contract,removeMember:QI.contract,listMembers:VI.contract}});var eT;var EW=g(()=>{ED();ZD();Ak();oz();Bk();Ek();Jz();yu();kx();PP();_$();Ng();XH();J$();vE();FE();nW();oW();rW();_I();pW();NI();Ug();xI();jW();HI();EI();HW();iI();eT={me:j$.contract,automations:{list:Lk.contract,get:Ck.contract,create:Dk.contract,update:zk.contract,enable:_k.contract,disable:jk.contract,runs:{list:Nk.contract,get:xk.contract,logs:Rk.contract}},logs:{query:Vr.contract,schema:ei.contract,volume:ti.contract,patterns:ni.contract,nativeQuery:oi.contract,searchNatural:bu.contract},logSources:{listProviders:hu.contract,list:Fr.contract,create:Qr.contract,get:uu.contract,update:gu.contract,delete:du.contract},logStreams:{list:bP.contract,create:mP.contract,get:pP.contract,update:wP.contract,delete:fP.contract,reassign:kP.contract},integrations:{listProviders:XD.contract,listConnections:YD.contract,getConnection:FD.contract,createConnection:QD.contract,beginConnect:VD.contract,getConnectAttempt:ez.contract,disconnectConnection:tz.contract,updateConnectionCredentials:nz.contract},notificationChannels:{getProject:uI.contract},notificationDeliveryRules:{list:wI.contract,options:fI.contract,create:kI.contract,update:vI.contract,delete:PI.contract},mcpConnectors:{listProviders:jg.contract,list:Pi.contract,get:Si.contract,details:$i.contract,search:Ii.contract,describe:Ti.contract,call:Ai.contract},sandboxPresets:{listConnections:xi.contract,listTypes:Xg.contract,upsertPreset:Yg.contract},scripts:{list:MI.contract,get:KI.contract,create:GI.contract,update:JI.contract,delete:BI.contract},logMatchExpressions:{list:Xk.contract,get:Yk.contract,create:Fk.contract,update:Qk.contract,disable:Vk.contract},memory:{put:Li.contract,get:Ci.contract,list:Di.contract,search:zi.contract,delete:_i.contract},onboarding:{getState:$I.contract,skipIntegration:II.contract,skipGithubAppInstallation:TI.contract,skipSampleIssue:AI.contract,finish:OI.contract},organizations:{list:CI.contract,get:DI.contract,create:LI.contract,update:zI.contract},members:{list:N$.contract,updateRole:x$.contract,remove:R$.contract},teams:{list:WI.contract,create:ZI.contract,update:XI.contract,delete:YI.contract,addMember:FI.contract,removeMember:QI.contract,listMembers:VI.contract},publicKeys:{list:Hr.contract,get:Er.contract,ensureLogForwarding:Wr.contract,update:Zr.contract,deactivate:Xr.contract},secretKeys:{list:tu.contract,get:nu.contract,create:ou.contract,update:ru.contract,delete:iu.contract},projects:{list:qg.contract,get:Hg.contract,create:Eg.contract,update:Wg.contract,delete:Zg.contract},search:{threads:Ri.contract,messages:Ui.contract},messages:{list:fE.contract,append:kE.contract},threads:{list:Z$.contract,get:X$.contract,getStatus:Y$.contract,stop:F$.contract,create:Q$.contract,update:V$.contract,fork:eI.contract,setVisibility:tI.contract,createShareLink:nI.contract,listShareLinks:oI.contract,revokeShareLink:rI.contract},runs:{list:B$.contract,listForThread:q$.contract,get:H$.contract,cancel:E$.contract},pullRequests:{list:jI.contract},issues:{count:qh.contract,create:qr.contract,list:Jh.contract,search:Bh.contract,get:Hh.contract,resolve:Eh.contract,ignore:Wh.contract,reopen:Zh.contract,reassignAndReopen:Xh.contract,mute:Yh.contract,unmute:Fh.contract},billing:{getSummary:Uk.contract,getUsage:Mk.contract,listTransactions:Kk.contract},tasks:{list:as.contract},recommendations:{list:is.contract},components:{list:Ph.contract,get:Sh.contract,register:Jr.contract,deregister:$h.contract,rename:Ih.contract,assignTeam:Th.contract,retirementPreview:Ah.contract,retire:Oh.contract,restorationPreview:Lh.contract,restore:Ch.contract,mergePreview:xh.contract,merge:Rh.contract,relationships:{list:Dh.contract,preview:zh.contract,add:_h.contract,remove:jh.contract},incidents:{list:Uh.contract},timeline:Mh.contract}}});var Mi=g(()=>{HC();Ak();EW();Bk();Ek();yu();PP();_$();J$();_I();NI();xI();HI();EI()});var qde="https://api.sazabi.com",Hde="x-sazabi-client-source",ZW=(e)=>{return{streamRun:async(t)=>{return WW({options:e,path:`/runs/${encodeURIComponent(t.runId)}/stream`,cursor:t.cursor,signal:t.signal})},streamThread:async(t)=>{return WW({options:e,path:`/threads/${encodeURIComponent(t.threadId)}/stream`,cursor:t.cursor,signal:t.signal})}}},WW=async(e)=>{let t=e.options.fetch??globalThis.fetch;if(!t)throw Error("Fetch transport is not available in this runtime.");let n=await e.options.credentialProvider.getToken(),r=Ede(e.options.apiBaseUrl,e.path,e.cursor);return Zde({url:r,token:n,clientSource:e.options.clientSource,initialCursor:e.cursor,signal:e.signal,fetch:t})},Ede=(e,t,n)=>{let r=Wde(e??qde),o=new URL(`${r}${t}`);if(n)o.searchParams.set(gk,n);return o.toString()},Wde=(e)=>{let t=e.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},Zde=async(e)=>{let t=[],n=[],r=!1,o=!1,i,c=e.initialCursor,s=new AbortController,l=(k)=>{if(r)return;r=!0,i=k;while(n.length>0)n.shift()?.({value:void 0,done:!0})},h=(k)=>{let T=n.shift();if(T){T({value:k,done:!1});return}t.push(k)},u=(k)=>{if(k.event===yk){let L=Vde(k.data);if(L!==void 0)c=L;return}if(k.data===bk){o=!0,s.abort(),l();return}let T=eye(k.data);if(T)h(T)},d=()=>{o=!0,s.abort(),l()};if(e.signal)if(e.signal.aborted)o=!0,s.abort();else e.signal.addEventListener("abort",d,{once:!0});let y={[Symbol.asyncIterator](){return y},get cursor(){return c},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(r){if(i)throw i;return{value:void 0,done:!0}}return new Promise((k)=>{n.push(k)}).then((k)=>{if(k.done&&i)throw i;return k})},return:async()=>{return o=!0,s.abort(),l(),{value:void 0,done:!0}},throw:async(k)=>{throw o=!0,s.abort(),l(k instanceof Error?k:Error(String(k))),k},close:async()=>{o=!0,s.abort(),l()}};if(o)return l(),y;let b=await e.fetch(e.url,{method:dk,headers:Xde(e.token,e.clientSource),signal:s.signal});if(await Yde(b))l();else Fde(b,u).then(()=>l()).catch((k)=>{if(nye(k)||o||e.signal?.aborted){l();return}l(oye(k))});return y},Xde=(e,t)=>{return{accept:"text/event-stream",authorization:`Bearer ${e}`,...t?{[Hde]:t}:{}}},Yde=async(e)=>{if(e.status===204)return!0;if(e.ok&&e.body)return!1;let t=await tye(e);if(e.status===401)throw Error("Authentication failed. Check your credential.");if(e.status===403)throw Error(`Forbidden (403): ${t||"Credential may not have access to this resource"}`);if(e.status===404)throw Error(`Not found (404): ${t||"Run or thread not found"}`);if(e.status===400)throw Error(`Invalid stream cursor (400): ${t||"The provided cursor was rejected"}`);if(e.status>=400&&e.status<500&&e.status!==429)throw Error(`Client error (${e.status}): ${t}`);if(!e.body)throw Error("Agent stream response did not include a body.");throw Error(e.status===429?`Rate limited (429): ${t}`:`Server error (${e.status}): ${t}`)},Fde=async(e,t)=>{let n=e.body?.getReader();if(!n)throw Error("Agent stream response did not include a body.");let r=new TextDecoder,o="",i=Qde(t);try{while(!0){let c=await n.read();if(c.done)break;o+=r.decode(c.value,{stream:!0});let s=o.split(/\r\n|\r|\n/);o=s.pop()??"";for(let l of s)i.line(l)}if(o+=r.decode(),o)for(let c of o.split(/\r\n|\r|\n/))i.line(c);i.flush()}finally{n.releaseLock()}},Qde=(e)=>{let t="message",n=[],r=()=>{t="message",n=[]},o=()=>{if(n.length===0){r();return}e({event:t,data:n.join(`
|
|
8555
8555
|
`)}),r()};return{line:(i)=>{if(i===""){o();return}if(i.startsWith(":"))return;let c=i.indexOf(":"),s=c===-1?i:i.slice(0,c),l=c===-1?"":i.slice(c+1),h=l.startsWith(" ")?l.slice(1):l;if(s==="event"){t=h||"message";return}if(s==="data")n.push(h)},flush:o}},Vde=(e)=>{try{let t=uk.safeParse(JSON.parse(e));return t.success?t.data.streamNextOffset:void 0}catch{return}},eye=(e)=>{try{let t=hk.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}},tye=async(e)=>{try{return await e.text()}catch{return""}},nye=(e)=>{return e instanceof Error&&e.name==="AbortError"},oye=(e)=>{return e instanceof Error?e:Error(String(e))};var XW=g(()=>{Mi()});var tT,nT,oT,YW;var FW=g(()=>{be();tT=a.object({severities:a.array(a.string()).optional().describe("Limit results to the listed severities."),services:a.array(a.string()).optional().describe("Limit results to the listed service names."),environments:a.array(a.string()).optional().describe("Limit results to the listed deployment environments."),searchTerm:a.string().optional().describe("Case-insensitive substring match against the log body."),traceId:a.string().optional().describe("Limit results to one trace ID."),attributes:a.record(a.string(),a.string()).optional().describe("Limit results to logs whose attributes contain every listed key with an exactly equal value.")}),nT=a.object({service:a.string(),namespace:a.string(),environment:a.string(),host:a.string(),container:a.string(),pod:a.string()}),oT=a.object({id:a.string(),timestamp:a.string().datetime(),severity:a.string(),body:a.string(),service:a.string(),traceId:a.string(),spanId:a.string(),attributes:a.record(a.string(),a.string()),resource:nT}),YW=a.object({type:a.literal("logs"),timestamp:a.string().datetime(),data:a.array(oT)})});var rye="https://{region}.intake.sazabi.com",iye="https://{region}.tail.sazabi.com",eZ=500,aye=5000,tZ="sazabi.public_key",cye="x-sazabi-internal-log-forwarding-secret",sye="x-sazabi-internal-log-forwarding-source",lye=(e)=>{return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e},nZ=(e)=>{let t=lye(e);return t==="localhost"||t==="127.0.0.1"||t==="::1"},hye,uye,gye,oZ=(e)=>{let t=new Map;return{tail:async(n)=>{let r=await $ye(e.credentialProvider,n.projectId,"logs.tail"),o=await Iye(e,t,r,n.region,"logs.tail"),i=bye({projectId:r,region:o,filters:n.filters,apiBaseUrl:e.apiBaseUrl,tailBaseUrl:e.tailBaseUrl}),c=await e.credentialProvider.getToken(),s=e.fetch??globalThis.fetch;if(!s)throw Error("Fetch transport is not available in this runtime.");return Aye({token:c,url:i,signal:n.signal,fetch:s})},forward:async(n)=>{let r=await Tye(e,t,n.projectId??await e.credentialProvider.getProjectId?.(),n.region,"logs.forward"),o=fye(r,e.intakeBaseUrl),i=e.fetch??globalThis.fetch,c=vye(n.logs,n.publicKey),s=Nye(c);return await jye(i,o,c,Sye(n.sazabiInternalForwarding)),{forwardedCount:s,failedCount:0}}}},dye="3010",yye,bye=(e)=>{let t=(e.tailBaseUrl??mye({region:e.region,apiBaseUrl:e.apiBaseUrl})).replace("{region}",e.region),n=pye(t);n.searchParams.set("projectId",e.projectId);let r=wye(e.filters);if(r)n.searchParams.set("filters",r);return n.toString()},mye=(e)=>{if(e.apiBaseUrl)try{let t=new URL(e.apiBaseUrl).hostname;if(t.endsWith(".sazabi.dev")){let n=t.includes(".staging.")?"staging.sazabi.dev":"development.sazabi.dev";return`https://${e.region}.tail.${n}`}}catch{}return iye.replace("{region}",e.region)},pye=(e)=>{let t=(()=>{try{return new URL(e)}catch{return null}})();if(!t)throw Error(`Invalid tail base URL: ${e}`);if(nZ(t.hostname)){if(t.protocol="http:",!t.port||yye.has(t.port))t.port=dye;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},wye=(e)=>{if(!e)return;let t=Object.entries(e).filter(([,n])=>n!==void 0&&(!Array.isArray(n)||n.length>0)&&(typeof n!=="object"||Array.isArray(n)||n===null||Object.keys(n).length>0)&&n!=="");if(t.length===0)return;return JSON.stringify(Object.fromEntries(t))},fye=(e,t)=>{let n=(t??rye).replace("{region}",e),r=n.endsWith("/")?n.slice(0,-1):n,o=kye(r);if(o)return o;let i=r.match(/^https:\/\/([a-z0-9-]+)\.intake\.([a-z0-9.]+)$/);return`${i?`https://otlp.${i[1]}.intake.${i[2]}`:r}/v1/logs`},kye=(e)=>{let t=(()=>{try{return new URL(e)}catch{return null}})();if(!t)return;if(!nZ(t.hostname))return;return t.pathname="/adapters/otlp",t.toString()},vye=(e,t)=>{let n=e.resourceLogs;if(!n||n.length===0)return{...e,resourceLogs:[{resource:{attributes:[rZ(t)]},scopeLogs:[]}]};return{...e,resourceLogs:n.map((r)=>({...r,resource:{...r.resource,attributes:Pye(r.resource?.attributes,t)}}))}},Pye=(e,t)=>{return[...(e??[]).filter((r)=>r?.key!==tZ),rZ(t)]},rZ=(e)=>({key:tZ,value:{stringValue:e}}),Sye=(e)=>{if(!e?.secret)return{};return{[cye]:e.secret,...e.source?{[sye]:e.source}:{}}},$ye=async(e,t,n)=>{let r=t??await e.getProjectId?.();if(r)return r;throw cZ(n,"Project ID is required",["projectId"])},Iye=async(e,t,n,r,o)=>{return r??await iZ(e,t,n)},Tye=async(e,t,n,r,o)=>{if(r)return r;if(!n)throw cZ(o,"Project ID is required",["projectId"]);return iZ(e,t,n)},iZ=async(e,t,n)=>{let r=t.get(n);if(r)return r;let o=e.raw.projects.get({projectId:n}).then((i)=>i.project.region);t.set(n,o);try{return await o}catch(i){throw t.delete(n),i}},Aye=async(e)=>{let t=[],n=[],r=!1,o=!1,i,c=0,s,l,h=(T)=>{if(r)return;r=!0,i=T;while(n.length>0){let L=n.shift();if(L)L({value:void 0,done:!0})}},u=(T)=>{let L=n.shift();if(L){L({value:T,done:!1});return}t.push(T)},d=()=>{l?.abort()},y=(T)=>{if(T.event!=="log"){if(T.id)s=T.id;return}let L=zye(T.data);for(let K of L)u(K);if(T.id)s=T.id},b=async(T)=>{let L=!1;while(!r&&!o){let K=new AbortController,R=()=>K.abort();l=K;let F=!1;e.signal?.addEventListener("abort",R,{once:!0});try{let G=await e.fetch(Oye(e.url,s),{method:"GET",headers:{accept:"text/event-stream",authorization:`Bearer ${e.token}`},signal:K.signal});await Lye(G),c=0,L=!0,T(),await Cye(G,y),F=!0}catch(G){if(VW(G)||e.signal?.aborted)break;let fe=QW(G);if(!L||_ye(fe))throw fe;F=!0}finally{if(e.signal?.removeEventListener("abort",R),l===K)l=void 0}if(r||o||e.signal?.aborted)break;if(!F)continue;c+=1,await aZ(Math.min(eZ*2**(c-1),aye),e.signal)}};if(e.signal?.addEventListener("abort",()=>{o=!0,d(),h()},{once:!0}),e.signal?.aborted)o=!0,d(),h();await new Promise((T,L)=>{let K=!1;b(()=>{if(!K)K=!0,T()}).catch((F)=>{let G=QW(F);if(!K){K=!0,L(G);return}if(!VW(F))h(G)})});let k={[Symbol.asyncIterator](){return k},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(r){if(i)throw i;return{value:void 0,done:!0}}return new Promise((T)=>{n.push(T)}).then((T)=>{if(T.done&&i)throw i;return T})},return:async()=>{return o=!0,d(),h(),{value:void 0,done:!0}},throw:async(T)=>{throw o=!0,d(),h(T instanceof Error?T:Error(String(T))),T}};return k},Oye=(e,t)=>{if(!t)return e;let n=new URL(e);return n.searchParams.set("cursor",t),n.toString()},Lye=async(e)=>{if(e.ok&&e.body)return;let t=await e.text();if(e.status===401)throw Error("Authentication failed. Check your credential.");if(e.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(e.status>=400&&e.status<500&&e.status!==429)throw Error(`Client error (${e.status}): ${t}`);if(!e.body)throw Error("Tail stream response did not include a body.");throw Error(e.status===429?`Rate limited (429): ${t}`:`Server error (${e.status}): ${t}`)},Cye=async(e,t)=>{let n=e.body?.getReader();if(!n)throw Error("Tail stream response did not include a body.");let r=new TextDecoder,o="",i=Dye(t);try{while(!0){let c=await n.read();if(c.done)break;o+=r.decode(c.value,{stream:!0});let s=o.split(/\r\n|\r|\n/);o=s.pop()??"";for(let l of s)i.line(l)}if(o+=r.decode(),o){let c=o.split(/\r\n|\r|\n/);for(let s of c)i.line(s)}i.flush()}finally{n.releaseLock()}},Dye=(e)=>{let t="message",n,r=[],o=()=>{t="message",n=void 0,r=[]},i=()=>{if(r.length===0&&!n){o();return}e({event:t,data:r.join(`
|
|
8556
8556
|
`),...n?{id:n}:{}}),o()};return{line:(c)=>{if(c===""){i();return}if(c.startsWith(":"))return;let s=c.indexOf(":"),l=s===-1?c:c.slice(0,s),h=s===-1?"":c.slice(s+1),u=h.startsWith(" ")?h.slice(1):h;if(l==="event"){t=u||"message";return}if(l==="data"){r.push(u);return}if(l==="id"&&!u.includes("\x00"))n=u},flush:i}},zye=(e)=>{try{let t=YW.safeParse(JSON.parse(e));if(!t.success)return[];return t.data.data}catch{return[]}},QW=(e)=>{return e instanceof Error?e:Error(String(e))},VW=(e)=>{return e instanceof Error&&e.name==="AbortError"},_ye=(e)=>{return e.message.startsWith("Authentication failed")||e.message.startsWith("Forbidden (")||e.message.startsWith("Wrong region (")||e.message.startsWith("Client error (")},jye=async(e,t,n,r={},o=3,i=1e4)=>{let c;for(let s=0;s<=o;s+=1){let l=new AbortController,h=globalThis.setTimeout(()=>l.abort(),i);try{let u=await e(t,{method:"POST",headers:{"content-type":"application/json",...r},body:JSON.stringify(n),signal:l.signal});if(u.ok)return;let d=await u.text();if(u.status===401||u.status===403)throw Error("Authentication failed. Check your public key.");if(u.status>=400&&u.status<500&&u.status!==429)throw Error(`Client error (${u.status}): ${d}`);c=Error(u.status===429?`Rate limited (429): ${d}`:`Server error (${u.status}): ${d}`)}catch(u){let d=u instanceof Error?u.message:String(u);if(d.startsWith("Authentication failed")||d.startsWith("Client error ("))throw u instanceof Error?u:Error(d);c=u instanceof Error&&u.name==="AbortError"?Error("Request timed out"):u instanceof Error?u:Error(String(u))}finally{globalThis.clearTimeout(h)}if(s<o)await aZ(eZ*2**s)}throw Error(`Failed after ${o+1} attempts: ${c?.message??"Unknown error"}`)},Nye=(e)=>{return e.resourceLogs?.reduce((t,n)=>t+(n.scopeLogs?.reduce((r,o)=>r+(o.logRecords?.length??0),0)??0),0)??0},aZ=async(e,t)=>{if(t?.aborted)return;await new Promise((n)=>{let r=globalThis.setTimeout(n,e);t?.addEventListener("abort",()=>{globalThis.clearTimeout(r),n()},{once:!0})})},cZ=(e,t,n)=>{return new Qe("BAD_REQUEST",{message:t,data:{operationId:e,missingContext:n}})};var rT=g(()=>{hr();FW();be();hye=a.object({projectId:a.string().uuid().optional().describe("Project to tail logs for. Auto-filled from CLI and SDK context when omitted."),filters:tT.optional().describe("Optional filters applied by the tail SSE service.")}),uye=a.object({publicKey:a.string().min(1).describe("Public key for intake auth. Create or list one via the public key endpoints."),logs:a.custom((e)=>typeof e==="object"&&e!==null).describe("OTLP logs export request payload to send to the intake service.")}),gye=a.object({forwardedCount:a.number().int().nonnegative().describe("Number of log records accepted by the intake request."),failedCount:a.number().int().nonnegative().describe("Number of log records rejected by the intake request.")}),yye=new Set(["15006","3010"])});var iT="https://api.sazabi.com",lZ="https://api.platform.sazabi.com",hZ="sazabi-cli",xye="urn:ietf:params:oauth:grant-type:device_code",uZ=(e)=>{let t=Vd(new gy(eT,{url:Rye(e.apiBaseUrl??iT),headers:async()=>{let o=new Headers({authorization:`Bearer ${await e.credentialProvider.getToken()}`});if(e.clientSource)o.set("x-sazabi-client-source",e.clientSource);return o},fetch:e.fetch,customErrorResponseBodyDecoder:(o,i)=>{let c=qye(o);if(!c)return null;return new Qe(c.code,{message:c.message,status:i.status,data:{operationId:c.operationId,missingContext:c.missingContext}})}})),n=oZ({raw:t,credentialProvider:e.credentialProvider,fetch:e.fetch,apiBaseUrl:e.apiBaseUrl??iT,intakeBaseUrl:e.intakeBaseUrl,tailBaseUrl:e.tailBaseUrl}),r=ZW({credentialProvider:e.credentialProvider,fetch:e.fetch,apiBaseUrl:e.apiBaseUrl??iT,clientSource:e.clientSource});return{raw:t,me:async()=>t.me({}),automations:{list:async(o={})=>t.automations.list(await Q(e.credentialProvider,o,"automations.list")),get:async(o)=>t.automations.get(await Q(e.credentialProvider,o,"automations.get")),create:async(o)=>t.automations.create(await Q(e.credentialProvider,o,"automations.create")),update:async(o)=>t.automations.update(await Q(e.credentialProvider,o,"automations.update")),enable:async(o)=>t.automations.enable(await Q(e.credentialProvider,o,"automations.enable")),disable:async(o)=>t.automations.disable(await Q(e.credentialProvider,o,"automations.disable")),runs:{list:async(o)=>t.automations.runs.list(await Q(e.credentialProvider,o,"automations.runs.list")),get:async(o)=>t.automations.runs.get(await Q(e.credentialProvider,o,"automations.runs.get")),logs:async(o)=>t.automations.runs.logs(await Q(e.credentialProvider,o,"automations.runs.logs"))}},logs:{...n,query:async(o={})=>t.logs.query(await Q(e.credentialProvider,o,Vr.operationId)),schema:async(o={})=>t.logs.schema(await Q(e.credentialProvider,o,ei.operationId)),volume:async(o)=>t.logs.volume(await Q(e.credentialProvider,o,ti.operationId)),patterns:async(o={})=>t.logs.patterns(await Q(e.credentialProvider,o,ni.operationId)),nativeQuery:async(o)=>t.logs.nativeQuery(await Q(e.credentialProvider,o,oi.operationId))},organizations:{list:async()=>t.organizations.list({}),get:async(o)=>t.organizations.get(o),update:async(o)=>t.organizations.update(await Mye(e.credentialProvider,o))},members:{list:async(o={})=>t.members.list(await Ue(e.credentialProvider,o)),updateRole:async(o)=>t.members.updateRole(await Ue(e.credentialProvider,o)),remove:async(o)=>{let i=await Ue(e.credentialProvider,o);return t.members.remove({params:{userId:i.userId},query:{organizationId:i.organizationId}})}},teams:{list:async(o={})=>t.teams.list(await Ue(e.credentialProvider,o)),create:async(o)=>t.teams.create(await Ue(e.credentialProvider,o)),update:async(o)=>t.teams.update(await Ue(e.credentialProvider,o)),delete:async(o)=>{let i=await Ue(e.credentialProvider,o);return t.teams.delete({params:{teamId:i.teamId},query:{organizationId:i.organizationId}})},addMember:async(o)=>t.teams.addMember(await Ue(e.credentialProvider,o)),removeMember:async(o)=>{let i=await Ue(e.credentialProvider,o);return t.teams.removeMember({params:{teamId:i.teamId,userId:i.userId},query:{organizationId:i.organizationId}})},listMembers:async(o)=>t.teams.listMembers(await Ue(e.credentialProvider,o))},publicKeys:{list:async(o={})=>t.publicKeys.list(await Q(e.credentialProvider,o,Hr.operationId)),get:async(o)=>t.publicKeys.get(await Q(e.credentialProvider,o,Er.operationId)),ensureLogForwarding:async(o={})=>t.publicKeys.ensureLogForwarding(await Q(e.credentialProvider,o,Wr.operationId)),update:async(o)=>t.publicKeys.update(await Q(e.credentialProvider,o,Zr.operationId)),deactivate:async(o)=>{let i=await Q(e.credentialProvider,o,Xr.operationId);return t.publicKeys.deactivate({params:{keyId:i.keyId},query:{projectId:i.projectId}})}},secretKeys:{list:async(o={})=>t.secretKeys.list(o),get:async(o)=>t.secretKeys.get(o),create:async(o)=>t.secretKeys.create(o),update:async(o)=>t.secretKeys.update(o),delete:async(o)=>{await t.secretKeys.delete({params:{keyId:o.keyId}})}},search:{threads:async(o)=>t.search.threads(await Q(e.credentialProvider,o,Ri.operationId)),messages:async(o)=>t.search.messages(await Q(e.credentialProvider,o,Ui.operationId))},projects:{list:async(o={})=>t.projects.list(await Uye(e.credentialProvider,o)),get:async(o)=>t.projects.get(o),create:async(o)=>t.projects.create(await Ue(e.credentialProvider,o))},messages:{list:async(o)=>t.messages.list(o),append:async(o)=>sZ(t,await t.messages.append(Bye(o)))},threads:{list:async(o={})=>t.threads.list(await Kye(e.credentialProvider,o)),get:async(o)=>t.threads.get(o),getStatus:async(o)=>t.threads.getStatus(o),stop:async(o)=>t.threads.stop(o),create:async(o)=>sZ(t,await t.threads.create(await Jye(e.credentialProvider,o))),update:async(o)=>t.threads.update(o),fork:async(o)=>t.threads.fork(o),setVisibility:async(o)=>t.threads.setVisibility(o),createShareLink:async(o)=>t.threads.createShareLink(o),listShareLinks:async(o)=>t.threads.listShareLinks(o),revokeShareLink:async(o)=>t.threads.revokeShareLink(o),stream:async(o)=>r.streamThread(o)},runs:{list:async(o={})=>t.runs.list(await Gye(e.credentialProvider,o)),listForThread:async(o)=>t.runs.listForThread(o),get:async(o)=>t.runs.get(o),cancel:async(o)=>t.runs.cancel(o),stream:async(o)=>r.streamRun(o)},logSources:{listProviders:async()=>t.logSources.listProviders({}),list:async(o={})=>t.logSources.list(await Q(e.credentialProvider,o,Fr.operationId)),get:async(o)=>t.logSources.get(o),create:async(o)=>t.logSources.create(await Q(e.credentialProvider,o,Qr.operationId)),update:async(o)=>t.logSources.update(o),delete:async(o)=>t.logSources.delete(o)},logStreams:{list:async(o)=>t.logStreams.list(o),get:async(o)=>t.logStreams.get(o),create:async(o)=>t.logStreams.create(o),update:async(o)=>t.logStreams.update(o),delete:async(o)=>t.logStreams.delete(o),reassign:async(o)=>t.logStreams.reassign(o)},integrations:{listProviders:async(o={})=>t.integrations.listProviders(await Ue(e.credentialProvider,o)),listConnections:async(o={})=>t.integrations.listConnections(await Ue(e.credentialProvider,o)),getConnection:async(o)=>t.integrations.getConnection(await Ue(e.credentialProvider,o)),createConnection:async(o)=>t.integrations.createConnection(await Ue(e.credentialProvider,o)),beginConnect:async(o)=>t.integrations.beginConnect(await Ue(e.credentialProvider,o)),getConnectAttempt:async(o)=>t.integrations.getConnectAttempt(await Ue(e.credentialProvider,o)),disconnectConnection:async(o)=>t.integrations.disconnectConnection(await Ue(e.credentialProvider,o)),updateConnectionCredentials:async(o)=>t.integrations.updateConnectionCredentials(await Ue(e.credentialProvider,o))},mcpConnectors:{list:async(o={})=>t.mcpConnectors.list(await Q(e.credentialProvider,o,Pi.operationId)),get:async(o)=>t.mcpConnectors.get(await Q(e.credentialProvider,o,Si.operationId)),details:async(o)=>t.mcpConnectors.details(await Q(e.credentialProvider,o,$i.operationId)),listProviders:async()=>t.mcpConnectors.listProviders({}),search:async(o={})=>t.mcpConnectors.search(await Q(e.credentialProvider,o,Ii.operationId)),describe:async(o)=>t.mcpConnectors.describe(await Q(e.credentialProvider,o,Ti.operationId)),call:async(o)=>t.mcpConnectors.call(await Q(e.credentialProvider,o,Ai.operationId))},sandboxPresets:{listConnections:async(o={})=>t.sandboxPresets.listConnections(await Q(e.credentialProvider,o,xi.operationId)),listTypes:async()=>t.sandboxPresets.listTypes({})},memory:{list:async(o={})=>t.memory.list(await Q(e.credentialProvider,o,Di.operationId)),get:async(o)=>t.memory.get(await Q(e.credentialProvider,o,Ci.operationId)),put:async(o)=>t.memory.put(await Q(e.credentialProvider,o,Li.operationId)),search:async(o)=>t.memory.search(await Q(e.credentialProvider,o,zi.operationId)),delete:async(o)=>t.memory.delete(await Q(e.credentialProvider,o,_i.operationId))},logMatchExpressions:{list:async(o={})=>t.logMatchExpressions.list(await Q(e.credentialProvider,o,"logMatchExpressions.list")),get:async(o)=>t.logMatchExpressions.get(await Q(e.credentialProvider,o,"logMatchExpressions.get")),create:async(o)=>t.logMatchExpressions.create(await Q(e.credentialProvider,o,"logMatchExpressions.create")),update:async(o)=>t.logMatchExpressions.update(await Q(e.credentialProvider,o,"logMatchExpressions.update")),disable:async(o)=>t.logMatchExpressions.disable(await Q(e.credentialProvider,o,"logMatchExpressions.disable"))},scripts:{list:async(o={})=>t.scripts.list(await Q(e.credentialProvider,o,"scripts.list")),get:async(o)=>t.scripts.get(await Q(e.credentialProvider,o,"scripts.get")),create:async(o)=>t.scripts.create(await Q(e.credentialProvider,o,"scripts.create")),update:async(o)=>t.scripts.update(await Q(e.credentialProvider,o,"scripts.update")),delete:async(o)=>t.scripts.delete(await Q(e.credentialProvider,o,"scripts.delete"))},issues:{count:async(o={})=>t.issues.count(await Q(e.credentialProvider,o,"issues.count")),create:async(o)=>t.issues.create(await Q(e.credentialProvider,o,qr.operationId)),list:async(o={})=>t.issues.list(await Q(e.credentialProvider,o,"issues.list")),search:async(o={})=>t.issues.search(await Q(e.credentialProvider,o,"issues.search")),get:async(o)=>t.issues.get(o),resolve:async(o)=>t.issues.resolve(o),ignore:async(o)=>t.issues.ignore(o),reopen:async(o)=>t.issues.reopen(o),mute:async(o)=>t.issues.mute(o),unmute:async(o)=>t.issues.unmute(o)},pullRequests:{list:async(o={})=>t.pullRequests.list(await Q(e.credentialProvider,o,"pullRequests.list"))},components:{list:async(o={})=>t.components.list(await Q(e.credentialProvider,o,"components.list")),get:async(o)=>t.components.get(o),register:async(o)=>t.components.register(await Q(e.credentialProvider,o,Jr.operationId)),deregister:async(o)=>t.components.deregister({componentId:o.componentId,...o.reason!==void 0?{reason:o.reason}:{}}),rename:async(o)=>t.components.rename(o),assignTeam:async(o)=>t.components.assignTeam(o),retirementPreview:async(o)=>t.components.retirementPreview(o),retire:async(o)=>t.components.retire(o),restorationPreview:async(o)=>t.components.restorationPreview(o),restore:async(o)=>t.components.restore(o),mergePreview:async(o)=>t.components.mergePreview(await Q(e.credentialProvider,o,"components.mergePreview")),merge:async(o)=>t.components.merge(await Q(e.credentialProvider,o,"components.merge")),relationships:{list:async(o={})=>t.components.relationships.list(await Q(e.credentialProvider,o,"components.relationships.list")),preview:async(o)=>t.components.relationships.preview(await Q(e.credentialProvider,o,"components.relationships.preview")),add:async(o)=>t.components.relationships.add(await Q(e.credentialProvider,o,"components.relationships.add")),remove:async(o)=>t.components.relationships.remove(await Q(e.credentialProvider,o,"components.relationships.remove"))},incidents:{list:async(o={})=>t.components.incidents.list(await Q(e.credentialProvider,o,"components.incidents.list"))},timeline:async(o)=>t.components.timeline(o)},billing:{getSummary:async(o={})=>t.billing.getSummary(await Ue(e.credentialProvider,o)),getUsage:async(o={})=>t.billing.getUsage(await Ue(e.credentialProvider,o)),listTransactions:async(o={})=>t.billing.listTransactions(await Ue(e.credentialProvider,o))},tasks:{list:async(o={})=>t.tasks.list(await Q(e.credentialProvider,o,as.operationId))},recommendations:{list:async(o={})=>t.recommendations.list(await Q(e.credentialProvider,o,is.operationId))},notificationDeliveryRules:{list:async(o={})=>t.notificationDeliveryRules.list(await Q(e.credentialProvider,o,"notificationDeliveryRules.list")),options:async(o={})=>t.notificationDeliveryRules.options(await Q(e.credentialProvider,o,"notificationDeliveryRules.options")),create:async(o)=>t.notificationDeliveryRules.create(await Q(e.credentialProvider,o,"notificationDeliveryRules.create")),update:async(o)=>t.notificationDeliveryRules.update(await Q(e.credentialProvider,o,"notificationDeliveryRules.update")),delete:async(o)=>t.notificationDeliveryRules.delete(await Q(e.credentialProvider,o,"notificationDeliveryRules.delete"))},notificationChannels:{getProject:async(o={})=>t.notificationChannels.getProject(await Q(e.credentialProvider,o,"notificationChannels.getProject"))}}},cT=async(e={})=>{let t=await yZ(e.fetch)(gZ(e.apiBaseUrl??lZ,"/device/code"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_id:e.clientId??hZ,...e.scope?{scope:e.scope}:{}})}),n=await t.json();if(!t.ok)throw Hye(n,t.status);let r=n;return{deviceCode:Ki(r.device_code,"device_code"),userCode:Ki(r.user_code,"user_code"),verificationUri:Ki(r.verification_uri,"verification_uri"),verificationUriComplete:Ki(r.verification_uri_complete,"verification_uri_complete"),expiresIn:aT(r.expires_in,"expires_in"),interval:aT(r.interval,"interval")}},sT=async(e)=>{let t=await yZ(e.fetch)(gZ(e.apiBaseUrl??lZ,"/device/token"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:xye,device_code:e.deviceCode,client_id:e.clientId??hZ})}),n=await t.json();if(t.ok){let o=n;return{status:"authorized",accessToken:Ki(o.access_token,"access_token"),tokenType:Ki(o.token_type,"token_type"),expiresIn:aT(o.expires_in,"expires_in"),scope:typeof o.scope==="string"?o.scope:""}}let r=dZ(n);if(!r)throw Error(`Device authorization failed with status ${t.status}`);if(r.error==="authorization_pending")return{status:"pending"};if(r.error==="slow_down")return{status:"pending",interval:10};if(r.error==="access_denied")return{status:"denied",message:r.errorDescription};if(r.error==="expired_token"||r.error==="invalid_grant")return{status:"expired",message:r.errorDescription};throw Error(r.errorDescription)},Rye=(e)=>{let t=e.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},gZ=(e,t)=>{return`${e.replace(/\/+$/,"")}/api/auth${t}`},Uye=async(e,t)=>{return Ue(e,t)},Ue=async(e,t)=>{let n=t.organizationId??await e.getOrganizationId?.();return n?{...t,organizationId:n}:t},Mye=async(e,t)=>{let n=t.organizationId??await e.getOrganizationId?.();if(!n)throw new Qe("BAD_REQUEST",{message:"Organization ID is required",data:{operationId:"organizations.update",missingContext:["organizationId"]},status:400});return{...t,organizationId:n}},Q=async(e,t,n)=>{let r=t.projectId??await e.getProjectId?.();if(!r)throw new Qe("BAD_REQUEST",{message:"Project ID is required",data:{operationId:n,missingContext:["projectId"]},status:400});return{...t,projectId:r}},Kye=async(e,t)=>{let n=t.projectId??await e.getProjectId?.();return n?{...t,projectId:n}:t},Gye=async(e,t)=>{let n=t.projectId??await e.getProjectId?.();return n?{...t,projectId:n}:t},Jye=async(e,t)=>{let n=t.projectId??await e.getProjectId?.();return n?{...t,projectId:n}:t},Bye=(e)=>{return{threadId:e.threadId,message:e.message,wait:e.wait??!0,timeoutSeconds:e.timeoutSeconds??20,...e.automationId!==void 0?{automationId:e.automationId}:{}}},qye=(e)=>{if(!e||typeof e!=="object")return null;let t=e;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((n)=>typeof n==="string"):[]}},dZ=(e)=>{if(!e||typeof e!=="object")return null;let t=e;if(typeof t.error!=="string"||typeof t.error_description!=="string")return null;return{error:t.error,errorDescription:t.error_description}},Hye=(e,t)=>{let n=dZ(e);return Error(n?.errorDescription??`Device authorization failed with status ${t}`)},yZ=(e)=>{return e??globalThis.fetch},sZ=(e,t)=>({result:t,poll:()=>e.runs.get({runId:t.runId}),waitForCompletion:async(n={})=>Eye(e,t,n)}),Eye=async(e,t,n)=>{if(t.completed)return t;let r=n.intervalMs??2000,o=Date.now(),i=t;while(!i.completed){if(n.timeoutMs!==void 0&&Date.now()-o>=n.timeoutMs)return i;await Wye(r),i=await e.runs.get({runId:i.runId})}return i},Wye=async(e)=>{await new Promise((t)=>globalThis.setTimeout(t,e))},Ki=(e,t)=>{if(typeof e==="string")return e;throw Error(`Expected '${t}' to be a string.`)},aT=(e,t)=>{if(typeof e==="number")return e;throw Error(`Expected '${t}' to be a number.`)};var lT=g(()=>{hr();JA();Mi();XW();rT();rT()});var Ze=(e)=>({success:!0,value:e}),Ke=(e,t,n)=>({success:!1,error:e,...t!==void 0&&{statusCode:t},...n!==void 0&&{errorPayload:n}}),w=(e,t,n)=>{if(!e.success){let r=`${t}: ${e.error}`;if(n)return m(e.errorPayload??r);return p(r)}return e.value};var ie=g(()=>{te()});var Zye="https://api.sazabi.com",O=async(e)=>{try{return Ze(await e())}catch(t){let n=Xye(t),r=Yye(t),o=t instanceof Error?t.message:String(t);return Ke(o,r,n)}},Xye=(e)=>{if(!e||typeof e!=="object")return;let t=e;if(typeof t.code!=="string"||typeof t.message!=="string"||!t.data||typeof t.data!=="object")return;let n=t.data;if(typeof n.operationId!=="string")return;return{code:t.code,message:t.message,operationId:n.operationId,missingContext:Array.isArray(n.missingContext)?n.missingContext.filter((r)=>typeof r==="string"):[]}},Yye=(e)=>{if(!e||typeof e!=="object")return;let t=e;return typeof t.status==="number"?t.status:void 0},Jn=(e)=>{let t=uZ({apiBaseUrl:e.baseUrl??Zye,clientSource:"cli",credentialProvider:{getToken:()=>e.token,getOrganizationId:()=>e.organizationId,getProjectId:()=>e.projectId},intakeBaseUrl:e.intakeBaseUrl,tailBaseUrl:e.tailBaseUrl});return{me:()=>O(()=>t.me()),automations:{list:(n={})=>O(()=>t.automations.list(n)),get:(n)=>O(()=>t.automations.get({automationId:n})),create:(n)=>O(()=>t.automations.create(n)),update:(n)=>O(()=>t.automations.update(n)),enable:(n)=>O(()=>t.automations.enable({automationId:n})),disable:(n)=>O(()=>t.automations.disable({automationId:n})),runs:{list:(n,r={})=>O(()=>t.automations.runs.list({automationId:n,...r})),get:(n,r)=>O(()=>t.automations.runs.get({automationId:n,runId:r})),logs:(n,r)=>O(()=>t.automations.runs.logs({automationId:n,runId:r}))}},logs:{tail:(n)=>O(()=>t.logs.tail(n)),forward:(n)=>O(()=>t.logs.forward(n)),query:(n={})=>O(()=>t.logs.query(n)),schema:(n={})=>O(()=>t.logs.schema(n)),volume:(n)=>O(()=>t.logs.volume(n)),patterns:(n={})=>O(()=>t.logs.patterns(n)),nativeQuery:(n)=>O(()=>t.logs.nativeQuery(n))},organizations:{list:()=>O(()=>t.organizations.list()),get:(n)=>O(()=>t.organizations.get({organizationId:n})),rename:(n,r)=>O(()=>t.organizations.update({organizationId:r,name:n}))},members:{list:(n={})=>O(()=>t.members.list(n)),updateRole:(n,r,o)=>O(()=>t.members.updateRole({organizationId:o,userId:n,role:r})),remove:(n,r)=>O(()=>t.members.remove({organizationId:r,userId:n}))},teams:{list:(n={})=>O(()=>t.teams.list(n)),create:(n,r,o)=>O(()=>t.teams.create({organizationId:o,name:n,...r!==void 0?{description:r}:{}})),update:(n,r,o)=>O(()=>t.teams.update({organizationId:o,teamId:n,...r.name!==void 0?{name:r.name}:{},...r.description!==void 0?{description:r.description}:{}})),delete:(n,r)=>O(()=>t.teams.delete({organizationId:r,teamId:n})),addMember:(n,r,o)=>O(()=>t.teams.addMember({organizationId:o,teamId:n,userId:r})),removeMember:(n,r,o)=>O(()=>t.teams.removeMember({organizationId:o,teamId:n,userId:r})),listMembers:(n,r)=>O(()=>t.teams.listMembers({organizationId:r,teamId:n}))},projects:{list:(n={})=>O(()=>t.projects.list(n)),get:(n)=>O(()=>t.projects.get({projectId:n})),create:(n)=>O(()=>t.projects.create(n))},threads:{list:(n={})=>O(()=>t.threads.list(n)),get:(n)=>O(()=>t.threads.get({threadId:n})),create:(n)=>O(()=>t.threads.create(n)),getStatus:(n)=>O(()=>t.threads.getStatus({threadId:n})),update:(n,r)=>O(()=>t.threads.update({threadId:n,status:r})),fork:(n,r)=>O(()=>t.threads.fork({threadId:n,messageId:r})),setVisibility:(n,r)=>O(()=>t.threads.setVisibility({threadId:n,visibility:r})),createShareLink:(n)=>O(()=>t.threads.createShareLink({threadId:n})),listShareLinks:(n)=>O(()=>t.threads.listShareLinks({threadId:n})),revokeShareLink:(n,r)=>O(()=>t.threads.revokeShareLink({threadId:n,shareId:r})),stop:(n)=>O(()=>t.threads.stop({threadId:n})),stream:(n)=>O(()=>t.threads.stream(n))},messages:{list:(n,r={})=>O(()=>t.messages.list({threadId:n,...r})),append:(n,r,o,i,c,s)=>O(()=>t.messages.append({threadId:n,message:r,wait:o,timeoutSeconds:i,...c!==void 0?{automationId:c}:{},...s?{ambientServiceRun:s}:{}}))},runs:{get:(n)=>O(()=>t.runs.get({runId:n})),cancel:(n)=>O(()=>t.runs.cancel({runId:n})),stream:(n)=>O(()=>t.runs.stream(n))},search:{threads:(n)=>O(()=>t.search.threads(n)),messages:(n)=>O(()=>t.search.messages(n))},publicKeys:{list:(n)=>O(()=>t.publicKeys.list(n)),get:(n,r)=>O(()=>t.publicKeys.get(r?{keyId:n,projectId:r}:{keyId:n})),ensureLogForwarding:(n)=>O(()=>t.publicKeys.ensureLogForwarding(n)),update:(n)=>O(()=>t.publicKeys.update(n)),deactivate:(n)=>O(()=>t.publicKeys.deactivate(n))},secretKeys:{list:(n)=>O(()=>t.secretKeys.list(n)),get:(n)=>O(()=>t.secretKeys.get({keyId:n})),create:(n)=>O(()=>t.secretKeys.create(n)),update:(n)=>O(()=>t.secretKeys.update(n)),delete:(n)=>O(()=>t.secretKeys.delete(n))},issues:{count:(n={})=>O(()=>t.issues.count(n)),create:(n)=>O(()=>t.issues.create(n)),list:(n={})=>O(()=>t.issues.list(n)),search:(n={})=>O(()=>t.issues.search(n)),get:(n)=>O(()=>t.issues.get({issueId:n})),resolve:(n)=>O(()=>t.issues.resolve({issueId:n})),ignore:(n)=>O(()=>t.issues.ignore({issueId:n})),reopen:(n)=>O(()=>t.issues.reopen({issueId:n})),mute:(n)=>O(()=>t.issues.mute({issueId:n})),unmute:(n)=>O(()=>t.issues.unmute({issueId:n}))},pullRequests:{list:(n={})=>O(()=>t.pullRequests.list(n))},components:{list:(n={})=>O(()=>t.components.list(n)),get:(n)=>O(()=>t.components.get({componentId:n})),register:(n)=>O(()=>t.components.register(n)),deregister:(n,r)=>O(()=>t.components.deregister({componentId:n,...r!==void 0?{reason:r}:{}})),rename:(n)=>O(()=>t.components.rename(n)),retirementPreview:(n)=>O(()=>t.components.retirementPreview(n)),retire:(n)=>O(()=>t.components.retire(n)),restorationPreview:(n)=>O(()=>t.components.restorationPreview(n)),restore:(n)=>O(()=>t.components.restore(n)),mergePreview:(n)=>O(()=>t.components.mergePreview(n)),merge:(n)=>O(()=>t.components.merge(n)),relationships:{list:(n={})=>O(()=>t.components.relationships.list(n)),preview:(n)=>O(()=>t.components.relationships.preview(n)),add:(n)=>O(()=>t.components.relationships.add(n)),remove:(n)=>O(()=>t.components.relationships.remove(n))},incidents:{list:(n={})=>O(()=>t.components.incidents.list(n))},timeline:(n)=>O(()=>t.components.timeline(n))},billing:{getSummary:(n={})=>O(()=>t.billing.getSummary(n)),getUsage:(n={})=>O(()=>t.billing.getUsage(n)),listTransactions:(n={})=>O(()=>t.billing.listTransactions(n))},tasks:{list:(n={})=>O(()=>t.tasks.list(n))},recommendations:{list:(n={})=>O(()=>t.recommendations.list(n))},notificationDeliveryRules:{list:()=>O(()=>t.notificationDeliveryRules.list()),options:()=>O(()=>t.notificationDeliveryRules.options()),create:(n)=>O(()=>t.notificationDeliveryRules.create(n)),update:(n)=>O(()=>t.notificationDeliveryRules.update(n)),delete:(n)=>O(()=>t.notificationDeliveryRules.delete({ruleId:n}))},notificationChannels:{getProject:()=>O(()=>t.notificationChannels.getProject())},logSources:{listProviders:()=>O(()=>t.logSources.listProviders()),list:(n)=>O(()=>t.logSources.list(n)),get:(n)=>O(()=>t.logSources.get({logSourceId:n})),create:(n)=>O(()=>t.logSources.create(n)),update:(n)=>O(()=>t.logSources.update(n)),delete:(n)=>O(()=>t.logSources.delete({logSourceId:n}))},logStreams:{list:(n)=>O(()=>t.logStreams.list({logSourceId:n})),get:(n)=>O(()=>t.logStreams.get({streamId:n})),create:(n)=>O(()=>t.logStreams.create(n)),update:(n)=>O(()=>t.logStreams.update(n)),delete:(n)=>O(()=>t.logStreams.delete({streamId:n})),reassign:(n)=>O(()=>t.logStreams.reassign(n))},integrations:{listProviders:()=>O(()=>t.integrations.listProviders()),listConnections:(n)=>O(()=>t.integrations.listConnections(n)),getConnection:(n)=>O(()=>t.integrations.getConnection({connectionId:n})),createConnection:(n)=>O(()=>t.integrations.createConnection(n)),beginConnect:(n)=>O(()=>t.integrations.beginConnect(n)),getConnectAttempt:(n)=>O(()=>t.integrations.getConnectAttempt({attemptId:n})),disconnectConnection:(n)=>O(()=>t.integrations.disconnectConnection({connectionId:n})),updateConnectionCredentials:(n)=>O(()=>t.integrations.updateConnectionCredentials(n))},mcpConnectors:{list:(n)=>O(()=>t.mcpConnectors.list(n)),get:(n)=>O(()=>t.mcpConnectors.get(n)),details:(n)=>O(()=>t.mcpConnectors.details(n)),listProviders:()=>O(()=>t.mcpConnectors.listProviders())},sandboxPresets:{listTypes:()=>O(()=>t.sandboxPresets.listTypes())},memory:{list:(n={})=>O(()=>t.memory.list(n)),get:(n)=>O(()=>t.memory.get(n)),search:(n)=>O(()=>t.memory.search(n)),put:(n)=>O(()=>t.memory.put({kind:"note",...n})),delete:(n)=>O(()=>t.memory.delete(n))},logMatchExpressions:{list:(n={})=>O(()=>t.logMatchExpressions.list(n)),get:(n)=>O(()=>t.logMatchExpressions.get({expressionId:n})),create:(n)=>O(()=>t.logMatchExpressions.create(n)),update:(n,r={})=>O(()=>t.logMatchExpressions.update({expressionId:n,...r})),disable:(n)=>O(()=>t.logMatchExpressions.disable({expressionId:n}))},scripts:{list:(n={})=>O(()=>t.scripts.list(n)),get:(n)=>O(()=>t.scripts.get({name:n})),create:(n)=>O(()=>t.scripts.create(n)),update:(n,r={})=>O(()=>t.scripts.update({name:n,...r})),delete:(n)=>O(()=>t.scripts.delete({name:n}))}}};var cs=g(()=>{lT();ie()});var bZ;var mZ=g(()=>{bZ={version:2,activeProfile:"default",profiles:{default:{}}}});import*as Bn from"node:fs";import*as pZ from"node:os";import*as gT from"node:path";var dt=(e)=>{if(e===void 0||e===null)return;if(typeof e==="string")return e.length>0?e:void 0;return},hT,Gi,Fye=()=>{if(!Bn.existsSync(hT))Bn.mkdirSync(hT,{recursive:!0,mode:448})},uT,wZ=(e)=>{uT=e},fZ=(e)=>({token:dt(e.token),activeOrganizationId:dt(e.activeOrganizationId??e.organizationId),organizationName:dt(e.organizationName),activeProjectId:dt(e.activeProjectId??e.defaultProjectId),apiBaseUrl:dt(e.apiBaseUrl),authBaseUrl:dt(e.authBaseUrl),webBaseUrl:dt(e.webBaseUrl),intakeBaseUrl:dt(e.intakeBaseUrl),tailBaseUrl:dt(e.tailBaseUrl),apiDomain:dt(e.apiDomain),webDomain:dt(e.webDomain),intakeDomain:dt(e.intakeDomain),tailDomain:dt(e.tailDomain),forwardPublicKey:dt(e.forwardPublicKey),forwardPublicKeyProjectId:dt(e.forwardPublicKeyProjectId)}),Qye=(e)=>({version:2,activeProfile:"default",profiles:{default:fZ(e)}}),Vye=(e)=>{let t=dt(e.activeProfile)??"default",n=typeof e.profiles==="object"&&e.profiles!==null?e.profiles:{},r={};for(let[o,i]of Object.entries(n)){if(typeof i!=="object"||i===null)continue;r[o]=fZ(i)}if(!r[t])r[t]={};return{version:2,activeProfile:t,profiles:r}},Re=()=>{try{if(!Bn.existsSync(Gi))return Ze(bZ);let e=Bn.readFileSync(Gi,"utf-8"),t=JSON.parse(e),n=typeof t.version==="number"?t.version:void 0;if(n!==void 0&&n>2)return Ke("Settings file requires a newer CLI version. Upgrade with 'npm install -g @sazabi/cli@latest'.");if(n===2)return Ze(Vye(t));let r=Qye(t),o=Ye(r);if(!o.success)return o;return Ze(r)}catch(e){let t=e instanceof Error?e.message:String(e);return Ke(t)}},Ye=(e)=>{try{return Fye(),Bn.writeFileSync(Gi,JSON.stringify(e,null,2),{encoding:"utf-8",mode:384}),Ze(void 0)}catch(t){let n=t instanceof Error?t.message:String(t);return Ke(n)}},In=(e,t)=>{if(t)return t;if(uT)return uT;let n=process.env.SAZABI_PROFILE?.trim();if(n)return n;return e.activeProfile??"default"},Rt=(e,t)=>{let n=In(e,t),r=e.profiles[n];if(r)return Ze(r);if(n==="default")return Ze({});return Ke(`Profile '${n}' does not exist. Run 'sazabi profiles create ${n}' first.`)},qn=()=>{let e=Re();if(!e.success)return e;return Rt(e.value)},Ut=(e,t,n)=>{let r=In(e,n);if(!e.profiles[r])return Ke(`Profile '${r}' does not exist. Run 'sazabi profiles create ${r}' first.`);return Ze({...e,profiles:{...e.profiles,[r]:{...e.profiles[r],...t}}})},Hn=(e)=>{if(!e?.forwardPublicKey&&!e?.forwardPublicKeyProjectId)return{};return{forwardPublicKey:void 0,forwardPublicKeyProjectId:void 0}};var Vt=g(()=>{mZ();ie();hT=gT.join(pZ.homedir(),".sazabi"),Gi=gT.join(hT,"settings.json")});var Tn=(e)=>{let{cliFlag:t,globalUrl:n,globalDomain:r,buildUrlFromDomain:o,defaultUrl:i}=e;if(t)return t;let c=process.env.SAZABI_API_URL?.trim();if(c)return c;if(n)return n;if(r)return o(r);return i},C=(e)=>{let{tokenFlag:t,organizationIdFlag:n,projectIdFlag:r,jsonMode:o}=e,i=t?.trim(),c=process.env.SAZABI_TOKEN?.trim(),s=process.env.SAZABI_ORGANIZATION_ID?.trim(),l=process.env.SAZABI_PROJECT_ID?.trim(),h=w(qn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",o),u=h.token?.trim(),d=(i&&i.length>0?i:void 0)||(c&&c.length>0?c:void 0)||u,y=i&&i.length>0?"flag":c&&c.length>0?"environment":"settings";if(!d||d.length===0){if(o)return m("Not authenticated. Set SAZABI_TOKEN, pass --token, run 'sazabi auth login', or run 'sazabi auth save <token>'.");return p("Not authenticated. Set SAZABI_TOKEN, pass --token, run 'sazabi auth login', or run 'sazabi auth save <token>'.")}let b,f;if(n)b=n,f="flag";else if(s&&s.length>0)b=s,f="environment";else if(h.activeOrganizationId)b=h.activeOrganizationId,f="settings";let k,T;if(r)k=r,T="flag";else if(l&&l.length>0)k=l,T="environment";else if(h.activeProjectId)k=h.activeProjectId,T="settings";return{token:d,type:"token",projectId:k,organizationId:b,tokenSource:y,organizationSource:f,projectSource:T}},yT=(e)=>{let t=w(qn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e?.jsonMode);return Tn({cliFlag:e?.apiBaseUrlFlag,globalUrl:t.apiBaseUrl,globalDomain:t.apiDomain,buildUrlFromDomain:(n)=>`https://api.${n}`,defaultUrl:"https://api.sazabi.com"})},z=(e)=>{let t=yT({apiBaseUrlFlag:e.apiBaseUrlFlag,jsonMode:e.jsonMode});return Jn({token:e.token,baseUrl:t,organizationId:e.organizationId,projectId:e.projectId})},kZ,dT,Vg=async(e)=>{let t=w(qn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.jsonMode),n=Tn({cliFlag:e.apiBaseUrlFlag,globalUrl:t.apiBaseUrl,globalDomain:t.apiDomain,buildUrlFromDomain:(l)=>`https://api.${l}`,defaultUrl:"https://api.sazabi.com"}),r=`${e.token}@${n}@${e.projectId??""}`,o=kZ.get(r);if(o)return o;let i=dT.get(r);if(i)return i;if(!e.projectId){if(e.jsonMode)return m("Project ID is required. Run 'sazabi projects use <project-id>' or set SAZABI_PROJECT_ID.");return p("Project ID is required. Run 'sazabi projects use <project-id>' or set SAZABI_PROJECT_ID.")}let c=e.projectId,s=(async()=>{let h=await Jn({token:e.token,baseUrl:n,projectId:c}).projects.get(c),d=w(h,"Couldn't fetch project info (run 'sazabi projects list' to verify the project ID)",e.jsonMode).project;return kZ.set(r,d),d})();dT.set(r,s);try{return await s}finally{dT.delete(r)}},Qg=(e)=>{let t=e.trim().toLowerCase(),n=/^[a-z][a-z0-9+.-]*:\/\//.test(t)?t:`https://${t}`,r=t;try{r=new URL(n).hostname.toLowerCase()}catch{r=t.replace(/^[a-z][a-z0-9+.-]*:\/\//,"").replace(/[/?#].*$/,"").replace(/:\d+$/,"")}return`https://app.${r.replace(/^(?:app\.)+/,"")}`},Ji=(e)=>{let t=(r)=>r.replace(/\/+$/,"");if(e)return t(e);let n=w(qn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)");if(n.webBaseUrl)return t(n.webBaseUrl);if(n.webDomain)return Qg(n.webDomain);if(n.apiDomain)return Qg(n.apiDomain);return"https://app.sazabi.com"},An=(e,t)=>{if(e&&e.length>0)return e;let n="No project selected. Pass --project-id, set SAZABI_PROJECT_ID, or run 'sazabi projects use <project-id>'.";if(t)return m(n);return p(n)},wo=(e,t)=>{return`${Ji(t)}/projects/${e}`},Fe=(e,t,n,r)=>{let o=`${Ji(n)}/projects/${e}/threads/${t}`;return r?`${o}?messageId=${encodeURIComponent(r)}`:o},vZ=(e,t,n,r)=>{return Fe(e,t,n,r)},PZ=(e,t,n)=>{return`${wo(e,n)}/issues/${t}`},SZ=(e,t,n)=>{return`${wo(e,n)}/automations/${t}`},$Z=(e,t)=>{return`${wo(e,t)}/status`},IZ=(e,t,n)=>{return`${wo(e,n)}/settings/log-source-providers/${t}`},TZ=(e,t,n)=>{return`${wo(e,n)}/settings/mcp-connectors/${t}`},AZ=(e,t,n)=>{return`${wo(e,n)}/settings/sandbox/catalog/${t}`},OZ=(e,t)=>{return`https://otlp.${t}.intake.${e}`};var ce=g(()=>{te();cs();ie();Vt();kZ=new Map,dT=new Map});var kd,gF=(e)=>{kd.set(e.name,e)},vd=(e)=>{return kd.get(e)},Ss=()=>{return Array.from(kd.values())},dF=(e)=>{return kd.has(e)};var GT=g(()=>{kd=new Map});async function HT(e){let t=await e.publicKeys.list({limit:20});if(!t.success)return[];return t.value.publicKeys.map((n)=>({value:n.id,description:n.name}))}async function ET(e){let t=await e.secretKeys.list({limit:20});if(!t.success)return[];return t.value.secretKeys.map((n)=>({value:n.id,description:n.name}))}async function Is(e){let t=await e.logSources.list();if(!t.success)return[];return t.value.logSources.map((n)=>({value:n.id,description:n.name??n.provider}))}async function mF(e){let t=await e.members.list();if(!t.success)return[];return t.value.members.map((n)=>({value:n.userId,description:n.name??n.email}))}var oPe=3000,rPe,pF=async(e,t,n)=>{try{let r=rPe[e]?.[t];if(!r)return[];let o=qn();if(!o.success)return[];let i=o.value,c=process.env.SAZABI_TOKEN?.trim()||i.token?.trim();if(!c)return[];let s=Tn({globalUrl:i.apiBaseUrl,globalDomain:i.apiDomain,buildUrlFromDomain:(u)=>`https://api.${u}`,defaultUrl:"https://api.sazabi.com"}),l=Jn({token:c,baseUrl:s,organizationId:i.activeOrganizationId,projectId:i.activeProjectId});return(await Promise.race([r(l),new Promise((u)=>setTimeout(()=>u([]),oPe))])).filter((u)=>u.value.startsWith(n))}catch{return[]}};var wF=g(()=>{cs();ce();Vt();rPe={threads:{get:async(e)=>{let t=await e.threads.list({limit:20});if(!t.success)return[];return t.value.threads.map((n)=>({value:n.id,description:n.title??void 0}))}},projects:{use:async(e)=>{let t=await e.projects.list();if(!t.success)return[];return t.value.projects.map((n)=>({value:n.id,description:n.name}))}},organizations:{use:async(e)=>{let t=await e.organizations.list();if(!t.success)return[];return t.value.organizations.map((n)=>({value:n.id,description:n.name}))},rename:async(e)=>{let t=await e.organizations.list();if(!t.success)return[];return t.value.organizations.map((n)=>({value:n.id,description:n.name}))}},"public-keys":{get:HT,update:HT,deactivate:HT},"secret-keys":{get:ET,update:ET,delete:ET},"log-sources":{get:Is,enable:Is,disable:Is,delete:Is,remove:Is},members:{"update-role":mF,remove:mF}}});var kF={};dn(kF,{parseCompletionContext:()=>cPe,getCompletions:()=>sPe});var iPe,aPe,cPe=(e)=>{let t=e.length>0?e:[""],n=t.length-1,r=t[n]??"";return{words:t,currentIndex:n,partial:r}},sPe=async(e)=>{let{words:t,currentIndex:n,partial:r}=e,o=t[n-1];if(o==="--profile")return gPe(r);let i=uPe(t),c=Math.max(0,i.length-(t.length-n));if(c===0)return lPe(r);let s=i[0]??"",l=vd(s);if(!l)return[];if(c===1&&l.subcommands){if(r.startsWith("-"))return fF(l.options,i);return hPe(l,r)}let h=l.subcommands?i[1]:void 0,d=(h?l.subcommands?.[h]:void 0)?.options??l.options;if(r.startsWith("-"))return fF(d,i);if(o?.startsWith("--")){let y=o.slice(2);if(d?.[y]?.type==="string"){let f=`${s}:${h??""}`,k=aPe[f]?.[y]??iPe[y];if(k)return k.filter((T)=>T.startsWith(r)).map((T)=>({value:T}));return[]}}return pF(s,h??"",r)},lPe=(e)=>{let n=Ss().filter((o)=>o.name.startsWith(e)).map((o)=>({value:o.name,description:o.description})),r=[{value:"--help",description:"Show help"},{value:"--version",description:"Show version"},{value:"--profile",description:"Use a named profile"}];for(let o of r)if(o.value.startsWith(e))n.push(o);return n},hPe=(e,t)=>{if(!e.subcommands)return[];return Object.values(e.subcommands).filter((n)=>n.name.startsWith(t)).map((n)=>({value:n.name,description:n.description}))},fF=(e,t)=>{let n=t[t.length-1]??"",r=new Set(t.filter((i)=>i.startsWith("--")).map((i)=>i.replace(/=.*/,""))),o=[];if(!r.has("--help")&&"--help".startsWith(n))o.push({value:"--help",description:"Show help"});if(!r.has("--profile")&&"--profile".startsWith(n))o.push({value:"--profile",description:"Use a named profile"});if(!e)return o;for(let[i,c]of Object.entries(e)){let s=`--${i}`;if(r.has(s))continue;if(!s.startsWith(n))continue;o.push({value:s,description:c.description})}return o},uPe=(e)=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r==="--profile"&&n+1<e.length)n++;else if(r.startsWith("--profile="));else t.push(r)}return t},gPe=(e)=>{try{let t=Re();if(!t.success)return[];return Object.keys(t.value.profiles).filter((n)=>n.startsWith(e)).map((n)=>({value:n,description:n===t.value.activeProfile?"active":void 0}))}catch{return[]}};var vF=g(()=>{GT();Vt();wF();iPe={status:["regular","archived"],format:["json","text"]},aPe={"members:update-role":{role:["admin","member"]},"messages:search":{role:["user","assistant"]},"messages:list":{role:["user","assistant"]}}});te();te();te();import{parseArgs as YF}from"node:util";var $=(e,t,n={})=>{let r=YF({args:e,options:t,allowPositionals:Boolean(n.allowPositionals),strict:!1,tokens:!0}),o=Object.hasOwn(t,"json")&&r.values.json===!0,i=new Set(Object.keys(t)),c=new Set(Object.entries(t).map(([,l])=>l.short).filter((l)=>Boolean(l))),s=[];if(Array.isArray(r.tokens))for(let l of r.tokens){if(l.kind!=="option")continue;let h=l.name,u=h.length>1;if(!(i.has(h)||!u&&c.has(h))){let y=u?`--${h}`:`-${h}`;if(!s.includes(y))s.push(y)}}for(let l of Object.keys(r.values))if(!i.has(l)){let h=l.length>1?`--${l}`:`-${l}`;if(!s.includes(h))s.push(h)}if(s.length>0){let l=`Unknown option${s.length>1?"s":""}: ${s.join(", ")}. Run the command with -h for usage.`;if(o)m(l);p(l)}for(let[l,h]of Object.entries(t))if(h.type==="string"&&r.values[l]===!0){let u=l.length===1?`-${l}`:`--${l}`,d=`Option ${u} requires a value. Use '${u} <value>'.`;if(o)m(d);p(d)}for(let[l,h]of Object.entries(t)){let u=r.values[l];if(h.type==="string"&&typeof u==="string"){if(u.startsWith("--")||u.length===2&&u[0]==="-"&&/[a-zA-Z]/.test(u.charAt(1))){let b=`Option ${l.length===1?`-${l}`:`--${l}`} received "${u}" as its value. Did you forget to provide a value?`;if(o)m(b);p(b)}}}return{values:r.values,positionals:r.positionals}};var Cs=(e,t)=>{if(e?.json?.type!=="boolean")throw Error(`${t} must include a boolean --json option (enforced by CommandBuilder)`)};class lA{name;description;handler;subcommands;options;examples;positionalArgs;allowNoJson=!1;constructor(e,t,n){this.name=e,this.description=t,this.handler=n}withOptions(e){return this.options=e,this}withSubcommands(e){return this.subcommands=e,this}withExamples(e){return this.examples=e,this}withPositionalArgs(e){return this.positionalArgs=e,this}build(){if(!this.handler&&!this.subcommands)throw Error(`Subcommand "${this.name}" must have either a handler or subcommands`);if(!this.allowNoJson&&this.handler)Cs(this.options,`Subcommand "${this.name}"`);if(!this.allowNoJson&&this.subcommands){for(let[e,t]of Object.entries(this.subcommands))if(!t.subcommands)Cs(t.options,`Subcommand "${this.name} ${e}"`)}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 hA{name;description;handler;subcommands;options;examples;positionalArgs;allowNoJson=!1;constructor(e,t){this.name=e,this.description=t}withHandler(e){return this.handler=e,this}withSubcommands(e){return this.subcommands=e,this}withOptions(e){return this.options=e,this}withExamples(e){return this.examples=e,this}withPositionalArgs(e){return this.positionalArgs=e,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)Cs(this.options,`Command "${this.name}"`);if(this.subcommands)for(let[e,t]of Object.entries(this.subcommands)){if(t.subcommands)continue;Cs(t.options,`Subcommand "${this.name} ${e}"`)}}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 V=(e,t)=>{return new hA(e,t)},P=(e,t,n)=>{return new lA(e,t,n)};te();var ht=(e,t,n,r,o)=>{let i=Number.parseInt(e,10);if(Number.isNaN(i)||i<t||i>n){let c=`${r} must be between ${t} and ${n}.`;if(o)return m(c);return p(c)}return i},Dt=(e,t,n,r)=>{if(!t.includes(e)){let o=t.map((c)=>`"${c}"`).join(" or "),i=`${n} must be ${o}.`;if(r)return m(i);return p(i)}return e};te();ce();ie();var mT=(e)=>{let t=[];for(let n of e){let r=0;for(let o of n.content){if(o.type!=="artifact")continue;t.push({id:`${n.id}:${r}`,messageId:n.id,name:o.name,toolCallId:o.toolCallId??null,createdAt:n.createdAt,data:o.data}),r+=1}}return t},CZ=(e)=>{let t=e.lastIndexOf(":");if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1);if(!/^\d+$/.test(r))return null;return{messageId:n,index:Number.parseInt(r,10)}},DZ=(e,t)=>{return mT(e).find((n)=>n.id===t)},bT=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),LZ=(e)=>{let t=e===null||e===void 0?"":typeof e==="object"?JSON.stringify(e):String(e);if(/[",\n\r]/.test(t))return`"${t.replace(/"/g,'""')}"`;return t},ebe=(e)=>{if(Array.isArray(e)&&e.every(bT))return e;if(bT(e))for(let t of["rows","data","items","points"]){let n=e[t];if(Array.isArray(n)&&n.every(bT))return n}return null},zZ=(e)=>{let t=ebe(e);if(!t||t.length===0)return null;let n=[];for(let o of t)for(let i of Object.keys(o))if(!n.includes(i))n.push(i);if(n.length===0)return null;let r=[n.map(LZ).join(",")];for(let o of t)r.push(n.map((i)=>LZ(o[i])).join(","));return r.join(`
|
|
8557
8557
|
`)};var tbe=100,_Z=100,nbe=async(e,t,n)=>{let r=[],o;for(let i=0;i<_Z;i++){let c=await e.messages.list(t,{limit:tbe,...o?{cursor:o}:{}}),s=w(c,"Couldn't get artifact (check the thread ID and try again)",n);if(r.push(...s.messages),!s.nextCursor)break;o=s.nextCursor}if(o&&!n)console.error(`Warning: reached the ${_Z}-page limit; the artifact may exist beyond the scanned messages.`);return r},obe=(e,t,n)=>{if(t)return t;let r=`--thread-id is required to locate artifact '${e}'. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>`;if(n)m(r);else p(r);return},rbe=(e,t)=>{if(t.json){E({id:e.id,messageId:e.messageId,name:e.name,toolCallId:e.toolCallId,createdAt:e.createdAt,data:e.data});return}if(t.format==="csv"){let n=zZ(e.data);if(n===null){p(`Artifact '${e.id}' (${e.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(n);return}console.log(JSON.stringify(e.data,null,2))},jZ=async(e,t)=>{if(!CZ(e)){let l=`Invalid artifact ID: '${e}'. Expected format '<message-id>:<index>' (from 'sazabi artifacts list').`;if(t.json)return m(l);return p(l)}let r=obe(e,t.threadId,t.json);if(!r)return;let o=C({tokenFlag:t.token,jsonMode:t.json}),i=z({token:o.token,projectId:o.projectId,apiBaseUrlFlag:t.apiBaseUrl}),c=await nbe(i,r,t.json),s=DZ(c,e);if(!s){let l=`Artifact '${e}' not found in thread '${r}'. Run 'sazabi artifacts list --thread-id ${r}' to see available artifacts.`;if(t.json)return m(l);return p(l)}rbe(s,t)};te();ce();ie();var ibe={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"}}},abe={schema:ibe,columns:["id","name","toolCallId","createdAt"],header:"Artifacts",emptyMessage:"No artifacts found in this thread."},cbe=100,NZ=100,sbe=async(e,t,n)=>{let r=[],o;for(let i=0;i<NZ;i++){let c=await e.messages.list(t,{limit:cbe,...o?{cursor:o}:{}}),s=w(c,"Couldn't list artifacts (check the thread ID and try again)",n);if(r.push(...s.messages),!s.nextCursor)break;o=s.nextCursor}if(o&&!n)console.error(`Warning: reached the ${NZ}-page limit; artifact list may be incomplete for this thread.`);return r},xZ=async(e)=>{let t=C({tokenFlag:e.token,jsonMode:e.json}),n=z({token:t.token,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl}),r=await sbe(n,e.threadId,e.json),i=mT(r).map((c)=>({id:c.id,name:c.name,toolCallId:c.toolCallId,createdAt:c.createdAt}));q(abe,i,{json:e.json})};var RZ=V("artifacts","Retrieve artifacts produced in a thread").withSubcommands({list:P("list","List artifacts produced in a thread",async(e)=>{let{values:t}=$(e,{token:{type:"string"},"thread-id":{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}}),n=t["thread-id"];if(!n){if(t.json)return m("--thread-id is required. Usage: sazabi artifacts list --thread-id <thread-id>");return p("--thread-id is required. Usage: sazabi artifacts list --thread-id <thread-id>")}await xZ({threadId:n,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:P("get","Get a single artifact's data",async(e)=>{let{values:t,positionals:n}=$(e,{token:{type:"string"},"thread-id":{type:"string"},format:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),r=n[0];if(!r){if(t.json)return m("Artifact ID is required. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>");return p("Artifact ID is required. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>")}if(n.length>1){let i=n.slice(1).join(", ");if(t.json)return m(`Unexpected arguments: ${i}.`);return p(`Unexpected arguments: ${i}.`)}let o;if(t.format)o=Dt(t.format,["json","csv"],"Format",t.json);await jZ(r,{token:t.token,threadId:t["thread-id"],format:o,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();te();lT();import{spawn as lbe}from"node:child_process";var j={token:{type:"string"},"api-base-url":{type:"string"},json:{type:"boolean"}},_={token:{type:"string",description:"Override token"},"api-base-url":{type:"string",description:"Override API base URL"},json:{type:"boolean",description:"Output as JSON"}};ce();ie();Vt();var Bi=(e)=>{if(e==="flag")return"from flag";if(e==="environment")return"from environment";return"from settings"},hbe=async(e={})=>{let t=C({jsonMode:e.json}),n=z({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),r=w(await n.me(),"Couldn't fetch authentication details (run 'sazabi auth login' to sign in again)",e.json);if(e.json){E({credential:r,activeOrganizationId:t.organizationId,activeProjectId:t.projectId,tokenSource:t.tokenSource,organizationSource:t.organizationSource,projectSource:t.projectSource});return}if(Pe("Authentication"),r.credentialType==="user"){Se({Type:`User token (${Bi(t.tokenSource)})`,User:r.user.name??r.user.email,Email:r.user.email,"Active organization":t.organizationId&&t.organizationSource?`${t.organizationId} (${Bi(t.organizationSource)})`:lt("(none)"),"Active project":t.projectId&&t.projectSource?`${t.projectId} (${Bi(t.projectSource)})`:lt("(none)"),Organizations:r.organizations.length.toString(),"Dashboard URL":Ji()});return}if(r.credentialType==="secret"){Se({Type:`Secret key (${Bi(t.tokenSource)})`,Organization:r.organization.name,"Key name":r.keyName,"Active project":t.projectId&&t.projectSource?`${t.projectId} (${Bi(t.projectSource)})`:lt("(none)"),"Dashboard URL":Ji()});return}Se({Type:`Partner key (${Bi(t.tokenSource)})`,Superorganization:r.superorganization.name,"Dashboard URL":Ji()})},ube=async(e,t={})=>{let n=e.trim();if(!n){if(t.json)return m("Token is required.");return p("Token is required.")}let r=w(Re(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json);await pT({token:n,options:t,cliSettings:r,status:"saved"})},UZ=(e)=>{let t=process.platform,n,r;if(t==="darwin")n="open",r=[e];else if(t==="win32")n="cmd",r=["/c","start","",e];else n="xdg-open",r=[e];let o=lbe(n,r,{detached:!0,stdio:"ignore"});o.on("error",()=>{}),o.unref()},MZ=(e)=>new Promise((t)=>setTimeout(t,e)),gbe=async(e={})=>{let t=w(Re(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=In(t),r=t.profiles[n]??{},o=wT(r,e.apiBaseUrl),i=KZ(o,e.authBaseUrl??r.authBaseUrl),c;try{c=await cT({apiBaseUrl:i})}catch(y){let b=y instanceof Error?y.message:String(y);if(e.json)return m(`Failed to initiate sign-up: ${b}`);return p(`Failed to initiate sign-up: ${b}`)}let s=JZ({profile:r,publicApiBaseUrl:o,authBaseUrl:i,apiBaseUrlOverride:e.apiBaseUrl,authBaseUrlOverride:e.authBaseUrl,webBaseUrlOverride:e.webBaseUrl,verificationUriComplete:c.verificationUriComplete}),l=`/login/cli?user_code=${encodeURIComponent(c.userCode)}`,h=`${s}/sign-up?returnTo=${encodeURIComponent(l)}`,u=new Date(Date.now()+c.expiresIn*1000),d=c.interval*1000;if(!e.json)he(),Pe("Create a Sazabi account"),he(),yn(`Opening ${Ae.info(h)}`),he(),UZ(h),ae("Waiting for sign-up to complete...");while(new Date<u){await MZ(d);try{let y=await sT({apiBaseUrl:i,deviceCode:c.deviceCode});if(y.status==="pending"){d=(y.interval??c.interval)*1000;continue}if(y.status==="denied"){if(e.json)return m("Sign-up was denied.");return he(),p("Sign-up was denied.")}if(y.status==="expired"){if(e.json)return m("Sign-up request expired. Try again.");return he(),p("Sign-up request expired. Try again.")}await pT({token:y.accessToken,options:e,cliSettings:t,status:"authorized"});return}catch(y){let b=y instanceof Error?y.message:String(y);if(e.json)return m(`Sign-up failed: ${b}`);return he(),p(`Sign-up failed: ${b}`)}}if(e.json)return m("Sign-up request expired. Try again.");return he(),p("Sign-up request expired. Try again.")},dbe=async(e={})=>{let t=w(Re(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=In(t),r=t.profiles[n]??{},o=wT(r,e.apiBaseUrl),i=KZ(o,e.authBaseUrl??r.authBaseUrl),c;try{c=await cT({apiBaseUrl:i})}catch(d){let y=d instanceof Error?d.message:String(d);if(e.json)return m(`Failed to initiate login: ${y}`);return p(`Failed to initiate login: ${y}`)}let s=JZ({profile:r,publicApiBaseUrl:o,authBaseUrl:i,apiBaseUrlOverride:e.apiBaseUrl,authBaseUrlOverride:e.authBaseUrl,webBaseUrlOverride:e.webBaseUrl,verificationUriComplete:c.verificationUriComplete}),l=vbe(c.verificationUriComplete,s),h=new Date(Date.now()+c.expiresIn*1000),u=c.interval*1000;if(!e.json)he(),Pe("Sign in to Sazabi"),he(),yn("Enter this code in your browser:"),he(),yn(Ae.bold(c.userCode),4),he(),yn(`Opening ${Ae.info(l)}`),he(),UZ(l),ae("Waiting for authorization...");while(new Date<h){await MZ(u);try{let d=await sT({apiBaseUrl:i,deviceCode:c.deviceCode});if(d.status==="pending"){u=(d.interval??c.interval)*1000;continue}if(d.status==="denied"){if(e.json)return m("Authorization was denied.");return he(),p("Authorization was denied.")}if(d.status==="expired"){if(e.json)return m("Authorization request expired. Try again.");return he(),p("Authorization request expired. Try again.")}await pT({token:d.accessToken,options:e,cliSettings:t,status:"authorized"});return}catch(d){let y=d instanceof Error?d.message:String(d);if(e.json)return m(`Authorization failed: ${y}`);return he(),p(`Authorization failed: ${y}`)}}if(e.json)return m("Authorization request expired. Try again.");return he(),p("Authorization request expired. Try again.")},ybe=(e)=>{let t=w(Re(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=w(Rt(t),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",e.json),r=Boolean(n.token),o=w(Ut(t,{token:void 0,activeOrganizationId:void 0,organizationName:void 0,activeProjectId:void 0,...Hn(n)}),"Failed to update profile",e.json);if(w(Ye(o),"Failed to remove credentials",e.json),e.json){E({removed:r});return}if(r){X("Signed out.");return}ae("No credentials were saved.")},pT=async({token:e,options:t,cliSettings:n,status:r})=>{let o=In(n),i=n.profiles[o]??{},c=wT(i,t.apiBaseUrl),s=z({token:e,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),l=w(await s.me(),`Couldn't resolve authenticated context at ${c} (pass --api-base-url to target a different environment)`,t.json);if(r==="authorized"&&l.credentialType!=="user"){if(t.json)return m("Expected a user session from device authorization.");return p("Expected a user session from device authorization.")}let h=n.profiles[o]?n:{...n,profiles:{...n.profiles,[o]:{}}},u=h.profiles[o],d=await bbe({client:s,credential:l,currentProjectId:u.activeProjectId,jsonMode:t.json}),y=u.token!==e||u.activeOrganizationId!==d.activeOrganizationId||u.activeProjectId!==d.activeProjectId,b=w(Ut(h,{token:e,activeOrganizationId:d.activeOrganizationId,organizationName:d.activeOrganizationName,activeProjectId:d.activeProjectId,apiBaseUrl:t.apiBaseUrl??u.apiBaseUrl,authBaseUrl:t.authBaseUrl??u.authBaseUrl,webBaseUrl:t.webBaseUrl??u.webBaseUrl,...y&&Hn(u)}),"Failed to update profile",t.json);if(w(Ye(b),"Failed to save credentials",t.json),t.json){E({status:r,credential:l,activeOrganizationId:d.activeOrganizationId,activeProjectId:d.activeProjectId,projects:d.projects});return}if(he(),X(r==="authorized"?"Signed in.":"Token saved."),he(),pbe({credential:l,activeOrganizationName:d.activeOrganizationName,activeProjectId:d.activeProjectId,projects:d.projects}),d.projects.length>0){he(),Pe("Available projects");for(let f of d.projects){let T=f.id===d.activeProjectId?Ae.success(" (active)"):"";yn(`${f.name} (${f.region})${T}`)}}},bbe=async({client:e,credential:t,currentProjectId:n,jsonMode:r})=>{if(t.credentialType==="partner")return{projects:[]};let o=t.credentialType==="user"?t.activeOrganizationId??t.organizations[0]?.id:t.organization.id,i=t.credentialType==="user"?t.organizations.find((s)=>s.id===o)?.name:t.organization.name,c=o?w(await e.projects.list({organizationId:o}),"Couldn't fetch projects (check your organization access and try again)",r).projects:[];return{activeOrganizationId:o,activeOrganizationName:i,activeProjectId:mbe(c,n),projects:c}},mbe=(e,t)=>{if(t&&e.some((n)=>n.id===t))return t;return e[0]?.id},pbe=({credential:e,activeOrganizationName:t,activeProjectId:n,projects:r})=>{if(e.credentialType==="user"){Se({Type:"User token",User:e.user.name??e.user.email,Organizations:e.organizations.length.toString(),"Active organization":t??"(none)","Active project":r.find((o)=>o.id===n)?.name??"(none)"});return}if(e.credentialType==="secret"){Se({Type:"Secret key",Organization:e.organization.name,"Key name":e.keyName,"Active project":r.find((o)=>o.id===n)?.name??"(none)"});return}Se({Type:"Partner key",Superorganization:e.superorganization.name})},wT=(e,t)=>{return Tn({cliFlag:t,globalUrl:e.apiBaseUrl,globalDomain:e.apiDomain,buildUrlFromDomain:(n)=>`https://api.${n}`,defaultUrl:"https://api.sazabi.com"})},KZ=(e,t)=>{if(t)return t;try{let n=new URL(e);if(["localhost","127.0.0.1"].includes(n.hostname)&&["15005","15009"].includes(n.port))return n.port="15001",n.toString().replace(/\/$/,"");if(n.hostname==="api.sazabi.com")return n.hostname="api.platform.sazabi.com",n.toString().replace(/\/$/,"");if(n.hostname==="api.staging.sazabi.dev")return n.hostname="api.platform.staging.sazabi.dev",n.toString().replace(/\/$/,"");return n.toString().replace(/\/$/,"")}catch{return e}},GZ=(e)=>e.replace(/\/+$/,""),Mt=(e)=>(e?.trim().length??0)>0,wbe=(e)=>{if(!Mt(e))return;try{let t=new URL(e);return`${t.protocol}//${t.host}`}catch{return}},qi=(e)=>{if(!Mt(e))return;try{let n=new URL(e).hostname.toLowerCase();if(["localhost","127.0.0.1"].includes(n))return"https://localhost:5173";if(["api.staging.sazabi.dev","api.platform.staging.sazabi.dev"].includes(n))return"https://app.staging.sazabi.dev";if(["api.sazabi.com","api.platform.sazabi.com"].includes(n))return"https://app.sazabi.com"}catch{return}return},fbe=(e)=>{if(Mt(e.webBaseUrl))return GZ(e.webBaseUrl);if(Mt(e.webDomain))return Qg(e.webDomain);return},kbe=({profile:e,publicApiBaseUrl:t})=>{if(!(Mt(e.authBaseUrl)||Mt(e.apiBaseUrl)||Mt(e.apiDomain)))return;if(Mt(e.authBaseUrl)){let r=qi(e.authBaseUrl);if(r)return r}return qi(t)},JZ=({profile:e,publicApiBaseUrl:t,authBaseUrl:n,apiBaseUrlOverride:r,authBaseUrlOverride:o,webBaseUrlOverride:i,verificationUriComplete:c})=>{if(Mt(i))return GZ(i);let s=process.env.SAZABI_API_URL?.trim(),l=Mt(o)||Mt(r)||Mt(s),h=wbe(c);if(l){let y=Mt(o)?qi(n):qi(t);if(y)return y;if(h)return h}let u=fbe(e);if(u)return u;let d=kbe({profile:e,publicApiBaseUrl:t});if(d)return d;if(h)return h;return"https://app.sazabi.com"},vbe=(e,t)=>{if(!t)return e;try{let n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.host=r.host,n.toString()}catch{return e}},BZ=V("auth","Manage authentication credentials").withSubcommands({signup:P("signup","Create a new Sazabi account via browser",async(e)=>{let{values:t,positionals:n}=$(e,{...j,"auth-base-url":{type:"string"},"web-base-url":{type:"string"}},{allowPositionals:!0});if(n.length>0){let r=n.join(", ");if(t.json)return m(`Unexpected arguments: ${r}.`);return p(`Unexpected arguments: ${r}.`)}await gbe({json:t.json,apiBaseUrl:t["api-base-url"],authBaseUrl:t["auth-base-url"],webBaseUrl:t["web-base-url"]})}).withOptions({..._,"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:P("login","Authenticate via browser",async(e)=>{let{values:t,positionals:n}=$(e,{...j,"auth-base-url":{type:"string"},"web-base-url":{type:"string"}},{allowPositionals:!0});if(n.length>0){let r=n.join(", ");if(t.json)return m(`Unexpected arguments: ${r}.`);return p(`Unexpected arguments: ${r}.`)}await dbe({json:t.json,apiBaseUrl:t["api-base-url"],authBaseUrl:t["auth-base-url"],webBaseUrl:t["web-base-url"]})}).withOptions({..._,"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:P("save","Save an existing bearer token",async(e)=>{let{values:t,positionals:n}=$(e,{...j,"web-base-url":{type:"string"}},{allowPositionals:!0}),r=n[0];if(!r){if(t.json)return m("Token is required.");return p("Token is required.")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return m(`Unexpected arguments: ${o}.`);return p(`Unexpected arguments: ${o}.`)}await ube(r,{json:t.json,apiBaseUrl:t["api-base-url"],webBaseUrl:t["web-base-url"]})}).withPositionalArgs("<token>").withOptions({..._,"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:P("logout","Remove saved credentials",async(e)=>{let{values:t,positionals:n}=$(e,j,{allowPositionals:!0});if(n.length>0){let r=n.join(", ");if(t.json)return m(`Unexpected arguments: ${r}.`);return p(`Unexpected arguments: ${r}.`)}ybe({json:t.json})}).withOptions(_).withExamples(["sazabi auth logout # Remove saved credentials"]).build(),whoami:P("whoami","Display current authentication context",async(e)=>{let{values:t,positionals:n}=$(e,j,{allowPositionals:!0});if(n.length>0){let r=n.join(", ");if(t.json)return m(`Unexpected arguments: ${r}.`);return p(`Unexpected arguments: ${r}.`)}await hbe({json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions(_).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();te();ce();ie();var ss=(e)=>({id:e.id,name:e.name,status:e.enabled?"active":"paused",source:e.source,kind:e.kind,health:e.health,cronExpression:e.cronExpression,timezone:e.timezone,timeoutSeconds:e.timeoutSeconds,successRate:e.successRate,runCount:e.runCount,failedRunCount:e.failedRunCount,lastRunStatus:e.lastRun?.status??null,lastRunAt:e.lastRun?.startedAt??null,scriptIdentifier:"scriptIdentifier"in e?e.scriptIdentifier:null,scriptId:"scriptId"in e?e.scriptId:null,scriptName:"scriptName"in e?e.scriptName:null,canToggle:"canToggle"in e?e.canToggle:null,createdAt:"createdAt"in e?e.createdAt:null,updatedAt:"updatedAt"in e?e.updatedAt:null}),HZ={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:(e)=>e==="active"?"Enabled":"Disabled",serialize:(e)=>e}},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:(e)=>e==null?"(none)":String(e),serialize:(e)=>e}},successRate:{label:"Success rate",type:{kind:"custom",render:(e)=>e==null?"(n/a)":`${Math.round(Number(e)*100)}%`,serialize:(e)=>e}},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:(e)=>e==null?"(n/a)":e?"yes":"no",serialize:(e)=>e}},createdAt:{label:"Created at",type:{kind:"nullable-date"}},updatedAt:{label:"Updated at",type:{kind:"nullable-date"}}},Pbe={schema:HZ,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."},ed={layout:"field-list",schema:HZ,fields:["id","url","name","status","source","kind","health","cronExpression","timezone","timeoutSeconds","successRate","runCount","failedRunCount","lastRunStatus","lastRunAt","scriptIdentifier","scriptId","scriptName","canToggle","createdAt","updatedAt"],title:"Automation"},EZ=(e)=>({id:e.id,automationRunKey:e.automationRunKey,status:e.status,scheduledAt:e.scheduledAt,dueAt:e.dueAt,startedAt:e.startedAt,completedAt:e.completedAt,durationMs:e.durationMs,exitCode:e.exitCode,errorMessage:e.errorMessage,automationId:"automationId"in e?e.automationId:null}),WZ={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:(e)=>e==null?"(n/a)":String(e),serialize:(e)=>e}},exitCode:{label:"Exit code",type:{kind:"custom",render:(e)=>e==null?"(n/a)":String(e),serialize:(e)=>e}},errorMessage:{label:"Error",type:{kind:"nullable-string",emptyLabel:"(none)"}}},Sbe={schema:WZ,columns:["status","startedAt","durationMs","exitCode"],jsonFields:["id","automationRunKey","status","scheduledAt","dueAt","startedAt","completedAt","durationMs","exitCode","errorMessage"],header:"Automation runs",emptyMessage:"No automation runs found."},$be={layout:"field-list",schema:WZ,fields:["id","automationId","automationRunKey","status","scheduledAt","dueAt","startedAt","completedAt","durationMs","exitCode","errorMessage"],title:"Automation run"},Ibe=(e)=>({status:e.status,exitCode:e.exitCode,truncated:e.truncated,durationMs:e.durationMs,startedAt:e.startedAt,completedAt:e.completedAt,stdout:e.stdout,stderr:e.stderr}),Tbe={status:{label:"Status",type:{kind:"string"}},exitCode:{label:"Exit code",type:{kind:"custom",render:(e)=>e==null?"(n/a)":String(e),serialize:(e)=>e}},truncated:{label:"Truncated",type:{kind:"custom",render:(e)=>e?"yes":"no",serialize:(e)=>e}},durationMs:{label:"Duration (ms)",type:{kind:"custom",render:(e)=>e==null?"(n/a)":String(e),serialize:(e)=>e}},startedAt:{label:"Started at",type:{kind:"nullable-date"}},completedAt:{label:"Completed at",type:{kind:"nullable-date"}},stdout:{label:"Stdout",type:{kind:"custom",render:(e)=>e?String(e):"(empty)",serialize:(e)=>e}},stderr:{label:"Stderr",type:{kind:"custom",render:(e)=>e?String(e):"(empty)",serialize:(e)=>e}}},Abe={layout:"field-list",schema:Tbe,fields:["status","exitCode","truncated","durationMs","startedAt","completedAt","stdout","stderr"],title:"Automation run logs"},fo=(e)=>{let t=C({tokenFlag:e.token,projectIdFlag:e.projectId,jsonMode:e.json});return{client:z({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),projectId:t.projectId}},td=(e,t)=>t?{...e,url:SZ(t,e.id)}:e,Obe=async(e)=>{let{client:t}=fo(e),n=w(await t.automations.list({search:e.search,status:e.status,source:e.source,health:e.health,sort:e.sort,limit:e.limit,cursor:e.cursor}),"Couldn't list automations (check the active project and try again)",e.json);q(Pbe,n.automations.map(ss),{json:e.json,nextCursor:n.nextCursor})},Lbe=async(e,t)=>{let{client:n,projectId:r}=fo(t),o=w(await n.automations.get(e),"Couldn't get automation (run 'sazabi automations list' to see automation IDs)",t.json);N(ed,td(ss(o.automation),r),{json:t.json})},Cbe=async(e,t)=>{let n=t.scriptId!==void 0,r=t.script!==void 0,o=t.expressionId!==void 0,i=Number(n)+Number(r)+Number(o),c=(u)=>{if(t.json){m(u);return}p(u)};if(i!==1){c("Provide exactly one of --script-id, --script, or --expression-id.");return}if(o){if(t.cronExpression!==void 0||t.timezone!==void 0||t.timeoutSeconds!==void 0){c("Cron and timeout flags are not used with --expression-id log-match automations.");return}if(!t.description?.trim()){c("--description is required for log-match automations (investigation instructions).");return}}let{client:s,projectId:l}=fo(t),h=w(await s.automations.create({name:e,...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}:{}}),o?"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)X(`Automation "${h.automation.name}" created.`);N(ed,td(ss(h.automation),l),{json:t.json})},Dbe=async(e,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){m("Nothing to update. Provide --name, --description, --clear-description, --cron-expression, --timezone, or --timeout-seconds.");return}p("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){m("Use either --description or --clear-description, not both.");return}p("Use either --description or --clear-description, not both.");return}let{client:n,projectId:r}=fo(t),o=w(await n.automations.update({automationId:e,...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)X(`Automation "${o.automation.name}" updated.`);N(ed,td(ss(o.automation),r),{json:t.json})},ZZ=async(e,t,n)=>{let{client:r,projectId:o}=fo(n),i=w(t?await r.automations.enable(e):await r.automations.disable(e),t?"Failed to enable automation":"Failed to disable automation",n.json),c=td(ss(i.automation),o);if(!n.json)X(`Automation "${c.name}" is now ${t?"enabled":"disabled"}.`);N(ed,c,{json:n.json})},zbe=async(e,t)=>ZZ(e,!0,t),_be=async(e,t)=>ZZ(e,!1,t),jbe=async(e,t)=>{let{client:n}=fo(t),r=w(await n.automations.runs.list(e,{status:t.status,limit:t.limit,cursor:t.cursor}),"Couldn't list automation runs (run 'sazabi automations list' to see automation IDs)",t.json);q(Sbe,r.runs.map(EZ),{json:t.json,nextCursor:r.nextCursor})},Nbe=async(e,t,n)=>{let{client:r}=fo(n),o=w(await r.automations.runs.get(e,t),"Couldn't get automation run (run 'sazabi automations runs list <automation-id>' to see run IDs)",n.json);N($be,EZ(o.run),{json:n.json})},xbe=async(e,t,n)=>{let{client:r}=fo(n),o=w(await r.automations.runs.logs(e,t),"Couldn't get automation run logs (run 'sazabi automations runs list <automation-id>' to see run IDs)",n.json);N(Abe,Ibe(o.logs),{json:n.json})},En={...j,"project-id":{type:"string"}},Wn={..._,"project-id":{type:"string",description:"Override active project ID"}},Rbe=(e,t)=>{let n=e[0];if(!n){if(t){m("Automation name is required.");return}p("Automation name is required.");return}return n},Qo=(e,t)=>{let n=e[0];if(!n){if(t){m("Automation ID is required.");return}p("Automation ID is required.");return}return n},qZ=(e,t)=>{let n=e[1];if(!n){if(t){m("Run ID is required.");return}p("Run ID is required.");return}return n},XZ=V("automations","Manage scheduled automations").withSubcommands({list:P("list","List automations in the active project",async(e)=>{let{values:t}=$(e,{...En,search:{type:"string"},status:{type:"string"},source:{type:"string"},health:{type:"string"},sort:{type:"string"},limit:{type:"string"},cursor:{type:"string"}}),n=(u)=>{if(t.json){m(u);return}p(u)},r=t.status;if(r!==void 0&&r!=="active"&&r!=="paused")return n(`Invalid --status value "${r}". Expected "active" or "paused".`);let o=t.source;if(o!==void 0&&o!=="sazabi_managed"&&o!=="custom")return n(`Invalid --source value "${o}". Expected "sazabi_managed" or "custom".`);let i=t.health,c=["healthy","failing","never_run"];if(i!==void 0&&!c.includes(i))return n(`Invalid --health value "${i}". Expected one of: ${c.join(", ")}.`);let s=t.sort,l=["name","last_run","failures","runs"];if(s!==void 0&&!l.includes(s))return n(`Invalid --sort value "${s}". Expected one of: ${l.join(", ")}.`);let h;if(t.limit!==void 0){if(h=Number(t.limit),!Number.isInteger(h)||h<1||h>100)return n(`Invalid --limit value "${t.limit}". Expected an integer between 1 and 100.`)}await Obe({token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],search:t.search,status:r,source:o,health:i,sort:s,limit:h,cursor:t.cursor})}).withOptions({...Wn,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:P("get","Get one automation by ID",async(e)=>{let{values:t,positionals:n}=$(e,En,{allowPositionals:!0}),r=Qo(n,t.json);if(!r)return;await Lbe(r,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id>").withOptions(Wn).withExamples(["sazabi automations get <automation-id> # Get one automation"]).build(),create:P("create","Create an automation",async(e)=>{let{values:t,positionals:n}=$(e,{...En,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}),r=Rbe(n,t.json);if(!r)return;let o=(c)=>{if(t.json){m(c);return}p(c)},i;if(t["timeout-seconds"]!==void 0){if(i=Number(t["timeout-seconds"]),!Number.isInteger(i)||i<1||i>3600)return o(`Invalid --timeout-seconds value "${t["timeout-seconds"]}". Expected an integer between 1 and 3600.`)}await Cbe(r,{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:i,enabled:t.enabled})}).withPositionalArgs("<name>").withOptions({...Wn,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:P("update","Update an automation",async(e)=>{let{values:t,positionals:n}=$(e,{...En,name:{type:"string"},description:{type:"string"},"clear-description":{type:"boolean"},"cron-expression":{type:"string"},timezone:{type:"string"},"timeout-seconds":{type:"string"}},{allowPositionals:!0}),r=Qo(n,t.json);if(!r)return;let o=(c)=>{if(t.json){m(c);return}p(c)},i;if(t["timeout-seconds"]!==void 0){if(i=Number(t["timeout-seconds"]),!Number.isInteger(i)||i<1||i>3600)return o(`Invalid --timeout-seconds value "${t["timeout-seconds"]}". Expected an integer between 1 and 3600.`)}await Dbe(r,{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:i})}).withPositionalArgs("<automation-id>").withOptions({...Wn,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:P("enable","Enable an automation",async(e)=>{let{values:t,positionals:n}=$(e,En,{allowPositionals:!0}),r=Qo(n,t.json);if(!r)return;await zbe(r,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id>").withOptions(Wn).withExamples(["sazabi automations enable <automation-id> # Enable an automation"]).build(),disable:P("disable","Disable an automation",async(e)=>{let{values:t,positionals:n}=$(e,En,{allowPositionals:!0}),r=Qo(n,t.json);if(!r)return;await _be(r,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id>").withOptions(Wn).withExamples(["sazabi automations disable <automation-id> # Disable an automation"]).build(),runs:P("runs","Inspect automation runs").withSubcommands({list:P("list","List runs for an automation",async(e)=>{let{values:t,positionals:n}=$(e,{...En,status:{type:"string"},limit:{type:"string"},cursor:{type:"string"}},{allowPositionals:!0}),r=Qo(n,t.json);if(!r)return;let o=(l)=>{if(t.json){m(l);return}p(l)},i=t.status,c=["running","succeeded","failed","timed_out","cancelled"];if(i!==void 0&&!c.includes(i))return o(`Invalid --status value "${i}". Expected one of: ${c.join(", ")}.`);let s;if(t.limit!==void 0){if(s=Number(t.limit),!Number.isInteger(s)||s<1||s>100)return o(`Invalid --limit value "${t.limit}". Expected an integer between 1 and 100.`)}await jbe(r,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],status:i,limit:s,cursor:t.cursor})}).withPositionalArgs("<automation-id>").withOptions({...Wn,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:P("get","Get one automation run by ID",async(e)=>{let{values:t,positionals:n}=$(e,En,{allowPositionals:!0}),r=Qo(n,t.json);if(!r)return;let o=qZ(n,t.json);if(!o)return;await Nbe(r,o,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id> <run-id>").withOptions(Wn).withExamples(["sazabi automations runs get <automation-id> <run-id> # Get one automation run"]).build(),logs:P("logs","Get the captured logs for an automation run",async(e)=>{let{values:t,positionals:n}=$(e,En,{allowPositionals:!0}),r=Qo(n,t.json);if(!r)return;let o=qZ(n,t.json);if(!o)return;await xbe(r,o,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<automation-id> <run-id>").withOptions(Wn).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();te();ce();ie();var fT=(e)=>{let t=e.json,n=C({tokenFlag:e.token,jsonMode:t});return{client:z({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:e["api-base-url"],jsonMode:t}),json:t??!1}},Ube={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"}}},Mbe={layout:"field-list",schema:Ube,fields:["plan","status","currency","balance","targetBalance","cycle","estimate","pendingDowngrade"]},Kbe=(e)=>({plan:e.planName??"—",status:e.status,currency:e.currency??"—",balance:e.currentBalance??"—",targetBalance:e.targetCreditBalance??"—",cycle:e.currentCycle?`${e.currentCycle.startsAt.slice(0,10)} - ${e.currentCycle.endsAt.slice(0,10)}`:"—",estimate:e.currentPeriodEstimate?`${e.currentPeriodEstimate.totalAmount} ${e.currentPeriodEstimate.currency}`:"—",pendingDowngrade:e.pendingDowngrade?`${e.pendingDowngrade.planName??"—"} (effective ${e.pendingDowngrade.effectiveAt.slice(0,10)})`:"—"}),Gbe=async(e)=>{let{values:t}=$(e,j),{client:n,json:r}=fT(t),o=w(await n.billing.getSummary(),"Couldn't fetch billing summary (check your organization access and try again)",r);if(!r){if(Pe("Billing summary"),!o.billable&&o.nonBillableReason)Se({"Not billable":o.nonBillableReason})}N(Mbe,Kbe(o),{json:r})},Jbe={logs_ingested_bytes:"Log data (GB)",input_tokens:"Input tokens",output_tokens:"Output tokens"},Bbe=(e)=>{let t=Number.parseFloat(e);if(Number.isNaN(t))return e;return(t/1e9).toFixed(3)},qbe=(e,t)=>{if(t==="logs_ingested_bytes")return Bbe(e);let n=Number.parseInt(e,10);return Number.isNaN(n)?e:n.toLocaleString()},Hbe={dimension:{label:"Dimension",type:{kind:"string"}},total:{label:"Total quantity",type:{kind:"string"}},credits:{label:"Credits consumed",type:{kind:"string"}}},Ebe={schema:Hbe,columns:["dimension","total","credits"],emptyMessage:"No usage recorded for this billing cycle."},Wbe=async(e)=>{let{values:t}=$(e,{...j,cycle:{type:"string"}}),{client:n,json:r}=fT(t);if(t.cycle&&t.cycle!=="current"&&t.cycle!=="previous"){if(r)return m("--cycle must be 'current' or 'previous'.");p("--cycle must be 'current' or 'previous'.");return}let o=t.cycle??"current",i=w(await n.billing.getUsage({cycle:o}),"Couldn't fetch billing usage (check your organization access and try again)",r);if(!r){if(Pe(`Billing usage (${o} cycle)`),i.cycle)Se({Cycle:`${i.cycle.startsAt.slice(0,10)} - ${i.cycle.endsAt.slice(0,10)}`})}let c=i.usage.map((s)=>{let l=s.dimension;return{dimension:Jbe[l]??s.dimension,total:qbe(s.totalQuantity,l),credits:s.creditsConsumed}});q(Ebe,c,{json:r})},Zbe={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"}}},Xbe={schema:Zbe,columns:["occurredAt","type","delta","balance"],emptyMessage:"No billing transactions found."},Ybe=async(e)=>{let{values:t}=$(e,{...j,limit:{type:"string"},page:{type:"string"}}),{client:n,json:r}=fT(t),o,i;if(t.limit){if(o=Number.parseInt(t.limit,10),Number.isNaN(o)||o<1||o>100){if(r)return m("--limit must be a positive integer (max 100).");p("--limit must be a positive integer (max 100).");return}}if(t.page){if(i=Number.parseInt(t.page,10),Number.isNaN(i)||i<1){if(r)return m("--page must be a positive integer.");p("--page must be a positive integer.");return}}let c=w(await n.billing.listTransactions({limit:o??10,page:i??1}),"Couldn't fetch billing transactions (check your organization access and try again)",r);if(!r)Pe("Billing transactions");let s=c.items.map((l)=>({occurredAt:l.occurredAt,type:l.transactionType,delta:l.creditDelta,balance:l.balanceAfter}));if(q(Xbe,s,{json:r,count:c.pagination.total}),!r&&c.pagination.hasNext){let l=(i??1)+1;Se({"Next page":`Use --page ${l} for more results.`})}},Fbe=P("summary","Show the billing summary for your organization",async(e)=>{await Gbe(e)}).withOptions(_).withExamples(["sazabi billing summary # Show billing summary","sazabi billing summary --json # Output as JSON"]).build(),Qbe=P("usage","Show per-dimension usage for the current or previous cycle",async(e)=>{await Wbe(e)}).withOptions({..._,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(),Vbe=P("transactions","List recent credit ledger transactions",async(e)=>{await Ybe(e)}).withOptions({..._,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(),YZ=V("billing","View billing summary, usage, and transactions").withSubcommands({summary:Fbe,usage:Qbe,transactions:Vbe}).withExamples(["sazabi billing summary # Show billing plan and balance","sazabi billing usage # Show usage for current cycle","sazabi billing transactions # List recent transactions"]).build();te();var FZ=()=>`
|