speclock 4.5.3 → 4.5.4

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.
@@ -9,7 +9,7 @@
9
9
  import { readBrain, readEvents } from "./storage.js";
10
10
  import { verifyAuditChain } from "./audit.js";
11
11
 
12
- const VERSION = "4.5.3";
12
+ const VERSION = "4.5.4";
13
13
 
14
14
  // PHI-related keywords for HIPAA filtering
15
15
  const PHI_KEYWORDS = [
@@ -342,16 +342,15 @@ export async function checkConflictAsync(rootOrAction, proposedActionOrLock) {
342
342
 
343
343
  /**
344
344
  * Merge heuristic result with LLM/proxy result.
345
- * Keeps HIGH heuristic conflicts + all LLM conflicts, deduplicates, takes MAX.
345
+ * Takes MAX(heuristic, LLM) confidence per lock neither engine can override the other.
346
+ * The heuristic catches domain-specific patterns; the LLM catches cross-domain vocabulary.
346
347
  */
347
348
  function mergeLLMResult(heuristicResult, llmResult) {
348
- const highConfidence = heuristicResult.conflictingLocks.filter(
349
- (c) => c.confidence > 70
350
- );
349
+ const allHeuristic = heuristicResult.conflictingLocks || [];
351
350
  const llmConflicts = llmResult.conflictingLocks || [];
352
- const merged = [...highConfidence, ...llmConflicts];
351
+ const merged = [...allHeuristic, ...llmConflicts];
353
352
 
354
- // Deduplicate by lock text, keeping the higher-confidence entry
353
+ // Deduplicate by lock text, keeping the higher-confidence entry (MAX per lock)
355
354
  const byText = new Map();
356
355
  for (const c of merged) {
357
356
  const existing = byText.get(c.text);
@@ -365,15 +364,17 @@ function mergeLLMResult(heuristicResult, llmResult) {
365
364
  return {
366
365
  hasConflict: false,
367
366
  conflictingLocks: [],
368
- analysis: `Heuristic had partial signal, LLM verified as safe. No conflicts.`,
367
+ analysis: `Both heuristic and LLM agree: no conflicts detected.`,
369
368
  };
370
369
  }
371
370
 
372
371
  unique.sort((a, b) => b.confidence - a.confidence);
372
+ const heuristicCount = allHeuristic.filter(c => !llmConflicts.some(l => l.text === c.text)).length;
373
+ const llmOnlyCount = llmConflicts.filter(l => !allHeuristic.some(h => h.text === l.text)).length;
373
374
  return {
374
375
  hasConflict: true,
375
376
  conflictingLocks: unique,
376
- analysis: `${unique.length} conflict(s) confirmed (${highConfidence.length} heuristic + ${llmConflicts.length} LLM-verified).`,
377
+ analysis: `${unique.length} conflict(s) detected (${heuristicCount} heuristic-only, ${llmOnlyCount} LLM-only, ${unique.length - heuristicCount - llmOnlyCount} both).`,
377
378
  };
378
379
  }
379
380
 
@@ -257,7 +257,7 @@ export async function flushToRemote(root) {
257
257
  // Build anonymized payload
258
258
  const payload = {
259
259
  instanceId: summary.instanceId,
260
- version: "4.5.3",
260
+ version: "4.5.4",
261
261
  totalCalls: summary.totalCalls,
262
262
  avgResponseMs: summary.avgResponseMs,
263
263
  conflicts: summary.conflicts,
@@ -89,7 +89,7 @@
89
89
  <div class="header">
90
90
  <div>
91
91
  <h1><span>SpecLock</span> Dashboard</h1>
92
- <div class="meta">v4.5.3 &mdash; AI Constraint Engine</div>
92
+ <div class="meta">v4.5.4 &mdash; AI Constraint Engine</div>
93
93
  </div>
94
94
  <div style="display:flex;align-items:center;gap:12px;">
95
95
  <span id="health-badge" class="status-badge healthy">Loading...</span>
@@ -182,7 +182,7 @@
182
182
  </div>
183
183
 
184
184
  <div style="text-align:center;padding:24px;color:var(--muted);font-size:12px;">
185
- SpecLock v4.5.3 &mdash; Developed by Sandeep Roy &mdash; <a href="https://github.com/sgroy10/speclock" style="color:var(--accent)">GitHub</a>
185
+ SpecLock v4.5.4 &mdash; Developed by Sandeep Roy &mdash; <a href="https://github.com/sgroy10/speclock" style="color:var(--accent)">GitHub</a>
186
186
  </div>
187
187
 
188
188
  <script>
@@ -91,7 +91,7 @@ import { fileURLToPath } from "url";
91
91
  import _path from "path";
92
92
 
93
93
  const PROJECT_ROOT = process.env.SPECLOCK_PROJECT_ROOT || process.cwd();
94
- const VERSION = "4.5.3";
94
+ const VERSION = "4.5.4";
95
95
  const AUTHOR = "Sandeep Roy";
96
96
  const START_TIME = Date.now();
97
97