@phala/cloud 0.6.3 → 0.6.5

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.
@@ -1,14 +1,19 @@
1
+ import { z } from "zod";
1
2
  import { type Client, type SafeResult } from "../../client";
2
3
  import type { ApiVersion } from "../../types/client";
4
+ import { type CvmGpuStatus } from "../../types/cvm_info_v20260121";
3
5
  import { type CvmIdInput } from "../../types/cvm_id";
4
6
  import type { GetCvmInfoResponse } from "../../types/version-mappings";
5
- export declare const GetCvmInfoRequestSchema: import("zod").ZodPipe<import("zod").ZodObject<{
6
- id: import("zod").ZodOptional<import("zod").ZodString>;
7
- uuid: import("zod").ZodOptional<import("zod").ZodString>;
8
- app_id: import("zod").ZodOptional<import("zod").ZodString>;
9
- instance_id: import("zod").ZodOptional<import("zod").ZodString>;
10
- name: import("zod").ZodOptional<import("zod").ZodString>;
11
- }, import("zod/v4/core").$strip>, import("zod").ZodTransform<{
7
+ export declare const GetCvmInfoRequestSchema: z.ZodPipe<z.ZodObject<{
8
+ id: z.ZodOptional<z.ZodString>;
9
+ uuid: z.ZodOptional<z.ZodString>;
10
+ app_id: z.ZodOptional<z.ZodString>;
11
+ instance_id: z.ZodOptional<z.ZodString>;
12
+ name: z.ZodOptional<z.ZodString>;
13
+ cvmId: z.ZodOptional<z.ZodString>;
14
+ include_compose: z.ZodOptional<z.ZodBoolean>;
15
+ }, z.core.$strip>, z.ZodTransform<{
16
+ include_compose: boolean | undefined;
12
17
  cvmId: string;
13
18
  }, {
14
19
  id?: string | undefined;
@@ -16,8 +21,13 @@ export declare const GetCvmInfoRequestSchema: import("zod").ZodPipe<import("zod"
16
21
  app_id?: string | undefined;
17
22
  instance_id?: string | undefined;
18
23
  name?: string | undefined;
24
+ cvmId?: string | undefined;
25
+ include_compose?: boolean | undefined;
19
26
  }>>;
20
- export type GetCvmInfoRequest = CvmIdInput;
27
+ export type GetCvmInfoRequest = CvmIdInput & {
28
+ cvmId?: string;
29
+ include_compose?: boolean;
30
+ };
21
31
  /**
22
32
  * Get information about a specific CVM
23
33
  *
@@ -32,6 +42,12 @@ export type GetCvmInfoRequest = CvmIdInput;
32
42
  * ```
33
43
  */
34
44
  export declare function getCvmInfo<V extends ApiVersion>(client: Client<V>, request: GetCvmInfoRequest): Promise<GetCvmInfoResponse<V>>;
45
+ export declare function getCvmGpuStatus(client: Client<ApiVersion>, request: {
46
+ cvmId: string;
47
+ }): Promise<CvmGpuStatus>;
48
+ export declare function safeGetCvmGpuStatus(client: Client<ApiVersion>, request: {
49
+ cvmId: string;
50
+ }): Promise<SafeResult<CvmGpuStatus>>;
35
51
  /**
36
52
  * Safe version of getCvmInfo that returns a SafeResult instead of throwing
37
53
  */
@@ -1,4 +1,5 @@
1
1
  import type { Client } from "../../client";
2
+ import type { ApiVersion } from "../../types/client";
2
3
  import { type CvmIdInput } from "../../types/cvm_id";
3
4
  import { ResourceError } from "../../utils/errors";
4
5
  export { resolveLogTimeWindow } from "./log-time";
@@ -6,7 +7,7 @@ export { resolveLogTimeWindow } from "./log-time";
6
7
  export declare const CVM_LOGS_INFO_API_VERSION = "2026-01-21";
7
8
  export type CvmLogChannel = "serial" | "stdout" | "stderr";
8
9
  export type CvmLogFormat = "text" | "ndjson";
9
- export type LogChannel = "stdout" | "stderr";
10
+ export type LogChannel = "stdout" | "stderr" | "stdin" | "console";
10
11
  export type CvmLogSource = {
11
12
  type: "node";
12
13
  channel: CvmLogChannel;
@@ -35,33 +36,43 @@ export declare class LogAccessError extends ResourceError {
35
36
  readonly suggestions: string[];
36
37
  /** True when the error was parsed from a 200 stream body, not an HTTP status. */
37
38
  readonly fromStreamBody: boolean;
39
+ /** Gateway in-stream error (retried like a network failure). */
40
+ readonly gatewayStream: boolean;
38
41
  constructor(options: {
39
42
  message: string;
40
43
  code?: string;
41
44
  httpStatus?: number;
42
45
  suggestions?: readonly string[];
43
46
  fromStreamBody?: boolean;
47
+ gatewayStream?: boolean;
48
+ requestId?: string;
49
+ details?: ResourceError["structuredDetails"];
50
+ links?: ResourceError["links"];
44
51
  });
45
52
  }
53
+ /** 250 ms doubling to 5 s; the attempt is clamped before the power so it never overflows. */
54
+ export declare function backoffDelayMs(attempt: number): number;
46
55
  /** Get a presigned CVM-level log URL for a given node channel. */
47
- export declare function getCvmLogEndpoint(client: Client, id: CvmIdInput | string, channel: CvmLogChannel): Promise<string>;
48
- export declare function fetchCvmChannelLogs(client: Client, id: CvmIdInput | string, channel: CvmLogChannel, options?: CvmLogsOptions): Promise<string>;
49
- export declare function streamCvmChannelLogs(client: Client, id: CvmIdInput | string, channel: CvmLogChannel, onData: (data: string) => void, options?: CvmLogsOptions, signal?: AbortSignal): Promise<void>;
50
- export declare function fetchContainerLogsEntries(client: Client, id: CvmIdInput | string, options?: CvmLogsOptions & {
56
+ export declare function getCvmLogEndpoint(client: Client<ApiVersion>, id: CvmIdInput | string, channel: CvmLogChannel, signal?: AbortSignal): Promise<string>;
57
+ /** Idle connections longer than this that end cleanly are not treated as a stopped container. */
58
+ export declare const EMPTY_STREAM_QUIET_MS = 10000;
59
+ export declare function fetchCvmChannelLogs(client: Client<ApiVersion>, id: CvmIdInput | string, channel: CvmLogChannel, options?: CvmLogsOptions): Promise<string>;
60
+ export declare function streamCvmChannelLogs(client: Client<ApiVersion>, id: CvmIdInput | string, channel: CvmLogChannel, onData: (data: string) => void, options?: CvmLogsOptions, signal?: AbortSignal): Promise<void>;
61
+ export declare function fetchContainerLogsEntries(client: Client<ApiVersion>, id: CvmIdInput | string, options?: CvmLogsOptions & {
51
62
  container?: string;
52
63
  matchContainerIdPrefix?: boolean;
53
64
  }): Promise<CvmLogEntry[]>;
54
- export declare function fetchContainerLogs(client: Client, id: CvmIdInput | string, options?: CvmLogsOptions & {
65
+ export declare function fetchContainerLogs(client: Client<ApiVersion>, id: CvmIdInput | string, options?: CvmLogsOptions & {
55
66
  container?: string;
56
67
  matchContainerIdPrefix?: boolean;
57
68
  }): Promise<string>;
58
- export declare function streamContainerLogsEntries(client: Client, id: CvmIdInput | string, onEntry: (entry: CvmLogEntry) => void, options?: CvmLogsOptions & {
69
+ export declare function streamContainerLogsEntries(client: Client<ApiVersion>, id: CvmIdInput | string, onEntry: (entry: CvmLogEntry) => void, options?: CvmLogsOptions & {
59
70
  container?: string;
60
71
  matchContainerIdPrefix?: boolean;
61
72
  }, signal?: AbortSignal): Promise<void>;
62
- export declare function streamContainerLogs(client: Client, id: CvmIdInput | string, onData: (data: string) => void, options?: CvmLogsOptions & {
73
+ export declare function streamContainerLogs(client: Client<ApiVersion>, id: CvmIdInput | string, onData: (data: string) => void, options?: CvmLogsOptions & {
63
74
  container?: string;
64
75
  matchContainerIdPrefix?: boolean;
65
76
  }, signal?: AbortSignal): Promise<void>;
66
- export declare function fetchCvmLogs(client: Client, id: CvmIdInput | string, source: CvmLogSource, options?: CvmLogsOptions): Promise<string | CvmLogEntry[]>;
67
- export declare function followCvmLogs(client: Client, id: CvmIdInput | string, source: CvmLogSource, options?: CvmLogsOptions): AsyncGenerator<string | CvmLogEntry>;
77
+ export declare function fetchCvmLogs(client: Client<ApiVersion>, id: CvmIdInput | string, source: CvmLogSource, options?: CvmLogsOptions): Promise<string | CvmLogEntry[]>;
78
+ export declare function followCvmLogs(client: Client<ApiVersion>, id: CvmIdInput | string, source: CvmLogSource, options?: CvmLogsOptions): AsyncGenerator<string | CvmLogEntry>;
@@ -18,7 +18,7 @@ export { provisionCvmComposeFileUpdate, safeProvisionCvmComposeFileUpdate, Provi
18
18
  export { commitCvmComposeFileUpdate, safeCommitCvmComposeFileUpdate, CommitCvmComposeFileUpdateRequestSchema, type CommitCvmComposeFileUpdateRequest, CommitCvmComposeFileUpdateSchema, type CommitCvmComposeFileUpdate, } from "./cvms/commit_cvm_compose_file_update";
19
19
  export { updateCvmEnvs, safeUpdateCvmEnvs, UpdateCvmEnvsRequestSchema, type UpdateCvmEnvsRequest, UpdateCvmEnvsResultSchema, type UpdateCvmEnvsResult, type UpdateCvmEnvsInProgress, type UpdateCvmEnvsPreconditionRequired, } from "./cvms/update_cvm_envs";
20
20
  export { getAppEnvEncryptPubKey, safeGetAppEnvEncryptPubKey, GetAppEnvEncryptPubKeySchema, type GetAppEnvEncryptPubKeyRequest, type GetAppEnvEncryptPubKey, GetAppEnvEncryptPubKeyRequestSchema, } from "./kms/get_app_env_encrypt_pubkey";
21
- export { getCvmInfo, safeGetCvmInfo, GetCvmInfoRequestSchema, type GetCvmInfoRequest, } from "./cvms/get_cvm_info";
21
+ export { getCvmInfo, getCvmGpuStatus, safeGetCvmGpuStatus, safeGetCvmInfo, GetCvmInfoRequestSchema, type GetCvmInfoRequest, } from "./cvms/get_cvm_info";
22
22
  export { getCvmList, safeGetCvmList, GetCvmListRequestSchema, type GetCvmListRequest, } from "./cvms/get_cvm_list";
23
23
  export { getKmsInfo, safeGetKmsInfo, GetKmsInfoRequestSchema, type GetKmsInfoRequest, } from "./kms/get_kms_info";
24
24
  export { getKmsList, safeGetKmsList, GetKmsListSchema, GetKmsListRequestSchema, type GetKmsListRequest, type GetKmsListResponse, } from "./kms/get_kms_list";
package/dist/client.d.ts CHANGED
@@ -4,7 +4,7 @@ import { type SafeResult, type ClientConfig, type ResolvedClientConfig, type Ful
4
4
  import type { Prettify } from "./types/common";
5
5
  import { PhalaCloudError } from "./utils/errors";
6
6
  export type { SafeResult, FullResponse, RequestOptions, ApiVersion, DefaultApiVersion, } from "./types/client";
7
- export declare const SUPPORTED_API_VERSIONS: readonly ["2025-10-28", "2026-01-21", "2026-05-22", "2026-06-23"];
7
+ export declare const SUPPORTED_API_VERSIONS: readonly ["2025-10-28", "2026-01-21", "2026-05-22", "2026-06-23", "2026-11-11"];
8
8
  export declare const DEFAULT_API_VERSION: DefaultApiVersion;
9
9
  type BoundActions<A> = {
10
10
  [K in keyof A]: A[K] extends (client: never, ...args: infer P) => infer R ? (...args: P) => R : never;
@@ -2165,6 +2165,12 @@ export interface Client<V extends ApiVersion = DefaultApiVersion> extends BaseCl
2165
2165
  schema: false;
2166
2166
  }): Promise<SafeResult<unknown>>;
2167
2167
  getCvmInfo(request: GetCvmInfoRequest): Promise<GetCvmInfoResponse<V>>;
2168
+ getCvmGpuStatus(request: {
2169
+ cvmId: string;
2170
+ }): Promise<import("./types/cvm_info_v20260121").CvmGpuStatus>;
2171
+ safeGetCvmGpuStatus(request: {
2172
+ cvmId: string;
2173
+ }): Promise<SafeResult<import("./types/cvm_info_v20260121").CvmGpuStatus>>;
2168
2174
  safeGetCvmInfo(request: GetCvmInfoRequest): Promise<SafeResult<GetCvmInfoResponse<V>>>;
2169
2175
  getCvmComposeFile(request: GetCvmComposeFileRequest): Promise<GetCvmComposeFileResult>;
2170
2176
  getCvmComposeFile<T extends z.ZodTypeAny>(request: GetCvmComposeFileRequest, parameters: {
@@ -6,8 +6,8 @@ export declare const UserInfoSchema: z.ZodObject<{
6
6
  username: z.ZodString;
7
7
  email: z.ZodString;
8
8
  role: z.ZodEnum<{
9
- admin: "admin";
10
9
  user: "user";
10
+ admin: "admin";
11
11
  }>;
12
12
  avatar: z.ZodString;
13
13
  email_verified: z.ZodBoolean;
@@ -44,8 +44,8 @@ export declare const CurrentUserV20260121Schema: z.ZodObject<{
44
44
  username: z.ZodString;
45
45
  email: z.ZodString;
46
46
  role: z.ZodEnum<{
47
- admin: "admin";
48
47
  user: "user";
48
+ admin: "admin";
49
49
  }>;
50
50
  avatar: z.ZodString;
51
51
  email_verified: z.ZodBoolean;