kylon-cli 0.2.2-next.227 → 0.2.2-next.229
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 +66 -177
- package/dist/kylon-bundle.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,56 +1,39 @@
|
|
|
1
1
|
# kylon-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Computer host CLI for running external agents on your own machine for a P2
|
|
4
|
+
workspace.
|
|
4
5
|
|
|
5
6
|
Requires Node.js 22.15.0 or newer.
|
|
6
7
|
|
|
7
8
|
## Install
|
|
8
9
|
|
|
9
10
|
The CLI is published to npm as
|
|
10
|
-
[`kylon-cli`](https://www.npmjs.com/package/kylon-cli). The Web UI
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
[`kylon-cli`](https://www.npmjs.com/package/kylon-cli). The Web UI provides
|
|
12
|
+
two copy-paste entry points, both built on `kylon connect`:
|
|
13
|
+
|
|
14
|
+
- **Workspace Settings → Kylon CLI** shows
|
|
15
|
+
`npx --yes kylon-cli@<tag> connect --workspace <id>` — registers this machine
|
|
16
|
+
as a computer for the workspace and runs the host daemon. Agents are then
|
|
17
|
+
assigned to the computer from the web.
|
|
18
|
+
- **An external agent's Settings page** (and the create-agent flow) shows
|
|
19
|
+
`npx --yes kylon-cli@<tag> connect --url '<setup url>'` — same registration,
|
|
20
|
+
plus the named agent is assigned to this computer in the same run. The setup
|
|
21
|
+
URL carries intent only (workspace + agent), never a credential, and expires
|
|
22
|
+
after an hour.
|
|
23
|
+
|
|
24
|
+
Both commands browser-authenticate the operator, enroll the computer (minting a
|
|
25
|
+
machine-scoped credential stored locally with mode `0600`), and start the host
|
|
26
|
+
daemon. In release builds on supported hosts a user-level
|
|
27
|
+
`launchd` / `systemd --user` service is installed so the daemon survives
|
|
28
|
+
terminal exit, reboot, and sleep/wake; otherwise the daemon runs in the
|
|
29
|
+
foreground until `Ctrl+C`.
|
|
30
|
+
|
|
31
|
+
The dist-tag tracks the environment: production uses `@latest`, dev uses
|
|
32
|
+
`@next` (newest prerelease). To pin a specific build, use `kylon-cli@X.Y.Z`.
|
|
31
33
|
|
|
32
34
|
Requirements: Node.js 22.15.0+ (npm ships with Node). Linux / macOS only
|
|
33
35
|
(Windows operators should use WSL).
|
|
34
36
|
|
|
35
|
-
### Step 2 — Start the gateway daemon
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
kylon gateway run \
|
|
39
|
-
--session-dir ~/.kylon/agents/<agent-id> \
|
|
40
|
-
--server-url https://<origin>/api \
|
|
41
|
-
--provider codex \
|
|
42
|
-
--api-key <agent-api-key>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
`gateway run` registers the session inside the selected agent directory
|
|
46
|
-
(writing `~/.kylon/agents/<agent-id>/gateway-session.json` with mode `0600`)
|
|
47
|
-
and starts the daemon in one step. On the next invocation, pass the same
|
|
48
|
-
`--session-dir` without connection flags to jump straight to start. See
|
|
49
|
-
[Usage → Run](#run) for the full decision table. The daemon runs
|
|
50
|
-
in the foreground until you stop it with `Ctrl+C`; hosts that want a
|
|
51
|
-
supervised daemon typically wrap the same command in
|
|
52
|
-
`launchd` / `systemd` / `supervisord`.
|
|
53
|
-
|
|
54
37
|
### Local development (contributors)
|
|
55
38
|
|
|
56
39
|
```bash
|
|
@@ -128,11 +111,12 @@ state:
|
|
|
128
111
|
|
|
129
112
|
- Use `kylon workspace secret list|set|delete` for canonical workspace secrets
|
|
130
113
|
with browser authorization.
|
|
131
|
-
- Use `kylon gateway secret list|set|delete
|
|
132
|
-
|
|
114
|
+
- Use `kylon gateway secret list|set|delete --agent <agent-id>` for agent-local
|
|
115
|
+
records, authenticated by this machine's computer credential through the
|
|
116
|
+
per-agent computer routes.
|
|
133
117
|
|
|
134
118
|
This separation prevents browser credentials from reaching the
|
|
135
|
-
|
|
119
|
+
daemon-authenticated secret endpoints and avoids state-dependent command
|
|
136
120
|
routing.
|
|
137
121
|
|
|
138
122
|
```bash
|
|
@@ -151,161 +135,66 @@ Credentials created by the earlier browser flow appear as **Legacy user API
|
|
|
151
135
|
key** in Settings. They can be revoked there, but they are not bound to a single
|
|
152
136
|
workspace; sign in again to replace one with the per-installation flow.
|
|
153
137
|
|
|
154
|
-
###
|
|
138
|
+
### Connect a computer (and optionally an agent)
|
|
155
139
|
|
|
156
|
-
|
|
157
|
-
created:
|
|
140
|
+
`kylon connect` is the single onboarding entrypoint.
|
|
158
141
|
|
|
159
142
|
```bash
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
The command resolves the invitation without printing its API key, checks the
|
|
165
|
-
local provider, verifies Codex or Claude Code authentication, connects the
|
|
166
|
-
gateway, binds a managed per-agent working directory, and installs or updates a
|
|
167
|
-
user-level `launchd` / `systemd --user` service running the unified gateway. The
|
|
168
|
-
command returns after the service is active; the gateway then survives terminal
|
|
169
|
-
exit, crash restart, reboot, and sleep/wake reconnects. Re-onboarding the same
|
|
170
|
-
agent preserves its registered provider and directory, safely interrupts
|
|
171
|
-
unfinished work owned by the displaced connection, and reconciles only that
|
|
172
|
-
agent inside the existing daemon. If Codex or Claude Code is logged out, an
|
|
173
|
-
interactive terminal launches the provider's own login flow and verifies
|
|
174
|
-
authentication again before connecting.
|
|
175
|
-
|
|
176
|
-
External-agent onboarding is intentionally separate from human `kylon auth
|
|
177
|
-
login`: it continues to use the agent principal's API key and gateway session.
|
|
178
|
-
It does not create a human CLI installation credential.
|
|
179
|
-
|
|
180
|
-
Each invited agent is installed below `~/.kylon/agents/<agent-id>/`, so several
|
|
181
|
-
Claude Code, Codex, or mixed-provider agents can run on the same host without
|
|
182
|
-
sharing credentials or provider resume state. Different agents cannot use the
|
|
183
|
-
same canonical working directory; create a separate checkout or Git worktree for
|
|
184
|
-
each concurrently installed agent.
|
|
185
|
-
|
|
186
|
-
Use `--workdir <path>` to select a different directory or `--no-start` to
|
|
187
|
-
configure and validate without opening the long-running connection. Generic
|
|
188
|
-
providers can supply their one-shot command with `--agent-command <command>`;
|
|
189
|
-
an interactive terminal prompts for it when the flag is omitted.
|
|
190
|
-
|
|
191
|
-
### Run
|
|
192
|
-
|
|
193
|
-
`gateway run` is the recommended entrypoint for external agent operators.
|
|
194
|
-
It composes `connect` + `start` into a single command.
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
kylon gateway run \
|
|
198
|
-
--session-dir ~/.kylon/agents/agent_123 \
|
|
199
|
-
--server-url https://api.p2.ai \
|
|
200
|
-
--provider codex \
|
|
201
|
-
--api-key pak_xxxxx
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
Decision table:
|
|
205
|
-
|
|
206
|
-
| Saved session in `--session-dir`? | Connection flags passed? | What `run` does |
|
|
207
|
-
|---|---|---|
|
|
208
|
-
| no | `--server-url` + `--api-key` + `--provider` | connect, persist session, start daemon |
|
|
209
|
-
| no | any field missing | error — lists the missing flag |
|
|
210
|
-
| yes | none | start the daemon from the saved session |
|
|
211
|
-
| yes | any | reconnect with the overrides (falls back to saved values for fields you didn't pass), persist the refreshed session, start the daemon |
|
|
143
|
+
# From Workspace Settings — register this machine, assign agents from the web:
|
|
144
|
+
npx --yes kylon-cli@latest connect --workspace <WORKSPACE_ID>
|
|
212
145
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
daemon image. With a saved session, the saved key remains authoritative and
|
|
216
|
-
any inherited `KYLON_API_KEY` is removed before the daemon starts.
|
|
217
|
-
|
|
218
|
-
### Connect
|
|
219
|
-
|
|
220
|
-
Register this machine as the gateway client for an external agent.
|
|
221
|
-
Most operators should prefer `gateway run` above. Use `connect` on its
|
|
222
|
-
own when scripting or when you need to register a session without
|
|
223
|
-
immediately starting the daemon.
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
kylon gateway connect \
|
|
227
|
-
--server-url https://api.p2.ai \
|
|
228
|
-
--api-key pak_xxxxx \
|
|
229
|
-
--provider codex
|
|
146
|
+
# From an agent's page — register this machine AND assign that agent to it:
|
|
147
|
+
npx --yes kylon-cli@latest connect --url 'https://api.kylon.io/docs/computer-setup/<opaque-token>'
|
|
230
148
|
```
|
|
231
149
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
150
|
+
Both forms browser-authenticate the operator (same PKCE flow as
|
|
151
|
+
`kylon auth login`), enroll the machine as a **computer** keyed on its stable
|
|
152
|
+
install id (re-running is idempotent), persist the machine-scoped credential,
|
|
153
|
+
and start the host daemon. The `--url` form resolves the setup link to a
|
|
154
|
+
workspace + agent and, after enrollment, assigns that agent to this computer —
|
|
155
|
+
authorized as the signed-in user, so an account that cannot manage the agent
|
|
156
|
+
gets a clear error and the computer registration still stands.
|
|
157
|
+
|
|
158
|
+
The daemon then reconciles the computer's assigned agents from the server:
|
|
159
|
+
each agent gets an isolated state root under `~/.kylon/agents/<agent-id>/`,
|
|
160
|
+
provider readiness (Codex / Claude Code install + authentication) is reported
|
|
161
|
+
per agent, and assignments arrive over the computer's single SSE stream.
|
|
162
|
+
Assigning, moving, or unassigning agents later happens in the web UI; the
|
|
163
|
+
daemon picks the change up without re-running `connect`.
|
|
164
|
+
|
|
165
|
+
Use `--no-start` to register without starting the daemon, `--json` for
|
|
166
|
+
machine-readable output, and `--server-url` to target a non-default API origin
|
|
167
|
+
(the `--url` form resolves the origin from the setup link itself).
|
|
241
168
|
|
|
242
|
-
|
|
243
|
-
target working directory:
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
kylon gateway bind \
|
|
247
|
-
--agent agent_123 \
|
|
248
|
-
--provider codex
|
|
249
|
-
```
|
|
169
|
+
### Run
|
|
250
170
|
|
|
251
|
-
|
|
171
|
+
`gateway run` starts the host daemon from this machine's saved computer
|
|
172
|
+
registration. It is the command the installed `launchd` / `systemd --user`
|
|
173
|
+
service execs; run it manually to host agents in the foreground.
|
|
252
174
|
|
|
253
175
|
```bash
|
|
254
|
-
|
|
255
|
-
kylon gateway bind --agent agent_123 --workdir .
|
|
176
|
+
kylon gateway run
|
|
256
177
|
```
|
|
257
178
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
arrives on — see
|
|
261
|
-
[`docs/journal_docs/05_27_gateway_routing_simplification.md`](../../docs/journal_docs/05_27_gateway_routing_simplification.md).
|
|
179
|
+
It takes no connection flags: register first with `kylon connect`. Without a
|
|
180
|
+
saved computer registration it exits with an error pointing there.
|
|
262
181
|
|
|
263
182
|
### Commands
|
|
264
183
|
|
|
265
184
|
| Command | Description |
|
|
266
185
|
|---|---|
|
|
267
|
-
| `kylon
|
|
268
|
-
| `kylon gateway
|
|
269
|
-
| `kylon gateway bind` | Create or update a logical session binding. |
|
|
270
|
-
| `kylon gateway start` | Start the gateway daemon from a saved session — opens the SSE stream and executes assignments. Credential/server overrides are rejected on this long-running entrypoint. |
|
|
271
|
-
|
|
272
|
-
### Run Options
|
|
273
|
-
|
|
274
|
-
| Flag | Description |
|
|
275
|
-
|---|---|
|
|
276
|
-
| `--server-url <url>` | P2 server URL (required for the first run; override otherwise) |
|
|
277
|
-
| `--api-key <key>` | Agent API key, e.g. `pak_xxx` (required for first run; override otherwise. `KYLON_API_KEY` satisfies first-run setup and is removed from the daemon environment after the key is persisted) |
|
|
278
|
-
| `--provider <name>` | Provider CLI: `codex`, `claude-code`, `hermes`, `openclaw`, `generic` (required for first run; override otherwise) |
|
|
279
|
-
| `--session-dir <path>` | Isolated state directory for this agent (normally `~/.kylon/agents/<agent-id>`) |
|
|
186
|
+
| `kylon connect` | **Recommended.** Register this computer (browser auth + enrollment) and run the host daemon. `--url` also assigns one agent. |
|
|
187
|
+
| `kylon gateway run` | Run the host daemon from the saved computer registration (service entrypoint). |
|
|
280
188
|
|
|
281
189
|
### Connect Options
|
|
282
190
|
|
|
283
191
|
| Flag | Description |
|
|
284
192
|
|---|---|
|
|
285
|
-
| `--
|
|
286
|
-
| `--
|
|
287
|
-
| `--
|
|
288
|
-
| `--
|
|
289
|
-
|
|
290
|
-
### Bind Options
|
|
291
|
-
|
|
292
|
-
| Flag | Description |
|
|
293
|
-
|---|---|
|
|
294
|
-
| `--agent <id>` | Agent ID (required) |
|
|
295
|
-
| `--provider <name>` | Provider CLI (required for new, optional for update) |
|
|
296
|
-
| `--workdir <path>` | Working directory (default: current directory) |
|
|
297
|
-
| `--session-dir <path>` | Isolated state directory for this agent |
|
|
298
|
-
|
|
299
|
-
### Start Options
|
|
300
|
-
|
|
301
|
-
| Flag | Description |
|
|
302
|
-
|---|---|
|
|
303
|
-
| `--session-dir <path>` | Isolated state directory containing this agent's saved session, bindings, and provider runtime cache |
|
|
304
|
-
|
|
305
|
-
`gateway start` accepts credentials and the server origin only from the saved
|
|
306
|
-
session. Use `gateway run` when a credential or origin must be supplied or
|
|
307
|
-
changed; it persists the session and replaces the process with a credential-free
|
|
308
|
-
daemon image before opening SSE.
|
|
193
|
+
| `--workspace <id>` | Workspace to register this computer with |
|
|
194
|
+
| `--url <setup url>` | Agent setup link from Kylon; implies the workspace and assigns that agent after enrollment (alternative to `--workspace`) |
|
|
195
|
+
| `--server-url <url>` | API server URL (defaults to `https://api.kylon.io`; ignored in favor of the origin resolved from `--url`) |
|
|
196
|
+
| `--no-start` | Register only; do not start the daemon |
|
|
197
|
+
| `--json` | Emit machine-readable JSON |
|
|
309
198
|
|
|
310
199
|
### Supported Providers
|
|
311
200
|
|