@adhdev/daemon-core 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.mjs CHANGED
@@ -20673,6 +20673,10 @@ function summarizeSessionHostPruneResult(result) {
20673
20673
  }
20674
20674
  var DaemonCommandRouter = class {
20675
20675
  deps;
20676
+ /** In-memory cache for cloud-originating meshes passed via inlineMesh.
20677
+ * Allows the MCP server to query mesh data via get_mesh even when
20678
+ * the mesh doesn't exist in the local meshes.json file. */
20679
+ inlineMeshCache = /* @__PURE__ */ new Map();
20676
20680
  constructor(deps) {
20677
20681
  this.deps = deps;
20678
20682
  }
@@ -21321,11 +21325,12 @@ var DaemonCommandRouter = class {
21321
21325
  try {
21322
21326
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
21323
21327
  const mesh = getMesh3(meshId);
21324
- if (!mesh) return { success: false, error: "Mesh not found" };
21325
- return { success: true, mesh };
21326
- } catch (e) {
21327
- return { success: false, error: e.message };
21328
+ if (mesh) return { success: true, mesh };
21329
+ } catch {
21328
21330
  }
21331
+ const cached = this.inlineMeshCache.get(meshId);
21332
+ if (cached) return { success: true, mesh: cached };
21333
+ return { success: false, error: "Mesh not found" };
21329
21334
  }
21330
21335
  case "create_mesh": {
21331
21336
  const name = typeof args?.name === "string" ? args.name.trim() : "";
@@ -21388,13 +21393,27 @@ var DaemonCommandRouter = class {
21388
21393
  let mesh;
21389
21394
  if (args?.inlineMesh && typeof args.inlineMesh === "object") {
21390
21395
  mesh = args.inlineMesh;
21396
+ this.inlineMeshCache.set(meshId, mesh);
21391
21397
  } else {
21392
21398
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
21393
21399
  mesh = getMesh3(meshId);
21394
21400
  }
21395
21401
  if (!mesh) return { success: false, error: "Mesh not found" };
21396
21402
  if (!Array.isArray(mesh.nodes) || mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
21397
- const workspace = mesh.nodes[0].workspace;
21403
+ const requestedCoordinatorNodeId = typeof args?.coordinatorNodeId === "string" ? args.coordinatorNodeId.trim() : "";
21404
+ const preferredCoordinatorNodeId = requestedCoordinatorNodeId || (typeof mesh.coordinator?.preferredNodeId === "string" ? mesh.coordinator.preferredNodeId.trim() : "");
21405
+ const coordinatorNode = preferredCoordinatorNodeId ? mesh.nodes.find((node) => node?.id === preferredCoordinatorNodeId || node?.nodeId === preferredCoordinatorNodeId) : mesh.nodes[0];
21406
+ if (!coordinatorNode) {
21407
+ return {
21408
+ success: false,
21409
+ code: "mesh_coordinator_node_not_found",
21410
+ error: `Coordinator node ${preferredCoordinatorNodeId} was not found in mesh`,
21411
+ meshId,
21412
+ cliType
21413
+ };
21414
+ }
21415
+ const workspace = typeof coordinatorNode.workspace === "string" ? coordinatorNode.workspace.trim() : "";
21416
+ if (!workspace) return { success: false, error: "Coordinator node workspace required", meshId, cliType };
21398
21417
  const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
21399
21418
  const coordinatorSetup = resolveMeshCoordinatorSetup({
21400
21419
  provider: providerMeta,