Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"t3": {
"repo": "pingdotgg/t3code",
"commit": "0f4a13071090e89c6d7eccdb0eb98b3cde1823ee",
"commit": "09a54f01bc0ae83865347a965ced50f8c8ec2953",
"paths": [
"apps/server/src/mcp/toolkits/attachment/tools.ts",
"apps/server/src/mcp/toolkits/device/tools.ts",
Expand Down
16 changes: 11 additions & 5 deletions t3/contract/apps/server/src/mcp/toolkits/html/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@ import * as ThreadManagementService from "../../../orchestration-v2/ThreadManage
import * as McpInvocationContext from "../../McpInvocationContext.ts";

const Html = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(512_000)).annotate({
description: "A complete, self-contained HTML document.",
description: "Inline HTML.",
});

const HtmlPath = Schema.String.annotate({
description: "Absolute .html file path.",
});

const PAGE_RULES =
"Inline <style> and <script>. Local images as absolute paths are inlined. Remote URLs load as-is.";
"Self-contained: inline <style> and <script>. Local images as absolute paths are inlined. Remote URLs load as-is.";

export const HtmlPreviewTool = Tool.make("html_preview", {
description: `Check an HTML page before html_render. Returns PNG, contentHeight, and console output. If it says the browser is still installing, call again in a minute. ${PAGE_RULES} Theme and layout rules are in html_render.`,
description: `Check an HTML page before html_render. Returns PNG, contentHeight, and console output. ${PAGE_RULES} Theme and layout rules are in html_render.`,
parameters: Schema.Struct({
html: Html,
path: Schema.optional(HtmlPath),
html: Schema.optional(Html),
width: Schema.optional(
Schema.Int.annotate({
description: `CSS pixels, 240 to 1600. Default ${HTML_RENDER_COLUMN_WIDTH}. Use about 390 for phones.`,
Expand Down Expand Up @@ -73,7 +78,8 @@ export const HtmlPreviewTool = Tool.make("html_preview", {
const HtmlRenderTool = Tool.make(HTML_RENDER_TOOL_NAME, {
description: `Show a finished HTML page (chart, diagram, mockup) inline in this thread, above your final reply. Do not announce or restate the page. Frame fits height to ${HTML_RENDER_MAX_FIT_HEIGHT}px. On mobile, content past the given height scrolls. ${HTML_RENDER_LAYOUT_GUIDE} ${HTML_RENDER_THEME_GUIDE}`,
parameters: Schema.Struct({
html: Html,
path: Schema.optional(HtmlPath),
html: Schema.optional(Html),
title: Schema.String.check(
Schema.isMinLength(1),
Schema.isMaxLength(HTML_RENDER_MAX_TITLE_LENGTH),
Expand Down
9 changes: 9 additions & 0 deletions t3/contract/packages/contracts/src/previewAutomation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,18 @@ export const PreviewAutomationSnapshot = Schema.Struct({
width: Schema.Int,
height: Schema.Int,
}),
/** The capture before `screenshot` was capped for the agent, when requested and larger. */
fullScreenshot: Schema.optional(
Schema.Struct({ data: Schema.String, width: Schema.Int, height: Schema.Int }),
),
});
export type PreviewAutomationSnapshot = typeof PreviewAutomationSnapshot.Type;

export const PreviewAutomationSnapshotInput = Schema.Struct({
fullScreenshot: Schema.optional(Schema.Boolean),
});
export type PreviewAutomationSnapshotInput = typeof PreviewAutomationSnapshotInput.Type;

export const PreviewAutomationRecordingStatus = Schema.Struct({
tabId: PreviewTabId,
recording: Schema.Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Ordinary coding tasks need no T3 tools.
- T3 tools may load late. Try the name once before you call it absent.`,
`### Visuals and preview

- Answer data with a trend or comparison with a chart, and show any visual the user asks for here: pass its HTML to \`html_preview\`, then \`html_render\`. If the visual is a file, pass that file's HTML. A screenshot on disk or a text description does not show it. Never start a server for it. Tools a web page exposes give data only. Never use them to show results. Asked for an image to post, send, or use elsewhere: a \`.png\` file and its path, never \`html_render\`.
- Answer data with a trend or comparison with a chart, and show any visual the user asks for here: pass the path to an HTML file, or inline HTML to \`html_preview\`, then \`html_render\`. A screenshot on disk or a text description does not show it. Never start a server for it. Tools a web page exposes give data only. Never use them to show results. Asked for an image to post, send, or use elsewhere: a \`.png\` file and its path, never \`html_render\`.
- Never use \`preview_*\` unasked to verify or show your own edit. Use them when the current request asks for browser work, including recording edits, or names a page or tab. Do not repeat preview calls from an earlier turn. Public pages: web fetch or search unless browser work was asked; then preview tools only, no web fetch. Close a tab you opened before you reply, unless the user asked for it or uses it.`,
];

Expand Down
Loading