@haven_ai/mcp 0.0.0-dev.202609282315.dd06d7c → 0.0.0-dev.202609291042.e2cc5e2

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 CHANGED
@@ -238,6 +238,17 @@ async function warnIfCredentialFilePermissive(path, log = (message) => process.s
238
238
  );
239
239
  }
240
240
  }
241
+ var TASK_BUDGET_MIN_SIGNER_VERSION = "0.6.0-alpha.0";
242
+ var SIGNER_CAPABILITY_KEY = "haven/signer-compatibility";
243
+ function taskSignerCompatibilityNotice() {
244
+ return {
245
+ task_sign_context_version: sdk.TASK_SIGN_CONTEXT_VERSION,
246
+ min_signer_version: TASK_BUDGET_MIN_SIGNER_VERSION,
247
+ signer_capability: SIGNER_CAPABILITY_KEY,
248
+ check: `Call next_tool with next_arguments EXACTLY as given \u2014 the signer fetches the exact bytes by task_budget_id. If haven_sign answers SIGNING_ERROR with a message starting "Pass payment_id (preferred for delegation-rail x402", the signer predates task budgets and signed nothing: first close this budget with haven_close_task_budget { task_budget_id } to release it, then update the connector by running \`${sdk.connectorUpgradeCommand()}\` and the repair line it prints, then open the budget again.`,
249
+ fallback: `haven_sign answered SIGNING_ERROR with a message starting "Pass payment_id (preferred for delegation-rail x402" \u2014 the signer predates task budgets and signed nothing: call haven_close_task_budget { task_budget_id } to release the pending budget, then update the connector by running \`${sdk.connectorUpgradeCommand()}\` and the repair line it prints, then open the budget again. There is no relay fallback for this signing context.`
250
+ };
251
+ }
241
252
  var headersSchema = v3.z.record(v3.z.string(), v3.z.string()).optional();
