@phala/cloud 0.2.4 → 0.2.5
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/get_app_attestation.d.ts +963 -0
- package/dist/actions/apps/get_app_device_allowlist.d.ts +108 -0
- package/dist/actions/blockchains/abi/dstack_app.d.ts +101 -0
- package/dist/actions/blockchains/add_device.d.ts +62 -0
- package/dist/actions/blockchains/check_device_allowed.d.ts +44 -0
- package/dist/actions/blockchains/get_allowed_devices.d.ts +65 -0
- package/dist/actions/blockchains/remove_device.d.ts +62 -0
- package/dist/actions/blockchains/set_allow_any_device.d.ts +62 -0
- package/dist/actions/cvms/get_cvm_attestation.d.ts +220 -0
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +16 -0
- package/dist/actions/cvms/provision_cvm.d.ts +26 -1
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +18 -0
- package/dist/actions/cvms/refresh_cvm_instance_id.d.ts +93 -0
- package/dist/actions/cvms/refresh_cvm_instance_ids.d.ts +194 -0
- package/dist/actions/cvms/replicate_cvm.d.ts +126 -0
- package/dist/actions/cvms/restart_cvm.d.ts +2 -2
- package/dist/actions/cvms/shutdown_cvm.d.ts +2 -2
- package/dist/actions/cvms/start_cvm.d.ts +2 -2
- package/dist/actions/cvms/stop_cvm.d.ts +2 -2
- package/dist/actions/index.d.ts +14 -1
- package/dist/actions/kms/get_kms_onchain_detail.d.ts +688 -0
- package/dist/actions/os_images/get_os_images.d.ts +217 -0
- package/dist/actions/workspaces/get_workspace.d.ts +2 -0
- package/dist/actions/workspaces/list_workspaces.d.ts +18 -0
- package/dist/create-client.d.ts +30 -0
- package/dist/index.js +1269 -251
- package/dist/index.mjs +1233 -251
- package/dist/types/app_compose.d.ts +5 -0
- package/dist/types/app_info_v20260121.d.ts +68 -0
- package/dist/types/cvm_info.d.ts +3 -3
- package/dist/types/cvm_info_v20260121.d.ts +22 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,8 +31,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AddComposeHashSchema: () => AddComposeHashSchema,
|
|
34
|
+
AddDeviceSchema: () => AddDeviceSchema,
|
|
34
35
|
AllFamiliesResponseSchema: () => AllFamiliesResponseSchema,
|
|
35
36
|
ApiErrorSchema: () => ApiErrorSchema,
|
|
37
|
+
AppAttestationInstanceSchema: () => AppAttestationInstanceSchema,
|
|
38
|
+
AppAttestationResponseSchema: () => AppAttestationResponseSchema,
|
|
36
39
|
AppFilterOptionsSchema: () => AppFilterOptionsSchema,
|
|
37
40
|
AppProfileSchema: () => AppProfileSchema,
|
|
38
41
|
AppRevisionDetailResponseSchema: () => AppRevisionDetailResponseSchema,
|
|
@@ -43,6 +46,9 @@ __export(index_exports, {
|
|
|
43
46
|
AvailableNodesSchema: () => AvailableNodesSchema,
|
|
44
47
|
BillingPeriodSchema: () => BillingPeriodSchema,
|
|
45
48
|
BusinessError: () => BusinessError,
|
|
49
|
+
CertificateIssuerSchema: () => CertificateIssuerSchema,
|
|
50
|
+
CertificateSchema: () => CertificateSchema,
|
|
51
|
+
CertificateSubjectSchema: () => CertificateSubjectSchema,
|
|
46
52
|
CommitCvmComposeFileUpdateRequestSchema: () => CommitCvmComposeFileUpdateRequestSchema,
|
|
47
53
|
CommitCvmComposeFileUpdateSchema: () => CommitCvmComposeFileUpdateSchema,
|
|
48
54
|
CommitCvmProvisionRequestSchema: () => CommitCvmProvisionRequestSchema,
|
|
@@ -88,9 +94,13 @@ __export(index_exports, {
|
|
|
88
94
|
DstackAppMinimalResponseV20260121Schema: () => DstackAppMinimalResponseV20260121Schema,
|
|
89
95
|
DstackAppWithCvmResponseV20251028Schema: () => DstackAppWithCvmResponseV20251028Schema,
|
|
90
96
|
DstackAppWithCvmResponseV20260121Schema: () => DstackAppWithCvmResponseV20260121Schema,
|
|
97
|
+
EventLogSchema: () => EventLogSchema,
|
|
91
98
|
FamilyGroupSchema: () => FamilyGroupSchema,
|
|
92
99
|
FamilyInstanceTypesResponseSchema: () => FamilyInstanceTypesResponseSchema,
|
|
100
|
+
GetAllowedDevicesSchema: () => GetAllowedDevicesSchema,
|
|
101
|
+
GetAppAttestationRequestSchema: () => GetAppAttestationRequestSchema,
|
|
93
102
|
GetAppCvmsRequestSchema: () => GetAppCvmsRequestSchema,
|
|
103
|
+
GetAppDeviceAllowlistRequestSchema: () => GetAppDeviceAllowlistRequestSchema,
|
|
94
104
|
GetAppEnvEncryptPubKeyRequestSchema: () => GetAppEnvEncryptPubKeyRequestSchema,
|
|
95
105
|
GetAppEnvEncryptPubKeySchema: () => GetAppEnvEncryptPubKeySchema,
|
|
96
106
|
GetAppInfoRequestSchema: () => GetAppInfoRequestSchema,
|
|
@@ -115,10 +125,15 @@ __export(index_exports, {
|
|
|
115
125
|
GetKmsInfoRequestSchema: () => GetKmsInfoRequestSchema,
|
|
116
126
|
GetKmsListRequestSchema: () => GetKmsListRequestSchema,
|
|
117
127
|
GetKmsListSchema: () => GetKmsListSchema,
|
|
128
|
+
GetKmsOnChainDetailRequestSchema: () => GetKmsOnChainDetailRequestSchema,
|
|
129
|
+
GetKmsOnChainDetailResponseSchema: () => GetKmsOnChainDetailResponseSchema,
|
|
130
|
+
GetOsImagesRequestSchema: () => GetOsImagesRequestSchema,
|
|
131
|
+
GetOsImagesResponseSchema: () => GetOsImagesResponseSchema,
|
|
118
132
|
GetWorkspaceNodesSchema: () => GetWorkspaceNodesSchema,
|
|
119
133
|
GetWorkspaceQuotasSchema: () => GetWorkspaceQuotasSchema,
|
|
120
134
|
ImportGithubProfileRequestSchema: () => ImportGithubProfileRequestSchema,
|
|
121
135
|
ImportGithubProfileResponseSchema: () => ImportGithubProfileResponseSchema,
|
|
136
|
+
InstanceIdRefreshResultSchema: () => InstanceIdRefreshResultSchema,
|
|
122
137
|
InstanceTypeSchema: () => InstanceTypeSchema,
|
|
123
138
|
KmsInfoSchema: () => KmsInfoSchema,
|
|
124
139
|
KmsTypeSchema: () => KmsTypeSchema,
|
|
@@ -135,7 +150,11 @@ __export(index_exports, {
|
|
|
135
150
|
NextAppIdsSchema: () => NextAppIdsSchema,
|
|
136
151
|
NodeInfoSchema: () => NodeInfoSchema,
|
|
137
152
|
NodeRefSchema: () => NodeRefSchema,
|
|
153
|
+
OSImagePublicSchema: () => OSImagePublicSchema,
|
|
138
154
|
OSImageVariantSchema: () => OSImageVariantSchema,
|
|
155
|
+
OnChainDeviceSchema: () => OnChainDeviceSchema,
|
|
156
|
+
OnChainKmsContractSchema: () => OnChainKmsContractSchema,
|
|
157
|
+
OnChainOsImageSchema: () => OnChainOsImageSchema,
|
|
139
158
|
PaginatedCvmInfosV20251028Schema: () => PaginatedCvmInfosV20251028Schema,
|
|
140
159
|
PaginatedCvmInfosV20260121Schema: () => PaginatedCvmInfosV20260121Schema,
|
|
141
160
|
PaginationMetadataSchema: () => PaginationMetadataSchema,
|
|
@@ -145,17 +164,24 @@ __export(index_exports, {
|
|
|
145
164
|
ProvisionCvmRequestSchema: () => ProvisionCvmRequestSchema,
|
|
146
165
|
ProvisionCvmSchema: () => ProvisionCvmSchema,
|
|
147
166
|
QuotaMetricSchema: () => QuotaMetricSchema,
|
|
167
|
+
RefreshCvmInstanceIdRequestSchema: () => RefreshCvmInstanceIdRequestSchema,
|
|
168
|
+
RefreshCvmInstanceIdsRequestSchema: () => RefreshCvmInstanceIdsRequestSchema,
|
|
169
|
+
RefreshCvmInstanceIdsResponseSchema: () => RefreshCvmInstanceIdsResponseSchema,
|
|
170
|
+
RemoveDeviceSchema: () => RemoveDeviceSchema,
|
|
171
|
+
ReplicateCvmRequestSchema: () => ReplicateCvmRequestSchema,
|
|
148
172
|
RequestError: () => RequestError,
|
|
149
173
|
ResourceError: () => ResourceError,
|
|
150
174
|
RestartCvmRequestSchema: () => RestartCvmRequestSchema,
|
|
151
175
|
SUPPORTED_API_VERSIONS: () => SUPPORTED_API_VERSIONS,
|
|
152
176
|
SUPPORTED_CHAINS: () => SUPPORTED_CHAINS,
|
|
153
177
|
ServerError: () => ServerError,
|
|
178
|
+
SetAllowAnyDeviceSchema: () => SetAllowAnyDeviceSchema,
|
|
154
179
|
ShutdownCvmRequestSchema: () => ShutdownCvmRequestSchema,
|
|
155
180
|
SshKeySchema: () => SshKeySchema,
|
|
156
181
|
StartCvmRequestSchema: () => StartCvmRequestSchema,
|
|
157
182
|
StopCvmRequestSchema: () => StopCvmRequestSchema,
|
|
158
183
|
SyncGithubSshKeysResponseSchema: () => SyncGithubSshKeysResponseSchema,
|
|
184
|
+
TcbInfoSchema: () => TcbInfoSchema,
|
|
159
185
|
TransactionError: () => TransactionError,
|
|
160
186
|
UnknownError: () => UnknownError,
|
|
161
187
|
UpdateCvmEnvsRequestSchema: () => UpdateCvmEnvsRequestSchema,
|
|
@@ -181,10 +207,12 @@ __export(index_exports, {
|
|
|
181
207
|
WorkspaceReservedGpuQuotaSchema: () => WorkspaceReservedGpuQuotaSchema,
|
|
182
208
|
WorkspaceResponseSchema: () => WorkspaceResponseSchema,
|
|
183
209
|
addComposeHash: () => addComposeHash,
|
|
210
|
+
addDevice: () => addDevice,
|
|
184
211
|
addNetwork: () => addNetwork,
|
|
185
212
|
asHex: () => asHex,
|
|
186
213
|
autoCreateClients: () => autoCreateClients,
|
|
187
214
|
checkBalance: () => checkBalance,
|
|
215
|
+
checkDeviceAllowed: () => checkDeviceAllowed,
|
|
188
216
|
checkNetworkStatus: () => checkNetworkStatus,
|
|
189
217
|
commitCvmComposeFileUpdate: () => commitCvmComposeFileUpdate,
|
|
190
218
|
commitCvmProvision: () => commitCvmProvision,
|
|
@@ -201,6 +229,7 @@ __export(index_exports, {
|
|
|
201
229
|
deleteCvm: () => deleteCvm,
|
|
202
230
|
deleteSshKey: () => deleteSshKey,
|
|
203
231
|
deployAppAuth: () => deployAppAuth,
|
|
232
|
+
dstackAppAbi: () => dstackAppAbi,
|
|
204
233
|
dumpAppCompose: () => dumpAppCompose,
|
|
205
234
|
encryptEnvVars: () => import_encrypt_env_vars2.encryptEnvVars,
|
|
206
235
|
estimateTransactionGas: () => estimateTransactionGas,
|
|
@@ -213,7 +242,10 @@ __export(index_exports, {
|
|
|
213
242
|
formatValidationErrors: () => formatValidationErrors,
|
|
214
243
|
generateDefaultCvmName: () => generateDefaultCvmName,
|
|
215
244
|
generateFallbackHostname: () => generateFallbackHostname,
|
|
245
|
+
getAllowedDevices: () => getAllowedDevices,
|
|
246
|
+
getAppAttestation: () => getAppAttestation,
|
|
216
247
|
getAppCvms: () => getAppCvms,
|
|
248
|
+
getAppDeviceAllowlist: () => getAppDeviceAllowlist,
|
|
217
249
|
getAppEnvEncryptPubKey: () => getAppEnvEncryptPubKey,
|
|
218
250
|
getAppFilterOptions: () => getAppFilterOptions,
|
|
219
251
|
getAppInfo: () => getAppInfo,
|
|
@@ -239,6 +271,8 @@ __export(index_exports, {
|
|
|
239
271
|
getErrorMessage: () => getErrorMessage,
|
|
240
272
|
getKmsInfo: () => getKmsInfo,
|
|
241
273
|
getKmsList: () => getKmsList,
|
|
274
|
+
getKmsOnChainDetail: () => getKmsOnChainDetail,
|
|
275
|
+
getOsImages: () => getOsImages,
|
|
242
276
|
getValidationFields: () => getValidationFields,
|
|
243
277
|
getWorkspace: () => getWorkspace,
|
|
244
278
|
getWorkspaceNodes: () => getWorkspaceNodes,
|
|
@@ -257,15 +291,24 @@ __export(index_exports, {
|
|
|
257
291
|
provisionCvm: () => provisionCvm,
|
|
258
292
|
provisionCvmComposeFileUpdate: () => provisionCvmComposeFileUpdate,
|
|
259
293
|
refineCvmId: () => refineCvmId,
|
|
294
|
+
refreshCvmInstanceId: () => refreshCvmInstanceId,
|
|
295
|
+
refreshCvmInstanceIds: () => refreshCvmInstanceIds,
|
|
296
|
+
removeDevice: () => removeDevice,
|
|
297
|
+
replicateCvm: () => replicateCvm,
|
|
260
298
|
restartCvm: () => restartCvm,
|
|
261
299
|
safeAddComposeHash: () => safeAddComposeHash,
|
|
300
|
+
safeAddDevice: () => safeAddDevice,
|
|
301
|
+
safeCheckDeviceAllowed: () => safeCheckDeviceAllowed,
|
|
262
302
|
safeCommitCvmComposeFileUpdate: () => safeCommitCvmComposeFileUpdate,
|
|
263
303
|
safeCommitCvmProvision: () => safeCommitCvmProvision,
|
|
264
304
|
safeCreateSshKey: () => safeCreateSshKey,
|
|
265
305
|
safeDeleteCvm: () => safeDeleteCvm,
|
|
266
306
|
safeDeleteSshKey: () => safeDeleteSshKey,
|
|
267
307
|
safeDeployAppAuth: () => safeDeployAppAuth,
|
|
308
|
+
safeGetAllowedDevices: () => safeGetAllowedDevices,
|
|
309
|
+
safeGetAppAttestation: () => safeGetAppAttestation,
|
|
268
310
|
safeGetAppCvms: () => safeGetAppCvms,
|
|
311
|
+
safeGetAppDeviceAllowlist: () => safeGetAppDeviceAllowlist,
|
|
269
312
|
safeGetAppEnvEncryptPubKey: () => safeGetAppEnvEncryptPubKey,
|
|
270
313
|
safeGetAppFilterOptions: () => safeGetAppFilterOptions,
|
|
271
314
|
safeGetAppInfo: () => safeGetAppInfo,
|
|
@@ -289,6 +332,8 @@ __export(index_exports, {
|
|
|
289
332
|
safeGetCvmUserConfig: () => safeGetCvmUserConfig,
|
|
290
333
|
safeGetKmsInfo: () => safeGetKmsInfo,
|
|
291
334
|
safeGetKmsList: () => safeGetKmsList,
|
|
335
|
+
safeGetKmsOnChainDetail: () => safeGetKmsOnChainDetail,
|
|
336
|
+
safeGetOsImages: () => safeGetOsImages,
|
|
292
337
|
safeGetWorkspace: () => safeGetWorkspace,
|
|
293
338
|
safeGetWorkspaceNodes: () => safeGetWorkspaceNodes,
|
|
294
339
|
safeGetWorkspaceQuotas: () => safeGetWorkspaceQuotas,
|
|
@@ -300,7 +345,12 @@ __export(index_exports, {
|
|
|
300
345
|
safeNextAppIds: () => safeNextAppIds,
|
|
301
346
|
safeProvisionCvm: () => safeProvisionCvm,
|
|
302
347
|
safeProvisionCvmComposeFileUpdate: () => safeProvisionCvmComposeFileUpdate,
|
|
348
|
+
safeRefreshCvmInstanceId: () => safeRefreshCvmInstanceId,
|
|
349
|
+
safeRefreshCvmInstanceIds: () => safeRefreshCvmInstanceIds,
|
|
350
|
+
safeRemoveDevice: () => safeRemoveDevice,
|
|
351
|
+
safeReplicateCvm: () => safeReplicateCvm,
|
|
303
352
|
safeRestartCvm: () => safeRestartCvm,
|
|
353
|
+
safeSetAllowAnyDevice: () => safeSetAllowAnyDevice,
|
|
304
354
|
safeShutdownCvm: () => safeShutdownCvm,
|
|
305
355
|
safeStartCvm: () => safeStartCvm,
|
|
306
356
|
safeStopCvm: () => safeStopCvm,
|
|
@@ -312,6 +362,7 @@ __export(index_exports, {
|
|
|
312
362
|
safeUpdateOsImage: () => safeUpdateOsImage,
|
|
313
363
|
safeUpdatePreLaunchScript: () => safeUpdatePreLaunchScript,
|
|
314
364
|
safeValidateActionParameters: () => safeValidateActionParameters,
|
|
365
|
+
setAllowAnyDevice: () => setAllowAnyDevice,
|
|
315
366
|
shutdownCvm: () => shutdownCvm,
|
|
316
367
|
sortObject: () => sortObject,
|
|
317
368
|
startCvm: () => startCvm,
|
|
@@ -1402,7 +1453,8 @@ var WorkspaceResponseSchema = import_zod7.z.object({
|
|
|
1402
1453
|
tier: import_zod7.z.string(),
|
|
1403
1454
|
role: import_zod7.z.string(),
|
|
1404
1455
|
is_default: import_zod7.z.boolean(),
|
|
1405
|
-
created_at: import_zod7.z.string()
|
|
1456
|
+
created_at: import_zod7.z.string(),
|
|
1457
|
+
confidential_models_enabled: import_zod7.z.boolean().optional()
|
|
1406
1458
|
}).passthrough();
|
|
1407
1459
|
var PaginationMetadataSchema = import_zod7.z.object({
|
|
1408
1460
|
has_more: import_zod7.z.boolean(),
|
|
@@ -1591,6 +1643,7 @@ var CvmInfoV20260121Schema = import_zod9.z.object({
|
|
|
1591
1643
|
name: import_zod9.z.string(),
|
|
1592
1644
|
app_id: import_zod9.z.string().nullable().optional(),
|
|
1593
1645
|
vm_uuid: import_zod9.z.string().nullable().optional(),
|
|
1646
|
+
instance_id: import_zod9.z.string().nullable().optional(),
|
|
1594
1647
|
resource: CvmResourceInfoV20260121Schema,
|
|
1595
1648
|
node_info: NodeRefSchema.nullable().optional(),
|
|
1596
1649
|
os: CvmOsInfoV20260121Schema.nullable().optional(),
|
|
@@ -1607,6 +1660,7 @@ var CvmInfoV20260121Schema = import_zod9.z.object({
|
|
|
1607
1660
|
public_tcbinfo: import_zod9.z.boolean().optional(),
|
|
1608
1661
|
gateway_enabled: import_zod9.z.boolean().optional(),
|
|
1609
1662
|
secure_time: import_zod9.z.boolean().optional(),
|
|
1663
|
+
listed: import_zod9.z.boolean().optional().default(false),
|
|
1610
1664
|
storage_fs: import_zod9.z.string().optional(),
|
|
1611
1665
|
workspace: WorkspaceRefSchema.nullable().optional(),
|
|
1612
1666
|
creator: UserRefSchema.nullable().optional()
|
|
@@ -1831,6 +1885,7 @@ var LooseAppComposeSchema = import_zod12.z.object({
|
|
|
1831
1885
|
public_logs: import_zod12.z.boolean().optional(),
|
|
1832
1886
|
public_sysinfo: import_zod12.z.boolean().optional(),
|
|
1833
1887
|
tproxy_enabled: import_zod12.z.boolean().optional(),
|
|
1888
|
+
storage_fs: import_zod12.z.enum(["ext4", "zfs"]).optional(),
|
|
1834
1889
|
pre_launch_script: import_zod12.z.string().optional(),
|
|
1835
1890
|
env_pubkey: import_zod12.z.string().optional(),
|
|
1836
1891
|
salt: import_zod12.z.string().optional().nullable()
|
|
@@ -1887,8 +1942,9 @@ var ProvisionCvmRequestSchema = import_zod13.z.object({
|
|
|
1887
1942
|
public_sysinfo: import_zod13.z.boolean().optional(),
|
|
1888
1943
|
gateway_enabled: import_zod13.z.boolean().optional(),
|
|
1889
1944
|
// recommended
|
|
1890
|
-
tproxy_enabled: import_zod13.z.boolean().optional()
|
|
1945
|
+
tproxy_enabled: import_zod13.z.boolean().optional(),
|
|
1891
1946
|
// deprecated, for compatibility
|
|
1947
|
+
storage_fs: import_zod13.z.enum(["ext4", "zfs"]).optional()
|
|
1892
1948
|
}).superRefine((data, ctx) => {
|
|
1893
1949
|
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1894
1950
|
}),
|
|
@@ -2437,7 +2493,7 @@ var VMSchema = import_zod25.z.object({
|
|
|
2437
2493
|
vm_uuid: import_zod25.z.string().nullable(),
|
|
2438
2494
|
instance_id: import_zod25.z.string().nullable(),
|
|
2439
2495
|
app_url: import_zod25.z.string().optional().nullable(),
|
|
2440
|
-
base_image: import_zod25.z.string().nullable(),
|
|
2496
|
+
base_image: import_zod25.z.string().optional().nullable(),
|
|
2441
2497
|
vcpu: import_zod25.z.number(),
|
|
2442
2498
|
memory: import_zod25.z.number(),
|
|
2443
2499
|
disk_size: import_zod25.z.number(),
|
|
@@ -2855,6 +2911,66 @@ var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSim
|
|
|
2855
2911
|
}
|
|
2856
2912
|
);
|
|
2857
2913
|
|
|
2914
|
+
// src/actions/os_images/get_os_images.ts
|
|
2915
|
+
var import_zod43 = require("zod");
|
|
2916
|
+
var OSImagePublicSchema = import_zod43.z.object({
|
|
2917
|
+
name: import_zod43.z.string(),
|
|
2918
|
+
slug: import_zod43.z.string(),
|
|
2919
|
+
version: import_zod43.z.string(),
|
|
2920
|
+
os_image_hash: import_zod43.z.string().nullable(),
|
|
2921
|
+
is_dev: import_zod43.z.boolean(),
|
|
2922
|
+
requires_gpu: import_zod43.z.boolean()
|
|
2923
|
+
}).passthrough();
|
|
2924
|
+
var GetOsImagesRequestSchema = import_zod43.z.object({
|
|
2925
|
+
page: import_zod43.z.number().int().min(1).optional(),
|
|
2926
|
+
page_size: import_zod43.z.number().int().min(1).optional(),
|
|
2927
|
+
is_dev: import_zod43.z.boolean().optional()
|
|
2928
|
+
}).strict();
|
|
2929
|
+
var GetOsImagesResponseSchema = import_zod43.z.object({
|
|
2930
|
+
items: import_zod43.z.array(OSImagePublicSchema),
|
|
2931
|
+
total: import_zod43.z.number(),
|
|
2932
|
+
page: import_zod43.z.number(),
|
|
2933
|
+
page_size: import_zod43.z.number(),
|
|
2934
|
+
pages: import_zod43.z.number()
|
|
2935
|
+
}).passthrough();
|
|
2936
|
+
var { action: getOsImages, safeAction: safeGetOsImages } = defineAction(GetOsImagesResponseSchema, async (client, request) => {
|
|
2937
|
+
const validatedRequest = GetOsImagesRequestSchema.parse(request ?? {});
|
|
2938
|
+
return await client.get("/os-images", { params: validatedRequest });
|
|
2939
|
+
});
|
|
2940
|
+
|
|
2941
|
+
// src/actions/kms/get_kms_onchain_detail.ts
|
|
2942
|
+
var import_zod44 = require("zod");
|
|
2943
|
+
var OnChainDeviceSchema = import_zod44.z.object({
|
|
2944
|
+
device_id: import_zod44.z.string(),
|
|
2945
|
+
node_name: import_zod44.z.string().nullable().optional(),
|
|
2946
|
+
on_chain_allowed: import_zod44.z.boolean().nullable()
|
|
2947
|
+
}).passthrough();
|
|
2948
|
+
var OnChainOsImageSchema = import_zod44.z.object({
|
|
2949
|
+
name: import_zod44.z.string(),
|
|
2950
|
+
version: import_zod44.z.string(),
|
|
2951
|
+
os_image_hash: import_zod44.z.string().nullable(),
|
|
2952
|
+
on_chain_allowed: import_zod44.z.boolean().nullable()
|
|
2953
|
+
}).passthrough();
|
|
2954
|
+
var OnChainKmsContractSchema = import_zod44.z.object({
|
|
2955
|
+
contract_address: import_zod44.z.string(),
|
|
2956
|
+
chain_id: import_zod44.z.number(),
|
|
2957
|
+
chain_name: import_zod44.z.string(),
|
|
2958
|
+
devices: import_zod44.z.array(OnChainDeviceSchema),
|
|
2959
|
+
os_images: import_zod44.z.array(OnChainOsImageSchema)
|
|
2960
|
+
}).passthrough();
|
|
2961
|
+
var GetKmsOnChainDetailResponseSchema = import_zod44.z.object({
|
|
2962
|
+
chain_name: import_zod44.z.string(),
|
|
2963
|
+
chain_id: import_zod44.z.number(),
|
|
2964
|
+
contracts: import_zod44.z.array(OnChainKmsContractSchema)
|
|
2965
|
+
}).passthrough();
|
|
2966
|
+
var GetKmsOnChainDetailRequestSchema = import_zod44.z.object({
|
|
2967
|
+
chain: import_zod44.z.string()
|
|
2968
|
+
}).strict();
|
|
2969
|
+
var { action: getKmsOnChainDetail, safeAction: safeGetKmsOnChainDetail } = defineAction(GetKmsOnChainDetailResponseSchema, async (client, request) => {
|
|
2970
|
+
const { chain } = GetKmsOnChainDetailRequestSchema.parse(request);
|
|
2971
|
+
return await client.get(`/kms/on-chain/${chain}`);
|
|
2972
|
+
});
|
|
2973
|
+
|
|
2858
2974
|
// src/create-client.ts
|
|
2859
2975
|
function createClient2(config = {}) {
|
|
2860
2976
|
const client = createClient(config);
|
|
@@ -2940,167 +3056,171 @@ function createClient2(config = {}) {
|
|
|
2940
3056
|
deleteSshKey,
|
|
2941
3057
|
safeDeleteSshKey,
|
|
2942
3058
|
syncGithubSshKeys,
|
|
2943
|
-
safeSyncGithubSshKeys
|
|
3059
|
+
safeSyncGithubSshKeys,
|
|
3060
|
+
getOsImages,
|
|
3061
|
+
safeGetOsImages,
|
|
3062
|
+
getKmsOnChainDetail,
|
|
3063
|
+
safeGetKmsOnChainDetail
|
|
2944
3064
|
};
|
|
2945
3065
|
return client.extend(allActions);
|
|
2946
3066
|
}
|
|
2947
3067
|
|
|
2948
3068
|
// src/types/app_info_v20251028.ts
|
|
2949
|
-
var
|
|
2950
|
-
var CvmBasicInfoV20251028Schema =
|
|
2951
|
-
vm_uuid:
|
|
2952
|
-
app_id:
|
|
2953
|
-
name:
|
|
2954
|
-
status:
|
|
2955
|
-
vcpu:
|
|
2956
|
-
memory:
|
|
2957
|
-
disk_size:
|
|
2958
|
-
teepod_id:
|
|
2959
|
-
teepod_name:
|
|
2960
|
-
region_identifier:
|
|
2961
|
-
kms_type:
|
|
2962
|
-
instance_type:
|
|
2963
|
-
listed:
|
|
2964
|
-
base_image:
|
|
2965
|
-
kms_slug:
|
|
2966
|
-
kms_id:
|
|
2967
|
-
instance_id:
|
|
3069
|
+
var import_zod45 = require("zod");
|
|
3070
|
+
var CvmBasicInfoV20251028Schema = import_zod45.z.object({
|
|
3071
|
+
vm_uuid: import_zod45.z.string().nullable(),
|
|
3072
|
+
app_id: import_zod45.z.string(),
|
|
3073
|
+
name: import_zod45.z.string().default(""),
|
|
3074
|
+
status: import_zod45.z.string(),
|
|
3075
|
+
vcpu: import_zod45.z.number().int(),
|
|
3076
|
+
memory: import_zod45.z.number().int(),
|
|
3077
|
+
disk_size: import_zod45.z.number().int(),
|
|
3078
|
+
teepod_id: import_zod45.z.number().int(),
|
|
3079
|
+
teepod_name: import_zod45.z.string(),
|
|
3080
|
+
region_identifier: import_zod45.z.string().nullable().optional(),
|
|
3081
|
+
kms_type: import_zod45.z.string().nullable().optional(),
|
|
3082
|
+
instance_type: import_zod45.z.string().nullable().optional(),
|
|
3083
|
+
listed: import_zod45.z.boolean().nullable().optional(),
|
|
3084
|
+
base_image: import_zod45.z.string().nullable().optional(),
|
|
3085
|
+
kms_slug: import_zod45.z.string().nullable().optional(),
|
|
3086
|
+
kms_id: import_zod45.z.string().nullable().optional(),
|
|
3087
|
+
instance_id: import_zod45.z.string().nullable().optional(),
|
|
2968
3088
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
2969
|
-
updated_at:
|
|
3089
|
+
updated_at: import_zod45.z.string().nullable().optional()
|
|
2970
3090
|
});
|
|
2971
|
-
var AppProfileSchema =
|
|
2972
|
-
display_name:
|
|
2973
|
-
avatar_url:
|
|
2974
|
-
description:
|
|
2975
|
-
custom_domain:
|
|
3091
|
+
var AppProfileSchema = import_zod45.z.object({
|
|
3092
|
+
display_name: import_zod45.z.string().nullable().optional(),
|
|
3093
|
+
avatar_url: import_zod45.z.string().nullable().optional(),
|
|
3094
|
+
description: import_zod45.z.string().nullable().optional(),
|
|
3095
|
+
custom_domain: import_zod45.z.string().nullable().optional()
|
|
2976
3096
|
});
|
|
2977
|
-
var DstackAppFullResponseV20251028Schema =
|
|
2978
|
-
id:
|
|
2979
|
-
name:
|
|
2980
|
-
app_id:
|
|
2981
|
-
app_provision_type:
|
|
2982
|
-
app_icon_url:
|
|
2983
|
-
created_at:
|
|
2984
|
-
kms_type:
|
|
3097
|
+
var DstackAppFullResponseV20251028Schema = import_zod45.z.object({
|
|
3098
|
+
id: import_zod45.z.string(),
|
|
3099
|
+
name: import_zod45.z.string(),
|
|
3100
|
+
app_id: import_zod45.z.string(),
|
|
3101
|
+
app_provision_type: import_zod45.z.string().nullable().optional(),
|
|
3102
|
+
app_icon_url: import_zod45.z.string().nullable().optional(),
|
|
3103
|
+
created_at: import_zod45.z.string(),
|
|
3104
|
+
kms_type: import_zod45.z.string(),
|
|
2985
3105
|
profile: AppProfileSchema.nullable().optional(),
|
|
2986
3106
|
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
2987
|
-
cvms:
|
|
2988
|
-
cvm_count:
|
|
3107
|
+
cvms: import_zod45.z.array(CvmBasicInfoV20251028Schema).default([]),
|
|
3108
|
+
cvm_count: import_zod45.z.number().int().default(0)
|
|
2989
3109
|
});
|
|
2990
|
-
var DstackAppMinimalResponseV20251028Schema =
|
|
2991
|
-
id:
|
|
2992
|
-
app_id:
|
|
2993
|
-
name:
|
|
2994
|
-
app_provision_type:
|
|
2995
|
-
app_icon_url:
|
|
2996
|
-
created_at:
|
|
2997
|
-
kms_type:
|
|
2998
|
-
current_cvm:
|
|
2999
|
-
cvms:
|
|
3000
|
-
cvm_count:
|
|
3110
|
+
var DstackAppMinimalResponseV20251028Schema = import_zod45.z.object({
|
|
3111
|
+
id: import_zod45.z.null().optional(),
|
|
3112
|
+
app_id: import_zod45.z.string(),
|
|
3113
|
+
name: import_zod45.z.null().optional(),
|
|
3114
|
+
app_provision_type: import_zod45.z.null().optional(),
|
|
3115
|
+
app_icon_url: import_zod45.z.null().optional(),
|
|
3116
|
+
created_at: import_zod45.z.null().optional(),
|
|
3117
|
+
kms_type: import_zod45.z.null().optional(),
|
|
3118
|
+
current_cvm: import_zod45.z.null().optional(),
|
|
3119
|
+
cvms: import_zod45.z.null().optional(),
|
|
3120
|
+
cvm_count: import_zod45.z.null().optional()
|
|
3001
3121
|
});
|
|
3002
|
-
var DstackAppWithCvmResponseV20251028Schema =
|
|
3122
|
+
var DstackAppWithCvmResponseV20251028Schema = import_zod45.z.union([
|
|
3003
3123
|
DstackAppFullResponseV20251028Schema,
|
|
3004
3124
|
DstackAppMinimalResponseV20251028Schema
|
|
3005
3125
|
]);
|
|
3006
|
-
var DstackAppListResponseV20251028Schema =
|
|
3007
|
-
dstack_apps:
|
|
3008
|
-
page:
|
|
3009
|
-
page_size:
|
|
3010
|
-
total:
|
|
3011
|
-
total_pages:
|
|
3126
|
+
var DstackAppListResponseV20251028Schema = import_zod45.z.object({
|
|
3127
|
+
dstack_apps: import_zod45.z.array(DstackAppWithCvmResponseV20251028Schema),
|
|
3128
|
+
page: import_zod45.z.number().int(),
|
|
3129
|
+
page_size: import_zod45.z.number().int(),
|
|
3130
|
+
total: import_zod45.z.number().int(),
|
|
3131
|
+
total_pages: import_zod45.z.number().int()
|
|
3012
3132
|
});
|
|
3013
3133
|
|
|
3014
3134
|
// src/types/app_info_v20260121.ts
|
|
3015
|
-
var
|
|
3016
|
-
var DstackAppFullResponseV20260121Schema =
|
|
3017
|
-
id:
|
|
3018
|
-
name:
|
|
3019
|
-
app_id:
|
|
3020
|
-
app_provision_type:
|
|
3021
|
-
app_icon_url:
|
|
3022
|
-
created_at:
|
|
3023
|
-
kms_type:
|
|
3024
|
-
profile:
|
|
3025
|
-
display_name:
|
|
3026
|
-
avatar_url:
|
|
3027
|
-
description:
|
|
3028
|
-
custom_domain:
|
|
3135
|
+
var import_zod46 = require("zod");
|
|
3136
|
+
var DstackAppFullResponseV20260121Schema = import_zod46.z.object({
|
|
3137
|
+
id: import_zod46.z.string(),
|
|
3138
|
+
name: import_zod46.z.string(),
|
|
3139
|
+
app_id: import_zod46.z.string(),
|
|
3140
|
+
app_provision_type: import_zod46.z.string().nullable().optional(),
|
|
3141
|
+
app_icon_url: import_zod46.z.string().nullable().optional(),
|
|
3142
|
+
created_at: import_zod46.z.string(),
|
|
3143
|
+
kms_type: import_zod46.z.string(),
|
|
3144
|
+
profile: import_zod46.z.object({
|
|
3145
|
+
display_name: import_zod46.z.string().nullable().optional(),
|
|
3146
|
+
avatar_url: import_zod46.z.string().nullable().optional(),
|
|
3147
|
+
description: import_zod46.z.string().nullable().optional(),
|
|
3148
|
+
custom_domain: import_zod46.z.string().nullable().optional()
|
|
3029
3149
|
}).nullable().optional(),
|
|
3030
3150
|
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
3031
|
-
cvms:
|
|
3032
|
-
cvm_count:
|
|
3151
|
+
cvms: import_zod46.z.array(CvmInfoV20260121Schema).default([]),
|
|
3152
|
+
cvm_count: import_zod46.z.number().int().default(0)
|
|
3033
3153
|
});
|
|
3034
|
-
var DstackAppMinimalResponseV20260121Schema =
|
|
3035
|
-
id:
|
|
3036
|
-
app_id:
|
|
3037
|
-
name:
|
|
3038
|
-
app_provision_type:
|
|
3039
|
-
app_icon_url:
|
|
3040
|
-
created_at:
|
|
3041
|
-
kms_type:
|
|
3042
|
-
current_cvm:
|
|
3043
|
-
cvms:
|
|
3044
|
-
cvm_count:
|
|
3154
|
+
var DstackAppMinimalResponseV20260121Schema = import_zod46.z.object({
|
|
3155
|
+
id: import_zod46.z.null().optional(),
|
|
3156
|
+
app_id: import_zod46.z.string(),
|
|
3157
|
+
name: import_zod46.z.null().optional(),
|
|
3158
|
+
app_provision_type: import_zod46.z.null().optional(),
|
|
3159
|
+
app_icon_url: import_zod46.z.null().optional(),
|
|
3160
|
+
created_at: import_zod46.z.null().optional(),
|
|
3161
|
+
kms_type: import_zod46.z.null().optional(),
|
|
3162
|
+
current_cvm: import_zod46.z.null().optional(),
|
|
3163
|
+
cvms: import_zod46.z.null().optional(),
|
|
3164
|
+
cvm_count: import_zod46.z.null().optional()
|
|
3045
3165
|
});
|
|
3046
|
-
var DstackAppWithCvmResponseV20260121Schema =
|
|
3166
|
+
var DstackAppWithCvmResponseV20260121Schema = import_zod46.z.union([
|
|
3047
3167
|
DstackAppFullResponseV20260121Schema,
|
|
3048
3168
|
DstackAppMinimalResponseV20260121Schema
|
|
3049
3169
|
]);
|
|
3050
|
-
var DstackAppListResponseV20260121Schema =
|
|
3051
|
-
dstack_apps:
|
|
3052
|
-
page:
|
|
3053
|
-
page_size:
|
|
3054
|
-
total:
|
|
3055
|
-
total_pages:
|
|
3170
|
+
var DstackAppListResponseV20260121Schema = import_zod46.z.object({
|
|
3171
|
+
dstack_apps: import_zod46.z.array(DstackAppWithCvmResponseV20260121Schema),
|
|
3172
|
+
page: import_zod46.z.number().int(),
|
|
3173
|
+
page_size: import_zod46.z.number().int(),
|
|
3174
|
+
total: import_zod46.z.number().int(),
|
|
3175
|
+
total_pages: import_zod46.z.number().int()
|
|
3056
3176
|
});
|
|
3057
3177
|
|
|
3058
3178
|
// src/types/app_revision.ts
|
|
3059
|
-
var
|
|
3060
|
-
var CvmRefSchema =
|
|
3061
|
-
object_type:
|
|
3062
|
-
id:
|
|
3063
|
-
name:
|
|
3064
|
-
app_id:
|
|
3065
|
-
vm_uuid:
|
|
3179
|
+
var import_zod47 = require("zod");
|
|
3180
|
+
var CvmRefSchema = import_zod47.z.object({
|
|
3181
|
+
object_type: import_zod47.z.literal("cvm"),
|
|
3182
|
+
id: import_zod47.z.string().nullable().optional(),
|
|
3183
|
+
name: import_zod47.z.string().nullable().optional(),
|
|
3184
|
+
app_id: import_zod47.z.string().nullable().optional(),
|
|
3185
|
+
vm_uuid: import_zod47.z.string().nullable().optional()
|
|
3066
3186
|
});
|
|
3067
|
-
var AppRevisionResponseSchema =
|
|
3068
|
-
revision_id:
|
|
3069
|
-
app_id:
|
|
3070
|
-
vm_uuid:
|
|
3071
|
-
compose_hash:
|
|
3072
|
-
created_at:
|
|
3073
|
-
trace_id:
|
|
3074
|
-
operation_type:
|
|
3187
|
+
var AppRevisionResponseSchema = import_zod47.z.object({
|
|
3188
|
+
revision_id: import_zod47.z.string(),
|
|
3189
|
+
app_id: import_zod47.z.string(),
|
|
3190
|
+
vm_uuid: import_zod47.z.string(),
|
|
3191
|
+
compose_hash: import_zod47.z.string(),
|
|
3192
|
+
created_at: import_zod47.z.string(),
|
|
3193
|
+
trace_id: import_zod47.z.string().nullable().optional(),
|
|
3194
|
+
operation_type: import_zod47.z.string(),
|
|
3075
3195
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
3076
3196
|
cvm: CvmRefSchema.nullable().optional(),
|
|
3077
3197
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
3078
3198
|
});
|
|
3079
|
-
var AppRevisionDetailResponseSchema =
|
|
3080
|
-
revision_id:
|
|
3081
|
-
app_id:
|
|
3082
|
-
vm_uuid:
|
|
3083
|
-
compose_hash:
|
|
3084
|
-
compose_file:
|
|
3085
|
-
encrypted_env:
|
|
3086
|
-
user_config:
|
|
3087
|
-
created_at:
|
|
3088
|
-
trace_id:
|
|
3089
|
-
operation_type:
|
|
3199
|
+
var AppRevisionDetailResponseSchema = import_zod47.z.object({
|
|
3200
|
+
revision_id: import_zod47.z.string(),
|
|
3201
|
+
app_id: import_zod47.z.string(),
|
|
3202
|
+
vm_uuid: import_zod47.z.string(),
|
|
3203
|
+
compose_hash: import_zod47.z.string(),
|
|
3204
|
+
compose_file: import_zod47.z.union([import_zod47.z.record(import_zod47.z.any()), import_zod47.z.string()]).nullable().optional(),
|
|
3205
|
+
encrypted_env: import_zod47.z.string(),
|
|
3206
|
+
user_config: import_zod47.z.string(),
|
|
3207
|
+
created_at: import_zod47.z.string(),
|
|
3208
|
+
trace_id: import_zod47.z.string().nullable().optional(),
|
|
3209
|
+
operation_type: import_zod47.z.string(),
|
|
3090
3210
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
3091
3211
|
cvm: CvmRefSchema.nullable().optional(),
|
|
3092
3212
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
3093
3213
|
});
|
|
3094
|
-
var AppRevisionsResponseSchema =
|
|
3095
|
-
revisions:
|
|
3096
|
-
total:
|
|
3097
|
-
page:
|
|
3098
|
-
page_size:
|
|
3099
|
-
total_pages:
|
|
3214
|
+
var AppRevisionsResponseSchema = import_zod47.z.object({
|
|
3215
|
+
revisions: import_zod47.z.array(AppRevisionResponseSchema),
|
|
3216
|
+
total: import_zod47.z.number().int(),
|
|
3217
|
+
page: import_zod47.z.number().int(),
|
|
3218
|
+
page_size: import_zod47.z.number().int(),
|
|
3219
|
+
total_pages: import_zod47.z.number().int()
|
|
3100
3220
|
});
|
|
3101
3221
|
|
|
3102
3222
|
// src/actions/blockchains/deploy_app_auth.ts
|
|
3103
|
-
var
|
|
3223
|
+
var import_zod48 = require("zod");
|
|
3104
3224
|
var import_viem3 = require("viem");
|
|
3105
3225
|
var import_accounts2 = require("viem/accounts");
|
|
3106
3226
|
|
|
@@ -3750,25 +3870,25 @@ var kmsAuthAbi = [
|
|
|
3750
3870
|
anonymous: false
|
|
3751
3871
|
}
|
|
3752
3872
|
];
|
|
3753
|
-
var DeployAppAuthRequestBaseSchema =
|
|
3873
|
+
var DeployAppAuthRequestBaseSchema = import_zod48.z.object({
|
|
3754
3874
|
// Chain configuration (conditionally required)
|
|
3755
|
-
chain:
|
|
3756
|
-
rpcUrl:
|
|
3875
|
+
chain: import_zod48.z.unknown().optional(),
|
|
3876
|
+
rpcUrl: import_zod48.z.string().optional(),
|
|
3757
3877
|
// Contract configuration (required)
|
|
3758
|
-
kmsContractAddress:
|
|
3878
|
+
kmsContractAddress: import_zod48.z.string(),
|
|
3759
3879
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
3760
|
-
privateKey:
|
|
3761
|
-
walletClient:
|
|
3880
|
+
privateKey: import_zod48.z.string().optional(),
|
|
3881
|
+
walletClient: import_zod48.z.unknown().optional(),
|
|
3762
3882
|
// Public client (optional, will create default if not provided)
|
|
3763
|
-
publicClient:
|
|
3883
|
+
publicClient: import_zod48.z.unknown().optional(),
|
|
3764
3884
|
// App configuration (optional)
|
|
3765
|
-
allowAnyDevice:
|
|
3766
|
-
deviceId:
|
|
3767
|
-
composeHash:
|
|
3768
|
-
disableUpgrades:
|
|
3885
|
+
allowAnyDevice: import_zod48.z.boolean().optional().default(false),
|
|
3886
|
+
deviceId: import_zod48.z.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
3887
|
+
composeHash: import_zod48.z.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
3888
|
+
disableUpgrades: import_zod48.z.boolean().optional().default(false),
|
|
3769
3889
|
// Validation configuration (optional)
|
|
3770
|
-
skipPrerequisiteChecks:
|
|
3771
|
-
minBalance:
|
|
3890
|
+
skipPrerequisiteChecks: import_zod48.z.boolean().optional().default(false),
|
|
3891
|
+
minBalance: import_zod48.z.string().optional()
|
|
3772
3892
|
// ETH amount as string, e.g., "0.01"
|
|
3773
3893
|
}).passthrough();
|
|
3774
3894
|
var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
@@ -3796,13 +3916,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
|
3796
3916
|
path: ["chain"]
|
|
3797
3917
|
}
|
|
3798
3918
|
);
|
|
3799
|
-
var DeployAppAuthSchema =
|
|
3800
|
-
appId:
|
|
3801
|
-
appAuthAddress:
|
|
3802
|
-
deployer:
|
|
3803
|
-
transactionHash:
|
|
3804
|
-
blockNumber:
|
|
3805
|
-
gasUsed:
|
|
3919
|
+
var DeployAppAuthSchema = import_zod48.z.object({
|
|
3920
|
+
appId: import_zod48.z.string(),
|
|
3921
|
+
appAuthAddress: import_zod48.z.string(),
|
|
3922
|
+
deployer: import_zod48.z.string(),
|
|
3923
|
+
transactionHash: import_zod48.z.string(),
|
|
3924
|
+
blockNumber: import_zod48.z.bigint().optional(),
|
|
3925
|
+
gasUsed: import_zod48.z.bigint().optional()
|
|
3806
3926
|
}).passthrough();
|
|
3807
3927
|
function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
|
|
3808
3928
|
try {
|
|
@@ -4048,7 +4168,7 @@ async function safeDeployAppAuth(request, parameters) {
|
|
|
4048
4168
|
}
|
|
4049
4169
|
|
|
4050
4170
|
// src/actions/blockchains/add_compose_hash.ts
|
|
4051
|
-
var
|
|
4171
|
+
var import_zod49 = require("zod");
|
|
4052
4172
|
var import_viem4 = require("viem");
|
|
4053
4173
|
var import_accounts3 = require("viem/accounts");
|
|
4054
4174
|
var appAuthAbi = [
|
|
@@ -4066,29 +4186,29 @@ var appAuthAbi = [
|
|
|
4066
4186
|
anonymous: false
|
|
4067
4187
|
}
|
|
4068
4188
|
];
|
|
4069
|
-
var AddComposeHashRequestSchema =
|
|
4189
|
+
var AddComposeHashRequestSchema = import_zod49.z.object({
|
|
4070
4190
|
// Chain configuration (conditionally required)
|
|
4071
|
-
chain:
|
|
4072
|
-
rpcUrl:
|
|
4073
|
-
appId:
|
|
4074
|
-
composeHash:
|
|
4191
|
+
chain: import_zod49.z.unknown().optional(),
|
|
4192
|
+
rpcUrl: import_zod49.z.string().optional(),
|
|
4193
|
+
appId: import_zod49.z.string(),
|
|
4194
|
+
composeHash: import_zod49.z.string(),
|
|
4075
4195
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
4076
|
-
privateKey:
|
|
4077
|
-
walletClient:
|
|
4196
|
+
privateKey: import_zod49.z.string().optional(),
|
|
4197
|
+
walletClient: import_zod49.z.unknown().optional(),
|
|
4078
4198
|
// Public client (optional, will create default if not provided)
|
|
4079
|
-
publicClient:
|
|
4199
|
+
publicClient: import_zod49.z.unknown().optional(),
|
|
4080
4200
|
// Validation configuration (optional)
|
|
4081
|
-
skipPrerequisiteChecks:
|
|
4082
|
-
minBalance:
|
|
4201
|
+
skipPrerequisiteChecks: import_zod49.z.boolean().optional().default(false),
|
|
4202
|
+
minBalance: import_zod49.z.string().optional(),
|
|
4083
4203
|
// ETH amount as string, e.g., "0.01"
|
|
4084
4204
|
// Transaction control options
|
|
4085
|
-
timeout:
|
|
4086
|
-
retryOptions:
|
|
4087
|
-
signal:
|
|
4205
|
+
timeout: import_zod49.z.number().optional().default(12e4),
|
|
4206
|
+
retryOptions: import_zod49.z.unknown().optional(),
|
|
4207
|
+
signal: import_zod49.z.unknown().optional(),
|
|
4088
4208
|
// Progress callbacks
|
|
4089
|
-
onTransactionStateChange:
|
|
4090
|
-
onTransactionSubmitted:
|
|
4091
|
-
onTransactionConfirmed:
|
|
4209
|
+
onTransactionStateChange: import_zod49.z.function().optional(),
|
|
4210
|
+
onTransactionSubmitted: import_zod49.z.function().optional(),
|
|
4211
|
+
onTransactionConfirmed: import_zod49.z.function().optional()
|
|
4092
4212
|
}).passthrough().refine(
|
|
4093
4213
|
(data) => {
|
|
4094
4214
|
const hasPrivateKey = !!data.privateKey;
|
|
@@ -4112,12 +4232,12 @@ var AddComposeHashRequestSchema = import_zod47.z.object({
|
|
|
4112
4232
|
path: ["chain"]
|
|
4113
4233
|
}
|
|
4114
4234
|
);
|
|
4115
|
-
var AddComposeHashSchema =
|
|
4116
|
-
composeHash:
|
|
4117
|
-
appId:
|
|
4118
|
-
transactionHash:
|
|
4119
|
-
blockNumber:
|
|
4120
|
-
gasUsed:
|
|
4235
|
+
var AddComposeHashSchema = import_zod49.z.object({
|
|
4236
|
+
composeHash: import_zod49.z.string(),
|
|
4237
|
+
appId: import_zod49.z.string(),
|
|
4238
|
+
transactionHash: import_zod49.z.string(),
|
|
4239
|
+
blockNumber: import_zod49.z.bigint().optional(),
|
|
4240
|
+
gasUsed: import_zod49.z.bigint().optional()
|
|
4121
4241
|
}).passthrough();
|
|
4122
4242
|
function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
|
|
4123
4243
|
console.log(receipt.logs);
|
|
@@ -4308,16 +4428,706 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
4308
4428
|
}
|
|
4309
4429
|
}
|
|
4310
4430
|
|
|
4431
|
+
// src/actions/blockchains/add_device.ts
|
|
4432
|
+
var import_zod50 = require("zod");
|
|
4433
|
+
var import_viem5 = require("viem");
|
|
4434
|
+
var import_accounts4 = require("viem/accounts");
|
|
4435
|
+
|
|
4436
|
+
// src/actions/blockchains/abi/dstack_app.ts
|
|
4437
|
+
var dstackAppAbi = [
|
|
4438
|
+
// ── Write functions ──────────────────────────────────────────────
|
|
4439
|
+
{
|
|
4440
|
+
inputs: [{ internalType: "bytes32", name: "deviceId", type: "bytes32" }],
|
|
4441
|
+
name: "addDevice",
|
|
4442
|
+
outputs: [],
|
|
4443
|
+
stateMutability: "nonpayable",
|
|
4444
|
+
type: "function"
|
|
4445
|
+
},
|
|
4446
|
+
{
|
|
4447
|
+
inputs: [{ internalType: "bytes32", name: "deviceId", type: "bytes32" }],
|
|
4448
|
+
name: "removeDevice",
|
|
4449
|
+
outputs: [],
|
|
4450
|
+
stateMutability: "nonpayable",
|
|
4451
|
+
type: "function"
|
|
4452
|
+
},
|
|
4453
|
+
{
|
|
4454
|
+
inputs: [{ internalType: "bool", name: "_allowAnyDevice", type: "bool" }],
|
|
4455
|
+
name: "setAllowAnyDevice",
|
|
4456
|
+
outputs: [],
|
|
4457
|
+
stateMutability: "nonpayable",
|
|
4458
|
+
type: "function"
|
|
4459
|
+
},
|
|
4460
|
+
// ── Read functions ───────────────────────────────────────────────
|
|
4461
|
+
{
|
|
4462
|
+
inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
4463
|
+
name: "allowedDeviceIds",
|
|
4464
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
4465
|
+
stateMutability: "view",
|
|
4466
|
+
type: "function"
|
|
4467
|
+
},
|
|
4468
|
+
{
|
|
4469
|
+
inputs: [],
|
|
4470
|
+
name: "allowAnyDevice",
|
|
4471
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
4472
|
+
stateMutability: "view",
|
|
4473
|
+
type: "function"
|
|
4474
|
+
},
|
|
4475
|
+
{
|
|
4476
|
+
inputs: [],
|
|
4477
|
+
name: "owner",
|
|
4478
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
4479
|
+
stateMutability: "view",
|
|
4480
|
+
type: "function"
|
|
4481
|
+
},
|
|
4482
|
+
// ── Events ───────────────────────────────────────────────────────
|
|
4483
|
+
{
|
|
4484
|
+
anonymous: false,
|
|
4485
|
+
inputs: [{ indexed: false, internalType: "bytes32", name: "deviceId", type: "bytes32" }],
|
|
4486
|
+
name: "DeviceAdded",
|
|
4487
|
+
type: "event"
|
|
4488
|
+
},
|
|
4489
|
+
{
|
|
4490
|
+
anonymous: false,
|
|
4491
|
+
inputs: [{ indexed: false, internalType: "bytes32", name: "deviceId", type: "bytes32" }],
|
|
4492
|
+
name: "DeviceRemoved",
|
|
4493
|
+
type: "event"
|
|
4494
|
+
},
|
|
4495
|
+
{
|
|
4496
|
+
anonymous: false,
|
|
4497
|
+
inputs: [{ indexed: false, internalType: "bool", name: "allowAny", type: "bool" }],
|
|
4498
|
+
name: "AllowAnyDeviceSet",
|
|
4499
|
+
type: "event"
|
|
4500
|
+
}
|
|
4501
|
+
];
|
|
4502
|
+
|
|
4503
|
+
// src/actions/blockchains/add_device.ts
|
|
4504
|
+
var AddDeviceRequestSchema = import_zod50.z.object({
|
|
4505
|
+
chain: import_zod50.z.unknown().optional(),
|
|
4506
|
+
rpcUrl: import_zod50.z.string().optional(),
|
|
4507
|
+
appAddress: import_zod50.z.string(),
|
|
4508
|
+
deviceId: import_zod50.z.string(),
|
|
4509
|
+
privateKey: import_zod50.z.string().optional(),
|
|
4510
|
+
walletClient: import_zod50.z.unknown().optional(),
|
|
4511
|
+
publicClient: import_zod50.z.unknown().optional(),
|
|
4512
|
+
skipPrerequisiteChecks: import_zod50.z.boolean().optional().default(false),
|
|
4513
|
+
minBalance: import_zod50.z.string().optional(),
|
|
4514
|
+
timeout: import_zod50.z.number().optional().default(12e4),
|
|
4515
|
+
retryOptions: import_zod50.z.unknown().optional(),
|
|
4516
|
+
signal: import_zod50.z.unknown().optional(),
|
|
4517
|
+
onTransactionStateChange: import_zod50.z.function().optional(),
|
|
4518
|
+
onTransactionSubmitted: import_zod50.z.function().optional(),
|
|
4519
|
+
onTransactionConfirmed: import_zod50.z.function().optional()
|
|
4520
|
+
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4521
|
+
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4522
|
+
path: ["privateKey", "walletClient"]
|
|
4523
|
+
}).refine(
|
|
4524
|
+
(data) => {
|
|
4525
|
+
if (!!data.publicClient && !!data.walletClient) return true;
|
|
4526
|
+
return !!data.chain;
|
|
4527
|
+
},
|
|
4528
|
+
{
|
|
4529
|
+
message: "Chain is required when publicClient or walletClient is not provided",
|
|
4530
|
+
path: ["chain"]
|
|
4531
|
+
}
|
|
4532
|
+
);
|
|
4533
|
+
var AddDeviceSchema = import_zod50.z.object({
|
|
4534
|
+
appAddress: import_zod50.z.string(),
|
|
4535
|
+
deviceId: import_zod50.z.string(),
|
|
4536
|
+
transactionHash: import_zod50.z.string(),
|
|
4537
|
+
blockNumber: import_zod50.z.bigint().optional(),
|
|
4538
|
+
gasUsed: import_zod50.z.bigint().optional()
|
|
4539
|
+
}).passthrough();
|
|
4540
|
+
async function addDevice(request, parameters) {
|
|
4541
|
+
const validatedRequest = AddDeviceRequestSchema.parse(request);
|
|
4542
|
+
const {
|
|
4543
|
+
chain,
|
|
4544
|
+
rpcUrl,
|
|
4545
|
+
appAddress,
|
|
4546
|
+
deviceId,
|
|
4547
|
+
privateKey,
|
|
4548
|
+
walletClient: providedWalletClient,
|
|
4549
|
+
publicClient: providedPublicClient,
|
|
4550
|
+
timeout = 12e4,
|
|
4551
|
+
retryOptions,
|
|
4552
|
+
signal,
|
|
4553
|
+
onTransactionStateChange,
|
|
4554
|
+
onTransactionSubmitted,
|
|
4555
|
+
onTransactionConfirmed,
|
|
4556
|
+
skipPrerequisiteChecks = false,
|
|
4557
|
+
minBalance
|
|
4558
|
+
} = validatedRequest;
|
|
4559
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
4560
|
+
const deviceIdHex = asHex(deviceId);
|
|
4561
|
+
let publicClient;
|
|
4562
|
+
let walletClient;
|
|
4563
|
+
let address;
|
|
4564
|
+
let chainId;
|
|
4565
|
+
if (privateKey) {
|
|
4566
|
+
const account = (0, import_accounts4.privateKeyToAccount)(privateKey);
|
|
4567
|
+
publicClient = providedPublicClient ? providedPublicClient : (0, import_viem5.createPublicClient)({ chain, transport: (0, import_viem5.http)(rpcUrl) });
|
|
4568
|
+
walletClient = (0, import_viem5.createWalletClient)({
|
|
4569
|
+
account,
|
|
4570
|
+
chain,
|
|
4571
|
+
transport: (0, import_viem5.http)(rpcUrl)
|
|
4572
|
+
});
|
|
4573
|
+
address = account.address;
|
|
4574
|
+
chainId = chain.id;
|
|
4575
|
+
} else if (providedWalletClient) {
|
|
4576
|
+
walletClient = providedWalletClient;
|
|
4577
|
+
publicClient = providedPublicClient ? providedPublicClient : (0, import_viem5.createPublicClient)({ chain, transport: (0, import_viem5.http)(rpcUrl) });
|
|
4578
|
+
if (!walletClient.account?.address) {
|
|
4579
|
+
throw new Error("WalletClient must have an account with address");
|
|
4580
|
+
}
|
|
4581
|
+
address = walletClient.account.address;
|
|
4582
|
+
chainId = chain ? chain.id : await walletClient.getChainId();
|
|
4583
|
+
} else {
|
|
4584
|
+
throw new Error("Either privateKey or walletClient must be provided");
|
|
4585
|
+
}
|
|
4586
|
+
const networkClients = { publicClient, walletClient, address, chainId };
|
|
4587
|
+
const transactionTracker = createTransactionTracker();
|
|
4588
|
+
if (onTransactionStateChange && typeof onTransactionStateChange === "function") {
|
|
4589
|
+
const pollStatus = () => {
|
|
4590
|
+
onTransactionStateChange(transactionTracker.status);
|
|
4591
|
+
if (!transactionTracker.isComplete) {
|
|
4592
|
+
setTimeout(pollStatus, 100);
|
|
4593
|
+
}
|
|
4594
|
+
};
|
|
4595
|
+
setTimeout(pollStatus, 10);
|
|
4596
|
+
}
|
|
4597
|
+
if (!skipPrerequisiteChecks) {
|
|
4598
|
+
const requirements = {
|
|
4599
|
+
targetChainId: chainId,
|
|
4600
|
+
minBalance: minBalance ? (0, import_viem5.parseEther)(minBalance) : (0, import_viem5.parseEther)("0.001")
|
|
4601
|
+
};
|
|
4602
|
+
const validation = await validateNetworkPrerequisites(networkClients, requirements);
|
|
4603
|
+
if (!validation.networkValid) {
|
|
4604
|
+
throw new Error(
|
|
4605
|
+
`Network mismatch: Expected chain ${requirements.targetChainId}, but wallet is on chain ${validation.details.currentChainId}`
|
|
4606
|
+
);
|
|
4607
|
+
}
|
|
4608
|
+
if (!validation.balanceValid) {
|
|
4609
|
+
const requiredEth = Number(requirements.minBalance) / 1e18;
|
|
4610
|
+
const currentEth = Number(validation.details.balance) / 1e18;
|
|
4611
|
+
throw new Error(
|
|
4612
|
+
`Insufficient balance: Required ${requiredEth} ETH, but account has ${currentEth.toFixed(6)} ETH`
|
|
4613
|
+
);
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
const addDeviceOperation = async (clients) => {
|
|
4617
|
+
return clients.walletClient.writeContract({
|
|
4618
|
+
address: contractAddress,
|
|
4619
|
+
abi: dstackAppAbi,
|
|
4620
|
+
functionName: "addDevice",
|
|
4621
|
+
args: [deviceIdHex],
|
|
4622
|
+
account: clients.walletClient.account || clients.address,
|
|
4623
|
+
chain: chain || null
|
|
4624
|
+
});
|
|
4625
|
+
};
|
|
4626
|
+
const transactionResult = retryOptions ? await executeTransactionWithRetry(
|
|
4627
|
+
addDeviceOperation,
|
|
4628
|
+
networkClients,
|
|
4629
|
+
[],
|
|
4630
|
+
{
|
|
4631
|
+
timeout,
|
|
4632
|
+
confirmations: 1,
|
|
4633
|
+
onSubmitted: onTransactionSubmitted,
|
|
4634
|
+
onConfirmed: onTransactionConfirmed,
|
|
4635
|
+
signal
|
|
4636
|
+
},
|
|
4637
|
+
retryOptions
|
|
4638
|
+
) : await transactionTracker.execute(addDeviceOperation, networkClients, [], {
|
|
4639
|
+
timeout,
|
|
4640
|
+
confirmations: 1,
|
|
4641
|
+
onSubmitted: onTransactionSubmitted,
|
|
4642
|
+
onConfirmed: onTransactionConfirmed,
|
|
4643
|
+
signal
|
|
4644
|
+
});
|
|
4645
|
+
const result = {
|
|
4646
|
+
appAddress: contractAddress,
|
|
4647
|
+
deviceId: deviceIdHex,
|
|
4648
|
+
transactionHash: transactionResult.receipt.transactionHash,
|
|
4649
|
+
blockNumber: transactionResult.receipt.blockNumber,
|
|
4650
|
+
gasUsed: transactionResult.receipt.gasUsed
|
|
4651
|
+
};
|
|
4652
|
+
if (parameters?.schema === false) {
|
|
4653
|
+
return result;
|
|
4654
|
+
}
|
|
4655
|
+
const schema = parameters?.schema || AddDeviceSchema;
|
|
4656
|
+
return schema.parse(result);
|
|
4657
|
+
}
|
|
4658
|
+
async function safeAddDevice(request, parameters) {
|
|
4659
|
+
try {
|
|
4660
|
+
const result = await addDevice(request, parameters);
|
|
4661
|
+
return { success: true, data: result };
|
|
4662
|
+
} catch (error) {
|
|
4663
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
4664
|
+
return {
|
|
4665
|
+
success: false,
|
|
4666
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
4667
|
+
};
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
|
|
4671
|
+
// src/actions/blockchains/remove_device.ts
|
|
4672
|
+
var import_zod51 = require("zod");
|
|
4673
|
+
var import_viem6 = require("viem");
|
|
4674
|
+
var import_accounts5 = require("viem/accounts");
|
|
4675
|
+
var RemoveDeviceRequestSchema = import_zod51.z.object({
|
|
4676
|
+
chain: import_zod51.z.unknown().optional(),
|
|
4677
|
+
rpcUrl: import_zod51.z.string().optional(),
|
|
4678
|
+
appAddress: import_zod51.z.string(),
|
|
4679
|
+
deviceId: import_zod51.z.string(),
|
|
4680
|
+
privateKey: import_zod51.z.string().optional(),
|
|
4681
|
+
walletClient: import_zod51.z.unknown().optional(),
|
|
4682
|
+
publicClient: import_zod51.z.unknown().optional(),
|
|
4683
|
+
skipPrerequisiteChecks: import_zod51.z.boolean().optional().default(false),
|
|
4684
|
+
minBalance: import_zod51.z.string().optional(),
|
|
4685
|
+
timeout: import_zod51.z.number().optional().default(12e4),
|
|
4686
|
+
retryOptions: import_zod51.z.unknown().optional(),
|
|
4687
|
+
signal: import_zod51.z.unknown().optional(),
|
|
4688
|
+
onTransactionStateChange: import_zod51.z.function().optional(),
|
|
4689
|
+
onTransactionSubmitted: import_zod51.z.function().optional(),
|
|
4690
|
+
onTransactionConfirmed: import_zod51.z.function().optional()
|
|
4691
|
+
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4692
|
+
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4693
|
+
path: ["privateKey", "walletClient"]
|
|
4694
|
+
}).refine(
|
|
4695
|
+
(data) => {
|
|
4696
|
+
if (!!data.publicClient && !!data.walletClient) return true;
|
|
4697
|
+
return !!data.chain;
|
|
4698
|
+
},
|
|
4699
|
+
{
|
|
4700
|
+
message: "Chain is required when publicClient or walletClient is not provided",
|
|
4701
|
+
path: ["chain"]
|
|
4702
|
+
}
|
|
4703
|
+
);
|
|
4704
|
+
var RemoveDeviceSchema = import_zod51.z.object({
|
|
4705
|
+
appAddress: import_zod51.z.string(),
|
|
4706
|
+
deviceId: import_zod51.z.string(),
|
|
4707
|
+
transactionHash: import_zod51.z.string(),
|
|
4708
|
+
blockNumber: import_zod51.z.bigint().optional(),
|
|
4709
|
+
gasUsed: import_zod51.z.bigint().optional()
|
|
4710
|
+
}).passthrough();
|
|
4711
|
+
async function removeDevice(request, parameters) {
|
|
4712
|
+
const validatedRequest = RemoveDeviceRequestSchema.parse(request);
|
|
4713
|
+
const {
|
|
4714
|
+
chain,
|
|
4715
|
+
rpcUrl,
|
|
4716
|
+
appAddress,
|
|
4717
|
+
deviceId,
|
|
4718
|
+
privateKey,
|
|
4719
|
+
walletClient: providedWalletClient,
|
|
4720
|
+
publicClient: providedPublicClient,
|
|
4721
|
+
timeout = 12e4,
|
|
4722
|
+
retryOptions,
|
|
4723
|
+
signal,
|
|
4724
|
+
onTransactionStateChange,
|
|
4725
|
+
onTransactionSubmitted,
|
|
4726
|
+
onTransactionConfirmed,
|
|
4727
|
+
skipPrerequisiteChecks = false,
|
|
4728
|
+
minBalance
|
|
4729
|
+
} = validatedRequest;
|
|
4730
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
4731
|
+
const deviceIdHex = asHex(deviceId);
|
|
4732
|
+
let publicClient;
|
|
4733
|
+
let walletClient;
|
|
4734
|
+
let address;
|
|
4735
|
+
let chainId;
|
|
4736
|
+
if (privateKey) {
|
|
4737
|
+
const account = (0, import_accounts5.privateKeyToAccount)(privateKey);
|
|
4738
|
+
publicClient = providedPublicClient ? providedPublicClient : (0, import_viem6.createPublicClient)({ chain, transport: (0, import_viem6.http)(rpcUrl) });
|
|
4739
|
+
walletClient = (0, import_viem6.createWalletClient)({
|
|
4740
|
+
account,
|
|
4741
|
+
chain,
|
|
4742
|
+
transport: (0, import_viem6.http)(rpcUrl)
|
|
4743
|
+
});
|
|
4744
|
+
address = account.address;
|
|
4745
|
+
chainId = chain.id;
|
|
4746
|
+
} else if (providedWalletClient) {
|
|
4747
|
+
walletClient = providedWalletClient;
|
|
4748
|
+
publicClient = providedPublicClient ? providedPublicClient : (0, import_viem6.createPublicClient)({ chain, transport: (0, import_viem6.http)(rpcUrl) });
|
|
4749
|
+
if (!walletClient.account?.address) {
|
|
4750
|
+
throw new Error("WalletClient must have an account with address");
|
|
4751
|
+
}
|
|
4752
|
+
address = walletClient.account.address;
|
|
4753
|
+
chainId = chain ? chain.id : await walletClient.getChainId();
|
|
4754
|
+
} else {
|
|
4755
|
+
throw new Error("Either privateKey or walletClient must be provided");
|
|
4756
|
+
}
|
|
4757
|
+
const networkClients = { publicClient, walletClient, address, chainId };
|
|
4758
|
+
const transactionTracker = createTransactionTracker();
|
|
4759
|
+
if (onTransactionStateChange && typeof onTransactionStateChange === "function") {
|
|
4760
|
+
const pollStatus = () => {
|
|
4761
|
+
onTransactionStateChange(transactionTracker.status);
|
|
4762
|
+
if (!transactionTracker.isComplete) {
|
|
4763
|
+
setTimeout(pollStatus, 100);
|
|
4764
|
+
}
|
|
4765
|
+
};
|
|
4766
|
+
setTimeout(pollStatus, 10);
|
|
4767
|
+
}
|
|
4768
|
+
if (!skipPrerequisiteChecks) {
|
|
4769
|
+
const requirements = {
|
|
4770
|
+
targetChainId: chainId,
|
|
4771
|
+
minBalance: minBalance ? (0, import_viem6.parseEther)(minBalance) : (0, import_viem6.parseEther)("0.001")
|
|
4772
|
+
};
|
|
4773
|
+
const validation = await validateNetworkPrerequisites(networkClients, requirements);
|
|
4774
|
+
if (!validation.networkValid) {
|
|
4775
|
+
throw new Error(
|
|
4776
|
+
`Network mismatch: Expected chain ${requirements.targetChainId}, but wallet is on chain ${validation.details.currentChainId}`
|
|
4777
|
+
);
|
|
4778
|
+
}
|
|
4779
|
+
if (!validation.balanceValid) {
|
|
4780
|
+
const requiredEth = Number(requirements.minBalance) / 1e18;
|
|
4781
|
+
const currentEth = Number(validation.details.balance) / 1e18;
|
|
4782
|
+
throw new Error(
|
|
4783
|
+
`Insufficient balance: Required ${requiredEth} ETH, but account has ${currentEth.toFixed(6)} ETH`
|
|
4784
|
+
);
|
|
4785
|
+
}
|
|
4786
|
+
}
|
|
4787
|
+
const removeDeviceOperation = async (clients) => {
|
|
4788
|
+
return clients.walletClient.writeContract({
|
|
4789
|
+
address: contractAddress,
|
|
4790
|
+
abi: dstackAppAbi,
|
|
4791
|
+
functionName: "removeDevice",
|
|
4792
|
+
args: [deviceIdHex],
|
|
4793
|
+
account: clients.walletClient.account || clients.address,
|
|
4794
|
+
chain: chain || null
|
|
4795
|
+
});
|
|
4796
|
+
};
|
|
4797
|
+
const transactionResult = retryOptions ? await executeTransactionWithRetry(
|
|
4798
|
+
removeDeviceOperation,
|
|
4799
|
+
networkClients,
|
|
4800
|
+
[],
|
|
4801
|
+
{
|
|
4802
|
+
timeout,
|
|
4803
|
+
confirmations: 1,
|
|
4804
|
+
onSubmitted: onTransactionSubmitted,
|
|
4805
|
+
onConfirmed: onTransactionConfirmed,
|
|
4806
|
+
signal
|
|
4807
|
+
},
|
|
4808
|
+
retryOptions
|
|
4809
|
+
) : await transactionTracker.execute(removeDeviceOperation, networkClients, [], {
|
|
4810
|
+
timeout,
|
|
4811
|
+
confirmations: 1,
|
|
4812
|
+
onSubmitted: onTransactionSubmitted,
|
|
4813
|
+
onConfirmed: onTransactionConfirmed,
|
|
4814
|
+
signal
|
|
4815
|
+
});
|
|
4816
|
+
const result = {
|
|
4817
|
+
appAddress: contractAddress,
|
|
4818
|
+
deviceId: deviceIdHex,
|
|
4819
|
+
transactionHash: transactionResult.receipt.transactionHash,
|
|
4820
|
+
blockNumber: transactionResult.receipt.blockNumber,
|
|
4821
|
+
gasUsed: transactionResult.receipt.gasUsed
|
|
4822
|
+
};
|
|
4823
|
+
if (parameters?.schema === false) {
|
|
4824
|
+
return result;
|
|
4825
|
+
}
|
|
4826
|
+
const schema = parameters?.schema || RemoveDeviceSchema;
|
|
4827
|
+
return schema.parse(result);
|
|
4828
|
+
}
|
|
4829
|
+
async function safeRemoveDevice(request, parameters) {
|
|
4830
|
+
try {
|
|
4831
|
+
const result = await removeDevice(request, parameters);
|
|
4832
|
+
return { success: true, data: result };
|
|
4833
|
+
} catch (error) {
|
|
4834
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
4835
|
+
return {
|
|
4836
|
+
success: false,
|
|
4837
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
4838
|
+
};
|
|
4839
|
+
}
|
|
4840
|
+
}
|
|
4841
|
+
|
|
4842
|
+
// src/actions/blockchains/set_allow_any_device.ts
|
|
4843
|
+
var import_zod52 = require("zod");
|
|
4844
|
+
var import_viem7 = require("viem");
|
|
4845
|
+
var import_accounts6 = require("viem/accounts");
|
|
4846
|
+
var SetAllowAnyDeviceRequestSchema = import_zod52.z.object({
|
|
4847
|
+
chain: import_zod52.z.unknown().optional(),
|
|
4848
|
+
rpcUrl: import_zod52.z.string().optional(),
|
|
4849
|
+
appAddress: import_zod52.z.string(),
|
|
4850
|
+
allow: import_zod52.z.boolean(),
|
|
4851
|
+
privateKey: import_zod52.z.string().optional(),
|
|
4852
|
+
walletClient: import_zod52.z.unknown().optional(),
|
|
4853
|
+
publicClient: import_zod52.z.unknown().optional(),
|
|
4854
|
+
skipPrerequisiteChecks: import_zod52.z.boolean().optional().default(false),
|
|
4855
|
+
minBalance: import_zod52.z.string().optional(),
|
|
4856
|
+
timeout: import_zod52.z.number().optional().default(12e4),
|
|
4857
|
+
retryOptions: import_zod52.z.unknown().optional(),
|
|
4858
|
+
signal: import_zod52.z.unknown().optional(),
|
|
4859
|
+
onTransactionStateChange: import_zod52.z.function().optional(),
|
|
4860
|
+
onTransactionSubmitted: import_zod52.z.function().optional(),
|
|
4861
|
+
onTransactionConfirmed: import_zod52.z.function().optional()
|
|
4862
|
+
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4863
|
+
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4864
|
+
path: ["privateKey", "walletClient"]
|
|
4865
|
+
}).refine(
|
|
4866
|
+
(data) => {
|
|
4867
|
+
if (!!data.publicClient && !!data.walletClient) return true;
|
|
4868
|
+
return !!data.chain;
|
|
4869
|
+
},
|
|
4870
|
+
{
|
|
4871
|
+
message: "Chain is required when publicClient or walletClient is not provided",
|
|
4872
|
+
path: ["chain"]
|
|
4873
|
+
}
|
|
4874
|
+
);
|
|
4875
|
+
var SetAllowAnyDeviceSchema = import_zod52.z.object({
|
|
4876
|
+
appAddress: import_zod52.z.string(),
|
|
4877
|
+
allow: import_zod52.z.boolean(),
|
|
4878
|
+
transactionHash: import_zod52.z.string(),
|
|
4879
|
+
blockNumber: import_zod52.z.bigint().optional(),
|
|
4880
|
+
gasUsed: import_zod52.z.bigint().optional()
|
|
4881
|
+
}).passthrough();
|
|
4882
|
+
async function setAllowAnyDevice(request, parameters) {
|
|
4883
|
+
const validatedRequest = SetAllowAnyDeviceRequestSchema.parse(request);
|
|
4884
|
+
const {
|
|
4885
|
+
chain,
|
|
4886
|
+
rpcUrl,
|
|
4887
|
+
appAddress,
|
|
4888
|
+
allow,
|
|
4889
|
+
privateKey,
|
|
4890
|
+
walletClient: providedWalletClient,
|
|
4891
|
+
publicClient: providedPublicClient,
|
|
4892
|
+
timeout = 12e4,
|
|
4893
|
+
retryOptions,
|
|
4894
|
+
signal,
|
|
4895
|
+
onTransactionStateChange,
|
|
4896
|
+
onTransactionSubmitted,
|
|
4897
|
+
onTransactionConfirmed,
|
|
4898
|
+
skipPrerequisiteChecks = false,
|
|
4899
|
+
minBalance
|
|
4900
|
+
} = validatedRequest;
|
|
4901
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
4902
|
+
let publicClient;
|
|
4903
|
+
let walletClient;
|
|
4904
|
+
let address;
|
|
4905
|
+
let chainId;
|
|
4906
|
+
if (privateKey) {
|
|
4907
|
+
const account = (0, import_accounts6.privateKeyToAccount)(privateKey);
|
|
4908
|
+
publicClient = providedPublicClient ? providedPublicClient : (0, import_viem7.createPublicClient)({ chain, transport: (0, import_viem7.http)(rpcUrl) });
|
|
4909
|
+
walletClient = (0, import_viem7.createWalletClient)({
|
|
4910
|
+
account,
|
|
4911
|
+
chain,
|
|
4912
|
+
transport: (0, import_viem7.http)(rpcUrl)
|
|
4913
|
+
});
|
|
4914
|
+
address = account.address;
|
|
4915
|
+
chainId = chain.id;
|
|
4916
|
+
} else if (providedWalletClient) {
|
|
4917
|
+
walletClient = providedWalletClient;
|
|
4918
|
+
publicClient = providedPublicClient ? providedPublicClient : (0, import_viem7.createPublicClient)({ chain, transport: (0, import_viem7.http)(rpcUrl) });
|
|
4919
|
+
if (!walletClient.account?.address) {
|
|
4920
|
+
throw new Error("WalletClient must have an account with address");
|
|
4921
|
+
}
|
|
4922
|
+
address = walletClient.account.address;
|
|
4923
|
+
chainId = chain ? chain.id : await walletClient.getChainId();
|
|
4924
|
+
} else {
|
|
4925
|
+
throw new Error("Either privateKey or walletClient must be provided");
|
|
4926
|
+
}
|
|
4927
|
+
const networkClients = { publicClient, walletClient, address, chainId };
|
|
4928
|
+
const transactionTracker = createTransactionTracker();
|
|
4929
|
+
if (onTransactionStateChange && typeof onTransactionStateChange === "function") {
|
|
4930
|
+
const pollStatus = () => {
|
|
4931
|
+
onTransactionStateChange(transactionTracker.status);
|
|
4932
|
+
if (!transactionTracker.isComplete) {
|
|
4933
|
+
setTimeout(pollStatus, 100);
|
|
4934
|
+
}
|
|
4935
|
+
};
|
|
4936
|
+
setTimeout(pollStatus, 10);
|
|
4937
|
+
}
|
|
4938
|
+
if (!skipPrerequisiteChecks) {
|
|
4939
|
+
const requirements = {
|
|
4940
|
+
targetChainId: chainId,
|
|
4941
|
+
minBalance: minBalance ? (0, import_viem7.parseEther)(minBalance) : (0, import_viem7.parseEther)("0.001")
|
|
4942
|
+
};
|
|
4943
|
+
const validation = await validateNetworkPrerequisites(networkClients, requirements);
|
|
4944
|
+
if (!validation.networkValid) {
|
|
4945
|
+
throw new Error(
|
|
4946
|
+
`Network mismatch: Expected chain ${requirements.targetChainId}, but wallet is on chain ${validation.details.currentChainId}`
|
|
4947
|
+
);
|
|
4948
|
+
}
|
|
4949
|
+
if (!validation.balanceValid) {
|
|
4950
|
+
const requiredEth = Number(requirements.minBalance) / 1e18;
|
|
4951
|
+
const currentEth = Number(validation.details.balance) / 1e18;
|
|
4952
|
+
throw new Error(
|
|
4953
|
+
`Insufficient balance: Required ${requiredEth} ETH, but account has ${currentEth.toFixed(6)} ETH`
|
|
4954
|
+
);
|
|
4955
|
+
}
|
|
4956
|
+
}
|
|
4957
|
+
const setAllowAnyOperation = async (clients) => {
|
|
4958
|
+
return clients.walletClient.writeContract({
|
|
4959
|
+
address: contractAddress,
|
|
4960
|
+
abi: dstackAppAbi,
|
|
4961
|
+
functionName: "setAllowAnyDevice",
|
|
4962
|
+
args: [allow],
|
|
4963
|
+
account: clients.walletClient.account || clients.address,
|
|
4964
|
+
chain: chain || null
|
|
4965
|
+
});
|
|
4966
|
+
};
|
|
4967
|
+
const transactionResult = retryOptions ? await executeTransactionWithRetry(
|
|
4968
|
+
setAllowAnyOperation,
|
|
4969
|
+
networkClients,
|
|
4970
|
+
[],
|
|
4971
|
+
{
|
|
4972
|
+
timeout,
|
|
4973
|
+
confirmations: 1,
|
|
4974
|
+
onSubmitted: onTransactionSubmitted,
|
|
4975
|
+
onConfirmed: onTransactionConfirmed,
|
|
4976
|
+
signal
|
|
4977
|
+
},
|
|
4978
|
+
retryOptions
|
|
4979
|
+
) : await transactionTracker.execute(setAllowAnyOperation, networkClients, [], {
|
|
4980
|
+
timeout,
|
|
4981
|
+
confirmations: 1,
|
|
4982
|
+
onSubmitted: onTransactionSubmitted,
|
|
4983
|
+
onConfirmed: onTransactionConfirmed,
|
|
4984
|
+
signal
|
|
4985
|
+
});
|
|
4986
|
+
const result = {
|
|
4987
|
+
appAddress: contractAddress,
|
|
4988
|
+
allow,
|
|
4989
|
+
transactionHash: transactionResult.receipt.transactionHash,
|
|
4990
|
+
blockNumber: transactionResult.receipt.blockNumber,
|
|
4991
|
+
gasUsed: transactionResult.receipt.gasUsed
|
|
4992
|
+
};
|
|
4993
|
+
if (parameters?.schema === false) {
|
|
4994
|
+
return result;
|
|
4995
|
+
}
|
|
4996
|
+
const schema = parameters?.schema || SetAllowAnyDeviceSchema;
|
|
4997
|
+
return schema.parse(result);
|
|
4998
|
+
}
|
|
4999
|
+
async function safeSetAllowAnyDevice(request, parameters) {
|
|
5000
|
+
try {
|
|
5001
|
+
const result = await setAllowAnyDevice(request, parameters);
|
|
5002
|
+
return { success: true, data: result };
|
|
5003
|
+
} catch (error) {
|
|
5004
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
5005
|
+
return {
|
|
5006
|
+
success: false,
|
|
5007
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
5008
|
+
};
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
5011
|
+
|
|
5012
|
+
// src/actions/blockchains/get_allowed_devices.ts
|
|
5013
|
+
var import_zod53 = require("zod");
|
|
5014
|
+
var import_viem8 = require("viem");
|
|
5015
|
+
var GetAllowedDevicesSchema = import_zod53.z.object({
|
|
5016
|
+
appAddress: import_zod53.z.string(),
|
|
5017
|
+
owner: import_zod53.z.string(),
|
|
5018
|
+
allowAnyDevice: import_zod53.z.boolean(),
|
|
5019
|
+
devices: import_zod53.z.array(import_zod53.z.string())
|
|
5020
|
+
});
|
|
5021
|
+
async function getAllowedDevices(request) {
|
|
5022
|
+
const { chain, rpcUrl, appAddress, deviceIds, publicClient: providedPublicClient } = request;
|
|
5023
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
5024
|
+
const publicClient = providedPublicClient ? providedPublicClient : (() => {
|
|
5025
|
+
if (!chain) throw new Error("Chain is required when publicClient is not provided");
|
|
5026
|
+
return (0, import_viem8.createPublicClient)({ chain, transport: (0, import_viem8.http)(rpcUrl) });
|
|
5027
|
+
})();
|
|
5028
|
+
const [allowAnyDevice, owner] = await Promise.all([
|
|
5029
|
+
publicClient.readContract({
|
|
5030
|
+
address: contractAddress,
|
|
5031
|
+
abi: dstackAppAbi,
|
|
5032
|
+
functionName: "allowAnyDevice"
|
|
5033
|
+
}),
|
|
5034
|
+
publicClient.readContract({
|
|
5035
|
+
address: contractAddress,
|
|
5036
|
+
abi: dstackAppAbi,
|
|
5037
|
+
functionName: "owner"
|
|
5038
|
+
})
|
|
5039
|
+
]);
|
|
5040
|
+
if (allowAnyDevice) {
|
|
5041
|
+
return {
|
|
5042
|
+
appAddress: contractAddress,
|
|
5043
|
+
owner,
|
|
5044
|
+
allowAnyDevice: true,
|
|
5045
|
+
devices: deviceIds.map((id) => asHex(id))
|
|
5046
|
+
};
|
|
5047
|
+
}
|
|
5048
|
+
let devices;
|
|
5049
|
+
if (deviceIds.length === 0) {
|
|
5050
|
+
devices = [];
|
|
5051
|
+
} else {
|
|
5052
|
+
const calls = deviceIds.map((deviceId) => ({
|
|
5053
|
+
address: contractAddress,
|
|
5054
|
+
abi: dstackAppAbi,
|
|
5055
|
+
functionName: "allowedDeviceIds",
|
|
5056
|
+
args: [asHex(deviceId)]
|
|
5057
|
+
}));
|
|
5058
|
+
const multicallResults = await publicClient.multicall({ contracts: calls });
|
|
5059
|
+
devices = deviceIds.map((deviceId, i) => ({
|
|
5060
|
+
deviceId: asHex(deviceId),
|
|
5061
|
+
allowed: multicallResults[i]?.status === "success" && multicallResults[i]?.result === true
|
|
5062
|
+
})).filter((r) => r.allowed).map((r) => r.deviceId);
|
|
5063
|
+
}
|
|
5064
|
+
return {
|
|
5065
|
+
appAddress: contractAddress,
|
|
5066
|
+
owner,
|
|
5067
|
+
allowAnyDevice: false,
|
|
5068
|
+
devices
|
|
5069
|
+
};
|
|
5070
|
+
}
|
|
5071
|
+
async function safeGetAllowedDevices(request) {
|
|
5072
|
+
try {
|
|
5073
|
+
const result = await getAllowedDevices(request);
|
|
5074
|
+
return { success: true, data: result };
|
|
5075
|
+
} catch (error) {
|
|
5076
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
5077
|
+
return {
|
|
5078
|
+
success: false,
|
|
5079
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
5080
|
+
};
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5083
|
+
|
|
5084
|
+
// src/actions/blockchains/check_device_allowed.ts
|
|
5085
|
+
var import_viem9 = require("viem");
|
|
5086
|
+
async function checkDeviceAllowed(request) {
|
|
5087
|
+
const { chain, rpcUrl, appAddress, deviceId, publicClient: providedPublicClient } = request;
|
|
5088
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
5089
|
+
const deviceIdHex = asHex(deviceId);
|
|
5090
|
+
const publicClient = providedPublicClient ? providedPublicClient : (() => {
|
|
5091
|
+
if (!chain) throw new Error("Chain is required when publicClient is not provided");
|
|
5092
|
+
return (0, import_viem9.createPublicClient)({ chain, transport: (0, import_viem9.http)(rpcUrl) });
|
|
5093
|
+
})();
|
|
5094
|
+
const allowAny = await publicClient.readContract({
|
|
5095
|
+
address: contractAddress,
|
|
5096
|
+
abi: dstackAppAbi,
|
|
5097
|
+
functionName: "allowAnyDevice"
|
|
5098
|
+
});
|
|
5099
|
+
if (allowAny) return true;
|
|
5100
|
+
const allowed = await publicClient.readContract({
|
|
5101
|
+
address: contractAddress,
|
|
5102
|
+
abi: dstackAppAbi,
|
|
5103
|
+
functionName: "allowedDeviceIds",
|
|
5104
|
+
args: [deviceIdHex]
|
|
5105
|
+
});
|
|
5106
|
+
return allowed;
|
|
5107
|
+
}
|
|
5108
|
+
async function safeCheckDeviceAllowed(request) {
|
|
5109
|
+
try {
|
|
5110
|
+
const result = await checkDeviceAllowed(request);
|
|
5111
|
+
return { success: true, data: result };
|
|
5112
|
+
} catch (error) {
|
|
5113
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
5114
|
+
return {
|
|
5115
|
+
success: false,
|
|
5116
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
5117
|
+
};
|
|
5118
|
+
}
|
|
5119
|
+
}
|
|
5120
|
+
|
|
4311
5121
|
// src/actions/workspaces/get_workspace_nodes.ts
|
|
4312
|
-
var
|
|
5122
|
+
var import_zod54 = require("zod");
|
|
4313
5123
|
var NodeRefSchema2 = NodeRefSchema;
|
|
4314
5124
|
var NodeInfoSchema = NodeRefSchema2;
|
|
4315
|
-
var GetWorkspaceNodesSchema =
|
|
4316
|
-
items:
|
|
4317
|
-
total:
|
|
4318
|
-
page:
|
|
4319
|
-
page_size:
|
|
4320
|
-
pages:
|
|
5125
|
+
var GetWorkspaceNodesSchema = import_zod54.z.object({
|
|
5126
|
+
items: import_zod54.z.array(NodeRefSchema2),
|
|
5127
|
+
total: import_zod54.z.number(),
|
|
5128
|
+
page: import_zod54.z.number(),
|
|
5129
|
+
page_size: import_zod54.z.number(),
|
|
5130
|
+
pages: import_zod54.z.number()
|
|
4321
5131
|
}).passthrough();
|
|
4322
5132
|
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
4323
5133
|
const { teamSlug, page, pageSize } = request;
|
|
@@ -4329,42 +5139,56 @@ var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAct
|
|
|
4329
5139
|
});
|
|
4330
5140
|
|
|
4331
5141
|
// src/actions/workspaces/get_workspace_quotas.ts
|
|
4332
|
-
var
|
|
4333
|
-
var QuotaMetricSchema =
|
|
4334
|
-
limit:
|
|
4335
|
-
remaining:
|
|
5142
|
+
var import_zod55 = require("zod");
|
|
5143
|
+
var QuotaMetricSchema = import_zod55.z.object({
|
|
5144
|
+
limit: import_zod55.z.number(),
|
|
5145
|
+
remaining: import_zod55.z.number()
|
|
4336
5146
|
}).passthrough();
|
|
4337
|
-
var WorkspaceQuotasSchema =
|
|
5147
|
+
var WorkspaceQuotasSchema = import_zod55.z.object({
|
|
4338
5148
|
vm_slots: QuotaMetricSchema,
|
|
4339
5149
|
vcpu: QuotaMetricSchema,
|
|
4340
5150
|
memory_mb: QuotaMetricSchema,
|
|
4341
5151
|
disk_gb: QuotaMetricSchema
|
|
4342
5152
|
}).passthrough();
|
|
4343
|
-
var WorkspaceReservedGpuQuotaSchema =
|
|
5153
|
+
var WorkspaceReservedGpuQuotaSchema = import_zod55.z.object({
|
|
4344
5154
|
gpus: QuotaMetricSchema,
|
|
4345
|
-
in_use:
|
|
4346
|
-
misconfigured:
|
|
5155
|
+
in_use: import_zod55.z.number(),
|
|
5156
|
+
misconfigured: import_zod55.z.number()
|
|
4347
5157
|
}).passthrough();
|
|
4348
|
-
var GetWorkspaceQuotasSchema =
|
|
4349
|
-
team_slug:
|
|
4350
|
-
tier:
|
|
5158
|
+
var GetWorkspaceQuotasSchema = import_zod55.z.object({
|
|
5159
|
+
team_slug: import_zod55.z.string(),
|
|
5160
|
+
tier: import_zod55.z.string(),
|
|
4351
5161
|
quotas: WorkspaceQuotasSchema,
|
|
4352
5162
|
reserved_nodes: QuotaMetricSchema,
|
|
4353
5163
|
reserved_gpu: WorkspaceReservedGpuQuotaSchema,
|
|
4354
|
-
as_of:
|
|
5164
|
+
as_of: import_zod55.z.string()
|
|
4355
5165
|
}).passthrough();
|
|
4356
5166
|
var { action: getWorkspaceQuotas, safeAction: safeGetWorkspaceQuotas } = defineAction(GetWorkspaceQuotasSchema, async (client, request) => {
|
|
4357
5167
|
return await client.get(`/workspaces/${request.teamSlug}/quotas`);
|
|
4358
5168
|
});
|
|
4359
5169
|
|
|
5170
|
+
// src/actions/cvms/replicate_cvm.ts
|
|
5171
|
+
var import_zod56 = require("zod");
|
|
5172
|
+
var ReplicateCvmRequestSchema = refineCvmId(
|
|
5173
|
+
CvmIdObjectSchema.extend({
|
|
5174
|
+
node_id: import_zod56.z.number().optional()
|
|
5175
|
+
})
|
|
5176
|
+
);
|
|
5177
|
+
var { action: replicateCvm, safeAction: safeReplicateCvm } = defineAction(VMSchema, async (client, request) => {
|
|
5178
|
+
const parsed = ReplicateCvmRequestSchema.parse(request);
|
|
5179
|
+
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
5180
|
+
const { node_id } = parsed;
|
|
5181
|
+
return await client.post(`/cvms/${cvmId}/replicas`, { node_id });
|
|
5182
|
+
});
|
|
5183
|
+
|
|
4360
5184
|
// src/actions/cvms/watch_cvm_state.ts
|
|
4361
|
-
var
|
|
4362
|
-
var WatchCvmStateParamsSchema =
|
|
4363
|
-
target:
|
|
4364
|
-
interval:
|
|
4365
|
-
timeout:
|
|
4366
|
-
maxRetries:
|
|
4367
|
-
retryDelay:
|
|
5185
|
+
var import_zod57 = require("zod");
|
|
5186
|
+
var WatchCvmStateParamsSchema = import_zod57.z.object({
|
|
5187
|
+
target: import_zod57.z.string().describe("Target status to wait for (e.g., 'running', 'stopped')"),
|
|
5188
|
+
interval: import_zod57.z.number().min(5).max(30).default(5).describe("Polling interval in seconds"),
|
|
5189
|
+
timeout: import_zod57.z.number().min(10).max(600).default(300).describe("Timeout per attempt in seconds"),
|
|
5190
|
+
maxRetries: import_zod57.z.number().min(0).default(Number.POSITIVE_INFINITY).describe("Maximum number of retry attempts (Infinity for unlimited)"),
|
|
5191
|
+
retryDelay: import_zod57.z.number().min(0).default(5e3).describe("Delay between retries in milliseconds")
|
|
4368
5192
|
});
|
|
4369
5193
|
var WatchCvmStateRequestSchema = WatchCvmStateParamsSchema;
|
|
4370
5194
|
var WatchAbortedError = class extends Error {
|
|
@@ -4551,22 +5375,75 @@ function sleep(ms, signal) {
|
|
|
4551
5375
|
});
|
|
4552
5376
|
}
|
|
4553
5377
|
|
|
5378
|
+
// src/actions/cvms/refresh_cvm_instance_id.ts
|
|
5379
|
+
var import_zod58 = require("zod");
|
|
5380
|
+
var InstanceIdRefreshResultSchema = import_zod58.z.object({
|
|
5381
|
+
cvm_id: import_zod58.z.number().int(),
|
|
5382
|
+
identifier: import_zod58.z.string(),
|
|
5383
|
+
status: import_zod58.z.enum(["updated", "unchanged", "skipped", "conflict", "error"]),
|
|
5384
|
+
old_instance_id: import_zod58.z.string().nullable().optional(),
|
|
5385
|
+
new_instance_id: import_zod58.z.string().nullable().optional(),
|
|
5386
|
+
source: import_zod58.z.enum(["teepod_state", "teepod_info", "gateway", "none"]),
|
|
5387
|
+
verified_with_gateway: import_zod58.z.boolean(),
|
|
5388
|
+
reason: import_zod58.z.string().nullable().optional()
|
|
5389
|
+
});
|
|
5390
|
+
var RefreshCvmInstanceIdRequestSchema = refineCvmId(
|
|
5391
|
+
CvmIdObjectSchema.extend({
|
|
5392
|
+
overwrite: import_zod58.z.boolean().optional(),
|
|
5393
|
+
dry_run: import_zod58.z.boolean().optional()
|
|
5394
|
+
})
|
|
5395
|
+
);
|
|
5396
|
+
var { action: refreshCvmInstanceId, safeAction: safeRefreshCvmInstanceId } = defineAction(InstanceIdRefreshResultSchema, async (client, request) => {
|
|
5397
|
+
const parsed = RefreshCvmInstanceIdRequestSchema.parse(request);
|
|
5398
|
+
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
5399
|
+
const { overwrite, dry_run } = parsed;
|
|
5400
|
+
return await client.patch(`/cvms/${cvmId}/instance-id`, {
|
|
5401
|
+
overwrite,
|
|
5402
|
+
dry_run
|
|
5403
|
+
});
|
|
5404
|
+
});
|
|
5405
|
+
|
|
5406
|
+
// src/actions/cvms/refresh_cvm_instance_ids.ts
|
|
5407
|
+
var import_zod59 = require("zod");
|
|
5408
|
+
var RefreshCvmInstanceIdsRequestSchema = import_zod59.z.object({
|
|
5409
|
+
cvm_ids: import_zod59.z.array(import_zod59.z.string()).optional(),
|
|
5410
|
+
running_only: import_zod59.z.boolean().optional(),
|
|
5411
|
+
missing_only: import_zod59.z.boolean().optional(),
|
|
5412
|
+
overwrite: import_zod59.z.boolean().optional(),
|
|
5413
|
+
limit: import_zod59.z.number().int().min(1).max(500).optional(),
|
|
5414
|
+
dry_run: import_zod59.z.boolean().optional()
|
|
5415
|
+
}).strict();
|
|
5416
|
+
var RefreshCvmInstanceIdsResponseSchema = import_zod59.z.object({
|
|
5417
|
+
total: import_zod59.z.number().int(),
|
|
5418
|
+
scanned: import_zod59.z.number().int(),
|
|
5419
|
+
updated: import_zod59.z.number().int(),
|
|
5420
|
+
unchanged: import_zod59.z.number().int(),
|
|
5421
|
+
skipped: import_zod59.z.number().int(),
|
|
5422
|
+
conflicts: import_zod59.z.number().int(),
|
|
5423
|
+
errors: import_zod59.z.number().int(),
|
|
5424
|
+
items: import_zod59.z.array(InstanceIdRefreshResultSchema)
|
|
5425
|
+
});
|
|
5426
|
+
var { action: refreshCvmInstanceIds, safeAction: safeRefreshCvmInstanceIds } = defineAction(RefreshCvmInstanceIdsResponseSchema, async (client, request) => {
|
|
5427
|
+
const parsed = RefreshCvmInstanceIdsRequestSchema.parse(request);
|
|
5428
|
+
return await client.patch("/cvms/instance-ids", parsed);
|
|
5429
|
+
});
|
|
5430
|
+
|
|
4554
5431
|
// src/actions/cvms/get_cvm_status_batch.ts
|
|
4555
|
-
var
|
|
4556
|
-
var CvmStatusSchema =
|
|
4557
|
-
vm_uuid:
|
|
4558
|
-
status:
|
|
4559
|
-
uptime:
|
|
4560
|
-
in_progress:
|
|
4561
|
-
boot_progress:
|
|
4562
|
-
boot_error:
|
|
4563
|
-
operation_type:
|
|
4564
|
-
operation_started_at:
|
|
4565
|
-
correlation_id:
|
|
5432
|
+
var import_zod60 = require("zod");
|
|
5433
|
+
var CvmStatusSchema = import_zod60.z.object({
|
|
5434
|
+
vm_uuid: import_zod60.z.string(),
|
|
5435
|
+
status: import_zod60.z.string(),
|
|
5436
|
+
uptime: import_zod60.z.string().nullable().optional(),
|
|
5437
|
+
in_progress: import_zod60.z.boolean(),
|
|
5438
|
+
boot_progress: import_zod60.z.string().nullable().optional(),
|
|
5439
|
+
boot_error: import_zod60.z.string().nullable().optional(),
|
|
5440
|
+
operation_type: import_zod60.z.string().nullable().optional(),
|
|
5441
|
+
operation_started_at: import_zod60.z.string().nullable().optional(),
|
|
5442
|
+
correlation_id: import_zod60.z.string().nullable().optional()
|
|
4566
5443
|
});
|
|
4567
|
-
var GetCvmStatusBatchResponseSchema =
|
|
4568
|
-
var GetCvmStatusBatchRequestSchema =
|
|
4569
|
-
vmUuids:
|
|
5444
|
+
var GetCvmStatusBatchResponseSchema = import_zod60.z.record(import_zod60.z.string(), CvmStatusSchema);
|
|
5445
|
+
var GetCvmStatusBatchRequestSchema = import_zod60.z.object({
|
|
5446
|
+
vmUuids: import_zod60.z.array(import_zod60.z.string())
|
|
4570
5447
|
});
|
|
4571
5448
|
var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAction(GetCvmStatusBatchResponseSchema, async (client, request) => {
|
|
4572
5449
|
const { vmUuids } = GetCvmStatusBatchRequestSchema.parse(request);
|
|
@@ -4574,11 +5451,11 @@ var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAct
|
|
|
4574
5451
|
});
|
|
4575
5452
|
|
|
4576
5453
|
// src/actions/cvms/get_cvm_user_config.ts
|
|
4577
|
-
var
|
|
4578
|
-
var CvmUserConfigSchema =
|
|
4579
|
-
hostname:
|
|
4580
|
-
ssh_authorized_keys:
|
|
4581
|
-
default_gateway_domain:
|
|
5454
|
+
var import_zod61 = require("zod");
|
|
5455
|
+
var CvmUserConfigSchema = import_zod61.z.object({
|
|
5456
|
+
hostname: import_zod61.z.string().nullable().optional(),
|
|
5457
|
+
ssh_authorized_keys: import_zod61.z.array(import_zod61.z.string()).default([]),
|
|
5458
|
+
default_gateway_domain: import_zod61.z.string().nullable().optional()
|
|
4582
5459
|
});
|
|
4583
5460
|
var GetCvmUserConfigRequestSchema = CvmIdSchema;
|
|
4584
5461
|
var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineAction(CvmUserConfigSchema, async (client, request) => {
|
|
@@ -4587,19 +5464,19 @@ var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineActio
|
|
|
4587
5464
|
});
|
|
4588
5465
|
|
|
4589
5466
|
// src/actions/apps/get_app_list.ts
|
|
4590
|
-
var
|
|
4591
|
-
var GetAppListRequestSchema =
|
|
4592
|
-
page:
|
|
4593
|
-
page_size:
|
|
4594
|
-
search:
|
|
4595
|
-
status:
|
|
4596
|
-
listed:
|
|
4597
|
-
base_image:
|
|
4598
|
-
instance_type:
|
|
4599
|
-
kms_slug:
|
|
4600
|
-
kms_type:
|
|
4601
|
-
node:
|
|
4602
|
-
region:
|
|
5467
|
+
var import_zod62 = require("zod");
|
|
5468
|
+
var GetAppListRequestSchema = import_zod62.z.object({
|
|
5469
|
+
page: import_zod62.z.number().int().min(1).optional(),
|
|
5470
|
+
page_size: import_zod62.z.number().int().min(1).max(100).optional(),
|
|
5471
|
+
search: import_zod62.z.string().optional(),
|
|
5472
|
+
status: import_zod62.z.array(import_zod62.z.string()).optional(),
|
|
5473
|
+
listed: import_zod62.z.boolean().optional(),
|
|
5474
|
+
base_image: import_zod62.z.string().optional(),
|
|
5475
|
+
instance_type: import_zod62.z.string().optional(),
|
|
5476
|
+
kms_slug: import_zod62.z.string().optional(),
|
|
5477
|
+
kms_type: import_zod62.z.string().optional(),
|
|
5478
|
+
node: import_zod62.z.string().optional(),
|
|
5479
|
+
region: import_zod62.z.string().optional()
|
|
4603
5480
|
}).strict();
|
|
4604
5481
|
function getSchemaForVersion4(version) {
|
|
4605
5482
|
return version === "2025-10-28" ? DstackAppListResponseV20251028Schema : DstackAppListResponseV20260121Schema;
|
|
@@ -4629,9 +5506,9 @@ async function safeGetAppList(client, request) {
|
|
|
4629
5506
|
}
|
|
4630
5507
|
|
|
4631
5508
|
// src/actions/apps/get_app_info.ts
|
|
4632
|
-
var
|
|
4633
|
-
var GetAppInfoRequestSchema =
|
|
4634
|
-
appId:
|
|
5509
|
+
var import_zod63 = require("zod");
|
|
5510
|
+
var GetAppInfoRequestSchema = import_zod63.z.object({
|
|
5511
|
+
appId: import_zod63.z.string().min(1)
|
|
4635
5512
|
}).strict();
|
|
4636
5513
|
function getSchemaForVersion5(version) {
|
|
4637
5514
|
return version === "2025-10-28" ? DstackAppWithCvmResponseV20251028Schema : DstackAppWithCvmResponseV20260121Schema;
|
|
@@ -4661,12 +5538,12 @@ async function safeGetAppInfo(client, request) {
|
|
|
4661
5538
|
}
|
|
4662
5539
|
|
|
4663
5540
|
// src/actions/apps/get_app_cvms.ts
|
|
4664
|
-
var
|
|
4665
|
-
var GetAppCvmsRequestSchema =
|
|
4666
|
-
appId:
|
|
5541
|
+
var import_zod64 = require("zod");
|
|
5542
|
+
var GetAppCvmsRequestSchema = import_zod64.z.object({
|
|
5543
|
+
appId: import_zod64.z.string().min(1)
|
|
4667
5544
|
}).strict();
|
|
4668
5545
|
function getSchemaForVersion6(version) {
|
|
4669
|
-
return version === "2025-10-28" ?
|
|
5546
|
+
return version === "2025-10-28" ? import_zod64.z.array(CvmInfoV20251028Schema) : import_zod64.z.array(CvmInfoV20260121Schema);
|
|
4670
5547
|
}
|
|
4671
5548
|
async function getAppCvms(client, request) {
|
|
4672
5549
|
const { appId } = GetAppCvmsRequestSchema.parse(request);
|
|
@@ -4692,12 +5569,54 @@ async function safeGetAppCvms(client, request) {
|
|
|
4692
5569
|
}
|
|
4693
5570
|
}
|
|
4694
5571
|
|
|
5572
|
+
// src/actions/apps/get_app_device_allowlist.ts
|
|
5573
|
+
var import_zod65 = require("zod");
|
|
5574
|
+
var DeviceAllowlistItemSchema = import_zod65.z.object({
|
|
5575
|
+
device_id: import_zod65.z.string(),
|
|
5576
|
+
node_name: import_zod65.z.string().nullable(),
|
|
5577
|
+
cvm_ids: import_zod65.z.array(import_zod65.z.number()),
|
|
5578
|
+
allowed_onchain: import_zod65.z.boolean(),
|
|
5579
|
+
status: import_zod65.z.string()
|
|
5580
|
+
});
|
|
5581
|
+
var DeviceAllowlistResponseSchema = import_zod65.z.object({
|
|
5582
|
+
is_onchain_kms: import_zod65.z.boolean(),
|
|
5583
|
+
allow_any_device: import_zod65.z.boolean().nullable().optional(),
|
|
5584
|
+
chain_id: import_zod65.z.number().nullable().optional(),
|
|
5585
|
+
app_contract_address: import_zod65.z.string().nullable().optional(),
|
|
5586
|
+
devices: import_zod65.z.array(DeviceAllowlistItemSchema).optional().default([])
|
|
5587
|
+
});
|
|
5588
|
+
var GetAppDeviceAllowlistRequestSchema = import_zod65.z.object({
|
|
5589
|
+
appId: import_zod65.z.string().min(1)
|
|
5590
|
+
}).strict();
|
|
5591
|
+
async function getAppDeviceAllowlist(client, request) {
|
|
5592
|
+
const { appId } = GetAppDeviceAllowlistRequestSchema.parse(request);
|
|
5593
|
+
const response = await client.get(`/apps/${appId}/device-allowlist`);
|
|
5594
|
+
return DeviceAllowlistResponseSchema.parse(response);
|
|
5595
|
+
}
|
|
5596
|
+
async function safeGetAppDeviceAllowlist(client, request) {
|
|
5597
|
+
try {
|
|
5598
|
+
const data = await getAppDeviceAllowlist(client, request);
|
|
5599
|
+
return { success: true, data };
|
|
5600
|
+
} catch (error) {
|
|
5601
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
5602
|
+
return { success: false, error };
|
|
5603
|
+
}
|
|
5604
|
+
return {
|
|
5605
|
+
success: false,
|
|
5606
|
+
error: {
|
|
5607
|
+
name: "Error",
|
|
5608
|
+
message: error instanceof Error ? error.message : String(error)
|
|
5609
|
+
}
|
|
5610
|
+
};
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
|
|
4695
5614
|
// src/actions/apps/get_app_revisions.ts
|
|
4696
|
-
var
|
|
4697
|
-
var GetAppRevisionsRequestSchema =
|
|
4698
|
-
appId:
|
|
4699
|
-
page:
|
|
4700
|
-
page_size:
|
|
5615
|
+
var import_zod66 = require("zod");
|
|
5616
|
+
var GetAppRevisionsRequestSchema = import_zod66.z.object({
|
|
5617
|
+
appId: import_zod66.z.string().min(1),
|
|
5618
|
+
page: import_zod66.z.number().int().min(1).optional(),
|
|
5619
|
+
page_size: import_zod66.z.number().int().min(1).max(1e3).optional()
|
|
4701
5620
|
}).strict();
|
|
4702
5621
|
async function getAppRevisions(client, request) {
|
|
4703
5622
|
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
@@ -4723,11 +5642,11 @@ async function safeGetAppRevisions(client, request) {
|
|
|
4723
5642
|
}
|
|
4724
5643
|
|
|
4725
5644
|
// src/actions/apps/get_app_revision_detail.ts
|
|
4726
|
-
var
|
|
4727
|
-
var GetAppRevisionDetailRequestSchema =
|
|
4728
|
-
appId:
|
|
4729
|
-
revisionId:
|
|
4730
|
-
rawComposeFile:
|
|
5645
|
+
var import_zod67 = require("zod");
|
|
5646
|
+
var GetAppRevisionDetailRequestSchema = import_zod67.z.object({
|
|
5647
|
+
appId: import_zod67.z.string().min(1),
|
|
5648
|
+
revisionId: import_zod67.z.string().min(1),
|
|
5649
|
+
rawComposeFile: import_zod67.z.boolean().optional()
|
|
4731
5650
|
}).strict();
|
|
4732
5651
|
async function getAppRevisionDetail(client, request) {
|
|
4733
5652
|
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
@@ -4754,15 +5673,15 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
4754
5673
|
}
|
|
4755
5674
|
|
|
4756
5675
|
// src/actions/apps/get_app_filter_options.ts
|
|
4757
|
-
var
|
|
4758
|
-
var AppFilterOptionsSchema =
|
|
4759
|
-
statuses:
|
|
4760
|
-
image_versions:
|
|
4761
|
-
instance_types:
|
|
4762
|
-
kms_slugs:
|
|
4763
|
-
kms_types:
|
|
4764
|
-
regions:
|
|
4765
|
-
nodes:
|
|
5676
|
+
var import_zod68 = require("zod");
|
|
5677
|
+
var AppFilterOptionsSchema = import_zod68.z.object({
|
|
5678
|
+
statuses: import_zod68.z.array(import_zod68.z.string()),
|
|
5679
|
+
image_versions: import_zod68.z.array(import_zod68.z.string()),
|
|
5680
|
+
instance_types: import_zod68.z.array(import_zod68.z.string()),
|
|
5681
|
+
kms_slugs: import_zod68.z.array(import_zod68.z.string()),
|
|
5682
|
+
kms_types: import_zod68.z.array(import_zod68.z.string()),
|
|
5683
|
+
regions: import_zod68.z.array(import_zod68.z.string()),
|
|
5684
|
+
nodes: import_zod68.z.array(import_zod68.z.string())
|
|
4766
5685
|
});
|
|
4767
5686
|
async function getAppFilterOptions(client) {
|
|
4768
5687
|
const response = await client.get("/apps/filter-options");
|
|
@@ -4786,6 +5705,54 @@ async function safeGetAppFilterOptions(client) {
|
|
|
4786
5705
|
}
|
|
4787
5706
|
}
|
|
4788
5707
|
|
|
5708
|
+
// src/actions/apps/get_app_attestation.ts
|
|
5709
|
+
var import_zod69 = require("zod");
|
|
5710
|
+
var KmsInfoSchema2 = import_zod69.z.object({
|
|
5711
|
+
contract_address: import_zod69.z.string(),
|
|
5712
|
+
chain_id: import_zod69.z.string().nullable(),
|
|
5713
|
+
version: import_zod69.z.string(),
|
|
5714
|
+
url: import_zod69.z.string(),
|
|
5715
|
+
gateway_app_id: import_zod69.z.string().nullable(),
|
|
5716
|
+
gateway_app_url: import_zod69.z.string(),
|
|
5717
|
+
kms_type: import_zod69.z.string()
|
|
5718
|
+
});
|
|
5719
|
+
var GuestAgentInfoSchema = import_zod69.z.object({
|
|
5720
|
+
app_id: import_zod69.z.string().optional(),
|
|
5721
|
+
instance_id: import_zod69.z.string().optional(),
|
|
5722
|
+
app_name: import_zod69.z.string().optional(),
|
|
5723
|
+
device_id: import_zod69.z.string().optional()
|
|
5724
|
+
}).passthrough().nullable();
|
|
5725
|
+
var AppAttestationInstanceSchema = import_zod69.z.object({
|
|
5726
|
+
vm_uuid: import_zod69.z.string().nullable().optional(),
|
|
5727
|
+
name: import_zod69.z.string().optional(),
|
|
5728
|
+
instance_id: import_zod69.z.string().nullable().optional(),
|
|
5729
|
+
status: import_zod69.z.string().optional(),
|
|
5730
|
+
image_version: import_zod69.z.string().nullable().optional(),
|
|
5731
|
+
quote: import_zod69.z.string().nullable().optional(),
|
|
5732
|
+
ppid: import_zod69.z.string().optional(),
|
|
5733
|
+
device_id: import_zod69.z.string().optional(),
|
|
5734
|
+
tcb_info: TcbInfoSchema.nullable().optional(),
|
|
5735
|
+
app_certificates: import_zod69.z.array(CertificateSchema).nullable().optional(),
|
|
5736
|
+
compose_file: import_zod69.z.string().nullable().optional(),
|
|
5737
|
+
error: import_zod69.z.string().nullable().optional()
|
|
5738
|
+
});
|
|
5739
|
+
var AppAttestationResponseSchema = import_zod69.z.object({
|
|
5740
|
+
app_id: import_zod69.z.string(),
|
|
5741
|
+
contract_address: import_zod69.z.string(),
|
|
5742
|
+
kms_info: KmsInfoSchema2,
|
|
5743
|
+
instances: import_zod69.z.array(AppAttestationInstanceSchema),
|
|
5744
|
+
kms_guest_agent_info: GuestAgentInfoSchema,
|
|
5745
|
+
gateway_guest_agent_info: GuestAgentInfoSchema,
|
|
5746
|
+
qemu_version: import_zod69.z.string().nullable()
|
|
5747
|
+
});
|
|
5748
|
+
var GetAppAttestationRequestSchema = import_zod69.z.object({
|
|
5749
|
+
appId: import_zod69.z.string().min(1)
|
|
5750
|
+
}).strict();
|
|
5751
|
+
var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAction(AppAttestationResponseSchema, async (client, request) => {
|
|
5752
|
+
const { appId } = GetAppAttestationRequestSchema.parse(request);
|
|
5753
|
+
return await client.get(`/apps/${appId}/attestations`);
|
|
5754
|
+
});
|
|
5755
|
+
|
|
4789
5756
|
// src/parse_dotenv.ts
|
|
4790
5757
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
4791
5758
|
function parseEnv(input) {
|
|
@@ -4824,8 +5791,11 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4824
5791
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4825
5792
|
0 && (module.exports = {
|
|
4826
5793
|
AddComposeHashSchema,
|
|
5794
|
+
AddDeviceSchema,
|
|
4827
5795
|
AllFamiliesResponseSchema,
|
|
4828
5796
|
ApiErrorSchema,
|
|
5797
|
+
AppAttestationInstanceSchema,
|
|
5798
|
+
AppAttestationResponseSchema,
|
|
4829
5799
|
AppFilterOptionsSchema,
|
|
4830
5800
|
AppProfileSchema,
|
|
4831
5801
|
AppRevisionDetailResponseSchema,
|
|
@@ -4836,6 +5806,9 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4836
5806
|
AvailableNodesSchema,
|
|
4837
5807
|
BillingPeriodSchema,
|
|
4838
5808
|
BusinessError,
|
|
5809
|
+
CertificateIssuerSchema,
|
|
5810
|
+
CertificateSchema,
|
|
5811
|
+
CertificateSubjectSchema,
|
|
4839
5812
|
CommitCvmComposeFileUpdateRequestSchema,
|
|
4840
5813
|
CommitCvmComposeFileUpdateSchema,
|
|
4841
5814
|
CommitCvmProvisionRequestSchema,
|
|
@@ -4881,9 +5854,13 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4881
5854
|
DstackAppMinimalResponseV20260121Schema,
|
|
4882
5855
|
DstackAppWithCvmResponseV20251028Schema,
|
|
4883
5856
|
DstackAppWithCvmResponseV20260121Schema,
|
|
5857
|
+
EventLogSchema,
|
|
4884
5858
|
FamilyGroupSchema,
|
|
4885
5859
|
FamilyInstanceTypesResponseSchema,
|
|
5860
|
+
GetAllowedDevicesSchema,
|
|
5861
|
+
GetAppAttestationRequestSchema,
|
|
4886
5862
|
GetAppCvmsRequestSchema,
|
|
5863
|
+
GetAppDeviceAllowlistRequestSchema,
|
|
4887
5864
|
GetAppEnvEncryptPubKeyRequestSchema,
|
|
4888
5865
|
GetAppEnvEncryptPubKeySchema,
|
|
4889
5866
|
GetAppInfoRequestSchema,
|
|
@@ -4908,10 +5885,15 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4908
5885
|
GetKmsInfoRequestSchema,
|
|
4909
5886
|
GetKmsListRequestSchema,
|
|
4910
5887
|
GetKmsListSchema,
|
|
5888
|
+
GetKmsOnChainDetailRequestSchema,
|
|
5889
|
+
GetKmsOnChainDetailResponseSchema,
|
|
5890
|
+
GetOsImagesRequestSchema,
|
|
5891
|
+
GetOsImagesResponseSchema,
|
|
4911
5892
|
GetWorkspaceNodesSchema,
|
|
4912
5893
|
GetWorkspaceQuotasSchema,
|
|
4913
5894
|
ImportGithubProfileRequestSchema,
|
|
4914
5895
|
ImportGithubProfileResponseSchema,
|
|
5896
|
+
InstanceIdRefreshResultSchema,
|
|
4915
5897
|
InstanceTypeSchema,
|
|
4916
5898
|
KmsInfoSchema,
|
|
4917
5899
|
KmsTypeSchema,
|
|
@@ -4928,7 +5910,11 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4928
5910
|
NextAppIdsSchema,
|
|
4929
5911
|
NodeInfoSchema,
|
|
4930
5912
|
NodeRefSchema,
|
|
5913
|
+
OSImagePublicSchema,
|
|
4931
5914
|
OSImageVariantSchema,
|
|
5915
|
+
OnChainDeviceSchema,
|
|
5916
|
+
OnChainKmsContractSchema,
|
|
5917
|
+
OnChainOsImageSchema,
|
|
4932
5918
|
PaginatedCvmInfosV20251028Schema,
|
|
4933
5919
|
PaginatedCvmInfosV20260121Schema,
|
|
4934
5920
|
PaginationMetadataSchema,
|
|
@@ -4938,17 +5924,24 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4938
5924
|
ProvisionCvmRequestSchema,
|
|
4939
5925
|
ProvisionCvmSchema,
|
|
4940
5926
|
QuotaMetricSchema,
|
|
5927
|
+
RefreshCvmInstanceIdRequestSchema,
|
|
5928
|
+
RefreshCvmInstanceIdsRequestSchema,
|
|
5929
|
+
RefreshCvmInstanceIdsResponseSchema,
|
|
5930
|
+
RemoveDeviceSchema,
|
|
5931
|
+
ReplicateCvmRequestSchema,
|
|
4941
5932
|
RequestError,
|
|
4942
5933
|
ResourceError,
|
|
4943
5934
|
RestartCvmRequestSchema,
|
|
4944
5935
|
SUPPORTED_API_VERSIONS,
|
|
4945
5936
|
SUPPORTED_CHAINS,
|
|
4946
5937
|
ServerError,
|
|
5938
|
+
SetAllowAnyDeviceSchema,
|
|
4947
5939
|
ShutdownCvmRequestSchema,
|
|
4948
5940
|
SshKeySchema,
|
|
4949
5941
|
StartCvmRequestSchema,
|
|
4950
5942
|
StopCvmRequestSchema,
|
|
4951
5943
|
SyncGithubSshKeysResponseSchema,
|
|
5944
|
+
TcbInfoSchema,
|
|
4952
5945
|
TransactionError,
|
|
4953
5946
|
UnknownError,
|
|
4954
5947
|
UpdateCvmEnvsRequestSchema,
|
|
@@ -4974,10 +5967,12 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4974
5967
|
WorkspaceReservedGpuQuotaSchema,
|
|
4975
5968
|
WorkspaceResponseSchema,
|
|
4976
5969
|
addComposeHash,
|
|
5970
|
+
addDevice,
|
|
4977
5971
|
addNetwork,
|
|
4978
5972
|
asHex,
|
|
4979
5973
|
autoCreateClients,
|
|
4980
5974
|
checkBalance,
|
|
5975
|
+
checkDeviceAllowed,
|
|
4981
5976
|
checkNetworkStatus,
|
|
4982
5977
|
commitCvmComposeFileUpdate,
|
|
4983
5978
|
commitCvmProvision,
|
|
@@ -4994,6 +5989,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4994
5989
|
deleteCvm,
|
|
4995
5990
|
deleteSshKey,
|
|
4996
5991
|
deployAppAuth,
|
|
5992
|
+
dstackAppAbi,
|
|
4997
5993
|
dumpAppCompose,
|
|
4998
5994
|
encryptEnvVars,
|
|
4999
5995
|
estimateTransactionGas,
|
|
@@ -5006,7 +6002,10 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
5006
6002
|
formatValidationErrors,
|
|
5007
6003
|
generateDefaultCvmName,
|
|
5008
6004
|
generateFallbackHostname,
|
|
6005
|
+
getAllowedDevices,
|
|
6006
|
+
getAppAttestation,
|
|
5009
6007
|
getAppCvms,
|
|
6008
|
+
getAppDeviceAllowlist,
|
|
5010
6009
|
getAppEnvEncryptPubKey,
|
|
5011
6010
|
getAppFilterOptions,
|
|
5012
6011
|
getAppInfo,
|
|
@@ -5032,6 +6031,8 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
5032
6031
|
getErrorMessage,
|
|
5033
6032
|
getKmsInfo,
|
|
5034
6033
|
getKmsList,
|
|
6034
|
+
getKmsOnChainDetail,
|
|
6035
|
+
getOsImages,
|
|
5035
6036
|
getValidationFields,
|
|
5036
6037
|
getWorkspace,
|
|
5037
6038
|
getWorkspaceNodes,
|
|
@@ -5050,15 +6051,24 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
5050
6051
|
provisionCvm,
|
|
5051
6052
|
provisionCvmComposeFileUpdate,
|
|
5052
6053
|
refineCvmId,
|
|
6054
|
+
refreshCvmInstanceId,
|
|
6055
|
+
refreshCvmInstanceIds,
|
|
6056
|
+
removeDevice,
|
|
6057
|
+
replicateCvm,
|
|
5053
6058
|
restartCvm,
|
|
5054
6059
|
safeAddComposeHash,
|
|
6060
|
+
safeAddDevice,
|
|
6061
|
+
safeCheckDeviceAllowed,
|
|
5055
6062
|
safeCommitCvmComposeFileUpdate,
|
|
5056
6063
|
safeCommitCvmProvision,
|
|
5057
6064
|
safeCreateSshKey,
|
|
5058
6065
|
safeDeleteCvm,
|
|
5059
6066
|
safeDeleteSshKey,
|
|
5060
6067
|
safeDeployAppAuth,
|
|
6068
|
+
safeGetAllowedDevices,
|
|
6069
|
+
safeGetAppAttestation,
|
|
5061
6070
|
safeGetAppCvms,
|
|
6071
|
+
safeGetAppDeviceAllowlist,
|
|
5062
6072
|
safeGetAppEnvEncryptPubKey,
|
|
5063
6073
|
safeGetAppFilterOptions,
|
|
5064
6074
|
safeGetAppInfo,
|
|
@@ -5082,6 +6092,8 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
5082
6092
|
safeGetCvmUserConfig,
|
|
5083
6093
|
safeGetKmsInfo,
|
|
5084
6094
|
safeGetKmsList,
|
|
6095
|
+
safeGetKmsOnChainDetail,
|
|
6096
|
+
safeGetOsImages,
|
|
5085
6097
|
safeGetWorkspace,
|
|
5086
6098
|
safeGetWorkspaceNodes,
|
|
5087
6099
|
safeGetWorkspaceQuotas,
|
|
@@ -5093,7 +6105,12 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
5093
6105
|
safeNextAppIds,
|
|
5094
6106
|
safeProvisionCvm,
|
|
5095
6107
|
safeProvisionCvmComposeFileUpdate,
|
|
6108
|
+
safeRefreshCvmInstanceId,
|
|
6109
|
+
safeRefreshCvmInstanceIds,
|
|
6110
|
+
safeRemoveDevice,
|
|
6111
|
+
safeReplicateCvm,
|
|
5096
6112
|
safeRestartCvm,
|
|
6113
|
+
safeSetAllowAnyDevice,
|
|
5097
6114
|
safeShutdownCvm,
|
|
5098
6115
|
safeStartCvm,
|
|
5099
6116
|
safeStopCvm,
|
|
@@ -5105,6 +6122,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
5105
6122
|
safeUpdateOsImage,
|
|
5106
6123
|
safeUpdatePreLaunchScript,
|
|
5107
6124
|
safeValidateActionParameters,
|
|
6125
|
+
setAllowAnyDevice,
|
|
5108
6126
|
shutdownCvm,
|
|
5109
6127
|
sortObject,
|
|
5110
6128
|
startCvm,
|