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
..

SettleKit Worker

Background worker for delivery execution, payment confirmation, access sync, renewals, and webhook retries (plan §17). A real Node ESM service that drives the @settlekit/* domain packages on interval-based schedules with graceful shutdown.

Jobs

Job Cadence env What it does
delivery-runner WORKER_DELIVERY_INTERVAL_MS Executes pending delivery runs through @settlekit/delivery DeliveryRunner with the concrete wired clients; retries failed runs.
payment-confirm WORKER_PAYMENT_INTERVAL_MS Polls @settlekit/arc verifyUsdcTransfer / getConfirmations, confirms payments via @settlekit/payments, and enqueues delivery.
access-sync WORKER_ACCESS_SYNC_INTERVAL_MS Reconciles GitHub (syncAccess) + Discord (syncDiscordAccess) grants; expires due entitlements (@settlekit/entitlements expireDue).
renewal-sweep WORKER_RENEWAL_INTERVAL_MS Advances subscriptions, enters grace, and expires via @settlekit/payments.
webhook-retry WORKER_WEBHOOK_RETRY_INTERVAL_MS Redelivers failed webhooks via @settlekit/webhooks deliverWithRetry.

Wiring

src/wiring/delivery-clients.ts builds the concrete adapters that implement the delivery package's client interfaces, each backed by a REAL package call:

  • GithubAccessClient → @settlekit/github
  • DiscordRoleClient → @settlekit/discord
  • LicenseIssuer → @settlekit/license-keys
  • ApiKeyIssuer → @settlekit/api-keys
  • FileGrantor → @settlekit/file-delivery
  • SaasEntitler → @settlekit/saas
  • WebhookSender → @settlekit/webhooks
  • EmailSender → @settlekit/notifications

The GitHub/Discord transports, Arc RPC, email transport, and webhook HTTP sender are injectable, so the wiring test exercises the exact production assembly path against in-memory doubles.

Run

pnpm --filter @settlekit/worker build
pnpm --filter @settlekit/worker start

Required env vars are validated at boot (src/config.ts); missing secrets fail fast.