@phala/cloud 0.1.1-beta.1 → 0.1.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,78 +1,1411 @@
1
- import {
2
- ApiErrorSchema,
1
+ // src/client.ts
2
+ import { ofetch } from "ofetch";
3
+ import debug from "debug";
4
+
5
+ // src/types/client.ts
6
+ import { z } from "zod";
7
+ var ApiErrorSchema = z.object({
8
+ detail: z.union([
9
+ z.string(),
10
+ z.array(
11
+ z.object({
12
+ msg: z.string(),
13
+ type: z.string().optional(),
14
+ ctx: z.record(z.unknown()).optional()
15
+ })
16
+ ),
17
+ z.record(z.unknown())
18
+ ]),
19
+ type: z.string().optional(),
20
+ code: z.string().optional()
21
+ });
22
+ var RequestError = class _RequestError extends Error {
23
+ constructor(message, options) {
24
+ super(message);
25
+ this.name = "RequestError";
26
+ this.isRequestError = true;
27
+ this.status = options?.status;
28
+ this.statusText = options?.statusText;
29
+ this.data = options?.data;
30
+ this.request = options?.request;
31
+ this.response = options?.response;
32
+ this.detail = options?.detail || message;
33
+ this.code = options?.code;
34
+ this.type = options?.type;
35
+ }
36
+ /**
37
+ * Create RequestError from FetchError
38
+ */
39
+ static fromFetchError(error) {
40
+ const parseResult = ApiErrorSchema.safeParse(error.data);
41
+ if (parseResult.success) {
42
+ return new _RequestError(error.message, {
43
+ status: error.status ?? void 0,
44
+ statusText: error.statusText ?? void 0,
45
+ data: error.data,
46
+ request: error.request ?? void 0,
47
+ response: error.response ?? void 0,
48
+ detail: parseResult.data.detail,
49
+ code: parseResult.data.code ?? void 0,
50
+ type: parseResult.data.type ?? void 0
51
+ });
52
+ }
53
+ return new _RequestError(error.message, {
54
+ status: error.status ?? void 0,
55
+ statusText: error.statusText ?? void 0,
56
+ data: error.data,
57
+ request: error.request ?? void 0,
58
+ response: error.response ?? void 0,
59
+ detail: error.data?.detail || "Unknown API error",
60
+ code: error.status?.toString() ?? void 0
61
+ });
62
+ }
63
+ /**
64
+ * Create RequestError from generic Error
65
+ */
66
+ static fromError(error, request) {
67
+ return new _RequestError(error.message, {
68
+ request: request ?? void 0,
69
+ detail: error.message
70
+ });
71
+ }
72
+ };
73
+
74
+ // src/client.ts
75
+ var SUPPORTED_API_VERSIONS = ["2025-05-31"];
76
+ var logger = debug("phala::api-client");
77
+ function formatHeaders(headers) {
78
+ return Object.entries(headers).map(([key, value]) => ` -H "${key}: ${value}"`).join("\n");
79
+ }
80
+ function formatBody(body) {
81
+ if (!body) return "";
82
+ const bodyStr = typeof body === "string" ? body : JSON.stringify(body, null, 2);
83
+ return ` -d '${bodyStr.replace(/'/g, "\\'")}'`;
84
+ }
85
+ function formatResponse(status, statusText, headers, body) {
86
+ const headerEntries = [];
87
+ headers.forEach((value, key) => {
88
+ headerEntries.push(`${key}: ${value}`);
89
+ });
90
+ const headerStr = headerEntries.join("\n");
91
+ const bodyStr = typeof body === "string" ? body : JSON.stringify(body, null, 2);
92
+ return [
93
+ `< HTTP/1.1 ${status} ${statusText}`,
94
+ headerStr ? `< ${headerStr.replace(/\n/g, "\n< ")}` : "",
95
+ "",
96
+ bodyStr
97
+ ].filter(Boolean).join("\n");
98
+ }
99
+ var Client = class {
100
+ constructor(config = {}) {
101
+ const resolvedConfig = {
102
+ ...config,
103
+ apiKey: config.apiKey || process?.env?.PHALA_CLOUD_API_KEY,
104
+ baseURL: config.baseURL || process?.env?.PHALA_CLOUD_API_PREFIX || "https://cloud-api.phala.network/api/v1"
105
+ };
106
+ const version = resolvedConfig.version && SUPPORTED_API_VERSIONS.includes(resolvedConfig.version) ? resolvedConfig.version : SUPPORTED_API_VERSIONS[0];
107
+ this.config = resolvedConfig;
108
+ if (!resolvedConfig.useCookieAuth && !resolvedConfig.apiKey) {
109
+ throw new Error(
110
+ "API key is required. Provide it via config.apiKey or set PHALA_CLOUD_API_KEY environment variable."
111
+ );
112
+ }
113
+ const { apiKey, baseURL, timeout, headers, useCookieAuth, onResponseError, ...fetchOptions } = resolvedConfig;
114
+ const requestHeaders = {
115
+ "X-Phala-Version": version,
116
+ "Content-Type": "application/json"
117
+ };
118
+ if (headers && typeof headers === "object") {
119
+ Object.entries(headers).forEach(([key, value]) => {
120
+ if (typeof value === "string") {
121
+ requestHeaders[key] = value;
122
+ }
123
+ });
124
+ }
125
+ if (!useCookieAuth && apiKey) {
126
+ requestHeaders["X-API-Key"] = apiKey;
127
+ }
128
+ this.fetchInstance = ofetch.create({
129
+ baseURL,
130
+ timeout: timeout || 3e4,
131
+ headers: requestHeaders,
132
+ ...useCookieAuth ? { credentials: "include" } : {},
133
+ ...fetchOptions,
134
+ // Log request in cURL format
135
+ onRequest({ request, options }) {
136
+ if (logger.enabled) {
137
+ const method = options.method || "GET";
138
+ const url = typeof request === "string" ? request : request.url;
139
+ const fullUrl = url.startsWith("http") ? url : `${baseURL}${url}`;
140
+ const headerObj = {};
141
+ if (options.headers && typeof options.headers === "object") {
142
+ Object.entries(options.headers).forEach(([key, value]) => {
143
+ if (typeof value === "string") {
144
+ headerObj[key] = value;
145
+ }
146
+ });
147
+ }
148
+ const curlCommand = [
149
+ `> curl -X ${method} "${fullUrl}"`,
150
+ formatHeaders(headerObj),
151
+ options.body ? formatBody(options.body) : ""
152
+ ].filter(Boolean).join("\n");
153
+ logger("\n=== REQUEST ===\n%s\n", curlCommand);
154
+ }
155
+ },
156
+ // Log response in cURL format
157
+ onResponse({ request, response, options }) {
158
+ if (logger.enabled) {
159
+ const method = options.method || "GET";
160
+ const url = typeof request === "string" ? request : request.url;
161
+ logger(
162
+ "\n=== RESPONSE [%s %s] (%dms) ===\n%s\n",
163
+ method,
164
+ url,
165
+ response.headers.get("x-response-time") || "?",
166
+ formatResponse(response.status, response.statusText, response.headers, response._data)
167
+ );
168
+ }
169
+ },
170
+ // Generic handlers for response error (similar to request.ts)
171
+ onResponseError: ({ request, response, options }) => {
172
+ console.warn(`HTTP ${response.status}: ${response.url}`);
173
+ if (logger.enabled) {
174
+ const method = options.method || "GET";
175
+ const url = typeof request === "string" ? request : request.url;
176
+ logger(
177
+ "\n=== ERROR RESPONSE [%s %s] ===\n%s\n",
178
+ method,
179
+ url,
180
+ formatResponse(response.status, response.statusText, response.headers, response._data)
181
+ );
182
+ }
183
+ if (onResponseError) {
184
+ onResponseError({ request, response, options });
185
+ }
186
+ }
187
+ });
188
+ }
189
+ /**
190
+ * Get the underlying ofetch instance for advanced usage
191
+ */
192
+ get raw() {
193
+ return this.fetchInstance;
194
+ }
195
+ // ===== Direct methods (throw on error) =====
196
+ /**
197
+ * Perform GET request (throws on error)
198
+ */
199
+ async get(request, options) {
200
+ return this.fetchInstance(request, {
201
+ ...options,
202
+ method: "GET"
203
+ });
204
+ }
205
+ /**
206
+ * Perform POST request (throws on error)
207
+ */
208
+ async post(request, body, options) {
209
+ return this.fetchInstance(request, {
210
+ ...options,
211
+ method: "POST",
212
+ body
213
+ });
214
+ }
215
+ /**
216
+ * Perform PUT request (throws on error)
217
+ */
218
+ async put(request, body, options) {
219
+ return this.fetchInstance(request, {
220
+ ...options,
221
+ method: "PUT",
222
+ body
223
+ });
224
+ }
225
+ /**
226
+ * Perform PATCH request (throws on error)
227
+ */
228
+ async patch(request, body, options) {
229
+ return this.fetchInstance(request, {
230
+ ...options,
231
+ method: "PATCH",
232
+ body
233
+ });
234
+ }
235
+ /**
236
+ * Perform DELETE request (throws on error)
237
+ */
238
+ async delete(request, options) {
239
+ return this.fetchInstance(request, {
240
+ ...options,
241
+ method: "DELETE"
242
+ });
243
+ }
244
+ // ===== Safe methods (return SafeResult) =====
245
+ /**
246
+ * Safe wrapper for any request method (zod-style result)
247
+ */
248
+ async safeRequest(fn) {
249
+ try {
250
+ const data = await fn();
251
+ return { success: true, data };
252
+ } catch (error) {
253
+ if (error && typeof error === "object" && "data" in error) {
254
+ const requestError2 = RequestError.fromFetchError(error);
255
+ return { success: false, error: requestError2 };
256
+ }
257
+ if (error instanceof Error) {
258
+ const requestError2 = RequestError.fromError(error);
259
+ return { success: false, error: requestError2 };
260
+ }
261
+ const requestError = new RequestError("Unknown error occurred", {
262
+ detail: "Unknown error occurred"
263
+ });
264
+ return { success: false, error: requestError };
265
+ }
266
+ }
267
+ /**
268
+ * Safe GET request (returns SafeResult)
269
+ */
270
+ async safeGet(request, options) {
271
+ return this.safeRequest(() => this.get(request, options));
272
+ }
273
+ /**
274
+ * Safe POST request (returns SafeResult)
275
+ */
276
+ async safePost(request, body, options) {
277
+ return this.safeRequest(() => this.post(request, body, options));
278
+ }
279
+ /**
280
+ * Safe PUT request (returns SafeResult)
281
+ */
282
+ async safePut(request, body, options) {
283
+ return this.safeRequest(() => this.put(request, body, options));
284
+ }
285
+ /**
286
+ * Safe PATCH request (returns SafeResult)
287
+ */
288
+ async safePatch(request, body, options) {
289
+ return this.safeRequest(() => this.patch(request, body, options));
290
+ }
291
+ /**
292
+ * Safe DELETE request (returns SafeResult)
293
+ */
294
+ async safeDelete(request, options) {
295
+ return this.safeRequest(() => this.delete(request, options));
296
+ }
297
+ /**
298
+ * Extend client with additional actions
299
+ *
300
+ * @example
301
+ * ```typescript
302
+ * const client = createClient({ apiKey: 'xxx' })
303
+ * .extend(publicActions)
304
+ * .extend(cvmActions)
305
+ *
306
+ * await client.getCurrentUser() // Method call instead of function call
307
+ * ```
308
+ */
309
+ extend(actions) {
310
+ const actionsObj = typeof actions === "function" ? actions(this) : actions;
311
+ const extended = Object.create(this);
312
+ for (const [key, action] of Object.entries(actionsObj)) {
313
+ if (typeof action === "function") {
314
+ extended[key] = (...args) => action(this, ...args);
315
+ }
316
+ }
317
+ return extended;
318
+ }
319
+ };
320
+ function createClient(config = {}) {
321
+ return new Client(config);
322
+ }
323
+
324
+ // src/actions/get_current_user.ts
325
+ import { z as z2 } from "zod";
326
+
327
+ // src/utils/validate-parameters.ts
328
+ function validateActionParameters(parameters) {
329
+ if (parameters?.schema !== void 0 && parameters?.schema !== false) {
330
+ if (typeof parameters.schema !== "object" || parameters.schema === null || !("parse" in parameters.schema) || typeof parameters.schema.parse !== "function") {
331
+ throw new Error("Invalid schema: must be a Zod schema object, false, or undefined");
332
+ }
333
+ }
334
+ }
335
+ function safeValidateActionParameters(parameters) {
336
+ if (parameters?.schema !== void 0 && parameters?.schema !== false) {
337
+ if (typeof parameters.schema !== "object" || parameters.schema === null || !("parse" in parameters.schema) || typeof parameters.schema.parse !== "function") {
338
+ return {
339
+ success: false,
340
+ error: {
341
+ name: "ZodError",
342
+ message: "Invalid schema: must be a Zod schema object, false, or undefined",
343
+ issues: [
344
+ {
345
+ code: "invalid_type",
346
+ expected: "object",
347
+ received: typeof parameters.schema,
348
+ path: ["schema"],
349
+ message: "Invalid schema: must be a Zod schema object, false, or undefined"
350
+ }
351
+ ]
352
+ }
353
+ };
354
+ }
355
+ }
356
+ return void 0;
357
+ }
358
+
359
+ // src/utils/define-action.ts
360
+ function defineSimpleAction(schema, fn) {
361
+ function action(client, parameters) {
362
+ return _actionImpl(client, parameters);
363
+ }
364
+ async function _actionImpl(client, parameters) {
365
+ validateActionParameters(parameters);
366
+ const response = await fn(client);
367
+ if (parameters?.schema === false) {
368
+ return response;
369
+ }
370
+ const actualSchema = parameters?.schema || schema;
371
+ return actualSchema.parse(response);
372
+ }
373
+ function safeAction(client, parameters) {
374
+ return _safeActionImpl(client, parameters);
375
+ }
376
+ async function _safeActionImpl(client, parameters) {
377
+ const parameterValidationError = safeValidateActionParameters(parameters);
378
+ if (parameterValidationError) {
379
+ return parameterValidationError;
380
+ }
381
+ const httpResult = await (async () => {
382
+ try {
383
+ const data = await fn(client);
384
+ return { success: true, data };
385
+ } catch (error) {
386
+ if (error && typeof error === "object" && "isRequestError" in error) {
387
+ return { success: false, error };
388
+ }
389
+ if (error && typeof error === "object" && "issues" in error) {
390
+ return { success: false, error };
391
+ }
392
+ return {
393
+ success: false,
394
+ error: {
395
+ name: "Error",
396
+ message: error instanceof Error ? error.message : String(error)
397
+ }
398
+ };
399
+ }
400
+ })();
401
+ if (!httpResult.success) {
402
+ return httpResult;
403
+ }
404
+ if (parameters?.schema === false) {
405
+ return { success: true, data: httpResult.data };
406
+ }
407
+ const actualSchema = parameters?.schema || schema;
408
+ return actualSchema.safeParse(httpResult.data);
409
+ }
410
+ return {
411
+ action,
412
+ safeAction
413
+ };
414
+ }
415
+ function defineAction(schema, fn) {
416
+ function action(client, ...args) {
417
+ const [params, parameters] = args;
418
+ return _actionImpl(client, params, parameters);
419
+ }
420
+ async function _actionImpl(client, params, parameters) {
421
+ validateActionParameters(parameters);
422
+ const response = await fn(client, params);
423
+ if (parameters?.schema === false) {
424
+ return response;
425
+ }
426
+ const actualSchema = parameters?.schema || schema;
427
+ return actualSchema.parse(response);
428
+ }
429
+ function safeAction(client, ...args) {
430
+ const [params, parameters] = args;
431
+ return _safeActionImpl(client, params, parameters);
432
+ }
433
+ async function _safeActionImpl(client, params, parameters) {
434
+ const parameterValidationError = safeValidateActionParameters(parameters);
435
+ if (parameterValidationError) {
436
+ return parameterValidationError;
437
+ }
438
+ const httpResult = await (async () => {
439
+ try {
440
+ const data = await fn(client, params);
441
+ return { success: true, data };
442
+ } catch (error) {
443
+ if (error && typeof error === "object" && "isRequestError" in error) {
444
+ return { success: false, error };
445
+ }
446
+ if (error && typeof error === "object" && "issues" in error) {
447
+ return { success: false, error };
448
+ }
449
+ return {
450
+ success: false,
451
+ error: {
452
+ name: "Error",
453
+ message: error instanceof Error ? error.message : String(error)
454
+ }
455
+ };
456
+ }
457
+ })();
458
+ if (!httpResult.success) {
459
+ return httpResult;
460
+ }
461
+ if (parameters?.schema === false) {
462
+ return { success: true, data: httpResult.data };
463
+ }
464
+ const actualSchema = parameters?.schema || schema;
465
+ return actualSchema.safeParse(httpResult.data);
466
+ }
467
+ return {
468
+ action,
469
+ safeAction
470
+ };
471
+ }
472
+
473
+ // src/actions/get_current_user.ts
474
+ var CurrentUserSchema = z2.object({
475
+ username: z2.string(),
476
+ email: z2.string(),
477
+ credits: z2.number(),
478
+ granted_credits: z2.number(),
479
+ avatar: z2.string(),
480
+ team_name: z2.string(),
481
+ team_tier: z2.string()
482
+ }).passthrough();
483
+ var { action: getCurrentUser, safeAction: safeGetCurrentUser } = defineSimpleAction(
484
+ CurrentUserSchema,
485
+ async (client) => {
486
+ return await client.get("/auth/me");
487
+ }
488
+ );
489
+
490
+ // src/actions/get_available_nodes.ts
491
+ import { z as z4 } from "zod";
492
+
493
+ // src/types/kms_info.ts
494
+ import { z as z3 } from "zod";
495
+
496
+ // src/types/supported_chains.ts
497
+ import { anvil, base, mainnet } from "viem/chains";
498
+ var SUPPORTED_CHAINS = {
499
+ [mainnet.id]: mainnet,
500
+ [base.id]: base,
501
+ [anvil.id]: anvil
502
+ };
503
+
504
+ // src/types/kms_info.ts
505
+ var KmsInfoBaseSchema = z3.object({
506
+ id: z3.string(),
507
+ slug: z3.string().nullable(),
508
+ url: z3.string(),
509
+ version: z3.string(),
510
+ chain_id: z3.number().nullable(),
511
+ kms_contract_address: z3.string().nullable().transform((val) => val),
512
+ gateway_app_id: z3.string().nullable().transform((val) => val)
513
+ }).passthrough();
514
+ var KmsInfoSchema = KmsInfoBaseSchema.transform((data) => {
515
+ if (data.chain_id != null) {
516
+ const chain = SUPPORTED_CHAINS[data.chain_id];
517
+ if (chain) {
518
+ return { ...data, chain };
519
+ }
520
+ }
521
+ return data;
522
+ });
523
+
524
+ // src/actions/get_available_nodes.ts
525
+ var AvailableOSImageSchema = z4.object({
526
+ name: z4.string(),
527
+ is_dev: z4.boolean(),
528
+ version: z4.union([
529
+ z4.tuple([z4.number(), z4.number(), z4.number()]),
530
+ z4.tuple([z4.number(), z4.number(), z4.number(), z4.number()])
531
+ ]),
532
+ os_image_hash: z4.string().nullable().optional()
533
+ }).passthrough();
534
+ var TeepodCapacitySchema = z4.object({
535
+ teepod_id: z4.number(),
536
+ name: z4.string(),
537
+ listed: z4.boolean(),
538
+ resource_score: z4.number(),
539
+ remaining_vcpu: z4.number(),
540
+ remaining_memory: z4.number(),
541
+ remaining_cvm_slots: z4.number(),
542
+ images: z4.array(AvailableOSImageSchema),
543
+ support_onchain_kms: z4.boolean().optional(),
544
+ fmspc: z4.string().nullable().optional(),
545
+ device_id: z4.string().nullable().optional(),
546
+ region_identifier: z4.string().nullable().optional(),
547
+ default_kms: z4.string().nullable().optional(),
548
+ kms_list: z4.array(z4.string()).default([])
549
+ }).passthrough();
550
+ var ResourceThresholdSchema = z4.object({
551
+ max_instances: z4.number().nullable().optional(),
552
+ max_vcpu: z4.number().nullable().optional(),
553
+ max_memory: z4.number().nullable().optional(),
554
+ max_disk: z4.number().nullable().optional()
555
+ }).passthrough();
556
+ var AvailableNodesSchema = z4.object({
557
+ tier: z4.string(),
558
+ // TeamTier is string enum
559
+ capacity: ResourceThresholdSchema,
560
+ nodes: z4.array(TeepodCapacitySchema),
561
+ kms_list: z4.array(KmsInfoSchema)
562
+ }).passthrough();
563
+ var { action: getAvailableNodes, safeAction: safeGetAvailableNodes } = defineSimpleAction(
3
564
  AvailableNodesSchema,
4
- CommitCvmComposeFileUpdateRequestSchema,
565
+ async (client) => {
566
+ return await client.get("/teepods/available");
567
+ }
568
+ );
569
+
570
+ // src/actions/list-instance-types.ts
571
+ import { z as z5 } from "zod";
572
+ var ListInstanceTypesRequestSchema = z5.object({
573
+ page: z5.number().int().min(1).optional().default(1),
574
+ page_size: z5.number().int().min(1).max(1e3).optional().default(100)
575
+ }).strict();
576
+ var InstanceTypeSchema = z5.object({
577
+ id: z5.string(),
578
+ name: z5.string(),
579
+ description: z5.string(),
580
+ vcpu: z5.number(),
581
+ memory_mb: z5.number(),
582
+ hourly_rate: z5.string(),
583
+ requires_gpu: z5.boolean(),
584
+ public: z5.boolean(),
585
+ enabled: z5.boolean()
586
+ }).passthrough();
587
+ var PaginatedInstanceTypesSchema = z5.object({
588
+ items: z5.array(InstanceTypeSchema),
589
+ total: z5.number(),
590
+ page: z5.number(),
591
+ page_size: z5.number(),
592
+ pages: z5.number()
593
+ }).strict();
594
+ var { action: listInstanceTypes, safeAction: safeListInstanceTypes } = defineAction(PaginatedInstanceTypesSchema, async (client, request) => {
595
+ const validatedRequest = ListInstanceTypesRequestSchema.parse(request ?? {});
596
+ const queryParams = new URLSearchParams();
597
+ queryParams.append("page", validatedRequest.page.toString());
598
+ queryParams.append("page_size", validatedRequest.page_size.toString());
599
+ return await client.get(`/api/instance-types?${queryParams.toString()}`);
600
+ });
601
+
602
+ // src/actions/workspaces/list_workspaces.ts
603
+ import { z as z6 } from "zod";
604
+ var WorkspaceResponseSchema = z6.object({
605
+ id: z6.string(),
606
+ name: z6.string(),
607
+ slug: z6.string().nullable(),
608
+ tier: z6.string(),
609
+ role: z6.string(),
610
+ created_at: z6.string()
611
+ }).passthrough();
612
+ var PaginationMetadataSchema = z6.object({
613
+ has_more: z6.boolean(),
614
+ next_cursor: z6.string().nullable(),
615
+ total: z6.number().nullable()
616
+ }).passthrough();
617
+ var ListWorkspacesSchema = z6.object({
618
+ data: z6.array(WorkspaceResponseSchema),
619
+ pagination: PaginationMetadataSchema
620
+ }).passthrough();
621
+ var { action: listWorkspaces, safeAction: safeListWorkspaces } = defineAction(ListWorkspacesSchema, async (client, request) => {
622
+ const queryParams = new URLSearchParams();
623
+ if (request?.cursor) queryParams.append("cursor", request.cursor);
624
+ if (request?.limit) queryParams.append("limit", request.limit.toString());
625
+ const url = queryParams.toString() ? `/workspaces?${queryParams.toString()}` : "/workspaces";
626
+ return await client.get(url);
627
+ });
628
+
629
+ // src/actions/workspaces/get_workspace.ts
630
+ var { action: getWorkspace, safeAction: safeGetWorkspace } = defineAction(WorkspaceResponseSchema, async (client, teamSlug) => {
631
+ return await client.get(`/workspaces/${teamSlug}`);
632
+ });
633
+
634
+ // src/types/cvm_info.ts
635
+ import { z as z7 } from "zod";
636
+ var VmInfoSchema = z7.object({
637
+ id: z7.string(),
638
+ name: z7.string(),
639
+ status: z7.string(),
640
+ uptime: z7.string(),
641
+ app_url: z7.string().nullable(),
642
+ app_id: z7.string(),
643
+ instance_id: z7.string().nullable(),
644
+ configuration: z7.any().optional(),
645
+ // TODO: add VmConfiguration schema if needed
646
+ exited_at: z7.string().nullable(),
647
+ boot_progress: z7.string().nullable(),
648
+ boot_error: z7.string().nullable(),
649
+ shutdown_progress: z7.string().nullable(),
650
+ image_version: z7.string().nullable()
651
+ });
652
+ var ManagedUserSchema = z7.object({
653
+ id: z7.number(),
654
+ username: z7.string()
655
+ });
656
+ var CvmNodeSchema = z7.object({
657
+ id: z7.number(),
658
+ name: z7.string(),
659
+ region_identifier: z7.string().nullable().optional()
660
+ });
661
+ var CvmNetworkUrlsSchema = z7.object({
662
+ app: z7.string(),
663
+ instance: z7.string()
664
+ });
665
+ var CvmInfoSchema = z7.object({
666
+ hosted: VmInfoSchema,
667
+ name: z7.string(),
668
+ managed_user: ManagedUserSchema.nullable(),
669
+ node: CvmNodeSchema.nullable(),
670
+ listed: z7.boolean().default(false),
671
+ status: z7.string(),
672
+ in_progress: z7.boolean().default(false),
673
+ dapp_dashboard_url: z7.string().nullable(),
674
+ syslog_endpoint: z7.string().nullable(),
675
+ allow_upgrade: z7.boolean().default(false),
676
+ project_id: z7.string().nullable(),
677
+ // HashedId is represented as string in JS
678
+ project_type: z7.string().nullable(),
679
+ billing_period: z7.string().nullable(),
680
+ kms_info: KmsInfoSchema.nullable(),
681
+ vcpu: z7.number().nullable(),
682
+ memory: z7.number().nullable(),
683
+ disk_size: z7.number().nullable(),
684
+ gateway_domain: z7.string().nullable(),
685
+ public_urls: z7.array(CvmNetworkUrlsSchema)
686
+ });
687
+ var CvmLegacyDetailSchema = z7.object({
688
+ id: z7.number(),
689
+ name: z7.string(),
690
+ status: z7.string(),
691
+ in_progress: z7.boolean().optional().default(false),
692
+ teepod_id: z7.number().nullable(),
693
+ teepod: CvmNodeSchema.optional().nullable(),
694
+ app_id: z7.string(),
695
+ vm_uuid: z7.string().nullable(),
696
+ instance_id: z7.string().nullable(),
697
+ vcpu: z7.number(),
698
+ memory: z7.number(),
699
+ disk_size: z7.number(),
700
+ base_image: z7.string().nullable(),
701
+ encrypted_env_pubkey: z7.string().nullable(),
702
+ listed: z7.boolean().optional().default(false),
703
+ project_id: z7.string().optional().nullable(),
704
+ project_type: z7.string().optional().nullable(),
705
+ public_sysinfo: z7.boolean().optional().default(false),
706
+ public_logs: z7.boolean().optional().default(false),
707
+ dapp_dashboard_url: z7.string().optional().nullable(),
708
+ syslog_endpoint: z7.string().optional().nullable(),
709
+ kms_info: KmsInfoSchema.optional().nullable(),
710
+ contract_address: z7.string().optional().nullable(),
711
+ deployer_address: z7.string().optional().nullable(),
712
+ scheduled_delete_at: z7.string().optional().nullable(),
713
+ public_urls: z7.array(CvmNetworkUrlsSchema).optional().default([]),
714
+ gateway_domain: z7.string().optional().nullable()
715
+ });
716
+ var VMSchema = z7.object({
717
+ id: z7.number(),
718
+ name: z7.string(),
719
+ status: z7.string(),
720
+ teepod_id: z7.number(),
721
+ teepod: CvmNodeSchema.optional().nullable(),
722
+ user_id: z7.number().optional().nullable(),
723
+ app_id: z7.string(),
724
+ vm_uuid: z7.string().nullable(),
725
+ instance_id: z7.string().nullable(),
726
+ app_url: z7.string().optional().nullable(),
727
+ base_image: z7.string().nullable(),
728
+ vcpu: z7.number(),
729
+ memory: z7.number(),
730
+ disk_size: z7.number(),
731
+ manifest_version: z7.number().optional().nullable(),
732
+ version: z7.string().optional().nullable(),
733
+ runner: z7.string().optional().nullable(),
734
+ docker_compose_file: z7.string().optional().nullable(),
735
+ features: z7.array(z7.string()).optional().nullable(),
736
+ created_at: z7.string(),
737
+ // datetime serialized as ISO string
738
+ encrypted_env_pubkey: z7.string().nullable()
739
+ });
740
+
741
+ // src/types/cvm_id.ts
742
+ import { z as z8 } from "zod";
743
+ var CvmIdObjectSchema = z8.object({
744
+ /** Direct CVM ID (any format) */
745
+ id: z8.string().optional(),
746
+ /** UUID format (with or without dashes) */
747
+ uuid: z8.string().regex(
748
+ /^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i,
749
+ "Invalid UUID format"
750
+ ).optional(),
751
+ /** App ID (40 characters, optionally prefixed with 'app_id_') */
752
+ app_id: z8.string().optional(),
753
+ /** Instance ID (40 characters, optionally prefixed with 'instance_') */
754
+ instance_id: z8.string().optional()
755
+ });
756
+ var refineCvmId = (schema) => schema.refine(
757
+ (data) => {
758
+ const obj = data;
759
+ return !!(obj.id || obj.uuid || obj.app_id || obj.instance_id);
760
+ },
761
+ {
762
+ message: "One of id, uuid, app_id, or instance_id must be provided"
763
+ }
764
+ );
765
+ var CvmIdBaseSchema = refineCvmId(CvmIdObjectSchema);
766
+ var CvmIdSchema = CvmIdBaseSchema.transform((data) => {
767
+ let cvmId;
768
+ if (data.id) {
769
+ cvmId = data.id;
770
+ } else if (data.uuid) {
771
+ cvmId = data.uuid.replace(/-/g, "");
772
+ } else if (data.app_id) {
773
+ cvmId = data.app_id.startsWith("app_") ? data.app_id : `app_${data.app_id}`;
774
+ } else if (data.instance_id) {
775
+ cvmId = data.instance_id.startsWith("instance_") ? data.instance_id : `instance_${data.instance_id}`;
776
+ } else {
777
+ throw new Error("No valid identifier provided");
778
+ }
779
+ return { cvmId };
780
+ });
781
+
782
+ // src/actions/cvms/get_cvm_info.ts
783
+ var GetCvmInfoRequestSchema = CvmIdSchema;
784
+ var { action: getCvmInfo, safeAction: safeGetCvmInfo } = defineAction(CvmLegacyDetailSchema, async (client, request) => {
785
+ const { cvmId } = GetCvmInfoRequestSchema.parse(request);
786
+ return await client.get(`/cvms/${cvmId}`);
787
+ });
788
+
789
+ // src/actions/cvms/get_cvm_list.ts
790
+ import { z as z9 } from "zod";
791
+ var GetCvmListRequestSchema = z9.object({
792
+ page: z9.number().int().min(1).optional(),
793
+ page_size: z9.number().int().min(1).optional(),
794
+ node_id: z9.number().int().min(1).optional(),
795
+ teepod_id: z9.number().int().min(1).optional(),
796
+ user_id: z9.string().optional()
797
+ }).strict();
798
+ var GetCvmListSchema = z9.object({
799
+ items: z9.array(CvmInfoSchema),
800
+ total: z9.number(),
801
+ page: z9.number(),
802
+ page_size: z9.number(),
803
+ pages: z9.number()
804
+ }).strict();
805
+ var { action: getCvmList, safeAction: safeGetCvmList } = defineAction(GetCvmListSchema, async (client, request) => {
806
+ const validatedRequest = GetCvmListRequestSchema.parse(request ?? {});
807
+ return await client.get("/cvms/paginated", { params: validatedRequest });
808
+ });
809
+
810
+ // src/actions/cvms/provision_cvm.ts
811
+ import { z as z10 } from "zod";
812
+ var ProvisionCvmSchema = z10.object({
813
+ app_id: z10.string().nullable().optional(),
814
+ app_env_encrypt_pubkey: z10.string().nullable().optional(),
815
+ compose_hash: z10.string(),
816
+ fmspc: z10.string().nullable().optional(),
817
+ device_id: z10.string().nullable().optional(),
818
+ os_image_hash: z10.string().nullable().optional(),
819
+ teepod_id: z10.number().nullable().optional(),
820
+ // Will be transformed to node_id
821
+ node_id: z10.number().nullable().optional(),
822
+ kms_id: z10.string().nullable().optional()
823
+ }).passthrough().transform((data) => {
824
+ if ("teepod_id" in data && data.teepod_id !== void 0) {
825
+ const { teepod_id, ...rest } = data;
826
+ return { ...rest, node_id: teepod_id };
827
+ }
828
+ return data;
829
+ });
830
+ var ProvisionCvmRequestSchema = z10.object({
831
+ node_id: z10.number().optional(),
832
+ // recommended
833
+ teepod_id: z10.number().optional(),
834
+ // deprecated, for compatibility
835
+ name: z10.string(),
836
+ image: z10.string(),
837
+ vcpu: z10.number(),
838
+ memory: z10.number(),
839
+ disk_size: z10.number(),
840
+ compose_file: z10.object({
841
+ allowed_envs: z10.array(z10.string()).optional(),
842
+ pre_launch_script: z10.string().optional(),
843
+ docker_compose_file: z10.string().optional(),
844
+ name: z10.string().optional(),
845
+ kms_enabled: z10.boolean().optional(),
846
+ public_logs: z10.boolean().optional(),
847
+ public_sysinfo: z10.boolean().optional(),
848
+ gateway_enabled: z10.boolean().optional(),
849
+ // recommended
850
+ tproxy_enabled: z10.boolean().optional()
851
+ // deprecated, for compatibility
852
+ }),
853
+ listed: z10.boolean().optional(),
854
+ instance_type: z10.string().nullable().optional(),
855
+ kms_id: z10.string().optional(),
856
+ env_keys: z10.array(z10.string()).optional()
857
+ }).passthrough();
858
+ function autofillComposeFileName(appCompose) {
859
+ if (appCompose.compose_file && !appCompose.compose_file.name) {
860
+ return {
861
+ ...appCompose,
862
+ compose_file: {
863
+ ...appCompose.compose_file,
864
+ name: appCompose.name
865
+ }
866
+ };
867
+ }
868
+ return appCompose;
869
+ }
870
+ function handleGatewayCompatibility(appCompose) {
871
+ if (!appCompose.compose_file) {
872
+ return appCompose;
873
+ }
874
+ const composeFile = { ...appCompose.compose_file };
875
+ if (typeof composeFile.gateway_enabled === "boolean" && typeof composeFile.tproxy_enabled === "boolean") {
876
+ delete composeFile.tproxy_enabled;
877
+ } else if (typeof composeFile.tproxy_enabled === "boolean" && typeof composeFile.gateway_enabled === "undefined") {
878
+ composeFile.gateway_enabled = composeFile.tproxy_enabled;
879
+ delete composeFile.tproxy_enabled;
880
+ if (typeof window !== "undefined" ? window.console : globalThis.console) {
881
+ console.warn(
882
+ "[phala/cloud] tproxy_enabled is deprecated, please use gateway_enabled instead. See docs for migration."
883
+ );
884
+ }
885
+ }
886
+ return {
887
+ ...appCompose,
888
+ compose_file: composeFile
889
+ };
890
+ }
891
+ var { action: provisionCvm, safeAction: safeProvisionCvm } = defineAction(ProvisionCvmSchema, async (client, appCompose) => {
892
+ const body = handleGatewayCompatibility(autofillComposeFileName(appCompose));
893
+ let requestBody = { ...body };
894
+ if (typeof body.node_id === "number") {
895
+ requestBody = { ...body, teepod_id: body.node_id };
896
+ delete requestBody.node_id;
897
+ } else if (typeof body.teepod_id === "number") {
898
+ console.warn("[phala/cloud] teepod_id is deprecated, please use node_id instead.");
899
+ }
900
+ return await client.post("/cvms/provision", requestBody);
901
+ });
902
+
903
+ // src/actions/cvms/commit_cvm_provision.ts
904
+ import { z as z11 } from "zod";
905
+ var CommitCvmProvisionSchema = z11.object({
906
+ id: z11.number(),
907
+ name: z11.string(),
908
+ status: z11.string(),
909
+ teepod_id: z11.number(),
910
+ teepod: z11.object({
911
+ id: z11.number(),
912
+ name: z11.string()
913
+ }).nullable(),
914
+ user_id: z11.number().nullable(),
915
+ app_id: z11.string().nullable(),
916
+ vm_uuid: z11.string().nullable(),
917
+ instance_id: z11.string().nullable(),
918
+ app_url: z11.string().nullable(),
919
+ base_image: z11.string().nullable(),
920
+ vcpu: z11.number(),
921
+ memory: z11.number(),
922
+ disk_size: z11.number(),
923
+ manifest_version: z11.number().nullable(),
924
+ version: z11.string().nullable(),
925
+ runner: z11.string().nullable(),
926
+ docker_compose_file: z11.string().nullable(),
927
+ features: z11.array(z11.string()).nullable(),
928
+ created_at: z11.string(),
929
+ encrypted_env_pubkey: z11.string().nullable().optional(),
930
+ app_auth_contract_address: z11.string().nullable().optional(),
931
+ deployer_address: z11.string().nullable().optional()
932
+ }).passthrough();
933
+ var CommitCvmProvisionRequestSchema = z11.object({
934
+ encrypted_env: z11.string().optional().nullable(),
935
+ app_id: z11.string(),
936
+ compose_hash: z11.string().optional(),
937
+ kms_id: z11.string().optional(),
938
+ contract_address: z11.string().optional(),
939
+ deployer_address: z11.string().optional(),
940
+ env_keys: z11.array(z11.string()).optional().nullable()
941
+ }).passthrough();
942
+ var { action: commitCvmProvision, safeAction: safeCommitCvmProvision } = defineAction(CommitCvmProvisionSchema, async (client, payload) => {
943
+ return await client.post("/cvms", payload);
944
+ });
945
+
946
+ // src/types/app_compose.ts
947
+ import { z as z12 } from "zod";
948
+ var LooseAppComposeSchema = z12.object({
949
+ allowed_envs: z12.array(z12.string()).optional(),
950
+ docker_compose_file: z12.string(),
951
+ features: z12.array(z12.string()).optional(),
952
+ name: z12.string().optional(),
953
+ manifest_version: z12.number().optional(),
954
+ kms_enabled: z12.boolean().optional(),
955
+ public_logs: z12.boolean().optional(),
956
+ public_sysinfo: z12.boolean().optional(),
957
+ tproxy_enabled: z12.boolean().optional(),
958
+ pre_launch_script: z12.string().optional(),
959
+ env_pubkey: z12.string().optional(),
960
+ salt: z12.string().optional().nullable()
961
+ }).passthrough();
962
+
963
+ // src/actions/cvms/get_cvm_compose_file.ts
964
+ var GetCvmComposeFileRequestSchema = CvmIdSchema;
965
+ var { action: getCvmComposeFile, safeAction: safeGetCvmComposeFile } = defineAction(LooseAppComposeSchema, async (client, request) => {
966
+ const { cvmId } = GetCvmComposeFileRequestSchema.parse(request);
967
+ return await client.get(`/cvms/${cvmId}/compose_file`);
968
+ });
969
+
970
+ // src/actions/cvms/provision_cvm_compose_file_update.ts
971
+ import { z as z13 } from "zod";
972
+ var ProvisionCvmComposeFileUpdateRequestSchema = z13.object({
973
+ id: z13.string().optional(),
974
+ uuid: z13.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
975
+ app_id: z13.string().refine(
976
+ (val) => !val.startsWith("app_") && val.length === 40,
977
+ "app_id should be 40 characters without prefix"
978
+ ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
979
+ instance_id: z13.string().refine(
980
+ (val) => !val.startsWith("instance_") && val.length === 40,
981
+ "instance_id should be 40 characters without prefix"
982
+ ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
983
+ app_compose: LooseAppComposeSchema,
984
+ update_env_vars: z13.boolean().optional().nullable()
985
+ }).refine(
986
+ (data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
987
+ "One of id, uuid, app_id, or instance_id must be provided"
988
+ ).transform((data) => ({
989
+ cvmId: data.id || data.uuid || data.app_id || data.instance_id,
990
+ request: data.app_compose,
991
+ update_env_vars: data.update_env_vars,
992
+ _raw: data
993
+ }));
994
+ var ProvisionCvmComposeFileUpdateResultSchema = z13.object({
995
+ app_id: z13.string().nullable(),
996
+ device_id: z13.string().nullable(),
997
+ compose_hash: z13.string(),
998
+ kms_info: KmsInfoSchema.nullable().optional()
999
+ }).passthrough();
1000
+ var { action: provisionCvmComposeFileUpdate, safeAction: safeProvisionCvmComposeFileUpdate } = defineAction(ProvisionCvmComposeFileUpdateResultSchema, async (client, request) => {
1001
+ const validatedRequest = ProvisionCvmComposeFileUpdateRequestSchema.parse(request);
1002
+ return await client.post(
1003
+ `/cvms/${validatedRequest.cvmId}/compose_file/provision`,
1004
+ validatedRequest.request
1005
+ );
1006
+ });
1007
+
1008
+ // src/actions/cvms/commit_cvm_compose_file_update.ts
1009
+ import { z as z14 } from "zod";
1010
+ var CommitCvmComposeFileUpdateRequestSchema = z14.object({
1011
+ id: z14.string().optional(),
1012
+ uuid: z14.string().regex(/^[0-9a-f]{8}[-]?[0-9a-f]{4}[-]?4[0-9a-f]{3}[-]?[89ab][0-9a-f]{3}[-]?[0-9a-f]{12}$/i).optional(),
1013
+ app_id: z14.string().refine(
1014
+ (val) => !val.startsWith("app_") && val.length === 40,
1015
+ "app_id should be 40 characters without prefix"
1016
+ ).transform((val) => val.startsWith("app_") ? val : `app_${val}`).optional(),
1017
+ instance_id: z14.string().refine(
1018
+ (val) => !val.startsWith("instance_") && val.length === 40,
1019
+ "instance_id should be 40 characters without prefix"
1020
+ ).transform((val) => val.startsWith("instance_") ? val : `instance_${val}`).optional(),
1021
+ compose_hash: z14.string().min(1, "Compose hash is required"),
1022
+ encrypted_env: z14.string().optional(),
1023
+ env_keys: z14.array(z14.string()).optional(),
1024
+ update_env_vars: z14.boolean().optional().nullable()
1025
+ }).refine(
1026
+ (data) => !!(data.id || data.uuid || data.app_id || data.instance_id),
1027
+ "One of id, uuid, app_id, or instance_id must be provided"
1028
+ ).transform((data) => ({
1029
+ cvmId: data.id || data.uuid || data.app_id || data.instance_id,
1030
+ compose_hash: data.compose_hash,
1031
+ encrypted_env: data.encrypted_env,
1032
+ env_keys: data.env_keys,
1033
+ update_env_vars: !!data.update_env_vars,
1034
+ _raw: data
1035
+ }));
1036
+ var CommitCvmComposeFileUpdateSchema = z14.any().transform(() => void 0);
1037
+ var { action: commitCvmComposeFileUpdate, safeAction: safeCommitCvmComposeFileUpdate } = defineAction(
5
1038
  CommitCvmComposeFileUpdateSchema,
6
- CommitCvmProvisionRequestSchema,
7
- CommitCvmProvisionSchema,
8
- CurrentUserSchema,
9
- CvmInfoSchema,
10
- CvmLegacyDetailSchema,
11
- CvmNetworkUrlsSchema,
12
- CvmNodeSchema,
13
- GetAppEnvEncryptPubKeyRequestSchema,
14
- GetAppEnvEncryptPubKeySchema,
15
- GetCvmComposeFileRequestSchema,
16
- GetCvmInfoRequestSchema,
17
- GetCvmListRequestSchema,
18
- GetCvmListSchema,
19
- GetKmsInfoRequestSchema,
20
- GetKmsListRequestSchema,
21
- GetKmsListSchema,
22
- InstanceTypeSchema,
23
- KmsInfoSchema,
24
- ListInstanceTypesRequestSchema,
25
- ListWorkspacesSchema,
26
- ManagedUserSchema,
27
- PaginatedInstanceTypesSchema,
28
- PaginationMetadataSchema,
29
- ProvisionCvmComposeFileUpdateRequestSchema,
30
- ProvisionCvmComposeFileUpdateResultSchema,
31
- ProvisionCvmRequestSchema,
32
- ProvisionCvmSchema,
33
- RequestError,
34
- SUPPORTED_CHAINS,
35
- VmInfoSchema,
36
- WorkspaceResponseSchema,
37
- commitCvmComposeFileUpdate,
38
- commitCvmProvision,
39
- createClient,
40
- defineAction,
41
- defineSimpleAction,
42
- getAppEnvEncryptPubKey,
43
- getAvailableNodes,
44
- getCurrentUser,
45
- getCvmComposeFile,
46
- getCvmInfo,
47
- getCvmList,
48
- getKmsInfo,
49
- getKmsList,
50
- getWorkspace,
51
- listInstanceTypes,
52
- listWorkspaces,
53
- provisionCvm,
54
- provisionCvmComposeFileUpdate,
55
- safeCommitCvmComposeFileUpdate,
56
- safeCommitCvmProvision,
57
- safeGetAppEnvEncryptPubKey,
58
- safeGetAvailableNodes,
59
- safeGetCurrentUser,
60
- safeGetCvmComposeFile,
61
- safeGetCvmInfo,
62
- safeGetCvmList,
63
- safeGetKmsInfo,
64
- safeGetKmsList,
65
- safeGetWorkspace,
66
- safeListInstanceTypes,
67
- safeListWorkspaces,
68
- safeProvisionCvm,
69
- safeProvisionCvmComposeFileUpdate,
70
- safeValidateActionParameters,
71
- validateActionParameters
72
- } from "./chunk-O5QBIXBA.mjs";
1039
+ async (client, request) => {
1040
+ const validatedRequest = CommitCvmComposeFileUpdateRequestSchema.parse(request);
1041
+ return await client.patch(`/cvms/${validatedRequest.cvmId}/compose_file`, {
1042
+ compose_hash: validatedRequest.compose_hash,
1043
+ encrypted_env: validatedRequest.encrypted_env,
1044
+ env_keys: validatedRequest.env_keys
1045
+ });
1046
+ }
1047
+ );
1048
+
1049
+ // src/actions/kms/get_kms_info.ts
1050
+ import { z as z15 } from "zod";
1051
+ var GetKmsInfoRequestSchema = z15.object({
1052
+ kms_id: z15.string().min(1, "KMS ID is required")
1053
+ });
1054
+ var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSchema, async (client, request) => {
1055
+ const validatedRequest = GetKmsInfoRequestSchema.parse(request);
1056
+ return await client.get(`/kms/${validatedRequest.kms_id}`);
1057
+ });
1058
+
1059
+ // src/actions/kms/get_kms_list.ts
1060
+ import { z as z16 } from "zod";
1061
+ var GetKmsListRequestSchema = z16.object({
1062
+ page: z16.number().int().min(1).optional(),
1063
+ page_size: z16.number().int().min(1).optional(),
1064
+ is_onchain: z16.boolean().optional()
1065
+ }).strict();
1066
+ var GetKmsListSchema = z16.object({
1067
+ items: z16.array(KmsInfoSchema),
1068
+ total: z16.number(),
1069
+ page: z16.number(),
1070
+ page_size: z16.number(),
1071
+ pages: z16.number()
1072
+ }).strict();
1073
+ var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsListSchema, async (client, request) => {
1074
+ const validatedRequest = GetKmsListRequestSchema.parse(request ?? {});
1075
+ return await client.get("/kms", { params: validatedRequest });
1076
+ });
1077
+
1078
+ // src/actions/kms/get_app_env_encrypt_pubkey.ts
1079
+ import { z as z17 } from "zod";
1080
+ var GetAppEnvEncryptPubKeyRequestSchema = z17.object({
1081
+ kms: z17.string().min(1, "KMS ID or slug is required"),
1082
+ app_id: z17.string().refine(
1083
+ (val) => val.length === 40 || val.startsWith("0x") && val.length === 42,
1084
+ "App ID must be exactly 40 characters or 42 characters with 0x prefix"
1085
+ )
1086
+ }).strict();
1087
+ var GetAppEnvEncryptPubKeySchema = z17.object({
1088
+ public_key: z17.string(),
1089
+ signature: z17.string()
1090
+ }).strict();
1091
+ var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } = defineAction(GetAppEnvEncryptPubKeySchema, async (client, payload) => {
1092
+ const validatedRequest = GetAppEnvEncryptPubKeyRequestSchema.parse(payload);
1093
+ return await client.get(`/kms/${validatedRequest.kms}/pubkey/${validatedRequest.app_id}`);
1094
+ });
1095
+
1096
+ // src/actions/cvms/start_cvm.ts
1097
+ var StartCvmRequestSchema = CvmIdSchema;
1098
+ var { action: startCvm, safeAction: safeStartCvm } = defineAction(VMSchema, async (client, request) => {
1099
+ const { cvmId } = StartCvmRequestSchema.parse(request);
1100
+ return await client.post(`/cvms/${cvmId}/start`);
1101
+ });
1102
+
1103
+ // src/actions/cvms/stop_cvm.ts
1104
+ var StopCvmRequestSchema = CvmIdSchema;
1105
+ var { action: stopCvm, safeAction: safeStopCvm } = defineAction(
1106
+ VMSchema,
1107
+ async (client, request) => {
1108
+ const { cvmId } = StopCvmRequestSchema.parse(request);
1109
+ return await client.post(`/cvms/${cvmId}/stop`);
1110
+ }
1111
+ );
1112
+
1113
+ // src/actions/cvms/shutdown_cvm.ts
1114
+ var ShutdownCvmRequestSchema = CvmIdSchema;
1115
+ var { action: shutdownCvm, safeAction: safeShutdownCvm } = defineAction(VMSchema, async (client, request) => {
1116
+ const { cvmId } = ShutdownCvmRequestSchema.parse(request);
1117
+ return await client.post(`/cvms/${cvmId}/shutdown`);
1118
+ });
1119
+
1120
+ // src/actions/cvms/restart_cvm.ts
1121
+ import { z as z18 } from "zod";
1122
+ var RestartCvmRequestSchema = refineCvmId(
1123
+ CvmIdObjectSchema.extend({
1124
+ force: z18.boolean().optional()
1125
+ })
1126
+ );
1127
+ var { action: restartCvm, safeAction: safeRestartCvm } = defineAction(VMSchema, async (client, request) => {
1128
+ const parsed = RestartCvmRequestSchema.parse(request);
1129
+ const { cvmId } = CvmIdSchema.parse(parsed);
1130
+ const { force = false } = parsed;
1131
+ return await client.post(`/cvms/${cvmId}/restart`, { force });
1132
+ });
1133
+
1134
+ // src/actions/cvms/delete_cvm.ts
1135
+ import { z as z19 } from "zod";
1136
+ var DeleteCvmRequestSchema = CvmIdSchema;
1137
+ var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
1138
+ z19.void(),
1139
+ async (client, request) => {
1140
+ const { cvmId } = DeleteCvmRequestSchema.parse(request);
1141
+ await client.delete(`/cvms/${cvmId}`);
1142
+ return void 0;
1143
+ }
1144
+ );
1145
+
1146
+ // src/actions/cvms/get_cvm_stats.ts
1147
+ import { z as z20 } from "zod";
1148
+ var DiskInfoSchema = z20.object({
1149
+ name: z20.string(),
1150
+ mount_point: z20.string(),
1151
+ total_size: z20.number(),
1152
+ free_size: z20.number()
1153
+ });
1154
+ var SystemInfoSchema = z20.object({
1155
+ os_name: z20.string(),
1156
+ os_version: z20.string(),
1157
+ kernel_version: z20.string(),
1158
+ cpu_model: z20.string(),
1159
+ num_cpus: z20.number(),
1160
+ total_memory: z20.number(),
1161
+ available_memory: z20.number(),
1162
+ used_memory: z20.number(),
1163
+ free_memory: z20.number(),
1164
+ total_swap: z20.number(),
1165
+ used_swap: z20.number(),
1166
+ free_swap: z20.number(),
1167
+ uptime: z20.number(),
1168
+ loadavg_one: z20.number(),
1169
+ loadavg_five: z20.number(),
1170
+ loadavg_fifteen: z20.number(),
1171
+ disks: z20.array(DiskInfoSchema)
1172
+ });
1173
+ var CvmSystemInfoSchema = z20.object({
1174
+ is_online: z20.boolean(),
1175
+ is_public: z20.boolean().default(false),
1176
+ error: z20.string().nullable(),
1177
+ sysinfo: SystemInfoSchema.nullable(),
1178
+ status: z20.string().nullable(),
1179
+ in_progress: z20.boolean().default(false),
1180
+ boot_progress: z20.string().nullable(),
1181
+ boot_error: z20.string().nullable()
1182
+ });
1183
+ var GetCvmStatsRequestSchema = CvmIdSchema;
1184
+ var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSystemInfoSchema, async (client, request) => {
1185
+ const { cvmId } = GetCvmStatsRequestSchema.parse(request);
1186
+ return await client.get(`/cvms/${cvmId}/stats`);
1187
+ });
1188
+
1189
+ // src/actions/cvms/get_cvm_network.ts
1190
+ import { z as z21 } from "zod";
1191
+ var CvmNetworkUrlsSchema2 = z21.object({
1192
+ app: z21.string(),
1193
+ instance: z21.string()
1194
+ });
1195
+ var CvmNetworkSchema = z21.object({
1196
+ is_online: z21.boolean(),
1197
+ is_public: z21.boolean().default(true),
1198
+ error: z21.string().nullable(),
1199
+ internal_ip: z21.string().nullable(),
1200
+ latest_handshake: z21.string().nullable(),
1201
+ public_urls: z21.array(CvmNetworkUrlsSchema2).nullable()
1202
+ });
1203
+ var GetCvmNetworkRequestSchema = CvmIdSchema;
1204
+ var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmNetworkSchema, async (client, request) => {
1205
+ const { cvmId } = GetCvmNetworkRequestSchema.parse(request);
1206
+ return await client.get(`/cvms/${cvmId}/network`);
1207
+ });
1208
+
1209
+ // src/actions/cvms/get_cvm_docker_compose.ts
1210
+ import { z as z22 } from "zod";
1211
+ var GetCvmDockerComposeRequestSchema = CvmIdSchema;
1212
+ var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(z22.string(), async (client, request) => {
1213
+ const { cvmId } = GetCvmDockerComposeRequestSchema.parse(request);
1214
+ return await client.get(`/cvms/${cvmId}/docker-compose.yml`);
1215
+ });
1216
+
1217
+ // src/actions/cvms/get_cvm_containers_stats.ts
1218
+ import { z as z23 } from "zod";
1219
+ var ContainerInfoSchema = z23.object({
1220
+ id: z23.string(),
1221
+ names: z23.array(z23.string()),
1222
+ image: z23.string(),
1223
+ image_id: z23.string(),
1224
+ command: z23.string().nullable().optional(),
1225
+ created: z23.number(),
1226
+ state: z23.string(),
1227
+ status: z23.string(),
1228
+ log_endpoint: z23.string().nullable()
1229
+ });
1230
+ var CvmContainersStatsSchema = z23.object({
1231
+ is_online: z23.boolean(),
1232
+ is_public: z23.boolean().default(true),
1233
+ error: z23.string().nullable(),
1234
+ docker_compose_file: z23.string().nullable(),
1235
+ manifest_version: z23.number().nullable(),
1236
+ version: z23.string().nullable(),
1237
+ runner: z23.string().nullable(),
1238
+ features: z23.array(z23.string()).nullable(),
1239
+ containers: z23.array(ContainerInfoSchema).nullable()
1240
+ });
1241
+ var GetCvmContainersStatsRequestSchema = CvmIdSchema;
1242
+ var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = defineAction(CvmContainersStatsSchema, async (client, request) => {
1243
+ const { cvmId } = GetCvmContainersStatsRequestSchema.parse(request);
1244
+ return await client.get(`/cvms/${cvmId}/composition`);
1245
+ });
1246
+
1247
+ // src/actions/cvms/get_cvm_attestation.ts
1248
+ import { z as z24 } from "zod";
1249
+ var CertificateSubjectSchema = z24.object({
1250
+ common_name: z24.string().nullable(),
1251
+ organization: z24.string().nullable(),
1252
+ country: z24.string().nullable(),
1253
+ state: z24.string().nullable(),
1254
+ locality: z24.string().nullable()
1255
+ });
1256
+ var CertificateIssuerSchema = z24.object({
1257
+ common_name: z24.string().nullable(),
1258
+ organization: z24.string().nullable(),
1259
+ country: z24.string().nullable()
1260
+ });
1261
+ var CertificateSchema = z24.object({
1262
+ subject: CertificateSubjectSchema,
1263
+ issuer: CertificateIssuerSchema,
1264
+ serial_number: z24.string(),
1265
+ not_before: z24.string(),
1266
+ // datetime serialized as ISO string
1267
+ not_after: z24.string(),
1268
+ // datetime serialized as ISO string
1269
+ version: z24.string(),
1270
+ fingerprint: z24.string(),
1271
+ signature_algorithm: z24.string(),
1272
+ sans: z24.array(z24.string()).nullable(),
1273
+ is_ca: z24.boolean(),
1274
+ position_in_chain: z24.number().nullable(),
1275
+ quote: z24.string().nullable(),
1276
+ app_id: z24.string().nullable().optional(),
1277
+ cert_usage: z24.string().nullable().optional()
1278
+ });
1279
+ var EventLogSchema = z24.object({
1280
+ imr: z24.number(),
1281
+ event_type: z24.number(),
1282
+ digest: z24.string(),
1283
+ event: z24.string(),
1284
+ event_payload: z24.string()
1285
+ });
1286
+ var TcbInfoSchema = z24.object({
1287
+ mrtd: z24.string(),
1288
+ rootfs_hash: z24.string().nullable().optional(),
1289
+ rtmr0: z24.string(),
1290
+ rtmr1: z24.string(),
1291
+ rtmr2: z24.string(),
1292
+ rtmr3: z24.string(),
1293
+ event_log: z24.array(EventLogSchema),
1294
+ app_compose: z24.string()
1295
+ });
1296
+ var CvmAttestationSchema = z24.object({
1297
+ name: z24.string().nullable(),
1298
+ is_online: z24.boolean(),
1299
+ is_public: z24.boolean().default(true),
1300
+ error: z24.string().nullable(),
1301
+ app_certificates: z24.array(CertificateSchema).nullable(),
1302
+ tcb_info: TcbInfoSchema.nullable(),
1303
+ compose_file: z24.string().nullable()
1304
+ });
1305
+ var GetCvmAttestationRequestSchema = CvmIdSchema;
1306
+ var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAction(CvmAttestationSchema, async (client, request) => {
1307
+ const { cvmId } = GetCvmAttestationRequestSchema.parse(request);
1308
+ return await client.get(`/cvms/${cvmId}/attestation`);
1309
+ });
1310
+
1311
+ // src/actions/cvms/update_cvm_resources.ts
1312
+ import { z as z25 } from "zod";
1313
+ var UpdateCvmResourcesRequestSchema = refineCvmId(
1314
+ CvmIdObjectSchema.extend({
1315
+ vcpu: z25.number().optional(),
1316
+ memory: z25.number().optional(),
1317
+ disk_size: z25.number().optional(),
1318
+ instance_type: z25.string().optional(),
1319
+ allow_restart: z25.boolean().optional()
1320
+ })
1321
+ );
1322
+ var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(z25.void(), async (client, request) => {
1323
+ const parsed = UpdateCvmResourcesRequestSchema.parse(request);
1324
+ const { cvmId } = CvmIdSchema.parse(parsed);
1325
+ const { ...body } = parsed;
1326
+ await client.patch(`/cvms/${cvmId}/resources`, body);
1327
+ return void 0;
1328
+ });
1329
+
1330
+ // src/actions/cvms/update_cvm_visibility.ts
1331
+ import { z as z26 } from "zod";
1332
+ var UpdateCvmVisibilityRequestSchema = refineCvmId(
1333
+ CvmIdObjectSchema.extend({
1334
+ public_sysinfo: z26.boolean(),
1335
+ public_logs: z26.boolean()
1336
+ })
1337
+ );
1338
+ var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(CvmLegacyDetailSchema, async (client, request) => {
1339
+ const parsed = UpdateCvmVisibilityRequestSchema.parse(request);
1340
+ const { cvmId } = CvmIdSchema.parse(parsed);
1341
+ const { public_sysinfo, public_logs } = parsed;
1342
+ return await client.patch(`/cvms/${cvmId}/visibility`, { public_sysinfo, public_logs });
1343
+ });
1344
+
1345
+ // src/create-client.ts
1346
+ function createClient2(config = {}) {
1347
+ const client = createClient(config);
1348
+ const allActions = {
1349
+ getCurrentUser,
1350
+ safeGetCurrentUser,
1351
+ getAvailableNodes,
1352
+ safeGetAvailableNodes,
1353
+ listInstanceTypes,
1354
+ safeListInstanceTypes,
1355
+ listWorkspaces,
1356
+ safeListWorkspaces,
1357
+ getWorkspace,
1358
+ safeGetWorkspace,
1359
+ getCvmInfo,
1360
+ safeGetCvmInfo,
1361
+ getCvmList,
1362
+ safeGetCvmList,
1363
+ provisionCvm,
1364
+ safeProvisionCvm,
1365
+ commitCvmProvision,
1366
+ safeCommitCvmProvision,
1367
+ getCvmComposeFile,
1368
+ safeGetCvmComposeFile,
1369
+ provisionCvmComposeFileUpdate,
1370
+ safeProvisionCvmComposeFileUpdate,
1371
+ commitCvmComposeFileUpdate,
1372
+ safeCommitCvmComposeFileUpdate,
1373
+ startCvm,
1374
+ safeStartCvm,
1375
+ stopCvm,
1376
+ safeStopCvm,
1377
+ shutdownCvm,
1378
+ safeShutdownCvm,
1379
+ restartCvm,
1380
+ safeRestartCvm,
1381
+ deleteCvm,
1382
+ safeDeleteCvm,
1383
+ getCvmStats,
1384
+ safeGetCvmStats,
1385
+ getCvmNetwork,
1386
+ safeGetCvmNetwork,
1387
+ getCvmDockerCompose,
1388
+ safeGetCvmDockerCompose,
1389
+ getCvmContainersStats,
1390
+ safeGetCvmContainersStats,
1391
+ getCvmAttestation,
1392
+ safeGetCvmAttestation,
1393
+ updateCvmResources,
1394
+ safeUpdateCvmResources,
1395
+ updateCvmVisibility,
1396
+ safeUpdateCvmVisibility,
1397
+ getKmsInfo,
1398
+ safeGetKmsInfo,
1399
+ getKmsList,
1400
+ safeGetKmsList,
1401
+ getAppEnvEncryptPubKey,
1402
+ safeGetAppEnvEncryptPubKey
1403
+ };
1404
+ return client.extend(allActions);
1405
+ }
73
1406
 
