@nac3/runtime 2.5.0-alpha.4 → 2.5.0

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