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

Function mapProviderOptions

packages/opencode/src/provider/transform.ts:412–428  ·  view source on GitHub ↗
(
  msgs: ModelMessage[],
  transform: (options: Record<string, any> | undefined) => Record<string, any> | undefined,
)

Source from the content-addressed store, hash-verified

410}
411
412function mapProviderOptions(
413 msgs: ModelMessage[],
414 transform: (options: Record<string, any> | undefined) => Record<string, any> | undefined,
415) {
416 return msgs.map((msg) => {
417 if (!Array.isArray(msg.content)) return { ...msg, providerOptions: transform(msg.providerOptions) }
418 return {
419 ...msg,
420 providerOptions: transform(msg.providerOptions),
421 content: msg.content.map((part) =>
422 part.type === "tool-approval-request" || part.type === "tool-approval-response"
423 ? part
424 : { ...part, providerOptions: transform(part.providerOptions) },
425 ),
426 } as typeof msg
427 })
428}
429
430export function message(msgs: ModelMessage[], model: Provider.Model, options: Record<string, unknown>) {
431 msgs = unsupportedParts(msgs, model)

Callers 1

messageFunction · 0.85

Calls 1

transformFunction · 0.85

Tested by

no test coverage detected