@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/cli.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("");
|
|
@@ -943,12 +946,15 @@ async function resolveHavenClient(options = {}) {
|
|
|
943
946
|
const client = new sdk.HavenClient({
|
|
944
947
|
apiKey: credentials.apiKey,
|
|
945
948
|
delegateKey: credentials.delegateKey,
|
|
946
|
-
baseUrl: credentials.apiUrl
|
|
949
|
+
baseUrl: credentials.apiUrl,
|
|
950
|
+
// #3303: name this package, not the SDK inside it, so the backend's
|
|
951
|
+
// update hint and refusal speak about what the user actually installed.
|
|
952
|
+
clientIdentity: sdk.havenClientIdentity(MCP_NAME, MCP_VERSION)
|
|
947
953
|
});
|
|
948
954
|
return { client, credentials };
|
|
949
955
|
}
|
|
950
956
|
var MCP_NAME = "@haven_ai/mcp";
|
|
951
|
-
var MCP_VERSION = "0.
|
|
957
|
+
var MCP_VERSION = "0.5.0-alpha.1";
|
|
952
958
|
var MCP_INSTRUCTIONS = [
|
|
953
959
|
"Haven local MCP server: signs in-process with the delegate key it holds on",
|
|
954
960
|
"this machine \u2014 the key never leaves this process. Call haven_get_agent",
|
|
@@ -985,7 +991,7 @@ function buildMcpServer(haven) {
|
|
|
985
991
|
toolSchemas[name],
|
|
986
992
|
async (args) => haven.withRequestContext(
|
|
987
993
|
{ "X-Haven-MCP-Tool": name },
|
|
988
|
-
async () => toMcpResult(await handlers[name](args))
|
|
994
|
+
async () => toMcpResult(withClientUpdate(await handlers[name](args), haven.clientUpdate()))
|
|
989
995
|
)
|
|
990
996
|
);
|
|
991
997
|
}
|
|
@@ -1035,6 +1041,10 @@ async function runConsentGate(haven, credentials, options) {
|
|
|
1035
1041
|
writeAck: options.writeAck
|
|
1036
1042
|
});
|
|
1037
1043
|
}
|
|
1044
|
+
function withClientUpdate(payload, hint) {
|
|
1045
|
+
if (!hint || payload.client_update) return payload;
|
|
1046
|
+
return { ...payload, client_update: hint };
|
|
1047
|
+
}
|
|
1038
1048
|
function toMcpResult(payload) {
|
|
1039
1049
|
return {
|
|
1040
1050
|
isError: !payload.success,
|