phala 1.0.19 → 1.0.21
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 +36 -7
- package/dist/api/index.d.ts +15 -25
- package/dist/api/index.js +1 -1
- package/dist/chunk-7WG72Q7R.js +58 -0
- package/dist/chunk-7WG72Q7R.js.map +1 -0
- package/dist/index.js +25 -42
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/chunk-X3GHW5ET.js +0 -58
- package/dist/chunk-X3GHW5ET.js.map +0 -1
package/README.md
CHANGED
@@ -63,7 +63,7 @@ ___
|
|
63
63
|
|
64
64
|
To deploy applications to Phala Cloud, you'll need an API key:
|
65
65
|
|
66
|
-
- Visit [Phala Cloud](https://cloud.phala.network/login) to log into your Phala Cloud account. If you do not have an account, registe [here](https://cloud.phala.network/register?invite=beta)
|
66
|
+
- Visit [Phala Cloud](https://cloud.phala.network/login) to log into your Phala Cloud account. If you do not have an account, registe [here](https://cloud.phala.network/register?invite=beta).
|
67
67
|
- After logging in, navigate to the "API Keys" section in your profile
|
68
68
|
- Create a new API key with an appropriate name (e.g., "CLI Access")
|
69
69
|
- Copy the generated API key - you'll need it for authentication
|
@@ -243,18 +243,21 @@ phala auth logout
|
|
243
243
|
#### Status
|
244
244
|
|
245
245
|
```bash
|
246
|
-
phala
|
246
|
+
phala status [options]
|
247
247
|
```
|
248
248
|
|
249
|
-
Check your authentication status with Phala Cloud. Displays user information
|
249
|
+
Check your authentication status with Phala Cloud. Displays user information including API endpoint, username, and current workspace.
|
250
|
+
|
251
|
+
> **Note**: `phala auth status` is still available for backward compatibility, but it's recommended to use `phala status` instead.
|
250
252
|
|
251
253
|
**Options:**
|
252
254
|
- `-j, --json`: Output in JSON format
|
255
|
+
- `-d, --debug`: Enable debug output
|
253
256
|
|
254
257
|
**Example:**
|
255
258
|
```bash
|
256
|
-
phala
|
257
|
-
phala
|
259
|
+
phala status
|
260
|
+
phala status --json
|
258
261
|
```
|
259
262
|
|
260
263
|
### Docker Management Commands
|
@@ -339,7 +342,15 @@ phala docker generate --image my-tee-app --tag v1.0.0 --env-file ./.env
|
|
339
342
|
|
340
343
|
### TEE Simulator Commands
|
341
344
|
|
342
|
-
Commands for managing the local TEE simulator for development and testing.
|
345
|
+
Commands for managing the local TEE simulator for development and testing. When run without subcommands, shows the current status of the simulator.
|
346
|
+
|
347
|
+
#### Check Status
|
348
|
+
|
349
|
+
```bash
|
350
|
+
phala simulator
|
351
|
+
```
|
352
|
+
|
353
|
+
Shows the current status of the TEE simulator, including the process ID and endpoint information if running.
|
343
354
|
|
344
355
|
#### Start Simulator
|
345
356
|
|
@@ -352,10 +363,16 @@ Start the TEE simulator locally for development and testing.
|
|
352
363
|
**Options:**
|
353
364
|
|
354
365
|
- `-p, --port <port>`: Port to bind the simulator to (default: 8000)
|
366
|
+
- `-v, --verbose`: Enable verbose output
|
367
|
+
|
368
|
+
**Examples:**
|
355
369
|
|
356
|
-
**Example:**
|
357
370
|
```bash
|
371
|
+
# Start with default options
|
358
372
|
phala simulator start
|
373
|
+
|
374
|
+
# Start with verbose output
|
375
|
+
phala simulator start --verbose
|
359
376
|
```
|
360
377
|
|
361
378
|
#### Stop Simulator
|
@@ -367,10 +384,22 @@ phala simulator stop
|
|
367
384
|
Stop the running TEE simulator.
|
368
385
|
|
369
386
|
**Example:**
|
387
|
+
|
370
388
|
```bash
|
371
389
|
phala simulator stop
|
372
390
|
```
|
373
391
|
|
392
|
+
#### Environment Variables
|
393
|
+
|
394
|
+
When the simulator is running, you'll need to set these environment variables to use it:
|
395
|
+
|
396
|
+
```bash
|
397
|
+
export DSTACK_SIMULATOR_ENDPOINT=/path/to/dstack.sock
|
398
|
+
export TAPPD_SIMULATOR_ENDPOINT=/path/to/tappd.sock
|
399
|
+
```
|
400
|
+
|
401
|
+
These variables will be automatically displayed when you run `phala simulator` while the simulator is running.
|
402
|
+
|
374
403
|
### Cloud Virtual Machine (CVM) Commands
|
375
404
|
|
376
405
|
Commands for managing Cloud Virtual Machines (CVMs) on Phala Cloud.
|
package/dist/api/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ZodType, ParseInput, ParseReturnType, RawCreateParams, ZodTypeDef, z } from 'zod';
|
2
|
-
import
|
2
|
+
import * as _phala_cloud from '@phala/cloud';
|
3
3
|
|
4
4
|
type ZodDecimalCheck = {
|
5
5
|
kind: 'precision';
|
@@ -2187,11 +2187,11 @@ declare const postCvmResponseSchema: z.ZodObject<{
|
|
2187
2187
|
created_at: z.ZodString;
|
2188
2188
|
encrypted_env_pubkey: z.ZodString;
|
2189
2189
|
}, "strip", z.ZodTypeAny, {
|
2190
|
+
status?: string;
|
2190
2191
|
teepod?: {
|
2191
2192
|
name?: string;
|
2192
2193
|
id?: number;
|
2193
2194
|
};
|
2194
|
-
status?: string;
|
2195
2195
|
docker_compose_file?: string;
|
2196
2196
|
features?: string[];
|
2197
2197
|
manifest_version?: number;
|
@@ -2212,11 +2212,11 @@ declare const postCvmResponseSchema: z.ZodObject<{
|
|
2212
2212
|
created_at?: string;
|
2213
2213
|
encrypted_env_pubkey?: string;
|
2214
2214
|
}, {
|
2215
|
+
status?: string;
|
2215
2216
|
teepod?: {
|
2216
2217
|
name?: string;
|
2217
2218
|
id?: number;
|
2218
2219
|
};
|
2219
|
-
status?: string;
|
2220
2220
|
docker_compose_file?: string;
|
2221
2221
|
features?: string[];
|
2222
2222
|
manifest_version?: number;
|
@@ -2275,11 +2275,11 @@ declare const getCvmByAppIdResponseSchema: z.ZodObject<{
|
|
2275
2275
|
project_id: z.ZodString;
|
2276
2276
|
project_type: z.ZodNullable<z.ZodString>;
|
2277
2277
|
}, "strip", z.ZodTypeAny, {
|
2278
|
+
status?: string;
|
2278
2279
|
teepod?: {
|
2279
2280
|
name?: string;
|
2280
2281
|
id?: number;
|
2281
2282
|
};
|
2282
|
-
status?: string;
|
2283
2283
|
name?: string;
|
2284
2284
|
vcpu?: number;
|
2285
2285
|
memory?: number;
|
@@ -2296,11 +2296,11 @@ declare const getCvmByAppIdResponseSchema: z.ZodObject<{
|
|
2296
2296
|
project_id?: string;
|
2297
2297
|
project_type?: string;
|
2298
2298
|
}, {
|
2299
|
+
status?: string;
|
2299
2300
|
teepod?: {
|
2300
2301
|
name?: string;
|
2301
2302
|
id?: number;
|
2302
2303
|
};
|
2303
|
-
status?: string;
|
2304
2304
|
name?: string;
|
2305
2305
|
vcpu?: number;
|
2306
2306
|
memory?: number;
|
@@ -3500,18 +3500,18 @@ declare const kmsListItemSchema: z.ZodObject<{
|
|
3500
3500
|
kms_contract_address: z.ZodString;
|
3501
3501
|
gateway_app_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
3502
3502
|
}, "strip", z.ZodTypeAny, {
|
3503
|
-
url?: string;
|
3504
3503
|
version?: string;
|
3505
3504
|
id?: string;
|
3506
3505
|
slug?: string;
|
3506
|
+
url?: string;
|
3507
3507
|
chain_id?: number;
|
3508
3508
|
kms_contract_address?: string;
|
3509
3509
|
gateway_app_id?: string;
|
3510
3510
|
}, {
|
3511
|
-
url?: string;
|
3512
3511
|
version?: string;
|
3513
3512
|
id?: string;
|
3514
3513
|
slug?: string;
|
3514
|
+
url?: string;
|
3515
3515
|
chain_id?: number;
|
3516
3516
|
kms_contract_address?: string;
|
3517
3517
|
gateway_app_id?: string;
|
@@ -3659,18 +3659,18 @@ declare const teepodResponseSchema: z.ZodObject<{
|
|
3659
3659
|
kms_contract_address: z.ZodString;
|
3660
3660
|
gateway_app_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
3661
3661
|
}, "strip", z.ZodTypeAny, {
|
3662
|
-
url?: string;
|
3663
3662
|
version?: string;
|
3664
3663
|
id?: string;
|
3665
3664
|
slug?: string;
|
3665
|
+
url?: string;
|
3666
3666
|
chain_id?: number;
|
3667
3667
|
kms_contract_address?: string;
|
3668
3668
|
gateway_app_id?: string;
|
3669
3669
|
}, {
|
3670
|
-
url?: string;
|
3671
3670
|
version?: string;
|
3672
3671
|
id?: string;
|
3673
3672
|
slug?: string;
|
3673
|
+
url?: string;
|
3674
3674
|
chain_id?: number;
|
3675
3675
|
kms_contract_address?: string;
|
3676
3676
|
gateway_app_id?: string;
|
@@ -3714,10 +3714,10 @@ declare const teepodResponseSchema: z.ZodObject<{
|
|
3714
3714
|
max_disk?: number;
|
3715
3715
|
};
|
3716
3716
|
kms_list?: {
|
3717
|
-
url?: string;
|
3718
3717
|
version?: string;
|
3719
3718
|
id?: string;
|
3720
3719
|
slug?: string;
|
3720
|
+
url?: string;
|
3721
3721
|
chain_id?: number;
|
3722
3722
|
kms_contract_address?: string;
|
3723
3723
|
gateway_app_id?: string;
|
@@ -3761,10 +3761,10 @@ declare const teepodResponseSchema: z.ZodObject<{
|
|
3761
3761
|
max_disk?: number;
|
3762
3762
|
};
|
3763
3763
|
kms_list?: {
|
3764
|
-
url?: string;
|
3765
3764
|
version?: string;
|
3766
3765
|
id?: string;
|
3767
3766
|
slug?: string;
|
3767
|
+
url?: string;
|
3768
3768
|
chain_id?: number;
|
3769
3769
|
kms_contract_address?: string;
|
3770
3770
|
gateway_app_id?: string;
|
@@ -4026,11 +4026,11 @@ declare const replicateCvmResponseSchema: z.ZodObject<{
|
|
4026
4026
|
created_at: z.ZodString;
|
4027
4027
|
encrypted_env_pubkey: z.ZodString;
|
4028
4028
|
}, "strip", z.ZodTypeAny, {
|
4029
|
+
status?: string;
|
4029
4030
|
teepod?: {
|
4030
4031
|
name?: string;
|
4031
4032
|
id?: number;
|
4032
4033
|
};
|
4033
|
-
status?: string;
|
4034
4034
|
docker_compose_file?: string;
|
4035
4035
|
features?: string[];
|
4036
4036
|
manifest_version?: number;
|
@@ -4051,11 +4051,11 @@ declare const replicateCvmResponseSchema: z.ZodObject<{
|
|
4051
4051
|
created_at?: string;
|
4052
4052
|
encrypted_env_pubkey?: string;
|
4053
4053
|
}, {
|
4054
|
+
status?: string;
|
4054
4055
|
teepod?: {
|
4055
4056
|
name?: string;
|
4056
4057
|
id?: number;
|
4057
4058
|
};
|
4058
|
-
status?: string;
|
4059
4059
|
docker_compose_file?: string;
|
4060
4060
|
features?: string[];
|
4061
4061
|
manifest_version?: number;
|
@@ -4323,17 +4323,7 @@ declare const cvmAttestationResponseSchema: z.ZodObject<{
|
|
4323
4323
|
*/
|
4324
4324
|
declare function getUserInfo(): Promise<GetUserInfoResponse>;
|
4325
4325
|
|
4326
|
-
declare
|
4327
|
-
private client;
|
4328
|
-
private apiKey;
|
4329
|
-
constructor(baseURL: string);
|
4330
|
-
get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
4331
|
-
post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
4332
|
-
put<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
4333
|
-
delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
4334
|
-
patch<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
4335
|
-
}
|
4336
|
-
declare const apiClient: ApiClient;
|
4326
|
+
declare const apiClient: _phala_cloud.Client;
|
4337
4327
|
|
4338
4328
|
/**
|
4339
4329
|
* Get all CVMs for the current user
|
@@ -4483,4 +4473,4 @@ declare function getTeepods(): Promise<TeepodResponse>;
|
|
4483
4473
|
*/
|
4484
4474
|
declare function getTeepodImages(teepodId: string): Promise<Image[]>;
|
4485
4475
|
|
4486
|
-
export {
|
4476
|
+
export { Capacity, CertificateInfo, CertificateNameInfo, ComposeFile, Configuration, CvmAttestationResponse, CvmComposeConfig, CvmInstance, DockerConfig, EncryptedEnvItem, GetCvmByAppIdResponse, GetCvmNetworkResponse, GetCvmsByUserIdResponse, GetPubkeyFromCvmResponse, GetUserInfoResponse, Hosted, Image, KmsListItem, ManagedUser, Node, PostCvmResponse, ReplicateCvmResponse, ResizeCvmPayload, TCBEventLogEntry, TCBInfo, TEEPod, TeepodResponse, UpdateCvmPayload, UpgradeCvmResponse, VMConfig, apiClient, capacitySchema, checkCvmExists, composeFileSchema, configurationSchema, createCvm, cvmAttestationResponseSchema, cvmComposeConfigSchema, cvmInstanceSchema, deleteCvm, dockerConfigSchema, encryptedEnvItemSchema, getCvmAttestation, getCvmByAppId, getCvmByAppIdResponseSchema, getCvmComposeConfig, getCvmNetwork, getCvmNetworkResponseSchema, getCvms, getCvmsByUserIdResponseSchema, getPubkeyFromCvm, getPubkeyFromCvmResponseSchema, getTeepodImages, getTeepods, getUserInfo, getUserInfoResponseSchema, hostedSchema, imageSchema, kmsListItemSchema, managedUserSchema, nodeSchema, postCvmResponseSchema, replicateCvm, replicateCvmResponseSchema, resizeCvm, restartCvm, selectCvm, startCvm, stopCvm, teepodResponseSchema, teepodSchema, updateCvm, upgradeCvm, upgradeCvmResponseSchema };
|
package/dist/api/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{
|
1
|
+
import{A as l,B as n,C as q,D as s,E as u,F as v,G as w,H as y,I as z,J as A,K as B,L as C,M as D,N as E,O as F,P as G,Q as H,R as I,S as J,T as K,U as L,V as M,W as N,X as O,Y as P,Z as Q,_ as R,b as o,k as r,l as e,m as f,n as m,o as p,p as t,q as x,r as a,s as b,t as c,u as d,v as g,w as h,x as i,y as j,z as k}from"../chunk-7WG72Q7R.js";export{o as apiClient,l as capacitySchema,A as checkCvmExists,e as composeFileSchema,f as configurationSchema,E as createCvm,w as cvmAttestationResponseSchema,u as cvmComposeConfigSchema,x as cvmInstanceSchema,J as deleteCvm,r as dockerConfigSchema,i as encryptedEnvItemSchema,M as getCvmAttestation,B as getCvmByAppId,c as getCvmByAppIdResponseSchema,N as getCvmComposeConfig,D as getCvmNetwork,s as getCvmNetworkResponseSchema,z as getCvms,g as getCvmsByUserIdResponseSchema,C as getPubkeyFromCvm,b as getPubkeyFromCvmResponseSchema,R as getTeepodImages,Q as getTeepods,y as getUserInfo,d as getUserInfoResponseSchema,m as hostedSchema,j as imageSchema,n as kmsListItemSchema,p as managedUserSchema,t as nodeSchema,a as postCvmResponseSchema,O as replicateCvm,v as replicateCvmResponseSchema,P as resizeCvm,H as restartCvm,L as selectCvm,F as startCvm,G as stopCvm,q as teepodResponseSchema,k as teepodSchema,K as updateCvm,I as upgradeCvm,h as upgradeCvmResponseSchema};
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,58 @@
|
|
1
|
+
var me=Object.defineProperty;var ge=(r,t,n)=>t in r?me(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var Z=(r,t,n)=>(ge(r,typeof t!="symbol"?t+"":t,n),n);import b from"chalk";function ue(r){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return r.replace(new RegExp(t,"g"),"")}function M(r){return ue(r).length}function z(r,t){if(!r)return[""];if(M(r)<=t)return[r];let n=[],o="",m=0,i=r.split(/(\s+)/).filter(p=>p.trim().length>0);for(let p of i){let v=M(p);if(v>t){o&&(n.push(o),o="",m=0),n.push(p);continue}m+v+(m>0?1:0)>t?(n.push(o),o=p,m=v):o?(o=`${o} ${p}`,m+=v+1):(o=p,m=v)}return o&&n.push(o),n}var S={error:(r,...t)=>{console.error(b.red("\u2717"),b.red(r),...t)},warn:(r,...t)=>{console.log(b.yellow("\u26A0"),b.yellow(r),...t)},info:(r,...t)=>{console.log(b.blue("\u2139"),b.blue(r),...t)},success:(r,...t)=>{console.log(b.green("\u2713"),b.green(r),...t)},debug:(r,...t)=>{process.env.DEBUG&&console.log(b.gray("\u{1F50D}"),b.gray(r),...t)},table:(r,t)=>{if(r.length===0){console.log(b.yellow("No data to display"));return}if(t)if(typeof t[0]=="string"){let n=t.map(o=>({key:o,header:o.charAt(0).toUpperCase()+o.slice(1)}));U(r,{columns:n,borderStyle:"rounded",headerStyle:o=>b.cyan.bold(o)})}else U(r,{columns:t,borderStyle:"rounded",headerStyle:n=>b.cyan.bold(n)});else U(r,{borderStyle:"rounded",headerStyle:n=>b.cyan.bold(n)})},keyValueTable:(r,t)=>{let o={...{borderStyle:"rounded",enableTextWrapping:!0,maxDepth:2,formatKeys:!0,keyFormatter:h=>{let C=["URL","ID","API","UI","URI","CPU","GPU","RAM","JSON","XML","HTML","HTTP","HTTPS","SSH","FTP","IP","TCP","UDP","DNS","SSL","TLS","SQL","VCPU","CVM","TEE","IO"],x={teepod:"TEEPod",dstack:"Dstack"},w;h.includes("_")?w=h.split("_").map(T=>T.charAt(0).toUpperCase()+T.slice(1).toLowerCase()).join(" "):h.includes("-")?w=h.split("-").map(T=>T.charAt(0).toUpperCase()+T.slice(1).toLowerCase()).join(" "):w=h.charAt(0).toUpperCase()+h.slice(1).replace(/([a-z])([A-Z])/g,"$1 $2");for(let T of C){let $=new RegExp(`\\b${T.toLowerCase()}\\b`,"gi");w=w.replace($,T)}for(let[T,$]of Object.entries(x)){let D=new RegExp(`\\b${T}\\b`,"gi");w=w.replace(D,$)}return w},valueFormatter:h=>String(h??"")},...t},{include:m,exclude:i,keyFormatter:p,valueFormatter:v,formatKeys:R,keyWidth:k,valueWidth:E,borderStyle:A,enableTextWrapping:l,maxDepth:c}=o,a=Object.keys(r);if(m&&(a=a.filter(h=>m.includes(h))),i&&(a=a.filter(h=>!i.includes(h))),a.length===0){console.log(b.yellow("No properties to display"));return}let g=a.map(h=>{let C=r[h],x;return C==null?x="":typeof C=="object"&&!Array.isArray(C)?x=H(C,0,c):Array.isArray(C)?C.length===0?x="[]":typeof C[0]=="object"?x=`[${C.length} items]`:x=`[${C.join(", ")}]`:x=String(C),v&&(x=v(C,h)),{key:R&&p?b.cyan.bold(p(h)):b.cyan.bold(h),value:x}}),f=K(),s=k,u=E;if(s||(s=Math.max(...g.map(h=>M(h.key)),10),s=Math.min(s,Math.floor(f/3))),!u){u=Math.max(...g.map(x=>M(x.value)),10),u+=3;let h=7,C=f-s-h;u=Math.min(u,C)}let d=de(A),I=`${d.topLeft}${d.horizontal.repeat(s+2)}${d.topT}${d.horizontal.repeat(u+2)}${d.topRight}`,P=`${d.leftT}${d.horizontal.repeat(s+2)}${d.cross}${d.horizontal.repeat(u+2)}${d.rightT}`;console.log(I),console.log(P),g.forEach((h,C)=>{let x=l?z(h.key,s):[h.key],w=l?z(h.value,u):[h.value],T=Math.max(x.length,w.length);for(let $=0;$<T;$++){let D=x[$]||"",G=w[$]||"",ce=D+" ".repeat(Math.max(0,s-M(D))),pe=G+" ".repeat(Math.max(0,u-M(G)));console.log(`${d.vertical} ${ce} ${d.vertical} ${pe} ${d.vertical}`)}C<g.length-1&&console.log(`${d.leftT}${d.horizontal.repeat(s+2)}${d.cross}${d.horizontal.repeat(u+2)}${d.rightT}`)});let j=`${d.bottomLeft}${d.horizontal.repeat(s+2)}${d.bottomT}${d.horizontal.repeat(u+2)}${d.bottomRight}`;console.log(j)},startSpinner:r=>(process.stdout.write(`${b.blue("\u27F3")} ${r}... `),{stop:(t=!0,n)=>{let o=t?b.green("\u2713"):b.red("\u2717"),m=n?`: ${n}`:"";console.log(`${o}${m}`)}}),break(){console.log("")}};function H(r,t,n){if(t>=n)return"[Nested Object]";if(r==null)return"";if(Array.isArray(r))return r.length===0?"[]":`[${r.length} items]`;let o=[];for(let[m,i]of Object.entries(r))i==null?o.push(`${m}: `):typeof i=="object"?o.push(`${m}: ${H(i,t+1,n)}`):o.push(`${m}: ${i}`);return o.join(", ")}function de(r="single"){return{single:{topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502",leftT:"\u251C",rightT:"\u2524",topT:"\u252C",bottomT:"\u2534",cross:"\u253C"},double:{topLeft:"\u2554",topRight:"\u2557",bottomLeft:"\u255A",bottomRight:"\u255D",horizontal:"\u2550",vertical:"\u2551",leftT:"\u2560",rightT:"\u2563",topT:"\u2566",bottomT:"\u2569",cross:"\u256C"},rounded:{topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",leftT:"\u251C",rightT:"\u2524",topT:"\u252C",bottomT:"\u2534",cross:"\u253C"}}[r]}function K(){return process.stdout.columns||80}function fe(r,t,n={}){let o=K(),m=n.borderChars??3,p=(n.additionalBorderWidth??1)+t.length*m,v=o-p,R={},k=0,E=0;for(let c of t){let a=c.key;if(c.fixedWidth!==void 0){R[a]=c.fixedWidth,k+=c.fixedWidth;continue}let g=c.minWidth??c.header.length,f;c.getWidth?f=Math.max(g,c.header.length,...r.map(s=>c.getWidth(s))):c.getValue?f=Math.max(g,c.header.length,...r.map(s=>String(c.getValue(s)||"").length)):f=Math.max(g,c.header.length,...r.map(s=>String(s[c.key]||"").length)),R[a]=f,k+=f,E+=c.weight??1}let A=Math.max(0,v-k);if(A>0&&E>0)for(let c of t){let a=c.key;if(c.fixedWidth===void 0&&c.weight){let g=Math.floor(A*(c.weight/E));R[a]+=g}}let l=Object.values(R).reduce((c,a)=>c+a,0)+p;if(l>o){let c=v/(l-p),a={};for(let g of t){let f=g.key,s=g.minWidth??g.header.length;a[f]=Math.max(s,Math.floor(R[f]*c))}return a}return R}function U(r,t={}){if(t.keyValueMode&&r.length===1){let l=r[0],c=[];t.columns||(t.columns=Object.keys(l).map(a=>({key:a,header:a.charAt(0).toUpperCase()+a.slice(1).replace(/([A-Z])/g," $1")})));for(let a of t.columns){let g=String(a.key),f;if(a.accessor)f=a.accessor(l);else if(typeof a.key=="string"&&a.key.includes(".")){let s=a.key.split("."),u=l;for(let d of s){if(u==null){f="";break}u=u[d]}f=u}else f=l[a.key];a.formatter&&(f=a.formatter(f)),c.push({key:a.header||g,value:f})}r=c,t.columns=[{key:"key",minWidth:15},{key:"value",minWidth:20}]}if(r.length===0){console.log(b.yellow("No data to display"));return}let o={...{includeHeaders:!0,border:!0,borderStyle:"single",headerStyle:l=>b.bold(l),cellStyle:l=>l,enableTextWrapping:!0},...t},m=o.columns;if(m)m=m.map(l=>({...l,enableTextWrapping:l.enableTextWrapping!==void 0?l.enableTextWrapping:o.enableTextWrapping}));else{let l=r[0];m=Object.keys(l).map(c=>({key:c,header:c.charAt(0).toUpperCase()+c.slice(1),enableTextWrapping:o.enableTextWrapping}))}let p={single:{topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502",leftT:"\u251C",rightT:"\u2524",topT:"\u252C",bottomT:"\u2534",cross:"\u253C"},double:{topLeft:"\u2554",topRight:"\u2557",bottomLeft:"\u255A",bottomRight:"\u255D",horizontal:"\u2550",vertical:"\u2551",leftT:"\u2560",rightT:"\u2563",topT:"\u2566",bottomT:"\u2569",cross:"\u256C"},rounded:{topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",leftT:"\u251C",rightT:"\u2524",topT:"\u252C",bottomT:"\u2534",cross:"\u253C"}}[o.borderStyle],v=m.map(l=>({key:l.key,header:l.header||String(l.key),minWidth:l.minWidth||3,weight:l.weight,enableTextWrapping:l.enableTextWrapping,getValue:l.accessor?c=>l.accessor(c):c=>{if(typeof l.key=="string"&&l.key.includes(".")){let a=l.key.split("."),g=c;for(let f of a){if(g==null)return"";g=g[f]}return g??""}return c[l.key]??""}})),R=fe(r,v),k=m.map((l,c)=>({...l,width:R[v[c].key]})),E=k.map(l=>l.header||String(l.key)),A=(l,c)=>{let a=k.map(s=>{let u;if(s.accessor)u=s.accessor(l);else if(typeof s.key=="string"&&s.key.includes(".")){let I=s.key.split("."),P=l;for(let j of I){if(P==null){u="";break}P=P[j]}u=P??""}else u=l[s.key]??"";let d=s.formatter?s.formatter(u):String(u||"");return s.enableTextWrapping?{lines:z(d,s.width),key:String(s.key)}:{lines:[d.length>s.width?d.substring(0,s.width-1)+"\u2026":d],key:String(s.key)}}),g=Math.max(...a.map(s=>s.lines.length)),f=[];for(let s=0;s<g;s++){let u=a.map((d,I)=>{let P=d.lines[s]||"";return o.cellStyle(P.padEnd(k[I].width),c,d.key)});f.push(u)}return f};if(o.border){let l=p.topLeft+k.map(a=>p.horizontal.repeat(a.width+2)).join(p.topT)+p.topRight;if(console.log(l),o.includeHeaders){let a=k.map((s,u)=>({lines:s.enableTextWrapping?z(E[u],s.width):[E[u]],width:s.width})),g=Math.max(...a.map(s=>s.lines.length));for(let s=0;s<g;s++){let u=p.vertical+a.map(d=>{let I=d.lines[s]||"";return" "+o.headerStyle(I.padEnd(d.width))+" "}).join(p.vertical)+p.vertical;console.log(u)}let f=p.leftT+k.map(s=>p.horizontal.repeat(s.width+2)).join(p.cross)+p.rightT;console.log(f)}r.forEach((a,g)=>{let f=A(a,g);if(f.forEach(s=>{console.log(p.vertical+s.map(u=>` ${u} `).join(p.vertical)+p.vertical)}),g<r.length-1&&f.length>1){let s=p.leftT+k.map(u=>p.horizontal.repeat(u.width+2)).join(p.cross)+p.rightT;console.log(s)}});let c=p.bottomLeft+k.map(a=>p.horizontal.repeat(a.width+2)).join(p.bottomT)+p.bottomRight;console.log(c)}else{if(o.includeHeaders){let l=k.map((g,f)=>({lines:g.enableTextWrapping?z(E[f],g.width):[E[f]],width:g.width})),c=Math.max(...l.map(g=>g.lines.length));for(let g=0;g<c;g++){let f=l.map(s=>{let u=s.lines[g]||"";return o.headerStyle(u.padEnd(s.width))}).join(" ");console.log(f)}let a=k.map(g=>"\u2500".repeat(g.width)).join(" ");console.log(a)}r.forEach((l,c)=>{let a=A(l,c);a.forEach(g=>{console.log(g.join(" "))}),c<r.length-1&&a.length>1&&console.log("")})}console.log(`Total: ${r.length} rows`)}import{createClient as he}from"@phala/cloud";var _=he();import{z as e}from"zod";import{INVALID as be,ParseStatus as ye,ZodIssueCode as V,ZodParsedType as Y,ZodType as _e,addIssueToContext as O,z as q}from"zod";var ve="ZodDecimal",Ce=/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,N=class extends _e{_parse(t){if(t.data!==null&&typeof t.data=="object"&&"toNumber"in t.data&&(t.data=t.data.toNumber()),this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Y.number){let i=this._getOrReturnCtx(t);return O(i,{code:V.invalid_type,expected:Y.number,received:i.parsedType}),be}let o,m=new ye;for(let i of this._def.checks)if(i.kind==="precision"){let p=t.data.toString().match(Ce);Math.max((p[1]?p[1].length:0)-(p[2]?parseInt(p[2],10):0),0)>i.value&&(o=this._getOrReturnCtx(t,o),O(o,{code:V.custom,message:i.message,params:{precision:i.value}}),m.dirty())}else i.kind==="wholeNumber"?t.data.toString().split(".")[0].length>i.value&&(o=this._getOrReturnCtx(t,o),O(o,{code:V.custom,message:i.message,params:{wholeNumber:i.value}}),m.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(o=this._getOrReturnCtx(t,o),O(o,{code:V.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),m.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(o=this._getOrReturnCtx(t,o),O(o,{code:V.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),m.dirty()):i.kind==="finite"&&(Number.isFinite(t.data)||(o=this._getOrReturnCtx(t,o),O(o,{code:V.not_finite,message:i.message}),m.dirty()));return{status:m.value,value:t.data}}setLimit(t,n,o,m){return new N({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:o,message:m}]})}_addCheck(t){return new N({...this._def,checks:[...this._def.checks,t]})}lte(t,n){return this.setLimit("max",t,!0,n)}lt(t,n){return this.setLimit("max",t,!1,n)}max=this.lte;gt(t,n){return this.setLimit("min",t,!1,n)}gte(t,n){return this.setLimit("min",t,!0,n)}min=this.gte;precision(t,n){return this._addCheck({kind:"precision",value:t,message:n})}wholeNumber(t,n){return this._addCheck({kind:"wholeNumber",value:t,message:n})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:t})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:t})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:t})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:t})}finite(t){return this._addCheck({kind:"finite",message:t})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:t})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:t})}get isFinite(){let t=null,n=null;for(let o of this._def.checks){if(o.kind==="finite")return!0;o.kind==="min"?(n===null||o.value>n)&&(n=o.value):o.kind==="max"&&(t===null||o.value<t)&&(t=o.value)}return Number.isFinite(n)&&Number.isFinite(t)}},L=N;Z(L,"create",t=>new N({checks:[],typeName:ve,coerce:t?.coerce??!1}));var Ge=q.object({template:q.string().min(1,"Template cannot be empty")});var ke=e.object({password:e.string(),registry:e.string().nullable(),username:e.string()}),xe=e.object({docker_compose_file:e.string(),docker_config:ke.optional().nullable(),features:e.array(e.string()),kms_enabled:e.boolean(),manifest_version:e.number(),name:e.string(),public_logs:e.boolean(),public_sysinfo:e.boolean(),runner:e.string().optional(),salt:e.string().nullable().optional(),tproxy_enabled:e.boolean(),version:e.string().optional()}).passthrough(),Se=e.object({name:e.string(),image:e.string(),compose_file:xe.nullable().optional(),vcpu:e.number(),memory:e.number(),disk_size:e.number(),ports:e.array(e.any())}).passthrough(),Te=e.object({id:e.string(),name:e.string(),status:e.string(),uptime:e.string(),app_url:e.string().nullable(),app_id:e.string(),instance_id:e.string().nullable(),configuration:Se.nullable().optional(),exited_at:e.string().nullable(),boot_progress:e.string().nullable(),boot_error:e.string().nullable(),shutdown_progress:e.string().nullable(),image_version:e.string().nullable()}).passthrough(),we=e.object({id:e.number(),username:e.string()}),Re=e.object({id:e.number(),name:e.string(),region_identifier:e.string().optional()}),F=e.object({hosted:Te,name:e.string(),managed_user:we,node:Re,listed:e.boolean(),status:e.string(),in_progress:e.boolean(),dapp_dashboard_url:e.string().nullable(),syslog_endpoint:e.string(),allow_upgrade:e.boolean()}),W=e.object({id:e.number(),name:e.string(),status:e.string(),teepod_id:e.number().nullable(),teepod:e.object({id:e.number(),name:e.string()}).nullable(),user_id:e.number(),app_id:e.string(),vm_uuid:e.string().nullable(),instance_id:e.string().nullable(),app_url:e.string().nullable(),base_image:e.string(),vcpu:e.number(),memory:e.number(),disk_size:e.number(),manifest_version:e.number(),version:e.string(),runner:e.string(),docker_compose_file:e.string(),features:e.array(e.string()).nullable(),created_at:e.string(),encrypted_env_pubkey:e.string()}),J=e.object({app_env_encrypt_pubkey:e.string(),app_id_salt:e.string()}),X=e.object({id:e.number(),teepod_id:e.number().nullable(),teepod:e.object({id:e.number(),name:e.string()}).nullable(),name:e.string(),status:e.string(),in_progress:e.boolean(),app_id:e.string(),vm_uuid:e.string(),instance_id:e.string().nullable(),vcpu:e.number(),memory:e.number(),disk_size:e.number(),base_image:e.string(),encrypted_env_pubkey:e.string(),listed:e.boolean(),project_id:e.string(),project_type:e.string().nullable()}),Q=e.object({username:e.string(),email:e.string(),credits:L.create({coerce:!0}),granted_credits:L.create({coerce:!0}),role:e.string(),avatar:e.string(),flag_reset_password:e.boolean(),team_name:e.string(),team_tier:e.string(),trial_ended_at:e.string().nullable()}),qe=e.array(F),ee=e.object({detail:e.string()}),Je=e.object({key:e.string(),value:e.string()}),B=e.object({name:e.string(),description:e.string().optional(),version:e.array(e.number()).optional(),is_dev:e.boolean().optional(),os_image_hash:e.string().nullable().optional(),rootfs_hash:e.string().optional(),shared_ro:e.boolean().optional(),cmdline:e.string().optional(),kernel:e.string().optional(),initrd:e.string().optional(),hda:e.string().nullable().optional(),rootfs:e.string().optional(),bios:e.string().optional()}),Ee=e.object({teepod_id:e.number().nullable(),id:e.number().optional(),name:e.string(),listed:e.boolean().optional(),resource_score:e.number().optional(),remaining_vcpu:e.number().optional(),remaining_memory:e.number().optional(),remaining_cvm_slots:e.number().optional(),images:e.array(B).optional(),region_identifier:e.string().optional(),dedicated_for_team_id:e.number().nullable().optional(),support_onchain_kms:e.boolean().optional(),fmspc:e.string().nullable().optional(),device_id:e.string().nullable().optional()}),Pe=e.object({max_instances:e.number().nullable(),max_vcpu:e.number().nullable(),max_memory:e.number().nullable(),max_disk:e.number().nullable()}),$e=e.object({id:e.string(),slug:e.string(),url:e.string(),version:e.string(),chain_id:e.number(),kms_contract_address:e.string(),gateway_app_id:e.string().nullable().optional()}),te=e.object({tier:e.string(),capacity:Pe,nodes:e.array(Ee),kms_list:e.array($e).optional()}),re=e.object({is_online:e.boolean(),is_public:e.boolean(),error:e.string().nullable(),internal_ip:e.string(),latest_handshake:e.string(),public_urls:e.array(e.object({app:e.string(),instance:e.string()}))}),ne=e.object({compose_file:e.object({bash_script:e.string().nullable(),docker_compose_file:e.string(),docker_config:e.object({password:e.string(),registry:e.string().nullable(),username:e.string()}),features:e.array(e.string()),kms_enabled:e.boolean(),manifest_version:e.number(),name:e.string(),pre_launch_script:e.string(),public_logs:e.boolean(),public_sysinfo:e.boolean(),runner:e.string(),salt:e.string(),tproxy_enabled:e.boolean(),version:e.string()}),env_pubkey:e.string(),salt:e.string()}),oe=e.object({id:e.number(),name:e.string(),status:e.string(),teepod_id:e.number(),teepod:e.object({id:e.number(),name:e.string()}),user_id:e.number(),app_id:e.string(),vm_uuid:e.string(),instance_id:e.string().nullable(),app_url:e.string().nullable(),base_image:e.string(),vcpu:e.number(),memory:e.number(),disk_size:e.number(),manifest_version:e.number(),version:e.string().nullable(),runner:e.string(),docker_compose_file:e.string(),features:e.array(e.string()).nullable(),created_at:e.string(),encrypted_env_pubkey:e.string()}),se=e.object({is_online:e.boolean(),is_public:e.boolean(),error:e.string().nullable(),app_certificates:e.array(e.object({subject:e.object({common_name:e.string().nullable(),organization:e.string().nullable(),country:e.string().nullable(),state:e.string().nullable().optional(),locality:e.string().nullable().optional()}),issuer:e.object({common_name:e.string().nullable(),organization:e.string().nullable(),country:e.string().nullable()}),serial_number:e.string(),not_before:e.string(),not_after:e.string(),version:e.string(),fingerprint:e.string(),signature_algorithm:e.string(),sans:e.string().nullable(),is_ca:e.boolean(),position_in_chain:e.number(),quote:e.string().nullable()})).nullable(),tcb_info:e.object({mrtd:e.string(),rootfs_hash:e.string(),rtmr0:e.string(),rtmr1:e.string(),rtmr2:e.string(),rtmr3:e.string(),event_log:e.array(e.object({imr:e.number(),event_type:e.number(),digest:e.string(),event:e.string(),event_payload:e.string()}))}).nullable(),compose_file:e.string().nullable()});var Qe=process.env.CLOUD_URL||"https://cloud.phala.network";var et=2,tt=4096,rt=40,nt="dstack-0.3.6",y={USER_INFO:"auth/me",TEEPODS:"teepods/available",TEEPOD_IMAGES:r=>`teepods/${r}/images`,CVMS:r=>`cvms?user_id=${r}`,CVM_BY_APP_ID:r=>`cvms/app_${r}`,CVM_NETWORK:r=>`cvms/app_${r}/network`,CVM_START:r=>`cvms/app_${r}/start`,CVM_STOP:r=>`cvms/app_${r}/stop`,CVM_RESTART:r=>`cvms/app_${r}/restart`,CVM_LOGS:r=>`cvms/app_${r}/logs`,CVM_FROM_CONFIGURATION:"cvms/from_cvm_configuration",CVM_PUBKEY:"cvms/pubkey/from_cvm_configuration",CVM_UPGRADE:r=>`cvms/app_${r}/compose`,CVM_ATTESTATION:r=>`cvms/app_${r}/attestation`,CVM_RESIZE:r=>`cvms/app_${r}/resources`,CVM_COMPOSE:r=>`cvms/${r}/compose`,REPLICATE_CVM:r=>`cvms/${r}/replicas`},ot=`version: '3.8'
|
2
|
+
services:
|
3
|
+
postgres:
|
4
|
+
image: ankane/pgvector:latest
|
5
|
+
environment:
|
6
|
+
- POSTGRES_PASSWORD=postgres
|
7
|
+
- POSTGRES_USER=postgres
|
8
|
+
- POSTGRES_DB=eliza
|
9
|
+
- PGDATA=/var/lib/postgresql/data/pgdata
|
10
|
+
volumes:
|
11
|
+
- postgres-data:/var/lib/postgresql/data:rw
|
12
|
+
ports:
|
13
|
+
- '127.0.0.1:5432:5432'
|
14
|
+
healthcheck:
|
15
|
+
test: ['CMD-SHELL', 'pg_isready -U $\${POSTGRES_USER} -d $\${POSTGRES_DB}']
|
16
|
+
interval: 5s
|
17
|
+
timeout: 5s
|
18
|
+
retries: 5
|
19
|
+
restart: always
|
20
|
+
networks:
|
21
|
+
- eliza-network
|
22
|
+
eliza:
|
23
|
+
image: {{imageName}}
|
24
|
+
command: bun run start
|
25
|
+
volumes:
|
26
|
+
- /var/run/tappd.sock:/var/run/tappd.sock
|
27
|
+
environment:
|
28
|
+
{{#each envVars}} - {{{this}}}
|
29
|
+
{{/each}}
|
30
|
+
ports:
|
31
|
+
- '3000:3000'
|
32
|
+
- '50000-50100:50000-50100/udp'
|
33
|
+
depends_on:
|
34
|
+
postgres:
|
35
|
+
condition: service_healthy
|
36
|
+
restart: always
|
37
|
+
networks:
|
38
|
+
- eliza-network
|
39
|
+
|
40
|
+
|
41
|
+
networks:
|
42
|
+
eliza-network:
|
43
|
+
driver: bridge
|
44
|
+
|
45
|
+
volumes:
|
46
|
+
postgres-data:`,st=`version: '3.8'
|
47
|
+
services:
|
48
|
+
app:
|
49
|
+
image: {{imageName}}
|
50
|
+
container_name: app
|
51
|
+
volumes:
|
52
|
+
- /var/run/tappd.sock:/var/run/tappd.sock
|
53
|
+
environment:
|
54
|
+
{{#each envVars}} - {{{this}}}
|
55
|
+
{{/each}}
|
56
|
+
restart: always
|
57
|
+
`;function ie(r){try{return JSON.stringify(r)}catch(t){return t instanceof Error&&t.message.includes("cyclic")?"[Cyclic Object]":String(r)}}async function gt(){try{S.debug(`Fetching user info from ${y.USER_INFO}`);let r=await _.get(y.USER_INFO);S.debug(`Received response: ${ie(r)}`);try{return Q.parse(r)}catch(t){throw S.error(`Failed to parse user info response: ${t}`),S.debug(`Response structure: ${ie(r)}`),t}}catch(r){throw S.error(`Failed to get user info: ${r instanceof Error?r.message:String(r)}`),new Error(`Failed to get user info: ${r instanceof Error?r.message:String(r)}`)}}import Ae from"inquirer";import{z as ae}from"zod";async function le(){try{let r=await _.get(y.CVMS(0));return ae.array(F).parse(r)}catch(r){throw new Error(`Failed to get CVMs: ${r instanceof Error?r.message:String(r)}`)}}async function kt(r){let n=(await le()).find(o=>o.hosted?.app_id===r||`app_${o.hosted?.app_id}`===r);if(!n)S.error(`CVM with App ID app_${r} not detected`),process.exit(1);else return S.success(`CVM with App ID app_${r} detected`),n.hosted?.app_id||""}async function xt(r){try{let t=await _.get(y.CVM_BY_APP_ID(r));return X.parse(t)}catch(t){throw new Error(`Failed to get CVM by App ID: ${t instanceof Error?t.message:String(t)}`)}}async function St(r){try{let t=await _.post(y.CVM_PUBKEY,r);return J.parse(t)}catch(t){throw new Error(`Failed to get pubkey from CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Tt(r){try{let t=await _.get(y.CVM_NETWORK(r));return re.parse(t)}catch(t){throw new Error(`Failed to get network information for CVM: ${t instanceof Error?t.message:String(t)}`)}}async function wt(r){try{let t=await _.post(y.CVM_FROM_CONFIGURATION,r);return W.parse(t)}catch(t){throw t instanceof ae.ZodError?(S.error("Schema validation error:",JSON.stringify(t.errors,null,2)),S.error("API response:",JSON.stringify(t.format(),null,2)),new Error(`Response validation failed: ${JSON.stringify(t.errors)}`)):new Error(`Failed to create CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Rt(r){try{let t=await _.post(y.CVM_START(r));return W.parse(t)}catch(t){throw new Error(`Failed to start CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Et(r){try{let t=await _.post(y.CVM_STOP(r));return W.parse(t)}catch(t){throw new Error(`Failed to stop CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Pt(r){try{let t=await _.post(y.CVM_RESTART(r));return W.parse(t)}catch(t){throw new Error(`Failed to restart CVM: ${t instanceof Error?t.message:String(t)}`)}}async function $t(r,t){try{let n=await _.put(y.CVM_UPGRADE(r),t);return ee.parse(n)}catch(n){throw new Error(`Failed to upgrade CVM: ${n instanceof Error?n.message:String(n)}`)}}async function At(r){try{return await _.delete(y.CVM_BY_APP_ID(r)),!0}catch(t){throw new Error(`Failed to delete CVM: ${t instanceof Error?t.message:String(t)}`)}}async function It(r){try{return await _.put(y.CVM_BY_APP_ID(r.app_id),r)}catch(t){throw new Error(`Failed to update CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Mt(){let r=S.startSpinner("Fetching available CVMs"),t=await le();if(r.stop(!0),!t||t.length===0){S.info("No CVMs found for your account");return}let n=t.map(m=>{let i=m.hosted?.app_id||m.hosted?.id,p=m.name||m.hosted?.name,v=m.status||m.hosted?.status;return{name:`${p||"Unnamed"} (${i}) - Status: ${v||"Unknown"}`,value:i}}),{selectedCvm:o}=await Ae.prompt([{type:"list",name:"selectedCvm",message:"Select a CVM:",choices:n}]);return o}async function Vt(r){try{let t=await _.get(y.CVM_ATTESTATION(r));try{return se.parse(t)}catch(n){return S.debug(`Validation error: ${n instanceof Error?n.message:String(n)}`),{is_online:!!t?.is_online,is_public:!!t?.is_public,error:typeof t?.error=="string"?t.error:null,app_certificates:Array.isArray(t?.app_certificates)?t.app_certificates:null,tcb_info:t?.tcb_info||null,compose_file:typeof t?.compose_file=="string"?t.compose_file:null}}}catch(t){throw new Error(`Failed to get attestation information: ${t instanceof Error?t.message:String(t)}`)}}async function Ot(r){try{let t=await _.get(y.CVM_COMPOSE(r));return ne.parse(t)}catch(t){throw new Error(`Failed to get CVM compose config: ${t instanceof Error?t.message:String(t)}`)}}async function Lt(r,t){try{let n=await _.post(y.REPLICATE_CVM(r),t);return oe.parse(n)}catch(n){throw new Error(`Failed to replicate CVM: ${n instanceof Error?n.message:String(n)}`)}}async function zt(r,t,n,o,m){try{let i={};if(t!==void 0&&(i.vcpu=t),n!==void 0&&(i.memory=n),o!==void 0&&(i.disk_size=o),m!==void 0&&(i.allow_restart=m),Object.keys(i).length===0)throw new Error("At least one resource parameter must be provided");return await _.patch(y.CVM_RESIZE(r),i),!0}catch(i){throw new Error(`Failed to resize CVM: ${i instanceof Error?i.message:String(i)}`)}}import{z as Ie}from"zod";async function Me(){try{let r=await(await _).get(y.TEEPODS);return te.parse(r)}catch(r){throw new Error(`Failed to get TEEPods: ${r instanceof Error?r.message:String(r)}`)}}async function Ht(r){try{let n=(await Me()).nodes.find(m=>m.teepod_id===Number(r));if(n&&n.images&&n.images.length>0)return n.images;let o=await(await _).get(y.TEEPOD_IMAGES(r));return Ie.array(B).parse(o)}catch(t){throw new Error(`Failed to get TEEPod images: ${t instanceof Error?t.message:String(t)}`)}}export{S as a,_ as b,Qe as c,et as d,tt as e,rt as f,nt as g,ot as h,st as i,Ge as j,ke as k,xe as l,Se as m,Te as n,we as o,Re as p,F as q,W as r,J as s,X as t,Q as u,qe as v,ee as w,Je as x,B as y,Ee as z,Pe as A,$e as B,te as C,re as D,ne as E,oe as F,se as G,gt as H,le as I,kt as J,xt as K,St as L,Tt as M,wt as N,Rt as O,Et as P,Pt as Q,$t as R,At as S,It as T,Mt as U,Vt as V,Ot as W,Lt as X,zt as Y,Me as Z,Ht as _};
|
58
|
+
//# sourceMappingURL=chunk-7WG72Q7R.js.map
|