@tonbo/cli 0.12.0 → 0.13.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 +74 -7
- package/package.json +1 -1
package/dist/bin/tonbo.js
CHANGED
|
@@ -415,7 +415,8 @@ var managementOperations = {
|
|
|
415
415
|
"pathParams": [],
|
|
416
416
|
"query": [
|
|
417
417
|
"after",
|
|
418
|
-
"wait"
|
|
418
|
+
"wait",
|
|
419
|
+
"include"
|
|
419
420
|
],
|
|
420
421
|
"idempotencyKey": false
|
|
421
422
|
},
|
|
@@ -588,6 +589,61 @@ var managementOperations = {
|
|
|
588
589
|
"query": [],
|
|
589
590
|
"idempotencyKey": false
|
|
590
591
|
},
|
|
592
|
+
"listYieldQuestions": {
|
|
593
|
+
"method": "GET",
|
|
594
|
+
"path": "/yield/questions",
|
|
595
|
+
"pathParams": [],
|
|
596
|
+
"query": [
|
|
597
|
+
"team",
|
|
598
|
+
"limit"
|
|
599
|
+
],
|
|
600
|
+
"idempotencyKey": false
|
|
601
|
+
},
|
|
602
|
+
"createYieldQuestion": {
|
|
603
|
+
"method": "POST",
|
|
604
|
+
"path": "/yield/questions",
|
|
605
|
+
"pathParams": [],
|
|
606
|
+
"query": [],
|
|
607
|
+
"idempotencyKey": false
|
|
608
|
+
},
|
|
609
|
+
"showYieldQuestion": {
|
|
610
|
+
"method": "GET",
|
|
611
|
+
"path": "/yield/questions/{id}",
|
|
612
|
+
"pathParams": [
|
|
613
|
+
"id"
|
|
614
|
+
],
|
|
615
|
+
"query": [],
|
|
616
|
+
"idempotencyKey": false
|
|
617
|
+
},
|
|
618
|
+
"replyYieldQuestion": {
|
|
619
|
+
"method": "POST",
|
|
620
|
+
"path": "/yield/questions/{id}/replies",
|
|
621
|
+
"pathParams": [
|
|
622
|
+
"id"
|
|
623
|
+
],
|
|
624
|
+
"query": [],
|
|
625
|
+
"idempotencyKey": false
|
|
626
|
+
},
|
|
627
|
+
"closeYieldQuestion": {
|
|
628
|
+
"method": "POST",
|
|
629
|
+
"path": "/yield/questions/{id}/close",
|
|
630
|
+
"pathParams": [
|
|
631
|
+
"id"
|
|
632
|
+
],
|
|
633
|
+
"query": [],
|
|
634
|
+
"idempotencyKey": false
|
|
635
|
+
},
|
|
636
|
+
"listYieldDecisions": {
|
|
637
|
+
"method": "GET",
|
|
638
|
+
"path": "/yield/decisions",
|
|
639
|
+
"pathParams": [],
|
|
640
|
+
"query": [
|
|
641
|
+
"project",
|
|
642
|
+
"path",
|
|
643
|
+
"limit"
|
|
644
|
+
],
|
|
645
|
+
"idempotencyKey": false
|
|
646
|
+
},
|
|
591
647
|
"listDatabases": {
|
|
592
648
|
"method": "GET",
|
|
593
649
|
"path": "/databases",
|
|
@@ -879,7 +935,7 @@ var apiKeyExpirations = [
|
|
|
879
935
|
];
|
|
880
936
|
var credentialsContract = {
|
|
881
937
|
"version": 1,
|
|
882
|
-
"description": "Legacy from ADR-0018: the per-account CLI login of @tonbo/cli 0.11 and @tonbo/yield 0.3. From @tonbo/cli 0.12 and @tonbo/yield 0.4 a login is one session of the person in login.json (credentials-v2.json); clients read this file only as the fallback when login.json is missing, and the per-account keys it holds
|
|
938
|
+
"description": "Legacy from ADR-0018: the per-account CLI login of @tonbo/cli 0.11 and @tonbo/yield 0.3. From @tonbo/cli 0.12 and @tonbo/yield 0.4 a login is one session of the person in login.json (credentials-v2.json); clients read this file only as the fallback when login.json is missing, and the per-account keys it holds were retired when those CLIs shipped (founder, 2026-11-03): User Center issues them no more (access-token-v1.json `cli_session.login.retired`) and the live ones were revoked, so no client writes this file any longer. Before that: the login `tonbo login` (and `yield login`) saves: a personal key of one account at the top level, the login made last, and, beside it, every account's login of this device in `accounts` with the device's `login_secret` (ADR-0016, \"Credentials\", PR 4b-ii). @tonbo/cli-core writes and reads it; the Tonbo SDK (@tonbo/sdk and tonbo-sdk, contracts/sdk/v1.json) reads it as its last key source, and every other reader follows `reader` and reads the top level alone.",
|
|
883
939
|
"path": {
|
|
884
940
|
"description": "`${XDG_CONFIG_HOME}/tonbo/credentials.json` when XDG_CONFIG_HOME is set and not empty, else `${HOME}/.config/tonbo/credentials.json`.",
|
|
885
941
|
"base_env": "XDG_CONFIG_HOME",
|
|
@@ -4360,6 +4416,7 @@ var MACHINE_ERROR_HINTS = {
|
|
|
4360
4416
|
machine_failed: "A Machine whose creation failed does not change: `tonbo machine show` says why; delete it with `tonbo machine delete` and create it again.",
|
|
4361
4417
|
snapshot_would_be_discarded: "Pass --discard-snapshot to apply the change at the next boot, which then starts fresh.",
|
|
4362
4418
|
machine_limit_reached: "The account holds as many Machines as it may: delete one you no longer need (`tonbo machine list`), or ask for more.",
|
|
4419
|
+
database_bound: "Another Machine binds that database, and a database binds one Machine: name another, or delete the Machine that binds it first.",
|
|
4363
4420
|
idempotency_conflict: "That idempotency key belongs to another request: leave out --idempotency-key to create a new Machine.",
|
|
4364
4421
|
create_rate_limited: "Too many Machines were created in the last hour; try again later.",
|
|
4365
4422
|
image_pulling: "The Machine's image is still being pulled; the request was not run. Try again shortly; `tonbo machine show` reports the image's state.",
|
|
@@ -4823,7 +4880,12 @@ async function machineCreateCommand(deps, name, command, options = {}) {
|
|
|
4823
4880
|
const ports = withDefault(parsePorts(options.port ?? []), options.defaultPort);
|
|
4824
4881
|
const key = await deps.auth.apiKey();
|
|
4825
4882
|
const bound = typeof options.volume === "string" ? await resolveVolumeBinding(deps, key, options.volume) : null;
|
|
4826
|
-
const
|
|
4883
|
+
const database = typeof options.database === "string" ? await deps.api.getDatabase(key, options.database) : null;
|
|
4884
|
+
if (database && bound && database.region !== bound.region && !options.region)
|
|
4885
|
+
throw new Error(
|
|
4886
|
+
`The Volume is in ${bound.region} and database ${database.name} in ${database.region}; a Machine binds both only in its own region.`
|
|
4887
|
+
);
|
|
4888
|
+
const region = options.region ?? bound?.region ?? database?.region;
|
|
4827
4889
|
const shape = options.shape ?? (await deps.api.listMachineShapes(key)).default;
|
|
4828
4890
|
let created;
|
|
4829
4891
|
try {
|
|
@@ -4841,7 +4903,9 @@ async function machineCreateCommand(deps, name, command, options = {}) {
|
|
|
4841
4903
|
idle_action: options.idleAction,
|
|
4842
4904
|
stop_grace_seconds: options.stopGrace,
|
|
4843
4905
|
...bound ? { volumes: [bound.binding] } : {},
|
|
4844
|
-
delete_after_seconds: deleteAfterSeconds(options.deleteAfter)
|
|
4906
|
+
delete_after_seconds: deleteAfterSeconds(options.deleteAfter),
|
|
4907
|
+
...database ? { database: database.name } : {},
|
|
4908
|
+
...options.database === false ? { database: null } : {}
|
|
4845
4909
|
},
|
|
4846
4910
|
options.idempotencyKey ?? randomUUID5()
|
|
4847
4911
|
);
|
|
@@ -5475,7 +5539,7 @@ var COMMAND_HELP = {
|
|
|
5475
5539
|
},
|
|
5476
5540
|
"tonbo machine create": {
|
|
5477
5541
|
about: [
|
|
5478
|
-
"Creates a Machine, a VM booted from an image in one region. It has no database of its own: its files can last on a Volume (`--volume`), and its program
|
|
5542
|
+
"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 files can last on a Volume (`--volume`), 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`.",
|
|
5479
5543
|
"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. 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.",
|
|
5480
5544
|
"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."
|
|
5481
5545
|
],
|
|
@@ -5487,7 +5551,7 @@ var COMMAND_HELP = {
|
|
|
5487
5551
|
defaults: {
|
|
5488
5552
|
"--shape": "the shape `tonbo machine shapes` marks as the default",
|
|
5489
5553
|
"--default-port": "the first --port",
|
|
5490
|
-
"--region": "the --volume's region, else the account's default region",
|
|
5554
|
+
"--region": "the --volume's or --database's region, else the account's default region",
|
|
5491
5555
|
"--idempotency-key": "a new UUID",
|
|
5492
5556
|
"--timeout": String(DEFAULT_WAIT_SECONDS),
|
|
5493
5557
|
"--delete-after": "never"
|
|
@@ -6062,7 +6126,10 @@ function createProgram(makeDependencies = createDependencies) {
|
|
|
6062
6126
|
).requiredOption(
|
|
6063
6127
|
"--image <reference>",
|
|
6064
6128
|
"the image the Machine boots: a public OCI image with a linux/arm64 variant (nginx:1.27, ghcr.io/org/app@sha256:...), or tonbo.dev/platform"
|
|
6065
|
-
).option("--region <region>", "the Machine's region, fixed for its life")
|
|
6129
|
+
).option("--region <region>", "the Machine's region, fixed for its life").option(
|
|
6130
|
+
"--database <name>",
|
|
6131
|
+
"bind the account's database <name> (see tonbo database list), of the Machine's region: its URL is TONBO_DATABASE_URL and the Machine writes it"
|
|
6132
|
+
).option("--no-database", "bind no database (the default)"),
|
|
6066
6133
|
false
|
|
6067
6134
|
).option(
|
|
6068
6135
|
"--idempotency-key <key>",
|