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