diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f3966..4df480f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ Each package and app has its own section and its own tags (`contracts@1.0.0`, `a ## Unreleased +## events@2.2.0, contracts@1.2.0 - 2026-11-17 + +### Events + +- **Cross Events 2.2.0**, the first release from this repo (`apps/events`, ROADMAP-v3 phase 1b): + moved in with its history, npm workspaces with one root lockfile, and the `crosscode` script + (`deploy`, `status`, `install`, `adopt`) in `scripts/`. Also AI use shown in tokens instead of + rand, and everything the backend serves under `/api`. Details in `apps/events/CHANGELOG.md`. + ### Contracts - AI status (Hub protocol §3b): optional `usedInputTokens`, `usedOutputTokens`, `capInputTokens`, diff --git a/apps/events/DEPLOYMENT.md b/apps/events/DEPLOYMENT.md index b6379cd..8c5831d 100644 --- a/apps/events/DEPLOYMENT.md +++ b/apps/events/DEPLOYMENT.md @@ -38,9 +38,9 @@ visitor ──http───▶ frps (vhost_http_port) ══tunnel══▶ frp On this server, nginx sends `/api`, `/uploads`, `/health` and `/docs` to the backend (port 5000) and everything else to the Next.js site (port 3000), the same as a normal install. -### One address, one rule (2.3.0 and later) +### One address, one rule (2.2.0 and later) -From 2.3.0 everything the backend serves is under **`/api`**: the API (`/api/v2`), the status page +From 2.2.0 everything the backend serves is under **`/api`**: the API (`/api/v2`), the status page (`/api`), health (`/api/health`), the API reference (`/api/docs/v2`) and uploaded files (`/api/uploads/…`). So the site and its API share one address (`events.yourchurch.org`, no separate `events-api.` record), and a web server or panel such as FastPanel needs a single @@ -54,10 +54,10 @@ rule: Set `BACKEND_URL` (backend `.env`) and `NEXT_PUBLIC_API_URL` (frontend `.env.production`) to the same `https://` address as `FRONTEND_URL`, then rebuild the frontend. The old paths (`/health`, `/docs/v2`, `/uploads/…`) still answer on the backend's port, so a site with a separate API -address keeps working unchanged. With only `/api` routed, links made before 2.3.0 that point at +address keeps working unchanged. With only `/api` routed, links made before 2.2.0 that point at `https:///uploads/…` stop working (they aren't stored that way, but could be in an old email); keep the four-path rule above if that matters. Pictures, logos and attachments are all -given out as `/api/uploads/…` from 2.3.0. +given out as `/api/uploads/…` from 2.2.0. ## 2. Before you start @@ -285,7 +285,7 @@ setup). If the `[hope-events-https]` section fails to start, check `journalctl - ## 6. Finish in the browser -1. Open `https://events.yourchurch.org/api/health` (`/health` before 2.3.0) — it should answer with the version. +1. Open `https://events.yourchurch.org/api/health` (`/health` before 2.2.0) — it should answer with the version. 2. Open `https://events.yourchurch.org/setup`: create the admin account. 3. **Site settings → Licence**: enter the licence key to connect to the Hub. The site checks in every 15 minutes from then on (outgoing HTTPS to `events-hub.crosscode.co.za`, which frp diff --git a/apps/events/README.md b/apps/events/README.md index 5a8e2ea..f214529 100644 --- a/apps/events/README.md +++ b/apps/events/README.md @@ -20,7 +20,7 @@ The backend provides a RESTful API for managing users, events, registrations, pa - Static uploads for event images Documentation: see Backend API Documentation and Backend README for environment setup and endpoints. -- API reference: `/api/docs/v2` on the running site (OpenAPI; admin token; `/docs/v2` before 2.3.0) — ./backend/API_DOCUMENTATION.md +- API reference: `/api/docs/v2` on the running site (OpenAPI; admin token; `/docs/v2` before 2.2.0) — ./backend/API_DOCUMENTATION.md - Moving to 2.0 (v1 API removed): ./MIGRATING-TO-2.md - Backend README: ./backend/README.md @@ -156,7 +156,7 @@ set names that match your PM2 apps (`pm2 ls`) and the port you use. ## Useful Links -- API reference: `/api/docs/v2` on the running site (OpenAPI; admin token; `/docs/v2` before 2.3.0) — ./backend/API_DOCUMENTATION.md +- API reference: `/api/docs/v2` on the running site (OpenAPI; admin token; `/docs/v2` before 2.2.0) — ./backend/API_DOCUMENTATION.md - Moving to 2.0 (v1 API removed): ./MIGRATING-TO-2.md - Backend README: ./backend/README.md - Frontend README: ./frontend/README.md diff --git a/apps/events/WHATS-NEW.md b/apps/events/WHATS-NEW.md index dd1bfd8..68def4b 100644 --- a/apps/events/WHATS-NEW.md +++ b/apps/events/WHATS-NEW.md @@ -12,6 +12,15 @@ Write for church admins, not developers: no environment variables, endpoints or developer log is CHANGELOG.md. A tagged version without a section here shows "No details given". --> +## 2.2.0 + +- **AI use is now shown in tokens.** Site settings → AI shows how much of this month's AI allowance + your team has used, as input tokens (what's sent to the AI) and output tokens (its answers), with + an estimate of the whole allowance. The tables of who used it and for what show tokens too. +- **Behind the scenes:** Cross Events now lives alongside our other church products, so every + product is updated the same way. Your site works as before, and your data and settings stay as + they are. + ## 2.1.1 - **Sending feedback forms and reminders no longer makes you wait.** "Send now" and "Remind" on the diff --git a/apps/events/backend/package.json b/apps/events/backend/package.json index dfc690e..ec2cea1 100644 --- a/apps/events/backend/package.json +++ b/apps/events/backend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events-backend", - "version": "2.1.1", + "version": "2.2.0", "description": "Event Management System Backend", "main": "src/index.js", "scripts": { diff --git a/apps/events/backend/prisma/migrations/20261117120000_ai_tokens/migration.sql b/apps/events/backend/prisma/migrations/20261117120000_ai_tokens/migration.sql index 5b35726..3e2baad 100644 --- a/apps/events/backend/prisma/migrations/20261117120000_ai_tokens/migration.sql +++ b/apps/events/backend/prisma/migrations/20261117120000_ai_tokens/migration.sql @@ -1,3 +1,3 @@ --- 2.3.0: tokens per AI call, which is what the site shows (the rand amount is the Hub's business). +-- 2.2.0: tokens per AI call, which is what the site shows (the rand amount is the Hub's business). ALTER TABLE "AiCall" ADD COLUMN "inputTokens" INTEGER NOT NULL DEFAULT 0; ALTER TABLE "AiCall" ADD COLUMN "outputTokens" INTEGER NOT NULL DEFAULT 0; diff --git a/apps/events/backend/prisma/schema.prisma b/apps/events/backend/prisma/schema.prisma index de2d008..31aaff9 100644 --- a/apps/events/backend/prisma/schema.prisma +++ b/apps/events/backend/prisma/schema.prisma @@ -2342,9 +2342,9 @@ model AiCall { // ok, refused, incomplete, failed, cap_reached, unavailable outcome String // What the church was charged, in cents (fractions of a cent). Kept for the record; the site - // shows tokens (2.3.0), and only the Hub shows rand. + // shows tokens (2.2.0), and only the Hub shows rand. chargedCents Float @default(0) - // Tokens the call used (2.3.0): input counts cached prompt tokens. 0 when the call failed. + // Tokens the call used (2.2.0): input counts cached prompt tokens. 0 when the call failed. inputTokens Int @default(0) outputTokens Int @default(0) createdAt DateTime @default(now()) diff --git a/apps/events/backend/src/ai/index.ts b/apps/events/backend/src/ai/index.ts index 7b1f5e7..817693c 100644 --- a/apps/events/backend/src/ai/index.ts +++ b/apps/events/backend/src/ai/index.ts @@ -1,7 +1,7 @@ /** * AI helpers (2.0, roadmap §15). The site never holds a Claude API key: every call goes through * the Cross Events Hub (docs/hub-protocol.md §3b), which checks the licence's monthly cap, calls - * Claude and meters the call. The site shows that use as tokens and a percentage (2.3.0); the cap's + * Claude and meters the call. The site shows that use as tokens and a percentage (2.2.0); the cap's * rand amount stays on the Hub. This module: * - works out what the AI buttons do (`aiStatus`): hidden, working, or disabled until the * allowance renews — from the licence token first, then the Hub (cached for a minute); @@ -35,7 +35,7 @@ export type HelperName = (typeof HELPERS)[number]; /** * What the Hub says (§3b), as the site keeps it. The Hub also sends the allowance in rand - * (`capCents`, `usedCents`); the site drops those (2.3.0): people see tokens and a percentage, + * (`capCents`, `usedCents`); the site drops those (2.2.0): people see tokens and a percentage, * and only the Hub shows rand. The token fields are null from a Hub before 2.0.1. */ export type HubAiStatus = { diff --git a/apps/events/backend/src/app.js b/apps/events/backend/src/app.js index 8db6b5b..95cf2b8 100644 --- a/apps/events/backend/src/app.js +++ b/apps/events/backend/src/app.js @@ -153,7 +153,7 @@ app.use((req, res, next) => { // Licence suspended, revoked or missing: no new or edited events, registrations or payments (src/hub/readOnly.js). app.use(require('./hub/readOnly').licenceReadOnly); -// Everything the backend serves is under /api (2.3.0), so the site and its API can share one +// Everything the backend serves is under /api (2.2.0), so the site and its API can share one // address: the web server sends /api to the backend and everything else to the frontend. The old // paths (/, /health, /docs/v2, /uploads) still work for sites with a separate API address. @@ -180,7 +180,7 @@ app.use('/api/v2', require('./v2').v2Router()); app.use(legacyLinkRedirects); app.use('/api/docs/v2', require('./v2').v2DocsRouter()); app.get('/api/docs', (req, res) => res.redirect(301, '/api/docs/v2')); -// Before 2.3.0 the reference was at /docs/v2 (bookmarks, the old status page). +// Before 2.2.0 the reference was at /docs/v2 (bookmarks, the old status page). app.use('/docs/v2', (req, res) => res.redirect(301, `/api${req.originalUrl}`)); app.get('/docs', (req, res) => res.redirect(301, '/api/docs/v2')); @@ -192,7 +192,7 @@ warmCache().catch(() => {}); // in the site's origin if opened directly, so pin the safe response headers // (no inline execution, no MIME-sniffing to HTML/script) on every asset here. // Stored paths stay "/uploads/…"; they're given out as /api/uploads/… (v2/schemas.ts absoluteUrl). -// /uploads still answers for links made before 2.3.0. +// /uploads still answers for links made before 2.2.0. const uploads = express.static('public/uploads', { setHeaders: (res) => { res.setHeader('Content-Security-Policy', "default-src 'none'; style-src 'unsafe-inline'; sandbox"); @@ -276,7 +276,7 @@ app.get('/favicon.ico', (req, res) => { res.sendFile(path.join(__dirname, '..', 'src', 'favicon.ico')); }); -// ── Status page, at /api (2.3.0); / sends you there ───────────────────────── +// ── Status page, at /api (2.2.0); / sends you there ───────────────────────── app.get('/', (req, res) => res.redirect(302, '/api')); app.get('/api', async (req, res) => { const mem = process.memoryUsage(); diff --git a/apps/events/backend/src/controllers/eventController.js b/apps/events/backend/src/controllers/eventController.js index 1f27b4b..4643dfd 100644 --- a/apps/events/backend/src/controllers/eventController.js +++ b/apps/events/backend/src/controllers/eventController.js @@ -46,7 +46,7 @@ function toAbsoluteUrl(req, url) { return raw; // keep as-is if already absolute and not localhost } // Relative path like /uploads/... => prefix with request origin; uploads are served under - // /api/uploads (2.3.0) so they reach the backend when the site and API share one address + // /api/uploads (2.2.0) so they reach the backend when the site and API share one address if (raw.startsWith('/')) { return `${req.protocol}://${req.get('host')}${raw.startsWith('/uploads/') ? `/api${raw}` : raw}`; } diff --git a/apps/events/backend/src/v2/index.ts b/apps/events/backend/src/v2/index.ts index e50bcfc..8fa197a 100644 --- a/apps/events/backend/src/v2/index.ts +++ b/apps/events/backend/src/v2/index.ts @@ -43,7 +43,7 @@ export function v2Router(): Router { } /** - * /api/docs/v2 (2.3.0; /docs/v2 before, which now redirects): Swagger UI (served from swagger-ui-dist, nothing from a CDN). The page itself is + * /api/docs/v2 (2.2.0; /docs/v2 before, which now redirects): Swagger UI (served from swagger-ui-dist, nothing from a CDN). The page itself is * public; it asks for an admin token and uses it to load openapi.json and to try requests. */ export function v2DocsRouter(): Router { diff --git a/apps/events/backend/src/v2/schemas.ts b/apps/events/backend/src/v2/schemas.ts index 7f9590c..19afa54 100644 --- a/apps/events/backend/src/v2/schemas.ts +++ b/apps/events/backend/src/v2/schemas.ts @@ -15,7 +15,7 @@ export function iso(d: Date | string | null | undefined): string | null { } /** - * Where a stored upload path is served: "/uploads/…" (as stored) → "/api/uploads/…" (2.3.0), so it + * Where a stored upload path is served: "/uploads/…" (as stored) → "/api/uploads/…" (2.2.0), so it * reaches the backend when the site and its API share one address. Anything else is unchanged. */ export function uploadPath(raw: string): string { diff --git a/apps/events/backend/tests/ai.test.ts b/apps/events/backend/tests/ai.test.ts index f6e8f40..86b6cf9 100644 --- a/apps/events/backend/tests/ai.test.ts +++ b/apps/events/backend/tests/ai.test.ts @@ -72,7 +72,7 @@ describe('status', () => { expect(await aiStatus()).toMatchObject({ enabled: true, available: false }); }); - test('the Hub\'s rand amounts never leave the site (2.3.0); a Hub before 2.0.1 sends no tokens', async () => { + test('the Hub\'s rand amounts never leave the site (2.2.0); a Hub before 2.0.1 sends no tokens', async () => { mockPost.mockResolvedValueOnce(hubStatus()); const s = await aiStatus() as unknown as Record; expect(s).not.toHaveProperty('capCents'); diff --git a/apps/events/backend/tests/v2.test.ts b/apps/events/backend/tests/v2.test.ts index c6e9666..787c6f8 100644 --- a/apps/events/backend/tests/v2.test.ts +++ b/apps/events/backend/tests/v2.test.ts @@ -558,7 +558,7 @@ describe('sections, costs, image uploads', () => { expect(res.body.data.url).toMatch(/^http:\/\/[^/]+\/api\/uploads\/events\/event-123\.jpg$/); }); - test('stored uploads are given out under /api/uploads (2.3.0); other addresses are left alone', () => { + test('stored uploads are given out under /api/uploads (2.2.0); other addresses are left alone', () => { expect(uploadPath('/uploads/branding/logo.png')).toBe('/api/uploads/branding/logo.png'); expect(uploadPath('/api/uploads/x.png')).toBe('/api/uploads/x.png'); expect(uploadPath('/images/x.png')).toBe('/images/x.png'); diff --git a/apps/events/e2e/api-v2.spec.ts b/apps/events/e2e/api-v2.spec.ts index 050fefc..d0fcaea 100644 --- a/apps/events/e2e/api-v2.spec.ts +++ b/apps/events/e2e/api-v2.spec.ts @@ -99,7 +99,7 @@ test.describe("API v2", () => { expect(ics.headers()["location"]).toBe(`/api/v2/events/${seed().events.conference}/calendar.ics`); const followed = await request.get(`${API}/api/events/${seed().events.conference}/ics`); expect(followed.headers()["content-type"]).toContain("text/calendar"); - // The old API reference addresses send people to the v2 one, under /api (2.3.0). + // The old API reference addresses send people to the v2 one, under /api (2.2.0). const docs = await request.get(`${API}/docs`, { maxRedirects: 0 }); expect(docs.headers()["location"]).toBe("/api/docs/v2"); const oldDocs = await request.get(`${API}/docs/v2?x=1`, { maxRedirects: 0 }); diff --git a/apps/events/frontend/package.json b/apps/events/frontend/package.json index 55c88bf..48acad6 100644 --- a/apps/events/frontend/package.json +++ b/apps/events/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events-frontend", - "version": "2.1.1", + "version": "2.2.0", "private": true, "scripts": { "dev": "next dev", diff --git a/apps/events/frontend/src/lib/ai.ts b/apps/events/frontend/src/lib/ai.ts index dd26728..92fb94f 100644 --- a/apps/events/frontend/src/lib/ai.ts +++ b/apps/events/frontend/src/lib/ai.ts @@ -3,7 +3,7 @@ import type { V2Result } from "@/lib/apiV2"; /** * AI helpers (2.0). The site calls AI through the Cross Events Hub, which keeps a monthly - * allowance per licence, shown here as tokens and a percentage (2.3.0). One status per page load is shared by every AI button + * allowance per licence, shown here as tokens and a percentage (2.2.0). One status per page load is shared by every AI button * (`useAiStatus`), and every helper call refreshes it — so the buttons disable straight after the * call that used up the allowance. */ diff --git a/apps/events/frontend/src/lib/api.ts b/apps/events/frontend/src/lib/api.ts index 396e94c..284164b 100644 --- a/apps/events/frontend/src/lib/api.ts +++ b/apps/events/frontend/src/lib/api.ts @@ -72,7 +72,7 @@ export function resolveToApiOrigin(urlOrPath: string | null | undefined): string } catch { // fall through to relative handling } - // Stored uploads ("/uploads/…") are served under /api/uploads (2.3.0), so they reach the + // Stored uploads ("/uploads/…") are served under /api/uploads (2.2.0), so they reach the // backend when the site and its API share one address. const path = raw.startsWith("/uploads/") ? `/api${raw}` : raw; return API_BASE ? `${API_BASE}${path}` : path; diff --git a/apps/events/package.json b/apps/events/package.json index 4f3baa3..3d4ca9d 100644 --- a/apps/events/package.json +++ b/apps/events/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events", - "version": "2.1.1", + "version": "2.2.0", "main": "index.js", "scripts": { "dev:backend": "cd backend && npm run dev", diff --git a/docs/AGENT-1.0-PLAN.md b/docs/AGENT-1.0-PLAN.md index 7e18090..7742b92 100644 --- a/docs/AGENT-1.0-PLAN.md +++ b/docs/AGENT-1.0-PLAN.md @@ -178,7 +178,7 @@ monorepo, listing every variable with its layer, whether it's required, and a de - **URLs are checked before and after.** Before: the form checks that the domain's DNS points at the central server and warns if not (the install still runs). After Joshua marks the proxy done: the Hub checks `https:///` (frontend answers), `https:///api/health` (backend - answers with the right version; `/health` before Events 2.3.0) and that it reports the + answers with the right version; `/health` before Events 2.2.0) and that it reports the `FRONTEND_URL` it was given. **For Joshua to set per server before the first install:** the database settings and @@ -376,7 +376,7 @@ Set up in FastPanel: events.hope.co.za (Hope Family Church, Cross Events) 1. Add the site events.hope.co.za. 2. Proxy: - /api → http://127.0.0.1:20011 (backend; Events 2.3.0+, older + /api → http://127.0.0.1:20011 (backend; Events 2.2.0+, older releases also need /uploads, /health, /docs) everything else → http://127.0.0.1:20010 (frontend) Pass the Host header and X-Forwarded-For / X-Forwarded-Proto: https. @@ -397,7 +397,7 @@ Central check: both ports are open in frps and only on 127.0.0.1. (lib/env.sh), ports given on the command line instead of picked. - `apps/events`: `env.template.json`, and the export (`crosscode export` calls a backend script that writes `crosscode.church-export/1`). -- `packages/contracts` **1.2.0**: `crosscode.agent-job/1`, `crosscode.agent-report/1`, +- `packages/contracts` **1.3.0** (1.2.0 went out with Events 2.2.0): `crosscode.agent-job/1`, `crosscode.agent-report/1`, `crosscode.agent-stats/1`, `crosscode.env-template/1`, `crosscode.church-export/1`. **`events-hub` (Hub 2.1.0)** @@ -441,7 +441,7 @@ Central check: both ports are open in frps and only on 127.0.0.1. ## 14. Rolling it out -1. Contracts 1.2.0 → the `crosscode` script changes (with Events 2.2.0 out first) → agent 1.0.0 +1. Contracts 1.3.0 → the `crosscode` script changes (with Events 2.2.0 out first) → agent 1.0.0 → Hub 2.1.0, each released as usual (branch → merge → tag → push). 2. On the central server: add `proxy_bind_addr = 127.0.0.1` to `frps.ini` if it's missing (check that each FastPanel site still answers), then join the central agent. diff --git a/docs/HANDOVER.md b/docs/HANDOVER.md index f77c0d1..63939d6 100644 --- a/docs/HANDOVER.md +++ b/docs/HANDOVER.md @@ -25,9 +25,9 @@ for each phase. They moved here from `hope-events/docs/` on 2026-11-05. |-------|------|-------| | 0 | contracts 1.0.0 / 1.1.0 | **Released** 2026-11-04 (`contracts@1.0.0`, `contracts@1.1.0`). Not published to a registry (decision 22): the Hub gets a packed release committed to its repo | | 1 | Hub 2.0.0 | **Released** 2026-11-05 (`events-hub` `v2.0.0`; `docs/HUB-2.0-PLAN.md` there). **Not deployed yet:** `events-hub/deployment.md` → "Upgrading to 2.0" (run `check-hub2` first). crosscode-site's address prices are merged, **not deployed yet** | -| 1b | Cross Events 2.2.0: moves here as `apps/events`, `crosscode` script | **In progress.** Planned in [EVENTS-2.2-PLAN.md](./EVENTS-2.2-PLAN.md). **Steps 1–3 done 2026-11-12** (merged into `main`): history merged in under `apps/events` (from `hope-events` `e6c9670`), workspaces and one root lockfile with versions pinned to 2.1.1, same test results as 2.1.1 (711 backend tests, typecheck, both builds). **The `crosscode` script and `adopt` (§4–5) are written** (branch `feat/crosscode-script`, 2026-11-12; shellcheck and 47 bats tests pass, not yet run on a server). **Still to do:** VM testing (§6), the version bump and `events@2.2.0` tag, adopting each install, archiving `hope-events` (§7). Until then servers keep deploying from `hope-events` `v2.1.1`, and **Events work happens here** (`hope-events` is frozen; a hotfix there as 2.1.2 is cherry-picked into `apps/events`) | -| 1c | Cross Events 2.3.0: authenticator app 2FA (TOTP + recovery codes) | TOTP not started (`TwoFactorMethod` enum in Events' `prisma/schema.prisma`). **Done on branches, 2026-11-17, not merged:** AI use in tokens (`feat/ai-tokens` here, in `events-hub` as 2.0.1 and in crosscode-site) and the backend under `/api` (`feat/api-prefix`) | -| 1d | Agent 1.0.0 + Hub 2.1.0 (+ contracts 1.2.0): server agent, installs / scheduled updates / uninstalls from the Hub, server stats | **Planned** 2026-11-12 in [AGENT-1.0-PLAN.md](./AGENT-1.0-PLAN.md) (ROADMAP decisions 27–37). Starts after 1b; can run alongside 1c | +| 1b | Cross Events 2.2.0: moves here as `apps/events`, `crosscode` script | **In progress.** Planned in [EVENTS-2.2-PLAN.md](./EVENTS-2.2-PLAN.md). **Steps 1–3 done 2026-11-12** (merged into `main`): history merged in under `apps/events` (from `hope-events` `e6c9670`), workspaces and one root lockfile with versions pinned to 2.1.1, same test results as 2.1.1 (711 backend tests, typecheck, both builds). **The `crosscode` script and `adopt` (§4–5) are written** (branch `feat/crosscode-script`, 2026-11-12; shellcheck and 47 bats tests pass, not yet run on a server). **Tagged `events@2.2.0` on 2026-11-17, before the VM testing (Joshua's call), with two additions: AI use in tokens and the backend under `/api` (Hub `v2.0.1` and crosscode-site `v1.2.0` released with them).** **Still to do:** VM testing (§6) of the tagged release, adopting each install, archiving `hope-events` (§7). Until then servers keep deploying from `hope-events` `v2.1.1`, and **Events work happens here** (`hope-events` is frozen; a hotfix there as 2.1.2 is cherry-picked into `apps/events`) | +| 1c | Cross Events 2.3.0: authenticator app 2FA (TOTP + recovery codes) | TOTP not started (`TwoFactorMethod` enum in Events' `prisma/schema.prisma`). | +| 1d | Agent 1.0.0 + Hub 2.1.0 (+ contracts 1.3.0): server agent, installs / scheduled updates / uninstalls from the Hub, server stats | **Planned** 2026-11-12 in [AGENT-1.0-PLAN.md](./AGENT-1.0-PLAN.md) (ROADMAP decisions 27–37). Starts after 1b; can run alongside 1c | | 2 | Cross Events 2.4.0: protocol v2, Linked products, event feed, `packages/seo` | Not started. Events keeps speaking protocol 1 until then | | 3–7 | Accounts 1.0.0 → Website 1.0.0 → Events 3.0.0 → App 1.0.0 → App 1.x | Not started | diff --git a/docs/ROADMAP-v3.md b/docs/ROADMAP-v3.md index d318801..be45bc1 100644 --- a/docs/ROADMAP-v3.md +++ b/docs/ROADMAP-v3.md @@ -613,9 +613,9 @@ Planned in [AGENT-1.0-PLAN.md](./AGENT-1.0-PLAN.md). In short: |-------|---------|------|----------------| | 0 | contracts 1.0.0 | `crosscode.event/1`, `crosscode.church/1`, `crosscode.identity/1`, Hub protocol v2: schemas, generated JSON Schema, docs, sample payloads, the monorepo set up. **Released 2026-11-04** | Everything else depends on them | | 1 | **Hub 2.0.0** | Cross Code Hub: products, licence per product, per-customer billing with bundles, protocol v2 (v1 still accepted), sibling discovery, AI usage per product, **releases per product with requirements** (§5), contracts as a committed file (§2). **Released 2026-11-05** (crosscode-site address prices merged) | Must exist before a second product is sold, and before Events releases come from the monorepo | -| 1b | **Cross Events 2.2.0** | **Moves into the monorepo** as `apps/events`, with its git history (merged in, not copied); its packages become workspaces; the **`crosscode` script** (`deploy`, `status`, `install`, `adopt`; §8) replaces `scripts/deploy.sh` and `scripts/install.sh`; every install moved with `crosscode adopt`; `hope-events` archived. No feature changes, so a problem is clearly the move | Before more products, so every product is released and deployed the same way from the start | -| 1c | **Cross Events 2.3.0** | **Authenticator app 2FA** (TOTP) next to email and WhatsApp, with recovery codes; admins can see which method each staff account uses. Also (decided 2026-11-17): **AI use shown in tokens**, never rand, outside the Hub (needs Hub 2.0.1); **everything the backend serves under `/api`**, so a site and its API share one address and one proxy rule | Independent and useful now; the Accounts migration later carries it over | -| 1d | **Agent 1.0.0 + Hub 2.1.0** (contracts 1.2.0) | **Server agent** on every server (polls only, signed jobs, runs the `crosscode` script); Hub: Servers page with stats and alerts, server configuration, frp port list, New install with a choice of server, scheduled / emergency / batch updates with notice to the church, uninstall with an encrypted JSON export, emailed reports. [AGENT-1.0-PLAN.md](./AGENT-1.0-PLAN.md) | Right after 1b (it runs the `crosscode` script), so every new church from then on is installed from the Hub. Can run alongside 1c | +| 1b | **Cross Events 2.2.0** | **Moves into the monorepo** as `apps/events`, with its git history (merged in, not copied); its packages become workspaces; the **`crosscode` script** (`deploy`, `status`, `install`, `adopt`; §8) replaces `scripts/deploy.sh` and `scripts/install.sh`; every install moved with `crosscode adopt`; `hope-events` archived. Planned with no feature changes; two small ones were added on 2026-11-17 (decided by Joshua): **AI use shown in tokens**, never rand, outside the Hub (needs Hub 2.0.1), and **everything the backend serves under `/api`**, so a site and its API share one address and one proxy rule. **Tagged 2026-11-17, before the VM testing** | Before more products, so every product is released and deployed the same way from the start | +| 1c | **Cross Events 2.3.0** | **Authenticator app 2FA** (TOTP) next to email and WhatsApp, with recovery codes; admins can see which method each staff account uses. | Independent and useful now; the Accounts migration later carries it over | +| 1d | **Agent 1.0.0 + Hub 2.1.0** (contracts 1.3.0) | **Server agent** on every server (polls only, signed jobs, runs the `crosscode` script); Hub: Servers page with stats and alerts, server configuration, frp port list, New install with a choice of server, scheduled / emergency / batch updates with notice to the church, uninstall with an encrypted JSON export, emailed reports. [AGENT-1.0-PLAN.md](./AGENT-1.0-PLAN.md) | Right after 1b (it runs the `crosscode` script), so every new church from then on is installed from the Hub. Can run alongside 1c | | 2 | **Cross Events 2.4.0** | Reports `product: "events"` (protocol v2), **Linked products**, the event feed (publish + show events from siblings), `packages/seo` (§11) with canonical links for imported events | Small; ready for when the Website exists | | 3 | **Accounts 1.0.0** | OIDC provider, sign-in, 2FA (email, WhatsApp, authenticator app), password reset, consent and notice, export / delete fan-out, admin, install script | The Website is built on it from day one | | 4 | **Church Website 1.0.0** | Public site with the **four templates** (§6), admin, simple events + feed, SEO (§11), Hope Family Church as the first church, then a second test church on a different template to prove it repeats | More churches need a website than an app; it also covers the "website only" case | @@ -636,8 +636,8 @@ At the end of each phase, update it in the same sitting and deploy it (its `DEPL |-------|--------------------------------| | 0 contracts | Nothing | | 1 Hub 2.0.0 | Bundle discounts (15% / 25%) and the address add-on (own domain R0 · Cross Code address R10 · domain included R25) in `src/data/pricing.mjs`, worded so it's clear the Website and App are still coming. Legal pages if billing terms change | -| 1b Events 2.2.0 | Nothing (the move doesn't change what Cross Events does) | -| 1c Events 2.3.0 | Authenticator app 2FA in the Cross Events feature list (`src/data/cross-events.mjs`) and the security / POPIA wording. (The AI allowance in tokens was done ahead, on branch `feat/ai-tokens` in crosscode-site, 2026-11-17) | +| 1b Events 2.2.0 | The AI allowance in tokens instead of rand (`src/data/cross-events.mjs`, the brochure). Done in crosscode-site 1.2.0 | +| 1c Events 2.3.0 | Authenticator app 2FA in the Cross Events feature list (`src/data/cross-events.mjs`) and the security / POPIA wording. | | 1d Agent 1.0.0 + Hub 2.1.0 | Nothing (it changes how installs are run, not what churches buy) | | 2 Events 2.4.0 | "Works with the Church Website and App" (event feed, Linked products) on the Cross Events page, as "coming" until those ship | | 3 Accounts 1.0.0 | "One sign-in for all your church's products" on the Products page. Accounts isn't sold, so no page or price of its own | diff --git a/docs/hub-protocol.md b/docs/hub-protocol.md index 5674075..0fa23f9 100644 --- a/docs/hub-protocol.md +++ b/docs/hub-protocol.md @@ -214,14 +214,14 @@ X-Hub-Install / X-Hub-Timestamp / X-Hub-Signature (as in §3) active (suspended, revoked, or past its grace days), or the Hub's AI isn't set up. - **`capReached: true`** — show the buttons **disabled** ("This month's AI allowance is used up — it renews on 1 December"). Reached means there isn't room left for even a small call. -- **Churches see tokens, never rand** (Hub 2.0.1, Cross Events 2.3.0). `usedInputTokens` / +- **Churches see tokens, never rand** (Hub 2.0.1, Cross Events 2.2.0). `usedInputTokens` / `usedOutputTokens` are this month's tokens over all the church's installs (input counts cached prompt tokens). `capInputTokens` / `capOutputTokens` are an **estimate** of the allowance: what half the cap buys as input and half as output, at the current model price, exchange rate and markup, rounded down to a thousand. `usedPercent` is exact (it's worked out in rand). Installs show the tokens and the percentage, and don't pass the cents on. - `capCents` / `usedCents` are cents (rand) as **charged** to the church, with fractions (a call costs - a fraction of a cent), for the Hub and for installs before Cross Events 2.3.0. The month is South + a fraction of a cent), for the Hub and for installs before Cross Events 2.2.0. The month is South African time; `renewsOn` is the 1st of the next month. ### A helper call diff --git a/package-lock.json b/package-lock.json index eba3f7f..bbd6ba7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ }, "apps/events/backend": { "name": "@crosscode/events-backend", - "version": "2.1.1", + "version": "2.2.0", "hasInstallScript": true, "dependencies": { "@cj-tech-master/excelts": "^10.2.0", @@ -91,7 +91,7 @@ }, "apps/events/frontend": { "name": "@crosscode/events-frontend", - "version": "2.1.1", + "version": "2.2.0", "dependencies": { "@dnd-kit/core": "^6.3.1", "@hookform/resolvers": "^5.2.1", @@ -19633,7 +19633,7 @@ }, "packages/contracts": { "name": "@crosscode/contracts", - "version": "1.1.0", + "version": "1.2.0", "license": "UNLICENSED", "dependencies": { "zod": "^4.6.7" diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 9b1bcfe..907c5fd 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/contracts", - "version": "1.1.0", + "version": "1.2.0", "description": "The shared JSON formats used by every Cross Code product: zod schemas, JSON Schema, TypeScript types and sample payloads", "license": "UNLICENSED", "type": "commonjs",