This repository has been archived on 2026-03-24 . You can view files and clone it. You cannot open issues or pull requests or push a commit.
512089ca080adcf2fc4a8d9237e2578abd15c328
1. Add `estimateRequestCost(request, model)` to PricingService in pricing.ts - Unified method combining estimateInputTokens + estimateOutputTokens + calculateWorkFeeUsd - Replaces duplicated token estimation logic at call sites in jobs.ts, sessions.ts, estimate.ts 2. Move partial free-tier `recordGrant()` from invoice creation to post-work in runWorkInBackground - Previously called at invoice creation for partial path (before user pays) — economic DoS vulnerability - Now deferred to after work completes, using new `partialAbsorbSats` parameter in runWorkInBackground - Fully-free jobs still record grant at eval time (no payment involved) 3. Sessions pre-gate refactor: estimate → decide → execute → reconcile - Free-tier `decide()` now runs on ESTIMATED cost BEFORE `executeWork()` is called - After execution, `absorbedSats` is capped at actual cost (Math.min) to prevent over-absorption - Uses new `estimateRequestCost()` for clean single-call estimation
Description
Timmy — Lightning-gated AI agent (TypeScript/Express)
Languages
TypeScript
68.2%
JavaScript
14.8%
Shell
12.4%
HTML
4.1%
CSS
0.4%