74
1407
  // src/actions/blockchains/deploy_app_auth.ts
75
- import { z } from "zod";
1408
+ import { z as z27 } from "zod";
76
1409
  import {
77
1410
  createPublicClient as createPublicClient2,
78
1411
  createWalletClient as createWalletClient2,
@@ -750,25 +2083,25 @@ var kmsAuthAbi = [
750
2083
  anonymous: false
751
2084
  }
752
2085
  ];
753
- var DeployAppAuthRequestBaseSchema = z.object({
2086
+ var DeployAppAuthRequestBaseSchema = z27.object({
754
2087
  // Chain configuration (conditionally required)
755
- chain: z.unknown().optional(),
756
- rpcUrl: z.string().optional(),
2088
+ chain: z27.unknown().optional(),
2089
+ rpcUrl: z27.string().optional(),
757
2090
  // Contract configuration (required)
758
- kmsContractAddress: z.string(),
2091
+ kmsContractAddress: z27.string(),
759
2092
  // Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
760
- privateKey: z.string().optional(),
761
- walletClient: z.unknown().optional(),
2093
+ privateKey: z27.string().optional(),
2094
+ walletClient: z27.unknown().optional(),
762
2095
  // Public client (optional, will create default if not provided)
763
- publicClient: z.unknown().optional(),
2096
+ publicClient: z27.unknown().optional(),
764
2097
  // App configuration (optional)
765
- allowAnyDevice: z.boolean().optional().default(false),
766
- deviceId: z.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
767
- composeHash: z.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
768
- disableUpgrades: z.boolean().optional().default(false),
2098
+ allowAnyDevice: z27.boolean().optional().default(false),
2099
+ deviceId: z27.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
2100
+ composeHash: z27.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
2101
+ disableUpgrades: z27.boolean().optional().default(false),
769
2102
  // Validation configuration (optional)
770
- skipPrerequisiteChecks: z.boolean().optional().default(false),
771
- minBalance: z.string().optional()
2103
+ skipPrerequisiteChecks: z27.boolean().optional().default(false),
2104
+ minBalance: z27.string().optional()
772
2105
  // ETH amount as string, e.g., "0.01"
773
2106
  }).passthrough();
774
2107
  var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
@@ -796,13 +2129,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
796
2129
  path: ["chain"]
797
2130
  }
798
2131
  );
