@miosa/sdk 1.2.0 → 1.2.2

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.d.ts CHANGED
@@ -768,8 +768,9 @@ interface ComputerData {
768
768
  id: ComputerId;
769
769
  name: string;
770
770
  /**
771
- * URL-safe identifier used in preview URLs: `https://{port}-{slug}.sandbox.miosa.ai`.
772
- * Falls back to the computer id when no slug is assigned.
771
+ * URL-safe identifier used in preview URLs: `https://{port}-{slug}.sandbox.{preview_domain}`.
772
+ * Falls back to the computer id when no slug is assigned. The domain is the
773
+ * tenant's white-label `preview_domain` (server-provided) — never hardcode it.
773
774
  */
774
775
  slug: string;
775
776
  status: ComputerStatus;
@@ -780,8 +781,10 @@ interface ComputerData {
780
781
  metadata: Record<string, string>;
781
782
  /** Controls who can access the HTTP preview URL. Defaults to `"public"`. */
782
783
  visibility: ComputerVisibility;
783
- /** Public ingress root, e.g. `https://<slug>.sandbox.miosa.ai`. */
784
+ /** Public ingress root, e.g. `https://<slug>.sandbox.<preview_domain>` (server-provided). */
784
785
  sandbox_url?: string;
786
+ /** Tenant's white-label preview/base domain (e.g. `cliniciq.com`). Use to build preview URLs. */
787
+ preview_domain?: string;
785
788
  /** KasmVNC URL for desktop templates. */
786
789
  desktop_url?: string;
787
790
  created_at: string;
@@ -2184,16 +2187,18 @@ declare class Computer {
2184
2187
  * ```ts
2185
2188
  * await computer.exec.bash("npm run dev &");
2186
2189
  * const url = computer.previewUrl(3000);
2187
- * // => https://3000-<slug>.sandbox.miosa.ai
2190
+ * // => https://3000-<slug>.sandbox.<tenant-domain>
2188
2191
  * ```
2189
2192
  *
2190
2193
  * Works for any TCP HTTP listener. Public (no auth required); anyone with
2191
2194
  * the URL can see it. Served over the ingress proxy so it inherits the
2192
- * wildcard TLS cert — no per-sandbox certs to manage.
2195
+ * tenant's white-label preview domain — no per-sandbox certs to manage.
2193
2196
  */
2194
2197
  previewUrl(port: number, path?: string): string;
2195
2198
  /** Root preview URL — serves whatever is on the default app port. */
2196
2199
  get publicUrl(): string;
2200
+ /** Tenant's preview/base domain, white-label aware. */
2201
+ get previewDomain(): string;
2197
2202
  /** Start the computer. */
2198
2203
  start(): Promise<Computer>;
2199
2204
  /** Stop the computer. */
@@ -2574,6 +2579,7 @@ type DeploymentState = "pending" | "building" | "running" | "stopped" | "failed"
2574
2579
  type DeploymentVersionKind = "static" | "dynamic" | "sandbox_backed";
2575
2580
  type DeploymentVersionState = "created" | "building" | "ready" | "failed" | "archived";
2576
2581
  type DeploymentSourceType = "repo" | "sandbox" | "upload";
2582
+ type DeploymentProduct = "miosa_deploy" | "docker_deploy";
2577
2583
  type DeploymentServiceType = "static_web" | "web" | "api" | "function" | "worker" | "cron" | "postgres" | "redis" | "bucket" | "volume";
2578
2584
  type RuntimeInstanceState = "provisioning" | "starting" | "healthy" | "unhealthy" | "error" | "stopped" | "destroyed";
2579
2585
  interface ExternalAttribution {
@@ -2607,6 +2613,8 @@ interface DeploymentData {
2607
2613
  auto_deploy?: boolean;
2608
2614
  custom_domain_id?: string | null;
2609
2615
  linked_database_id?: string | null;
2616
+ deployment_product?: DeploymentProduct | string | null;
2617
+ docker_deploy_host_id?: string | null;
2610
2618
  metadata?: Record<string, unknown>;
2611
2619
  external_workspace_id?: string | null;
2612
2620
  external_user_id?: string | null;
@@ -2616,7 +2624,7 @@ interface DeploymentData {
2616
2624
  updated_at?: string;
2617
2625
  }
2618
2626
  type DeploymentDatabaseRequest = boolean | {
2619
- engine?: "postgresql" | "mysql" | "redis";
2627
+ engine?: "postgresql" | "mysql" | "redis" | "qdrant";
2620
2628
  size?: "xs" | "small" | "medium" | "large";
2621
2629
  storage_mb?: number;
2622
2630
  region?: string;
@@ -2768,6 +2776,8 @@ interface DeploymentCreateParams extends ExternalAttribution {
2768
2776
  metadata?: Record<string, unknown>;
2769
2777
  idempotencyKey?: string;
2770
2778
  }
2779
+ interface DockerDeployCreateParams extends DeploymentCreateParams {
2780
+ }
2771
2781
  interface DeploymentUpdateParams {
2772
2782
  name?: string;
2773
2783
  branch?: string;
@@ -2892,6 +2902,12 @@ declare class Deployments {
2892
2902
  list(params?: DeploymentListParams): Promise<DeploymentData[]>;
2893
2903
  get(deploymentId: string): Promise<DeploymentData>;
2894
2904
  create(params: DeploymentCreateParams): Promise<DeploymentData>;
2905
+ /**
2906
+ * Create a deployment that runs on the workspace's dedicated Docker Deploy
2907
+ * runtime. It uses the same /deployments API as MIOSA Deploy, but marks the
2908
+ * deployment so the control plane attaches it to the workspace Docker host.
2909
+ */
2910
+ createDockerDeploy(params: DockerDeployCreateParams): Promise<DeploymentData>;
2895
2911
  update(deploymentId: string, params: DeploymentUpdateParams): Promise<DeploymentData>;
2896
2912
  delete(deploymentId: string): Promise<void>;
2897
2913
  publish(deploymentId: string, params: PublishParams): Promise<PublishResult>;
@@ -4560,6 +4576,21 @@ interface SandboxDeployParams {
4560
4576
  sourceSnapshotPath?: string;
4561
4577
  source_snapshot_path?: string;
4562
4578
  entrypoint?: string;
4579
+ buildCommand?: string;
4580
+ build_command?: string;
4581
+ runCommand?: string;
4582
+ run_command?: string;
4583
+ startCommand?: string;
4584
+ start_command?: string;
4585
+ port?: number;
4586
+ healthCheckPath?: string;
4587
+ health_check_path?: string;
4588
+ deploymentType?: "miosa_deploy" | "docker_deploy" | "docker-deploy" | string;
4589
+ deployment_type?: "miosa_deploy" | "docker_deploy" | "docker-deploy" | string;
4590
+ type?: "static" | "dynamic" | "server" | string;
4591
+ mode?: "static" | "dynamic" | "server" | string;
4592
+ database?: boolean | Record<string, unknown>;
4593
+ resources?: Record<string, unknown>;
4563
4594
  domain?: string;
4564
4595
  customDomain?: string;
4565
4596
  custom_domain?: string;
@@ -4751,6 +4782,7 @@ declare class Sandbox {
4751
4782
  pause(): Promise<Sandbox>;
4752
4783
  resume(): Promise<Sandbox>;
4753
4784
  deploy(params?: SandboxDeployParams): Promise<Record<string, unknown>>;
4785
+ deployDocker(params?: SandboxDeployParams): Promise<Record<string, unknown>>;
4754
4786
  /** Check readiness of the sandbox (GET /sandboxes/:id/readiness). */
4755
4787
  readiness(): Promise<Record<string, unknown>>;
4756
4788
  /**
@@ -5139,10 +5171,34 @@ declare class OrgInvites {
5139
5171
  interface TenantPlan {
5140
5172
  id?: string;
5141
5173
  name?: string;
5174
+ preview_domain?: string | null;
5175
+ deployment_domain?: string | null;
5176
+ fallback_miosa_domain?: string | null;
5142
5177
  limits?: Record<string, unknown>;
5143
5178
  usage?: Record<string, unknown>;
5144
5179
  [key: string]: unknown;
5145
5180
  }
5181
+ interface BrandingData {
5182
+ logo_url?: string | null;
5183
+ primary_color?: string | null;
5184
+ wordmark?: string | null;
5185
+ favicon_url?: string | null;
5186
+ [key: string]: unknown;
5187
+ }
5188
+ interface PreviewDomainData {
5189
+ preview_domain?: string | null;
5190
+ deployment_domain?: string | null;
5191
+ fallback_miosa_domain?: string | null;
5192
+ status?: string;
5193
+ [key: string]: unknown;
5194
+ }
5195
+ interface TenantBrandingUpdateParams {
5196
+ logo_url?: string | null;
5197
+ primary_color?: string | null;
5198
+ wordmark?: string | null;
5199
+ favicon_url?: string | null;
5200
+ [key: string]: unknown;
5201
+ }
5146
5202
  declare class Tenant {
5147
5203
  private readonly http;
5148
5204
  constructor(http: HttpClient);
@@ -5285,8 +5341,20 @@ interface WebhookUpdateParams {
5285
5341
  enabled?: boolean;
5286
5342
  [key: string]: unknown;
5287
5343
  }
5344
+ interface WebhookSignatureVerifyOptions {
5345
+ /** Maximum age for the webhook timestamp in seconds. Defaults to 300. */
5346
+ toleranceSeconds?: number;
5347
+ }
5348
+ /**
5349
+ * Verify a MIOSA webhook signature header.
5350
+ *
5351
+ * Header format: `t=<unix_seconds>,v1=<hex_hmac_sha256>`.
5352
+ */
5353
+ declare function verifySignature(body: string | Buffer | Uint8Array, header: string, secret: string, options?: WebhookSignatureVerifyOptions): boolean;
5288
5354
  declare class Webhooks {
5289
5355
  private readonly http;
5356
+ static verifySignature: typeof verifySignature;
5357
+ static verify_signature: typeof verifySignature;
5290
5358
  constructor(http: HttpClient);
5291
5359
  list(params?: WebhookListParams): Promise<WebhookData[]>;
5292
5360
  get(webhookId: string): Promise<WebhookData>;
@@ -5674,4 +5742,4 @@ declare class NetworkError extends MiosaError {
5674
5742
  constructor(message: string, cause: Error);
5675
5743
  }
5676
5744
 
5677
- export { type AcceptOrgInviteResponse, type AcceptWorkspaceInviteResponse, type AddDomainParams, type AddWorkspaceMemberParams, Admin, type AgentDispatchParams, type AgentEvent$1 as AgentEvent, type AgentEventType, type AgentSessionCreateParams, type AgentSessionData, type AgentSessionListResponse$1 as AgentSessionListResponse, type AgentSessionStatus$1 as AgentSessionStatus, type AllowParams, Analytics, type AnalyticsFilters, type ApiKeyCreateParams, type ApiKeyCreateResult, type ApiKeyData, type ApiKeyId, type ApiKeyListParams, ApiKeys, type AppCatalogEntry, type AppInstallData, type AppInstallEvent, type AuditListParams, AuditLog, type AuditLogEvent, type AuditLogListParams, type AuditTailParams, AuthError, type BenchmarkCompareParams, type BenchmarkCreateParams, Benchmarks, type BindingCreateParams, type BindingListParams, type BrandingUpdateParams, type BucketCreateParams, type BucketData, type BucketId, type BuilderSessionListParams, BuilderSessions, type BulkUserActionParams, type ChannelCreateParams, type ChannelData, type ChannelListParams, type ChannelUpdateParams, Channels, type ChatCompletionCreateParams, type ChatCompletionCreateStreamParams, Checkpoints, type ClickParams, type ClusterCreateParams, type ClusterData, type ClusterEvent, type ClusterId, type ClusterListResponse, type ClusterStatus, CommandCenter, Community, type CompletionCreateParams, type CompletionCreateStreamParams, Completions, Computer, ComputerAudit, ComputerAutoStop, type ComputerCreateParams, type ComputerData, ComputerEnv, type ComputerId, ComputerInbox, type ComputerListParams, type ComputerListResponse, ComputerLogs, type ComputerLogsGetParams, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, type ComputerSize, type ComputerStatus, type ComputerTemplateType, ComputerTerminal, type ComputerUpdateParams, type ComputerVisibility, ComputerVolumes, Computers, type CopyParams, type CreateAdminApiKeyParams, type CreateOrgInviteParams, type CreateWorkspaceInviteParams, type CreateWorkspaceInviteResponse, type CreditBalance, type CreditTransaction, type CreditTransactionListResponse, type CreditUsage, Credits, type CronJobCreateParams, type CronJobData, type CronJobExecutionData, type CronJobExecutionId, type CronJobId, type CronJobListParams, type CronJobUpdateParams, CronJobs, type CursorInfo, type CustomDomainCreateParams, type CustomDomainData, type CustomDomainId, type CustomDomainListParams, Dashboard, type DashboardSummary, type DatabaseCreateParams, type DatabaseCredentials, type DatabaseData, type DatabaseId, type DatabaseListParams, type DatabaseLogsParams, type DatabaseLogsResult, Databases, type DeploymentBuildData, type DeploymentCreateParams, type DeploymentData, DeploymentDomains, type DeploymentId, type DeploymentListParams, type DeploymentReleaseData, type DeploymentReleaseId, DeploymentReleases, DeploymentRuntimeInstances, type DeploymentServiceData, type DeploymentServiceId, type DeploymentServiceType, type DeploymentSourceType, type DeploymentState, type DeploymentUpdateParams, type DeploymentVersionData, type DeploymentVersionId, type DeploymentVersionKind, type DeploymentVersionState, DeploymentVersions, Deployments, Desktop$1 as Desktop, type DesktopActionResult, type DirEntry, type DirListResult, type DiscordSendTestParams, type DoubleClickParams, type DragParams, type EgressAllowlistRule, EgressAudit, type EgressAuditEvent, type EgressBindingData, EgressNetwork, type EgressPolicyData, type EgressPolicyMode, type EgressRuleEffect, type EgressSecretData, type EgressSecretScope, type EgressSecretType, EgressSecrets, type EgressSuggestion, Email, EmailCampaigns, EmailInbox, EmailTemplates, type EmbeddingCreateParams, Embeddings, Exec, type ExecParams, type ExecPythonParams, type ExecResult, type ExternalAttribution, type ExternalKeyCreateParams, type ExternalKeyData, ExternalKeys, type FileDeleteParams, type FileDownloadParams, type FileEntry, type FileExportParams, type FileExportResult, type FileListParams, type FileListResult, type FileStat, Files, FlatCustomDomains, type FsEntry, type FsListResponse, type FsStat, type FunctionCreateParams, type FunctionData, type FunctionId, type FunctionInvokeParams, type FunctionListParams, type FunctionUpdateParams, Functions, type GithubRepo, type GithubSshKey, type HealthCheckCreateParams, type HealthCheckData, type HealthCheckId, type HealthCheckListParams, type HealthCheckUpdateParams, HealthChecks, type HostCreateParams, type HostData, type HostEvent, type HostId, type HostListResponse, type HostStatus, type HostUpdateParams, InsufficientCreditsError, type IntegrationCatalogEntry, type IntegrationData, Integrations, type JobData, type JobEvent, type JobEventType, type JobId, type JobListResponse, type JobRunParams, type JobStatus, type KeyParams, type LaunchParams, type LinearCreateIssueParams, type ListAdminApiKeysParams, type ListAdminComputersParams, type ListAdminTenantsParams, type ListAdminUsersParams, Mcp, type McpDispatchParams, Miosa, type MiosaClientConfig, MiosaError, type MkdirParams, type ModeParams, Models, type MouseButton, NetworkError, NetworkPolicy, type NetworkPolicyData, type NetworkPolicyEffect, type NetworkPolicyProtocol, type NetworkPolicyRule, type NetworkPolicySetParams, NotFoundError, type NotificationPrefsUpdateParams, OAuthFlow, type OauthConnectParams, type OauthProvider, type OauthStartResult, type OauthStatusResult, type ObjectListParams, type AgentEvent as OcAgentEvent, type OcAgentSessionData, type AgentSessionListResponse as OcAgentSessionListResponse, type OcWorkspaceCreateParams, type OcWorkspaceData, type OcWorkspaceEvent, type OcWorkspaceListResponse, type OcWorkspaceStatus, type OcWorkspaceUpdateParams, OpenComputers, type OrgInvite, type OrgInviteCreated, type OrgInviteCreatedResponse, type OrgInviteListResponse, type OrgInvitePreview, type OrgInviteRevokeResponse, OrgInvites, type OrgRole, type OverviewData, type PolicyCreateParams, type PolicyListParams, type PolicyUpdateParams, type PresignParams, type PresignResult, ProjectAuth, type ProjectAuthEnableParams, type ProjectAuthStatus, type ProjectAuthUpdateParams, type ProjectIntegrationCatalogEntry, type ProjectIntegrationCreateParams, type ProjectIntegrationData, type ProjectIntegrationListParams, type ProjectIntegrationUpdateParams, ProjectIntegrations, ProviderDefaults, type ProviderKeyUpsertParams, type PublishFromSandboxParams, type PublishParams, type PublishResult, RateLimitError, type RegionData, Regions, type RollbackParams, type RulesListParams, type RuntimeInstanceData, type RuntimeInstanceId, type RuntimeInstanceState, type RuntimeLogsResult, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, type SandboxBuildSpec, type SandboxBuildSpecError, type SandboxBuildSpecValidation, SandboxCommands, type SandboxCreateParams, type SandboxData, SandboxEnv, SandboxEvents, type SandboxExecOptions, type SandboxExecResult, SandboxFiles, type SandboxId, type SandboxListParams, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, type SandboxState, SandboxTags, type SandboxTemplate, type SandboxTemplateBuild, type SandboxTemplateBuildCreateParams, type SandboxTemplateBuildResourceData, type SandboxTemplateBuildResourceId, type SandboxTemplateCreateParams, type SandboxTemplateList, type SandboxTemplateListParams, type SandboxTemplateResourceData, type SandboxTemplateResourceId, SandboxTemplates, SandboxTerminal, Sandboxes, ScopedFs, type ScrollDirection, type ScrollParams, type SecretCreateParams, type SecretData, type SecretId, type SecretListParams, type SecretRotateParams, type SecretSetParams, type SecretUpdateParams, type SessionId, Settings, type SettingsUpdateParams, type SizeData, type SlackSendTestParams, type SnapshotCreateParams, type SnapshotData, type SnapshotListResponse, type SnapshotProgressEvent, type SnapshotRestoreResult, type SnapshotStatus, SnapshotsStandalone, Storage, type StorageObjectData, type SuggestionsParams, type TemplateBuildCreateParams, type TemplateCreateParams, type TemplateData, Tenant, type TenantId, type TenantPlan, type TenantSummary, type TerminalCreateParams, TimeoutError, type TimeseriesParams, type TunnelAuthMode, type TunnelCreateParams, type TunnelData, type TunnelId, type TunnelListResponse, type TunnelUpdateParams, type TypeParams, type UpdateWorkspaceMemberRoleParams, Usage, type UsageReportParams, type UsageSession, type UsageSessionsParams, type UsageSummary, ValidationError, type VersionListParams, type VolumeCreateParams, type VolumeData, type VolumeId, type VolumeListParams, Volumes, type WaitParams, type WebhookCreateParams, type WebhookData, type WebhookDeliveryData, type WebhookDeliveryId, type WebhookId, type WebhookListParams, type WebhookUpdateParams, Webhooks, type WindowFocusParams, type WindowInfo, type WorkspaceId, type WorkspaceInvite, type WorkspaceInviteCreatedResponse, type WorkspaceInviteListResponse, type WorkspaceInvitePreview, type WorkspaceInviteRevokeResponse, WorkspaceInvites, type WorkspaceMember, type WorkspaceMemberAddedResponse, type WorkspaceMemberDeleteResponse, type WorkspaceMemberListResponse, type WorkspaceMemberRecord, type WorkspaceMemberRecordResponse, WorkspaceMembers, type WorkspaceRole, type WsTicket };
5745
+ export { type AcceptOrgInviteResponse, type AcceptWorkspaceInviteResponse, type AddDomainParams, type AddWorkspaceMemberParams, Admin, type AgentDispatchParams, type AgentEvent$1 as AgentEvent, type AgentEventType, type AgentSessionCreateParams, type AgentSessionData, type AgentSessionListResponse$1 as AgentSessionListResponse, type AgentSessionStatus$1 as AgentSessionStatus, type AllowParams, Analytics, type AnalyticsFilters, type ApiKeyCreateParams, type ApiKeyCreateResult, type ApiKeyData, type ApiKeyId, type ApiKeyListParams, ApiKeys, type AppCatalogEntry, type AppInstallData, type AppInstallEvent, type AuditListParams, AuditLog, type AuditLogEvent, type AuditLogListParams, type AuditTailParams, AuthError, type BenchmarkCompareParams, type BenchmarkCreateParams, Benchmarks, type BindingCreateParams, type BindingListParams, type BrandingData, type BrandingUpdateParams, type BucketCreateParams, type BucketData, type BucketId, type BuilderSessionListParams, BuilderSessions, type BulkUserActionParams, type ChannelCreateParams, type ChannelData, type ChannelListParams, type ChannelUpdateParams, Channels, type ChatCompletionCreateParams, type ChatCompletionCreateStreamParams, Checkpoints, type ClickParams, type ClusterCreateParams, type ClusterData, type ClusterEvent, type ClusterId, type ClusterListResponse, type ClusterStatus, CommandCenter, Community, type CompletionCreateParams, type CompletionCreateStreamParams, Completions, Computer, ComputerAudit, ComputerAutoStop, type ComputerCreateParams, type ComputerData, ComputerEnv, type ComputerId, ComputerInbox, type ComputerListParams, type ComputerListResponse, ComputerLogs, type ComputerLogsGetParams, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, type ComputerSize, type ComputerStatus, type ComputerTemplateType, ComputerTerminal, type ComputerUpdateParams, type ComputerVisibility, ComputerVolumes, Computers, type CopyParams, type CreateAdminApiKeyParams, type CreateOrgInviteParams, type CreateWorkspaceInviteParams, type CreateWorkspaceInviteResponse, type CreditBalance, type CreditTransaction, type CreditTransactionListResponse, type CreditUsage, Credits, type CronJobCreateParams, type CronJobData, type CronJobExecutionData, type CronJobExecutionId, type CronJobId, type CronJobListParams, type CronJobUpdateParams, CronJobs, type CursorInfo, type CustomDomainCreateParams, type CustomDomainData, type CustomDomainId, type CustomDomainListParams, Dashboard, type DashboardSummary, type DatabaseCreateParams, type DatabaseCredentials, type DatabaseData, type DatabaseId, type DatabaseListParams, type DatabaseLogsParams, type DatabaseLogsResult, Databases, type DeploymentBuildData, type DeploymentCreateParams, type DeploymentData, DeploymentDomains, type DeploymentId, type DeploymentListParams, type DeploymentProduct, type DeploymentReleaseData, type DeploymentReleaseId, DeploymentReleases, DeploymentRuntimeInstances, type DeploymentServiceData, type DeploymentServiceId, type DeploymentServiceType, type DeploymentSourceType, type DeploymentState, type DeploymentUpdateParams, type DeploymentVersionData, type DeploymentVersionId, type DeploymentVersionKind, type DeploymentVersionState, DeploymentVersions, Deployments, Desktop$1 as Desktop, type DesktopActionResult, type DirEntry, type DirListResult, type DiscordSendTestParams, type DockerDeployCreateParams, type DoubleClickParams, type DragParams, type EgressAllowlistRule, EgressAudit, type EgressAuditEvent, type EgressBindingData, EgressNetwork, type EgressPolicyData, type EgressPolicyMode, type EgressRuleEffect, type EgressSecretData, type EgressSecretScope, type EgressSecretType, EgressSecrets, type EgressSuggestion, Email, EmailCampaigns, EmailInbox, EmailTemplates, type EmbeddingCreateParams, Embeddings, Exec, type ExecParams, type ExecPythonParams, type ExecResult, type ExternalAttribution, type ExternalKeyCreateParams, type ExternalKeyData, ExternalKeys, type FileDeleteParams, type FileDownloadParams, type FileEntry, type FileExportParams, type FileExportResult, type FileListParams, type FileListResult, type FileStat, Files, FlatCustomDomains, type FsEntry, type FsListResponse, type FsStat, type FunctionCreateParams, type FunctionData, type FunctionId, type FunctionInvokeParams, type FunctionListParams, type FunctionUpdateParams, Functions, type GithubRepo, type GithubSshKey, type HealthCheckCreateParams, type HealthCheckData, type HealthCheckId, type HealthCheckListParams, type HealthCheckUpdateParams, HealthChecks, type HostCreateParams, type HostData, type HostEvent, type HostId, type HostListResponse, type HostStatus, type HostUpdateParams, InsufficientCreditsError, type IntegrationCatalogEntry, type IntegrationData, Integrations, type JobData, type JobEvent, type JobEventType, type JobId, type JobListResponse, type JobRunParams, type JobStatus, type KeyParams, type LaunchParams, type LinearCreateIssueParams, type ListAdminApiKeysParams, type ListAdminComputersParams, type ListAdminTenantsParams, type ListAdminUsersParams, Mcp, type McpDispatchParams, Miosa, type MiosaClientConfig, MiosaError, type MkdirParams, type ModeParams, Models, type MouseButton, NetworkError, NetworkPolicy, type NetworkPolicyData, type NetworkPolicyEffect, type NetworkPolicyProtocol, type NetworkPolicyRule, type NetworkPolicySetParams, NotFoundError, type NotificationPrefsUpdateParams, OAuthFlow, type OauthConnectParams, type OauthProvider, type OauthStartResult, type OauthStatusResult, type ObjectListParams, type AgentEvent as OcAgentEvent, type OcAgentSessionData, type AgentSessionListResponse as OcAgentSessionListResponse, type OcWorkspaceCreateParams, type OcWorkspaceData, type OcWorkspaceEvent, type OcWorkspaceListResponse, type OcWorkspaceStatus, type OcWorkspaceUpdateParams, OpenComputers, type OrgInvite, type OrgInviteCreated, type OrgInviteCreatedResponse, type OrgInviteListResponse, type OrgInvitePreview, type OrgInviteRevokeResponse, OrgInvites, type OrgRole, type OverviewData, type PolicyCreateParams, type PolicyListParams, type PolicyUpdateParams, type PresignParams, type PresignResult, type PreviewDomainData, ProjectAuth, type ProjectAuthEnableParams, type ProjectAuthStatus, type ProjectAuthUpdateParams, type ProjectIntegrationCatalogEntry, type ProjectIntegrationCreateParams, type ProjectIntegrationData, type ProjectIntegrationListParams, type ProjectIntegrationUpdateParams, ProjectIntegrations, ProviderDefaults, type ProviderKeyUpsertParams, type PublishFromSandboxParams, type PublishParams, type PublishResult, RateLimitError, type RegionData, Regions, type RollbackParams, type RulesListParams, type RuntimeInstanceData, type RuntimeInstanceId, type RuntimeInstanceState, type RuntimeLogsResult, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, type SandboxBuildSpec, type SandboxBuildSpecError, type SandboxBuildSpecValidation, SandboxCommands, type SandboxCreateParams, type SandboxData, SandboxEnv, SandboxEvents, type SandboxExecOptions, type SandboxExecResult, SandboxFiles, type SandboxId, type SandboxListParams, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, type SandboxState, SandboxTags, type SandboxTemplate, type SandboxTemplateBuild, type SandboxTemplateBuildCreateParams, type SandboxTemplateBuildResourceData, type SandboxTemplateBuildResourceId, type SandboxTemplateCreateParams, type SandboxTemplateList, type SandboxTemplateListParams, type SandboxTemplateResourceData, type SandboxTemplateResourceId, SandboxTemplates, SandboxTerminal, Sandboxes, ScopedFs, type ScrollDirection, type ScrollParams, type SecretCreateParams, type SecretData, type SecretId, type SecretListParams, type SecretRotateParams, type SecretSetParams, type SecretUpdateParams, type SessionId, Settings, type SettingsUpdateParams, type SizeData, type SlackSendTestParams, type SnapshotCreateParams, type SnapshotData, type SnapshotListResponse, type SnapshotProgressEvent, type SnapshotRestoreResult, type SnapshotStatus, SnapshotsStandalone, Storage, type StorageObjectData, type SuggestionsParams, type TemplateBuildCreateParams, type TemplateCreateParams, type TemplateData, Tenant, type TenantBrandingUpdateParams, type TenantId, type TenantPlan, type TenantSummary, type TerminalCreateParams, TimeoutError, type TimeseriesParams, type TunnelAuthMode, type TunnelCreateParams, type TunnelData, type TunnelId, type TunnelListResponse, type TunnelUpdateParams, type TypeParams, type UpdateWorkspaceMemberRoleParams, Usage, type UsageReportParams, type UsageSession, type UsageSessionsParams, type UsageSummary, ValidationError, type VersionListParams, type VolumeCreateParams, type VolumeData, type VolumeId, type VolumeListParams, Volumes, type WaitParams, type WebhookCreateParams, type WebhookData, type WebhookDeliveryData, type WebhookDeliveryId, type WebhookId, type WebhookListParams, type WebhookUpdateParams, Webhooks, type WindowFocusParams, type WindowInfo, type WorkspaceId, type WorkspaceInvite, type WorkspaceInviteCreatedResponse, type WorkspaceInviteListResponse, type WorkspaceInvitePreview, type WorkspaceInviteRevokeResponse, WorkspaceInvites, type WorkspaceMember, type WorkspaceMemberAddedResponse, type WorkspaceMemberDeleteResponse, type WorkspaceMemberListResponse, type WorkspaceMemberRecord, type WorkspaceMemberRecordResponse, WorkspaceMembers, type WorkspaceRole, type WsTicket, verifySignature };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { randomUUID } from 'crypto';
1
+ import { createHmac, timingSafeEqual, randomUUID } from 'crypto';
2
2
  import EventEmitter from 'events';
3
3
 
4
4
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
@@ -3004,20 +3004,24 @@ var Computer = class _Computer {
3004
3004
  * ```ts
3005
3005
  * await computer.exec.bash("npm run dev &");
3006
3006
  * const url = computer.previewUrl(3000);
3007
- * // => https://3000-<slug>.sandbox.miosa.ai
3007
+ * // => https://3000-<slug>.sandbox.<tenant-domain>
3008
3008
  * ```
3009
3009
  *
3010
3010
  * Works for any TCP HTTP listener. Public (no auth required); anyone with
3011
3011
  * the URL can see it. Served over the ingress proxy so it inherits the
3012
- * wildcard TLS cert — no per-sandbox certs to manage.
3012
+ * tenant's white-label preview domain — no per-sandbox certs to manage.
3013
3013
  */
3014
3014
  previewUrl(port, path = "/") {
3015
3015
  const p = path.startsWith("/") ? path : `/${path}`;
3016
- return `https://${port}-${this.slug}.sandbox.miosa.ai${p}`;
3016
+ return `https://${port}-${this.slug}.sandbox.${this.previewDomain}${p}`;
3017
3017
  }
3018
3018
  /** Root preview URL — serves whatever is on the default app port. */
3019
3019
  get publicUrl() {
3020
- return `https://${this.slug}.sandbox.miosa.ai`;
3020
+ return `https://${this.slug}.sandbox.${this.previewDomain}`;
3021
+ }
3022
+ /** Tenant's preview/base domain, white-label aware. */
3023
+ get previewDomain() {
3024
+ return this.data.preview_domain || "miosa.app";
3021
3025
  }
3022
3026
  // ─── Lifecycle ─────────────────────────────────────────────────────────────
3023
3027
  /** Start the computer. */
@@ -3635,6 +3639,12 @@ function stripUndefined10(input) {
3635
3639
  Object.entries(input).filter(([, v]) => v !== void 0)
3636
3640
  );
3637
3641
  }
3642
+ function dockerDeployMetadata(metadata) {
3643
+ return {
3644
+ ...metadata ?? {},
3645
+ deployment_product: "docker_deploy"
3646
+ };
3647
+ }
3638
3648
  var DeploymentVersions = class {
3639
3649
  constructor(http, deploymentId) {
3640
3650
  this.http = http;
@@ -3817,6 +3827,17 @@ var Deployments = class {
3817
3827
  });
3818
3828
  return unwrap23(data);
3819
3829
  }
3830
+ /**
3831
+ * Create a deployment that runs on the workspace's dedicated Docker Deploy
3832
+ * runtime. It uses the same /deployments API as MIOSA Deploy, but marks the
3833
+ * deployment so the control plane attaches it to the workspace Docker host.
3834
+ */
3835
+ async createDockerDeploy(params) {
3836
+ return this.create({
3837
+ ...params,
3838
+ metadata: dockerDeployMetadata(params.metadata)
3839
+ });
3840
+ }
3820
3841
  async update(deploymentId, params) {
3821
3842
  const body = stripUndefined10({
3822
3843
  name: params.name,
@@ -6047,6 +6068,16 @@ var Sandbox = class _Sandbox {
6047
6068
  output_path: params.outputPath ?? params.output_path ?? params.path ?? params.sourcePath ?? params.source_path,
6048
6069
  source_snapshot_path: params.sourceSnapshotPath ?? params.source_snapshot_path,
6049
6070
  entrypoint: params.entrypoint,
6071
+ build_command: params.buildCommand ?? params.build_command,
6072
+ run_command: params.runCommand ?? params.run_command,
6073
+ start_command: params.startCommand ?? params.start_command,
6074
+ port: params.port,
6075
+ health_check_path: params.healthCheckPath ?? params.health_check_path,
6076
+ deployment_type: params.deploymentType ?? params.deployment_type,
6077
+ type: params.type,
6078
+ mode: params.mode,
6079
+ database: params.database,
6080
+ resources: params.resources,
6050
6081
  domain: params.domain,
6051
6082
  custom_domain: params.customDomain ?? params.custom_domain
6052
6083
  })
@@ -6061,6 +6092,9 @@ var Sandbox = class _Sandbox {
6061
6092
  )
6062
6093
  );
6063
6094
  }
6095
+ async deployDocker(params = {}) {
6096
+ return this.deploy({ ...params, deploymentType: "docker_deploy" });
6097
+ }
6064
6098
  /** Check readiness of the sandbox (GET /sandboxes/:id/readiness). */
6065
6099
  async readiness() {
6066
6100
  return unwrap36(
@@ -6856,11 +6890,51 @@ function stripUndefined25(input) {
6856
6890
  function idempotencyKey10(key) {
6857
6891
  return key ?? randomUUID();
6858
6892
  }
6893
+ function parseSignatureHeader(header) {
6894
+ const parts = header.split(",").map((part) => part.trim());
6895
+ let timestamp = null;
6896
+ const signatures = [];
6897
+ for (const part of parts) {
6898
+ const [key, value] = part.split("=", 2);
6899
+ if (!key || !value) continue;
6900
+ if (key === "t") {
6901
+ const parsed = Number(value);
6902
+ if (Number.isFinite(parsed)) timestamp = parsed;
6903
+ } else if (key === "v1") {
6904
+ signatures.push(value);
6905
+ }
6906
+ }
6907
+ if (timestamp == null || signatures.length === 0) return null;
6908
+ return { timestamp, signatures };
6909
+ }
6910
+ function verifySignature(body, header, secret, options = {}) {
6911
+ const parsed = parseSignatureHeader(header);
6912
+ if (!parsed) return false;
6913
+ const toleranceSeconds = options.toleranceSeconds ?? 300;
6914
+ const ageSeconds = Math.abs(Math.floor(Date.now() / 1e3) - parsed.timestamp);
6915
+ if (ageSeconds > toleranceSeconds) {
6916
+ throw new Error("Webhook signature timestamp is too old");
6917
+ }
6918
+ const bodyBuffer = Buffer.isBuffer(body) ? body : Buffer.from(body);
6919
+ const signedPayload = Buffer.concat([
6920
+ Buffer.from(`${parsed.timestamp}.`),
6921
+ bodyBuffer
6922
+ ]);
6923
+ const expected = createHmac("sha256", secret).update(signedPayload).digest("hex");
6924
+ const expectedBuffer = Buffer.from(expected, "hex");
6925
+ return parsed.signatures.some((signature) => {
6926
+ const actualBuffer = Buffer.from(signature, "hex");
6927
+ if (actualBuffer.length !== expectedBuffer.length) return false;
6928
+ return timingSafeEqual(actualBuffer, expectedBuffer);
6929
+ });
6930
+ }
6859
6931
  var Webhooks = class {
6860
6932
  constructor(http) {
6861
6933
  this.http = http;
6862
6934
  }
6863
6935
  http;
6936
+ static verifySignature = verifySignature;
6937
+ static verify_signature = verifySignature;
6864
6938
  async list(params = {}) {
6865
6939
  const query = stripUndefined25({ ...params });
6866
6940
  const data = await this.http.get("/webhooks", query);
@@ -7235,6 +7309,6 @@ var Miosa = class {
7235
7309
  }
7236
7310
  };
7237
7311
 
7238
- export { Admin, Analytics, ApiKeys, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Credits, CronJobs, Dashboard, Databases, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, EgressAudit, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Functions, HealthChecks, InsufficientCreditsError, Integrations, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, ProjectAuth, ProjectIntegrations, ProviderDefaults, RateLimitError, Regions, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, SandboxCommands, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopedFs, Settings, SnapshotsStandalone, Storage, Tenant, TimeoutError, Usage, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers };
7312
+ export { Admin, Analytics, ApiKeys, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Credits, CronJobs, Dashboard, Databases, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, EgressAudit, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Functions, HealthChecks, InsufficientCreditsError, Integrations, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, ProjectAuth, ProjectIntegrations, ProviderDefaults, RateLimitError, Regions, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, SandboxCommands, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopedFs, Settings, SnapshotsStandalone, Storage, Tenant, TimeoutError, Usage, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers, verifySignature };
7239
7313
  //# sourceMappingURL=index.js.map
7240
7314
  //# sourceMappingURL=index.js.map