MCPcopy Create free account
hub / github.com/apache/maka / normalizeRelayModelProfiles

Function normalizeRelayModelProfiles

packages/core/src/model-thinking.ts:182–193  ·  view source on GitHub ↗
(
  table: unknown,
)

Source from the content-addressed store, hash-verified

180 * the entry.
181 */
182export function normalizeRelayModelProfiles(
183 table: unknown,
184): Record<string, RelayModelProfile> | undefined {
185 if (!isRecord(table)) return undefined;
186 const parsed: [string, RelayModelProfile][] = [];
187 for (const [modelId, entry] of Object.entries(table)) {
188 if (modelId.length === 0 || modelId.length > 512) continue;
189 const declared = normalizeRelayModelProfile(entry);
190 if (declared) parsed.push([modelId, declared]);
191 }
192 return parsed.length > 0 ? Object.fromEntries(parsed) : undefined;
193}
194
195/**
196 * Restore the `keys(profiles) ⊆ enabledModelIds` invariant after a selection

Callers 6

decodeRelayProfileFunction · 0.90
useConnectionDetailFunction · 0.90
relayProfileDraftSeedFunction · 0.90

Calls 4

isRecordFunction · 0.70
entriesMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected