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

Function traceTabs

packages/opencode/src/cli/cmd/run/stream.transport.ts:364–389  ·  view source on GitHub ↗
(trace: Trace | undefined, prev: FooterSubagentTab[], next: FooterSubagentTab[])

Source from the content-addressed store, hash-verified

362}
363
364function traceTabs(trace: Trace | undefined, prev: FooterSubagentTab[], next: FooterSubagentTab[]) {
365 const before = new Map(prev.map((item) => [item.sessionID, item]))
366 const after = new Map(next.map((item) => [item.sessionID, item]))
367
368 for (const [sessionID, tab] of after) {
369 if (sameSubagentTab(before.get(sessionID), tab)) {
370 continue
371 }
372
373 trace?.write("subagent.tab", {
374 sessionID,
375 tab,
376 })
377 }
378
379 for (const sessionID of before.keys()) {
380 if (after.has(sessionID)) {
381 continue
382 }
383
384 trace?.write("subagent.tab", {
385 sessionID,
386 cleared: true,
387 })
388 }
389}
390
391function createLayer(input: StreamInput) {
392 return Layer.fresh(

Callers 1

createLayerFunction · 0.85

Calls 3

sameSubagentTabFunction · 0.90
writeMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected