MCPcopy Create free account
hub / github.com/anomalyco/opencode / merge

Function merge

packages/core/src/plugin/models-dev.ts:58–63  ·  view source on GitHub ↗
(left: ModelV2Info["cost"][number], right: ModelV2Info["cost"][number])

Source from the content-addressed store, hash-verified

56 const [nextDefault, ...nextTiers] = next
57 const tierKey = (item: ModelV2Info["cost"][number]) => `${item.tier?.type ?? "base"}:${item.tier?.size ?? 0}`
58 const merge = (left: ModelV2Info["cost"][number], right: ModelV2Info["cost"][number]) => ({
59 ...left,
60 ...right,
61 tier: right.tier ?? left.tier,
62 cache: { ...left.cache, ...right.cache },
63 })
64 const tiers = new Map(baseTiers.map((item) => [tierKey(item), item]))
65 for (const item of nextTiers) {
66 const current = tiers.get(tierKey(item))

Callers 1

mergeCostFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected