@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/cli.cjs
CHANGED
|
@@ -9,6 +9,7 @@ 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');
|
|
12
13
|
var signer = require('@haven_ai/signer');
|
|
13
14
|
|
|
14
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -147,6 +148,7 @@ async function writeCredentialFiles(input) {
|
|
|
147
148
|
safe_address: input.safeAddress,
|
|
148
149
|
chain_id: input.chainId,
|
|
149
150
|
network: input.network,
|
|
151
|
+
x402_binding_signer: input.x402BindingSigner,
|
|
150
152
|
note: "Local signer credential. Haven backend never receives this private key."
|
|
151
153
|
},
|
|
152
154
|
input.warn
|
|
@@ -213,9 +215,9 @@ var MCP_RUNTIME_MANIFEST = {
|
|
|
213
215
|
mcpPackage: "@haven_ai/mcp",
|
|
214
216
|
mcpVersion: mcp.MCP_VERSION,
|
|
215
217
|
sdkPackage: "@haven_ai/sdk",
|
|
216
|
-
sdkVersion: "0.1.
|
|
218
|
+
sdkVersion: "0.1.12-alpha.0",
|
|
217
219
|
signerPackage: "@haven_ai/signer",
|
|
218
|
-
signerVersion: "0.1.
|
|
220
|
+
signerVersion: "0.1.12-alpha.0",
|
|
219
221
|
minimumNodeVersion: "20.0.0",
|
|
220
222
|
supportedClients: ["codex-cli", "codex-desktop", "claude-code"],
|
|
221
223
|
requiredTools: mcp.registeredToolNames()
|
|
@@ -1156,75 +1158,6 @@ async function assertFileExists(path, label) {
|
|
|
1156
1158
|
throw new Error(`Missing ${label}: ${path}`);
|
|
1157
1159
|
}
|
|
1158
1160
|
}
|
|
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";
|
|
1228
1161
|
async function acknowledgeLocalSignerConsent(signerPath, log) {
|
|
1229
1162
|
try {
|
|
1230
1163
|
const input = await buildSignerConsentInput(signerPath);
|
|
@@ -1507,9 +1440,9 @@ async function defaultRunCommand(command, args) {
|
|
|
1507
1440
|
}
|
|
1508
1441
|
async function installClaudeSkill(homeDir) {
|
|
1509
1442
|
try {
|
|
1510
|
-
const skillDir = path.resolve(homeDir ?? os.homedir(), ".claude", "skills", SKILL_FOLDER_NAME);
|
|
1443
|
+
const skillDir = path.resolve(homeDir ?? os.homedir(), ".claude", "skills", sdk.SKILL_FOLDER_NAME);
|
|
1511
1444
|
await promises.mkdir(skillDir, { recursive: true });
|
|
1512
|
-
await promises.writeFile(path.join(skillDir, "SKILL.md"), HAVEN_SKILL_MD, "utf8");
|
|
1445
|
+
await promises.writeFile(path.join(skillDir, "SKILL.md"), sdk.HAVEN_SKILL_MD, "utf8");
|
|
1513
1446
|
return {
|
|
1514
1447
|
installed: true,
|
|
1515
1448
|
messages: ["Installed the generic Haven payment skill (~/.claude/skills/haven-pay). It contains no secrets."]
|
|
@@ -1602,7 +1535,7 @@ function localRuntimePrepareErrorCode(err) {
|
|
|
1602
1535
|
}
|
|
1603
1536
|
|
|
1604
1537
|
// src/runtime.ts
|
|
1605
|
-
var CONNECTOR_VERSION = "0.1.
|
|
1538
|
+
var CONNECTOR_VERSION = "0.1.12-alpha.0";
|
|
1606
1539
|
async function runConnect(options, deps = {}) {
|
|
1607
1540
|
const connectorVersion = options.connectorVersion ?? CONNECTOR_VERSION;
|
|
1608
1541
|
const api = deps.api ?? createConnectApiClient(options.apiBaseUrl);
|
|
@@ -1667,10 +1600,18 @@ async function runConnect(options, deps = {}) {
|
|
|
1667
1600
|
})),
|
|
1668
1601
|
apiUrl: options.apiBaseUrl,
|
|
1669
1602
|
hostedMcpUrl: registration.hosted_mcp_url,
|
|
1603
|
+
x402BindingSigner: setup.x402_binding_signer ?? void 0,
|
|
1670
1604
|
warn: log
|
|
1671
1605
|
});
|
|
1672
1606
|
log(`Stored Haven identity credential locally: ${credentialPaths.identityPath}`);
|
|
1673
1607
|
log(`Stored local signer credential locally: ${credentialPaths.signerPath}`);
|
|
1608
|
+
if (setup.x402_binding_signer) {
|
|
1609
|
+
log("Configured x402 binding signer for the local signer.");
|
|
1610
|
+
} else {
|
|
1611
|
+
log(
|
|
1612
|
+
"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."
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1674
1615
|
const runtimeInstall = await runRuntimeInstall({
|
|
1675
1616
|
runtime: options.runtime,
|
|
1676
1617
|
hostedMcpUrl: registration.hosted_mcp_url,
|