@tonbo/cli 0.0.6 → 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.
package/README.md CHANGED
@@ -7,41 +7,76 @@ npm install --global @tonbo/cli
7
7
  tonbo --version
8
8
  ```
9
9
 
10
- The V1 CLI deploys a PI-based 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
- ? Agent shape: [1] PI project [2] PI Package project [3] PI SDK app [1]:
15
- ? Inference model [claude-sonnet-4-5]:
16
- Created .tonbo.
17
- Next: tonbo project create <slug>
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
37
+ Harness: PI
38
+ Mode: PI CLI
39
+ Next: tonbo deploy
18
40
  ```
19
41
 
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.
43
+
20
44
  The generated `.tonbo` is TOML:
21
45
 
22
46
  ```toml
23
- 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"
24
51
 
25
- [agent]
52
+ [harness]
26
53
  runtime = "pi"
27
54
 
28
- [agent.driver]
55
+ [harness.driver]
29
56
  kind = "native"
30
57
 
31
58
  [inference]
32
59
  model = "claude-sonnet-4-5"
33
60
  ```
34
61
 
35
- For automation, use `tonbo init --model <model>`; an existing declaration requires interactive confirmation or `--force`. Then authenticate, bind the directory and deploy its current contents:
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`:
65
+
66
+ ```console
67
+ tonbo init --harness pi --driver native
68
+ tonbo init --harness pi --driver command --agent-entry dist/agent.mjs
69
+ tonbo project use my-project-my-account.tonbo.sh
70
+ ```
71
+
72
+ After interactive initialization, deploy the current contents:
36
73
 
37
74
  ```console
38
- tonbo login
39
- tonbo project create my-project
40
75
  tonbo deploy
41
76
  tonbo run "Reply with exactly READY."
42
77
  ```
43
78
 
44
- 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.
45
80
 
46
81
  `run` creates a durable Session and prints its ID in `--json` output. Pass that identity back to continue the same PI conversation:
47
82
 
@@ -49,23 +84,52 @@ Use `tonbo project use my-project` instead when the Project already exists.
49
84
  tonbo run --session 4d8e9501-... "Continue the previous task."
50
85
  ```
51
86
 
52
- 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:
53
88
 
54
89
  ```console
55
- tonbo ssh
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:
108
+
109
+ ```console
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
56
116
  ```
57
117
 
58
- `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:
59
121
 
60
122
  ```console
61
- ssh my-project@tonbo.sh
123
+ ssh my-project.my-account@tonbo.sh
62
124
  ```
63
125
 
64
- 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.
65
129
 
66
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`.
67
131
 
68
- 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.
69
133
 
70
134
  ## Supported PI project shapes
71
135
 
@@ -76,14 +140,13 @@ Keep the normal PI project layout. Tonbo runs the same `AGENTS.md`, `.pi/APPEND_
76
140
  ```console
77
141
  pi
78
142
  tonbo init
79
- tonbo project create my-agent
80
143
  tonbo deploy
81
144
  tonbo run "Start the task."
82
145
  ```
83
146
 
84
147
  ### 2. PI Package project
85
148
 
86
- Use PI's project-local package declaration as the single source of truth. Install an immutable package reference locally, verify it with PI, and deploy the project; Tonbo excludes `.pi/npm` and `.pi/git` caches and restores packages inside the isolated runtime:
149
+ Use PI's project-local package declaration as the single source of truth. A package is a PI resource, not another Tonbo execution mode: `tonbo init` recognizes `.pi/settings.json`, then the native PI driver loads the packages. Install an immutable package reference locally, verify it with PI, and deploy the project; Tonbo excludes `.pi/npm` and `.pi/git` caches and restores packages inside the isolated runtime:
87
150
 
88
151
  ```console
89
152
  pi install -l npm:@acme/my-pi-agent@1.2.3
@@ -96,16 +159,16 @@ Remote npm packages must use an exact version. Git packages must use a full 40-c
96
159
 
97
160
  ### 3. PI SDK app
98
161
 
99
- Choose `PI SDK app` in `tonbo init`, 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:
100
163
 
101
164
  ```toml
102
- version = 1
165
+ version = 2
103
166
 
104
- [agent]
167
+ [harness]
105
168
  runtime = "pi"
106
169
  secrets = ["GITHUB_TOKEN"]
107
170
 
108
- [agent.driver]
171
+ [harness.driver]
109
172
  kind = "command"
110
173
  protocol = "pi-rpc-v1"
111
174
  command = ["node", "dist/agent.mjs"]
@@ -119,11 +182,11 @@ model = "claude-sonnet-4-5"
119
182
 
120
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.
121
184
 
122
- 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:
123
186
 
124
187
  ```console
125
- TONBO_ACCESS_TOKEN=... tonbo --json deploy --project project-id
126
- 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"
127
190
  ```
128
191
 
129
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.
@@ -131,6 +194,9 @@ Node.js 22 or newer is required. Human OAuth tokens are stored at `${XDG_CONFIG_
131
194
  ## Related design
132
195
 
133
196
  - [Design documentation map](../../docs/design/README.md)
197
+ - [Agent source inspection and onboarding](../../docs/design/agent-source-onboarding.md)
198
+ - [Shared source inspector](../../packages/agent-source-inspector/README.md)
134
199
  - [Project resource model](../../docs/design/project-resource-model.md)
200
+ - [Project Deployments, Production and Rollouts](../../docs/design/project-deployments.md)
135
201
  - [ADR-0008: Tonbo CLI onboarding and credential boundaries](../../apps/user-center/docs/decisions/adr-0008-tonbo-cli-onboarding.md)
136
202
  - [Management API v1](../../contracts/management/openapi-v1.yaml)