apodictic-sdk 0.0.0-stage → 3.9.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.
- package/README.md +58 -2
- package/package.json +29 -4
- package/src/enclave_worker.py +717 -0
- package/src/index.d.ts +157 -0
- package/src/index.mjs +622 -0
- package/src/odoo20_guard.mjs +321 -0
- package/src/pglite_shadow.d.mts +36 -0
- package/src/pglite_shadow.mjs +286 -0
- package/src/standalone_z3_enclave.py +2094 -0
- package/src/z3_wasm_verifier.mjs +1314 -0
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `apodictic-sdk`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pre-commit formal verification & Zero-PII symbolic gateway SDK for AI agents writing to PostgreSQL, Odoo 18–20 (`/json/2/` Bearer API & `/jsonrpc`), Stripe, and enterprise ledgers.
|
|
4
|
+
|
|
5
|
+
Runs **100% locally with zero Python required** via bundled Microsoft **Z3 5.4.1 WebAssembly** (`z3-solver`), **WASM PostgreSQL 17** (`@electric-sql/pglite`), and SQLite WAL persistence — or seamlessly delegates to Python Z3 5.4.1 (`engine: 'auto'`), the native Rust kernel (`engine: 'rust'`), or HTTPS (`/api/v1/enclave`).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install apodictic-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { SymbolicGateway } from 'apodictic-sdk';
|
|
17
|
+
|
|
18
|
+
const gw = new SymbolicGateway({
|
|
19
|
+
posture: 'MODE_B_HYBRID', // or MODE_A_AIRGAP with { airgap: true }
|
|
20
|
+
engine: 'auto', // 'auto' | 'wasm' | 'python' | 'rust'
|
|
21
|
+
endpoint: process.env.APODICTIC_ENDPOINT, // optional remote /api/v1/enclave URL
|
|
22
|
+
forbidRawLiterals: true,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// 1. Strip spaced/hyphenated IBANs, Luhn PANs, tax IDs, emails, and secrets locally before LLM calls
|
|
26
|
+
const { sanitized } = gw.scrubSqlAst("PAY iban='DE89 3704 0044 0532 0130 00' amount=14200");
|
|
27
|
+
|
|
28
|
+
// 2. Verify proposed SQL mutation before commit (verifySql or verifyMutation)
|
|
29
|
+
const verdict = await gw.verifySql('UPDATE invoices SET total = 100 WHERE id = 1;', {
|
|
30
|
+
amount: 100,
|
|
31
|
+
currentBalance: 250000,
|
|
32
|
+
minReserve: 50000,
|
|
33
|
+
maxAutonomousLimit: 50000,
|
|
34
|
+
cfoSigned: true,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
if (!verdict.verified) throw new Error(`Blocked: ${verdict.reason}`);
|
|
38
|
+
|
|
39
|
+
// 3. Shadow-execute inside WASM Postgres 17 (ROLLBACK unconditionally) + Z3 proof
|
|
40
|
+
const shadow = await gw.shadowExecuteAndProve({
|
|
41
|
+
sql: "UPDATE accounts SET balance = balance - 12500 WHERE id = 'acc_treasury';",
|
|
42
|
+
accountId: 'acc_treasury',
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// 4. Verify Odoo 19/20 JSON-2 & MCP scope invariants
|
|
46
|
+
const odooCheck = await gw.verifyMutation({
|
|
47
|
+
sql: 'POST /json/2/account.move/button_draft',
|
|
48
|
+
odoo: {
|
|
49
|
+
model: 'account.move',
|
|
50
|
+
method: 'button_draft',
|
|
51
|
+
bearerScope: 'mcp',
|
|
52
|
+
moveDate: '2026-09-01',
|
|
53
|
+
hardLockDate: '2026-09-30',
|
|
54
|
+
inalterableHash: '9f86d081884c7d65',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
await gw.close();
|
|
59
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apodictic-sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "3.9.0",
|
|
4
|
+
"description": "Production TypeScript/Node SDK for Apodictic Pre-Commit Z3 Verification & Zero-PII Symbolic Gateway",
|
|
5
|
+
"homepage": "https://apodictic.dev",
|
|
6
|
+
"author": "Sofian Mousa <sofianmousa@apodictic.dev>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./src/index.mjs",
|
|
9
|
+
"types": "./src/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"src/*.mjs",
|
|
12
|
+
"src/*.py",
|
|
13
|
+
"src/*.d.ts",
|
|
14
|
+
"src/*.d.mts",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./src/index.d.ts",
|
|
20
|
+
"default": "./src/index.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"test": "node ./test.mjs"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@electric-sql/pglite": "^0.5.17",
|
|
29
|
+
"z3-solver": "^5.4.1"
|
|
30
|
+
}
|
|
31
|
+
}
|