mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 13:22:14 +00:00
Every new endpoint of the contract exists, wrapped in apiHandler, with its authentication, module gate and request validation, and answers 501 not_implemented until its behaviour lands. The OpenAPI document carries the new operations and schemas and the additive response fields on the changed routes. The four server feature flags are published as false. contract-stub-inventory.test.ts registers the stubbed routes; each one leaves the register with the change that fills it. The route, sharing, session, security, module-gate and outcome inventories name the new routes deliberately, and the error-code catalogue lists the codes the routes emit today.
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
/**
|
|
* v1.43 (#1217) — AI usage in three levels.
|
|
*
|
|
* The wire spells a level in lower case; the database enum (`AiUsageLevel`)
|
|
* in upper case. The order of {@link AI_USAGE_LEVELS} is the ceiling order:
|
|
* a level is allowed when it is at or below the operator's `maxLevel`.
|
|
*/
|
|
import { z } from "zod/v4";
|
|
|
|
export const AI_USAGE_LEVELS = ["frugal", "standard", "full"] as const;
|
|
export type AiUsageLevelWire = (typeof AI_USAGE_LEVELS)[number];
|
|
|
|
export const aiUsageLevelSchema = z.enum(AI_USAGE_LEVELS);
|
|
|
|
/** `PUT /api/auth/me/ai-usage`: the account's own choice; `null` follows the instance default. */
|
|
export const aiUsagePutSchema = z.strictObject({
|
|
level: aiUsageLevelSchema.nullable(),
|
|
});
|
|
export type AiUsagePutInput = z.infer<typeof aiUsagePutSchema>;
|
|
|
|
/** The `aiUsage` block of `PUT /api/admin/settings/assistant-flags`. */
|
|
export const adminAiUsageSchema = z.strictObject({
|
|
maxLevel: aiUsageLevelSchema,
|
|
defaultLevel: aiUsageLevelSchema,
|
|
syncRegenGapHours: z.number().int().min(1).max(48).nullable(),
|
|
});
|
|
export type AdminAiUsageInput = z.infer<typeof adminAiUsageSchema>;
|