speclock 4.4.0 → 4.4.2
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 +1 -1
- package/src/cli/index.js +1 -1
- package/src/core/compliance.js +1 -1
- package/src/core/semantics.js +120 -9
- package/src/core/telemetry.js +1 -1
- package/src/dashboard/index.html +2 -2
- package/src/mcp/http-server.js +1 -1
- package/src/mcp/server.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "speclock",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2",
|
|
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.
|
|
119
|
+
SpecLock v4.4.2 — 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]
|
package/src/core/compliance.js
CHANGED
package/src/core/semantics.js
CHANGED
|
@@ -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",
|
|
@@ -235,6 +239,7 @@ export const EUPHEMISM_MAP = {
|
|
|
235
239
|
"pull the plug": ["disable", "stop", "remove"],
|
|
236
240
|
"skip": ["disable", "bypass", "ignore"],
|
|
237
241
|
"bypass": ["disable", "circumvent", "skip"],
|
|
242
|
+
"disable": ["bypass", "circumvent", "turn off", "deactivate"],
|
|
238
243
|
"work around": ["bypass", "circumvent"],
|
|
239
244
|
"shortcut": ["bypass", "skip"],
|
|
240
245
|
|
|
@@ -384,6 +389,36 @@ export const CONCEPT_MAP = {
|
|
|
384
389
|
"transaction"],
|
|
385
390
|
"invoice": ["billing", "payment", "charge", "transaction", "accounts receivable"],
|
|
386
391
|
|
|
392
|
+
// Salary / Payroll / Compensation
|
|
393
|
+
"salary": ["payroll", "wages", "compensation", "financial records",
|
|
394
|
+
"accounting", "payment"],
|
|
395
|
+
"payroll": ["salary", "wages", "compensation", "financial records",
|
|
396
|
+
"accounting", "payment"],
|
|
397
|
+
"wages": ["salary", "payroll", "compensation", "financial records"],
|
|
398
|
+
"compensation": ["salary", "payroll", "wages", "financial records"],
|
|
399
|
+
|
|
400
|
+
// Payment providers (brand names → payment gateway concept)
|
|
401
|
+
"razorpay": ["payment gateway", "payment processing", "payment",
|
|
402
|
+
"transaction", "billing"],
|
|
403
|
+
"phonepe": ["payment gateway", "payment processing", "payment",
|
|
404
|
+
"upi", "transaction"],
|
|
405
|
+
"ccavenue": ["payment gateway", "payment processing", "payment",
|
|
406
|
+
"transaction", "billing"],
|
|
407
|
+
"paytm": ["payment gateway", "payment processing", "payment",
|
|
408
|
+
"upi", "transaction"],
|
|
409
|
+
"paypal": ["payment gateway", "payment processing", "payment",
|
|
410
|
+
"transaction", "billing"],
|
|
411
|
+
"stripe": ["payment gateway", "payment processing", "payment",
|
|
412
|
+
"transaction", "billing"],
|
|
413
|
+
"square": ["payment gateway", "payment processing", "payment",
|
|
414
|
+
"transaction", "billing"],
|
|
415
|
+
"adyen": ["payment gateway", "payment processing", "payment",
|
|
416
|
+
"transaction", "billing"],
|
|
417
|
+
"braintree": ["payment gateway", "payment processing", "payment",
|
|
418
|
+
"transaction", "billing"],
|
|
419
|
+
"upi": ["payment gateway", "payment processing", "phonepe",
|
|
420
|
+
"paytm", "transaction", "payment"],
|
|
421
|
+
|
|
387
422
|
// Logistics / Supply Chain
|
|
388
423
|
"shipment": ["cargo", "freight", "consignment", "delivery", "package",
|
|
389
424
|
"manifest", "tracking", "shipping"],
|
|
@@ -425,9 +460,18 @@ export const CONCEPT_MAP = {
|
|
|
425
460
|
// E-commerce
|
|
426
461
|
"cart": ["checkout", "purchase", "shopping cart"],
|
|
427
462
|
"payment processing":["payment", "billing", "transaction",
|
|
428
|
-
"stripe", "payment gateway"],
|
|
463
|
+
"stripe", "payment gateway", "payment provider"],
|
|
429
464
|
"payment gateway": ["payment processing", "stripe", "paypal",
|
|
430
|
-
"billing", "transaction"
|
|
465
|
+
"billing", "transaction", "payment provider",
|
|
466
|
+
"payment processor"],
|
|
467
|
+
"payment provider": ["payment gateway", "payment processing", "payment",
|
|
468
|
+
"transaction", "billing"],
|
|
469
|
+
"payment processor": ["payment gateway", "payment processing", "payment",
|
|
470
|
+
"transaction", "billing"],
|
|
471
|
+
"payment service": ["payment gateway", "payment processing", "payment",
|
|
472
|
+
"transaction", "billing"],
|
|
473
|
+
"payment platform": ["payment gateway", "payment processing", "payment",
|
|
474
|
+
"transaction", "billing"],
|
|
431
475
|
"product": ["item", "sku", "catalog", "merchandise", "product listing"],
|
|
432
476
|
"price": ["pricing", "cost", "amount", "rate", "charge"],
|
|
433
477
|
|
|
@@ -443,6 +487,13 @@ export const CONCEPT_MAP = {
|
|
|
443
487
|
"signed firmware": ["verified firmware", "trusted firmware", "secure boot"],
|
|
444
488
|
"unsigned firmware": ["unverified firmware", "untrusted firmware", "insecure"],
|
|
445
489
|
|
|
490
|
+
// Safety systems
|
|
491
|
+
"safety": ["safety system", "safeguard", "interlock", "protection"],
|
|
492
|
+
"safety system": ["safety", "interlock", "safeguard", "protection", "fail-safe"],
|
|
493
|
+
"safety systems": ["safety", "interlock", "safeguard", "protection", "fail-safe"],
|
|
494
|
+
"interlock": ["safety", "safety system", "safeguard", "protection", "fail-safe"],
|
|
495
|
+
"safeguard": ["safety", "safety system", "interlock", "protection"],
|
|
496
|
+
|
|
446
497
|
// Network
|
|
447
498
|
"network segments": ["vlans", "subnets", "network zones",
|
|
448
499
|
"network isolation", "segmentation"],
|
|
@@ -761,6 +812,22 @@ export function tokenize(text) {
|
|
|
761
812
|
words.push(w.slice(0, -1));
|
|
762
813
|
}
|
|
763
814
|
}
|
|
815
|
+
|
|
816
|
+
// Verb tense normalization — so "changed" matches "change",
|
|
817
|
+
// "processed" matches "process", "modifying" matches "modify"
|
|
818
|
+
for (const w of rawWords) {
|
|
819
|
+
if (w.endsWith("ed") && w.length > 4) {
|
|
820
|
+
words.push(w.slice(0, -1)); // "changed" → "change" (verb+d)
|
|
821
|
+
words.push(w.slice(0, -2)); // "processed" → "process" (verb+ed)
|
|
822
|
+
if (w.endsWith("ied") && w.length > 5) {
|
|
823
|
+
words.push(w.slice(0, -3) + "y"); // "modified" → "modify"
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
if (w.endsWith("ing") && w.length > 5) {
|
|
827
|
+
words.push(w.slice(0, -3)); // "processing" → "process"
|
|
828
|
+
words.push(w.slice(0, -3) + "e"); // "changing" → "change"
|
|
829
|
+
}
|
|
830
|
+
}
|
|
764
831
|
const uniqueWords = [...new Set(words)];
|
|
765
832
|
|
|
766
833
|
const all = [...new Set([...phrases, ...uniqueWords])];
|
|
@@ -979,15 +1046,38 @@ function extractProhibitedVerb(lockText) {
|
|
|
979
1046
|
for (const pattern of patterns) {
|
|
980
1047
|
const match = lower.match(pattern);
|
|
981
1048
|
if (match) {
|
|
982
|
-
|
|
1049
|
+
let verb = match[1].trim();
|
|
1050
|
+
// Handle passive voice: "must not be changed" → "changed" → stem → "change"
|
|
1051
|
+
if (verb.startsWith("be ")) verb = verb.slice(3);
|
|
983
1052
|
// Check multi-word markers first
|
|
984
1053
|
const allMarkers = [...NEGATIVE_INTENT_MARKERS, ...POSITIVE_INTENT_MARKERS]
|
|
985
1054
|
.sort((a, b) => b.length - a.length);
|
|
986
1055
|
for (const marker of allMarkers) {
|
|
987
1056
|
if (verb.startsWith(marker)) return marker;
|
|
988
1057
|
}
|
|
989
|
-
//
|
|
990
|
-
|
|
1058
|
+
// Stem -ed/-ing verb forms: "changed" → "change", "modified" → "modify"
|
|
1059
|
+
const firstWord = verb.split(/\s+/)[0];
|
|
1060
|
+
if (firstWord.endsWith("ed") && firstWord.length > 4) {
|
|
1061
|
+
const stem1 = firstWord.slice(0, -1); // changed → change
|
|
1062
|
+
const stem2 = firstWord.slice(0, -2); // processed → process
|
|
1063
|
+
for (const marker of allMarkers) {
|
|
1064
|
+
if (stem1 === marker || stem2 === marker) return marker;
|
|
1065
|
+
}
|
|
1066
|
+
if (firstWord.endsWith("ied") && firstWord.length > 5) {
|
|
1067
|
+
const stem3 = firstWord.slice(0, -3) + "y"; // modified → modify
|
|
1068
|
+
for (const marker of allMarkers) {
|
|
1069
|
+
if (stem3 === marker) return marker;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
if (firstWord.endsWith("ing") && firstWord.length > 5) {
|
|
1074
|
+
const stem1 = firstWord.slice(0, -3); // processing → process
|
|
1075
|
+
const stem2 = firstWord.slice(0, -3) + "e"; // changing → change
|
|
1076
|
+
for (const marker of allMarkers) {
|
|
1077
|
+
if (stem1 === marker || stem2 === marker) return marker;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
return firstWord;
|
|
991
1081
|
}
|
|
992
1082
|
}
|
|
993
1083
|
return null;
|
|
@@ -1098,6 +1188,7 @@ const _CONTAMINATING_VERBS = new Set([
|
|
|
1098
1188
|
"reconcile", "reverse", "recalculate", "backdate", "rebalance",
|
|
1099
1189
|
"reroute", "divert", "reassign", "rebook", "cancel",
|
|
1100
1190
|
"upgrade", "downgrade", "patch", "bump",
|
|
1191
|
+
"optimize", "streamline", "modernize", "overhaul", "revamp",
|
|
1101
1192
|
]);
|
|
1102
1193
|
|
|
1103
1194
|
const _FILLER_WORDS = new Set([
|
|
@@ -1806,6 +1897,30 @@ export function scoreConflict({ actionText, lockText }) {
|
|
|
1806
1897
|
`no scope overlap — different components despite shared vocabulary`);
|
|
1807
1898
|
}
|
|
1808
1899
|
}
|
|
1900
|
+
|
|
1901
|
+
// 5c: UI/cosmetic changes that share a location word with a system lock.
|
|
1902
|
+
// "Change the font on the login page" shares "login" with auth locks,
|
|
1903
|
+
// but changing a font/color/style is a visual change, not a system modification.
|
|
1904
|
+
// Only applies when scope overlap is WEAK (shared location word, not shared target).
|
|
1905
|
+
const UI_COSMETIC_WORDS = new Set([
|
|
1906
|
+
"font", "fonts", "color", "colors", "colour", "theme", "themes",
|
|
1907
|
+
"styling", "style", "styles", "css", "icon", "icons", "layout",
|
|
1908
|
+
"margin", "padding", "border", "background", "typography", "spacing",
|
|
1909
|
+
"alignment", "animation", "transition", "hover", "tooltip",
|
|
1910
|
+
"placeholder", "logo", "image", "banner", "hero", "avatar",
|
|
1911
|
+
"sidebar", "navigation", "menu", "breadcrumb", "footer",
|
|
1912
|
+
]);
|
|
1913
|
+
if (!intentAligned && !hasStrongScopeMatch && !hasStrongVocabMatch) {
|
|
1914
|
+
const actionLower = actionText.toLowerCase();
|
|
1915
|
+
const actionWords = actionLower.split(/\s+/).map(w => w.replace(/[^a-z]/g, ""));
|
|
1916
|
+
const hasUISubject = actionWords.some(w => UI_COSMETIC_WORDS.has(w));
|
|
1917
|
+
if (hasUISubject) {
|
|
1918
|
+
intentAligned = true;
|
|
1919
|
+
reasons.push(
|
|
1920
|
+
`intent alignment: UI/cosmetic change — visual modification, ` +
|
|
1921
|
+
`not system logic change`);
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1809
1924
|
}
|
|
1810
1925
|
|
|
1811
1926
|
// If intent is ALIGNED, the action is COMPLIANT — slash the score to near zero
|
|
@@ -1821,10 +1936,6 @@ export function scoreConflict({ actionText, lockText }) {
|
|
|
1821
1936
|
// Either: scope overlap (subject extraction confirms same target)
|
|
1822
1937
|
// Or: 2+ direct word overlaps (not just a single shared word)
|
|
1823
1938
|
// 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
1939
|
const hasStrongSubjectMatch = hasStrongScopeMatch ||
|
|
1829
1940
|
directOverlap.length >= 2 ||
|
|
1830
1941
|
phraseOverlap.length > 0;
|
package/src/core/telemetry.js
CHANGED
|
@@ -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.
|
|
260
|
+
version: "4.4.2",
|
|
261
261
|
totalCalls: summary.totalCalls,
|
|
262
262
|
avgResponseMs: summary.avgResponseMs,
|
|
263
263
|
conflicts: summary.conflicts,
|
package/src/dashboard/index.html
CHANGED
|
@@ -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.
|
|
92
|
+
<div class="meta">v4.4.2 — 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.
|
|
185
|
+
SpecLock v4.4.2 — Developed by Sandeep Roy — <a href="https://github.com/sgroy10/speclock" style="color:var(--accent)">GitHub</a>
|
|
186
186
|
</div>
|
|
187
187
|
|
|
188
188
|
<script>
|
package/src/mcp/http-server.js
CHANGED
|
@@ -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.
|
|
94
|
+
const VERSION = "4.4.2";
|
|
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.
|
|
103
|
+
const VERSION = "4.4.2";
|
|
104
104
|
const AUTHOR = "Sandeep Roy";
|
|
105
105
|
|
|
106
106
|
const server = new McpServer(
|