@haven_ai/connect 0.1.37-alpha.0 → 0.2.1-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
@@ -267,7 +267,7 @@ function signerPayload(input) {
267
267
  delegate_key: input.delegateKey,
268
268
  delegate_address: input.delegateAddress,
269
269
  agent_id: input.agentId,
270
- safe_address: input.safeAddress,
270
+ account_address: input.accountAddress,
271
271
  chain_id: input.chainId,
272
272
  network: input.network,
273
273
  x402_binding_signer: input.x402BindingSigner,
@@ -278,7 +278,7 @@ function identityPayload(input) {
278
278
  return {
279
279
  api_key: input.apiKey,
280
280
  agent_id: input.agentId,
281
- safe_address: input.safeAddress,
281
+ account_address: input.accountAddress,
282
282
  chain_id: input.chainId,
283
283
  network: input.network,
284
284
  api_url: input.apiUrl,
@@ -291,7 +291,7 @@ function agentPayload(input) {
291
291
  return {
292
292
  agent_id: input.agentId,
293
293
  delegate_address: input.delegateAddress,
294
- safe_address: input.safeAddress,
294
+ account_address: input.accountAddress,
295
295
  chain_id: input.chainId,
296
296
  network: input.network,
297
297
  agent_budget: input.agentBudget,
@@ -325,13 +325,20 @@ async function readStoredCredentials(serverName, agentIdOrSlug, baseDir) {
325
325
  apiUrl,
326
326
  hostedMcpUrl,
327
327
  delegateAddress: asString(agent.delegate_address) ?? asString(signer.delegate_address),
328
- safeAddress: asString(identity.safe_address) ?? asString(agent.safe_address),
328
+ ...readStoredAccountAddress(identity, agent),
329
329
  chainId: typeof identity.chain_id === "number" ? identity.chain_id : void 0,
330
330
  network: asString(identity.network),
331
331
  x402BindingSigner: asString(signer.x402_binding_signer),
332
332
  agentBudget: Array.isArray(identity.agent_budget) ? identity.agent_budget : void 0
333
333
  };
334
334
  }
335
+ function readStoredAccountAddress(identity, agent) {
336
+ const fresh = asString(identity.account_address) ?? asString(agent.account_address);
337
+ if (fresh) return { accountAddress: fresh, accountAddressKey: "account_address" };
338
+ const legacy = asString(identity.safe_address) ?? asString(agent.safe_address);
339
+ if (legacy) return { accountAddress: legacy, accountAddressKey: "safe_address" };
340
+ return {};
341
+ }
335
342
  async function discoverSoleAgentDirectory(baseDir) {
336
343
  const root = defaultCredentialRoot(baseDir);
337
344
  let entries = [];
@@ -543,9 +550,9 @@ var init_runtime_manifest = __esm({
543
550
  mcpPackage: "@haven_ai/mcp",
544
551
  mcpVersion: MCP_VERSION,
545
552
  sdkPackage: "@haven_ai/sdk",
546
- sdkVersion: "0.1.37-alpha.0",
553
+ sdkVersion: "0.2.1-alpha.0",
547
554
  signerPackage: "@haven_ai/signer",
548
- signerVersion: "0.1.37-alpha.0",
555
+ signerVersion: "0.2.1-alpha.0",
549
556
  // Sourced from the SDK, never a literal (#1161). This field read '20.0.0'
550
557
  // while every package's `engines` said `>=24` and the docs said `>=24.0.0`,
551
558
  // so the guard that was supposed to enforce the floor waved Node v23 through
@@ -1433,7 +1440,7 @@ async function buildLocalMcpConsentInput(identityPath, signerPath) {
1433
1440
  apiKey: credentials.apiKey,
1434
1441
  apiUrl: credentials.apiUrl,
1435
1442
  agentId: credentials.agentId,
1436
- safeAddress: credentials.safeAddress,
1443
+ safeAddress: credentials.accountAddress ?? credentials.safeAddress,
1437
1444
  delegateAddress: credentials.delegateAddress,
1438
1445
  chainId: credentials.chainId,
1439
1446
  allowanceSummary: credentials.allowanceSummary
@@ -2475,7 +2482,7 @@ async function buildSignerConsentInput(signerPath) {
2475
2482
  });
2476
2483
  return {
2477
2484
  delegateAddress: signer.delegateAddress,
2478
- safeAddress: credentials.safeAddress,
2485
+ safeAddress: credentials.accountAddress ?? credentials.safeAddress,
2479
2486
  agentId: credentials.agentId,
2480
2487
  chainId: credentials.chainId,
2481
2488
  network: credentials.network,
@@ -2651,7 +2658,7 @@ async function installRuntime(input, deps = {}) {
2651
2658
  (signerProbe === void 0 || signerProbe.status === "ok");
2652
2659
  const restartRequired = configResult.restartRequired || restartRequiredForRuntime(runtime, deps.env);
2653
2660
  const errorCode = configResult.errorCode ?? (configResult.runtimeMcpMode === "local_stdio" ? localMcpErrorCode(signerCredentialReady, localMcpConsent, localMcpProbe?.status) : hostedMcpErrorCode(configResult.hostedConfigured, hostedProbe.status) ?? signerConsentErrorCode(signerCredentialReady, signerConsent) ?? signerProbeErrorCode(signerProbe));
2654
- const hostedProbeMessages = configResult.hostedConfigured && hostedProbe.status !== "ok" ? [`Hosted Haven MCP probe failed: ${hostedProbe.status}.`] : configResult.hostedConfigured ? ["Verified hosted Haven MCP tools with a read-only handshake."] : [];
2661
+ const hostedProbeMessages = configResult.hostedConfigured && hostedProbe.status !== "ok" ? [`Hosted Haven MCP probe failed: ${hostedProbe.status}.`] : configResult.hostedConfigured ? ["Verified that the hosted Haven MCP tools endpoint responds to a read-only handshake."] : [];
2655
2662
  const signerProbeMessages = signerProbe ? signerProbe.status === "ok" ? ["Verified local Haven signer with a stdio handshake."] : [
2656
2663
  `Local Haven signer handshake failed: ${signerProbe.status}.`,
2657
2664
  `Re-run \`${connectorRerunCommand()}\` to repair the signer setup.`
@@ -3313,7 +3320,9 @@ async function finishRekey(options, deps = {}) {
3313
3320
  apiKey: options.newApiKey,
3314
3321
  delegateKey: pending.new_delegate_key,
3315
3322
  delegateAddress: pending.new_delegate_address,
3316
- safeAddress: stored.safeAddress ?? identity.safe_address ?? void 0,
3323
+ // #2908: the stored value (already new-name-first) wins; the hosted
3324
+ // identity's `account_address` twin before its deprecated `safe_address`.
3325
+ accountAddress: stored.accountAddress ?? identity.account_address ?? identity.safe_address ?? void 0,
3317
3326
  chainId: stored.chainId ?? identity.chain_id ?? void 0,
3318
3327
  network: stored.network,
3319
3328
  agentBudget: stored.agentBudget,
@@ -3499,6 +3508,7 @@ var init_rekey_restart = __esm({
3499
3508
  // src/doctor.ts
3500
3509
  var doctor_exports = {};
3501
3510
  __export(doctor_exports, {
3511
+ describeAccountAddressKey: () => describeAccountAddressKey,
3502
3512
  runDoctor: () => runDoctor,
3503
3513
  runRepair: () => runRepair
3504
3514
  });
@@ -3649,6 +3659,15 @@ async function readIdentity(directory) {
3649
3659
  return void 0;
3650
3660
  }
3651
3661
  }
3662
+ function describeAccountAddressKey(identity, signerFile) {
3663
+ const files = [identity, signerFile];
3664
+ const has = (key) => files.some((f) => typeof f?.[key] === "string" && f[key].trim() !== "");
3665
+ if (has("account_address")) return "account address stored as account_address";
3666
+ if (has("safe_address")) {
3667
+ return "account address stored under the pre-#2908 name safe_address \u2014 still read; the next --rekey or setup rewrites it as account_address";
3668
+ }
3669
+ return "no account address stored";
3670
+ }
3652
3671
  async function checksForAgent(entry, input, deps) {
3653
3672
  const { directory, identity, sidecar } = entry;
3654
3673
  const checks = [];
@@ -3665,7 +3684,7 @@ async function checksForAgent(entry, input, deps) {
3665
3684
  id: "credentials",
3666
3685
  label: "Agent credentials",
3667
3686
  ok: credentialsOk,
3668
- detail: credentialsOk ? `identity.json and signer.json parse (agent ${identity?.agent_id ?? "unknown"})` : "identity.json or signer.json is missing or unparseable.",
3687
+ detail: credentialsOk ? `identity.json and signer.json parse (agent ${identity?.agent_id ?? "unknown"}; ${describeAccountAddressKey(identity, signerFile)})` : "identity.json or signer.json is missing or unparseable.",
3669
3688
  ...credentialsOk ? {} : { repair: `Re-run the full setup with a fresh token: ${RERUN} --setup <token>.` }
3670
3689
  });
3671
3690
  if (!sidecar) {
@@ -3689,14 +3708,17 @@ async function checksForAgent(entry, input, deps) {
3689
3708
  ...matches ? {} : { repair: `Run: ${RERUN} --doctor --repair --runtime ${input.runtime} with the same HAVEN_*_SPEC variables set.` }
3690
3709
  });
3691
3710
  } else {
3692
- const matches = await installedRuntimeMatches(sidecar.runtime_directory, sidecar.cli_path);
3711
+ const intact = await installedRuntimeMatchesVersions(sidecar.runtime_directory, sidecar.cli_path, {
3712
+ signerVersion: sidecar.signer_version,
3713
+ sdkVersion: sidecar.sdk_version
3714
+ });
3693
3715
  const versionOk = sidecar.signer_version === MCP_RUNTIME_MANIFEST.signerVersion;
3694
- const ok = matches && versionOk;
3716
+ const ok = intact && versionOk;
3695
3717
  checks.push({
3696
3718
  id: "signer_runtime",
3697
3719
  label: "Signer runtime (preinstalled wrapper)",
3698
3720
  ok,
3699
- detail: ok ? `Installed ${sidecar.signer_package}@${sidecar.signer_version} at ${sidecar.runtime_directory}` : matches ? `Installed version ${sidecar.signer_version} does not match the connector's pinned ${MCP_RUNTIME_MANIFEST.signerVersion}.` : `Runtime directory is stale or empty (${sidecar.runtime_directory}) \u2014 the CLI or package versions are missing.`,
3721
+ detail: ok ? `Installed ${sidecar.signer_package}@${sidecar.signer_version} at ${sidecar.runtime_directory}` : intact ? `Installed version ${sidecar.signer_version} does not match the connector's pinned ${MCP_RUNTIME_MANIFEST.signerVersion} \u2014 intact, but outdated.` : `Runtime directory is stale or empty (${sidecar.runtime_directory}) \u2014 the CLI or package versions are missing.`,
3700
3722
  ...ok ? {} : { repair: `Run: ${RERUN} --doctor --repair --runtime ${input.runtime}` }
3701
3723
  });
3702
3724
  }
@@ -3709,9 +3731,9 @@ async function checksForAgent(entry, input, deps) {
3709
3731
  id: "hosted_mcp",
3710
3732
  label: "Hosted Haven MCP",
3711
3733
  ok: probe.status === "ok",
3712
- detail: probe.status === "ok" ? `Reachable and authorized (${hostedUrl}).` : `Probe failed: ${probe.status} (${hostedUrl}).`,
3734
+ detail: probe.status === "ok" ? `MCP tools endpoint is reachable (${hostedUrl}).` : `MCP tools endpoint probe failed: ${probe.status} (${hostedUrl}).`,
3713
3735
  ...probe.status === "ok" ? {} : {
3714
- repair: probe.status === "unauthorized" ? `The stored API key was rejected \u2014 re-run the full setup with a fresh token: ${RERUN} --setup <token>.` : "Check network access to the hosted MCP URL, then re-run --doctor."
3736
+ repair: "Check network access and runtime configuration for the hosted MCP URL, then re-run --doctor."
3715
3737
  }
3716
3738
  });
3717
3739
  } else {
@@ -3945,14 +3967,17 @@ async function runDoctor(input, deps = {}) {
3945
3967
  const identity = await readIdentity(entry.directory);
3946
3968
  const tombstone = await readAgentTombstone(entry.directory);
3947
3969
  const otherAgent = entry.agentId ?? basename(entry.directory);
3948
- const otherUrl = identity?.hosted_mcp_url ?? (identity?.api_url ? `${identity.api_url}/mcp` : void 0);
3949
- if (!identity?.api_key || !otherUrl) {
3970
+ if (!identity?.api_key || !identity.api_url) {
3950
3971
  if (tombstone) retired.push(`${otherAgent} (retired ${tombstone.retired_at})`);
3951
- else unverifiable.push(`${otherAgent} (no stored key/URL to probe)`);
3972
+ else unverifiable.push(`${otherAgent} (no stored key/API URL to probe)`);
3952
3973
  continue;
3953
3974
  }
3954
3975
  const suffix = tombstone ? " [tombstoned \u2014 key material still present]" : "";
3955
- const probe = await (deps.probeHosted ?? probeHostedMcpTools)(identity.api_key, otherUrl, deps.fetch);
3976
+ const probe = await (deps.probeHostedIdentity ?? probeHostedAgentIdentity)(
3977
+ identity.api_key,
3978
+ identity.api_url,
3979
+ deps.fetch
3980
+ );
3956
3981
  if (probe.status === "ok") live.push({ label: `${otherAgent}${suffix}`, entry });
3957
3982
  else if (probe.status === "unauthorized") revoked.push(`${otherAgent}${suffix}`);
3958
3983
  else unverifiable.push(`${otherAgent} (${probe.status})${suffix}`);
@@ -4396,7 +4421,7 @@ async function pathExists2(path) {
4396
4421
  init_unwire();
4397
4422
  init_local_mcp_runtime();
4398
4423
  init_runtime_manifest();
4399
- var CONNECTOR_VERSION = "0.1.37-alpha.0";
4424
+ var CONNECTOR_VERSION = "0.2.1-alpha.0";
4400
4425
  var CONNECT_OUTCOME_SCHEMA_VERSION = 1;
4401
4426
  var failureOutcomesByError = /* @__PURE__ */ new WeakMap();
4402
4427
  function failureOutcomeFor(runtimeHint, error) {
@@ -4572,7 +4597,7 @@ async function executeConnect(options, deps, trace) {
4572
4597
  apiKey: localApiKey,
4573
4598
  delegateKey: localKey.privateKey,
4574
4599
  delegateAddress: localKey.address,
4575
- safeAddress: setup.haven_wallet.address,
4600
+ accountAddress: setup.haven_wallet.address,
4576
4601
  chainId: setup.haven_wallet.chain_id,
4577
4602
  network: setup.haven_wallet.network,
4578
4603
  agentBudget: setup.agent_budget.map((budget) => ({