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

Function compactCallMap

packages/opencode/src/cli/cmd/run/subagent-data.ts:498–516  ·  view source on GitHub ↗
(detail: DetailState)

Source from the content-addressed store, hash-verified

496}
497
498function compactCallMap(detail: DetailState) {
499 const keep = new Set(recent(detail.data.call.keys(), SUBAGENT_CALL_LIMIT))
500
501 for (const request of detail.data.permissions) {
502 const key = callKey(request.tool?.messageID, request.tool?.callID)
503 if (key) {
504 keep.add(key)
505 }
506 }
507
508 for (const item of detail.frames) {
509 const key = callKey(item.commit.part?.messageID, item.commit.part?.callID)
510 if (key) {
511 keep.add(key)
512 }
513 }
514
515 return copyMap(detail.data.call, keep)
516}
517
518function compactEchoMap(data: SessionData, messageIDs: Set<string>) {
519 const keys = new Set([...messageIDs, ...recent(data.echo.keys(), SUBAGENT_ECHO_LIMIT)])

Callers 1

compactDetailFunction · 0.85

Calls 4

callKeyFunction · 0.85
copyMapFunction · 0.85
recentFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected