import * as yup$1 from "yup"; import { KnownErrors } from "../known-errors.js"; import { MoneyAmount } from "../utils/currency-constants.js"; import { ConfigAgentRunApi, RestrictedReason, branchConfigSourceSchema } from "../schema-fields.js"; import { Result } from "../utils/results.js"; import { HexclaveServerInterface, ServerAuthApplicationOptions } from "./server-interface.js"; import { AccessToken, InternalSession, RefreshToken } from "../sessions.js"; import { TeamPermissionDefinitionsCrud } from "./crud/team-permissions.js"; import { ProjectPermissionDefinitionsCrud } from "./crud/project-permissions.js"; import { EnvironmentConfigOverrideOverride } from "../config/schema.js"; import { DeploymentMemorySize, DeploymentSourceManifest } from "../deployments.js"; import { AnalyticsClickmapDevice, AnalyticsClickmapKind, AnalyticsClickmapResponse, AnalyticsClickmapTokenResponse, MetricsResponse, MetricsUserCounts, UserActivityResponse } from "./admin-metrics.js"; import { EmailOutboxCrud } from "./crud/email-outbox.js"; import { InternalEmailsCrud } from "./crud/emails.js"; import { InternalApiKeysCrud } from "./crud/internal-api-keys.js"; import { ProjectsCrud } from "./crud/projects.js"; import { SvixTokenCrud } from "./crud/svix-token.js"; import { Transaction, TransactionType } from "./crud/transactions.js"; import { PlanUsageResponse, PlanUsageResponse as PlanUsageResponse$1 } from "./plan-usage.js"; import { WorkflowCancelRunsResultJson, WorkflowRunDetailsJson, WorkflowRunJson, WorkflowRunsFilterJson, WorkflowSummaryJson, WorkflowSyncResultJson, WorkflowUpgradeRunsResultJson, WorkflowVersionJson } from "./workflows.js"; //#region src/interface/admin-interface.d.ts type BranchConfigSourceApi = yup$1.InferType; type ChatContent = Array<{ type: "text"; text: string; } | { type: "tool-call"; toolName: string; toolCallId: string; args: any; argsText: string; result: any; }>; type AdminDeploymentServiceLogLineJson = { at_millis: number; stream: "stdout" | "stderr" | "system"; instance: string | null; text: string; }; type AdminDeploymentServiceOutcomeJson = { service_id: string; status: "pending" | "building" | "deploying" | "deployed" | "failed" | "skipped"; url: string | null; revision: string | null; image: string | null; error: string | null; }; type AdminDeploymentEnvVarJson = { key: string; type: "plain" | "secret" | "connection"; value: string | null; secret_key: string | null; }; type AdminDeploymentJson = { id: string; number: number; deployment_source_id: string; status: "queued" | "building" | "deploying" | "deployed" | "failed" | "canceled"; triggered_by: string; created_at_millis: number; finished_at_millis: number | null; error: string | null; has_build_logs: boolean; source_manifest: DeploymentSourceManifest | null; services: AdminDeploymentServiceOutcomeJson[]; }; type AdminDeploymentServiceJson = { id: string; deployment_source_id: string; type: "server" | "serverless"; public: boolean; ports: Record; min_instances: number | null; max_instances: number | null; memory: DeploymentMemorySize; cpu: { count: number; shared: boolean; }; root_directory: string | null; dockerfile_path: string | null; image: string | null; build_command: string | null; start_command: string | null; persistent_volumes: Record | null; provisioned: boolean; parked_at: string | null; parked_reason: string | null; status: "not_deployed" | "queued" | "building" | "deploying" | "deployed" | "failed" | "canceled"; has_successful_deploy: boolean; url: string | null; env: AdminDeploymentEnvVarJson[]; domains: { hostname: string; port: number | null; is_primary: boolean; verified: boolean; }[]; latest_deployment_id: string | null; }; type AdminProjectSecretJson = { key: string; created_at_millis: number; updated_at_millis: number; }; type AdminDeploymentDomainJson = { hostname: string; is_primary: boolean; verified: boolean; /** * Finer-grained than `verified`. "issuing" means the deployment runtime has accepted the * DNS and is waiting on the certificate authority; without it that window looks exactly * like the user having created no records at all. */ status: "awaiting_dns" | "issuing" | "verified"; pending_first_deploy: boolean; dns_records: { type: string; name: string; value: string; }[]; }; type AdminAuthApplicationOptions = ServerAuthApplicationOptions & ({ superSecretAdminKey: string; } | { projectOwnerSession: InternalSession | (() => Promise); }); type InternalApiKeyCreateCrudRequest = { has_publishable_client_key: boolean; has_secret_server_key: boolean; has_super_secret_admin_key: boolean; expires_at_millis: number; description: string; }; type InternalApiKeyCreateCrudResponse = InternalApiKeysCrud["Admin"]["Read"] & { publishable_client_key?: string; secret_server_key?: string; super_secret_admin_key?: string; }; declare class HexclaveAdminInterface extends HexclaveServerInterface { readonly options: AdminAuthApplicationOptions; constructor(options: AdminAuthApplicationOptions); sendAdminRequest(path: string, options: RequestInit, session: InternalSession | null, requestType?: "admin"): Promise; protected sendAdminRequestAndCatchKnownError(path: string, requestOptions: RequestInit, tokenStoreOrNull: InternalSession | null, errorsToCatch: readonly E[]): Promise>>; getProject(): Promise; updateProject(update: ProjectsCrud["Admin"]["Update"]): Promise; createInternalApiKey(options: InternalApiKeyCreateCrudRequest): Promise; listInternalApiKeys(): Promise; revokeInternalApiKeyById(id: string): Promise; getInternalApiKey(id: string, session: InternalSession): Promise; listInternalEmailTemplates(): Promise<{ id: string; display_name: string; theme_id?: string; tsx_source: string; }[]>; listWorkflows(): Promise; createWorkflow(options: { id: string; display_name?: string; source: string; }): Promise; updateWorkflowSource(workflowId: string, source: string): Promise; setWorkflowPaused(workflowId: string, isPaused: boolean): Promise<{ is_paused: boolean; paused_at_millis: number | null; }>; deleteWorkflow(workflowId: string): Promise; listWorkflowVersions(workflowId: string): Promise; listWorkflowRuns(workflowId: string, filter?: WorkflowRunsFilterJson): Promise<{ runs: WorkflowRunJson[]; next_cursor: string | null; }>; getWorkflowRun(runId: string): Promise; cancelWorkflowRuns(workflowId: string, filter: { run_key?: string; run_id?: string; state?: string; version?: number; }): Promise; upgradeWorkflowRuns(workflowId: string, options: { to_version: number; run_key?: string; from_version?: number; }): Promise; retryWorkflowRun(runId: string): Promise<{ run_id: string; }>; sendWorkflowEvent(name: string, data: unknown): Promise<{ event_id: string; }>; listInternalEmailDrafts(): Promise<{ id: string; display_name: string; theme_id?: string | undefined | false; tsx_source: string; sent_at_millis?: number | null; }[]>; createEmailDraft(options: { display_name?: string; theme_id?: string | false; tsx_source?: string; }): Promise<{ id: string; }>; updateEmailDraft(id: string, data: { display_name?: string; theme_id?: string | null | false; tsx_source?: string; sent_at_millis?: number | null; }): Promise; deleteEmailDraft(id: string): Promise; listEmailThemes(): Promise<{ id: string; display_name: string; }[]>; listTeamPermissionDefinitions(): Promise; listTeamPermissionDefinitionsPaginated(options: { limit: number; cursor?: string; query?: string; }): Promise<{ items: TeamPermissionDefinitionsCrud['Admin']['Read'][]; nextCursor: string | null; }>; createTeamPermissionDefinition(data: TeamPermissionDefinitionsCrud['Admin']['Create']): Promise; updateTeamPermissionDefinition(permissionId: string, data: TeamPermissionDefinitionsCrud['Admin']['Update']): Promise; deleteTeamPermissionDefinition(permissionId: string): Promise; listProjectPermissionDefinitions(): Promise; createProjectPermissionDefinition(data: ProjectPermissionDefinitionsCrud['Admin']['Create']): Promise; updateProjectPermissionDefinition(permissionId: string, data: ProjectPermissionDefinitionsCrud['Admin']['Update']): Promise; deleteProjectPermissionDefinition(permissionId: string): Promise; getSvixToken(): Promise; deleteProject(): Promise; getMetrics(includeAnonymous?: boolean, filters?: { country_code?: string; referrer?: string; browser?: string; os?: string; device?: string; since?: string; until?: string; }): Promise; getPlanUsage(): Promise; getUserActivity(userId: string): Promise; getAnalyticsClickmap(options: { kind: AnalyticsClickmapKind; member_user_ids?: string[]; route_path?: string; route_regex?: string; url_pattern?: string; user_id?: string; replay_id?: string; device?: AnalyticsClickmapDevice; viewport_width_min?: number; viewport_width_max?: number; sampling?: number; since: string; until: string; }): Promise; createAnalyticsClickmapToken(options: { origin: string; }): Promise; getMetricsUserCounts(): Promise; sendTestEmail(data: { recipient_email: string; email_config: { host: string; port: number; username: string; password: string; sender_email: string; sender_name: string; }; }): Promise<{ success: boolean; error_message?: string; }>; sendTestWebhook(data: { endpoint_id: string; }): Promise<{ success: boolean; error_message?: string; }>; listSentEmails(): Promise; setupManagedEmailProvider(data: { subdomain: string; sender_local_part: string; }): Promise<{ domain_id: string; subdomain: string; sender_local_part: string; name_server_records: string[]; status: "pending_dns" | "pending_verification" | "verified" | "applied" | "failed"; }>; checkManagedEmailStatus(data: { domain_id: string; subdomain: string; sender_local_part: string; }): Promise<{ status: "pending_dns" | "pending_verification" | "verified" | "applied" | "failed"; }>; listManagedEmailDomains(): Promise<{ items: Array<{ domain_id: string; subdomain: string; sender_local_part: string; status: "pending_dns" | "pending_verification" | "verified" | "applied" | "failed"; name_server_records: string[]; }>; }>; deleteManagedEmailDomain(data: { resend_domain_id: string; }): Promise<{ status: "deleted"; }>; applyManagedEmailProvider(data: { domain_id: string; }): Promise<{ status: "applied"; }>; sendSignInInvitationEmail(email: string, callbackUrl: string): Promise; saveChatMessage(threadId: string, message: any): Promise; listChatMessages(threadId: string): Promise<{ messages: Array; }>; renderEmailPreview(options: { themeId?: string | null | false; themeTsxSource?: string; templateId?: string; templateTsxSource?: string; editableMarkers?: boolean; editableSource?: 'template' | 'theme' | 'both'; }): Promise<{ html: string; editable_regions?: Record; }>; rewriteTemplateSourceWithAI(templateTsxSource: string): Promise<{ tsx_source: string; }>; createEmailTheme(displayName: string): Promise<{ id: string; }>; getEmailTheme(id: string): Promise<{ display_name: string; tsx_source: string; }>; updateEmailTheme(id: string, tsxSource: string): Promise; deleteEmailTheme(id: string): Promise; updateEmailTemplate(id: string, tsxSource: string, themeId: string | null | false): Promise<{ rendered_html: string; }>; getConfig(): Promise<{ config_string: string; }>; getConfigOverride(level: "project" | "branch" | "environment"): Promise<{ config_string: string; }>; setConfigOverride(level: "project" | "branch" | "environment", configOverride: any, source?: BranchConfigSourceApi): Promise; updateConfigOverride(level: "project" | "branch" | "environment", configOverrideOverride: any): Promise; getPushedConfigSource(): Promise; unlinkPushedConfigSource(): Promise; /** * Reads a specific config-agent run's state (or `null`) for the linked GitHub * repo. Polled by the dashboard — using the id returned by `applyConfigViaAgent` * — for live progress and the review diff. Runs are independent, so each is * addressed by its own id rather than "the" run on the branch. */ getConfigAgentRun(runId: string): Promise; /** * Applies a dashboard config change to the linked GitHub repo by running the * config agent in a sandbox (server-side). Returns immediately with the new run's * `id`; poll `getConfigAgentRun(id)` for progress. The GitHub access token is the * caller's own OAuth token and is used transiently server-side. */ applyConfigViaAgent(options: { configUpdate: EnvironmentConfigOverrideOverride; githubAccessToken: string; }): Promise<{ status: "started"; id: string; }>; /** * Cancels a specific in-flight agent-driven config write: hard-stops the sandbox * so the agent stops mid-work. Also cancels runs in `awaiting_review`. No revert * — if the agent already pushed, the commit stays. Returns `not-running` if the * run is gone or already terminal. */ cancelConfigAgentRun(runId: string): Promise<{ status: "cancelling" | "not-running"; }>; /** * Commits a specific run's reviewed change to GitHub. Only valid when that run is in * `awaiting_review` status; the change (diff + base commit) was captured at apply time * and is rebuilt + pushed via the GitHub API here, so no live sandbox is involved. * Returns `not-awaiting-review` if the run isn't in a committable state. */ commitConfigAgentRun(runId: string, options: { githubAccessToken: string; commitMessage?: string; }): Promise<{ status: "committing" | "not-awaiting-review"; }>; resetConfigOverrideKeys(level: "branch" | "environment", keys: string[]): Promise; createEmailTemplate(displayName: string): Promise<{ id: string; }>; deleteEmailTemplate(id: string): Promise; setupPayments(): Promise<{ url: string; }>; getStripeAccountInfo(): Promise; getPaymentMethodConfigs(): Promise<{ configId: string; methods: Array<{ id: string; name: string; enabled: boolean; available: boolean; overridable: boolean; }>; } | null>; updatePaymentMethodConfigs(configId: string, updates: Record): Promise; createStripeWidgetAccountSession(): Promise<{ client_secret: string; }>; listTransactions(params?: { cursor?: string; limit?: number; type?: TransactionType; customerType?: 'user' | 'team' | 'custom'; customerId?: string; }): Promise<{ transactions: Transaction[]; nextCursor: string | null; }>; refundTransaction(options: { type: "subscription" | "one-time-purchase"; id: string; invoiceId?: string; amountUsd: MoneyAmount; /** * Lifecycle action for the source purchase: * "now" — end product access immediately (revokes product, * expires item grants, cancels Stripe sub if any). * "at-period-end" — schedule sub cancel-at-period-end; subscriptions * only — rejected for one-time purchases. * undefined — no lifecycle change; refund money only. */ endAction?: "now" | "at-period-end"; }): Promise<{ success: boolean; refundTransactionId: string; }>; previewAffectedUsersByOnboardingChange(onboarding: { require_email_verification?: boolean; }, limit?: number): Promise<{ affected_users: Array<{ id: string; display_name: string | null; primary_email: string | null; restricted_reason: RestrictedReason; }>; total_affected_count: number; }>; listOutboxEmails(options?: { status?: string; simple_status?: string; user_id?: string; limit?: number; cursor?: string; }): Promise; getOutboxEmail(id: string): Promise; updateOutboxEmail(id: string, data: EmailOutboxCrud["Server"]["Update"]): Promise; listDeploymentServices(): Promise; listProjectSecrets(): Promise; setProjectSecret(key: string, value: string): Promise; deleteProjectSecret(key: string): Promise; listDeployments(options?: { limit?: number; }): Promise; getDeployment(deploymentId: string): Promise; getDeploymentBuildLogs(deploymentId: string, options?: { signal?: AbortSignal; }): Promise; /** * Follows a service's runtime logs, calling `onLine` for each line as it arrives. * * The endpoint streams NDJSON and follows for a few minutes before closing, so * this resolves when the server stops following rather than when the service * stops running — there is no end to a runtime log. Resume by calling again * with the largest `at_millis` seen; omit it to start at the tail. * * Rejects if the stream ends in an error, AFTER delivering everything that * arrived before it: the lines already handed to `onLine` are real output and * the caller should keep them. */ getDeploymentServiceLogs(serviceId: string, options: { sinceMillis?: number; /** False returns what is available right now instead of following. */ follow?: boolean; signal?: AbortSignal; onLine: (line: AdminDeploymentServiceLogLineJson) => void; }): Promise; addDeploymentServiceDomain(serviceId: string, hostname: string, options?: { isPrimary?: boolean; }): Promise; getDeploymentServiceDomain(serviceId: string, hostname: string): Promise; deleteDeploymentServiceDomain(serviceId: string, hostname: string): Promise; } //#endregion export { AdminAuthApplicationOptions, AdminDeploymentDomainJson, AdminDeploymentEnvVarJson, AdminDeploymentJson, AdminDeploymentServiceJson, AdminDeploymentServiceLogLineJson, AdminDeploymentServiceOutcomeJson, AdminProjectSecretJson, ChatContent, HexclaveAdminInterface, InternalApiKeyCreateCrudRequest, InternalApiKeyCreateCrudResponse, type PlanUsageResponse }; //# sourceMappingURL=admin-interface.d.ts.map