log-llm-config 1.2.8 → 1.3.0

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.
@@ -10,6 +10,7 @@ import { resolveHardwareUuid } from './hardware_uuid.js';
10
10
  import { ensureAuthentication } from '../auth/auth_flow.js';
11
11
  import { readJSONFile, readMarkdownFile } from '../readers/file_readers.js';
12
12
  import { isVscdbVirtualPath, tryReadVscdbVirtualFile } from '../readers/vscdb_config_builder.js';
13
+ import { persistVscdbComposerContractFromPatternsResponse } from '../readers/vscdb_reader.js';
13
14
  import { collectConfigFilesFromPatterns, collectMcpToolFiles, collectConfigFilesFromInstalledPlugins, determineFileTypeFromPath } from '../collection/config_collector.js';
14
15
  import { normalizePathSkipPrefixes } from '../paths/pattern_resolver.js';
15
16
  import { sendConfigFile, sendConfigFilesBatch, sendHookRequestCreate, sendHookRequestUpdateManifest, sendIngestSessionStart, sendIngestSessionFinish, BATCH_CHUNK_SIZE } from '../sender/batch_sender.js';
@@ -26,6 +27,7 @@ async function collectAllConfigFiles(endpointBase) {
26
27
  hookRunLog(msg);
27
28
  throw new Error(msg);
28
29
  }
30
+ persistVscdbComposerContractFromPatternsResponse(patternsResponse);
29
31
  hookRunLog(`scanning config files`);
30
32
  const configFiles = collectConfigFilesFromPatterns(patternsResponse.patterns, PROJECT_ROOT, hookRunLog, {
31
33
  vscdbEntrySpecs: patternsResponse.vscdb_entry_specs,
@@ -7,12 +7,43 @@ import { dirname, join } from 'node:path';
7
7
  import { homedir } from 'node:os';
8
8
  import { OPT_AI_SEC_MANAGEMENT_REL } from '../../bootstrap_constants.js';
9
9
  export const REMEDIATION_INSTRUCTIONS_BASENAME = 'remediation_instructions.json';
10
+ /** Pending state.vscdb writes applied after Cursor exits (IDE holds the DB locked). */
11
+ export const DEFERRED_VSCDB_APPLY_BASENAME = 'optimus_deferred_vscdb_apply.json';
12
+ /**
13
+ * Cached subset of GET file-patterns: reactive ItemTable key + composer shadow keys from the backend.
14
+ * Written when patterns are fetched; remediations and vscdb reads use this so the npm package stays free
15
+ * of hardcoded Cursor paths.
16
+ */
17
+ export const FILE_COLLECTION_VSCDB_CONTRACT_BASENAME = 'file_collection_vscdb_contract.json';
10
18
  export function getManagementDir() {
11
19
  return join(homedir(), OPT_AI_SEC_MANAGEMENT_REL);
12
20
  }
13
21
  export function getRemediationInstructionsPath() {
14
22
  return join(getManagementDir(), REMEDIATION_INSTRUCTIONS_BASENAME);
15
23
  }
24
+ export function getDeferredVscdbApplyPath() {
25
+ return join(getManagementDir(), DEFERRED_VSCDB_APPLY_BASENAME);
26
+ }
27
+ export function getFileCollectionVscdbContractPath() {
28
+ return join(getManagementDir(), FILE_COLLECTION_VSCDB_CONTRACT_BASENAME);
29
+ }
30
+ export function readFileCollectionVscdbContract() {
31
+ const path = getFileCollectionVscdbContractPath();
32
+ if (!existsSync(path))
33
+ return null;
34
+ try {
35
+ const parsed = JSON.parse(readFileSync(path, 'utf8'));
36
+ if (parsed?.version !== 1 || !Array.isArray(parsed.composer_shadow_keys))
37
+ return null;
38
+ return parsed;
39
+ }
40
+ catch {
41
+ return null;
42
+ }
43
+ }
44
+ export function writeFileCollectionVscdbContract(contract) {
45
+ atomicWriteJson(getFileCollectionVscdbContractPath(), contract);
46
+ }
16
47
  export function atomicWriteJson(filePath, data) {
17
48
  const dir = dirname(filePath);
18
49
  if (!existsSync(dir))