You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/templates.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -363,7 +363,7 @@ The site-scope AI agent can author templates end-to-end:
363
363
364
364
1. Build the chrome on a page with `insertHtml`, including one `<instatic-outlet>` element where the wrapped content should appear (the importer maps it to a `base.outlet` node).
365
365
2. Call `setPageTemplate(pageId, target, priority?)` — `target` is `{ kind: 'everywhere' }` or `{ kind: 'postTypes', tableSlugs: [...] }`. For a postTypes target, the agent reads valid slugs from `list_post_types` first.
366
-
3.`clearPageTemplate(pageId)` reverts a template to an ordinary page. `list_pages` reports each page's current `template` config.
366
+
3.`clearPageTemplate(pageId)` reverts a template to an ordinary page. `list_documents` reports each page/template's current `template` config.
367
367
368
368
No outlet save-guard applies here either — an agent-built template with no outlet simply doesn't apply. See [agent.md → Templates](agent.md) for the tool surface.
|`agent-no-raw-html-in-reply-rule.test.ts`| The agent system prompt contains the narrate-only rule (1–2 sentence replies, no raw HTML/CSS/JSON in the reply body). Prevents accidental removal during prompt refactors. |
159
-
|`agent-system-prompt-no-module-enumeration.test.ts`| The system prompt does not enumerate module ids — they're discovered via `list_modules`/`read_page` at runtime. Also asserts the HTML-native style markers (`insertHtml`, "Structure as HTML, styling as CSS"). |
159
+
|`agent-system-prompt-no-module-enumeration.test.ts`| The system prompt does not enumerate module ids — they're discovered via `list_modules`/`read_document` at runtime. Also asserts the HTML-native style markers (`insertHtml`, "Structure as HTML, styling as CSS"). |
160
160
|`agent-tool-surface.test.ts`| Legacy node-construction tools (`insertNode`, `insertTree`) and retired class-patch tools (`createClass`, `updateClassStyles`) are absent from the site write-tool list; HTML-native replacements (`insertHtml`, `getNodeHtml`, `replaceNodeHtml`) and the unified CSS-authoring tool (`applyCss`) are present; design-system token tools and template tools are present; total count is exactly 22. |
Copy file name to clipboardExpand all lines: scripts/bench/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,12 +164,12 @@ You'll get a frame-by-frame scrubber with DOM snapshots, network waterfall, cons
164
164
### snapshot-tokens (opt-in)
165
165
Measures how many tokens the site-editor agent's page **read surface** costs, comparing the two representations of the same page:
166
166
167
-
-**JSON** — the legacy read surface (deleted): `inspect_page` (full node tree) + `list_classes` (all CSS classes) + `list_tokens` (design tokens), each `JSON.stringify`'d exactly as the old tools emitted them into a `tool_result`. Rebuilt by a local `flattenForBench` that reproduces the deleted `buildPageSnapshot` node/class/token mapping, so this regression guard keeps measuring the surface that `read_page` replaced.
168
-
-**read_page** — the live first `read_page` result from `renderAgentPage(...)`, counted as the exact serialized tool payload including `pageInfo`. It contains annotated body HTML with a `uid` on each tag plus page-relevant CSS wrapped in a `<style>` block. The CSS includes framework variables/utilities, font token variables, active-page module CSS, used class rules, applicable ambient selectors, and page-targeted user stylesheets. It omits browser-only `@font-face` blocks, unrelated cross-page ambient selectors, long base64/data URLs, and very long URLs. Oversized pages report `pageInfo.nextPart` so follow-up `read_page({ part })` calls can retrieve the remaining cleaned slices.
167
+
-**JSON** — the legacy read surface (deleted): `inspect_page` (full node tree) + `list_classes` (all CSS classes) + `list_tokens` (design tokens), each `JSON.stringify`'d exactly as the old tools emitted them into a `tool_result`. Rebuilt by a local `flattenForBench` that reproduces the deleted `buildPageSnapshot` node/class/token mapping, so this regression guard keeps measuring the surface that `read_document` replaced.
168
+
-**read_document** — the live first `read_document` result from `renderAgentDocument(...)`, counted as the exact serialized tool payload including `pageInfo`. It contains annotated body HTML with a `uid` on each tag plus page-relevant CSS wrapped in a `<style>` block. The CSS includes framework variables/utilities, font token variables, active-page module CSS, used class rules, applicable ambient selectors, and page-targeted user stylesheets. It omits browser-only `@font-face` blocks, unrelated cross-page ambient selectors, long base64/data URLs, and very long URLs. Oversized pages report `pageInfo.nextPart` so follow-up `read_document({ part })` calls can retrieve the remaining cleaned slices.
169
169
170
-
Tokens are counted with Anthropic's `count_tokens` endpoint (model-accurate, no SDK) against the **real seeded pages** in `.tmp/dev.db`. The report gives per-page and aggregate JSON-vs-read_page token counts and a ratio, plus fairness/fidelity facts it deliberately surfaces: how many `@media` breakpoint blocks the counted CSS carries, how many nodes got annotated, and how many carry per-node prop overrides that live in the JSON tree but not in the published CSS (responsive styling that flows through included class `@media` blocks is counted on the read_page side).
170
+
Tokens are counted with Anthropic's `count_tokens` endpoint (model-accurate, no SDK) against the **real seeded pages** in `.tmp/dev.db`. The report gives per-page and aggregate JSON-vs-read_document token counts and a ratio, plus fairness/fidelity facts it deliberately surfaces: how many `@media` breakpoint blocks the counted CSS carries, how many nodes got annotated, and how many carry per-node prop overrides that live in the JSON tree but not in the published CSS (responsive styling that flows through included class `@media` blocks is counted on the read_document side).
171
171
172
-
The HTML read surface has shipped (`read_page` replaced the five legacy JSON tools). This bench now serves as a **regression guard** — confirming the first size-budgeted read remains cheaper than the legacy JSON surface it replaced. It is **opt-in**: it needs `ANTHROPIC_API_KEY` and a seeded dev DB, and it makes one network call per measured string. Run it with:
172
+
The HTML read surface has shipped (`read_document` replaced the five legacy JSON tools). This bench now serves as a **regression guard** — confirming the first size-budgeted read remains cheaper than the legacy JSON surface it replaced. It is **opt-in**: it needs `ANTHROPIC_API_KEY` and a seeded dev DB, and it makes one network call per measured string. Run it with:
173
173
```bash
174
174
ANTHROPIC_API_KEY=sk-... bun run bench --only=snapshot-tokens
0 commit comments