@phala/cloud 0.2.3 → 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/get_cvm_user_config.d.ts +92 -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 +20 -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/ssh_keys/create_ssh_key.d.ts +104 -0
- package/dist/actions/ssh_keys/delete_ssh_key.d.ts +65 -0
- package/dist/actions/ssh_keys/import_github_profile.d.ts +93 -0
- package/dist/actions/ssh_keys/list_ssh_keys.d.ts +101 -0
- package/dist/actions/ssh_keys/sync_github_ssh_keys.d.ts +78 -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 +106 -0
- package/dist/index.js +1500 -322
- package/dist/index.mjs +1441 -320
- 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,10 +46,14 @@ __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,
|
|
49
55
|
CommitCvmProvisionSchema: () => CommitCvmProvisionSchema,
|
|
56
|
+
CreateSshKeyRequestSchema: () => CreateSshKeyRequestSchema,
|
|
50
57
|
CreditsInfoSchema: () => CreditsInfoSchema,
|
|
51
58
|
CurrentUserSchema: () => CurrentUserV20251028Schema,
|
|
52
59
|
CurrentUserV20251028Schema: () => CurrentUserV20251028Schema,
|
|
@@ -74,7 +81,9 @@ __export(index_exports, {
|
|
|
74
81
|
CvmStateSchema: () => CvmStateSchema,
|
|
75
82
|
CvmStatusSchema: () => CvmStatusSchema,
|
|
76
83
|
CvmSystemInfoSchema: () => CvmSystemInfoSchema,
|
|
84
|
+
CvmUserConfigSchema: () => CvmUserConfigSchema,
|
|
77
85
|
DeleteCvmRequestSchema: () => DeleteCvmRequestSchema,
|
|
86
|
+
DeleteSshKeyRequestSchema: () => DeleteSshKeyRequestSchema,
|
|
78
87
|
DeployAppAuthRequestSchema: () => DeployAppAuthRequestSchema,
|
|
79
88
|
DeployAppAuthSchema: () => DeployAppAuthSchema,
|
|
80
89
|
DstackAppFullResponseV20251028Schema: () => DstackAppFullResponseV20251028Schema,
|
|
@@ -85,9 +94,13 @@ __export(index_exports, {
|
|
|
85
94
|
DstackAppMinimalResponseV20260121Schema: () => DstackAppMinimalResponseV20260121Schema,
|
|
86
95
|
DstackAppWithCvmResponseV20251028Schema: () => DstackAppWithCvmResponseV20251028Schema,
|
|
87
96
|
DstackAppWithCvmResponseV20260121Schema: () => DstackAppWithCvmResponseV20260121Schema,
|
|
97
|
+
EventLogSchema: () => EventLogSchema,
|
|
88
98
|
FamilyGroupSchema: () => FamilyGroupSchema,
|
|
89
99
|
FamilyInstanceTypesResponseSchema: () => FamilyInstanceTypesResponseSchema,
|
|
100
|
+
GetAllowedDevicesSchema: () => GetAllowedDevicesSchema,
|
|
101
|
+
GetAppAttestationRequestSchema: () => GetAppAttestationRequestSchema,
|
|
90
102
|
GetAppCvmsRequestSchema: () => GetAppCvmsRequestSchema,
|
|
103
|
+
GetAppDeviceAllowlistRequestSchema: () => GetAppDeviceAllowlistRequestSchema,
|
|
91
104
|
GetAppEnvEncryptPubKeyRequestSchema: () => GetAppEnvEncryptPubKeyRequestSchema,
|
|
92
105
|
GetAppEnvEncryptPubKeySchema: () => GetAppEnvEncryptPubKeySchema,
|
|
93
106
|
GetAppInfoRequestSchema: () => GetAppInfoRequestSchema,
|
|
@@ -108,15 +121,24 @@ __export(index_exports, {
|
|
|
108
121
|
GetCvmStatsRequestSchema: () => GetCvmStatsRequestSchema,
|
|
109
122
|
GetCvmStatusBatchRequestSchema: () => GetCvmStatusBatchRequestSchema,
|
|
110
123
|
GetCvmStatusBatchResponseSchema: () => GetCvmStatusBatchResponseSchema,
|
|
124
|
+
GetCvmUserConfigRequestSchema: () => GetCvmUserConfigRequestSchema,
|
|
111
125
|
GetKmsInfoRequestSchema: () => GetKmsInfoRequestSchema,
|
|
112
126
|
GetKmsListRequestSchema: () => GetKmsListRequestSchema,
|
|
113
127
|
GetKmsListSchema: () => GetKmsListSchema,
|
|
128
|
+
GetKmsOnChainDetailRequestSchema: () => GetKmsOnChainDetailRequestSchema,
|
|
129
|
+
GetKmsOnChainDetailResponseSchema: () => GetKmsOnChainDetailResponseSchema,
|
|
130
|
+
GetOsImagesRequestSchema: () => GetOsImagesRequestSchema,
|
|
131
|
+
GetOsImagesResponseSchema: () => GetOsImagesResponseSchema,
|
|
114
132
|
GetWorkspaceNodesSchema: () => GetWorkspaceNodesSchema,
|
|
115
133
|
GetWorkspaceQuotasSchema: () => GetWorkspaceQuotasSchema,
|
|
134
|
+
ImportGithubProfileRequestSchema: () => ImportGithubProfileRequestSchema,
|
|
135
|
+
ImportGithubProfileResponseSchema: () => ImportGithubProfileResponseSchema,
|
|
136
|
+
InstanceIdRefreshResultSchema: () => InstanceIdRefreshResultSchema,
|
|
116
137
|
InstanceTypeSchema: () => InstanceTypeSchema,
|
|
117
138
|
KmsInfoSchema: () => KmsInfoSchema,
|
|
118
139
|
KmsTypeSchema: () => KmsTypeSchema,
|
|
119
140
|
ListFamilyInstanceTypesRequestSchema: () => ListFamilyInstanceTypesRequestSchema,
|
|
141
|
+
ListSshKeysResponseSchema: () => ListSshKeysResponseSchema,
|
|
120
142
|
ListWorkspacesSchema: () => ListWorkspacesSchema,
|
|
121
143
|
LooseAppComposeSchema: () => LooseAppComposeSchema,
|
|
122
144
|
MAX_COMPOSE_PAYLOAD_BYTES: () => MAX_COMPOSE_PAYLOAD_BYTES,
|
|
@@ -128,7 +150,11 @@ __export(index_exports, {
|
|
|
128
150
|
NextAppIdsSchema: () => NextAppIdsSchema,
|
|
129
151
|
NodeInfoSchema: () => NodeInfoSchema,
|
|
130
152
|
NodeRefSchema: () => NodeRefSchema,
|
|
153
|
+
OSImagePublicSchema: () => OSImagePublicSchema,
|
|
131
154
|
OSImageVariantSchema: () => OSImageVariantSchema,
|
|
155
|
+
OnChainDeviceSchema: () => OnChainDeviceSchema,
|
|
156
|
+
OnChainKmsContractSchema: () => OnChainKmsContractSchema,
|
|
157
|
+
OnChainOsImageSchema: () => OnChainOsImageSchema,
|
|
132
158
|
PaginatedCvmInfosV20251028Schema: () => PaginatedCvmInfosV20251028Schema,
|
|
133
159
|
PaginatedCvmInfosV20260121Schema: () => PaginatedCvmInfosV20260121Schema,
|
|
134
160
|
PaginationMetadataSchema: () => PaginationMetadataSchema,
|
|
@@ -138,15 +164,24 @@ __export(index_exports, {
|
|
|
138
164
|
ProvisionCvmRequestSchema: () => ProvisionCvmRequestSchema,
|
|
139
165
|
ProvisionCvmSchema: () => ProvisionCvmSchema,
|
|
140
166
|
QuotaMetricSchema: () => QuotaMetricSchema,
|
|
167
|
+
RefreshCvmInstanceIdRequestSchema: () => RefreshCvmInstanceIdRequestSchema,
|
|
168
|
+
RefreshCvmInstanceIdsRequestSchema: () => RefreshCvmInstanceIdsRequestSchema,
|
|
169
|
+
RefreshCvmInstanceIdsResponseSchema: () => RefreshCvmInstanceIdsResponseSchema,
|
|
170
|
+
RemoveDeviceSchema: () => RemoveDeviceSchema,
|
|
171
|
+
ReplicateCvmRequestSchema: () => ReplicateCvmRequestSchema,
|
|
141
172
|
RequestError: () => RequestError,
|
|
142
173
|
ResourceError: () => ResourceError,
|
|
143
174
|
RestartCvmRequestSchema: () => RestartCvmRequestSchema,
|
|
144
175
|
SUPPORTED_API_VERSIONS: () => SUPPORTED_API_VERSIONS,
|
|
145
176
|
SUPPORTED_CHAINS: () => SUPPORTED_CHAINS,
|
|
146
177
|
ServerError: () => ServerError,
|
|
178
|
+
SetAllowAnyDeviceSchema: () => SetAllowAnyDeviceSchema,
|
|
147
179
|
ShutdownCvmRequestSchema: () => ShutdownCvmRequestSchema,
|
|
180
|
+
SshKeySchema: () => SshKeySchema,
|
|
148
181
|
StartCvmRequestSchema: () => StartCvmRequestSchema,
|
|
149
182
|
StopCvmRequestSchema: () => StopCvmRequestSchema,
|
|
183
|
+
SyncGithubSshKeysResponseSchema: () => SyncGithubSshKeysResponseSchema,
|
|
184
|
+
TcbInfoSchema: () => TcbInfoSchema,
|
|
150
185
|
TransactionError: () => TransactionError,
|
|
151
186
|
UnknownError: () => UnknownError,
|
|
152
187
|
UpdateCvmEnvsRequestSchema: () => UpdateCvmEnvsRequestSchema,
|
|
@@ -172,10 +207,12 @@ __export(index_exports, {
|
|
|
172
207
|
WorkspaceReservedGpuQuotaSchema: () => WorkspaceReservedGpuQuotaSchema,
|
|
173
208
|
WorkspaceResponseSchema: () => WorkspaceResponseSchema,
|
|
174
209
|
addComposeHash: () => addComposeHash,
|
|
210
|
+
addDevice: () => addDevice,
|
|
175
211
|
addNetwork: () => addNetwork,
|
|
176
212
|
asHex: () => asHex,
|
|
177
213
|
autoCreateClients: () => autoCreateClients,
|
|
178
214
|
checkBalance: () => checkBalance,
|
|
215
|
+
checkDeviceAllowed: () => checkDeviceAllowed,
|
|
179
216
|
checkNetworkStatus: () => checkNetworkStatus,
|
|
180
217
|
commitCvmComposeFileUpdate: () => commitCvmComposeFileUpdate,
|
|
181
218
|
commitCvmProvision: () => commitCvmProvision,
|
|
@@ -185,11 +222,14 @@ __export(index_exports, {
|
|
|
185
222
|
createClientsFromBrowser: () => createClientsFromBrowser,
|
|
186
223
|
createClientsFromPrivateKey: () => createClientsFromPrivateKey,
|
|
187
224
|
createNetworkClients: () => createNetworkClients,
|
|
225
|
+
createSshKey: () => createSshKey,
|
|
188
226
|
createTransactionTracker: () => createTransactionTracker,
|
|
189
227
|
defineAction: () => defineAction,
|
|
190
228
|
defineSimpleAction: () => defineSimpleAction,
|
|
191
229
|
deleteCvm: () => deleteCvm,
|
|
230
|
+
deleteSshKey: () => deleteSshKey,
|
|
192
231
|
deployAppAuth: () => deployAppAuth,
|
|
232
|
+
dstackAppAbi: () => dstackAppAbi,
|
|
193
233
|
dumpAppCompose: () => dumpAppCompose,
|
|
194
234
|
encryptEnvVars: () => import_encrypt_env_vars2.encryptEnvVars,
|
|
195
235
|
estimateTransactionGas: () => estimateTransactionGas,
|
|
@@ -202,7 +242,10 @@ __export(index_exports, {
|
|
|
202
242
|
formatValidationErrors: () => formatValidationErrors,
|
|
203
243
|
generateDefaultCvmName: () => generateDefaultCvmName,
|
|
204
244
|
generateFallbackHostname: () => generateFallbackHostname,
|
|
245
|
+
getAllowedDevices: () => getAllowedDevices,
|
|
246
|
+
getAppAttestation: () => getAppAttestation,
|
|
205
247
|
getAppCvms: () => getAppCvms,
|
|
248
|
+
getAppDeviceAllowlist: () => getAppDeviceAllowlist,
|
|
206
249
|
getAppEnvEncryptPubKey: () => getAppEnvEncryptPubKey,
|
|
207
250
|
getAppFilterOptions: () => getAppFilterOptions,
|
|
208
251
|
getAppInfo: () => getAppInfo,
|
|
@@ -224,16 +267,21 @@ __export(index_exports, {
|
|
|
224
267
|
getCvmState: () => getCvmState,
|
|
225
268
|
getCvmStats: () => getCvmStats,
|
|
226
269
|
getCvmStatusBatch: () => getCvmStatusBatch,
|
|
270
|
+
getCvmUserConfig: () => getCvmUserConfig,
|
|
227
271
|
getErrorMessage: () => getErrorMessage,
|
|
228
272
|
getKmsInfo: () => getKmsInfo,
|
|
229
273
|
getKmsList: () => getKmsList,
|
|
274
|
+
getKmsOnChainDetail: () => getKmsOnChainDetail,
|
|
275
|
+
getOsImages: () => getOsImages,
|
|
230
276
|
getValidationFields: () => getValidationFields,
|
|
231
277
|
getWorkspace: () => getWorkspace,
|
|
232
278
|
getWorkspaceNodes: () => getWorkspaceNodes,
|
|
233
279
|
getWorkspaceQuotas: () => getWorkspaceQuotas,
|
|
280
|
+
importGithubProfileSshKeys: () => importGithubProfileSshKeys,
|
|
234
281
|
isValidHostname: () => isValidHostname,
|
|
235
282
|
listAllInstanceTypeFamilies: () => listAllInstanceTypeFamilies,
|
|
236
283
|
listFamilyInstanceTypes: () => listFamilyInstanceTypes,
|
|
284
|
+
listSshKeys: () => listSshKeys,
|
|
237
285
|
listWorkspaces: () => listWorkspaces,
|
|
238
286
|
nextAppIds: () => nextAppIds,
|
|
239
287
|
parseApiError: () => parseApiError,
|
|
@@ -243,13 +291,24 @@ __export(index_exports, {
|
|
|
243
291
|
provisionCvm: () => provisionCvm,
|
|
244
292
|
provisionCvmComposeFileUpdate: () => provisionCvmComposeFileUpdate,
|
|
245
293
|
refineCvmId: () => refineCvmId,
|
|
294
|
+
refreshCvmInstanceId: () => refreshCvmInstanceId,
|
|
295
|
+
refreshCvmInstanceIds: () => refreshCvmInstanceIds,
|
|
296
|
+
removeDevice: () => removeDevice,
|
|
297
|
+
replicateCvm: () => replicateCvm,
|
|
246
298
|
restartCvm: () => restartCvm,
|
|
247
299
|
safeAddComposeHash: () => safeAddComposeHash,
|
|
300
|
+
safeAddDevice: () => safeAddDevice,
|
|
301
|
+
safeCheckDeviceAllowed: () => safeCheckDeviceAllowed,
|
|
248
302
|
safeCommitCvmComposeFileUpdate: () => safeCommitCvmComposeFileUpdate,
|
|
249
303
|
safeCommitCvmProvision: () => safeCommitCvmProvision,
|
|
304
|
+
safeCreateSshKey: () => safeCreateSshKey,
|
|
250
305
|
safeDeleteCvm: () => safeDeleteCvm,
|
|
306
|
+
safeDeleteSshKey: () => safeDeleteSshKey,
|
|
251
307
|
safeDeployAppAuth: () => safeDeployAppAuth,
|
|
308
|
+
safeGetAllowedDevices: () => safeGetAllowedDevices,
|
|
309
|
+
safeGetAppAttestation: () => safeGetAppAttestation,
|
|
252
310
|
safeGetAppCvms: () => safeGetAppCvms,
|
|
311
|
+
safeGetAppDeviceAllowlist: () => safeGetAppDeviceAllowlist,
|
|
253
312
|
safeGetAppEnvEncryptPubKey: () => safeGetAppEnvEncryptPubKey,
|
|
254
313
|
safeGetAppFilterOptions: () => safeGetAppFilterOptions,
|
|
255
314
|
safeGetAppInfo: () => safeGetAppInfo,
|
|
@@ -270,21 +329,32 @@ __export(index_exports, {
|
|
|
270
329
|
safeGetCvmState: () => safeGetCvmState,
|
|
271
330
|
safeGetCvmStats: () => safeGetCvmStats,
|
|
272
331
|
safeGetCvmStatusBatch: () => safeGetCvmStatusBatch,
|
|
332
|
+
safeGetCvmUserConfig: () => safeGetCvmUserConfig,
|
|
273
333
|
safeGetKmsInfo: () => safeGetKmsInfo,
|
|
274
334
|
safeGetKmsList: () => safeGetKmsList,
|
|
335
|
+
safeGetKmsOnChainDetail: () => safeGetKmsOnChainDetail,
|
|
336
|
+
safeGetOsImages: () => safeGetOsImages,
|
|
275
337
|
safeGetWorkspace: () => safeGetWorkspace,
|
|
276
338
|
safeGetWorkspaceNodes: () => safeGetWorkspaceNodes,
|
|
277
339
|
safeGetWorkspaceQuotas: () => safeGetWorkspaceQuotas,
|
|
340
|
+
safeImportGithubProfileSshKeys: () => safeImportGithubProfileSshKeys,
|
|
278
341
|
safeListAllInstanceTypeFamilies: () => safeListAllInstanceTypeFamilies,
|
|
279
342
|
safeListFamilyInstanceTypes: () => safeListFamilyInstanceTypes,
|
|
343
|
+
safeListSshKeys: () => safeListSshKeys,
|
|
280
344
|
safeListWorkspaces: () => safeListWorkspaces,
|
|
281
345
|
safeNextAppIds: () => safeNextAppIds,
|
|
282
346
|
safeProvisionCvm: () => safeProvisionCvm,
|
|
283
347
|
safeProvisionCvmComposeFileUpdate: () => safeProvisionCvmComposeFileUpdate,
|
|
348
|
+
safeRefreshCvmInstanceId: () => safeRefreshCvmInstanceId,
|
|
349
|
+
safeRefreshCvmInstanceIds: () => safeRefreshCvmInstanceIds,
|
|
350
|
+
safeRemoveDevice: () => safeRemoveDevice,
|
|
351
|
+
safeReplicateCvm: () => safeReplicateCvm,
|
|
284
352
|
safeRestartCvm: () => safeRestartCvm,
|
|
353
|
+
safeSetAllowAnyDevice: () => safeSetAllowAnyDevice,
|
|
285
354
|
safeShutdownCvm: () => safeShutdownCvm,
|
|
286
355
|
safeStartCvm: () => safeStartCvm,
|
|
287
356
|
safeStopCvm: () => safeStopCvm,
|
|
357
|
+
safeSyncGithubSshKeys: () => safeSyncGithubSshKeys,
|
|
288
358
|
safeUpdateCvmEnvs: () => safeUpdateCvmEnvs,
|
|
289
359
|
safeUpdateCvmResources: () => safeUpdateCvmResources,
|
|
290
360
|
safeUpdateCvmVisibility: () => safeUpdateCvmVisibility,
|
|
@@ -292,11 +362,13 @@ __export(index_exports, {
|
|
|
292
362
|
safeUpdateOsImage: () => safeUpdateOsImage,
|
|
293
363
|
safeUpdatePreLaunchScript: () => safeUpdatePreLaunchScript,
|
|
294
364
|
safeValidateActionParameters: () => safeValidateActionParameters,
|
|
365
|
+
setAllowAnyDevice: () => setAllowAnyDevice,
|
|
295
366
|
shutdownCvm: () => shutdownCvm,
|
|
296
367
|
sortObject: () => sortObject,
|
|
297
368
|
startCvm: () => startCvm,
|
|
298
369
|
stopCvm: () => stopCvm,
|
|
299
370
|
switchToNetwork: () => switchToNetwork,
|
|
371
|
+
syncGithubSshKeys: () => syncGithubSshKeys,
|
|
300
372
|
updateCvmEnvs: () => updateCvmEnvs,
|
|
301
373
|
updateCvmResources: () => updateCvmResources,
|
|
302
374
|
updateCvmVisibility: () => updateCvmVisibility,
|
|
@@ -1381,7 +1453,8 @@ var WorkspaceResponseSchema = import_zod7.z.object({
|
|
|
1381
1453
|
tier: import_zod7.z.string(),
|
|
1382
1454
|
role: import_zod7.z.string(),
|
|
1383
1455
|
is_default: import_zod7.z.boolean(),
|
|
1384
|
-
created_at: import_zod7.z.string()
|
|
1456
|
+
created_at: import_zod7.z.string(),
|
|
1457
|
+
confidential_models_enabled: import_zod7.z.boolean().optional()
|
|
1385
1458
|
}).passthrough();
|
|
1386
1459
|
var PaginationMetadataSchema = import_zod7.z.object({
|
|
1387
1460
|
has_more: import_zod7.z.boolean(),
|
|
@@ -1570,6 +1643,7 @@ var CvmInfoV20260121Schema = import_zod9.z.object({
|
|
|
1570
1643
|
name: import_zod9.z.string(),
|
|
1571
1644
|
app_id: import_zod9.z.string().nullable().optional(),
|
|
1572
1645
|
vm_uuid: import_zod9.z.string().nullable().optional(),
|
|
1646
|
+
instance_id: import_zod9.z.string().nullable().optional(),
|
|
1573
1647
|
resource: CvmResourceInfoV20260121Schema,
|
|
1574
1648
|
node_info: NodeRefSchema.nullable().optional(),
|
|
1575
1649
|
os: CvmOsInfoV20260121Schema.nullable().optional(),
|
|
@@ -1586,6 +1660,7 @@ var CvmInfoV20260121Schema = import_zod9.z.object({
|
|
|
1586
1660
|
public_tcbinfo: import_zod9.z.boolean().optional(),
|
|
1587
1661
|
gateway_enabled: import_zod9.z.boolean().optional(),
|
|
1588
1662
|
secure_time: import_zod9.z.boolean().optional(),
|
|
1663
|
+
listed: import_zod9.z.boolean().optional().default(false),
|
|
1589
1664
|
storage_fs: import_zod9.z.string().optional(),
|
|
1590
1665
|
workspace: WorkspaceRefSchema.nullable().optional(),
|
|
1591
1666
|
creator: UserRefSchema.nullable().optional()
|
|
@@ -1810,6 +1885,7 @@ var LooseAppComposeSchema = import_zod12.z.object({
|
|
|
1810
1885
|
public_logs: import_zod12.z.boolean().optional(),
|
|
1811
1886
|
public_sysinfo: import_zod12.z.boolean().optional(),
|
|
1812
1887
|
tproxy_enabled: import_zod12.z.boolean().optional(),
|
|
1888
|
+
storage_fs: import_zod12.z.enum(["ext4", "zfs"]).optional(),
|
|
1813
1889
|
pre_launch_script: import_zod12.z.string().optional(),
|
|
1814
1890
|
env_pubkey: import_zod12.z.string().optional(),
|
|
1815
1891
|
salt: import_zod12.z.string().optional().nullable()
|
|
@@ -1866,8 +1942,9 @@ var ProvisionCvmRequestSchema = import_zod13.z.object({
|
|
|
1866
1942
|
public_sysinfo: import_zod13.z.boolean().optional(),
|
|
1867
1943
|
gateway_enabled: import_zod13.z.boolean().optional(),
|
|
1868
1944
|
// recommended
|
|
1869
|
-
tproxy_enabled: import_zod13.z.boolean().optional()
|
|
1945
|
+
tproxy_enabled: import_zod13.z.boolean().optional(),
|
|
1870
1946
|
// deprecated, for compatibility
|
|
1947
|
+
storage_fs: import_zod13.z.enum(["ext4", "zfs"]).optional()
|
|
1871
1948
|
}).superRefine((data, ctx) => {
|
|
1872
1949
|
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1873
1950
|
}),
|
|
@@ -2416,7 +2493,7 @@ var VMSchema = import_zod25.z.object({
|
|
|
2416
2493
|
vm_uuid: import_zod25.z.string().nullable(),
|
|
2417
2494
|
instance_id: import_zod25.z.string().nullable(),
|
|
2418
2495
|
app_url: import_zod25.z.string().optional().nullable(),
|
|
2419
|
-
base_image: import_zod25.z.string().nullable(),
|
|
2496
|
+
base_image: import_zod25.z.string().optional().nullable(),
|
|
2420
2497
|
vcpu: import_zod25.z.number(),
|
|
2421
2498
|
memory: import_zod25.z.number(),
|
|
2422
2499
|
disk_size: import_zod25.z.number(),
|
|
@@ -2739,6 +2816,161 @@ var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmState
|
|
|
2739
2816
|
return await client.get(`/cvms/${cvmId}/state`);
|
|
2740
2817
|
});
|
|
2741
2818
|
|
|
2819
|
+
// src/actions/ssh_keys/list_ssh_keys.ts
|
|
2820
|
+
var import_zod38 = require("zod");
|
|
2821
|
+
var SshKeySchema = import_zod38.z.object({
|
|
2822
|
+
id: import_zod38.z.string(),
|
|
2823
|
+
user_id: import_zod38.z.string(),
|
|
2824
|
+
name: import_zod38.z.string(),
|
|
2825
|
+
public_key: import_zod38.z.string(),
|
|
2826
|
+
fingerprint: import_zod38.z.string(),
|
|
2827
|
+
key_type: import_zod38.z.string(),
|
|
2828
|
+
source: import_zod38.z.string(),
|
|
2829
|
+
key_metadata: import_zod38.z.record(import_zod38.z.unknown()).nullable().optional(),
|
|
2830
|
+
last_synced_at: import_zod38.z.string().nullable().optional(),
|
|
2831
|
+
created_at: import_zod38.z.string(),
|
|
2832
|
+
updated_at: import_zod38.z.string()
|
|
2833
|
+
});
|
|
2834
|
+
var ListSshKeysResponseSchema = import_zod38.z.array(SshKeySchema);
|
|
2835
|
+
async function listSshKeys(client) {
|
|
2836
|
+
const response = await client.get("/user/ssh-keys");
|
|
2837
|
+
return ListSshKeysResponseSchema.parse(response);
|
|
2838
|
+
}
|
|
2839
|
+
async function safeListSshKeys(client) {
|
|
2840
|
+
try {
|
|
2841
|
+
const data = await listSshKeys(client);
|
|
2842
|
+
return { success: true, data };
|
|
2843
|
+
} catch (error) {
|
|
2844
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
2845
|
+
return { success: false, error };
|
|
2846
|
+
}
|
|
2847
|
+
return {
|
|
2848
|
+
success: false,
|
|
2849
|
+
error: {
|
|
2850
|
+
name: "Error",
|
|
2851
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
// src/actions/ssh_keys/import_github_profile.ts
|
|
2858
|
+
var import_zod39 = require("zod");
|
|
2859
|
+
var ImportGithubProfileRequestSchema = import_zod39.z.object({
|
|
2860
|
+
github_username: import_zod39.z.string().min(1)
|
|
2861
|
+
});
|
|
2862
|
+
var ImportGithubProfileResponseSchema = import_zod39.z.object({
|
|
2863
|
+
github_username: import_zod39.z.string(),
|
|
2864
|
+
keys_added: import_zod39.z.number().int(),
|
|
2865
|
+
keys_skipped: import_zod39.z.number().int(),
|
|
2866
|
+
errors: import_zod39.z.array(import_zod39.z.string()).default([])
|
|
2867
|
+
});
|
|
2868
|
+
var { action: importGithubProfileSshKeys, safeAction: safeImportGithubProfileSshKeys } = defineAction(
|
|
2869
|
+
ImportGithubProfileResponseSchema,
|
|
2870
|
+
async (client, request) => {
|
|
2871
|
+
const { github_username } = ImportGithubProfileRequestSchema.parse(request);
|
|
2872
|
+
return await client.post("/user/ssh-keys/github-profile", { github_username });
|
|
2873
|
+
}
|
|
2874
|
+
);
|
|
2875
|
+
|
|
2876
|
+
// src/actions/ssh_keys/create_ssh_key.ts
|
|
2877
|
+
var import_zod40 = require("zod");
|
|
2878
|
+
var CreateSshKeyRequestSchema = import_zod40.z.object({
|
|
2879
|
+
name: import_zod40.z.string().min(1),
|
|
2880
|
+
public_key: import_zod40.z.string().min(1)
|
|
2881
|
+
});
|
|
2882
|
+
var { action: createSshKey, safeAction: safeCreateSshKey } = defineAction(SshKeySchema, async (client, request) => {
|
|
2883
|
+
const { name, public_key } = CreateSshKeyRequestSchema.parse(request);
|
|
2884
|
+
return await client.post("/user/ssh-keys", { name, public_key });
|
|
2885
|
+
});
|
|
2886
|
+
|
|
2887
|
+
// src/actions/ssh_keys/delete_ssh_key.ts
|
|
2888
|
+
var import_zod41 = require("zod");
|
|
2889
|
+
var DeleteSshKeyRequestSchema = import_zod41.z.object({
|
|
2890
|
+
keyId: import_zod41.z.string().min(1)
|
|
2891
|
+
});
|
|
2892
|
+
var { action: deleteSshKey, safeAction: safeDeleteSshKey } = defineAction(import_zod41.z.void(), async (client, request) => {
|
|
2893
|
+
const { keyId } = DeleteSshKeyRequestSchema.parse(request);
|
|
2894
|
+
await client.delete(`/user/ssh-keys/${keyId}`);
|
|
2895
|
+
return void 0;
|
|
2896
|
+
});
|
|
2897
|
+
|
|
2898
|
+
// src/actions/ssh_keys/sync_github_ssh_keys.ts
|
|
2899
|
+
var import_zod42 = require("zod");
|
|
2900
|
+
var SyncGithubSshKeysResponseSchema = import_zod42.z.object({
|
|
2901
|
+
synced_count: import_zod42.z.number().int(),
|
|
2902
|
+
keys_added: import_zod42.z.number().int(),
|
|
2903
|
+
keys_updated: import_zod42.z.number().int(),
|
|
2904
|
+
keys_removed: import_zod42.z.number().int(),
|
|
2905
|
+
errors: import_zod42.z.array(import_zod42.z.string()).default([])
|
|
2906
|
+
});
|
|
2907
|
+
var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSimpleAction(
|
|
2908
|
+
SyncGithubSshKeysResponseSchema,
|
|
2909
|
+
async (client) => {
|
|
2910
|
+
return await client.post("/user/ssh-keys/github-sync", {});
|
|
2911
|
+
}
|
|
2912
|
+
);
|
|
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
|
+
|
|
2742
2974
|
// src/create-client.ts
|
|
2743
2975
|
function createClient2(config = {}) {
|
|
2744
2976
|
const client = createClient(config);
|
|
@@ -2814,167 +3046,181 @@ function createClient2(config = {}) {
|
|
|
2814
3046
|
nextAppIds,
|
|
2815
3047
|
safeNextAppIds,
|
|
2816
3048
|
getCvmState,
|
|
2817
|
-
safeGetCvmState
|
|
3049
|
+
safeGetCvmState,
|
|
3050
|
+
listSshKeys,
|
|
3051
|
+
safeListSshKeys,
|
|
3052
|
+
importGithubProfileSshKeys,
|
|
3053
|
+
safeImportGithubProfileSshKeys,
|
|
3054
|
+
createSshKey,
|
|
3055
|
+
safeCreateSshKey,
|
|
3056
|
+
deleteSshKey,
|
|
3057
|
+
safeDeleteSshKey,
|
|
3058
|
+
syncGithubSshKeys,
|
|
3059
|
+
safeSyncGithubSshKeys,
|
|
3060
|
+
getOsImages,
|
|
3061
|
+
safeGetOsImages,
|
|
3062
|
+
getKmsOnChainDetail,
|
|
3063
|
+
safeGetKmsOnChainDetail
|
|
2818
3064
|
};
|
|
2819
3065
|
return client.extend(allActions);
|
|
2820
3066
|
}
|
|
2821
3067
|
|
|
2822
3068
|
// src/types/app_info_v20251028.ts
|
|
2823
|
-
var
|
|
2824
|
-
var CvmBasicInfoV20251028Schema =
|
|
2825
|
-
vm_uuid:
|
|
2826
|
-
app_id:
|
|
2827
|
-
name:
|
|
2828
|
-
status:
|
|
2829
|
-
vcpu:
|
|
2830
|
-
memory:
|
|
2831
|
-
disk_size:
|
|
2832
|
-
teepod_id:
|
|
2833
|
-
teepod_name:
|
|
2834
|
-
region_identifier:
|
|
2835
|
-
kms_type:
|
|
2836
|
-
instance_type:
|
|
2837
|
-
listed:
|
|
2838
|
-
base_image:
|
|
2839
|
-
kms_slug:
|
|
2840
|
-
kms_id:
|
|
2841
|
-
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(),
|
|
2842
3088
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
2843
|
-
updated_at:
|
|
3089
|
+
updated_at: import_zod45.z.string().nullable().optional()
|
|
2844
3090
|
});
|
|
2845
|
-
var AppProfileSchema =
|
|
2846
|
-
display_name:
|
|
2847
|
-
avatar_url:
|
|
2848
|
-
description:
|
|
2849
|
-
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()
|
|
2850
3096
|
});
|
|
2851
|
-
var DstackAppFullResponseV20251028Schema =
|
|
2852
|
-
id:
|
|
2853
|
-
name:
|
|
2854
|
-
app_id:
|
|
2855
|
-
app_provision_type:
|
|
2856
|
-
app_icon_url:
|
|
2857
|
-
created_at:
|
|
2858
|
-
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(),
|
|
2859
3105
|
profile: AppProfileSchema.nullable().optional(),
|
|
2860
3106
|
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
2861
|
-
cvms:
|
|
2862
|
-
cvm_count:
|
|
3107
|
+
cvms: import_zod45.z.array(CvmBasicInfoV20251028Schema).default([]),
|
|
3108
|
+
cvm_count: import_zod45.z.number().int().default(0)
|
|
2863
3109
|
});
|
|
2864
|
-
var DstackAppMinimalResponseV20251028Schema =
|
|
2865
|
-
id:
|
|
2866
|
-
app_id:
|
|
2867
|
-
name:
|
|
2868
|
-
app_provision_type:
|
|
2869
|
-
app_icon_url:
|
|
2870
|
-
created_at:
|
|
2871
|
-
kms_type:
|
|
2872
|
-
current_cvm:
|
|
2873
|
-
cvms:
|
|
2874
|
-
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()
|
|
2875
3121
|
});
|
|
2876
|
-
var DstackAppWithCvmResponseV20251028Schema =
|
|
3122
|
+
var DstackAppWithCvmResponseV20251028Schema = import_zod45.z.union([
|
|
2877
3123
|
DstackAppFullResponseV20251028Schema,
|
|
2878
3124
|
DstackAppMinimalResponseV20251028Schema
|
|
2879
3125
|
]);
|
|
2880
|
-
var DstackAppListResponseV20251028Schema =
|
|
2881
|
-
dstack_apps:
|
|
2882
|
-
page:
|
|
2883
|
-
page_size:
|
|
2884
|
-
total:
|
|
2885
|
-
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()
|
|
2886
3132
|
});
|
|
2887
3133
|
|
|
2888
3134
|
// src/types/app_info_v20260121.ts
|
|
2889
|
-
var
|
|
2890
|
-
var DstackAppFullResponseV20260121Schema =
|
|
2891
|
-
id:
|
|
2892
|
-
name:
|
|
2893
|
-
app_id:
|
|
2894
|
-
app_provision_type:
|
|
2895
|
-
app_icon_url:
|
|
2896
|
-
created_at:
|
|
2897
|
-
kms_type:
|
|
2898
|
-
profile:
|
|
2899
|
-
display_name:
|
|
2900
|
-
avatar_url:
|
|
2901
|
-
description:
|
|
2902
|
-
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()
|
|
2903
3149
|
}).nullable().optional(),
|
|
2904
3150
|
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
2905
|
-
cvms:
|
|
2906
|
-
cvm_count:
|
|
3151
|
+
cvms: import_zod46.z.array(CvmInfoV20260121Schema).default([]),
|
|
3152
|
+
cvm_count: import_zod46.z.number().int().default(0)
|
|
2907
3153
|
});
|
|
2908
|
-
var DstackAppMinimalResponseV20260121Schema =
|
|
2909
|
-
id:
|
|
2910
|
-
app_id:
|
|
2911
|
-
name:
|
|
2912
|
-
app_provision_type:
|
|
2913
|
-
app_icon_url:
|
|
2914
|
-
created_at:
|
|
2915
|
-
kms_type:
|
|
2916
|
-
current_cvm:
|
|
2917
|
-
cvms:
|
|
2918
|
-
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()
|
|
2919
3165
|
});
|
|
2920
|
-
var DstackAppWithCvmResponseV20260121Schema =
|
|
3166
|
+
var DstackAppWithCvmResponseV20260121Schema = import_zod46.z.union([
|
|
2921
3167
|
DstackAppFullResponseV20260121Schema,
|
|
2922
3168
|
DstackAppMinimalResponseV20260121Schema
|
|
2923
3169
|
]);
|
|
2924
|
-
var DstackAppListResponseV20260121Schema =
|
|
2925
|
-
dstack_apps:
|
|
2926
|
-
page:
|
|
2927
|
-
page_size:
|
|
2928
|
-
total:
|
|
2929
|
-
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()
|
|
2930
3176
|
});
|
|
2931
3177
|
|
|
2932
3178
|
// src/types/app_revision.ts
|
|
2933
|
-
var
|
|
2934
|
-
var CvmRefSchema =
|
|
2935
|
-
object_type:
|
|
2936
|
-
id:
|
|
2937
|
-
name:
|
|
2938
|
-
app_id:
|
|
2939
|
-
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()
|
|
2940
3186
|
});
|
|
2941
|
-
var AppRevisionResponseSchema =
|
|
2942
|
-
revision_id:
|
|
2943
|
-
app_id:
|
|
2944
|
-
vm_uuid:
|
|
2945
|
-
compose_hash:
|
|
2946
|
-
created_at:
|
|
2947
|
-
trace_id:
|
|
2948
|
-
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(),
|
|
2949
3195
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
2950
3196
|
cvm: CvmRefSchema.nullable().optional(),
|
|
2951
3197
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2952
3198
|
});
|
|
2953
|
-
var AppRevisionDetailResponseSchema =
|
|
2954
|
-
revision_id:
|
|
2955
|
-
app_id:
|
|
2956
|
-
vm_uuid:
|
|
2957
|
-
compose_hash:
|
|
2958
|
-
compose_file:
|
|
2959
|
-
encrypted_env:
|
|
2960
|
-
user_config:
|
|
2961
|
-
created_at:
|
|
2962
|
-
trace_id:
|
|
2963
|
-
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(),
|
|
2964
3210
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
2965
3211
|
cvm: CvmRefSchema.nullable().optional(),
|
|
2966
3212
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2967
3213
|
});
|
|
2968
|
-
var AppRevisionsResponseSchema =
|
|
2969
|
-
revisions:
|
|
2970
|
-
total:
|
|
2971
|
-
page:
|
|
2972
|
-
page_size:
|
|
2973
|
-
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()
|
|
2974
3220
|
});
|
|
2975
3221
|
|
|
2976
3222
|
// src/actions/blockchains/deploy_app_auth.ts
|
|
2977
|
-
var
|
|
3223
|
+
var import_zod48 = require("zod");
|
|
2978
3224
|
var import_viem3 = require("viem");
|
|
2979
3225
|
var import_accounts2 = require("viem/accounts");
|
|
2980
3226
|
|
|
@@ -3624,25 +3870,25 @@ var kmsAuthAbi = [
|
|
|
3624
3870
|
anonymous: false
|
|
3625
3871
|
}
|
|
3626
3872
|
];
|
|
3627
|
-
var DeployAppAuthRequestBaseSchema =
|
|
3873
|
+
var DeployAppAuthRequestBaseSchema = import_zod48.z.object({
|
|
3628
3874
|
// Chain configuration (conditionally required)
|
|
3629
|
-
chain:
|
|
3630
|
-
rpcUrl:
|
|
3875
|
+
chain: import_zod48.z.unknown().optional(),
|
|
3876
|
+
rpcUrl: import_zod48.z.string().optional(),
|
|
3631
3877
|
// Contract configuration (required)
|
|
3632
|
-
kmsContractAddress:
|
|
3878
|
+
kmsContractAddress: import_zod48.z.string(),
|
|
3633
3879
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
3634
|
-
privateKey:
|
|
3635
|
-
walletClient:
|
|
3880
|
+
privateKey: import_zod48.z.string().optional(),
|
|
3881
|
+
walletClient: import_zod48.z.unknown().optional(),
|
|
3636
3882
|
// Public client (optional, will create default if not provided)
|
|
3637
|
-
publicClient:
|
|
3883
|
+
publicClient: import_zod48.z.unknown().optional(),
|
|
3638
3884
|
// App configuration (optional)
|
|
3639
|
-
allowAnyDevice:
|
|
3640
|
-
deviceId:
|
|
3641
|
-
composeHash:
|
|
3642
|
-
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),
|
|
3643
3889
|
// Validation configuration (optional)
|
|
3644
|
-
skipPrerequisiteChecks:
|
|
3645
|
-
minBalance:
|
|
3890
|
+
skipPrerequisiteChecks: import_zod48.z.boolean().optional().default(false),
|
|
3891
|
+
minBalance: import_zod48.z.string().optional()
|
|
3646
3892
|
// ETH amount as string, e.g., "0.01"
|
|
3647
3893
|
}).passthrough();
|
|
3648
3894
|
var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
@@ -3670,13 +3916,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
|
3670
3916
|
path: ["chain"]
|
|
3671
3917
|
}
|
|
3672
3918
|
);
|
|
3673
|
-
var DeployAppAuthSchema =
|
|
3674
|
-
appId:
|
|
3675
|
-
appAuthAddress:
|
|
3676
|
-
deployer:
|
|
3677
|
-
transactionHash:
|
|
3678
|
-
blockNumber:
|
|
3679
|
-
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()
|
|
3680
3926
|
}).passthrough();
|
|
3681
3927
|
function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
|
|
3682
3928
|
try {
|
|
@@ -3922,7 +4168,7 @@ async function safeDeployAppAuth(request, parameters) {
|
|
|
3922
4168
|
}
|
|
3923
4169
|
|
|
3924
4170
|
// src/actions/blockchains/add_compose_hash.ts
|
|
3925
|
-
var
|
|
4171
|
+
var import_zod49 = require("zod");
|
|
3926
4172
|
var import_viem4 = require("viem");
|
|
3927
4173
|
var import_accounts3 = require("viem/accounts");
|
|
3928
4174
|
var appAuthAbi = [
|
|
@@ -3940,29 +4186,29 @@ var appAuthAbi = [
|
|
|
3940
4186
|
anonymous: false
|
|
3941
4187
|
}
|
|
3942
4188
|
];
|
|
3943
|
-
var AddComposeHashRequestSchema =
|
|
4189
|
+
var AddComposeHashRequestSchema = import_zod49.z.object({
|
|
3944
4190
|
// Chain configuration (conditionally required)
|
|
3945
|
-
chain:
|
|
3946
|
-
rpcUrl:
|
|
3947
|
-
appId:
|
|
3948
|
-
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(),
|
|
3949
4195
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
3950
|
-
privateKey:
|
|
3951
|
-
walletClient:
|
|
4196
|
+
privateKey: import_zod49.z.string().optional(),
|
|
4197
|
+
walletClient: import_zod49.z.unknown().optional(),
|
|
3952
4198
|
// Public client (optional, will create default if not provided)
|
|
3953
|
-
publicClient:
|
|
4199
|
+
publicClient: import_zod49.z.unknown().optional(),
|
|
3954
4200
|
// Validation configuration (optional)
|
|
3955
|
-
skipPrerequisiteChecks:
|
|
3956
|
-
minBalance:
|
|
4201
|
+
skipPrerequisiteChecks: import_zod49.z.boolean().optional().default(false),
|
|
4202
|
+
minBalance: import_zod49.z.string().optional(),
|
|
3957
4203
|
// ETH amount as string, e.g., "0.01"
|
|
3958
4204
|
// Transaction control options
|
|
3959
|
-
timeout:
|
|
3960
|
-
retryOptions:
|
|
3961
|
-
signal:
|
|
4205
|
+
timeout: import_zod49.z.number().optional().default(12e4),
|
|
4206
|
+
retryOptions: import_zod49.z.unknown().optional(),
|
|
4207
|
+
signal: import_zod49.z.unknown().optional(),
|
|
3962
4208
|
// Progress callbacks
|
|
3963
|
-
onTransactionStateChange:
|
|
3964
|
-
onTransactionSubmitted:
|
|
3965
|
-
onTransactionConfirmed:
|
|
4209
|
+
onTransactionStateChange: import_zod49.z.function().optional(),
|
|
4210
|
+
onTransactionSubmitted: import_zod49.z.function().optional(),
|
|
4211
|
+
onTransactionConfirmed: import_zod49.z.function().optional()
|
|
3966
4212
|
}).passthrough().refine(
|
|
3967
4213
|
(data) => {
|
|
3968
4214
|
const hasPrivateKey = !!data.privateKey;
|
|
@@ -3986,12 +4232,12 @@ var AddComposeHashRequestSchema = import_zod42.z.object({
|
|
|
3986
4232
|
path: ["chain"]
|
|
3987
4233
|
}
|
|
3988
4234
|
);
|
|
3989
|
-
var AddComposeHashSchema =
|
|
3990
|
-
composeHash:
|
|
3991
|
-
appId:
|
|
3992
|
-
transactionHash:
|
|
3993
|
-
blockNumber:
|
|
3994
|
-
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()
|
|
3995
4241
|
}).passthrough();
|
|
3996
4242
|
function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
|
|
3997
4243
|
console.log(receipt.logs);
|
|
@@ -4182,115 +4428,819 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
4182
4428
|
}
|
|
4183
4429
|
}
|
|
4184
4430
|
|
|
4185
|
-
// src/actions/
|
|
4186
|
-
var
|
|
4187
|
-
var
|
|
4188
|
-
var
|
|
4189
|
-
var GetWorkspaceNodesSchema = import_zod43.z.object({
|
|
4190
|
-
items: import_zod43.z.array(NodeRefSchema2),
|
|
4191
|
-
total: import_zod43.z.number(),
|
|
4192
|
-
page: import_zod43.z.number(),
|
|
4193
|
-
page_size: import_zod43.z.number(),
|
|
4194
|
-
pages: import_zod43.z.number()
|
|
4195
|
-
}).passthrough();
|
|
4196
|
-
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
4197
|
-
const { teamSlug, page, pageSize } = request;
|
|
4198
|
-
const queryParams = new URLSearchParams();
|
|
4199
|
-
if (page !== void 0) queryParams.append("page", page.toString());
|
|
4200
|
-
if (pageSize !== void 0) queryParams.append("page_size", pageSize.toString());
|
|
4201
|
-
const url = queryParams.toString() ? `/workspaces/${teamSlug}/nodes?${queryParams.toString()}` : `/workspaces/${teamSlug}/nodes`;
|
|
4202
|
-
return await client.get(url);
|
|
4203
|
-
});
|
|
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");
|
|
4204
4435
|
|
|
4205
|
-
// src/actions/
|
|
4206
|
-
var
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
}
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
}
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
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
|
+
];
|
|
4233
4502
|
|
|
4234
|
-
// src/actions/
|
|
4235
|
-
var
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
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"]
|
|
4248
4531
|
}
|
|
4249
|
-
|
|
4250
|
-
var
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
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");
|
|
4255
4585
|
}
|
|
4256
|
-
};
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
const
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
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);
|
|
4263
4596
|
}
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
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
|
+
);
|
|
4273
4607
|
}
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
const
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
target,
|
|
4280
|
-
interval,
|
|
4281
|
-
timeout,
|
|
4282
|
-
signal,
|
|
4283
|
-
onEvent
|
|
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`
|
|
4284
4613
|
);
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
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
|
+
|
|
5121
|
+
// src/actions/workspaces/get_workspace_nodes.ts
|
|
5122
|
+
var import_zod54 = require("zod");
|
|
5123
|
+
var NodeRefSchema2 = NodeRefSchema;
|
|
5124
|
+
var NodeInfoSchema = NodeRefSchema2;
|
|
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()
|
|
5131
|
+
}).passthrough();
|
|
5132
|
+
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
5133
|
+
const { teamSlug, page, pageSize } = request;
|
|
5134
|
+
const queryParams = new URLSearchParams();
|
|
5135
|
+
if (page !== void 0) queryParams.append("page", page.toString());
|
|
5136
|
+
if (pageSize !== void 0) queryParams.append("page_size", pageSize.toString());
|
|
5137
|
+
const url = queryParams.toString() ? `/workspaces/${teamSlug}/nodes?${queryParams.toString()}` : `/workspaces/${teamSlug}/nodes`;
|
|
5138
|
+
return await client.get(url);
|
|
5139
|
+
});
|
|
5140
|
+
|
|
5141
|
+
// src/actions/workspaces/get_workspace_quotas.ts
|
|
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()
|
|
5146
|
+
}).passthrough();
|
|
5147
|
+
var WorkspaceQuotasSchema = import_zod55.z.object({
|
|
5148
|
+
vm_slots: QuotaMetricSchema,
|
|
5149
|
+
vcpu: QuotaMetricSchema,
|
|
5150
|
+
memory_mb: QuotaMetricSchema,
|
|
5151
|
+
disk_gb: QuotaMetricSchema
|
|
5152
|
+
}).passthrough();
|
|
5153
|
+
var WorkspaceReservedGpuQuotaSchema = import_zod55.z.object({
|
|
5154
|
+
gpus: QuotaMetricSchema,
|
|
5155
|
+
in_use: import_zod55.z.number(),
|
|
5156
|
+
misconfigured: import_zod55.z.number()
|
|
5157
|
+
}).passthrough();
|
|
5158
|
+
var GetWorkspaceQuotasSchema = import_zod55.z.object({
|
|
5159
|
+
team_slug: import_zod55.z.string(),
|
|
5160
|
+
tier: import_zod55.z.string(),
|
|
5161
|
+
quotas: WorkspaceQuotasSchema,
|
|
5162
|
+
reserved_nodes: QuotaMetricSchema,
|
|
5163
|
+
reserved_gpu: WorkspaceReservedGpuQuotaSchema,
|
|
5164
|
+
as_of: import_zod55.z.string()
|
|
5165
|
+
}).passthrough();
|
|
5166
|
+
var { action: getWorkspaceQuotas, safeAction: safeGetWorkspaceQuotas } = defineAction(GetWorkspaceQuotasSchema, async (client, request) => {
|
|
5167
|
+
return await client.get(`/workspaces/${request.teamSlug}/quotas`);
|
|
5168
|
+
});
|
|
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
|
+
|
|
5184
|
+
// src/actions/cvms/watch_cvm_state.ts
|
|
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")
|
|
5192
|
+
});
|
|
5193
|
+
var WatchCvmStateRequestSchema = WatchCvmStateParamsSchema;
|
|
5194
|
+
var WatchAbortedError = class extends Error {
|
|
5195
|
+
constructor() {
|
|
5196
|
+
super("Watch operation was aborted");
|
|
5197
|
+
this.name = "WatchAbortedError";
|
|
5198
|
+
}
|
|
5199
|
+
};
|
|
5200
|
+
var MaxRetriesExceededError = class extends Error {
|
|
5201
|
+
constructor(attempts) {
|
|
5202
|
+
super(`Maximum retry attempts (${attempts}) exceeded`);
|
|
5203
|
+
this.attempts = attempts;
|
|
5204
|
+
this.name = "MaxRetriesExceededError";
|
|
5205
|
+
}
|
|
5206
|
+
};
|
|
5207
|
+
function parseSSEEvent(eventType, data) {
|
|
5208
|
+
try {
|
|
5209
|
+
const parsed = JSON.parse(data);
|
|
5210
|
+
return { type: eventType, data: parsed };
|
|
5211
|
+
} catch {
|
|
5212
|
+
return { type: "error", data: { error: "Failed to parse SSE event" } };
|
|
5213
|
+
}
|
|
5214
|
+
}
|
|
5215
|
+
async function watchCvmState(client, request, options = {}) {
|
|
5216
|
+
const { cvmId } = CvmIdSchema.parse(request);
|
|
5217
|
+
const { target, interval, timeout, maxRetries, retryDelay } = WatchCvmStateParamsSchema.parse(request);
|
|
5218
|
+
const { signal, onEvent } = options;
|
|
5219
|
+
let attempt = 0;
|
|
5220
|
+
while (attempt < maxRetries) {
|
|
5221
|
+
if (signal?.aborted) {
|
|
5222
|
+
throw new WatchAbortedError();
|
|
5223
|
+
}
|
|
5224
|
+
attempt++;
|
|
5225
|
+
try {
|
|
5226
|
+
const result = await watchSingleAttempt(
|
|
5227
|
+
client,
|
|
5228
|
+
cvmId,
|
|
5229
|
+
target,
|
|
5230
|
+
interval,
|
|
5231
|
+
timeout,
|
|
5232
|
+
signal,
|
|
5233
|
+
onEvent
|
|
5234
|
+
);
|
|
5235
|
+
if (result) {
|
|
5236
|
+
return result;
|
|
5237
|
+
}
|
|
5238
|
+
if (attempt >= maxRetries) {
|
|
5239
|
+
throw new MaxRetriesExceededError(attempt);
|
|
5240
|
+
}
|
|
5241
|
+
await sleep(retryDelay, signal);
|
|
5242
|
+
} catch (error) {
|
|
5243
|
+
if (signal?.aborted) {
|
|
4294
5244
|
throw new WatchAbortedError();
|
|
4295
5245
|
}
|
|
4296
5246
|
if (error instanceof WatchAbortedError || error instanceof MaxRetriesExceededError) {
|
|
@@ -4425,42 +5375,108 @@ function sleep(ms, signal) {
|
|
|
4425
5375
|
});
|
|
4426
5376
|
}
|
|
4427
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
|
+
|
|
4428
5431
|
// src/actions/cvms/get_cvm_status_batch.ts
|
|
4429
|
-
var
|
|
4430
|
-
var CvmStatusSchema =
|
|
4431
|
-
vm_uuid:
|
|
4432
|
-
status:
|
|
4433
|
-
uptime:
|
|
4434
|
-
in_progress:
|
|
4435
|
-
boot_progress:
|
|
4436
|
-
boot_error:
|
|
4437
|
-
operation_type:
|
|
4438
|
-
operation_started_at:
|
|
4439
|
-
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()
|
|
4440
5443
|
});
|
|
4441
|
-
var GetCvmStatusBatchResponseSchema =
|
|
4442
|
-
var GetCvmStatusBatchRequestSchema =
|
|
4443
|
-
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())
|
|
4444
5447
|
});
|
|
4445
5448
|
var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAction(GetCvmStatusBatchResponseSchema, async (client, request) => {
|
|
4446
5449
|
const { vmUuids } = GetCvmStatusBatchRequestSchema.parse(request);
|
|
4447
5450
|
return await client.post("/status/batch", { vm_uuids: vmUuids });
|
|
4448
5451
|
});
|
|
4449
5452
|
|
|
5453
|
+
// src/actions/cvms/get_cvm_user_config.ts
|
|
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()
|
|
5459
|
+
});
|
|
5460
|
+
var GetCvmUserConfigRequestSchema = CvmIdSchema;
|
|
5461
|
+
var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineAction(CvmUserConfigSchema, async (client, request) => {
|
|
5462
|
+
const { cvmId } = GetCvmUserConfigRequestSchema.parse(request);
|
|
5463
|
+
return await client.get(`/cvms/${cvmId}/user_config`);
|
|
5464
|
+
});
|
|
5465
|
+
|
|
4450
5466
|
// src/actions/apps/get_app_list.ts
|
|
4451
|
-
var
|
|
4452
|
-
var GetAppListRequestSchema =
|
|
4453
|
-
page:
|
|
4454
|
-
page_size:
|
|
4455
|
-
search:
|
|
4456
|
-
status:
|
|
4457
|
-
listed:
|
|
4458
|
-
base_image:
|
|
4459
|
-
instance_type:
|
|
4460
|
-
kms_slug:
|
|
4461
|
-
kms_type:
|
|
4462
|
-
node:
|
|
4463
|
-
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()
|
|
4464
5480
|
}).strict();
|
|
4465
5481
|
function getSchemaForVersion4(version) {
|
|
4466
5482
|
return version === "2025-10-28" ? DstackAppListResponseV20251028Schema : DstackAppListResponseV20260121Schema;
|
|
@@ -4490,9 +5506,9 @@ async function safeGetAppList(client, request) {
|
|
|
4490
5506
|
}
|
|
4491
5507
|
|
|
4492
5508
|
// src/actions/apps/get_app_info.ts
|
|
4493
|
-
var
|
|
4494
|
-
var GetAppInfoRequestSchema =
|
|
4495
|
-
appId:
|
|
5509
|
+
var import_zod63 = require("zod");
|
|
5510
|
+
var GetAppInfoRequestSchema = import_zod63.z.object({
|
|
5511
|
+
appId: import_zod63.z.string().min(1)
|
|
4496
5512
|
}).strict();
|
|
4497
5513
|
function getSchemaForVersion5(version) {
|
|
4498
5514
|
return version === "2025-10-28" ? DstackAppWithCvmResponseV20251028Schema : DstackAppWithCvmResponseV20260121Schema;
|
|
@@ -4522,12 +5538,12 @@ async function safeGetAppInfo(client, request) {
|
|
|
4522
5538
|
}
|
|
4523
5539
|
|
|
4524
5540
|
// src/actions/apps/get_app_cvms.ts
|
|
4525
|
-
var
|
|
4526
|
-
var GetAppCvmsRequestSchema =
|
|
4527
|
-
appId:
|
|
5541
|
+
var import_zod64 = require("zod");
|
|
5542
|
+
var GetAppCvmsRequestSchema = import_zod64.z.object({
|
|
5543
|
+
appId: import_zod64.z.string().min(1)
|
|
4528
5544
|
}).strict();
|
|
4529
5545
|
function getSchemaForVersion6(version) {
|
|
4530
|
-
return version === "2025-10-28" ?
|
|
5546
|
+
return version === "2025-10-28" ? import_zod64.z.array(CvmInfoV20251028Schema) : import_zod64.z.array(CvmInfoV20260121Schema);
|
|
4531
5547
|
}
|
|
4532
5548
|
async function getAppCvms(client, request) {
|
|
4533
5549
|
const { appId } = GetAppCvmsRequestSchema.parse(request);
|
|
@@ -4553,12 +5569,54 @@ async function safeGetAppCvms(client, request) {
|
|
|
4553
5569
|
}
|
|
4554
5570
|
}
|
|
4555
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
|
+
|
|
4556
5614
|
// src/actions/apps/get_app_revisions.ts
|
|
4557
|
-
var
|
|
4558
|
-
var GetAppRevisionsRequestSchema =
|
|
4559
|
-
appId:
|
|
4560
|
-
page:
|
|
4561
|
-
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()
|
|
4562
5620
|
}).strict();
|
|
4563
5621
|
async function getAppRevisions(client, request) {
|
|
4564
5622
|
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
@@ -4584,11 +5642,11 @@ async function safeGetAppRevisions(client, request) {
|
|
|
4584
5642
|
}
|
|
4585
5643
|
|
|
4586
5644
|
// src/actions/apps/get_app_revision_detail.ts
|
|
4587
|
-
var
|
|
4588
|
-
var GetAppRevisionDetailRequestSchema =
|
|
4589
|
-
appId:
|
|
4590
|
-
revisionId:
|
|
4591
|
-
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()
|
|
4592
5650
|
}).strict();
|
|
4593
5651
|
async function getAppRevisionDetail(client, request) {
|
|
4594
5652
|
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
@@ -4615,15 +5673,15 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
4615
5673
|
}
|
|
4616
5674
|
|
|
4617
5675
|
// src/actions/apps/get_app_filter_options.ts
|
|
4618
|
-
var
|
|
4619
|
-
var AppFilterOptionsSchema =
|
|
4620
|
-
statuses:
|
|
4621
|
-
image_versions:
|
|
4622
|
-
instance_types:
|
|
4623
|
-
kms_slugs:
|
|
4624
|
-
kms_types:
|
|
4625
|
-
regions:
|
|
4626
|
-
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())
|
|
4627
5685
|
});
|
|
4628
5686
|
async function getAppFilterOptions(client) {
|
|
4629
5687
|
const response = await client.get("/apps/filter-options");
|
|
@@ -4647,6 +5705,54 @@ async function safeGetAppFilterOptions(client) {
|
|
|
4647
5705
|
}
|
|
4648
5706
|
}
|
|
4649
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
|
+
|
|
4650
5756
|
// src/parse_dotenv.ts
|
|
4651
5757
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
4652
5758
|
function parseEnv(input) {
|
|
@@ -4685,8 +5791,11 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4685
5791
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4686
5792
|
0 && (module.exports = {
|
|
4687
5793
|
AddComposeHashSchema,
|
|
5794
|
+
AddDeviceSchema,
|
|
4688
5795
|
AllFamiliesResponseSchema,
|
|
4689
5796
|
ApiErrorSchema,
|
|
5797
|
+
AppAttestationInstanceSchema,
|
|
5798
|
+
AppAttestationResponseSchema,
|
|
4690
5799
|
AppFilterOptionsSchema,
|
|
4691
5800
|
AppProfileSchema,
|
|
4692
5801
|
AppRevisionDetailResponseSchema,
|
|
@@ -4697,10 +5806,14 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4697
5806
|
AvailableNodesSchema,
|
|
4698
5807
|
BillingPeriodSchema,
|
|
4699
5808
|
BusinessError,
|
|
5809
|
+
CertificateIssuerSchema,
|
|
5810
|
+
CertificateSchema,
|
|
5811
|
+
CertificateSubjectSchema,
|
|
4700
5812
|
CommitCvmComposeFileUpdateRequestSchema,
|
|
4701
5813
|
CommitCvmComposeFileUpdateSchema,
|
|
4702
5814
|
CommitCvmProvisionRequestSchema,
|
|
4703
5815
|
CommitCvmProvisionSchema,
|
|
5816
|
+
CreateSshKeyRequestSchema,
|
|
4704
5817
|
CreditsInfoSchema,
|
|
4705
5818
|
CurrentUserSchema,
|
|
4706
5819
|
CurrentUserV20251028Schema,
|
|
@@ -4728,7 +5841,9 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4728
5841
|
CvmStateSchema,
|
|
4729
5842
|
CvmStatusSchema,
|
|
4730
5843
|
CvmSystemInfoSchema,
|
|
5844
|
+
CvmUserConfigSchema,
|
|
4731
5845
|
DeleteCvmRequestSchema,
|
|
5846
|
+
DeleteSshKeyRequestSchema,
|
|
4732
5847
|
DeployAppAuthRequestSchema,
|
|
4733
5848
|
DeployAppAuthSchema,
|
|
4734
5849
|
DstackAppFullResponseV20251028Schema,
|
|
@@ -4739,9 +5854,13 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4739
5854
|
DstackAppMinimalResponseV20260121Schema,
|
|
4740
5855
|
DstackAppWithCvmResponseV20251028Schema,
|
|
4741
5856
|
DstackAppWithCvmResponseV20260121Schema,
|
|
5857
|
+
EventLogSchema,
|
|
4742
5858
|
FamilyGroupSchema,
|
|
4743
5859
|
FamilyInstanceTypesResponseSchema,
|
|
5860
|
+
GetAllowedDevicesSchema,
|
|
5861
|
+
GetAppAttestationRequestSchema,
|
|
4744
5862
|
GetAppCvmsRequestSchema,
|
|
5863
|
+
GetAppDeviceAllowlistRequestSchema,
|
|
4745
5864
|
GetAppEnvEncryptPubKeyRequestSchema,
|
|
4746
5865
|
GetAppEnvEncryptPubKeySchema,
|
|
4747
5866
|
GetAppInfoRequestSchema,
|
|
@@ -4762,15 +5881,24 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4762
5881
|
GetCvmStatsRequestSchema,
|
|
4763
5882
|
GetCvmStatusBatchRequestSchema,
|
|
4764
5883
|
GetCvmStatusBatchResponseSchema,
|
|
5884
|
+
GetCvmUserConfigRequestSchema,
|
|
4765
5885
|
GetKmsInfoRequestSchema,
|
|
4766
5886
|
GetKmsListRequestSchema,
|
|
4767
5887
|
GetKmsListSchema,
|
|
5888
|
+
GetKmsOnChainDetailRequestSchema,
|
|
5889
|
+
GetKmsOnChainDetailResponseSchema,
|
|
5890
|
+
GetOsImagesRequestSchema,
|
|
5891
|
+
GetOsImagesResponseSchema,
|
|
4768
5892
|
GetWorkspaceNodesSchema,
|
|
4769
5893
|
GetWorkspaceQuotasSchema,
|
|
5894
|
+
ImportGithubProfileRequestSchema,
|
|
5895
|
+
ImportGithubProfileResponseSchema,
|
|
5896
|
+
InstanceIdRefreshResultSchema,
|
|
4770
5897
|
InstanceTypeSchema,
|
|
4771
5898
|
KmsInfoSchema,
|
|
4772
5899
|
KmsTypeSchema,
|
|
4773
5900
|
ListFamilyInstanceTypesRequestSchema,
|
|
5901
|
+
ListSshKeysResponseSchema,
|
|
4774
5902
|
ListWorkspacesSchema,
|
|
4775
5903
|
LooseAppComposeSchema,
|
|
4776
5904
|
MAX_COMPOSE_PAYLOAD_BYTES,
|
|
@@ -4782,7 +5910,11 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4782
5910
|
NextAppIdsSchema,
|
|
4783
5911
|
NodeInfoSchema,
|
|
4784
5912
|
NodeRefSchema,
|
|
5913
|
+
OSImagePublicSchema,
|
|
4785
5914
|
OSImageVariantSchema,
|
|
5915
|
+
OnChainDeviceSchema,
|
|
5916
|
+
OnChainKmsContractSchema,
|
|
5917
|
+
OnChainOsImageSchema,
|
|
4786
5918
|
PaginatedCvmInfosV20251028Schema,
|
|
4787
5919
|
PaginatedCvmInfosV20260121Schema,
|
|
4788
5920
|
PaginationMetadataSchema,
|
|
@@ -4792,15 +5924,24 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4792
5924
|
ProvisionCvmRequestSchema,
|
|
4793
5925
|
ProvisionCvmSchema,
|
|
4794
5926
|
QuotaMetricSchema,
|
|
5927
|
+
RefreshCvmInstanceIdRequestSchema,
|
|
5928
|
+
RefreshCvmInstanceIdsRequestSchema,
|
|
5929
|
+
RefreshCvmInstanceIdsResponseSchema,
|
|
5930
|
+
RemoveDeviceSchema,
|
|
5931
|
+
ReplicateCvmRequestSchema,
|
|
4795
5932
|
RequestError,
|
|
4796
5933
|
ResourceError,
|
|
4797
5934
|
RestartCvmRequestSchema,
|
|
4798
5935
|
SUPPORTED_API_VERSIONS,
|
|
4799
5936
|
SUPPORTED_CHAINS,
|
|
4800
5937
|
ServerError,
|
|
5938
|
+
SetAllowAnyDeviceSchema,
|
|
4801
5939
|
ShutdownCvmRequestSchema,
|
|
5940
|
+
SshKeySchema,
|
|
4802
5941
|
StartCvmRequestSchema,
|
|
4803
5942
|
StopCvmRequestSchema,
|
|
5943
|
+
SyncGithubSshKeysResponseSchema,
|
|
5944
|
+
TcbInfoSchema,
|
|
4804
5945
|
TransactionError,
|
|
4805
5946
|
UnknownError,
|
|
4806
5947
|
UpdateCvmEnvsRequestSchema,
|
|
@@ -4826,10 +5967,12 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4826
5967
|
WorkspaceReservedGpuQuotaSchema,
|
|
4827
5968
|
WorkspaceResponseSchema,
|
|
4828
5969
|
addComposeHash,
|
|
5970
|
+
addDevice,
|
|
4829
5971
|
addNetwork,
|
|
4830
5972
|
asHex,
|
|
4831
5973
|
autoCreateClients,
|
|
4832
5974
|
checkBalance,
|
|
5975
|
+
checkDeviceAllowed,
|
|
4833
5976
|
checkNetworkStatus,
|
|
4834
5977
|
commitCvmComposeFileUpdate,
|
|
4835
5978
|
commitCvmProvision,
|
|
@@ -4839,11 +5982,14 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4839
5982
|
createClientsFromBrowser,
|
|
4840
5983
|
createClientsFromPrivateKey,
|
|
4841
5984
|
createNetworkClients,
|
|
5985
|
+
createSshKey,
|
|
4842
5986
|
createTransactionTracker,
|
|
4843
5987
|
defineAction,
|
|
4844
5988
|
defineSimpleAction,
|
|
4845
5989
|
deleteCvm,
|
|
5990
|
+
deleteSshKey,
|
|
4846
5991
|
deployAppAuth,
|
|
5992
|
+
dstackAppAbi,
|
|
4847
5993
|
dumpAppCompose,
|
|
4848
5994
|
encryptEnvVars,
|
|
4849
5995
|
estimateTransactionGas,
|
|
@@ -4856,7 +6002,10 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4856
6002
|
formatValidationErrors,
|
|
4857
6003
|
generateDefaultCvmName,
|
|
4858
6004
|
generateFallbackHostname,
|
|
6005
|
+
getAllowedDevices,
|
|
6006
|
+
getAppAttestation,
|
|
4859
6007
|
getAppCvms,
|
|
6008
|
+
getAppDeviceAllowlist,
|
|
4860
6009
|
getAppEnvEncryptPubKey,
|
|
4861
6010
|
getAppFilterOptions,
|
|
4862
6011
|
getAppInfo,
|
|
@@ -4878,16 +6027,21 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4878
6027
|
getCvmState,
|
|
4879
6028
|
getCvmStats,
|
|
4880
6029
|
getCvmStatusBatch,
|
|
6030
|
+
getCvmUserConfig,
|
|
4881
6031
|
getErrorMessage,
|
|
4882
6032
|
getKmsInfo,
|
|
4883
6033
|
getKmsList,
|
|
6034
|
+
getKmsOnChainDetail,
|
|
6035
|
+
getOsImages,
|
|
4884
6036
|
getValidationFields,
|
|
4885
6037
|
getWorkspace,
|
|
4886
6038
|
getWorkspaceNodes,
|
|
4887
6039
|
getWorkspaceQuotas,
|
|
6040
|
+
importGithubProfileSshKeys,
|
|
4888
6041
|
isValidHostname,
|
|
4889
6042
|
listAllInstanceTypeFamilies,
|
|
4890
6043
|
listFamilyInstanceTypes,
|
|
6044
|
+
listSshKeys,
|
|
4891
6045
|
listWorkspaces,
|
|
4892
6046
|
nextAppIds,
|
|
4893
6047
|
parseApiError,
|
|
@@ -4897,13 +6051,24 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4897
6051
|
provisionCvm,
|
|
4898
6052
|
provisionCvmComposeFileUpdate,
|
|
4899
6053
|
refineCvmId,
|
|
6054
|
+
refreshCvmInstanceId,
|
|
6055
|
+
refreshCvmInstanceIds,
|
|
6056
|
+
removeDevice,
|
|
6057
|
+
replicateCvm,
|
|
4900
6058
|
restartCvm,
|
|
4901
6059
|
safeAddComposeHash,
|
|
6060
|
+
safeAddDevice,
|
|
6061
|
+
safeCheckDeviceAllowed,
|
|
4902
6062
|
safeCommitCvmComposeFileUpdate,
|
|
4903
6063
|
safeCommitCvmProvision,
|
|
6064
|
+
safeCreateSshKey,
|
|
4904
6065
|
safeDeleteCvm,
|
|
6066
|
+
safeDeleteSshKey,
|
|
4905
6067
|
safeDeployAppAuth,
|
|
6068
|
+
safeGetAllowedDevices,
|
|
6069
|
+
safeGetAppAttestation,
|
|
4906
6070
|
safeGetAppCvms,
|
|
6071
|
+
safeGetAppDeviceAllowlist,
|
|
4907
6072
|
safeGetAppEnvEncryptPubKey,
|
|
4908
6073
|
safeGetAppFilterOptions,
|
|
4909
6074
|
safeGetAppInfo,
|
|
@@ -4924,21 +6089,32 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4924
6089
|
safeGetCvmState,
|
|
4925
6090
|
safeGetCvmStats,
|
|
4926
6091
|
safeGetCvmStatusBatch,
|
|
6092
|
+
safeGetCvmUserConfig,
|
|
4927
6093
|
safeGetKmsInfo,
|
|
4928
6094
|
safeGetKmsList,
|
|
6095
|
+
safeGetKmsOnChainDetail,
|
|
6096
|
+
safeGetOsImages,
|
|
4929
6097
|
safeGetWorkspace,
|
|
4930
6098
|
safeGetWorkspaceNodes,
|
|
4931
6099
|
safeGetWorkspaceQuotas,
|
|
6100
|
+
safeImportGithubProfileSshKeys,
|
|
4932
6101
|
safeListAllInstanceTypeFamilies,
|
|
4933
6102
|
safeListFamilyInstanceTypes,
|
|
6103
|
+
safeListSshKeys,
|
|
4934
6104
|
safeListWorkspaces,
|
|
4935
6105
|
safeNextAppIds,
|
|
4936
6106
|
safeProvisionCvm,
|
|
4937
6107
|
safeProvisionCvmComposeFileUpdate,
|
|
6108
|
+
safeRefreshCvmInstanceId,
|
|
6109
|
+
safeRefreshCvmInstanceIds,
|
|
6110
|
+
safeRemoveDevice,
|
|
6111
|
+
safeReplicateCvm,
|
|
4938
6112
|
safeRestartCvm,
|
|
6113
|
+
safeSetAllowAnyDevice,
|
|
4939
6114
|
safeShutdownCvm,
|
|
4940
6115
|
safeStartCvm,
|
|
4941
6116
|
safeStopCvm,
|
|
6117
|
+
safeSyncGithubSshKeys,
|
|
4942
6118
|
safeUpdateCvmEnvs,
|
|
4943
6119
|
safeUpdateCvmResources,
|
|
4944
6120
|
safeUpdateCvmVisibility,
|
|
@@ -4946,11 +6122,13 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
|
|
|
4946
6122
|
safeUpdateOsImage,
|
|
4947
6123
|
safeUpdatePreLaunchScript,
|
|
4948
6124
|
safeValidateActionParameters,
|
|
6125
|
+
setAllowAnyDevice,
|
|
4949
6126
|
shutdownCvm,
|
|
4950
6127
|
sortObject,
|
|
4951
6128
|
startCvm,
|
|
4952
6129
|
stopCvm,
|
|
4953
6130
|
switchToNetwork,
|
|
6131
|
+
syncGithubSshKeys,
|
|
4954
6132
|
updateCvmEnvs,
|
|
4955
6133
|
updateCvmResources,
|
|
4956
6134
|
updateCvmVisibility,
|