@miosa/sdk 1.2.25 → 1.2.27

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 CHANGED
@@ -1047,6 +1047,11 @@ var AgentRuns = class {
1047
1047
  timeout: params.timeout,
1048
1048
  wait: params.wait,
1049
1049
  env: params.env,
1050
+ output_format: params.outputFormat ?? params.output_format,
1051
+ resume_session_id: params.resumeSessionId ?? params.resume_session_id,
1052
+ json: params.json,
1053
+ output_schema: params.outputSchema ?? params.output_schema,
1054
+ image: params.image,
1050
1055
  agent_runtime_profile_id: params.agentRuntimeProfileId,
1051
1056
  agent_profile_id: params.agentProfileId,
1052
1057
  agent_run_group_id: params.agentRunGroupId,
@@ -2684,6 +2689,18 @@ var Desktop = class {
2684
2689
  button
2685
2690
  });
2686
2691
  }
2692
+ /** Explicit left-button click. Alias for click(x, y, "left"). */
2693
+ async leftClick(x, y) {
2694
+ return this.click(x, y, "left");
2695
+ }
2696
+ /** Right-button click. Alias for click(x, y, "right"). */
2697
+ async rightClick(x, y) {
2698
+ return this.click(x, y, "right");
2699
+ }
2700
+ /** Middle-button click. Alias for click(x, y, "middle"). */
2701
+ async middleClick(x, y) {
2702
+ return this.click(x, y, "middle");
2703
+ }
2687
2704
  /** Double-click at the given coordinates. */
2688
2705
  async doubleClick(x, y) {
2689
2706
  const params = { x, y };
@@ -2692,16 +2709,28 @@ var Desktop = class {
2692
2709
  params
2693
2710
  );
2694
2711
  }
2712
+ /** Move the mouse pointer without clicking. */
2713
+ async moveMouse(x, y) {
2714
+ return this.http.post(`${this.base()}/move`, { x, y });
2715
+ }
2695
2716
  /** Type text into the currently focused element. */
2696
2717
  async type(text, delay) {
2697
2718
  const params = { text, ...delay !== void 0 && { delay } };
2698
2719
  return this.http.post(`${this.base()}/type`, params);
2699
2720
  }
2721
+ /** Alias for `type(text)` used by simple computer-control loops. */
2722
+ async write(text, delay) {
2723
+ return this.type(text, delay);
2724
+ }
2700
2725
  /** Send a key or key combination (e.g. "Enter", "ctrl+c"). */
2701
2726
  async key(key) {
2702
2727
  const params = { key };
2703
2728
  return this.http.post(`${this.base()}/key`, params);
2704
2729
  }
2730
+ /** Alias for `key(key)` used by simple computer-control loops. */
2731
+ async press(key) {
2732
+ return this.key(key);
2733
+ }
2705
2734
  /** Scroll in a direction at an optional position. */
