@haven_ai/connect 0.1.3-alpha → 0.1.4-alpha
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 +136 -115
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +137 -116
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +136 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +137 -116
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -212,24 +212,12 @@ var MCP_RUNTIME_MANIFEST = {
|
|
|
212
212
|
mcpPackage: "@haven_ai/mcp",
|
|
213
213
|
mcpVersion: mcp.MCP_VERSION,
|
|
214
214
|
sdkPackage: "@haven_ai/sdk",
|
|
215
|
-
sdkVersion: "0.1.
|
|
215
|
+
sdkVersion: "0.1.7",
|
|
216
216
|
signerPackage: "@haven_ai/signer",
|
|
217
217
|
signerVersion: "0.1.0-alpha",
|
|
218
218
|
minimumNodeVersion: "20.0.0",
|
|
219
219
|
supportedClients: ["codex-cli", "codex-desktop", "claude-code"],
|
|
220
|
-
requiredTools:
|
|
221
|
-
"haven_quote_x402",
|
|
222
|
-
"haven_pay_x402_quote",
|
|
223
|
-
"haven_resume_x402_payment",
|
|
224
|
-
"haven_quote_mpp",
|
|
225
|
-
"haven_pay_mpp_challenge",
|
|
226
|
-
"haven_resume_mpp_payment",
|
|
227
|
-
"haven_get_payment_status",
|
|
228
|
-
"haven_get_resume_state",
|
|
229
|
-
"haven_get_agent",
|
|
230
|
-
"haven_get_allowances",
|
|
231
|
-
"haven_list_receipts"
|
|
232
|
-
]
|
|
220
|
+
requiredTools: mcp.registeredToolNames()
|
|
233
221
|
};
|
|
234
222
|
function mcpPackageSpec() {
|
|
235
223
|
return `${MCP_RUNTIME_MANIFEST.mcpPackage}@${MCP_RUNTIME_MANIFEST.mcpVersion}`;
|
|
@@ -241,6 +229,117 @@ function signerPackageSpec() {
|
|
|
241
229
|
return `${MCP_RUNTIME_MANIFEST.signerPackage}@${MCP_RUNTIME_MANIFEST.signerVersion}`;
|
|
242
230
|
}
|
|
243
231
|
|
|
232
|
+
// src/runtime-registry.ts
|
|
233
|
+
var RUNTIME_PROFILES = {
|
|
234
|
+
"claude-code": {
|
|
235
|
+
id: "claude-code",
|
|
236
|
+
label: "Claude Code",
|
|
237
|
+
restartMode: "restart-session",
|
|
238
|
+
canWriteRuntimeConfig: true
|
|
239
|
+
},
|
|
240
|
+
"codex-cli": {
|
|
241
|
+
id: "codex-cli",
|
|
242
|
+
label: "Codex CLI",
|
|
243
|
+
restartMode: "restart-session",
|
|
244
|
+
canWriteRuntimeConfig: true
|
|
245
|
+
},
|
|
246
|
+
"codex-desktop": {
|
|
247
|
+
id: "codex-desktop",
|
|
248
|
+
label: "Codex Desktop",
|
|
249
|
+
restartMode: "restart-session",
|
|
250
|
+
canWriteRuntimeConfig: true
|
|
251
|
+
},
|
|
252
|
+
cursor: {
|
|
253
|
+
id: "cursor",
|
|
254
|
+
label: "Cursor",
|
|
255
|
+
restartMode: "hot-reload",
|
|
256
|
+
canWriteRuntimeConfig: true
|
|
257
|
+
},
|
|
258
|
+
vscode: {
|
|
259
|
+
id: "vscode",
|
|
260
|
+
label: "VS Code",
|
|
261
|
+
restartMode: "hot-reload",
|
|
262
|
+
canWriteRuntimeConfig: true
|
|
263
|
+
},
|
|
264
|
+
"vscode-insiders": {
|
|
265
|
+
id: "vscode-insiders",
|
|
266
|
+
label: "VS Code Insiders",
|
|
267
|
+
restartMode: "hot-reload",
|
|
268
|
+
canWriteRuntimeConfig: true
|
|
269
|
+
},
|
|
270
|
+
"claude-desktop": {
|
|
271
|
+
id: "claude-desktop",
|
|
272
|
+
label: "Claude Desktop",
|
|
273
|
+
restartMode: "restart-app",
|
|
274
|
+
canWriteRuntimeConfig: true
|
|
275
|
+
},
|
|
276
|
+
other: {
|
|
277
|
+
id: "other",
|
|
278
|
+
label: "Other agent runtime",
|
|
279
|
+
restartMode: "manual",
|
|
280
|
+
canWriteRuntimeConfig: false
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
var RUNTIME_ALIASES = {
|
|
284
|
+
claude: "claude-code",
|
|
285
|
+
"claude-code": "claude-code",
|
|
286
|
+
claudecode: "claude-code",
|
|
287
|
+
"claude_code": "claude-code",
|
|
288
|
+
codex: "codex-cli",
|
|
289
|
+
"codex-cli": "codex-cli",
|
|
290
|
+
codexcli: "codex-cli",
|
|
291
|
+
"codex_cli": "codex-cli",
|
|
292
|
+
"codex-desktop": "codex-desktop",
|
|
293
|
+
"codex_desktop": "codex-desktop",
|
|
294
|
+
codexdesktop: "codex-desktop",
|
|
295
|
+
"codex-app": "codex-desktop",
|
|
296
|
+
"codex_app": "codex-desktop",
|
|
297
|
+
codexapp: "codex-desktop",
|
|
298
|
+
cursor: "cursor",
|
|
299
|
+
vscode: "vscode",
|
|
300
|
+
"vs-code": "vscode",
|
|
301
|
+
"vs_code": "vscode",
|
|
302
|
+
code: "vscode",
|
|
303
|
+
"vscode-insiders": "vscode-insiders",
|
|
304
|
+
"vscode_insiders": "vscode-insiders",
|
|
305
|
+
vscodeinsiders: "vscode-insiders",
|
|
306
|
+
"vs-code-insiders": "vscode-insiders",
|
|
307
|
+
"code-insiders": "vscode-insiders",
|
|
308
|
+
insiders: "vscode-insiders",
|
|
309
|
+
"claude-desktop": "claude-desktop",
|
|
310
|
+
"claude_desktop": "claude-desktop",
|
|
311
|
+
claudesktop: "claude-desktop",
|
|
312
|
+
desktop: "claude-desktop",
|
|
313
|
+
other: "other",
|
|
314
|
+
manual: "other"
|
|
315
|
+
};
|
|
316
|
+
function runtimeProfile(runtime, env = process.env) {
|
|
317
|
+
return RUNTIME_PROFILES[normalizeRuntime(runtime, env)];
|
|
318
|
+
}
|
|
319
|
+
function normalizeRuntime(runtime, env = process.env) {
|
|
320
|
+
const explicit = normalizeRuntimeName(runtime);
|
|
321
|
+
if (explicit) return explicit;
|
|
322
|
+
return detectRuntime(env) ?? "other";
|
|
323
|
+
}
|
|
324
|
+
function restartRequiredForRuntime(runtime, env = process.env) {
|
|
325
|
+
const mode = runtimeProfile(runtime, env).restartMode;
|
|
326
|
+
return mode === "restart-session" || mode === "restart-app";
|
|
327
|
+
}
|
|
328
|
+
function runtimeRequiresHardRestart(runtime) {
|
|
329
|
+
return runtime === "claude-desktop" || runtime === "codex-desktop";
|
|
330
|
+
}
|
|
331
|
+
function normalizeRuntimeName(runtime) {
|
|
332
|
+
const key = runtime?.trim().toLowerCase();
|
|
333
|
+
if (!key) return null;
|
|
334
|
+
return RUNTIME_ALIASES[key.replace(/\s+/g, "-")] ?? null;
|
|
335
|
+
}
|
|
336
|
+
function detectRuntime(env) {
|
|
337
|
+
if (env.CLAUDECODE || env.CLAUDE_CODE || env.CLAUDECODE_CWD) return "claude-code";
|
|
338
|
+
if (env.CODEX_SANDBOX || env.CODEX_HOME || env.CODEX_CWD) return "codex-cli";
|
|
339
|
+
if (env.VSCODE_CWD || env.VSCODE_IPC_HOOK_CLI || env.TERM_PROGRAM === "vscode") return "vscode";
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
|
|
244
343
|
// src/config-writers.ts
|
|
245
344
|
var InvalidCodexTomlError = class extends Error {
|
|
246
345
|
constructor(message) {
|
|
@@ -257,6 +356,8 @@ async function writeRuntimeConfig(input) {
|
|
|
257
356
|
return writeJsonRuntimeConfig(input, cursorConfigPath(input.homeDir), "mcpServers");
|
|
258
357
|
case "vscode":
|
|
259
358
|
return writeJsonRuntimeConfig(input, vscodeConfigPath(input.homeDir), "servers");
|
|
359
|
+
case "vscode-insiders":
|
|
360
|
+
return writeJsonRuntimeConfig(input, vscodeInsidersConfigPath(input.homeDir), "servers");
|
|
260
361
|
case "claude-desktop":
|
|
261
362
|
return writeJsonRuntimeConfig(input, claudeDesktopConfigPath(input.homeDir), "mcpServers");
|
|
262
363
|
default:
|
|
@@ -274,7 +375,7 @@ async function writeRuntimeConfig(input) {
|
|
|
274
375
|
}
|
|
275
376
|
}
|
|
276
377
|
function buildHostedServer(hostedMcpUrl, apiKey, runtime) {
|
|
277
|
-
if (runtime === "vscode") {
|
|
378
|
+
if (runtime === "vscode" || runtime === "vscode-insiders") {
|
|
278
379
|
return {
|
|
279
380
|
type: "http",
|
|
280
381
|
url: hostedMcpUrl,
|
|
@@ -291,7 +392,7 @@ function buildSignerServer(signerPath, runtime) {
|
|
|
291
392
|
command: "npx",
|
|
292
393
|
args: ["-y", signerPackageName(), "--credentials", signerPath]
|
|
293
394
|
};
|
|
294
|
-
if (runtime === "vscode") return { type: "stdio", ...server };
|
|
395
|
+
if (runtime === "vscode" || runtime === "vscode-insiders") return { type: "stdio", ...server };
|
|
295
396
|
return server;
|
|
296
397
|
}
|
|
297
398
|
function mergeJsonMcpConfig(existingJson, serverRoot, hostedServer, signerServer) {
|
|
@@ -375,7 +476,10 @@ async function writeCodexConfig(input) {
|
|
|
375
476
|
restartRequired: true,
|
|
376
477
|
messages: [
|
|
377
478
|
`Updated local Haven MCP entry in ${configTargetLabel(input.runtime)}.`,
|
|
378
|
-
|
|
479
|
+
// Codex Desktop loads MCP servers at app launch; Codex CLI typically
|
|
480
|
+
// picks them up in the next session. Branch the copy so desktop users
|
|
481
|
+
// get the unambiguous instruction.
|
|
482
|
+
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."
|
|
379
483
|
]
|
|
380
484
|
};
|
|
381
485
|
} catch (err) {
|
|
@@ -614,6 +718,13 @@ function vscodeConfigPath(homeDir = os.homedir()) {
|
|
|
614
718
|
}
|
|
615
719
|
return path.resolve(homeDir, ".config", "Code", "User", "mcp.json");
|
|
616
720
|
}
|
|
721
|
+
function vscodeInsidersConfigPath(homeDir = os.homedir()) {
|
|
722
|
+
if (os.platform() === "darwin") return path.resolve(homeDir, "Library", "Application Support", "Code - Insiders", "User", "mcp.json");
|
|
723
|
+
if (os.platform() === "win32") {
|
|
724
|
+
return path.resolve(process.env.APPDATA ?? path.join(homeDir, "AppData", "Roaming"), "Code - Insiders", "User", "mcp.json");
|
|
725
|
+
}
|
|
726
|
+
return path.resolve(homeDir, ".config", "Code - Insiders", "User", "mcp.json");
|
|
727
|
+
}
|
|
617
728
|
function claudeDesktopConfigPath(homeDir = os.homedir()) {
|
|
618
729
|
if (os.platform() === "darwin") {
|
|
619
730
|
return path.resolve(homeDir, "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
@@ -633,6 +744,8 @@ function configTargetLabel(runtime) {
|
|
|
633
744
|
return "Cursor MCP config";
|
|
634
745
|
case "vscode":
|
|
635
746
|
return "VS Code MCP config";
|
|
747
|
+
case "vscode-insiders":
|
|
748
|
+
return "VS Code Insiders MCP config";
|
|
636
749
|
case "claude-desktop":
|
|
637
750
|
return "Claude Desktop config";
|
|
638
751
|
default:
|
|
@@ -1003,102 +1116,6 @@ async function assertFileExists(path, label) {
|
|
|
1003
1116
|
throw new Error(`Missing ${label}: ${path}`);
|
|
1004
1117
|
}
|
|
1005
1118
|
}
|
|
1006
|
-
|
|
1007
|
-
// src/runtime-registry.ts
|
|
1008
|
-
var RUNTIME_PROFILES = {
|
|
1009
|
-
"claude-code": {
|
|
1010
|
-
id: "claude-code",
|
|
1011
|
-
label: "Claude Code",
|
|
1012
|
-
restartMode: "restart-session",
|
|
1013
|
-
canWriteRuntimeConfig: true
|
|
1014
|
-
},
|
|
1015
|
-
"codex-cli": {
|
|
1016
|
-
id: "codex-cli",
|
|
1017
|
-
label: "Codex CLI",
|
|
1018
|
-
restartMode: "restart-session",
|
|
1019
|
-
canWriteRuntimeConfig: true
|
|
1020
|
-
},
|
|
1021
|
-
"codex-desktop": {
|
|
1022
|
-
id: "codex-desktop",
|
|
1023
|
-
label: "Codex Desktop",
|
|
1024
|
-
restartMode: "restart-session",
|
|
1025
|
-
canWriteRuntimeConfig: true
|
|
1026
|
-
},
|
|
1027
|
-
cursor: {
|
|
1028
|
-
id: "cursor",
|
|
1029
|
-
label: "Cursor",
|
|
1030
|
-
restartMode: "hot-reload",
|
|
1031
|
-
canWriteRuntimeConfig: true
|
|
1032
|
-
},
|
|
1033
|
-
vscode: {
|
|
1034
|
-
id: "vscode",
|
|
1035
|
-
label: "VS Code",
|
|
1036
|
-
restartMode: "hot-reload",
|
|
1037
|
-
canWriteRuntimeConfig: true
|
|
1038
|
-
},
|
|
1039
|
-
"claude-desktop": {
|
|
1040
|
-
id: "claude-desktop",
|
|
1041
|
-
label: "Claude Desktop",
|
|
1042
|
-
restartMode: "restart-app",
|
|
1043
|
-
canWriteRuntimeConfig: true
|
|
1044
|
-
},
|
|
1045
|
-
other: {
|
|
1046
|
-
id: "other",
|
|
1047
|
-
label: "Other agent runtime",
|
|
1048
|
-
restartMode: "manual",
|
|
1049
|
-
canWriteRuntimeConfig: false
|
|
1050
|
-
}
|
|
1051
|
-
};
|
|
1052
|
-
var RUNTIME_ALIASES = {
|
|
1053
|
-
claude: "claude-code",
|
|
1054
|
-
"claude-code": "claude-code",
|
|
1055
|
-
claudecode: "claude-code",
|
|
1056
|
-
"claude_code": "claude-code",
|
|
1057
|
-
codex: "codex-cli",
|
|
1058
|
-
"codex-cli": "codex-cli",
|
|
1059
|
-
codexcli: "codex-cli",
|
|
1060
|
-
"codex_cli": "codex-cli",
|
|
1061
|
-
"codex-desktop": "codex-desktop",
|
|
1062
|
-
"codex_desktop": "codex-desktop",
|
|
1063
|
-
codexdesktop: "codex-desktop",
|
|
1064
|
-
"codex-app": "codex-desktop",
|
|
1065
|
-
"codex_app": "codex-desktop",
|
|
1066
|
-
codexapp: "codex-desktop",
|
|
1067
|
-
cursor: "cursor",
|
|
1068
|
-
vscode: "vscode",
|
|
1069
|
-
"vs-code": "vscode",
|
|
1070
|
-
"vs_code": "vscode",
|
|
1071
|
-
code: "vscode",
|
|
1072
|
-
"claude-desktop": "claude-desktop",
|
|
1073
|
-
"claude_desktop": "claude-desktop",
|
|
1074
|
-
claudesktop: "claude-desktop",
|
|
1075
|
-
desktop: "claude-desktop",
|
|
1076
|
-
other: "other",
|
|
1077
|
-
manual: "other"
|
|
1078
|
-
};
|
|
1079
|
-
function runtimeProfile(runtime, env = process.env) {
|
|
1080
|
-
return RUNTIME_PROFILES[normalizeRuntime(runtime, env)];
|
|
1081
|
-
}
|
|
1082
|
-
function normalizeRuntime(runtime, env = process.env) {
|
|
1083
|
-
const explicit = normalizeRuntimeName(runtime);
|
|
1084
|
-
if (explicit) return explicit;
|
|
1085
|
-
return detectRuntime(env) ?? "other";
|
|
1086
|
-
}
|
|
1087
|
-
function restartRequiredForRuntime(runtime, env = process.env) {
|
|
1088
|
-
const mode = runtimeProfile(runtime, env).restartMode;
|
|
1089
|
-
return mode === "restart-session" || mode === "restart-app";
|
|
1090
|
-
}
|
|
1091
|
-
function normalizeRuntimeName(runtime) {
|
|
1092
|
-
const key = runtime?.trim().toLowerCase();
|
|
1093
|
-
if (!key) return null;
|
|
1094
|
-
return RUNTIME_ALIASES[key.replace(/\s+/g, "-")] ?? null;
|
|
1095
|
-
}
|
|
1096
|
-
function detectRuntime(env) {
|
|
1097
|
-
if (env.CLAUDECODE || env.CLAUDE_CODE || env.CLAUDECODE_CWD) return "claude-code";
|
|
1098
|
-
if (env.CODEX_SANDBOX || env.CODEX_HOME || env.CODEX_CWD) return "codex-cli";
|
|
1099
|
-
if (env.VSCODE_CWD || env.VSCODE_IPC_HOOK_CLI || env.TERM_PROGRAM === "vscode") return "vscode";
|
|
1100
|
-
return null;
|
|
1101
|
-
}
|
|
1102
1119
|
async function acknowledgeLocalSignerConsent(signerPath, log) {
|
|
1103
1120
|
try {
|
|
1104
1121
|
const input = await buildSignerConsentInput(signerPath);
|
|
@@ -1303,7 +1320,7 @@ async function configureClaudeCode(deps, localMcpCommand) {
|
|
|
1303
1320
|
messages: [
|
|
1304
1321
|
"Updated local Haven MCP entry with Claude Code.",
|
|
1305
1322
|
...verified ? ["Verified Claude Code MCP entry."] : [],
|
|
1306
|
-
"After Haven approval,
|
|
1323
|
+
"After Haven approval, Haven tools should appear in your next Claude Code message. If they don't, restart the session to load them."
|
|
1307
1324
|
]
|
|
1308
1325
|
};
|
|
1309
1326
|
} catch (err) {
|
|
@@ -1503,7 +1520,11 @@ async function runConnect(options, deps = {}) {
|
|
|
1503
1520
|
}
|
|
1504
1521
|
log("Return to Haven to approve the agent rules.");
|
|
1505
1522
|
if (runtimeInstall.restartRequired) {
|
|
1506
|
-
|
|
1523
|
+
if (runtimeRequiresHardRestart(runtimeInstall.runtime)) {
|
|
1524
|
+
log("After approval, restart this agent so it can load Haven tools.");
|
|
1525
|
+
} else {
|
|
1526
|
+
log("After approval, Haven tools should appear in your next message. If they don't, restart this agent to load them.");
|
|
1527
|
+
}
|
|
1507
1528
|
}
|
|
1508
1529
|
return {
|
|
1509
1530
|
setupId: registration.setup_id,
|