@haven_ai/connect 0.1.29-alpha.0 → 0.1.30-alpha.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
@@ -175,16 +175,104 @@ already-configured machine behaves as follows (characterized in
175
175
  - **Runtime MCP entries are replaced, not duplicated**: Connect owns the
176
176
  `haven` and `haven-signer` entries (and the managed Codex/Hermes
177
177
  equivalents) and re-points them at the newest agent's credentials.
178
- Unrelated MCP servers and configuration are preserved. One runtime is
179
- therefore wired to one Haven agent — the newest one.
178
+ Unrelated MCP servers and configuration are preserved. Without `--name`, one
179
+ runtime is therefore wired to one Haven agent — the newest one. With
180
+ `--name`, each agent owns its own suffixed pair and they coexist; see
181
+ [Running several agents in one runtime](#running-several-agents-in-one-runtime).
180
182
  - **The previous agent is not revoked by a re-run.** Its credentials remain on
181
183
  disk and its authority remains whatever its on-chain rules say. Revoke
182
184
  agents you no longer use from the Haven dashboard, then delete their
183
185
  credential directories.
184
- - **Connect never overwrites an existing credential file.** A write that would
186
+ - **A re-run never overwrites an existing credential file.** A write that would
185
187
  collide with an existing `identity.json`/`signer.json`/`agent.json` is
186
188
  refused outright (and a partially failed write rolls itself back), so a
187
- re-run cannot corrupt stored key material.
189
+ re-run cannot corrupt stored key material. **`--rekey` is the one exception,
190
+ and it is a different operation** — it deliberately replaces a credential set
191
+ in place, at an unchanged path, and is the supported way to replace a key
192
+ rather than accumulate agents. See
193
+ [Replacing an agent's signing key](#replacing-an-agents-signing-key-rekey).
194
+
195
+ ## Running several agents in one runtime
196
+
197
+ `--name <slug>` gives an agent its own MCP server pair and its own credential
198
+ directory, so several agents coexist in one runtime instead of replacing each
199
+ other:
200
+
201
+ ```sh
202
+ npx -y @haven_ai/connect@alpha --setup hv_setup_... --api https://api.haven.example \
203
+ --name research --runtime claude-code
204
+ ```
205
+
206
+ | | Without `--name` | With `--name research` |
207
+ |---|---|---|
208
+ | MCP entries | `haven`, `haven-signer` | `haven-research`, `haven-signer-research` |
209
+ | Credentials | `~/.haven/agents/<agent-id>/` | `~/.haven/agents/research/` |
210
+
211
+ A writer only ever touches the pair it owns, so adding a named agent cannot
212
+ disturb the bare pair or another named one. Omitting `--name` is byte-identical
213
+ to how the connector behaved before named pairs existed, so nothing already
214
+ wired needs changing.
215
+
216
+ The slug is **1–32 lowercase letters, digits and single hyphens**, validated
217
+ before anything is written, and **immutable once wired** — it is the server name
218
+ and tool prefix every host depends on. `haven`, `signer` and `signer-*` are
219
+ refused, because their derived names would collide with another pair's.
220
+
221
+ > A current connector reports the resolved server name (`haven`, or
222
+ > `haven-<slug>`) to Haven at registration, and the dashboard shows it on each
223
+ > agent, so you can match an agent to its config entry without leaving the
224
+ > browser ([#1878](https://github.com/d-hinders/Haven-AI/issues/1878)). It is a
225
+ > label, not authority — nothing keys off it.
226
+ >
227
+ > Agents connected before that shipped read **"MCP name not recorded"**: Haven
228
+ > genuinely does not know, and guessing would name the wrong pair for anyone who
229
+ > used `--name`. They keep working exactly as they are; `--doctor` on the machine
230
+ > still maps them, and reconnecting records the name.
231
+
232
+ ## Replacing an agent's signing key (`--rekey`)
233
+
234
+ If an agent's signing key is lost or exposed, replace it: same agent, same name,
235
+ same history, new key. This does **not** create a new agent, and it is not the
236
+ same as running setup again.
237
+
238
+ Re-key is authorised by the **account owner in the dashboard** — the connector
239
+ never calls Haven's re-key endpoints, which refuse an agent credential by
240
+ design. So it runs in two phases with the dashboard between them:
241
+
242
+ ```sh
243
+ # 1. On this machine: generate the new key, print its public address.
244
+ npx -y @haven_ai/connect@alpha --rekey [--name research]
245
+
246
+ # 2. In the dashboard: agent → Replace signing key → paste that address.
247
+ # Sign the steps. It shows a new API key ONCE.
248
+
249
+ # 3. Back here: write the new credentials and rewire this agent's MCP pair.
250
+ npx -y @haven_ai/connect@alpha --rekey-finish --api-key sk_agent_... \
251
+ --runtime claude-code [--name research]
252
+ ```
253
+
254
+ Between the two phases nothing has changed: the agent keeps working on its old
255
+ key until you finish. Phase one refuses up front what the backend would refuse
256
+ anyway — a legacy-rail account, a revoked agent — so you find out before signing
257
+ anything. Phase two refuses to write unless the pasted key authenticates,
258
+ belongs to **this** agent, and Haven's recorded signing address matches the one
259
+ this machine generated.
260
+
261
+ **Pass `--runtime` on the finish step.** Your API key lives inside the MCP config
262
+ as well as in the credential files, so without it the credentials are correct and
263
+ every wired host still presents the retired key and fails with 401.
264
+
265
+ **Then restart every long-lived host** — not just the one in front of you. Each
266
+ long-running process loaded its wiring at startup and is still holding the old
267
+ key. The connector prints the exact restart command for your runtime; the sweep
268
+ across the rest is yours.
269
+
270
+ > **If the key is lost, check for a balance on it first.** An agent's delegate
271
+ > address can hold a small amount from x402 settlement, and sweeping it needs a
272
+ > signature from that key. After a re-key it is unrecoverable — by you and by
273
+ > Haven. Haven's preflight reads the balance and refuses until you say what
274
+ > happened to it. Full detail:
275
+ > [Replacing an agent's signing key](../../docs/product/agent-key-rotation.md).
188
276
 
189
277
  ## Diagnosing a stuck setup: `--doctor` / `--repair` (#1589)
190
278