@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.
@@ -76,6 +76,10 @@ export interface CommandRouterResult {
76
76
  }
77
77
  export declare class DaemonCommandRouter {
78
78
  private deps;
79
+ /** In-memory cache for cloud-originating meshes passed via inlineMesh.
80
+ * Allows the MCP server to query mesh data via get_mesh even when
81
+ * the mesh doesn't exist in the local meshes.json file. */
82
+ private inlineMeshCache;
79
83
  constructor(deps: CommandRouterDeps);
80
84
  private traceSessionHostAction;
81
85
  /**
package/dist/index.js CHANGED
@@ -20860,6 +20860,10 @@ function summarizeSessionHostPruneResult(result) {
20860
20860
  }
20861
20861
  var DaemonCommandRouter = class {
20862
20862
  deps;
20863
+ /** In-memory cache for cloud-originating meshes passed via inlineMesh.
20864
+ * Allows the MCP server to query mesh data via get_mesh even when
20865
+ * the mesh doesn't exist in the local meshes.json file. */
20866
+ inlineMeshCache = /* @__PURE__ */ new Map();
20863
20867
  constructor(deps) {
20864
20868
  this.deps = deps;
20865
20869
  }
@@ -21508,11 +21512,12 @@ var DaemonCommandRouter = class {
21508
21512
  try {
21509
21513
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
21510
21514
  const mesh = getMesh3(meshId);
21511
- if (!mesh) return { success: false, error: "Mesh not found" };
21512
- return { success: true, mesh };
21513
- } catch (e) {
21514
- return { success: false, error: e.message };
21515
+ if (mesh) return { success: true, mesh };
21516
+ } catch {
21515
21517
  }
21518
+ const cached = this.inlineMeshCache.get(meshId);
21519
+ if (cached) return { success: true, mesh: cached };
21520
+ return { success: false, error: "Mesh not found" };
21516
21521
  }
21517
21522
  case "create_mesh": {
21518
21523
  const name = typeof args?.name === "string" ? args.name.trim() : "";
@@ -21575,13 +21580,27 @@ var DaemonCommandRouter = class {
21575
21580
  let mesh;
21576
21581
  if (args?.inlineMesh && typeof args.inlineMesh === "object") {
21577
21582
  mesh = args.inlineMesh;
21583
+ this.inlineMeshCache.set(meshId, mesh);
21578
21584
  } else {
21579
21585
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
21580
21586
  mesh = getMesh3(meshId);
21581
21587
  }
21582
21588
  if (!mesh) return { success: false, error: "Mesh not found" };
21583
21589
  if (!Array.isArray(mesh.nodes) || mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
21584
- const workspace = mesh.nodes[0].workspace;
21590
+ const requestedCoordinatorNodeId = typeof args?.coordinatorNodeId === "string" ? args.coordinatorNodeId.trim() : "";
21591
+ const preferredCoordinatorNodeId = requestedCoordinatorNodeId || (typeof mesh.coordinator?.preferredNodeId === "string" ? mesh.coordinator.preferredNodeId.trim() : "");
21592
+ const coordinatorNode = preferredCoordinatorNodeId ? mesh.nodes.find((node) => node?.id === preferredCoordinatorNodeId || node?.nodeId === preferredCoordinatorNodeId) : mesh.nodes[0];
21593
+ if (!coordinatorNode) {
21594
+ return {
21595
+ success: false,
21596
+ code: "mesh_coordinator_node_not_found",
21597
+ error: `Coordinator node ${preferredCoordinatorNodeId} was not found in mesh`,
21598
+ meshId,
21599
+ cliType
21600
+ };
21601
+ }
21602
+ const workspace = typeof coordinatorNode.workspace === "string" ? coordinatorNode.workspace.trim() : "";
21603
+ if (!workspace) return { success: false, error: "Coordinator node workspace required", meshId, cliType };
21585
21604
  const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
21586
21605
  const coordinatorSetup = resolveMeshCoordinatorSetup({
21587
21606
  provider: providerMeta,