cassian-cli 0.3.0 → 0.3.1

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.
@@ -2,14 +2,42 @@ import { createInterface } from "readline";
2
2
  import { writeFileSync, existsSync } from "fs";
3
3
  import { green, dim, bold } from "../lib/output.js";
4
4
  import { fatal } from "../lib/errors.js";
5
- const GPU_OPTIONS = [
6
- { label: "H100 SXM", value: "h100-sxm", hint: "80GB — best for large training" },
7
- { label: "H100 PCIe", value: "h100-pcie", hint: "80GB" },
8
- { label: "A100 SXM", value: "a100-sxm", hint: "80GB — reliable workhorse" },
9
- { label: "A100 PCIe", value: "a100-pcie", hint: "80GB" },
10
- { label: "L40S", value: "l40s", hint: "48GB — great for inference" },
11
- { label: "RTX 4090", value: "rtx4090", hint: "24GB — fast, affordable" },
5
+ import { AGENT_URL } from "../lib/constants.js";
6
+ const GPU_METADATA = {
7
+ "h100": { memory: "80GB", hint: "best for large training" },
8
+ "a100": { memory: "80GB", hint: "reliable workhorse" },
9
+ "l40s": { memory: "48GB", hint: "great for inference" },
10
+ "l4": { memory: "24GB", hint: "efficient inference" },
11
+ "a10g": { memory: "24GB", hint: "good all-rounder" },
12
+ "rtx4090": { memory: "24GB", hint: "fast, affordable" },
13
+ "rtx3090": { memory: "24GB" },
14
+ };
15
+ async function fetchAvailableGpus() {
16
+ try {
17
+ const resp = await fetch(`${AGENT_URL}/v1/gpu-types`);
18
+ if (!resp.ok)
19
+ return [];
20
+ const { gpu_types } = await resp.json();
21
+ const options = [];
22
+ for (const gpu of gpu_types) {
23
+ const type = gpu.type.toLowerCase();
24
+ const meta = GPU_METADATA[type];
25
+ const label = type.toUpperCase().replace("RTX", "RTX ");
26
+ const hint = meta
27
+ ? `${meta.memory}${meta.hint ? ` — ${meta.hint}` : ""} — ${gpu.available} available`
28
+ : `${gpu.available} available`;
29
+ options.push({ label, value: type, hint });
30
+ }
31
+ return options;
32
+ }
33
+ catch {
34
+ return [];
35
+ }
36
+ }
37
+ const FALLBACK_GPU_OPTIONS = [
12
38
  { label: "RTX 3090", value: "rtx3090", hint: "24GB" },
39
+ { label: "L4", value: "l4", hint: "24GB — efficient inference" },
40
+ { label: "A10G", value: "a10g", hint: "24GB — good all-rounder" },
13
41
  ];
14
42
  function prompt(rl, question, fallback) {
15
43
  return new Promise((resolve) => {
@@ -95,7 +123,10 @@ export async function init(options = {}) {
95
123
  console.log(dim(" Press enter to accept defaults. Or pass flags to skip: cassian init --help\n"));
96
124
  const name = options.name || await prompt(rl, ` Instance name ${dim(`[${dirName}]`)}: `, dirName);
97
125
  console.log();
98
- const gpuType = options.gpu || await promptChoice(rl, " GPU type:", GPU_OPTIONS, "rtx3090");
126
+ const liveGpus = await fetchAvailableGpus();
127
+ const gpuOptions = liveGpus.length > 0 ? liveGpus : FALLBACK_GPU_OPTIONS;
128
+ const defaultGpu = gpuOptions[0].value;
129
+ const gpuType = options.gpu || await promptChoice(rl, " GPU type:", gpuOptions, defaultGpu);
99
130
  console.log();
100
131
  const gpuCountStr = options.gpuCount || await promptChoice(rl, " Number of GPUs:", [
101
132
  { label: "1", value: "1" }, { label: "2", value: "2" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cassian-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "The Cassian GPU cloud CLI — provision GPUs, sync files, and run workloads from your terminal.",
5
5
  "type": "module",
6
6
  "bin": {