@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.d.cts
CHANGED
|
@@ -170,7 +170,10 @@ interface AgentIdentity {
|
|
|
170
170
|
id: string;
|
|
171
171
|
name: string;
|
|
172
172
|
status: string;
|
|
173
|
+
/** @deprecated #2908 — same value as `account_address`; the server drops it at #2914. */
|
|
173
174
|
safe_address: string | null;
|
|
175
|
+
/** #2908 — the account-vocabulary twin (not emitted by every server yet; read first, never required). */
|
|
176
|
+
account_address?: string | null;
|
|
174
177
|
delegate_address: string | null;
|
|
175
178
|
chain_id: number | null;
|
|
176
179
|
execution_rail: 'legacy' | 'delegation' | string;
|
|
@@ -204,7 +207,13 @@ interface WriteCredentialInput {
|
|
|
204
207
|
apiKey: string;
|
|
205
208
|
delegateKey: string;
|
|
206
209
|
delegateAddress: string;
|
|
207
|
-
|
|
210
|
+
/**
|
|
211
|
+
* The Haven account (smart account) address. Written to every credential
|
|
212
|
+
* file as `account_address` ONLY (#2908 — write the new name, never the
|
|
213
|
+
* old; the readers in `@haven_ai/signer` / `@haven_ai/mcp` fall back to the
|
|
214
|
+
* pre-#2908 `safe_address` permanently, so a file from either era loads).
|
|
215
|
+
*/
|
|
216
|
+
accountAddress?: string;
|
|
208
217
|
chainId?: number;
|
|
209
218
|
network?: string;
|
|
210
219
|
agentBudget?: Array<{
|
|
@@ -729,7 +738,7 @@ type WiringCollisionResolution = {
|
|
|
729
738
|
action: 'abort';
|
|
730
739
|
};
|
|
731
740
|
|
|
732
|
-
declare const CONNECTOR_VERSION = "0.1
|
|
741
|
+
declare const CONNECTOR_VERSION = "0.2.1-alpha.0";
|
|
733
742
|
interface ConnectOptions {
|
|
734
743
|
setupToken: string;
|
|
735
744
|
apiBaseUrl: string;
|
|
@@ -1129,11 +1138,11 @@ declare function isConnectError(err: unknown): err is ConnectError;
|
|
|
1129
1138
|
|
|
1130
1139
|
declare const MCP_RUNTIME_MANIFEST: {
|
|
1131
1140
|
readonly mcpPackage: "@haven_ai/mcp";
|
|
1132
|
-
readonly mcpVersion: "0.1
|
|
1141
|
+
readonly mcpVersion: "0.2.1-alpha.0";
|
|
1133
1142
|
readonly sdkPackage: "@haven_ai/sdk";
|
|
1134
|
-
readonly sdkVersion: "0.1
|
|
1143
|
+
readonly sdkVersion: "0.2.1-alpha.0";
|
|
1135
1144
|
readonly signerPackage: "@haven_ai/signer";
|
|
1136
|
-
readonly signerVersion: "0.1
|
|
1145
|
+
readonly signerVersion: "0.2.1-alpha.0";
|
|
1137
1146
|
readonly minimumNodeVersion: "22.0.0";
|
|
1138
1147
|
readonly supportedClients: readonly ["codex-cli", "codex-desktop", "claude-code"];
|
|
1139
1148
|
readonly requiredTools: readonly string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -170,7 +170,10 @@ interface AgentIdentity {
|
|
|
170
170
|
id: string;
|
|
171
171
|
name: string;
|
|
172
172
|
status: string;
|
|
173
|
+
/** @deprecated #2908 — same value as `account_address`; the server drops it at #2914. */
|
|
173
174
|
safe_address: string | null;
|
|
175
|
+
/** #2908 — the account-vocabulary twin (not emitted by every server yet; read first, never required). */
|
|
176
|
+
account_address?: string | null;
|
|
174
177
|
delegate_address: string | null;
|
|
175
178
|
chain_id: number | null;
|
|
176
179
|
execution_rail: 'legacy' | 'delegation' | string;
|
|
@@ -204,7 +207,13 @@ interface WriteCredentialInput {
|
|
|
204
207
|
apiKey: string;
|
|
205
208
|
delegateKey: string;
|
|
206
209
|
delegateAddress: string;
|
|
207
|
-
|
|
210
|
+
/**
|
|
211
|
+
* The Haven account (smart account) address. Written to every credential
|
|
212
|
+
* file as `account_address` ONLY (#2908 — write the new name, never the
|
|
213
|
+
* old; the readers in `@haven_ai/signer` / `@haven_ai/mcp` fall back to the
|
|
214
|
+
* pre-#2908 `safe_address` permanently, so a file from either era loads).
|
|
215
|
+
*/
|
|
216
|
+
accountAddress?: string;
|
|
208
217
|
chainId?: number;
|
|
209
218
|
network?: string;
|
|
210
219
|
agentBudget?: Array<{
|
|
@@ -729,7 +738,7 @@ type WiringCollisionResolution = {
|
|
|
729
738
|
action: 'abort';
|
|
730
739
|
};
|
|
731
740
|
|
|
732
|
-
declare const CONNECTOR_VERSION = "0.1
|
|
741
|
+
declare const CONNECTOR_VERSION = "0.2.1-alpha.0";
|
|
733
742
|
interface ConnectOptions {
|
|
734
743
|
setupToken: string;
|
|
735
744
|
apiBaseUrl: string;
|
|
@@ -1129,11 +1138,11 @@ declare function isConnectError(err: unknown): err is ConnectError;
|
|
|
1129
1138
|
|
|
1130
1139
|
declare const MCP_RUNTIME_MANIFEST: {
|
|
1131
1140
|
readonly mcpPackage: "@haven_ai/mcp";
|
|
1132
|
-
readonly mcpVersion: "0.1
|
|
1141
|
+
readonly mcpVersion: "0.2.1-alpha.0";
|
|
1133
1142
|
readonly sdkPackage: "@haven_ai/sdk";
|
|
1134
|
-
readonly sdkVersion: "0.1
|
|
1143
|
+
readonly sdkVersion: "0.2.1-alpha.0";
|
|
1135
1144
|
readonly signerPackage: "@haven_ai/signer";
|
|
1136
|
-
readonly signerVersion: "0.1
|
|
1145
|
+
readonly signerVersion: "0.2.1-alpha.0";
|
|
1137
1146
|
readonly minimumNodeVersion: "22.0.0";
|
|
1138
1147
|
readonly supportedClients: readonly ["codex-cli", "codex-desktop", "claude-code"];
|
|
1139
1148
|
readonly requiredTools: readonly string[];
|
package/dist/index.js
CHANGED
|
@@ -266,7 +266,7 @@ function signerPayload(input) {
|
|
|
266
266
|
delegate_key: input.delegateKey,
|
|
267
267
|
delegate_address: input.delegateAddress,
|
|
268
268
|
agent_id: input.agentId,
|
|
269
|
-
|
|
269
|
+
account_address: input.accountAddress,
|
|
270
270
|
chain_id: input.chainId,
|
|
271
271
|
network: input.network,
|
|
272
272
|
x402_binding_signer: input.x402BindingSigner,
|
|
@@ -277,7 +277,7 @@ function identityPayload(input) {
|
|
|
277
277
|
return {
|
|
278
278
|
api_key: input.apiKey,
|
|
279
279
|
agent_id: input.agentId,
|
|
280
|
-
|
|
280
|
+
account_address: input.accountAddress,
|
|
281
281
|
chain_id: input.chainId,
|
|
282
282
|
network: input.network,
|
|
283
283
|
api_url: input.apiUrl,
|
|
@@ -290,7 +290,7 @@ function agentPayload(input) {
|
|
|
290
290
|
return {
|
|
291
291
|
agent_id: input.agentId,
|
|
292
292
|
delegate_address: input.delegateAddress,
|
|
293
|
-
|
|
293
|
+
account_address: input.accountAddress,
|
|
294
294
|
chain_id: input.chainId,
|
|
295
295
|
network: input.network,
|
|
296
296
|
agent_budget: input.agentBudget,
|
|
@@ -324,13 +324,20 @@ async function readStoredCredentials(serverName, agentIdOrSlug, baseDir) {
|
|
|
324
324
|
apiUrl,
|
|
325
325
|
hostedMcpUrl,
|
|
326
326
|
delegateAddress: asString(agent.delegate_address) ?? asString(signer.delegate_address),
|
|
327
|
-
|
|
327
|
+
...readStoredAccountAddress(identity, agent),
|
|
328
328
|
chainId: typeof identity.chain_id === "number" ? identity.chain_id : void 0,
|
|
329
329
|
network: asString(identity.network),
|
|
330
330
|
x402BindingSigner: asString(signer.x402_binding_signer),
|
|
331
331
|
agentBudget: Array.isArray(identity.agent_budget) ? identity.agent_budget : void 0
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
+
function readStoredAccountAddress(identity, agent) {
|
|
335
|
+
const fresh = asString(identity.account_address) ?? asString(agent.account_address);
|
|
336
|
+
if (fresh) return { accountAddress: fresh, accountAddressKey: "account_address" };
|
|
337
|
+
const legacy = asString(identity.safe_address) ?? asString(agent.safe_address);
|
|
338
|
+
if (legacy) return { accountAddress: legacy, accountAddressKey: "safe_address" };
|
|
339
|
+
return {};
|
|
340
|
+
}
|
|
334
341
|
async function discoverSoleAgentDirectory(baseDir) {
|
|
335
342
|
const root = defaultCredentialRoot(baseDir);
|
|
336
343
|
let entries = [];
|
|
@@ -542,9 +549,9 @@ var init_runtime_manifest = __esm({
|
|
|
542
549
|
mcpPackage: "@haven_ai/mcp",
|
|
543
550
|
mcpVersion: MCP_VERSION,
|
|
544
551
|
sdkPackage: "@haven_ai/sdk",
|
|
545
|
-
sdkVersion: "0.1
|
|
552
|
+
sdkVersion: "0.2.1-alpha.0",
|
|
546
553
|
signerPackage: "@haven_ai/signer",
|
|
547
|
-
signerVersion: "0.1
|
|
554
|
+
signerVersion: "0.2.1-alpha.0",
|
|
548
555
|
// Sourced from the SDK, never a literal (#1161). This field read '20.0.0'
|
|
549
556
|
// while every package's `engines` said `>=24` and the docs said `>=24.0.0`,
|
|
550
557
|
// so the guard that was supposed to enforce the floor waved Node v23 through
|
|
@@ -1432,7 +1439,7 @@ async function buildLocalMcpConsentInput(identityPath, signerPath) {
|
|
|
1432
1439
|
apiKey: credentials.apiKey,
|
|
1433
1440
|
apiUrl: credentials.apiUrl,
|
|
1434
1441
|
agentId: credentials.agentId,
|
|
1435
|
-
safeAddress: credentials.safeAddress,
|
|
1442
|
+
safeAddress: credentials.accountAddress ?? credentials.safeAddress,
|
|
1436
1443
|
delegateAddress: credentials.delegateAddress,
|
|
1437
1444
|
chainId: credentials.chainId,
|
|
1438
1445
|
allowanceSummary: credentials.allowanceSummary
|
|
@@ -2474,7 +2481,7 @@ async function buildSignerConsentInput(signerPath) {
|
|
|
2474
2481
|
});
|
|
2475
2482
|
return {
|
|
2476
2483
|
delegateAddress: signer.delegateAddress,
|
|
2477
|
-
safeAddress: credentials.safeAddress,
|
|
2484
|
+
safeAddress: credentials.accountAddress ?? credentials.safeAddress,
|
|
2478
2485
|
agentId: credentials.agentId,
|
|
2479
2486
|
chainId: credentials.chainId,
|
|
2480
2487
|
network: credentials.network,
|
|
@@ -2650,7 +2657,7 @@ async function installRuntime(input, deps = {}) {
|
|
|
2650
2657
|
(signerProbe === void 0 || signerProbe.status === "ok");
|
|
2651
2658
|
const restartRequired = configResult.restartRequired || restartRequiredForRuntime(runtime, deps.env);
|
|
2652
2659
|
const errorCode = configResult.errorCode ?? (configResult.runtimeMcpMode === "local_stdio" ? localMcpErrorCode(signerCredentialReady, localMcpConsent, localMcpProbe?.status) : hostedMcpErrorCode(configResult.hostedConfigured, hostedProbe.status) ?? signerConsentErrorCode(signerCredentialReady, signerConsent) ?? signerProbeErrorCode(signerProbe));
|
|
2653
|
-
const hostedProbeMessages = configResult.hostedConfigured && hostedProbe.status !== "ok" ? [`Hosted Haven MCP probe failed: ${hostedProbe.status}.`] : configResult.hostedConfigured ? ["Verified hosted Haven MCP tools
|
|
2660
|
+
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."] : [];
|
|
2654
2661
|
const signerProbeMessages = signerProbe ? signerProbe.status === "ok" ? ["Verified local Haven signer with a stdio handshake."] : [
|
|
2655
2662
|
`Local Haven signer handshake failed: ${signerProbe.status}.`,
|
|
2656
2663
|
`Re-run \`${connectorRerunCommand()}\` to repair the signer setup.`
|
|
@@ -3312,7 +3319,9 @@ async function finishRekey(options, deps = {}) {
|
|
|
3312
3319
|
apiKey: options.newApiKey,
|
|
3313
3320
|
delegateKey: pending.new_delegate_key,
|
|
3314
3321
|
delegateAddress: pending.new_delegate_address,
|
|
3315
|
-
|
|
3322
|
+
// #2908: the stored value (already new-name-first) wins; the hosted
|
|
3323
|
+
// identity's `account_address` twin before its deprecated `safe_address`.
|
|
3324
|
+
accountAddress: stored.accountAddress ?? identity.account_address ?? identity.safe_address ?? void 0,
|
|
3316
3325
|
chainId: stored.chainId ?? identity.chain_id ?? void 0,
|
|
3317
3326
|
network: stored.network,
|
|
3318
3327
|
agentBudget: stored.agentBudget,
|
|
@@ -3498,6 +3507,7 @@ var init_rekey_restart = __esm({
|
|
|
3498
3507
|
// src/doctor.ts
|
|
3499
3508
|
var doctor_exports = {};
|
|
3500
3509
|
__export(doctor_exports, {
|
|
3510
|
+
describeAccountAddressKey: () => describeAccountAddressKey,
|
|
3501
3511
|
runDoctor: () => runDoctor,
|
|
3502
3512
|
runRepair: () => runRepair
|
|
3503
3513
|
});
|
|
@@ -3648,6 +3658,15 @@ async function readIdentity(directory) {
|
|
|
3648
3658
|
return void 0;
|
|
3649
3659
|
}
|
|
3650
3660
|
}
|
|
3661
|
+
function describeAccountAddressKey(identity, signerFile) {
|
|
3662
|
+
const files = [identity, signerFile];
|
|
3663
|
+
const has = (key) => files.some((f) => typeof f?.[key] === "string" && f[key].trim() !== "");
|
|
3664
|
+
if (has("account_address")) return "account address stored as account_address";
|
|
3665
|
+
if (has("safe_address")) {
|
|
3666
|
+
return "account address stored under the pre-#2908 name safe_address \u2014 still read; the next --rekey or setup rewrites it as account_address";
|
|
3667
|
+
}
|
|
3668
|
+
return "no account address stored";
|
|
3669
|
+
}
|
|
3651
3670
|
async function checksForAgent(entry, input, deps) {
|
|
3652
3671
|
const { directory, identity, sidecar } = entry;
|
|
3653
3672
|
const checks = [];
|
|
@@ -3664,7 +3683,7 @@ async function checksForAgent(entry, input, deps) {
|
|
|
3664
3683
|
id: "credentials",
|
|
3665
3684
|
label: "Agent credentials",
|
|
3666
3685
|
ok: credentialsOk,
|
|
3667
|
-
detail: credentialsOk ? `identity.json and signer.json parse (agent ${identity?.agent_id ?? "unknown"})` : "identity.json or signer.json is missing or unparseable.",
|
|
3686
|
+
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.",
|
|
3668
3687
|
...credentialsOk ? {} : { repair: `Re-run the full setup with a fresh token: ${RERUN} --setup <token>.` }
|
|
3669
3688
|
});
|
|
3670
3689
|
if (!sidecar) {
|
|
@@ -3688,14 +3707,17 @@ async function checksForAgent(entry, input, deps) {
|
|
|
3688
3707
|
...matches ? {} : { repair: `Run: ${RERUN} --doctor --repair --runtime ${input.runtime} with the same HAVEN_*_SPEC variables set.` }
|
|
3689
3708
|
});
|
|
3690
3709
|
} else {
|
|
3691
|
-
const
|
|
3710
|
+
const intact = await installedRuntimeMatchesVersions(sidecar.runtime_directory, sidecar.cli_path, {
|
|
3711
|
+
signerVersion: sidecar.signer_version,
|
|
3712
|
+
sdkVersion: sidecar.sdk_version
|
|
3713
|
+
});
|
|
3692
3714
|
const versionOk = sidecar.signer_version === MCP_RUNTIME_MANIFEST.signerVersion;
|
|
3693
|
-
const ok =
|
|
3715
|
+
const ok = intact && versionOk;
|
|
3694
3716
|
checks.push({
|
|
3695
3717
|
id: "signer_runtime",
|
|
3696
3718
|
label: "Signer runtime (preinstalled wrapper)",
|
|
3697
3719
|
ok,
|
|
3698
|
-
detail: ok ? `Installed ${sidecar.signer_package}@${sidecar.signer_version} at ${sidecar.runtime_directory}` :
|
|
3720
|
+
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.`,
|
|
3699
3721
|
...ok ? {} : { repair: `Run: ${RERUN} --doctor --repair --runtime ${input.runtime}` }
|
|
3700
3722
|
});
|
|
3701
3723
|
}
|
|
@@ -3708,9 +3730,9 @@ async function checksForAgent(entry, input, deps) {
|
|
|
3708
3730
|
id: "hosted_mcp",
|
|
3709
3731
|
label: "Hosted Haven MCP",
|
|
3710
3732
|
ok: probe.status === "ok",
|
|
3711
|
-
detail: probe.status === "ok" ? `
|
|
3733
|
+
detail: probe.status === "ok" ? `MCP tools endpoint is reachable (${hostedUrl}).` : `MCP tools endpoint probe failed: ${probe.status} (${hostedUrl}).`,
|
|
3712
3734
|
...probe.status === "ok" ? {} : {
|
|
3713
|
-
repair:
|
|
3735
|
+
repair: "Check network access and runtime configuration for the hosted MCP URL, then re-run --doctor."
|
|
3714
3736
|
}
|
|
3715
3737
|
});
|
|
3716
3738
|
} else {
|
|
@@ -3944,14 +3966,17 @@ async function runDoctor(input, deps = {}) {
|
|
|
3944
3966
|
const identity = await readIdentity(entry.directory);
|
|
3945
3967
|
const tombstone = await readAgentTombstone(entry.directory);
|
|
3946
3968
|
const otherAgent = entry.agentId ?? basename(entry.directory);
|
|
3947
|
-
|
|
3948
|
-
if (!identity?.api_key || !otherUrl) {
|
|
3969
|
+
if (!identity?.api_key || !identity.api_url) {
|
|
3949
3970
|
if (tombstone) retired.push(`${otherAgent} (retired ${tombstone.retired_at})`);
|
|
3950
|
-
else unverifiable.push(`${otherAgent} (no stored key/URL to probe)`);
|
|
3971
|
+
else unverifiable.push(`${otherAgent} (no stored key/API URL to probe)`);
|
|
3951
3972
|
continue;
|
|
3952
3973
|
}
|
|
3953
3974
|
const suffix = tombstone ? " [tombstoned \u2014 key material still present]" : "";
|
|
3954
|
-
const probe = await (deps.
|
|
3975
|
+
const probe = await (deps.probeHostedIdentity ?? probeHostedAgentIdentity)(
|
|
3976
|
+
identity.api_key,
|
|
3977
|
+
identity.api_url,
|
|
3978
|
+
deps.fetch
|
|
3979
|
+
);
|
|
3955
3980
|
if (probe.status === "ok") live.push({ label: `${otherAgent}${suffix}`, entry });
|
|
3956
3981
|
else if (probe.status === "unauthorized") revoked.push(`${otherAgent}${suffix}`);
|
|
3957
3982
|
else unverifiable.push(`${otherAgent} (${probe.status})${suffix}`);
|
|
@@ -4395,7 +4420,7 @@ async function pathExists2(path) {
|
|
|
4395
4420
|
init_unwire();
|
|
4396
4421
|
init_local_mcp_runtime();
|
|
4397
4422
|
init_runtime_manifest();
|
|
4398
|
-
var CONNECTOR_VERSION = "0.1
|
|
4423
|
+
var CONNECTOR_VERSION = "0.2.1-alpha.0";
|
|
4399
4424
|
var CONNECT_OUTCOME_SCHEMA_VERSION = 1;
|
|
4400
4425
|
var failureOutcomesByError = /* @__PURE__ */ new WeakMap();
|
|
4401
4426
|
function failureOutcomeFor(runtimeHint, error) {
|
|
@@ -4571,7 +4596,7 @@ async function executeConnect(options, deps, trace) {
|
|
|
4571
4596
|
apiKey: localApiKey,
|
|
4572
4597
|
delegateKey: localKey.privateKey,
|
|
4573
4598
|
delegateAddress: localKey.address,
|
|
4574
|
-
|
|
4599
|
+
accountAddress: setup.haven_wallet.address,
|
|
4575
4600
|
chainId: setup.haven_wallet.chain_id,
|
|
4576
4601
|
network: setup.haven_wallet.network,
|
|
4577
4602
|
agentBudget: setup.agent_budget.map((budget) => ({
|