@adhdev/daemon-core 0.9.82-rc.18 → 0.9.82-rc.19

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.
@@ -87,6 +87,7 @@ export declare class DaemonCommandRouter {
87
87
  private inlineMeshCache;
88
88
  constructor(deps: CommandRouterDeps);
89
89
  getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined;
90
+ private warmInlineMeshCache;
90
91
  private getMeshForCommand;
91
92
  private updateInlineMeshNode;
92
93
  private removeInlineMeshNode;
package/dist/index.js CHANGED
@@ -24552,25 +24552,35 @@ var DaemonCommandRouter = class {
24552
24552
  }
24553
24553
  getCachedInlineMesh(meshId, inlineMesh) {
24554
24554
  if (inlineMesh && typeof inlineMesh === "object") {
24555
- this.inlineMeshCache.set(meshId, inlineMesh);
24556
- return inlineMesh;
24555
+ return this.warmInlineMeshCache(meshId, inlineMesh);
24557
24556
  }
24558
24557
  return this.inlineMeshCache.get(meshId);
24559
24558
  }
24559
+ warmInlineMeshCache(meshId, inlineMesh) {
24560
+ if (!inlineMesh || typeof inlineMesh !== "object") return void 0;
24561
+ const cached = this.inlineMeshCache.get(meshId);
24562
+ if (cached) return cached;
24563
+ this.inlineMeshCache.set(meshId, inlineMesh);
24564
+ return inlineMesh;
24565
+ }
24560
24566
  async getMeshForCommand(meshId, inlineMesh, options) {
24561
24567
  const preferInline = options?.preferInline === true;
24562
24568
  if (preferInline) {
24563
- const cached2 = this.getCachedInlineMesh(meshId, inlineMesh);
24564
- if (cached2) return { mesh: cached2, inline: true };
24569
+ const cached2 = this.getCachedInlineMesh(meshId);
24570
+ if (cached2) return { mesh: cached2, inline: true, source: "inline_cache" };
24571
+ const warmedInline2 = this.warmInlineMeshCache(meshId, inlineMesh);
24572
+ if (warmedInline2) return { mesh: warmedInline2, inline: true, source: "inline_bootstrap" };
24565
24573
  }
24566
24574
  try {
24567
24575
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
24568
24576
  const mesh = getMesh3(meshId);
24569
- if (mesh) return { mesh, inline: false };
24577
+ if (mesh) return { mesh, inline: false, source: "local_config" };
24570
24578
  } catch {
24571
24579
  }
24572
- const cached = this.getCachedInlineMesh(meshId, inlineMesh);
24573
- return cached ? { mesh: cached, inline: true } : null;
24580
+ const cached = this.getCachedInlineMesh(meshId);
24581
+ if (cached) return { mesh: cached, inline: true, source: "inline_cache" };
24582
+ const warmedInline = this.warmInlineMeshCache(meshId, inlineMesh);
24583
+ return warmedInline ? { mesh: warmedInline, inline: true, source: "inline_bootstrap" } : null;
24574
24584
  }
24575
24585
  updateInlineMeshNode(meshId, mesh, node) {
24576
24586
  if (!mesh || !Array.isArray(mesh.nodes) || !node?.id) return;
@@ -24799,6 +24809,7 @@ var DaemonCommandRouter = class {
24799
24809
  const deletedSessionIds = [];
24800
24810
  const skippedSessionIds = [];
24801
24811
  const skippedLiveSessionIds = [];
24812
+ const skippedCoordinatorSessionIds = [];
24802
24813
  const deleteUnsupportedSessionIds = [];
24803
24814
  const recordsRemainSessionIds = [];
24804
24815
  const errors = [];
@@ -24831,6 +24842,12 @@ var DaemonCommandRouter = class {
24831
24842
  const completed = this.isCompletedHostedSession(record);
24832
24843
  const surfaceKind = getSessionHostSurfaceKind(record);
24833
24844
  const liveRuntime = surfaceKind === "live_runtime";
24845
+ const coordinatorSession = readStringValue(record?.meta?.meshCoordinatorFor) === args.meshId;
24846
+ if (!hasExplicitSessionIds && coordinatorSession) {
24847
+ skippedSessionIds.push(sessionId);
24848
+ skippedCoordinatorSessionIds.push(sessionId);
24849
+ continue;
24850
+ }
24834
24851
  if (!hasExplicitSessionIds && liveRuntime) {
24835
24852
  skippedSessionIds.push(sessionId);
24836
24853
  skippedLiveSessionIds.push(sessionId);
@@ -24896,6 +24913,7 @@ var DaemonCommandRouter = class {
24896
24913
  deletedSessionIds,
24897
24914
  skippedSessionIds,
24898
24915
  skippedLiveSessionIds,
24916
+ skippedCoordinatorSessionIds,
24899
24917
  ...deleteUnsupported ? {
24900
24918
  deleteUnsupported: true,
24901
24919
  effectiveCleanup: args.mode === "stop_and_delete" ? "stopped_only_records_remain" : "delete_unsupported_records_remain",
@@ -26518,6 +26536,11 @@ ${block}`);
26518
26536
  repoIdentity: mesh.repoIdentity,
26519
26537
  defaultBranch: mesh.defaultBranch,
26520
26538
  refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
26539
+ sourceOfTruth: {
26540
+ membership: meshRecord?.source === "inline_cache" ? "coordinator_inline_mesh_cache" : meshRecord?.source === "local_config" ? "local_mesh_config" : "inline_bootstrap_snapshot",
26541
+ coordinatorOwnsLiveTruth: meshRecord?.source !== "inline_bootstrap",
26542
+ historicalEvidenceOnly: ["recoveryHints", "ledger.summary", "queue.summary"]
26543
+ },
26521
26544
  nodes: nodeStatuses,
26522
26545
  queue: { tasks: queue, summary: queueSummary },
26523
26546
  ledger: { entries: ledgerEntries, summary: ledgerSummary }