kylon-cli 0.2.0-next.151 → 0.2.0-next.154

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,11 +7,11 @@ Requires Node.js 22 or newer.
7
7
  ## Install
8
8
 
9
9
  The CLI is published to npm as
10
- [`kylon-cli`](https://www.npmjs.com/package/kylon-cli). The Web UI
11
- generates two separate commands an **install** step and a **run**
12
- step each with its own Copy button. Operators paste the install
13
- once per host (and any time they want to upgrade) and the run
14
- whenever they want to start the daemon.
10
+ [`kylon-cli`](https://www.npmjs.com/package/kylon-cli). The Web UI's
11
+ Onboarding tab provides one opaque `npx ... onboard --url ...` command
12
+ for the normal setup and re-onboarding flow. Its collapsed manual setup
13
+ shows the separate install and run commands documented below for recovery
14
+ and advanced operation.
15
15
 
16
16
  ### Step 1 — Install kylon (once per host, re-paste to upgrade)
17
17
 
@@ -36,15 +36,16 @@ Requirements: Node.js 22+ (npm ships with Node). Linux / macOS only
36
36
 
37
37
  ```bash
38
38
  kylon gateway run \
39
+ --session-dir ~/.kylon/agents/<agent-id> \
39
40
  --server-url https://<origin>/api \
40
41
  --provider codex \
41
42
  --api-key <agent-api-key>
42
43
  ```
43
44
 
44
- `gateway run` registers the session (writing `~/.kylon/gateway-session.json`
45
- with mode `0600`) and starts the daemon in one step. On the next
46
- invocation, if a session already exists, plain `kylon gateway run`
47
- without flags picks it up and jumps straight to start. See
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
48
49
  [Usage → Run](#run) for the full decision table. The daemon runs
49
50
  in the foreground until you stop it with `Ctrl+C`; hosts that want a
50
51
  supervised daemon typically wrap the same command in
@@ -94,6 +95,12 @@ by the displaced connection, and replaces the foreground daemon. If Codex or
94
95
  Claude Code is logged out, an interactive terminal launches the provider's own
95
96
  login flow and verifies authentication again before connecting.
96
97
 
98
+ Each invited agent is installed below `~/.kylon/agents/<agent-id>/`, so several
99
+ Claude Code, Codex, or mixed-provider agents can run on the same host without
100
+ sharing credentials or provider resume state. Different agents cannot use the
101
+ same canonical working directory; create a separate checkout or Git worktree for
102
+ each concurrently installed agent.
103
+
97
104
  Use `--workdir <path>` to select a different directory or `--no-start` to
98
105
  configure and validate without opening the long-running connection. Generic
99
106
  providers can supply their one-shot command with `--agent-command <command>`;
@@ -106,6 +113,7 @@ It composes `connect` + `start` into a single command.
106
113
 
107
114
  ```bash
108
115
  kylon gateway run \
116
+ --session-dir ~/.kylon/agents/agent_123 \
109
117
  --server-url https://api.p2.ai \
110
118
  --provider codex \
111
119
  --api-key pak_xxxxx
@@ -113,7 +121,7 @@ kylon gateway run \
113
121
 
114
122
  Decision table:
115
123
 
116
- | Saved session? | Flags passed? | What `run` does |
124
+ | Saved session in `--session-dir`? | Connection flags passed? | What `run` does |
117
125
  |---|---|---|
118
126
  | no | `--server-url` + `--api-key` + `--provider` | connect, persist session, start daemon |
119
127
  | no | any field missing | error — lists the missing flag |
@@ -142,6 +150,10 @@ The agent's API key identifies which agent the daemon will serve;
142
150
  channels are bound separately via the "invite agent into channel" flow
143
151
  in the web UI.
144
152
 
153
+ `--session-dir` selects the full isolated state root for one agent. It is
154
+ not a connection override, so it must be present both when connecting and
155
+ when restarting that agent.
156
+
145
157
  ### Bind
146
158
 
147
159
  Create or update a logical session binding for an agent. Run from the
@@ -181,6 +193,7 @@ arrives on — see
181
193
  | `--server-url <url>` | P2 server URL (required for the first run; override otherwise) |
182
194
  | `--api-key <key>` | Agent API key, e.g. `pak_xxx` (required for first run; override otherwise. `KYLON_API_KEY` env var satisfies the first-run requirement but does not count as an override on subsequent runs) |
183
195
  | `--provider <name>` | Provider CLI: `codex`, `claude-code`, `hermes`, `openclaw`, `generic` (required for first run; override otherwise) |
196
+ | `--session-dir <path>` | Isolated state directory for this agent (normally `~/.kylon/agents/<agent-id>`) |
184
197
 
185
198
  ### Connect Options
186
199
 
@@ -189,6 +202,7 @@ arrives on — see
189
202
  | `--server-url <url>` | P2 server URL (required) |
190
203
  | `--api-key <key>` | Agent API key, e.g. `pak_xxx` (required, or set `KYLON_API_KEY`) |
191
204
  | `--provider <name>` | Provider CLI: `codex`, `claude-code`, `hermes`, `openclaw`, `generic` (required) |
205
+ | `--session-dir <path>` | Isolated state directory for this agent |
192
206
 
193
207
  ### Bind Options
194
208
 
@@ -197,6 +211,15 @@ arrives on — see
197
211
  | `--agent <id>` | Agent ID (required) |
198
212
  | `--provider <name>` | Provider CLI (required for new, optional for update) |
199
213
  | `--workdir <path>` | Working directory (default: current directory) |
214
+ | `--session-dir <path>` | Isolated state directory for this agent |
215
+
216
+ ### Start Options
217
+
218
+ | Flag | Description |
219
+ |---|---|
220
+ | `--server-url <url>` | Override the server URL from the saved session |
221
+ | `--api-key <key>` | Override the API key from the saved session |
222
+ | `--session-dir <path>` | Isolated state directory containing this agent's saved session, bindings, and provider runtime cache |
200
223
 
201
224
  ### Supported Providers
202
225
 
@@ -210,15 +233,18 @@ arrives on — see
210
233
 
211
234
  ## State Model
212
235
 
213
- The CLI uses a three-layer state model:
236
+ The CLI uses a per-agent installation profile and three runtime-state layers:
214
237
 
215
- - **GatewaySession** — authenticated connection to the P2 server (one per machine)
238
+ - **InstalledAgentProfile** — non-secret agent identity, provider, and exclusive workdir ownership
239
+ - **GatewaySession** — authenticated connection to the P2 server for one agent
216
240
  - **LogicalSessionState** — per-`(gateway session, agent)` binding holding the current workdir and provider
217
241
  - **ProviderRuntimeEntry** — per-conversation provider resume cache, keyed by `(gateway session, channel, agent, scope, provider, workdir)` (disposable)
218
242
 
219
243
  Switching workdir updates the logical session without creating a new one. Provider runtimes are cached per workdir + conversation scope — switching back resumes the old runtime.
220
244
 
221
- State is persisted to `~/.kylon/` (or `$XDG_CONFIG_HOME/kylon/`).
245
+ Agent state is persisted to `~/.kylon/agents/<agent-id>/` (or
246
+ `$XDG_CONFIG_HOME/kylon/agents/<agent-id>/`). Human workspace authentication
247
+ remains in the top-level Kylon config directory.
222
248
 
223
249
  ## Development
224
250