799
- var DeployAppAuthSchema = z.object({
800
- appId: z.string(),
801
- appAuthAddress: z.string(),
802
- deployer: z.string(),
803
- transactionHash: z.string(),
804
- blockNumber: z.bigint().optional(),
805
- gasUsed: z.bigint().optional()
2132
+ var DeployAppAuthSchema = z27.object({
2133
+ appId: z27.string(),
2134
+ appAuthAddress: z27.string(),
2135
+ deployer: z27.string(),
2136
+ transactionHash: z27.string(),
2137
+ blockNumber: z27.bigint().optional(),
2138
+ gasUsed: z27.bigint().optional()
806
2139
  }).passthrough();
807
2140
  function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
808
2141
  try {
@@ -1048,7 +2381,7 @@ async function safeDeployAppAuth(request, parameters) {
1048
2381
  }
1049
2382
 
1050
2383
  // src/actions/blockchains/add_compose_hash.ts
1051
- import { z as z2 } from "zod";
2384
+ import { z as z28 } from "zod";
1052
2385
  import {
1053
2386
  createPublicClient as createPublicClient3,
1054
2387
  createWalletClient as createWalletClient3,
@@ -1072,29 +2405,29 @@ var appAuthAbi = [
1072
2405
  anonymous: false
1073
2406
  }
1074
2407
  ];
1075
- var AddComposeHashRequestSchema = z2.object({
2408
+ var AddComposeHashRequestSchema = z28.object({
1076
2409
  // Chain configuration (conditionally required)
1077
- chain: z2.unknown().optional(),
1078
- rpcUrl: z2.string().optional(),
1079
- appId: z2.string(),
1080
- composeHash: z2.string(),
2410
+ chain: z28.unknown().optional(),
2411
+ rpcUrl: z28.string().optional(),
2412
+ appId: z28.string(),
2413
+ composeHash: z28.string(),
1081
2414
  // Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
1082
- privateKey: z2.string().optional(),
1083
- walletClient: z2.unknown().optional(),
2415
+ privateKey: z28.string().optional(),
2416
+ walletClient: z28.unknown().optional(),
1084
2417
  // Public client (optional, will create default if not provided)
1085
- publicClient: z2.unknown().optional(),
2418
+ publicClient: z28.unknown().optional(),
1086
2419
  // Validation configuration (optional)
1087
- skipPrerequisiteChecks: z2.boolean().optional().default(false),
1088
- minBalance: z2.string().optional(),
2420
+ skipPrerequisiteChecks: z28.boolean().optional().default(false),
2421
+ minBalance: z28.string().optional(),
1089
2422
  // ETH amount as string, e.g., "0.01"
1090
2423
  // Transaction control options
1091
- timeout: z2.number().optional().default(12e4),
1092
- retryOptions: z2.unknown().optional(),
1093
- signal: z2.unknown().optional(),
2424
+ timeout: z28.number().optional().default(12e4),
2425
+ retryOptions: z28.unknown().optional(),
2426
+ signal: z28.unknown().optional(),
1094
2427
  // Progress callbacks
1095
- onTransactionStateChange: z2.function().optional(),
1096
- onTransactionSubmitted: z2.function().optional(),
1097
- onTransactionConfirmed: z2.function().optional()
2428
+ onTransactionStateChange: z28.function().optional(),
2429
+ onTransactionSubmitted: z28.function().optional(),
2430
+ onTransactionConfirmed: z28.function().optional()
1098
2431
  }).passthrough().refine(
1099
2432
  (data) => {
1100
2433
  const hasPrivateKey = !!data.privateKey;
@@ -1118,12 +2451,12 @@ var AddComposeHashRequestSchema = z2.object({
1118
2451
  path: ["chain"]
1119
2452
  }
1120
2453
  );
1121
- var AddComposeHashSchema = z2.object({
1122
- composeHash: z2.string(),
1123
- appId: z2.string(),
1124
- transactionHash: z2.string(),
1125
- blockNumber: z2.bigint().optional(),
1126
- gasUsed: z2.bigint().optional()
2454
+ var AddComposeHashSchema = z28.object({
2455
+ composeHash: z28.string(),
2456
+ appId: z28.string(),
2457
+ transactionHash: z28.string(),
2458
+ blockNumber: z28.bigint().optional(),
2459
+ gasUsed: z28.bigint().optional()
1127
2460
  }).passthrough();
1128
2461
  function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
1129
2462
  console.log(receipt.logs);
@@ -1360,18 +2693,31 @@ export {
1360
2693
  CommitCvmProvisionRequestSchema,
1361
2694
  CommitCvmProvisionSchema,
1362
2695
  CurrentUserSchema,
2696
+ CvmAttestationSchema,
2697
+ CvmContainersStatsSchema,
2698
+ CvmIdBaseSchema,
2699
+ CvmIdObjectSchema,
2700
+ CvmIdSchema,
1363
2701
  CvmInfoSchema,
1364
2702
  CvmLegacyDetailSchema,
2703
+ CvmNetworkSchema,
1365
2704
  CvmNetworkUrlsSchema,
1366
2705
  CvmNodeSchema,
2706
+ CvmSystemInfoSchema,
2707
+ DeleteCvmRequestSchema,
1367
2708
  DeployAppAuthRequestSchema,
1368
2709
  DeployAppAuthSchema,
1369
2710
  GetAppEnvEncryptPubKeyRequestSchema,
1370
2711
  GetAppEnvEncryptPubKeySchema,
2712
+ GetCvmAttestationRequestSchema,
1371
2713
  GetCvmComposeFileRequestSchema,
2714
+ GetCvmContainersStatsRequestSchema,
2715
+ GetCvmDockerComposeRequestSchema,
1372
2716
  GetCvmInfoRequestSchema,
1373
2717
  GetCvmListRequestSchema,
1374
2718
  GetCvmListSchema,
2719
+ GetCvmNetworkRequestSchema,
2720
+ GetCvmStatsRequestSchema,
1375
2721
  GetKmsInfoRequestSchema,
1376
2722
  GetKmsListRequestSchema,
1377
2723
  GetKmsListSchema,
@@ -1388,8 +2734,15 @@ export {
1388
2734
  ProvisionCvmRequestSchema,
1389
2735
  ProvisionCvmSchema,
1390
2736
  RequestError,
2737
+ RestartCvmRequestSchema,
1391
2738
  SUPPORTED_CHAINS,
2739
+ ShutdownCvmRequestSchema,
2740
+ StartCvmRequestSchema,
2741
+ StopCvmRequestSchema,
1392
2742
  TransactionError,
2743
+ UpdateCvmResourcesRequestSchema,
2744
+ UpdateCvmVisibilityRequestSchema,
2745
+ VMSchema,
1393
2746
  VmInfoSchema,
1394
2747
  WalletError,
1395
2748
  WorkspaceResponseSchema,
@@ -1401,13 +2754,15 @@ export {
1401
2754
  checkNetworkStatus,
1402
2755
  commitCvmComposeFileUpdate,
1403
2756
  commitCvmProvision,
1404
- createClient,
2757
+ createClient as createBaseClient,
2758
+ createClient2 as createClient,
1405
2759
  createClientsFromBrowser,
1406
2760
  createClientsFromPrivateKey,
1407
2761
  createNetworkClients,
1408
2762
  createTransactionTracker,
1409
2763
  defineAction,
1410
2764
  defineSimpleAction,
2765
+ deleteCvm,
1411
2766
  deployAppAuth,
1412
2767
  encryptEnvVars2 as encryptEnvVars,
1413
2768
  estimateTransactionGas,
@@ -1419,9 +2774,14 @@ export {
1419
2774
  getAvailableNodes,
1420
2775
  getComposeHash2 as getComposeHash,
1421
2776
  getCurrentUser,
2777
+ getCvmAttestation,
1422
2778
  getCvmComposeFile,
2779
+ getCvmContainersStats,
2780
+ getCvmDockerCompose,
1423
2781
  getCvmInfo,
1424
2782
  getCvmList,
2783
+ getCvmNetwork,
2784
+ getCvmStats,
1425
2785
  getErrorMessage,
1426
2786
  getKmsInfo,
1427
2787
  getKmsList,
@@ -1432,16 +2792,24 @@ export {
1432
2792
  parseEnvVars,
1433
2793
  provisionCvm,
1434
2794
  provisionCvmComposeFileUpdate,
2795
+ refineCvmId,
2796
+ restartCvm,
1435
2797
  safeAddComposeHash,
1436
2798
  safeCommitCvmComposeFileUpdate,
1437
2799
  safeCommitCvmProvision,
2800
+ safeDeleteCvm,
1438
2801
  safeDeployAppAuth,
1439
2802
  safeGetAppEnvEncryptPubKey,
1440
2803
  safeGetAvailableNodes,
1441
2804
  safeGetCurrentUser,
2805
+ safeGetCvmAttestation,
1442
2806
  safeGetCvmComposeFile,
2807
+ safeGetCvmContainersStats,
2808
+ safeGetCvmDockerCompose,
1443
2809
  safeGetCvmInfo,
1444
2810
  safeGetCvmList,
2811
+ safeGetCvmNetwork,
2812
+ safeGetCvmStats,
1445
2813
  safeGetKmsInfo,
1446
2814
  safeGetKmsList,
1447
2815
  safeGetWorkspace,
@@ -1449,8 +2817,19 @@ export {
1449
2817
  safeListWorkspaces,
1450
2818
  safeProvisionCvm,
1451
2819
  safeProvisionCvmComposeFileUpdate,
2820
+ safeRestartCvm,
2821
+ safeShutdownCvm,
2822
+ safeStartCvm,
2823
+ safeStopCvm,
2824
+ safeUpdateCvmResources,
2825
+ safeUpdateCvmVisibility,
1452
2826
  safeValidateActionParameters,
2827
+ shutdownCvm,
2828
+ startCvm,
2829
+ stopCvm,
1453
2830
  switchToNetwork,
2831
+ updateCvmResources,
2832
+ updateCvmVisibility,
1454
2833
  validateActionParameters,
1455
2834
  validateNetworkPrerequisites,
1456
2835
  verifyEnvEncryptPublicKey,