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