@phala/cloud 0.2.5 → 0.2.8

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/index.js CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  ApiErrorSchema: () => ApiErrorSchema,
37
37
  AppAttestationInstanceSchema: () => AppAttestationInstanceSchema,
38
38
  AppAttestationResponseSchema: () => AppAttestationResponseSchema,
39
+ AppCvmsBatchIsAllowedResponseSchema: () => AppCvmsBatchIsAllowedResponseSchema,
39
40
  AppFilterOptionsSchema: () => AppFilterOptionsSchema,
40
41
  AppProfileSchema: () => AppProfileSchema,
41
42
  AppRevisionDetailResponseSchema: () => AppRevisionDetailResponseSchema,
@@ -49,10 +50,15 @@ __export(index_exports, {
49
50
  CertificateIssuerSchema: () => CertificateIssuerSchema,
50
51
  CertificateSchema: () => CertificateSchema,
51
52
  CertificateSubjectSchema: () => CertificateSubjectSchema,
53
+ CheckAppCvmsIsAllowedRequestSchema: () => CheckAppCvmsIsAllowedRequestSchema,
54
+ CheckAppIsAllowedRequestSchema: () => CheckAppIsAllowedRequestSchema,
55
+ CheckCvmIsAllowedRequestSchema: () => CheckCvmIsAllowedRequestSchema,
52
56
  CommitCvmComposeFileUpdateRequestSchema: () => CommitCvmComposeFileUpdateRequestSchema,
53
57
  CommitCvmComposeFileUpdateSchema: () => CommitCvmComposeFileUpdateSchema,
54
58
  CommitCvmProvisionRequestSchema: () => CommitCvmProvisionRequestSchema,
55
59
  CommitCvmProvisionSchema: () => CommitCvmProvisionSchema,
60
+ CommitCvmUpdateRequestSchema: () => CommitCvmUpdateRequestSchema,
61
+ ConfirmCvmPatchRequestSchema: () => ConfirmCvmPatchRequestSchema,
56
62
  CreateSshKeyRequestSchema: () => CreateSshKeyRequestSchema,
57
63
  CreditsInfoSchema: () => CreditsInfoSchema,
58
64
  CurrentUserSchema: () => CurrentUserV20251028Schema,
@@ -94,6 +100,7 @@ __export(index_exports, {
94
100
  DstackAppMinimalResponseV20260121Schema: () => DstackAppMinimalResponseV20260121Schema,
95
101
  DstackAppWithCvmResponseV20251028Schema: () => DstackAppWithCvmResponseV20251028Schema,
96
102
  DstackAppWithCvmResponseV20260121Schema: () => DstackAppWithCvmResponseV20260121Schema,
103
+ ErrorCodes: () => ErrorCodes,
97
104
  EventLogSchema: () => EventLogSchema,
98
105
  FamilyGroupSchema: () => FamilyGroupSchema,
99
106
  FamilyInstanceTypesResponseSchema: () => FamilyInstanceTypesResponseSchema,
@@ -135,6 +142,7 @@ __export(index_exports, {
135
142
  ImportGithubProfileResponseSchema: () => ImportGithubProfileResponseSchema,
136
143
  InstanceIdRefreshResultSchema: () => InstanceIdRefreshResultSchema,
137
144
  InstanceTypeSchema: () => InstanceTypeSchema,
145
+ IsAllowedResultSchema: () => IsAllowedResultSchema,
138
146
  KmsInfoSchema: () => KmsInfoSchema,
139
147
  KmsTypeSchema: () => KmsTypeSchema,
140
148
  ListFamilyInstanceTypesRequestSchema: () => ListFamilyInstanceTypesRequestSchema,
@@ -158,6 +166,8 @@ __export(index_exports, {
158
166
  PaginatedCvmInfosV20251028Schema: () => PaginatedCvmInfosV20251028Schema,
159
167
  PaginatedCvmInfosV20260121Schema: () => PaginatedCvmInfosV20260121Schema,
160
168
  PaginationMetadataSchema: () => PaginationMetadataSchema,
169
+ PatchCvmRequestSchema: () => PatchCvmRequestSchema,
170
+ PatchCvmResultSchema: () => PatchCvmResultSchema,
161
171
  PhalaCloudError: () => PhalaCloudError,
162
172
  ProvisionCvmComposeFileUpdateRequestSchema: () => ProvisionCvmComposeFileUpdateRequestSchema,
163
173
  ProvisionCvmComposeFileUpdateResultSchema: () => ProvisionCvmComposeFileUpdateResultSchema,
@@ -211,11 +221,18 @@ __export(index_exports, {
211
221
  addNetwork: () => addNetwork,
212
222
  asHex: () => asHex,
213
223
  autoCreateClients: () => autoCreateClients,
224
+ checkAppCvmsIsAllowed: () => checkAppCvmsIsAllowed,
225
+ checkAppIsAllowed: () => checkAppIsAllowed,
214
226
  checkBalance: () => checkBalance,
227
+ checkComposeHashAllowed: () => checkComposeHashAllowed,
228
+ checkCvmIsAllowed: () => checkCvmIsAllowed,
215
229
  checkDeviceAllowed: () => checkDeviceAllowed,
216
230
  checkNetworkStatus: () => checkNetworkStatus,
231
+ checkOnChainPrerequisites: () => checkOnChainPrerequisites,
217
232
  commitCvmComposeFileUpdate: () => commitCvmComposeFileUpdate,
218
233
  commitCvmProvision: () => commitCvmProvision,
234
+ commitCvmUpdate: () => commitCvmUpdate,
235
+ confirmCvmPatch: () => confirmCvmPatch,
219
236
  convertToHostname: () => convertToHostname,
220
237
  createBaseClient: () => createClient,
221
238
  createClient: () => createClient2,
@@ -278,6 +295,8 @@ __export(index_exports, {
278
295
  getWorkspaceNodes: () => getWorkspaceNodes,
279
296
  getWorkspaceQuotas: () => getWorkspaceQuotas,
280
297
  importGithubProfileSshKeys: () => importGithubProfileSshKeys,
298
+ isAppIdConflictError: () => isAppIdConflictError,
299
+ isConflictError: () => isConflictError,
281
300
  isValidHostname: () => isValidHostname,
282
301
  listAllInstanceTypeFamilies: () => listAllInstanceTypeFamilies,
283
302
  listFamilyInstanceTypes: () => listFamilyInstanceTypes,
@@ -287,6 +306,7 @@ __export(index_exports, {
287
306
  parseApiError: () => parseApiError,
288
307
  parseEnv: () => parseEnv,
289
308
  parseEnvVars: () => parseEnvVars,
309
+ patchCvm: () => patchCvm,
290
310
  preprocessAppCompose: () => preprocessAppCompose,
291
311
  provisionCvm: () => provisionCvm,
292
312
  provisionCvmComposeFileUpdate: () => provisionCvmComposeFileUpdate,
@@ -298,9 +318,16 @@ __export(index_exports, {
298
318
  restartCvm: () => restartCvm,
299
319
  safeAddComposeHash: () => safeAddComposeHash,
300
320
  safeAddDevice: () => safeAddDevice,
321
+ safeCheckAppCvmsIsAllowed: () => safeCheckAppCvmsIsAllowed,
322
+ safeCheckAppIsAllowed: () => safeCheckAppIsAllowed,
323
+ safeCheckComposeHashAllowed: () => safeCheckComposeHashAllowed,
324
+ safeCheckCvmIsAllowed: () => safeCheckCvmIsAllowed,
301
325
  safeCheckDeviceAllowed: () => safeCheckDeviceAllowed,
326
+ safeCheckOnChainPrerequisites: () => safeCheckOnChainPrerequisites,
302
327
  safeCommitCvmComposeFileUpdate: () => safeCommitCvmComposeFileUpdate,
303
328
  safeCommitCvmProvision: () => safeCommitCvmProvision,
329
+ safeCommitCvmUpdate: () => safeCommitCvmUpdate,
330
+ safeConfirmCvmPatch: () => safeConfirmCvmPatch,
304
331
  safeCreateSshKey: () => safeCreateSshKey,
305
332
  safeDeleteCvm: () => safeDeleteCvm,
306
333
  safeDeleteSshKey: () => safeDeleteSshKey,
@@ -343,6 +370,7 @@ __export(index_exports, {
343
370
  safeListSshKeys: () => safeListSshKeys,
344
371
  safeListWorkspaces: () => safeListWorkspaces,
345
372
  safeNextAppIds: () => safeNextAppIds,
373
+ safePatchCvm: () => safePatchCvm,
346
374
  safeProvisionCvm: () => safeProvisionCvm,
347
375
  safeProvisionCvmComposeFileUpdate: () => safeProvisionCvmComposeFileUpdate,
348
376
  safeRefreshCvmInstanceId: () => safeRefreshCvmInstanceId,
@@ -443,13 +471,14 @@ var RequestError = class _RequestError extends PhalaCloudError {
443
471
  static fromFetchError(error) {
444
472
  const parseResult = ApiErrorSchema.safeParse(error.data);
445
473
  if (parseResult.success) {
474
+ const detail = parseResult.data.detail ?? (error.data && typeof error.data === "object" && "error_code" in error.data ? error.data : void 0);
446
475
  return new _RequestError(error.message, {
447
476
  status: error.status ?? void 0,
448
477
  statusText: error.statusText ?? void 0,
449
478
  data: error.data,
450
479
  request: error.request ?? void 0,
451
480
  response: error.response ?? void 0,
452
- detail: parseResult.data.detail,
481
+ detail,
453
482
  code: parseResult.data.code ?? void 0,
454
483
  type: parseResult.data.type ?? void 0
455
484
  });
@@ -718,6 +747,12 @@ function formatStructuredError(error, options) {
718
747
  }
719
748
  return parts.join("\n");
720
749
  }
750
+ function isConflictError(error) {
751
+ return error.status === 409;
752
+ }
753
+ function isAppIdConflictError(error) {
754
+ return error instanceof ResourceError && error.errorCode === "ERR-03-007";
755
+ }
721
756
 
722
757
  // src/client.ts
723
758
  var SUPPORTED_API_VERSIONS = [
@@ -781,8 +816,20 @@ var Client = class _Client {
781
816
  headers: requestHeaders,
782
817
  ...useCookieAuth ? { credentials: "include" } : {},
783
818
  ...fetchOptions,
784
- // Log request in cURL format
819
+ // Strip Content-Type for FormData so the browser/runtime sets
820
+ // the correct multipart/form-data boundary automatically.
821
+ // This runs after ofetch merges instance and per-request headers,
822
+ // so deleting here is final.
785
823
  onRequest({ request, options }) {
824
+ if (options.body instanceof FormData) {
825
+ const h = options.headers;
826
+ if (h instanceof Headers) {
827
+ h.delete("content-type");
828
+ } else if (h && typeof h === "object" && !Array.isArray(h)) {
829
+ delete h["Content-Type"];
830
+ delete h["content-type"];
831
+ }
832
+ }
786
833
  if (logger.enabled) {
787
834
  const method = options.method || "GET";
788
835
  const url = typeof request === "string" ? request : request.url;
@@ -914,16 +961,28 @@ var Client = class _Client {
914
961
  throw phalaCloudError;
915
962
  }
916
963
  }
964
+ /**
965
+ * Build request options, stripping Content-Type when body is FormData
966
+ * so the browser/runtime sets the correct multipart boundary automatically.
967
+ */
968
+ // biome-ignore lint/suspicious/noExplicitAny: ofetch generic variance
969
+ buildRequestOptions(method, body, options) {
970
+ const opts = { ...options, method, body };
971
+ if (body instanceof FormData) {
972
+ const existing = opts.headers;
973
+ opts.headers = {
974
+ ...existing,
975
+ "Content-Type": ""
976
+ };
977
+ }
978
+ return opts;
979
+ }
917
980
  /**
918
981
  * Perform POST request (throws PhalaCloudError on error)
919
982
  */
920
983
  async post(request, body, options) {
921
984
  try {
922
- return await this.fetchInstance(request, {
923
- ...options,
924
- method: "POST",
925
- body
926
- });
985
+ return await this.fetchInstance(request, this.buildRequestOptions("POST", body, options));
927
986
  } catch (error) {
928
987
  const requestError = this.convertToRequestError(error);
929
988
  const phalaCloudError = this.emitError(requestError);
@@ -935,11 +994,7 @@ var Client = class _Client {
935
994
  */
936
995
  async put(request, body, options) {
937
996
  try {
938
- return await this.fetchInstance(request, {
939
- ...options,
940
- method: "PUT",
941
- body
942
- });
997
+ return await this.fetchInstance(request, this.buildRequestOptions("PUT", body, options));
943
998
  } catch (error) {
944
999
  const requestError = this.convertToRequestError(error);
945
1000
  const phalaCloudError = this.emitError(requestError);
@@ -951,11 +1006,7 @@ var Client = class _Client {
951
1006
  */
952
1007
  async patch(request, body, options) {
953
1008
  try {
954
- return await this.fetchInstance(request, {
955
- ...options,
956
- method: "PATCH",
957
- body
958
- });
1009
+ return await this.fetchInstance(request, this.buildRequestOptions("PATCH", body, options));
959
1010
  } catch (error) {
960
1011
  const requestError = this.convertToRequestError(error);
961
1012
  const phalaCloudError = this.emitError(requestError);
@@ -1609,7 +1660,7 @@ var CvmOsInfoV20260121Schema = import_zod9.z.object({
1609
1660
  is_dev: import_zod9.z.boolean().nullable().optional(),
1610
1661
  os_image_hash: import_zod9.z.string().nullable().optional()
1611
1662
  });
1612
- var CvmKmsInfoV20260121Schema = import_zod9.z.object({
1663
+ var CvmKmsInfoV20260121BaseSchema = import_zod9.z.object({
1613
1664
  chain_id: import_zod9.z.number().int().nullable().optional(),
1614
1665
  dstack_kms_address: import_zod9.z.string().nullable().optional(),
1615
1666
  dstack_app_address: import_zod9.z.string().nullable().optional(),
@@ -1617,6 +1668,15 @@ var CvmKmsInfoV20260121Schema = import_zod9.z.object({
1617
1668
  rpc_endpoint: import_zod9.z.string().nullable().optional(),
1618
1669
  encrypted_env_pubkey: import_zod9.z.string().nullable().optional()
1619
1670
  });
1671
+ var CvmKmsInfoV20260121Schema = CvmKmsInfoV20260121BaseSchema.transform((data) => {
1672
+ if (data.chain_id != null) {
1673
+ const chain = SUPPORTED_CHAINS[data.chain_id];
1674
+ if (chain) {
1675
+ return { ...data, chain };
1676
+ }
1677
+ }
1678
+ return data;
1679
+ });
1620
1680
  var CvmProgressInfoV20260121Schema = import_zod9.z.object({
1621
1681
  target: import_zod9.z.string().nullable().optional(),
1622
1682
  started_at: import_zod9.z.string().nullable().optional(),
@@ -2132,7 +2192,8 @@ var ProvisionCvmComposeFileUpdateResultSchema = import_zod15.z.object({
2132
2192
  app_id: import_zod15.z.string().nullable(),
2133
2193
  device_id: import_zod15.z.string().nullable(),
2134
2194
  compose_hash: import_zod15.z.string(),
2135
- kms_info: KmsInfoSchema.nullable().optional()
2195
+ kms_info: KmsInfoSchema.nullable().optional(),
2196
+ compose_hash_registered: import_zod15.z.boolean().optional().default(false)
2136
2197
  }).passthrough();
2137
2198
  var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmComposeFileUpdate } = defineAction(ProvisionCvmComposeFileUpdateResultSchema, async (client, request) => {
2138
2199
  const validatedRequest = ProvisionCvmComposeFileUpdateRequestSchema.parse(request);
@@ -2239,14 +2300,24 @@ var { action: updateCvmEnvs, safeAction: safeUpdateCvmEnvs } = defineAction(Upda
2239
2300
  const detail = error.detail;
2240
2301
  if (detail && typeof detail === "object") {
2241
2302
  const detailObj = detail;
2242
- return {
2243
- status: "precondition_required",
2244
- message: detailObj.message || "Compose hash verification required",
2245
- compose_hash: detailObj.compose_hash,
2246
- app_id: detailObj.app_id,
2247
- device_id: detailObj.device_id,
2248
- kms_info: detailObj.kms_info
2249
- };
2303
+ const detailsArray = detailObj.details;
2304
+ if (detailsArray && Array.isArray(detailsArray)) {
2305
+ const fieldMap = new Map(detailsArray.map((d) => [d.field, d.value]));
2306
+ const composeHash = fieldMap.get("compose_hash");
2307
+ const appId = fieldMap.get("app_id");
2308
+ const deviceId = fieldMap.get("device_id");
2309
+ const kmsInfo = fieldMap.get("kms_info");
2310
+ if (composeHash && appId) {
2311
+ return {
2312
+ status: "precondition_required",
2313
+ message: detailObj.message || "Compose hash verification required",
2314
+ compose_hash: composeHash,
2315
+ app_id: appId,
2316
+ device_id: deviceId || "",
2317
+ kms_info: kmsInfo
2318
+ };
2319
+ }
2320
+ }
2250
2321
  }
2251
2322
  }
2252
2323
  throw error;
@@ -2313,14 +2384,24 @@ var { action: updateDockerCompose, safeAction: safeUpdateDockerCompose } = defin
2313
2384
  const detail = error.detail;
2314
2385
  if (detail && typeof detail === "object") {
2315
2386
  const detailObj = detail;
2316
- return {
2317
- status: "precondition_required",
2318
- message: detailObj.message || "Compose hash verification required",
2319
- compose_hash: detailObj.compose_hash,
2320
- app_id: detailObj.app_id,
2321
- device_id: detailObj.device_id,
2322
- kms_info: detailObj.kms_info
2323
- };
2387
+ const detailsArray = detailObj.details;
2388
+ if (detailsArray && Array.isArray(detailsArray)) {
2389
+ const fieldMap = new Map(detailsArray.map((d) => [d.field, d.value]));
2390
+ const composeHash = fieldMap.get("compose_hash");
2391
+ const appId = fieldMap.get("app_id");
2392
+ const deviceId = fieldMap.get("device_id");
2393
+ const kmsInfo = fieldMap.get("kms_info");
2394
+ if (composeHash && appId) {
2395
+ return {
2396
+ status: "precondition_required",
2397
+ message: detailObj.message || "Compose hash verification required",
2398
+ compose_hash: composeHash,
2399
+ app_id: appId,
2400
+ device_id: deviceId || "",
2401
+ kms_info: kmsInfo
2402
+ };
2403
+ }
2404
+ }
2324
2405
  }
2325
2406
  }
2326
2407
  throw error;
@@ -2387,14 +2468,24 @@ var { action: updatePreLaunchScript, safeAction: safeUpdatePreLaunchScript } = d
2387
2468
  const detail = error.detail;
2388
2469
  if (detail && typeof detail === "object") {
2389
2470
  const detailObj = detail;
2390
- return {
2391
- status: "precondition_required",
2392
- message: detailObj.message || "Compose hash verification required",
2393
- compose_hash: detailObj.compose_hash,
2394
- app_id: detailObj.app_id,
2395
- device_id: detailObj.device_id,
2396
- kms_info: detailObj.kms_info
2397
- };
2471
+ const detailsArray = detailObj.details;
2472
+ if (detailsArray && Array.isArray(detailsArray)) {
2473
+ const fieldMap = new Map(detailsArray.map((d) => [d.field, d.value]));
2474
+ const composeHash = fieldMap.get("compose_hash");
2475
+ const appId = fieldMap.get("app_id");
2476
+ const deviceId = fieldMap.get("device_id");
2477
+ const kmsInfo = fieldMap.get("kms_info");
2478
+ if (composeHash && appId) {
2479
+ return {
2480
+ status: "precondition_required",
2481
+ message: detailObj.message || "Compose hash verification required",
2482
+ compose_hash: composeHash,
2483
+ app_id: appId,
2484
+ device_id: deviceId || "",
2485
+ kms_info: kmsInfo
2486
+ };
2487
+ }
2488
+ }
2398
2489
  }
2399
2490
  }
2400
2491
  throw error;
@@ -3240,6 +3331,51 @@ function asHex(value) {
3240
3331
  throw new Error(`Invalid hex value: ${value}`);
3241
3332
  }
3242
3333
 
3334
+ // src/utils/error_codes.ts
3335
+ var ErrorCodes = {
3336
+ // Module 01: CVM Preflight & Compose Hash
3337
+ NODE_NOT_FOUND: "ERR-01-001",
3338
+ COMPOSE_FILE_REQUIRED: "ERR-01-002",
3339
+ INVALID_COMPOSE_FILE: "ERR-01-003",
3340
+ DUPLICATE_CVM_NAME: "ERR-01-004",
3341
+ HASH_REGISTRATION_REQUIRED: "ERR-01-005",
3342
+ HASH_INVALID_OR_EXPIRED: "ERR-01-006",
3343
+ TX_VERIFICATION_FAILED: "ERR-01-007",
3344
+ HASH_NOT_ALLOWED: "ERR-01-008",
3345
+ // Module 02: Inventory
3346
+ INSTANCE_TYPE_NOT_FOUND: "ERR-02-001",
3347
+ RESOURCE_NOT_AVAILABLE: "ERR-02-002",
3348
+ INSUFFICIENT_VCPU: "ERR-02-003",
3349
+ INSUFFICIENT_MEMORY: "ERR-02-004",
3350
+ INSUFFICIENT_SLOTS: "ERR-02-005",
3351
+ GPU_ALLOCATION_ERROR: "ERR-02-006",
3352
+ INSUFFICIENT_GPU: "ERR-02-007",
3353
+ INVALID_REQUEST: "ERR-02-008",
3354
+ INCOMPATIBLE_CONFIG: "ERR-02-009",
3355
+ IMAGE_NOT_FOUND: "ERR-02-010",
3356
+ KMS_NOT_FOUND: "ERR-02-011",
3357
+ TEEPOD_NOT_ACCESSIBLE: "ERR-02-012",
3358
+ OS_IMAGE_NOT_COMPATIBLE: "ERR-02-013",
3359
+ NODE_CAPACITY_NOT_CONFIGURED: "ERR-02-014",
3360
+ QUOTA_EXCEEDED: "ERR-02-015",
3361
+ // Module 03: CVM Operations
3362
+ CVM_NOT_FOUND: "ERR-03-001",
3363
+ MULTIPLE_CVMS_SAME_NAME: "ERR-03-002",
3364
+ CVM_NOT_IN_WORKSPACE: "ERR-03-003",
3365
+ CVM_ACCESS_DENIED: "ERR-03-005",
3366
+ REPLICA_IMAGE_NOT_AVAILABLE: "ERR-03-006",
3367
+ CVM_APP_ID_CONFLICT: "ERR-03-007",
3368
+ // Module 04: Workspace
3369
+ INSUFFICIENT_BALANCE: "ERR-04-001",
3370
+ MAX_CVM_LIMIT: "ERR-04-002",
3371
+ RESOURCE_LIMIT_EXCEEDED: "ERR-04-003",
3372
+ // Module 05: Credentials
3373
+ TOKEN_LIMIT_EXCEEDED: "ERR-05-001",
3374
+ TOKEN_RATE_LIMIT: "ERR-05-002",
3375
+ // Module 06: Auth
3376
+ OAUTH_EMAIL_INVALID: "ERR-06-001"
3377
+ };
3378
+
3243
3379
  // src/utils/network.ts
3244
3380
  var NetworkError = class extends Error {
3245
3381
  constructor(message, code, details) {
@@ -4367,6 +4503,24 @@ async function addComposeHash(request, parameters) {
4367
4503
  );
4368
4504
  }
4369
4505
  }
4506
+ const contractOwner = await publicClient.readContract({
4507
+ address: appAuthAddress,
4508
+ abi: [
4509
+ {
4510
+ inputs: [],
4511
+ name: "owner",
4512
+ outputs: [{ type: "address" }],
4513
+ stateMutability: "view",
4514
+ type: "function"
4515
+ }
4516
+ ],
4517
+ functionName: "owner"
4518
+ });
4519
+ if (contractOwner.toLowerCase() !== address.toLowerCase()) {
4520
+ throw new Error(
4521
+ `Sender ${address} is not the owner of contract ${appAuthAddress}. Contract owner is ${contractOwner}.`
4522
+ );
4523
+ }
4370
4524
  const addComposeHashOperation = async (clients) => {
4371
4525
  const hash = await clients.walletClient.writeContract({
4372
4526
  address: appAuthAddress,
@@ -4479,6 +4633,24 @@ var dstackAppAbi = [
4479
4633
  stateMutability: "view",
4480
4634
  type: "function"
4481
4635
  },
4636
+ {
4637
+ inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
4638
+ name: "allowedComposeHashes",
4639
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
4640
+ stateMutability: "view",
4641
+ type: "function"
4642
+ },
4643
+ // ── Errors ───────────────────────────────────────────────────────
4644
+ {
4645
+ inputs: [{ internalType: "address", name: "owner", type: "address" }],
4646
+ name: "OwnableInvalidOwner",
4647
+ type: "error"
4648
+ },
4649
+ {
4650
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
4651
+ name: "OwnableUnauthorizedAccount",
4652
+ type: "error"
4653
+ },
4482
4654
  // ── Events ───────────────────────────────────────────────────────
4483
4655
  {
4484
4656
  anonymous: false,
@@ -4564,17 +4736,21 @@ async function addDevice(request, parameters) {
4564
4736
  let chainId;
4565
4737
  if (privateKey) {
4566
4738
  const account = (0, import_accounts4.privateKeyToAccount)(privateKey);
4567
- publicClient = providedPublicClient ? providedPublicClient : (0, import_viem5.createPublicClient)({ chain, transport: (0, import_viem5.http)(rpcUrl) });
4739
+ const transport = (0, import_viem5.http)(rpcUrl, { timeout });
4740
+ publicClient = providedPublicClient ? providedPublicClient : (0, import_viem5.createPublicClient)({ chain, transport });
4568
4741
  walletClient = (0, import_viem5.createWalletClient)({
4569
4742
  account,
4570
4743
  chain,
4571
- transport: (0, import_viem5.http)(rpcUrl)
4744
+ transport
4572
4745
  });
4573
4746
  address = account.address;
4574
4747
  chainId = chain.id;
4575
4748
  } else if (providedWalletClient) {
4576
4749
  walletClient = providedWalletClient;
4577
- publicClient = providedPublicClient ? providedPublicClient : (0, import_viem5.createPublicClient)({ chain, transport: (0, import_viem5.http)(rpcUrl) });
4750
+ publicClient = providedPublicClient ? providedPublicClient : (0, import_viem5.createPublicClient)({
4751
+ chain,
4752
+ transport: (0, import_viem5.http)(rpcUrl, { timeout })
4753
+ });
4578
4754
  if (!walletClient.account?.address) {
4579
4755
  throw new Error("WalletClient must have an account with address");
4580
4756
  }
@@ -4613,6 +4789,16 @@ async function addDevice(request, parameters) {
4613
4789
  );
4614
4790
  }
4615
4791
  }
4792
+ const contractOwner = await publicClient.readContract({
4793
+ address: contractAddress,
4794
+ abi: dstackAppAbi,
4795
+ functionName: "owner"
4796
+ });
4797
+ if (contractOwner.toLowerCase() !== address.toLowerCase()) {
4798
+ throw new Error(
4799
+ `Sender ${address} is not the owner of contract ${contractAddress}. Contract owner is ${contractOwner}.`
4800
+ );
4801
+ }
4616
4802
  const addDeviceOperation = async (clients) => {
4617
4803
  return clients.walletClient.writeContract({
4618
4804
  address: contractAddress,
@@ -4735,17 +4921,21 @@ async function removeDevice(request, parameters) {
4735
4921
  let chainId;
4736
4922
  if (privateKey) {
4737
4923
  const account = (0, import_accounts5.privateKeyToAccount)(privateKey);
4738
- publicClient = providedPublicClient ? providedPublicClient : (0, import_viem6.createPublicClient)({ chain, transport: (0, import_viem6.http)(rpcUrl) });
4924
+ const transport = (0, import_viem6.http)(rpcUrl, { timeout });
4925
+ publicClient = providedPublicClient ? providedPublicClient : (0, import_viem6.createPublicClient)({ chain, transport });
4739
4926
  walletClient = (0, import_viem6.createWalletClient)({
4740
4927
  account,
4741
4928
  chain,
4742
- transport: (0, import_viem6.http)(rpcUrl)
4929
+ transport
4743
4930
  });
4744
4931
  address = account.address;
4745
4932
  chainId = chain.id;
4746
4933
  } else if (providedWalletClient) {
4747
4934
  walletClient = providedWalletClient;
4748
- publicClient = providedPublicClient ? providedPublicClient : (0, import_viem6.createPublicClient)({ chain, transport: (0, import_viem6.http)(rpcUrl) });
4935
+ publicClient = providedPublicClient ? providedPublicClient : (0, import_viem6.createPublicClient)({
4936
+ chain,
4937
+ transport: (0, import_viem6.http)(rpcUrl, { timeout })
4938
+ });
4749
4939
  if (!walletClient.account?.address) {
4750
4940
  throw new Error("WalletClient must have an account with address");
4751
4941
  }
@@ -4905,17 +5095,21 @@ async function setAllowAnyDevice(request, parameters) {
4905
5095
  let chainId;
4906
5096
  if (privateKey) {
4907
5097
  const account = (0, import_accounts6.privateKeyToAccount)(privateKey);
4908
- publicClient = providedPublicClient ? providedPublicClient : (0, import_viem7.createPublicClient)({ chain, transport: (0, import_viem7.http)(rpcUrl) });
5098
+ const transport = (0, import_viem7.http)(rpcUrl, { timeout });
5099
+ publicClient = providedPublicClient ? providedPublicClient : (0, import_viem7.createPublicClient)({ chain, transport });
4909
5100
  walletClient = (0, import_viem7.createWalletClient)({
4910
5101
  account,
4911
5102
  chain,
4912
- transport: (0, import_viem7.http)(rpcUrl)
5103
+ transport
4913
5104
  });
4914
5105
  address = account.address;
4915
5106
  chainId = chain.id;
4916
5107
  } else if (providedWalletClient) {
4917
5108
  walletClient = providedWalletClient;
4918
- publicClient = providedPublicClient ? providedPublicClient : (0, import_viem7.createPublicClient)({ chain, transport: (0, import_viem7.http)(rpcUrl) });
5109
+ publicClient = providedPublicClient ? providedPublicClient : (0, import_viem7.createPublicClient)({
5110
+ chain,
5111
+ transport: (0, import_viem7.http)(rpcUrl, { timeout })
5112
+ });
4919
5113
  if (!walletClient.account?.address) {
4920
5114
  throw new Error("WalletClient must have an account with address");
4921
5115
  }
@@ -5118,6 +5312,97 @@ async function safeCheckDeviceAllowed(request) {
5118
5312
  }
5119
5313
  }
5120
5314
 
5315
+ // src/actions/blockchains/check_compose_hash_allowed.ts
5316
+ var import_viem10 = require("viem");
5317
+ async function checkComposeHashAllowed(request) {
5318
+ const { chain, rpcUrl, appAddress, composeHash, publicClient: providedPublicClient } = request;
5319
+ const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
5320
+ const composeHashHex = asHex(composeHash);
5321
+ const publicClient = providedPublicClient ? providedPublicClient : (() => {
5322
+ if (!chain) throw new Error("Chain is required when publicClient is not provided");
5323
+ return (0, import_viem10.createPublicClient)({ chain, transport: (0, import_viem10.http)(rpcUrl) });
5324
+ })();
5325
+ const allowed = await publicClient.readContract({
5326
+ address: contractAddress,
5327
+ abi: dstackAppAbi,
5328
+ functionName: "allowedComposeHashes",
5329
+ args: [composeHashHex]
5330
+ });
5331
+ return allowed;
5332
+ }
5333
+ async function safeCheckComposeHashAllowed(request) {
5334
+ try {
5335
+ const result = await checkComposeHashAllowed(request);
5336
+ return { success: true, data: result };
5337
+ } catch (error) {
5338
+ const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
5339
+ return {
5340
+ success: false,
5341
+ error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
5342
+ };
5343
+ }
5344
+ }
5345
+
5346
+ // src/actions/blockchains/check_on_chain_prerequisites.ts
5347
+ var import_viem11 = require("viem");
5348
+ async function checkOnChainPrerequisites(request) {
5349
+ const {
5350
+ chain,
5351
+ rpcUrl,
5352
+ appAddress,
5353
+ deviceId,
5354
+ composeHash,
5355
+ publicClient: providedPublicClient
5356
+ } = request;
5357
+ const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
5358
+ const deviceIdHex = asHex(deviceId);
5359
+ const composeHashHex = asHex(composeHash);
5360
+ const publicClient = providedPublicClient ? providedPublicClient : (() => {
5361
+ if (!chain) throw new Error("Chain is required when publicClient is not provided");
5362
+ return (0, import_viem11.createPublicClient)({ chain, transport: (0, import_viem11.http)(rpcUrl) });
5363
+ })();
5364
+ const calls = [
5365
+ {
5366
+ address: contractAddress,
5367
+ abi: dstackAppAbi,
5368
+ functionName: "allowAnyDevice"
5369
+ },
5370
+ {
5371
+ address: contractAddress,
5372
+ abi: dstackAppAbi,
5373
+ functionName: "allowedDeviceIds",
5374
+ args: [deviceIdHex]
5375
+ },
5376
+ {
5377
+ address: contractAddress,
5378
+ abi: dstackAppAbi,
5379
+ functionName: "allowedComposeHashes",
5380
+ args: [composeHashHex]
5381
+ }
5382
+ ];
5383
+ const multicallResults = await publicClient.multicall({ contracts: calls });
5384
+ const allowAnyDevice = multicallResults[0]?.status === "success" && multicallResults[0]?.result === true;
5385
+ const deviceIdAllowed = multicallResults[1]?.status === "success" && multicallResults[1]?.result === true;
5386
+ const composeHashAllowed = multicallResults[2]?.status === "success" && multicallResults[2]?.result === true;
5387
+ return {
5388
+ allowAnyDevice,
5389
+ deviceAllowed: allowAnyDevice || deviceIdAllowed,
5390
+ composeHashAllowed
5391
+ };
5392
+ }
5393
+ async function safeCheckOnChainPrerequisites(request) {
5394
+ try {
5395
+ const result = await checkOnChainPrerequisites(request);
5396
+ return { success: true, data: result };
5397
+ } catch (error) {
5398
+ const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
5399
+ return {
5400
+ success: false,
5401
+ error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
5402
+ };
5403
+ }
5404
+ }
5405
+
5121
5406
  // src/actions/workspaces/get_workspace_nodes.ts
5122
5407
  var import_zod54 = require("zod");
5123
5408
  var NodeRefSchema2 = NodeRefSchema;
@@ -5375,22 +5660,177 @@ function sleep(ms, signal) {
5375
5660
  });
5376
5661
  }
5377
5662
 
5378
- // src/actions/cvms/refresh_cvm_instance_id.ts
5663
+ // src/actions/cvms/patch_cvm.ts
5379
5664
  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()
5665
+ var PatchCvmRequestSchema = refineCvmId(
5666
+ CvmIdObjectSchema.extend({
5667
+ // Compose-hash-affecting fields
5668
+ docker_compose_file: import_zod58.z.string().optional(),
5669
+ pre_launch_script: import_zod58.z.string().optional(),
5670
+ allowed_envs: import_zod58.z.array(import_zod58.z.string()).optional(),
5671
+ // Visibility
5672
+ public_logs: import_zod58.z.boolean().optional(),
5673
+ public_sysinfo: import_zod58.z.boolean().optional(),
5674
+ public_tcbinfo: import_zod58.z.boolean().optional(),
5675
+ // Non-compose-hash config
5676
+ encrypted_env: import_zod58.z.string().optional(),
5677
+ user_config: import_zod58.z.string().optional(),
5678
+ gpus: import_zod58.z.object({
5679
+ count: import_zod58.z.number(),
5680
+ product_name: import_zod58.z.string().optional()
5681
+ }).optional(),
5682
+ // Resources
5683
+ vcpu: import_zod58.z.number().optional(),
5684
+ memory: import_zod58.z.number().optional(),
5685
+ disk_size: import_zod58.z.number().optional(),
5686
+ // OS image
5687
+ image: import_zod58.z.string().optional(),
5688
+ // Shutdown behavior
5689
+ shutdown_timeout: import_zod58.z.number().optional(),
5690
+ allow_force_stop: import_zod58.z.boolean().optional(),
5691
+ // Prepare-only mode (for multisig workflows)
5692
+ prepareOnly: import_zod58.z.boolean().optional()
5693
+ })
5694
+ );
5695
+ var PatchCvmAcceptedSchema = import_zod58.z.object({
5696
+ requiresOnChainHash: import_zod58.z.literal(false),
5697
+ correlationId: import_zod58.z.string()
5698
+ });
5699
+ var PatchCvmHashRequiredSchema = import_zod58.z.object({
5700
+ requiresOnChainHash: import_zod58.z.literal(true),
5701
+ composeHash: import_zod58.z.string(),
5702
+ appId: import_zod58.z.string(),
5703
+ deviceId: import_zod58.z.string(),
5704
+ kmsInfo: KmsInfoSchema,
5705
+ commitToken: import_zod58.z.string().optional(),
5706
+ commitUrl: import_zod58.z.string().optional(),
5707
+ apiCommitUrl: import_zod58.z.string().optional(),
5708
+ onchainStatus: import_zod58.z.object({
5709
+ compose_hash_allowed: import_zod58.z.boolean(),
5710
+ device_id_allowed: import_zod58.z.boolean(),
5711
+ is_allowed: import_zod58.z.boolean()
5712
+ }).optional()
5713
+ });
5714
+ var PatchCvmResultSchema = import_zod58.z.discriminatedUnion("requiresOnChainHash", [
5715
+ PatchCvmAcceptedSchema,
5716
+ PatchCvmHashRequiredSchema
5717
+ ]);
5718
+ function extractDetailsMap(detail) {
5719
+ const map = {};
5720
+ if (!detail || typeof detail !== "object") return map;
5721
+ const obj = detail;
5722
+ const details = obj.details;
5723
+ if (!Array.isArray(details)) return map;
5724
+ for (const item of details) {
5725
+ if (item && typeof item === "object" && "field" in item && "value" in item) {
5726
+ map[item.field] = item.value;
5727
+ }
5728
+ }
5729
+ return map;
5730
+ }
5731
+ var { action: patchCvm, safeAction: safePatchCvm } = defineAction(PatchCvmResultSchema, async (client, request) => {
5732
+ const parsed = PatchCvmRequestSchema.parse(request);
5733
+ const { cvmId } = CvmIdSchema.parse(parsed);
5734
+ const { id, uuid, app_id, instance_id, name, prepareOnly, ...body } = parsed;
5735
+ try {
5736
+ const response = prepareOnly ? await client.patch(`/cvms/${cvmId}`, body, {
5737
+ headers: { "X-Prepare-Only": "true" }
5738
+ }) : await client.patch(`/cvms/${cvmId}`, body);
5739
+ return {
5740
+ requiresOnChainHash: false,
5741
+ correlationId: response.correlation_id
5742
+ };
5743
+ } catch (error) {
5744
+ if (error instanceof PhalaCloudError && error.status === 465) {
5745
+ const details = extractDetailsMap(error.detail);
5746
+ return {
5747
+ requiresOnChainHash: true,
5748
+ composeHash: details.compose_hash,
5749
+ appId: String(details.app_id),
5750
+ deviceId: details.device_id,
5751
+ kmsInfo: details.kms_info,
5752
+ commitToken: details.commit_token,
5753
+ commitUrl: details.commit_url,
5754
+ apiCommitUrl: details.api_commit_url,
5755
+ onchainStatus: details.onchain_status
5756
+ };
5757
+ }
5758
+ throw error;
5759
+ }
5760
+ });
5761
+
5762
+ // src/actions/cvms/confirm_cvm_patch.ts
5763
+ var import_zod59 = require("zod");
5764
+ var ConfirmCvmPatchRequestSchema = refineCvmId(
5765
+ CvmIdObjectSchema.extend({
5766
+ composeHash: import_zod59.z.string().describe("Compose hash from patchCvm Phase 1 response"),
5767
+ transactionHash: import_zod59.z.string().describe("Transaction hash proving on-chain registration")
5768
+ })
5769
+ );
5770
+ var ConfirmCvmPatchResultSchema = import_zod59.z.object({
5771
+ correlationId: import_zod59.z.string()
5772
+ });
5773
+ var { action: confirmCvmPatch, safeAction: safeConfirmCvmPatch } = defineAction(ConfirmCvmPatchResultSchema, async (client, request) => {
5774
+ const parsed = ConfirmCvmPatchRequestSchema.parse(request);
5775
+ const { cvmId } = CvmIdSchema.parse(parsed);
5776
+ const response = await client.patch(
5777
+ `/cvms/${cvmId}`,
5778
+ {},
5779
+ {
5780
+ headers: {
5781
+ "X-Compose-Hash": parsed.composeHash,
5782
+ "X-Transaction-Hash": parsed.transactionHash
5783
+ }
5784
+ }
5785
+ );
5786
+ return {
5787
+ correlationId: response.correlation_id
5788
+ };
5789
+ });
5790
+
5791
+ // src/actions/cvms/commit_cvm_update.ts
5792
+ var import_zod60 = require("zod");
5793
+ var CommitCvmUpdateRequestSchema = refineCvmId(
5794
+ CvmIdObjectSchema.extend({
5795
+ token: import_zod60.z.string().describe("One-time commit token from prepare-only flow"),
5796
+ composeHash: import_zod60.z.string().describe("Compose hash from Phase 1 response"),
5797
+ transactionHash: import_zod60.z.string().describe("Transaction hash proving on-chain registration")
5798
+ })
5799
+ );
5800
+ var CommitCvmUpdateResultSchema = import_zod60.z.object({
5801
+ correlationId: import_zod60.z.string(),
5802
+ status: import_zod60.z.string()
5803
+ });
5804
+ var { action: commitCvmUpdate, safeAction: safeCommitCvmUpdate } = defineAction(CommitCvmUpdateResultSchema, async (client, request) => {
5805
+ const parsed = CommitCvmUpdateRequestSchema.parse(request);
5806
+ const { cvmId } = CvmIdSchema.parse(parsed);
5807
+ const response = await client.post(`/cvms/${cvmId}/commit-update`, {
5808
+ token: parsed.token,
5809
+ compose_hash: parsed.composeHash,
5810
+ transaction_hash: parsed.transactionHash
5811
+ });
5812
+ return {
5813
+ correlationId: response.correlation_id,
5814
+ status: response.status
5815
+ };
5816
+ });
5817
+
5818
+ // src/actions/cvms/refresh_cvm_instance_id.ts
5819
+ var import_zod61 = require("zod");
5820
+ var InstanceIdRefreshResultSchema = import_zod61.z.object({
5821
+ cvm_id: import_zod61.z.number().int(),
5822
+ identifier: import_zod61.z.string(),
5823
+ status: import_zod61.z.enum(["updated", "unchanged", "skipped", "conflict", "error"]),
5824
+ old_instance_id: import_zod61.z.string().nullable().optional(),
5825
+ new_instance_id: import_zod61.z.string().nullable().optional(),
5826
+ source: import_zod61.z.enum(["teepod_state", "teepod_info", "gateway", "none"]),
5827
+ verified_with_gateway: import_zod61.z.boolean(),
5828
+ reason: import_zod61.z.string().nullable().optional()
5389
5829
  });
5390
5830
  var RefreshCvmInstanceIdRequestSchema = refineCvmId(
5391
5831
  CvmIdObjectSchema.extend({
5392
- overwrite: import_zod58.z.boolean().optional(),
5393
- dry_run: import_zod58.z.boolean().optional()
5832
+ overwrite: import_zod61.z.boolean().optional(),
5833
+ dry_run: import_zod61.z.boolean().optional()
5394
5834
  })
5395
5835
  );
5396
5836
  var { action: refreshCvmInstanceId, safeAction: safeRefreshCvmInstanceId } = defineAction(InstanceIdRefreshResultSchema, async (client, request) => {
@@ -5404,24 +5844,24 @@ var { action: refreshCvmInstanceId, safeAction: safeRefreshCvmInstanceId } = def
5404
5844
  });
5405
5845
 
5406
5846
  // 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()
5847
+ var import_zod62 = require("zod");
5848
+ var RefreshCvmInstanceIdsRequestSchema = import_zod62.z.object({
5849
+ cvm_ids: import_zod62.z.array(import_zod62.z.string()).optional(),
5850
+ running_only: import_zod62.z.boolean().optional(),
5851
+ missing_only: import_zod62.z.boolean().optional(),
5852
+ overwrite: import_zod62.z.boolean().optional(),
5853
+ limit: import_zod62.z.number().int().min(1).max(500).optional(),
5854
+ dry_run: import_zod62.z.boolean().optional()
5415
5855
  }).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)
5856
+ var RefreshCvmInstanceIdsResponseSchema = import_zod62.z.object({
5857
+ total: import_zod62.z.number().int(),
5858
+ scanned: import_zod62.z.number().int(),
5859
+ updated: import_zod62.z.number().int(),
5860
+ unchanged: import_zod62.z.number().int(),
5861
+ skipped: import_zod62.z.number().int(),
5862
+ conflicts: import_zod62.z.number().int(),
5863
+ errors: import_zod62.z.number().int(),
5864
+ items: import_zod62.z.array(InstanceIdRefreshResultSchema)
5425
5865
  });
5426
5866
  var { action: refreshCvmInstanceIds, safeAction: safeRefreshCvmInstanceIds } = defineAction(RefreshCvmInstanceIdsResponseSchema, async (client, request) => {
5427
5867
  const parsed = RefreshCvmInstanceIdsRequestSchema.parse(request);
@@ -5429,21 +5869,21 @@ var { action: refreshCvmInstanceIds, safeAction: safeRefreshCvmInstanceIds } = d
5429
5869
  });
5430
5870
 
5431
5871
  // src/actions/cvms/get_cvm_status_batch.ts
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()
5443
- });
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())
5872
+ var import_zod63 = require("zod");
5873
+ var CvmStatusSchema = import_zod63.z.object({
5874
+ vm_uuid: import_zod63.z.string(),
5875
+ status: import_zod63.z.string(),
5876
+ uptime: import_zod63.z.string().nullable().optional(),
5877
+ in_progress: import_zod63.z.boolean(),
5878
+ boot_progress: import_zod63.z.string().nullable().optional(),
5879
+ boot_error: import_zod63.z.string().nullable().optional(),
5880
+ operation_type: import_zod63.z.string().nullable().optional(),
5881
+ operation_started_at: import_zod63.z.string().nullable().optional(),
5882
+ correlation_id: import_zod63.z.string().nullable().optional()
5883
+ });
5884
+ var GetCvmStatusBatchResponseSchema = import_zod63.z.record(import_zod63.z.string(), CvmStatusSchema);
5885
+ var GetCvmStatusBatchRequestSchema = import_zod63.z.object({
5886
+ vmUuids: import_zod63.z.array(import_zod63.z.string())
5447
5887
  });
5448
5888
  var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAction(GetCvmStatusBatchResponseSchema, async (client, request) => {
5449
5889
  const { vmUuids } = GetCvmStatusBatchRequestSchema.parse(request);
@@ -5451,11 +5891,11 @@ var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAct
5451
5891
  });
5452
5892
 
5453
5893
  // 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()
5894
+ var import_zod64 = require("zod");
5895
+ var CvmUserConfigSchema = import_zod64.z.object({
5896
+ hostname: import_zod64.z.string().nullable().optional(),
5897
+ ssh_authorized_keys: import_zod64.z.array(import_zod64.z.string()).default([]),
5898
+ default_gateway_domain: import_zod64.z.string().nullable().optional()
5459
5899
  });
5460
5900
  var GetCvmUserConfigRequestSchema = CvmIdSchema;
5461
5901
  var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineAction(CvmUserConfigSchema, async (client, request) => {
@@ -5463,20 +5903,78 @@ var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineActio
5463
5903
  return await client.get(`/cvms/${cvmId}/user_config`);
5464
5904
  });
5465
5905
 
5906
+ // src/actions/cvms/check_cvm_is_allowed.ts
5907
+ var import_zod65 = require("zod");
5908
+ var IsAllowedResultSchema = import_zod65.z.object({
5909
+ cvm_id: import_zod65.z.number().optional(),
5910
+ app_contract_address: import_zod65.z.string(),
5911
+ compose_hash: import_zod65.z.string(),
5912
+ device_id: import_zod65.z.string(),
5913
+ compose_hash_allowed: import_zod65.z.boolean(),
5914
+ allow_any_device: import_zod65.z.boolean(),
5915
+ device_id_allowed: import_zod65.z.boolean().nullable().optional(),
5916
+ is_allowed: import_zod65.z.boolean(),
5917
+ error: import_zod65.z.string().nullable().optional()
5918
+ });
5919
+ var CheckCvmIsAllowedInputSchema = import_zod65.z.object({
5920
+ cvmId: import_zod65.z.string().min(1),
5921
+ compose_hash: import_zod65.z.string().optional(),
5922
+ node_id: import_zod65.z.number().optional(),
5923
+ device_id: import_zod65.z.string().optional()
5924
+ });
5925
+ var CheckCvmIsAllowedRequestSchema = CheckCvmIsAllowedInputSchema;
5926
+ var { action: checkCvmIsAllowed, safeAction: safeCheckCvmIsAllowed } = defineAction(IsAllowedResultSchema, async (client, request) => {
5927
+ const { cvmId, ...body } = CheckCvmIsAllowedRequestSchema.parse(request);
5928
+ return await client.post(`/cvms/${cvmId}/is-allowed`, body);
5929
+ });
5930
+
5931
+ // src/actions/apps/check_app_is_allowed.ts
5932
+ var import_zod66 = require("zod");
5933
+ var CheckAppIsAllowedRequestSchema = import_zod66.z.object({
5934
+ appId: import_zod66.z.string().min(1),
5935
+ compose_hash: import_zod66.z.string(),
5936
+ node_id: import_zod66.z.number().optional(),
5937
+ device_id: import_zod66.z.string().optional(),
5938
+ chain_id: import_zod66.z.number().optional()
5939
+ });
5940
+ var { action: checkAppIsAllowed, safeAction: safeCheckAppIsAllowed } = defineAction(IsAllowedResultSchema, async (client, request) => {
5941
+ const { appId, ...body } = CheckAppIsAllowedRequestSchema.parse(request);
5942
+ return await client.post(`/apps/${appId}/is-allowed`, body);
5943
+ });
5944
+
5945
+ // src/actions/apps/check_app_cvms_is_allowed.ts
5946
+ var import_zod67 = require("zod");
5947
+ var AppCvmsBatchIsAllowedResponseSchema = import_zod67.z.object({
5948
+ is_onchain: import_zod67.z.boolean(),
5949
+ results: import_zod67.z.array(IsAllowedResultSchema.extend({ cvm_id: import_zod67.z.number() })).default([]),
5950
+ total: import_zod67.z.number().default(0),
5951
+ allowed_count: import_zod67.z.number().default(0),
5952
+ denied_count: import_zod67.z.number().default(0),
5953
+ error_count: import_zod67.z.number().default(0),
5954
+ skipped_cvm_ids: import_zod67.z.array(import_zod67.z.number()).default([])
5955
+ });
5956
+ var CheckAppCvmsIsAllowedRequestSchema = import_zod67.z.object({
5957
+ appId: import_zod67.z.string().min(1)
5958
+ });
5959
+ var { action: checkAppCvmsIsAllowed, safeAction: safeCheckAppCvmsIsAllowed } = defineAction(AppCvmsBatchIsAllowedResponseSchema, async (client, request) => {
5960
+ const { appId } = CheckAppCvmsIsAllowedRequestSchema.parse(request);
5961
+ return await client.post(`/apps/${appId}/cvms/is-allowed`, {});
5962
+ });
5963
+
5466
5964
  // src/actions/apps/get_app_list.ts
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()
5965
+ var import_zod68 = require("zod");
5966
+ var GetAppListRequestSchema = import_zod68.z.object({
5967
+ page: import_zod68.z.number().int().min(1).optional(),
5968
+ page_size: import_zod68.z.number().int().min(1).max(100).optional(),
5969
+ search: import_zod68.z.string().optional(),
5970
+ status: import_zod68.z.array(import_zod68.z.string()).optional(),
5971
+ listed: import_zod68.z.boolean().optional(),
5972
+ base_image: import_zod68.z.string().optional(),
5973
+ instance_type: import_zod68.z.string().optional(),
5974
+ kms_slug: import_zod68.z.string().optional(),
5975
+ kms_type: import_zod68.z.string().optional(),
5976
+ node: import_zod68.z.string().optional(),
5977
+ region: import_zod68.z.string().optional()
5480
5978
  }).strict();
5481
5979
  function getSchemaForVersion4(version) {
5482
5980
  return version === "2025-10-28" ? DstackAppListResponseV20251028Schema : DstackAppListResponseV20260121Schema;
@@ -5506,9 +6004,9 @@ async function safeGetAppList(client, request) {
5506
6004
  }
5507
6005
 
5508
6006
  // src/actions/apps/get_app_info.ts
5509
- var import_zod63 = require("zod");
5510
- var GetAppInfoRequestSchema = import_zod63.z.object({
5511
- appId: import_zod63.z.string().min(1)
6007
+ var import_zod69 = require("zod");
6008
+ var GetAppInfoRequestSchema = import_zod69.z.object({
6009
+ appId: import_zod69.z.string().min(1)
5512
6010
  }).strict();
5513
6011
  function getSchemaForVersion5(version) {
5514
6012
  return version === "2025-10-28" ? DstackAppWithCvmResponseV20251028Schema : DstackAppWithCvmResponseV20260121Schema;
@@ -5538,12 +6036,12 @@ async function safeGetAppInfo(client, request) {
5538
6036
  }
5539
6037
 
5540
6038
  // src/actions/apps/get_app_cvms.ts
5541
- var import_zod64 = require("zod");
5542
- var GetAppCvmsRequestSchema = import_zod64.z.object({
5543
- appId: import_zod64.z.string().min(1)
6039
+ var import_zod70 = require("zod");
6040
+ var GetAppCvmsRequestSchema = import_zod70.z.object({
6041
+ appId: import_zod70.z.string().min(1)
5544
6042
  }).strict();
5545
6043
  function getSchemaForVersion6(version) {
5546
- return version === "2025-10-28" ? import_zod64.z.array(CvmInfoV20251028Schema) : import_zod64.z.array(CvmInfoV20260121Schema);
6044
+ return version === "2025-10-28" ? import_zod70.z.array(CvmInfoV20251028Schema) : import_zod70.z.array(CvmInfoV20260121Schema);
5547
6045
  }
5548
6046
  async function getAppCvms(client, request) {
5549
6047
  const { appId } = GetAppCvmsRequestSchema.parse(request);
@@ -5570,23 +6068,23 @@ async function safeGetAppCvms(client, request) {
5570
6068
  }
5571
6069
 
5572
6070
  // 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)
6071
+ var import_zod71 = require("zod");
6072
+ var DeviceAllowlistItemSchema = import_zod71.z.object({
6073
+ device_id: import_zod71.z.string(),
6074
+ node_name: import_zod71.z.string().nullable(),
6075
+ cvm_ids: import_zod71.z.array(import_zod71.z.number()),
6076
+ allowed_onchain: import_zod71.z.boolean(),
6077
+ status: import_zod71.z.string()
6078
+ });
6079
+ var DeviceAllowlistResponseSchema = import_zod71.z.object({
6080
+ is_onchain_kms: import_zod71.z.boolean(),
6081
+ allow_any_device: import_zod71.z.boolean().nullable().optional(),
6082
+ chain_id: import_zod71.z.number().nullable().optional(),
6083
+ app_contract_address: import_zod71.z.string().nullable().optional(),
6084
+ devices: import_zod71.z.array(DeviceAllowlistItemSchema).optional().default([])
6085
+ });
6086
+ var GetAppDeviceAllowlistRequestSchema = import_zod71.z.object({
6087
+ appId: import_zod71.z.string().min(1)
5590
6088
  }).strict();
5591
6089
  async function getAppDeviceAllowlist(client, request) {
5592
6090
  const { appId } = GetAppDeviceAllowlistRequestSchema.parse(request);
@@ -5612,11 +6110,11 @@ async function safeGetAppDeviceAllowlist(client, request) {
5612
6110
  }
5613
6111
 
5614
6112
  // src/actions/apps/get_app_revisions.ts
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()
6113
+ var import_zod72 = require("zod");
6114
+ var GetAppRevisionsRequestSchema = import_zod72.z.object({
6115
+ appId: import_zod72.z.string().min(1),
6116
+ page: import_zod72.z.number().int().min(1).optional(),
6117
+ page_size: import_zod72.z.number().int().min(1).max(1e3).optional()
5620
6118
  }).strict();
5621
6119
  async function getAppRevisions(client, request) {
5622
6120
  const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
@@ -5642,11 +6140,11 @@ async function safeGetAppRevisions(client, request) {
5642
6140
  }
5643
6141
 
5644
6142
  // src/actions/apps/get_app_revision_detail.ts
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()
6143
+ var import_zod73 = require("zod");
6144
+ var GetAppRevisionDetailRequestSchema = import_zod73.z.object({
6145
+ appId: import_zod73.z.string().min(1),
6146
+ revisionId: import_zod73.z.string().min(1),
6147
+ rawComposeFile: import_zod73.z.boolean().optional()
5650
6148
  }).strict();
5651
6149
  async function getAppRevisionDetail(client, request) {
5652
6150
  const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
@@ -5673,15 +6171,15 @@ async function safeGetAppRevisionDetail(client, request) {
5673
6171
  }
5674
6172
 
5675
6173
  // src/actions/apps/get_app_filter_options.ts
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())
6174
+ var import_zod74 = require("zod");
6175
+ var AppFilterOptionsSchema = import_zod74.z.object({
6176
+ statuses: import_zod74.z.array(import_zod74.z.string()),
6177
+ image_versions: import_zod74.z.array(import_zod74.z.string()),
6178
+ instance_types: import_zod74.z.array(import_zod74.z.string()),
6179
+ kms_slugs: import_zod74.z.array(import_zod74.z.string()),
6180
+ kms_types: import_zod74.z.array(import_zod74.z.string()),
6181
+ regions: import_zod74.z.array(import_zod74.z.string()),
6182
+ nodes: import_zod74.z.array(import_zod74.z.string())
5685
6183
  });
5686
6184
  async function getAppFilterOptions(client) {
5687
6185
  const response = await client.get("/apps/filter-options");
@@ -5706,47 +6204,47 @@ async function safeGetAppFilterOptions(client) {
5706
6204
  }
5707
6205
 
5708
6206
  // 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()
6207
+ var import_zod75 = require("zod");
6208
+ var KmsInfoSchema2 = import_zod75.z.object({
6209
+ contract_address: import_zod75.z.string(),
6210
+ chain_id: import_zod75.z.string().nullable(),
6211
+ version: import_zod75.z.string(),
6212
+ url: import_zod75.z.string(),
6213
+ gateway_app_id: import_zod75.z.string().nullable(),
6214
+ gateway_app_url: import_zod75.z.string(),
6215
+ kms_type: import_zod75.z.string()
6216
+ });
6217
+ var GuestAgentInfoSchema = import_zod75.z.object({
6218
+ app_id: import_zod75.z.string().optional(),
6219
+ instance_id: import_zod75.z.string().optional(),
6220
+ app_name: import_zod75.z.string().optional(),
6221
+ device_id: import_zod75.z.string().optional()
5724
6222
  }).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(),
6223
+ var AppAttestationInstanceSchema = import_zod75.z.object({
6224
+ vm_uuid: import_zod75.z.string().nullable().optional(),
6225
+ name: import_zod75.z.string().optional(),
6226
+ instance_id: import_zod75.z.string().nullable().optional(),
6227
+ status: import_zod75.z.string().optional(),
6228
+ image_version: import_zod75.z.string().nullable().optional(),
6229
+ quote: import_zod75.z.string().nullable().optional(),
6230
+ ppid: import_zod75.z.string().optional(),
6231
+ device_id: import_zod75.z.string().optional(),
5734
6232
  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()
6233
+ app_certificates: import_zod75.z.array(CertificateSchema).nullable().optional(),
6234
+ compose_file: import_zod75.z.string().nullable().optional(),
6235
+ error: import_zod75.z.string().nullable().optional()
5738
6236
  });
5739
- var AppAttestationResponseSchema = import_zod69.z.object({
5740
- app_id: import_zod69.z.string(),
5741
- contract_address: import_zod69.z.string(),
6237
+ var AppAttestationResponseSchema = import_zod75.z.object({
6238
+ app_id: import_zod75.z.string(),
6239
+ contract_address: import_zod75.z.string(),
5742
6240
  kms_info: KmsInfoSchema2,
5743
- instances: import_zod69.z.array(AppAttestationInstanceSchema),
6241
+ instances: import_zod75.z.array(AppAttestationInstanceSchema),
5744
6242
  kms_guest_agent_info: GuestAgentInfoSchema,
5745
6243
  gateway_guest_agent_info: GuestAgentInfoSchema,
5746
- qemu_version: import_zod69.z.string().nullable()
6244
+ qemu_version: import_zod75.z.string().nullable()
5747
6245
  });
5748
- var GetAppAttestationRequestSchema = import_zod69.z.object({
5749
- appId: import_zod69.z.string().min(1)
6246
+ var GetAppAttestationRequestSchema = import_zod75.z.object({
6247
+ appId: import_zod75.z.string().min(1)
5750
6248
  }).strict();
5751
6249
  var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAction(AppAttestationResponseSchema, async (client, request) => {
5752
6250
  const { appId } = GetAppAttestationRequestSchema.parse(request);
@@ -5796,6 +6294,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
5796
6294
  ApiErrorSchema,
5797
6295
  AppAttestationInstanceSchema,
5798
6296
  AppAttestationResponseSchema,
6297
+ AppCvmsBatchIsAllowedResponseSchema,
5799
6298
  AppFilterOptionsSchema,
5800
6299
  AppProfileSchema,
5801
6300
  AppRevisionDetailResponseSchema,
@@ -5809,10 +6308,15 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
5809
6308
  CertificateIssuerSchema,
5810
6309
  CertificateSchema,
5811
6310
  CertificateSubjectSchema,
6311
+ CheckAppCvmsIsAllowedRequestSchema,
6312
+ CheckAppIsAllowedRequestSchema,
6313
+ CheckCvmIsAllowedRequestSchema,
5812
6314
  CommitCvmComposeFileUpdateRequestSchema,
5813
6315
  CommitCvmComposeFileUpdateSchema,
5814
6316
  CommitCvmProvisionRequestSchema,
5815
6317
  CommitCvmProvisionSchema,
6318
+ CommitCvmUpdateRequestSchema,
6319
+ ConfirmCvmPatchRequestSchema,
5816
6320
  CreateSshKeyRequestSchema,
5817
6321
  CreditsInfoSchema,
5818
6322
  CurrentUserSchema,
@@ -5854,6 +6358,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
5854
6358
  DstackAppMinimalResponseV20260121Schema,
5855
6359
  DstackAppWithCvmResponseV20251028Schema,
5856
6360
  DstackAppWithCvmResponseV20260121Schema,
6361
+ ErrorCodes,
5857
6362
  EventLogSchema,
5858
6363
  FamilyGroupSchema,
5859
6364
  FamilyInstanceTypesResponseSchema,
@@ -5895,6 +6400,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
5895
6400
  ImportGithubProfileResponseSchema,
5896
6401
  InstanceIdRefreshResultSchema,
5897
6402
  InstanceTypeSchema,
6403
+ IsAllowedResultSchema,
5898
6404
  KmsInfoSchema,
5899
6405
  KmsTypeSchema,
5900
6406
  ListFamilyInstanceTypesRequestSchema,
@@ -5918,6 +6424,8 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
5918
6424
  PaginatedCvmInfosV20251028Schema,
5919
6425
  PaginatedCvmInfosV20260121Schema,
5920
6426
  PaginationMetadataSchema,
6427
+ PatchCvmRequestSchema,
6428
+ PatchCvmResultSchema,
5921
6429
  PhalaCloudError,
5922
6430
  ProvisionCvmComposeFileUpdateRequestSchema,
5923
6431
  ProvisionCvmComposeFileUpdateResultSchema,
@@ -5971,11 +6479,18 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
5971
6479
  addNetwork,
5972
6480
  asHex,
5973
6481
  autoCreateClients,
6482
+ checkAppCvmsIsAllowed,
6483
+ checkAppIsAllowed,
5974
6484
  checkBalance,
6485
+ checkComposeHashAllowed,
6486
+ checkCvmIsAllowed,
5975
6487
  checkDeviceAllowed,
5976
6488
  checkNetworkStatus,
6489
+ checkOnChainPrerequisites,
5977
6490
  commitCvmComposeFileUpdate,
5978
6491
  commitCvmProvision,
6492
+ commitCvmUpdate,
6493
+ confirmCvmPatch,
5979
6494
  convertToHostname,
5980
6495
  createBaseClient,
5981
6496
  createClient,
@@ -6038,6 +6553,8 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
6038
6553
  getWorkspaceNodes,
6039
6554
  getWorkspaceQuotas,
6040
6555
  importGithubProfileSshKeys,
6556
+ isAppIdConflictError,
6557
+ isConflictError,
6041
6558
  isValidHostname,
6042
6559
  listAllInstanceTypeFamilies,
6043
6560
  listFamilyInstanceTypes,
@@ -6047,6 +6564,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
6047
6564
  parseApiError,
6048
6565
  parseEnv,
6049
6566
  parseEnvVars,
6567
+ patchCvm,
6050
6568
  preprocessAppCompose,
6051
6569
  provisionCvm,
6052
6570
  provisionCvmComposeFileUpdate,
@@ -6058,9 +6576,16 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
6058
6576
  restartCvm,
6059
6577
  safeAddComposeHash,
6060
6578
  safeAddDevice,
6579
+ safeCheckAppCvmsIsAllowed,
6580
+ safeCheckAppIsAllowed,
6581
+ safeCheckComposeHashAllowed,
6582
+ safeCheckCvmIsAllowed,
6061
6583
  safeCheckDeviceAllowed,
6584
+ safeCheckOnChainPrerequisites,
6062
6585
  safeCommitCvmComposeFileUpdate,
6063
6586
  safeCommitCvmProvision,
6587
+ safeCommitCvmUpdate,
6588
+ safeConfirmCvmPatch,
6064
6589
  safeCreateSshKey,
6065
6590
  safeDeleteCvm,
6066
6591
  safeDeleteSshKey,
@@ -6103,6 +6628,7 @@ var import_verify_env_encrypt_public_key = require("@phala/dstack-sdk/verify-env
6103
6628
  safeListSshKeys,
6104
6629
  safeListWorkspaces,
6105
6630
  safeNextAppIds,
6631
+ safePatchCvm,
6106
6632
  safeProvisionCvm,
6107
6633
  safeProvisionCvmComposeFileUpdate,
6108
6634
  safeRefreshCvmInstanceId,