@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.
package/dist/index.mjs CHANGED
@@ -24319,25 +24319,35 @@ var DaemonCommandRouter = class {
24319
24319
  }
24320
24320
  getCachedInlineMesh(meshId, inlineMesh) {
24321
24321
  if (inlineMesh && typeof inlineMesh === "object") {
24322
- this.inlineMeshCache.set(meshId, inlineMesh);
24323
- return inlineMesh;
24322
+ return this.warmInlineMeshCache(meshId, inlineMesh);
24324
24323
  }
24325
24324
  return this.inlineMeshCache.get(meshId);
24326
24325
  }
24326
+ warmInlineMeshCache(meshId, inlineMesh) {
24327
+ if (!inlineMesh || typeof inlineMesh !== "object") return void 0;
24328
+ const cached = this.inlineMeshCache.get(meshId);
24329
+ if (cached) return cached;
24330
+ this.inlineMeshCache.set(meshId, inlineMesh);
24331
+ return inlineMesh;
24332
+ }
24327
24333
  async getMeshForCommand(meshId, inlineMesh, options) {
24328
24334
  const preferInline = options?.preferInline === true;
24329
24335
  if (preferInline) {
24330
- const cached2 = this.getCachedInlineMesh(meshId, inlineMesh);
24331
- if (cached2) return { mesh: cached2, inline: true };
24336
+ const cached2 = this.getCachedInlineMesh(meshId);
24337
+ if (cached2) return { mesh: cached2, inline: true, source: "inline_cache" };
24338
+ const warmedInline2 = this.warmInlineMeshCache(meshId, inlineMesh);
24339
+ if (warmedInline2) return { mesh: warmedInline2, inline: true, source: "inline_bootstrap" };
24332
24340
  }
24333
24341
  try {
24334
24342
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
24335
24343
  const mesh = getMesh3(meshId);
24336
- if (mesh) return { mesh, inline: false };
24344
+ if (mesh) return { mesh, inline: false, source: "local_config" };
24337
24345
  } catch {
24338
24346
  }
24339
- const cached = this.getCachedInlineMesh(meshId, inlineMesh);
24340
- return cached ? { mesh: cached, inline: true } : null;
24347
+ const cached = this.getCachedInlineMesh(meshId);
24348
+ if (cached) return { mesh: cached, inline: true, source: "inline_cache" };
24349
+ const warmedInline = this.warmInlineMeshCache(meshId, inlineMesh);
24350
+ return warmedInline ? { mesh: warmedInline, inline: true, source: "inline_bootstrap" } : null;
24341
24351
  }
24342
24352
  updateInlineMeshNode(meshId, mesh, node) {
24343
24353
  if (!mesh || !Array.isArray(mesh.nodes) || !node?.id) return;
@@ -24566,6 +24576,7 @@ var DaemonCommandRouter = class {
24566
24576
  const deletedSessionIds = [];
24567
24577
  const skippedSessionIds = [];
24568
24578
  const skippedLiveSessionIds = [];
24579
+ const skippedCoordinatorSessionIds = [];
24569
24580
  const deleteUnsupportedSessionIds = [];
24570
24581
  const recordsRemainSessionIds = [];
24571
24582
  const errors = [];
@@ -24598,6 +24609,12 @@ var DaemonCommandRouter = class {
24598
24609
  const completed = this.isCompletedHostedSession(record);
24599
24610
  const surfaceKind = getSessionHostSurfaceKind(record);
24600
24611
  const liveRuntime = surfaceKind === "live_runtime";
24612
+ const coordinatorSession = readStringValue(record?.meta?.meshCoordinatorFor) === args.meshId;
24613
+ if (!hasExplicitSessionIds && coordinatorSession) {
24614
+ skippedSessionIds.push(sessionId);
24615
+ skippedCoordinatorSessionIds.push(sessionId);
24616
+ continue;
24617
+ }
24601
24618
  if (!hasExplicitSessionIds && liveRuntime) {
24602
24619
  skippedSessionIds.push(sessionId);
24603
24620
  skippedLiveSessionIds.push(sessionId);
@@ -24663,6 +24680,7 @@ var DaemonCommandRouter = class {
24663
24680
  deletedSessionIds,
24664
24681
  skippedSessionIds,
24665
24682
  skippedLiveSessionIds,
24683
+ skippedCoordinatorSessionIds,
24666
24684
  ...deleteUnsupported ? {
24667
24685
  deleteUnsupported: true,
24668
24686
  effectiveCleanup: args.mode === "stop_and_delete" ? "stopped_only_records_remain" : "delete_unsupported_records_remain",
@@ -26285,6 +26303,11 @@ ${block}`);
26285
26303
  repoIdentity: mesh.repoIdentity,
26286
26304
  defaultBranch: mesh.defaultBranch,
26287
26305
  refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
26306
+ sourceOfTruth: {
26307
+ membership: meshRecord?.source === "inline_cache" ? "coordinator_inline_mesh_cache" : meshRecord?.source === "local_config" ? "local_mesh_config" : "inline_bootstrap_snapshot",
26308
+ coordinatorOwnsLiveTruth: meshRecord?.source !== "inline_bootstrap",
26309
+ historicalEvidenceOnly: ["recoveryHints", "ledger.summary", "queue.summary"]
26310
+ },
26288
26311
  nodes: nodeStatuses,
26289
26312
  queue: { tasks: queue, summary: queueSummary },
26290
26313
  ledger: { entries: ledgerEntries, summary: ledgerSummary }