@adhdev/daemon-core 0.9.82-rc.338 → 0.9.82-rc.339

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.
@@ -987,4 +987,13 @@ export interface ProviderControlDef {
987
987
  order?: number;
988
988
  /** Hide this control when condition not met */
989
989
  hidden?: boolean;
990
+ /**
991
+ * FSM state ids in which this control should be visible (mirrors the spec's
992
+ * `control_bar[].visible_when_state`). When omitted the control is always
993
+ * visible. The daemon enforces this on click (FsmDriver.handleClickControl),
994
+ * so the web bar must mirror the same gating to avoid showing a button that
995
+ * the daemon would silently drop. Uses raw FSM state ids (e.g. 'idle',
996
+ * 'busy'), not the derived dashboard status.
997
+ */
998
+ visibleWhenState?: string[];
990
999
  }
@@ -529,6 +529,13 @@ export interface ProviderControlSchema {
529
529
  order?: number;
530
530
  /** Hide this control even if it would otherwise render */
531
531
  hidden?: boolean;
532
+ /**
533
+ * FSM state ids in which this control should be visible. When omitted the
534
+ * control is always visible. Mirrors the daemon's click-time enforcement so
535
+ * the bar hides controls the daemon would silently drop. Uses raw FSM state
536
+ * ids (e.g. 'idle', 'busy'), not the derived dashboard status.
537
+ */
538
+ visibleWhenState?: string[];
532
539
  }
533
540
  /** Machine hardware/OS info (reported by daemon, displayed by web) */
534
541
  export interface MachineInfo {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.82-rc.338",
3
+ "version": "0.9.82-rc.339",
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",
@@ -46,7 +46,7 @@
46
46
  "author": "vilmire",
47
47
  "license": "AGPL-3.0-or-later",
48
48
  "dependencies": {
49
- "@adhdev/mesh-shared": "0.9.82-rc.338",
49
+ "@adhdev/mesh-shared": "0.9.82-rc.339",
50
50
  "@adhdev/session-host-core": "*",
51
51
  "@agentclientprotocol/sdk": "^0.16.1",
52
52
  "ajv": "^8.20.0",
@@ -1156,4 +1156,13 @@ export interface ProviderControlDef {
1156
1156
  order?: number;
1157
1157
  /** Hide this control when condition not met */
1158
1158
  hidden?: boolean;
1159
+ /**
1160
+ * FSM state ids in which this control should be visible (mirrors the spec's
1161
+ * `control_bar[].visible_when_state`). When omitted the control is always
1162
+ * visible. The daemon enforces this on click (FsmDriver.handleClickControl),
1163
+ * so the web bar must mirror the same gating to avoid showing a button that
1164
+ * the daemon would silently drop. Uses raw FSM state ids (e.g. 'idle',
1165
+ * 'busy'), not the derived dashboard status.
1166
+ */
1167
+ visibleWhenState?: string[];
1159
1168
  }
@@ -124,6 +124,12 @@ function synthesizeControlsFromControlBar(specControls: any[]): ProviderControlD
124
124
  const actionType = ctl?.action?.type;
125
125
  if (!id || !actionType) return;
126
126
  const label = typeof ctl?.label === 'string' && ctl.label.trim() ? ctl.label : id;
127
+ // Preserve the spec's state gating so the web bar can mirror the daemon's
128
+ // FsmDriver.handleClickControl enforcement (otherwise the button renders in
129
+ // states where the daemon would silently drop the click).
130
+ const visibleWhenState = Array.isArray(ctl?.visible_when_state)
131
+ ? ctl.visible_when_state.filter((s: unknown): s is string => typeof s === 'string')
132
+ : undefined;
127
133
  if (actionType === 'open_picker') {
128
134
  out.push({
129
135
  id,
@@ -135,6 +141,7 @@ function synthesizeControlsFromControlBar(specControls: any[]): ProviderControlD
135
141
  setScript: id,
136
142
  readFrom: id,
137
143
  order: index,
144
+ ...(visibleWhenState && visibleWhenState.length > 0 ? { visibleWhenState } : {}),
138
145
  });
139
146
  } else if (actionType === 'send_keys') {
140
147
  out.push({
@@ -145,6 +152,7 @@ function synthesizeControlsFromControlBar(specControls: any[]): ProviderControlD
145
152
  invokeScript: id,
146
153
  resultDisplay: 'none',
147
154
  order: index,
155
+ ...(visibleWhenState && visibleWhenState.length > 0 ? { visibleWhenState } : {}),
148
156
  });
149
157
  }
150
158
  // attach_image intentionally skipped — see fn doc.
@@ -635,6 +635,13 @@ export interface ProviderControlSchema {
635
635
  order?: number;
636
636
  /** Hide this control even if it would otherwise render */
637
637
  hidden?: boolean;
638
+ /**
639
+ * FSM state ids in which this control should be visible. When omitted the
640
+ * control is always visible. Mirrors the daemon's click-time enforcement so
641
+ * the bar hides controls the daemon would silently drop. Uses raw FSM state
642
+ * ids (e.g. 'idle', 'busy'), not the derived dashboard status.
643
+ */
644
+ visibleWhenState?: string[];
638
645
  }
639
646
 
640
647
  // ─── Common Sub-Types (used across StatusReportPayload, BaseDaemonData, etc.) ──