@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/index.cjs CHANGED
@@ -8,7 +8,6 @@ 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');
12
11
  var signer = require('@haven_ai/signer');
13
12
 
14
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -213,9 +212,9 @@ var MCP_RUNTIME_MANIFEST = {
213
212
  mcpPackage: "@haven_ai/mcp",
214
213
  mcpVersion: mcp.MCP_VERSION,
215
214
  sdkPackage: "@haven_ai/sdk",
216
- sdkVersion: "0.1.10-alpha.0",
215
+ sdkVersion: "0.1.11-alpha.0",
217
216
  signerPackage: "@haven_ai/signer",
218
- signerVersion: "0.1.10-alpha.0",
217
+ signerVersion: "0.1.11-alpha.0",
219
218
  minimumNodeVersion: "20.0.0",
220
219
  supportedClients: ["codex-cli", "codex-desktop", "claude-code"],
221
220
  requiredTools: mcp.registeredToolNames()
@@ -1156,6 +1155,75 @@ async function assertFileExists(path, label) {
1156
1155
  throw new Error(`Missing ${label}: ${path}`);
1157
1156
  }
1158
1157
  }
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";
1159
1227
  async function acknowledgeLocalSignerConsent(signerPath, log) {
1160
1228
  try {
1161
1229
  const input = await buildSignerConsentInput(signerPath);
@@ -1438,9 +1506,9 @@ async function defaultRunCommand(command, args) {
1438
1506
  }
1439
1507
  async function installClaudeSkill(homeDir) {
1440
1508
  try {
1441
- const skillDir = path.resolve(homeDir ?? os.homedir(), ".claude", "skills", sdk.SKILL_FOLDER_NAME);
1509
+ const skillDir = path.resolve(homeDir ?? os.homedir(), ".claude", "skills", SKILL_FOLDER_NAME);
1442
1510
  await promises.mkdir(skillDir, { recursive: true });
1443
- await promises.writeFile(path.join(skillDir, "SKILL.md"), sdk.HAVEN_SKILL_MD, "utf8");
1511
+ await promises.writeFile(path.join(skillDir, "SKILL.md"), HAVEN_SKILL_MD, "utf8");
1444
1512
  return {
1445
1513
  installed: true,
1446
1514
  messages: ["Installed the generic Haven payment skill (~/.claude/skills/haven-pay). It contains no secrets."]
@@ -1533,7 +1601,7 @@ function localRuntimePrepareErrorCode(err) {
1533
1601
  }
1534
1602
 
1535
1603
  // src/runtime.ts
1536
- var CONNECTOR_VERSION = "0.1.2";
1604
+ var CONNECTOR_VERSION = "0.1.11-alpha.0";
1537
1605
  async function runConnect(options, deps = {}) {
1538
1606
  const connectorVersion = options.connectorVersion ?? CONNECTOR_VERSION;
1539
1607
  const api = deps.api ?? createConnectApiClient(options.apiBaseUrl);