spec 3.8.0: pages are static
ci / check (push) Canceled after 0s

A scripted page in a sealed frame can still send data out (a WebRTC
datagram), and a document without script can make the browser resolve a
chosen name (link rel=dns-prefetch, preconnect, prefetch). So a page is
static everywhere: HTML, CSS and inline SVG. pages.md §6, the prompt block
and loop.json pages.static say what it may hold — the listed elements and
attributes, no script or event handler, no link, meta, base, frames,
media, canvas or forms, no address but #fragment and an inline data:image,
no @import or url() that fetches — and what a client that shows pages
does: rebuild the document from the allow-list, a frame with scripts off,
fixed height with its own scrolling, Open larger in place; a client that
cannot guarantee it shows the note. Charts are inline SVG the model writes
out. conformance/pages.json gains the static cases (src/pages/static.ts
answers them); the fence, title, note and projection are as they were.

reports.md: the creator of a schedule that runs once may store always
(scheduled.notify.one_shot_default); a device without the reports
capability is never sent an instruction naming report_write — it gets the
3.5.0 prompt (the [SILENT] hint for `when`, none otherwise).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Fable 5.2 committed 2026-11-13 10:47:07 +00:00
1 parent 0512745ccb
commit ca849facb2
10 files changed
+455 -28

No files matched your search

