@haven_ai/connect 0.1.10-alpha.0 → 0.1.11-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 +74 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +72 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +74 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +72 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/cli.cjs
CHANGED
|
@@ -9,7 +9,6 @@ var path = require('path');
|
|
|
9
9
|
var child_process = require('child_process');
|
|
10
10
|
var util = require('util');
|
|
11
11
|
var mcp = require('@haven_ai/mcp');
|
|
12
|
-
var sdk = require('@haven_ai/sdk');
|
|
13
12
|
var signer = require('@haven_ai/signer');
|
|
14
13
|
|
|
15
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -214,9 +213,9 @@ var MCP_RUNTIME_MANIFEST = {
|
|
|
214
213
|
mcpPackage: "@haven_ai/mcp",
|
|
215
214
|
mcpVersion: mcp.MCP_VERSION,
|
|
216
215
|
sdkPackage: "@haven_ai/sdk",
|
|
217
|
-
sdkVersion: "0.1.
|
|
216
|
+
sdkVersion: "0.1.11-alpha.0",
|
|
218
217
|
signerPackage: "@haven_ai/signer",
|
|
219
|
-
signerVersion: "0.1.
|
|
218
|
+
signerVersion: "0.1.11-alpha.0",
|
|
220
219
|
minimumNodeVersion: "20.0.0",
|
|
221
220
|
supportedClients: ["codex-cli", "codex-desktop", "claude-code"],
|
|
222
221
|
requiredTools: mcp.registeredToolNames()
|
|
@@ -1157,6 +1156,75 @@ async function assertFileExists(path, label) {
|
|
|
1157
1156
|
throw new Error(`Missing ${label}: ${path}`);
|
|
1158
1157
|
}
|
|
1159
1158
|
}
|
|
1159
|
+
|
|
1160
|
+
// src/skill-content.ts
|
|
1161
|
+
var HAVEN_SKILL_MD = `---
|
|
1162
|
+
name: haven-pay
|
|
1163
|
+
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.
|
|
1164
|
+
---
|
|
1165
|
+
|
|
1166
|
+
# Haven: pay from a Haven wallet
|
|
1167
|
+
|
|
1168
|
+
This skill lets the agent make payments from the user's Haven wallet through
|
|
1169
|
+
the Haven MCP tools. Every payment is checked against the agent's on-chain
|
|
1170
|
+
budget before money moves; payments above the remaining budget wait for the
|
|
1171
|
+
user's approval in Haven.
|
|
1172
|
+
|
|
1173
|
+
## When to use this skill
|
|
1174
|
+
|
|
1175
|
+
- The user asks to send money, pay someone, tip, donate, or transfer tokens.
|
|
1176
|
+
- A request returns HTTP 402 (x402): use the Haven pay tools to settle it,
|
|
1177
|
+
then retry the original request.
|
|
1178
|
+
|
|
1179
|
+
## Identity and budget come from the tools \u2014 never assume them
|
|
1180
|
+
|
|
1181
|
+
Do not guess the wallet address, network, or budget. Read them live:
|
|
1182
|
+
|
|
1183
|
+
- \`haven_get_agent\` \u2014 agent identity, Haven wallet address, network.
|
|
1184
|
+
- \`haven_get_allowances\` \u2014 current per-token budgets and what remains.
|
|
1185
|
+
|
|
1186
|
+
Budgets reset on a period the user chose. If a payment exceeds the remaining
|
|
1187
|
+
budget it is queued for the user to approve in the Haven dashboard \u2014 this is
|
|
1188
|
+
normal, not an error.
|
|
1189
|
+
|
|
1190
|
+
## Paying
|
|
1191
|
+
|
|
1192
|
+
- **Direct transfer:** \`haven_pay\` with recipient, amount, and token.
|
|
1193
|
+
- **x402 paywall:** \`haven_quote_x402\` to get a quote, then
|
|
1194
|
+
\`haven_pay_x402_quote\`. In the hosted setup the signing step happens in
|
|
1195
|
+
the local Haven signer; follow the tool results \u2014 they tell you the next
|
|
1196
|
+
action at every step. Retry the original request only when the result says
|
|
1197
|
+
\`retry_original_x402_request\`.
|
|
1198
|
+
- **Status:** \`haven_get_payment_status\` with a \`payment_id\` to check on
|
|
1199
|
+
queued or in-flight payments. Do not poll in a tight loop.
|
|
1200
|
+
|
|
1201
|
+
## Approval semantics
|
|
1202
|
+
|
|
1203
|
+
- A result with \`pending_approval\` means the payment exceeded the remaining
|
|
1204
|
+
budget and is waiting for the user in Haven. Tell the user, then check
|
|
1205
|
+
status later.
|
|
1206
|
+
- Never ask the user for private keys and never try to sign anything
|
|
1207
|
+
yourself \u2014 Haven signs. If a tool reports a missing or invalid credential,
|
|
1208
|
+
tell the user to re-run the Haven setup command.
|
|
1209
|
+
|
|
1210
|
+
## Failure handling
|
|
1211
|
+
|
|
1212
|
+
Haven errors are shaped \`{ error, status, details? }\` and written for
|
|
1213
|
+
humans \u2014 surface the message verbatim. Common cases:
|
|
1214
|
+
|
|
1215
|
+
- \`pending_approval\`: queued for the user's approval (see above).
|
|
1216
|
+
- \`insufficient_funds\`: the Haven wallet doesn't hold enough of that token.
|
|
1217
|
+
Suggest the user add funds in the Haven dashboard.
|
|
1218
|
+
- Budget exceeded: tell the user how much remains (from
|
|
1219
|
+
\`haven_get_allowances\`) and that they can raise the budget in Haven.
|
|
1220
|
+
|
|
1221
|
+
## Revoke
|
|
1222
|
+
|
|
1223
|
+
If this agent's credential may have leaked, tell the user to pause or revoke
|
|
1224
|
+
the agent in the Haven dashboard under Agents. New requests stop immediately
|
|
1225
|
+
for that credential.
|
|
1226
|
+
`;
|
|
1227
|
+
var SKILL_FOLDER_NAME = "haven-pay";
|
|
1160
1228
|
async function acknowledgeLocalSignerConsent(signerPath, log) {
|
|
1161
1229
|
try {
|
|
1162
1230
|
const input = await buildSignerConsentInput(signerPath);
|
|
@@ -1439,9 +1507,9 @@ async function defaultRunCommand(command, args) {
|
|
|
1439
1507
|
}
|
|
1440
1508
|
async function installClaudeSkill(homeDir) {
|
|
1441
1509
|
try {
|
|
1442
|
-
const skillDir = path.resolve(homeDir ?? os.homedir(), ".claude", "skills",
|
|
1510
|
+
const skillDir = path.resolve(homeDir ?? os.homedir(), ".claude", "skills", SKILL_FOLDER_NAME);
|
|
1443
1511
|
await promises.mkdir(skillDir, { recursive: true });
|
|
1444
|
-
await promises.writeFile(path.join(skillDir, "SKILL.md"),
|
|
1512
|
+
await promises.writeFile(path.join(skillDir, "SKILL.md"), HAVEN_SKILL_MD, "utf8");
|
|
1445
1513
|
return {
|
|
1446
1514
|
installed: true,
|
|
1447
1515
|
messages: ["Installed the generic Haven payment skill (~/.claude/skills/haven-pay). It contains no secrets."]
|
|
@@ -1534,7 +1602,7 @@ function localRuntimePrepareErrorCode(err) {
|
|
|
1534
1602
|
}
|
|
1535
1603
|
|
|
1536
1604
|
// src/runtime.ts
|
|
1537
|
-
var CONNECTOR_VERSION = "0.1.
|
|
1605
|
+
var CONNECTOR_VERSION = "0.1.11-alpha.0";
|
|
1538
1606
|
async function runConnect(options, deps = {}) {
|
|
1539
1607
|
const connectorVersion = options.connectorVersion ?? CONNECTOR_VERSION;
|
|
1540
1608
|
const api = deps.api ?? createConnectApiClient(options.apiBaseUrl);
|