(detail: DetailState)
| 525 | } |
| 526 | |
| 527 | function compactDetail(detail: DetailState) { |
| 528 | const next = createSessionData({ |
| 529 | includeUserText: true, |
| 530 | }) |
| 531 | const activePartIDs = new Set(detail.data.part.keys()) |
| 532 | const framePartIDs = new Set(detail.frames.flatMap((item) => (item.commit.partID ? [item.commit.partID] : []))) |
| 533 | const partIDs = new Set([...activePartIDs, ...framePartIDs, ...detail.data.tools]) |
| 534 | const messageIDs = new Set([ |
| 535 | ...[...activePartIDs] |
| 536 | .map((partID) => detail.data.msg.get(partID)) |
| 537 | .filter((item): item is string => typeof item === "string"), |
| 538 | ...recent(detail.data.role.keys(), SUBAGENT_ROLE_LIMIT), |
| 539 | ]) |
| 540 | |
| 541 | next.announced = detail.data.announced |
| 542 | next.permissions = detail.data.permissions |
| 543 | next.questions = detail.data.questions |
| 544 | next.ids = compactIDs(detail) |
| 545 | next.tools = new Set([...detail.data.tools].filter((item) => partIDs.has(item))) |
| 546 | next.call = compactCallMap(detail) |
| 547 | next.role = copyMap(detail.data.role, messageIDs) |
| 548 | next.msg = copyMap(detail.data.msg, activePartIDs) |
| 549 | next.part = copyMap(detail.data.part, activePartIDs) |
| 550 | next.text = copyMap(detail.data.text, activePartIDs) |
| 551 | next.sent = copyMap(detail.data.sent, activePartIDs) |
| 552 | next.end = new Set([...detail.data.end].filter((item) => activePartIDs.has(item))) |
| 553 | next.echo = compactEchoMap(detail.data, messageIDs) |
| 554 | detail.data = next |
| 555 | } |
| 556 | |
| 557 | function applyChildEvent(input: { |
| 558 | detail: DetailState |
no test coverage detected