speclock 4.4.0 → 4.4.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speclock",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "description": "AI constraint engine with Gemini LLM universal detection, Policy-as-Code DSL, OAuth/OIDC SSO, admin dashboard, telemetry, API key auth, RBAC, AES-256-GCM encryption, hard enforcement, semantic pre-commit, HMAC audit chain, SOC 2/HIPAA compliance. Cross-platform: MCP + direct API. 31 MCP tools + CLI. Enterprise platform.",
5
5
  "type": "module",
6
6
  "main": "src/mcp/server.js",
package/src/cli/index.js CHANGED
@@ -116,7 +116,7 @@ function refreshContext(root) {
116
116
 
117
117
  function printHelp() {
118
118
  console.log(`
119
- SpecLock v4.4.0 — AI Constraint Engine (Gemini LLM + Policy-as-Code + SSO + Dashboard + Telemetry + Auth + RBAC + Encryption)
119
+ SpecLock v4.4.1 — AI Constraint Engine (Gemini LLM + Policy-as-Code + SSO + Dashboard + Telemetry + Auth + RBAC + Encryption)
120
120
  Developed by Sandeep Roy (github.com/sgroy10)
121
121
 
122
122
  Usage: speclock <command> [options]
@@ -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.4.0";
12
+ const VERSION = "4.4.1";
13
13
 
14
14
  // PHI-related keywords for HIPAA filtering
15
15
  const PHI_KEYWORDS = [
@@ -104,6 +104,10 @@ export const SYNONYM_GROUPS = [
104
104
  "ledger", "general ledger", "accounts"],
105
105
  ["trade", "trades", "executed trade", "trade record", "order",
106
106
  "position", "portfolio"],
107
+ ["salary", "salaries", "payroll", "wages", "compensation",
108
+ "remuneration", "stipend"],
109
+ ["payment gateway", "payment provider", "payment processor",
110
+ "payment service", "payment platform"],
107
111
 
108
112
  // --- IoT / firmware ---
109
113
  ["firmware", "firmware update", "ota", "over the air",
@@ -384,6 +388,36 @@ export const CONCEPT_MAP = {
384
388
  "transaction"],
385
389
  "invoice": ["billing", "payment", "charge", "transaction", "accounts receivable"],
386
390
 
391
+ // Salary / Payroll / Compensation
392
+ "salary": ["payroll", "wages", "compensation", "financial records",
393
+ "accounting", "payment"],
394
+ "payroll": ["salary", "wages", "compensation", "financial records",
395
+ "accounting", "payment"],
396
+ "wages": ["salary", "payroll", "compensation", "financial records"],
397
+ "compensation": ["salary", "payroll", "wages", "financial records"],
398
+
399
+ // Payment providers (brand names → payment gateway concept)
400
+ "razorpay": ["payment gateway", "payment processing", "payment",
401
+ "transaction", "billing"],
402
+ "phonepe": ["payment gateway", "payment processing", "payment",
403
+ "upi", "transaction"],
404
+ "ccavenue": ["payment gateway", "payment processing", "payment",
405
+ "transaction", "billing"],
406
+ "paytm": ["payment gateway", "payment processing", "payment",
407
+ "upi", "transaction"],
408
+ "paypal": ["payment gateway", "payment processing", "payment",
409
+ "transaction", "billing"],
410
+ "stripe": ["payment gateway", "payment processing", "payment",
411
+ "transaction", "billing"],
412
+ "square": ["payment gateway", "payment processing", "payment",
413
+ "transaction", "billing"],
414
+ "adyen": ["payment gateway", "payment processing", "payment",
415
+ "transaction", "billing"],
416
+ "braintree": ["payment gateway", "payment processing", "payment",
417
+ "transaction", "billing"],
418
+ "upi": ["payment gateway", "payment processing", "phonepe",
419
+ "paytm", "transaction", "payment"],
420
+
387
421
  // Logistics / Supply Chain
388
422
  "shipment": ["cargo", "freight", "consignment", "delivery", "package",
389
423
  "manifest", "tracking", "shipping"],
@@ -425,9 +459,18 @@ export const CONCEPT_MAP = {
425
459
  // E-commerce
426
460
  "cart": ["checkout", "purchase", "shopping cart"],
427
461
  "payment processing":["payment", "billing", "transaction",
428
- "stripe", "payment gateway"],
462
+ "stripe", "payment gateway", "payment provider"],
429
463
  "payment gateway": ["payment processing", "stripe", "paypal",
430
- "billing", "transaction"],
464
+ "billing", "transaction", "payment provider",
465
+ "payment processor"],
466
+ "payment provider": ["payment gateway", "payment processing", "payment",
467
+ "transaction", "billing"],
468
+ "payment processor": ["payment gateway", "payment processing", "payment",
469
+ "transaction", "billing"],
470
+ "payment service": ["payment gateway", "payment processing", "payment",
471
+ "transaction", "billing"],
472
+ "payment platform": ["payment gateway", "payment processing", "payment",
473
+ "transaction", "billing"],
431
474
  "product": ["item", "sku", "catalog", "merchandise", "product listing"],
432
475
  "price": ["pricing", "cost", "amount", "rate", "charge"],
433
476
 
@@ -761,6 +804,22 @@ export function tokenize(text) {
761
804
  words.push(w.slice(0, -1));
762
805
  }
763
806
  }
807
+
808
+ // Verb tense normalization — so "changed" matches "change",
809
+ // "processed" matches "process", "modifying" matches "modify"
810
+ for (const w of rawWords) {
811
+ if (w.endsWith("ed") && w.length > 4) {
812
+ words.push(w.slice(0, -1)); // "changed" → "change" (verb+d)
813
+ words.push(w.slice(0, -2)); // "processed" → "process" (verb+ed)
814
+ if (w.endsWith("ied") && w.length > 5) {
815
+ words.push(w.slice(0, -3) + "y"); // "modified" → "modify"
816
+ }
817
+ }
818
+ if (w.endsWith("ing") && w.length > 5) {
819
+ words.push(w.slice(0, -3)); // "processing" → "process"
820
+ words.push(w.slice(0, -3) + "e"); // "changing" → "change"
821
+ }
822
+ }
764
823
  const uniqueWords = [...new Set(words)];
765
824
 
766
825
  const all = [...new Set([...phrases, ...uniqueWords])];
@@ -979,15 +1038,38 @@ function extractProhibitedVerb(lockText) {
979
1038
  for (const pattern of patterns) {
980
1039
  const match = lower.match(pattern);
981
1040
  if (match) {
982
- const verb = match[1].trim();
1041
+ let verb = match[1].trim();
1042
+ // Handle passive voice: "must not be changed" → "changed" → stem → "change"
1043
+ if (verb.startsWith("be ")) verb = verb.slice(3);
983
1044
  // Check multi-word markers first
984
1045
  const allMarkers = [...NEGATIVE_INTENT_MARKERS, ...POSITIVE_INTENT_MARKERS]
985
1046
  .sort((a, b) => b.length - a.length);
986
1047
  for (const marker of allMarkers) {
987
1048
  if (verb.startsWith(marker)) return marker;
988
1049
  }
989
- // Return the first word
990
- return verb.split(/\s+/)[0];
1050
+ // Stem -ed/-ing verb forms: "changed" → "change", "modified" → "modify"
1051
+ const firstWord = verb.split(/\s+/)[0];
1052
+ if (firstWord.endsWith("ed") && firstWord.length > 4) {
1053
+ const stem1 = firstWord.slice(0, -1); // changed → change
1054
+ const stem2 = firstWord.slice(0, -2); // processed → process
1055
+ for (const marker of allMarkers) {
1056
+ if (stem1 === marker || stem2 === marker) return marker;
1057
+ }
1058
+ if (firstWord.endsWith("ied") && firstWord.length > 5) {
1059
+ const stem3 = firstWord.slice(0, -3) + "y"; // modified → modify
1060
+ for (const marker of allMarkers) {
1061
+ if (stem3 === marker) return marker;
1062
+ }
1063
+ }
1064
+ }
1065
+ if (firstWord.endsWith("ing") && firstWord.length > 5) {
1066
+ const stem1 = firstWord.slice(0, -3); // processing → process
1067
+ const stem2 = firstWord.slice(0, -3) + "e"; // changing → change
1068
+ for (const marker of allMarkers) {
1069
+ if (stem1 === marker || stem2 === marker) return marker;
1070
+ }
1071
+ }
1072
+ return firstWord;
991
1073
  }
992
1074
  }
993
1075
  return null;
@@ -1098,6 +1180,7 @@ const _CONTAMINATING_VERBS = new Set([
1098
1180
  "reconcile", "reverse", "recalculate", "backdate", "rebalance",
1099
1181
  "reroute", "divert", "reassign", "rebook", "cancel",
1100
1182
  "upgrade", "downgrade", "patch", "bump",
1183
+ "optimize", "streamline", "modernize", "overhaul", "revamp",
1101
1184
  ]);
1102
1185
 
1103
1186
  const _FILLER_WORDS = new Set([
@@ -1806,6 +1889,30 @@ export function scoreConflict({ actionText, lockText }) {
1806
1889
  `no scope overlap — different components despite shared vocabulary`);
1807
1890
  }
1808
1891
  }
1892
+
1893
+ // 5c: UI/cosmetic changes that share a location word with a system lock.
1894
+ // "Change the font on the login page" shares "login" with auth locks,
1895
+ // but changing a font/color/style is a visual change, not a system modification.
1896
+ // Only applies when scope overlap is WEAK (shared location word, not shared target).
1897
+ const UI_COSMETIC_WORDS = new Set([
1898
+ "font", "fonts", "color", "colors", "colour", "theme", "themes",
1899
+ "styling", "style", "styles", "css", "icon", "icons", "layout",
1900
+ "margin", "padding", "border", "background", "typography", "spacing",
1901
+ "alignment", "animation", "transition", "hover", "tooltip",
1902
+ "placeholder", "logo", "image", "banner", "hero", "avatar",
1903
+ "sidebar", "navigation", "menu", "breadcrumb", "footer",
1904
+ ]);
1905
+ if (!intentAligned && !hasStrongScopeMatch && !hasStrongVocabMatch) {
1906
+ const actionLower = actionText.toLowerCase();
1907
+ const actionWords = actionLower.split(/\s+/).map(w => w.replace(/[^a-z]/g, ""));
1908
+ const hasUISubject = actionWords.some(w => UI_COSMETIC_WORDS.has(w));
1909
+ if (hasUISubject) {
1910
+ intentAligned = true;
1911
+ reasons.push(
1912
+ `intent alignment: UI/cosmetic change — visual modification, ` +
1913
+ `not system logic change`);
1914
+ }
1915
+ }
1809
1916
  }
1810
1917
 
1811
1918
  // If intent is ALIGNED, the action is COMPLIANT — slash the score to near zero
@@ -1821,10 +1928,6 @@ export function scoreConflict({ actionText, lockText }) {
1821
1928
  // Either: scope overlap (subject extraction confirms same target)
1822
1929
  // Or: 2+ direct word overlaps (not just a single shared word)
1823
1930
  // Or: phrase overlap (multi-word match is strong signal)
1824
- // Or: concept match (domain-level relevance)
1825
- // Concept matches contribute to base score but should NOT gate the negation
1826
- // bonus — they're too indirect ("account" → "ledger" via concept map shouldn't
1827
- // trigger the +35 negation bonus). Only direct evidence counts.
1828
1931
  const hasStrongSubjectMatch = hasStrongScopeMatch ||
1829
1932
  directOverlap.length >= 2 ||
1830
1933
  phraseOverlap.length > 0;
@@ -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.4.0",
260
+ version: "4.4.1",
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.4.0 &mdash; AI Constraint Engine</div>
92
+ <div class="meta">v4.4.1 &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.4.0 &mdash; Developed by Sandeep Roy &mdash; <a href="https://github.com/sgroy10/speclock" style="color:var(--accent)">GitHub</a>
185
+ SpecLock v4.4.1 &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.4.0";
94
+ const VERSION = "4.4.1";
95
95
  const AUTHOR = "Sandeep Roy";
96
96
  const START_TIME = Date.now();
97
97
 
package/src/mcp/server.js CHANGED
@@ -100,7 +100,7 @@ const PROJECT_ROOT =
100
100
  args.project || process.env.SPECLOCK_PROJECT_ROOT || process.cwd();
101
101
 
102
102
  // --- MCP Server ---
103
- const VERSION = "4.4.0";
103
+ const VERSION = "4.4.1";
104
104
  const AUTHOR = "Sandeep Roy";
105
105
 
106
106
  const server = new McpServer(