MCPcopy Index your code
hub / github.com/anomalyco/opencode / toPublicInfo

Function toPublicInfo

packages/opencode/src/provider/provider.ts:1061–1069  ·  view source on GitHub ↗
(provider: Info)

Source from the content-addressed store, hash-verified

1059export type ConfigProvidersResult = Types.DeepMutable<Schema.Schema.Type<typeof ConfigProvidersResult>>
1060
1061export function toPublicInfo(provider: Info): Info {
1062 return JSON.parse(
1063 JSON.stringify(provider, (_, value) => {
1064 if (typeof value === "function" || typeof value === "symbol" || value === undefined) return undefined
1065 if (typeof value === "bigint") return value.toString()
1066 return value
1067 }),
1068 )
1069}
1070
1071export function defaultModelIDs<T extends { models: Record<string, { id: string }> }>(providers: Record<string, T>) {
1072 return mapValues(providers, (item) => sort(Object.values(item.models))[0].id)

Callers 1

provider.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected