adhdev 0.9.68 → 0.9.70

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/index.js CHANGED
@@ -37504,6 +37504,7 @@ function validateProviderDefinition(raw) {
37504
37504
  }
37505
37505
  validateCapabilities(provider, controls, errors);
37506
37506
  validateCanonicalHistory(provider.canonicalHistory, errors);
37507
+ validateMeshCoordinator(provider.meshCoordinator, errors);
37507
37508
  for (const control of controls) {
37508
37509
  validateControl(control, errors);
37509
37510
  }
@@ -37594,6 +37595,60 @@ function validateCanonicalHistory(raw, errors) {
37594
37595
  }
37595
37596
  }
37596
37597
  }
37598
+ function validateMeshCoordinator(raw, errors) {
37599
+ if (raw === void 0) return;
37600
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
37601
+ errors.push("meshCoordinator must be an object");
37602
+ return;
37603
+ }
37604
+ const meshCoordinator = raw;
37605
+ if (typeof meshCoordinator.supported !== "boolean") {
37606
+ errors.push("meshCoordinator.supported must be boolean");
37607
+ }
37608
+ if (meshCoordinator.reason !== void 0 && (typeof meshCoordinator.reason !== "string" || !meshCoordinator.reason.trim())) {
37609
+ errors.push("meshCoordinator.reason must be a non-empty string when provided");
37610
+ }
37611
+ const mcpConfig = meshCoordinator.mcpConfig;
37612
+ if (mcpConfig === void 0) return;
37613
+ if (!mcpConfig || typeof mcpConfig !== "object" || Array.isArray(mcpConfig)) {
37614
+ errors.push("meshCoordinator.mcpConfig must be an object");
37615
+ return;
37616
+ }
37617
+ const config2 = mcpConfig;
37618
+ const mode = config2.mode;
37619
+ if (!["auto_import", "manual", "none"].includes(String(mode))) {
37620
+ errors.push("meshCoordinator.mcpConfig.mode must be one of: auto_import, manual, none");
37621
+ }
37622
+ const format = config2.format;
37623
+ if (format !== void 0 && !["claude_mcp_json", "hermes_config_yaml"].includes(String(format))) {
37624
+ errors.push("meshCoordinator.mcpConfig.format must be one of: claude_mcp_json, hermes_config_yaml");
37625
+ }
37626
+ for (const key of ["path", "serverName", "configPathCommand", "instructions", "template"]) {
37627
+ const value = config2[key];
37628
+ if (value !== void 0 && (typeof value !== "string" || !value.trim())) {
37629
+ errors.push(`meshCoordinator.mcpConfig.${key} must be a non-empty string when provided`);
37630
+ }
37631
+ }
37632
+ if (config2.requiresRestart !== void 0 && typeof config2.requiresRestart !== "boolean") {
37633
+ errors.push("meshCoordinator.mcpConfig.requiresRestart must be boolean when provided");
37634
+ }
37635
+ if (mode === "auto_import") {
37636
+ if (format === void 0) {
37637
+ errors.push("meshCoordinator.mcpConfig.format is required for auto_import MCP setup");
37638
+ }
37639
+ if (typeof config2.path !== "string" || !config2.path.trim()) {
37640
+ errors.push("meshCoordinator.mcpConfig.path is required for auto_import MCP setup");
37641
+ }
37642
+ }
37643
+ if (mode === "manual") {
37644
+ if (typeof config2.instructions !== "string" || !config2.instructions.trim()) {
37645
+ errors.push("meshCoordinator.mcpConfig.instructions is required for manual MCP setup");
37646
+ }
37647
+ if (typeof config2.template !== "string" || !config2.template.trim()) {
37648
+ errors.push("meshCoordinator.mcpConfig.template is required for manual MCP setup");
37649
+ }
37650
+ }
37651
+ }
37597
37652
  function validateControl(control, errors) {
37598
37653
  if (!control || typeof control !== "object") {
37599
37654
  errors.push("controls: each control must be an object");
@@ -37635,6 +37690,8 @@ var init_provider_schema = __esm({
37635
37690
  "type",
37636
37691
  "name",
37637
37692
  "category",
37693
+ "transcriptAuthority",
37694
+ "transcriptContext",
37638
37695
  "aliases",
37639
37696
  "cdpPorts",
37640
37697
  "targetFilter",
@@ -37679,6 +37736,7 @@ var init_provider_schema = __esm({
37679
37736
  "staticConfigOptions",
37680
37737
  "spawnArgBuilder",
37681
37738
  "auth",
37739
+ "meshCoordinator",
37682
37740
  "contractVersion",
37683
37741
  "capabilities",
37684
37742
  "providerVersion",
@@ -39848,6 +39906,75 @@ var init_command_log = __esm({
39848
39906
  }
39849
39907
  });
39850
39908
 
39909
+ // ../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts
39910
+ function resolveMeshCoordinatorSetup(options) {
39911
+ const { provider, meshId, workspace } = options;
39912
+ const config2 = provider?.meshCoordinator;
39913
+ if (!config2?.supported) {
39914
+ return {
39915
+ kind: "unsupported",
39916
+ reason: config2?.reason || "Provider does not declare Repo Mesh coordinator support"
39917
+ };
39918
+ }
39919
+ const mcpConfig = config2.mcpConfig;
39920
+ if (!mcpConfig || mcpConfig.mode === "none") {
39921
+ return {
39922
+ kind: "unsupported",
39923
+ reason: config2.reason || "Provider does not declare a usable Repo Mesh MCP configuration mode"
39924
+ };
39925
+ }
39926
+ const serverName = mcpConfig.serverName?.trim() || DEFAULT_SERVER_NAME;
39927
+ if (mcpConfig.mode === "auto_import") {
39928
+ const path40 = mcpConfig.path?.trim();
39929
+ if (!path40) {
39930
+ return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
39931
+ }
39932
+ return {
39933
+ kind: "auto_import",
39934
+ serverName,
39935
+ configPath: (0, import_path4.join)(workspace, path40),
39936
+ configFormat: mcpConfig.format
39937
+ };
39938
+ }
39939
+ if (mcpConfig.mode === "manual") {
39940
+ const instructions = mcpConfig.instructions?.trim();
39941
+ const template = mcpConfig.template;
39942
+ if (!instructions || !template?.trim()) {
39943
+ return { kind: "unsupported", reason: "Provider manual MCP setup is missing instructions or template" };
39944
+ }
39945
+ return {
39946
+ kind: "manual",
39947
+ serverName,
39948
+ configFormat: mcpConfig.format,
39949
+ configPathCommand: mcpConfig.configPathCommand,
39950
+ requiresRestart: mcpConfig.requiresRestart === true,
39951
+ instructions,
39952
+ template: renderMeshCoordinatorTemplate(template, {
39953
+ meshId,
39954
+ workspace,
39955
+ serverName,
39956
+ adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
39957
+ })
39958
+ };
39959
+ }
39960
+ return {
39961
+ kind: "unsupported",
39962
+ reason: `Unsupported Repo Mesh MCP configuration mode: ${String(mcpConfig.mode)}`
39963
+ };
39964
+ }
39965
+ function renderMeshCoordinatorTemplate(template, values) {
39966
+ return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand)\s*\}\}/g, (_2, key) => values[key] || "");
39967
+ }
39968
+ var import_path4, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
39969
+ var init_mesh_coordinator = __esm({
39970
+ "../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts"() {
39971
+ "use strict";
39972
+ import_path4 = require("path");
39973
+ DEFAULT_SERVER_NAME = "adhdev-mesh";
39974
+ DEFAULT_ADHDEV_MCP_COMMAND = "adhdev-mcp";
39975
+ }
39976
+ });
39977
+
39851
39978
  // ../../oss/packages/daemon-core/src/status/snapshot.ts
39852
39979
  function buildRecentReadDebugSignature(snapshot) {
39853
39980
  return [
@@ -39893,7 +40020,8 @@ function buildAvailableProviders(providerLoader) {
39893
40020
  ...provider.enabled !== void 0 ? { enabled: provider.enabled } : {},
39894
40021
  ...provider.machineStatus !== void 0 ? { machineStatus: provider.machineStatus } : {},
39895
40022
  ...provider.lastDetection !== void 0 ? { lastDetection: provider.lastDetection } : {},
39896
- ...provider.lastVerification !== void 0 ? { lastVerification: provider.lastVerification } : {}
40023
+ ...provider.lastVerification !== void 0 ? { lastVerification: provider.lastVerification } : {},
40024
+ ...provider.meshCoordinator !== void 0 ? { meshCoordinator: provider.meshCoordinator } : {}
39897
40025
  }));
39898
40026
  }
