@haven_ai/mcp 0.8.0-alpha.0 → 0.9.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.js CHANGED
@@ -336,7 +336,21 @@ var toolSchemas = {
336
336
  compact: z.boolean().optional().describe("true drops challengePayload, selectedPayment and protocolReceiptPayload from each row; omit for the full row.")
337
337
  },
338
338
  haven_verify_receipt: {
339
- receipt: z.unknown()
339
+ receipt: z.unknown(),
340
+ // #3723: the spread form — the endpoint's `{ receipt, verification }`
341
+ // spread as top-level arguments — verifies: `verification` is declared
342
+ // ACCEPTED-AND-IGNORED (Haven's own self-check, never read). The stdio
343
+ // z.object would strip it silently anyway; declaring it keeps the schema
344
+ // identical to the hosted runtime's, where the key must be declared to
345
+ // pass its strict refusal.
346
+ verification: z.unknown().optional().describe("accepted and ignored \u2014 verification reads the receipt itself")
347
+ },
348
+ // #3723: the signed bundle's read — `{ receipt }` only, settled payments
349
+ // only. The endpoint's server-side `verification` is deliberately NOT
350
+ // returned: it is computed on Haven's server, not offline, and an agent
351
+ // that trusted it would skip haven_verify_receipt.
352
+ haven_get_receipt: {
353
+ payment_id: z.string().min(1)
340
354
  },
341
355
  // #3329: a budget for one task that ends by itself — a short-lived child of
342
356
  // the agent's own budget, capped and time-boxed independently of the period
@@ -421,6 +435,8 @@ var toolDescriptions = {
421
435
  haven_submit_catalog_entry: composeDescription(toolDescriptions$1.submitCatalogEntry),
422
436
  haven_list_receipts: composeDescription(toolDescriptions$1.listReceipts),
423
437
  haven_verify_receipt: composeDescription(toolDescriptions$1.verifyReceipt),
438
+ // #3723: the signed bundle's read, described from the shared fragment.
439
+ haven_get_receipt: composeDescription(toolDescriptions$1.getReceipt),
424
440
  haven_open_task_budget: OPEN_TASK_BUDGET_DESCRIPTION,
425
441
  haven_close_task_budget: CLOSE_TASK_BUDGET_DESCRIPTION,
426
442
  haven_get_task_budget: GET_TASK_BUDGET_DESCRIPTION,
@@ -767,6 +783,17 @@ function createToolHandlers(haven) {
767
783
  const args = objectInput("haven_verify_receipt", input);
768
784
  return runTool(async () => verifyPaymentReceipt(args.receipt));
769
785
  },
786
+ // #3723: the signed bundle's home on the local surface. Parsed INSIDE
787
+ // runTool, so a missing payment_id is a structured INVALID_INPUT failure
788
+ // rather than a thrown ZodError (the hosted runtime's parseStrict already
789
+ // answers that way). Returns `{ receipt }` only — the endpoint's
790
+ // server-side `verification` is not offline evidence, and the agent
791
+ // verifies with haven_verify_receipt, which reads the bundle unchanged.
792
+ haven_get_receipt: async (input) => runTool(async () => {
793
+ const args = objectInput("haven_get_receipt", input);
794
+ const { receipt } = await haven.getReceipt(args.payment_id);
795
+ return { receipt };
796
+ }),
770
797
  haven_open_task_budget: async (input) => {
771
798
  const args = objectInput("haven_open_task_budget", input);
772
799
  return runTool(async () => {
@@ -1050,6 +1077,14 @@ function normalizeError(err) {
1050
1077
  body: err.body
1051
1078
  };
1052
1079
  }
1080
+ if (err instanceof z.ZodError) {
1081
+ return {
1082
+ success: false,
1083
+ code: "INVALID_INPUT",
1084
+ message: err.errors.map((e) => `${e.path.join(".") || "(root)"}: ${e.message}`).join("; "),
1085
+ statusCode: 400
1086
+ };
1087
+ }
1053
1088
  if (err instanceof HavenError) {
1054
1089
  return {
1055
1090
  success: false,
@@ -1278,7 +1313,7 @@ async function resolveHavenClient(options = {}) {
1278
1313
  return { client, credentials };
1279
1314
  }
1280
1315
  var MCP_NAME = "@haven_ai/mcp";
1281
- var MCP_VERSION = "0.8.0-alpha.0";
1316
+ var MCP_VERSION = "0.9.0-alpha.0";
1282
1317
  var MCP_INSTRUCTIONS = [
1283
1318
  "Haven local MCP server: signs in-process with the delegate key it holds on",
1284
1319
  "this machine \u2014 the key never leaves this process. Call haven_get_agent",