log-llm-config 1.3.79 → 1.3.80

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.
@@ -176,13 +176,13 @@ function runOneStep(dbPath, stateData, step) {
176
176
  ? composerState
177
177
  : undefined;
178
178
  for (const k of step.include_keys) {
179
- // Prefer the value inside composerState when present; blob root can be stale vs the UI.
180
- if (nested && k in nested && nested[k] !== undefined) {
181
- stateData[k] = nested[k];
182
- }
183
- else if (k in obj && obj[k] !== undefined) {
179
+ // Reactive blob root wins over nested composerState (matches policy_engine.scan_targets merge).
180
+ if (k in obj && obj[k] !== undefined) {
184
181
  stateData[k] = obj[k];
185
182
  }
183
+ else if (nested && k in nested && nested[k] !== undefined) {
184
+ stateData[k] = nested[k];
185
+ }
186
186
  }
187
187
  }
188
188
  return;
@@ -14,7 +14,7 @@ import { existsSync, readFileSync } from 'node:fs';
14
14
  import { homedir } from 'node:os';
15
15
  import { join } from 'node:path';
16
16
  import { readVscdbItemTableJson } from '../readers/vscdb_reader.js';
17
- import { readRemediationInstructionsFile, writeRemediationInstructionsFile } from './management_storage.js';
17
+ import { readFileCollectionVscdbContract, readRemediationInstructionsFile, writeRemediationInstructionsFile, } from './management_storage.js';
18
18
  import { resolveRemediationConfigPath } from './remediation_config_path.js';
19
19
  import { complianceRunnerDiag, hookRunLog, logRemediationApplyFailure } from './hook_logger.js';
20
20
  import { loadEndpointBase } from '../sender/endpoint_config.js';
@@ -174,6 +174,47 @@ function verifyOpsApplied(configJson, settingPath, ops) {
174
174
  }
175
175
  return { ok: true, expected: null };
176
176
  }
177
+ function shouldMergeComposerShadowKeys(itemKeyFromPath, checkSettingPaths) {
178
+ if (itemKeyFromPath === 'composerState')
179
+ return true;
180
+ return checkSettingPaths.some((p) => p === 'composerState' || p.startsWith('composerState.'));
181
+ }
182
+ /**
183
+ * Cursor stores web-tool toggles on the reactive blob root and nested `composerState`.
184
+ * Policy scan merges root shadow keys into composerState; compliance must match or autofix
185
+ * never runs when nested values are stale (e.g. lastBrowserConnectionMode none vs root editor).
186
+ */
187
+ export function mergeComposerShadowKeysFromReactiveBlob(dbPath, merged) {
188
+ const contract = readFileCollectionVscdbContract();
189
+ const reactiveKey = contract?.reactive_storage_item_key?.trim();
190
+ const shadowKeys = contract?.composer_shadow_keys ?? [];
191
+ if (!reactiveKey || shadowKeys.length === 0)
192
+ return;
193
+ const reactiveWrapped = readVscdbItemTableJson(dbPath, reactiveKey);
194
+ if (reactiveWrapped === null)
195
+ return;
196
+ const blob = reactiveWrapped[reactiveKey];
197
+ if (!blob || typeof blob !== 'object' || Array.isArray(blob))
198
+ return;
199
+ const root = blob;
200
+ let cs = merged.composerState;
201
+ if (!cs || typeof cs !== 'object' || Array.isArray(cs)) {
202
+ const nested = root.composerState;
203
+ if (nested && typeof nested === 'object' && !Array.isArray(nested)) {
204
+ cs = { ...nested };
205
+ }
206
+ else {
207
+ cs = {};
208
+ }
209
+ merged.composerState = cs;
210
+ }
211
+ const composerState = cs;
212
+ for (const key of shadowKeys) {
213
+ if (Object.prototype.hasOwnProperty.call(root, key) && root[key] !== undefined) {
214
+ composerState[key] = root[key];
215
+ }
216
+ }
217
+ }
177
218
  /** Plain JSON file or virtual `…/state.vscdb#itemKey` path for ItemTable-backed settings. */
178
219
  function loadRemediationConfigJson(configFilePath, checkSettingPaths = []) {
179
220
  const resolvedPath = resolveRemediationConfigPath(configFilePath);
@@ -193,6 +234,9 @@ function loadRemediationConfigJson(configFilePath, checkSettingPaths = []) {
193
234
  return { ok: false, reason: 'vscdb_read_failed' };
194
235
  Object.assign(merged, wrapped);
195
236
  }
237
+ if (shouldMergeComposerShadowKeys(itemKeyFromPath, checkSettingPaths)) {
238
+ mergeComposerShadowKeysFromReactiveBlob(dbPath, merged);
239
+ }
196
240
  return { ok: true, json: merged };
197
241
  }
198
242
  if (!existsSync(resolvedPath))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "log-llm-config",
3
- "version": "1.3.79",
3
+ "version": "1.3.80",
4
4
  "description": "CLI helpers for logging hardware UUIDs and posting startup payloads to Optimus Security.",
5
5
  "type": "module",
6
6
  "bin": {