Require tool part ids for tool-call rendering and caching

Rebind permissions from callID to part id when parts arrive.
This commit is contained in:
Shantur Rathore
2026-01-02 16:21:24 +00:00
parent a9524b3e30
commit 4b05e698f8
6 changed files with 107 additions and 43 deletions

View File

@@ -35,7 +35,10 @@ export function Markdown(props: MarkdownProps) {
const dark = Boolean(props.isDark)
const themeKey = dark ? "dark" : "light"
const highlightEnabled = !props.disableHighlight
const partId = typeof part.id === "string" && part.id.length > 0 ? part.id : "__anonymous__"
const partId = typeof part.id === "string" && part.id.length > 0 ? part.id : ""
if (!partId) {
throw new Error("Markdown rendering requires a part id")
}
const versionKey = typeof part.version === "number" ? String(part.version) : ""
const cacheKey = makeMarkdownCacheKey(partId, themeKey, highlightEnabled, versionKey)