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/index.js CHANGED
@@ -36547,6 +36547,7 @@ function validateProviderDefinition(raw) {
36547
36547
  }
36548
36548
  validateCapabilities(provider, controls, errors);
36549
36549
  validateCanonicalHistory(provider.canonicalHistory, errors);
36550
+ validateMeshCoordinator(provider.meshCoordinator, errors);
36550
36551
  for (const control of controls) {
36551
36552
  validateControl(control, errors);
36552
36553
  }
@@ -36637,6 +36638,60 @@ function validateCanonicalHistory(raw, errors) {
36637
36638
  }
36638
36639
  }
36639
36640
  }
36641
+ function validateMeshCoordinator(raw, errors) {
36642
+ if (raw === void 0) return;
36643
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
36644
+ errors.push("meshCoordinator must be an object");
36645
+ return;
36646
+ }
36647
+ const meshCoordinator = raw;
36648
+ if (typeof meshCoordinator.supported !== "boolean") {
36649
+ errors.push("meshCoordinator.supported must be boolean");
36650
+ }
36651
+ if (meshCoordinator.reason !== void 0 && (typeof meshCoordinator.reason !== "string" || !meshCoordinator.reason.trim())) {
36652
+ errors.push("meshCoordinator.reason must be a non-empty string when provided");
36653
+ }
36654
+ const mcpConfig = meshCoordinator.mcpConfig;
36655
+ if (mcpConfig === void 0) return;
36656
+ if (!mcpConfig || typeof mcpConfig !== "object" || Array.isArray(mcpConfig)) {
36657
+ errors.push("meshCoordinator.mcpConfig must be an object");
36658
+ return;
36659
+ }
36660
+ const config2 = mcpConfig;
36661
+ const mode = config2.mode;
36662
+ if (!["auto_import", "manual", "none"].includes(String(mode))) {
36663
+ errors.push("meshCoordinator.mcpConfig.mode must be one of: auto_import, manual, none");
36664
+ }
36665
+ const format = config2.format;
36666
+ if (format !== void 0 && !["claude_mcp_json", "hermes_config_yaml"].includes(String(format))) {
36667
+ errors.push("meshCoordinator.mcpConfig.format must be one of: claude_mcp_json, hermes_config_yaml");
36668
+ }
36669
+ for (const key of ["path", "serverName", "configPathCommand", "instructions", "template"]) {
36670
+ const value = config2[key];
36671
+ if (value !== void 0 && (typeof value !== "string" || !value.trim())) {
36672
+ errors.push(`meshCoordinator.mcpConfig.${key} must be a non-empty string when provided`);
36673
+ }
36674
+ }
36675
+ if (config2.requiresRestart !== void 0 && typeof config2.requiresRestart !== "boolean") {
36676
+ errors.push("meshCoordinator.mcpConfig.requiresRestart must be boolean when provided");
36677
+ }
36678
+ if (mode === "auto_import") {
36679
+ if (format === void 0) {
36680
+ errors.push("meshCoordinator.mcpConfig.format is required for auto_import MCP setup");
36681
+ }
36682
+ if (typeof config2.path !== "string" || !config2.path.trim()) {
36683
+ errors.push("meshCoordinator.mcpConfig.path is required for auto_import MCP setup");
36684
+ }
36685
+ }
36686
+ if (mode === "manual") {
36687
+ if (typeof config2.instructions !== "string" || !config2.instructions.trim()) {
36688
+ errors.push("meshCoordinator.mcpConfig.instructions is required for manual MCP setup");
36689
+ }
36690
+ if (typeof config2.template !== "string" || !config2.template.trim()) {
36691
+ errors.push("meshCoordinator.mcpConfig.template is required for manual MCP setup");
36692
+ }
36693
+ }
36694
+ }
36640
36695
  function validateControl(control, errors) {
36641
36696
  if (!control || typeof control !== "object") {
36642
36697
  errors.push("controls: each control must be an object");
@@ -36678,6 +36733,8 @@ var init_provider_schema = __esm({
36678
36733
  "type",
36679
36734
  "name",
36680
36735
  "category",
36736
+ "transcriptAuthority",
36737
+ "transcriptContext",
36681
36738
  "aliases",
36682
36739
  "cdpPorts",
36683
36740
  "targetFilter",
@@ -36722,6 +36779,7 @@ var init_provider_schema = __esm({
36722
36779
  "staticConfigOptions",
36723
36780
  "spawnArgBuilder",
36724
36781
  "auth",
36782
+ "meshCoordinator",
36725
36783
  "contractVersion",
36726
36784
  "capabilities",
36727
36785
  "providerVersion",
@@ -38891,6 +38949,75 @@ var init_command_log = __esm({
38891
38949
  }
38892
38950
  });
38893
38951
 
38952
+ // ../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts
38953
+ function resolveMeshCoordinatorSetup(options) {
38954
+ const { provider, meshId, workspace } = options;
38955
+ const config2 = provider?.meshCoordinator;
38956
+ if (!config2?.supported) {
38957
+ return {
38958
+ kind: "unsupported",
38959
+ reason: config2?.reason || "Provider does not declare Repo Mesh coordinator support"
38960
+ };
38961
+ }
38962
+ const mcpConfig = config2.mcpConfig;
38963
+ if (!mcpConfig || mcpConfig.mode === "none") {
38964
+ return {
38965
+ kind: "unsupported",
38966
+ reason: config2.reason || "Provider does not declare a usable Repo Mesh MCP configuration mode"
38967
+ };
38968
+ }
38969
+ const serverName = mcpConfig.serverName?.trim() || DEFAULT_SERVER_NAME;
38970
+ if (mcpConfig.mode === "auto_import") {
38971
+ const path33 = mcpConfig.path?.trim();
38972
+ if (!path33) {
38973
+ return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
38974
+ }
38975
+ return {
38976
+ kind: "auto_import",
38977
+ serverName,
38978
+ configPath: (0, import_path4.join)(workspace, path33),
38979
+ configFormat: mcpConfig.format
38980
+ };
38981
+ }
38982
+ if (mcpConfig.mode === "manual") {
38983
+ const instructions = mcpConfig.instructions?.trim();
38984
+ const template = mcpConfig.template;
38985
+ if (!instructions || !template?.trim()) {
38986
+ return { kind: "unsupported", reason: "Provider manual MCP setup is missing instructions or template" };
38987
+ }
38988
+ return {
38989
+ kind: "manual",
38990
+ serverName,
38991
+ configFormat: mcpConfig.format,
38992
+ configPathCommand: mcpConfig.configPathCommand,
38993
+ requiresRestart: mcpConfig.requiresRestart === true,
38994
+ instructions,
38995
+ template: renderMeshCoordinatorTemplate(template, {
38996
+ meshId,
38997
+ workspace,
38998
+ serverName,
38999
+ adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
39000
+ })
39001
+ };
39002
+ }
39003
+ return {
39004
+ kind: "unsupported",
39005
+ reason: `Unsupported Repo Mesh MCP configuration mode: ${String(mcpConfig.mode)}`
39006
+ };
39007
+ }
39008
+ function renderMeshCoordinatorTemplate(template, values) {
39009
+ return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand)\s*\}\}/g, (_2, key) => values[key] || "");
39010
+ }
39011
+ var import_path4, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
39012
+ var init_mesh_coordinator = __esm({
39013
+ "../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts"() {
39014
+ "use strict";
39015
+ import_path4 = require("path");
39016
+ DEFAULT_SERVER_NAME = "adhdev-mesh";
39017
+ DEFAULT_ADHDEV_MCP_COMMAND = "adhdev-mcp";
39018
+ }
39019
+ });
39020
+
38894
39021
  // ../../oss/packages/daemon-core/src/status/snapshot.ts
38895
39022
  function buildRecentReadDebugSignature(snapshot) {
38896
39023
  return [
@@ -38936,7 +39063,8 @@ function buildAvailableProviders(providerLoader) {
38936
39063
  ...provider.enabled !== void 0 ? { enabled: provider.enabled } : {},
38937
39064
  ...provider.machineStatus !== void 0 ? { machineStatus: provider.machineStatus } : {},
38938
39065
  ...provider.lastDetection !== void 0 ? { lastDetection: provider.lastDetection } : {},
38939
- ...provider.lastVerification !== void 0 ? { lastVerification: provider.lastVerification } : {}
39066
+ ...provider.lastVerification !== void 0 ? { lastVerification: provider.lastVerification } : {},
39067
+ ...provider.meshCoordinator !== void 0 ? { meshCoordinator: provider.meshCoordinator } : {}
38940
39068
  }));
38941
39069
  }
