feat: MCP apps render and run inline in threads (#16236)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Opus 5.5 authored and GitHub committed 2026-10-07 09:44:08 -07:00
1 parent 6ecb82dc42
commit 4d976d1fc2
83 files changed
+4990 -55

No files matched your search

+6 -4
View File
@@ -4,7 +4,7 @@ import * as NodeFS from "node:fs";
import * as NodePath from "node:path";
import type { ChatAttachment } from "@t3tools/contracts";
import { htmlRenderFromToolItem } from "@t3tools/shared/toolOutput";
import { htmlRenderFromToolItem, mcpAppFromToolItem } from "@t3tools/shared/toolOutput";
import {
normalizeAttachmentRelativePath,
@@ -116,8 +116,9 @@ export function parseThreadSegmentFromAttachmentId(attachmentId: string): string
}
/**
* Attachments a thread's `html_render` tool calls published. Only ids minted
* for this thread count, so deleting a fork never removes its source's pages.
* Attachments a thread's tool calls published: `html_render` pages and
* captured MCP App documents. Only ids minted for this thread count, so
* deleting a fork never removes its source's pages.
*/
export function threadHtmlRenderAttachmentIds(
threadId: string,
@@ -126,7 +127,8 @@ export function threadHtmlRenderAttachmentIds(
const segment = toSafeThreadAttachmentSegment(threadId);
if (segment === null) return [];
return Array.from(items).flatMap((item) => {
const attachmentId = htmlRenderFromToolItem(item)?.attachmentId;
const attachmentId =
htmlRenderFromToolItem(item)?.attachmentId ?? mcpAppFromToolItem(item)?.attachmentId;
return attachmentId !== undefined &&
parseThreadSegmentFromAttachmentId(attachmentId) === segment
? [attachmentId]