@sperax/tool-defi-exploits
v0.1.1
Published
SperaxOS builtin tool: DeFi Exploits — historical protocol exploit and incident data for AI agents.
Maintainers
Readme
@sperax/tool-defi-exploits
Defi Hacks — a headless SperaxOS builtin tool. Ships the manifest (the tool definition an LLM sees) and the executor (the code that runs when the model calls it). No UI, no React required.
Install
npm install @sperax/tool-defi-exploitsUsage
import { readdirSync } from 'node:fs';Import the manifest to register the tool with your agent, and the executor to run the calls it produces:
import * as tool from '@sperax/tool-defi-exploits';
// The manifest is the tool definition: identifier, meta, systemRole, and the
// 'api' array of callable functions with JSON-Schema parameters.
const manifest = Object.values(tool).find(
(v: any) => v && typeof v === 'object' && Array.isArray((v as any).api),
);
console.log(manifest.identifier);
console.log(manifest.api.map((a: any) => a.name));// Executors are exported from the /executor subpath.
import { ... } from '@sperax/tool-defi-exploits/executor';
// Every executor exposes the same interface:
// invoke(apiName, params, ctx) => Promise<BuiltinToolResult>
// hasApi(apiName) => boolean
// getApiNames() => string[]A BuiltinToolResult is { success, content?, state?, error? } — content
is prose for the model to read, state is the typed payload for a UI.
Contract
Types come from @sperax/tool-kit.
License
Apache-2.0
