@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.82-rc.18",
3
+ "version": "0.9.82-rc.19",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -953,29 +953,40 @@ export class DaemonCommandRouter {
953
953
 
954
954
  public getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined {
955
955
  if (inlineMesh && typeof inlineMesh === 'object') {
956
- this.inlineMeshCache.set(meshId, inlineMesh as any);
957
- return inlineMesh as any;
956
+ return this.warmInlineMeshCache(meshId, inlineMesh);
958
957
  }
959
958
  return this.inlineMeshCache.get(meshId);
960
959
  }
961
960
 
961
+ private warmInlineMeshCache(meshId: string, inlineMesh?: unknown): any | undefined {
962
+ if (!inlineMesh || typeof inlineMesh !== 'object') return undefined;
963
+ const cached = this.inlineMeshCache.get(meshId);
964
+ if (cached) return cached;
965
+ this.inlineMeshCache.set(meshId, inlineMesh as any);
966
+ return inlineMesh as any;
967
+ }
968
+
962
969
  private async getMeshForCommand(
963
970
  meshId: string,
964
971
  inlineMesh?: unknown,
965
972
  options?: { preferInline?: boolean },
966
- ): Promise<{ mesh: any; inline: boolean } | null> {
973
+ ): Promise<{ mesh: any; inline: boolean; source: 'inline_cache' | 'inline_bootstrap' | 'local_config' } | null> {
967
974
  const preferInline = options?.preferInline === true;
968
975
  if (preferInline) {
969
- const cached = this.getCachedInlineMesh(meshId, inlineMesh);
970
- if (cached) return { mesh: cached, inline: true };
976
+ const cached = this.getCachedInlineMesh(meshId);
977
+ if (cached) return { mesh: cached, inline: true, source: 'inline_cache' };
978
+ const warmedInline = this.warmInlineMeshCache(meshId, inlineMesh);
979
+ if (warmedInline) return { mesh: warmedInline, inline: true, source: 'inline_bootstrap' };
971
980
  }
972
981
  try {
973
982
  const { getMesh } = await import('../config/mesh-config.js');
974
983
  const mesh = getMesh(meshId);
975
- if (mesh) return { mesh, inline: false };
984
+ if (mesh) return { mesh, inline: false, source: 'local_config' };
976
985
  } catch { /* fall through to inline cache */ }
977
- const cached = this.getCachedInlineMesh(meshId, inlineMesh);
978
- return cached ? { mesh: cached, inline: true } : null;
986
+ const cached = this.getCachedInlineMesh(meshId);
987
+ if (cached) return { mesh: cached, inline: true, source: 'inline_cache' };
988
+ const warmedInline = this.warmInlineMeshCache(meshId, inlineMesh);
989
+ return warmedInline ? { mesh: warmedInline, inline: true, source: 'inline_bootstrap' } : null;
979
990
  }
980
991
 
981
992
  private updateInlineMeshNode(meshId: string, mesh: any, node: any): void {
@@ -1272,6 +1283,7 @@ export class DaemonCommandRouter {
1272
1283
  const deletedSessionIds: string[] = [];
1273
1284
  const skippedSessionIds: string[] = [];
1274
1285
  const skippedLiveSessionIds: string[] = [];
1286
+ const skippedCoordinatorSessionIds: string[] = [];
1275
1287
  const deleteUnsupportedSessionIds: string[] = [];
1276
1288
  const recordsRemainSessionIds: string[] = [];
1277
1289
  const errors: Array<{ sessionId: string; error: string }> = [];
@@ -1306,6 +1318,12 @@ export class DaemonCommandRouter {
1306
1318
  const completed = this.isCompletedHostedSession(record);
1307
1319
  const surfaceKind = getSessionHostSurfaceKind(record);
1308
1320
  const liveRuntime = surfaceKind === 'live_runtime';
1321
+ const coordinatorSession = readStringValue(record?.meta?.meshCoordinatorFor) === args.meshId;
1322
+ if (!hasExplicitSessionIds && coordinatorSession) {
1323
+ skippedSessionIds.push(sessionId);
1324
+ skippedCoordinatorSessionIds.push(sessionId);
1325
+ continue;
1326
+ }
1309
1327
  if (!hasExplicitSessionIds && liveRuntime) {
1310
1328
  skippedSessionIds.push(sessionId);
1311
1329
  skippedLiveSessionIds.push(sessionId);
@@ -1375,6 +1393,7 @@ export class DaemonCommandRouter {
1375
1393
  deletedSessionIds,
1376
1394
  skippedSessionIds,
1377
1395
  skippedLiveSessionIds,
1396
+ skippedCoordinatorSessionIds,
1378
1397
  ...(deleteUnsupported ? {
1379
1398
  deleteUnsupported: true,
1380
1399
  effectiveCleanup: args.mode === 'stop_and_delete'
@@ -3217,6 +3236,15 @@ export class DaemonCommandRouter {
3217
3236
  repoIdentity: mesh.repoIdentity,
3218
3237
  defaultBranch: mesh.defaultBranch,
3219
3238
  refreshedAt: new Date().toISOString(),
3239
+ sourceOfTruth: {
3240
+ membership: meshRecord?.source === 'inline_cache'
3241
+ ? 'coordinator_inline_mesh_cache'
3242
+ : meshRecord?.source === 'local_config'
3243
+ ? 'local_mesh_config'
3244
+ : 'inline_bootstrap_snapshot',
3245
+ coordinatorOwnsLiveTruth: meshRecord?.source !== 'inline_bootstrap',
3246
+ historicalEvidenceOnly: ['recoveryHints', 'ledger.summary', 'queue.summary'],
3247
+ },
3220
3248
  nodes: nodeStatuses,
3221
3249
  queue: { tasks: queue, summary: queueSummary },
3222
3250
  ledger: { entries: ledgerEntries, summary: ledgerSummary },