242
253
  var toolSchemas = {
243
254
  haven_send: {
@@ -248,7 +259,13 @@ var toolSchemas = {
248
259
  /** REMOVED (#3411): declared only so the resolver can refuse it by name, never accepted. */
249
260
  idempotencyKey: v3.z.string().optional().describe("REMOVED (#3411): refused \u2014 send idempotency_key"),
250
261
  /** #3329: spend against an open task budget instead of the agent's period budget. */
251
- task_budget_id: v3.z.string().min(1).optional()
262
+ task_budget_id: v3.z.string().min(1).optional(),
263
+ /**
264
+ * #3330: spend against an open sub-budget this agent HOLDS (it is the
265
+ * sub-agent B) instead of the agent's own budget. Mutually exclusive
266
+ * with task_budget_id — the backend refuses a body naming both.
267
+ */
268
+ sub_budget_id: v3.z.string().min(1).optional()
252
269
  },
253
270
  haven_pay_mcp_tool: {
254
271
  merchant_url: v3.z.string().url(),
@@ -273,7 +290,9 @@ var toolSchemas = {
273
290
  /** REMOVED (#3411): declared only so the resolver can refuse it by name, never accepted. */
274
291
  idempotencyKey: v3.z.string().optional().describe("REMOVED (#3411): refused \u2014 send idempotency_key"),
275
292
  /** #3329: spend against an open task budget instead of the agent's period budget. */
276
- task_budget_id: v3.z.string().min(1).optional()
293
+ task_budget_id: v3.z.string().min(1).optional(),
294
+ /** #3330: spend against an open sub-budget this agent holds (it is sub-agent B). Mutually exclusive with task_budget_id. */
295
+ sub_budget_id: v3.z.string().min(1).optional()
277
296
  },
278
297
  haven_pay_x402: {
279
298
  url: v3.z.string().url(),
@@ -284,7 +303,9 @@ var toolSchemas = {
284
303
  /** REMOVED (#3411): declared only so the resolver can refuse it by name, never accepted. */
285
304
  idempotencyKey: v3.z.string().optional().describe("REMOVED (#3411): refused \u2014 send idempotency_key"),
286
305
  /** #3329: spend against an open task budget instead of the agent's period budget. */
287
- task_budget_id: v3.z.string().min(1).optional()
306
+ task_budget_id: v3.z.string().min(1).optional(),
307
+ /** #3330: spend against an open sub-budget this agent holds (it is sub-agent B). Mutually exclusive with task_budget_id. */
308
+ sub_budget_id: v3.z.string().min(1).optional()
288
309
  },
289
310
  haven_resume_x402_payment: {
290
311
  payment_id: v3.z.string().optional(),
@@ -406,7 +427,10 @@ function createToolHandlers(haven) {
406
427
  idempotencyKey: args.resolvedIdempotencyKey,
407
428
  // #3329: spend against an open task budget instead of the
408
429
  // agent's period budget, when the caller names one.
409
- ...typeof args.task_budget_id === "string" ? { taskBudgetId: args.task_budget_id } : {}
430
+ ...typeof args.task_budget_id === "string" ? { taskBudgetId: args.task_budget_id } : {},
431
+ // #3330: spend through a sub-budget this agent holds (it is
432
+ // sub-agent B). Exactly one of the two ids, never both.
433
+ ...typeof args.sub_budget_id === "string" ? { subBudgetId: args.sub_budget_id } : {}
410
434
  });
411
435
  return {
412
436
  payment_id: result.paymentId,
@@ -506,7 +530,8 @@ function createToolHandlers(haven) {
506
530
  return runTool(async () => {
507
531
  const response = await haven.payX402Quote(args.quote, {
508
532
  idempotencyKey: args.resolvedIdempotencyKey,
509
- ...typeof args.task_budget_id === "string" ? { taskBudgetId: args.task_budget_id } : {}
533
+ ...typeof args.task_budget_id === "string" ? { taskBudgetId: args.task_budget_id } : {},
534
+ ...typeof args.sub_budget_id === "string" ? { subBudgetId: args.sub_budget_id } : {}
510
535
  });
511
536
  return responsePayload(response);
512
537
  }, warnings);
@@ -518,7 +543,8 @@ function createToolHandlers(haven) {
518
543
  return runTool(async () => {
519
544
  const response = await haven.fetch(args.url, requestInit(args), {
520
545
  idempotencyKey: args.resolvedIdempotencyKey,
521
- ...typeof args.task_budget_id === "string" ? { taskBudgetId: args.task_budget_id } : {}
546
+ ...typeof args.task_budget_id === "string" ? { taskBudgetId: args.task_budget_id } : {},
547
+ ...typeof args.sub_budget_id === "string" ? { subBudgetId: args.sub_budget_id } : {}
522
548
  });
523
549
  return responsePayload(response);
524
550
  }, warnings);
@@ -643,7 +669,8 @@ function createToolHandlers(haven) {
643
669
  task_budget: result.taskBudget,
644
670
  next_action: "sign",
645
671
  next_tool: "mcp__haven-signer__haven_sign",
646
- next_arguments: { task_budget_id: result.taskBudget.id }
672
+ next_arguments: { task_budget_id: result.taskBudget.id },
673
+ signer_compatibility: taskSignerCompatibilityNotice()
647
674
  };
648
675
  });
649
676
  },
@@ -658,7 +685,8 @@ function createToolHandlers(haven) {
658
685
  task_budget: result.taskBudget,
659
686
  next_action: "sign",
660
687
  next_tool: "mcp__haven-signer__haven_sign",
661
- next_arguments: { task_budget_id: args.task_budget_id }
688
+ next_arguments: { task_budget_id: args.task_budget_id },
689
+ signer_compatibility: taskSignerCompatibilityNotice()
662
690
  };
663
691
  });
664
692
  },
@@ -1115,7 +1143,7 @@ async function resolveHavenClient(options = {}) {
1115
1143
  return { client, credentials };
1116
1144
  }
1117
1145
  var MCP_NAME = "@haven_ai/mcp";
1118
- var MCP_VERSION = "0.0.0-dev.202609282315.dd06d7c";
1146
+ var MCP_VERSION = "0.0.0-dev.202609291042.e2cc5e2";
1119
1147
  var MCP_INSTRUCTIONS = [
1120
1148
  "Haven local MCP server: signs in-process with the delegate key it holds on",
1121
1149
  "this machine \u2014 the key never leaves this process. Call haven_get_agent",