@tonbo/cli 0.0.7 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +81 -29
  2. package/dist/bin/tonbo.js +937 -289
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -7,53 +7,76 @@ npm install --global @tonbo/cli
7
7
  tonbo --version
8
8
  ```
9
9
 
10
- The CLI deploys an Agent directly from a local directory without requiring Git or Tonbo calls in the Agent source. Initialize the current directory interactively:
10
+ The CLI deploys an Agent directly from a local directory without requiring Git or Tonbo calls in the Agent source. Sign in, then initialize the current directory interactively:
11
11
 
12
12
  ```console
13
+ tonbo login
13
14
  tonbo init
14
- ? How should Tonbo run this project?
15
- PI CLI (`pi`) Run pi directly with AGENTS.md and optional project-local .pi resources.
16
- PI SDK app Run a custom Node.js entrypoint built on the PI SDK.
17
- Created .tonbo.
15
+ No Harness-specific configuration was found in this project.
16
+ ? Which supported Harness should Tonbo use?
17
+ PI (`pi`) Run this project with the pi command.
18
+ ? How should this Agent connect to Tonbo?
19
+ ❯ Create a new project Create it only after you confirm the complete configuration.
20
+ Use an existing project
21
+ Set up later
22
+ ? Project name [my-agent]:
23
+
24
+ Tonbo Agent configuration:
25
+ Project: Create my-agent in my-account (permanent address assigned after creation)
26
+ Harness: PI
27
+ Execution: PI CLI (`pi`)
28
+ Model: claude-sonnet-4-5
29
+ ? Create project and .tonbo with this configuration?
30
+ ❯ Create project and .tonbo
31
+ Edit configuration Change the project, Harness, execution mode, model, or SDK entrypoint.
32
+ Cancel
33
+ Created project my-agent and .tonbo.
34
+ Project: my-agent (my-agent-my-account.tonbo.sh)
35
+ Organization: my-account
36
+ Application: https://my-agent-my-account.tonbo.sh
18
37
  Harness: PI
19
38
  Mode: PI CLI
20
- Next: tonbo project create <slug>
39
+ Next: tonbo deploy
21
40
  ```
22
41
 
23
- Use the arrow keys to select an available execution target and Enter to confirm. `AGENTS.md` is Harness-neutral and never identifies PI by itself. When `.pi/settings.json` exists, the shared source inspector identifies the PI Harness, reports its project-local packages, and narrows the prompt to the native PI or PI SDK execution modes. Unsupported and planned Harnesses are not shown.
42
+ Use the arrow keys and Enter to select a supported Harness and either create or select the one Project owned by this source tree. Project creation and file writes wait until the final review; cancelling leaves both local and cloud state unchanged. `AGENTS.md` is Harness-neutral and never identifies PI by itself. When `.pi/settings.json` exists, the shared source inspector identifies the PI Harness and reports its project-local packages. A regular PI project defaults to the native PI CLI; choose `Edit configuration` only when changing the Project, execution mode, model, or another setting. Unsupported and planned Harnesses are not shown.
24
43
 
25
44
  The generated `.tonbo` is TOML:
26
45
 
27
46
  ```toml
28
- version = 1
47
+ # Tonbo Project Agent configuration.
48
+ # Edit this file directly or run `tonbo init` to reconfigure.
49
+ version = 2
50
+ agent = "my-agent-my-account.tonbo.sh"
29
51
 
30
- [agent]
52
+ [harness]
31
53
  runtime = "pi"
32
54
 
33
- [agent.driver]
55
+ [harness.driver]
34
56
  kind = "native"
35
57
 
36
58
  [inference]
37
59
  model = "claude-sonnet-4-5"
38
60
  ```
39
61
 
40
- The default inference model is written without prompting. Override it explicitly with `--model`. Automation must make ambiguous choices explicit; an existing declaration requires interactive confirmation or `--force`:
62
+ The immutable full Project hostname is the only durable Project authority in the source tree; it is not a credential. This keeps Projects with the same name in different Organizations unambiguous. `deploy`, `run`, `ssh` and `secret` refuse an unbound declaration. `tonbo project use <name-hostname-or-id>` accepts any convenient selector, resolves it through the signed-in account and writes the selected `project-organization.tonbo.sh` hostname into `.tonbo`; rebinding an existing declaration requires interactive confirmation or `--force`. UUIDs remain internal API identities and are never committed by the CLI.
63
+
64
+ The default inference model is written without prompting. Override it explicitly with `--model`. Headless initialization makes Harness and driver choices explicit and may bind the resulting declaration with `project use`:
41
65
 
42
66
  ```console
43
67
  tonbo init --harness pi --driver native
44
68
  tonbo init --harness pi --driver command --agent-entry dist/agent.mjs
69
+ tonbo project use my-project-my-account.tonbo.sh
45
70
  ```
46
71
 
47
- Then authenticate, bind the directory and deploy its current contents:
72
+ After interactive initialization, deploy the current contents:
48
73
 
49
74
  ```console
50
- tonbo login
51
- tonbo project create my-project
52
75
  tonbo deploy
53
76
  tonbo run "Reply with exactly READY."
54
77
  ```
55
78
 
56
- Use `tonbo project use my-project` instead when the Project already exists.
79
+ Choose `Use an existing project` during `init` when the Project already exists. `tonbo project create <name>` and `tonbo project use <name-hostname-or-id>` remain explicit automation and recovery commands.
57
80
 
58
81
  `run` creates a durable Session and prints its ID in `--json` output. Pass that identity back to continue the same PI conversation:
59
82
 
@@ -61,23 +84,52 @@ Use `tonbo project use my-project` instead when the Project already exists.
61
84
  tonbo run --session 4d8e9501-... "Continue the previous task."
62
85
  ```
63
86
 
64
- Open the same singleton runtime and persistent `/workspace` interactively:
87
+ Every `tonbo deploy` creates one immutable Deployment: the uploaded source, the `.tonbo` settings and the git provenance of the source root (commit, branch, subject, author and whether the tree was dirty) when the directory is inside a git work tree. Git is optional; without it the Deployment records `tonbo deploy` as its source. Deployments are named by their commit subject, or by their short id (the first eight hex characters) when there is no commit, and every command that takes a Deployment accepts any unambiguous id prefix. The Project's Production pointer names the one Deployment that serves its hostname; `deploy` moves Production to the new Deployment and prints the Deployment, its Production state and the exact standard OpenSSH command for the bound Project and its username:
88
+
89
+ ```console
90
+ $ tonbo deploy
91
+ Deployed project my-project.
92
+ Organization: my-account
93
+ Deployment: Fix greeting (0f3a7c21)
94
+ Source: 0123456 · main
95
+ Production: promoting (generation 4)
96
+ Application: https://my-project-my-account.tonbo.sh
97
+
98
+ Agent process: starts with the first turn and stays warm while the runtime is active.
99
+
100
+ Start the Agent:
101
+ tonbo run "<prompt>"
102
+
103
+ Connect with SSH:
104
+ ssh my-project.my-account@tonbo.sh
105
+ ```
106
+
107
+ When the new Deployment has the same contents as the Production Deployment it replaces, `deploy` says so; the record is still created. `tonbo deploy --no-promote` creates the Deployment without moving Production, for example to stage a build and promote it later:
65
108
 
66
109
  ```console
67
- tonbo ssh
110
+ tonbo deploy --no-promote
111
+ tonbo deployments # ID NAME STATUS PRODUCTION SOURCE CREATED BY
112
+ tonbo deployments show 0f3a7c21 # datasheet and Rollouts for one Deployment
113
+ tonbo deployments promote 0f3a7c21 # move Production to a Deployment
114
+ tonbo deployments rollback # move Production back to the previous Production Deployment
115
+ tonbo deployments rollback 9b8c1d22 # or to a named one
68
116
  ```
69
117
 
70
- `tonbo login` registers public keys found at the conventional `~/.ssh/id_ed25519.pub`, `id_ecdsa.pub` and `id_rsa.pub` paths. Register a key at another path with `tonbo ssh-key add <path.pub>` and revoke a lost or retired key with `tonbo ssh-key remove SHA256:...`. After that, the CLI is not part of the SSH connection; ordinary OpenSSH works directly:
118
+ `tonbo deployments` (alias `tonbo deployments list`) marks the current Production Deployment with `●` and earlier ones with `○`; `STATUS` is the Deployment's relationship to Production: `current`, `promoting`, `failed`, `stopped`, `previous` or `none`. Promotion and rollback compare-and-swap the Production generation, so two people moving Production at once cannot silently overwrite each other; a conflict is reported and the command can be retried after checking `tonbo deployments`. `tonbo project show` prints the Production Deployment and its state alongside the Project addresses.
119
+
120
+ Use `tonbo project show` to rediscover the username, application address and SSH command later. `tonbo login` registers public keys found at the conventional `~/.ssh/id_ed25519.pub`, `id_ecdsa.pub` and `id_rsa.pub` paths. Register a key at another path with `tonbo ssh-key add <path.pub>` and revoke a lost or retired key with `tonbo ssh-key remove SHA256:...`. The CLI is not part of the SSH connection; ordinary OpenSSH, `scp` and `rsync` connect directly:
71
121
 
72
122
  ```console
73
- ssh my-project@tonbo.sh
123
+ ssh my-project.my-account@tonbo.sh
74
124
  ```
75
125
 
76
- The SSH username selects the globally unique Project; the signed public key identifies the Tonbo user and is checked against Project membership and IAM at connection time. The shell and HTTP turns may coexist on the singleton runtime, allowing the shell to observe the Agent while it works. Session writer fencing protects durable conversation history; ordinary workspace files retain Linux process concurrency semantics.
126
+ The SSH user name is the Project qualified by its username; the signed public key identifies the Tonbo user and is checked against membership and IAM at connection time. The CLI resolves the Project name in `.tonbo` and prints the server-authoritative destination, so users never need to remember or assemble a username. The shell and HTTP turns may coexist on the singleton runtime, allowing the shell to observe the Agent while it works. Session writer fencing protects durable conversation history; ordinary workspace files retain Linux process concurrency semantics.
127
+
128
+ Deploy does not create a hidden Session just to prewarm PI. The first real `tonbo run` starts the Session-bound PI RPC process; successful Turns keep that process hot, including across native Session switches. The process is disposable cache rather than durable state: pause, replacement and uncertain failures remove it, and the next Turn restores authority from the durable Session JSONL.
77
129
 
