@nac3/runtime 2.5.0-alpha.5 → 2.5.1

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/CHANGELOG.md CHANGED
@@ -1,887 +1,1051 @@
1
- # Changelog
2
-
3
- ## 2.5.0-alpha.5 -- 2026-05-25
4
-
5
- NAC3 v2.5.0-alpha.5 ships the remaining three assistive blocks of
6
- the v2.5 line: **Block B tree navigation**, **Block C asistive
7
- labels**, **Block D effect detection**. The full v2.5 surface is
8
- now GA: every SHIPPED RFC (V24-01/02/04/05 + V25-01/02/03/04) has
9
- runtime code + Layer 2 demo + Layer 3 Pilot LIVE evidence.
10
-
11
- ### Added
12
-
13
- - **`NAC.narrate(plugin, nac_id) -> string | null`** (RFC V25-03 /
14
- SPEC sec 17). Canonical human-readable label resolution. Priority:
15
- `aria-label > visible text > data-nac-label > nac_id`. Nested
16
- addressable children excluded from parent's visible-text. Whitespace
17
- values at any tier fall through.
18
- - **`NAC.context(plugin) -> { breadcrumb: [{nac_id, label}, ...] }`**
19
- (RFC V25-02 / SPEC sec 16). Walks up from `document.activeElement`
20
- through addressable ancestors. Labels via narrate.
21
- - **`NAC.tree(plugin, rootId?) -> [{nac_id, label, opens?, leaf?}, ...]`**
22
- (RFC V25-02). Enumerates IMMEDIATE addressable children of rootId
23
- (or the plugin root). Honours `data-nac-opens` and `data-nac-leaf`
24
- authoring attributes.
25
- - **`NAC.expect(plugin, statePath, value, opts?) -> Promise<value>`**
26
- (RFC V25-04 / SPEC sec 18). Polls `NAC.read()` until the comparator
27
- returns truthy or the deadline fires (default 5000ms timeout,
28
- 100ms poll). Rejects `NacError('timeout')` on deadline.
29
- - **`NAC.diff(plugin, statePath, actionFn) -> Promise<{before, after, changed}>`**
30
- (RFC V25-04). Snapshots state, awaits actionFn, snapshots again.
31
- JSON-stringify compare for the `changed` flag.
32
-
33
- ### Evidence (Layer 2 + Layer 3 LIVE)
34
-
35
- - V25-02 tree-nav: L2 18 PASS / L3 LIVE 4 PASS.
36
- - V25-03 narrate: L2 12 PASS / L3 LIVE 6 PASS.
37
- - V25-04 expect+diff: L2 17 PASS / L3 LIVE 7 PASS.
38
-
39
- Each demo + Pilot driver under `demos/` and `scripts/`, evidence in
40
- `evidence/v25-0{2,3,4}*/<date>/`. Total LIVE Claude cost: ~$0.04.
41
-
42
- ### Status of v2.5 line
43
-
44
- All 8 RFCs of the v2.5 line are now SHIPPED with full L2 + L3 LIVE
45
- evidence. Collabora pilot can now consume the full surface end-to-end.
46
-
47
- ---
48
-
49
- ## 2.5.0-alpha.4 -- 2026-05-25
50
-
51
- NAC3 v2.5.0-alpha.4 closes the V24-04 contract: every mutating
52
- verb now honours `expected_*` parameters, and `STRICT_VERSIONING`
53
- default flips from `false` to `true`. Adopters that do not opt in
54
- to OCC explicitly will get `version_required` and must either pass
55
- expected parameters or set `NAC.STRICT_VERSIONING = false` once
56
- at bootstrap.
57
-
58
- ### Added (V24-04 -- final dispatch hook)
59
-
60
- - **`tab(plugin, tab_key, opts?)`** -- third argument added. opts
61
- accepts `expected_plugin_version` / `expected_tree_version` /
62
- `expected_element_state_hash`. The single-arg ergonomic form
63
- (e.g., `tab('conduit.tab.feed__home')`) keeps working; when
64
- called as `tab(bareId, opts)` the runtime detects the object
65
- and re-binds. Both two-arg and single-arg paths run the OCC
66
- gate after element resolution + before the tab click.
67
- - **`tab_by_label(plugin, label, opts?)`** -- propagates opts
68
- through to `tab()`.
69
-
70
- ### Changed (V24-04 -- default flip)
71
-
72
- - **`NAC.STRICT_VERSIONING` defaults to `true`** in alpha.4.
73
- Rationale: every mutating verb (click / fill / select / invoke
74
- / tab / tab_by_label / click_by_verb via click) now honours the
75
- OCC gate, so the strict default is finally safe to flip.
76
- - Callers that do NOT pass `expected_*` parameters must set
77
- `NAC.STRICT_VERSIONING = false` at bootstrap if they want the
78
- pre-alpha.4 behaviour (silent dispatch ignoring OCC state).
79
- - Code reviewers should reject any new callsite that catches
80
- `version_required` without escalating to the user -- swallowing
81
- the error defeats the point of the contract.
82
-
83
- ### Breaking changes since alpha.3
84
-
85
- - ALL test files that exercised mutating verbs (`click`,
86
- `click_by_verb`, `fill`, `select`, `invoke`, `tab`,
87
- `tab_by_label`) without passing `expected_*` started failing
88
- on the STRICT default flip. Fix: opt out at the top of the test
89
- file with `NAC.STRICT_VERSIONING = false;` after the runtime
90
- loads. Applied across all internal tests as part of this
91
- commit; downstream adopters that have similar tests need the
92
- same one-line addition.
93
-
94
- ### Tests
95
-
96
- stage12-snapshot-versioning.mjs grows two assertions:
97
-
98
- - `tab() with stale expected_tree_version throws snapshot_stale`
99
- - `tab() under STRICT without expected_* throws version_required`
100
-
101
- Total suite: **384 PASS / 0 FAIL** across 14 stage suites.
102
-
103
- ### Pending for 2.5.0 stable promotion (alpha -> latest)
104
-
105
- Per `PROJECT.md` sec 3.1 (three-layer test bar, instituted
106
- 2026-05-25), `npm dist-tag add @nac3/runtime@2.5.0 latest`
107
- requires:
108
-
109
- - Layer 1 unit tests green (already 384/0). ✓
110
- - Layer 2 visual demos + Playwright + screenshots in
111
- `evidence/<feature>/<run-date>/` per RFC.
112
- - Layer 3 Pilot-driven high-complexity statements run against
113
- each demo, with reasoning trace + screenshots saved.
114
- - Pablo's explicit OK after reviewing Layer 2 + Layer 3
115
- evidence.
116
-
117
- Layer 2 + Layer 3 building scheduled next. V25-02 / V25-03 /
118
- V25-04 RFCs remain DRAFT; target subsequent 2.5.x patches.
119
-
120
- ---
121
-
122
- ## 2.5.0-alpha.3 -- 2026-05-23
123
-
124
- NAC3 v2.5.0-alpha.3 wires the V24-04 OCC dispatch hooks into the
125
- mutating verbs. The contract now has teeth: an agent that passes
126
- mismatched `expected_*` parameters gets `NacError('snapshot_stale',
127
- ...)` synchronously, BEFORE any side effect occurs. No partial
128
- mutations on stale state. No silent damage.
129
-
130
- ### Added (V24-04 -- dispatch enforcement)
131
-
132
- Every mutating verb that accepts `opts` now calls
133
- `_resolveVersionExpectations(opts, el)` after the element lookup +
134
- disabled / hidden / aria preflight checks, and BEFORE the side
135
- effect:
136
-
137
- - **`click(nac_id, opts?)`** -- after the v2.3 capability gate +
138
- v1.8 hidden gate + v1.9 aria preflight, before `el.click()`.
139
- - **`fill(nac_id, value, opts?)`** -- after the fillability preflight,
140
- before native-setter `el.value = ...`.
141
- - **`select(nac_id, option, opts?)`** -- after `_findElement`, before
142
- the select-option write.
143
- - **`invoke(action_id, payload, opts?)`** -- after `_findElement`,
144
- before the `nac:action:requested` dispatch.
145
-
146
- Verbs that inherit click/tab transitively are covered automatically:
147
-
148
- - **`click_by_verb(plugin, verb, opts?)`** -- resolves to a `nac_id`
149
- then dispatches `click(id, opts)`. The OCC gate runs inside the
150
- nested click. Caller passes `expected_*` in opts and they flow
151
- through.
152
- - **`tab_by_label(plugin, label, opts?)`** -- similarly delegates to
153
- `tab(...)`. But because `tab` itself does not yet accept `opts`
154
- (signature change pending alpha.4), `expected_*` passed to
155
- `tab_by_label` is currently dropped. This will close in alpha.4.
156
-
157
- ### Pending for 2.5.0-alpha.4
158
-
159
- - `tab(plugin, tab_key, opts?)` accepts opts + threads OCC gate.
160
- - `NAC.STRICT_VERSIONING` default flips from `false` to `true` once
161
- tab is covered (so all mutating verbs uniformly require
162
- `expected_*` under strict mode).
163
- - E2E demo `example-v25-snapshot-versioning.php` for the landing.
164
-
165
- ### Conditional-await pattern
166
-
167
- To avoid introducing a microtask boundary that would reorder
168
- side-effect-then-immediate-check call patterns (which several
169
- v23-editor tests rely on with synchronous `NAC.click_by_verb()`
170
- followed by an immediate DOM check), the OCC hook is conditional:
171
-
172
- - When opts has any `expected_*` key OR `NAC.STRICT_VERSIONING` is
173
- true: `await _resolveVersionExpectations(...)`. May throw
174
- `snapshot_stale` / `version_required` / `feature_not_supported`.
175
- - Otherwise: no await, no microtask. Existing behaviour preserved.
176
-
177
- This keeps backward compatibility intact for code that never opted
178
- into OCC, while making `expected_*`-aware callers see the contract.
179
-
180
- ### Tests
181
-
182
- stage12-snapshot-versioning.mjs gains 7 new assertions for the
183
- dispatch enforcement: stale plugin_version + stale tree_version
184
- both raise `snapshot_stale` with structured `reason` + `slug` +
185
- expected/current pairs; current plugin_version passes the gate and
186
- proceeds (then hits the timeout, NOT snapshot_stale); STRICT mode
187
- without expected_* throws `version_required`.
188
-
189
- Total suite: **384 PASS / 0 FAIL** across 14 stage suites.
190
-
191
- ---
192
-
193
- ## 2.5.0-alpha.2 -- 2026-05-23
194
-
195
- NAC3 v2.5.0-alpha.2 lands the V24-04 OCC foundation that was
196
- deferred from alpha.1. This is an additive release on top of
197
- alpha.1 -- everything that worked in alpha.1 still works.
198
-
199
- ### Added (V24-04 -- foundation SHIPPED)
200
-
201
- The snapshot versioning + optimistic concurrency framework from
202
- RFC V24-04 lands as a foundation layer:
203
-
204
- - `_tree_version` + `_plugin_versions` Map -- per-(slug, instance_id)
205
- monotonic version counters. Bumped on every structural mutation
206
- observed by the runtime MutationObserver + on every syncPlugin
207
- call.
208
- - `_resolvePluginScope(el)` walks ancestor [data-nac-plugin] roots
209
- with WeakMap caching to avoid O(depth) walks on every mutation.
210
- - `_bumpPluginVersion(slug, instance_id, trigger)` + `_bumpTreeVersion`
211
- atomic helpers: increment counter, push to `_version_history`
212
- (capped at 500), dispatch `nac:plugin:invalidated` +
213
- `nac:tree:invalidated` events.
214
- - Single document-rooted MutationObserver that filters mutations to
215
- data-nac-* attribute changes + addNodes/removeNodes that contain
216
- data-nac-* descendants. Pure value/text changes do NOT bump.
217
- - `element_state_hash` (128-bit SHA-256 truncated) over a canonical
218
- 5-key state (visible, disabled, value, text, custom). Sync impl
219
- + async crypto.subtle path when available. Byte-identical digests
220
- across paths.
221
- - `markHydrationComplete()` + 100ms fallback for SSR-then-hydrate
222
- scenarios. Tagged trigger='hydration_complete' on the resulting
223
- bump events.
224
- - `versionHistory(limit?)` devtools surface -- last N bumps, most
225
- recent first.
226
-
227
- ### Added (V24-04 -- describe() additions)
228
-
229
- - `describe()` output now carries `tree_version` at the root +
230
- `plugin_version` + `plugin_instance_id` per plugin entry +
231
- `element_state_hash` per element entry. All three are read-only
232
- observers; consuming them is opt-in.
233
-
234
- ### Added (V24-04 -- NAC.* surface)
235
-
236
- - `NAC.STRICT_VERSIONING` (default **false** in alpha.2; will flip to
237
- true in alpha.3 after one soak window). When true,
238
- every mutating API call without `expected_*` parameters throws
239
- `NacError('version_required', ...)`.
240
- - `NAC.eager_hashing` (default false) -- placeholder flag for future
241
- cache-the-hash-on-mutate optimization.
242
- - `NAC.conformance_tier` (default `'NAC-3-versioned'`). Runtimes that
243
- declare the legacy `'NAC-3'` tier explicitly reject `expected_*`
244
- parameters with `NacError('feature_not_supported', ...)`.
245
- - `NAC.markHydrationComplete()` -- explicit hydration ack.
246
- - `NAC.versionHistory(limit?)` -- devtools.
247
-
248
- ### V24-02 syncPlugin consolidation
249
-
250
- syncPlugin's version stamp now uses the V24-04 `_bumpPluginVersion`
251
- machinery instead of the alpha.1 per-call timestamp string. The
252
- return shape (`{replaced, slug, version}`) is unchanged, but the
253
- `version` value is now `v_<N>` instead of `v_<base36-ts>_<seq>`.
254
- Tests pass either format (just check the `v_` prefix and that
255
- versions differ across calls).
256
-
257
- ### Pending for 2.5.0-alpha.3
258
-
259
- - **Dispatch enforcement hooks.** `click` / `click_by_verb` / `tab` /
260
- `tab_by_label` / `fill` / `select` / `invoke` accept
261
- `expected_plugin_version` / `expected_tree_version` /
262
- `expected_element_state_hash` parameters and reject with
263
- `NacError('snapshot_stale', ...)` on mismatch via
264
- `_resolveVersionExpectations()` (the helper is already in this
265
- release; the hooks are not yet wired into the dispatch verbs).
266
- - **`STRICT_VERSIONING` default flip** from false to true. Gated on
267
- the dispatch hooks landing.
268
- - **V25-02/03/04 drafts** -- tree navigation, asistive labels,
269
- effect detection. Target subsequent 2.5.x patches.
270
-
271
- ### Tests
272
-
273
- `runtime/test/` adds stage12-snapshot-versioning.mjs (23 PASS):
274
- API surface, describe() additions, syncPlugin bump events, version
275
- history, markHydrationComplete idempotency, hydration trigger
276
- tagging.
277
-
278
- Suite total: **377 PASS / 0 FAIL** across 14 stage suites.
279
-
280
- ### Migration notes
281
-
282
- - Code consuming `describe()` output that did NOT expect
283
- `tree_version` / `plugin_version` / `element_state_hash` keys is
284
- unaffected: those keys are additive. Code that explicitly checked
285
- describe().plugins[i] for an enumerated key set might fail; the
286
- fix is to ignore unknown keys (forward-compatible default).
287
- - syncPlugin's `result.version` value format changed (see V24-02
288
- section above). Tests that asserted the exact alpha.1 format
289
- string would need to relax to a prefix-only check.
290
-
291
- ---
292
-
293
- ## 2.5.0-alpha.1 -- 2026-05-23
294
-
295
- NAC3 v2.5.0-alpha.1 is a **consolidation release**. Two parallel
296
- development lines that diverged during May 2026 are unified here.
297
- The yujinapp/nac-spec repository becomes the SOLE source of truth
298
- for NAC3 from this commit forward; the prior development copies
299
- under rpaforce-crm (`packages/nac/`, `yujin.app/nac-spec/`) are
300
- deleted in that monorepo's history.
301
-
302
- ### Lines unified
303
-
304
- - **Line A** (was on this repo, RFC track): V24-01 plugin slug
305
- uniqueness, V24-02 idempotent syncPlugin (was announced in
306
- 2.3.x changelog but never landed in code -- now implemented
307
- for the first time with full test coverage), V24-04 snapshot
308
- versioning + OCC (in flight, see "Pending" below), V24-05
309
- agent authority + sudo (was DRAFT, ships SHIPPED here).
310
- - **Line B** (was on rpaforce-crm, contract track): V25-01 plugin
311
- extension contract for canvas+API surfaces (Block A: 8 backends
312
- complete + tests).
313
-
314
- ### Added (V25-01 -- NEW)
315
-
316
- - `NAC.registerPlugin(slug, manifest)` declarative plugin
317
- registration for surfaces where verbs / state / events route
318
- through something other than direct DOM (postMessage to iframe,
319
- plugin SDK call, script bridge, DOM mirror, same-origin window,
320
- synthesised events).
321
- - `NAC.call(plugin, verb_path, args)` abstract verb dispatch.
322
- - `NAC.read(plugin, state_path)` abstract state read with declared
323
- fallback chain semantics.
324
- - `NAC.subscribe(plugin, event_path, cb) / unsubscribe(handle)`
325
- event subscription with backend routing.
326
- - 8 backend kinds in fixed vocabulary: `postmessage`,
327
- `postmessage-listen`, `sdk-call`, `script-bridge`, `dom-mirror`,
328
- `same-origin-window`, `synthetic-mutation`, `synthetic-poll`.
329
- - Declarative extractor mini-DSL (`text` / `value` / `present` /
330
- `attribute:NAME` / `classList.contains:CLASS` / dotted-path).
331
- - Provenance event family: `nac:plugin:invoked` / `:read` / `:event`
332
- with `{plugin, backend, request_id, source, trusted, duration_ms,
333
- ok, error}` payload.
334
-
335
- ### Added (V24-02 -- NEW IMPLEMENTATION)
336
-
337
- - `NAC.syncPlugin(manifest)` / `NAC.syncPlugin(slug, manifest)`
338
- -- idempotent registration. Replaces the manifest for a slug
339
- instead of appending; SPA hosts call this on remount without
340
- accumulating stale entries.
341
- - Returns `{ replaced: boolean, slug, version }`.
342
- - Emits `nac:plugin:invalidated` on REPLACE (not on first-add),
343
- detail `{plugin_slug, plugin_instance_id, from_version,
344
- to_version, trigger: 'syncPlugin'}`.
345
-
346
- ### Added (V24-05 -- NEW)
347
-
348
- - `NAC.set_confirm_handler(fn)` -- register async (req) => boolean.
349
- - `NAC.confirm_action(action_id, message, opts?)` -- Promise<boolean>.
350
- Sudo bypass: short-circuits true if elevation already granted
351
- for the requested scope (or higher).
352
- - `NAC.request_authority(scope, ttl_ms, opts?)` -- sudo-style
353
- time-bounded elevation. Scope rank: high > medium > low.
354
- - `NAC.has_authority(scope) -> bool`.
355
- - `NAC.revoke_authority(scope) -> void` (idempotent).
356
- - Provenance event family:
357
- `nac:authority:requested / :granted / :denied / :revoked / :expired`,
358
- `nac:action:confirmed / :rejected`.
359
- - SUPERSEDES the v1.9 confirm_action mechanism (removed: it was
360
- unused + had a strictly narrower contract).
361
-
362
- ### Added (V24-01 -- CONSOLIDATED + ENFORCED)
363
-
364
- - `NAC.HARD_DEDUP` flag (default true). Gates the synchronous
365
- throw in `NAC.register` + the boot-time pass.
366
- - `NAC.register` throws `NacError('duplicate_plugin_no_instance_id',
367
- ...)` synchronously when the DOM already contains multiple roots
368
- for the registered slug and any of them omits / duplicates
369
- `data-nac-plugin-id`.
370
- - Boot-time pass on `DOMContentLoaded` runs the same check across
371
- every `[data-nac-plugin]` root. On first violation: dispatches
372
- `nac:fatal` event + paints a fixed-position red banner
373
- (`#__nac_fatal_banner__`) + re-throws asynchronously so test
374
- harnesses + browsers catch it.
375
- - `validate_global()` extended with `plugin_instance_violations`
376
- array -- structured findings for CI gates.
377
- - Migration: `NAC.HARD_DEDUP = false` BEFORE any `register()`
378
- call opts out for one release window. Flag removed in v2.6.
379
-
380
- ### New: PROJECT.md at repo root
381
-
382
- PROJECT.md documents the post-migration topology, the RFC process
383
- states (Proposed / In implementation / Implemented / Alpha /
384
- Production), the doc-update invariant (every RFC transition
385
- touches SPEC + CHANGELOG + USER_MANUAL + TECHNICAL_DESIGN + demos
386
- list + benchmark numbers + Sumi KB), and the programming +
387
- architecture norms. Read it FIRST before any contribution.
388
-
389
- ### Tests
390
-
391
- `runtime/test/` suite now has 13 stages:
392
-
393
- smoke + v22 + v23-{invoke,shadow,capabilities,editor,interop}
394
- + stage2-disambiguation + stage7-strict-resolution + stage8-plugin-extension
395
- + stage9-sync-plugin + stage10-authority-sudo + stage11-plugin-id-dedup
396
-
397
- `npm test` exit code 0, 349 PASS / 0 FAIL.
398
-
399
- ### Pending for 2.5.0-alpha.2
400
-
401
- - V24-04 snapshot versioning + OCC -- in implementation, code in
402
- flight. Targets `NAC.STRICT_VERSIONING=true` by default, with
403
- `expected_plugin_version` / `expected_tree_version` enforcement
404
- on every mutating API. The `plugin_version` + `element_state_hash`
405
- fields will appear in `describe()` output.
406
- - V25-02 tree navigation (`context`, `tree`, `data-nac-opens`)
407
- -- DRAFT, target 2.5.x.
408
- - V25-03 asistive labels (`narrate`) -- DRAFT, target 2.5.x.
409
- - V25-04 effect detection (`expect`, `diff`) -- DRAFT, target 2.5.x.
410
-
411
- ### Migration notes
412
-
413
- - Code that ran fine under 2.4.0 (strict resolution + disambiguation)
414
- continues to work unchanged in 2.5; that contract is stable.
415
- - Code that called the pre-existing v1.9 `confirm_action` must
416
- migrate to V24-05 (`confirm_action` + `set_confirm_handler` +
417
- `request_authority`). The argument shape changed
418
- (`(action_id, opts)` -> `(action_id, message, opts)`). Audit
419
- callers; no automatic migration tool.
420
- - Code that registered the same plugin slug on multiple DOM roots
421
- WITHOUT `data-nac-plugin-id` now throws at register time. Either
422
- add the attribute, OR set `NAC.HARD_DEDUP=false` before
423
- registering for a one-release migration window.
424
-
425
- ---
426
-
427
- ## 2.4.0 -- 2026-05-21
428
-
429
- NAC3 v2.4.0 is a **behavior-of-contract change**: id / verb / qualifier
430
- resolution becomes strict. Backwards-compatible with code paths that
431
- already supplied unambiguous arguments, **NOT** backwards-compatible
432
- with code paths that depended on the previous lenient (`indexOf`)
433
- fallback to resolve to the first near-match.
434
-
435
- ### Why this changed (the principle, not a feature)
436
-
437
- The lenient resolution in 2.3.x violated the spec's 0-silent-damage
438
- invariant. Specifically, `click_by_verb(plugin, verb, { qualifier })`
439
- would, on a no-exact-suffix match, fall through to an `indexOf(qualifier)`
440
- substring search and resolve silently to whatever element happened to
441
- contain the qualifier string anywhere in its id. The H4 benchmark on the
442
- Conduit case study (2026-05-21) showed that **12 of 18 "model failures"
443
- on the canonical flows were actually silent runtime damage** — the
444
- agent emitted an invalid qualifier, the runtime sent it to the wrong
445
- element, the agent looped against the wrong page state. Strict
446
- resolution rescues those 12 (see `nac-spec/conduit/H4_STRICT_NAC_REPORT.md`).
447
-
448
- For an assistive-software use case (the principal driver of this
449
- project), a silent dispatch to the wrong element with no recovery path
450
- is a safety blocker. Strict resolution closes that gap.
451
-
452
- ### New error model — disambiguation contract
453
-
454
- When `click_by_verb` / `tab` / `tab_by_label` cannot resolve a request
455
- unambiguously, the runtime now:
456
-
457
- 1. Emits `nac:disambiguation_requested` on `document` with a
458
- structured detail payload (see below).
459
- 2. Throws `NacError` with `err.code` ∈ `{no_matching_instance,
460
- ambiguous_qualifier, ambiguous_tab, ambiguous_label}` AND
461
- `err.candidates: [{nac_id, label}, ...]` pre-validated against the
462
- live DOM.
463
-
464
- Detail / candidates payload:
465
- ```js
466
- {
467
- method: 'click_by_verb' | 'tab' | 'tab_by_label',
468
- plugin: string | null,
469
- query: { verb?, qualifier?, label?, id? },
470
- reason: 'no_matching_instance' | 'ambiguous_qualifier' | 'ambiguous_tab' |
471
- 'ambiguous_label' | 'ambiguous_label_exact' | 'ambiguous_label_fuzzy' |
472
- 'no_matching_label',
473
- candidates: [{ nac_id: string, label: string }, ...]
474
- }
475
- ```
476
-
477
- A reactive host (chat UI / voice agent / screen-reader) can listen
478
- on the event and present the options to the user as *"did you
479
- mean A or B?"*. A synchronous catcher can read `err.candidates`
480
- directly. An autonomous agent (Pilot, etc.) can inject the candidates
481
- into the next turn's prompt so the LLM picks from a DOM-validated
482
- list instead of re-guessing a qualifier.
483
-
484
- ### What changed in the resolvers
485
-
486
- - **`click_by_verb` with qualifier:** only exact-equality or anchored
487
- suffix (`id === qualifier || id.endsWith('__' + qualifier)`)
488
- resolves. Multiple matches → `ambiguous_qualifier`. Zero matches →
489
- `no_matching_instance`. **The `indexOf` substring fallback is
490
- removed.**
491
- - **`tab` single-arg form:** bare id resolves to exact match in DOM. If
492
- no exact, exactly one anchored-prefix instance
493
- (`id.startsWith(bare + '__')`) resolves; multiple → `ambiguous_tab`;
494
- zero → `no_matching_instance`.
495
- - **`tab_by_label`:** two-tier strict — exact label match first
496
- (errors if multiple), then substring match (errors if multiple).
497
- Fuzzy match preserved for voice/assistive use case; ambiguity
498
- caught.
499
-
500
- ### Verification
501
-
502
- - `packages/nac/test/stage2-disambiguation.mjs` — pre-existing
503
- tab_by_label cases still PASS (B1–B4).
504
- - `packages/nac/test/stage7-strict-resolution.mjs` (new) — 9/9
505
- invariants pass under JSDOM shim.
506
- - `nac3-bench/bench/scripts/stage7_strict_nac.mjs` (new) — 9/9
507
- invariants pass under Playwright against a live page.
508
- - `nac3-bench/bench/h4_results/h4_2026-05-21T19-01-19-040Z.json` —
509
- cheap-model benchmark with strict NAC: 48/54 = 89% (vs 36/54 = 67%
510
- under lenient).
511
-
512
- ### Migration guide
513
-
514
- If your code was passing fuzzy qualifiers and depending on the runtime
515
- to pick "something close", the upgrade requires you to:
516
- - Either supply the full `nac_id` directly (always unambiguous), OR
517
- - Pass the exact `__suffix` of the instance you want, OR
518
- - Listen for `nac:disambiguation_requested` / catch `NacError` with
519
- `err.candidates` and pick from the returned list.
520
-
521
- Most users won't be affected — the only callers that broke during the
522
- internal regression were the ones that were already broken silently in
523
- 2.3.x but happened to land on the wrong-but-related element instead of
524
- failing.
525
-
526
- ---
527
-
528
- ## 2.3.1 -- 2026-05-13 (stable, blank republish)
529
-
530
- Identical source to 2.3.0. The 2.3.0 tag had already been published to
531
- npm as a preview; 2.3.1 is the first installable stable version. No
532
- behavioural changes.
533
-
534
- ---
535
-
536
- ## 2.3.0 -- 2026-05-13 (stable)
537
-
538
- NAC3 v2.3.0 is the first stable release of the payload-bearing
539
- contract. Everything in 2.3.0-alpha.1 and 2.3.0-alpha.2 is rolled
540
- in; the alpha tags are deprecated. New in stable (beyond the alpha
541
- preview):
542
-
543
- ### New primitives
544
-
545
- - **`NAC.invoke(action_id, payload, opts?)`** -- payload-bearing
546
- action. Dispatches `nac:action:requested`, awaits the host's
547
- `nac:action:succeeded` / `:failed` with the same `request_id`.
548
- Default timeout 30 s. (Promoted from 2.3.0-alpha.1.)
549
- - **`NAC.utter(action_id, {text, lang?, voice?})`** -- ergonomic
550
- shortcut for `verb='utter'`. (Promoted from 2.3.0-alpha.1.)
551
- - **`NAC.bindTab(el, handler, ctx, opts?)`** -- tab companion to
552
- `bindAction`. Emits `nac:tab:activated` / `:activation_failed`
553
- for you. Sister of v2.2's `bindAction`.
554
- - **`NAC.edit_field(nac_id)`** -- field editor primitive promoted
555
- from preview to GA. Selection, replace, AI syntax correction,
556
- save/cancel verbs. Modal mounts the `nac_editor` plugin
557
- idempotently with all 10 locales.
558
-
559
- ### Shadow DOM resolution (F1 + F6)
560
-
561
- - **Open shadow DOM**: the runtime walks `el.shadowRoot`
562
- recursively up to depth 10. Any element with `data-nac-id`
563
- inside an open shadow root is now resolvable by `NAC.click`,
564
- `NAC.fill`, `NAC.invoke`, etc. with no glue code.
565
- - **Closed shadow DOM**: voluntary exposure contract. A
566
- component MAY expose a `nac3` getter on the host element
567
- implementing `query(selector)` (mandatory),
568
- `queryAll(selector)` (recommended), and `describe()` (optional).
569
- The runtime delegates to those methods.
570
- - **Error events** for closed shadow:
571
- - `nac:shadow_blocked` -- emitted once per host with
572
- `detail.reason` in `'exposure_threw'`, `'not_exposed'`.
573
- - `nac:shadow_protocol_violation` -- emitted when an exposed
574
- method returns a non-Element value.
575
- - All events use `composed: true` so they correctly cross shadow
576
- boundaries to document-level listeners.
577
-
578
- ### Auth-aware capabilities (F7)
579
-
580
- - Manifest entries MAY declare `requires_capability: 'verb_slug'`
581
- at the element level or per `action.verb`. Array values use
582
- OR semantics ("at least one cap matches passes").
583
- - `NAC.setCapabilities([...])`, `NAC.grantCapability(cap)`,
584
- `NAC.revokeCapability(cap)`, `NAC.userCapabilities()` manage
585
- the user's capability set.
586
- - `NAC.click` and `NAC.invoke` gate against the set before
587
- dispatch. Missing cap -> reject with `code='capability_required'`
588
- + emit `nac:command:rejected`.
589
-
590
- ### Strict validation default (F3)
591
-
592
- - `NAC.STRICT_VALIDATION` default flipped from `false` to **`true`**
593
- in v2.3 stable, per the v2.2 migration promise.
594
- `NAC.register` now throws `code='strict_validation'` on
595
- `manifest_role_unknown` / `tab_id_manifest_role_drift` /
596
- `manifest_dom_role_mismatch` findings.
597
- - Opt-out: set `NAC.STRICT_VALIDATION = false` BEFORE any
598
- `register()` call in your bootstrap. See
599
- `guides/MIGRATION_v2.2_to_v2.3.md` for the playbook.
600
-
601
- ### Hotfix carryover from alpha.2
602
-
603
- - `NAC.invoke` does NOT reject with `code='disabled'` on elements
604
- with `disabled` or `aria-disabled='true'`. `invoke` is a logical
605
- payload-bearing request, not a synthetic click. `NAC.click` still
606
- rejects on disabled (click semantics preserved). Pinned down by
607
- test v23-invoke.mjs T7/T8/T9 so the relaxation cannot silently
608
- regress.
609
-
610
- ### Test surface
611
-
612
- `npm test` now chains 7 suites (75+ assertions):
613
- smoke, v22, v23-invoke, v23-shadow, v23-capabilities, v23-editor,
614
- v23-interop. Plus 5 stage suites + live Playwright E2E
615
- (`atlas-pro-v23-utter-e2e.mjs` 16/16 GREEN against the deployed
616
- demo).
617
-
618
- ### Spec text
619
-
620
- SPEC.md updated:
621
- - Section 5.1.4 -- `NAC.invoke` + `NAC.utter` final wording.
622
- - Section 5.1.5 -- Shadow DOM resolution (open, cap 10).
623
- - Section 5.1.6 -- Closed shadow DOM exposure API (voluntary).
624
- - Section 5.1.7 -- Auth-aware capabilities.
625
- - Section 13 -- `edit_field` promoted from preview to GA.
626
-
627
- ### Reference adopters
628
-
629
- - Atlas Pro voice ad (`ads-demo/atlas-pro/`) -- production live,
630
- uses `NAC.utter` + payload schema.
631
- - React demo (`packages/nac-react-demo/`) -- adopts payload-bearing
632
- pattern for the chat-to-todos flow.
633
- - Angular demo (`packages/nac-angular-demo/`) -- mirror of React.
634
- - Web Component demos: `example-v23-shadow-open.html` and
635
- `example-v23-shadow-closed.html`.
636
-
637
- ## 2.3.0-alpha.2 -- 2026-05-13 (superseded by 2.3.0)
638
-
639
- Hotfix on top of 2.3.0-alpha.1:
640
-
641
- - `NAC.invoke` no longer rejects with `code='disabled'` when the
642
- target element has `disabled` or `aria-disabled='true'` set. The
643
- `disabled` HTML attribute is a click-event UX guard; `invoke` is
644
- a logical payload-bearing request, not a synthetic click. Hosts
645
- that need to refuse an invoke based on UI state should do it in
646
- their `nac:action:requested` listener and emit
647
- `nac:action:failed` with a meaningful code. This was hitting the
648
- Atlas Pro mic which gets `disabled = true` during /parse +
649
- /tts processing, blocking subsequent NAC.utter calls from
650
- external agents mid-conversation. Reproduced in the video-gen
651
- pipeline (every turn after the demo's first state-transition).
652
- - Bumped CLI version + smoke test assertions to match.
653
-
654
- ## 2.3.0-alpha.1 -- 2026-05-12
655
-
656
- ### New: payload-bearing actions via `NAC.invoke` + `NAC.utter`
657
-
658
- The NAC v2.2 contract was click-and-go: an agent triggers
659
- `NAC.click(id)` or `NAC.click_by_verb(plugin, verb)` and the host
660
- does whatever it does. That works for verb-and-state actions
661
- (`save`, `cancel`, `submit`, `delete`) but breaks down when the
662
- action needs **data** from the agent: `utter(text)`,
663
- `search(query)`, `send_message(body)`, `upload(file)`,
664
- `schedule(date)`. Hosts had no way to receive an agent's payload
665
- via a synthetic click.
666
-
667
- v2.3 adds the missing primitive:
668
-
669
- ```ts
670
- NAC.invoke(action_id, payload, opts?): Promise<{ok, request_id, ack}>
671
- NAC.utter(action_id, {text, lang?, voice?}): Promise<...>
672
- ```
673
-
674
- `NAC.invoke` dispatches a `nac:action:requested` CustomEvent on
675
- the host element (bubbles) with the agent's `payload` + a
676
- runtime-issued `request_id`. The host listens, processes, emits
677
- `nac:action:succeeded` (or `:failed`) echoing the same
678
- `request_id`. The runtime correlates and resolves the Promise.
679
-
680
- Default timeout 30 s (vs 5 s for click). On timeout the Promise
681
- rejects with `code='timeout'`.
682
-
683
- `NAC.utter(id, opts)` is the ergonomic shortcut for `verb='utter'`
684
- -- equivalent to `NAC.invoke(id, {verb:'utter', text, lang, voice})`.
685
-
686
- Manifest entries for payload-bearing actions can declare an
687
- informational `payload_schema`:
688
-
689
- ```js
690
- { id: 'atlas_pro_ad.mic', role: 'action',
691
- actions: [
692
- { verb: 'listen' },
693
- { verb: 'utter',
694
- payload_schema: {
695
- text: { type: 'string', required: true, max: 4000 },
696
- lang: { type: 'string', enum: ['en','es','pt','fr','it','de','ja','zh','hi','ar'] }
697
- }
698
- }
699
- ]
700
- }
701
- ```
702
-
703
- Click-style verbs (`NAC.click`, `NAC.click_by_verb`) continue to
704
- work unchanged. The new contract is purely additive; no demo
705
- behaviour regresses.
706
-
707
- #### First adopter
708
-
709
- Atlas Pro (`https://yujin.app/nac-spec/ads-demo/atlas-pro/`)
710
- declares both `listen` (click-only, existing) and `utter`
711
- (payload-bearing) on its `atlas_pro_ad.mic` action. The same
712
- `/ad-orchestrator/parse` + `/ad-orchestrator/tts` loop drives
713
- either path -- agents with their own STT call `listen`, agents
714
- with their own LM call `utter` with the recognised text.
715
-
716
- #### Test coverage
717
-
718
- - `test/v23-invoke.mjs` (new) -- 22 assertions covering happy
719
- path, ack echo, host-failed path, invalid args, not-found,
720
- custom timeout. PASS.
721
- - `test/v22.mjs` -- amended to accept v2.3.x in addition to
722
- v2.2.x. PASS.
723
- - `test/smoke.mjs` -- updated version assertions. PASS.
724
-
725
- #### Files touched
726
-
727
- - `yujin.app/nac-spec/js/nac.js` -- `invoke()` + `utter()` (~150
728
- LOC additive). Public API surface +2 functions. NAC.version
729
- bumped to '2.3.0-alpha.1', spec_version to '2.3'.
730
- - `yujin.app/nac-spec/SPEC.md` -- new section 5.1.4 + header
731
- version line.
732
- - `yujin.app/nac-spec/ads-demo/atlas-pro/index.html` -- manifest
733
- declares the `utter` verb + DOM listener routes into the demo's
734
- existing `handleUtterance(text)`.
735
- - `packages/nac/package.json`, `build.mjs`, `test/smoke.mjs` --
736
- version bumps + new test in `npm test`.
737
-
738
- #### Not yet wired
739
-
740
- - `STRICT_VALIDATION` enforcement of `payload_schema` (alpha:
741
- schema is informational).
742
- - A `NAC.search` / `NAC.upload` / `NAC.send_message` ergonomic
743
- shortcut sibling to `NAC.utter`. The generic `NAC.invoke` works
744
- today; concrete shortcuts can be added without re-spec.
745
-
746
- ## 2.2.1 -- 2026-05-12
747
-
748
- ### Bug fix: importable in Node / SSR / test contexts
749
-
750
- Pre-launch smoke test caught that `import '@nac3/runtime'` and
751
- `import '@nac3/runtime/chat-client'` crashed in Node.js with
752
- `ReferenceError: document is not defined`. The bundles had
753
- top-level `document.dispatchEvent` and `document.addEventListener`
754
- calls firing at module-evaluation time.
755
-
756
- Fix: wrap browser-only init in `typeof document !== 'undefined'`
757
- guards. In the browser the behaviour is unchanged (the events
758
- still fire on install + the confirm listener still attaches). In
759
- Node / SSR / Vitest / Jest the bundles now import as no-ops
760
- instead of crashing.
761
-
762
- Files patched (no API change):
763
- - `dist/nac.{mjs,cjs,browser.js}` -- guarded `nac:installed`
764
- dispatch + `_installA11yHintBridge()` call.
765
- - `dist/nac-chat-client.{mjs,cjs,browser.js}` -- guarded
766
- `nac:confirm:requested` listener attach.
767
- - `dist/nac-v2-extensions.*` -- unchanged (it already early-bails
768
- when the main runtime is not present).
769
-
770
- Verified: all three entry points (`@nac3/runtime`,
771
- `@nac3/runtime/extensions`, `@nac3/runtime/chat-client`) now
772
- import cleanly under Node 22 ESM + CommonJS `require`.
773
-
774
- ## 2.2.0 -- 2026-05-10
775
-
776
- Same-day v2.2 ships the constructor-strict validator + action-ack
777
- helper. Both items moved from the v2.2 roadmap into the runtime
778
- with no breaking changes (warning-only mode by default).
779
-
780
- ### V22-01 -- `NAC.register` strict validator
781
-
782
- `NAC.register(manifest)` now checks each manifest entry against
783
- three rules and emits `console.error` for findings:
784
-
785
- - `manifest_role_unknown` -- the entry's `role` is outside the
786
- canonical set (the 18 roles in SPEC sec 1).
787
- - `tab_id_manifest_role_drift` -- the entry's id matches `^tab\.`
788
- but its role is not `'tab'`. NAC.tab() and NAC.tab_by_label()
789
- query the canonical role only; a drift here makes the tab
790
- invisible to those resolvers (the bug class that broke
791
- example-v21-data-table.php on 2026-05-09).
792
- - `manifest_dom_role_mismatch` -- the corresponding DOM element
793
- is mounted, and its `data-nac-role` differs from the manifest's
794
- `role` value. Catches the case where an HTML author and a JS
795
- author drift apart on what role to use.
796
-
797
- A new flag `NAC.STRICT_VALIDATION` toggles findings between
798
- warning-only (default; ships in 2.2) and throwing (will be the
799
- v2.3 default; opt-in in 2.2 for adopters who want to gate CI).
800
-
801
- Migration window: v2.2 = console.error only, v2.3 = throw
802
- default, v3.0 = remove the flag.
803
-
804
- ### V22-02 -- `NAC.bindAction` helper
805
-
806
- New helper:
807
-
808
- ```js
809
- NAC.bindAction(buttonEl, function (ev) { /* side effect */ }, {
810
- plugin: 'invoice', action_id: 'invoice.save'
811
- });
812
- ```
813
-
814
- Bakes the `nac:action:succeeded` / `:failed` contract into the
815
- runtime so brownfield panels cannot forget to emit the ack event.
816
- Handles sync handlers + Promise-returning handlers; emits failure
817
- on throw + preserves normal error semantics; returns an unbinder
818
- function.
819
-
820
- Removes the foot-gun that produced the v20-panel timeout reports
821
- on 2026-05-09 (every voice command on example-v20-full.php
822
- replied "No pude ejecutar X: timeout" because the panel handlers
823
- did the work synchronously but never emitted the ack).
824
-
825
- ### Tests
826
-
827
- - `test/smoke.mjs` -- 36/36 PASS (artefact integrity + d.ts
828
- surface + CLI version + CLI lint over demos + package.json
829
- consistency, version asserts now check 2.2.0).
830
- - `test/v22.mjs` -- new. 14/14 PASS. 5 strict-validator cases
831
- (clean, unknown-role, tab-drift, DOM mismatch, strict-throws)
832
- + 5 bindAction cases (sync ack, throw -> failed event, Promise
833
- ack, unbinder, ctx validation) + NAC sanity checks.
834
-
835
- Run via: `npm test` (chains both suites).
836
-
837
- ### Known to-dos
838
-
839
- - Per-action signing (v3.0 candidate).
840
- - v2.3 will flip `STRICT_VALIDATION` default to true.
841
- - v2.3 will ship `NAC.bindTab(el, handler, ctx)` companion for
842
- tab-role widgets.
843
-
844
- ## 2.1.0 -- 2026-05-10
845
-
846
- First public release. Wraps the reference runtime that has been
847
- running in production at yujin.app since 2026-04 as the npm package
848
- `@nac3/runtime`.
849
-
850
- ### Spec
851
-
852
- - v2.1 with data-table primitive (collection / matrix /
853
- matrix-singletree subkinds; `dt_add_row` / `dt_edit_cell` /
854
- aggregates / transactional commit).
855
- - Brownfield migration story shipped (v2.0 extensions: scope tree,
856
- ephemeral capture, autoRegister, HMAC, isTrusted).
857
- - 18 canonical roles, 11 success-event families.
858
- - 10-locale i18n contract.
859
-
860
- ### Package
861
-
862
- - ESM + CJS + browser builds.
863
- - TypeScript declarations (permissive surface; v2.2 ships
864
- hand-authored full types).
865
- - CLI: `npx nac validate <dir>` does static lint of HTML/PHP.
866
- - Single source of truth: package built from
867
- `yujin.app/nac-spec/js/*.js`, no maintenance duplication.
868
-
869
- ### Demos
870
-
871
- - `example.php` -- v1.9 reference, 27 widgets.
872
- - `example-v20-full.php` -- brownfield migration of v1.9 to v2.0.
873
- - `example-v20-primitives-showcase.php` -- didactic showcase of
874
- the 8 v2.0 primitives.
875
- - `example-v21-data-table.php` -- live data-table demo wired to
876
- the Yujin chat backend.
877
-
878
- All demos hosted at yujin.app/nac-spec/.
879
-
880
- ### Known limitations
881
-
882
- - No per-action signing yet (only manifests). v3.0 candidate.
883
- - Constructor (`NAC.register`) is permissive on unknown roles; the
884
- v2.2 strict-validator landing fixes this.
885
- - CLI URL mode (`nac validate https://...`) requires Playwright;
886
- the package does not pull Playwright as a hard dep. Static-lint
887
- mode works without it.
1
+ # Changelog
2
+
3
+ ## 2.5.1 -- 2026-10-26
4
+
5
+ A patch release with no runtime behaviour change. It exists because two
6
+ PUBLISHED surfaces contradicted themselves, and neither could be fixed
7
+ without a version: the contract API publishes `spec_sha384`, the hash of
8
+ SPEC.md's bytes, so editing that document moves the contract of a version
9
+ already in the chain.
10
+
11
+ ### Fixed
12
+
13
+ - **The `**Status:**` line of SPEC.md stopped restating the version**
14
+ (audit N-45, second half). The published 2.5.0 declared its version
15
+ twice in its first four lines and the two disagreed: line 3 said
16
+ `2.5.0 (stable)` and line 4 said `v2.5.0-alpha.5 ... Promoted to npm
17
+ dist-tag latest`. Line 4 was TRUE until 18:40 on 2026-10-26 -- the act of
18
+ promoting `latest` to the stable release is what falsified it, in both
19
+ halves. It now points at section 9.1 and names no version, and the
20
+ version coherence gate has a slot that refuses a Status line naming one,
21
+ with the line the 2.5.0 shipped with as its first red case.
22
+
23
+ ### Changed
24
+
25
+ - **Section 4.3 says what the ten-locale requirement is a requirement ON,
26
+ and section 4.3.2 declares the normative language** (decision D-03,
27
+ option C). The ten locales are a requirement on the adopter manifest's
28
+ `label_i18n`, not on the language of this document. The English text is
29
+ normative; the nine published translations are non-normative, each
30
+ partial and frozen at the revision its own banner declares; where they
31
+ disagree the English text governs, and a conformance claim is a claim
32
+ against the English text. Measured rather than estimated: all nine
33
+ carry the same 34 of the 83 sections SPEC.md has today -- they translate
34
+ the May document in full and the English text has grown 49 sections
35
+ since. No runtime surface changes.
36
+
37
+ ## 2.5.0 -- 2026-10-26
38
+
39
+ Stabilises the 2.5 line. First stable release of the 2.5 series: `latest`
40
+ points here, and the stability guarantees of SPEC section 10 and the
41
+ finding-code guarantees of section 12 begin at this version.
42
+
43
+ ### Fixed
44
+
45
+ - **`fill()` no longer throws on a host with a partial DOM, and the
46
+ fallback it always had is finally reachable** (audit N-44). `fill()`
47
+ writes an input value through the native property setter on
48
+ `HTMLInputElement.prototype` rather than with `el.value = v`, because
49
+ React tracks the original setter and a plain assignment is silently
50
+ reverted on the next render -- a controlled input never sees the
51
+ value. A fallback existed for a host without those constructors, and
52
+ it could never run: the guard tested the property DESCRIPTOR while
53
+ the expression producing it reached through
54
+ `window.HTMLInputElement.prototype`. On a partial DOM -- a test shim,
55
+ an SSR or headless context -- `fill()` threw
56
+ `TypeError: Cannot read properties of undefined (reading 'prototype')`
57
+ before any fallback could run, and that TypeError carries no `code`,
58
+ so a caller branching on the error contract got nothing usable.
59
+ The three call sites (`checked`, `SELECT.value`,
60
+ `INPUT`/`TEXTAREA.value`) now share one helper that checks the
61
+ constructor before the descriptor.
62
+ **No change in a browser:** the constructors always exist there, the
63
+ native setter is used exactly as before, and a Chromium lock
64
+ (`npm run test:fill-setter`) now proves it by spying on the
65
+ instance property the native setter bypasses.
66
+
67
+ - **The copy-paste install snippet on the project landing page
68
+ published an `integrity` hash that matched no released file** (audit
69
+ N-40). It carried the hash computed over CRLF bytes from a Windows
70
+ working tree; the fix that moved every real `<script>` tag onto the
71
+ LF hash never reached the snippet, because the snippet is
72
+ HTML-escaped and so was not a script tag. Anyone who copied it got a
73
+ browser that refused to execute the runtime, reported only as a
74
+ console line. Does not affect `npm install`; it affected the
75
+ documented CDN path. The snippet hash now has a single producer and
76
+ the gate refuses any `sha384` on the page that is not a published
77
+ hash.
78
+
79
+ - **`validate_global()` can see a manifest written the documented way**
80
+ (audit N-33). The id collector behind it read only the legacy manifest
81
+ groups (`actions`, `fields`, `tabs`, `kpis`, `charts`, keyed by
82
+ `nac_id`) and never the canonical `elements: [{ id }]` shape of SPEC
83
+ section 4 -- the shape every demo ships and the rest of the runtime
84
+ reads. Against a canonical manifest it reported `total_ids: 0`, listed
85
+ every declared element as an orphan, could not report a duplicate, an
86
+ unmounted id or a convention violation at all, and still answered
87
+ `ok: true`. Measured on this project's own landing page: 2 plugins,
88
+ 64 declared elements, `total_ids: 0`, 128 orphans. After the fix:
89
+ `total_ids: 64`, 64 orphans -- and those 64 are exactly the undeclared
90
+ ids a separate audit had counted by hand.
91
+ **Upgrade note:** a host that gates CI on `has_errors` may see its
92
+ first failure after upgrading. That is a true positive that was always
93
+ there, not a new rule. Both manifest shapes are read from now on.
94
+
95
+ ### Added
96
+
97
+ - **`nac validate <url>` loads the page and REPORTS A CONFORMANCE
98
+ LEVEL** (audit N-18, second half). Until now URL mode aborted with
99
+ exit 2 and a message about Playwright, and no mode of the CLI ever
100
+ printed a level -- while SPEC section 8 said, in those words, that
101
+ this command "reports the highest level a page reaches".
102
+
103
+ The validator loads the page in a real browser, waits for the manifest
104
+ registry to stop moving rather than for a fixed sleep, and reports
105
+ against the identifiers published in `levels.json`. It follows the
106
+ published rule: a level is asserted only when every machine-checkable
107
+ requirement of that level and of every lower level passes, and
108
+ anything no tool can decide is reported `unverified` -- never assumed.
109
+ Three verdicts, and the difference between the last two is the point:
110
+ `pass` measured and it holds, `fail` measured and it does not,
111
+ `unverified` **not measured**.
112
+
113
+ Every level it reports carries its coverage -- "asserted on N of M
114
+ requirements" -- and the words *this is a measurement, not a
115
+ certification*. Directory mode now says out loud that it cannot decide
116
+ a level, instead of printing a finding count a reader could mistake
117
+ for one.
118
+
119
+ - `--drive` clicks the advertised controls, which is what decides the
120
+ two behavioural requirements of level 1. Off by default: clicking
121
+ every control on somebody's production page is not a read-only
122
+ operation.
123
+ - `--json` emits the whole report. `--timeout`, `--drive-roles`,
124
+ `--drive-limit` for the rest.
125
+ - **Playwright is optional and is NOT a dependency of this package.**
126
+ It is resolved at call time; when it is missing the CLI exits 3 and
127
+ prints the two commands that install it. A runtime that pulled a
128
+ browser into every adopter's `node_modules` to offer a tool most of
129
+ them never run would be charging everyone for nobody.
130
+
131
+ The level definitions are NOT in the CLI. They are generated from
132
+ SPEC section 8 through the same module that produces
133
+ `api/v/<version>/levels.json`, and each requirement publishes the name
134
+ of the `decider` that judges it. The build refuses to emit a CLI whose
135
+ decider table disagrees with the contract in either direction.
136
+
137
+ - **The contract publishes the `conformance_tier` vocabulary**
138
+ (audit N-29). `contract.json` used to publish the field as
139
+ `type: "string"` and not its values, so a machine could see the field
140
+ and had no way to learn that `NAC-3-versioned` is not a level name.
141
+ It now publishes the three values with what each one requires, which
142
+ one this runtime declares, where they are defined, and the sentence
143
+ that separates the two taxonomies: a **tier** describes what the
144
+ runtime implements (RFC V24-04 section 6); a **level** describes what
145
+ the page declares and does (SPEC section 8). The values are extracted
146
+ from the RFC, never typed, and the build refuses any disagreement
147
+ between the RFC, the sidecar and the value the runtime declares.
148
+
149
+ - **Every `validate_global()` bucket carries `code` + `severity`**
150
+ (audit N-14, SPEC sec 10.1 + 12 promise 4). New codes:
151
+ `nac_id_duplicate_across_plugins` (error),
152
+ `nac_id_orphan_in_dom` (warn),
153
+ `nac_id_declared_not_mounted` (warn),
154
+ `nac_id_missing_plugin_prefix` (warn).
155
+ `plugin_instance_violations` already carried
156
+ `duplicate_plugin_no_instance_id`. Promise 4 of section 12 named this
157
+ validator while every bucket was uncoded, so it covered an empty set;
158
+ it covers a real one now. The codes are published with their severity
159
+ and a fix under `global_buckets` in `api/latest/findings.json`.
160
+
161
+ ### Changed
162
+
163
+ - **SPEC section 10.1 describes the shape the runtime actually returns**
164
+ (audit N-34): an object of named buckets, not the flat array of
165
+ findings the section had documented since before 1.0.
166
+
167
+ ## 2.5.0-alpha.5 -- 2026-05-25
168
+
169
+ NAC3 v2.5.0-alpha.5 ships the remaining three assistive blocks of
170
+ the v2.5 line: **Block B tree navigation**, **Block C assistive
171
+ labels**, **Block D effect detection**. The full v2.5 surface is
172
+ now GA: every SHIPPED RFC (V24-01/02/04/05 + V25-01/02/03/04) has
173
+ runtime code + Layer 2 demo + Layer 3 Pilot LIVE evidence.
174
+
175
+ ### Added
176
+
177
+ - **`NAC.narrate(plugin, nac_id) -> string | null`** (RFC V25-03 /
178
+ SPEC sec 17). Canonical human-readable label resolution. Priority:
179
+ `aria-label > visible text > data-nac-label > nac_id`. Nested
180
+ addressable children excluded from parent's visible-text. Whitespace
181
+ values at any tier fall through.
182
+ - **`NAC.context(plugin) -> { breadcrumb: [{nac_id, label}, ...] }`**
183
+ (RFC V25-02 / SPEC sec 16). Walks up from `document.activeElement`
184
+ through addressable ancestors. Labels via narrate.
185
+ - **`NAC.tree(plugin, rootId?) -> [{nac_id, label, opens?, leaf?}, ...]`**
186
+ (RFC V25-02). Enumerates IMMEDIATE addressable children of rootId
187
+ (or the plugin root). Honours `data-nac-opens` and `data-nac-leaf`
188
+ authoring attributes.
189
+ - **`NAC.expect(plugin, statePath, value, opts?) -> Promise<value>`**
190
+ (RFC V25-04 / SPEC sec 18). Polls `NAC.read()` until the comparator
191
+ returns truthy or the deadline fires (default 5000ms timeout,
192
+ 100ms poll). Rejects `NacError('timeout')` on deadline.
193
+ - **`NAC.diff(plugin, statePath, actionFn) -> Promise<{before, after, changed}>`**
194
+ (RFC V25-04). Snapshots state, awaits actionFn, snapshots again.
195
+ JSON-stringify compare for the `changed` flag.
196
+
197
+ ### Evidence (Layer 2 + Layer 3 LIVE)
198
+
199
+ - V25-02 tree-nav: L2 18 PASS / L3 LIVE 4 PASS.
200
+ - V25-03 narrate: L2 12 PASS / L3 LIVE 6 PASS.
201
+ - V25-04 expect+diff: L2 17 PASS / L3 LIVE 7 PASS.
202
+
203
+ Each demo + Pilot driver under `demos/` and `scripts/`, evidence in
204
+ `evidence/v25-0{2,3,4}*/<date>/`. Total LIVE Claude cost: ~$0.04.
205
+
206
+ ### Status of v2.5 line
207
+
208
+ All 8 RFCs of the v2.5 line are now SHIPPED with full L2 + L3 LIVE
209
+ evidence. Collabora pilot can now consume the full surface end-to-end.
210
+
211
+ ---
212
+
213
+ ## 2.5.0-alpha.4 -- 2026-05-25
214
+
215
+ NAC3 v2.5.0-alpha.4 closes the V24-04 contract: every mutating
216
+ verb now honours `expected_*` parameters, and `STRICT_VERSIONING`
217
+ default flips from `false` to `true`. Adopters that do not opt in
218
+ to OCC explicitly will get `version_required` and must either pass
219
+ expected parameters or set `NAC.STRICT_VERSIONING = false` once
220
+ at bootstrap.
221
+
222
+ ### Added (V24-04 -- final dispatch hook)
223
+
224
+ - **`tab(plugin, tab_key, opts?)`** -- third argument added. opts
225
+ accepts `expected_plugin_version` / `expected_tree_version` /
226
+ `expected_element_state_hash`. The single-arg ergonomic form
227
+ (e.g., `tab('conduit.tab.feed__home')`) keeps working; when
228
+ called as `tab(bareId, opts)` the runtime detects the object
229
+ and re-binds. Both two-arg and single-arg paths run the OCC
230
+ gate after element resolution + before the tab click.
231
+ - **`tab_by_label(plugin, label, opts?)`** -- propagates opts
232
+ through to `tab()`.
233
+
234
+ ### Changed (V24-04 -- default flip)
235
+
236
+ - **`NAC.STRICT_VERSIONING` defaults to `true`** in alpha.4.
237
+ Rationale: every mutating verb (click / fill / select / invoke
238
+ / tab / tab_by_label / click_by_verb via click) now honours the
239
+ OCC gate, so the strict default is finally safe to flip.
240
+ - Callers that do NOT pass `expected_*` parameters must set
241
+ `NAC.STRICT_VERSIONING = false` at bootstrap if they want the
242
+ pre-alpha.4 behaviour (silent dispatch ignoring OCC state).
243
+ - Code reviewers should reject any new callsite that catches
244
+ `version_required` without escalating to the user -- swallowing
245
+ the error defeats the point of the contract.
246
+
247
+ ### Breaking changes since alpha.3
248
+
249
+ - ALL test files that exercised mutating verbs (`click`,
250
+ `click_by_verb`, `fill`, `select`, `invoke`, `tab`,
251
+ `tab_by_label`) without passing `expected_*` started failing
252
+ on the STRICT default flip. Fix: opt out at the top of the test
253
+ file with `NAC.STRICT_VERSIONING = false;` after the runtime
254
+ loads. Applied across all internal tests as part of this
255
+ commit; downstream adopters that have similar tests need the
256
+ same one-line addition.
257
+
258
+ ### Tests
259
+
260
+ stage12-snapshot-versioning.mjs grows two assertions:
261
+
262
+ - `tab() with stale expected_tree_version throws snapshot_stale`
263
+ - `tab() under STRICT without expected_* throws version_required`
264
+
265
+ Total suite: **386 PASS / 0 FAIL** across 14 stage suites.
266
+
267
+ ### Pending for 2.5.0 stable promotion (alpha -> latest)
268
+
269
+ Per `PROJECT.md` sec 3.1 (three-layer test bar, instituted
270
+ 2026-05-25), `npm dist-tag add @nac3/runtime@2.5.0 latest`
271
+ requires:
272
+
273
+ - Layer 1 unit tests green (already 386/0). ✓
274
+ - Layer 2 visual demos + Playwright + screenshots in
275
+ `evidence/<feature>/<run-date>/` per RFC.
276
+ - Layer 3 Pilot-driven high-complexity statements run against
277
+ each demo, with reasoning trace + screenshots saved.
278
+ - Pablo's explicit OK after reviewing Layer 2 + Layer 3
279
+ evidence.
280
+
281
+ Layer 2 + Layer 3 building scheduled next. V25-02 / V25-03 /
282
+ V25-04 RFCs remain DRAFT; target subsequent 2.5.x patches.
283
+
284
+ ---
285
+
286
+ ## 2.5.0-alpha.3 -- 2026-05-23
287
+
288
+ NAC3 v2.5.0-alpha.3 wires the V24-04 OCC dispatch hooks into the
289
+ mutating verbs. The contract now has teeth: an agent that passes
290
+ mismatched `expected_*` parameters gets `NacError('snapshot_stale',
291
+ ...)` synchronously, BEFORE any side effect occurs. No partial
292
+ mutations on stale state. No silent damage.
293
+
294
+ ### Added (V24-04 -- dispatch enforcement)
295
+
296
+ Every mutating verb that accepts `opts` now calls
297
+ `_resolveVersionExpectations(opts, el)` after the element lookup +
298
+ disabled / hidden / aria preflight checks, and BEFORE the side
299
+ effect:
300
+
301
+ - **`click(nac_id, opts?)`** -- after the v2.3 capability gate +
302
+ v1.8 hidden gate + v1.9 aria preflight, before `el.click()`.
303
+ - **`fill(nac_id, value, opts?)`** -- after the fillability preflight,
304
+ before native-setter `el.value = ...`.
305
+ - **`select(nac_id, option, opts?)`** -- after `_findElement`, before
306
+ the select-option write.
307
+ - **`invoke(action_id, payload, opts?)`** -- after `_findElement`,
308
+ before the `nac:action:requested` dispatch.
309
+
310
+ Verbs that inherit click/tab transitively are covered automatically:
311
+
312
+ - **`click_by_verb(plugin, verb, opts?)`** -- resolves to a `nac_id`
313
+ then dispatches `click(id, opts)`. The OCC gate runs inside the
314
+ nested click. Caller passes `expected_*` in opts and they flow
315
+ through.
316
+ - **`tab_by_label(plugin, label, opts?)`** -- similarly delegates to
317
+ `tab(...)`. But because `tab` itself does not yet accept `opts`
318
+ (signature change pending alpha.4), `expected_*` passed to
319
+ `tab_by_label` is currently dropped. This will close in alpha.4.
320
+
321
+ ### Pending for 2.5.0-alpha.4
322
+
323
+ - `tab(plugin, tab_key, opts?)` accepts opts + threads OCC gate.
324
+ - `NAC.STRICT_VERSIONING` default flips from `false` to `true` once
325
+ tab is covered (so all mutating verbs uniformly require
326
+ `expected_*` under strict mode).
327
+ - E2E demo `example-v25-snapshot-versioning.php` for the landing.
328
+
329
+ ### Conditional-await pattern
330
+
331
+ To avoid introducing a microtask boundary that would reorder
332
+ side-effect-then-immediate-check call patterns (which several
333
+ v23-editor tests rely on with synchronous `NAC.click_by_verb()`
334
+ followed by an immediate DOM check), the OCC hook is conditional:
335
+
336
+ - When opts has any `expected_*` key OR `NAC.STRICT_VERSIONING` is
337
+ true: `await _resolveVersionExpectations(...)`. May throw
338
+ `snapshot_stale` / `version_required` / `feature_not_supported`.
339
+ - Otherwise: no await, no microtask. Existing behaviour preserved.
340
+
341
+ This keeps backward compatibility intact for code that never opted
342
+ into OCC, while making `expected_*`-aware callers see the contract.
343
+
344
+ ### Tests
345
+
346
+ stage12-snapshot-versioning.mjs gains 7 new assertions for the
347
+ dispatch enforcement: stale plugin_version + stale tree_version
348
+ both raise `snapshot_stale` with structured `reason` + `slug` +
349
+ expected/current pairs; current plugin_version passes the gate and
350
+ proceeds (then hits the timeout, NOT snapshot_stale); STRICT mode
351
+ without expected_* throws `version_required`.
352
+
353
+ Total suite: **386 PASS / 0 FAIL** across 14 stage suites.
354
+
355
+ ---
356
+
357
+ ## 2.5.0-alpha.2 -- 2026-05-23
358
+
359
+ NAC3 v2.5.0-alpha.2 lands the V24-04 OCC foundation that was
360
+ deferred from alpha.1. This is an additive release on top of
361
+ alpha.1 -- everything that worked in alpha.1 still works.
362
+
363
+ ### Added (V24-04 -- foundation SHIPPED)
364
+
365
+ The snapshot versioning + optimistic concurrency framework from
366
+ RFC V24-04 lands as a foundation layer:
367
+
368
+ - `_tree_version` + `_plugin_versions` Map -- per-(slug, instance_id)
369
+ monotonic version counters. Bumped on every structural mutation
370
+ observed by the runtime MutationObserver + on every syncPlugin
371
+ call.
372
+ - `_resolvePluginScope(el)` walks ancestor [data-nac-plugin] roots
373
+ with WeakMap caching to avoid O(depth) walks on every mutation.
374
+ - `_bumpPluginVersion(slug, instance_id, trigger)` + `_bumpTreeVersion`
375
+ atomic helpers: increment counter, push to `_version_history`
376
+ (capped at 500), dispatch `nac:plugin:invalidated` +
377
+ `nac:tree:invalidated` events.
378
+ - Single document-rooted MutationObserver that filters mutations to
379
+ data-nac-* attribute changes + addNodes/removeNodes that contain
380
+ data-nac-* descendants. Pure value/text changes do NOT bump.
381
+ - `element_state_hash` (128-bit SHA-256 truncated) over a canonical
382
+ 5-key state (visible, disabled, value, text, custom). Sync impl
383
+ + async crypto.subtle path when available. Byte-identical digests
384
+ across paths.
385
+ - `markHydrationComplete()` + 100ms fallback for SSR-then-hydrate
386
+ scenarios. Tagged trigger='hydration_complete' on the resulting
387
+ bump events.
388
+ - `versionHistory(limit?)` devtools surface -- last N bumps, most
389
+ recent first.
390
+
391
+ ### Added (V24-04 -- describe() additions)
392
+
393
+ - `describe()` output now carries `tree_version` at the root +
394
+ `plugin_version` + `plugin_instance_id` per plugin entry +
395
+ `element_state_hash` per element entry. All three are read-only
396
+ observers; consuming them is opt-in.
397
+
398
+ ### Added (V24-04 -- NAC.* surface)
399
+
400
+ - `NAC.STRICT_VERSIONING` (default **false** in alpha.2; will flip to
401
+ true in alpha.3 after one soak window). When true,
402
+ every mutating API call without `expected_*` parameters throws
403
+ `NacError('version_required', ...)`.
404
+ - `NAC.eager_hashing` (default false) -- placeholder flag for future
405
+ cache-the-hash-on-mutate optimization.
406
+ - `NAC.conformance_tier` (default `'NAC-3-versioned'`). Runtimes that
407
+ declare the legacy `'NAC-3'` tier explicitly reject `expected_*`
408
+ parameters with `NacError('feature_not_supported', ...)`.
409
+ - `NAC.markHydrationComplete()` -- explicit hydration ack.
410
+ - `NAC.versionHistory(limit?)` -- devtools.
411
+
412
+ ### V24-02 syncPlugin consolidation
413
+
414
+ syncPlugin's version stamp now uses the V24-04 `_bumpPluginVersion`
415
+ machinery instead of the alpha.1 per-call timestamp string. The
416
+ return shape (`{replaced, slug, version}`) is unchanged, but the
417
+ `version` value is now `v_<N>` instead of `v_<base36-ts>_<seq>`.
418
+ Tests pass either format (just check the `v_` prefix and that
419
+ versions differ across calls).
420
+
421
+ ### Pending for 2.5.0-alpha.3
422
+
423
+ - **Dispatch enforcement hooks.** `click` / `click_by_verb` / `tab` /
424
+ `tab_by_label` / `fill` / `select` / `invoke` accept
425
+ `expected_plugin_version` / `expected_tree_version` /
426
+ `expected_element_state_hash` parameters and reject with
427
+ `NacError('snapshot_stale', ...)` on mismatch via
428
+ `_resolveVersionExpectations()` (the helper is already in this
429
+ release; the hooks are not yet wired into the dispatch verbs).
430
+ - **`STRICT_VERSIONING` default flip** from false to true. Gated on
431
+ the dispatch hooks landing.
432
+ - **V25-02/03/04 drafts** -- tree navigation, assistive labels,
433
+ effect detection. Target subsequent 2.5.x patches.
434
+
435
+ ### Tests
436
+
437
+ `runtime/test/` adds stage12-snapshot-versioning.mjs (23 PASS):
438
+ API surface, describe() additions, syncPlugin bump events, version
439
+ history, markHydrationComplete idempotency, hydration trigger
440
+ tagging.
441
+
442
+ Suite total: **377 PASS / 0 FAIL** across 14 stage suites.
443
+
444
+ ### Migration notes
445
+
446
+ - Code consuming `describe()` output that did NOT expect
447
+ `tree_version` / `plugin_version` / `element_state_hash` keys is
448
+ unaffected: those keys are additive. Code that explicitly checked
449
+ describe().plugins[i] for an enumerated key set might fail; the
450
+ fix is to ignore unknown keys (forward-compatible default).
451
+ - syncPlugin's `result.version` value format changed (see V24-02
452
+ section above). Tests that asserted the exact alpha.1 format
453
+ string would need to relax to a prefix-only check.
454
+
455
+ ---
456
+
457
+ ## 2.5.0-alpha.1 -- 2026-05-23
458
+
459
+ NAC3 v2.5.0-alpha.1 is a **consolidation release**. Two parallel
460
+ development lines that diverged during May 2026 are unified here.
461
+ The yujinapp/nac-spec repository becomes the SOLE source of truth
462
+ for NAC3 from this commit forward; the prior development copies
463
+ under rpaforce-crm (`packages/nac/`, `yujin.app/nac-spec/`) are
464
+ deleted in that monorepo's history.
465
+
466
+ ### Lines unified
467
+
468
+ - **Line A** (was on this repo, RFC track): V24-01 plugin slug
469
+ uniqueness, V24-02 idempotent syncPlugin (was announced in
470
+ 2.3.x changelog but never landed in code -- now implemented
471
+ for the first time with full test coverage), V24-04 snapshot
472
+ versioning + OCC (in flight, see "Pending" below), V24-05
473
+ agent authority + sudo (was DRAFT, ships SHIPPED here).
474
+ - **Line B** (was on rpaforce-crm, contract track): V25-01 plugin
475
+ extension contract for canvas+API surfaces (Block A: 8 backends
476
+ complete + tests).
477
+
478
+ ### Added (V25-01 -- NEW)
479
+
480
+ - `NAC.registerPlugin(slug, manifest)` declarative plugin
481
+ registration for surfaces where verbs / state / events route
482
+ through something other than direct DOM (postMessage to iframe,
483
+ plugin SDK call, script bridge, DOM mirror, same-origin window,
484
+ synthesised events).
485
+ - `NAC.call(plugin, verb_path, args)` abstract verb dispatch.
486
+ - `NAC.read(plugin, state_path)` abstract state read with declared
487
+ fallback chain semantics.
488
+ - `NAC.subscribe(plugin, event_path, cb) / unsubscribe(handle)`
489
+ event subscription with backend routing.
490
+ - 8 backend kinds in fixed vocabulary: `postmessage`,
491
+ `postmessage-listen`, `sdk-call`, `script-bridge`, `dom-mirror`,
492
+ `same-origin-window`, `synthetic-mutation`, `synthetic-poll`.
493
+ - Declarative extractor mini-DSL (`text` / `value` / `present` /
494
+ `attribute:NAME` / `classList.contains:CLASS` / dotted-path).
495
+ - Provenance event family: `nac:plugin:invoked` / `:read` / `:event`
496
+ with `{plugin, backend, request_id, source, trusted, duration_ms,
497
+ ok, error}` payload.
498
+
499
+ ### Added (V24-02 -- NEW IMPLEMENTATION)
500
+
501
+ - `NAC.syncPlugin(manifest)` / `NAC.syncPlugin(slug, manifest)`
502
+ -- idempotent registration. Replaces the manifest for a slug
503
+ instead of appending; SPA hosts call this on remount without
504
+ accumulating stale entries.
505
+ - Returns `{ replaced: boolean, slug, version }`.
506
+ - Emits `nac:plugin:invalidated` on REPLACE (not on first-add),
507
+ detail `{plugin_slug, plugin_instance_id, from_version,
508
+ to_version, trigger: 'syncPlugin'}`.
509
+
510
+ ### Added (V24-05 -- NEW)
511
+
512
+ - `NAC.set_confirm_handler(fn)` -- register async (req) => boolean.
513
+ - `NAC.confirm_action(action_id, message, opts?)` -- Promise<boolean>.
514
+ Sudo bypass: short-circuits true if elevation already granted
515
+ for the requested scope (or higher).
516
+ - `NAC.request_authority(scope, ttl_ms, opts?)` -- sudo-style
517
+ time-bounded elevation. Scope rank: high > medium > low.
518
+ - `NAC.has_authority(scope) -> bool`.
519
+ - `NAC.revoke_authority(scope) -> void` (idempotent).
520
+ - Provenance event family:
521
+ `nac:authority:requested / :granted / :denied / :revoked / :expired`,
522
+ `nac:action:confirmed / :rejected`.
523
+ - SUPERSEDES the v1.9 confirm_action mechanism (removed: it was
524
+ unused + had a strictly narrower contract).
525
+
526
+ ### Added (V24-01 -- CONSOLIDATED + ENFORCED)
527
+
528
+ - `NAC.HARD_DEDUP` flag (default true). Gates the synchronous
529
+ throw in `NAC.register` + the boot-time pass.
530
+ - `NAC.register` throws `NacError('duplicate_plugin_no_instance_id',
531
+ ...)` synchronously when the DOM already contains multiple roots
532
+ for the registered slug and any of them omits / duplicates
533
+ `data-nac-plugin-id`.
534
+ - Boot-time pass on `DOMContentLoaded` runs the same check across
535
+ every `[data-nac-plugin]` root. On first violation: dispatches
536
+ `nac:fatal` event + paints a fixed-position red banner
537
+ (`#__nac_fatal_banner__`) + re-throws asynchronously so test
538
+ harnesses + browsers catch it.
539
+ - `validate_global()` extended with `plugin_instance_violations`
540
+ array -- structured findings for CI gates.
541
+ - Migration: `NAC.HARD_DEDUP = false` BEFORE any `register()`
542
+ call opts out for one release window. Flag removed in v2.6.
543
+
544
+ ### New: PROJECT.md at repo root
545
+
546
+ PROJECT.md documents the post-migration topology, the RFC process
547
+ states (Proposed / In implementation / Implemented / Alpha /
548
+ Production), the doc-update invariant (every RFC transition
549
+ touches SPEC + CHANGELOG + USER_MANUAL + TECHNICAL_DESIGN + demos
550
+ list + benchmark numbers + Sumi KB), and the programming +
551
+ architecture norms. Read it FIRST before any contribution.
552
+
553
+ ### Tests
554
+
555
+ `runtime/test/` suite now has 13 stages:
556
+
557
+ smoke + v22 + v23-{invoke,shadow,capabilities,editor,interop}
558
+ + stage2-disambiguation + stage7-strict-resolution + stage8-plugin-extension
559
+ + stage9-sync-plugin + stage10-authority-sudo + stage11-plugin-id-dedup
560
+
561
+ `npm test` exit code 0, 349 PASS / 0 FAIL.
562
+
563
+ ### Pending for 2.5.0-alpha.2
564
+
565
+ - V24-04 snapshot versioning + OCC -- in implementation, code in
566
+ flight. Targets `NAC.STRICT_VERSIONING=true` by default, with
567
+ `expected_plugin_version` / `expected_tree_version` enforcement
568
+ on every mutating API. The `plugin_version` + `element_state_hash`
569
+ fields will appear in `describe()` output.
570
+ - V25-02 tree navigation (`context`, `tree`, `data-nac-opens`)
571
+ -- DRAFT, target 2.5.x.
572
+ - V25-03 assistive labels (`narrate`) -- DRAFT, target 2.5.x.
573
+ - V25-04 effect detection (`expect`, `diff`) -- DRAFT, target 2.5.x.
574
+
575
+ ### Migration notes
576
+
577
+ - Code that ran fine under 2.4.0 (strict resolution + disambiguation)
578
+ continues to work unchanged in 2.5; that contract is stable.
579
+ - Code that called the pre-existing v1.9 `confirm_action` must
580
+ migrate to V24-05 (`confirm_action` + `set_confirm_handler` +
581
+ `request_authority`). The argument shape changed
582
+ (`(action_id, opts)` -> `(action_id, message, opts)`). Audit
583
+ callers; no automatic migration tool.
584
+ - Code that registered the same plugin slug on multiple DOM roots
585
+ WITHOUT `data-nac-plugin-id` now throws at register time. Either
586
+ add the attribute, OR set `NAC.HARD_DEDUP=false` before
587
+ registering for a one-release migration window.
588
+
589
+ ---
590
+
591
+ ## 2.4.0 -- 2026-05-21
592
+
593
+ NAC3 v2.4.0 is a **behavior-of-contract change**: id / verb / qualifier
594
+ resolution becomes strict. Backwards-compatible with code paths that
595
+ already supplied unambiguous arguments, **NOT** backwards-compatible
596
+ with code paths that depended on the previous lenient (`indexOf`)
597
+ fallback to resolve to the first near-match.
598
+
599
+ ### Why this changed (the principle, not a feature)
600
+
601
+ The lenient resolution in 2.3.x violated the spec's 0-silent-damage
602
+ invariant. Specifically, `click_by_verb(plugin, verb, { qualifier })`
603
+ would, on a no-exact-suffix match, fall through to an `indexOf(qualifier)`
604
+ substring search and resolve silently to whatever element happened to
605
+ contain the qualifier string anywhere in its id. The H4 benchmark on the
606
+ Conduit case study (2026-05-21) showed that **12 of 18 "model failures"
607
+ on the canonical flows were actually silent runtime damage** — the
608
+ agent emitted an invalid qualifier, the runtime sent it to the wrong
609
+ element, the agent looped against the wrong page state. Strict
610
+ resolution rescues those 12 (see `nac-spec/conduit/H4_STRICT_NAC_REPORT.md`).
611
+
612
+ For an assistive-software use case (the principal driver of this
613
+ project), a silent dispatch to the wrong element with no recovery path
614
+ is a safety blocker. Strict resolution closes that gap.
615
+
616
+ ### New error model — disambiguation contract
617
+
618
+ When `click_by_verb` / `tab` / `tab_by_label` cannot resolve a request
619
+ unambiguously, the runtime now:
620
+
621
+ 1. Emits `nac:disambiguation_requested` on `document` with a
622
+ structured detail payload (see below).
623
+ 2. Throws `NacError` with `err.code` ∈ `{no_matching_instance,
624
+ ambiguous_qualifier, ambiguous_tab, ambiguous_label}` AND
625
+ `err.candidates: [{nac_id, label}, ...]` pre-validated against the
626
+ live DOM.
627
+
628
+ Detail / candidates payload:
629
+ ```js
630
+ {
631
+ method: 'click_by_verb' | 'tab' | 'tab_by_label',
632
+ plugin: string | null,
633
+ query: { verb?, qualifier?, label?, id? },
634
+ reason: 'no_matching_instance' | 'ambiguous_qualifier' | 'ambiguous_tab' |
635
+ 'ambiguous_label' | 'ambiguous_label_exact' | 'ambiguous_label_fuzzy' |
636
+ 'no_matching_label',
637
+ candidates: [{ nac_id: string, label: string }, ...]
638
+ }
639
+ ```
640
+
641
+ A reactive host (chat UI / voice agent / screen-reader) can listen
642
+ on the event and present the options to the user as *"did you
643
+ mean A or B?"*. A synchronous catcher can read `err.candidates`
644
+ directly. An autonomous agent (Pilot, etc.) can inject the candidates
645
+ into the next turn's prompt so the LLM picks from a DOM-validated
646
+ list instead of re-guessing a qualifier.
647
+
648
+ ### What changed in the resolvers
649
+
650
+ - **`click_by_verb` with qualifier:** only exact-equality or anchored
651
+ suffix (`id === qualifier || id.endsWith('__' + qualifier)`)
652
+ resolves. Multiple matches → `ambiguous_qualifier`. Zero matches →
653
+ `no_matching_instance`. **The `indexOf` substring fallback is
654
+ removed.**
655
+ - **`tab` single-arg form:** bare id resolves to exact match in DOM. If
656
+ no exact, exactly one anchored-prefix instance
657
+ (`id.startsWith(bare + '__')`) resolves; multiple → `ambiguous_tab`;
658
+ zero → `no_matching_instance`.
659
+ - **`tab_by_label`:** two-tier strict — exact label match first
660
+ (errors if multiple), then substring match (errors if multiple).
661
+ Fuzzy match preserved for voice/assistive use case; ambiguity
662
+ caught.
663
+
664
+ ### Verification
665
+
666
+ - `packages/nac/test/stage2-disambiguation.mjs` — pre-existing
667
+ tab_by_label cases still PASS (B1–B4).
668
+ - `packages/nac/test/stage7-strict-resolution.mjs` (new) — 9/9
669
+ invariants pass under JSDOM shim.
670
+ - `nac3-bench/bench/scripts/stage7_strict_nac.mjs` (new) — 9/9
671
+ invariants pass under Playwright against a live page.
672
+ - `nac3-bench/bench/h4_results/h4_2026-05-21T19-01-19-040Z.json` —
673
+ cheap-model benchmark with strict NAC: 48/54 = 89% (vs 36/54 = 67%
674
+ under lenient).
675
+
676
+ ### Migration guide
677
+
678
+ If your code was passing fuzzy qualifiers and depending on the runtime
679
+ to pick "something close", the upgrade requires you to:
680
+ - Either supply the full `nac_id` directly (always unambiguous), OR
681
+ - Pass the exact `__suffix` of the instance you want, OR
682
+ - Listen for `nac:disambiguation_requested` / catch `NacError` with
683
+ `err.candidates` and pick from the returned list.
684
+
685
+ Most users won't be affected — the only callers that broke during the
686
+ internal regression were the ones that were already broken silently in
687
+ 2.3.x but happened to land on the wrong-but-related element instead of
688
+ failing.
689
+
690
+ ---
691
+
692
+ ## 2.3.1 -- 2026-05-13 (stable, blank republish)
693
+
694
+ Identical source to 2.3.0. The 2.3.0 tag had already been published to
695
+ npm as a preview; 2.3.1 is the first installable stable version. No
696
+ behavioural changes.
697
+
698
+ ---
699
+
700
+ ## 2.3.0 -- 2026-05-13 (stable)
701
+
702
+ NAC3 v2.3.0 is the first stable release of the payload-bearing
703
+ contract. Everything in 2.3.0-alpha.1 and 2.3.0-alpha.2 is rolled
704
+ in; the alpha tags are deprecated. New in stable (beyond the alpha
705
+ preview):
706
+
707
+ ### New primitives
708
+
709
+ - **`NAC.invoke(action_id, payload, opts?)`** -- payload-bearing
710
+ action. Dispatches `nac:action:requested`, awaits the host's
711
+ `nac:action:succeeded` / `:failed` with the same `request_id`.
712
+ Default timeout 30 s. (Promoted from 2.3.0-alpha.1.)
713
+ - **`NAC.utter(action_id, {text, lang?, voice?})`** -- ergonomic
714
+ shortcut for `verb='utter'`. (Promoted from 2.3.0-alpha.1.)
715
+ - **`NAC.bindTab(el, handler, ctx, opts?)`** -- tab companion to
716
+ `bindAction`. Emits `nac:tab:activated` / `:activation_failed`
717
+ for you. Sister of v2.2's `bindAction`.
718
+ - **`NAC.edit_field(nac_id)`** -- field editor primitive promoted
719
+ from preview to GA. Selection, replace, AI syntax correction,
720
+ save/cancel verbs. Modal mounts the `nac_editor` plugin
721
+ idempotently with all 10 locales.
722
+
723
+ ### Shadow DOM resolution (F1 + F6)
724
+
725
+ - **Open shadow DOM**: the runtime walks `el.shadowRoot`
726
+ recursively up to depth 10. Any element with `data-nac-id`
727
+ inside an open shadow root is now resolvable by `NAC.click`,
728
+ `NAC.fill`, `NAC.invoke`, etc. with no glue code.
729
+ - **Closed shadow DOM**: voluntary exposure contract. A
730
+ component MAY expose a `nac3` getter on the host element
731
+ implementing `query(selector)` (mandatory),
732
+ `queryAll(selector)` (recommended), and `describe()` (optional).
733
+ The runtime delegates to those methods.
734
+ - **Error events** for closed shadow:
735
+ - `nac:shadow_blocked` -- emitted once per host with
736
+ `detail.reason` in `'exposure_threw'`, `'not_exposed'`.
737
+ - `nac:shadow_protocol_violation` -- emitted when an exposed
738
+ method returns a non-Element value.
739
+ - All events use `composed: true` so they correctly cross shadow
740
+ boundaries to document-level listeners.
741
+
742
+ ### Auth-aware capabilities (F7)
743
+
744
+ - Manifest entries MAY declare `requires_capability: 'verb_slug'`
745
+ at the element level or per `action.verb`. Array values use
746
+ OR semantics ("at least one cap matches passes").
747
+ - `NAC.setCapabilities([...])`, `NAC.grantCapability(cap)`,
748
+ `NAC.revokeCapability(cap)`, `NAC.userCapabilities()` manage
749
+ the user's capability set.
750
+ - `NAC.click` and `NAC.invoke` gate against the set before
751
+ dispatch. Missing cap -> reject with `code='capability_required'`
752
+ + emit `nac:command:rejected`.
753
+
754
+ ### Strict validation default (F3)
755
+
756
+ - `NAC.STRICT_VALIDATION` default flipped from `false` to **`true`**
757
+ in v2.3 stable, per the v2.2 migration promise.
758
+ `NAC.register` now throws `code='strict_validation'` on
759
+ `manifest_role_unknown` / `tab_id_manifest_role_drift` /
760
+ `manifest_dom_role_mismatch` findings.
761
+ - Opt-out: set `NAC.STRICT_VALIDATION = false` BEFORE any
762
+ `register()` call in your bootstrap. See
763
+ `guides/MIGRATION_v2.2_to_v2.3.md` for the playbook.
764
+
765
+ ### Hotfix carryover from alpha.2
766
+
767
+ - `NAC.invoke` does NOT reject with `code='disabled'` on elements
768
+ with `disabled` or `aria-disabled='true'`. `invoke` is a logical
769
+ payload-bearing request, not a synthetic click. `NAC.click` still
770
+ rejects on disabled (click semantics preserved). Pinned down by
771
+ test v23-invoke.mjs T7/T8/T9 so the relaxation cannot silently
772
+ regress.
773
+
774
+ ### Test surface
775
+
776
+ `npm test` now chains 7 suites (75+ assertions):
777
+ smoke, v22, v23-invoke, v23-shadow, v23-capabilities, v23-editor,
778
+ v23-interop. Plus 5 stage suites + live Playwright E2E
779
+ (`atlas-pro-v23-utter-e2e.mjs` 16/16 GREEN against the deployed
780
+ demo).
781
+
782
+ ### Spec text
783
+
784
+ SPEC.md updated:
785
+ - Section 5.1.4 -- `NAC.invoke` + `NAC.utter` final wording.
786
+ - Section 5.1.5 -- Shadow DOM resolution (open, cap 10).
787
+ - Section 5.1.6 -- Closed shadow DOM exposure API (voluntary).
788
+ - Section 5.1.7 -- Auth-aware capabilities.
789
+ - Section 13 -- `edit_field` promoted from preview to GA.
790
+
791
+ ### Reference adopters
792
+
793
+ - Atlas Pro voice ad (`ads-demo/atlas-pro/`) -- production live,
794
+ uses `NAC.utter` + payload schema.
795
+ - React demo (`packages/nac-react-demo/`) -- adopts payload-bearing
796
+ pattern for the chat-to-todos flow.
797
+ - Angular demo (`packages/nac-angular-demo/`) -- mirror of React.
798
+ - Web Component demos: `example-v23-shadow-open.html` and
799
+ `example-v23-shadow-closed.html`.
800
+
801
+ ## 2.3.0-alpha.2 -- 2026-05-13 (superseded by 2.3.0)
802
+
803
+ Hotfix on top of 2.3.0-alpha.1:
804
+
805
+ - `NAC.invoke` no longer rejects with `code='disabled'` when the
806
+ target element has `disabled` or `aria-disabled='true'` set. The
807
+ `disabled` HTML attribute is a click-event UX guard; `invoke` is
808
+ a logical payload-bearing request, not a synthetic click. Hosts
809
+ that need to refuse an invoke based on UI state should do it in
810
+ their `nac:action:requested` listener and emit
811
+ `nac:action:failed` with a meaningful code. This was hitting the
812
+ Atlas Pro mic which gets `disabled = true` during /parse +
813
+ /tts processing, blocking subsequent NAC.utter calls from
814
+ external agents mid-conversation. Reproduced in the video-gen
815
+ pipeline (every turn after the demo's first state-transition).
816
+ - Bumped CLI version + smoke test assertions to match.
817
+
818
+ ## 2.3.0-alpha.1 -- 2026-05-12
819
+
820
+ ### New: payload-bearing actions via `NAC.invoke` + `NAC.utter`
821
+
822
+ The NAC v2.2 contract was click-and-go: an agent triggers
823
+ `NAC.click(id)` or `NAC.click_by_verb(plugin, verb)` and the host
824
+ does whatever it does. That works for verb-and-state actions
825
+ (`save`, `cancel`, `submit`, `delete`) but breaks down when the
826
+ action needs **data** from the agent: `utter(text)`,
827
+ `search(query)`, `send_message(body)`, `upload(file)`,
828
+ `schedule(date)`. Hosts had no way to receive an agent's payload
829
+ via a synthetic click.
830
+
831
+ v2.3 adds the missing primitive:
832
+
833
+ ```ts
834
+ NAC.invoke(action_id, payload, opts?): Promise<{ok, request_id, ack}>
835
+ NAC.utter(action_id, {text, lang?, voice?}): Promise<...>
836
+ ```
837
+
838
+ `NAC.invoke` dispatches a `nac:action:requested` CustomEvent on
839
+ the host element (bubbles) with the agent's `payload` + a
840
+ runtime-issued `request_id`. The host listens, processes, emits
841
+ `nac:action:succeeded` (or `:failed`) echoing the same
842
+ `request_id`. The runtime correlates and resolves the Promise.
843
+
844
+ Default timeout 30 s (vs 5 s for click). On timeout the Promise
845
+ rejects with `code='timeout'`.
846
+
847
+ `NAC.utter(id, opts)` is the ergonomic shortcut for `verb='utter'`
848
+ -- equivalent to `NAC.invoke(id, {verb:'utter', text, lang, voice})`.
849
+
850
+ Manifest entries for payload-bearing actions can declare an
851
+ informational `payload_schema`:
852
+
853
+ ```js
854
+ { id: 'atlas_pro_ad.mic', role: 'action',
855
+ actions: [
856
+ { verb: 'listen' },
857
+ { verb: 'utter',
858
+ payload_schema: {
859
+ text: { type: 'string', required: true, max: 4000 },
860
+ lang: { type: 'string', enum: ['en','es','pt','fr','it','de','ja','zh','hi','ar'] }
861
+ }
862
+ }
863
+ ]
864
+ }
865
+ ```
866
+
867
+ Click-style verbs (`NAC.click`, `NAC.click_by_verb`) continue to
868
+ work unchanged. The new contract is purely additive; no demo
869
+ behaviour regresses.
870
+
871
+ #### First adopter
872
+
873
+ Atlas Pro (`https://yujin.app/nac-spec/ads-demo/atlas-pro/`)
874
+ declares both `listen` (click-only, existing) and `utter`
875
+ (payload-bearing) on its `atlas_pro_ad.mic` action. The same
876
+ `/ad-orchestrator/parse` + `/ad-orchestrator/tts` loop drives
877
+ either path -- agents with their own STT call `listen`, agents
878
+ with their own LM call `utter` with the recognised text.
879
+
880
+ #### Test coverage
881
+
882
+ - `test/v23-invoke.mjs` (new) -- 22 assertions covering happy
883
+ path, ack echo, host-failed path, invalid args, not-found,
884
+ custom timeout. PASS.
885
+ - `test/v22.mjs` -- amended to accept v2.3.x in addition to
886
+ v2.2.x. PASS.
887
+ - `test/smoke.mjs` -- updated version assertions. PASS.
888
+
889
+ #### Files touched
890
+
891
+ - `yujin.app/nac-spec/js/nac.js` -- `invoke()` + `utter()` (~150
892
+ LOC additive). Public API surface +2 functions. NAC.version
893
+ bumped to '2.3.0-alpha.1', spec_version to '2.3'.
894
+ - `yujin.app/nac-spec/SPEC.md` -- new section 5.1.4 + header
895
+ version line.
896
+ - `yujin.app/nac-spec/ads-demo/atlas-pro/index.html` -- manifest
897
+ declares the `utter` verb + DOM listener routes into the demo's
898
+ existing `handleUtterance(text)`.
899
+ - `packages/nac/package.json`, `build.mjs`, `test/smoke.mjs` --
900
+ version bumps + new test in `npm test`.
901
+
902
+ #### Not yet wired
903
+
904
+ - `STRICT_VALIDATION` enforcement of `payload_schema` (alpha:
905
+ schema is informational).
906
+ - A `NAC.search` / `NAC.upload` / `NAC.send_message` ergonomic
907
+ shortcut sibling to `NAC.utter`. The generic `NAC.invoke` works
908
+ today; concrete shortcuts can be added without re-spec.
909
+
910
+ ## 2.2.1 -- 2026-05-12
911
+
912
+ ### Bug fix: importable in Node / SSR / test contexts
913
+
914
+ Pre-launch smoke test caught that `import '@nac3/runtime'` and
915
+ `import '@nac3/runtime/chat-client'` crashed in Node.js with
916
+ `ReferenceError: document is not defined`. The bundles had
917
+ top-level `document.dispatchEvent` and `document.addEventListener`
918
+ calls firing at module-evaluation time.
919
+
920
+ Fix: wrap browser-only init in `typeof document !== 'undefined'`
921
+ guards. In the browser the behaviour is unchanged (the events
922
+ still fire on install + the confirm listener still attaches). In
923
+ Node / SSR / Vitest / Jest the bundles now import as no-ops
924
+ instead of crashing.
925
+
926
+ Files patched (no API change):
927
+ - `dist/nac.{mjs,cjs,browser.js}` -- guarded `nac:installed`
928
+ dispatch + `_installA11yHintBridge()` call.
929
+ - `dist/nac-chat-client.{mjs,cjs,browser.js}` -- guarded
930
+ `nac:confirm:requested` listener attach.
931
+ - `dist/nac-v2-extensions.*` -- unchanged (it already early-bails
932
+ when the main runtime is not present).
933
+
934
+ Verified: all three entry points (`@nac3/runtime`,
935
+ `@nac3/runtime/extensions`, `@nac3/runtime/chat-client`) now
936
+ import cleanly under Node 22 ESM + CommonJS `require`.
937
+
938
+ ## 2.2.0 -- 2026-05-10
939
+
940
+ Same-day v2.2 ships the constructor-strict validator + action-ack
941
+ helper. Both items moved from the v2.2 roadmap into the runtime
942
+ with no breaking changes (warning-only mode by default).
943
+
944
+ ### V22-01 -- `NAC.register` strict validator
945
+
946
+ `NAC.register(manifest)` now checks each manifest entry against
947
+ three rules and emits `console.error` for findings:
948
+
949
+ - `manifest_role_unknown` -- the entry's `role` is outside the
950
+ canonical set (the 18 roles in SPEC sec 1).
951
+ - `tab_id_manifest_role_drift` -- the entry's id matches `^tab\.`
952
+ but its role is not `'tab'`. NAC.tab() and NAC.tab_by_label()
953
+ query the canonical role only; a drift here makes the tab
954
+ invisible to those resolvers (the bug class that broke
955
+ example-v21-data-table.php on 2026-05-09).
956
+ - `manifest_dom_role_mismatch` -- the corresponding DOM element
957
+ is mounted, and its `data-nac-role` differs from the manifest's
958
+ `role` value. Catches the case where an HTML author and a JS
959
+ author drift apart on what role to use.
960
+
961
+ A new flag `NAC.STRICT_VALIDATION` toggles findings between
962
+ warning-only (default; ships in 2.2) and throwing (will be the
963
+ v2.3 default; opt-in in 2.2 for adopters who want to gate CI).
964
+
965
+ Migration window: v2.2 = console.error only, v2.3 = throw
966
+ default, v3.0 = remove the flag.
967
+
968
+ ### V22-02 -- `NAC.bindAction` helper
969
+
970
+ New helper:
971
+
972
+ ```js
973
+ NAC.bindAction(buttonEl, function (ev) { /* side effect */ }, {
974
+ plugin: 'invoice', action_id: 'invoice.save'
975
+ });
976
+ ```
977
+
978
+ Bakes the `nac:action:succeeded` / `:failed` contract into the
979
+ runtime so brownfield panels cannot forget to emit the ack event.
980
+ Handles sync handlers + Promise-returning handlers; emits failure
981
+ on throw + preserves normal error semantics; returns an unbinder
982
+ function.
983
+
984
+ Removes the foot-gun that produced the v20-panel timeout reports
985
+ on 2026-05-09 (every voice command on example-v20-full.php
986
+ replied "No pude ejecutar X: timeout" because the panel handlers
987
+ did the work synchronously but never emitted the ack).
988
+
989
+ ### Tests
990
+
991
+ - `test/smoke.mjs` -- 36/36 PASS (artefact integrity + d.ts
992
+ surface + CLI version + CLI lint over demos + package.json
993
+ consistency, version asserts now check 2.2.0).
994
+ - `test/v22.mjs` -- new. 14/14 PASS. 5 strict-validator cases
995
+ (clean, unknown-role, tab-drift, DOM mismatch, strict-throws)
996
+ + 5 bindAction cases (sync ack, throw -> failed event, Promise
997
+ ack, unbinder, ctx validation) + NAC sanity checks.
998
+
999
+ Run via: `npm test` (chains both suites).
1000
+
1001
+ ### Known to-dos
1002
+
1003
+ - Per-action signing (v3.0 candidate).
1004
+ - v2.3 will flip `STRICT_VALIDATION` default to true.
1005
+ - v2.3 will ship `NAC.bindTab(el, handler, ctx)` companion for
1006
+ tab-role widgets.
1007
+
1008
+ ## 2.1.0 -- 2026-05-10
1009
+
1010
+ First public release. Wraps the reference runtime that has been
1011
+ running in production at yujin.app since 2026-04 as the npm package
1012
+ `@nac3/runtime`.
1013
+
1014
+ ### Spec
1015
+
1016
+ - v2.1 with data-table primitive (collection / matrix /
1017
+ matrix-singletree subkinds; `dt_add_row` / `dt_edit_cell` /
1018
+ aggregates / transactional commit).
1019
+ - Brownfield migration story shipped (v2.0 extensions: scope tree,
1020
+ ephemeral capture, autoRegister, HMAC, isTrusted).
1021
+ - 18 canonical roles, 11 success-event families.
1022
+ - 10-locale i18n contract.
1023
+
1024
+ ### Package
1025
+
1026
+ - ESM + CJS + browser builds.
1027
+ - TypeScript declarations (permissive surface; v2.2 ships
1028
+ hand-authored full types).
1029
+ - CLI: `npx nac validate <dir>` does static lint of HTML/PHP.
1030
+ - Single source of truth: package built from
1031
+ `yujin.app/nac-spec/js/*.js`, no maintenance duplication.
1032
+
1033
+ ### Demos
1034
+
1035
+ - `example.php` -- v1.9 reference, 27 widgets.
1036
+ - `example-v20-full.php` -- brownfield migration of v1.9 to v2.0.
1037
+ - `example-v20-primitives-showcase.php` -- didactic showcase of
1038
+ the 8 v2.0 primitives.
1039
+ - `example-v21-data-table.php` -- live data-table demo wired to
1040
+ the Yujin chat backend.
1041
+
1042
+ All demos hosted at yujin.app/nac-spec/.
1043
+
1044
+ ### Known limitations
1045
+
1046
+ - No per-action signing yet (only manifests). v3.0 candidate.
1047
+ - Constructor (`NAC.register`) is permissive on unknown roles; the
1048
+ v2.2 strict-validator landing fixes this.
1049
+ - CLI URL mode (`nac validate https://...`) requires Playwright;
1050
+ the package does not pull Playwright as a hard dep. Static-lint
1051
+ mode works without it.