@tonbo/cli 0.3.2 → 0.3.3

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/README.md CHANGED
@@ -207,7 +207,8 @@ Machines belong to an Account independently of Agents. Allocate in `us-east-1`,
207
207
 
208
208
  ```console
209
209
  tonbo --json region list
210
- tonbo --json machine allocate --account <account-uuid> --region us-east-1
210
+ tonbo --json machine allocate --account <account-uuid> --region us-east-1 --request-id <request-uuid>
211
+ tonbo --json machine allocation <request-uuid> --account <account-uuid>
211
212
  tonbo --json machine list --account <account-uuid>
212
213
  tonbo --json machine bind <machine-uuid> --agent <agent-uuid>
213
214
  tonbo --json machine show <machine-uuid>
@@ -219,3 +220,5 @@ tonbo --json machine release <machine-uuid>
219
220
  Only one active Agent binding per Machine and one Machine per Agent are currently supported. Unbinding drains execution and completes physical deletion, final usage settlement and storage credential revocation before the Machine becomes available. Wait for `available: true` in `machine show` before rebinding. Cross-Agent reassignment resets rootfs; the destination mounts its own Agent Workspace and Sessions. Hidden pause/resume within the same Agent retains rootfs and process state. Release also drains an existing binding automatically; it does not delete Agent files or Sessions.
220
221
 
221
222
  `tonbo agent list` lists accessible Agents without requiring a local `.tonbo` file. JSON command output uses `agent` for one Agent and `agents` for the list; there is no duplicate `agent` output alias.
223
+
224
+ Persist the allocation request UUID before sending when automating. Reuse it with the same account and region after a lost response; lookup returns the original Machine even after release. Omitting `--request-id` generates one, included in the success output or retry error.
package/dist/bin/tonbo.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/app.ts
4
+ import { randomUUID as randomUUID4 } from "node:crypto";
4
5
  import { Command } from "commander";
5
6
  import { readFileSync } from "node:fs";
6
7
 
@@ -2719,13 +2720,33 @@ function createProgram(dependencies = createDependencies) {
2719
2720
  )
2720
2721
  );
2721
2722
  });
2722
- machine.command("allocate").requiredOption("--account <account>", "owning account UUID").requiredOption("--region <region>", "compute region (see tonbo region list)").action(async (options) => {
2723
+ machine.command("allocate").requiredOption("--account <account>", "owning account UUID").requiredOption("--region <region>", "compute region (see tonbo region list)").option(
2724
+ "--request-id <uuid>",
2725
+ "stable allocation request UUID; reuse it after an uncertain response"
2726
+ ).action(async (options) => {
2723
2727
  const deps = dependencies(jsonOutput(program));
2724
- deps.output(
2725
- await deps.api.machineRequest(await deps.auth.accessToken(), "", "POST", {
2728
+ const requestId = options.requestId ?? randomUUID4();
2729
+ try {
2730
+ const result = await deps.api.machineRequest(await deps.auth.accessToken(), "", "POST", {
2726
2731
  accountId: options.account,
2727
- region: options.region
2728
- })
2732
+ region: options.region,
2733
+ requestId
2734
+ });
2735
+ deps.output({ ...result, requestId });
2736
+ } catch (cause) {
2737
+ throw new Error(
2738
+ `Machine allocation was not confirmed. Retry with --request-id ${requestId} and the same account and region.`,
2739
+ { cause }
2740
+ );
2741
+ }
2742
+ });
2743
+ machine.command("allocation <requestId>").description("query the original Machine for an allocation request").requiredOption("--account <account>", "owning account UUID").action(async (requestId, options) => {
2744
+ const deps = dependencies(jsonOutput(program));
2745
+ deps.output(
2746
+ await deps.api.machineRequest(
2747
+ await deps.auth.accessToken(),
2748
+ `/allocations/${encodeURIComponent(requestId)}?account=${encodeURIComponent(options.account)}`
2749
+ )
2729
2750
  );
2730
2751
  });
2731
2752
  for (const operation of ["show", "metrics", "release"]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonbo/cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Deploy persistent Agents and manage their Machines from the command line.",
5
5
  "homepage": "https://tonbo.dev",
6
6
  "bugs": {