11 Commits

Author SHA1 Message Date
a2249b5a06 Merge feat/statement-frontend-redesign: attribution package (RFB 6.01) + creator-dashboard
# Conflicts:
#	services/sidecars/rsshub-citation-toll/src/config.ts
2026-06-20 11:57:27 +03:00
pextacy
71e89bdfd8 feat(lepton): attribution package (RFB 6.01) + creator-dashboard
Adds @settlekit/attribution — reuse-detection, weighted provenance lineage,
and HMAC-signed proofs-of-citation — wired live into the rsshub-citation-toll
sidecar (POST /attribution/{detect,proof,verify}) and persisted via
PgLineageStore/PgProofStore over new lepton_lineage_edges + lepton_citation_proofs
tables.

Adds apps/creator-dashboard — a Next.js earnings view in the Statement
greenbar-ledger design system, driven by real domain logic (createSource +
computeRoyaltyDistribution + detectReuse, not mocks). Statement / Sources /
Payouts / Reuse & proofs (interactive) / Wallet. next build green.

Also bundles in-progress settlement hardening: settlement-core idempotency
concurrency, api env validation, bundles + contracts/worker tweaks.

Verified: 943 vitest tests, 27 Foundry tests, next build all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 01:19:22 +03:00
2a592888c4 fix(navidrome): reject non-finite/negative playedSeconds at the boundary
The /scrobble validator accepted any `typeof === "number"` playedSeconds, but
typeof NaN/Infinity is also "number" and `NaN < minPlaySeconds` is false — so a
non-finite duration slips past the skip-gate and charges for a non-play. Over
JSON, NaN/Infinity serialize to null (already rejected), but a negative duration
was silently treated as a free skip rather than flagged as malformed, and any
programmatic caller of the typed processor API could pass a raw NaN.

Require a finite, non-negative playedSeconds at the boundary. Test: NaN,
Infinity, and -1 all return 400 and accrue no royalty leg. Full suite 906 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:11:06 +03:00
b8d61b2781 feat(sidecars): optional bearer auth on money-moving webhook endpoints
The Navidrome, Owncast, and RSSHub sidecars exposed unauthenticated POST
endpoints that bind payout wallets and accrue/settle royalties (/scrobble,
/sessions/*, /admin/*). Because join/ingest events carry a caller-supplied
wallet, an attacker who can reach an exposed endpoint could rebind a creator's
payout address and redirect earnings.

Add a shared requireBearer guard (constant-time token compare) to each sidecar
and a SIDECAR_AUTH_TOKEN config knob. When the token is set, guarded routes
require `Authorization: Bearer <token>`; when unset the guard is a no-op so local
demos and tests run unchanged. Read-only routes (/, /health) and RSSHub's
x402-paid /articles/:id stay open — payment is that route's gate.

Test: with a token configured, /sessions/join is 401 without/with a wrong token
and 200 with the right one; /health stays open. Full suite 905 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:09:10 +03:00
cb38b17f5a feat(lepton): live-wiring seams + Phase 4 on-chain contracts
Live-wiring (flip to production by config, no code change):
- settlementProviderFromEnv (local/Circle) wired into every sidecar startSidecar
- createFeedPoller fetches a live RSSHub JSON feed and ingests on an interval

On-chain contracts (Foundry, Solc 0.8.30, forge test green):
- RecursiveSplitDistributor.sol: settle a citation/remix lineage in one tx (RFB 6)
- LeptonStreamSettlement.sol: per-second stream w/ reserve, proof-of-flow
  pause/resume, settle, close+refund (RFB 4)
- AgentReputationBond.sol: ERC-8004-style USDC bond, release/slash (RFB 3)

All green: full typecheck, 885 JS tests, 25 Foundry tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 15:00:17 +03:00
ce766b63cc feat(lepton): owncast per-second sidecar + live-wiring seams
Owncast per-second streaming settlement (RFB 4) on @settlekit/streaming:
- viewer join/leave meters watched time into a per-second PaymentStream
- watched time accrues to the streamer (payee-registry), unused reserve refunded
- settled via the shared sweepPendingRoyalties + settlement-core

Live-wiring seams (flip to production by config, no code change):
- all three sidecars accept an injectable settlementProvider (Gateway/Circle)
- rsshub sidecar: verify override + on-chain verification via ARC_INDEXER_URL
- fetchRssHubFeed / mapJsonFeed map a live RSSHub JSON feed to RssItems

Three creator-monetization patterns now share one settlement spine:
per-citation (RSSHub), per-listen (Navidrome), per-second (Owncast).
All green: full typecheck + 881 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 14:49:05 +03:00
0daf9e2da3 feat(lepton): navidrome per-listen scrobble sidecar (RFB 6.05)
Per-listen royalties for self-hosted music servers (Navidrome/Subsonic):
- play-gating (a skip in the first seconds is free)
- per-listener daily spending caps (wallet-fleet SpendingCapEnforcer)
- artist→wallet via @settlekit/payee-registry (escrow fallback)
- accrues per-listen royalty legs, settled to artists via the shared
  sweepPendingRoyalties + settlement-core

Hono service: /scrobble, /admin/artists, /admin/sweep, /health. Reuses the
production spine; booted live (skip→free, full play→accrued, sweep→settled).
Plan updated. All green: full typecheck + 875 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 14:41:53 +03:00
ff11f7754e feat(lepton): nanopayment modules + production settlement spine
Lepton Agents Hackathon (Canteen × Circle × Arc): agent-native nanopayments
on Arc, built on the existing SettleKit platform.

Hackathon modules (demo-ready, RFB-aligned):
- @settlekit/agent: autonomous paying agent (Claude tool-use loop) — RFB 1/3
- @settlekit/citation-toll: per-access content + recursive royalty splits — RFB 6
- @settlekit/streaming: per-second continuous-authorization settlement — RFB 4
- @settlekit/x402-client: x402 pay-and-retry + pluggable settler (local/Circle)
- @settlekit/agent-economy: closed-loop traction harness + CLI
- apps/api /v1/lepton: public live demo surface

Production settlement spine (Phase 1):
- @settlekit/settlement-core: configurable Gateway/Circle/local providers,
  idempotency, batch accumulator, on-chain reconciliation, nonce + receipt stores
- @settlekit/wallet-fleet: registry, spending caps + kill-switch, balances,
  Circle provisioning
- x402-client: provider-settler adapter + Arc-indexer on-chain verifier
- lepton DB schema (12 tables) + persistence Pg stores (settlements, nonces,
  sources, royalty legs, wallets, streams, payees)
- apps/worker jobs: lepton-settlement-reconcile, lepton-payout-sweep,
  lepton-stream-refund (no-op until the settlement spine is wired)

First real-world traction sidecar (Phase 2):
- @settlekit/payee-registry: identity→wallet payout rule (in-memory + Pg)
- services/sidecars/rsshub-citation-toll: ingest RSS items as priced citeable
  sources, x402-gated, settle per-citation royalties via settlement-core
- shared sweepPendingRoyalties used by the worker job and the sidecar
- services/sidecars/* wired as a TS workspace area (pnpm + vitest)

Docs: LEPTON.md, LEPTON_PRODUCTION_PLAN.md. All green: full typecheck + 870 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 14:37:38 +03:00
dbc754b2f0 chore: untrack committed Rust target/ build artifacts
2501 files under sdks/rust/target and services/arc-indexer/target were
committed before the target/ gitignore rule. Remove them from the index
(kept on disk); .gitignore already excludes target/. Also shrinks Vercel
uploads.
2026-06-17 17:59:28 +03:00
3853551433 asad 2026-06-17 02:09:36 +03:00
32b89f0515 firstof 2026-06-16 02:51:34 +03:00