@phala/cloud 0.2.9 → 0.2.10
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/actions/apps/check_app_cvms_is_allowed.d.ts +315 -5
- package/dist/actions/apps/check_app_is_allowed.d.ts +2 -2
- package/dist/actions/apps/create_app_instance.d.ts +13 -4
- package/dist/actions/apps/get_app_attestation.d.ts +50 -0
- package/dist/actions/apps/get_app_device_allowlist.d.ts +274 -5
- package/dist/actions/apps/get_app_filter_options.d.ts +2 -2
- package/dist/actions/cvms/check_cvm_is_allowed.d.ts +133 -3
- package/dist/actions/cvms/commit_cvm_provision.d.ts +425 -148
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +328 -0
- package/dist/actions/cvms/get_prelaunch_script_upgrade_status.d.ts +93 -0
- package/dist/actions/cvms/provision_cvm.d.ts +243 -225
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +216 -0
- package/dist/actions/cvms/refresh_cvm_instance_id.d.ts +123 -5
- package/dist/actions/cvms/refresh_cvm_instance_ids.d.ts +236 -7
- package/dist/actions/cvms/replicate_cvm.d.ts +4 -4
- package/dist/actions/cvms/restart_cvm.d.ts +4 -4
- package/dist/actions/cvms/shutdown_cvm.d.ts +4 -4
- package/dist/actions/cvms/start_cvm.d.ts +4 -4
- package/dist/actions/cvms/stop_cvm.d.ts +4 -4
- package/dist/actions/cvms/update_cvm_visibility.d.ts +2 -2
- package/dist/actions/cvms/upgrade_prelaunch_script.d.ts +319 -0
- package/dist/actions/get_cvm_create_resources.d.ts +2412 -0
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/workspaces/get_workspace.d.ts +2 -0
- package/dist/actions/workspaces/list_workspaces.d.ts +18 -0
- package/dist/client.d.ts +5 -2
- package/dist/create-client.d.ts +48 -0
- package/dist/index.js +1634 -1218
- package/dist/index.mjs +1602 -1216
- package/dist/types/app_compose.d.ts +125 -0
- package/dist/types/app_info_v20251028.d.ts +8 -131
- package/dist/types/app_info_v20260121.d.ts +4500 -168
- package/dist/types/client.d.ts +2 -2
- package/dist/types/cvm_info.d.ts +533 -7
- package/dist/types/cvm_info_v20251028.d.ts +18 -18
- package/dist/types/cvm_info_v20260121.d.ts +1640 -89
- package/dist/types/version-mappings.d.ts +8 -8
- package/dist/utils/errors.d.ts +8 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -23,6 +23,16 @@ var ApiErrorSchema = z.object({
|
|
|
23
23
|
type: z.string().optional(),
|
|
24
24
|
code: z.string().optional()
|
|
25
25
|
});
|
|
26
|
+
function extractRequestId(data) {
|
|
27
|
+
if (!data || typeof data !== "object") {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
const requestId = data.request_id;
|
|
31
|
+
return typeof requestId === "string" ? requestId : void 0;
|
|
32
|
+
}
|
|
33
|
+
function extractRequestIdFromResponse(response) {
|
|
34
|
+
return response?.headers?.get("X-Request-ID") ?? void 0;
|
|
35
|
+
}
|
|
26
36
|
var PhalaCloudError = class extends Error {
|
|
27
37
|
constructor(message, data) {
|
|
28
38
|
super(message);
|
|
@@ -30,6 +40,8 @@ var PhalaCloudError = class extends Error {
|
|
|
30
40
|
this.status = data.status;
|
|
31
41
|
this.statusText = data.statusText;
|
|
32
42
|
this.detail = data.detail;
|
|
43
|
+
this.requestId = data.requestId;
|
|
44
|
+
this.code = data.code;
|
|
33
45
|
if (Error.captureStackTrace) {
|
|
34
46
|
Error.captureStackTrace(this, this.constructor);
|
|
35
47
|
}
|
|
@@ -40,20 +52,24 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
40
52
|
super(message, {
|
|
41
53
|
status: options?.status ?? 0,
|
|
42
54
|
statusText: options?.statusText ?? "Unknown Error",
|
|
43
|
-
detail: options?.detail || message
|
|
55
|
+
detail: options?.detail || message,
|
|
56
|
+
requestId: options?.requestId,
|
|
57
|
+
code: options?.code
|
|
44
58
|
});
|
|
45
59
|
this.name = "RequestError";
|
|
46
60
|
this.isRequestError = true;
|
|
47
61
|
this.data = options?.data;
|
|
48
62
|
this.request = options?.request;
|
|
49
63
|
this.response = options?.response;
|
|
50
|
-
this.code = options?.code;
|
|
51
64
|
this.type = options?.type;
|
|
52
65
|
}
|
|
53
66
|
/**
|
|
54
67
|
* Create RequestError from FetchError
|
|
55
68
|
*/
|
|
56
69
|
static fromFetchError(error) {
|
|
70
|
+
const bodyRequestId = extractRequestId(error.data);
|
|
71
|
+
const headerRequestId = extractRequestIdFromResponse(error.response);
|
|
72
|
+
const requestId = bodyRequestId ?? headerRequestId;
|
|
57
73
|
const parseResult = ApiErrorSchema.safeParse(error.data);
|
|
58
74
|
if (parseResult.success) {
|
|
59
75
|
const detail = parseResult.data.detail ?? (error.data && typeof error.data === "object" && "error_code" in error.data ? error.data : void 0);
|
|
@@ -65,7 +81,22 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
65
81
|
response: error.response ?? void 0,
|
|
66
82
|
detail,
|
|
67
83
|
code: parseResult.data.code ?? void 0,
|
|
68
|
-
type: parseResult.data.type ?? void 0
|
|
84
|
+
type: parseResult.data.type ?? void 0,
|
|
85
|
+
requestId
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const cause = error.cause;
|
|
89
|
+
if (cause?.name === "TimeoutError" || error.message?.includes("[TimeoutError]")) {
|
|
90
|
+
const message = "Request timed out. The server did not respond in time.";
|
|
91
|
+
return new _RequestError(message, {
|
|
92
|
+
status: 0,
|
|
93
|
+
statusText: "Request Timeout",
|
|
94
|
+
data: error.data,
|
|
95
|
+
request: error.request ?? void 0,
|
|
96
|
+
response: error.response ?? void 0,
|
|
97
|
+
detail: message,
|
|
98
|
+
code: "TIMEOUT",
|
|
99
|
+
requestId
|
|
69
100
|
});
|
|
70
101
|
}
|
|
71
102
|
return new _RequestError(error.message, {
|
|
@@ -74,8 +105,9 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
74
105
|
data: error.data,
|
|
75
106
|
request: error.request ?? void 0,
|
|
76
107
|
response: error.response ?? void 0,
|
|
77
|
-
detail: error.data?.detail || "Unknown API error",
|
|
78
|
-
code: error.status?.toString() ?? void 0
|
|
108
|
+
detail: error.data?.detail || error.message || "Unknown API error",
|
|
109
|
+
code: error.status?.toString() ?? void 0,
|
|
110
|
+
requestId
|
|
79
111
|
});
|
|
80
112
|
}
|
|
81
113
|
/**
|
|
@@ -201,6 +233,7 @@ function parseApiError(requestError) {
|
|
|
201
233
|
status,
|
|
202
234
|
statusText,
|
|
203
235
|
detail,
|
|
236
|
+
requestId: structured.request_id ?? requestError.requestId,
|
|
204
237
|
errorCode: structured.error_code,
|
|
205
238
|
structuredDetails: structured.details,
|
|
206
239
|
suggestions: structured.suggestions,
|
|
@@ -209,7 +242,13 @@ function parseApiError(requestError) {
|
|
|
209
242
|
}
|
|
210
243
|
const errorType = categorizeErrorType(status);
|
|
211
244
|
const message = extractPrimaryMessage(status, detail, requestError.message);
|
|
212
|
-
const commonData = {
|
|
245
|
+
const commonData = {
|
|
246
|
+
status,
|
|
247
|
+
statusText,
|
|
248
|
+
detail,
|
|
249
|
+
requestId: requestError.requestId,
|
|
250
|
+
code: requestError.code
|
|
251
|
+
};
|
|
213
252
|
if (errorType === "validation" && Array.isArray(detail)) {
|
|
214
253
|
const { errors } = parseValidationErrors(detail);
|
|
215
254
|
return new ValidationError(message, {
|
|
@@ -290,6 +329,7 @@ function parseStructuredError(detail) {
|
|
|
290
329
|
return {
|
|
291
330
|
error_code: obj.error_code,
|
|
292
331
|
message: obj.message,
|
|
332
|
+
request_id: typeof obj.request_id === "string" ? obj.request_id : void 0,
|
|
293
333
|
details: obj.details,
|
|
294
334
|
suggestions: obj.suggestions,
|
|
295
335
|
links: obj.links
|
|
@@ -305,6 +345,9 @@ function formatStructuredError(error, options) {
|
|
|
305
345
|
} else {
|
|
306
346
|
parts.push(error.message);
|
|
307
347
|
}
|
|
348
|
+
if (error.requestId) {
|
|
349
|
+
parts.push(`Request ID: ${error.requestId}`);
|
|
350
|
+
}
|
|
308
351
|
if (error.structuredDetails && error.structuredDetails.length > 0) {
|
|
309
352
|
parts.push("");
|
|
310
353
|
parts.push("Details:");
|
|
@@ -342,9 +385,10 @@ function isAppIdConflictError(error) {
|
|
|
342
385
|
// src/client.ts
|
|
343
386
|
var SUPPORTED_API_VERSIONS = [
|
|
344
387
|
"2025-10-28",
|
|
345
|
-
"2026-01-21"
|
|
388
|
+
"2026-01-21",
|
|
389
|
+
"2026-05-22"
|
|
346
390
|
];
|
|
347
|
-
var DEFAULT_API_VERSION = "2026-
|
|
391
|
+
var DEFAULT_API_VERSION = "2026-05-22";
|
|
348
392
|
var logger = debug("phala::api-client");
|
|
349
393
|
function formatHeaders(headers) {
|
|
350
394
|
return Object.entries(headers).map(([key, value]) => ` -H "${key}: ${value}"`).join("\n");
|
|
@@ -397,7 +441,7 @@ var Client = class _Client {
|
|
|
397
441
|
}
|
|
398
442
|
this.fetchInstance = ofetch.create({
|
|
399
443
|
baseURL,
|
|
400
|
-
timeout: timeout ||
|
|
444
|
+
timeout: timeout || 6e4,
|
|
401
445
|
headers: requestHeaders,
|
|
402
446
|
...useCookieAuth ? { credentials: "include" } : {},
|
|
403
447
|
...fetchOptions,
|
|
@@ -702,7 +746,7 @@ var Client = class _Client {
|
|
|
702
746
|
*
|
|
703
747
|
* @example
|
|
704
748
|
* ```typescript
|
|
705
|
-
* const client = createClient(); // defaults to 2026-
|
|
749
|
+
* const client = createClient(); // defaults to 2026-05-22
|
|
706
750
|
* const legacyClient = client.withVersion("2025-10-28");
|
|
707
751
|
* const data = await getCvmInfo(legacyClient, { id: "xxx" });
|
|
708
752
|
* ```
|
|
@@ -1040,34 +1084,135 @@ var { action: getAvailableNodes, safeAction: safeGetAvailableNodes } = defineSim
|
|
|
1040
1084
|
}
|
|
1041
1085
|
);
|
|
1042
1086
|
|
|
1043
|
-
// src/actions/
|
|
1087
|
+
// src/actions/get_cvm_create_resources.ts
|
|
1044
1088
|
import { z as z6 } from "zod";
|
|
1045
|
-
var
|
|
1089
|
+
var ResourceIdV20260121Schema = z6.union([z6.number(), z6.string()]);
|
|
1090
|
+
var HashIdSchema = z6.string();
|
|
1091
|
+
var GpuAvailabilitySchema = z6.object({
|
|
1092
|
+
has_reserved_gpus: z6.boolean(),
|
|
1093
|
+
reserved_gpu_count: z6.number(),
|
|
1094
|
+
has_public_gpus: z6.boolean(),
|
|
1095
|
+
public_gpu_count: z6.number()
|
|
1096
|
+
}).passthrough();
|
|
1097
|
+
var CvmCreateKmsResourceV20260121Schema = z6.object({
|
|
1098
|
+
id: ResourceIdV20260121Schema,
|
|
1099
|
+
slug: z6.string().nullable().optional(),
|
|
1100
|
+
url: z6.string(),
|
|
1101
|
+
version: z6.string().nullable().optional(),
|
|
1102
|
+
kms_type: z6.string(),
|
|
1103
|
+
chain_id: z6.number().nullable().optional(),
|
|
1104
|
+
kms_contract_id: ResourceIdV20260121Schema.nullable().optional(),
|
|
1105
|
+
kms_contract_address: z6.string().nullable().optional(),
|
|
1106
|
+
gateway_app_id: z6.string().nullable().optional(),
|
|
1107
|
+
supported_os_images: z6.array(z6.string()).default([])
|
|
1108
|
+
}).passthrough();
|
|
1109
|
+
var CvmCreateNodeKmsRelationV20260121Schema = z6.object({
|
|
1110
|
+
teepod_id: z6.number(),
|
|
1111
|
+
kms_id: ResourceIdV20260121Schema,
|
|
1112
|
+
kms_type: z6.string(),
|
|
1113
|
+
kms_contract_id: ResourceIdV20260121Schema.nullable().optional(),
|
|
1114
|
+
kms_contract_address: z6.string().nullable().optional(),
|
|
1115
|
+
supported_os_images: z6.array(z6.string()).default([])
|
|
1116
|
+
}).passthrough();
|
|
1117
|
+
var CvmCreateGatewayResourceV20260121Schema = z6.object({
|
|
1118
|
+
id: ResourceIdV20260121Schema,
|
|
1119
|
+
teepod_id: z6.number().nullable().optional(),
|
|
1120
|
+
kms_contract_id: ResourceIdV20260121Schema,
|
|
1121
|
+
rpc_url: z6.string().nullable().optional(),
|
|
1122
|
+
domain_suffix: z6.string().nullable().optional(),
|
|
1123
|
+
enabled: z6.boolean()
|
|
1124
|
+
}).passthrough();
|
|
1125
|
+
var CvmCreateKmsResourceSchema = CvmCreateKmsResourceV20260121Schema.extend({
|
|
1126
|
+
id: HashIdSchema,
|
|
1127
|
+
kms_contract_id: HashIdSchema.nullable().optional()
|
|
1128
|
+
});
|
|
1129
|
+
var CvmCreateNodeKmsRelationSchema = CvmCreateNodeKmsRelationV20260121Schema.extend({
|
|
1130
|
+
kms_id: HashIdSchema,
|
|
1131
|
+
kms_contract_id: HashIdSchema.nullable().optional()
|
|
1132
|
+
});
|
|
1133
|
+
var CvmCreateGatewayResourceSchema = CvmCreateGatewayResourceV20260121Schema.extend({
|
|
1134
|
+
id: HashIdSchema,
|
|
1135
|
+
kms_contract_id: HashIdSchema
|
|
1136
|
+
});
|
|
1137
|
+
var CvmCreateInstanceTypeResourceSchema = z6.object({
|
|
1046
1138
|
id: z6.string(),
|
|
1047
1139
|
name: z6.string(),
|
|
1048
|
-
description: z6.string(),
|
|
1049
1140
|
vcpu: z6.number(),
|
|
1050
1141
|
memory_mb: z6.number(),
|
|
1051
|
-
|
|
1142
|
+
default_disk_size_gb: z6.number(),
|
|
1052
1143
|
requires_gpu: z6.boolean(),
|
|
1053
|
-
|
|
1054
|
-
family: z6.string().nullable()
|
|
1144
|
+
requires_gpu_count: z6.number(),
|
|
1145
|
+
family: z6.string().nullable().optional(),
|
|
1146
|
+
display_order: z6.number().nullable().optional()
|
|
1055
1147
|
}).passthrough();
|
|
1056
|
-
var
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1148
|
+
var CvmCreateResourceGraphV20260121Schema = z6.object({
|
|
1149
|
+
tier: z6.string(),
|
|
1150
|
+
capacity: ResourceThresholdSchema,
|
|
1151
|
+
nodes: z6.array(TeepodCapacitySchema),
|
|
1152
|
+
kms_nodes: z6.array(CvmCreateKmsResourceV20260121Schema),
|
|
1153
|
+
node_kms_relations: z6.array(CvmCreateNodeKmsRelationV20260121Schema),
|
|
1154
|
+
gateway_nodes: z6.array(CvmCreateGatewayResourceV20260121Schema),
|
|
1155
|
+
instance_types: z6.array(CvmCreateInstanceTypeResourceSchema),
|
|
1156
|
+
gpu_availability: GpuAvailabilitySchema
|
|
1157
|
+
}).passthrough();
|
|
1158
|
+
var CvmCreateResourceGraphV20260522Schema = CvmCreateResourceGraphV20260121Schema.extend({
|
|
1159
|
+
kms_nodes: z6.array(CvmCreateKmsResourceSchema),
|
|
1160
|
+
node_kms_relations: z6.array(CvmCreateNodeKmsRelationSchema),
|
|
1161
|
+
gateway_nodes: z6.array(CvmCreateGatewayResourceSchema)
|
|
1162
|
+
});
|
|
1163
|
+
var CvmCreateResourceGraphSchema = CvmCreateResourceGraphV20260522Schema;
|
|
1164
|
+
function getSchemaForVersion2(version) {
|
|
1165
|
+
if (version === "2026-01-21") return CvmCreateResourceGraphV20260121Schema;
|
|
1166
|
+
return CvmCreateResourceGraphV20260522Schema;
|
|
1167
|
+
}
|
|
1168
|
+
async function getCvmCreateResources(client, parameters) {
|
|
1169
|
+
const response = await client.get("/teepods/cvm-create-resources");
|
|
1170
|
+
if (parameters?.schema === false) return response;
|
|
1171
|
+
const schema = parameters?.schema || getSchemaForVersion2(client.config.version);
|
|
1172
|
+
return schema.parse(response);
|
|
1173
|
+
}
|
|
1174
|
+
async function safeGetCvmCreateResources(client, parameters) {
|
|
1175
|
+
try {
|
|
1176
|
+
const response = await client.get("/teepods/cvm-create-resources");
|
|
1177
|
+
if (parameters?.schema === false) {
|
|
1178
|
+
return { success: true, data: response };
|
|
1179
|
+
}
|
|
1180
|
+
const schema = parameters?.schema || getSchemaForVersion2(client.config.version);
|
|
1181
|
+
const data = schema.parse(response);
|
|
1182
|
+
return { success: true, data };
|
|
1183
|
+
} catch (error) {
|
|
1184
|
+
return { success: false, error };
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// src/actions/list-instance-types.ts
|
|
1189
|
+
import { z as z7 } from "zod";
|
|
1190
|
+
var InstanceTypeSchema = z7.object({
|
|
1191
|
+
id: z7.string(),
|
|
1192
|
+
name: z7.string(),
|
|
1193
|
+
description: z7.string(),
|
|
1194
|
+
vcpu: z7.number(),
|
|
1195
|
+
memory_mb: z7.number(),
|
|
1196
|
+
hourly_rate: z7.string(),
|
|
1197
|
+
requires_gpu: z7.boolean(),
|
|
1198
|
+
default_disk_size_gb: z7.number().default(20),
|
|
1199
|
+
family: z7.string().nullable()
|
|
1200
|
+
}).passthrough();
|
|
1201
|
+
var FamilyGroupSchema = z7.object({
|
|
1202
|
+
name: z7.string(),
|
|
1203
|
+
items: z7.array(InstanceTypeSchema),
|
|
1204
|
+
total: z7.number()
|
|
1060
1205
|
}).strict();
|
|
1061
|
-
var AllFamiliesResponseSchema =
|
|
1062
|
-
result:
|
|
1206
|
+
var AllFamiliesResponseSchema = z7.object({
|
|
1207
|
+
result: z7.array(FamilyGroupSchema)
|
|
1063
1208
|
}).strict();
|
|
1064
|
-
var FamilyInstanceTypesResponseSchema =
|
|
1065
|
-
items:
|
|
1066
|
-
total:
|
|
1067
|
-
family:
|
|
1209
|
+
var FamilyInstanceTypesResponseSchema = z7.object({
|
|
1210
|
+
items: z7.array(InstanceTypeSchema),
|
|
1211
|
+
total: z7.number(),
|
|
1212
|
+
family: z7.string()
|
|
1068
1213
|
}).strict();
|
|
1069
|
-
var ListFamilyInstanceTypesRequestSchema =
|
|
1070
|
-
family:
|
|
1214
|
+
var ListFamilyInstanceTypesRequestSchema = z7.object({
|
|
1215
|
+
family: z7.string()
|
|
1071
1216
|
}).strict();
|
|
1072
1217
|
var { action: listAllInstanceTypeFamilies, safeAction: safeListAllInstanceTypeFamilies } = defineAction(
|
|
1073
1218
|
AllFamiliesResponseSchema,
|
|
@@ -1081,24 +1226,25 @@ var { action: listFamilyInstanceTypes, safeAction: safeListFamilyInstanceTypes }
|
|
|
1081
1226
|
});
|
|
1082
1227
|
|
|
1083
1228
|
// src/actions/workspaces/list_workspaces.ts
|
|
1084
|
-
import { z as
|
|
1085
|
-
var WorkspaceResponseSchema =
|
|
1086
|
-
id:
|
|
1087
|
-
name:
|
|
1088
|
-
slug:
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1229
|
+
import { z as z8 } from "zod";
|
|
1230
|
+
var WorkspaceResponseSchema = z8.object({
|
|
1231
|
+
id: z8.string(),
|
|
1232
|
+
name: z8.string(),
|
|
1233
|
+
slug: z8.string().nullable(),
|
|
1234
|
+
avatar_url: z8.string().nullable().optional(),
|
|
1235
|
+
tier: z8.string(),
|
|
1236
|
+
role: z8.string(),
|
|
1237
|
+
is_default: z8.boolean(),
|
|
1238
|
+
created_at: z8.string(),
|
|
1239
|
+
confidential_models_enabled: z8.boolean().optional()
|
|
1094
1240
|
}).passthrough();
|
|
1095
|
-
var PaginationMetadataSchema =
|
|
1096
|
-
has_more:
|
|
1097
|
-
next_cursor:
|
|
1098
|
-
total:
|
|
1241
|
+
var PaginationMetadataSchema = z8.object({
|
|
1242
|
+
has_more: z8.boolean(),
|
|
1243
|
+
next_cursor: z8.string().nullable(),
|
|
1244
|
+
total: z8.number().nullable()
|
|
1099
1245
|
}).passthrough();
|
|
1100
|
-
var ListWorkspacesSchema =
|
|
1101
|
-
data:
|
|
1246
|
+
var ListWorkspacesSchema = z8.object({
|
|
1247
|
+
data: z8.array(WorkspaceResponseSchema),
|
|
1102
1248
|
pagination: PaginationMetadataSchema
|
|
1103
1249
|
}).passthrough();
|
|
1104
1250
|
var { action: listWorkspaces, safeAction: safeListWorkspaces } = defineAction(ListWorkspacesSchema, async (client, request) => {
|
|
@@ -1115,143 +1261,144 @@ var { action: getWorkspace, safeAction: safeGetWorkspace } = defineAction(Worksp
|
|
|
1115
1261
|
});
|
|
1116
1262
|
|
|
1117
1263
|
// src/types/cvm_info_v20251028.ts
|
|
1118
|
-
import { z as
|
|
1119
|
-
var
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1264
|
+
import { z as z9 } from "zod";
|
|
1265
|
+
var TableIdSchema = z9.union([z9.number(), z9.string()]);
|
|
1266
|
+
var VmInfoV20251028Schema = z9.object({
|
|
1267
|
+
id: z9.string(),
|
|
1268
|
+
name: z9.string(),
|
|
1269
|
+
status: z9.string(),
|
|
1270
|
+
uptime: z9.string(),
|
|
1271
|
+
app_url: z9.string().nullable(),
|
|
1272
|
+
app_id: z9.string(),
|
|
1273
|
+
instance_id: z9.string().nullable(),
|
|
1274
|
+
configuration: z9.any().optional(),
|
|
1275
|
+
exited_at: z9.string().nullable(),
|
|
1276
|
+
boot_progress: z9.string().nullable(),
|
|
1277
|
+
boot_error: z9.string().nullable(),
|
|
1278
|
+
shutdown_progress: z9.string().nullable(),
|
|
1279
|
+
image_version: z9.string().nullable()
|
|
1280
|
+
});
|
|
1281
|
+
var ManagedUserV20251028Schema = z9.object({
|
|
1282
|
+
id: TableIdSchema,
|
|
1283
|
+
username: z9.string()
|
|
1284
|
+
});
|
|
1285
|
+
var CvmNodeV20251028Schema = z9.object({
|
|
1286
|
+
id: z9.number(),
|
|
1287
|
+
name: z9.string(),
|
|
1288
|
+
region_identifier: z9.string().nullable().optional()
|
|
1142
1289
|
});
|
|
1143
|
-
var MachineInfoV20251028Schema =
|
|
1144
|
-
vcpu:
|
|
1145
|
-
memory:
|
|
1146
|
-
disk_size:
|
|
1147
|
-
gpu_count:
|
|
1290
|
+
var MachineInfoV20251028Schema = z9.object({
|
|
1291
|
+
vcpu: z9.number(),
|
|
1292
|
+
memory: z9.number(),
|
|
1293
|
+
disk_size: z9.number(),
|
|
1294
|
+
gpu_count: z9.number().default(0)
|
|
1148
1295
|
});
|
|
1149
|
-
var CvmNetworkUrlsV20251028Schema =
|
|
1150
|
-
app:
|
|
1151
|
-
instance:
|
|
1296
|
+
var CvmNetworkUrlsV20251028Schema = z9.object({
|
|
1297
|
+
app: z9.string(),
|
|
1298
|
+
instance: z9.string()
|
|
1152
1299
|
});
|
|
1153
|
-
var CvmInfoV20251028Schema =
|
|
1300
|
+
var CvmInfoV20251028Schema = z9.object({
|
|
1154
1301
|
hosted: VmInfoV20251028Schema,
|
|
1155
|
-
name:
|
|
1302
|
+
name: z9.string(),
|
|
1156
1303
|
managed_user: ManagedUserV20251028Schema.nullable(),
|
|
1157
1304
|
node: CvmNodeV20251028Schema.nullable(),
|
|
1158
|
-
listed:
|
|
1159
|
-
status:
|
|
1160
|
-
in_progress:
|
|
1161
|
-
dapp_dashboard_url:
|
|
1162
|
-
syslog_endpoint:
|
|
1163
|
-
allow_upgrade:
|
|
1164
|
-
project_id:
|
|
1165
|
-
project_type:
|
|
1166
|
-
billing_period:
|
|
1305
|
+
listed: z9.boolean().default(false),
|
|
1306
|
+
status: z9.string(),
|
|
1307
|
+
in_progress: z9.boolean().default(false),
|
|
1308
|
+
dapp_dashboard_url: z9.string().nullable(),
|
|
1309
|
+
syslog_endpoint: z9.string().nullable(),
|
|
1310
|
+
allow_upgrade: z9.boolean().default(false),
|
|
1311
|
+
project_id: z9.string().nullable(),
|
|
1312
|
+
project_type: z9.string().nullable(),
|
|
1313
|
+
billing_period: z9.string().nullable(),
|
|
1167
1314
|
kms_info: KmsInfoSchema.nullable(),
|
|
1168
|
-
vcpu:
|
|
1169
|
-
memory:
|
|
1170
|
-
disk_size:
|
|
1171
|
-
gateway_domain:
|
|
1172
|
-
public_urls:
|
|
1315
|
+
vcpu: z9.number().nullable(),
|
|
1316
|
+
memory: z9.number().nullable(),
|
|
1317
|
+
disk_size: z9.number().nullable(),
|
|
1318
|
+
gateway_domain: z9.string().nullable(),
|
|
1319
|
+
public_urls: z9.array(CvmNetworkUrlsV20251028Schema),
|
|
1173
1320
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
1174
|
-
updated_at:
|
|
1321
|
+
updated_at: z9.string().nullable().optional()
|
|
1175
1322
|
});
|
|
1176
|
-
var CvmDetailV20251028Schema =
|
|
1177
|
-
id:
|
|
1178
|
-
name:
|
|
1179
|
-
status:
|
|
1180
|
-
in_progress:
|
|
1181
|
-
teepod_id:
|
|
1323
|
+
var CvmDetailV20251028Schema = z9.object({
|
|
1324
|
+
id: TableIdSchema,
|
|
1325
|
+
name: z9.string(),
|
|
1326
|
+
status: z9.string(),
|
|
1327
|
+
in_progress: z9.boolean().optional().default(false),
|
|
1328
|
+
teepod_id: z9.number().nullable(),
|
|
1182
1329
|
teepod: CvmNodeV20251028Schema.optional().nullable(),
|
|
1183
|
-
app_id:
|
|
1184
|
-
vm_uuid:
|
|
1185
|
-
instance_id:
|
|
1186
|
-
vcpu:
|
|
1187
|
-
memory:
|
|
1188
|
-
disk_size:
|
|
1189
|
-
base_image:
|
|
1190
|
-
encrypted_env_pubkey:
|
|
1191
|
-
listed:
|
|
1192
|
-
project_id:
|
|
1193
|
-
project_type:
|
|
1194
|
-
instance_type:
|
|
1195
|
-
public_sysinfo:
|
|
1196
|
-
public_logs:
|
|
1197
|
-
dapp_dashboard_url:
|
|
1198
|
-
syslog_endpoint:
|
|
1330
|
+
app_id: z9.string(),
|
|
1331
|
+
vm_uuid: z9.string().nullable(),
|
|
1332
|
+
instance_id: z9.string().nullable(),
|
|
1333
|
+
vcpu: z9.number(),
|
|
1334
|
+
memory: z9.number(),
|
|
1335
|
+
disk_size: z9.number(),
|
|
1336
|
+
base_image: z9.string().nullable(),
|
|
1337
|
+
encrypted_env_pubkey: z9.string().nullable(),
|
|
1338
|
+
listed: z9.boolean().optional().default(false),
|
|
1339
|
+
project_id: z9.string().optional().nullable(),
|
|
1340
|
+
project_type: z9.string().optional().nullable(),
|
|
1341
|
+
instance_type: z9.string().optional().nullable(),
|
|
1342
|
+
public_sysinfo: z9.boolean().optional().default(false),
|
|
1343
|
+
public_logs: z9.boolean().optional().default(false),
|
|
1344
|
+
dapp_dashboard_url: z9.string().optional().nullable(),
|
|
1345
|
+
syslog_endpoint: z9.string().optional().nullable(),
|
|
1199
1346
|
kms_info: KmsInfoSchema.optional().nullable(),
|
|
1200
|
-
contract_address:
|
|
1201
|
-
deployer_address:
|
|
1202
|
-
scheduled_delete_at:
|
|
1203
|
-
public_urls:
|
|
1204
|
-
gateway_domain:
|
|
1347
|
+
contract_address: z9.string().optional().nullable(),
|
|
1348
|
+
deployer_address: z9.string().optional().nullable(),
|
|
1349
|
+
scheduled_delete_at: z9.string().optional().nullable(),
|
|
1350
|
+
public_urls: z9.array(CvmNetworkUrlsV20251028Schema).optional().default([]),
|
|
1351
|
+
gateway_domain: z9.string().optional().nullable(),
|
|
1205
1352
|
machine_info: MachineInfoV20251028Schema.optional().nullable(),
|
|
1206
|
-
updated_at:
|
|
1353
|
+
updated_at: z9.string().optional().nullable()
|
|
1207
1354
|
});
|
|
1208
|
-
var PaginatedCvmInfosV20251028Schema =
|
|
1209
|
-
items:
|
|
1210
|
-
total:
|
|
1211
|
-
page:
|
|
1212
|
-
page_size:
|
|
1213
|
-
pages:
|
|
1355
|
+
var PaginatedCvmInfosV20251028Schema = z9.object({
|
|
1356
|
+
items: z9.array(CvmInfoV20251028Schema),
|
|
1357
|
+
total: z9.number(),
|
|
1358
|
+
page: z9.number(),
|
|
1359
|
+
page_size: z9.number(),
|
|
1360
|
+
pages: z9.number()
|
|
1214
1361
|
});
|
|
1215
1362
|
|
|
1216
1363
|
// src/types/cvm_info_v20260121.ts
|
|
1217
|
-
import { z as
|
|
1218
|
-
var BillingPeriodSchema =
|
|
1219
|
-
var KmsTypeSchema =
|
|
1220
|
-
var UserRefSchema =
|
|
1221
|
-
object_type:
|
|
1222
|
-
id:
|
|
1223
|
-
username:
|
|
1224
|
-
avatar_url:
|
|
1225
|
-
});
|
|
1226
|
-
var WorkspaceRefSchema =
|
|
1227
|
-
object_type:
|
|
1228
|
-
id:
|
|
1229
|
-
name:
|
|
1230
|
-
slug:
|
|
1231
|
-
avatar_url:
|
|
1232
|
-
});
|
|
1233
|
-
var CvmResourceInfoV20260121Schema =
|
|
1234
|
-
instance_type:
|
|
1235
|
-
vcpu:
|
|
1236
|
-
memory_in_gb:
|
|
1237
|
-
disk_in_gb:
|
|
1238
|
-
gpus:
|
|
1239
|
-
compute_billing_price:
|
|
1364
|
+
import { z as z10 } from "zod";
|
|
1365
|
+
var BillingPeriodSchema = z10.enum(["skip", "hourly", "monthly"]);
|
|
1366
|
+
var KmsTypeSchema = z10.enum(["phala", "ethereum", "base", "legacy"]);
|
|
1367
|
+
var UserRefSchema = z10.object({
|
|
1368
|
+
object_type: z10.literal("user"),
|
|
1369
|
+
id: z10.string().nullable().optional(),
|
|
1370
|
+
username: z10.string().nullable().optional(),
|
|
1371
|
+
avatar_url: z10.string().nullable().optional()
|
|
1372
|
+
});
|
|
1373
|
+
var WorkspaceRefSchema = z10.object({
|
|
1374
|
+
object_type: z10.literal("workspace"),
|
|
1375
|
+
id: z10.string(),
|
|
1376
|
+
name: z10.string(),
|
|
1377
|
+
slug: z10.string().nullable().optional(),
|
|
1378
|
+
avatar_url: z10.string().nullable().optional()
|
|
1379
|
+
});
|
|
1380
|
+
var CvmResourceInfoV20260121Schema = z10.object({
|
|
1381
|
+
instance_type: z10.string().nullable().optional(),
|
|
1382
|
+
vcpu: z10.number().int().nullable().optional(),
|
|
1383
|
+
memory_in_gb: z10.number().nullable().optional(),
|
|
1384
|
+
disk_in_gb: z10.number().int().nullable().optional(),
|
|
1385
|
+
gpus: z10.number().int().nullable().optional(),
|
|
1386
|
+
compute_billing_price: z10.string().nullable().optional(),
|
|
1240
1387
|
billing_period: BillingPeriodSchema.nullable().optional()
|
|
1241
1388
|
});
|
|
1242
|
-
var CvmOsInfoV20260121Schema =
|
|
1243
|
-
name:
|
|
1244
|
-
version:
|
|
1245
|
-
is_dev:
|
|
1246
|
-
os_image_hash:
|
|
1389
|
+
var CvmOsInfoV20260121Schema = z10.object({
|
|
1390
|
+
name: z10.string().nullable().optional(),
|
|
1391
|
+
version: z10.string().nullable().optional(),
|
|
1392
|
+
is_dev: z10.boolean().nullable().optional(),
|
|
1393
|
+
os_image_hash: z10.string().nullable().optional()
|
|
1247
1394
|
});
|
|
1248
|
-
var CvmKmsInfoV20260121BaseSchema =
|
|
1249
|
-
chain_id:
|
|
1250
|
-
dstack_kms_address:
|
|
1251
|
-
dstack_app_address:
|
|
1252
|
-
deployer_address:
|
|
1253
|
-
rpc_endpoint:
|
|
1254
|
-
encrypted_env_pubkey:
|
|
1395
|
+
var CvmKmsInfoV20260121BaseSchema = z10.object({
|
|
1396
|
+
chain_id: z10.number().int().nullable().optional(),
|
|
1397
|
+
dstack_kms_address: z10.string().nullable().optional(),
|
|
1398
|
+
dstack_app_address: z10.string().nullable().optional(),
|
|
1399
|
+
deployer_address: z10.string().nullable().optional(),
|
|
1400
|
+
rpc_endpoint: z10.string().nullable().optional(),
|
|
1401
|
+
encrypted_env_pubkey: z10.string().nullable().optional()
|
|
1255
1402
|
});
|
|
1256
1403
|
var CvmKmsInfoV20260121Schema = CvmKmsInfoV20260121BaseSchema.transform((data) => {
|
|
1257
1404
|
if (data.chain_id != null) {
|
|
@@ -1262,67 +1409,88 @@ var CvmKmsInfoV20260121Schema = CvmKmsInfoV20260121BaseSchema.transform((data) =
|
|
|
1262
1409
|
}
|
|
1263
1410
|
return data;
|
|
1264
1411
|
});
|
|
1265
|
-
var CvmProgressInfoV20260121Schema =
|
|
1266
|
-
target:
|
|
1267
|
-
started_at:
|
|
1268
|
-
correlation_id:
|
|
1269
|
-
});
|
|
1270
|
-
var CvmGatewayInfoV20260121Schema =
|
|
1271
|
-
base_domain:
|
|
1272
|
-
cname:
|
|
1273
|
-
});
|
|
1274
|
-
var
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1412
|
+
var CvmProgressInfoV20260121Schema = z10.object({
|
|
1413
|
+
target: z10.string().nullable().optional(),
|
|
1414
|
+
started_at: z10.string().nullable().optional(),
|
|
1415
|
+
correlation_id: z10.string().nullable().optional()
|
|
1416
|
+
});
|
|
1417
|
+
var CvmGatewayInfoV20260121Schema = z10.object({
|
|
1418
|
+
base_domain: z10.string().nullable().optional(),
|
|
1419
|
+
cname: z10.string().nullable().optional()
|
|
1420
|
+
});
|
|
1421
|
+
var CvmLogUrlsV20260121Schema = z10.object({
|
|
1422
|
+
serial: z10.string().nullable().optional(),
|
|
1423
|
+
stdout: z10.string().nullable().optional(),
|
|
1424
|
+
stderr: z10.string().nullable().optional(),
|
|
1425
|
+
container_log_base: z10.string().nullable().optional()
|
|
1426
|
+
});
|
|
1427
|
+
var NodeRefSchema = z10.object({
|
|
1428
|
+
object_type: z10.literal("node"),
|
|
1429
|
+
id: z10.number().int().nullable().optional(),
|
|
1430
|
+
name: z10.string().nullable().optional(),
|
|
1431
|
+
region: z10.string().nullable().optional(),
|
|
1432
|
+
device_id: z10.string().nullable().optional(),
|
|
1433
|
+
ppid: z10.string().nullable().optional(),
|
|
1434
|
+
status: z10.string().nullable().optional(),
|
|
1435
|
+
version: z10.string().nullable().optional()
|
|
1283
1436
|
});
|
|
1284
1437
|
var CvmNodeInfoV20260121Schema = NodeRefSchema;
|
|
1285
|
-
var CvmInfoV20260121Schema =
|
|
1286
|
-
id:
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
instance_id: z9.string().nullable().optional(),
|
|
1438
|
+
var CvmInfoV20260121Schema = z10.object({
|
|
1439
|
+
id: z10.string(),
|
|
1440
|
+
name: z10.string(),
|
|
1441
|
+
app_id: z10.string().nullable().optional(),
|
|
1442
|
+
vm_uuid: z10.string().nullable().optional(),
|
|
1443
|
+
instance_id: z10.string().nullable().optional(),
|
|
1292
1444
|
resource: CvmResourceInfoV20260121Schema,
|
|
1293
1445
|
node_info: NodeRefSchema.nullable().optional(),
|
|
1294
1446
|
os: CvmOsInfoV20260121Schema.nullable().optional(),
|
|
1295
1447
|
kms_type: KmsTypeSchema.nullable().optional(),
|
|
1296
1448
|
kms_info: CvmKmsInfoV20260121Schema.nullable().optional(),
|
|
1297
|
-
status:
|
|
1449
|
+
status: z10.string(),
|
|
1450
|
+
in_progress: z10.boolean().optional().default(false),
|
|
1298
1451
|
progress: CvmProgressInfoV20260121Schema.nullable().optional(),
|
|
1299
|
-
compose_hash:
|
|
1452
|
+
compose_hash: z10.string().nullable().optional(),
|
|
1453
|
+
docker_compose_hash: z10.string().nullable().optional(),
|
|
1454
|
+
pre_launch_script_hash: z10.string().nullable().optional(),
|
|
1300
1455
|
gateway: CvmGatewayInfoV20260121Schema,
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1456
|
+
logs: CvmLogUrlsV20260121Schema.optional().default({}),
|
|
1457
|
+
services: z10.array(z10.record(z10.any())).optional().default([]),
|
|
1458
|
+
endpoints: z10.array(CvmNetworkUrlsV20251028Schema).nullable().optional(),
|
|
1459
|
+
public_logs: z10.boolean().optional(),
|
|
1460
|
+
public_sysinfo: z10.boolean().optional(),
|
|
1461
|
+
public_tcbinfo: z10.boolean().optional(),
|
|
1462
|
+
gateway_enabled: z10.boolean().optional(),
|
|
1463
|
+
secure_time: z10.boolean().optional(),
|
|
1464
|
+
listed: z10.boolean().optional().default(false),
|
|
1465
|
+
storage_fs: z10.string().optional(),
|
|
1310
1466
|
workspace: WorkspaceRefSchema.nullable().optional(),
|
|
1311
|
-
creator: UserRefSchema.nullable().optional()
|
|
1467
|
+
creator: UserRefSchema.nullable().optional(),
|
|
1468
|
+
created_at: z10.string().nullable().optional(),
|
|
1469
|
+
deleted_at: z10.string().nullable().optional(),
|
|
1470
|
+
project_type: z10.string().nullable().optional()
|
|
1471
|
+
});
|
|
1472
|
+
var CvmInfoV20260522Schema = CvmInfoV20260121Schema.extend({
|
|
1473
|
+
id: z10.string()
|
|
1312
1474
|
});
|
|
1313
1475
|
var CvmInfoDetailV20260121Schema = CvmInfoV20260121Schema.extend({
|
|
1314
|
-
compose_file:
|
|
1476
|
+
compose_file: z10.union([z10.record(z10.any()), z10.string()]).nullable().optional()
|
|
1315
1477
|
});
|
|
1316
|
-
var
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1478
|
+
var CvmInfoDetailV20260522Schema = CvmInfoV20260522Schema.extend({
|
|
1479
|
+
compose_file: z10.union([z10.record(z10.any()), z10.string()]).nullable().optional()
|
|
1480
|
+
});
|
|
1481
|
+
var PaginatedCvmInfosV20260121Schema = z10.object({
|
|
1482
|
+
items: z10.array(CvmInfoV20260121Schema),
|
|
1483
|
+
total: z10.number(),
|
|
1484
|
+
page: z10.number(),
|
|
1485
|
+
page_size: z10.number(),
|
|
1486
|
+
pages: z10.number()
|
|
1487
|
+
});
|
|
1488
|
+
var PaginatedCvmInfosV20260522Schema = PaginatedCvmInfosV20260121Schema.extend({
|
|
1489
|
+
items: z10.array(CvmInfoV20260522Schema)
|
|
1322
1490
|
});
|
|
1323
1491
|
|
|
1324
1492
|
// src/types/cvm_id.ts
|
|
1325
|
-
import { z as
|
|
1493
|
+
import { z as z11 } from "zod";
|
|
1326
1494
|
|
|
1327
1495
|
// src/utils/hostname.ts
|
|
1328
1496
|
function isValidHostname(name) {
|
|
@@ -1380,20 +1548,20 @@ function generateDefaultCvmName(prefix = "dstack-app") {
|
|
|
1380
1548
|
}
|
|
1381
1549
|
|
|
1382
1550
|
// src/types/cvm_id.ts
|
|
1383
|
-
var CvmIdObjectSchema =
|
|
1551
|
+
var CvmIdObjectSchema = z11.object({
|
|
1384
1552
|
/** Direct CVM ID (any format) - accepts any string including names */
|
|
1385
|
-
id:
|
|
1553
|
+
id: z11.string().optional(),
|
|
1386
1554
|
/** UUID format (with or without dashes) */
|
|
1387
|
-
uuid:
|
|
1555
|
+
uuid: z11.string().regex(
|
|
1388
1556
|
/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i,
|
|
1389
1557
|
"Invalid UUID format"
|
|
1390
1558
|
).optional(),
|
|
1391
1559
|
/** App ID (40 characters, optionally prefixed with 'app_id_') */
|
|
1392
|
-
app_id:
|
|
1560
|
+
app_id: z11.string().optional(),
|
|
1393
1561
|
/** Instance ID (40 characters, optionally prefixed with 'instance_') */
|
|
1394
|
-
instance_id:
|
|
1562
|
+
instance_id: z11.string().optional(),
|
|
1395
1563
|
/** CVM name (RFC 1123 hostname format: 5-63 chars, starts with letter, alphanumeric + hyphens) */
|
|
1396
|
-
name:
|
|
1564
|
+
name: z11.string().refine(isValidHostname, {
|
|
1397
1565
|
message: "Name must be 5-63 characters, start with letter, and contain only letters/numbers/hyphens"
|
|
1398
1566
|
}).optional()
|
|
1399
1567
|
});
|
|
@@ -1437,13 +1605,15 @@ var CvmIdSchema = CvmIdBaseSchema.transform((data) => {
|
|
|
1437
1605
|
|
|
1438
1606
|
// src/actions/cvms/get_cvm_info.ts
|
|
1439
1607
|
var GetCvmInfoRequestSchema = CvmIdSchema;
|
|
1440
|
-
function
|
|
1441
|
-
|
|
1608
|
+
function getSchemaForVersion3(version) {
|
|
1609
|
+
if (version === "2025-10-28") return CvmDetailV20251028Schema;
|
|
1610
|
+
if (version === "2026-01-21") return CvmInfoDetailV20260121Schema;
|
|
1611
|
+
return CvmInfoDetailV20260522Schema;
|
|
1442
1612
|
}
|
|
1443
1613
|
async function getCvmInfo(client, request) {
|
|
1444
1614
|
const { cvmId } = GetCvmInfoRequestSchema.parse(request);
|
|
1445
1615
|
const response = await client.get(`/cvms/${cvmId}`);
|
|
1446
|
-
const schema =
|
|
1616
|
+
const schema = getSchemaForVersion3(client.config.version);
|
|
1447
1617
|
return schema.parse(response);
|
|
1448
1618
|
}
|
|
1449
1619
|
async function safeGetCvmInfo(client, request) {
|
|
@@ -1465,21 +1635,23 @@ async function safeGetCvmInfo(client, request) {
|
|
|
1465
1635
|
}
|
|
1466
1636
|
|
|
1467
1637
|
// src/actions/cvms/get_cvm_list.ts
|
|
1468
|
-
import { z as
|
|
1469
|
-
var GetCvmListRequestSchema =
|
|
1470
|
-
page:
|
|
1471
|
-
page_size:
|
|
1472
|
-
node_id:
|
|
1473
|
-
teepod_id:
|
|
1474
|
-
user_id:
|
|
1638
|
+
import { z as z12 } from "zod";
|
|
1639
|
+
var GetCvmListRequestSchema = z12.object({
|
|
1640
|
+
page: z12.number().int().min(1).optional(),
|
|
1641
|
+
page_size: z12.number().int().min(1).optional(),
|
|
1642
|
+
node_id: z12.number().int().min(1).optional(),
|
|
1643
|
+
teepod_id: z12.number().int().min(1).optional(),
|
|
1644
|
+
user_id: z12.string().optional()
|
|
1475
1645
|
}).strict();
|
|
1476
|
-
function
|
|
1477
|
-
|
|
1646
|
+
function getSchemaForVersion4(version) {
|
|
1647
|
+
if (version === "2025-10-28") return PaginatedCvmInfosV20251028Schema;
|
|
1648
|
+
if (version === "2026-01-21") return PaginatedCvmInfosV20260121Schema;
|
|
1649
|
+
return PaginatedCvmInfosV20260522Schema;
|
|
1478
1650
|
}
|
|
1479
1651
|
async function getCvmList(client, request) {
|
|
1480
1652
|
const validatedRequest = GetCvmListRequestSchema.parse(request ?? {});
|
|
1481
1653
|
const response = await client.get("/cvms/paginated", { params: validatedRequest });
|
|
1482
|
-
const schema =
|
|
1654
|
+
const schema = getSchemaForVersion4(client.config.version);
|
|
1483
1655
|
return schema.parse(response);
|
|
1484
1656
|
}
|
|
1485
1657
|
async function safeGetCvmList(client, request) {
|
|
@@ -1501,10 +1673,10 @@ async function safeGetCvmList(client, request) {
|
|
|
1501
1673
|
}
|
|
1502
1674
|
|
|
1503
1675
|
// src/actions/cvms/provision_cvm.ts
|
|
1504
|
-
import { z as
|
|
1676
|
+
import { z as z14 } from "zod";
|
|
1505
1677
|
|
|
1506
1678
|
// src/types/app_compose.ts
|
|
1507
|
-
import { z as
|
|
1679
|
+
import { z as z13 } from "zod";
|
|
1508
1680
|
var MAX_COMPOSE_PAYLOAD_BYTES = 200 * 1024;
|
|
1509
1681
|
function validateComposePayloadSize(dockerComposeFile, preLaunchScript, ctx) {
|
|
1510
1682
|
const encoder = new TextEncoder();
|
|
@@ -1515,43 +1687,52 @@ function validateComposePayloadSize(dockerComposeFile, preLaunchScript, ctx) {
|
|
|
1515
1687
|
const maxKB = MAX_COMPOSE_PAYLOAD_BYTES / 1024;
|
|
1516
1688
|
const currentKB = Math.ceil(totalSize / 1024);
|
|
1517
1689
|
ctx.addIssue({
|
|
1518
|
-
code:
|
|
1690
|
+
code: z13.ZodIssueCode.custom,
|
|
1519
1691
|
message: `Combined size of docker_compose_file and pre_launch_script must not exceed ${maxKB}KB (current: ${currentKB}KB)`
|
|
1520
1692
|
});
|
|
1521
1693
|
}
|
|
1522
1694
|
}
|
|
1523
|
-
var LooseAppComposeSchema =
|
|
1524
|
-
allowed_envs:
|
|
1525
|
-
docker_compose_file:
|
|
1526
|
-
features:
|
|
1527
|
-
name:
|
|
1528
|
-
manifest_version:
|
|
1529
|
-
kms_enabled:
|
|
1530
|
-
public_logs:
|
|
1531
|
-
public_sysinfo:
|
|
1532
|
-
tproxy_enabled:
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1695
|
+
var LooseAppComposeSchema = z13.object({
|
|
1696
|
+
allowed_envs: z13.array(z13.string()).optional(),
|
|
1697
|
+
docker_compose_file: z13.string(),
|
|
1698
|
+
features: z13.array(z13.string()).optional(),
|
|
1699
|
+
name: z13.string().optional(),
|
|
1700
|
+
manifest_version: z13.number().optional(),
|
|
1701
|
+
kms_enabled: z13.boolean().optional(),
|
|
1702
|
+
public_logs: z13.boolean().optional(),
|
|
1703
|
+
public_sysinfo: z13.boolean().optional(),
|
|
1704
|
+
tproxy_enabled: z13.boolean().optional(),
|
|
1705
|
+
port_policy: z13.object({
|
|
1706
|
+
ports: z13.array(
|
|
1707
|
+
z13.object({
|
|
1708
|
+
port: z13.number().int().min(1).max(65535),
|
|
1709
|
+
pp: z13.boolean()
|
|
1710
|
+
})
|
|
1711
|
+
),
|
|
1712
|
+
restrict_mode: z13.boolean()
|
|
1713
|
+
}).optional(),
|
|
1714
|
+
storage_fs: z13.enum(["ext4", "zfs"]).optional(),
|
|
1715
|
+
pre_launch_script: z13.string().optional(),
|
|
1716
|
+
env_pubkey: z13.string().optional(),
|
|
1717
|
+
salt: z13.string().optional().nullable()
|
|
1537
1718
|
}).passthrough().superRefine((data, ctx) => {
|
|
1538
1719
|
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1539
1720
|
});
|
|
1540
1721
|
|
|
1541
1722
|
// src/actions/cvms/provision_cvm.ts
|
|
1542
|
-
var ProvisionCvmSchema =
|
|
1543
|
-
app_id:
|
|
1544
|
-
app_env_encrypt_pubkey:
|
|
1545
|
-
compose_hash:
|
|
1723
|
+
var ProvisionCvmSchema = z14.object({
|
|
1724
|
+
app_id: z14.string().nullable().optional(),
|
|
1725
|
+
app_env_encrypt_pubkey: z14.string().nullable().optional(),
|
|
1726
|
+
compose_hash: z14.string(),
|
|
1546
1727
|
kms_info: KmsInfoSchema.nullable().optional(),
|
|
1547
|
-
fmspc:
|
|
1548
|
-
device_id:
|
|
1549
|
-
os_image_hash:
|
|
1550
|
-
instance_type:
|
|
1551
|
-
teepod_id:
|
|
1728
|
+
fmspc: z14.string().nullable().optional(),
|
|
1729
|
+
device_id: z14.string().nullable().optional(),
|
|
1730
|
+
os_image_hash: z14.string().nullable().optional(),
|
|
1731
|
+
instance_type: z14.string().nullable().optional(),
|
|
1732
|
+
teepod_id: z14.number().nullable().optional(),
|
|
1552
1733
|
// Will be transformed to node_id
|
|
1553
|
-
node_id:
|
|
1554
|
-
kms_id:
|
|
1734
|
+
node_id: z14.number().nullable().optional(),
|
|
1735
|
+
kms_id: z14.string().nullable().optional()
|
|
1555
1736
|
}).passthrough().transform((data) => {
|
|
1556
1737
|
if ("teepod_id" in data && data.teepod_id !== void 0) {
|
|
1557
1738
|
const { teepod_id, ...rest } = data;
|
|
@@ -1560,50 +1741,53 @@ var ProvisionCvmSchema = z13.object({
|
|
|
1560
1741
|
return data;
|
|
1561
1742
|
});
|
|
1562
1743
|
var NAME_VALIDATION_MESSAGE = "Name must be 5-63 characters, start with letter, and contain only letters/numbers/hyphens";
|
|
1563
|
-
var ProvisionCvmRequestSchema =
|
|
1564
|
-
node_id:
|
|
1744
|
+
var ProvisionCvmRequestSchema = z14.object({
|
|
1745
|
+
node_id: z14.number().optional(),
|
|
1565
1746
|
// recommended - optional, system auto-selects if not specified
|
|
1566
|
-
teepod_id:
|
|
1747
|
+
teepod_id: z14.number().optional(),
|
|
1567
1748
|
// deprecated, for compatibility
|
|
1568
|
-
region:
|
|
1749
|
+
region: z14.string().optional(),
|
|
1569
1750
|
// optional - region filter for auto-selection
|
|
1570
|
-
name:
|
|
1571
|
-
instance_type:
|
|
1751
|
+
name: z14.string().min(5, NAME_VALIDATION_MESSAGE).max(63, NAME_VALIDATION_MESSAGE).refine((val) => isValidHostname(val), NAME_VALIDATION_MESSAGE),
|
|
1752
|
+
instance_type: z14.string().optional(),
|
|
1572
1753
|
// optional, defaults to "tdx.small" when no resource params specified
|
|
1573
|
-
image:
|
|
1574
|
-
vcpu:
|
|
1754
|
+
image: z14.string().optional(),
|
|
1755
|
+
vcpu: z14.number().optional(),
|
|
1575
1756
|
// deprecated, use instance_type instead
|
|
1576
|
-
memory:
|
|
1757
|
+
memory: z14.number().optional(),
|
|
1577
1758
|
// deprecated, use instance_type instead
|
|
1578
|
-
disk_size:
|
|
1579
|
-
compose_file:
|
|
1580
|
-
allowed_envs:
|
|
1581
|
-
pre_launch_script:
|
|
1582
|
-
docker_compose_file:
|
|
1583
|
-
name:
|
|
1759
|
+
disk_size: z14.number().optional(),
|
|
1760
|
+
compose_file: z14.object({
|
|
1761
|
+
allowed_envs: z14.array(z14.string()).optional(),
|
|
1762
|
+
pre_launch_script: z14.string().optional(),
|
|
1763
|
+
docker_compose_file: z14.string().optional(),
|
|
1764
|
+
name: z14.string().optional().default(""),
|
|
1584
1765
|
// optional with default empty string
|
|
1585
|
-
kms_enabled:
|
|
1586
|
-
public_logs:
|
|
1587
|
-
public_sysinfo:
|
|
1588
|
-
gateway_enabled:
|
|
1766
|
+
kms_enabled: z14.boolean().optional(),
|
|
1767
|
+
public_logs: z14.boolean().optional(),
|
|
1768
|
+
public_sysinfo: z14.boolean().optional(),
|
|
1769
|
+
gateway_enabled: z14.boolean().optional(),
|
|
1589
1770
|
// recommended
|
|
1590
|
-
tproxy_enabled:
|
|
1771
|
+
tproxy_enabled: z14.boolean().optional(),
|
|
1591
1772
|
// deprecated, for compatibility
|
|
1592
|
-
storage_fs:
|
|
1593
|
-
}).superRefine((data, ctx) => {
|
|
1773
|
+
storage_fs: z14.enum(["ext4", "zfs"]).optional()
|
|
1774
|
+
}).passthrough().superRefine((data, ctx) => {
|
|
1594
1775
|
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1595
1776
|
}),
|
|
1596
|
-
listed:
|
|
1597
|
-
kms_id:
|
|
1598
|
-
kms:
|
|
1777
|
+
listed: z14.boolean().optional(),
|
|
1778
|
+
kms_id: z14.string().optional(),
|
|
1779
|
+
kms: z14.enum(["PHALA", "ETHEREUM", "BASE"]).optional(),
|
|
1599
1780
|
// KMS type selection (defaults to PHALA)
|
|
1600
|
-
kms_contract:
|
|
1781
|
+
kms_contract: z14.string().optional(),
|
|
1601
1782
|
// KMS contract address for on-chain KMS
|
|
1602
|
-
|
|
1783
|
+
kms_contract_id: z14.union([z14.string(), z14.number()]).optional(),
|
|
1784
|
+
key_provider_mode: z14.enum(["kms", "local"]).optional(),
|
|
1785
|
+
skip_gateway: z14.boolean().optional(),
|
|
1786
|
+
env_keys: z14.array(z14.string()).optional(),
|
|
1603
1787
|
// Manual nonce specification (Advanced - PHALA KMS only)
|
|
1604
|
-
nonce:
|
|
1788
|
+
nonce: z14.number().optional(),
|
|
1605
1789
|
// User-specified nonce for deterministic app_id generation
|
|
1606
|
-
app_id:
|
|
1790
|
+
app_id: z14.string().optional()
|
|
1607
1791
|
// Expected app_id (must match calculated app_id from nonce)
|
|
1608
1792
|
}).passthrough().transform((data) => {
|
|
1609
1793
|
if (!data.instance_type && !data.vcpu && !data.memory) {
|
|
@@ -1635,55 +1819,62 @@ function handleGatewayCompatibility(appCompose) {
|
|
|
1635
1819
|
var { action: provisionCvm, safeAction: safeProvisionCvm } = defineAction(ProvisionCvmSchema, async (client, appCompose) => {
|
|
1636
1820
|
const validated = ProvisionCvmRequestSchema.parse(appCompose);
|
|
1637
1821
|
const body = handleGatewayCompatibility(validated);
|
|
1638
|
-
|
|
1639
|
-
if (typeof body.node_id === "number") {
|
|
1640
|
-
requestBody = { ...body, teepod_id: body.node_id };
|
|
1641
|
-
delete requestBody.node_id;
|
|
1642
|
-
} else if (typeof body.teepod_id === "number") {
|
|
1822
|
+
if (typeof body.teepod_id === "number" && typeof body.node_id !== "number") {
|
|
1643
1823
|
console.warn("[phala/cloud] teepod_id is deprecated, please use node_id instead.");
|
|
1644
1824
|
}
|
|
1645
|
-
return await client.post("/cvms/provision",
|
|
1825
|
+
return await client.post("/cvms/provision", body);
|
|
1646
1826
|
});
|
|
1647
1827
|
|
|
1648
1828
|
// src/actions/cvms/commit_cvm_provision.ts
|
|
1649
|
-
import { z as
|
|
1650
|
-
var
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
name: z14.string()
|
|
1829
|
+
import { z as z15 } from "zod";
|
|
1830
|
+
var CommitCvmProvisionBaseSchema = z15.object({
|
|
1831
|
+
name: z15.string(),
|
|
1832
|
+
status: z15.string(),
|
|
1833
|
+
teepod_id: z15.number(),
|
|
1834
|
+
teepod: z15.object({
|
|
1835
|
+
id: z15.number(),
|
|
1836
|
+
name: z15.string()
|
|
1658
1837
|
}).nullable(),
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
instance_id: z14.string().nullable(),
|
|
1838
|
+
app_id: z15.string().nullable(),
|
|
1839
|
+
vm_uuid: z15.string().nullable(),
|
|
1840
|
+
instance_id: z15.string().nullable(),
|
|
1663
1841
|
// Deprecated fields - will be removed in next API version
|
|
1664
|
-
app_url:
|
|
1665
|
-
base_image:
|
|
1666
|
-
vcpu:
|
|
1667
|
-
memory:
|
|
1668
|
-
disk_size:
|
|
1669
|
-
manifest_version:
|
|
1670
|
-
version:
|
|
1671
|
-
runner:
|
|
1672
|
-
docker_compose_file:
|
|
1673
|
-
features:
|
|
1674
|
-
created_at:
|
|
1675
|
-
encrypted_env_pubkey:
|
|
1676
|
-
app_auth_contract_address:
|
|
1677
|
-
deployer_address:
|
|
1842
|
+
app_url: z15.string().nullable().default(null),
|
|
1843
|
+
base_image: z15.string().nullable(),
|
|
1844
|
+
vcpu: z15.number(),
|
|
1845
|
+
memory: z15.number(),
|
|
1846
|
+
disk_size: z15.number(),
|
|
1847
|
+
manifest_version: z15.number().nullable().default(2),
|
|
1848
|
+
version: z15.string().nullable().default("1.0.0"),
|
|
1849
|
+
runner: z15.string().nullable().default("docker-compose"),
|
|
1850
|
+
docker_compose_file: z15.string().nullable(),
|
|
1851
|
+
features: z15.array(z15.string()).nullable().default(["kms", "tproxy-net"]),
|
|
1852
|
+
created_at: z15.string(),
|
|
1853
|
+
encrypted_env_pubkey: z15.string().nullable().optional(),
|
|
1854
|
+
app_auth_contract_address: z15.string().nullable().optional(),
|
|
1855
|
+
deployer_address: z15.string().nullable().optional()
|
|
1678
1856
|
}).passthrough();
|
|
1679
|
-
var
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1857
|
+
var CommitCvmProvisionV20260121Schema = CommitCvmProvisionBaseSchema.extend({
|
|
1858
|
+
id: z15.number(),
|
|
1859
|
+
user_id: z15.number().nullable()
|
|
1860
|
+
});
|
|
1861
|
+
var CommitCvmProvisionV20260522Schema = CommitCvmProvisionBaseSchema.extend({
|
|
1862
|
+
id: z15.string(),
|
|
1863
|
+
user_id: z15.string().nullable()
|
|
1864
|
+
});
|
|
1865
|
+
var CommitCvmProvisionAnySchema = z15.union([
|
|
1866
|
+
CommitCvmProvisionV20260121Schema,
|
|
1867
|
+
CommitCvmProvisionV20260522Schema
|
|
1868
|
+
]);
|
|
1869
|
+
var CommitCvmProvisionSchema = CommitCvmProvisionV20260522Schema;
|
|
1870
|
+
var CommitCvmProvisionRequestSchema = z15.object({
|
|
1871
|
+
encrypted_env: z15.string().optional().nullable(),
|
|
1872
|
+
app_id: z15.string(),
|
|
1873
|
+
compose_hash: z15.string(),
|
|
1874
|
+
kms_id: z15.string().optional(),
|
|
1875
|
+
contract_address: z15.string().optional(),
|
|
1876
|
+
deployer_address: z15.string().optional(),
|
|
1877
|
+
env_keys: z15.array(z15.string()).optional().nullable()
|
|
1687
1878
|
}).passthrough();
|
|
1688
1879
|
var { action: commitCvmProvision, safeAction: safeCommitCvmProvision } = defineAction(CommitCvmProvisionSchema, async (client, payload) => {
|
|
1689
1880
|
return await client.post("/cvms", payload);
|
|
@@ -1749,20 +1940,20 @@ var { action: getCvmComposeFile, safeAction: safeGetCvmComposeFile } = defineAct
|
|
|
1749
1940
|
});
|
|
1750
1941
|
|
|
1751
1942
|
// src/actions/cvms/provision_cvm_compose_file_update.ts
|
|
1752
|
-
import { z as
|
|
1753
|
-
var ProvisionCvmComposeFileUpdateRequestSchema =
|
|
1754
|
-
id:
|
|
1755
|
-
uuid:
|
|
1756
|
-
app_id:
|
|
1943
|
+
import { z as z16 } from "zod";
|
|
1944
|
+
var ProvisionCvmComposeFileUpdateRequestSchema = z16.object({
|
|
1945
|
+
id: z16.string().optional(),
|
|
1946
|
+
uuid: z16.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
|
|
1947
|
+
app_id: z16.string().refine(
|
|
1757
1948
|
(val) => !val.startsWith("app_") && val.length === 40,
|
|
1758
1949
|
"app_id should be 40 characters without prefix"
|
|
1759
1950
|
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
1760
|
-
instance_id:
|
|
1951
|
+
instance_id: z16.string().refine(
|
|
1761
1952
|
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
1762
1953
|
"instance_id should be 40 characters without prefix"
|
|
1763
1954
|
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
1764
1955
|
app_compose: LooseAppComposeSchema,
|
|
1765
|
-
update_env_vars:
|
|
1956
|
+
update_env_vars: z16.boolean().optional().nullable()
|
|
1766
1957
|
}).refine(
|
|
1767
1958
|
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
1768
1959
|
"One of id, uuid, app_id, or instance_id must be provided"
|
|
@@ -1773,12 +1964,12 @@ var ProvisionCvmComposeFileUpdateRequestSchema = z15.object({
|
|
|
1773
1964
|
_raw: data
|
|
1774
1965
|
};
|
|
1775
1966
|
});
|
|
1776
|
-
var ProvisionCvmComposeFileUpdateResultSchema =
|
|
1777
|
-
app_id:
|
|
1778
|
-
device_id:
|
|
1779
|
-
compose_hash:
|
|
1967
|
+
var ProvisionCvmComposeFileUpdateResultSchema = z16.object({
|
|
1968
|
+
app_id: z16.string().nullable(),
|
|
1969
|
+
device_id: z16.string().nullable(),
|
|
1970
|
+
compose_hash: z16.string(),
|
|
1780
1971
|
kms_info: KmsInfoSchema.nullable().optional(),
|
|
1781
|
-
compose_hash_registered:
|
|
1972
|
+
compose_hash_registered: z16.boolean().optional().default(false)
|
|
1782
1973
|
}).passthrough();
|
|
1783
1974
|
var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmComposeFileUpdate } = defineAction(ProvisionCvmComposeFileUpdateResultSchema, async (client, request) => {
|
|
1784
1975
|
const validatedRequest = ProvisionCvmComposeFileUpdateRequestSchema.parse(request);
|
|
@@ -1789,22 +1980,22 @@ var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmCompose
|
|
|
1789
1980
|
});
|
|
1790
1981
|
|
|
1791
1982
|
// src/actions/cvms/commit_cvm_compose_file_update.ts
|
|
1792
|
-
import { z as
|
|
1793
|
-
var CommitCvmComposeFileUpdateRequestSchema =
|
|
1794
|
-
id:
|
|
1795
|
-
uuid:
|
|
1796
|
-
app_id:
|
|
1983
|
+
import { z as z17 } from "zod";
|
|
1984
|
+
var CommitCvmComposeFileUpdateRequestSchema = z17.object({
|
|
1985
|
+
id: z17.string().optional(),
|
|
1986
|
+
uuid: z17.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
|
|
1987
|
+
app_id: z17.string().refine(
|
|
1797
1988
|
(val) => !val.startsWith("app_") && val.length === 40,
|
|
1798
1989
|
"app_id should be 40 characters without prefix"
|
|
1799
1990
|
).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
|
|
1800
|
-
instance_id:
|
|
1991
|
+
instance_id: z17.string().refine(
|
|
1801
1992
|
(val) => !val.startsWith("instance_") && val.length === 40,
|
|
1802
1993
|
"instance_id should be 40 characters without prefix"
|
|
1803
1994
|
).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
|
|
1804
|
-
compose_hash:
|
|
1805
|
-
encrypted_env:
|
|
1806
|
-
env_keys:
|
|
1807
|
-
update_env_vars:
|
|
1995
|
+
compose_hash: z17.string().min(1, "Compose hash is required"),
|
|
1996
|
+
encrypted_env: z17.string().optional(),
|
|
1997
|
+
env_keys: z17.array(z17.string()).optional(),
|
|
1998
|
+
update_env_vars: z17.boolean().optional().nullable()
|
|
1808
1999
|
}).refine(
|
|
1809
2000
|
(data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
|
|
1810
2001
|
"One of id, uuid, app_id, or instance_id must be provided"
|
|
@@ -1816,7 +2007,7 @@ var CommitCvmComposeFileUpdateRequestSchema = z16.object({
|
|
|
1816
2007
|
update_env_vars: data.update_env_vars ?? void 0,
|
|
1817
2008
|
_raw: data
|
|
1818
2009
|
}));
|
|
1819
|
-
var CommitCvmComposeFileUpdateSchema =
|
|
2010
|
+
var CommitCvmComposeFileUpdateSchema = z17.any().transform(() => void 0);
|
|
1820
2011
|
var { action: commitCvmComposeFileUpdate, safeAction: safeCommitCvmComposeFileUpdate } = defineAction(
|
|
1821
2012
|
CommitCvmComposeFileUpdateSchema,
|
|
1822
2013
|
async (client, request) => {
|
|
@@ -1831,13 +2022,13 @@ var { action: commitCvmComposeFileUpdate, safeAction: safeCommitCvmComposeFileUp
|
|
|
1831
2022
|
);
|
|
1832
2023
|
|
|
1833
2024
|
// src/actions/cvms/update_cvm_envs.ts
|
|
1834
|
-
import { z as
|
|
2025
|
+
import { z as z18 } from "zod";
|
|
1835
2026
|
var UpdateCvmEnvsRequestSchema = refineCvmId(
|
|
1836
2027
|
CvmIdObjectSchema.extend({
|
|
1837
|
-
encrypted_env:
|
|
1838
|
-
env_keys:
|
|
1839
|
-
compose_hash:
|
|
1840
|
-
transaction_hash:
|
|
2028
|
+
encrypted_env: z18.string().describe("Encrypted environment variables (hex string)"),
|
|
2029
|
+
env_keys: z18.array(z18.string()).optional().describe("List of allowed environment variable keys"),
|
|
2030
|
+
compose_hash: z18.string().optional().describe("Compose hash for verification (Phase 2, required when env_keys changes)"),
|
|
2031
|
+
transaction_hash: z18.string().optional().describe(
|
|
1841
2032
|
"On-chain transaction hash for verification (Phase 2, required when env_keys changes)"
|
|
1842
2033
|
)
|
|
1843
2034
|
})
|
|
@@ -1854,21 +2045,21 @@ var UpdateCvmEnvsRequestSchema = refineCvmId(
|
|
|
1854
2045
|
_raw: data
|
|
1855
2046
|
};
|
|
1856
2047
|
});
|
|
1857
|
-
var UpdateCvmEnvsInProgressSchema =
|
|
1858
|
-
status:
|
|
1859
|
-
message:
|
|
1860
|
-
correlation_id:
|
|
1861
|
-
allowed_envs_changed:
|
|
1862
|
-
});
|
|
1863
|
-
var UpdateCvmEnvsPreconditionRequiredSchema =
|
|
1864
|
-
status:
|
|
1865
|
-
message:
|
|
1866
|
-
compose_hash:
|
|
1867
|
-
app_id:
|
|
1868
|
-
device_id:
|
|
2048
|
+
var UpdateCvmEnvsInProgressSchema = z18.object({
|
|
2049
|
+
status: z18.literal("in_progress"),
|
|
2050
|
+
message: z18.string(),
|
|
2051
|
+
correlation_id: z18.string(),
|
|
2052
|
+
allowed_envs_changed: z18.boolean()
|
|
2053
|
+
});
|
|
2054
|
+
var UpdateCvmEnvsPreconditionRequiredSchema = z18.object({
|
|
2055
|
+
status: z18.literal("precondition_required"),
|
|
2056
|
+
message: z18.string(),
|
|
2057
|
+
compose_hash: z18.string(),
|
|
2058
|
+
app_id: z18.string(),
|
|
2059
|
+
device_id: z18.string(),
|
|
1869
2060
|
kms_info: KmsInfoSchema
|
|
1870
2061
|
});
|
|
1871
|
-
var UpdateCvmEnvsResultSchema =
|
|
2062
|
+
var UpdateCvmEnvsResultSchema = z18.union([
|
|
1872
2063
|
UpdateCvmEnvsInProgressSchema,
|
|
1873
2064
|
UpdateCvmEnvsPreconditionRequiredSchema
|
|
1874
2065
|
]);
|
|
@@ -1910,12 +2101,12 @@ var { action: updateCvmEnvs, safeAction: safeUpdateCvmEnvs } = defineAction(Upda
|
|
|
1910
2101
|
});
|
|
1911
2102
|
|
|
1912
2103
|
// src/actions/cvms/update_docker_compose.ts
|
|
1913
|
-
import { z as
|
|
2104
|
+
import { z as z19 } from "zod";
|
|
1914
2105
|
var UpdateDockerComposeRequestSchema = refineCvmId(
|
|
1915
2106
|
CvmIdObjectSchema.extend({
|
|
1916
|
-
docker_compose_file:
|
|
1917
|
-
compose_hash:
|
|
1918
|
-
transaction_hash:
|
|
2107
|
+
docker_compose_file: z19.string().describe("Docker Compose YAML content"),
|
|
2108
|
+
compose_hash: z19.string().optional().describe("Compose hash for verification (Phase 2, contract-owned KMS only)"),
|
|
2109
|
+
transaction_hash: z19.string().optional().describe("On-chain transaction hash for verification (Phase 2, contract-owned KMS only)")
|
|
1919
2110
|
})
|
|
1920
2111
|
).transform((data) => {
|
|
1921
2112
|
const { cvmId } = CvmIdSchema.parse(data);
|
|
@@ -1929,20 +2120,20 @@ var UpdateDockerComposeRequestSchema = refineCvmId(
|
|
|
1929
2120
|
_raw: data
|
|
1930
2121
|
};
|
|
1931
2122
|
});
|
|
1932
|
-
var UpdateDockerComposeInProgressSchema =
|
|
1933
|
-
status:
|
|
1934
|
-
message:
|
|
1935
|
-
correlation_id:
|
|
2123
|
+
var UpdateDockerComposeInProgressSchema = z19.object({
|
|
2124
|
+
status: z19.literal("in_progress"),
|
|
2125
|
+
message: z19.string(),
|
|
2126
|
+
correlation_id: z19.string()
|
|
1936
2127
|
});
|
|
1937
|
-
var UpdateDockerComposePreconditionRequiredSchema =
|
|
1938
|
-
status:
|
|
1939
|
-
message:
|
|
1940
|
-
compose_hash:
|
|
1941
|
-
app_id:
|
|
1942
|
-
device_id:
|
|
2128
|
+
var UpdateDockerComposePreconditionRequiredSchema = z19.object({
|
|
2129
|
+
status: z19.literal("precondition_required"),
|
|
2130
|
+
message: z19.string(),
|
|
2131
|
+
compose_hash: z19.string(),
|
|
2132
|
+
app_id: z19.string(),
|
|
2133
|
+
device_id: z19.string(),
|
|
1943
2134
|
kms_info: KmsInfoSchema
|
|
1944
2135
|
});
|
|
1945
|
-
var UpdateDockerComposeResultSchema =
|
|
2136
|
+
var UpdateDockerComposeResultSchema = z19.union([
|
|
1946
2137
|
UpdateDockerComposeInProgressSchema,
|
|
1947
2138
|
UpdateDockerComposePreconditionRequiredSchema
|
|
1948
2139
|
]);
|
|
@@ -1994,12 +2185,12 @@ var { action: updateDockerCompose, safeAction: safeUpdateDockerCompose } = defin
|
|
|
1994
2185
|
});
|
|
1995
2186
|
|
|
1996
2187
|
// src/actions/cvms/update_prelaunch_script.ts
|
|
1997
|
-
import { z as
|
|
2188
|
+
import { z as z20 } from "zod";
|
|
1998
2189
|
var UpdatePreLaunchScriptRequestSchema = refineCvmId(
|
|
1999
2190
|
CvmIdObjectSchema.extend({
|
|
2000
|
-
pre_launch_script:
|
|
2001
|
-
compose_hash:
|
|
2002
|
-
transaction_hash:
|
|
2191
|
+
pre_launch_script: z20.string().describe("Pre-launch script content (shell script)"),
|
|
2192
|
+
compose_hash: z20.string().optional().describe("Compose hash for verification (Phase 2, contract-owned KMS only)"),
|
|
2193
|
+
transaction_hash: z20.string().optional().describe("On-chain transaction hash for verification (Phase 2, contract-owned KMS only)")
|
|
2003
2194
|
})
|
|
2004
2195
|
).transform((data) => {
|
|
2005
2196
|
const { cvmId } = CvmIdSchema.parse(data);
|
|
@@ -2013,20 +2204,20 @@ var UpdatePreLaunchScriptRequestSchema = refineCvmId(
|
|
|
2013
2204
|
_raw: data
|
|
2014
2205
|
};
|
|
2015
2206
|
});
|
|
2016
|
-
var UpdatePreLaunchScriptInProgressSchema =
|
|
2017
|
-
status:
|
|
2018
|
-
message:
|
|
2019
|
-
correlation_id:
|
|
2020
|
-
});
|
|
2021
|
-
var UpdatePreLaunchScriptPreconditionRequiredSchema =
|
|
2022
|
-
status:
|
|
2023
|
-
message:
|
|
2024
|
-
compose_hash:
|
|
2025
|
-
app_id:
|
|
2026
|
-
device_id:
|
|
2207
|
+
var UpdatePreLaunchScriptInProgressSchema = z20.object({
|
|
2208
|
+
status: z20.literal("in_progress"),
|
|
2209
|
+
message: z20.string(),
|
|
2210
|
+
correlation_id: z20.string()
|
|
2211
|
+
});
|
|
2212
|
+
var UpdatePreLaunchScriptPreconditionRequiredSchema = z20.object({
|
|
2213
|
+
status: z20.literal("precondition_required"),
|
|
2214
|
+
message: z20.string(),
|
|
2215
|
+
compose_hash: z20.string(),
|
|
2216
|
+
app_id: z20.string(),
|
|
2217
|
+
device_id: z20.string(),
|
|
2027
2218
|
kms_info: KmsInfoSchema
|
|
2028
2219
|
});
|
|
2029
|
-
var UpdatePreLaunchScriptResultSchema =
|
|
2220
|
+
var UpdatePreLaunchScriptResultSchema = z20.union([
|
|
2030
2221
|
UpdatePreLaunchScriptInProgressSchema,
|
|
2031
2222
|
UpdatePreLaunchScriptPreconditionRequiredSchema
|
|
2032
2223
|
]);
|
|
@@ -2078,17 +2269,115 @@ var { action: updatePreLaunchScript, safeAction: safeUpdatePreLaunchScript } = d
|
|
|
2078
2269
|
});
|
|
2079
2270
|
|
|
2080
2271
|
// src/actions/cvms/get_cvm_prelaunch_script.ts
|
|
2081
|
-
import { z as
|
|
2272
|
+
import { z as z21 } from "zod";
|
|
2082
2273
|
var GetCvmPreLaunchScriptRequestSchema = CvmIdSchema;
|
|
2083
|
-
var { action: getCvmPreLaunchScript, safeAction: safeGetCvmPreLaunchScript } = defineAction(
|
|
2274
|
+
var { action: getCvmPreLaunchScript, safeAction: safeGetCvmPreLaunchScript } = defineAction(z21.string(), async (client, request) => {
|
|
2084
2275
|
const { cvmId } = GetCvmPreLaunchScriptRequestSchema.parse(request);
|
|
2085
2276
|
return await client.get(`/cvms/${cvmId}/pre-launch-script`);
|
|
2086
2277
|
});
|
|
2087
2278
|
|
|
2279
|
+
// src/actions/cvms/get_prelaunch_script_upgrade_status.ts
|
|
2280
|
+
import { z as z22 } from "zod";
|
|
2281
|
+
var GetPreLaunchScriptUpgradeStatusRequestSchema = CvmIdSchema;
|
|
2282
|
+
var PreLaunchScriptUpgradeStatusSchema = z22.object({
|
|
2283
|
+
current_hash: z22.string().nullable(),
|
|
2284
|
+
latest_official_hash: z22.string(),
|
|
2285
|
+
is_official: z22.boolean(),
|
|
2286
|
+
is_latest: z22.boolean(),
|
|
2287
|
+
can_upgrade: z22.boolean()
|
|
2288
|
+
});
|
|
2289
|
+
var { action: getPreLaunchScriptUpgradeStatus, safeAction: safeGetPreLaunchScriptUpgradeStatus } = defineAction(
|
|
2290
|
+
PreLaunchScriptUpgradeStatusSchema,
|
|
2291
|
+
async (client, request) => {
|
|
2292
|
+
const { cvmId } = GetPreLaunchScriptUpgradeStatusRequestSchema.parse(request);
|
|
2293
|
+
return await client.get(`/cvms/${cvmId}/pre-launch-script/upgrade-status`);
|
|
2294
|
+
}
|
|
2295
|
+
);
|
|
2296
|
+
|
|
2297
|
+
// src/actions/cvms/upgrade_prelaunch_script.ts
|
|
2298
|
+
import { z as z23 } from "zod";
|
|
2299
|
+
var UpgradePreLaunchScriptRequestSchema = refineCvmId(
|
|
2300
|
+
CvmIdObjectSchema.extend({
|
|
2301
|
+
compose_hash: z23.string().optional().describe("Compose hash for verification (Phase 2, contract-owned KMS only)"),
|
|
2302
|
+
transaction_hash: z23.string().optional().describe("On-chain transaction hash for verification (Phase 2, contract-owned KMS only)")
|
|
2303
|
+
})
|
|
2304
|
+
).transform((data) => {
|
|
2305
|
+
const { cvmId } = CvmIdSchema.parse(data);
|
|
2306
|
+
return {
|
|
2307
|
+
cvmId,
|
|
2308
|
+
request: {
|
|
2309
|
+
compose_hash: data.compose_hash,
|
|
2310
|
+
transaction_hash: data.transaction_hash
|
|
2311
|
+
},
|
|
2312
|
+
_raw: data
|
|
2313
|
+
};
|
|
2314
|
+
});
|
|
2315
|
+
var UpgradePreLaunchScriptInProgressSchema = z23.object({
|
|
2316
|
+
status: z23.literal("in_progress"),
|
|
2317
|
+
message: z23.string(),
|
|
2318
|
+
correlation_id: z23.string()
|
|
2319
|
+
});
|
|
2320
|
+
var UpgradePreLaunchScriptPreconditionRequiredSchema = z23.object({
|
|
2321
|
+
status: z23.literal("precondition_required"),
|
|
2322
|
+
message: z23.string(),
|
|
2323
|
+
compose_hash: z23.string(),
|
|
2324
|
+
app_id: z23.string(),
|
|
2325
|
+
device_id: z23.string(),
|
|
2326
|
+
kms_info: KmsInfoSchema
|
|
2327
|
+
});
|
|
2328
|
+
var UpgradePreLaunchScriptResultSchema = z23.union([
|
|
2329
|
+
UpgradePreLaunchScriptInProgressSchema,
|
|
2330
|
+
UpgradePreLaunchScriptPreconditionRequiredSchema
|
|
2331
|
+
]);
|
|
2332
|
+
var { action: upgradePreLaunchScript, safeAction: safeUpgradePreLaunchScript } = defineAction(UpgradePreLaunchScriptResultSchema, async (client, request) => {
|
|
2333
|
+
const validated = UpgradePreLaunchScriptRequestSchema.parse(request);
|
|
2334
|
+
const headers = {};
|
|
2335
|
+
if (validated.request.compose_hash) {
|
|
2336
|
+
headers["X-Compose-Hash"] = validated.request.compose_hash;
|
|
2337
|
+
}
|
|
2338
|
+
if (validated.request.transaction_hash) {
|
|
2339
|
+
headers["X-Transaction-Hash"] = validated.request.transaction_hash;
|
|
2340
|
+
}
|
|
2341
|
+
try {
|
|
2342
|
+
const response = await client.post(
|
|
2343
|
+
`/cvms/${validated.cvmId}/pre-launch-script/upgrade-to-latest-official`,
|
|
2344
|
+
void 0,
|
|
2345
|
+
{ headers }
|
|
2346
|
+
);
|
|
2347
|
+
return response;
|
|
2348
|
+
} catch (error) {
|
|
2349
|
+
if (error instanceof PhalaCloudError && error.status === 465) {
|
|
2350
|
+
const detail = error.detail;
|
|
2351
|
+
if (detail && typeof detail === "object") {
|
|
2352
|
+
const detailObj = detail;
|
|
2353
|
+
const detailsArray = detailObj.details;
|
|
2354
|
+
if (detailsArray && Array.isArray(detailsArray)) {
|
|
2355
|
+
const fieldMap = new Map(detailsArray.map((d) => [d.field, d.value]));
|
|
2356
|
+
const composeHash = fieldMap.get("compose_hash");
|
|
2357
|
+
const appId = fieldMap.get("app_id");
|
|
2358
|
+
const deviceId = fieldMap.get("device_id");
|
|
2359
|
+
const kmsInfo = fieldMap.get("kms_info");
|
|
2360
|
+
if (composeHash && appId) {
|
|
2361
|
+
return {
|
|
2362
|
+
status: "precondition_required",
|
|
2363
|
+
message: detailObj.message || "Compose hash verification required",
|
|
2364
|
+
compose_hash: composeHash,
|
|
2365
|
+
app_id: appId,
|
|
2366
|
+
device_id: deviceId || "",
|
|
2367
|
+
kms_info: kmsInfo
|
|
2368
|
+
};
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
throw error;
|
|
2374
|
+
}
|
|
2375
|
+
});
|
|
2376
|
+
|
|
2088
2377
|
// src/actions/kms/get_kms_info.ts
|
|
2089
|
-
import { z as
|
|
2090
|
-
var GetKmsInfoRequestSchema =
|
|
2091
|
-
kms_id:
|
|
2378
|
+
import { z as z24 } from "zod";
|
|
2379
|
+
var GetKmsInfoRequestSchema = z24.object({
|
|
2380
|
+
kms_id: z24.string().min(1, "KMS ID is required")
|
|
2092
2381
|
});
|
|
2093
2382
|
var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSchema, async (client, request) => {
|
|
2094
2383
|
const validatedRequest = GetKmsInfoRequestSchema.parse(request);
|
|
@@ -2096,18 +2385,18 @@ var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSch
|
|
|
2096
2385
|
});
|
|
2097
2386
|
|
|
2098
2387
|
// src/actions/kms/get_kms_list.ts
|
|
2099
|
-
import { z as
|
|
2100
|
-
var GetKmsListRequestSchema =
|
|
2101
|
-
page:
|
|
2102
|
-
page_size:
|
|
2103
|
-
is_onchain:
|
|
2388
|
+
import { z as z25 } from "zod";
|
|
2389
|
+
var GetKmsListRequestSchema = z25.object({
|
|
2390
|
+
page: z25.number().int().min(1).optional(),
|
|
2391
|
+
page_size: z25.number().int().min(1).optional(),
|
|
2392
|
+
is_onchain: z25.boolean().optional()
|
|
2104
2393
|
}).strict();
|
|
2105
|
-
var GetKmsListSchema =
|
|
2106
|
-
items:
|
|
2107
|
-
total:
|
|
2108
|
-
page:
|
|
2109
|
-
page_size:
|
|
2110
|
-
pages:
|
|
2394
|
+
var GetKmsListSchema = z25.object({
|
|
2395
|
+
items: z25.array(KmsInfoSchema),
|
|
2396
|
+
total: z25.number(),
|
|
2397
|
+
page: z25.number(),
|
|
2398
|
+
page_size: z25.number(),
|
|
2399
|
+
pages: z25.number()
|
|
2111
2400
|
}).strict();
|
|
2112
2401
|
var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsListSchema, async (client, request) => {
|
|
2113
2402
|
const validatedRequest = GetKmsListRequestSchema.parse(request ?? {});
|
|
@@ -2115,17 +2404,17 @@ var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsList
|
|
|
2115
2404
|
});
|
|
2116
2405
|
|
|
2117
2406
|
// src/actions/kms/get_app_env_encrypt_pubkey.ts
|
|
2118
|
-
import { z as
|
|
2119
|
-
var GetAppEnvEncryptPubKeyRequestSchema =
|
|
2120
|
-
kms:
|
|
2121
|
-
app_id:
|
|
2407
|
+
import { z as z26 } from "zod";
|
|
2408
|
+
var GetAppEnvEncryptPubKeyRequestSchema = z26.object({
|
|
2409
|
+
kms: z26.string().min(1, "KMS ID or slug is required"),
|
|
2410
|
+
app_id: z26.string().refine(
|
|
2122
2411
|
(val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
|
|
2123
2412
|
"App ID must be exactly 40 characters or 42 characters with 0x prefix"
|
|
2124
2413
|
)
|
|
2125
2414
|
}).strict();
|
|
2126
|
-
var GetAppEnvEncryptPubKeySchema =
|
|
2127
|
-
public_key:
|
|
2128
|
-
signature:
|
|
2415
|
+
var GetAppEnvEncryptPubKeySchema = z26.object({
|
|
2416
|
+
public_key: z26.string(),
|
|
2417
|
+
signature: z26.string()
|
|
2129
2418
|
}).strict();
|
|
2130
2419
|
var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } = defineAction(GetAppEnvEncryptPubKeySchema, async (client, payload) => {
|
|
2131
2420
|
const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
|
|
@@ -2133,15 +2422,15 @@ var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } =
|
|
|
2133
2422
|
});
|
|
2134
2423
|
|
|
2135
2424
|
// src/actions/kms/next_app_ids.ts
|
|
2136
|
-
import { z as
|
|
2137
|
-
var NextAppIdsRequestSchema =
|
|
2138
|
-
counts:
|
|
2425
|
+
import { z as z27 } from "zod";
|
|
2426
|
+
var NextAppIdsRequestSchema = z27.object({
|
|
2427
|
+
counts: z27.number().int().min(1).max(20).optional().default(1)
|
|
2139
2428
|
}).strict();
|
|
2140
|
-
var NextAppIdsSchema =
|
|
2141
|
-
app_ids:
|
|
2142
|
-
|
|
2143
|
-
app_id:
|
|
2144
|
-
nonce:
|
|
2429
|
+
var NextAppIdsSchema = z27.object({
|
|
2430
|
+
app_ids: z27.array(
|
|
2431
|
+
z27.object({
|
|
2432
|
+
app_id: z27.string(),
|
|
2433
|
+
nonce: z27.number().int().min(0)
|
|
2145
2434
|
})
|
|
2146
2435
|
)
|
|
2147
2436
|
}).strict();
|
|
@@ -2153,34 +2442,46 @@ var { action: nextAppIds, safeAction: safeNextAppIds } = defineAction(NextAppIds
|
|
|
2153
2442
|
});
|
|
2154
2443
|
|
|
2155
2444
|
// src/types/cvm_info.ts
|
|
2156
|
-
import { z as
|
|
2157
|
-
var
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
region_identifier: z25.string().nullable().optional()
|
|
2445
|
+
import { z as z28 } from "zod";
|
|
2446
|
+
var VMBaseSchema = z28.object({
|
|
2447
|
+
name: z28.string(),
|
|
2448
|
+
status: z28.string(),
|
|
2449
|
+
teepod_id: z28.number(),
|
|
2450
|
+
teepod: z28.object({
|
|
2451
|
+
id: z28.number(),
|
|
2452
|
+
name: z28.string(),
|
|
2453
|
+
region_identifier: z28.string().nullable().optional()
|
|
2166
2454
|
}).optional().nullable(),
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2455
|
+
app_id: z28.string(),
|
|
2456
|
+
vm_uuid: z28.string().nullable(),
|
|
2457
|
+
instance_id: z28.string().nullable(),
|
|
2458
|
+
app_url: z28.string().optional().nullable(),
|
|
2459
|
+
base_image: z28.string().optional().nullable(),
|
|
2460
|
+
vcpu: z28.number(),
|
|
2461
|
+
memory: z28.number(),
|
|
2462
|
+
disk_size: z28.number(),
|
|
2463
|
+
manifest_version: z28.number().optional().nullable(),
|
|
2464
|
+
version: z28.string().optional().nullable(),
|
|
2465
|
+
runner: z28.string().optional().nullable(),
|
|
2466
|
+
docker_compose_file: z28.string().optional().nullable(),
|
|
2467
|
+
features: z28.array(z28.string()).optional().nullable(),
|
|
2468
|
+
created_at: z28.string(),
|
|
2469
|
+
encrypted_env_pubkey: z28.string().nullable()
|
|
2470
|
+
});
|
|
2471
|
+
var VMV20260121Schema = VMBaseSchema.extend({
|
|
2472
|
+
id: z28.number(),
|
|
2473
|
+
user_id: z28.number().optional().nullable()
|
|
2474
|
+
});
|
|
2475
|
+
var VMV20260522Schema = VMBaseSchema.extend({
|
|
2476
|
+
id: z28.string(),
|
|
2477
|
+
user_id: z28.string().optional().nullable()
|
|
2478
|
+
});
|
|
2479
|
+
var VMAnySchema = z28.union([VMV20260121Schema, VMV20260522Schema]);
|
|
2480
|
+
var VMSchema = VMV20260522Schema;
|
|
2481
|
+
function getVMSchemaForVersion(version) {
|
|
2482
|
+
if (version === "2026-01-21") return VMV20260121Schema;
|
|
2483
|
+
return VMV20260522Schema;
|
|
2484
|
+
}
|
|
2184
2485
|
|
|
2185
2486
|
// src/actions/cvms/start_cvm.ts
|
|
2186
2487
|
var StartCvmRequestSchema = CvmIdSchema;
|
|
@@ -2207,10 +2508,10 @@ var { action: shutdownCvm, safeAction: safeShutdownCvm } = defineAction(VMSchema
|
|
|
2207
2508
|
});
|
|
2208
2509
|
|
|
2209
2510
|
// src/actions/cvms/restart_cvm.ts
|
|
2210
|
-
import { z as
|
|
2511
|
+
import { z as z29 } from "zod";
|
|
2211
2512
|
var RestartCvmRequestSchema = refineCvmId(
|
|
2212
2513
|
CvmIdObjectSchema.extend({
|
|
2213
|
-
force:
|
|
2514
|
+
force: z29.boolean().optional()
|
|
2214
2515
|
})
|
|
2215
2516
|
);
|
|
2216
2517
|
var { action: restartCvm, safeAction: safeRestartCvm } = defineAction(VMSchema, async (client, request) => {
|
|
@@ -2221,10 +2522,10 @@ var { action: restartCvm, safeAction: safeRestartCvm } = defineAction(VMSchema,
|
|
|
2221
2522
|
});
|
|
2222
2523
|
|
|
2223
2524
|
// src/actions/cvms/delete_cvm.ts
|
|
2224
|
-
import { z as
|
|
2525
|
+
import { z as z30 } from "zod";
|
|
2225
2526
|
var DeleteCvmRequestSchema = CvmIdSchema;
|
|
2226
2527
|
var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
2227
|
-
|
|
2528
|
+
z30.void(),
|
|
2228
2529
|
async (client, request) => {
|
|
2229
2530
|
const { cvmId } = DeleteCvmRequestSchema.parse(request);
|
|
2230
2531
|
await client.delete(`/cvms/${cvmId}`);
|
|
@@ -2233,41 +2534,41 @@ var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
|
2233
2534
|
);
|
|
2234
2535
|
|
|
2235
2536
|
// src/actions/cvms/get_cvm_stats.ts
|
|
2236
|
-
import { z as
|
|
2237
|
-
var DiskInfoSchema =
|
|
2238
|
-
name:
|
|
2239
|
-
mount_point:
|
|
2240
|
-
total_size:
|
|
2241
|
-
free_size:
|
|
2242
|
-
});
|
|
2243
|
-
var SystemInfoSchema =
|
|
2244
|
-
os_name:
|
|
2245
|
-
os_version:
|
|
2246
|
-
kernel_version:
|
|
2247
|
-
cpu_model:
|
|
2248
|
-
num_cpus:
|
|
2249
|
-
total_memory:
|
|
2250
|
-
available_memory:
|
|
2251
|
-
used_memory:
|
|
2252
|
-
free_memory:
|
|
2253
|
-
total_swap:
|
|
2254
|
-
used_swap:
|
|
2255
|
-
free_swap:
|
|
2256
|
-
uptime:
|
|
2257
|
-
loadavg_one:
|
|
2258
|
-
loadavg_five:
|
|
2259
|
-
loadavg_fifteen:
|
|
2260
|
-
disks:
|
|
2261
|
-
});
|
|
2262
|
-
var CvmSystemInfoSchema =
|
|
2263
|
-
is_online:
|
|
2264
|
-
is_public:
|
|
2265
|
-
error:
|
|
2537
|
+
import { z as z31 } from "zod";
|
|
2538
|
+
var DiskInfoSchema = z31.object({
|
|
2539
|
+
name: z31.string(),
|
|
2540
|
+
mount_point: z31.string(),
|
|
2541
|
+
total_size: z31.number(),
|
|
2542
|
+
free_size: z31.number()
|
|
2543
|
+
});
|
|
2544
|
+
var SystemInfoSchema = z31.object({
|
|
2545
|
+
os_name: z31.string(),
|
|
2546
|
+
os_version: z31.string(),
|
|
2547
|
+
kernel_version: z31.string(),
|
|
2548
|
+
cpu_model: z31.string(),
|
|
2549
|
+
num_cpus: z31.number(),
|
|
2550
|
+
total_memory: z31.number(),
|
|
2551
|
+
available_memory: z31.number(),
|
|
2552
|
+
used_memory: z31.number(),
|
|
2553
|
+
free_memory: z31.number(),
|
|
2554
|
+
total_swap: z31.number(),
|
|
2555
|
+
used_swap: z31.number(),
|
|
2556
|
+
free_swap: z31.number(),
|
|
2557
|
+
uptime: z31.number(),
|
|
2558
|
+
loadavg_one: z31.number(),
|
|
2559
|
+
loadavg_five: z31.number(),
|
|
2560
|
+
loadavg_fifteen: z31.number(),
|
|
2561
|
+
disks: z31.array(DiskInfoSchema)
|
|
2562
|
+
});
|
|
2563
|
+
var CvmSystemInfoSchema = z31.object({
|
|
2564
|
+
is_online: z31.boolean(),
|
|
2565
|
+
is_public: z31.boolean().default(false),
|
|
2566
|
+
error: z31.string().nullable(),
|
|
2266
2567
|
sysinfo: SystemInfoSchema.nullable(),
|
|
2267
|
-
status:
|
|
2268
|
-
in_progress:
|
|
2269
|
-
boot_progress:
|
|
2270
|
-
boot_error:
|
|
2568
|
+
status: z31.string().nullable(),
|
|
2569
|
+
in_progress: z31.boolean().default(false),
|
|
2570
|
+
boot_progress: z31.string().nullable(),
|
|
2571
|
+
boot_error: z31.string().nullable()
|
|
2271
2572
|
});
|
|
2272
2573
|
var GetCvmStatsRequestSchema = CvmIdSchema;
|
|
2273
2574
|
var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSystemInfoSchema, async (client, request) => {
|
|
@@ -2276,18 +2577,18 @@ var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSyste
|
|
|
2276
2577
|
});
|
|
2277
2578
|
|
|
2278
2579
|
// src/actions/cvms/get_cvm_network.ts
|
|
2279
|
-
import { z as
|
|
2280
|
-
var CvmNetworkUrlsSchema =
|
|
2281
|
-
app:
|
|
2282
|
-
instance:
|
|
2283
|
-
});
|
|
2284
|
-
var CvmNetworkSchema =
|
|
2285
|
-
is_online:
|
|
2286
|
-
is_public:
|
|
2287
|
-
error:
|
|
2288
|
-
internal_ip:
|
|
2289
|
-
latest_handshake:
|
|
2290
|
-
public_urls:
|
|
2580
|
+
import { z as z32 } from "zod";
|
|
2581
|
+
var CvmNetworkUrlsSchema = z32.object({
|
|
2582
|
+
app: z32.string(),
|
|
2583
|
+
instance: z32.string()
|
|
2584
|
+
});
|
|
2585
|
+
var CvmNetworkSchema = z32.object({
|
|
2586
|
+
is_online: z32.boolean(),
|
|
2587
|
+
is_public: z32.boolean().default(true),
|
|
2588
|
+
error: z32.string().nullable(),
|
|
2589
|
+
internal_ip: z32.string().nullable(),
|
|
2590
|
+
latest_handshake: z32.string().nullable(),
|
|
2591
|
+
public_urls: z32.array(CvmNetworkUrlsSchema).nullable()
|
|
2291
2592
|
});
|
|
2292
2593
|
var GetCvmNetworkRequestSchema = CvmIdSchema;
|
|
2293
2594
|
var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmNetworkSchema, async (client, request) => {
|
|
@@ -2296,36 +2597,36 @@ var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmN
|
|
|
2296
2597
|
});
|
|
2297
2598
|
|
|
2298
2599
|
// src/actions/cvms/get_cvm_docker_compose.ts
|
|
2299
|
-
import { z as
|
|
2600
|
+
import { z as z33 } from "zod";
|
|
2300
2601
|
var GetCvmDockerComposeRequestSchema = CvmIdSchema;
|
|
2301
|
-
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(
|
|
2602
|
+
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(z33.string(), async (client, request) => {
|
|
2302
2603
|
const { cvmId } = GetCvmDockerComposeRequestSchema.parse(request);
|
|
2303
2604
|
return await client.get(`/cvms/${cvmId}/docker-compose.yml`);
|
|
2304
2605
|
});
|
|
2305
2606
|
|
|
2306
2607
|
// src/actions/cvms/get_cvm_containers_stats.ts
|
|
2307
|
-
import { z as
|
|
2308
|
-
var ContainerInfoSchema =
|
|
2309
|
-
id:
|
|
2310
|
-
names:
|
|
2311
|
-
image:
|
|
2312
|
-
image_id:
|
|
2313
|
-
command:
|
|
2314
|
-
created:
|
|
2315
|
-
state:
|
|
2316
|
-
status:
|
|
2317
|
-
log_endpoint:
|
|
2318
|
-
});
|
|
2319
|
-
var CvmContainersStatsSchema =
|
|
2320
|
-
is_online:
|
|
2321
|
-
is_public:
|
|
2322
|
-
error:
|
|
2323
|
-
docker_compose_file:
|
|
2324
|
-
manifest_version:
|
|
2325
|
-
version:
|
|
2326
|
-
runner:
|
|
2327
|
-
features:
|
|
2328
|
-
containers:
|
|
2608
|
+
import { z as z34 } from "zod";
|
|
2609
|
+
var ContainerInfoSchema = z34.object({
|
|
2610
|
+
id: z34.string(),
|
|
2611
|
+
names: z34.array(z34.string()),
|
|
2612
|
+
image: z34.string(),
|
|
2613
|
+
image_id: z34.string(),
|
|
2614
|
+
command: z34.string().nullable().optional(),
|
|
2615
|
+
created: z34.number(),
|
|
2616
|
+
state: z34.string(),
|
|
2617
|
+
status: z34.string(),
|
|
2618
|
+
log_endpoint: z34.string().nullable()
|
|
2619
|
+
});
|
|
2620
|
+
var CvmContainersStatsSchema = z34.object({
|
|
2621
|
+
is_online: z34.boolean(),
|
|
2622
|
+
is_public: z34.boolean().default(true),
|
|
2623
|
+
error: z34.string().nullable(),
|
|
2624
|
+
docker_compose_file: z34.string().nullable(),
|
|
2625
|
+
manifest_version: z34.number().nullable(),
|
|
2626
|
+
version: z34.string().nullable(),
|
|
2627
|
+
runner: z34.string().nullable(),
|
|
2628
|
+
features: z34.array(z34.string()).nullable(),
|
|
2629
|
+
containers: z34.array(ContainerInfoSchema).nullable()
|
|
2329
2630
|
});
|
|
2330
2631
|
var GetCvmContainersStatsRequestSchema = CvmIdSchema;
|
|
2331
2632
|
var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = defineAction(CvmContainersStatsSchema, async (client, request) => {
|
|
@@ -2334,62 +2635,62 @@ var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = d
|
|
|
2334
2635
|
});
|
|
2335
2636
|
|
|
2336
2637
|
// src/actions/cvms/get_cvm_attestation.ts
|
|
2337
|
-
import { z as
|
|
2338
|
-
var CertificateSubjectSchema =
|
|
2339
|
-
common_name:
|
|
2340
|
-
organization:
|
|
2341
|
-
country:
|
|
2342
|
-
state:
|
|
2343
|
-
locality:
|
|
2344
|
-
});
|
|
2345
|
-
var CertificateIssuerSchema =
|
|
2346
|
-
common_name:
|
|
2347
|
-
organization:
|
|
2348
|
-
country:
|
|
2349
|
-
});
|
|
2350
|
-
var CertificateSchema =
|
|
2638
|
+
import { z as z35 } from "zod";
|
|
2639
|
+
var CertificateSubjectSchema = z35.object({
|
|
2640
|
+
common_name: z35.string().nullable(),
|
|
2641
|
+
organization: z35.string().nullable(),
|
|
2642
|
+
country: z35.string().nullable(),
|
|
2643
|
+
state: z35.string().nullable(),
|
|
2644
|
+
locality: z35.string().nullable()
|
|
2645
|
+
});
|
|
2646
|
+
var CertificateIssuerSchema = z35.object({
|
|
2647
|
+
common_name: z35.string().nullable(),
|
|
2648
|
+
organization: z35.string().nullable(),
|
|
2649
|
+
country: z35.string().nullable()
|
|
2650
|
+
});
|
|
2651
|
+
var CertificateSchema = z35.object({
|
|
2351
2652
|
subject: CertificateSubjectSchema,
|
|
2352
2653
|
issuer: CertificateIssuerSchema,
|
|
2353
|
-
serial_number:
|
|
2354
|
-
not_before:
|
|
2654
|
+
serial_number: z35.string(),
|
|
2655
|
+
not_before: z35.string(),
|
|
2355
2656
|
// datetime serialized as ISO string
|
|
2356
|
-
not_after:
|
|
2657
|
+
not_after: z35.string(),
|
|
2357
2658
|
// datetime serialized as ISO string
|
|
2358
|
-
version:
|
|
2359
|
-
fingerprint:
|
|
2360
|
-
signature_algorithm:
|
|
2361
|
-
sans:
|
|
2362
|
-
is_ca:
|
|
2363
|
-
position_in_chain:
|
|
2364
|
-
quote:
|
|
2365
|
-
app_id:
|
|
2366
|
-
cert_usage:
|
|
2367
|
-
});
|
|
2368
|
-
var EventLogSchema =
|
|
2369
|
-
imr:
|
|
2370
|
-
event_type:
|
|
2371
|
-
digest:
|
|
2372
|
-
event:
|
|
2373
|
-
event_payload:
|
|
2374
|
-
});
|
|
2375
|
-
var TcbInfoSchema =
|
|
2376
|
-
mrtd:
|
|
2377
|
-
rootfs_hash:
|
|
2378
|
-
rtmr0:
|
|
2379
|
-
rtmr1:
|
|
2380
|
-
rtmr2:
|
|
2381
|
-
rtmr3:
|
|
2382
|
-
event_log:
|
|
2383
|
-
app_compose:
|
|
2384
|
-
});
|
|
2385
|
-
var CvmAttestationSchema =
|
|
2386
|
-
name:
|
|
2387
|
-
is_online:
|
|
2388
|
-
is_public:
|
|
2389
|
-
error:
|
|
2390
|
-
app_certificates:
|
|
2659
|
+
version: z35.string(),
|
|
2660
|
+
fingerprint: z35.string(),
|
|
2661
|
+
signature_algorithm: z35.string(),
|
|
2662
|
+
sans: z35.array(z35.string()).nullable(),
|
|
2663
|
+
is_ca: z35.boolean(),
|
|
2664
|
+
position_in_chain: z35.number().nullable(),
|
|
2665
|
+
quote: z35.string().nullable(),
|
|
2666
|
+
app_id: z35.string().nullable().optional(),
|
|
2667
|
+
cert_usage: z35.string().nullable().optional()
|
|
2668
|
+
});
|
|
2669
|
+
var EventLogSchema = z35.object({
|
|
2670
|
+
imr: z35.number(),
|
|
2671
|
+
event_type: z35.number(),
|
|
2672
|
+
digest: z35.string(),
|
|
2673
|
+
event: z35.string(),
|
|
2674
|
+
event_payload: z35.string()
|
|
2675
|
+
});
|
|
2676
|
+
var TcbInfoSchema = z35.object({
|
|
2677
|
+
mrtd: z35.string(),
|
|
2678
|
+
rootfs_hash: z35.string().nullable().optional(),
|
|
2679
|
+
rtmr0: z35.string(),
|
|
2680
|
+
rtmr1: z35.string(),
|
|
2681
|
+
rtmr2: z35.string(),
|
|
2682
|
+
rtmr3: z35.string(),
|
|
2683
|
+
event_log: z35.array(EventLogSchema),
|
|
2684
|
+
app_compose: z35.string()
|
|
2685
|
+
});
|
|
2686
|
+
var CvmAttestationSchema = z35.object({
|
|
2687
|
+
name: z35.string().nullable(),
|
|
2688
|
+
is_online: z35.boolean(),
|
|
2689
|
+
is_public: z35.boolean().default(true),
|
|
2690
|
+
error: z35.string().nullable(),
|
|
2691
|
+
app_certificates: z35.array(CertificateSchema).nullable(),
|
|
2391
2692
|
tcb_info: TcbInfoSchema.nullable(),
|
|
2392
|
-
compose_file:
|
|
2693
|
+
compose_file: z35.string().nullable()
|
|
2393
2694
|
});
|
|
2394
2695
|
var GetCvmAttestationRequestSchema = CvmIdSchema;
|
|
2395
2696
|
var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAction(CvmAttestationSchema, async (client, request) => {
|
|
@@ -2398,17 +2699,17 @@ var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAct
|
|
|
2398
2699
|
});
|
|
2399
2700
|
|
|
2400
2701
|
// src/actions/cvms/update_cvm_resources.ts
|
|
2401
|
-
import { z as
|
|
2702
|
+
import { z as z36 } from "zod";
|
|
2402
2703
|
var UpdateCvmResourcesRequestSchema = refineCvmId(
|
|
2403
2704
|
CvmIdObjectSchema.extend({
|
|
2404
|
-
vcpu:
|
|
2405
|
-
memory:
|
|
2406
|
-
disk_size:
|
|
2407
|
-
instance_type:
|
|
2408
|
-
allow_restart:
|
|
2705
|
+
vcpu: z36.number().optional(),
|
|
2706
|
+
memory: z36.number().optional(),
|
|
2707
|
+
disk_size: z36.number().optional(),
|
|
2708
|
+
instance_type: z36.string().optional(),
|
|
2709
|
+
allow_restart: z36.boolean().optional()
|
|
2409
2710
|
})
|
|
2410
2711
|
);
|
|
2411
|
-
var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(
|
|
2712
|
+
var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(z36.void(), async (client, request) => {
|
|
2412
2713
|
const parsed = UpdateCvmResourcesRequestSchema.parse(request);
|
|
2413
2714
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
2414
2715
|
const { ...body } = parsed;
|
|
@@ -2417,12 +2718,12 @@ var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineA
|
|
|
2417
2718
|
});
|
|
2418
2719
|
|
|
2419
2720
|
// src/actions/cvms/update_cvm_visibility.ts
|
|
2420
|
-
import { z as
|
|
2721
|
+
import { z as z37 } from "zod";
|
|
2421
2722
|
var UpdateCvmVisibilityRequestSchema = refineCvmId(
|
|
2422
2723
|
CvmIdObjectSchema.extend({
|
|
2423
|
-
public_sysinfo:
|
|
2424
|
-
public_logs:
|
|
2425
|
-
public_tcbinfo:
|
|
2724
|
+
public_sysinfo: z37.boolean(),
|
|
2725
|
+
public_logs: z37.boolean(),
|
|
2726
|
+
public_tcbinfo: z37.boolean().optional()
|
|
2426
2727
|
})
|
|
2427
2728
|
);
|
|
2428
2729
|
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(CvmDetailV20251028Schema, async (client, request) => {
|
|
@@ -2437,21 +2738,21 @@ var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defin
|
|
|
2437
2738
|
});
|
|
2438
2739
|
|
|
2439
2740
|
// src/actions/cvms/get_available_os_images.ts
|
|
2440
|
-
import { z as
|
|
2441
|
-
var OSImageVariantSchema =
|
|
2442
|
-
name:
|
|
2443
|
-
os_image_hash:
|
|
2444
|
-
is_current:
|
|
2445
|
-
});
|
|
2446
|
-
var
|
|
2447
|
-
version:
|
|
2448
|
-
|
|
2449
|
-
|
|
2741
|
+
import { z as z38 } from "zod";
|
|
2742
|
+
var OSImageVariantSchema = z38.object({
|
|
2743
|
+
name: z38.string(),
|
|
2744
|
+
os_image_hash: z38.string().nullable(),
|
|
2745
|
+
is_current: z38.boolean()
|
|
2746
|
+
});
|
|
2747
|
+
var AvailableOSImageSchema3 = z38.object({
|
|
2748
|
+
version: z38.union([
|
|
2749
|
+
z38.tuple([z38.number(), z38.number(), z38.number(), z38.number()]),
|
|
2750
|
+
z38.tuple([z38.number(), z38.number(), z38.number()])
|
|
2450
2751
|
]),
|
|
2451
2752
|
prod: OSImageVariantSchema.nullable(),
|
|
2452
2753
|
dev: OSImageVariantSchema.nullable()
|
|
2453
2754
|
});
|
|
2454
|
-
var GetAvailableOSImagesResponseSchema =
|
|
2755
|
+
var GetAvailableOSImagesResponseSchema = z38.array(AvailableOSImageSchema3);
|
|
2455
2756
|
var GetAvailableOSImagesRequestSchema = CvmIdSchema;
|
|
2456
2757
|
var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = defineAction(GetAvailableOSImagesResponseSchema, async (client, request) => {
|
|
2457
2758
|
const { cvmId } = GetAvailableOSImagesRequestSchema.parse(request);
|
|
@@ -2459,13 +2760,13 @@ var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = def
|
|
|
2459
2760
|
});
|
|
2460
2761
|
|
|
2461
2762
|
// src/actions/cvms/update_os_image.ts
|
|
2462
|
-
import { z as
|
|
2763
|
+
import { z as z39 } from "zod";
|
|
2463
2764
|
var UpdateOsImageRequestSchema = refineCvmId(
|
|
2464
2765
|
CvmIdObjectSchema.extend({
|
|
2465
|
-
os_image_name:
|
|
2766
|
+
os_image_name: z39.string().min(1, "OS image name is required")
|
|
2466
2767
|
})
|
|
2467
2768
|
);
|
|
2468
|
-
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(
|
|
2769
|
+
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z39.void(), async (client, request) => {
|
|
2469
2770
|
const parsed = UpdateOsImageRequestSchema.parse(request);
|
|
2470
2771
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
2471
2772
|
const { os_image_name } = parsed;
|
|
@@ -2474,17 +2775,17 @@ var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z36.
|
|
|
2474
2775
|
});
|
|
2475
2776
|
|
|
2476
2777
|
// src/actions/cvms/get_cvm_state.ts
|
|
2477
|
-
import { z as
|
|
2478
|
-
var CvmStateSchema =
|
|
2479
|
-
id:
|
|
2480
|
-
instance_id:
|
|
2481
|
-
name:
|
|
2482
|
-
status:
|
|
2483
|
-
uptime:
|
|
2484
|
-
exited_at:
|
|
2485
|
-
boot_progress:
|
|
2486
|
-
boot_error:
|
|
2487
|
-
shutdown_progress:
|
|
2778
|
+
import { z as z40 } from "zod";
|
|
2779
|
+
var CvmStateSchema = z40.object({
|
|
2780
|
+
id: z40.string().optional(),
|
|
2781
|
+
instance_id: z40.string().optional(),
|
|
2782
|
+
name: z40.string(),
|
|
2783
|
+
status: z40.string(),
|
|
2784
|
+
uptime: z40.string().optional(),
|
|
2785
|
+
exited_at: z40.string().optional(),
|
|
2786
|
+
boot_progress: z40.string().optional(),
|
|
2787
|
+
boot_error: z40.string().optional(),
|
|
2788
|
+
shutdown_progress: z40.string().optional()
|
|
2488
2789
|
});
|
|
2489
2790
|
var GetCvmStateRequestSchema = CvmIdSchema;
|
|
2490
2791
|
var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmStateSchema, async (client, request) => {
|
|
@@ -2493,21 +2794,21 @@ var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmState
|
|
|
2493
2794
|
});
|
|
2494
2795
|
|
|
2495
2796
|
// src/actions/ssh_keys/list_ssh_keys.ts
|
|
2496
|
-
import { z as
|
|
2497
|
-
var SshKeySchema =
|
|
2498
|
-
id:
|
|
2499
|
-
user_id:
|
|
2500
|
-
name:
|
|
2501
|
-
public_key:
|
|
2502
|
-
fingerprint:
|
|
2503
|
-
key_type:
|
|
2504
|
-
source:
|
|
2505
|
-
key_metadata:
|
|
2506
|
-
last_synced_at:
|
|
2507
|
-
created_at:
|
|
2508
|
-
updated_at:
|
|
2509
|
-
});
|
|
2510
|
-
var ListSshKeysResponseSchema =
|
|
2797
|
+
import { z as z41 } from "zod";
|
|
2798
|
+
var SshKeySchema = z41.object({
|
|
2799
|
+
id: z41.string(),
|
|
2800
|
+
user_id: z41.string(),
|
|
2801
|
+
name: z41.string(),
|
|
2802
|
+
public_key: z41.string(),
|
|
2803
|
+
fingerprint: z41.string(),
|
|
2804
|
+
key_type: z41.string(),
|
|
2805
|
+
source: z41.string(),
|
|
2806
|
+
key_metadata: z41.record(z41.unknown()).nullable().optional(),
|
|
2807
|
+
last_synced_at: z41.string().nullable().optional(),
|
|
2808
|
+
created_at: z41.string(),
|
|
2809
|
+
updated_at: z41.string()
|
|
2810
|
+
});
|
|
2811
|
+
var ListSshKeysResponseSchema = z41.array(SshKeySchema);
|
|
2511
2812
|
async function listSshKeys(client) {
|
|
2512
2813
|
const response = await client.get("/user/ssh-keys");
|
|
2513
2814
|
return ListSshKeysResponseSchema.parse(response);
|
|
@@ -2531,15 +2832,15 @@ async function safeListSshKeys(client) {
|
|
|
2531
2832
|
}
|
|
2532
2833
|
|
|
2533
2834
|
// src/actions/ssh_keys/import_github_profile.ts
|
|
2534
|
-
import { z as
|
|
2535
|
-
var ImportGithubProfileRequestSchema =
|
|
2536
|
-
github_username:
|
|
2835
|
+
import { z as z42 } from "zod";
|
|
2836
|
+
var ImportGithubProfileRequestSchema = z42.object({
|
|
2837
|
+
github_username: z42.string().min(1)
|
|
2537
2838
|
});
|
|
2538
|
-
var ImportGithubProfileResponseSchema =
|
|
2539
|
-
github_username:
|
|
2540
|
-
keys_added:
|
|
2541
|
-
keys_skipped:
|
|
2542
|
-
errors:
|
|
2839
|
+
var ImportGithubProfileResponseSchema = z42.object({
|
|
2840
|
+
github_username: z42.string(),
|
|
2841
|
+
keys_added: z42.number().int(),
|
|
2842
|
+
keys_skipped: z42.number().int(),
|
|
2843
|
+
errors: z42.array(z42.string()).default([])
|
|
2543
2844
|
});
|
|
2544
2845
|
var { action: importGithubProfileSshKeys, safeAction: safeImportGithubProfileSshKeys } = defineAction(
|
|
2545
2846
|
ImportGithubProfileResponseSchema,
|
|
@@ -2550,10 +2851,10 @@ var { action: importGithubProfileSshKeys, safeAction: safeImportGithubProfileSsh
|
|
|
2550
2851
|
);
|
|
2551
2852
|
|
|
2552
2853
|
// src/actions/ssh_keys/create_ssh_key.ts
|
|
2553
|
-
import { z as
|
|
2554
|
-
var CreateSshKeyRequestSchema =
|
|
2555
|
-
name:
|
|
2556
|
-
public_key:
|
|
2854
|
+
import { z as z43 } from "zod";
|
|
2855
|
+
var CreateSshKeyRequestSchema = z43.object({
|
|
2856
|
+
name: z43.string().min(1),
|
|
2857
|
+
public_key: z43.string().min(1)
|
|
2557
2858
|
});
|
|
2558
2859
|
var { action: createSshKey, safeAction: safeCreateSshKey } = defineAction(SshKeySchema, async (client, request) => {
|
|
2559
2860
|
const { name, public_key } = CreateSshKeyRequestSchema.parse(request);
|
|
@@ -2561,24 +2862,24 @@ var { action: createSshKey, safeAction: safeCreateSshKey } = defineAction(SshKey
|
|
|
2561
2862
|
});
|
|
2562
2863
|
|
|
2563
2864
|
// src/actions/ssh_keys/delete_ssh_key.ts
|
|
2564
|
-
import { z as
|
|
2565
|
-
var DeleteSshKeyRequestSchema =
|
|
2566
|
-
keyId:
|
|
2865
|
+
import { z as z44 } from "zod";
|
|
2866
|
+
var DeleteSshKeyRequestSchema = z44.object({
|
|
2867
|
+
keyId: z44.string().min(1)
|
|
2567
2868
|
});
|
|
2568
|
-
var { action: deleteSshKey, safeAction: safeDeleteSshKey } = defineAction(
|
|
2869
|
+
var { action: deleteSshKey, safeAction: safeDeleteSshKey } = defineAction(z44.void(), async (client, request) => {
|
|
2569
2870
|
const { keyId } = DeleteSshKeyRequestSchema.parse(request);
|
|
2570
2871
|
await client.delete(`/user/ssh-keys/${keyId}`);
|
|
2571
2872
|
return void 0;
|
|
2572
2873
|
});
|
|
2573
2874
|
|
|
2574
2875
|
// src/actions/ssh_keys/sync_github_ssh_keys.ts
|
|
2575
|
-
import { z as
|
|
2576
|
-
var SyncGithubSshKeysResponseSchema =
|
|
2577
|
-
synced_count:
|
|
2578
|
-
keys_added:
|
|
2579
|
-
keys_updated:
|
|
2580
|
-
keys_removed:
|
|
2581
|
-
errors:
|
|
2876
|
+
import { z as z45 } from "zod";
|
|
2877
|
+
var SyncGithubSshKeysResponseSchema = z45.object({
|
|
2878
|
+
synced_count: z45.number().int(),
|
|
2879
|
+
keys_added: z45.number().int(),
|
|
2880
|
+
keys_updated: z45.number().int(),
|
|
2881
|
+
keys_removed: z45.number().int(),
|
|
2882
|
+
errors: z45.array(z45.string()).default([])
|
|
2582
2883
|
});
|
|
2583
2884
|
var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSimpleAction(
|
|
2584
2885
|
SyncGithubSshKeysResponseSchema,
|
|
@@ -2588,26 +2889,26 @@ var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSim
|
|
|
2588
2889
|
);
|
|
2589
2890
|
|
|
2590
2891
|
// src/actions/os_images/get_os_images.ts
|
|
2591
|
-
import { z as
|
|
2592
|
-
var OSImagePublicSchema =
|
|
2593
|
-
name:
|
|
2594
|
-
slug:
|
|
2595
|
-
version:
|
|
2596
|
-
os_image_hash:
|
|
2597
|
-
is_dev:
|
|
2598
|
-
requires_gpu:
|
|
2892
|
+
import { z as z46 } from "zod";
|
|
2893
|
+
var OSImagePublicSchema = z46.object({
|
|
2894
|
+
name: z46.string(),
|
|
2895
|
+
slug: z46.string(),
|
|
2896
|
+
version: z46.string(),
|
|
2897
|
+
os_image_hash: z46.string().nullable(),
|
|
2898
|
+
is_dev: z46.boolean(),
|
|
2899
|
+
requires_gpu: z46.boolean()
|
|
2599
2900
|
}).passthrough();
|
|
2600
|
-
var GetOsImagesRequestSchema =
|
|
2601
|
-
page:
|
|
2602
|
-
page_size:
|
|
2603
|
-
is_dev:
|
|
2901
|
+
var GetOsImagesRequestSchema = z46.object({
|
|
2902
|
+
page: z46.number().int().min(1).optional(),
|
|
2903
|
+
page_size: z46.number().int().min(1).optional(),
|
|
2904
|
+
is_dev: z46.boolean().optional()
|
|
2604
2905
|
}).strict();
|
|
2605
|
-
var GetOsImagesResponseSchema =
|
|
2606
|
-
items:
|
|
2607
|
-
total:
|
|
2608
|
-
page:
|
|
2609
|
-
page_size:
|
|
2610
|
-
pages:
|
|
2906
|
+
var GetOsImagesResponseSchema = z46.object({
|
|
2907
|
+
items: z46.array(OSImagePublicSchema),
|
|
2908
|
+
total: z46.number(),
|
|
2909
|
+
page: z46.number(),
|
|
2910
|
+
page_size: z46.number(),
|
|
2911
|
+
pages: z46.number()
|
|
2611
2912
|
}).passthrough();
|
|
2612
2913
|
var { action: getOsImages, safeAction: safeGetOsImages } = defineAction(GetOsImagesResponseSchema, async (client, request) => {
|
|
2613
2914
|
const validatedRequest = GetOsImagesRequestSchema.parse(request ?? {});
|
|
@@ -2615,32 +2916,32 @@ var { action: getOsImages, safeAction: safeGetOsImages } = defineAction(GetOsIma
|
|
|
2615
2916
|
});
|
|
2616
2917
|
|
|
2617
2918
|
// src/actions/kms/get_kms_onchain_detail.ts
|
|
2618
|
-
import { z as
|
|
2619
|
-
var OnChainDeviceSchema =
|
|
2620
|
-
device_id:
|
|
2621
|
-
node_name:
|
|
2622
|
-
on_chain_allowed:
|
|
2919
|
+
import { z as z47 } from "zod";
|
|
2920
|
+
var OnChainDeviceSchema = z47.object({
|
|
2921
|
+
device_id: z47.string(),
|
|
2922
|
+
node_name: z47.string().nullable().optional(),
|
|
2923
|
+
on_chain_allowed: z47.boolean().nullable()
|
|
2623
2924
|
}).passthrough();
|
|
2624
|
-
var OnChainOsImageSchema =
|
|
2625
|
-
name:
|
|
2626
|
-
version:
|
|
2627
|
-
os_image_hash:
|
|
2628
|
-
on_chain_allowed:
|
|
2925
|
+
var OnChainOsImageSchema = z47.object({
|
|
2926
|
+
name: z47.string(),
|
|
2927
|
+
version: z47.string(),
|
|
2928
|
+
os_image_hash: z47.string().nullable(),
|
|
2929
|
+
on_chain_allowed: z47.boolean().nullable()
|
|
2629
2930
|
}).passthrough();
|
|
2630
|
-
var OnChainKmsContractSchema =
|
|
2631
|
-
contract_address:
|
|
2632
|
-
chain_id:
|
|
2633
|
-
chain_name:
|
|
2634
|
-
devices:
|
|
2635
|
-
os_images:
|
|
2931
|
+
var OnChainKmsContractSchema = z47.object({
|
|
2932
|
+
contract_address: z47.string(),
|
|
2933
|
+
chain_id: z47.number(),
|
|
2934
|
+
chain_name: z47.string(),
|
|
2935
|
+
devices: z47.array(OnChainDeviceSchema),
|
|
2936
|
+
os_images: z47.array(OnChainOsImageSchema)
|
|
2636
2937
|
}).passthrough();
|
|
2637
|
-
var GetKmsOnChainDetailResponseSchema =
|
|
2638
|
-
chain_name:
|
|
2639
|
-
chain_id:
|
|
2640
|
-
contracts:
|
|
2938
|
+
var GetKmsOnChainDetailResponseSchema = z47.object({
|
|
2939
|
+
chain_name: z47.string(),
|
|
2940
|
+
chain_id: z47.number(),
|
|
2941
|
+
contracts: z47.array(OnChainKmsContractSchema)
|
|
2641
2942
|
}).passthrough();
|
|
2642
|
-
var GetKmsOnChainDetailRequestSchema =
|
|
2643
|
-
chain:
|
|
2943
|
+
var GetKmsOnChainDetailRequestSchema = z47.object({
|
|
2944
|
+
chain: z47.string()
|
|
2644
2945
|
}).strict();
|
|
2645
2946
|
var { action: getKmsOnChainDetail, safeAction: safeGetKmsOnChainDetail } = defineAction(GetKmsOnChainDetailResponseSchema, async (client, request) => {
|
|
2646
2947
|
const { chain } = GetKmsOnChainDetailRequestSchema.parse(request);
|
|
@@ -2655,6 +2956,8 @@ function createClient2(config = {}) {
|
|
|
2655
2956
|
safeGetCurrentUser,
|
|
2656
2957
|
getAvailableNodes,
|
|
2657
2958
|
safeGetAvailableNodes,
|
|
2959
|
+
getCvmCreateResources,
|
|
2960
|
+
safeGetCvmCreateResources,
|
|
2658
2961
|
listAllInstanceTypeFamilies,
|
|
2659
2962
|
safeListAllInstanceTypeFamilies,
|
|
2660
2963
|
listFamilyInstanceTypes,
|
|
@@ -2685,6 +2988,10 @@ function createClient2(config = {}) {
|
|
|
2685
2988
|
safeUpdatePreLaunchScript,
|
|
2686
2989
|
getCvmPreLaunchScript,
|
|
2687
2990
|
safeGetCvmPreLaunchScript,
|
|
2991
|
+
getPreLaunchScriptUpgradeStatus,
|
|
2992
|
+
safeGetPreLaunchScriptUpgradeStatus,
|
|
2993
|
+
upgradePreLaunchScript,
|
|
2994
|
+
safeUpgradePreLaunchScript,
|
|
2688
2995
|
startCvm,
|
|
2689
2996
|
safeStartCvm,
|
|
2690
2997
|
stopCvm,
|
|
@@ -2742,161 +3049,139 @@ function createClient2(config = {}) {
|
|
|
2742
3049
|
}
|
|
2743
3050
|
|
|
2744
3051
|
// src/types/app_info_v20251028.ts
|
|
2745
|
-
import { z as
|
|
2746
|
-
var CvmBasicInfoV20251028Schema =
|
|
2747
|
-
vm_uuid:
|
|
2748
|
-
app_id:
|
|
2749
|
-
name:
|
|
2750
|
-
status:
|
|
2751
|
-
vcpu:
|
|
2752
|
-
memory:
|
|
2753
|
-
disk_size:
|
|
2754
|
-
teepod_id:
|
|
2755
|
-
teepod_name:
|
|
2756
|
-
region_identifier:
|
|
2757
|
-
kms_type:
|
|
2758
|
-
instance_type:
|
|
2759
|
-
listed:
|
|
2760
|
-
base_image:
|
|
2761
|
-
kms_slug:
|
|
2762
|
-
kms_id:
|
|
2763
|
-
instance_id:
|
|
3052
|
+
import { z as z48 } from "zod";
|
|
3053
|
+
var CvmBasicInfoV20251028Schema = z48.object({
|
|
3054
|
+
vm_uuid: z48.string().nullable(),
|
|
3055
|
+
app_id: z48.string(),
|
|
3056
|
+
name: z48.string().default(""),
|
|
3057
|
+
status: z48.string(),
|
|
3058
|
+
vcpu: z48.number().int(),
|
|
3059
|
+
memory: z48.number().int(),
|
|
3060
|
+
disk_size: z48.number().int(),
|
|
3061
|
+
teepod_id: z48.number().int(),
|
|
3062
|
+
teepod_name: z48.string(),
|
|
3063
|
+
region_identifier: z48.string().nullable().optional(),
|
|
3064
|
+
kms_type: z48.string().nullable().optional(),
|
|
3065
|
+
instance_type: z48.string().nullable().optional(),
|
|
3066
|
+
listed: z48.boolean().nullable().optional(),
|
|
3067
|
+
base_image: z48.string().nullable().optional(),
|
|
3068
|
+
kms_slug: z48.string().nullable().optional(),
|
|
3069
|
+
kms_id: z48.string().nullable().optional(),
|
|
3070
|
+
instance_id: z48.string().nullable().optional(),
|
|
2764
3071
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
2765
|
-
updated_at:
|
|
2766
|
-
});
|
|
2767
|
-
var AppProfileSchema =
|
|
2768
|
-
display_name:
|
|
2769
|
-
avatar_url:
|
|
2770
|
-
description:
|
|
2771
|
-
custom_domain:
|
|
2772
|
-
});
|
|
2773
|
-
var DstackAppFullResponseV20251028Schema =
|
|
2774
|
-
id:
|
|
2775
|
-
name:
|
|
2776
|
-
app_id:
|
|
2777
|
-
app_provision_type:
|
|
2778
|
-
app_icon_url:
|
|
2779
|
-
created_at:
|
|
2780
|
-
kms_type:
|
|
3072
|
+
updated_at: z48.string().nullable().optional()
|
|
3073
|
+
});
|
|
3074
|
+
var AppProfileSchema = z48.object({
|
|
3075
|
+
display_name: z48.string().nullable().optional(),
|
|
3076
|
+
avatar_url: z48.string().nullable().optional(),
|
|
3077
|
+
description: z48.string().nullable().optional(),
|
|
3078
|
+
custom_domain: z48.string().nullable().optional()
|
|
3079
|
+
});
|
|
3080
|
+
var DstackAppFullResponseV20251028Schema = z48.object({
|
|
3081
|
+
id: z48.string(),
|
|
3082
|
+
name: z48.string(),
|
|
3083
|
+
app_id: z48.string(),
|
|
3084
|
+
app_provision_type: z48.string().nullable().optional(),
|
|
3085
|
+
app_icon_url: z48.string().nullable().optional(),
|
|
3086
|
+
created_at: z48.string(),
|
|
3087
|
+
kms_type: z48.string(),
|
|
2781
3088
|
profile: AppProfileSchema.nullable().optional(),
|
|
2782
3089
|
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
2783
|
-
cvms:
|
|
2784
|
-
cvm_count:
|
|
2785
|
-
});
|
|
2786
|
-
var
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
kms_type: z45.null().optional(),
|
|
2794
|
-
current_cvm: z45.null().optional(),
|
|
2795
|
-
cvms: z45.null().optional(),
|
|
2796
|
-
cvm_count: z45.null().optional()
|
|
2797
|
-
});
|
|
2798
|
-
var DstackAppWithCvmResponseV20251028Schema = z45.union([
|
|
2799
|
-
DstackAppFullResponseV20251028Schema,
|
|
2800
|
-
DstackAppMinimalResponseV20251028Schema
|
|
2801
|
-
]);
|
|
2802
|
-
var DstackAppListResponseV20251028Schema = z45.object({
|
|
2803
|
-
dstack_apps: z45.array(DstackAppWithCvmResponseV20251028Schema),
|
|
2804
|
-
page: z45.number().int(),
|
|
2805
|
-
page_size: z45.number().int(),
|
|
2806
|
-
total: z45.number().int(),
|
|
2807
|
-
total_pages: z45.number().int()
|
|
3090
|
+
cvms: z48.array(CvmBasicInfoV20251028Schema).default([]),
|
|
3091
|
+
cvm_count: z48.number().int().default(0)
|
|
3092
|
+
});
|
|
3093
|
+
var DstackAppWithCvmResponseV20251028Schema = DstackAppFullResponseV20251028Schema;
|
|
3094
|
+
var DstackAppListResponseV20251028Schema = z48.object({
|
|
3095
|
+
dstack_apps: z48.array(DstackAppWithCvmResponseV20251028Schema),
|
|
3096
|
+
page: z48.number().int(),
|
|
3097
|
+
page_size: z48.number().int(),
|
|
3098
|
+
total: z48.number().int(),
|
|
3099
|
+
total_pages: z48.number().int()
|
|
2808
3100
|
});
|
|
2809
3101
|
|
|
2810
3102
|
// src/types/app_info_v20260121.ts
|
|
2811
|
-
import { z as
|
|
2812
|
-
var DstackAppFullResponseV20260121Schema =
|
|
2813
|
-
id:
|
|
2814
|
-
name:
|
|
2815
|
-
app_id:
|
|
2816
|
-
app_provision_type:
|
|
2817
|
-
app_icon_url:
|
|
2818
|
-
created_at:
|
|
2819
|
-
kms_type:
|
|
2820
|
-
profile:
|
|
2821
|
-
display_name:
|
|
2822
|
-
avatar_url:
|
|
2823
|
-
description:
|
|
2824
|
-
custom_domain:
|
|
3103
|
+
import { z as z49 } from "zod";
|
|
3104
|
+
var DstackAppFullResponseV20260121Schema = z49.object({
|
|
3105
|
+
id: z49.string(),
|
|
3106
|
+
name: z49.string(),
|
|
3107
|
+
app_id: z49.string(),
|
|
3108
|
+
app_provision_type: z49.string().nullable().optional(),
|
|
3109
|
+
app_icon_url: z49.string().nullable().optional(),
|
|
3110
|
+
created_at: z49.string(),
|
|
3111
|
+
kms_type: z49.string(),
|
|
3112
|
+
profile: z49.object({
|
|
3113
|
+
display_name: z49.string().nullable().optional(),
|
|
3114
|
+
avatar_url: z49.string().nullable().optional(),
|
|
3115
|
+
description: z49.string().nullable().optional(),
|
|
3116
|
+
custom_domain: z49.string().nullable().optional()
|
|
2825
3117
|
}).nullable().optional(),
|
|
2826
3118
|
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
2827
|
-
cvms:
|
|
2828
|
-
cvm_count:
|
|
2829
|
-
});
|
|
2830
|
-
var
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
]);
|
|
2846
|
-
var DstackAppListResponseV20260121Schema = z46.object({
|
|
2847
|
-
dstack_apps: z46.array(DstackAppWithCvmResponseV20260121Schema),
|
|
2848
|
-
page: z46.number().int(),
|
|
2849
|
-
page_size: z46.number().int(),
|
|
2850
|
-
total: z46.number().int(),
|
|
2851
|
-
total_pages: z46.number().int()
|
|
3119
|
+
cvms: z49.array(CvmInfoV20260121Schema).default([]),
|
|
3120
|
+
cvm_count: z49.number().int().default(0)
|
|
3121
|
+
});
|
|
3122
|
+
var DstackAppFullResponseV20260522Schema = DstackAppFullResponseV20260121Schema.extend({
|
|
3123
|
+
current_cvm: CvmInfoV20260522Schema.nullable().optional(),
|
|
3124
|
+
cvms: z49.array(CvmInfoV20260522Schema).default([])
|
|
3125
|
+
});
|
|
3126
|
+
var DstackAppWithCvmResponseV20260121Schema = DstackAppFullResponseV20260121Schema;
|
|
3127
|
+
var DstackAppWithCvmResponseV20260522Schema = DstackAppFullResponseV20260522Schema;
|
|
3128
|
+
var DstackAppListResponseV20260121Schema = z49.object({
|
|
3129
|
+
dstack_apps: z49.array(DstackAppWithCvmResponseV20260121Schema),
|
|
3130
|
+
page: z49.number().int(),
|
|
3131
|
+
page_size: z49.number().int(),
|
|
3132
|
+
total: z49.number().int(),
|
|
3133
|
+
total_pages: z49.number().int()
|
|
3134
|
+
});
|
|
3135
|
+
var DstackAppListResponseV20260522Schema = DstackAppListResponseV20260121Schema.extend({
|
|
3136
|
+
dstack_apps: z49.array(DstackAppWithCvmResponseV20260522Schema)
|
|
2852
3137
|
});
|
|
2853
3138
|
|
|
2854
3139
|
// src/types/app_revision.ts
|
|
2855
|
-
import { z as
|
|
2856
|
-
var CvmRefSchema =
|
|
2857
|
-
object_type:
|
|
2858
|
-
id:
|
|
2859
|
-
name:
|
|
2860
|
-
app_id:
|
|
2861
|
-
vm_uuid:
|
|
2862
|
-
});
|
|
2863
|
-
var AppRevisionResponseSchema =
|
|
2864
|
-
revision_id:
|
|
2865
|
-
app_id:
|
|
2866
|
-
vm_uuid:
|
|
2867
|
-
compose_hash:
|
|
2868
|
-
created_at:
|
|
2869
|
-
trace_id:
|
|
2870
|
-
operation_type:
|
|
3140
|
+
import { z as z50 } from "zod";
|
|
3141
|
+
var CvmRefSchema = z50.object({
|
|
3142
|
+
object_type: z50.literal("cvm"),
|
|
3143
|
+
id: z50.string().nullable().optional(),
|
|
3144
|
+
name: z50.string().nullable().optional(),
|
|
3145
|
+
app_id: z50.string().nullable().optional(),
|
|
3146
|
+
vm_uuid: z50.string().nullable().optional()
|
|
3147
|
+
});
|
|
3148
|
+
var AppRevisionResponseSchema = z50.object({
|
|
3149
|
+
revision_id: z50.string(),
|
|
3150
|
+
app_id: z50.string(),
|
|
3151
|
+
vm_uuid: z50.string(),
|
|
3152
|
+
compose_hash: z50.string(),
|
|
3153
|
+
created_at: z50.string(),
|
|
3154
|
+
trace_id: z50.string().nullable().optional(),
|
|
3155
|
+
operation_type: z50.string(),
|
|
2871
3156
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
2872
3157
|
cvm: CvmRefSchema.nullable().optional(),
|
|
2873
3158
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2874
3159
|
});
|
|
2875
|
-
var AppRevisionDetailResponseSchema =
|
|
2876
|
-
revision_id:
|
|
2877
|
-
app_id:
|
|
2878
|
-
vm_uuid:
|
|
2879
|
-
compose_hash:
|
|
2880
|
-
compose_file:
|
|
2881
|
-
encrypted_env:
|
|
2882
|
-
user_config:
|
|
2883
|
-
created_at:
|
|
2884
|
-
trace_id:
|
|
2885
|
-
operation_type:
|
|
3160
|
+
var AppRevisionDetailResponseSchema = z50.object({
|
|
3161
|
+
revision_id: z50.string(),
|
|
3162
|
+
app_id: z50.string(),
|
|
3163
|
+
vm_uuid: z50.string(),
|
|
3164
|
+
compose_hash: z50.string(),
|
|
3165
|
+
compose_file: z50.union([z50.record(z50.any()), z50.string()]).nullable().optional(),
|
|
3166
|
+
encrypted_env: z50.string(),
|
|
3167
|
+
user_config: z50.string(),
|
|
3168
|
+
created_at: z50.string(),
|
|
3169
|
+
trace_id: z50.string().nullable().optional(),
|
|
3170
|
+
operation_type: z50.string(),
|
|
2886
3171
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
2887
3172
|
cvm: CvmRefSchema.nullable().optional(),
|
|
2888
3173
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2889
3174
|
});
|
|
2890
|
-
var AppRevisionsResponseSchema =
|
|
2891
|
-
revisions:
|
|
2892
|
-
total:
|
|
2893
|
-
page:
|
|
2894
|
-
page_size:
|
|
2895
|
-
total_pages:
|
|
3175
|
+
var AppRevisionsResponseSchema = z50.object({
|
|
3176
|
+
revisions: z50.array(AppRevisionResponseSchema),
|
|
3177
|
+
total: z50.number().int(),
|
|
3178
|
+
page: z50.number().int(),
|
|
3179
|
+
page_size: z50.number().int(),
|
|
3180
|
+
total_pages: z50.number().int()
|
|
2896
3181
|
});
|
|
2897
3182
|
|
|
2898
3183
|
// src/actions/blockchains/deploy_app_auth.ts
|
|
2899
|
-
import { z as
|
|
3184
|
+
import { z as z51 } from "zod";
|
|
2900
3185
|
import {
|
|
2901
3186
|
createPublicClient as createPublicClient2,
|
|
2902
3187
|
createWalletClient as createWalletClient2,
|
|
@@ -3602,25 +3887,25 @@ var kmsAuthAbi = [
|
|
|
3602
3887
|
anonymous: false
|
|
3603
3888
|
}
|
|
3604
3889
|
];
|
|
3605
|
-
var DeployAppAuthRequestBaseSchema =
|
|
3890
|
+
var DeployAppAuthRequestBaseSchema = z51.object({
|
|
3606
3891
|
// Chain configuration (conditionally required)
|
|
3607
|
-
chain:
|
|
3608
|
-
rpcUrl:
|
|
3892
|
+
chain: z51.unknown().optional(),
|
|
3893
|
+
rpcUrl: z51.string().optional(),
|
|
3609
3894
|
// Contract configuration (required)
|
|
3610
|
-
kmsContractAddress:
|
|
3895
|
+
kmsContractAddress: z51.string(),
|
|
3611
3896
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
3612
|
-
privateKey:
|
|
3613
|
-
walletClient:
|
|
3897
|
+
privateKey: z51.string().optional(),
|
|
3898
|
+
walletClient: z51.unknown().optional(),
|
|
3614
3899
|
// Public client (optional, will create default if not provided)
|
|
3615
|
-
publicClient:
|
|
3900
|
+
publicClient: z51.unknown().optional(),
|
|
3616
3901
|
// App configuration (optional)
|
|
3617
|
-
allowAnyDevice:
|
|
3618
|
-
deviceId:
|
|
3619
|
-
composeHash:
|
|
3620
|
-
disableUpgrades:
|
|
3902
|
+
allowAnyDevice: z51.boolean().optional().default(false),
|
|
3903
|
+
deviceId: z51.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
3904
|
+
composeHash: z51.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
3905
|
+
disableUpgrades: z51.boolean().optional().default(false),
|
|
3621
3906
|
// Validation configuration (optional)
|
|
3622
|
-
skipPrerequisiteChecks:
|
|
3623
|
-
minBalance:
|
|
3907
|
+
skipPrerequisiteChecks: z51.boolean().optional().default(false),
|
|
3908
|
+
minBalance: z51.string().optional()
|
|
3624
3909
|
// ETH amount as string, e.g., "0.01"
|
|
3625
3910
|
}).passthrough();
|
|
3626
3911
|
var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
@@ -3648,13 +3933,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
|
3648
3933
|
path: ["chain"]
|
|
3649
3934
|
}
|
|
3650
3935
|
);
|
|
3651
|
-
var DeployAppAuthSchema =
|
|
3652
|
-
appId:
|
|
3653
|
-
appAuthAddress:
|
|
3654
|
-
deployer:
|
|
3655
|
-
transactionHash:
|
|
3656
|
-
blockNumber:
|
|
3657
|
-
gasUsed:
|
|
3936
|
+
var DeployAppAuthSchema = z51.object({
|
|
3937
|
+
appId: z51.string(),
|
|
3938
|
+
appAuthAddress: z51.string(),
|
|
3939
|
+
deployer: z51.string(),
|
|
3940
|
+
transactionHash: z51.string(),
|
|
3941
|
+
blockNumber: z51.bigint().optional(),
|
|
3942
|
+
gasUsed: z51.bigint().optional()
|
|
3658
3943
|
}).passthrough();
|
|
3659
3944
|
function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
|
|
3660
3945
|
try {
|
|
@@ -3900,7 +4185,7 @@ async function safeDeployAppAuth(request, parameters) {
|
|
|
3900
4185
|
}
|
|
3901
4186
|
|
|
3902
4187
|
// src/actions/blockchains/add_compose_hash.ts
|
|
3903
|
-
import { z as
|
|
4188
|
+
import { z as z52 } from "zod";
|
|
3904
4189
|
import {
|
|
3905
4190
|
createPublicClient as createPublicClient3,
|
|
3906
4191
|
createWalletClient as createWalletClient3,
|
|
@@ -3924,29 +4209,29 @@ var appAuthAbi = [
|
|
|
3924
4209
|
anonymous: false
|
|
3925
4210
|
}
|
|
3926
4211
|
];
|
|
3927
|
-
var AddComposeHashRequestSchema =
|
|
4212
|
+
var AddComposeHashRequestSchema = z52.object({
|
|
3928
4213
|
// Chain configuration (conditionally required)
|
|
3929
|
-
chain:
|
|
3930
|
-
rpcUrl:
|
|
3931
|
-
appId:
|
|
3932
|
-
composeHash:
|
|
4214
|
+
chain: z52.unknown().optional(),
|
|
4215
|
+
rpcUrl: z52.string().optional(),
|
|
4216
|
+
appId: z52.string(),
|
|
4217
|
+
composeHash: z52.string(),
|
|
3933
4218
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
3934
|
-
privateKey:
|
|
3935
|
-
walletClient:
|
|
4219
|
+
privateKey: z52.string().optional(),
|
|
4220
|
+
walletClient: z52.unknown().optional(),
|
|
3936
4221
|
// Public client (optional, will create default if not provided)
|
|
3937
|
-
publicClient:
|
|
4222
|
+
publicClient: z52.unknown().optional(),
|
|
3938
4223
|
// Validation configuration (optional)
|
|
3939
|
-
skipPrerequisiteChecks:
|
|
3940
|
-
minBalance:
|
|
4224
|
+
skipPrerequisiteChecks: z52.boolean().optional().default(false),
|
|
4225
|
+
minBalance: z52.string().optional(),
|
|
3941
4226
|
// ETH amount as string, e.g., "0.01"
|
|
3942
4227
|
// Transaction control options
|
|
3943
|
-
timeout:
|
|
3944
|
-
retryOptions:
|
|
3945
|
-
signal:
|
|
4228
|
+
timeout: z52.number().optional().default(12e4),
|
|
4229
|
+
retryOptions: z52.unknown().optional(),
|
|
4230
|
+
signal: z52.unknown().optional(),
|
|
3946
4231
|
// Progress callbacks
|
|
3947
|
-
onTransactionStateChange:
|
|
3948
|
-
onTransactionSubmitted:
|
|
3949
|
-
onTransactionConfirmed:
|
|
4232
|
+
onTransactionStateChange: z52.function().optional(),
|
|
4233
|
+
onTransactionSubmitted: z52.function().optional(),
|
|
4234
|
+
onTransactionConfirmed: z52.function().optional()
|
|
3950
4235
|
}).passthrough().refine(
|
|
3951
4236
|
(data) => {
|
|
3952
4237
|
const hasPrivateKey = !!data.privateKey;
|
|
@@ -3970,12 +4255,12 @@ var AddComposeHashRequestSchema = z49.object({
|
|
|
3970
4255
|
path: ["chain"]
|
|
3971
4256
|
}
|
|
3972
4257
|
);
|
|
3973
|
-
var AddComposeHashSchema =
|
|
3974
|
-
composeHash:
|
|
3975
|
-
appId:
|
|
3976
|
-
transactionHash:
|
|
3977
|
-
blockNumber:
|
|
3978
|
-
gasUsed:
|
|
4258
|
+
var AddComposeHashSchema = z52.object({
|
|
4259
|
+
composeHash: z52.string(),
|
|
4260
|
+
appId: z52.string(),
|
|
4261
|
+
transactionHash: z52.string(),
|
|
4262
|
+
blockNumber: z52.bigint().optional(),
|
|
4263
|
+
gasUsed: z52.bigint().optional()
|
|
3979
4264
|
}).passthrough();
|
|
3980
4265
|
function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
|
|
3981
4266
|
console.log(receipt.logs);
|
|
@@ -4185,7 +4470,7 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
4185
4470
|
}
|
|
4186
4471
|
|
|
4187
4472
|
// src/actions/blockchains/add_device.ts
|
|
4188
|
-
import { z as
|
|
4473
|
+
import { z as z53 } from "zod";
|
|
4189
4474
|
import {
|
|
4190
4475
|
createPublicClient as createPublicClient4,
|
|
4191
4476
|
createWalletClient as createWalletClient4,
|
|
@@ -4280,22 +4565,22 @@ var dstackAppAbi = [
|
|
|
4280
4565
|
];
|
|
4281
4566
|
|
|
4282
4567
|
// src/actions/blockchains/add_device.ts
|
|
4283
|
-
var AddDeviceRequestSchema =
|
|
4284
|
-
chain:
|
|
4285
|
-
rpcUrl:
|
|
4286
|
-
appAddress:
|
|
4287
|
-
deviceId:
|
|
4288
|
-
privateKey:
|
|
4289
|
-
walletClient:
|
|
4290
|
-
publicClient:
|
|
4291
|
-
skipPrerequisiteChecks:
|
|
4292
|
-
minBalance:
|
|
4293
|
-
timeout:
|
|
4294
|
-
retryOptions:
|
|
4295
|
-
signal:
|
|
4296
|
-
onTransactionStateChange:
|
|
4297
|
-
onTransactionSubmitted:
|
|
4298
|
-
onTransactionConfirmed:
|
|
4568
|
+
var AddDeviceRequestSchema = z53.object({
|
|
4569
|
+
chain: z53.unknown().optional(),
|
|
4570
|
+
rpcUrl: z53.string().optional(),
|
|
4571
|
+
appAddress: z53.string(),
|
|
4572
|
+
deviceId: z53.string(),
|
|
4573
|
+
privateKey: z53.string().optional(),
|
|
4574
|
+
walletClient: z53.unknown().optional(),
|
|
4575
|
+
publicClient: z53.unknown().optional(),
|
|
4576
|
+
skipPrerequisiteChecks: z53.boolean().optional().default(false),
|
|
4577
|
+
minBalance: z53.string().optional(),
|
|
4578
|
+
timeout: z53.number().optional().default(12e4),
|
|
4579
|
+
retryOptions: z53.unknown().optional(),
|
|
4580
|
+
signal: z53.unknown().optional(),
|
|
4581
|
+
onTransactionStateChange: z53.function().optional(),
|
|
4582
|
+
onTransactionSubmitted: z53.function().optional(),
|
|
4583
|
+
onTransactionConfirmed: z53.function().optional()
|
|
4299
4584
|
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4300
4585
|
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4301
4586
|
path: ["privateKey", "walletClient"]
|
|
@@ -4309,12 +4594,12 @@ var AddDeviceRequestSchema = z50.object({
|
|
|
4309
4594
|
path: ["chain"]
|
|
4310
4595
|
}
|
|
4311
4596
|
);
|
|
4312
|
-
var AddDeviceSchema =
|
|
4313
|
-
appAddress:
|
|
4314
|
-
deviceId:
|
|
4315
|
-
transactionHash:
|
|
4316
|
-
blockNumber:
|
|
4317
|
-
gasUsed:
|
|
4597
|
+
var AddDeviceSchema = z53.object({
|
|
4598
|
+
appAddress: z53.string(),
|
|
4599
|
+
deviceId: z53.string(),
|
|
4600
|
+
transactionHash: z53.string(),
|
|
4601
|
+
blockNumber: z53.bigint().optional(),
|
|
4602
|
+
gasUsed: z53.bigint().optional()
|
|
4318
4603
|
}).passthrough();
|
|
4319
4604
|
async function addDevice(request, parameters) {
|
|
4320
4605
|
const validatedRequest = AddDeviceRequestSchema.parse(request);
|
|
@@ -4462,7 +4747,7 @@ async function safeAddDevice(request, parameters) {
|
|
|
4462
4747
|
}
|
|
4463
4748
|
|
|
4464
4749
|
// src/actions/blockchains/remove_device.ts
|
|
4465
|
-
import { z as
|
|
4750
|
+
import { z as z54 } from "zod";
|
|
4466
4751
|
import {
|
|
4467
4752
|
createPublicClient as createPublicClient5,
|
|
4468
4753
|
createWalletClient as createWalletClient5,
|
|
@@ -4470,22 +4755,22 @@ import {
|
|
|
4470
4755
|
parseEther as parseEther4
|
|
4471
4756
|
} from "viem";
|
|
4472
4757
|
import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
|
|
4473
|
-
var RemoveDeviceRequestSchema =
|
|
4474
|
-
chain:
|
|
4475
|
-
rpcUrl:
|
|
4476
|
-
appAddress:
|
|
4477
|
-
deviceId:
|
|
4478
|
-
privateKey:
|
|
4479
|
-
walletClient:
|
|
4480
|
-
publicClient:
|
|
4481
|
-
skipPrerequisiteChecks:
|
|
4482
|
-
minBalance:
|
|
4483
|
-
timeout:
|
|
4484
|
-
retryOptions:
|
|
4485
|
-
signal:
|
|
4486
|
-
onTransactionStateChange:
|
|
4487
|
-
onTransactionSubmitted:
|
|
4488
|
-
onTransactionConfirmed:
|
|
4758
|
+
var RemoveDeviceRequestSchema = z54.object({
|
|
4759
|
+
chain: z54.unknown().optional(),
|
|
4760
|
+
rpcUrl: z54.string().optional(),
|
|
4761
|
+
appAddress: z54.string(),
|
|
4762
|
+
deviceId: z54.string(),
|
|
4763
|
+
privateKey: z54.string().optional(),
|
|
4764
|
+
walletClient: z54.unknown().optional(),
|
|
4765
|
+
publicClient: z54.unknown().optional(),
|
|
4766
|
+
skipPrerequisiteChecks: z54.boolean().optional().default(false),
|
|
4767
|
+
minBalance: z54.string().optional(),
|
|
4768
|
+
timeout: z54.number().optional().default(12e4),
|
|
4769
|
+
retryOptions: z54.unknown().optional(),
|
|
4770
|
+
signal: z54.unknown().optional(),
|
|
4771
|
+
onTransactionStateChange: z54.function().optional(),
|
|
4772
|
+
onTransactionSubmitted: z54.function().optional(),
|
|
4773
|
+
onTransactionConfirmed: z54.function().optional()
|
|
4489
4774
|
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4490
4775
|
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4491
4776
|
path: ["privateKey", "walletClient"]
|
|
@@ -4499,12 +4784,12 @@ var RemoveDeviceRequestSchema = z51.object({
|
|
|
4499
4784
|
path: ["chain"]
|
|
4500
4785
|
}
|
|
4501
4786
|
);
|
|
4502
|
-
var RemoveDeviceSchema =
|
|
4503
|
-
appAddress:
|
|
4504
|
-
deviceId:
|
|
4505
|
-
transactionHash:
|
|
4506
|
-
blockNumber:
|
|
4507
|
-
gasUsed:
|
|
4787
|
+
var RemoveDeviceSchema = z54.object({
|
|
4788
|
+
appAddress: z54.string(),
|
|
4789
|
+
deviceId: z54.string(),
|
|
4790
|
+
transactionHash: z54.string(),
|
|
4791
|
+
blockNumber: z54.bigint().optional(),
|
|
4792
|
+
gasUsed: z54.bigint().optional()
|
|
4508
4793
|
}).passthrough();
|
|
4509
4794
|
async function removeDevice(request, parameters) {
|
|
4510
4795
|
const validatedRequest = RemoveDeviceRequestSchema.parse(request);
|
|
@@ -4642,7 +4927,7 @@ async function safeRemoveDevice(request, parameters) {
|
|
|
4642
4927
|
}
|
|
4643
4928
|
|
|
4644
4929
|
// src/actions/blockchains/set_allow_any_device.ts
|
|
4645
|
-
import { z as
|
|
4930
|
+
import { z as z55 } from "zod";
|
|
4646
4931
|
import {
|
|
4647
4932
|
createPublicClient as createPublicClient6,
|
|
4648
4933
|
createWalletClient as createWalletClient6,
|
|
@@ -4650,22 +4935,22 @@ import {
|
|
|
4650
4935
|
parseEther as parseEther5
|
|
4651
4936
|
} from "viem";
|
|
4652
4937
|
import { privateKeyToAccount as privateKeyToAccount6 } from "viem/accounts";
|
|
4653
|
-
var SetAllowAnyDeviceRequestSchema =
|
|
4654
|
-
chain:
|
|
4655
|
-
rpcUrl:
|
|
4656
|
-
appAddress:
|
|
4657
|
-
allow:
|
|
4658
|
-
privateKey:
|
|
4659
|
-
walletClient:
|
|
4660
|
-
publicClient:
|
|
4661
|
-
skipPrerequisiteChecks:
|
|
4662
|
-
minBalance:
|
|
4663
|
-
timeout:
|
|
4664
|
-
retryOptions:
|
|
4665
|
-
signal:
|
|
4666
|
-
onTransactionStateChange:
|
|
4667
|
-
onTransactionSubmitted:
|
|
4668
|
-
onTransactionConfirmed:
|
|
4938
|
+
var SetAllowAnyDeviceRequestSchema = z55.object({
|
|
4939
|
+
chain: z55.unknown().optional(),
|
|
4940
|
+
rpcUrl: z55.string().optional(),
|
|
4941
|
+
appAddress: z55.string(),
|
|
4942
|
+
allow: z55.boolean(),
|
|
4943
|
+
privateKey: z55.string().optional(),
|
|
4944
|
+
walletClient: z55.unknown().optional(),
|
|
4945
|
+
publicClient: z55.unknown().optional(),
|
|
4946
|
+
skipPrerequisiteChecks: z55.boolean().optional().default(false),
|
|
4947
|
+
minBalance: z55.string().optional(),
|
|
4948
|
+
timeout: z55.number().optional().default(12e4),
|
|
4949
|
+
retryOptions: z55.unknown().optional(),
|
|
4950
|
+
signal: z55.unknown().optional(),
|
|
4951
|
+
onTransactionStateChange: z55.function().optional(),
|
|
4952
|
+
onTransactionSubmitted: z55.function().optional(),
|
|
4953
|
+
onTransactionConfirmed: z55.function().optional()
|
|
4669
4954
|
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4670
4955
|
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4671
4956
|
path: ["privateKey", "walletClient"]
|
|
@@ -4679,12 +4964,12 @@ var SetAllowAnyDeviceRequestSchema = z52.object({
|
|
|
4679
4964
|
path: ["chain"]
|
|
4680
4965
|
}
|
|
4681
4966
|
);
|
|
4682
|
-
var SetAllowAnyDeviceSchema =
|
|
4683
|
-
appAddress:
|
|
4684
|
-
allow:
|
|
4685
|
-
transactionHash:
|
|
4686
|
-
blockNumber:
|
|
4687
|
-
gasUsed:
|
|
4967
|
+
var SetAllowAnyDeviceSchema = z55.object({
|
|
4968
|
+
appAddress: z55.string(),
|
|
4969
|
+
allow: z55.boolean(),
|
|
4970
|
+
transactionHash: z55.string(),
|
|
4971
|
+
blockNumber: z55.bigint().optional(),
|
|
4972
|
+
gasUsed: z55.bigint().optional()
|
|
4688
4973
|
}).passthrough();
|
|
4689
4974
|
async function setAllowAnyDevice(request, parameters) {
|
|
4690
4975
|
const validatedRequest = SetAllowAnyDeviceRequestSchema.parse(request);
|
|
@@ -4821,13 +5106,13 @@ async function safeSetAllowAnyDevice(request, parameters) {
|
|
|
4821
5106
|
}
|
|
4822
5107
|
|
|
4823
5108
|
// src/actions/blockchains/get_allowed_devices.ts
|
|
4824
|
-
import { z as
|
|
5109
|
+
import { z as z56 } from "zod";
|
|
4825
5110
|
import { createPublicClient as createPublicClient7, http as http7 } from "viem";
|
|
4826
|
-
var GetAllowedDevicesSchema =
|
|
4827
|
-
appAddress:
|
|
4828
|
-
owner:
|
|
4829
|
-
allowAnyDevice:
|
|
4830
|
-
devices:
|
|
5111
|
+
var GetAllowedDevicesSchema = z56.object({
|
|
5112
|
+
appAddress: z56.string(),
|
|
5113
|
+
owner: z56.string(),
|
|
5114
|
+
allowAnyDevice: z56.boolean(),
|
|
5115
|
+
devices: z56.array(z56.string())
|
|
4831
5116
|
});
|
|
4832
5117
|
async function getAllowedDevices(request) {
|
|
4833
5118
|
const { chain, rpcUrl, appAddress, deviceIds, publicClient: providedPublicClient } = request;
|
|
@@ -5021,15 +5306,15 @@ async function safeCheckOnChainPrerequisites(request) {
|
|
|
5021
5306
|
}
|
|
5022
5307
|
|
|
5023
5308
|
// src/actions/workspaces/get_workspace_nodes.ts
|
|
5024
|
-
import { z as
|
|
5309
|
+
import { z as z57 } from "zod";
|
|
5025
5310
|
var NodeRefSchema2 = NodeRefSchema;
|
|
5026
5311
|
var NodeInfoSchema = NodeRefSchema2;
|
|
5027
|
-
var GetWorkspaceNodesSchema =
|
|
5028
|
-
items:
|
|
5029
|
-
total:
|
|
5030
|
-
page:
|
|
5031
|
-
page_size:
|
|
5032
|
-
pages:
|
|
5312
|
+
var GetWorkspaceNodesSchema = z57.object({
|
|
5313
|
+
items: z57.array(NodeRefSchema2),
|
|
5314
|
+
total: z57.number(),
|
|
5315
|
+
page: z57.number(),
|
|
5316
|
+
page_size: z57.number(),
|
|
5317
|
+
pages: z57.number()
|
|
5033
5318
|
}).passthrough();
|
|
5034
5319
|
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
5035
5320
|
const { teamSlug, page, pageSize } = request;
|
|
@@ -5041,39 +5326,39 @@ var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAct
|
|
|
5041
5326
|
});
|
|
5042
5327
|
|
|
5043
5328
|
// src/actions/workspaces/get_workspace_quotas.ts
|
|
5044
|
-
import { z as
|
|
5045
|
-
var QuotaMetricSchema =
|
|
5046
|
-
limit:
|
|
5047
|
-
remaining:
|
|
5329
|
+
import { z as z58 } from "zod";
|
|
5330
|
+
var QuotaMetricSchema = z58.object({
|
|
5331
|
+
limit: z58.number(),
|
|
5332
|
+
remaining: z58.number()
|
|
5048
5333
|
}).passthrough();
|
|
5049
|
-
var WorkspaceQuotasSchema =
|
|
5334
|
+
var WorkspaceQuotasSchema = z58.object({
|
|
5050
5335
|
vm_slots: QuotaMetricSchema,
|
|
5051
5336
|
vcpu: QuotaMetricSchema,
|
|
5052
5337
|
memory_mb: QuotaMetricSchema,
|
|
5053
5338
|
disk_gb: QuotaMetricSchema
|
|
5054
5339
|
}).passthrough();
|
|
5055
|
-
var WorkspaceReservedGpuQuotaSchema =
|
|
5340
|
+
var WorkspaceReservedGpuQuotaSchema = z58.object({
|
|
5056
5341
|
gpus: QuotaMetricSchema,
|
|
5057
|
-
in_use:
|
|
5058
|
-
misconfigured:
|
|
5342
|
+
in_use: z58.number(),
|
|
5343
|
+
misconfigured: z58.number()
|
|
5059
5344
|
}).passthrough();
|
|
5060
|
-
var GetWorkspaceQuotasSchema =
|
|
5061
|
-
team_slug:
|
|
5062
|
-
tier:
|
|
5345
|
+
var GetWorkspaceQuotasSchema = z58.object({
|
|
5346
|
+
team_slug: z58.string(),
|
|
5347
|
+
tier: z58.string(),
|
|
5063
5348
|
quotas: WorkspaceQuotasSchema,
|
|
5064
5349
|
reserved_nodes: QuotaMetricSchema,
|
|
5065
5350
|
reserved_gpu: WorkspaceReservedGpuQuotaSchema,
|
|
5066
|
-
as_of:
|
|
5351
|
+
as_of: z58.string()
|
|
5067
5352
|
}).passthrough();
|
|
5068
5353
|
var { action: getWorkspaceQuotas, safeAction: safeGetWorkspaceQuotas } = defineAction(GetWorkspaceQuotasSchema, async (client, request) => {
|
|
5069
5354
|
return await client.get(`/workspaces/${request.teamSlug}/quotas`);
|
|
5070
5355
|
});
|
|
5071
5356
|
|
|
5072
5357
|
// src/actions/cvms/replicate_cvm.ts
|
|
5073
|
-
import { z as
|
|
5358
|
+
import { z as z59 } from "zod";
|
|
5074
5359
|
var ReplicateCvmRequestSchema = refineCvmId(
|
|
5075
5360
|
CvmIdObjectSchema.extend({
|
|
5076
|
-
node_id:
|
|
5361
|
+
node_id: z59.number().optional()
|
|
5077
5362
|
})
|
|
5078
5363
|
);
|
|
5079
5364
|
var { action: replicateCvm, safeAction: safeReplicateCvm } = defineAction(VMSchema, async (client, request) => {
|
|
@@ -5084,13 +5369,13 @@ var { action: replicateCvm, safeAction: safeReplicateCvm } = defineAction(VMSche
|
|
|
5084
5369
|
});
|
|
5085
5370
|
|
|
5086
5371
|
// src/actions/cvms/watch_cvm_state.ts
|
|
5087
|
-
import { z as
|
|
5088
|
-
var WatchCvmStateParamsSchema =
|
|
5089
|
-
target:
|
|
5090
|
-
interval:
|
|
5091
|
-
timeout:
|
|
5092
|
-
maxRetries:
|
|
5093
|
-
retryDelay:
|
|
5372
|
+
import { z as z60 } from "zod";
|
|
5373
|
+
var WatchCvmStateParamsSchema = z60.object({
|
|
5374
|
+
target: z60.string().describe("Target status to wait for (e.g., 'running', 'stopped')"),
|
|
5375
|
+
interval: z60.number().min(5).max(30).default(5).describe("Polling interval in seconds"),
|
|
5376
|
+
timeout: z60.number().min(10).max(600).default(300).describe("Timeout per attempt in seconds"),
|
|
5377
|
+
maxRetries: z60.number().min(0).default(Number.POSITIVE_INFINITY).describe("Maximum number of retry attempts (Infinity for unlimited)"),
|
|
5378
|
+
retryDelay: z60.number().min(0).default(5e3).describe("Delay between retries in milliseconds")
|
|
5094
5379
|
});
|
|
5095
5380
|
var WatchCvmStateRequestSchema = WatchCvmStateParamsSchema;
|
|
5096
5381
|
var WatchAbortedError = class extends Error {
|
|
@@ -5278,57 +5563,57 @@ function sleep(ms, signal) {
|
|
|
5278
5563
|
}
|
|
5279
5564
|
|
|
5280
5565
|
// src/actions/cvms/patch_cvm.ts
|
|
5281
|
-
import { z as
|
|
5566
|
+
import { z as z61 } from "zod";
|
|
5282
5567
|
var PatchCvmRequestSchema = refineCvmId(
|
|
5283
5568
|
CvmIdObjectSchema.extend({
|
|
5284
5569
|
// Compose-hash-affecting fields
|
|
5285
|
-
docker_compose_file:
|
|
5286
|
-
pre_launch_script:
|
|
5287
|
-
allowed_envs:
|
|
5570
|
+
docker_compose_file: z61.string().optional(),
|
|
5571
|
+
pre_launch_script: z61.string().optional(),
|
|
5572
|
+
allowed_envs: z61.array(z61.string()).optional(),
|
|
5288
5573
|
// Visibility
|
|
5289
|
-
public_logs:
|
|
5290
|
-
public_sysinfo:
|
|
5291
|
-
public_tcbinfo:
|
|
5574
|
+
public_logs: z61.boolean().optional(),
|
|
5575
|
+
public_sysinfo: z61.boolean().optional(),
|
|
5576
|
+
public_tcbinfo: z61.boolean().optional(),
|
|
5292
5577
|
// Non-compose-hash config
|
|
5293
|
-
encrypted_env:
|
|
5294
|
-
user_config:
|
|
5295
|
-
gpus:
|
|
5296
|
-
count:
|
|
5297
|
-
product_name:
|
|
5578
|
+
encrypted_env: z61.string().optional(),
|
|
5579
|
+
user_config: z61.string().optional(),
|
|
5580
|
+
gpus: z61.object({
|
|
5581
|
+
count: z61.number(),
|
|
5582
|
+
product_name: z61.string().optional()
|
|
5298
5583
|
}).optional(),
|
|
5299
5584
|
// Resources
|
|
5300
|
-
vcpu:
|
|
5301
|
-
memory:
|
|
5302
|
-
disk_size:
|
|
5585
|
+
vcpu: z61.number().optional(),
|
|
5586
|
+
memory: z61.number().optional(),
|
|
5587
|
+
disk_size: z61.number().optional(),
|
|
5303
5588
|
// OS image
|
|
5304
|
-
image:
|
|
5589
|
+
image: z61.string().optional(),
|
|
5305
5590
|
// Shutdown behavior
|
|
5306
|
-
shutdown_timeout:
|
|
5307
|
-
allow_force_stop:
|
|
5591
|
+
shutdown_timeout: z61.number().optional(),
|
|
5592
|
+
allow_force_stop: z61.boolean().optional(),
|
|
5308
5593
|
// Prepare-only mode (for multisig workflows)
|
|
5309
|
-
prepareOnly:
|
|
5594
|
+
prepareOnly: z61.boolean().optional()
|
|
5310
5595
|
})
|
|
5311
5596
|
);
|
|
5312
|
-
var PatchCvmAcceptedSchema =
|
|
5313
|
-
requiresOnChainHash:
|
|
5314
|
-
correlationId:
|
|
5315
|
-
});
|
|
5316
|
-
var PatchCvmHashRequiredSchema =
|
|
5317
|
-
requiresOnChainHash:
|
|
5318
|
-
composeHash:
|
|
5319
|
-
appId:
|
|
5320
|
-
deviceId:
|
|
5597
|
+
var PatchCvmAcceptedSchema = z61.object({
|
|
5598
|
+
requiresOnChainHash: z61.literal(false),
|
|
5599
|
+
correlationId: z61.string()
|
|
5600
|
+
});
|
|
5601
|
+
var PatchCvmHashRequiredSchema = z61.object({
|
|
5602
|
+
requiresOnChainHash: z61.literal(true),
|
|
5603
|
+
composeHash: z61.string(),
|
|
5604
|
+
appId: z61.string(),
|
|
5605
|
+
deviceId: z61.string(),
|
|
5321
5606
|
kmsInfo: KmsInfoSchema,
|
|
5322
|
-
commitToken:
|
|
5323
|
-
commitUrl:
|
|
5324
|
-
apiCommitUrl:
|
|
5325
|
-
onchainStatus:
|
|
5326
|
-
compose_hash_allowed:
|
|
5327
|
-
device_id_allowed:
|
|
5328
|
-
is_allowed:
|
|
5607
|
+
commitToken: z61.string().optional(),
|
|
5608
|
+
commitUrl: z61.string().optional(),
|
|
5609
|
+
apiCommitUrl: z61.string().optional(),
|
|
5610
|
+
onchainStatus: z61.object({
|
|
5611
|
+
compose_hash_allowed: z61.boolean(),
|
|
5612
|
+
device_id_allowed: z61.boolean(),
|
|
5613
|
+
is_allowed: z61.boolean()
|
|
5329
5614
|
}).optional()
|
|
5330
5615
|
});
|
|
5331
|
-
var PatchCvmResultSchema =
|
|
5616
|
+
var PatchCvmResultSchema = z61.discriminatedUnion("requiresOnChainHash", [
|
|
5332
5617
|
PatchCvmAcceptedSchema,
|
|
5333
5618
|
PatchCvmHashRequiredSchema
|
|
5334
5619
|
]);
|
|
@@ -5377,15 +5662,15 @@ var { action: patchCvm, safeAction: safePatchCvm } = defineAction(PatchCvmResult
|
|
|
5377
5662
|
});
|
|
5378
5663
|
|
|
5379
5664
|
// src/actions/cvms/confirm_cvm_patch.ts
|
|
5380
|
-
import { z as
|
|
5665
|
+
import { z as z62 } from "zod";
|
|
5381
5666
|
var ConfirmCvmPatchRequestSchema = refineCvmId(
|
|
5382
5667
|
CvmIdObjectSchema.extend({
|
|
5383
|
-
composeHash:
|
|
5384
|
-
transactionHash:
|
|
5668
|
+
composeHash: z62.string().describe("Compose hash from patchCvm Phase 1 response"),
|
|
5669
|
+
transactionHash: z62.string().describe("Transaction hash proving on-chain registration")
|
|
5385
5670
|
})
|
|
5386
5671
|
);
|
|
5387
|
-
var ConfirmCvmPatchResultSchema =
|
|
5388
|
-
correlationId:
|
|
5672
|
+
var ConfirmCvmPatchResultSchema = z62.object({
|
|
5673
|
+
correlationId: z62.string()
|
|
5389
5674
|
});
|
|
5390
5675
|
var { action: confirmCvmPatch, safeAction: safeConfirmCvmPatch } = defineAction(ConfirmCvmPatchResultSchema, async (client, request) => {
|
|
5391
5676
|
const parsed = ConfirmCvmPatchRequestSchema.parse(request);
|
|
@@ -5406,17 +5691,17 @@ var { action: confirmCvmPatch, safeAction: safeConfirmCvmPatch } = defineAction(
|
|
|
5406
5691
|
});
|
|
5407
5692
|
|
|
5408
5693
|
// src/actions/cvms/commit_cvm_update.ts
|
|
5409
|
-
import { z as
|
|
5694
|
+
import { z as z63 } from "zod";
|
|
5410
5695
|
var CommitCvmUpdateRequestSchema = refineCvmId(
|
|
5411
5696
|
CvmIdObjectSchema.extend({
|
|
5412
|
-
token:
|
|
5413
|
-
composeHash:
|
|
5414
|
-
transactionHash:
|
|
5697
|
+
token: z63.string().describe("One-time commit token from prepare-only flow"),
|
|
5698
|
+
composeHash: z63.string().describe("Compose hash from Phase 1 response"),
|
|
5699
|
+
transactionHash: z63.string().describe("Transaction hash proving on-chain registration")
|
|
5415
5700
|
})
|
|
5416
5701
|
);
|
|
5417
|
-
var CommitCvmUpdateResultSchema =
|
|
5418
|
-
correlationId:
|
|
5419
|
-
status:
|
|
5702
|
+
var CommitCvmUpdateResultSchema = z63.object({
|
|
5703
|
+
correlationId: z63.string(),
|
|
5704
|
+
status: z63.string()
|
|
5420
5705
|
});
|
|
5421
5706
|
var { action: commitCvmUpdate, safeAction: safeCommitCvmUpdate } = defineAction(CommitCvmUpdateResultSchema, async (client, request) => {
|
|
5422
5707
|
const parsed = CommitCvmUpdateRequestSchema.parse(request);
|
|
@@ -5433,21 +5718,31 @@ var { action: commitCvmUpdate, safeAction: safeCommitCvmUpdate } = defineAction(
|
|
|
5433
5718
|
});
|
|
5434
5719
|
|
|
5435
5720
|
// src/actions/cvms/refresh_cvm_instance_id.ts
|
|
5436
|
-
import { z as
|
|
5437
|
-
var
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5721
|
+
import { z as z64 } from "zod";
|
|
5722
|
+
var InstanceIdRefreshResultBaseSchema = z64.object({
|
|
5723
|
+
identifier: z64.string(),
|
|
5724
|
+
status: z64.enum(["updated", "unchanged", "skipped", "conflict", "error"]),
|
|
5725
|
+
old_instance_id: z64.string().nullable().optional(),
|
|
5726
|
+
new_instance_id: z64.string().nullable().optional(),
|
|
5727
|
+
source: z64.enum(["teepod_state", "teepod_info", "gateway", "none"]),
|
|
5728
|
+
verified_with_gateway: z64.boolean(),
|
|
5729
|
+
reason: z64.string().nullable().optional()
|
|
5730
|
+
});
|
|
5731
|
+
var InstanceIdRefreshResultV20260121Schema = InstanceIdRefreshResultBaseSchema.extend({
|
|
5732
|
+
cvm_id: z64.number().nullable()
|
|
5733
|
+
});
|
|
5734
|
+
var InstanceIdRefreshResultV20260522Schema = InstanceIdRefreshResultBaseSchema.extend({
|
|
5735
|
+
cvm_id: z64.string().nullable()
|
|
5736
|
+
});
|
|
5737
|
+
var InstanceIdRefreshResultAnySchema = z64.union([
|
|
5738
|
+
InstanceIdRefreshResultV20260121Schema,
|
|
5739
|
+
InstanceIdRefreshResultV20260522Schema
|
|
5740
|
+
]);
|
|
5741
|
+
var InstanceIdRefreshResultSchema = InstanceIdRefreshResultV20260522Schema;
|
|
5447
5742
|
var RefreshCvmInstanceIdRequestSchema = refineCvmId(
|
|
5448
5743
|
CvmIdObjectSchema.extend({
|
|
5449
|
-
overwrite:
|
|
5450
|
-
dry_run:
|
|
5744
|
+
overwrite: z64.boolean().optional(),
|
|
5745
|
+
dry_run: z64.boolean().optional()
|
|
5451
5746
|
})
|
|
5452
5747
|
);
|
|
5453
5748
|
var { action: refreshCvmInstanceId, safeAction: safeRefreshCvmInstanceId } = defineAction(InstanceIdRefreshResultSchema, async (client, request) => {
|
|
@@ -5461,46 +5756,55 @@ var { action: refreshCvmInstanceId, safeAction: safeRefreshCvmInstanceId } = def
|
|
|
5461
5756
|
});
|
|
5462
5757
|
|
|
5463
5758
|
// src/actions/cvms/refresh_cvm_instance_ids.ts
|
|
5464
|
-
import { z as
|
|
5465
|
-
var RefreshCvmInstanceIdsRequestSchema =
|
|
5466
|
-
cvm_ids:
|
|
5467
|
-
running_only:
|
|
5468
|
-
missing_only:
|
|
5469
|
-
overwrite:
|
|
5470
|
-
limit:
|
|
5471
|
-
dry_run:
|
|
5759
|
+
import { z as z65 } from "zod";
|
|
5760
|
+
var RefreshCvmInstanceIdsRequestSchema = z65.object({
|
|
5761
|
+
cvm_ids: z65.array(z65.string()).optional(),
|
|
5762
|
+
running_only: z65.boolean().optional(),
|
|
5763
|
+
missing_only: z65.boolean().optional(),
|
|
5764
|
+
overwrite: z65.boolean().optional(),
|
|
5765
|
+
limit: z65.number().int().min(1).max(500).optional(),
|
|
5766
|
+
dry_run: z65.boolean().optional()
|
|
5472
5767
|
}).strict();
|
|
5473
|
-
var
|
|
5474
|
-
total:
|
|
5475
|
-
scanned:
|
|
5476
|
-
updated:
|
|
5477
|
-
unchanged:
|
|
5478
|
-
skipped:
|
|
5479
|
-
conflicts:
|
|
5480
|
-
errors:
|
|
5481
|
-
|
|
5768
|
+
var RefreshCvmInstanceIdsResponseBaseSchema = z65.object({
|
|
5769
|
+
total: z65.number().int(),
|
|
5770
|
+
scanned: z65.number().int(),
|
|
5771
|
+
updated: z65.number().int(),
|
|
5772
|
+
unchanged: z65.number().int(),
|
|
5773
|
+
skipped: z65.number().int(),
|
|
5774
|
+
conflicts: z65.number().int(),
|
|
5775
|
+
errors: z65.number().int()
|
|
5776
|
+
});
|
|
5777
|
+
var RefreshCvmInstanceIdsResponseV20260121Schema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5778
|
+
items: z65.array(InstanceIdRefreshResultV20260121Schema)
|
|
5779
|
+
});
|
|
5780
|
+
var RefreshCvmInstanceIdsResponseV20260522Schema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5781
|
+
items: z65.array(InstanceIdRefreshResultV20260522Schema)
|
|
5482
5782
|
});
|
|
5783
|
+
var RefreshCvmInstanceIdsResponseAnySchema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5784
|
+
items: z65.array(InstanceIdRefreshResultSchema)
|
|
5785
|
+
});
|
|
5786
|
+
var RefreshCvmInstanceIdsResponseSchema = RefreshCvmInstanceIdsResponseV20260522Schema;
|
|
5483
5787
|
var { action: refreshCvmInstanceIds, safeAction: safeRefreshCvmInstanceIds } = defineAction(RefreshCvmInstanceIdsResponseSchema, async (client, request) => {
|
|
5484
5788
|
const parsed = RefreshCvmInstanceIdsRequestSchema.parse(request);
|
|
5485
5789
|
return await client.patch("/cvms/instance-ids", parsed);
|
|
5486
5790
|
});
|
|
5487
5791
|
|
|
5488
5792
|
// src/actions/cvms/get_cvm_status_batch.ts
|
|
5489
|
-
import { z as
|
|
5490
|
-
var CvmStatusSchema =
|
|
5491
|
-
vm_uuid:
|
|
5492
|
-
status:
|
|
5493
|
-
uptime:
|
|
5494
|
-
in_progress:
|
|
5495
|
-
boot_progress:
|
|
5496
|
-
boot_error:
|
|
5497
|
-
operation_type:
|
|
5498
|
-
operation_started_at:
|
|
5499
|
-
correlation_id:
|
|
5500
|
-
});
|
|
5501
|
-
var GetCvmStatusBatchResponseSchema =
|
|
5502
|
-
var GetCvmStatusBatchRequestSchema =
|
|
5503
|
-
vmUuids:
|
|
5793
|
+
import { z as z66 } from "zod";
|
|
5794
|
+
var CvmStatusSchema = z66.object({
|
|
5795
|
+
vm_uuid: z66.string(),
|
|
5796
|
+
status: z66.string(),
|
|
5797
|
+
uptime: z66.string().nullable().optional(),
|
|
5798
|
+
in_progress: z66.boolean(),
|
|
5799
|
+
boot_progress: z66.string().nullable().optional(),
|
|
5800
|
+
boot_error: z66.string().nullable().optional(),
|
|
5801
|
+
operation_type: z66.string().nullable().optional(),
|
|
5802
|
+
operation_started_at: z66.string().nullable().optional(),
|
|
5803
|
+
correlation_id: z66.string().nullable().optional()
|
|
5804
|
+
});
|
|
5805
|
+
var GetCvmStatusBatchResponseSchema = z66.record(z66.string(), CvmStatusSchema);
|
|
5806
|
+
var GetCvmStatusBatchRequestSchema = z66.object({
|
|
5807
|
+
vmUuids: z66.array(z66.string())
|
|
5504
5808
|
});
|
|
5505
5809
|
var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAction(GetCvmStatusBatchResponseSchema, async (client, request) => {
|
|
5506
5810
|
const { vmUuids } = GetCvmStatusBatchRequestSchema.parse(request);
|
|
@@ -5508,11 +5812,11 @@ var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAct
|
|
|
5508
5812
|
});
|
|
5509
5813
|
|
|
5510
5814
|
// src/actions/cvms/get_cvm_user_config.ts
|
|
5511
|
-
import { z as
|
|
5512
|
-
var CvmUserConfigSchema =
|
|
5513
|
-
hostname:
|
|
5514
|
-
ssh_authorized_keys:
|
|
5515
|
-
default_gateway_domain:
|
|
5815
|
+
import { z as z67 } from "zod";
|
|
5816
|
+
var CvmUserConfigSchema = z67.object({
|
|
5817
|
+
hostname: z67.string().nullable().optional(),
|
|
5818
|
+
ssh_authorized_keys: z67.array(z67.string()).default([]),
|
|
5819
|
+
default_gateway_domain: z67.string().nullable().optional()
|
|
5516
5820
|
});
|
|
5517
5821
|
var GetCvmUserConfigRequestSchema = CvmIdSchema;
|
|
5518
5822
|
var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineAction(CvmUserConfigSchema, async (client, request) => {
|
|
@@ -5521,23 +5825,33 @@ var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineActio
|
|
|
5521
5825
|
});
|
|
5522
5826
|
|
|
5523
5827
|
// src/actions/cvms/check_cvm_is_allowed.ts
|
|
5524
|
-
import { z as
|
|
5525
|
-
var
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5828
|
+
import { z as z68 } from "zod";
|
|
5829
|
+
var IsAllowedResultBaseSchema = z68.object({
|
|
5830
|
+
app_contract_address: z68.string(),
|
|
5831
|
+
compose_hash: z68.string(),
|
|
5832
|
+
device_id: z68.string(),
|
|
5833
|
+
compose_hash_allowed: z68.boolean(),
|
|
5834
|
+
allow_any_device: z68.boolean(),
|
|
5835
|
+
device_id_allowed: z68.boolean().nullable().optional(),
|
|
5836
|
+
is_allowed: z68.boolean(),
|
|
5837
|
+
error: z68.string().nullable().optional()
|
|
5838
|
+
});
|
|
5839
|
+
var IsAllowedResultV20260121Schema = IsAllowedResultBaseSchema.extend({
|
|
5840
|
+
cvm_id: z68.number().optional()
|
|
5841
|
+
});
|
|
5842
|
+
var IsAllowedResultV20260522Schema = IsAllowedResultBaseSchema.extend({
|
|
5843
|
+
cvm_id: z68.string().optional()
|
|
5844
|
+
});
|
|
5845
|
+
var IsAllowedResultAnySchema = z68.union([
|
|
5846
|
+
IsAllowedResultV20260121Schema,
|
|
5847
|
+
IsAllowedResultV20260522Schema
|
|
5848
|
+
]);
|
|
5849
|
+
var IsAllowedResultSchema = IsAllowedResultV20260522Schema;
|
|
5850
|
+
var CheckCvmIsAllowedInputSchema = z68.object({
|
|
5851
|
+
cvmId: z68.string().min(1),
|
|
5852
|
+
compose_hash: z68.string().optional(),
|
|
5853
|
+
node_id: z68.number().optional(),
|
|
5854
|
+
device_id: z68.string().optional()
|
|
5541
5855
|
});
|
|
5542
5856
|
var CheckCvmIsAllowedRequestSchema = CheckCvmIsAllowedInputSchema;
|
|
5543
5857
|
var { action: checkCvmIsAllowed, safeAction: safeCheckCvmIsAllowed } = defineAction(IsAllowedResultSchema, async (client, request) => {
|
|
@@ -5546,13 +5860,13 @@ var { action: checkCvmIsAllowed, safeAction: safeCheckCvmIsAllowed } = defineAct
|
|
|
5546
5860
|
});
|
|
5547
5861
|
|
|
5548
5862
|
// src/actions/apps/check_app_is_allowed.ts
|
|
5549
|
-
import { z as
|
|
5550
|
-
var CheckAppIsAllowedRequestSchema =
|
|
5551
|
-
appId:
|
|
5552
|
-
compose_hash:
|
|
5553
|
-
node_id:
|
|
5554
|
-
device_id:
|
|
5555
|
-
chain_id:
|
|
5863
|
+
import { z as z69 } from "zod";
|
|
5864
|
+
var CheckAppIsAllowedRequestSchema = z69.object({
|
|
5865
|
+
appId: z69.string().min(1),
|
|
5866
|
+
compose_hash: z69.string(),
|
|
5867
|
+
node_id: z69.number().optional(),
|
|
5868
|
+
device_id: z69.string().optional(),
|
|
5869
|
+
chain_id: z69.number().optional()
|
|
5556
5870
|
});
|
|
5557
5871
|
var { action: checkAppIsAllowed, safeAction: safeCheckAppIsAllowed } = defineAction(IsAllowedResultSchema, async (client, request) => {
|
|
5558
5872
|
const { appId, ...body } = CheckAppIsAllowedRequestSchema.parse(request);
|
|
@@ -5560,18 +5874,29 @@ var { action: checkAppIsAllowed, safeAction: safeCheckAppIsAllowed } = defineAct
|
|
|
5560
5874
|
});
|
|
5561
5875
|
|
|
5562
5876
|
// src/actions/apps/check_app_cvms_is_allowed.ts
|
|
5563
|
-
import { z as
|
|
5564
|
-
var
|
|
5565
|
-
is_onchain:
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
})
|
|
5573
|
-
|
|
5574
|
-
|
|
5877
|
+
import { z as z70 } from "zod";
|
|
5878
|
+
var AppCvmsBatchIsAllowedResponseBaseSchema = z70.object({
|
|
5879
|
+
is_onchain: z70.boolean(),
|
|
5880
|
+
total: z70.number().default(0),
|
|
5881
|
+
allowed_count: z70.number().default(0),
|
|
5882
|
+
denied_count: z70.number().default(0),
|
|
5883
|
+
error_count: z70.number().default(0)
|
|
5884
|
+
});
|
|
5885
|
+
var AppCvmsBatchIsAllowedResponseV20260121Schema = AppCvmsBatchIsAllowedResponseBaseSchema.extend({
|
|
5886
|
+
results: z70.array(IsAllowedResultV20260121Schema.extend({ cvm_id: z70.number() })).default([]),
|
|
5887
|
+
skipped_cvm_ids: z70.array(z70.number()).default([])
|
|
5888
|
+
});
|
|
5889
|
+
var AppCvmsBatchIsAllowedResponseV20260522Schema = AppCvmsBatchIsAllowedResponseBaseSchema.extend({
|
|
5890
|
+
results: z70.array(IsAllowedResultV20260522Schema.extend({ cvm_id: z70.string() })).default([]),
|
|
5891
|
+
skipped_cvm_ids: z70.array(z70.string()).default([])
|
|
5892
|
+
});
|
|
5893
|
+
var AppCvmsBatchIsAllowedResponseAnySchema = z70.union([
|
|
5894
|
+
AppCvmsBatchIsAllowedResponseV20260121Schema,
|
|
5895
|
+
AppCvmsBatchIsAllowedResponseV20260522Schema
|
|
5896
|
+
]);
|
|
5897
|
+
var AppCvmsBatchIsAllowedResponseSchema = AppCvmsBatchIsAllowedResponseV20260522Schema;
|
|
5898
|
+
var CheckAppCvmsIsAllowedRequestSchema = z70.object({
|
|
5899
|
+
appId: z70.string().min(1)
|
|
5575
5900
|
});
|
|
5576
5901
|
var { action: checkAppCvmsIsAllowed, safeAction: safeCheckAppCvmsIsAllowed } = defineAction(AppCvmsBatchIsAllowedResponseSchema, async (client, request) => {
|
|
5577
5902
|
const { appId } = CheckAppCvmsIsAllowedRequestSchema.parse(request);
|
|
@@ -5579,27 +5904,29 @@ var { action: checkAppCvmsIsAllowed, safeAction: safeCheckAppCvmsIsAllowed } = d
|
|
|
5579
5904
|
});
|
|
5580
5905
|
|
|
5581
5906
|
// src/actions/apps/get_app_list.ts
|
|
5582
|
-
import { z as
|
|
5583
|
-
var GetAppListRequestSchema =
|
|
5584
|
-
page:
|
|
5585
|
-
page_size:
|
|
5586
|
-
search:
|
|
5587
|
-
status:
|
|
5588
|
-
listed:
|
|
5589
|
-
base_image:
|
|
5590
|
-
instance_type:
|
|
5591
|
-
kms_slug:
|
|
5592
|
-
kms_type:
|
|
5593
|
-
node:
|
|
5594
|
-
region:
|
|
5907
|
+
import { z as z71 } from "zod";
|
|
5908
|
+
var GetAppListRequestSchema = z71.object({
|
|
5909
|
+
page: z71.number().int().min(1).optional(),
|
|
5910
|
+
page_size: z71.number().int().min(1).max(100).optional(),
|
|
5911
|
+
search: z71.string().optional(),
|
|
5912
|
+
status: z71.array(z71.string()).optional(),
|
|
5913
|
+
listed: z71.boolean().optional(),
|
|
5914
|
+
base_image: z71.string().optional(),
|
|
5915
|
+
instance_type: z71.string().optional(),
|
|
5916
|
+
kms_slug: z71.string().optional(),
|
|
5917
|
+
kms_type: z71.string().optional(),
|
|
5918
|
+
node: z71.string().optional(),
|
|
5919
|
+
region: z71.string().optional()
|
|
5595
5920
|
}).strict();
|
|
5596
|
-
function
|
|
5597
|
-
|
|
5921
|
+
function getSchemaForVersion5(version) {
|
|
5922
|
+
if (version === "2025-10-28") return DstackAppListResponseV20251028Schema;
|
|
5923
|
+
if (version === "2026-01-21") return DstackAppListResponseV20260121Schema;
|
|
5924
|
+
return DstackAppListResponseV20260522Schema;
|
|
5598
5925
|
}
|
|
5599
5926
|
async function getAppList(client, request) {
|
|
5600
5927
|
const validatedRequest = GetAppListRequestSchema.parse(request ?? {});
|
|
5601
5928
|
const response = await client.get("/apps", { params: validatedRequest });
|
|
5602
|
-
const schema =
|
|
5929
|
+
const schema = getSchemaForVersion5(client.config.version);
|
|
5603
5930
|
return schema.parse(response);
|
|
5604
5931
|
}
|
|
5605
5932
|
async function safeGetAppList(client, request) {
|
|
@@ -5621,17 +5948,19 @@ async function safeGetAppList(client, request) {
|
|
|
5621
5948
|
}
|
|
5622
5949
|
|
|
5623
5950
|
// src/actions/apps/get_app_info.ts
|
|
5624
|
-
import { z as
|
|
5625
|
-
var GetAppInfoRequestSchema =
|
|
5626
|
-
appId:
|
|
5951
|
+
import { z as z72 } from "zod";
|
|
5952
|
+
var GetAppInfoRequestSchema = z72.object({
|
|
5953
|
+
appId: z72.string().min(1)
|
|
5627
5954
|
}).strict();
|
|
5628
|
-
function
|
|
5629
|
-
|
|
5955
|
+
function getSchemaForVersion6(version) {
|
|
5956
|
+
if (version === "2025-10-28") return DstackAppWithCvmResponseV20251028Schema;
|
|
5957
|
+
if (version === "2026-01-21") return DstackAppWithCvmResponseV20260121Schema;
|
|
5958
|
+
return DstackAppWithCvmResponseV20260522Schema;
|
|
5630
5959
|
}
|
|
5631
5960
|
async function getAppInfo(client, request) {
|
|
5632
5961
|
const { appId } = GetAppInfoRequestSchema.parse(request);
|
|
5633
5962
|
const response = await client.get(`/apps/${appId}`);
|
|
5634
|
-
const schema =
|
|
5963
|
+
const schema = getSchemaForVersion6(client.config.version);
|
|
5635
5964
|
return schema.parse(response);
|
|
5636
5965
|
}
|
|
5637
5966
|
async function safeGetAppInfo(client, request) {
|
|
@@ -5653,17 +5982,19 @@ async function safeGetAppInfo(client, request) {
|
|
|
5653
5982
|
}
|
|
5654
5983
|
|
|
5655
5984
|
// src/actions/apps/get_app_cvms.ts
|
|
5656
|
-
import { z as
|
|
5657
|
-
var GetAppCvmsRequestSchema =
|
|
5658
|
-
appId:
|
|
5985
|
+
import { z as z73 } from "zod";
|
|
5986
|
+
var GetAppCvmsRequestSchema = z73.object({
|
|
5987
|
+
appId: z73.string().min(1)
|
|
5659
5988
|
}).strict();
|
|
5660
|
-
function
|
|
5661
|
-
|
|
5989
|
+
function getSchemaForVersion7(version) {
|
|
5990
|
+
if (version === "2025-10-28") return z73.array(CvmInfoV20251028Schema);
|
|
5991
|
+
if (version === "2026-01-21") return z73.array(CvmInfoV20260121Schema);
|
|
5992
|
+
return z73.array(CvmInfoV20260522Schema);
|
|
5662
5993
|
}
|
|
5663
5994
|
async function getAppCvms(client, request) {
|
|
5664
5995
|
const { appId } = GetAppCvmsRequestSchema.parse(request);
|
|
5665
5996
|
const response = await client.get(`/apps/${appId}/cvms`);
|
|
5666
|
-
const schema =
|
|
5997
|
+
const schema = getSchemaForVersion7(client.config.version);
|
|
5667
5998
|
return schema.parse(response);
|
|
5668
5999
|
}
|
|
5669
6000
|
async function safeGetAppCvms(client, request) {
|
|
@@ -5685,16 +6016,17 @@ async function safeGetAppCvms(client, request) {
|
|
|
5685
6016
|
}
|
|
5686
6017
|
|
|
5687
6018
|
// src/actions/apps/create_app_instance.ts
|
|
5688
|
-
import { z as
|
|
5689
|
-
var CreateAppInstanceRequestSchema =
|
|
5690
|
-
appId:
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
6019
|
+
import { z as z74 } from "zod";
|
|
6020
|
+
var CreateAppInstanceRequestSchema = z74.object({
|
|
6021
|
+
appId: z74.string().min(1),
|
|
6022
|
+
name: z74.string().optional(),
|
|
6023
|
+
node_id: z74.number().optional(),
|
|
6024
|
+
docker_compose_file: z74.string().optional(),
|
|
6025
|
+
pre_launch_script: z74.string().optional(),
|
|
6026
|
+
encrypted_env: z74.string().optional(),
|
|
6027
|
+
compose_hash: z74.string().optional(),
|
|
6028
|
+
token: z74.string().optional(),
|
|
6029
|
+
transaction_hash: z74.string().optional()
|
|
5698
6030
|
}).strict();
|
|
5699
6031
|
var { action: createAppInstance, safeAction: safeCreateAppInstance } = defineAction(VMSchema, async (client, request) => {
|
|
5700
6032
|
const parsed = CreateAppInstanceRequestSchema.parse(request);
|
|
@@ -5703,23 +6035,42 @@ var { action: createAppInstance, safeAction: safeCreateAppInstance } = defineAct
|
|
|
5703
6035
|
});
|
|
5704
6036
|
|
|
5705
6037
|
// src/actions/apps/get_app_device_allowlist.ts
|
|
5706
|
-
import { z as
|
|
5707
|
-
var
|
|
5708
|
-
device_id:
|
|
5709
|
-
node_name:
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
6038
|
+
import { z as z75 } from "zod";
|
|
6039
|
+
var DeviceAllowlistItemBaseSchema = z75.object({
|
|
6040
|
+
device_id: z75.string(),
|
|
6041
|
+
node_name: z75.string().nullable(),
|
|
6042
|
+
allowed_onchain: z75.boolean(),
|
|
6043
|
+
status: z75.string()
|
|
6044
|
+
});
|
|
6045
|
+
var DeviceAllowlistItemV20260121Schema = DeviceAllowlistItemBaseSchema.extend({
|
|
6046
|
+
cvm_ids: z75.array(z75.number())
|
|
6047
|
+
});
|
|
6048
|
+
var DeviceAllowlistItemV20260522Schema = DeviceAllowlistItemBaseSchema.extend({
|
|
6049
|
+
cvm_ids: z75.array(z75.string())
|
|
6050
|
+
});
|
|
6051
|
+
var DeviceAllowlistResponseBaseSchema = z75.object({
|
|
6052
|
+
is_onchain_kms: z75.boolean(),
|
|
6053
|
+
allow_any_device: z75.boolean().nullable().optional(),
|
|
6054
|
+
chain_id: z75.number().nullable().optional(),
|
|
6055
|
+
app_contract_address: z75.string().nullable().optional()
|
|
6056
|
+
});
|
|
6057
|
+
var DeviceAllowlistResponseV20260121Schema = DeviceAllowlistResponseBaseSchema.extend({
|
|
6058
|
+
devices: z75.array(DeviceAllowlistItemV20260121Schema).optional().default([])
|
|
6059
|
+
});
|
|
6060
|
+
var DeviceAllowlistResponseV20260522Schema = DeviceAllowlistResponseBaseSchema.extend({
|
|
6061
|
+
devices: z75.array(DeviceAllowlistItemV20260522Schema).optional().default([])
|
|
6062
|
+
});
|
|
6063
|
+
var DeviceAllowlistItemAnySchema = z75.union([
|
|
6064
|
+
DeviceAllowlistItemV20260121Schema,
|
|
6065
|
+
DeviceAllowlistItemV20260522Schema
|
|
6066
|
+
]);
|
|
6067
|
+
var DeviceAllowlistResponseAnySchema = z75.union([
|
|
6068
|
+
DeviceAllowlistResponseV20260121Schema,
|
|
6069
|
+
DeviceAllowlistResponseV20260522Schema
|
|
6070
|
+
]);
|
|
6071
|
+
var DeviceAllowlistResponseSchema = DeviceAllowlistResponseV20260522Schema;
|
|
6072
|
+
var GetAppDeviceAllowlistRequestSchema = z75.object({
|
|
6073
|
+
appId: z75.string().min(1)
|
|
5723
6074
|
}).strict();
|
|
5724
6075
|
async function getAppDeviceAllowlist(client, request) {
|
|
5725
6076
|
const { appId } = GetAppDeviceAllowlistRequestSchema.parse(request);
|
|
@@ -5745,11 +6096,11 @@ async function safeGetAppDeviceAllowlist(client, request) {
|
|
|
5745
6096
|
}
|
|
5746
6097
|
|
|
5747
6098
|
// src/actions/apps/get_app_revisions.ts
|
|
5748
|
-
import { z as
|
|
5749
|
-
var GetAppRevisionsRequestSchema =
|
|
5750
|
-
appId:
|
|
5751
|
-
page:
|
|
5752
|
-
page_size:
|
|
6099
|
+
import { z as z76 } from "zod";
|
|
6100
|
+
var GetAppRevisionsRequestSchema = z76.object({
|
|
6101
|
+
appId: z76.string().min(1),
|
|
6102
|
+
page: z76.number().int().min(1).optional(),
|
|
6103
|
+
page_size: z76.number().int().min(1).max(1e3).optional()
|
|
5753
6104
|
}).strict();
|
|
5754
6105
|
async function getAppRevisions(client, request) {
|
|
5755
6106
|
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
@@ -5775,11 +6126,11 @@ async function safeGetAppRevisions(client, request) {
|
|
|
5775
6126
|
}
|
|
5776
6127
|
|
|
5777
6128
|
// src/actions/apps/get_app_revision_detail.ts
|
|
5778
|
-
import { z as
|
|
5779
|
-
var GetAppRevisionDetailRequestSchema =
|
|
5780
|
-
appId:
|
|
5781
|
-
revisionId:
|
|
5782
|
-
rawComposeFile:
|
|
6129
|
+
import { z as z77 } from "zod";
|
|
6130
|
+
var GetAppRevisionDetailRequestSchema = z77.object({
|
|
6131
|
+
appId: z77.string().min(1),
|
|
6132
|
+
revisionId: z77.string().min(1),
|
|
6133
|
+
rawComposeFile: z77.boolean().optional()
|
|
5783
6134
|
}).strict();
|
|
5784
6135
|
async function getAppRevisionDetail(client, request) {
|
|
5785
6136
|
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
@@ -5806,15 +6157,15 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
5806
6157
|
}
|
|
5807
6158
|
|
|
5808
6159
|
// src/actions/apps/get_app_filter_options.ts
|
|
5809
|
-
import { z as
|
|
5810
|
-
var AppFilterOptionsSchema =
|
|
5811
|
-
statuses:
|
|
5812
|
-
image_versions:
|
|
5813
|
-
instance_types:
|
|
5814
|
-
kms_slugs:
|
|
5815
|
-
kms_types:
|
|
5816
|
-
regions:
|
|
5817
|
-
nodes:
|
|
6160
|
+
import { z as z78 } from "zod";
|
|
6161
|
+
var AppFilterOptionsSchema = z78.object({
|
|
6162
|
+
statuses: z78.array(z78.string()),
|
|
6163
|
+
image_versions: z78.array(z78.string()),
|
|
6164
|
+
instance_types: z78.array(z78.string()),
|
|
6165
|
+
kms_slugs: z78.array(z78.string()),
|
|
6166
|
+
kms_types: z78.array(z78.string()),
|
|
6167
|
+
regions: z78.array(z78.string()),
|
|
6168
|
+
nodes: z78.array(z78.string())
|
|
5818
6169
|
});
|
|
5819
6170
|
async function getAppFilterOptions(client) {
|
|
5820
6171
|
const response = await client.get("/apps/filter-options");
|
|
@@ -5839,47 +6190,52 @@ async function safeGetAppFilterOptions(client) {
|
|
|
5839
6190
|
}
|
|
5840
6191
|
|
|
5841
6192
|
// src/actions/apps/get_app_attestation.ts
|
|
5842
|
-
import { z as
|
|
5843
|
-
var KmsInfoSchema2 =
|
|
5844
|
-
contract_address:
|
|
5845
|
-
chain_id:
|
|
5846
|
-
version:
|
|
5847
|
-
url:
|
|
5848
|
-
gateway_app_id:
|
|
5849
|
-
gateway_app_url:
|
|
5850
|
-
kms_type:
|
|
5851
|
-
});
|
|
5852
|
-
var GuestAgentInfoSchema =
|
|
5853
|
-
app_id:
|
|
5854
|
-
instance_id:
|
|
5855
|
-
app_name:
|
|
5856
|
-
device_id:
|
|
6193
|
+
import { z as z79 } from "zod";
|
|
6194
|
+
var KmsInfoSchema2 = z79.object({
|
|
6195
|
+
contract_address: z79.string(),
|
|
6196
|
+
chain_id: z79.string().nullable(),
|
|
6197
|
+
version: z79.string(),
|
|
6198
|
+
url: z79.string(),
|
|
6199
|
+
gateway_app_id: z79.string().nullable(),
|
|
6200
|
+
gateway_app_url: z79.string(),
|
|
6201
|
+
kms_type: z79.string()
|
|
6202
|
+
});
|
|
6203
|
+
var GuestAgentInfoSchema = z79.object({
|
|
6204
|
+
app_id: z79.string().optional(),
|
|
6205
|
+
instance_id: z79.string().optional(),
|
|
6206
|
+
app_name: z79.string().optional(),
|
|
6207
|
+
device_id: z79.string().optional()
|
|
5857
6208
|
}).passthrough().nullable();
|
|
5858
|
-
var AppAttestationInstanceSchema =
|
|
5859
|
-
vm_uuid:
|
|
5860
|
-
name:
|
|
5861
|
-
instance_id:
|
|
5862
|
-
status:
|
|
5863
|
-
image_version:
|
|
5864
|
-
quote:
|
|
5865
|
-
ppid:
|
|
5866
|
-
|
|
6209
|
+
var AppAttestationInstanceSchema = z79.object({
|
|
6210
|
+
vm_uuid: z79.string().nullable().optional(),
|
|
6211
|
+
name: z79.string().optional(),
|
|
6212
|
+
instance_id: z79.string().nullable().optional(),
|
|
6213
|
+
status: z79.string().optional(),
|
|
6214
|
+
image_version: z79.string().nullable().optional(),
|
|
6215
|
+
quote: z79.string().nullable().optional(),
|
|
6216
|
+
ppid: z79.string().optional(),
|
|
6217
|
+
ppid_sha256: z79.string().nullable().optional(),
|
|
6218
|
+
device_id: z79.string().optional(),
|
|
6219
|
+
fmspc: z79.string().nullable().optional(),
|
|
6220
|
+
tee_tcb_svn: z79.string().nullable().optional(),
|
|
6221
|
+
cpusvn: z79.string().nullable().optional(),
|
|
6222
|
+
pcesvn: z79.number().nullable().optional(),
|
|
5867
6223
|
tcb_info: TcbInfoSchema.nullable().optional(),
|
|
5868
|
-
app_certificates:
|
|
5869
|
-
compose_file:
|
|
5870
|
-
error:
|
|
6224
|
+
app_certificates: z79.array(CertificateSchema).nullable().optional(),
|
|
6225
|
+
compose_file: z79.string().nullable().optional(),
|
|
6226
|
+
error: z79.string().nullable().optional()
|
|
5871
6227
|
});
|
|
5872
|
-
var AppAttestationResponseSchema =
|
|
5873
|
-
app_id:
|
|
5874
|
-
contract_address:
|
|
6228
|
+
var AppAttestationResponseSchema = z79.object({
|
|
6229
|
+
app_id: z79.string(),
|
|
6230
|
+
contract_address: z79.string(),
|
|
5875
6231
|
kms_info: KmsInfoSchema2,
|
|
5876
|
-
instances:
|
|
6232
|
+
instances: z79.array(AppAttestationInstanceSchema),
|
|
5877
6233
|
kms_guest_agent_info: GuestAgentInfoSchema,
|
|
5878
6234
|
gateway_guest_agent_info: GuestAgentInfoSchema,
|
|
5879
|
-
qemu_version:
|
|
6235
|
+
qemu_version: z79.string().nullable()
|
|
5880
6236
|
});
|
|
5881
|
-
var GetAppAttestationRequestSchema =
|
|
5882
|
-
appId:
|
|
6237
|
+
var GetAppAttestationRequestSchema = z79.object({
|
|
6238
|
+
appId: z79.string().min(1)
|
|
5883
6239
|
}).strict();
|
|
5884
6240
|
var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAction(AppAttestationResponseSchema, async (client, request) => {
|
|
5885
6241
|
const { appId } = GetAppAttestationRequestSchema.parse(request);
|
|
@@ -5962,15 +6318,28 @@ export {
|
|
|
5962
6318
|
CvmAttestationSchema,
|
|
5963
6319
|
CvmBasicInfoV20251028Schema,
|
|
5964
6320
|
CvmContainersStatsSchema,
|
|
6321
|
+
CvmCreateGatewayResourceSchema,
|
|
6322
|
+
CvmCreateGatewayResourceV20260121Schema,
|
|
6323
|
+
CvmCreateInstanceTypeResourceSchema,
|
|
6324
|
+
CvmCreateKmsResourceSchema,
|
|
6325
|
+
CvmCreateKmsResourceV20260121Schema,
|
|
6326
|
+
CvmCreateNodeKmsRelationSchema,
|
|
6327
|
+
CvmCreateNodeKmsRelationV20260121Schema,
|
|
6328
|
+
CvmCreateResourceGraphSchema,
|
|
6329
|
+
CvmCreateResourceGraphV20260121Schema,
|
|
6330
|
+
CvmCreateResourceGraphV20260522Schema,
|
|
5965
6331
|
CvmDetailV20251028Schema,
|
|
5966
6332
|
CvmGatewayInfoV20260121Schema,
|
|
5967
6333
|
CvmIdBaseSchema,
|
|
5968
6334
|
CvmIdObjectSchema,
|
|
5969
6335
|
CvmIdSchema,
|
|
5970
6336
|
CvmInfoDetailV20260121Schema,
|
|
6337
|
+
CvmInfoDetailV20260522Schema,
|
|
5971
6338
|
CvmInfoV20251028Schema,
|
|
5972
6339
|
CvmInfoV20260121Schema,
|
|
6340
|
+
CvmInfoV20260522Schema,
|
|
5973
6341
|
CvmKmsInfoV20260121Schema,
|
|
6342
|
+
CvmLogUrlsV20260121Schema,
|
|
5974
6343
|
CvmNetworkSchema,
|
|
5975
6344
|
CvmNetworkUrlsV20251028Schema,
|
|
5976
6345
|
CvmNodeInfoV20260121Schema,
|
|
@@ -5989,12 +6358,13 @@ export {
|
|
|
5989
6358
|
DeployAppAuthSchema,
|
|
5990
6359
|
DstackAppFullResponseV20251028Schema,
|
|
5991
6360
|
DstackAppFullResponseV20260121Schema,
|
|
6361
|
+
DstackAppFullResponseV20260522Schema,
|
|
5992
6362
|
DstackAppListResponseV20251028Schema,
|
|
5993
6363
|
DstackAppListResponseV20260121Schema,
|
|
5994
|
-
|
|
5995
|
-
DstackAppMinimalResponseV20260121Schema,
|
|
6364
|
+
DstackAppListResponseV20260522Schema,
|
|
5996
6365
|
DstackAppWithCvmResponseV20251028Schema,
|
|
5997
6366
|
DstackAppWithCvmResponseV20260121Schema,
|
|
6367
|
+
DstackAppWithCvmResponseV20260522Schema,
|
|
5998
6368
|
ErrorCodes,
|
|
5999
6369
|
EventLogSchema,
|
|
6000
6370
|
FamilyGroupSchema,
|
|
@@ -6031,8 +6401,10 @@ export {
|
|
|
6031
6401
|
GetKmsOnChainDetailResponseSchema,
|
|
6032
6402
|
GetOsImagesRequestSchema,
|
|
6033
6403
|
GetOsImagesResponseSchema,
|
|
6404
|
+
GetPreLaunchScriptUpgradeStatusRequestSchema,
|
|
6034
6405
|
GetWorkspaceNodesSchema,
|
|
6035
6406
|
GetWorkspaceQuotasSchema,
|
|
6407
|
+
GpuAvailabilitySchema,
|
|
6036
6408
|
ImportGithubProfileRequestSchema,
|
|
6037
6409
|
ImportGithubProfileResponseSchema,
|
|
6038
6410
|
InstanceIdRefreshResultSchema,
|
|
@@ -6060,10 +6432,12 @@ export {
|
|
|
6060
6432
|
OnChainOsImageSchema,
|
|
6061
6433
|
PaginatedCvmInfosV20251028Schema,
|
|
6062
6434
|
PaginatedCvmInfosV20260121Schema,
|
|
6435
|
+
PaginatedCvmInfosV20260522Schema,
|
|
6063
6436
|
PaginationMetadataSchema,
|
|
6064
6437
|
PatchCvmRequestSchema,
|
|
6065
6438
|
PatchCvmResultSchema,
|
|
6066
6439
|
PhalaCloudError,
|
|
6440
|
+
PreLaunchScriptUpgradeStatusSchema,
|
|
6067
6441
|
ProvisionCvmComposeFileUpdateRequestSchema,
|
|
6068
6442
|
ProvisionCvmComposeFileUpdateResultSchema,
|
|
6069
6443
|
ProvisionCvmRequestSchema,
|
|
@@ -6098,9 +6472,14 @@ export {
|
|
|
6098
6472
|
UpdateOsImageRequestSchema,
|
|
6099
6473
|
UpdatePreLaunchScriptRequestSchema,
|
|
6100
6474
|
UpdatePreLaunchScriptResultSchema,
|
|
6475
|
+
UpgradePreLaunchScriptRequestSchema,
|
|
6476
|
+
UpgradePreLaunchScriptResultSchema,
|
|
6101
6477
|
UserInfoSchema,
|
|
6102
6478
|
UserRefSchema,
|
|
6479
|
+
VMAnySchema,
|
|
6103
6480
|
VMSchema,
|
|
6481
|
+
VMV20260121Schema,
|
|
6482
|
+
VMV20260522Schema,
|
|
6104
6483
|
ValidationError,
|
|
6105
6484
|
VmInfoV20251028Schema,
|
|
6106
6485
|
WalletError,
|
|
@@ -6172,6 +6551,7 @@ export {
|
|
|
6172
6551
|
getCvmAttestation,
|
|
6173
6552
|
getCvmComposeFile,
|
|
6174
6553
|
getCvmContainersStats,
|
|
6554
|
+
getCvmCreateResources,
|
|
6175
6555
|
getCvmDockerCompose,
|
|
6176
6556
|
getCvmInfo,
|
|
6177
6557
|
getCvmList,
|
|
@@ -6186,6 +6566,8 @@ export {
|
|
|
6186
6566
|
getKmsList,
|
|
6187
6567
|
getKmsOnChainDetail,
|
|
6188
6568
|
getOsImages,
|
|
6569
|
+
getPreLaunchScriptUpgradeStatus,
|
|
6570
|
+
getVMSchemaForVersion,
|
|
6189
6571
|
getValidationFields,
|
|
6190
6572
|
getWorkspace,
|
|
6191
6573
|
getWorkspaceNodes,
|
|
@@ -6245,6 +6627,7 @@ export {
|
|
|
6245
6627
|
safeGetCvmAttestation,
|
|
6246
6628
|
safeGetCvmComposeFile,
|
|
6247
6629
|
safeGetCvmContainersStats,
|
|
6630
|
+
safeGetCvmCreateResources,
|
|
6248
6631
|
safeGetCvmDockerCompose,
|
|
6249
6632
|
safeGetCvmInfo,
|
|
6250
6633
|
safeGetCvmList,
|
|
@@ -6258,6 +6641,7 @@ export {
|
|
|
6258
6641
|
safeGetKmsList,
|
|
6259
6642
|
safeGetKmsOnChainDetail,
|
|
6260
6643
|
safeGetOsImages,
|
|
6644
|
+
safeGetPreLaunchScriptUpgradeStatus,
|
|
6261
6645
|
safeGetWorkspace,
|
|
6262
6646
|
safeGetWorkspaceNodes,
|
|
6263
6647
|
safeGetWorkspaceQuotas,
|
|
@@ -6286,6 +6670,7 @@ export {
|
|
|
6286
6670
|
safeUpdateDockerCompose,
|
|
6287
6671
|
safeUpdateOsImage,
|
|
6288
6672
|
safeUpdatePreLaunchScript,
|
|
6673
|
+
safeUpgradePreLaunchScript,
|
|
6289
6674
|
safeValidateActionParameters,
|
|
6290
6675
|
setAllowAnyDevice,
|
|
6291
6676
|
shutdownCvm,
|
|
@@ -6300,6 +6685,7 @@ export {
|
|
|
6300
6685
|
updateDockerCompose,
|
|
6301
6686
|
updateOsImage,
|
|
6302
6687
|
updatePreLaunchScript,
|
|
6688
|
+
upgradePreLaunchScript,
|
|
6303
6689
|
validateActionParameters,
|
|
6304
6690
|
validateComposePayloadSize,
|
|
6305
6691
|
validateNetworkPrerequisites,
|