@haven_ai/mcp 0.4.0-alpha.0 → 0.5.0-alpha.1
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.cjs +14 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +15 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +14 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -732,6 +732,9 @@ function normalizeError(err) {
|
|
|
732
732
|
phase: stringOrUndefined(body?.phase),
|
|
733
733
|
nextAction: stringOrUndefined(body?.nextAction) ?? stringOrUndefined(body?.next_action) ?? sdk.AgentPaymentNextAction.StopAndTellUser,
|
|
734
734
|
next_action: stringOrUndefined(body?.nextAction) ?? stringOrUndefined(body?.next_action) ?? sdk.AgentPaymentNextAction.StopAndTellUser,
|
|
735
|
+
// #3303: a backend refusal that already names why no tool follows (the
|
|
736
|
+
// 426 `client_outdated` does) keeps that reason at the top level.
|
|
737
|
+
...typeof body?.next_tool_omitted_reason === "string" ? { next_tool_omitted_reason: body.next_tool_omitted_reason } : {},
|
|
735
738
|
body: err.body
|
|
736
739
|
};
|
|
737
740
|
}
|
|
@@ -784,7 +787,7 @@ function renderConsentBlock(input, hash) {
|
|
|
784
787
|
];
|
|
785
788
|
if (input.apiUrl) lines.push(`Haven API: ${input.apiUrl}`);
|
|
786
789
|
if (input.agentId) lines.push(`Agent ID: ${input.agentId}`);
|
|
787
|
-
if (input.accountAddress) lines.push(`Haven wallet
|
|
790
|
+
if (input.accountAddress) lines.push(`Haven wallet: ${input.accountAddress}`);
|
|
788
791
|
if (input.delegateAddress) lines.push(`Delegate (local signer): ${input.delegateAddress}`);
|
|
789
792
|
if (typeof input.chainId === "number") lines.push(`Chain ID: ${input.chainId}`);
|
|
790
793
|
lines.push("");
|
|
@@ -947,7 +950,10 @@ async function resolveHavenClient(options = {}) {
|
|
|
947
950
|
const client = new sdk.HavenClient({
|
|
948
951
|
apiKey: credentials.apiKey,
|
|
949
952
|
delegateKey: credentials.delegateKey,
|
|
950
|
-
baseUrl: credentials.apiUrl
|
|
953
|
+
baseUrl: credentials.apiUrl,
|
|
954
|
+
// #3303: name this package, not the SDK inside it, so the backend's
|
|
955
|
+
// update hint and refusal speak about what the user actually installed.
|
|
956
|
+
clientIdentity: sdk.havenClientIdentity(MCP_NAME, MCP_VERSION)
|
|
951
957
|
});
|
|
952
958
|
return { client, credentials };
|
|
953
959
|
}
|
|
@@ -956,7 +962,7 @@ async function createHavenMcpServer(options = {}) {
|
|
|
956
962
|
return buildMcpServer(haven);
|
|
957
963
|
}
|
|
958
964
|
var MCP_NAME = "@haven_ai/mcp";
|
|
959
|
-
var MCP_VERSION = "0.
|
|
965
|
+
var MCP_VERSION = "0.5.0-alpha.1";
|
|
960
966
|
var MCP_INSTRUCTIONS = [
|
|
961
967
|
"Haven local MCP server: signs in-process with the delegate key it holds on",
|
|
962
968
|
"this machine \u2014 the key never leaves this process. Call haven_get_agent",
|
|
@@ -993,7 +999,7 @@ function buildMcpServer(haven) {
|
|
|
993
999
|
toolSchemas[name],
|
|
994
1000
|
async (args) => haven.withRequestContext(
|
|
995
1001
|
{ "X-Haven-MCP-Tool": name },
|
|
996
|
-
async () => toMcpResult(await handlers[name](args))
|
|
1002
|
+
async () => toMcpResult(withClientUpdate(await handlers[name](args), haven.clientUpdate()))
|
|
997
1003
|
)
|
|
998
1004
|
);
|
|
999
1005
|
}
|
|
@@ -1043,6 +1049,10 @@ async function runConsentGate(haven, credentials, options) {
|
|
|
1043
1049
|
writeAck: options.writeAck
|
|
1044
1050
|
});
|
|
1045
1051
|
}
|
|
1052
|
+
function withClientUpdate(payload, hint) {
|
|
1053
|
+
if (!hint || payload.client_update) return payload;
|
|
1054
|
+
return { ...payload, client_update: hint };
|
|
1055
|
+
}
|
|
1046
1056
|
function toMcpResult(payload) {
|
|
1047
1057
|
return {
|
|
1048
1058
|
isError: !payload.success,
|