@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/README.md +7 -0
- package/dist/cli.cjs +47 -22
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +47 -22
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +47 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +47 -22
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -273,7 +273,7 @@ function signerPayload(input) {
|
|
|
273
273
|
delegate_key: input.delegateKey,
|
|
274
274
|
delegate_address: input.delegateAddress,
|
|
275
275
|
agent_id: input.agentId,
|
|
276
|
-
|
|
276
|
+
account_address: input.accountAddress,
|
|
277
277
|
chain_id: input.chainId,
|
|
278
278
|
network: input.network,
|
|
279
279
|
x402_binding_signer: input.x402BindingSigner,
|
|
@@ -284,7 +284,7 @@ function identityPayload(input) {
|
|
|
284
284
|
return {
|
|
285
285
|
api_key: input.apiKey,
|
|
286
286
|
agent_id: input.agentId,
|
|
287
|
-
|
|
287
|
+
account_address: input.accountAddress,
|
|
288
288
|
chain_id: input.chainId,
|
|
289
289
|
network: input.network,
|
|
290
290
|
api_url: input.apiUrl,
|
|
@@ -297,7 +297,7 @@ function agentPayload(input) {
|
|
|
297
297
|
return {
|
|
298
298
|
agent_id: input.agentId,
|
|
299
299
|
delegate_address: input.delegateAddress,
|
|
300
|
-
|
|
300
|
+
account_address: input.accountAddress,
|
|
301
301
|
chain_id: input.chainId,
|
|
302
302
|
network: input.network,
|
|
303
303
|
agent_budget: input.agentBudget,
|
|
@@ -331,13 +331,20 @@ async function readStoredCredentials(serverName, agentIdOrSlug, baseDir) {
|
|
|
331
331
|
apiUrl,
|
|
332
332
|
hostedMcpUrl,
|
|
333
333
|
delegateAddress: asString(agent.delegate_address) ?? asString(signer.delegate_address),
|
|
334
|
-
|
|
334
|
+
...readStoredAccountAddress(identity, agent),
|
|
335
335
|
chainId: typeof identity.chain_id === "number" ? identity.chain_id : void 0,
|
|
336
336
|
network: asString(identity.network),
|
|
337
337
|
x402BindingSigner: asString(signer.x402_binding_signer),
|
|
338
338
|
agentBudget: Array.isArray(identity.agent_budget) ? identity.agent_budget : void 0
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
+
function readStoredAccountAddress(identity, agent) {
|
|
342
|
+
const fresh = asString(identity.account_address) ?? asString(agent.account_address);
|
|
343
|
+
if (fresh) return { accountAddress: fresh, accountAddressKey: "account_address" };
|
|
344
|
+
const legacy = asString(identity.safe_address) ?? asString(agent.safe_address);
|
|
345
|
+
if (legacy) return { accountAddress: legacy, accountAddressKey: "safe_address" };
|
|
346
|
+
return {};
|
|
347
|
+
}
|
|
341
348
|
async function discoverSoleAgentDirectory(baseDir) {
|
|
342
349
|
const root = defaultCredentialRoot(baseDir);
|
|
343
350
|
let entries = [];
|
|
@@ -549,9 +556,9 @@ var init_runtime_manifest = __esm({
|
|
|
549
556
|
mcpPackage: "@haven_ai/mcp",
|
|
550
557
|
mcpVersion: mcp.MCP_VERSION,
|
|
551
558
|
sdkPackage: "@haven_ai/sdk",
|
|
552
|
-
sdkVersion: "0.1
|
|
559
|
+
sdkVersion: "0.2.1-alpha.0",
|
|
553
560
|
signerPackage: "@haven_ai/signer",
|
|
554
|
-
signerVersion: "0.1
|
|
561
|
+
signerVersion: "0.2.1-alpha.0",
|
|
555
562
|
// Sourced from the SDK, never a literal (#1161). This field read '20.0.0'
|
|
556
563
|
// while every package's `engines` said `>=24` and the docs said `>=24.0.0`,
|
|
557
564
|
// so the guard that was supposed to enforce the floor waved Node v23 through
|
|
@@ -1439,7 +1446,7 @@ async function buildLocalMcpConsentInput(identityPath, signerPath) {
|
|
|
1439
1446
|
apiKey: credentials.apiKey,
|
|
1440
1447
|
apiUrl: credentials.apiUrl,
|
|
1441
1448
|
agentId: credentials.agentId,
|
|
1442
|
-
safeAddress: credentials.safeAddress,
|
|
1449
|
+
safeAddress: credentials.accountAddress ?? credentials.safeAddress,
|
|
1443
1450
|
delegateAddress: credentials.delegateAddress,
|
|
1444
1451
|
chainId: credentials.chainId,
|
|
1445
1452
|
allowanceSummary: credentials.allowanceSummary
|
|
@@ -2481,7 +2488,7 @@ async function buildSignerConsentInput(signerPath) {
|
|
|
2481
2488
|
});
|
|
2482
2489
|
return {
|
|
2483
2490
|
delegateAddress: signer$1.delegateAddress,
|
|
2484
|
-
safeAddress: credentials.safeAddress,
|
|
2491
|
+
safeAddress: credentials.accountAddress ?? credentials.safeAddress,
|
|
2485
2492
|
agentId: credentials.agentId,
|
|
2486
2493
|
chainId: credentials.chainId,
|
|
2487
2494
|
network: credentials.network,
|
|
@@ -2657,7 +2664,7 @@ async function installRuntime(input, deps = {}) {
|
|
|
2657
2664
|
(signerProbe === void 0 || signerProbe.status === "ok");
|
|
2658
2665
|
const restartRequired = configResult.restartRequired || restartRequiredForRuntime(runtime, deps.env);
|
|
2659
2666
|
const errorCode = configResult.errorCode ?? (configResult.runtimeMcpMode === "local_stdio" ? localMcpErrorCode(signerCredentialReady, localMcpConsent, localMcpProbe?.status) : hostedMcpErrorCode(configResult.hostedConfigured, hostedProbe.status) ?? signerConsentErrorCode(signerCredentialReady, signerConsent) ?? signerProbeErrorCode(signerProbe));
|
|
2660
|
-
const hostedProbeMessages = configResult.hostedConfigured && hostedProbe.status !== "ok" ? [`Hosted Haven MCP probe failed: ${hostedProbe.status}.`] : configResult.hostedConfigured ? ["Verified hosted Haven MCP tools
|
|
2667
|
+
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."] : [];
|
|
2661
2668
|
const signerProbeMessages = signerProbe ? signerProbe.status === "ok" ? ["Verified local Haven signer with a stdio handshake."] : [
|
|
2662
2669
|
`Local Haven signer handshake failed: ${signerProbe.status}.`,
|
|
2663
2670
|
`Re-run \`${sdk.connectorRerunCommand()}\` to repair the signer setup.`
|
|
@@ -3319,7 +3326,9 @@ async function finishRekey(options, deps = {}) {
|
|
|
3319
3326
|
apiKey: options.newApiKey,
|
|
3320
3327
|
delegateKey: pending.new_delegate_key,
|
|
3321
3328
|
delegateAddress: pending.new_delegate_address,
|
|
3322
|
-
|
|
3329
|
+
// #2908: the stored value (already new-name-first) wins; the hosted
|
|
3330
|
+
// identity's `account_address` twin before its deprecated `safe_address`.
|
|
3331
|
+
accountAddress: stored.accountAddress ?? identity.account_address ?? identity.safe_address ?? void 0,
|
|
3323
3332
|
chainId: stored.chainId ?? identity.chain_id ?? void 0,
|
|
3324
3333
|
network: stored.network,
|
|
3325
3334
|
agentBudget: stored.agentBudget,
|
|
@@ -3505,6 +3514,7 @@ var init_rekey_restart = __esm({
|
|
|
3505
3514
|
// src/doctor.ts
|
|
3506
3515
|
var doctor_exports = {};
|
|
3507
3516
|
__export(doctor_exports, {
|
|
3517
|
+
describeAccountAddressKey: () => describeAccountAddressKey,
|
|
3508
3518
|
runDoctor: () => runDoctor,
|
|
3509
3519
|
runRepair: () => runRepair
|
|
3510
3520
|
});
|
|
@@ -3655,6 +3665,15 @@ async function readIdentity(directory) {
|
|
|
3655
3665
|
return void 0;
|
|
3656
3666
|
}
|
|
3657
3667
|
}
|
|
3668
|
+
function describeAccountAddressKey(identity, signerFile) {
|
|
3669
|
+
const files = [identity, signerFile];
|
|
3670
|
+
const has = (key) => files.some((f) => typeof f?.[key] === "string" && f[key].trim() !== "");
|
|
3671
|
+
if (has("account_address")) return "account address stored as account_address";
|
|
3672
|
+
if (has("safe_address")) {
|
|
3673
|
+
return "account address stored under the pre-#2908 name safe_address \u2014 still read; the next --rekey or setup rewrites it as account_address";
|
|
3674
|
+
}
|
|
3675
|
+
return "no account address stored";
|
|
3676
|
+
}
|
|
3658
3677
|
async function checksForAgent(entry, input, deps) {
|
|
3659
3678
|
const { directory, identity, sidecar } = entry;
|
|
3660
3679
|
const checks = [];
|
|
@@ -3671,7 +3690,7 @@ async function checksForAgent(entry, input, deps) {
|
|
|
3671
3690
|
id: "credentials",
|
|
3672
3691
|
label: "Agent credentials",
|
|
3673
3692
|
ok: credentialsOk,
|
|
3674
|
-
detail: credentialsOk ? `identity.json and signer.json parse (agent ${identity?.agent_id ?? "unknown"})` : "identity.json or signer.json is missing or unparseable.",
|
|
3693
|
+
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.",
|
|
3675
3694
|
...credentialsOk ? {} : { repair: `Re-run the full setup with a fresh token: ${RERUN} --setup <token>.` }
|
|
3676
3695
|
});
|
|
3677
3696
|
if (!sidecar) {
|
|
@@ -3695,14 +3714,17 @@ async function checksForAgent(entry, input, deps) {
|
|
|
3695
3714
|
...matches ? {} : { repair: `Run: ${RERUN} --doctor --repair --runtime ${input.runtime} with the same HAVEN_*_SPEC variables set.` }
|
|
3696
3715
|
});
|
|
3697
3716
|
} else {
|
|
3698
|
-
const
|
|
3717
|
+
const intact = await installedRuntimeMatchesVersions(sidecar.runtime_directory, sidecar.cli_path, {
|
|
3718
|
+
signerVersion: sidecar.signer_version,
|
|
3719
|
+
sdkVersion: sidecar.sdk_version
|
|
3720
|
+
});
|
|
3699
3721
|
const versionOk = sidecar.signer_version === exports.MCP_RUNTIME_MANIFEST.signerVersion;
|
|
3700
|
-
const ok =
|
|
3722
|
+
const ok = intact && versionOk;
|
|
3701
3723
|
checks.push({
|
|
3702
3724
|
id: "signer_runtime",
|
|
3703
3725
|
label: "Signer runtime (preinstalled wrapper)",
|
|
3704
3726
|
ok,
|
|
3705
|
-
detail: ok ? `Installed ${sidecar.signer_package}@${sidecar.signer_version} at ${sidecar.runtime_directory}` :
|
|
3727
|
+
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 ${exports.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.`,
|
|
3706
3728
|
...ok ? {} : { repair: `Run: ${RERUN} --doctor --repair --runtime ${input.runtime}` }
|
|
3707
3729
|
});
|
|
3708
3730
|
}
|
|
@@ -3715,9 +3737,9 @@ async function checksForAgent(entry, input, deps) {
|
|
|
3715
3737
|
id: "hosted_mcp",
|
|
3716
3738
|
label: "Hosted Haven MCP",
|
|
3717
3739
|
ok: probe.status === "ok",
|
|
3718
|
-
detail: probe.status === "ok" ? `
|
|
3740
|
+
detail: probe.status === "ok" ? `MCP tools endpoint is reachable (${hostedUrl}).` : `MCP tools endpoint probe failed: ${probe.status} (${hostedUrl}).`,
|
|
3719
3741
|
...probe.status === "ok" ? {} : {
|
|
3720
|
-
repair:
|
|
3742
|
+
repair: "Check network access and runtime configuration for the hosted MCP URL, then re-run --doctor."
|
|
3721
3743
|
}
|
|
3722
3744
|
});
|
|
3723
3745
|
} else {
|
|
@@ -3951,14 +3973,17 @@ async function runDoctor(input, deps = {}) {
|
|
|
3951
3973
|
const identity = await readIdentity(entry.directory);
|
|
3952
3974
|
const tombstone = await readAgentTombstone(entry.directory);
|
|
3953
3975
|
const otherAgent = entry.agentId ?? path.basename(entry.directory);
|
|
3954
|
-
|
|
3955
|
-
if (!identity?.api_key || !otherUrl) {
|
|
3976
|
+
if (!identity?.api_key || !identity.api_url) {
|
|
3956
3977
|
if (tombstone) retired.push(`${otherAgent} (retired ${tombstone.retired_at})`);
|
|
3957
|
-
else unverifiable.push(`${otherAgent} (no stored key/URL to probe)`);
|
|
3978
|
+
else unverifiable.push(`${otherAgent} (no stored key/API URL to probe)`);
|
|
3958
3979
|
continue;
|
|
3959
3980
|
}
|
|
3960
3981
|
const suffix = tombstone ? " [tombstoned \u2014 key material still present]" : "";
|
|
3961
|
-
const probe = await (deps.
|
|
3982
|
+
const probe = await (deps.probeHostedIdentity ?? probeHostedAgentIdentity)(
|
|
3983
|
+
identity.api_key,
|
|
3984
|
+
identity.api_url,
|
|
3985
|
+
deps.fetch
|
|
3986
|
+
);
|
|
3962
3987
|
if (probe.status === "ok") live.push({ label: `${otherAgent}${suffix}`, entry });
|
|
3963
3988
|
else if (probe.status === "unauthorized") revoked.push(`${otherAgent}${suffix}`);
|
|
3964
3989
|
else unverifiable.push(`${otherAgent} (${probe.status})${suffix}`);
|
|
@@ -4402,7 +4427,7 @@ async function pathExists2(path) {
|
|
|
4402
4427
|
init_unwire();
|
|
4403
4428
|
init_local_mcp_runtime();
|
|
4404
4429
|
init_runtime_manifest();
|
|
4405
|
-
var CONNECTOR_VERSION = "0.1
|
|
4430
|
+
var CONNECTOR_VERSION = "0.2.1-alpha.0";
|
|
4406
4431
|
var CONNECT_OUTCOME_SCHEMA_VERSION = 1;
|
|
4407
4432
|
var failureOutcomesByError = /* @__PURE__ */ new WeakMap();
|
|
4408
4433
|
function failureOutcomeFor(runtimeHint, error) {
|
|
@@ -4578,7 +4603,7 @@ async function executeConnect(options, deps, trace) {
|
|
|
4578
4603
|
apiKey: localApiKey,
|
|
4579
4604
|
delegateKey: localKey.privateKey,
|
|
4580
4605
|
delegateAddress: localKey.address,
|
|
4581
|
-
|
|
4606
|
+
accountAddress: setup.haven_wallet.address,
|
|
4582
4607
|
chainId: setup.haven_wallet.chain_id,
|
|
4583
4608
|
network: setup.haven_wallet.network,
|
|
4584
4609
|
agentBudget: setup.agent_budget.map((budget) => ({
|