@adhdev/daemon-core 0.9.82-rc.291 → 0.9.82-rc.293

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.
@@ -829,22 +829,27 @@ export class CliProviderInstance implements ProviderInstance {
829
829
  }
830
830
 
831
831
  updateSettings(newSettings: Record<string, any>): void {
832
- const runtimeMeshSettings: Record<string, any> = {};
833
- for (const key of [
834
- 'meshNodeFor',
835
- 'meshNodeId',
836
- 'meshActiveTaskId',
837
- 'meshCoordinatorFor',
838
- 'meshCoordinatorDaemonId',
839
- 'meshCoordinatorNodeId',
840
- 'spawnedSessionVisibility',
841
- 'launchedByCoordinator',
842
- ]) {
843
- if (this.settings[key] !== undefined && newSettings[key] === undefined) {
844
- runtimeMeshSettings[key] = this.settings[key];
845
- }
846
- }
847
- this.settings = { ...newSettings, ...runtimeMeshSettings };
832
+ // Merge semantics: a key omitted from newSettings preserves its existing
833
+ // value, a key present in newSettings (even as false) overrides it.
834
+ //
835
+ // This is required because updateSettings has two callers with opposite
836
+ // intent:
837
+ // 1. Full re-injection — the dashboard toggle path (handleSetProviderSetting
838
+ // → getSettings → updateInstanceSettings) sends the COMPLETE settings
839
+ // object, so an explicit autoApprove:false must win.
840
+ // 2. Partial stamp — the mesh relay-safety stamp (router.ts agent_command,
841
+ // buildMeshWorkerRelayStamp) sends ONLY {meshNodeFor, meshNodeId,
842
+ // meshCoordinatorDaemonId, launchedByCoordinator} on every coordinator
843
+ // re-dispatch. It carries no autoApprove, so a full replacement would
844
+ // wipe the launch-time autoApprove:true the worker was started with,
845
+ // silently dropping every later approval to a manual gate until the
846
+ // machine-page toggle re-injected the full settings.
847
+ //
848
+ // A plain merge satisfies both: undefined keys fall through to the existing
849
+ // value (preserving launch-stamp settings like autoApprove + the mesh routing
850
+ // keys), explicit keys override. This subsumes the previous mesh-key preserve
851
+ // list, which only protected the routing keys and not autoApprove.
852
+ this.settings = { ...this.settings, ...newSettings };
848
853
  this.adapter.updateRuntimeSettings?.(this.settings);
849
854
  this.monitor.updateConfig({
850
855
  approvalAlert: this.settings.approvalAlert !== false,
@@ -171,7 +171,11 @@ export class ExtensionProviderInstance implements ProviderInstance {
171
171
  }
172
172
 
173
173
  updateSettings(newSettings: Record<string, any>): void {
174
- this.settings = { ...newSettings };
174
+ // Merge (not replace): a key omitted from newSettings preserves its existing
175
+ // value, a key present (even false) overrides. Mirrors cli/ide-provider-instance
176
+ // so partial updates do not wipe launch-time settings (e.g. autoApprove) while a
177
+ // full settings object still applies explicit values.
178
+ this.settings = { ...this.settings, ...newSettings };
175
179
  this.monitor.updateConfig({
176
180
  approvalAlert: this.settings.approvalAlert !== false,
177
181
  longGeneratingAlert: this.settings.longGeneratingAlert !== false,
@@ -259,7 +259,12 @@ export class IdeProviderInstance implements ProviderInstance {
259
259
  }
260
260
 
261
261
  updateSettings(newSettings: Record<string, any>): void {
262
- this.settings = { ...newSettings };
262
+ // Merge (not replace): a key omitted from newSettings preserves its existing
263
+ // value, a key present (even false) overrides. Mirrors cli-provider-instance —
264
+ // a partial mesh relay-stamp must not wipe launch-time settings such as
265
+ // autoApprove, while the dashboard toggle's full settings object still applies
266
+ // an explicit autoApprove:false. See cli-provider-instance.updateSettings.
267
+ this.settings = { ...this.settings, ...newSettings };
263
268
  this.monitor.updateConfig({
264
269
  approvalAlert: this.settings.approvalAlert !== false,
265
270
  longGeneratingAlert: this.settings.longGeneratingAlert !== false,