mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-03 03:06:44 +00:00
deduplicate sameTab
This commit is contained in:
@@ -29,6 +29,7 @@ import {
|
|||||||
listSubagentQuestions,
|
listSubagentQuestions,
|
||||||
listSubagentTabs,
|
listSubagentTabs,
|
||||||
reduceSubagentData,
|
reduceSubagentData,
|
||||||
|
sameSubagentTab,
|
||||||
snapshotSelectedSubagentData,
|
snapshotSelectedSubagentData,
|
||||||
snapshotSubagentData,
|
snapshotSubagentData,
|
||||||
SUBAGENT_BOOTSTRAP_LIMIT,
|
SUBAGENT_BOOTSTRAP_LIMIT,
|
||||||
@@ -305,30 +306,12 @@ function composeFooter(input: {
|
|||||||
return footer
|
return footer
|
||||||
}
|
}
|
||||||
|
|
||||||
function sameTab(a: FooterSubagentTab | undefined, b: FooterSubagentTab | undefined) {
|
|
||||||
if (!a || !b) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
a.sessionID === b.sessionID &&
|
|
||||||
a.partID === b.partID &&
|
|
||||||
a.callID === b.callID &&
|
|
||||||
a.label === b.label &&
|
|
||||||
a.description === b.description &&
|
|
||||||
a.status === b.status &&
|
|
||||||
a.title === b.title &&
|
|
||||||
a.toolCalls === b.toolCalls &&
|
|
||||||
a.lastUpdatedAt === b.lastUpdatedAt
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function traceTabs(trace: Trace | undefined, prev: FooterSubagentTab[], next: FooterSubagentTab[]) {
|
function traceTabs(trace: Trace | undefined, prev: FooterSubagentTab[], next: FooterSubagentTab[]) {
|
||||||
const before = new Map(prev.map((item) => [item.sessionID, item]))
|
const before = new Map(prev.map((item) => [item.sessionID, item]))
|
||||||
const after = new Map(next.map((item) => [item.sessionID, item]))
|
const after = new Map(next.map((item) => [item.sessionID, item]))
|
||||||
|
|
||||||
for (const [sessionID, tab] of after) {
|
for (const [sessionID, tab] of after) {
|
||||||
if (sameTab(before.get(sessionID), tab)) {
|
if (sameSubagentTab(before.get(sessionID), tab)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ function ensureDetail(data: SubagentData, sessionID: string) {
|
|||||||
return next
|
return next
|
||||||
}
|
}
|
||||||
|
|
||||||
function sameTab(a: FooterSubagentTab | undefined, b: FooterSubagentTab) {
|
export function sameSubagentTab(a: FooterSubagentTab | undefined, b: FooterSubagentTab | undefined) {
|
||||||
if (!a) {
|
if (!a || !b) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ function syncTaskTab(data: SubagentData, part: ToolPart, children?: Set<string>)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const next = taskTab(part, sessionID)
|
const next = taskTab(part, sessionID)
|
||||||
if (sameTab(data.tabs.get(sessionID), next)) {
|
if (sameSubagentTab(data.tabs.get(sessionID), next)) {
|
||||||
ensureDetail(data, sessionID)
|
ensureDetail(data, sessionID)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user