@miosa/sdk 1.2.19 → 1.2.21

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
@@ -5885,6 +5885,10 @@ interface SandboxData {
5885
5885
  boot_ms?: number | null;
5886
5886
  ready_at?: string | null;
5887
5887
  preview_url?: string | null;
5888
+ url_info?: PreviewUrlInfo | null;
5889
+ url_class?: PreviewUrlClass | null;
5890
+ stable_for_embedding?: boolean | null;
5891
+ recommended_next_action?: PreviewUrlAction | null;
5888
5892
  metadata?: Record<string, unknown>;
5889
5893
  inserted_at?: string;
5890
5894
  created_at?: string;
@@ -5892,6 +5896,18 @@ interface SandboxData {
5892
5896
  destroyed_at?: string | null;
5893
5897
  total_runtime_sec?: number | null;
5894
5898
  }
5899
+ type PreviewUrlClass = "temporary_preview" | "always_on_preview" | "stable_sandbox_embed" | "durable_deployment" | (string & {});
5900
+ type PreviewUrlAction = "create_alias_or_publish" | "publish_when_ready" | "attach_custom_domain" | (string & {});
5901
+ interface PreviewUrlInfo {
5902
+ url: string;
5903
+ class: PreviewUrlClass;
5904
+ url_class: PreviewUrlClass;
5905
+ stable_for_embedding: boolean;
5906
+ recommended_next_action: PreviewUrlAction;
5907
+ alias_slug?: string | null;
5908
+ port?: number | null;
5909
+ [key: string]: unknown;
5910
+ }
5895
5911
  interface SandboxTemplate {
5896
5912
  id: string;
5897
5913
  name?: string;
@@ -6095,6 +6111,7 @@ declare class SandboxPreview {
6095
6111
  private readonly sandbox;
6096
6112
  constructor(sandbox: Sandbox);
6097
6113
  expose(port?: number): Promise<string>;
6114
+ exposeInfo(port?: number): Promise<PreviewUrlInfo>;
6098
6115
  }
6099
6116
  declare class SandboxArtifacts {
6100
6117
  private readonly sandbox;
@@ -6218,6 +6235,7 @@ declare class Sandbox {
6218
6235
  listFiles(path?: string): Promise<SandboxFileList>;
6219
6236
  statFile(path: string): Promise<SandboxFileStat>;
6220
6237
  expose(port?: number): Promise<string>;
6238
+ exposeInfo(port?: number): Promise<PreviewUrlInfo>;
6221
6239
  startTemplate(options?: Record<string, unknown>): Promise<Record<string, unknown>>;
6222
6240
  getArtifacts(): Promise<Record<string, unknown>>;
6223
6241
  getLogs(lines?: number): Promise<string | Record<string, unknown>>;
package/dist/index.js CHANGED
@@ -4063,7 +4063,7 @@ var Computer = class _Computer {
4063
4063
  }
4064
4064
  /** Tenant's preview/base domain, white-label aware. */
4065
4065
  get previewDomain() {
4066
- return this.data.preview_domain || "miosa.app";
4066
+ return this.data.preview_domain || "miosa.ai";
4067
4067
  }
4068
4068
  // ─── Lifecycle ─────────────────────────────────────────────────────────────
4069
4069
  /** Start the computer. */
@@ -7353,6 +7353,9 @@ var SandboxPreview = class {
7353
7353
  expose(port) {
7354
7354
  return this.sandbox.expose(port);
7355
7355
  }
7356
+ exposeInfo(port) {
7357
+ return this.sandbox.exposeInfo(port);
7358
+ }
7356
7359
  };
7357
7360
  var SandboxArtifacts = class {
7358
7361
  constructor(sandbox) {
@@ -7707,6 +7710,9 @@ var Sandbox = class _Sandbox {
7707
7710
  );
7708
7711
  }
7709
7712
  async expose(port) {
7713
+ return (await this.exposeInfo(port)).url;
7714
+ }
7715
+ async exposeInfo(port) {
7710
7716
  this.assertRunning("expose");
7711
7717
  const response = unwrap44(
7712
7718
  await this.http.post(
@@ -7714,7 +7720,7 @@ var Sandbox = class _Sandbox {
7714
7720
  port === void 0 ? {} : { port }
7715
7721
  )
7716
7722
  );
7717
- return String(response.url ?? response.preview_url ?? "");
7723
+ return previewInfoFromResponse(response);
7718
7724
  }
7719
7725
  async startTemplate(options = {}) {
7720
7726
  this.assertRunning("startTemplate");
@@ -8198,6 +8204,26 @@ function toBase642(bytes) {
8198
8204
  }
8199
8205
  return btoa(binary);
8200
8206
  }
8207
+ function previewInfoFromResponse(response) {
8208
+ const url = String(response.url ?? response.preview_url ?? "");
8209
+ const embeddedInfo = response.url_info && typeof response.url_info === "object" ? response.url_info : {};
8210
+ return {
8211
+ ...embeddedInfo,
8212
+ url: String(embeddedInfo.url ?? url),
8213
+ class: String(
8214
+ response.class ?? response.url_class ?? embeddedInfo.class ?? embeddedInfo.url_class ?? "temporary_preview"
8215
+ ),
8216
+ url_class: String(
8217
+ response.url_class ?? response.class ?? embeddedInfo.url_class ?? embeddedInfo.class ?? "temporary_preview"
8218
+ ),
8219
+ stable_for_embedding: Boolean(
8220
+ response.stable_for_embedding ?? embeddedInfo.stable_for_embedding ?? false
8221
+ ),
8222
+ recommended_next_action: String(
8223
+ response.recommended_next_action ?? embeddedInfo.recommended_next_action ?? "create_alias_or_publish"
8224
+ )
8225
+ };
8226
+ }
8201
8227
  function unwrap45(payload) {
8202
8228
  if (payload && typeof payload === "object" && "data" in payload) {
8203
8229
  return payload.data;