+2 -2
View File
@@ -16,8 +16,8 @@ Harness spec 3.8.0: reports from scheduled runs, HTML pages in answers, which pe
attention"), or never. `[SILENT]` is retired. On a linked computer the CLI offers
`report_write` to a scheduled run's model and hands the report back with the run's answer.
- **Harness spec 3.8.0: HTML pages in answers** (`harness/pages.md`), experimental and off unless
the server switches it on: a reply may carry a complete page in an `html-view` block, shown in
a sealed frame by the web UI and Desktop. A terminal shows a note in its place — *This answer
the server switches it on: a reply may carry a complete page in an `html-view` block — static:
HTML, CSS and inline SVG, no script — shown in a sealed frame by the web UI and Desktop. A terminal shows a note in its place — *This answer
has a page: title* — and keeps the page as a file (`/pages`). A terminal's own model is never
offered pages.
- **`/reports`**: the reports your schedules filed, read from your LLeMbas server — unread first,
+5 -1
View File
@@ -98,7 +98,11 @@ Written ahead of the implementations; the CLI carries it in the same round.
- **HTML pages in answers** (`pages.md`, `prompts/blocks/html-pages.md`, `loop.json` `pages`,
`models/schema.json` `html_pages`) — experimental, off unless switched on. The reply stays
Markdown; the model may add a complete, self-contained page in a fence whose info string is
`html-view` and a title. Offered only when the instance's switch, the model's flag and the
`html-view` and a title. **A page is static everywhere** — HTML, CSS and inline SVG; no script,
no event handlers, no `<link>`/`<meta>`/`<base>`, frames, media or forms, no address but
`#fragment` and an inline `data:image/…`; a client rebuilds it from the allow-list
(`loop.json` `pages.static`) and shows it in a frame with scripts off, or shows the note.
Offered only when the instance's switch, the model's flag and the
chat's switch are all on (a scheduled run: instance and model); never to a subagent, the phone
assistant or an agent chat. A reader that cannot show a page sees *This answer has a page:
title*; anything that reads a reply as text sees `[page: title]`. A switch changed mid-chat is
+134 -1
View File
@@ -1,5 +1,5 @@
{
"about": "HTML pages in answers (pages.md, spec 3.8.0). `show` says what is asked. `fence`: a reply's `text` — expect `pages`, each closed `html-view` block in order with its `title` and its `html` (the lines between the fences, joined by newlines), and `projection`, the reply with every page replaced by its `[page: title]` line. `note`: a page's `title` — expect what a client that cannot render shows. `offered`: the `instance` switch, the `model`'s flag (absent: false), the `chat` switch, and `where` (absent: a chat; `scheduled`: a schedule's run on the server, which has no chat switch; `subagent`, `phone_assistant`, `agent_chat`) — expect whether the block is in the prompt. `note_line`: the chat's switch `change`d to `on` or `off` after the prompt was made — expect the session note's `line`. LLeMbas: services/pages.py; CLI: src/prototype/fence.ts.",
"about": "HTML pages in answers (pages.md, spec 3.8.0). `show` says what is asked. `fence`: a reply's `text` — expect `pages`, each closed `html-view` block in order with its `title` and its `html` (the lines between the fences, joined by newlines), and `projection`, the reply with every page replaced by its `[page: title]` line. `note`: a page's `title` — expect what a client that cannot render shows. `offered`: the `instance` switch, the `model`'s flag (absent: false), the `chat` switch, and `where` (absent: a chat; `scheduled`: a schedule's run on the server, which has no chat switch; `subagent`, `phone_assistant`, `agent_chat`) — expect whether the block is in the prompt. `note_line`: the chat's switch `change`d to `on` or `off` after the prompt was made — expect the session note's `line`. `static`: a page's `html` — expect `static` true, or false with `why`: what makes it not static, each once, in the order first met — `element:<name>` (not in pages.static.elements), `attribute:<name>` (not in pages.static.attributes, nor a kept prefix), `address:<attribute>` (an address other than #fragment or an inline data: image of a listed type), `css:import`, `css:url` (a url() that is neither) — names in lower case. It says what the rule is; a client still rebuilds the document with a real parser (pages.md §6). LLeMbas: services/pages.py; CLI: src/prototype/fence.ts.",
"cases": [
{
"about": "A page with a title.",
@@ -281,6 +281,139 @@
"expect": {
"line": "HTML pages are now off for this chat: write no more `html-view` blocks."
}
},
{
"about": "A static page: text, a table, a style element with the variables, inline SVG.",
"show": "static",
"html": "<!doctype html><html><head><title>Sales</title><style>body{color:var(--page-ink,#222);background:var(--page-bg,#fff)} td{border:1px solid var(--page-line,#ccc)}</style></head><body><h1>Sales</h1><table><tr><th scope=\"col\">Month</th><td colspan=\"2\">12</td></tr></table><svg viewBox=\"0 0 100 40\" role=\"img\" aria-label=\"Bars\"><rect x=\"0\" y=\"10\" width=\"20\" height=\"30\" fill=\"var(--page-accent,#06c)\"/><text x=\"10\" y=\"8\" text-anchor=\"middle\" font-size=\"6\">12</text></svg></body></html>",
"expect": {
"static": true
}
},
{
"about": "A link within the page and an inline picture are the two addresses there are.",
"show": "static",
"html": "<a href=\"#totals\">Totals</a><h2 id=\"totals\">Totals</h2><img alt=\"dot\" src=\"data:image/png;base64,iVBORw0KGgo=\">",
"expect": {
"static": true
}
},
{
"about": "A script.",
"show": "static",
"html": "<p>x</p><script>fetch('https://example.org/')</script>",
"expect": {
"static": false,
"why": [
"element:script"
]
}
},
{
"about": "An event handler.",
"show": "static",
"html": "<p onclick=\"go()\">x</p><svg onload=\"go()\"></svg>",
"expect": {
"static": false,
"why": [
"attribute:onclick",
"attribute:onload"
]
}
},
{
"about": "A link element — a dns-prefetch needs no script at all.",
"show": "static",
"html": "<link rel=\"dns-prefetch\" href=\"//example.org\"><p>x</p>",
"expect": {
"static": false,
"why": [
"element:link"
]
}
},
{
"about": "meta, base, frames, objects, media, canvas, forms.",
"show": "static",
"html": "<meta http-equiv=\"refresh\" content=\"0;url=https://example.org\"><base href=\"https://example.org/\"><iframe src=\"https://example.org\"></iframe><object data=\"x\"></object><embed src=\"x\"><video src=\"x\"></video><audio></audio><canvas></canvas><form action=\"https://example.org\"><input name=\"q\"><button>go</button></form>",
"expect": {
"static": false,
"why": [
"element:meta",
"element:base",
"element:iframe",
"element:object",
"element:embed",
"element:video",
"element:audio",
"element:canvas",
"element:form",
"element:input",
"element:button"
]
}
},
{
"about": "An address that leaves the page.",
"show": "static",
"html": "<a href=\"https://example.org/\">out</a><img src=\"https://example.org/p.png\" alt=\"\"><a href=\"page2.html\">next</a>",
"expect": {
"static": false,
"why": [
"address:href",
"address:src"
]
}
},
{
"about": "A javascript: address, a protocol-relative one, a data: address that is not a picture, an SVG picture.",
"show": "static",
"html": "<a href=\"JavaScript:go()\">x</a><a href=\"//example.org\">y</a><a href=\"data:text/html;base64,PGI+\">z</a><img alt=\"\" src=\"data:image/svg+xml;base64,PHN2Zz4=\">",
"expect": {
"static": false,
"why": [
"address:href",
"address:src"
]
}
},
{
"about": "CSS that would fetch: @import and url() to anywhere; url(#id) and an inline picture are fine.",
"show": "static",
"html": "<style>@import url(https://example.org/a.css); .a{background:url(https://example.org/b.png)} .b{fill:url(#grad)} .c{background:url(data:image/png;base64,iVBOR=)}</style><p style=\"background:url('//example.org/c.png')\">x</p>",
"expect": {
"static": false,
"why": [
"css:import",
"css:url"
]
}
},
{
"about": "Elements and attributes nobody listed: dropped, whatever they are.",
"show": "static",
"html": "<marquee>x</marquee><template><p>y</p></template><svg><foreignObject><p>z</p></foreignObject><use href=\"#a\"/></svg><p contenteditable=\"true\" data-n=\"1\" aria-hidden=\"true\">w</p>",
"expect": {
"static": false,
"why": [
"element:marquee",
"element:template",
"element:foreignobject",
"attribute:contenteditable"
]
}
},
{
"about": "An xlink:href is not a listed attribute; a use that points outside is an address.",
"show": "static",
"html": "<svg><use xlink:href=\"#a\"/><use href=\"https://example.org/s.svg#a\"/></svg>",
"expect": {
"static": false,
"why": [
"attribute:xlink:href",
"address:href"
]
}
}
]
}
+176 -3
View File
@@ -444,7 +444,7 @@
"pace_per_second": 4
},
"scheduled": {
"about": "Spec 3.5.0 (acp.md *Scheduled work on a linked computer*): a schedule's run as an agent turn on a linked computer, and the watch command of monitor mode. `setting` is how the device's switch is shown; `modes` the modes a schedule may choose (`default_mode` when it chose none), lowered to remote.max_mode; `approval_wait_seconds` how long an approval in a scheduled turn waits (the schedule's wait, clamped); `sentinel` the word a reply says when there is nothing to tell; `monitor` the watch command's limits. conformance/scheduled.json, silent.json, monitor.json. Spec 3.8.0 (reports.md): `notify` — a schedule's notify-when: its `values`, the `default`, the `default_condition` of `when`, the instruction `texts` placed in the run's prompt ({{condition}} the person's words), what the tool answers (`result`), and the limits of the history line and of a summary made from an answer. `sentinel` is retired: told to no model, and a reply that still carries it leaves no report. conformance/reports.json.",
"about": "Spec 3.5.0 (acp.md *Scheduled work on a linked computer*): a schedule's run as an agent turn on a linked computer, and the watch command of monitor mode. `setting` is how the device's switch is shown; `modes` the modes a schedule may choose (`default_mode` when it chose none), lowered to remote.max_mode; `approval_wait_seconds` how long an approval in a scheduled turn waits (the schedule's wait, clamped); `sentinel` the word a reply says when there is nothing to tell; `monitor` the watch command's limits. conformance/scheduled.json, silent.json, monitor.json. Spec 3.8.0 (reports.md): `notify` — a schedule's notify-when: its `values`, the `default`, the `default_condition` of `when`, the instruction `texts` placed in the run's prompt ({{condition}} the person's words), what the tool answers (`result`), and the limits of the history line and of a summary made from an answer. `sentinel` is retired: told to no model, and a reply that still carries it leaves no report. conformance/reports.json. `notify.one_shot_default`: what the creator of a schedule that runs once may store when the person chose nothing.",
"setting": {
"key": "remote.scheduled",
"label": "Accept scheduled work",
@@ -492,6 +492,7 @@
"never"
],
"default": "when",
"one_shot_default": "always",
"default_condition": "something needs my attention",
"labels": {
"always": "Every run",
@@ -801,7 +802,7 @@
}
},
"pages": {
"about": "Spec 3.8.0 (pages.md): HTML pages in answers — experimental, off unless switched on. `fence`: the info word of a page's fenced block; `title_max` and `untitled` for its title; `variables`: the CSS variables the frame provides; `note` what a client that cannot render shows in a page's place and `where` what it may add; `projection` the one line a page is for anything that reads a reply as text; `never`: where pages are never offered, whatever the switches say. conformance/pages.json.",
"about": "Spec 3.8.0 (pages.md): HTML pages in answers — experimental, off unless switched on. `fence`: the info word of a page's fenced block; `title_max` and `untitled` for its title; `variables`: the CSS variables the frame provides; `note` what a client that cannot render shows in a page's place and `where` what it may add; `projection` the one line a page is for anything that reads a reply as text; `never`: where pages are never offered, whatever the switches say. conformance/pages.json. `static` (pages.md §6): a page is static everywhere — the `elements` and `attributes` a client keeps when it rebuilds the document (anything else is dropped; `aria-*` and `data-*` attributes are kept), the `addresses` an attribute or a CSS url() may hold, and the `image_types` of an inline data: image.",
"fence": "html-view",
"title_max": 80,
"untitled": "Page",
@@ -819,6 +820,178 @@
"subagent",
"phone_assistant",
"agent_chat"
]
],
"static": {
"elements": [
"html",
"head",
"title",
"style",
"body",
"main",
"header",
"footer",
"section",
"article",
"aside",
"nav",
"div",
"span",
"p",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"ul",
"ol",
"li",
"dl",
"dt",
"dd",
"table",
"caption",
"colgroup",
"col",
"thead",
"tbody",
"tfoot",
"tr",
"th",
"td",
"figure",
"figcaption",
"blockquote",
"pre",
"code",
"em",
"strong",
"b",
"i",
"u",
"s",
"small",
"sub",
"sup",
"mark",
"abbr",
"time",
"br",
"hr",
"a",
"img",
"details",
"summary",
"svg",
"g",
"defs",
"path",
"rect",
"circle",
"ellipse",
"line",
"polyline",
"polygon",
"text",
"tspan",
"desc",
"linearGradient",
"radialGradient",
"stop",
"clipPath",
"marker",
"symbol",
"use"
],
"attributes": [
"class",
"id",
"style",
"title",
"lang",
"dir",
"role",
"hidden",
"colspan",
"rowspan",
"scope",
"headers",
"span",
"href",
"src",
"alt",
"width",
"height",
"open",
"datetime",
"xmlns",
"viewBox",
"preserveAspectRatio",
"x",
"y",
"x1",
"y1",
"x2",
"y2",
"cx",
"cy",
"r",
"rx",
"ry",
"d",
"points",
"dx",
"dy",
"transform",
"fill",
"fill-opacity",
"fill-rule",
"stroke",
"stroke-width",
"stroke-opacity",
"stroke-dasharray",
"stroke-linecap",
"stroke-linejoin",
"opacity",
"font-family",
"font-size",
"font-weight",
"text-anchor",
"dominant-baseline",
"offset",
"stop-color",
"stop-opacity",
"gradientUnits",
"gradientTransform",
"clip-path",
"marker-start",
"marker-mid",
"marker-end",
"markerWidth",
"markerHeight",
"refX",
"refY",
"orient"
],
"attribute_prefixes": [
"aria-",
"data-"
],
"address_attributes": [
"href",
"src"
],
"addresses": [
"#fragment",
"data:image"
],
"image_types": [
"png",
"jpeg",
"gif",
"webp"
]
}
}
}
+48 -13
View File
@@ -2,8 +2,9 @@
Spec 3.8.0. **Experimental, and off unless switched on.** A reply stays Markdown; where seeing
answers better than reading, the model may add **a page** to it: a complete, self-contained HTML
document in a fenced block. A client that can, shows the page in a sealed frame at that place in
the reply; every other reader sees a one-line note. The prompt text is `prompts/blocks/html-pages.md`;
document in a fenced block — **static: HTML, CSS and inline SVG, no script** (§6). A client that
can, shows the page in a sealed frame at that place in the reply; every other reader sees a
one-line note. The prompt text is `prompts/blocks/html-pages.md`;
the names and texts `loop.json` `pages`; the model flag `models/schema.json` `html_pages`; the
cases `conformance/pages.json`. (It takes the place of the 1.x *prototypes*, which 2.0 removed:
one kind of block instead of two, no panel, no network.)
@@ -40,10 +41,10 @@ A page is a fenced code block whose info string begins with the word **`html-vie
`prompts/blocks/html-pages.md`, as bullets of the system prompt when pages are offered (§4) —
in short: the answer stays Markdown and must make sense without the page; a page is a complete
document in an `html-view` fence with a short title, one page per fence; everything is inline —
no external script, style, font or image, the frame has no network; charts are drawn with inline
SVG or a canvas script; colours come from the frame's variables so the page follows light and
dark; no forms that submit, no links that navigate.
document in an `html-view` fence with a short title, one page per fence; it is **static** — HTML,
CSS and inline SVG, nothing that runs and nothing loaded from anywhere; a chart is inline SVG the
model writes out, shapes and numbers it worked out itself; tables and layout are CSS; colours
come from the frame's variables so the page follows light and dark.
**The frame's variables**, set on the page's root by the client that shows it, always used with
a fallback (`pages.variables`):
@@ -95,11 +96,45 @@ message: `context.note.pages_on` — with the block's text as `{{pages_text}}`
is made; a change of those reaches a chat the same way, as the chat's switch going off or
becoming available.
## 6. The frame
## 6. A page is static
What a rendering client must hold to (the server's and Desktop's own tests prove it; it is here
so that a third client does not weaken it): the page runs in a frame of its own origin with
scripts allowed and nothing else — no cookie, no storage of the app's, **no network** (no fetch,
no image, font, script or style from anywhere), no navigation of itself or its parent, no forms
that submit, no pop-ups. The client gives it the five variables and takes its height. A page
never reaches the app that shows it.
**Everywhere, in every client: HTML, CSS and inline SVG — nothing that runs, nothing that
reaches anywhere.** A frame with scripts on cannot be sealed by policy alone: a script can still
send data out (a WebRTC datagram to a server it chooses), and even without script a document can
make the browser look a name up (`<link rel="dns-prefetch">`, `preconnect`, `prefetch`). So the
rule is about the document, not only the frame around it (`loop.json` `pages.static`;
`conformance/pages.json`, `show: static`):
- **No script of any kind**: no `<script>`, no event-handler attribute (`on…`), no
`javascript:` address.
- **Only the listed elements** (`pages.static.elements`: text, lists, tables, figures, `style`,
and the SVG shapes) — so no `<link>`, `<meta>`, `<base>`, no frames (`iframe`, `frame`,
`embed`, `object`), no media (`audio`, `video`, `source`, `track`, `canvas`), no forms
(`form`, `input`, `button`, `select`, `textarea`), no `<template>`, `<slot>`, `<foreignObject>`.
- **Only the listed attributes** (`pages.static.attributes`): presentation and structure.
- **No address but two**: `#fragment` (a link or a reference within the page) and an inline
`data:image/png|jpeg|gif|webp;base64,…` image. Nothing else in `href`, `src`, `xlink:href` or
any other attribute — no `http:`, `https:`, `//host`, relative paths, `data:` of another kind.
- **CSS that fetches nothing**: no `@import`, and no `url(…)` other than `url(#fragment)` or
such an inline image — in a `<style>` element and in a `style` attribute alike.
A chart is therefore **inline SVG the model writes out**: bars, lines and pie slices as SVG
shapes, with the numbers it computed; a table is a table, styled with CSS.
**What a client that shows pages must do**, all of it:
1. **Rebuild the document from the allow-list** before showing it: parse what the model wrote,
keep the listed elements and attributes and the two kinds of address, drop everything else
(the element with its content for `script`, `style` that fetches, and the forbidden
elements; the attribute alone for a forbidden attribute). What is shown is the rebuilt
document, never the model's text as it came.
2. Show it in a **frame of its own origin with scripts off** — nothing allowed to the frame:
no script, no forms, no pop-ups, no navigation of itself or its parent, no cookie or storage
of the app's, no network.
3. Give it the five variables, a **fixed height with its own scrolling** (a static document
cannot report its height), and an **Open larger** control that shows the same rebuilt
document larger, in place, under the same rules.
**A client that cannot guarantee all of this shows the note of §3 instead** — a terminal, a
phone, and any client whose frame cannot be held to it. A page never reaches the app that shows
it, and never reaches anywhere else.
+5 -4
View File
@@ -1,8 +1,9 @@
<!-- Spec 3.8.0 (pages.md). Offered only when the instance, the model and the chat all say so; never
to a subagent, the phone assistant or an agent chat. The fence word and the variables are
loop.json `pages`. -->
- Your answer is Markdown, as always. Where seeing answers better than reading — a chart, a comparison laid out as a table with colour, a diagram, a small calculator — you may add a page to it: a complete, self-contained HTML document in a fenced block whose info string is `html-view` followed by a short title, for example ```html-view Monthly sales. One page per block. It is shown at that place in your answer, in a sealed frame.
- Everything the page needs is inside it: no external scripts, styles, fonts or images — the frame has no network, and anything loaded from elsewhere is simply missing. Draw charts with inline SVG, or with a script that draws on a canvas. No forms that submit, no links that navigate.
to a subagent, the phone assistant or an agent chat. The fence word, the variables and what a
static page may hold are loop.json `pages`. -->
- Your answer is Markdown, as always. Where seeing answers better than reading — a chart, a comparison laid out as a table with colour, a diagram, a timeline — you may add a page to it: a complete, self-contained HTML document in a fenced block whose info string is `html-view` followed by a short title, for example ```html-view Monthly sales. One page per block. It is shown at that place in your answer, in a sealed frame of a fixed height that scrolls.
- A page is static: HTML, CSS and inline SVG only. Nothing in it runs and nothing is loaded: no `<script>` and no event handlers; no `<link>`, `<meta>`, `<base>`, frames, objects, audio, video, canvas or forms; no address anywhere except `#fragment` and an inline `data:image/…` picture. Anything else is removed before the page is shown.
- Draw a chart as inline SVG you write out yourself: work the numbers out first, then write the bars, lines or slices as SVG shapes with their labels. Lay out and style tables and text with CSS in a `<style>` element — no `@import`, no `url(…)` to anywhere.
- Follow the reader's light or dark theme with the frame's CSS variables, always with a fallback: --page-bg (background), --page-ink (text), --page-muted (secondary text), --page-accent (the accent colour) and --page-line (rules and borders) — for example `color: var(--page-ink, #222)`.
- If the page itself contains a line of three backticks, open and close its block with four.
- Not every reader sees the page: on a phone or in a terminal there is only a note with its title. So the Markdown around it must make sense without it — say what the page shows, and put the conclusion in words. Add a page only when it earns its place; to change one, write the whole new page in a new block.
+11 -3
View File
@@ -51,6 +51,10 @@ A schedule says when its owner wants to hear from it (`scheduled.notify.values`)
| `never` | Never | nothing about reports | not offered |
A schedule that says nothing is `when` with the default condition (`scheduled.notify.default`).
The side that creates a schedule may choose otherwise for **a schedule that runs once**: a
person who asks for one thing, once, wants its answer, so a one-shot may be created as `always`
(`scheduled.notify.one_shot_default`). The value is the schedule's from then on, and is always
sent and stored as one of the three — only a schedule that truly carries none is read as `when`.
**The instruction** is `scheduled.notify.texts.<value>`, word for word, `{{condition}}` the
person's words (trimmed, one line, without a full stop at the end) — `never` has no text. It is
@@ -80,8 +84,8 @@ still says it failed.
## 5. `[SILENT]` is retired
The sentinel of 3.5.0 (`scheduled.sentinel`) is no longer told to any model: the notify-when
texts replace the hint. A reply that still carries it — an older prompt, a model's habit — is
The sentinel of 3.5.0 (`scheduled.sentinel`) is no longer told to a model: the notify-when
texts replace the hint — but for a run on a device that has no `reports` capability (§6). A reply that still carries it — an older prompt, a model's habit — is
read as **no report**: its sentinel lines (first or last line, as `conformance/silent.json`
strips them) are taken out before the history line is made, and under `always` an answer that is
only the sentinel files nothing. The run's status is never `silent` under 3.8.0; a device that
@@ -102,7 +106,11 @@ The report travels **with the turn's answer** — there is no method of its own:
answer.
- The server then applies §4 to that answer exactly as to a run of its own: the `always`
fallback, the history line and the notification are the server's, never the device's.
- A device **without** the capability (before 3.8.0) is not sent `notify` and offers no tool: the
- A device **without** the capability (before 3.8.0) is not sent `notify`, offers no tool, and
**must not be sent an instruction that names `report_write`** — its model would be told to
call a tool it does not have. Its run's prompt is the one of 3.5.0 instead: for `when`, the
`[SILENT]` hint as it was (say the sentinel alone when there is nothing to tell); for `always`
and `never`, no hint at all. This is the one place the sentinel is still told to a model. The
server files by §4 from its `text` alone — under `always` the answer is the report; under
`when` there is none, and the model's closing line is the note. `silent` from such a device is
`ok` without a report.
+13 -1
View File
@@ -193,6 +193,7 @@ export const LOOP: {
notify: {
values: string[]
default: string
one_shot_default: string
default_condition: string
labels: Record<"always" | "when" | "never", string>
texts: Record<"always" | "when", string>
@@ -202,7 +203,18 @@ export const LOOP: {
}
}
/** HTML pages in answers (spec 3.8.0, harness/pages.md). */
pages: { fence: string; title_max: number; untitled: string; variables: string[]; note: string; where: string; projection: string; never: string[] }
pages: {
fence: string
title_max: number
untitled: string
variables: string[]
note: string
where: string
projection: string
never: string[]
/** pages.md §6: what a static page may hold. */
static: { elements: string[]; attributes: string[]; attribute_prefixes: string[]; address_attributes: string[]; addresses: string[]; image_types: string[] }
}
/** Display (spec 3.7.0, harness/display.md): a tool call's title, states and facts, the blocks,
* the phases that end a reply, what each card offers. */
display: {
+56
View File
@@ -0,0 +1,56 @@
// A page is static (harness pages.md §6): HTML, CSS and inline SVG, nothing that runs and nothing
// that reaches anywhere. This says what in a page breaks that rule, by the spec's lists
// (loop.json pages.static) — the rule as the conformance cases pin it. A terminal shows no page,
// so nothing here is a sanitiser: a client that shows pages rebuilds the document with a real
// parser.
import { LOOP } from "../harness.ts"
const S = LOOP.pages.static
const ELEMENTS = new Set(S.elements.map((e) => e.toLowerCase()))
const ATTRIBUTES = new Set(S.attributes.map((a) => a.toLowerCase()))
const IMAGE = new RegExp(`^data:image/(?:${S.image_types.join("|")});base64,`, "i")
/** Whether an address is one of the two a page may hold: `#fragment`, or an inline picture. */
export const addressAllowed = (v: string) => /^#/.test(v.trim()) || IMAGE.test(v.trim())
/** What CSS would fetch: `@import`, and any url() that is not an allowed address. */
function cssFaults(css: string): string[] {
const out: string[] = []
if (/@import\b/i.test(css)) out.push("css:import")
for (const m of css.matchAll(/url\(\s*(['"]?)([^)'"]*)\1\s*\)/gi)) if (!addressAllowed(m[2]!)) out.push("css:url")
return out
}
/** What makes a page not static, each thing once, in the order first met; none: it is static. */
export function staticFaults(html: string): string[] {
const why: string[] = []
const say = (w: string) => void (why.includes(w) || why.push(w))
const TAG = /<(\/?)([a-zA-Z][a-zA-Z0-9:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g
let style = -1
for (const m of html.matchAll(TAG)) {
const name = m[2]!.toLowerCase()
if (m[1]) {
if (name === "style" && style >= 0) {
for (const f of cssFaults(html.slice(style, m.index))) say(f)
style = -1
}
continue
}
if (!ELEMENTS.has(name)) {
say(`element:${name}`)
continue
}
if (name === "style") style = m.index! + m[0].length
for (const a of m[3]!.matchAll(/([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)) {
const attr = a[1]!.toLowerCase()
const value = a[2] ?? a[3] ?? a[4] ?? ""
if (!ATTRIBUTES.has(attr) && !S.attribute_prefixes.some((p) => attr.startsWith(p))) {
say(`attribute:${attr}`)
continue
}
if (S.address_attributes.includes(attr) && !addressAllowed(value)) say(`address:${attr}`)
if (attr === "style") for (const f of cssFaults(value)) say(f)
}
}
return why
}
+5
View File
@@ -16,6 +16,7 @@ import { apply, fromTodos, normalise, type Plan } from "../src/plan/plan.ts"
import { ToolCallAccumulator, toOpenAIMessages } from "../src/provider/openai-chat.ts"
import type { Message } from "../src/provider/types.ts"
import { pageNote, pagesOf, pagesOffered, textProjection } from "../src/pages/fence.ts"
import { staticFaults } from "../src/pages/static.ts"
import { resolveBase } from "../src/library/store.ts"
import { NarrowError, narrowParameters, type Narrow } from "../src/harness.ts"
import { fillPrompt } from "../src/prompt/fill.ts"
@@ -125,6 +126,10 @@ export const AREAS: Record<string, (c: Case) => unknown> = {
return { note: pageNote(c.title as string) }
case "offered":
return { offered: pagesOffered(c as { instance?: boolean; model?: boolean; chat?: boolean; where?: string }) }
case "static": {
const why = staticFaults(c.html as string)
return why.length ? { static: false, why } : { static: true }
}
case "note_line":
return { line: c.change === "on" ? fillText(CONTEXT.note.pages_on, { pages_text: c.pages_text as string }) : CONTEXT.note.pages_off }
default: