@haven_ai/sdk 0.1.11-alpha.0 → 0.1.13-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 +71 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +70 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3046,6 +3046,75 @@ var havenTools = {
|
|
|
3046
3046
|
openai: openaiTools
|
|
3047
3047
|
};
|
|
3048
3048
|
|
|
3049
|
+
// src/skill-content.ts
|
|
3050
|
+
var HAVEN_SKILL_MD = `---
|
|
3051
|
+
name: haven-pay
|
|
3052
|
+
description: Pay for things from the user's Haven wallet within their agent rules. Use when the user asks to send, pay, tip, or transfer crypto \u2014 or when a request hits an HTTP 402 (x402) paywall.
|
|
3053
|
+
---
|
|
3054
|
+
|
|
3055
|
+
# Haven: pay from a Haven wallet
|
|
3056
|
+
|
|
3057
|
+
This skill lets the agent make payments from the user's Haven wallet through
|
|
3058
|
+
the Haven MCP tools. Every payment is checked against the agent's on-chain
|
|
3059
|
+
budget before money moves; payments above the remaining budget wait for the
|
|
3060
|
+
user's approval in Haven.
|
|
3061
|
+
|
|
3062
|
+
## When to use this skill
|
|
3063
|
+
|
|
3064
|
+
- The user asks to send money, pay someone, tip, donate, or transfer tokens.
|
|
3065
|
+
- A request returns HTTP 402 (x402): use the Haven pay tools to settle it,
|
|
3066
|
+
then retry the original request.
|
|
3067
|
+
|
|
3068
|
+
## Identity and budget come from the tools \u2014 never assume them
|
|
3069
|
+
|
|
3070
|
+
Do not guess the wallet address, network, or budget. Read them live:
|
|
3071
|
+
|
|
3072
|
+
- \`haven_get_agent\` \u2014 agent identity, Haven wallet address, network.
|
|
3073
|
+
- \`haven_get_allowances\` \u2014 current per-token budgets and what remains.
|
|
3074
|
+
|
|
3075
|
+
Budgets reset on a period the user chose. If a payment exceeds the remaining
|
|
3076
|
+
budget it is queued for the user to approve in the Haven dashboard \u2014 this is
|
|
3077
|
+
normal, not an error.
|
|
3078
|
+
|
|
3079
|
+
## Paying
|
|
3080
|
+
|
|
3081
|
+
- **Direct transfer:** \`haven_pay\` with recipient, amount, and token.
|
|
3082
|
+
- **x402 paywall:** \`haven_quote_x402\` to get a quote, then
|
|
3083
|
+
\`haven_pay_x402_quote\`. In the hosted setup the signing step happens in
|
|
3084
|
+
the local Haven signer; follow the tool results \u2014 they tell you the next
|
|
3085
|
+
action at every step. Retry the original request only when the result says
|
|
3086
|
+
\`retry_original_x402_request\`.
|
|
3087
|
+
- **Status:** \`haven_get_payment_status\` with a \`payment_id\` to check on
|
|
3088
|
+
queued or in-flight payments. Do not poll in a tight loop.
|
|
3089
|
+
|
|
3090
|
+
## Approval semantics
|
|
3091
|
+
|
|
3092
|
+
- A result with \`pending_approval\` means the payment exceeded the remaining
|
|
3093
|
+
budget and is waiting for the user in Haven. Tell the user, then check
|
|
3094
|
+
status later.
|
|
3095
|
+
- Never ask the user for private keys and never try to sign anything
|
|
3096
|
+
yourself \u2014 Haven signs. If a tool reports a missing or invalid credential,
|
|
3097
|
+
tell the user to re-run the Haven setup command.
|
|
3098
|
+
|
|
3099
|
+
## Failure handling
|
|
3100
|
+
|
|
3101
|
+
Haven errors are shaped \`{ error, status, details? }\` and written for
|
|
3102
|
+
humans \u2014 surface the message verbatim. Common cases:
|
|
3103
|
+
|
|
3104
|
+
- \`pending_approval\`: queued for the user's approval (see above).
|
|
3105
|
+
- \`insufficient_funds\`: the Haven wallet doesn't hold enough of that token.
|
|
3106
|
+
Suggest the user add funds in the Haven dashboard.
|
|
3107
|
+
- Budget exceeded: tell the user how much remains (from
|
|
3108
|
+
\`haven_get_allowances\`) and that they can raise the budget in Haven.
|
|
3109
|
+
|
|
3110
|
+
## Revoke
|
|
3111
|
+
|
|
3112
|
+
If this agent's credential may have leaked, tell the user to pause or revoke
|
|
3113
|
+
the agent in the Haven dashboard under Agents. New requests stop immediately
|
|
3114
|
+
for that credential.
|
|
3115
|
+
`;
|
|
3116
|
+
var SKILL_FOLDER_NAME = "haven-pay";
|
|
3117
|
+
|
|
3049
3118
|
exports.AGENT_PAYMENT_NEXT_ACTION_VALUES = AGENT_PAYMENT_NEXT_ACTION_VALUES;
|
|
3050
3119
|
exports.AGENT_PAYMENT_PHASE_VALUES = AGENT_PAYMENT_PHASE_VALUES;
|
|
3051
3120
|
exports.AGENT_PAYMENT_RAIL_VALUES = AGENT_PAYMENT_RAIL_VALUES;
|
|
@@ -3058,12 +3127,14 @@ exports.AgentPaymentPhaseSchema = AgentPaymentPhaseSchema;
|
|
|
3058
3127
|
exports.AgentPaymentRail = AgentPaymentRail;
|
|
3059
3128
|
exports.AgentPaymentRailDescriptions = AgentPaymentRailDescriptions;
|
|
3060
3129
|
exports.AgentPaymentRailSchema = AgentPaymentRailSchema;
|
|
3130
|
+
exports.HAVEN_SKILL_MD = HAVEN_SKILL_MD;
|
|
3061
3131
|
exports.HavenApiError = HavenApiError;
|
|
3062
3132
|
exports.HavenClient = HavenClient;
|
|
3063
3133
|
exports.HavenError = HavenError;
|
|
3064
3134
|
exports.HavenPaymentStateError = HavenPaymentStateError;
|
|
3065
3135
|
exports.HavenSigningError = HavenSigningError;
|
|
3066
3136
|
exports.HavenTimeoutError = HavenTimeoutError;
|
|
3137
|
+
exports.SKILL_FOLDER_NAME = SKILL_FOLDER_NAME;
|
|
3067
3138
|
exports.addressFromKey = addressFromKey;
|
|
3068
3139
|
exports.buildMachinePaymentIdempotencyKey = buildMachinePaymentIdempotencyKey;
|
|
3069
3140
|
exports.buildX402ExpectedMessage = buildX402ExpectedMessage;
|