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/src/index.d.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export interface SymbolicGatewayOptions {
|
|
2
|
+
posture?: 'MODE_A_AIRGAP' | 'MODE_B_HYBRID';
|
|
3
|
+
airgap?: boolean;
|
|
4
|
+
vaultPath?: string;
|
|
5
|
+
forbidRawLiterals?: boolean;
|
|
6
|
+
endpoint?: string;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
repoRoot?: string;
|
|
9
|
+
pythonBin?: string;
|
|
10
|
+
engine?: 'python' | 'wasm' | 'rust' | 'auto';
|
|
11
|
+
rustKernelPath?: string;
|
|
12
|
+
stateDbPath?: string;
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ScrubResult {
|
|
17
|
+
sanitized: string;
|
|
18
|
+
redactions: number;
|
|
19
|
+
symbolCount: number;
|
|
20
|
+
dlpChecksums?: {
|
|
21
|
+
ibanMod97ValidCount: number;
|
|
22
|
+
luhnPanValidCount: number;
|
|
23
|
+
validators: string[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface VerifyMutationInput {
|
|
28
|
+
sql: string;
|
|
29
|
+
action?: string;
|
|
30
|
+
accountId?: string;
|
|
31
|
+
amount?: number;
|
|
32
|
+
debitTotal?: number;
|
|
33
|
+
creditTotal?: number;
|
|
34
|
+
pgoutputHex?: string;
|
|
35
|
+
engine?: 'python' | 'wasm' | 'rust';
|
|
36
|
+
stateless?: boolean;
|
|
37
|
+
currentBalance?: number;
|
|
38
|
+
minReserve?: number;
|
|
39
|
+
maxAutonomousLimit?: number;
|
|
40
|
+
cfoSigned?: boolean;
|
|
41
|
+
statutoryVat?: number;
|
|
42
|
+
expectedVat?: number;
|
|
43
|
+
targetSystem?: 'postgresql' | 'odoo_v18' | 'odoo_v19' | 'odoo_v20' | 'sap_s4hana' | 'stripe';
|
|
44
|
+
odoo?: Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface VerifyMutationResult {
|
|
48
|
+
verdict: 'SAT' | 'UNSAT';
|
|
49
|
+
verified: boolean;
|
|
50
|
+
engine: string;
|
|
51
|
+
proofId?: string;
|
|
52
|
+
proofDigest?: string;
|
|
53
|
+
blockIndex?: number;
|
|
54
|
+
blockHash?: string;
|
|
55
|
+
rollbackBatchId?: string | null;
|
|
56
|
+
escrowStatus?: string | null;
|
|
57
|
+
doubleEntryAccount?: Record<string, unknown> | null;
|
|
58
|
+
walBeforeImage?: Record<string, unknown> | null;
|
|
59
|
+
rfc6962LeafHash?: string | null;
|
|
60
|
+
rfc6962TreeRoot?: string | null;
|
|
61
|
+
dlpChecksums?: Record<string, unknown> | null;
|
|
62
|
+
odoo20Evaluation?: Record<string, unknown>;
|
|
63
|
+
z3SolveMs?: number;
|
|
64
|
+
totalLatencyMs?: number;
|
|
65
|
+
redactions: number;
|
|
66
|
+
sanitizedSql: string;
|
|
67
|
+
counterfactualPatch?: {
|
|
68
|
+
max_safe_amount: number;
|
|
69
|
+
reduction_delta: number;
|
|
70
|
+
patched_sql: string | null;
|
|
71
|
+
solver: string;
|
|
72
|
+
} | null;
|
|
73
|
+
reason?: string | null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ThreeWayMatchInput {
|
|
77
|
+
po: { poId: string; sku: string; orderedQty: number; unitPrice: number };
|
|
78
|
+
receipts: Array<{ receiptId: string; poId: string; sku: string; receivedQty: number }>;
|
|
79
|
+
invoices: Array<{ invoiceId: string; poId: string; sku: string; billedQty: number; billedUnitPrice: number }>;
|
|
80
|
+
priceTolerancePct?: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface TaxComplianceInput {
|
|
84
|
+
jurisdiction: 'KSA_ZATCA' | 'EGYPT_ETA' | 'EU_VAT_DE' | 'EU_REVERSE_CHARGE';
|
|
85
|
+
lines: Array<{
|
|
86
|
+
sku: string;
|
|
87
|
+
netAmount: number;
|
|
88
|
+
claimedVatAmount: number;
|
|
89
|
+
claimedWhtAmount?: number;
|
|
90
|
+
isExempt?: boolean;
|
|
91
|
+
}>;
|
|
92
|
+
hasCryptographicStamp?: boolean;
|
|
93
|
+
tolerance?: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export declare class SymbolicGateway {
|
|
97
|
+
constructor(options?: SymbolicGatewayOptions);
|
|
98
|
+
scrubSqlAst(input: string, opts?: { scrubQuotedLiterals?: boolean }): ScrubResult;
|
|
99
|
+
rehydrate(text: string): string;
|
|
100
|
+
verifyMutation(input: VerifyMutationInput): Promise<VerifyMutationResult>;
|
|
101
|
+
verifyMutationNativeRust(input: VerifyMutationInput): Promise<VerifyMutationResult>;
|
|
102
|
+
shadowExecuteAndProve(input?: VerifyMutationInput & { schemaSql?: string; seedSql?: string }): Promise<{
|
|
103
|
+
verdict: 'SAT' | 'UNSAT';
|
|
104
|
+
verified: boolean;
|
|
105
|
+
engine: 'apodictic-pglite-shadow-z3';
|
|
106
|
+
rowsAffected: number;
|
|
107
|
+
observedDebit: number;
|
|
108
|
+
observedDeltas: Record<string, { before: number; after: number; delta: number }>;
|
|
109
|
+
postBalances: Record<string, number>;
|
|
110
|
+
z3Proof: VerifyMutationResult;
|
|
111
|
+
counterfactualPatch: VerifyMutationResult['counterfactualPatch'];
|
|
112
|
+
reason?: string | null;
|
|
113
|
+
executionError?: string | null;
|
|
114
|
+
latencyMs: number;
|
|
115
|
+
}>;
|
|
116
|
+
verifySql(sql: string, options?: Omit<VerifyMutationInput, 'sql'>): Promise<VerifyMutationResult>;
|
|
117
|
+
rollback(batchId: string): Promise<Record<string, unknown>>;
|
|
118
|
+
verifyThreeWayMatch(input: ThreeWayMatchInput): Promise<Record<string, unknown>>;
|
|
119
|
+
verifyTaxCompliance(input: TaxComplianceInput): Promise<Record<string, unknown>>;
|
|
120
|
+
bitemporalInsert(input: { entityId: string; data: Record<string, unknown>; validStart: number; validEnd?: number; systemTime?: number }): Promise<Record<string, unknown>>;
|
|
121
|
+
bitemporalRestate(input: { entityId: string; data: Record<string, unknown>; validStart: number; validEnd?: number; systemTime?: number }): Promise<Record<string, unknown>>;
|
|
122
|
+
bitemporalAsOf(input: { entityId: string; validTime: number; systemTime: number }): Promise<{ found: boolean; data: Record<string, unknown> | null }>;
|
|
123
|
+
verifyAuditChain(): Promise<{ valid: boolean; block_count: number; tip_hash: string }>;
|
|
124
|
+
flushEscrow(options?: { batchId?: string; coolingWindowSec?: number }): Promise<Record<string, unknown>>;
|
|
125
|
+
evaluatePolicy(options?: {
|
|
126
|
+
policyText?: string;
|
|
127
|
+
action?: string;
|
|
128
|
+
principal?: string;
|
|
129
|
+
resource?: string;
|
|
130
|
+
entityHierarchy?: Record<string, string[]>;
|
|
131
|
+
context?: Record<string, unknown>;
|
|
132
|
+
amount?: number;
|
|
133
|
+
currentBalance?: number;
|
|
134
|
+
minReserve?: number;
|
|
135
|
+
spendingLimit?: number;
|
|
136
|
+
cfoSigned?: boolean;
|
|
137
|
+
reversalArmed?: boolean;
|
|
138
|
+
}): Promise<Record<string, unknown>>;
|
|
139
|
+
getMerkleInclusionProof(blockIndex?: number): Promise<{
|
|
140
|
+
spec: string;
|
|
141
|
+
block_index: number;
|
|
142
|
+
leaf_index: number;
|
|
143
|
+
tree_size: number;
|
|
144
|
+
leaf_hash: string | null;
|
|
145
|
+
root_hash: string;
|
|
146
|
+
audit_path: string[];
|
|
147
|
+
inclusion_verified: boolean;
|
|
148
|
+
}>;
|
|
149
|
+
health(): Promise<Record<string, unknown>>;
|
|
150
|
+
close(): Promise<void>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { PGlite } from '@electric-sql/pglite';
|
|
154
|
+
export { ShadowPostgresVerifier } from './pglite_shadow.mjs';
|
|
155
|
+
export { Z3WasmEnclaveSession } from './z3_wasm_verifier.mjs';
|
|
156
|
+
export { evaluateOdoo20Call, extractOdoo20Call } from './odoo20_guard.mjs';
|
|
157
|
+
export default SymbolicGateway;
|