@haven_ai/connect 0.1.15-alpha.0 → 0.1.17-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/dist/cli.js CHANGED
@@ -131,8 +131,10 @@ async function writeCredentialFiles(input) {
131
131
  await restrictPermissions(directory, 448, input.warn);
132
132
  const identityPath = join(directory, "identity.json");
133
133
  const signerPath = join(directory, "signer.json");
134
+ const agentPath = join(directory, "agent.json");
134
135
  await assertDoesNotExist(identityPath);
135
136
  await assertDoesNotExist(signerPath);
137
+ await assertDoesNotExist(agentPath);
136
138
  await writeOwnerOnlyJson(
137
139
  signerPath,
138
140
  {
@@ -167,7 +169,26 @@ async function writeCredentialFiles(input) {
167
169
  await rm(signerPath, { force: true }).catch(() => void 0);
168
170
  throw err;
169
171
  }
170
- return { directory, identityPath, signerPath };
172
+ try {
173
+ await writeOwnerOnlyJson(
174
+ agentPath,
175
+ {
176
+ agent_id: input.agentId,
177
+ safe_address: input.safeAddress,
178
+ chain_id: input.chainId,
179
+ network: input.network,
180
+ agent_budget: input.agentBudget,
181
+ note: "Non-secret orientation for the agent: identity + configured budget. Contains no API key or signing key. For the live remaining budget, call haven_get_allowances."
182
+ },
183
+ input.warn
184
+ );
185
+ } catch (err) {
186
+ await rm(signerPath, { force: true }).catch(() => void 0);
187
+ await rm(identityPath, { force: true }).catch(() => void 0);
188
+ await rm(agentPath, { force: true }).catch(() => void 0);
189
+ throw err;
190
+ }
191
+ return { directory, identityPath, signerPath, agentPath };
171
192
  }
172
193
  function defaultAgentDirectory(agentId, baseDir = join(homedir(), ".haven", "agents")) {
173
194
  return resolve(defaultCredentialRoot(baseDir), safePathPart(agentId));
@@ -209,9 +230,9 @@ var MCP_RUNTIME_MANIFEST = {
209
230
  mcpPackage: "@haven_ai/mcp",
210
231
  mcpVersion: MCP_VERSION,
211
232
  sdkPackage: "@haven_ai/sdk",
212
- sdkVersion: "0.1.15-alpha.0",
233
+ sdkVersion: "0.1.17-alpha.0",
213
234
  signerPackage: "@haven_ai/signer",
214
- signerVersion: "0.1.15-alpha.0",
235
+ signerVersion: "0.1.17-alpha.0",
215
236
  minimumNodeVersion: "20.0.0",
216
237
  supportedClients: ["codex-cli", "codex-desktop", "claude-code"],
217
238
  requiredTools: registeredToolNames()
@@ -226,117 +247,6 @@ function signerPackageSpec() {
226
247
  return `${MCP_RUNTIME_MANIFEST.signerPackage}@${MCP_RUNTIME_MANIFEST.signerVersion}`;
227
248
  }
228
249
 
229
- // src/runtime-registry.ts
230
- var RUNTIME_PROFILES = {
231
- "claude-code": {
232
- id: "claude-code",
233
- label: "Claude Code",
234
- restartMode: "restart-session",
235
- canWriteRuntimeConfig: true
236
- },
237
- "codex-cli": {
238
- id: "codex-cli",
239
- label: "Codex CLI",
240
- restartMode: "restart-session",
241
- canWriteRuntimeConfig: true
242
- },
243
- "codex-desktop": {
244
- id: "codex-desktop",
245
- label: "Codex Desktop",
246
- restartMode: "restart-session",
247
- canWriteRuntimeConfig: true
248
- },
249
- cursor: {
250
- id: "cursor",
251
- label: "Cursor",
252
- restartMode: "hot-reload",
253
- canWriteRuntimeConfig: true
254
- },
255
- vscode: {
256
- id: "vscode",
257
- label: "VS Code",
258
- restartMode: "hot-reload",
259
- canWriteRuntimeConfig: true
260
- },
261
- "vscode-insiders": {
262
- id: "vscode-insiders",
263
- label: "VS Code Insiders",
264
- restartMode: "hot-reload",
265
- canWriteRuntimeConfig: true
266
- },
267
- "claude-desktop": {
268
- id: "claude-desktop",
269
- label: "Claude Desktop",
270
- restartMode: "restart-app",
271
- canWriteRuntimeConfig: true
272
- },
273
- other: {
274
- id: "other",
275
- label: "Other agent runtime",
276
- restartMode: "manual",
277
- canWriteRuntimeConfig: false
278
- }
279
- };
280
- var RUNTIME_ALIASES = {
281
- claude: "claude-code",
282
- "claude-code": "claude-code",
283
- claudecode: "claude-code",
284
- "claude_code": "claude-code",
285
- codex: "codex-cli",
286
- "codex-cli": "codex-cli",
287
- codexcli: "codex-cli",
288
- "codex_cli": "codex-cli",
289
- "codex-desktop": "codex-desktop",
290
- "codex_desktop": "codex-desktop",
291
- codexdesktop: "codex-desktop",
292
- "codex-app": "codex-desktop",
293
- "codex_app": "codex-desktop",
294
- codexapp: "codex-desktop",
295
- cursor: "cursor",
296
- vscode: "vscode",
297
- "vs-code": "vscode",
298
- "vs_code": "vscode",
299
- code: "vscode",
300
- "vscode-insiders": "vscode-insiders",
301
- "vscode_insiders": "vscode-insiders",
302
- vscodeinsiders: "vscode-insiders",
303
- "vs-code-insiders": "vscode-insiders",
304
- "code-insiders": "vscode-insiders",
305
- insiders: "vscode-insiders",
306
- "claude-desktop": "claude-desktop",
307
- "claude_desktop": "claude-desktop",
308
- claudesktop: "claude-desktop",
309
- desktop: "claude-desktop",
310
- other: "other",
311
- manual: "other"
312
- };
313
- function runtimeProfile(runtime, env = process.env) {
314
- return RUNTIME_PROFILES[normalizeRuntime(runtime, env)];
315
- }
316
- function normalizeRuntime(runtime, env = process.env) {
317
- const explicit = normalizeRuntimeName(runtime);
318
- if (explicit) return explicit;
319
- return detectRuntime(env) ?? "other";
320
- }
321
- function restartRequiredForRuntime(runtime, env = process.env) {
322
- const mode = runtimeProfile(runtime, env).restartMode;
323
- return mode === "restart-session" || mode === "restart-app";
324
- }
325
- function runtimeRequiresHardRestart(runtime) {
326
- return runtime === "claude-desktop" || runtime === "codex-desktop";
327
- }
328
- function normalizeRuntimeName(runtime) {
329
- const key = runtime?.trim().toLowerCase();
330
- if (!key) return null;
331
- return RUNTIME_ALIASES[key.replace(/\s+/g, "-")] ?? null;
332
- }
333
- function detectRuntime(env) {
334
- if (env.CLAUDECODE || env.CLAUDE_CODE || env.CLAUDECODE_CWD) return "claude-code";
335
- if (env.CODEX_SANDBOX || env.CODEX_HOME || env.CODEX_CWD) return "codex-cli";
336
- if (env.VSCODE_CWD || env.VSCODE_IPC_HOOK_CLI || env.TERM_PROGRAM === "vscode") return "vscode";
337
- return null;
338
- }
339
-
340
250
  // src/config-writers.ts
341
251
  var InvalidCodexTomlError = class extends Error {
342
252
  constructor(message) {
@@ -483,7 +393,6 @@ async function writeJsonRuntimeConfig(input, target, serverRoot) {
483
393
  async function writeCodexConfig(input) {
484
394
  const target = codexConfigPath(input.homeDir);
485
395
  const local = input.mode === "local";
486
- const restartMessage = runtimeRequiresHardRestart(input.runtime) ? "After Haven approval, restart Codex Desktop so it can load Haven tools." : "After Haven approval, Haven tools should appear in your next Codex message. If they don't, restart Codex to load them.";
487
396
  try {
488
397
  const existing = await readOptional(target);
489
398
  if (local) {
@@ -501,11 +410,7 @@ async function writeCodexConfig(input) {
501
410
  changed: existing !== merged2,
502
411
  restartRequired: true,
503
412
  messages: [
504
- `Updated local Haven MCP entry in ${configTargetLabel(input.runtime)}.`,
505
- // Codex Desktop loads MCP servers at app launch; Codex CLI typically
506
- // picks them up in the next session. Branch the copy so desktop users
507
- // get the unambiguous instruction.
508
- restartMessage
413
+ `Updated local Haven MCP entry in ${configTargetLabel(input.runtime)}.`
509
414
  ]
510
415
  };
511
416
  }
@@ -520,8 +425,7 @@ async function writeCodexConfig(input) {
520
425
  changed: existing !== merged,
521
426
  restartRequired: true,
522
427
  messages: [
523
- `Updated Haven MCP entries in ${configTargetLabel(input.runtime)}.`,
524
- restartMessage
428
+ `Updated Haven MCP entries in ${configTargetLabel(input.runtime)}.`
525
429
  ]
526
430
  };
527
431
  } catch (err) {
@@ -1074,23 +978,29 @@ function parseNodeVersion(value) {
1074
978
  ];
1075
979
  }
1076
980
  async function installRuntimePackages(runtimeDirectory, npmCacheDirectory, runCommand) {
1077
- const args = [
981
+ const baseArgs = [
1078
982
  "install",
1079
983
  "--prefix",
1080
984
  runtimeDirectory,
1081
- "--cache",
1082
- npmCacheDirectory,
1083
985
  "--no-audit",
1084
986
  "--no-fund",
1085
987
  "--omit=dev",
988
+ "--prefer-offline",
1086
989
  mcpPackageSpec(),
1087
990
  sdkPackageSpec()
1088
991
  ];
1089
- try {
992
+ const run = async (args) => {
1090
993
  if (runCommand) await runCommand("npm", args);
1091
994
  else await execFileAsync("npm", args, { timeout: 12e4, maxBuffer: 1024 * 1024 });
1092
- } catch (err) {
1093
- throw new Error(`Could not install local Haven MCP runtime ${mcpPackageSpec()}: ${err instanceof Error ? err.message : String(err)}`);
995
+ };
996
+ try {
997
+ await run(baseArgs);
998
+ } catch {
999
+ try {
1000
+ await run([...baseArgs, "--cache", npmCacheDirectory]);
1001
+ } catch (err) {
1002
+ throw new Error(`Could not install local Haven MCP runtime ${mcpPackageSpec()}: ${err instanceof Error ? err.message : String(err)}`);
1003
+ }
1094
1004
  }
1095
1005
  }
1096
1006
  async function installedRuntimeMatches(runtimeDirectory, cliPath) {
@@ -1194,25 +1104,31 @@ async function prepareSignerRuntime(input, deps = {}) {
1194
1104
  };
1195
1105
  }
1196
1106
  async function installRuntimePackages2(runtimeDirectory, npmCacheDirectory, runCommand) {
1197
- const args = [
1107
+ const baseArgs = [
1198
1108
  "install",
1199
1109
  "--prefix",
1200
1110
  runtimeDirectory,
1201
- "--cache",
1202
- npmCacheDirectory,
1203
1111
  "--no-audit",
1204
1112
  "--no-fund",
1205
1113
  "--omit=dev",
1114
+ "--prefer-offline",
1206
1115
  signerPackageSpec(),
1207
1116
  sdkPackageSpec()
1208
1117
  ];
1209
- try {
1118
+ const run = async (args) => {
1210
1119
  if (runCommand) await runCommand("npm", args);
1211
1120
  else await execFileAsync2("npm", args, { timeout: 12e4, maxBuffer: 1024 * 1024 });
1212
- } catch (err) {
1213
- throw new Error(
1214
- `Could not install local Haven signer runtime ${signerPackageSpec()}: ${err instanceof Error ? err.message : String(err)}`
1215
- );
1121
+ };
1122
+ try {
1123
+ await run(baseArgs);
1124
+ } catch {
1125
+ try {
1126
+ await run([...baseArgs, "--cache", npmCacheDirectory]);
1127
+ } catch (err) {
1128
+ throw new Error(
1129
+ `Could not install local Haven signer runtime ${signerPackageSpec()}: ${err instanceof Error ? err.message : String(err)}`
1130
+ );
1131
+ }
1216
1132
  }
1217
1133
  }
1218
1134
  async function installedRuntimeMatches2(runtimeDirectory, cliPath) {
@@ -1275,6 +1191,117 @@ async function assertFileExists2(path, label) {
1275
1191
  throw new Error(`Missing ${label}: ${path}`);
1276
1192
  }
1277
1193
  }
1194
+
1195
+ // src/runtime-registry.ts
1196
+ var RUNTIME_PROFILES = {
1197
+ "claude-code": {
1198
+ id: "claude-code",
1199
+ label: "Claude Code",
1200
+ restartMode: "restart-session",
1201
+ canWriteRuntimeConfig: true
1202
+ },
1203
+ "codex-cli": {
1204
+ id: "codex-cli",
1205
+ label: "Codex CLI",
1206
+ restartMode: "restart-session",
1207
+ canWriteRuntimeConfig: true
1208
+ },
1209
+ "codex-desktop": {
1210
+ id: "codex-desktop",
1211
+ label: "Codex Desktop",
1212
+ restartMode: "restart-session",
1213
+ canWriteRuntimeConfig: true
1214
+ },
1215
+ cursor: {
1216
+ id: "cursor",
1217
+ label: "Cursor",
1218
+ restartMode: "hot-reload",
1219
+ canWriteRuntimeConfig: true
1220
+ },
1221
+ vscode: {
1222
+ id: "vscode",
1223
+ label: "VS Code",
1224
+ restartMode: "hot-reload",
1225
+ canWriteRuntimeConfig: true
1226
+ },
1227
+ "vscode-insiders": {
1228
+ id: "vscode-insiders",
1229
+ label: "VS Code Insiders",
1230
+ restartMode: "hot-reload",
1231
+ canWriteRuntimeConfig: true
1232
+ },
1233
+ "claude-desktop": {
1234
+ id: "claude-desktop",
1235
+ label: "Claude Desktop",
1236
+ restartMode: "restart-app",
1237
+ canWriteRuntimeConfig: true
1238
+ },
1239
+ other: {
1240
+ id: "other",
1241
+ label: "Other agent runtime",
1242
+ restartMode: "manual",
1243
+ canWriteRuntimeConfig: false
1244
+ }
1245
+ };
1246
+ var RUNTIME_ALIASES = {
1247
+ claude: "claude-code",
1248
+ "claude-code": "claude-code",
1249
+ claudecode: "claude-code",
1250
+ "claude_code": "claude-code",
1251
+ codex: "codex-cli",
1252
+ "codex-cli": "codex-cli",
1253
+ codexcli: "codex-cli",
1254
+ "codex_cli": "codex-cli",
1255
+ "codex-desktop": "codex-desktop",
1256
+ "codex_desktop": "codex-desktop",
1257
+ codexdesktop: "codex-desktop",
1258
+ "codex-app": "codex-desktop",
1259
+ "codex_app": "codex-desktop",
1260
+ codexapp: "codex-desktop",
1261
+ cursor: "cursor",
1262
+ vscode: "vscode",
1263
+ "vs-code": "vscode",
1264
+ "vs_code": "vscode",
1265
+ code: "vscode",
1266
+ "vscode-insiders": "vscode-insiders",
1267
+ "vscode_insiders": "vscode-insiders",
1268
+ vscodeinsiders: "vscode-insiders",
1269
+ "vs-code-insiders": "vscode-insiders",
1270
+ "code-insiders": "vscode-insiders",
1271
+ insiders: "vscode-insiders",
1272
+ "claude-desktop": "claude-desktop",
1273
+ "claude_desktop": "claude-desktop",
1274
+ claudesktop: "claude-desktop",
1275
+ desktop: "claude-desktop",
1276
+ other: "other",
1277
+ manual: "other"
1278
+ };
1279
+ function runtimeProfile(runtime, env = process.env) {
1280
+ return RUNTIME_PROFILES[normalizeRuntime(runtime, env)];
1281
+ }
1282
+ function normalizeRuntime(runtime, env = process.env) {
1283
+ const explicit = normalizeRuntimeName(runtime);
1284
+ if (explicit) return explicit;
1285
+ return detectRuntime(env) ?? "other";
1286
+ }
1287
+ function restartRequiredForRuntime(runtime, env = process.env) {
1288
+ const mode = runtimeProfile(runtime, env).restartMode;
1289
+ return mode === "restart-session" || mode === "restart-app";
1290
+ }
1291
+ function runtimeRequiresHardRestart(runtime) {
1292
+ return runtime === "claude-desktop" || runtime === "codex-desktop";
1293
+ }
1294
+ function normalizeRuntimeName(runtime) {
1295
+ const key = runtime?.trim().toLowerCase();
1296
+ if (!key) return null;
1297
+ return RUNTIME_ALIASES[key.replace(/\s+/g, "-")] ?? null;
1298
+ }
1299
+ function detectRuntime(env) {
1300
+ if (env.CLAUDECODE || env.CLAUDE_CODE || env.CLAUDECODE_CWD) return "claude-code";
1301
+ if (env.CODEX_SANDBOX || env.CODEX_HOME || env.CODEX_CWD) return "codex-cli";
1302
+ if (env.VSCODE_CWD || env.VSCODE_IPC_HOOK_CLI || env.TERM_PROGRAM === "vscode") return "vscode";
1303
+ return null;
1304
+ }
1278
1305
  async function acknowledgeLocalSignerConsent(signerPath, log) {
1279
1306
  try {
1280
1307
  const input = await buildSignerConsentInput(signerPath);
@@ -1350,6 +1377,7 @@ var execFileAsync3 = promisify(execFile);
1350
1377
  async function installRuntime(input, deps = {}) {
1351
1378
  const runtime = normalizeRuntime(input.runtime, deps.env);
1352
1379
  const profile = runtimeProfile(runtime, deps.env);
1380
+ const progress = deps.onProgress ?? (() => void 0);
1353
1381
  const localRuntime = input.localMcp === true && supportsLocalMcp(runtime);
1354
1382
  const consentMessages = [];
1355
1383
  const localMcpConsent = localRuntime ? await resolveLocalMcpConsent(input, consentMessages) : void 0;
@@ -1409,6 +1437,7 @@ async function installRuntime(input, deps = {}) {
1409
1437
  }
1410
1438
  let signerCommand;
1411
1439
  if (!localRuntime) {
1440
+ progress("Getting the signer ready\u2026");
1412
1441
  try {
1413
1442
  const signerRuntime = await prepareSignerForRuntime(input, deps);
1414
1443
  signerCommand = { command: signerRuntime.command, args: signerRuntime.args };
@@ -1420,6 +1449,7 @@ async function installRuntime(input, deps = {}) {
1420
1449
  }
1421
1450
  }
1422
1451
  const signerRuntimePrepared = localRuntime ? void 0 : signerCommand !== void 0;
1452
+ progress("Setting up your Haven tools\u2026");
1423
1453
  const configResult = runtime === "claude-code" ? localRuntime ? await configureClaudeCode(deps, localRuntimeInstall?.command ?? "") : await configureClaudeCodeHosted(deps, input, signerCommand) : await writeRuntimeConfig({
1424
1454
  runtime,
1425
1455
  hostedMcpUrl: input.hostedMcpUrl,
@@ -1432,6 +1462,7 @@ async function installRuntime(input, deps = {}) {
1432
1462
  homeDir: deps.homeDir,
1433
1463
  mode: localRuntime ? "local" : "hosted"
1434
1464
  });
1465
+ progress("Almost there \u2014 just confirming everything connects\u2026");
1435
1466
  const localProbePromise = configResult.runtimeMcpMode === "local_stdio" && localRuntimeInstall ? runLocalMcpProbe(localRuntimeInstall, deps) : Promise.resolve(void 0);
1436
1467
  const [hostedProbe, signerCredentialReady, localMcpProbe] = await Promise.all([
1437
1468
  configResult.hostedConfigured ? probeHostedMcpTools(input.apiKey, input.hostedMcpUrl, deps.fetch) : Promise.resolve({ status: "bad_response" }),
@@ -1496,8 +1527,7 @@ async function configureClaudeCode(deps, localMcpCommand) {
1496
1527
  restartRequired: true,
1497
1528
  messages: [
1498
1529
  "Updated local Haven MCP entry with Claude Code.",
1499
- ...verified ? ["Verified Claude Code MCP entry."] : [],
1500
- "After Haven approval, Haven tools should appear in your next Claude Code message. If they don't, restart the session to load them."
1530
+ ...verified ? ["Verified Claude Code MCP entry."] : []
1501
1531
  ]
1502
1532
  };
1503
1533
  } catch (err) {
@@ -1546,8 +1576,7 @@ async function configureClaudeCodeHosted(deps, input, signerCommand) {
1546
1576
  restartRequired: true,
1547
1577
  messages: [
1548
1578
  "Updated hosted Haven MCP and local signer entries with Claude Code.",
1549
- ...verified ? ["Verified Claude Code MCP entry."] : [],
1550
- "After Haven approval, Haven tools should appear in your next Claude Code message. If they don't, restart the session to load them."
1579
+ ...verified ? ["Verified Claude Code MCP entry."] : []
1551
1580
  ]
1552
1581
  };
1553
1582
  } catch (err) {
@@ -1675,7 +1704,7 @@ function localRuntimePrepareErrorCode(err) {
1675
1704
  }
1676
1705
 
1677
1706
  // src/runtime.ts
1678
- var CONNECTOR_VERSION = "0.1.15-alpha.0";
1707
+ var CONNECTOR_VERSION = "0.1.17-alpha.0";
1679
1708
  async function runConnect(options, deps = {}) {
1680
1709
  const connectorVersion = options.connectorVersion ?? CONNECTOR_VERSION;
1681
1710
  const api = deps.api ?? createConnectApiClient(options.apiBaseUrl);
@@ -1695,6 +1724,7 @@ async function runConnect(options, deps = {}) {
1695
1724
  );
1696
1725
  }
1697
1726
  }
1727
+ log("Warming up your connection to Haven\u2026");
1698
1728
  const setup = await api.resolveSetup({
1699
1729
  setupToken: options.setupToken,
1700
1730
  connectorVersion,
@@ -1702,12 +1732,12 @@ async function runConnect(options, deps = {}) {
1702
1732
  });
1703
1733
  printSetupSummary(setup, log);
1704
1734
  await preflightStorage({ baseDir: options.credentialsDir, warn: log });
1705
- log("Checked local credential storage.");
1735
+ log("Checked local credential storage \u2014 all clear.");
1706
1736
  const localKey = generateKey();
1707
1737
  const localApiKey = generateLocalApiKey();
1708
- log("Generated local signing key.");
1709
- log("Generated local Haven API key.");
1738
+ log("Minting a fresh signing key and API key \u2014 both stay on this machine.");
1710
1739
  const proofSignature = await localKey.signChallenge(setup.challenge.message);
1740
+ log("Introducing your agent to Haven\u2026");
1711
1741
  const registration = await api.registerSetup({
1712
1742
  setupToken: options.setupToken,
1713
1743
  connectorVersion,
@@ -1724,6 +1754,7 @@ async function runConnect(options, deps = {}) {
1724
1754
  installCapabilities
1725
1755
  });
1726
1756
  log(`Registered signing address with Haven: ${shortAddress(registration.delegate_address)}.`);
1757
+ log("Tucking your credentials away safely on disk\u2026");
1727
1758
  const credentialPaths = await writeCredentials({
1728
1759
  baseDir: options.credentialsDir,
1729
1760
  agentId: registration.agent_id,
@@ -1745,6 +1776,7 @@ async function runConnect(options, deps = {}) {
1745
1776
  });
1746
1777
  log(`Stored Haven identity credential locally: ${credentialPaths.identityPath}`);
1747
1778
  log(`Stored local signer credential locally: ${credentialPaths.signerPath}`);
1779
+ log(`Stored non-secret agent orientation locally: ${credentialPaths.agentPath}`);
1748
1780
  if (setup.x402_binding_signer) {
1749
1781
  log("Configured x402 binding signer for the local signer.");
1750
1782
  } else {
@@ -1763,8 +1795,14 @@ async function runConnect(options, deps = {}) {
1763
1795
  ackSigner: options.ackSigner,
1764
1796
  ackLocalTools: options.ackLocalTools,
1765
1797
  localMcp: options.localMcp
1766
- });
1798
+ }, { onProgress: log });
1767
1799
  printRuntimeInstall(runtimeInstall, log);
1800
+ if (runtimeInstall.errorCode) {
1801
+ log("Haven setup needs a couple more steps on this machine \u2014 see the notes above.");
1802
+ } else {
1803
+ log("Haven setup on this machine is complete.");
1804
+ }
1805
+ printNextSteps(runtimeInstall, log);
1768
1806
  try {
1769
1807
  await api.updateInstallStatus(registration.setup_id, localApiKey, {
1770
1808
  runtime: runtimeInstall.runtime,
@@ -1787,14 +1825,6 @@ async function runConnect(options, deps = {}) {
1787
1825
  } catch (err) {
1788
1826
  log(`Could not report install status to Haven: ${err instanceof Error ? err.message : String(err)}`);
1789
1827
  }
1790
- log("Return to Haven to approve the agent rules.");
1791
- if (runtimeInstall.restartRequired) {
1792
- if (runtimeRequiresHardRestart(runtimeInstall.runtime)) {
1793
- log("After approval, restart this agent so it can load Haven tools.");
1794
- } else {
1795
- log("After approval, Haven tools should appear in your next message. If they don't, restart this agent to load them.");
1796
- }
1797
- }
1798
1828
  return {
1799
1829
  setupId: registration.setup_id,
1800
1830
  agentId: registration.agent_id,
@@ -1832,6 +1862,18 @@ function printRuntimeInstall(result, log) {
1832
1862
  log("Local Haven signer still needs runtime setup.");
1833
1863
  }
1834
1864
  }
1865
+ function printNextSteps(result, log) {
1866
+ log("Next: approve the agent rules in Haven. No Haven tools appear until you approve \u2014 restart or not.");
1867
+ if (result.restartRequired) {
1868
+ if (runtimeRequiresHardRestart(result.runtime)) {
1869
+ log("After you approve, restart this agent so it can load Haven tools.");
1870
+ } else {
1871
+ log("After you approve, restart this agent \u2014 your current session won't load the Haven tools until you do.");
1872
+ }
1873
+ } else {
1874
+ log("After you approve, the Haven tools should appear in this runtime shortly.");
1875
+ }
1876
+ }
1835
1877
 
1836
1878
  // src/args.ts
1837
1879
  function parseArgs(argv, env = process.env) {