contracts 1.18.0 + website: Get more storage

contracts: hub.storageRequestSchema and its reply, a sample and JSON
Schemas. Website: an Owner or Admin asks for more 5 GB steps under
Media library (signed to the Hub); the heartbeat reports the licence's
storage limit, so the Hub emails the church at 80% and when full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 16:18:46 +02:00
co-authored by Claude Opus 5.5
parent 53e5de3f14
commit 283e75737d
17 changed files with 276 additions and 12 deletions
+30
View File
@@ -294,6 +294,36 @@ export const updateRequestResponseSchema = z.object({
export const updateRequestCancelSchema = z.object({ protocolVersion });
export const updateRequestCancelResponseSchema = z.object({ cancelled: z.boolean() });
// ---------------------------------------------------------------------------------------------
// More storage (contracts 1.18.0, WEBSITE-1.0-PLAN §10, decision 12): a Website's admin presses
// "Get more storage". `POST /api/installs/storage-request`, signed as the heartbeat. The Hub records
// it and emails Joshua; he adds the steps to the licence, and the new limit reaches the site with
// the next heartbeat answer (`limits.storageBytes`). Asking again while a request is open changes
// its number of steps; nobody is emailed twice for the same request.
// ---------------------------------------------------------------------------------------------
/** One step is 5 GB (ROADMAP-v3 §10: R20 a month each). */
export const STORAGE_STEP_BYTES = 5 * 1024 ** 3;
export const storageRequestSchema = z.object({
protocolVersion,
/** How many 5 GB steps to add. */
steps: z.int().min(1).max(10),
/** What the site uses and may use now, for the email. */
usedBytes: z.int().nonnegative(),
limitBytes: z.int().nonnegative(),
/** Who asked (their name in the Website's admin), for the email. */
requestedBy: z.string().trim().max(200).nullable(),
});
export type StorageRequest = z.infer<typeof storageRequestSchema>;
export const storageRequestResponseSchema = z.object({
requestedAt: dateTimeSchema,
steps: z.int().min(1).max(10),
alreadyRequested: z.boolean(),
});
export type StorageRequestResponse = z.infer<typeof storageRequestResponseSchema>;
// ---------------------------------------------------------------------------------------------
// AI (as v1; usage is recorded per product on the Hub, the cap stays per customer)
// ---------------------------------------------------------------------------------------------