@adhdev/daemon-standalone 0.9.68 → 0.9.69

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.js CHANGED
@@ -45254,6 +45254,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
45254
45254
  "type",
45255
45255
  "name",
45256
45256
  "category",
45257
+ "transcriptAuthority",
45258
+ "transcriptContext",
45257
45259
  "aliases",
45258
45260
  "cdpPorts",
45259
45261
  "targetFilter",
@@ -45298,6 +45300,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
45298
45300
  "staticConfigOptions",
45299
45301
  "spawnArgBuilder",
45300
45302
  "auth",
45303
+ "meshCoordinator",
45301
45304
  "contractVersion",
45302
45305
  "capabilities",
45303
45306
  "providerVersion",
@@ -45355,6 +45358,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
45355
45358
  }
45356
45359
  validateCapabilities(provider, controls, errors);
45357
45360
  validateCanonicalHistory(provider.canonicalHistory, errors);
45361
+ validateMeshCoordinator(provider.meshCoordinator, errors);
45358
45362
  for (const control of controls) {
45359
45363
  validateControl(control, errors);
45360
45364
  }
@@ -45445,6 +45449,60 @@ Run 'adhdev doctor' for detailed diagnostics.`
45445
45449
  }
45446
45450
  }
45447
45451
  }
45452
+ function validateMeshCoordinator(raw, errors) {
45453
+ if (raw === void 0) return;
45454
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
45455
+ errors.push("meshCoordinator must be an object");
45456
+ return;
45457
+ }
45458
+ const meshCoordinator = raw;
45459
+ if (typeof meshCoordinator.supported !== "boolean") {
45460
+ errors.push("meshCoordinator.supported must be boolean");
45461
+ }
45462
+ if (meshCoordinator.reason !== void 0 && (typeof meshCoordinator.reason !== "string" || !meshCoordinator.reason.trim())) {
45463
+ errors.push("meshCoordinator.reason must be a non-empty string when provided");
45464
+ }
45465
+ const mcpConfig = meshCoordinator.mcpConfig;
45466
+ if (mcpConfig === void 0) return;
45467
+ if (!mcpConfig || typeof mcpConfig !== "object" || Array.isArray(mcpConfig)) {
45468
+ errors.push("meshCoordinator.mcpConfig must be an object");
45469
+ return;
45470
+ }
45471
+ const config2 = mcpConfig;
45472
+ const mode = config2.mode;
45473
+ if (!["auto_import", "manual", "none"].includes(String(mode))) {
45474
+ errors.push("meshCoordinator.mcpConfig.mode must be one of: auto_import, manual, none");
45475
+ }
45476
+ const format = config2.format;
45477
+ if (format !== void 0 && !["claude_mcp_json", "hermes_config_yaml"].includes(String(format))) {
45478
+ errors.push("meshCoordinator.mcpConfig.format must be one of: claude_mcp_json, hermes_config_yaml");
45479
+ }
45480
+ for (const key of ["path", "serverName", "configPathCommand", "instructions", "template"]) {
45481
+ const value = config2[key];
45482
+ if (value !== void 0 && (typeof value !== "string" || !value.trim())) {
45483
+ errors.push(`meshCoordinator.mcpConfig.${key} must be a non-empty string when provided`);
45484
+ }
45485
+ }
45486
+ if (config2.requiresRestart !== void 0 && typeof config2.requiresRestart !== "boolean") {
45487
+ errors.push("meshCoordinator.mcpConfig.requiresRestart must be boolean when provided");
45488
+ }
45489
+ if (mode === "auto_import") {
45490
+ if (format === void 0) {
45491
+ errors.push("meshCoordinator.mcpConfig.format is required for auto_import MCP setup");
45492
+ }
45493
+ if (typeof config2.path !== "string" || !config2.path.trim()) {
45494
+ errors.push("meshCoordinator.mcpConfig.path is required for auto_import MCP setup");
45495
+ }
45496
+ }
45497
+ if (mode === "manual") {
45498
+ if (typeof config2.instructions !== "string" || !config2.instructions.trim()) {
45499
+ errors.push("meshCoordinator.mcpConfig.instructions is required for manual MCP setup");
45500
+ }
45501
+ if (typeof config2.template !== "string" || !config2.template.trim()) {
45502
+ errors.push("meshCoordinator.mcpConfig.template is required for manual MCP setup");
45503
+ }
45504
+ }
45505
+ }
45448
45506
  function validateControl(control, errors) {
45449
45507
  if (!control || typeof control !== "object") {
45450
45508
  errors.push("controls: each control must be an object");
@@ -47587,6 +47645,67 @@ Run 'adhdev doctor' for detailed diagnostics.`
47587
47645
  }