38942
39070
  function buildMachineInfo(profile = "full") {
@@ -39663,6 +39791,7 @@ var init_router = __esm({
39663
39791
  init_logger();
39664
39792
  init_debug_trace();
39665
39793
  init_runtime_surface();
39794
+ init_mesh_coordinator();
39666
39795
  init_builders();
39667
39796
  init_snapshot();
39668
39797
  init_snapshot();
@@ -40395,9 +40524,45 @@ var init_router = __esm({
40395
40524
  if (!mesh) return { success: false, error: "Mesh not found" };
40396
40525
  if (mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
40397
40526
  const workspace = mesh.nodes[0].workspace;
40527
+ const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
40528
+ const coordinatorSetup = resolveMeshCoordinatorSetup({
40529
+ provider: providerMeta,
40530
+ meshId,
40531
+ workspace
40532
+ });
40533
+ if (coordinatorSetup.kind === "unsupported") {
40534
+ return {
40535
+ success: false,
40536
+ code: "mesh_coordinator_unsupported",
40537
+ error: coordinatorSetup.reason,
40538
+ meshId,
40539
+ cliType,
40540
+ workspace
40541
+ };
40542
+ }
40543
+ if (coordinatorSetup.kind === "manual") {
40544
+ return {
40545
+ success: false,
40546
+ code: "mesh_coordinator_manual_mcp_setup_required",
40547
+ error: coordinatorSetup.instructions,
40548
+ meshId,
40549
+ cliType,
40550
+ workspace,
40551
+ meshCoordinatorSetup: coordinatorSetup
40552
+ };
40553
+ }
40554
+ if (coordinatorSetup.configFormat !== "claude_mcp_json") {
40555
+ return {
40556
+ success: false,
40557
+ code: "mesh_coordinator_unsupported",
40558
+ error: `Unsupported auto-import MCP config format: ${String(coordinatorSetup.configFormat)}`,
40559
+ meshId,
40560
+ cliType,
40561
+ workspace
40562
+ };
40563
+ }
40398
40564
  const { existsSync: existsSync25, readFileSync: readFileSync20, writeFileSync: writeFileSync14, copyFileSync: copyFileSync4 } = await import("fs");
40399
- const { join: join32 } = await import("path");
40400
- const mcpConfigPath = join32(workspace, ".mcp.json");
40565
+ const mcpConfigPath = coordinatorSetup.configPath;
40401
40566
  const hadExistingMcpConfig = existsSync25(mcpConfigPath);
40402
40567
  let existingMcpConfig = {};
40403
40568
  if (hadExistingMcpConfig) {
@@ -40411,14 +40576,14 @@ var init_router = __esm({
40411
40576
  ...existingMcpConfig,
40412
40577
  mcpServers: {
40413
40578
  ...existingMcpConfig.mcpServers || {},
40414
- "adhdev-mesh": {
40579
+ [coordinatorSetup.serverName]: {
40415
40580
  command: "adhdev-mcp",
40416
40581
  args: ["--repo-mesh", meshId]
40417
40582
  }
40418
40583
  }
40419
40584
  };
40420
40585
  writeFileSync14(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
40421
- LOG.info("MeshCoordinator", `Wrote .mcp.json to ${workspace} with adhdev-mesh server`);
40586
+ LOG.info("MeshCoordinator", `Wrote ${mcpConfigPath} with ${coordinatorSetup.serverName} server`);
40422
40587
  let systemPrompt = "";
40423
40588
  try {
40424
40589
  systemPrompt = buildCoordinatorSystemPrompt2({ mesh });
@@ -58403,9 +58568,9 @@ function resolvePackageVersion(options) {
58403
58568
  const injectedVersion = options?.injectedVersion || "unknown";
58404
58569
  const dir = options?.dirname || __dirname;
58405
58570
  const possiblePaths = [
58406
- (0, import_path4.join)(dir, "..", "..", "package.json"),
58407
- (0, import_path4.join)(dir, "..", "package.json"),
58408
- (0, import_path4.join)(dir, "package.json")
58571
+ (0, import_path5.join)(dir, "..", "..", "package.json"),
58572
+ (0, import_path5.join)(dir, "..", "package.json"),
58573
+ (0, import_path5.join)(dir, "package.json")
58409
58574
  ];
58410
58575
  for (const p of possiblePaths) {
58411
58576
  try {
@@ -58416,12 +58581,12 @@ function resolvePackageVersion(options) {
58416
58581
  }
58417
58582
  return injectedVersion;
58418
58583
  }
58419
- var import_fs7, import_path4;
58584
+ var import_fs7, import_path5;
58420
58585
  var init_version = __esm({
58421
58586
  "src/version.ts"() {
58422
58587
  "use strict";
58423
58588
  import_fs7 = require("fs");
58424
- import_path4 = require("path");
58589
+ import_path5 = require("path");
58425
58590
  }
58426
58591
  });
58427
58592
 
@@ -58750,7 +58915,7 @@ var init_adhdev_daemon = __esm({
58750
58915
  init_version();
58751
58916
  init_src();
58752
58917
  init_runtime_defaults();
58753
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.68" });
58918
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.70" });
58754
58919
  AdhdevDaemon = class _AdhdevDaemon {
58755
58920
  localHttpServer = null;
58756
58921
  localWss = null;
@@ -74618,7 +74783,7 @@ var require_buffer_list = __commonJS({
74618
74783
  }
74619
74784
  }, {
74620
74785
  key: "join",
74621
- value: function join32(s) {
74786
+ value: function join33(s) {
74622
74787
  if (this.length === 0) return "";
74623
74788
  var p = this.head;
74624
74789
  var ret = "" + p.data;