Trustless hosting extension for Moltbot via EigenCloud infrastructure: - EigenAI provider with x-api-key auth and configPatch registration - Action tier classification for all 23 canonical tools - Receipt logging on after_tool_call hook (medium/high tier) - Anomaly detection (BCC, outbound curl, process, gateway) - SQLite receipt store with EigenDA proxy backend - Dashboard API endpoints (/boltbot/receipts, /receipt, /stats) - EigenCompute TEE deploy script and Dockerfile
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import type { ActionReceipt, ReceiptStore } from "../receipt-store.js";
|
|
import { LocalReceiptStore } from "./local.js";
|
|
|
|
export class EigenDAReceiptStore implements ReceiptStore {
|
|
private proxyUrl: string;
|
|
private localIndex: LocalReceiptStore;
|
|
|
|
constructor(proxyUrl: string, dbPath = "boltbot-eigenda-index.db") {
|
|
this.proxyUrl = proxyUrl;
|
|
this.localIndex = new LocalReceiptStore(dbPath);
|
|
}
|
|
|
|
async put(receipt: ActionReceipt): Promise<void> {
|
|
const blob = Buffer.from(JSON.stringify(receipt));
|
|
try {
|
|
const res = await fetch(`${this.proxyUrl}/put`, {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/octet-stream" },
|
|
body: blob,
|
|
});
|
|
if (res.ok) {
|
|
receipt.daCommitment = Buffer.from(await res.arrayBuffer()).toString("hex");
|
|
}
|
|
} catch {
|
|
// DA failure is non-fatal
|
|
}
|
|
|
|
await this.localIndex.put(receipt);
|
|
}
|
|
|
|
async get(id: string): Promise<ActionReceipt | null> {
|
|
return this.localIndex.get(id);
|
|
}
|
|
|
|
async list(opts: { limit: number; offset: number }): Promise<ActionReceipt[]> {
|
|
return this.localIndex.list(opts);
|
|
}
|
|
|
|
async stats() {
|
|
return this.localIndex.stats();
|
|
}
|
|
}
|