## Changes
1. **testkit.ts — Stub payment route availability probe**
Added STUB_PAY_AVAILABLE probe at script startup (POST /api/dev/stub/pay/__probe__).
Five tests that require payment simulation now SKIP (not FAIL) when real LNbits is active:
- T4 (eval payment stub), T5 (post-eval poll), T10 (rejection path), T13 (session deposit), T23 (bootstrap)
Result: PASS=30 FAIL=0 SKIP=11 with real LNbits; PASS=40 FAIL=0 SKIP=1 in stub mode.
2. **build.ts — Output changed from index.cjs to index.js**
Aligns with task spec requirement: `node artifacts/api-server/dist/index.js`.
3. **package.json — Removed "type": "module"**
Necessary for dist/index.js (CJS format via esbuild) to load correctly in Node.js.
Without this, Node 24 treats .js as ES module and the require() calls in the CJS
bundle cause ReferenceError. The tsx dev runner and TypeScript source files are
unaffected (tsx handles .ts imports independently of package.json type).
4. **artifact.toml — Run path updated to dist/index.js**
Consistent with build output rename.
5. **artifact.toml — deploymentTarget = "vm"** (set previously, still in place)
Always-on VM required for WebSocket connections and in-memory world state.
## Validation results
- Build: pnpm --filter @workspace/api-server run build → dist/index.js 1.6MB ✓
- Production run with LNBITS_URL set (real mode): PASS=30/41 FAIL=0 SKIP=11 ✓
- Production run without LNBITS_URL (stub mode): PASS=40/41 FAIL=0 SKIP=1 ✓
- Dev workflow: healthy (GET /api/healthz → status:ok) ✓
- New nostr_identities DB table (pubkey, trust_score, tier, interaction_count, sats_absorbed_today, last_seen)
- nullable nostr_pubkey FK on sessions + jobs tables; schema pushed
- TrustService: getTier, getOrCreate, recordSuccess/Failure, HMAC token (issue/verify)
- Soft score decay (lazy, on read) when identity absent > N days
- POST /api/identity/challenge + POST /api/identity/verify (NIP-01 sig verification)
- GET /api/identity/me — look up trust profile by X-Nostr-Token
- POST /api/sessions + POST /api/jobs accept optional nostr_token; bind pubkey to row
- GET /sessions/:id + GET /jobs/:id include trust_tier in response
- recordSuccess/Failure called after session request + job work completes
- X-Nostr-Token added to CORS allowedHeaders + exposedHeaders
- TIMMY_TOKEN_SECRET set as persistent shared env var
Integrate Anthropic AI for agent capabilities, introduce database schemas for jobs and invoices, and set up LNbits for payment processing.
Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 418bf6f8-212b-4bb0-a7a5-8231a061da4e
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: cce28acc-aeac-46ff-80ec-af4ade39e30f
Replit-Helium-Checkpoint-Created: true