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
17 changes: 10 additions & 7 deletions extensions/render.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// extensions/render.ts
import { chromium } from "playwright-core"
import { Type } from "typebox"

import { pathToFileURL } from "node:url"
import { writeFileSync, mkdirSync } from "node:fs"
import { join } from "node:path"
Expand Down Expand Up @@ -186,14 +188,15 @@ export default function (pi: any) {
pi.registerTool({
name: "keystone_render",
description: "Render an HTML file with headless Chromium at given viewports. Returns screenshots + computed styles + DOM snapshot for the Keystone gate engine.",
parameters: {
htmlPath: { type: "string", description: "Absolute path to the HTML file to render" },
url: { type: "string", description: "Optional live URL to render instead of htmlPath (audit URL mode). If set, htmlPath is ignored." },
viewports: { type: "array", items: { type: "number" }, description: "CSS pixel widths to screenshot", default: [1280, 375, 320, 414, 768] },
outDir: { type: "string", description: "Directory to write outputs", default: "./keystone-render" },
},
parameters: Type.Object({
htmlPath: Type.String({ description: "Absolute path to the HTML file to render" }),
url: Type.Optional(Type.String({ description: "Optional live URL to render instead of htmlPath (audit URL mode). If set, htmlPath is ignored." })),
viewports: Type.Optional(Type.Array(Type.Number({ description: "CSS pixel widths to screenshot" }))),
outDir: Type.Optional(Type.String({ description: "Directory to write outputs" })),
}),
async execute(_toolCallId: string, input: RenderInput) {
return render(input)
const result = await render(input)
return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], details: result }
},
})
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getpipher/keystone",
"version": "1.0.1",
"version": "1.0.2",
"description": "Anti-AI-slop design skill with an executable gate engine. Beats Hallmark by enforcing its gates instead of imagining them.",
"keywords": [
"pi-package",
Expand Down Expand Up @@ -52,7 +52,8 @@
},
"devDependencies": {
"@types/node": "^24.13.3",
"playwright": "1.62.0"
"playwright": "1.62.0",
"typebox": "*"
},
"packageManager": "pnpm@10.33.2"
}
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading