From d9b00c203e54de688cd3984b10b516262365ec05 Mon Sep 17 00:00:00 2001 From: alexpaynex <55271826-alexpaynex@users.noreply.replit.com> Date: Thu, 19 Mar 2026 18:10:11 +0000 Subject: [PATCH] =?UTF-8?q?task-28:=20Edge=20intelligence=20=E2=80=94=20br?= =?UTF-8?q?owser=20Transformers.js=20triage,=20Nostr=20signing,=20cost=20p?= =?UTF-8?q?review,=20sentiment=20moods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What was built Five components of Task #28 implemented: 1. js/edge-worker.js (new) — Transformers.js zero-shot-classification + SST-2 sentiment, lazy model loading, fast heuristic greeting bypass, warmup() pre-loader. 2. js/nostr-identity.js (new) — NIP-07 extension preferred (window.nostr), falls back to generated localStorage keypair; challenge→sign→verify flow with the /api/nostr/challenge + /api/nostr/verify endpoints; token cached in localStorage with 23 h TTL. 3. js/agents.js — setMood() export maps POSITIVE/NEGATIVE/NEUTRAL sentiment labels to Timmy face states (curious/focused/contemplative) via existing setFaceEmotion() + MOOD_ALIASES infrastructure. 4. js/ui.js — edge triage on every send: trivial/greeting → answered locally with "local ⚡ 0 sats" badge, no server round-trip; cost preview badge debounced 300 ms via GET /api/estimate, shows FREE / partial / full cost; sentiment-driven setMood() on every user message (auto-clears after 8 s). 5. js/payment.js, js/session.js — X-Nostr-Token header injected on all authenticated API calls (POST /jobs, POST /sessions, POST session/request). session.js also runs sentiment → setMood() on every session send. 6. js/main.js — initNostrIdentity('/api') + warmupEdgeWorker() called on firstInit. 7. vite.config.js — optimizeDeps.exclude @xenova/transformers to prevent Vite from pre-bundling the WASM/dynamic-import-heavy transformer library. 8. the-matrix/package.json — nostr-tools, @xenova/transformers added as deps. ## No server-side changes — all Task #28 work is frontend-only.