47588
47646
  cleanOldFiles();
47589
47647
  init_logger();
47648
+ var import_path4 = require("path");
47649
+ var DEFAULT_SERVER_NAME = "adhdev-mesh";
47650
+ var DEFAULT_ADHDEV_MCP_COMMAND = "adhdev-mcp";
47651
+ function resolveMeshCoordinatorSetup(options) {
47652
+ const { provider, meshId, workspace } = options;
47653
+ const config2 = provider?.meshCoordinator;
47654
+ if (!config2?.supported) {
47655
+ return {
47656
+ kind: "unsupported",
47657
+ reason: config2?.reason || "Provider does not declare Repo Mesh coordinator support"
47658
+ };
47659
+ }
47660
+ const mcpConfig = config2.mcpConfig;
47661
+ if (!mcpConfig || mcpConfig.mode === "none") {
47662
+ return {
47663
+ kind: "unsupported",
47664
+ reason: config2.reason || "Provider does not declare a usable Repo Mesh MCP configuration mode"
47665
+ };
47666
+ }
47667
+ const serverName = mcpConfig.serverName?.trim() || DEFAULT_SERVER_NAME;
47668
+ if (mcpConfig.mode === "auto_import") {
47669
+ const path26 = mcpConfig.path?.trim();
47670
+ if (!path26) {
47671
+ return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
47672
+ }
47673
+ return {
47674
+ kind: "auto_import",
47675
+ serverName,
47676
+ configPath: (0, import_path4.join)(workspace, path26),
47677
+ configFormat: mcpConfig.format
47678
+ };
47679
+ }
47680
+ if (mcpConfig.mode === "manual") {
47681
+ const instructions = mcpConfig.instructions?.trim();
47682
+ const template = mcpConfig.template;
47683
+ if (!instructions || !template?.trim()) {
47684
+ return { kind: "unsupported", reason: "Provider manual MCP setup is missing instructions or template" };
47685
+ }
47686
+ return {
47687
+ kind: "manual",
47688
+ serverName,
47689
+ configFormat: mcpConfig.format,
47690
+ configPathCommand: mcpConfig.configPathCommand,
47691
+ requiresRestart: mcpConfig.requiresRestart === true,
47692
+ instructions,
47693
+ template: renderMeshCoordinatorTemplate(template, {
47694
+ meshId,
47695
+ workspace,
47696
+ serverName,
47697
+ adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
47698
+ })
47699
+ };
47700
+ }
47701
+ return {
47702
+ kind: "unsupported",
47703
+ reason: `Unsupported Repo Mesh MCP configuration mode: ${String(mcpConfig.mode)}`
47704
+ };
47705
+ }
47706
+ function renderMeshCoordinatorTemplate(template, values) {
47707
+ return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand)\s*\}\}/g, (_, key) => values[key] || "");
47708
+ }
47590
47709
  var os17 = __toESM2(require("os"));
47591
47710
  init_config();
47592
47711
  init_terminal_screen();
@@ -47637,7 +47756,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
47637
47756
  ...provider.enabled !== void 0 ? { enabled: provider.enabled } : {},
