@phala/cloud 0.2.3 → 0.2.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/apps/get_app_attestation.d.ts +963 -0
- package/dist/actions/apps/get_app_device_allowlist.d.ts +108 -0
- package/dist/actions/blockchains/abi/dstack_app.d.ts +101 -0
- package/dist/actions/blockchains/add_device.d.ts +62 -0
- package/dist/actions/blockchains/check_device_allowed.d.ts +44 -0
- package/dist/actions/blockchains/get_allowed_devices.d.ts +65 -0
- package/dist/actions/blockchains/remove_device.d.ts +62 -0
- package/dist/actions/blockchains/set_allow_any_device.d.ts +62 -0
- package/dist/actions/cvms/get_cvm_attestation.d.ts +220 -0
- package/dist/actions/cvms/get_cvm_compose_file.d.ts +16 -0
- package/dist/actions/cvms/get_cvm_user_config.d.ts +92 -0
- package/dist/actions/cvms/provision_cvm.d.ts +26 -1
- package/dist/actions/cvms/provision_cvm_compose_file_update.d.ts +18 -0
- package/dist/actions/cvms/refresh_cvm_instance_id.d.ts +93 -0
- package/dist/actions/cvms/refresh_cvm_instance_ids.d.ts +194 -0
- package/dist/actions/cvms/replicate_cvm.d.ts +126 -0
- package/dist/actions/cvms/restart_cvm.d.ts +2 -2
- package/dist/actions/cvms/shutdown_cvm.d.ts +2 -2
- package/dist/actions/cvms/start_cvm.d.ts +2 -2
- package/dist/actions/cvms/stop_cvm.d.ts +2 -2
- package/dist/actions/index.d.ts +20 -1
- package/dist/actions/kms/get_kms_onchain_detail.d.ts +688 -0
- package/dist/actions/os_images/get_os_images.d.ts +217 -0
- package/dist/actions/ssh_keys/create_ssh_key.d.ts +104 -0
- package/dist/actions/ssh_keys/delete_ssh_key.d.ts +65 -0
- package/dist/actions/ssh_keys/import_github_profile.d.ts +93 -0
- package/dist/actions/ssh_keys/list_ssh_keys.d.ts +101 -0
- package/dist/actions/ssh_keys/sync_github_ssh_keys.d.ts +78 -0
- package/dist/actions/workspaces/get_workspace.d.ts +2 -0
- package/dist/actions/workspaces/list_workspaces.d.ts +18 -0
- package/dist/create-client.d.ts +106 -0
- package/dist/index.js +1500 -322
- package/dist/index.mjs +1441 -320
- package/dist/types/app_compose.d.ts +5 -0
- package/dist/types/app_info_v20260121.d.ts +68 -0
- package/dist/types/cvm_info.d.ts +3 -3
- package/dist/types/cvm_info_v20260121.d.ts +22 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1066,7 +1066,8 @@ var WorkspaceResponseSchema = z7.object({
|
|
|
1066
1066
|
tier: z7.string(),
|
|
1067
1067
|
role: z7.string(),
|
|
1068
1068
|
is_default: z7.boolean(),
|
|
1069
|
-
created_at: z7.string()
|
|
1069
|
+
created_at: z7.string(),
|
|
1070
|
+
confidential_models_enabled: z7.boolean().optional()
|
|
1070
1071
|
}).passthrough();
|
|
1071
1072
|
var PaginationMetadataSchema = z7.object({
|
|
1072
1073
|
has_more: z7.boolean(),
|
|
@@ -1255,6 +1256,7 @@ var CvmInfoV20260121Schema = z9.object({
|
|
|
1255
1256
|
name: z9.string(),
|
|
1256
1257
|
app_id: z9.string().nullable().optional(),
|
|
1257
1258
|
vm_uuid: z9.string().nullable().optional(),
|
|
1259
|
+
instance_id: z9.string().nullable().optional(),
|
|
1258
1260
|
resource: CvmResourceInfoV20260121Schema,
|
|
1259
1261
|
node_info: NodeRefSchema.nullable().optional(),
|
|
1260
1262
|
os: CvmOsInfoV20260121Schema.nullable().optional(),
|
|
@@ -1271,6 +1273,7 @@ var CvmInfoV20260121Schema = z9.object({
|
|
|
1271
1273
|
public_tcbinfo: z9.boolean().optional(),
|
|
1272
1274
|
gateway_enabled: z9.boolean().optional(),
|
|
1273
1275
|
secure_time: z9.boolean().optional(),
|
|
1276
|
+
listed: z9.boolean().optional().default(false),
|
|
1274
1277
|
storage_fs: z9.string().optional(),
|
|
1275
1278
|
workspace: WorkspaceRefSchema.nullable().optional(),
|
|
1276
1279
|
creator: UserRefSchema.nullable().optional()
|
|
@@ -1495,6 +1498,7 @@ var LooseAppComposeSchema = z12.object({
|
|
|
1495
1498
|
public_logs: z12.boolean().optional(),
|
|
1496
1499
|
public_sysinfo: z12.boolean().optional(),
|
|
1497
1500
|
tproxy_enabled: z12.boolean().optional(),
|
|
1501
|
+
storage_fs: z12.enum(["ext4", "zfs"]).optional(),
|
|
1498
1502
|
pre_launch_script: z12.string().optional(),
|
|
1499
1503
|
env_pubkey: z12.string().optional(),
|
|
1500
1504
|
salt: z12.string().optional().nullable()
|
|
@@ -1551,8 +1555,9 @@ var ProvisionCvmRequestSchema = z13.object({
|
|
|
1551
1555
|
public_sysinfo: z13.boolean().optional(),
|
|
1552
1556
|
gateway_enabled: z13.boolean().optional(),
|
|
1553
1557
|
// recommended
|
|
1554
|
-
tproxy_enabled: z13.boolean().optional()
|
|
1558
|
+
tproxy_enabled: z13.boolean().optional(),
|
|
1555
1559
|
// deprecated, for compatibility
|
|
1560
|
+
storage_fs: z13.enum(["ext4", "zfs"]).optional()
|
|
1556
1561
|
}).superRefine((data, ctx) => {
|
|
1557
1562
|
validateComposePayloadSize(data.docker_compose_file, data.pre_launch_script, ctx);
|
|
1558
1563
|
}),
|
|
@@ -2101,7 +2106,7 @@ var VMSchema = z25.object({
|
|
|
2101
2106
|
vm_uuid: z25.string().nullable(),
|
|
2102
2107
|
instance_id: z25.string().nullable(),
|
|
2103
2108
|
app_url: z25.string().optional().nullable(),
|
|
2104
|
-
base_image: z25.string().nullable(),
|
|
2109
|
+
base_image: z25.string().optional().nullable(),
|
|
2105
2110
|
vcpu: z25.number(),
|
|
2106
2111
|
memory: z25.number(),
|
|
2107
2112
|
disk_size: z25.number(),
|
|
@@ -2424,6 +2429,161 @@ var { action: getCvmState, safeAction: safeGetCvmState } = defineAction(CvmState
|
|
|
2424
2429
|
return await client.get(`/cvms/${cvmId}/state`);
|
|
2425
2430
|
});
|
|
2426
2431
|
|
|
2432
|
+
// src/actions/ssh_keys/list_ssh_keys.ts
|
|
2433
|
+
import { z as z38 } from "zod";
|
|
2434
|
+
var SshKeySchema = z38.object({
|
|
2435
|
+
id: z38.string(),
|
|
2436
|
+
user_id: z38.string(),
|
|
2437
|
+
name: z38.string(),
|
|
2438
|
+
public_key: z38.string(),
|
|
2439
|
+
fingerprint: z38.string(),
|
|
2440
|
+
key_type: z38.string(),
|
|
2441
|
+
source: z38.string(),
|
|
2442
|
+
key_metadata: z38.record(z38.unknown()).nullable().optional(),
|
|
2443
|
+
last_synced_at: z38.string().nullable().optional(),
|
|
2444
|
+
created_at: z38.string(),
|
|
2445
|
+
updated_at: z38.string()
|
|
2446
|
+
});
|
|
2447
|
+
var ListSshKeysResponseSchema = z38.array(SshKeySchema);
|
|
2448
|
+
async function listSshKeys(client) {
|
|
2449
|
+
const response = await client.get("/user/ssh-keys");
|
|
2450
|
+
return ListSshKeysResponseSchema.parse(response);
|
|
2451
|
+
}
|
|
2452
|
+
async function safeListSshKeys(client) {
|
|
2453
|
+
try {
|
|
2454
|
+
const data = await listSshKeys(client);
|
|
2455
|
+
return { success: true, data };
|
|
2456
|
+
} catch (error) {
|
|
2457
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
2458
|
+
return { success: false, error };
|
|
2459
|
+
}
|
|
2460
|
+
return {
|
|
2461
|
+
success: false,
|
|
2462
|
+
error: {
|
|
2463
|
+
name: "Error",
|
|
2464
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2465
|
+
}
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
// src/actions/ssh_keys/import_github_profile.ts
|
|
2471
|
+
import { z as z39 } from "zod";
|
|
2472
|
+
var ImportGithubProfileRequestSchema = z39.object({
|
|
2473
|
+
github_username: z39.string().min(1)
|
|
2474
|
+
});
|
|
2475
|
+
var ImportGithubProfileResponseSchema = z39.object({
|
|
2476
|
+
github_username: z39.string(),
|
|
2477
|
+
keys_added: z39.number().int(),
|
|
2478
|
+
keys_skipped: z39.number().int(),
|
|
2479
|
+
errors: z39.array(z39.string()).default([])
|
|
2480
|
+
});
|
|
2481
|
+
var { action: importGithubProfileSshKeys, safeAction: safeImportGithubProfileSshKeys } = defineAction(
|
|
2482
|
+
ImportGithubProfileResponseSchema,
|
|
2483
|
+
async (client, request) => {
|
|
2484
|
+
const { github_username } = ImportGithubProfileRequestSchema.parse(request);
|
|
2485
|
+
return await client.post("/user/ssh-keys/github-profile", { github_username });
|
|
2486
|
+
}
|
|
2487
|
+
);
|
|
2488
|
+
|
|
2489
|
+
// src/actions/ssh_keys/create_ssh_key.ts
|
|
2490
|
+
import { z as z40 } from "zod";
|
|
2491
|
+
var CreateSshKeyRequestSchema = z40.object({
|
|
2492
|
+
name: z40.string().min(1),
|
|
2493
|
+
public_key: z40.string().min(1)
|
|
2494
|
+
});
|
|
2495
|
+
var { action: createSshKey, safeAction: safeCreateSshKey } = defineAction(SshKeySchema, async (client, request) => {
|
|
2496
|
+
const { name, public_key } = CreateSshKeyRequestSchema.parse(request);
|
|
2497
|
+
return await client.post("/user/ssh-keys", { name, public_key });
|
|
2498
|
+
});
|
|
2499
|
+
|
|
2500
|
+
// src/actions/ssh_keys/delete_ssh_key.ts
|
|
2501
|
+
import { z as z41 } from "zod";
|
|
2502
|
+
var DeleteSshKeyRequestSchema = z41.object({
|
|
2503
|
+
keyId: z41.string().min(1)
|
|
2504
|
+
});
|
|
2505
|
+
var { action: deleteSshKey, safeAction: safeDeleteSshKey } = defineAction(z41.void(), async (client, request) => {
|
|
2506
|
+
const { keyId } = DeleteSshKeyRequestSchema.parse(request);
|
|
2507
|
+
await client.delete(`/user/ssh-keys/${keyId}`);
|
|
2508
|
+
return void 0;
|
|
2509
|
+
});
|
|
2510
|
+
|
|
2511
|
+
// src/actions/ssh_keys/sync_github_ssh_keys.ts
|
|
2512
|
+
import { z as z42 } from "zod";
|
|
2513
|
+
var SyncGithubSshKeysResponseSchema = z42.object({
|
|
2514
|
+
synced_count: z42.number().int(),
|
|
2515
|
+
keys_added: z42.number().int(),
|
|
2516
|
+
keys_updated: z42.number().int(),
|
|
2517
|
+
keys_removed: z42.number().int(),
|
|
2518
|
+
errors: z42.array(z42.string()).default([])
|
|
2519
|
+
});
|
|
2520
|
+
var { action: syncGithubSshKeys, safeAction: safeSyncGithubSshKeys } = defineSimpleAction(
|
|
2521
|
+
SyncGithubSshKeysResponseSchema,
|
|
2522
|
+
async (client) => {
|
|
2523
|
+
return await client.post("/user/ssh-keys/github-sync", {});
|
|
2524
|
+
}
|
|
2525
|
+
);
|
|
2526
|
+
|
|
2527
|
+
// src/actions/os_images/get_os_images.ts
|
|
2528
|
+
import { z as z43 } from "zod";
|
|
2529
|
+
var OSImagePublicSchema = z43.object({
|
|
2530
|
+
name: z43.string(),
|
|
2531
|
+
slug: z43.string(),
|
|
2532
|
+
version: z43.string(),
|
|
2533
|
+
os_image_hash: z43.string().nullable(),
|
|
2534
|
+
is_dev: z43.boolean(),
|
|
2535
|
+
requires_gpu: z43.boolean()
|
|
2536
|
+
}).passthrough();
|
|
2537
|
+
var GetOsImagesRequestSchema = z43.object({
|
|
2538
|
+
page: z43.number().int().min(1).optional(),
|
|
2539
|
+
page_size: z43.number().int().min(1).optional(),
|
|
2540
|
+
is_dev: z43.boolean().optional()
|
|
2541
|
+
}).strict();
|
|
2542
|
+
var GetOsImagesResponseSchema = z43.object({
|
|
2543
|
+
items: z43.array(OSImagePublicSchema),
|
|
2544
|
+
total: z43.number(),
|
|
2545
|
+
page: z43.number(),
|
|
2546
|
+
page_size: z43.number(),
|
|
2547
|
+
pages: z43.number()
|
|
2548
|
+
}).passthrough();
|
|
2549
|
+
var { action: getOsImages, safeAction: safeGetOsImages } = defineAction(GetOsImagesResponseSchema, async (client, request) => {
|
|
2550
|
+
const validatedRequest = GetOsImagesRequestSchema.parse(request ?? {});
|
|
2551
|
+
return await client.get("/os-images", { params: validatedRequest });
|
|
2552
|
+
});
|
|
2553
|
+
|
|
2554
|
+
// src/actions/kms/get_kms_onchain_detail.ts
|
|
2555
|
+
import { z as z44 } from "zod";
|
|
2556
|
+
var OnChainDeviceSchema = z44.object({
|
|
2557
|
+
device_id: z44.string(),
|
|
2558
|
+
node_name: z44.string().nullable().optional(),
|
|
2559
|
+
on_chain_allowed: z44.boolean().nullable()
|
|
2560
|
+
}).passthrough();
|
|
2561
|
+
var OnChainOsImageSchema = z44.object({
|
|
2562
|
+
name: z44.string(),
|
|
2563
|
+
version: z44.string(),
|
|
2564
|
+
os_image_hash: z44.string().nullable(),
|
|
2565
|
+
on_chain_allowed: z44.boolean().nullable()
|
|
2566
|
+
}).passthrough();
|
|
2567
|
+
var OnChainKmsContractSchema = z44.object({
|
|
2568
|
+
contract_address: z44.string(),
|
|
2569
|
+
chain_id: z44.number(),
|
|
2570
|
+
chain_name: z44.string(),
|
|
2571
|
+
devices: z44.array(OnChainDeviceSchema),
|
|
2572
|
+
os_images: z44.array(OnChainOsImageSchema)
|
|
2573
|
+
}).passthrough();
|
|
2574
|
+
var GetKmsOnChainDetailResponseSchema = z44.object({
|
|
2575
|
+
chain_name: z44.string(),
|
|
2576
|
+
chain_id: z44.number(),
|
|
2577
|
+
contracts: z44.array(OnChainKmsContractSchema)
|
|
2578
|
+
}).passthrough();
|
|
2579
|
+
var GetKmsOnChainDetailRequestSchema = z44.object({
|
|
2580
|
+
chain: z44.string()
|
|
2581
|
+
}).strict();
|
|
2582
|
+
var { action: getKmsOnChainDetail, safeAction: safeGetKmsOnChainDetail } = defineAction(GetKmsOnChainDetailResponseSchema, async (client, request) => {
|
|
2583
|
+
const { chain } = GetKmsOnChainDetailRequestSchema.parse(request);
|
|
2584
|
+
return await client.get(`/kms/on-chain/${chain}`);
|
|
2585
|
+
});
|
|
2586
|
+
|
|
2427
2587
|
// src/create-client.ts
|
|
2428
2588
|
function createClient2(config = {}) {
|
|
2429
2589
|
const client = createClient(config);
|
|
@@ -2499,167 +2659,181 @@ function createClient2(config = {}) {
|
|
|
2499
2659
|
nextAppIds,
|
|
2500
2660
|
safeNextAppIds,
|
|
2501
2661
|
getCvmState,
|
|
2502
|
-
safeGetCvmState
|
|
2662
|
+
safeGetCvmState,
|
|
2663
|
+
listSshKeys,
|
|
2664
|
+
safeListSshKeys,
|
|
2665
|
+
importGithubProfileSshKeys,
|
|
2666
|
+
safeImportGithubProfileSshKeys,
|
|
2667
|
+
createSshKey,
|
|
2668
|
+
safeCreateSshKey,
|
|
2669
|
+
deleteSshKey,
|
|
2670
|
+
safeDeleteSshKey,
|
|
2671
|
+
syncGithubSshKeys,
|
|
2672
|
+
safeSyncGithubSshKeys,
|
|
2673
|
+
getOsImages,
|
|
2674
|
+
safeGetOsImages,
|
|
2675
|
+
getKmsOnChainDetail,
|
|
2676
|
+
safeGetKmsOnChainDetail
|
|
2503
2677
|
};
|
|
2504
2678
|
return client.extend(allActions);
|
|
2505
2679
|
}
|
|
2506
2680
|
|
|
2507
2681
|
// src/types/app_info_v20251028.ts
|
|
2508
|
-
import { z as
|
|
2509
|
-
var CvmBasicInfoV20251028Schema =
|
|
2510
|
-
vm_uuid:
|
|
2511
|
-
app_id:
|
|
2512
|
-
name:
|
|
2513
|
-
status:
|
|
2514
|
-
vcpu:
|
|
2515
|
-
memory:
|
|
2516
|
-
disk_size:
|
|
2517
|
-
teepod_id:
|
|
2518
|
-
teepod_name:
|
|
2519
|
-
region_identifier:
|
|
2520
|
-
kms_type:
|
|
2521
|
-
instance_type:
|
|
2522
|
-
listed:
|
|
2523
|
-
base_image:
|
|
2524
|
-
kms_slug:
|
|
2525
|
-
kms_id:
|
|
2526
|
-
instance_id:
|
|
2682
|
+
import { z as z45 } from "zod";
|
|
2683
|
+
var CvmBasicInfoV20251028Schema = z45.object({
|
|
2684
|
+
vm_uuid: z45.string().nullable(),
|
|
2685
|
+
app_id: z45.string(),
|
|
2686
|
+
name: z45.string().default(""),
|
|
2687
|
+
status: z45.string(),
|
|
2688
|
+
vcpu: z45.number().int(),
|
|
2689
|
+
memory: z45.number().int(),
|
|
2690
|
+
disk_size: z45.number().int(),
|
|
2691
|
+
teepod_id: z45.number().int(),
|
|
2692
|
+
teepod_name: z45.string(),
|
|
2693
|
+
region_identifier: z45.string().nullable().optional(),
|
|
2694
|
+
kms_type: z45.string().nullable().optional(),
|
|
2695
|
+
instance_type: z45.string().nullable().optional(),
|
|
2696
|
+
listed: z45.boolean().nullable().optional(),
|
|
2697
|
+
base_image: z45.string().nullable().optional(),
|
|
2698
|
+
kms_slug: z45.string().nullable().optional(),
|
|
2699
|
+
kms_id: z45.string().nullable().optional(),
|
|
2700
|
+
instance_id: z45.string().nullable().optional(),
|
|
2527
2701
|
machine_info: MachineInfoV20251028Schema.nullable().optional(),
|
|
2528
|
-
updated_at:
|
|
2702
|
+
updated_at: z45.string().nullable().optional()
|
|
2529
2703
|
});
|
|
2530
|
-
var AppProfileSchema =
|
|
2531
|
-
display_name:
|
|
2532
|
-
avatar_url:
|
|
2533
|
-
description:
|
|
2534
|
-
custom_domain:
|
|
2704
|
+
var AppProfileSchema = z45.object({
|
|
2705
|
+
display_name: z45.string().nullable().optional(),
|
|
2706
|
+
avatar_url: z45.string().nullable().optional(),
|
|
2707
|
+
description: z45.string().nullable().optional(),
|
|
2708
|
+
custom_domain: z45.string().nullable().optional()
|
|
2535
2709
|
});
|
|
2536
|
-
var DstackAppFullResponseV20251028Schema =
|
|
2537
|
-
id:
|
|
2538
|
-
name:
|
|
2539
|
-
app_id:
|
|
2540
|
-
app_provision_type:
|
|
2541
|
-
app_icon_url:
|
|
2542
|
-
created_at:
|
|
2543
|
-
kms_type:
|
|
2710
|
+
var DstackAppFullResponseV20251028Schema = z45.object({
|
|
2711
|
+
id: z45.string(),
|
|
2712
|
+
name: z45.string(),
|
|
2713
|
+
app_id: z45.string(),
|
|
2714
|
+
app_provision_type: z45.string().nullable().optional(),
|
|
2715
|
+
app_icon_url: z45.string().nullable().optional(),
|
|
2716
|
+
created_at: z45.string(),
|
|
2717
|
+
kms_type: z45.string(),
|
|
2544
2718
|
profile: AppProfileSchema.nullable().optional(),
|
|
2545
2719
|
current_cvm: CvmBasicInfoV20251028Schema.nullable().optional(),
|
|
2546
|
-
cvms:
|
|
2547
|
-
cvm_count:
|
|
2720
|
+
cvms: z45.array(CvmBasicInfoV20251028Schema).default([]),
|
|
2721
|
+
cvm_count: z45.number().int().default(0)
|
|
2548
2722
|
});
|
|
2549
|
-
var DstackAppMinimalResponseV20251028Schema =
|
|
2550
|
-
id:
|
|
2551
|
-
app_id:
|
|
2552
|
-
name:
|
|
2553
|
-
app_provision_type:
|
|
2554
|
-
app_icon_url:
|
|
2555
|
-
created_at:
|
|
2556
|
-
kms_type:
|
|
2557
|
-
current_cvm:
|
|
2558
|
-
cvms:
|
|
2559
|
-
cvm_count:
|
|
2723
|
+
var DstackAppMinimalResponseV20251028Schema = z45.object({
|
|
2724
|
+
id: z45.null().optional(),
|
|
2725
|
+
app_id: z45.string(),
|
|
2726
|
+
name: z45.null().optional(),
|
|
2727
|
+
app_provision_type: z45.null().optional(),
|
|
2728
|
+
app_icon_url: z45.null().optional(),
|
|
2729
|
+
created_at: z45.null().optional(),
|
|
2730
|
+
kms_type: z45.null().optional(),
|
|
2731
|
+
current_cvm: z45.null().optional(),
|
|
2732
|
+
cvms: z45.null().optional(),
|
|
2733
|
+
cvm_count: z45.null().optional()
|
|
2560
2734
|
});
|
|
2561
|
-
var DstackAppWithCvmResponseV20251028Schema =
|
|
2735
|
+
var DstackAppWithCvmResponseV20251028Schema = z45.union([
|
|
2562
2736
|
DstackAppFullResponseV20251028Schema,
|
|
2563
2737
|
DstackAppMinimalResponseV20251028Schema
|
|
2564
2738
|
]);
|
|
2565
|
-
var DstackAppListResponseV20251028Schema =
|
|
2566
|
-
dstack_apps:
|
|
2567
|
-
page:
|
|
2568
|
-
page_size:
|
|
2569
|
-
total:
|
|
2570
|
-
total_pages:
|
|
2739
|
+
var DstackAppListResponseV20251028Schema = z45.object({
|
|
2740
|
+
dstack_apps: z45.array(DstackAppWithCvmResponseV20251028Schema),
|
|
2741
|
+
page: z45.number().int(),
|
|
2742
|
+
page_size: z45.number().int(),
|
|
2743
|
+
total: z45.number().int(),
|
|
2744
|
+
total_pages: z45.number().int()
|
|
2571
2745
|
});
|
|
2572
2746
|
|
|
2573
2747
|
// src/types/app_info_v20260121.ts
|
|
2574
|
-
import { z as
|
|
2575
|
-
var DstackAppFullResponseV20260121Schema =
|
|
2576
|
-
id:
|
|
2577
|
-
name:
|
|
2578
|
-
app_id:
|
|
2579
|
-
app_provision_type:
|
|
2580
|
-
app_icon_url:
|
|
2581
|
-
created_at:
|
|
2582
|
-
kms_type:
|
|
2583
|
-
profile:
|
|
2584
|
-
display_name:
|
|
2585
|
-
avatar_url:
|
|
2586
|
-
description:
|
|
2587
|
-
custom_domain:
|
|
2748
|
+
import { z as z46 } from "zod";
|
|
2749
|
+
var DstackAppFullResponseV20260121Schema = z46.object({
|
|
2750
|
+
id: z46.string(),
|
|
2751
|
+
name: z46.string(),
|
|
2752
|
+
app_id: z46.string(),
|
|
2753
|
+
app_provision_type: z46.string().nullable().optional(),
|
|
2754
|
+
app_icon_url: z46.string().nullable().optional(),
|
|
2755
|
+
created_at: z46.string(),
|
|
2756
|
+
kms_type: z46.string(),
|
|
2757
|
+
profile: z46.object({
|
|
2758
|
+
display_name: z46.string().nullable().optional(),
|
|
2759
|
+
avatar_url: z46.string().nullable().optional(),
|
|
2760
|
+
description: z46.string().nullable().optional(),
|
|
2761
|
+
custom_domain: z46.string().nullable().optional()
|
|
2588
2762
|
}).nullable().optional(),
|
|
2589
2763
|
current_cvm: CvmInfoV20260121Schema.nullable().optional(),
|
|
2590
|
-
cvms:
|
|
2591
|
-
cvm_count:
|
|
2764
|
+
cvms: z46.array(CvmInfoV20260121Schema).default([]),
|
|
2765
|
+
cvm_count: z46.number().int().default(0)
|
|
2592
2766
|
});
|
|
2593
|
-
var DstackAppMinimalResponseV20260121Schema =
|
|
2594
|
-
id:
|
|
2595
|
-
app_id:
|
|
2596
|
-
name:
|
|
2597
|
-
app_provision_type:
|
|
2598
|
-
app_icon_url:
|
|
2599
|
-
created_at:
|
|
2600
|
-
kms_type:
|
|
2601
|
-
current_cvm:
|
|
2602
|
-
cvms:
|
|
2603
|
-
cvm_count:
|
|
2767
|
+
var DstackAppMinimalResponseV20260121Schema = z46.object({
|
|
2768
|
+
id: z46.null().optional(),
|
|
2769
|
+
app_id: z46.string(),
|
|
2770
|
+
name: z46.null().optional(),
|
|
2771
|
+
app_provision_type: z46.null().optional(),
|
|
2772
|
+
app_icon_url: z46.null().optional(),
|
|
2773
|
+
created_at: z46.null().optional(),
|
|
2774
|
+
kms_type: z46.null().optional(),
|
|
2775
|
+
current_cvm: z46.null().optional(),
|
|
2776
|
+
cvms: z46.null().optional(),
|
|
2777
|
+
cvm_count: z46.null().optional()
|
|
2604
2778
|
});
|
|
2605
|
-
var DstackAppWithCvmResponseV20260121Schema =
|
|
2779
|
+
var DstackAppWithCvmResponseV20260121Schema = z46.union([
|
|
2606
2780
|
DstackAppFullResponseV20260121Schema,
|
|
2607
2781
|
DstackAppMinimalResponseV20260121Schema
|
|
2608
2782
|
]);
|
|
2609
|
-
var DstackAppListResponseV20260121Schema =
|
|
2610
|
-
dstack_apps:
|
|
2611
|
-
page:
|
|
2612
|
-
page_size:
|
|
2613
|
-
total:
|
|
2614
|
-
total_pages:
|
|
2783
|
+
var DstackAppListResponseV20260121Schema = z46.object({
|
|
2784
|
+
dstack_apps: z46.array(DstackAppWithCvmResponseV20260121Schema),
|
|
2785
|
+
page: z46.number().int(),
|
|
2786
|
+
page_size: z46.number().int(),
|
|
2787
|
+
total: z46.number().int(),
|
|
2788
|
+
total_pages: z46.number().int()
|
|
2615
2789
|
});
|
|
2616
2790
|
|
|
2617
2791
|
// src/types/app_revision.ts
|
|
2618
|
-
import { z as
|
|
2619
|
-
var CvmRefSchema =
|
|
2620
|
-
object_type:
|
|
2621
|
-
id:
|
|
2622
|
-
name:
|
|
2623
|
-
app_id:
|
|
2624
|
-
vm_uuid:
|
|
2792
|
+
import { z as z47 } from "zod";
|
|
2793
|
+
var CvmRefSchema = z47.object({
|
|
2794
|
+
object_type: z47.literal("cvm"),
|
|
2795
|
+
id: z47.string().nullable().optional(),
|
|
2796
|
+
name: z47.string().nullable().optional(),
|
|
2797
|
+
app_id: z47.string().nullable().optional(),
|
|
2798
|
+
vm_uuid: z47.string().nullable().optional()
|
|
2625
2799
|
});
|
|
2626
|
-
var AppRevisionResponseSchema =
|
|
2627
|
-
revision_id:
|
|
2628
|
-
app_id:
|
|
2629
|
-
vm_uuid:
|
|
2630
|
-
compose_hash:
|
|
2631
|
-
created_at:
|
|
2632
|
-
trace_id:
|
|
2633
|
-
operation_type:
|
|
2800
|
+
var AppRevisionResponseSchema = z47.object({
|
|
2801
|
+
revision_id: z47.string(),
|
|
2802
|
+
app_id: z47.string(),
|
|
2803
|
+
vm_uuid: z47.string(),
|
|
2804
|
+
compose_hash: z47.string(),
|
|
2805
|
+
created_at: z47.string(),
|
|
2806
|
+
trace_id: z47.string().nullable().optional(),
|
|
2807
|
+
operation_type: z47.string(),
|
|
2634
2808
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
2635
2809
|
cvm: CvmRefSchema.nullable().optional(),
|
|
2636
2810
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2637
2811
|
});
|
|
2638
|
-
var AppRevisionDetailResponseSchema =
|
|
2639
|
-
revision_id:
|
|
2640
|
-
app_id:
|
|
2641
|
-
vm_uuid:
|
|
2642
|
-
compose_hash:
|
|
2643
|
-
compose_file:
|
|
2644
|
-
encrypted_env:
|
|
2645
|
-
user_config:
|
|
2646
|
-
created_at:
|
|
2647
|
-
trace_id:
|
|
2648
|
-
operation_type:
|
|
2812
|
+
var AppRevisionDetailResponseSchema = z47.object({
|
|
2813
|
+
revision_id: z47.string(),
|
|
2814
|
+
app_id: z47.string(),
|
|
2815
|
+
vm_uuid: z47.string(),
|
|
2816
|
+
compose_hash: z47.string(),
|
|
2817
|
+
compose_file: z47.union([z47.record(z47.any()), z47.string()]).nullable().optional(),
|
|
2818
|
+
encrypted_env: z47.string(),
|
|
2819
|
+
user_config: z47.string(),
|
|
2820
|
+
created_at: z47.string(),
|
|
2821
|
+
trace_id: z47.string().nullable().optional(),
|
|
2822
|
+
operation_type: z47.string(),
|
|
2649
2823
|
triggered_by: UserRefSchema.nullable().optional(),
|
|
2650
2824
|
cvm: CvmRefSchema.nullable().optional(),
|
|
2651
2825
|
workspace: WorkspaceRefSchema.nullable().optional()
|
|
2652
2826
|
});
|
|
2653
|
-
var AppRevisionsResponseSchema =
|
|
2654
|
-
revisions:
|
|
2655
|
-
total:
|
|
2656
|
-
page:
|
|
2657
|
-
page_size:
|
|
2658
|
-
total_pages:
|
|
2827
|
+
var AppRevisionsResponseSchema = z47.object({
|
|
2828
|
+
revisions: z47.array(AppRevisionResponseSchema),
|
|
2829
|
+
total: z47.number().int(),
|
|
2830
|
+
page: z47.number().int(),
|
|
2831
|
+
page_size: z47.number().int(),
|
|
2832
|
+
total_pages: z47.number().int()
|
|
2659
2833
|
});
|
|
2660
2834
|
|
|
2661
2835
|
// src/actions/blockchains/deploy_app_auth.ts
|
|
2662
|
-
import { z as
|
|
2836
|
+
import { z as z48 } from "zod";
|
|
2663
2837
|
import {
|
|
2664
2838
|
createPublicClient as createPublicClient2,
|
|
2665
2839
|
createWalletClient as createWalletClient2,
|
|
@@ -3320,25 +3494,25 @@ var kmsAuthAbi = [
|
|
|
3320
3494
|
anonymous: false
|
|
3321
3495
|
}
|
|
3322
3496
|
];
|
|
3323
|
-
var DeployAppAuthRequestBaseSchema =
|
|
3497
|
+
var DeployAppAuthRequestBaseSchema = z48.object({
|
|
3324
3498
|
// Chain configuration (conditionally required)
|
|
3325
|
-
chain:
|
|
3326
|
-
rpcUrl:
|
|
3499
|
+
chain: z48.unknown().optional(),
|
|
3500
|
+
rpcUrl: z48.string().optional(),
|
|
3327
3501
|
// Contract configuration (required)
|
|
3328
|
-
kmsContractAddress:
|
|
3502
|
+
kmsContractAddress: z48.string(),
|
|
3329
3503
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
3330
|
-
privateKey:
|
|
3331
|
-
walletClient:
|
|
3504
|
+
privateKey: z48.string().optional(),
|
|
3505
|
+
walletClient: z48.unknown().optional(),
|
|
3332
3506
|
// Public client (optional, will create default if not provided)
|
|
3333
|
-
publicClient:
|
|
3507
|
+
publicClient: z48.unknown().optional(),
|
|
3334
3508
|
// App configuration (optional)
|
|
3335
|
-
allowAnyDevice:
|
|
3336
|
-
deviceId:
|
|
3337
|
-
composeHash:
|
|
3338
|
-
disableUpgrades:
|
|
3509
|
+
allowAnyDevice: z48.boolean().optional().default(false),
|
|
3510
|
+
deviceId: z48.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
3511
|
+
composeHash: z48.string().optional().default("0000000000000000000000000000000000000000000000000000000000000000"),
|
|
3512
|
+
disableUpgrades: z48.boolean().optional().default(false),
|
|
3339
3513
|
// Validation configuration (optional)
|
|
3340
|
-
skipPrerequisiteChecks:
|
|
3341
|
-
minBalance:
|
|
3514
|
+
skipPrerequisiteChecks: z48.boolean().optional().default(false),
|
|
3515
|
+
minBalance: z48.string().optional()
|
|
3342
3516
|
// ETH amount as string, e.g., "0.01"
|
|
3343
3517
|
}).passthrough();
|
|
3344
3518
|
var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
@@ -3366,13 +3540,13 @@ var DeployAppAuthRequestSchema = DeployAppAuthRequestBaseSchema.refine(
|
|
|
3366
3540
|
path: ["chain"]
|
|
3367
3541
|
}
|
|
3368
3542
|
);
|
|
3369
|
-
var DeployAppAuthSchema =
|
|
3370
|
-
appId:
|
|
3371
|
-
appAuthAddress:
|
|
3372
|
-
deployer:
|
|
3373
|
-
transactionHash:
|
|
3374
|
-
blockNumber:
|
|
3375
|
-
gasUsed:
|
|
3543
|
+
var DeployAppAuthSchema = z48.object({
|
|
3544
|
+
appId: z48.string(),
|
|
3545
|
+
appAuthAddress: z48.string(),
|
|
3546
|
+
deployer: z48.string(),
|
|
3547
|
+
transactionHash: z48.string(),
|
|
3548
|
+
blockNumber: z48.bigint().optional(),
|
|
3549
|
+
gasUsed: z48.bigint().optional()
|
|
3376
3550
|
}).passthrough();
|
|
3377
3551
|
function parseDeploymentResult(receipt, deployer, kmsContractAddress) {
|
|
3378
3552
|
try {
|
|
@@ -3618,7 +3792,7 @@ async function safeDeployAppAuth(request, parameters) {
|
|
|
3618
3792
|
}
|
|
3619
3793
|
|
|
3620
3794
|
// src/actions/blockchains/add_compose_hash.ts
|
|
3621
|
-
import { z as
|
|
3795
|
+
import { z as z49 } from "zod";
|
|
3622
3796
|
import {
|
|
3623
3797
|
createPublicClient as createPublicClient3,
|
|
3624
3798
|
createWalletClient as createWalletClient3,
|
|
@@ -3642,29 +3816,29 @@ var appAuthAbi = [
|
|
|
3642
3816
|
anonymous: false
|
|
3643
3817
|
}
|
|
3644
3818
|
];
|
|
3645
|
-
var AddComposeHashRequestSchema =
|
|
3819
|
+
var AddComposeHashRequestSchema = z49.object({
|
|
3646
3820
|
// Chain configuration (conditionally required)
|
|
3647
|
-
chain:
|
|
3648
|
-
rpcUrl:
|
|
3649
|
-
appId:
|
|
3650
|
-
composeHash:
|
|
3821
|
+
chain: z49.unknown().optional(),
|
|
3822
|
+
rpcUrl: z49.string().optional(),
|
|
3823
|
+
appId: z49.string(),
|
|
3824
|
+
composeHash: z49.string(),
|
|
3651
3825
|
// Authentication mode: either privateKey OR walletClient (required, mutually exclusive)
|
|
3652
|
-
privateKey:
|
|
3653
|
-
walletClient:
|
|
3826
|
+
privateKey: z49.string().optional(),
|
|
3827
|
+
walletClient: z49.unknown().optional(),
|
|
3654
3828
|
// Public client (optional, will create default if not provided)
|
|
3655
|
-
publicClient:
|
|
3829
|
+
publicClient: z49.unknown().optional(),
|
|
3656
3830
|
// Validation configuration (optional)
|
|
3657
|
-
skipPrerequisiteChecks:
|
|
3658
|
-
minBalance:
|
|
3831
|
+
skipPrerequisiteChecks: z49.boolean().optional().default(false),
|
|
3832
|
+
minBalance: z49.string().optional(),
|
|
3659
3833
|
// ETH amount as string, e.g., "0.01"
|
|
3660
3834
|
// Transaction control options
|
|
3661
|
-
timeout:
|
|
3662
|
-
retryOptions:
|
|
3663
|
-
signal:
|
|
3835
|
+
timeout: z49.number().optional().default(12e4),
|
|
3836
|
+
retryOptions: z49.unknown().optional(),
|
|
3837
|
+
signal: z49.unknown().optional(),
|
|
3664
3838
|
// Progress callbacks
|
|
3665
|
-
onTransactionStateChange:
|
|
3666
|
-
onTransactionSubmitted:
|
|
3667
|
-
onTransactionConfirmed:
|
|
3839
|
+
onTransactionStateChange: z49.function().optional(),
|
|
3840
|
+
onTransactionSubmitted: z49.function().optional(),
|
|
3841
|
+
onTransactionConfirmed: z49.function().optional()
|
|
3668
3842
|
}).passthrough().refine(
|
|
3669
3843
|
(data) => {
|
|
3670
3844
|
const hasPrivateKey = !!data.privateKey;
|
|
@@ -3688,12 +3862,12 @@ var AddComposeHashRequestSchema = z42.object({
|
|
|
3688
3862
|
path: ["chain"]
|
|
3689
3863
|
}
|
|
3690
3864
|
);
|
|
3691
|
-
var AddComposeHashSchema =
|
|
3692
|
-
composeHash:
|
|
3693
|
-
appId:
|
|
3694
|
-
transactionHash:
|
|
3695
|
-
blockNumber:
|
|
3696
|
-
gasUsed:
|
|
3865
|
+
var AddComposeHashSchema = z49.object({
|
|
3866
|
+
composeHash: z49.string(),
|
|
3867
|
+
appId: z49.string(),
|
|
3868
|
+
transactionHash: z49.string(),
|
|
3869
|
+
blockNumber: z49.bigint().optional(),
|
|
3870
|
+
gasUsed: z49.bigint().optional()
|
|
3697
3871
|
}).passthrough();
|
|
3698
3872
|
function parseComposeHashResult(receipt, composeHash, appAuthAddress, appId) {
|
|
3699
3873
|
console.log(receipt.logs);
|
|
@@ -3884,113 +4058,832 @@ async function safeAddComposeHash(request, parameters) {
|
|
|
3884
4058
|
}
|
|
3885
4059
|
}
|
|
3886
4060
|
|
|
3887
|
-
// src/actions/
|
|
3888
|
-
import { z as
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
pages: z43.number()
|
|
3897
|
-
}).passthrough();
|
|
3898
|
-
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
3899
|
-
const { teamSlug, page, pageSize } = request;
|
|
3900
|
-
const queryParams = new URLSearchParams();
|
|
3901
|
-
if (page !== void 0) queryParams.append("page", page.toString());
|
|
3902
|
-
if (pageSize !== void 0) queryParams.append("page_size", pageSize.toString());
|
|
3903
|
-
const url = queryParams.toString() ? `/workspaces/${teamSlug}/nodes?${queryParams.toString()}` : `/workspaces/${teamSlug}/nodes`;
|
|
3904
|
-
return await client.get(url);
|
|
3905
|
-
});
|
|
4061
|
+
// src/actions/blockchains/add_device.ts
|
|
4062
|
+
import { z as z50 } from "zod";
|
|
4063
|
+
import {
|
|
4064
|
+
createPublicClient as createPublicClient4,
|
|
4065
|
+
createWalletClient as createWalletClient4,
|
|
4066
|
+
http as http4,
|
|
4067
|
+
parseEther as parseEther3
|
|
4068
|
+
} from "viem";
|
|
4069
|
+
import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
|
|
3906
4070
|
|
|
3907
|
-
// src/actions/
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
}
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
}
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
4071
|
+
// src/actions/blockchains/abi/dstack_app.ts
|
|
4072
|
+
var dstackAppAbi = [
|
|
4073
|
+
// ── Write functions ──────────────────────────────────────────────
|
|
4074
|
+
{
|
|
4075
|
+
inputs: [{ internalType: "bytes32", name: "deviceId", type: "bytes32" }],
|
|
4076
|
+
name: "addDevice",
|
|
4077
|
+
outputs: [],
|
|
4078
|
+
stateMutability: "nonpayable",
|
|
4079
|
+
type: "function"
|
|
4080
|
+
},
|
|
4081
|
+
{
|
|
4082
|
+
inputs: [{ internalType: "bytes32", name: "deviceId", type: "bytes32" }],
|
|
4083
|
+
name: "removeDevice",
|
|
4084
|
+
outputs: [],
|
|
4085
|
+
stateMutability: "nonpayable",
|
|
4086
|
+
type: "function"
|
|
4087
|
+
},
|
|
4088
|
+
{
|
|
4089
|
+
inputs: [{ internalType: "bool", name: "_allowAnyDevice", type: "bool" }],
|
|
4090
|
+
name: "setAllowAnyDevice",
|
|
4091
|
+
outputs: [],
|
|
4092
|
+
stateMutability: "nonpayable",
|
|
4093
|
+
type: "function"
|
|
4094
|
+
},
|
|
4095
|
+
// ── Read functions ───────────────────────────────────────────────
|
|
4096
|
+
{
|
|
4097
|
+
inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
4098
|
+
name: "allowedDeviceIds",
|
|
4099
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
4100
|
+
stateMutability: "view",
|
|
4101
|
+
type: "function"
|
|
4102
|
+
},
|
|
4103
|
+
{
|
|
4104
|
+
inputs: [],
|
|
4105
|
+
name: "allowAnyDevice",
|
|
4106
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
4107
|
+
stateMutability: "view",
|
|
4108
|
+
type: "function"
|
|
4109
|
+
},
|
|
4110
|
+
{
|
|
4111
|
+
inputs: [],
|
|
4112
|
+
name: "owner",
|
|
4113
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
4114
|
+
stateMutability: "view",
|
|
4115
|
+
type: "function"
|
|
4116
|
+
},
|
|
4117
|
+
// ── Events ───────────────────────────────────────────────────────
|
|
4118
|
+
{
|
|
4119
|
+
anonymous: false,
|
|
4120
|
+
inputs: [{ indexed: false, internalType: "bytes32", name: "deviceId", type: "bytes32" }],
|
|
4121
|
+
name: "DeviceAdded",
|
|
4122
|
+
type: "event"
|
|
4123
|
+
},
|
|
4124
|
+
{
|
|
4125
|
+
anonymous: false,
|
|
4126
|
+
inputs: [{ indexed: false, internalType: "bytes32", name: "deviceId", type: "bytes32" }],
|
|
4127
|
+
name: "DeviceRemoved",
|
|
4128
|
+
type: "event"
|
|
4129
|
+
},
|
|
4130
|
+
{
|
|
4131
|
+
anonymous: false,
|
|
4132
|
+
inputs: [{ indexed: false, internalType: "bool", name: "allowAny", type: "bool" }],
|
|
4133
|
+
name: "AllowAnyDeviceSet",
|
|
4134
|
+
type: "event"
|
|
4135
|
+
}
|
|
4136
|
+
];
|
|
3935
4137
|
|
|
3936
|
-
// src/actions/
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4138
|
+
// src/actions/blockchains/add_device.ts
|
|
4139
|
+
var AddDeviceRequestSchema = z50.object({
|
|
4140
|
+
chain: z50.unknown().optional(),
|
|
4141
|
+
rpcUrl: z50.string().optional(),
|
|
4142
|
+
appAddress: z50.string(),
|
|
4143
|
+
deviceId: z50.string(),
|
|
4144
|
+
privateKey: z50.string().optional(),
|
|
4145
|
+
walletClient: z50.unknown().optional(),
|
|
4146
|
+
publicClient: z50.unknown().optional(),
|
|
4147
|
+
skipPrerequisiteChecks: z50.boolean().optional().default(false),
|
|
4148
|
+
minBalance: z50.string().optional(),
|
|
4149
|
+
timeout: z50.number().optional().default(12e4),
|
|
4150
|
+
retryOptions: z50.unknown().optional(),
|
|
4151
|
+
signal: z50.unknown().optional(),
|
|
4152
|
+
onTransactionStateChange: z50.function().optional(),
|
|
4153
|
+
onTransactionSubmitted: z50.function().optional(),
|
|
4154
|
+
onTransactionConfirmed: z50.function().optional()
|
|
4155
|
+
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4156
|
+
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4157
|
+
path: ["privateKey", "walletClient"]
|
|
4158
|
+
}).refine(
|
|
4159
|
+
(data) => {
|
|
4160
|
+
if (!!data.publicClient && !!data.walletClient) return true;
|
|
4161
|
+
return !!data.chain;
|
|
4162
|
+
},
|
|
4163
|
+
{
|
|
4164
|
+
message: "Chain is required when publicClient or walletClient is not provided",
|
|
4165
|
+
path: ["chain"]
|
|
3950
4166
|
}
|
|
3951
|
-
|
|
3952
|
-
var
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
4167
|
+
);
|
|
4168
|
+
var AddDeviceSchema = z50.object({
|
|
4169
|
+
appAddress: z50.string(),
|
|
4170
|
+
deviceId: z50.string(),
|
|
4171
|
+
transactionHash: z50.string(),
|
|
4172
|
+
blockNumber: z50.bigint().optional(),
|
|
4173
|
+
gasUsed: z50.bigint().optional()
|
|
4174
|
+
}).passthrough();
|
|
4175
|
+
async function addDevice(request, parameters) {
|
|
4176
|
+
const validatedRequest = AddDeviceRequestSchema.parse(request);
|
|
4177
|
+
const {
|
|
4178
|
+
chain,
|
|
4179
|
+
rpcUrl,
|
|
4180
|
+
appAddress,
|
|
4181
|
+
deviceId,
|
|
4182
|
+
privateKey,
|
|
4183
|
+
walletClient: providedWalletClient,
|
|
4184
|
+
publicClient: providedPublicClient,
|
|
4185
|
+
timeout = 12e4,
|
|
4186
|
+
retryOptions,
|
|
4187
|
+
signal,
|
|
4188
|
+
onTransactionStateChange,
|
|
4189
|
+
onTransactionSubmitted,
|
|
4190
|
+
onTransactionConfirmed,
|
|
4191
|
+
skipPrerequisiteChecks = false,
|
|
4192
|
+
minBalance
|
|
4193
|
+
} = validatedRequest;
|
|
4194
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
4195
|
+
const deviceIdHex = asHex(deviceId);
|
|
4196
|
+
let publicClient;
|
|
4197
|
+
let walletClient;
|
|
4198
|
+
let address;
|
|
4199
|
+
let chainId;
|
|
4200
|
+
if (privateKey) {
|
|
4201
|
+
const account = privateKeyToAccount4(privateKey);
|
|
4202
|
+
publicClient = providedPublicClient ? providedPublicClient : createPublicClient4({ chain, transport: http4(rpcUrl) });
|
|
4203
|
+
walletClient = createWalletClient4({
|
|
4204
|
+
account,
|
|
4205
|
+
chain,
|
|
4206
|
+
transport: http4(rpcUrl)
|
|
4207
|
+
});
|
|
4208
|
+
address = account.address;
|
|
4209
|
+
chainId = chain.id;
|
|
4210
|
+
} else if (providedWalletClient) {
|
|
4211
|
+
walletClient = providedWalletClient;
|
|
4212
|
+
publicClient = providedPublicClient ? providedPublicClient : createPublicClient4({ chain, transport: http4(rpcUrl) });
|
|
4213
|
+
if (!walletClient.account?.address) {
|
|
4214
|
+
throw new Error("WalletClient must have an account with address");
|
|
4215
|
+
}
|
|
4216
|
+
address = walletClient.account.address;
|
|
4217
|
+
chainId = chain ? chain.id : await walletClient.getChainId();
|
|
4218
|
+
} else {
|
|
4219
|
+
throw new Error("Either privateKey or walletClient must be provided");
|
|
3957
4220
|
}
|
|
3958
|
-
};
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
const
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
4221
|
+
const networkClients = { publicClient, walletClient, address, chainId };
|
|
4222
|
+
const transactionTracker = createTransactionTracker();
|
|
4223
|
+
if (onTransactionStateChange && typeof onTransactionStateChange === "function") {
|
|
4224
|
+
const pollStatus = () => {
|
|
4225
|
+
onTransactionStateChange(transactionTracker.status);
|
|
4226
|
+
if (!transactionTracker.isComplete) {
|
|
4227
|
+
setTimeout(pollStatus, 100);
|
|
4228
|
+
}
|
|
4229
|
+
};
|
|
4230
|
+
setTimeout(pollStatus, 10);
|
|
3965
4231
|
}
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
4232
|
+
if (!skipPrerequisiteChecks) {
|
|
4233
|
+
const requirements = {
|
|
4234
|
+
targetChainId: chainId,
|
|
4235
|
+
minBalance: minBalance ? parseEther3(minBalance) : parseEther3("0.001")
|
|
4236
|
+
};
|
|
4237
|
+
const validation = await validateNetworkPrerequisites(networkClients, requirements);
|
|
4238
|
+
if (!validation.networkValid) {
|
|
4239
|
+
throw new Error(
|
|
4240
|
+
`Network mismatch: Expected chain ${requirements.targetChainId}, but wallet is on chain ${validation.details.currentChainId}`
|
|
4241
|
+
);
|
|
3975
4242
|
}
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
const
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
target,
|
|
3982
|
-
interval,
|
|
3983
|
-
timeout,
|
|
3984
|
-
signal,
|
|
3985
|
-
onEvent
|
|
4243
|
+
if (!validation.balanceValid) {
|
|
4244
|
+
const requiredEth = Number(requirements.minBalance) / 1e18;
|
|
4245
|
+
const currentEth = Number(validation.details.balance) / 1e18;
|
|
4246
|
+
throw new Error(
|
|
4247
|
+
`Insufficient balance: Required ${requiredEth} ETH, but account has ${currentEth.toFixed(6)} ETH`
|
|
3986
4248
|
);
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
const addDeviceOperation = async (clients) => {
|
|
4252
|
+
return clients.walletClient.writeContract({
|
|
4253
|
+
address: contractAddress,
|
|
4254
|
+
abi: dstackAppAbi,
|
|
4255
|
+
functionName: "addDevice",
|
|
4256
|
+
args: [deviceIdHex],
|
|
4257
|
+
account: clients.walletClient.account || clients.address,
|
|
4258
|
+
chain: chain || null
|
|
4259
|
+
});
|
|
4260
|
+
};
|
|
4261
|
+
const transactionResult = retryOptions ? await executeTransactionWithRetry(
|
|
4262
|
+
addDeviceOperation,
|
|
4263
|
+
networkClients,
|
|
4264
|
+
[],
|
|
4265
|
+
{
|
|
4266
|
+
timeout,
|
|
4267
|
+
confirmations: 1,
|
|
4268
|
+
onSubmitted: onTransactionSubmitted,
|
|
4269
|
+
onConfirmed: onTransactionConfirmed,
|
|
4270
|
+
signal
|
|
4271
|
+
},
|
|
4272
|
+
retryOptions
|
|
4273
|
+
) : await transactionTracker.execute(addDeviceOperation, networkClients, [], {
|
|
4274
|
+
timeout,
|
|
4275
|
+
confirmations: 1,
|
|
4276
|
+
onSubmitted: onTransactionSubmitted,
|
|
4277
|
+
onConfirmed: onTransactionConfirmed,
|
|
4278
|
+
signal
|
|
4279
|
+
});
|
|
4280
|
+
const result = {
|
|
4281
|
+
appAddress: contractAddress,
|
|
4282
|
+
deviceId: deviceIdHex,
|
|
4283
|
+
transactionHash: transactionResult.receipt.transactionHash,
|
|
4284
|
+
blockNumber: transactionResult.receipt.blockNumber,
|
|
4285
|
+
gasUsed: transactionResult.receipt.gasUsed
|
|
4286
|
+
};
|
|
4287
|
+
if (parameters?.schema === false) {
|
|
4288
|
+
return result;
|
|
4289
|
+
}
|
|
4290
|
+
const schema = parameters?.schema || AddDeviceSchema;
|
|
4291
|
+
return schema.parse(result);
|
|
4292
|
+
}
|
|
4293
|
+
async function safeAddDevice(request, parameters) {
|
|
4294
|
+
try {
|
|
4295
|
+
const result = await addDevice(request, parameters);
|
|
4296
|
+
return { success: true, data: result };
|
|
4297
|
+
} catch (error) {
|
|
4298
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
4299
|
+
return {
|
|
4300
|
+
success: false,
|
|
4301
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
4302
|
+
};
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
// src/actions/blockchains/remove_device.ts
|
|
4307
|
+
import { z as z51 } from "zod";
|
|
4308
|
+
import {
|
|
4309
|
+
createPublicClient as createPublicClient5,
|
|
4310
|
+
createWalletClient as createWalletClient5,
|
|
4311
|
+
http as http5,
|
|
4312
|
+
parseEther as parseEther4
|
|
4313
|
+
} from "viem";
|
|
4314
|
+
import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
|
|
4315
|
+
var RemoveDeviceRequestSchema = z51.object({
|
|
4316
|
+
chain: z51.unknown().optional(),
|
|
4317
|
+
rpcUrl: z51.string().optional(),
|
|
4318
|
+
appAddress: z51.string(),
|
|
4319
|
+
deviceId: z51.string(),
|
|
4320
|
+
privateKey: z51.string().optional(),
|
|
4321
|
+
walletClient: z51.unknown().optional(),
|
|
4322
|
+
publicClient: z51.unknown().optional(),
|
|
4323
|
+
skipPrerequisiteChecks: z51.boolean().optional().default(false),
|
|
4324
|
+
minBalance: z51.string().optional(),
|
|
4325
|
+
timeout: z51.number().optional().default(12e4),
|
|
4326
|
+
retryOptions: z51.unknown().optional(),
|
|
4327
|
+
signal: z51.unknown().optional(),
|
|
4328
|
+
onTransactionStateChange: z51.function().optional(),
|
|
4329
|
+
onTransactionSubmitted: z51.function().optional(),
|
|
4330
|
+
onTransactionConfirmed: z51.function().optional()
|
|
4331
|
+
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4332
|
+
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4333
|
+
path: ["privateKey", "walletClient"]
|
|
4334
|
+
}).refine(
|
|
4335
|
+
(data) => {
|
|
4336
|
+
if (!!data.publicClient && !!data.walletClient) return true;
|
|
4337
|
+
return !!data.chain;
|
|
4338
|
+
},
|
|
4339
|
+
{
|
|
4340
|
+
message: "Chain is required when publicClient or walletClient is not provided",
|
|
4341
|
+
path: ["chain"]
|
|
4342
|
+
}
|
|
4343
|
+
);
|
|
4344
|
+
var RemoveDeviceSchema = z51.object({
|
|
4345
|
+
appAddress: z51.string(),
|
|
4346
|
+
deviceId: z51.string(),
|
|
4347
|
+
transactionHash: z51.string(),
|
|
4348
|
+
blockNumber: z51.bigint().optional(),
|
|
4349
|
+
gasUsed: z51.bigint().optional()
|
|
4350
|
+
}).passthrough();
|
|
4351
|
+
async function removeDevice(request, parameters) {
|
|
4352
|
+
const validatedRequest = RemoveDeviceRequestSchema.parse(request);
|
|
4353
|
+
const {
|
|
4354
|
+
chain,
|
|
4355
|
+
rpcUrl,
|
|
4356
|
+
appAddress,
|
|
4357
|
+
deviceId,
|
|
4358
|
+
privateKey,
|
|
4359
|
+
walletClient: providedWalletClient,
|
|
4360
|
+
publicClient: providedPublicClient,
|
|
4361
|
+
timeout = 12e4,
|
|
4362
|
+
retryOptions,
|
|
4363
|
+
signal,
|
|
4364
|
+
onTransactionStateChange,
|
|
4365
|
+
onTransactionSubmitted,
|
|
4366
|
+
onTransactionConfirmed,
|
|
4367
|
+
skipPrerequisiteChecks = false,
|
|
4368
|
+
minBalance
|
|
4369
|
+
} = validatedRequest;
|
|
4370
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
4371
|
+
const deviceIdHex = asHex(deviceId);
|
|
4372
|
+
let publicClient;
|
|
4373
|
+
let walletClient;
|
|
4374
|
+
let address;
|
|
4375
|
+
let chainId;
|
|
4376
|
+
if (privateKey) {
|
|
4377
|
+
const account = privateKeyToAccount5(privateKey);
|
|
4378
|
+
publicClient = providedPublicClient ? providedPublicClient : createPublicClient5({ chain, transport: http5(rpcUrl) });
|
|
4379
|
+
walletClient = createWalletClient5({
|
|
4380
|
+
account,
|
|
4381
|
+
chain,
|
|
4382
|
+
transport: http5(rpcUrl)
|
|
4383
|
+
});
|
|
4384
|
+
address = account.address;
|
|
4385
|
+
chainId = chain.id;
|
|
4386
|
+
} else if (providedWalletClient) {
|
|
4387
|
+
walletClient = providedWalletClient;
|
|
4388
|
+
publicClient = providedPublicClient ? providedPublicClient : createPublicClient5({ chain, transport: http5(rpcUrl) });
|
|
4389
|
+
if (!walletClient.account?.address) {
|
|
4390
|
+
throw new Error("WalletClient must have an account with address");
|
|
4391
|
+
}
|
|
4392
|
+
address = walletClient.account.address;
|
|
4393
|
+
chainId = chain ? chain.id : await walletClient.getChainId();
|
|
4394
|
+
} else {
|
|
4395
|
+
throw new Error("Either privateKey or walletClient must be provided");
|
|
4396
|
+
}
|
|
4397
|
+
const networkClients = { publicClient, walletClient, address, chainId };
|
|
4398
|
+
const transactionTracker = createTransactionTracker();
|
|
4399
|
+
if (onTransactionStateChange && typeof onTransactionStateChange === "function") {
|
|
4400
|
+
const pollStatus = () => {
|
|
4401
|
+
onTransactionStateChange(transactionTracker.status);
|
|
4402
|
+
if (!transactionTracker.isComplete) {
|
|
4403
|
+
setTimeout(pollStatus, 100);
|
|
4404
|
+
}
|
|
4405
|
+
};
|
|
4406
|
+
setTimeout(pollStatus, 10);
|
|
4407
|
+
}
|
|
4408
|
+
if (!skipPrerequisiteChecks) {
|
|
4409
|
+
const requirements = {
|
|
4410
|
+
targetChainId: chainId,
|
|
4411
|
+
minBalance: minBalance ? parseEther4(minBalance) : parseEther4("0.001")
|
|
4412
|
+
};
|
|
4413
|
+
const validation = await validateNetworkPrerequisites(networkClients, requirements);
|
|
4414
|
+
if (!validation.networkValid) {
|
|
4415
|
+
throw new Error(
|
|
4416
|
+
`Network mismatch: Expected chain ${requirements.targetChainId}, but wallet is on chain ${validation.details.currentChainId}`
|
|
4417
|
+
);
|
|
4418
|
+
}
|
|
4419
|
+
if (!validation.balanceValid) {
|
|
4420
|
+
const requiredEth = Number(requirements.minBalance) / 1e18;
|
|
4421
|
+
const currentEth = Number(validation.details.balance) / 1e18;
|
|
4422
|
+
throw new Error(
|
|
4423
|
+
`Insufficient balance: Required ${requiredEth} ETH, but account has ${currentEth.toFixed(6)} ETH`
|
|
4424
|
+
);
|
|
4425
|
+
}
|
|
4426
|
+
}
|
|
4427
|
+
const removeDeviceOperation = async (clients) => {
|
|
4428
|
+
return clients.walletClient.writeContract({
|
|
4429
|
+
address: contractAddress,
|
|
4430
|
+
abi: dstackAppAbi,
|
|
4431
|
+
functionName: "removeDevice",
|
|
4432
|
+
args: [deviceIdHex],
|
|
4433
|
+
account: clients.walletClient.account || clients.address,
|
|
4434
|
+
chain: chain || null
|
|
4435
|
+
});
|
|
4436
|
+
};
|
|
4437
|
+
const transactionResult = retryOptions ? await executeTransactionWithRetry(
|
|
4438
|
+
removeDeviceOperation,
|
|
4439
|
+
networkClients,
|
|
4440
|
+
[],
|
|
4441
|
+
{
|
|
4442
|
+
timeout,
|
|
4443
|
+
confirmations: 1,
|
|
4444
|
+
onSubmitted: onTransactionSubmitted,
|
|
4445
|
+
onConfirmed: onTransactionConfirmed,
|
|
4446
|
+
signal
|
|
4447
|
+
},
|
|
4448
|
+
retryOptions
|
|
4449
|
+
) : await transactionTracker.execute(removeDeviceOperation, networkClients, [], {
|
|
4450
|
+
timeout,
|
|
4451
|
+
confirmations: 1,
|
|
4452
|
+
onSubmitted: onTransactionSubmitted,
|
|
4453
|
+
onConfirmed: onTransactionConfirmed,
|
|
4454
|
+
signal
|
|
4455
|
+
});
|
|
4456
|
+
const result = {
|
|
4457
|
+
appAddress: contractAddress,
|
|
4458
|
+
deviceId: deviceIdHex,
|
|
4459
|
+
transactionHash: transactionResult.receipt.transactionHash,
|
|
4460
|
+
blockNumber: transactionResult.receipt.blockNumber,
|
|
4461
|
+
gasUsed: transactionResult.receipt.gasUsed
|
|
4462
|
+
};
|
|
4463
|
+
if (parameters?.schema === false) {
|
|
4464
|
+
return result;
|
|
4465
|
+
}
|
|
4466
|
+
const schema = parameters?.schema || RemoveDeviceSchema;
|
|
4467
|
+
return schema.parse(result);
|
|
4468
|
+
}
|
|
4469
|
+
async function safeRemoveDevice(request, parameters) {
|
|
4470
|
+
try {
|
|
4471
|
+
const result = await removeDevice(request, parameters);
|
|
4472
|
+
return { success: true, data: result };
|
|
4473
|
+
} catch (error) {
|
|
4474
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
4475
|
+
return {
|
|
4476
|
+
success: false,
|
|
4477
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
4478
|
+
};
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
|
|
4482
|
+
// src/actions/blockchains/set_allow_any_device.ts
|
|
4483
|
+
import { z as z52 } from "zod";
|
|
4484
|
+
import {
|
|
4485
|
+
createPublicClient as createPublicClient6,
|
|
4486
|
+
createWalletClient as createWalletClient6,
|
|
4487
|
+
http as http6,
|
|
4488
|
+
parseEther as parseEther5
|
|
4489
|
+
} from "viem";
|
|
4490
|
+
import { privateKeyToAccount as privateKeyToAccount6 } from "viem/accounts";
|
|
4491
|
+
var SetAllowAnyDeviceRequestSchema = z52.object({
|
|
4492
|
+
chain: z52.unknown().optional(),
|
|
4493
|
+
rpcUrl: z52.string().optional(),
|
|
4494
|
+
appAddress: z52.string(),
|
|
4495
|
+
allow: z52.boolean(),
|
|
4496
|
+
privateKey: z52.string().optional(),
|
|
4497
|
+
walletClient: z52.unknown().optional(),
|
|
4498
|
+
publicClient: z52.unknown().optional(),
|
|
4499
|
+
skipPrerequisiteChecks: z52.boolean().optional().default(false),
|
|
4500
|
+
minBalance: z52.string().optional(),
|
|
4501
|
+
timeout: z52.number().optional().default(12e4),
|
|
4502
|
+
retryOptions: z52.unknown().optional(),
|
|
4503
|
+
signal: z52.unknown().optional(),
|
|
4504
|
+
onTransactionStateChange: z52.function().optional(),
|
|
4505
|
+
onTransactionSubmitted: z52.function().optional(),
|
|
4506
|
+
onTransactionConfirmed: z52.function().optional()
|
|
4507
|
+
}).passthrough().refine((data) => !!data.privateKey !== !!data.walletClient, {
|
|
4508
|
+
message: "Either 'privateKey' or 'walletClient' must be provided, but not both",
|
|
4509
|
+
path: ["privateKey", "walletClient"]
|
|
4510
|
+
}).refine(
|
|
4511
|
+
(data) => {
|
|
4512
|
+
if (!!data.publicClient && !!data.walletClient) return true;
|
|
4513
|
+
return !!data.chain;
|
|
4514
|
+
},
|
|
4515
|
+
{
|
|
4516
|
+
message: "Chain is required when publicClient or walletClient is not provided",
|
|
4517
|
+
path: ["chain"]
|
|
4518
|
+
}
|
|
4519
|
+
);
|
|
4520
|
+
var SetAllowAnyDeviceSchema = z52.object({
|
|
4521
|
+
appAddress: z52.string(),
|
|
4522
|
+
allow: z52.boolean(),
|
|
4523
|
+
transactionHash: z52.string(),
|
|
4524
|
+
blockNumber: z52.bigint().optional(),
|
|
4525
|
+
gasUsed: z52.bigint().optional()
|
|
4526
|
+
}).passthrough();
|
|
4527
|
+
async function setAllowAnyDevice(request, parameters) {
|
|
4528
|
+
const validatedRequest = SetAllowAnyDeviceRequestSchema.parse(request);
|
|
4529
|
+
const {
|
|
4530
|
+
chain,
|
|
4531
|
+
rpcUrl,
|
|
4532
|
+
appAddress,
|
|
4533
|
+
allow,
|
|
4534
|
+
privateKey,
|
|
4535
|
+
walletClient: providedWalletClient,
|
|
4536
|
+
publicClient: providedPublicClient,
|
|
4537
|
+
timeout = 12e4,
|
|
4538
|
+
retryOptions,
|
|
4539
|
+
signal,
|
|
4540
|
+
onTransactionStateChange,
|
|
4541
|
+
onTransactionSubmitted,
|
|
4542
|
+
onTransactionConfirmed,
|
|
4543
|
+
skipPrerequisiteChecks = false,
|
|
4544
|
+
minBalance
|
|
4545
|
+
} = validatedRequest;
|
|
4546
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
4547
|
+
let publicClient;
|
|
4548
|
+
let walletClient;
|
|
4549
|
+
let address;
|
|
4550
|
+
let chainId;
|
|
4551
|
+
if (privateKey) {
|
|
4552
|
+
const account = privateKeyToAccount6(privateKey);
|
|
4553
|
+
publicClient = providedPublicClient ? providedPublicClient : createPublicClient6({ chain, transport: http6(rpcUrl) });
|
|
4554
|
+
walletClient = createWalletClient6({
|
|
4555
|
+
account,
|
|
4556
|
+
chain,
|
|
4557
|
+
transport: http6(rpcUrl)
|
|
4558
|
+
});
|
|
4559
|
+
address = account.address;
|
|
4560
|
+
chainId = chain.id;
|
|
4561
|
+
} else if (providedWalletClient) {
|
|
4562
|
+
walletClient = providedWalletClient;
|
|
4563
|
+
publicClient = providedPublicClient ? providedPublicClient : createPublicClient6({ chain, transport: http6(rpcUrl) });
|
|
4564
|
+
if (!walletClient.account?.address) {
|
|
4565
|
+
throw new Error("WalletClient must have an account with address");
|
|
4566
|
+
}
|
|
4567
|
+
address = walletClient.account.address;
|
|
4568
|
+
chainId = chain ? chain.id : await walletClient.getChainId();
|
|
4569
|
+
} else {
|
|
4570
|
+
throw new Error("Either privateKey or walletClient must be provided");
|
|
4571
|
+
}
|
|
4572
|
+
const networkClients = { publicClient, walletClient, address, chainId };
|
|
4573
|
+
const transactionTracker = createTransactionTracker();
|
|
4574
|
+
if (onTransactionStateChange && typeof onTransactionStateChange === "function") {
|
|
4575
|
+
const pollStatus = () => {
|
|
4576
|
+
onTransactionStateChange(transactionTracker.status);
|
|
4577
|
+
if (!transactionTracker.isComplete) {
|
|
4578
|
+
setTimeout(pollStatus, 100);
|
|
4579
|
+
}
|
|
4580
|
+
};
|
|
4581
|
+
setTimeout(pollStatus, 10);
|
|
4582
|
+
}
|
|
4583
|
+
if (!skipPrerequisiteChecks) {
|
|
4584
|
+
const requirements = {
|
|
4585
|
+
targetChainId: chainId,
|
|
4586
|
+
minBalance: minBalance ? parseEther5(minBalance) : parseEther5("0.001")
|
|
4587
|
+
};
|
|
4588
|
+
const validation = await validateNetworkPrerequisites(networkClients, requirements);
|
|
4589
|
+
if (!validation.networkValid) {
|
|
4590
|
+
throw new Error(
|
|
4591
|
+
`Network mismatch: Expected chain ${requirements.targetChainId}, but wallet is on chain ${validation.details.currentChainId}`
|
|
4592
|
+
);
|
|
4593
|
+
}
|
|
4594
|
+
if (!validation.balanceValid) {
|
|
4595
|
+
const requiredEth = Number(requirements.minBalance) / 1e18;
|
|
4596
|
+
const currentEth = Number(validation.details.balance) / 1e18;
|
|
4597
|
+
throw new Error(
|
|
4598
|
+
`Insufficient balance: Required ${requiredEth} ETH, but account has ${currentEth.toFixed(6)} ETH`
|
|
4599
|
+
);
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4602
|
+
const setAllowAnyOperation = async (clients) => {
|
|
4603
|
+
return clients.walletClient.writeContract({
|
|
4604
|
+
address: contractAddress,
|
|
4605
|
+
abi: dstackAppAbi,
|
|
4606
|
+
functionName: "setAllowAnyDevice",
|
|
4607
|
+
args: [allow],
|
|
4608
|
+
account: clients.walletClient.account || clients.address,
|
|
4609
|
+
chain: chain || null
|
|
4610
|
+
});
|
|
4611
|
+
};
|
|
4612
|
+
const transactionResult = retryOptions ? await executeTransactionWithRetry(
|
|
4613
|
+
setAllowAnyOperation,
|
|
4614
|
+
networkClients,
|
|
4615
|
+
[],
|
|
4616
|
+
{
|
|
4617
|
+
timeout,
|
|
4618
|
+
confirmations: 1,
|
|
4619
|
+
onSubmitted: onTransactionSubmitted,
|
|
4620
|
+
onConfirmed: onTransactionConfirmed,
|
|
4621
|
+
signal
|
|
4622
|
+
},
|
|
4623
|
+
retryOptions
|
|
4624
|
+
) : await transactionTracker.execute(setAllowAnyOperation, networkClients, [], {
|
|
4625
|
+
timeout,
|
|
4626
|
+
confirmations: 1,
|
|
4627
|
+
onSubmitted: onTransactionSubmitted,
|
|
4628
|
+
onConfirmed: onTransactionConfirmed,
|
|
4629
|
+
signal
|
|
4630
|
+
});
|
|
4631
|
+
const result = {
|
|
4632
|
+
appAddress: contractAddress,
|
|
4633
|
+
allow,
|
|
4634
|
+
transactionHash: transactionResult.receipt.transactionHash,
|
|
4635
|
+
blockNumber: transactionResult.receipt.blockNumber,
|
|
4636
|
+
gasUsed: transactionResult.receipt.gasUsed
|
|
4637
|
+
};
|
|
4638
|
+
if (parameters?.schema === false) {
|
|
4639
|
+
return result;
|
|
4640
|
+
}
|
|
4641
|
+
const schema = parameters?.schema || SetAllowAnyDeviceSchema;
|
|
4642
|
+
return schema.parse(result);
|
|
4643
|
+
}
|
|
4644
|
+
async function safeSetAllowAnyDevice(request, parameters) {
|
|
4645
|
+
try {
|
|
4646
|
+
const result = await setAllowAnyDevice(request, parameters);
|
|
4647
|
+
return { success: true, data: result };
|
|
4648
|
+
} catch (error) {
|
|
4649
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
4650
|
+
return {
|
|
4651
|
+
success: false,
|
|
4652
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
4653
|
+
};
|
|
4654
|
+
}
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4657
|
+
// src/actions/blockchains/get_allowed_devices.ts
|
|
4658
|
+
import { z as z53 } from "zod";
|
|
4659
|
+
import { createPublicClient as createPublicClient7, http as http7 } from "viem";
|
|
4660
|
+
var GetAllowedDevicesSchema = z53.object({
|
|
4661
|
+
appAddress: z53.string(),
|
|
4662
|
+
owner: z53.string(),
|
|
4663
|
+
allowAnyDevice: z53.boolean(),
|
|
4664
|
+
devices: z53.array(z53.string())
|
|
4665
|
+
});
|
|
4666
|
+
async function getAllowedDevices(request) {
|
|
4667
|
+
const { chain, rpcUrl, appAddress, deviceIds, publicClient: providedPublicClient } = request;
|
|
4668
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
4669
|
+
const publicClient = providedPublicClient ? providedPublicClient : (() => {
|
|
4670
|
+
if (!chain) throw new Error("Chain is required when publicClient is not provided");
|
|
4671
|
+
return createPublicClient7({ chain, transport: http7(rpcUrl) });
|
|
4672
|
+
})();
|
|
4673
|
+
const [allowAnyDevice, owner] = await Promise.all([
|
|
4674
|
+
publicClient.readContract({
|
|
4675
|
+
address: contractAddress,
|
|
4676
|
+
abi: dstackAppAbi,
|
|
4677
|
+
functionName: "allowAnyDevice"
|
|
4678
|
+
}),
|
|
4679
|
+
publicClient.readContract({
|
|
4680
|
+
address: contractAddress,
|
|
4681
|
+
abi: dstackAppAbi,
|
|
4682
|
+
functionName: "owner"
|
|
4683
|
+
})
|
|
4684
|
+
]);
|
|
4685
|
+
if (allowAnyDevice) {
|
|
4686
|
+
return {
|
|
4687
|
+
appAddress: contractAddress,
|
|
4688
|
+
owner,
|
|
4689
|
+
allowAnyDevice: true,
|
|
4690
|
+
devices: deviceIds.map((id) => asHex(id))
|
|
4691
|
+
};
|
|
4692
|
+
}
|
|
4693
|
+
let devices;
|
|
4694
|
+
if (deviceIds.length === 0) {
|
|
4695
|
+
devices = [];
|
|
4696
|
+
} else {
|
|
4697
|
+
const calls = deviceIds.map((deviceId) => ({
|
|
4698
|
+
address: contractAddress,
|
|
4699
|
+
abi: dstackAppAbi,
|
|
4700
|
+
functionName: "allowedDeviceIds",
|
|
4701
|
+
args: [asHex(deviceId)]
|
|
4702
|
+
}));
|
|
4703
|
+
const multicallResults = await publicClient.multicall({ contracts: calls });
|
|
4704
|
+
devices = deviceIds.map((deviceId, i) => ({
|
|
4705
|
+
deviceId: asHex(deviceId),
|
|
4706
|
+
allowed: multicallResults[i]?.status === "success" && multicallResults[i]?.result === true
|
|
4707
|
+
})).filter((r) => r.allowed).map((r) => r.deviceId);
|
|
4708
|
+
}
|
|
4709
|
+
return {
|
|
4710
|
+
appAddress: contractAddress,
|
|
4711
|
+
owner,
|
|
4712
|
+
allowAnyDevice: false,
|
|
4713
|
+
devices
|
|
4714
|
+
};
|
|
4715
|
+
}
|
|
4716
|
+
async function safeGetAllowedDevices(request) {
|
|
4717
|
+
try {
|
|
4718
|
+
const result = await getAllowedDevices(request);
|
|
4719
|
+
return { success: true, data: result };
|
|
4720
|
+
} catch (error) {
|
|
4721
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
4722
|
+
return {
|
|
4723
|
+
success: false,
|
|
4724
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
4725
|
+
};
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4728
|
+
|
|
4729
|
+
// src/actions/blockchains/check_device_allowed.ts
|
|
4730
|
+
import { createPublicClient as createPublicClient8, http as http8 } from "viem";
|
|
4731
|
+
async function checkDeviceAllowed(request) {
|
|
4732
|
+
const { chain, rpcUrl, appAddress, deviceId, publicClient: providedPublicClient } = request;
|
|
4733
|
+
const contractAddress = appAddress.startsWith("0x") ? appAddress : `0x${appAddress}`;
|
|
4734
|
+
const deviceIdHex = asHex(deviceId);
|
|
4735
|
+
const publicClient = providedPublicClient ? providedPublicClient : (() => {
|
|
4736
|
+
if (!chain) throw new Error("Chain is required when publicClient is not provided");
|
|
4737
|
+
return createPublicClient8({ chain, transport: http8(rpcUrl) });
|
|
4738
|
+
})();
|
|
4739
|
+
const allowAny = await publicClient.readContract({
|
|
4740
|
+
address: contractAddress,
|
|
4741
|
+
abi: dstackAppAbi,
|
|
4742
|
+
functionName: "allowAnyDevice"
|
|
4743
|
+
});
|
|
4744
|
+
if (allowAny) return true;
|
|
4745
|
+
const allowed = await publicClient.readContract({
|
|
4746
|
+
address: contractAddress,
|
|
4747
|
+
abi: dstackAppAbi,
|
|
4748
|
+
functionName: "allowedDeviceIds",
|
|
4749
|
+
args: [deviceIdHex]
|
|
4750
|
+
});
|
|
4751
|
+
return allowed;
|
|
4752
|
+
}
|
|
4753
|
+
async function safeCheckDeviceAllowed(request) {
|
|
4754
|
+
try {
|
|
4755
|
+
const result = await checkDeviceAllowed(request);
|
|
4756
|
+
return { success: true, data: result };
|
|
4757
|
+
} catch (error) {
|
|
4758
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown blockchain error";
|
|
4759
|
+
return {
|
|
4760
|
+
success: false,
|
|
4761
|
+
error: { isRequestError: true, message: errorMessage, status: 500, detail: errorMessage }
|
|
4762
|
+
};
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4765
|
+
|
|
4766
|
+
// src/actions/workspaces/get_workspace_nodes.ts
|
|
4767
|
+
import { z as z54 } from "zod";
|
|
4768
|
+
var NodeRefSchema2 = NodeRefSchema;
|
|
4769
|
+
var NodeInfoSchema = NodeRefSchema2;
|
|
4770
|
+
var GetWorkspaceNodesSchema = z54.object({
|
|
4771
|
+
items: z54.array(NodeRefSchema2),
|
|
4772
|
+
total: z54.number(),
|
|
4773
|
+
page: z54.number(),
|
|
4774
|
+
page_size: z54.number(),
|
|
4775
|
+
pages: z54.number()
|
|
4776
|
+
}).passthrough();
|
|
4777
|
+
var { action: getWorkspaceNodes, safeAction: safeGetWorkspaceNodes } = defineAction(GetWorkspaceNodesSchema, async (client, request) => {
|
|
4778
|
+
const { teamSlug, page, pageSize } = request;
|
|
4779
|
+
const queryParams = new URLSearchParams();
|
|
4780
|
+
if (page !== void 0) queryParams.append("page", page.toString());
|
|
4781
|
+
if (pageSize !== void 0) queryParams.append("page_size", pageSize.toString());
|
|
4782
|
+
const url = queryParams.toString() ? `/workspaces/${teamSlug}/nodes?${queryParams.toString()}` : `/workspaces/${teamSlug}/nodes`;
|
|
4783
|
+
return await client.get(url);
|
|
4784
|
+
});
|
|
4785
|
+
|
|
4786
|
+
// src/actions/workspaces/get_workspace_quotas.ts
|
|
4787
|
+
import { z as z55 } from "zod";
|
|
4788
|
+
var QuotaMetricSchema = z55.object({
|
|
4789
|
+
limit: z55.number(),
|
|
4790
|
+
remaining: z55.number()
|
|
4791
|
+
}).passthrough();
|
|
4792
|
+
var WorkspaceQuotasSchema = z55.object({
|
|
4793
|
+
vm_slots: QuotaMetricSchema,
|
|
4794
|
+
vcpu: QuotaMetricSchema,
|
|
4795
|
+
memory_mb: QuotaMetricSchema,
|
|
4796
|
+
disk_gb: QuotaMetricSchema
|
|
4797
|
+
}).passthrough();
|
|
4798
|
+
var WorkspaceReservedGpuQuotaSchema = z55.object({
|
|
4799
|
+
gpus: QuotaMetricSchema,
|
|
4800
|
+
in_use: z55.number(),
|
|
4801
|
+
misconfigured: z55.number()
|
|
4802
|
+
}).passthrough();
|
|
4803
|
+
var GetWorkspaceQuotasSchema = z55.object({
|
|
4804
|
+
team_slug: z55.string(),
|
|
4805
|
+
tier: z55.string(),
|
|
4806
|
+
quotas: WorkspaceQuotasSchema,
|
|
4807
|
+
reserved_nodes: QuotaMetricSchema,
|
|
4808
|
+
reserved_gpu: WorkspaceReservedGpuQuotaSchema,
|
|
4809
|
+
as_of: z55.string()
|
|
4810
|
+
}).passthrough();
|
|
4811
|
+
var { action: getWorkspaceQuotas, safeAction: safeGetWorkspaceQuotas } = defineAction(GetWorkspaceQuotasSchema, async (client, request) => {
|
|
4812
|
+
return await client.get(`/workspaces/${request.teamSlug}/quotas`);
|
|
4813
|
+
});
|
|
4814
|
+
|
|
4815
|
+
// src/actions/cvms/replicate_cvm.ts
|
|
4816
|
+
import { z as z56 } from "zod";
|
|
4817
|
+
var ReplicateCvmRequestSchema = refineCvmId(
|
|
4818
|
+
CvmIdObjectSchema.extend({
|
|
4819
|
+
node_id: z56.number().optional()
|
|
4820
|
+
})
|
|
4821
|
+
);
|
|
4822
|
+
var { action: replicateCvm, safeAction: safeReplicateCvm } = defineAction(VMSchema, async (client, request) => {
|
|
4823
|
+
const parsed = ReplicateCvmRequestSchema.parse(request);
|
|
4824
|
+
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
4825
|
+
const { node_id } = parsed;
|
|
4826
|
+
return await client.post(`/cvms/${cvmId}/replicas`, { node_id });
|
|
4827
|
+
});
|
|
4828
|
+
|
|
4829
|
+
// src/actions/cvms/watch_cvm_state.ts
|
|
4830
|
+
import { z as z57 } from "zod";
|
|
4831
|
+
var WatchCvmStateParamsSchema = z57.object({
|
|
4832
|
+
target: z57.string().describe("Target status to wait for (e.g., 'running', 'stopped')"),
|
|
4833
|
+
interval: z57.number().min(5).max(30).default(5).describe("Polling interval in seconds"),
|
|
4834
|
+
timeout: z57.number().min(10).max(600).default(300).describe("Timeout per attempt in seconds"),
|
|
4835
|
+
maxRetries: z57.number().min(0).default(Number.POSITIVE_INFINITY).describe("Maximum number of retry attempts (Infinity for unlimited)"),
|
|
4836
|
+
retryDelay: z57.number().min(0).default(5e3).describe("Delay between retries in milliseconds")
|
|
4837
|
+
});
|
|
4838
|
+
var WatchCvmStateRequestSchema = WatchCvmStateParamsSchema;
|
|
4839
|
+
var WatchAbortedError = class extends Error {
|
|
4840
|
+
constructor() {
|
|
4841
|
+
super("Watch operation was aborted");
|
|
4842
|
+
this.name = "WatchAbortedError";
|
|
4843
|
+
}
|
|
4844
|
+
};
|
|
4845
|
+
var MaxRetriesExceededError = class extends Error {
|
|
4846
|
+
constructor(attempts) {
|
|
4847
|
+
super(`Maximum retry attempts (${attempts}) exceeded`);
|
|
4848
|
+
this.attempts = attempts;
|
|
4849
|
+
this.name = "MaxRetriesExceededError";
|
|
4850
|
+
}
|
|
4851
|
+
};
|
|
4852
|
+
function parseSSEEvent(eventType, data) {
|
|
4853
|
+
try {
|
|
4854
|
+
const parsed = JSON.parse(data);
|
|
4855
|
+
return { type: eventType, data: parsed };
|
|
4856
|
+
} catch {
|
|
4857
|
+
return { type: "error", data: { error: "Failed to parse SSE event" } };
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4860
|
+
async function watchCvmState(client, request, options = {}) {
|
|
4861
|
+
const { cvmId } = CvmIdSchema.parse(request);
|
|
4862
|
+
const { target, interval, timeout, maxRetries, retryDelay } = WatchCvmStateParamsSchema.parse(request);
|
|
4863
|
+
const { signal, onEvent } = options;
|
|
4864
|
+
let attempt = 0;
|
|
4865
|
+
while (attempt < maxRetries) {
|
|
4866
|
+
if (signal?.aborted) {
|
|
4867
|
+
throw new WatchAbortedError();
|
|
4868
|
+
}
|
|
4869
|
+
attempt++;
|
|
4870
|
+
try {
|
|
4871
|
+
const result = await watchSingleAttempt(
|
|
4872
|
+
client,
|
|
4873
|
+
cvmId,
|
|
4874
|
+
target,
|
|
4875
|
+
interval,
|
|
4876
|
+
timeout,
|
|
4877
|
+
signal,
|
|
4878
|
+
onEvent
|
|
4879
|
+
);
|
|
4880
|
+
if (result) {
|
|
4881
|
+
return result;
|
|
4882
|
+
}
|
|
4883
|
+
if (attempt >= maxRetries) {
|
|
4884
|
+
throw new MaxRetriesExceededError(attempt);
|
|
4885
|
+
}
|
|
4886
|
+
await sleep(retryDelay, signal);
|
|
3994
4887
|
} catch (error) {
|
|
3995
4888
|
if (signal?.aborted) {
|
|
3996
4889
|
throw new WatchAbortedError();
|
|
@@ -4127,42 +5020,108 @@ function sleep(ms, signal) {
|
|
|
4127
5020
|
});
|
|
4128
5021
|
}
|
|
4129
5022
|
|
|
5023
|
+
// src/actions/cvms/refresh_cvm_instance_id.ts
|
|
5024
|
+
import { z as z58 } from "zod";
|
|
5025
|
+
var InstanceIdRefreshResultSchema = z58.object({
|
|
5026
|
+
cvm_id: z58.number().int(),
|
|
5027
|
+
identifier: z58.string(),
|
|
5028
|
+
status: z58.enum(["updated", "unchanged", "skipped", "conflict", "error"]),
|
|
5029
|
+
old_instance_id: z58.string().nullable().optional(),
|
|
5030
|
+
new_instance_id: z58.string().nullable().optional(),
|
|
5031
|
+
source: z58.enum(["teepod_state", "teepod_info", "gateway", "none"]),
|
|
5032
|
+
verified_with_gateway: z58.boolean(),
|
|
5033
|
+
reason: z58.string().nullable().optional()
|
|
5034
|
+
});
|
|
5035
|
+
var RefreshCvmInstanceIdRequestSchema = refineCvmId(
|
|
5036
|
+
CvmIdObjectSchema.extend({
|
|
5037
|
+
overwrite: z58.boolean().optional(),
|
|
5038
|
+
dry_run: z58.boolean().optional()
|
|
5039
|
+
})
|
|
5040
|
+
);
|
|
5041
|
+
var { action: refreshCvmInstanceId, safeAction: safeRefreshCvmInstanceId } = defineAction(InstanceIdRefreshResultSchema, async (client, request) => {
|
|
5042
|
+
const parsed = RefreshCvmInstanceIdRequestSchema.parse(request);
|
|
5043
|
+
const { cvmId } = CvmIdSchema.parse(parsed);
|
|
5044
|
+
const { overwrite, dry_run } = parsed;
|
|
5045
|
+
return await client.patch(`/cvms/${cvmId}/instance-id`, {
|
|
5046
|
+
overwrite,
|
|
5047
|
+
dry_run
|
|
5048
|
+
});
|
|
5049
|
+
});
|
|
5050
|
+
|
|
5051
|
+
// src/actions/cvms/refresh_cvm_instance_ids.ts
|
|
5052
|
+
import { z as z59 } from "zod";
|
|
5053
|
+
var RefreshCvmInstanceIdsRequestSchema = z59.object({
|
|
5054
|
+
cvm_ids: z59.array(z59.string()).optional(),
|
|
5055
|
+
running_only: z59.boolean().optional(),
|
|
5056
|
+
missing_only: z59.boolean().optional(),
|
|
5057
|
+
overwrite: z59.boolean().optional(),
|
|
5058
|
+
limit: z59.number().int().min(1).max(500).optional(),
|
|
5059
|
+
dry_run: z59.boolean().optional()
|
|
5060
|
+
}).strict();
|
|
5061
|
+
var RefreshCvmInstanceIdsResponseSchema = z59.object({
|
|
5062
|
+
total: z59.number().int(),
|
|
5063
|
+
scanned: z59.number().int(),
|
|
5064
|
+
updated: z59.number().int(),
|
|
5065
|
+
unchanged: z59.number().int(),
|
|
5066
|
+
skipped: z59.number().int(),
|
|
5067
|
+
conflicts: z59.number().int(),
|
|
5068
|
+
errors: z59.number().int(),
|
|
5069
|
+
items: z59.array(InstanceIdRefreshResultSchema)
|
|
5070
|
+
});
|
|
5071
|
+
var { action: refreshCvmInstanceIds, safeAction: safeRefreshCvmInstanceIds } = defineAction(RefreshCvmInstanceIdsResponseSchema, async (client, request) => {
|
|
5072
|
+
const parsed = RefreshCvmInstanceIdsRequestSchema.parse(request);
|
|
5073
|
+
return await client.patch("/cvms/instance-ids", parsed);
|
|
5074
|
+
});
|
|
5075
|
+
|
|
4130
5076
|
// src/actions/cvms/get_cvm_status_batch.ts
|
|
4131
|
-
import { z as
|
|
4132
|
-
var CvmStatusSchema =
|
|
4133
|
-
vm_uuid:
|
|
4134
|
-
status:
|
|
4135
|
-
uptime:
|
|
4136
|
-
in_progress:
|
|
4137
|
-
boot_progress:
|
|
4138
|
-
boot_error:
|
|
4139
|
-
operation_type:
|
|
4140
|
-
operation_started_at:
|
|
4141
|
-
correlation_id:
|
|
5077
|
+
import { z as z60 } from "zod";
|
|
5078
|
+
var CvmStatusSchema = z60.object({
|
|
5079
|
+
vm_uuid: z60.string(),
|
|
5080
|
+
status: z60.string(),
|
|
5081
|
+
uptime: z60.string().nullable().optional(),
|
|
5082
|
+
in_progress: z60.boolean(),
|
|
5083
|
+
boot_progress: z60.string().nullable().optional(),
|
|
5084
|
+
boot_error: z60.string().nullable().optional(),
|
|
5085
|
+
operation_type: z60.string().nullable().optional(),
|
|
5086
|
+
operation_started_at: z60.string().nullable().optional(),
|
|
5087
|
+
correlation_id: z60.string().nullable().optional()
|
|
4142
5088
|
});
|
|
4143
|
-
var GetCvmStatusBatchResponseSchema =
|
|
4144
|
-
var GetCvmStatusBatchRequestSchema =
|
|
4145
|
-
vmUuids:
|
|
5089
|
+
var GetCvmStatusBatchResponseSchema = z60.record(z60.string(), CvmStatusSchema);
|
|
5090
|
+
var GetCvmStatusBatchRequestSchema = z60.object({
|
|
5091
|
+
vmUuids: z60.array(z60.string())
|
|
4146
5092
|
});
|
|
4147
5093
|
var { action: getCvmStatusBatch, safeAction: safeGetCvmStatusBatch } = defineAction(GetCvmStatusBatchResponseSchema, async (client, request) => {
|
|
4148
5094
|
const { vmUuids } = GetCvmStatusBatchRequestSchema.parse(request);
|
|
4149
5095
|
return await client.post("/status/batch", { vm_uuids: vmUuids });
|
|
4150
5096
|
});
|
|
4151
5097
|
|
|
5098
|
+
// src/actions/cvms/get_cvm_user_config.ts
|
|
5099
|
+
import { z as z61 } from "zod";
|
|
5100
|
+
var CvmUserConfigSchema = z61.object({
|
|
5101
|
+
hostname: z61.string().nullable().optional(),
|
|
5102
|
+
ssh_authorized_keys: z61.array(z61.string()).default([]),
|
|
5103
|
+
default_gateway_domain: z61.string().nullable().optional()
|
|
5104
|
+
});
|
|
5105
|
+
var GetCvmUserConfigRequestSchema = CvmIdSchema;
|
|
5106
|
+
var { action: getCvmUserConfig, safeAction: safeGetCvmUserConfig } = defineAction(CvmUserConfigSchema, async (client, request) => {
|
|
5107
|
+
const { cvmId } = GetCvmUserConfigRequestSchema.parse(request);
|
|
5108
|
+
return await client.get(`/cvms/${cvmId}/user_config`);
|
|
5109
|
+
});
|
|
5110
|
+
|
|
4152
5111
|
// src/actions/apps/get_app_list.ts
|
|
4153
|
-
import { z as
|
|
4154
|
-
var GetAppListRequestSchema =
|
|
4155
|
-
page:
|
|
4156
|
-
page_size:
|
|
4157
|
-
search:
|
|
4158
|
-
status:
|
|
4159
|
-
listed:
|
|
4160
|
-
base_image:
|
|
4161
|
-
instance_type:
|
|
4162
|
-
kms_slug:
|
|
4163
|
-
kms_type:
|
|
4164
|
-
node:
|
|
4165
|
-
region:
|
|
5112
|
+
import { z as z62 } from "zod";
|
|
5113
|
+
var GetAppListRequestSchema = z62.object({
|
|
5114
|
+
page: z62.number().int().min(1).optional(),
|
|
5115
|
+
page_size: z62.number().int().min(1).max(100).optional(),
|
|
5116
|
+
search: z62.string().optional(),
|
|
5117
|
+
status: z62.array(z62.string()).optional(),
|
|
5118
|
+
listed: z62.boolean().optional(),
|
|
5119
|
+
base_image: z62.string().optional(),
|
|
5120
|
+
instance_type: z62.string().optional(),
|
|
5121
|
+
kms_slug: z62.string().optional(),
|
|
5122
|
+
kms_type: z62.string().optional(),
|
|
5123
|
+
node: z62.string().optional(),
|
|
5124
|
+
region: z62.string().optional()
|
|
4166
5125
|
}).strict();
|
|
4167
5126
|
function getSchemaForVersion4(version) {
|
|
4168
5127
|
return version === "2025-10-28" ? DstackAppListResponseV20251028Schema : DstackAppListResponseV20260121Schema;
|
|
@@ -4192,9 +5151,9 @@ async function safeGetAppList(client, request) {
|
|
|
4192
5151
|
}
|
|
4193
5152
|
|
|
4194
5153
|
// src/actions/apps/get_app_info.ts
|
|
4195
|
-
import { z as
|
|
4196
|
-
var GetAppInfoRequestSchema =
|
|
4197
|
-
appId:
|
|
5154
|
+
import { z as z63 } from "zod";
|
|
5155
|
+
var GetAppInfoRequestSchema = z63.object({
|
|
5156
|
+
appId: z63.string().min(1)
|
|
4198
5157
|
}).strict();
|
|
4199
5158
|
function getSchemaForVersion5(version) {
|
|
4200
5159
|
return version === "2025-10-28" ? DstackAppWithCvmResponseV20251028Schema : DstackAppWithCvmResponseV20260121Schema;
|
|
@@ -4224,12 +5183,12 @@ async function safeGetAppInfo(client, request) {
|
|
|
4224
5183
|
}
|
|
4225
5184
|
|
|
4226
5185
|
// src/actions/apps/get_app_cvms.ts
|
|
4227
|
-
import { z as
|
|
4228
|
-
var GetAppCvmsRequestSchema =
|
|
4229
|
-
appId:
|
|
5186
|
+
import { z as z64 } from "zod";
|
|
5187
|
+
var GetAppCvmsRequestSchema = z64.object({
|
|
5188
|
+
appId: z64.string().min(1)
|
|
4230
5189
|
}).strict();
|
|
4231
5190
|
function getSchemaForVersion6(version) {
|
|
4232
|
-
return version === "2025-10-28" ?
|
|
5191
|
+
return version === "2025-10-28" ? z64.array(CvmInfoV20251028Schema) : z64.array(CvmInfoV20260121Schema);
|
|
4233
5192
|
}
|
|
4234
5193
|
async function getAppCvms(client, request) {
|
|
4235
5194
|
const { appId } = GetAppCvmsRequestSchema.parse(request);
|
|
@@ -4255,12 +5214,54 @@ async function safeGetAppCvms(client, request) {
|
|
|
4255
5214
|
}
|
|
4256
5215
|
}
|
|
4257
5216
|
|
|
5217
|
+
// src/actions/apps/get_app_device_allowlist.ts
|
|
5218
|
+
import { z as z65 } from "zod";
|
|
5219
|
+
var DeviceAllowlistItemSchema = z65.object({
|
|
5220
|
+
device_id: z65.string(),
|
|
5221
|
+
node_name: z65.string().nullable(),
|
|
5222
|
+
cvm_ids: z65.array(z65.number()),
|
|
5223
|
+
allowed_onchain: z65.boolean(),
|
|
5224
|
+
status: z65.string()
|
|
5225
|
+
});
|
|
5226
|
+
var DeviceAllowlistResponseSchema = z65.object({
|
|
5227
|
+
is_onchain_kms: z65.boolean(),
|
|
5228
|
+
allow_any_device: z65.boolean().nullable().optional(),
|
|
5229
|
+
chain_id: z65.number().nullable().optional(),
|
|
5230
|
+
app_contract_address: z65.string().nullable().optional(),
|
|
5231
|
+
devices: z65.array(DeviceAllowlistItemSchema).optional().default([])
|
|
5232
|
+
});
|
|
5233
|
+
var GetAppDeviceAllowlistRequestSchema = z65.object({
|
|
5234
|
+
appId: z65.string().min(1)
|
|
5235
|
+
}).strict();
|
|
5236
|
+
async function getAppDeviceAllowlist(client, request) {
|
|
5237
|
+
const { appId } = GetAppDeviceAllowlistRequestSchema.parse(request);
|
|
5238
|
+
const response = await client.get(`/apps/${appId}/device-allowlist`);
|
|
5239
|
+
return DeviceAllowlistResponseSchema.parse(response);
|
|
5240
|
+
}
|
|
5241
|
+
async function safeGetAppDeviceAllowlist(client, request) {
|
|
5242
|
+
try {
|
|
5243
|
+
const data = await getAppDeviceAllowlist(client, request);
|
|
5244
|
+
return { success: true, data };
|
|
5245
|
+
} catch (error) {
|
|
5246
|
+
if (error && typeof error === "object" && ("status" in error || "issues" in error)) {
|
|
5247
|
+
return { success: false, error };
|
|
5248
|
+
}
|
|
5249
|
+
return {
|
|
5250
|
+
success: false,
|
|
5251
|
+
error: {
|
|
5252
|
+
name: "Error",
|
|
5253
|
+
message: error instanceof Error ? error.message : String(error)
|
|
5254
|
+
}
|
|
5255
|
+
};
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
|
|
4258
5259
|
// src/actions/apps/get_app_revisions.ts
|
|
4259
|
-
import { z as
|
|
4260
|
-
var GetAppRevisionsRequestSchema =
|
|
4261
|
-
appId:
|
|
4262
|
-
page:
|
|
4263
|
-
page_size:
|
|
5260
|
+
import { z as z66 } from "zod";
|
|
5261
|
+
var GetAppRevisionsRequestSchema = z66.object({
|
|
5262
|
+
appId: z66.string().min(1),
|
|
5263
|
+
page: z66.number().int().min(1).optional(),
|
|
5264
|
+
page_size: z66.number().int().min(1).max(1e3).optional()
|
|
4264
5265
|
}).strict();
|
|
4265
5266
|
async function getAppRevisions(client, request) {
|
|
4266
5267
|
const { appId, ...params } = GetAppRevisionsRequestSchema.parse(request);
|
|
@@ -4286,11 +5287,11 @@ async function safeGetAppRevisions(client, request) {
|
|
|
4286
5287
|
}
|
|
4287
5288
|
|
|
4288
5289
|
// src/actions/apps/get_app_revision_detail.ts
|
|
4289
|
-
import { z as
|
|
4290
|
-
var GetAppRevisionDetailRequestSchema =
|
|
4291
|
-
appId:
|
|
4292
|
-
revisionId:
|
|
4293
|
-
rawComposeFile:
|
|
5290
|
+
import { z as z67 } from "zod";
|
|
5291
|
+
var GetAppRevisionDetailRequestSchema = z67.object({
|
|
5292
|
+
appId: z67.string().min(1),
|
|
5293
|
+
revisionId: z67.string().min(1),
|
|
5294
|
+
rawComposeFile: z67.boolean().optional()
|
|
4294
5295
|
}).strict();
|
|
4295
5296
|
async function getAppRevisionDetail(client, request) {
|
|
4296
5297
|
const { appId, revisionId, rawComposeFile } = GetAppRevisionDetailRequestSchema.parse(request);
|
|
@@ -4317,15 +5318,15 @@ async function safeGetAppRevisionDetail(client, request) {
|
|
|
4317
5318
|
}
|
|
4318
5319
|
|
|
4319
5320
|
// src/actions/apps/get_app_filter_options.ts
|
|
4320
|
-
import { z as
|
|
4321
|
-
var AppFilterOptionsSchema =
|
|
4322
|
-
statuses:
|
|
4323
|
-
image_versions:
|
|
4324
|
-
instance_types:
|
|
4325
|
-
kms_slugs:
|
|
4326
|
-
kms_types:
|
|
4327
|
-
regions:
|
|
4328
|
-
nodes:
|
|
5321
|
+
import { z as z68 } from "zod";
|
|
5322
|
+
var AppFilterOptionsSchema = z68.object({
|
|
5323
|
+
statuses: z68.array(z68.string()),
|
|
5324
|
+
image_versions: z68.array(z68.string()),
|
|
5325
|
+
instance_types: z68.array(z68.string()),
|
|
5326
|
+
kms_slugs: z68.array(z68.string()),
|
|
5327
|
+
kms_types: z68.array(z68.string()),
|
|
5328
|
+
regions: z68.array(z68.string()),
|
|
5329
|
+
nodes: z68.array(z68.string())
|
|
4329
5330
|
});
|
|
4330
5331
|
async function getAppFilterOptions(client) {
|
|
4331
5332
|
const response = await client.get("/apps/filter-options");
|
|
@@ -4349,6 +5350,54 @@ async function safeGetAppFilterOptions(client) {
|
|
|
4349
5350
|
}
|
|
4350
5351
|
}
|
|
4351
5352
|
|
|
5353
|
+
// src/actions/apps/get_app_attestation.ts
|
|
5354
|
+
import { z as z69 } from "zod";
|
|
5355
|
+
var KmsInfoSchema2 = z69.object({
|
|
5356
|
+
contract_address: z69.string(),
|
|
5357
|
+
chain_id: z69.string().nullable(),
|
|
5358
|
+
version: z69.string(),
|
|
5359
|
+
url: z69.string(),
|
|
5360
|
+
gateway_app_id: z69.string().nullable(),
|
|
5361
|
+
gateway_app_url: z69.string(),
|
|
5362
|
+
kms_type: z69.string()
|
|
5363
|
+
});
|
|
5364
|
+
var GuestAgentInfoSchema = z69.object({
|
|
5365
|
+
app_id: z69.string().optional(),
|
|
5366
|
+
instance_id: z69.string().optional(),
|
|
5367
|
+
app_name: z69.string().optional(),
|
|
5368
|
+
device_id: z69.string().optional()
|
|
5369
|
+
}).passthrough().nullable();
|
|
5370
|
+
var AppAttestationInstanceSchema = z69.object({
|
|
5371
|
+
vm_uuid: z69.string().nullable().optional(),
|
|
5372
|
+
name: z69.string().optional(),
|
|
5373
|
+
instance_id: z69.string().nullable().optional(),
|
|
5374
|
+
status: z69.string().optional(),
|
|
5375
|
+
image_version: z69.string().nullable().optional(),
|
|
5376
|
+
quote: z69.string().nullable().optional(),
|
|
5377
|
+
ppid: z69.string().optional(),
|
|
5378
|
+
device_id: z69.string().optional(),
|
|
5379
|
+
tcb_info: TcbInfoSchema.nullable().optional(),
|
|
5380
|
+
app_certificates: z69.array(CertificateSchema).nullable().optional(),
|
|
5381
|
+
compose_file: z69.string().nullable().optional(),
|
|
5382
|
+
error: z69.string().nullable().optional()
|
|
5383
|
+
});
|
|
5384
|
+
var AppAttestationResponseSchema = z69.object({
|
|
5385
|
+
app_id: z69.string(),
|
|
5386
|
+
contract_address: z69.string(),
|
|
5387
|
+
kms_info: KmsInfoSchema2,
|
|
5388
|
+
instances: z69.array(AppAttestationInstanceSchema),
|
|
5389
|
+
kms_guest_agent_info: GuestAgentInfoSchema,
|
|
5390
|
+
gateway_guest_agent_info: GuestAgentInfoSchema,
|
|
5391
|
+
qemu_version: z69.string().nullable()
|
|
5392
|
+
});
|
|
5393
|
+
var GetAppAttestationRequestSchema = z69.object({
|
|
5394
|
+
appId: z69.string().min(1)
|
|
5395
|
+
}).strict();
|
|
5396
|
+
var { action: getAppAttestation, safeAction: safeGetAppAttestation } = defineAction(AppAttestationResponseSchema, async (client, request) => {
|
|
5397
|
+
const { appId } = GetAppAttestationRequestSchema.parse(request);
|
|
5398
|
+
return await client.get(`/apps/${appId}/attestations`);
|
|
5399
|
+
});
|
|
5400
|
+
|
|
4352
5401
|
// src/parse_dotenv.ts
|
|
4353
5402
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
4354
5403
|
function parseEnv(input) {
|
|
@@ -4388,8 +5437,11 @@ import { getComposeHash as getComposeHash2 } from "@phala/dstack-sdk/get-compose
|
|
|
4388
5437
|
import { verifyEnvEncryptPublicKey } from "@phala/dstack-sdk/verify-env-encrypt-public-key";
|
|
4389
5438
|
export {
|
|
4390
5439
|
AddComposeHashSchema,
|
|
5440
|
+
AddDeviceSchema,
|
|
4391
5441
|
AllFamiliesResponseSchema,
|
|
4392
5442
|
ApiErrorSchema,
|
|
5443
|
+
AppAttestationInstanceSchema,
|
|
5444
|
+
AppAttestationResponseSchema,
|
|
4393
5445
|
AppFilterOptionsSchema,
|
|
4394
5446
|
AppProfileSchema,
|
|
4395
5447
|
AppRevisionDetailResponseSchema,
|
|
@@ -4400,10 +5452,14 @@ export {
|
|
|
4400
5452
|
AvailableNodesSchema,
|
|
4401
5453
|
BillingPeriodSchema,
|
|
4402
5454
|
BusinessError,
|
|
5455
|
+
CertificateIssuerSchema,
|
|
5456
|
+
CertificateSchema,
|
|
5457
|
+
CertificateSubjectSchema,
|
|
4403
5458
|
CommitCvmComposeFileUpdateRequestSchema,
|
|
4404
5459
|
CommitCvmComposeFileUpdateSchema,
|
|
4405
5460
|
CommitCvmProvisionRequestSchema,
|
|
4406
5461
|
CommitCvmProvisionSchema,
|
|
5462
|
+
CreateSshKeyRequestSchema,
|
|
4407
5463
|
CreditsInfoSchema,
|
|
4408
5464
|
CurrentUserV20251028Schema as CurrentUserSchema,
|
|
4409
5465
|
CurrentUserV20251028Schema,
|
|
@@ -4431,7 +5487,9 @@ export {
|
|
|
4431
5487
|
CvmStateSchema,
|
|
4432
5488
|
CvmStatusSchema,
|
|
4433
5489
|
CvmSystemInfoSchema,
|
|
5490
|
+
CvmUserConfigSchema,
|
|
4434
5491
|
DeleteCvmRequestSchema,
|
|
5492
|
+
DeleteSshKeyRequestSchema,
|
|
4435
5493
|
DeployAppAuthRequestSchema,
|
|
4436
5494
|
DeployAppAuthSchema,
|
|
4437
5495
|
DstackAppFullResponseV20251028Schema,
|
|
@@ -4442,9 +5500,13 @@ export {
|
|
|
4442
5500
|
DstackAppMinimalResponseV20260121Schema,
|
|
4443
5501
|
DstackAppWithCvmResponseV20251028Schema,
|
|
4444
5502
|
DstackAppWithCvmResponseV20260121Schema,
|
|
5503
|
+
EventLogSchema,
|
|
4445
5504
|
FamilyGroupSchema,
|
|
4446
5505
|
FamilyInstanceTypesResponseSchema,
|
|
5506
|
+
GetAllowedDevicesSchema,
|
|
5507
|
+
GetAppAttestationRequestSchema,
|
|
4447
5508
|
GetAppCvmsRequestSchema,
|
|
5509
|
+
GetAppDeviceAllowlistRequestSchema,
|
|
4448
5510
|
GetAppEnvEncryptPubKeyRequestSchema,
|
|
4449
5511
|
GetAppEnvEncryptPubKeySchema,
|
|
4450
5512
|
GetAppInfoRequestSchema,
|
|
@@ -4465,15 +5527,24 @@ export {
|
|
|
4465
5527
|
GetCvmStatsRequestSchema,
|
|
4466
5528
|
GetCvmStatusBatchRequestSchema,
|
|
4467
5529
|
GetCvmStatusBatchResponseSchema,
|
|
5530
|
+
GetCvmUserConfigRequestSchema,
|
|
4468
5531
|
GetKmsInfoRequestSchema,
|
|
4469
5532
|
GetKmsListRequestSchema,
|
|
4470
5533
|
GetKmsListSchema,
|
|
5534
|
+
GetKmsOnChainDetailRequestSchema,
|
|
5535
|
+
GetKmsOnChainDetailResponseSchema,
|
|
5536
|
+
GetOsImagesRequestSchema,
|
|
5537
|
+
GetOsImagesResponseSchema,
|
|
4471
5538
|
GetWorkspaceNodesSchema,
|
|
4472
5539
|
GetWorkspaceQuotasSchema,
|
|
5540
|
+
ImportGithubProfileRequestSchema,
|
|
5541
|
+
ImportGithubProfileResponseSchema,
|
|
5542
|
+
InstanceIdRefreshResultSchema,
|
|
4473
5543
|
InstanceTypeSchema,
|
|
4474
5544
|
KmsInfoSchema,
|
|
4475
5545
|
KmsTypeSchema,
|
|
4476
5546
|
ListFamilyInstanceTypesRequestSchema,
|
|
5547
|
+
ListSshKeysResponseSchema,
|
|
4477
5548
|
ListWorkspacesSchema,
|
|
4478
5549
|
LooseAppComposeSchema,
|
|
4479
5550
|
MAX_COMPOSE_PAYLOAD_BYTES,
|
|
@@ -4485,7 +5556,11 @@ export {
|
|
|
4485
5556
|
NextAppIdsSchema,
|
|
4486
5557
|
NodeInfoSchema,
|
|
4487
5558
|
NodeRefSchema,
|
|
5559
|
+
OSImagePublicSchema,
|
|
4488
5560
|
OSImageVariantSchema,
|
|
5561
|
+
OnChainDeviceSchema,
|
|
5562
|
+
OnChainKmsContractSchema,
|
|
5563
|
+
OnChainOsImageSchema,
|
|
4489
5564
|
PaginatedCvmInfosV20251028Schema,
|
|
4490
5565
|
PaginatedCvmInfosV20260121Schema,
|
|
4491
5566
|
PaginationMetadataSchema,
|
|
@@ -4495,15 +5570,24 @@ export {
|
|
|
4495
5570
|
ProvisionCvmRequestSchema,
|
|
4496
5571
|
ProvisionCvmSchema,
|
|
4497
5572
|
QuotaMetricSchema,
|
|
5573
|
+
RefreshCvmInstanceIdRequestSchema,
|
|
5574
|
+
RefreshCvmInstanceIdsRequestSchema,
|
|
5575
|
+
RefreshCvmInstanceIdsResponseSchema,
|
|
5576
|
+
RemoveDeviceSchema,
|
|
5577
|
+
ReplicateCvmRequestSchema,
|
|
4498
5578
|
RequestError,
|
|
4499
5579
|
ResourceError,
|
|
4500
5580
|
RestartCvmRequestSchema,
|
|
4501
5581
|
SUPPORTED_API_VERSIONS,
|
|
4502
5582
|
SUPPORTED_CHAINS,
|
|
4503
5583
|
ServerError,
|
|
5584
|
+
SetAllowAnyDeviceSchema,
|
|
4504
5585
|
ShutdownCvmRequestSchema,
|
|
5586
|
+
SshKeySchema,
|
|
4505
5587
|
StartCvmRequestSchema,
|
|
4506
5588
|
StopCvmRequestSchema,
|
|
5589
|
+
SyncGithubSshKeysResponseSchema,
|
|
5590
|
+
TcbInfoSchema,
|
|
4507
5591
|
TransactionError,
|
|
4508
5592
|
UnknownError,
|
|
4509
5593
|
UpdateCvmEnvsRequestSchema,
|
|
@@ -4529,10 +5613,12 @@ export {
|
|
|
4529
5613
|
WorkspaceReservedGpuQuotaSchema,
|
|
4530
5614
|
WorkspaceResponseSchema,
|
|
4531
5615
|
addComposeHash,
|
|
5616
|
+
addDevice,
|
|
4532
5617
|
addNetwork,
|
|
4533
5618
|
asHex,
|
|
4534
5619
|
autoCreateClients,
|
|
4535
5620
|
checkBalance,
|
|
5621
|
+
checkDeviceAllowed,
|
|
4536
5622
|
checkNetworkStatus,
|
|
4537
5623
|
commitCvmComposeFileUpdate,
|
|
4538
5624
|
commitCvmProvision,
|
|
@@ -4542,11 +5628,14 @@ export {
|
|
|
4542
5628
|
createClientsFromBrowser,
|
|
4543
5629
|
createClientsFromPrivateKey,
|
|
4544
5630
|
createNetworkClients,
|
|
5631
|
+
createSshKey,
|
|
4545
5632
|
createTransactionTracker,
|
|
4546
5633
|
defineAction,
|
|
4547
5634
|
defineSimpleAction,
|
|
4548
5635
|
deleteCvm,
|
|
5636
|
+
deleteSshKey,
|
|
4549
5637
|
deployAppAuth,
|
|
5638
|
+
dstackAppAbi,
|
|
4550
5639
|
dumpAppCompose,
|
|
4551
5640
|
encryptEnvVars2 as encryptEnvVars,
|
|
4552
5641
|
estimateTransactionGas,
|
|
@@ -4559,7 +5648,10 @@ export {
|
|
|
4559
5648
|
formatValidationErrors,
|
|
4560
5649
|
generateDefaultCvmName,
|
|
4561
5650
|
generateFallbackHostname,
|
|
5651
|
+
getAllowedDevices,
|
|
5652
|
+
getAppAttestation,
|
|
4562
5653
|
getAppCvms,
|
|
5654
|
+
getAppDeviceAllowlist,
|
|
4563
5655
|
getAppEnvEncryptPubKey,
|
|
4564
5656
|
getAppFilterOptions,
|
|
4565
5657
|
getAppInfo,
|
|
@@ -4581,16 +5673,21 @@ export {
|
|
|
4581
5673
|
getCvmState,
|
|
4582
5674
|
getCvmStats,
|
|
4583
5675
|
getCvmStatusBatch,
|
|
5676
|
+
getCvmUserConfig,
|
|
4584
5677
|
getErrorMessage,
|
|
4585
5678
|
getKmsInfo,
|
|
4586
5679
|
getKmsList,
|
|
5680
|
+
getKmsOnChainDetail,
|
|
5681
|
+
getOsImages,
|
|
4587
5682
|
getValidationFields,
|
|
4588
5683
|
getWorkspace,
|
|
4589
5684
|
getWorkspaceNodes,
|
|
4590
5685
|
getWorkspaceQuotas,
|
|
5686
|
+
importGithubProfileSshKeys,
|
|
4591
5687
|
isValidHostname,
|
|
4592
5688
|
listAllInstanceTypeFamilies,
|
|
4593
5689
|
listFamilyInstanceTypes,
|
|
5690
|
+
listSshKeys,
|
|
4594
5691
|
listWorkspaces,
|
|
4595
5692
|
nextAppIds,
|
|
4596
5693
|
parseApiError,
|
|
@@ -4600,13 +5697,24 @@ export {
|
|
|
4600
5697
|
provisionCvm,
|
|
4601
5698
|
provisionCvmComposeFileUpdate,
|
|
4602
5699
|
refineCvmId,
|
|
5700
|
+
refreshCvmInstanceId,
|
|
5701
|
+
refreshCvmInstanceIds,
|
|
5702
|
+
removeDevice,
|
|
5703
|
+
replicateCvm,
|
|
4603
5704
|
restartCvm,
|
|
4604
5705
|
safeAddComposeHash,
|
|
5706
|
+
safeAddDevice,
|
|
5707
|
+
safeCheckDeviceAllowed,
|
|
4605
5708
|
safeCommitCvmComposeFileUpdate,
|
|
4606
5709
|
safeCommitCvmProvision,
|
|
5710
|
+
safeCreateSshKey,
|
|
4607
5711
|
safeDeleteCvm,
|
|
5712
|
+
safeDeleteSshKey,
|
|
4608
5713
|
safeDeployAppAuth,
|
|
5714
|
+
safeGetAllowedDevices,
|
|
5715
|
+
safeGetAppAttestation,
|
|
4609
5716
|
safeGetAppCvms,
|
|
5717
|
+
safeGetAppDeviceAllowlist,
|
|
4610
5718
|
safeGetAppEnvEncryptPubKey,
|
|
4611
5719
|
safeGetAppFilterOptions,
|
|
4612
5720
|
safeGetAppInfo,
|
|
@@ -4627,21 +5735,32 @@ export {
|
|
|
4627
5735
|
safeGetCvmState,
|
|
4628
5736
|
safeGetCvmStats,
|
|
4629
5737
|
safeGetCvmStatusBatch,
|
|
5738
|
+
safeGetCvmUserConfig,
|
|
4630
5739
|
safeGetKmsInfo,
|
|
4631
5740
|
safeGetKmsList,
|
|
5741
|
+
safeGetKmsOnChainDetail,
|
|
5742
|
+
safeGetOsImages,
|
|
4632
5743
|
safeGetWorkspace,
|
|
4633
5744
|
safeGetWorkspaceNodes,
|
|
4634
5745
|
safeGetWorkspaceQuotas,
|
|
5746
|
+
safeImportGithubProfileSshKeys,
|
|
4635
5747
|
safeListAllInstanceTypeFamilies,
|
|
4636
5748
|
safeListFamilyInstanceTypes,
|
|
5749
|
+
safeListSshKeys,
|
|
4637
5750
|
safeListWorkspaces,
|
|
4638
5751
|
safeNextAppIds,
|
|
4639
5752
|
safeProvisionCvm,
|
|
4640
5753
|
safeProvisionCvmComposeFileUpdate,
|
|
5754
|
+
safeRefreshCvmInstanceId,
|
|
5755
|
+
safeRefreshCvmInstanceIds,
|
|
5756
|
+
safeRemoveDevice,
|
|
5757
|
+
safeReplicateCvm,
|
|
4641
5758
|
safeRestartCvm,
|
|
5759
|
+
safeSetAllowAnyDevice,
|
|
4642
5760
|
safeShutdownCvm,
|
|
4643
5761
|
safeStartCvm,
|
|
4644
5762
|
safeStopCvm,
|
|
5763
|
+
safeSyncGithubSshKeys,
|
|
4645
5764
|
safeUpdateCvmEnvs,
|
|
4646
5765
|
safeUpdateCvmResources,
|
|
4647
5766
|
safeUpdateCvmVisibility,
|
|
@@ -4649,11 +5768,13 @@ export {
|
|
|
4649
5768
|
safeUpdateOsImage,
|
|
4650
5769
|
safeUpdatePreLaunchScript,
|
|
4651
5770
|
safeValidateActionParameters,
|
|
5771
|
+
setAllowAnyDevice,
|
|
4652
5772
|
shutdownCvm,
|
|
4653
5773
|
sortObject,
|
|
4654
5774
|
startCvm,
|
|
4655
5775
|
stopCvm,
|
|
4656
5776
|
switchToNetwork,
|
|
5777
|
+
syncGithubSshKeys,
|
|
4657
5778
|
updateCvmEnvs,
|
|
4658
5779
|
updateCvmResources,
|
|
4659
5780
|
updateCvmVisibility,
|