@adhdev/daemon-core 0.9.82-rc.22 → 0.9.82-rc.23

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.22",
3
+ "version": "0.9.82-rc.23",
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",
@@ -447,6 +447,23 @@ function summarizeMeshSessionRecord(record: any): Record<string, unknown> {
447
447
  };
448
448
  }
449
449
 
450
+ function liveSessionRecordMatchesMeshNode(record: any, meshId: string, nodeId: string): boolean {
451
+ const recordNodeId = readStringValue(record?.meta?.meshNodeId);
452
+ if (!recordNodeId || recordNodeId !== nodeId) return false;
453
+ const recordMeshId = readStringValue(record?.meta?.meshNodeFor);
454
+ return !recordMeshId || recordMeshId === meshId;
455
+ }
456
+
457
+ function liveSessionRecordMatchesMeshWorkspace(record: any, meshId: string, workspace: string): boolean {
458
+ const recordWorkspace = readStringValue(record?.workspace);
459
+ if (!recordWorkspace || !workspace || recordWorkspace !== workspace) return false;
460
+
461
+ const recordMeshId = readStringValue(record?.meta?.meshNodeFor);
462
+ if (recordMeshId) return recordMeshId === meshId;
463
+
464
+ return record?.meta?.launchedByCoordinator === true || !!readStringValue(record?.meta?.meshNodeId);
465
+ }
466
+
450
467
  function readLiveMeshNodeWorkspace(args: {
451
468
  meshId: string;
452
469
  nodeId: string;
@@ -454,7 +471,7 @@ function readLiveMeshNodeWorkspace(args: {
454
471
  allowCoordinatorSession?: boolean;
455
472
  }): string {
456
473
  const directNodeWorkspace = args.liveSessionRecords.find((record) => (
457
- readStringValue(record?.meta?.meshNodeId) === args.nodeId
474
+ liveSessionRecordMatchesMeshNode(record, args.meshId, args.nodeId)
458
475
  && readStringValue(record?.workspace)
459
476
  ));
460
477
  if (directNodeWorkspace) {
@@ -482,10 +499,9 @@ function collectLiveMeshSessionRecords(args: {
482
499
  allowCoordinatorSession?: boolean;
483
500
  }): any[] {
484
501
  const matches = args.liveSessionRecords.filter((record) => {
485
- if (readStringValue(record?.meta?.meshNodeId) === args.nodeId) return true;
486
- const recordWorkspace = readStringValue(record?.workspace);
487
502
  const nodeWorkspace = readStringValue(args.node?.workspace);
488
- return !!recordWorkspace && !!nodeWorkspace && recordWorkspace === nodeWorkspace;
503
+ if (liveSessionRecordMatchesMeshNode(record, args.meshId, args.nodeId)) return true;
504
+ return !!nodeWorkspace && liveSessionRecordMatchesMeshWorkspace(record, args.meshId, nodeWorkspace);
489
505
  });
490
506
 
491
507
  if (args.allowCoordinatorSession) {