@phala/cloud 0.6.4 → 0.6.6-beta.1

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.
Files changed (95) hide show
  1. package/README.md +6 -6
  2. package/dist/actions/api_tokens/revoke_current_api_token.d.ts +2 -2
  3. package/dist/actions/apps/app_launch_token.d.ts +4 -4
  4. package/dist/actions/apps/check_app_is_allowed.d.ts +4 -4
  5. package/dist/actions/apps/create_app_instance.d.ts +20 -20
  6. package/dist/actions/apps/get_app_attestation.d.ts +4 -4
  7. package/dist/actions/blockchains/abi/dstack_app.d.ts +403 -1
  8. package/dist/actions/blockchains/add_compose_hash.d.ts +7 -0
  9. package/dist/actions/blockchains/add_device.d.ts +7 -0
  10. package/dist/actions/blockchains/check_compose_hash_allowed.d.ts +4 -1
  11. package/dist/actions/blockchains/check_device_allowed.d.ts +5 -2
  12. package/dist/actions/blockchains/check_on_chain_prerequisites.d.ts +7 -2
  13. package/dist/actions/blockchains/epoch_compat.d.ts +106 -0
  14. package/dist/actions/blockchains/get_allowed_devices.d.ts +10 -2
  15. package/dist/actions/blockchains/remove_device.d.ts +7 -0
  16. package/dist/actions/cvms/commit_cvm_compose_file_update.d.ts +4 -4
  17. package/dist/actions/cvms/commit_cvm_update.d.ts +20 -20
  18. package/dist/actions/cvms/confirm_cvm_patch.d.ts +14 -14
  19. package/dist/actions/cvms/cvm_annotations.d.ts +10 -10
  20. package/dist/actions/cvms/delete_cvm.d.ts +2 -2
  21. package/dist/actions/cvms/get_available_os_images.d.ts +2 -2
  22. package/dist/actions/cvms/get_cvm_attestation.d.ts +4 -4
  23. package/dist/actions/cvms/get_cvm_compose_file.d.ts +10 -10
  24. package/dist/actions/cvms/get_cvm_containers_stats.d.ts +4 -4
  25. package/dist/actions/cvms/get_cvm_docker_compose.d.ts +2 -2
  26. package/dist/actions/cvms/get_cvm_info.d.ts +24 -8
  27. package/dist/actions/cvms/get_cvm_init_scripts.d.ts +2 -2
  28. package/dist/actions/cvms/get_cvm_network.d.ts +2 -2
  29. package/dist/actions/cvms/get_cvm_prelaunch_script.d.ts +2 -2
  30. package/dist/actions/cvms/get_cvm_state.d.ts +6 -6
  31. package/dist/actions/cvms/get_cvm_stats.d.ts +2 -2
  32. package/dist/actions/cvms/get_cvm_status_batch.d.ts +10 -10
  33. package/dist/actions/cvms/get_cvm_user_config.d.ts +4 -4
  34. package/dist/actions/cvms/get_prelaunch_script_upgrade_status.d.ts +2 -2
  35. package/dist/actions/cvms/logs.d.ts +10 -9
  36. package/dist/actions/cvms/patch_cvm.d.ts +10 -10
  37. package/dist/actions/cvms/provision_cvm.d.ts +23 -20
  38. package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +49 -49
  39. package/dist/actions/cvms/put_cvm_init_scripts.d.ts +8 -8
  40. package/dist/actions/cvms/refresh_cvm_instance_id.d.ts +25 -25
  41. package/dist/actions/cvms/refresh_cvm_instance_ids.d.ts +25 -25
  42. package/dist/actions/cvms/update_cvm_envs.d.ts +10 -10
  43. package/dist/actions/cvms/update_cvm_resources.d.ts +2 -2
  44. package/dist/actions/cvms/update_cvm_visibility.d.ts +14 -14
  45. package/dist/actions/cvms/update_docker_compose.d.ts +10 -10
  46. package/dist/actions/cvms/update_os_image.d.ts +8 -8
  47. package/dist/actions/cvms/update_prelaunch_script.d.ts +10 -10
  48. package/dist/actions/cvms/upgrade_prelaunch_script.d.ts +2 -2
  49. package/dist/actions/cvms/watch_cvm_state.d.ts +2 -2
  50. package/dist/actions/domains/create_app_domain.d.ts +139 -0
  51. package/dist/actions/domains/delete_app_domain.d.ts +120 -0
  52. package/dist/actions/domains/get_app_domain_guide.d.ts +67 -0
  53. package/dist/actions/domains/list_app_domains.d.ts +107 -0
  54. package/dist/actions/domains/list_domains.d.ts +157 -0
  55. package/dist/actions/domains/merge_app_domain_ingress.d.ts +120 -0
  56. package/dist/actions/domains/preflight_app_domain.d.ts +110 -0
  57. package/dist/actions/domains/schemas.d.ts +82 -0
  58. package/dist/actions/domains/verify_app_domain.d.ts +142 -0
  59. package/dist/actions/get_available_nodes.d.ts +16 -16
  60. package/dist/actions/index.d.ts +11 -1
  61. package/dist/actions/kms/get_app_env_encrypt_pubkey.d.ts +2 -2
  62. package/dist/actions/kms/get_kms_contract.d.ts +2 -2
  63. package/dist/actions/kms/get_kms_info.d.ts +2 -2
  64. package/dist/actions/kms/get_kms_list.d.ts +2 -2
  65. package/dist/actions/kms/get_kms_onchain_detail.d.ts +10 -10
  66. package/dist/actions/kms/list_kms_contract_nodes.d.ts +2 -2
  67. package/dist/actions/kms/list_kms_contracts.d.ts +2 -2
  68. package/dist/actions/kms/next_app_ids.d.ts +2 -2
  69. package/dist/actions/list-instance-types.d.ts +8 -8
  70. package/dist/actions/os_images/get_os_images.d.ts +2 -2
  71. package/dist/actions/ssh_keys/create_ssh_key.d.ts +6 -6
  72. package/dist/actions/ssh_keys/delete_ssh_key.d.ts +2 -2
  73. package/dist/actions/ssh_keys/get_cvm_ssh_keys.d.ts +2 -2
  74. package/dist/actions/ssh_keys/import_github_profile.d.ts +2 -2
  75. package/dist/actions/ssh_keys/sync_github_ssh_keys.d.ts +2 -2
  76. package/dist/actions/ssh_keys/update_cvm_ssh_keys.d.ts +8 -8
  77. package/dist/actions/workspaces/get_workspace.d.ts +8 -8
  78. package/dist/actions/workspaces/get_workspace_nodes.d.ts +12 -12
  79. package/dist/actions/workspaces/get_workspace_quotas.d.ts +2 -2
  80. package/dist/actions/workspaces/list_workspaces.d.ts +10 -10
  81. package/dist/client.d.ts +1 -1
  82. package/dist/create-client.d.ts +263 -134
  83. package/dist/index.js +2468 -1497
  84. package/dist/index.mjs +2447 -1520
  85. package/dist/types/app_compose.d.ts +2 -2
  86. package/dist/types/app_info_v20260121.d.ts +84 -36
  87. package/dist/types/client.d.ts +3 -3
  88. package/dist/types/cvm_info_v20251028.d.ts +1 -0
  89. package/dist/types/cvm_info_v20260121.d.ts +225 -22
  90. package/dist/types/version-mappings.d.ts +11 -11
  91. package/dist/utils/define-action.d.ts +4 -4
  92. package/dist/utils/errors.d.ts +4 -0
  93. package/dist/utils/network.d.ts +6 -6
  94. package/dist/version.d.ts +1 -0
  95. package/package.json +25 -12
