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

Function firstByOrder

packages/opencode/src/cli/cmd/run/stream.transport.ts:293–302  ·  view source on GitHub ↗
(left: T[], right: T[], order: Map<string, number>)

Source from the content-addressed store, hash-verified

291}
292
293function firstByOrder<T extends { id: string }>(left: T[], right: T[], order: Map<string, number>) {
294 return [...left, ...right].sort((a, b) => {
295 const next = blockerOrder(order, a.id) - blockerOrder(order, b.id)
296 if (next !== 0) {
297 return next
298 }
299
300 return a.id.localeCompare(b.id)
301 })[0]
302}
303
304function pickView(data: SessionData, subagent: SubagentData, order: Map<string, number>): FooterView {
305 return pickBlockerView({

Callers 1

pickViewFunction · 0.85

Calls 1

blockerOrderFunction · 0.85

Tested by

no test coverage detected