@miosa/sdk 1.2.27 → 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/README.md +5 -5
- package/dist/index.d.ts +251 -219
- package/dist/index.js +345 -262
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -673,17 +673,17 @@ var Admin = class {
|
|
|
673
673
|
}
|
|
674
674
|
};
|
|
675
675
|
|
|
676
|
-
// src/resources/
|
|
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
|
|
683
|
+
function fileRows(raw) {
|
|
684
684
|
const data = unwrap(raw);
|
|
685
685
|
if (Array.isArray(data)) return data;
|
|
686
|
-
return data.
|
|
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
|
-
|
|
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
|
-
|
|
722
|
+
parent_run_id: entry.parentRunId,
|
|
721
723
|
orchestration_role: entry.orchestrationRole,
|
|
722
|
-
skip_agent_runtime_profile: entry.
|
|
724
|
+
skip_agent_runtime_profile: entry.skipRuntimeProfile,
|
|
723
725
|
execution_packet: entry.executionPacket,
|
|
724
|
-
|
|
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
|
|
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
|
-
"/
|
|
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("/
|
|
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(`/
|
|
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
|
-
`/
|
|
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
|
-
`/
|
|
782
|
+
`/run-groups/${encodeURIComponent(id)}/cancel`,
|
|
781
783
|
{}
|
|
782
784
|
)
|
|
783
785
|
);
|
|
784
786
|
}
|
|
785
|
-
async
|
|
787
|
+
async activity(id) {
|
|
786
788
|
const data = unwrap(
|
|
787
789
|
await this.http.get(
|
|
788
|
-
`/
|
|
790
|
+
`/run-groups/${encodeURIComponent(id)}/activity`
|
|
789
791
|
)
|
|
790
792
|
);
|
|
791
793
|
if (Array.isArray(data)) return data;
|
|
792
|
-
return data.
|
|
794
|
+
return data.activity ?? data.items ?? [];
|
|
793
795
|
}
|
|
794
|
-
|
|
796
|
+
streamActivity(id) {
|
|
795
797
|
return this.http.stream(
|
|
796
|
-
`/
|
|
798
|
+
`/run-groups/${encodeURIComponent(id)}/activity`
|
|
797
799
|
);
|
|
798
800
|
}
|
|
799
|
-
async
|
|
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
|
|
806
|
+
const files = fileRows(
|
|
805
807
|
await this.http.get(
|
|
806
|
-
`/
|
|
808
|
+
`/runs/${encodeURIComponent(run.id)}/files`
|
|
807
809
|
)
|
|
808
810
|
);
|
|
809
|
-
return
|
|
810
|
-
...
|
|
811
|
-
|
|
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
|
|
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/
|
|
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
|
|
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
|
-
"/
|
|
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
|
-
|
|
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(`/
|
|
987
|
+
await this.http.get(`/runs/${encodeURIComponent(id)}`)
|
|
985
988
|
);
|
|
986
989
|
}
|
|
987
|
-
async
|
|
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.
|
|
1000
|
+
return data.files ?? data.items ?? [];
|
|
995
1001
|
}
|
|
996
|
-
async
|
|
1002
|
+
async downloadFile(id, fileId, options = {}) {
|
|
997
1003
|
const query3 = options.inline ? "?disposition=inline" : "";
|
|
998
1004
|
return this.http.getBinary(
|
|
999
|
-
`/
|
|
1000
|
-
|
|
1005
|
+
`/runs/${encodeURIComponent(id)}/files/${encodeURIComponent(
|
|
1006
|
+
fileId
|
|
1001
1007
|
)}/download${query3}`
|
|
1002
1008
|
);
|
|
1003
1009
|
}
|
|
1004
|
-
async
|
|
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(`/
|
|
1031
|
+
await this.http.get(`/runs/${encodeURIComponent(id)}/previews`)
|
|
1007
1032
|
);
|
|
1008
1033
|
if (Array.isArray(data)) return data;
|
|
1009
|
-
return data.
|
|
1034
|
+
return data.previews ?? data.items ?? [];
|
|
1010
1035
|
}
|
|
1011
|
-
|
|
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
|
-
`/
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
1058
|
-
|
|
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.
|
|
1090
|
+
skip_agent_runtime_profile: params.skipRuntimeProfile,
|
|
1064
1091
|
execution_packet: params.executionPacket,
|
|
1065
|
-
|
|
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("/
|
|
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
|
-
`/
|
|
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
|
|
4138
|
+
* same Runs API as `miosa agent run --computer`, scoped to this VM.
|
|
4136
4139
|
*/
|
|
4137
|
-
async
|
|
4138
|
-
|
|
4140
|
+
async run(instruction, options = {}) {
|
|
4141
|
+
const runner = options.runner ?? "claude-code";
|
|
4142
|
+
return new Runs(this.http).run({
|
|
4139
4143
|
...options,
|
|
4140
|
-
|
|
4144
|
+
instruction,
|
|
4141
4145
|
targetKind: "computer",
|
|
4142
4146
|
targetId: this.id,
|
|
4147
|
+
runtimeId: this.id,
|
|
4143
4148
|
computerId: this.id,
|
|
4144
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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) ? "
|
|
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 ? "
|
|
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
|
|
5118
|
-
const
|
|
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
|
|
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("
|
|
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("
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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");
|
|
@@ -7311,7 +7451,6 @@ function createBody(params = {}) {
|
|
|
7311
7451
|
timeout_sec: params.timeoutSec ?? params.timeout_sec ?? (persistent === true ? 86400 : void 0),
|
|
7312
7452
|
idle_timeout_sec: params.idleTimeoutSec ?? params.idle_timeout_sec ?? (persistent === true ? 1800 : void 0),
|
|
7313
7453
|
always_on: params.alwaysOn ?? params.always_on,
|
|
7314
|
-
allow_provision: params.allowProvision ?? params.allow_provision,
|
|
7315
7454
|
env: params.env,
|
|
7316
7455
|
metadata: Object.keys(metadata).length > 0 ? metadata : void 0,
|
|
7317
7456
|
services: params.services,
|
|
@@ -7326,7 +7465,7 @@ function createBody(params = {}) {
|
|
|
7326
7465
|
tags: params.tags,
|
|
7327
7466
|
slug: params.slug,
|
|
7328
7467
|
agent_runtime_profile_id: params.agentRuntimeProfileId ?? params.agent_runtime_profile_id ?? params.agentProfileId ?? params.agent_profile_id,
|
|
7329
|
-
skip_agent_runtime_profile: params.
|
|
7468
|
+
skip_agent_runtime_profile: params.skipRuntimeProfile ?? params.skip_agent_runtime_profile,
|
|
7330
7469
|
external_workspace_id: params.externalWorkspaceId ?? params.external_workspace_id,
|
|
7331
7470
|
external_user_id: params.externalUserId ?? params.external_user_id,
|
|
7332
7471
|
external_project_id: params.externalProjectId ?? params.external_project_id
|
|
@@ -7506,15 +7645,6 @@ var SandboxEvents = class {
|
|
|
7506
7645
|
return this.sandbox.http.stream(`/sandboxes/${this.sandbox.id}/events`);
|
|
7507
7646
|
}
|
|
7508
7647
|
};
|
|
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
|
-
};
|
|
7518
7648
|
var SandboxPreviews = class {
|
|
7519
7649
|
constructor(sandbox) {
|
|
7520
7650
|
this.sandbox = sandbox;
|
|
@@ -7655,7 +7785,6 @@ var Sandbox = class _Sandbox {
|
|
|
7655
7785
|
this.snapshots = new SandboxSnapshots(this);
|
|
7656
7786
|
this.terminal = new SandboxTerminal(this);
|
|
7657
7787
|
this.events = new SandboxEvents(this);
|
|
7658
|
-
this.metricsResource = new SandboxMetrics(this);
|
|
7659
7788
|
this.previews = new SandboxPreviews(this);
|
|
7660
7789
|
this.env = new SandboxEnv(this);
|
|
7661
7790
|
this.tags = new SandboxTags(this);
|
|
@@ -7678,8 +7807,6 @@ var Sandbox = class _Sandbox {
|
|
|
7678
7807
|
terminal;
|
|
7679
7808
|
/** SSE event stream. */
|
|
7680
7809
|
events;
|
|
7681
|
-
/** Operational metrics and current resource state. */
|
|
7682
|
-
metricsResource;
|
|
7683
7810
|
/** Preview CRUD + share/revokeShare. */
|
|
7684
7811
|
previews;
|
|
7685
7812
|
/** Read-only env var listing. */
|
|
@@ -7716,16 +7843,18 @@ var Sandbox = class _Sandbox {
|
|
|
7716
7843
|
* Run an AI coding agent inside this Sandbox.
|
|
7717
7844
|
*
|
|
7718
7845
|
* Defaults to Claude Code, waits for completion, and runs from `/workspace`.
|
|
7719
|
-
* Pass `{
|
|
7846
|
+
* Pass `{ runner: "codex", env: { CODEX_API_KEY } }` to run Codex.
|
|
7720
7847
|
*/
|
|
7721
|
-
async
|
|
7722
|
-
|
|
7848
|
+
async run(instruction, options = {}) {
|
|
7849
|
+
const runner = options.runner ?? "claude-code";
|
|
7850
|
+
return new Runs(this.http).run({
|
|
7723
7851
|
...options,
|
|
7724
|
-
|
|
7852
|
+
instruction,
|
|
7725
7853
|
targetKind: "sandbox",
|
|
7726
7854
|
targetId: this.id,
|
|
7855
|
+
runtimeId: this.id,
|
|
7727
7856
|
sandboxId: this.id,
|
|
7728
|
-
|
|
7857
|
+
runner,
|
|
7729
7858
|
cwd: options.cwd ?? "/workspace",
|
|
7730
7859
|
wait: options.wait ?? true
|
|
7731
7860
|
});
|
|
@@ -7822,14 +7951,6 @@ var Sandbox = class _Sandbox {
|
|
|
7822
7951
|
async expose(port) {
|
|
7823
7952
|
return (await this.exposeInfo(port)).url;
|
|
7824
7953
|
}
|
|
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
|
-
}
|
|
7833
7954
|
async exposeInfo(port) {
|
|
7834
7955
|
this.assertRunning("expose");
|
|
7835
7956
|
const response = unwrap44(
|
|
@@ -7868,17 +7989,6 @@ var Sandbox = class _Sandbox {
|
|
|
7868
7989
|
`/sandboxes/${this.id}/logs/stream`
|
|
7869
7990
|
);
|
|
7870
7991
|
}
|
|
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
|
-
}
|
|
7882
7992
|
async createSnapshot(comment) {
|
|
7883
7993
|
this.assertRunning("snapshots.create");
|
|
7884
7994
|
return unwrap44(
|
|
@@ -7930,8 +8040,7 @@ var Sandbox = class _Sandbox {
|
|
|
7930
8040
|
async update(params) {
|
|
7931
8041
|
const snapshotExpirationSec = snapshotExpirationSeconds(params);
|
|
7932
8042
|
const metadata = { ...params.metadata ?? {} };
|
|
7933
|
-
if (params.persistent !== void 0)
|
|
7934
|
-
metadata.miosa_persistent = params.persistent;
|
|
8043
|
+
if (params.persistent !== void 0) metadata.miosa_persistent = params.persistent;
|
|
7935
8044
|
if (snapshotExpirationSec !== void 0) {
|
|
7936
8045
|
metadata.snapshot_expiration_sec = snapshotExpirationSec;
|
|
7937
8046
|
}
|
|
@@ -9007,39 +9116,6 @@ var Volumes = class {
|
|
|
9007
9116
|
async delete(volumeId) {
|
|
9008
9117
|
await this.http.delete(`/volumes/${volumeId}`);
|
|
9009
9118
|
}
|
|
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
|
-
}
|
|
9043
9119
|
};
|
|
9044
9120
|
function unwrap52(payload) {
|
|
9045
9121
|
if (payload && typeof payload === "object" && "data" in payload) {
|
|
@@ -9345,10 +9421,10 @@ var Miosa = class {
|
|
|
9345
9421
|
externalKeys;
|
|
9346
9422
|
/** Model Context Protocol — JSON-RPC dispatch + streaming channel. */
|
|
9347
9423
|
mcp;
|
|
9348
|
-
/**
|
|
9349
|
-
|
|
9350
|
-
/**
|
|
9351
|
-
|
|
9424
|
+
/** Runs - instruction dispatch into sandbox and computer targets. */
|
|
9425
|
+
runs;
|
|
9426
|
+
/** Run groups - durable multi-run orchestration groups. */
|
|
9427
|
+
runGroups;
|
|
9352
9428
|
/** Agent runtime profiles — tenant/workspace defaults for sandbox/computer agents. */
|
|
9353
9429
|
agentRuntimeProfiles;
|
|
9354
9430
|
/** MIOSA Connect — provider connectors and runtime tokens. */
|
|
@@ -9368,7 +9444,7 @@ var Miosa = class {
|
|
|
9368
9444
|
* Versions, releases, rollback, custom domains.
|
|
9369
9445
|
*/
|
|
9370
9446
|
deployments;
|
|
9371
|
-
/**
|
|
9447
|
+
/** App Engine appliance hosts — one always-on workspace host, many apps. */
|
|
9372
9448
|
dockerDeploy;
|
|
9373
9449
|
/** Credit balance and usage. */
|
|
9374
9450
|
credits;
|
|
@@ -9464,8 +9540,8 @@ var Miosa = class {
|
|
|
9464
9540
|
this.projectAuth = new ProjectAuth(this.http);
|
|
9465
9541
|
this.externalKeys = new ExternalKeys(this.http);
|
|
9466
9542
|
this.mcp = new Mcp(this.http);
|
|
9467
|
-
this.
|
|
9468
|
-
this.
|
|
9543
|
+
this.runs = new Runs(this.http);
|
|
9544
|
+
this.runGroups = new RunGroups(this.http);
|
|
9469
9545
|
this.agentRuntimeProfiles = new AgentRuntimeProfiles(this.http);
|
|
9470
9546
|
this.connectors = new Connectors(this.http);
|
|
9471
9547
|
this.runtimeEnv = new RuntimeEnv(this.http);
|
|
@@ -9519,7 +9595,7 @@ var NEXTJS_RUNTIME_TEMPLATE = {
|
|
|
9519
9595
|
start_command: "npm run dev -- --hostname 0.0.0.0 --port 3000",
|
|
9520
9596
|
build_command: "npm run build"
|
|
9521
9597
|
};
|
|
9522
|
-
function
|
|
9598
|
+
function fileBundle(kind) {
|
|
9523
9599
|
return {
|
|
9524
9600
|
kind,
|
|
9525
9601
|
workspace_root: "/workspace",
|
|
@@ -9583,15 +9659,15 @@ var BUILD_KIND_ALIASES = {
|
|
|
9583
9659
|
webinar: "webinar",
|
|
9584
9660
|
website: "website"
|
|
9585
9661
|
};
|
|
9586
|
-
function spec(kind, label,
|
|
9662
|
+
function spec(kind, label, deliverableType, runtimeTemplate, files, options = {}) {
|
|
9587
9663
|
const resolved = {
|
|
9588
9664
|
kind,
|
|
9589
9665
|
label,
|
|
9590
|
-
|
|
9666
|
+
deliverableType,
|
|
9591
9667
|
runtimeTemplate,
|
|
9592
9668
|
requestedOutputs: options.requestedOutputs ?? ["requested deliverables", "manifest"],
|
|
9593
9669
|
plannerDocumentKinds: options.plannerDocumentKinds ?? COMMON_PLANNER_DOCUMENT_KINDS,
|
|
9594
|
-
|
|
9670
|
+
files,
|
|
9595
9671
|
designResearchRequired: options.designResearchRequired ?? false
|
|
9596
9672
|
};
|
|
9597
9673
|
if (options.previewPort !== void 0) resolved.previewPort = options.previewPort;
|
|
@@ -9621,50 +9697,50 @@ var AGENT_BUILD_KIND_SPECS = {
|
|
|
9621
9697
|
{ kind: "html", path: "webinar-page.html", mime_type: "text/html", name: "Webinar page", previewable: true },
|
|
9622
9698
|
{ kind: "markdown", path: "webinar-script.md", mime_type: "text/markdown", name: "Webinar script" }
|
|
9623
9699
|
], { requestedOutputs: ["webinar registration page", "script", "slides"], designResearchRequired: true, previewPort: 3e3 }),
|
|
9624
|
-
slides_deck: spec("slides_deck", "Slides deck", "slides_deck",
|
|
9700
|
+
slides_deck: spec("slides_deck", "Slides deck", "slides_deck", fileBundle("html_deck"), [
|
|
9625
9701
|
{ kind: "html", path: "deck.html", mime_type: "text/html", name: "Slide deck", previewable: true }
|
|
9626
9702
|
], { designResearchRequired: true }),
|
|
9627
|
-
email_sequence: spec("email_sequence", "Email sequence", "email_sms_sequence",
|
|
9703
|
+
email_sequence: spec("email_sequence", "Email sequence", "email_sms_sequence", fileBundle("email_bundle"), [
|
|
9628
9704
|
{ kind: "markdown", path: "email-sequence.md", mime_type: "text/markdown", name: "Email sequence", previewable: true }
|
|
9629
9705
|
]),
|
|
9630
|
-
social_content: spec("social_content", "Social content", "social_media_post",
|
|
9706
|
+
social_content: spec("social_content", "Social content", "social_media_post", fileBundle("html_image_bundle"), [
|
|
9631
9707
|
{ kind: "html", path: "social-carousel.html", mime_type: "text/html", name: "Social carousel", previewable: true },
|
|
9632
9708
|
{ kind: "markdown", path: "captions.md", mime_type: "text/markdown", name: "Caption bank" }
|
|
9633
9709
|
], { designResearchRequired: true }),
|
|
9634
|
-
ad_creative: spec("ad_creative", "Ad creative", "ad_creative",
|
|
9710
|
+
ad_creative: spec("ad_creative", "Ad creative", "ad_creative", fileBundle("html_image_bundle"), [
|
|
9635
9711
|
{ kind: "html", path: "ad-creative.html", mime_type: "text/html", name: "Ad creative previews", previewable: true }
|
|
9636
9712
|
], { designResearchRequired: true }),
|
|
9637
9713
|
booking_page: spec("booking_page", "Booking page", "booking_page", NEXTJS_RUNTIME_TEMPLATE, [
|
|
9638
9714
|
{ kind: "html", path: "booking-page.html", mime_type: "text/html", name: "Booking page", previewable: true }
|
|
9639
9715
|
], { requestedOutputs: ["booking page", "confirmation copy", "source files"], designResearchRequired: true, previewPort: 3e3 }),
|
|
9640
|
-
brand_identity: spec("brand_identity", "Brand identity", "brand_identity",
|
|
9716
|
+
brand_identity: spec("brand_identity", "Brand identity", "brand_identity", fileBundle("brand_bundle"), [
|
|
9641
9717
|
{ kind: "markdown", path: "brand-guide.md", mime_type: "text/markdown", name: "Brand guide", previewable: true }
|
|
9642
9718
|
], { designResearchRequired: true }),
|
|
9643
|
-
offer: spec("offer", "Offer", "offer",
|
|
9719
|
+
offer: spec("offer", "Offer", "offer", fileBundle("offer_bundle"), [
|
|
9644
9720
|
{ kind: "markdown", path: "offer-stack.md", mime_type: "text/markdown", name: "Offer stack", previewable: true }
|
|
9645
9721
|
]),
|
|
9646
|
-
program: spec("program", "Program", "program_lms",
|
|
9722
|
+
program: spec("program", "Program", "program_lms", fileBundle("program_lms"), [
|
|
9647
9723
|
{ kind: "html", path: "program.html", mime_type: "text/html", name: "Program preview", previewable: true },
|
|
9648
9724
|
{ kind: "markdown", path: "program.md", mime_type: "text/markdown", name: "Program outline" }
|
|
9649
9725
|
], { designResearchRequired: true }),
|
|
9650
|
-
podcast: spec("podcast", "Podcast", "podcast_audio",
|
|
9726
|
+
podcast: spec("podcast", "Podcast", "podcast_audio", fileBundle("podcast_audio"), [
|
|
9651
9727
|
{ kind: "html", path: "podcast.html", mime_type: "text/html", name: "Podcast preview", previewable: true },
|
|
9652
9728
|
{ kind: "markdown", path: "show-notes.md", mime_type: "text/markdown", name: "Show notes" }
|
|
9653
9729
|
]),
|
|
9654
|
-
sales_script: spec("sales_script", "Sales script", "sales_script",
|
|
9730
|
+
sales_script: spec("sales_script", "Sales script", "sales_script", fileBundle("script_bundle"), [
|
|
9655
9731
|
{ kind: "markdown", path: "sales-script.md", mime_type: "text/markdown", name: "Sales script", previewable: true }
|
|
9656
9732
|
]),
|
|
9657
|
-
campaign: spec("campaign", "Campaign", "campaign",
|
|
9733
|
+
campaign: spec("campaign", "Campaign", "campaign", fileBundle("campaign_bundle"), [
|
|
9658
9734
|
{ kind: "markdown", path: "campaign-plan.md", mime_type: "text/markdown", name: "Campaign plan", previewable: true },
|
|
9659
9735
|
{ kind: "html", path: "campaign-assets.html", mime_type: "text/html", name: "Campaign assets", previewable: true }
|
|
9660
9736
|
], { designResearchRequired: true }),
|
|
9661
|
-
challenge: spec("challenge", "Challenge", "challenge",
|
|
9737
|
+
challenge: spec("challenge", "Challenge", "challenge", fileBundle("challenge_bundle"), [
|
|
9662
9738
|
{ kind: "markdown", path: "challenge-plan.md", mime_type: "text/markdown", name: "Challenge plan", previewable: true }
|
|
9663
9739
|
]),
|
|
9664
|
-
character: spec("character", "Character pack", "brand_character",
|
|
9740
|
+
character: spec("character", "Character pack", "brand_character", fileBundle("character_bundle"), [
|
|
9665
9741
|
{ kind: "markdown", path: "character-pack.md", mime_type: "text/markdown", name: "Character pack", previewable: true }
|
|
9666
9742
|
], { designResearchRequired: true }),
|
|
9667
|
-
custom: spec("custom", "Custom build", "
|
|
9743
|
+
custom: spec("custom", "Custom build", "file", fileBundle("file_bundle"), [])
|
|
9668
9744
|
};
|
|
9669
9745
|
function normalizeBuildKind(value) {
|
|
9670
9746
|
return (value ?? "").trim().toLowerCase().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
|
|
@@ -9677,14 +9753,14 @@ function resolveAgentBuildKind(value, fallback = "custom") {
|
|
|
9677
9753
|
function getAgentBuildKindSpec(value) {
|
|
9678
9754
|
return AGENT_BUILD_KIND_SPECS[resolveAgentBuildKind(value)];
|
|
9679
9755
|
}
|
|
9680
|
-
function
|
|
9756
|
+
function normalizeFilePath(path, outputRoot) {
|
|
9681
9757
|
return path.startsWith("/") ? path : `${outputRoot}/${path}`;
|
|
9682
9758
|
}
|
|
9683
|
-
function
|
|
9684
|
-
if (options.
|
|
9759
|
+
function createAgentBuildExpectedOutputs(buildKind, options = {}) {
|
|
9760
|
+
if (options.expectedOutputs) return options.expectedOutputs;
|
|
9685
9761
|
const spec2 = getAgentBuildKindSpec(buildKind);
|
|
9686
9762
|
const outputRoot = options.outputRoot ?? DEFAULT_AGENT_BUILD_OUTPUT_ROOT;
|
|
9687
|
-
const
|
|
9763
|
+
const files = [
|
|
9688
9764
|
{
|
|
9689
9765
|
path: `${outputRoot}/manifest.json`,
|
|
9690
9766
|
kind: "json",
|
|
@@ -9692,10 +9768,10 @@ function createAgentBuildOutputContract(buildKind, options = {}) {
|
|
|
9692
9768
|
name: "Manifest",
|
|
9693
9769
|
downloadable: true
|
|
9694
9770
|
},
|
|
9695
|
-
...(options.
|
|
9696
|
-
...
|
|
9697
|
-
path:
|
|
9698
|
-
downloadable:
|
|
9771
|
+
...(options.files ?? spec2.files).map((file) => ({
|
|
9772
|
+
...file,
|
|
9773
|
+
path: normalizeFilePath(file.path, outputRoot),
|
|
9774
|
+
downloadable: file.downloadable ?? true
|
|
9699
9775
|
}))
|
|
9700
9776
|
];
|
|
9701
9777
|
const contract = withoutUndefined({
|
|
@@ -9703,11 +9779,16 @@ function createAgentBuildOutputContract(buildKind, options = {}) {
|
|
|
9703
9779
|
manifest: `${outputRoot}/manifest.json`,
|
|
9704
9780
|
planner_documents_under: "/workspace/planner",
|
|
9705
9781
|
inputs_under: DEFAULT_AGENT_BUILD_INPUT_ROOT,
|
|
9706
|
-
|
|
9782
|
+
deliverable_type: options.deliverableType ?? spec2.deliverableType,
|
|
9707
9783
|
required_files: [`${outputRoot}/manifest.json`],
|
|
9708
|
-
|
|
9784
|
+
files,
|
|
9785
|
+
expected_outputs: {
|
|
9786
|
+
messages: true,
|
|
9787
|
+
files,
|
|
9788
|
+
previews: spec2.previewPort !== void 0
|
|
9789
|
+
},
|
|
9709
9790
|
preview_port: spec2.previewPort,
|
|
9710
|
-
|
|
9791
|
+
include_downloads: true
|
|
9711
9792
|
});
|
|
9712
9793
|
return contract;
|
|
9713
9794
|
}
|
|
@@ -9725,21 +9806,21 @@ function withoutUndefined(input) {
|
|
|
9725
9806
|
function createAgentBuildExecutionPacket(params) {
|
|
9726
9807
|
const buildKind = resolveAgentBuildKind(params.buildKind ?? params.runType);
|
|
9727
9808
|
const spec2 = AGENT_BUILD_KIND_SPECS[buildKind];
|
|
9728
|
-
const
|
|
9809
|
+
const deliverableType = params.deliverableType ?? spec2.deliverableType;
|
|
9729
9810
|
const runtimeTemplate = params.runtimeTemplate ?? spec2.runtimeTemplate;
|
|
9730
|
-
const outputOptions = {
|
|
9731
|
-
if (params.
|
|
9732
|
-
if (params.
|
|
9733
|
-
outputOptions.
|
|
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;
|
|
9734
9815
|
}
|
|
9735
9816
|
if (params.outputRoot !== void 0) outputOptions.outputRoot = params.outputRoot;
|
|
9736
|
-
const
|
|
9817
|
+
const expectedOutputs = createAgentBuildExpectedOutputs(buildKind, outputOptions);
|
|
9737
9818
|
const inputRefs = params.inputRefs ?? [];
|
|
9738
9819
|
const packet = {
|
|
9739
9820
|
version: DEFAULT_AGENT_BUILD_PACKET_VERSION,
|
|
9740
9821
|
run_type: buildKind,
|
|
9741
9822
|
build_kind: buildKind,
|
|
9742
|
-
|
|
9823
|
+
deliverable_type: deliverableType,
|
|
9743
9824
|
title: params.title,
|
|
9744
9825
|
goal: params.goal,
|
|
9745
9826
|
source_refs: params.sourceRefs ?? [],
|
|
@@ -9748,7 +9829,7 @@ function createAgentBuildExecutionPacket(params) {
|
|
|
9748
9829
|
planner_documents: normalizePlannerDocuments(params.plannerDocuments),
|
|
9749
9830
|
requested_outputs: params.requestedOutputs ?? spec2.requestedOutputs,
|
|
9750
9831
|
quality_rules: params.qualityRules ?? [],
|
|
9751
|
-
|
|
9832
|
+
expected_outputs: expectedOutputs,
|
|
9752
9833
|
runtime_instructions: {
|
|
9753
9834
|
agent: "claude",
|
|
9754
9835
|
template: runtimeTemplate,
|
|
@@ -9764,10 +9845,10 @@ function createAgentBuildExecutionPacket(params) {
|
|
|
9764
9845
|
metadata: {
|
|
9765
9846
|
...params.metadata ?? {},
|
|
9766
9847
|
build_kind: buildKind,
|
|
9767
|
-
|
|
9848
|
+
deliverable_type: deliverableType,
|
|
9768
9849
|
build_target: runtimeTemplate,
|
|
9769
9850
|
runtime_template: runtimeTemplate,
|
|
9770
|
-
|
|
9851
|
+
expected_outputs: expectedOutputs,
|
|
9771
9852
|
input_refs: inputRefs,
|
|
9772
9853
|
design_research_required: spec2.designResearchRequired,
|
|
9773
9854
|
planner_document_kinds: spec2.plannerDocumentKinds
|
|
@@ -9784,23 +9865,24 @@ function createAgentBuildPrompt(packet) {
|
|
|
9784
9865
|
"",
|
|
9785
9866
|
`Materialize input_refs under ${DEFAULT_AGENT_BUILD_INPUT_ROOT}.`,
|
|
9786
9867
|
"Use the execution packet, input bundle, planner documents, brand/context notes, and quality rules.",
|
|
9787
|
-
`Write every deliverable under ${packet.
|
|
9788
|
-
`Write a JSON manifest to ${packet.
|
|
9868
|
+
`Write every deliverable under ${packet.expected_outputs.write_files_under}.`,
|
|
9869
|
+
`Write a JSON manifest to ${packet.expected_outputs.manifest}.`,
|
|
9789
9870
|
"Do not expose secrets. Do not publish externally unless the approval policy allows it."
|
|
9790
9871
|
].join("\n");
|
|
9791
9872
|
}
|
|
9792
|
-
function
|
|
9873
|
+
function createBuildRunParams(params) {
|
|
9793
9874
|
const runtimeProfileId = params.agentRuntimeProfileId ?? params.runtimeProfileId;
|
|
9794
9875
|
const packetParams = { ...params };
|
|
9795
9876
|
if (runtimeProfileId !== void 0) packetParams.runtimeProfileId = runtimeProfileId;
|
|
9796
9877
|
const packet = createAgentBuildExecutionPacket(packetParams);
|
|
9797
9878
|
return withoutUndefined({
|
|
9798
|
-
|
|
9879
|
+
instruction: params.instruction ?? createAgentBuildPrompt(packet),
|
|
9799
9880
|
targetKind: params.targetKind ?? (params.computerId ? "computer" : "sandbox"),
|
|
9800
9881
|
targetId: params.targetId,
|
|
9801
9882
|
sandboxId: params.sandboxId,
|
|
9802
9883
|
computerId: params.computerId,
|
|
9803
|
-
|
|
9884
|
+
runner: params.runner ?? "claude-code",
|
|
9885
|
+
provider: params.provider,
|
|
9804
9886
|
model: params.model,
|
|
9805
9887
|
cwd: params.cwd ?? "/workspace",
|
|
9806
9888
|
timeout: params.timeout ?? 1800,
|
|
@@ -9811,7 +9893,7 @@ function createBuildAgentRunParams(params) {
|
|
|
9811
9893
|
externalUserId: params.externalUserId,
|
|
9812
9894
|
externalProjectId: params.externalProjectId,
|
|
9813
9895
|
executionPacket: packet,
|
|
9814
|
-
|
|
9896
|
+
expectedOutputs: packet.expected_outputs,
|
|
9815
9897
|
approvalPolicy: params.approvalPolicy ?? {
|
|
9816
9898
|
publish: "manual",
|
|
9817
9899
|
external_write: "manual",
|
|
@@ -9820,12 +9902,13 @@ function createBuildAgentRunParams(params) {
|
|
|
9820
9902
|
capabilityRequirements: params.capabilityRequirements ?? [
|
|
9821
9903
|
"filesystem",
|
|
9822
9904
|
"shell",
|
|
9823
|
-
"
|
|
9905
|
+
"files",
|
|
9906
|
+
"downloads"
|
|
9824
9907
|
],
|
|
9825
9908
|
metadata: {
|
|
9826
9909
|
...params.metadata ?? {},
|
|
9827
9910
|
build_kind: packet.build_kind,
|
|
9828
|
-
|
|
9911
|
+
deliverable_type: packet.deliverable_type
|
|
9829
9912
|
}
|
|
9830
9913
|
});
|
|
9831
9914
|
}
|
|
@@ -9986,6 +10069,6 @@ var AppAuth = class {
|
|
|
9986
10069
|
}
|
|
9987
10070
|
};
|
|
9988
10071
|
|
|
9989
|
-
export { AGENT_BUILD_KIND_SPECS, Admin,
|
|
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 };
|
|
9990
10073
|
//# sourceMappingURL=index.js.map
|
|
9991
10074
|
//# sourceMappingURL=index.js.map
|