47638
47757
  ...provider.machineStatus !== void 0 ? { machineStatus: provider.machineStatus } : {},
47639
47758
  ...provider.lastDetection !== void 0 ? { lastDetection: provider.lastDetection } : {},
47640
- ...provider.lastVerification !== void 0 ? { lastVerification: provider.lastVerification } : {}
47759
+ ...provider.lastVerification !== void 0 ? { lastVerification: provider.lastVerification } : {},
47760
+ ...provider.meshCoordinator !== void 0 ? { meshCoordinator: provider.meshCoordinator } : {}
47641
47761
  }));
47642
47762
  }
47643
47763
  function buildMachineInfo2(profile = "full") {
@@ -49042,9 +49162,45 @@ Run 'adhdev doctor' for detailed diagnostics.`
49042
49162
  if (!mesh) return { success: false, error: "Mesh not found" };
49043
49163
  if (mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
49044
49164
  const workspace = mesh.nodes[0].workspace;
49165
+ const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
49166
+ const coordinatorSetup = resolveMeshCoordinatorSetup({
49167
+ provider: providerMeta,
49168
+ meshId,
49169
+ workspace
49170
+ });
49171
+ if (coordinatorSetup.kind === "unsupported") {
49172
+ return {
49173
+ success: false,
49174
+ code: "mesh_coordinator_unsupported",
49175
+ error: coordinatorSetup.reason,
49176
+ meshId,
49177
+ cliType,
49178
+ workspace
49179
+ };
49180
+ }
49181
+ if (coordinatorSetup.kind === "manual") {
49182
+ return {
49183
+ success: false,
49184
+ code: "mesh_coordinator_manual_mcp_setup_required",
49185
+ error: coordinatorSetup.instructions,
49186
+ meshId,
49187
+ cliType,
49188
+ workspace,
49189
+ meshCoordinatorSetup: coordinatorSetup
49190
+ };
49191
+ }
49192
+ if (coordinatorSetup.configFormat !== "claude_mcp_json") {
49193
+ return {
49194
+ success: false,
49195
+ code: "mesh_coordinator_unsupported",
49196
+ error: `Unsupported auto-import MCP config format: ${String(coordinatorSetup.configFormat)}`,
49197
+ meshId,
49198
+ cliType,
49199
+ workspace
49200
+ };
49201
+ }
49045
49202
  const { existsSync: existsSync21, readFileSync: readFileSync15, writeFileSync: writeFileSync12, copyFileSync: copyFileSync3 } = await import("fs");
49046
- const { join: join23 } = await import("path");
49047
- const mcpConfigPath = join23(workspace, ".mcp.json");
49203
+ const mcpConfigPath = coordinatorSetup.configPath;
49048
49204
  const hadExistingMcpConfig = existsSync21(mcpConfigPath);
49049
49205
  let existingMcpConfig = {};
49050
49206
  if (hadExistingMcpConfig) {
@@ -49058,14 +49214,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
49058
49214
  ...existingMcpConfig,
49059
49215
  mcpServers: {
49060
49216
  ...existingMcpConfig.mcpServers || {},
49061
- "adhdev-mesh": {
49217
+ [coordinatorSetup.serverName]: {
49062
49218
  command: "adhdev-mcp",
49063
49219
  args: ["--repo-mesh", meshId]
49064
49220
  }
49065
49221
  }
49066
49222
  };
49067
49223
  writeFileSync12(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
49068
- LOG2.info("MeshCoordinator", `Wrote .mcp.json to ${workspace} with adhdev-mesh server`);
49224
+ LOG2.info("MeshCoordinator", `Wrote ${mcpConfigPath} with ${coordinatorSetup.serverName} server`);
49069
49225
  let systemPrompt = "";
49070
49226
  try {
49071
49227
  systemPrompt = buildCoordinatorSystemPrompt2({ mesh });