Phase 14, part 1: plans, each team's account, and their limits

The multi-tenant edition's plans (Free and Paid as decided, or a plans
file) and each team's billing account, with a 14-day trial of Paid. A
team's plan caps what its people and agents may change: modules outside it
stay readable, a lapsed team changes nothing, and agents, Market entries,
crawls and background jobs keep to it. Without a Stripe key, no billing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 13:15:00 -07:00
co-authored by Claude Opus 5.5
parent e47764a78e
commit a47990f9bf
19 changed files with 848 additions and 7 deletions
+9 -1
View File
@@ -30,6 +30,7 @@ type viewer struct {
Platform bool // runs the multi-tenant platform (SUPERMARKET_PLATFORM_ADMINS)
Viewing bool // a platform admin viewing a team, read-only
ReadOnly bool // the team's subscription has lapsed: nothing may change
}
// localOwner is the local edition's one user.
@@ -166,7 +167,14 @@ func (s *Server) lookupSession(r *http.Request) (*viewer, error) {
if err != nil {
return nil, err
}
return &viewer{User: u, Member: m, Session: sess, Platform: pa}, nil
v := &viewer{User: u, Member: m, Session: sess, Platform: pa}
if s.billingOn() {
if ts, err := s.forTeam(sess.Team); err == nil {
plan, ro := ts.teamPlan()
v.Member, v.ReadOnly = planned(m, plan, ro), ro
}
}
return v, nil
}
// toSignIn sends someone who isn't signed in to the sign-in page, and