phala 1.0.40 → 1.1.0-beta.10

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/README.md CHANGED
@@ -446,6 +446,92 @@ Get detailed information about a specific CVM.
446
446
  phala cvms get app_123456
447
447
  ```
448
448
 
449
+ #### Deploy (Simplified)
450
+
451
+ ```bash
452
+ phala deploy [options]
453
+ ```
454
+
455
+ Create a new CVM with automatic resource matching. This is the recommended command for most users as it simplifies deployment by automatically selecting optimal resources based on availability.
456
+
457
+ **Key Features:**
458
+ - **Auto Resource Matching**: Backend automatically finds the best available node based on your requirements
459
+ - **All Parameters Optional**: Specify only what you need; the system handles the rest
460
+ - **Structured Error Messages**: Clear error codes (ERR-xxxx) with actionable suggestions
461
+ - **On-chain KMS Support**: Built-in support for decentralized key management
462
+
463
+ **Options:**
464
+ - `-n, --name <name>`: Name of the CVM (auto-generated from folder name if not provided)
465
+ - `-c, --compose <compose>`: Path to Docker Compose file (default: docker-compose.yml)
466
+ - `-t, --instance-type <type>`: Instance type (e.g., tdx.small, tdx.medium, tdx.large) - **optional**, auto-selected if not specified
467
+ - `-r, --region <region>`: Preferred region (e.g., us-west, eu-central) - **optional**, auto-selected if not specified
468
+ - `--vcpu <vcpu>`: Number of vCPUs - **optional**, auto-matched if not specified
469
+ - `--memory <memory>`: Memory with unit (e.g., 2G, 1024MB) - **optional**, auto-matched if not specified
470
+ - `--disk-size <diskSize>`: Disk size with unit (e.g., 50G, 100GB) - **optional**, auto-matched if not specified
471
+ - `--image <image>`: OS image version - **optional**, auto-selected if not specified
472
+ - `--node-id <nodeId>`: Specific node ID - **optional**, auto-selected if not specified
473
+ - `-e, --env-file <envFile>`: Path to environment variables file
474
+ - `-i, --interactive`: Enable interactive mode for required parameters
475
+ - `--kms-id <kmsId>`: KMS ID for on-chain key management
476
+ - `--private-key <key>`: Private key for on-chain KMS deployment
477
+ - `--rpc-url <url>`: RPC URL for blockchain interaction
478
+ - `--uuid <uuid>`: UUID of existing CVM to upgrade
479
+ - `--wait`: Wait for deployment/update to complete before returning
480
+ - `-j, --json`: Output in JSON format
481
+ - `-d, --debug`: Enable debug logging
482
+
483
+ **Examples:**
484
+
485
+ ```bash
486
+ # Simplest - auto-select everything
487
+ phala deploy
488
+
489
+ # Specify instance type and region
490
+ phala deploy --instance-type tdx.medium --region us-west
491
+
492
+ # Manual resource specification
493
+ phala deploy --vcpu 4 --memory 8G --disk-size 100G
494
+
495
+ # With on-chain KMS
496
+ phala deploy --kms-id ethereum --private-key <key> --rpc-url <url>
497
+
498
+ # Deploy to specific node (advanced)
499
+ phala deploy --node-id 6
500
+
501
+ # Interactive mode for guided setup
502
+ phala deploy --interactive
503
+ ```
504
+
505
+ **Error Handling:**
506
+
507
+ The deploy command provides structured error messages with unique error codes for easy troubleshooting:
508
+
509
+ ```
510
+ Error [ERR-1003]: The selected node does not have enough CPU capacity
511
+
512
+ Details:
513
+ - Need 4 CPUs, but only 2 are available
514
+ - node_id: 6
515
+
516
+ Suggestions:
517
+ - Choose a smaller instance type
518
+ - Reduce the number of CPUs requested
519
+ - Remove the --node-id flag to search all available nodes
520
+
521
+ Need help? Contact support: https://cloud.phala.network/contact
522
+ Reference error code: ERR-1003
523
+ ```
524
+
525
+ Common error codes:
526
+ - `ERR-1001`: Instance type not found
527
+ - `ERR-1002`: No available resources match requirements
528
+ - `ERR-1003`: Insufficient CPU capacity
529
+ - `ERR-1004`: Insufficient memory
530
+ - `ERR-2003`: OS image not available
531
+ - `ERR-2005`: Node not accessible
532
+
533
+ For a complete list of error codes, refer to the error code documentation.
534
+
449
535
  #### Create CVM
450
536
 
451
537
  ```bash
@@ -1,17 +1,19 @@
1
1
  import { z } from 'zod';
2
+ import { CvmLegacyDetail } from '@phala/cloud';
3
+ export { CvmLegacyDetail as CvmInfoResponse } from '@phala/cloud';
2
4
 
3
5
  declare const dockerConfigSchema: z.ZodObject<{
4
6
  password: z.ZodString;
5
7
  registry: z.ZodNullable<z.ZodString>;
6
8
  username: z.ZodString;
7
9
  }, "strip", z.ZodTypeAny, {
10
+ username?: string;
8
11
  password?: string;
9
12
  registry?: string;
10
- username?: string;
11
13
  }, {
14
+ username?: string;
12
15
  password?: string;
13
16
  registry?: string;
14
- username?: string;
15
17
  }>;
16
18
  declare const composeFileSchema: z.ZodObject<{
17
19
  docker_compose_file: z.ZodString;
@@ -20,13 +22,13 @@ declare const composeFileSchema: z.ZodObject<{
20
22
  registry: z.ZodNullable<z.ZodString>;
21
23
  username: z.ZodString;
22
24
  }, "strip", z.ZodTypeAny, {
25
+ username?: string;
23
26
  password?: string;
24
27
  registry?: string;
25
- username?: string;
26
28
  }, {
29
+ username?: string;
27
30
  password?: string;
28
31
  registry?: string;
29
- username?: string;
30
32
  }>>>;
31
33
  features: z.ZodArray<z.ZodString, "many">;
32
34
  kms_enabled: z.ZodBoolean;
@@ -45,13 +47,13 @@ declare const composeFileSchema: z.ZodObject<{
45
47
  registry: z.ZodNullable<z.ZodString>;
46
48
  username: z.ZodString;
47
49
  }, "strip", z.ZodTypeAny, {
50
+ username?: string;
48
51
  password?: string;
49
52
  registry?: string;
50
- username?: string;
51
53
  }, {
54
+ username?: string;
52
55
  password?: string;
53
56
  registry?: string;
54
- username?: string;
55
57
  }>>>;
56
58
  features: z.ZodArray<z.ZodString, "many">;
57
59
  kms_enabled: z.ZodBoolean;
@@ -70,13 +72,13 @@ declare const composeFileSchema: z.ZodObject<{
70
72
  registry: z.ZodNullable<z.ZodString>;
71
73
  username: z.ZodString;
72
74
  }, "strip", z.ZodTypeAny, {
75
+ username?: string;
73
76
  password?: string;
74
77
  registry?: string;
75
- username?: string;
76
78
  }, {
79
+ username?: string;
77
80
  password?: string;
78
81
  registry?: string;
79
- username?: string;
80
82
  }>>>;
81
83
  features: z.ZodArray<z.ZodString, "many">;
82
84
  kms_enabled: z.ZodBoolean;
@@ -104,69 +106,69 @@ declare const postCvmResponseSchema: z.ZodObject<{
104
106
  name?: string;
105
107
  id?: number;
106
108
  }>>;
107
- user_id: z.ZodNumber;
109
+ user_id: z.ZodNullable<z.ZodNumber>;
108
110
  app_id: z.ZodString;
109
111
  vm_uuid: z.ZodNullable<z.ZodString>;
110
112
  instance_id: z.ZodNullable<z.ZodString>;
111
113
  app_url: z.ZodNullable<z.ZodString>;
112
- base_image: z.ZodString;
114
+ base_image: z.ZodNullable<z.ZodString>;
113
115
  vcpu: z.ZodNumber;
114
116
  memory: z.ZodNumber;
115
117
  disk_size: z.ZodNumber;
116
- manifest_version: z.ZodNumber;
117
- version: z.ZodString;
118
- runner: z.ZodString;
119
- docker_compose_file: z.ZodString;
118
+ manifest_version: z.ZodNullable<z.ZodNumber>;
119
+ version: z.ZodNullable<z.ZodString>;
120
+ runner: z.ZodNullable<z.ZodString>;
121
+ docker_compose_file: z.ZodNullable<z.ZodString>;
120
122
  features: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
121
123
  created_at: z.ZodString;
122
- encrypted_env_pubkey: z.ZodString;
124
+ encrypted_env_pubkey: z.ZodNullable<z.ZodString>;
123
125
  }, "strip", z.ZodTypeAny, {
124
126
  status?: string;
127
+ name?: string;
128
+ vcpu?: number;
129
+ memory?: number;
130
+ id?: number;
131
+ app_id?: string;
132
+ instance_id?: string;
133
+ version?: string;
134
+ runner?: string;
125
135
  docker_compose_file?: string;
126
136
  features?: string[];
127
137
  manifest_version?: number;
128
- name?: string;
129
- runner?: string;
130
- version?: string;
131
- id?: number;
132
138
  teepod_id?: number;
133
139
  teepod?: {
134
140
  name?: string;
135
141
  id?: number;
136
142
  };
137
143
  user_id?: number;
138
- app_id?: string;
139
144
  vm_uuid?: string;
140
- instance_id?: string;
141
145
  app_url?: string;
142
146
  base_image?: string;
143
- vcpu?: number;
144
- memory?: number;
145
147
  disk_size?: number;
146
148
  created_at?: string;
147
149
  encrypted_env_pubkey?: string;
148
150
  }, {
149
151
  status?: string;
152
+ name?: string;
153
+ vcpu?: number;
154
+ memory?: number;
155
+ id?: number;
156
+ app_id?: string;
157
+ instance_id?: string;
158
+ version?: string;
159
+ runner?: string;
150
160
  docker_compose_file?: string;
151
161
  features?: string[];
152
162
  manifest_version?: number;
153
- name?: string;
154
- runner?: string;
155
- version?: string;
156
- id?: number;
157
163
  teepod_id?: number;
158
164
  teepod?: {
159
165
  name?: string;
160
166
  id?: number;
161
167
  };
162
168
  user_id?: number;
163
- app_id?: string;
164
169
  vm_uuid?: string;
165
- instance_id?: string;
166
170
  app_url?: string;
167
171
  base_image?: string;
168
- vcpu?: number;
169
- memory?: number;
170
172
  disk_size?: number;
171
173
  created_at?: string;
172
174
  encrypted_env_pubkey?: string;
@@ -175,11 +177,11 @@ declare const encryptedEnvItemSchema: z.ZodObject<{
175
177
  key: z.ZodString;
176
178
  value: z.ZodString;
177
179
  }, "strip", z.ZodTypeAny, {
178
- key?: string;
179
180
  value?: string;
180
- }, {
181
181
  key?: string;
182
+ }, {
182
183
  value?: string;
184
+ key?: string;
183
185
  }>;
184
186
  declare const getCvmNetworkResponseSchema: z.ZodObject<{
185
187
  is_online: z.ZodBoolean;
@@ -198,9 +200,9 @@ declare const getCvmNetworkResponseSchema: z.ZodObject<{
198
200
  instance?: string;
199
201
  }>, "many">;
200
202
  }, "strip", z.ZodTypeAny, {
203
+ error?: string;
201
204
  is_online?: boolean;
202
205
  is_public?: boolean;
203
- error?: string;
204
206
  internal_ip?: string;
205
207
  latest_handshake?: string;
206
208
  public_urls?: {
@@ -208,9 +210,9 @@ declare const getCvmNetworkResponseSchema: z.ZodObject<{
208
210
  instance?: string;
209
211
  }[];
210
212
  }, {
213
+ error?: string;
211
214
  is_online?: boolean;
212
215
  is_public?: boolean;
213
- error?: string;
214
216
  internal_ip?: string;
215
217
  latest_handshake?: string;
216
218
  public_urls?: {
@@ -288,69 +290,69 @@ declare const replicateCvmResponseSchema: z.ZodObject<{
288
290
  name?: string;
289
291
  id?: number;
290
292
  }>;
291
- user_id: z.ZodNumber;
293
+ user_id: z.ZodNullable<z.ZodNumber>;
292
294
  app_id: z.ZodString;
293
- vm_uuid: z.ZodString;
295
+ vm_uuid: z.ZodNullable<z.ZodString>;
294
296
  instance_id: z.ZodNullable<z.ZodString>;
295
297
  app_url: z.ZodNullable<z.ZodString>;
296
- base_image: z.ZodString;
298
+ base_image: z.ZodNullable<z.ZodString>;
297
299
  vcpu: z.ZodNumber;
298
300
  memory: z.ZodNumber;
299
301
  disk_size: z.ZodNumber;
300
- manifest_version: z.ZodNumber;
302
+ manifest_version: z.ZodNullable<z.ZodNumber>;
301
303
  version: z.ZodNullable<z.ZodString>;
302
- runner: z.ZodString;
303
- docker_compose_file: z.ZodString;
304
+ runner: z.ZodNullable<z.ZodString>;
305
+ docker_compose_file: z.ZodNullable<z.ZodString>;
304
306
  features: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
305
307
  created_at: z.ZodString;
306
- encrypted_env_pubkey: z.ZodString;
308
+ encrypted_env_pubkey: z.ZodNullable<z.ZodString>;
307
309
  }, "strip", z.ZodTypeAny, {
308
310
  status?: string;
311
+ name?: string;
312
+ vcpu?: number;
313
+ memory?: number;
314
+ id?: number;
315
+ app_id?: string;
316
+ instance_id?: string;
317
+ version?: string;
318
+ runner?: string;
309
319
  docker_compose_file?: string;
310
320
  features?: string[];
311
321
  manifest_version?: number;
312
- name?: string;
313
- runner?: string;
314
- version?: string;
315
- id?: number;
316
322
  teepod_id?: number;
317
323
  teepod?: {
318
324
  name?: string;
319
325
  id?: number;
320
326
  };
321
327
  user_id?: number;
322
- app_id?: string;
323
328
  vm_uuid?: string;
324
- instance_id?: string;
325
329
  app_url?: string;
326
330
  base_image?: string;
327
- vcpu?: number;
328
- memory?: number;
329
331
  disk_size?: number;
330
332
  created_at?: string;
331
333
  encrypted_env_pubkey?: string;
332
334
  }, {
333
335
  status?: string;
336
+ name?: string;
337
+ vcpu?: number;
338
+ memory?: number;
339
+ id?: number;
340
+ app_id?: string;
341
+ instance_id?: string;
342
+ version?: string;
343
+ runner?: string;
334
344
  docker_compose_file?: string;
335
345
  features?: string[];
336
346
  manifest_version?: number;
337
- name?: string;
338
- runner?: string;
339
- version?: string;
340
- id?: number;
341
347
  teepod_id?: number;
342
348
  teepod?: {
343
349
  name?: string;
344
350
  id?: number;
345
351
  };
346
352
  user_id?: number;
347
- app_id?: string;
348
353
  vm_uuid?: string;
349
- instance_id?: string;
350
354
  app_url?: string;
351
355
  base_image?: string;
352
- vcpu?: number;
353
- memory?: number;
354
356
  disk_size?: number;
355
357
  created_at?: string;
356
358
  encrypted_env_pubkey?: string;
@@ -507,9 +509,9 @@ declare const cvmAttestationResponseSchema: z.ZodObject<{
507
509
  }>>;
508
510
  compose_file: z.ZodNullable<z.ZodString>;
509
511
  }, "strip", z.ZodTypeAny, {
512
+ error?: string;
510
513
  is_online?: boolean;
511
514
  is_public?: boolean;
512
- error?: string;
513
515
  app_certificates?: {
514
516
  version?: string;
515
517
  subject?: {
@@ -551,9 +553,9 @@ declare const cvmAttestationResponseSchema: z.ZodObject<{
551
553
  };
552
554
  compose_file?: string;
553
555
  }, {
556
+ error?: string;
554
557
  is_online?: boolean;
555
558
  is_public?: boolean;
556
- error?: string;
557
559
  app_certificates?: {
558
560
  version?: string;
559
561
  subject?: {
@@ -611,9 +613,9 @@ declare const imageSchema: z.ZodObject<{
611
613
  bios: z.ZodOptional<z.ZodString>;
612
614
  }, "strip", z.ZodTypeAny, {
613
615
  name?: string;
616
+ description?: string;
614
617
  version?: number[];
615
618
  rootfs_hash?: string;
616
- description?: string;
617
619
  is_dev?: boolean;
618
620
  os_image_hash?: string;
619
621
  shared_ro?: boolean;
@@ -625,9 +627,9 @@ declare const imageSchema: z.ZodObject<{
625
627
  bios?: string;
626
628
  }, {
627
629
  name?: string;
630
+ description?: string;
628
631
  version?: number[];
629
632
  rootfs_hash?: string;
630
- description?: string;
631
633
  is_dev?: boolean;
632
634
  os_image_hash?: string;
633
635
  shared_ro?: boolean;
@@ -663,9 +665,9 @@ declare const teepodSchema: z.ZodObject<{
663
665
  bios: z.ZodOptional<z.ZodString>;
664
666
  }, "strip", z.ZodTypeAny, {
665
667
  name?: string;
668
+ description?: string;
666
669
  version?: number[];
667
670
  rootfs_hash?: string;
668
- description?: string;
669
671
  is_dev?: boolean;
670
672
  os_image_hash?: string;
671
673
  shared_ro?: boolean;
@@ -677,9 +679,9 @@ declare const teepodSchema: z.ZodObject<{
677
679
  bios?: string;
678
680
  }, {
679
681
  name?: string;
682
+ description?: string;
680
683
  version?: number[];
681
684
  rootfs_hash?: string;
682
- description?: string;
683
685
  is_dev?: boolean;
684
686
  os_image_hash?: string;
685
687
  shared_ro?: boolean;
@@ -706,9 +708,9 @@ declare const teepodSchema: z.ZodObject<{
706
708
  remaining_cvm_slots?: number;
707
709
  images?: {
708
710
  name?: string;
711
+ description?: string;
709
712
  version?: number[];
710
713
  rootfs_hash?: string;
711
- description?: string;
712
714
  is_dev?: boolean;
713
715
  os_image_hash?: string;
714
716
  shared_ro?: boolean;
@@ -735,9 +737,9 @@ declare const teepodSchema: z.ZodObject<{
735
737
  remaining_cvm_slots?: number;
736
738
  images?: {
737
739
  name?: string;
740
+ description?: string;
738
741
  version?: number[];
739
742
  rootfs_hash?: string;
740
- description?: string;
741
743
  is_dev?: boolean;
742
744
  os_image_hash?: string;
743
745
  shared_ro?: boolean;
@@ -773,18 +775,7 @@ interface PubkeyResponse {
773
775
  app_env_encrypt_pubkey: string;
774
776
  app_id_salt: string;
775
777
  }
776
- interface CvmInfoResponse {
777
- id: number;
778
- name: string;
779
- status: string;
780
- app_id: string;
781
- vcpu: number;
782
- memory: number;
783
- disk_size: number;
784
- base_image: string;
785
- encrypted_env_pubkey: string;
786
- env_pubkey?: string;
787
- }
778
+
788
779
  interface UpgradeResponse {
789
780
  detail?: string;
790
781
  [key: string]: unknown;
@@ -809,7 +800,8 @@ interface CvmComposeConfigResponse {
809
800
  /**
810
801
  * Check CVM exists for the current user and appId
811
802
  * @param appId App ID (with or without app_ prefix)
812
- * @returns CVM appId string (without app_ prefix) or throws if not found
803
+ * @returns CVM appId string (without app_ prefix)
804
+ * @throws Error if CVM list fetch fails or CVM not found
813
805
  */
814
806
  declare function checkCvmExists(appId: string): Promise<string>;
815
807
  /**
@@ -817,7 +809,7 @@ declare function checkCvmExists(appId: string): Promise<string>;
817
809
  * @param appId App ID (with or without app_ prefix)
818
810
  * @returns CVM details
819
811
  */
820
- declare function getCvmByAppId(appId: string): Promise<CvmInfoResponse>;
812
+ declare function getCvmByAppId(appId: string): Promise<CvmLegacyDetail>;
821
813
  /**
822
814
  * Get CVM compose configuration
823
815
  */
@@ -926,4 +918,4 @@ declare function upgradeCvm(appId: string, vmConfig: VMConfig): Promise<UpgradeR
926
918
  */
927
919
  declare function getTeepods(v03x_only?: boolean): Promise<TeepodResponse>;
928
920
 
929
- export { AvailableNodesResponse, CertificateInfo, CertificateNameInfo, ComposeFile, CvmAttestationResponse, CvmComposeConfigResponse, CvmInfoResponse, CvmListResponse, DockerConfig, EncryptedEnvItem, GetCvmNetworkResponse, Image, KmsListItem, PostCvmResponse, PubkeyResponse, ReplicateCvmResponse, ResizeCvmPayload, TCBEventLogEntry, TCBInfo, TEEPod, TeepodResponse, UpgradeResponse, UserInfoResponse, VMConfig, checkCvmExists, composeFileSchema, createCvm, cvmAttestationResponseSchema, deleteCvm, dockerConfigSchema, encryptedEnvItemSchema, getCvmAttestation, getCvmByAppId, getCvmComposeConfig, getCvmNetwork, getCvmNetworkResponseSchema, getPubkeyFromCvm, getTeepods, imageSchema, postCvmResponseSchema, replicateCvm, replicateCvmResponseSchema, resizeCvm, restartCvm, selectCvm, startCvm, stopCvm, teepodSchema, upgradeCvm };
921
+ export { AvailableNodesResponse, CertificateInfo, CertificateNameInfo, ComposeFile, CvmAttestationResponse, CvmComposeConfigResponse, CvmListResponse, DockerConfig, EncryptedEnvItem, GetCvmNetworkResponse, Image, KmsListItem, PostCvmResponse, PubkeyResponse, ReplicateCvmResponse, ResizeCvmPayload, TCBEventLogEntry, TCBInfo, TEEPod, TeepodResponse, UpgradeResponse, UserInfoResponse, VMConfig, checkCvmExists, composeFileSchema, createCvm, cvmAttestationResponseSchema, deleteCvm, dockerConfigSchema, encryptedEnvItemSchema, getCvmAttestation, getCvmByAppId, getCvmComposeConfig, getCvmNetwork, getCvmNetworkResponseSchema, getPubkeyFromCvm, getTeepods, imageSchema, postCvmResponseSchema, replicateCvm, replicateCvmResponseSchema, resizeCvm, restartCvm, selectCvm, startCvm, stopCvm, teepodSchema, upgradeCvm };