@nac3/runtime 2.3.0 → 2.3.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,214 +1,73 @@
1
1
  # Changelog
2
2
 
3
- ## 2.3.0 -- 2026-05-13 (stable)
4
-
5
- NAC3 v2.3.0 is the first stable release of the payload-bearing
6
- contract. Everything in 2.3.0-alpha.1 and 2.3.0-alpha.2 is rolled
7
- in; the alpha tags are deprecated. New in stable (beyond the alpha
8
- preview):
9
-
10
- ### New primitives
11
-
12
- - **`NAC.invoke(action_id, payload, opts?)`** -- payload-bearing
13
- action. Dispatches `nac:action:requested`, awaits the host's
14
- `nac:action:succeeded` / `:failed` with the same `request_id`.
15
- Default timeout 30 s. (Promoted from 2.3.0-alpha.1.)
16
- - **`NAC.utter(action_id, {text, lang?, voice?})`** -- ergonomic
17
- shortcut for `verb='utter'`. (Promoted from 2.3.0-alpha.1.)
18
- - **`NAC.bindTab(el, handler, ctx, opts?)`** -- tab companion to
19
- `bindAction`. Emits `nac:tab:activated` / `:activation_failed`
20
- for you. Sister of v2.2's `bindAction`.
21
- - **`NAC.edit_field(nac_id)`** -- field editor primitive promoted
22
- from preview to GA. Selection, replace, AI syntax correction,
23
- save/cancel verbs. Modal mounts the `nac_editor` plugin
24
- idempotently with all 10 locales.
25
-
26
- ### Shadow DOM resolution (F1 + F6)
27
-
28
- - **Open shadow DOM**: the runtime walks `el.shadowRoot`
29
- recursively up to depth 10. Any element with `data-nac-id`
30
- inside an open shadow root is now resolvable by `NAC.click`,
31
- `NAC.fill`, `NAC.invoke`, etc. with no glue code.
32
- - **Closed shadow DOM**: voluntary exposure contract. A
33
- component MAY expose a `nac3` getter on the host element
34
- implementing `query(selector)` (mandatory),
35
- `queryAll(selector)` (recommended), and `describe()` (optional).
36
- The runtime delegates to those methods.
37
- - **Error events** for closed shadow:
38
- - `nac:shadow_blocked` -- emitted once per host with
39
- `detail.reason` in `'exposure_threw'`, `'not_exposed'`.
40
- - `nac:shadow_protocol_violation` -- emitted when an exposed
41
- method returns a non-Element value.
42
- - All events use `composed: true` so they correctly cross shadow
43
- boundaries to document-level listeners.
44
-
45
- ### Auth-aware capabilities (F7)
46
-
47
- - Manifest entries MAY declare `requires_capability: 'verb_slug'`
48
- at the element level or per `action.verb`. Array values use
49
- OR semantics ("at least one cap matches passes").
50
- - `NAC.setCapabilities([...])`, `NAC.grantCapability(cap)`,
51
- `NAC.revokeCapability(cap)`, `NAC.userCapabilities()` manage
52
- the user's capability set.
53
- - `NAC.click` and `NAC.invoke` gate against the set before
54
- dispatch. Missing cap -> reject with `code='capability_required'`
55
- + emit `nac:command:rejected`.
56
-
57
- ### Strict validation default (F3)
58
-
59
- - `NAC.STRICT_VALIDATION` default flipped from `false` to **`true`**
60
- in v2.3 stable, per the v2.2 migration promise.
61
- `NAC.register` now throws `code='strict_validation'` on
62
- `manifest_role_unknown` / `tab_id_manifest_role_drift` /
63
- `manifest_dom_role_mismatch` findings.
64
- - Opt-out: set `NAC.STRICT_VALIDATION = false` BEFORE any
65
- `register()` call in your bootstrap. See
66
- `guides/MIGRATION_v2.2_to_v2.3.md` for the playbook.
67
-
68
- ### Hotfix carryover from alpha.2
69
-
70
- - `NAC.invoke` does NOT reject with `code='disabled'` on elements
71
- with `disabled` or `aria-disabled='true'`. `invoke` is a logical
72
- payload-bearing request, not a synthetic click. `NAC.click` still
73
- rejects on disabled (click semantics preserved). Pinned down by
74
- test v23-invoke.mjs T7/T8/T9 so the relaxation cannot silently
75
- regress.
76
-
77
- ### Test surface
78
-
79
- `npm test` now chains 7 suites (75+ assertions):
80
- smoke, v22, v23-invoke, v23-shadow, v23-capabilities, v23-editor,
81
- v23-interop. Plus 5 stage suites + live Playwright E2E
82
- (`atlas-pro-v23-utter-e2e.mjs` 16/16 GREEN against the deployed
83
- demo).
84
-
85
- ### Spec text
86
-
87
- SPEC.md updated:
88
- - Section 5.1.4 -- `NAC.invoke` + `NAC.utter` final wording.
89
- - Section 5.1.5 -- Shadow DOM resolution (open, cap 10).
90
- - Section 5.1.6 -- Closed shadow DOM exposure API (voluntary).
91
- - Section 5.1.7 -- Auth-aware capabilities.
92
- - Section 13 -- `edit_field` promoted from preview to GA.
93
-
94
- ### Reference adopters
95
-
96
- - Atlas Pro voice ad (`ads-demo/atlas-pro/`) -- production live,
97
- uses `NAC.utter` + payload schema.
98
- - React demo (`packages/nac-react-demo/`) -- adopts payload-bearing
99
- pattern for the chat-to-todos flow.
100
- - Angular demo (`packages/nac-angular-demo/`) -- mirror of React.
101
- - Web Component demos: `example-v23-shadow-open.html` and
102
- `example-v23-shadow-closed.html`.
103
-
104
- ## 2.3.0-alpha.2 -- 2026-05-13 (superseded by 2.3.0)
105
-
106
- Hotfix on top of 2.3.0-alpha.1:
107
-
108
- - `NAC.invoke` no longer rejects with `code='disabled'` when the
109
- target element has `disabled` or `aria-disabled='true'` set. The
110
- `disabled` HTML attribute is a click-event UX guard; `invoke` is
111
- a logical payload-bearing request, not a synthetic click. Hosts
112
- that need to refuse an invoke based on UI state should do it in
113
- their `nac:action:requested` listener and emit
114
- `nac:action:failed` with a meaningful code. This was hitting the
115
- Atlas Pro mic which gets `disabled = true` during /parse +
116
- /tts processing, blocking subsequent NAC.utter calls from
117
- external agents mid-conversation. Reproduced in the video-gen
118
- pipeline (every turn after the demo's first state-transition).
119
- - Bumped CLI version + smoke test assertions to match.
120
-
121
- ## 2.3.0-alpha.1 -- 2026-05-12
122
-
123
- ### New: payload-bearing actions via `NAC.invoke` + `NAC.utter`
124
-
125
- The NAC v2.2 contract was click-and-go: an agent triggers
126
- `NAC.click(id)` or `NAC.click_by_verb(plugin, verb)` and the host
127
- does whatever it does. That works for verb-and-state actions
128
- (`save`, `cancel`, `submit`, `delete`) but breaks down when the
129
- action needs **data** from the agent: `utter(text)`,
130
- `search(query)`, `send_message(body)`, `upload(file)`,
131
- `schedule(date)`. Hosts had no way to receive an agent's payload
132
- via a synthetic click.
133
-
134
- v2.3 adds the missing primitive:
135
-
136
- ```ts
137
- NAC.invoke(action_id, payload, opts?): Promise<{ok, request_id, ack}>
138
- NAC.utter(action_id, {text, lang?, voice?}): Promise<...>
139
- ```
140
-
141
- `NAC.invoke` dispatches a `nac:action:requested` CustomEvent on
142
- the host element (bubbles) with the agent's `payload` + a
143
- runtime-issued `request_id`. The host listens, processes, emits
144
- `nac:action:succeeded` (or `:failed`) echoing the same
145
- `request_id`. The runtime correlates and resolves the Promise.
146
-
147
- Default timeout 30 s (vs 5 s for click). On timeout the Promise
148
- rejects with `code='timeout'`.
149
-
150
- `NAC.utter(id, opts)` is the ergonomic shortcut for `verb='utter'`
151
- -- equivalent to `NAC.invoke(id, {verb:'utter', text, lang, voice})`.
152
-
153
- Manifest entries for payload-bearing actions can declare an
154
- informational `payload_schema`:
155
-
156
- ```js
157
- { id: 'atlas_pro_ad.mic', role: 'action',
158
- actions: [
159
- { verb: 'listen' },
160
- { verb: 'utter',
161
- payload_schema: {
162
- text: { type: 'string', required: true, max: 4000 },
163
- lang: { type: 'string', enum: ['en','es','pt','fr','it','de','ja','zh','hi','ar'] }
164
- }
165
- }
166
- ]
167
- }
168
- ```
169
-
170
- Click-style verbs (`NAC.click`, `NAC.click_by_verb`) continue to
171
- work unchanged. The new contract is purely additive; no demo
172
- behaviour regresses.
173
-
174
- #### First adopter
175
-
176
- Atlas Pro (`https://yujin.app/nac-spec/ads-demo/atlas-pro/`)
177
- declares both `listen` (click-only, existing) and `utter`
178
- (payload-bearing) on its `atlas_pro_ad.mic` action. The same
179
- `/ad-orchestrator/parse` + `/ad-orchestrator/tts` loop drives
180
- either path -- agents with their own STT call `listen`, agents
181
- with their own LM call `utter` with the recognised text.
182
-
183
- #### Test coverage
184
-
185
- - `test/v23-invoke.mjs` (new) -- 22 assertions covering happy
186
- path, ack echo, host-failed path, invalid args, not-found,
187
- custom timeout. PASS.
188
- - `test/v22.mjs` -- amended to accept v2.3.x in addition to
189
- v2.2.x. PASS.
190
- - `test/smoke.mjs` -- updated version assertions. PASS.
191
-
192
- #### Files touched
193
-
194
- - `yujin.app/nac-spec/js/nac.js` -- `invoke()` + `utter()` (~150
195
- LOC additive). Public API surface +2 functions. NAC.version
196
- bumped to '2.3.0-alpha.1', spec_version to '2.3'.
197
- - `yujin.app/nac-spec/SPEC.md` -- new section 5.1.4 + header
198
- version line.
199
- - `yujin.app/nac-spec/ads-demo/atlas-pro/index.html` -- manifest
200
- declares the `utter` verb + DOM listener routes into the demo's
201
- existing `handleUtterance(text)`.
202
- - `packages/nac/package.json`, `build.mjs`, `test/smoke.mjs` --
203
- version bumps + new test in `npm test`.
204
-
205
- #### Not yet wired
206
-
207
- - `STRICT_VALIDATION` enforcement of `payload_schema` (alpha:
208
- schema is informational).
209
- - A `NAC.search` / `NAC.upload` / `NAC.send_message` ergonomic
210
- shortcut sibling to `NAC.utter`. The generic `NAC.invoke` works
211
- today; concrete shortcuts can be added without re-spec.
3
+ ## 2.3.0 -- 2026-05-20
4
+
5
+ ### Added
6
+
7
+ - **`NAC.syncPlugin(spec)`** -- idempotent plugin registration.
8
+ Replaces the manifest for a plugin instead of appending, fixing the
9
+ stale-snapshot class of bugs where repeated `register()` calls on
10
+ dynamic re-renders accumulated duplicate manifest entries. Counterpart
11
+ to the existing `syncDataTable`. Recommended path for SPA hosts.
12
+ - **`data-nac-plugin-id`** -- explicit plugin instance identifier for
13
+ pages with multiple roots sharing a plugin slug. When a slug appears
14
+ more than once in the DOM, every root MUST carry a unique
15
+ `data-nac-plugin-id`. `validate_global` flags violations.
16
+
17
+ ### Fixed
18
+
19
+ - Manifest accumulation on repeated `register()` calls. `syncPlugin` is
20
+ the recommended migration path for hosts that re-render.
21
+ - `validate_global` now flags duplicate plugin manifest entries.
22
+
23
+ ### Benchmark
24
+
25
+ This release ships the runtime that was validated across **600 runs**
26
+ (5 models x 3 protocols x 4 tasks x 10 iterations) published at
27
+ <https://github.com/yujinapp/nac-spec/tree/main/benchmark/>. Highlights:
28
+
29
+ - **95.5% success rate** under NAC3 (191 / 200 runs).
30
+ - **Zero phantom-selector silent damage** in NAC3 (0 / 200) vs
31
+ **15%** in Raw DOM (30 / 200).
32
+ - **1.0 round-trip per task** in NAC3 vs 3.5 in MCP.
33
+ - Cheap models (Gemini Flash Lite, GPT-4o-mini) reached
34
+ **100% success** under NAC3 -- matching frontier models in Raw DOM.
35
+
36
+ Full reproducibility: every JSONL row carries `runtime_version`,
37
+ `bench_version`, `manifest_checksum`. Bundle downloadable from the
38
+ benchmark page. Cost to re-run: ~US$15.
39
+
40
+ ### Experimental (not yet GA)
41
+
42
+ The runtime contains code merged for the V24-04 RFC (snapshot
43
+ versioning + optimistic concurrency control). This release ships it as
44
+ **implementation present, enforcement opt-in**:
45
+
46
+ - `plugin_version` and `element_state_hash` are present in
47
+ `NAC.describe()` output by default. Shape is stable; semantics may
48
+ tighten in v2.4.
49
+ - `expected_plugin_version` and `expected_tree_version` parameters on
50
+ dispatch are accepted, but enforcement (throwing `snapshot_stale`)
51
+ is gated behind `NAC.STRICT_VERSIONING = true`. Default is `false`.
52
+ - `markHydrationComplete()` is exported and active. SSR hosts may call
53
+ it; SPA hosts get a 100ms auto-fallback.
54
+
55
+ The 2.3 benchmark ran with `STRICT_VERSIONING=false` and did not
56
+ exercise the OCC enforcement. V24-04 will move from "experimental
57
+ opt-in" to "SHIPPED" in v2.4, validated by a dedicated concurrency
58
+ benchmark. See `/rfcs/README.md` for status.
59
+
60
+ V24-05 (agent authority + interposition: `confirm_action`,
61
+ `request_authority`) is RFC draft only -- not in this runtime.
62
+
63
+ ### Spec changes
64
+
65
+ - `SPEC.md` header bumped to v2.3.
66
+ - New `/rfcs/` directory separates spec-shipped features from open
67
+ proposals. Index in `/rfcs/README.md` documents status per RFC.
68
+ - `docs/BENCHMARK_PROVENANCE.md` ties dataset (which reads
69
+ `runtime_version=2.2.1` per JSONL field) to the npm release
70
+ (`2.3.0`) via the shared commit hash.
212
71
 
213
72
  ## 2.2.1 -- 2026-05-12
214
73