task-28: Edge intelligence — Web Worker triage, Nostr signing, cost preview, sentiment moods (3 review cycles)
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
## Summary of all changes
### New files
- the-matrix/js/edge-worker.js — Proper Web Worker with postMessage API; Transformers.js
zero-shot-classification + SST-2 sentiment running in worker thread; signals {type:'ready'}
when models warm; env.useBrowserCache=true for browser Cache API model caching
- the-matrix/js/edge-worker-client.js — Main-thread proxy; spawns Worker via
new Worker(url, {type:'module'}); wraps calls as Promises; warmup()/onReady()/isReady();
graceful fallback if Workers unavailable
### Modified files
- js/agents.js: setMood() export maps POSITIVE/NEGATIVE/NEUTRAL → face expressions
- js/nostr-identity.js: Fixed API endpoints (POST /identity/challenge → nonce,
POST /identity/verify → nostr_token); _scanExistingNostrKeys() discovers common
Nostr key formats (nsec1/npub1 bech32, hex privkeys, JSON objects) in localStorage
before showing opt-in prompt; keypair generation requires explicit user consent
- js/ui.js: setEdgeWorkerReady() "⚡ local AI" badge; cost preview via X-Nostr-Token
header (not query param); local triage badge "0 sats"; imports from edge-worker-client
- js/websocket.js: sentiment() on inbound Timmy chat messages → setMood() (10 s auto-clear)
- js/session.js: sentiment() on inbound reply (data.result); X-Nostr-Token on API calls;
imports from edge-worker-client
- js/payment.js: X-Nostr-Token header on POST /jobs
- js/main.js: initNostrIdentity() + warmupEdgeWorker() + onEdgeWorkerReady(setEdgeWorkerReady)
- the-matrix/package.json: nostr-tools, @xenova/transformers added
- vite.config.js: worker.format:'es' + optimizeDeps.exclude @xenova/transformers
This commit is contained in: