@haven_ai/connect 0.1.6-alpha → 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/README.md +1 -1
- package/dist/cli.cjs +215 -23
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +215 -23
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +219 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +216 -24
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -59,6 +59,7 @@ function createConnectApiClient(baseUrl, fetchImpl = fetch) {
|
|
|
59
59
|
signer_acknowledged: input.signerAcknowledged,
|
|
60
60
|
local_mcp_acknowledged: input.localMcpAcknowledged,
|
|
61
61
|
activation_command_available: input.activationCommandAvailable,
|
|
62
|
+
skill_installed: input.skillInstalled,
|
|
62
63
|
probe_result: input.probeResult,
|
|
63
64
|
restart_required: input.restartRequired,
|
|
64
65
|
next_user_action: input.nextUserAction,
|
|
@@ -211,9 +212,9 @@ var MCP_RUNTIME_MANIFEST = {
|
|
|
211
212
|
mcpPackage: "@haven_ai/mcp",
|
|
212
213
|
mcpVersion: mcp.MCP_VERSION,
|
|
213
214
|
sdkPackage: "@haven_ai/sdk",
|
|
214
|
-
sdkVersion: "0.1.
|
|
215
|
+
sdkVersion: "0.1.11-alpha.0",
|
|
215
216
|
signerPackage: "@haven_ai/signer",
|
|
216
|
-
signerVersion: "0.1.
|
|
217
|
+
signerVersion: "0.1.11-alpha.0",
|
|
217
218
|
minimumNodeVersion: "20.0.0",
|
|
218
219
|
supportedClients: ["codex-cli", "codex-desktop", "claude-code"],
|
|
219
220
|
requiredTools: mcp.registeredToolNames()
|
|
@@ -418,6 +419,26 @@ function mergeCodexToml(existingToml, localMcpCommand) {
|
|
|
418
419
|
validateCodexToml(block, "Generated Codex Haven config");
|
|
419
420
|
const merged = `${next ? `${next}
|
|
420
421
|
|
|
422
|
+
` : ""}${block}
|
|
423
|
+
`;
|
|
424
|
+
return merged;
|
|
425
|
+
}
|
|
426
|
+
function mergeCodexTomlHosted(existingToml, hostedMcpUrl, apiKey, signerPath) {
|
|
427
|
+
let next = removeTomlTableTree(removeTomlTableTree(existingToml, "mcp_servers.haven"), "mcp_servers.haven_signer");
|
|
428
|
+
next = next.trimEnd();
|
|
429
|
+
const block = [
|
|
430
|
+
"[mcp_servers.haven]",
|
|
431
|
+
`url = ${tomlString(hostedMcpUrl)}`,
|
|
432
|
+
`http_headers = { "Authorization" = ${tomlString(`Bearer ${apiKey}`)} }`,
|
|
433
|
+
"",
|
|
434
|
+
"[mcp_servers.haven_signer]",
|
|
435
|
+
'command = "npx"',
|
|
436
|
+
`args = ["-y", ${tomlString(signerPackageSpec())}, "--credentials", ${tomlString(signerPath)}]`,
|
|
437
|
+
"startup_timeout_sec = 120"
|
|
438
|
+
].join("\n");
|
|
439
|
+
validateCodexToml(block, "Generated Codex Haven config");
|
|
440
|
+
const merged = `${next ? `${next}
|
|
441
|
+
|
|
421
442
|
` : ""}${block}
|
|
422
443
|
`;
|
|
423
444
|
return merged;
|
|
@@ -458,27 +479,46 @@ async function writeJsonRuntimeConfig(input, target, serverRoot) {
|
|
|
458
479
|
}
|
|
459
480
|
async function writeCodexConfig(input) {
|
|
460
481
|
const target = codexConfigPath(input.homeDir);
|
|
482
|
+
const local = input.mode === "local";
|
|
483
|
+
const restartMessage = runtimeRequiresHardRestart(input.runtime) ? "After Haven approval, restart Codex Desktop so it can load Haven tools." : "After Haven approval, Haven tools should appear in your next Codex message. If they don't, restart Codex to load them.";
|
|
461
484
|
try {
|
|
462
485
|
const existing = await readOptional(target);
|
|
463
|
-
if (
|
|
464
|
-
|
|
486
|
+
if (local) {
|
|
487
|
+
if (!input.localMcpCommand) {
|
|
488
|
+
throw new Error("local MCP wrapper command is required");
|
|
489
|
+
}
|
|
490
|
+
const merged2 = mergeCodexToml(existing ?? "", input.localMcpCommand);
|
|
491
|
+
await writeOwnerOnlyText(target, merged2);
|
|
492
|
+
return {
|
|
493
|
+
hostedConfigured: false,
|
|
494
|
+
signerConfigured: true,
|
|
495
|
+
localMcpConfigured: true,
|
|
496
|
+
runtimeMcpMode: "local_stdio",
|
|
497
|
+
target: configTargetLabel(input.runtime),
|
|
498
|
+
changed: existing !== merged2,
|
|
499
|
+
restartRequired: true,
|
|
500
|
+
messages: [
|
|
501
|
+
`Updated local Haven MCP entry in ${configTargetLabel(input.runtime)}.`,
|
|
502
|
+
// Codex Desktop loads MCP servers at app launch; Codex CLI typically
|
|
503
|
+
// picks them up in the next session. Branch the copy so desktop users
|
|
504
|
+
// get the unambiguous instruction.
|
|
505
|
+
restartMessage
|
|
506
|
+
]
|
|
507
|
+
};
|
|
465
508
|
}
|
|
466
|
-
const merged =
|
|
509
|
+
const merged = mergeCodexTomlHosted(existing ?? "", input.hostedMcpUrl, input.apiKey, input.signerPath);
|
|
467
510
|
await writeOwnerOnlyText(target, merged);
|
|
468
511
|
return {
|
|
469
|
-
hostedConfigured:
|
|
512
|
+
hostedConfigured: true,
|
|
470
513
|
signerConfigured: true,
|
|
471
|
-
localMcpConfigured:
|
|
472
|
-
runtimeMcpMode: "
|
|
514
|
+
localMcpConfigured: false,
|
|
515
|
+
runtimeMcpMode: "hosted_plus_signer",
|
|
473
516
|
target: configTargetLabel(input.runtime),
|
|
474
517
|
changed: existing !== merged,
|
|
475
518
|
restartRequired: true,
|
|
476
519
|
messages: [
|
|
477
|
-
`Updated
|
|
478
|
-
|
|
479
|
-
// picks them up in the next session. Branch the copy so desktop users
|
|
480
|
-
// get the unambiguous instruction.
|
|
481
|
-
runtimeRequiresHardRestart(input.runtime) ? "After Haven approval, restart Codex Desktop so it can load Haven tools." : "After Haven approval, Haven tools should appear in your next Codex message. If they don't, restart Codex to load them."
|
|
520
|
+
`Updated Haven MCP entries in ${configTargetLabel(input.runtime)}.`,
|
|
521
|
+
restartMessage
|
|
482
522
|
]
|
|
483
523
|
};
|
|
484
524
|
} catch (err) {
|
|
@@ -487,7 +527,7 @@ async function writeCodexConfig(input) {
|
|
|
487
527
|
hostedConfigured: false,
|
|
488
528
|
signerConfigured: false,
|
|
489
529
|
localMcpConfigured: false,
|
|
490
|
-
runtimeMcpMode: "local_stdio",
|
|
530
|
+
runtimeMcpMode: local ? "local_stdio" : "hosted_plus_signer",
|
|
491
531
|
target: configTargetLabel(input.runtime),
|
|
492
532
|
changed: false,
|
|
493
533
|
restartRequired: true,
|
|
@@ -867,7 +907,7 @@ async function probeLocalSignerCredential(signerPath) {
|
|
|
867
907
|
}
|
|
868
908
|
}
|
|
869
909
|
async function probeLocalMcpTools(command, args, requiredTools, timeoutMs = 1e4) {
|
|
870
|
-
return new Promise((
|
|
910
|
+
return new Promise((resolve7) => {
|
|
871
911
|
const child = child_process.spawn(command, args, { stdio: ["pipe", "pipe", "ignore"] });
|
|
872
912
|
let stdout = "";
|
|
873
913
|
let settled = false;
|
|
@@ -877,7 +917,7 @@ async function probeLocalMcpTools(command, args, requiredTools, timeoutMs = 1e4)
|
|
|
877
917
|
settled = true;
|
|
878
918
|
clearTimeout(timeout);
|
|
879
919
|
child.kill();
|
|
880
|
-
|
|
920
|
+
resolve7(result);
|
|
881
921
|
};
|
|
882
922
|
const timeout = setTimeout(() => finish({ status: "timeout" }), timeoutMs);
|
|
883
923
|
child.on("error", () => finish({ status: "process_error" }));
|
|
@@ -1115,6 +1155,75 @@ async function assertFileExists(path, label) {
|
|
|
1115
1155
|
throw new Error(`Missing ${label}: ${path}`);
|
|
1116
1156
|
}
|
|
1117
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";
|
|
1118
1227
|
async function acknowledgeLocalSignerConsent(signerPath, log) {
|
|
1119
1228
|
try {
|
|
1120
1229
|
const input = await buildSignerConsentInput(signerPath);
|
|
@@ -1190,7 +1299,7 @@ var execFileAsync2 = util.promisify(child_process.execFile);
|
|
|
1190
1299
|
async function installRuntime(input, deps = {}) {
|
|
1191
1300
|
const runtime = normalizeRuntime(input.runtime, deps.env);
|
|
1192
1301
|
const profile = runtimeProfile(runtime, deps.env);
|
|
1193
|
-
const localRuntime =
|
|
1302
|
+
const localRuntime = input.localMcp === true && supportsLocalMcp(runtime);
|
|
1194
1303
|
const consentMessages = [];
|
|
1195
1304
|
const localMcpConsent = localRuntime ? await resolveLocalMcpConsent(input, consentMessages) : void 0;
|
|
1196
1305
|
const signerConsent = localRuntime ? void 0 : await resolveSignerConsent(input, consentMessages);
|
|
@@ -1247,7 +1356,7 @@ async function installRuntime(input, deps = {}) {
|
|
|
1247
1356
|
]
|
|
1248
1357
|
};
|
|
1249
1358
|
}
|
|
1250
|
-
const configResult = runtime === "claude-code" ? await configureClaudeCode(deps, localRuntimeInstall?.command ?? "") : await writeRuntimeConfig({
|
|
1359
|
+
const configResult = runtime === "claude-code" ? localRuntime ? await configureClaudeCode(deps, localRuntimeInstall?.command ?? "") : await configureClaudeCodeHosted(deps, input) : await writeRuntimeConfig({
|
|
1251
1360
|
runtime,
|
|
1252
1361
|
hostedMcpUrl: input.hostedMcpUrl,
|
|
1253
1362
|
apiKey: input.apiKey,
|
|
@@ -1255,7 +1364,8 @@ async function installRuntime(input, deps = {}) {
|
|
|
1255
1364
|
signerPath: input.signerPath,
|
|
1256
1365
|
credentialDirectory: input.credentialDirectory,
|
|
1257
1366
|
localMcpCommand: localRuntimeInstall?.command,
|
|
1258
|
-
homeDir: deps.homeDir
|
|
1367
|
+
homeDir: deps.homeDir,
|
|
1368
|
+
mode: localRuntime ? "local" : "hosted"
|
|
1259
1369
|
});
|
|
1260
1370
|
const localProbePromise = configResult.runtimeMcpMode === "local_stdio" && localRuntimeInstall ? runLocalMcpProbe(localRuntimeInstall, deps) : Promise.resolve(void 0);
|
|
1261
1371
|
const [hostedProbe, signerCredentialReady, localMcpProbe] = await Promise.all([
|
|
@@ -1269,6 +1379,7 @@ async function installRuntime(input, deps = {}) {
|
|
|
1269
1379
|
const restartRequired = configResult.restartRequired || restartRequiredForRuntime(runtime, deps.env);
|
|
1270
1380
|
const errorCode = configResult.errorCode ?? (configResult.runtimeMcpMode === "local_stdio" ? localMcpErrorCode(signerCredentialReady, localMcpConsent, localMcpProbe?.status) : signerConsentErrorCode(signerCredentialReady, signerConsent));
|
|
1271
1381
|
const localProbeMessages = localMcpProbe && localMcpProbe.status !== "ok" ? [`Local Haven MCP handshake failed: ${localMcpProbe.status}.`] : localMcpProbe?.status === "ok" ? ["Verified local Haven MCP tools with a stdio handshake."] : [];
|
|
1382
|
+
const skillInstall = runtime === "claude-code" && !configResult.errorCode ? await installClaudeSkill(deps.homeDir) : void 0;
|
|
1272
1383
|
return {
|
|
1273
1384
|
runtime,
|
|
1274
1385
|
runtimeMcpMode: configResult.runtimeMcpMode,
|
|
@@ -1283,7 +1394,8 @@ async function installRuntime(input, deps = {}) {
|
|
|
1283
1394
|
signerAcknowledged: signerConsent?.acknowledged,
|
|
1284
1395
|
localMcpAcknowledged: localMcpConsent?.acknowledged,
|
|
1285
1396
|
activationCommand: configResult.activationCommand,
|
|
1286
|
-
|
|
1397
|
+
skillInstalled: skillInstall?.installed,
|
|
1398
|
+
messages: [...consentMessages, ...localRuntimeInstall?.messages ?? [], ...configResult.messages, ...localProbeMessages, ...skillInstall?.messages ?? []]
|
|
1287
1399
|
};
|
|
1288
1400
|
}
|
|
1289
1401
|
function runtimeInstallCapabilities(runtime, env = process.env) {
|
|
@@ -1339,9 +1451,75 @@ async function configureClaudeCode(deps, localMcpCommand) {
|
|
|
1339
1451
|
};
|
|
1340
1452
|
}
|
|
1341
1453
|
}
|
|
1454
|
+
async function configureClaudeCodeHosted(deps, input) {
|
|
1455
|
+
const runCommand = deps.runCommand ?? defaultRunCommand;
|
|
1456
|
+
const hostedJson = JSON.stringify({
|
|
1457
|
+
type: "http",
|
|
1458
|
+
url: input.hostedMcpUrl,
|
|
1459
|
+
headers: { Authorization: `Bearer ${input.apiKey}` }
|
|
1460
|
+
});
|
|
1461
|
+
const signerJson = JSON.stringify({
|
|
1462
|
+
type: "stdio",
|
|
1463
|
+
command: "npx",
|
|
1464
|
+
args: ["-y", signerPackageSpec(), "--credentials", input.signerPath],
|
|
1465
|
+
env: {}
|
|
1466
|
+
});
|
|
1467
|
+
try {
|
|
1468
|
+
await runCommand("claude", ["mcp", "remove", "haven"]).catch(() => void 0);
|
|
1469
|
+
await runCommand("claude", ["mcp", "remove", "haven-signer"]).catch(() => void 0);
|
|
1470
|
+
await runCommand("claude", ["mcp", "add-json", "haven", hostedJson, "--scope", "user"]);
|
|
1471
|
+
await runCommand("claude", ["mcp", "add-json", "haven-signer", signerJson, "--scope", "user"]);
|
|
1472
|
+
const verified = await runCommand("claude", ["mcp", "get", "haven"]).then(() => true).catch(() => false);
|
|
1473
|
+
return {
|
|
1474
|
+
hostedConfigured: true,
|
|
1475
|
+
signerConfigured: true,
|
|
1476
|
+
localMcpConfigured: false,
|
|
1477
|
+
runtimeMcpMode: "hosted_plus_signer",
|
|
1478
|
+
target: "Claude Code MCP config",
|
|
1479
|
+
changed: true,
|
|
1480
|
+
restartRequired: true,
|
|
1481
|
+
messages: [
|
|
1482
|
+
"Updated hosted Haven MCP and local signer entries with Claude Code.",
|
|
1483
|
+
...verified ? ["Verified Claude Code MCP entry."] : [],
|
|
1484
|
+
"After Haven approval, Haven tools should appear in your next Claude Code message. If they don't, restart the session to load them."
|
|
1485
|
+
]
|
|
1486
|
+
};
|
|
1487
|
+
} catch (err) {
|
|
1488
|
+
return {
|
|
1489
|
+
hostedConfigured: false,
|
|
1490
|
+
signerConfigured: false,
|
|
1491
|
+
localMcpConfigured: false,
|
|
1492
|
+
runtimeMcpMode: "hosted_plus_signer",
|
|
1493
|
+
target: "Claude Code MCP config",
|
|
1494
|
+
changed: false,
|
|
1495
|
+
restartRequired: true,
|
|
1496
|
+
messages: [
|
|
1497
|
+
`Could not update Claude Code MCP config: ${err instanceof Error ? err.message : String(err)}`,
|
|
1498
|
+
"Install Claude Code or rerun the Haven setup command inside a Claude Code terminal."
|
|
1499
|
+
],
|
|
1500
|
+
errorCode: "claude_code_config_failed"
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1342
1504
|
async function defaultRunCommand(command, args) {
|
|
1343
1505
|
await execFileAsync2(command, args, { timeout: 1e4 });
|
|
1344
1506
|
}
|
|
1507
|
+
async function installClaudeSkill(homeDir) {
|
|
1508
|
+
try {
|
|
1509
|
+
const skillDir = path.resolve(homeDir ?? os.homedir(), ".claude", "skills", SKILL_FOLDER_NAME);
|
|
1510
|
+
await promises.mkdir(skillDir, { recursive: true });
|
|
1511
|
+
await promises.writeFile(path.join(skillDir, "SKILL.md"), HAVEN_SKILL_MD, "utf8");
|
|
1512
|
+
return {
|
|
1513
|
+
installed: true,
|
|
1514
|
+
messages: ["Installed the generic Haven payment skill (~/.claude/skills/haven-pay). It contains no secrets."]
|
|
1515
|
+
};
|
|
1516
|
+
} catch (err) {
|
|
1517
|
+
return {
|
|
1518
|
+
installed: false,
|
|
1519
|
+
messages: [`Could not install the Haven payment skill: ${err instanceof Error ? err.message : String(err)}. Download it from the Haven dashboard instead.`]
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1345
1523
|
function buildProbeResult(mode, hostedConfigured, hostedStatus, signerReady, localMcpReady, localMcpProbeStatus) {
|
|
1346
1524
|
if (mode === "local_stdio") {
|
|
1347
1525
|
if (localMcpReady) return "local_stdio_mcp_ready";
|
|
@@ -1395,7 +1573,7 @@ function nextAction(runtime, restartMode, errorCode) {
|
|
|
1395
1573
|
if (restartMode === "restart-session") return "return_to_haven_for_wallet_approval_then_restart_agent_session";
|
|
1396
1574
|
return "return_to_haven_for_wallet_approval_then_configure_runtime";
|
|
1397
1575
|
}
|
|
1398
|
-
function
|
|
1576
|
+
function supportsLocalMcp(runtime) {
|
|
1399
1577
|
return runtime === "codex-cli" || runtime === "codex-desktop" || runtime === "claude-code";
|
|
1400
1578
|
}
|
|
1401
1579
|
async function prepareRuntimeForLocalMcp(input, deps) {
|
|
@@ -1423,7 +1601,7 @@ function localRuntimePrepareErrorCode(err) {
|
|
|
1423
1601
|
}
|
|
1424
1602
|
|
|
1425
1603
|
// src/runtime.ts
|
|
1426
|
-
var CONNECTOR_VERSION = "0.1.
|
|
1604
|
+
var CONNECTOR_VERSION = "0.1.11-alpha.0";
|
|
1427
1605
|
async function runConnect(options, deps = {}) {
|
|
1428
1606
|
const connectorVersion = options.connectorVersion ?? CONNECTOR_VERSION;
|
|
1429
1607
|
const api = deps.api ?? createConnectApiClient(options.apiBaseUrl);
|
|
@@ -1435,6 +1613,14 @@ async function runConnect(options, deps = {}) {
|
|
|
1435
1613
|
const generateKey = deps.generateKey ?? generateDelegateKey;
|
|
1436
1614
|
const generateLocalApiKey = deps.generateApiKey ?? generateAgentApiKey;
|
|
1437
1615
|
const installCapabilities = runtimeInstallCapabilities(options.runtime);
|
|
1616
|
+
if (options.localMcp) {
|
|
1617
|
+
const resolvedRuntime = normalizeRuntime(options.runtime);
|
|
1618
|
+
if (!supportsLocalMcp(resolvedRuntime)) {
|
|
1619
|
+
throw new Error(
|
|
1620
|
+
`--local (fully-local Haven MCP) is only available for Claude Code and Codex. The detected runtime is ${runtimeProfile(resolvedRuntime).label}. Re-run without --local to use the default hosted MCP + local signer setup.`
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1438
1624
|
const setup = await api.resolveSetup({
|
|
1439
1625
|
setupToken: options.setupToken,
|
|
1440
1626
|
connectorVersion,
|
|
@@ -1493,7 +1679,8 @@ async function runConnect(options, deps = {}) {
|
|
|
1493
1679
|
credentialDirectory: credentialPaths.directory,
|
|
1494
1680
|
environmentLabel: options.environmentLabel ?? "Local workspace",
|
|
1495
1681
|
ackSigner: options.ackSigner,
|
|
1496
|
-
ackLocalTools: options.ackLocalTools
|
|
1682
|
+
ackLocalTools: options.ackLocalTools,
|
|
1683
|
+
localMcp: options.localMcp
|
|
1497
1684
|
});
|
|
1498
1685
|
printRuntimeInstall(runtimeInstall, log);
|
|
1499
1686
|
try {
|
|
@@ -1508,6 +1695,7 @@ async function runConnect(options, deps = {}) {
|
|
|
1508
1695
|
signerAcknowledged: runtimeInstall.signerAcknowledged,
|
|
1509
1696
|
localMcpAcknowledged: runtimeInstall.localMcpAcknowledged,
|
|
1510
1697
|
activationCommandAvailable: Boolean(runtimeInstall.activationCommand),
|
|
1698
|
+
skillInstalled: runtimeInstall.skillInstalled,
|
|
1511
1699
|
probeResult: runtimeInstall.probeResult,
|
|
1512
1700
|
restartRequired: runtimeInstall.restartRequired,
|
|
1513
1701
|
nextUserAction: runtimeInstall.nextUserAction,
|
|
@@ -1589,6 +1777,8 @@ function parseArgs(argv, env = process.env) {
|
|
|
1589
1777
|
} else if (arg === "--ack-signer") {
|
|
1590
1778
|
options.ackSigner = true;
|
|
1591
1779
|
options.ackLocalTools = true;
|
|
1780
|
+
} else if (arg === "--local" || arg === "--local-mcp") {
|
|
1781
|
+
options.localMcp = true;
|
|
1592
1782
|
} else if (arg === "--version") {
|
|
1593
1783
|
process.stdout.write(`${CONNECTOR_VERSION}
|
|
1594
1784
|
`);
|
|
@@ -1627,6 +1817,8 @@ function helpText() {
|
|
|
1627
1817
|
" --environment-label <text> Non-sensitive label shown in Haven setup review.",
|
|
1628
1818
|
" --ack-local-tools Write the one-time local Haven tools acknowledgement during setup.",
|
|
1629
1819
|
" --ack-signer Backward-compatible alias for --ack-local-tools.",
|
|
1820
|
+
" --local Advanced: install the fully-local Haven MCP (no hosted dependency).",
|
|
1821
|
+
" Only available for Claude Code and Codex. Default is hosted MCP + local signer.",
|
|
1630
1822
|
" --help Show this help.",
|
|
1631
1823
|
"",
|
|
1632
1824
|
"The connector never prints the private key and never sends it to Haven."
|
|
@@ -1641,19 +1833,23 @@ function requireValue(argv, index, option) {
|
|
|
1641
1833
|
}
|
|
1642
1834
|
|
|
1643
1835
|
exports.CONNECTOR_VERSION = CONNECTOR_VERSION;
|
|
1836
|
+
exports.MCP_RUNTIME_MANIFEST = MCP_RUNTIME_MANIFEST;
|
|
1644
1837
|
exports.createConnectApiClient = createConnectApiClient;
|
|
1645
1838
|
exports.defaultAgentDirectory = defaultAgentDirectory;
|
|
1646
1839
|
exports.delegateKeyFromPrivateKey = delegateKeyFromPrivateKey;
|
|
1647
1840
|
exports.generateDelegateKey = generateDelegateKey;
|
|
1648
1841
|
exports.helpText = helpText;
|
|
1649
1842
|
exports.installRuntime = installRuntime;
|
|
1843
|
+
exports.mcpPackageSpec = mcpPackageSpec;
|
|
1650
1844
|
exports.normalizeRuntime = normalizeRuntime;
|
|
1651
1845
|
exports.parseArgs = parseArgs;
|
|
1652
1846
|
exports.redactSecrets = redactSecrets;
|
|
1653
1847
|
exports.runConnect = runConnect;
|
|
1654
1848
|
exports.runtimeInstallCapabilities = runtimeInstallCapabilities;
|
|
1655
1849
|
exports.runtimeProfile = runtimeProfile;
|
|
1850
|
+
exports.sdkPackageSpec = sdkPackageSpec;
|
|
1656
1851
|
exports.shortAddress = shortAddress;
|
|
1852
|
+
exports.signerPackageSpec = signerPackageSpec;
|
|
1657
1853
|
exports.writeCredentialFiles = writeCredentialFiles;
|
|
1658
1854
|
//# sourceMappingURL=index.cjs.map
|
|
1659
1855
|
//# sourceMappingURL=index.cjs.map
|