@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.
- package/dist/actions/cvms/get_cvm_info.d.ts +24 -8
- package/dist/actions/cvms/logs.d.ts +21 -10
- package/dist/actions/index.d.ts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/create-client.d.ts +6 -0
- package/dist/credentials/current_user_v20260121.d.ts +2 -2
- package/dist/index.js +1563 -1179
- package/dist/index.mjs +1559 -1179
- package/dist/types/app_info_v20260121.d.ts +48 -12
- package/dist/types/client.d.ts +3 -3
- package/dist/types/cvm_info_v20260121.d.ts +203 -7
- package/dist/types/version-mappings.d.ts +11 -11
- package/dist/version.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -417,6 +417,12 @@ function isAppIdConflictError(error) {
|
|
|
417
417
|
return error instanceof ResourceError && error.errorCode === "ERR-03-007";
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
+
// package.json
|
|
421
|
+
var version = "0.6.5";
|
|
422
|
+
|
|
423
|
+
// src/version.ts
|
|
424
|
+
var sdkVersion = version;
|
|
425
|
+
|
|
420
426
|
// src/user-agent.ts
|
|
421
427
|
function runtimeToken(runtime) {
|
|
422
428
|
const deno = runtime.Deno?.version?.deno;
|
|
@@ -440,7 +446,7 @@ function defaultUserAgent(runtime = globalThis) {
|
|
|
440
446
|
if (runtime.window !== void 0 && runtime.document !== void 0) {
|
|
441
447
|
return void 0;
|
|
442
448
|
}
|
|
443
|
-
const product = "phala-cloud-sdk-js/
|
|
449
|
+
const product = "phala-cloud-sdk-js/" + sdkVersion;
|
|
444
450
|
const token = runtimeToken(runtime);
|
|
445
451
|
return token ? `${product} ${token}` : product;
|
|
446
452
|
}
|
|
@@ -450,9 +456,10 @@ var SUPPORTED_API_VERSIONS = [
|
|
|
450
456
|
"2025-10-28",
|
|
451
457
|
"2026-01-21",
|
|
452
458
|
"2026-05-22",
|
|
453
|
-
"2026-06-23"
|
|
459
|
+
"2026-06-23",
|
|
460
|
+
"2026-11-11"
|
|
454
461
|
];
|
|
455
|
-
var DEFAULT_API_VERSION = "2026-
|
|
462
|
+
var DEFAULT_API_VERSION = "2026-11-11";
|
|
456
463
|
var logger = debug("phala::api-client");
|
|
457
464
|
function formatHeaders(headers) {
|
|
458
465
|
return Object.entries(headers).map(([key, value]) => ` -H "${key}: ${value}"`).join("\n");
|
|
@@ -483,14 +490,14 @@ var Client = class _Client {
|
|
|
483
490
|
const resolvedBearerToken = config.bearerToken || process?.env?.PHALA_OIDC_TOKEN;
|
|
484
491
|
const resolvedWorkspace = config.workspace || process?.env?.PHALA_CLOUD_WORKSPACE;
|
|
485
492
|
const resolvedBaseURL = config.baseURL || process?.env?.PHALA_CLOUD_API_PREFIX || "https://cloud-api.phala.com/api/v1";
|
|
486
|
-
const
|
|
493
|
+
const version2 = config.version && SUPPORTED_API_VERSIONS.includes(config.version) ? config.version : DEFAULT_API_VERSION;
|
|
487
494
|
this.config = {
|
|
488
495
|
...config,
|
|
489
496
|
apiKey: resolvedApiKey,
|
|
490
497
|
bearerToken: resolvedBearerToken,
|
|
491
498
|
workspace: resolvedWorkspace,
|
|
492
499
|
baseURL: resolvedBaseURL,
|
|
493
|
-
version
|
|
500
|
+
version: version2
|
|
494
501
|
};
|
|
495
502
|
const {
|
|
496
503
|
apiKey,
|
|
@@ -509,7 +516,7 @@ var Client = class _Client {
|
|
|
509
516
|
requestHeaders.set("User-Agent", userAgent);
|
|
510
517
|
}
|
|
511
518
|
new Headers(headers).forEach((value, key) => requestHeaders.set(key, value));
|
|
512
|
-
requestHeaders.set("X-Phala-Version",
|
|
519
|
+
requestHeaders.set("X-Phala-Version", version2);
|
|
513
520
|
if (!useCookieAuth && apiKey) {
|
|
514
521
|
requestHeaders.set("X-API-Key", apiKey);
|
|
515
522
|
} else if (!useCookieAuth && bearerToken) {
|
|
@@ -854,10 +861,10 @@ var Client = class _Client {
|
|
|
854
861
|
* const data = await getCvmInfo(legacyClient, { id: "xxx" });
|
|
855
862
|
* ```
|
|
856
863
|
*/
|
|
857
|
-
withVersion(
|
|
864
|
+
withVersion(version2) {
|
|
858
865
|
const clone = new _Client({
|
|
859
866
|
...this.config,
|
|
860
|
-
version
|
|
867
|
+
version: version2
|
|
861
868
|
});
|
|
862
869
|
clone.emitter = this.emitter;
|
|
863
870
|
return clone;
|
|
@@ -888,7 +895,7 @@ var Client = class _Client {
|
|
|
888
895
|
}
|
|
889
896
|
}
|
|
890
897
|
Object.defineProperty(extended, "withVersion", {
|
|
891
|
-
value: (
|
|
898
|
+
value: (version2) => this.withVersion(version2).extend(actions),
|
|
892
899
|
configurable: true,
|
|
893
900
|
writable: true
|
|
894
901
|
});
|
|
@@ -944,8 +951,8 @@ var CurrentUserV20251028Schema = z3.object({
|
|
|
944
951
|
}).passthrough();
|
|
945
952
|
|
|
946
953
|
// src/actions/get_current_user.ts
|
|
947
|
-
function getSchemaForVersion(
|
|
948
|
-
return
|
|
954
|
+
function getSchemaForVersion(version2) {
|
|
955
|
+
return version2 === "2025-10-28" ? CurrentUserV20251028Schema : CurrentUserV20260121Schema;
|
|
949
956
|
}
|
|
950
957
|
async function getCurrentUser(client, parameters) {
|
|
951
958
|
const response = await client.get("/auth/me");
|
|
@@ -1177,7 +1184,8 @@ var CvmKmsInfoV20260121BaseSchema = z6.object({
|
|
|
1177
1184
|
dstack_app_address: z6.string().nullable().optional(),
|
|
1178
1185
|
deployer_address: z6.string().nullable().optional(),
|
|
1179
1186
|
rpc_endpoint: z6.string().nullable().optional(),
|
|
1180
|
-
encrypted_env_pubkey: z6.string().nullable().optional()
|
|
1187
|
+
encrypted_env_pubkey: z6.string().nullable().optional(),
|
|
1188
|
+
k256_pubkey: z6.string().nullable().optional()
|
|
1181
1189
|
});
|
|
1182
1190
|
var CvmKmsInfoV20260121Schema = CvmKmsInfoV20260121BaseSchema.transform((data) => {
|
|
1183
1191
|
if (data.chain_id != null) {
|
|
@@ -1276,6 +1284,21 @@ var CvmInfoDetailV20260121Schema = CvmInfoV20260121Schema.extend({
|
|
|
1276
1284
|
var CvmInfoDetailV20260522Schema = CvmInfoV20260522Schema.extend({
|
|
1277
1285
|
compose_file: z6.union([z6.record(z6.string(), z6.any()), z6.string()]).nullable().optional()
|
|
1278
1286
|
});
|
|
1287
|
+
var CvmInfoDetailV20261111Schema = CvmInfoDetailV20260522Schema.extend({
|
|
1288
|
+
resource: CvmResourceInfoV20260121Schema.extend({
|
|
1289
|
+
memory_in_mb: z6.number().int()
|
|
1290
|
+
}),
|
|
1291
|
+
gpu: z6.object({
|
|
1292
|
+
product_id: z6.string().nullable(),
|
|
1293
|
+
gpus: z6.number().int(),
|
|
1294
|
+
cc_mode: z6.object({ expected: z6.enum(["on", "devtools"]) })
|
|
1295
|
+
}).optional(),
|
|
1296
|
+
dapp_dashboard_url: z6.string().nullable().optional(),
|
|
1297
|
+
syslog_endpoint: z6.string().nullable().optional()
|
|
1298
|
+
});
|
|
1299
|
+
var CvmGpuStatusSchema = z6.object({
|
|
1300
|
+
observed: z6.array(z6.object({ slot: z6.string(), cc_mode: z6.string() })).nullable()
|
|
1301
|
+
});
|
|
1279
1302
|
var PaginatedCvmInfosV20260121Schema = z6.object({
|
|
1280
1303
|
items: z6.array(CvmInfoV20260121Schema),
|
|
1281
1304
|
total: z6.number(),
|
|
@@ -1576,8 +1599,8 @@ var CvmCreateResourceGraphV20260522Schema = CvmCreateResourceGraphV20260121Schem
|
|
|
1576
1599
|
gateway_nodes: z8.array(CvmCreateGatewayResourceSchema)
|
|
1577
1600
|
});
|
|
1578
1601
|
var CvmCreateResourceGraphSchema = CvmCreateResourceGraphV20260522Schema;
|
|
1579
|
-
function getSchemaForVersion2(
|
|
1580
|
-
if (
|
|
1602
|
+
function getSchemaForVersion2(version2) {
|
|
1603
|
+
if (version2 === "2026-01-21") return CvmCreateResourceGraphV20260121Schema;
|
|
1581
1604
|
return CvmCreateResourceGraphV20260522Schema;
|
|
1582
1605
|
}
|
|
1583
1606
|
async function getCvmCreateResources(client, parameters) {
|
|
@@ -1952,8 +1975,8 @@ var CommitCvmProvisionRequestSchema = z11.object({
|
|
|
1952
1975
|
deployer_address: z11.string().optional(),
|
|
1953
1976
|
env_keys: z11.array(z11.string()).optional().nullable()
|
|
1954
1977
|
}).passthrough();
|
|
1955
|
-
function getSchemaForVersion3(
|
|
1956
|
-
if (
|
|
1978
|
+
function getSchemaForVersion3(version2) {
|
|
1979
|
+
if (version2 === "2026-01-21") return CommitCvmProvisionV20260121Schema;
|
|
1957
1980
|
return CommitCvmProvisionV20260522Schema;
|
|
1958
1981
|
}
|
|
1959
1982
|
async function commitCvmProvision(client, payload) {
|
|
@@ -2027,9 +2050,9 @@ var OMIT_WHEN_EMPTY = [
|
|
|
2027
2050
|
"pre_launch_script",
|
|
2028
2051
|
"salt"
|
|
2029
2052
|
];
|
|
2030
|
-
function parseOsImageVersion(
|
|
2053
|
+
function parseOsImageVersion(version2) {
|
|
2031
2054
|
const parts = [];
|
|
2032
|
-
for (const raw of
|
|
2055
|
+
for (const raw of version2.split(".")) {
|
|
2033
2056
|
const match = /^\d+/.exec(raw);
|
|
2034
2057
|
if (!match) break;
|
|
2035
2058
|
parts.push(Number(match[0]));
|
|
@@ -2038,8 +2061,8 @@ function parseOsImageVersion(version) {
|
|
|
2038
2061
|
while (parts.length < 3) parts.push(0);
|
|
2039
2062
|
return parts;
|
|
2040
2063
|
}
|
|
2041
|
-
function isBelowDstack060(
|
|
2042
|
-
const [major = 0, minor = 0] = parseOsImageVersion(
|
|
2064
|
+
function isBelowDstack060(version2) {
|
|
2065
|
+
const [major = 0, minor = 0] = parseOsImageVersion(version2);
|
|
2043
2066
|
return major === 0 && minor < 6;
|
|
2044
2067
|
}
|
|
2045
2068
|
function preprocessAppCompose(dic, osImageVersion) {
|
|
@@ -4615,18 +4638,55 @@ var { action: getAppEnvEncryptPubKey, safeAction: safeGetAppEnvEncryptPubKey } =
|
|
|
4615
4638
|
});
|
|
4616
4639
|
|
|
4617
4640
|
// src/actions/cvms/get_cvm_info.ts
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4641
|
+
import { z as z24 } from "zod";
|
|
4642
|
+
var GetCvmInfoRequestSchema = CvmIdObjectSchema.extend({
|
|
4643
|
+
cvmId: z24.string().optional(),
|
|
4644
|
+
include_compose: z24.boolean().optional()
|
|
4645
|
+
}).transform((request, ctx) => {
|
|
4646
|
+
const result = CvmIdSchema.safeParse({ ...request, id: request.cvmId ?? request.id });
|
|
4647
|
+
if (!result.success) {
|
|
4648
|
+
for (const issue of result.error.issues) {
|
|
4649
|
+
ctx.addIssue({ code: "custom", message: issue.message, path: issue.path });
|
|
4650
|
+
}
|
|
4651
|
+
return z24.NEVER;
|
|
4652
|
+
}
|
|
4653
|
+
return { ...result.data, include_compose: request.include_compose };
|
|
4654
|
+
});
|
|
4655
|
+
function getSchemaForVersion4(version2) {
|
|
4656
|
+
if (version2 === "2026-11-11") return CvmInfoDetailV20261111Schema;
|
|
4657
|
+
if (version2 === "2025-10-28") return CvmDetailV20251028Schema;
|
|
4658
|
+
if (version2 === "2026-01-21") return CvmInfoDetailV20260121Schema;
|
|
4622
4659
|
return CvmInfoDetailV20260522Schema;
|
|
4623
4660
|
}
|
|
4624
4661
|
async function getCvmInfo(client, request) {
|
|
4625
|
-
const
|
|
4626
|
-
const
|
|
4662
|
+
const validated = GetCvmInfoRequestSchema.parse(request);
|
|
4663
|
+
const { cvmId } = validated;
|
|
4664
|
+
const response = validated.include_compose === void 0 ? await client.get(`/cvms/${cvmId}`) : await client.get(`/cvms/${cvmId}`, {
|
|
4665
|
+
params: { include_compose: validated.include_compose }
|
|
4666
|
+
});
|
|
4627
4667
|
const schema = getSchemaForVersion4(client.config.version);
|
|
4628
4668
|
return schema.parse(response);
|
|
4629
4669
|
}
|
|
4670
|
+
async function getCvmGpuStatus(client, request) {
|
|
4671
|
+
const { cvmId } = z24.object({ cvmId: z24.string().min(1) }).parse(request);
|
|
4672
|
+
return CvmGpuStatusSchema.parse(await client.get(`/cvms/${cvmId}/gpu-status`));
|
|
4673
|
+
}
|
|
4674
|
+
async function safeGetCvmGpuStatus(client, request) {
|
|
4675
|
+
try {
|
|
4676
|
+
return { success: true, data: await getCvmGpuStatus(client, request) };
|
|
4677
|
+
} catch (error) {
|
|
4678
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
4679
|
+
return { success: false, error };
|
|
4680
|
+
}
|
|
4681
|
+
return {
|
|
4682
|
+
success: false,
|
|
4683
|
+
error: {
|
|
4684
|
+
name: "Error",
|
|
4685
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4686
|
+
}
|
|
4687
|
+
};
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4630
4690
|
async function safeGetCvmInfo(client, request) {
|
|
4631
4691
|
try {
|
|
4632
4692
|
const data = await getCvmInfo(client, request);
|
|
@@ -4646,16 +4706,16 @@ async function safeGetCvmInfo(client, request) {
|
|
|
4646
4706
|
}
|
|
4647
4707
|
|
|
4648
4708
|
// src/actions/cvms/get_cvm_list.ts
|
|
4649
|
-
import { z as
|
|
4650
|
-
var GetCvmListRequestSchema =
|
|
4651
|
-
page:
|
|
4652
|
-
page_size:
|
|
4653
|
-
family:
|
|
4654
|
-
instance_types:
|
|
4709
|
+
import { z as z25 } from "zod";
|
|
4710
|
+
var GetCvmListRequestSchema = z25.object({
|
|
4711
|
+
page: z25.number().int().min(1).optional(),
|
|
4712
|
+
page_size: z25.number().int().min(1).optional(),
|
|
4713
|
+
family: z25.enum(["all", "cpu", "gpu"]).optional(),
|
|
4714
|
+
instance_types: z25.array(z25.string()).optional()
|
|
4655
4715
|
}).strict();
|
|
4656
|
-
function getSchemaForVersion5(
|
|
4657
|
-
if (
|
|
4658
|
-
if (
|
|
4716
|
+
function getSchemaForVersion5(version2) {
|
|
4717
|
+
if (version2 === "2025-10-28") return PaginatedCvmInfosV20251028Schema;
|
|
4718
|
+
if (version2 === "2026-01-21") return PaginatedCvmInfosV20260121Schema;
|
|
4659
4719
|
return PaginatedCvmInfosV20260522Schema;
|
|
4660
4720
|
}
|
|
4661
4721
|
async function getCvmList(client, request) {
|
|
@@ -4683,9 +4743,9 @@ async function safeGetCvmList(client, request) {
|
|
|
4683
4743
|
}
|
|
4684
4744
|
|
|
4685
4745
|
// src/actions/kms/get_kms_info.ts
|
|
4686
|
-
import { z as
|
|
4687
|
-
var GetKmsInfoRequestSchema =
|
|
4688
|
-
kms_id:
|
|
4746
|
+
import { z as z26 } from "zod";
|
|
4747
|
+
var GetKmsInfoRequestSchema = z26.object({
|
|
4748
|
+
kms_id: z26.string().min(1, "KMS ID is required")
|
|
4689
4749
|
});
|
|
4690
4750
|
var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSchema, async (client, request) => {
|
|
4691
4751
|
const validatedRequest = GetKmsInfoRequestSchema.parse(request);
|
|
@@ -4695,18 +4755,18 @@ var { action: getKmsInfo, safeAction: safeGetKmsInfo } = defineAction(KmsInfoSch
|
|
|
4695
4755
|
});
|
|
4696
4756
|
|
|
4697
4757
|
// src/actions/kms/get_kms_list.ts
|
|
4698
|
-
import { z as
|
|
4699
|
-
var GetKmsListRequestSchema =
|
|
4700
|
-
page:
|
|
4701
|
-
page_size:
|
|
4702
|
-
is_onchain:
|
|
4758
|
+
import { z as z27 } from "zod";
|
|
4759
|
+
var GetKmsListRequestSchema = z27.object({
|
|
4760
|
+
page: z27.number().int().min(1).optional(),
|
|
4761
|
+
page_size: z27.number().int().min(1).optional(),
|
|
4762
|
+
is_onchain: z27.boolean().optional()
|
|
4703
4763
|
}).strict();
|
|
4704
|
-
var GetKmsListSchema =
|
|
4705
|
-
items:
|
|
4706
|
-
total:
|
|
4707
|
-
page:
|
|
4708
|
-
page_size:
|
|
4709
|
-
pages:
|
|
4764
|
+
var GetKmsListSchema = z27.object({
|
|
4765
|
+
items: z27.array(KmsInfoSchema),
|
|
4766
|
+
total: z27.number(),
|
|
4767
|
+
page: z27.number(),
|
|
4768
|
+
page_size: z27.number(),
|
|
4769
|
+
pages: z27.number()
|
|
4710
4770
|
}).strict();
|
|
4711
4771
|
var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsListSchema, async (client, request) => {
|
|
4712
4772
|
const validatedRequest = GetKmsListRequestSchema.parse(request ?? {});
|
|
@@ -4717,41 +4777,41 @@ var { action: getKmsList, safeAction: safeGetKmsList } = defineAction(GetKmsList
|
|
|
4717
4777
|
});
|
|
4718
4778
|
|
|
4719
4779
|
// src/actions/kms/list_kms_contracts.ts
|
|
4720
|
-
import { z as
|
|
4780
|
+
import { z as z29 } from "zod";
|
|
4721
4781
|
|
|
4722
4782
|
// src/types/kms_contract.ts
|
|
4723
|
-
import { z as
|
|
4724
|
-
var KmsContractInfoSchema =
|
|
4725
|
-
id:
|
|
4726
|
-
slug:
|
|
4727
|
-
label:
|
|
4728
|
-
contract_address:
|
|
4729
|
-
chain_id:
|
|
4730
|
-
k256_pubkey:
|
|
4731
|
-
ca_pubkey:
|
|
4732
|
-
node_count:
|
|
4783
|
+
import { z as z28 } from "zod";
|
|
4784
|
+
var KmsContractInfoSchema = z28.object({
|
|
4785
|
+
id: z28.string(),
|
|
4786
|
+
slug: z28.string().nullable(),
|
|
4787
|
+
label: z28.string().nullable(),
|
|
4788
|
+
contract_address: z28.string(),
|
|
4789
|
+
chain_id: z28.number(),
|
|
4790
|
+
k256_pubkey: z28.string().nullable(),
|
|
4791
|
+
ca_pubkey: z28.string().nullable(),
|
|
4792
|
+
node_count: z28.number()
|
|
4733
4793
|
}).passthrough();
|
|
4734
|
-
var KmsContractNodeSchema =
|
|
4735
|
-
id:
|
|
4736
|
-
slug:
|
|
4737
|
-
url:
|
|
4738
|
-
version:
|
|
4739
|
-
kms_type:
|
|
4794
|
+
var KmsContractNodeSchema = z28.object({
|
|
4795
|
+
id: z28.string(),
|
|
4796
|
+
slug: z28.string().nullable(),
|
|
4797
|
+
url: z28.string(),
|
|
4798
|
+
version: z28.string(),
|
|
4799
|
+
kms_type: z28.string()
|
|
4740
4800
|
}).passthrough();
|
|
4741
4801
|
|
|
4742
4802
|
// src/actions/kms/list_kms_contracts.ts
|
|
4743
4803
|
var KMS_CONTRACT_API_VERSION = "2026-06-23";
|
|
4744
|
-
var ListKmsContractsRequestSchema =
|
|
4745
|
-
page:
|
|
4746
|
-
page_size:
|
|
4747
|
-
is_onchain:
|
|
4804
|
+
var ListKmsContractsRequestSchema = z29.object({
|
|
4805
|
+
page: z29.number().int().min(1).optional(),
|
|
4806
|
+
page_size: z29.number().int().min(1).optional(),
|
|
4807
|
+
is_onchain: z29.boolean().optional()
|
|
4748
4808
|
}).strict();
|
|
4749
|
-
var ListKmsContractsSchema =
|
|
4750
|
-
items:
|
|
4751
|
-
total:
|
|
4752
|
-
page:
|
|
4753
|
-
page_size:
|
|
4754
|
-
pages:
|
|
4809
|
+
var ListKmsContractsSchema = z29.object({
|
|
4810
|
+
items: z29.array(KmsContractInfoSchema),
|
|
4811
|
+
total: z29.number(),
|
|
4812
|
+
page: z29.number(),
|
|
4813
|
+
page_size: z29.number(),
|
|
4814
|
+
pages: z29.number()
|
|
4755
4815
|
}).strict();
|
|
4756
4816
|
var { action: listKmsContracts, safeAction: safeListKmsContracts } = defineAction(ListKmsContractsSchema, async (client, request) => {
|
|
4757
4817
|
const validatedRequest = ListKmsContractsRequestSchema.parse(request ?? {});
|
|
@@ -4762,11 +4822,11 @@ var { action: listKmsContracts, safeAction: safeListKmsContracts } = defineActio
|
|
|
4762
4822
|
});
|
|
4763
4823
|
|
|
4764
4824
|
// src/actions/kms/get_kms_contract.ts
|
|
4765
|
-
import { z as
|
|
4825
|
+
import { z as z30 } from "zod";
|
|
4766
4826
|
var KMS_CONTRACT_API_VERSION2 = "2026-06-23";
|
|
4767
|
-
var GetKmsContractRequestSchema =
|
|
4827
|
+
var GetKmsContractRequestSchema = z30.object({
|
|
4768
4828
|
// Contract slug (documented). A kc_ hashed id also resolves.
|
|
4769
|
-
slug:
|
|
4829
|
+
slug: z30.string().min(1, "KMS contract slug is required")
|
|
4770
4830
|
}).strict();
|
|
4771
4831
|
var { action: getKmsContract, safeAction: safeGetKmsContract } = defineAction(KmsContractInfoSchema, async (client, payload) => {
|
|
4772
4832
|
const { slug } = GetKmsContractRequestSchema.parse(payload);
|
|
@@ -4776,15 +4836,15 @@ var { action: getKmsContract, safeAction: safeGetKmsContract } = defineAction(Km
|
|
|
4776
4836
|
});
|
|
4777
4837
|
|
|
4778
4838
|
// src/actions/kms/list_kms_contract_nodes.ts
|
|
4779
|
-
import { z as
|
|
4839
|
+
import { z as z31 } from "zod";
|
|
4780
4840
|
var KMS_CONTRACT_API_VERSION3 = "2026-06-23";
|
|
4781
|
-
var ListKmsContractNodesRequestSchema =
|
|
4841
|
+
var ListKmsContractNodesRequestSchema = z31.object({
|
|
4782
4842
|
// Contract slug (documented). A kc_ hashed id also resolves.
|
|
4783
|
-
slug:
|
|
4843
|
+
slug: z31.string().min(1, "KMS contract slug is required")
|
|
4784
4844
|
}).strict();
|
|
4785
|
-
var ListKmsContractNodesSchema =
|
|
4786
|
-
items:
|
|
4787
|
-
total:
|
|
4845
|
+
var ListKmsContractNodesSchema = z31.object({
|
|
4846
|
+
items: z31.array(KmsContractNodeSchema),
|
|
4847
|
+
total: z31.number()
|
|
4788
4848
|
}).strict();
|
|
4789
4849
|
var { action: listKmsContractNodes, safeAction: safeListKmsContractNodes } = defineAction(ListKmsContractNodesSchema, async (client, payload) => {
|
|
4790
4850
|
const { slug } = ListKmsContractNodesRequestSchema.parse(payload);
|
|
@@ -4794,35 +4854,35 @@ var { action: listKmsContractNodes, safeAction: safeListKmsContractNodes } = def
|
|
|
4794
4854
|
});
|
|
4795
4855
|
|
|
4796
4856
|
// src/actions/kms/get_kms_onchain_detail.ts
|
|
4797
|
-
import { z as
|
|
4798
|
-
var OnChainDeviceSchema =
|
|
4799
|
-
device_id:
|
|
4800
|
-
node_name:
|
|
4801
|
-
on_chain_allowed:
|
|
4857
|
+
import { z as z32 } from "zod";
|
|
4858
|
+
var OnChainDeviceSchema = z32.object({
|
|
4859
|
+
device_id: z32.string(),
|
|
4860
|
+
node_name: z32.string().nullable().optional(),
|
|
4861
|
+
on_chain_allowed: z32.boolean().nullable()
|
|
4802
4862
|
}).passthrough();
|
|
4803
|
-
var OnChainOsImageSchema =
|
|
4804
|
-
name:
|
|
4805
|
-
version:
|
|
4806
|
-
os_image_hash:
|
|
4807
|
-
on_chain_allowed:
|
|
4863
|
+
var OnChainOsImageSchema = z32.object({
|
|
4864
|
+
name: z32.string(),
|
|
4865
|
+
version: z32.string(),
|
|
4866
|
+
os_image_hash: z32.string().nullable(),
|
|
4867
|
+
on_chain_allowed: z32.boolean().nullable()
|
|
4808
4868
|
}).passthrough();
|
|
4809
|
-
var OnChainKmsContractSchema =
|
|
4810
|
-
contract_address:
|
|
4811
|
-
chain_id:
|
|
4812
|
-
chain_name:
|
|
4813
|
-
k256_pubkey:
|
|
4814
|
-
ca_pubkey:
|
|
4815
|
-
gateway_contract_address:
|
|
4816
|
-
devices:
|
|
4817
|
-
os_images:
|
|
4869
|
+
var OnChainKmsContractSchema = z32.object({
|
|
4870
|
+
contract_address: z32.string(),
|
|
4871
|
+
chain_id: z32.number(),
|
|
4872
|
+
chain_name: z32.string(),
|
|
4873
|
+
k256_pubkey: z32.string().nullable().optional(),
|
|
4874
|
+
ca_pubkey: z32.string().nullable().optional(),
|
|
4875
|
+
gateway_contract_address: z32.string().nullable().optional(),
|
|
4876
|
+
devices: z32.array(OnChainDeviceSchema),
|
|
4877
|
+
os_images: z32.array(OnChainOsImageSchema)
|
|
4818
4878
|
}).passthrough();
|
|
4819
|
-
var GetKmsOnChainDetailResponseSchema =
|
|
4820
|
-
chain_name:
|
|
4821
|
-
chain_id:
|
|
4822
|
-
contracts:
|
|
4879
|
+
var GetKmsOnChainDetailResponseSchema = z32.object({
|
|
4880
|
+
chain_name: z32.string(),
|
|
4881
|
+
chain_id: z32.number(),
|
|
4882
|
+
contracts: z32.array(OnChainKmsContractSchema)
|
|
4823
4883
|
}).passthrough();
|
|
4824
|
-
var GetKmsOnChainDetailRequestSchema =
|
|
4825
|
-
chain:
|
|
4884
|
+
var GetKmsOnChainDetailRequestSchema = z32.object({
|
|
4885
|
+
chain: z32.string()
|
|
4826
4886
|
}).strict();
|
|
4827
4887
|
var { action: getKmsOnChainDetail, safeAction: safeGetKmsOnChainDetail } = defineAction(GetKmsOnChainDetailResponseSchema, async (client, request) => {
|
|
4828
4888
|
const { chain } = GetKmsOnChainDetailRequestSchema.parse(request);
|
|
@@ -4830,15 +4890,15 @@ var { action: getKmsOnChainDetail, safeAction: safeGetKmsOnChainDetail } = defin
|
|
|
4830
4890
|
});
|
|
4831
4891
|
|
|
4832
4892
|
// src/actions/kms/next_app_ids.ts
|
|
4833
|
-
import { z as
|
|
4834
|
-
var NextAppIdsRequestSchema =
|
|
4835
|
-
counts:
|
|
4893
|
+
import { z as z33 } from "zod";
|
|
4894
|
+
var NextAppIdsRequestSchema = z33.object({
|
|
4895
|
+
counts: z33.number().int().min(1).max(20).optional().default(1)
|
|
4836
4896
|
}).strict();
|
|
4837
|
-
var NextAppIdsSchema =
|
|
4838
|
-
app_ids:
|
|
4839
|
-
|
|
4840
|
-
app_id:
|
|
4841
|
-
nonce:
|
|
4897
|
+
var NextAppIdsSchema = z33.object({
|
|
4898
|
+
app_ids: z33.array(
|
|
4899
|
+
z33.object({
|
|
4900
|
+
app_id: z33.string(),
|
|
4901
|
+
nonce: z33.number().int().min(0)
|
|
4842
4902
|
})
|
|
4843
4903
|
)
|
|
4844
4904
|
}).strict();
|
|
@@ -4850,34 +4910,34 @@ var { action: nextAppIds, safeAction: safeNextAppIds } = defineAction(NextAppIds
|
|
|
4850
4910
|
});
|
|
4851
4911
|
|
|
4852
4912
|
// src/actions/workspaces/list_workspaces.ts
|
|
4853
|
-
import { z as
|
|
4854
|
-
var WorkspaceResponseSchema =
|
|
4855
|
-
id:
|
|
4856
|
-
name:
|
|
4857
|
-
slug:
|
|
4858
|
-
avatar_url:
|
|
4859
|
-
description:
|
|
4860
|
-
tier:
|
|
4861
|
-
role:
|
|
4862
|
-
is_default:
|
|
4863
|
-
created_at:
|
|
4864
|
-
confidential_models_enabled:
|
|
4913
|
+
import { z as z34 } from "zod";
|
|
4914
|
+
var WorkspaceResponseSchema = z34.object({
|
|
4915
|
+
id: z34.string(),
|
|
4916
|
+
name: z34.string(),
|
|
4917
|
+
slug: z34.string().nullable(),
|
|
4918
|
+
avatar_url: z34.string().nullable().optional(),
|
|
4919
|
+
description: z34.string().nullable().optional(),
|
|
4920
|
+
tier: z34.string(),
|
|
4921
|
+
role: z34.string(),
|
|
4922
|
+
is_default: z34.boolean(),
|
|
4923
|
+
created_at: z34.string(),
|
|
4924
|
+
confidential_models_enabled: z34.boolean().optional(),
|
|
4865
4925
|
/**
|
|
4866
4926
|
* Billing lifecycle state. A suspended workspace has its CVMs stopped until
|
|
4867
4927
|
* it pays what it owes or is topped up. An abandoned one is closed and
|
|
4868
4928
|
* read-only until what it owes is paid.
|
|
4869
4929
|
*/
|
|
4870
|
-
billing_status:
|
|
4930
|
+
billing_status: z34.enum(["active", "suspended", "abandoned"]).default("active"),
|
|
4871
4931
|
/** When the workspace was suspended. Null unless billing_status is suspended. */
|
|
4872
|
-
suspended_at:
|
|
4932
|
+
suspended_at: z34.string().nullable().optional()
|
|
4873
4933
|
}).passthrough();
|
|
4874
|
-
var PaginationMetadataSchema =
|
|
4875
|
-
has_more:
|
|
4876
|
-
next_cursor:
|
|
4877
|
-
total:
|
|
4934
|
+
var PaginationMetadataSchema = z34.object({
|
|
4935
|
+
has_more: z34.boolean(),
|
|
4936
|
+
next_cursor: z34.string().nullable(),
|
|
4937
|
+
total: z34.number().nullable()
|
|
4878
4938
|
}).passthrough();
|
|
4879
|
-
var ListWorkspacesSchema =
|
|
4880
|
-
data:
|
|
4939
|
+
var ListWorkspacesSchema = z34.object({
|
|
4940
|
+
data: z34.array(WorkspaceResponseSchema),
|
|
4881
4941
|
pagination: PaginationMetadataSchema
|
|
4882
4942
|
}).passthrough();
|
|
4883
4943
|
var { action: listWorkspaces, safeAction: safeListWorkspaces } = defineAction(ListWorkspacesSchema, async (client, request) => {
|
|
@@ -4894,15 +4954,15 @@ var { action: getWorkspace, safeAction: safeGetWorkspace } = defineAction(Worksp
|
|
|
4894
4954
|
});
|
|
4895
4955
|
|
|
4896
4956
|
// src/actions/workspaces/get_workspace_nodes.ts
|
|
4897
|
-
import { z as
|
|
4957
|
+
import { z as z35 } from "zod";
|
|
4898
4958
|
var NodeRefSchema2 = NodeRefSchema;
|
|
4899
4959
|
var NodeInfoSchema = NodeRefSchema2;
|
|
4900
|
-
var GetWorkspaceNodesSchema =
|
|
4901
|
-
items:
|
|
4902
|
-
total:
|
|
4903
|
-
page:
|
|
4904
|
-
page_size:
|
|
4905
|
-
pages:
|
|
4960
|
+
var GetWorkspaceNodesSchema = z35.object({
|
|
4961
|
+
items: z35.array(NodeRefSchema2.extend({ node: z35.string() })),
|
|
4962
|
+
total: z35.number(),
|
|
4963
|
+
page: z35.number(),
|
|
4964
|
+
page_size: z35.number(),
|
|
4965
|
+
pages: z35.number()
|
|
4906
4966
|
}).passthrough();
|
|
4907
4967
|
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
4908
4968
|
const { teamSlug, page, pageSize } = request;
|
|
@@ -4914,64 +4974,64 @@ var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAct
|
|
|
4914
4974
|
});
|
|
4915
4975
|
|
|
4916
4976
|
// src/actions/workspaces/get_workspace_quotas.ts
|
|
4917
|
-
import { z as
|
|
4918
|
-
var QuotaMetricSchema =
|
|
4919
|
-
limit:
|
|
4920
|
-
remaining:
|
|
4977
|
+
import { z as z36 } from "zod";
|
|
4978
|
+
var QuotaMetricSchema = z36.object({
|
|
4979
|
+
limit: z36.number(),
|
|
4980
|
+
remaining: z36.number()
|
|
4921
4981
|
}).passthrough();
|
|
4922
|
-
var WorkspaceQuotasSchema =
|
|
4982
|
+
var WorkspaceQuotasSchema = z36.object({
|
|
4923
4983
|
vm_slots: QuotaMetricSchema,
|
|
4924
4984
|
vcpu: QuotaMetricSchema,
|
|
4925
4985
|
memory_mb: QuotaMetricSchema,
|
|
4926
4986
|
disk_gb: QuotaMetricSchema
|
|
4927
4987
|
}).passthrough();
|
|
4928
|
-
var WorkspaceReservedGpuQuotaSchema =
|
|
4988
|
+
var WorkspaceReservedGpuQuotaSchema = z36.object({
|
|
4929
4989
|
gpus: QuotaMetricSchema,
|
|
4930
|
-
in_use:
|
|
4931
|
-
misconfigured:
|
|
4990
|
+
in_use: z36.number(),
|
|
4991
|
+
misconfigured: z36.number()
|
|
4932
4992
|
}).passthrough();
|
|
4933
|
-
var GetWorkspaceQuotasSchema =
|
|
4934
|
-
team_slug:
|
|
4935
|
-
tier:
|
|
4993
|
+
var GetWorkspaceQuotasSchema = z36.object({
|
|
4994
|
+
team_slug: z36.string(),
|
|
4995
|
+
tier: z36.string(),
|
|
4936
4996
|
quotas: WorkspaceQuotasSchema,
|
|
4937
4997
|
reserved_nodes: QuotaMetricSchema,
|
|
4938
4998
|
reserved_gpu: WorkspaceReservedGpuQuotaSchema,
|
|
4939
|
-
as_of:
|
|
4999
|
+
as_of: z36.string()
|
|
4940
5000
|
}).passthrough();
|
|
4941
5001
|
var { action: getWorkspaceQuotas, safeAction: safeGetWorkspaceQuotas } = defineAction(GetWorkspaceQuotasSchema, async (client, request) => {
|
|
4942
5002
|
return await client.get(`/workspaces/${request.teamSlug}/quotas`);
|
|
4943
5003
|
});
|
|
4944
5004
|
|
|
4945
5005
|
// src/actions/list-instance-types.ts
|
|
4946
|
-
import { z as
|
|
4947
|
-
var InstanceTypeSchema =
|
|
4948
|
-
id:
|
|
4949
|
-
name:
|
|
4950
|
-
description:
|
|
4951
|
-
vcpu:
|
|
4952
|
-
memory_mb:
|
|
4953
|
-
hourly_rate:
|
|
4954
|
-
requires_gpu:
|
|
4955
|
-
requires_gpu_count:
|
|
4956
|
-
requires_gpu_product_id:
|
|
4957
|
-
default_disk_size_gb:
|
|
4958
|
-
family:
|
|
5006
|
+
import { z as z37 } from "zod";
|
|
5007
|
+
var InstanceTypeSchema = z37.object({
|
|
5008
|
+
id: z37.string(),
|
|
5009
|
+
name: z37.string(),
|
|
5010
|
+
description: z37.string(),
|
|
5011
|
+
vcpu: z37.number(),
|
|
5012
|
+
memory_mb: z37.number(),
|
|
5013
|
+
hourly_rate: z37.string(),
|
|
5014
|
+
requires_gpu: z37.boolean(),
|
|
5015
|
+
requires_gpu_count: z37.number().int().min(0).default(0),
|
|
5016
|
+
requires_gpu_product_id: z37.string().nullable().optional(),
|
|
5017
|
+
default_disk_size_gb: z37.number().default(20),
|
|
5018
|
+
family: z37.string().nullable()
|
|
4959
5019
|
}).passthrough();
|
|
4960
|
-
var FamilyGroupSchema =
|
|
4961
|
-
name:
|
|
4962
|
-
items:
|
|
4963
|
-
total:
|
|
5020
|
+
var FamilyGroupSchema = z37.object({
|
|
5021
|
+
name: z37.string(),
|
|
5022
|
+
items: z37.array(InstanceTypeSchema),
|
|
5023
|
+
total: z37.number()
|
|
4964
5024
|
}).strict();
|
|
4965
|
-
var AllFamiliesResponseSchema =
|
|
4966
|
-
result:
|
|
5025
|
+
var AllFamiliesResponseSchema = z37.object({
|
|
5026
|
+
result: z37.array(FamilyGroupSchema)
|
|
4967
5027
|
}).strict();
|
|
4968
|
-
var FamilyInstanceTypesResponseSchema =
|
|
4969
|
-
items:
|
|
4970
|
-
total:
|
|
4971
|
-
family:
|
|
5028
|
+
var FamilyInstanceTypesResponseSchema = z37.object({
|
|
5029
|
+
items: z37.array(InstanceTypeSchema),
|
|
5030
|
+
total: z37.number(),
|
|
5031
|
+
family: z37.string()
|
|
4972
5032
|
}).strict();
|
|
4973
|
-
var ListFamilyInstanceTypesRequestSchema =
|
|
4974
|
-
family:
|
|
5033
|
+
var ListFamilyInstanceTypesRequestSchema = z37.object({
|
|
5034
|
+
family: z37.string()
|
|
4975
5035
|
}).strict();
|
|
4976
5036
|
var { action: listAllInstanceTypeFamilies, safeAction: safeListAllInstanceTypeFamilies } = defineAction(
|
|
4977
5037
|
AllFamiliesResponseSchema,
|
|
@@ -4985,44 +5045,44 @@ var { action: listFamilyInstanceTypes, safeAction: safeListFamilyInstanceTypes }
|
|
|
4985
5045
|
});
|
|
4986
5046
|
|
|
4987
5047
|
// src/types/cvm_info.ts
|
|
4988
|
-
import { z as
|
|
4989
|
-
var VMBaseSchema =
|
|
4990
|
-
name:
|
|
4991
|
-
status:
|
|
4992
|
-
teepod_id:
|
|
4993
|
-
teepod:
|
|
4994
|
-
id:
|
|
4995
|
-
name:
|
|
4996
|
-
region_identifier:
|
|
5048
|
+
import { z as z38 } from "zod";
|
|
5049
|
+
var VMBaseSchema = z38.object({
|
|
5050
|
+
name: z38.string(),
|
|
5051
|
+
status: z38.string(),
|
|
5052
|
+
teepod_id: z38.number(),
|
|
5053
|
+
teepod: z38.object({
|
|
5054
|
+
id: z38.number(),
|
|
5055
|
+
name: z38.string(),
|
|
5056
|
+
region_identifier: z38.string().nullable().optional()
|
|
4997
5057
|
}).optional().nullable(),
|
|
4998
|
-
app_id:
|
|
4999
|
-
vm_uuid:
|
|
5000
|
-
instance_id:
|
|
5001
|
-
app_url:
|
|
5002
|
-
base_image:
|
|
5003
|
-
vcpu:
|
|
5004
|
-
memory:
|
|
5005
|
-
disk_size:
|
|
5006
|
-
manifest_version:
|
|
5007
|
-
version:
|
|
5008
|
-
runner:
|
|
5009
|
-
docker_compose_file:
|
|
5010
|
-
features:
|
|
5011
|
-
created_at:
|
|
5012
|
-
encrypted_env_pubkey:
|
|
5058
|
+
app_id: z38.string(),
|
|
5059
|
+
vm_uuid: z38.string().nullable(),
|
|
5060
|
+
instance_id: z38.string().nullable(),
|
|
5061
|
+
app_url: z38.string().optional().nullable(),
|
|
5062
|
+
base_image: z38.string().optional().nullable(),
|
|
5063
|
+
vcpu: z38.number(),
|
|
5064
|
+
memory: z38.number(),
|
|
5065
|
+
disk_size: z38.number(),
|
|
5066
|
+
manifest_version: z38.coerce.number().optional().nullable(),
|
|
5067
|
+
version: z38.string().optional().nullable(),
|
|
5068
|
+
runner: z38.string().optional().nullable(),
|
|
5069
|
+
docker_compose_file: z38.string().optional().nullable(),
|
|
5070
|
+
features: z38.array(z38.string()).optional().nullable(),
|
|
5071
|
+
created_at: z38.string(),
|
|
5072
|
+
encrypted_env_pubkey: z38.string().nullable()
|
|
5013
5073
|
});
|
|
5014
5074
|
var VMV20260121Schema = VMBaseSchema.extend({
|
|
5015
|
-
id:
|
|
5016
|
-
user_id:
|
|
5075
|
+
id: z38.number(),
|
|
5076
|
+
user_id: z38.number().optional().nullable()
|
|
5017
5077
|
});
|
|
5018
5078
|
var VMV20260522Schema = VMBaseSchema.extend({
|
|
5019
|
-
id:
|
|
5020
|
-
user_id:
|
|
5079
|
+
id: z38.string(),
|
|
5080
|
+
user_id: z38.string().optional().nullable()
|
|
5021
5081
|
});
|
|
5022
|
-
var VMAnySchema =
|
|
5082
|
+
var VMAnySchema = z38.union([VMV20260121Schema, VMV20260522Schema]);
|
|
5023
5083
|
var VMSchema = VMV20260522Schema;
|
|
5024
|
-
function getVMSchemaForVersion(
|
|
5025
|
-
if (
|
|
5084
|
+
function getVMSchemaForVersion(version2) {
|
|
5085
|
+
if (version2 === "2026-01-21") return VMV20260121Schema;
|
|
5026
5086
|
return VMV20260522Schema;
|
|
5027
5087
|
}
|
|
5028
5088
|
|
|
@@ -5102,10 +5162,10 @@ async function safeStopCvm(client, request) {
|
|
|
5102
5162
|
}
|
|
5103
5163
|
|
|
5104
5164
|
// src/actions/cvms/restart_cvm.ts
|
|
5105
|
-
import { z as
|
|
5165
|
+
import { z as z39 } from "zod";
|
|
5106
5166
|
var RestartCvmRequestSchema = refineCvmId(
|
|
5107
5167
|
CvmIdObjectSchema.extend({
|
|
5108
|
-
force:
|
|
5168
|
+
force: z39.boolean().optional()
|
|
5109
5169
|
})
|
|
5110
5170
|
);
|
|
5111
5171
|
async function restartCvm(client, request) {
|
|
@@ -5134,10 +5194,10 @@ async function safeRestartCvm(client, request) {
|
|
|
5134
5194
|
}
|
|
5135
5195
|
|
|
5136
5196
|
// src/actions/cvms/delete_cvm.ts
|
|
5137
|
-
import { z as
|
|
5197
|
+
import { z as z40 } from "zod";
|
|
5138
5198
|
var DeleteCvmRequestSchema = CvmIdSchema;
|
|
5139
5199
|
var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
5140
|
-
|
|
5200
|
+
z40.void(),
|
|
5141
5201
|
async (client, request) => {
|
|
5142
5202
|
const { cvmId } = DeleteCvmRequestSchema.parse(request);
|
|
5143
5203
|
await client.delete(`/cvms/${cvmId}`);
|
|
@@ -5146,17 +5206,17 @@ var { action: deleteCvm, safeAction: safeDeleteCvm } = defineAction(
|
|
|
5146
5206
|
);
|
|
5147
5207
|
|
|
5148
5208
|
// src/actions/cvms/replicate_cvm.ts
|
|
5149
|
-
import { z as
|
|
5209
|
+
import { z as z42 } from "zod";
|
|
5150
5210
|
|
|
5151
5211
|
// src/utils/placement-request.ts
|
|
5152
|
-
import { z as
|
|
5212
|
+
import { z as z41 } from "zod";
|
|
5153
5213
|
function placementRequest(schema) {
|
|
5154
|
-
return
|
|
5214
|
+
return z41.unknown().superRefine((data, ctx) => {
|
|
5155
5215
|
if (data !== null && typeof data === "object") {
|
|
5156
5216
|
for (const key of ["node_id", "teepod_id"]) {
|
|
5157
5217
|
if (key in data) {
|
|
5158
5218
|
ctx.addIssue({
|
|
5159
|
-
code:
|
|
5219
|
+
code: z41.ZodIssueCode.custom,
|
|
5160
5220
|
path: [key],
|
|
5161
5221
|
message: `Use node instead of ${key}`
|
|
5162
5222
|
});
|
|
@@ -5170,8 +5230,8 @@ function placementRequest(schema) {
|
|
|
5170
5230
|
var ReplicateCvmRequestSchema = placementRequest(
|
|
5171
5231
|
refineCvmId(
|
|
5172
5232
|
CvmIdObjectSchema.extend({
|
|
5173
|
-
node:
|
|
5174
|
-
os_image:
|
|
5233
|
+
node: z42.string().min(1).optional(),
|
|
5234
|
+
os_image: z42.string().min(1).optional()
|
|
5175
5235
|
})
|
|
5176
5236
|
)
|
|
5177
5237
|
);
|
|
@@ -5204,41 +5264,41 @@ async function safeReplicateCvm(client, request) {
|
|
|
5204
5264
|
}
|
|
5205
5265
|
|
|
5206
5266
|
// src/actions/cvms/get_cvm_stats.ts
|
|
5207
|
-
import { z as
|
|
5208
|
-
var DiskInfoSchema =
|
|
5209
|
-
name:
|
|
5210
|
-
mount_point:
|
|
5211
|
-
total_size:
|
|
5212
|
-
free_size:
|
|
5213
|
-
});
|
|
5214
|
-
var SystemInfoSchema =
|
|
5215
|
-
os_name:
|
|
5216
|
-
os_version:
|
|
5217
|
-
kernel_version:
|
|
5218
|
-
cpu_model:
|
|
5219
|
-
num_cpus:
|
|
5220
|
-
total_memory:
|
|
5221
|
-
available_memory:
|
|
5222
|
-
used_memory:
|
|
5223
|
-
free_memory:
|
|
5224
|
-
total_swap:
|
|
5225
|
-
used_swap:
|
|
5226
|
-
free_swap:
|
|
5227
|
-
uptime:
|
|
5228
|
-
loadavg_one:
|
|
5229
|
-
loadavg_five:
|
|
5230
|
-
loadavg_fifteen:
|
|
5231
|
-
disks:
|
|
5232
|
-
});
|
|
5233
|
-
var CvmSystemInfoSchema =
|
|
5234
|
-
is_online:
|
|
5235
|
-
is_public:
|
|
5236
|
-
error:
|
|
5267
|
+
import { z as z43 } from "zod";
|
|
5268
|
+
var DiskInfoSchema = z43.object({
|
|
5269
|
+
name: z43.string(),
|
|
5270
|
+
mount_point: z43.string(),
|
|
5271
|
+
total_size: z43.number(),
|
|
5272
|
+
free_size: z43.number()
|
|
5273
|
+
});
|
|
5274
|
+
var SystemInfoSchema = z43.object({
|
|
5275
|
+
os_name: z43.string(),
|
|
5276
|
+
os_version: z43.string(),
|
|
5277
|
+
kernel_version: z43.string(),
|
|
5278
|
+
cpu_model: z43.string(),
|
|
5279
|
+
num_cpus: z43.number(),
|
|
5280
|
+
total_memory: z43.number(),
|
|
5281
|
+
available_memory: z43.number(),
|
|
5282
|
+
used_memory: z43.number(),
|
|
5283
|
+
free_memory: z43.number(),
|
|
5284
|
+
total_swap: z43.number(),
|
|
5285
|
+
used_swap: z43.number(),
|
|
5286
|
+
free_swap: z43.number(),
|
|
5287
|
+
uptime: z43.number(),
|
|
5288
|
+
loadavg_one: z43.number(),
|
|
5289
|
+
loadavg_five: z43.number(),
|
|
5290
|
+
loadavg_fifteen: z43.number(),
|
|
5291
|
+
disks: z43.array(DiskInfoSchema)
|
|
5292
|
+
});
|
|
5293
|
+
var CvmSystemInfoSchema = z43.object({
|
|
5294
|
+
is_online: z43.boolean(),
|
|
5295
|
+
is_public: z43.boolean().default(false),
|
|
5296
|
+
error: z43.string().nullable(),
|
|
5237
5297
|
sysinfo: SystemInfoSchema.nullable(),
|
|
5238
|
-
status:
|
|
5239
|
-
in_progress:
|
|
5240
|
-
boot_progress:
|
|
5241
|
-
boot_error:
|
|
5298
|
+
status: z43.string().nullable(),
|
|
5299
|
+
in_progress: z43.boolean().default(false),
|
|
5300
|
+
boot_progress: z43.string().nullable(),
|
|
5301
|
+
boot_error: z43.string().nullable()
|
|
5242
5302
|
});
|
|
5243
5303
|
var GetCvmStatsRequestSchema = CvmIdSchema;
|
|
5244
5304
|
var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSystemInfoSchema, async (client, request) => {
|
|
@@ -5247,29 +5307,29 @@ var { action: getCvmStats, safeAction: safeGetCvmStats } = defineAction(CvmSyste
|
|
|
5247
5307
|
});
|
|
5248
5308
|
|
|
5249
5309
|
// src/actions/cvms/get_cvm_containers_stats.ts
|
|
5250
|
-
import { z as
|
|
5251
|
-
var ContainerInfoSchema =
|
|
5252
|
-
id:
|
|
5253
|
-
names:
|
|
5254
|
-
image:
|
|
5255
|
-
image_id:
|
|
5256
|
-
command:
|
|
5257
|
-
created:
|
|
5258
|
-
state:
|
|
5259
|
-
status:
|
|
5310
|
+
import { z as z44 } from "zod";
|
|
5311
|
+
var ContainerInfoSchema = z44.object({
|
|
5312
|
+
id: z44.string(),
|
|
5313
|
+
names: z44.array(z44.string()),
|
|
5314
|
+
image: z44.string(),
|
|
5315
|
+
image_id: z44.string(),
|
|
5316
|
+
command: z44.string().nullable().optional(),
|
|
5317
|
+
created: z44.number(),
|
|
5318
|
+
state: z44.string(),
|
|
5319
|
+
status: z44.string(),
|
|
5260
5320
|
/** Presigned container log URL that expires shortly after it is issued. */
|
|
5261
|
-
log_endpoint:
|
|
5321
|
+
log_endpoint: z44.string().nullable().describe("Presigned container log URL that expires shortly after issuance.")
|
|
5262
5322
|
});
|
|
5263
|
-
var CvmContainersStatsSchema =
|
|
5264
|
-
is_online:
|
|
5265
|
-
is_public:
|
|
5266
|
-
error:
|
|
5267
|
-
docker_compose_file:
|
|
5268
|
-
manifest_version:
|
|
5269
|
-
version:
|
|
5270
|
-
runner:
|
|
5271
|
-
features:
|
|
5272
|
-
containers:
|
|
5323
|
+
var CvmContainersStatsSchema = z44.object({
|
|
5324
|
+
is_online: z44.boolean(),
|
|
5325
|
+
is_public: z44.boolean().default(true),
|
|
5326
|
+
error: z44.string().nullable(),
|
|
5327
|
+
docker_compose_file: z44.string().nullable(),
|
|
5328
|
+
manifest_version: z44.coerce.number().nullable(),
|
|
5329
|
+
version: z44.string().nullable(),
|
|
5330
|
+
runner: z44.string().nullable(),
|
|
5331
|
+
features: z44.array(z44.string()).nullable(),
|
|
5332
|
+
containers: z44.array(ContainerInfoSchema).nullable()
|
|
5273
5333
|
});
|
|
5274
5334
|
var GetCvmContainersStatsRequestSchema = CvmIdSchema;
|
|
5275
5335
|
var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = defineAction(CvmContainersStatsSchema, async (client, request) => {
|
|
@@ -5278,18 +5338,18 @@ var { action: getCvmContainersStats, safeAction: safeGetCvmContainersStats } = d
|
|
|
5278
5338
|
});
|
|
5279
5339
|
|
|
5280
5340
|
// src/actions/cvms/get_cvm_network.ts
|
|
5281
|
-
import { z as
|
|
5282
|
-
var CvmNetworkUrlsSchema =
|
|
5283
|
-
app:
|
|
5284
|
-
instance:
|
|
5285
|
-
});
|
|
5286
|
-
var CvmNetworkSchema =
|
|
5287
|
-
is_online:
|
|
5288
|
-
is_public:
|
|
5289
|
-
error:
|
|
5290
|
-
internal_ip:
|
|
5291
|
-
latest_handshake:
|
|
5292
|
-
public_urls:
|
|
5341
|
+
import { z as z45 } from "zod";
|
|
5342
|
+
var CvmNetworkUrlsSchema = z45.object({
|
|
5343
|
+
app: z45.string(),
|
|
5344
|
+
instance: z45.string()
|
|
5345
|
+
});
|
|
5346
|
+
var CvmNetworkSchema = z45.object({
|
|
5347
|
+
is_online: z45.boolean(),
|
|
5348
|
+
is_public: z45.boolean().default(true),
|
|
5349
|
+
error: z45.string().nullable(),
|
|
5350
|
+
internal_ip: z45.string().nullable(),
|
|
5351
|
+
latest_handshake: z45.string().nullable(),
|
|
5352
|
+
public_urls: z45.array(CvmNetworkUrlsSchema).nullable()
|
|
5293
5353
|
});
|
|
5294
5354
|
var GetCvmNetworkRequestSchema = CvmIdSchema;
|
|
5295
5355
|
var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmNetworkSchema, async (client, request) => {
|
|
@@ -5298,17 +5358,17 @@ var { action: getCvmNetwork, safeAction: safeGetCvmNetwork } = defineAction(CvmN
|
|
|
5298
5358
|
});
|
|
5299
5359
|
|
|
5300
5360
|
// src/actions/cvms/get_cvm_state.ts
|
|
5301
|
-
import { z as
|
|
5302
|
-
var CvmStateSchema =
|
|
5303
|
-
id:
|
|
5304
|
-
instance_id:
|
|
5305
|
-
name:
|
|
5306
|
-
status:
|
|
5307
|
-
uptime:
|
|
5308
|
-
exited_at:
|
|
5309
|
-
boot_progress:
|
|
5310
|
-
boot_error:
|
|
5311
|
-
shutdown_progress:
|
|
5361
|
+
import { z as z46 } from "zod";
|
|
5362
|
+
var CvmStateSchema = z46.object({
|
|
5363
|
+
id: z46.string().optional(),
|
|
5364
|
+
instance_id: z46.string().optional(),
|
|
5365
|
+
name: z46.string(),
|
|
5366
|
+
status: z46.string(),
|
|
5367
|
+
uptime: z46.string().optional(),
|
|
5368
|
+
exited_at: z46.string().optional(),
|
|
5369
|
+
boot_progress: z46.string().optional(),
|
|
5370
|
+
boot_error: z46.string().optional(),
|
|
5371
|
+
shutdown_progress: z46.string().optional()
|
|
5312
5372
|
});
|
|
5313
5373
|
var GetCvmStateRequestSchema = CvmIdSchema;
|
|
5314
5374
|
var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmStateSchema, async (client, request) => {
|
|
@@ -5317,14 +5377,14 @@ var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmState
|
|
|
5317
5377
|
});
|
|
5318
5378
|
|
|
5319
5379
|
// src/actions/cvms/watch_cvm_state.ts
|
|
5320
|
-
import { z as
|
|
5321
|
-
var WatchCvmStateParamsSchema =
|
|
5322
|
-
target:
|
|
5323
|
-
interval:
|
|
5324
|
-
timeout:
|
|
5380
|
+
import { z as z47 } from "zod";
|
|
5381
|
+
var WatchCvmStateParamsSchema = z47.object({
|
|
5382
|
+
target: z47.string().describe("Target status to wait for (e.g., 'running', 'stopped')"),
|
|
5383
|
+
interval: z47.number().min(5).max(30).default(5).describe("Polling interval in seconds"),
|
|
5384
|
+
timeout: z47.number().min(10).max(600).default(300).describe("Timeout per attempt in seconds"),
|
|
5325
5385
|
// Zod 4 rejects Infinity in z.number(), so allow it explicitly.
|
|
5326
|
-
maxRetries:
|
|
5327
|
-
retryDelay:
|
|
5386
|
+
maxRetries: z47.union([z47.number().min(0), z47.literal(Number.POSITIVE_INFINITY)]).default(Number.POSITIVE_INFINITY).describe("Maximum number of retry attempts (Infinity for unlimited)"),
|
|
5387
|
+
retryDelay: z47.number().min(0).default(5e3).describe("Delay between retries in milliseconds")
|
|
5328
5388
|
});
|
|
5329
5389
|
var WatchCvmStateRequestSchema = WatchCvmStateParamsSchema;
|
|
5330
5390
|
var WatchAbortedError = class extends Error {
|
|
@@ -5546,62 +5606,62 @@ function sleep(ms, signal) {
|
|
|
5546
5606
|
}
|
|
5547
5607
|
|
|
5548
5608
|
// src/actions/cvms/get_cvm_attestation.ts
|
|
5549
|
-
import { z as
|
|
5550
|
-
var CertificateSubjectSchema =
|
|
5551
|
-
common_name:
|
|
5552
|
-
organization:
|
|
5553
|
-
country:
|
|
5554
|
-
state:
|
|
5555
|
-
locality:
|
|
5556
|
-
});
|
|
5557
|
-
var CertificateIssuerSchema =
|
|
5558
|
-
common_name:
|
|
5559
|
-
organization:
|
|
5560
|
-
country:
|
|
5561
|
-
});
|
|
5562
|
-
var CertificateSchema =
|
|
5609
|
+
import { z as z48 } from "zod";
|
|
5610
|
+
var CertificateSubjectSchema = z48.object({
|
|
5611
|
+
common_name: z48.string().nullable(),
|
|
5612
|
+
organization: z48.string().nullable(),
|
|
5613
|
+
country: z48.string().nullable(),
|
|
5614
|
+
state: z48.string().nullable(),
|
|
5615
|
+
locality: z48.string().nullable()
|
|
5616
|
+
});
|
|
5617
|
+
var CertificateIssuerSchema = z48.object({
|
|
5618
|
+
common_name: z48.string().nullable(),
|
|
5619
|
+
organization: z48.string().nullable(),
|
|
5620
|
+
country: z48.string().nullable()
|
|
5621
|
+
});
|
|
5622
|
+
var CertificateSchema = z48.object({
|
|
5563
5623
|
subject: CertificateSubjectSchema,
|
|
5564
5624
|
issuer: CertificateIssuerSchema,
|
|
5565
|
-
serial_number:
|
|
5566
|
-
not_before:
|
|
5625
|
+
serial_number: z48.string(),
|
|
5626
|
+
not_before: z48.string(),
|
|
5567
5627
|
// datetime serialized as ISO string
|
|
5568
|
-
not_after:
|
|
5628
|
+
not_after: z48.string(),
|
|
5569
5629
|
// datetime serialized as ISO string
|
|
5570
|
-
version:
|
|
5571
|
-
fingerprint:
|
|
5572
|
-
signature_algorithm:
|
|
5573
|
-
sans:
|
|
5574
|
-
is_ca:
|
|
5575
|
-
position_in_chain:
|
|
5576
|
-
quote:
|
|
5577
|
-
app_id:
|
|
5578
|
-
cert_usage:
|
|
5579
|
-
});
|
|
5580
|
-
var EventLogSchema =
|
|
5581
|
-
imr:
|
|
5582
|
-
event_type:
|
|
5583
|
-
digest:
|
|
5584
|
-
event:
|
|
5585
|
-
event_payload:
|
|
5586
|
-
});
|
|
5587
|
-
var TcbInfoSchema =
|
|
5588
|
-
mrtd:
|
|
5589
|
-
rootfs_hash:
|
|
5590
|
-
rtmr0:
|
|
5591
|
-
rtmr1:
|
|
5592
|
-
rtmr2:
|
|
5593
|
-
rtmr3:
|
|
5594
|
-
event_log:
|
|
5595
|
-
app_compose:
|
|
5596
|
-
});
|
|
5597
|
-
var CvmAttestationSchema =
|
|
5598
|
-
name:
|
|
5599
|
-
is_online:
|
|
5600
|
-
is_public:
|
|
5601
|
-
error:
|
|
5602
|
-
app_certificates:
|
|
5630
|
+
version: z48.string(),
|
|
5631
|
+
fingerprint: z48.string(),
|
|
5632
|
+
signature_algorithm: z48.string(),
|
|
5633
|
+
sans: z48.array(z48.string()).nullable(),
|
|
5634
|
+
is_ca: z48.boolean(),
|
|
5635
|
+
position_in_chain: z48.number().nullable(),
|
|
5636
|
+
quote: z48.string().nullable(),
|
|
5637
|
+
app_id: z48.string().nullable().optional(),
|
|
5638
|
+
cert_usage: z48.string().nullable().optional()
|
|
5639
|
+
});
|
|
5640
|
+
var EventLogSchema = z48.object({
|
|
5641
|
+
imr: z48.number(),
|
|
5642
|
+
event_type: z48.number(),
|
|
5643
|
+
digest: z48.string(),
|
|
5644
|
+
event: z48.string(),
|
|
5645
|
+
event_payload: z48.string()
|
|
5646
|
+
});
|
|
5647
|
+
var TcbInfoSchema = z48.object({
|
|
5648
|
+
mrtd: z48.string(),
|
|
5649
|
+
rootfs_hash: z48.string().nullable().optional(),
|
|
5650
|
+
rtmr0: z48.string(),
|
|
5651
|
+
rtmr1: z48.string(),
|
|
5652
|
+
rtmr2: z48.string(),
|
|
5653
|
+
rtmr3: z48.string(),
|
|
5654
|
+
event_log: z48.array(EventLogSchema),
|
|
5655
|
+
app_compose: z48.string()
|
|
5656
|
+
});
|
|
5657
|
+
var CvmAttestationSchema = z48.object({
|
|
5658
|
+
name: z48.string().nullable(),
|
|
5659
|
+
is_online: z48.boolean(),
|
|
5660
|
+
is_public: z48.boolean().default(true),
|
|
5661
|
+
error: z48.string().nullable(),
|
|
5662
|
+
app_certificates: z48.array(CertificateSchema).nullable(),
|
|
5603
5663
|
tcb_info: TcbInfoSchema.nullable(),
|
|
5604
|
-
compose_file:
|
|
5664
|
+
compose_file: z48.string().nullable()
|
|
5605
5665
|
});
|
|
5606
5666
|
var GetCvmAttestationRequestSchema = CvmIdSchema;
|
|
5607
5667
|
var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAction(CvmAttestationSchema, async (client, request) => {
|
|
@@ -5610,115 +5670,115 @@ var { action: getCvmAttestation, safeAction: safeGetCvmAttestation } = defineAct
|
|
|
5610
5670
|
});
|
|
5611
5671
|
|
|
5612
5672
|
// src/actions/cvms/get_cvm_docker_compose.ts
|
|
5613
|
-
import { z as
|
|
5673
|
+
import { z as z49 } from "zod";
|
|
5614
5674
|
var GetCvmDockerComposeRequestSchema = CvmIdSchema;
|
|
5615
|
-
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(
|
|
5675
|
+
var { action: getCvmDockerCompose, safeAction: safeGetCvmDockerCompose } = defineAction(z49.string(), async (client, request) => {
|
|
5616
5676
|
const { cvmId } = GetCvmDockerComposeRequestSchema.parse(request);
|
|
5617
5677
|
return await client.get(`/cvms/${cvmId}/docker-compose.yml`);
|
|
5618
5678
|
});
|
|
5619
5679
|
|
|
5620
5680
|
// src/actions/cvms/patch_cvm.ts
|
|
5621
|
-
import { z as
|
|
5622
|
-
var PatchCvmGpuConfigSchema =
|
|
5623
|
-
gpus:
|
|
5624
|
-
|
|
5625
|
-
slot:
|
|
5626
|
-
product_id:
|
|
5681
|
+
import { z as z50 } from "zod";
|
|
5682
|
+
var PatchCvmGpuConfigSchema = z50.object({
|
|
5683
|
+
gpus: z50.array(
|
|
5684
|
+
z50.object({
|
|
5685
|
+
slot: z50.string(),
|
|
5686
|
+
product_id: z50.string().optional()
|
|
5627
5687
|
})
|
|
5628
5688
|
),
|
|
5629
|
-
attach_mode:
|
|
5689
|
+
attach_mode: z50.string().optional()
|
|
5630
5690
|
});
|
|
5631
|
-
var ComposeRequirementsPatchSchema =
|
|
5691
|
+
var ComposeRequirementsPatchSchema = z50.object({
|
|
5632
5692
|
/** Format the data disk on every boot (OS >= 0.6.3). Turning it on needs `confirm_data_wipe`. */
|
|
5633
|
-
ephemeral_data_disk:
|
|
5634
|
-
health_check:
|
|
5635
|
-
health_status_file:
|
|
5693
|
+
ephemeral_data_disk: z50.boolean().nullable().optional(),
|
|
5694
|
+
health_check: z50.boolean().nullable().optional(),
|
|
5695
|
+
health_status_file: z50.string().nullable().optional(),
|
|
5636
5696
|
/** Must be the hash of the app's launch token. */
|
|
5637
|
-
launch_token_hash:
|
|
5638
|
-
platforms:
|
|
5639
|
-
tdx_measure_acpi_tables:
|
|
5697
|
+
launch_token_hash: z50.string().nullable().optional(),
|
|
5698
|
+
platforms: z50.array(z50.string()).nullable().optional(),
|
|
5699
|
+
tdx_measure_acpi_tables: z50.boolean().nullable().optional()
|
|
5640
5700
|
}).passthrough();
|
|
5641
|
-
var ComposePatchSchema =
|
|
5642
|
-
secure_time:
|
|
5643
|
-
swap_size:
|
|
5644
|
-
storage_discard:
|
|
5701
|
+
var ComposePatchSchema = z50.object({
|
|
5702
|
+
secure_time: z50.boolean().nullable().optional(),
|
|
5703
|
+
swap_size: z50.string().nullable().optional(),
|
|
5704
|
+
storage_discard: z50.boolean().nullable().optional(),
|
|
5645
5705
|
/** Only with the nerdctl-compose runner. */
|
|
5646
|
-
snapshotter:
|
|
5706
|
+
snapshotter: z50.enum(["overlayfs", "stargz"]).nullable().optional(),
|
|
5647
5707
|
/** Disabling removes the instance from the gateway after the update. */
|
|
5648
|
-
gateway_enabled:
|
|
5708
|
+
gateway_enabled: z50.boolean().nullable().optional(),
|
|
5649
5709
|
port_policy: PortPolicySchema.nullable().optional(),
|
|
5650
|
-
event_log_version:
|
|
5710
|
+
event_log_version: z50.union([z50.literal(1), z50.literal(2)]).nullable().optional(),
|
|
5651
5711
|
requirements: ComposeRequirementsPatchSchema.nullable().optional(),
|
|
5652
5712
|
// Fixed when the CVM is created: the current value passes, any other is rejected.
|
|
5653
|
-
kms_enabled:
|
|
5654
|
-
key_provider:
|
|
5655
|
-
key_provider_id:
|
|
5656
|
-
local_key_provider_enabled:
|
|
5657
|
-
manifest_version:
|
|
5658
|
-
no_instance_id:
|
|
5659
|
-
runner:
|
|
5660
|
-
storage_fs:
|
|
5661
|
-
verity_volumes:
|
|
5662
|
-
tproxy_enabled:
|
|
5663
|
-
features:
|
|
5713
|
+
kms_enabled: z50.boolean().nullable().optional(),
|
|
5714
|
+
key_provider: z50.enum(["none", "kms", "local", "tpm"]).nullable().optional(),
|
|
5715
|
+
key_provider_id: z50.string().nullable().optional(),
|
|
5716
|
+
local_key_provider_enabled: z50.boolean().nullable().optional(),
|
|
5717
|
+
manifest_version: z50.union([z50.number(), z50.string()]).nullable().optional(),
|
|
5718
|
+
no_instance_id: z50.boolean().nullable().optional(),
|
|
5719
|
+
runner: z50.string().nullable().optional(),
|
|
5720
|
+
storage_fs: z50.enum(["ext4", "zfs"]).nullable().optional(),
|
|
5721
|
+
verity_volumes: z50.array(VerityVolumeSchema).nullable().optional(),
|
|
5722
|
+
tproxy_enabled: z50.boolean().nullable().optional(),
|
|
5723
|
+
features: z50.array(z50.string()).nullable().optional()
|
|
5664
5724
|
}).passthrough();
|
|
5665
5725
|
var PatchCvmRequestSchema = refineCvmId(
|
|
5666
5726
|
CvmIdObjectSchema.extend({
|
|
5667
5727
|
// Compose-hash-affecting fields
|
|
5668
|
-
docker_compose_file:
|
|
5669
|
-
pre_launch_script:
|
|
5670
|
-
allowed_envs:
|
|
5728
|
+
docker_compose_file: z50.string().optional(),
|
|
5729
|
+
pre_launch_script: z50.string().optional(),
|
|
5730
|
+
allowed_envs: z50.array(z50.string()).optional(),
|
|
5671
5731
|
// Visibility
|
|
5672
|
-
public_logs:
|
|
5673
|
-
public_sysinfo:
|
|
5674
|
-
public_tcbinfo:
|
|
5732
|
+
public_logs: z50.boolean().optional(),
|
|
5733
|
+
public_sysinfo: z50.boolean().optional(),
|
|
5734
|
+
public_tcbinfo: z50.boolean().optional(),
|
|
5675
5735
|
// JSON Merge Patch of the app compose (see ComposePatchSchema)
|
|
5676
5736
|
compose: ComposePatchSchema.optional(),
|
|
5677
5737
|
// Platform init scripts this CVM runs, replacing the current set
|
|
5678
|
-
init_scripts:
|
|
5738
|
+
init_scripts: z50.array(InitScriptSlugSchema).optional(),
|
|
5679
5739
|
// Raw guest init scripts, replacing the current set. System admins only.
|
|
5680
|
-
init_script:
|
|
5740
|
+
init_script: z50.array(z50.string()).optional(),
|
|
5681
5741
|
// Confirms turning on docker_cleanup or requirements.ephemeral_data_disk,
|
|
5682
5742
|
// which erase data on every boot
|
|
5683
|
-
confirm_data_wipe:
|
|
5743
|
+
confirm_data_wipe: z50.boolean().optional(),
|
|
5684
5744
|
// Non-compose-hash config
|
|
5685
|
-
encrypted_env:
|
|
5686
|
-
user_config:
|
|
5745
|
+
encrypted_env: z50.string().optional(),
|
|
5746
|
+
user_config: z50.string().optional(),
|
|
5687
5747
|
gpus: PatchCvmGpuConfigSchema.optional(),
|
|
5688
5748
|
// Resources
|
|
5689
|
-
vcpu:
|
|
5690
|
-
memory:
|
|
5691
|
-
disk_size:
|
|
5692
|
-
instance_type:
|
|
5749
|
+
vcpu: z50.number().optional(),
|
|
5750
|
+
memory: z50.number().optional(),
|
|
5751
|
+
disk_size: z50.number().optional(),
|
|
5752
|
+
instance_type: z50.string().optional(),
|
|
5693
5753
|
// OS image
|
|
5694
|
-
image:
|
|
5754
|
+
image: z50.string().optional(),
|
|
5695
5755
|
// Shutdown behavior
|
|
5696
|
-
shutdown_timeout:
|
|
5697
|
-
allow_force_stop:
|
|
5756
|
+
shutdown_timeout: z50.number().optional(),
|
|
5757
|
+
allow_force_stop: z50.boolean().optional(),
|
|
5698
5758
|
// Prepare-only mode (for multisig workflows)
|
|
5699
|
-
prepareOnly:
|
|
5759
|
+
prepareOnly: z50.boolean().optional()
|
|
5700
5760
|
})
|
|
5701
5761
|
);
|
|
5702
|
-
var PatchCvmAcceptedSchema =
|
|
5703
|
-
requiresOnChainHash:
|
|
5704
|
-
correlationId:
|
|
5705
|
-
});
|
|
5706
|
-
var PatchCvmHashRequiredSchema =
|
|
5707
|
-
requiresOnChainHash:
|
|
5708
|
-
composeHash:
|
|
5709
|
-
appId:
|
|
5710
|
-
deviceId:
|
|
5762
|
+
var PatchCvmAcceptedSchema = z50.object({
|
|
5763
|
+
requiresOnChainHash: z50.literal(false),
|
|
5764
|
+
correlationId: z50.string()
|
|
5765
|
+
});
|
|
5766
|
+
var PatchCvmHashRequiredSchema = z50.object({
|
|
5767
|
+
requiresOnChainHash: z50.literal(true),
|
|
5768
|
+
composeHash: z50.string(),
|
|
5769
|
+
appId: z50.string(),
|
|
5770
|
+
deviceId: z50.string(),
|
|
5711
5771
|
kmsInfo: KmsInfoSchema,
|
|
5712
|
-
commitToken:
|
|
5713
|
-
commitUrl:
|
|
5714
|
-
apiCommitUrl:
|
|
5715
|
-
onchainStatus:
|
|
5716
|
-
compose_hash_allowed:
|
|
5717
|
-
device_id_allowed:
|
|
5718
|
-
is_allowed:
|
|
5772
|
+
commitToken: z50.string().optional(),
|
|
5773
|
+
commitUrl: z50.string().optional(),
|
|
5774
|
+
apiCommitUrl: z50.string().optional(),
|
|
5775
|
+
onchainStatus: z50.object({
|
|
5776
|
+
compose_hash_allowed: z50.boolean(),
|
|
5777
|
+
device_id_allowed: z50.boolean(),
|
|
5778
|
+
is_allowed: z50.boolean()
|
|
5719
5779
|
}).optional()
|
|
5720
5780
|
});
|
|
5721
|
-
var PatchCvmResultSchema =
|
|
5781
|
+
var PatchCvmResultSchema = z50.discriminatedUnion("requiresOnChainHash", [
|
|
5722
5782
|
PatchCvmAcceptedSchema,
|
|
5723
5783
|
PatchCvmHashRequiredSchema
|
|
5724
5784
|
]);
|
|
@@ -5768,15 +5828,15 @@ var { action: patchCvm, safeAction: safePatchCvm } = defineAction(PatchCvmResult
|
|
|
5768
5828
|
});
|
|
5769
5829
|
|
|
5770
5830
|
// src/actions/cvms/confirm_cvm_patch.ts
|
|
5771
|
-
import { z as
|
|
5831
|
+
import { z as z51 } from "zod";
|
|
5772
5832
|
var ConfirmCvmPatchRequestSchema = refineCvmId(
|
|
5773
5833
|
CvmIdObjectSchema.extend({
|
|
5774
|
-
composeHash:
|
|
5775
|
-
transactionHash:
|
|
5834
|
+
composeHash: z51.string().describe("Compose hash from patchCvm Phase 1 response"),
|
|
5835
|
+
transactionHash: z51.string().describe("Transaction hash proving on-chain registration")
|
|
5776
5836
|
})
|
|
5777
5837
|
);
|
|
5778
|
-
var ConfirmCvmPatchResultSchema =
|
|
5779
|
-
correlationId:
|
|
5838
|
+
var ConfirmCvmPatchResultSchema = z51.object({
|
|
5839
|
+
correlationId: z51.string()
|
|
5780
5840
|
});
|
|
5781
5841
|
var { action: confirmCvmPatch, safeAction: safeConfirmCvmPatch } = defineAction(ConfirmCvmPatchResultSchema, async (client, request) => {
|
|
5782
5842
|
const parsed = ConfirmCvmPatchRequestSchema.parse(request);
|
|
@@ -5797,17 +5857,17 @@ var { action: confirmCvmPatch, safeAction: safeConfirmCvmPatch } = defineAction(
|
|
|
5797
5857
|
});
|
|
5798
5858
|
|
|
5799
5859
|
// src/actions/cvms/commit_cvm_update.ts
|
|
5800
|
-
import { z as
|
|
5860
|
+
import { z as z52 } from "zod";
|
|
5801
5861
|
var CommitCvmUpdateRequestSchema = refineCvmId(
|
|
5802
5862
|
CvmIdObjectSchema.extend({
|
|
5803
|
-
token:
|
|
5804
|
-
composeHash:
|
|
5805
|
-
transactionHash:
|
|
5863
|
+
token: z52.string().describe("One-time commit token from prepare-only flow"),
|
|
5864
|
+
composeHash: z52.string().describe("Compose hash from Phase 1 response"),
|
|
5865
|
+
transactionHash: z52.string().describe("Transaction hash proving on-chain registration")
|
|
5806
5866
|
})
|
|
5807
5867
|
);
|
|
5808
|
-
var CommitCvmUpdateResultSchema =
|
|
5809
|
-
correlationId:
|
|
5810
|
-
status:
|
|
5868
|
+
var CommitCvmUpdateResultSchema = z52.object({
|
|
5869
|
+
correlationId: z52.string(),
|
|
5870
|
+
status: z52.string()
|
|
5811
5871
|
});
|
|
5812
5872
|
var { action: commitCvmUpdate, safeAction: safeCommitCvmUpdate } = defineAction(CommitCvmUpdateResultSchema, async (client, request) => {
|
|
5813
5873
|
const parsed = CommitCvmUpdateRequestSchema.parse(request);
|
|
@@ -5824,24 +5884,24 @@ var { action: commitCvmUpdate, safeAction: safeCommitCvmUpdate } = defineAction(
|
|
|
5824
5884
|
});
|
|
5825
5885
|
|
|
5826
5886
|
// src/actions/cvms/update_cvm_resources.ts
|
|
5827
|
-
import { z as
|
|
5887
|
+
import { z as z53 } from "zod";
|
|
5828
5888
|
var UpdateCvmResourcesRequestSchema = refineCvmId(
|
|
5829
5889
|
CvmIdObjectSchema.extend({
|
|
5830
|
-
vcpu:
|
|
5831
|
-
memory:
|
|
5832
|
-
disk_size:
|
|
5833
|
-
instance_type:
|
|
5890
|
+
vcpu: z53.number().optional(),
|
|
5891
|
+
memory: z53.number().optional(),
|
|
5892
|
+
disk_size: z53.number().optional(),
|
|
5893
|
+
instance_type: z53.string().optional(),
|
|
5834
5894
|
/**
|
|
5835
5895
|
* @deprecated The backend restarts the CVM whenever a resize needs it and
|
|
5836
5896
|
* ignores this flag. It is no longer sent.
|
|
5837
5897
|
*/
|
|
5838
|
-
allow_restart:
|
|
5898
|
+
allow_restart: z53.boolean().optional()
|
|
5839
5899
|
})
|
|
5840
5900
|
);
|
|
5841
|
-
var UpdateCvmResourcesResponseSchema =
|
|
5842
|
-
message:
|
|
5843
|
-
correlation_id:
|
|
5844
|
-
status:
|
|
5901
|
+
var UpdateCvmResourcesResponseSchema = z53.object({
|
|
5902
|
+
message: z53.string(),
|
|
5903
|
+
correlation_id: z53.string(),
|
|
5904
|
+
status: z53.string()
|
|
5845
5905
|
});
|
|
5846
5906
|
var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineAction(UpdateCvmResourcesResponseSchema, async (client, request) => {
|
|
5847
5907
|
const parsed = UpdateCvmResourcesRequestSchema.parse(request);
|
|
@@ -5851,18 +5911,18 @@ var { action: updateCvmResources, safeAction: safeUpdateCvmResources } = defineA
|
|
|
5851
5911
|
});
|
|
5852
5912
|
|
|
5853
5913
|
// src/actions/cvms/update_cvm_visibility.ts
|
|
5854
|
-
import { z as
|
|
5914
|
+
import { z as z54 } from "zod";
|
|
5855
5915
|
var UpdateCvmVisibilityRequestSchema = refineCvmId(
|
|
5856
5916
|
CvmIdObjectSchema.extend({
|
|
5857
|
-
public_sysinfo:
|
|
5858
|
-
public_logs:
|
|
5859
|
-
public_tcbinfo:
|
|
5917
|
+
public_sysinfo: z54.boolean(),
|
|
5918
|
+
public_logs: z54.boolean(),
|
|
5919
|
+
public_tcbinfo: z54.boolean().optional()
|
|
5860
5920
|
})
|
|
5861
5921
|
);
|
|
5862
|
-
var UpdateCvmVisibilityResponseSchema =
|
|
5863
|
-
message:
|
|
5864
|
-
correlation_id:
|
|
5865
|
-
status:
|
|
5922
|
+
var UpdateCvmVisibilityResponseSchema = z54.object({
|
|
5923
|
+
message: z54.string(),
|
|
5924
|
+
correlation_id: z54.string(),
|
|
5925
|
+
status: z54.string()
|
|
5866
5926
|
});
|
|
5867
5927
|
var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defineAction(UpdateCvmVisibilityResponseSchema, async (client, request) => {
|
|
5868
5928
|
const parsed = UpdateCvmVisibilityRequestSchema.parse(request);
|
|
@@ -5876,35 +5936,35 @@ var { action: updateCvmVisibility, safeAction: safeUpdateCvmVisibility } = defin
|
|
|
5876
5936
|
});
|
|
5877
5937
|
|
|
5878
5938
|
// src/actions/cvms/refresh_cvm_instance_id.ts
|
|
5879
|
-
import { z as
|
|
5880
|
-
var InstanceIdRefreshResultBaseSchema =
|
|
5881
|
-
identifier:
|
|
5882
|
-
status:
|
|
5883
|
-
old_instance_id:
|
|
5884
|
-
new_instance_id:
|
|
5885
|
-
source:
|
|
5886
|
-
verified_with_gateway:
|
|
5887
|
-
reason:
|
|
5939
|
+
import { z as z55 } from "zod";
|
|
5940
|
+
var InstanceIdRefreshResultBaseSchema = z55.object({
|
|
5941
|
+
identifier: z55.string(),
|
|
5942
|
+
status: z55.enum(["updated", "unchanged", "skipped", "conflict", "error"]),
|
|
5943
|
+
old_instance_id: z55.string().nullable().optional(),
|
|
5944
|
+
new_instance_id: z55.string().nullable().optional(),
|
|
5945
|
+
source: z55.enum(["teepod_state", "teepod_info", "gateway", "none"]),
|
|
5946
|
+
verified_with_gateway: z55.boolean(),
|
|
5947
|
+
reason: z55.string().nullable().optional()
|
|
5888
5948
|
});
|
|
5889
5949
|
var InstanceIdRefreshResultV20260121Schema = InstanceIdRefreshResultBaseSchema.extend({
|
|
5890
|
-
cvm_id:
|
|
5950
|
+
cvm_id: z55.number().nullable()
|
|
5891
5951
|
});
|
|
5892
5952
|
var InstanceIdRefreshResultV20260522Schema = InstanceIdRefreshResultBaseSchema.extend({
|
|
5893
|
-
cvm_id:
|
|
5953
|
+
cvm_id: z55.string().nullable()
|
|
5894
5954
|
});
|
|
5895
|
-
var InstanceIdRefreshResultAnySchema =
|
|
5955
|
+
var InstanceIdRefreshResultAnySchema = z55.union([
|
|
5896
5956
|
InstanceIdRefreshResultV20260121Schema,
|
|
5897
5957
|
InstanceIdRefreshResultV20260522Schema
|
|
5898
5958
|
]);
|
|
5899
5959
|
var InstanceIdRefreshResultSchema = InstanceIdRefreshResultV20260522Schema;
|
|
5900
5960
|
var RefreshCvmInstanceIdRequestSchema = refineCvmId(
|
|
5901
5961
|
CvmIdObjectSchema.extend({
|
|
5902
|
-
overwrite:
|
|
5903
|
-
dry_run:
|
|
5962
|
+
overwrite: z55.boolean().optional(),
|
|
5963
|
+
dry_run: z55.boolean().optional()
|
|
5904
5964
|
})
|
|
5905
5965
|
);
|
|
5906
|
-
function getSchemaForVersion6(
|
|
5907
|
-
if (
|
|
5966
|
+
function getSchemaForVersion6(version2) {
|
|
5967
|
+
if (version2 === "2026-01-21") return InstanceIdRefreshResultV20260121Schema;
|
|
5908
5968
|
return InstanceIdRefreshResultV20260522Schema;
|
|
5909
5969
|
}
|
|
5910
5970
|
async function refreshCvmInstanceId(client, request) {
|
|
@@ -5935,38 +5995,38 @@ async function safeRefreshCvmInstanceId(client, request) {
|
|
|
5935
5995
|
}
|
|
5936
5996
|
|
|
5937
5997
|
// src/actions/cvms/refresh_cvm_instance_ids.ts
|
|
5938
|
-
import { z as
|
|
5939
|
-
var RefreshCvmInstanceIdsRequestSchema =
|
|
5940
|
-
cvm_ids:
|
|
5941
|
-
running_only:
|
|
5942
|
-
missing_only:
|
|
5943
|
-
overwrite:
|
|
5944
|
-
limit:
|
|
5945
|
-
dry_run:
|
|
5998
|
+
import { z as z56 } from "zod";
|
|
5999
|
+
var RefreshCvmInstanceIdsRequestSchema = z56.object({
|
|
6000
|
+
cvm_ids: z56.array(z56.string()).optional(),
|
|
6001
|
+
running_only: z56.boolean().optional(),
|
|
6002
|
+
missing_only: z56.boolean().optional(),
|
|
6003
|
+
overwrite: z56.boolean().optional(),
|
|
6004
|
+
limit: z56.number().int().min(1).max(500).optional(),
|
|
6005
|
+
dry_run: z56.boolean().optional()
|
|
5946
6006
|
}).strict();
|
|
5947
|
-
var RefreshCvmInstanceIdsResponseBaseSchema =
|
|
5948
|
-
total:
|
|
5949
|
-
scanned:
|
|
5950
|
-
updated:
|
|
5951
|
-
unchanged:
|
|
5952
|
-
skipped:
|
|
5953
|
-
conflicts:
|
|
5954
|
-
errors:
|
|
6007
|
+
var RefreshCvmInstanceIdsResponseBaseSchema = z56.object({
|
|
6008
|
+
total: z56.number().int(),
|
|
6009
|
+
scanned: z56.number().int(),
|
|
6010
|
+
updated: z56.number().int(),
|
|
6011
|
+
unchanged: z56.number().int(),
|
|
6012
|
+
skipped: z56.number().int(),
|
|
6013
|
+
conflicts: z56.number().int(),
|
|
6014
|
+
errors: z56.number().int()
|
|
5955
6015
|
});
|
|
5956
6016
|
var RefreshCvmInstanceIdsResponseV20260121Schema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5957
|
-
items:
|
|
6017
|
+
items: z56.array(InstanceIdRefreshResultV20260121Schema)
|
|
5958
6018
|
});
|
|
5959
6019
|
var RefreshCvmInstanceIdsResponseV20260522Schema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5960
|
-
items:
|
|
6020
|
+
items: z56.array(InstanceIdRefreshResultV20260522Schema)
|
|
5961
6021
|
});
|
|
5962
6022
|
var RefreshCvmInstanceIdsResponseAnySchema = RefreshCvmInstanceIdsResponseBaseSchema.extend({
|
|
5963
|
-
items:
|
|
5964
|
-
|
|
6023
|
+
items: z56.array(
|
|
6024
|
+
z56.union([InstanceIdRefreshResultV20260121Schema, InstanceIdRefreshResultV20260522Schema])
|
|
5965
6025
|
)
|
|
5966
6026
|
});
|
|
5967
6027
|
var RefreshCvmInstanceIdsResponseSchema = RefreshCvmInstanceIdsResponseV20260522Schema;
|
|
5968
|
-
function getSchemaForVersion7(
|
|
5969
|
-
if (
|
|
6028
|
+
function getSchemaForVersion7(version2) {
|
|
6029
|
+
if (version2 === "2026-01-21") return RefreshCvmInstanceIdsResponseV20260121Schema;
|
|
5970
6030
|
return RefreshCvmInstanceIdsResponseV20260522Schema;
|
|
5971
6031
|
}
|
|
5972
6032
|
async function refreshCvmInstanceIds(client, request) {
|
|
@@ -5995,28 +6055,28 @@ async function safeRefreshCvmInstanceIds(client, request) {
|
|
|
5995
6055
|
}
|
|
5996
6056
|
|
|
5997
6057
|
// src/actions/cvms/get_available_os_images.ts
|
|
5998
|
-
import { z as
|
|
5999
|
-
var OSImageVariantSchema =
|
|
6000
|
-
name:
|
|
6001
|
-
slug:
|
|
6002
|
-
os_image_hash:
|
|
6003
|
-
requires_gpu:
|
|
6004
|
-
supports_cpu:
|
|
6005
|
-
supports_gpu:
|
|
6006
|
-
is_current:
|
|
6007
|
-
enabled:
|
|
6008
|
-
});
|
|
6009
|
-
var AvailableOSImageSchema3 =
|
|
6010
|
-
version:
|
|
6011
|
-
|
|
6012
|
-
|
|
6058
|
+
import { z as z57 } from "zod";
|
|
6059
|
+
var OSImageVariantSchema = z57.object({
|
|
6060
|
+
name: z57.string(),
|
|
6061
|
+
slug: z57.string(),
|
|
6062
|
+
os_image_hash: z57.string().nullable(),
|
|
6063
|
+
requires_gpu: z57.boolean(),
|
|
6064
|
+
supports_cpu: z57.boolean(),
|
|
6065
|
+
supports_gpu: z57.boolean(),
|
|
6066
|
+
is_current: z57.boolean(),
|
|
6067
|
+
enabled: z57.boolean()
|
|
6068
|
+
});
|
|
6069
|
+
var AvailableOSImageSchema3 = z57.object({
|
|
6070
|
+
version: z57.union([
|
|
6071
|
+
z57.tuple([z57.number(), z57.number(), z57.number(), z57.number()]),
|
|
6072
|
+
z57.tuple([z57.number(), z57.number(), z57.number()])
|
|
6013
6073
|
]),
|
|
6014
|
-
release:
|
|
6015
|
-
published_at:
|
|
6074
|
+
release: z57.string(),
|
|
6075
|
+
published_at: z57.string().nullable(),
|
|
6016
6076
|
prod: OSImageVariantSchema.nullable(),
|
|
6017
6077
|
dev: OSImageVariantSchema.nullable()
|
|
6018
6078
|
});
|
|
6019
|
-
var GetAvailableOSImagesResponseSchema =
|
|
6079
|
+
var GetAvailableOSImagesResponseSchema = z57.array(AvailableOSImageSchema3);
|
|
6020
6080
|
var GetAvailableOSImagesRequestSchema = CvmIdSchema;
|
|
6021
6081
|
var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = defineAction(GetAvailableOSImagesResponseSchema, async (client, request) => {
|
|
6022
6082
|
const { cvmId } = GetAvailableOSImagesRequestSchema.parse(request);
|
|
@@ -6024,13 +6084,13 @@ var { action: getAvailableOsImages, safeAction: safeGetAvailableOsImages } = def
|
|
|
6024
6084
|
});
|
|
6025
6085
|
|
|
6026
6086
|
// src/actions/cvms/update_os_image.ts
|
|
6027
|
-
import { z as
|
|
6087
|
+
import { z as z58 } from "zod";
|
|
6028
6088
|
var UpdateOsImageRequestSchema = refineCvmId(
|
|
6029
6089
|
CvmIdObjectSchema.extend({
|
|
6030
|
-
os_image_name:
|
|
6090
|
+
os_image_name: z58.string().min(1, "OS image name is required")
|
|
6031
6091
|
})
|
|
6032
6092
|
);
|
|
6033
|
-
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(
|
|
6093
|
+
var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z58.void(), async (client, request) => {
|
|
6034
6094
|
const parsed = UpdateOsImageRequestSchema.parse(request);
|
|
6035
6095
|
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
6036
6096
|
const { os_image_name } = parsed;
|
|
@@ -6039,12 +6099,12 @@ var { action: updateOsImage, safeAction: safeUpdateOsImage } = defineAction(z57.
|
|
|
6039
6099
|
});
|
|
6040
6100
|
|
|
6041
6101
|
// src/actions/cvms/update_docker_compose.ts
|
|
6042
|
-
import { z as
|
|
6102
|
+
import { z as z59 } from "zod";
|
|
6043
6103
|
var UpdateDockerComposeRequestSchema = refineCvmId(
|
|
6044
6104
|
CvmIdObjectSchema.extend({
|
|
6045
|
-
docker_compose_file:
|
|
6046
|
-
compose_hash:
|
|
6047
|
-
transaction_hash:
|
|
6105
|
+
docker_compose_file: z59.string().describe("Docker Compose YAML content"),
|
|
6106
|
+
compose_hash: z59.string().optional().describe("Compose hash for verification (Phase 2, contract-owned KMS only)"),
|
|
6107
|
+
transaction_hash: z59.string().optional().describe("On-chain transaction hash for verification (Phase 2, contract-owned KMS only)")
|
|
6048
6108
|
})
|
|
6049
6109
|
).transform((data) => {
|
|
6050
6110
|
const { cvmId } = CvmIdSchema.parse(data);
|
|
@@ -6058,24 +6118,24 @@ var UpdateDockerComposeRequestSchema = refineCvmId(
|
|
|
6058
6118
|
_raw: data
|
|
6059
6119
|
};
|
|
6060
6120
|
});
|
|
6061
|
-
var UpdateDockerComposeInProgressSchema =
|
|
6062
|
-
status:
|
|
6063
|
-
message:
|
|
6064
|
-
correlation_id:
|
|
6065
|
-
});
|
|
6066
|
-
var UpdateDockerComposePreconditionRequiredSchema =
|
|
6067
|
-
status:
|
|
6068
|
-
message:
|
|
6069
|
-
compose_hash:
|
|
6070
|
-
app_id:
|
|
6071
|
-
device_id:
|
|
6121
|
+
var UpdateDockerComposeInProgressSchema = z59.object({
|
|
6122
|
+
status: z59.literal("in_progress"),
|
|
6123
|
+
message: z59.string(),
|
|
6124
|
+
correlation_id: z59.string()
|
|
6125
|
+
});
|
|
6126
|
+
var UpdateDockerComposePreconditionRequiredSchema = z59.object({
|
|
6127
|
+
status: z59.literal("precondition_required"),
|
|
6128
|
+
message: z59.string(),
|
|
6129
|
+
compose_hash: z59.string(),
|
|
6130
|
+
app_id: z59.string(),
|
|
6131
|
+
device_id: z59.string(),
|
|
6072
6132
|
kms_info: KmsInfoSchema
|
|
6073
6133
|
});
|
|
6074
|
-
var UpdateDockerComposeNoChangeSchema =
|
|
6075
|
-
status:
|
|
6076
|
-
message:
|
|
6134
|
+
var UpdateDockerComposeNoChangeSchema = z59.object({
|
|
6135
|
+
status: z59.literal("no_change"),
|
|
6136
|
+
message: z59.string()
|
|
6077
6137
|
});
|
|
6078
|
-
var UpdateDockerComposeResultSchema =
|
|
6138
|
+
var UpdateDockerComposeResultSchema = z59.union([
|
|
6079
6139
|
UpdateDockerComposeInProgressSchema,
|
|
6080
6140
|
UpdateDockerComposePreconditionRequiredSchema,
|
|
6081
6141
|
UpdateDockerComposeNoChangeSchema
|
|
@@ -6128,12 +6188,12 @@ var { action: updateDockerCompose, safeAction: safeUpdateDockerCompose } = defin
|
|
|
6128
6188
|
});
|
|
6129
6189
|
|
|
6130
6190
|
// src/actions/cvms/update_prelaunch_script.ts
|
|
6131
|
-
import { z as
|
|
6191
|
+
import { z as z60 } from "zod";
|
|
6132
6192
|
var UpdatePreLaunchScriptRequestSchema = refineCvmId(
|
|
6133
6193
|
CvmIdObjectSchema.extend({
|
|
6134
|
-
pre_launch_script:
|
|
6135
|
-
compose_hash:
|
|
6136
|
-
transaction_hash:
|
|
6194
|
+
pre_launch_script: z60.string().describe("Pre-launch script content (shell script)"),
|
|
6195
|
+
compose_hash: z60.string().optional().describe("Compose hash for verification (Phase 2, contract-owned KMS only)"),
|
|
6196
|
+
transaction_hash: z60.string().optional().describe("On-chain transaction hash for verification (Phase 2, contract-owned KMS only)")
|
|
6137
6197
|
})
|
|
6138
6198
|
).transform((data) => {
|
|
6139
6199
|
const { cvmId } = CvmIdSchema.parse(data);
|
|
@@ -6147,24 +6207,24 @@ var UpdatePreLaunchScriptRequestSchema = refineCvmId(
|
|
|
6147
6207
|
_raw: data
|
|
6148
6208
|
};
|
|
6149
6209
|
});
|
|
6150
|
-
var UpdatePreLaunchScriptInProgressSchema =
|
|
6151
|
-
status:
|
|
6152
|
-
message:
|
|
6153
|
-
correlation_id:
|
|
6154
|
-
});
|
|
6155
|
-
var UpdatePreLaunchScriptPreconditionRequiredSchema =
|
|
6156
|
-
status:
|
|
6157
|
-
message:
|
|
6158
|
-
compose_hash:
|
|
6159
|
-
app_id:
|
|
6160
|
-
device_id:
|
|
6210
|
+
var UpdatePreLaunchScriptInProgressSchema = z60.object({
|
|
6211
|
+
status: z60.literal("in_progress"),
|
|
6212
|
+
message: z60.string(),
|
|
6213
|
+
correlation_id: z60.string()
|
|
6214
|
+
});
|
|
6215
|
+
var UpdatePreLaunchScriptPreconditionRequiredSchema = z60.object({
|
|
6216
|
+
status: z60.literal("precondition_required"),
|
|
6217
|
+
message: z60.string(),
|
|
6218
|
+
compose_hash: z60.string(),
|
|
6219
|
+
app_id: z60.string(),
|
|
6220
|
+
device_id: z60.string(),
|
|
6161
6221
|
kms_info: KmsInfoSchema
|
|
6162
6222
|
});
|
|
6163
|
-
var UpdatePreLaunchScriptNoChangeSchema =
|
|
6164
|
-
status:
|
|
6165
|
-
message:
|
|
6223
|
+
var UpdatePreLaunchScriptNoChangeSchema = z60.object({
|
|
6224
|
+
status: z60.literal("no_change"),
|
|
6225
|
+
message: z60.string()
|
|
6166
6226
|
});
|
|
6167
|
-
var UpdatePreLaunchScriptResultSchema =
|
|
6227
|
+
var UpdatePreLaunchScriptResultSchema = z60.union([
|
|
6168
6228
|
UpdatePreLaunchScriptInProgressSchema,
|
|
6169
6229
|
UpdatePreLaunchScriptPreconditionRequiredSchema,
|
|
6170
6230
|
UpdatePreLaunchScriptNoChangeSchema
|
|
@@ -6217,22 +6277,22 @@ var { action: updatePreLaunchScript, safeAction: safeUpdatePreLaunchScript } = d
|
|
|
6217
6277
|
});
|
|
6218
6278
|
|
|
6219
6279
|
// src/actions/cvms/get_cvm_prelaunch_script.ts
|
|
6220
|
-
import { z as
|
|
6280
|
+
import { z as z61 } from "zod";
|
|
6221
6281
|
var GetCvmPreLaunchScriptRequestSchema = CvmIdSchema;
|
|
6222
|
-
var { action: getCvmPreLaunchScript, safeAction: safeGetCvmPreLaunchScript } = defineAction(
|
|
6282
|
+
var { action: getCvmPreLaunchScript, safeAction: safeGetCvmPreLaunchScript } = defineAction(z61.string(), async (client, request) => {
|
|
6223
6283
|
const { cvmId } = GetCvmPreLaunchScriptRequestSchema.parse(request);
|
|
6224
6284
|
return await client.get(`/cvms/${cvmId}/pre-launch-script`);
|
|
6225
6285
|
});
|
|
6226
6286
|
|
|
6227
6287
|
// src/actions/cvms/get_prelaunch_script_upgrade_status.ts
|
|
6228
|
-
import { z as
|
|
6288
|
+
import { z as z62 } from "zod";
|
|
6229
6289
|
var GetPreLaunchScriptUpgradeStatusRequestSchema = CvmIdSchema;
|
|
6230
|
-
var PreLaunchScriptUpgradeStatusSchema =
|
|
6231
|
-
current_hash:
|
|
6232
|
-
latest_official_hash:
|
|
6233
|
-
is_official:
|
|
6234
|
-
is_latest:
|
|
6235
|
-
can_upgrade:
|
|
6290
|
+
var PreLaunchScriptUpgradeStatusSchema = z62.object({
|
|
6291
|
+
current_hash: z62.string().nullable(),
|
|
6292
|
+
latest_official_hash: z62.string(),
|
|
6293
|
+
is_official: z62.boolean(),
|
|
6294
|
+
is_latest: z62.boolean(),
|
|
6295
|
+
can_upgrade: z62.boolean()
|
|
6236
6296
|
});
|
|
6237
6297
|
var { action: getPreLaunchScriptUpgradeStatus, safeAction: safeGetPreLaunchScriptUpgradeStatus } = defineAction(
|
|
6238
6298
|
PreLaunchScriptUpgradeStatusSchema,
|
|
@@ -6243,11 +6303,11 @@ var { action: getPreLaunchScriptUpgradeStatus, safeAction: safeGetPreLaunchScrip
|
|
|
6243
6303
|
);
|
|
6244
6304
|
|
|
6245
6305
|
// src/actions/cvms/upgrade_prelaunch_script.ts
|
|
6246
|
-
import { z as
|
|
6306
|
+
import { z as z63 } from "zod";
|
|
6247
6307
|
var UpgradePreLaunchScriptRequestSchema = refineCvmId(
|
|
6248
6308
|
CvmIdObjectSchema.extend({
|
|
6249
|
-
compose_hash:
|
|
6250
|
-
transaction_hash:
|
|
6309
|
+
compose_hash: z63.string().optional().describe("Compose hash for verification (Phase 2, contract-owned KMS only)"),
|
|
6310
|
+
transaction_hash: z63.string().optional().describe("On-chain transaction hash for verification (Phase 2, contract-owned KMS only)")
|
|
6251
6311
|
})
|
|
6252
6312
|
).transform((data) => {
|
|
6253
6313
|
const { cvmId } = CvmIdSchema.parse(data);
|
|
@@ -6260,20 +6320,20 @@ var UpgradePreLaunchScriptRequestSchema = refineCvmId(
|
|
|
6260
6320
|
_raw: data
|
|
6261
6321
|
};
|
|
6262
6322
|
});
|
|
6263
|
-
var UpgradePreLaunchScriptInProgressSchema =
|
|
6264
|
-
status:
|
|
6265
|
-
message:
|
|
6266
|
-
correlation_id:
|
|
6267
|
-
});
|
|
6268
|
-
var UpgradePreLaunchScriptPreconditionRequiredSchema =
|
|
6269
|
-
status:
|
|
6270
|
-
message:
|
|
6271
|
-
compose_hash:
|
|
6272
|
-
app_id:
|
|
6273
|
-
device_id:
|
|
6323
|
+
var UpgradePreLaunchScriptInProgressSchema = z63.object({
|
|
6324
|
+
status: z63.literal("in_progress"),
|
|
6325
|
+
message: z63.string(),
|
|
6326
|
+
correlation_id: z63.string()
|
|
6327
|
+
});
|
|
6328
|
+
var UpgradePreLaunchScriptPreconditionRequiredSchema = z63.object({
|
|
6329
|
+
status: z63.literal("precondition_required"),
|
|
6330
|
+
message: z63.string(),
|
|
6331
|
+
compose_hash: z63.string(),
|
|
6332
|
+
app_id: z63.string(),
|
|
6333
|
+
device_id: z63.string(),
|
|
6274
6334
|
kms_info: KmsInfoSchema
|
|
6275
6335
|
});
|
|
6276
|
-
var UpgradePreLaunchScriptResultSchema =
|
|
6336
|
+
var UpgradePreLaunchScriptResultSchema = z63.union([
|
|
6277
6337
|
UpgradePreLaunchScriptInProgressSchema,
|
|
6278
6338
|
UpgradePreLaunchScriptPreconditionRequiredSchema
|
|
6279
6339
|
]);
|
|
@@ -6323,41 +6383,41 @@ var { action: upgradePreLaunchScript, safeAction: safeUpgradePreLaunchScript } =
|
|
|
6323
6383
|
});
|
|
6324
6384
|
|
|
6325
6385
|
// src/actions/cvms/get_cvm_status_batch.ts
|
|
6326
|
-
import { z as
|
|
6327
|
-
var CvmResourceUsageSchema =
|
|
6328
|
-
cpu_percent:
|
|
6329
|
-
memory_used_bytes:
|
|
6330
|
-
memory_total_bytes:
|
|
6331
|
-
disk_used_bytes:
|
|
6332
|
-
disk_total_bytes:
|
|
6333
|
-
egress_bytes:
|
|
6334
|
-
});
|
|
6335
|
-
var CvmStatusSchema =
|
|
6336
|
-
vm_uuid:
|
|
6337
|
-
status:
|
|
6338
|
-
uptime:
|
|
6339
|
-
in_progress:
|
|
6340
|
-
boot_progress:
|
|
6341
|
-
boot_error:
|
|
6342
|
-
shutdown_progress:
|
|
6343
|
-
events:
|
|
6344
|
-
|
|
6345
|
-
event:
|
|
6346
|
-
body:
|
|
6347
|
-
timestamp:
|
|
6386
|
+
import { z as z64 } from "zod";
|
|
6387
|
+
var CvmResourceUsageSchema = z64.object({
|
|
6388
|
+
cpu_percent: z64.number().nullable().optional(),
|
|
6389
|
+
memory_used_bytes: z64.number().nullable().optional(),
|
|
6390
|
+
memory_total_bytes: z64.number().nullable().optional(),
|
|
6391
|
+
disk_used_bytes: z64.number().nullable().optional(),
|
|
6392
|
+
disk_total_bytes: z64.number().nullable().optional(),
|
|
6393
|
+
egress_bytes: z64.number().nullable().optional()
|
|
6394
|
+
});
|
|
6395
|
+
var CvmStatusSchema = z64.object({
|
|
6396
|
+
vm_uuid: z64.string(),
|
|
6397
|
+
status: z64.string(),
|
|
6398
|
+
uptime: z64.string().nullable().optional(),
|
|
6399
|
+
in_progress: z64.boolean(),
|
|
6400
|
+
boot_progress: z64.string().nullable().optional(),
|
|
6401
|
+
boot_error: z64.string().nullable().optional(),
|
|
6402
|
+
shutdown_progress: z64.string().nullable().optional(),
|
|
6403
|
+
events: z64.array(
|
|
6404
|
+
z64.object({
|
|
6405
|
+
event: z64.string(),
|
|
6406
|
+
body: z64.string(),
|
|
6407
|
+
timestamp: z64.number()
|
|
6348
6408
|
})
|
|
6349
6409
|
).default([]),
|
|
6350
|
-
operation:
|
|
6351
|
-
type:
|
|
6352
|
-
phase:
|
|
6353
|
-
started_at:
|
|
6354
|
-
correlation_id:
|
|
6410
|
+
operation: z64.object({
|
|
6411
|
+
type: z64.string().nullable().optional(),
|
|
6412
|
+
phase: z64.string().nullable().optional(),
|
|
6413
|
+
started_at: z64.string().nullable().optional(),
|
|
6414
|
+
correlation_id: z64.string().nullable().optional()
|
|
6355
6415
|
}).nullable().optional(),
|
|
6356
6416
|
resource_usage: CvmResourceUsageSchema.nullable().optional()
|
|
6357
6417
|
});
|
|
6358
|
-
var GetCvmStatusBatchResponseSchema =
|
|
6359
|
-
var GetCvmStatusBatchRequestSchema =
|
|
6360
|
-
vmUuids:
|
|
6418
|
+
var GetCvmStatusBatchResponseSchema = z64.record(z64.string(), CvmStatusSchema);
|
|
6419
|
+
var GetCvmStatusBatchRequestSchema = z64.object({
|
|
6420
|
+
vmUuids: z64.array(z64.string())
|
|
6361
6421
|
});
|
|
6362
6422
|
var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAction(GetCvmStatusBatchResponseSchema, async (client, request) => {
|
|
6363
6423
|
const { vmUuids } = GetCvmStatusBatchRequestSchema.parse(request);
|
|
@@ -6365,14 +6425,14 @@ var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAct
|
|
|
6365
6425
|
});
|
|
6366
6426
|
|
|
6367
6427
|
// src/actions/cvms/get_cvm_user_config.ts
|
|
6368
|
-
import { z as
|
|
6369
|
-
var CvmUserConfigSchema =
|
|
6370
|
-
hostname:
|
|
6371
|
-
ssh_authorized_keys:
|
|
6372
|
-
default_gateway_domain:
|
|
6428
|
+
import { z as z65 } from "zod";
|
|
6429
|
+
var CvmUserConfigSchema = z65.object({
|
|
6430
|
+
hostname: z65.string().nullable().optional(),
|
|
6431
|
+
ssh_authorized_keys: z65.array(z65.string()).default([]),
|
|
6432
|
+
default_gateway_domain: z65.string().nullable().optional(),
|
|
6373
6433
|
// The app's launch token; set only when the CVM's compose carries
|
|
6374
6434
|
// requirements.launch_token_hash.
|
|
6375
|
-
launch_token:
|
|
6435
|
+
launch_token: z65.string().nullable().optional()
|
|
6376
6436
|
});
|
|
6377
6437
|
var GetCvmUserConfigRequestSchema = CvmIdSchema;
|
|
6378
6438
|
var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineAction(CvmUserConfigSchema, async (client, request) => {
|
|
@@ -6381,9 +6441,9 @@ var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineActio
|
|
|
6381
6441
|
});
|
|
6382
6442
|
|
|
6383
6443
|
// src/actions/cvms/cvm_annotations.ts
|
|
6384
|
-
import { z as
|
|
6385
|
-
var CvmAnnotationsSchema =
|
|
6386
|
-
annotations:
|
|
6444
|
+
import { z as z66 } from "zod";
|
|
6445
|
+
var CvmAnnotationsSchema = z66.object({
|
|
6446
|
+
annotations: z66.record(z66.string(), z66.string())
|
|
6387
6447
|
});
|
|
6388
6448
|
var GetCvmAnnotationsRequestSchema = CvmIdSchema;
|
|
6389
6449
|
var { action: getCvmAnnotations, safeAction: safeGetCvmAnnotations } = defineAction(CvmAnnotationsSchema, async (client, request) => {
|
|
@@ -6392,7 +6452,7 @@ var { action: getCvmAnnotations, safeAction: safeGetCvmAnnotations } = defineAct
|
|
|
6392
6452
|
});
|
|
6393
6453
|
var UpdateCvmAnnotationsRequestSchema = refineCvmId(
|
|
6394
6454
|
CvmIdObjectSchema.extend({
|
|
6395
|
-
annotations:
|
|
6455
|
+
annotations: z66.record(z66.string(), z66.string())
|
|
6396
6456
|
})
|
|
6397
6457
|
);
|
|
6398
6458
|
var { action: updateCvmAnnotations, safeAction: safeUpdateCvmAnnotations } = defineAction(CvmAnnotationsSchema, async (client, request) => {
|
|
@@ -6402,19 +6462,19 @@ var { action: updateCvmAnnotations, safeAction: safeUpdateCvmAnnotations } = def
|
|
|
6402
6462
|
});
|
|
6403
6463
|
|
|
6404
6464
|
// src/actions/cvms/get_cvm_init_scripts.ts
|
|
6405
|
-
import { z as
|
|
6406
|
-
var CvmInitScriptSchema =
|
|
6465
|
+
import { z as z67 } from "zod";
|
|
6466
|
+
var CvmInitScriptSchema = z67.object({
|
|
6407
6467
|
slug: InitScriptSlugSchema,
|
|
6408
6468
|
/** The CVM's current compose runs this script. */
|
|
6409
|
-
selected:
|
|
6469
|
+
selected: z67.boolean(),
|
|
6410
6470
|
/** The caller may select this script for this CVM's compose and OS image. */
|
|
6411
|
-
selectable:
|
|
6471
|
+
selectable: z67.boolean(),
|
|
6412
6472
|
/** Why the script is not selectable; null when it is. */
|
|
6413
|
-
reason:
|
|
6473
|
+
reason: z67.string().nullable().optional()
|
|
6414
6474
|
});
|
|
6415
|
-
var CvmInitScriptsSchema =
|
|
6416
|
-
items:
|
|
6417
|
-
has_custom_scripts:
|
|
6475
|
+
var CvmInitScriptsSchema = z67.object({
|
|
6476
|
+
items: z67.array(CvmInitScriptSchema),
|
|
6477
|
+
has_custom_scripts: z67.boolean()
|
|
6418
6478
|
});
|
|
6419
6479
|
var GetCvmInitScriptsRequestSchema = CvmIdSchema;
|
|
6420
6480
|
var { action: getCvmInitScripts, safeAction: safeGetCvmInitScripts } = defineAction(CvmInitScriptsSchema, async (client, request) => {
|
|
@@ -6423,11 +6483,11 @@ var { action: getCvmInitScripts, safeAction: safeGetCvmInitScripts } = defineAct
|
|
|
6423
6483
|
});
|
|
6424
6484
|
|
|
6425
6485
|
// src/actions/cvms/put_cvm_init_scripts.ts
|
|
6426
|
-
import { z as
|
|
6486
|
+
import { z as z68 } from "zod";
|
|
6427
6487
|
var PutCvmInitScriptsRequestSchema = refineCvmId(
|
|
6428
6488
|
CvmIdObjectSchema.extend({
|
|
6429
|
-
scripts:
|
|
6430
|
-
prepareOnly:
|
|
6489
|
+
scripts: z68.array(z68.string()).max(5),
|
|
6490
|
+
prepareOnly: z68.boolean().optional()
|
|
6431
6491
|
})
|
|
6432
6492
|
);
|
|
6433
6493
|
function extractDetailsMap2(detail) {
|
|
@@ -6479,21 +6539,21 @@ var { action: putCvmInitScripts, safeAction: safePutCvmInitScripts } = defineAct
|
|
|
6479
6539
|
});
|
|
6480
6540
|
|
|
6481
6541
|
// src/actions/ssh_keys/list_ssh_keys.ts
|
|
6482
|
-
import { z as
|
|
6483
|
-
var SshKeySchema =
|
|
6484
|
-
id:
|
|
6485
|
-
user_id:
|
|
6486
|
-
name:
|
|
6487
|
-
public_key:
|
|
6488
|
-
fingerprint:
|
|
6489
|
-
key_type:
|
|
6490
|
-
source:
|
|
6491
|
-
key_metadata:
|
|
6492
|
-
last_synced_at:
|
|
6493
|
-
created_at:
|
|
6494
|
-
updated_at:
|
|
6495
|
-
});
|
|
6496
|
-
var ListSshKeysResponseSchema =
|
|
6542
|
+
import { z as z69 } from "zod";
|
|
6543
|
+
var SshKeySchema = z69.object({
|
|
6544
|
+
id: z69.string(),
|
|
6545
|
+
user_id: z69.string(),
|
|
6546
|
+
name: z69.string(),
|
|
6547
|
+
public_key: z69.string(),
|
|
6548
|
+
fingerprint: z69.string(),
|
|
6549
|
+
key_type: z69.string(),
|
|
6550
|
+
source: z69.string(),
|
|
6551
|
+
key_metadata: z69.record(z69.string(), z69.unknown()).nullable().optional(),
|
|
6552
|
+
last_synced_at: z69.string().nullable().optional(),
|
|
6553
|
+
created_at: z69.string(),
|
|
6554
|
+
updated_at: z69.string()
|
|
6555
|
+
});
|
|
6556
|
+
var ListSshKeysResponseSchema = z69.array(SshKeySchema);
|
|
6497
6557
|
async function listSshKeys(client) {
|
|
6498
6558
|
const response = await client.get("/user/ssh-keys");
|
|
6499
6559
|
return ListSshKeysResponseSchema.parse(response);
|
|
@@ -6517,15 +6577,15 @@ async function safeListSshKeys(client) {
|
|
|
6517
6577
|
}
|
|
6518
6578
|
|
|
6519
6579
|
// src/actions/ssh_keys/import_github_profile.ts
|
|
6520
|
-
import { z as
|
|
6521
|
-
var ImportGithubProfileRequestSchema =
|
|
6522
|
-
github_username:
|
|
6580
|
+
import { z as z70 } from "zod";
|
|
6581
|
+
var ImportGithubProfileRequestSchema = z70.object({
|
|
6582
|
+
github_username: z70.string().min(1)
|
|
6523
6583
|
});
|
|
6524
|
-
var ImportGithubProfileResponseSchema =
|
|
6525
|
-
github_username:
|
|
6526
|
-
keys_added:
|
|
6527
|
-
keys_skipped:
|
|
6528
|
-
errors:
|
|
6584
|
+
var ImportGithubProfileResponseSchema = z70.object({
|
|
6585
|
+
github_username: z70.string(),
|
|
6586
|
+
keys_added: z70.number().int(),
|
|
6587
|
+
keys_skipped: z70.number().int(),
|
|
6588
|
+
errors: z70.array(z70.string()).default([])
|
|
6529
6589
|
});
|
|
6530
6590
|
var { action: importGithubProfileSshKeys, safeAction: safeImportGithubProfileSshKeys } = defineAction(
|
|
6531
6591
|
ImportGithubProfileResponseSchema,
|
|
@@ -6536,10 +6596,10 @@ var { action: importGithubProfileSshKeys, safeAction: safeImportGithubProfileSsh
|
|
|
6536
6596
|
);
|
|
6537
6597
|
|
|
6538
6598
|
// src/actions/ssh_keys/create_ssh_key.ts
|
|
6539
|
-
import { z as
|
|
6540
|
-
var CreateSshKeyRequestSchema =
|
|
6541
|
-
name:
|
|
6542
|
-
public_key:
|
|
6599
|
+
import { z as z71 } from "zod";
|
|
6600
|
+
var CreateSshKeyRequestSchema = z71.object({
|
|
6601
|
+
name: z71.string().min(1),
|
|
6602
|
+
public_key: z71.string().min(1)
|
|
6543
6603
|
});
|
|
6544
6604
|
var { action: createSshKey, safeAction: safeCreateSshKey } = defineAction(SshKeySchema, async (client, request) => {
|
|
6545
6605
|
const { name, public_key } = CreateSshKeyRequestSchema.parse(request);
|
|
@@ -6547,24 +6607,24 @@ var { action: createSshKey, safeAction: safeCreateSshKey } = defineAction(SshKey
|
|
|
6547
6607
|
});
|
|
6548
6608
|
|
|
6549
6609
|
// src/actions/ssh_keys/delete_ssh_key.ts
|
|
6550
|
-
import { z as
|
|
6551
|
-
var DeleteSshKeyRequestSchema =
|
|
6552
|
-
keyId:
|
|
6610
|
+
import { z as z72 } from "zod";
|
|
6611
|
+
var DeleteSshKeyRequestSchema = z72.object({
|
|
6612
|
+
keyId: z72.string().min(1)
|
|
6553
6613
|
});
|
|
6554
|
-
var { action: deleteSshKey, safeAction: safeDeleteSshKey } = defineAction(
|
|
6614
|
+
var { action: deleteSshKey, safeAction: safeDeleteSshKey } = defineAction(z72.void(), async (client, request) => {
|
|
6555
6615
|
const { keyId } = DeleteSshKeyRequestSchema.parse(request);
|
|
6556
6616
|
await client.delete(`/user/ssh-keys/${keyId}`);
|
|
6557
6617
|
return void 0;
|
|
6558
6618
|
});
|
|
6559
6619
|
|
|
6560
6620
|
// src/actions/ssh_keys/sync_github_ssh_keys.ts
|
|
6561
|
-
import { z as
|
|
6562
|
-
var SyncGithubSshKeysResponseSchema =
|
|
6563
|
-
synced_count:
|
|
6564
|
-
keys_added:
|
|
6565
|
-
keys_updated:
|
|
6566
|
-
keys_removed:
|
|
6567
|
-
errors:
|
|
6621
|
+
import { z as z73 } from "zod";
|
|
6622
|
+
var SyncGithubSshKeysResponseSchema = z73.object({
|
|
6623
|
+
synced_count: z73.number().int(),
|
|
6624
|
+
keys_added: z73.number().int(),
|
|
6625
|
+
keys_updated: z73.number().int(),
|
|
6626
|
+
keys_removed: z73.number().int(),
|
|
6627
|
+
errors: z73.array(z73.string()).default([])
|
|
6568
6628
|
});
|
|
6569
6629
|
var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSimpleAction(
|
|
6570
6630
|
SyncGithubSshKeysResponseSchema,
|
|
@@ -6574,20 +6634,20 @@ var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSim
|
|
|
6574
6634
|
);
|
|
6575
6635
|
|
|
6576
6636
|
// src/actions/ssh_keys/get_cvm_ssh_keys.ts
|
|
6577
|
-
import { z as
|
|
6578
|
-
var CvmSshKeySchema =
|
|
6579
|
-
id:
|
|
6580
|
-
owner_user_id:
|
|
6581
|
-
owner_username:
|
|
6582
|
-
added_by_user_id:
|
|
6583
|
-
name:
|
|
6584
|
-
public_key:
|
|
6585
|
-
fingerprint:
|
|
6586
|
-
key_type:
|
|
6587
|
-
});
|
|
6588
|
-
var CvmSshKeysResponseSchema =
|
|
6589
|
-
keys:
|
|
6590
|
-
restart_required:
|
|
6637
|
+
import { z as z74 } from "zod";
|
|
6638
|
+
var CvmSshKeySchema = z74.object({
|
|
6639
|
+
id: z74.string(),
|
|
6640
|
+
owner_user_id: z74.string(),
|
|
6641
|
+
owner_username: z74.string(),
|
|
6642
|
+
added_by_user_id: z74.string(),
|
|
6643
|
+
name: z74.string(),
|
|
6644
|
+
public_key: z74.string(),
|
|
6645
|
+
fingerprint: z74.string(),
|
|
6646
|
+
key_type: z74.string()
|
|
6647
|
+
});
|
|
6648
|
+
var CvmSshKeysResponseSchema = z74.object({
|
|
6649
|
+
keys: z74.array(CvmSshKeySchema),
|
|
6650
|
+
restart_required: z74.boolean()
|
|
6591
6651
|
});
|
|
6592
6652
|
var GetCvmSshKeysRequestSchema = CvmIdSchema;
|
|
6593
6653
|
var { action: getCvmSshKeys, safeAction: safeGetCvmSshKeys } = defineAction(CvmSshKeysResponseSchema, async (client, request) => {
|
|
@@ -6596,12 +6656,12 @@ var { action: getCvmSshKeys, safeAction: safeGetCvmSshKeys } = defineAction(CvmS
|
|
|
6596
6656
|
});
|
|
6597
6657
|
|
|
6598
6658
|
// src/actions/ssh_keys/update_cvm_ssh_keys.ts
|
|
6599
|
-
import { z as
|
|
6659
|
+
import { z as z75 } from "zod";
|
|
6600
6660
|
var UpdateCvmSshKeysRequestSchema = refineCvmId(
|
|
6601
6661
|
CvmIdObjectSchema.extend({
|
|
6602
|
-
ssh_key_ids:
|
|
6603
|
-
usernames:
|
|
6604
|
-
apply_now:
|
|
6662
|
+
ssh_key_ids: z75.array(z75.string()),
|
|
6663
|
+
usernames: z75.array(z75.string()).optional(),
|
|
6664
|
+
apply_now: z75.boolean().optional()
|
|
6605
6665
|
})
|
|
6606
6666
|
);
|
|
6607
6667
|
var { action: updateCvmSshKeys, safeAction: safeUpdateCvmSshKeys } = defineAction(CvmSshKeysResponseSchema, async (client, request) => {
|
|
@@ -6615,9 +6675,9 @@ var { action: updateCvmSshKeys, safeAction: safeUpdateCvmSshKeys } = defineActio
|
|
|
6615
6675
|
});
|
|
6616
6676
|
|
|
6617
6677
|
// src/actions/api_tokens/revoke_current_api_token.ts
|
|
6618
|
-
import { z as
|
|
6678
|
+
import { z as z76 } from "zod";
|
|
6619
6679
|
var { action: revokeCurrentApiToken, safeAction: safeRevokeCurrentApiToken } = defineSimpleAction(
|
|
6620
|
-
|
|
6680
|
+
z76.void(),
|
|
6621
6681
|
async (client) => {
|
|
6622
6682
|
await client.delete("/tokens/self");
|
|
6623
6683
|
return void 0;
|
|
@@ -6625,39 +6685,39 @@ var { action: revokeCurrentApiToken, safeAction: safeRevokeCurrentApiToken } = d
|
|
|
6625
6685
|
);
|
|
6626
6686
|
|
|
6627
6687
|
// src/actions/cvms/check_cvm_is_allowed.ts
|
|
6628
|
-
import { z as
|
|
6629
|
-
var IsAllowedResultBaseSchema =
|
|
6630
|
-
app_contract_address:
|
|
6631
|
-
compose_hash:
|
|
6632
|
-
device_id:
|
|
6633
|
-
compose_hash_allowed:
|
|
6634
|
-
allow_any_device:
|
|
6635
|
-
device_id_allowed:
|
|
6636
|
-
is_allowed:
|
|
6637
|
-
error:
|
|
6688
|
+
import { z as z77 } from "zod";
|
|
6689
|
+
var IsAllowedResultBaseSchema = z77.object({
|
|
6690
|
+
app_contract_address: z77.string(),
|
|
6691
|
+
compose_hash: z77.string(),
|
|
6692
|
+
device_id: z77.string(),
|
|
6693
|
+
compose_hash_allowed: z77.boolean(),
|
|
6694
|
+
allow_any_device: z77.boolean(),
|
|
6695
|
+
device_id_allowed: z77.boolean().nullable().optional(),
|
|
6696
|
+
is_allowed: z77.boolean(),
|
|
6697
|
+
error: z77.string().nullable().optional()
|
|
6638
6698
|
});
|
|
6639
6699
|
var IsAllowedResultV20260121Schema = IsAllowedResultBaseSchema.extend({
|
|
6640
|
-
cvm_id:
|
|
6700
|
+
cvm_id: z77.number().optional()
|
|
6641
6701
|
});
|
|
6642
6702
|
var IsAllowedResultV20260522Schema = IsAllowedResultBaseSchema.extend({
|
|
6643
|
-
cvm_id:
|
|
6703
|
+
cvm_id: z77.string().optional()
|
|
6644
6704
|
});
|
|
6645
|
-
var IsAllowedResultAnySchema =
|
|
6705
|
+
var IsAllowedResultAnySchema = z77.union([
|
|
6646
6706
|
IsAllowedResultV20260121Schema,
|
|
6647
6707
|
IsAllowedResultV20260522Schema
|
|
6648
6708
|
]);
|
|
6649
6709
|
var IsAllowedResultSchema = IsAllowedResultV20260522Schema;
|
|
6650
6710
|
var CheckCvmIsAllowedInputSchema = placementRequest(
|
|
6651
|
-
|
|
6652
|
-
cvmId:
|
|
6653
|
-
compose_hash:
|
|
6654
|
-
node:
|
|
6655
|
-
device_id:
|
|
6711
|
+
z77.object({
|
|
6712
|
+
cvmId: z77.string().min(1),
|
|
6713
|
+
compose_hash: z77.string().optional(),
|
|
6714
|
+
node: z77.string().min(1).optional(),
|
|
6715
|
+
device_id: z77.string().optional()
|
|
6656
6716
|
})
|
|
6657
6717
|
);
|
|
6658
6718
|
var CheckCvmIsAllowedRequestSchema = CheckCvmIsAllowedInputSchema;
|
|
6659
|
-
function getSchemaForVersion8(
|
|
6660
|
-
if (
|
|
6719
|
+
function getSchemaForVersion8(version2) {
|
|
6720
|
+
if (version2 === "2026-01-21") return IsAllowedResultV20260121Schema;
|
|
6661
6721
|
return IsAllowedResultV20260522Schema;
|
|
6662
6722
|
}
|
|
6663
6723
|
async function checkCvmIsAllowed(client, request) {
|
|
@@ -6684,14 +6744,14 @@ async function safeCheckCvmIsAllowed(client, request) {
|
|
|
6684
6744
|
}
|
|
6685
6745
|
|
|
6686
6746
|
// src/actions/apps/check_app_is_allowed.ts
|
|
6687
|
-
import { z as
|
|
6747
|
+
import { z as z78 } from "zod";
|
|
6688
6748
|
var CheckAppIsAllowedRequestSchema = placementRequest(
|
|
6689
|
-
|
|
6690
|
-
appId:
|
|
6691
|
-
compose_hash:
|
|
6692
|
-
node:
|
|
6693
|
-
device_id:
|
|
6694
|
-
chain_id:
|
|
6749
|
+
z78.object({
|
|
6750
|
+
appId: z78.string().min(1),
|
|
6751
|
+
compose_hash: z78.string(),
|
|
6752
|
+
node: z78.string().min(1).optional(),
|
|
6753
|
+
device_id: z78.string().optional(),
|
|
6754
|
+
chain_id: z78.number().optional()
|
|
6695
6755
|
})
|
|
6696
6756
|
);
|
|
6697
6757
|
var { action: checkAppIsAllowed, safeAction: safeCheckAppIsAllowed } = defineAction(IsAllowedResultSchema, async (client, request) => {
|
|
@@ -6700,32 +6760,32 @@ var { action: checkAppIsAllowed, safeAction: safeCheckAppIsAllowed } = defineAct
|
|
|
6700
6760
|
});
|
|
6701
6761
|
|
|
6702
6762
|
// src/actions/apps/check_app_cvms_is_allowed.ts
|
|
6703
|
-
import { z as
|
|
6704
|
-
var AppCvmsBatchIsAllowedResponseBaseSchema =
|
|
6705
|
-
is_onchain:
|
|
6706
|
-
total:
|
|
6707
|
-
allowed_count:
|
|
6708
|
-
denied_count:
|
|
6709
|
-
error_count:
|
|
6763
|
+
import { z as z79 } from "zod";
|
|
6764
|
+
var AppCvmsBatchIsAllowedResponseBaseSchema = z79.object({
|
|
6765
|
+
is_onchain: z79.boolean(),
|
|
6766
|
+
total: z79.number().default(0),
|
|
6767
|
+
allowed_count: z79.number().default(0),
|
|
6768
|
+
denied_count: z79.number().default(0),
|
|
6769
|
+
error_count: z79.number().default(0)
|
|
6710
6770
|
});
|
|
6711
6771
|
var AppCvmsBatchIsAllowedResponseV20260121Schema = AppCvmsBatchIsAllowedResponseBaseSchema.extend({
|
|
6712
|
-
results:
|
|
6713
|
-
skipped_cvm_ids:
|
|
6772
|
+
results: z79.array(IsAllowedResultV20260121Schema.extend({ cvm_id: z79.number() })).default([]),
|
|
6773
|
+
skipped_cvm_ids: z79.array(z79.number()).default([])
|
|
6714
6774
|
});
|
|
6715
6775
|
var AppCvmsBatchIsAllowedResponseV20260522Schema = AppCvmsBatchIsAllowedResponseBaseSchema.extend({
|
|
6716
|
-
results:
|
|
6717
|
-
skipped_cvm_ids:
|
|
6776
|
+
results: z79.array(IsAllowedResultV20260522Schema.extend({ cvm_id: z79.string() })).default([]),
|
|
6777
|
+
skipped_cvm_ids: z79.array(z79.string()).default([])
|
|
6718
6778
|
});
|
|
6719
|
-
var AppCvmsBatchIsAllowedResponseAnySchema =
|
|
6779
|
+
var AppCvmsBatchIsAllowedResponseAnySchema = z79.union([
|
|
6720
6780
|
AppCvmsBatchIsAllowedResponseV20260121Schema,
|
|
6721
6781
|
AppCvmsBatchIsAllowedResponseV20260522Schema
|
|
6722
6782
|
]);
|
|
6723
6783
|
var AppCvmsBatchIsAllowedResponseSchema = AppCvmsBatchIsAllowedResponseV20260522Schema;
|
|
6724
|
-
var CheckAppCvmsIsAllowedRequestSchema =
|
|
6725
|
-
appId:
|
|
6784
|
+
var CheckAppCvmsIsAllowedRequestSchema = z79.object({
|
|
6785
|
+
appId: z79.string().min(1)
|
|
6726
6786
|
});
|
|
6727
|
-
function getSchemaForVersion9(
|
|
6728
|
-
if (
|
|
6787
|
+
function getSchemaForVersion9(version2) {
|
|
6788
|
+
if (version2 === "2026-01-21") return AppCvmsBatchIsAllowedResponseV20260121Schema;
|
|
6729
6789
|
return AppCvmsBatchIsAllowedResponseV20260522Schema;
|
|
6730
6790
|
}
|
|
6731
6791
|
async function checkAppCvmsIsAllowed(client, request) {
|
|
@@ -6754,64 +6814,40 @@ async function safeCheckAppCvmsIsAllowed(client, request) {
|
|
|
6754
6814
|
}
|
|
6755
6815
|
|
|
6756
6816
|
// src/actions/apps/get_app_list.ts
|
|
6757
|
-
import { z as
|
|
6817
|
+
import { z as z82 } from "zod";
|
|
6758
6818
|
|
|
6759
6819
|
// src/types/app_info_v20251028.ts
|
|
6760
|
-
import { z as
|
|
6761
|
-
var CvmBasicInfoV20251028Schema =
|
|
6762
|
-
vm_uuid:
|
|
6763
|
-
app_id:
|
|
6764
|
-
name:
|
|
6765
|
-
status:
|
|
6766
|
-
vcpu:
|
|
6767
|
-
memory:
|
|
6768
|
-
disk_size:
|
|
6769
|
-
teepod_id:
|
|
6770
|
-
teepod_name:
|
|
6771
|
-
region_identifier:
|
|
6772
|
-
kms_type:
|
|
6773
|
-
instance_type:
|
|
6774
|
-
listed:
|
|
6775
|
-
base_image:
|
|
6776
|
-
kms_slug:
|
|
6820
|
+
import { z as z80 } from "zod";
|
|
6821
|
+
var CvmBasicInfoV20251028Schema = z80.object({
|
|
6822
|
+
vm_uuid: z80.string().nullable(),
|
|
6823
|
+
app_id: z80.string(),
|
|
6824
|
+
name: z80.string().default(""),
|
|
6825
|
+
status: z80.string(),
|
|
6826
|
+
vcpu: z80.number().int(),
|
|
6827
|
+
memory: z80.number().int(),
|
|
6828
|
+
disk_size: z80.number().int(),
|
|
6829
|
+
teepod_id: z80.number().int(),
|
|
6830
|
+
teepod_name: z80.string(),
|
|
6831
|
+
region_identifier: z80.string().nullable().optional(),
|
|
6832
|
+
kms_type: z80.string().nullable().optional(),
|
|
6833
|
+
instance_type: z80.string().nullable().optional(),
|
|
6834
|
+
listed: z80.boolean().nullable().optional(),
|
|
6835
|
+
base_image: z80.string().nullable().optional(),
|
|
6836
|
+
kms_slug: z80.string().nullable().optional(),
|
|
6777
6837
|
/** @deprecated Identifies a KMS node, not the on-chain KMS contract. Use kms_contract_id. */
|
|
6778
|
-
kms_id:
|
|
6779
|
-
kms_contract_id:
|
|
6780
|
-
instance_id:
|
|
6838
|
+
kms_id: z80.string().nullable().optional(),
|
|
6839
|
+
kms_contract_id: z80.string().nullable().optional(),
|
|
6840
|
+
instance_id: z80.string().nullable().optional(),
|
|
6781
6841
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
6782
|
-
updated_at:
|
|
6783
|
-
});
|
|
6784
|
-
var AppProfileSchema = z79.object({
|
|
6785
|
-
display_name: z79.string().nullable().optional(),
|
|
6786
|
-
avatar_url: z79.string().nullable().optional(),
|
|
6787
|
-
description: z79.string().nullable().optional(),
|
|
6788
|
-
custom_domain: z79.string().nullable().optional()
|
|
6789
|
-
});
|
|
6790
|
-
var DstackAppFullResponseV20251028Schema = z79.object({
|
|
6791
|
-
id: z79.string(),
|
|
6792
|
-
name: z79.string(),
|
|
6793
|
-
app_id: z79.string(),
|
|
6794
|
-
app_provision_type: z79.string().nullable().optional(),
|
|
6795
|
-
app_icon_url: z79.string().nullable().optional(),
|
|
6796
|
-
created_at: z79.string(),
|
|
6797
|
-
kms_type: z79.string(),
|
|
6798
|
-
profile: AppProfileSchema.nullable().optional(),
|
|
6799
|
-
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
6800
|
-
cvms: z79.array(CvmBasicInfoV20251028Schema).default([]),
|
|
6801
|
-
cvm_count: z79.number().int().default(0)
|
|
6842
|
+
updated_at: z80.string().nullable().optional()
|
|
6802
6843
|
});
|
|
6803
|
-
var
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
total: z79.number().int(),
|
|
6809
|
-
total_pages: z79.number().int()
|
|
6844
|
+
var AppProfileSchema = z80.object({
|
|
6845
|
+
display_name: z80.string().nullable().optional(),
|
|
6846
|
+
avatar_url: z80.string().nullable().optional(),
|
|
6847
|
+
description: z80.string().nullable().optional(),
|
|
6848
|
+
custom_domain: z80.string().nullable().optional()
|
|
6810
6849
|
});
|
|
6811
|
-
|
|
6812
|
-
// src/types/app_info_v20260121.ts
|
|
6813
|
-
import { z as z80 } from "zod";
|
|
6814
|
-
var DstackAppFullResponseV20260121Schema = z80.object({
|
|
6850
|
+
var DstackAppFullResponseV20251028Schema = z80.object({
|
|
6815
6851
|
id: z80.string(),
|
|
6816
6852
|
name: z80.string(),
|
|
6817
6853
|
app_id: z80.string(),
|
|
@@ -6819,50 +6855,74 @@ var DstackAppFullResponseV20260121Schema = z80.object({
|
|
|
6819
6855
|
app_icon_url: z80.string().nullable().optional(),
|
|
6820
6856
|
created_at: z80.string(),
|
|
6821
6857
|
kms_type: z80.string(),
|
|
6822
|
-
profile:
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6858
|
+
profile: AppProfileSchema.nullable().optional(),
|
|
6859
|
+
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
6860
|
+
cvms: z80.array(CvmBasicInfoV20251028Schema).default([]),
|
|
6861
|
+
cvm_count: z80.number().int().default(0)
|
|
6862
|
+
});
|
|
6863
|
+
var DstackAppWithCvmResponseV20251028Schema = DstackAppFullResponseV20251028Schema;
|
|
6864
|
+
var DstackAppListResponseV20251028Schema = z80.object({
|
|
6865
|
+
dstack_apps: z80.array(DstackAppWithCvmResponseV20251028Schema),
|
|
6866
|
+
page: z80.number().int(),
|
|
6867
|
+
page_size: z80.number().int(),
|
|
6868
|
+
total: z80.number().int(),
|
|
6869
|
+
total_pages: z80.number().int()
|
|
6870
|
+
});
|
|
6871
|
+
|
|
6872
|
+
// src/types/app_info_v20260121.ts
|
|
6873
|
+
import { z as z81 } from "zod";
|
|
6874
|
+
var DstackAppFullResponseV20260121Schema = z81.object({
|
|
6875
|
+
id: z81.string(),
|
|
6876
|
+
name: z81.string(),
|
|
6877
|
+
app_id: z81.string(),
|
|
6878
|
+
app_provision_type: z81.string().nullable().optional(),
|
|
6879
|
+
app_icon_url: z81.string().nullable().optional(),
|
|
6880
|
+
created_at: z81.string(),
|
|
6881
|
+
kms_type: z81.string(),
|
|
6882
|
+
profile: z81.object({
|
|
6883
|
+
display_name: z81.string().nullable().optional(),
|
|
6884
|
+
avatar_url: z81.string().nullable().optional(),
|
|
6885
|
+
description: z81.string().nullable().optional(),
|
|
6886
|
+
custom_domain: z81.string().nullable().optional()
|
|
6827
6887
|
}).nullable().optional(),
|
|
6828
6888
|
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
6829
|
-
cvms:
|
|
6830
|
-
cvm_count:
|
|
6889
|
+
cvms: z81.array(CvmInfoV20260121Schema).default([]),
|
|
6890
|
+
cvm_count: z81.number().int().default(0)
|
|
6831
6891
|
});
|
|
6832
6892
|
var DstackAppFullResponseV20260522Schema = DstackAppFullResponseV20260121Schema.extend({
|
|
6833
6893
|
current_cvm: CvmInfoV20260522Schema.nullable().optional(),
|
|
6834
|
-
cvms:
|
|
6894
|
+
cvms: z81.array(CvmInfoV20260522Schema).default([])
|
|
6835
6895
|
});
|
|
6836
6896
|
var DstackAppWithCvmResponseV20260121Schema = DstackAppFullResponseV20260121Schema;
|
|
6837
6897
|
var DstackAppWithCvmResponseV20260522Schema = DstackAppFullResponseV20260522Schema;
|
|
6838
|
-
var DstackAppListResponseV20260121Schema =
|
|
6839
|
-
dstack_apps:
|
|
6840
|
-
page:
|
|
6841
|
-
page_size:
|
|
6842
|
-
total:
|
|
6843
|
-
total_pages:
|
|
6898
|
+
var DstackAppListResponseV20260121Schema = z81.object({
|
|
6899
|
+
dstack_apps: z81.array(DstackAppWithCvmResponseV20260121Schema),
|
|
6900
|
+
page: z81.number().int(),
|
|
6901
|
+
page_size: z81.number().int(),
|
|
6902
|
+
total: z81.number().int(),
|
|
6903
|
+
total_pages: z81.number().int()
|
|
6844
6904
|
});
|
|
6845
6905
|
var DstackAppListResponseV20260522Schema = DstackAppListResponseV20260121Schema.extend({
|
|
6846
|
-
dstack_apps:
|
|
6906
|
+
dstack_apps: z81.array(DstackAppWithCvmResponseV20260522Schema)
|
|
6847
6907
|
});
|
|
6848
6908
|
|
|
6849
6909
|
// src/actions/apps/get_app_list.ts
|
|
6850
|
-
var GetAppListRequestSchema =
|
|
6851
|
-
page:
|
|
6852
|
-
page_size:
|
|
6853
|
-
search:
|
|
6854
|
-
status:
|
|
6855
|
-
listed:
|
|
6856
|
-
base_image:
|
|
6857
|
-
instance_type:
|
|
6858
|
-
kms_slug:
|
|
6859
|
-
kms_type:
|
|
6860
|
-
node:
|
|
6861
|
-
region:
|
|
6910
|
+
var GetAppListRequestSchema = z82.object({
|
|
6911
|
+
page: z82.number().int().min(1).optional(),
|
|
6912
|
+
page_size: z82.number().int().min(1).max(100).optional(),
|
|
6913
|
+
search: z82.string().optional(),
|
|
6914
|
+
status: z82.array(z82.string()).optional(),
|
|
6915
|
+
listed: z82.boolean().optional(),
|
|
6916
|
+
base_image: z82.string().optional(),
|
|
6917
|
+
instance_type: z82.string().optional(),
|
|
6918
|
+
kms_slug: z82.string().optional(),
|
|
6919
|
+
kms_type: z82.string().optional(),
|
|
6920
|
+
node: z82.string().optional(),
|
|
6921
|
+
region: z82.string().optional()
|
|
6862
6922
|
}).strict();
|
|
6863
|
-
function getSchemaForVersion10(
|
|
6864
|
-
if (
|
|
6865
|
-
if (
|
|
6923
|
+
function getSchemaForVersion10(version2) {
|
|
6924
|
+
if (version2 === "2025-10-28") return DstackAppListResponseV20251028Schema;
|
|
6925
|
+
if (version2 === "2026-01-21") return DstackAppListResponseV20260121Schema;
|
|
6866
6926
|
return DstackAppListResponseV20260522Schema;
|
|
6867
6927
|
}
|
|
6868
6928
|
async function getAppList(client, request) {
|
|
@@ -6890,13 +6950,13 @@ async function safeGetAppList(client, request) {
|
|
|
6890
6950
|
}
|
|
6891
6951
|
|
|
6892
6952
|
// src/actions/apps/get_app_info.ts
|
|
6893
|
-
import { z as
|
|
6894
|
-
var GetAppInfoRequestSchema =
|
|
6895
|
-
appId:
|
|
6953
|
+
import { z as z83 } from "zod";
|
|
6954
|
+
var GetAppInfoRequestSchema = z83.object({
|
|
6955
|
+
appId: z83.string().min(1)
|
|
6896
6956
|
}).strict();
|
|
6897
|
-
function getSchemaForVersion11(
|
|
6898
|
-
if (
|
|
6899
|
-
if (
|
|
6957
|
+
function getSchemaForVersion11(version2) {
|
|
6958
|
+
if (version2 === "2025-10-28") return DstackAppWithCvmResponseV20251028Schema;
|
|
6959
|
+
if (version2 === "2026-01-21") return DstackAppWithCvmResponseV20260121Schema;
|
|
6900
6960
|
return DstackAppWithCvmResponseV20260522Schema;
|
|
6901
6961
|
}
|
|
6902
6962
|
async function getAppInfo(client, request) {
|
|
@@ -6924,14 +6984,14 @@ async function safeGetAppInfo(client, request) {
|
|
|
6924
6984
|
}
|
|
6925
6985
|
|
|
6926
6986
|
// src/actions/apps/get_app_cvms.ts
|
|
6927
|
-
import { z as
|
|
6928
|
-
var GetAppCvmsRequestSchema =
|
|
6929
|
-
appId:
|
|
6987
|
+
import { z as z84 } from "zod";
|
|
6988
|
+
var GetAppCvmsRequestSchema = z84.object({
|
|
6989
|
+
appId: z84.string().min(1)
|
|
6930
6990
|
}).strict();
|
|
6931
|
-
function getSchemaForVersion12(
|
|
6932
|
-
if (
|
|
6933
|
-
if (
|
|
6934
|
-
return
|
|
6991
|
+
function getSchemaForVersion12(version2) {
|
|
6992
|
+
if (version2 === "2025-10-28") return z84.array(CvmInfoV20251028Schema);
|
|
6993
|
+
if (version2 === "2026-01-21") return z84.array(CvmInfoV20260121Schema);
|
|
6994
|
+
return z84.array(CvmInfoV20260522Schema);
|
|
6935
6995
|
}
|
|
6936
6996
|
async function getAppCvms(client, request) {
|
|
6937
6997
|
const { appId } = GetAppCvmsRequestSchema.parse(request);
|
|
@@ -6958,18 +7018,18 @@ async function safeGetAppCvms(client, request) {
|
|
|
6958
7018
|
}
|
|
6959
7019
|
|
|
6960
7020
|
// src/actions/apps/create_app_instance.ts
|
|
6961
|
-
import { z as
|
|
7021
|
+
import { z as z85 } from "zod";
|
|
6962
7022
|
var CreateAppInstanceRequestSchema = placementRequest(
|
|
6963
|
-
|
|
6964
|
-
appId:
|
|
6965
|
-
name:
|
|
6966
|
-
node:
|
|
6967
|
-
docker_compose_file:
|
|
6968
|
-
pre_launch_script:
|
|
6969
|
-
encrypted_env:
|
|
6970
|
-
compose_hash:
|
|
6971
|
-
token:
|
|
6972
|
-
transaction_hash:
|
|
7023
|
+
z85.object({
|
|
7024
|
+
appId: z85.string().min(1),
|
|
7025
|
+
name: z85.string().optional(),
|
|
7026
|
+
node: z85.string().min(1).optional(),
|
|
7027
|
+
docker_compose_file: z85.string().optional(),
|
|
7028
|
+
pre_launch_script: z85.string().optional(),
|
|
7029
|
+
encrypted_env: z85.string().optional(),
|
|
7030
|
+
compose_hash: z85.string().optional(),
|
|
7031
|
+
token: z85.string().optional(),
|
|
7032
|
+
transaction_hash: z85.string().optional()
|
|
6973
7033
|
}).strict()
|
|
6974
7034
|
);
|
|
6975
7035
|
var { action: createAppInstance, safeAction: safeCreateAppInstance } = defineAction(VMSchema, async (client, request) => {
|
|
@@ -6979,45 +7039,45 @@ var { action: createAppInstance, safeAction: safeCreateAppInstance } = defineAct
|
|
|
6979
7039
|
});
|
|
6980
7040
|
|
|
6981
7041
|
// src/actions/apps/get_app_device_allowlist.ts
|
|
6982
|
-
import { z as
|
|
6983
|
-
var DeviceAllowlistItemBaseSchema =
|
|
6984
|
-
device_id:
|
|
6985
|
-
node_name:
|
|
6986
|
-
allowed_onchain:
|
|
6987
|
-
status:
|
|
7042
|
+
import { z as z86 } from "zod";
|
|
7043
|
+
var DeviceAllowlistItemBaseSchema = z86.object({
|
|
7044
|
+
device_id: z86.string(),
|
|
7045
|
+
node_name: z86.string().nullable(),
|
|
7046
|
+
allowed_onchain: z86.boolean(),
|
|
7047
|
+
status: z86.string()
|
|
6988
7048
|
});
|
|
6989
7049
|
var DeviceAllowlistItemV20260121Schema = DeviceAllowlistItemBaseSchema.extend({
|
|
6990
|
-
cvm_ids:
|
|
7050
|
+
cvm_ids: z86.array(z86.number())
|
|
6991
7051
|
});
|
|
6992
7052
|
var DeviceAllowlistItemV20260522Schema = DeviceAllowlistItemBaseSchema.extend({
|
|
6993
|
-
cvm_ids:
|
|
7053
|
+
cvm_ids: z86.array(z86.string())
|
|
6994
7054
|
});
|
|
6995
|
-
var DeviceAllowlistResponseBaseSchema =
|
|
6996
|
-
is_onchain_kms:
|
|
6997
|
-
allow_any_device:
|
|
6998
|
-
chain_id:
|
|
6999
|
-
app_contract_address:
|
|
7055
|
+
var DeviceAllowlistResponseBaseSchema = z86.object({
|
|
7056
|
+
is_onchain_kms: z86.boolean(),
|
|
7057
|
+
allow_any_device: z86.boolean().nullable().optional(),
|
|
7058
|
+
chain_id: z86.number().nullable().optional(),
|
|
7059
|
+
app_contract_address: z86.string().nullable().optional()
|
|
7000
7060
|
});
|
|
7001
7061
|
var DeviceAllowlistResponseV20260121Schema = DeviceAllowlistResponseBaseSchema.extend({
|
|
7002
|
-
devices:
|
|
7062
|
+
devices: z86.array(DeviceAllowlistItemV20260121Schema).optional().default([])
|
|
7003
7063
|
});
|
|
7004
7064
|
var DeviceAllowlistResponseV20260522Schema = DeviceAllowlistResponseBaseSchema.extend({
|
|
7005
|
-
devices:
|
|
7065
|
+
devices: z86.array(DeviceAllowlistItemV20260522Schema).optional().default([])
|
|
7006
7066
|
});
|
|
7007
|
-
var DeviceAllowlistItemAnySchema =
|
|
7067
|
+
var DeviceAllowlistItemAnySchema = z86.union([
|
|
7008
7068
|
DeviceAllowlistItemV20260121Schema,
|
|
7009
7069
|
DeviceAllowlistItemV20260522Schema
|
|
7010
7070
|
]);
|
|
7011
|
-
var DeviceAllowlistResponseAnySchema =
|
|
7071
|
+
var DeviceAllowlistResponseAnySchema = z86.union([
|
|
7012
7072
|
DeviceAllowlistResponseV20260121Schema,
|
|
7013
7073
|
DeviceAllowlistResponseV20260522Schema
|
|
7014
7074
|
]);
|
|
7015
|
-
function getSchemaForVersion13(
|
|
7016
|
-
if (
|
|
7075
|
+
function getSchemaForVersion13(version2) {
|
|
7076
|
+
if (version2 === "2026-01-21") return DeviceAllowlistResponseV20260121Schema;
|
|
7017
7077
|
return DeviceAllowlistResponseV20260522Schema;
|
|
7018
7078
|
}
|
|
7019
|
-
var GetAppDeviceAllowlistRequestSchema =
|
|
7020
|
-
appId:
|
|
7079
|
+
var GetAppDeviceAllowlistRequestSchema = z86.object({
|
|
7080
|
+
appId: z86.string().min(1)
|
|
7021
7081
|
}).strict();
|
|
7022
7082
|
async function getAppDeviceAllowlist(client, request) {
|
|
7023
7083
|
const { appId } = GetAppDeviceAllowlistRequestSchema.parse(request);
|
|
@@ -7045,57 +7105,57 @@ async function safeGetAppDeviceAllowlist(client, request) {
|
|
|
7045
7105
|
}
|
|
7046
7106
|
|
|
7047
7107
|
// src/actions/apps/get_app_revisions.ts
|
|
7048
|
-
import { z as
|
|
7108
|
+
import { z as z88 } from "zod";
|
|
7049
7109
|
|
|
7050
7110
|
// src/types/app_revision.ts
|
|
7051
|
-
import { z as
|
|
7052
|
-
var CvmRefSchema =
|
|
7053
|
-
object_type:
|
|
7054
|
-
id:
|
|
7055
|
-
name:
|
|
7056
|
-
app_id:
|
|
7057
|
-
vm_uuid:
|
|
7058
|
-
});
|
|
7059
|
-
var AppRevisionResponseSchema =
|
|
7060
|
-
revision_id:
|
|
7061
|
-
app_id:
|
|
7062
|
-
vm_uuid:
|
|
7063
|
-
compose_hash:
|
|
7064
|
-
created_at:
|
|
7065
|
-
trace_id:
|
|
7066
|
-
operation_type:
|
|
7111
|
+
import { z as z87 } from "zod";
|
|
7112
|
+
var CvmRefSchema = z87.object({
|
|
7113
|
+
object_type: z87.literal("cvm"),
|
|
7114
|
+
id: z87.string().nullable().optional(),
|
|
7115
|
+
name: z87.string().nullable().optional(),
|
|
7116
|
+
app_id: z87.string().nullable().optional(),
|
|
7117
|
+
vm_uuid: z87.string().nullable().optional()
|
|
7118
|
+
});
|
|
7119
|
+
var AppRevisionResponseSchema = z87.object({
|
|
7120
|
+
revision_id: z87.string(),
|
|
7121
|
+
app_id: z87.string(),
|
|
7122
|
+
vm_uuid: z87.string(),
|
|
7123
|
+
compose_hash: z87.string(),
|
|
7124
|
+
created_at: z87.string(),
|
|
7125
|
+
trace_id: z87.string().nullable().optional(),
|
|
7126
|
+
operation_type: z87.string(),
|
|
7067
7127
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
7068
7128
|
cvm: CvmRefSchema.nullable().optional(),
|
|
7069
7129
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
7070
7130
|
});
|
|
7071
|
-
var AppRevisionDetailResponseSchema =
|
|
7072
|
-
revision_id:
|
|
7073
|
-
app_id:
|
|
7074
|
-
vm_uuid:
|
|
7075
|
-
compose_hash:
|
|
7076
|
-
compose_file:
|
|
7077
|
-
encrypted_env:
|
|
7078
|
-
user_config:
|
|
7079
|
-
created_at:
|
|
7080
|
-
trace_id:
|
|
7081
|
-
operation_type:
|
|
7131
|
+
var AppRevisionDetailResponseSchema = z87.object({
|
|
7132
|
+
revision_id: z87.string(),
|
|
7133
|
+
app_id: z87.string(),
|
|
7134
|
+
vm_uuid: z87.string(),
|
|
7135
|
+
compose_hash: z87.string(),
|
|
7136
|
+
compose_file: z87.union([z87.record(z87.string(), z87.any()), z87.string()]).nullable().optional(),
|
|
7137
|
+
encrypted_env: z87.string(),
|
|
7138
|
+
user_config: z87.string(),
|
|
7139
|
+
created_at: z87.string(),
|
|
7140
|
+
trace_id: z87.string().nullable().optional(),
|
|
7141
|
+
operation_type: z87.string(),
|
|
7082
7142
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
7083
7143
|
cvm: CvmRefSchema.nullable().optional(),
|
|
7084
7144
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
7085
7145
|
});
|
|
7086
|
-
var AppRevisionsResponseSchema =
|
|
7087
|
-
revisions:
|
|
7088
|
-
total:
|
|
7089
|
-
page:
|
|
7090
|
-
page_size:
|
|
7091
|
-
total_pages:
|
|
7146
|
+
var AppRevisionsResponseSchema = z87.object({
|
|
7147
|
+
revisions: z87.array(AppRevisionResponseSchema),
|
|
7148
|
+
total: z87.number().int(),
|
|
7149
|
+
page: z87.number().int(),
|
|
7150
|
+
page_size: z87.number().int(),
|
|
7151
|
+
total_pages: z87.number().int()
|
|
7092
7152
|
});
|
|
7093
7153
|
|
|
7094
7154
|
// src/actions/apps/get_app_revisions.ts
|
|
7095
|
-
var GetAppRevisionsRequestSchema =
|
|
7096
|
-
appId:
|
|
7097
|
-
page:
|
|
7098
|
-
page_size:
|
|
7155
|
+
var GetAppRevisionsRequestSchema = z88.object({
|
|
7156
|
+
appId: z88.string().min(1),
|
|
7157
|
+
page: z88.number().int().min(1).optional(),
|
|
7158
|
+
page_size: z88.number().int().min(1).max(1e3).optional()
|
|
7099
7159
|
}).strict();
|
|
7100
7160
|
async function getAppRevisions(client, request) {
|
|
7101
7161
|
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
@@ -7121,11 +7181,11 @@ async function safeGetAppRevisions(client, request) {
|
|
|
7121
7181
|
}
|
|
7122
7182
|
|
|
7123
7183
|
// src/actions/apps/get_app_revision_detail.ts
|
|
7124
|
-
import { z as
|
|
7125
|
-
var GetAppRevisionDetailRequestSchema =
|
|
7126
|
-
appId:
|
|
7127
|
-
revisionId:
|
|
7128
|
-
rawComposeFile:
|
|
7184
|
+
import { z as z89 } from "zod";
|
|
7185
|
+
var GetAppRevisionDetailRequestSchema = z89.object({
|
|
7186
|
+
appId: z89.string().min(1),
|
|
7187
|
+
revisionId: z89.string().min(1),
|
|
7188
|
+
rawComposeFile: z89.boolean().optional()
|
|
7129
7189
|
}).strict();
|
|
7130
7190
|
async function getAppRevisionDetail(client, request) {
|
|
7131
7191
|
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
@@ -7152,15 +7212,15 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
7152
7212
|
}
|
|
7153
7213
|
|
|
7154
7214
|
// src/actions/apps/get_app_filter_options.ts
|
|
7155
|
-
import { z as
|
|
7156
|
-
var AppFilterOptionsSchema =
|
|
7157
|
-
statuses:
|
|
7158
|
-
image_versions:
|
|
7159
|
-
instance_types:
|
|
7160
|
-
kms_slugs:
|
|
7161
|
-
kms_types:
|
|
7162
|
-
regions:
|
|
7163
|
-
nodes:
|
|
7215
|
+
import { z as z90 } from "zod";
|
|
7216
|
+
var AppFilterOptionsSchema = z90.object({
|
|
7217
|
+
statuses: z90.array(z90.string()),
|
|
7218
|
+
image_versions: z90.array(z90.string()),
|
|
7219
|
+
instance_types: z90.array(z90.string()),
|
|
7220
|
+
kms_slugs: z90.array(z90.string()),
|
|
7221
|
+
kms_types: z90.array(z90.string()),
|
|
7222
|
+
regions: z90.array(z90.string()),
|
|
7223
|
+
nodes: z90.array(z90.string())
|
|
7164
7224
|
});
|
|
7165
7225
|
async function getAppFilterOptions(client) {
|
|
7166
7226
|
const response = await client.get("/apps/filter-options");
|
|
@@ -7185,53 +7245,53 @@ async function safeGetAppFilterOptions(client) {
|
|
|
7185
7245
|
}
|
|
7186
7246
|
|
|
7187
7247
|
// src/actions/apps/get_app_attestation.ts
|
|
7188
|
-
import { z as
|
|
7189
|
-
var KmsInfoSchema2 =
|
|
7190
|
-
contract_address:
|
|
7191
|
-
chain_id:
|
|
7192
|
-
version:
|
|
7193
|
-
url:
|
|
7194
|
-
gateway_app_id:
|
|
7195
|
-
gateway_app_url:
|
|
7196
|
-
kms_type:
|
|
7197
|
-
});
|
|
7198
|
-
var GuestAgentInfoSchema =
|
|
7199
|
-
app_id:
|
|
7200
|
-
instance_id:
|
|
7201
|
-
app_name:
|
|
7202
|
-
device_id:
|
|
7248
|
+
import { z as z91 } from "zod";
|
|
7249
|
+
var KmsInfoSchema2 = z91.object({
|
|
7250
|
+
contract_address: z91.string(),
|
|
7251
|
+
chain_id: z91.number().nullable(),
|
|
7252
|
+
version: z91.string(),
|
|
7253
|
+
url: z91.string(),
|
|
7254
|
+
gateway_app_id: z91.string().nullable(),
|
|
7255
|
+
gateway_app_url: z91.string(),
|
|
7256
|
+
kms_type: z91.string()
|
|
7257
|
+
});
|
|
7258
|
+
var GuestAgentInfoSchema = z91.object({
|
|
7259
|
+
app_id: z91.string().optional(),
|
|
7260
|
+
instance_id: z91.string().optional(),
|
|
7261
|
+
app_name: z91.string().optional(),
|
|
7262
|
+
device_id: z91.string().optional()
|
|
7203
7263
|
}).passthrough().nullable();
|
|
7204
|
-
var AppAttestationInstanceSchema =
|
|
7205
|
-
vm_uuid:
|
|
7206
|
-
name:
|
|
7207
|
-
instance_id:
|
|
7208
|
-
status:
|
|
7209
|
-
image_version:
|
|
7210
|
-
quote:
|
|
7211
|
-
ppid:
|
|
7212
|
-
ppid_sha256:
|
|
7213
|
-
device_id:
|
|
7214
|
-
fmspc:
|
|
7215
|
-
tee_tcb_svn:
|
|
7216
|
-
mr_config_id:
|
|
7217
|
-
cpusvn:
|
|
7218
|
-
pcesvn:
|
|
7264
|
+
var AppAttestationInstanceSchema = z91.object({
|
|
7265
|
+
vm_uuid: z91.string().nullable().optional(),
|
|
7266
|
+
name: z91.string().optional(),
|
|
7267
|
+
instance_id: z91.string().nullable().optional(),
|
|
7268
|
+
status: z91.string().optional(),
|
|
7269
|
+
image_version: z91.string().nullable().optional(),
|
|
7270
|
+
quote: z91.string().nullable().optional(),
|
|
7271
|
+
ppid: z91.string().optional(),
|
|
7272
|
+
ppid_sha256: z91.string().nullable().optional(),
|
|
7273
|
+
device_id: z91.string().optional(),
|
|
7274
|
+
fmspc: z91.string().nullable().optional(),
|
|
7275
|
+
tee_tcb_svn: z91.string().nullable().optional(),
|
|
7276
|
+
mr_config_id: z91.string().nullable().optional(),
|
|
7277
|
+
cpusvn: z91.string().nullable().optional(),
|
|
7278
|
+
pcesvn: z91.number().nullable().optional(),
|
|
7219
7279
|
tcb_info: TcbInfoSchema.nullable().optional(),
|
|
7220
|
-
app_certificates:
|
|
7221
|
-
compose_file:
|
|
7222
|
-
error:
|
|
7280
|
+
app_certificates: z91.array(CertificateSchema).nullable().optional(),
|
|
7281
|
+
compose_file: z91.string().nullable().optional(),
|
|
7282
|
+
error: z91.string().nullable().optional()
|
|
7223
7283
|
});
|
|
7224
|
-
var AppAttestationResponseSchema =
|
|
7225
|
-
app_id:
|
|
7226
|
-
contract_address:
|
|
7284
|
+
var AppAttestationResponseSchema = z91.object({
|
|
7285
|
+
app_id: z91.string(),
|
|
7286
|
+
contract_address: z91.string(),
|
|
7227
7287
|
kms_info: KmsInfoSchema2,
|
|
7228
|
-
instances:
|
|
7288
|
+
instances: z91.array(AppAttestationInstanceSchema),
|
|
7229
7289
|
kms_guest_agent_info: GuestAgentInfoSchema,
|
|
7230
7290
|
gateway_guest_agent_info: GuestAgentInfoSchema,
|
|
7231
|
-
qemu_version:
|
|
7291
|
+
qemu_version: z91.string().nullable()
|
|
7232
7292
|
});
|
|
7233
|
-
var GetAppAttestationRequestSchema =
|
|
7234
|
-
appId:
|
|
7293
|
+
var GetAppAttestationRequestSchema = z91.object({
|
|
7294
|
+
appId: z91.string().min(1)
|
|
7235
7295
|
}).strict();
|
|
7236
7296
|
var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAction(AppAttestationResponseSchema, async (client, request) => {
|
|
7237
7297
|
const { appId } = GetAppAttestationRequestSchema.parse(request);
|
|
@@ -7239,17 +7299,17 @@ var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAct
|
|
|
7239
7299
|
});
|
|
7240
7300
|
|
|
7241
7301
|
// src/actions/apps/app_launch_token.ts
|
|
7242
|
-
import { z as
|
|
7243
|
-
var AppLaunchTokenSchema =
|
|
7302
|
+
import { z as z92 } from "zod";
|
|
7303
|
+
var AppLaunchTokenSchema = z92.object({
|
|
7244
7304
|
/** The app's new launch token. Returned only here, once. */
|
|
7245
|
-
launch_token:
|
|
7305
|
+
launch_token: z92.string(),
|
|
7246
7306
|
/** Value for `requirements.launch_token_hash` of every CVM of the app. */
|
|
7247
|
-
launch_token_hash:
|
|
7307
|
+
launch_token_hash: z92.string()
|
|
7248
7308
|
});
|
|
7249
|
-
var SetAppLaunchTokenRequestSchema =
|
|
7250
|
-
appId:
|
|
7309
|
+
var SetAppLaunchTokenRequestSchema = z92.object({
|
|
7310
|
+
appId: z92.string().min(1),
|
|
7251
7311
|
/** Token to set (at least 32 bytes). Omit to have Phala Cloud generate one. */
|
|
7252
|
-
launchToken:
|
|
7312
|
+
launchToken: z92.string().optional()
|
|
7253
7313
|
});
|
|
7254
7314
|
var { action: setAppLaunchToken, safeAction: safeSetAppLaunchToken } = defineAction(AppLaunchTokenSchema, async (client, request) => {
|
|
7255
7315
|
const { appId, launchToken } = SetAppLaunchTokenRequestSchema.parse(request);
|
|
@@ -7258,36 +7318,36 @@ var { action: setAppLaunchToken, safeAction: safeSetAppLaunchToken } = defineAct
|
|
|
7258
7318
|
launchToken === void 0 ? {} : { launch_token: launchToken }
|
|
7259
7319
|
);
|
|
7260
7320
|
});
|
|
7261
|
-
var ClearAppLaunchTokenRequestSchema =
|
|
7262
|
-
appId:
|
|
7321
|
+
var ClearAppLaunchTokenRequestSchema = z92.object({
|
|
7322
|
+
appId: z92.string().min(1)
|
|
7263
7323
|
});
|
|
7264
|
-
var { action: clearAppLaunchToken, safeAction: safeClearAppLaunchToken } = defineAction(
|
|
7324
|
+
var { action: clearAppLaunchToken, safeAction: safeClearAppLaunchToken } = defineAction(z92.void(), async (client, request) => {
|
|
7265
7325
|
const { appId } = ClearAppLaunchTokenRequestSchema.parse(request);
|
|
7266
7326
|
await client.delete(`/apps/${appId}/launch-token`);
|
|
7267
7327
|
return void 0;
|
|
7268
7328
|
});
|
|
7269
7329
|
|
|
7270
7330
|
// src/actions/os_images/get_os_images.ts
|
|
7271
|
-
import { z as
|
|
7272
|
-
var OSImagePublicSchema =
|
|
7273
|
-
name:
|
|
7274
|
-
slug:
|
|
7275
|
-
version:
|
|
7276
|
-
os_image_hash:
|
|
7277
|
-
is_dev:
|
|
7278
|
-
requires_gpu:
|
|
7331
|
+
import { z as z93 } from "zod";
|
|
7332
|
+
var OSImagePublicSchema = z93.object({
|
|
7333
|
+
name: z93.string(),
|
|
7334
|
+
slug: z93.string(),
|
|
7335
|
+
version: z93.string(),
|
|
7336
|
+
os_image_hash: z93.string().nullable(),
|
|
7337
|
+
is_dev: z93.boolean(),
|
|
7338
|
+
requires_gpu: z93.boolean()
|
|
7279
7339
|
}).passthrough();
|
|
7280
|
-
var GetOsImagesRequestSchema =
|
|
7281
|
-
page:
|
|
7282
|
-
page_size:
|
|
7283
|
-
is_dev:
|
|
7340
|
+
var GetOsImagesRequestSchema = z93.object({
|
|
7341
|
+
page: z93.number().int().min(1).optional(),
|
|
7342
|
+
page_size: z93.number().int().min(1).optional(),
|
|
7343
|
+
is_dev: z93.boolean().optional()
|
|
7284
7344
|
}).strict();
|
|
7285
|
-
var GetOsImagesResponseSchema =
|
|
7286
|
-
items:
|
|
7287
|
-
total:
|
|
7288
|
-
page:
|
|
7289
|
-
page_size:
|
|
7290
|
-
pages:
|
|
7345
|
+
var GetOsImagesResponseSchema = z93.object({
|
|
7346
|
+
items: z93.array(OSImagePublicSchema),
|
|
7347
|
+
total: z93.number(),
|
|
7348
|
+
page: z93.number(),
|
|
7349
|
+
page_size: z93.number(),
|
|
7350
|
+
pages: z93.number()
|
|
7291
7351
|
}).passthrough();
|
|
7292
7352
|
var { action: getOsImages, safeAction: safeGetOsImages } = defineAction(GetOsImagesResponseSchema, async (client, request) => {
|
|
7293
7353
|
const validatedRequest = GetOsImagesRequestSchema.parse(request ?? {});
|
|
@@ -7400,6 +7460,8 @@ function buildClient(client) {
|
|
|
7400
7460
|
getWorkspace,
|
|
7401
7461
|
safeGetWorkspace,
|
|
7402
7462
|
getCvmInfo,
|
|
7463
|
+
getCvmGpuStatus,
|
|
7464
|
+
safeGetCvmGpuStatus,
|
|
7403
7465
|
safeGetCvmInfo,
|
|
7404
7466
|
getCvmList,
|
|
7405
7467
|
safeGetCvmList,
|
|
@@ -7486,7 +7548,7 @@ function buildClient(client) {
|
|
|
7486
7548
|
};
|
|
7487
7549
|
const extended = client.extend(allActions).extend(additionalActions);
|
|
7488
7550
|
Object.assign(extended, onChainActions);
|
|
7489
|
-
extended.withVersion = (
|
|
7551
|
+
extended.withVersion = (version2) => buildClient(client.withVersion(version2));
|
|
7490
7552
|
return extended;
|
|
7491
7553
|
}
|
|
7492
7554
|
|
|
@@ -7518,20 +7580,24 @@ function parseRfc3339(value) {
|
|
|
7518
7580
|
if (year < 1 || month < 1 || month > 12 || day < 1 || day > daysInMonth || hour > 23 || minute > 59 || second > 59 || offsetHour > 23 || offsetMinute > 59) {
|
|
7519
7581
|
return void 0;
|
|
7520
7582
|
}
|
|
7521
|
-
const fractionalMilliseconds = fraction ? Number(`0.${fraction}`) * 1e3 : 0;
|
|
7522
7583
|
const offset = sign === "+" ? 1 : sign === "-" ? -1 : 0;
|
|
7523
|
-
const
|
|
7584
|
+
const offsetSeconds = offset * (offsetHour * 60 + offsetMinute) * 60;
|
|
7524
7585
|
const date = /* @__PURE__ */ new Date(0);
|
|
7525
7586
|
date.setUTCFullYear(year, month - 1, day);
|
|
7526
7587
|
date.setUTCHours(hour, minute, second, 0);
|
|
7527
|
-
|
|
7588
|
+
const seconds = Math.floor(date.getTime() / 1e3) - offsetSeconds;
|
|
7589
|
+
const fractionNonZero = Boolean(fraction && /[1-9]/.test(fraction));
|
|
7590
|
+
return { seconds, fractionNonZero };
|
|
7528
7591
|
}
|
|
7529
|
-
function
|
|
7592
|
+
function resolveLogInstant(value, nowMs, ceil) {
|
|
7593
|
+
if (typeof value === "number") {
|
|
7594
|
+
return ceil ? Math.ceil(value) : Math.floor(value);
|
|
7595
|
+
}
|
|
7530
7596
|
if (/^-?\d+$/.test(value)) {
|
|
7531
7597
|
const seconds = Number(value);
|
|
7532
7598
|
const milliseconds = seconds * 1e3;
|
|
7533
7599
|
if (Number.isSafeInteger(seconds) && Number.isSafeInteger(milliseconds)) {
|
|
7534
|
-
return
|
|
7600
|
+
return seconds;
|
|
7535
7601
|
}
|
|
7536
7602
|
}
|
|
7537
7603
|
const relative = /^(\d+)([smhd])$/.exec(value);
|
|
@@ -7545,18 +7611,20 @@ function parseLogTime(value, nowMs) {
|
|
|
7545
7611
|
const duration = Number(relative[1]) * (DURATION_SECONDS[unit] ?? 0);
|
|
7546
7612
|
const milliseconds = nowMs - duration * 1e3;
|
|
7547
7613
|
if (Number.isFinite(milliseconds) && Number.isSafeInteger(Math.floor(milliseconds / 1e3))) {
|
|
7548
|
-
return milliseconds;
|
|
7614
|
+
return ceil ? Math.ceil(milliseconds / 1e3) : Math.floor(milliseconds / 1e3);
|
|
7549
7615
|
}
|
|
7550
7616
|
}
|
|
7551
7617
|
const rfc3339 = parseRfc3339(value);
|
|
7552
|
-
if (rfc3339 !== void 0)
|
|
7618
|
+
if (rfc3339 !== void 0) {
|
|
7619
|
+
return ceil && rfc3339.fractionNonZero ? rfc3339.seconds + 1 : rfc3339.seconds;
|
|
7620
|
+
}
|
|
7553
7621
|
throw new Error(
|
|
7554
7622
|
`Invalid log time '${value}'. Use RFC3339, Unix seconds, or a relative duration such as 10m.`
|
|
7555
7623
|
);
|
|
7556
7624
|
}
|
|
7557
7625
|
function resolveLogTimeWindow(since, until, nowMs = Date.now()) {
|
|
7558
|
-
const resolvedSince = since === void 0 ? void 0 :
|
|
7559
|
-
const resolvedUntil = until === void 0 ? void 0 :
|
|
7626
|
+
const resolvedSince = since === void 0 ? void 0 : resolveLogInstant(since, nowMs, false);
|
|
7627
|
+
const resolvedUntil = until === void 0 ? void 0 : resolveLogInstant(until, nowMs, true);
|
|
7560
7628
|
if (resolvedSince !== void 0 && !Number.isSafeInteger(resolvedSince) || resolvedUntil !== void 0 && !Number.isSafeInteger(resolvedUntil)) {
|
|
7561
7629
|
throw new Error("Log time is outside the supported Unix seconds range.");
|
|
7562
7630
|
}
|
|
@@ -7568,42 +7636,46 @@ function resolveLogTimeWindow(since, until, nowMs = Date.now()) {
|
|
|
7568
7636
|
|
|
7569
7637
|
// src/actions/cvms/logs.ts
|
|
7570
7638
|
var CVM_LOGS_INFO_API_VERSION = "2026-01-21";
|
|
7571
|
-
var
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
"
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7639
|
+
var LOG_CHANNELS = /* @__PURE__ */ new Set(["stdout", "stderr", "stdin", "console"]);
|
|
7640
|
+
function logFetchHeaders(client) {
|
|
7641
|
+
const headers = new Headers();
|
|
7642
|
+
const ua = defaultUserAgent();
|
|
7643
|
+
if (ua) headers.set("User-Agent", ua);
|
|
7644
|
+
const extra = client.config?.headers;
|
|
7645
|
+
if (extra) {
|
|
7646
|
+
new Headers(extra).forEach((value, key) => {
|
|
7647
|
+
if (key.toLowerCase() === "user-agent") headers.set("User-Agent", value);
|
|
7648
|
+
});
|
|
7649
|
+
}
|
|
7650
|
+
return headers;
|
|
7651
|
+
}
|
|
7652
|
+
function logFetch(client, url, signal) {
|
|
7653
|
+
return fetch(url, {
|
|
7654
|
+
method: "GET",
|
|
7655
|
+
headers: logFetchHeaders(client),
|
|
7656
|
+
signal,
|
|
7657
|
+
redirect: "manual"
|
|
7658
|
+
});
|
|
7588
7659
|
}
|
|
7589
7660
|
var LogAccessError = class extends ResourceError {
|
|
7590
7661
|
constructor(options) {
|
|
7591
7662
|
const details = options.message;
|
|
7592
|
-
const
|
|
7593
|
-
|
|
7594
|
-
${options.suggestions.map((suggestion) => `- ${suggestion}`).join("\n")}` : "";
|
|
7595
|
-
const status = options.fromStreamBody ? 0 : options.httpStatus ?? (options.code ? logErrorHttpStatus(options.code) : void 0) ?? 0;
|
|
7596
|
-
super(`${details}${suggestionText}`, {
|
|
7663
|
+
const status = options.fromStreamBody ? 0 : options.httpStatus && options.httpStatus > 0 ? options.httpStatus : 0;
|
|
7664
|
+
super(details, {
|
|
7597
7665
|
status,
|
|
7598
7666
|
statusText: "",
|
|
7599
7667
|
errorCode: options.code,
|
|
7600
|
-
suggestions: options.suggestions ? [...options.suggestions] : void 0
|
|
7668
|
+
suggestions: options.suggestions ? [...options.suggestions] : void 0,
|
|
7669
|
+
requestId: options.requestId,
|
|
7670
|
+
structuredDetails: options.details,
|
|
7671
|
+
links: options.links
|
|
7601
7672
|
});
|
|
7602
7673
|
this.name = "LogAccessError";
|
|
7603
7674
|
this.code = options.code;
|
|
7604
|
-
this.httpStatus =
|
|
7675
|
+
this.httpStatus = options.fromStreamBody || !options.httpStatus || options.httpStatus <= 0 ? void 0 : options.httpStatus;
|
|
7605
7676
|
this.suggestions = options.suggestions ? [...options.suggestions] : [];
|
|
7606
7677
|
this.fromStreamBody = options.fromStreamBody === true;
|
|
7678
|
+
this.gatewayStream = options.gatewayStream === true;
|
|
7607
7679
|
}
|
|
7608
7680
|
};
|
|
7609
7681
|
function resolveCvmId(id) {
|
|
@@ -7621,12 +7693,13 @@ function buildLogUrl(baseUrl, options) {
|
|
|
7621
7693
|
const sep = baseUrl.includes("?") ? "&" : "?";
|
|
7622
7694
|
return params.length > 0 ? `${baseUrl}${sep}${params.join("&")}` : baseUrl;
|
|
7623
7695
|
}
|
|
7624
|
-
async function streamResponse(response, onData) {
|
|
7696
|
+
async function streamResponse(response, onData, markDelivered, ansi) {
|
|
7625
7697
|
const reader = response.body?.getReader();
|
|
7626
7698
|
if (!reader) throw new Error("No response body available for streaming");
|
|
7627
7699
|
const decoder = new TextDecoder();
|
|
7628
7700
|
let buffer = "";
|
|
7629
7701
|
let finished = false;
|
|
7702
|
+
let delivered = false;
|
|
7630
7703
|
try {
|
|
7631
7704
|
while (true) {
|
|
7632
7705
|
const { done, value } = await reader.read();
|
|
@@ -7638,7 +7711,9 @@ async function streamResponse(response, onData) {
|
|
|
7638
7711
|
const content = line.replace(/\r?\n$/, "");
|
|
7639
7712
|
if (content !== "[vmm heartbeat]" && content !== "[teepod heartbeat]") {
|
|
7640
7713
|
throwTextStreamError(content);
|
|
7641
|
-
|
|
7714
|
+
markDelivered?.();
|
|
7715
|
+
onData(applyAnsiPolicy(line, ansi));
|
|
7716
|
+
delivered = true;
|
|
7642
7717
|
}
|
|
7643
7718
|
newline = buffer.indexOf("\n");
|
|
7644
7719
|
}
|
|
@@ -7649,13 +7724,16 @@ async function streamResponse(response, onData) {
|
|
|
7649
7724
|
}
|
|
7650
7725
|
if (buffer && buffer !== "[vmm heartbeat]" && buffer !== "[teepod heartbeat]") {
|
|
7651
7726
|
throwTextStreamError(buffer);
|
|
7652
|
-
|
|
7727
|
+
markDelivered?.();
|
|
7728
|
+
onData(applyAnsiPolicy(buffer, ansi));
|
|
7729
|
+
delivered = true;
|
|
7653
7730
|
}
|
|
7654
7731
|
} finally {
|
|
7655
7732
|
if (!finished) await reader.cancel().catch(() => {
|
|
7656
7733
|
});
|
|
7657
7734
|
reader.releaseLock();
|
|
7658
7735
|
}
|
|
7736
|
+
return delivered;
|
|
7659
7737
|
}
|
|
7660
7738
|
async function throwResponseError(response) {
|
|
7661
7739
|
const body = await response.text();
|
|
@@ -7668,16 +7746,35 @@ async function throwResponseError(response) {
|
|
|
7668
7746
|
const suggestions = Array.isArray(envelope.suggestions) ? envelope.suggestions.filter((item) => typeof item === "string") : [];
|
|
7669
7747
|
throw new LogAccessError({
|
|
7670
7748
|
code: typeof envelope.error_code === "string" ? envelope.error_code : void 0,
|
|
7671
|
-
message: typeof envelope.message === "string" ? envelope.message : `HTTP ${response.status}
|
|
7749
|
+
message: typeof envelope.message === "string" ? envelope.message : `HTTP ${response.status}`,
|
|
7672
7750
|
httpStatus: response.status,
|
|
7673
|
-
suggestions
|
|
7751
|
+
suggestions,
|
|
7752
|
+
requestId: typeof envelope.request_id === "string" ? envelope.request_id : void 0,
|
|
7753
|
+
details: Array.isArray(envelope.details) ? envelope.details : void 0,
|
|
7754
|
+
links: Array.isArray(envelope.links) ? envelope.links : void 0
|
|
7674
7755
|
});
|
|
7675
7756
|
}
|
|
7757
|
+
function backoffDelayMs(attempt) {
|
|
7758
|
+
return Math.min(250 * 2 ** (Math.min(Math.max(attempt, 1), 6) - 1), 5e3);
|
|
7759
|
+
}
|
|
7676
7760
|
function throwTextStreamError(line) {
|
|
7677
7761
|
const match = /^\[error\] (ERR-17-\d{3}) (.*)$/.exec(line.trim());
|
|
7678
7762
|
const code = match?.[1];
|
|
7679
7763
|
const message = match?.[2];
|
|
7680
|
-
if (code && message !== void 0)
|
|
7764
|
+
if (code && message !== void 0) {
|
|
7765
|
+
throw new LogAccessError({
|
|
7766
|
+
code,
|
|
7767
|
+
message,
|
|
7768
|
+
gatewayStream: true
|
|
7769
|
+
});
|
|
7770
|
+
}
|
|
7771
|
+
}
|
|
7772
|
+
function throwIfTextBodyErrors(text) {
|
|
7773
|
+
throwIfGuestAgentError(text);
|
|
7774
|
+
for (const line of text.split(/\r?\n/)) throwTextStreamError(line);
|
|
7775
|
+
}
|
|
7776
|
+
function throwIfGatewayTextErrors(text) {
|
|
7777
|
+
for (const line of text.split(/\r?\n/)) throwTextStreamError(line);
|
|
7681
7778
|
}
|
|
7682
7779
|
function parseTimestampedMessage(message) {
|
|
7683
7780
|
const match = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})) (.*)$/s.exec(
|
|
@@ -7692,13 +7789,9 @@ function parseTimestampedMessage(message) {
|
|
|
7692
7789
|
message: match[2]
|
|
7693
7790
|
};
|
|
7694
7791
|
}
|
|
7695
|
-
function formatFollowContainerEntry(entry, includeTimestamps) {
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
return {
|
|
7699
|
-
channel: entry.channel,
|
|
7700
|
-
message: timestamp.timestamp ? timestamp.message ?? "" : entry.message
|
|
7701
|
-
};
|
|
7792
|
+
function formatFollowContainerEntry(entry, includeTimestamps, ansi) {
|
|
7793
|
+
const raw = includeTimestamps ? entry.message : parseTimestampedMessage(entry.message).timestamp ? parseTimestampedMessage(entry.message).message ?? "" : entry.message;
|
|
7794
|
+
return { channel: entry.channel, message: applyAnsiPolicy(raw, ansi) };
|
|
7702
7795
|
}
|
|
7703
7796
|
function guestAgentErrorMessage(text) {
|
|
7704
7797
|
const trimmed = text.trim();
|
|
@@ -7714,6 +7807,18 @@ function guestAgentErrorMessage(text) {
|
|
|
7714
7807
|
return void 0;
|
|
7715
7808
|
}
|
|
7716
7809
|
function throwIfGuestAgentError(text) {
|
|
7810
|
+
const taken = takeJsonObject(text);
|
|
7811
|
+
if (taken) {
|
|
7812
|
+
const parsed = taken.value;
|
|
7813
|
+
if (typeof parsed.error === "string" && parsed.channel === void 0 && parsed.message === void 0) {
|
|
7814
|
+
throw new LogAccessError({
|
|
7815
|
+
code: "ERR-17-009",
|
|
7816
|
+
message: parsed.error,
|
|
7817
|
+
fromStreamBody: true
|
|
7818
|
+
});
|
|
7819
|
+
}
|
|
7820
|
+
return;
|
|
7821
|
+
}
|
|
7717
7822
|
const message = guestAgentErrorMessage(text);
|
|
7718
7823
|
if (message !== void 0) {
|
|
7719
7824
|
throw new LogAccessError({
|
|
@@ -7723,6 +7828,51 @@ function throwIfGuestAgentError(text) {
|
|
|
7723
7828
|
});
|
|
7724
7829
|
}
|
|
7725
7830
|
}
|
|
7831
|
+
var ANSI_PATTERN = /\x1b(?:\][^\x07\x1b]*(?:\x07|\x1b\\)|\[[0-?]*[ -/]*[@-~]|[ -/]*[0-~])/g;
|
|
7832
|
+
function stripAnsi(text) {
|
|
7833
|
+
return text.replace(ANSI_PATTERN, "");
|
|
7834
|
+
}
|
|
7835
|
+
function applyAnsiPolicy(text, ansi) {
|
|
7836
|
+
return ansi ? text : stripAnsi(text);
|
|
7837
|
+
}
|
|
7838
|
+
function takeJsonObject(buffer) {
|
|
7839
|
+
let i = 0;
|
|
7840
|
+
while (i < buffer.length && /[\s]/.test(buffer[i])) i += 1;
|
|
7841
|
+
if (buffer[i] !== "{") return null;
|
|
7842
|
+
let depth = 0;
|
|
7843
|
+
let inString = false;
|
|
7844
|
+
let escaped = false;
|
|
7845
|
+
for (let j = i; j < buffer.length; j += 1) {
|
|
7846
|
+
const char = buffer[j];
|
|
7847
|
+
if (inString) {
|
|
7848
|
+
if (escaped) {
|
|
7849
|
+
escaped = false;
|
|
7850
|
+
continue;
|
|
7851
|
+
}
|
|
7852
|
+
if (char === "\\") {
|
|
7853
|
+
escaped = true;
|
|
7854
|
+
continue;
|
|
7855
|
+
}
|
|
7856
|
+
if (char === '"') inString = false;
|
|
7857
|
+
continue;
|
|
7858
|
+
}
|
|
7859
|
+
if (char === '"') {
|
|
7860
|
+
inString = true;
|
|
7861
|
+
continue;
|
|
7862
|
+
}
|
|
7863
|
+
if (char === "{") depth += 1;
|
|
7864
|
+
else if (char === "}") {
|
|
7865
|
+
depth -= 1;
|
|
7866
|
+
if (depth === 0) {
|
|
7867
|
+
return {
|
|
7868
|
+
value: JSON.parse(buffer.slice(i, j + 1)),
|
|
7869
|
+
rest: buffer.slice(j + 1)
|
|
7870
|
+
};
|
|
7871
|
+
}
|
|
7872
|
+
}
|
|
7873
|
+
}
|
|
7874
|
+
return null;
|
|
7875
|
+
}
|
|
7726
7876
|
function parseStructuredLogLineToEntry(line) {
|
|
7727
7877
|
const trimmed = line.trim();
|
|
7728
7878
|
if (!trimmed) return null;
|
|
@@ -7743,10 +7893,14 @@ function parseStructuredLogLineToEntry(line) {
|
|
|
7743
7893
|
throw new LogAccessError({
|
|
7744
7894
|
code: parsed.error_code,
|
|
7745
7895
|
message: typeof parsed.message === "string" ? parsed.message : "The log stream ended with an error.",
|
|
7746
|
-
|
|
7896
|
+
gatewayStream: true,
|
|
7897
|
+
suggestions: Array.isArray(parsed.suggestions) ? parsed.suggestions.filter((item) => typeof item === "string") : [],
|
|
7898
|
+
details: Array.isArray(parsed.details) ? parsed.details : void 0,
|
|
7899
|
+
links: Array.isArray(parsed.links) ? parsed.links : void 0,
|
|
7900
|
+
requestId: typeof parsed.request_id === "string" ? parsed.request_id : void 0
|
|
7747
7901
|
});
|
|
7748
7902
|
}
|
|
7749
|
-
if (
|
|
7903
|
+
if (!LOG_CHANNELS.has(parsed.channel) || typeof parsed.message !== "string") {
|
|
7750
7904
|
throw new LogAccessError({ message: "Invalid NDJSON log record." });
|
|
7751
7905
|
}
|
|
7752
7906
|
const entry = {
|
|
@@ -7759,9 +7913,24 @@ function parseStructuredLogLineToEntry(line) {
|
|
|
7759
7913
|
}
|
|
7760
7914
|
function parseStructuredLogsToEntries(input) {
|
|
7761
7915
|
const entries = [];
|
|
7762
|
-
|
|
7763
|
-
|
|
7916
|
+
let buffer = input;
|
|
7917
|
+
while (buffer.length > 0) {
|
|
7918
|
+
const taken = takeJsonObject(buffer);
|
|
7919
|
+
if (!taken) {
|
|
7920
|
+
const newline = buffer.indexOf("\n");
|
|
7921
|
+
if (newline < 0) {
|
|
7922
|
+
const entry3 = parseStructuredLogLineToEntry(buffer);
|
|
7923
|
+
if (entry3) entries.push(entry3);
|
|
7924
|
+
break;
|
|
7925
|
+
}
|
|
7926
|
+
const entry2 = parseStructuredLogLineToEntry(buffer.slice(0, newline));
|
|
7927
|
+
if (entry2) entries.push(entry2);
|
|
7928
|
+
buffer = buffer.slice(newline + 1);
|
|
7929
|
+
continue;
|
|
7930
|
+
}
|
|
7931
|
+
const entry = parseStructuredLogLineToEntry(JSON.stringify(taken.value));
|
|
7764
7932
|
if (entry) entries.push(entry);
|
|
7933
|
+
buffer = taken.rest;
|
|
7765
7934
|
}
|
|
7766
7935
|
return entries;
|
|
7767
7936
|
}
|
|
@@ -7775,12 +7944,12 @@ async function streamNdjsonEntriesResponse(response, onEntry) {
|
|
|
7775
7944
|
while (true) {
|
|
7776
7945
|
const { done, value } = await reader.read();
|
|
7777
7946
|
buffer += decoder.decode(value, { stream: !done });
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7947
|
+
for (; ; ) {
|
|
7948
|
+
const taken = takeJsonObject(buffer);
|
|
7949
|
+
if (!taken) break;
|
|
7950
|
+
const entry = parseStructuredLogLineToEntry(JSON.stringify(taken.value));
|
|
7781
7951
|
if (entry) onEntry(entry);
|
|
7782
|
-
buffer =
|
|
7783
|
-
newline = buffer.indexOf("\n");
|
|
7952
|
+
buffer = taken.rest;
|
|
7784
7953
|
}
|
|
7785
7954
|
if (done) {
|
|
7786
7955
|
finished = true;
|
|
@@ -7805,26 +7974,25 @@ function assertSupportedNodeLogOptions(options) {
|
|
|
7805
7974
|
options.format === "ndjson" && "format=ndjson"
|
|
7806
7975
|
].filter((option) => Boolean(option));
|
|
7807
7976
|
if (unsupported.length > 0) {
|
|
7808
|
-
throw
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
throw new LogAccessError({
|
|
7812
|
-
code: "ERR-17-001",
|
|
7813
|
-
message: "ansi is valid only with format=text"
|
|
7814
|
-
});
|
|
7977
|
+
throw clientValidationError(
|
|
7978
|
+
`${unsupported.join(", ")} not supported for serial/stdout/stderr logs`
|
|
7979
|
+
);
|
|
7815
7980
|
}
|
|
7816
7981
|
}
|
|
7817
|
-
async function getCvmInfoLogs(client, cvmId) {
|
|
7982
|
+
async function getCvmInfoLogs(client, cvmId, signal) {
|
|
7818
7983
|
return await client.get(`/cvms/${cvmId}`, {
|
|
7819
|
-
headers: { "X-Phala-Version": CVM_LOGS_INFO_API_VERSION }
|
|
7984
|
+
headers: { "X-Phala-Version": CVM_LOGS_INFO_API_VERSION },
|
|
7985
|
+
signal
|
|
7820
7986
|
});
|
|
7821
7987
|
}
|
|
7822
|
-
async function getCvmLogEndpoint(client, id, channel) {
|
|
7988
|
+
async function getCvmLogEndpoint(client, id, channel, signal) {
|
|
7823
7989
|
const cvmId = resolveCvmId(id);
|
|
7824
|
-
const info = await getCvmInfoLogs(client, cvmId);
|
|
7990
|
+
const info = await getCvmInfoLogs(client, cvmId, signal);
|
|
7825
7991
|
const endpoint = info.logs?.[channel];
|
|
7826
7992
|
if (!endpoint) {
|
|
7827
|
-
throw new
|
|
7993
|
+
throw new LogAccessError({
|
|
7994
|
+
message: `No ${channel} log endpoint available for CVM '${cvmId}'`
|
|
7995
|
+
});
|
|
7828
7996
|
}
|
|
7829
7997
|
return endpoint;
|
|
7830
7998
|
}
|
|
@@ -7835,35 +8003,122 @@ function containerLogsDisabledError() {
|
|
|
7835
8003
|
httpStatus: 409
|
|
7836
8004
|
});
|
|
7837
8005
|
}
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
8006
|
+
var CONTAINER_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/;
|
|
8007
|
+
function clientValidationError(message) {
|
|
8008
|
+
return new LogAccessError({ code: "ERR-17-001", message });
|
|
8009
|
+
}
|
|
8010
|
+
function resolveTimes(since, until) {
|
|
8011
|
+
try {
|
|
8012
|
+
return resolveLogTimeWindow(since, until);
|
|
8013
|
+
} catch (error) {
|
|
8014
|
+
throw clientValidationError(error instanceof Error ? error.message : String(error));
|
|
7842
8015
|
}
|
|
7843
8016
|
}
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
8017
|
+
function assertSafeContainerName(name) {
|
|
8018
|
+
if (!CONTAINER_NAME_RE.test(name) || name.includes("..")) {
|
|
8019
|
+
throw clientValidationError(
|
|
8020
|
+
`Invalid container name '${name}'. Use 1\u2013128 characters starting with a letter or digit, then letters, digits, '_', '.', and '-'.`
|
|
8021
|
+
);
|
|
7849
8022
|
}
|
|
7850
|
-
|
|
8023
|
+
return name;
|
|
8024
|
+
}
|
|
8025
|
+
function assertContainerNameOption(name) {
|
|
8026
|
+
if (name) assertSafeContainerName(name);
|
|
8027
|
+
}
|
|
8028
|
+
function throwIfAborted(signal) {
|
|
8029
|
+
if (!signal?.aborted) return;
|
|
8030
|
+
const error = new Error("This operation was aborted");
|
|
8031
|
+
error.name = "AbortError";
|
|
8032
|
+
throw error;
|
|
8033
|
+
}
|
|
8034
|
+
function untilReached(until, cursorSince) {
|
|
8035
|
+
if (until === void 0) return false;
|
|
8036
|
+
if (cursorSince !== void 0 && cursorSince >= until) return true;
|
|
8037
|
+
return Math.floor(Date.now() / 1e3) >= until;
|
|
8038
|
+
}
|
|
8039
|
+
function joinContainerLogUrl(base2, name, authQuery) {
|
|
8040
|
+
const trimmed = base2.replace(/\/$/, "");
|
|
8041
|
+
const slug = assertSafeContainerName(name);
|
|
8042
|
+
const url = `${trimmed}/${slug}`;
|
|
8043
|
+
if (!authQuery) return url;
|
|
8044
|
+
return url.includes("?") ? `${url}&${authQuery}` : `${url}?${authQuery}`;
|
|
8045
|
+
}
|
|
8046
|
+
function reconnectSinceValue(cursorSince, first200Second, callerSince) {
|
|
8047
|
+
if (cursorSince !== void 0) return cursorSince;
|
|
8048
|
+
if (callerSince !== void 0) return callerSince;
|
|
8049
|
+
return first200Second;
|
|
8050
|
+
}
|
|
8051
|
+
function exactContainerNameMatch(container, name) {
|
|
8052
|
+
return container.names.some((n) => n === name || n === `/${name}`);
|
|
8053
|
+
}
|
|
8054
|
+
function containerSlug(container, fallback) {
|
|
8055
|
+
return container.names[0]?.replace(/^\//, "") ?? container.id ?? fallback;
|
|
8056
|
+
}
|
|
8057
|
+
async function resolveContainerSlug(client, id, containerName, matchContainerIdPrefix = true, signal) {
|
|
8058
|
+
throwIfAborted(signal);
|
|
8059
|
+
assertContainerNameOption(containerName);
|
|
8060
|
+
const cvmId = resolveCvmId(id);
|
|
8061
|
+
const composition = await client.get(`/cvms/${cvmId}/composition`, {
|
|
8062
|
+
signal
|
|
8063
|
+
});
|
|
8064
|
+
const containers = composition.containers ?? [];
|
|
8065
|
+
const compositionError = typeof composition.error === "string" && composition.error ? composition.error : void 0;
|
|
7851
8066
|
if (containerName) {
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
8067
|
+
const exact = containers.filter((item) => exactContainerNameMatch(item, containerName));
|
|
8068
|
+
if (exact[0]) return containerName;
|
|
8069
|
+
if (matchContainerIdPrefix) {
|
|
8070
|
+
const prefixed = containers.filter((item) => item.id.startsWith(containerName));
|
|
8071
|
+
if (prefixed.length > 1) {
|
|
8072
|
+
throw clientValidationError(
|
|
8073
|
+
`Ambiguous container prefix '${containerName}': ${prefixed.map((item) => item.names[0]?.replace(/^\//, "") ?? item.id).join(", ")}`
|
|
8074
|
+
);
|
|
8075
|
+
}
|
|
8076
|
+
if (prefixed[0]) return containerSlug(prefixed[0], containerName);
|
|
8077
|
+
}
|
|
8078
|
+
if (containers.length > 0) {
|
|
8079
|
+
throw new LogAccessError({ code: "ERR-17-007", message: "Container not found" });
|
|
8080
|
+
}
|
|
8081
|
+
if (compositionError) {
|
|
8082
|
+
throw new LogAccessError({ message: compositionError });
|
|
7860
8083
|
}
|
|
8084
|
+
throw new LogAccessError({ code: "ERR-17-007", message: "Container not found" });
|
|
7861
8085
|
}
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
throw new Error(`No log endpoints available for CVM '${cvmId}'`);
|
|
8086
|
+
if (compositionError) {
|
|
8087
|
+
throw new LogAccessError({ message: compositionError });
|
|
7865
8088
|
}
|
|
7866
|
-
|
|
8089
|
+
if (!containers.length) {
|
|
8090
|
+
throw new LogAccessError({ code: "ERR-17-007", message: "Container not found" });
|
|
8091
|
+
}
|
|
8092
|
+
const fallback = containers[0];
|
|
8093
|
+
if (!fallback) {
|
|
8094
|
+
throw new LogAccessError({ code: "ERR-17-007", message: "Container not found" });
|
|
8095
|
+
}
|
|
8096
|
+
return containerSlug(fallback, "app");
|
|
8097
|
+
}
|
|
8098
|
+
async function loadCvmLogInfo(client, id, signal) {
|
|
8099
|
+
const info = await getCvmInfoLogs(client, resolveCvmId(id), signal);
|
|
8100
|
+
if (info.public_logs === false) {
|
|
8101
|
+
throw containerLogsDisabledError();
|
|
8102
|
+
}
|
|
8103
|
+
return info;
|
|
8104
|
+
}
|
|
8105
|
+
function urlFromLogInfo(info, slug, cvmId) {
|
|
8106
|
+
const base2 = info.logs?.container_log_base ?? null;
|
|
8107
|
+
if (!base2) {
|
|
8108
|
+
throw new LogAccessError({ message: `No log endpoints available for CVM '${cvmId}'` });
|
|
8109
|
+
}
|
|
8110
|
+
return joinContainerLogUrl(base2, slug, info.logs?.auth_query);
|
|
8111
|
+
}
|
|
8112
|
+
async function getContainerLogEndpoint(client, id, containerName, matchContainerIdPrefix = true, signal) {
|
|
8113
|
+
const info = await loadCvmLogInfo(client, id, signal);
|
|
8114
|
+
const slug = await resolveContainerSlug(
|
|
8115
|
+
client,
|
|
8116
|
+
id,
|
|
8117
|
+
containerName,
|
|
8118
|
+
matchContainerIdPrefix,
|
|
8119
|
+
signal
|
|
8120
|
+
);
|
|
8121
|
+
return urlFromLogInfo(info, slug, resolveCvmId(id));
|
|
7867
8122
|
}
|
|
7868
8123
|
function waitForReconnect(signal, delayMs) {
|
|
7869
8124
|
if (signal?.aborted) return Promise.resolve();
|
|
@@ -7891,91 +8146,122 @@ function getErrorHttpStatus(error) {
|
|
|
7891
8146
|
return void 0;
|
|
7892
8147
|
}
|
|
7893
8148
|
var EMPTY_STREAM_END_MESSAGE = "log stream keeps ending without new output; the container may have stopped";
|
|
7894
|
-
|
|
8149
|
+
var EMPTY_STREAM_QUIET_MS = 1e4;
|
|
8150
|
+
async function followLogRequests(client, resolveUrl, consume, signal, refreshCvm, trackEmptyEnds = false, onConnected, shouldStop) {
|
|
7895
8151
|
let failureCount = 0;
|
|
7896
8152
|
let expiredRetries = 0;
|
|
7897
8153
|
let emptyEnds = 0;
|
|
8154
|
+
let lastConnectionStartedAt = 0;
|
|
8155
|
+
let haveStarted = false;
|
|
7898
8156
|
while (!signal?.aborted) {
|
|
8157
|
+
if (haveStarted) {
|
|
8158
|
+
const waitMs = 1e3 - (performance.now() - lastConnectionStartedAt);
|
|
8159
|
+
if (waitMs > 0) await waitForReconnect(signal, waitMs);
|
|
8160
|
+
if (signal?.aborted) return;
|
|
8161
|
+
}
|
|
8162
|
+
lastConnectionStartedAt = performance.now();
|
|
8163
|
+
haveStarted = true;
|
|
8164
|
+
let deliveredThisConnection = false;
|
|
8165
|
+
const markDelivered = () => {
|
|
8166
|
+
deliveredThisConnection = true;
|
|
8167
|
+
};
|
|
7899
8168
|
try {
|
|
7900
8169
|
const url = await resolveUrl();
|
|
7901
8170
|
if (signal?.aborted) return;
|
|
7902
|
-
const response = await
|
|
8171
|
+
const response = await logFetch(client, url, signal);
|
|
7903
8172
|
if (!response.ok) await throwResponseError(response);
|
|
7904
|
-
|
|
7905
|
-
const
|
|
8173
|
+
onConnected?.();
|
|
8174
|
+
const connectedAt = Date.now();
|
|
8175
|
+
const delivered = await consume(response, markDelivered) ?? deliveredThisConnection;
|
|
7906
8176
|
expiredRetries = 0;
|
|
8177
|
+
if (delivered) {
|
|
8178
|
+
failureCount = 0;
|
|
8179
|
+
}
|
|
8180
|
+
if (shouldStop?.()) return;
|
|
7907
8181
|
if (signal?.aborted) return;
|
|
7908
|
-
if (
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
}
|
|
7919
|
-
await waitForReconnect(signal, Math.min(250 * 2 ** (emptyEnds - 1), 5e3));
|
|
8182
|
+
if (delivered) {
|
|
8183
|
+
emptyEnds = 0;
|
|
8184
|
+
} else if (Date.now() - connectedAt >= EMPTY_STREAM_QUIET_MS) {
|
|
8185
|
+
emptyEnds = 0;
|
|
8186
|
+
} else {
|
|
8187
|
+
emptyEnds += 1;
|
|
8188
|
+
if (trackEmptyEnds && emptyEnds >= 5) {
|
|
8189
|
+
throw new LogAccessError({
|
|
8190
|
+
message: EMPTY_STREAM_END_MESSAGE,
|
|
8191
|
+
fromStreamBody: true
|
|
8192
|
+
});
|
|
7920
8193
|
}
|
|
8194
|
+
await waitForReconnect(signal, backoffDelayMs(emptyEnds));
|
|
7921
8195
|
}
|
|
7922
8196
|
} catch (error) {
|
|
7923
8197
|
if (signal?.aborted || error instanceof Error && error.name === "AbortError") {
|
|
7924
8198
|
return;
|
|
7925
8199
|
}
|
|
7926
|
-
|
|
8200
|
+
const retryError = error;
|
|
7927
8201
|
if (error instanceof LogAccessError && error.fromStreamBody) {
|
|
7928
8202
|
throw error;
|
|
7929
8203
|
}
|
|
7930
|
-
|
|
8204
|
+
emptyEnds = 0;
|
|
8205
|
+
if (deliveredThisConnection) {
|
|
8206
|
+
expiredRetries = 0;
|
|
8207
|
+
}
|
|
8208
|
+
if (error instanceof LogAccessError && !error.gatewayStream && error.code === "ERR-17-003") {
|
|
7931
8209
|
expiredRetries += 1;
|
|
7932
8210
|
if (expiredRetries > 3) throw error;
|
|
7933
|
-
|
|
7934
|
-
await refreshCvm?.();
|
|
7935
|
-
continue;
|
|
7936
|
-
} catch (refreshError) {
|
|
7937
|
-
retryError = refreshError;
|
|
7938
|
-
}
|
|
8211
|
+
continue;
|
|
7939
8212
|
}
|
|
7940
8213
|
const status = getErrorHttpStatus(retryError);
|
|
7941
|
-
|
|
7942
|
-
|
|
8214
|
+
const code = retryError instanceof LogAccessError ? retryError.code : void 0;
|
|
8215
|
+
const gatewayStream = retryError instanceof LogAccessError && retryError.gatewayStream;
|
|
8216
|
+
if (!gatewayStream && code === "ERR-17-002") {
|
|
8217
|
+
} else if (gatewayStream || status === 429 || status !== void 0 && status >= 500 || retryError instanceof TypeError || retryError instanceof UnknownError) {
|
|
8218
|
+
} else {
|
|
7943
8219
|
throw retryError;
|
|
7944
8220
|
}
|
|
7945
|
-
if (
|
|
7946
|
-
|
|
8221
|
+
if (deliveredThisConnection) {
|
|
8222
|
+
failureCount = 0;
|
|
7947
8223
|
}
|
|
7948
8224
|
failureCount += 1;
|
|
7949
8225
|
if (failureCount >= 5) throw retryError;
|
|
7950
|
-
const delayMs =
|
|
8226
|
+
const delayMs = backoffDelayMs(failureCount);
|
|
7951
8227
|
await waitForReconnect(signal, delayMs);
|
|
7952
8228
|
}
|
|
7953
8229
|
}
|
|
7954
8230
|
}
|
|
7955
8231
|
async function fetchCvmChannelLogs(client, id, channel, options = {}) {
|
|
8232
|
+
throwIfAborted(options.signal);
|
|
7956
8233
|
assertSupportedNodeLogOptions(options);
|
|
7957
|
-
const times =
|
|
7958
|
-
const baseUrl = await getCvmLogEndpoint(client, id, channel);
|
|
8234
|
+
const times = resolveTimes(options.since, options.until);
|
|
8235
|
+
const baseUrl = await getCvmLogEndpoint(client, id, channel, options.signal);
|
|
7959
8236
|
const url = buildLogUrl(baseUrl, {
|
|
7960
8237
|
since: times.since,
|
|
7961
8238
|
until: times.until,
|
|
7962
8239
|
tail: options.tail,
|
|
7963
8240
|
ansi: options.ansi
|
|
7964
8241
|
});
|
|
7965
|
-
const response = await
|
|
8242
|
+
const response = await logFetch(client, url, options.signal);
|
|
7966
8243
|
if (!response.ok) await throwResponseError(response);
|
|
7967
|
-
|
|
8244
|
+
const text = await response.text();
|
|
8245
|
+
throwIfGatewayTextErrors(text);
|
|
8246
|
+
return applyAnsiPolicy(
|
|
8247
|
+
text.split(/(?<=\n)/).filter((line) => {
|
|
8248
|
+
const content = line.replace(/\r?\n$/, "");
|
|
8249
|
+
return content !== "[vmm heartbeat]" && content !== "[teepod heartbeat]";
|
|
8250
|
+
}).join(""),
|
|
8251
|
+
options.ansi
|
|
8252
|
+
);
|
|
7968
8253
|
}
|
|
7969
8254
|
async function streamCvmChannelLogs(client, id, channel, onData, options = {}, signal) {
|
|
8255
|
+
throwIfAborted(signal ?? options.signal);
|
|
7970
8256
|
assertSupportedNodeLogOptions(options);
|
|
7971
8257
|
const abort = signal ?? options.signal;
|
|
7972
|
-
const times =
|
|
8258
|
+
const times = resolveTimes(options.since, options.until);
|
|
7973
8259
|
let firstRequest = true;
|
|
7974
8260
|
await followLogRequests(
|
|
8261
|
+
client,
|
|
7975
8262
|
async () => {
|
|
7976
|
-
const baseUrl = await getCvmLogEndpoint(client, id, channel);
|
|
8263
|
+
const baseUrl = await getCvmLogEndpoint(client, id, channel, abort);
|
|
7977
8264
|
const tail = firstRequest ? options.tail : 0;
|
|
7978
|
-
firstRequest = false;
|
|
7979
8265
|
return buildLogUrl(baseUrl, {
|
|
7980
8266
|
since: times.since,
|
|
7981
8267
|
until: times.until,
|
|
@@ -7984,42 +8270,50 @@ async function streamCvmChannelLogs(client, id, channel, onData, options = {}, s
|
|
|
7984
8270
|
ansi: options.ansi
|
|
7985
8271
|
});
|
|
7986
8272
|
},
|
|
7987
|
-
(response) => streamResponse(response, onData),
|
|
8273
|
+
(response, markDelivered) => streamResponse(response, onData, markDelivered, options.ansi),
|
|
7988
8274
|
abort,
|
|
7989
|
-
|
|
7990
|
-
|
|
8275
|
+
void 0,
|
|
8276
|
+
false,
|
|
8277
|
+
() => {
|
|
8278
|
+
firstRequest = false;
|
|
7991
8279
|
}
|
|
7992
8280
|
);
|
|
7993
8281
|
}
|
|
7994
8282
|
async function fetchContainerLogsEntries(client, id, options = {}) {
|
|
7995
|
-
|
|
7996
|
-
|
|
8283
|
+
throwIfAborted(options.signal);
|
|
8284
|
+
assertContainerNameOption(options.container);
|
|
8285
|
+
const times = resolveTimes(options.since, options.until);
|
|
7997
8286
|
const baseUrl = await getContainerLogEndpoint(
|
|
7998
8287
|
client,
|
|
7999
8288
|
id,
|
|
8000
8289
|
options.container,
|
|
8001
|
-
options.matchContainerIdPrefix ?? true
|
|
8290
|
+
options.matchContainerIdPrefix ?? true,
|
|
8291
|
+
options.signal
|
|
8002
8292
|
);
|
|
8003
8293
|
const url = buildLogUrl(baseUrl, {
|
|
8004
8294
|
...times,
|
|
8005
8295
|
tail: options.tail,
|
|
8006
8296
|
timestamps: options.timestamps,
|
|
8007
|
-
ansi: options.ansi,
|
|
8008
8297
|
format: options.format ?? "ndjson"
|
|
8009
8298
|
});
|
|
8010
|
-
const response = await
|
|
8299
|
+
const response = await logFetch(client, url, options.signal);
|
|
8011
8300
|
if (!response.ok) await throwResponseError(response);
|
|
8012
|
-
return parseStructuredLogsToEntries(await response.text())
|
|
8301
|
+
return parseStructuredLogsToEntries(await response.text()).map((entry) => ({
|
|
8302
|
+
...entry,
|
|
8303
|
+
message: applyAnsiPolicy(entry.message, options.ansi)
|
|
8304
|
+
}));
|
|
8013
8305
|
}
|
|
8014
8306
|
async function fetchContainerLogs(client, id, options = {}) {
|
|
8307
|
+
throwIfAborted(options.signal);
|
|
8308
|
+
assertContainerNameOption(options.container);
|
|
8015
8309
|
if (options.format === "text") {
|
|
8016
|
-
const times =
|
|
8017
|
-
await assertContainerLogsEnabled(client, id);
|
|
8310
|
+
const times = resolveTimes(options.since, options.until);
|
|
8018
8311
|
const baseUrl = await getContainerLogEndpoint(
|
|
8019
8312
|
client,
|
|
8020
8313
|
id,
|
|
8021
8314
|
options.container,
|
|
8022
|
-
options.matchContainerIdPrefix ?? true
|
|
8315
|
+
options.matchContainerIdPrefix ?? true,
|
|
8316
|
+
options.signal
|
|
8023
8317
|
);
|
|
8024
8318
|
const url = buildLogUrl(baseUrl, {
|
|
8025
8319
|
...times,
|
|
@@ -8028,37 +8322,44 @@ async function fetchContainerLogs(client, id, options = {}) {
|
|
|
8028
8322
|
ansi: options.ansi,
|
|
8029
8323
|
format: "text"
|
|
8030
8324
|
});
|
|
8031
|
-
const response = await
|
|
8325
|
+
const response = await logFetch(client, url, options.signal);
|
|
8032
8326
|
if (!response.ok) await throwResponseError(response);
|
|
8033
8327
|
const text = await response.text();
|
|
8034
|
-
|
|
8035
|
-
return text;
|
|
8328
|
+
throwIfTextBodyErrors(text);
|
|
8329
|
+
return applyAnsiPolicy(text, options.ansi);
|
|
8036
8330
|
}
|
|
8037
8331
|
const entries = await fetchContainerLogsEntries(client, id, {
|
|
8038
8332
|
...options,
|
|
8039
8333
|
format: "ndjson"
|
|
8040
8334
|
});
|
|
8041
|
-
return entries.map((entry) => entry.message
|
|
8335
|
+
return entries.map((entry) => entry.message).join("");
|
|
8042
8336
|
}
|
|
8043
8337
|
async function streamContainerLogsEntries(client, id, onEntry, options = {}, signal) {
|
|
8044
8338
|
const abort = signal ?? options.signal;
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
const
|
|
8339
|
+
throwIfAborted(abort);
|
|
8340
|
+
assertContainerNameOption(options.container);
|
|
8341
|
+
const times = resolveTimes(options.since, options.until);
|
|
8342
|
+
const cursor = { boundaryCounts: /* @__PURE__ */ new Map() };
|
|
8048
8343
|
let replayCounts = /* @__PURE__ */ new Map();
|
|
8049
8344
|
let firstRequest = true;
|
|
8345
|
+
let first200Second;
|
|
8346
|
+
let slug;
|
|
8050
8347
|
const buildRequestUrl = async () => {
|
|
8051
|
-
const
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8348
|
+
const info = await loadCvmLogInfo(client, id, abort);
|
|
8349
|
+
if (slug === void 0) {
|
|
8350
|
+
slug = await resolveContainerSlug(
|
|
8351
|
+
client,
|
|
8352
|
+
id,
|
|
8353
|
+
options.container,
|
|
8354
|
+
options.matchContainerIdPrefix ?? true,
|
|
8355
|
+
abort
|
|
8356
|
+
);
|
|
8357
|
+
}
|
|
8358
|
+
const baseUrl = urlFromLogInfo(info, slug, resolveCvmId(id));
|
|
8359
|
+
const tail = firstRequest ? options.tail : "all";
|
|
8059
8360
|
replayCounts = new Map(cursor.boundaryCounts);
|
|
8060
8361
|
return buildLogUrl(baseUrl, {
|
|
8061
|
-
since: cursor.since,
|
|
8362
|
+
since: firstRequest ? times.since : reconnectSinceValue(cursor.since, first200Second, times.since),
|
|
8062
8363
|
until: times.until,
|
|
8063
8364
|
tail,
|
|
8064
8365
|
follow: true,
|
|
@@ -8067,20 +8368,23 @@ async function streamContainerLogsEntries(client, id, onEntry, options = {}, sig
|
|
|
8067
8368
|
});
|
|
8068
8369
|
};
|
|
8069
8370
|
await followLogRequests(
|
|
8371
|
+
client,
|
|
8070
8372
|
buildRequestUrl,
|
|
8071
|
-
async (response) => {
|
|
8373
|
+
async (response, markDelivered) => {
|
|
8072
8374
|
let delivered = false;
|
|
8073
8375
|
await streamNdjsonEntriesResponse(response, (entry) => {
|
|
8074
8376
|
const timestamp = parseTimestampedMessage(entry.message);
|
|
8075
8377
|
if (timestamp.second === void 0 || !timestamp.timestamp) {
|
|
8076
8378
|
delivered = true;
|
|
8077
|
-
|
|
8379
|
+
markDelivered();
|
|
8380
|
+
onEntry(formatFollowContainerEntry(entry, options.timestamps ?? false, options.ansi));
|
|
8078
8381
|
return;
|
|
8079
8382
|
}
|
|
8080
8383
|
const key = JSON.stringify([entry.channel, entry.message]);
|
|
8081
8384
|
if (cursor.boundarySecond !== void 0 && timestamp.second < cursor.boundarySecond) {
|
|
8082
8385
|
delivered = true;
|
|
8083
|
-
|
|
8386
|
+
markDelivered();
|
|
8387
|
+
onEntry(formatFollowContainerEntry(entry, options.timestamps ?? false, options.ansi));
|
|
8084
8388
|
return;
|
|
8085
8389
|
}
|
|
8086
8390
|
if (timestamp.second === cursor.boundarySecond) {
|
|
@@ -8096,18 +8400,22 @@ async function streamContainerLogsEntries(client, id, onEntry, options = {}, sig
|
|
|
8096
8400
|
cursor.since = Math.max(cursor.since ?? timestamp.second, timestamp.second);
|
|
8097
8401
|
cursor.boundaryCounts.set(key, (cursor.boundaryCounts.get(key) ?? 0) + 1);
|
|
8098
8402
|
delivered = true;
|
|
8099
|
-
|
|
8403
|
+
markDelivered();
|
|
8404
|
+
onEntry(formatFollowContainerEntry(entry, options.timestamps ?? false, options.ansi));
|
|
8100
8405
|
});
|
|
8101
8406
|
return delivered;
|
|
8102
8407
|
},
|
|
8103
8408
|
abort,
|
|
8104
|
-
|
|
8105
|
-
|
|
8409
|
+
void 0,
|
|
8410
|
+
true,
|
|
8411
|
+
() => {
|
|
8412
|
+
firstRequest = false;
|
|
8413
|
+
if (first200Second === void 0) first200Second = Math.floor(Date.now() / 1e3);
|
|
8106
8414
|
},
|
|
8107
|
-
|
|
8415
|
+
() => untilReached(times.until, cursor.since)
|
|
8108
8416
|
);
|
|
8109
8417
|
}
|
|
8110
|
-
async function streamContainerText(response, onData) {
|
|
8418
|
+
async function streamContainerText(response, onData, ansi) {
|
|
8111
8419
|
const reader = response.body?.getReader();
|
|
8112
8420
|
if (!reader) throw new Error("No response body available for streaming");
|
|
8113
8421
|
const decoder = new TextDecoder();
|
|
@@ -8122,8 +8430,9 @@ async function streamContainerText(response, onData) {
|
|
|
8122
8430
|
while (newline >= 0) {
|
|
8123
8431
|
const line = buffer.slice(0, newline);
|
|
8124
8432
|
buffer = buffer.slice(newline + 1);
|
|
8125
|
-
throwIfGuestAgentError(line);
|
|
8126
|
-
|
|
8433
|
+
if (!delivered) throwIfGuestAgentError(line);
|
|
8434
|
+
throwTextStreamError(line);
|
|
8435
|
+
onData(applyAnsiPolicy(line + "\n", ansi));
|
|
8127
8436
|
delivered = true;
|
|
8128
8437
|
newline = buffer.indexOf("\n");
|
|
8129
8438
|
}
|
|
@@ -8133,8 +8442,9 @@ async function streamContainerText(response, onData) {
|
|
|
8133
8442
|
}
|
|
8134
8443
|
}
|
|
8135
8444
|
if (buffer) {
|
|
8136
|
-
throwIfGuestAgentError(buffer);
|
|
8137
|
-
|
|
8445
|
+
if (!delivered) throwIfGuestAgentError(buffer);
|
|
8446
|
+
throwTextStreamError(buffer);
|
|
8447
|
+
onData(applyAnsiPolicy(buffer, ansi));
|
|
8138
8448
|
delivered = true;
|
|
8139
8449
|
}
|
|
8140
8450
|
} finally {
|
|
@@ -8147,46 +8457,101 @@ async function streamContainerText(response, onData) {
|
|
|
8147
8457
|
async function streamContainerLogs(client, id, onData, options = {}, signal) {
|
|
8148
8458
|
if (options.format === "text") {
|
|
8149
8459
|
const abort = signal ?? options.signal;
|
|
8150
|
-
|
|
8151
|
-
|
|
8460
|
+
throwIfAborted(abort);
|
|
8461
|
+
assertContainerNameOption(options.container);
|
|
8462
|
+
const times = resolveTimes(options.since, options.until);
|
|
8463
|
+
const cursor = { boundaryCounts: /* @__PURE__ */ new Map() };
|
|
8464
|
+
let replayCounts = /* @__PURE__ */ new Map();
|
|
8152
8465
|
let firstRequest = true;
|
|
8466
|
+
let first200Second;
|
|
8467
|
+
let slug;
|
|
8153
8468
|
await followLogRequests(
|
|
8469
|
+
client,
|
|
8154
8470
|
async () => {
|
|
8155
|
-
const
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8471
|
+
const info = await loadCvmLogInfo(client, id, abort);
|
|
8472
|
+
if (slug === void 0) {
|
|
8473
|
+
slug = await resolveContainerSlug(
|
|
8474
|
+
client,
|
|
8475
|
+
id,
|
|
8476
|
+
options.container,
|
|
8477
|
+
options.matchContainerIdPrefix ?? true,
|
|
8478
|
+
abort
|
|
8479
|
+
);
|
|
8480
|
+
}
|
|
8481
|
+
const baseUrl = urlFromLogInfo(info, slug, resolveCvmId(id));
|
|
8482
|
+
const tail = firstRequest ? options.tail : "all";
|
|
8483
|
+
replayCounts = new Map(cursor.boundaryCounts);
|
|
8163
8484
|
return buildLogUrl(baseUrl, {
|
|
8164
|
-
|
|
8485
|
+
since: firstRequest ? times.since : reconnectSinceValue(cursor.since, first200Second, times.since),
|
|
8486
|
+
until: times.until,
|
|
8165
8487
|
tail,
|
|
8166
8488
|
follow: true,
|
|
8167
|
-
timestamps:
|
|
8489
|
+
timestamps: true,
|
|
8168
8490
|
ansi: options.ansi,
|
|
8169
8491
|
format: "text"
|
|
8170
8492
|
});
|
|
8171
8493
|
},
|
|
8172
|
-
(response) =>
|
|
8494
|
+
async (response, markDelivered) => {
|
|
8495
|
+
let delivered = false;
|
|
8496
|
+
await streamContainerText(
|
|
8497
|
+
response,
|
|
8498
|
+
(line) => {
|
|
8499
|
+
const raw = line.endsWith("\n") ? line.slice(0, -1) : line;
|
|
8500
|
+
throwTextStreamError(raw);
|
|
8501
|
+
const timestamp = parseTimestampedMessage(raw);
|
|
8502
|
+
const out = applyAnsiPolicy(
|
|
8503
|
+
options.timestamps ? line : timestamp.timestamp ? `${timestamp.message ?? ""}${line.endsWith("\n") ? "\n" : ""}` : line,
|
|
8504
|
+
options.ansi
|
|
8505
|
+
);
|
|
8506
|
+
if (timestamp.second === void 0 || !timestamp.timestamp) {
|
|
8507
|
+
delivered = true;
|
|
8508
|
+
markDelivered();
|
|
8509
|
+
onData(out);
|
|
8510
|
+
return;
|
|
8511
|
+
}
|
|
8512
|
+
const key = raw;
|
|
8513
|
+
if (cursor.boundarySecond !== void 0 && timestamp.second < cursor.boundarySecond) {
|
|
8514
|
+
delivered = true;
|
|
8515
|
+
markDelivered();
|
|
8516
|
+
onData(out);
|
|
8517
|
+
return;
|
|
8518
|
+
}
|
|
8519
|
+
if (timestamp.second === cursor.boundarySecond) {
|
|
8520
|
+
const replayCount = replayCounts.get(key) ?? 0;
|
|
8521
|
+
if (replayCount > 0) {
|
|
8522
|
+
replayCounts.set(key, replayCount - 1);
|
|
8523
|
+
return;
|
|
8524
|
+
}
|
|
8525
|
+
} else if (cursor.boundarySecond === void 0 || timestamp.second > cursor.boundarySecond) {
|
|
8526
|
+
cursor.boundarySecond = timestamp.second;
|
|
8527
|
+
cursor.boundaryCounts.clear();
|
|
8528
|
+
}
|
|
8529
|
+
cursor.since = Math.max(cursor.since ?? timestamp.second, timestamp.second);
|
|
8530
|
+
cursor.boundaryCounts.set(key, (cursor.boundaryCounts.get(key) ?? 0) + 1);
|
|
8531
|
+
delivered = true;
|
|
8532
|
+
markDelivered();
|
|
8533
|
+
onData(out);
|
|
8534
|
+
},
|
|
8535
|
+
options.ansi
|
|
8536
|
+
);
|
|
8537
|
+
return delivered;
|
|
8538
|
+
},
|
|
8173
8539
|
abort,
|
|
8174
|
-
|
|
8175
|
-
|
|
8540
|
+
void 0,
|
|
8541
|
+
true,
|
|
8542
|
+
() => {
|
|
8543
|
+
firstRequest = false;
|
|
8544
|
+
if (first200Second === void 0) first200Second = Math.floor(Date.now() / 1e3);
|
|
8176
8545
|
},
|
|
8177
|
-
|
|
8546
|
+
() => untilReached(times.until, cursor.since)
|
|
8178
8547
|
);
|
|
8179
8548
|
return;
|
|
8180
8549
|
}
|
|
8181
|
-
return streamContainerLogsEntries(
|
|
8182
|
-
client,
|
|
8183
|
-
id,
|
|
8184
|
-
(entry) => onData(entry.message === "" ? "\n" : entry.message),
|
|
8185
|
-
options,
|
|
8186
|
-
signal
|
|
8187
|
-
);
|
|
8550
|
+
return streamContainerLogsEntries(client, id, (entry) => onData(entry.message), options, signal);
|
|
8188
8551
|
}
|
|
8189
8552
|
async function fetchCvmLogs(client, id, source, options = {}) {
|
|
8553
|
+
throwIfAborted(options.signal);
|
|
8554
|
+
if (source.type === "container") assertContainerNameOption(source.name);
|
|
8190
8555
|
if (source.type === "node") {
|
|
8191
8556
|
return fetchCvmChannelLogs(client, id, source.channel, options);
|
|
8192
8557
|
}
|
|
@@ -8204,15 +8569,22 @@ async function fetchCvmLogs(client, id, source, options = {}) {
|
|
|
8204
8569
|
});
|
|
8205
8570
|
}
|
|
8206
8571
|
async function* followCvmLogs(client, id, source, options = {}) {
|
|
8572
|
+
if (source.type === "container") assertContainerNameOption(source.name);
|
|
8207
8573
|
const pending = [];
|
|
8208
8574
|
let wake;
|
|
8209
8575
|
let done = false;
|
|
8210
8576
|
let error;
|
|
8577
|
+
const abort = new AbortController();
|
|
8578
|
+
if (options.signal) {
|
|
8579
|
+
if (options.signal.aborted) abort.abort();
|
|
8580
|
+
else options.signal.addEventListener("abort", () => abort.abort(), { once: true });
|
|
8581
|
+
}
|
|
8582
|
+
const signal = abort.signal;
|
|
8211
8583
|
const push = (item) => {
|
|
8212
8584
|
pending.push(item);
|
|
8213
8585
|
wake?.();
|
|
8214
8586
|
};
|
|
8215
|
-
const run = source.type === "node" ? streamCvmChannelLogs(client, id, source.channel, push, options,
|
|
8587
|
+
const run = source.type === "node" ? streamCvmChannelLogs(client, id, source.channel, push, options, signal) : options.format === "text" ? streamContainerLogs(
|
|
8216
8588
|
client,
|
|
8217
8589
|
id,
|
|
8218
8590
|
(data) => push(data),
|
|
@@ -8221,7 +8593,7 @@ async function* followCvmLogs(client, id, source, options = {}) {
|
|
|
8221
8593
|
container: source.name,
|
|
8222
8594
|
matchContainerIdPrefix: source.matchContainerIdPrefix
|
|
8223
8595
|
},
|
|
8224
|
-
|
|
8596
|
+
signal
|
|
8225
8597
|
) : streamContainerLogsEntries(
|
|
8226
8598
|
client,
|
|
8227
8599
|
id,
|
|
@@ -8231,7 +8603,7 @@ async function* followCvmLogs(client, id, source, options = {}) {
|
|
|
8231
8603
|
container: source.name,
|
|
8232
8604
|
matchContainerIdPrefix: source.matchContainerIdPrefix
|
|
8233
8605
|
},
|
|
8234
|
-
|
|
8606
|
+
signal
|
|
8235
8607
|
);
|
|
8236
8608
|
void run.then(
|
|
8237
8609
|
() => {
|
|
@@ -8244,16 +8616,20 @@ async function* followCvmLogs(client, id, source, options = {}) {
|
|
|
8244
8616
|
wake?.();
|
|
8245
8617
|
}
|
|
8246
8618
|
);
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8619
|
+
try {
|
|
8620
|
+
while (!done || pending.length > 0) {
|
|
8621
|
+
if (pending.length > 0) {
|
|
8622
|
+
yield pending.shift();
|
|
8623
|
+
continue;
|
|
8624
|
+
}
|
|
8625
|
+
await new Promise((resolve) => {
|
|
8626
|
+
wake = resolve;
|
|
8627
|
+
});
|
|
8251
8628
|
}
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8629
|
+
if (error) throw error;
|
|
8630
|
+
} finally {
|
|
8631
|
+
abort.abort();
|
|
8255
8632
|
}
|
|
8256
|
-
if (error) throw error;
|
|
8257
8633
|
}
|
|
8258
8634
|
|
|
8259
8635
|
// src/parse_dotenv.ts
|
|
@@ -8354,12 +8730,14 @@ export {
|
|
|
8354
8730
|
CvmDetailV20251028Schema,
|
|
8355
8731
|
CvmGatewayInfoV20260121Schema,
|
|
8356
8732
|
CvmGpuRentalOrderInfoV20260121Schema,
|
|
8733
|
+
CvmGpuStatusSchema,
|
|
8357
8734
|
CvmHourlyRateV20260121Schema,
|
|
8358
8735
|
CvmIdBaseSchema,
|
|
8359
8736
|
CvmIdObjectSchema,
|
|
8360
8737
|
CvmIdSchema,
|
|
8361
8738
|
CvmInfoDetailV20260121Schema,
|
|
8362
8739
|
CvmInfoDetailV20260522Schema,
|
|
8740
|
+
CvmInfoDetailV20261111Schema,
|
|
8363
8741
|
CvmInfoV20251028Schema,
|
|
8364
8742
|
CvmInfoV20260121Schema,
|
|
8365
8743
|
CvmInfoV20260522Schema,
|
|
@@ -8617,6 +8995,7 @@ export {
|
|
|
8617
8995
|
getCvmContainersStats,
|
|
8618
8996
|
getCvmCreateResources,
|
|
8619
8997
|
getCvmDockerCompose,
|
|
8998
|
+
getCvmGpuStatus,
|
|
8620
8999
|
getCvmInfo,
|
|
8621
9000
|
getCvmInitScripts,
|
|
8622
9001
|
getCvmList,
|
|
@@ -8708,6 +9087,7 @@ export {
|
|
|
8708
9087
|
safeGetCvmContainersStats,
|
|
8709
9088
|
safeGetCvmCreateResources,
|
|
8710
9089
|
safeGetCvmDockerCompose,
|
|
9090
|
+
safeGetCvmGpuStatus,
|
|
8711
9091
|
safeGetCvmInfo,
|
|
8712
9092
|
safeGetCvmInitScripts,
|
|
8713
9093
|
safeGetCvmList,
|