trusted-external-provider-catalog.mjs
63 lines 1.8 KB
Raw
sha256:fbe982a22c05c6fe2e93876f250deecdb43d883f648b4e1810c7546caa9f17db docs: activate KNOWTATION- board identity and preserve livi… Human minor ⚠ breaking 2 days ago
1 /**
2 * Immutable reserved external-provider identities (RHF-b-KN0).
3 *
4 * Global catalog entries are source-controlled — never stored in per-vault envelopes or
5 * mutable identity blobs. Identity resolution checks this catalog first.
6 *
7 * @see ~/scooling/docs/reviews/2026-08-27-retail-helper-finish.md §B1
8 */
9
10 export const AGENT_IDENTITY_SCHEMA_V1 = 'knowtation.agent_identity/v1';
11
12 /** @type {ReadonlyArray<object>} */
13 export const TRUSTED_EXTERNAL_PROVIDER_IDENTITIES = Object.freeze([
14 Object.freeze({
15 schema: AGENT_IDENTITY_SCHEMA_V1,
16 agent_id: 'agent_codex_retail',
17 kind: 'external_provider',
18 provider: 'codex',
19 owner_ref: 'org_ref:scooling',
20 registry_scope: 'global',
21 vault_id: null,
22 scope_ceiling: 'personal',
23 status: 'active',
24 created: '2026-08-27T00:00:00.000Z',
25 updated: '2026-08-27T00:00:00.000Z',
26 }),
27 ]);
28
29 /** @type {ReadonlySet<string>} */
30 const RESERVED_CATALOG_IDS = Object.freeze(
31 new Set(TRUSTED_EXTERNAL_PROVIDER_IDENTITIES.map((entry) => entry.agent_id)),
32 );
33
34 /** @type {ReadonlyMap<string, object>} */
35 const CATALOG_BY_ID = Object.freeze(
36 new Map(TRUSTED_EXTERNAL_PROVIDER_IDENTITIES.map((entry) => [entry.agent_id, entry])),
37 );
38
39 /**
40 * @param {string} agentId
41 * @returns {boolean}
42 */
43 export function isReservedCatalogAgentId(agentId) {
44 return typeof agentId === 'string' && RESERVED_CATALOG_IDS.has(agentId.trim());
45 }
46
47 /**
48 * @param {string} agentId
49 * @returns {object|null}
50 */
51 export function getTrustedCatalogIdentity(agentId) {
52 if (typeof agentId !== 'string') return null;
53 const entry = CATALOG_BY_ID.get(agentId.trim());
54 if (!entry) return null;
55 return { ...entry };
56 }
57
58 /**
59 * @returns {object[]}
60 */
61 export function listTrustedCatalogIdentities() {
62 return TRUSTED_EXTERNAL_PROVIDER_IDENTITIES.map((entry) => ({ ...entry }));
63 }
File History 1 commit
sha256:fbe982a22c05c6fe2e93876f250deecdb43d883f648b4e1810c7546caa9f17db docs: activate KNOWTATION- board identity and preserve livi… Human minor 2 days ago