@nac3/runtime 2.5.2 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SPEC.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NAC3 -- Native Agent Contract
2
2
 
3
- **Version:** 2.5.2 (stable -- the complete v2.5 surface: narrate, context+tree, expect+diff)
3
+ **Version:** 2.8.0 (stable -- the v2.5 surface, the v2.6 plugin extension hooks (discovery, self-description, emitter-listen), the v2.7 authenticity surface (HMAC-verified manifests, dispatch provenance, the probing validator, the surface doors of 15.12, the headless profile) and the v2.8 vocabulary: 45 surface roles, 7 declared aliases, the complete event table of 6.4, and `register_role`)
4
4
  **Status:** Stable release. The npm dist-tag `latest` points here; section 9.1 states what that guarantees and what a prerelease does not. This document states its version in exactly one place, the line above. The shipped RFCs and their Layer 2 + Layer 3 evidence are listed in `README.md` and `runtime/CHANGELOG.md`.
5
5
  **License:** Apache-2.0
6
6
  **Editor:** Yujin (yujin.app)
@@ -32,8 +32,12 @@ system.
32
32
 
33
33
  ## 1. Roles
34
34
 
35
- Every agent-relevant DOM element carries `data-nac-role`. The
36
- canonical roles are:
35
+ Every agent-relevant DOM element carries `data-nac-role`.
36
+
37
+ ### 1.1 Core roles
38
+
39
+ The roles below are the vocabulary the protocol has declared since
40
+ v1.0, plus the additions each row notes:
37
41
 
38
42
  | Role | Meaning | Example |
39
43
  |------|---------|---------|
@@ -58,6 +62,186 @@ canonical roles are:
58
62
  | `drop-target` | A place a `draggable` can be dropped (since 1.6.2). | `<ul data-nac-role="drop-target">` |
59
63
  | `button` | **Tolerated, not recommended.** A legacy button that only needs to be clickable, with no action contract. The runtime treats it as `action`. Prefer `action` with an explicit `data-nac-action`. | `<button data-nac-role="button">` |
60
64
 
65
+ ### 1.2 Surface roles (v2.8)
66
+
67
+ The twenty roles above are the vocabulary the protocol declared
68
+ through v2.7. They are not the vocabulary the protocol *used*:
69
+ measured against this tree on 2026-11-25, **67 distinct roles were
70
+ in use and 52 of them were not declared anywhere** -- not in this
71
+ table, not in the runtime's known-role set, not in the click
72
+ completion map. The runtime already emitted 121 distinct `nac:*`
73
+ events, of which this document named 16.
74
+
75
+ That gap was not cosmetic. `NAC.click()` picks the event it waits
76
+ for from the role on the target, and a role it does not know falls
77
+ back to the `action` family -- so a click on a widget that answers
78
+ with `nac:map:marker_selected` waited five seconds for
79
+ `nac:action:succeeded`, timed out, and reported that *the widget*
80
+ had not acknowledged. The protocol blamed the page for not speaking
81
+ a word the protocol did not have.
82
+
83
+ The roles below close that gap. They are **additive**: nothing in
84
+ the table above changed meaning, and section 12 promise 3 (the
85
+ canonical role set never shrinks) holds. Section 1.5 declares the
86
+ seven legacy spellings this tree had grown, each mapped to the
87
+ canonical role it means, so no markup that worked before stops
88
+ working.
89
+
90
+ **Maps.** The interior of a map is drawn, not marked up. The host
91
+ addresses what it owns; the pixels stay out of reach (section
92
+ 15.12).
93
+
94
+ | Role | Meaning | Example |
95
+ |------|---------|---------|
96
+ | `map` | A map viewport. Its own state (centre, zoom) is readable; its interior is reached through the elements below, never by coordinates in an id. | `<div data-nac-role="map">` |
97
+ | `map-layer` | A layer of a map that can be turned on and off. | `<li data-nac-role="map-layer">` |
98
+ | `map-marker` | A point of interest on a map. | `<button data-nac-role="map-marker">` |
99
+
100
+ **Charts.** The one family where what an agent needs is to *read*,
101
+ not to press. `chart-series` is the operable part; `chart-point`
102
+ carries the datum and is read-only.
103
+
104
+ | Role | Meaning | Example |
105
+ |------|---------|---------|
106
+ | `chart` | A chart host. | `<figure data-nac-role="chart">` |
107
+ | `chart-series` | One series of a chart. Clickable: toggling a series is the operation a chart offers. | `<li data-nac-role="chart-series">` |
108
+ | `chart-point` | One datum of a series. Read-only: it is addressable so an agent can read a value it would otherwise have to infer from pixels. | `<circle data-nac-role="chart-point">` |
109
+
110
+ **Calendar.**
111
+
112
+ | Role | Meaning | Example |
113
+ |------|---------|---------|
114
+ | `calendar` | A calendar host. Carries its own view state (month / week / day), which changes without any element being operated. | `<div data-nac-role="calendar">` |
115
+ | `calendar-event` | An entry on a calendar. | `<li data-nac-role="calendar-event">` |
116
+
117
+ **Tree.**
118
+
119
+ | Role | Meaning | Example |
120
+ |------|---------|---------|
121
+ | `tree` | A tree host. | `<ul data-nac-role="tree">` |
122
+ | `tree-node` | A node of a tree. Its expanded state is `data-nac-state`, not a separate role. | `<li data-nac-role="tree-node">` |
123
+ | `tree-children` | The container holding the children of a `tree-node`. It exists as a role because a collapsed subtree is present in the DOM and not operable, which is exactly what an agent has to be able to tell. | `<ul data-nac-role="tree-children">` |
124
+
125
+ **Timeline.** A timeline is usually paginated, and that is why its
126
+ load events are normative (section 6.4): an agent that cannot hear
127
+ `nac:timeline:loaded_more` reports the first page as the whole
128
+ record.
129
+
130
+ | Role | Meaning | Example |
131
+ |------|---------|---------|
132
+ | `timeline` | A chronological feed. | `<ol data-nac-role="timeline">` |
133
+ | `timeline-item` | One entry of a timeline. | `<li data-nac-role="timeline-item">` |
134
+
135
+ **Carousel.** The only family where the protocol has to talk about
136
+ time: a carousel with autoplay changes without anyone touching it,
137
+ so what an agent read a moment ago can stop being true. Section 6.4
138
+ keeps `nac:carousel:advanced` (the verb completed) distinct from
139
+ `nac:carousel:slide_changed` (the state moved, possibly on its
140
+ own).
141
+
142
+ | Role | Meaning | Example |
143
+ |------|---------|---------|
144
+ | `carousel` | A slide container that MAY advance on its own. | `<div data-nac-role="carousel">` |
145
+ | `carousel-slide` | One slide of a carousel. | `<li data-nac-role="carousel-slide">` |
146
+
147
+ **Live regions.** What the agent did not ask for and has to learn
148
+ about anyway. These map one-to-one onto ARIA, which is deliberate:
149
+ `docs/ACCESSIBILITY.md` claims that what makes an interface
150
+ navigable by an agent makes it navigable by a screen reader, and
151
+ this is where that stops being a sentence.
152
+
153
+ | Role | Meaning | Example |
154
+ |------|---------|---------|
155
+ | `status` | A short statement of current state, replaced in place (ARIA `role="status"`, polite). | `<span data-nac-role="status">` |
156
+ | `log` | An append-only record where new entries arrive at the end (ARIA `role="log"`). | `<div data-nac-role="log">` |
157
+ | `toast` | A transient notification that disappears on its own. Clicking it dismisses it. | `<div data-nac-role="toast">` |
158
+ | `toast-region` | The container a `toast` is appended to. Same element/container pairing as `data-table` and `row`. | `<div data-nac-role="toast-region">` |
159
+ | `banner` | A notification that persists until dismissed. | `<div data-nac-role="banner">` |
160
+ | `feedback` | The outcome of one operation, attached to the control that produced it: a state, a message and an optional error. Narrower than `status` and read by `NAC.read_feedback()`, which is why it is its own role. | `<span data-nac-role="feedback">` |
161
+
162
+ **Overlays.** An overlay creates the one problem an agent cannot
163
+ work around on its own: what was behind it is still in the DOM and
164
+ is no longer operable. An overlay host SHOULD declare
165
+ `undrivable_until` (section 19.1) on the entries it occludes, so a
166
+ refusal names the gate instead of reporting a hidden element.
167
+
168
+ | Role | Meaning | Example |
169
+ |------|---------|---------|
170
+ | `modal` | An overlay that occludes the whole surface behind it. `confirm-dialog` is the special case of a modal that asks a confirmation; `modal` is the general one. | `<div data-nac-role="modal">` |
171
+ | `drawer` | An edge-anchored overlay. The only role with an intermediate state of its own (`peek`: partially open, and what is operable in that state is up to the host to declare). | `<aside data-nac-role="drawer">` |
172
+ | `bottom-sheet` | A bottom-anchored overlay. | `<div data-nac-role="bottom-sheet">` |
173
+
174
+ **Controls whose value is not their text.** A combobox shows
175
+ "Argentina" and sends `AR`; a slider shows a position and sends a
176
+ number. These declare that the field has resolvable options or a
177
+ numeric range, which is what tells an agent to go through
178
+ `NAC.options()` / `NAC.set_options_resolver()` (section 5.1.3)
179
+ instead of typing what it sees.
180
+
181
+ | Role | Meaning | Example |
182
+ |------|---------|---------|
183
+ | `combobox` | A field whose displayed text is not its value. | `<input data-nac-role="combobox">` |
184
+ | `listbox` | A list of options whose selection is the value. Its children are `option`. | `<ul data-nac-role="listbox">` |
185
+ | `slider` | A continuous value control. | `<input type="range" data-nac-role="slider">` |
186
+ | `richtext` | A rich-text editor. Its operations (format, link, mention) are not value edits and have their own events. | `<div data-nac-role="richtext">` |
187
+
188
+ **Tabs, steps and accordions: the containers the protocol was
189
+ missing.** Each of these three families declared its *control* and
190
+ not its *content*, so an agent could activate a tab and had no way
191
+ to name what appeared.
192
+
193
+ | Role | Meaning | Example |
194
+ |------|---------|---------|
195
+ | `tablist` | The container of `tab` controls (ARIA `role="tablist"`). | `<div data-nac-role="tablist">` |
196
+ | `tabpanel` | The content a `tab` reveals (ARIA `role="tabpanel"`). | `<section data-nac-role="tabpanel">` |
197
+ | `stepper` | The container of `step` indicators. | `<ol data-nac-role="stepper">` |
198
+ | `accordion-section` | The content an `accordion-toggle` reveals. | `<section data-nac-role="accordion-section">` |
199
+
200
+ **Navigation containers.** Measured, not assumed: in this tree
201
+ `breadcrumb` sits on a `<nav>` and `pagination-control` on the
202
+ pager's container, so neither was a rival spelling of
203
+ `breadcrumb-item` / `pagination-item`. They were the containers,
204
+ and the containers were never declared.
205
+
206
+ | Role | Meaning | Example |
207
+ |------|---------|---------|
208
+ | `breadcrumb` | The container of `breadcrumb-item` hops. | `<nav data-nac-role="breadcrumb">` |
209
+ | `pagination-control` | The container of `pagination-item` controls. | `<div data-nac-role="pagination-control">` |
210
+
211
+ **Identity, and the state of the interface itself.** The last two
212
+ are the ones that matter most to an agent and were hardest to say:
213
+ the difference between "it has not loaded yet", "there is nothing
214
+ here, and that is not an error" and "it failed" is the difference
215
+ between waiting, moving on, and reporting a problem. None of the
216
+ four is clickable, and none of them is in the click completion map
217
+ -- putting them there would make `click()` promise a completion
218
+ nobody emits.
219
+
220
+ | Role | Meaning | Example |
221
+ |------|---------|---------|
222
+ | `avatar` | The visual identity of a person or account. Read-only. | `<span data-nac-role="avatar">` |
223
+ | `presence-indicator` | The availability of a person or account. Changes without being operated; its value is in `data-nac-state`. | `<span data-nac-role="presence-indicator">` |
224
+ | `skeleton` | A placeholder standing where real content will be. Means **not loaded yet**, never "empty". | `<div data-nac-role="skeleton">` |
225
+ | `empty-state` | The element shown in place of content when there is none. Means **nothing to show, and this is not an error**. | `<div data-nac-role="empty-state">` |
226
+
227
+ **Structure.** The last group is the one where the work was mostly
228
+ in what NOT to declare (section 1.5 has the discards). These seven
229
+ stayed because each one is consumed by something: three are queried
230
+ by the reference runtime itself, one is the host of a documented
231
+ verb, and one is the door section 15.12 decided on.
232
+
233
+ | Role | Meaning | Example |
234
+ |------|---------|---------|
235
+ | `list` | An ordered collection. The host of `NAC.reorder()`, whose completion event is `nac:list:reordered`. | `<ul data-nac-role="list">` |
236
+ | `row` | One row of a `data-table`. Read by the reference runtime to place cell ids. | `<tr data-nac-role="row">` |
237
+ | `menu` | A popup menu. **Not a `navigation` landmark**: a menu is transient and occludes, a landmark is permanent. | `<div data-nac-role="menu">` |
238
+ | `label` | The human name of a control. Read by the reference runtime when deriving a label for an element that has none. | `<span data-nac-role="label">` |
239
+ | `value` | The rendered value of a datum. Read-only, and the reason it exists: a screenless agent (section 19) has no other way to address a number that is only on screen. | `<strong data-nac-role="value">` |
240
+ | `paragraph` | A prose block addressable for reading. Declared for the same reason as `value`: under section 19 reading is a capability, not a side effect of having a screen. | `<p data-nac-role="paragraph">` |
241
+ | `canvas` | A host whose interior is **not in the DOM**. A role is not enough to operate it: its interior is reached through the plugin extension contract of section 15, which is the door section 15.12 assigned to this surface. Declaring `canvas` without that contract would promise what cannot be delivered. | `<div data-nac-role="canvas">` |
242
+
243
+ ### 1.3 Unknown roles
244
+
61
245
  Roles outside this list are reserved for future use. A NAC-strict
62
246
  runtime SHOULD reject unknown roles at register-time (v2.2). A
63
247
  NAC-permissive runtime MAY treat unknown roles as `action` for
@@ -71,6 +255,121 @@ reading prose. They agree as of v2.5. Any future divergence is
71
255
  visible in that flag rather than hidden in a difference of opinion
72
256
  between a document and an implementation.
73
257
 
258
+ ### 1.4 Registering a role (v2.8)
259
+
260
+ Sections 1.1 and 1.2 are a **closed** vocabulary, and section 1.3
261
+ says what a runtime does with a word that is not in it. That
262
+ closure is what makes a role worth reading: an agent that meets
263
+ `data-nac-role="action"` knows what it means without asking the
264
+ page.
265
+
266
+ It also meant that extending the vocabulary required editing this
267
+ document, the reference runtime, the static validator and nine
268
+ translations -- so nobody outside this repository could do it. That
269
+ is not a theoretical limitation. It is the measured cause of the
270
+ fifty-two undeclared roles this release absorbed: somebody needed a
271
+ word, the only door that was open was writing it into the HTML, and
272
+ no rule compared the markup against the vocabulary, so it worked
273
+ for four years.
274
+
275
+ From v2.8 there is a door:
276
+
277
+ ```js
278
+ NAC.register_role('gantt-bar', {
279
+ events: ['nac:gantt:bar_moved'], // its completion event
280
+ describes: 'one bar of a Gantt chart',
281
+ plugin: 'scheduling'
282
+ });
283
+ ```
284
+
285
+ From that call on, within that page: the manifest validator accepts
286
+ the role instead of reporting `manifest_role_unknown`,
287
+ `NAC.click()` waits for `nac:gantt:bar_moved` instead of falling
288
+ back to the `action` family and timing out, and `NAC.roles()`
289
+ reports the role with `source: "registered"` so a consumer can
290
+ always tell which half of the contract a word came from.
291
+
292
+ A registration is refused, by throwing, when the name is a
293
+ canonical role (a page does not get to redefine `action`: an agent
294
+ that trusted the protocol's meaning would be reading a different
295
+ contract on every page), when it is a declared alias of section
296
+ 1.5, when the name is not `^[a-z][a-z0-9-]*$`, or when a completion
297
+ event is not a `nac:` name. Registering the same role twice with
298
+ the same definition is idempotent -- a page that registers on every
299
+ render must not fail on the second one. Registering it with a
300
+ *different* definition throws, because two definitions of one word
301
+ is the drift this registry exists to prevent.
302
+
303
+ **The static half, and why it is not optional.** A registered role
304
+ exists only while the page is loaded, and `npx nac3 lint` runs with
305
+ no page: it reads files. A role declared in JavaScript is invisible
306
+ to it, so the lint would report a page as wrong for using a role
307
+ that page itself declares. Making the lint execute the page it is
308
+ validating is not an option -- a validator that runs its subject
309
+ has stopped being one. So a page that registers roles declares them
310
+ a second time, in a `nac3.roles.json` the lint can read:
311
+
312
+ ```json
313
+ {
314
+ "roles": [
315
+ { "role": "gantt-bar",
316
+ "events": ["nac:gantt:bar_moved"],
317
+ "describes": "one bar of a Gantt chart" }
318
+ ]
319
+ }
320
+ ```
321
+
322
+ Two declarations of one fact is exactly the producer/consumer
323
+ asymmetry the rest of this release spent its time removing, so it
324
+ is not left to good intentions: the lint reports
325
+ `role_registration_undeclared` when a page calls `register_role`
326
+ for a role its `nac3.roles.json` does not carry, and
327
+ `role_registration_orphan` in the other direction. A registered
328
+ role is **page-scoped**: it is not a proposal to add a word to this
329
+ document, and it carries none of the stability guarantees of
330
+ section 12.
331
+
332
+
333
+ ---
334
+
335
+ ## 1.5 Declared aliases
336
+
337
+ Seven spellings were in use in this tree for roles that already had
338
+ a name, or for concepts that are not roles. They are declared here
339
+ rather than deleted, for the reason section 12 gives: a spelling
340
+ that ever worked keeps working. The runtime resolves an alias to
341
+ its canonical role before anything else looks at it; the static
342
+ lint reports `dom_role_legacy_spelling` (severity `warn`) so a tree
343
+ can be migrated deliberately instead of all at once.
344
+
345
+ | Spelling in use | Canonical role | Why it is not its own role |
346
+ |-----------------|----------------|----------------------------|
347
+ | `treenode` | `tree-node` | Every multi-word canonical role in section 1 is hyphenated (`breadcrumb-item`, `accordion-toggle`, `sort-control`, `data-table`, `drop-target`). The unhyphenated spelling was the odd one out, not a different concept. |
348
+ | `timeline-entry` | `timeline-item` | The `-item` suffix is already canonical twice (`breadcrumb-item`, `pagination-item`). One suffix for "one of these", not two. |
349
+ | `input` | `field` | `field` is the canonical role for anything the user types or toggles, and has been since v1.0. |
350
+ | `textbox` | `field` | Same. The ARIA role name is `textbox`; the NAC3 role name is `field`, and section 1 is the authority on NAC3 role names. |
351
+ | `panel` | `region` | A nameable area inside a section is a `region`. `panel` was a second word for it. |
352
+ | `fab` | `action` | A floating action button is a button. Where it floats is presentation; the contract is `action`. |
353
+ | `dropzone` | `drop-target` | `drop-target` has been canonical since 1.6.2 and is what `NAC.drag_drop()` resolves. |
354
+
355
+ Two candidates were **rejected as aliases and kept as roles**.
356
+ `label` looked like presentation, and then measurement showed
357
+ the reference runtime queries `[data-nac-role="label"]` to derive a
358
+ name for an element that has none. A role the implementation reads
359
+ is part of the contract whether the document says so or not, which
360
+ is rule 10 of `docs/WORKING_AGREEMENT.md` applied to a role instead
361
+ of a sentence. And `feedback`, which looked like a second word for
362
+ `status` until the same measurement found `NAC.read_feedback()` -- a
363
+ published verb, since v1.3 -- filtering on it. The same measurement
364
+ kept `row`, `toast`, `toast-region` and `banner`.
365
+
366
+ Four concepts were discarded outright rather than aliased, because
367
+ nothing in the tree used them and inventing a role for them would
368
+ have been the opposite of this work: a pixel, a coordinate, a
369
+ viewport offset and a frame are **arguments**, not names. Section
370
+ 15.12 already decided that: an instant, a coordinate or an area
371
+ travels as an argument to a verb and never as part of an id.
372
+
74
373
  ---
75
374
 
76
375
  ## 2. Names
@@ -166,6 +465,51 @@ plugin manifest, finds the verb `save`, and emits
166
465
  sub-collections; same semantics as `elements[]` filtered by
167
466
  role. Demos pick the shape that reads cleanest to humans.
168
467
 
468
+ #### `undrivable_until` -- a gated surface, declared (2.7.0)
469
+
470
+ An `elements[]` entry MAY carry `undrivable_until: '<nac_id>'`:
471
+ the id of the element that has to be operated before this one can
472
+ be. It is the honest declaration for a surface that is painted and
473
+ declared but lives behind a closed panel, a collapsed drawer or a
474
+ step that has not been reached yet.
475
+
476
+ ```js
477
+ elements: [
478
+ { id: 'chat.toggle', role: 'action', actions: [{ verb: 'open' }] },
479
+ { id: 'chat.send', role: 'action', actions: [{ verb: 'send' }],
480
+ undrivable_until: 'chat.toggle' }
481
+ ]
482
+ ```
483
+
484
+ Three things follow, and none of them loosens anything:
485
+
486
+ - `NAC.click()` still **refuses** the element while it is hidden.
487
+ It really is unreachable, and pretending otherwise is the silent
488
+ damage this protocol exists to remove. What changes is the
489
+ rejection: `NacError('hidden')` now carries `.gate` and a
490
+ message naming the id to operate first, and
491
+ `nac:command:rejected` carries the same in `detail.gate`.
492
+ - `NAC.validate_global({probe: true})` stops reporting it as
493
+ `nac_id_declared_not_reachable` and reports it in the `gated`
494
+ bucket as `nac_id_undrivable_until_gate` (severity `info`),
495
+ which is not a finding (section 10.1).
496
+ - the declaration is **checked**. If `undrivable_until` names an id
497
+ that is not a usable way in -- no manifest declares it, it is not
498
+ mounted, it is on two nodes so `find()` picks by document order, or
499
+ it is itself unreachable -- the validator reports
500
+ `nac_id_undrivable_gate_unusable` at severity **error**, with
501
+ `gate_problem` saying which of the four it is. That is a harder
502
+ finding than the warn it replaced. A promised way in that does not
503
+ open is worse than no promise, because an agent will wait for it.
504
+
505
+ Absent the field nothing changes, so every manifest published before
506
+ 2.7.0 keeps the behaviour it had. The field was added because this
507
+ project's own landing page had no way to express it: the probe
508
+ reported seven correct and useless findings for a chat panel that is
509
+ closed on purpose, and the only alternatives were to stop declaring
510
+ the surface -- worse for the agent -- or to stop painting it until
511
+ opened, which is a rewrite of a published widget (audit N-39).
512
+
169
513
  ### 4.3 i18n
170
514
 
171
515
  Every `label_i18n` MUST cover all 10 NAC3 locales:
@@ -178,6 +522,19 @@ es, en, pt, fr, ja, zh, hi, ar, de, it
178
522
  partial coverage during brownfield migration; production manifests
179
523
  should ship 10 locales.
180
524
 
525
+ **The fallback chain, when coverage is partial (normative since
526
+ 2.7.0).** A manifest that covers the 10 locales never reaches this
527
+ rule; one that does not, does. Asked for a label in a locale the map
528
+ does not carry, the runtime answers in this order: **the requested
529
+ locale, then `es`, then `en`, then the first locale the map
530
+ carries**, and only then the key itself. The order is not alphabetical
531
+ and not English-first: it is the order the reference runtime has
532
+ resolved since 2.0, written down here because for two years it was
533
+ only in the code, and an undocumented resolution order is a coin flip
534
+ an adopter discovers in production (decision D-14). It does not
535
+ contradict section 4.3.2: that section is about the language of THIS
536
+ DOCUMENT, not about which string a host's own catalogue serves.
537
+
181
538
  #### 4.3.1 What the ten locales are a requirement ON
182
539
 
183
540
  The requirement above is a requirement on the **adopter's manifest** --
@@ -374,9 +731,12 @@ release, to formalise the schema grammar and make enforcement
374
731
  the default. **That did not happen in 2.4 and has not happened
375
732
  through 2.5.** The sentence is removed rather than re-dated: a
376
733
  promise with a version number attached, left standing past that
377
- version, reads to an agent as a capability it can expect. Formalising the
378
- grammar and wiring enforcement is tracked as an open question in
379
- section 13, where it is listed as open and undated.
734
+ version, reads to an agent as a capability it can expect.
735
+ **As of 2.7.0 the question is closed, not open**: `payload_schema`
736
+ stays informational, enforcement is not part of the protocol, and
737
+ the row in section 13 records the decision and its reasons. An agent
738
+ reads the field as DOCUMENTATION of what a host expects, never as a
739
+ guarantee that anything checked it.
380
740
 
381
741
  #### Disabled-state semantics (v2.3 hotfix from alpha.2)
382
742
 
@@ -769,13 +1129,45 @@ All async methods reject with `NacError` whose `code` is one of:
769
1129
 
770
1130
  ### 5.2 Introspection
771
1131
 
1132
+ Everything an agent can ASK without changing anything. All of it is
1133
+ synchronous: it reads the document and the registry and reaches no
1134
+ surface.
1135
+
772
1136
  ```ts
1137
+ /* the document, as the protocol sees it */
773
1138
  NAC.describe(): { active: string|null, plugins: PluginSnap[] }
774
1139
  NAC.describe_v2(): { v2_scope_entries: [...], sitemap: ..., data_tables: [...] }
775
1140
  NAC.manifest(plugin_slug: string): Manifest|null
1141
+
1142
+ /* resolution: one element, or every element of a role */
1143
+ NAC.find(nac_id: string, opts?: {plugin?: string}): ElementSnap|null
1144
+ NAC.list(role?: string): ElementSnap[]
1145
+
1146
+ /* state an agent must be able to read rather than infer */
1147
+ NAC.read_feedback(): Array<{ nac_id, state, message, error }>
1148
+ NAC.snapshot_state(): { errors: [...], ... }
1149
+
1150
+ /* the role vocabulary, with the provenance of every word (v2.8, 1.4) */
1151
+ NAC.roles(): { spec_version, canonical: string[], aliases: {...},
1152
+ registered: [...], click_events: {...}, no_click_event: string[] }
1153
+ NAC.canonical_role(role: string): string
1154
+
1155
+ /* conformance */
776
1156
  NAC.validate_global(opts?: {probe?: boolean}): GlobalReport // named buckets, see 10.1
777
1157
  ```
778
1158
 
1159
+ `find` is the one worth pointing at, because it is the resolver every
1160
+ other verb is built on and it was published for seven minor versions
1161
+ without this document naming it. `find(id)` answers *what is this id,
1162
+ and is it there* -- without clicking it, without focusing it, without
1163
+ touching the page. An agent that wants to check a precondition before
1164
+ acting has needed exactly that from the start; until v2.8 it had to
1165
+ read `js/nac.js` to learn the verb existed. Audit PND-129.
1166
+
1167
+ `list(role)` is its plural: every element the page declares with that
1168
+ role, or every declared element when the argument is omitted. Both
1169
+ return the same element shape the buckets of 10.1 use.
1170
+
779
1171
  ### 5.3 Data tables (since 2.1)
780
1172
 
781
1173
  The data-table primitives are NOT part of the core runtime
@@ -979,6 +1371,49 @@ Every action emits a deterministic completion event. The runtime's
979
1371
  | `sort-control` | `nac:table:sort_changed` | -- |
980
1372
  | `filter-control` | `nac:table:filter_changed` | -- |
981
1373
 
1374
+ | `map-layer` | `nac:map:layer_toggled` | -- |
1375
+ | `map-marker` | `nac:map:marker_selected` | -- |
1376
+ | `chart-series` | `nac:chart:series_toggled` | -- |
1377
+ | `calendar-event` | `nac:calendar:event_selected` | -- |
1378
+ | `tree-node` | `nac:tree:selected` | -- |
1379
+ | `carousel-slide` | `nac:carousel:slide_changed` | -- |
1380
+ | `toast` | `nac:toast:dismissed` | -- |
1381
+ | `banner` | `nac:banner:dismissed` | -- |
1382
+ | `combobox` | `nac:field:changed` | -- |
1383
+ | `listbox` | `nac:field:changed` | -- |
1384
+ | `slider` | `nac:slider:value_changed` | -- |
1385
+ | `richtext` | `nac:richtext:format_applied` | -- |
1386
+
1387
+ The `tab` row above gained its failure event in v2.8:
1388
+ `nac:tab:activation_failed` existed in the runtime from v2.2 and was
1389
+ not in this table, so `NAC.click()` on a tab whose activation was
1390
+ refused waited out its full timeout instead of rejecting at once.
1391
+
1392
+ **The forty-one roles with no completion event of their own.** They are
1393
+ listed because the absence is part of the contract, not an
1394
+ oversight: `plugin`, `section`, `region`, `navigation`,
1395
+ `data-table`, `confirm-dialog`, `draggable`, `drop-target`, `map`,
1396
+ `chart`, `chart-point`, `calendar`, `tree`, `tree-children`,
1397
+ `timeline`, `timeline-item`, `carousel`, `status`, `log`,
1398
+ `toast-region`, `feedback`, `modal`, `drawer`, `bottom-sheet`, `tablist`,
1399
+ `tabpanel`, `stepper`, `accordion-section`, `breadcrumb`,
1400
+ `pagination-control`, `avatar`, `presence-indicator`, `skeleton`,
1401
+ `empty-state`, `list`, `row`, `menu`, `label`, `value`, `paragraph`
1402
+ and `canvas`.
1403
+
1404
+ Four of those are structural hosts, two are driven by
1405
+ `NAC.drag_drop()` rather than by a click, and the rest are
1406
+ read-only or are containers whose control carries the event. What
1407
+ `NAC.click()` does with them has not changed: it clicks, and it
1408
+ still listens for the `action` family, because a host is free to
1409
+ make a region clickable and emit `nac:action:succeeded`. What
1410
+ changed in v2.7 is that the timeout says which of the two happened
1411
+ instead of blaming the widget, and what changed in v2.8 is that
1412
+ the list above is complete -- before it, a click on any of the
1413
+ thirty-three roles v2.8 added to it fell through to the `action`
1414
+ family indistinguishably from a role nobody had thought about.
1415
+
1416
+
982
1417
  ### 6.1 Event detail shape
983
1418
 
984
1419
  Every event detail carries the canonical id field plus `plugin`:
@@ -1025,6 +1460,318 @@ click started. Hence the separate event family.
1025
1460
 
1026
1461
  ---
1027
1462
 
1463
+ ### 6.4 The complete event vocabulary (v2.8)
1464
+
1465
+ Through v2.7 this document named **16** events and the reference
1466
+ runtime emitted **121**. The other 105 were signals the system
1467
+ produced that no consumer could learn about by reading the
1468
+ specification -- only by reading the implementation, which is the
1469
+ one thing a protocol exists to make unnecessary.
1470
+
1471
+ The tables below are the whole vocabulary. They are normative in
1472
+ the same sense as section 1: an event the reference runtime emits
1473
+ and this section does not name is a defect, and
1474
+ `scripts/check-event-vocabulary.mjs` refuses the build when that
1475
+ happens -- in both directions, so a name retired from the code
1476
+ cannot be left declared here either.
1477
+
1478
+ Three conventions, stated once because they recur:
1479
+
1480
+ - **A completion is not a state.** `nac:carousel:advanced` says a
1481
+ verb finished; `nac:carousel:slide_changed` says the view moved,
1482
+ and it fires on its own when autoplay runs. Only the first is
1483
+ something an agent can wait for.
1484
+ - **Four pairs are duplicates, kept on purpose.** Each pair below
1485
+ marks one spelling **canonical** and keeps the other emitted,
1486
+ because both shipped and a listener may be bound to either.
1487
+ Section 12 promise 2 is why they are not deleted.
1488
+ - **A two-segment name is not a family member.** It is about the
1489
+ runtime or the page rather than about one element, so it has no
1490
+ family to belong to.
1491
+
1492
+ **`action` -- the default contract**
1493
+
1494
+ The family every `action` and `button` answers with. `requested` and `dispatching` are the two halves of the call leaving; `succeeded` and `failed` are the effect landing. A host that emits `nac:action:confirmed` has resolved a confirmation gate (section 5.1.4).
1495
+
1496
+ | Event | What it means |
1497
+ |-------|---------------|
1498
+ | `nac:action:requested` | A verb was asked for. Emitted before any effect; this is where a host validates a payload. |
1499
+ | `nac:action:dispatching` | The request passed validation and is on its way to the host handler. |
1500
+ | `nac:action:succeeded` | The effect happened. The completion event of `action` and `button`. |
1501
+ | `nac:action:failed` | The effect did not happen. Carries the reason. |
1502
+ | `nac:action:confirmed` | A confirmation gate in front of an action was resolved affirmatively. |
1503
+
1504
+ **`command` -- what the runtime itself refused**
1505
+
1506
+ These do not come from a widget: the runtime emits them about its own verbs, so a silent miss can be heard instead of only thrown (v1.8).
1507
+
1508
+ | Event | What it means |
1509
+ |-------|---------------|
1510
+ | `nac:command_pending` | A verb was accepted and has not resolved yet. |
1511
+ | `nac:command_done` | A verb resolved. |
1512
+ | `nac:command_failed` | A verb rejected after reaching its target. |
1513
+ | `nac:command_rejected` | A verb was refused before reaching a target (not found, hidden, disabled, gated). |
1514
+ | `nac:command:failed` | The three-segment spelling of `nac:command_failed`, emitted alongside it since v1.8 for listeners that filter by family. |
1515
+ | `nac:command:rejected` | The three-segment spelling of `nac:command_rejected`. |
1516
+
1517
+ **`field` and value controls**
1518
+
1519
+ One event for a value change, whatever the control. A `slider` has its own because the value is continuous and the host may coalesce.
1520
+
1521
+ | Event | What it means |
1522
+ |-------|---------------|
1523
+ | `nac:field:changed` | The value of a `field`, `option`, `combobox` or `listbox` changed. |
1524
+ | `nac:slider:value_changed` | The value of a `slider` changed. |
1525
+ | `nac:tags:added` | A tag was added to a multi-value field. |
1526
+ | `nac:tags:removed` | A tag was removed from a multi-value field. |
1527
+
1528
+ **`richtext` -- editing that is not a value change**
1529
+
1530
+ Formatting is not typing: the document changed shape, not content. `format_applied` is the canonical completion of a `richtext` click; `formatted` is kept because it shipped first and a listener may be bound to it.
1531
+
1532
+ | Event | What it means |
1533
+ |-------|---------------|
1534
+ | `nac:richtext:format_applied` | A formatting operation completed. **Canonical.** |
1535
+ | `nac:richtext:formatted` | Deprecated spelling of `format_applied`, still emitted. |
1536
+ | `nac:richtext:link_inserted` | A link was inserted. |
1537
+ | `nac:richtext:mention_picked` | A mention was chosen from the editor picker. This is an option resolution happening while typing (section 5.1.3). |
1538
+
1539
+ **`tab`, `step`, `accordion` and `section` -- progressive disclosure**
1540
+
1541
+ The three families whose control was declared and whose content was not until v2.8. `section:reached` is the only one that fires without anybody operating anything: it means a scroll brought a landmark into view.
1542
+
1543
+ | Event | What it means |
1544
+ |-------|---------------|
1545
+ | `nac:tab:activated` | A tab was activated. The completion event of `tab`. |
1546
+ | `nac:tab:changed` | The active tab of a `tablist` changed, including when the host changed it on its own. |
1547
+ | `nac:tab:activation_failed` | A tab refused activation. The failure event of `tab`. |
1548
+ | `nac:step:advanced` | A wizard moved forward. |
1549
+ | `nac:step:back` | A wizard moved backward. |
1550
+ | `nac:step:completed` | The last step of a `stepper` was completed. |
1551
+ | `nac:accordion:expanded` | An `accordion-section` opened. |
1552
+ | `nac:accordion:collapsed` | An `accordion-section` closed. |
1553
+ | `nac:section:expanded` | A collapsible `section` opened. |
1554
+ | `nac:section:collapsed` | A collapsible `section` closed. |
1555
+ | `nac:section:reached` | A `section` came into view. State, not a completion: nobody asked for it. |
1556
+
1557
+ **`table` and `dt` -- the data-table surface**
1558
+
1559
+ `nac:table:*` are the three completions a column header or pager produces. The eleven `nac:dt:*` are the editable-table surface of 2.1 and are about the *model*, not about a click: an agent that edits a cell has to be able to tell a validated edit from a committed one.
1560
+
1561
+ | Event | What it means |
1562
+ |-------|---------------|
1563
+ | `nac:table:sort_changed` | A column sort changed. The completion event of `sort-control`. |
1564
+ | `nac:table:filter_changed` | A column filter changed. The completion event of `filter-control`. |
1565
+ | `nac:table:page_changed` | The page of a paginated table changed. The completion event of `pagination-item`. |
1566
+ | `nac:dt:registered` | A data table was registered with the runtime. |
1567
+ | `nac:dt:unregistered` | A data table was removed. |
1568
+ | `nac:dt:cell_edited` | A cell took a new value in the edit buffer. Not yet committed. |
1569
+ | `nac:dt:validation_failed` | An edit was rejected by the table validator; the buffer still holds the old value. |
1570
+ | `nac:dt:committed` | The edit buffer was written through. |
1571
+ | `nac:dt:discarded` | The edit buffer was dropped without writing. |
1572
+ | `nac:dt:row_added` | A row was added. |
1573
+ | `nac:dt:row_removed` | A row was removed. |
1574
+ | `nac:dt:selection_changed` | The selected rows changed. |
1575
+ | `nac:dt:aggregate_changed` | A footer aggregate recomputed. |
1576
+ | `nac:dt:matrix_cell_set` | A cell of a matrix-shaped table took a value. |
1577
+
1578
+ **`map` -- six events for a surface with no DOM inside**
1579
+
1580
+ `marker_selected` is the canonical completion of a click on a `map-marker`; `marker_clicked` is kept because it shipped first. `moved` and `zoom_changed` are state and arrive without anybody operating an element, which is why an agent must not treat two reads of a map as comparable (section 15.12).
1581
+
1582
+ | Event | What it means |
1583
+ |-------|---------------|
1584
+ | `nac:map:marker_selected` | A marker became the selection. **Canonical** completion of `map-marker`. |
1585
+ | `nac:map:marker_clicked` | Deprecated spelling of `marker_selected`, still emitted. |
1586
+ | `nac:map:layer_toggled` | A `map-layer` was turned on or off. Completion of `map-layer`. |
1587
+ | `nac:map:focused` | The map centred on something it was asked to focus. |
1588
+ | `nac:map:moved` | The viewport moved. State. |
1589
+ | `nac:map:zoom_changed` | The zoom level changed. State. |
1590
+
1591
+ **`chart` -- reading, not pressing**
1592
+
1593
+ | Event | What it means |
1594
+ |-------|---------------|
1595
+ | `nac:chart:series_toggled` | A `chart-series` was shown or hidden. Completion of `chart-series`. |
1596
+ | `nac:chart:filtered` | The chart data was filtered. |
1597
+ | `nac:chart:data_loaded` | New data arrived. Every `chart-point` read before this event is stale. |
1598
+
1599
+ **`calendar`**
1600
+
1601
+ Same shape as the map: a duplicated pair, and one event that is about the whole view rather than about an element.
1602
+
1603
+ | Event | What it means |
1604
+ |-------|---------------|
1605
+ | `nac:calendar:event_selected` | A `calendar-event` became the selection. **Canonical** completion of `calendar-event`. |
1606
+ | `nac:calendar:event_clicked` | Deprecated spelling of `event_selected`, still emitted. |
1607
+ | `nac:calendar:date_selected` | A date was selected. |
1608
+ | `nac:calendar:view_changed` | The calendar changed view (month / week / day). State of the `calendar`, not of an element. |
1609
+
1610
+ **`tree`**
1611
+
1612
+ `invalidated` is the one that is easy to get wrong: it is a cache invalidation, not a success. An agent that reads it as a completion believes something finished that never started.
1613
+
1614
+ | Event | What it means |
1615
+ |-------|---------------|
1616
+ | `nac:tree:selected` | A `tree-node` became the selection. Completion of `tree-node`. |
1617
+ | `nac:tree:expanded` | A node opened; its `tree-children` is now operable. |
1618
+ | `nac:tree:collapsed` | A node closed; its `tree-children` is in the DOM and not operable. |
1619
+ | `nac:tree:invalidated` | The cached shape of the tree is no longer valid. **Not a completion.** |
1620
+
1621
+ **`timeline` -- the two events that stop an agent from reporting a page as the whole record**
1622
+
1623
+ | Event | What it means |
1624
+ |-------|---------------|
1625
+ | `nac:timeline:loaded` | The first page of a timeline arrived. |
1626
+ | `nac:timeline:loaded_more` | A further page arrived. While this can still fire, the record is incomplete. |
1627
+
1628
+ **`carousel` -- the one family where the protocol talks about time**
1629
+
1630
+ `advanced` and `slide_changed` are not the same event with two names, and this is the distinction that makes the pair worth keeping: one is *the verb completed*, the other is *the state moved*, and the state moves on its own when autoplay is running.
1631
+
1632
+ | Event | What it means |
1633
+ |-------|---------------|
1634
+ | `nac:carousel:advanced` | A carousel advanced because it was asked to. The verb completed. |
1635
+ | `nac:carousel:slide_changed` | The visible slide changed, including on its own. Completion of `carousel-slide`. |
1636
+ | `nac:carousel:autoplay_paused` | Autoplay stopped. From here a read of the carousel stays true. |
1637
+ | `nac:carousel:autoplay_resumed` | Autoplay started again. From here it does not. |
1638
+
1639
+ **`toast`, `banner` -- what the agent did not ask for**
1640
+
1641
+ `shown` is the canonical appearance; `fired` is kept because it shipped first and is emitted at call time rather than at paint time.
1642
+
1643
+ | Event | What it means |
1644
+ |-------|---------------|
1645
+ | `nac:toast:shown` | A `toast` appeared. **Canonical.** |
1646
+ | `nac:toast:fired` | A toast was requested. Deprecated as the appearance signal, still emitted. |
1647
+ | `nac:toast:dismissed` | A toast went away, by click or by timeout. Completion of `toast`. |
1648
+ | `nac:banner:dismissed` | A `banner` was dismissed. Completion of `banner`. |
1649
+
1650
+ **`drawer`, `editor`, `plugin` -- containers opening and closing**
1651
+
1652
+ `nac:drawer:peek` is the only intermediate container state in the protocol: neither open nor closed. What is operable in that state is for the host to declare, with `undrivable_until` (section 19.1).
1653
+
1654
+ | Event | What it means |
1655
+ |-------|---------------|
1656
+ | `nac:drawer:opened` | A `drawer` opened. |
1657
+ | `nac:drawer:closed` | A `drawer` closed. |
1658
+ | `nac:drawer:peek` | A drawer is partially open. |
1659
+ | `nac:editor:opened` | The field editor of section 5.1.3 opened. |
1660
+ | `nac:editor:closed` | The field editor closed. |
1661
+ | `nac:plugin:opened` | A plugin surface opened. |
1662
+ | `nac:plugin:closed` | A plugin surface closed. |
1663
+ | `nac:plugin:minimized` | A plugin surface was minimized. |
1664
+ | `nac:plugin:maximized` | A plugin surface was maximized. |
1665
+ | `nac:plugin:restored` | A plugin surface returned to its previous size. |
1666
+ | `nac:plugin:reset` | A plugin surface was reset to its initial state. |
1667
+ | `nac:plugin:invalidated` | A plugin surface declared its cached description stale. |
1668
+ | `nac:plugin:invoked` | A section 15 primitive was invoked on a registered plugin. |
1669
+ | `nac:plugin:read` | A section 15 `read` resolved. |
1670
+ | `nac:plugin:event` | A section 15 `subscribe` delivered an event. |
1671
+
1672
+ The last three are composed at emit time (`'nac:plugin:' + kind`)
1673
+ rather than written as literals, so a scan of the runtime's string
1674
+ constants cannot see them. Nine names in this section are like that
1675
+ -- these three plus the `nac:authority:*` family and
1676
+ `nac:action:confirmed`. `scripts/check-event-vocabulary.mjs` does
1677
+ not carry a list of them: it reads the kinds off the call sites of
1678
+ the three emitters that compose them, so a new one cannot slip past
1679
+ a mechanical gate by being dynamic.
1680
+
1681
+ **`confirm` -- the gate in front of a destructive action**
1682
+
1683
+ | Event | What it means |
1684
+ |-------|---------------|
1685
+ | `nac:confirm:requested` | A confirmation was asked for; a `confirm-dialog` is now the surface. |
1686
+ | `nac:confirm:confirmed` | The affirmative branch was taken. |
1687
+ | `nac:confirm:cancelled` | The negative branch was taken. Failure event of `confirm-button`. |
1688
+ | `nac:confirm:resolved` | The gate closed, either way. Completion of `confirm-button`. |
1689
+ | `nac:action:confirm:requested` | A confirmation gate opened in front of a named action (v1.9 family, four segments). |
1690
+ | `nac:action:confirm:granted` | The gate was granted. |
1691
+ | `nac:action:confirm:denied` | The gate was denied. |
1692
+
1693
+ **`drag` -- the four events of `NAC.drag_drop()`**
1694
+
1695
+ The verb has been documented since 1.6.2 and its events were not. All four are about the same gesture and only the last two are terminal.
1696
+
1697
+ | Event | What it means |
1698
+ |-------|---------------|
1699
+ | `nac:drag:started` | A `draggable` was picked up. |
1700
+ | `nac:drag:over` | The pointer is over a `drop-target` that would accept the drop. |
1701
+ | `nac:drag:dropped` | The drop happened. Terminal. |
1702
+ | `nac:drag:cancelled` | The gesture ended with no drop. Terminal. |
1703
+
1704
+ **`list` -- the event of `NAC.reorder()`**
1705
+
1706
+ | Event | What it means |
1707
+ |-------|---------------|
1708
+ | `nac:list:reordered` | A `list` took a new order. Carries the index that was actually applied, which is not necessarily the one asked for (section 5.1). |
1709
+
1710
+ **Navigation and focus**
1711
+
1712
+ | Event | What it means |
1713
+ |-------|---------------|
1714
+ | `nac:breadcrumb:navigated` | A `breadcrumb-item` was followed. Completion of `breadcrumb-item`. |
1715
+ | `nac:focus:moved` | The runtime moved focus (section 17). |
1716
+ | `nac:state:changed` | A `data-nac-state` value changed on an addressable element. |
1717
+ | `nac:mode:requested` | A host-defined mode change was asked for. |
1718
+ | `nac:authority:requested` | An elevated-authority step was asked for (section 5.1.7). |
1719
+ | `nac:authority:granted` | The scope was granted. A granted `high` satisfies `medium` and `low`; a granted `low` satisfies neither of the higher two. |
1720
+ | `nac:authority:denied` | The scope was refused. |
1721
+ | `nac:authority:revoked` | A previously granted scope was withdrawn. Idempotent: revoking what was never granted emits nothing. |
1722
+ | `nac:authority:expired` | A granted scope reached its time limit. This one arrives without anybody doing anything, so an agent that cached a capability has to listen for it. |
1723
+
1724
+ **Lifecycle of the runtime itself**
1725
+
1726
+ Two-segment names, and that is deliberate: they are not about any element, so there is no family to put them in.
1727
+
1728
+ | Event | What it means |
1729
+ |-------|---------------|
1730
+ | `nac:installed` | The runtime installed on the page. |
1731
+ | `nac:v2_installed` | The v2 extension module installed. |
1732
+ | `nac:registered` | A manifest was registered. |
1733
+ | `nac:locale_changed` | The active locale changed (section 4.3). |
1734
+ | `nac:role_registered` | A host declared a page-scoped role with `NAC.register_role()` (section 1.4). From this event on, that role resolves. |
1735
+ | `nac:source_changed` | The provenance source for synthetic actions changed (section 15.7). |
1736
+ | `nac:fatal` | The runtime reached a state it will not continue from. |
1737
+
1738
+ **Resolution warnings -- the protocol telling on the page**
1739
+
1740
+ These are the ones a conformance run should be read against: each one is the runtime saying it could answer, and that the answer rested on something the page should fix.
1741
+
1742
+ | Event | What it means |
1743
+ |-------|---------------|
1744
+ | `nac:duplicate_warn` | Two elements carried the same `data-nac-id`; the first in document order was used. |
1745
+ | `nac:depth_warn` | Resolution crossed more nesting levels than the protocol expects. |
1746
+ | `nac:disambiguation_requested` | A name matched more than one element and the runtime refused to choose (section 5.4). |
1747
+ | `nac:autoregister_orphan_warn` | An element was auto-registered because no manifest claimed it. |
1748
+ | `nac:adopt_failed` | An element could not be adopted into a manifest. |
1749
+ | `nac:autoregister_role_underivable` | No declared role could be derived for an element, so none was written (section 1). |
1750
+ | `nac:i18n_skipped` | A label was not translated because its catalogue entry was missing (section 4.3). |
1751
+ | `nac:virtual_resolver_slow` | A virtualised-surface resolver took longer than its budget (section 15.12). |
1752
+
1753
+ **Shadow DOM**
1754
+
1755
+ | Event | What it means |
1756
+ |-------|---------------|
1757
+ | `nac:shadow_blocked` | Resolution stopped at a closed shadow root that had not volunteered exposure (section 5.1.6). |
1758
+ | `nac:shadow_depth_exceeded` | Shadow nesting went past the configured limit. |
1759
+ | `nac:shadow_protocol_violation` | A shadow root exposed something the protocol does not allow. |
1760
+
1761
+ **Cross-frame**
1762
+
1763
+ Seven events for one question -- is the document in that frame speaking this protocol, and can its claims be trusted (section 7).
1764
+
1765
+ | Event | What it means |
1766
+ |-------|---------------|
1767
+ | `nac:iframe_describe_received` | A framed document answered a description request. |
1768
+ | `nac:iframe_handshake_timeout` | A framed document did not answer in time. |
1769
+ | `nac:iframe_version_mismatch` | A framed document runs a different protocol version. |
1770
+ | `nac:iframe_untrusted` | A message arrived from an origin that is not on the trust list. |
1771
+ | `nac:iframe_signature_missing` | A framed claim arrived unsigned where a signature is required. |
1772
+ | `nac:iframe_signature_invalid` | A framed claim arrived with a signature that did not verify. |
1773
+ | `nac:iframe_no_secret_at_nac3` | A signature could not be checked because no secret was registered. |
1774
+
1028
1775
  ## 7. Provenance
1029
1776
 
1030
1777
  ### 7.1 isTrusted
@@ -1092,15 +1839,32 @@ A page is at **NAC3 Conformance Level 1** if:
1092
1839
  - Every clickable widget that an agent should be able to operate
1093
1840
  carries `data-nac-id` and `data-nac-role`.
1094
1841
  - Every `data-nac-role="action"` element fires
1095
- `nac:action:succeeded` after its side effect.
1842
+ `nac:action:succeeded` after its side effect -- **except when that
1843
+ side effect is a navigation that unloads the document**, where there
1844
+ is no "after": nothing is left to emit the event and nothing is left
1845
+ to hear it. Such an element MAY emit BEFORE navigating, which is what
1846
+ lets an agent await a confirmation, and a validator MUST report the
1847
+ ones that do not as navigating rather than as failing. (Through 2.6
1848
+ this bullet carried no exception, so a page whose actions are plain
1849
+ `<a href>` links could not reach level 1 at all -- 31 of the 39
1850
+ actions of this project's own landing page are such links. The
1851
+ reference validator already separated them and answered
1852
+ `unverified`; what was missing was the sentence. Audit N-38, closed
1853
+ in 2.7.0.)
1096
1854
  - The page registers at least one plugin manifest via
1097
1855
  `NAC.register()`.
1098
1856
  - `NAC.click(id)` works for every advertised id.
1099
1857
 
1100
1858
  A page is at **NAC3 Conformance Level 2** if it also:
1101
1859
 
1102
- - Registers `tabs[]`, `fields[]`, `actions[]` arrays explicitly
1103
- in its manifest (not inferred from DOM).
1860
+ - Declares its surface EXPLICITLY in the manifest instead of leaving
1861
+ it to be inferred from the DOM, in either published shape:
1862
+ `elements[]` with a `role` on every entry, which is the canonical
1863
+ shape of section 4, or the legacy `tabs[]` / `fields[]` /
1864
+ `actions[]` arrays. (Through 2.6 this bullet named only the three
1865
+ legacy arrays, so a page written the way section 4 documents failed
1866
+ level 2 as worded -- including this project's own landing page,
1867
+ whose two manifests use `elements[]`. Audit N-37, closed in 2.7.0.)
1104
1868
  - Provides `label_i18n` covering all 10 NAC3 locales for every
1105
1869
  user-facing label.
1106
1870
  - Implements the v2.0 brownfield primitives: scope tree,
@@ -1203,6 +1967,7 @@ without parsing a message:
1203
1967
  {
1204
1968
  ok: boolean, // false when any error-severity finding exists
1205
1969
  has_errors: boolean,
1970
+ probed: boolean, // the echo of opts.probe (since 2.7.0)
1206
1971
  duplicates: [{ code: 'nac_id_duplicate_across_plugins',
1207
1972
  severity: 'error', nac_id, plugins: string[] }],
1208
1973
  orphans: [{ code: 'nac_id_orphan_in_dom',
@@ -1211,6 +1976,17 @@ without parsing a message:
1211
1976
  unmounted: [{ code: 'nac_id_declared_not_mounted',
1212
1977
  severity: 'warn', nac_id, in_manifest, in_dom,
1213
1978
  plugin }],
1979
+ ambiguous: [{ code: 'nac_id_ambiguous_in_dom',
1980
+ severity: 'error', nac_id, count, plugin, hint }],
1981
+ unreachable:
1982
+ [{ code: 'nac_id_declared_not_reachable',
1983
+ severity: 'warn', nac_id, reason, plugin, hint },
1984
+ { code: 'nac_id_undrivable_gate_unusable',
1985
+ severity: 'error', nac_id, reason, gate,
1986
+ gate_problem, plugin, hint }],
1987
+ gated: [{ code: 'nac_id_undrivable_until_gate',
1988
+ severity: 'info', nac_id, reason, gate, plugin,
1989
+ hint }],
1214
1990
  convention_violations:
1215
1991
  [{ code: 'nac_id_missing_plugin_prefix',
1216
1992
  severity: 'warn', nac_id, plugin, hint }],
@@ -1224,11 +2000,36 @@ without parsing a message:
1224
2000
  }
1225
2001
  ```
1226
2002
 
1227
- The five codes, their severity and what to do about each are
2003
+ The codes, their severity and what to do about each are
1228
2004
  published as data at `api/latest/findings.json`, under
1229
2005
  `global_buckets`. Finding codes are stable across patch releases;
1230
2006
  new codes only in minor bumps, and a code is never reused for a
1231
- different condition (section 12, promise 4).
2007
+ different condition (section 12, promise 4). The last four arrived in
2008
+ 2.7.0 and are reported only when the validator is asked to probe.
2009
+
2010
+ **`gated` is not a findings bucket.** An element that declares what
2011
+ opens it is keeping the contract, not breaking it, so `gated` is
2012
+ excluded from `ok`, from `has_errors` and from the "zero findings"
2013
+ threshold of conformance level 3 (section 8). It is reported because
2014
+ an agent reading a validation report is exactly who needs to know
2015
+ that an id it can see needs a panel opened first.
2016
+
2017
+ **The `probe` option (2.7.0).** `probe: false` is the default and is
2018
+ the whole of what 2.5 did: compare the registered manifests against
2019
+ the ids present in the DOM, which is a comparison of two lists.
2020
+ `probe: true` also asks whether each declared element can be
2021
+ OPERATED, and that question is what the two new buckets answer:
2022
+ `ambiguous` -- the same id on more than one node, so `find()`
2023
+ resolves it by document order and re-ordering the markup changes
2024
+ what an agent does -- and `unreachable` -- mounted, but behind
2025
+ `aria-hidden="true"`, behind `inert`, or not displayed, which is
2026
+ exactly what `NAC.click()` refuses with `NacError('hidden')`.
2027
+ Probing reads the DOM and the computed style; it clicks nothing and
2028
+ mutates nothing. Through 2.6 the reference runtime declared this
2029
+ function with NO parameters and ignored `probe` entirely, so the
2030
+ level 3 check of section 8 was the level 2 check with a stricter
2031
+ threshold rather than the deeper inspection the sentence implies
2032
+ (audit N-35, closed in 2.7.0).
1232
2033
 
1233
2034
  **Versions before 2.5.0 attached no code to these buckets**, and
1234
2035
  this section described a flat array of findings that the reference
@@ -1282,6 +2083,35 @@ NAC3 standardises only step 2's input/output shape (the
1282
2083
  `NAC.describe()` snapshot + the action shape). Steps 1, 3, 4 are
1283
2084
  outside the spec; you compose what you like.
1284
2085
 
2086
+ ### 11.1 A screenless assistant routes through the intermediary (v2.7)
2087
+
2088
+ A caller with no screen -- a web IVR, an assistant embedded in a device,
2089
+ a voice runner with no page open -- uses the same four pieces. Exactly
2090
+ two things change, and neither is a new primitive:
2091
+
2092
+ 1. **Step 2's input is the MANIFEST.** There is no page to snapshot, so
2093
+ the capability snapshot is `NAC.describePlugin(slug)` plus the
2094
+ declared state read through `NAC.read` -- not `NAC.describe()`.
2095
+ The labels, hints, params and units of 15.11 are what make that
2096
+ snapshot speakable, which is why they exist.
2097
+ 2. **The dispatcher uses `NAC.call` / `read` / `subscribe`** where a
2098
+ page would have used `click` / `fill` / `tab`. The verb changes;
2099
+ the contract does not.
2100
+
2101
+ Step 2's OUTPUT is unchanged: the same structured intent shape. Steps 1
2102
+ and 4 -- the recogniser and the synthesiser -- stay outside this spec,
2103
+ and this section does not bring them in.
2104
+
2105
+ The application on the other side has to be in the headless profile
2106
+ (section 19) for the call to be auditable at all: with no document and
2107
+ no event sink there is nobody to receive the provenance row, and 19.4
2108
+ refuses rather than act unobserved.
2109
+
2110
+ Reference: `demos/v27-headless-voice/voice-broker.mjs`, whose header
2111
+ names which of the four pieces a deployment replaces and which it
2112
+ keeps. Owner decision D-26 (2026-11-25) wrote this door down; it
2113
+ existed before, undocumented.
2114
+
1285
2115
  ---
1286
2116
 
1287
2117
  ## 12. Stability guarantees
@@ -1334,7 +2164,7 @@ to make about `payload_schema`.
1334
2164
  | Should `data-nac-role="navigation"` ever resolve to a tab? | **DECIDED: no** | v2.5 | Decided in 2.2.0 and enforced since: a `tab.`-prefixed id with role `navigation` raises `tab_id_manifest_role_drift`, and with `STRICT_VALIDATION` (default `true` since 2.3.0) `NAC.register` throws. `tab_by_label` resolves tabs only from `m.tabs[]` and `elements[role=='tab']`. `navigation` is a landmark region, never a switchable panel. See sections 1 and 10. |
1335
2165
  | Should `NAC.click()` accept relative ids (e.g. `'./save'`)? | **OPEN, not implemented** | v2.5 | The resolver matches `data-nac-id` exactly and scopes by plugin -- the active one, or `opts.plugin`. That scoping already covers the case the question was asking for (`NAC.click('save', {plugin:'invoice'})`), so the pressure for a relative syntax is low and nothing is in progress. Deciding it would mean adding a path grammar to section 2, where ids are declared opaque to the runtime. |
1336
2166
  | Should manifests support inheritance / extension across plugins (one base manifest extended by a tenant)? | **OPEN, candidate for the next major** | v2.5 | Not implemented. **Not to be confused with section 15**, "plugin extension contract": that shipped in v2.5 and is a backend-routing mechanism (`registerPlugin` / `call` / `read` / `subscribe`), not manifest inheritance. The question here is about one manifest deriving from another, which touches the id-uniqueness rules of section 2 and is why it is held for a major. |
1337
- | Should `payload_schema` enforcement be formalised and turned on? | **OPEN, undated** | v2.5 | Moved here from section 5, which promised it for v2.4. It did not land in v2.4 and has not landed through v2.5; the reference runtime does not read the field. See section 5 for exactly what is and is not validated today. |
2167
+ | Should `payload_schema` enforcement be formalised and turned on? | **DECIDED: no -- it stays informational** | v2.7.0 | Decided in 2.7.0 (D-15), after three releases of being open and undated. Three reasons, in order of weight. (1) An agent cannot tell a host that validates from one that does not, so a schema that is enforced by SOME runtimes is worse than one enforced by none: the agent must validate before sending either way, which is what section 5 already tells it to do. (2) Turning enforcement on would make every manifest in the field a candidate for rejection on upgrade -- the field was accepted and never checked since 2.3, so nobody's schema has ever had to be right. (3) The grammar is a JSON-Schema-shaped subset precisely so a runtime need not ship a validator; formalising it walks that back. A host that wants payload validation does it in its `nac:action:requested` listener, where it also has the application context the schema does not. |
1338
2168
  | Should `validate_global()` findings carry a code from the published catalogue? | **DECIDED: yes, shipped in 2.5.0** | v2.5 | Every item of every bucket carries `code` + `severity`, so section 12 promise 4 now covers a real set instead of an empty one. The five codes are published under `global_buckets` in `api/latest/findings.json`, and the generator READS them off a fixture that provokes each bucket rather than writing them by hand -- the previous version wrote `code: null` for a bucket that had carried a code since 2.5.0 and published both claims in the same file. Building that fixture is also what found audit N-33: the validator could not see a manifest written in the canonical shape. See 10.1. |
1339
2169
 
1340
2170
  ---
@@ -1400,7 +2230,7 @@ code, is the authority.
1400
2230
 
1401
2231
  ---
1402
2232
 
1403
- ## 15. Plugin extension contract -- canvas + API surfaces (v2.5)
2233
+ ## 15. Plugin extension contract -- canvas + API surfaces (v2.5, extended in v2.6 and v2.7)
1404
2234
 
1405
2235
  Sections 1-14 assume the agent-relevant surface is **DOM**. Every
1406
2236
  addressable element has a `data-nac-id` attribute, every verb fires
@@ -1420,6 +2250,24 @@ its own routing contract to such surfaces. The runtime stays
1420
2250
  agnostic of any specific app -- it learns how to talk to one only
1421
2251
  by reading the plugin's manifest.
1422
2252
 
2253
+ v2.6 adds no new way to REACH an app: the backends of 15.4 already
2254
+ cover the ones that exist. What it adds is the half that was missing
2255
+ for a plugin to live in a repository of its own -- how an agent FINDS
2256
+ a plugin it did not register (15.10) and UNDERSTANDS what its verbs
2257
+ take (15.11), one real event source that is not postMessage
2258
+ (`emitter-listen`, 15.4), the two reaches `sdk-call` lacked (an API
2259
+ object outside `window`, and positional arguments), a fail-closed rule
2260
+ for an observer with nothing to observe, and a declared code space for
2261
+ a plugin's own errors (15.9). A manifest written against v2.5 needs no
2262
+ changes.
2263
+
2264
+ v2.7 adds no primitive either, and no manifest field. What it adds is
2265
+ 15.12: WHICH surface enters by which of the three doors, and why --
2266
+ so an adopter arriving with a virtualised grid, a map, a media player,
2267
+ an embedded PDF or a 3D scene finds their own case named instead of
2268
+ inferring it from silence. Nothing a v2.5 or v2.6 manifest does
2269
+ changes.
2270
+
1423
2271
  ### 15.1 Why a new primitive set
1424
2272
 
1425
2273
  DOM-only `NAC.click(id)` cannot:
@@ -1437,7 +2285,7 @@ heuristics. The fix is to add an explicit, agnostic verb that
1437
2285
  takes a plugin slug and a verb path, and lets the plugin's
1438
2286
  manifest declare how that verb is routed.
1439
2287
 
1440
- ### 15.2 The three primitives
2288
+ ### 15.2 The primitives
1441
2289
 
1442
2290
  ```ts
1443
2291
  NAC.registerPlugin(slug: string, manifest: PluginManifest): void
@@ -1446,6 +2294,21 @@ NAC.read(plugin: string, state_path: string): Promise<any>
1446
2294
  NAC.subscribe(plugin: string, event_path: string,
1447
2295
  cb: (data: any) => void): SubscriptionHandle
1448
2296
  NAC.unsubscribe(handle: SubscriptionHandle): void
2297
+
2298
+ /* v2.6 -- discovery (sec 15.10) */
2299
+ NAC.plugins(): PluginDescriptor[]
2300
+ NAC.describePlugin(slug: string): PluginDescriptor
2301
+
2302
+ /* v2.6 -- API handles for objects that never land on `window` (15.4) */
2303
+ NAC.registerApiHandle(name: string, obj: object): void
2304
+ NAC.unregisterApiHandle(name: string): boolean
2305
+ NAC.apiHandles(): string[]
2306
+
2307
+ /* v2.7 -- the headless profile (sec 19) */
2308
+ NAC.profile(slug: string): PluginProfile
2309
+ NAC.setEventSink(fn: ((row: ProvenanceRow) => void) | null): typeof fn
2310
+ NAC.eventSink(): ((row: ProvenanceRow) => void) | null
2311
+ NAC.provenanceStatus(): ProvenanceStatus
1449
2312
  ```
1450
2313
 
1451
2314
  - `registerPlugin(slug, manifest)` registers a v2.5 plugin. A given
@@ -1467,14 +2330,48 @@ NAC.unsubscribe(handle: SubscriptionHandle): void
1467
2330
  synthesised via polling / MutationObserver -- the manifest
1468
2331
  declares which.
1469
2332
 
1470
- All four functions are async (Promise-returning) except
1471
- `unsubscribe`, which is synchronous and idempotent.
2333
+ - `plugins()` returns a descriptor for every registered v2.5 plugin,
2334
+ ordered by slug; `describePlugin(slug)` returns one. Both are
2335
+ read-only: the descriptor is a COPY, so a caller cannot reach the
2336
+ live registry through it (sec 15.10).
2337
+ - `registerApiHandle(name, obj)` publishes an API object under a name
2338
+ a manifest can reference with `handle`. The object itself never
2339
+ enters the manifest -- manifests stay pure JSON.
2340
+
2341
+ - `profile(slug)` answers whether a registered plugin needs a document
2342
+ at all, MEASURED from its bindings and not from what it claimed
2343
+ (sec 19.1). `setEventSink(fn)` installs the one bus that is not the
2344
+ DOM, so the `nac:plugin:*` family survives where no document exists;
2345
+ `provenanceStatus()` reports which buses are live and counts every
2346
+ row that reached neither (sec 19.4). All four are SYNCHRONOUS: they
2347
+ read or write local state and reach no surface.
2348
+
2349
+ `call` and `read` reach a surface and are therefore async
2350
+ (Promise-returning). `subscribe` is **synchronous**: it validates the
2351
+ plugin, the event path and the backend, attaches the listener and
2352
+ returns the handle, all before returning -- so it signals failure by
2353
+ THROWING a `NacError`, not by rejecting. `unsubscribe`, `plugins`,
2354
+ `describePlugin` and the handle registry only touch local state and are
2355
+ synchronous too; `unsubscribe` is also idempotent.
2356
+
2357
+ That `subscribe` is synchronous is worth stating plainly, because this
2358
+ document said the opposite through v2.7 while the signature three
2359
+ paragraphs above declared the truth. A consumer that believed the prose
2360
+ would write `await NAC.subscribe(...)` -- which happens to work, since
2361
+ awaiting a non-Promise is free -- and then guard it with `.catch()`,
2362
+ which does not: the throw escapes uncaught and the page loses the very
2363
+ error this protocol named for it.
1472
2364
 
1473
2365
  ### 15.3 Plugin manifest shape
1474
2366
 
1475
2367
  ```ts
1476
2368
  interface PluginManifest {
1477
2369
  slug: string;
2370
+ label?: string; /* v2.6 -- human name of the surface */
2371
+ hint?: string; /* v2.6 -- one line on what it is for */
2372
+ headless?: boolean; /* v2.7 -- the profile of sec 19: every
2373
+ binding reaches its surface with no
2374
+ document. Absent means false. */
1478
2375
  verbs: { [verb_path: string]: VerbBinding };
1479
2376
  state: { [state_path: string]: StateBinding[] };
1480
2377
  events: { [event_path: string]: EventBinding };
@@ -1482,12 +2379,18 @@ interface PluginManifest {
1482
2379
 
1483
2380
  interface VerbBinding {
1484
2381
  backend: BackendKind;
2382
+ label?: string; /* v2.6 -- see 15.11 */
2383
+ hint?: string; /* v2.6 */
2384
+ params?: ParamDecl[]; /* v2.6 -- what the verb takes */
1485
2385
  /* backend-specific fields (see 15.4) */
1486
2386
  [k: string]: any;
1487
2387
  }
1488
2388
 
1489
2389
  interface StateBinding {
1490
2390
  backend: BackendKind;
2391
+ label?: string; /* v2.6 -- names the state PATH (see 15.11) */
2392
+ hint?: string; /* v2.6 */
2393
+ unit?: string; /* v2.6 -- 'degrees', 'seconds', 'page' */
1491
2394
  /* backend-specific fields (see 15.4) */
1492
2395
  extract?: string; /* extractor DSL string (see 15.5) */
1493
2396
  [k: string]: any;
@@ -1495,10 +2398,24 @@ interface StateBinding {
1495
2398
 
1496
2399
  interface EventBinding {
1497
2400
  backend: BackendKind;
2401
+ label?: string; /* v2.6 */
2402
+ hint?: string; /* v2.6 */
1498
2403
  /* backend-specific fields */
1499
2404
  [k: string]: any;
1500
2405
  }
1501
2406
 
2407
+ interface ParamDecl { /* v2.6 -- see 15.11 */
2408
+ name: string;
2409
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
2410
+ required?: boolean;
2411
+ unit?: string;
2412
+ min?: number;
2413
+ max?: number;
2414
+ enum?: any[];
2415
+ label?: string;
2416
+ hint?: string;
2417
+ }
2418
+
1502
2419
  type BackendKind =
1503
2420
  | 'postmessage'
1504
2421
  | 'postmessage-listen'
@@ -1507,7 +2424,8 @@ type BackendKind =
1507
2424
  | 'dom-mirror'
1508
2425
  | 'same-origin-window'
1509
2426
  | 'synthetic-mutation'
1510
- | 'synthetic-poll';
2427
+ | 'synthetic-poll'
2428
+ | 'emitter-listen'; /* v2.6 */
1511
2429
  ```
1512
2430
 
1513
2431
  Manifests are pure JSON (no JS callbacks). Forge, Sumi, and any
@@ -1518,24 +2436,62 @@ Verbs and events have **exactly one** binding. State has an
1518
2436
  **ordered array** of bindings: the runtime walks the chain in
1519
2437
  order, returning the first source that successfully resolved.
1520
2438
 
2439
+ `headless` (v2.7) is likewise optional, and declaring it is the ONLY
2440
+ way into the profile of section 19 -- it is never inferred. When it is
2441
+ declared, every binding is checked against the profile at register time
2442
+ (19.1); when it is absent the manifest behaves exactly as it did in
2443
+ 2.5 and 2.6.
2444
+
2445
+ Every field marked `v2.6` is OPTIONAL: a manifest written against
2446
+ v2.5 stays valid without changes. What is not optional is being
2447
+ well-formed WHEN declared -- a `label` that is not a string, or a
2448
+ `params` entry of a type outside the vocabulary above, is rejected at
2449
+ register time with `invalid` (sec 15.11).
2450
+
1521
2451
  ### 15.4 Backend vocabulary
1522
2452
 
1523
2453
  | Kind | Used for | Required fields |
1524
2454
  |------|----------|-----------------|
1525
2455
  | `postmessage` | Verb: post a message to an iframe via `postMessage`. | `target` (CSS selector of the iframe to send to), `message` (MessageId string), `values` (object literal interpolated with args), `values_from_args` (optional array of arg keys to forward verbatim) |
1526
2456
  | `postmessage-listen` | Event: listen for a specific incoming `MessageId` on `window.message`. | `source` (CSS selector of the iframe to filter origin by; if omitted, accept any source), `message` (MessageId to match), `extract` (extractor DSL into the message data) |
1527
- | `sdk-call` | Verb: call a globally-exposed JS function (e.g. Figma plugin, Excalidraw API). | `path` (dotted path into `window`, e.g. `figma.currentPage.selection`), `mode` (`assign` to set the path to the args value, `invoke` to call it as a function with the args object) |
2457
+ | `sdk-call` | Verb or state: call or read a JS function / property exposed on `window` or on a registered API handle (Figma plugin, Excalidraw API, a map instance). | `path` (dotted path, e.g. `figma.currentPage.selection`), `mode` (`assign` to set the path to the args value, `invoke` to call it as a function, `read` to return the value at the path), and from v2.6: `handle` (optional -- the name of an object registered with `NAC.registerApiHandle`; the `path` is walked against THAT object instead of the global one, which is how an API that never lands on `window` is reached), `args_order` (optional -- an array of arg names spelling out the POSITIONAL argument list, so `map.setView(center, zoom)` is expressible; without it the args object travels as a single argument, which is what every v2.5 manifest does) |
1528
2458
  | `script-bridge` | Verb or state: invoke an app's scripting bridge (Collabora's `CallPythonScript`, LibreOffice UNO bridge, Google Apps Script). | `bridge` (a backend-specific identifier like `collabora.python`), `script` (script identifier), `function` (function name to run), `args` (object literal interpolated with the call args), `response_match` (for state: the response MessageId to wait on), `timeout_ms` (optional, default 5000) |
1529
2459
  | `dom-mirror` | State: read from a DOM element whose attribute / class / text mirrors a canvas-internal state (e.g. a toolbar button highlighted when its formatting is active on the current selection). | `selector` (CSS selector to query), `extract` (extractor DSL, see 15.5) |
1530
2460
  | `same-origin-window` | State: read from `iframe.contentWindow.<path>` when the iframe is same-origin. The runtime detects cross-origin and falls through. | `target` (CSS selector of the iframe), `path` (dotted path into `contentWindow`) |
1531
- | `synthetic-mutation` | Event: synthesise an event by observing DOM mutations on one or more state sources and re-emitting when the observed value changes. | `observe` (array of state paths to watch; the runtime calls `read` on each and diffs across mutations), `throttle_ms` (optional, default 100) |
2461
+ | `synthetic-mutation` | Event: synthesise an event by observing DOM mutations on one or more state sources and re-emitting when the observed value changes. | `observe` (array of state paths to watch; the runtime calls `read` on each and diffs across mutations), `throttle_ms` (optional, default 100), `root` (optional, v2.6 -- a CSS selector for a container to observe instead of the mirror nodes themselves; see the fail-closed rule below) |
1532
2462
  | `synthetic-poll` | Event: synthesise an event by polling state sources. | `observe` (array of state paths), `interval_ms` (default 250) |
2463
+ | `emitter-listen` | Event (v2.6): listen to a REAL event source that is not postMessage -- a JS event emitter exposed by a library (`map.on('moveend')`, `video.addEventListener('timeupdate')`, pdf.js `pagechanging`, a recogniser's `onresult`). | `event` (required -- the library's event name), `handle` (optional -- a registered API handle to listen on), `path` (optional -- dotted path to the emitter; resolved against the handle when one is declared, against the global object otherwise; omitted means the handle itself is the emitter), `method` / `off_method` (optional -- the subscribe / unsubscribe method names; when omitted the runtime detects `on`/`off`, `addEventListener`/`removeEventListener` or `addListener`/`removeListener`, in that order), `extract` (optional extractor DSL over the payload the library hands the listener), `observe` (optional array of state paths: instead of the raw payload, the runtime re-reads those states at event time and the callback receives that snapshot -- the useful shape for a continuous surface, where the event says "it moved" and the state says where to) |
1533
2464
 
1534
2465
  Each backend MUST be implemented by the runtime as a self-contained
1535
2466
  dispatcher (`dispatch(binding, args, context) -> Promise<value>`).
1536
2467
  Adding a new backend type to the spec requires bumping the spec
1537
2468
  version; runtimes ignoring unknown backends MUST reject manifests
1538
- that declare them (no silent skip).
2469
+ that declare them (no silent skip). `emitter-listen` is the reason
2470
+ this document is 2.6 and not 2.5.3.
2471
+
2472
+ **Fail-closed rule for an observer with nothing to observe (v2.6).**
2473
+ `synthetic-mutation` resolves every observed state path to the DOM
2474
+ element its primary `dom-mirror` binding selects. When a selector
2475
+ matches no element, `subscribe` MUST refuse with
2476
+ `backend_target_missing` -- by throwing, since it is synchronous (15.2)
2477
+ -- naming the state paths and selectors that did not resolve. It MUST NOT return a handle: a subscription that
2478
+ observes nothing resolves successfully and then never fires, which is
2479
+ precisely the silent damage this protocol exists to remove -- and
2480
+ until 2.5.2 that is what the reference runtime did.
2481
+
2482
+ A manifest whose observed node legitimately comes and goes -- the row
2483
+ of a virtualised grid, which exists only while it is scrolled into
2484
+ view -- declares `root`: a container that OUTLIVES the node. The
2485
+ runtime then observes the container with `subtree: true` and
2486
+ re-resolves the selectors on every mutation, so a subscription taken
2487
+ while the node was absent fires when the node mounts. `root` itself
2488
+ must resolve, for the same reason. When a subscription starts with
2489
+ nothing readable and the observed state later becomes readable, that
2490
+ transition is itself an emit: the move from unknown to known is the
2491
+ change the caller is waiting for. While an observed state is
2492
+ unreadable no event is emitted, so a manifest for which ABSENCE is
2493
+ meaningful declares it as data -- a `present` extractor, or a
2494
+ fallback binding in the chain.
1539
2495
 
1540
2496
  ### 15.5 Extractor mini-DSL
1541
2497
 
@@ -1663,8 +2619,8 @@ never knows or cares which source answered.
1663
2619
 
1664
2620
  ### 15.9 Errors
1665
2621
 
1666
- `NAC.call` / `read` / `subscribe` reject with `NacError` whose `code`
1667
- is one of:
2622
+ `NAC.call` and `NAC.read` reject, and `subscribe` throws (15.2), with
2623
+ a `NacError` whose `code` is one of:
1668
2624
 
1669
2625
  - `plugin_not_registered` -- the slug has no v2.5 manifest.
1670
2626
  - `verb_not_declared` -- the verb path is not in the manifest.
@@ -1681,9 +2637,448 @@ is one of:
1681
2637
  - `state_unreadable` -- every binding in a state chain failed; see
1682
2638
  15.6.
1683
2639
  - `timeout` -- a backend did not respond within its declared
1684
- `timeout_ms` (default 5000 for verbs, 1000 for state reads).
2640
+ `timeout_ms`. The default is **5000 for verbs and 5000 for state
2641
+ reads**, and a binding sets its own with `timeout_ms`. Through 2.6
2642
+ this line published "1000 for state reads", which no release ever
2643
+ implemented: the one backend that can time out (`script-bridge`)
2644
+ reads `binding.timeout_ms || 5000` and never looks at who called it. The text is corrected
2645
+ rather than the code (D-16): cutting a read's default to 1000 would
2646
+ make a backend that answers in 1.4 s start timing out on upgrade,
2647
+ with nothing changed in the adopter's own code, and a read that
2648
+ fails slower than advertised costs latency where the other
2649
+ direction costs correctness.
1685
2650
  - `invalid` -- argument shape is wrong (bad slug, malformed
1686
2651
  manifest at register time, etc).
2652
+ - `no_document` (v2.7) -- a backend that reaches its surface THROUGH
2653
+ the document was dispatched where there is no document: no page, no
2654
+ iframe, no selector to resolve. Raised by the six DOM-requiring
2655
+ backends of 15.4, and -- outside this contract -- by the DOM
2656
+ primitives of sections 1 to 14, which until 2.6 let a raw
2657
+ `ReferenceError` through instead. See 19.3.
2658
+ - `provenance_unobservable` (v2.7) -- a plugin that declares
2659
+ `headless: true` was reached where its `nac:plugin:*` row can
2660
+ arrive nowhere: no document AND no event sink. Refused BEFORE the
2661
+ effect, because an action nobody can audit is the silent damage this
2662
+ protocol exists to remove. See 19.4.
2663
+
2664
+ **The plugin code space (v2.6).** The twelve codes above are the whole
2665
+ contract vocabulary, and they are deliberately about ROUTING: they say
2666
+ the protocol could not get there, never why the application said no. A
2667
+ plugin that needs a code of its own -- `row_not_materialized` as
2668
+ something distinguishable from "that row does not exist", a document
2669
+ that is locked, an export still rendering -- raises it under the
2670
+ reserved prefix `plugin.`:
2671
+
2672
+ ```js
2673
+ const e = new Error('row 42 is not materialised');
2674
+ e._code = 'plugin.row_not_materialized';
2675
+ throw e; /* inside the backend the manifest routes to */
2676
+ ```
2677
+
2678
+ `NAC.call` and `NAC.subscribe` surface such a code verbatim on
2679
+ `err.code`. A code that is NEITHER one of the twelve NOR under the
2680
+ `plugin.` prefix is refused as `invalid`, with the refused string
2681
+ preserved on `err.offending_code`: an undeclared code that travelled
2682
+ anyway is how a vocabulary stops being a vocabulary. The prefix is
2683
+ reserved -- the contract codes will never take it, so a plugin code can
2684
+ never collide with a future one.
2685
+
2686
+ ### 15.10 Discovery of the registry (v2.6)
2687
+
2688
+ Sections 15.2 to 15.9 all require the caller to already know the slug
2689
+ and the path. Until 2.5.2 that was the ONLY way in: the registry was
2690
+ readable by exactly three functions (`call`, `read`, `subscribe`), so
2691
+ an agent that did not register the plugin itself could not learn it
2692
+ exists. It read the DOM manifest (section 5), found the chrome, and
2693
+ the canvas surface was invisible. For a surface that declares no DOM
2694
+ at all -- a voice-only plugin -- there was nothing to find whatsoever.
2695
+
2696
+ ```ts
2697
+ NAC.plugins(): PluginDescriptor[] /* ordered by slug */
2698
+ NAC.describePlugin(slug: string): PluginDescriptor
2699
+
2700
+ interface PluginDescriptor {
2701
+ slug: string;
2702
+ label: string | null;
2703
+ hint: string | null;
2704
+ verbs: { verb_path: string; backend: string | null;
2705
+ label: string | null; hint: string | null;
2706
+ params: ParamDecl[] | null; handle?: string }[];
2707
+ state: { state_path: string; backends: (string | null)[];
2708
+ label: string | null; hint: string | null;
2709
+ unit: string | null }[];
2710
+ events: { event_path: string; backend: string | null;
2711
+ label: string | null; hint: string | null;
2712
+ observe: string[] | null; event?: string }[];
2713
+ }
2714
+ ```
2715
+
2716
+ Rules:
2717
+
2718
+ 1. Both are SYNCHRONOUS. They read a local object; nothing is
2719
+ dispatched to any surface, so there is no reason for an agent to
2720
+ await a round trip to find out what is there.
2721
+ 2. The descriptor is a **copy**. A caller MUST NOT be able to reach
2722
+ the live registry through it and rewrite another plugin's routing.
2723
+ 3. Verbs, state paths and events come back sorted by path, so two
2724
+ reads of the same registry are byte-comparable.
2725
+ 4. An undeclared `label` / `hint` / `params` reads as `null`, never as
2726
+ a missing key: a reader does not have to tell "absent" from
2727
+ "not declared".
2728
+ 5. `describePlugin` on an unregistered slug rejects with
2729
+ `plugin_not_registered` (sec 15.9).
2730
+
2731
+ Discovery is deliberately a read of what the manifest DECLARES, not a
2732
+ probe of the surface. It tells an agent what exists and how to name
2733
+ it; whether the surface answers today is what `call` and `read` are
2734
+ for.
2735
+
2736
+ ### 15.11 Self-description (v2.6)
2737
+
2738
+ The DOM half of this protocol has carried a human name and a typed
2739
+ field list since v1 (`data-nac-label`, `data-nac-hint`, `fields[]`
2740
+ with a type, section 6). The plugin half carried none: a manifest
2741
+ declared WHERE a verb routes and nothing about what it is called or
2742
+ what it takes. On a continuous surface the actionable thing IS the
2743
+ argument -- a coordinate and a zoom, an instant on a timeline, a page
2744
+ and a form field, a pose in three dimensions -- and nothing declared
2745
+ its shape, its unit or its range. A voice runner could not even name
2746
+ the verb out loud.
2747
+
2748
+ `label`, `hint`, `params` (verbs), `label` / `hint` / `unit` (state
2749
+ and events) close that. All optional; all read back through 15.10.
2750
+
2751
+ ```json
2752
+ {
2753
+ "slug": "acme.map",
2754
+ "label": "Acme map",
2755
+ "verbs": {
2756
+ "view.set": {
2757
+ "backend": "sdk-call",
2758
+ "handle": "acme.map",
2759
+ "path": "setView",
2760
+ "mode": "invoke",
2761
+ "args_order": ["center", "zoom"],
2762
+ "label": "Move the map",
2763
+ "hint": "Centres the map on a coordinate at a zoom level",
2764
+ "params": [
2765
+ { "name": "center", "type": "array", "required": true,
2766
+ "unit": "degrees", "label": "Centre", "hint": "[lat, lng]" },
2767
+ { "name": "zoom", "type": "number", "required": false,
2768
+ "unit": "zoom level", "min": 0, "max": 22 }
2769
+ ]
2770
+ }
2771
+ },
2772
+ "state": {
2773
+ "view.center": [
2774
+ { "backend": "sdk-call", "handle": "acme.map", "path": "getCenter",
2775
+ "mode": "invoke", "label": "Centre of the view", "unit": "degrees" }
2776
+ ]
2777
+ },
2778
+ "events": {
2779
+ "view.moved": {
2780
+ "backend": "emitter-listen", "handle": "acme.map",
2781
+ "event": "moveend", "observe": ["view.center"],
2782
+ "label": "The map stopped moving"
2783
+ }
2784
+ }
2785
+ }
2786
+ ```
2787
+
2788
+ Rules:
2789
+
2790
+ 1. A `label`, `hint` or `unit` that is declared MUST be a non-empty
2791
+ string; otherwise the manifest is rejected at register time with
2792
+ `invalid`.
2793
+ 2. `params` MUST be an array. Each entry MUST carry a `name` (unique
2794
+ within the verb) and a `type` from
2795
+ `string | number | boolean | object | array`. `required`, `unit`,
2796
+ `min`, `max`, `enum`, `label` and `hint` are optional, and are
2797
+ type-checked when present. Anything else is `invalid`.
2798
+ 3. The label of a state PATH is the first one its chain declares. A
2799
+ state path is one value with an ordered list of sources (sec 15.6),
2800
+ so it is named once, by whichever source names it.
2801
+ 4. `params` declares the shape of the `args` object `NAC.call`
2802
+ receives. The runtime does NOT validate args against it: the
2803
+ declaration exists so an agent can compose a call and a voice
2804
+ runner can speak it, and a surface that needs its arguments
2805
+ enforced enforces them where they land.
2806
+ 5. Nothing here is translated by the runtime. A label is authored in
2807
+ the language of the app; a host that speaks another one localises
2808
+ at its own layer (section 4.3).
2809
+
2810
+ ---
2811
+
2812
+ ### 15.12 Which surface enters by which door (v2.7)
2813
+
2814
+ Sections 15.1 to 15.11 say HOW a plugin reaches a surface. They never
2815
+ said WHICH surfaces an adopter is expected to bring, so an evaluator
2816
+ arriving with a virtualised grid, a map, a video player, an embedded
2817
+ PDF or a WebXR scene found their own case in neither list -- not in
2818
+ what the protocol covers, not in what it declares out of scope -- and
2819
+ had to guess. Guessing in favour of the protocol is the expensive
2820
+ direction: it is discovered after the migration, not before.
2821
+
2822
+ This section is the answer, surface by surface. It adds no primitive,
2823
+ no backend and no manifest field: a manifest written against v2.5 or
2824
+ v2.6 needs no changes. What it adds is a door for each surface, and
2825
+ the reason.
2826
+
2827
+ There are three doors and only three:
2828
+
2829
+ - **DOM** (sections 1-14). The actionable thing is a node; the name
2830
+ resolves by querying the document.
2831
+ - **This extension contract** (section 15). The actionable thing is
2832
+ not a node, or the action is not a click. A plugin declares the
2833
+ routing and the runtime stays agnostic of the app.
2834
+ - **Out of scope**, declared. The surface is named as a published
2835
+ limit and the protocol refuses instead of degrading. A declared
2836
+ limit is a feature of a protocol whose whole claim is that it does
2837
+ not damage silently.
2838
+
2839
+ | Surface | Door | Where |
2840
+ |---|---|---|
2841
+ | Virtualised collections (react-window, TanStack Virtual, ag-grid) | extension contract | 15.12.1 |
2842
+ | Map canvases (Leaflet, Mapbox GL, Google Maps) | extension contract | 15.12.3 |
2843
+ | Media players reachable by script (Video.js, Plyr, the YouTube iframe API, a bare `<video>` or `<audio>`) | extension contract | 15.12.4 |
2844
+ | The browser's own media control bar | out of scope | 15.12.4 |
2845
+ | Embedded PDF in a DOM-based viewer (pdf.js and relatives) | extension contract | 15.12.5 |
2846
+ | Embedded PDF in the browser's built-in viewer | out of scope | 15.12.5 |
2847
+ | XR and 3D scenes (WebXR, Three.js, Babylon, Unity WebGL) | out of scope | 15.12.6 |
2848
+ | Voice-only interfaces with no document (a web IVR, a screenless assistant, a voice device) | extension contract, in the headless profile of section 19 -- and the intermediary of 11.1 | 15.12.7 |
2849
+
2850
+ The last row is the one this table could not fill when it shipped, and
2851
+ the reason it took its own decision is in 15.12.7: it was never a
2852
+ routing question.
2853
+
2854
+ #### 15.12.1 Virtualised collections
2855
+
2856
+ The most common surface in business software, and the one where this
2857
+ protocol most resembles its own enemy: the first twenty rows answer,
2858
+ row 4000 does not, because the virtualiser never mounted it. A name
2859
+ that works until the user scrolls is exactly the silent damage NAC3
2860
+ exists to remove.
2861
+
2862
+ Routing is not the hard part -- a virtualiser has an API and
2863
+ `sdk-call` reaches it. The hard part is that in a virtualised
2864
+ collection IDENTITY OUTLIVES THE NODE, while section 7 resolves names
2865
+ by querying the document. The rules:
2866
+
2867
+ 1. A row's name is derived from its key in the DATA -- a primary key,
2868
+ a stable ordinal -- and never from its position on screen. A name
2869
+ that means "the third visible row" is not addressable: after a
2870
+ scroll it points at a different row.
2871
+ 2. The DOM primitives (section 5) keep their meaning exactly. With the
2872
+ row unmounted `NAC.find` resolves nothing and `NAC.click` fails
2873
+ closed. That is correct, and a runtime MUST NOT work around it by
2874
+ scrolling on its own: moving a user's viewport to satisfy a lookup
2875
+ is a side effect nobody asked for.
2876
+ 3. Reaching a row that the DATA has and the DOM does not is a plugin
2877
+ call, and the plugin MUST distinguish the two failures with two
2878
+ codes of its own (15.9):
2879
+ - `plugin.row_not_materialized` -- the row exists in the
2880
+ collection and is not mounted. Retryable after materialisation.
2881
+ - `plugin.row_not_found` -- there is no such row. Retrying will
2882
+ never work.
2883
+ One code for both is the defect this rule forbids: with a single
2884
+ code an agent cannot tell "scroll and try again" from "stop".
2885
+ 4. Materialisation is a DECLARED VERB of the plugin and the adopter
2886
+ owns it, because only the adopter knows which scroll container and
2887
+ which API bring a row in. The verb MUST be idempotent: asking for a
2888
+ row already on screen succeeds without moving anything.
2889
+ 5. A subscription scoped to a row that is not mounted is a declared
2890
+ choice and never an accident. Declared WITHOUT `root`, it MUST be
2891
+ refused with `backend_target_missing` (15.4): a handle that never
2892
+ fires is a silent failure wearing the shape of a success. Declared
2893
+ WITH `root` -- a container that outlives the row -- it is accepted
2894
+ and fires when the row mounts, and that is the form a virtualised
2895
+ collection should publish.
2896
+ 6. A name taken while the row was on screen and used after it was
2897
+ unmounted behaves as (2) and (3) say: the name stays valid, the
2898
+ node does not, and the answer says which of the two happened.
2899
+
2900
+ Reference plugin and receipt: `demos/v27-virtual-grid/`, 10,000 rows
2901
+ over a hand-written virtualiser, driven by
2902
+ `scripts/run-demo-v27-virtual-grid.mjs`.
2903
+
2904
+ #### 15.12.2 Positions, instants and areas are arguments, not names
2905
+
2906
+ Three surfaces in the table -- maps, media timelines and 3D scenes --
2907
+ share one problem that has nothing to do with how they are reached:
2908
+ what the user wants to act on is a POINT IN A CONTINUOUS SPACE.
2909
+ "Centre on Berlin." "Go to minute four." "Select everything within
2910
+ this radius." A name cannot say that, and there are infinitely many
2911
+ such points, so no registry of names can enumerate them.
2912
+
2913
+ NAC3 does NOT add a continuous addressing scheme. That is a decision,
2914
+ not an omission. The vocabulary is the one 15.11 already publishes:
2915
+
2916
+ - The ELEMENT is named: the map, the player, the scene. One id.
2917
+ - The POSITION is an ARGUMENT of a declared verb -- typed, with its
2918
+ unit and its range in `params` (15.11). `view.set` takes degrees;
2919
+ `media.seek` takes seconds; a radius takes metres.
2920
+ - An agent composes the call from that declaration and never has to
2921
+ guess the unit, which is the whole reason `unit` exists.
2922
+
2923
+ **Confirming an effect on a value that moves.** Sections 6 and 18
2924
+ confirm an action by observing a discrete change. A continuous value
2925
+ defeats that: by the time a read returns, the value has moved, so
2926
+ equality on a sampled value is not a confirmation -- it is a race the
2927
+ protocol would lose at sixty frames per second. The contract:
2928
+
2929
+ 1. If the surface emits its own settle event -- `moveend`, `seeked`,
2930
+ `ratechange` -- the plugin MUST declare it (`emitter-listen`,
2931
+ 15.4) and THAT event is the confirmation. This is the preferred
2932
+ form, because the surface itself says when it stopped moving.
2933
+ 2. If it emits none, the plugin's verb MUST NOT resolve on an equality
2934
+ test. It resolves once its backend observed the requested value
2935
+ within a TOLERANCE the plugin owns and declares in its own
2936
+ documentation -- a seek is confirmed within a frame, not to the
2937
+ microsecond. The tolerance belongs to the plugin, never to the
2938
+ runtime: the runtime cannot know what "close enough" means on a
2939
+ surface it knows nothing about.
2940
+ 3. An agent MUST NOT read a continuous state twice and infer an
2941
+ effect from the difference. Something else may have moved it: the
2942
+ user, an animation, the media clock.
2943
+
2944
+ #### 15.12.3 Map canvases
2945
+
2946
+ A real map is MIXED, and the published canvas limit reads as if it
2947
+ were not. The controls -- zoom buttons, layer switcher, search box --
2948
+ are ordinary DOM and are covered by sections 1-14. The tiles are
2949
+ always images. The markers are DOM in Leaflet and pixels in Mapbox GL
2950
+ or deck.gl. So "a map is canvas, therefore excluded" is wrong in both
2951
+ directions, and an adopter of Leaflet who read the limit and concluded
2952
+ their map was entirely covered also had the wrong answer.
2953
+
2954
+ The door: the controls by DOM, everything else by this contract. The
2955
+ view is set with a verb whose `params` declare degrees and a zoom
2956
+ level (15.11), read back through a state path, and confirmed with the
2957
+ library's own `moveend` (15.12.2 rule 1). Pixels are never read, and a
2958
+ marker painted into a canvas is reachable only if the library can name
2959
+ it in its own API -- which is the plugin's declaration to make, not a
2960
+ promise this protocol makes for it.
2961
+
2962
+ Reference plugin and receipt: `demos/v26-leaflet-plugin/` against
2963
+ Leaflet 1.9.4, driven by `scripts/run-demo-v26-leaflet-plugin.mjs` --
2964
+ a library this project does not control and cannot adjust if the
2965
+ contract does not fit.
2966
+
2967
+ #### 15.12.4 Media players
2968
+
2969
+ What is actionable in a player is half buttons and half an INSTANT.
2970
+ The buttons are DOM when the player draws its own; the instant is
2971
+ 15.12.2. Two cases, and the line between them is not where an adopter
2972
+ expects it:
2973
+
2974
+ - **A player reachable by script** -- Video.js, Plyr, the YouTube
2975
+ iframe API, or a bare `<video>` / `<audio>` element -- enters by
2976
+ this contract. A media element IS an API: `currentTime`,
2977
+ `playbackRate` and `textTracks` are scriptable, so even a player
2978
+ whose CONTROLS belong to the browser is drivable through its
2979
+ element.
2980
+ - **The browser's own control bar** -- what `<video controls>` paints
2981
+ -- is out of scope, for the same reason as a closed shadow root: it
2982
+ is rendered by the user agent, not by the document. It exposes no
2983
+ nodes, it cannot carry an attribute, and NAC3 does not read pixels.
2984
+ An agent that asks for the pause button of the native bar does not
2985
+ get it. It gets `media.pause` on the element, which is the same
2986
+ effect through a door that exists.
2987
+
2988
+ Verbs declare their units: a seek takes seconds, a rate takes a
2989
+ multiplier, a subtitle track takes a BCP 47 language tag.
2990
+ Confirmation uses the element's own events -- `seeked`, `ratechange`,
2991
+ `cuechange` -- per 15.12.2 rule 1; a player that emits none falls to
2992
+ rule 2.
2993
+
2994
+ Reference plugin and receipt: `demos/v27-media-player/`, driven by
2995
+ `scripts/run-demo-v27-media-player.mjs`.
2996
+
2997
+ #### 15.12.5 Embedded PDF
2998
+
2999
+ The only surface in the table whose honest answer depends on the
3000
+ VIEWER and not on the protocol, so it gets both halves of the answer
3001
+ instead of one verdict.
3002
+
3003
+ - **The browser's built-in viewer** -- what a bare `<embed>`, or an
3004
+ `<iframe>` pointed at a `.pdf`, gets you -- is OUT OF SCOPE. It is
3005
+ an internal user-agent surface: no nodes, no attributes, nothing a
3006
+ document can mark, and reading it would mean reading pixels. An
3007
+ agent that asks for "page 7" of that viewer gets a refusal, not a
3008
+ guess.
3009
+ - **A DOM-based viewer** -- pdf.js and its relatives -- enters by this
3010
+ contract. The page is an argument with a unit (`page`), not a name,
3011
+ per 15.12.2; the text layer is real DOM; the fields of an AcroForm
3012
+ live in the document and not in the page, so they are reachable
3013
+ only through the viewer's API and the plugin declares them one by
3014
+ one or not at all.
3015
+
3016
+ Neither half promises OCR, layout inference or pixel reading. A PDF
3017
+ that is a scan of paper carries no text to reach, and no door in this
3018
+ protocol changes that.
3019
+
3020
+ #### 15.12.6 XR and 3D scenes
3021
+
3022
+ Out of scope, by its own name, and NOT as a special case of canvas --
3023
+ the reason is different and an adopter deserves the real one. A WebXR
3024
+ scene is painted through WebGL, so the canvas limit happens to contain
3025
+ it, but pixels are not what makes it unreachable:
3026
+
3027
+ 1. The addressable unit is an entity with a pose and an orientation in
3028
+ three dimensions, occluded by other entities. A name does not
3029
+ locate it, and 15.12.2 declares that this protocol does not address
3030
+ a continuous space.
3031
+ 2. There is no click. Selection is gaze, grab or controller, and it
3032
+ has duration.
3033
+ 3. The scene renders at 72 to 90 frames per second with no discrete
3034
+ event saying an action happened, so section 18 effect detection has
3035
+ nothing to anchor to.
3036
+
3037
+ There is also no DOM-shaped standard to route to: Three.js, Babylon,
3038
+ A-Frame and Unity WebGL each expose a different scene tree, and none
3039
+ of them is the document.
3040
+
3041
+ If an adopter brings a real case, the door would be this contract
3042
+ against the scene tree of one engine -- A-Frame, whose entities are
3043
+ elements, is the realistic target -- and that is a future decision,
3044
+ not a promise made here. Spending the protocol's budget on the rarest
3045
+ surface before the most common one (15.12.1) would be the wrong order.
3046
+
3047
+ #### 15.12.7 Voice-only interfaces, with no document at all
3048
+
3049
+ A voice-only interface has nothing to mark: a web IVR, an assistant
3050
+ embedded in a device, a voice runner with no page open. Until 2.7 this
3051
+ protocol was spoken BY voice over a document -- the voice was the input
3052
+ channel and the page was still the surface.
3053
+
3054
+ This was the one row the 15.12 table could not fill when it shipped,
3055
+ and not because the routing was hard. It asks whether a MANIFEST alone
3056
+ is enough to operate an application, and the two possible answers are
3057
+ two different definitions of NAC3 that cannot both be true: a markup
3058
+ layer for documents, or a contract about capabilities whose most common
3059
+ incarnation is a document. Owner decision D-26 (2026-11-25) chose the
3060
+ second and asked for both doors to be built.
3061
+
3062
+ So this surface enters by two doors at once, which no other row of the
3063
+ table does:
3064
+
3065
+ - **The application side** enters by this extension contract, in the
3066
+ **headless profile** of section 19. The manifest is the surface;
3067
+ every binding reaches it without a document; and the provenance that
3068
+ used to vanish where no document existed now travels over a bus that
3069
+ is not the DOM.
3070
+ - **The agent side** enters by the **intermediary** of section 11.1.
3071
+ The capability snapshot is the manifest rather than a page, and the
3072
+ dispatcher calls `call` where a page would have called `click`.
3073
+
3074
+ What this does NOT bring in is speech. A recogniser and a synthesiser
3075
+ are outside this spec (section 11) and stay there: a protocol that
3076
+ promised to transcribe would be promising something it does not
3077
+ implement, and 15.12 exists to stop exactly that.
3078
+
3079
+ Reference plugin and receipt: `demos/v27-headless-voice/`, driven by
3080
+ `scripts/run-demo-v27-headless-voice.mjs` -- no browser, no network, no
3081
+ microphone, because the absence of a screen is the surface under test.
1687
3082
 
1688
3083
  ---
1689
3084
 
@@ -1786,7 +3181,177 @@ some specific value at some point".
1786
3181
 
1787
3182
  ---
1788
3183
 
3184
+ ## 19. Headless profile -- the manifest as the surface (v2.7)
3185
+
3186
+ Sections 1 to 14 address nodes. Section 15 addresses a surface a node
3187
+ cannot reach. Neither says what happens when there is no document AT
3188
+ ALL, and 15.12.7 sends that case here.
3189
+
3190
+ This section adds no primitive and no backend. What it says is that the
3191
+ extension contract ALREADY is a capability interface: a plugin whose
3192
+ every binding reaches its surface without a document is operable with
3193
+ no document, and `plugins()` + `describePlugin()` are the resolution
3194
+ surface, because they read the manifest and never the page. What was
3195
+ missing was not routing. It was the declaration, the refusals, and one
3196
+ thing that was genuinely absent -- a provenance bus that is not the DOM.
3197
+
3198
+ **What this decides about the protocol**, because the two statements
3199
+ cannot both be true: NAC3 is a contract about CAPABILITIES. The
3200
+ document is its most common incarnation, the one every section before
3201
+ 15 is written for, and the one an adopter should still reach for when a
3202
+ page exists -- but it is not the definition. A name resolves against
3203
+ whatever the contract says it resolves against: a node, where there is
3204
+ a document; a declared verb, state or event path, where there is not.
3205
+
3206
+ ### 19.1 The profile is declared, and the predicate is mechanical
3207
+
3208
+ A manifest enters the profile by declaring it:
3209
+
3210
+ ```json
3211
+ { "slug": "clinic", "headless": true, "verbs": { }, "state": { }, "events": { } }
3212
+ ```
3213
+
3214
+ Of the nine backends of 15.4, three reach their surface without a
3215
+ document and six do not. This is a property of what each one does, not
3216
+ a policy:
3217
+
3218
+ | Backend | In the profile? | Why |
3219
+ |---|---|---|
3220
+ | `sdk-call` | yes | walks a dotted path on a registered API handle, or on the global object |
3221
+ | `emitter-listen` | yes | subscribes to the library's own emitter |
3222
+ | `synthetic-poll` | inherits | re-reads the state paths it observes; DOM-free exactly when all of them are |
3223
+ | `postmessage` | no | posts to the `contentWindow` of an iframe a CSS selector matched |
3224
+ | `postmessage-listen` | no | filters `window.message` by that same iframe |
3225
+ | `script-bridge` | no | posts to the `contentWindow` of an iframe a CSS selector matched |
3226
+ | `dom-mirror` | no | reads a DOM element a CSS selector matched |
3227
+ | `same-origin-window` | no | reads into an iframe's `contentWindow` |
3228
+ | `synthetic-mutation` | no | observes DOM mutations with a `MutationObserver` |
3229
+
3230
+ The rules:
3231
+
3232
+ 1. **The profile is never inferred.** `headless` absent means outside
3233
+ it, which is every manifest written before 2.7. Declared, it MUST be
3234
+ a boolean: the string `"true"` is a typo that would silently leave
3235
+ the plugin outside the profile it meant to enter, so it is refused
3236
+ and not coerced.
3237
+ 2. **A declared manifest is CHECKED at register time.**
3238
+ `registerPlugin` MUST reject with `invalid` when any binding needs
3239
+ a document, naming the offending ones -- the reference runtime also
3240
+ hands back the whole list on `err.dom_required`. The adopter learns
3241
+ on the bench, not on a device with no screen.
3242
+ 3. **A state chain is checked WHOLE, not at its first link.** A chain
3243
+ whose fallback is a `dom-mirror` works in a browser and degrades to
3244
+ nothing without one. Outside the profile that is a legitimate
3245
+ fallback chain (15.6); inside it, it is a declaration error.
3246
+ 4. **`synthetic-poll` inherits the question** from every state path it
3247
+ observes, and an observed path the manifest does not declare is
3248
+ itself refused: a poll over an undeclared state resolves and then
3249
+ never fires, which is the failure shape 15.4 already refuses.
3250
+ 5. **`profile(slug)` answers for ANY registered plugin**, declared or
3251
+ not, and separates the two questions:
3252
+ `declared_headless` is what the manifest claimed; `headless` is
3253
+ what its bindings measure. They differ when a manifest would work
3254
+ with no page and never said so, which is a thing an agent can
3255
+ usefully discover.
3256
+ 6. **The descriptor carries it.** `plugins()` and `describePlugin()`
3257
+ expose `headless`, so an agent that discovered a plugin does not
3258
+ need a second call to learn whether it needs a page.
3259
+
3260
+ ### 19.2 Resolution without a document
3261
+
3262
+ The id space of this profile is the manifest's own paths -- verbs,
3263
+ state, events. There are no `data-nac-*` attributes, because there is
3264
+ nothing to put them on.
3265
+
3266
+ An agent therefore resolves in three steps, all of which already
3267
+ existed: `plugins()` to discover, `describePlugin(slug)` to read the
3268
+ shape (the labels, hints, params and units of 15.11 are what make it
3269
+ speakable), `call` / `read` / `subscribe` to act. There is no
3270
+ `describe()` snapshot, because there is nothing to snapshot: the
3271
+ manifest IS the snapshot, and unlike a page it does not change while
3272
+ the agent is reading it.
3273
+
3274
+ ### 19.3 The DOM primitives fail closed
3275
+
3276
+ With no document, the primitives of sections 1 to 14 MUST refuse with
3277
+ `no_document` -- `find`, `click`, `fill`, `describe`, `narrate`,
3278
+ `tree`, `context`, `validate_global` and anything else that resolves a
3279
+ name by querying the document. The refusal names the way in that does
3280
+ exist (`call` / `read` / `subscribe`).
3281
+
3282
+ Two notes, because the previous behaviour was worse than useless:
3283
+
3284
+ - Through 2.6 those primitives threw a raw
3285
+ `ReferenceError: document is not defined` from whichever line
3286
+ happened to touch it first. That is not a code a caller can branch
3287
+ on, and it reads like a bug in the runtime rather than a refusal.
3288
+ - `validate_global()` returned `{ok: true}` for a tree that does not
3289
+ exist. A false green is worse than a crash: a build step could
3290
+ report a conformant page where there was no page.
3291
+
3292
+ What this does NOT change: importing the runtime where no document
3293
+ exists -- Node, a worker, an SSR build -- is still supported and still
3294
+ silent, as it has been since 2.2.1. Only CALLING a DOM primitive
3295
+ refuses, and it refuses by name.
3296
+
3297
+ ### 19.4 Confirmation and provenance without DOM events
3298
+
3299
+ The `nac:plugin:*` family of 15.7 is dispatched on `document`. With no
3300
+ document, every release through 2.6 lost it: the dispatch sat inside a
3301
+ `try/catch`, the call reported success, and nothing anywhere said a row
3302
+ had been dropped. An unauditable action is the silent damage section 7
3303
+ exists to remove, and the runtime was committing it.
3304
+
3305
+ - **`setEventSink(fn)` installs a bus that is not the DOM.** The sink
3306
+ receives `{type, detail}` with the SAME type names and the SAME
3307
+ detail shapes as the DOM family: the bus changes, the contract does
3308
+ not. It is ADDITIVE -- where a document exists the events still reach
3309
+ it, so installing a sink to collect an audit log takes nothing away
3310
+ from an existing consumer.
3311
+ - **A sink MUST NOT throw.** The effect has already happened when the
3312
+ row is emitted, so a runtime MUST NOT undo it and MUST NOT retry.
3313
+ What it owes the caller is the count: a row lost to a throwing sink
3314
+ is reported in `provenanceStatus().sink_errors`.
3315
+ - **Inside the profile, no bus means no call.** When a plugin declares
3316
+ `headless: true` and there is neither a document nor a sink,
3317
+ `call` / `read` / `subscribe` MUST refuse with
3318
+ `provenance_unobservable` BEFORE dispatching. The refusal names
3319
+ `setEventSink` as the way out.
3320
+ - **Outside the profile, the loss is COUNTED.** A manifest that never
3321
+ declared the profile keeps the 2.6 behaviour exactly -- the call goes
3322
+ through and the row is dropped -- but the drop lands in
3323
+ `provenanceStatus().dropped`. Counting is the floor; refusing would
3324
+ turn an upgrade into a breaking change for every adopter who runs the
3325
+ runtime server-side today.
3326
+ - **Effect confirmation is the rule of 15.12.2 again.** The effect of
3327
+ an action is confirmed by the surface's own event, through
3328
+ `emitter-listen`, or by reading declared state with `expect` /
3329
+ `diff` (section 18). Never by a DOM event: there is none.
3330
+
3331
+ ### 19.5 What the profile does not promise
3332
+
3333
+ - **No speech.** Recognition and synthesis are outside this spec
3334
+ (section 11) and this profile does not bring them in.
3335
+ - **No transport.** A headless plugin is not automatically remote. How
3336
+ the agent and the application reach each other -- in process, over a
3337
+ socket, across a queue -- is the adopter's, exactly as it was for a
3338
+ page.
3339
+ - **It is not a permission system**, for the same reason the DOM
3340
+ profile is not: a declared verb is an intent-level signal and the
3341
+ server still authorises every call.
3342
+ - **It does not say a voice application SHOULD be headless.** A page
3343
+ that exists and is marked up is the common case and the cheaper one.
3344
+ This profile is for the case where there is no page at all.
3345
+
3346
+ Reference plugin and receipt: `demos/v27-headless-voice/`, driven by
3347
+ `scripts/run-demo-v27-headless-voice.mjs`. It books an appointment end
3348
+ to end in a process with no `document` and no `window`, loading the
3349
+ runtime from the published package entry; the evidence of a screenless
3350
+ run is a transcript and an audit trail, not a screenshot.
3351
+
3352
+ ---
3353
+
1789
3354
  *This document is the canonical NAC3 v2.5 specification.
1790
3355
  Sections 0-14 are unchanged from v2.4 stable. Sections 15-18 ship
1791
- in v2.5. Edits to this file constitute spec changes and require an
1792
- RFC; see `CONTRIBUTING.md`.*
3356
+ in v2.5; section 19 ships in v2.7. Edits to this file constitute spec
3357
+ changes and require an RFC; see `CONTRIBUTING.md`.*