perf(ui): avoid full rescan of task child tools

This commit is contained in:
Shantur Rathore
2026-02-27 21:09:46 +00:00
parent 5d5fbfb5f2
commit 9a4d378238
3 changed files with 124 additions and 22 deletions

View File

@@ -117,6 +117,7 @@ export function applyPartDeltaV2(
partId: input.partId,
field: input.field,
delta: input.delta,
bumpSessionRevision: false,
})
}

View File

@@ -189,7 +189,14 @@ export interface InstanceMessageStore {
hydrateMessages: (sessionId: string, inputs: MessageUpsertInput[], infos?: Iterable<MessageInfo>) => void
upsertMessage: (input: MessageUpsertInput) => void
applyPartUpdate: (input: PartUpdateInput) => void
applyPartDelta: (input: { messageId: string; partId: string; field: string; delta: string; bumpRevision?: boolean }) => void
applyPartDelta: (input: {
messageId: string
partId: string
field: string
delta: string
bumpRevision?: boolean
bumpSessionRevision: boolean
}) => void
removeMessage: (messageId: string) => void
removeMessagePart: (messageId: string, partId: string) => void
bufferPendingPart: (entry: PendingPartEntry) => void
@@ -598,7 +605,14 @@ export function createInstanceMessageStore(instanceId: string, hooks?: MessageSt
bumpSessionRevision(message.sessionId)
}
function applyPartDelta(input: { messageId: string; partId: string; field: string; delta: string; bumpRevision?: boolean }) {
function applyPartDelta(input: {
messageId: string
partId: string
field: string
delta: string
bumpRevision?: boolean
bumpSessionRevision?: boolean
}) {
if (!input?.messageId || !input.partId || !input.field || typeof input.delta !== "string") {
return
}
@@ -632,7 +646,7 @@ export function createInstanceMessageStore(instanceId: string, hooks?: MessageSt
}),
)
if (applied) {
if (applied && (input.bumpSessionRevision ?? true)) {
bumpSessionRevision(message.sessionId)
}
}
@@ -1165,4 +1179,3 @@ export function createInstanceMessageStore(instanceId: string, hooks?: MessageSt
clearInstance,
}
}