@haven_ai/mcp 0.3.0-alpha.0 → 0.4.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/dist/cli.cjs +42 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +42 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +42 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -2
- package/dist/index.d.ts +92 -2
- package/dist/index.js +42 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -304,11 +304,14 @@ var toolSchemas = {
|
|
|
304
304
|
website: v3.z.string().optional()
|
|
305
305
|
},
|
|
306
306
|
haven_list_receipts: {
|
|
307
|
-
limit: v3.z.number().int().min(1).max(100).optional()
|
|
307
|
+
limit: v3.z.number().int().min(1).max(100).optional(),
|
|
308
|
+
/** #3128: the previous page's next_cursor (a receipt id). */
|
|
309
|
+
cursor: v3.z.string().min(1).optional()
|
|
308
310
|
},
|
|
309
311
|
haven_verify_receipt: {
|
|
310
312
|
receipt: v3.z.unknown()
|
|
311
313
|
}
|
|
314
|
+
// #3101: keys survive on the type (see the hosted server's contracts.ts).
|
|
312
315
|
};
|
|
313
316
|
var toolDescriptions = {
|
|
314
317
|
haven_send: sdk.composeDescription(sdk.toolDescriptions.send),
|
|
@@ -499,12 +502,32 @@ function createToolHandlers(haven) {
|
|
|
499
502
|
source: entry.source,
|
|
500
503
|
domain_verified: entry.domainVerified,
|
|
501
504
|
verified_payable: entry.verifiedPayable,
|
|
502
|
-
// Which Haven pay tool reaches this entry from the local MCP surface
|
|
505
|
+
// Which Haven pay tool reaches this entry from the local MCP surface,
|
|
506
|
+
// and — #3100 (epic #3105, decision 4) — the arguments that tool
|
|
507
|
+
// accepts VERBATIM, spelled in ITS vocabulary (`merchant_url`, not
|
|
508
|
+
// the entry's `resource_url`). The local surface keeps pointing at
|
|
509
|
+
// its pay tools: they need no cap, so a verbatim hint exists.
|
|
503
510
|
// #1328: the 'mpp' rail's only-ever catalog row (the Haven MPP demo
|
|
504
511
|
// resource) is delisted with the mpp_demo retirement, so this
|
|
505
512
|
// fallback is unreachable today; it stays x402 rather than naming a
|
|
506
513
|
// deleted tool in case a future non-demo 'mpp' rail entry appears.
|
|
507
|
-
|
|
514
|
+
// A row without a tool_name cannot get a verbatim hint —
|
|
515
|
+
// haven_pay_mcp_tool requires tool_name — so it gets the REASON
|
|
516
|
+
// instead of a hint its own tool refuses (haven-reviewer on #3113;
|
|
517
|
+
// the epic's "omitted + reason, never null" shape, decision 3).
|
|
518
|
+
...entry.protocol === "mcp" ? entry.toolName ? {
|
|
519
|
+
suggested_tool: "haven_pay_mcp_tool",
|
|
520
|
+
suggested_arguments: {
|
|
521
|
+
merchant_url: entry.resourceUrl,
|
|
522
|
+
tool_name: entry.toolName,
|
|
523
|
+
...entry.toolArguments ? { arguments: entry.toolArguments } : {}
|
|
524
|
+
}
|
|
525
|
+
} : {
|
|
526
|
+
suggested_tool_omitted_reason: "this catalog row carries no tool_name, which haven_pay_mcp_tool requires; read the merchant's tool list yourself, then call haven_pay_mcp_tool with merchant_url, tool_name and arguments"
|
|
527
|
+
} : {
|
|
528
|
+
suggested_tool: "haven_pay_x402",
|
|
529
|
+
suggested_arguments: { url: entry.resourceUrl }
|
|
530
|
+
}
|
|
508
531
|
}));
|
|
509
532
|
});
|
|
510
533
|
},
|
|
@@ -524,7 +547,7 @@ function createToolHandlers(haven) {
|
|
|
524
547
|
},
|
|
525
548
|
haven_list_receipts: async (input) => {
|
|
526
549
|
const args = objectInput("haven_list_receipts", input);
|
|
527
|
-
return runTool(async () => haven.
|
|
550
|
+
return runTool(async () => haven.listReceiptsPage({ limit: args.limit, cursor: args.cursor }));
|
|
528
551
|
},
|
|
529
552
|
haven_verify_receipt: async (input) => {
|
|
530
553
|
const args = objectInput("haven_verify_receipt", input);
|
|
@@ -669,7 +692,11 @@ function normalizeError(err) {
|
|
|
669
692
|
message: err.message,
|
|
670
693
|
statusCode: err.statusCode,
|
|
671
694
|
nextAction: err.nextAction,
|
|
672
|
-
|
|
695
|
+
next_action: err.nextAction,
|
|
696
|
+
retry_with_new_quote: err.retryWithNewQuote,
|
|
697
|
+
// #3103: the local runtime's one decision site — no tool can act until
|
|
698
|
+
// the merchant recovers; the message carries retry_after_s.
|
|
699
|
+
next_tool_omitted_reason: "the merchant needs to recover first; re-quote after the retry_after_s in the message"
|
|
673
700
|
};
|
|
674
701
|
}
|
|
675
702
|
if (err instanceof sdk.HavenPaymentStateError) {
|
|
@@ -682,6 +709,7 @@ function normalizeError(err) {
|
|
|
682
709
|
status: err.status,
|
|
683
710
|
phase: err.phase,
|
|
684
711
|
nextAction: err.nextAction,
|
|
712
|
+
next_action: err.nextAction,
|
|
685
713
|
resume_state: err.resumeState,
|
|
686
714
|
body: err.body
|
|
687
715
|
};
|
|
@@ -703,6 +731,7 @@ function normalizeError(err) {
|
|
|
703
731
|
paymentId: err.paymentId,
|
|
704
732
|
phase: stringOrUndefined(body?.phase),
|
|
705
733
|
nextAction: stringOrUndefined(body?.nextAction) ?? stringOrUndefined(body?.next_action) ?? sdk.AgentPaymentNextAction.StopAndTellUser,
|
|
734
|
+
next_action: stringOrUndefined(body?.nextAction) ?? stringOrUndefined(body?.next_action) ?? sdk.AgentPaymentNextAction.StopAndTellUser,
|
|
706
735
|
body: err.body
|
|
707
736
|
};
|
|
708
737
|
}
|
|
@@ -719,7 +748,11 @@ function normalizeError(err) {
|
|
|
719
748
|
success: false,
|
|
720
749
|
code: "UNKNOWN_ERROR",
|
|
721
750
|
message: err instanceof Error ? err.message : String(err),
|
|
722
|
-
nextAction: sdk.AgentPaymentNextAction.StopAndTellUser
|
|
751
|
+
nextAction: sdk.AgentPaymentNextAction.StopAndTellUser,
|
|
752
|
+
next_action: sdk.AgentPaymentNextAction.StopAndTellUser,
|
|
753
|
+
// #3103: the second local decision site — nothing structured can follow an
|
|
754
|
+
// error this runtime did not recognise.
|
|
755
|
+
next_tool_omitted_reason: "an error this runtime does not recognise; tell the user what the message says"
|
|
723
756
|
};
|
|
724
757
|
}
|
|
725
758
|
function stringOrUndefined(value) {
|
|
@@ -915,7 +948,7 @@ async function resolveHavenClient(options = {}) {
|
|
|
915
948
|
return { client, credentials };
|
|
916
949
|
}
|
|
917
950
|
var MCP_NAME = "@haven_ai/mcp";
|
|
918
|
-
var MCP_VERSION = "0.
|
|
951
|
+
var MCP_VERSION = "0.4.0-alpha.0";
|
|
919
952
|
var MCP_INSTRUCTIONS = [
|
|
920
953
|
"Haven local MCP server: signs in-process with the delegate key it holds on",
|
|
921
954
|
"this machine \u2014 the key never leaves this process. Call haven_get_agent",
|
|
@@ -924,7 +957,8 @@ var MCP_INSTRUCTIONS = [
|
|
|
924
957
|
"",
|
|
925
958
|
"To pay: haven_discover_tools to find a payable service, then",
|
|
926
959
|
"haven_pay_mcp_tool for MCP merchants or haven_pay_x402 for any x402",
|
|
927
|
-
"paywall. Tool responses carry nextAction
|
|
960
|
+
"paywall. Tool responses carry next_action (nextAction is the same value, kept one more",
|
|
961
|
+
"release) and, when no tool follows, next_tool_omitted_reason \u2014 follow them; description prose",
|
|
928
962
|
"is fallback, not the source of truth.",
|
|
929
963
|
"",
|
|
930
964
|
"A payment outside the agent budget is declined before any money moves. Haven",
|