@haven_ai/connect 0.1.30-alpha.0 → 0.1.32-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
@@ -93,7 +93,7 @@ minutes. Two rules follow:
93
93
  2. **Tombstone a directory before (or instead of) deleting it:**
94
94
 
95
95
  ```
96
- npx @haven_ai/connect@alpha --tombstone ~/.haven/agents/<id> --reason "superseded"
96
+ npx @haven_ai/connect@alpha --tombstone ~/.haven/agents/<directory> --reason "superseded" --json
97
97
  ```
98
98
 
99
99
  This replaces the directory's signer wrapper with a diagnostic that logs the
@@ -103,6 +103,47 @@ minutes. Two rules follow:
103
103
  agent on the Haven agent page yourself. Delete the tombstone only once every
104
104
  long-lived host has been restarted.
105
105
 
106
+ **Pass a real DIRECTORY, not an agent id.** A named agent lives at its wiring
107
+ slug, which never equals its agent id — so `~/.haven/agents/<agent-id>` does
108
+ not exist for one, and the command refuses with
109
+ `tombstone_directory_not_found` having retired nothing. List `~/.haven/agents`
110
+ or read the `directory` values out of `--doctor --json`.
111
+
112
+ Under `--json`, success is `{"tombstoned": true, …}` on stdout with exit 0,
113
+ and a refusal is `{"tombstoned": false, "error": {"code", "next_action"}}`
114
+ with exit 1 — so check the result rather than assuming silence means success
115
+ (#2175). The `message` field is present only for connector-authored refusals;
116
+ an unexpected filesystem error keeps its raw text on stderr alone.
117
+
118
+ ### Unwiring an agent (`--unwire`, #2169)
119
+
120
+ Connect has always been able to *write* a pair into a runtime config and never
121
+ able to *erase* one — so a "reset" left the old `mcp_servers` pair and (on
122
+ Hermes) the `MCP_HAVEN_API_KEY` dotenv line behind, and the runtime quoted as
123
+ one agent while signing as another. `--unwire` is the erase half:
124
+
125
+ ```
126
+ npx @haven_ai/connect@alpha --unwire ~/.haven/agents/<directory> [--reason "..."]
127
+ npx @haven_ai/connect@alpha --unwire --name research [--reason "..."]
128
+ ```
129
+
130
+ It tombstone-first (so a stale long-lived host still hears `HAVEN-TOMBSTONE`,
131
+ never a masked `ENOENT`), then removes THAT agent's hosted + signer pair from
132
+ every runtime config it appears in (Hermes YAML, Codex TOML, the Cursor / VS
133
+ Code / Insiders / Claude Desktop JSON configs), plus the Hermes dotenv API-key
134
+ line — bare `MCP_HAVEN_API_KEY` or named `MCP_HAVEN_<SLUG>_API_KEY`. Finally it
135
+ tears down the target directory's local key material (signer key, any abandoned
136
+ re-key, the stored API key) so `--doctor` reports `retired`, not the
137
+ still-spend-capable `superseded`; the #2155 tombstone mirror keeps the record.
138
+
139
+ An **unnamed** pair (`haven` / `haven-signer`) is shared by every unnamed agent
140
+ and is only removed when this directory's wrapper is the one the config
141
+ launches (or its key is the one the Hermes env holds) — otherwise `--unwire`
142
+ **refuses** rather than unwire a different, working agent. Nothing is ever
143
+ revoked on the backend; `connect reports, the user decides` (#1688) survives,
144
+ and revocation stays an owner action on the Haven agent page. Restart every
145
+ long-lived host afterwards, as with any retirement.
146
+
106
147
  ### Structured output for automation
107
148
 
108
149
  Pass `--json` when a launcher needs a machine-readable completion record. Connect
@@ -113,17 +154,48 @@ budget-approval wait so the record is emitted promptly; approve in the Haven
113
154
  dashboard whenever ready and verify later with the read-only `haven_get_agent`
114
155
  tool. The object includes runtime/topology status,
115
156
  probe result, activation and next-action guidance, approval state/expiry (null
116
- when the backend does not provide an approval expiry), and the two
117
- read-only verification tools. It contains no API key, private key, credential
157
+ when the backend does not provide an approval expiry), the two
158
+ read-only verification tools, `hosted_mcp_url`, and `superseded_agent_ids`. It
159
+ contains no API key, private key, credential
118
160
  contents, full credential paths, or full delegate address. The same redacted
119
161
  object is available to library callers as `runConnect(...).outcome`; the older
120
162
  fields remain for additive compatibility.
121
163
 
164
+ `hosted_mcp_url` is the hosted MCP endpoint this run wired up — **not** the
165
+ backend URL you passed as `--api`. The hosted MCP server is a separate
166
+ deployment, so the two differing is intended topology, not an environment
167
+ mismatch. It is non-secret: the same string goes into your own MCP config file,
168
+ and the API key travels beside it in a header.
169
+
170
+ `superseded_agent_ids` lists the other agent directories on this machine. A
171
+ re-run mints a NEW agent and retires nothing, so those older agents still hold
172
+ live API and signing keys — revoke them on the Haven agent page if you meant to
173
+ replace them. Empty on a clean first run; an empty list is not a guarantee,
174
+ since a scan that cannot read the credential root also yields one rather than
175
+ failing a completed setup.
176
+
122
177
  For a recoverable install, configuration, probe, consent, or manual-runtime
123
178
  condition, inspect `error.code` and `error.next_action`, then follow the safe
124
179
  next action. A failed setup emits `outcome: "failed"` with a stable error code;
125
180
  it never presents credential material as a recovery diagnostic.
126
181
 
182
+ ### Recovering the record after a lost stream
183
+
184
+ Connect also writes its terminal outcome to `last-connect-outcome.json` in the
185
+ agent's credential directory (`~/.haven/agents/<slug-or-agent-id>/`) — the same
186
+ object, pretty-printed, for every terminal state. **If your harness stopped
187
+ watching before the connector finished, read that file rather than guessing
188
+ from your runtime's MCP listing.** A first run downloads and installs the
189
+ signer, which can take several minutes on a cold cache; a command harness that
190
+ gives up during it sees the install heartbeat as the last line and never the
191
+ verdict. The setup usually finished.
192
+
193
+ A refusal that happens before any credentials are written (an undetermined
194
+ runtime, an expired setup challenge, an unsupported Node) writes no file,
195
+ because nothing was created that could need recovering. The write is
196
+ best-effort and never changes the verdict: a setup that completed stays
197
+ completed even if the record could not be written.
198
+
127
199
  If the setup challenge expires, return to Haven to start a fresh connection and
128
200
  rerun Connect. If a runtime write, installation, or probe fails, follow the
129
201
  structured `error.next_action` (or its human equivalent). The `other` runtime