adhdev 0.9.72 → 0.9.74

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
@@ -39925,6 +39925,10 @@ var init_router = __esm({
39925
39925
  READ_DEBUG_ENABLED2 = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
39926
39926
  DaemonCommandRouter = class {
39927
39927
  deps;
39928
+ /** In-memory cache for cloud-originating meshes passed via inlineMesh.
39929
+ * Allows the MCP server to query mesh data via get_mesh even when
39930
+ * the mesh doesn't exist in the local meshes.json file. */
39931
+ inlineMeshCache = /* @__PURE__ */ new Map();
39928
39932
  constructor(deps) {
39929
39933
  this.deps = deps;
39930
39934
  }
@@ -40573,11 +40577,12 @@ var init_router = __esm({
40573
40577
  try {
40574
40578
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40575
40579
  const mesh = getMesh3(meshId);
40576
- if (!mesh) return { success: false, error: "Mesh not found" };
40577
- return { success: true, mesh };
40578
- } catch (e) {
40579
- return { success: false, error: e.message };
40580
+ if (mesh) return { success: true, mesh };
40581
+ } catch {
40580
40582
  }
40583
+ const cached2 = this.inlineMeshCache.get(meshId);
40584
+ if (cached2) return { success: true, mesh: cached2 };
40585
+ return { success: false, error: "Mesh not found" };
40581
40586
  }
40582
40587
  case "create_mesh": {
40583
40588
  const name = typeof args?.name === "string" ? args.name.trim() : "";
@@ -40640,13 +40645,27 @@ var init_router = __esm({
40640
40645
  let mesh;
40641
40646
  if (args?.inlineMesh && typeof args.inlineMesh === "object") {
40642
40647
  mesh = args.inlineMesh;
40648
+ this.inlineMeshCache.set(meshId, mesh);
40643
40649
  } else {
40644
40650
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40645
40651
  mesh = getMesh3(meshId);
40646
40652
  }
40647
40653
  if (!mesh) return { success: false, error: "Mesh not found" };
40648
40654
  if (!Array.isArray(mesh.nodes) || mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
40649
- const workspace = mesh.nodes[0].workspace;
40655
+ const requestedCoordinatorNodeId = typeof args?.coordinatorNodeId === "string" ? args.coordinatorNodeId.trim() : "";
40656
+ const preferredCoordinatorNodeId = requestedCoordinatorNodeId || (typeof mesh.coordinator?.preferredNodeId === "string" ? mesh.coordinator.preferredNodeId.trim() : "");
40657
+ const coordinatorNode = preferredCoordinatorNodeId ? mesh.nodes.find((node) => node?.id === preferredCoordinatorNodeId || node?.nodeId === preferredCoordinatorNodeId) : mesh.nodes[0];
40658
+ if (!coordinatorNode) {
40659
+ return {
40660
+ success: false,
40661
+ code: "mesh_coordinator_node_not_found",
40662
+ error: `Coordinator node ${preferredCoordinatorNodeId} was not found in mesh`,
40663
+ meshId,
40664
+ cliType
40665
+ };
40666
+ }
40667
+ const workspace = typeof coordinatorNode.workspace === "string" ? coordinatorNode.workspace.trim() : "";
40668
+ if (!workspace) return { success: false, error: "Coordinator node workspace required", meshId, cliType };
40650
40669
  const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
40651
40670
  const coordinatorSetup = resolveMeshCoordinatorSetup({
40652
40671
  provider: providerMeta,
@@ -59097,7 +59116,7 @@ var init_adhdev_daemon = __esm({
59097
59116
  init_version();
59098
59117
  init_src();
59099
59118
  init_runtime_defaults();
59100
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.72" });
59119
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.74" });
59101
59120
  AdhdevDaemon = class _AdhdevDaemon {
59102
59121
  localHttpServer = null;
59103
59122
  localWss = null;