@haven_ai/mcp 0.2.1-alpha.0 → 0.3.0-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 +6 -3
- package/dist/cli.cjs +29 -20
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +29 -20
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +29 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -20
- package/dist/index.d.ts +8 -20
- package/dist/index.js +29 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -54,7 +54,6 @@ async function loadCredentialsFromFile(path) {
|
|
|
54
54
|
delegateKey,
|
|
55
55
|
agentId: stringField(raw.agent_id ?? raw.agentId),
|
|
56
56
|
accountAddress,
|
|
57
|
-
safeAddress: accountAddress,
|
|
58
57
|
delegateAddress: stringField(raw.delegate_address ?? raw.delegateAddress),
|
|
59
58
|
chainId: numberField(raw.chain_id ?? raw.chainId),
|
|
60
59
|
network: stringField(raw.network),
|
|
@@ -84,13 +83,11 @@ async function loadCredentialsFromSplitFiles(identityPath, signerPath) {
|
|
|
84
83
|
identity.agent_id ?? identity.agentId,
|
|
85
84
|
signer.agent_id ?? signer.agentId
|
|
86
85
|
),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{ caseInsensitive: true }
|
|
93
|
-
)
|
|
86
|
+
accountAddress: matchingStringField(
|
|
87
|
+
"account_address",
|
|
88
|
+
readAccountAddressField(identity),
|
|
89
|
+
readAccountAddressField(signer),
|
|
90
|
+
{ caseInsensitive: true }
|
|
94
91
|
),
|
|
95
92
|
delegateAddress: matchingStringField(
|
|
96
93
|
"delegate_address",
|
|
@@ -145,7 +142,7 @@ function loadCredentialsFromEnv() {
|
|
|
145
142
|
apiKey,
|
|
146
143
|
delegateKey,
|
|
147
144
|
agentId: stringField(process.env.HAVEN_AGENT_ID),
|
|
148
|
-
|
|
145
|
+
accountAddress: readAccountAddressEnv(process.env),
|
|
149
146
|
chainId: numberField(process.env.HAVEN_CHAIN_ID),
|
|
150
147
|
network: stringField(process.env.HAVEN_NETWORK),
|
|
151
148
|
apiUrl: stringField(process.env.HAVEN_API_URL)
|
|
@@ -155,10 +152,22 @@ function readAccountAddressField(raw) {
|
|
|
155
152
|
return stringField(raw.account_address ?? raw.safe_address ?? raw.safeAddress);
|
|
156
153
|
}
|
|
157
154
|
function readAccountAddressEnv(env) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
const current = stringField(env.HAVEN_ACCOUNT_ADDRESS);
|
|
156
|
+
for (const name of ["HAVEN_WALLET_ADDRESS", "HAVEN_SAFE_ADDRESS"]) {
|
|
157
|
+
const retired = stringField(env[name]);
|
|
158
|
+
if (!retired) continue;
|
|
159
|
+
if (!current) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`${name} is retired (#2906) \u2014 Haven accounts are addressed as accounts, not Safes. Set HAVEN_ACCOUNT_ADDRESS to the same value. Refusing rather than ignoring it, because an unset account address silently skips the sweep-destination check.`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
if (retired.toLowerCase() !== current.toLowerCase()) {
|
|
165
|
+
throw new Error(
|
|
166
|
+
`${name} and HAVEN_ACCOUNT_ADDRESS were both set to different addresses. Remove the retired name, or make them match \u2014 picking one silently would hide the mismatch.`
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return current;
|
|
162
171
|
}
|
|
163
172
|
function stringField(value) {
|
|
164
173
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
@@ -721,7 +730,7 @@ function computeConsentHash(input) {
|
|
|
721
730
|
input.apiKeyPrefix,
|
|
722
731
|
input.apiUrl ?? "",
|
|
723
732
|
input.agentId ?? "",
|
|
724
|
-
(input.
|
|
733
|
+
(input.accountAddress ?? "").toLowerCase(),
|
|
725
734
|
(input.delegateAddress ?? "").toLowerCase(),
|
|
726
735
|
input.chainId ?? ""
|
|
727
736
|
].join("|");
|
|
@@ -740,7 +749,7 @@ function renderConsentBlock(input, hash) {
|
|
|
740
749
|
];
|
|
741
750
|
if (input.apiUrl) lines.push(`Haven API: ${input.apiUrl}`);
|
|
742
751
|
if (input.agentId) lines.push(`Agent ID: ${input.agentId}`);
|
|
743
|
-
if (input.
|
|
752
|
+
if (input.accountAddress) lines.push(`Haven wallet (Safe): ${input.accountAddress}`);
|
|
744
753
|
if (input.delegateAddress) lines.push(`Delegate (local signer): ${input.delegateAddress}`);
|
|
745
754
|
if (typeof input.chainId === "number") lines.push(`Chain ID: ${input.chainId}`);
|
|
746
755
|
lines.push("");
|
|
@@ -847,14 +856,14 @@ async function writeAckFile(path, hash) {
|
|
|
847
856
|
}
|
|
848
857
|
async function consentInputFromClient(haven, seed, toolNames) {
|
|
849
858
|
let allowanceSummary = seed.allowanceSummary ?? [];
|
|
850
|
-
let
|
|
859
|
+
let accountAddress = seed.accountAddress;
|
|
851
860
|
let delegateAddress = seed.delegateAddress;
|
|
852
861
|
let chainId = seed.chainId;
|
|
853
862
|
try {
|
|
854
863
|
const summary = await haven.getAllowances();
|
|
855
864
|
const list = isAllowanceSummary(summary) ? summary.allowances : Array.isArray(summary) ? summary : [];
|
|
856
865
|
if (isAllowanceSummary(summary)) {
|
|
857
|
-
|
|
866
|
+
accountAddress = summary.accountAddress ?? accountAddress;
|
|
858
867
|
delegateAddress = summary.delegateAddress;
|
|
859
868
|
chainId = typeof summary.chainId === "number" ? summary.chainId : chainId;
|
|
860
869
|
}
|
|
@@ -870,7 +879,7 @@ async function consentInputFromClient(haven, seed, toolNames) {
|
|
|
870
879
|
apiKeyPrefix: derivePrefix(seed.apiKey),
|
|
871
880
|
apiUrl: seed.apiUrl,
|
|
872
881
|
agentId: seed.agentId,
|
|
873
|
-
|
|
882
|
+
accountAddress,
|
|
874
883
|
delegateAddress,
|
|
875
884
|
chainId,
|
|
876
885
|
toolNames,
|
|
@@ -904,7 +913,7 @@ async function resolveHavenClient(options = {}) {
|
|
|
904
913
|
return { client, credentials };
|
|
905
914
|
}
|
|
906
915
|
var MCP_NAME = "@haven_ai/mcp";
|
|
907
|
-
var MCP_VERSION = "0.
|
|
916
|
+
var MCP_VERSION = "0.3.0-alpha.0";
|
|
908
917
|
var MCP_INSTRUCTIONS = [
|
|
909
918
|
"Haven local MCP server: signs in-process with the delegate key it holds on",
|
|
910
919
|
"this machine \u2014 the key never leaves this process. Call haven_get_agent",
|
|
@@ -977,7 +986,7 @@ async function runConsentGate(haven, credentials, options) {
|
|
|
977
986
|
apiKey: credentials.apiKey,
|
|
978
987
|
apiUrl: credentials.apiUrl,
|
|
979
988
|
agentId: credentials.agentId,
|
|
980
|
-
|
|
989
|
+
accountAddress: credentials.accountAddress,
|
|
981
990
|
delegateAddress: credentials.delegateAddress,
|
|
982
991
|
chainId: credentials.chainId,
|
|
983
992
|
allowanceSummary: credentials.allowanceSummary
|