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

Function cycleVariant

packages/opencode/src/cli/cmd/run/variant.shared.ts:61–76  ·  view source on GitHub ↗
(current: string | undefined, variants: string[])

Source from the content-addressed store, hash-verified

59}
60
61export function cycleVariant(current: string | undefined, variants: string[]): string | undefined {
62 if (variants.length === 0) {
63 return undefined
64 }
65
66 if (!current) {
67 return variants[0]
68 }
69
70 const idx = variants.indexOf(current)
71 if (idx === -1 || idx === variants.length - 1) {
72 return undefined
73 }
74
75 return variants[idx + 1]
76}
77
78export function pickVariant(model: RunInput["model"], input: RunSession | SessionMessages): string | undefined {
79 return sessionVariant(Array.isArray(input) ? createSession(input) : input, model)

Callers 2

runInteractiveRuntimeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected