@sigmashake/ssg 0.12.12 → 0.12.14
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/README.md +28 -13
- package/bin/ssg.cjs +15 -7
- package/package.json +5 -2
- package/ssg +0 -0
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ The [`rules-typescript`](https://hub.sigmashake.com) ruleset on the SigmaShake H
|
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
rule no-sourcemap-in-tsconfig {
|
|
15
|
+
enabled true
|
|
15
16
|
priority 95
|
|
16
17
|
severity error
|
|
17
18
|
DENY write
|
|
@@ -43,6 +44,11 @@ ssg init
|
|
|
43
44
|
echo '{"tool":"Bash","input":{"command":"rm -rf /"}}' | ssg eval
|
|
44
45
|
# → {"decision":"block", "rule_id":"no-destructive-ops", ...}
|
|
45
46
|
|
|
47
|
+
# Start persistent daemon for sub-2ms eval (recommended)
|
|
48
|
+
ssg daemon &
|
|
49
|
+
echo '{"tool":"Bash","input":{"command":"ls"}}' | nc -U ~/.sigmashake/evald.sock
|
|
50
|
+
# → {"decision":"allow", "duration_ns":150000, ...}
|
|
51
|
+
|
|
46
52
|
# Start approval dashboard
|
|
47
53
|
ssg serve
|
|
48
54
|
```
|
|
@@ -58,16 +64,22 @@ sigmashake-gov provides **runtime safety for AI agents** by:
|
|
|
58
64
|
## Architecture
|
|
59
65
|
|
|
60
66
|
```
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
Agent Tool Call
|
|
68
|
+
↓
|
|
69
|
+
Hook → ┌─ Daemon (Unix socket, ~0.1-2ms) ← recommended
|
|
70
|
+
└─ ssg eval (subprocess, ~73ms+)
|
|
71
|
+
↓
|
|
72
|
+
Engine: Native (Zig/Rust, ~5-30µs) → TS Rule Index → TS evaluate
|
|
73
|
+
↓
|
|
74
|
+
Decision → Audit Log → Dashboard (if ASK)
|
|
66
75
|
```
|
|
67
76
|
|
|
68
|
-
- **
|
|
77
|
+
- **Daemon**: Persistent process (`ssg daemon`) — keeps rules, DB, and native engine hot in memory
|
|
78
|
+
- **Native Engine**: Zig + Rust FFI with SIMD-accelerated matching and zero-alloc eval
|
|
69
79
|
- **Engine Core**: Rules parser, evaluation logic, SQLite database
|
|
70
|
-
- **Server**: Local dashboard
|
|
80
|
+
- **Server**: Local dashboard (server-rendered HTML + HTMX + SSE for real-time updates)
|
|
81
|
+
|
|
82
|
+
See `ARCHITECTURE.md` for full system diagrams and performance budget.
|
|
71
83
|
|
|
72
84
|
## Commands
|
|
73
85
|
|
|
@@ -91,9 +103,9 @@ CLI → Engine (Parser/Evaluate/DB) → Decision
|
|
|
91
103
|
| `ssg blocked` | Show blocked/forced commands from this session |
|
|
92
104
|
| `ssg usage` | Show eval usage, storage, and plan limits |
|
|
93
105
|
| `ssg dedupe` | Detect duplicate rules (exact/structural/semantic) |
|
|
106
|
+
| `ssg daemon` | Persistent eval daemon (Unix socket, sub-2ms eval) |
|
|
107
|
+
| `ssg profile` | Eval latency profiling (flight logs + live daemon metrics) |
|
|
94
108
|
| `ssg flight` | Flight recorder stats (latency, memory, CPU) |
|
|
95
|
-
| `ssg profile` | Eval latency profiling |
|
|
96
|
-
| `ssg daemon` | Persistent eval daemon (Unix socket, ~5ms eval) |
|
|
97
109
|
| `ssg install` | Install ssg binary to `~/.local/bin` |
|
|
98
110
|
| `ssg publish` | Publish local `.rules` to GitHub and hub |
|
|
99
111
|
| `ssg certify` | Run scenario files and produce certification report |
|
|
@@ -103,6 +115,7 @@ CLI → Engine (Parser/Evaluate/DB) → Decision
|
|
|
103
115
|
|
|
104
116
|
```
|
|
105
117
|
rule no-destructive-ops {
|
|
118
|
+
enabled true
|
|
106
119
|
priority 100
|
|
107
120
|
severity error
|
|
108
121
|
DENY execution
|
|
@@ -153,7 +166,7 @@ Rules from `.sigmashake/rules/*.rules` are loaded fresh on every `ssg eval` invo
|
|
|
153
166
|
|
|
154
167
|
ssg enforces governance for multiple AI coding agents from a single rule set:
|
|
155
168
|
|
|
156
|
-
- **Claude Code**:
|
|
169
|
+
- **Claude Code**: `ssg hook eval` registered as PreToolUse hook — evaluates tool calls via daemon or subprocess
|
|
157
170
|
|
|
158
171
|
Both agents share the same rules from `.sigmashake/rules/` and log to the same SQLite audit database.
|
|
159
172
|
|
|
@@ -161,7 +174,9 @@ Both agents share the same rules from `.sigmashake/rules/` and log to the same S
|
|
|
161
174
|
|
|
162
175
|
- **Loop guard**: Blocks identical Bash commands repeated 3 times consecutively (prevents agent loops)
|
|
163
176
|
- **Circuit breaker**: After 5 consecutive denies in Claude Code hook, auto-allows to prevent lockout. Reset by deleting `/tmp/ssg-deny-count`.
|
|
177
|
+
- **Rate limiter**: Per-PID token bucket in daemon (1000 burst, 500/s refill) with permanent trip on exhaustion
|
|
164
178
|
- **Fail-open**: If the ssg binary is missing or crashes, tool calls are allowed through — governance never blocks the agent entirely.
|
|
179
|
+
- **Native engine fail-secure**: Invalid regex patterns in native Zig engine default to `match=true` (block) with ReDoS protection
|
|
165
180
|
|
|
166
181
|
## Build
|
|
167
182
|
|
|
@@ -174,13 +189,13 @@ bun build:macos # macOS ARM
|
|
|
174
189
|
## Tests
|
|
175
190
|
|
|
176
191
|
```bash
|
|
177
|
-
bun test # All
|
|
192
|
+
bun test # All 931 tests
|
|
178
193
|
bun test test/engine.test.ts # Engine only
|
|
179
194
|
npx gts fix # Format + lint
|
|
180
195
|
```
|
|
181
196
|
|
|
182
|
-
Tests: `engine`, `parser`, `evaluate_operators`, `db`, `server`, `html`, `integration`.
|
|
197
|
+
Tests: `engine`, `parser`, `evaluate_operators`, `db`, `server`, `html`, `integration`, `e2e-daemon`, `daemon-metrics`, `flight-recorder`, `certify`.
|
|
183
198
|
|
|
184
199
|
---
|
|
185
200
|
|
|
186
|
-
**License**: Proprietary — Copyright (c)
|
|
201
|
+
**License**: Proprietary — Copyright (c) 2026 Sigma Shake. All rights reserved.
|
package/bin/ssg.cjs
CHANGED
|
@@ -12,14 +12,22 @@ const ext = process.platform === 'win32' ? '.exe' : '';
|
|
|
12
12
|
const platformPkg = `@sigmashake/ssg-${process.platform}-${process.arch}`;
|
|
13
13
|
let binaryPath;
|
|
14
14
|
|
|
15
|
-
// 1.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
// 1. Check if binary was bundled in the root (via local npm pack or manual build)
|
|
16
|
+
const rootBin = path.resolve(__dirname, '..', `ssg${ext}`);
|
|
17
|
+
if (fs.existsSync(rootBin)) {
|
|
18
|
+
binaryPath = rootBin;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// 2. Try platform-specific optional dependency (npm install path)
|
|
22
|
+
if (!binaryPath) {
|
|
23
|
+
try {
|
|
24
|
+
const pkgRoot = path.dirname(require.resolve(`${platformPkg}/package.json`));
|
|
25
|
+
const candidate = path.join(pkgRoot, 'bin', `ssg${ext}`);
|
|
26
|
+
if (fs.existsSync(candidate)) binaryPath = candidate;
|
|
27
|
+
} catch {}
|
|
28
|
+
}
|
|
21
29
|
|
|
22
|
-
//
|
|
30
|
+
// 3. Fall back to local dist/ (dev build / bun build --compile)
|
|
23
31
|
if (!binaryPath) {
|
|
24
32
|
const devBin = path.resolve(
|
|
25
33
|
__dirname, '..', 'dist',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigmashake/ssg",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.14",
|
|
4
4
|
"description": "AI Agent Governance CLI — evaluate tool calls against rules, block dangerous operations, and surface blocked commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/",
|
|
11
11
|
"public/",
|
|
12
|
+
"ssg",
|
|
12
13
|
"LICENSE",
|
|
13
14
|
"README.md"
|
|
14
15
|
],
|
|
@@ -111,5 +112,7 @@
|
|
|
111
112
|
"urlpattern-polyfill": "10.1.0",
|
|
112
113
|
"vite": "8.0.1"
|
|
113
114
|
},
|
|
114
|
-
"dependencies": {
|
|
115
|
+
"dependencies": {
|
|
116
|
+
"re2": "^1.24.0"
|
|
117
|
+
}
|
|
115
118
|
}
|
package/ssg
ADDED
|
Binary file
|