@phala/cloud 0.2.10 → 0.4.0
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 +100 -161
- package/dist/actions/apps/check_app_is_allowed.d.ts +14 -14
- package/dist/actions/apps/create_app_instance.d.ts +22 -22
- package/dist/actions/apps/get_app_attestation.d.ts +43 -33
- package/dist/actions/apps/get_app_device_allowlist.d.ts +51 -50
- package/dist/actions/apps/get_app_list.d.ts +2 -2
- package/dist/actions/cvms/check_cvm_is_allowed.d.ts +40 -102
- package/dist/actions/cvms/commit_cvm_compose_file_update.d.ts +12 -12
- package/dist/actions/cvms/commit_cvm_provision.d.ts +11 -135
- package/dist/actions/cvms/commit_cvm_update.d.ts +2 -2
- package/dist/actions/cvms/confirm_cvm_patch.d.ts +2 -2
- package/dist/actions/cvms/delete_cvm.d.ts +2 -2
- package/dist/actions/cvms/get_available_os_images.d.ts +2 -2
- package/dist/actions/cvms/get_cvm_attestation.d.ts +2 -2
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +166 -22
- package/dist/actions/cvms/get_cvm_containers_stats.d.ts +10 -10
- package/dist/actions/cvms/get_cvm_docker_compose.d.ts +2 -2
- package/dist/actions/cvms/get_cvm_info.d.ts +2 -2
- package/dist/actions/cvms/get_cvm_list.d.ts +8 -10
- package/dist/actions/cvms/get_cvm_network.d.ts +2 -2
- package/dist/actions/cvms/get_cvm_prelaunch_script.d.ts +2 -2
- package/dist/actions/cvms/get_cvm_state.d.ts +6 -6
- package/dist/actions/cvms/get_cvm_stats.d.ts +2 -2
- package/dist/actions/cvms/get_cvm_status_batch.d.ts +253 -30
- package/dist/actions/cvms/get_cvm_user_config.d.ts +2 -2
- package/dist/actions/cvms/get_prelaunch_script_upgrade_status.d.ts +2 -2
- package/dist/actions/cvms/patch_cvm.d.ts +34 -18
- package/dist/actions/cvms/provision_cvm.d.ts +900 -51
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +253 -43
- package/dist/actions/cvms/refresh_cvm_instance_id.d.ts +27 -58
- package/dist/actions/cvms/refresh_cvm_instance_ids.d.ts +120 -165
- package/dist/actions/cvms/replicate_cvm.d.ts +7 -72
- package/dist/actions/cvms/restart_cvm.d.ts +7 -72
- package/dist/actions/cvms/shutdown_cvm.d.ts +9 -72
- package/dist/actions/cvms/start_cvm.d.ts +7 -72
- package/dist/actions/cvms/stop_cvm.d.ts +7 -72
- package/dist/actions/cvms/update_cvm_envs.d.ts +36 -20
- package/dist/actions/cvms/update_cvm_resources.d.ts +26 -4
- package/dist/actions/cvms/update_cvm_visibility.d.ts +26 -24
- package/dist/actions/cvms/update_docker_compose.d.ts +51 -20
- package/dist/actions/cvms/update_os_image.d.ts +2 -2
- package/dist/actions/cvms/update_prelaunch_script.d.ts +51 -20
- package/dist/actions/cvms/upgrade_prelaunch_script.d.ts +36 -20
- package/dist/actions/get_available_nodes.d.ts +259 -0
- package/dist/actions/get_cvm_create_resources.d.ts +351 -0
- package/dist/actions/index.d.ts +6 -2
- package/dist/actions/kms/get_kms_contract.d.ts +59 -0
- package/dist/actions/kms/get_kms_list.d.ts +25 -10
- package/dist/actions/kms/get_kms_onchain_detail.d.ts +54 -0
- package/dist/actions/kms/list_kms_contract_nodes.d.ts +98 -0
- package/dist/actions/kms/list_kms_contracts.d.ts +152 -0
- package/dist/actions/kms/next_app_ids.d.ts +6 -6
- package/dist/actions/list-instance-types.d.ts +12 -12
- package/dist/actions/ssh_keys/create_ssh_key.d.ts +2 -2
- package/dist/actions/ssh_keys/list_ssh_keys.d.ts +4 -4
- package/dist/actions/workspaces/get_workspace.d.ts +4 -0
- package/dist/actions/workspaces/get_workspace_nodes.d.ts +175 -14
- package/dist/actions/workspaces/list_workspaces.d.ts +126 -0
- package/dist/client.d.ts +4 -1
- package/dist/create-client.d.ts +48 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1779 -1250
- package/dist/index.mjs +1704 -1194
- package/dist/types/app_compose.d.ts +50 -5
- package/dist/types/app_info_v20251028.d.ts +172 -128
- package/dist/types/app_info_v20260121.d.ts +2814 -490
- package/dist/types/app_revision.d.ts +8 -8
- package/dist/types/client.d.ts +2 -2
- package/dist/types/cvm_id.d.ts +6 -6
- package/dist/types/cvm_info.d.ts +98 -98
- package/dist/types/cvm_info_v20251028.d.ts +70 -47
- package/dist/types/cvm_info_v20260121.d.ts +1125 -148
- package/dist/types/kms_contract.d.ts +64 -0
- package/dist/types/kms_info.d.ts +8 -0
- package/dist/types/version-mappings.d.ts +43 -6
- package/dist/utils/error_codes.d.ts +1 -0
- package/dist/utils/errors.d.ts +30 -1
- package/dist/utils/get_compose_hash.d.ts +24 -0
- package/dist/utils/get_mr_config_id.d.ts +55 -0
- package/dist/utils/index.d.ts +3 -2
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -33,6 +33,13 @@ function extractRequestId(data) {
|
|
|
33
33
|
function extractRequestIdFromResponse(response) {
|
|
34
34
|
return response?.headers?.get("X-Request-ID") ?? void 0;
|
|
35
35
|
}
|
|
36
|
+
function extractRequestMethod(method) {
|
|
37
|
+
if (typeof method !== "string") {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
const normalized = method.trim().toUpperCase();
|
|
41
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
42
|
+
}
|
|
36
43
|
var PhalaCloudError = class extends Error {
|
|
37
44
|
constructor(message, data) {
|
|
38
45
|
super(message);
|
|
@@ -41,6 +48,9 @@ var PhalaCloudError = class extends Error {
|
|
|
41
48
|
this.statusText = data.statusText;
|
|
42
49
|
this.detail = data.detail;
|
|
43
50
|
this.requestId = data.requestId;
|
|
51
|
+
this.request = data.request;
|
|
52
|
+
this.requestMethod = data.requestMethod;
|
|
53
|
+
this.data = data.data;
|
|
44
54
|
this.code = data.code;
|
|
45
55
|
if (Error.captureStackTrace) {
|
|
46
56
|
Error.captureStackTrace(this, this.constructor);
|
|
@@ -54,12 +64,16 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
54
64
|
statusText: options?.statusText ?? "Unknown Error",
|
|
55
65
|
detail: options?.detail || message,
|
|
56
66
|
requestId: options?.requestId,
|
|
67
|
+
request: options?.request,
|
|
68
|
+
requestMethod: options?.requestMethod,
|
|
69
|
+
data: options?.data,
|
|
57
70
|
code: options?.code
|
|
58
71
|
});
|
|
59
72
|
this.name = "RequestError";
|
|
60
73
|
this.isRequestError = true;
|
|
61
74
|
this.data = options?.data;
|
|
62
75
|
this.request = options?.request;
|
|
76
|
+
this.requestMethod = options?.requestMethod;
|
|
63
77
|
this.response = options?.response;
|
|
64
78
|
this.type = options?.type;
|
|
65
79
|
}
|
|
@@ -70,6 +84,7 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
70
84
|
const bodyRequestId = extractRequestId(error.data);
|
|
71
85
|
const headerRequestId = extractRequestIdFromResponse(error.response);
|
|
72
86
|
const requestId = bodyRequestId ?? headerRequestId;
|
|
87
|
+
const requestMethod = extractRequestMethod(error.options?.method);
|
|
73
88
|
const parseResult = ApiErrorSchema.safeParse(error.data);
|
|
74
89
|
if (parseResult.success) {
|
|
75
90
|
const detail = parseResult.data.detail ?? (error.data && typeof error.data === "object" && "error_code" in error.data ? error.data : void 0);
|
|
@@ -78,6 +93,7 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
78
93
|
statusText: error.statusText ?? void 0,
|
|
79
94
|
data: error.data,
|
|
80
95
|
request: error.request ?? void 0,
|
|
96
|
+
requestMethod,
|
|
81
97
|
response: error.response ?? void 0,
|
|
82
98
|
detail,
|
|
83
99
|
code: parseResult.data.code ?? void 0,
|
|
@@ -93,6 +109,7 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
93
109
|
statusText: "Request Timeout",
|
|
94
110
|
data: error.data,
|
|
95
111
|
request: error.request ?? void 0,
|
|
112
|
+
requestMethod,
|
|
96
113
|
response: error.response ?? void 0,
|
|
97
114
|
detail: message,
|
|
98
115
|
code: "TIMEOUT",
|
|
@@ -104,6 +121,7 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
104
121
|
statusText: error.statusText ?? void 0,
|
|
105
122
|
data: error.data,
|
|
106
123
|
request: error.request ?? void 0,
|
|
124
|
+
requestMethod,
|
|
107
125
|
response: error.response ?? void 0,
|
|
108
126
|
detail: error.data?.detail || error.message || "Unknown API error",
|
|
109
127
|
code: error.status?.toString() ?? void 0,
|
|
@@ -113,9 +131,10 @@ var RequestError = class _RequestError extends PhalaCloudError {
|
|
|
113
131
|
/**
|
|
114
132
|
* Create RequestError from generic Error
|
|
115
133
|
*/
|
|
116
|
-
static fromError(error, request) {
|
|
134
|
+
static fromError(error, request, requestMethod) {
|
|
117
135
|
return new _RequestError(error.message, {
|
|
118
136
|
request: request ?? void 0,
|
|
137
|
+
requestMethod: extractRequestMethod(requestMethod),
|
|
119
138
|
detail: error.message
|
|
120
139
|
});
|
|
121
140
|
}
|
|
@@ -234,6 +253,9 @@ function parseApiError(requestError) {
|
|
|
234
253
|
statusText,
|
|
235
254
|
detail,
|
|
236
255
|
requestId: structured.request_id ?? requestError.requestId,
|
|
256
|
+
request: requestError.request,
|
|
257
|
+
requestMethod: requestError.requestMethod,
|
|
258
|
+
data: requestError.data,
|
|
237
259
|
errorCode: structured.error_code,
|
|
238
260
|
structuredDetails: structured.details,
|
|
239
261
|
suggestions: structured.suggestions,
|
|
@@ -247,6 +269,9 @@ function parseApiError(requestError) {
|
|
|
247
269
|
statusText,
|
|
248
270
|
detail,
|
|
249
271
|
requestId: requestError.requestId,
|
|
272
|
+
request: requestError.request,
|
|
273
|
+
requestMethod: requestError.requestMethod,
|
|
274
|
+
data: requestError.data,
|
|
250
275
|
code: requestError.code
|
|
251
276
|
};
|
|
252
277
|
if (errorType === "validation" && Array.isArray(detail)) {
|
|
@@ -310,6 +335,16 @@ function getErrorMessage(error) {
|
|
|
310
335
|
}
|
|
311
336
|
return "Unknown error occurred";
|
|
312
337
|
}
|
|
338
|
+
function formatStructuredErrorDetailValue(value) {
|
|
339
|
+
if (value === null || value === void 0) return "";
|
|
340
|
+
if (typeof value === "string") return value;
|
|
341
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
342
|
+
try {
|
|
343
|
+
return JSON.stringify(value);
|
|
344
|
+
} catch {
|
|
345
|
+
return String(value);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
313
348
|
var ResourceError = class extends BusinessError {
|
|
314
349
|
constructor(message, data) {
|
|
315
350
|
super(message, data);
|
|
@@ -355,7 +390,7 @@ function formatStructuredError(error, options) {
|
|
|
355
390
|
if (d.message) {
|
|
356
391
|
parts.push(` - ${d.message}`);
|
|
357
392
|
} else if (d.field && d.value !== void 0) {
|
|
358
|
-
parts.push(` - ${d.field}: ${d.value}`);
|
|
393
|
+
parts.push(` - ${d.field}: ${formatStructuredErrorDetailValue(d.value)}`);
|
|
359
394
|
}
|
|
360
395
|
});
|
|
361
396
|
}
|
|
@@ -386,9 +421,10 @@ function isAppIdConflictError(error) {
|
|
|
386
421
|
var SUPPORTED_API_VERSIONS = [
|
|
387
422
|
"2025-10-28",
|
|
388
423
|
"2026-01-21",
|
|
389
|
-
"2026-05-22"
|
|
424
|
+
"2026-05-22",
|
|
425
|
+
"2026-06-23"
|
|
390
426
|
];
|
|
391
|
-
var DEFAULT_API_VERSION = "2026-
|
|
427
|
+
var DEFAULT_API_VERSION = "2026-06-23";
|
|
392
428
|
var logger = debug("phala::api-client");
|
|
393
429
|
function formatHeaders(headers) {
|
|
394
430
|
return Object.entries(headers).map(([key, value]) => ` -H "${key}: ${value}"`).join("\n");
|
|
@@ -859,6 +895,12 @@ async function safeGetCurrentUser(client, parameters) {
|
|
|
859
895
|
}
|
|
860
896
|
|
|
861
897
|
// src/actions/get_available_nodes.ts
|
|
898
|
+
import { z as z7 } from "zod";
|
|
899
|
+
|
|
900
|
+
// src/types/cvm_info_v20260121.ts
|
|
901
|
+
import { z as z6 } from "zod";
|
|
902
|
+
|
|
903
|
+
// src/types/cvm_info_v20251028.ts
|
|
862
904
|
import { z as z5 } from "zod";
|
|
863
905
|
|
|
864
906
|
// src/types/kms_info.ts
|
|
@@ -880,7 +922,8 @@ var KmsInfoBaseSchema = z4.object({
|
|
|
880
922
|
version: z4.string(),
|
|
881
923
|
chain_id: z4.number().nullable(),
|
|
882
924
|
kms_contract_address: z4.string().nullable().transform((val) => val),
|
|
883
|
-
gateway_app_id: z4.string().nullable().transform((val) => val)
|
|
925
|
+
gateway_app_id: z4.string().nullable().transform((val) => val),
|
|
926
|
+
k256_pubkey: z4.string().nullable().optional()
|
|
884
927
|
}).passthrough();
|
|
885
928
|
var KmsInfoSchema = KmsInfoBaseSchema.transform((data) => {
|
|
886
929
|
if (data.chain_id != null) {
|
|
@@ -892,6 +935,262 @@ var KmsInfoSchema = KmsInfoBaseSchema.transform((data) => {
|
|
|
892
935
|
return data;
|
|
893
936
|
});
|
|
894
937
|
|
|
938
|
+
// src/types/cvm_info_v20251028.ts
|
|
939
|
+
var TableIdSchema = z5.union([z5.number(), z5.string()]);
|
|
940
|
+
var VmInfoV20251028Schema = z5.object({
|
|
941
|
+
id: z5.string(),
|
|
942
|
+
name: z5.string(),
|
|
943
|
+
status: z5.string(),
|
|
944
|
+
uptime: z5.string(),
|
|
945
|
+
app_url: z5.string().nullable(),
|
|
946
|
+
app_id: z5.string(),
|
|
947
|
+
instance_id: z5.string().nullable(),
|
|
948
|
+
configuration: z5.any().optional(),
|
|
949
|
+
exited_at: z5.string().nullable(),
|
|
950
|
+
boot_progress: z5.string().nullable(),
|
|
951
|
+
boot_error: z5.string().nullable(),
|
|
952
|
+
shutdown_progress: z5.string().nullable(),
|
|
953
|
+
image_version: z5.string().nullable()
|
|
954
|
+
});
|
|
955
|
+
var ManagedUserV20251028Schema = z5.object({
|
|
956
|
+
id: TableIdSchema,
|
|
957
|
+
username: z5.string()
|
|
958
|
+
});
|
|
959
|
+
var CvmNodeV20251028Schema = z5.object({
|
|
960
|
+
id: z5.number(),
|
|
961
|
+
name: z5.string(),
|
|
962
|
+
region_identifier: z5.string().nullable().optional()
|
|
963
|
+
});
|
|
964
|
+
var MachineInfoV20251028Schema = z5.object({
|
|
965
|
+
vcpu: z5.number(),
|
|
966
|
+
memory: z5.number(),
|
|
967
|
+
disk_size: z5.number(),
|
|
968
|
+
gpu_count: z5.number().default(0)
|
|
969
|
+
});
|
|
970
|
+
var CvmNetworkUrlsV20251028Schema = z5.object({
|
|
971
|
+
app: z5.string(),
|
|
972
|
+
instance: z5.string()
|
|
973
|
+
});
|
|
974
|
+
var CvmInfoV20251028Schema = z5.object({
|
|
975
|
+
hosted: VmInfoV20251028Schema,
|
|
976
|
+
name: z5.string(),
|
|
977
|
+
managed_user: ManagedUserV20251028Schema.nullable(),
|
|
978
|
+
node: CvmNodeV20251028Schema.nullable(),
|
|
979
|
+
listed: z5.boolean().default(false),
|
|
980
|
+
status: z5.string(),
|
|
981
|
+
in_progress: z5.boolean().default(false),
|
|
982
|
+
dapp_dashboard_url: z5.string().nullable(),
|
|
983
|
+
syslog_endpoint: z5.string().nullable(),
|
|
984
|
+
allow_upgrade: z5.boolean().default(false),
|
|
985
|
+
project_id: z5.string().nullable(),
|
|
986
|
+
project_type: z5.string().nullable(),
|
|
987
|
+
billing_period: z5.string().nullable(),
|
|
988
|
+
kms_info: KmsInfoSchema.nullable(),
|
|
989
|
+
vcpu: z5.number().nullable(),
|
|
990
|
+
memory: z5.number().nullable(),
|
|
991
|
+
disk_size: z5.number().nullable(),
|
|
992
|
+
gateway_domain: z5.string().nullable(),
|
|
993
|
+
public_urls: z5.array(CvmNetworkUrlsV20251028Schema),
|
|
994
|
+
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
995
|
+
updated_at: z5.string().nullable().optional()
|
|
996
|
+
});
|
|
997
|
+
var CvmDetailV20251028Schema = z5.object({
|
|
998
|
+
id: TableIdSchema,
|
|
999
|
+
name: z5.string(),
|
|
1000
|
+
status: z5.string(),
|
|
1001
|
+
in_progress: z5.boolean().optional().default(false),
|
|
1002
|
+
teepod_id: z5.number().nullable(),
|
|
1003
|
+
teepod: CvmNodeV20251028Schema.optional().nullable(),
|
|
1004
|
+
app_id: z5.string(),
|
|
1005
|
+
vm_uuid: z5.string().nullable(),
|
|
1006
|
+
instance_id: z5.string().nullable(),
|
|
1007
|
+
vcpu: z5.number(),
|
|
1008
|
+
memory: z5.number(),
|
|
1009
|
+
disk_size: z5.number(),
|
|
1010
|
+
base_image: z5.string().nullable(),
|
|
1011
|
+
encrypted_env_pubkey: z5.string().nullable(),
|
|
1012
|
+
listed: z5.boolean().optional().default(false),
|
|
1013
|
+
project_id: z5.string().optional().nullable(),
|
|
1014
|
+
project_type: z5.string().optional().nullable(),
|
|
1015
|
+
instance_type: z5.string().optional().nullable(),
|
|
1016
|
+
public_sysinfo: z5.boolean().optional().default(false),
|
|
1017
|
+
public_logs: z5.boolean().optional().default(false),
|
|
1018
|
+
dapp_dashboard_url: z5.string().optional().nullable(),
|
|
1019
|
+
syslog_endpoint: z5.string().optional().nullable(),
|
|
1020
|
+
kms_info: KmsInfoSchema.optional().nullable(),
|
|
1021
|
+
contract_address: z5.string().optional().nullable(),
|
|
1022
|
+
deployer_address: z5.string().optional().nullable(),
|
|
1023
|
+
scheduled_delete_at: z5.string().optional().nullable(),
|
|
1024
|
+
public_urls: z5.array(CvmNetworkUrlsV20251028Schema).optional().default([]),
|
|
1025
|
+
gateway_domain: z5.string().optional().nullable(),
|
|
1026
|
+
machine_info: MachineInfoV20251028Schema.optional().nullable(),
|
|
1027
|
+
updated_at: z5.string().optional().nullable()
|
|
1028
|
+
});
|
|
1029
|
+
var PaginatedCvmInfosV20251028Schema = z5.object({
|
|
1030
|
+
items: z5.array(CvmInfoV20251028Schema),
|
|
1031
|
+
total: z5.number(),
|
|
1032
|
+
page: z5.number(),
|
|
1033
|
+
page_size: z5.number(),
|
|
1034
|
+
pages: z5.number()
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
// src/types/cvm_info_v20260121.ts
|
|
1038
|
+
var BillingPeriodSchema = z6.enum(["skip", "hourly", "monthly"]);
|
|
1039
|
+
var KmsTypeSchema = z6.enum(["phala", "ethereum", "base", "legacy"]);
|
|
1040
|
+
var UserRefSchema = z6.object({
|
|
1041
|
+
object_type: z6.literal("user"),
|
|
1042
|
+
id: z6.string().nullable().optional(),
|
|
1043
|
+
username: z6.string().nullable().optional(),
|
|
1044
|
+
avatar_url: z6.string().nullable().optional()
|
|
1045
|
+
});
|
|
1046
|
+
var WorkspaceRefSchema = z6.object({
|
|
1047
|
+
object_type: z6.literal("workspace"),
|
|
1048
|
+
id: z6.string(),
|
|
1049
|
+
name: z6.string(),
|
|
1050
|
+
slug: z6.string().nullable().optional(),
|
|
1051
|
+
avatar_url: z6.string().nullable().optional()
|
|
1052
|
+
});
|
|
1053
|
+
var CvmResourceInfoV20260121Schema = z6.object({
|
|
1054
|
+
instance_type: z6.string().nullable().optional(),
|
|
1055
|
+
vcpu: z6.number().int().nullable().optional(),
|
|
1056
|
+
memory_in_gb: z6.number().nullable().optional(),
|
|
1057
|
+
disk_in_gb: z6.number().int().nullable().optional(),
|
|
1058
|
+
gpus: z6.number().int().nullable().optional(),
|
|
1059
|
+
compute_billing_price: z6.string().nullable().optional(),
|
|
1060
|
+
billing_period: BillingPeriodSchema.nullable().optional()
|
|
1061
|
+
});
|
|
1062
|
+
var CvmHourlyRateV20260121Schema = z6.object({
|
|
1063
|
+
total: z6.string().nullable().optional(),
|
|
1064
|
+
compute: z6.string().nullable().optional(),
|
|
1065
|
+
disk: z6.string().nullable().optional()
|
|
1066
|
+
});
|
|
1067
|
+
var CvmGpuRentalOrderInfoV20260121Schema = z6.object({
|
|
1068
|
+
order_id: z6.string(),
|
|
1069
|
+
status: z6.string(),
|
|
1070
|
+
pricing_plan: z6.string().nullable().optional(),
|
|
1071
|
+
commitment_days: z6.number().int().nullable().optional(),
|
|
1072
|
+
agreed_hourly_rate: z6.string().nullable().optional(),
|
|
1073
|
+
hourly_billing_start_time: z6.string().nullable().optional(),
|
|
1074
|
+
activated_at: z6.string().nullable().optional(),
|
|
1075
|
+
completed_at: z6.string().nullable().optional(),
|
|
1076
|
+
cancelled_at: z6.string().nullable().optional(),
|
|
1077
|
+
decoupled_at: z6.string().nullable().optional(),
|
|
1078
|
+
sku_code: z6.string().nullable().optional(),
|
|
1079
|
+
sku_display_name: z6.string().nullable().optional()
|
|
1080
|
+
});
|
|
1081
|
+
var CvmOsInfoV20260121Schema = z6.object({
|
|
1082
|
+
name: z6.string().nullable().optional(),
|
|
1083
|
+
version: z6.string().nullable().optional(),
|
|
1084
|
+
is_dev: z6.boolean().nullable().optional(),
|
|
1085
|
+
os_image_hash: z6.string().nullable().optional()
|
|
1086
|
+
});
|
|
1087
|
+
var CvmKmsInfoV20260121BaseSchema = z6.object({
|
|
1088
|
+
chain_id: z6.number().int().nullable().optional(),
|
|
1089
|
+
dstack_kms_address: z6.string().nullable().optional(),
|
|
1090
|
+
dstack_app_address: z6.string().nullable().optional(),
|
|
1091
|
+
deployer_address: z6.string().nullable().optional(),
|
|
1092
|
+
rpc_endpoint: z6.string().nullable().optional(),
|
|
1093
|
+
encrypted_env_pubkey: z6.string().nullable().optional()
|
|
1094
|
+
});
|
|
1095
|
+
var CvmKmsInfoV20260121Schema = CvmKmsInfoV20260121BaseSchema.transform((data) => {
|
|
1096
|
+
if (data.chain_id != null) {
|
|
1097
|
+
const chain = SUPPORTED_CHAINS[data.chain_id];
|
|
1098
|
+
if (chain) {
|
|
1099
|
+
return { ...data, chain };
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
return data;
|
|
1103
|
+
});
|
|
1104
|
+
var CvmProgressInfoV20260121Schema = z6.object({
|
|
1105
|
+
target: z6.string().nullable().optional(),
|
|
1106
|
+
started_at: z6.string().nullable().optional(),
|
|
1107
|
+
correlation_id: z6.string().nullable().optional()
|
|
1108
|
+
});
|
|
1109
|
+
var CvmGatewayInfoV20260121Schema = z6.object({
|
|
1110
|
+
base_domain: z6.string().nullable().optional(),
|
|
1111
|
+
cname: z6.string().nullable().optional()
|
|
1112
|
+
});
|
|
1113
|
+
var CvmLogUrlsV20260121Schema = z6.object({
|
|
1114
|
+
serial: z6.string().nullable().optional(),
|
|
1115
|
+
stdout: z6.string().nullable().optional(),
|
|
1116
|
+
stderr: z6.string().nullable().optional(),
|
|
1117
|
+
container_log_base: z6.string().nullable().optional()
|
|
1118
|
+
});
|
|
1119
|
+
var DeviceIdEntrySchema = z6.object({
|
|
1120
|
+
device_id: z6.string(),
|
|
1121
|
+
algorithm_version: z6.string(),
|
|
1122
|
+
enabled: z6.boolean()
|
|
1123
|
+
});
|
|
1124
|
+
var NodeRefSchema = z6.object({
|
|
1125
|
+
object_type: z6.literal("node"),
|
|
1126
|
+
id: z6.number().int().nullable().optional(),
|
|
1127
|
+
name: z6.string().nullable().optional(),
|
|
1128
|
+
region: z6.string().nullable().optional(),
|
|
1129
|
+
// Deprecated: resolved single device_id. Use device_ids for the full matrix.
|
|
1130
|
+
device_id: z6.string().nullable().optional(),
|
|
1131
|
+
device_ids: z6.array(DeviceIdEntrySchema).default([]),
|
|
1132
|
+
ppid: z6.string().nullable().optional(),
|
|
1133
|
+
status: z6.string().nullable().optional(),
|
|
1134
|
+
version: z6.string().nullable().optional()
|
|
1135
|
+
});
|
|
1136
|
+
var CvmNodeInfoV20260121Schema = NodeRefSchema;
|
|
1137
|
+
var CvmInfoV20260121Schema = z6.object({
|
|
1138
|
+
id: z6.string(),
|
|
1139
|
+
name: z6.string(),
|
|
1140
|
+
app_id: z6.string().nullable().optional(),
|
|
1141
|
+
vm_uuid: z6.string().nullable().optional(),
|
|
1142
|
+
instance_id: z6.string().nullable().optional(),
|
|
1143
|
+
resource: CvmResourceInfoV20260121Schema,
|
|
1144
|
+
node_info: NodeRefSchema.nullable().optional(),
|
|
1145
|
+
os: CvmOsInfoV20260121Schema.nullable().optional(),
|
|
1146
|
+
kms_type: KmsTypeSchema.nullable().optional(),
|
|
1147
|
+
kms_info: CvmKmsInfoV20260121Schema.nullable().optional(),
|
|
1148
|
+
status: z6.string(),
|
|
1149
|
+
in_progress: z6.boolean().optional().default(false),
|
|
1150
|
+
progress: CvmProgressInfoV20260121Schema.nullable().optional(),
|
|
1151
|
+
compose_hash: z6.string().nullable().optional(),
|
|
1152
|
+
docker_compose_hash: z6.string().nullable().optional(),
|
|
1153
|
+
pre_launch_script_hash: z6.string().nullable().optional(),
|
|
1154
|
+
gateway: CvmGatewayInfoV20260121Schema,
|
|
1155
|
+
logs: CvmLogUrlsV20260121Schema.optional().default({}),
|
|
1156
|
+
services: z6.array(z6.record(z6.any())).optional().default([]),
|
|
1157
|
+
endpoints: z6.array(CvmNetworkUrlsV20251028Schema).nullable().optional(),
|
|
1158
|
+
public_logs: z6.boolean().optional(),
|
|
1159
|
+
public_sysinfo: z6.boolean().optional(),
|
|
1160
|
+
public_tcbinfo: z6.boolean().optional(),
|
|
1161
|
+
gateway_enabled: z6.boolean().optional(),
|
|
1162
|
+
secure_time: z6.boolean().optional(),
|
|
1163
|
+
listed: z6.boolean().optional().default(false),
|
|
1164
|
+
storage_fs: z6.string().optional(),
|
|
1165
|
+
workspace: WorkspaceRefSchema.nullable().optional(),
|
|
1166
|
+
creator: UserRefSchema.nullable().optional(),
|
|
1167
|
+
created_at: z6.string().nullable().optional(),
|
|
1168
|
+
deleted_at: z6.string().nullable().optional(),
|
|
1169
|
+
project_type: z6.string().nullable().optional(),
|
|
1170
|
+
hourly_rate: CvmHourlyRateV20260121Schema.nullable().optional(),
|
|
1171
|
+
billing_interval: z6.string().nullable().optional(),
|
|
1172
|
+
gpu_rental_order: CvmGpuRentalOrderInfoV20260121Schema.nullable().optional()
|
|
1173
|
+
});
|
|
1174
|
+
var CvmInfoV20260522Schema = CvmInfoV20260121Schema.extend({
|
|
1175
|
+
id: z6.string()
|
|
1176
|
+
});
|
|
1177
|
+
var CvmInfoDetailV20260121Schema = CvmInfoV20260121Schema.extend({
|
|
1178
|
+
compose_file: z6.union([z6.record(z6.any()), z6.string()]).nullable().optional()
|
|
1179
|
+
});
|
|
1180
|
+
var CvmInfoDetailV20260522Schema = CvmInfoV20260522Schema.extend({
|
|
1181
|
+
compose_file: z6.union([z6.record(z6.any()), z6.string()]).nullable().optional()
|
|
1182
|
+
});
|
|
1183
|
+
var PaginatedCvmInfosV20260121Schema = z6.object({
|
|
1184
|
+
items: z6.array(CvmInfoV20260121Schema),
|
|
1185
|
+
total: z6.number(),
|
|
1186
|
+
page: z6.number(),
|
|
1187
|
+
page_size: z6.number(),
|
|
1188
|
+
pages: z6.number()
|
|
1189
|
+
});
|
|
1190
|
+
var PaginatedCvmInfosV20260522Schema = PaginatedCvmInfosV20260121Schema.extend({
|
|
1191
|
+
items: z6.array(CvmInfoV20260522Schema)
|
|
1192
|
+
});
|
|
1193
|
+
|
|
895
1194
|
// src/utils/validate-parameters.ts
|
|
896
1195
|
function validateActionParameters(parameters) {
|
|
897
1196
|
if (parameters?.schema !== void 0 && parameters?.schema !== false) {
|
|
@@ -1039,43 +1338,44 @@ function defineAction(schema, fn) {
|
|
|
1039
1338
|
}
|
|
1040
1339
|
|
|
1041
1340
|
// src/actions/get_available_nodes.ts
|
|
1042
|
-
var AvailableOSImageSchema =
|
|
1043
|
-
name:
|
|
1044
|
-
is_dev:
|
|
1045
|
-
version:
|
|
1046
|
-
|
|
1047
|
-
|
|
1341
|
+
var AvailableOSImageSchema = z7.object({
|
|
1342
|
+
name: z7.string(),
|
|
1343
|
+
is_dev: z7.boolean(),
|
|
1344
|
+
version: z7.union([
|
|
1345
|
+
z7.tuple([z7.number(), z7.number(), z7.number()]),
|
|
1346
|
+
z7.tuple([z7.number(), z7.number(), z7.number(), z7.number()])
|
|
1048
1347
|
]),
|
|
1049
|
-
os_image_hash:
|
|
1348
|
+
os_image_hash: z7.string().nullable().optional()
|
|
1050
1349
|
}).passthrough();
|
|
1051
|
-
var TeepodCapacitySchema =
|
|
1052
|
-
teepod_id:
|
|
1053
|
-
name:
|
|
1054
|
-
listed:
|
|
1055
|
-
resource_score:
|
|
1056
|
-
remaining_vcpu:
|
|
1057
|
-
remaining_memory:
|
|
1058
|
-
remaining_cvm_slots:
|
|
1059
|
-
images:
|
|
1060
|
-
support_onchain_kms:
|
|
1061
|
-
fmspc:
|
|
1062
|
-
device_id:
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1350
|
+
var TeepodCapacitySchema = z7.object({
|
|
1351
|
+
teepod_id: z7.number(),
|
|
1352
|
+
name: z7.string(),
|
|
1353
|
+
listed: z7.boolean(),
|
|
1354
|
+
resource_score: z7.number(),
|
|
1355
|
+
remaining_vcpu: z7.number(),
|
|
1356
|
+
remaining_memory: z7.number(),
|
|
1357
|
+
remaining_cvm_slots: z7.number(),
|
|
1358
|
+
images: z7.array(AvailableOSImageSchema),
|
|
1359
|
+
support_onchain_kms: z7.boolean().optional(),
|
|
1360
|
+
fmspc: z7.string().nullable().optional(),
|
|
1361
|
+
device_id: z7.string().nullable().optional(),
|
|
1362
|
+
device_ids: z7.array(DeviceIdEntrySchema).default([]),
|
|
1363
|
+
region_identifier: z7.string().nullable().optional(),
|
|
1364
|
+
default_kms: z7.string().nullable().optional(),
|
|
1365
|
+
kms_list: z7.array(z7.string()).default([])
|
|
1066
1366
|
}).passthrough();
|
|
1067
|
-
var ResourceThresholdSchema =
|
|
1068
|
-
max_instances:
|
|
1069
|
-
max_vcpu:
|
|
1070
|
-
max_memory:
|
|
1071
|
-
max_disk:
|
|
1367
|
+
var ResourceThresholdSchema = z7.object({
|
|
1368
|
+
max_instances: z7.number().nullable().optional(),
|
|
1369
|
+
max_vcpu: z7.number().nullable().optional(),
|
|
1370
|
+
max_memory: z7.number().nullable().optional(),
|
|
1371
|
+
max_disk: z7.number().nullable().optional()
|
|
1072
1372
|
}).passthrough();
|
|
1073
|
-
var AvailableNodesSchema =
|
|
1074
|
-
tier:
|
|
1373
|
+
var AvailableNodesSchema = z7.object({
|
|
1374
|
+
tier: z7.string(),
|
|
1075
1375
|
// TeamTier is string enum
|
|
1076
1376
|
capacity: ResourceThresholdSchema,
|
|
1077
|
-
nodes:
|
|
1078
|
-
kms_list:
|
|
1377
|
+
nodes: z7.array(TeepodCapacitySchema),
|
|
1378
|
+
kms_list: z7.array(KmsInfoSchema)
|
|
1079
1379
|
}).passthrough();
|
|
1080
1380
|
var { action: getAvailableNodes, safeAction: safeGetAvailableNodes } = defineSimpleAction(
|
|
1081
1381
|
AvailableNodesSchema,
|
|
@@ -1085,42 +1385,42 @@ var { action: getAvailableNodes, safeAction: safeGetAvailableNodes } = defineSim
|
|
|
1085
1385
|
);
|
|
1086
1386
|
|
|
1087
1387
|
// src/actions/get_cvm_create_resources.ts
|
|
1088
|
-
import { z as
|
|
1089
|
-
var ResourceIdV20260121Schema =
|
|
1090
|
-
var HashIdSchema =
|
|
1091
|
-
var GpuAvailabilitySchema =
|
|
1092
|
-
has_reserved_gpus:
|
|
1093
|
-
reserved_gpu_count:
|
|
1094
|
-
has_public_gpus:
|
|
1095
|
-
public_gpu_count:
|
|
1388
|
+
import { z as z8 } from "zod";
|
|
1389
|
+
var ResourceIdV20260121Schema = z8.union([z8.number(), z8.string()]);
|
|
1390
|
+
var HashIdSchema = z8.string();
|
|
1391
|
+
var GpuAvailabilitySchema = z8.object({
|
|
1392
|
+
has_reserved_gpus: z8.boolean(),
|
|
1393
|
+
reserved_gpu_count: z8.number(),
|
|
1394
|
+
has_public_gpus: z8.boolean(),
|
|
1395
|
+
public_gpu_count: z8.number()
|
|
1096
1396
|
}).passthrough();
|
|
1097
|
-
var CvmCreateKmsResourceV20260121Schema =
|
|
1397
|
+
var CvmCreateKmsResourceV20260121Schema = z8.object({
|
|
1098
1398
|
id: ResourceIdV20260121Schema,
|
|
1099
|
-
slug:
|
|
1100
|
-
url:
|
|
1101
|
-
version:
|
|
1102
|
-
kms_type:
|
|
1103
|
-
chain_id:
|
|
1399
|
+
slug: z8.string().nullable().optional(),
|
|
1400
|
+
url: z8.string(),
|
|
1401
|
+
version: z8.string().nullable().optional(),
|
|
1402
|
+
kms_type: z8.string(),
|
|
1403
|
+
chain_id: z8.number().nullable().optional(),
|
|
1104
1404
|
kms_contract_id: ResourceIdV20260121Schema.nullable().optional(),
|
|
1105
|
-
kms_contract_address:
|
|
1106
|
-
gateway_app_id:
|
|
1107
|
-
supported_os_images:
|
|
1405
|
+
kms_contract_address: z8.string().nullable().optional(),
|
|
1406
|
+
gateway_app_id: z8.string().nullable().optional(),
|
|
1407
|
+
supported_os_images: z8.array(z8.string()).default([])
|
|
1108
1408
|
}).passthrough();
|
|
1109
|
-
var CvmCreateNodeKmsRelationV20260121Schema =
|
|
1110
|
-
teepod_id:
|
|
1409
|
+
var CvmCreateNodeKmsRelationV20260121Schema = z8.object({
|
|
1410
|
+
teepod_id: z8.number(),
|
|
1111
1411
|
kms_id: ResourceIdV20260121Schema,
|
|
1112
|
-
kms_type:
|
|
1412
|
+
kms_type: z8.string(),
|
|
1113
1413
|
kms_contract_id: ResourceIdV20260121Schema.nullable().optional(),
|
|
1114
|
-
kms_contract_address:
|
|
1115
|
-
supported_os_images:
|
|
1414
|
+
kms_contract_address: z8.string().nullable().optional(),
|
|
1415
|
+
supported_os_images: z8.array(z8.string()).default([])
|
|
1116
1416
|
}).passthrough();
|
|
1117
|
-
var CvmCreateGatewayResourceV20260121Schema =
|
|
1417
|
+
var CvmCreateGatewayResourceV20260121Schema = z8.object({
|
|
1118
1418
|
id: ResourceIdV20260121Schema,
|
|
1119
|
-
teepod_id:
|
|
1419
|
+
teepod_id: z8.number().nullable().optional(),
|
|
1120
1420
|
kms_contract_id: ResourceIdV20260121Schema,
|
|
1121
|
-
rpc_url:
|
|
1122
|
-
domain_suffix:
|
|
1123
|
-
enabled:
|
|
1421
|
+
rpc_url: z8.string().nullable().optional(),
|
|
1422
|
+
domain_suffix: z8.string().nullable().optional(),
|
|
1423
|
+
enabled: z8.boolean()
|
|
1124
1424
|
}).passthrough();
|
|
1125
1425
|
var CvmCreateKmsResourceSchema = CvmCreateKmsResourceV20260121Schema.extend({
|
|
1126
1426
|
id: HashIdSchema,
|
|
@@ -1134,31 +1434,31 @@ var CvmCreateGatewayResourceSchema = CvmCreateGatewayResourceV20260121Schema.ext
|
|
|
1134
1434
|
id: HashIdSchema,
|
|
1135
1435
|
kms_contract_id: HashIdSchema
|
|
1136
1436
|
});
|
|
1137
|
-
var CvmCreateInstanceTypeResourceSchema =
|
|
1138
|
-
id:
|
|
1139
|
-
name:
|
|
1140
|
-
vcpu:
|
|
1141
|
-
memory_mb:
|
|
1142
|
-
default_disk_size_gb:
|
|
1143
|
-
requires_gpu:
|
|
1144
|
-
requires_gpu_count:
|
|
1145
|
-
family:
|
|
1146
|
-
display_order:
|
|
1437
|
+
var CvmCreateInstanceTypeResourceSchema = z8.object({
|
|
1438
|
+
id: z8.string(),
|
|
1439
|
+
name: z8.string(),
|
|
1440
|
+
vcpu: z8.number(),
|
|
1441
|
+
memory_mb: z8.number(),
|
|
1442
|
+
default_disk_size_gb: z8.number(),
|
|
1443
|
+
requires_gpu: z8.boolean(),
|
|
1444
|
+
requires_gpu_count: z8.number(),
|
|
1445
|
+
family: z8.string().nullable().optional(),
|
|
1446
|
+
display_order: z8.number().nullable().optional()
|
|
1147
1447
|
}).passthrough();
|
|
1148
|
-
var CvmCreateResourceGraphV20260121Schema =
|
|
1149
|
-
tier:
|
|
1448
|
+
var CvmCreateResourceGraphV20260121Schema = z8.object({
|
|
1449
|
+
tier: z8.string(),
|
|
1150
1450
|
capacity: ResourceThresholdSchema,
|
|
1151
|
-
nodes:
|
|
1152
|
-
kms_nodes:
|
|
1153
|
-
node_kms_relations:
|
|
1154
|
-
gateway_nodes:
|
|
1155
|
-
instance_types:
|
|
1451
|
+
nodes: z8.array(TeepodCapacitySchema),
|
|
1452
|
+
kms_nodes: z8.array(CvmCreateKmsResourceV20260121Schema),
|
|
1453
|
+
node_kms_relations: z8.array(CvmCreateNodeKmsRelationV20260121Schema),
|
|
1454
|
+
gateway_nodes: z8.array(CvmCreateGatewayResourceV20260121Schema),
|
|
1455
|
+
instance_types: z8.array(CvmCreateInstanceTypeResourceSchema),
|
|
1156
1456
|
gpu_availability: GpuAvailabilitySchema
|
|
1157
1457
|
}).passthrough();
|
|
1158
1458
|
var CvmCreateResourceGraphV20260522Schema = CvmCreateResourceGraphV20260121Schema.extend({
|
|
1159
|
-
kms_nodes:
|
|
1160
|
-
node_kms_relations:
|
|
1161
|
-
gateway_nodes:
|
|
1459
|
+
kms_nodes: z8.array(CvmCreateKmsResourceSchema),
|
|
1460
|
+
node_kms_relations: z8.array(CvmCreateNodeKmsRelationSchema),
|
|
1461
|
+
gateway_nodes: z8.array(CvmCreateGatewayResourceSchema)
|
|
1162
1462
|
});
|
|
1163
1463
|
var CvmCreateResourceGraphSchema = CvmCreateResourceGraphV20260522Schema;
|
|
1164
1464
|
function getSchemaForVersion2(version) {
|
|
@@ -1186,33 +1486,33 @@ async function safeGetCvmCreateResources(client, parameters) {
|
|
|
1186
1486
|
}
|
|
1187
1487
|
|
|
1188
1488
|
// src/actions/list-instance-types.ts
|
|
1189
|
-
import { z as
|
|
1190
|
-
var InstanceTypeSchema =
|
|
1191
|
-
id:
|
|
1192
|
-
name:
|
|
1193
|
-
description:
|
|
1194
|
-
vcpu:
|
|
1195
|
-
memory_mb:
|
|
1196
|
-
hourly_rate:
|
|
1197
|
-
requires_gpu:
|
|
1198
|
-
default_disk_size_gb:
|
|
1199
|
-
family:
|
|
1489
|
+
import { z as z9 } from "zod";
|
|
1490
|
+
var InstanceTypeSchema = z9.object({
|
|
1491
|
+
id: z9.string(),
|
|
1492
|
+
name: z9.string(),
|
|
1493
|
+
description: z9.string(),
|
|
1494
|
+
vcpu: z9.number(),
|
|
1495
|
+
memory_mb: z9.number(),
|
|
1496
|
+
hourly_rate: z9.string(),
|
|
1497
|
+
requires_gpu: z9.boolean(),
|
|
1498
|
+
default_disk_size_gb: z9.number().default(20),
|
|
1499
|
+
family: z9.string().nullable()
|
|
1200
1500
|
}).passthrough();
|
|
1201
|
-
var FamilyGroupSchema =
|
|
1202
|
-
name:
|
|
1203
|
-
items:
|
|
1204
|
-
total:
|
|
1501
|
+
var FamilyGroupSchema = z9.object({
|
|
1502
|
+
name: z9.string(),
|
|
1503
|
+
items: z9.array(InstanceTypeSchema),
|
|
1504
|
+
total: z9.number()
|
|
1205
1505
|
}).strict();
|
|
1206
|
-
var AllFamiliesResponseSchema =
|
|
1207
|
-
result:
|
|
1506
|
+
var AllFamiliesResponseSchema = z9.object({
|
|
1507
|
+
result: z9.array(FamilyGroupSchema)
|
|
1208
1508
|
}).strict();
|
|
1209
|
-
var FamilyInstanceTypesResponseSchema =
|
|
1210
|
-
items:
|
|
1211
|
-
total:
|
|
1212
|
-
family:
|
|
1509
|
+
var FamilyInstanceTypesResponseSchema = z9.object({
|
|
1510
|
+
items: z9.array(InstanceTypeSchema),
|
|
1511
|
+
total: z9.number(),
|
|
1512
|
+
family: z9.string()
|
|
1213
1513
|
}).strict();
|
|
1214
|
-
var ListFamilyInstanceTypesRequestSchema =
|
|
1215
|
-
family:
|
|
1514
|
+
var ListFamilyInstanceTypesRequestSchema = z9.object({
|
|
1515
|
+
family: z9.string()
|
|
1216
1516
|
}).strict();
|
|
1217
1517
|
var { action: listAllInstanceTypeFamilies, safeAction: safeListAllInstanceTypeFamilies } = defineAction(
|
|
1218
1518
|
AllFamiliesResponseSchema,
|
|
@@ -1226,25 +1526,32 @@ var { action: listFamilyInstanceTypes, safeAction: safeListFamilyInstanceTypes }
|
|
|
1226
1526
|
});
|
|
1227
1527
|
|
|
1228
1528
|
// src/actions/workspaces/list_workspaces.ts
|
|
1229
|
-
import { z as
|
|
1230
|
-
var WorkspaceResponseSchema =
|
|
1231
|
-
id:
|
|
1232
|
-
name:
|
|
1233
|
-
slug:
|
|
1234
|
-
avatar_url:
|
|
1235
|
-
tier:
|
|
1236
|
-
role:
|
|
1237
|
-
is_default:
|
|
1238
|
-
created_at:
|
|
1239
|
-
confidential_models_enabled:
|
|
1529
|
+
import { z as z10 } from "zod";
|
|
1530
|
+
var WorkspaceResponseSchema = z10.object({
|
|
1531
|
+
id: z10.string(),
|
|
1532
|
+
name: z10.string(),
|
|
1533
|
+
slug: z10.string().nullable(),
|
|
1534
|
+
avatar_url: z10.string().nullable().optional(),
|
|
1535
|
+
tier: z10.string(),
|
|
1536
|
+
role: z10.string(),
|
|
1537
|
+
is_default: z10.boolean(),
|
|
1538
|
+
created_at: z10.string(),
|
|
1539
|
+
confidential_models_enabled: z10.boolean().optional(),
|
|
1540
|
+
/**
|
|
1541
|
+
* Billing lifecycle state. A suspended workspace still runs but owes money;
|
|
1542
|
+
* an abandoned one is closed and read-only until its balance is settled.
|
|
1543
|
+
*/
|
|
1544
|
+
billing_status: z10.enum(["active", "suspended", "abandoned"]).default("active"),
|
|
1545
|
+
/** When the workspace was suspended. Null unless billing_status is suspended. */
|
|
1546
|
+
suspended_at: z10.string().nullable().optional()
|
|
1240
1547
|
}).passthrough();
|
|
1241
|
-
var PaginationMetadataSchema =
|
|
1242
|
-
has_more:
|
|
1243
|
-
next_cursor:
|
|
1244
|
-
total:
|
|
1548
|
+
var PaginationMetadataSchema = z10.object({
|
|
1549
|
+
has_more: z10.boolean(),
|
|
1550
|
+
next_cursor: z10.string().nullable(),
|
|
1551
|
+
total: z10.number().nullable()
|
|
1245
1552
|
}).passthrough();
|
|
1246
|
-
var ListWorkspacesSchema =
|
|
1247
|
-
data:
|
|
1553
|
+
var ListWorkspacesSchema = z10.object({
|
|
1554
|
+
data: z10.array(WorkspaceResponseSchema),
|
|
1248
1555
|
pagination: PaginationMetadataSchema
|
|
1249
1556
|
}).passthrough();
|
|
1250
1557
|
var { action: listWorkspaces, safeAction: safeListWorkspaces } = defineAction(ListWorkspacesSchema, async (client, request) => {
|
|
@@ -1260,235 +1567,6 @@ var { action: getWorkspace, safeAction: safeGetWorkspace } = defineAction(Worksp
|
|
|
1260
1567
|
return await client.get(`/workspaces/${teamSlug}`);
|
|
1261
1568
|
});
|
|
1262
1569
|
|
|
1263
|
-
// src/types/cvm_info_v20251028.ts
|
|
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()
|
|
1289
|
-
});
|
|
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)
|
|
1295
|
-
});
|
|
1296
|
-
var CvmNetworkUrlsV20251028Schema = z9.object({
|
|
1297
|
-
app: z9.string(),
|
|
1298
|
-
instance: z9.string()
|
|
1299
|
-
});
|
|
1300
|
-
var CvmInfoV20251028Schema = z9.object({
|
|
1301
|
-
hosted: VmInfoV20251028Schema,
|
|
1302
|
-
name: z9.string(),
|
|
1303
|
-
managed_user: ManagedUserV20251028Schema.nullable(),
|
|
1304
|
-
node: CvmNodeV20251028Schema.nullable(),
|
|
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(),
|
|
1314
|
-
kms_info: KmsInfoSchema.nullable(),
|
|
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),
|
|
1320
|
-
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
1321
|
-
updated_at: z9.string().nullable().optional()
|
|
1322
|
-
});
|
|
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(),
|
|
1329
|
-
teepod: CvmNodeV20251028Schema.optional().nullable(),
|
|
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(),
|
|
1346
|
-
kms_info: KmsInfoSchema.optional().nullable(),
|
|
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(),
|
|
1352
|
-
machine_info: MachineInfoV20251028Schema.optional().nullable(),
|
|
1353
|
-
updated_at: z9.string().optional().nullable()
|
|
1354
|
-
});
|
|
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()
|
|
1361
|
-
});
|
|
1362
|
-
|
|
1363
|
-
// src/types/cvm_info_v20260121.ts
|
|
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(),
|
|
1387
|
-
billing_period: BillingPeriodSchema.nullable().optional()
|
|
1388
|
-
});
|
|
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()
|
|
1394
|
-
});
|
|
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()
|
|
1402
|
-
});
|
|
1403
|
-
var CvmKmsInfoV20260121Schema = CvmKmsInfoV20260121BaseSchema.transform((data) => {
|
|
1404
|
-
if (data.chain_id != null) {
|
|
1405
|
-
const chain = SUPPORTED_CHAINS[data.chain_id];
|
|
1406
|
-
if (chain) {
|
|
1407
|
-
return { ...data, chain };
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
return data;
|
|
1411
|
-
});
|
|
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()
|
|
1436
|
-
});
|
|
1437
|
-
var CvmNodeInfoV20260121Schema = NodeRefSchema;
|
|
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(),
|
|
1444
|
-
resource: CvmResourceInfoV20260121Schema,
|
|
1445
|
-
node_info: NodeRefSchema.nullable().optional(),
|
|
1446
|
-
os: CvmOsInfoV20260121Schema.nullable().optional(),
|
|
1447
|
-
kms_type: KmsTypeSchema.nullable().optional(),
|
|
1448
|
-
kms_info: CvmKmsInfoV20260121Schema.nullable().optional(),
|
|
1449
|
-
status: z10.string(),
|
|
1450
|
-
in_progress: z10.boolean().optional().default(false),
|
|
1451
|
-
progress: CvmProgressInfoV20260121Schema.nullable().optional(),
|
|
1452
|
-
compose_hash: z10.string().nullable().optional(),
|
|
1453
|
-
docker_compose_hash: z10.string().nullable().optional(),
|
|
1454
|
-
pre_launch_script_hash: z10.string().nullable().optional(),
|
|
1455
|
-
gateway: CvmGatewayInfoV20260121Schema,
|
|
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(),
|
|
1466
|
-
workspace: WorkspaceRefSchema.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()
|
|
1474
|
-
});
|
|
1475
|
-
var CvmInfoDetailV20260121Schema = CvmInfoV20260121Schema.extend({
|
|
1476
|
-
compose_file: z10.union([z10.record(z10.any()), z10.string()]).nullable().optional()
|
|
1477
|
-
});
|
|
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)
|
|
1490
|
-
});
|
|
1491
|
-
|
|
1492
1570
|
// src/types/cvm_id.ts
|
|
1493
1571
|
import { z as z11 } from "zod";
|
|
1494
1572
|
|
|
@@ -1639,9 +1717,8 @@ import { z as z12 } from "zod";
|
|
|
1639
1717
|
var GetCvmListRequestSchema = z12.object({
|
|
1640
1718
|
page: z12.number().int().min(1).optional(),
|
|
1641
1719
|
page_size: z12.number().int().min(1).optional(),
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
user_id: z12.string().optional()
|
|
1720
|
+
family: z12.enum(["all", "cpu", "gpu"]).optional(),
|
|
1721
|
+
instance_types: z12.array(z12.string()).optional()
|
|
1645
1722
|
}).strict();
|
|
1646
1723
|
function getSchemaForVersion4(version) {
|
|
1647
1724
|
if (version === "2025-10-28") return PaginatedCvmInfosV20251028Schema;
|
|
@@ -1698,10 +1775,18 @@ var LooseAppComposeSchema = z13.object({
|
|
|
1698
1775
|
features: z13.array(z13.string()).optional(),
|
|
1699
1776
|
name: z13.string().optional(),
|
|
1700
1777
|
manifest_version: z13.number().optional(),
|
|
1778
|
+
runner: z13.string().optional(),
|
|
1701
1779
|
kms_enabled: z13.boolean().optional(),
|
|
1780
|
+
gateway_enabled: z13.boolean().optional(),
|
|
1781
|
+
tproxy_enabled: z13.boolean().optional(),
|
|
1782
|
+
local_key_provider_enabled: z13.boolean().optional(),
|
|
1783
|
+
key_provider: z13.enum(["none", "kms", "local", "tpm"]).optional(),
|
|
1784
|
+
key_provider_id: z13.string().optional(),
|
|
1702
1785
|
public_logs: z13.boolean().optional(),
|
|
1703
1786
|
public_sysinfo: z13.boolean().optional(),
|
|
1704
|
-
|
|
1787
|
+
public_tcbinfo: z13.boolean().optional(),
|
|
1788
|
+
no_instance_id: z13.boolean().optional(),
|
|
1789
|
+
secure_time: z13.boolean().optional(),
|
|
1705
1790
|
port_policy: z13.object({
|
|
1706
1791
|
ports: z13.array(
|
|
1707
1792
|
z13.object({
|
|
@@ -1712,6 +1797,7 @@ var LooseAppComposeSchema = z13.object({
|
|
|
1712
1797
|
restrict_mode: z13.boolean()
|
|
1713
1798
|
}).optional(),
|
|
1714
1799
|
storage_fs: z13.enum(["ext4", "zfs"]).optional(),
|
|
1800
|
+
swap_size: z13.string().optional(),
|
|
1715
1801
|
pre_launch_script: z13.string().optional(),
|
|
1716
1802
|
env_pubkey: z13.string().optional(),
|
|
1717
1803
|
salt: z13.string().optional().nullable()
|
|
@@ -1732,7 +1818,9 @@ var ProvisionCvmSchema = z14.object({
|
|
|
1732
1818
|
teepod_id: z14.number().nullable().optional(),
|
|
1733
1819
|
// Will be transformed to node_id
|
|
1734
1820
|
node_id: z14.number().nullable().optional(),
|
|
1735
|
-
|
|
1821
|
+
/** @deprecated Identifies a KMS node, not the on-chain KMS contract. Use kms_contract_id. */
|
|
1822
|
+
kms_id: z14.string().nullable().optional(),
|
|
1823
|
+
kms_contract_id: z14.union([z14.string(), z14.number()]).nullable().optional()
|
|
1736
1824
|
}).passthrough().transform((data) => {
|
|
1737
1825
|
if ("teepod_id" in data && data.teepod_id !== void 0) {
|
|
1738
1826
|
const { teepod_id, ...rest } = data;
|
|
@@ -1764,13 +1852,24 @@ var ProvisionCvmRequestSchema = z14.object({
|
|
|
1764
1852
|
name: z14.string().optional().default(""),
|
|
1765
1853
|
// optional with default empty string
|
|
1766
1854
|
kms_enabled: z14.boolean().optional(),
|
|
1767
|
-
public_logs: z14.boolean().optional(),
|
|
1768
|
-
public_sysinfo: z14.boolean().optional(),
|
|
1769
1855
|
gateway_enabled: z14.boolean().optional(),
|
|
1770
1856
|
// recommended
|
|
1771
1857
|
tproxy_enabled: z14.boolean().optional(),
|
|
1772
1858
|
// deprecated, for compatibility
|
|
1773
|
-
|
|
1859
|
+
local_key_provider_enabled: z14.boolean().optional(),
|
|
1860
|
+
key_provider: z14.enum(["none", "kms", "local", "tpm"]).optional(),
|
|
1861
|
+
key_provider_id: z14.string().optional(),
|
|
1862
|
+
public_logs: z14.boolean().optional(),
|
|
1863
|
+
public_sysinfo: z14.boolean().optional(),
|
|
1864
|
+
public_tcbinfo: z14.boolean().optional(),
|
|
1865
|
+
no_instance_id: z14.boolean().optional(),
|
|
1866
|
+
secure_time: z14.boolean().optional(),
|
|
1867
|
+
storage_fs: z14.enum(["ext4", "zfs"]).optional(),
|
|
1868
|
+
swap_size: z14.string().optional(),
|
|
1869
|
+
port_policy: z14.object({
|
|
1870
|
+
ports: z14.array(z14.object({ port: z14.number(), pp: z14.boolean() })),
|
|
1871
|
+
restrict_mode: z14.boolean()
|
|
1872
|
+
}).optional()
|
|
1774
1873
|
}).passthrough().superRefine((data, ctx) => {
|
|
1775
1874
|
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1776
1875
|
}),
|
|
@@ -1871,14 +1970,40 @@ var CommitCvmProvisionRequestSchema = z15.object({
|
|
|
1871
1970
|
encrypted_env: z15.string().optional().nullable(),
|
|
1872
1971
|
app_id: z15.string(),
|
|
1873
1972
|
compose_hash: z15.string(),
|
|
1973
|
+
/** @deprecated Identifies a KMS node, not the on-chain KMS contract. Use kms_contract_id. */
|
|
1874
1974
|
kms_id: z15.string().optional(),
|
|
1975
|
+
kms_contract_id: z15.union([z15.string(), z15.number()]).optional(),
|
|
1875
1976
|
contract_address: z15.string().optional(),
|
|
1876
1977
|
deployer_address: z15.string().optional(),
|
|
1877
1978
|
env_keys: z15.array(z15.string()).optional().nullable()
|
|
1878
1979
|
}).passthrough();
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1980
|
+
function getSchemaForVersion5(version) {
|
|
1981
|
+
if (version === "2026-01-21") return CommitCvmProvisionV20260121Schema;
|
|
1982
|
+
return CommitCvmProvisionV20260522Schema;
|
|
1983
|
+
}
|
|
1984
|
+
async function commitCvmProvision(client, payload) {
|
|
1985
|
+
const response = await client.post("/cvms", payload);
|
|
1986
|
+
return getSchemaForVersion5(client.config.version).parse(
|
|
1987
|
+
response
|
|
1988
|
+
);
|
|
1989
|
+
}
|
|
1990
|
+
async function safeCommitCvmProvision(client, payload) {
|
|
1991
|
+
try {
|
|
1992
|
+
const data = await commitCvmProvision(client, payload);
|
|
1993
|
+
return { success: true, data };
|
|
1994
|
+
} catch (error) {
|
|
1995
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
1996
|
+
return { success: false, error };
|
|
1997
|
+
}
|
|
1998
|
+
return {
|
|
1999
|
+
success: false,
|
|
2000
|
+
error: {
|
|
2001
|
+
name: "Error",
|
|
2002
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
1882
2007
|
|
|
1883
2008
|
// src/utils/get_compose_hash.ts
|
|
1884
2009
|
import crypto from "crypto";
|
|
@@ -1969,7 +2094,8 @@ var ProvisionCvmComposeFileUpdateResultSchema = z16.object({
|
|
|
1969
2094
|
device_id: z16.string().nullable(),
|
|
1970
2095
|
compose_hash: z16.string(),
|
|
1971
2096
|
kms_info: KmsInfoSchema.nullable().optional(),
|
|
1972
|
-
compose_hash_registered: z16.boolean().optional().default(false)
|
|
2097
|
+
compose_hash_registered: z16.boolean().optional().default(false),
|
|
2098
|
+
compose_unchanged: z16.boolean().optional().default(false)
|
|
1973
2099
|
}).passthrough();
|
|
1974
2100
|
var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmComposeFileUpdate } = defineAction(ProvisionCvmComposeFileUpdateResultSchema, async (client, request) => {
|
|
1975
2101
|
const validatedRequest = ProvisionCvmComposeFileUpdateRequestSchema.parse(request);
|
|
@@ -2133,9 +2259,14 @@ var UpdateDockerComposePreconditionRequiredSchema = z19.object({
|
|
|
2133
2259
|
device_id: z19.string(),
|
|
2134
2260
|
kms_info: KmsInfoSchema
|
|
2135
2261
|
});
|
|
2262
|
+
var UpdateDockerComposeNoChangeSchema = z19.object({
|
|
2263
|
+
status: z19.literal("no_change"),
|
|
2264
|
+
message: z19.string()
|
|
2265
|
+
});
|
|
2136
2266
|
var UpdateDockerComposeResultSchema = z19.union([
|
|
2137
2267
|
UpdateDockerComposeInProgressSchema,
|
|
2138
|
-
UpdateDockerComposePreconditionRequiredSchema
|
|
2268
|
+
UpdateDockerComposePreconditionRequiredSchema,
|
|
2269
|
+
UpdateDockerComposeNoChangeSchema
|
|
2139
2270
|
]);
|
|
2140
2271
|
var { action: updateDockerCompose, safeAction: safeUpdateDockerCompose } = defineAction(UpdateDockerComposeResultSchema, async (client, request) => {
|
|
2141
2272
|
const validatedRequest = UpdateDockerComposeRequestSchema.parse(request);
|
|
@@ -2217,9 +2348,14 @@ var UpdatePreLaunchScriptPreconditionRequiredSchema = z20.object({
|
|
|
2217
2348
|
device_id: z20.string(),
|
|
2218
2349
|
kms_info: KmsInfoSchema
|
|
2219
2350
|
});
|
|
2351
|
+
var UpdatePreLaunchScriptNoChangeSchema = z20.object({
|
|
2352
|
+
status: z20.literal("no_change"),
|
|
2353
|
+
message: z20.string()
|
|
2354
|
+
});
|
|
2220
2355
|
var UpdatePreLaunchScriptResultSchema = z20.union([
|
|
2221
2356
|
UpdatePreLaunchScriptInProgressSchema,
|
|
2222
|
-
UpdatePreLaunchScriptPreconditionRequiredSchema
|
|
2357
|
+
UpdatePreLaunchScriptPreconditionRequiredSchema,
|
|
2358
|
+
UpdatePreLaunchScriptNoChangeSchema
|
|
2223
2359
|
]);
|
|
2224
2360
|
var { action: updatePreLaunchScript, safeAction: safeUpdatePreLaunchScript } = defineAction(UpdatePreLaunchScriptResultSchema, async (client, request) => {
|
|
2225
2361
|
const validatedRequest = UpdatePreLaunchScriptRequestSchema.parse(request);
|
|
@@ -2381,7 +2517,9 @@ var GetKmsInfoRequestSchema = z24.object({
|
|
|
2381
2517
|
});
|
|
2382
2518
|
var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSchema, async (client, request) => {
|
|
2383
2519
|
const validatedRequest = GetKmsInfoRequestSchema.parse(request);
|
|
2384
|
-
return await client.get(`/kms/${validatedRequest.kms_id}
|
|
2520
|
+
return await client.get(`/kms/${validatedRequest.kms_id}`, {
|
|
2521
|
+
headers: { "X-Phala-Version": "2026-05-22" }
|
|
2522
|
+
});
|
|
2385
2523
|
});
|
|
2386
2524
|
|
|
2387
2525
|
// src/actions/kms/get_kms_list.ts
|
|
@@ -2400,37 +2538,119 @@ var GetKmsListSchema = z25.object({
|
|
|
2400
2538
|
}).strict();
|
|
2401
2539
|
var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsListSchema, async (client, request) => {
|
|
2402
2540
|
const validatedRequest = GetKmsListRequestSchema.parse(request ?? {});
|
|
2403
|
-
return await client.get("/kms", {
|
|
2541
|
+
return await client.get("/kms", {
|
|
2542
|
+
params: validatedRequest,
|
|
2543
|
+
headers: { "X-Phala-Version": "2026-05-22" }
|
|
2544
|
+
});
|
|
2404
2545
|
});
|
|
2405
2546
|
|
|
2406
|
-
// src/actions/kms/
|
|
2547
|
+
// src/actions/kms/list_kms_contracts.ts
|
|
2548
|
+
import { z as z27 } from "zod";
|
|
2549
|
+
|
|
2550
|
+
// src/types/kms_contract.ts
|
|
2407
2551
|
import { z as z26 } from "zod";
|
|
2408
|
-
var
|
|
2409
|
-
|
|
2410
|
-
|
|
2552
|
+
var KmsContractInfoSchema = z26.object({
|
|
2553
|
+
id: z26.string(),
|
|
2554
|
+
slug: z26.string().nullable(),
|
|
2555
|
+
label: z26.string().nullable(),
|
|
2556
|
+
contract_address: z26.string(),
|
|
2557
|
+
chain_id: z26.number(),
|
|
2558
|
+
k256_pubkey: z26.string().nullable(),
|
|
2559
|
+
ca_pubkey: z26.string().nullable(),
|
|
2560
|
+
node_count: z26.number()
|
|
2561
|
+
}).passthrough();
|
|
2562
|
+
var KmsContractNodeSchema = z26.object({
|
|
2563
|
+
id: z26.string(),
|
|
2564
|
+
slug: z26.string().nullable(),
|
|
2565
|
+
url: z26.string(),
|
|
2566
|
+
version: z26.string(),
|
|
2567
|
+
kms_type: z26.string()
|
|
2568
|
+
}).passthrough();
|
|
2569
|
+
|
|
2570
|
+
// src/actions/kms/list_kms_contracts.ts
|
|
2571
|
+
var KMS_CONTRACT_API_VERSION = "2026-06-23";
|
|
2572
|
+
var ListKmsContractsRequestSchema = z27.object({
|
|
2573
|
+
page: z27.number().int().min(1).optional(),
|
|
2574
|
+
page_size: z27.number().int().min(1).optional(),
|
|
2575
|
+
is_onchain: z27.boolean().optional()
|
|
2576
|
+
}).strict();
|
|
2577
|
+
var ListKmsContractsSchema = z27.object({
|
|
2578
|
+
items: z27.array(KmsContractInfoSchema),
|
|
2579
|
+
total: z27.number(),
|
|
2580
|
+
page: z27.number(),
|
|
2581
|
+
page_size: z27.number(),
|
|
2582
|
+
pages: z27.number()
|
|
2583
|
+
}).strict();
|
|
2584
|
+
var { action: listKmsContracts, safeAction: safeListKmsContracts } = defineAction(ListKmsContractsSchema, async (client, request) => {
|
|
2585
|
+
const validatedRequest = ListKmsContractsRequestSchema.parse(request ?? {});
|
|
2586
|
+
return await client.get("/kms", {
|
|
2587
|
+
params: validatedRequest,
|
|
2588
|
+
headers: { "X-Phala-Version": KMS_CONTRACT_API_VERSION }
|
|
2589
|
+
});
|
|
2590
|
+
});
|
|
2591
|
+
|
|
2592
|
+
// src/actions/kms/get_kms_contract.ts
|
|
2593
|
+
import { z as z28 } from "zod";
|
|
2594
|
+
var KMS_CONTRACT_API_VERSION2 = "2026-06-23";
|
|
2595
|
+
var GetKmsContractRequestSchema = z28.object({
|
|
2596
|
+
// Contract slug (documented). A kc_ hashed id also resolves.
|
|
2597
|
+
slug: z28.string().min(1, "KMS contract slug is required")
|
|
2598
|
+
}).strict();
|
|
2599
|
+
var { action: getKmsContract, safeAction: safeGetKmsContract } = defineAction(KmsContractInfoSchema, async (client, payload) => {
|
|
2600
|
+
const { slug } = GetKmsContractRequestSchema.parse(payload);
|
|
2601
|
+
return await client.get(`/kms/${slug}`, {
|
|
2602
|
+
headers: { "X-Phala-Version": KMS_CONTRACT_API_VERSION2 }
|
|
2603
|
+
});
|
|
2604
|
+
});
|
|
2605
|
+
|
|
2606
|
+
// src/actions/kms/list_kms_contract_nodes.ts
|
|
2607
|
+
import { z as z29 } from "zod";
|
|
2608
|
+
var KMS_CONTRACT_API_VERSION3 = "2026-06-23";
|
|
2609
|
+
var ListKmsContractNodesRequestSchema = z29.object({
|
|
2610
|
+
// Contract slug (documented). A kc_ hashed id also resolves.
|
|
2611
|
+
slug: z29.string().min(1, "KMS contract slug is required")
|
|
2612
|
+
}).strict();
|
|
2613
|
+
var ListKmsContractNodesSchema = z29.object({
|
|
2614
|
+
items: z29.array(KmsContractNodeSchema),
|
|
2615
|
+
total: z29.number()
|
|
2616
|
+
}).strict();
|
|
2617
|
+
var { action: listKmsContractNodes, safeAction: safeListKmsContractNodes } = defineAction(ListKmsContractNodesSchema, async (client, payload) => {
|
|
2618
|
+
const { slug } = ListKmsContractNodesRequestSchema.parse(payload);
|
|
2619
|
+
return await client.get(`/kms/${slug}/nodes`, {
|
|
2620
|
+
headers: { "X-Phala-Version": KMS_CONTRACT_API_VERSION3 }
|
|
2621
|
+
});
|
|
2622
|
+
});
|
|
2623
|
+
|
|
2624
|
+
// src/actions/kms/get_app_env_encrypt_pubkey.ts
|
|
2625
|
+
import { z as z30 } from "zod";
|
|
2626
|
+
var GetAppEnvEncryptPubKeyRequestSchema = z30.object({
|
|
2627
|
+
kms: z30.string().min(1, "KMS ID or slug is required"),
|
|
2628
|
+
app_id: z30.string().refine(
|
|
2411
2629
|
(val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
|
|
2412
2630
|
"App ID must be exactly 40 characters or 42 characters with 0x prefix"
|
|
2413
2631
|
)
|
|
2414
2632
|
}).strict();
|
|
2415
|
-
var GetAppEnvEncryptPubKeySchema =
|
|
2416
|
-
public_key:
|
|
2417
|
-
signature:
|
|
2633
|
+
var GetAppEnvEncryptPubKeySchema = z30.object({
|
|
2634
|
+
public_key: z30.string(),
|
|
2635
|
+
signature: z30.string()
|
|
2418
2636
|
}).strict();
|
|
2419
2637
|
var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } = defineAction(GetAppEnvEncryptPubKeySchema, async (client, payload) => {
|
|
2420
2638
|
const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
|
|
2421
|
-
return await client.get(`/kms/${validatedRequest.kms}/pubkey/${validatedRequest.app_id}
|
|
2639
|
+
return await client.get(`/kms/${validatedRequest.kms}/pubkey/${validatedRequest.app_id}`, {
|
|
2640
|
+
headers: { "X-Phala-Version": "2026-05-22" }
|
|
2641
|
+
});
|
|
2422
2642
|
});
|
|
2423
2643
|
|
|
2424
2644
|
// src/actions/kms/next_app_ids.ts
|
|
2425
|
-
import { z as
|
|
2426
|
-
var NextAppIdsRequestSchema =
|
|
2427
|
-
counts:
|
|
2645
|
+
import { z as z31 } from "zod";
|
|
2646
|
+
var NextAppIdsRequestSchema = z31.object({
|
|
2647
|
+
counts: z31.number().int().min(1).max(20).optional().default(1)
|
|
2428
2648
|
}).strict();
|
|
2429
|
-
var NextAppIdsSchema =
|
|
2430
|
-
app_ids:
|
|
2431
|
-
|
|
2432
|
-
app_id:
|
|
2433
|
-
nonce:
|
|
2649
|
+
var NextAppIdsSchema = z31.object({
|
|
2650
|
+
app_ids: z31.array(
|
|
2651
|
+
z31.object({
|
|
2652
|
+
app_id: z31.string(),
|
|
2653
|
+
nonce: z31.number().int().min(0)
|
|
2434
2654
|
})
|
|
2435
2655
|
)
|
|
2436
2656
|
}).strict();
|
|
@@ -2442,41 +2662,41 @@ var { action: nextAppIds, safeAction: safeNextAppIds } = defineAction(NextAppIds
|
|
|
2442
2662
|
});
|
|
2443
2663
|
|
|
2444
2664
|
// src/types/cvm_info.ts
|
|
2445
|
-
import { z as
|
|
2446
|
-
var VMBaseSchema =
|
|
2447
|
-
name:
|
|
2448
|
-
status:
|
|
2449
|
-
teepod_id:
|
|
2450
|
-
teepod:
|
|
2451
|
-
id:
|
|
2452
|
-
name:
|
|
2453
|
-
region_identifier:
|
|
2665
|
+
import { z as z32 } from "zod";
|
|
2666
|
+
var VMBaseSchema = z32.object({
|
|
2667
|
+
name: z32.string(),
|
|
2668
|
+
status: z32.string(),
|
|
2669
|
+
teepod_id: z32.number(),
|
|
2670
|
+
teepod: z32.object({
|
|
2671
|
+
id: z32.number(),
|
|
2672
|
+
name: z32.string(),
|
|
2673
|
+
region_identifier: z32.string().nullable().optional()
|
|
2454
2674
|
}).optional().nullable(),
|
|
2455
|
-
app_id:
|
|
2456
|
-
vm_uuid:
|
|
2457
|
-
instance_id:
|
|
2458
|
-
app_url:
|
|
2459
|
-
base_image:
|
|
2460
|
-
vcpu:
|
|
2461
|
-
memory:
|
|
2462
|
-
disk_size:
|
|
2463
|
-
manifest_version:
|
|
2464
|
-
version:
|
|
2465
|
-
runner:
|
|
2466
|
-
docker_compose_file:
|
|
2467
|
-
features:
|
|
2468
|
-
created_at:
|
|
2469
|
-
encrypted_env_pubkey:
|
|
2675
|
+
app_id: z32.string(),
|
|
2676
|
+
vm_uuid: z32.string().nullable(),
|
|
2677
|
+
instance_id: z32.string().nullable(),
|
|
2678
|
+
app_url: z32.string().optional().nullable(),
|
|
2679
|
+
base_image: z32.string().optional().nullable(),
|
|
2680
|
+
vcpu: z32.number(),
|
|
2681
|
+
memory: z32.number(),
|
|
2682
|
+
disk_size: z32.number(),
|
|
2683
|
+
manifest_version: z32.number().optional().nullable(),
|
|
2684
|
+
version: z32.string().optional().nullable(),
|
|
2685
|
+
runner: z32.string().optional().nullable(),
|
|
2686
|
+
docker_compose_file: z32.string().optional().nullable(),
|
|
2687
|
+
features: z32.array(z32.string()).optional().nullable(),
|
|
2688
|
+
created_at: z32.string(),
|
|
2689
|
+
encrypted_env_pubkey: z32.string().nullable()
|
|
2470
2690
|
});
|
|
2471
2691
|
var VMV20260121Schema = VMBaseSchema.extend({
|
|
2472
|
-
id:
|
|
2473
|
-
user_id:
|
|
2692
|
+
id: z32.number(),
|
|
2693
|
+
user_id: z32.number().optional().nullable()
|
|
2474
2694
|
});
|
|
2475
2695
|
var VMV20260522Schema = VMBaseSchema.extend({
|
|
2476
|
-
id:
|
|
2477
|
-
user_id:
|
|
2696
|
+
id: z32.string(),
|
|
2697
|
+
user_id: z32.string().optional().nullable()
|
|
2478
2698
|
});
|
|
2479
|
-
var VMAnySchema =
|
|
2699
|
+
var VMAnySchema = z32.union([VMV20260121Schema, VMV20260522Schema]);
|
|
2480
2700
|
var VMSchema = VMV20260522Schema;
|
|
2481
2701
|
function getVMSchemaForVersion(version) {
|
|
2482
2702
|
if (version === "2026-01-21") return VMV20260121Schema;
|
|
@@ -2485,47 +2705,116 @@ function getVMSchemaForVersion(version) {
|
|
|
2485
2705
|
|
|
2486
2706
|
// src/actions/cvms/start_cvm.ts
|
|
2487
2707
|
var StartCvmRequestSchema = CvmIdSchema;
|
|
2488
|
-
|
|
2708
|
+
async function startCvm(client, request) {
|
|
2489
2709
|
const { cvmId } = StartCvmRequestSchema.parse(request);
|
|
2490
|
-
|
|
2491
|
-
|
|
2710
|
+
const response = await client.post(`/cvms/${cvmId}/start`);
|
|
2711
|
+
return getVMSchemaForVersion(client.config.version).parse(response);
|
|
2712
|
+
}
|
|
2713
|
+
async function safeStartCvm(client, request) {
|
|
2714
|
+
try {
|
|
2715
|
+
const data = await startCvm(client, request);
|
|
2716
|
+
return { success: true, data };
|
|
2717
|
+
} catch (error) {
|
|
2718
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
2719
|
+
return { success: false, error };
|
|
2720
|
+
}
|
|
2721
|
+
return {
|
|
2722
|
+
success: false,
|
|
2723
|
+
error: {
|
|
2724
|
+
name: "Error",
|
|
2725
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2726
|
+
}
|
|
2727
|
+
};
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2492
2730
|
|
|
2493
2731
|
// src/actions/cvms/stop_cvm.ts
|
|
2494
2732
|
var StopCvmRequestSchema = CvmIdSchema;
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2733
|
+
async function stopCvm(client, request) {
|
|
2734
|
+
const { cvmId } = StopCvmRequestSchema.parse(request);
|
|
2735
|
+
const response = await client.post(`/cvms/${cvmId}/stop`);
|
|
2736
|
+
return getVMSchemaForVersion(client.config.version).parse(response);
|
|
2737
|
+
}
|
|
2738
|
+
async function safeStopCvm(client, request) {
|
|
2739
|
+
try {
|
|
2740
|
+
const data = await stopCvm(client, request);
|
|
2741
|
+
return { success: true, data };
|
|
2742
|
+
} catch (error) {
|
|
2743
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
2744
|
+
return { success: false, error };
|
|
2745
|
+
}
|
|
2746
|
+
return {
|
|
2747
|
+
success: false,
|
|
2748
|
+
error: {
|
|
2749
|
+
name: "Error",
|
|
2750
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2751
|
+
}
|
|
2752
|
+
};
|
|
2500
2753
|
}
|
|
2501
|
-
|
|
2754
|
+
}
|
|
2502
2755
|
|
|
2503
2756
|
// src/actions/cvms/shutdown_cvm.ts
|
|
2504
2757
|
var ShutdownCvmRequestSchema = CvmIdSchema;
|
|
2505
|
-
|
|
2758
|
+
async function shutdownCvm(client, request) {
|
|
2506
2759
|
const { cvmId } = ShutdownCvmRequestSchema.parse(request);
|
|
2507
|
-
|
|
2508
|
-
|
|
2760
|
+
const response = await client.post(`/cvms/${cvmId}/shutdown`);
|
|
2761
|
+
return getVMSchemaForVersion(client.config.version).parse(response);
|
|
2762
|
+
}
|
|
2763
|
+
async function safeShutdownCvm(client, request) {
|
|
2764
|
+
try {
|
|
2765
|
+
const data = await shutdownCvm(client, request);
|
|
2766
|
+
return { success: true, data };
|
|
2767
|
+
} catch (error) {
|
|
2768
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
2769
|
+
return { success: false, error };
|
|
2770
|
+
}
|
|
2771
|
+
return {
|
|
2772
|
+
success: false,
|
|
2773
|
+
error: {
|
|
2774
|
+
name: "Error",
|
|
2775
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2776
|
+
}
|
|
2777
|
+
};
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2509
2780
|
|
|
2510
2781
|
// src/actions/cvms/restart_cvm.ts
|
|
2511
|
-
import { z as
|
|
2782
|
+
import { z as z33 } from "zod";
|
|
2512
2783
|
var RestartCvmRequestSchema = refineCvmId(
|
|
2513
2784
|
CvmIdObjectSchema.extend({
|
|
2514
|
-
force:
|
|
2785
|
+
force: z33.boolean().optional()
|
|
2515
2786
|
})
|
|
2516
2787
|
);
|
|
2517
|
-
|
|
2788
|
+
async function restartCvm(client, request) {
|
|
2518
2789
|
const parsed = RestartCvmRequestSchema.parse(request);
|
|
2519
2790
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
2520
2791
|
const { force = false } = parsed;
|
|
2521
|
-
|
|
2522
|
-
|
|
2792
|
+
const response = await client.post(`/cvms/${cvmId}/restart`, { force });
|
|
2793
|
+
return getVMSchemaForVersion(client.config.version).parse(response);
|
|
2794
|
+
}
|
|
2795
|
+
async function safeRestartCvm(client, request) {
|
|
2796
|
+
try {
|
|
2797
|
+
const data = await restartCvm(client, request);
|
|
2798
|
+
return { success: true, data };
|
|
2799
|
+
} catch (error) {
|
|
2800
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
2801
|
+
return { success: false, error };
|
|
2802
|
+
}
|
|
2803
|
+
return {
|
|
2804
|
+
success: false,
|
|
2805
|
+
error: {
|
|
2806
|
+
name: "Error",
|
|
2807
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2808
|
+
}
|
|
2809
|
+
};
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2523
2812
|
|
|
2524
2813
|
// src/actions/cvms/delete_cvm.ts
|
|
2525
|
-
import { z as
|
|
2814
|
+
import { z as z34 } from "zod";
|
|
2526
2815
|
var DeleteCvmRequestSchema = CvmIdSchema;
|
|
2527
2816
|
var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
2528
|
-
|
|
2817
|
+
z34.void(),
|
|
2529
2818
|
async (client, request) => {
|
|
2530
2819
|
const { cvmId } = DeleteCvmRequestSchema.parse(request);
|
|
2531
2820
|
await client.delete(`/cvms/${cvmId}`);
|
|
@@ -2534,41 +2823,41 @@ var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
|
2534
2823
|
);
|
|
2535
2824
|
|
|
2536
2825
|
// src/actions/cvms/get_cvm_stats.ts
|
|
2537
|
-
import { z as
|
|
2538
|
-
var DiskInfoSchema =
|
|
2539
|
-
name:
|
|
2540
|
-
mount_point:
|
|
2541
|
-
total_size:
|
|
2542
|
-
free_size:
|
|
2543
|
-
});
|
|
2544
|
-
var SystemInfoSchema =
|
|
2545
|
-
os_name:
|
|
2546
|
-
os_version:
|
|
2547
|
-
kernel_version:
|
|
2548
|
-
cpu_model:
|
|
2549
|
-
num_cpus:
|
|
2550
|
-
total_memory:
|
|
2551
|
-
available_memory:
|
|
2552
|
-
used_memory:
|
|
2553
|
-
free_memory:
|
|
2554
|
-
total_swap:
|
|
2555
|
-
used_swap:
|
|
2556
|
-
free_swap:
|
|
2557
|
-
uptime:
|
|
2558
|
-
loadavg_one:
|
|
2559
|
-
loadavg_five:
|
|
2560
|
-
loadavg_fifteen:
|
|
2561
|
-
disks:
|
|
2562
|
-
});
|
|
2563
|
-
var CvmSystemInfoSchema =
|
|
2564
|
-
is_online:
|
|
2565
|
-
is_public:
|
|
2566
|
-
error:
|
|
2826
|
+
import { z as z35 } from "zod";
|
|
2827
|
+
var DiskInfoSchema = z35.object({
|
|
2828
|
+
name: z35.string(),
|
|
2829
|
+
mount_point: z35.string(),
|
|
2830
|
+
total_size: z35.number(),
|
|
2831
|
+
free_size: z35.number()
|
|
2832
|
+
});
|
|
2833
|
+
var SystemInfoSchema = z35.object({
|
|
2834
|
+
os_name: z35.string(),
|
|
2835
|
+
os_version: z35.string(),
|
|
2836
|
+
kernel_version: z35.string(),
|
|
2837
|
+
cpu_model: z35.string(),
|
|
2838
|
+
num_cpus: z35.number(),
|
|
2839
|
+
total_memory: z35.number(),
|
|
2840
|
+
available_memory: z35.number(),
|
|
2841
|
+
used_memory: z35.number(),
|
|
2842
|
+
free_memory: z35.number(),
|
|
2843
|
+
total_swap: z35.number(),
|
|
2844
|
+
used_swap: z35.number(),
|
|
2845
|
+
free_swap: z35.number(),
|
|
2846
|
+
uptime: z35.number(),
|
|
2847
|
+
loadavg_one: z35.number(),
|
|
2848
|
+
loadavg_five: z35.number(),
|
|
2849
|
+
loadavg_fifteen: z35.number(),
|
|
2850
|
+
disks: z35.array(DiskInfoSchema)
|
|
2851
|
+
});
|
|
2852
|
+
var CvmSystemInfoSchema = z35.object({
|
|
2853
|
+
is_online: z35.boolean(),
|
|
2854
|
+
is_public: z35.boolean().default(false),
|
|
2855
|
+
error: z35.string().nullable(),
|
|
2567
2856
|
sysinfo: SystemInfoSchema.nullable(),
|
|
2568
|
-
status:
|
|
2569
|
-
in_progress:
|
|
2570
|
-
boot_progress:
|
|
2571
|
-
boot_error:
|
|
2857
|
+
status: z35.string().nullable(),
|
|
2858
|
+
in_progress: z35.boolean().default(false),
|
|
2859
|
+
boot_progress: z35.string().nullable(),
|
|
2860
|
+
boot_error: z35.string().nullable()
|
|
2572
2861
|
});
|
|
2573
2862
|
var GetCvmStatsRequestSchema = CvmIdSchema;
|
|
2574
2863
|
var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSystemInfoSchema, async (client, request) => {
|
|
@@ -2577,18 +2866,18 @@ var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSyste
|
|
|
2577
2866
|
});
|
|
2578
2867
|
|
|
2579
2868
|
// src/actions/cvms/get_cvm_network.ts
|
|
2580
|
-
import { z as
|
|
2581
|
-
var CvmNetworkUrlsSchema =
|
|
2582
|
-
app:
|
|
2583
|
-
instance:
|
|
2584
|
-
});
|
|
2585
|
-
var CvmNetworkSchema =
|
|
2586
|
-
is_online:
|
|
2587
|
-
is_public:
|
|
2588
|
-
error:
|
|
2589
|
-
internal_ip:
|
|
2590
|
-
latest_handshake:
|
|
2591
|
-
public_urls:
|
|
2869
|
+
import { z as z36 } from "zod";
|
|
2870
|
+
var CvmNetworkUrlsSchema = z36.object({
|
|
2871
|
+
app: z36.string(),
|
|
2872
|
+
instance: z36.string()
|
|
2873
|
+
});
|
|
2874
|
+
var CvmNetworkSchema = z36.object({
|
|
2875
|
+
is_online: z36.boolean(),
|
|
2876
|
+
is_public: z36.boolean().default(true),
|
|
2877
|
+
error: z36.string().nullable(),
|
|
2878
|
+
internal_ip: z36.string().nullable(),
|
|
2879
|
+
latest_handshake: z36.string().nullable(),
|
|
2880
|
+
public_urls: z36.array(CvmNetworkUrlsSchema).nullable()
|
|
2592
2881
|
});
|
|
2593
2882
|
var GetCvmNetworkRequestSchema = CvmIdSchema;
|
|
2594
2883
|
var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmNetworkSchema, async (client, request) => {
|
|
@@ -2597,36 +2886,36 @@ var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmN
|
|
|
2597
2886
|
});
|
|
2598
2887
|
|
|
2599
2888
|
// src/actions/cvms/get_cvm_docker_compose.ts
|
|
2600
|
-
import { z as
|
|
2889
|
+
import { z as z37 } from "zod";
|
|
2601
2890
|
var GetCvmDockerComposeRequestSchema = CvmIdSchema;
|
|
2602
|
-
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(
|
|
2891
|
+
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(z37.string(), async (client, request) => {
|
|
2603
2892
|
const { cvmId } = GetCvmDockerComposeRequestSchema.parse(request);
|
|
2604
2893
|
return await client.get(`/cvms/${cvmId}/docker-compose.yml`);
|
|
2605
2894
|
});
|
|
2606
2895
|
|
|
2607
2896
|
// src/actions/cvms/get_cvm_containers_stats.ts
|
|
2608
|
-
import { z as
|
|
2609
|
-
var ContainerInfoSchema =
|
|
2610
|
-
id:
|
|
2611
|
-
names:
|
|
2612
|
-
image:
|
|
2613
|
-
image_id:
|
|
2614
|
-
command:
|
|
2615
|
-
created:
|
|
2616
|
-
state:
|
|
2617
|
-
status:
|
|
2618
|
-
log_endpoint:
|
|
2619
|
-
});
|
|
2620
|
-
var CvmContainersStatsSchema =
|
|
2621
|
-
is_online:
|
|
2622
|
-
is_public:
|
|
2623
|
-
error:
|
|
2624
|
-
docker_compose_file:
|
|
2625
|
-
manifest_version:
|
|
2626
|
-
version:
|
|
2627
|
-
runner:
|
|
2628
|
-
features:
|
|
2629
|
-
containers:
|
|
2897
|
+
import { z as z38 } from "zod";
|
|
2898
|
+
var ContainerInfoSchema = z38.object({
|
|
2899
|
+
id: z38.string(),
|
|
2900
|
+
names: z38.array(z38.string()),
|
|
2901
|
+
image: z38.string(),
|
|
2902
|
+
image_id: z38.string(),
|
|
2903
|
+
command: z38.string().nullable().optional(),
|
|
2904
|
+
created: z38.number(),
|
|
2905
|
+
state: z38.string(),
|
|
2906
|
+
status: z38.string(),
|
|
2907
|
+
log_endpoint: z38.string().nullable()
|
|
2908
|
+
});
|
|
2909
|
+
var CvmContainersStatsSchema = z38.object({
|
|
2910
|
+
is_online: z38.boolean(),
|
|
2911
|
+
is_public: z38.boolean().default(true),
|
|
2912
|
+
error: z38.string().nullable(),
|
|
2913
|
+
docker_compose_file: z38.string().nullable(),
|
|
2914
|
+
manifest_version: z38.number().nullable(),
|
|
2915
|
+
version: z38.string().nullable(),
|
|
2916
|
+
runner: z38.string().nullable(),
|
|
2917
|
+
features: z38.array(z38.string()).nullable(),
|
|
2918
|
+
containers: z38.array(ContainerInfoSchema).nullable()
|
|
2630
2919
|
});
|
|
2631
2920
|
var GetCvmContainersStatsRequestSchema = CvmIdSchema;
|
|
2632
2921
|
var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = defineAction(CvmContainersStatsSchema, async (client, request) => {
|
|
@@ -2635,62 +2924,62 @@ var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = d
|
|
|
2635
2924
|
});
|
|
2636
2925
|
|
|
2637
2926
|
// src/actions/cvms/get_cvm_attestation.ts
|
|
2638
|
-
import { z as
|
|
2639
|
-
var CertificateSubjectSchema =
|
|
2640
|
-
common_name:
|
|
2641
|
-
organization:
|
|
2642
|
-
country:
|
|
2643
|
-
state:
|
|
2644
|
-
locality:
|
|
2645
|
-
});
|
|
2646
|
-
var CertificateIssuerSchema =
|
|
2647
|
-
common_name:
|
|
2648
|
-
organization:
|
|
2649
|
-
country:
|
|
2650
|
-
});
|
|
2651
|
-
var CertificateSchema =
|
|
2927
|
+
import { z as z39 } from "zod";
|
|
2928
|
+
var CertificateSubjectSchema = z39.object({
|
|
2929
|
+
common_name: z39.string().nullable(),
|
|
2930
|
+
organization: z39.string().nullable(),
|
|
2931
|
+
country: z39.string().nullable(),
|
|
2932
|
+
state: z39.string().nullable(),
|
|
2933
|
+
locality: z39.string().nullable()
|
|
2934
|
+
});
|
|
2935
|
+
var CertificateIssuerSchema = z39.object({
|
|
2936
|
+
common_name: z39.string().nullable(),
|
|
2937
|
+
organization: z39.string().nullable(),
|
|
2938
|
+
country: z39.string().nullable()
|
|
2939
|
+
});
|
|
2940
|
+
var CertificateSchema = z39.object({
|
|
2652
2941
|
subject: CertificateSubjectSchema,
|
|
2653
2942
|
issuer: CertificateIssuerSchema,
|
|
2654
|
-
serial_number:
|
|
2655
|
-
not_before:
|
|
2943
|
+
serial_number: z39.string(),
|
|
2944
|
+
not_before: z39.string(),
|
|
2656
2945
|
// datetime serialized as ISO string
|
|
2657
|
-
not_after:
|
|
2946
|
+
not_after: z39.string(),
|
|
2658
2947
|
// datetime serialized as ISO string
|
|
2659
|
-
version:
|
|
2660
|
-
fingerprint:
|
|
2661
|
-
signature_algorithm:
|
|
2662
|
-
sans:
|
|
2663
|
-
is_ca:
|
|
2664
|
-
position_in_chain:
|
|
2665
|
-
quote:
|
|
2666
|
-
app_id:
|
|
2667
|
-
cert_usage:
|
|
2668
|
-
});
|
|
2669
|
-
var EventLogSchema =
|
|
2670
|
-
imr:
|
|
2671
|
-
event_type:
|
|
2672
|
-
digest:
|
|
2673
|
-
event:
|
|
2674
|
-
event_payload:
|
|
2675
|
-
});
|
|
2676
|
-
var TcbInfoSchema =
|
|
2677
|
-
mrtd:
|
|
2678
|
-
rootfs_hash:
|
|
2679
|
-
rtmr0:
|
|
2680
|
-
rtmr1:
|
|
2681
|
-
rtmr2:
|
|
2682
|
-
rtmr3:
|
|
2683
|
-
event_log:
|
|
2684
|
-
app_compose:
|
|
2685
|
-
});
|
|
2686
|
-
var CvmAttestationSchema =
|
|
2687
|
-
name:
|
|
2688
|
-
is_online:
|
|
2689
|
-
is_public:
|
|
2690
|
-
error:
|
|
2691
|
-
app_certificates:
|
|
2948
|
+
version: z39.string(),
|
|
2949
|
+
fingerprint: z39.string(),
|
|
2950
|
+
signature_algorithm: z39.string(),
|
|
2951
|
+
sans: z39.array(z39.string()).nullable(),
|
|
2952
|
+
is_ca: z39.boolean(),
|
|
2953
|
+
position_in_chain: z39.number().nullable(),
|
|
2954
|
+
quote: z39.string().nullable(),
|
|
2955
|
+
app_id: z39.string().nullable().optional(),
|
|
2956
|
+
cert_usage: z39.string().nullable().optional()
|
|
2957
|
+
});
|
|
2958
|
+
var EventLogSchema = z39.object({
|
|
2959
|
+
imr: z39.number(),
|
|
2960
|
+
event_type: z39.number(),
|
|
2961
|
+
digest: z39.string(),
|
|
2962
|
+
event: z39.string(),
|
|
2963
|
+
event_payload: z39.string()
|
|
2964
|
+
});
|
|
2965
|
+
var TcbInfoSchema = z39.object({
|
|
2966
|
+
mrtd: z39.string(),
|
|
2967
|
+
rootfs_hash: z39.string().nullable().optional(),
|
|
2968
|
+
rtmr0: z39.string(),
|
|
2969
|
+
rtmr1: z39.string(),
|
|
2970
|
+
rtmr2: z39.string(),
|
|
2971
|
+
rtmr3: z39.string(),
|
|
2972
|
+
event_log: z39.array(EventLogSchema),
|
|
2973
|
+
app_compose: z39.string()
|
|
2974
|
+
});
|
|
2975
|
+
var CvmAttestationSchema = z39.object({
|
|
2976
|
+
name: z39.string().nullable(),
|
|
2977
|
+
is_online: z39.boolean(),
|
|
2978
|
+
is_public: z39.boolean().default(true),
|
|
2979
|
+
error: z39.string().nullable(),
|
|
2980
|
+
app_certificates: z39.array(CertificateSchema).nullable(),
|
|
2692
2981
|
tcb_info: TcbInfoSchema.nullable(),
|
|
2693
|
-
compose_file:
|
|
2982
|
+
compose_file: z39.string().nullable()
|
|
2694
2983
|
});
|
|
2695
2984
|
var GetCvmAttestationRequestSchema = CvmIdSchema;
|
|
2696
2985
|
var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAction(CvmAttestationSchema, async (client, request) => {
|
|
@@ -2699,31 +2988,35 @@ var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAct
|
|
|
2699
2988
|
});
|
|
2700
2989
|
|
|
2701
2990
|
// src/actions/cvms/update_cvm_resources.ts
|
|
2702
|
-
import { z as
|
|
2991
|
+
import { z as z40 } from "zod";
|
|
2703
2992
|
var UpdateCvmResourcesRequestSchema = refineCvmId(
|
|
2704
2993
|
CvmIdObjectSchema.extend({
|
|
2705
|
-
vcpu:
|
|
2706
|
-
memory:
|
|
2707
|
-
disk_size:
|
|
2708
|
-
instance_type:
|
|
2709
|
-
allow_restart:
|
|
2994
|
+
vcpu: z40.number().optional(),
|
|
2995
|
+
memory: z40.number().optional(),
|
|
2996
|
+
disk_size: z40.number().optional(),
|
|
2997
|
+
instance_type: z40.string().optional(),
|
|
2998
|
+
allow_restart: z40.boolean().optional()
|
|
2710
2999
|
})
|
|
2711
3000
|
);
|
|
2712
|
-
var
|
|
3001
|
+
var UpdateCvmResourcesResponseSchema = z40.object({
|
|
3002
|
+
message: z40.string(),
|
|
3003
|
+
correlation_id: z40.string(),
|
|
3004
|
+
status: z40.string()
|
|
3005
|
+
});
|
|
3006
|
+
var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(UpdateCvmResourcesResponseSchema, async (client, request) => {
|
|
2713
3007
|
const parsed = UpdateCvmResourcesRequestSchema.parse(request);
|
|
2714
3008
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
2715
3009
|
const { ...body } = parsed;
|
|
2716
|
-
await client.patch(`/cvms/${cvmId}
|
|
2717
|
-
return void 0;
|
|
3010
|
+
return await client.patch(`/cvms/${cvmId}`, body);
|
|
2718
3011
|
});
|
|
2719
3012
|
|
|
2720
3013
|
// src/actions/cvms/update_cvm_visibility.ts
|
|
2721
|
-
import { z as
|
|
3014
|
+
import { z as z41 } from "zod";
|
|
2722
3015
|
var UpdateCvmVisibilityRequestSchema = refineCvmId(
|
|
2723
3016
|
CvmIdObjectSchema.extend({
|
|
2724
|
-
public_sysinfo:
|
|
2725
|
-
public_logs:
|
|
2726
|
-
public_tcbinfo:
|
|
3017
|
+
public_sysinfo: z41.boolean(),
|
|
3018
|
+
public_logs: z41.boolean(),
|
|
3019
|
+
public_tcbinfo: z41.boolean().optional()
|
|
2727
3020
|
})
|
|
2728
3021
|
);
|
|
2729
3022
|
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(CvmDetailV20251028Schema, async (client, request) => {
|
|
@@ -2738,21 +3031,21 @@ var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defin
|
|
|
2738
3031
|
});
|
|
2739
3032
|
|
|
2740
3033
|
// src/actions/cvms/get_available_os_images.ts
|
|
2741
|
-
import { z as
|
|
2742
|
-
var OSImageVariantSchema =
|
|
2743
|
-
name:
|
|
2744
|
-
os_image_hash:
|
|
2745
|
-
is_current:
|
|
2746
|
-
});
|
|
2747
|
-
var AvailableOSImageSchema3 =
|
|
2748
|
-
version:
|
|
2749
|
-
|
|
2750
|
-
|
|
3034
|
+
import { z as z42 } from "zod";
|
|
3035
|
+
var OSImageVariantSchema = z42.object({
|
|
3036
|
+
name: z42.string(),
|
|
3037
|
+
os_image_hash: z42.string().nullable(),
|
|
3038
|
+
is_current: z42.boolean()
|
|
3039
|
+
});
|
|
3040
|
+
var AvailableOSImageSchema3 = z42.object({
|
|
3041
|
+
version: z42.union([
|
|
3042
|
+
z42.tuple([z42.number(), z42.number(), z42.number(), z42.number()]),
|
|
3043
|
+
z42.tuple([z42.number(), z42.number(), z42.number()])
|
|
2751
3044
|
]),
|
|
2752
3045
|
prod: OSImageVariantSchema.nullable(),
|
|
2753
3046
|
dev: OSImageVariantSchema.nullable()
|
|
2754
3047
|
});
|
|
2755
|
-
var GetAvailableOSImagesResponseSchema =
|
|
3048
|
+
var GetAvailableOSImagesResponseSchema = z42.array(AvailableOSImageSchema3);
|
|
2756
3049
|
var GetAvailableOSImagesRequestSchema = CvmIdSchema;
|
|
2757
3050
|
var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = defineAction(GetAvailableOSImagesResponseSchema, async (client, request) => {
|
|
2758
3051
|
const { cvmId } = GetAvailableOSImagesRequestSchema.parse(request);
|
|
@@ -2760,13 +3053,13 @@ var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = def
|
|
|
2760
3053
|
});
|
|
2761
3054
|
|
|
2762
3055
|
// src/actions/cvms/update_os_image.ts
|
|
2763
|
-
import { z as
|
|
3056
|
+
import { z as z43 } from "zod";
|
|
2764
3057
|
var UpdateOsImageRequestSchema = refineCvmId(
|
|
2765
3058
|
CvmIdObjectSchema.extend({
|
|
2766
|
-
os_image_name:
|
|
3059
|
+
os_image_name: z43.string().min(1, "OS image name is required")
|
|
2767
3060
|
})
|
|
2768
3061
|
);
|
|
2769
|
-
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(
|
|
3062
|
+
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z43.void(), async (client, request) => {
|
|
2770
3063
|
const parsed = UpdateOsImageRequestSchema.parse(request);
|
|
2771
3064
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
2772
3065
|
const { os_image_name } = parsed;
|
|
@@ -2775,17 +3068,17 @@ var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z39.
|
|
|
2775
3068
|
});
|
|
2776
3069
|
|
|
2777
3070
|
// src/actions/cvms/get_cvm_state.ts
|
|
2778
|
-
import { z as
|
|
2779
|
-
var CvmStateSchema =
|
|
2780
|
-
id:
|
|
2781
|
-
instance_id:
|
|
2782
|
-
name:
|
|
2783
|
-
status:
|
|
2784
|
-
uptime:
|
|
2785
|
-
exited_at:
|
|
2786
|
-
boot_progress:
|
|
2787
|
-
boot_error:
|
|
2788
|
-
shutdown_progress:
|
|
3071
|
+
import { z as z44 } from "zod";
|
|
3072
|
+
var CvmStateSchema = z44.object({
|
|
3073
|
+
id: z44.string().optional(),
|
|
3074
|
+
instance_id: z44.string().optional(),
|
|
3075
|
+
name: z44.string(),
|
|
3076
|
+
status: z44.string(),
|
|
3077
|
+
uptime: z44.string().optional(),
|
|
3078
|
+
exited_at: z44.string().optional(),
|
|
3079
|
+
boot_progress: z44.string().optional(),
|
|
3080
|
+
boot_error: z44.string().optional(),
|
|
3081
|
+
shutdown_progress: z44.string().optional()
|
|
2789
3082
|
});
|
|
2790
3083
|
var GetCvmStateRequestSchema = CvmIdSchema;
|
|
2791
3084
|
var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmStateSchema, async (client, request) => {
|
|
@@ -2794,21 +3087,21 @@ var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmState
|
|
|
2794
3087
|
});
|
|
2795
3088
|
|
|
2796
3089
|
// src/actions/ssh_keys/list_ssh_keys.ts
|
|
2797
|
-
import { z as
|
|
2798
|
-
var SshKeySchema =
|
|
2799
|
-
id:
|
|
2800
|
-
user_id:
|
|
2801
|
-
name:
|
|
2802
|
-
public_key:
|
|
2803
|
-
fingerprint:
|
|
2804
|
-
key_type:
|
|
2805
|
-
source:
|
|
2806
|
-
key_metadata:
|
|
2807
|
-
last_synced_at:
|
|
2808
|
-
created_at:
|
|
2809
|
-
updated_at:
|
|
2810
|
-
});
|
|
2811
|
-
var ListSshKeysResponseSchema =
|
|
3090
|
+
import { z as z45 } from "zod";
|
|
3091
|
+
var SshKeySchema = z45.object({
|
|
3092
|
+
id: z45.string(),
|
|
3093
|
+
user_id: z45.string(),
|
|
3094
|
+
name: z45.string(),
|
|
3095
|
+
public_key: z45.string(),
|
|
3096
|
+
fingerprint: z45.string(),
|
|
3097
|
+
key_type: z45.string(),
|
|
3098
|
+
source: z45.string(),
|
|
3099
|
+
key_metadata: z45.record(z45.unknown()).nullable().optional(),
|
|
3100
|
+
last_synced_at: z45.string().nullable().optional(),
|
|
3101
|
+
created_at: z45.string(),
|
|
3102
|
+
updated_at: z45.string()
|
|
3103
|
+
});
|
|
3104
|
+
var ListSshKeysResponseSchema = z45.array(SshKeySchema);
|
|
2812
3105
|
async function listSshKeys(client) {
|
|
2813
3106
|
const response = await client.get("/user/ssh-keys");
|
|
2814
3107
|
return ListSshKeysResponseSchema.parse(response);
|
|
@@ -2832,15 +3125,15 @@ async function safeListSshKeys(client) {
|
|
|
2832
3125
|
}
|
|
2833
3126
|
|
|
2834
3127
|
// src/actions/ssh_keys/import_github_profile.ts
|
|
2835
|
-
import { z as
|
|
2836
|
-
var ImportGithubProfileRequestSchema =
|
|
2837
|
-
github_username:
|
|
3128
|
+
import { z as z46 } from "zod";
|
|
3129
|
+
var ImportGithubProfileRequestSchema = z46.object({
|
|
3130
|
+
github_username: z46.string().min(1)
|
|
2838
3131
|
});
|
|
2839
|
-
var ImportGithubProfileResponseSchema =
|
|
2840
|
-
github_username:
|
|
2841
|
-
keys_added:
|
|
2842
|
-
keys_skipped:
|
|
2843
|
-
errors:
|
|
3132
|
+
var ImportGithubProfileResponseSchema = z46.object({
|
|
3133
|
+
github_username: z46.string(),
|
|
3134
|
+
keys_added: z46.number().int(),
|
|
3135
|
+
keys_skipped: z46.number().int(),
|
|
3136
|
+
errors: z46.array(z46.string()).default([])
|
|
2844
3137
|
});
|
|
2845
3138
|
var { action: importGithubProfileSshKeys, safeAction: safeImportGithubProfileSshKeys } = defineAction(
|
|
2846
3139
|
ImportGithubProfileResponseSchema,
|
|
@@ -2851,10 +3144,10 @@ var { action: importGithubProfileSshKeys, safeAction: safeImportGithubProfileSsh
|
|
|
2851
3144
|
);
|
|
2852
3145
|
|
|
2853
3146
|
// src/actions/ssh_keys/create_ssh_key.ts
|
|
2854
|
-
import { z as
|
|
2855
|
-
var CreateSshKeyRequestSchema =
|
|
2856
|
-
name:
|
|
2857
|
-
public_key:
|
|
3147
|
+
import { z as z47 } from "zod";
|
|
3148
|
+
var CreateSshKeyRequestSchema = z47.object({
|
|
3149
|
+
name: z47.string().min(1),
|
|
3150
|
+
public_key: z47.string().min(1)
|
|
2858
3151
|
});
|
|
2859
3152
|
var { action: createSshKey, safeAction: safeCreateSshKey } = defineAction(SshKeySchema, async (client, request) => {
|
|
2860
3153
|
const { name, public_key } = CreateSshKeyRequestSchema.parse(request);
|
|
@@ -2862,24 +3155,24 @@ var { action: createSshKey, safeAction: safeCreateSshKey } = defineAction(SshKey
|
|
|
2862
3155
|
});
|
|
2863
3156
|
|
|
2864
3157
|
// src/actions/ssh_keys/delete_ssh_key.ts
|
|
2865
|
-
import { z as
|
|
2866
|
-
var DeleteSshKeyRequestSchema =
|
|
2867
|
-
keyId:
|
|
3158
|
+
import { z as z48 } from "zod";
|
|
3159
|
+
var DeleteSshKeyRequestSchema = z48.object({
|
|
3160
|
+
keyId: z48.string().min(1)
|
|
2868
3161
|
});
|
|
2869
|
-
var { action: deleteSshKey, safeAction: safeDeleteSshKey } = defineAction(
|
|
3162
|
+
var { action: deleteSshKey, safeAction: safeDeleteSshKey } = defineAction(z48.void(), async (client, request) => {
|
|
2870
3163
|
const { keyId } = DeleteSshKeyRequestSchema.parse(request);
|
|
2871
3164
|
await client.delete(`/user/ssh-keys/${keyId}`);
|
|
2872
3165
|
return void 0;
|
|
2873
3166
|
});
|
|
2874
3167
|
|
|
2875
3168
|
// src/actions/ssh_keys/sync_github_ssh_keys.ts
|
|
2876
|
-
import { z as
|
|
2877
|
-
var SyncGithubSshKeysResponseSchema =
|
|
2878
|
-
synced_count:
|
|
2879
|
-
keys_added:
|
|
2880
|
-
keys_updated:
|
|
2881
|
-
keys_removed:
|
|
2882
|
-
errors:
|
|
3169
|
+
import { z as z49 } from "zod";
|
|
3170
|
+
var SyncGithubSshKeysResponseSchema = z49.object({
|
|
3171
|
+
synced_count: z49.number().int(),
|
|
3172
|
+
keys_added: z49.number().int(),
|
|
3173
|
+
keys_updated: z49.number().int(),
|
|
3174
|
+
keys_removed: z49.number().int(),
|
|
3175
|
+
errors: z49.array(z49.string()).default([])
|
|
2883
3176
|
});
|
|
2884
3177
|
var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSimpleAction(
|
|
2885
3178
|
SyncGithubSshKeysResponseSchema,
|
|
@@ -2889,26 +3182,26 @@ var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSim
|
|
|
2889
3182
|
);
|
|
2890
3183
|
|
|
2891
3184
|
// src/actions/os_images/get_os_images.ts
|
|
2892
|
-
import { z as
|
|
2893
|
-
var OSImagePublicSchema =
|
|
2894
|
-
name:
|
|
2895
|
-
slug:
|
|
2896
|
-
version:
|
|
2897
|
-
os_image_hash:
|
|
2898
|
-
is_dev:
|
|
2899
|
-
requires_gpu:
|
|
3185
|
+
import { z as z50 } from "zod";
|
|
3186
|
+
var OSImagePublicSchema = z50.object({
|
|
3187
|
+
name: z50.string(),
|
|
3188
|
+
slug: z50.string(),
|
|
3189
|
+
version: z50.string(),
|
|
3190
|
+
os_image_hash: z50.string().nullable(),
|
|
3191
|
+
is_dev: z50.boolean(),
|
|
3192
|
+
requires_gpu: z50.boolean()
|
|
2900
3193
|
}).passthrough();
|
|
2901
|
-
var GetOsImagesRequestSchema =
|
|
2902
|
-
page:
|
|
2903
|
-
page_size:
|
|
2904
|
-
is_dev:
|
|
3194
|
+
var GetOsImagesRequestSchema = z50.object({
|
|
3195
|
+
page: z50.number().int().min(1).optional(),
|
|
3196
|
+
page_size: z50.number().int().min(1).optional(),
|
|
3197
|
+
is_dev: z50.boolean().optional()
|
|
2905
3198
|
}).strict();
|
|
2906
|
-
var GetOsImagesResponseSchema =
|
|
2907
|
-
items:
|
|
2908
|
-
total:
|
|
2909
|
-
page:
|
|
2910
|
-
page_size:
|
|
2911
|
-
pages:
|
|
3199
|
+
var GetOsImagesResponseSchema = z50.object({
|
|
3200
|
+
items: z50.array(OSImagePublicSchema),
|
|
3201
|
+
total: z50.number(),
|
|
3202
|
+
page: z50.number(),
|
|
3203
|
+
page_size: z50.number(),
|
|
3204
|
+
pages: z50.number()
|
|
2912
3205
|
}).passthrough();
|
|
2913
3206
|
var { action: getOsImages, safeAction: safeGetOsImages } = defineAction(GetOsImagesResponseSchema, async (client, request) => {
|
|
2914
3207
|
const validatedRequest = GetOsImagesRequestSchema.parse(request ?? {});
|
|
@@ -2916,32 +3209,35 @@ var { action: getOsImages, safeAction: safeGetOsImages } = defineAction(GetOsIma
|
|
|
2916
3209
|
});
|
|
2917
3210
|
|
|
2918
3211
|
// src/actions/kms/get_kms_onchain_detail.ts
|
|
2919
|
-
import { z as
|
|
2920
|
-
var OnChainDeviceSchema =
|
|
2921
|
-
device_id:
|
|
2922
|
-
node_name:
|
|
2923
|
-
on_chain_allowed:
|
|
3212
|
+
import { z as z51 } from "zod";
|
|
3213
|
+
var OnChainDeviceSchema = z51.object({
|
|
3214
|
+
device_id: z51.string(),
|
|
3215
|
+
node_name: z51.string().nullable().optional(),
|
|
3216
|
+
on_chain_allowed: z51.boolean().nullable()
|
|
2924
3217
|
}).passthrough();
|
|
2925
|
-
var OnChainOsImageSchema =
|
|
2926
|
-
name:
|
|
2927
|
-
version:
|
|
2928
|
-
os_image_hash:
|
|
2929
|
-
on_chain_allowed:
|
|
3218
|
+
var OnChainOsImageSchema = z51.object({
|
|
3219
|
+
name: z51.string(),
|
|
3220
|
+
version: z51.string(),
|
|
3221
|
+
os_image_hash: z51.string().nullable(),
|
|
3222
|
+
on_chain_allowed: z51.boolean().nullable()
|
|
2930
3223
|
}).passthrough();
|
|
2931
|
-
var OnChainKmsContractSchema =
|
|
2932
|
-
contract_address:
|
|
2933
|
-
chain_id:
|
|
2934
|
-
chain_name:
|
|
2935
|
-
|
|
2936
|
-
|
|
3224
|
+
var OnChainKmsContractSchema = z51.object({
|
|
3225
|
+
contract_address: z51.string(),
|
|
3226
|
+
chain_id: z51.number(),
|
|
3227
|
+
chain_name: z51.string(),
|
|
3228
|
+
k256_pubkey: z51.string().nullable().optional(),
|
|
3229
|
+
ca_pubkey: z51.string().nullable().optional(),
|
|
3230
|
+
gateway_contract_address: z51.string().nullable().optional(),
|
|
3231
|
+
devices: z51.array(OnChainDeviceSchema),
|
|
3232
|
+
os_images: z51.array(OnChainOsImageSchema)
|
|
2937
3233
|
}).passthrough();
|
|
2938
|
-
var GetKmsOnChainDetailResponseSchema =
|
|
2939
|
-
chain_name:
|
|
2940
|
-
chain_id:
|
|
2941
|
-
contracts:
|
|
3234
|
+
var GetKmsOnChainDetailResponseSchema = z51.object({
|
|
3235
|
+
chain_name: z51.string(),
|
|
3236
|
+
chain_id: z51.number(),
|
|
3237
|
+
contracts: z51.array(OnChainKmsContractSchema)
|
|
2942
3238
|
}).passthrough();
|
|
2943
|
-
var GetKmsOnChainDetailRequestSchema =
|
|
2944
|
-
chain:
|
|
3239
|
+
var GetKmsOnChainDetailRequestSchema = z51.object({
|
|
3240
|
+
chain: z51.string()
|
|
2945
3241
|
}).strict();
|
|
2946
3242
|
var { action: getKmsOnChainDetail, safeAction: safeGetKmsOnChainDetail } = defineAction(GetKmsOnChainDetailResponseSchema, async (client, request) => {
|
|
2947
3243
|
const { chain } = GetKmsOnChainDetailRequestSchema.parse(request);
|
|
@@ -3024,6 +3320,12 @@ function createClient2(config = {}) {
|
|
|
3024
3320
|
safeGetKmsInfo,
|
|
3025
3321
|
getKmsList,
|
|
3026
3322
|
safeGetKmsList,
|
|
3323
|
+
listKmsContracts,
|
|
3324
|
+
safeListKmsContracts,
|
|
3325
|
+
getKmsContract,
|
|
3326
|
+
safeGetKmsContract,
|
|
3327
|
+
listKmsContractNodes,
|
|
3328
|
+
safeListKmsContractNodes,
|
|
3027
3329
|
getAppEnvEncryptPubKey,
|
|
3028
3330
|
safeGetAppEnvEncryptPubKey,
|
|
3029
3331
|
nextAppIds,
|
|
@@ -3049,139 +3351,141 @@ function createClient2(config = {}) {
|
|
|
3049
3351
|
}
|
|
3050
3352
|
|
|
3051
3353
|
// src/types/app_info_v20251028.ts
|
|
3052
|
-
import { z as
|
|
3053
|
-
var CvmBasicInfoV20251028Schema =
|
|
3054
|
-
vm_uuid:
|
|
3055
|
-
app_id:
|
|
3056
|
-
name:
|
|
3057
|
-
status:
|
|
3058
|
-
vcpu:
|
|
3059
|
-
memory:
|
|
3060
|
-
disk_size:
|
|
3061
|
-
teepod_id:
|
|
3062
|
-
teepod_name:
|
|
3063
|
-
region_identifier:
|
|
3064
|
-
kms_type:
|
|
3065
|
-
instance_type:
|
|
3066
|
-
listed:
|
|
3067
|
-
base_image:
|
|
3068
|
-
kms_slug:
|
|
3069
|
-
|
|
3070
|
-
|
|
3354
|
+
import { z as z52 } from "zod";
|
|
3355
|
+
var CvmBasicInfoV20251028Schema = z52.object({
|
|
3356
|
+
vm_uuid: z52.string().nullable(),
|
|
3357
|
+
app_id: z52.string(),
|
|
3358
|
+
name: z52.string().default(""),
|
|
3359
|
+
status: z52.string(),
|
|
3360
|
+
vcpu: z52.number().int(),
|
|
3361
|
+
memory: z52.number().int(),
|
|
3362
|
+
disk_size: z52.number().int(),
|
|
3363
|
+
teepod_id: z52.number().int(),
|
|
3364
|
+
teepod_name: z52.string(),
|
|
3365
|
+
region_identifier: z52.string().nullable().optional(),
|
|
3366
|
+
kms_type: z52.string().nullable().optional(),
|
|
3367
|
+
instance_type: z52.string().nullable().optional(),
|
|
3368
|
+
listed: z52.boolean().nullable().optional(),
|
|
3369
|
+
base_image: z52.string().nullable().optional(),
|
|
3370
|
+
kms_slug: z52.string().nullable().optional(),
|
|
3371
|
+
/** @deprecated Identifies a KMS node, not the on-chain KMS contract. Use kms_contract_id. */
|
|
3372
|
+
kms_id: z52.string().nullable().optional(),
|
|
3373
|
+
kms_contract_id: z52.string().nullable().optional(),
|
|
3374
|
+
instance_id: z52.string().nullable().optional(),
|
|
3071
3375
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
3072
|
-
updated_at:
|
|
3073
|
-
});
|
|
3074
|
-
var AppProfileSchema =
|
|
3075
|
-
display_name:
|
|
3076
|
-
avatar_url:
|
|
3077
|
-
description:
|
|
3078
|
-
custom_domain:
|
|
3079
|
-
});
|
|
3080
|
-
var DstackAppFullResponseV20251028Schema =
|
|
3081
|
-
id:
|
|
3082
|
-
name:
|
|
3083
|
-
app_id:
|
|
3084
|
-
app_provision_type:
|
|
3085
|
-
app_icon_url:
|
|
3086
|
-
created_at:
|
|
3087
|
-
kms_type:
|
|
3376
|
+
updated_at: z52.string().nullable().optional()
|
|
3377
|
+
});
|
|
3378
|
+
var AppProfileSchema = z52.object({
|
|
3379
|
+
display_name: z52.string().nullable().optional(),
|
|
3380
|
+
avatar_url: z52.string().nullable().optional(),
|
|
3381
|
+
description: z52.string().nullable().optional(),
|
|
3382
|
+
custom_domain: z52.string().nullable().optional()
|
|
3383
|
+
});
|
|
3384
|
+
var DstackAppFullResponseV20251028Schema = z52.object({
|
|
3385
|
+
id: z52.string(),
|
|
3386
|
+
name: z52.string(),
|
|
3387
|
+
app_id: z52.string(),
|
|
3388
|
+
app_provision_type: z52.string().nullable().optional(),
|
|
3389
|
+
app_icon_url: z52.string().nullable().optional(),
|
|
3390
|
+
created_at: z52.string(),
|
|
3391
|
+
kms_type: z52.string(),
|
|
3088
3392
|
profile: AppProfileSchema.nullable().optional(),
|
|
3089
3393
|
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
3090
|
-
cvms:
|
|
3091
|
-
cvm_count:
|
|
3394
|
+
cvms: z52.array(CvmBasicInfoV20251028Schema).default([]),
|
|
3395
|
+
cvm_count: z52.number().int().default(0)
|
|
3092
3396
|
});
|
|
3093
3397
|
var DstackAppWithCvmResponseV20251028Schema = DstackAppFullResponseV20251028Schema;
|
|
3094
|
-
var DstackAppListResponseV20251028Schema =
|
|
3095
|
-
dstack_apps:
|
|
3096
|
-
page:
|
|
3097
|
-
page_size:
|
|
3098
|
-
total:
|
|
3099
|
-
total_pages:
|
|
3398
|
+
var DstackAppListResponseV20251028Schema = z52.object({
|
|
3399
|
+
dstack_apps: z52.array(DstackAppWithCvmResponseV20251028Schema),
|
|
3400
|
+
page: z52.number().int(),
|
|
3401
|
+
page_size: z52.number().int(),
|
|
3402
|
+
total: z52.number().int(),
|
|
3403
|
+
total_pages: z52.number().int()
|
|
3100
3404
|
});
|
|
3101
3405
|
|
|
3102
3406
|
// src/types/app_info_v20260121.ts
|
|
3103
|
-
import { z as
|
|
3104
|
-
var DstackAppFullResponseV20260121Schema =
|
|
3105
|
-
id:
|
|
3106
|
-
name:
|
|
3107
|
-
app_id:
|
|
3108
|
-
app_provision_type:
|
|
3109
|
-
app_icon_url:
|
|
3110
|
-
created_at:
|
|
3111
|
-
kms_type:
|
|
3112
|
-
profile:
|
|
3113
|
-
display_name:
|
|
3114
|
-
avatar_url:
|
|
3115
|
-
description:
|
|
3116
|
-
custom_domain:
|
|
3407
|
+
import { z as z53 } from "zod";
|
|
3408
|
+
var DstackAppFullResponseV20260121Schema = z53.object({
|
|
3409
|
+
id: z53.string(),
|
|
3410
|
+
name: z53.string(),
|
|
3411
|
+
app_id: z53.string(),
|
|
3412
|
+
app_provision_type: z53.string().nullable().optional(),
|
|
3413
|
+
app_icon_url: z53.string().nullable().optional(),
|
|
3414
|
+
created_at: z53.string(),
|
|
3415
|
+
kms_type: z53.string(),
|
|
3416
|
+
profile: z53.object({
|
|
3417
|
+
display_name: z53.string().nullable().optional(),
|
|
3418
|
+
avatar_url: z53.string().nullable().optional(),
|
|
3419
|
+
description: z53.string().nullable().optional(),
|
|
3420
|
+
custom_domain: z53.string().nullable().optional()
|
|
3117
3421
|
}).nullable().optional(),
|
|
3118
3422
|
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
3119
|
-
cvms:
|
|
3120
|
-
cvm_count:
|
|
3423
|
+
cvms: z53.array(CvmInfoV20260121Schema).default([]),
|
|
3424
|
+
cvm_count: z53.number().int().default(0)
|
|
3121
3425
|
});
|
|
3122
3426
|
var DstackAppFullResponseV20260522Schema = DstackAppFullResponseV20260121Schema.extend({
|
|
3123
3427
|
current_cvm: CvmInfoV20260522Schema.nullable().optional(),
|
|
3124
|
-
cvms:
|
|
3428
|
+
cvms: z53.array(CvmInfoV20260522Schema).default([])
|
|
3125
3429
|
});
|
|
3126
3430
|
var DstackAppWithCvmResponseV20260121Schema = DstackAppFullResponseV20260121Schema;
|
|
3127
3431
|
var DstackAppWithCvmResponseV20260522Schema = DstackAppFullResponseV20260522Schema;
|
|
3128
|
-
var DstackAppListResponseV20260121Schema =
|
|
3129
|
-
dstack_apps:
|
|
3130
|
-
page:
|
|
3131
|
-
page_size:
|
|
3132
|
-
total:
|
|
3133
|
-
total_pages:
|
|
3432
|
+
var DstackAppListResponseV20260121Schema = z53.object({
|
|
3433
|
+
dstack_apps: z53.array(DstackAppWithCvmResponseV20260121Schema),
|
|
3434
|
+
page: z53.number().int(),
|
|
3435
|
+
page_size: z53.number().int(),
|
|
3436
|
+
total: z53.number().int(),
|
|
3437
|
+
total_pages: z53.number().int()
|
|
3134
3438
|
});
|
|
3135
3439
|
var DstackAppListResponseV20260522Schema = DstackAppListResponseV20260121Schema.extend({
|
|
3136
|
-
dstack_apps:
|
|
3440
|
+
dstack_apps: z53.array(DstackAppWithCvmResponseV20260522Schema)
|
|
3137
3441
|
});
|
|
3138
3442
|
|
|
3139
3443
|
// src/types/app_revision.ts
|
|
3140
|
-
import { z as
|
|
3141
|
-
var CvmRefSchema =
|
|
3142
|
-
object_type:
|
|
3143
|
-
id:
|
|
3144
|
-
name:
|
|
3145
|
-
app_id:
|
|
3146
|
-
vm_uuid:
|
|
3147
|
-
});
|
|
3148
|
-
var AppRevisionResponseSchema =
|
|
3149
|
-
revision_id:
|
|
3150
|
-
app_id:
|
|
3151
|
-
vm_uuid:
|
|
3152
|
-
compose_hash:
|
|
3153
|
-
created_at:
|
|
3154
|
-
trace_id:
|
|
3155
|
-
operation_type:
|
|
3444
|
+
import { z as z54 } from "zod";
|
|
3445
|
+
var CvmRefSchema = z54.object({
|
|
3446
|
+
object_type: z54.literal("cvm"),
|
|
3447
|
+
id: z54.string().nullable().optional(),
|
|
3448
|
+
name: z54.string().nullable().optional(),
|
|
3449
|
+
app_id: z54.string().nullable().optional(),
|
|
3450
|
+
vm_uuid: z54.string().nullable().optional()
|
|
3451
|
+
});
|
|
3452
|
+
var AppRevisionResponseSchema = z54.object({
|
|
3453
|
+
revision_id: z54.string(),
|
|
3454
|
+
app_id: z54.string(),
|
|
3455
|
+
vm_uuid: z54.string(),
|
|
3456
|
+
compose_hash: z54.string(),
|
|
3457
|
+
created_at: z54.string(),
|
|
3458
|
+
trace_id: z54.string().nullable().optional(),
|
|
3459
|
+
operation_type: z54.string(),
|
|
3156
3460
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
3157
3461
|
cvm: CvmRefSchema.nullable().optional(),
|
|
3158
3462
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
3159
3463
|
});
|
|
3160
|
-
var AppRevisionDetailResponseSchema =
|
|
3161
|
-
revision_id:
|
|
3162
|
-
app_id:
|
|
3163
|
-
vm_uuid:
|
|
3164
|
-
compose_hash:
|
|
3165
|
-
compose_file:
|
|
3166
|
-
encrypted_env:
|
|
3167
|
-
user_config:
|
|
3168
|
-
created_at:
|
|
3169
|
-
trace_id:
|
|
3170
|
-
operation_type:
|
|
3464
|
+
var AppRevisionDetailResponseSchema = z54.object({
|
|
3465
|
+
revision_id: z54.string(),
|
|
3466
|
+
app_id: z54.string(),
|
|
3467
|
+
vm_uuid: z54.string(),
|
|
3468
|
+
compose_hash: z54.string(),
|
|
3469
|
+
compose_file: z54.union([z54.record(z54.any()), z54.string()]).nullable().optional(),
|
|
3470
|
+
encrypted_env: z54.string(),
|
|
3471
|
+
user_config: z54.string(),
|
|
3472
|
+
created_at: z54.string(),
|
|
3473
|
+
trace_id: z54.string().nullable().optional(),
|
|
3474
|
+
operation_type: z54.string(),
|
|
3171
3475
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
3172
3476
|
cvm: CvmRefSchema.nullable().optional(),
|
|
3173
3477
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
3174
3478
|
});
|
|
3175
|
-
var AppRevisionsResponseSchema =
|
|
3176
|
-
revisions:
|
|
3177
|
-
total:
|
|
3178
|
-
page:
|
|
3179
|
-
page_size:
|
|
3180
|
-
total_pages:
|
|
3479
|
+
var AppRevisionsResponseSchema = z54.object({
|
|
3480
|
+
revisions: z54.array(AppRevisionResponseSchema),
|
|
3481
|
+
total: z54.number().int(),
|
|
3482
|
+
page: z54.number().int(),
|
|
3483
|
+
page_size: z54.number().int(),
|
|
3484
|
+
total_pages: z54.number().int()
|
|
3181
3485
|
});
|
|
3182
3486
|
|
|
3183
3487
|
// src/actions/blockchains/deploy_app_auth.ts
|
|
3184
|
-
import { z as
|
|
3488
|
+
import { z as z55 } from "zod";
|
|
3185
3489
|
import {
|
|
3186
3490
|
createPublicClient as createPublicClient2,
|
|
3187
3491
|
createWalletClient as createWalletClient2,
|
|
@@ -3194,6 +3498,49 @@ import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
|
3194
3498
|
// src/utils/index.ts
|
|
3195
3499
|
import { encryptEnvVars } from "@phala/dstack-sdk/encrypt-env-vars";
|
|
3196
3500
|
|
|
3501
|
+
// src/utils/get_mr_config_id.ts
|
|
3502
|
+
import { keccak256, toBytes, toHex } from "viem";
|
|
3503
|
+
var MR_CONFIG_ID_LENGTH = 48;
|
|
3504
|
+
var KEY_PROVIDER_BYTE = {
|
|
3505
|
+
none: 0,
|
|
3506
|
+
local: 1,
|
|
3507
|
+
kms: 2,
|
|
3508
|
+
tpm: 3
|
|
3509
|
+
};
|
|
3510
|
+
function getMrConfigIdV1(composeHash) {
|
|
3511
|
+
const result = new Uint8Array(MR_CONFIG_ID_LENGTH);
|
|
3512
|
+
result[0] = 1;
|
|
3513
|
+
result.set(toBytes(composeHash), 1);
|
|
3514
|
+
return toHex(result);
|
|
3515
|
+
}
|
|
3516
|
+
function getMrConfigId(input) {
|
|
3517
|
+
const composeHashBytes = toBytes(input.compose_hash);
|
|
3518
|
+
const appIdBytes = toBytes(input.app_id);
|
|
3519
|
+
const kpByte = KEY_PROVIDER_BYTE[input.key_provider_type];
|
|
3520
|
+
const kpIdBytes = input.key_provider_id === "0x" ? new Uint8Array(0) : toBytes(input.key_provider_id);
|
|
3521
|
+
const payload = new Uint8Array(
|
|
3522
|
+
composeHashBytes.length + appIdBytes.length + 1 + kpIdBytes.length
|
|
3523
|
+
);
|
|
3524
|
+
let offset = 0;
|
|
3525
|
+
payload.set(composeHashBytes, offset);
|
|
3526
|
+
offset += composeHashBytes.length;
|
|
3527
|
+
payload.set(appIdBytes, offset);
|
|
3528
|
+
offset += appIdBytes.length;
|
|
3529
|
+
payload[offset] = kpByte;
|
|
3530
|
+
offset += 1;
|
|
3531
|
+
payload.set(kpIdBytes, offset);
|
|
3532
|
+
const hash = keccak256(payload);
|
|
3533
|
+
const hashBytes = toBytes(hash);
|
|
3534
|
+
const result = new Uint8Array(MR_CONFIG_ID_LENGTH);
|
|
3535
|
+
result[0] = 2;
|
|
3536
|
+
result.set(hashBytes, 1);
|
|
3537
|
+
return toHex(result);
|
|
3538
|
+
}
|
|
3539
|
+
function verifyMrConfigId(mrConfigId, input) {
|
|
3540
|
+
const expected = getMrConfigId(input);
|
|
3541
|
+
return expected.toLowerCase() === mrConfigId.toLowerCase();
|
|
3542
|
+
}
|
|
3543
|
+
|
|
3197
3544
|
// src/utils/as-hex.ts
|
|
3198
3545
|
import { isHex } from "viem";
|
|
3199
3546
|
function asHex(value) {
|
|
@@ -3249,7 +3596,8 @@ var ErrorCodes = {
|
|
|
3249
3596
|
TOKEN_LIMIT_EXCEEDED: "ERR-05-001",
|
|
3250
3597
|
TOKEN_RATE_LIMIT: "ERR-05-002",
|
|
3251
3598
|
// Module 06: Auth
|
|
3252
|
-
OAUTH_EMAIL_INVALID: "ERR-06-001"
|
|
3599
|
+
OAUTH_EMAIL_INVALID: "ERR-06-001",
|
|
3600
|
+
PERMISSION_DENIED: "ERR-06-006"
|
|
3253
3601
|
};
|
|
3254
3602
|
|
|
3255
3603
|
// src/utils/network.ts
|
|
@@ -3887,25 +4235,25 @@ var kmsAuthAbi = [
|
|
|
3887
4235
|
anonymous: false
|
|
3888
4236
|
}
|
|
3889
4237
|
];
|
|
3890
|
-
var DeployAppAuthRequestBaseSchema =
|
|
4238
|
+
var DeployAppAuthRequestBaseSchema = z55.object({
|
|
3891
4239
|
// Chain configuration (conditionally required)
|
|
3892
|
-
chain:
|
|
3893
|
-
rpcUrl:
|
|
4240
|
+
chain: z55.unknown().optional(),
|
|
4241
|
+
rpcUrl: z55.string().optional(),
|
|
3894
4242
|
// Contract configuration (required)
|
|
3895
|
-
kmsContractAddress:
|
|
4243
|
+
kmsContractAddress: z55.string(),
|
|
3896
4244
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
3897
|
-
privateKey:
|
|
3898
|
-
walletClient:
|
|
4245
|
+
privateKey: z55.string().optional(),
|
|
4246
|
+
walletClient: z55.unknown().optional(),
|
|
3899
4247
|
// Public client (optional, will create default if not provided)
|
|
3900
|
-
publicClient:
|
|
4248
|
+
publicClient: z55.unknown().optional(),
|
|
3901
4249
|
// App configuration (optional)
|
|
3902
|
-
allowAnyDevice:
|
|
3903
|
-
deviceId:
|
|
3904
|
-
composeHash:
|
|
3905
|
-
disableUpgrades:
|
|
4250
|
+
allowAnyDevice: z55.boolean().optional().default(false),
|
|
4251
|
+
deviceId: z55.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
4252
|
+
composeHash: z55.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
4253
|
+
disableUpgrades: z55.boolean().optional().default(false),
|
|
3906
4254
|
// Validation configuration (optional)
|
|
3907
|
-
skipPrerequisiteChecks:
|
|
3908
|
-
minBalance:
|
|
4255
|
+
skipPrerequisiteChecks: z55.boolean().optional().default(false),
|
|
4256
|
+
minBalance: z55.string().optional()
|
|
3909
4257
|
// ETH amount as string, e.g., "0.01"
|
|
3910
4258
|
}).passthrough();
|
|
3911
4259
|
var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
@@ -3933,13 +4281,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
|
3933
4281
|
path: ["chain"]
|
|
3934
4282
|
}
|
|
3935
4283
|
);
|
|
3936
|
-
var DeployAppAuthSchema =
|
|
3937
|
-
appId:
|
|
3938
|
-
appAuthAddress:
|
|
3939
|
-
deployer:
|
|
3940
|
-
transactionHash:
|
|
3941
|
-
blockNumber:
|
|
3942
|
-
gasUsed:
|
|
4284
|
+
var DeployAppAuthSchema = z55.object({
|
|
4285
|
+
appId: z55.string(),
|
|
4286
|
+
appAuthAddress: z55.string(),
|
|
4287
|
+
deployer: z55.string(),
|
|
4288
|
+
transactionHash: z55.string(),
|
|
4289
|
+
blockNumber: z55.bigint().optional(),
|
|
4290
|
+
gasUsed: z55.bigint().optional()
|
|
3943
4291
|
}).passthrough();
|
|
3944
4292
|
function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
|
|
3945
4293
|
try {
|
|
@@ -4185,7 +4533,7 @@ async function safeDeployAppAuth(request, parameters) {
|
|
|
4185
4533
|
}
|
|
4186
4534
|
|
|
4187
4535
|
// src/actions/blockchains/add_compose_hash.ts
|
|
4188
|
-
import { z as
|
|
4536
|
+
import { z as z56 } from "zod";
|
|
4189
4537
|
import {
|
|
4190
4538
|
createPublicClient as createPublicClient3,
|
|
4191
4539
|
createWalletClient as createWalletClient3,
|
|
@@ -4209,29 +4557,29 @@ var appAuthAbi = [
|
|
|
4209
4557
|
anonymous: false
|
|
4210
4558
|
}
|
|
4211
4559
|
];
|
|
4212
|
-
var AddComposeHashRequestSchema =
|
|
4560
|
+
var AddComposeHashRequestSchema = z56.object({
|
|
4213
4561
|
// Chain configuration (conditionally required)
|
|
4214
|
-
chain:
|
|
4215
|
-
rpcUrl:
|
|
4216
|
-
appId:
|
|
4217
|
-
composeHash:
|
|
4562
|
+
chain: z56.unknown().optional(),
|
|
4563
|
+
rpcUrl: z56.string().optional(),
|
|
4564
|
+
appId: z56.string(),
|
|
4565
|
+
composeHash: z56.string(),
|
|
4218
4566
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
4219
|
-
privateKey:
|
|
4220
|
-
walletClient:
|
|
4567
|
+
privateKey: z56.string().optional(),
|
|
4568
|
+
walletClient: z56.unknown().optional(),
|
|
4221
4569
|
// Public client (optional, will create default if not provided)
|
|
4222
|
-
publicClient:
|
|
4570
|
+
publicClient: z56.unknown().optional(),
|
|
4223
4571
|
// Validation configuration (optional)
|
|
4224
|
-
skipPrerequisiteChecks:
|
|
4225
|
-
minBalance:
|
|
4572
|
+
skipPrerequisiteChecks: z56.boolean().optional().default(false),
|
|
4573
|
+
minBalance: z56.string().optional(),
|
|
4226
4574
|
// ETH amount as string, e.g., "0.01"
|
|
4227
4575
|
// Transaction control options
|
|
4228
|
-
timeout:
|
|
4229
|
-
retryOptions:
|
|
4230
|
-
signal:
|
|
4576
|
+
timeout: z56.number().optional().default(12e4),
|
|
4577
|
+
retryOptions: z56.unknown().optional(),
|
|
4578
|
+
signal: z56.unknown().optional(),
|
|
4231
4579
|
// Progress callbacks
|
|
4232
|
-
onTransactionStateChange:
|
|
4233
|
-
onTransactionSubmitted:
|
|
4234
|
-
onTransactionConfirmed:
|
|
4580
|
+
onTransactionStateChange: z56.function().optional(),
|
|
4581
|
+
onTransactionSubmitted: z56.function().optional(),
|
|
4582
|
+
onTransactionConfirmed: z56.function().optional()
|
|
4235
4583
|
}).passthrough().refine(
|
|
4236
4584
|
(data) => {
|
|
4237
4585
|
const hasPrivateKey = !!data.privateKey;
|
|
@@ -4255,12 +4603,12 @@ var AddComposeHashRequestSchema = z52.object({
|
|
|
4255
4603
|
path: ["chain"]
|
|
4256
4604
|
}
|
|
4257
4605
|
);
|
|
4258
|
-
var AddComposeHashSchema =
|
|
4259
|
-
composeHash:
|
|
4260
|
-
appId:
|
|
4261
|
-
transactionHash:
|
|
4262
|
-
blockNumber:
|
|
4263
|
-
gasUsed:
|
|
4606
|
+
var AddComposeHashSchema = z56.object({
|
|
4607
|
+
composeHash: z56.string(),
|
|
4608
|
+
appId: z56.string(),
|
|
4609
|
+
transactionHash: z56.string(),
|
|
4610
|
+
blockNumber: z56.bigint().optional(),
|
|
4611
|
+
gasUsed: z56.bigint().optional()
|
|
4264
4612
|
}).passthrough();
|
|
4265
4613
|
function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
|
|
4266
4614
|
console.log(receipt.logs);
|
|
@@ -4470,7 +4818,7 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
4470
4818
|
}
|
|
4471
4819
|
|
|
4472
4820
|
// src/actions/blockchains/add_device.ts
|
|
4473
|
-
import { z as
|
|
4821
|
+
import { z as z57 } from "zod";
|
|
4474
4822
|
import {
|
|
4475
4823
|
createPublicClient as createPublicClient4,
|
|
4476
4824
|
createWalletClient as createWalletClient4,
|
|
@@ -4565,22 +4913,22 @@ var dstackAppAbi = [
|
|
|
4565
4913
|
];
|
|
4566
4914
|
|
|
4567
4915
|
// src/actions/blockchains/add_device.ts
|
|
4568
|
-
var AddDeviceRequestSchema =
|
|
4569
|
-
chain:
|
|
4570
|
-
rpcUrl:
|
|
4571
|
-
appAddress:
|
|
4572
|
-
deviceId:
|
|
4573
|
-
privateKey:
|
|
4574
|
-
walletClient:
|
|
4575
|
-
publicClient:
|
|
4576
|
-
skipPrerequisiteChecks:
|
|
4577
|
-
minBalance:
|
|
4578
|
-
timeout:
|
|
4579
|
-
retryOptions:
|
|
4580
|
-
signal:
|
|
4581
|
-
onTransactionStateChange:
|
|
4582
|
-
onTransactionSubmitted:
|
|
4583
|
-
onTransactionConfirmed:
|
|
4916
|
+
var AddDeviceRequestSchema = z57.object({
|
|
4917
|
+
chain: z57.unknown().optional(),
|
|
4918
|
+
rpcUrl: z57.string().optional(),
|
|
4919
|
+
appAddress: z57.string(),
|
|
4920
|
+
deviceId: z57.string(),
|
|
4921
|
+
privateKey: z57.string().optional(),
|
|
4922
|
+
walletClient: z57.unknown().optional(),
|
|
4923
|
+
publicClient: z57.unknown().optional(),
|
|
4924
|
+
skipPrerequisiteChecks: z57.boolean().optional().default(false),
|
|
4925
|
+
minBalance: z57.string().optional(),
|
|
4926
|
+
timeout: z57.number().optional().default(12e4),
|
|
4927
|
+
retryOptions: z57.unknown().optional(),
|
|
4928
|
+
signal: z57.unknown().optional(),
|
|
4929
|
+
onTransactionStateChange: z57.function().optional(),
|
|
4930
|
+
onTransactionSubmitted: z57.function().optional(),
|
|
4931
|
+
onTransactionConfirmed: z57.function().optional()
|
|
4584
4932
|
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4585
4933
|
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4586
4934
|
path: ["privateKey", "walletClient"]
|
|
@@ -4594,12 +4942,12 @@ var AddDeviceRequestSchema = z53.object({
|
|
|
4594
4942
|
path: ["chain"]
|
|
4595
4943
|
}
|
|
4596
4944
|
);
|
|
4597
|
-
var AddDeviceSchema =
|
|
4598
|
-
appAddress:
|
|
4599
|
-
deviceId:
|
|
4600
|
-
transactionHash:
|
|
4601
|
-
blockNumber:
|
|
4602
|
-
gasUsed:
|
|
4945
|
+
var AddDeviceSchema = z57.object({
|
|
4946
|
+
appAddress: z57.string(),
|
|
4947
|
+
deviceId: z57.string(),
|
|
4948
|
+
transactionHash: z57.string(),
|
|
4949
|
+
blockNumber: z57.bigint().optional(),
|
|
4950
|
+
gasUsed: z57.bigint().optional()
|
|
4603
4951
|
}).passthrough();
|
|
4604
4952
|
async function addDevice(request, parameters) {
|
|
4605
4953
|
const validatedRequest = AddDeviceRequestSchema.parse(request);
|
|
@@ -4747,7 +5095,7 @@ async function safeAddDevice(request, parameters) {
|
|
|
4747
5095
|
}
|
|
4748
5096
|
|
|
4749
5097
|
// src/actions/blockchains/remove_device.ts
|
|
4750
|
-
import { z as
|
|
5098
|
+
import { z as z58 } from "zod";
|
|
4751
5099
|
import {
|
|
4752
5100
|
createPublicClient as createPublicClient5,
|
|
4753
5101
|
createWalletClient as createWalletClient5,
|
|
@@ -4755,22 +5103,22 @@ import {
|
|
|
4755
5103
|
parseEther as parseEther4
|
|
4756
5104
|
} from "viem";
|
|
4757
5105
|
import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
|
|
4758
|
-
var RemoveDeviceRequestSchema =
|
|
4759
|
-
chain:
|
|
4760
|
-
rpcUrl:
|
|
4761
|
-
appAddress:
|
|
4762
|
-
deviceId:
|
|
4763
|
-
privateKey:
|
|
4764
|
-
walletClient:
|
|
4765
|
-
publicClient:
|
|
4766
|
-
skipPrerequisiteChecks:
|
|
4767
|
-
minBalance:
|
|
4768
|
-
timeout:
|
|
4769
|
-
retryOptions:
|
|
4770
|
-
signal:
|
|
4771
|
-
onTransactionStateChange:
|
|
4772
|
-
onTransactionSubmitted:
|
|
4773
|
-
onTransactionConfirmed:
|
|
5106
|
+
var RemoveDeviceRequestSchema = z58.object({
|
|
5107
|
+
chain: z58.unknown().optional(),
|
|
5108
|
+
rpcUrl: z58.string().optional(),
|
|
5109
|
+
appAddress: z58.string(),
|
|
5110
|
+
deviceId: z58.string(),
|
|
5111
|
+
privateKey: z58.string().optional(),
|
|
5112
|
+
walletClient: z58.unknown().optional(),
|
|
5113
|
+
publicClient: z58.unknown().optional(),
|
|
5114
|
+
skipPrerequisiteChecks: z58.boolean().optional().default(false),
|
|
5115
|
+
minBalance: z58.string().optional(),
|
|
5116
|
+
timeout: z58.number().optional().default(12e4),
|
|
5117
|
+
retryOptions: z58.unknown().optional(),
|
|
5118
|
+
signal: z58.unknown().optional(),
|
|
5119
|
+
onTransactionStateChange: z58.function().optional(),
|
|
5120
|
+
onTransactionSubmitted: z58.function().optional(),
|
|
5121
|
+
onTransactionConfirmed: z58.function().optional()
|
|
4774
5122
|
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4775
5123
|
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4776
5124
|
path: ["privateKey", "walletClient"]
|
|
@@ -4784,12 +5132,12 @@ var RemoveDeviceRequestSchema = z54.object({
|
|
|
4784
5132
|
path: ["chain"]
|
|
4785
5133
|
}
|
|
4786
5134
|
);
|
|
4787
|
-
var RemoveDeviceSchema =
|
|
4788
|
-
appAddress:
|
|
4789
|
-
deviceId:
|
|
4790
|
-
transactionHash:
|
|
4791
|
-
blockNumber:
|
|
4792
|
-
gasUsed:
|
|
5135
|
+
var RemoveDeviceSchema = z58.object({
|
|
5136
|
+
appAddress: z58.string(),
|
|
5137
|
+
deviceId: z58.string(),
|
|
5138
|
+
transactionHash: z58.string(),
|
|
5139
|
+
blockNumber: z58.bigint().optional(),
|
|
5140
|
+
gasUsed: z58.bigint().optional()
|
|
4793
5141
|
}).passthrough();
|
|
4794
5142
|
async function removeDevice(request, parameters) {
|
|
4795
5143
|
const validatedRequest = RemoveDeviceRequestSchema.parse(request);
|
|
@@ -4927,7 +5275,7 @@ async function safeRemoveDevice(request, parameters) {
|
|
|
4927
5275
|
}
|
|
4928
5276
|
|
|
4929
5277
|
// src/actions/blockchains/set_allow_any_device.ts
|
|
4930
|
-
import { z as
|
|
5278
|
+
import { z as z59 } from "zod";
|
|
4931
5279
|
import {
|
|
4932
5280
|
createPublicClient as createPublicClient6,
|
|
4933
5281
|
createWalletClient as createWalletClient6,
|
|
@@ -4935,22 +5283,22 @@ import {
|
|
|
4935
5283
|
parseEther as parseEther5
|
|
4936
5284
|
} from "viem";
|
|
4937
5285
|
import { privateKeyToAccount as privateKeyToAccount6 } from "viem/accounts";
|
|
4938
|
-
var SetAllowAnyDeviceRequestSchema =
|
|
4939
|
-
chain:
|
|
4940
|
-
rpcUrl:
|
|
4941
|
-
appAddress:
|
|
4942
|
-
allow:
|
|
4943
|
-
privateKey:
|
|
4944
|
-
walletClient:
|
|
4945
|
-
publicClient:
|
|
4946
|
-
skipPrerequisiteChecks:
|
|
4947
|
-
minBalance:
|
|
4948
|
-
timeout:
|
|
4949
|
-
retryOptions:
|
|
4950
|
-
signal:
|
|
4951
|
-
onTransactionStateChange:
|
|
4952
|
-
onTransactionSubmitted:
|
|
4953
|
-
onTransactionConfirmed:
|
|
5286
|
+
var SetAllowAnyDeviceRequestSchema = z59.object({
|
|
5287
|
+
chain: z59.unknown().optional(),
|
|
5288
|
+
rpcUrl: z59.string().optional(),
|
|
5289
|
+
appAddress: z59.string(),
|
|
5290
|
+
allow: z59.boolean(),
|
|
5291
|
+
privateKey: z59.string().optional(),
|
|
5292
|
+
walletClient: z59.unknown().optional(),
|
|
5293
|
+
publicClient: z59.unknown().optional(),
|
|
5294
|
+
skipPrerequisiteChecks: z59.boolean().optional().default(false),
|
|
5295
|
+
minBalance: z59.string().optional(),
|
|
5296
|
+
timeout: z59.number().optional().default(12e4),
|
|
5297
|
+
retryOptions: z59.unknown().optional(),
|
|
5298
|
+
signal: z59.unknown().optional(),
|
|
5299
|
+
onTransactionStateChange: z59.function().optional(),
|
|
5300
|
+
onTransactionSubmitted: z59.function().optional(),
|
|
5301
|
+
onTransactionConfirmed: z59.function().optional()
|
|
4954
5302
|
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4955
5303
|
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4956
5304
|
path: ["privateKey", "walletClient"]
|
|
@@ -4964,12 +5312,12 @@ var SetAllowAnyDeviceRequestSchema = z55.object({
|
|
|
4964
5312
|
path: ["chain"]
|
|
4965
5313
|
}
|
|
4966
5314
|
);
|
|
4967
|
-
var SetAllowAnyDeviceSchema =
|
|
4968
|
-
appAddress:
|
|
4969
|
-
allow:
|
|
4970
|
-
transactionHash:
|
|
4971
|
-
blockNumber:
|
|
4972
|
-
gasUsed:
|
|
5315
|
+
var SetAllowAnyDeviceSchema = z59.object({
|
|
5316
|
+
appAddress: z59.string(),
|
|
5317
|
+
allow: z59.boolean(),
|
|
5318
|
+
transactionHash: z59.string(),
|
|
5319
|
+
blockNumber: z59.bigint().optional(),
|
|
5320
|
+
gasUsed: z59.bigint().optional()
|
|
4973
5321
|
}).passthrough();
|
|
4974
5322
|
async function setAllowAnyDevice(request, parameters) {
|
|
4975
5323
|
const validatedRequest = SetAllowAnyDeviceRequestSchema.parse(request);
|
|
@@ -5106,13 +5454,13 @@ async function safeSetAllowAnyDevice(request, parameters) {
|
|
|
5106
5454
|
}
|
|
5107
5455
|
|
|
5108
5456
|
// src/actions/blockchains/get_allowed_devices.ts
|
|
5109
|
-
import { z as
|
|
5457
|
+
import { z as z60 } from "zod";
|
|
5110
5458
|
import { createPublicClient as createPublicClient7, http as http7 } from "viem";
|
|
5111
|
-
var GetAllowedDevicesSchema =
|
|
5112
|
-
appAddress:
|
|
5113
|
-
owner:
|
|
5114
|
-
allowAnyDevice:
|
|
5115
|
-
devices:
|
|
5459
|
+
var GetAllowedDevicesSchema = z60.object({
|
|
5460
|
+
appAddress: z60.string(),
|
|
5461
|
+
owner: z60.string(),
|
|
5462
|
+
allowAnyDevice: z60.boolean(),
|
|
5463
|
+
devices: z60.array(z60.string())
|
|
5116
5464
|
});
|
|
5117
5465
|
async function getAllowedDevices(request) {
|
|
5118
5466
|
const { chain, rpcUrl, appAddress, deviceIds, publicClient: providedPublicClient } = request;
|
|
@@ -5306,15 +5654,15 @@ async function safeCheckOnChainPrerequisites(request) {
|
|
|
5306
5654
|
}
|
|
5307
5655
|
|
|
5308
5656
|
// src/actions/workspaces/get_workspace_nodes.ts
|
|
5309
|
-
import { z as
|
|
5657
|
+
import { z as z61 } from "zod";
|
|
5310
5658
|
var NodeRefSchema2 = NodeRefSchema;
|
|
5311
5659
|
var NodeInfoSchema = NodeRefSchema2;
|
|
5312
|
-
var GetWorkspaceNodesSchema =
|
|
5313
|
-
items:
|
|
5314
|
-
total:
|
|
5315
|
-
page:
|
|
5316
|
-
page_size:
|
|
5317
|
-
pages:
|
|
5660
|
+
var GetWorkspaceNodesSchema = z61.object({
|
|
5661
|
+
items: z61.array(NodeRefSchema2),
|
|
5662
|
+
total: z61.number(),
|
|
5663
|
+
page: z61.number(),
|
|
5664
|
+
page_size: z61.number(),
|
|
5665
|
+
pages: z61.number()
|
|
5318
5666
|
}).passthrough();
|
|
5319
5667
|
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
5320
5668
|
const { teamSlug, page, pageSize } = request;
|
|
@@ -5326,56 +5674,74 @@ var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAct
|
|
|
5326
5674
|
});
|
|
5327
5675
|
|
|
5328
5676
|
// src/actions/workspaces/get_workspace_quotas.ts
|
|
5329
|
-
import { z as
|
|
5330
|
-
var QuotaMetricSchema =
|
|
5331
|
-
limit:
|
|
5332
|
-
remaining:
|
|
5677
|
+
import { z as z62 } from "zod";
|
|
5678
|
+
var QuotaMetricSchema = z62.object({
|
|
5679
|
+
limit: z62.number(),
|
|
5680
|
+
remaining: z62.number()
|
|
5333
5681
|
}).passthrough();
|
|
5334
|
-
var WorkspaceQuotasSchema =
|
|
5682
|
+
var WorkspaceQuotasSchema = z62.object({
|
|
5335
5683
|
vm_slots: QuotaMetricSchema,
|
|
5336
5684
|
vcpu: QuotaMetricSchema,
|
|
5337
5685
|
memory_mb: QuotaMetricSchema,
|
|
5338
5686
|
disk_gb: QuotaMetricSchema
|
|
5339
5687
|
}).passthrough();
|
|
5340
|
-
var WorkspaceReservedGpuQuotaSchema =
|
|
5688
|
+
var WorkspaceReservedGpuQuotaSchema = z62.object({
|
|
5341
5689
|
gpus: QuotaMetricSchema,
|
|
5342
|
-
in_use:
|
|
5343
|
-
misconfigured:
|
|
5690
|
+
in_use: z62.number(),
|
|
5691
|
+
misconfigured: z62.number()
|
|
5344
5692
|
}).passthrough();
|
|
5345
|
-
var GetWorkspaceQuotasSchema =
|
|
5346
|
-
team_slug:
|
|
5347
|
-
tier:
|
|
5693
|
+
var GetWorkspaceQuotasSchema = z62.object({
|
|
5694
|
+
team_slug: z62.string(),
|
|
5695
|
+
tier: z62.string(),
|
|
5348
5696
|
quotas: WorkspaceQuotasSchema,
|
|
5349
5697
|
reserved_nodes: QuotaMetricSchema,
|
|
5350
5698
|
reserved_gpu: WorkspaceReservedGpuQuotaSchema,
|
|
5351
|
-
as_of:
|
|
5699
|
+
as_of: z62.string()
|
|
5352
5700
|
}).passthrough();
|
|
5353
5701
|
var { action: getWorkspaceQuotas, safeAction: safeGetWorkspaceQuotas } = defineAction(GetWorkspaceQuotasSchema, async (client, request) => {
|
|
5354
5702
|
return await client.get(`/workspaces/${request.teamSlug}/quotas`);
|
|
5355
5703
|
});
|
|
5356
5704
|
|
|
5357
5705
|
// src/actions/cvms/replicate_cvm.ts
|
|
5358
|
-
import { z as
|
|
5706
|
+
import { z as z63 } from "zod";
|
|
5359
5707
|
var ReplicateCvmRequestSchema = refineCvmId(
|
|
5360
5708
|
CvmIdObjectSchema.extend({
|
|
5361
|
-
node_id:
|
|
5709
|
+
node_id: z63.number().optional()
|
|
5362
5710
|
})
|
|
5363
5711
|
);
|
|
5364
|
-
|
|
5712
|
+
async function replicateCvm(client, request) {
|
|
5365
5713
|
const parsed = ReplicateCvmRequestSchema.parse(request);
|
|
5366
5714
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
5367
5715
|
const { node_id } = parsed;
|
|
5368
|
-
|
|
5369
|
-
|
|
5716
|
+
const response = await client.post(`/cvms/${cvmId}/replicas`, { node_id });
|
|
5717
|
+
return getVMSchemaForVersion(client.config.version).parse(response);
|
|
5718
|
+
}
|
|
5719
|
+
async function safeReplicateCvm(client, request) {
|
|
5720
|
+
try {
|
|
5721
|
+
const data = await replicateCvm(client, request);
|
|
5722
|
+
return { success: true, data };
|
|
5723
|
+
} catch (error) {
|
|
5724
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
5725
|
+
return { success: false, error };
|
|
5726
|
+
}
|
|
5727
|
+
return {
|
|
5728
|
+
success: false,
|
|
5729
|
+
error: {
|
|
5730
|
+
name: "Error",
|
|
5731
|
+
message: error instanceof Error ? error.message : String(error)
|
|
5732
|
+
}
|
|
5733
|
+
};
|
|
5734
|
+
}
|
|
5735
|
+
}
|
|
5370
5736
|
|
|
5371
5737
|
// src/actions/cvms/watch_cvm_state.ts
|
|
5372
|
-
import { z as
|
|
5373
|
-
var WatchCvmStateParamsSchema =
|
|
5374
|
-
target:
|
|
5375
|
-
interval:
|
|
5376
|
-
timeout:
|
|
5377
|
-
maxRetries:
|
|
5378
|
-
retryDelay:
|
|
5738
|
+
import { z as z64 } from "zod";
|
|
5739
|
+
var WatchCvmStateParamsSchema = z64.object({
|
|
5740
|
+
target: z64.string().describe("Target status to wait for (e.g., 'running', 'stopped')"),
|
|
5741
|
+
interval: z64.number().min(5).max(30).default(5).describe("Polling interval in seconds"),
|
|
5742
|
+
timeout: z64.number().min(10).max(600).default(300).describe("Timeout per attempt in seconds"),
|
|
5743
|
+
maxRetries: z64.number().min(0).default(Number.POSITIVE_INFINITY).describe("Maximum number of retry attempts (Infinity for unlimited)"),
|
|
5744
|
+
retryDelay: z64.number().min(0).default(5e3).describe("Delay between retries in milliseconds")
|
|
5379
5745
|
});
|
|
5380
5746
|
var WatchCvmStateRequestSchema = WatchCvmStateParamsSchema;
|
|
5381
5747
|
var WatchAbortedError = class extends Error {
|
|
@@ -5563,57 +5929,57 @@ function sleep(ms, signal) {
|
|
|
5563
5929
|
}
|
|
5564
5930
|
|
|
5565
5931
|
// src/actions/cvms/patch_cvm.ts
|
|
5566
|
-
import { z as
|
|
5932
|
+
import { z as z65 } from "zod";
|
|
5567
5933
|
var PatchCvmRequestSchema = refineCvmId(
|
|
5568
5934
|
CvmIdObjectSchema.extend({
|
|
5569
5935
|
// Compose-hash-affecting fields
|
|
5570
|
-
docker_compose_file:
|
|
5571
|
-
pre_launch_script:
|
|
5572
|
-
allowed_envs:
|
|
5936
|
+
docker_compose_file: z65.string().optional(),
|
|
5937
|
+
pre_launch_script: z65.string().optional(),
|
|
5938
|
+
allowed_envs: z65.array(z65.string()).optional(),
|
|
5573
5939
|
// Visibility
|
|
5574
|
-
public_logs:
|
|
5575
|
-
public_sysinfo:
|
|
5576
|
-
public_tcbinfo:
|
|
5940
|
+
public_logs: z65.boolean().optional(),
|
|
5941
|
+
public_sysinfo: z65.boolean().optional(),
|
|
5942
|
+
public_tcbinfo: z65.boolean().optional(),
|
|
5577
5943
|
// Non-compose-hash config
|
|
5578
|
-
encrypted_env:
|
|
5579
|
-
user_config:
|
|
5580
|
-
gpus:
|
|
5581
|
-
count:
|
|
5582
|
-
product_name:
|
|
5944
|
+
encrypted_env: z65.string().optional(),
|
|
5945
|
+
user_config: z65.string().optional(),
|
|
5946
|
+
gpus: z65.object({
|
|
5947
|
+
count: z65.number(),
|
|
5948
|
+
product_name: z65.string().optional()
|
|
5583
5949
|
}).optional(),
|
|
5584
5950
|
// Resources
|
|
5585
|
-
vcpu:
|
|
5586
|
-
memory:
|
|
5587
|
-
disk_size:
|
|
5951
|
+
vcpu: z65.number().optional(),
|
|
5952
|
+
memory: z65.number().optional(),
|
|
5953
|
+
disk_size: z65.number().optional(),
|
|
5588
5954
|
// OS image
|
|
5589
|
-
image:
|
|
5955
|
+
image: z65.string().optional(),
|
|
5590
5956
|
// Shutdown behavior
|
|
5591
|
-
shutdown_timeout:
|
|
5592
|
-
allow_force_stop:
|
|
5957
|
+
shutdown_timeout: z65.number().optional(),
|
|
5958
|
+
allow_force_stop: z65.boolean().optional(),
|
|
5593
5959
|
// Prepare-only mode (for multisig workflows)
|
|
5594
|
-
prepareOnly:
|
|
5960
|
+
prepareOnly: z65.boolean().optional()
|
|
5595
5961
|
})
|
|
5596
5962
|
);
|
|
5597
|
-
var PatchCvmAcceptedSchema =
|
|
5598
|
-
requiresOnChainHash:
|
|
5599
|
-
correlationId:
|
|
5600
|
-
});
|
|
5601
|
-
var PatchCvmHashRequiredSchema =
|
|
5602
|
-
requiresOnChainHash:
|
|
5603
|
-
composeHash:
|
|
5604
|
-
appId:
|
|
5605
|
-
deviceId:
|
|
5963
|
+
var PatchCvmAcceptedSchema = z65.object({
|
|
5964
|
+
requiresOnChainHash: z65.literal(false),
|
|
5965
|
+
correlationId: z65.string()
|
|
5966
|
+
});
|
|
5967
|
+
var PatchCvmHashRequiredSchema = z65.object({
|
|
5968
|
+
requiresOnChainHash: z65.literal(true),
|
|
5969
|
+
composeHash: z65.string(),
|
|
5970
|
+
appId: z65.string(),
|
|
5971
|
+
deviceId: z65.string(),
|
|
5606
5972
|
kmsInfo: KmsInfoSchema,
|
|
5607
|
-
commitToken:
|
|
5608
|
-
commitUrl:
|
|
5609
|
-
apiCommitUrl:
|
|
5610
|
-
onchainStatus:
|
|
5611
|
-
compose_hash_allowed:
|
|
5612
|
-
device_id_allowed:
|
|
5613
|
-
is_allowed:
|
|
5973
|
+
commitToken: z65.string().optional(),
|
|
5974
|
+
commitUrl: z65.string().optional(),
|
|
5975
|
+
apiCommitUrl: z65.string().optional(),
|
|
5976
|
+
onchainStatus: z65.object({
|
|
5977
|
+
compose_hash_allowed: z65.boolean(),
|
|
5978
|
+
device_id_allowed: z65.boolean(),
|
|
5979
|
+
is_allowed: z65.boolean()
|
|
5614
5980
|
}).optional()
|
|
5615
5981
|
});
|
|
5616
|
-
var PatchCvmResultSchema =
|
|
5982
|
+
var PatchCvmResultSchema = z65.discriminatedUnion("requiresOnChainHash", [
|
|
5617
5983
|
PatchCvmAcceptedSchema,
|
|
5618
5984
|
PatchCvmHashRequiredSchema
|
|
5619
5985
|
]);
|
|
@@ -5662,15 +6028,15 @@ var { action: patchCvm, safeAction: safePatchCvm } = defineAction(PatchCvmResult
|
|
|
5662
6028
|
});
|
|
5663
6029
|
|
|
5664
6030
|
// src/actions/cvms/confirm_cvm_patch.ts
|
|
5665
|
-
import { z as
|
|
6031
|
+
import { z as z66 } from "zod";
|
|
5666
6032
|
var ConfirmCvmPatchRequestSchema = refineCvmId(
|
|
5667
6033
|
CvmIdObjectSchema.extend({
|
|
5668
|
-
composeHash:
|
|
5669
|
-
transactionHash:
|
|
6034
|
+
composeHash: z66.string().describe("Compose hash from patchCvm Phase 1 response"),
|
|
6035
|
+
transactionHash: z66.string().describe("Transaction hash proving on-chain registration")
|
|
5670
6036
|
})
|
|
5671
6037
|
);
|
|
5672
|
-
var ConfirmCvmPatchResultSchema =
|
|
5673
|
-
correlationId:
|
|
6038
|
+
var ConfirmCvmPatchResultSchema = z66.object({
|
|
6039
|
+
correlationId: z66.string()
|
|
5674
6040
|
});
|
|
5675
6041
|
var { action: confirmCvmPatch, safeAction: safeConfirmCvmPatch } = defineAction(ConfirmCvmPatchResultSchema, async (client, request) => {
|
|
5676
6042
|
const parsed = ConfirmCvmPatchRequestSchema.parse(request);
|
|
@@ -5691,17 +6057,17 @@ var { action: confirmCvmPatch, safeAction: safeConfirmCvmPatch } = defineAction(
|
|
|
5691
6057
|
});
|
|
5692
6058
|
|
|
5693
6059
|
// src/actions/cvms/commit_cvm_update.ts
|
|
5694
|
-
import { z as
|
|
6060
|
+
import { z as z67 } from "zod";
|
|
5695
6061
|
var CommitCvmUpdateRequestSchema = refineCvmId(
|
|
5696
6062
|
CvmIdObjectSchema.extend({
|
|
5697
|
-
token:
|
|
5698
|
-
composeHash:
|
|
5699
|
-
transactionHash:
|
|
6063
|
+
token: z67.string().describe("One-time commit token from prepare-only flow"),
|
|
6064
|
+
composeHash: z67.string().describe("Compose hash from Phase 1 response"),
|
|
6065
|
+
transactionHash: z67.string().describe("Transaction hash proving on-chain registration")
|
|
5700
6066
|
})
|
|
5701
6067
|
);
|
|
5702
|
-
var CommitCvmUpdateResultSchema =
|
|
5703
|
-
correlationId:
|
|
5704
|
-
status:
|
|
6068
|
+
var CommitCvmUpdateResultSchema = z67.object({
|
|
6069
|
+
correlationId: z67.string(),
|
|
6070
|
+
status: z67.string()
|
|
5705
6071
|
});
|
|
5706
6072
|
var { action: commitCvmUpdate, safeAction: safeCommitCvmUpdate } = defineAction(CommitCvmUpdateResultSchema, async (client, request) => {
|
|
5707
6073
|
const parsed = CommitCvmUpdateRequestSchema.parse(request);
|
|
@@ -5718,93 +6084,160 @@ var { action: commitCvmUpdate, safeAction: safeCommitCvmUpdate } = defineAction(
|
|
|
5718
6084
|
});
|
|
5719
6085
|
|
|
5720
6086
|
// src/actions/cvms/refresh_cvm_instance_id.ts
|
|
5721
|
-
import { z as
|
|
5722
|
-
var InstanceIdRefreshResultBaseSchema =
|
|
5723
|
-
identifier:
|
|
5724
|
-
status:
|
|
5725
|
-
old_instance_id:
|
|
5726
|
-
new_instance_id:
|
|
5727
|
-
source:
|
|
5728
|
-
verified_with_gateway:
|
|
5729
|
-
reason:
|
|
6087
|
+
import { z as z68 } from "zod";
|
|
6088
|
+
var InstanceIdRefreshResultBaseSchema = z68.object({
|
|
6089
|
+
identifier: z68.string(),
|
|
6090
|
+
status: z68.enum(["updated", "unchanged", "skipped", "conflict", "error"]),
|
|
6091
|
+
old_instance_id: z68.string().nullable().optional(),
|
|
6092
|
+
new_instance_id: z68.string().nullable().optional(),
|
|
6093
|
+
source: z68.enum(["teepod_state", "teepod_info", "gateway", "none"]),
|
|
6094
|
+
verified_with_gateway: z68.boolean(),
|
|
6095
|
+
reason: z68.string().nullable().optional()
|
|
5730
6096
|
});
|
|
5731
6097
|
var InstanceIdRefreshResultV20260121Schema = InstanceIdRefreshResultBaseSchema.extend({
|
|
5732
|
-
cvm_id:
|
|
6098
|
+
cvm_id: z68.number().nullable()
|
|
5733
6099
|
});
|
|
5734
6100
|
var InstanceIdRefreshResultV20260522Schema = InstanceIdRefreshResultBaseSchema.extend({
|
|
5735
|
-
cvm_id:
|
|
6101
|
+
cvm_id: z68.string().nullable()
|
|
5736
6102
|
});
|
|
5737
|
-
var InstanceIdRefreshResultAnySchema =
|
|
6103
|
+
var InstanceIdRefreshResultAnySchema = z68.union([
|
|
5738
6104
|
InstanceIdRefreshResultV20260121Schema,
|
|
5739
6105
|
InstanceIdRefreshResultV20260522Schema
|
|
5740
6106
|
]);
|
|
5741
6107
|
var InstanceIdRefreshResultSchema = InstanceIdRefreshResultV20260522Schema;
|
|
5742
6108
|
var RefreshCvmInstanceIdRequestSchema = refineCvmId(
|
|
5743
6109
|
CvmIdObjectSchema.extend({
|
|
5744
|
-
overwrite:
|
|
5745
|
-
dry_run:
|
|
6110
|
+
overwrite: z68.boolean().optional(),
|
|
6111
|
+
dry_run: z68.boolean().optional()
|
|
5746
6112
|
})
|
|
5747
6113
|
);
|
|
5748
|
-
|
|
6114
|
+
function getSchemaForVersion6(version) {
|
|
6115
|
+
if (version === "2026-01-21") return InstanceIdRefreshResultV20260121Schema;
|
|
6116
|
+
return InstanceIdRefreshResultV20260522Schema;
|
|
6117
|
+
}
|
|
6118
|
+
async function refreshCvmInstanceId(client, request) {
|
|
5749
6119
|
const parsed = RefreshCvmInstanceIdRequestSchema.parse(request);
|
|
5750
6120
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
5751
6121
|
const { overwrite, dry_run } = parsed;
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
}
|
|
6122
|
+
const response = await client.patch(`/cvms/${cvmId}/instance-id`, { overwrite, dry_run });
|
|
6123
|
+
return getSchemaForVersion6(client.config.version).parse(
|
|
6124
|
+
response
|
|
6125
|
+
);
|
|
6126
|
+
}
|
|
6127
|
+
async function safeRefreshCvmInstanceId(client, request) {
|
|
6128
|
+
try {
|
|
6129
|
+
const data = await refreshCvmInstanceId(client, request);
|
|
6130
|
+
return { success: true, data };
|
|
6131
|
+
} catch (error) {
|
|
6132
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
6133
|
+
return { success: false, error };
|
|
6134
|
+
}
|
|
6135
|
+
return {
|
|
6136
|
+
success: false,
|
|
6137
|
+
error: {
|
|
6138
|
+
name: "Error",
|
|
6139
|
+
message: error instanceof Error ? error.message : String(error)
|
|
6140
|
+
}
|
|
6141
|
+
};
|
|
6142
|
+
}
|
|
6143
|
+
}
|
|
5757
6144
|
|
|
5758
6145
|
// src/actions/cvms/refresh_cvm_instance_ids.ts
|
|
5759
|
-
import { z as
|
|
5760
|
-
var RefreshCvmInstanceIdsRequestSchema =
|
|
5761
|
-
cvm_ids:
|
|
5762
|
-
running_only:
|
|
5763
|
-
missing_only:
|
|
5764
|
-
overwrite:
|
|
5765
|
-
limit:
|
|
5766
|
-
dry_run:
|
|
6146
|
+
import { z as z69 } from "zod";
|
|
6147
|
+
var RefreshCvmInstanceIdsRequestSchema = z69.object({
|
|
6148
|
+
cvm_ids: z69.array(z69.string()).optional(),
|
|
6149
|
+
running_only: z69.boolean().optional(),
|
|
6150
|
+
missing_only: z69.boolean().optional(),
|
|
6151
|
+
overwrite: z69.boolean().optional(),
|
|
6152
|
+
limit: z69.number().int().min(1).max(500).optional(),
|
|
6153
|
+
dry_run: z69.boolean().optional()
|
|
5767
6154
|
}).strict();
|
|
5768
|
-
var RefreshCvmInstanceIdsResponseBaseSchema =
|
|
5769
|
-
total:
|
|
5770
|
-
scanned:
|
|
5771
|
-
updated:
|
|
5772
|
-
unchanged:
|
|
5773
|
-
skipped:
|
|
5774
|
-
conflicts:
|
|
5775
|
-
errors:
|
|
6155
|
+
var RefreshCvmInstanceIdsResponseBaseSchema = z69.object({
|
|
6156
|
+
total: z69.number().int(),
|
|
6157
|
+
scanned: z69.number().int(),
|
|
6158
|
+
updated: z69.number().int(),
|
|
6159
|
+
unchanged: z69.number().int(),
|
|
6160
|
+
skipped: z69.number().int(),
|
|
6161
|
+
conflicts: z69.number().int(),
|
|
6162
|
+
errors: z69.number().int()
|
|
5776
6163
|
});
|
|
5777
6164
|
var RefreshCvmInstanceIdsResponseV20260121Schema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5778
|
-
items:
|
|
6165
|
+
items: z69.array(InstanceIdRefreshResultV20260121Schema)
|
|
5779
6166
|
});
|
|
5780
6167
|
var RefreshCvmInstanceIdsResponseV20260522Schema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5781
|
-
items:
|
|
6168
|
+
items: z69.array(InstanceIdRefreshResultV20260522Schema)
|
|
5782
6169
|
});
|
|
5783
6170
|
var RefreshCvmInstanceIdsResponseAnySchema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5784
|
-
items:
|
|
6171
|
+
items: z69.array(
|
|
6172
|
+
z69.union([InstanceIdRefreshResultV20260121Schema, InstanceIdRefreshResultV20260522Schema])
|
|
6173
|
+
)
|
|
5785
6174
|
});
|
|
5786
6175
|
var RefreshCvmInstanceIdsResponseSchema = RefreshCvmInstanceIdsResponseV20260522Schema;
|
|
5787
|
-
|
|
6176
|
+
function getSchemaForVersion7(version) {
|
|
6177
|
+
if (version === "2026-01-21") return RefreshCvmInstanceIdsResponseV20260121Schema;
|
|
6178
|
+
return RefreshCvmInstanceIdsResponseV20260522Schema;
|
|
6179
|
+
}
|
|
6180
|
+
async function refreshCvmInstanceIds(client, request) {
|
|
5788
6181
|
const parsed = RefreshCvmInstanceIdsRequestSchema.parse(request);
|
|
5789
|
-
|
|
5790
|
-
|
|
6182
|
+
const response = await client.patch("/cvms/instance-ids", parsed);
|
|
6183
|
+
return getSchemaForVersion7(client.config.version).parse(
|
|
6184
|
+
response
|
|
6185
|
+
);
|
|
6186
|
+
}
|
|
6187
|
+
async function safeRefreshCvmInstanceIds(client, request) {
|
|
6188
|
+
try {
|
|
6189
|
+
const data = await refreshCvmInstanceIds(client, request);
|
|
6190
|
+
return { success: true, data };
|
|
6191
|
+
} catch (error) {
|
|
6192
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
6193
|
+
return { success: false, error };
|
|
6194
|
+
}
|
|
6195
|
+
return {
|
|
6196
|
+
success: false,
|
|
6197
|
+
error: {
|
|
6198
|
+
name: "Error",
|
|
6199
|
+
message: error instanceof Error ? error.message : String(error)
|
|
6200
|
+
}
|
|
6201
|
+
};
|
|
6202
|
+
}
|
|
6203
|
+
}
|
|
5791
6204
|
|
|
5792
6205
|
// src/actions/cvms/get_cvm_status_batch.ts
|
|
5793
|
-
import { z as
|
|
5794
|
-
var
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
6206
|
+
import { z as z70 } from "zod";
|
|
6207
|
+
var CvmResourceUsageSchema = z70.object({
|
|
6208
|
+
cpu_percent: z70.number().nullable().optional(),
|
|
6209
|
+
memory_used_bytes: z70.number().nullable().optional(),
|
|
6210
|
+
memory_total_bytes: z70.number().nullable().optional(),
|
|
6211
|
+
disk_used_bytes: z70.number().nullable().optional(),
|
|
6212
|
+
disk_total_bytes: z70.number().nullable().optional(),
|
|
6213
|
+
egress_bytes: z70.number().nullable().optional()
|
|
6214
|
+
});
|
|
6215
|
+
var CvmStatusSchema = z70.object({
|
|
6216
|
+
vm_uuid: z70.string(),
|
|
6217
|
+
status: z70.string(),
|
|
6218
|
+
uptime: z70.string().nullable().optional(),
|
|
6219
|
+
in_progress: z70.boolean(),
|
|
6220
|
+
boot_progress: z70.string().nullable().optional(),
|
|
6221
|
+
boot_error: z70.string().nullable().optional(),
|
|
6222
|
+
shutdown_progress: z70.string().nullable().optional(),
|
|
6223
|
+
events: z70.array(
|
|
6224
|
+
z70.object({
|
|
6225
|
+
event: z70.string(),
|
|
6226
|
+
body: z70.string(),
|
|
6227
|
+
timestamp: z70.number()
|
|
6228
|
+
})
|
|
6229
|
+
).default([]),
|
|
6230
|
+
operation: z70.object({
|
|
6231
|
+
type: z70.string().nullable().optional(),
|
|
6232
|
+
phase: z70.string().nullable().optional(),
|
|
6233
|
+
started_at: z70.string().nullable().optional(),
|
|
6234
|
+
correlation_id: z70.string().nullable().optional()
|
|
6235
|
+
}).nullable().optional(),
|
|
6236
|
+
resource_usage: CvmResourceUsageSchema.nullable().optional()
|
|
6237
|
+
});
|
|
6238
|
+
var GetCvmStatusBatchResponseSchema = z70.record(z70.string(), CvmStatusSchema);
|
|
6239
|
+
var GetCvmStatusBatchRequestSchema = z70.object({
|
|
6240
|
+
vmUuids: z70.array(z70.string())
|
|
5808
6241
|
});
|
|
5809
6242
|
var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAction(GetCvmStatusBatchResponseSchema, async (client, request) => {
|
|
5810
6243
|
const { vmUuids } = GetCvmStatusBatchRequestSchema.parse(request);
|
|
@@ -5812,11 +6245,11 @@ var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAct
|
|
|
5812
6245
|
});
|
|
5813
6246
|
|
|
5814
6247
|
// src/actions/cvms/get_cvm_user_config.ts
|
|
5815
|
-
import { z as
|
|
5816
|
-
var CvmUserConfigSchema =
|
|
5817
|
-
hostname:
|
|
5818
|
-
ssh_authorized_keys:
|
|
5819
|
-
default_gateway_domain:
|
|
6248
|
+
import { z as z71 } from "zod";
|
|
6249
|
+
var CvmUserConfigSchema = z71.object({
|
|
6250
|
+
hostname: z71.string().nullable().optional(),
|
|
6251
|
+
ssh_authorized_keys: z71.array(z71.string()).default([]),
|
|
6252
|
+
default_gateway_domain: z71.string().nullable().optional()
|
|
5820
6253
|
});
|
|
5821
6254
|
var GetCvmUserConfigRequestSchema = CvmIdSchema;
|
|
5822
6255
|
var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineAction(CvmUserConfigSchema, async (client, request) => {
|
|
@@ -5825,48 +6258,70 @@ var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineActio
|
|
|
5825
6258
|
});
|
|
5826
6259
|
|
|
5827
6260
|
// src/actions/cvms/check_cvm_is_allowed.ts
|
|
5828
|
-
import { z as
|
|
5829
|
-
var IsAllowedResultBaseSchema =
|
|
5830
|
-
app_contract_address:
|
|
5831
|
-
compose_hash:
|
|
5832
|
-
device_id:
|
|
5833
|
-
compose_hash_allowed:
|
|
5834
|
-
allow_any_device:
|
|
5835
|
-
device_id_allowed:
|
|
5836
|
-
is_allowed:
|
|
5837
|
-
error:
|
|
6261
|
+
import { z as z72 } from "zod";
|
|
6262
|
+
var IsAllowedResultBaseSchema = z72.object({
|
|
6263
|
+
app_contract_address: z72.string(),
|
|
6264
|
+
compose_hash: z72.string(),
|
|
6265
|
+
device_id: z72.string(),
|
|
6266
|
+
compose_hash_allowed: z72.boolean(),
|
|
6267
|
+
allow_any_device: z72.boolean(),
|
|
6268
|
+
device_id_allowed: z72.boolean().nullable().optional(),
|
|
6269
|
+
is_allowed: z72.boolean(),
|
|
6270
|
+
error: z72.string().nullable().optional()
|
|
5838
6271
|
});
|
|
5839
6272
|
var IsAllowedResultV20260121Schema = IsAllowedResultBaseSchema.extend({
|
|
5840
|
-
cvm_id:
|
|
6273
|
+
cvm_id: z72.number().optional()
|
|
5841
6274
|
});
|
|
5842
6275
|
var IsAllowedResultV20260522Schema = IsAllowedResultBaseSchema.extend({
|
|
5843
|
-
cvm_id:
|
|
6276
|
+
cvm_id: z72.string().optional()
|
|
5844
6277
|
});
|
|
5845
|
-
var IsAllowedResultAnySchema =
|
|
6278
|
+
var IsAllowedResultAnySchema = z72.union([
|
|
5846
6279
|
IsAllowedResultV20260121Schema,
|
|
5847
6280
|
IsAllowedResultV20260522Schema
|
|
5848
6281
|
]);
|
|
5849
6282
|
var IsAllowedResultSchema = IsAllowedResultV20260522Schema;
|
|
5850
|
-
var CheckCvmIsAllowedInputSchema =
|
|
5851
|
-
cvmId:
|
|
5852
|
-
compose_hash:
|
|
5853
|
-
node_id:
|
|
5854
|
-
device_id:
|
|
6283
|
+
var CheckCvmIsAllowedInputSchema = z72.object({
|
|
6284
|
+
cvmId: z72.string().min(1),
|
|
6285
|
+
compose_hash: z72.string().optional(),
|
|
6286
|
+
node_id: z72.number().optional(),
|
|
6287
|
+
device_id: z72.string().optional()
|
|
5855
6288
|
});
|
|
5856
6289
|
var CheckCvmIsAllowedRequestSchema = CheckCvmIsAllowedInputSchema;
|
|
5857
|
-
|
|
6290
|
+
function getSchemaForVersion8(version) {
|
|
6291
|
+
if (version === "2026-01-21") return IsAllowedResultV20260121Schema;
|
|
6292
|
+
return IsAllowedResultV20260522Schema;
|
|
6293
|
+
}
|
|
6294
|
+
async function checkCvmIsAllowed(client, request) {
|
|
5858
6295
|
const { cvmId, ...body } = CheckCvmIsAllowedRequestSchema.parse(request);
|
|
5859
|
-
|
|
5860
|
-
|
|
6296
|
+
const response = await client.post(`/cvms/${cvmId}/is-allowed`, body);
|
|
6297
|
+
return getSchemaForVersion8(client.config.version).parse(response);
|
|
6298
|
+
}
|
|
6299
|
+
async function safeCheckCvmIsAllowed(client, request) {
|
|
6300
|
+
try {
|
|
6301
|
+
const data = await checkCvmIsAllowed(client, request);
|
|
6302
|
+
return { success: true, data };
|
|
6303
|
+
} catch (error) {
|
|
6304
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
6305
|
+
return { success: false, error };
|
|
6306
|
+
}
|
|
6307
|
+
return {
|
|
6308
|
+
success: false,
|
|
6309
|
+
error: {
|
|
6310
|
+
name: "Error",
|
|
6311
|
+
message: error instanceof Error ? error.message : String(error)
|
|
6312
|
+
}
|
|
6313
|
+
};
|
|
6314
|
+
}
|
|
6315
|
+
}
|
|
5861
6316
|
|
|
5862
6317
|
// src/actions/apps/check_app_is_allowed.ts
|
|
5863
|
-
import { z as
|
|
5864
|
-
var CheckAppIsAllowedRequestSchema =
|
|
5865
|
-
appId:
|
|
5866
|
-
compose_hash:
|
|
5867
|
-
node_id:
|
|
5868
|
-
device_id:
|
|
5869
|
-
chain_id:
|
|
6318
|
+
import { z as z73 } from "zod";
|
|
6319
|
+
var CheckAppIsAllowedRequestSchema = z73.object({
|
|
6320
|
+
appId: z73.string().min(1),
|
|
6321
|
+
compose_hash: z73.string(),
|
|
6322
|
+
node_id: z73.number().optional(),
|
|
6323
|
+
device_id: z73.string().optional(),
|
|
6324
|
+
chain_id: z73.number().optional()
|
|
5870
6325
|
});
|
|
5871
6326
|
var { action: checkAppIsAllowed, safeAction: safeCheckAppIsAllowed } = defineAction(IsAllowedResultSchema, async (client, request) => {
|
|
5872
6327
|
const { appId, ...body } = CheckAppIsAllowedRequestSchema.parse(request);
|
|
@@ -5874,51 +6329,75 @@ var { action: checkAppIsAllowed, safeAction: safeCheckAppIsAllowed } = defineAct
|
|
|
5874
6329
|
});
|
|
5875
6330
|
|
|
5876
6331
|
// src/actions/apps/check_app_cvms_is_allowed.ts
|
|
5877
|
-
import { z as
|
|
5878
|
-
var AppCvmsBatchIsAllowedResponseBaseSchema =
|
|
5879
|
-
is_onchain:
|
|
5880
|
-
total:
|
|
5881
|
-
allowed_count:
|
|
5882
|
-
denied_count:
|
|
5883
|
-
error_count:
|
|
6332
|
+
import { z as z74 } from "zod";
|
|
6333
|
+
var AppCvmsBatchIsAllowedResponseBaseSchema = z74.object({
|
|
6334
|
+
is_onchain: z74.boolean(),
|
|
6335
|
+
total: z74.number().default(0),
|
|
6336
|
+
allowed_count: z74.number().default(0),
|
|
6337
|
+
denied_count: z74.number().default(0),
|
|
6338
|
+
error_count: z74.number().default(0)
|
|
5884
6339
|
});
|
|
5885
6340
|
var AppCvmsBatchIsAllowedResponseV20260121Schema = AppCvmsBatchIsAllowedResponseBaseSchema.extend({
|
|
5886
|
-
results:
|
|
5887
|
-
skipped_cvm_ids:
|
|
6341
|
+
results: z74.array(IsAllowedResultV20260121Schema.extend({ cvm_id: z74.number() })).default([]),
|
|
6342
|
+
skipped_cvm_ids: z74.array(z74.number()).default([])
|
|
5888
6343
|
});
|
|
5889
6344
|
var AppCvmsBatchIsAllowedResponseV20260522Schema = AppCvmsBatchIsAllowedResponseBaseSchema.extend({
|
|
5890
|
-
results:
|
|
5891
|
-
skipped_cvm_ids:
|
|
6345
|
+
results: z74.array(IsAllowedResultV20260522Schema.extend({ cvm_id: z74.string() })).default([]),
|
|
6346
|
+
skipped_cvm_ids: z74.array(z74.string()).default([])
|
|
5892
6347
|
});
|
|
5893
|
-
var AppCvmsBatchIsAllowedResponseAnySchema =
|
|
6348
|
+
var AppCvmsBatchIsAllowedResponseAnySchema = z74.union([
|
|
5894
6349
|
AppCvmsBatchIsAllowedResponseV20260121Schema,
|
|
5895
6350
|
AppCvmsBatchIsAllowedResponseV20260522Schema
|
|
5896
6351
|
]);
|
|
5897
6352
|
var AppCvmsBatchIsAllowedResponseSchema = AppCvmsBatchIsAllowedResponseV20260522Schema;
|
|
5898
|
-
var CheckAppCvmsIsAllowedRequestSchema =
|
|
5899
|
-
appId:
|
|
6353
|
+
var CheckAppCvmsIsAllowedRequestSchema = z74.object({
|
|
6354
|
+
appId: z74.string().min(1)
|
|
5900
6355
|
});
|
|
5901
|
-
|
|
6356
|
+
function getSchemaForVersion9(version) {
|
|
6357
|
+
if (version === "2026-01-21") return AppCvmsBatchIsAllowedResponseV20260121Schema;
|
|
6358
|
+
return AppCvmsBatchIsAllowedResponseV20260522Schema;
|
|
6359
|
+
}
|
|
6360
|
+
async function checkAppCvmsIsAllowed(client, request) {
|
|
5902
6361
|
const { appId } = CheckAppCvmsIsAllowedRequestSchema.parse(request);
|
|
5903
|
-
|
|
5904
|
-
|
|
6362
|
+
const response = await client.post(`/apps/${appId}/cvms/is-allowed`, {});
|
|
6363
|
+
return getSchemaForVersion9(client.config.version).parse(
|
|
6364
|
+
response
|
|
6365
|
+
);
|
|
6366
|
+
}
|
|
6367
|
+
async function safeCheckAppCvmsIsAllowed(client, request) {
|
|
6368
|
+
try {
|
|
6369
|
+
const data = await checkAppCvmsIsAllowed(client, request);
|
|
6370
|
+
return { success: true, data };
|
|
6371
|
+
} catch (error) {
|
|
6372
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
6373
|
+
return { success: false, error };
|
|
6374
|
+
}
|
|
6375
|
+
return {
|
|
6376
|
+
success: false,
|
|
6377
|
+
error: {
|
|
6378
|
+
name: "Error",
|
|
6379
|
+
message: error instanceof Error ? error.message : String(error)
|
|
6380
|
+
}
|
|
6381
|
+
};
|
|
6382
|
+
}
|
|
6383
|
+
}
|
|
5905
6384
|
|
|
5906
6385
|
// src/actions/apps/get_app_list.ts
|
|
5907
|
-
import { z as
|
|
5908
|
-
var GetAppListRequestSchema =
|
|
5909
|
-
page:
|
|
5910
|
-
page_size:
|
|
5911
|
-
search:
|
|
5912
|
-
status:
|
|
5913
|
-
listed:
|
|
5914
|
-
base_image:
|
|
5915
|
-
instance_type:
|
|
5916
|
-
kms_slug:
|
|
5917
|
-
kms_type:
|
|
5918
|
-
node:
|
|
5919
|
-
region:
|
|
6386
|
+
import { z as z75 } from "zod";
|
|
6387
|
+
var GetAppListRequestSchema = z75.object({
|
|
6388
|
+
page: z75.number().int().min(1).optional(),
|
|
6389
|
+
page_size: z75.number().int().min(1).max(100).optional(),
|
|
6390
|
+
search: z75.string().optional(),
|
|
6391
|
+
status: z75.array(z75.string()).optional(),
|
|
6392
|
+
listed: z75.boolean().optional(),
|
|
6393
|
+
base_image: z75.string().optional(),
|
|
6394
|
+
instance_type: z75.string().optional(),
|
|
6395
|
+
kms_slug: z75.string().optional(),
|
|
6396
|
+
kms_type: z75.string().optional(),
|
|
6397
|
+
node: z75.string().optional(),
|
|
6398
|
+
region: z75.string().optional()
|
|
5920
6399
|
}).strict();
|
|
5921
|
-
function
|
|
6400
|
+
function getSchemaForVersion10(version) {
|
|
5922
6401
|
if (version === "2025-10-28") return DstackAppListResponseV20251028Schema;
|
|
5923
6402
|
if (version === "2026-01-21") return DstackAppListResponseV20260121Schema;
|
|
5924
6403
|
return DstackAppListResponseV20260522Schema;
|
|
@@ -5926,7 +6405,7 @@ function getSchemaForVersion5(version) {
|
|
|
5926
6405
|
async function getAppList(client, request) {
|
|
5927
6406
|
const validatedRequest = GetAppListRequestSchema.parse(request ?? {});
|
|
5928
6407
|
const response = await client.get("/apps", { params: validatedRequest });
|
|
5929
|
-
const schema =
|
|
6408
|
+
const schema = getSchemaForVersion10(client.config.version);
|
|
5930
6409
|
return schema.parse(response);
|
|
5931
6410
|
}
|
|
5932
6411
|
async function safeGetAppList(client, request) {
|
|
@@ -5948,11 +6427,11 @@ async function safeGetAppList(client, request) {
|
|
|
5948
6427
|
}
|
|
5949
6428
|
|
|
5950
6429
|
// src/actions/apps/get_app_info.ts
|
|
5951
|
-
import { z as
|
|
5952
|
-
var GetAppInfoRequestSchema =
|
|
5953
|
-
appId:
|
|
6430
|
+
import { z as z76 } from "zod";
|
|
6431
|
+
var GetAppInfoRequestSchema = z76.object({
|
|
6432
|
+
appId: z76.string().min(1)
|
|
5954
6433
|
}).strict();
|
|
5955
|
-
function
|
|
6434
|
+
function getSchemaForVersion11(version) {
|
|
5956
6435
|
if (version === "2025-10-28") return DstackAppWithCvmResponseV20251028Schema;
|
|
5957
6436
|
if (version === "2026-01-21") return DstackAppWithCvmResponseV20260121Schema;
|
|
5958
6437
|
return DstackAppWithCvmResponseV20260522Schema;
|
|
@@ -5960,7 +6439,7 @@ function getSchemaForVersion6(version) {
|
|
|
5960
6439
|
async function getAppInfo(client, request) {
|
|
5961
6440
|
const { appId } = GetAppInfoRequestSchema.parse(request);
|
|
5962
6441
|
const response = await client.get(`/apps/${appId}`);
|
|
5963
|
-
const schema =
|
|
6442
|
+
const schema = getSchemaForVersion11(client.config.version);
|
|
5964
6443
|
return schema.parse(response);
|
|
5965
6444
|
}
|
|
5966
6445
|
async function safeGetAppInfo(client, request) {
|
|
@@ -5982,19 +6461,19 @@ async function safeGetAppInfo(client, request) {
|
|
|
5982
6461
|
}
|
|
5983
6462
|
|
|
5984
6463
|
// src/actions/apps/get_app_cvms.ts
|
|
5985
|
-
import { z as
|
|
5986
|
-
var GetAppCvmsRequestSchema =
|
|
5987
|
-
appId:
|
|
6464
|
+
import { z as z77 } from "zod";
|
|
6465
|
+
var GetAppCvmsRequestSchema = z77.object({
|
|
6466
|
+
appId: z77.string().min(1)
|
|
5988
6467
|
}).strict();
|
|
5989
|
-
function
|
|
5990
|
-
if (version === "2025-10-28") return
|
|
5991
|
-
if (version === "2026-01-21") return
|
|
5992
|
-
return
|
|
6468
|
+
function getSchemaForVersion12(version) {
|
|
6469
|
+
if (version === "2025-10-28") return z77.array(CvmInfoV20251028Schema);
|
|
6470
|
+
if (version === "2026-01-21") return z77.array(CvmInfoV20260121Schema);
|
|
6471
|
+
return z77.array(CvmInfoV20260522Schema);
|
|
5993
6472
|
}
|
|
5994
6473
|
async function getAppCvms(client, request) {
|
|
5995
6474
|
const { appId } = GetAppCvmsRequestSchema.parse(request);
|
|
5996
6475
|
const response = await client.get(`/apps/${appId}/cvms`);
|
|
5997
|
-
const schema =
|
|
6476
|
+
const schema = getSchemaForVersion12(client.config.version);
|
|
5998
6477
|
return schema.parse(response);
|
|
5999
6478
|
}
|
|
6000
6479
|
async function safeGetAppCvms(client, request) {
|
|
@@ -6016,17 +6495,17 @@ async function safeGetAppCvms(client, request) {
|
|
|
6016
6495
|
}
|
|
6017
6496
|
|
|
6018
6497
|
// src/actions/apps/create_app_instance.ts
|
|
6019
|
-
import { z as
|
|
6020
|
-
var CreateAppInstanceRequestSchema =
|
|
6021
|
-
appId:
|
|
6022
|
-
name:
|
|
6023
|
-
node_id:
|
|
6024
|
-
docker_compose_file:
|
|
6025
|
-
pre_launch_script:
|
|
6026
|
-
encrypted_env:
|
|
6027
|
-
compose_hash:
|
|
6028
|
-
token:
|
|
6029
|
-
transaction_hash:
|
|
6498
|
+
import { z as z78 } from "zod";
|
|
6499
|
+
var CreateAppInstanceRequestSchema = z78.object({
|
|
6500
|
+
appId: z78.string().min(1),
|
|
6501
|
+
name: z78.string().optional(),
|
|
6502
|
+
node_id: z78.number().optional(),
|
|
6503
|
+
docker_compose_file: z78.string().optional(),
|
|
6504
|
+
pre_launch_script: z78.string().optional(),
|
|
6505
|
+
encrypted_env: z78.string().optional(),
|
|
6506
|
+
compose_hash: z78.string().optional(),
|
|
6507
|
+
token: z78.string().optional(),
|
|
6508
|
+
transaction_hash: z78.string().optional()
|
|
6030
6509
|
}).strict();
|
|
6031
6510
|
var { action: createAppInstance, safeAction: safeCreateAppInstance } = defineAction(VMSchema, async (client, request) => {
|
|
6032
6511
|
const parsed = CreateAppInstanceRequestSchema.parse(request);
|
|
@@ -6035,47 +6514,52 @@ var { action: createAppInstance, safeAction: safeCreateAppInstance } = defineAct
|
|
|
6035
6514
|
});
|
|
6036
6515
|
|
|
6037
6516
|
// src/actions/apps/get_app_device_allowlist.ts
|
|
6038
|
-
import { z as
|
|
6039
|
-
var DeviceAllowlistItemBaseSchema =
|
|
6040
|
-
device_id:
|
|
6041
|
-
node_name:
|
|
6042
|
-
allowed_onchain:
|
|
6043
|
-
status:
|
|
6517
|
+
import { z as z79 } from "zod";
|
|
6518
|
+
var DeviceAllowlistItemBaseSchema = z79.object({
|
|
6519
|
+
device_id: z79.string(),
|
|
6520
|
+
node_name: z79.string().nullable(),
|
|
6521
|
+
allowed_onchain: z79.boolean(),
|
|
6522
|
+
status: z79.string()
|
|
6044
6523
|
});
|
|
6045
6524
|
var DeviceAllowlistItemV20260121Schema = DeviceAllowlistItemBaseSchema.extend({
|
|
6046
|
-
cvm_ids:
|
|
6525
|
+
cvm_ids: z79.array(z79.number())
|
|
6047
6526
|
});
|
|
6048
6527
|
var DeviceAllowlistItemV20260522Schema = DeviceAllowlistItemBaseSchema.extend({
|
|
6049
|
-
cvm_ids:
|
|
6528
|
+
cvm_ids: z79.array(z79.string())
|
|
6050
6529
|
});
|
|
6051
|
-
var DeviceAllowlistResponseBaseSchema =
|
|
6052
|
-
is_onchain_kms:
|
|
6053
|
-
allow_any_device:
|
|
6054
|
-
chain_id:
|
|
6055
|
-
app_contract_address:
|
|
6530
|
+
var DeviceAllowlistResponseBaseSchema = z79.object({
|
|
6531
|
+
is_onchain_kms: z79.boolean(),
|
|
6532
|
+
allow_any_device: z79.boolean().nullable().optional(),
|
|
6533
|
+
chain_id: z79.number().nullable().optional(),
|
|
6534
|
+
app_contract_address: z79.string().nullable().optional()
|
|
6056
6535
|
});
|
|
6057
6536
|
var DeviceAllowlistResponseV20260121Schema = DeviceAllowlistResponseBaseSchema.extend({
|
|
6058
|
-
devices:
|
|
6537
|
+
devices: z79.array(DeviceAllowlistItemV20260121Schema).optional().default([])
|
|
6059
6538
|
});
|
|
6060
6539
|
var DeviceAllowlistResponseV20260522Schema = DeviceAllowlistResponseBaseSchema.extend({
|
|
6061
|
-
devices:
|
|
6540
|
+
devices: z79.array(DeviceAllowlistItemV20260522Schema).optional().default([])
|
|
6062
6541
|
});
|
|
6063
|
-
var DeviceAllowlistItemAnySchema =
|
|
6542
|
+
var DeviceAllowlistItemAnySchema = z79.union([
|
|
6064
6543
|
DeviceAllowlistItemV20260121Schema,
|
|
6065
6544
|
DeviceAllowlistItemV20260522Schema
|
|
6066
6545
|
]);
|
|
6067
|
-
var DeviceAllowlistResponseAnySchema =
|
|
6546
|
+
var DeviceAllowlistResponseAnySchema = z79.union([
|
|
6068
6547
|
DeviceAllowlistResponseV20260121Schema,
|
|
6069
6548
|
DeviceAllowlistResponseV20260522Schema
|
|
6070
6549
|
]);
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6550
|
+
function getSchemaForVersion13(version) {
|
|
6551
|
+
if (version === "2026-01-21") return DeviceAllowlistResponseV20260121Schema;
|
|
6552
|
+
return DeviceAllowlistResponseV20260522Schema;
|
|
6553
|
+
}
|
|
6554
|
+
var GetAppDeviceAllowlistRequestSchema = z79.object({
|
|
6555
|
+
appId: z79.string().min(1)
|
|
6074
6556
|
}).strict();
|
|
6075
6557
|
async function getAppDeviceAllowlist(client, request) {
|
|
6076
6558
|
const { appId } = GetAppDeviceAllowlistRequestSchema.parse(request);
|
|
6077
6559
|
const response = await client.get(`/apps/${appId}/device-allowlist`);
|
|
6078
|
-
return
|
|
6560
|
+
return getSchemaForVersion13(client.config.version).parse(
|
|
6561
|
+
response
|
|
6562
|
+
);
|
|
6079
6563
|
}
|
|
6080
6564
|
async function safeGetAppDeviceAllowlist(client, request) {
|
|
6081
6565
|
try {
|
|
@@ -6096,11 +6580,11 @@ async function safeGetAppDeviceAllowlist(client, request) {
|
|
|
6096
6580
|
}
|
|
6097
6581
|
|
|
6098
6582
|
// src/actions/apps/get_app_revisions.ts
|
|
6099
|
-
import { z as
|
|
6100
|
-
var GetAppRevisionsRequestSchema =
|
|
6101
|
-
appId:
|
|
6102
|
-
page:
|
|
6103
|
-
page_size:
|
|
6583
|
+
import { z as z80 } from "zod";
|
|
6584
|
+
var GetAppRevisionsRequestSchema = z80.object({
|
|
6585
|
+
appId: z80.string().min(1),
|
|
6586
|
+
page: z80.number().int().min(1).optional(),
|
|
6587
|
+
page_size: z80.number().int().min(1).max(1e3).optional()
|
|
6104
6588
|
}).strict();
|
|
6105
6589
|
async function getAppRevisions(client, request) {
|
|
6106
6590
|
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
@@ -6126,11 +6610,11 @@ async function safeGetAppRevisions(client, request) {
|
|
|
6126
6610
|
}
|
|
6127
6611
|
|
|
6128
6612
|
// src/actions/apps/get_app_revision_detail.ts
|
|
6129
|
-
import { z as
|
|
6130
|
-
var GetAppRevisionDetailRequestSchema =
|
|
6131
|
-
appId:
|
|
6132
|
-
revisionId:
|
|
6133
|
-
rawComposeFile:
|
|
6613
|
+
import { z as z81 } from "zod";
|
|
6614
|
+
var GetAppRevisionDetailRequestSchema = z81.object({
|
|
6615
|
+
appId: z81.string().min(1),
|
|
6616
|
+
revisionId: z81.string().min(1),
|
|
6617
|
+
rawComposeFile: z81.boolean().optional()
|
|
6134
6618
|
}).strict();
|
|
6135
6619
|
async function getAppRevisionDetail(client, request) {
|
|
6136
6620
|
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
@@ -6157,15 +6641,15 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
6157
6641
|
}
|
|
6158
6642
|
|
|
6159
6643
|
// src/actions/apps/get_app_filter_options.ts
|
|
6160
|
-
import { z as
|
|
6161
|
-
var AppFilterOptionsSchema =
|
|
6162
|
-
statuses:
|
|
6163
|
-
image_versions:
|
|
6164
|
-
instance_types:
|
|
6165
|
-
kms_slugs:
|
|
6166
|
-
kms_types:
|
|
6167
|
-
regions:
|
|
6168
|
-
nodes:
|
|
6644
|
+
import { z as z82 } from "zod";
|
|
6645
|
+
var AppFilterOptionsSchema = z82.object({
|
|
6646
|
+
statuses: z82.array(z82.string()),
|
|
6647
|
+
image_versions: z82.array(z82.string()),
|
|
6648
|
+
instance_types: z82.array(z82.string()),
|
|
6649
|
+
kms_slugs: z82.array(z82.string()),
|
|
6650
|
+
kms_types: z82.array(z82.string()),
|
|
6651
|
+
regions: z82.array(z82.string()),
|
|
6652
|
+
nodes: z82.array(z82.string())
|
|
6169
6653
|
});
|
|
6170
6654
|
async function getAppFilterOptions(client) {
|
|
6171
6655
|
const response = await client.get("/apps/filter-options");
|
|
@@ -6190,52 +6674,53 @@ async function safeGetAppFilterOptions(client) {
|
|
|
6190
6674
|
}
|
|
6191
6675
|
|
|
6192
6676
|
// src/actions/apps/get_app_attestation.ts
|
|
6193
|
-
import { z as
|
|
6194
|
-
var KmsInfoSchema2 =
|
|
6195
|
-
contract_address:
|
|
6196
|
-
chain_id:
|
|
6197
|
-
version:
|
|
6198
|
-
url:
|
|
6199
|
-
gateway_app_id:
|
|
6200
|
-
gateway_app_url:
|
|
6201
|
-
kms_type:
|
|
6202
|
-
});
|
|
6203
|
-
var GuestAgentInfoSchema =
|
|
6204
|
-
app_id:
|
|
6205
|
-
instance_id:
|
|
6206
|
-
app_name:
|
|
6207
|
-
device_id:
|
|
6677
|
+
import { z as z83 } from "zod";
|
|
6678
|
+
var KmsInfoSchema2 = z83.object({
|
|
6679
|
+
contract_address: z83.string(),
|
|
6680
|
+
chain_id: z83.number().nullable(),
|
|
6681
|
+
version: z83.string(),
|
|
6682
|
+
url: z83.string(),
|
|
6683
|
+
gateway_app_id: z83.string().nullable(),
|
|
6684
|
+
gateway_app_url: z83.string(),
|
|
6685
|
+
kms_type: z83.string()
|
|
6686
|
+
});
|
|
6687
|
+
var GuestAgentInfoSchema = z83.object({
|
|
6688
|
+
app_id: z83.string().optional(),
|
|
6689
|
+
instance_id: z83.string().optional(),
|
|
6690
|
+
app_name: z83.string().optional(),
|
|
6691
|
+
device_id: z83.string().optional()
|
|
6208
6692
|
}).passthrough().nullable();
|
|
6209
|
-
var AppAttestationInstanceSchema =
|
|
6210
|
-
vm_uuid:
|
|
6211
|
-
name:
|
|
6212
|
-
instance_id:
|
|
6213
|
-
status:
|
|
6214
|
-
image_version:
|
|
6215
|
-
quote:
|
|
6216
|
-
ppid:
|
|
6217
|
-
ppid_sha256:
|
|
6218
|
-
device_id:
|
|
6219
|
-
fmspc:
|
|
6220
|
-
tee_tcb_svn:
|
|
6221
|
-
|
|
6222
|
-
|
|
6693
|
+
var AppAttestationInstanceSchema = z83.object({
|
|
6694
|
+
vm_uuid: z83.string().nullable().optional(),
|
|
6695
|
+
name: z83.string().optional(),
|
|
6696
|
+
instance_id: z83.string().nullable().optional(),
|
|
6697
|
+
status: z83.string().optional(),
|
|
6698
|
+
image_version: z83.string().nullable().optional(),
|
|
6699
|
+
quote: z83.string().nullable().optional(),
|
|
6700
|
+
ppid: z83.string().optional(),
|
|
6701
|
+
ppid_sha256: z83.string().nullable().optional(),
|
|
6702
|
+
device_id: z83.string().optional(),
|
|
6703
|
+
fmspc: z83.string().nullable().optional(),
|
|
6704
|
+
tee_tcb_svn: z83.string().nullable().optional(),
|
|
6705
|
+
mr_config_id: z83.string().nullable().optional(),
|
|
6706
|
+
cpusvn: z83.string().nullable().optional(),
|
|
6707
|
+
pcesvn: z83.number().nullable().optional(),
|
|
6223
6708
|
tcb_info: TcbInfoSchema.nullable().optional(),
|
|
6224
|
-
app_certificates:
|
|
6225
|
-
compose_file:
|
|
6226
|
-
error:
|
|
6709
|
+
app_certificates: z83.array(CertificateSchema).nullable().optional(),
|
|
6710
|
+
compose_file: z83.string().nullable().optional(),
|
|
6711
|
+
error: z83.string().nullable().optional()
|
|
6227
6712
|
});
|
|
6228
|
-
var AppAttestationResponseSchema =
|
|
6229
|
-
app_id:
|
|
6230
|
-
contract_address:
|
|
6713
|
+
var AppAttestationResponseSchema = z83.object({
|
|
6714
|
+
app_id: z83.string(),
|
|
6715
|
+
contract_address: z83.string(),
|
|
6231
6716
|
kms_info: KmsInfoSchema2,
|
|
6232
|
-
instances:
|
|
6717
|
+
instances: z83.array(AppAttestationInstanceSchema),
|
|
6233
6718
|
kms_guest_agent_info: GuestAgentInfoSchema,
|
|
6234
6719
|
gateway_guest_agent_info: GuestAgentInfoSchema,
|
|
6235
|
-
qemu_version:
|
|
6720
|
+
qemu_version: z83.string().nullable()
|
|
6236
6721
|
});
|
|
6237
|
-
var GetAppAttestationRequestSchema =
|
|
6238
|
-
appId:
|
|
6722
|
+
var GetAppAttestationRequestSchema = z83.object({
|
|
6723
|
+
appId: z83.string().min(1)
|
|
6239
6724
|
}).strict();
|
|
6240
6725
|
var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAction(AppAttestationResponseSchema, async (client, request) => {
|
|
6241
6726
|
const { appId } = GetAppAttestationRequestSchema.parse(request);
|
|
@@ -6278,7 +6763,10 @@ import {
|
|
|
6278
6763
|
encryptEnvVars as encryptEnvVars2
|
|
6279
6764
|
} from "@phala/dstack-sdk/encrypt-env-vars";
|
|
6280
6765
|
import { getComposeHash as getComposeHash2 } from "@phala/dstack-sdk/get-compose-hash";
|
|
6281
|
-
import {
|
|
6766
|
+
import {
|
|
6767
|
+
verifyEnvEncryptPublicKey,
|
|
6768
|
+
verifyEnvEncryptPublicKeyLegacy
|
|
6769
|
+
} from "@phala/dstack-sdk/verify-env-encrypt-public-key";
|
|
6282
6770
|
export {
|
|
6283
6771
|
AddComposeHashSchema,
|
|
6284
6772
|
AddDeviceSchema,
|
|
@@ -6330,6 +6818,8 @@ export {
|
|
|
6330
6818
|
CvmCreateResourceGraphV20260522Schema,
|
|
6331
6819
|
CvmDetailV20251028Schema,
|
|
6332
6820
|
CvmGatewayInfoV20260121Schema,
|
|
6821
|
+
CvmGpuRentalOrderInfoV20260121Schema,
|
|
6822
|
+
CvmHourlyRateV20260121Schema,
|
|
6333
6823
|
CvmIdBaseSchema,
|
|
6334
6824
|
CvmIdObjectSchema,
|
|
6335
6825
|
CvmIdSchema,
|
|
@@ -6348,6 +6838,7 @@ export {
|
|
|
6348
6838
|
CvmProgressInfoV20260121Schema,
|
|
6349
6839
|
CvmRefSchema,
|
|
6350
6840
|
CvmResourceInfoV20260121Schema,
|
|
6841
|
+
CvmResourceUsageSchema,
|
|
6351
6842
|
CvmStateSchema,
|
|
6352
6843
|
CvmStatusSchema,
|
|
6353
6844
|
CvmSystemInfoSchema,
|
|
@@ -6356,6 +6847,7 @@ export {
|
|
|
6356
6847
|
DeleteSshKeyRequestSchema,
|
|
6357
6848
|
DeployAppAuthRequestSchema,
|
|
6358
6849
|
DeployAppAuthSchema,
|
|
6850
|
+
DeviceIdEntrySchema,
|
|
6359
6851
|
DstackAppFullResponseV20251028Schema,
|
|
6360
6852
|
DstackAppFullResponseV20260121Schema,
|
|
6361
6853
|
DstackAppFullResponseV20260522Schema,
|
|
@@ -6394,6 +6886,7 @@ export {
|
|
|
6394
6886
|
GetCvmStatusBatchRequestSchema,
|
|
6395
6887
|
GetCvmStatusBatchResponseSchema,
|
|
6396
6888
|
GetCvmUserConfigRequestSchema,
|
|
6889
|
+
GetKmsContractRequestSchema,
|
|
6397
6890
|
GetKmsInfoRequestSchema,
|
|
6398
6891
|
GetKmsListRequestSchema,
|
|
6399
6892
|
GetKmsListSchema,
|
|
@@ -6410,9 +6903,15 @@ export {
|
|
|
6410
6903
|
InstanceIdRefreshResultSchema,
|
|
6411
6904
|
InstanceTypeSchema,
|
|
6412
6905
|
IsAllowedResultSchema,
|
|
6906
|
+
KmsContractInfoSchema,
|
|
6907
|
+
KmsContractNodeSchema,
|
|
6413
6908
|
KmsInfoSchema,
|
|
6414
6909
|
KmsTypeSchema,
|
|
6415
6910
|
ListFamilyInstanceTypesRequestSchema,
|
|
6911
|
+
ListKmsContractNodesRequestSchema,
|
|
6912
|
+
ListKmsContractNodesSchema,
|
|
6913
|
+
ListKmsContractsRequestSchema,
|
|
6914
|
+
ListKmsContractsSchema,
|
|
6416
6915
|
ListSshKeysResponseSchema,
|
|
6417
6916
|
ListWorkspacesSchema,
|
|
6418
6917
|
LooseAppComposeSchema,
|
|
@@ -6531,6 +7030,7 @@ export {
|
|
|
6531
7030
|
extractNetworkClients,
|
|
6532
7031
|
formatErrorMessage,
|
|
6533
7032
|
formatStructuredError,
|
|
7033
|
+
formatStructuredErrorDetailValue,
|
|
6534
7034
|
formatValidationErrors,
|
|
6535
7035
|
generateDefaultCvmName,
|
|
6536
7036
|
generateFallbackHostname,
|
|
@@ -6562,9 +7062,12 @@ export {
|
|
|
6562
7062
|
getCvmStatusBatch,
|
|
6563
7063
|
getCvmUserConfig,
|
|
6564
7064
|
getErrorMessage,
|
|
7065
|
+
getKmsContract,
|
|
6565
7066
|
getKmsInfo,
|
|
6566
7067
|
getKmsList,
|
|
6567
7068
|
getKmsOnChainDetail,
|
|
7069
|
+
getMrConfigId,
|
|
7070
|
+
getMrConfigIdV1,
|
|
6568
7071
|
getOsImages,
|
|
6569
7072
|
getPreLaunchScriptUpgradeStatus,
|
|
6570
7073
|
getVMSchemaForVersion,
|
|
@@ -6578,6 +7081,8 @@ export {
|
|
|
6578
7081
|
isValidHostname,
|
|
6579
7082
|
listAllInstanceTypeFamilies,
|
|
6580
7083
|
listFamilyInstanceTypes,
|
|
7084
|
+
listKmsContractNodes,
|
|
7085
|
+
listKmsContracts,
|
|
6581
7086
|
listSshKeys,
|
|
6582
7087
|
listWorkspaces,
|
|
6583
7088
|
nextAppIds,
|
|
@@ -6637,6 +7142,7 @@ export {
|
|
|
6637
7142
|
safeGetCvmStats,
|
|
6638
7143
|
safeGetCvmStatusBatch,
|
|
6639
7144
|
safeGetCvmUserConfig,
|
|
7145
|
+
safeGetKmsContract,
|
|
6640
7146
|
safeGetKmsInfo,
|
|
6641
7147
|
safeGetKmsList,
|
|
6642
7148
|
safeGetKmsOnChainDetail,
|
|
@@ -6648,6 +7154,8 @@ export {
|
|
|
6648
7154
|
safeImportGithubProfileSshKeys,
|
|
6649
7155
|
safeListAllInstanceTypeFamilies,
|
|
6650
7156
|
safeListFamilyInstanceTypes,
|
|
7157
|
+
safeListKmsContractNodes,
|
|
7158
|
+
safeListKmsContracts,
|
|
6651
7159
|
safeListSshKeys,
|
|
6652
7160
|
safeListWorkspaces,
|
|
6653
7161
|
safeNextAppIds,
|
|
@@ -6690,6 +7198,8 @@ export {
|
|
|
6690
7198
|
validateComposePayloadSize,
|
|
6691
7199
|
validateNetworkPrerequisites,
|
|
6692
7200
|
verifyEnvEncryptPublicKey,
|
|
7201
|
+
verifyEnvEncryptPublicKeyLegacy,
|
|
7202
|
+
verifyMrConfigId,
|
|
6693
7203
|
waitForTransactionReceipt,
|
|
6694
7204
|
watchCvmState,
|
|
6695
7205
|
withComposeMethods
|