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