@haven_ai/connect 0.1.3-alpha → 0.1.5-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/index.d.cts CHANGED
@@ -121,7 +121,7 @@ declare function preflightCredentialStorage(input?: PreflightCredentialStorageIn
121
121
  declare function writeCredentialFiles(input: WriteCredentialInput): Promise<StoredCredentialPaths>;
122
122
  declare function defaultAgentDirectory(agentId: string, baseDir?: string): string;
123
123
 
124
- type RuntimeId = 'claude-code' | 'codex-desktop' | 'codex-cli' | 'cursor' | 'vscode' | 'claude-desktop' | 'other';
124
+ type RuntimeId = 'claude-code' | 'codex-desktop' | 'codex-cli' | 'cursor' | 'vscode' | 'vscode-insiders' | 'claude-desktop' | 'other';
125
125
  type RestartMode = 'restart-session' | 'restart-app' | 'hot-reload' | 'manual';
126
126
  interface RuntimeProfile {
127
127
  id: RuntimeId;
package/dist/index.d.ts CHANGED
@@ -121,7 +121,7 @@ declare function preflightCredentialStorage(input?: PreflightCredentialStorageIn
121
121
  declare function writeCredentialFiles(input: WriteCredentialInput): Promise<StoredCredentialPaths>;
122
122
  declare function defaultAgentDirectory(agentId: string, baseDir?: string): string;
123
123
 
124
- type RuntimeId = 'claude-code' | 'codex-desktop' | 'codex-cli' | 'cursor' | 'vscode' | 'claude-desktop' | 'other';
124
+ type RuntimeId = 'claude-code' | 'codex-desktop' | 'codex-cli' | 'cursor' | 'vscode' | 'vscode-insiders' | 'claude-desktop' | 'other';
125
125
  type RestartMode = 'restart-session' | 'restart-app' | 'hot-reload' | 'manual';
126
126
  interface RuntimeProfile {
127
127
  id: RuntimeId;
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { homedir, platform } from 'os';
5
5
  import { join, resolve, dirname } from 'path';
6
6
  import { execFile, spawn } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { MCP_VERSION, ensureConsent, computeConsentHash, loadCredentials, consentInputFromClient, registeredToolNames } from '@haven_ai/mcp';
8
+ import { registeredToolNames, MCP_VERSION, ensureConsent, computeConsentHash, loadCredentials, consentInputFromClient } from '@haven_ai/mcp';
9
9
  import { ensureSignerConsent, computeSignerConsentHash, loadSignerCredentials, createEdgeSigner, toolSchemas } from '@haven_ai/signer';
10
10
 
11
11
  // src/api.ts
@@ -205,24 +205,12 @@ var MCP_RUNTIME_MANIFEST = {
205
205
  mcpPackage: "@haven_ai/mcp",
206
206
  mcpVersion: MCP_VERSION,
207
207
  sdkPackage: "@haven_ai/sdk",
208
- sdkVersion: "0.1.6",
208
+ sdkVersion: "0.1.8",
209
209
  signerPackage: "@haven_ai/signer",
210
- signerVersion: "0.1.0-alpha",
210
+ signerVersion: "0.1.2-alpha",
211
211
  minimumNodeVersion: "20.0.0",
212
212
  supportedClients: ["codex-cli", "codex-desktop", "claude-code"],
213
- requiredTools: [
214
- "haven_quote_x402",
215
- "haven_pay_x402_quote",
216
- "haven_resume_x402_payment",
217
- "haven_quote_mpp",
218
- "haven_pay_mpp_challenge",
219
- "haven_resume_mpp_payment",
220
- "haven_get_payment_status",
221
- "haven_get_resume_state",
222
- "haven_get_agent",
223
- "haven_get_allowances",
224
- "haven_list_receipts"
225
- ]
213
+ requiredTools: registeredToolNames()
226
214
  };
227
215
  function mcpPackageSpec() {
228
216
  return `${MCP_RUNTIME_MANIFEST.mcpPackage}@${MCP_RUNTIME_MANIFEST.mcpVersion}`;
@@ -234,6 +222,117 @@ function signerPackageSpec() {
234
222
  return `${MCP_RUNTIME_MANIFEST.signerPackage}@${MCP_RUNTIME_MANIFEST.signerVersion}`;
235
223
  }
236
224
 
225
+ // src/runtime-registry.ts
226
+ var RUNTIME_PROFILES = {
227
+ "claude-code": {
228
+ id: "claude-code",
229
+ label: "Claude Code",
230
+ restartMode: "restart-session",
231
+ canWriteRuntimeConfig: true
232
+ },
233
+ "codex-cli": {
234
+ id: "codex-cli",
235
+ label: "Codex CLI",
236
+ restartMode: "restart-session",
237
+ canWriteRuntimeConfig: true
238
+ },
239
+ "codex-desktop": {
240
+ id: "codex-desktop",
241
+ label: "Codex Desktop",
242
+ restartMode: "restart-session",
243
+ canWriteRuntimeConfig: true
244
+ },
245
+ cursor: {
246
+ id: "cursor",
247
+ label: "Cursor",
248
+ restartMode: "hot-reload",
249
+ canWriteRuntimeConfig: true
250
+ },
251
+ vscode: {
252
+ id: "vscode",
253
+ label: "VS Code",
254
+ restartMode: "hot-reload",
255
+ canWriteRuntimeConfig: true
256
+ },
257
+ "vscode-insiders": {
258
+ id: "vscode-insiders",
259
+ label: "VS Code Insiders",
260
+ restartMode: "hot-reload",
261
+ canWriteRuntimeConfig: true
262
+ },
263
+ "claude-desktop": {
264
+ id: "claude-desktop",
265
+ label: "Claude Desktop",
266
+ restartMode: "restart-app",
267
+ canWriteRuntimeConfig: true
268
+ },
269
+ other: {
270
+ id: "other",
271
+ label: "Other agent runtime",
272
+ restartMode: "manual",
273
+ canWriteRuntimeConfig: false
274
+ }
275
+ };
276
+ var RUNTIME_ALIASES = {
277
+ claude: "claude-code",
278
+ "claude-code": "claude-code",
279
+ claudecode: "claude-code",
280
+ "claude_code": "claude-code",
281
+ codex: "codex-cli",
282
+ "codex-cli": "codex-cli",
283
+ codexcli: "codex-cli",
284
+ "codex_cli": "codex-cli",
285
+ "codex-desktop": "codex-desktop",
286
+ "codex_desktop": "codex-desktop",
287
+ codexdesktop: "codex-desktop",
288
+ "codex-app": "codex-desktop",
289
+ "codex_app": "codex-desktop",
290
+ codexapp: "codex-desktop",
291
+ cursor: "cursor",
292
+ vscode: "vscode",
293
+ "vs-code": "vscode",
294
+ "vs_code": "vscode",
295
+ code: "vscode",
296
+ "vscode-insiders": "vscode-insiders",
297
+ "vscode_insiders": "vscode-insiders",
298
+ vscodeinsiders: "vscode-insiders",
299
+ "vs-code-insiders": "vscode-insiders",
300
+ "code-insiders": "vscode-insiders",
301
+ insiders: "vscode-insiders",
302
+ "claude-desktop": "claude-desktop",
303
+ "claude_desktop": "claude-desktop",
304
+ claudesktop: "claude-desktop",
305
+ desktop: "claude-desktop",
306
+ other: "other",
307
+ manual: "other"
308
+ };
309
+ function runtimeProfile(runtime, env = process.env) {
310
+ return RUNTIME_PROFILES[normalizeRuntime(runtime, env)];
311
+ }
312
+ function normalizeRuntime(runtime, env = process.env) {
313
+ const explicit = normalizeRuntimeName(runtime);
314
+ if (explicit) return explicit;
315
+ return detectRuntime(env) ?? "other";
316
+ }
317
+ function restartRequiredForRuntime(runtime, env = process.env) {
318
+ const mode = runtimeProfile(runtime, env).restartMode;
319
+ return mode === "restart-session" || mode === "restart-app";
320
+ }
321
+ function runtimeRequiresHardRestart(runtime) {
322
+ return runtime === "claude-desktop" || runtime === "codex-desktop";
323
+ }
324
+ function normalizeRuntimeName(runtime) {
325
+ const key = runtime?.trim().toLowerCase();
326
+ if (!key) return null;
327
+ return RUNTIME_ALIASES[key.replace(/\s+/g, "-")] ?? null;
328
+ }
329
+ function detectRuntime(env) {
330
+ if (env.CLAUDECODE || env.CLAUDE_CODE || env.CLAUDECODE_CWD) return "claude-code";
331
+ if (env.CODEX_SANDBOX || env.CODEX_HOME || env.CODEX_CWD) return "codex-cli";
332
+ if (env.VSCODE_CWD || env.VSCODE_IPC_HOOK_CLI || env.TERM_PROGRAM === "vscode") return "vscode";
333
+ return null;
334
+ }
335
+
237
336
  // src/config-writers.ts
238
337
  var InvalidCodexTomlError = class extends Error {
239
338
  constructor(message) {
@@ -250,6 +349,8 @@ async function writeRuntimeConfig(input) {
250
349
  return writeJsonRuntimeConfig(input, cursorConfigPath(input.homeDir), "mcpServers");
251
350
  case "vscode":
252
351
  return writeJsonRuntimeConfig(input, vscodeConfigPath(input.homeDir), "servers");
352
+ case "vscode-insiders":
353
+ return writeJsonRuntimeConfig(input, vscodeInsidersConfigPath(input.homeDir), "servers");
253
354
  case "claude-desktop":
254
355
  return writeJsonRuntimeConfig(input, claudeDesktopConfigPath(input.homeDir), "mcpServers");
255
356
  default:
@@ -267,7 +368,7 @@ async function writeRuntimeConfig(input) {
267
368
  }
268
369
  }
269
370
  function buildHostedServer(hostedMcpUrl, apiKey, runtime) {
270
- if (runtime === "vscode") {
371
+ if (runtime === "vscode" || runtime === "vscode-insiders") {
271
372
  return {
272
373
  type: "http",
273
374
  url: hostedMcpUrl,
@@ -284,7 +385,7 @@ function buildSignerServer(signerPath, runtime) {
284
385
  command: "npx",
285
386
  args: ["-y", signerPackageName(), "--credentials", signerPath]
286
387
  };
287
- if (runtime === "vscode") return { type: "stdio", ...server };
388
+ if (runtime === "vscode" || runtime === "vscode-insiders") return { type: "stdio", ...server };
288
389
  return server;
289
390
  }
290
391
  function mergeJsonMcpConfig(existingJson, serverRoot, hostedServer, signerServer) {
@@ -368,7 +469,10 @@ async function writeCodexConfig(input) {
368
469
  restartRequired: true,
369
470
  messages: [
370
471
  `Updated local Haven MCP entry in ${configTargetLabel(input.runtime)}.`,
371
- "After Haven approval, restart Codex normally so it can load Haven tools."
472
+ // Codex Desktop loads MCP servers at app launch; Codex CLI typically
473
+ // picks them up in the next session. Branch the copy so desktop users
474
+ // get the unambiguous instruction.
475
+ 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."
372
476
  ]
373
477
  };
374
478
  } catch (err) {
@@ -607,6 +711,13 @@ function vscodeConfigPath(homeDir = homedir()) {
607
711
  }
608
712
  return resolve(homeDir, ".config", "Code", "User", "mcp.json");
609
713
  }
714
+ function vscodeInsidersConfigPath(homeDir = homedir()) {
715
+ if (platform() === "darwin") return resolve(homeDir, "Library", "Application Support", "Code - Insiders", "User", "mcp.json");
716
+ if (platform() === "win32") {
717
+ return resolve(process.env.APPDATA ?? join(homeDir, "AppData", "Roaming"), "Code - Insiders", "User", "mcp.json");
718
+ }
719
+ return resolve(homeDir, ".config", "Code - Insiders", "User", "mcp.json");
720
+ }
610
721
  function claudeDesktopConfigPath(homeDir = homedir()) {
611
722
  if (platform() === "darwin") {
612
723
  return resolve(homeDir, "Library", "Application Support", "Claude", "claude_desktop_config.json");
@@ -626,6 +737,8 @@ function configTargetLabel(runtime) {
626
737
  return "Cursor MCP config";
627
738
  case "vscode":
628
739
  return "VS Code MCP config";
740
+ case "vscode-insiders":
741
+ return "VS Code Insiders MCP config";
629
742
  case "claude-desktop":
630
743
  return "Claude Desktop config";
631
744
  default:
@@ -996,102 +1109,6 @@ async function assertFileExists(path, label) {
996
1109
  throw new Error(`Missing ${label}: ${path}`);
997
1110
  }
998
1111
  }
999
-
1000
- // src/runtime-registry.ts
1001
- var RUNTIME_PROFILES = {
1002
- "claude-code": {
1003
- id: "claude-code",
1004
- label: "Claude Code",
1005
- restartMode: "restart-session",
1006
- canWriteRuntimeConfig: true
1007
- },
1008
- "codex-cli": {
1009
- id: "codex-cli",
1010
- label: "Codex CLI",
1011
- restartMode: "restart-session",
1012
- canWriteRuntimeConfig: true
1013
- },
1014
- "codex-desktop": {
1015
- id: "codex-desktop",
1016
- label: "Codex Desktop",
1017
- restartMode: "restart-session",
1018
- canWriteRuntimeConfig: true
1019
- },
1020
- cursor: {
1021
- id: "cursor",
1022
- label: "Cursor",
1023
- restartMode: "hot-reload",
1024
- canWriteRuntimeConfig: true
1025
- },
1026
- vscode: {
1027
- id: "vscode",
1028
- label: "VS Code",
1029
- restartMode: "hot-reload",
1030
- canWriteRuntimeConfig: true
1031
- },
1032
- "claude-desktop": {
1033
- id: "claude-desktop",
1034
- label: "Claude Desktop",
1035
- restartMode: "restart-app",
1036
- canWriteRuntimeConfig: true
1037
- },
1038
- other: {
1039
- id: "other",
1040
- label: "Other agent runtime",
1041
- restartMode: "manual",
1042
- canWriteRuntimeConfig: false
1043
- }
1044
- };
1045
- var RUNTIME_ALIASES = {
1046
- claude: "claude-code",
1047
- "claude-code": "claude-code",
1048
- claudecode: "claude-code",
1049
- "claude_code": "claude-code",
1050
- codex: "codex-cli",
1051
- "codex-cli": "codex-cli",
1052
- codexcli: "codex-cli",
1053
- "codex_cli": "codex-cli",
1054
- "codex-desktop": "codex-desktop",
1055
- "codex_desktop": "codex-desktop",
1056
- codexdesktop: "codex-desktop",
1057
- "codex-app": "codex-desktop",
1058
- "codex_app": "codex-desktop",
1059
- codexapp: "codex-desktop",
1060
- cursor: "cursor",
1061
- vscode: "vscode",
1062
- "vs-code": "vscode",
1063
- "vs_code": "vscode",
1064
- code: "vscode",
1065
- "claude-desktop": "claude-desktop",
1066
- "claude_desktop": "claude-desktop",
1067
- claudesktop: "claude-desktop",
1068
- desktop: "claude-desktop",
1069
- other: "other",
1070
- manual: "other"
1071
- };
1072
- function runtimeProfile(runtime, env = process.env) {
1073
- return RUNTIME_PROFILES[normalizeRuntime(runtime, env)];
1074
- }
1075
- function normalizeRuntime(runtime, env = process.env) {
1076
- const explicit = normalizeRuntimeName(runtime);
1077
- if (explicit) return explicit;
1078
- return detectRuntime(env) ?? "other";
1079
- }
1080
- function restartRequiredForRuntime(runtime, env = process.env) {
1081
- const mode = runtimeProfile(runtime, env).restartMode;
1082
- return mode === "restart-session" || mode === "restart-app";
1083
- }
1084
- function normalizeRuntimeName(runtime) {
1085
- const key = runtime?.trim().toLowerCase();
1086
- if (!key) return null;
1087
- return RUNTIME_ALIASES[key.replace(/\s+/g, "-")] ?? null;
1088
- }
1089
- function detectRuntime(env) {
1090
- if (env.CLAUDECODE || env.CLAUDE_CODE || env.CLAUDECODE_CWD) return "claude-code";
1091
- if (env.CODEX_SANDBOX || env.CODEX_HOME || env.CODEX_CWD) return "codex-cli";
1092
- if (env.VSCODE_CWD || env.VSCODE_IPC_HOOK_CLI || env.TERM_PROGRAM === "vscode") return "vscode";
1093
- return null;
1094
- }
1095
1112
  async function acknowledgeLocalSignerConsent(signerPath, log) {
1096
1113
  try {
1097
1114
  const input = await buildSignerConsentInput(signerPath);
@@ -1296,7 +1313,7 @@ async function configureClaudeCode(deps, localMcpCommand) {
1296
1313
  messages: [
1297
1314
  "Updated local Haven MCP entry with Claude Code.",
1298
1315
  ...verified ? ["Verified Claude Code MCP entry."] : [],
1299
- "After Haven approval, restart Claude Code normally so it can load Haven tools."
1316
+ "After Haven approval, Haven tools should appear in your next Claude Code message. If they don't, restart the session to load them."
1300
1317
  ]
1301
1318
  };
1302
1319
  } catch (err) {
@@ -1496,7 +1513,11 @@ async function runConnect(options, deps = {}) {
1496
1513
  }
1497
1514
  log("Return to Haven to approve the agent rules.");
1498
1515
  if (runtimeInstall.restartRequired) {
1499
- log("After approval, restart this agent normally so it can load Haven tools.");
1516
+ if (runtimeRequiresHardRestart(runtimeInstall.runtime)) {
1517
+ log("After approval, restart this agent so it can load Haven tools.");
1518
+ } else {
1519
+ log("After approval, Haven tools should appear in your next message. If they don't, restart this agent to load them.");
1520
+ }
1500
1521
  }
1501
1522
  return {
1502
1523
  setupId: registration.setup_id,