@miosa/sdk 1.2.26 → 1.2.28

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
@@ -673,17 +673,17 @@ var Admin = class {
673
673
  }
674
674
  };
675
675
 
676
- // src/resources/agent-run-groups.ts
676
+ // src/resources/run-groups.ts
677
677
  function unwrap(payload) {
678
678
  if (payload && typeof payload === "object" && "data" in payload) {
679
679
  return payload.data;
680
680
  }
681
681
  return payload;
682
682
  }
683
- function artifactRows(raw) {
683
+ function fileRows(raw) {
684
684
  const data = unwrap(raw);
685
685
  if (Array.isArray(data)) return data;
686
- return data.artifacts ?? data.items ?? [];
686
+ return data.files ?? data.items ?? [];
687
687
  }
688
688
  function stripUndefined(input) {
689
689
  return Object.fromEntries(
@@ -703,12 +703,14 @@ function body(params) {
703
703
  }
704
704
  function runBody(entry) {
705
705
  return stripUndefined({
706
- prompt: entry.prompt,
706
+ instruction: entry.instruction,
707
707
  target_kind: entry.targetKind,
708
708
  target_id: entry.targetId,
709
+ runtime_id: entry.runtimeId,
709
710
  sandbox_id: entry.sandboxId,
710
711
  computer_id: entry.computerId,
711
712
  provider: entry.provider,
713
+ runner: entry.runner,
712
714
  model: entry.model,
713
715
  command: entry.command,
714
716
  runtime_command: entry.runtimeCommand,
@@ -717,11 +719,11 @@ function runBody(entry) {
717
719
  env: entry.env,
718
720
  agent_runtime_profile_id: entry.agentRuntimeProfileId,
719
721
  agent_profile_id: entry.agentProfileId,
720
- parent_agent_run_id: entry.parentAgentRunId,
722
+ parent_run_id: entry.parentRunId,
721
723
  orchestration_role: entry.orchestrationRole,
722
- skip_agent_runtime_profile: entry.skipAgentRuntimeProfile,
724
+ skip_agent_runtime_profile: entry.skipRuntimeProfile,
723
725
  execution_packet: entry.executionPacket,
724
- output_contract: entry.outputContract,
726
+ expected_outputs: entry.expectedOutputs,
725
727
  approval_policy: entry.approvalPolicy,
726
728
  capability_requirements: entry.capabilityRequirements,
727
729
  metadata: entry.metadata
@@ -734,14 +736,14 @@ function sleep2(ms) {
734
736
  if (ms <= 0) return Promise.resolve();
735
737
  return new Promise((resolve) => setTimeout(resolve, ms));
736
738
  }
737
- var AgentRunGroups = class {
739
+ var RunGroups = class {
738
740
  constructor(http) {
739
741
  this.http = http;
740
742
  }
741
743
  http;
742
744
  async list(params = {}) {
743
745
  const response = await this.http.get(
744
- "/agent-run-groups",
746
+ "/run-groups",
745
747
  stripUndefined({
746
748
  workspace_id: params.workspaceId,
747
749
  project_id: params.projectId,
@@ -757,19 +759,19 @@ var AgentRunGroups = class {
757
759
  }
758
760
  async create(params) {
759
761
  return unwrap(
760
- await this.http.post("/agent-run-groups", body(params))
762
+ await this.http.post("/run-groups", body(params))
761
763
  );
762
764
  }
763
765
  async get(id, options = {}) {
764
766
  const query3 = options.includeRuns ? "?include=runs" : "";
765
767
  return unwrap(
766
- await this.http.get(`/agent-run-groups/${encodeURIComponent(id)}${query3}`)
768
+ await this.http.get(`/run-groups/${encodeURIComponent(id)}${query3}`)
767
769
  );
768
770
  }
769
771
  async dispatch(id, runs, options = {}) {
770
772
  return unwrap(
771
773
  await this.http.post(
772
- `/agent-run-groups/${encodeURIComponent(id)}/dispatch`,
774
+ `/run-groups/${encodeURIComponent(id)}/dispatch`,
773
775
  stripUndefined({ runs: runs.map(runBody), async: options.async })
774
776
  )
775
777
  );
@@ -777,38 +779,38 @@ var AgentRunGroups = class {
777
779
  async cancel(id) {
778
780
  return unwrap(
779
781
  await this.http.post(
780
- `/agent-run-groups/${encodeURIComponent(id)}/cancel`,
782
+ `/run-groups/${encodeURIComponent(id)}/cancel`,
781
783
  {}
782
784
  )
783
785
  );
784
786
  }
785
- async events(id) {
787
+ async activity(id) {
786
788
  const data = unwrap(
787
789
  await this.http.get(
788
- `/agent-run-groups/${encodeURIComponent(id)}/events`
790
+ `/run-groups/${encodeURIComponent(id)}/activity`
789
791
  )
790
792
  );
791
793
  if (Array.isArray(data)) return data;
792
- return data.events ?? data.items ?? [];
794
+ return data.activity ?? data.items ?? [];
793
795
  }
794
- streamEvents(id) {
796
+ streamActivity(id) {
795
797
  return this.http.stream(
796
- `/agent-run-groups/${encodeURIComponent(id)}/events`
798
+ `/run-groups/${encodeURIComponent(id)}/activity`
797
799
  );
798
800
  }
799
- async artifacts(id) {
801
+ async files(id) {
800
802
  const group = await this.get(id, { includeRuns: true });
801
803
  const runs = (group.runs ?? []).filter((run) => Boolean(run.id));
802
804
  const nested = await Promise.all(
803
805
  runs.map(async (run) => {
804
- const artifacts = artifactRows(
806
+ const files = fileRows(
805
807
  await this.http.get(
806
- `/agent-runs/${encodeURIComponent(run.id)}/artifacts`
808
+ `/runs/${encodeURIComponent(run.id)}/files`
807
809
  )
808
810
  );
809
- return artifacts.map((artifact) => ({
810
- ...artifact,
811
- agent_run_id: artifact.agent_run_id ?? run.id
811
+ return files.map((file) => ({
812
+ ...file,
813
+ run_id: file.run_id ?? run.id
812
814
  }));
813
815
  })
814
816
  );
@@ -831,7 +833,7 @@ var AgentRunGroups = class {
831
833
  );
832
834
  if (isTerminalStatus(group.status, terminalStatuses)) return group;
833
835
  if (Date.now() >= deadline) {
834
- throw new Error(`Timed out waiting for agent run group ${id}`);
836
+ throw new Error(`Timed out waiting for run group ${id}`);
835
837
  }
836
838
  await sleep2(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
837
839
  }
@@ -934,7 +936,7 @@ var AgentRuntimeProfiles = class {
934
936
  }
935
937
  };
936
938
 
937
- // src/resources/agent-runs.ts
939
+ // src/resources/runs.ts
938
940
  function unwrap3(payload) {
939
941
  if (payload && typeof payload === "object" && "data" in payload) {
940
942
  return payload.data;
@@ -953,20 +955,21 @@ function sleep3(ms) {
953
955
  if (ms <= 0) return Promise.resolve();
954
956
  return new Promise((resolve) => setTimeout(resolve, ms));
955
957
  }
956
- var AgentRuns = class {
958
+ var Runs = class {
957
959
  constructor(http) {
958
960
  this.http = http;
959
961
  }
960
962
  http;
961
963
  async list(params = {}) {
962
964
  const response = await this.http.get(
963
- "/agent-runs",
965
+ "/runs",
964
966
  stripUndefined2({
965
967
  target_kind: params.targetKind,
966
968
  target_id: params.targetId,
969
+ runtime_id: params.runtimeId,
967
970
  sandbox_id: params.sandboxId,
968
971
  computer_id: params.computerId,
969
- agent_run_group_id: params.agentRunGroupId,
972
+ run_group_id: params.runGroupId,
970
973
  external_workspace_id: params.externalWorkspaceId ?? params.external_workspace_id,
971
974
  external_user_id: params.externalUserId ?? params.external_user_id,
972
975
  external_project_id: params.externalProjectId ?? params.external_project_id,
@@ -981,36 +984,63 @@ var AgentRuns = class {
981
984
  }
982
985
  async get(id) {
983
986
  return unwrap3(
984
- await this.http.get(`/agent-runs/${encodeURIComponent(id)}`)
987
+ await this.http.get(`/runs/${encodeURIComponent(id)}`)
985
988
  );
986
989
  }
987
- async artifacts(id) {
990
+ async outputs(id) {
991
+ return unwrap3(
992
+ await this.http.get(`/runs/${encodeURIComponent(id)}/outputs`)
993
+ );
994
+ }
995
+ async files(id) {
988
996
  const data = unwrap3(
989
- await this.http.get(
990
- `/agent-runs/${encodeURIComponent(id)}/artifacts`
991
- )
997
+ await this.http.get(`/runs/${encodeURIComponent(id)}/files`)
992
998
  );
993
999
  if (Array.isArray(data)) return data;
994
- return data.artifacts ?? data.items ?? [];
1000
+ return data.files ?? data.items ?? [];
995
1001
  }
996
- async downloadArtifact(id, artifactId, options = {}) {
1002
+ async downloadFile(id, fileId, options = {}) {
997
1003
  const query3 = options.inline ? "?disposition=inline" : "";
998
1004
  return this.http.getBinary(
999
- `/agent-runs/${encodeURIComponent(id)}/artifacts/${encodeURIComponent(
1000
- artifactId
1005
+ `/runs/${encodeURIComponent(id)}/files/${encodeURIComponent(
1006
+ fileId
1001
1007
  )}/download${query3}`
1002
1008
  );
1003
1009
  }
1004
- async events(id) {
1010
+ async messages(id) {
1011
+ const data = unwrap3(
1012
+ await this.http.get(`/runs/${encodeURIComponent(id)}/messages`)
1013
+ );
1014
+ if (Array.isArray(data)) return data;
1015
+ return data.messages ?? data.items ?? [];
1016
+ }
1017
+ async commandOutput(id) {
1018
+ return unwrap3(
1019
+ await this.http.get(`/runs/${encodeURIComponent(id)}/command-output`)
1020
+ );
1021
+ }
1022
+ async activity(id) {
1023
+ const data = unwrap3(
1024
+ await this.http.get(`/runs/${encodeURIComponent(id)}/activity`)
1025
+ );
1026
+ if (Array.isArray(data)) return data;
1027
+ return data.activity ?? data.items ?? [];
1028
+ }
1029
+ async previews(id) {
1005
1030
  const data = unwrap3(
1006
- await this.http.get(`/agent-runs/${encodeURIComponent(id)}/events`)
1031
+ await this.http.get(`/runs/${encodeURIComponent(id)}/previews`)
1007
1032
  );
1008
1033
  if (Array.isArray(data)) return data;
1009
- return data.events ?? data.items ?? [];
1034
+ return data.previews ?? data.items ?? [];
1010
1035
  }
1011
- streamEvents(id) {
1036
+ async diagnostics(id) {
1037
+ const data = unwrap3(await this.http.get(`/runs/${encodeURIComponent(id)}/diagnostics`));
1038
+ if (Array.isArray(data)) return data;
1039
+ return data.diagnostics ?? data.items ?? [];
1040
+ }
1041
+ streamActivity(id) {
1012
1042
  return this.http.stream(
1013
- `/agent-runs/${encodeURIComponent(id)}/events`
1043
+ `/runs/${encodeURIComponent(id)}/activity`
1014
1044
  );
1015
1045
  }
1016
1046
  async waitForCompletion(id, options = {}) {
@@ -1027,19 +1057,21 @@ var AgentRuns = class {
1027
1057
  const run = await this.get(id);
1028
1058
  if (isTerminalStatus2(run.status, terminalStatuses)) return run;
1029
1059
  if (Date.now() >= deadline) {
1030
- throw new Error(`Timed out waiting for agent run ${id}`);
1060
+ throw new Error(`Timed out waiting for run ${id}`);
1031
1061
  }
1032
1062
  await sleep3(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
1033
1063
  }
1034
1064
  }
1035
1065
  async run(params) {
1036
1066
  const body4 = stripUndefined2({
1037
- prompt: params.prompt,
1067
+ instruction: params.instruction,
1038
1068
  target_kind: params.targetKind,
1039
1069
  target_id: params.targetId,
1070
+ runtime_id: params.runtimeId,
1040
1071
  sandbox_id: params.sandboxId,
1041
1072
  computer_id: params.computerId,
1042
1073
  provider: params.provider,
1074
+ runner: params.runner,
1043
1075
  model: params.model,
1044
1076
  command: params.command,
1045
1077
  runtime_command: params.runtimeCommand,
@@ -1047,32 +1079,27 @@ var AgentRuns = class {
1047
1079
  timeout: params.timeout,
1048
1080
  wait: params.wait,
1049
1081
  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,
1055
1082
  agent_runtime_profile_id: params.agentRuntimeProfileId,
1056
1083
  agent_profile_id: params.agentProfileId,
1057
- agent_run_group_id: params.agentRunGroupId,
1058
- parent_agent_run_id: params.parentAgentRunId,
1084
+ run_group_id: params.runGroupId,
1085
+ parent_run_id: params.parentRunId,
1059
1086
  orchestration_role: params.orchestrationRole,
1060
1087
  external_workspace_id: params.externalWorkspaceId ?? params.external_workspace_id,
1061
1088
  external_user_id: params.externalUserId ?? params.external_user_id,
1062
1089
  external_project_id: params.externalProjectId ?? params.external_project_id,
1063
- skip_agent_runtime_profile: params.skipAgentRuntimeProfile,
1090
+ skip_agent_runtime_profile: params.skipRuntimeProfile,
1064
1091
  execution_packet: params.executionPacket,
1065
- output_contract: params.outputContract,
1092
+ expected_outputs: params.expectedOutputs,
1066
1093
  approval_policy: params.approvalPolicy,
1067
1094
  capability_requirements: params.capabilityRequirements,
1068
1095
  metadata: params.metadata
1069
1096
  });
1070
- return unwrap3(await this.http.post("/agent-runs", body4));
1097
+ return unwrap3(await this.http.post("/runs", body4));
1071
1098
  }
1072
1099
  async cancel(id) {
1073
1100
  return unwrap3(
1074
1101
  await this.http.post(
1075
- `/agent-runs/${encodeURIComponent(id)}/cancel`,
1102
+ `/runs/${encodeURIComponent(id)}/cancel`,
1076
1103
  {}
1077
1104
  )
1078
1105
  );
@@ -2689,18 +2716,6 @@ var Desktop = class {
2689
2716
  button
2690
2717
  });
2691
2718
  }
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
- }
2704
2719
  /** Double-click at the given coordinates. */
2705
2720
  async doubleClick(x, y) {
2706
2721
  const params = { x, y };
@@ -2709,28 +2724,16 @@ var Desktop = class {
2709
2724
  params
2710
2725
  );
2711
2726
  }
2712
- /** Move the mouse pointer without clicking. */
2713
- async moveMouse(x, y) {
2714
- return this.http.post(`${this.base()}/move`, { x, y });
2715
- }
2716
2727
  /** Type text into the currently focused element. */
2717
2728
  async type(text, delay) {
2718
2729
  const params = { text, ...delay !== void 0 && { delay } };
2719
2730
  return this.http.post(`${this.base()}/type`, params);
2720
2731
  }
2721
- /** Alias for `type(text)` used by simple computer-control loops. */
2722
- async write(text, delay) {
2723
- return this.type(text, delay);
2724
- }
2725
2732
  /** Send a key or key combination (e.g. "Enter", "ctrl+c"). */
2726
2733
  async key(key) {
2727
2734
  const params = { key };
2728
2735
  return this.http.post(`${this.base()}/key`, params);
2729
2736
  }
2730
- /** Alias for `key(key)` used by simple computer-control loops. */
2731
- async press(key) {
2732
- return this.key(key);
2733
- }
2734
2737
  /** Scroll in a direction at an optional position. */
2735
2738
  async scroll(direction, clicks = 3, x, y) {
2736
2739
  const params = {
@@ -4132,16 +4135,18 @@ var Computer = class _Computer {
4132
4135
  * Run an AI agent inside this Computer.
4133
4136
  *
4134
4137
  * The Computer is the graphical desktop VM product. This dispatches the
4135
- * same Agent Runs API as `miosa agent run --computer`, scoped to this VM.
4138
+ * same Runs API as `miosa agent run --computer`, scoped to this VM.
4136
4139
  */
4137
- async prompt(instruction, options = {}) {
4138
- return new AgentRuns(this.http).run({
4140
+ async run(instruction, options = {}) {
4141
+ const runner = options.runner ?? "claude-code";
4142
+ return new Runs(this.http).run({
4139
4143
  ...options,
4140
- prompt: instruction,
4144
+ instruction,
4141
4145
  targetKind: "computer",
4142
4146
  targetId: this.id,
4147
+ runtimeId: this.id,
4143
4148
  computerId: this.id,
4144
- provider: options.provider ?? "claude",
4149
+ runner,
4145
4150
  cwd: options.cwd ?? "/workspace",
4146
4151
  wait: options.wait ?? true
4147
4152
  });
@@ -4185,14 +4190,6 @@ var Computer = class _Computer {
4185
4190
  async doubleClick(x, y) {
4186
4191
  await this.desktop.doubleClick(x, y);
4187
4192
  }
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
- }
4196
4193
  /**
4197
4194
  * Type text into the focused element.
4198
4195
  * Shortcut for `computer.desktop.type(text)`.
@@ -4200,10 +4197,6 @@ var Computer = class _Computer {
4200
4197
  async type(text) {
4201
4198
  await this.desktop.type(text);
4202
4199
  }
4203
- /** Alias for `type(text)`. */
4204
- async write(text) {
4205
- await this.desktop.write(text);
4206
- }
4207
4200
  /**
4208
4201
  * Send a key or key combo.
4209
4202
  * Shortcut for `computer.desktop.key(key)`.
@@ -4211,10 +4204,6 @@ var Computer = class _Computer {
4211
4204
  async key(key) {
4212
4205
  await this.desktop.key(key);
4213
4206
  }
4214
- /** Alias for `key(key)`. */
4215
- async press(key) {
4216
- await this.desktop.press(key);
4217
- }
4218
4207
  /**
4219
4208
  * Scroll in a direction.
4220
4209
  * Shortcut for `computer.desktop.scroll(direction, clicks)`.
@@ -4330,17 +4319,6 @@ var Computer = class _Computer {
4330
4319
  await this.http.post(`/computers/${this.id}/stream-token`)
4331
4320
  );
4332
4321
  }
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
- }
4344
4322
  /** Clone this computer into a new one. */
4345
4323
  async clone(opts = {}) {
4346
4324
  const body4 = Object.fromEntries(
@@ -4451,6 +4429,7 @@ var Computers = class {
4451
4429
  agentRuntimeProfileId,
4452
4430
  agentProfileId,
4453
4431
  skipAgentRuntimeProfile,
4432
+ skipRuntimeProfile,
4454
4433
  ...body4
4455
4434
  } = params;
4456
4435
  const data = await this.http.post("/computers", {
@@ -4458,7 +4437,7 @@ var Computers = class {
4458
4437
  ...body4,
4459
4438
  size: normalizeComputerSize(body4.size ?? "small"),
4460
4439
  agent_runtime_profile_id: agentRuntimeProfileId ?? params.agent_runtime_profile_id ?? agentProfileId ?? params.agent_profile_id,
4461
- skip_agent_runtime_profile: skipAgentRuntimeProfile ?? params.skip_agent_runtime_profile
4440
+ skip_agent_runtime_profile: skipAgentRuntimeProfile ?? skipRuntimeProfile ?? params.skip_agent_runtime_profile
4462
4441
  });
4463
4442
  return new Computer(this.http, data);
4464
4443
  }
@@ -4819,14 +4798,21 @@ function dockerDeployProduct(deployment) {
4819
4798
  }
4820
4799
  function dockerDeployHostId(deployment) {
4821
4800
  const metadataHost = deployment.metadata?.docker_deploy_host_id;
4822
- return deployment.docker_deploy_host_id ?? (typeof metadataHost === "string" ? metadataHost : null);
4801
+ const appHost = dockerDeployApp(deployment)?.docker_deploy_host_id;
4802
+ return deployment.docker_deploy_host_id ?? (typeof metadataHost === "string" ? metadataHost : null) ?? (typeof appHost === "string" ? appHost : null);
4823
4803
  }
4824
4804
  function dockerDeployApp(deployment) {
4805
+ if (deployment.docker_deploy_app && typeof deployment.docker_deploy_app === "object" && !Array.isArray(deployment.docker_deploy_app)) {
4806
+ return deployment.docker_deploy_app;
4807
+ }
4825
4808
  const app = deployment.metadata?.docker_deploy;
4826
4809
  if (!app || typeof app !== "object" || Array.isArray(app)) return null;
4827
4810
  return app;
4828
4811
  }
4829
4812
  function dockerDeployAppPort(app) {
4813
+ const runtimePort = app?.runtime_port;
4814
+ if (typeof runtimePort === "number" && Number.isFinite(runtimePort)) return runtimePort;
4815
+ if (typeof runtimePort === "string" && /^\d+$/.test(runtimePort)) return Number(runtimePort);
4830
4816
  const url = app?.url;
4831
4817
  if (typeof url !== "string") return null;
4832
4818
  try {
@@ -4840,6 +4826,21 @@ function dockerDeployAppPort(app) {
4840
4826
  function addDoctorCheck(checks, name, ok, message, details) {
4841
4827
  checks.push({ name, ok, message, ...details ? { details } : {} });
4842
4828
  }
4829
+ function addProofCheck(checks, id, ok, message, details, recovery) {
4830
+ checks.push({
4831
+ id,
4832
+ ok,
4833
+ message,
4834
+ ...details ? { details } : {},
4835
+ ...recovery ? { recovery } : {}
4836
+ });
4837
+ }
4838
+ function deploymentPublicUrl(deployment) {
4839
+ const app = dockerDeployApp(deployment);
4840
+ const appUrl = app?.public_url;
4841
+ if (typeof appUrl === "string" && appUrl) return appUrl;
4842
+ return deployment.public_url ?? null;
4843
+ }
4843
4844
  function hostHealthy(host) {
4844
4845
  return Boolean(
4845
4846
  host && host.status === "active" && host.appliance_status === "healthy"
@@ -5033,7 +5034,7 @@ var Deployments = class {
5033
5034
  return unwrap28(data);
5034
5035
  }
5035
5036
  /**
5036
- * Create a deployment that runs on the workspace's dedicated Docker Deploy
5037
+ * Create a deployment that runs on the workspace's dedicated App Engine
5037
5038
  * runtime. It uses the same /deployments API as MIOSA Deploy, but marks the
5038
5039
  * deployment so the control plane attaches it to the workspace Docker host.
5039
5040
  */
@@ -5044,7 +5045,7 @@ var Deployments = class {
5044
5045
  });
5045
5046
  }
5046
5047
  /**
5047
- * Verify a Docker Deploy deployment before telling a user or agent it is
5048
+ * Verify a App Engine deployment before telling a user or agent it is
5048
5049
  * live. Checks product markers, appliance host health, route metadata, and
5049
5050
  * optionally probes the public URL.
5050
5051
  */
@@ -5058,14 +5059,14 @@ var Deployments = class {
5058
5059
  checks,
5059
5060
  "deployment_product",
5060
5061
  product === "docker_deploy",
5061
- product === "docker_deploy" ? "Deployment is marked for Docker Deploy." : `Expected deployment_product=docker_deploy, got ${String(product ?? "missing")}.`,
5062
+ product === "docker_deploy" ? "Deployment is marked for App Engine." : `Expected deployment_product=docker_deploy, got ${String(product ?? "missing")}.`,
5062
5063
  { deployment_product: product ?? null }
5063
5064
  );
5064
5065
  addDoctorCheck(
5065
5066
  checks,
5066
5067
  "docker_deploy_host_id",
5067
5068
  Boolean(hostId),
5068
- hostId ? "Deployment has a Docker Deploy host id." : "Deployment has no docker_deploy_host_id.",
5069
+ hostId ? "Deployment has a App Engine host id." : "Deployment has no docker_deploy_host_id.",
5069
5070
  { docker_deploy_host_id: hostId }
5070
5071
  );
5071
5072
  let host;
@@ -5081,7 +5082,7 @@ var Deployments = class {
5081
5082
  checks,
5082
5083
  "docker_deploy_host_health",
5083
5084
  hostHealthy(host),
5084
- hostHealthy(host) ? "Docker Deploy host is active and healthy." : `Docker Deploy host status=${host.status} appliance=${host.appliance_status}.`,
5085
+ hostHealthy(host) ? "App Engine host is active and healthy." : `App Engine host status=${host.status} appliance=${host.appliance_status}.`,
5085
5086
  {
5086
5087
  status: host.status,
5087
5088
  appliance_status: host.appliance_status
@@ -5103,7 +5104,7 @@ var Deployments = class {
5103
5104
  checks,
5104
5105
  "docker_deploy_app",
5105
5106
  appRunning,
5106
- appRunning ? "Docker Deploy app metadata points at a running container." : "Deployment is missing running Docker Deploy app metadata.",
5107
+ appRunning ? "App Engine app metadata points at a running container." : "Deployment is missing running App Engine app metadata.",
5107
5108
  app ? {
5108
5109
  app_id: app.app_id,
5109
5110
  container_id: app.container_id,
@@ -5114,8 +5115,12 @@ var Deployments = class {
5114
5115
  );
5115
5116
  const runtime = metadata.runtime;
5116
5117
  const runtimeCandidate = typeof runtime === "object" && runtime !== null ? runtime : void 0;
5117
- const hasRuntimeRoute = typeof runtimeCandidate?.ip === "string" && typeof runtimeCandidate.port === "number";
5118
- const runtimeRecord = hasRuntimeRoute ? runtimeCandidate : void 0;
5118
+ const appRuntimeIp = app?.runtime_ip;
5119
+ const appRuntimePort = app?.runtime_port;
5120
+ const appRuntimeCandidate = typeof appRuntimeIp === "string" && (typeof appRuntimePort === "number" || typeof appRuntimePort === "string") ? { ip: appRuntimeIp, port: Number(appRuntimePort) } : void 0;
5121
+ const effectiveRuntime = appRuntimeCandidate ?? runtimeCandidate;
5122
+ const hasRuntimeRoute = typeof effectiveRuntime?.ip === "string" && typeof effectiveRuntime.port === "number" && Number.isFinite(effectiveRuntime.port);
5123
+ const runtimeRecord = hasRuntimeRoute ? effectiveRuntime : void 0;
5119
5124
  const routeMatchesContainerPort = hasRuntimeRoute && (appPort === null || runtimeRecord?.port === appPort);
5120
5125
  addDoctorCheck(
5121
5126
  checks,
@@ -5129,7 +5134,7 @@ var Deployments = class {
5129
5134
  } : void 0
5130
5135
  );
5131
5136
  let probe;
5132
- const publicUrl = deployment.public_url;
5137
+ const publicUrl = deploymentPublicUrl(deployment);
5133
5138
  const path = params.probePath ?? params.probe_path ?? "/";
5134
5139
  if (publicUrl && typeof fetch === "function") {
5135
5140
  const url = probeUrl(publicUrl, path);
@@ -5176,6 +5181,146 @@ var Deployments = class {
5176
5181
  ...probe ? { probe } : {}
5177
5182
  };
5178
5183
  }
5184
+ async prove(deploymentId, params = {}) {
5185
+ const deployment = await this.get(deploymentId);
5186
+ const product = dockerDeployProduct(deployment);
5187
+ const checks = [];
5188
+ const publicUrl = deploymentPublicUrl(deployment);
5189
+ addProofCheck(
5190
+ checks,
5191
+ "deployment_row",
5192
+ true,
5193
+ `Deployment ${deployment.id} exists with state=${deployment.state}.`,
5194
+ { state: deployment.state }
5195
+ );
5196
+ addProofCheck(
5197
+ checks,
5198
+ "deployment_running",
5199
+ deployment.state === "running",
5200
+ deployment.state === "running" ? "Deployment is marked running." : `Deployment state is ${deployment.state}, expected running.`,
5201
+ { state: deployment.state },
5202
+ ["Inspect deployment logs.", "Redeploy the deployment."]
5203
+ );
5204
+ addProofCheck(
5205
+ checks,
5206
+ "public_url_present",
5207
+ Boolean(publicUrl),
5208
+ publicUrl ? `Public URL is ${publicUrl}.` : "Deployment has no public URL.",
5209
+ { public_url: publicUrl }
5210
+ );
5211
+ if (product === "docker_deploy") {
5212
+ const app = dockerDeployApp(deployment);
5213
+ const appPort = dockerDeployAppPort(app);
5214
+ const hostId = dockerDeployHostId(deployment);
5215
+ const runtimeIp = typeof app?.runtime_ip === "string" ? app.runtime_ip : typeof deployment.metadata?.runtime === "object" && deployment.metadata.runtime !== null ? deployment.metadata.runtime.ip : null;
5216
+ addProofCheck(
5217
+ checks,
5218
+ "docker_deploy_host_link",
5219
+ Boolean(hostId),
5220
+ hostId ? `Deployment links App Engine host ${hostId}.` : "Deployment has no App Engine host id.",
5221
+ { docker_deploy_host_id: hostId },
5222
+ ["Ensure the workspace App Engine appliance."]
5223
+ );
5224
+ if (hostId) {
5225
+ try {
5226
+ const rawHost = await this.http.get(
5227
+ `/docker-deploy/hosts/${hostId}`
5228
+ );
5229
+ const host = unwrap28(
5230
+ rawHost
5231
+ );
5232
+ addProofCheck(
5233
+ checks,
5234
+ "docker_deploy_host_ready",
5235
+ hostHealthy(host),
5236
+ `Host status=${host.status}, appliance=${host.appliance_status}.`,
5237
+ {
5238
+ status: host.status,
5239
+ appliance_status: host.appliance_status
5240
+ },
5241
+ ["Check App Engine host health."]
5242
+ );
5243
+ } catch (error) {
5244
+ addProofCheck(
5245
+ checks,
5246
+ "docker_deploy_host_ready",
5247
+ false,
5248
+ error instanceof Error ? error.message : String(error),
5249
+ { docker_deploy_host_id: hostId }
5250
+ );
5251
+ }
5252
+ }
5253
+ addProofCheck(
5254
+ checks,
5255
+ "docker_deploy_app_row",
5256
+ Boolean(app),
5257
+ app ? `App Engine app status=${String(app.status ?? "unknown")}.` : "App Engine app row is missing.",
5258
+ app ? {
5259
+ app_id: app.app_id,
5260
+ container_id: app.container_id,
5261
+ status: app.status
5262
+ } : void 0,
5263
+ ["Publish through App Engine again."]
5264
+ );
5265
+ addProofCheck(
5266
+ checks,
5267
+ "docker_deploy_container_route",
5268
+ Boolean(
5269
+ app && app.status === "running" && typeof app.container_id === "string" && typeof runtimeIp === "string" && appPort !== null
5270
+ ),
5271
+ app ? `Container=${String(app.container_id ?? "missing")}, route=${String(runtimeIp ?? "missing")}:${String(appPort ?? "missing")}.` : "Cannot verify container route without App Engine app row.",
5272
+ {
5273
+ container_id: app?.container_id ?? null,
5274
+ runtime_ip: runtimeIp ?? null,
5275
+ runtime_port: appPort
5276
+ },
5277
+ ["Run App Engine doctor.", "Check appliance container health."]
5278
+ );
5279
+ }
5280
+ let probe;
5281
+ const shouldProbe = params.probe ?? true;
5282
+ if (shouldProbe && publicUrl && typeof fetch === "function") {
5283
+ const url = probeUrl(publicUrl, params.probePath ?? params.probe_path ?? "/");
5284
+ const controller = new AbortController();
5285
+ const timeout = setTimeout(
5286
+ () => controller.abort(),
5287
+ params.timeoutMs ?? params.timeout_ms ?? 1e4
5288
+ );
5289
+ try {
5290
+ const response = await fetch(url, {
5291
+ method: "GET",
5292
+ signal: controller.signal
5293
+ });
5294
+ probe = { url, ok: response.ok, status: response.status };
5295
+ } catch (error) {
5296
+ probe = {
5297
+ url,
5298
+ ok: false,
5299
+ error: error instanceof Error ? error.message : String(error)
5300
+ };
5301
+ } finally {
5302
+ clearTimeout(timeout);
5303
+ }
5304
+ addProofCheck(
5305
+ checks,
5306
+ "public_url_probe",
5307
+ probe.ok,
5308
+ probe.ok ? `Public URL returned HTTP ${probe.status}.` : `Public URL probe failed: ${probe.error ?? `HTTP ${probe.status}`}.`,
5309
+ { ...probe },
5310
+ ["Check DNS/custom domain routing.", "Check app logs and container health."]
5311
+ );
5312
+ }
5313
+ const nextActions = checks.filter((check) => !check.ok).flatMap((check) => check.recovery ?? []).filter((action, index, all) => all.indexOf(action) === index);
5314
+ return {
5315
+ ok: checks.every((check) => check.ok),
5316
+ deployment,
5317
+ deployment_product: typeof product === "string" ? product : null,
5318
+ public_url: publicUrl,
5319
+ checks,
5320
+ ...probe ? { probe } : {},
5321
+ next_actions: nextActions
5322
+ };
5323
+ }
5179
5324
  async update(deploymentId, params) {
5180
5325
  const body4 = stripUndefined14({
5181
5326
  name: params.name,
@@ -5560,7 +5705,7 @@ function ensureBody(params) {
5560
5705
  function unwrapHost(response) {
5561
5706
  const host = response.data ?? response.host;
5562
5707
  if (!host) {
5563
- throw new Error("Docker Deploy host response was empty.");
5708
+ throw new Error("App Engine host response was empty.");
5564
5709
  }
5565
5710
  return host;
5566
5711
  }
@@ -5570,7 +5715,7 @@ function unwrapTemplates(response) {
5570
5715
  function unwrapTemplate(response) {
5571
5716
  const template = response.data ?? response.template;
5572
5717
  if (!template) {
5573
- throw new Error("Docker Deploy template response was empty.");
5718
+ throw new Error("App Engine template response was empty.");
5574
5719
  }
5575
5720
  return template;
5576
5721
  }
@@ -5580,7 +5725,7 @@ var DockerDeploy = class {
5580
5725
  }
5581
5726
  http;
5582
5727
  /**
5583
- * List Docker Deploy appliance hosts scoped to the current tenant.
5728
+ * List App Engine appliance hosts scoped to the current tenant.
5584
5729
  *
5585
5730
  * Pass a workspace ID to inspect the dedicated always-on appliance machine
5586
5731
  * for one white-label workspace.
@@ -5593,7 +5738,7 @@ var DockerDeploy = class {
5593
5738
  return res.data ?? res.hosts ?? [];
5594
5739
  }
5595
5740
  /**
5596
- * Ensure a workspace has its dedicated Docker Deploy appliance host.
5741
+ * Ensure a workspace has its dedicated App Engine appliance host.
5597
5742
  *
5598
5743
  * The host may still be `pending`, `provisioning`, or `bootstrapping` after
5599
5744
  * this call. Treat `status === "active"` and `appliance_status === "healthy"`
@@ -5606,21 +5751,21 @@ var DockerDeploy = class {
5606
5751
  );
5607
5752
  return { host: unwrapHost(res), queued: res.queued ?? false };
5608
5753
  }
5609
- /** Fetch one Docker Deploy host by ID. */
5754
+ /** Fetch one App Engine host by ID. */
5610
5755
  async getHost(hostId) {
5611
5756
  const res = await this.http.get(
5612
5757
  `/docker-deploy/hosts/${hostId}`
5613
5758
  );
5614
5759
  return unwrapHost(res);
5615
5760
  }
5616
- /** List Docker Deploy starter templates. */
5761
+ /** List App Engine starter templates. */
5617
5762
  async listTemplates() {
5618
5763
  const res = await this.http.get(
5619
5764
  "/docker-deploy/templates"
5620
5765
  );
5621
5766
  return unwrapTemplates(res);
5622
5767
  }
5623
- /** Fetch one Docker Deploy starter template by ID. */
5768
+ /** Fetch one App Engine starter template by ID. */
5624
5769
  async getTemplate(templateId) {
5625
5770
  const res = await this.http.get(
5626
5771
  `/docker-deploy/templates/${encodeURIComponent(templateId)}`
@@ -7113,11 +7258,6 @@ var Regions = class {
7113
7258
  const data = await this.http.get("/compute/regions");
7114
7259
  return listItems10(data);
7115
7260
  }
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
- }
7121
7261
  /** List available compute sizes. */
7122
7262
  async listSizes() {
7123
7263
  const data = await this.http.get("/compute/sizes");
@@ -7325,7 +7465,7 @@ function createBody(params = {}) {
7325
7465
  tags: params.tags,
7326
7466
  slug: params.slug,
7327
7467
  agent_runtime_profile_id: params.agentRuntimeProfileId ?? params.agent_runtime_profile_id ?? params.agentProfileId ?? params.agent_profile_id,
7328
- skip_agent_runtime_profile: params.skipAgentRuntimeProfile ?? params.skip_agent_runtime_profile,
7468
+ skip_agent_runtime_profile: params.skipRuntimeProfile ?? params.skip_agent_runtime_profile,
7329
7469
  external_workspace_id: params.externalWorkspaceId ?? params.external_workspace_id,
7330
7470
  external_user_id: params.externalUserId ?? params.external_user_id,
7331
7471
  external_project_id: params.externalProjectId ?? params.external_project_id
@@ -7505,15 +7645,6 @@ var SandboxEvents = class {
7505
7645
  return this.sandbox.http.stream(`/sandboxes/${this.sandbox.id}/events`);
7506
7646
  }
7507
7647
  };
7508
- var SandboxMetrics = class {
7509
- constructor(sandbox) {
7510
- this.sandbox = sandbox;
7511
- }
7512
- sandbox;
7513
- get(window2 = "1h") {
7514
- return this.sandbox.metrics(window2);
7515
- }
7516
- };
7517
7648
  var SandboxPreviews = class {
7518
7649
  constructor(sandbox) {
7519
7650
  this.sandbox = sandbox;
@@ -7654,7 +7785,6 @@ var Sandbox = class _Sandbox {
7654
7785
  this.snapshots = new SandboxSnapshots(this);
7655
7786
  this.terminal = new SandboxTerminal(this);
7656
7787
  this.events = new SandboxEvents(this);
7657
- this.metricsResource = new SandboxMetrics(this);
7658
7788
  this.previews = new SandboxPreviews(this);
7659
7789
  this.env = new SandboxEnv(this);
7660
7790
  this.tags = new SandboxTags(this);
@@ -7677,8 +7807,6 @@ var Sandbox = class _Sandbox {
7677
7807
  terminal;
7678
7808
  /** SSE event stream. */
7679
7809
  events;
7680
- /** Operational metrics and current resource state. */
7681
- metricsResource;
7682
7810
  /** Preview CRUD + share/revokeShare. */
7683
7811
  previews;
7684
7812
  /** Read-only env var listing. */
@@ -7715,16 +7843,18 @@ var Sandbox = class _Sandbox {
7715
7843
  * Run an AI coding agent inside this Sandbox.
7716
7844
  *
7717
7845
  * Defaults to Claude Code, waits for completion, and runs from `/workspace`.
7718
- * Pass `{ provider: "codex", env: { CODEX_API_KEY } }` to run Codex.
7846
+ * Pass `{ runner: "codex", env: { CODEX_API_KEY } }` to run Codex.
7719
7847
  */
7720
- async prompt(instruction, options = {}) {
7721
- return new AgentRuns(this.http).run({
7848
+ async run(instruction, options = {}) {
7849
+ const runner = options.runner ?? "claude-code";
7850
+ return new Runs(this.http).run({
7722
7851
  ...options,
7723
- prompt: instruction,
7852
+ instruction,
7724
7853
  targetKind: "sandbox",
7725
7854
  targetId: this.id,
7855
+ runtimeId: this.id,
7726
7856
  sandboxId: this.id,
7727
- provider: options.provider ?? "claude",
7857
+ runner,
7728
7858
  cwd: options.cwd ?? "/workspace",
7729
7859
  wait: options.wait ?? true
7730
7860
  });
@@ -7821,14 +7951,6 @@ var Sandbox = class _Sandbox {
7821
7951
  async expose(port) {
7822
7952
  return (await this.exposeInfo(port)).url;
7823
7953
  }
7824
- async getUrl(port, path = "/") {
7825
- const url = new URL((await this.exposeInfo(port)).url);
7826
- url.pathname = path.startsWith("/") ? path : `/${path}`;
7827
- return url.toString();
7828
- }
7829
- async getHost(port) {
7830
- return new URL((await this.exposeInfo(port)).url).host;
7831
- }
7832
7954
  async exposeInfo(port) {
7833
7955
  this.assertRunning("expose");
7834
7956
  const response = unwrap44(
@@ -7867,17 +7989,6 @@ var Sandbox = class _Sandbox {
7867
7989
  `/sandboxes/${this.id}/logs/stream`
7868
7990
  );
7869
7991
  }
7870
- async metrics(window2 = "1h") {
7871
- return unwrap44(
7872
- await this.http.get(
7873
- `/sandboxes/${this.id}/metrics`,
7874
- { window: window2 }
7875
- )
7876
- );
7877
- }
7878
- async getMetrics(window2 = "1h") {
7879
- return this.metrics(window2);
7880
- }
7881
7992
  async createSnapshot(comment) {
7882
7993
  this.assertRunning("snapshots.create");
7883
7994
  return unwrap44(
@@ -9005,39 +9116,6 @@ var Volumes = class {
9005
9116
  async delete(volumeId) {
9006
9117
  await this.http.delete(`/volumes/${volumeId}`);
9007
9118
  }
9008
- async listAttachments(computerId) {
9009
- const data = await this.http.get(`/computers/${computerId}/volumes`);
9010
- return listItems15(data, [
9011
- "data",
9012
- "attachments",
9013
- "volumes",
9014
- "items"
9015
- ]);
9016
- }
9017
- async attach(computerId, params) {
9018
- const volumeId = params.volumeId ?? params.volume_id;
9019
- const mountPath = params.mountPath ?? params.mount_path;
9020
- const readOnly = params.readOnly ?? params.read_only;
9021
- const body4 = stripUndefined30({
9022
- ...params,
9023
- volumeId: void 0,
9024
- mountPath: void 0,
9025
- readOnly: void 0,
9026
- volume_id: volumeId,
9027
- mount_path: mountPath,
9028
- read_only: readOnly
9029
- });
9030
- const data = await this.http.post(
9031
- `/computers/${computerId}/volumes`,
9032
- body4
9033
- );
9034
- return unwrap51(data);
9035
- }
9036
- async detach(computerId, attachmentId) {
9037
- await this.http.delete(
9038
- `/computers/${computerId}/volumes/${attachmentId}`
9039
- );
9040
- }
9041
9119
  };
9042
9120
  function unwrap52(payload) {
9043
9121
  if (payload && typeof payload === "object" && "data" in payload) {
@@ -9343,10 +9421,10 @@ var Miosa = class {
9343
9421
  externalKeys;
9344
9422
  /** Model Context Protocol — JSON-RPC dispatch + streaming channel. */
9345
9423
  mcp;
9346
- /** Agent Runs prompt dispatch into sandbox targets. */
9347
- agentRuns;
9348
- /** Agent Run Groups durable multi-agent orchestration groups. */
9349
- agentRunGroups;
9424
+ /** Runs - instruction dispatch into sandbox and computer targets. */
9425
+ runs;
9426
+ /** Run groups - durable multi-run orchestration groups. */
9427
+ runGroups;
9350
9428
  /** Agent runtime profiles — tenant/workspace defaults for sandbox/computer agents. */
9351
9429
  agentRuntimeProfiles;
9352
9430
  /** MIOSA Connect — provider connectors and runtime tokens. */
@@ -9366,7 +9444,7 @@ var Miosa = class {
9366
9444
  * Versions, releases, rollback, custom domains.
9367
9445
  */
9368
9446
  deployments;
9369
- /** Docker Deploy appliance hosts — one always-on workspace host, many apps. */
9447
+ /** App Engine appliance hosts — one always-on workspace host, many apps. */
9370
9448
  dockerDeploy;
9371
9449
  /** Credit balance and usage. */
9372
9450
  credits;
@@ -9462,8 +9540,8 @@ var Miosa = class {
9462
9540
  this.projectAuth = new ProjectAuth(this.http);
9463
9541
  this.externalKeys = new ExternalKeys(this.http);
9464
9542
  this.mcp = new Mcp(this.http);
9465
- this.agentRuns = new AgentRuns(this.http);
9466
- this.agentRunGroups = new AgentRunGroups(this.http);
9543
+ this.runs = new Runs(this.http);
9544
+ this.runGroups = new RunGroups(this.http);
9467
9545
  this.agentRuntimeProfiles = new AgentRuntimeProfiles(this.http);
9468
9546
  this.connectors = new Connectors(this.http);
9469
9547
  this.runtimeEnv = new RuntimeEnv(this.http);
@@ -9517,7 +9595,7 @@ var NEXTJS_RUNTIME_TEMPLATE = {
9517
9595
  start_command: "npm run dev -- --hostname 0.0.0.0 --port 3000",
9518
9596
  build_command: "npm run build"
9519
9597
  };
9520
- function artifactBundle(kind) {
9598
+ function fileBundle(kind) {
9521
9599
  return {
9522
9600
  kind,
9523
9601
  workspace_root: "/workspace",
@@ -9581,15 +9659,15 @@ var BUILD_KIND_ALIASES = {
9581
9659
  webinar: "webinar",
9582
9660
  website: "website"
9583
9661
  };
9584
- function spec(kind, label, artifactType, runtimeTemplate, artifacts, options = {}) {
9662
+ function spec(kind, label, deliverableType, runtimeTemplate, files, options = {}) {
9585
9663
  const resolved = {
9586
9664
  kind,
9587
9665
  label,
9588
- artifactType,
9666
+ deliverableType,
9589
9667
  runtimeTemplate,
9590
9668
  requestedOutputs: options.requestedOutputs ?? ["requested deliverables", "manifest"],
9591
9669
  plannerDocumentKinds: options.plannerDocumentKinds ?? COMMON_PLANNER_DOCUMENT_KINDS,
9592
- artifacts,
9670
+ files,
9593
9671
  designResearchRequired: options.designResearchRequired ?? false
9594
9672
  };
9595
9673
  if (options.previewPort !== void 0) resolved.previewPort = options.previewPort;
@@ -9619,50 +9697,50 @@ var AGENT_BUILD_KIND_SPECS = {
9619
9697
  { kind: "html", path: "webinar-page.html", mime_type: "text/html", name: "Webinar page", previewable: true },
9620
9698
  { kind: "markdown", path: "webinar-script.md", mime_type: "text/markdown", name: "Webinar script" }
9621
9699
  ], { requestedOutputs: ["webinar registration page", "script", "slides"], designResearchRequired: true, previewPort: 3e3 }),
9622
- slides_deck: spec("slides_deck", "Slides deck", "slides_deck", artifactBundle("html_deck"), [
9700
+ slides_deck: spec("slides_deck", "Slides deck", "slides_deck", fileBundle("html_deck"), [
9623
9701
  { kind: "html", path: "deck.html", mime_type: "text/html", name: "Slide deck", previewable: true }
9624
9702
  ], { designResearchRequired: true }),
9625
- email_sequence: spec("email_sequence", "Email sequence", "email_sms_sequence", artifactBundle("email_bundle"), [
9703
+ email_sequence: spec("email_sequence", "Email sequence", "email_sms_sequence", fileBundle("email_bundle"), [
9626
9704
  { kind: "markdown", path: "email-sequence.md", mime_type: "text/markdown", name: "Email sequence", previewable: true }
9627
9705
  ]),
9628
- social_content: spec("social_content", "Social content", "social_media_post", artifactBundle("html_image_bundle"), [
9706
+ social_content: spec("social_content", "Social content", "social_media_post", fileBundle("html_image_bundle"), [
9629
9707
  { kind: "html", path: "social-carousel.html", mime_type: "text/html", name: "Social carousel", previewable: true },
9630
9708
  { kind: "markdown", path: "captions.md", mime_type: "text/markdown", name: "Caption bank" }
9631
9709
  ], { designResearchRequired: true }),
9632
- ad_creative: spec("ad_creative", "Ad creative", "ad_creative", artifactBundle("html_image_bundle"), [
9710
+ ad_creative: spec("ad_creative", "Ad creative", "ad_creative", fileBundle("html_image_bundle"), [
9633
9711
  { kind: "html", path: "ad-creative.html", mime_type: "text/html", name: "Ad creative previews", previewable: true }
9634
9712
  ], { designResearchRequired: true }),
9635
9713
  booking_page: spec("booking_page", "Booking page", "booking_page", NEXTJS_RUNTIME_TEMPLATE, [
9636
9714
  { kind: "html", path: "booking-page.html", mime_type: "text/html", name: "Booking page", previewable: true }
9637
9715
  ], { requestedOutputs: ["booking page", "confirmation copy", "source files"], designResearchRequired: true, previewPort: 3e3 }),
9638
- brand_identity: spec("brand_identity", "Brand identity", "brand_identity", artifactBundle("brand_bundle"), [
9716
+ brand_identity: spec("brand_identity", "Brand identity", "brand_identity", fileBundle("brand_bundle"), [
9639
9717
  { kind: "markdown", path: "brand-guide.md", mime_type: "text/markdown", name: "Brand guide", previewable: true }
9640
9718
  ], { designResearchRequired: true }),
9641
- offer: spec("offer", "Offer", "offer", artifactBundle("offer_bundle"), [
9719
+ offer: spec("offer", "Offer", "offer", fileBundle("offer_bundle"), [
9642
9720
  { kind: "markdown", path: "offer-stack.md", mime_type: "text/markdown", name: "Offer stack", previewable: true }
9643
9721
  ]),
9644
- program: spec("program", "Program", "program_lms", artifactBundle("program_lms"), [
9722
+ program: spec("program", "Program", "program_lms", fileBundle("program_lms"), [
9645
9723
  { kind: "html", path: "program.html", mime_type: "text/html", name: "Program preview", previewable: true },
9646
9724
  { kind: "markdown", path: "program.md", mime_type: "text/markdown", name: "Program outline" }
9647
9725
  ], { designResearchRequired: true }),
9648
- podcast: spec("podcast", "Podcast", "podcast_audio", artifactBundle("podcast_audio"), [
9726
+ podcast: spec("podcast", "Podcast", "podcast_audio", fileBundle("podcast_audio"), [
9649
9727
  { kind: "html", path: "podcast.html", mime_type: "text/html", name: "Podcast preview", previewable: true },
9650
9728
  { kind: "markdown", path: "show-notes.md", mime_type: "text/markdown", name: "Show notes" }
9651
9729
  ]),
9652
- sales_script: spec("sales_script", "Sales script", "sales_script", artifactBundle("script_bundle"), [
9730
+ sales_script: spec("sales_script", "Sales script", "sales_script", fileBundle("script_bundle"), [
9653
9731
  { kind: "markdown", path: "sales-script.md", mime_type: "text/markdown", name: "Sales script", previewable: true }
9654
9732
  ]),
9655
- campaign: spec("campaign", "Campaign", "campaign", artifactBundle("campaign_bundle"), [
9733
+ campaign: spec("campaign", "Campaign", "campaign", fileBundle("campaign_bundle"), [
9656
9734
  { kind: "markdown", path: "campaign-plan.md", mime_type: "text/markdown", name: "Campaign plan", previewable: true },
9657
9735
  { kind: "html", path: "campaign-assets.html", mime_type: "text/html", name: "Campaign assets", previewable: true }
9658
9736
  ], { designResearchRequired: true }),
9659
- challenge: spec("challenge", "Challenge", "challenge", artifactBundle("challenge_bundle"), [
9737
+ challenge: spec("challenge", "Challenge", "challenge", fileBundle("challenge_bundle"), [
9660
9738
  { kind: "markdown", path: "challenge-plan.md", mime_type: "text/markdown", name: "Challenge plan", previewable: true }
9661
9739
  ]),
9662
- character: spec("character", "Character pack", "brand_character", artifactBundle("character_bundle"), [
9740
+ character: spec("character", "Character pack", "brand_character", fileBundle("character_bundle"), [
9663
9741
  { kind: "markdown", path: "character-pack.md", mime_type: "text/markdown", name: "Character pack", previewable: true }
9664
9742
  ], { designResearchRequired: true }),
9665
- custom: spec("custom", "Custom build", "artifact", artifactBundle("artifact_bundle"), [])
9743
+ custom: spec("custom", "Custom build", "file", fileBundle("file_bundle"), [])
9666
9744
  };
9667
9745
  function normalizeBuildKind(value) {
9668
9746
  return (value ?? "").trim().toLowerCase().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
@@ -9675,14 +9753,14 @@ function resolveAgentBuildKind(value, fallback = "custom") {
9675
9753
  function getAgentBuildKindSpec(value) {
9676
9754
  return AGENT_BUILD_KIND_SPECS[resolveAgentBuildKind(value)];
9677
9755
  }
9678
- function normalizeArtifactPath(path, outputRoot) {
9756
+ function normalizeFilePath(path, outputRoot) {
9679
9757
  return path.startsWith("/") ? path : `${outputRoot}/${path}`;
9680
9758
  }
9681
- function createAgentBuildOutputContract(buildKind, options = {}) {
9682
- if (options.outputContract) return options.outputContract;
9759
+ function createAgentBuildExpectedOutputs(buildKind, options = {}) {
9760
+ if (options.expectedOutputs) return options.expectedOutputs;
9683
9761
  const spec2 = getAgentBuildKindSpec(buildKind);
9684
9762
  const outputRoot = options.outputRoot ?? DEFAULT_AGENT_BUILD_OUTPUT_ROOT;
9685
- const artifacts = [
9763
+ const files = [
9686
9764
  {
9687
9765
  path: `${outputRoot}/manifest.json`,
9688
9766
  kind: "json",
@@ -9690,10 +9768,10 @@ function createAgentBuildOutputContract(buildKind, options = {}) {
9690
9768
  name: "Manifest",
9691
9769
  downloadable: true
9692
9770
  },
9693
- ...(options.artifacts ?? spec2.artifacts).map((artifact) => ({
9694
- ...artifact,
9695
- path: normalizeArtifactPath(artifact.path, outputRoot),
9696
- downloadable: artifact.downloadable ?? true
9771
+ ...(options.files ?? spec2.files).map((file) => ({
9772
+ ...file,
9773
+ path: normalizeFilePath(file.path, outputRoot),
9774
+ downloadable: file.downloadable ?? true
9697
9775
  }))
9698
9776
  ];
9699
9777
  const contract = withoutUndefined({
@@ -9701,11 +9779,16 @@ function createAgentBuildOutputContract(buildKind, options = {}) {
9701
9779
  manifest: `${outputRoot}/manifest.json`,
9702
9780
  planner_documents_under: "/workspace/planner",
9703
9781
  inputs_under: DEFAULT_AGENT_BUILD_INPUT_ROOT,
9704
- artifact_type: options.artifactType ?? spec2.artifactType,
9782
+ deliverable_type: options.deliverableType ?? spec2.deliverableType,
9705
9783
  required_files: [`${outputRoot}/manifest.json`],
9706
- artifacts,
9784
+ files,
9785
+ expected_outputs: {
9786
+ messages: true,
9787
+ files,
9788
+ previews: spec2.previewPort !== void 0
9789
+ },
9707
9790
  preview_port: spec2.previewPort,
9708
- include_downloadable_artifacts: true
9791
+ include_downloads: true
9709
9792
  });
9710
9793
  return contract;
9711
9794
  }
@@ -9723,21 +9806,21 @@ function withoutUndefined(input) {
9723
9806
  function createAgentBuildExecutionPacket(params) {
9724
9807
  const buildKind = resolveAgentBuildKind(params.buildKind ?? params.runType);
9725
9808
  const spec2 = AGENT_BUILD_KIND_SPECS[buildKind];
9726
- const artifactType = params.artifactType ?? spec2.artifactType;
9809
+ const deliverableType = params.deliverableType ?? spec2.deliverableType;
9727
9810
  const runtimeTemplate = params.runtimeTemplate ?? spec2.runtimeTemplate;
9728
- const outputOptions = { artifactType };
9729
- if (params.artifacts !== void 0) outputOptions.artifacts = params.artifacts;
9730
- if (params.outputContract !== void 0) {
9731
- outputOptions.outputContract = params.outputContract;
9811
+ const outputOptions = { deliverableType };
9812
+ if (params.files !== void 0) outputOptions.files = params.files;
9813
+ if (params.expectedOutputs !== void 0) {
9814
+ outputOptions.expectedOutputs = params.expectedOutputs;
9732
9815
  }
9733
9816
  if (params.outputRoot !== void 0) outputOptions.outputRoot = params.outputRoot;
9734
- const outputContract = createAgentBuildOutputContract(buildKind, outputOptions);
9817
+ const expectedOutputs = createAgentBuildExpectedOutputs(buildKind, outputOptions);
9735
9818
  const inputRefs = params.inputRefs ?? [];
9736
9819
  const packet = {
9737
9820
  version: DEFAULT_AGENT_BUILD_PACKET_VERSION,
9738
9821
  run_type: buildKind,
9739
9822
  build_kind: buildKind,
9740
- artifact_type: artifactType,
9823
+ deliverable_type: deliverableType,
9741
9824
  title: params.title,
9742
9825
  goal: params.goal,
9743
9826
  source_refs: params.sourceRefs ?? [],
@@ -9746,7 +9829,7 @@ function createAgentBuildExecutionPacket(params) {
9746
9829
  planner_documents: normalizePlannerDocuments(params.plannerDocuments),
9747
9830
  requested_outputs: params.requestedOutputs ?? spec2.requestedOutputs,
9748
9831
  quality_rules: params.qualityRules ?? [],
9749
- output_contract: outputContract,
9832
+ expected_outputs: expectedOutputs,
9750
9833
  runtime_instructions: {
9751
9834
  agent: "claude",
9752
9835
  template: runtimeTemplate,
@@ -9762,10 +9845,10 @@ function createAgentBuildExecutionPacket(params) {
9762
9845
  metadata: {
9763
9846
  ...params.metadata ?? {},
9764
9847
  build_kind: buildKind,
9765
- artifact_type: artifactType,
9848
+ deliverable_type: deliverableType,
9766
9849
  build_target: runtimeTemplate,
9767
9850
  runtime_template: runtimeTemplate,
9768
- output_contract: outputContract,
9851
+ expected_outputs: expectedOutputs,
9769
9852
  input_refs: inputRefs,
9770
9853
  design_research_required: spec2.designResearchRequired,
9771
9854
  planner_document_kinds: spec2.plannerDocumentKinds
@@ -9782,23 +9865,24 @@ function createAgentBuildPrompt(packet) {
9782
9865
  "",
9783
9866
  `Materialize input_refs under ${DEFAULT_AGENT_BUILD_INPUT_ROOT}.`,
9784
9867
  "Use the execution packet, input bundle, planner documents, brand/context notes, and quality rules.",
9785
- `Write every deliverable under ${packet.output_contract.write_files_under}.`,
9786
- `Write a JSON manifest to ${packet.output_contract.manifest}.`,
9868
+ `Write every deliverable under ${packet.expected_outputs.write_files_under}.`,
9869
+ `Write a JSON manifest to ${packet.expected_outputs.manifest}.`,
9787
9870
  "Do not expose secrets. Do not publish externally unless the approval policy allows it."
9788
9871
  ].join("\n");
9789
9872
  }
9790
- function createBuildAgentRunParams(params) {
9873
+ function createBuildRunParams(params) {
9791
9874
  const runtimeProfileId = params.agentRuntimeProfileId ?? params.runtimeProfileId;
9792
9875
  const packetParams = { ...params };
9793
9876
  if (runtimeProfileId !== void 0) packetParams.runtimeProfileId = runtimeProfileId;
9794
9877
  const packet = createAgentBuildExecutionPacket(packetParams);
9795
9878
  return withoutUndefined({
9796
- prompt: params.prompt ?? createAgentBuildPrompt(packet),
9879
+ instruction: params.instruction ?? createAgentBuildPrompt(packet),
9797
9880
  targetKind: params.targetKind ?? (params.computerId ? "computer" : "sandbox"),
9798
9881
  targetId: params.targetId,
9799
9882
  sandboxId: params.sandboxId,
9800
9883
  computerId: params.computerId,
9801
- provider: params.provider ?? "claude",
9884
+ runner: params.runner ?? "claude-code",
9885
+ provider: params.provider,
9802
9886
  model: params.model,
9803
9887
  cwd: params.cwd ?? "/workspace",
9804
9888
  timeout: params.timeout ?? 1800,
@@ -9809,7 +9893,7 @@ function createBuildAgentRunParams(params) {
9809
9893
  externalUserId: params.externalUserId,
9810
9894
  externalProjectId: params.externalProjectId,
9811
9895
  executionPacket: packet,
9812
- outputContract: packet.output_contract,
9896
+ expectedOutputs: packet.expected_outputs,
9813
9897
  approvalPolicy: params.approvalPolicy ?? {
9814
9898
  publish: "manual",
9815
9899
  external_write: "manual",
@@ -9818,12 +9902,13 @@ function createBuildAgentRunParams(params) {
9818
9902
  capabilityRequirements: params.capabilityRequirements ?? [
9819
9903
  "filesystem",
9820
9904
  "shell",
9821
- "artifact_downloads"
9905
+ "files",
9906
+ "downloads"
9822
9907
  ],
9823
9908
  metadata: {
9824
9909
  ...params.metadata ?? {},
9825
9910
  build_kind: packet.build_kind,
9826
- artifact_type: packet.artifact_type
9911
+ deliverable_type: packet.deliverable_type
9827
9912
  }
9828
9913
  });
9829
9914
  }
@@ -9984,6 +10069,6 @@ var AppAuth = class {
9984
10069
  }
9985
10070
  };
9986
10071
 
9987
- 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 };
10072
+ export { AGENT_BUILD_KIND_SPECS, Admin, 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, RunGroups, Runs, RuntimeCapabilitiesResource, RuntimeEnv, SANDBOX_TEMPLATE, Sandbox, 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, createAgentBuildExpectedOutputs, createAgentBuildPrompt, createBuildRunParams, getAgentBuildKindSpec, resolveAgentBuildKind, verifySignature };
9988
10073
  //# sourceMappingURL=index.js.map
9989
10074
  //# sourceMappingURL=index.js.map