@tonbo/cli 0.17.3 → 0.18.0
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/bin/tonbo.js +24 -9
- package/package.json +1 -1
package/dist/bin/tonbo.js
CHANGED
|
@@ -402,6 +402,7 @@ var managementOperations = {
|
|
|
402
402
|
"query": [
|
|
403
403
|
"origin",
|
|
404
404
|
"scope",
|
|
405
|
+
"owners",
|
|
405
406
|
"cursor",
|
|
406
407
|
"limit"
|
|
407
408
|
],
|
|
@@ -5519,12 +5520,22 @@ async function volumeDeleteCommand(deps, name, options = {}) {
|
|
|
5519
5520
|
);
|
|
5520
5521
|
});
|
|
5521
5522
|
}
|
|
5522
|
-
|
|
5523
|
+
function parseVolumeSpec(spec) {
|
|
5523
5524
|
const split = spec.indexOf(":");
|
|
5525
|
+
if (split === -1 && spec.length > 0) return { name: spec };
|
|
5524
5526
|
if (split < 1 || split === spec.length - 1)
|
|
5525
|
-
throw new Error(
|
|
5526
|
-
|
|
5527
|
-
|
|
5527
|
+
throw new Error(
|
|
5528
|
+
`--volume ${spec}: give <name> for the Machine's whole disk, or <name>:<path> to mount it at a path, such as data:/data.`
|
|
5529
|
+
);
|
|
5530
|
+
return { name: spec.slice(0, split), path: spec.slice(split + 1) };
|
|
5531
|
+
}
|
|
5532
|
+
async function resolveVolumeBinding(deps, key, spec) {
|
|
5533
|
+
const { name, path: path6 } = parseVolumeSpec(spec);
|
|
5534
|
+
const volume = await deps.api.getVolume(key, name);
|
|
5535
|
+
return {
|
|
5536
|
+
binding: path6 === void 0 ? { volume: volume.id } : { volume: volume.id, path: path6 },
|
|
5537
|
+
region: volume.region
|
|
5538
|
+
};
|
|
5528
5539
|
}
|
|
5529
5540
|
|
|
5530
5541
|
// src/machine.ts
|
|
@@ -5550,6 +5561,9 @@ var MACHINE_ERROR_HINTS = {
|
|
|
5550
5561
|
image_failed: "The Machine's image could not be pulled; `tonbo machine show` says why. Fix the image, then name it again with `tonbo machine update --image`.",
|
|
5551
5562
|
machine_kind_mismatch: "That Machine is one of your computers: `tonbo machine show` and `tonbo machine delete` serve it, and nothing else does.",
|
|
5552
5563
|
volumes_not_offered: "Volumes are not offered to this account in the Machine's region yet; nothing was created or changed.",
|
|
5564
|
+
root_mode_not_offered: "A Volume as the Machine's whole disk is not offered to this account yet; nothing was created or changed. Mount it at a path instead: --volume <name>:<path>.",
|
|
5565
|
+
rebuild_required: "This Machine's Volume is its whole disk, so its image changes only by Rebuild, which keeps /home, /workspace and /root and deletes every other change on the disk. Rebuild is not available yet: keep the image, or create a new Machine with the new image and a new Volume.",
|
|
5566
|
+
volume_mode_change: "The Volume cannot move between being the Machine's whole disk and being mounted at a path; nothing was changed. Bind a new Volume in the mode you want.",
|
|
5553
5567
|
secret_env_conflict: "Use another secret key or remove the non-secret env variable with that name.",
|
|
5554
5568
|
secret_limit: "Reduce the number or byte size of this Machine's secrets.",
|
|
5555
5569
|
wake_unavailable: "The wake was refused for now; nothing woke. Wake it again after a while; `tonbo machine show` says why it is blocked."
|
|
@@ -5812,7 +5826,8 @@ function deleteFields(machine) {
|
|
|
5812
5826
|
}
|
|
5813
5827
|
function volumeText(machine) {
|
|
5814
5828
|
const binding = machine.volumes?.[0];
|
|
5815
|
-
|
|
5829
|
+
if (!binding) return "none";
|
|
5830
|
+
return binding.path === void 0 ? `${binding.volume} (whole disk)` : `${binding.volume} at ${binding.path}`;
|
|
5816
5831
|
}
|
|
5817
5832
|
function machineText(machine, billing, etag = null, lastEnd = null) {
|
|
5818
5833
|
return [machineFields(machine, billing, etag, lastEnd), ...privatePortLines(machine)].join("\n");
|
|
@@ -6886,7 +6901,7 @@ var COMMAND_HELP = {
|
|
|
6886
6901
|
},
|
|
6887
6902
|
"tonbo machine create": {
|
|
6888
6903
|
about: [
|
|
6889
|
-
"Creates a Machine, a VM booted from an image in one region. It has no database of its own: `--database <name>` binds one of the account's databases of its region, which it then reaches at `TONBO_DATABASE_URL`, and a database binds one Machine at a time; its
|
|
6904
|
+
"Creates a Machine, a VM booted from an image in one region. It has no database of its own: `--database <name>` binds one of the account's databases of its region, which it then reaches at `TONBO_DATABASE_URL`, and a database binds one Machine at a time; its disk can last on a Volume (`--volume <name>` keeps the Machine's whole disk on it, and `--volume <name>:<path>` mounts it at a path instead), and its program can open any other database by URL with a key. The image is a public OCI image with a linux/arm64 variant, from Docker Hub or another public registry (`nginx:1.27`, `ghcr.io/org/app:v1`, or one pinned by digest), or `tonbo.dev/platform`, the platform image. A registry reachable only over IPv6, one named by an IP address, and one that redirects its manifests are refused. The CLI resolves a registry image to its linux/arm64 digest, and the image is pulled before the Machine leaves `creating`.",
|
|
6890
6905
|
"The Machine is served at `https://<name>-<account>.tonbo.sh` on its default port. `--port <port>` serves a private port, which takes a member's token, and `--port <port>:public` an open one, which needs the `machines.public` capability. A command after `--` replaces the image's CMD. `--secret-env KEY=FILE` and `--secret-file KEY=FILE` read initial secrets from local files and store them with the Machine before its first boot; their values are never returned. The CLI warns on stderr when the Machine has no port, since nothing can wake it then, and when an `--env` key looks secret: env values are readable by every member through the API.",
|
|
6891
6906
|
"The answer is the Machine while it is `creating`. With `--wait` the CLI reads it until it is `active` or `failed`, or `--timeout` passes: a failure prints what to do and exits 1, and a timeout says it is still creating and undoes nothing. A creation the network or a 5xx answer did not confirm is sent at most three times with the same idempotency key, each retry after its `Retry-After` (at most 30 s) or a short backoff; a `name_taken` refusal says which Machine holds the name and how old it is, in case it is yours from a lost reply. In a region not open for Machines the creation is refused with `region_not_offered`, and nothing is created."
|
|
6892
6907
|
],
|
|
@@ -6937,7 +6952,7 @@ var COMMAND_HELP = {
|
|
|
6937
6952
|
"tonbo machine update": {
|
|
6938
6953
|
about: [
|
|
6939
6954
|
"Changes only what its options name. It reads the Machine and sends the ETag it read, or `--if-match`'s, so a change someone made in between is refused with `precondition_failed` rather than overwritten; a Machine whose creation failed is refused with `machine_failed`. `--env` and `--unset-env` change single variables; `--port` replaces every port, and the current default port stays the default while it is still listed.",
|
|
6940
|
-
"Ports and `--sleep-after` apply at once. The image, command, shape, env, Volume and database apply at the next boot, and the command says how to apply them now: `tonbo machine sleep`, after which the next request boots the new spec. Naming the same tag again resolves its digest again. `--database <name>` binds another database of the account in the Machine's region, which no other Machine binds, and `--no-database` binds none; the database it leaves is kept. A Machine created with its own database keeps it.",
|
|
6955
|
+
"Ports and `--sleep-after` apply at once. The image, command, shape, env, Volume and database apply at the next boot, and the command says how to apply them now: `tonbo machine sleep`, after which the next request boots the new spec. Naming the same tag again resolves its digest again. A Machine whose Volume is its whole disk keeps its image: another image is refused with `rebuild_required`, since only Rebuild, which keeps /home, /workspace and /root and deletes every other change on the disk, may move it, and Rebuild is not available yet. `--database <name>` binds another database of the account in the Machine's region, which no other Machine binds, and `--no-database` binds none; the database it leaves is kept. A Machine created with its own database keeps it.",
|
|
6941
6956
|
"`--delete-after` applies at once and keeps the clock, which counts from the end of the Machine's last activation (or its creation), so a lower value can delete a Machine that has already slept that long; `--no-delete-after` turns it off. `tonbo machine show` prints when it will be deleted."
|
|
6942
6957
|
],
|
|
6943
6958
|
examples: ["tonbo machine update web --env MODE=staging --sleep-after 300"],
|
|
@@ -8556,8 +8571,8 @@ function machineSpecOptions(command, update) {
|
|
|
8556
8571
|
"the seconds between SIGTERM and SIGKILL on a planned stop",
|
|
8557
8572
|
parseWhole
|
|
8558
8573
|
).option(
|
|
8559
|
-
"--volume <name:path>",
|
|
8560
|
-
`
|
|
8574
|
+
"--volume <name[:path]>",
|
|
8575
|
+
`keep the Machine's whole disk on the Volume <name> (see tonbo volume list), or with :<path> mount it at <path> instead; a Machine has at most one, of its own region${update ? "; applies at the next boot" : ""}`
|
|
8561
8576
|
).option(
|
|
8562
8577
|
"--delete-after <seconds>",
|
|
8563
8578
|
`delete the Machine once it has been asleep, never woken or failed this long (3600 to 7776000)${update ? "; applies at once, from its last activation's end" : ""}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonbo/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "The Tonbo CLI. Compute, disks, databases and streams for AI agents: your agent picks what it needs, sets it up, and knows what it costs, from the command line.",
|
|
5
5
|
"homepage": "https://tonbo.dev",
|
|
6
6
|
"bugs": {
|