@adhdev/daemon-core 0.9.82-rc.485 → 0.9.82-rc.487

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.
@@ -34,6 +34,47 @@ import {
34
34
  } from '../providers/open-panel-support.js';
35
35
  import { TEXT_ONLY_MESSAGE_INPUT_SUPPORT } from '../providers/provider-input-support.js';
36
36
 
37
+ /**
38
+ * A coordinator-spawned worker session that mesh policy launched hidden. This is
39
+ * the daemon-side equivalent of the web `shouldAutoHideMeshConversation` predicate:
40
+ * these sessions should default to muted+hidden in the user dashboard (the user
41
+ * interacts through the ONE coordinator session, not each worker), while the
42
+ * coordinator↔worker mesh data/completion path (mesh-event-forwarding) is
43
+ * unaffected.
44
+ */
45
+ function isCoordinatorSpawnedHiddenWorker(settings: Record<string, any> | undefined): boolean {
46
+ if (!settings) return false;
47
+ return settings.launchedByCoordinator === true
48
+ && typeof settings.meshNodeFor === 'string'
49
+ && settings.meshNodeFor.trim().length > 0
50
+ && settings.spawnedSessionVisibility === 'hidden';
51
+ }
52
+
53
+ /**
54
+ * A session is surface-hidden (collapsed from the user's inbox/notifications) when
55
+ * mesh policy spawned it hidden, OR when a coordinator-spawned worker defaults
56
+ * hidden, OR when the user manually hid it (userHidden). userHidden === false is an
57
+ * explicit un-hide that overrides the policy/worker default until daemon restart.
58
+ */
59
+ function resolveSurfaceHidden(settings: Record<string, any> | undefined): boolean {
60
+ if (!settings) return false;
61
+ if (settings.userHidden === true) return true;
62
+ if (settings.userHidden === false) return false;
63
+ return settings.spawnedSessionVisibility === 'hidden' || isCoordinatorSpawnedHiddenWorker(settings);
64
+ }
65
+
66
+ /**
67
+ * A session is muted (attention side-effects suppressed, but still shown in the
68
+ * list) when the user muted it, OR a coordinator-spawned worker defaults muted.
69
+ * userMuted === false is an explicit un-mute overriding the worker default.
70
+ */
71
+ function resolveMuted(settings: Record<string, any> | undefined): boolean {
72
+ if (!settings) return false;
73
+ if (settings.userMuted === true) return true;
74
+ if (settings.userMuted === false) return false;
75
+ return isCoordinatorSpawnedHiddenWorker(settings);
76
+ }
77
+
37
78
  export type SessionEntryProfile = 'full' | 'live' | 'metadata';
38
79
 
39
80
  export interface SessionEntryBuildOptions {
@@ -342,7 +383,8 @@ function buildCliSession(state: CliProviderState, options: SessionEntryBuildOpti
342
383
  settings: state.settings,
343
384
  ...(coordinator && { coordinator }),
344
385
  ...(meshQueueStats && { meshQueueStats }),
345
- ...(state.settings?.spawnedSessionVisibility === 'hidden' && { surfaceHidden: true }),
386
+ ...(resolveSurfaceHidden(state.settings) && { surfaceHidden: true }),
387
+ ...(resolveMuted(state.settings) && { muted: true }),
346
388
  };
347
389
  }
348
390
 
@@ -384,7 +426,8 @@ function buildAcpSession(state: AcpProviderState, options: SessionEntryBuildOpti
384
426
  settings: state.settings,
385
427
  ...(coordinator && { coordinator }),
386
428
  ...(meshQueueStats && { meshQueueStats }),
387
- ...(state.settings?.spawnedSessionVisibility === 'hidden' && { surfaceHidden: true }),
429
+ ...(resolveSurfaceHidden(state.settings) && { surfaceHidden: true }),
430
+ ...(resolveMuted(state.settings) && { muted: true }),
388
431
  };
389
432
  }
390
433
 
@@ -130,7 +130,7 @@ function buildDetectedIdeInfos(
130
130
  }));
131
131
  }
132
132
 
133
- function buildAvailableProviders(
133
+ export function buildAvailableProviders(
134
134
  providerLoader: StatusSnapshotOptions['providerLoader'],
135
135
  ): AvailableProviderInfo[] {
136
136
  const providers: Array<{