@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.js
CHANGED
|
@@ -7,6 +7,7 @@ import { join, resolve, dirname } from 'path';
|
|
|
7
7
|
import { execFile, spawn } from 'child_process';
|
|
8
8
|
import { promisify } from 'util';
|
|
9
9
|
import { registeredToolNames, MCP_VERSION, ensureConsent, computeConsentHash, loadCredentials, consentInputFromClient } from '@haven_ai/mcp';
|
|
10
|
+
import { SKILL_FOLDER_NAME, HAVEN_SKILL_MD } from '@haven_ai/sdk';
|
|
10
11
|
import { ensureSignerConsent, computeSignerConsentHash, loadSignerCredentials, createEdgeSigner, toolSchemas } from '@haven_ai/signer';
|
|
11
12
|
|
|
12
13
|
// src/api.ts
|
|
@@ -141,6 +142,7 @@ async function writeCredentialFiles(input) {
|
|
|
141
142
|
safe_address: input.safeAddress,
|
|
142
143
|
chain_id: input.chainId,
|
|
143
144
|
network: input.network,
|
|
145
|
+
x402_binding_signer: input.x402BindingSigner,
|
|
144
146
|
note: "Local signer credential. Haven backend never receives this private key."
|
|
145
147
|
},
|
|
146
148
|
input.warn
|
|
@@ -207,9 +209,9 @@ var MCP_RUNTIME_MANIFEST = {
|
|
|
207
209
|
mcpPackage: "@haven_ai/mcp",
|
|
208
210
|
mcpVersion: MCP_VERSION,
|
|
209
211
|
sdkPackage: "@haven_ai/sdk",
|
|
210
|
-
sdkVersion: "0.1.
|
|
212
|
+
sdkVersion: "0.1.12-alpha.0",
|
|
211
213
|
signerPackage: "@haven_ai/signer",
|
|
212
|
-
signerVersion: "0.1.
|
|
214
|
+
signerVersion: "0.1.12-alpha.0",
|
|
213
215
|
minimumNodeVersion: "20.0.0",
|
|
214
216
|
supportedClients: ["codex-cli", "codex-desktop", "claude-code"],
|
|
215
217
|
requiredTools: registeredToolNames()
|
|
@@ -1150,75 +1152,6 @@ async function assertFileExists(path, label) {
|
|
|
1150
1152
|
throw new Error(`Missing ${label}: ${path}`);
|
|
1151
1153
|
}
|
|
1152
1154
|
}
|
|
1153
|
-
|
|
1154
|
-
// src/skill-content.ts
|
|
1155
|
-
var HAVEN_SKILL_MD = `---
|
|
1156
|
-
name: haven-pay
|
|
1157
|
-
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.
|
|
1158
|
-
---
|
|
1159
|
-
|
|
1160
|
-
# Haven: pay from a Haven wallet
|
|
1161
|
-
|
|
1162
|
-
This skill lets the agent make payments from the user's Haven wallet through
|
|
1163
|
-
the Haven MCP tools. Every payment is checked against the agent's on-chain
|
|
1164
|
-
budget before money moves; payments above the remaining budget wait for the
|
|
1165
|
-
user's approval in Haven.
|
|
1166
|
-
|
|
1167
|
-
## When to use this skill
|
|
1168
|
-
|
|
1169
|
-
- The user asks to send money, pay someone, tip, donate, or transfer tokens.
|
|
1170
|
-
- A request returns HTTP 402 (x402): use the Haven pay tools to settle it,
|
|
1171
|
-
then retry the original request.
|
|
1172
|
-
|
|
1173
|
-
## Identity and budget come from the tools \u2014 never assume them
|
|
1174
|
-
|
|
1175
|
-
Do not guess the wallet address, network, or budget. Read them live:
|
|
1176
|
-
|
|
1177
|
-
- \`haven_get_agent\` \u2014 agent identity, Haven wallet address, network.
|
|
1178
|
-
- \`haven_get_allowances\` \u2014 current per-token budgets and what remains.
|
|
1179
|
-
|
|
1180
|
-
Budgets reset on a period the user chose. If a payment exceeds the remaining
|
|
1181
|
-
budget it is queued for the user to approve in the Haven dashboard \u2014 this is
|
|
1182
|
-
normal, not an error.
|
|
1183
|
-
|
|
1184
|
-
## Paying
|
|
1185
|
-
|
|
1186
|
-
- **Direct transfer:** \`haven_pay\` with recipient, amount, and token.
|
|
1187
|
-
- **x402 paywall:** \`haven_quote_x402\` to get a quote, then
|
|
1188
|
-
\`haven_pay_x402_quote\`. In the hosted setup the signing step happens in
|
|
1189
|
-
the local Haven signer; follow the tool results \u2014 they tell you the next
|
|
1190
|
-
action at every step. Retry the original request only when the result says
|
|
1191
|
-
\`retry_original_x402_request\`.
|
|
1192
|
-
- **Status:** \`haven_get_payment_status\` with a \`payment_id\` to check on
|
|
1193
|
-
queued or in-flight payments. Do not poll in a tight loop.
|
|
1194
|
-
|
|
1195
|
-
## Approval semantics
|
|
1196
|
-
|
|
1197
|
-
- A result with \`pending_approval\` means the payment exceeded the remaining
|
|
1198
|
-
budget and is waiting for the user in Haven. Tell the user, then check
|
|
1199
|
-
status later.
|
|
1200
|
-
- Never ask the user for private keys and never try to sign anything
|
|
1201
|
-
yourself \u2014 Haven signs. If a tool reports a missing or invalid credential,
|
|
1202
|
-
tell the user to re-run the Haven setup command.
|
|
1203
|
-
|
|
1204
|
-
## Failure handling
|
|
1205
|
-
|
|
1206
|
-
Haven errors are shaped \`{ error, status, details? }\` and written for
|
|
1207
|
-
humans \u2014 surface the message verbatim. Common cases:
|
|
1208
|
-
|
|
1209
|
-
- \`pending_approval\`: queued for the user's approval (see above).
|
|
1210
|
-
- \`insufficient_funds\`: the Haven wallet doesn't hold enough of that token.
|
|
1211
|
-
Suggest the user add funds in the Haven dashboard.
|
|
1212
|
-
- Budget exceeded: tell the user how much remains (from
|
|
1213
|
-
\`haven_get_allowances\`) and that they can raise the budget in Haven.
|
|
1214
|
-
|
|
1215
|
-
## Revoke
|
|
1216
|
-
|
|
1217
|
-
If this agent's credential may have leaked, tell the user to pause or revoke
|
|
1218
|
-
the agent in the Haven dashboard under Agents. New requests stop immediately
|
|
1219
|
-
for that credential.
|
|
1220
|
-
`;
|
|
1221
|
-
var SKILL_FOLDER_NAME = "haven-pay";
|
|
1222
1155
|
async function acknowledgeLocalSignerConsent(signerPath, log) {
|
|
1223
1156
|
try {
|
|
1224
1157
|
const input = await buildSignerConsentInput(signerPath);
|
|
@@ -1596,7 +1529,7 @@ function localRuntimePrepareErrorCode(err) {
|
|
|
1596
1529
|
}
|
|
1597
1530
|
|
|
1598
1531
|
// src/runtime.ts
|
|
1599
|
-
var CONNECTOR_VERSION = "0.1.
|
|
1532
|
+
var CONNECTOR_VERSION = "0.1.12-alpha.0";
|
|
1600
1533
|
async function runConnect(options, deps = {}) {
|
|
1601
1534
|
const connectorVersion = options.connectorVersion ?? CONNECTOR_VERSION;
|
|
1602
1535
|
const api = deps.api ?? createConnectApiClient(options.apiBaseUrl);
|
|
@@ -1661,10 +1594,18 @@ async function runConnect(options, deps = {}) {
|
|
|
1661
1594
|
})),
|
|
1662
1595
|
apiUrl: options.apiBaseUrl,
|
|
1663
1596
|
hostedMcpUrl: registration.hosted_mcp_url,
|
|
1597
|
+
x402BindingSigner: setup.x402_binding_signer ?? void 0,
|
|
1664
1598
|
warn: log
|
|
1665
1599
|
});
|
|
1666
1600
|
log(`Stored Haven identity credential locally: ${credentialPaths.identityPath}`);
|
|
1667
1601
|
log(`Stored local signer credential locally: ${credentialPaths.signerPath}`);
|
|
1602
|
+
if (setup.x402_binding_signer) {
|
|
1603
|
+
log("Configured x402 binding signer for the local signer.");
|
|
1604
|
+
} else {
|
|
1605
|
+
log(
|
|
1606
|
+
"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."
|
|
1607
|
+
);
|
|
1608
|
+
}
|
|
1668
1609
|
const runtimeInstall = await runRuntimeInstall({
|
|
1669
1610
|
runtime: options.runtime,
|
|
1670
1611
|
hostedMcpUrl: registration.hosted_mcp_url,
|