mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
refactor(ai): define the operator-held providers once
The list of provider tags that send data out through a credential the operator holds (admin-openai, admin-codex) existed four times: in the consent gate, in the capability resolver, in the shared-provider health read and in the admin provider-health ordering. A tag added to one and not the others would be consented for in one place and not the other. The list and the local-provider test now live in src/lib/ai/provider-egress.ts and every reader imports them. The guard meant to keep one copy matched a variable name, so the copy in the resolver, under another name, never tripped it. It now matches the list itself in either order and names the one file allowed to hold it.
This commit is contained in:
1 parent
63e69e98ea
commit
5fd858e0af
6 files changed
+79
-47
No files matched your search
@@ -3,6 +3,7 @@ import { buildDateKey } from "@/lib/ai/coach/budget";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { apiSuccess } from "@/lib/api-response";
|
||||
import { annotate } from "@/lib/logging/context";
|
||||
import { OPERATOR_HELD_PROVIDER_TYPES } from "@/lib/ai/provider-egress";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -43,8 +44,11 @@ interface ProviderHealthSummary {
|
||||
lastFailureStatus: number | null;
|
||||
}
|
||||
|
||||
/** The two operator-managed tags sort first — they affect every user on the chain. */
|
||||
const CENTRAL_TYPES = ["admin-openai", "admin-codex"];
|
||||
/**
|
||||
* The operator-managed tags sort first — they affect every user on the chain.
|
||||
* Read from the one definition, in its order (the OpenAI key, then Codex).
|
||||
*/
|
||||
const CENTRAL_TYPES = [...OPERATOR_HELD_PROVIDER_TYPES];
|
||||
|
||||
export const GET = apiHandler(async () => {
|
||||
await requireAdmin();
|
||||
|
||||
Reference in new issue
Block a user