pot_stats
Retrieve Proof of Time statistics including total swaps, turbo/full counts, and turbo ratio for specified time periods (day, week, month).
Instructions
Get PoT statistics: total swaps, turbo/full counts, and turbo ratio for a given period.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | Yes | Time period for statistics |
Implementation Reference
- tools.ts:187-217 (handler)The implementation of the pot_stats tool, which calculates statistics about Proof of Time (PoT) anchors over a given period based on the in-memory log.
// ---------- Tool: pot_stats ---------- export async function potStats(args: { period: "day" | "week" | "month"; }): Promise<unknown> { telemetryIncrement("pot_stats"); const now = Date.now(); const periodMs: Record<string, number> = { day: 86400_000, week: 604800_000, month: 2592000_000, }; const cutoff = now - (periodMs[args.period] ?? periodMs.day); const entries = potLog.filter((e) => e.createdAt >= cutoff); const turboCount = entries.filter((e) => e.mode === AdaptiveMode.TURBO).length; const fullCount = entries.filter((e) => e.mode === AdaptiveMode.FULL).length; const totalSwaps = entries.length; return serialize({ period: args.period, totalSwaps, turboCount, fullCount, turboRatio: totalSwaps > 0 ? +(turboCount / totalSwaps).toFixed(4) : 0, currentMode: adaptiveSwitch.getCurrentMode(), windowStart: new Date(cutoff).toISOString(), windowEnd: new Date(now).toISOString(), }); }