@haven_ai/sdk 0.1.26-alpha.0 → 0.1.27-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/index.cjs +20 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -4
- package/dist/index.d.ts +26 -4
- package/dist/index.js +20 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1514,7 +1514,8 @@ var HavenClient = class {
|
|
|
1514
1514
|
isResetPending: a.onchain.isResetPending
|
|
1515
1515
|
};
|
|
1516
1516
|
});
|
|
1517
|
-
|
|
1517
|
+
const readiness = deriveReadiness(agent.status, allowances);
|
|
1518
|
+
return { ...agent, readiness, spend_authority_readiness: readiness, allowances };
|
|
1518
1519
|
}
|
|
1519
1520
|
/**
|
|
1520
1521
|
* Sweep stranded USDC and ETH from the delegate EOA back to the originating Safe.
|
|
@@ -2094,7 +2095,10 @@ var HavenClient = class {
|
|
|
2094
2095
|
// redeemable ONLY by them. `null` here means the merchant advertised none
|
|
2095
2096
|
// (or an empty array, which the backend 400s on), so the field is OMITTED
|
|
2096
2097
|
// rather than sent empty. See x402FacilitatorAddresses.
|
|
2097
|
-
...selection.facilitatorAddresses ? { facilitatorAddresses: selection.facilitatorAddresses } : {}
|
|
2098
|
+
...selection.facilitatorAddresses ? { facilitatorAddresses: selection.facilitatorAddresses } : {},
|
|
2099
|
+
// #1307/#1547: persisted so the settle leg can rehydrate the merchant
|
|
2100
|
+
// call by payment_id on this scheme too, not only on the 3009 bridge.
|
|
2101
|
+
...options.mcpCallContext ? { mcpCallContext: options.mcpCallContext } : {}
|
|
2098
2102
|
});
|
|
2099
2103
|
if (!raw.payment_id) {
|
|
2100
2104
|
throw new HavenApiError("No payment_id returned from x402/authorize", 500, raw);
|
|
@@ -3576,9 +3580,9 @@ var toolDescriptions = {
|
|
|
3576
3580
|
nextActionGuidance: ""
|
|
3577
3581
|
},
|
|
3578
3582
|
getAgent: {
|
|
3579
|
-
summary: "Return the authenticated agent identity AND its live spend authority in one call: Haven wallet, delegate, chain, raw status,
|
|
3583
|
+
summary: "Return the authenticated agent identity AND its live spend authority in one call: Haven wallet, delegate, chain, raw status, spend_authority_readiness, and per-token remaining allowance (atomic + human-readable). The recommended first call in a new session to confirm who you are and whether Haven will let you spend right now.",
|
|
3580
3584
|
selectionGuidance: "Use this as the one-shot orientation/bootstrap at the start of a session, or whenever you need to confirm identity together with whether the agent can spend right now. For a detailed per-token breakdown (configured vs spent vs reset window) use haven_get_allowances.",
|
|
3581
|
-
behavior: 'Reads identity plus the live spend-authority snapshot in one shot \u2014 the on-chain AllowanceModule on the legacy rail, the active budget delegation on the delegation rail. readiness is "ready" when at least one token has remaining spend authority, "needs_approval" when the agent is active but has none, and "revoked" when the credential is not active. What an over-budget payment does differs by rail: on the legacy AllowanceModule rail it is queued for the wallet owner to approve in Haven; on the delegation rail there is no approval queue \u2014 an over-budget redemption reverts on-chain, so ask the owner to grant or raise the budget in Haven rather than waiting for an approval. allowances[] carries remainingAtomic and remainingDisplay per token. Identity fields (id, name, status, safeAddress, delegateAddress, chainId) are unchanged from before.',
|
|
3585
|
+
behavior: 'Reads identity plus the live spend-authority snapshot in one shot \u2014 the on-chain AllowanceModule on the legacy rail, the active budget delegation on the delegation rail. spend_authority_readiness (readiness is a deprecated alias, same value) is "ready" when at least one token has remaining spend authority, "needs_approval" when the agent is active but has none, and "revoked" when the credential is not active. It covers hosted identity + on-chain spend authority ONLY \u2014 the hosted server cannot see the LOCAL signer, so "ready" does not mean the signer can start; verify the signer with a signer tool call or connect --doctor. What an over-budget payment does differs by rail: on the legacy AllowanceModule rail it is queued for the wallet owner to approve in Haven; on the delegation rail there is no approval queue \u2014 an over-budget redemption reverts on-chain, so ask the owner to grant or raise the budget in Haven rather than waiting for an approval. allowances[] carries remainingAtomic and remainingDisplay per token. Identity fields (id, name, status, safeAddress, delegateAddress, chainId) are unchanged from before.',
|
|
3582
3586
|
nextActionGuidance: ""
|
|
3583
3587
|
},
|
|
3584
3588
|
getAllowances: {
|
|
@@ -3609,7 +3613,7 @@ var toolDescriptions = {
|
|
|
3609
3613
|
summary: "Step 1 of a purchase: discover payable services from Haven's curated merchant catalog \u2014 names, prices, and which pay tool to use next.",
|
|
3610
3614
|
selectionGuidance: "Use this when the user asks what the agent can buy, pay for, or which paid services exist \u2014 or when you need a resource URL for a service the user described. Do NOT use for balance, budget, or spend-limit questions \u2014 use haven_get_allowances. Do NOT use to pay \u2014 each returned entry names the pay tool to use next.",
|
|
3611
3615
|
behavior: "Use each entry's suggested_tool field first \u2014 it names the exact next call. Read-only lookup against Haven's curated catalog; entries are periodically re-verified against the live merchant and degraded entries are flagged. Use category for a case-insensitive category filter (for example, VPN or vpn), or search for a product name, category, or description term. Returns name, description, price, rail, resource URL, tool_name, tool_arguments, and suggested_tool. The catalog price (price_display/price_atomic, marked price_is_indicative) is a last-verified hint, NOT authoritative \u2014 the real price comes from the merchant's live 402 at pay time. Never creates a payment, signature, or approval.",
|
|
3612
|
-
nextActionGuidance: `Pick an entry and pay it with the tool named in suggested_tool, passing the entry's resource_url, tool_name, and tool_arguments for MCP merchants. Confirm the price from the live pay-tool result (not the catalog), and pass the user's cap as max_amount_human in whole tokens ("no more than 1 USDC" \u2192 max_amount_human: "1") \u2014 never convert it to atomic units by hand
|
|
3616
|
+
nextActionGuidance: `Pick an entry and pay it with the tool named in suggested_tool, passing the entry's resource_url, tool_name, and tool_arguments for MCP merchants. Confirm the price from the live pay-tool result (not the catalog), and pass the user's cap as max_amount_human in whole tokens ("no more than 1 USDC" \u2192 max_amount_human: "1") \u2014 never convert it to atomic units by hand.`
|
|
3613
3617
|
},
|
|
3614
3618
|
sweep_delegate: {
|
|
3615
3619
|
summary: "Sweep stranded USDC and/or ETH from the delegate wallet back to the originating Safe.",
|
|
@@ -3854,9 +3858,13 @@ user's approval in Haven.
|
|
|
3854
3858
|
|
|
3855
3859
|
Hosted tools run in the \`mcp__haven__\` namespace. Local signing tools run in
|
|
3856
3860
|
the \`mcp__haven-signer__\` namespace and keep the delegate key on this machine.
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3861
|
+
That namespacing is Claude-family; other runtimes name the servers by their
|
|
3862
|
+
own config keys (Codex: \`haven\`, \`haven_signer\`). Tool results carry the
|
|
3863
|
+
exact next step (\`next_action\`, \`next_tool\`, \`next_arguments\`, plus the
|
|
3864
|
+
runtime-neutral \`next_tool_server\` + \`next_tool_name\` \u2014 the bare tool name
|
|
3865
|
+
on that logical server, whatever your runtime calls it).
|
|
3866
|
+
Follow those fields first; the prose below is fallback and orientation, not
|
|
3867
|
+
the source of truth.
|
|
3860
3868
|
|
|
3861
3869
|
## When to use this skill
|
|
3862
3870
|
|
|
@@ -3882,8 +3890,10 @@ Before any payment, confirm the *live remaining* budget with the tools \u2014
|
|
|
3882
3890
|
spending:
|
|
3883
3891
|
|
|
3884
3892
|
- \`mcp__haven__haven_get_agent\` \u2014 the recommended first call: identity
|
|
3885
|
-
(wallet, network) plus
|
|
3886
|
-
\`revoked\`) and live remaining per-token allowance, in one shot.
|
|
3893
|
+
(wallet, network) plus \`spend_authority_readiness\` (\`ready\` / \`needs_approval\` /
|
|
3894
|
+
\`revoked\`) and live remaining per-token allowance, in one shot. That signal
|
|
3895
|
+
covers hosted identity and on-chain spend authority only \u2014 it cannot see the
|
|
3896
|
+
local signer; the signer is verified by calling any signer tool.
|
|
3887
3897
|
- \`mcp__haven__haven_get_allowances\` \u2014 detailed per-token breakdown
|
|
3888
3898
|
(configured, spent, reset window) when you need more than the summary.
|
|
3889
3899
|
|