@@ -3,6 +3,20 @@
3
3
  *
4
4
  * The full ABI lives in teehouse-ui; we only include the functions and events
5
5
  * that the SDK needs for device management and read-only queries.
6
+ *
7
+ * Two contract generations are supported:
8
+ *
9
+ * - Legacy (dstack < 0.6.4): epoch-less setters `addDevice` / `removeDevice` /
10
+ * `addComposeHash` / `removeComposeHash`, and getters that only ever read the
11
+ * epoch-0 rows.
12
+ * - Epoch-aware (dstack >= 0.6.4): the epoch-less setters are removed and
13
+ * replaced by `*AtEpoch` / `*AtEpochs` forms; allowlist rows are stored per
14
+ * epoch and are not inherited across epochs. The legacy getters are kept, but
15
+ * they only ever report epoch-0 rows, so read paths must use
16
+ * `allowedDeviceIdsAtEpoch` / `allowedComposeHashesAtEpoch` instead.
17
+ *
18
+ * The two generations are told apart with the ERC-165 interface IDs declared in
19
+ * `epoch_compat.ts`.
6
20
  */
7
21
  export declare const dstackAppAbi: readonly [{
8
22
  readonly inputs: readonly [{
@@ -24,6 +38,164 @@ export declare const dstackAppAbi: readonly [{
24
38
  readonly outputs: readonly [];
25
39
  readonly stateMutability: "nonpayable";
26
40
  readonly type: "function";
41
+ }, {
42
+ readonly inputs: readonly [{
43
+ readonly internalType: "bytes32";
44
+ readonly name: "composeHash";
45
+ readonly type: "bytes32";
46
+ }];
47
+ readonly name: "addComposeHash";
48
+ readonly outputs: readonly [];
49
+ readonly stateMutability: "nonpayable";
50
+ readonly type: "function";
51
+ }, {
52
+ readonly inputs: readonly [{
53
+ readonly internalType: "bytes32";
54
+ readonly name: "composeHash";
55
+ readonly type: "bytes32";
56
+ }];
57
+ readonly name: "removeComposeHash";
58
+ readonly outputs: readonly [];
59
+ readonly stateMutability: "nonpayable";
60
+ readonly type: "function";
61
+ }, {
62
+ readonly inputs: readonly [{
63
+ readonly internalType: "uint256";
64
+ readonly name: "epoch";
65
+ readonly type: "uint256";
66
+ }, {
67
+ readonly internalType: "bytes32";
68
+ readonly name: "deviceId";
69
+ readonly type: "bytes32";
70
+ }];
71
+ readonly name: "addDeviceAtEpoch";
72
+ readonly outputs: readonly [];
73
+ readonly stateMutability: "nonpayable";
74
+ readonly type: "function";
75
+ }, {
76
+ readonly inputs: readonly [{
77
+ readonly internalType: "uint256";
78
+ readonly name: "fromEpoch";
79
+ readonly type: "uint256";
80
+ }, {
81
+ readonly internalType: "uint256";
82
+ readonly name: "toEpoch";
83
+ readonly type: "uint256";
84
+ }, {
85
+ readonly internalType: "bytes32";
86
+ readonly name: "deviceId";
87
+ readonly type: "bytes32";
88
+ }];
89
+ readonly name: "addDeviceAtEpochs";
90
+ readonly outputs: readonly [];
91
+ readonly stateMutability: "nonpayable";
92
+ readonly type: "function";
93
+ }, {
94
+ readonly inputs: readonly [{
95
+ readonly internalType: "uint256";
96
+ readonly name: "epoch";
97
+ readonly type: "uint256";
98
+ }, {
99
+ readonly internalType: "bytes32";
100
+ readonly name: "deviceId";
101
+ readonly type: "bytes32";
102
+ }];
103
+ readonly name: "removeDeviceAtEpoch";
104
+ readonly outputs: readonly [];
105
+ readonly stateMutability: "nonpayable";
106
+ readonly type: "function";
107
+ }, {
108
+ readonly inputs: readonly [{
109
+ readonly internalType: "uint256";
110
+ readonly name: "fromEpoch";
111
+ readonly type: "uint256";
112
+ }, {
113
+ readonly internalType: "uint256";
114
+ readonly name: "toEpoch";
115
+ readonly type: "uint256";
116
+ }, {
117
+ readonly internalType: "bytes32";
118
+ readonly name: "deviceId";
119
+ readonly type: "bytes32";
120
+ }];
121
+ readonly name: "removeDeviceAtEpochs";
122
+ readonly outputs: readonly [];
123
+ readonly stateMutability: "nonpayable";
124
+ readonly type: "function";
125
+ }, {
126
+ readonly inputs: readonly [{
127
+ readonly internalType: "uint256";
128
+ readonly name: "epoch";
129
+ readonly type: "uint256";
130
+ }, {
131
+ readonly internalType: "bytes32";
132
+ readonly name: "composeHash";
133
+ readonly type: "bytes32";
134
+ }];
135
+ readonly name: "addComposeHashAtEpoch";
136
+ readonly outputs: readonly [];
137
+ readonly stateMutability: "nonpayable";
138
+ readonly type: "function";
139
+ }, {
140
+ readonly inputs: readonly [{
141
+ readonly internalType: "uint256";
142
+ readonly name: "fromEpoch";
143
+ readonly type: "uint256";
144
+ }, {
145
+ readonly internalType: "uint256";
146
+ readonly name: "toEpoch";
147
+ readonly type: "uint256";
148
+ }, {
149
+ readonly internalType: "bytes32";
150
+ readonly name: "composeHash";
151
+ readonly type: "bytes32";
152
+ }];
153
+ readonly name: "addComposeHashAtEpochs";
154
+ readonly outputs: readonly [];
155
+ readonly stateMutability: "nonpayable";
156
+ readonly type: "function";
157
+ }, {
158
+ readonly inputs: readonly [{
159
+ readonly internalType: "uint256";
160
+ readonly name: "epoch";
161
+ readonly type: "uint256";
162
+ }, {
163
+ readonly internalType: "bytes32";
164
+ readonly name: "composeHash";
165
+ readonly type: "bytes32";
166
+ }];
167
+ readonly name: "removeComposeHashAtEpoch";
168
+ readonly outputs: readonly [];
169
+ readonly stateMutability: "nonpayable";
170
+ readonly type: "function";
171
+ }, {
172
+ readonly inputs: readonly [{
173
+ readonly internalType: "uint256";
174
+ readonly name: "fromEpoch";
175
+ readonly type: "uint256";
176
+ }, {
177
+ readonly internalType: "uint256";
178
+ readonly name: "toEpoch";
179
+ readonly type: "uint256";
180
+ }, {
181
+ readonly internalType: "bytes32";
182
+ readonly name: "composeHash";
183
+ readonly type: "bytes32";
184
+ }];
185
+ readonly name: "removeComposeHashAtEpochs";
186
+ readonly outputs: readonly [];
187
+ readonly stateMutability: "nonpayable";
188
+ readonly type: "function";
189
+ }, {
190
+ readonly inputs: readonly [{
191
+ readonly internalType: "uint256";
192
+ readonly name: "expectedCurrentEpoch";
193
+ readonly type: "uint256";
194
+ }];
195
+ readonly name: "advanceAppEpoch";
196
+ readonly outputs: readonly [];
197
+ readonly stateMutability: "nonpayable";
198
+ readonly type: "function";
27
199
  }, {
28
200
  readonly inputs: readonly [{
29
201
  readonly internalType: "bool";
@@ -34,6 +206,36 @@ export declare const dstackAppAbi: readonly [{
34
206
  readonly outputs: readonly [];
35
207
  readonly stateMutability: "nonpayable";
36
208
  readonly type: "function";
209
+ }, {
210
+ readonly inputs: readonly [{
211
+ readonly internalType: "bool";
212
+ readonly name: "allowed";
213
+ readonly type: "bool";
214
+ }];
215
+ readonly name: "setAllowAnyTeeVariant";
216
+ readonly outputs: readonly [];
217
+ readonly stateMutability: "nonpayable";
218
+ readonly type: "function";
219
+ }, {
220
+ readonly inputs: readonly [{
221
+ readonly internalType: "string[]";
222
+ readonly name: "teeVariants";
223
+ readonly type: "string[]";
224
+ }];
225
+ readonly name: "setAllowedTeeVariants";
226
+ readonly outputs: readonly [];
227
+ readonly stateMutability: "nonpayable";
228
+ readonly type: "function";
229
+ }, {
230
+ readonly inputs: readonly [{
231
+ readonly internalType: "bool";
232
+ readonly name: "_requireUpToDate";
233
+ readonly type: "bool";
234
+ }];
235
+ readonly name: "setRequireTcbUpToDate";
236
+ readonly outputs: readonly [];
237
+ readonly stateMutability: "nonpayable";
238
+ readonly type: "function";
37
239
  }, {
38
240
  readonly inputs: readonly [{
39
241
  readonly internalType: "bytes32";
@@ -48,6 +250,20 @@ export declare const dstackAppAbi: readonly [{
48
250
  }];
49
251
  readonly stateMutability: "view";
50
252
  readonly type: "function";
253
+ }, {
254
+ readonly inputs: readonly [{
255
+ readonly internalType: "bytes32";
256
+ readonly name: "";
257
+ readonly type: "bytes32";
258
+ }];
259
+ readonly name: "allowedComposeHashes";
260
+ readonly outputs: readonly [{
261
+ readonly internalType: "bool";
262
+ readonly name: "";
263
+ readonly type: "bool";
264
+ }];
265
+ readonly stateMutability: "view";
266
+ readonly type: "function";
51
267
  }, {
52
268
  readonly inputs: readonly [];
53
269
  readonly name: "allowAnyDevice";
@@ -68,13 +284,89 @@ export declare const dstackAppAbi: readonly [{
68
284
  }];
69
285
  readonly stateMutability: "view";
70
286
  readonly type: "function";
287
+ }, {
288
+ readonly inputs: readonly [];
289
+ readonly name: "currentAppEpoch";
290
+ readonly outputs: readonly [{
291
+ readonly internalType: "uint256";
292
+ readonly name: "";
293
+ readonly type: "uint256";
294
+ }];
295
+ readonly stateMutability: "view";
296
+ readonly type: "function";
71
297
  }, {
72
298
  readonly inputs: readonly [{
299
+ readonly internalType: "uint256";
300
+ readonly name: "epoch";
301
+ readonly type: "uint256";
302
+ }, {
73
303
  readonly internalType: "bytes32";
304
+ readonly name: "deviceId";
305
+ readonly type: "bytes32";
306
+ }];
307
+ readonly name: "allowedDeviceIdsAtEpoch";
308
+ readonly outputs: readonly [{
309
+ readonly internalType: "bool";
74
310
  readonly name: "";
311
+ readonly type: "bool";
312
+ }];
313
+ readonly stateMutability: "view";
314
+ readonly type: "function";
315
+ }, {
316
+ readonly inputs: readonly [{
317
+ readonly internalType: "uint256";
318
+ readonly name: "epoch";
319
+ readonly type: "uint256";
320
+ }, {
321
+ readonly internalType: "bytes32";
322
+ readonly name: "composeHash";
75
323
  readonly type: "bytes32";
76
324
  }];
77
- readonly name: "allowedComposeHashes";
325
+ readonly name: "allowedComposeHashesAtEpoch";
326
+ readonly outputs: readonly [{
327
+ readonly internalType: "bool";
328
+ readonly name: "";
329
+ readonly type: "bool";
330
+ }];
331
+ readonly stateMutability: "view";
332
+ readonly type: "function";
333
+ }, {
334
+ readonly inputs: readonly [];
335
+ readonly name: "allowAnyTeeVariant";
336
+ readonly outputs: readonly [{
337
+ readonly internalType: "bool";
338
+ readonly name: "";
339
+ readonly type: "bool";
340
+ }];
341
+ readonly stateMutability: "view";
342
+ readonly type: "function";
343
+ }, {
344
+ readonly inputs: readonly [];
345
+ readonly name: "allowedTeeVariants";
346
+ readonly outputs: readonly [{
347
+ readonly internalType: "string[]";
348
+ readonly name: "";
349
+ readonly type: "string[]";
350
+ }];
351
+ readonly stateMutability: "view";
352
+ readonly type: "function";
353
+ }, {
354
+ readonly inputs: readonly [];
355
+ readonly name: "requireTcbUpToDate";
356
+ readonly outputs: readonly [{
357
+ readonly internalType: "bool";
358
+ readonly name: "";
359
+ readonly type: "bool";
360
+ }];
361
+ readonly stateMutability: "view";
362
+ readonly type: "function";
363
+ }, {
364
+ readonly inputs: readonly [{
365
+ readonly internalType: "bytes4";
366
+ readonly name: "interfaceId";
367
+ readonly type: "bytes4";
368
+ }];
369
+ readonly name: "supportsInterface";
78
370
  readonly outputs: readonly [{
79
371
  readonly internalType: "bool";
80
372
  readonly name: "";
@@ -118,6 +410,86 @@ export declare const dstackAppAbi: readonly [{
118
410
  }];
119
411
  readonly name: "DeviceRemoved";
120
412
  readonly type: "event";
413
+ }, {
414
+ readonly anonymous: false;
415
+ readonly inputs: readonly [{
416
+ readonly indexed: false;
417
+ readonly internalType: "bytes32";
418
+ readonly name: "composeHash";
419
+ readonly type: "bytes32";
420
+ }];
421
+ readonly name: "ComposeHashAdded";
422
+ readonly type: "event";
423
+ }, {
424
+ readonly anonymous: false;
425
+ readonly inputs: readonly [{
426
+ readonly indexed: false;
427
+ readonly internalType: "bytes32";
428
+ readonly name: "composeHash";
429
+ readonly type: "bytes32";
430
+ }];
431
+ readonly name: "ComposeHashRemoved";
432
+ readonly type: "event";
433
+ }, {
434
+ readonly anonymous: false;
435
+ readonly inputs: readonly [{
436
+ readonly indexed: true;
437
+ readonly internalType: "uint256";
438
+ readonly name: "epoch";
439
+ readonly type: "uint256";
440
+ }];
441
+ readonly name: "AppEpochAdvanced";
442
+ readonly type: "event";
443
+ }, {
444
+ readonly anonymous: false;
445
+ readonly inputs: readonly [{
446
+ readonly indexed: true;
447
+ readonly internalType: "bytes32";
448
+ readonly name: "policy";
449
+ readonly type: "bytes32";
450
+ }, {
451
+ readonly indexed: true;
452
+ readonly internalType: "bytes32";
453
+ readonly name: "value";
454
+ readonly type: "bytes32";
455
+ }, {
456
+ readonly indexed: true;
457
+ readonly internalType: "uint256";
458
+ readonly name: "epoch";
459
+ readonly type: "uint256";
460
+ }, {
461
+ readonly indexed: false;
462
+ readonly internalType: "bool";
463
+ readonly name: "enabled";
464
+ readonly type: "bool";
465
+ }];
466
+ readonly name: "EpochPolicyChanged";
467
+ readonly type: "event";
468
+ }, {
469
+ readonly anonymous: false;
470
+ readonly inputs: readonly [{
471
+ readonly indexed: true;
472
+ readonly internalType: "address";
473
+ readonly name: "actor";
474
+ readonly type: "address";
475
+ }, {
476
+ readonly indexed: true;
477
+ readonly internalType: "bytes32";
478
+ readonly name: "policy";
479
+ readonly type: "bytes32";
480
+ }, {
481
+ readonly indexed: true;
482
+ readonly internalType: "bytes32";
483
+ readonly name: "value";
484
+ readonly type: "bytes32";
485
+ }, {
486
+ readonly indexed: false;
487
+ readonly internalType: "bool";
488
+ readonly name: "enabled";
489
+ readonly type: "bool";
490
+ }];
491
+ readonly name: "PolicyChanged";
492
+ readonly type: "event";
121
493
  }, {
122
494
  readonly anonymous: false;
123
495
  readonly inputs: readonly [{
@@ -128,4 +500,34 @@ export declare const dstackAppAbi: readonly [{
128
500
  }];
129
501
  readonly name: "AllowAnyDeviceSet";
130
502
  readonly type: "event";
503
+ }, {
504
+ readonly anonymous: false;
505
+ readonly inputs: readonly [{
506
+ readonly indexed: false;
507
+ readonly internalType: "bool";
508
+ readonly name: "allowAny";
509
+ readonly type: "bool";
510
+ }];
511
+ readonly name: "AllowAnyTeeVariantSet";
512
+ readonly type: "event";
513
+ }, {
514
+ readonly anonymous: false;
515
+ readonly inputs: readonly [{
516
+ readonly indexed: false;
517
+ readonly internalType: "string[]";
518
+ readonly name: "teeVariants";
519
+ readonly type: "string[]";
520
+ }];
521
+ readonly name: "AllowedTeeVariantsSet";
522
+ readonly type: "event";
523
+ }, {
524
+ readonly anonymous: false;
525
+ readonly inputs: readonly [{
526
+ readonly indexed: false;
527
+ readonly internalType: "bool";
528
+ readonly name: "requireUpToDate";
529
+ readonly type: "bool";
530
+ }];
531
+ readonly name: "RequireTcbUpToDateSet";
532
+ readonly type: "event";
131
533
  }];
@@ -6,6 +6,12 @@ export type AddComposeHashRequest = {
6
6
  rpcUrl?: string;
7
7
  appId: Address;
8
8
  composeHash: string;
9
+ /**
10
+ * App epoch to write, on epoch-aware contracts. Omit to write
11
+ * `[currentAppEpoch, currentAppEpoch + 1]`. Unsupported (and rejected) on
12
+ * contracts that predate app epochs.
13
+ */
14
+ epoch?: number;
9
15
  privateKey?: Hex;
10
16
  walletClient?: WalletClient;
11
17
  publicClient?: PublicClient;
@@ -24,6 +30,7 @@ export declare const AddComposeHashSchema: z.ZodObject<{
24
30
  transactionHash: z.ZodString;
25
31
  blockNumber: z.ZodOptional<z.ZodBigInt>;
26
32
  gasUsed: z.ZodOptional<z.ZodBigInt>;
33
+ epochsWritten: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
27
34
  }, z.core.$loose>;
28
35
  export type AddComposeHash = z.infer<typeof AddComposeHashSchema>;
29
36
  export type AddComposeHashParameters<T = undefined> = T extends z.ZodTypeAny ? {
@@ -6,6 +6,12 @@ export type AddDeviceRequest = {
6
6
  rpcUrl?: string;
7
7
  appAddress: Address;
8
8
  deviceId: string;
9
+ /**
10
+ * App epoch to write, on epoch-aware contracts. Omit to write
11
+ * `[currentAppEpoch, currentAppEpoch + 1]`. Unsupported (and rejected) on
12
+ * contracts that predate app epochs.
13
+ */
14
+ epoch?: number;
9
15
  privateKey?: Hex;
10
16
  walletClient?: WalletClient;
11
17
  publicClient?: PublicClient;
@@ -24,6 +30,7 @@ export declare const AddDeviceSchema: z.ZodObject<{
24
30
  transactionHash: z.ZodString;
25
31
  blockNumber: z.ZodOptional<z.ZodBigInt>;
26
32
  gasUsed: z.ZodOptional<z.ZodBigInt>;
33
+ epochsWritten: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
27
34
  }, z.core.$loose>;
28
35
  export type AddDevice = z.infer<typeof AddDeviceSchema>;
29
36
  export type AddDeviceParameters<T = undefined> = T extends z.ZodTypeAny ? {
@@ -2,7 +2,10 @@ import { type Chain, type Address, type PublicClient } from "viem";
2
2
  /**
3
3
  * Check whether a specific compose hash is allowed by a DstackApp contract.
4
4
  *
5
- * Reads the `allowedComposeHashes(hash)` mapping on-chain.
5
+ * The row read is epoch-aware: contracts without app epochs use the
6
+ * `allowedComposeHashes(hash)` getter, epoch-aware contracts use
7
+ * `allowedComposeHashesAtEpoch(currentAppEpoch, hash)` because the plain getter
8
+ * only ever reports epoch-0 rows.
6
9
  *
7
10
  * @group Actions
8
11
  * @since 0.7.0
@@ -2,8 +2,11 @@ import { type Chain, type Address, type PublicClient } from "viem";
2
2
  /**
3
3
  * Check whether a specific device is allowed by a DstackApp contract.
4
4
  *
5
- * Reads the `allowAnyDevice()` flag first; if false, checks
6
- * `allowedDeviceIds(deviceId)`.
5
+ * Reads the `allowAnyDevice()` flag first; if false, checks the device row.
6
+ * The row read is epoch-aware: contracts without app epochs use the
7
+ * `allowedDeviceIds(deviceId)` getter, epoch-aware contracts use
8
+ * `allowedDeviceIdsAtEpoch(currentAppEpoch, deviceId)` because the plain getter
9
+ * only ever reports epoch-0 rows.
7
10
  *
8
11
  * @group Actions
9
12
  * @since 0.6.0
@@ -4,8 +4,13 @@ import { type Chain, type Address, type PublicClient } from "viem";
4
4
  *
5
5
  * Uses `multicall` to batch-check:
6
6
  * 1. `allowAnyDevice()` — whether the contract allows any device
7
- * 2. `allowedDeviceIds(deviceId)` — whether the specific device is registered
8
- * 3. `allowedComposeHashes(composeHash)` — whether the compose hash is already registered
7
+ * 2. the device row for the specific device
8
+ * 3. the compose-hash row for the specific compose hash
9
+ *
10
+ * The row reads are epoch-aware: contracts without app epochs use the
11
+ * `allowedDeviceIds` / `allowedComposeHashes` getters, epoch-aware contracts use
12
+ * the `…AtEpoch(currentAppEpoch, …)` getters because the plain getters only ever
13
+ * report epoch-0 rows.
9
14
  *
10
15
  * @group Actions
11
16
  * @since 0.7.0
@@ -0,0 +1,106 @@
1
+ import { z } from "zod";
2
+ import { type Account, type Address, type Chain, type Hash, type Hex, type PublicClient, type WalletClient } from "viem";
3
+ /**
4
+ * Compatibility layer between the two generations of the DstackApp contract.
5
+ *
6
+ * dstack 0.6.4 replaced the epoch-less allowlist setters (`addDevice`,
7
+ * `removeDevice`, `addComposeHash`, `removeComposeHash`) with per-epoch forms:
8
+ *
9
+ * - `…AtEpoch(epoch, value)` writes exactly one epoch;
10
+ * - `…AtEpochs(fromEpoch, toEpoch, value)` writes a range, capped at
11
+ * `currentAppEpoch + 1`;
12
+ * - `currentAppEpoch()` reports the active epoch;
13
+ * - allowlist rows are not inherited across epochs, so the legacy getters
14
+ * (`allowedDeviceIds`, `allowedComposeHashes`) only ever report epoch-0 rows.
15
+ *
16
+ * Contracts shipped before 0.6.4 keep working through the legacy calls, so
17
+ * every caller has to know which generation it is talking to. That is what the
18
+ * probe below answers, cached per contract address for the process lifetime.
19
+ */
20
+ /** ERC-165 interface ID of `IAppEpochManagement` (dstack >= 0.6.4). */
21
+ export declare const APP_EPOCH_MANAGEMENT_INTERFACE_ID = "0x8c0524c4";
22
+ /** ERC-165 interface ID of `IAppAuthBasicManagement` (dstack < 0.6.4). */
23
+ export declare const APP_AUTH_BASIC_MANAGEMENT_INTERFACE_ID = "0x8fd37527";
24
+ /**
25
+ * The app epoch rows a write touched, as `[fromEpoch, toEpoch]`. A single-epoch
26
+ * write reports the same epoch twice. `undefined` means the contract has no
27
+ * epoch concept at all and the write used an epoch-less setter.
28
+ */
29
+ export declare const EpochsWrittenSchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
30
+ export type EpochsWritten = [fromEpoch: number, toEpoch: number];
31
+ /** Which generation of the DstackApp contract an address runs. */
32
+ export type AppContractGeneration = "legacy" | "epoch";
33
+ /**
34
+ * The contract generation plus, for epoch-aware contracts, the epoch that reads
35
+ * and writes should target by default.
36
+ */
37
+ export type AppEpochPlan = {
38
+ kind: "legacy";
39
+ } | {
40
+ kind: "epoch";
41
+ currentAppEpoch: number;
42
+ };
43
+ /**
44
+ * How a single allowlist value should be written:
45
+ *
46
+ * - `legacy` — epoch-less setter on a contract without epochs;
47
+ * - `epoch` — `…AtEpoch(epoch, value)`, the caller named the epoch;
48
+ * - `epochs` — `…AtEpochs(fromEpoch, toEpoch, value)`, the default range:
49
+ * `[currentAppEpoch, currentAppEpoch + 1]` for additions, and
50
+ * `[0, currentAppEpoch + 1]` for removals — the contract still authorizes
51
+ * any epoch ≤ current (`appEpoch > currentAppEpoch` is the only bound), so
52
+ * a removal that skips historical epochs leaves the old rows fetchable.
53
+ */
54
+ export type AppEpochWritePlan = {
55
+ readonly kind: "legacy";
56
+ } | {
57
+ readonly kind: "epoch";
58
+ readonly epoch: number;
59
+ } | {
60
+ readonly kind: "epochs";
61
+ readonly fromEpoch: number;
62
+ readonly toEpoch: number;
63
+ };
64
+ /** Wallet-side context a policy write needs, mirroring the action clients. */
65
+ export type AppPolicyWriteContext = {
66
+ readonly walletClient: WalletClient;
67
+ readonly address: Address;
68
+ readonly account: Account | Address;
69
+ readonly chain: Chain | null;
70
+ };
71
+ /** Drop cached probe verdicts; meant for tests and long-lived processes. */
72
+ export declare function clearAppEpochProbeCache(): void;
73
+ /**
74
+ * Resolve which DstackApp generation `appContractAddress` runs, and for
75
+ * epoch-aware contracts the epoch to target.
76
+ *
77
+ * Probes `supportsInterface(0x8c0524c4)` (epoch-aware), then
78
+ * `supportsInterface(0x8fd37527)` (legacy), and finally falls back to
79
+ * `currentAppEpoch()`, treating a contract rejection as legacy. Transport
80
+ * failures are rethrown instead of being cached as a verdict.
81
+ */
82
+ export declare function resolveAppEpochPlan(publicClient: PublicClient, appContractAddress: Address): Promise<AppEpochPlan>;
83
+ /**
84
+ * Decide how to write an allowlist value.
85
+ *
86
+ * - legacy contract — the epoch-less setter; an explicit `epoch` is an error
87
+ * because the contract cannot express it;
88
+ * - epoch-aware contract with `epoch` — write exactly that epoch;
89
+ * - epoch-aware contract without `epoch` — additions write
90
+ * `[currentAppEpoch, currentAppEpoch + 1]` (the contract caps writes at
91
+ * `currentAppEpoch + 1`), removals write `[0, currentAppEpoch + 1]` because
92
+ * the contract still authorizes every epoch ≤ current, so skipping history
93
+ * would leave the revoked value fetchable at older epochs.
94
+ *
95
+ * The plan is computed from a `currentAppEpoch` read taken before signing. An
96
+ * `advanceAppEpoch` landing between the read and execution is not detectable
97
+ * on-chain (historical epochs stay writable), so the guarantee is "current
98
+ * and next as of planning time", not as of execution.
99
+ */
100
+ export declare function resolveAppEpochWritePlan(publicClient: PublicClient, appContractAddress: Address, requestedEpoch?: number, change?: "add" | "remove"): Promise<AppEpochWritePlan>;
101
+ /** The epoch rows a write plan touches, for result metadata. */
102
+ export declare function epochsWritten(plan: AppEpochWritePlan): EpochsWritten | undefined;
103
+ /** Write a device row through the generation-appropriate setter. */
104
+ export declare function writeDeviceAllowlist(context: AppPolicyWriteContext, change: "add" | "remove", plan: AppEpochWritePlan, deviceId: Hex): Promise<Hash>;
105
+ /** Write a compose-hash row through the generation-appropriate setter. */
106
+ export declare function writeComposeHashAllowlist(context: AppPolicyWriteContext, change: "add" | "remove", plan: AppEpochWritePlan, composeHash: Hex): Promise<Hash>;
@@ -3,8 +3,11 @@ import { type Chain, type Address, type PublicClient } from "viem";
3
3
  /**
4
4
  * Query the on-chain device allowlist for a DstackApp contract.
5
5
  *
6
- * Checks a list of candidate device IDs against the contract's
7
- * `allowedDeviceIds` mapping and returns the ones that are allowed.
6
+ * Checks a list of candidate device IDs against the contract's device rows and
7
+ * returns the ones that are allowed. The row reads are epoch-aware: contracts
8
+ * without app epochs use the `allowedDeviceIds` getter, epoch-aware contracts
9
+ * use `allowedDeviceIdsAtEpoch(currentAppEpoch, …)` because the plain getter
10
+ * only ever reports epoch-0 rows.
8
11
  *
9
12
  * @group Actions
10
13
  * @since 0.6.0
@@ -30,6 +33,11 @@ export type GetAllowedDevicesRequest = {
30
33
  appAddress: Address;
31
34
  /** Candidate device IDs to check against the on-chain allowlist. */
32
35
  deviceIds: string[];
36
+ /**
37
+ * Read the allowlist at this app epoch instead of the current one. Only
38
+ * meaningful on epoch-aware contracts; ignored on legacy contracts.
39
+ */
40
+ epoch?: number;
33
41
  publicClient?: PublicClient;
34
42
  };
35
43
  export declare const GetAllowedDevicesSchema: z.ZodObject<{