@neta-art/cohub-cli 2.2.6 → 2.2.8
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/commands/spaces.js +16 -5
- package/package.json +2 -2
package/dist/commands/spaces.js
CHANGED
|
@@ -11,6 +11,7 @@ import { registerSpaceCommerce } from "./space-commerce.js";
|
|
|
11
11
|
const cliEnv = resolveCohubEnvironment();
|
|
12
12
|
const defaultIdleTtlSeconds = cliEnv === "prod" ? 12 * 60 * 60 : 10 * 60;
|
|
13
13
|
const SPACE_ROLES = ["host", "builder", "guest"];
|
|
14
|
+
const SANDBOX_SPEC_IDS = ["standard", "boost", "ultra"];
|
|
14
15
|
const LABEL_RESOURCE_TYPES = ["session", "checkpoint", "file"];
|
|
15
16
|
function parseInteger(value, name, options = {}) {
|
|
16
17
|
if (!/^-?\d+$/.test(value.trim()))
|
|
@@ -63,6 +64,7 @@ const parseAutoDestroy = (opts) => {
|
|
|
63
64
|
const ttlSeconds = parseInteger(opts.idleTtl ?? String(defaultIdleTtlSeconds), "idle TTL", { min: 60, max: 30 * 24 * 60 * 60 });
|
|
64
65
|
return { mode: "idle", ttlSeconds };
|
|
65
66
|
};
|
|
67
|
+
const parseSandboxSpec = (value) => value ? parseChoice(value, "sandbox spec", SANDBOX_SPEC_IDS) : undefined;
|
|
66
68
|
const formatAutoDestroy = (policy) => {
|
|
67
69
|
if (!policy)
|
|
68
70
|
return `${cliEnv === "prod" ? "12h" : "10m"} (default)`;
|
|
@@ -328,15 +330,17 @@ export function registerSpaces(program) {
|
|
|
328
330
|
.option("-d, --description <desc>", "Space description")
|
|
329
331
|
.option("--auto-destroy <mode>", "Sandbox auto destroy mode: idle or never")
|
|
330
332
|
.option("--idle-ttl <seconds>", "Idle auto destroy TTL in seconds, max 2592000 (30d)")
|
|
333
|
+
.option("--spec <spec>", "Sandbox spec: standard, boost, or ultra")
|
|
331
334
|
.option("--json", "Output as JSON")
|
|
332
335
|
.action(async (opts) => {
|
|
333
336
|
const client = createClient();
|
|
334
337
|
try {
|
|
335
338
|
const autoDestroy = parseAutoDestroy(opts);
|
|
339
|
+
const spec = parseSandboxSpec(opts.spec);
|
|
336
340
|
const result = await client.spaces.create({
|
|
337
341
|
name: opts.name,
|
|
338
342
|
description: opts.description,
|
|
339
|
-
...(autoDestroy ? { config: { sandbox: { autoDestroy } } } : {}),
|
|
343
|
+
...((autoDestroy || spec) ? { config: { sandbox: { ...(autoDestroy ? { autoDestroy } : {}), ...(spec ? { spec } : {}) } } } : {}),
|
|
340
344
|
});
|
|
341
345
|
if (jsonRequested(opts))
|
|
342
346
|
return outJson(result);
|
|
@@ -421,22 +425,29 @@ export function registerSpaces(program) {
|
|
|
421
425
|
.description("Show or update space configuration")
|
|
422
426
|
.option("--auto-destroy <mode>", "Sandbox auto destroy mode: idle or never")
|
|
423
427
|
.option("--idle-ttl <seconds>", "Idle auto destroy TTL in seconds, max 2592000 (30d)")
|
|
428
|
+
.option("--spec <spec>", "Sandbox spec: standard, boost, or ultra")
|
|
424
429
|
.option("--json", "Output as JSON")
|
|
425
430
|
.action(async (id, opts) => {
|
|
426
431
|
const client = createClient();
|
|
427
432
|
try {
|
|
428
433
|
const autoDestroy = parseAutoDestroy(opts);
|
|
429
|
-
|
|
430
|
-
|
|
434
|
+
const spec = parseSandboxSpec(opts.spec);
|
|
435
|
+
if (autoDestroy || spec) {
|
|
436
|
+
const result = await client.space(id).updateConfig({ sandbox: { ...(autoDestroy ? { autoDestroy } : {}), ...(spec ? { spec } : {}) } });
|
|
431
437
|
if (jsonRequested(opts))
|
|
432
438
|
return outJson(result);
|
|
433
|
-
ok(`Space config updated — sandbox auto destroy: ${formatAutoDestroy(autoDestroy)}`);
|
|
439
|
+
ok(`Space config updated${autoDestroy ? ` — sandbox auto destroy: ${formatAutoDestroy(autoDestroy)}` : ""}${spec ? ` — sandbox spec: ${spec}` : ""}`);
|
|
434
440
|
return;
|
|
435
441
|
}
|
|
436
442
|
const result = await client.space(id).getConfig();
|
|
437
443
|
if (jsonRequested(opts))
|
|
438
444
|
return outJson(result);
|
|
439
|
-
table([
|
|
445
|
+
table([
|
|
446
|
+
{ key: "sandbox.autoDestroy", value: formatAutoDestroy(result.config.sandbox.autoDestroy) },
|
|
447
|
+
{ key: "sandbox.spec", value: result.config.sandbox.spec ?? "standard" },
|
|
448
|
+
{ key: "sandbox.appliedSpec", value: result.config.sandbox.appliedSpec ?? "—" },
|
|
449
|
+
{ key: "sandbox.allowedSpec", value: result.config.sandbox.allowedSpec ?? "standard" },
|
|
450
|
+
], [
|
|
440
451
|
{ key: "key", label: "Key" },
|
|
441
452
|
{ key: "value", label: "Value" },
|
|
442
453
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neta-art/cohub-cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@neta-art/generation": "^0.1.10",
|
|
17
17
|
"commander": "^14.0.3",
|
|
18
18
|
"sharp": "^0.34.5",
|
|
19
|
-
"@neta-art/cohub": "2.
|
|
19
|
+
"@neta-art/cohub": "2.7.1"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|