78
130
  The platform injects scoped inference access and owns PI Session capture. Do not put a model-provider API key or a Tonbo credential in `.tonbo`.
79
131
 
80
- Deploy snapshots regular files under `.tonbo`, excluding `.git`, `node_modules`, PI package caches, local environment files and patterns in `.tonboignore`. Equal contents produce the same revision. Coding tools start in the persistent Artifacts workspace, while `AGENTS.md` and trusted `.pi` extensions, skills, prompts and settings load from the uploaded revision.
132
+ Deploy snapshots regular files under `.tonbo`, excluding `.git`, `node_modules`, PI package caches, local environment files and patterns in `.tonboignore`. Coding tools start in the persistent Artifacts workspace, while `AGENTS.md` and trusted `.pi` extensions, skills, prompts and settings load from the Deployment's uploaded source.
81
133
 
82
134
  ## Supported PI project shapes
83
135
 
@@ -88,7 +140,6 @@ Keep the normal PI project layout. Tonbo runs the same `AGENTS.md`, `.pi/APPEND_
88
140
  ```console
89
141
  pi
90
142
  tonbo init
91
- tonbo project create my-agent
92
143
  tonbo deploy
93
144
  tonbo run "Start the task."
94
145
  ```
@@ -108,16 +159,16 @@ Remote npm packages must use an exact version. Git packages must use a full 40-c
108
159
 
109
160
  ### 3. PI SDK app
110
161
 
111
- Choose `PI SDK app` with the arrow selector, use `--driver command --agent-entry <file>` in automation, or declare a command driver directly:
162
+ Choose `Edit configuration`, change `Execution mode` to `PI SDK app`, and confirm the resulting summary. In automation, use `--driver command --agent-entry <file>`, or declare a command driver directly:
112
163
 
113
164
  ```toml
114
- version = 1
165
+ version = 2
115
166
 
116
- [agent]
167
+ [harness]
117
168
  runtime = "pi"
118
169
  secrets = ["GITHUB_TOKEN"]
119
170
 
120
- [agent.driver]
171
+ [harness.driver]
121
172
  kind = "command"
122
173
  protocol = "pi-rpc-v1"
123
174
  command = ["node", "dist/agent.mjs"]
@@ -131,11 +182,11 @@ model = "claude-sonnet-4-5"
131
182
 
132
183
  `tonbo deploy` runs the build command before creating the source snapshot. The entrypoint must keep stdout exclusively for PI RPC and send logs to stderr. It receives `PI_CODING_AGENT_MODULE`, `PI_CODING_AGENT_DIR`, `PI_CODING_AGENT_SESSION_DIR`, `TONBO_PI_SESSION_FILE`, `TONBO_PI_SESSION_ID`, `TONBO_PI_PROVIDER`, `TONBO_PI_MODEL` and `TONBO_PI_RPC_PROTOCOL`. Load the platform PI SDK from `PI_CODING_AGENT_MODULE`, open `TONBO_PI_SESSION_FILE`, create an `AgentSessionRuntime`, and pass it to `runRpcMode()`. This lets the app customize tools and runtime services without forking PI while preserving Tonbo's durable Session and Turn protocol.
133
184
 
134
- For a non-interactive invocation, provide a current Tonbo CLI OAuth access token and an explicit Project:
185
+ For a non-interactive invocation, provide a current Tonbo CLI OAuth access token; the committed `.tonbo` supplies the only Project context:
135
186
 
136
187
  ```console
137
- TONBO_ACCESS_TOKEN=... tonbo --json deploy --project project-id
138
- TONBO_ACCESS_TOKEN=... tonbo --json run --project project-id "health check"
188
+ TONBO_ACCESS_TOKEN=... tonbo --json deploy
189
+ TONBO_ACCESS_TOKEN=... tonbo --json run "health check"
139
190
  ```
140
191
 
141
192
  Node.js 22 or newer is required. Human OAuth tokens are stored at `${XDG_CONFIG_HOME:-$HOME/.config}/tonbo/credentials.json`; the CLI atomically replaces that file with owner-only permissions and never writes it into an Agent directory.
@@ -146,5 +197,6 @@ Node.js 22 or newer is required. Human OAuth tokens are stored at `${XDG_CONFIG_
146
197
  - [Agent source inspection and onboarding](../../docs/design/agent-source-onboarding.md)
147
198
  - [Shared source inspector](../../packages/agent-source-inspector/README.md)
148
199
  - [Project resource model](../../docs/design/project-resource-model.md)
200
+ - [Project Deployments, Production and Rollouts](../../docs/design/project-deployments.md)
149
201
  - [ADR-0008: Tonbo CLI onboarding and credential boundaries](../../apps/user-center/docs/decisions/adr-0008-tonbo-cli-onboarding.md)
150
202
  - [Management API v1](../../contracts/management/openapi-v1.yaml)