@sazabi/cli 0.14.1-dev.g7ced9d5 → 0.14.1-dev.g85febdc
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 +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8555,7 +8555,7 @@ The Context Company hosts a Streamable HTTP MCP server at \`https://api.theconte
|
|
|
8555
8555
|
- A read-only API key from the [MCP access documentation](https://docs.thecontext.company/access-data/mcp)
|
|
8556
8556
|
`.trim()});import{dirname as Vre,resolve as eae}from"node:path";import{fileURLToPath as tae}from"node:url";var nae,wx,vx,oae,fx,iae,rae,aae,kx;var QI=g(()=>{fe();wl();nae=eae(Vre(tae(import.meta.url)),"../../../skills"),wx=["airbyte","atlassian","attio","autumn","aws","axiom","better-stack","braintrust","calendly","cekura","checkly","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"],vx=c.enum(wx),oae=c.object({readOnlyToolNames:c.array(c.string()).optional(),blockedToolNames:c.array(c.string()).optional(),defaultUnavailableReason:c.enum(ml).optional(),allowWriteTools:c.boolean().optional()}),fx=c.object({registrationEndpoint:c.string().url(),tokenEndpointAuthMethod:c.enum(pl).optional(),includeScopesInRegistration:c.boolean().optional()}),iae=c.object({providerConfigKey:c.string().min(1),callbackPathSegment:c.string().min(1),authorizationUrl:c.string().url().optional(),tokenUrl:c.string().url().optional(),resourceUrl:c.string().url().optional(),useServerUrlAsResource:c.boolean().optional(),omitScopeFromAuthorizationUrl:c.boolean().optional(),authorizationUrlParams:c.record(c.string(),c.string()).optional(),dynamicClientRegistration:fx.optional()}),rae=c.object({label:c.string().min(1),serverUrl:c.string().url(),authorizationUrl:c.string().url().optional(),tokenUrl:c.string().url().optional(),resourceUrl:c.string().url().optional(),dynamicClientRegistration:fx.optional()}),aae=c.object({id:c.string().min(1),title:c.string().min(1),description:c.string().optional(),body:c.string().min(1),fieldKeys:c.array(c.string().min(1)).optional(),imageKeys:c.array(c.string().min(1)).optional()}),kx=c.object({id:c.string().min(1),label:c.string().min(1),iconKey:vx,defaultServerUrl:c.string().url().nullable(),serverUrlPathSuffixMaxSegments:c.number().int().positive().optional(),transport:c.enum(Mf),authMode:c.enum(Yf),availability:c.enum(Xi),oauth:iae.optional(),regions:c.array(rae).optional(),capabilityOverrides:oae.optional(),helpText:c.string().optional(),setupGroups:c.array(aae).optional(),evidenceHints:c.array(c.string().min(1)).optional(),skill:c.string().min(1).optional(),setupSkill:c.string().min(1).optional(),scopesUserSelectable:c.boolean().optional()})});var C=(e)=>{return{...kx.parse(e),...e.getAvailableScopes?{getAvailableScopes:e.getAvailableScopes}:{},...e.getUrlConfiguration?{getUrlConfiguration:e.getUrlConfiguration}:{},...e.validateCredentials?{validateCredentials:e.validateCredentials}:{},...e.normalizeHeaders?{normalizeHeaders:e.normalizeHeaders}:{}}};var F=g(()=>{QI()});var Ix;var Ox=g(()=>{F();Ix=C({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:"Give agents authenticated access to your connected third-party platforms (CRM, support, analytics, and more) to read and write records on your behalf.",skill:"airbyte",setupSkill:"airbyte-setup"})});var Px;var Sx=g(()=>{F();Px=C({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.",skill:"atlassian",setupSkill:"atlassian-setup"})});var $x;var Tx=g(()=>{F();$x=C({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.",skill:"attio",setupSkill:"attio-setup"})});var Ax;var Cx=g(()=>{F();Ax=C({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:sx,normalizeHeaders:ax})});var VI,B4e,Lx;var eO=g(()=>{F();VI=[{value:"us-east-1",label:"US East (N. Virginia) — us-east-1"},{value:"eu-central-1",label:"Europe (Frankfurt) — eu-central-1"}],B4e=new Set(VI.map((e)=>e.value)),Lx=C({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 Dx;var zx=g(()=>{F();Dx=C({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()=>null,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 Nx;var _x=g(()=>{F();Nx=C({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, and build telemetry queries to investigate production issues."})});var jx;var Rx=g(()=>{F();jx=C({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. The hosted MCP server lives at `https://api.braintrust.dev/mcp` (use `https://api-eu.braintrust.dev/mcp` if your data lives in the EU data plane).",fieldKeys:["apiKey"]}],validateCredentials:HK,normalizeHeaders:qK})});var Ux;var Ex=g(()=>{F();Ux=C({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 Kx;var xx=g(()=>{F();Kx=C({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:"Create or copy a project-scoped Cekura [API key](https://dashboard.cekura.ai/settings/org/api-key) when possible, then paste it below.",fieldKeys:["apiKey"]}],validateCredentials:px})});var Gx;var Bx=g(()=>{F();Gx=C({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 Jx;var qx=g(()=>{F();Jx=C({id:"circleback",label:"Circleback",iconKey:"plug",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 Circleback meeting notes, transcripts, action items, and calendar/email context."})});var Hx;var Wx=g(()=>{F();Hx=C({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."})});var Mx;var Yx=g(()=>{F();Mx=C({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 Xx;var Zx=g(()=>{F();Xx=C({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:"Query Cloudflare Workers observability logs and analytics, bindings (D1, R2, KV), builds, and Radar insights."})});var Fx;var Qx=g(()=>{F();Fx=C({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.",imageKeys:["mcp.cloudflare-api-token.create-token"],body:"In the Cloudflare dashboard, go to **My Profile > API Tokens > Create Token**. Use a template or **Create Custom Token**, grant the permissions you want the agent to use (for example Workers Observability, DNS, or Account 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:KK,normalizeHeaders:EK})});var Vx;var e0=g(()=>{F();Vx=C({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:"Connect to Composio's hosted MCP server and use tools from your configured toolkit with a Composio API key.",setupGroups:[{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:"Create or copy an API key from the [Composio dashboard](https://app.composio.dev/settings) and 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:tx,normalizeHeaders:ex})});var t0;var n0=g(()=>{F();t0=C({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:rx,normalizeHeaders:ix,skill:"context-dev",setupSkill:"context-dev-setup"})});var o0;var i0=g(()=>{F();o0=C({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 r0;var a0=g(()=>{F();r0=C({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.",fieldKeys:["apiKey","applicationKey"]}],validateCredentials:UK,normalizeHeaders:jK})});var c0;var s0=g(()=>{F();c0=C({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 h0;var l0=g(()=>{F();h0=C({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, create an API key with the Agent Builder and index read privileges required by Elastic's MCP server, then copy the generated key.",fieldKeys:["apiKey"]}],validateCredentials:RK,normalizeHeaders:_K})});var u0;var g0=g(()=>{F();u0=C({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:VK,normalizeHeaders:QK,skill:"exa",setupSkill:"exa-setup"})});var d0;var y0=g(()=>{F();d0=C({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:bx,normalizeHeaders:yx})});var b0;var p0=g(()=>{F();b0=C({id:"google-drive",label:"Google Drive",iconKey:"google-drive",defaultServerUrl:"https://drivemcp.googleapis.com/mcp/v1",transport:"streamable-http",authMode:"oauth",availability:"enabled",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(`
|
|
8557
8557
|
`)}],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."})});var m0;var w0=g(()=>{F();m0=C({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 v0;var f0=g(()=>{F();v0=C({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()=>[],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 k0;var I0=g(()=>{F();k0=C({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 O0;var P0=g(()=>{F();O0=C({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, triggers, and run queries."})});var S0;var $0=g(()=>{F();S0=C({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 T0;var A0=g(()=>{F();T0=C({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:MK,normalizeHeaders:WK})});var C0;var L0=g(()=>{F();C0=C({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:hx,normalizeHeaders:cx})});var D0;var z0=g(()=>{F();D0=C({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."})});var N0;var _0=g(()=>{F();N0=C({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 manage Linear issues and projects."})});var j0;var R0=g(()=>{F();j0=C({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, dashboards, and schedules."})});var U0;var E0=g(()=>{F();U0=C({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."}],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."})});var K0;var x0=g(()=>{F();K0=C({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:"Start with https://mcp.neon.tech/mcp. To narrow access, append query params such as `?readonly=true`, `&projectId=<id>`, and/or `&category=<groups>`, then copy the resulting Server URL.",defaultServerUrl:"https://mcp.neon.tech/mcp",imageKeys:["mcp.neon.projects-console","mcp.neon.project-settings-details"],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 G0;var B0=g(()=>{F();G0=C({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."})});var J0;var q0=g(()=>{F();J0=C({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 H0;var W0=g(()=>{F();H0=C({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."})});var M0;var Y0=g(()=>{F();M0=C({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 X0;var Z0=g(()=>{F();X0=C({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 F0;var Q0=g(()=>{F();F0=C({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"},{value:"user:write"},{value:"organization:read"},{value:"project:read"},{value:"project:write"},{value:"survey:read"},{value:"survey:write"},{value:"error_tracking:read"},{value:"logs:read"},{value:"tracing:read"}],getUrlConfiguration:async()=>({docsUrl:"https://posthog.com/docs/model-context-protocol/faq",instructions:"Add ?features=<groups> or ?tools=<names> to limit which tools are exposed (e.g. https://mcp.posthog.com/mcp?features=flags,workspace), then copy the Server URL.",defaultServerUrl:"https://mcp.posthog.com/mcp",imageKeys:["mcp.posthog.settings-page"],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 V0;var eG=g(()=>{F();V0=C({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 tG;var nG=g(()=>{F();tG=C({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 oG;var iG=g(()=>{F();oG=C({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.",fieldKeys:["apiKey"]}],validateCredentials:XK,normalizeHeaders:YK})});var rG;var aG=g(()=>{F();rG=C({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.",fieldKeys:["apiKey"]}],validateCredentials:ox,normalizeHeaders:nx,skill:"rentahuman",setupSkill:"rentahuman-setup"})});var cG;var sG=g(()=>{F();cG=C({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. 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:ux,normalizeHeaders:lx,skill:"resend",setupSkill:"resend-setup"})});var hG;var lG=g(()=>{F();hG=C({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:dx,normalizeHeaders:gx,skill:"respan",setupSkill:"respan-setup"})});var uG;var gG=g(()=>{F();uG=C({id:"salesforce",label:"Salesforce",iconKey:"salesforce",defaultServerUrl:"https://api.salesforce.com/platform/mcp/v1/platform/sobject-all",transport:"streamable-http",authMode:"oauth",availability:"enabled",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(`
|
|
8558
|
-
`)}],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."})});var dG;var yG=g(()=>{F();dG=C({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 `https://mcp.sentry.dev/mcp` for broad access. To scope this connection to one organization or project, copy a path-scoped URL such as `https://mcp.sentry.dev/mcp/your-org` or `https://mcp.sentry.dev/mcp/your-org/your-project`.",defaultServerUrl:"https://mcp.sentry.dev/mcp",imageKeys:["mcp.sentry.url-configuration-page"],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 bG;var pG=g(()=>{F();bG=C({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:FK,normalizeHeaders:ZK})});var mG;var wG=g(()=>{F();mG=C({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 vG;var fG=g(()=>{F();vG=C({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 kG;var IG=g(()=>{F();kG=C({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 OG;var PG=g(()=>{F();OG=C({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:"Create a read-only API key in [The Context Company](https://docs.thecontext.company/access-data/mcp), then paste the raw key below. Sazabi sends it as `Authorization: Bearer <key>` to `https://api.thecontext.company/mcp`.",fieldKeys:["apiKey"]}],validateCredentials:BK,normalizeHeaders:GK,skill:"the-context-company",setupSkill:"the-context-company-setup"})});var SG;var $G=g(()=>{F();SG=C({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."})});var TG;var AG=g(()=>{F();TG=C({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 an X API OAuth 2.0 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:"Create an OAuth 2.0 Bearer token",description:"Generate the OAuth 2.0 access token the hosted MCP server will use.",body:"In your app's **Keys and tokens**, generate an OAuth 2.0 access token and copy it. Paste the raw token into Sazabi — Sazabi adds the `Bearer ` prefix and sends it in the `Authorization` header.",fieldKeys:["accessToken"]}],validateCredentials:JK,normalizeHeaders:xK,skill:"x",setupSkill:"x-setup"})});var CG,l6e;var LG=g(()=>{Ox();Sx();Tx();Cx();eO();eO();zx();_x();Rx();Ex();xx();Bx();qx();Wx();Yx();Zx();Qx();e0();n0();i0();a0();s0();l0();g0();y0();p0();w0();f0();I0();P0();$0();A0();L0();z0();_0();R0();E0();x0();B0();q0();W0();Y0();Z0();Q0();eG();nG();iG();aG();sG();lG();gG();yG();pG();wG();fG();IG();PG();$G();AG();CG=[vG,r0,c0,Ix,Px,$x,Ax,Lx,Dx,Nx,jx,Ux,Kx,Gx,Hx,Mx,Xx,Fx,Jx,Vx,t0,h0,u0,d0,b0,m0,v0,k0,O0,S0,T0,C0,D0,N0,j0,U0,K0,G0,J0,H0,M0,X0,F0,V0,tG,rG,oG,cG,hG,uG,dG,bG,mG,kG,OG,SG,TG,o0],l6e=new Map(CG.map((e)=>[e.id,e]))});var DG=()=>{};var zG=()=>{};var NG=()=>{};var _G=()=>{};var jG=()=>{};var RG=()=>{};var UG=()=>{};var EG=()=>{};var KG=()=>{};var xG=()=>{};var GG=()=>{};var BG=()=>{};var JG=()=>{};var qG=()=>{};var HG=()=>{};var WG=()=>{};var MG=()=>{};var YG=()=>{};var XG=()=>{};var ZG=()=>{};var FG=()=>{};var QG=()=>{};var VG=()=>{};var eB=()=>{};var tB=()=>{};var nB=()=>{};var oB=()=>{};var iB=()=>{};var rB=()=>{};var aB=()=>{};var cB=()=>{};var sB=()=>{};var hB=()=>{};var lB=()=>{};var uB=()=>{};var gB=()=>{};var dB=()=>{};var yB=()=>{};var bB=()=>{};var pB=()=>{};var mB=g(()=>{DG();zG();NG();_G();jG();RG();UG();EG();KG();xG();GG();BG();JG();qG();HG();WG();MG();YG();XG();ZG();FG();QG();VG();eB();tB();nB();oB();iB();rB();aB();cB();sB();hB();lB();uB();gB();dB();yB();bB();pB()});var wB=()=>{};var vB=()=>{};var fB=g(()=>{Bj();wl();NK();mx();LG();QI();mB();wB();vB()});var kB,lae,IB,uae,OB,gae,PB,SB,Nu,$B,TB,AB,dr,CB,LB,yr,DB,zB,br,NB,dae,_B,_u,yae;var tO=g(()=>{fB();fe();je();kB=["configured","authorizing","connected","error"],lae=c.enum(kB),IB=["preset","custom"],uae=c.enum(IB),OB=["streamable-http","sse"],gae=c.enum(OB),PB=["none","headers","oauth","aws-sigv4"],SB=c.enum(PB),Nu=c.object({connectionId:c.string().uuid().describe("Connection ID."),connectionKey:c.string().describe("Stable key used to reference this connector in tool calls."),providerId:c.string().describe('Provider identifier, e.g. "linear".'),displayName:c.string().describe("Human-readable connector name."),source:uae.describe("Whether the connector is a built-in preset or a custom server."),installStatus:lae.describe("Current connection lifecycle status."),authMode:SB.describe("Authentication mode."),transport:gae.describe("Transport protocol."),serverUrl:c.string().describe("MCP server URL."),readOnly:c.boolean().describe("Whether the connector is restricted to read-only tools."),management:Qf.describe("Lifecycle owner and supported connector mutations."),enabledToolCount:c.number().int().nonnegative().describe("Number of tools enabled and available for this connector."),connectedAt:c.string().datetime().nullable().describe("When the connector last became connected, if ever."),createdAt:c.string().datetime(),updatedAt:c.string().datetime()}),$B=c.object({name:c.string().describe("Tool name as invoked."),title:c.string().describe("Human-readable tool title."),description:c.string().describe("Tool description."),isReadOnly:c.boolean().describe("Whether the tool is considered read-only."),enabled:c.boolean().describe("Whether the tool is enabled and available given the connector config.")}),TB=c.object({projectId:c.string().uuid().optional().describe("Project to list connectors for. Auto-filled from SDK context when omitted."),connectedOnly:c.boolean().optional().describe("When true, only return connectors that are connected.")}),AB=c.object({connectors:c.array(Nu)}),dr=$({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:TB,output:AB,pagination:"none",async:"sync"}),CB=c.object({connectionId:c.string().uuid().describe("Connection ID to fetch."),projectId:c.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),LB=c.object({connector:Nu}),yr=$({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:CB,output:LB,pagination:"none",async:"sync"}),DB=c.object({connectionId:c.string().uuid().describe("Connection ID to inspect."),projectId:c.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),zB=c.object({connector:Nu,tools:c.array($B)}),br=$({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:DB,output:zB,pagination:"none",async:"sync"}),NB=c.object({providerId:c.string().describe('Provider identifier, e.g. "linear".'),label:c.string().describe("Human-readable provider name."),authMode:SB.describe("Authentication mode."),availability:c.enum(Xi).describe("Whether the provider is enabled or coming soon."),setupSkill:c.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),dae=c.object({}),_B=c.object({providers:c.array(NB)}),_u=$({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:dae,output:_B,pagination:"none",async:"sync"}),yae={list:dr.contract,get:yr.contract,details:br.contract,listProviders:_u.contract}});var pr,bae,pae,mae,wae,vae,fae,kae,nO,NGe;var ju=g(()=>{fe();je();pr=c.enum(["admin","member"]),bae=c.object({id:c.string().min(1),name:c.string(),slug:c.string(),logo:c.string().nullable().optional(),role:pr}),pae=c.object({id:c.string().min(1),name:c.string().nullable(),email:c.string().email()}),mae=c.object({credentialType:c.literal("user"),user:pae,activeOrganizationId:c.string().min(1).nullable(),organizations:c.array(bae).describe("Organizations the user belongs to, including membership role.")}),wae=c.object({credentialType:c.literal("secret"),organization:c.object({id:c.string().min(1),name:c.string(),slug:c.string(),logo:c.string().nullable().optional()}),keyName:c.string()}),vae=c.object({credentialType:c.literal("partner"),superorganization:c.object({id:c.string().uuid(),name:c.string()})}),fae=c.object({}),kae=c.discriminatedUnion("credentialType",[mae,wae,vae]),nO=$({operationId:"me.get",description:"Return the identity and available context for the current credential.",backend:"api",route:{method:"GET",path:"/me",tags:["Auth"]},input:fae,output:kae,pagination:"none",async:"sync"}),NGe=nO.contract});var jB,Iae,Oae,Pae,Sae,$ae,Tae,oO,iO,rO,EGe;var RB=g(()=>{fe();je();ju();jB=c.object({membershipId:c.string().min(1).describe("Organization membership record ID."),userId:c.string().min(1).describe("User ID for the organization member."),name:c.string().nullable().describe("Display name for the member, when available."),email:c.string().email().describe("Email address for the member."),imageUrl:c.string().nullable().describe("Profile image URL for the member, when available."),role:pr.describe("Organization role."),createdAt:c.string().datetime().describe("When the membership was created.")}),Iae=c.object({organizationId:c.string().min(1).optional().describe("Organization to list members for. Auto-filled from CLI and SDK context when omitted.")}),Oae=c.object({members:c.array(jB).describe("Members visible within the selected organization.")}),Pae=c.object({organizationId:c.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted."),userId:c.string().min(1).describe("User ID of the member to update."),role:pr.describe("Role to assign.")}),Sae=c.object({member:jB.describe("Updated organization member.")}),$ae=c.object({params:c.object({userId:c.string().min(1).describe("User ID of the member to remove.")}),query:c.object({organizationId:c.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})),Tae=c.object({removedUserId:c.string().min(1).describe("User ID removed from the organization.")}),oO=$({operationId:"members.list",description:"List members in an organization.",backend:"api",route:{method:"GET",path:"/members",tags:["Members"]},input:Iae,output:Oae,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"}]}}]}),iO=$({operationId:"members.updateRole",description:"Update a member's organization role.",backend:"api",route:{method:"PATCH",path:"/members/{userId}/role",tags:["Members"]},input:Pae,output:Sae,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"}}}]}),rO=$({operationId:"members.remove",description:"Remove a member from an organization.",backend:"api",route:{method:"DELETE",path:"/members/{userId}",tags:["Members"],inputStructure:"detailed"},input:$ae,output:Tae,pagination:"none",async:"sync"}),EGe={list:oO.contract,updateRole:iO.contract,remove:rO.contract}});var UB,EB,Aae,Cae,Lae,Dae,zae,Ic,Nae,_ae,jae,aO,cO,sO,hO,BGe;var Ru=g(()=>{fe();je();UB=c.enum(["processing","completed","aborted","error"]),EB=c.object({id:c.string().uuid(),threadId:c.string().uuid(),userMessageId:c.string().uuid().nullable(),assistantMessageId:c.string().uuid().nullable(),parentRunId:c.string().uuid().nullable(),workflowRunId:c.string().nullable(),status:UB,source:c.enum(["app","api","mcp","slack","teams","linear","github","agent","cli"]),createdAt:c.string().datetime(),updatedAt:c.string().datetime(),completedAt:c.string().datetime().nullable()}),Aae=c.object({projectId:c.string().uuid().optional().describe("Project ID to list runs for. Auto-filled from CLI and SDK context when omitted."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:c.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),Cae=c.object({runs:c.array(EB),nextCursor:c.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),Lae=c.object({threadId:c.string().uuid().describe("Thread ID to list runs for."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:c.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),Dae=c.object({runs:c.array(EB),nextCursor:c.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),zae=c.object({runId:c.string().uuid().describe("Run ID returned by a deferred operation.")}),Ic=c.object({completed:c.boolean().describe("Whether the run has reached a terminal status."),threadId:c.string().uuid().describe("Thread ID associated with the run."),runId:c.string().uuid().describe("Run ID for subsequent polling."),messageId:c.string().uuid().optional().describe("ID of the user message that triggered this run."),status:UB.describe("Current run lifecycle status."),response:c.string().nullable().describe("Assistant response text when the run has completed.")}),Nae=Ic.describe("Current run state and, when complete, the assistant response."),_ae=c.object({runId:c.string().uuid().describe("Run ID of the in-flight run to request cancellation for.")}),jae=c.object({success:c.literal(!0).describe("Always true when the cancellation request was accepted.")}),aO=$({operationId:"runs.list",description:"List deferred runs within one project.",backend:"api",route:{method:"GET",path:"/runs",tags:["Runs"]},input:Aae,output:Cae,pagination:"cursor",async:"sync"}),cO=$({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:Lae,output:Dae,pagination:"cursor",async:"sync"}),sO=$({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:zae,output:Nae,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}}]}),hO=$({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:_ae,output:jae,pagination:"none",async:"sync",examples:[{name:"cancel-processing-run",input:{runId:"33333333-3333-4333-8333-333333333333"},output:{success:!0}}]}),BGe={list:aO.contract,listForThread:cO.contract,get:sO.contract,cancel:hO.contract}});var Uu=(e,t,n)=>{let i=t?20000:1e4;if(e.length>i)n.addIssue({code:"too_big",maximum:i,type:"string",inclusive:!0,message:`Message cannot exceed ${i} characters`,origin:"string",path:["message"]})},Eu=(e,t,n)=>{if(e&&!t)n.addIssue({code:"custom",message:"ambientServiceRun requires an automationId",path:["ambientServiceRun"]})};var KB,Oc,Rae,Uae,Eae,Kae,xae,Gae,Bae,Jae,qae,lO,Hae,Wae,Mae,Yae,Xae,Zae,Fae,Qae,Vae,ece,tce,nce,uO,gO,dO,yO,bO,pO,xB,oce,ice,rce,ace,GB,cce,sce,hce,lce,uce,gce,Wo="22222222-2222-4222-8222-222222222222",BB="11111111-1111-4111-8111-111111111111",dce="44444444-4444-4444-8444-444444444444",JB="55555555-5555-4555-8555-555555555555",mO,wO,vO,fO,kO,XGe;var IO=g(()=>{fe();je();Ru();KB=c.enum(["slack","teams","linear","github","app","mcp","agent","api","cli"]),Oc=c.object({id:c.string().uuid(),projectId:c.string().uuid(),title:c.string().nullable(),status:c.enum(["regular","archived"]),source:KB.nullable(),createdAt:c.string().datetime(),updatedAt:c.string().datetime()}),Rae=c.object({type:c.literal("message"),message:c.string()}),Uae=c.object({type:c.literal("reasoning"),reasoning:c.string(),status:c.enum(["in_progress","complete"]).optional()}),Eae=c.object({type:c.literal("tool_call"),name:c.string(),params:c.any().optional(),result:c.any().optional(),status:c.enum(["in_progress","success","error","unknown"]).optional(),toolCallId:c.string().optional(),durationMs:c.number().nonnegative().optional()}),Kae=c.object({type:c.literal("artifact"),name:c.enum(["timeseries","table","log_detail","integration_required","alert_card","issue_card","mdx"]),data:c.any(),toolCallId:c.string().optional()}),xae=c.object({type:c.literal("fork"),sourceThreadId:c.string(),sourceMessageId:c.string(),sourceThreadTitle:c.string().nullable()}),Gae=c.object({type:c.literal("summary"),summary:c.string()}),Bae=c.object({type:c.literal("slack_context"),channelId:c.string(),isTruncated:c.boolean().optional(),messages:c.array(c.object({timestamp:c.string(),slackUserId:c.string().optional(),displayName:c.string(),text:c.string(),isBot:c.boolean(),files:c.array(c.object({name:c.string(),mimetype:c.string(),size:c.number().optional(),attachmentId:c.string().uuid().optional(),ingestionStatus:c.enum(["attached","unsupported","oversized","skipped","unavailable"]).optional()})).optional()}))}),Jae=c.object({type:c.literal("teams_context"),conversationId:c.string(),isTruncated:c.boolean().optional(),messages:c.array(c.object({activityId:c.string().optional(),displayName:c.string(),text:c.string(),isBot:c.boolean(),createdDateTime:c.string().optional()}))}),qae=c.union([Rae,Uae,Eae,Kae,xae,Gae,Bae,Jae]),lO=c.object({id:c.string().uuid(),role:c.enum(["user","assistant"]),content:c.array(qae),source:KB,createdAt:c.string().datetime()}),Hae=c.object({projectId:c.string().uuid().optional().describe("Project to list threads for. Auto-filled from CLI and SDK context when omitted."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of threads to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:c.enum(["regular","archived"]).optional().describe("Filter by thread status. 'regular' returns active threads, 'archived' returns archived threads.")}),Wae=c.object({threads:c.array(Oc).describe("The page of threads matching the query."),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),Mae=c.object({threadId:c.string().uuid().describe("Thread ID returned by threads.list or threads.create.")}),Yae=c.object({thread:Oc.describe("The requested thread."),messages:c.array(lO).describe("Messages currently stored on the thread in chronological order.")}),Xae=c.object({projectId:c.string().uuid().optional().describe("Project to create the thread in. Auto-filled from CLI and SDK context when omitted."),message:c.string().min(1,"Message cannot be empty").describe("Initial user message that starts the thread."),wait:c.boolean().default(!0).describe("Whether the server should wait for the agent run before responding."),timeoutSeconds:c.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:c.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:c.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)=>{Uu(e.message,e.automationId,t),Eu(e.ambientServiceRun,e.automationId,t)}),Zae=Ic.describe("Deferred run result for creating a thread."),Fae=c.object({threadId:c.string().uuid().describe("Thread ID whose current processing status should be returned.")}),Qae=c.object({status:c.enum(["idle","processing"]),lastRunStatus:c.enum(["error"]).nullable()}),Vae=c.object({threadId:c.string().uuid().describe("Thread ID whose active run should be stopped.")}),ece=c.object({success:c.literal(!0).describe("Always true when the stop request was accepted.")}),tce=c.object({threadId:c.string().uuid().describe("Thread ID of the thread to update."),status:c.enum(["regular","archived"]).describe("New status for the thread. 'archived' hides the thread from the sidebar.")}),nce=c.object({thread:Oc.describe("The updated thread.")}),uO=$({operationId:"threads.list",description:"List threads in a project, optionally filtered by status.",backend:"api",route:{method:"GET",path:"/threads",tags:["Threads"]},input:Hae,output:Wae,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}}]}),gO=$({operationId:"threads.get",description:"Get a thread and its messages.",backend:"api",route:{method:"GET",path:"/threads/{threadId}",tags:["Threads"]},input:Mae,output:Yae,pagination:"none",async:"sync"}),dO=$({operationId:"threads.getStatus",description:"Get the current processing status for a thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/status",tags:["Threads"]},input:Fae,output:Qae,pagination:"none",async:"sync",examples:[{name:"processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{status:"processing",lastRunStatus:null}}]}),yO=$({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:Vae,output:ece,pagination:"none",async:"sync",examples:[{name:"stop-processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{success:!0}}]}),bO=$({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:Xae,output:Zae,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}}]}),pO=$({operationId:"threads.update",description:"Update a thread's status.",backend:"api",route:{method:"PATCH",path:"/threads/{threadId}",tags:["Threads"]},input:tce,output:nce,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"}}}]}),xB=c.enum(["private","organization"]),oce=c.object({threadId:c.string().uuid().describe("Thread ID of the source thread to fork."),messageId:c.string().uuid().describe("Message ID in the source thread to fork from. The new thread copies messages up to and including this message.")}),ice=c.object({thread:Oc.describe("The newly created forked thread.")}),rce=c.object({threadId:c.string().uuid().describe("Thread ID of the thread to update."),visibility:xB.describe("New visibility. 'private' restricts the thread to its owner; 'organization' shares it with the organization.")}),ace=c.object({thread:Oc.describe("The updated thread."),visibility:xB.describe("The thread's resulting visibility.")}),GB=c.object({shareId:c.string().uuid().describe("Unique identifier for the snapshot."),threadId:c.string().uuid().describe("Thread the snapshot was taken from."),url:c.string().describe("Public read-only URL for the snapshot."),createdAt:c.string().datetime()}),cce=c.object({threadId:c.string().uuid().describe("Thread ID to create a public read-only snapshot for.")}),sce=c.object({share:GB.describe("The created share link.")}),hce=c.object({threadId:c.string().uuid().describe("Thread ID the snapshot belongs to."),shareId:c.string().uuid().describe("Snapshot ID to revoke.")}),lce=c.void(),uce=c.object({threadId:c.string().uuid().describe("Thread ID to list public snapshots for.")}),gce=c.object({shares:c.array(GB).describe("Active share links for the thread.")}),mO=$({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:oce,output:ice,pagination:"none",async:"sync",examples:[{name:"fork-from-message",input:{threadId:Wo,messageId:dce},output:{thread:{id:"66666666-6666-4666-8666-666666666666",projectId:BB,title:"API returning 500s (fork)",status:"regular",source:"api",createdAt:"2026-01-01T00:20:00.000Z",updatedAt:"2026-01-01T00:20:00.000Z"}}}]}),wO=$({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:rce,output:ace,pagination:"none",async:"sync",examples:[{name:"make-private",input:{threadId:Wo,visibility:"private"},output:{thread:{id:Wo,projectId:BB,title:"API returning 500s",status:"regular",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:30:00.000Z"},visibility:"private"}}]}),vO=$({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:cce,output:sce,pagination:"none",async:"sync",examples:[{name:"create-share-link",input:{threadId:Wo},output:{share:{shareId:JB,threadId:Wo,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}}}]}),fO=$({operationId:"threads.listShareLinks",description:"List active public share links for a thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/share",tags:["Threads"]},input:uce,output:gce,pagination:"none",async:"sync",examples:[{name:"list-share-links",input:{threadId:Wo},output:{shares:[{shareId:JB,threadId:Wo,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}]}}]}),kO=$({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:hce,output:lce,pagination:"none",async:"sync"}),XGe={list:uO.contract,get:gO.contract,getStatus:dO.contract,stop:yO.contract,create:bO.contract,update:pO.contract,fork:mO.contract,setVisibility:wO.contract,createShareLink:vO.contract,listShareLinks:fO.contract,revokeShareLink:kO.contract}});var yce,bce,pce,mce,qB,HB;var WB=g(()=>{fe();je();Ru();IO();yce=c.object({threadId:c.string().uuid().describe("Thread ID to list messages for."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of messages to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),bce=c.object({messages:c.array(lO),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),pce=c.object({threadId:c.string().uuid().describe("Thread ID to append the message to."),message:c.string().min(1,"Message cannot be empty").describe("Message body to append to the thread."),wait:c.boolean().default(!0).describe("Whether the server should wait for the appended message run before responding."),timeoutSeconds:c.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:c.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:c.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)=>{Uu(e.message,e.automationId,t),Eu(e.ambientServiceRun,e.automationId,t)}),mce=Ic.describe("Deferred run result for appending a message to an existing thread."),qB=$({operationId:"messages.list",description:"List messages in a thread with cursor pagination.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/messages",tags:["Messages"]},input:yce,output:bce,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}}]}),HB=$({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:pce,output:mce,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 MB,wce=(e,t)=>e.value===t.value&&e.label===t.label&&e.scope===t.scope&&e.role===t.role&&e.defaultOff===t.defaultOff,wt=(e)=>{for(let t of Object.values(e)){let n=MB.get(t.value);if(n&&!wce(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}`);MB.set(t.value,t)}return e};var xn=g(()=>{MB=new Map});var YB;var XB=g(()=>{xn();YB=wt({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 ZB;var FB=g(()=>{xn();ZB=wt({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 QB;var VB=g(()=>{xn();QB=wt({INTEGRATION_CONNECTED:{value:"integration_connected",label:"Integration connected",scope:"org",defaultOff:!0},INTEGRATION_DISCONNECTED:{value:"integration_disconnected",label:"Integration disconnected",scope:"org"}})});var eJ;var tJ=g(()=>{xn();eJ=wt({ISSUE_TRIGGERED:{value:"issue_triggered",label:"Issue triggered",scope:"project"},ISSUE_RESOLVED:{value:"issue_resolved",label:"Issue resolved",scope:"project"},ISSUE_IGNORED:{value:"issue_ignored",label:"Issue ignored",scope:"project"}})});var nJ;var oJ=g(()=>{xn();nJ=wt({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 iJ;var rJ=g(()=>{xn();iJ=wt({SANDBOX_CREATED:{value:"sandbox_created",label:"Sandbox connected",scope:"project",defaultOff:!0},SANDBOX_DELETED:{value:"sandbox_deleted",label:"Sandbox disconnected",scope:"project",defaultOff:!0},DATA_SOURCE_CONNECTED:{value:"data_source_connected",label:"Data source connected",scope:"project",defaultOff:!0},DATA_SOURCE_DISCONNECTED:{value:"data_source_disconnected",label:"Data 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 aJ;var cJ=g(()=>{xn();aJ=wt({SECURITY_ALERT:{value:"security_alert",label:"Security alert",scope:"org",role:"admin"}})});var OO,it,sJ,hJ=(e)=>sJ.get(e)?.scope,PO=(e)=>{let t=sJ.get(e)?.label;if(t)return t;let n=e.replace(/_/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):e},SO=(e)=>hJ(e)==="project";var Pc=g(()=>{XB();FB();VB();tJ();oJ();rJ();cJ();xn();OO={...aJ,...nJ,...QB,...YB,...eJ,...iJ,...ZB},it=Object.fromEntries(Object.entries(OO).map(([e,t])=>[e,t.value])),sJ=new Map(Object.values(OO).map((e)=>[e.value,e]))});var Sc,lJ,ABe,Ku,CBe,Xt,$O,$c,Mo,fce;var Tc=g(()=>{Pc();Sc=Object.values(it),lJ=[it.BILLING_PLAN_UPGRADE_APPLIED,it.BILLING_PLAN_DOWNGRADE_SCHEDULED,it.BILLING_PLAN_DOWNGRADE_APPLIED,it.BILLING_CREDIT_BALANCE_LOW,it.BILLING_CREDIT_BALANCE_DEPLETED,it.BILLING_AUTO_TOP_UP_SETTINGS_CHANGED,it.BILLING_AUTO_TOP_UP_FAILED,it.BILLING_INVOICE_PAID,it.BILLING_NEGATIVE_BALANCE_COLLECTED,it.BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED],ABe=new Set(lJ),Ku=[it.ISSUE_TRIGGERED,it.ISSUE_RESOLVED,it.ISSUE_IGNORED,it.AUTOMATION_RUN_FAILED],CBe=new Set(Ku),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"},$O=[Xt.IN_APP,Xt.SLACK,Xt.EMAIL,Xt.SMS],$c=[Xt.SLACK_CHANNEL,Xt.TEAMS_CHANNEL,Xt.INCIDENT_IO,Xt.PAGERDUTY,Xt.ROOTLY,Xt.WEBHOOK],Mo=Object.values(Xt),fce=[...Mo,"victorops"]});var mr,xu,Yo;var uJ=g(()=>{fe();Tc();mr=c.enum(Mo),xu=c.enum($c),Yo=c.enum(Sc)});var kce,dJ,RBe,UBe,EBe,gJ;var yJ=g(()=>{Pc();Tc();kce=Ku.map((e)=>({notificationType:e,label:PO(e)})),dJ=[{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"}],RBe=new Set($O),UBe=new Set($c),EBe=Sc.filter(SO),gJ=new Set(dJ.map(({channel:e})=>e));if(gJ.size!==Mo.length||Mo.some((e)=>!gJ.has(e)))throw Error("Notification channel card definitions must represent every channel")});var bJ=g(()=>{Pc();Tc()});var TO=g(()=>{Pc();Tc();uJ();yJ();bJ()});var Pce,Sce,$ce,Tce,Ace,Cce,Lce,AO,gJe;var pJ=g(()=>{TO();fe();je();Pce=c.enum(["ready","missing","degraded","unavailable"]),Sce=c.object({id:c.string(),label:c.string(),status:c.enum(["active","inactive","degraded"]),statusLabel:c.string()}),$ce=c.object({channel:mr,name:c.string(),description:c.string(),scope:c.enum(["personal","project"]),enabled:c.boolean().nullable(),preferenceId:c.string().nullable(),prerequisite:c.object({status:Pce,statusLabel:c.string(),message:c.string()}),action:c.object({label:c.string(),href:c.string()}).nullable(),destinations:c.array(Sce),destinationManagement:c.enum(["none","slack_channels","teams_channels","integration_connections","webhook_endpoints"]),canCreateDestinations:c.boolean(),supportedNotificationTypes:c.array(Yo)}),Tce=c.object({channel:xu,enabled:c.boolean(),preferenceId:c.string().nullable()}),Ace=c.object({channel:xu,notificationType:Yo,enabled:c.boolean(),preferenceId:c.string()}),Cce=c.object({projectId:c.string().uuid().optional().describe("Project to inspect. Auto-filled from CLI and SDK context when omitted.")}),Lce=c.object({channelCards:c.array($ce).length(10),channels:c.array(Tce),notificationTypePreferences:c.array(Ace),issueNotificationMinSeverity:c.enum(["low","medium","high","critical"])}),AO=$({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:Cce,output:Lce,pagination:"none",async:"sync"}),gJe={getProject:AO.contract}});var mJ,Dce,zce,CO,Nce,_ce,jce,Rce,Uce,Ece,Kce,xce,LO,DO,zO,NO,mJe;var wJ=g(()=>{TO();fe();je();mJ=c.object({minSeverity:c.enum(["medium","high","critical"]).optional().describe("Suppress rules only: suppress deliveries whose issue severity is below this threshold."),component:c.string().min(1).max(200).optional().describe("Match the component the agent records on issue metadata (exact match).")}).strict(),Dce=c.object({id:c.string().uuid(),channel:c.string(),destinationKey:c.string(),displayName:c.string().nullable()}),zce=c.object({channel:c.enum(["slack_channel","teams_channel"]),destinationKey:c.string().min(1).describe("The stable destination id — the Slack channel id or Microsoft Teams channel id. Must be one of the project's configured notification channels.")}),CO=c.object({id:c.string().uuid(),projectId:c.string().uuid(),channel:mr.nullable().describe("Channel the rule targets; null means all channels."),notificationType:Yo.nullable().describe("Notification type the rule targets; null means all types."),priority:c.number().int().describe("Route-pass evaluation order; suppress rules are unordered."),condition:mJ,outcome:c.enum(["suppress","route"]),enabled:c.boolean(),destinations:c.array(Dce),createdAt:c.string().datetime(),updatedAt:c.string().datetime()}),Nce=c.object({projectId:c.string().uuid().optional().describe("Project to inspect. Auto-filled from CLI and SDK context when omitted.")}),_ce=c.object({rules:c.array(CO)}),jce=c.object({projectId:c.string().uuid().optional().describe("Project that owns the rule. Auto-filled from CLI and SDK context when omitted."),outcome:c.enum(["suppress","route"]).describe("suppress gates matching deliveries; route sends them to a destination subset."),channel:mr.nullable().describe("Channel to target; null targets all channels (suppress rules only)."),notificationType:Yo.nullable().describe("Notification type to target; null targets all types."),condition:mJ,destinations:c.array(zce).default([]).describe("Route rules only: the destinations to select.")}),Rce=CO,Uce=c.object({projectId:c.string().uuid().optional().describe("Project that owns the rule. Auto-filled from CLI and SDK context when omitted."),ruleId:c.string().uuid().describe("The delivery rule to update."),enabled:c.boolean()}),Ece=CO,Kce=c.object({projectId:c.string().uuid().optional().describe("Project that owns the rule. Auto-filled from CLI and SDK context when omitted."),ruleId:c.string().uuid().describe("The delivery rule to delete.")}),xce=c.object({removed:c.boolean()}),LO=$({operationId:"notificationDeliveryRules.list",description:"List a project's notification delivery rules — delivery-side suppress and route conditions evaluated after the preference gates.",backend:"api",route:{method:"GET",path:"/notification-delivery-rules",tags:["Notification delivery rules"]},input:Nce,output:_ce,pagination:"none",async:"sync"}),DO=$({operationId:"notificationDeliveryRules.create",description:"Create a delivery rule. Suppress rules gate a channel below a severity threshold or for a component; route rules send matching notifications to a subset of the project's configured Slack and Microsoft Teams destinations.",backend:"api",route:{method:"POST",path:"/notification-delivery-rules",tags:["Notification delivery rules"]},input:jce,output:Rce,pagination:"none",async:"sync"}),zO=$({operationId:"notificationDeliveryRules.setEnabled",description:"Enable or disable a delivery rule without deleting it.",backend:"api",route:{method:"POST",path:"/notification-delivery-rules/{ruleId}/set-enabled",tags:["Notification delivery rules"]},input:Uce,output:Ece,pagination:"none",async:"sync"}),NO=$({operationId:"notificationDeliveryRules.delete",description:"Delete a delivery rule.",backend:"api",route:{method:"DELETE",path:"/notification-delivery-rules/{ruleId}",tags:["Notification delivery rules"]},input:Kce,output:xce,pagination:"none",async:"sync"}),mJe={list:LO.contract,create:DO.contract,setEnabled:zO.contract,delete:NO.contract}});var _O,Gce,Bce,Jce,qce,Hce,Wce,jO,Mce,Yce,RO,Xce,Zce,UO,Fce,Qce,EO,Vce,ese,KO,kJe;var vJ=g(()=>{fe();je();_O=c.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"]),Gce=c.enum(["needs-onboarding","blocked","ready"]),Bce=c.enum(["incomplete","complete","skipped"]),Jce=c.object({invitationId:c.string(),organizationId:c.string(),organizationName:c.string(),organizationSlug:c.string(),organizationImageUrl:c.string().nullable(),inviterName:c.string().nullable()}),qce=c.object({gate:Gce,canonicalStep:_O.nullable(),organizationId:c.string().nullable(),projectId:c.string().nullable(),completionByStep:c.record(_O,Bce),githubSkipped:c.boolean(),githubAppSkipped:c.boolean(),slackSkipped:c.boolean(),sampleIssueId:c.string().nullable(),actorRole:c.enum(["admin","member"]).nullable(),requiredStep:c.union([_O,c.literal("select-organization")]).nullable(),isCompleted:c.boolean(),onboardingRecommendationsThreadId:c.string().nullable(),hasOrganizations:c.boolean(),hasPaidBillingSubscription:c.boolean(),billingStepEnabled:c.boolean(),pendingInvitations:c.array(Jce)}),Hce=c.object({}),Wce=c.object({onboarding:qce}),jO=$({operationId:"onboarding.getState",description:"Read onboarding progress for the authenticated user.",backend:"api",route:{method:"GET",path:"/onboarding/state",tags:["Onboarding"]},input:Hce,output:Wce,pagination:"none",async:"sync"}),Mce=c.object({integration:c.enum(["github","slack"]).describe("Integration onboarding step to skip.")}),Yce=c.object({skipped:c.literal(!0)}),RO=$({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:Mce,output:Yce,pagination:"none",async:"sync"}),Xce=c.object({}),Zce=c.object({skipped:c.literal(!0)}),UO=$({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:Xce,output:Zce,pagination:"none",async:"sync"}),Fce=c.object({}),Qce=c.object({skipped:c.literal(!0)}),EO=$({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:Fce,output:Qce,pagination:"none",async:"sync"}),Vce=c.object({projectId:c.string().uuid().describe("Project that completed onboarding.")}),ese=c.object({completed:c.boolean()}),KO=$({operationId:"onboarding.finish",description:"Mark onboarding complete when all prerequisites are satisfied.",backend:"api",route:{method:"POST",path:"/onboarding/finish",tags:["Onboarding"]},input:Vce,output:ese,pagination:"none",async:"sync"}),kJe={getState:jO.contract,skipIntegration:RO.contract,skipGithubAppInstallation:UO.contract,skipSampleIssue:EO.contract,finish:KO.contract}});var Gu,tse,nse,ose,ise,rse,ase,cse,sse,hse,lse,xO,GO,BO,JO,$Je;var fJ=g(()=>{fe();je();ju();Gu=c.object({id:c.string().min(1),name:c.string(),slug:c.string(),logo:c.string().nullable().optional()}),tse=Gu.extend({role:pr.optional()}),nse=c.object({}),ose=c.object({organizations:c.array(tse).describe("Organizations available to the current credential.")}),ise=c.object({organizationId:c.string().min(1).describe("Organization ID to fetch.")}),rse=c.object({organization:Gu}),ase=c.object({organizationId:c.string().min(1).describe("Organization ID to update. SDK and CLI callers can auto-fill this before dispatch."),name:c.string().trim().min(1).max(100).describe("New organization name.")}),cse=c.object({organization:Gu.describe("Updated organization.")}),sse=c.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"),hse=c.object({name:sse.describe("Organization display name.")}),lse=c.object({organization:Gu}),xO=$({operationId:"organizations.create",description:"Create an organization for the authenticated user.",backend:"api",route:{method:"POST",path:"/organizations",tags:["Organizations"],successStatus:201},input:hse,output:lse,pagination:"none",async:"sync"}),GO=$({operationId:"organizations.list",description:"List organizations available to the current credential.",backend:"api",route:{method:"GET",path:"/organizations",tags:["Organizations"]},input:nse,output:ose,pagination:"none",async:"sync"}),BO=$({operationId:"organizations.get",description:"Get one organization by ID.",backend:"api",route:{method:"GET",path:"/organizations/{organizationId}",tags:["Organizations"]},input:ise,output:rse,pagination:"none",async:"sync"}),JO=$({operationId:"organizations.update",description:"Update one organization.",backend:"api",route:{method:"PATCH",path:"/organizations/{organizationId}",tags:["Organizations"]},input:ase,output:cse,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}}}]}),$Je={list:GO.contract,get:BO.contract,create:xO.contract,update:JO.contract}});var wr,Ac,kJ,IJ,OJ,PJ,SJ,$J,TJ,Bu,Ju,qu,AJ,CJ,Hu,LJ,DJ,Wu,use;var qO=g(()=>{fe();je();wr=c.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"]),Ac=c.object({id:c.string().uuid(),organizationId:c.string().min(1),name:c.string(),region:wr}),kJ=c.object({organizationId:c.string().min(1).optional().describe("Organization to list projects for. Auto-filled from CLI and SDK context when omitted.")}),IJ=c.object({projects:c.array(Ac).describe("Projects visible within the selected organization.")}),OJ=c.object({projectId:c.string().uuid().describe("Project ID to fetch.")}),PJ=c.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"),SJ=c.object({organizationId:c.string().min(1).optional().describe("Organization to create the project under. Auto-filled from CLI and SDK context when omitted."),name:PJ.describe("Project name."),region:wr.optional().default("us-west-2").describe("AWS region where the new project should be created.")}),$J=c.object({project:Ac}),TJ=c.object({project:Ac}),Bu=$({operationId:"projects.list",description:"List projects in an organization.",backend:"api",route:{method:"GET",path:"/projects",tags:["Projects"]},input:kJ,output:IJ,pagination:"none",async:"sync"}),Ju=$({operationId:"projects.get",description:"Get one project by ID.",backend:"api",route:{method:"GET",path:"/projects/{projectId}",tags:["Projects"]},input:OJ,output:TJ,pagination:"none",async:"sync"}),qu=$({operationId:"projects.create",description:"Create one project in an organization.",backend:"api",route:{method:"POST",path:"/projects",successStatus:201,tags:["Projects"]},input:SJ,output:$J,pagination:"none",async:"sync"}),AJ=c.object({projectId:c.string().uuid().describe("Project ID to update."),name:PJ.optional().describe("New project name.")}),CJ=c.object({project:Ac}),Hu=$({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:AJ,output:CJ,pagination:"none",async:"sync"}),LJ=c.object({projectId:c.string().uuid().describe("Project ID to delete.")}),DJ=c.void(),Wu=$({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:LJ,output:DJ,pagination:"none",async:"sync"}),use={list:Bu.contract,get:Ju.contract,create:qu.contract,update:Hu.contract,delete:Wu.contract}});var zJ,gse,dse,yse,bse,pse,HO,NJe;var NJ=g(()=>{fe();je();zJ=c.enum(["open","merged","closed"]),gse=c.enum(["review_required","approved","changes_requested"]),dse=c.enum(["passing","failing","pending"]),yse=c.object({id:c.string().uuid(),projectId:c.string().uuid(),repositoryFullName:c.string(),pullRequestId:c.string().describe("Provider-native pull request identifier (GitHub PR number or Bitbucket PR id), serialized as a string."),githubPullRequestId:c.number().int().describe("Deprecated: use pullRequestId. Numeric form of the provider-native pull request identifier; kept for backward compatibility."),title:c.string().nullable(),url:c.string().nullable(),status:zJ.nullable(),reviewState:gse.nullable(),checksState:dse.nullable(),requestedByUserId:c.string().nullable(),authorLogin:c.string().nullable().describe("Forge login that authored the pull request (often the Sazabi app identity)."),githubAuthorLogin:c.string().nullable().describe("Deprecated: use authorLogin. Kept for backward compatibility."),threadId:c.string().uuid().nullable(),runId:c.string().uuid().nullable(),createdAt:c.string().datetime(),mergedAt:c.string().datetime().nullable(),closedAt:c.string().datetime().nullable()}),bse=c.object({projectId:c.string().uuid().optional().describe("Project to list pull requests for. Auto-filled from CLI and SDK context when omitted."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of pull requests to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:zJ.optional().describe("Filter by pull request status (open, merged, or closed)."),repositoryFullName:c.string().trim().optional().describe("Filter by repository full name, for example owner/repo. Case-insensitive."),requestedByUserId:c.string().trim().optional().describe("Filter by the Sazabi user who requested the pull request. Pass 'me' to filter to the authenticated user.")}),pse=c.object({pullRequests:c.array(yse),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),HO=$({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:bse,output:pse,pagination:"cursor",async:"sync"}),NJe={list:HO.contract}});var _J,jJ,RJ,UJ,EJ,Cc;var WO=g(()=>{fe();je();_J=c.enum(["data_source","mcp_connector","sandbox_cli","integration"]),jJ=c.enum(["connected","recommended"]),RJ=c.object({kind:_J.describe("What the recommendation targets: a data source, MCP connector, sandbox CLI, or integration."),targetId:c.string().describe("Exact catalog id for the kind (data source type, MCP provider id, sandbox CLI preset type, or integration provider id)."),status:jJ.describe("Resolved live against current connections: connected (already set up) or recommended (suggested, not yet connected)."),roiScore:c.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:c.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.")}),UJ=c.object({projectId:c.string().uuid().optional().describe("Project to list recommendations for. Auto-filled from CLI and SDK context when omitted.")}),EJ=c.object({recommendations:c.array(RJ).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).")}),Cc=$({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:UJ,output:EJ,pagination:"none",async:"sync"})});var KJ,mse,xJ,Mu,GJ,BJ,JJ,qJ,vr,HJ,WJ,MJ,Yu,wse;var MO=g(()=>{fe();je();KJ=c.object({type:c.string().describe("Preset type identifier."),label:c.string().describe("Human-readable display name."),executableNames:c.array(c.string()).describe("CLI binary names installed by this preset."),envVarKeys:c.array(c.string()).describe("Environment variables required for authentication."),setupSkill:c.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),mse=c.object({}),xJ=c.object({types:c.array(KJ)}),Mu=$({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:mse,output:xJ,pagination:"none",async:"sync"}),GJ=c.enum(["github_app","personal_access_token","stored_credentials"]),BJ=c.object({presetType:c.string().describe("Preset type identifier."),credentialSource:GJ.describe("Authoritative credential source for the preset."),isSystemManaged:c.boolean().describe("Whether the connection follows an integration lifecycle."),fallbackConfigured:c.boolean().describe("Whether user-provided fallback credentials are stored for this preset."),envVarKeys:c.array(c.string()).describe("Stored environment variable names. Secret values are omitted.")}),JJ=c.object({projectId:c.string().uuid().optional().describe("Project to inspect. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted.")}),qJ=c.object({connections:c.array(BJ)}),vr=$({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:JJ,output:qJ,pagination:"none",async:"sync"}),HJ=c.object({key:c.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:c.string().max(10240).describe("Secret value. Encrypted at rest; never returned by any API response.")}),WJ=c.object({projectId:c.string().uuid().optional().describe("Project to configure. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:c.string().min(1).describe("Preset type identifier (e.g. kubectl, aws, github)."),environmentVariables:c.array(HJ).max(100).describe("Full set of env vars for this preset. Replaces any previously stored values for the preset.")}),MJ=c.object({projectId:c.string().uuid().describe("Project the preset was written to."),presetType:c.string().describe("Preset type that was upserted."),envVarKeys:c.array(c.string()).describe("Env var key names now stored for this preset. Values are never returned.")}),Yu=$({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:WJ,output:MJ,pagination:"none",async:"sync"}),wse={listConnections:vr.contract,listTypes:Mu.contract,upsertPreset:Yu.contract}});var Xu,YJ=1048576,YO,XJ,XO,vse,fse,kse,Ise,Ose,Pse,Sse,$se,Tse,Ase,ZO,FO,QO,VO,eP,JJe;var ZJ=g(()=>{fe();je();Xu=c.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."),YO=c.string().min(1).refine((e)=>new TextEncoder().encode(e).length<=YJ,{message:`Script content must be at most ${YJ} bytes (1 MiB).`}).describe("Bash script body materialized as /home/sazabi/scripts/<name>.sh in the sandbox."),XJ=c.object({id:c.string().uuid(),projectId:c.string().uuid(),name:c.string(),description:c.string().nullable(),contentHash:c.string().describe("sha256 hex digest of the script content."),createdAt:c.string().datetime(),updatedAt:c.string().datetime()}),XO=XJ.extend({content:YO}),vse=c.object({projectId:c.string().uuid().optional().describe("Project to list scripts for. Auto-filled from CLI and SDK context when omitted."),search:c.string().optional().describe("Case-insensitive partial match on script name."),cursor:c.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of scripts to return per page.")}),fse=c.object({scripts:c.array(XJ),nextCursor:c.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),kse=c.object({name:Xu.describe("Script name to fetch."),projectId:c.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),Ise=c.object({script:XO}),Ose=c.object({projectId:c.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),name:Xu.describe("Script name. Must be unique within the project among non-deleted scripts."),content:YO,description:c.string().max(500).nullable().optional().describe("Optional human-readable description.")}),Pse=c.object({script:XO}),Sse=c.object({name:Xu.describe("Script to update."),projectId:c.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),content:YO.optional().describe("New script body. Omit to leave content unchanged."),description:c.string().max(500).nullable().optional().describe("New description, or null to clear it. Omit to leave unchanged.")}),$se=c.object({script:XO}),Tse=c.object({name:Xu.describe("Script to delete."),projectId:c.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),Ase=c.object({deleted:c.boolean()}),ZO=$({operationId:"scripts.list",description:"List durable bash scripts stored for a project.",backend:"api",route:{method:"GET",path:"/scripts",tags:["Scripts"]},input:vse,output:fse,pagination:"cursor",async:"sync"}),FO=$({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:kse,output:Ise,pagination:"none",async:"sync"}),QO=$({operationId:"scripts.create",description:"Create a durable bash script for a project.",backend:"api",route:{method:"POST",path:"/scripts",successStatus:201,tags:["Scripts"]},input:Ose,output:Pse,pagination:"none",async:"sync"}),VO=$({operationId:"scripts.update",description:"Update a project script's body and/or description.",backend:"api",route:{method:"PATCH",path:"/scripts/{name}",tags:["Scripts"]},input:Sse,output:$se,pagination:"none",async:"sync"}),eP=$({operationId:"scripts.delete",description:"Soft-delete a project script by name.",backend:"api",route:{method:"DELETE",path:"/scripts/{name}",successStatus:204,tags:["Scripts"]},input:Tse,output:Ase,pagination:"none",async:"sync"}),JJe={list:ZO.contract,get:FO.contract,create:QO.contract,update:VO.contract,delete:eP.contract}});var tP,FJ,QJ,VJ,eq,fr,kr,Cse;var nP=g(()=>{fe();je();tP=c.object({projectId:c.string().uuid().optional().describe("Project to search within. Auto-filled from CLI and SDK context when omitted."),query:c.string().trim().min(1,"Query must be at least 1 character").max(500,"Query must be at most 500 characters"),limit:c.coerce.number().min(1).max(100).default(20).describe("Maximum number of search results to return."),page:c.coerce.number().min(1).default(1).describe("One-based page number.")}),FJ=tP.extend({status:c.enum(["regular","archived"]).optional().describe("Optional thread status filter.")}),QJ=tP.extend({threadId:c.string().uuid().optional().describe("Optional thread restriction for message search."),role:c.enum(["user","assistant"]).optional().describe("Optional message role filter.")}),VJ=c.object({threads:c.array(c.object({id:c.string().uuid(),projectId:c.string().uuid().optional(),title:c.string(),status:c.enum(["regular","archived"]),labels:c.array(c.string()),createdAt:c.string().datetime(),updatedAt:c.string().datetime(),highlights:c.array(c.string()),score:c.number().optional()})),pagination:c.object({page:c.number(),limit:c.number(),totalResults:c.number(),totalPages:c.number()}).describe("Page-based pagination metadata for the current search result.")}),eq=c.object({messages:c.array(c.object({id:c.string().uuid(),threadId:c.string().uuid(),threadTitle:c.string(),role:c.enum(["user","assistant"]),content:c.string(),createdAt:c.string().datetime(),updatedAt:c.string().datetime(),highlights:c.array(c.string()),score:c.number().optional()})),pagination:c.object({page:c.number(),limit:c.number(),totalResults:c.number(),totalPages:c.number()}).describe("Page-based pagination metadata for the current search result.")}),fr=$({operationId:"search.threads",description:"Search threads within one project.",backend:"api",route:{method:"GET",path:"/search/threads",tags:["Search"]},input:FJ,output:VJ,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}}}]}),kr=$({operationId:"search.messages",description:"Search messages within one project.",backend:"api",route:{method:"GET",path:"/search/messages",tags:["Search"]},input:QJ,output:eq,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}}}]}),Cse={threads:fr.contract,messages:kr.contract}});var Lc,tq,nq,oq,iq,rq,aq,cq,sq,Zu,Fu,Ir,Qu,hq,oP,lq,uq,gq,dq,yq,Vu,eg,Lse;var iP=g(()=>{fe();je();Lc=c.object({id:c.string().uuid(),projectId:c.string().uuid(),name:c.string(),description:c.string().nullable(),currentStatus:c.enum(["operational","degraded","outage"]).describe("Current health status of this component."),firstSeenAt:c.string().datetime(),lastSeenAt:c.string().datetime(),deletedAt:c.string().datetime().nullable().describe("Timestamp when this component was deregistered, if any.")}),tq=c.object({projectId:c.string().uuid().optional().describe("Project to list status components for. Auto-filled from CLI and SDK context when omitted."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of components to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),includeDeleted:c.union([c.boolean(),c.stringbool()]).default(!1).describe("When true, include removed components in the response.")}),nq=c.object({statusComponents:c.array(Lc),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),oq=c.object({componentId:c.string().uuid().describe("Status component ID to retrieve.")}),iq=c.object({statusComponent:Lc}),rq=c.object({projectId:c.string().uuid().optional().describe("Project to register the status component in. Auto-filled from CLI and SDK context when omitted."),name:c.string().trim().min(1,"Name is required").describe("Evidence-backed component name to register."),description:c.string().trim().min(1,"Description cannot be empty").optional().describe("Optional component description.")}),aq=c.object({statusComponent:Lc}),cq=c.object({componentId:c.string().uuid().describe("Status component ID to deregister."),reason:c.string().trim().min(1,"Reason cannot be empty").optional().describe("Optional reason for audit logging.")}),sq=c.object({statusComponent:Lc}),Zu=$({operationId:"statusComponents.list",description:"List status page components in a project.",backend:"api",route:{method:"GET",path:"/status-components",tags:["Status Components"]},input:tq,output:nq,pagination:"cursor",async:"sync"}),Fu=$({operationId:"statusComponents.get",description:"Get a single status component by ID.",backend:"api",route:{method:"GET",path:"/status-components/{componentId}",tags:["Status Components"]},input:oq,output:iq,pagination:"none",async:"sync"}),Ir=$({operationId:"statusComponents.register",description:"Register a status page component in a project, or refresh an existing active component with the same name.",backend:"api",route:{method:"POST",path:"/status-components",tags:["Status Components"]},input:rq,output:aq,pagination:"none",async:"sync"}),Qu=$({operationId:"statusComponents.deregister",description:"Deregister a status page component. Deregistered components no longer appear on the status page.",backend:"api",route:{method:"POST",path:"/status-components/{componentId}/deregister",tags:["Status Components"]},input:cq,output:sq,pagination:"none",async:"sync"}),hq=c.enum(["degraded","outage"]).describe("Severity of a status-page incident. 'outage' marks the component down; 'degraded' marks partial impact."),oP=c.object({id:c.string().uuid(),componentId:c.string().uuid(),projectId:c.string().uuid(),severity:hq,summary:c.string().describe("Human-readable summary of the status-page issue."),startedAt:c.string().datetime().describe("When the incident began affecting the component."),resolvedAt:c.string().datetime().nullable().describe("When the incident was resolved, or null while ongoing.")}),lq=c.object({projectId:c.string().uuid().optional().describe("Project to list status-page issues for. Auto-filled from CLI and SDK context when omitted."),componentId:c.string().uuid().optional().describe("Restrict results to a single component."),activeOnly:c.union([c.boolean(),c.stringbool()]).default(!1).describe("When true, return only unresolved (ongoing) issues."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of issues to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),uq=c.object({incidents:c.array(oP),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),gq=c.object({timestamp:c.string().datetime(),status:c.enum(["operational","degraded","outage","unknown"]).describe("Worst component status observed during this timeline bucket.")}),dq=c.object({componentId:c.string().uuid().describe("Status component to build the timeline for."),windowStart:c.string().datetime({offset:!0}).optional().describe("Start of the timeline window. Defaults to 7 days before windowEnd."),windowEnd:c.string().datetime({offset:!0}).optional().describe("End of the timeline window. Defaults to now.")}),yq=c.object({componentId:c.string().uuid(),windowStart:c.string().datetime(),windowEnd:c.string().datetime(),timeline:c.array(gq),incidents:c.array(oP)}),Vu=$({operationId:"statusComponents.incidents.list",description:"List status-page issues in a project.",backend:"api",route:{method:"GET",path:"/status-incidents",tags:["Status Components"]},input:lq,output:uq,pagination:"cursor",async:"sync"}),eg=$({operationId:"statusComponents.timeline",description:"Get the dense status timeline and incidents for a component over a time window.",backend:"api",route:{method:"GET",path:"/status-components/{componentId}/timeline",tags:["Status Components"]},input:dq,output:yq,pagination:"none",async:"sync"}),Lse={list:Zu.contract,get:Fu.contract,register:Ir.contract,deregister:Qu.contract,incidents:{list:Vu.contract},timeline:eg.contract}});var bq;var pq=g(()=>{bq=["onboarding","setup"]});var mq,wq,vq,fq,Dc;var rP=g(()=>{pq();fe();je();mq=c.enum(bq),wq=c.object({id:c.string().describe("Unique task identifier (e.g. install_github_app)."),label:c.string().describe("Short human-readable task name."),description:c.string().describe("Explanation of what needs to be completed to satisfy this task."),instructions:c.string().describe("Step-by-step instructions for completing this task."),completed:c.boolean().describe("Whether the task has been completed."),completedAt:c.string().datetime().nullable().describe("ISO 8601 timestamp of when the task was completed, or null."),category:mq.describe("Task category: onboarding (core setup steps) or setup (additional configuration).")}),vq=c.object({projectId:c.string().uuid().optional().describe("Project to list tasks for. Auto-filled from CLI and SDK context when omitted.")}),fq=c.object({tasks:c.array(wq).describe("All onboarding and setup tasks with their current completion status.")}),Dc=$({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:vq,output:fq,pagination:"none",async:"sync"})});var aP;var kq=g(()=>{ZA();QA();jf();R_();xf();Jf();Hf();tO();ju();RB();WB();pJ();wJ();vJ();fJ();qO();NJ();WO();Ru();MO();ZJ();nP();iP();rP();IO();aP={me:nO.contract,automations:{list:hv.contract,get:lv.contract,create:uv.contract,update:gv.contract,enable:dv.contract,disable:yv.contract,runs:{list:bv.contract,get:pv.contract,logs:mv.contract}},logs:{query:qi.contract,schema:Hi.contract,volume:Wi.contract,patterns:Mi.contract,nativeQuery:Yi.contract,searchNatural:bl.contract},dataSources:{listTypes:Gh.contract,listConnections:Ri.contract,getConnection:Bh.contract,listInstances:Jh.contract,getInstance:qh.contract,createConnection:Ui.contract,disconnectConnection:Zh.contract,listStreams:Hh.contract,listInstanceStreams:Wh.contract,createStream:Mh.contract,getStream:Yh.contract,deleteStream:Xh.contract},integrations:{listProviders:N_.contract,listConnections:__.contract,getConnection:j_.contract},notificationChannels:{getProject:AO.contract},notificationDeliveryRules:{list:LO.contract,create:DO.contract,setEnabled:zO.contract,delete:NO.contract},mcpConnectors:{listProviders:_u.contract,list:dr.contract,get:yr.contract,details:br.contract},sandboxPresets:{listConnections:vr.contract,listTypes:Mu.contract,upsertPreset:Yu.contract},scripts:{list:ZO.contract,get:FO.contract,create:QO.contract,update:VO.contract,delete:eP.contract},onboarding:{getState:jO.contract,skipIntegration:RO.contract,skipGithubAppInstallation:UO.contract,skipSampleIssue:EO.contract,finish:KO.contract},organizations:{list:GO.contract,get:BO.contract,create:xO.contract,update:JO.contract},members:{list:oO.contract,updateRole:iO.contract,remove:rO.contract},publicKeys:{list:Ki.contract,get:xi.contract,ensureLogForwarding:Gi.contract,update:Bi.contract,deactivate:Ji.contract},secretKeys:{list:ll.contract,get:ul.contract,create:gl.contract,update:dl.contract,delete:yl.contract},projects:{list:Bu.contract,get:Ju.contract,create:qu.contract,update:Hu.contract,delete:Wu.contract},search:{threads:fr.contract,messages:kr.contract},messages:{list:qB.contract,append:HB.contract},threads:{list:uO.contract,get:gO.contract,getStatus:dO.contract,stop:yO.contract,create:bO.contract,update:pO.contract,fork:mO.contract,setVisibility:wO.contract,createShareLink:vO.contract,listShareLinks:fO.contract,revokeShareLink:kO.contract},runs:{list:aO.contract,listForThread:cO.contract,get:sO.contract,cancel:hO.contract},pullRequests:{list:HO.contract},issues:{count:tl.contract,create:Ei.contract,list:Vh.contract,search:el.contract,get:nl.contract,resolve:ol.contract,ignore:il.contract,reopen:Kf.contract,mute:rl.contract,unmute:al.contract},billing:{getSummary:wv.contract,getUsage:vv.contract,listTransactions:fv.contract},tasks:{list:Dc.contract},recommendations:{list:Cc.contract},statusComponents:{list:Zu.contract,get:Fu.contract,register:Ir.contract,deregister:Qu.contract,incidents:{list:Vu.contract},timeline:eg.contract}}});var zc=g(()=>{qA();kq();jf();xf();Jf();Hf();tO();qO();WO();MO();nP();iP();rP()});var Dse="https://api.sazabi.com",zse="x-sazabi-client-source",Oq=(e)=>{return{streamRun:async(t)=>{return Iq({options:e,path:`/runs/${encodeURIComponent(t.runId)}/stream`,cursor:t.cursor,signal:t.signal})},streamThread:async(t)=>{return Iq({options:e,path:`/threads/${encodeURIComponent(t.threadId)}/stream`,cursor:t.cursor,signal:t.signal})}}},Iq=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(),i=Nse(e.options.apiBaseUrl,e.path,e.cursor);return jse({url:i,token:n,clientSource:e.options.clientSource,initialCursor:e.cursor,signal:e.signal,fetch:t})},Nse=(e,t,n)=>{let i=_se(e??Dse),o=new URL(`${i}${t}`);if(n)o.searchParams.set(iv,n);return o.toString()},_se=(e)=>{let t=e.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},jse=async(e)=>{let t=[],n=[],i=!1,o=!1,r,a=e.initialCursor,s=new AbortController,h=(v)=>{if(i)return;i=!0,r=v;while(n.length>0)n.shift()?.({value:void 0,done:!0})},l=(v)=>{let O=n.shift();if(O){O({value:v,done:!1});return}t.push(v)},u=(v)=>{if(v.event===av){let A=xse(v.data);if(A!==void 0)a=A;return}if(v.data===cv){o=!0,s.abort(),h();return}let O=Gse(v.data);if(O)l(O)},d=()=>{o=!0,s.abort(),h()};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 a},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(i){if(r)throw r;return{value:void 0,done:!0}}return new Promise((v)=>{n.push(v)}).then((v)=>{if(v.done&&r)throw r;return v})},return:async()=>{return o=!0,s.abort(),h(),{value:void 0,done:!0}},throw:async(v)=>{throw o=!0,s.abort(),h(v instanceof Error?v:Error(String(v))),v},close:async()=>{o=!0,s.abort(),h()}};if(o)return h(),y;let b=await e.fetch(e.url,{method:rv,headers:Rse(e.token,e.clientSource),signal:s.signal});if(await Use(b))h();else Ese(b,u).then(()=>h()).catch((v)=>{if(Jse(v)||o||e.signal?.aborted){h();return}h(qse(v))});return y},Rse=(e,t)=>{return{accept:"text/event-stream",authorization:`Bearer ${e}`,...t?{[zse]:t}:{}}},Use=async(e)=>{if(e.status===204)return!0;if(e.ok&&e.body)return!1;let t=await Bse(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}`)},Ese=async(e,t)=>{let n=e.body?.getReader();if(!n)throw Error("Agent stream response did not include a body.");let i=new TextDecoder,o="",r=Kse(t);try{while(!0){let a=await n.read();if(a.done)break;o+=i.decode(a.value,{stream:!0});let s=o.split(/\r\n|\r|\n/);o=s.pop()??"";for(let h of s)r.line(h)}if(o+=i.decode(),o)for(let a of o.split(/\r\n|\r|\n/))r.line(a);r.flush()}finally{n.releaseLock()}},Kse=(e)=>{let t="message",n=[],i=()=>{t="message",n=[]},o=()=>{if(n.length===0){i();return}e({event:t,data:n.join(`
|
|
8558
|
+
`)}],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."})});var dG;var yG=g(()=>{F();dG=C({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 `https://mcp.sentry.dev/mcp` for broad access. To scope this connection to one organization or project, copy a path-scoped URL such as `https://mcp.sentry.dev/mcp/your-org` or `https://mcp.sentry.dev/mcp/your-org/your-project`.",defaultServerUrl:"https://mcp.sentry.dev/mcp",imageKeys:["mcp.sentry.url-configuration-page"],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 bG;var pG=g(()=>{F();bG=C({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:FK,normalizeHeaders:ZK})});var mG;var wG=g(()=>{F();mG=C({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 vG;var fG=g(()=>{F();vG=C({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 kG;var IG=g(()=>{F();kG=C({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 OG;var PG=g(()=>{F();OG=C({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:"Create a read-only API key in [The Context Company](https://docs.thecontext.company/access-data/mcp), then paste the raw key below. Sazabi sends it as `Authorization: Bearer <key>` to `https://api.thecontext.company/mcp`.",fieldKeys:["apiKey"]}],validateCredentials:BK,normalizeHeaders:GK,skill:"the-context-company",setupSkill:"the-context-company-setup"})});var SG;var $G=g(()=>{F();SG=C({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."})});var TG;var AG=g(()=>{F();TG=C({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 an X API OAuth 2.0 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:"Create an OAuth 2.0 Bearer token",description:"Generate the OAuth 2.0 access token the hosted MCP server will use.",body:"In your app's **Keys and tokens**, generate an OAuth 2.0 access token and copy it. Paste the raw token into Sazabi — Sazabi adds the `Bearer ` prefix and sends it in the `Authorization` header.",fieldKeys:["accessToken"]}],validateCredentials:JK,normalizeHeaders:xK,skill:"x",setupSkill:"x-setup"})});var CG,l6e;var LG=g(()=>{Ox();Sx();Tx();Cx();eO();eO();zx();_x();Rx();Ex();xx();Bx();qx();Wx();Yx();Zx();Qx();e0();n0();i0();a0();s0();l0();g0();y0();p0();w0();f0();I0();P0();$0();A0();L0();z0();_0();R0();E0();x0();B0();q0();W0();Y0();Z0();Q0();eG();nG();iG();aG();sG();lG();gG();yG();pG();wG();fG();IG();PG();$G();AG();CG=[vG,r0,c0,Ix,Px,$x,Ax,Lx,Dx,Nx,jx,Ux,Kx,Gx,Hx,Mx,Xx,Fx,Jx,Vx,t0,h0,u0,d0,b0,m0,v0,k0,O0,S0,T0,C0,D0,N0,j0,U0,K0,G0,J0,H0,M0,X0,F0,V0,tG,rG,oG,cG,hG,uG,dG,bG,mG,kG,OG,SG,TG,o0],l6e=new Map(CG.map((e)=>[e.id,e]))});var DG=()=>{};var zG=()=>{};var NG=()=>{};var _G=()=>{};var jG=()=>{};var RG=()=>{};var UG=()=>{};var EG=()=>{};var KG=()=>{};var xG=()=>{};var GG=()=>{};var BG=()=>{};var JG=()=>{};var qG=()=>{};var HG=()=>{};var WG=()=>{};var MG=()=>{};var YG=()=>{};var XG=()=>{};var ZG=()=>{};var FG=()=>{};var QG=()=>{};var VG=()=>{};var eB=()=>{};var tB=()=>{};var nB=()=>{};var oB=()=>{};var iB=()=>{};var rB=()=>{};var aB=()=>{};var cB=()=>{};var sB=()=>{};var hB=()=>{};var lB=()=>{};var uB=()=>{};var gB=()=>{};var dB=()=>{};var yB=()=>{};var bB=()=>{};var pB=()=>{};var mB=g(()=>{DG();zG();NG();_G();jG();RG();UG();EG();KG();xG();GG();BG();JG();qG();HG();WG();MG();YG();XG();ZG();FG();QG();VG();eB();tB();nB();oB();iB();rB();aB();cB();sB();hB();lB();uB();gB();dB();yB();bB();pB()});var wB=()=>{};var vB=()=>{};var fB=g(()=>{Bj();wl();NK();mx();LG();QI();mB();wB();vB()});var kB,lae,IB,uae,OB,gae,PB,SB,Nu,$B,TB,AB,dr,CB,LB,yr,DB,zB,br,NB,dae,_B,_u,yae;var tO=g(()=>{fB();fe();je();kB=["configured","authorizing","connected","error"],lae=c.enum(kB),IB=["preset","custom"],uae=c.enum(IB),OB=["streamable-http","sse"],gae=c.enum(OB),PB=["none","headers","oauth","aws-sigv4"],SB=c.enum(PB),Nu=c.object({connectionId:c.string().uuid().describe("Connection ID."),connectionKey:c.string().describe("Stable key used to reference this connector in tool calls."),providerId:c.string().describe('Provider identifier, e.g. "linear".'),displayName:c.string().describe("Human-readable connector name."),source:uae.describe("Whether the connector is a built-in preset or a custom server."),installStatus:lae.describe("Current connection lifecycle status."),authMode:SB.describe("Authentication mode."),transport:gae.describe("Transport protocol."),serverUrl:c.string().describe("MCP server URL."),readOnly:c.boolean().describe("Whether the connector is restricted to read-only tools."),management:Qf.describe("Lifecycle owner and supported connector mutations."),enabledToolCount:c.number().int().nonnegative().describe("Number of tools enabled and available for this connector."),connectedAt:c.string().datetime().nullable().describe("When the connector last became connected, if ever."),createdAt:c.string().datetime(),updatedAt:c.string().datetime()}),$B=c.object({name:c.string().describe("Tool name as invoked."),title:c.string().describe("Human-readable tool title."),description:c.string().describe("Tool description."),isReadOnly:c.boolean().describe("Whether the tool is considered read-only."),enabled:c.boolean().describe("Whether the tool is enabled and available given the connector config.")}),TB=c.object({projectId:c.string().uuid().optional().describe("Project to list connectors for. Auto-filled from SDK context when omitted."),connectedOnly:c.boolean().optional().describe("When true, only return connectors that are connected.")}),AB=c.object({connectors:c.array(Nu)}),dr=$({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:TB,output:AB,pagination:"none",async:"sync"}),CB=c.object({connectionId:c.string().uuid().describe("Connection ID to fetch."),projectId:c.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),LB=c.object({connector:Nu}),yr=$({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:CB,output:LB,pagination:"none",async:"sync"}),DB=c.object({connectionId:c.string().uuid().describe("Connection ID to inspect."),projectId:c.string().uuid().optional().describe("Project the connector belongs to. Auto-filled from SDK context when omitted.")}),zB=c.object({connector:Nu,tools:c.array($B)}),br=$({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:DB,output:zB,pagination:"none",async:"sync"}),NB=c.object({providerId:c.string().describe('Provider identifier, e.g. "linear".'),label:c.string().describe("Human-readable provider name."),authMode:SB.describe("Authentication mode."),availability:c.enum(Xi).describe("Whether the provider is enabled or coming soon."),setupSkill:c.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),dae=c.object({}),_B=c.object({providers:c.array(NB)}),_u=$({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:dae,output:_B,pagination:"none",async:"sync"}),yae={list:dr.contract,get:yr.contract,details:br.contract,listProviders:_u.contract}});var pr,bae,pae,mae,wae,vae,fae,kae,nO,_Ge;var ju=g(()=>{fe();je();pr=c.enum(["admin","member"]),bae=c.object({id:c.string().min(1),name:c.string(),slug:c.string(),logo:c.string().nullable().optional(),role:pr}),pae=c.object({id:c.string().min(1),name:c.string().nullable(),email:c.string().email()}),mae=c.object({credentialType:c.literal("user"),user:pae,activeOrganizationId:c.string().min(1).nullable(),organizations:c.array(bae).describe("Organizations the user belongs to, including membership role.")}),wae=c.object({credentialType:c.literal("secret"),organization:c.object({id:c.string().min(1),name:c.string(),slug:c.string(),logo:c.string().nullable().optional()}),keyName:c.string()}),vae=c.object({credentialType:c.literal("partner"),superorganization:c.object({id:c.string().uuid(),name:c.string()})}),fae=c.object({}),kae=c.discriminatedUnion("credentialType",[mae,wae,vae]),nO=$({operationId:"me.get",description:"Return the identity and available context for the current credential.",backend:"api",route:{method:"GET",path:"/me",tags:["Auth"]},input:fae,output:kae,pagination:"none",async:"sync"}),_Ge=nO.contract});var jB,Iae,Oae,Pae,Sae,$ae,Tae,oO,iO,rO,KGe;var RB=g(()=>{fe();je();ju();jB=c.object({membershipId:c.string().min(1).describe("Organization membership record ID."),userId:c.string().min(1).describe("User ID for the organization member."),name:c.string().nullable().describe("Display name for the member, when available."),email:c.string().email().describe("Email address for the member."),imageUrl:c.string().nullable().describe("Profile image URL for the member, when available."),role:pr.describe("Organization role."),createdAt:c.string().datetime().describe("When the membership was created.")}),Iae=c.object({organizationId:c.string().min(1).optional().describe("Organization to list members for. Auto-filled from CLI and SDK context when omitted.")}),Oae=c.object({members:c.array(jB).describe("Members visible within the selected organization.")}),Pae=c.object({organizationId:c.string().min(1).optional().describe("Organization containing the member. Auto-filled from CLI and SDK context when omitted."),userId:c.string().min(1).describe("User ID of the member to update."),role:pr.describe("Role to assign.")}),Sae=c.object({member:jB.describe("Updated organization member.")}),$ae=c.object({params:c.object({userId:c.string().min(1).describe("User ID of the member to remove.")}),query:c.object({organizationId:c.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})),Tae=c.object({removedUserId:c.string().min(1).describe("User ID removed from the organization.")}),oO=$({operationId:"members.list",description:"List members in an organization.",backend:"api",route:{method:"GET",path:"/members",tags:["Members"]},input:Iae,output:Oae,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"}]}}]}),iO=$({operationId:"members.updateRole",description:"Update a member's organization role.",backend:"api",route:{method:"PATCH",path:"/members/{userId}/role",tags:["Members"]},input:Pae,output:Sae,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"}}}]}),rO=$({operationId:"members.remove",description:"Remove a member from an organization.",backend:"api",route:{method:"DELETE",path:"/members/{userId}",tags:["Members"],inputStructure:"detailed"},input:$ae,output:Tae,pagination:"none",async:"sync"}),KGe={list:oO.contract,updateRole:iO.contract,remove:rO.contract}});var UB,EB,Aae,Cae,Lae,Dae,zae,Ic,Nae,_ae,jae,aO,cO,sO,hO,JGe;var Ru=g(()=>{fe();je();UB=c.enum(["processing","completed","aborted","error"]),EB=c.object({id:c.string().uuid(),threadId:c.string().uuid(),userMessageId:c.string().uuid().nullable(),assistantMessageId:c.string().uuid().nullable(),parentRunId:c.string().uuid().nullable(),workflowRunId:c.string().nullable(),status:UB,source:c.enum(["app","api","mcp","slack","teams","linear","github","agent","cli"]),createdAt:c.string().datetime(),updatedAt:c.string().datetime(),completedAt:c.string().datetime().nullable()}),Aae=c.object({projectId:c.string().uuid().optional().describe("Project ID to list runs for. Auto-filled from CLI and SDK context when omitted."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:c.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),Cae=c.object({runs:c.array(EB),nextCursor:c.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),Lae=c.object({threadId:c.string().uuid().describe("Thread ID to list runs for."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of runs to return per page."),cursor:c.string().datetime().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),Dae=c.object({runs:c.array(EB),nextCursor:c.string().datetime().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),zae=c.object({runId:c.string().uuid().describe("Run ID returned by a deferred operation.")}),Ic=c.object({completed:c.boolean().describe("Whether the run has reached a terminal status."),threadId:c.string().uuid().describe("Thread ID associated with the run."),runId:c.string().uuid().describe("Run ID for subsequent polling."),messageId:c.string().uuid().optional().describe("ID of the user message that triggered this run."),status:UB.describe("Current run lifecycle status."),response:c.string().nullable().describe("Assistant response text when the run has completed.")}),Nae=Ic.describe("Current run state and, when complete, the assistant response."),_ae=c.object({runId:c.string().uuid().describe("Run ID of the in-flight run to request cancellation for.")}),jae=c.object({success:c.literal(!0).describe("Always true when the cancellation request was accepted.")}),aO=$({operationId:"runs.list",description:"List deferred runs within one project.",backend:"api",route:{method:"GET",path:"/runs",tags:["Runs"]},input:Aae,output:Cae,pagination:"cursor",async:"sync"}),cO=$({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:Lae,output:Dae,pagination:"cursor",async:"sync"}),sO=$({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:zae,output:Nae,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}}]}),hO=$({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:_ae,output:jae,pagination:"none",async:"sync",examples:[{name:"cancel-processing-run",input:{runId:"33333333-3333-4333-8333-333333333333"},output:{success:!0}}]}),JGe={list:aO.contract,listForThread:cO.contract,get:sO.contract,cancel:hO.contract}});var Uu=(e,t,n)=>{let i=t?20000:1e4;if(e.length>i)n.addIssue({code:"too_big",maximum:i,type:"string",inclusive:!0,message:`Message cannot exceed ${i} characters`,origin:"string",path:["message"]})},Eu=(e,t,n)=>{if(e&&!t)n.addIssue({code:"custom",message:"ambientServiceRun requires an automationId",path:["ambientServiceRun"]})};var KB,Oc,Rae,Uae,Eae,Kae,xae,Gae,Bae,Jae,qae,lO,Hae,Wae,Mae,Yae,Xae,Zae,Fae,Qae,Vae,ece,tce,nce,uO,gO,dO,yO,bO,pO,xB,oce,ice,rce,ace,GB,cce,sce,hce,lce,uce,gce,Wo="22222222-2222-4222-8222-222222222222",BB="11111111-1111-4111-8111-111111111111",dce="44444444-4444-4444-8444-444444444444",JB="55555555-5555-4555-8555-555555555555",mO,wO,vO,fO,kO,ZGe;var IO=g(()=>{fe();je();Ru();KB=c.enum(["slack","teams","linear","github","app","mcp","agent","api","cli"]),Oc=c.object({id:c.string().uuid(),projectId:c.string().uuid(),title:c.string().nullable(),status:c.enum(["regular","archived"]),source:KB.nullable(),createdAt:c.string().datetime(),updatedAt:c.string().datetime()}),Rae=c.object({type:c.literal("message"),message:c.string()}),Uae=c.object({type:c.literal("reasoning"),reasoning:c.string(),status:c.enum(["in_progress","complete"]).optional()}),Eae=c.object({type:c.literal("tool_call"),name:c.string(),params:c.any().optional(),result:c.any().optional(),status:c.enum(["in_progress","success","error","unknown"]).optional(),toolCallId:c.string().optional(),durationMs:c.number().nonnegative().optional()}),Kae=c.object({type:c.literal("artifact"),name:c.enum(["timeseries","table","log_detail","integration_required","alert_card","issue_card","mdx"]),data:c.any(),toolCallId:c.string().optional()}),xae=c.object({type:c.literal("fork"),sourceThreadId:c.string(),sourceMessageId:c.string(),sourceThreadTitle:c.string().nullable()}),Gae=c.object({type:c.literal("summary"),summary:c.string()}),Bae=c.object({type:c.literal("slack_context"),channelId:c.string(),isTruncated:c.boolean().optional(),messages:c.array(c.object({timestamp:c.string(),slackUserId:c.string().optional(),displayName:c.string(),text:c.string(),isBot:c.boolean(),files:c.array(c.object({name:c.string(),mimetype:c.string(),size:c.number().optional(),attachmentId:c.string().uuid().optional(),ingestionStatus:c.enum(["attached","unsupported","oversized","skipped","unavailable"]).optional()})).optional()}))}),Jae=c.object({type:c.literal("teams_context"),conversationId:c.string(),isTruncated:c.boolean().optional(),messages:c.array(c.object({activityId:c.string().optional(),displayName:c.string(),text:c.string(),isBot:c.boolean(),createdDateTime:c.string().optional()}))}),qae=c.union([Rae,Uae,Eae,Kae,xae,Gae,Bae,Jae]),lO=c.object({id:c.string().uuid(),role:c.enum(["user","assistant"]),content:c.array(qae),source:KB,createdAt:c.string().datetime()}),Hae=c.object({projectId:c.string().uuid().optional().describe("Project to list threads for. Auto-filled from CLI and SDK context when omitted."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of threads to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:c.enum(["regular","archived"]).optional().describe("Filter by thread status. 'regular' returns active threads, 'archived' returns archived threads.")}),Wae=c.object({threads:c.array(Oc).describe("The page of threads matching the query."),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),Mae=c.object({threadId:c.string().uuid().describe("Thread ID returned by threads.list or threads.create.")}),Yae=c.object({thread:Oc.describe("The requested thread."),messages:c.array(lO).describe("Messages currently stored on the thread in chronological order.")}),Xae=c.object({projectId:c.string().uuid().optional().describe("Project to create the thread in. Auto-filled from CLI and SDK context when omitted."),message:c.string().min(1,"Message cannot be empty").describe("Initial user message that starts the thread."),wait:c.boolean().default(!0).describe("Whether the server should wait for the agent run before responding."),timeoutSeconds:c.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:c.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:c.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)=>{Uu(e.message,e.automationId,t),Eu(e.ambientServiceRun,e.automationId,t)}),Zae=Ic.describe("Deferred run result for creating a thread."),Fae=c.object({threadId:c.string().uuid().describe("Thread ID whose current processing status should be returned.")}),Qae=c.object({status:c.enum(["idle","processing"]),lastRunStatus:c.enum(["error"]).nullable()}),Vae=c.object({threadId:c.string().uuid().describe("Thread ID whose active run should be stopped.")}),ece=c.object({success:c.literal(!0).describe("Always true when the stop request was accepted.")}),tce=c.object({threadId:c.string().uuid().describe("Thread ID of the thread to update."),status:c.enum(["regular","archived"]).describe("New status for the thread. 'archived' hides the thread from the sidebar.")}),nce=c.object({thread:Oc.describe("The updated thread.")}),uO=$({operationId:"threads.list",description:"List threads in a project, optionally filtered by status.",backend:"api",route:{method:"GET",path:"/threads",tags:["Threads"]},input:Hae,output:Wae,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}}]}),gO=$({operationId:"threads.get",description:"Get a thread and its messages.",backend:"api",route:{method:"GET",path:"/threads/{threadId}",tags:["Threads"]},input:Mae,output:Yae,pagination:"none",async:"sync"}),dO=$({operationId:"threads.getStatus",description:"Get the current processing status for a thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/status",tags:["Threads"]},input:Fae,output:Qae,pagination:"none",async:"sync",examples:[{name:"processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{status:"processing",lastRunStatus:null}}]}),yO=$({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:Vae,output:ece,pagination:"none",async:"sync",examples:[{name:"stop-processing-thread",input:{threadId:"22222222-2222-4222-8222-222222222222"},output:{success:!0}}]}),bO=$({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:Xae,output:Zae,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}}]}),pO=$({operationId:"threads.update",description:"Update a thread's status.",backend:"api",route:{method:"PATCH",path:"/threads/{threadId}",tags:["Threads"]},input:tce,output:nce,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"}}}]}),xB=c.enum(["private","organization"]),oce=c.object({threadId:c.string().uuid().describe("Thread ID of the source thread to fork."),messageId:c.string().uuid().describe("Message ID in the source thread to fork from. The new thread copies messages up to and including this message.")}),ice=c.object({thread:Oc.describe("The newly created forked thread.")}),rce=c.object({threadId:c.string().uuid().describe("Thread ID of the thread to update."),visibility:xB.describe("New visibility. 'private' restricts the thread to its owner; 'organization' shares it with the organization.")}),ace=c.object({thread:Oc.describe("The updated thread."),visibility:xB.describe("The thread's resulting visibility.")}),GB=c.object({shareId:c.string().uuid().describe("Unique identifier for the snapshot."),threadId:c.string().uuid().describe("Thread the snapshot was taken from."),url:c.string().describe("Public read-only URL for the snapshot."),createdAt:c.string().datetime()}),cce=c.object({threadId:c.string().uuid().describe("Thread ID to create a public read-only snapshot for.")}),sce=c.object({share:GB.describe("The created share link.")}),hce=c.object({threadId:c.string().uuid().describe("Thread ID the snapshot belongs to."),shareId:c.string().uuid().describe("Snapshot ID to revoke.")}),lce=c.void(),uce=c.object({threadId:c.string().uuid().describe("Thread ID to list public snapshots for.")}),gce=c.object({shares:c.array(GB).describe("Active share links for the thread.")}),mO=$({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:oce,output:ice,pagination:"none",async:"sync",examples:[{name:"fork-from-message",input:{threadId:Wo,messageId:dce},output:{thread:{id:"66666666-6666-4666-8666-666666666666",projectId:BB,title:"API returning 500s (fork)",status:"regular",source:"api",createdAt:"2026-01-01T00:20:00.000Z",updatedAt:"2026-01-01T00:20:00.000Z"}}}]}),wO=$({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:rce,output:ace,pagination:"none",async:"sync",examples:[{name:"make-private",input:{threadId:Wo,visibility:"private"},output:{thread:{id:Wo,projectId:BB,title:"API returning 500s",status:"regular",source:"api",createdAt:"2026-01-01T00:00:00.000Z",updatedAt:"2026-01-01T00:30:00.000Z"},visibility:"private"}}]}),vO=$({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:cce,output:sce,pagination:"none",async:"sync",examples:[{name:"create-share-link",input:{threadId:Wo},output:{share:{shareId:JB,threadId:Wo,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}}}]}),fO=$({operationId:"threads.listShareLinks",description:"List active public share links for a thread.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/share",tags:["Threads"]},input:uce,output:gce,pagination:"none",async:"sync",examples:[{name:"list-share-links",input:{threadId:Wo},output:{shares:[{shareId:JB,threadId:Wo,url:"https://app.sazabi.com/share/55555555-5555-4555-8555-555555555555",createdAt:"2026-01-01T00:40:00.000Z"}]}}]}),kO=$({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:hce,output:lce,pagination:"none",async:"sync"}),ZGe={list:uO.contract,get:gO.contract,getStatus:dO.contract,stop:yO.contract,create:bO.contract,update:pO.contract,fork:mO.contract,setVisibility:wO.contract,createShareLink:vO.contract,listShareLinks:fO.contract,revokeShareLink:kO.contract}});var yce,bce,pce,mce,qB,HB;var WB=g(()=>{fe();je();Ru();IO();yce=c.object({threadId:c.string().uuid().describe("Thread ID to list messages for."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of messages to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),bce=c.object({messages:c.array(lO),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),pce=c.object({threadId:c.string().uuid().describe("Thread ID to append the message to."),message:c.string().min(1,"Message cannot be empty").describe("Message body to append to the thread."),wait:c.boolean().default(!0).describe("Whether the server should wait for the appended message run before responding."),timeoutSeconds:c.coerce.number().int().min(1).max(20).default(20).describe("Maximum seconds to wait when wait is true before handing off to polling."),automationId:c.string().uuid().optional().describe("Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run."),ambientServiceRun:c.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)=>{Uu(e.message,e.automationId,t),Eu(e.ambientServiceRun,e.automationId,t)}),mce=Ic.describe("Deferred run result for appending a message to an existing thread."),qB=$({operationId:"messages.list",description:"List messages in a thread with cursor pagination.",backend:"api",route:{method:"GET",path:"/threads/{threadId}/messages",tags:["Messages"]},input:yce,output:bce,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}}]}),HB=$({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:pce,output:mce,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 MB,wce=(e,t)=>e.value===t.value&&e.label===t.label&&e.scope===t.scope&&e.role===t.role&&e.defaultOff===t.defaultOff,wt=(e)=>{for(let t of Object.values(e)){let n=MB.get(t.value);if(n&&!wce(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}`);MB.set(t.value,t)}return e};var xn=g(()=>{MB=new Map});var YB;var XB=g(()=>{xn();YB=wt({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 ZB;var FB=g(()=>{xn();ZB=wt({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 QB;var VB=g(()=>{xn();QB=wt({INTEGRATION_CONNECTED:{value:"integration_connected",label:"Integration connected",scope:"org",defaultOff:!0},INTEGRATION_DISCONNECTED:{value:"integration_disconnected",label:"Integration disconnected",scope:"org"}})});var eJ;var tJ=g(()=>{xn();eJ=wt({ISSUE_TRIGGERED:{value:"issue_triggered",label:"Issue triggered",scope:"project"},ISSUE_RESOLVED:{value:"issue_resolved",label:"Issue resolved",scope:"project"},ISSUE_IGNORED:{value:"issue_ignored",label:"Issue ignored",scope:"project"}})});var nJ;var oJ=g(()=>{xn();nJ=wt({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 iJ;var rJ=g(()=>{xn();iJ=wt({SANDBOX_CREATED:{value:"sandbox_created",label:"Sandbox connected",scope:"project",defaultOff:!0},SANDBOX_DELETED:{value:"sandbox_deleted",label:"Sandbox disconnected",scope:"project",defaultOff:!0},DATA_SOURCE_CONNECTED:{value:"data_source_connected",label:"Data source connected",scope:"project",defaultOff:!0},DATA_SOURCE_DISCONNECTED:{value:"data_source_disconnected",label:"Data 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 aJ;var cJ=g(()=>{xn();aJ=wt({SECURITY_ALERT:{value:"security_alert",label:"Security alert",scope:"org",role:"admin"}})});var OO,it,sJ,hJ=(e)=>sJ.get(e)?.scope,PO=(e)=>{let t=sJ.get(e)?.label;if(t)return t;let n=e.replace(/_/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):e},SO=(e)=>hJ(e)==="project";var Pc=g(()=>{XB();FB();VB();tJ();oJ();rJ();cJ();xn();OO={...aJ,...nJ,...QB,...YB,...eJ,...iJ,...ZB},it=Object.fromEntries(Object.entries(OO).map(([e,t])=>[e,t.value])),sJ=new Map(Object.values(OO).map((e)=>[e.value,e]))});var Sc,lJ,CBe,Ku,LBe,Xt,$O,$c,Mo,fce;var Tc=g(()=>{Pc();Sc=Object.values(it),lJ=[it.BILLING_PLAN_UPGRADE_APPLIED,it.BILLING_PLAN_DOWNGRADE_SCHEDULED,it.BILLING_PLAN_DOWNGRADE_APPLIED,it.BILLING_CREDIT_BALANCE_LOW,it.BILLING_CREDIT_BALANCE_DEPLETED,it.BILLING_AUTO_TOP_UP_SETTINGS_CHANGED,it.BILLING_AUTO_TOP_UP_FAILED,it.BILLING_INVOICE_PAID,it.BILLING_NEGATIVE_BALANCE_COLLECTED,it.BILLING_NEGATIVE_BALANCE_COLLECTION_FAILED],CBe=new Set(lJ),Ku=[it.ISSUE_TRIGGERED,it.ISSUE_RESOLVED,it.ISSUE_IGNORED,it.AUTOMATION_RUN_FAILED],LBe=new Set(Ku),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"},$O=[Xt.IN_APP,Xt.SLACK,Xt.EMAIL,Xt.SMS],$c=[Xt.SLACK_CHANNEL,Xt.TEAMS_CHANNEL,Xt.INCIDENT_IO,Xt.PAGERDUTY,Xt.ROOTLY,Xt.WEBHOOK],Mo=Object.values(Xt),fce=[...Mo,"victorops"]});var mr,xu,Yo;var uJ=g(()=>{fe();Tc();mr=c.enum(Mo),xu=c.enum($c),Yo=c.enum(Sc)});var kce,dJ,UBe,EBe,KBe,gJ;var yJ=g(()=>{Pc();Tc();kce=Ku.map((e)=>({notificationType:e,label:PO(e)})),dJ=[{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"}],UBe=new Set($O),EBe=new Set($c),KBe=Sc.filter(SO),gJ=new Set(dJ.map(({channel:e})=>e));if(gJ.size!==Mo.length||Mo.some((e)=>!gJ.has(e)))throw Error("Notification channel card definitions must represent every channel")});var bJ=g(()=>{Pc();Tc()});var TO=g(()=>{Pc();Tc();uJ();yJ();bJ()});var Pce,Sce,$ce,Tce,Ace,Cce,Lce,AO,dJe;var pJ=g(()=>{TO();fe();je();Pce=c.enum(["ready","missing","degraded","unavailable"]),Sce=c.object({id:c.string(),label:c.string(),status:c.enum(["active","inactive","degraded"]),statusLabel:c.string()}),$ce=c.object({channel:mr,name:c.string(),description:c.string(),scope:c.enum(["personal","project"]),enabled:c.boolean().nullable(),preferenceId:c.string().nullable(),prerequisite:c.object({status:Pce,statusLabel:c.string(),message:c.string()}),action:c.object({label:c.string(),href:c.string()}).nullable(),destinations:c.array(Sce),destinationManagement:c.enum(["none","slack_channels","teams_channels","integration_connections","webhook_endpoints"]),canCreateDestinations:c.boolean(),supportedNotificationTypes:c.array(Yo)}),Tce=c.object({channel:xu,enabled:c.boolean(),preferenceId:c.string().nullable()}),Ace=c.object({channel:xu,notificationType:Yo,enabled:c.boolean(),preferenceId:c.string()}),Cce=c.object({projectId:c.string().uuid().optional().describe("Project to inspect. Auto-filled from CLI and SDK context when omitted.")}),Lce=c.object({channelCards:c.array($ce).length(10),channels:c.array(Tce),notificationTypePreferences:c.array(Ace),issueNotificationMinSeverity:c.enum(["low","medium","high","critical"])}),AO=$({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:Cce,output:Lce,pagination:"none",async:"sync"}),dJe={getProject:AO.contract}});var mJ,Dce,zce,CO,Nce,_ce,jce,Rce,Uce,Ece,Kce,xce,LO,DO,zO,NO,wJe;var wJ=g(()=>{TO();fe();je();mJ=c.object({minSeverity:c.enum(["medium","high","critical"]).optional().describe("Suppress rules only: suppress deliveries whose issue severity is below this threshold."),component:c.string().min(1).max(200).optional().describe("Match the component the agent records on issue metadata (exact match).")}).strict(),Dce=c.object({id:c.string().uuid(),channel:c.string(),destinationKey:c.string(),displayName:c.string().nullable()}),zce=c.object({channel:c.enum(["slack_channel","teams_channel"]),destinationKey:c.string().min(1).describe("The stable destination id — the Slack channel id or Microsoft Teams channel id. Must be one of the project's configured notification channels.")}),CO=c.object({id:c.string().uuid(),projectId:c.string().uuid(),channel:mr.nullable().describe("Channel the rule targets; null means all channels."),notificationType:Yo.nullable().describe("Notification type the rule targets; null means all types."),priority:c.number().int().describe("Route-pass evaluation order; suppress rules are unordered."),condition:mJ,outcome:c.enum(["suppress","route"]),enabled:c.boolean(),destinations:c.array(Dce),createdAt:c.string().datetime(),updatedAt:c.string().datetime()}),Nce=c.object({projectId:c.string().uuid().optional().describe("Project to inspect. Auto-filled from CLI and SDK context when omitted.")}),_ce=c.object({rules:c.array(CO)}),jce=c.object({projectId:c.string().uuid().optional().describe("Project that owns the rule. Auto-filled from CLI and SDK context when omitted."),outcome:c.enum(["suppress","route"]).describe("suppress gates matching deliveries; route sends them to a destination subset."),channel:mr.nullable().describe("Channel to target; null targets all channels (suppress rules only)."),notificationType:Yo.nullable().describe("Notification type to target; null targets all types."),condition:mJ,destinations:c.array(zce).default([]).describe("Route rules only: the destinations to select.")}),Rce=CO,Uce=c.object({projectId:c.string().uuid().optional().describe("Project that owns the rule. Auto-filled from CLI and SDK context when omitted."),ruleId:c.string().uuid().describe("The delivery rule to update."),enabled:c.boolean()}),Ece=CO,Kce=c.object({projectId:c.string().uuid().optional().describe("Project that owns the rule. Auto-filled from CLI and SDK context when omitted."),ruleId:c.string().uuid().describe("The delivery rule to delete.")}),xce=c.object({removed:c.boolean()}),LO=$({operationId:"notificationDeliveryRules.list",description:"List a project's notification delivery rules — delivery-side suppress and route conditions evaluated after the preference gates.",backend:"api",route:{method:"GET",path:"/notification-delivery-rules",tags:["Notification delivery rules"]},input:Nce,output:_ce,pagination:"none",async:"sync"}),DO=$({operationId:"notificationDeliveryRules.create",description:"Create a delivery rule. Suppress rules gate a channel below a severity threshold or for a component; route rules send matching notifications to a subset of the project's configured Slack and Microsoft Teams destinations.",backend:"api",route:{method:"POST",path:"/notification-delivery-rules",tags:["Notification delivery rules"]},input:jce,output:Rce,pagination:"none",async:"sync"}),zO=$({operationId:"notificationDeliveryRules.setEnabled",description:"Enable or disable a delivery rule without deleting it.",backend:"api",route:{method:"POST",path:"/notification-delivery-rules/{ruleId}/set-enabled",tags:["Notification delivery rules"]},input:Uce,output:Ece,pagination:"none",async:"sync"}),NO=$({operationId:"notificationDeliveryRules.delete",description:"Delete a delivery rule.",backend:"api",route:{method:"DELETE",path:"/notification-delivery-rules/{ruleId}",tags:["Notification delivery rules"]},input:Kce,output:xce,pagination:"none",async:"sync"}),wJe={list:LO.contract,create:DO.contract,setEnabled:zO.contract,delete:NO.contract}});var _O,Gce,Bce,Jce,qce,Hce,Wce,jO,Mce,Yce,RO,Xce,Zce,UO,Fce,Qce,EO,Vce,ese,KO,IJe;var vJ=g(()=>{fe();je();_O=c.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"]),Gce=c.enum(["needs-onboarding","blocked","ready"]),Bce=c.enum(["incomplete","complete","skipped"]),Jce=c.object({invitationId:c.string(),organizationId:c.string(),organizationName:c.string(),organizationSlug:c.string(),organizationImageUrl:c.string().nullable(),inviterName:c.string().nullable()}),qce=c.object({gate:Gce,canonicalStep:_O.nullable(),organizationId:c.string().nullable(),projectId:c.string().nullable(),completionByStep:c.record(_O,Bce),githubSkipped:c.boolean(),githubAppSkipped:c.boolean(),slackSkipped:c.boolean(),sampleIssueId:c.string().nullable(),actorRole:c.enum(["admin","member"]).nullable(),requiredStep:c.union([_O,c.literal("select-organization")]).nullable(),isCompleted:c.boolean(),onboardingRecommendationsThreadId:c.string().nullable(),hasOrganizations:c.boolean(),hasPaidBillingSubscription:c.boolean(),billingStepEnabled:c.boolean(),pendingInvitations:c.array(Jce)}),Hce=c.object({}),Wce=c.object({onboarding:qce}),jO=$({operationId:"onboarding.getState",description:"Read onboarding progress for the authenticated user.",backend:"api",route:{method:"GET",path:"/onboarding/state",tags:["Onboarding"]},input:Hce,output:Wce,pagination:"none",async:"sync"}),Mce=c.object({integration:c.enum(["github","slack"]).describe("Integration onboarding step to skip.")}),Yce=c.object({skipped:c.literal(!0)}),RO=$({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:Mce,output:Yce,pagination:"none",async:"sync"}),Xce=c.object({}),Zce=c.object({skipped:c.literal(!0)}),UO=$({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:Xce,output:Zce,pagination:"none",async:"sync"}),Fce=c.object({}),Qce=c.object({skipped:c.literal(!0)}),EO=$({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:Fce,output:Qce,pagination:"none",async:"sync"}),Vce=c.object({projectId:c.string().uuid().describe("Project that completed onboarding.")}),ese=c.object({completed:c.boolean()}),KO=$({operationId:"onboarding.finish",description:"Mark onboarding complete when all prerequisites are satisfied.",backend:"api",route:{method:"POST",path:"/onboarding/finish",tags:["Onboarding"]},input:Vce,output:ese,pagination:"none",async:"sync"}),IJe={getState:jO.contract,skipIntegration:RO.contract,skipGithubAppInstallation:UO.contract,skipSampleIssue:EO.contract,finish:KO.contract}});var Gu,tse,nse,ose,ise,rse,ase,cse,sse,hse,lse,xO,GO,BO,JO,TJe;var fJ=g(()=>{fe();je();ju();Gu=c.object({id:c.string().min(1),name:c.string(),slug:c.string(),logo:c.string().nullable().optional()}),tse=Gu.extend({role:pr.optional()}),nse=c.object({}),ose=c.object({organizations:c.array(tse).describe("Organizations available to the current credential.")}),ise=c.object({organizationId:c.string().min(1).describe("Organization ID to fetch.")}),rse=c.object({organization:Gu}),ase=c.object({organizationId:c.string().min(1).describe("Organization ID to update. SDK and CLI callers can auto-fill this before dispatch."),name:c.string().trim().min(1).max(100).describe("New organization name.")}),cse=c.object({organization:Gu.describe("Updated organization.")}),sse=c.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"),hse=c.object({name:sse.describe("Organization display name.")}),lse=c.object({organization:Gu}),xO=$({operationId:"organizations.create",description:"Create an organization for the authenticated user.",backend:"api",route:{method:"POST",path:"/organizations",tags:["Organizations"],successStatus:201},input:hse,output:lse,pagination:"none",async:"sync"}),GO=$({operationId:"organizations.list",description:"List organizations available to the current credential.",backend:"api",route:{method:"GET",path:"/organizations",tags:["Organizations"]},input:nse,output:ose,pagination:"none",async:"sync"}),BO=$({operationId:"organizations.get",description:"Get one organization by ID.",backend:"api",route:{method:"GET",path:"/organizations/{organizationId}",tags:["Organizations"]},input:ise,output:rse,pagination:"none",async:"sync"}),JO=$({operationId:"organizations.update",description:"Update one organization.",backend:"api",route:{method:"PATCH",path:"/organizations/{organizationId}",tags:["Organizations"]},input:ase,output:cse,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}}}]}),TJe={list:GO.contract,get:BO.contract,create:xO.contract,update:JO.contract}});var wr,Ac,kJ,IJ,OJ,PJ,SJ,$J,TJ,Bu,Ju,qu,AJ,CJ,Hu,LJ,DJ,Wu,use;var qO=g(()=>{fe();je();wr=c.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"]),Ac=c.object({id:c.string().uuid(),organizationId:c.string().min(1),name:c.string(),region:wr}),kJ=c.object({organizationId:c.string().min(1).optional().describe("Organization to list projects for. Auto-filled from CLI and SDK context when omitted.")}),IJ=c.object({projects:c.array(Ac).describe("Projects visible within the selected organization.")}),OJ=c.object({projectId:c.string().uuid().describe("Project ID to fetch.")}),PJ=c.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"),SJ=c.object({organizationId:c.string().min(1).optional().describe("Organization to create the project under. Auto-filled from CLI and SDK context when omitted."),name:PJ.describe("Project name."),region:wr.optional().default("us-west-2").describe("AWS region where the new project should be created.")}),$J=c.object({project:Ac}),TJ=c.object({project:Ac}),Bu=$({operationId:"projects.list",description:"List projects in an organization.",backend:"api",route:{method:"GET",path:"/projects",tags:["Projects"]},input:kJ,output:IJ,pagination:"none",async:"sync"}),Ju=$({operationId:"projects.get",description:"Get one project by ID.",backend:"api",route:{method:"GET",path:"/projects/{projectId}",tags:["Projects"]},input:OJ,output:TJ,pagination:"none",async:"sync"}),qu=$({operationId:"projects.create",description:"Create one project in an organization.",backend:"api",route:{method:"POST",path:"/projects",successStatus:201,tags:["Projects"]},input:SJ,output:$J,pagination:"none",async:"sync"}),AJ=c.object({projectId:c.string().uuid().describe("Project ID to update."),name:PJ.optional().describe("New project name.")}),CJ=c.object({project:Ac}),Hu=$({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:AJ,output:CJ,pagination:"none",async:"sync"}),LJ=c.object({projectId:c.string().uuid().describe("Project ID to delete.")}),DJ=c.void(),Wu=$({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:LJ,output:DJ,pagination:"none",async:"sync"}),use={list:Bu.contract,get:Ju.contract,create:qu.contract,update:Hu.contract,delete:Wu.contract}});var zJ,gse,dse,yse,bse,pse,HO,_Je;var NJ=g(()=>{fe();je();zJ=c.enum(["open","merged","closed"]),gse=c.enum(["review_required","approved","changes_requested"]),dse=c.enum(["passing","failing","pending"]),yse=c.object({id:c.string().uuid(),projectId:c.string().uuid(),repositoryFullName:c.string(),pullRequestId:c.string().describe("Provider-native pull request identifier (GitHub PR number or Bitbucket PR id), serialized as a string."),githubPullRequestId:c.number().int().describe("Deprecated: use pullRequestId. Numeric form of the provider-native pull request identifier; kept for backward compatibility."),title:c.string().nullable(),url:c.string().nullable(),status:zJ.nullable(),reviewState:gse.nullable(),checksState:dse.nullable(),requestedByUserId:c.string().nullable(),authorLogin:c.string().nullable().describe("Forge login that authored the pull request (often the Sazabi app identity)."),githubAuthorLogin:c.string().nullable().describe("Deprecated: use authorLogin. Kept for backward compatibility."),threadId:c.string().uuid().nullable(),runId:c.string().uuid().nullable(),createdAt:c.string().datetime(),mergedAt:c.string().datetime().nullable(),closedAt:c.string().datetime().nullable()}),bse=c.object({projectId:c.string().uuid().optional().describe("Project to list pull requests for. Auto-filled from CLI and SDK context when omitted."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of pull requests to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),status:zJ.optional().describe("Filter by pull request status (open, merged, or closed)."),repositoryFullName:c.string().trim().optional().describe("Filter by repository full name, for example owner/repo. Case-insensitive."),requestedByUserId:c.string().trim().optional().describe("Filter by the Sazabi user who requested the pull request. Pass 'me' to filter to the authenticated user.")}),pse=c.object({pullRequests:c.array(yse),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),HO=$({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:bse,output:pse,pagination:"cursor",async:"sync"}),_Je={list:HO.contract}});var _J,jJ,RJ,UJ,EJ,Cc;var WO=g(()=>{fe();je();_J=c.enum(["data_source","mcp_connector","sandbox_cli","integration"]),jJ=c.enum(["connected","recommended"]),RJ=c.object({kind:_J.describe("What the recommendation targets: a data source, MCP connector, sandbox CLI, or integration."),targetId:c.string().describe("Exact catalog id for the kind (data source type, MCP provider id, sandbox CLI preset type, or integration provider id)."),status:jJ.describe("Resolved live against current connections: connected (already set up) or recommended (suggested, not yet connected)."),roiScore:c.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:c.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.")}),UJ=c.object({projectId:c.string().uuid().optional().describe("Project to list recommendations for. Auto-filled from CLI and SDK context when omitted.")}),EJ=c.object({recommendations:c.array(RJ).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).")}),Cc=$({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:UJ,output:EJ,pagination:"none",async:"sync"})});var KJ,mse,xJ,Mu,GJ,BJ,JJ,qJ,vr,HJ,WJ,MJ,Yu,wse;var MO=g(()=>{fe();je();KJ=c.object({type:c.string().describe("Preset type identifier."),label:c.string().describe("Human-readable display name."),executableNames:c.array(c.string()).describe("CLI binary names installed by this preset."),envVarKeys:c.array(c.string()).describe("Environment variables required for authentication."),setupSkill:c.string().nullable().describe("Markdown setup skill for AI agents. Null when no skill is available.")}),mse=c.object({}),xJ=c.object({types:c.array(KJ)}),Mu=$({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:mse,output:xJ,pagination:"none",async:"sync"}),GJ=c.enum(["github_app","personal_access_token","stored_credentials"]),BJ=c.object({presetType:c.string().describe("Preset type identifier."),credentialSource:GJ.describe("Authoritative credential source for the preset."),isSystemManaged:c.boolean().describe("Whether the connection follows an integration lifecycle."),fallbackConfigured:c.boolean().describe("Whether user-provided fallback credentials are stored for this preset."),envVarKeys:c.array(c.string()).describe("Stored environment variable names. Secret values are omitted.")}),JJ=c.object({projectId:c.string().uuid().optional().describe("Project to inspect. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted.")}),qJ=c.object({connections:c.array(BJ)}),vr=$({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:JJ,output:qJ,pagination:"none",async:"sync"}),HJ=c.object({key:c.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:c.string().max(10240).describe("Secret value. Encrypted at rest; never returned by any API response.")}),WJ=c.object({projectId:c.string().uuid().optional().describe("Project to configure. Required for organization-scoped keys; auto-filled from a project-scoped key when omitted."),presetType:c.string().min(1).describe("Preset type identifier (e.g. kubectl, aws, github)."),environmentVariables:c.array(HJ).max(100).describe("Full set of env vars for this preset. Replaces any previously stored values for the preset.")}),MJ=c.object({projectId:c.string().uuid().describe("Project the preset was written to."),presetType:c.string().describe("Preset type that was upserted."),envVarKeys:c.array(c.string()).describe("Env var key names now stored for this preset. Values are never returned.")}),Yu=$({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:WJ,output:MJ,pagination:"none",async:"sync"}),wse={listConnections:vr.contract,listTypes:Mu.contract,upsertPreset:Yu.contract}});var Xu,YJ=1048576,YO,XJ,XO,vse,fse,kse,Ise,Ose,Pse,Sse,$se,Tse,Ase,ZO,FO,QO,VO,eP,qJe;var ZJ=g(()=>{fe();je();Xu=c.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."),YO=c.string().min(1).refine((e)=>new TextEncoder().encode(e).length<=YJ,{message:`Script content must be at most ${YJ} bytes (1 MiB).`}).describe("Bash script body materialized as /home/sazabi/scripts/<name>.sh in the sandbox."),XJ=c.object({id:c.string().uuid(),projectId:c.string().uuid(),name:c.string(),description:c.string().nullable(),contentHash:c.string().describe("sha256 hex digest of the script content."),createdAt:c.string().datetime(),updatedAt:c.string().datetime()}),XO=XJ.extend({content:YO}),vse=c.object({projectId:c.string().uuid().optional().describe("Project to list scripts for. Auto-filled from CLI and SDK context when omitted."),search:c.string().optional().describe("Case-insensitive partial match on script name."),cursor:c.string().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of scripts to return per page.")}),fse=c.object({scripts:c.array(XJ),nextCursor:c.string().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),kse=c.object({name:Xu.describe("Script name to fetch."),projectId:c.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),Ise=c.object({script:XO}),Ose=c.object({projectId:c.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),name:Xu.describe("Script name. Must be unique within the project among non-deleted scripts."),content:YO,description:c.string().max(500).nullable().optional().describe("Optional human-readable description.")}),Pse=c.object({script:XO}),Sse=c.object({name:Xu.describe("Script to update."),projectId:c.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted."),content:YO.optional().describe("New script body. Omit to leave content unchanged."),description:c.string().max(500).nullable().optional().describe("New description, or null to clear it. Omit to leave unchanged.")}),$se=c.object({script:XO}),Tse=c.object({name:Xu.describe("Script to delete."),projectId:c.string().uuid().optional().describe("Project that owns the script. Auto-filled from CLI and SDK context when omitted.")}),Ase=c.object({deleted:c.boolean()}),ZO=$({operationId:"scripts.list",description:"List durable bash scripts stored for a project.",backend:"api",route:{method:"GET",path:"/scripts",tags:["Scripts"]},input:vse,output:fse,pagination:"cursor",async:"sync"}),FO=$({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:kse,output:Ise,pagination:"none",async:"sync"}),QO=$({operationId:"scripts.create",description:"Create a durable bash script for a project.",backend:"api",route:{method:"POST",path:"/scripts",successStatus:201,tags:["Scripts"]},input:Ose,output:Pse,pagination:"none",async:"sync"}),VO=$({operationId:"scripts.update",description:"Update a project script's body and/or description.",backend:"api",route:{method:"PATCH",path:"/scripts/{name}",tags:["Scripts"]},input:Sse,output:$se,pagination:"none",async:"sync"}),eP=$({operationId:"scripts.delete",description:"Soft-delete a project script by name.",backend:"api",route:{method:"DELETE",path:"/scripts/{name}",successStatus:204,tags:["Scripts"]},input:Tse,output:Ase,pagination:"none",async:"sync"}),qJe={list:ZO.contract,get:FO.contract,create:QO.contract,update:VO.contract,delete:eP.contract}});var tP,FJ,QJ,VJ,eq,fr,kr,Cse;var nP=g(()=>{fe();je();tP=c.object({projectId:c.string().uuid().optional().describe("Project to search within. Auto-filled from CLI and SDK context when omitted."),query:c.string().trim().min(1,"Query must be at least 1 character").max(500,"Query must be at most 500 characters"),limit:c.coerce.number().min(1).max(100).default(20).describe("Maximum number of search results to return."),page:c.coerce.number().min(1).default(1).describe("One-based page number.")}),FJ=tP.extend({status:c.enum(["regular","archived"]).optional().describe("Optional thread status filter.")}),QJ=tP.extend({threadId:c.string().uuid().optional().describe("Optional thread restriction for message search."),role:c.enum(["user","assistant"]).optional().describe("Optional message role filter.")}),VJ=c.object({threads:c.array(c.object({id:c.string().uuid(),projectId:c.string().uuid().optional(),title:c.string(),status:c.enum(["regular","archived"]),labels:c.array(c.string()),createdAt:c.string().datetime(),updatedAt:c.string().datetime(),highlights:c.array(c.string()),score:c.number().optional()})),pagination:c.object({page:c.number(),limit:c.number(),totalResults:c.number(),totalPages:c.number()}).describe("Page-based pagination metadata for the current search result.")}),eq=c.object({messages:c.array(c.object({id:c.string().uuid(),threadId:c.string().uuid(),threadTitle:c.string(),role:c.enum(["user","assistant"]),content:c.string(),createdAt:c.string().datetime(),updatedAt:c.string().datetime(),highlights:c.array(c.string()),score:c.number().optional()})),pagination:c.object({page:c.number(),limit:c.number(),totalResults:c.number(),totalPages:c.number()}).describe("Page-based pagination metadata for the current search result.")}),fr=$({operationId:"search.threads",description:"Search threads within one project.",backend:"api",route:{method:"GET",path:"/search/threads",tags:["Search"]},input:FJ,output:VJ,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}}}]}),kr=$({operationId:"search.messages",description:"Search messages within one project.",backend:"api",route:{method:"GET",path:"/search/messages",tags:["Search"]},input:QJ,output:eq,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}}}]}),Cse={threads:fr.contract,messages:kr.contract}});var Lc,tq,nq,oq,iq,rq,aq,cq,sq,Zu,Fu,Ir,Qu,hq,oP,lq,uq,gq,dq,yq,Vu,eg,Lse;var iP=g(()=>{fe();je();Lc=c.object({id:c.string().uuid(),projectId:c.string().uuid(),name:c.string(),description:c.string().nullable(),currentStatus:c.enum(["operational","degraded","outage"]).describe("Current health status of this component."),firstSeenAt:c.string().datetime(),lastSeenAt:c.string().datetime(),deletedAt:c.string().datetime().nullable().describe("Timestamp when this component was deregistered, if any.")}),tq=c.object({projectId:c.string().uuid().optional().describe("Project to list status components for. Auto-filled from CLI and SDK context when omitted."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of components to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page."),includeDeleted:c.union([c.boolean(),c.stringbool()]).default(!1).describe("When true, include removed components in the response.")}),nq=c.object({statusComponents:c.array(Lc),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),oq=c.object({componentId:c.string().uuid().describe("Status component ID to retrieve.")}),iq=c.object({statusComponent:Lc}),rq=c.object({projectId:c.string().uuid().optional().describe("Project to register the status component in. Auto-filled from CLI and SDK context when omitted."),name:c.string().trim().min(1,"Name is required").describe("Evidence-backed component name to register."),description:c.string().trim().min(1,"Description cannot be empty").optional().describe("Optional component description.")}),aq=c.object({statusComponent:Lc}),cq=c.object({componentId:c.string().uuid().describe("Status component ID to deregister."),reason:c.string().trim().min(1,"Reason cannot be empty").optional().describe("Optional reason for audit logging.")}),sq=c.object({statusComponent:Lc}),Zu=$({operationId:"statusComponents.list",description:"List status page components in a project.",backend:"api",route:{method:"GET",path:"/status-components",tags:["Status Components"]},input:tq,output:nq,pagination:"cursor",async:"sync"}),Fu=$({operationId:"statusComponents.get",description:"Get a single status component by ID.",backend:"api",route:{method:"GET",path:"/status-components/{componentId}",tags:["Status Components"]},input:oq,output:iq,pagination:"none",async:"sync"}),Ir=$({operationId:"statusComponents.register",description:"Register a status page component in a project, or refresh an existing active component with the same name.",backend:"api",route:{method:"POST",path:"/status-components",tags:["Status Components"]},input:rq,output:aq,pagination:"none",async:"sync"}),Qu=$({operationId:"statusComponents.deregister",description:"Deregister a status page component. Deregistered components no longer appear on the status page.",backend:"api",route:{method:"POST",path:"/status-components/{componentId}/deregister",tags:["Status Components"]},input:cq,output:sq,pagination:"none",async:"sync"}),hq=c.enum(["degraded","outage"]).describe("Severity of a status-page incident. 'outage' marks the component down; 'degraded' marks partial impact."),oP=c.object({id:c.string().uuid(),componentId:c.string().uuid(),projectId:c.string().uuid(),severity:hq,summary:c.string().describe("Human-readable summary of the status-page issue."),startedAt:c.string().datetime().describe("When the incident began affecting the component."),resolvedAt:c.string().datetime().nullable().describe("When the incident was resolved, or null while ongoing.")}),lq=c.object({projectId:c.string().uuid().optional().describe("Project to list status-page issues for. Auto-filled from CLI and SDK context when omitted."),componentId:c.string().uuid().optional().describe("Restrict results to a single component."),activeOnly:c.union([c.boolean(),c.stringbool()]).default(!1).describe("When true, return only unresolved (ongoing) issues."),limit:c.coerce.number().int().min(1).max(100).default(50).describe("Maximum number of issues to return per page."),cursor:c.string().uuid().optional().describe("Cursor from a previous response's nextCursor to fetch the next page.")}),uq=c.object({incidents:c.array(oP),nextCursor:c.string().uuid().nullable().describe("Pass as 'cursor' to fetch the next page. Null when there are no more results.")}),gq=c.object({timestamp:c.string().datetime(),status:c.enum(["operational","degraded","outage","unknown"]).describe("Worst component status observed during this timeline bucket.")}),dq=c.object({componentId:c.string().uuid().describe("Status component to build the timeline for."),windowStart:c.string().datetime({offset:!0}).optional().describe("Start of the timeline window. Defaults to 7 days before windowEnd."),windowEnd:c.string().datetime({offset:!0}).optional().describe("End of the timeline window. Defaults to now.")}),yq=c.object({componentId:c.string().uuid(),windowStart:c.string().datetime(),windowEnd:c.string().datetime(),timeline:c.array(gq),incidents:c.array(oP)}),Vu=$({operationId:"statusComponents.incidents.list",description:"List status-page issues in a project.",backend:"api",route:{method:"GET",path:"/status-incidents",tags:["Status Components"]},input:lq,output:uq,pagination:"cursor",async:"sync"}),eg=$({operationId:"statusComponents.timeline",description:"Get the dense status timeline and incidents for a component over a time window.",backend:"api",route:{method:"GET",path:"/status-components/{componentId}/timeline",tags:["Status Components"]},input:dq,output:yq,pagination:"none",async:"sync"}),Lse={list:Zu.contract,get:Fu.contract,register:Ir.contract,deregister:Qu.contract,incidents:{list:Vu.contract},timeline:eg.contract}});var bq;var pq=g(()=>{bq=["onboarding","setup"]});var mq,wq,vq,fq,Dc;var rP=g(()=>{pq();fe();je();mq=c.enum(bq),wq=c.object({id:c.string().describe("Unique task identifier (e.g. install_github_app)."),label:c.string().describe("Short human-readable task name."),description:c.string().describe("Explanation of what needs to be completed to satisfy this task."),instructions:c.string().describe("Step-by-step instructions for completing this task."),completed:c.boolean().describe("Whether the task has been completed."),completedAt:c.string().datetime().nullable().describe("ISO 8601 timestamp of when the task was completed, or null."),category:mq.describe("Task category: onboarding (core setup steps) or setup (additional configuration).")}),vq=c.object({projectId:c.string().uuid().optional().describe("Project to list tasks for. Auto-filled from CLI and SDK context when omitted.")}),fq=c.object({tasks:c.array(wq).describe("All onboarding and setup tasks with their current completion status.")}),Dc=$({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:vq,output:fq,pagination:"none",async:"sync"})});var aP;var kq=g(()=>{ZA();QA();jf();R_();xf();Jf();Hf();tO();ju();RB();WB();pJ();wJ();vJ();fJ();qO();NJ();WO();Ru();MO();ZJ();nP();iP();rP();IO();aP={me:nO.contract,automations:{list:hv.contract,get:lv.contract,create:uv.contract,update:gv.contract,enable:dv.contract,disable:yv.contract,runs:{list:bv.contract,get:pv.contract,logs:mv.contract}},logs:{query:qi.contract,schema:Hi.contract,volume:Wi.contract,patterns:Mi.contract,nativeQuery:Yi.contract,searchNatural:bl.contract},dataSources:{listTypes:Gh.contract,listConnections:Ri.contract,getConnection:Bh.contract,listInstances:Jh.contract,getInstance:qh.contract,createConnection:Ui.contract,disconnectConnection:Zh.contract,listStreams:Hh.contract,listInstanceStreams:Wh.contract,createStream:Mh.contract,getStream:Yh.contract,deleteStream:Xh.contract},integrations:{listProviders:N_.contract,listConnections:__.contract,getConnection:j_.contract},notificationChannels:{getProject:AO.contract},notificationDeliveryRules:{list:LO.contract,create:DO.contract,setEnabled:zO.contract,delete:NO.contract},mcpConnectors:{listProviders:_u.contract,list:dr.contract,get:yr.contract,details:br.contract},sandboxPresets:{listConnections:vr.contract,listTypes:Mu.contract,upsertPreset:Yu.contract},scripts:{list:ZO.contract,get:FO.contract,create:QO.contract,update:VO.contract,delete:eP.contract},onboarding:{getState:jO.contract,skipIntegration:RO.contract,skipGithubAppInstallation:UO.contract,skipSampleIssue:EO.contract,finish:KO.contract},organizations:{list:GO.contract,get:BO.contract,create:xO.contract,update:JO.contract},members:{list:oO.contract,updateRole:iO.contract,remove:rO.contract},publicKeys:{list:Ki.contract,get:xi.contract,ensureLogForwarding:Gi.contract,update:Bi.contract,deactivate:Ji.contract},secretKeys:{list:ll.contract,get:ul.contract,create:gl.contract,update:dl.contract,delete:yl.contract},projects:{list:Bu.contract,get:Ju.contract,create:qu.contract,update:Hu.contract,delete:Wu.contract},search:{threads:fr.contract,messages:kr.contract},messages:{list:qB.contract,append:HB.contract},threads:{list:uO.contract,get:gO.contract,getStatus:dO.contract,stop:yO.contract,create:bO.contract,update:pO.contract,fork:mO.contract,setVisibility:wO.contract,createShareLink:vO.contract,listShareLinks:fO.contract,revokeShareLink:kO.contract},runs:{list:aO.contract,listForThread:cO.contract,get:sO.contract,cancel:hO.contract},pullRequests:{list:HO.contract},issues:{count:tl.contract,create:Ei.contract,list:Vh.contract,search:el.contract,get:nl.contract,resolve:ol.contract,ignore:il.contract,reopen:Kf.contract,mute:rl.contract,unmute:al.contract},billing:{getSummary:wv.contract,getUsage:vv.contract,listTransactions:fv.contract},tasks:{list:Dc.contract},recommendations:{list:Cc.contract},statusComponents:{list:Zu.contract,get:Fu.contract,register:Ir.contract,deregister:Qu.contract,incidents:{list:Vu.contract},timeline:eg.contract}}});var zc=g(()=>{qA();kq();jf();xf();Jf();Hf();tO();qO();WO();MO();nP();iP();rP()});var Dse="https://api.sazabi.com",zse="x-sazabi-client-source",Oq=(e)=>{return{streamRun:async(t)=>{return Iq({options:e,path:`/runs/${encodeURIComponent(t.runId)}/stream`,cursor:t.cursor,signal:t.signal})},streamThread:async(t)=>{return Iq({options:e,path:`/threads/${encodeURIComponent(t.threadId)}/stream`,cursor:t.cursor,signal:t.signal})}}},Iq=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(),i=Nse(e.options.apiBaseUrl,e.path,e.cursor);return jse({url:i,token:n,clientSource:e.options.clientSource,initialCursor:e.cursor,signal:e.signal,fetch:t})},Nse=(e,t,n)=>{let i=_se(e??Dse),o=new URL(`${i}${t}`);if(n)o.searchParams.set(iv,n);return o.toString()},_se=(e)=>{let t=e.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},jse=async(e)=>{let t=[],n=[],i=!1,o=!1,r,a=e.initialCursor,s=new AbortController,h=(v)=>{if(i)return;i=!0,r=v;while(n.length>0)n.shift()?.({value:void 0,done:!0})},l=(v)=>{let O=n.shift();if(O){O({value:v,done:!1});return}t.push(v)},u=(v)=>{if(v.event===av){let A=xse(v.data);if(A!==void 0)a=A;return}if(v.data===cv){o=!0,s.abort(),h();return}let O=Gse(v.data);if(O)l(O)},d=()=>{o=!0,s.abort(),h()};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 a},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(i){if(r)throw r;return{value:void 0,done:!0}}return new Promise((v)=>{n.push(v)}).then((v)=>{if(v.done&&r)throw r;return v})},return:async()=>{return o=!0,s.abort(),h(),{value:void 0,done:!0}},throw:async(v)=>{throw o=!0,s.abort(),h(v instanceof Error?v:Error(String(v))),v},close:async()=>{o=!0,s.abort(),h()}};if(o)return h(),y;let b=await e.fetch(e.url,{method:rv,headers:Rse(e.token,e.clientSource),signal:s.signal});if(await Use(b))h();else Ese(b,u).then(()=>h()).catch((v)=>{if(Jse(v)||o||e.signal?.aborted){h();return}h(qse(v))});return y},Rse=(e,t)=>{return{accept:"text/event-stream",authorization:`Bearer ${e}`,...t?{[zse]:t}:{}}},Use=async(e)=>{if(e.status===204)return!0;if(e.ok&&e.body)return!1;let t=await Bse(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}`)},Ese=async(e,t)=>{let n=e.body?.getReader();if(!n)throw Error("Agent stream response did not include a body.");let i=new TextDecoder,o="",r=Kse(t);try{while(!0){let a=await n.read();if(a.done)break;o+=i.decode(a.value,{stream:!0});let s=o.split(/\r\n|\r|\n/);o=s.pop()??"";for(let h of s)r.line(h)}if(o+=i.decode(),o)for(let a of o.split(/\r\n|\r|\n/))r.line(a);r.flush()}finally{n.releaseLock()}},Kse=(e)=>{let t="message",n=[],i=()=>{t="message",n=[]},o=()=>{if(n.length===0){i();return}e({event:t,data:n.join(`
|
|
8559
8559
|
`)}),i()};return{line:(r)=>{if(r===""){o();return}if(r.startsWith(":"))return;let a=r.indexOf(":"),s=a===-1?r:r.slice(0,a),h=a===-1?"":r.slice(a+1),l=h.startsWith(" ")?h.slice(1):h;if(s==="event"){t=l||"message";return}if(s==="data")n.push(l)},flush:o}},xse=(e)=>{try{let t=ov.safeParse(JSON.parse(e));return t.success?t.data.streamNextOffset:void 0}catch{return}},Gse=(e)=>{try{let t=nv.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}},Bse=async(e)=>{try{return await e.text()}catch{return""}},Jse=(e)=>{return e instanceof Error&&e.name==="AbortError"},qse=(e)=>{return e instanceof Error?e:Error(String(e))};var Pq=g(()=>{zc()});var cP,sP,hP,Sq;var $q=g(()=>{fe();cP=c.object({severities:c.array(c.string()).optional().describe("Limit results to the listed severities."),services:c.array(c.string()).optional().describe("Limit results to the listed service names."),environments:c.array(c.string()).optional().describe("Limit results to the listed deployment environments."),searchTerm:c.string().optional().describe("Case-insensitive substring match against the log body."),traceId:c.string().optional().describe("Limit results to one trace ID.")}),sP=c.object({service:c.string(),namespace:c.string(),environment:c.string(),host:c.string(),container:c.string(),pod:c.string()}),hP=c.object({id:c.string(),timestamp:c.string().datetime(),severity:c.string(),body:c.string(),service:c.string(),traceId:c.string(),spanId:c.string(),attributes:c.record(c.string(),c.string()),resource:sP}),Sq=c.object({type:c.literal("logs"),timestamp:c.string().datetime(),data:c.array(hP)})});var Hse="https://{region}.intake.sazabi.com",Wse="https://{region}.tail.sazabi.com",Cq=500,Mse=5000,Lq="sazabi.public_key",Yse="x-sazabi-internal-log-forwarding-secret",Xse="x-sazabi-internal-log-forwarding-source",Zse=(e)=>{return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e},Dq=(e)=>{let t=Zse(e);return t==="localhost"||t==="127.0.0.1"||t==="::1"},Fse,Qse,Vse,zq=(e)=>{let t=new Map;return{tail:async(n)=>{let i=await uhe(e.credentialProvider,n.projectId,"logs.tail"),o=await ghe(e,t,i,n.region,"logs.tail"),r=nhe({projectId:i,region:o,filters:n.filters,apiBaseUrl:e.apiBaseUrl,tailBaseUrl:e.tailBaseUrl}),a=await e.credentialProvider.getToken(),s=e.fetch??globalThis.fetch;if(!s)throw Error("Fetch transport is not available in this runtime.");return yhe({token:a,url:r,signal:n.signal,fetch:s})},forward:async(n)=>{let i=await dhe(e,t,n.projectId??await e.credentialProvider.getProjectId?.(),n.region,"logs.forward"),o=ahe(i,e.intakeBaseUrl),r=e.fetch??globalThis.fetch,a=she(n.logs,n.publicKey),s=Ihe(a);return await khe(r,o,a,lhe(n.sazabiInternalForwarding)),{forwardedCount:s,failedCount:0}}}},ehe="3010",the,nhe=(e)=>{let t=(e.tailBaseUrl??ohe({region:e.region,apiBaseUrl:e.apiBaseUrl})).replace("{region}",e.region),n=ihe(t);n.searchParams.set("projectId",e.projectId);let i=rhe(e.filters);if(i)n.searchParams.set("filters",i);return n.toString()},ohe=(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 Wse.replace("{region}",e.region)},ihe=(e)=>{let t=(()=>{try{return new URL(e)}catch{return null}})();if(!t)throw Error(`Invalid tail base URL: ${e}`);if(Dq(t.hostname)){if(t.protocol="http:",!t.port||the.has(t.port))t.port=ehe;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},rhe=(e)=>{if(!e)return;let t=Object.entries(e).filter(([,n])=>n!==void 0&&(!Array.isArray(n)||n.length>0)&&n!=="");if(t.length===0)return;return JSON.stringify(Object.fromEntries(t))},ahe=(e,t)=>{let n=(t??Hse).replace("{region}",e),i=n.endsWith("/")?n.slice(0,-1):n,o=che(i);if(o)return o;let r=i.match(/^https:\/\/([a-z0-9-]+)\.intake\.([a-z0-9.]+)$/);return`${r?`https://otlp.${r[1]}.intake.${r[2]}`:i}/v1/logs`},che=(e)=>{let t=(()=>{try{return new URL(e)}catch{return null}})();if(!t)return;if(!Dq(t.hostname))return;return t.pathname="/adapters/otlp",t.toString()},she=(e,t)=>{let n=e.resourceLogs;if(!n||n.length===0)return{...e,resourceLogs:[{resource:{attributes:[Nq(t)]},scopeLogs:[]}]};return{...e,resourceLogs:n.map((i)=>({...i,resource:{...i.resource,attributes:hhe(i.resource?.attributes,t)}}))}},hhe=(e,t)=>{return[...(e??[]).filter((i)=>i?.key!==Lq),Nq(t)]},Nq=(e)=>({key:Lq,value:{stringValue:e}}),lhe=(e)=>{if(!e?.secret)return{};return{[Yse]:e.secret,...e.source?{[Xse]:e.source}:{}}},uhe=async(e,t,n)=>{let i=t??await e.getProjectId?.();if(i)return i;throw Rq(n,"Project ID is required",["projectId"])},ghe=async(e,t,n,i,o)=>{return i??await _q(e,t,n)},dhe=async(e,t,n,i,o)=>{if(i)return i;if(!n)throw Rq(o,"Project ID is required",["projectId"]);return _q(e,t,n)},_q=async(e,t,n)=>{let i=t.get(n);if(i)return i;let o=e.raw.projects.get({projectId:n}).then((r)=>r.project.region);t.set(n,o);try{return await o}catch(r){throw t.delete(n),r}},yhe=async(e)=>{let t=[],n=[],i=!1,o=!1,r,a=0,s,h,l=(O)=>{if(i)return;i=!0,r=O;while(n.length>0){let A=n.shift();if(A)A({value:void 0,done:!0})}},u=(O)=>{let A=n.shift();if(A){A({value:O,done:!1});return}t.push(O)},d=()=>{h?.abort()},y=(O)=>{if(O.event!=="log"){if(O.id)s=O.id;return}let A=vhe(O.data);for(let N of A)u(N);if(O.id)s=O.id},b=async(O)=>{let A=!1;while(!i&&!o){let N=new AbortController,U=()=>N.abort();h=N;let Y=!1;e.signal?.addEventListener("abort",U,{once:!0});try{let G=await e.fetch(bhe(e.url,s),{method:"GET",headers:{accept:"text/event-stream",authorization:`Bearer ${e.token}`},signal:N.signal});await phe(G),a=0,A=!0,O(),await mhe(G,y),Y=!0}catch(G){if(Aq(G)||e.signal?.aborted)break;let me=Tq(G);if(!A||fhe(me))throw me;Y=!0}finally{if(e.signal?.removeEventListener("abort",U),h===N)h=void 0}if(i||o||e.signal?.aborted)break;if(!Y)continue;a+=1,await jq(Math.min(Cq*2**(a-1),Mse),e.signal)}};if(e.signal?.addEventListener("abort",()=>{o=!0,d(),l()},{once:!0}),e.signal?.aborted)o=!0,d(),l();await new Promise((O,A)=>{let N=!1;b(()=>{if(!N)N=!0,O()}).catch((Y)=>{let G=Tq(Y);if(!N){N=!0,A(G);return}if(!Aq(Y))l(G)})});let v={[Symbol.asyncIterator](){return v},next:async()=>{if(t.length>0)return{value:t.shift(),done:!1};if(i){if(r)throw r;return{value:void 0,done:!0}}return new Promise((O)=>{n.push(O)}).then((O)=>{if(O.done&&r)throw r;return O})},return:async()=>{return o=!0,d(),l(),{value:void 0,done:!0}},throw:async(O)=>{throw o=!0,d(),l(O instanceof Error?O:Error(String(O))),O}};return v},bhe=(e,t)=>{if(!t)return e;let n=new URL(e);return n.searchParams.set("cursor",t),n.toString()},phe=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}`)},mhe=async(e,t)=>{let n=e.body?.getReader();if(!n)throw Error("Tail stream response did not include a body.");let i=new TextDecoder,o="",r=whe(t);try{while(!0){let a=await n.read();if(a.done)break;o+=i.decode(a.value,{stream:!0});let s=o.split(/\r\n|\r|\n/);o=s.pop()??"";for(let h of s)r.line(h)}if(o+=i.decode(),o){let a=o.split(/\r\n|\r|\n/);for(let s of a)r.line(s)}r.flush()}finally{n.releaseLock()}},whe=(e)=>{let t="message",n,i=[],o=()=>{t="message",n=void 0,i=[]},r=()=>{if(i.length===0&&!n){o();return}e({event:t,data:i.join(`
|
|
8560
8560
|
`),...n?{id:n}:{}}),o()};return{line:(a)=>{if(a===""){r();return}if(a.startsWith(":"))return;let s=a.indexOf(":"),h=s===-1?a:a.slice(0,s),l=s===-1?"":a.slice(s+1),u=l.startsWith(" ")?l.slice(1):l;if(h==="event"){t=u||"message";return}if(h==="data"){i.push(u);return}if(h==="id"&&!u.includes("\x00"))n=u},flush:r}},vhe=(e)=>{try{let t=Sq.safeParse(JSON.parse(e));if(!t.success)return[];return t.data.data}catch{return[]}},Tq=(e)=>{return e instanceof Error?e:Error(String(e))},Aq=(e)=>{return e instanceof Error&&e.name==="AbortError"},fhe=(e)=>{return e.message.startsWith("Authentication failed")||e.message.startsWith("Forbidden (")||e.message.startsWith("Wrong region (")||e.message.startsWith("Client error (")},khe=async(e,t,n,i={},o=3,r=1e4)=>{let a;for(let s=0;s<=o;s+=1){let h=new AbortController,l=globalThis.setTimeout(()=>h.abort(),r);try{let u=await e(t,{method:"POST",headers:{"content-type":"application/json",...i},body:JSON.stringify(n),signal:h.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}`);a=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);a=u instanceof Error&&u.name==="AbortError"?Error("Request timed out"):u instanceof Error?u:Error(String(u))}finally{globalThis.clearTimeout(l)}if(s<o)await jq(Cq*2**s)}throw Error(`Failed after ${o+1} attempts: ${a?.message??"Unknown error"}`)},Ihe=(e)=>{return e.resourceLogs?.reduce((t,n)=>t+(n.scopeLogs?.reduce((i,o)=>i+(o.logRecords?.length??0),0)??0),0)??0},jq=async(e,t)=>{if(t?.aborted)return;await new Promise((n)=>{let i=globalThis.setTimeout(n,e);t?.addEventListener("abort",()=>{globalThis.clearTimeout(i),n()},{once:!0})})},Rq=(e,t,n)=>{return new Ze("BAD_REQUEST",{message:t,data:{operationId:e,missingContext:n}})};var lP=g(()=>{oi();$q();fe();Fse=c.object({projectId:c.string().uuid().optional().describe("Project to tail logs for. Auto-filled from CLI and SDK context when omitted."),filters:cP.optional().describe("Optional filters applied by the tail SSE service.")}),Qse=c.object({publicKey:c.string().min(1).describe("Public key for intake auth. Create or list one via the public key endpoints."),logs:c.custom((e)=>typeof e==="object"&&e!==null).describe("OTLP logs export request payload to send to the intake service.")}),Vse=c.object({forwardedCount:c.number().int().nonnegative().describe("Number of log records accepted by the intake request."),failedCount:c.number().int().nonnegative().describe("Number of log records rejected by the intake request.")}),the=new Set(["15006","3010"])});var uP="https://api.sazabi.com",Eq="https://api.platform.sazabi.com",Kq="sazabi-cli",Ohe="urn:ietf:params:oauth:grant-type:device_code",xq=(e)=>{let t=Wg(new rd(aP,{url:Phe(e.apiBaseUrl??uP),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,r)=>{let a=Dhe(o);if(!a)return null;return new Ze(a.code,{message:a.message,status:r.status,data:{operationId:a.operationId,missingContext:a.missingContext}})}})),n=zq({raw:t,credentialProvider:e.credentialProvider,fetch:e.fetch,apiBaseUrl:e.apiBaseUrl??uP,intakeBaseUrl:e.intakeBaseUrl,tailBaseUrl:e.tailBaseUrl}),i=Oq({credentialProvider:e.credentialProvider,fetch:e.fetch,apiBaseUrl:e.apiBaseUrl??uP,clientSource:e.clientSource});return{raw:t,me:async()=>t.me({}),automations:{list:async(o={})=>t.automations.list(await le(e.credentialProvider,o,"automations.list")),get:async(o)=>t.automations.get(await le(e.credentialProvider,o,"automations.get")),create:async(o)=>t.automations.create(await le(e.credentialProvider,o,"automations.create")),update:async(o)=>t.automations.update(await le(e.credentialProvider,o,"automations.update")),enable:async(o)=>t.automations.enable(await le(e.credentialProvider,o,"automations.enable")),disable:async(o)=>t.automations.disable(await le(e.credentialProvider,o,"automations.disable")),runs:{list:async(o)=>t.automations.runs.list(await le(e.credentialProvider,o,"automations.runs.list")),get:async(o)=>t.automations.runs.get(await le(e.credentialProvider,o,"automations.runs.get")),logs:async(o)=>t.automations.runs.logs(await le(e.credentialProvider,o,"automations.runs.logs"))}},logs:{...n,query:async(o={})=>t.logs.query(await le(e.credentialProvider,o,qi.operationId)),schema:async(o={})=>t.logs.schema(await le(e.credentialProvider,o,Hi.operationId)),volume:async(o)=>t.logs.volume(await le(e.credentialProvider,o,Wi.operationId)),patterns:async(o={})=>t.logs.patterns(await le(e.credentialProvider,o,Mi.operationId)),nativeQuery:async(o)=>t.logs.nativeQuery(await le(e.credentialProvider,o,Yi.operationId))},organizations:{list:async()=>t.organizations.list({}),get:async(o)=>t.organizations.get(o),update:async(o)=>t.organizations.update(await $he(e.credentialProvider,o))},members:{list:async(o={})=>t.members.list(await ln(e.credentialProvider,o)),updateRole:async(o)=>t.members.updateRole(await ln(e.credentialProvider,o)),remove:async(o)=>{let r=await ln(e.credentialProvider,o);return t.members.remove({params:{userId:r.userId},query:{organizationId:r.organizationId}})}},publicKeys:{list:async(o={})=>t.publicKeys.list(await le(e.credentialProvider,o,Ki.operationId)),get:async(o)=>t.publicKeys.get(await le(e.credentialProvider,o,xi.operationId)),ensureLogForwarding:async(o={})=>t.publicKeys.ensureLogForwarding(await le(e.credentialProvider,o,Gi.operationId)),update:async(o)=>t.publicKeys.update(await le(e.credentialProvider,o,Bi.operationId)),deactivate:async(o)=>{let r=await le(e.credentialProvider,o,Ji.operationId);return t.publicKeys.deactivate({params:{keyId:r.keyId},query:{projectId:r.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 le(e.credentialProvider,o,fr.operationId)),messages:async(o)=>t.search.messages(await le(e.credentialProvider,o,kr.operationId))},projects:{list:async(o={})=>t.projects.list(await She(e.credentialProvider,o)),get:async(o)=>t.projects.get(o),create:async(o)=>t.projects.create(await ln(e.credentialProvider,o))},messages:{list:async(o)=>t.messages.list(o),append:async(o)=>Uq(t,await t.messages.append(Lhe(o)))},threads:{list:async(o={})=>t.threads.list(await The(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)=>Uq(t,await t.threads.create(await Che(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)=>i.streamThread(o)},runs:{list:async(o={})=>t.runs.list(await Ahe(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)=>i.streamRun(o)},dataSources:{listTypes:async()=>t.dataSources.listTypes({}),connections:{list:async(o={})=>t.dataSources.listConnections(await le(e.credentialProvider,o,Ri.operationId)),get:async(o)=>t.dataSources.getConnection(o),create:async(o)=>t.dataSources.createConnection(await le(e.credentialProvider,o,Ui.operationId)),disconnect:async(o)=>t.dataSources.disconnectConnection(o)},streams:{list:async(o)=>t.dataSources.listStreams(o),get:async(o)=>t.dataSources.getStream(o),create:async(o)=>t.dataSources.createStream(o),delete:async(o)=>t.dataSources.deleteStream(o)}},integrations:{listProviders:async(o={})=>t.integrations.listProviders(await ln(e.credentialProvider,o)),listConnections:async(o={})=>t.integrations.listConnections(await ln(e.credentialProvider,o)),getConnection:async(o)=>t.integrations.getConnection(await ln(e.credentialProvider,o))},mcpConnectors:{list:async(o={})=>t.mcpConnectors.list(await le(e.credentialProvider,o,dr.operationId)),get:async(o)=>t.mcpConnectors.get(await le(e.credentialProvider,o,yr.operationId)),details:async(o)=>t.mcpConnectors.details(await le(e.credentialProvider,o,br.operationId)),listProviders:async()=>t.mcpConnectors.listProviders({})},sandboxPresets:{listConnections:async(o={})=>t.sandboxPresets.listConnections(await le(e.credentialProvider,o,vr.operationId)),listTypes:async()=>t.sandboxPresets.listTypes({})},scripts:{list:async(o={})=>t.scripts.list(await le(e.credentialProvider,o,"scripts.list")),get:async(o)=>t.scripts.get(await le(e.credentialProvider,o,"scripts.get")),create:async(o)=>t.scripts.create(await le(e.credentialProvider,o,"scripts.create")),update:async(o)=>t.scripts.update(await le(e.credentialProvider,o,"scripts.update")),delete:async(o)=>t.scripts.delete(await le(e.credentialProvider,o,"scripts.delete"))},issues:{count:async(o={})=>t.issues.count(await le(e.credentialProvider,o,"issues.count")),create:async(o)=>t.issues.create(await le(e.credentialProvider,o,Ei.operationId)),list:async(o={})=>t.issues.list(await le(e.credentialProvider,o,"issues.list")),search:async(o={})=>t.issues.search(await le(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 le(e.credentialProvider,o,"pullRequests.list"))},statusComponents:{list:async(o={})=>t.statusComponents.list(await le(e.credentialProvider,o,"statusComponents.list")),get:async(o)=>t.statusComponents.get(o),register:async(o)=>t.statusComponents.register(await le(e.credentialProvider,o,Ir.operationId)),deregister:async(o)=>t.statusComponents.deregister({componentId:o.componentId,...o.reason!==void 0?{reason:o.reason}:{}}),incidents:{list:async(o={})=>t.statusComponents.incidents.list(await le(e.credentialProvider,o,"statusComponents.incidents.list"))},timeline:async(o)=>t.statusComponents.timeline(o)},billing:{getSummary:async(o={})=>t.billing.getSummary(await ln(e.credentialProvider,o)),getUsage:async(o={})=>t.billing.getUsage(await ln(e.credentialProvider,o)),listTransactions:async(o={})=>t.billing.listTransactions(await ln(e.credentialProvider,o))},tasks:{list:async(o={})=>t.tasks.list(await le(e.credentialProvider,o,Dc.operationId))},recommendations:{list:async(o={})=>t.recommendations.list(await le(e.credentialProvider,o,Cc.operationId))}}},dP=async(e={})=>{let t=await Jq(e.fetch)(Gq(e.apiBaseUrl??Eq,"/device/code"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_id:e.clientId??Kq,...e.scope?{scope:e.scope}:{}})}),n=await t.json();if(!t.ok)throw zhe(n,t.status);let i=n;return{deviceCode:Or(i.device_code,"device_code"),userCode:Or(i.user_code,"user_code"),verificationUri:Or(i.verification_uri,"verification_uri"),verificationUriComplete:Or(i.verification_uri_complete,"verification_uri_complete"),expiresIn:gP(i.expires_in,"expires_in"),interval:gP(i.interval,"interval")}},yP=async(e)=>{let t=await Jq(e.fetch)(Gq(e.apiBaseUrl??Eq,"/device/token"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:Ohe,device_code:e.deviceCode,client_id:e.clientId??Kq})}),n=await t.json();if(t.ok){let o=n;return{status:"authorized",accessToken:Or(o.access_token,"access_token"),tokenType:Or(o.token_type,"token_type"),expiresIn:gP(o.expires_in,"expires_in"),scope:typeof o.scope==="string"?o.scope:""}}let i=Bq(n);if(!i)throw Error(`Device authorization failed with status ${t.status}`);if(i.error==="authorization_pending")return{status:"pending"};if(i.error==="slow_down")return{status:"pending",interval:10};if(i.error==="access_denied")return{status:"denied",message:i.errorDescription};if(i.error==="expired_token"||i.error==="invalid_grant")return{status:"expired",message:i.errorDescription};throw Error(i.errorDescription)},Phe=(e)=>{let t=e.replace(/\/+$/,"");return t.endsWith("/v1")?t:`${t}/v1`},Gq=(e,t)=>{return`${e.replace(/\/+$/,"")}/api/auth${t}`},She=async(e,t)=>{return ln(e,t)},ln=async(e,t)=>{let n=t.organizationId??await e.getOrganizationId?.();return n?{...t,organizationId:n}:t},$he=async(e,t)=>{let n=t.organizationId??await e.getOrganizationId?.();if(!n)throw new Ze("BAD_REQUEST",{message:"Organization ID is required",data:{operationId:"organizations.update",missingContext:["organizationId"]},status:400});return{...t,organizationId:n}},le=async(e,t,n)=>{let i=t.projectId??await e.getProjectId?.();if(!i)throw new Ze("BAD_REQUEST",{message:"Project ID is required",data:{operationId:n,missingContext:["projectId"]},status:400});return{...t,projectId:i}},The=async(e,t)=>{let n=t.projectId??await e.getProjectId?.();return n?{...t,projectId:n}:t},Ahe=async(e,t)=>{let n=t.projectId??await e.getProjectId?.();return n?{...t,projectId:n}:t},Che=async(e,t)=>{let n=t.projectId??await e.getProjectId?.();return n?{...t,projectId:n}:t},Lhe=(e)=>{return{threadId:e.threadId,message:e.message,wait:e.wait??!0,timeoutSeconds:e.timeoutSeconds??20,...e.automationId!==void 0?{automationId:e.automationId}:{}}},Dhe=(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"):[]}},Bq=(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}},zhe=(e,t)=>{let n=Bq(e);return Error(n?.errorDescription??`Device authorization failed with status ${t}`)},Jq=(e)=>{return e??globalThis.fetch},Uq=(e,t)=>({result:t,poll:()=>e.runs.get({runId:t.runId}),waitForCompletion:async(n={})=>Nhe(e,t,n)}),Nhe=async(e,t,n)=>{if(t.completed)return t;let i=n.intervalMs??2000,o=Date.now(),r=t;while(!r.completed){if(n.timeoutMs!==void 0&&Date.now()-o>=n.timeoutMs)return r;await _he(i),r=await e.runs.get({runId:r.runId})}return r},_he=async(e)=>{await new Promise((t)=>globalThis.setTimeout(t,e))},Or=(e,t)=>{if(typeof e==="string")return e;throw Error(`Expected '${t}' to be a string.`)},gP=(e,t)=>{if(typeof e==="number")return e;throw Error(`Expected '${t}' to be a number.`)};var bP=g(()=>{oi();GS();zc();Pq();lP();lP()});var rt=(e)=>({success:!0,value:e}),We=(e,t,n)=>({success:!1,error:e,...t!==void 0&&{statusCode:t},...n!==void 0&&{errorPayload:n}}),k=(e,t,n)=>{if(!e.success){let i=`${t}: ${e.error}`;if(n)return p(e.errorPayload??i);return m(i)}return e.value};var ie=g(()=>{te()});var jhe="https://api.sazabi.com",z=async(e)=>{try{return rt(await e())}catch(t){let n=Rhe(t),i=Uhe(t),o=t instanceof Error?t.message:String(t);return We(o,i,n)}},Rhe=(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((i)=>typeof i==="string"):[]}},Uhe=(e)=>{if(!e||typeof e!=="object")return;let t=e;return typeof t.status==="number"?t.status:void 0},Gn=(e)=>{let t=xq({apiBaseUrl:e.baseUrl??jhe,clientSource:"cli",credentialProvider:{getToken:()=>e.token,getOrganizationId:()=>e.organizationId,getProjectId:()=>e.projectId},intakeBaseUrl:e.intakeBaseUrl,tailBaseUrl:e.tailBaseUrl});return{me:()=>z(()=>t.me()),automations:{list:(n={})=>z(()=>t.automations.list(n)),get:(n)=>z(()=>t.automations.get({automationId:n})),create:(n)=>z(()=>t.automations.create(n)),update:(n)=>z(()=>t.automations.update(n)),enable:(n)=>z(()=>t.automations.enable({automationId:n})),disable:(n)=>z(()=>t.automations.disable({automationId:n})),runs:{list:(n,i={})=>z(()=>t.automations.runs.list({automationId:n,...i})),get:(n,i)=>z(()=>t.automations.runs.get({automationId:n,runId:i})),logs:(n,i)=>z(()=>t.automations.runs.logs({automationId:n,runId:i}))}},logs:{tail:(n)=>z(()=>t.logs.tail(n)),forward:(n)=>z(()=>t.logs.forward(n)),query:(n={})=>z(()=>t.logs.query(n)),schema:(n={})=>z(()=>t.logs.schema(n)),volume:(n)=>z(()=>t.logs.volume(n)),patterns:(n={})=>z(()=>t.logs.patterns(n)),nativeQuery:(n)=>z(()=>t.logs.nativeQuery(n))},organizations:{list:()=>z(()=>t.organizations.list()),get:(n)=>z(()=>t.organizations.get({organizationId:n})),rename:(n,i)=>z(()=>t.organizations.update({organizationId:i,name:n}))},members:{list:(n={})=>z(()=>t.members.list(n)),updateRole:(n,i,o)=>z(()=>t.members.updateRole({organizationId:o,userId:n,role:i})),remove:(n,i)=>z(()=>t.members.remove({organizationId:i,userId:n}))},projects:{list:(n={})=>z(()=>t.projects.list(n)),get:(n)=>z(()=>t.projects.get({projectId:n})),create:(n)=>z(()=>t.projects.create(n))},threads:{list:(n={})=>z(()=>t.threads.list(n)),get:(n)=>z(()=>t.threads.get({threadId:n})),create:(n)=>z(()=>t.threads.create(n)),getStatus:(n)=>z(()=>t.threads.getStatus({threadId:n})),update:(n,i)=>z(()=>t.threads.update({threadId:n,status:i})),fork:(n,i)=>z(()=>t.threads.fork({threadId:n,messageId:i})),setVisibility:(n,i)=>z(()=>t.threads.setVisibility({threadId:n,visibility:i})),createShareLink:(n)=>z(()=>t.threads.createShareLink({threadId:n})),listShareLinks:(n)=>z(()=>t.threads.listShareLinks({threadId:n})),revokeShareLink:(n,i)=>z(()=>t.threads.revokeShareLink({threadId:n,shareId:i})),stop:(n)=>z(()=>t.threads.stop({threadId:n})),stream:(n)=>z(()=>t.threads.stream(n))},messages:{list:(n,i={})=>z(()=>t.messages.list({threadId:n,...i})),append:(n,i,o,r,a,s)=>z(()=>t.messages.append({threadId:n,message:i,wait:o,timeoutSeconds:r,...a!==void 0?{automationId:a}:{},...s?{ambientServiceRun:s}:{}}))},runs:{get:(n)=>z(()=>t.runs.get({runId:n})),cancel:(n)=>z(()=>t.runs.cancel({runId:n})),stream:(n)=>z(()=>t.runs.stream(n))},search:{threads:(n)=>z(()=>t.search.threads(n)),messages:(n)=>z(()=>t.search.messages(n))},publicKeys:{list:(n)=>z(()=>t.publicKeys.list(n)),get:(n,i)=>z(()=>t.publicKeys.get(i?{keyId:n,projectId:i}:{keyId:n})),ensureLogForwarding:(n)=>z(()=>t.publicKeys.ensureLogForwarding(n)),update:(n)=>z(()=>t.publicKeys.update(n)),deactivate:(n)=>z(()=>t.publicKeys.deactivate(n))},secretKeys:{list:(n)=>z(()=>t.secretKeys.list(n)),get:(n)=>z(()=>t.secretKeys.get({keyId:n})),create:(n)=>z(()=>t.secretKeys.create(n)),update:(n)=>z(()=>t.secretKeys.update(n)),delete:(n)=>z(()=>t.secretKeys.delete(n))},issues:{count:(n={})=>z(()=>t.issues.count(n)),create:(n)=>z(()=>t.issues.create(n)),list:(n={})=>z(()=>t.issues.list(n)),search:(n={})=>z(()=>t.issues.search(n)),get:(n)=>z(()=>t.issues.get({issueId:n})),resolve:(n)=>z(()=>t.issues.resolve({issueId:n})),ignore:(n)=>z(()=>t.issues.ignore({issueId:n})),reopen:(n)=>z(()=>t.issues.reopen({issueId:n})),mute:(n)=>z(()=>t.issues.mute({issueId:n})),unmute:(n)=>z(()=>t.issues.unmute({issueId:n}))},pullRequests:{list:(n={})=>z(()=>t.pullRequests.list(n))},statusComponents:{list:(n={})=>z(()=>t.statusComponents.list(n)),get:(n)=>z(()=>t.statusComponents.get({componentId:n})),register:(n)=>z(()=>t.statusComponents.register(n)),deregister:(n,i)=>z(()=>t.statusComponents.deregister({componentId:n,...i!==void 0?{reason:i}:{}})),incidents:{list:(n={})=>z(()=>t.statusComponents.incidents.list(n))},timeline:(n)=>z(()=>t.statusComponents.timeline(n))},billing:{getSummary:(n={})=>z(()=>t.billing.getSummary(n)),getUsage:(n={})=>z(()=>t.billing.getUsage(n)),listTransactions:(n={})=>z(()=>t.billing.listTransactions(n))},tasks:{list:(n={})=>z(()=>t.tasks.list(n))},recommendations:{list:(n={})=>z(()=>t.recommendations.list(n))},dataSources:{listTypes:()=>z(()=>t.dataSources.listTypes()),connections:{list:(n)=>z(()=>t.dataSources.connections.list(n)),get:(n)=>z(()=>t.dataSources.connections.get({connectionId:n})),create:(n)=>z(()=>t.dataSources.connections.create(n)),disconnect:(n)=>z(()=>t.dataSources.connections.disconnect({connectionId:n}))},streams:{list:(n)=>z(()=>t.dataSources.streams.list({connectionId:n})),get:(n)=>z(()=>t.dataSources.streams.get({streamId:n})),create:(n)=>z(()=>t.dataSources.streams.create(n)),delete:(n)=>z(()=>t.dataSources.streams.delete({streamId:n}))}},integrations:{listProviders:()=>z(()=>t.integrations.listProviders()),listConnections:(n)=>z(()=>t.integrations.listConnections(n)),getConnection:(n)=>z(()=>t.integrations.getConnection({connectionId:n}))},mcpConnectors:{list:(n)=>z(()=>t.mcpConnectors.list(n)),get:(n)=>z(()=>t.mcpConnectors.get(n)),details:(n)=>z(()=>t.mcpConnectors.details(n)),listProviders:()=>z(()=>t.mcpConnectors.listProviders())},sandboxPresets:{listTypes:()=>z(()=>t.sandboxPresets.listTypes())},scripts:{list:(n={})=>z(()=>t.scripts.list(n)),get:(n)=>z(()=>t.scripts.get({name:n})),create:(n)=>z(()=>t.scripts.create(n)),update:(n,i={})=>z(()=>t.scripts.update({name:n,...i})),delete:(n)=>z(()=>t.scripts.delete({name:n}))}}};var Nc=g(()=>{bP();ie()});var qq;var Hq=g(()=>{qq={version:2,activeProfile:"default",profiles:{default:{}}}});import*as Bn from"node:fs";import*as Wq from"node:os";import*as wP from"node:path";var gt=(e)=>{if(e===void 0||e===null)return;if(typeof e==="string")return e.length>0?e:void 0;return},pP,Pr,Ehe=()=>{if(!Bn.existsSync(pP))Bn.mkdirSync(pP,{recursive:!0,mode:448})},mP,Mq=(e)=>{mP=e},Yq=(e)=>({token:gt(e.token),activeOrganizationId:gt(e.activeOrganizationId??e.organizationId),organizationName:gt(e.organizationName),activeProjectId:gt(e.activeProjectId??e.defaultProjectId),apiBaseUrl:gt(e.apiBaseUrl),authBaseUrl:gt(e.authBaseUrl),webBaseUrl:gt(e.webBaseUrl),intakeBaseUrl:gt(e.intakeBaseUrl),tailBaseUrl:gt(e.tailBaseUrl),apiDomain:gt(e.apiDomain),webDomain:gt(e.webDomain),intakeDomain:gt(e.intakeDomain),tailDomain:gt(e.tailDomain),forwardPublicKey:gt(e.forwardPublicKey),forwardPublicKeyProjectId:gt(e.forwardPublicKeyProjectId)}),Khe=(e)=>({version:2,activeProfile:"default",profiles:{default:Yq(e)}}),xhe=(e)=>{let t=gt(e.activeProfile)??"default",n=typeof e.profiles==="object"&&e.profiles!==null?e.profiles:{},i={};for(let[o,r]of Object.entries(n)){if(typeof r!=="object"||r===null)continue;i[o]=Yq(r)}if(!i[t])i[t]={};return{version:2,activeProfile:t,profiles:i}},Ue=()=>{try{if(!Bn.existsSync(Pr))return rt(qq);let e=Bn.readFileSync(Pr,"utf-8"),t=JSON.parse(e),n=typeof t.version==="number"?t.version:void 0;if(n!==void 0&&n>2)return We("Settings file requires a newer CLI version. Upgrade with 'npm install -g @sazabi/cli@latest'.");if(n===2)return rt(xhe(t));let i=Khe(t),o=Ye(i);if(!o.success)return o;return rt(i)}catch(e){let t=e instanceof Error?e.message:String(e);return We(t)}},Ye=(e)=>{try{return Ehe(),Bn.writeFileSync(Pr,JSON.stringify(e,null,2),{encoding:"utf-8",mode:384}),rt(void 0)}catch(t){let n=t instanceof Error?t.message:String(t);return We(n)}},On=(e,t)=>{if(t)return t;if(mP)return mP;let n=process.env.SAZABI_PROFILE?.trim();if(n)return n;return e.activeProfile??"default"},zt=(e,t)=>{let n=On(e,t),i=e.profiles[n];if(i)return rt(i);if(n==="default")return rt({});return We(`Profile '${n}' does not exist. Run 'sazabi profiles create ${n}' first.`)},Jn=()=>{let e=Ue();if(!e.success)return e;return zt(e.value)},Nt=(e,t,n)=>{let i=On(e,n);if(!e.profiles[i])return We(`Profile '${i}' does not exist. Run 'sazabi profiles create ${i}' first.`);return rt({...e,profiles:{...e.profiles,[i]:{...e.profiles[i],...t}}})},qn=(e)=>{if(!e?.forwardPublicKey&&!e?.forwardPublicKeyProjectId)return{};return{forwardPublicKey:void 0,forwardPublicKeyProjectId:void 0}};var Zt=g(()=>{Hq();ie();pP=wP.join(Wq.homedir(),".sazabi"),Pr=wP.join(pP,"settings.json")});var Pn=(e)=>{let{cliFlag:t,globalUrl:n,globalDomain:i,buildUrlFromDomain:o,defaultUrl:r}=e;if(t)return t;let a=process.env.SAZABI_API_URL?.trim();if(a)return a;if(n)return n;if(i)return o(i);return r},L=(e)=>{let{tokenFlag:t,organizationIdFlag:n,projectIdFlag:i,jsonMode:o}=e,r=t?.trim(),a=process.env.SAZABI_TOKEN?.trim(),s=process.env.SAZABI_ORGANIZATION_ID?.trim(),h=process.env.SAZABI_PROJECT_ID?.trim(),l=k(Jn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",o),u=l.token?.trim(),d=(r&&r.length>0?r:void 0)||(a&&a.length>0?a:void 0)||u,y=r&&r.length>0?"flag":a&&a.length>0?"environment":"settings";if(!d||d.length===0){if(o)return p("Not authenticated. Set SAZABI_TOKEN, pass --token, run 'sazabi auth login', or run 'sazabi auth save <token>'.");return m("Not authenticated. Set SAZABI_TOKEN, pass --token, run 'sazabi auth login', or run 'sazabi auth save <token>'.")}let b,w;if(n)b=n,w="flag";else if(s&&s.length>0)b=s,w="environment";else if(l.activeOrganizationId)b=l.activeOrganizationId,w="settings";let v,O;if(i)v=i,O="flag";else if(h&&h.length>0)v=h,O="environment";else if(l.activeProjectId)v=l.activeProjectId,O="settings";return{token:d,type:"token",projectId:v,organizationId:b,tokenSource:y,organizationSource:w,projectSource:O}},fP=(e)=>{let t=k(Jn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e?.jsonMode);return Pn({cliFlag:e?.apiBaseUrlFlag,globalUrl:t.apiBaseUrl,globalDomain:t.apiDomain,buildUrlFromDomain:(n)=>`https://api.${n}`,defaultUrl:"https://api.sazabi.com"})},D=(e)=>{let t=fP({apiBaseUrlFlag:e.apiBaseUrlFlag,jsonMode:e.jsonMode});return Gn({token:e.token,baseUrl:t,organizationId:e.organizationId,projectId:e.projectId})},Xq,vP,ng=async(e)=>{let t=k(Jn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.jsonMode),n=Pn({cliFlag:e.apiBaseUrlFlag,globalUrl:t.apiBaseUrl,globalDomain:t.apiDomain,buildUrlFromDomain:(h)=>`https://api.${h}`,defaultUrl:"https://api.sazabi.com"}),i=`${e.token}@${n}@${e.projectId??""}`,o=Xq.get(i);if(o)return o;let r=vP.get(i);if(r)return r;if(!e.projectId){if(e.jsonMode)return p("Project ID is required. Run 'sazabi projects use <project-id>' or set SAZABI_PROJECT_ID.");return m("Project ID is required. Run 'sazabi projects use <project-id>' or set SAZABI_PROJECT_ID.")}let a=e.projectId,s=(async()=>{let l=await Gn({token:e.token,baseUrl:n,projectId:a}).projects.get(a),d=k(l,"Couldn't fetch project info (run 'sazabi projects list' to verify the project ID)",e.jsonMode).project;return Xq.set(i,d),d})();vP.set(i,s);try{return await s}finally{vP.delete(i)}},tg=(e)=>{let t=e.trim().toLowerCase(),n=/^[a-z][a-z0-9+.-]*:\/\//.test(t)?t:`https://${t}`,i=t;try{i=new URL(n).hostname.toLowerCase()}catch{i=t.replace(/^[a-z][a-z0-9+.-]*:\/\//,"").replace(/[/?#].*$/,"").replace(/:\d+$/,"")}return`https://app.${i.replace(/^(?:app\.)+/,"")}`},Sr=(e)=>{let t=(i)=>i.replace(/\/+$/,"");if(e)return t(e);let n=k(Jn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)");if(n.webBaseUrl)return t(n.webBaseUrl);if(n.webDomain)return tg(n.webDomain);if(n.apiDomain)return tg(n.apiDomain);return"https://app.sazabi.com"},Sn=(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 p(n);return m(n)},po=(e,t)=>{return`${Sr(t)}/projects/${e}`},Xe=(e,t,n,i)=>{let o=`${Sr(n)}/projects/${e}/threads/${t}`;return i?`${o}?messageId=${encodeURIComponent(i)}`:o},Zq=(e,t,n,i)=>{return Xe(e,t,n,i)},Fq=(e,t,n)=>{return`${po(e,n)}/issues/${t}`},Qq=(e,t,n)=>{return`${po(e,n)}/automations/${t}`},Vq=(e,t)=>{return`${po(e,t)}/status`},eH=(e,t,n)=>{return`${po(e,n)}/settings/data-sources/${t}`},tH=(e,t,n)=>{return`${po(e,n)}/settings/mcp-connectors/${t}`},nH=(e,t,n)=>{return`${po(e,n)}/settings/sandbox/catalog/${t}`},oH=(e,t)=>{return`https://otlp.${t}.intake.${e}`};var ce=g(()=>{te();Nc();ie();Zt();Xq=new Map,vP=new Map});var dg,yM=(e)=>{dg.set(e.name,e)},yg=(e)=>{return dg.get(e)},xc=()=>{return Array.from(dg.values())},bM=(e)=>{return dg.has(e)};var xP=g(()=>{dg=new Map});async function qP(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 HP(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 Abe(e){let t=await e.dataSources.connections.list();if(!t.success)return[];return t.value.connections.map((n)=>({value:n.id,description:n.displayName??void 0}))}async function wM(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 $be=3000,Tbe,vM=async(e,t,n)=>{try{let i=Tbe[e]?.[t];if(!i)return[];let o=Jn();if(!o.success)return[];let r=o.value,a=process.env.SAZABI_TOKEN?.trim()||r.token?.trim();if(!a)return[];let s=Pn({globalUrl:r.apiBaseUrl,globalDomain:r.apiDomain,buildUrlFromDomain:(u)=>`https://api.${u}`,defaultUrl:"https://api.sazabi.com"}),h=Gn({token:a,baseUrl:s,organizationId:r.activeOrganizationId,projectId:r.activeProjectId});return(await Promise.race([i(h),new Promise((u)=>setTimeout(()=>u([]),$be))])).filter((u)=>u.value.startsWith(n))}catch{return[]}};var fM=g(()=>{Nc();ce();Zt();Tbe={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:qP,update:qP,deactivate:qP},"secret-keys":{get:HP,update:HP,delete:HP},"data-sources":{"get-connection":Abe},members:{"update-role":wM,remove:wM}}});var IM={};un(IM,{parseCompletionContext:()=>Dbe,getCompletions:()=>zbe});var Cbe,Lbe,Dbe=(e)=>{let t=e.length>0?e:[""],n=t.length-1,i=t[n]??"";return{words:t,currentIndex:n,partial:i}},zbe=async(e)=>{let{words:t,currentIndex:n,partial:i}=e,o=t[n-1];if(o==="--profile")return Rbe(i);let r=jbe(t),a=Math.max(0,r.length-(t.length-n));if(a===0)return Nbe(i);let s=r[0]??"",h=yg(s);if(!h)return[];if(a===1&&h.subcommands){if(i.startsWith("-"))return kM(h.options,r);return _be(h,i)}let l=h.subcommands?r[1]:void 0,d=(l?h.subcommands?.[l]:void 0)?.options??h.options;if(i.startsWith("-"))return kM(d,r);if(o?.startsWith("--")){let y=o.slice(2);if(d?.[y]?.type==="string"){let w=`${s}:${l??""}`,v=Lbe[w]?.[y]??Cbe[y];if(v)return v.filter((O)=>O.startsWith(i)).map((O)=>({value:O}));return[]}}return vM(s,l??"",i)},Nbe=(e)=>{let n=xc().filter((o)=>o.name.startsWith(e)).map((o)=>({value:o.name,description:o.description})),i=[{value:"--help",description:"Show help"},{value:"--version",description:"Show version"},{value:"--profile",description:"Use a named profile"}];for(let o of i)if(o.value.startsWith(e))n.push(o);return n},_be=(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}))},kM=(e,t)=>{let n=t[t.length-1]??"",i=new Set(t.filter((r)=>r.startsWith("--")).map((r)=>r.replace(/=.*/,""))),o=[];if(!i.has("--help")&&"--help".startsWith(n))o.push({value:"--help",description:"Show help"});if(!i.has("--profile")&&"--profile".startsWith(n))o.push({value:"--profile",description:"Use a named profile"});if(!e)return o;for(let[r,a]of Object.entries(e)){let s=`--${r}`;if(i.has(s))continue;if(!s.startsWith(n))continue;o.push({value:s,description:a.description})}return o},jbe=(e)=>{let t=[];for(let n=0;n<e.length;n++){let i=e[n];if(i==="--profile"&&n+1<e.length)n++;else if(i.startsWith("--profile="));else t.push(i)}return t},Rbe=(e)=>{try{let t=Ue();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 OM=g(()=>{xP();Zt();fM();Cbe={status:["regular","archived"],format:["json","text"]},Lbe={"members:update-role":{role:["admin","member"]},"messages:search":{role:["user","assistant"]},"messages:list":{role:["user","assistant"]}}});te();te();te();import{parseArgs as QM}from"node:util";var S=(e,t,n={})=>{let i=QM({args:e,options:t,allowPositionals:Boolean(n.allowPositionals),strict:!1,tokens:!0}),o=Object.hasOwn(t,"json")&&i.values.json===!0,r=new Set(Object.keys(t)),a=new Set(Object.entries(t).map(([,h])=>h.short).filter((h)=>Boolean(h))),s=[];if(Array.isArray(i.tokens))for(let h of i.tokens){if(h.kind!=="option")continue;let l=h.name,u=l.length>1;if(!(r.has(l)||!u&&a.has(l))){let y=u?`--${l}`:`-${l}`;if(!s.includes(y))s.push(y)}}for(let h of Object.keys(i.values))if(!r.has(h)){let l=h.length>1?`--${h}`:`-${h}`;if(!s.includes(l))s.push(l)}if(s.length>0){let h=`Unknown option${s.length>1?"s":""}: ${s.join(", ")}. Run the command with -h for usage.`;if(o)p(h);m(h)}for(let[h,l]of Object.entries(t))if(l.type==="string"&&i.values[h]===!0){let u=h.length===1?`-${h}`:`--${h}`,d=`Option ${u} requires a value. Use '${u} <value>'.`;if(o)p(d);m(d)}for(let[h,l]of Object.entries(t)){let u=i.values[h];if(l.type==="string"&&typeof u==="string"){if(u.startsWith("--")||u.length===2&&u[0]==="-"&&/[a-zA-Z]/.test(u.charAt(1))){let b=`Option ${h.length===1?`-${h}`:`--${h}`} received "${u}" as its value. Did you forget to provide a value?`;if(o)p(b);m(b)}}}return{values:i.values,positionals:i.positionals}};var Wc=(e,t)=>{if(e?.json?.type!=="boolean")throw Error(`${t} must include a boolean --json option (enforced by CommandBuilder)`)};class sS{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)Wc(this.options,`Subcommand "${this.name}"`);if(!this.allowNoJson&&this.subcommands){for(let[e,t]of Object.entries(this.subcommands))if(!t.subcommands)Wc(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 hS{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)Wc(this.options,`Command "${this.name}"`);if(this.subcommands)for(let[e,t]of Object.entries(this.subcommands)){if(t.subcommands)continue;Wc(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 ne=(e,t)=>{return new hS(e,t)},P=(e,t,n)=>{return new sS(e,t,n)};te();var ht=(e,t,n,i,o)=>{let r=Number.parseInt(e,10);if(Number.isNaN(r)||r<t||r>n){let a=`${i} must be between ${t} and ${n}.`;if(o)return p(a);return m(a)}return r},Tt=(e,t,n,i)=>{if(!t.includes(e)){let o=t.map((a)=>`"${a}"`).join(" or "),r=`${n} must be ${o}.`;if(i)return p(r);return m(r)}return e};te();ce();ie();var IP=(e)=>{let t=[];for(let n of e){let i=0;for(let o of n.content){if(o.type!=="artifact")continue;t.push({id:`${n.id}:${i}`,messageId:n.id,name:o.name,toolCallId:o.toolCallId??null,createdAt:n.createdAt,data:o.data}),i+=1}}return t},rH=(e)=>{let t=e.lastIndexOf(":");if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),i=e.slice(t+1);if(!/^\d+$/.test(i))return null;return{messageId:n,index:Number.parseInt(i,10)}},aH=(e,t)=>{return IP(e).find((n)=>n.id===t)},kP=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),iH=(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},Ghe=(e)=>{if(Array.isArray(e)&&e.every(kP))return e;if(kP(e))for(let t of["rows","data","items","points"]){let n=e[t];if(Array.isArray(n)&&n.every(kP))return n}return null},cH=(e)=>{let t=Ghe(e);if(!t||t.length===0)return null;let n=[];for(let o of t)for(let r of Object.keys(o))if(!n.includes(r))n.push(r);if(n.length===0)return null;let i=[n.map(iH).join(",")];for(let o of t)i.push(n.map((r)=>iH(o[r])).join(","));return i.join(`
|
|
8561
8561
|
`)};var Bhe=100,sH=100,Jhe=async(e,t,n)=>{let i=[],o;for(let r=0;r<sH;r++){let a=await e.messages.list(t,{limit:Bhe,...o?{cursor:o}:{}}),s=k(a,"Couldn't get artifact (check the thread ID and try again)",n);if(i.push(...s.messages),!s.nextCursor)break;o=s.nextCursor}if(o&&!n)console.error(`Warning: reached the ${sH}-page limit; the artifact may exist beyond the scanned messages.`);return i},qhe=(e,t,n)=>{if(t)return t;let i=`--thread-id is required to locate artifact '${e}'. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>`;if(n)p(i);else m(i);return},Hhe=(e,t)=>{if(t.json){Q({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=cH(e.data);if(n===null){m(`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))},hH=async(e,t)=>{if(!rH(e)){let h=`Invalid artifact ID: '${e}'. Expected format '<message-id>:<index>' (from 'sazabi artifacts list').`;if(t.json)return p(h);return m(h)}let i=qhe(e,t.threadId,t.json);if(!i)return;let o=L({tokenFlag:t.token,jsonMode:t.json}),r=D({token:o.token,projectId:o.projectId,apiBaseUrlFlag:t.apiBaseUrl}),a=await Jhe(r,i,t.json),s=aH(a,e);if(!s){let h=`Artifact '${e}' not found in thread '${i}'. Run 'sazabi artifacts list --thread-id ${i}' to see available artifacts.`;if(t.json)return p(h);return m(h)}Hhe(s,t)};te();ce();ie();var Whe={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"}}},Mhe={schema:Whe,columns:["id","name","toolCallId","createdAt"],header:"Artifacts",emptyMessage:"No artifacts found in this thread."},Yhe=100,lH=100,Xhe=async(e,t,n)=>{let i=[],o;for(let r=0;r<lH;r++){let a=await e.messages.list(t,{limit:Yhe,...o?{cursor:o}:{}}),s=k(a,"Couldn't list artifacts (check the thread ID and try again)",n);if(i.push(...s.messages),!s.nextCursor)break;o=s.nextCursor}if(o&&!n)console.error(`Warning: reached the ${lH}-page limit; artifact list may be incomplete for this thread.`);return i},uH=async(e)=>{let t=L({tokenFlag:e.token,jsonMode:e.json}),n=D({token:t.token,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl}),i=await Xhe(n,e.threadId,e.json),r=IP(i).map((a)=>({id:a.id,name:a.name,toolCallId:a.toolCallId,createdAt:a.createdAt}));X(Mhe,r,{json:e.json})};var gH=ne("artifacts","Retrieve artifacts produced in a thread").withSubcommands({list:P("list","List artifacts produced in a thread",async(e)=>{let{values:t}=S(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 p("--thread-id is required. Usage: sazabi artifacts list --thread-id <thread-id>");return m("--thread-id is required. Usage: sazabi artifacts list --thread-id <thread-id>")}await uH({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}=S(e,{token:{type:"string"},"thread-id":{type:"string"},format:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Artifact ID is required. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>");return m("Artifact ID is required. Usage: sazabi artifacts get <artifact-id> --thread-id <thread-id>")}if(n.length>1){let r=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${r}.`);return m(`Unexpected arguments: ${r}.`)}let o;if(t.format)o=Tt(t.format,["json","csv"],"Format",t.json);await hH(i,{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();bP();import{spawn as Zhe}from"node:child_process";var B={token:{type:"string"},"api-base-url":{type:"string"},json:{type:"boolean"}},J={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();Zt();var $r=(e)=>{if(e==="flag")return"from flag";if(e==="environment")return"from environment";return"from settings"},Fhe=async(e={})=>{let t=L({jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),i=k(await n.me(),"Couldn't fetch authentication details (run 'sazabi auth login' to sign in again)",e.json);if(e.json){Q({credential:i,activeOrganizationId:t.organizationId,activeProjectId:t.projectId,tokenSource:t.tokenSource,organizationSource:t.organizationSource,projectSource:t.projectSource});return}if(Ie("Authentication"),i.credentialType==="user"){Se({Type:`User token (${$r(t.tokenSource)})`,User:i.user.name??i.user.email,Email:i.user.email,"Active organization":t.organizationId&&t.organizationSource?`${t.organizationId} (${$r(t.organizationSource)})`:st("(none)"),"Active project":t.projectId&&t.projectSource?`${t.projectId} (${$r(t.projectSource)})`:st("(none)"),Organizations:i.organizations.length.toString(),"Dashboard URL":Sr()});return}if(i.credentialType==="secret"){Se({Type:`Secret key (${$r(t.tokenSource)})`,Organization:i.organization.name,"Key name":i.keyName,"Active project":t.projectId&&t.projectSource?`${t.projectId} (${$r(t.projectSource)})`:st("(none)"),"Dashboard URL":Sr()});return}Se({Type:`Partner key (${$r(t.tokenSource)})`,Superorganization:i.superorganization.name,"Dashboard URL":Sr()})},Qhe=async(e,t={})=>{let n=e.trim();if(!n){if(t.json)return p("Token is required.");return m("Token is required.")}let i=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json);await OP({token:n,options:t,cliSettings:i,status:"saved"})},dH=(e)=>{let t=process.platform,n,i;if(t==="darwin")n="open",i=[e];else if(t==="win32")n="cmd",i=["/c","start","",e];else n="xdg-open",i=[e];let o=Zhe(n,i,{detached:!0,stdio:"ignore"});o.on("error",()=>{}),o.unref()},yH=(e)=>new Promise((t)=>setTimeout(t,e)),Vhe=async(e={})=>{let t=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=On(t),i=t.profiles[n]??{},o=PP(i,e.apiBaseUrl),r=bH(o,e.authBaseUrl??i.authBaseUrl),a;try{a=await dP({apiBaseUrl:r})}catch(y){let b=y instanceof Error?y.message:String(y);if(e.json)return p(`Failed to initiate sign-up: ${b}`);return m(`Failed to initiate sign-up: ${b}`)}let s=mH({profile:i,publicApiBaseUrl:o,authBaseUrl:r,apiBaseUrlOverride:e.apiBaseUrl,authBaseUrlOverride:e.authBaseUrl,webBaseUrlOverride:e.webBaseUrl,verificationUriComplete:a.verificationUriComplete}),h=`/login/cli?user_code=${encodeURIComponent(a.userCode)}`,l=`${s}/sign-up?returnTo=${encodeURIComponent(h)}`,u=new Date(Date.now()+a.expiresIn*1000),d=a.interval*1000;if(!e.json)se(),Ie("Create a Sazabi account"),se(),gn(`Opening ${_e.info(l)}`),se(),dH(l),ye("Waiting for sign-up to complete...");while(new Date<u){await yH(d);try{let y=await yP({apiBaseUrl:r,deviceCode:a.deviceCode});if(y.status==="pending"){d=(y.interval??a.interval)*1000;continue}if(y.status==="denied"){if(e.json)return p("Sign-up was denied.");return se(),m("Sign-up was denied.")}if(y.status==="expired"){if(e.json)return p("Sign-up request expired. Try again.");return se(),m("Sign-up request expired. Try again.")}await OP({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 p(`Sign-up failed: ${b}`);return se(),m(`Sign-up failed: ${b}`)}}if(e.json)return p("Sign-up request expired. Try again.");return se(),m("Sign-up request expired. Try again.")},ele=async(e={})=>{let t=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=On(t),i=t.profiles[n]??{},o=PP(i,e.apiBaseUrl),r=bH(o,e.authBaseUrl??i.authBaseUrl),a;try{a=await dP({apiBaseUrl:r})}catch(d){let y=d instanceof Error?d.message:String(d);if(e.json)return p(`Failed to initiate login: ${y}`);return m(`Failed to initiate login: ${y}`)}let s=mH({profile:i,publicApiBaseUrl:o,authBaseUrl:r,apiBaseUrlOverride:e.apiBaseUrl,authBaseUrlOverride:e.authBaseUrl,webBaseUrlOverride:e.webBaseUrl,verificationUriComplete:a.verificationUriComplete}),h=sle(a.verificationUriComplete,s),l=new Date(Date.now()+a.expiresIn*1000),u=a.interval*1000;if(!e.json)se(),Ie("Sign in to Sazabi"),se(),gn("Enter this code in your browser:"),se(),gn(_e.bold(a.userCode),4),se(),gn(`Opening ${_e.info(h)}`),se(),dH(h),ye("Waiting for authorization...");while(new Date<l){await yH(u);try{let d=await yP({apiBaseUrl:r,deviceCode:a.deviceCode});if(d.status==="pending"){u=(d.interval??a.interval)*1000;continue}if(d.status==="denied"){if(e.json)return p("Authorization was denied.");return se(),m("Authorization was denied.")}if(d.status==="expired"){if(e.json)return p("Authorization request expired. Try again.");return se(),m("Authorization request expired. Try again.")}await OP({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 p(`Authorization failed: ${y}`);return se(),m(`Authorization failed: ${y}`)}}if(e.json)return p("Authorization request expired. Try again.");return se(),m("Authorization request expired. Try again.")},tle=(e)=>{let t=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=k(zt(t),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",e.json),i=Boolean(n.token),o=k(Nt(t,{token:void 0,activeOrganizationId:void 0,organizationName:void 0,activeProjectId:void 0,...qn(n)}),"Failed to update profile",e.json);if(k(Ye(o),"Failed to remove credentials",e.json),e.json){Q({removed:i});return}if(i){oe("Signed out.");return}ye("No credentials were saved.")},OP=async({token:e,options:t,cliSettings:n,status:i})=>{let o=On(n),r=n.profiles[o]??{},a=PP(r,t.apiBaseUrl),s=D({token:e,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),h=k(await s.me(),`Couldn't resolve authenticated context at ${a} (pass --api-base-url to target a different environment)`,t.json);if(i==="authorized"&&h.credentialType!=="user"){if(t.json)return p("Expected a user session from device authorization.");return m("Expected a user session from device authorization.")}let l=n.profiles[o]?n:{...n,profiles:{...n.profiles,[o]:{}}},u=l.profiles[o],d=await nle({client:s,credential:h,currentProjectId:u.activeProjectId,jsonMode:t.json}),y=u.token!==e||u.activeOrganizationId!==d.activeOrganizationId||u.activeProjectId!==d.activeProjectId,b=k(Nt(l,{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&&qn(u)}),"Failed to update profile",t.json);if(k(Ye(b),"Failed to save credentials",t.json),t.json){Q({status:i,credential:h,activeOrganizationId:d.activeOrganizationId,activeProjectId:d.activeProjectId,projects:d.projects});return}if(se(),oe(i==="authorized"?"Signed in.":"Token saved."),se(),ile({credential:h,activeOrganizationName:d.activeOrganizationName,activeProjectId:d.activeProjectId,projects:d.projects}),d.projects.length>0){se(),Ie("Available projects");for(let w of d.projects){let O=w.id===d.activeProjectId?_e.success(" (active)"):"";gn(`${w.name} (${w.region})${O}`)}}},nle=async({client:e,credential:t,currentProjectId:n,jsonMode:i})=>{if(t.credentialType==="partner")return{projects:[]};let o=t.credentialType==="user"?t.activeOrganizationId??t.organizations[0]?.id:t.organization.id,r=t.credentialType==="user"?t.organizations.find((s)=>s.id===o)?.name:t.organization.name,a=o?k(await e.projects.list({organizationId:o}),"Couldn't fetch projects (check your organization access and try again)",i).projects:[];return{activeOrganizationId:o,activeOrganizationName:r,activeProjectId:ole(a,n),projects:a}},ole=(e,t)=>{if(t&&e.some((n)=>n.id===t))return t;return e[0]?.id},ile=({credential:e,activeOrganizationName:t,activeProjectId:n,projects:i})=>{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":i.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":i.find((o)=>o.id===n)?.name??"(none)"});return}Se({Type:"Partner key",Superorganization:e.superorganization.name})},PP=(e,t)=>{return Pn({cliFlag:t,globalUrl:e.apiBaseUrl,globalDomain:e.apiDomain,buildUrlFromDomain:(n)=>`https://api.${n}`,defaultUrl:"https://api.sazabi.com"})},bH=(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}},pH=(e)=>e.replace(/\/+$/,""),_t=(e)=>(e?.trim().length??0)>0,rle=(e)=>{if(!_t(e))return;try{let t=new URL(e);return`${t.protocol}//${t.host}`}catch{return}},Tr=(e)=>{if(!_t(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},ale=(e)=>{if(_t(e.webBaseUrl))return pH(e.webBaseUrl);if(_t(e.webDomain))return tg(e.webDomain);return},cle=({profile:e,publicApiBaseUrl:t})=>{if(!(_t(e.authBaseUrl)||_t(e.apiBaseUrl)||_t(e.apiDomain)))return;if(_t(e.authBaseUrl)){let i=Tr(e.authBaseUrl);if(i)return i}return Tr(t)},mH=({profile:e,publicApiBaseUrl:t,authBaseUrl:n,apiBaseUrlOverride:i,authBaseUrlOverride:o,webBaseUrlOverride:r,verificationUriComplete:a})=>{if(_t(r))return pH(r);let s=process.env.SAZABI_API_URL?.trim(),h=_t(o)||_t(i)||_t(s),l=rle(a);if(h){let y=_t(o)?Tr(n):Tr(t);if(y)return y;if(l)return l}let u=ale(e);if(u)return u;let d=cle({profile:e,publicApiBaseUrl:t});if(d)return d;if(l)return l;return"https://app.sazabi.com"},sle=(e,t)=>{if(!t)return e;try{let n=new URL(e),i=new URL(t);return n.protocol=i.protocol,n.host=i.host,n.toString()}catch{return e}},wH=ne("auth","Manage authentication credentials").withSubcommands({signup:P("signup","Create a new Sazabi account via browser",async(e)=>{let{values:t,positionals:n}=S(e,{...B,"auth-base-url":{type:"string"},"web-base-url":{type:"string"}},{allowPositionals:!0});if(n.length>0){let i=n.join(", ");if(t.json)return p(`Unexpected arguments: ${i}.`);return m(`Unexpected arguments: ${i}.`)}await Vhe({json:t.json,apiBaseUrl:t["api-base-url"],authBaseUrl:t["auth-base-url"],webBaseUrl:t["web-base-url"]})}).withOptions({...J,"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}=S(e,{...B,"auth-base-url":{type:"string"},"web-base-url":{type:"string"}},{allowPositionals:!0});if(n.length>0){let i=n.join(", ");if(t.json)return p(`Unexpected arguments: ${i}.`);return m(`Unexpected arguments: ${i}.`)}await ele({json:t.json,apiBaseUrl:t["api-base-url"],authBaseUrl:t["auth-base-url"],webBaseUrl:t["web-base-url"]})}).withOptions({...J,"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}=S(e,{...B,"web-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Token is required.");return m("Token is required.")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}.`);return m(`Unexpected arguments: ${o}.`)}await Qhe(i,{json:t.json,apiBaseUrl:t["api-base-url"],webBaseUrl:t["web-base-url"]})}).withPositionalArgs("<token>").withOptions({...J,"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}=S(e,B,{allowPositionals:!0});if(n.length>0){let i=n.join(", ");if(t.json)return p(`Unexpected arguments: ${i}.`);return m(`Unexpected arguments: ${i}.`)}tle({json:t.json})}).withOptions(J).withExamples(["sazabi auth logout # Remove saved credentials"]).build(),whoami:P("whoami","Display current authentication context",async(e)=>{let{values:t,positionals:n}=S(e,B,{allowPositionals:!0});if(n.length>0){let i=n.join(", ");if(t.json)return p(`Unexpected arguments: ${i}.`);return m(`Unexpected arguments: ${i}.`)}await Fhe({json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions(J).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 _c=(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}),fH={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"}}},hle={schema:fH,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."},og={layout:"field-list",schema:fH,fields:["id","url","name","status","source","kind","health","cronExpression","timezone","timeoutSeconds","successRate","runCount","failedRunCount","lastRunStatus","lastRunAt","scriptIdentifier","scriptId","scriptName","canToggle","createdAt","updatedAt"],title:"Automation"},kH=(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}),IH={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)"}}},lle={schema:IH,columns:["status","startedAt","durationMs","exitCode"],jsonFields:["id","automationRunKey","status","scheduledAt","dueAt","startedAt","completedAt","durationMs","exitCode","errorMessage"],header:"Automation runs",emptyMessage:"No automation runs found."},ule={layout:"field-list",schema:IH,fields:["id","automationId","automationRunKey","status","scheduledAt","dueAt","startedAt","completedAt","durationMs","exitCode","errorMessage"],title:"Automation run"},gle=(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}),dle={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}}},yle={layout:"field-list",schema:dle,fields:["status","exitCode","truncated","durationMs","startedAt","completedAt","stdout","stderr"],title:"Automation run logs"},mo=(e)=>{let t=L({tokenFlag:e.token,projectIdFlag:e.projectId,jsonMode:e.json});return{client:D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),projectId:t.projectId}},ig=(e,t)=>t?{...e,url:Qq(t,e.id)}:e,ble=async(e)=>{let{client:t}=mo(e),n=k(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);X(hle,n.automations.map(_c),{json:e.json,nextCursor:n.nextCursor})},ple=async(e,t)=>{let{client:n,projectId:i}=mo(t),o=k(await n.automations.get(e),"Couldn't get automation (run 'sazabi automations list' to see automation IDs)",t.json);H(og,ig(_c(o.automation),i),{json:t.json})},mle=async(e,t)=>{let n=t.scriptId!==void 0,i=t.script!==void 0;if(n&&i){if(t.json){p("Provide exactly one of --script-id or --script.");return}m("Provide exactly one of --script-id or --script.");return}if(!n&&!i){if(t.json){p("Provide exactly one of --script-id or --script.");return}m("Provide exactly one of --script-id or --script.");return}let{client:o,projectId:r}=mo(t),a=k(await o.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.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}:{}}),"Couldn't create automation (check the script name/ID and try again)",t.json);if(!t.json)oe(`Automation "${a.automation.name}" created.`);H(og,ig(_c(a.automation),r),{json:t.json})},wle=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){p("Nothing to update. Provide --name, --description, --clear-description, --cron-expression, --timezone, or --timeout-seconds.");return}m("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){p("Use either --description or --clear-description, not both.");return}m("Use either --description or --clear-description, not both.");return}let{client:n,projectId:i}=mo(t),o=k(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)oe(`Automation "${o.automation.name}" updated.`);H(og,ig(_c(o.automation),i),{json:t.json})},OH=async(e,t,n)=>{let{client:i,projectId:o}=mo(n),r=k(t?await i.automations.enable(e):await i.automations.disable(e),t?"Failed to enable automation":"Failed to disable automation",n.json),a=ig(_c(r.automation),o);if(!n.json)oe(`Automation "${a.name}" is now ${t?"enabled":"disabled"}.`);H(og,a,{json:n.json})},vle=async(e,t)=>OH(e,!0,t),fle=async(e,t)=>OH(e,!1,t),kle=async(e,t)=>{let{client:n}=mo(t),i=k(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);X(lle,i.runs.map(kH),{json:t.json,nextCursor:i.nextCursor})},Ile=async(e,t,n)=>{let{client:i}=mo(n),o=k(await i.automations.runs.get(e,t),"Couldn't get automation run (run 'sazabi automations runs list <automation-id>' to see run IDs)",n.json);H(ule,kH(o.run),{json:n.json})},Ole=async(e,t,n)=>{let{client:i}=mo(n),o=k(await i.automations.runs.logs(e,t),"Couldn't get automation run logs (run 'sazabi automations runs list <automation-id>' to see run IDs)",n.json);H(yle,gle(o.logs),{json:n.json})},Hn={...B,"project-id":{type:"string"}},Wn={...J,"project-id":{type:"string",description:"Override active project ID"}},Ple=(e,t)=>{let n=e[0];if(!n){if(t){p("Automation name is required.");return}m("Automation name is required.");return}return n},Xo=(e,t)=>{let n=e[0];if(!n){if(t){p("Automation ID is required.");return}m("Automation ID is required.");return}return n},vH=(e,t)=>{let n=e[1];if(!n){if(t){p("Run ID is required.");return}m("Run ID is required.");return}return n},PH=ne("automations","Manage scheduled automations").withSubcommands({list:P("list","List automations in the active project",async(e)=>{let{values:t}=S(e,{...Hn,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){p(u);return}m(u)},i=t.status;if(i!==void 0&&i!=="active"&&i!=="paused")return n(`Invalid --status value "${i}". 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 r=t.health,a=["healthy","failing","never_run"];if(r!==void 0&&!a.includes(r))return n(`Invalid --health value "${r}". Expected one of: ${a.join(", ")}.`);let s=t.sort,h=["name","last_run","failures","runs"];if(s!==void 0&&!h.includes(s))return n(`Invalid --sort value "${s}". Expected one of: ${h.join(", ")}.`);let l;if(t.limit!==void 0){if(l=Number(t.limit),!Number.isInteger(l)||l<1||l>100)return n(`Invalid --limit value "${t.limit}". Expected an integer between 1 and 100.`)}await ble({token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],search:t.search,status:i,source:o,health:r,sort:s,limit:l,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}=S(e,Hn,{allowPositionals:!0}),i=Xo(n,t.json);if(!i)return;await ple(i,{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}=S(e,{...Hn,description:{type:"string"},"script-id":{type:"string"},script:{type:"string"},"cron-expression":{type:"string"},timezone:{type:"string"},"timeout-seconds":{type:"string"},enabled:{type:"boolean"}},{allowPositionals:!0}),i=Ple(n,t.json);if(!i)return;let o=(a)=>{if(t.json){p(a);return}m(a)},r;if(t["timeout-seconds"]!==void 0){if(r=Number(t["timeout-seconds"]),!Number.isInteger(r)||r<1||r>3600)return o(`Invalid --timeout-seconds value "${t["timeout-seconds"]}". Expected an integer between 1 and 3600.`)}await mle(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],description:t.description,scriptId:t["script-id"],script:t.script,cronExpression:t["cron-expression"],timezone:t.timezone,timeoutSeconds:r,enabled:t.enabled})}).withPositionalArgs("<name>").withOptions({...Wn,description:{type:"string",description:"Optional human-readable description"},"script-id":{type:"string",description:"Project script ID to run"},script:{type:"string",description:"Project script name to run"},"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"]).build(),update:P("update","Update an automation",async(e)=>{let{values:t,positionals:n}=S(e,{...Hn,name:{type:"string"},description:{type:"string"},"clear-description":{type:"boolean"},"cron-expression":{type:"string"},timezone:{type:"string"},"timeout-seconds":{type:"string"}},{allowPositionals:!0}),i=Xo(n,t.json);if(!i)return;let o=(a)=>{if(t.json){p(a);return}m(a)},r;if(t["timeout-seconds"]!==void 0){if(r=Number(t["timeout-seconds"]),!Number.isInteger(r)||r<1||r>3600)return o(`Invalid --timeout-seconds value "${t["timeout-seconds"]}". Expected an integer between 1 and 3600.`)}await wle(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],name:t.name,description:t.description,clearDescription:t["clear-description"],cronExpression:t["cron-expression"],timezone:t.timezone,timeoutSeconds:r})}).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}=S(e,Hn,{allowPositionals:!0}),i=Xo(n,t.json);if(!i)return;await vle(i,{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}=S(e,Hn,{allowPositionals:!0}),i=Xo(n,t.json);if(!i)return;await fle(i,{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}=S(e,{...Hn,status:{type:"string"},limit:{type:"string"},cursor:{type:"string"}},{allowPositionals:!0}),i=Xo(n,t.json);if(!i)return;let o=(h)=>{if(t.json){p(h);return}m(h)},r=t.status,a=["running","succeeded","failed","timed_out","cancelled"];if(r!==void 0&&!a.includes(r))return o(`Invalid --status value "${r}". Expected one of: ${a.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 kle(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],status:r,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}=S(e,Hn,{allowPositionals:!0}),i=Xo(n,t.json);if(!i)return;let o=vH(n,t.json);if(!o)return;await Ile(i,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}=S(e,Hn,{allowPositionals:!0}),i=Xo(n,t.json);if(!i)return;let o=vH(n,t.json);if(!o)return;await Ole(i,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 SP=(e)=>{let t=e.json,n=L({tokenFlag:e.token,jsonMode:t});return{client:D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:e["api-base-url"],jsonMode:t}),json:t??!1}},Sle={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"}}},$le={layout:"field-list",schema:Sle,fields:["plan","status","currency","balance","targetBalance","cycle","estimate","pendingDowngrade"]},Tle=(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)})`:"—"}),Ale=async(e)=>{let{values:t}=S(e,B),{client:n,json:i}=SP(t),o=k(await n.billing.getSummary(),"Couldn't fetch billing summary (check your organization access and try again)",i);if(!i){if(Ie("Billing summary"),!o.billable&&o.nonBillableReason)Se({"Not billable":o.nonBillableReason})}H($le,Tle(o),{json:i})},Cle={logs_ingested_bytes:"Log data (GB)",input_tokens:"Input tokens",output_tokens:"Output tokens"},Lle=(e)=>{let t=Number.parseFloat(e);if(Number.isNaN(t))return e;return(t/1e9).toFixed(3)},Dle=(e,t)=>{if(t==="logs_ingested_bytes")return Lle(e);let n=Number.parseInt(e,10);return Number.isNaN(n)?e:n.toLocaleString()},zle={dimension:{label:"Dimension",type:{kind:"string"}},total:{label:"Total quantity",type:{kind:"string"}},credits:{label:"Credits consumed",type:{kind:"string"}}},Nle={schema:zle,columns:["dimension","total","credits"],emptyMessage:"No usage recorded for this billing cycle."},_le=async(e)=>{let{values:t}=S(e,{...B,cycle:{type:"string"}}),{client:n,json:i}=SP(t);if(t.cycle&&t.cycle!=="current"&&t.cycle!=="previous"){if(i)return p("--cycle must be 'current' or 'previous'.");m("--cycle must be 'current' or 'previous'.");return}let o=t.cycle??"current",r=k(await n.billing.getUsage({cycle:o}),"Couldn't fetch billing usage (check your organization access and try again)",i);if(!i){if(Ie(`Billing usage (${o} cycle)`),r.cycle)Se({Cycle:`${r.cycle.startsAt.slice(0,10)} - ${r.cycle.endsAt.slice(0,10)}`})}let a=r.usage.map((s)=>{let h=s.dimension;return{dimension:Cle[h]??s.dimension,total:Dle(s.totalQuantity,h),credits:s.creditsConsumed}});X(Nle,a,{json:i})},jle={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"}}},Rle={schema:jle,columns:["occurredAt","type","delta","balance"],emptyMessage:"No billing transactions found."},Ule=async(e)=>{let{values:t}=S(e,{...B,limit:{type:"string"},page:{type:"string"}}),{client:n,json:i}=SP(t),o,r;if(t.limit){if(o=Number.parseInt(t.limit,10),Number.isNaN(o)||o<1||o>100){if(i)return p("--limit must be a positive integer (max 100).");m("--limit must be a positive integer (max 100).");return}}if(t.page){if(r=Number.parseInt(t.page,10),Number.isNaN(r)||r<1){if(i)return p("--page must be a positive integer.");m("--page must be a positive integer.");return}}let a=k(await n.billing.listTransactions({limit:o??10,page:r??1}),"Couldn't fetch billing transactions (check your organization access and try again)",i);if(!i)Ie("Billing transactions");let s=a.items.map((h)=>({occurredAt:h.occurredAt,type:h.transactionType,delta:h.creditDelta,balance:h.balanceAfter}));if(X(Rle,s,{json:i,count:a.pagination.total}),!i&&a.pagination.hasNext){let h=(r??1)+1;Se({"Next page":`Use --page ${h} for more results.`})}},Ele=P("summary","Show the billing summary for your organization",async(e)=>{await Ale(e)}).withOptions(J).withExamples(["sazabi billing summary # Show billing summary","sazabi billing summary --json # Output as JSON"]).build(),Kle=P("usage","Show per-dimension usage for the current or previous cycle",async(e)=>{await _le(e)}).withOptions({...J,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(),xle=P("transactions","List recent credit ledger transactions",async(e)=>{await Ule(e)}).withOptions({...J,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(),SH=ne("billing","View billing summary, usage, and transactions").withSubcommands({summary:Ele,usage:Kle,transactions:xle}).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 $H=()=>`
|
|
@@ -8602,7 +8602,7 @@ complete -F _sazabi sazabi
|
|
|
8602
8602
|
`)};te();ce();ie();te();var mge=/^(\d+)(s|m|h|d)$/u,wge=(e,t)=>{let n=mge.exec(e.trim());if(!n){if(t)return p("Duration must use s, m, h, or d units, for example 30m.");return m("Duration must use s, m, h, or d units, for example 30m.")}let i=Number(n[1]),o=n[2];return i*(o==="s"?1000:o==="m"?60000:o==="h"?3600000:86400000)},WH=(e,t,n)=>{let i=new Date(e);if(Number.isNaN(i.getTime())){let o=`${t} must be a valid ISO-8601 timestamp.`;if(n)return p(o);return m(o)}return i.toISOString()},Cr=(e)=>{if(e.last&&(e.from||e.to)){if(e.json)return p("Use either --last or --from/--to, not both.");return m("Use either --last or --from/--to, not both.")}if(e.last){let i=new Date,o=new Date(i.getTime()-wge(e.last,e.json));if(!Number.isFinite(o.getTime())||!Number.isFinite(i.getTime())){if(e.json)return p("--last is out of the supported date range.");return m("--last is out of the supported date range.")}return{startDate:o.toISOString(),endDate:i.toISOString()}}let t=e.from?WH(e.from,"--from",e.json):void 0,n=e.to?WH(e.to,"--to",e.json):void 0;if(t&&n&&new Date(t)>=new Date(n)){if(e.json)return p("--from must be before --to.");return m("--from must be before --to.")}return{startDate:t,endDate:n}};var vge={patterns:{label:"Patterns",type:{kind:"custom",render:(e)=>`${Array.isArray(e)?e.length:0} patterns`,serialize:(e)=>e}},meta:{label:"Meta",type:{kind:"custom",render:(e)=>JSON.stringify(e),serialize:(e)=>e}}},fge={layout:"field-list",schema:vge,fields:["patterns","meta"]},kge={serviceName:{label:"Service",type:{kind:"nullable-string",emptyLabel:"(unknown)"}},severity:{label:"Severity",type:{kind:"custom",render:(e)=>typeof e==="string"&&e.length>0?An(e):"(none)",serialize:(e)=>e}},occurrences:{label:"Occurrences",type:{kind:"number"},align:"right"},lastSeen:{label:"Last Seen",type:{kind:"nullable-date",emptyLabel:"(never)"}},pattern:{label:"Pattern",type:{kind:"truncated",maxLength:140}},representativeId:{label:"Representative",type:{kind:"nullable-string",emptyLabel:"(none)"}}},Ige={schema:kge,columns:["serviceName","severity","occurrences","lastSeen","pattern","representativeId"],header:{title:"Log patterns",variant:"search"},emptyMessage:"No matching log patterns."},Oge=(e)=>{let t=Cr(e);return{...e.query?{query:e.query}:{},...e.severity?{severity:e.severity}:{},...t.startDate?{startDate:t.startDate}:{},...t.endDate?{endDate:t.endDate}:{},limit:e.limit??25}},MH=async(e)=>{let t=L({tokenFlag:e.token,projectIdFlag:e.project,jsonMode:e.json}),n=D({token:t.token,projectId:t.projectId,apiBaseUrlFlag:e["api-base-url"],jsonMode:e.json}),i=k(await n.logs.patterns(Oge(e)),"Failed to query log patterns",e.json);if(e.json){H(fge,i,{json:!0});return}Pge(i)},Pge=(e)=>{if(e.patterns.length>0)ye(`Returned ${e.meta.count} pattern${e.meta.count===1?"":"s"} in ${e.meta.took}ms`);X(Ige,e.patterns,{count:e.meta.count})};te();ce();ie();var ag=500,YH=new Set(["eq","neq","in","contains","starts_with","gt","gte","lt","lte","between","exists"]),Sge=(e)=>{if(e==="@timestamp")return"timestamp";return e},cg=(e,t)=>{for(let n of t){let i=e[n];if(i===void 0||i===null)continue;if(typeof i==="string")return i;if(typeof i==="number"||typeof i==="boolean")return String(i)}return""},$ge=(e)=>{let t=cg(e,["@timestamp","timestamp","time","ts","date"]);if(!t)return st("(no time)");return Xn(t)},Tge=(e)=>{return cg(e,["body","message","log","text","content","msg"])||st("(no message)")},Age=(e)=>{return cg(e,["severity","level","log_level","priority"])},Cge=(e)=>{return cg(e,["service","service_name","serviceName","source"])},Lge=(e,t)=>{let n={};if(!t.omitSearch)n.search={query:e,mode:t.mode??"all",...t.searchFields?.length?{fields:t.searchFields}:{}};if(t.cursor!==void 0||t.limit!==void 0||t.all)n.pagination={limit:t.limit??(t.all?100:50),...t.cursor!==void 0?{cursor:t.cursor}:{}};if(t["sort-field"])n.sort={field:Sge(t["sort-field"]),direction:t["sort-direction"]??"desc"};if(t.select){let o=t.select.split(",").map((r)=>r.trim()).filter((r)=>r.length>0);if(o.length>0)n.select=o}let i=_ge(t);if(!i.ok)return{ok:!1,errors:i.errors};if(i.filters.length>0)n.filters=i.filters;return{ok:!0,input:n}};var Dge=(e)=>{if(e==="true")return!0;if(e==="false")return!1;let t=Number(e);if(e.trim()!==""&&Number.isFinite(t))return t;return e},zge=(e)=>{let t=Number(e);if(e.trim()!==""&&Number.isFinite(t))return t;return e},Nge=(e)=>{let t=e.indexOf("=");if(t<=0)return{ok:!1,error:"Filter must use <field>.<op>=<value>."};let n=e.slice(0,t),i=e.slice(t+1),o=n.lastIndexOf(".");if(o<=0||o===n.length-1)return{ok:!1,error:"Filter must use <field>.<op>=<value>."};let r=n.slice(0,o),a=n.slice(o+1);if(!YH.has(a))return{ok:!1,error:`Unsupported filter operator: ${a}. Valid operators: ${[...YH].join(", ")}.`};if(a==="in"){let s=i.split(",").map((h)=>zge(h.trim())).filter((h)=>h!=="");if(s.length===0)return{ok:!1,error:"in filters must include at least one value."};return{ok:!0,filter:{field:r,op:a,value:s}}}if(a==="between"){let s=i.includes("..")?i.split(".."):i.split(",");if(s.length!==2)return{ok:!1,error:"between filters must use <from>..<to>."};let[h,l]=s.map((u)=>u.trim());if(!h||!l)return{ok:!1,error:"between filters must use <from>..<to>."};return{ok:!0,filter:{field:r,op:a,value:{from:h,to:l}}}}if(a==="exists"){if(i!=="true"&&i!=="false")return{ok:!1,error:"exists filters must use true or false."};return{ok:!0,filter:{field:r,op:a,value:i==="true"}}}return{ok:!0,filter:{field:r,op:a,value:Dge(i)}}},_ge=(e)=>{let t=[],n=[],i=Cr({from:e.from,to:e.to,last:e.last,json:e.json});if(i.startDate&&i.endDate)t.push({field:"timestamp",op:"between",value:{from:i.startDate,to:i.endDate}});else if(i.startDate)t.push({field:"timestamp",op:"gte",value:i.startDate});else if(i.endDate)t.push({field:"timestamp",op:"lte",value:i.endDate});if(e.service)t.push({field:"service",op:"eq",value:e.service});if(e.severity)t.push({field:"severity",op:"eq",value:e.severity});if(e.env)t.push({field:"environment",op:"eq",value:e.env});if(e.traceId)t.push({field:"trace_id",op:"eq",value:e.traceId});for(let o of e.filters??[]){let r=Nge(o);if(r.ok)t.push(r.filter);else n.push(`${o}: ${r.error}`)}if(n.length>0)return{ok:!1,errors:n};return{ok:!0,filters:t}},XH=async(e,t)=>{let n=L({tokenFlag:t.token,projectIdFlag:t.project,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t["api-base-url"],jsonMode:t.json}),o=Lge(e,t);if(!o.ok){if(t.json)return p({success:!1,error:"Invalid log query filters",errors:o.errors});return m(`Invalid log query filters: ${o.errors.join("; ")}`)}let r=o.input,a=t.all?await jge(i,r,t):k(await i.logs.query(r),"Couldn't query logs (adjust the filters or time window and try again)",t.json);if(t.json){Q(a);return}Rge(a)},jge=async(e,t,n)=>{let i=[],o=t.pagination?.cursor,r=0;do{let a={...t,pagination:{limit:t.pagination?.limit??n.limit??100,...o?{cursor:o}:{}}},s=k(await e.logs.query(a),"Failed to query logs",n.json);i.push(...s.data),r+=s.meta.took,o=s.nextCursor}while(o);return{data:i,nextCursor:null,meta:{count:i.length,took:r}}},Rge=(e)=>{let{data:t,nextCursor:n,meta:i}=e;if(t.length===0){Io("No matching log rows. Widen the time window with --last or loosen filters.");return}ye(`Returned ${i.count} row${i.count===1?"":"s"} in ${i.took}ms`);let o=t.map((r)=>{let a=r,s=Age(a);return{time:$ge(a),severity:s?An(s,s):_e.muted(st("(sev)")),service:Cge(a)||st("(service)"),message:Qt(Tge(a),200)}});dn(o,[{header:"Time (UTC)",key:"time"},{header:"Severity",key:"severity"},{header:"Service",key:"service"},{header:"Message",key:"message"}],{header:{title:"Log query results",variant:"search",count:i.count}}),Cn({type:"cursor",nextCursor:n})};te();ce();ie();var Uge={backend:{label:"Backend",type:{kind:"custom",render:(e)=>{let t=e;return`${t.name} (${t.id})`},serialize:(e)=>e}},features:{label:"Features",type:{kind:"custom",render:(e)=>Array.isArray(e)?e.join(", "):"(none)",serialize:(e)=>e}},commands:{label:"Commands",type:{kind:"custom",render:(e)=>Array.isArray(e)?e.join(", "):"(none)",serialize:(e)=>e}},queryableFields:{label:"Queryable",type:{kind:"custom",render:(e)=>Array.isArray(e)?e.join(", "):"(none)",serialize:(e)=>e}},searchableFields:{label:"Searchable",type:{kind:"custom",render:(e)=>Array.isArray(e)?e.join(", "):"(none)",serialize:(e)=>e}},observedServiceNames:{label:"Observed Services",type:{kind:"custom",render:(e)=>Array.isArray(e)?e.join(", "):"(none)",serialize:(e)=>e}},observedAttributeKeys:{label:"Observed Attributes",type:{kind:"custom",render:(e)=>Array.isArray(e)?e.join(", "):"(none)",serialize:(e)=>e}},schemaContext:{label:"Schema Context",type:{kind:"custom",render:(e)=>e?JSON.stringify(e):"(none)",serialize:(e)=>e}}},Ege={layout:"field-list",schema:Uge,fields:["backend","features","commands","queryableFields","searchableFields","observedServiceNames","observedAttributeKeys","schemaContext"]},ZH=async(e)=>{let t=L({tokenFlag:e.token,projectIdFlag:e.project,jsonMode:e.json}),n=D({token:t.token,projectId:t.projectId,apiBaseUrlFlag:e["api-base-url"],jsonMode:e.json}),i=k(await n.logs.schema({}),"Couldn't fetch log schema (check the active project and try again)",e.json);if(e.json){H(Ege,i,{json:!0});return}Kge(i)},Kge=(e)=>{if(Ie("Log backend"),Se({Backend:`${e.backend.name} (${e.backend.id})`,Kind:e.backend.kind,Commands:e.commands.join(", "),Features:e.features.join(", ")||"(none)"}),Ie("Normalized fields"),Se({Queryable:e.queryableFields.join(", ")||"(none)",Searchable:e.searchableFields.join(", ")||"(none)"}),e.observedServiceNames.length>0)dn(e.observedServiceNames.map((t)=>({service:Qt(t,80)})),[{header:"Observed Services",key:"service"}]);if(e.observedAttributeKeys.length>0)dn(e.observedAttributeKeys.map((t)=>({attribute:Qt(t,80)})),[{header:"Observed Attributes",key:"attribute"}])};te();Nc();ce();ie();Zt();var FH=["ERROR","WARN","INFO","DEBUG","TRACE"],xge="3010",Gge=(e)=>{return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e},Bge=(e)=>{let t=Gge(e);return t==="localhost"||t==="127.0.0.1"||t==="::1"},Jge=(e)=>{let t=Xn(e.timestamp).split("T")[1]??e.timestamp,n=An(e.severity,e.severity.padEnd(7)),i=_e.cyan(e.service.padEnd(20)),o=e.body.length>120?`${e.body.substring(0,117)}...`:e.body;return`[${t}] ${n} ${i} ${o}`},VH=async(e)=>{let t=k(Jn(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)"),n=e.json??!1,i=Wge(t,e.apiBaseUrl),o=Hge(e.severities,n),r=LP(e.services),a=LP(e.environments),s=L({tokenFlag:e.token,jsonMode:n}),h=await Xge({apiBaseUrlFlag:e.apiBaseUrl,jsonMode:n,projectId:s.projectId,regionFlag:e.region,token:s.token}),l=Gn({token:s.token,projectId:s.projectId,baseUrl:i,tailBaseUrl:Yge(t,e.tailBaseUrl,h,i)}),u={severities:o,services:r,environments:a,searchTerm:e.search,traceId:e.traceId},d=new AbortController,y,b=0,w,v,O=()=>{y="interrupted",d.abort()};if(!n)qge({environments:a,region:h,search:e.search,services:r,severities:o,traceId:e.traceId});let A=k(await l.logs.tail({...s.projectId?{projectId:s.projectId}:{},...h?{region:h}:{},filters:u,signal:d.signal}),"Couldn't tail logs (check your network connection and try again)",n);if(!n)oe("Connected. Waiting for logs..."),ye("Press Ctrl+C to stop (auto-reconnects on disconnect)."),se();if(process.on("SIGINT",O),e.duration&&e.duration>0)v=setTimeout(()=>{y="duration",d.abort()},e.duration*1000);try{for await(let N of A){if(b+=1,n){Q(N);continue}Ln(Jge(N))}}catch(N){if(y==="interrupted"||y==="duration"||N instanceof Error&&N.name==="AbortError")w=void 0;else w=N instanceof Error?N:Error(String(N))}finally{if(process.removeListener("SIGINT",O),v)clearTimeout(v)}if(w){if(n)return p(w.message);se(),_r(),Ft(w.message);return}if(n)return;if(se(),y==="duration")ye("Duration reached, closing connection...");if(y==="interrupted")ye("Interrupted, closing connection...");_r(),ye(`Connection closed. Received ${jt(b,"log")}.`)},qge=(e)=>{if(Ie("Tailing logs"),e.severities?.length)ye(`Severities: ${e.severities.join(", ")}`);if(e.services?.length)ye(`Services: ${e.services.join(", ")}`);if(e.environments?.length)ye(`Environments: ${e.environments.join(", ")}`);if(e.search)ye(`Search: ${e.search}`);if(e.traceId)ye(`Trace ID: ${e.traceId}`);if(e.region)ye(`Region: ${e.region}`);_r(),se()},LP=(e)=>{if(!e)return;let t=e.split(",").map((n)=>n.trim()).filter((n)=>n.length>0);return t.length>0?t:void 0},Hge=(e,t)=>{let n=LP(e)?.map((r)=>r.toUpperCase());if(!n)return;let i=n.find((r)=>!FH.includes(r));if(!i)return n;let o=`Invalid severity: ${i}. Valid values: ${FH.join(", ")}.`;if(t)return p(o);return m(o)},Wge=(e,t)=>{return Pn({cliFlag:t,globalUrl:e.apiBaseUrl,globalDomain:e.apiDomain,buildUrlFromDomain:(n)=>`https://api.${n}`,defaultUrl:"https://api.sazabi.com"})},Mge=(e)=>{let t=(()=>{try{return new URL(e)}catch{return null}})();if(!t)return;if(!Bge(t.hostname))return;return t.protocol="http:",t.port=xge,t.pathname="/v1/tail",t.search="",t.hash="",t.toString()},Yge=(e,t,n,i)=>{if(t)return QH(t);if(e.tailBaseUrl)return QH(e.tailBaseUrl);let o=Mge(i);if(o)return o;if(e.tailDomain&&n)return`https://${n}.tail.${e.tailDomain}/v1/tail`;if(n){try{let r=new URL(i).hostname;if(r.endsWith(".sazabi.dev")){let a=r.includes(".staging.")?"staging.sazabi.dev":"development.sazabi.dev";return`https://${n}.tail.${a}/v1/tail`}}catch{}return`https://${n}.tail.sazabi.com/v1/tail`}return},QH=(e)=>{let t=e.replace(/^wss:/i,"https:").replace(/^ws:/i,"http:"),n=(()=>{try{return new URL(t)}catch{return null}})();if(!n)return t;return n.pathname="/v1/tail",n.search="",n.hash="",n.toString()},Xge=async(e)=>{if(e.regionFlag){if(!/^[a-z]+-[a-z]+-\d+$/.test(e.regionFlag))Ft(`Invalid region format: "${e.regionFlag}". Expected format: us-west-2.`),process.exit(1);return e.regionFlag}if(!e.projectId)return;return(await ng({token:e.token,projectId:e.projectId,apiBaseUrlFlag:e.apiBaseUrlFlag,jsonMode:e.jsonMode})).region};te();ce();ie();var Zge={total:{label:"Total",type:{kind:"number"}},startDate:{label:"Start",type:{kind:"date"}},endDate:{label:"End",type:{kind:"date"}},interval:{label:"Interval",type:{kind:"string"}},series:{label:"Series",type:{kind:"custom",render:(e)=>`${Array.isArray(e)?e.length:0} series`,serialize:(e)=>e}}},Fge={layout:"field-list",schema:Zge,fields:["total","startDate","endDate","interval","series"]},Qge={group:{label:"Group",type:{kind:"string"}},total:{label:"Total",type:{kind:"number"},align:"right"},points:{label:"Points",type:{kind:"custom",render:(e)=>Array.isArray(e)?String(e.length):"0",serialize:(e)=>e},align:"right"}},Vge={schema:Qge,columns:["group","total","points"],header:{title:"Log volume",variant:"results"},emptyMessage:"No log volume found."},ede=(e)=>{if(e==="service")return"service_name";if(e==="severity")return"severity_text";return e},tde=(e)=>{let t=new Date,n=Cr(e),i=n.endDate??t.toISOString();return{startDate:n.startDate??new Date(new Date(i).getTime()-3600000).toISOString(),endDate:i,...e.interval?{interval:e.interval}:{},...e.groupBy?{groupBy:ede(e.groupBy)}:{},filters:{...e.service?{service_name:e.service}:{},...e.severity?{severity_text:e.severity}:{},...e.env?{environment:e.env}:{}}}},eW=async(e)=>{let t=L({tokenFlag:e.token,projectIdFlag:e.project,jsonMode:e.json}),n=D({token:t.token,projectId:t.projectId,apiBaseUrlFlag:e["api-base-url"],jsonMode:e.json}),i=k(await n.logs.volume(tde(e)),"Failed to query log volume",e.json);if(e.json){H(Fge,i,{json:!0});return}nde(i)},nde=(e)=>{if(e.series.length>0)ye(`Total ${e.total} logs from ${e.startDate} to ${e.endDate} at ${e.interval}`);X(Vge,e.series,{count:e.series.length})};var DP=(e,t)=>{let n=[],i=`--${t}=`;for(let o=0;o<e.length;o+=1){let r=e[o];if(r===void 0)continue;if(r===`--${t}`){let a=e[o+1];if(a!==void 0&&!a.startsWith("-"))n.push(a),o+=1;continue}if(r.startsWith(i))n.push(r.slice(i.length))}return n},tW=ne("logs","Stream, search, and forward logs").withSubcommands({schema:P("schema","Describe the active log backend and query fields",async(e)=>{let{values:t}=S(e,{...B,project:{type:"string"}}),n={token:t.token,project:t.project,json:t.json,"api-base-url":t["api-base-url"]};await ZH(n)}).withOptions({...J,project:{type:"string",description:"Override project ID (default: active project)"}}).withExamples(["sazabi logs schema # Show backend, commands, and fields","sazabi logs schema --json # Machine-readable schema context"]).build(),tail:P("tail","Stream logs from the active project in real time",async(e)=>{let{values:t}=S(e,{...B,severities:{type:"string"},services:{type:"string"},environments:{type:"string"},search:{type:"string"},"trace-id":{type:"string"},duration:{type:"string"},"tail-base-url":{type:"string"},region:{type:"string"}}),n={};if(t.token)n.token=t.token;if(t.severities)n.severities=t.severities;if(t.services)n.services=t.services;if(t.environments)n.environments=t.environments;if(t.search)n.search=t.search;if(t["trace-id"])n.traceId=t["trace-id"];if(t.duration)n.duration=ht(t.duration,1,Number.MAX_SAFE_INTEGER,"Duration",t.json);if(t.json)n.json=!0;if(t["tail-base-url"])n.tailBaseUrl=t["tail-base-url"];if(t.region)n.region=t.region;if(t["api-base-url"])n.apiBaseUrl=t["api-base-url"];await VH(n)}).withOptions({...J,severities:{type:"string",description:"Filter by comma-separated severities (e.g., ERROR,WARN,INFO)"},services:{type:"string",description:"Filter by comma-separated service names"},environments:{type:"string",description:"Filter by comma-separated environments"},search:{type:"string",description:"Filter by search term (case-insensitive)"},"trace-id":{type:"string",description:"Filter by trace ID"},duration:{type:"string",description:"Duration to tail in seconds (default: unlimited)"},"tail-base-url":{type:"string",description:"Override tail SSE base URL"},region:{type:"string",description:"Override project region"}}).withExamples(["sazabi logs tail # Tail all logs in real time","sazabi logs tail --severities ERROR,WARN # Tail only errors and warnings","sazabi logs tail --services api,worker # Tail specific services","sazabi logs tail --environments production,staging # Tail specific environments",'sazabi logs tail --search "database" # Tail logs matching search term',"sazabi logs tail --json # Output as JSON"]).build(),query:P("query","Search stored logs in the current project (POST /logs/query)",async(e)=>{let{values:t,positionals:n}=S(e,{...B,project:{type:"string"},limit:{type:"string"},cursor:{type:"string"},mode:{type:"string"},"sort-field":{type:"string"},"sort-direction":{type:"string"},select:{type:"string"},from:{type:"string"},to:{type:"string"},last:{type:"string"},service:{type:"string"},severity:{type:"string"},env:{type:"string"},"trace-id":{type:"string"},filter:{type:"string"},"search-field":{type:"string"},"query-all":{type:"boolean"},all:{type:"boolean"}},{allowPositionals:!0}),i=n.join(" ").trim(),o=DP(e,"filter"),r=DP(e,"search-field"),a=Boolean(t.from||t.to||t.last||t.service||t.severity||t.env||t["trace-id"])||o.length>0;if(!i&&!t["query-all"]&&!a){if(t.json)return p("Search text, a structured filter, or --query-all is required. Usage: sazabi logs query <search-text> [options]");return m("Search text, a structured filter, or --query-all is required. Usage: sazabi logs query <search-text> [options]")}if(i.length>ag){if(t.json)return p(`Search text must be at most ${ag} characters.`);return m(`Search text must be at most ${ag} characters.`)}if(i&&t["query-all"]){if(t.json)return p("Pass either a search phrase or --query-all, not both.");return m("Pass either a search phrase or --query-all, not both.")}if(t.mode&&!i){if(t.json)return p("--mode requires search text (search is omitted).");return m("--mode requires search text (search is omitted).")}let s={token:t.token,project:t.project,json:t.json,"api-base-url":t["api-base-url"],omitSearch:t["query-all"]===!0||!i,from:t.from,to:t.to,last:t.last,service:t.service,severity:t.severity,env:t.env,traceId:t["trace-id"],filters:o,searchFields:r,all:t.all};if(t.limit)s.limit=ht(t.limit,1,1000,"Limit",t.json);if(t.cursor)s.cursor=t.cursor;if(t.mode)s.mode=Tt(t.mode,["any","all","phrase"],"Mode",t.json);if(t["sort-field"])s["sort-field"]=t["sort-field"];if(t["sort-direction"]&&!t["sort-field"]){if(t.json)return p("--sort-direction requires --sort-field.");return m("--sort-direction requires --sort-field.")}if(t["sort-direction"])s["sort-direction"]=Tt(t["sort-direction"],["asc","desc"],"Sort direction",t.json);if(t.select)s.select=t.select;await XH(i,s)}).withPositionalArgs("[search-text]").withOptions({...J,project:{type:"string",description:"Override project ID (default: active project)"},limit:{type:"string",description:"Max rows to return (1-1000, default: 50)"},cursor:{type:"string",description:"Pagination cursor from a previous response"},mode:{type:"string",description:"Token match mode: any, all, or phrase (default: all)"},"sort-field":{type:"string",description:"Field to sort by (e.g. @timestamp)"},"sort-direction":{type:"string",description:"Sort direction: asc or desc (default: desc)"},select:{type:"string",description:"Comma-separated fields to return"},from:{type:"string",description:"Start time as ISO-8601 timestamp"},to:{type:"string",description:"End time as ISO-8601 timestamp"},last:{type:"string",description:"Relative time window, for example 30m, 6h, or 7d"},service:{type:"string",description:"Filter by service name"},severity:{type:"string",description:"Filter by severity, for example ERROR"},env:{type:"string",description:"Filter by deployment environment"},"trace-id":{type:"string",description:"Filter by trace ID"},filter:{type:"string",description:"Structured filter as <field>.<op>=<value>; repeatable"},"search-field":{type:"string",description:"Restrict full-text search to a field; repeatable"},"query-all":{type:"boolean",description:"Omit full-text search and return the API default slice (sort/pagination only; server may require other filters)"},all:{type:"boolean",description:"Fetch all pages until the server returns no cursor"}}).withExamples(['sazabi logs query "connection refused" --last 1h --service api --severity ERROR # Search recent API errors',"sazabi logs query --trace-id abc123 --select timestamp,service,severity,body # Find logs for one trace","sazabi logs query --filter http_status_code.gte=500 --limit 100 --json # Machine-readable structured filter","sazabi logs query error --mode any --limit 100 # Match any token with a larger page","sazabi logs query --query-all --limit 20 --sort-field @timestamp # Recent rows without full-text search","sazabi logs query slow --json # Machine-readable output"]).build(),patterns:P("patterns","Search normalized log patterns for discovery",async(e)=>{let{values:t,positionals:n}=S(e,{...B,project:{type:"string"},severity:{type:"string"},from:{type:"string"},to:{type:"string"},last:{type:"string"},limit:{type:"string"}},{allowPositionals:!0}),i={token:t.token,project:t.project,query:n.join(" ").trim()||void 0,severity:t.severity,from:t.from,to:t.to,last:t.last,json:t.json,"api-base-url":t["api-base-url"]};if(t.limit)i.limit=ht(t.limit,1,100,"Limit",t.json);await MH(i)}).withPositionalArgs("[pattern-text]").withOptions({...J,project:{type:"string",description:"Override project ID (default: active project)"},severity:{type:"string",description:"Filter by severity, for example ERROR"},from:{type:"string",description:"Start time as ISO-8601 timestamp"},to:{type:"string",description:"End time as ISO-8601 timestamp"},last:{type:"string",description:"Relative time window, for example 30m, 6h, or 7d"},limit:{type:"string",description:"Max patterns to return (1-100, default: 25)"}}).withExamples(['sazabi logs patterns "connection refused" --severity ERROR --limit 25 # Find recurring error patterns',"sazabi logs patterns --last 24h --json # Export recent patterns"]).build(),volume:P("volume","Summarize log volume by time and optional dimension",async(e)=>{let{values:t}=S(e,{...B,project:{type:"string"},from:{type:"string"},to:{type:"string"},last:{type:"string"},interval:{type:"string"},"group-by":{type:"string"},service:{type:"string"},severity:{type:"string"},env:{type:"string"}}),n={token:t.token,project:t.project,from:t.from,to:t.to,last:t.last,service:t.service,severity:t.severity,env:t.env,json:t.json,"api-base-url":t["api-base-url"]};if(t.interval)n.interval=Tt(t.interval,["1m","5m","15m","1h"],"Interval",t.json);if(t["group-by"])n.groupBy=Tt(t["group-by"],["service","severity","environment"],"Group by",t.json);await eW(n)}).withOptions({...J,project:{type:"string",description:"Override project ID (default: active project)"},from:{type:"string",description:"Start time as ISO-8601 timestamp"},to:{type:"string",description:"End time as ISO-8601 timestamp"},last:{type:"string",description:"Relative time window, for example 30m, 6h, or 7d"},interval:{type:"string",description:"Bucket interval: 1m, 5m, 15m, or 1h"},"group-by":{type:"string",description:"Group by service, severity, or environment"},service:{type:"string",description:"Filter by service name"},severity:{type:"string",description:"Filter by severity, for example ERROR"},env:{type:"string",description:"Filter by deployment environment"}}).withExamples(["sazabi logs volume --last 6h --group-by service # Compare service log volume","sazabi logs volume --last 24h --severity ERROR --interval 15m --json # Export error volume"]).build(),"native-query":P("native-query","Run a backend-native read-only log query",async(e)=>{let{values:t}=S(e,{...B,project:{type:"string"},query:{type:"string"},file:{type:"string",short:"f"}}),n={token:t.token,project:t.project,query:t.query,file:t.file,json:t.json,"api-base-url":t["api-base-url"]};await HH(n)}).withOptions({...J,project:{type:"string",description:"Override project ID (default: active project)"},query:{type:"string",description:"Backend-native query text"},file:{type:"string",short:"f",description:"Read backend-native query text from a file"}}).withExamples(['sazabi logs native-query --query "SELECT service_name, count() FROM log_volume_per_minute GROUP BY service_name LIMIT 20" # Run backend-native query text',"sazabi logs native-query --file investigation.sql --json # Run a query from a file"]).build(),forward:P("forward","Forward plaintext logs to the active project",async(e)=>{let{values:t}=S(e,{...B,file:{type:"string",short:"f"},follow:{type:"boolean"},"batch-size":{type:"string"},"intake-base-url":{type:"string"},"public-key":{type:"string"},service:{type:"string"},attribute:{type:"string"},region:{type:"string"}}),n={};if(t.token)n.token=t.token;if(t.file)n.file=t.file;if(t.follow)n.follow=t.follow;if(t["batch-size"])n.batchSize=ht(t["batch-size"],1,Number.MAX_SAFE_INTEGER,"Batch size",t.json);if(t["api-base-url"])n.apiBaseUrl=t["api-base-url"];if(t["intake-base-url"])n.intakeBaseUrl=t["intake-base-url"];if(t.region)n.region=t.region;if(t["public-key"])n.publicKey=t["public-key"];if(t.service)n.service=t.service;let i=DP(e,"attribute");if(i.length>0)n.attributes=i;await qH({...n,json:t.json})}).withOptions({...J,json:{type:"boolean",description:"Output a final JSON summary"},file:{type:"string",short:"f",description:"Read from file instead of stdin"},follow:{type:"boolean",description:"Follow file for new lines (like tail -f)"},"batch-size":{type:"string",description:"Number of logs to batch before sending (default: 100)"},"intake-base-url":{type:"string",description:"Override intake base URL"},"public-key":{type:"string",description:"Use this public key value (skip creating/storing)"},service:{type:"string",description:"Set OTLP service.name for forwarded lines (default: sazabi-cli)"},attribute:{type:"string",description:"Attach a log attribute as key=value. Repeat for multiple attributes."},region:{type:"string",description:"Override project region"}}).withExamples(['echo "Log message" | sazabi logs forward # Forward from stdin',"sazabi logs forward --file app.log # Forward from file","sazabi logs forward --file app.log --follow # Forward file with tail -f behavior","sazabi logs forward --file app.log --batch-size 50 # Forward with custom batch size"]).build()}).withExamples(["sazabi logs tail # Tail all logs in real time","sazabi logs tail --severities ERROR,WARN # Tail only errors and warnings",'sazabi logs query "timeout" # Search stored logs',"sazabi logs forward --file app.log # Forward from file"]).build();te();ce();ie();var nW={connectionId:{label:"ID",type:{kind:"string"}},connectionKey:{label:"Key",type:{kind:"string"}},url:{label:"URL",type:{kind:"string"}},providerId:{label:"Provider",type:{kind:"string"}},displayName:{label:"Name",type:{kind:"string"}},source:{label:"Source",type:{kind:"string"}},installStatus:{label:"Status",type:{kind:"string"}},authMode:{label:"Auth",type:{kind:"string"}},transport:{label:"Transport",type:{kind:"string"}},serverUrl:{label:"Server URL",type:{kind:"string"}},readOnly:{label:"Read-only",type:{kind:"boolean"}},enabledToolCount:{label:"Enabled tools",type:{kind:"number"}},connectedAt:{label:"Connected",type:{kind:"nullable-date"}},createdAt:{label:"Created",type:{kind:"date"}},updatedAt:{label:"Updated",type:{kind:"date"}}},ode={schema:nW,columns:["connectionId","providerId","displayName","installStatus","enabledToolCount","url"],header:"MCP connectors",emptyMessage:"No MCP connectors configured. Add one in Settings > MCP connectors in the dashboard."},oW={layout:"field-list",schema:nW,fields:["connectionId","connectionKey","providerId","displayName","source","installStatus","authMode","transport","serverUrl","url","readOnly","enabledToolCount","connectedAt","createdAt","updatedAt"],title:"MCP connector"},ide={name:{label:"Name",type:{kind:"string"}},title:{label:"Title",type:{kind:"string"}},description:{label:"Description",type:{kind:"string"}},isReadOnly:{label:"Read-only",type:{kind:"boolean"}},enabled:{label:"Enabled",type:{kind:"boolean"}}},rde={schema:ide,columns:["name","title","isReadOnly","enabled"],header:"Tools",emptyMessage:"No tools discovered for this connector."},ade={providerId:{label:"Provider",type:{kind:"string"}},label:{label:"Name",type:{kind:"string"}},authMode:{label:"Auth",type:{kind:"string"}},availability:{label:"Availability",type:{kind:"string"}},hasSetupSkill:{label:"Setup skill",type:{kind:"boolean"}}},cde={schema:ade,columns:["providerId","label","authMode","availability","hasSetupSkill"],header:"MCP connector providers",emptyMessage:"No MCP connector providers found."},sde={providerId:{label:"Provider",type:{kind:"string"}},setupSkill:{label:"Setup skill",type:{kind:"string"}}},hde={layout:"field-list",schema:sde,fields:["providerId","setupSkill"],title:"MCP connector setup skill"},Rc=(e)=>{let t=e.json,n=L({tokenFlag:e.token,jsonMode:t});return{client:D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:e["api-base-url"],jsonMode:t}),json:t,projectId:n.projectId}},zP=(e,t)=>({...e,url:tH(t,e.connectionId)}),lde=async(e)=>{let{values:t}=S(e,{...B,"project-id":{type:"string"},"connected-only":{type:"boolean"}}),{client:n,json:i,projectId:o}=Rc(t),{connectors:r}=k(await n.mcpConnectors.list({projectId:t["project-id"],connectedOnly:t["connected-only"]}),"Couldn't list MCP connectors (check the active project and try again)",i),a=Sn(t["project-id"]??o,i);X(ode,r.map((s)=>zP(s,a)),{json:i})},ude=async(e)=>{let{values:t,positionals:n}=S(e,{...B,"project-id":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Connection ID is required.");return m("Connection ID is required.")}let{client:o,json:r,projectId:a}=Rc(t),{connector:s}=k(await o.mcpConnectors.get({connectionId:i,projectId:t["project-id"]}),"Couldn't get MCP connector (run 'sazabi mcp-connectors list' to see connection IDs)",r),h=Sn(t["project-id"]??a,r);H(oW,zP(s,h),{json:r})},gde=async(e)=>{let{values:t,positionals:n}=S(e,{...B,"project-id":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Connection ID is required.");return m("Connection ID is required.")}let{client:o,json:r,projectId:a}=Rc(t),{connector:s,tools:h}=k(await o.mcpConnectors.details({connectionId:i,projectId:t["project-id"]}),"Couldn't inspect MCP connector (run 'sazabi mcp-connectors list' to see connection IDs)",r),l=Sn(t["project-id"]??a,r),u=zP(s,l);if(r){Q({connector:u,tools:h});return}H(oW,u,{json:r}),X(rde,h,{json:r})},dde=async(e)=>{let{values:t}=S(e,{...B}),{client:n,json:i}=Rc(t),{providers:o}=k(await n.mcpConnectors.listProviders(),"Couldn't list MCP connector providers (try again)",i),r=o.map((a)=>({providerId:a.providerId,label:a.label,authMode:a.authMode,availability:a.availability,hasSetupSkill:Boolean(a.setupSkill)}));X(cde,r,{json:i})},yde=async(e)=>{let{values:t}=S(e,{...B,"provider-id":{type:"string"}});if(!t["provider-id"]){if(t.json)return p("--provider-id is required.");return m("--provider-id is required. Use 'sazabi mcp-connectors providers' to see valid provider IDs.")}let{client:n,json:i}=Rc(t),{providers:o}=k(await n.mcpConnectors.listProviders(),"Couldn't list MCP connector providers (try again)",i),r=o.find((a)=>a.providerId===t["provider-id"]);if(!r){let a=`Unknown MCP connector provider: '${t["provider-id"]}'. Run 'sazabi mcp-connectors providers' to see valid provider IDs.`;if(i)return p(a);return m(a)}if(!r.setupSkill){if(i)return p(`No setup skill available for ${t["provider-id"]}.`);return m(`No setup skill available for ${t["provider-id"]}. This MCP connector does not have an agent-ready skill yet.`)}H(hde,{providerId:t["provider-id"],setupSkill:r.setupSkill},{json:i})},iW=ne("mcp-connectors","Inspect MCP connectors").withSubcommands({list:P("list","List configured MCP connectors",lde).withOptions({...J,"project-id":{type:"string",description:"Project ID"},"connected-only":{type:"boolean",description:"Only show connected connectors"}}).withExamples(["sazabi mcp-connectors list # List all connectors","sazabi mcp-connectors list --connected-only # Only connected ones","sazabi mcp-connectors list --json # Output as JSON"]).build(),get:P("get","Get one MCP connector",ude).withPositionalArgs("<connection-id>").withOptions({...J,"project-id":{type:"string",description:"Project ID"}}).withExamples(["sazabi mcp-connectors get <id> # Show connector details"]).build(),details:P("details","Inspect one connector's tool surface",gde).withPositionalArgs("<connection-id>").withOptions({...J,"project-id":{type:"string",description:"Project ID"}}).withExamples(["sazabi mcp-connectors details <id> # Show enabled tools","sazabi mcp-connectors details <id> --json # Output as JSON"]).build(),providers:P("providers","List all supported MCP connector providers",dde).withOptions({...J}).withExamples(["sazabi mcp-connectors providers # List all providers","sazabi mcp-connectors providers --json # Output as JSON"]).build(),skill:P("skill","Show setup skill for an MCP connector provider",yde).withOptions({...J,"provider-id":{type:"string",description:"MCP connector provider ID (e.g. linear, supabase)"}}).withExamples(["sazabi mcp-connectors skill --provider-id linear # Show Linear setup skill","sazabi mcp-connectors skill --provider-id posthog # Show PostHog setup skill","sazabi mcp-connectors skill --provider-id x --json # Output as JSON"]).build()}).withExamples(["sazabi mcp-connectors list # List configured MCP connectors","sazabi mcp-connectors get <id> # Inspect one connector","sazabi mcp-connectors details <id> # Inspect a connector's tool surface","sazabi mcp-connectors providers # List all MCP connector providers","sazabi mcp-connectors skill --provider-id linear # Show setup skill"]).build();te();ce();ie();var rW={membershipId:{label:"Membership ID",type:{kind:"string"}},userId:{label:"User ID",type:{kind:"string"}},name:{label:"Name",type:{kind:"nullable-string"}},email:{label:"Email",type:{kind:"string"}},role:{label:"Role",type:{kind:"string"}}},bde={schema:rW,columns:["membershipId","userId","name","email","role"],header:"Members",emptyMessage:"No members found."},pde={layout:"field-list",schema:rW,fields:["membershipId","userId","name","email","role"]},mde=async(e)=>{let t=L({tokenFlag:e.token,organizationIdFlag:e.organizationId,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),i=k(await n.members.list({organizationId:t.organizationId}),"Couldn't list members (check the active organization and try again)",e.json);X(bde,i.members,{json:e.json})},wde=async(e,t)=>{let n=L({tokenFlag:t.token,organizationIdFlag:t.organizationId,jsonMode:t.json}),i=D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),o=k(await i.members.updateRole(e,t.role,n.organizationId),"Failed to update member role",t.json);H(pde,o.member,{json:t.json})},vde=async(e,t)=>{let n=L({tokenFlag:t.token,organizationIdFlag:t.organizationId,jsonMode:t.json}),i=D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),o=k(await i.members.remove(e,n.organizationId),"Failed to remove member",t.json);if(t.json){Q(o);return}oe(`Member ${o.removedUserId} removed from the active organization.`)},aW=ne("members","Manage organization members").withSubcommands({list:P("list","List members in the active organization",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},"organization-id":{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0});if(n.length>0){let i=n.join(", ");if(t.json)return p(`Unexpected arguments: ${i}. Run 'sazabi members -h' for usage.`);return m(`Unexpected arguments: ${i}. Run 'sazabi members -h' for usage.`)}await mde({token:t.token,organizationId:t["organization-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},"organization-id":{type:"string",description:"Override organization selection"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi members list # List members in the active organization"]).build(),"update-role":P("update-role","Update one member's organization role",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},"organization-id":{type:"string"},role:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("User ID is required.");return m("User ID is required.")}if(t.role!=="admin"&&t.role!=="member"){if(t.json)return p("Role must be either 'admin' or 'member'.");return m("Role must be either 'admin' or 'member'.")}await wde(i,{token:t.token,organizationId:t["organization-id"],role:t.role,json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},"organization-id":{type:"string",description:"Override organization selection"},role:{type:"string",description:"New role: admin or member"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi members update-role user_123 --role admin # Promote a member to admin"]).build(),remove:P("remove","Remove one member from the active organization",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},"organization-id":{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("User ID is required.");return m("User ID is required.")}await vde(i,{token:t.token,organizationId:t["organization-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},"organization-id":{type:"string",description:"Override organization selection"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi members remove user_123 # Remove a member from the active organization"]).build()}).withExamples(["sazabi members list # List members in the active organization","sazabi members update-role user_123 --role admin # Promote a member to admin","sazabi members remove user_123 # Remove a member from the active organization"]).build();te();ce();ie();te();ce();ie();ie();var fde=2000,sg=async(e)=>{let t=e.pollIntervalMs??fde,n=Date.now(),i=!1,o={completed:!1,threadId:e.threadId,runId:e.runId,status:"processing",response:null};while(!0){let r=await e.client.runs.get(e.runId);if(!r.success){if(!Ide(r))return NP(e.printProgress,i),r}else if(o=r.value,r.value.completed)return NP(e.printProgress,i),r;if(e.timeoutMs!==void 0&&Date.now()-n>=e.timeoutMs)return NP(e.printProgress,i),rt(o);i=kde(e.printProgress,i),await jc(t)}},kde=(e,t)=>{if(!e)return t;if(!t)process.stdout.write(`
|
|
8603
8603
|
`);return process.stdout.write("."),!0},NP=(e,t)=>{if(!e||!t)return;process.stdout.write(`
|
|
8604
8604
|
`)},Ide=(e)=>{return e.statusCode===404};var Ode={threadId:{label:"Thread ID",type:{kind:"id"}},messageId:{label:"Message ID",type:{kind:"nullable-string",emptyLabel:"(pending)"}},url:{label:"URL",type:{kind:"nullable-string"},get:(e)=>e.threadUrl??null},runId:{label:"Run ID",type:{kind:"id"}},status:{label:"Status",type:{kind:"string"}},pollWith:{label:"Poll with",type:{kind:"string"},get:(e)=>`sazabi runs get ${e.runId}`},response:{label:"Response",type:{kind:"nullable-string"},get:(e)=>e.response}},Pde={layout:"sections",schema:Ode,primary:{title:"Thread",fields:["threadId","messageId","url","runId","status","pollWith"]},secondary:[{title:"Response",field:"response"}]},Sde=()=>{return process.env.SAZABI_AUTOMATION_ID??process.env.SAZABI_SCRIPT_PARAM_AUTOMATION_ID},$de=()=>process.env.SAZABI_AMBIENT_SERVICE_RUN==="true"?!0:void 0,sW=async(e,t={})=>{let n=Date.now(),i=L({tokenFlag:t.token,jsonMode:t.json}),o=D({token:i.token,projectId:i.projectId,apiBaseUrlFlag:t.apiBaseUrl}),r=await Tde({message:e,threadId:t.threadId,projectId:i.projectId,json:t.json,client:o,wait:t.wait,timeoutMs:t.timeout,automationId:Sde(),ambientServiceRun:$de()});if(t.wait&&r.status==="processing"){let a=t.timeout===void 0?void 0:Math.max(0,t.timeout-(Date.now()-n)),s=k(await sg({client:o,runId:r.runId,threadId:r.threadId,timeoutMs:a,printProgress:!t.json}),`Couldn't get run (poll again with 'sazabi runs get ${r.runId}')`,t.json);r={...r,status:s.status,response:s.response,messageId:r.messageId??s.messageId}}H(Pde,r,{json:t.json})},Tde=async(e)=>{if(e.threadId){let n=k(await e.client.messages.append(e.threadId,e.message,e.wait??!1,cW(e.timeoutMs),e.automationId,e.ambientServiceRun),"Failed to send message",e.json);return{threadId:e.threadId,runId:n.result.runId,messageId:n.result.messageId,status:n.result.status,response:n.result.response,threadUrl:e.projectId?Xe(e.projectId,e.threadId,void 0,n.result.messageId):void 0}}let t=k(await e.client.threads.create({message:e.message,...e.projectId?{projectId:e.projectId}:{},wait:e.wait??!1,timeoutSeconds:cW(e.timeoutMs),...e.automationId!==void 0?{automationId:e.automationId}:{},...e.ambientServiceRun?{ambientServiceRun:!0}:{}}),"Failed to create thread",e.json);return{threadId:t.result.threadId,runId:t.result.runId,messageId:t.result.messageId,status:t.result.status,response:t.result.response,threadUrl:e.projectId?Xe(e.projectId,t.result.threadId,void 0,t.result.messageId):void 0}},cW=(e)=>{if(e===void 0)return 20;return Math.max(1,Math.min(Math.ceil(e/1000),20))};var Ade={id:{label:"ID",type:{kind:"string"}},role:{label:"Role",type:{kind:"role"}},content:{label:"Content",type:{kind:"custom",render:(e)=>{let n=e.find((i)=>i.type==="message"&&Boolean(i.message));return n?Qt(n.message):st("(no text)")}}},createdAt:{label:"Created",type:{kind:"date"}}},Cde={schema:Ade,columns:["id","role","content","createdAt"],header:"Messages",emptyMessage:"No messages found."},Lde={id:{label:"ID",type:{kind:"string"}},threadTitle:{label:"Thread",type:{kind:"nullable-string",emptyLabel:"(no title)"}},role:{label:"Role",type:{kind:"role"}},content:{label:"Content",type:{kind:"custom",render:(e)=>Qt(e)}},score:{label:"Score",align:"right",type:{kind:"custom",render:(e)=>e!=null?e.toFixed(2):"-"}}},Dde={schema:Lde,columns:["id","threadTitle","role","content","score"],header:{title:"Search results",variant:"search"},emptyMessage:"No matching messages found."},zde=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),{messages:o,nextCursor:r}=k(await i.messages.list(e,{limit:t.limit,cursor:t.cursor}),"Couldn't list messages (check the thread ID and try again)",t.json);X(Cde,o,{json:t.json,nextCursor:r})},Nde=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),{messages:o,pagination:r}=k(await i.search.messages({query:e,limit:t.limit,page:t.page,threadId:t.threadId,role:t.role}),"Couldn't search messages (check the active project and try again)",t.json);if(t.json){Q({messages:o,pagination:r});return}X(Dde,o,{count:r.totalResults}),Cn({type:"page",page:r.page,totalPages:r.totalPages})},hW=ne("messages","Send, list, and search messages").withSubcommands({send:P("send","Send a message (creates new thread if --thread-id omitted)",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},"thread-id":{type:"string",short:"t"},wait:{type:"boolean"},timeout:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n.join(" ");if(!i){if(t.json)return p("Message is required. Usage: sazabi messages send <message> [--thread-id <id>]");return m("Message is required. Usage: sazabi messages send <message> [--thread-id <id>]")}let o=t.timeout?ht(t.timeout,1,3600,"Timeout",t.json)*1000:void 0,r={token:t.token,threadId:t["thread-id"],wait:t.wait,timeout:o,json:t.json,apiBaseUrl:t["api-base-url"]};await sW(i,r)}).withPositionalArgs("<message>").withOptions({token:{type:"string",description:"Override token"},"thread-id":{type:"string",short:"t",description:"Thread ID to append to (creates new thread if omitted)"},wait:{type:"boolean",description:"Wait for assistant response and print it"},timeout:{type:"string",description:"Timeout in seconds to wait for response before returning processing state"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi messages send 'Hello' # Start a new thread","sazabi messages send 'Hello' --thread-id abc123 # Append to existing thread","sazabi messages send 'Hello' -t abc123 --wait # Append and wait for reply","sazabi messages send 'Hello' --wait # New thread, wait for reply","sazabi messages send 'Hello' --wait --timeout 120 # Wait up to 2 minutes"]).build(),list:P("list","List messages in a thread",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},limit:{type:"string"},cursor:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Thread ID is required. Usage: sazabi messages list <thread-id>");return m("Thread ID is required. Usage: sazabi messages list <thread-id>")}if(n.length>1){let r=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${r}. Run 'sazabi messages -h' for usage.`);return m(`Unexpected arguments: ${r}. Run 'sazabi messages -h' for usage.`)}let o={token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]};if(t.limit)o.limit=ht(t.limit,1,100,"Limit",t.json);if(t.cursor)o.cursor=t.cursor;await zde(i,o)}).withPositionalArgs("<thread-id>").withOptions({token:{type:"string",description:"Override token"},limit:{type:"string",description:"Maximum number of messages to return (default: 50, max: 100)"},cursor:{type:"string",description:"Pagination cursor from previous response"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi messages list <thread-id> # List all messages in thread","sazabi messages list <thread-id> --limit 20 # List with custom limit","sazabi messages list <thread-id> --cursor xyz # List next page"]).build(),search:P("search","Search messages in the active project",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},limit:{type:"string"},page:{type:"string"},"thread-id":{type:"string"},role:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n.join(" ");if(!i){if(t.json)return p("Search query is required. Usage: sazabi messages search <query>");return m("Search query is required. Usage: sazabi messages search <query>")}let o={token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]};if(t.limit)o.limit=ht(t.limit,1,100,"Limit",t.json);if(t.page)o.page=ht(t.page,1,Number.MAX_SAFE_INTEGER,"Page",t.json);if(t["thread-id"])o.threadId=t["thread-id"];if(t.role)o.role=Tt(t.role,["user","assistant"],"Role",t.json);await Nde(i,o)}).withPositionalArgs("<query>").withOptions({token:{type:"string",description:"Override token"},limit:{type:"string",description:"Maximum number of results (default: 20, max: 100)"},page:{type:"string",description:"Page number for pagination (default: 1)"},"thread-id":{type:"string",description:"Filter messages by thread ID"},role:{type:"string",description:"Filter by role: user or assistant"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(['sazabi messages search "error handling" # Search messages','sazabi messages search "bug" --limit 50 # Search with limit','sazabi messages search "user input" --role user # Search user messages only','sazabi messages search "response" --thread-id thread-123 # Search in specific thread']).build()}).withExamples(["sazabi messages send 'Hello' # Start a new thread","sazabi messages send 'Follow up' -t <thread-id> # Append to thread","sazabi messages list <thread-id> # List messages in thread",'sazabi messages search "error" # Search messages']).build();te();ce();ie();Zt();var lW={id:{label:"ID",type:{kind:"string"}},name:{label:"Name",type:{kind:"string"}},slug:{label:"Slug",type:{kind:"string"}},role:{label:"Role",type:{kind:"nullable-string"}}},_de={schema:lW,columns:["id","name","slug","role"],header:"Organizations",emptyMessage:"No organizations found."},jde={layout:"field-list",schema:lW,fields:["id","name","slug","role"]},Rde=async(e)=>{let t=L({tokenFlag:e.token,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),i=k(await n.organizations.list(),"Couldn't list organizations (check your token and try again)",e.json);X(_de,i.organizations,{json:e.json})},Ude=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json),o=D({token:n.token,organizationId:e,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),r=k(await o.organizations.get(e),"Couldn't fetch organization (run 'sazabi organizations list' to see organization IDs)",t.json).organization,a=k(await o.projects.list({organizationId:e}),"Couldn't fetch organization projects (check the organization ID and try again)",t.json).projects,s=k(zt(i),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",t.json),h=s.activeProjectId&&a.some((y)=>y.id===s.activeProjectId)?s.activeProjectId:a[0]?.id,l=r.id!==s.activeOrganizationId,u=h!==s.activeProjectId,d=k(Nt(i,{activeOrganizationId:r.id,organizationName:r.name,activeProjectId:h,...(l||u)&&qn(s)}),"Failed to update profile",t.json);if(k(Ye(d),"Failed to persist active organization",t.json),t.json){Q({organization:r,activeProjectId:k(zt(d),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",t.json).activeProjectId});return}oe(`Active organization set to ${r.name}.`)},Ede=async(e,t)=>{let n=L({tokenFlag:t.token,organizationIdFlag:t.organizationId,jsonMode:t.json}),i=D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),o=k(await i.organizations.rename(e,n.organizationId),"Failed to rename organization",t.json);Kde(o.organization.id,o.organization.name),H(jde,o.organization,{json:t.json})},Kde=(e,t)=>{let n=Ue();if(!n.success)return;let i=n.value,o=zt(i);if(!o.success)return;if(o.value.activeOrganizationId!==e)return;let r=Nt(i,{organizationName:t});if(r.success)Ye(r.value)},uW=ne("organizations","Manage organizations").withSubcommands({list:P("list","List organizations available to the current credential",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0});if(n.length>0){let i=n.join(", ");if(t.json)return p(`Unexpected arguments: ${i}. Run 'sazabi organizations -h' for usage.`);return m(`Unexpected arguments: ${i}. Run 'sazabi organizations -h' for usage.`)}await Rde({token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi organizations list # List available organizations"]).build(),use:P("use","Set the active organization for future commands",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Organization ID is required.");return m("Organization ID is required.")}await Ude(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi organizations use org_123 # Set the active organization"]).build(),rename:P("rename","Rename the active organization",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},"organization-id":{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Organization name is required.");return m("Organization name is required.")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi organizations -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi organizations -h' for usage.`)}await Ede(i,{token:t.token,organizationId:t["organization-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},"organization-id":{type:"string",description:"Override organization selection"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(['sazabi organizations rename "Observed Platform" # Rename the active organization']).build()}).withExamples(["sazabi organizations list # List available organizations","sazabi organizations use org_123 # Set the active organization",'sazabi organizations rename "Observed Platform" # Rename the active organization']).build();te();ie();Zt();var xde={name:{label:"Profile",type:{kind:"string"}},active:{label:"Active",type:{kind:"custom",render:(e)=>e?_e.success("*"):"",serialize:(e)=>Boolean(e)}}},Gde=(e)=>{let t=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=Object.keys(t.profiles).map((i)=>({name:i,active:i===t.activeProfile}));X({schema:xde,columns:["name","active"],header:"Profiles",emptyMessage:"No profiles configured."},n,{json:e.json})},Bde=(e,t)=>{let n=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json);if(!n.profiles[e]){let i=`Profile '${e}' does not exist. Run 'sazabi profiles list' to see available profiles.`;if(t.json)p(i);m(i)}if(n.activeProfile=e,k(Ye(n),"Failed to write settings",t.json),t.json){Q({activeProfile:e});return}oe(`Active profile set to '${e}'.`)},Jde=(e,t)=>{let n=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json);if(n.profiles[e]){let i=`Profile '${e}' already exists.`;if(t.json)p(i);m(i)}if(n.profiles[e]={},k(Ye(n),"Failed to write settings",t.json),t.json){Q({created:e});return}oe(`Profile '${e}' created.`)},qde=(e,t)=>{let n=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json);if(!n.profiles[e]){let i=`Profile '${e}' does not exist. Run 'sazabi profiles list' to see available profiles.`;if(t.json)p(i);m(i)}if(e===n.activeProfile){let i=`Cannot delete the active profile '${e}'. Switch to a different profile first with 'sazabi profiles use <name>'.`;if(t.json)p(i);m(i)}if(delete n.profiles[e],k(Ye(n),"Failed to write settings",t.json),t.json){Q({deleted:e});return}oe(`Profile '${e}' deleted.`)},gW=ne("profiles","Manage named CLI profiles").withSubcommands({list:P("list","List all profiles",async(e)=>{let{values:t}=S(e,{json:{type:"boolean"}});Gde({json:t.json})}).withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi profiles list # List all profiles"]).build(),use:P("use","Set the active profile",async(e)=>{let{values:t,positionals:n}=S(e,{json:{type:"boolean"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Profile name is required. Usage: sazabi profiles use <name>");return m("Profile name is required. Usage: sazabi profiles use <name>")}Bde(i,{json:t.json})}).withPositionalArgs("<name>").withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi profiles use staging # Switch to staging profile"]).build(),create:P("create","Create a new empty profile",async(e)=>{let{values:t,positionals:n}=S(e,{json:{type:"boolean"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Profile name is required. Usage: sazabi profiles create <name>");return m("Profile name is required. Usage: sazabi profiles create <name>")}Jde(i,{json:t.json})}).withPositionalArgs("<name>").withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi profiles create staging # Create a new profile"]).build(),delete:P("delete","Delete a profile",async(e)=>{let{values:t,positionals:n}=S(e,{json:{type:"boolean"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Profile name is required. Usage: sazabi profiles delete <name>");return m("Profile name is required. Usage: sazabi profiles delete <name>")}qde(i,{json:t.json})}).withPositionalArgs("<name>").withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi profiles delete staging # Delete a profile"]).build()}).withExamples(["sazabi profiles list # List all profiles","sazabi profiles use staging # Switch to staging profile","sazabi profiles create local # Create a new profile","sazabi profiles delete staging # Delete a profile"]).build();te();ce();ie();Zt();var Hde={id:{label:"ID",type:{kind:"string"}},name:{label:"Name",type:{kind:"string"}},region:{label:"Region",type:{kind:"string"}},active:{label:"Active",type:{kind:"custom",render:(e)=>e?_e.success("*"):"",serialize:(e)=>e}},url:{label:"URL",type:{kind:"string"}}},Wde={schema:Hde,columns:["id","name","region","active","url"],header:"Projects",emptyMessage:"No projects found."},Mde={id:{label:"ID",type:{kind:"string"}},name:{label:"Name",type:{kind:"string"}},region:{label:"Region",type:{kind:"string"}},organizationId:{label:"Organization",type:{kind:"string"}}},Yde={layout:"field-list",schema:Mde,fields:["id","name","region","organizationId"],title:"Project"},Xde=async(e)=>{let t=L({tokenFlag:e.token,organizationIdFlag:e.organizationId,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),i=k(await n.projects.create({name:e.name,...e.organizationId?{organizationId:e.organizationId}:{},...e.region?{region:e.region}:{}}),"Failed to create project",e.json);if(H(Yde,{id:i.project.id,name:i.project.name,region:i.project.region,organizationId:i.project.organizationId},{json:e.json}),!e.json)oe(`Project ${i.project.name} created.`)},Zde=async(e)=>{let t=L({tokenFlag:e.token,organizationIdFlag:e.organizationId,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),o=k(await n.projects.list({organizationId:t.organizationId}),"Couldn't list projects (check the active organization and try again)",e.json).projects.map((r)=>({...r,active:r.id===t.projectId,url:po(r.id)}));X(Wde,o,{json:e.json})},Fde=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json),o=D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),r=k(await o.projects.get(e),"Couldn't fetch project (run 'sazabi projects list' to see project IDs)",t.json).project,a=On(i),s=i.profiles[a],h=r.organizationId!==s?.activeOrganizationId,l=r.id!==s?.activeProjectId,u=k(Nt(i,{activeOrganizationId:r.organizationId,activeProjectId:r.id,...h&&{organizationName:void 0},...(h||l)&&qn(s)}),"Failed to update profile",t.json);if(k(Ye(u),"Failed to persist active project",t.json),t.json){Q({project:r});return}oe(`Active project set to ${r.name}.`)},dW=ne("projects","Manage projects").withSubcommands({list:P("list","List projects in the active organization",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},"organization-id":{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0});if(n.length>0){let i=n.join(", ");if(t.json)return p(`Unexpected arguments: ${i}. Run 'sazabi projects -h' for usage.`);return m(`Unexpected arguments: ${i}. Run 'sazabi projects -h' for usage.`)}await Zde({token:t.token,organizationId:t["organization-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},"organization-id":{type:"string",description:"Override organization selection"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi projects list # List projects in the active organization"]).build(),use:P("use","Set the active project for future commands",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Project ID is required.");return m("Project ID is required.")}await Fde(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi projects use 11111111-1111-4111-8111-111111111111 # Set the active project"]).build(),create:P("create","Create a new project in the active organization",async(e)=>{let{values:t,positionals:n}=S(e,{...B,name:{type:"string"},region:{type:"string"},"organization-id":{type:"string"}},{allowPositionals:!0});if(n.length>0){let i=n.join(", ");if(t.json)return p(`Unexpected arguments: ${i}. Run 'sazabi projects -h' for usage.`);return m(`Unexpected arguments: ${i}. Run 'sazabi projects -h' for usage.`)}if(!t.name){if(t.json)return p("--name is required.");return m("--name is required.")}await Xde({name:t.name,region:t.region,organizationId:t["organization-id"],token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({...J,name:{type:"string",required:!0,description:"Project name (required)"},region:{type:"string",description:"AWS region for the project (defaults to us-west-2)"},"organization-id":{type:"string",description:"Override organization selection"}}).withExamples(['sazabi projects create --name "My Project" # Create a project in the active organization','sazabi projects create --name "EU App" --region eu-central-1 # Create in a specific region']).build()}).withExamples(["sazabi projects list # List projects in the active organization","sazabi projects use 11111111-1111-4111-8111-111111111111 # Set the active project",'sazabi projects create --name "My Project" # Create a project']).build();te();ce();ie();var Qde={id:{label:"ID",type:{kind:"string"}},projectId:{label:"Project",type:{kind:"string"}},repositoryFullName:{label:"Repository",type:{kind:"string"}},githubPullRequestId:{label:"PR #",type:{kind:"number"}},title:{label:"Title",type:{kind:"nullable-string"}},url:{label:"URL",type:{kind:"nullable-string"}},status:{label:"Status",type:{kind:"nullable-string"}},reviewState:{label:"Review",type:{kind:"nullable-string"}},checksState:{label:"Checks",type:{kind:"nullable-string"}},requestedByUserId:{label:"Requested by",type:{kind:"nullable-string"}},githubAuthorLogin:{label:"GitHub author",type:{kind:"nullable-string"}},threadId:{label:"Thread",type:{kind:"nullable-string"}},runId:{label:"Run",type:{kind:"nullable-string"}},createdAt:{label:"Created",type:{kind:"date"}},mergedAt:{label:"Merged",type:{kind:"nullable-date"}},closedAt:{label:"Closed",type:{kind:"nullable-date"}}},Vde=["id","projectId","repositoryFullName","githubPullRequestId","title","url","status","reviewState","checksState","requestedByUserId","githubAuthorLogin","threadId","runId","createdAt","mergedAt","closedAt"],eye={schema:Qde,columns:["repositoryFullName","githubPullRequestId","title","status","createdAt"],jsonFields:Vde,header:"Pull requests",emptyMessage:"No pull requests found."},tye=async(e)=>{let t=L({tokenFlag:e.token,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),i=k(await n.pullRequests.list({status:e.status,repositoryFullName:e.repository,requestedByUserId:e.requestedBy,limit:e.limit,cursor:e.cursor}),"Couldn't list pull requests (check the active project and try again)",e.json);X(eye,i.pullRequests,{json:e.json,nextCursor:i.nextCursor})},yW=ne("pull-requests","List pull requests opened by Sazabi").withSubcommands({list:P("list","List pull requests Sazabi opened in the active project",async(e)=>{let{values:t}=S(e,{...B,status:{type:"string"},repository:{type:"string"},"requested-by":{type:"string"},mine:{type:"boolean"},limit:{type:"string"},cursor:{type:"string"}}),n=["open","merged","closed"];if(t.status&&!n.includes(t.status)){let r=`Invalid --status "${t.status}". Must be one of: ${n.join(", ")}.`;if(t.json)return p(r);return m(r)}let i=t.limit?Number(t.limit):void 0;if(i!==void 0&&(Number.isNaN(i)||i<1||i>100)){if(t.json)return p("Invalid --limit. Must be an integer between 1 and 100.");return m("Invalid --limit. Must be an integer between 1 and 100.")}let o=t.mine?"me":t["requested-by"];await tye({token:t.token,json:t.json,apiBaseUrl:t["api-base-url"],status:t.status,repository:t.repository,requestedBy:o,limit:i,cursor:t.cursor})}).withOptions({...J,status:{type:"string",description:"Filter by status: open, merged, or closed"},repository:{type:"string",description:"Filter by repository full name, for example owner/repo"},"requested-by":{type:"string",description:"Filter by the Sazabi user ID that requested the PR (or 'me')"},mine:{type:"boolean",description:"Only show pull requests you requested (requires user authentication)"},limit:{type:"string",description:"Maximum number of pull requests to return (default: 50, max: 100)"},cursor:{type:"string",description:"Pagination cursor from a previous response"}}).withExamples(["sazabi pull-requests list # List PRs Sazabi opened in the active project","sazabi pull-requests list --status open --mine # Your open PRs","sazabi pull-requests list --repository sazabi/monorepo --json # PRs in one repo as JSON"]).build()}).withExamples(["sazabi pull-requests list # List PRs Sazabi opened","sazabi pull-requests list --status open --mine # Your open PRs","sazabi pull-requests list --repository owner/repo # PRs in one repo"]).build();te();ce();ie();var nye={priority:{label:"#",type:{kind:"number"}},kind:{label:"Kind",type:{kind:"string"}},targetId:{label:"Target",type:{kind:"string"}},status:{label:"Status",type:{kind:"custom",render:(e)=>e==="connected"?_e.success("connected"):_e.info("recommended"),serialize:(e)=>e}},roiScore:{label:"ROI",type:{kind:"number"}}},oye={schema:nye,columns:["priority","kind","targetId","status","roiScore"],header:"Recommendations",emptyMessage:"No recommendations found."},bW=["data_source","mcp_connector","sandbox_cli","integration"],pW=["connected","recommended"],iye=async(e)=>{if(e.kind&&!bW.includes(e.kind)){let r=`Invalid --kind: ${e.kind}. Expected one of: ${bW.join(", ")}.`;if(e.json)return p(r);return m(r)}if(e.status&&!pW.includes(e.status)){let r=`Invalid --status: ${e.status}. Expected one of: ${pW.join(", ")}.`;if(e.json)return p(r);return m(r)}let t=L({tokenFlag:e.token,projectIdFlag:e.projectId,organizationIdFlag:e.organizationId,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),o=k(await n.recommendations.list(),"Couldn't list recommendations (check the active project and try again)",e.json).recommendations.filter((r)=>(!e.kind||r.kind===e.kind)&&(!e.status||r.status===e.status));X(oye,o,{json:e.json})},rye={...B,"project-id":{type:"string"},"organization-id":{type:"string"},kind:{type:"string"},status:{type:"string"}},aye={...J,"project-id":{type:"string",description:"Override active project ID"},"organization-id":{type:"string",description:"Override active organization ID"},kind:{type:"string",description:"Filter by kind (data_source, mcp_connector, sandbox_cli, integration)"},status:{type:"string",description:"Filter by status (connected, recommended)"}},mW=ne("recommendations","View setup recommendations for a project").withSubcommands({list:P("list","List setup recommendations for the active project",async(e)=>{let{values:t}=S(e,rye);await iye({token:t.token,projectId:t["project-id"],organizationId:t["organization-id"],apiBaseUrl:t["api-base-url"],json:t.json,kind:t.kind,status:t.status})}).withOptions(aye).withExamples(["sazabi recommendations list # List all recommendations","sazabi recommendations list --status recommended # Only not-yet-connected items","sazabi recommendations list --kind data_source # Only data sources","sazabi recommendations list --json # Output as JSON"]).build()}).withExamples(["sazabi recommendations list # List all recommendations","sazabi recommendations list --json # Output as JSON"]).build();te();te();ie();var _P=(e)=>{process.stderr.write(`${e}
|
|
8605
|
-
`)},hg=async(e)=>{let t=new AbortController,n,i=!1,o=()=>{i=!0,t.abort(),n?.close()};if(process.on("SIGINT",o),!e.json)_P(`Streaming events for ${e.label}. Press Ctrl+C to stop.`);try{if(n=k(await e.open(t.signal),e.errorContext,e.json),i)await n.close();let r=sye(),a=0,s;try{for await(let h of n){if(a+=1,e.json){console.log(JSON.stringify(h));continue}let l=r(h);if(l)Ln(l)}}catch(h){if(i||h instanceof Error&&h.name==="AbortError")s=void 0;else s=h instanceof Error?h:Error(String(h))}if(s){if(e.json)return p(s.message);Ft(s.message);return}if(cye(n.cursor,e.resumeCommand),!e.json)_P(i?`Interrupted after ${jt(a,"event")}.`:`Stream ended after ${jt(a,"event")}.`)}finally{process.removeListener("SIGINT",o)}},cye=(e,t)=>{if(!e)return;_P(`Resume with: ${t} --cursor ${e}`)},wW=160,vW=(e)=>{let t=e.replace(/\s+/g," ").trim();return t.length>wW?`${t.slice(0,wW-3)}...`:t},sye=()=>{let e=new Map;return(t)=>{switch(t.type){case"run_started":return`run started (${t.runId})`;case"message_started":return`message started (${t.messageId})`;case"text_chunk":case"reasoning_chunk":return;case"text_complete":return`assistant: ${vW(t.content)}`;case"reasoning_complete":return`reasoning: ${vW(t.content)}`;case"tool_call_pending":return e.set(t.toolCallId,t.name),`tool ${t.name} · pending`;case"tool_call_start":return e.set(t.toolCallId,t.name),`tool ${t.name} · started`;case"tool_call_complete":{let n=e.get(t.toolCallId)??t.toolCallId,i=t.durationMs!==void 0?` (${t.durationMs}ms)`:"";return`tool ${n} · ${t.status}${i}`}case"artifact":return`artifact ${t.name}`;case"error":return`error: ${t.message}`;case"stream_reset":return`stream reset (${t.messageId})`;case"disconnected":return"disconnected";default:return}}};ce();ie();var hye={runId:{label:"Run ID",type:{kind:"id"}},threadId:{label:"Thread ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"string"}},status:{label:"Status",type:{kind:"string"}},completed:{label:"Completed",type:{kind:"boolean"}},messageId:{label:"Message ID",type:{kind:"nullable-string",emptyLabel:"(none)"}},response:{label:"Response",type:{kind:"nullable-string"}}},lye={layout:"sections",schema:hye,primary:{title:"Run",fields:["runId","threadId","url","status","completed","messageId"]},secondary:[{title:"Response",field:"response"}]},uye=async(e,t={})=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),o=k(await i.runs.get(e),"Couldn't get run (check the run ID and try again)",t.json),r=t.wait&&!o.completed?k(await sg({client:i,runId:e,threadId:o.threadId,timeoutMs:t.timeout,printProgress:!t.json}),"Couldn't get run (check the run ID and try again)",t.json):o,a={...r,url:Zq(Sn(n.projectId,t.json),r.threadId,void 0,r.messageId??void 0)};if(H(lye,a,{json:t.json}),!t.json&&!r.completed)se(),ye(`Poll with: sazabi runs get ${r.runId}`)},gye=async(e,t={})=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),o=k(await i.runs.cancel(e),"Failed to cancel run",t.json);if(t.json){Q({...o,runId:e});return}oe(`Cancellation requested for run ${e}.`),ye(`Cancellation is best-effort; poll with: sazabi runs get ${e}`)},dye=async(e,t={})=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl});await hg({json:t.json,label:`run ${e}`,resumeCommand:`sazabi runs stream ${e}`,errorContext:`Couldn't stream run (retry with 'sazabi runs stream ${e}')`,open:(o)=>i.runs.stream({runId:e,...t.cursor?{cursor:t.cursor}:{},signal:o})})},fW=ne("runs","Inspect deferred agent runs").withSubcommands({get:P("get","Get a deferred run by run ID",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},wait:{type:"boolean"},timeout:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Run ID is required. Usage: sazabi runs get <run-id>");return m("Run ID is required. Usage: sazabi runs get <run-id>")}if(n.length>1){let r=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${r}. Run 'sazabi runs -h' for usage.`);return m(`Unexpected arguments: ${r}. Run 'sazabi runs -h' for usage.`)}let o=t.timeout?ht(t.timeout,1,3600,"Timeout",t.json)*1000:void 0;await uye(i,{token:t.token,wait:t.wait,timeout:o,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<run-id>").withOptions({token:{type:"string",description:"Override token"},wait:{type:"boolean",description:"Wait for terminal status and print the final result"},timeout:{type:"string",description:"Timeout in seconds to wait before returning processing state"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi runs get <run-id> # Check current run status","sazabi runs get <run-id> --wait # Wait until the run is terminal","sazabi runs get <run-id> --wait --timeout 60 # Wait up to 60 seconds","sazabi runs get <run-id> --json # Output run state as JSON"]).build(),cancel:P("cancel","Request cancellation of an in-flight run",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Run ID is required. Usage: sazabi runs cancel <run-id>");return m("Run ID is required. Usage: sazabi runs cancel <run-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi runs -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi runs -h' for usage.`)}await gye(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<run-id>").withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi runs cancel <run-id> # Request cancellation of a run","sazabi runs cancel <run-id> --json # Output the result as JSON"]).build(),stream:P("stream","Stream a run's agent events in real time",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},cursor:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Run ID is required. Usage: sazabi runs stream <run-id>");return m("Run ID is required. Usage: sazabi runs stream <run-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi runs -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi runs -h' for usage.`)}await dye(i,{token:t.token,cursor:t.cursor,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<run-id>").withOptions({token:{type:"string",description:"Override token"},cursor:{type:"string",description:"Resume from a prior stream cursor after a disconnect"},json:{type:"boolean",description:"Emit one NDJSON event per line (stdout carries events only)"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi runs stream <run-id> # Follow run events (human-readable)","sazabi runs stream <run-id> --json # Emit NDJSON events for tools","sazabi runs stream <run-id> --cursor seq:42 # Resume after a disconnect"]).build()}).withExamples(["sazabi runs get <run-id> # Check current run status","sazabi runs get <run-id> --wait # Wait until the run is terminal","sazabi runs cancel <run-id> # Request cancellation of a run","sazabi runs stream <run-id> # Stream run events in real time"]).build();te();ce();ie();var yye={type:{label:"Type",type:{kind:"string"}},label:{label:"Name",type:{kind:"string"}},envVars:{label:"Env vars",type:{kind:"string"}},hasSetupSkill:{label:"Setup skill",type:{kind:"boolean"}},url:{label:"URL",type:{kind:"string"}}},bye={schema:yye,columns:["type","label","envVars","hasSetupSkill","url"],header:"Sandbox CLIs",emptyMessage:"No sandbox CLIs available."},pye={type:{label:"Type",type:{kind:"string"}},setupSkill:{label:"Setup skill",type:{kind:"string"}}},mye={layout:"field-list",schema:pye,fields:["type","setupSkill"],title:"Sandbox CLI setup skill"},kW=(e)=>{let t=e.json,n=L({tokenFlag:e.token,jsonMode:t}),i=e["api-base-url"];return{client:D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:i,jsonMode:t}),json:t,projectId:n.projectId,apiBaseUrl:i}},wye=async(e)=>{let{values:t}=S(e,{...B}),{client:n,json:i,projectId:o}=kW(t),{types:r}=k(await n.sandboxPresets.listTypes(),"Couldn't list sandbox CLI types (check your token and try again)",i),a=Sn(o,i),s=r.map((h)=>({type:h.type,label:h.label,envVars:h.envVarKeys.length>0?h.envVarKeys.join(", "):"(none)",hasSetupSkill:Boolean(h.setupSkill),url:nH(a,h.type)}));X(bye,s,{json:i})},vye=async(e)=>{let{values:t}=S(e,{...B,type:{type:"string"}});if(!t.type){if(t.json)return p("--type is required. Use 'sazabi sandbox-presets types' to see available CLI types.");return m("--type is required. Use 'sazabi sandbox-presets types' to see available CLI types.")}let{client:n,json:i}=kW(t),{types:o}=k(await n.sandboxPresets.listTypes(),"Couldn't list sandbox CLI types (check your token and try again)",i),r=o.find((a)=>a.type===t.type);if(!r){let a=`Unknown sandbox CLI type: ${t.type}. Run 'sazabi sandbox-presets types' to see available types.`;if(i)return p(a);return m(a)}if(!r.setupSkill){let a=`No setup skill available for ${t.type}. This CLI does not have an agent-ready skill yet.`;if(i)return p(a);return m(a)}H(mye,{type:t.type,setupSkill:r.setupSkill},{json:i})},IW=ne("sandbox-presets","Inspect sandbox CLIs").withSubcommands({types:P("types","List available sandbox CLI types",wye).withOptions({...J}).withExamples(["sazabi sandbox-presets types # List all sandbox CLI types","sazabi sandbox-presets types --json # Output as JSON"]).build(),skill:P("skill","Show setup skill for a sandbox CLI type",vye).withOptions({...J,type:{type:"string",description:"Sandbox CLI type (e.g. aws, github, vercel, supabase)"}}).withExamples(["sazabi sandbox-presets skill --type aws # Show AWS setup skill","sazabi sandbox-presets skill --type github # Show GitHub setup skill","sazabi sandbox-presets skill --type vercel --json # Output as JSON"]).build()}).withExamples(["sazabi sandbox-presets types # List available sandbox CLIs","sazabi sandbox-presets skill --type aws # Show setup skill"]).build();te();import{readFile as fye}from"node:fs/promises";ce();ie();var ug=(e)=>({name:e.name,description:e.description,contentHash:e.contentHash,content:"content"in e?e.content:null,createdAt:e.createdAt,updatedAt:e.updatedAt}),OW={name:{label:"Name",type:{kind:"string"}},description:{label:"Description",type:{kind:"nullable-string"}},contentHash:{label:"Content hash",type:{kind:"nullable-string"}},content:{label:"Content",type:{kind:"custom",render:(e)=>e?String(e):"(empty)",serialize:(e)=>e}},createdAt:{label:"Created at",type:{kind:"nullable-date"}},updatedAt:{label:"Updated at",type:{kind:"nullable-date"}}},kye={schema:OW,columns:["name","description","updatedAt"],jsonFields:["name","description","updatedAt"],header:"Scripts",emptyMessage:"No scripts found."},jP={layout:"field-list",schema:OW,fields:["name","description","contentHash","content","createdAt","updatedAt"],title:"Script"},Kc=(e)=>{let t=L({tokenFlag:e.token,projectIdFlag:e.projectId,jsonMode:e.json});return{client:D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json})}},Iye=async()=>{let e=[];process.stdin.setEncoding("utf8");for await(let t of process.stdin)e.push(String(t));return e.join("")},PW=async(e,t,n)=>{let i=e.content!==void 0,o=e.file!==void 0;if(i&&o){if(t){p("Provide script content via exactly one of --content or --file.");return}m("Provide script content via exactly one of --content or --file.");return}if(!i&&!o){if(!n)return;let a="Script content is required. Provide --content <text> or --file <path>.";if(t){p(a);return}m(a);return}if(i)return e.content;let r=e.file;try{return r==="-"?await Iye():await fye(r,"utf8")}catch(a){let s=`Couldn't read script content (check that the --file path exists and is readable): ${a instanceof Error?a.message:String(a)}`;if(t){p(s);return}m(s);return}},Oye=async(e)=>{let{client:t}=Kc(e),n=k(await t.scripts.list({search:e.search,limit:e.limit,cursor:e.cursor}),"Couldn't list scripts (check the active project and try again)",e.json);X(kye,n.scripts.map(ug),{json:e.json,nextCursor:n.nextCursor})},Pye=async(e,t)=>{let{client:n}=Kc(t),i=k(await n.scripts.get(e),"Couldn't get script (run 'sazabi scripts list' to see script names)",t.json);H(jP,ug(i.script),{json:t.json})},Sye=async(e,t)=>{let n=await PW(t,t.json,!0);if(n===void 0)return;let{client:i}=Kc(t),o=k(await i.scripts.create({name:e,content:n,...t.description!==void 0?{description:t.description}:{}}),"Couldn't create script (check the script name and content, then try again)",t.json);if(!t.json)oe(`Script "${o.script.name}" created.`);H(jP,ug(o.script),{json:t.json})},$ye=async(e,t)=>{let n=t.description!==void 0||t.clearDescription===!0;if(t.description!==void 0&&t.clearDescription===!0){if(t.json){p("Use either --description or --clear-description, not both.");return}m("Use either --description or --clear-description, not both.");return}let i=await PW(t,t.json,!1);if(i===void 0&&t.content!==void 0)return;if(i===void 0&&t.file!==void 0)return;if(i===void 0&&!n){if(t.json){p("Nothing to update. Provide --content, --file, --description, or --clear-description.");return}m("Nothing to update. Provide --content, --file, --description, or --clear-description.");return}let{client:o}=Kc(t),r=k(await o.scripts.update(e,{...i!==void 0?{content:i}:{},...t.clearDescription?{description:null}:t.description!==void 0?{description:t.description}:{}}),"Couldn't update script (run 'sazabi scripts list' to see script names)",t.json);if(!t.json)oe(`Script "${r.script.name}" updated.`);H(jP,ug(r.script),{json:t.json})},Tye=async(e,t)=>{let{client:n}=Kc(t);if(k(await n.scripts.delete(e),"Couldn't delete script (run 'sazabi scripts list' to see script names)",t.json),t.json){Q({deleted:!0,name:e});return}oe(`Script "${e}" deleted.`)},Uc={...B,"project-id":{type:"string"}},Ec={...J,"project-id":{type:"string",description:"Override active project ID"}},lg=(e,t)=>{let n=e[0];if(!n){if(t){p("Script name is required.");return}m("Script name is required.");return}return n},SW=ne("scripts","Manage durable project scripts").withSubcommands({list:P("list","List scripts in the active project",async(e)=>{let{values:t}=S(e,{...Uc,search:{type:"string"},limit:{type:"string"},cursor:{type:"string"}}),n=(o)=>{if(t.json){p(o);return}m(o)},i;if(t.limit!==void 0){if(i=Number(t.limit),!Number.isInteger(i)||i<1||i>100)return n(`Invalid --limit value "${t.limit}". Expected an integer between 1 and 100.`)}await Oye({token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],search:t.search,limit:i,cursor:t.cursor})}).withOptions({...Ec,search:{type:"string",description:"Filter by script name (case-insensitive)"},limit:{type:"string",description:"Maximum number of scripts to return (default: 50, max: 100)"},cursor:{type:"string",description:"Pagination cursor from previous response"}}).withExamples(["sazabi scripts list # List project scripts","sazabi scripts list --search deploy # Search scripts by name"]).build(),get:P("get","Get one project script by name",async(e)=>{let{values:t,positionals:n}=S(e,Uc,{allowPositionals:!0}),i=lg(n,t.json);if(!i)return;await Pye(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<name>").withOptions(Ec).withExamples(["sazabi scripts get deploy # Get one script"]).build(),create:P("create","Create a project script",async(e)=>{let{values:t,positionals:n}=S(e,{...Uc,content:{type:"string"},file:{type:"string"},description:{type:"string"}},{allowPositionals:!0}),i=lg(n,t.json);if(!i)return;await Sye(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],content:t.content,file:t.file,description:t.description})}).withPositionalArgs("<name>").withOptions({...Ec,content:{type:"string",description:"Script body text"},file:{type:"string",description:"Read script body from a file, or '-' for stdin"},description:{type:"string",description:"Optional human-readable description"}}).withExamples(["sazabi scripts create deploy --content '#!/usr/bin/env bash' # Create from inline content","sazabi scripts create deploy --file ./deploy.sh # Create from a file"]).build(),update:P("update","Update a project script",async(e)=>{let{values:t,positionals:n}=S(e,{...Uc,content:{type:"string"},file:{type:"string"},description:{type:"string"},"clear-description":{type:"boolean"}},{allowPositionals:!0}),i=lg(n,t.json);if(!i)return;await $ye(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],content:t.content,file:t.file,description:t.description,clearDescription:t["clear-description"]})}).withPositionalArgs("<name>").withOptions({...Ec,content:{type:"string",description:"New script body text"},file:{type:"string",description:"Read new script body from a file, or '-' for stdin"},description:{type:"string",description:"New human-readable description"},"clear-description":{type:"boolean",description:"Clear the script description"}}).withExamples(["sazabi scripts update deploy --description 'Deploy helper' # Update description only","sazabi scripts update deploy --file ./deploy.sh # Replace script body"]).build(),delete:P("delete","Delete a project script",async(e)=>{let{values:t,positionals:n}=S(e,Uc,{allowPositionals:!0}),i=lg(n,t.json);if(!i)return;await Tye(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<name>").withOptions(Ec).withExamples(["sazabi scripts delete deploy # Delete a script"]).build()}).withExamples(["sazabi scripts list # List project scripts","sazabi scripts get deploy # Get one script","sazabi scripts create deploy --file ./deploy.sh # Create a script","sazabi scripts update deploy --description 'Deploy helper' # Update a script","sazabi scripts delete deploy # Delete a script"]).build();te();ie();Zt();var RP=["apiBaseUrl","authBaseUrl","webBaseUrl","intakeBaseUrl","tailBaseUrl","apiDomain","webDomain","intakeDomain","tailDomain","forwardPublicKey"],$W=(e)=>{return RP.includes(e)},Aye=["apiBaseUrl","authBaseUrl","webBaseUrl","intakeBaseUrl","tailBaseUrl"],Cye=(e)=>Aye.includes(e),Lye={apiBaseUrl:["http:","https:"],authBaseUrl:["http:","https:"],webBaseUrl:["http:","https:"],intakeBaseUrl:["http:","https:"],tailBaseUrl:["ws:","wss:","http:","https:"]},Dye=(e,t)=>{let n=(()=>{try{return new URL(t)}catch{return null}})();if(!n)return We(`Invalid URL for ${e}: '${t}'. Provide a full URL such as https://api.example.com.`);let i=Lye[e];if(!i.includes(n.protocol))return We(`Invalid protocol '${n.protocol}' for ${e}. Allowed: ${i.join(", ")}.`);return rt(n.toString().replace(/\/+$/,""))},zye=(e={})=>{let t=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=On(t),i=k(zt(t),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",e.json);if(e.json){Q({success:!0,settingsFile:Pr,profile:n,settings:i});return}Se({"Settings file":Pr,"Active profile":n}),se();let o=Object.entries(i).filter(([,a])=>a!=null);if(o.length===0){Io("No settings configured.");return}let r=o.map(([a,s])=>({key:a,value:String(s)})).sort((a,s)=>a.key.localeCompare(s.key));dn(r,[{header:"Key",key:"key",width:20},{header:"Value",key:"value"}],{header:"Settings"})},Nye=(e,t,n={})=>{if(!$W(e)){let h=RP.join(", "),l=`Invalid setting key: '${e}'. Valid keys: ${h}.`;if(n.json){p(l);return}m(l);return}let i=t;if(Cye(e)){let h=Dye(e,t);if(!h.success){if(n.json){p(h.error);return}m(h.error);return}i=h.value}let o=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",n.json),r=k(zt(o),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",n.json);if(e==="forwardPublicKey"&&!r.activeProjectId){if(n.json){p("Cannot set forwardPublicKey without an active project. Select a project first with 'sazabi projects use <id>'.");return}m("Cannot set forwardPublicKey without an active project. Select a project first with 'sazabi projects use <id>'.");return}let a=e==="forwardPublicKey"?{forwardPublicKey:i,forwardPublicKeyProjectId:r.activeProjectId}:{[e]:i},s=k(Nt(o,a),"Failed to update profile",n.json);if(k(Ye(s),"Failed to write settings",n.json),n.json){Q({success:!0,key:e,value:i});return}oe(`Set ${e} to ${i}.`)},_ye=(e,t={})=>{if(!$W(e)){let a=RP.join(", "),s=`Invalid setting key: '${e}'. Valid keys: ${a}.`;if(t.json){p(s);return}m(s);return}let n=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json),i=k(zt(n),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",t.json),o=e==="forwardPublicKey"?qn(i):{[e]:void 0},r=k(Nt(n,o),"Failed to update profile",t.json);if(k(Ye(r),"Failed to write settings",t.json),t.json){Q({success:!0,key:e});return}oe(`Cleared ${e}.`)},TW=ne("settings","Manage global CLI settings").withSubcommands({view:P("view","Show current CLI settings and file location",async(e)=>{let{values:t}=S(e,{json:{type:"boolean"}});zye({json:t.json})}).withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi settings view # Show current settings","sazabi settings view --json # Output as JSON"]).build(),set:P("set","Set a global configuration value",async(e)=>{let{values:t,positionals:n}=S(e,{json:{type:"boolean"}},{allowPositionals:!0}),i=n[0],o=n[1];if(!i){if(t.json)return p("Setting key is required. Usage: sazabi settings set <key> <value>");return m("Setting key is required. Usage: sazabi settings set <key> <value>")}if(!o){if(t.json)return p("Value is required. Usage: sazabi settings set <key> <value>");return m("Value is required. Usage: sazabi settings set <key> <value>")}Nye(i,o,{json:t.json})}).withPositionalArgs("<key> <value>").withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi settings set apiBaseUrl https://api.example.com # Override a base URL (also: authBaseUrl, webBaseUrl, intakeBaseUrl, tailBaseUrl)"]).build(),unset:P("unset","Clear a global configuration value",async(e)=>{let{values:t,positionals:n}=S(e,{json:{type:"boolean"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Setting key is required. Usage: sazabi settings unset <key>");return m("Setting key is required. Usage: sazabi settings unset <key>")}_ye(i,{json:t.json})}).withPositionalArgs("<key>").withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi settings unset apiBaseUrl # Clear API base URL override","sazabi settings unset --json apiBaseUrl # Output as JSON"]).build()}).withExamples(["sazabi settings view # Show current settings","sazabi settings set apiBaseUrl https://api.example.com # Set API base URL","sazabi settings unset apiBaseUrl # Clear API base URL override"]).build();te();ie();import*as EW from"node:os";import*as KW from"node:path";import*as Mn from"node:path";var gg=["claude-code","codex","cursor","amp","opencode"],jye={"claude-code":{user:(e)=>Mn.join(e,".claude","skills"),project:(e)=>Mn.join(e,".claude","skills")},codex:{user:(e)=>Mn.join(e,".agents","skills"),project:(e)=>Mn.join(e,".agents","skills")},amp:{user:(e)=>Mn.join(e,".config","agents","skills"),project:(e)=>Mn.join(e,".agents","skills")},opencode:{user:(e)=>Mn.join(e,".config","opencode","skills"),project:(e)=>Mn.join(e,".opencode","skills")}},Rye="Cursor does not support agent skills. Use Cursor Rules (.cursor/rules/*.mdc) instead. See https://cursor.com/docs/context/rules.",AW=(e)=>{if(e.agent==="cursor")return{kind:"unsupported",agent:"cursor",reason:Rye};let t=jye[e.agent],n=e.scope==="user"?t.user(e.home):t.project(e.projectDir);return{kind:"supported",agent:e.agent,scope:e.scope,root:n}};zf();import{dirname as Gye,resolve as Bye}from"node:path";import{fileURLToPath as Jye}from"node:url";var CW=`# Sazabi CLI Reference
|
|
8605
|
+
`)},hg=async(e)=>{let t=new AbortController,n,i=!1,o=()=>{i=!0,t.abort(),n?.close()};if(process.on("SIGINT",o),!e.json)_P(`Streaming events for ${e.label}. Press Ctrl+C to stop.`);try{if(n=k(await e.open(t.signal),e.errorContext,e.json),i)await n.close();let r=sye(),a=0,s;try{for await(let h of n){if(a+=1,e.json){console.log(JSON.stringify(h));continue}let l=r(h);if(l)Ln(l)}}catch(h){if(i||h instanceof Error&&h.name==="AbortError")s=void 0;else s=h instanceof Error?h:Error(String(h))}if(s){if(e.json)return p(s.message);Ft(s.message);return}if(cye(n.cursor,e.resumeCommand),!e.json)_P(i?`Interrupted after ${jt(a,"event")}.`:`Stream ended after ${jt(a,"event")}.`)}finally{process.removeListener("SIGINT",o)}},cye=(e,t)=>{if(!e)return;_P(`Resume with: ${t} --cursor ${e}`)},wW=160,vW=(e)=>{let t=e.replace(/\s+/g," ").trim();return t.length>wW?`${t.slice(0,wW-3)}...`:t},sye=()=>{let e=new Map;return(t)=>{switch(t.type){case"run_started":return`run started (${t.runId})`;case"message_started":return`message started (${t.messageId})`;case"text_chunk":case"reasoning_chunk":return;case"text_complete":return`assistant: ${vW(t.content)}`;case"reasoning_complete":return`reasoning: ${vW(t.content)}`;case"tool_call_pending":return e.set(t.toolCallId,t.name),`tool ${t.name} · pending`;case"tool_call_start":return e.set(t.toolCallId,t.name),`tool ${t.name} · started`;case"tool_call_complete":{let n=e.get(t.toolCallId)??t.toolCallId,i=t.durationMs!==void 0?` (${t.durationMs}ms)`:"";return`tool ${n} · ${t.status}${i}`}case"artifact":return`artifact ${t.name}`;case"error":return`error: ${t.message}`;case"stream_reset":return`stream reset (${t.messageId})`;case"disconnected":return"disconnected";default:return}}};ce();ie();var hye={runId:{label:"Run ID",type:{kind:"id"}},threadId:{label:"Thread ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"string"}},status:{label:"Status",type:{kind:"string"}},completed:{label:"Completed",type:{kind:"boolean"}},messageId:{label:"Message ID",type:{kind:"nullable-string",emptyLabel:"(none)"}},response:{label:"Response",type:{kind:"nullable-string"}}},lye={layout:"sections",schema:hye,primary:{title:"Run",fields:["runId","threadId","url","status","completed","messageId"]},secondary:[{title:"Response",field:"response"}]},uye=async(e,t={})=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),o=k(await i.runs.get(e),"Couldn't get run (check the run ID and try again)",t.json),r=t.wait&&!o.completed?k(await sg({client:i,runId:e,threadId:o.threadId,timeoutMs:t.timeout,printProgress:!t.json}),"Couldn't get run (check the run ID and try again)",t.json):o,a={...r,url:Zq(Sn(n.projectId,t.json),r.threadId,void 0,r.messageId??void 0)};if(H(lye,a,{json:t.json}),!t.json&&!r.completed)se(),ye(`Poll with: sazabi runs get ${r.runId}`)},gye=async(e,t={})=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),o=k(await i.runs.cancel(e),"Failed to cancel run",t.json);if(t.json){Q({...o,runId:e});return}oe(`Cancellation requested for run ${e}.`),ye(`Cancellation is best-effort; poll with: sazabi runs get ${e}`)},dye=async(e,t={})=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl});await hg({json:t.json,label:`run ${e}`,resumeCommand:`sazabi runs stream ${e}`,errorContext:`Couldn't stream run (retry with 'sazabi runs stream ${e}')`,open:(o)=>i.runs.stream({runId:e,...t.cursor?{cursor:t.cursor}:{},signal:o})})},fW=ne("runs","Inspect deferred agent runs").withSubcommands({get:P("get","Get a deferred run by run ID",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},wait:{type:"boolean"},timeout:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Run ID is required. Usage: sazabi runs get <run-id>");return m("Run ID is required. Usage: sazabi runs get <run-id>")}if(n.length>1){let r=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${r}. Run 'sazabi runs -h' for usage.`);return m(`Unexpected arguments: ${r}. Run 'sazabi runs -h' for usage.`)}let o=t.timeout?ht(t.timeout,1,3600,"Timeout",t.json)*1000:void 0;await uye(i,{token:t.token,wait:t.wait,timeout:o,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<run-id>").withOptions({token:{type:"string",description:"Override token"},wait:{type:"boolean",description:"Wait for terminal status and print the final result"},timeout:{type:"string",description:"Timeout in seconds to wait before returning processing state"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi runs get <run-id> # Check current run status","sazabi runs get <run-id> --wait # Wait until the run is terminal","sazabi runs get <run-id> --wait --timeout 60 # Wait up to 60 seconds","sazabi runs get <run-id> --json # Output run state as JSON"]).build(),cancel:P("cancel","Request cancellation of an in-flight run",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Run ID is required. Usage: sazabi runs cancel <run-id>");return m("Run ID is required. Usage: sazabi runs cancel <run-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi runs -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi runs -h' for usage.`)}await gye(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<run-id>").withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi runs cancel <run-id> # Request cancellation of a run","sazabi runs cancel <run-id> --json # Output the result as JSON"]).build(),stream:P("stream","Stream a run's agent events in real time",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},cursor:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Run ID is required. Usage: sazabi runs stream <run-id>");return m("Run ID is required. Usage: sazabi runs stream <run-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi runs -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi runs -h' for usage.`)}await dye(i,{token:t.token,cursor:t.cursor,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<run-id>").withOptions({token:{type:"string",description:"Override token"},cursor:{type:"string",description:"Resume from a prior stream cursor after a disconnect"},json:{type:"boolean",description:"Emit one NDJSON event per line (stdout carries events only)"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi runs stream <run-id> # Follow run events (human-readable)","sazabi runs stream <run-id> --json # Emit NDJSON events for tools","sazabi runs stream <run-id> --cursor seq:42 # Resume after a disconnect"]).build()}).withExamples(["sazabi runs get <run-id> # Check current run status","sazabi runs get <run-id> --wait # Wait until the run is terminal","sazabi runs cancel <run-id> # Request cancellation of a run","sazabi runs stream <run-id> # Stream run events in real time"]).build();te();ce();ie();var yye={type:{label:"Type",type:{kind:"string"}},label:{label:"Name",type:{kind:"string"}},envVars:{label:"Env vars",type:{kind:"string"}},hasSetupSkill:{label:"Setup skill",type:{kind:"boolean"}},url:{label:"URL",type:{kind:"string"}}},bye={schema:yye,columns:["type","label","envVars","hasSetupSkill","url"],header:"Sandbox CLIs",emptyMessage:"No sandbox CLIs available."},pye={type:{label:"Type",type:{kind:"string"}},setupSkill:{label:"Setup skill",type:{kind:"string"}}},mye={layout:"field-list",schema:pye,fields:["type","setupSkill"],title:"Sandbox CLI setup skill"},kW=(e)=>{let t=e.json,n=L({tokenFlag:e.token,jsonMode:t}),i=e["api-base-url"];return{client:D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:i,jsonMode:t}),json:t,projectId:n.projectId,apiBaseUrl:i}},wye=async(e)=>{let{values:t}=S(e,{...B}),{client:n,json:i,projectId:o}=kW(t),{types:r}=k(await n.sandboxPresets.listTypes(),"Couldn't list sandbox CLI types (check your token and try again)",i),a=Sn(o,i),s=r.map((h)=>({type:h.type,label:h.label,envVars:h.envVarKeys.length>0?h.envVarKeys.join(", "):"(none)",hasSetupSkill:Boolean(h.setupSkill),url:nH(a,h.type)}));X(bye,s,{json:i})},vye=async(e)=>{let{values:t}=S(e,{...B,type:{type:"string"}});if(!t.type){if(t.json)return p("--type is required. Use 'sazabi sandbox-presets types' to see available CLI types.");return m("--type is required. Use 'sazabi sandbox-presets types' to see available CLI types.")}let{client:n,json:i}=kW(t),{types:o}=k(await n.sandboxPresets.listTypes(),"Couldn't list sandbox CLI types (check your token and try again)",i),r=o.find((a)=>a.type===t.type);if(!r){let a=`Unknown sandbox CLI type: ${t.type}. Run 'sazabi sandbox-presets types' to see available types.`;if(i)return p(a);return m(a)}if(!r.setupSkill){let a=`No setup skill available for ${t.type}. This CLI does not have an agent-ready skill yet.`;if(i)return p(a);return m(a)}H(mye,{type:t.type,setupSkill:r.setupSkill},{json:i})},IW=ne("sandbox-presets","Inspect sandbox CLIs").withSubcommands({types:P("types","List available sandbox CLI types",wye).withOptions({...J}).withExamples(["sazabi sandbox-presets types # List all sandbox CLI types","sazabi sandbox-presets types --json # Output as JSON"]).build(),skill:P("skill","Show setup skill for a sandbox CLI type",vye).withOptions({...J,type:{type:"string",description:"Sandbox CLI type (e.g. aws, github, vercel, supabase)"}}).withExamples(["sazabi sandbox-presets skill --type aws # Show AWS setup skill","sazabi sandbox-presets skill --type github # Show GitHub setup skill","sazabi sandbox-presets skill --type vercel --json # Output as JSON"]).build()}).withExamples(["sazabi sandbox-presets types # List available sandbox CLIs","sazabi sandbox-presets skill --type aws # Show setup skill"]).build();te();import{readFile as fye}from"node:fs/promises";ce();ie();var ug=(e)=>({id:e.id,projectId:e.projectId,name:e.name,description:e.description,contentHash:e.contentHash,content:"content"in e?e.content:null,createdAt:e.createdAt,updatedAt:e.updatedAt}),OW={id:{label:"ID",type:{kind:"id"}},projectId:{label:"Project ID",type:{kind:"id"}},name:{label:"Name",type:{kind:"string"}},description:{label:"Description",type:{kind:"nullable-string"}},contentHash:{label:"Content hash",type:{kind:"nullable-string"}},content:{label:"Content",type:{kind:"custom",render:(e)=>e?String(e):"(empty)",serialize:(e)=>e}},createdAt:{label:"Created at",type:{kind:"nullable-date"}},updatedAt:{label:"Updated at",type:{kind:"nullable-date"}}},kye={schema:OW,columns:["name","description","updatedAt"],jsonFields:["id","projectId","name","description","updatedAt"],header:"Scripts",emptyMessage:"No scripts found."},jP={layout:"field-list",schema:OW,fields:["id","projectId","name","description","contentHash","content","createdAt","updatedAt"],title:"Script"},Kc=(e)=>{let t=L({tokenFlag:e.token,projectIdFlag:e.projectId,jsonMode:e.json});return{client:D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json})}},Iye=async()=>{let e=[];process.stdin.setEncoding("utf8");for await(let t of process.stdin)e.push(String(t));return e.join("")},PW=async(e,t,n)=>{let i=e.content!==void 0,o=e.file!==void 0;if(i&&o){if(t){p("Provide script content via exactly one of --content or --file.");return}m("Provide script content via exactly one of --content or --file.");return}if(!i&&!o){if(!n)return;let a="Script content is required. Provide --content <text> or --file <path>.";if(t){p(a);return}m(a);return}if(i)return e.content;let r=e.file;try{return r==="-"?await Iye():await fye(r,"utf8")}catch(a){let s=`Couldn't read script content (check that the --file path exists and is readable): ${a instanceof Error?a.message:String(a)}`;if(t){p(s);return}m(s);return}},Oye=async(e)=>{let{client:t}=Kc(e),n=k(await t.scripts.list({search:e.search,limit:e.limit,cursor:e.cursor}),"Couldn't list scripts (check the active project and try again)",e.json);X(kye,n.scripts.map(ug),{json:e.json,nextCursor:n.nextCursor})},Pye=async(e,t)=>{let{client:n}=Kc(t),i=k(await n.scripts.get(e),"Couldn't get script (run 'sazabi scripts list' to see script names)",t.json);H(jP,ug(i.script),{json:t.json})},Sye=async(e,t)=>{let n=await PW(t,t.json,!0);if(n===void 0)return;let{client:i}=Kc(t),o=k(await i.scripts.create({name:e,content:n,...t.description!==void 0?{description:t.description}:{}}),"Couldn't create script (check the script name and content, then try again)",t.json);if(!t.json)oe(`Script "${o.script.name}" created.`);H(jP,ug(o.script),{json:t.json})},$ye=async(e,t)=>{let n=t.description!==void 0||t.clearDescription===!0;if(t.description!==void 0&&t.clearDescription===!0){if(t.json){p("Use either --description or --clear-description, not both.");return}m("Use either --description or --clear-description, not both.");return}let i=await PW(t,t.json,!1);if(i===void 0&&t.content!==void 0)return;if(i===void 0&&t.file!==void 0)return;if(i===void 0&&!n){if(t.json){p("Nothing to update. Provide --content, --file, --description, or --clear-description.");return}m("Nothing to update. Provide --content, --file, --description, or --clear-description.");return}let{client:o}=Kc(t),r=k(await o.scripts.update(e,{...i!==void 0?{content:i}:{},...t.clearDescription?{description:null}:t.description!==void 0?{description:t.description}:{}}),"Couldn't update script (run 'sazabi scripts list' to see script names)",t.json);if(!t.json)oe(`Script "${r.script.name}" updated.`);H(jP,ug(r.script),{json:t.json})},Tye=async(e,t)=>{let{client:n}=Kc(t);if(k(await n.scripts.delete(e),"Couldn't delete script (run 'sazabi scripts list' to see script names)",t.json),t.json){Q({deleted:!0,name:e});return}oe(`Script "${e}" deleted.`)},Uc={...B,"project-id":{type:"string"}},Ec={...J,"project-id":{type:"string",description:"Override active project ID"}},lg=(e,t)=>{let n=e[0];if(!n){if(t){p("Script name is required.");return}m("Script name is required.");return}return n},SW=ne("scripts","Manage durable project scripts").withSubcommands({list:P("list","List scripts in the active project",async(e)=>{let{values:t}=S(e,{...Uc,search:{type:"string"},limit:{type:"string"},cursor:{type:"string"}}),n=(o)=>{if(t.json){p(o);return}m(o)},i;if(t.limit!==void 0){if(i=Number(t.limit),!Number.isInteger(i)||i<1||i>100)return n(`Invalid --limit value "${t.limit}". Expected an integer between 1 and 100.`)}await Oye({token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],search:t.search,limit:i,cursor:t.cursor})}).withOptions({...Ec,search:{type:"string",description:"Filter by script name (case-insensitive)"},limit:{type:"string",description:"Maximum number of scripts to return (default: 50, max: 100)"},cursor:{type:"string",description:"Pagination cursor from previous response"}}).withExamples(["sazabi scripts list # List project scripts","sazabi scripts list --search deploy # Search scripts by name"]).build(),get:P("get","Get one project script by name",async(e)=>{let{values:t,positionals:n}=S(e,Uc,{allowPositionals:!0}),i=lg(n,t.json);if(!i)return;await Pye(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<name>").withOptions(Ec).withExamples(["sazabi scripts get deploy # Get one script"]).build(),create:P("create","Create a project script",async(e)=>{let{values:t,positionals:n}=S(e,{...Uc,content:{type:"string"},file:{type:"string"},description:{type:"string"}},{allowPositionals:!0}),i=lg(n,t.json);if(!i)return;await Sye(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],content:t.content,file:t.file,description:t.description})}).withPositionalArgs("<name>").withOptions({...Ec,content:{type:"string",description:"Script body text"},file:{type:"string",description:"Read script body from a file, or '-' for stdin"},description:{type:"string",description:"Optional human-readable description"}}).withExamples(["sazabi scripts create deploy --content '#!/usr/bin/env bash' # Create from inline content","sazabi scripts create deploy --file ./deploy.sh # Create from a file"]).build(),update:P("update","Update a project script",async(e)=>{let{values:t,positionals:n}=S(e,{...Uc,content:{type:"string"},file:{type:"string"},description:{type:"string"},"clear-description":{type:"boolean"}},{allowPositionals:!0}),i=lg(n,t.json);if(!i)return;await $ye(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"],content:t.content,file:t.file,description:t.description,clearDescription:t["clear-description"]})}).withPositionalArgs("<name>").withOptions({...Ec,content:{type:"string",description:"New script body text"},file:{type:"string",description:"Read new script body from a file, or '-' for stdin"},description:{type:"string",description:"New human-readable description"},"clear-description":{type:"boolean",description:"Clear the script description"}}).withExamples(["sazabi scripts update deploy --description 'Deploy helper' # Update description only","sazabi scripts update deploy --file ./deploy.sh # Replace script body"]).build(),delete:P("delete","Delete a project script",async(e)=>{let{values:t,positionals:n}=S(e,Uc,{allowPositionals:!0}),i=lg(n,t.json);if(!i)return;await Tye(i,{token:t.token,projectId:t["project-id"],json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<name>").withOptions(Ec).withExamples(["sazabi scripts delete deploy # Delete a script"]).build()}).withExamples(["sazabi scripts list # List project scripts","sazabi scripts get deploy # Get one script","sazabi scripts create deploy --file ./deploy.sh # Create a script","sazabi scripts update deploy --description 'Deploy helper' # Update a script","sazabi scripts delete deploy # Delete a script"]).build();te();ie();Zt();var RP=["apiBaseUrl","authBaseUrl","webBaseUrl","intakeBaseUrl","tailBaseUrl","apiDomain","webDomain","intakeDomain","tailDomain","forwardPublicKey"],$W=(e)=>{return RP.includes(e)},Aye=["apiBaseUrl","authBaseUrl","webBaseUrl","intakeBaseUrl","tailBaseUrl"],Cye=(e)=>Aye.includes(e),Lye={apiBaseUrl:["http:","https:"],authBaseUrl:["http:","https:"],webBaseUrl:["http:","https:"],intakeBaseUrl:["http:","https:"],tailBaseUrl:["ws:","wss:","http:","https:"]},Dye=(e,t)=>{let n=(()=>{try{return new URL(t)}catch{return null}})();if(!n)return We(`Invalid URL for ${e}: '${t}'. Provide a full URL such as https://api.example.com.`);let i=Lye[e];if(!i.includes(n.protocol))return We(`Invalid protocol '${n.protocol}' for ${e}. Allowed: ${i.join(", ")}.`);return rt(n.toString().replace(/\/+$/,""))},zye=(e={})=>{let t=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",e.json),n=On(t),i=k(zt(t),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",e.json);if(e.json){Q({success:!0,settingsFile:Pr,profile:n,settings:i});return}Se({"Settings file":Pr,"Active profile":n}),se();let o=Object.entries(i).filter(([,a])=>a!=null);if(o.length===0){Io("No settings configured.");return}let r=o.map(([a,s])=>({key:a,value:String(s)})).sort((a,s)=>a.key.localeCompare(s.key));dn(r,[{header:"Key",key:"key",width:20},{header:"Value",key:"value"}],{header:"Settings"})},Nye=(e,t,n={})=>{if(!$W(e)){let h=RP.join(", "),l=`Invalid setting key: '${e}'. Valid keys: ${h}.`;if(n.json){p(l);return}m(l);return}let i=t;if(Cye(e)){let h=Dye(e,t);if(!h.success){if(n.json){p(h.error);return}m(h.error);return}i=h.value}let o=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",n.json),r=k(zt(o),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",n.json);if(e==="forwardPublicKey"&&!r.activeProjectId){if(n.json){p("Cannot set forwardPublicKey without an active project. Select a project first with 'sazabi projects use <id>'.");return}m("Cannot set forwardPublicKey without an active project. Select a project first with 'sazabi projects use <id>'.");return}let a=e==="forwardPublicKey"?{forwardPublicKey:i,forwardPublicKeyProjectId:r.activeProjectId}:{[e]:i},s=k(Nt(o,a),"Failed to update profile",n.json);if(k(Ye(s),"Failed to write settings",n.json),n.json){Q({success:!0,key:e,value:i});return}oe(`Set ${e} to ${i}.`)},_ye=(e,t={})=>{if(!$W(e)){let a=RP.join(", "),s=`Invalid setting key: '${e}'. Valid keys: ${a}.`;if(t.json){p(s);return}m(s);return}let n=k(Ue(),"Couldn't read settings (check that ~/.sazabi/settings.json is readable)",t.json),i=k(zt(n),"Couldn't resolve profile (run 'sazabi profiles list' to see available profiles)",t.json),o=e==="forwardPublicKey"?qn(i):{[e]:void 0},r=k(Nt(n,o),"Failed to update profile",t.json);if(k(Ye(r),"Failed to write settings",t.json),t.json){Q({success:!0,key:e});return}oe(`Cleared ${e}.`)},TW=ne("settings","Manage global CLI settings").withSubcommands({view:P("view","Show current CLI settings and file location",async(e)=>{let{values:t}=S(e,{json:{type:"boolean"}});zye({json:t.json})}).withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi settings view # Show current settings","sazabi settings view --json # Output as JSON"]).build(),set:P("set","Set a global configuration value",async(e)=>{let{values:t,positionals:n}=S(e,{json:{type:"boolean"}},{allowPositionals:!0}),i=n[0],o=n[1];if(!i){if(t.json)return p("Setting key is required. Usage: sazabi settings set <key> <value>");return m("Setting key is required. Usage: sazabi settings set <key> <value>")}if(!o){if(t.json)return p("Value is required. Usage: sazabi settings set <key> <value>");return m("Value is required. Usage: sazabi settings set <key> <value>")}Nye(i,o,{json:t.json})}).withPositionalArgs("<key> <value>").withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi settings set apiBaseUrl https://api.example.com # Override a base URL (also: authBaseUrl, webBaseUrl, intakeBaseUrl, tailBaseUrl)"]).build(),unset:P("unset","Clear a global configuration value",async(e)=>{let{values:t,positionals:n}=S(e,{json:{type:"boolean"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Setting key is required. Usage: sazabi settings unset <key>");return m("Setting key is required. Usage: sazabi settings unset <key>")}_ye(i,{json:t.json})}).withPositionalArgs("<key>").withOptions({json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi settings unset apiBaseUrl # Clear API base URL override","sazabi settings unset --json apiBaseUrl # Output as JSON"]).build()}).withExamples(["sazabi settings view # Show current settings","sazabi settings set apiBaseUrl https://api.example.com # Set API base URL","sazabi settings unset apiBaseUrl # Clear API base URL override"]).build();te();ie();import*as EW from"node:os";import*as KW from"node:path";import*as Mn from"node:path";var gg=["claude-code","codex","cursor","amp","opencode"],jye={"claude-code":{user:(e)=>Mn.join(e,".claude","skills"),project:(e)=>Mn.join(e,".claude","skills")},codex:{user:(e)=>Mn.join(e,".agents","skills"),project:(e)=>Mn.join(e,".agents","skills")},amp:{user:(e)=>Mn.join(e,".config","agents","skills"),project:(e)=>Mn.join(e,".agents","skills")},opencode:{user:(e)=>Mn.join(e,".config","opencode","skills"),project:(e)=>Mn.join(e,".opencode","skills")}},Rye="Cursor does not support agent skills. Use Cursor Rules (.cursor/rules/*.mdc) instead. See https://cursor.com/docs/context/rules.",AW=(e)=>{if(e.agent==="cursor")return{kind:"unsupported",agent:"cursor",reason:Rye};let t=jye[e.agent],n=e.scope==="user"?t.user(e.home):t.project(e.projectDir);return{kind:"supported",agent:e.agent,scope:e.scope,root:n}};zf();import{dirname as Gye,resolve as Bye}from"node:path";import{fileURLToPath as Jye}from"node:url";var CW=`# Sazabi CLI Reference
|
|
8606
8606
|
|
|
8607
8607
|
The CLI is published as \`@sazabi/cli\`. Every command supports \`--json\` for machine-readable output and \`-h\` for help.
|
|
8608
8608
|
|
|
@@ -9445,5 +9445,5 @@ The full API reference is available at https://api.sazabi.com/docs (interactive
|
|
|
9445
9445
|
### CLI
|
|
9446
9446
|
- \`references/cli/setup.md\` — Installation, authentication, credential precedence, settings
|
|
9447
9447
|
- \`references/cli/commands.md\` — All CLI commands, log tailing, log forwarding, JSON mode
|
|
9448
|
-
`;var
|
|
9448
|
+
`;var Y3e=Bye(Gye(Jye(import.meta.url)),"../skills"),qye=[...ji].sort().map((e)=>({relPath:`references/data-sources/${e}.md`,contents:kv(e)})),NW=[{name:"sazabi",files:[{relPath:"SKILL.md",contents:zW},{relPath:"references/cli/commands.md",contents:CW},{relPath:"references/cli/setup.md",contents:LW},{relPath:"references/mcp/setup.md",contents:DW},...qye]}];var Lr=NW;ie();import*as at from"node:fs";import*as Me from"node:path";var jW=(e)=>{let t=[],n=Me.resolve(e.targetRoot);for(let i of e.skills){let o=Me.join(n,i.name),r=Me.relative(n,o);if(r.startsWith("..")||Me.isAbsolute(r))return We(`Invalid skill name "${i.name}" escapes target root.`);let a=[];for(let s of i.files){let h=Me.resolve(o,s.relPath),l=Me.relative(o,h);if(l.startsWith("..")||Me.isAbsolute(l))return We(`Invalid skill file path "${s.relPath}" in skill "${i.name}" escapes skill root.`);a.push({absPath:h,contents:s.contents})}t.push({skillName:i.name,files:a})}return rt(t)},RW=(e)=>{let t=[];for(let n of e)for(let i of n.files)if(at.existsSync(i.absPath))t.push(i.absPath);return t},_W=(e)=>{let t=Me.resolve(e);while(!at.existsSync(t)){let n=Me.dirname(t);if(n===t)break;t=n}return t},UW=(e,t)=>{try{let n;if(t.targetRoot){let a=_W(t.targetRoot);n=at.existsSync(a)?at.realpathSync(a):Me.resolve(t.targetRoot)}let i=[];for(let a of e)for(let s of a.files)i.push({absPath:s.absPath,contents:s.contents,existed:at.existsSync(s.absPath)});if(!t.force){let a=i.find((s)=>s.existed);if(a)return We(`Refusing to overwrite ${a.absPath}. Use --force to overwrite.`)}let o=[],r=[];for(let a of i){if(n){let h=Me.dirname(a.absPath),l=_W(h);if(at.existsSync(l)){let u=at.realpathSync(l),d=Me.relative(n,u);if(d.startsWith("..")||Me.isAbsolute(d))return We(`Refusing to write ${a.absPath}: symlink escape detected (resolves outside target root).`)}}at.mkdirSync(Me.dirname(a.absPath),{recursive:!0,mode:493});let s=!1;try{if(at.lstatSync(a.absPath).isSymbolicLink())s=!0}catch(h){if(!(h instanceof Error&&("code"in h)&&h.code==="ENOENT"))throw h}if(s)return We(`Refusing to write ${a.absPath}: path is a symbolic link.`);if(t.force&&a.existed)try{at.unlinkSync(a.absPath)}catch(h){if(!(h instanceof Error&&("code"in h)&&h.code==="ENOENT"))throw h}try{at.writeFileSync(a.absPath,a.contents,{encoding:"utf-8",mode:420,flag:"wx"})}catch(h){if(h instanceof Error&&"code"in h&&h.code==="EEXIST"){let l=t.force?`Failed to write ${a.absPath}: file was recreated during operation (possible race condition). Try again.`:`Refusing to overwrite ${a.absPath}. Use --force to overwrite.`;return We(l)}throw h}if(a.existed)r.push(a.absPath);else o.push(a.absPath)}return rt({written:o,overwritten:r})}catch(n){let i=n instanceof Error?n.message:String(n);return We(`Failed to write skill files: ${i}`)}};var Zo=(e,t)=>{if(t)return p(e);return m(e)},Hye=(e)=>e!==void 0&&gg.includes(e),xW=async(e)=>{let t=Boolean(e.json);if(!e.agent)return void Zo(`Agent is required. Usage: sazabi skill install <agent>. Known agents: ${gg.join(", ")}.`,t);if(!Hye(e.agent))return void Zo(`Unknown agent '${e.agent}'. Known agents: ${gg.join(", ")}.`,t);let n=e.agent;if(e.user&&e.project)return void Zo("--user and --project are mutually exclusive.",t);if(e.projectDir!==void 0&&!e.project)return void Zo("--project-dir is only valid with --project.",t);let i=e.project?"project":"user",o=e.projectDir!==void 0?KW.resolve(e.projectDir):process.cwd(),r=AW({agent:n,scope:i,home:EW.homedir(),projectDir:o});if(r.kind==="unsupported")return void Zo(r.reason,t);if(Lr.length===0)return void Zo("No skills are available to install.",t);let a=k(jW({targetRoot:r.root,skills:Lr}),"Failed to plan skill installation",t);if(!e.force){let h=RW(a);if(h.length>0)return void Zo(["Refusing to overwrite existing files (use --force to overwrite):",...h.map((l)=>` ${l}`)].join(`
|
|
9449
9449
|
`),t)}let s=k(UW(a,{force:Boolean(e.force),targetRoot:r.root}),"Failed to install skills",t);if(t){Q({agent:n,scope:i,targetRoot:r.root,skills:Lr.map((h)=>({name:h.name,files:h.files.map((l)=>l.relPath)})),written:s.written,overwritten:s.overwritten});return}Ie("Installed skills"),Se({Agent:n,Scope:i,Destination:r.root});for(let h of s.written)oe(`wrote ${h}`);for(let h of s.overwritten)Ut(`replaced ${h}`);oe(`Installed ${Lr.length} skill${Lr.length===1?"":"s"} to ${r.root}`)};var GW=ne("skill","Manage Sazabi agent skills").withSubcommands({install:P("install","Install Sazabi skills into your AI agent's skills directory",async(e)=>{let{values:t,positionals:n}=S(e,{user:{type:"boolean"},project:{type:"boolean"},"project-dir":{type:"string"},force:{type:"boolean"},json:{type:"boolean"}},{allowPositionals:!0});await xW({agent:n[0],user:t.user,project:t.project,projectDir:t["project-dir"],force:t.force,json:t.json})}).withPositionalArgs("<agent>").withOptions({user:{type:"boolean",description:"Install into the user-scoped skills directory (default)"},project:{type:"boolean",description:"Install into the project-scoped skills directory"},"project-dir":{type:"string",description:"Project directory for --project (default: current working directory)"},force:{type:"boolean",description:"Overwrite existing skill files"},json:{type:"boolean",description:"Output as JSON"}}).withExamples(["sazabi skill install claude-code # Install for Claude Code in $HOME (default --user)","sazabi skill install codex --project # Install into current repo","sazabi skill install codex --project --project-dir ../other # Install into another repo","sazabi skill install claude-code --force # Overwrite existing files"]).build()}).withExamples(["sazabi skill install claude-code # Install Sazabi skills for Claude Code in $HOME","sazabi skill install codex --project # Install Sazabi skills into the current repo"]).build();te();ce();ie();te();ce();ie();var Wye={id:{label:"ID",type:{kind:"string"}},componentId:{label:"Component",type:{kind:"string"}},projectId:{label:"Project",type:{kind:"string"}},severity:{label:"Severity",type:{kind:"string"}},summary:{label:"Summary",type:{kind:"string"}},startedAt:{label:"Started at",type:{kind:"date"}},resolvedAt:{label:"Resolved at",type:{kind:"nullable-date"}}},UP={schema:Wye,columns:["id","componentId","severity","startedAt","resolvedAt"],jsonFields:["id","componentId","projectId","severity","summary","startedAt","resolvedAt"],emptyMessage:"No status page issues found."},Mye={timestamp:{label:"Time",type:{kind:"date"}},status:{label:"Status",type:{kind:"string"}}},BW={schema:Mye,columns:["timestamp","status"],emptyMessage:"No timeline data available."},JW=(e)=>{let t=L({tokenFlag:e.token,jsonMode:e.json});return D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json})},Yye=async(e)=>{let t=JW(e),n=k(await t.statusComponents.incidents.list({...e.componentId?{componentId:e.componentId}:{},activeOnly:e.activeOnly,limit:e.limit,cursor:e.cursor}),"Couldn't list status page issues (check the active project and try again)",e.json);X(UP,n.incidents,{json:e.json,nextCursor:n.nextCursor})},Xye=async(e,t)=>{let n=JW(t),i=k(await n.statusComponents.timeline({componentId:e,...t.windowStart?{windowStart:t.windowStart}:{},...t.windowEnd?{windowEnd:t.windowEnd}:{}}),"Couldn't fetch status timeline (check the component ID and try again)",t.json);if(t.json){X(BW,i.timeline,{json:!0}),X(UP,i.incidents,{json:!0});return}Ie("Status timeline"),X(BW,i.timeline),Ie("Issues"),X(UP,i.incidents)},qW=P("incidents","List status page issues").withSubcommands({list:P("list","List status page issues in the active project",async(e)=>{let{values:t}=S(e,{...B,"component-id":{type:"string"},"active-only":{type:"boolean"},limit:{type:"string"},cursor:{type:"string"}}),n=t.limit?Number(t.limit):void 0;if(n!==void 0&&(!Number.isInteger(n)||n<1||n>100)){if(t.json)return p("Invalid --limit. Must be an integer between 1 and 100.");return m("Invalid --limit. Must be an integer between 1 and 100.")}await Yye({token:t.token,json:t.json,apiBaseUrl:t["api-base-url"],componentId:t["component-id"],activeOnly:t["active-only"],limit:n,cursor:t.cursor})}).withOptions({...J,"component-id":{type:"string",description:"Filter issues to a single component"},"active-only":{type:"boolean",description:"Only show unresolved (ongoing) issues"},limit:{type:"string",description:"Maximum number of issues to return (default: 50, max: 100)"},cursor:{type:"string",description:"Pagination cursor from previous response"}}).withExamples(["sazabi status incidents list # List recent issues","sazabi status incidents list --active-only # Only ongoing issues","sazabi status incidents list --component-id <id> --json # Issues for one component"]).build()}).withExamples(["sazabi status incidents list # List recent issues","sazabi status incidents list --active-only # List ongoing issues"]).build(),HW=P("timeline","Show the status timeline and issues for a component",async(e)=>{let{values:t,positionals:n}=S(e,{...B,"window-start":{type:"string"},"window-end":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Component ID is required.");return m("Component ID is required.")}await Xye(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"],windowStart:t["window-start"],windowEnd:t["window-end"]})}).withPositionalArgs("<component-id>").withOptions({...J,"window-start":{type:"string",description:"ISO timestamp for timeline window start (defaults to 7 days ago)"},"window-end":{type:"string",description:"ISO timestamp for timeline window end (defaults to now)"}}).withExamples(["sazabi status timeline <component-id> # Last 7 days","sazabi status timeline <component-id> --window-start 2026-06-01T00:00:00Z --window-end 2026-06-08T00:00:00Z # Custom window"]).build();var Zye={id:{label:"ID",type:{kind:"string"}},name:{label:"Name",type:{kind:"string"}},currentStatus:{label:"Status",type:{kind:"string"}},firstSeenAt:{label:"Created at",type:{kind:"date"}}},Fye={schema:Zye,columns:["id","name","currentStatus","firstSeenAt"],emptyMessage:"All clear. No status components found."},Qye=async(e)=>{let t=L({tokenFlag:e.token,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),i=k(await n.statusComponents.list(),"Couldn't fetch status (check the active project and try again)",e.json);if(e.json){Q(i);return}if(Ie("Status page"),t.projectId)Se({URL:Vq(t.projectId)});X(Fye,i.statusComponents)},WW=ne("status","Show a summary of the status page").withHandler(async(e)=>{let{values:t}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}});await Qye({token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withSubcommands({incidents:qW,timeline:HW}).withExamples(["sazabi status # Show status page summary","sazabi status --json # Output as JSON","sazabi status incidents list --active-only # List ongoing issues","sazabi status timeline <component-id> # Show component timeline"]).build();te();ce();ie();var MW={id:{label:"ID",type:{kind:"string"}},projectId:{label:"Project",type:{kind:"string"}},name:{label:"Name",type:{kind:"string"}},currentStatus:{label:"Status",type:{kind:"string"}},description:{label:"Description",type:{kind:"nullable-string"}},firstSeenAt:{label:"Created at",type:{kind:"date"}},lastSeenAt:{label:"Last seen",type:{kind:"date"}},deletedAt:{label:"Deleted at",type:{kind:"nullable-date"}}},Vye={schema:MW,columns:["id","name","currentStatus","firstSeenAt","deletedAt"],jsonFields:["id","projectId","name","currentStatus","description","firstSeenAt","lastSeenAt","deletedAt"],emptyMessage:"No status components found. Register one with 'sazabi status-components register --name <name>'."},EP={layout:"field-list",schema:MW,fields:["id","projectId","name","currentStatus","description","firstSeenAt","lastSeenAt","deletedAt"],title:"Status component"},ebe=async(e)=>{let t=L({tokenFlag:e.token,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),i=k(await n.statusComponents.list({limit:e.limit,cursor:e.cursor,includeDeleted:e.includeDeleted}),"Couldn't list status components (check the active project and try again)",e.json);X(Vye,i.statusComponents,{json:e.json,nextCursor:i.nextCursor})},tbe=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),o=k(await i.statusComponents.get(e),"Couldn't get status component (run 'sazabi status-components list' to see component IDs)",t.json);H(EP,o.statusComponent,{json:t.json})},nbe=async(e)=>{let t=e.name?.trim(),n=e.description?.trim();if(!t){if(e.json)return p("Name is required.");return m("Name is required.")}if(e.description!==void 0&&!n){if(e.json)return p("Description cannot be empty.");return m("Description cannot be empty.")}let i=L({tokenFlag:e.token,jsonMode:e.json}),o=D({token:i.token,organizationId:i.organizationId,projectId:i.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),r=k(await o.statusComponents.register({name:t,...n?{description:n}:{}}),"Failed to register status component",e.json);H(EP,r.statusComponent,{json:e.json})},obe=async(e,t)=>{let n=t.reason?.trim();if(t.reason!==void 0&&!n){if(t.json)return p("Reason cannot be empty.");return m("Reason cannot be empty.")}let i=L({tokenFlag:t.token,jsonMode:t.json}),o=D({token:i.token,organizationId:i.organizationId,projectId:i.projectId,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),r=k(await o.statusComponents.deregister(e,n),"Failed to deregister status component",t.json);H(EP,r.statusComponent,{json:t.json})},YW=ne("status-components","Manage status page components").withSubcommands({list:P("list","List status components in the active project",async(e)=>{let{values:t}=S(e,{...B,limit:{type:"string"},cursor:{type:"string"},"include-deleted":{type:"boolean"}});await ebe({token:t.token,json:t.json,apiBaseUrl:t["api-base-url"],limit:t.limit?Number(t.limit):void 0,cursor:t.cursor,includeDeleted:t["include-deleted"]})}).withOptions({...J,limit:{type:"string",description:"Maximum number of components to return (default: 50, max: 100)"},cursor:{type:"string",description:"Pagination cursor from previous response"},"include-deleted":{type:"boolean",description:"Include deregistered status components"}}).withExamples(["sazabi status-components list # List all status components","sazabi status-components list --include-deleted # Include deregistered components"]).build(),get:P("get","Get one status component by ID",async(e)=>{let{values:t,positionals:n}=S(e,B,{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Component ID is required.");return m("Component ID is required.")}await tbe(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<component-id>").withOptions(J).withExamples(["sazabi status-components get <component-id> # Get one status component"]).build(),register:P("register","Register or refresh a status component",async(e)=>{let{values:t}=S(e,{...B,name:{type:"string"},description:{type:"string"}});await nbe({token:t.token,json:t.json,apiBaseUrl:t["api-base-url"],name:t.name,description:t.description})}).withOptions({...J,name:{type:"string",description:"Component name to register"},description:{type:"string",description:"Optional component description"}}).withExamples(['sazabi status-components register --name "API Gateway" # Register a component','sazabi status-components register --name "Checkout" --description "Checkout API and workflow" # Register with description']).build(),deregister:P("deregister","Deregister a status component",async(e)=>{let{values:t,positionals:n}=S(e,{...B,reason:{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Component ID is required.");return m("Component ID is required.")}await obe(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"],reason:t.reason})}).withPositionalArgs("<component-id>").withOptions({...J,reason:{type:"string",description:"Optional deregistration reason"}}).withExamples(["sazabi status-components deregister <component-id> # Deregister a component",'sazabi status-components deregister <component-id> --reason "service retired" # Deregister with reason']).build()}).withExamples(["sazabi status-components list # List all status components","sazabi status-components get <component-id> # Get one status component",'sazabi status-components register --name "API Gateway" # Register a component',"sazabi status-components deregister <component-id> # Deregister a component"]).build();te();ce();ie();var FW={id:{label:"ID",type:{kind:"id"}},label:{label:"Task",type:{kind:"string"}},description:{label:"Description",type:{kind:"string"}},instructions:{label:"Instructions",type:{kind:"string"}},completed:{label:"Status",type:{kind:"custom",render:(e)=>e?_e.success("✓ Done"):_e.muted("○ Pending"),serialize:(e)=>e}},completedAt:{label:"Completed at",type:{kind:"nullable-date",emptyLabel:"(none)"}},category:{label:"Category",type:{kind:"string"}}},ibe={schema:FW,columns:["completed","label","id","category"],header:"Onboarding and setup tasks",emptyMessage:"No tasks found."},rbe={layout:"field-list",schema:FW,fields:["id","label","completed","completedAt","category","description","instructions"],title:"Task"},abe=async(e)=>{let t=L({tokenFlag:e.token,projectIdFlag:e.projectId,organizationIdFlag:e.organizationId,jsonMode:e.json}),n=D({token:t.token,organizationId:t.organizationId,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl,jsonMode:e.json}),i=k(await n.tasks.list(),"Couldn't list tasks (check the active project and try again)",e.json);X(ibe,i.tasks,{json:e.json})},cbe=async(e,t)=>{let n=L({tokenFlag:t.token,projectIdFlag:t.projectId,organizationIdFlag:t.organizationId,jsonMode:t.json}),i=D({token:n.token,organizationId:n.organizationId,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl,jsonMode:t.json}),r=k(await i.tasks.list(),"Couldn't list tasks (check the active project and try again)",t.json).tasks.find((a)=>a.id===e);if(!r){let a=`Task not found: ${e}. Run 'sazabi tasks list' to see available tasks.`;if(t.json)return p(a);return m(a)}H(rbe,r,{json:t.json})},XW={...B,"project-id":{type:"string"},"organization-id":{type:"string"}},ZW={...J,"project-id":{type:"string",description:"Override active project ID"},"organization-id":{type:"string",description:"Override active organization ID"}},QW=ne("tasks","View onboarding and setup tasks").withSubcommands({list:P("list","List all onboarding and setup tasks for the active project",async(e)=>{let{values:t}=S(e,XW);await abe({token:t.token,projectId:t["project-id"],organizationId:t["organization-id"],apiBaseUrl:t["api-base-url"],json:t.json})}).withOptions(ZW).withExamples(["sazabi tasks list # List all tasks for the active project","sazabi tasks list --json # Output tasks as JSON"]).build(),get:P("get","Get one task by ID",async(e)=>{let{values:t,positionals:n}=S(e,XW,{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Task ID is required.");return m("Task ID is required.")}await cbe(i,{token:t.token,projectId:t["project-id"],organizationId:t["organization-id"],apiBaseUrl:t["api-base-url"],json:t.json})}).withPositionalArgs("<task-id>").withOptions(ZW).withExamples(["sazabi tasks get install_github_app # Show task details and instructions","sazabi tasks get send_message --json # Output as JSON"]).build()}).withExamples(["sazabi tasks list # List all tasks","sazabi tasks list --json # List tasks as JSON","sazabi tasks get install_github_app # Get one task by ID","sazabi tasks get send_message --json # Get one task as JSON"]).build();te();te();ce();ie();var sbe={id:{label:"ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"string"}},title:{label:"Title",type:{kind:"nullable-string",emptyLabel:"(no title)"}},status:{label:"Status",type:{kind:"string"}},createdAt:{label:"Created",type:{kind:"date"}},updatedAt:{label:"Updated",type:{kind:"date"}}},hbe={layout:"field-list",schema:sbe,fields:["id","url","title","status","createdAt","updatedAt"]},VW=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),{thread:o}=k(await i.threads.update(e,"archived"),"Failed to archive thread",t.json),r={...o,url:Xe(o.projectId,o.id)};H(hbe,r,{json:t.json})};te();ce();ie();var lbe={id:{label:"ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"string"}},title:{label:"Title",type:{kind:"nullable-string",emptyLabel:"(no title)"}},status:{label:"Status",type:{kind:"string"}},createdAt:{label:"Created",type:{kind:"date"}},updatedAt:{label:"Updated",type:{kind:"date"}}},ube={layout:"field-list",schema:lbe,fields:["id","url","title","status","createdAt","updatedAt"],title:"Forked thread"},eM=async(e,t,n)=>{let i=L({tokenFlag:n.token,jsonMode:n.json}),o=D({token:i.token,projectId:i.projectId,apiBaseUrlFlag:n.apiBaseUrl}),{thread:r}=k(await o.threads.fork(e,t),"Failed to fork thread",n.json),a={...r,url:Xe(r.projectId,r.id)};H(ube,a,{json:n.json})};te();ce();ie();var gbe={id:{label:"ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"string"}},title:{label:"Title",type:{kind:"nullable-string",emptyLabel:"(no title)"}},status:{label:"Status",type:{kind:"string"}},createdAt:{label:"Created",type:{kind:"date"}},updatedAt:{label:"Updated",type:{kind:"date"}}},dbe={id:{label:"ID",type:{kind:"id"}},role:{label:"Role",type:{kind:"role"}},createdAt:{label:"When",type:{kind:"date"}},text:{label:"Message",type:{kind:"truncated",maxLength:80}}},ybe=(e)=>{for(let t of e.content){if(t.type==="message"&&t.message)return t.message;if(t.type==="tool_call")return`[tool: ${t.name}]`;if(t.type==="artifact")return`[artifact: ${t.name}]`;if(t.type==="summary")return"[summary]";if(t.type==="reasoning")return"[reasoning]";if(t.type==="fork")return"[fork]";if(t.type==="slack_context")return"[Slack context]";if(t.type==="teams_context")return"[Teams context]"}return"(empty)"},tM=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),{thread:o,messages:r}=k(await i.threads.get(e),"Couldn't get thread (run 'sazabi threads list' to see thread IDs)",t.json);if(t.json){Q({thread:o,messages:r});return}let a=Tr(fP({apiBaseUrlFlag:t.apiBaseUrl})),s={...o,url:Xe(o.projectId,o.id,a)},h=r.map((l)=>({id:l.id,role:l.role,createdAt:l.createdAt,text:ybe(l)}));H({layout:"field-list",schema:gbe,fields:["id","url","title","status","createdAt","updatedAt"],title:"Thread"},s),se(),X({schema:dbe,columns:["id","role","createdAt","text"],header:"Messages",emptyMessage:"No messages."},h)};te();ce();ie();var bbe={id:{label:"ID",type:{kind:"string"}},projectId:{label:"Project",type:{kind:"string"}},url:{label:"URL",type:{kind:"string"}},title:{label:"Title",type:{kind:"nullable-string",emptyLabel:"(no title)"}},status:{label:"Status",type:{kind:"string"}},updatedAt:{label:"Updated",type:{kind:"date"}}},pbe={schema:bbe,columns:["id","title","status","updatedAt","url"],jsonFields:["id","projectId","url","title","status","updatedAt"],header:"Threads",emptyMessage:"No threads found."},nM=async(e)=>{let t=L({tokenFlag:e.token,jsonMode:e.json}),i=await D({token:t.token,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl}).threads.list({limit:e.limit,cursor:e.cursor,status:e.status}),{threads:o,nextCursor:r}=k(i,"Couldn't list threads (check the active project and try again)",e.json),a=o.map((s)=>({...s,url:Xe(s.projectId,s.id)}));X(pbe,a,{json:e.json,nextCursor:r})};te();ce();ie();var mbe={id:{label:"ID",type:{kind:"string"}},projectId:{label:"Project",type:{kind:"string"}},url:{label:"URL",type:{kind:"string"}},title:{label:"Title",type:{kind:"nullable-string",emptyLabel:"(no title)"}},status:{label:"Status",type:{kind:"string"}},score:{label:"Score",align:"right",type:{kind:"custom",render:(e)=>e!=null?e.toFixed(2):"-"}}},wbe={schema:mbe,columns:["id","title","status","score","url"],jsonFields:["id","projectId","url","title","status","score"],header:{title:"Search Results",variant:"search"},emptyMessage:"No matching threads found."},oM=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),{threads:o,pagination:r}=k(await i.search.threads({query:e,limit:t.limit,page:t.page,status:t.status}),"Failed to search threads",t.json),a=o.map((s)=>({...s,url:Xe(s.projectId??Sn(n.projectId,t.json),s.id)}));if(t.json){Q({threads:a,pagination:r});return}X(wbe,a,{count:r.totalResults}),Cn({type:"page",page:r.page,totalPages:r.totalPages})};te();ce();ie();var iM={shareId:{label:"Share ID",type:{kind:"id"}},threadId:{label:"Thread ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"string"}},createdAt:{label:"Created",type:{kind:"date"}}},vbe={layout:"field-list",schema:iM,fields:["shareId","threadId","url","createdAt"],title:"Share link"},KP=(e)=>{let t=L({tokenFlag:e.token,jsonMode:e.json});return D({token:t.token,projectId:t.projectId,apiBaseUrlFlag:e.apiBaseUrl})},rM=async(e,t)=>{let n=KP(t),{share:i}=k(await n.threads.createShareLink(e),"Failed to create share link",t.json);H(vbe,i,{json:t.json})},aM=async(e,t)=>{let n=KP(t),{shares:i}=k(await n.threads.listShareLinks(e),"Couldn't list share links (verify the thread ID and try again)",t.json);X({schema:iM,columns:["shareId","url","createdAt"],header:"Share links",emptyMessage:"No active share links."},i,{json:t.json})},cM=async(e,t,n)=>{let i=KP(n);if(k(await i.threads.revokeShareLink(e,t),"Failed to revoke share link",n.json),H({layout:"field-list",schema:{shareId:{label:"Share ID",type:{kind:"id"}},revoked:{label:"Revoked",type:{kind:"string"}}},fields:["shareId","revoked"]},{shareId:t,revoked:!0},{json:n.json}),!n.json)oe(`Revoked share link ${t}.`)};te();ce();ie();var sM=async(e,t={})=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),o=k(await i.threads.stop(e),"Failed to stop thread",t.json);if(t.json){Q({...o,threadId:e});return}oe(`Requested stop for thread ${e}.`),ye(`Stop is best-effort; check status with: sazabi threads get ${e}`)};ce();var hM=async(e,t={})=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl});await hg({json:t.json,label:`thread ${e}`,resumeCommand:`sazabi threads stream ${e}`,errorContext:`Couldn't stream thread (retry with 'sazabi threads stream ${e}')`,open:(o)=>i.threads.stream({threadId:e,...t.cursor?{cursor:t.cursor}:{},signal:o})})};te();ce();ie();var fbe={id:{label:"ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"string"}},title:{label:"Title",type:{kind:"nullable-string",emptyLabel:"(no title)"}},status:{label:"Status",type:{kind:"string"}},createdAt:{label:"Created",type:{kind:"date"}},updatedAt:{label:"Updated",type:{kind:"date"}}},kbe={layout:"field-list",schema:fbe,fields:["id","url","title","status","createdAt","updatedAt"]},lM=async(e,t)=>{let n=L({tokenFlag:t.token,jsonMode:t.json}),i=D({token:n.token,projectId:n.projectId,apiBaseUrlFlag:t.apiBaseUrl}),{thread:o}=k(await i.threads.update(e,"regular"),"Failed to unarchive thread",t.json),r={...o,url:Xe(o.projectId,o.id)};H(kbe,r,{json:t.json})};te();ce();ie();var Ibe={id:{label:"ID",type:{kind:"id"}},url:{label:"URL",type:{kind:"string"}},title:{label:"Title",type:{kind:"nullable-string",emptyLabel:"(no title)"}},visibility:{label:"Visibility",type:{kind:"string"}},status:{label:"Status",type:{kind:"string"}},createdAt:{label:"Created",type:{kind:"date"}},updatedAt:{label:"Updated",type:{kind:"date"}}},Obe={layout:"field-list",schema:Ibe,fields:["id","url","title","visibility","status","createdAt","updatedAt"]},uM=async(e,t,n)=>{let i=L({tokenFlag:n.token,jsonMode:n.json}),o=D({token:i.token,projectId:i.projectId,apiBaseUrlFlag:n.apiBaseUrl}),{thread:r,visibility:a}=k(await o.threads.setVisibility(e,t),"Failed to set thread visibility",n.json),s={...r,visibility:a,url:Xe(r.projectId,r.id)};H(Obe,s,{json:n.json})};var gM=ne("threads","Manage agent threads").withSubcommands({list:P("list","List threads from the active project",async(e)=>{let{values:t}=S(e,{token:{type:"string"},limit:{type:"string"},cursor:{type:"string"},status:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}}),n={token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]};if(t.limit)n.limit=ht(t.limit,1,100,"Limit",t.json);if(t.cursor)n.cursor=t.cursor;if(t.status)n.status=Tt(t.status,["regular","archived"],"Status",t.json);await nM(n)}).withOptions({token:{type:"string",description:"Override token"},limit:{type:"string",description:"Maximum number of threads to return (default: 20, max: 100)"},cursor:{type:"string",description:"Pagination cursor from previous response"},status:{type:"string",description:"Filter by status: regular or archived"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi threads list # List all threads","sazabi threads list --limit 50 # List with custom limit","sazabi threads list --status archived # List archived threads","sazabi threads list --cursor xyz # List next page"]).build(),get:P("get","Get thread with messages",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Thread ID is required. Usage: sazabi threads get <thread-id>");return m("Thread ID is required. Usage: sazabi threads get <thread-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`)}await tM(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id>").withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi threads get <thread-id> # Get thread with messages","sazabi threads get <thread-id> --json # Output as JSON"]).build(),search:P("search","Search threads in the active project",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},limit:{type:"string"},page:{type:"string"},status:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n.join(" ");if(!i){if(t.json)return p("Search query is required. Usage: sazabi threads search <query>");return m("Search query is required. Usage: sazabi threads search <query>")}let o={token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]};if(t.limit)o.limit=ht(t.limit,1,100,"Limit",t.json);if(t.page)o.page=ht(t.page,1,Number.MAX_SAFE_INTEGER,"Page",t.json);if(t.status)o.status=Tt(t.status,["regular","archived"],"Status",t.json);await oM(i,o)}).withPositionalArgs("<query>").withOptions({token:{type:"string",description:"Override token"},limit:{type:"string",description:"Maximum number of results (default: 20, max: 100)"},page:{type:"string",description:"Page number for pagination (default: 1)"},status:{type:"string",description:"Filter by status: regular or archived"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(['sazabi threads search "error handling" # Search threads','sazabi threads search "bug" --limit 50 # Search with limit','sazabi threads search "authentication" --status regular # Search only regular threads']).build(),archive:P("archive","Archive a thread",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Thread ID is required. Usage: sazabi threads archive <thread-id>");return m("Thread ID is required. Usage: sazabi threads archive <thread-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`)}await VW(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id>").withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi threads archive <thread-id> # Archive a thread","sazabi threads archive <thread-id> --json # Output as JSON"]).build(),unarchive:P("unarchive","Unarchive a thread",async(e)=>{let{values:t,positionals:n}=S(e,{token:{type:"string"},json:{type:"boolean"},"api-base-url":{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Thread ID is required. Usage: sazabi threads unarchive <thread-id>");return m("Thread ID is required. Usage: sazabi threads unarchive <thread-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`)}await lM(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id>").withOptions({token:{type:"string",description:"Override token"},json:{type:"boolean",description:"Output as JSON"},"api-base-url":{type:"string",description:"Override API base URL"}}).withExamples(["sazabi threads unarchive <thread-id> # Unarchive a thread","sazabi threads unarchive <thread-id> --json # Output as JSON"]).build(),fork:P("fork","Fork a thread from a message into a new thread",async(e)=>{let{values:t,positionals:n}=S(e,{...B,"message-id":{type:"string",short:"m"}},{allowPositionals:!0}),i=n[0],o=t["message-id"],r=n[1];if(o&&r&&o!==r){let s=`Conflicting message IDs: --message-id ${o} and positional ${r}. Provide only one.`;if(t.json)return p(s);return m(s)}let a=o??r;if(!i||!a){if(t.json)return p("Thread ID and message ID are required. Usage: sazabi threads fork <thread-id> --message-id <message-id>");return m("Thread ID and message ID are required. Usage: sazabi threads fork <thread-id> --message-id <message-id>")}if(n.length>2){let s=n.slice(2).join(", ");if(t.json)return p(`Unexpected arguments: ${s}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${s}. Run 'sazabi threads -h' for usage.`)}await eM(i,a,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id>").withOptions({...J,"message-id":{type:"string",short:"m",description:"Message ID to fork from (copies messages up to it)"}}).withExamples(["sazabi threads fork <thread-id> --message-id <message-id> # Fork from a message","sazabi threads fork <thread-id> -m <message-id> --json # Output as JSON"]).build(),visibility:P("visibility","Set a thread's visibility (private or organization)",async(e)=>{let{values:t,positionals:n}=S(e,{...B},{allowPositionals:!0}),i=n[0],o=n[1];if(!i||!o){if(t.json)return p("Thread ID and visibility are required. Usage: sazabi threads visibility <thread-id> <private|organization>");return m("Thread ID and visibility are required. Usage: sazabi threads visibility <thread-id> <private|organization>")}if(n.length>2){let a=n.slice(2).join(", ");if(t.json)return p(`Unexpected arguments: ${a}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${a}. Run 'sazabi threads -h' for usage.`)}let r=Tt(o,["private","organization"],"Visibility",t.json);await uM(i,r,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id> <private|organization>").withOptions({...J}).withExamples(["sazabi threads visibility <thread-id> private # Restrict to owner","sazabi threads visibility <thread-id> organization # Share with organization"]).build(),stop:P("stop","Stop a thread's in-flight run",async(e)=>{let{values:t,positionals:n}=S(e,{...B},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Thread ID is required. Usage: sazabi threads stop <thread-id>");return m("Thread ID is required. Usage: sazabi threads stop <thread-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`)}await sM(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id>").withOptions({...J}).withExamples(["sazabi threads stop <thread-id> # Stop the thread's active run","sazabi threads stop <thread-id> --json # Output the result as JSON"]).build(),stream:P("stream","Stream a thread's live agent-run events",async(e)=>{let{values:t,positionals:n}=S(e,{...B,cursor:{type:"string"}},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Thread ID is required. Usage: sazabi threads stream <thread-id>");return m("Thread ID is required. Usage: sazabi threads stream <thread-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`)}await hM(i,{token:t.token,cursor:t.cursor,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id>").withOptions({...J,cursor:{type:"string",description:"Resume from a prior stream cursor after a disconnect"}}).withExamples(["sazabi threads stream <thread-id> # Follow live thread events","sazabi threads stream <thread-id> --json # Emit NDJSON events for tools","sazabi threads stream <thread-id> --cursor seq:42 # Resume after a disconnect"]).build(),share:ne("share","Manage public read-only share links for a thread").withSubcommands({create:P("create","Create a public read-only snapshot link for a thread",async(e)=>{let{values:t,positionals:n}=S(e,{...B},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Thread ID is required. Usage: sazabi threads share create <thread-id>");return m("Thread ID is required. Usage: sazabi threads share create <thread-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`)}await rM(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id>").withOptions({...J}).withExamples(["sazabi threads share create <thread-id> # Create a share link"]).build(),list:P("list","List active public share links for a thread",async(e)=>{let{values:t,positionals:n}=S(e,{...B},{allowPositionals:!0}),i=n[0];if(!i){if(t.json)return p("Thread ID is required. Usage: sazabi threads share list <thread-id>");return m("Thread ID is required. Usage: sazabi threads share list <thread-id>")}if(n.length>1){let o=n.slice(1).join(", ");if(t.json)return p(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${o}. Run 'sazabi threads -h' for usage.`)}await aM(i,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id>").withOptions({...J}).withExamples(["sazabi threads share list <thread-id> # List share links"]).build(),revoke:P("revoke","Revoke a public share link for a thread",async(e)=>{let{values:t,positionals:n}=S(e,{...B},{allowPositionals:!0}),i=n[0],o=n[1];if(!i||!o){if(t.json)return p("Thread ID and share ID are required. Usage: sazabi threads share revoke <thread-id> <share-id>");return m("Thread ID and share ID are required. Usage: sazabi threads share revoke <thread-id> <share-id>")}if(n.length>2){let r=n.slice(2).join(", ");if(t.json)return p(`Unexpected arguments: ${r}. Run 'sazabi threads -h' for usage.`);return m(`Unexpected arguments: ${r}. Run 'sazabi threads -h' for usage.`)}await cM(i,o,{token:t.token,json:t.json,apiBaseUrl:t["api-base-url"]})}).withPositionalArgs("<thread-id> <share-id>").withOptions({...J}).withExamples(["sazabi threads share revoke <thread-id> <share-id> # Revoke a share link"]).build()}).withExamples(["sazabi threads share create <thread-id> # Create a share link","sazabi threads share list <thread-id> # List share links","sazabi threads share revoke <thread-id> <share-id> # Revoke a share link"]).build()}).withExamples(["sazabi threads list # List all threads","sazabi threads get <thread-id> # Get thread with messages",'sazabi threads search "error" # Search threads',"sazabi threads archive <thread-id> # Archive a thread","sazabi threads unarchive <thread-id> # Unarchive a thread","sazabi threads fork <thread-id> -m <message-id> # Fork a thread","sazabi threads visibility <thread-id> private # Set visibility","sazabi threads stop <thread-id> # Stop the active run","sazabi threads stream <thread-id> # Stream live agent events","sazabi threads share create <thread-id> # Create a share link"]).build();var dM=[wH,PH,SH,AH,DH,NH,iW,uW,aW,gW,dW,GH,BH,TW,GW,tW,gM,hW,gH,fW,UH,yW,YW,WW,QW,mW,IW,SW];xP();te();var{renderSubcommandHelp:GP,renderSubcommandGroupHelp:pM,renderCommandHelp:BP,renderMainHelp:Pbe}=Ig("sazabi");var JP=(e)=>Pbe(e,{title:"Sazabi CLI",description:"Command-line interface for the Sazabi public API",examples:["sazabi auth login # Authenticate via browser",'sazabi messages send "Hello" # Start a new thread','sazabi messages send "Hi" -t <id> # Send a message to a thread',"sazabi logs tail --severities ERROR,WARN # Tail logs filtered by severity","sazabi threads list # List all threads"]});Zt();import*as bg from"node:fs";import*as Gc from"node:path";import{fileURLToPath as Sbe}from"node:url";var mM=()=>{try{let e=Gc.dirname(Sbe(import.meta.url));for(let t=0;t<5;t++){let n=Gc.join(e,"package.json");if(bg.existsSync(n)){let i=bg.readFileSync(n,"utf-8");return JSON.parse(i).version??"0.0.0"}e=Gc.dirname(e)}return"0.0.0"}catch{return"0.0.0"}};var Ube=mM();for(let e of dM)yM(e);var Ebe=async()=>{let e=process.argv.slice(2);if(e[0]==="--get-completions"&&e[1]==="--"){let{getCompletions:d,parseCompletionContext:y}=await Promise.resolve().then(() => (OM(),IM)),b=y(e.slice(2)),w=await d(b);for(let v of w)if(v.description)console.log(`${v.value} ${v.description}`);else console.log(v.value);return}let t=[],n;for(let d=0;d<e.length;d++){let y=e[d];if(y==="--profile"){let b=e[d+1],w=e.includes("--json");if(b===void 0||b.startsWith("-")){let v=b===void 0?"--profile requires a value.":`--profile requires a value, but got '${b}'. Use '--profile <name>'.`;if(w)p(v);m(v)}n=b,d++}else if(y.startsWith("--profile=")){let b=y.slice(10),w=e.includes("--json");if(!b){if(w)p("--profile requires a value.");m("--profile requires a value.")}n=b}else t.push(y)}Mq(n);let i=t[0]==="--json",o=i?t.slice(1):t,r=i||o.includes("--json");if(o.includes("--version")||o.includes("-v")){console.log(`sazabi ${Ube}`);return}if(o.length===0){console.log(JP(xc()));return}if(o[0]?.startsWith("--")||o[0]==="-h"){if(o[0]==="--help"||o[0]==="-h"){console.log(JP(xc()));return}}let a=o[0];if(a&&!bM(a)){let y=a.startsWith("-")?`Unknown option: ${a}. Run 'sazabi -h' for usage.`:`Unknown command: ${a}. Run 'sazabi -h' for usage.`;if(r)p(y);throw m(y),Error("Unreachable")}if(!a)throw Error("Unexpected: commandName is undefined");let s=yg(a);if(!s)throw m(`Unknown command: ${a}. Run 'sazabi -h' for usage.`),Error("Unreachable");let h=o[1]??"",l=o.slice(2);if(h==="--help"||h==="-h"){console.log(BP(s));return}if(!h&&s.subcommands&&!s.handler){console.log(BP(s));return}let u=s.subcommands?.[h];if(!u){if(s.handler){let d=h?[h,...l]:l;await s.handler(d)}else{let y=h.startsWith("-")?`Subcommand required. Run 'sazabi ${a} -h' for usage.`:`Unknown subcommand: ${h}. Run 'sazabi ${a} -h' for usage.`;if(r)p(y);throw m(y),Error("Unreachable")}return}if(u.subcommands){let d=l[0]??"",y=l.slice(1);if(d==="--help"||d==="-h"||!d&&!u.handler){console.log(pM(a,u));return}let b=u.subcommands[d];if(b){if(y.includes("--help")||y.includes("-h")){console.log(GP(`${a} ${h}`,b));return}if(b.handler)await b.handler(y);return}if(u.handler){await u.handler(l);return}let v=d.startsWith("-")?`Subcommand required. Run 'sazabi ${a} ${h} -h' for usage.`:`Unknown subcommand: ${d}. Run 'sazabi ${a} ${h} -h' for usage.`;if(r)p(v);throw m(v),Error("Unreachable")}if(l.includes("--help")||l.includes("-h")){console.log(GP(a,u));return}if(u.handler)await u.handler(l)};Ebe().catch((e)=>{let t=process.argv.includes("--json"),n=`Unexpected error: ${String(e).replace(/\.$/,"")}. Try again, or re-run the command with --json for details.`;if(t)p(n);m(n)});
|