39899
40027
  function buildMachineInfo(profile = "full") {
@@ -40620,6 +40748,7 @@ var init_router = __esm({
40620
40748
  init_logger();
40621
40749
  init_debug_trace();
40622
40750
  init_runtime_surface();
40751
+ init_mesh_coordinator();
40623
40752
  init_builders();
40624
40753
  init_snapshot();
40625
40754
  init_snapshot();
@@ -41352,9 +41481,45 @@ var init_router = __esm({
41352
41481
  if (!mesh) return { success: false, error: "Mesh not found" };
41353
41482
  if (mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
41354
41483
  const workspace = mesh.nodes[0].workspace;
41484
+ const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
41485
+ const coordinatorSetup = resolveMeshCoordinatorSetup({
41486
+ provider: providerMeta,
41487
+ meshId,
41488
+ workspace
41489
+ });
41490
+ if (coordinatorSetup.kind === "unsupported") {
41491
+ return {
41492
+ success: false,
41493
+ code: "mesh_coordinator_unsupported",
41494
+ error: coordinatorSetup.reason,
41495
+ meshId,
41496
+ cliType,
41497
+ workspace
41498
+ };
41499
+ }
41500
+ if (coordinatorSetup.kind === "manual") {
41501
+ return {
41502
+ success: false,
41503
+ code: "mesh_coordinator_manual_mcp_setup_required",
41504
+ error: coordinatorSetup.instructions,
41505
+ meshId,
41506
+ cliType,
41507
+ workspace,
41508
+ meshCoordinatorSetup: coordinatorSetup
41509
+ };
41510
+ }
41511
+ if (coordinatorSetup.configFormat !== "claude_mcp_json") {
41512
+ return {
41513
+ success: false,
41514
+ code: "mesh_coordinator_unsupported",
41515
+ error: `Unsupported auto-import MCP config format: ${String(coordinatorSetup.configFormat)}`,
41516
+ meshId,
41517
+ cliType,
41518
+ workspace
41519
+ };
41520
+ }
41355
41521
  const { existsSync: existsSync28, readFileSync: readFileSync21, writeFileSync: writeFileSync15, copyFileSync: copyFileSync4 } = await import("fs");
41356
- const { join: join35 } = await import("path");
41357
- const mcpConfigPath = join35(workspace, ".mcp.json");
41522
+ const mcpConfigPath = coordinatorSetup.configPath;
41358
41523
  const hadExistingMcpConfig = existsSync28(mcpConfigPath);
41359
41524
  let existingMcpConfig = {};
41360
41525
  if (hadExistingMcpConfig) {
@@ -41368,14 +41533,14 @@ var init_router = __esm({
41368
41533
  ...existingMcpConfig,
41369
41534
  mcpServers: {
41370
41535
  ...existingMcpConfig.mcpServers || {},
41371
- "adhdev-mesh": {
41536
+ [coordinatorSetup.serverName]: {
41372
41537
  command: "adhdev-mcp",
41373
41538
  args: ["--repo-mesh", meshId]
41374
41539
  }
41375
41540
  }
41376
41541
  };
41377
41542
  writeFileSync15(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
41378
- LOG.info("MeshCoordinator", `Wrote .mcp.json to ${workspace} with adhdev-mesh server`);
41543
+ LOG.info("MeshCoordinator", `Wrote ${mcpConfigPath} with ${coordinatorSetup.serverName} server`);
41379
41544
  let systemPrompt = "";
41380
41545
  try {
41381
41546
  systemPrompt = buildCoordinatorSystemPrompt2({ mesh });
@@ -64571,7 +64736,7 @@ var require_buffer_list = __commonJS({
64571
64736
  }
64572
64737
  }, {
64573
64738
  key: "join",
64574
- value: function join35(s) {
64739
+ value: function join36(s) {
64575
64740
  if (this.length === 0) return "";
64576
64741
  var p = this.head;
64577
64742
  var ret = "" + p.data;
@@ -80437,9 +80602,9 @@ function resolvePackageVersion(options) {
80437
80602
  const injectedVersion = options?.injectedVersion || "unknown";
80438
80603
  const dir = options?.dirname || __dirname;
80439
80604
  const possiblePaths = [
80440
- (0, import_path4.join)(dir, "..", "..", "package.json"),
80441
- (0, import_path4.join)(dir, "..", "package.json"),
80442
- (0, import_path4.join)(dir, "package.json")
80605
+ (0, import_path5.join)(dir, "..", "..", "package.json"),
80606
+ (0, import_path5.join)(dir, "..", "package.json"),
80607
+ (0, import_path5.join)(dir, "package.json")
80443
80608
  ];
80444
80609
  for (const p of possiblePaths) {
80445
80610
  try {
@@ -80450,12 +80615,12 @@ function resolvePackageVersion(options) {
80450
80615
  }
80451
80616
  return injectedVersion;
80452
80617
  }
80453
- var import_fs8, import_path4;
80618
+ var import_fs8, import_path5;
80454
80619
  var init_version = __esm({
80455
80620
  "src/version.ts"() {
80456
80621
  "use strict";
80457
80622
  import_fs8 = require("fs");
80458
- import_path4 = require("path");
80623
+ import_path5 = require("path");
80459
80624
  }
80460
80625
  });
80461
80626
 
@@ -89892,7 +90057,7 @@ var init_adhdev_daemon = __esm({
89892
90057
  init_version();
89893
90058
  init_src();
89894
90059
  init_runtime_defaults();
89895
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.68" });
90060
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.70" });
89896
90061
  AdhdevDaemon = class _AdhdevDaemon {
89897
90062
  localHttpServer = null;
89898
90063
  localWss = null;