2706
2735
  async scroll(direction, clicks = 3, x, y) {
2707
2736
  const params = {
@@ -4156,6 +4185,14 @@ var Computer = class _Computer {
4156
4185
  async doubleClick(x, y) {
4157
4186
  await this.desktop.doubleClick(x, y);
4158
4187
  }
4188
+ /** Middle-button click. */
4189
+ async middleClick(x, y) {
4190
+ await this.desktop.click(x, y, "middle");
4191
+ }
4192
+ /** Move the pointer without clicking. */
4193
+ async moveMouse(x, y) {
4194
+ await this.desktop.moveMouse(x, y);
4195
+ }
4159
4196
  /**
4160
4197
  * Type text into the focused element.
4161
4198
  * Shortcut for `computer.desktop.type(text)`.
@@ -4163,6 +4200,10 @@ var Computer = class _Computer {
4163
4200
  async type(text) {
4164
4201
  await this.desktop.type(text);
4165
4202
  }
4203
+ /** Alias for `type(text)`. */
4204
+ async write(text) {
4205
+ await this.desktop.write(text);
4206
+ }
4166
4207
  /**
4167
4208
  * Send a key or key combo.
4168
4209
  * Shortcut for `computer.desktop.key(key)`.
@@ -4170,6 +4211,10 @@ var Computer = class _Computer {
4170
4211
  async key(key) {
4171
4212
  await this.desktop.key(key);
4172
4213
  }
4214
+ /** Alias for `key(key)`. */
4215
+ async press(key) {
4216
+ await this.desktop.press(key);
4217
+ }
4173
4218
  /**
4174
4219
  * Scroll in a direction.
4175
4220
  * Shortcut for `computer.desktop.scroll(direction, clicks)`.
@@ -4285,6 +4330,17 @@ var Computer = class _Computer {
4285
4330
  await this.http.post(`/computers/${this.id}/stream-token`)
4286
4331
  );
4287
4332
  }
4333
+ /**
4334
+ * Mint a passwordless browser embed URL for authenticated platform sessions.
4335
+ *
4336
+ * Use this inside MIOSA or tenant apps. Raw shared desktop URLs can still use
4337
+ * the viewer password flow when opened outside an authenticated platform.
4338
+ */
4339
+ async embed() {
4340
+ return unwrapData(
4341
+ await this.http.get(`/computers/${this.id}/embed`)
4342
+ );
4343
+ }
4288
4344
  /** Clone this computer into a new one. */
4289
4345
  async clone(opts = {}) {
4290
4346
  const body4 = Object.fromEntries(
@@ -7057,6 +7113,11 @@ var Regions = class {
7057
7113
  const data = await this.http.get("/compute/regions");
7058
7114
  return listItems10(data);
7059
7115
  }
7116
+ /** Get canonical compute catalog, including product templates and readiness. */
7117
+ async catalog() {
7118
+ const data = await this.http.get("/compute/catalog");
7119
+ return unwrap41(data);
7120
+ }
7060
7121
  /** List available compute sizes. */
7061
7122
  async listSizes() {
7062
7123
  const data = await this.http.get("/compute/sizes");
@@ -7250,6 +7311,7 @@ function createBody(params = {}) {
7250
7311
  timeout_sec: params.timeoutSec ?? params.timeout_sec ?? (persistent === true ? 86400 : void 0),
7251
7312
  idle_timeout_sec: params.idleTimeoutSec ?? params.idle_timeout_sec ?? (persistent === true ? 1800 : void 0),
7252
7313
  always_on: params.alwaysOn ?? params.always_on,
7314
+ allow_provision: params.allowProvision ?? params.allow_provision,
7253
7315
  env: params.env,
7254
7316
  metadata: Object.keys(metadata).length > 0 ? metadata : void 0,
7255
7317
  services: params.services,
@@ -7444,6 +7506,15 @@ var SandboxEvents = class {
7444
7506
  return this.sandbox.http.stream(`/sandboxes/${this.sandbox.id}/events`);
7445
7507
  }
7446
7508
  };
7509
+ var SandboxMetrics = class {
7510
+ constructor(sandbox) {
7511
+ this.sandbox = sandbox;
7512
+ }
7513
+ sandbox;
7514
+ get(window2 = "1h") {
7515
+ return this.sandbox.metrics(window2);
7516
+ }
7517
+ };
7447
7518
  var SandboxPreviews = class {
7448
7519
  constructor(sandbox) {
7449
7520
  this.sandbox = sandbox;
@@ -7584,6 +7655,7 @@ var Sandbox = class _Sandbox {
7584
7655
  this.snapshots = new SandboxSnapshots(this);
7585
7656
  this.terminal = new SandboxTerminal(this);
7586
7657
  this.events = new SandboxEvents(this);
7658
+ this.metricsResource = new SandboxMetrics(this);
7587
7659
  this.previews = new SandboxPreviews(this);
7588
7660
  this.env = new SandboxEnv(this);
7589
7661
  this.tags = new SandboxTags(this);
@@ -7606,6 +7678,8 @@ var Sandbox = class _Sandbox {
7606
7678
  terminal;
7607
7679
  /** SSE event stream. */
7608
7680
  events;
7681
+ /** Operational metrics and current resource state. */
7682
+ metricsResource;
7609
7683
  /** Preview CRUD + share/revokeShare. */
7610
7684
  previews;
7611
7685
  /** Read-only env var listing. */
@@ -7748,6 +7822,14 @@ var Sandbox = class _Sandbox {
7748
7822
  async expose(port) {
7749
7823
  return (await this.exposeInfo(port)).url;
7750
7824
  }
7825
+ async getUrl(port, path = "/") {
7826
+ const url = new URL((await this.exposeInfo(port)).url);
7827
+ url.pathname = path.startsWith("/") ? path : `/${path}`;
7828
+ return url.toString();
7829
+ }
7830
+ async getHost(port) {
7831
+ return new URL((await this.exposeInfo(port)).url).host;
7832
+ }
7751
7833
  async exposeInfo(port) {
7752
7834
  this.assertRunning("expose");
7753
7835
  const response = unwrap44(
@@ -7786,6 +7868,17 @@ var Sandbox = class _Sandbox {
7786
7868
  `/sandboxes/${this.id}/logs/stream`
7787
7869
  );
7788
7870
  }
7871
+ async metrics(window2 = "1h") {
7872
+ return unwrap44(
7873
+ await this.http.get(
7874
+ `/sandboxes/${this.id}/metrics`,
7875
+ { window: window2 }
7876
+ )
7877
+ );
7878
+ }
7879
+ async getMetrics(window2 = "1h") {
7880
+ return this.metrics(window2);
7881
+ }
7789
7882
  async createSnapshot(comment) {
7790
7883
  this.assertRunning("snapshots.create");
7791
7884
  return unwrap44(
@@ -7837,7 +7930,8 @@ var Sandbox = class _Sandbox {
7837
7930
  async update(params) {
7838
7931
  const snapshotExpirationSec = snapshotExpirationSeconds(params);
7839
7932
  const metadata = { ...params.metadata ?? {} };
7840
- if (params.persistent !== void 0) metadata.miosa_persistent = params.persistent;
7933
+ if (params.persistent !== void 0)
7934
+ metadata.miosa_persistent = params.persistent;
7841
7935
  if (snapshotExpirationSec !== void 0) {
7842
7936
  metadata.snapshot_expiration_sec = snapshotExpirationSec;
7843
7937
  }
@@ -8775,6 +8869,50 @@ var Tenant = class {
8775
8869
  }
8776
8870
  };
8777
8871
 
8872
+ // src/resources/templates.ts
8873
+ function unwrapCatalog(payload) {
8874
+ if (!payload || typeof payload !== "object") return { templates: [] };
8875
+ const data = "data" in payload && typeof payload.data === "object" ? payload.data : payload;
8876
+ const templates = Array.isArray(data.templates) ? data.templates : [];
8877
+ return {
8878
+ ...data,
8879
+ templates
8880
+ };
8881
+ }
8882
+ var Templates = class {
8883
+ constructor(http) {
8884
+ this.http = http;
8885
+ }
8886
+ http;
8887
+ /**
8888
+ * List product-aware templates across sandbox, computer, and appliance.
8889
+ *
8890
+ * Use `sandboxTemplates` for tenant-owned sandbox template CRUD/builds.
8891
+ */
8892
+ async list(params = {}) {
8893
+ const data = await this.http.get("/templates");
8894
+ const catalog = unwrapCatalog(data);
8895
+ if (!params.product) return catalog.templates;
8896
+ return catalog.templates.filter((template) => template.product === params.product);
8897
+ }
8898
+ async catalog() {
8899
+ const data = await this.http.get("/templates");
8900
+ return unwrapCatalog(data);
8901
+ }
8902
+ async get(templateId, params = {}) {
8903
+ const templates = await this.list(params);
8904
+ const match = templates.find((template) => template.id === templateId);
8905
+ if (!match) {
8906
+ throw new Error(`Template not found: ${templateId}`);
8907
+ }
8908
+ return match;
8909
+ }
8910
+ async readiness(templateId, params = {}) {
8911
+ const template = await this.get(templateId, params);
8912
+ return template.sizes ?? [];
8913
+ }
8914
+ };
8915
+
8778
8916
  // src/resources/usage.ts
8779
8917
  function unwrap50(payload) {
8780
8918
  if (payload && typeof payload === "object") {
@@ -8869,6 +9007,39 @@ var Volumes = class {
8869
9007
  async delete(volumeId) {
8870
9008
  await this.http.delete(`/volumes/${volumeId}`);
8871
9009
  }
9010
+ async listAttachments(computerId) {
9011
+ const data = await this.http.get(`/computers/${computerId}/volumes`);
9012
+ return listItems15(data, [
9013
+ "data",
9014
+ "attachments",
9015
+ "volumes",
9016
+ "items"
9017
+ ]);
9018
+ }
9019
+ async attach(computerId, params) {
9020
+ const volumeId = params.volumeId ?? params.volume_id;
9021
+ const mountPath = params.mountPath ?? params.mount_path;
9022
+ const readOnly = params.readOnly ?? params.read_only;
9023
+ const body4 = stripUndefined30({
9024
+ ...params,
9025
+ volumeId: void 0,
9026
+ mountPath: void 0,
9027
+ readOnly: void 0,
9028
+ volume_id: volumeId,
9029
+ mount_path: mountPath,
9030
+ read_only: readOnly
9031
+ });
9032
+ const data = await this.http.post(
9033
+ `/computers/${computerId}/volumes`,
9034
+ body4
9035
+ );
9036
+ return unwrap51(data);
9037
+ }
9038
+ async detach(computerId, attachmentId) {
9039
+ await this.http.delete(
9040
+ `/computers/${computerId}/volumes/${attachmentId}`
9041
+ );
9042
+ }
8872
9043
  };
8873
9044
  function unwrap52(payload) {
8874
9045
  if (payload && typeof payload === "object" && "data" in payload) {
@@ -9226,6 +9397,8 @@ var Miosa = class {
9226
9397
  webhooks;
9227
9398
  /** Sandbox templates — CRUD, build-spec schema, builds. */
9228
9399
  sandboxTemplates;
9400
+ /** Product-aware templates — catalog/readiness for sandbox, computer, appliance. */
9401
+ templates;
9229
9402
  /** API key management — list, create, delete. */
9230
9403
  apiKeys;
9231
9404
  // ── P3 / P4 resources ──────────────────────────────────────────────────────
@@ -9314,6 +9487,7 @@ var Miosa = class {
9314
9487
  this.healthChecks = new HealthChecks(this.http);
9315
9488
  this.webhooks = new Webhooks(this.http);
9316
9489
  this.sandboxTemplates = new SandboxTemplates(this.http);
9490
+ this.templates = new Templates(this.http);
9317
9491
  this.apiKeys = new ApiKeys(this.http);
9318
9492
  this.models = new Models(this.http);
9319
9493
  this.completions = new Completions(this.http);
@@ -9812,6 +9986,6 @@ var AppAuth = class {
9812
9986
  }
9813
9987
  };
9814
9988
 
9815
- export { AGENT_BUILD_KIND_SPECS, Admin, AgentRunGroups, AgentRuns, AgentRuntimeProfiles, Analytics, ApiKeys, AppAuth, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, Cloud, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerConnectors, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Connectors, Credits, CronJobs, DEFAULT_AGENT_BUILD_OUTPUT_ROOT, DEFAULT_AGENT_BUILD_PACKET_VERSION, Dashboard, Databases, DeploymentConnectors, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, Devices, DockerDeploy, EgressAudit, EgressHostNotAllowedError, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Functions, HealthChecks, InstallationRequiredError, InsufficientCreditsError, Integrations, ManagedProviderBindingOnlyError, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, ProjectAuth, ProjectIntegrations, ProjectNotLinkedError, ProviderDefaults, RateLimitError, Regions, RuntimeCapabilitiesResource, RuntimeEnv, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, SandboxCommands, SandboxConnectors, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopeNotAllowedError, ScopedFs, Settings, SnapshotsStandalone, Storage, SubjectNotAllowedError, Tenant, TimeoutError, TokenRefreshFailedError, Usage, UserAuthorizationRequiredError, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers, createAgentBuildExecutionPacket, createAgentBuildOutputContract, createAgentBuildPrompt, createBuildAgentRunParams, getAgentBuildKindSpec, resolveAgentBuildKind, verifySignature };
9989
+ export { AGENT_BUILD_KIND_SPECS, Admin, AgentRunGroups, AgentRuns, AgentRuntimeProfiles, Analytics, ApiKeys, AppAuth, AuditLog, AuthError, Benchmarks, BuilderSessions, Channels, Checkpoints, Cloud, CommandCenter, Community, Completions, Computer, ComputerAudit, ComputerAutoStop, ComputerConnectors, ComputerEnv, ComputerInbox, ComputerLogs, ComputerNetwork, ComputerOsa, ComputerPorts, ComputerSecrets, ComputerTerminal, ComputerVolumes, Computers, Connectors, Credits, CronJobs, DEFAULT_AGENT_BUILD_OUTPUT_ROOT, DEFAULT_AGENT_BUILD_PACKET_VERSION, Dashboard, Databases, DeploymentConnectors, DeploymentDomains, DeploymentReleases, DeploymentRuntimeInstances, DeploymentVersions, Deployments, Desktop, Devices, DockerDeploy, EgressAudit, EgressHostNotAllowedError, EgressNetwork, EgressSecrets, Email, EmailCampaigns, EmailInbox, EmailTemplates, Embeddings, Exec, ExternalKeys, Files, FlatCustomDomains, Functions, HealthChecks, InstallationRequiredError, InsufficientCreditsError, Integrations, ManagedProviderBindingOnlyError, Mcp, Miosa, MiosaError, Models, NetworkError, NetworkPolicy, NotFoundError, OAuthFlow, OpenComputers, OrgInvites, ProjectAuth, ProjectIntegrations, ProjectNotLinkedError, ProviderDefaults, RateLimitError, Regions, RuntimeCapabilitiesResource, RuntimeEnv, SANDBOX_TEMPLATE, Sandbox, SandboxArtifacts, SandboxAudit, SandboxCommands, SandboxConnectors, SandboxEnv, SandboxEvents, SandboxFiles, SandboxNetwork, SandboxPreview, SandboxPreviews, SandboxSecrets, SandboxTags, SandboxTemplates, SandboxTerminal, Sandboxes, ScopeNotAllowedError, ScopedFs, Settings, SnapshotsStandalone, Storage, SubjectNotAllowedError, Templates, Tenant, TimeoutError, TokenRefreshFailedError, Usage, UserAuthorizationRequiredError, ValidationError, Volumes, Webhooks, WorkspaceInvites, WorkspaceMembers, createAgentBuildExecutionPacket, createAgentBuildOutputContract, createAgentBuildPrompt, createBuildAgentRunParams, getAgentBuildKindSpec, resolveAgentBuildKind, verifySignature };
9816
9990
  //# sourceMappingURL=index.js.map
9817
9991
  //# sourceMappingURL=index.js.map