@adhdev/daemon-standalone 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
@@ -48563,6 +48563,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
48563
48563
  }
48564
48564
  var DaemonCommandRouter = class {
48565
48565
  deps;
48566
+ /** In-memory cache for cloud-originating meshes passed via inlineMesh.
48567
+ * Allows the MCP server to query mesh data via get_mesh even when
48568
+ * the mesh doesn't exist in the local meshes.json file. */
48569
+ inlineMeshCache = /* @__PURE__ */ new Map();
48566
48570
  constructor(deps) {
48567
48571
  this.deps = deps;
48568
48572
  }
@@ -49211,11 +49215,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
49211
49215
  try {
49212
49216
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
49213
49217
  const mesh = getMesh3(meshId);
49214
- if (!mesh) return { success: false, error: "Mesh not found" };
49215
- return { success: true, mesh };
49216
- } catch (e) {
49217
- return { success: false, error: e.message };
49218
+ if (mesh) return { success: true, mesh };
49219
+ } catch {
49218
49220
  }
49221
+ const cached2 = this.inlineMeshCache.get(meshId);
49222
+ if (cached2) return { success: true, mesh: cached2 };
49223
+ return { success: false, error: "Mesh not found" };
49219
49224
  }
49220
49225
  case "create_mesh": {
49221
49226
  const name = typeof args?.name === "string" ? args.name.trim() : "";
@@ -49278,13 +49283,27 @@ Run 'adhdev doctor' for detailed diagnostics.`
49278
49283
  let mesh;
49279
49284
  if (args?.inlineMesh && typeof args.inlineMesh === "object") {
49280
49285
  mesh = args.inlineMesh;
49286
+ this.inlineMeshCache.set(meshId, mesh);
49281
49287
  } else {
49282
49288
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
49283
49289
  mesh = getMesh3(meshId);
49284
49290
  }
49285
49291
  if (!mesh) return { success: false, error: "Mesh not found" };
49286
49292
  if (!Array.isArray(mesh.nodes) || mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
49287
- const workspace = mesh.nodes[0].workspace;
49293
+ const requestedCoordinatorNodeId = typeof args?.coordinatorNodeId === "string" ? args.coordinatorNodeId.trim() : "";
49294
+ const preferredCoordinatorNodeId = requestedCoordinatorNodeId || (typeof mesh.coordinator?.preferredNodeId === "string" ? mesh.coordinator.preferredNodeId.trim() : "");
49295
+ const coordinatorNode = preferredCoordinatorNodeId ? mesh.nodes.find((node) => node?.id === preferredCoordinatorNodeId || node?.nodeId === preferredCoordinatorNodeId) : mesh.nodes[0];
49296
+ if (!coordinatorNode) {
49297
+ return {
49298
+ success: false,
49299
+ code: "mesh_coordinator_node_not_found",
49300
+ error: `Coordinator node ${preferredCoordinatorNodeId} was not found in mesh`,
49301
+ meshId,
49302
+ cliType
49303
+ };
49304
+ }
49305
+ const workspace = typeof coordinatorNode.workspace === "string" ? coordinatorNode.workspace.trim() : "";
49306
+ if (!workspace) return { success: false, error: "Coordinator node workspace required", meshId, cliType };
49288
49307
  const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
49289
49308
  const coordinatorSetup = resolveMeshCoordinatorSetup({
49290
49309
  provider: providerMeta,