@nac3/runtime 2.5.0-alpha.1 → 2.5.0-alpha.3
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 +171 -0
- package/SPEC.md +2 -2
- package/dist/nac.browser.js +737 -38
- package/dist/nac.cjs +737 -38
- package/dist/nac.mjs +737 -38
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,176 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.5.0-alpha.3 -- 2026-05-23
|
|
4
|
+
|
|
5
|
+
NAC3 v2.5.0-alpha.3 wires the V24-04 OCC dispatch hooks into the
|
|
6
|
+
mutating verbs. The contract now has teeth: an agent that passes
|
|
7
|
+
mismatched `expected_*` parameters gets `NacError('snapshot_stale',
|
|
8
|
+
...)` synchronously, BEFORE any side effect occurs. No partial
|
|
9
|
+
mutations on stale state. No silent damage.
|
|
10
|
+
|
|
11
|
+
### Added (V24-04 -- dispatch enforcement)
|
|
12
|
+
|
|
13
|
+
Every mutating verb that accepts `opts` now calls
|
|
14
|
+
`_resolveVersionExpectations(opts, el)` after the element lookup +
|
|
15
|
+
disabled / hidden / aria preflight checks, and BEFORE the side
|
|
16
|
+
effect:
|
|
17
|
+
|
|
18
|
+
- **`click(nac_id, opts?)`** -- after the v2.3 capability gate +
|
|
19
|
+
v1.8 hidden gate + v1.9 aria preflight, before `el.click()`.
|
|
20
|
+
- **`fill(nac_id, value, opts?)`** -- after the fillability preflight,
|
|
21
|
+
before native-setter `el.value = ...`.
|
|
22
|
+
- **`select(nac_id, option, opts?)`** -- after `_findElement`, before
|
|
23
|
+
the select-option write.
|
|
24
|
+
- **`invoke(action_id, payload, opts?)`** -- after `_findElement`,
|
|
25
|
+
before the `nac:action:requested` dispatch.
|
|
26
|
+
|
|
27
|
+
Verbs that inherit click/tab transitively are covered automatically:
|
|
28
|
+
|
|
29
|
+
- **`click_by_verb(plugin, verb, opts?)`** -- resolves to a `nac_id`
|
|
30
|
+
then dispatches `click(id, opts)`. The OCC gate runs inside the
|
|
31
|
+
nested click. Caller passes `expected_*` in opts and they flow
|
|
32
|
+
through.
|
|
33
|
+
- **`tab_by_label(plugin, label, opts?)`** -- similarly delegates to
|
|
34
|
+
`tab(...)`. But because `tab` itself does not yet accept `opts`
|
|
35
|
+
(signature change pending alpha.4), `expected_*` passed to
|
|
36
|
+
`tab_by_label` is currently dropped. This will close in alpha.4.
|
|
37
|
+
|
|
38
|
+
### Pending for 2.5.0-alpha.4
|
|
39
|
+
|
|
40
|
+
- `tab(plugin, tab_key, opts?)` accepts opts + threads OCC gate.
|
|
41
|
+
- `NAC.STRICT_VERSIONING` default flips from `false` to `true` once
|
|
42
|
+
tab is covered (so all mutating verbs uniformly require
|
|
43
|
+
`expected_*` under strict mode).
|
|
44
|
+
- E2E demo `example-v25-snapshot-versioning.php` for the landing.
|
|
45
|
+
|
|
46
|
+
### Conditional-await pattern
|
|
47
|
+
|
|
48
|
+
To avoid introducing a microtask boundary that would reorder
|
|
49
|
+
side-effect-then-immediate-check call patterns (which several
|
|
50
|
+
v23-editor tests rely on with synchronous `NAC.click_by_verb()`
|
|
51
|
+
followed by an immediate DOM check), the OCC hook is conditional:
|
|
52
|
+
|
|
53
|
+
- When opts has any `expected_*` key OR `NAC.STRICT_VERSIONING` is
|
|
54
|
+
true: `await _resolveVersionExpectations(...)`. May throw
|
|
55
|
+
`snapshot_stale` / `version_required` / `feature_not_supported`.
|
|
56
|
+
- Otherwise: no await, no microtask. Existing behaviour preserved.
|
|
57
|
+
|
|
58
|
+
This keeps backward compatibility intact for code that never opted
|
|
59
|
+
into OCC, while making `expected_*`-aware callers see the contract.
|
|
60
|
+
|
|
61
|
+
### Tests
|
|
62
|
+
|
|
63
|
+
stage12-snapshot-versioning.mjs gains 7 new assertions for the
|
|
64
|
+
dispatch enforcement: stale plugin_version + stale tree_version
|
|
65
|
+
both raise `snapshot_stale` with structured `reason` + `slug` +
|
|
66
|
+
expected/current pairs; current plugin_version passes the gate and
|
|
67
|
+
proceeds (then hits the timeout, NOT snapshot_stale); STRICT mode
|
|
68
|
+
without expected_* throws `version_required`.
|
|
69
|
+
|
|
70
|
+
Total suite: **384 PASS / 0 FAIL** across 14 stage suites.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 2.5.0-alpha.2 -- 2026-05-23
|
|
75
|
+
|
|
76
|
+
NAC3 v2.5.0-alpha.2 lands the V24-04 OCC foundation that was
|
|
77
|
+
deferred from alpha.1. This is an additive release on top of
|
|
78
|
+
alpha.1 -- everything that worked in alpha.1 still works.
|
|
79
|
+
|
|
80
|
+
### Added (V24-04 -- foundation SHIPPED)
|
|
81
|
+
|
|
82
|
+
The snapshot versioning + optimistic concurrency framework from
|
|
83
|
+
RFC V24-04 lands as a foundation layer:
|
|
84
|
+
|
|
85
|
+
- `_tree_version` + `_plugin_versions` Map -- per-(slug, instance_id)
|
|
86
|
+
monotonic version counters. Bumped on every structural mutation
|
|
87
|
+
observed by the runtime MutationObserver + on every syncPlugin
|
|
88
|
+
call.
|
|
89
|
+
- `_resolvePluginScope(el)` walks ancestor [data-nac-plugin] roots
|
|
90
|
+
with WeakMap caching to avoid O(depth) walks on every mutation.
|
|
91
|
+
- `_bumpPluginVersion(slug, instance_id, trigger)` + `_bumpTreeVersion`
|
|
92
|
+
atomic helpers: increment counter, push to `_version_history`
|
|
93
|
+
(capped at 500), dispatch `nac:plugin:invalidated` +
|
|
94
|
+
`nac:tree:invalidated` events.
|
|
95
|
+
- Single document-rooted MutationObserver that filters mutations to
|
|
96
|
+
data-nac-* attribute changes + addNodes/removeNodes that contain
|
|
97
|
+
data-nac-* descendants. Pure value/text changes do NOT bump.
|
|
98
|
+
- `element_state_hash` (128-bit SHA-256 truncated) over a canonical
|
|
99
|
+
5-key state (visible, disabled, value, text, custom). Sync impl
|
|
100
|
+
+ async crypto.subtle path when available. Byte-identical digests
|
|
101
|
+
across paths.
|
|
102
|
+
- `markHydrationComplete()` + 100ms fallback for SSR-then-hydrate
|
|
103
|
+
scenarios. Tagged trigger='hydration_complete' on the resulting
|
|
104
|
+
bump events.
|
|
105
|
+
- `versionHistory(limit?)` devtools surface -- last N bumps, most
|
|
106
|
+
recent first.
|
|
107
|
+
|
|
108
|
+
### Added (V24-04 -- describe() additions)
|
|
109
|
+
|
|
110
|
+
- `describe()` output now carries `tree_version` at the root +
|
|
111
|
+
`plugin_version` + `plugin_instance_id` per plugin entry +
|
|
112
|
+
`element_state_hash` per element entry. All three are read-only
|
|
113
|
+
observers; consuming them is opt-in.
|
|
114
|
+
|
|
115
|
+
### Added (V24-04 -- NAC.* surface)
|
|
116
|
+
|
|
117
|
+
- `NAC.STRICT_VERSIONING` (default **false** in alpha.2; will flip to
|
|
118
|
+
true in alpha.3 after one soak window). When true,
|
|
119
|
+
every mutating API call without `expected_*` parameters throws
|
|
120
|
+
`NacError('version_required', ...)`.
|
|
121
|
+
- `NAC.eager_hashing` (default false) -- placeholder flag for future
|
|
122
|
+
cache-the-hash-on-mutate optimization.
|
|
123
|
+
- `NAC.conformance_tier` (default `'NAC-3-versioned'`). Runtimes that
|
|
124
|
+
declare the legacy `'NAC-3'` tier explicitly reject `expected_*`
|
|
125
|
+
parameters with `NacError('feature_not_supported', ...)`.
|
|
126
|
+
- `NAC.markHydrationComplete()` -- explicit hydration ack.
|
|
127
|
+
- `NAC.versionHistory(limit?)` -- devtools.
|
|
128
|
+
|
|
129
|
+
### V24-02 syncPlugin consolidation
|
|
130
|
+
|
|
131
|
+
syncPlugin's version stamp now uses the V24-04 `_bumpPluginVersion`
|
|
132
|
+
machinery instead of the alpha.1 per-call timestamp string. The
|
|
133
|
+
return shape (`{replaced, slug, version}`) is unchanged, but the
|
|
134
|
+
`version` value is now `v_<N>` instead of `v_<base36-ts>_<seq>`.
|
|
135
|
+
Tests pass either format (just check the `v_` prefix and that
|
|
136
|
+
versions differ across calls).
|
|
137
|
+
|
|
138
|
+
### Pending for 2.5.0-alpha.3
|
|
139
|
+
|
|
140
|
+
- **Dispatch enforcement hooks.** `click` / `click_by_verb` / `tab` /
|
|
141
|
+
`tab_by_label` / `fill` / `select` / `invoke` accept
|
|
142
|
+
`expected_plugin_version` / `expected_tree_version` /
|
|
143
|
+
`expected_element_state_hash` parameters and reject with
|
|
144
|
+
`NacError('snapshot_stale', ...)` on mismatch via
|
|
145
|
+
`_resolveVersionExpectations()` (the helper is already in this
|
|
146
|
+
release; the hooks are not yet wired into the dispatch verbs).
|
|
147
|
+
- **`STRICT_VERSIONING` default flip** from false to true. Gated on
|
|
148
|
+
the dispatch hooks landing.
|
|
149
|
+
- **V25-02/03/04 drafts** -- tree navigation, asistive labels,
|
|
150
|
+
effect detection. Target subsequent 2.5.x patches.
|
|
151
|
+
|
|
152
|
+
### Tests
|
|
153
|
+
|
|
154
|
+
`runtime/test/` adds stage12-snapshot-versioning.mjs (23 PASS):
|
|
155
|
+
API surface, describe() additions, syncPlugin bump events, version
|
|
156
|
+
history, markHydrationComplete idempotency, hydration trigger
|
|
157
|
+
tagging.
|
|
158
|
+
|
|
159
|
+
Suite total: **377 PASS / 0 FAIL** across 14 stage suites.
|
|
160
|
+
|
|
161
|
+
### Migration notes
|
|
162
|
+
|
|
163
|
+
- Code consuming `describe()` output that did NOT expect
|
|
164
|
+
`tree_version` / `plugin_version` / `element_state_hash` keys is
|
|
165
|
+
unaffected: those keys are additive. Code that explicitly checked
|
|
166
|
+
describe().plugins[i] for an enumerated key set might fail; the
|
|
167
|
+
fix is to ignore unknown keys (forward-compatible default).
|
|
168
|
+
- syncPlugin's `result.version` value format changed (see V24-02
|
|
169
|
+
section above). Tests that asserted the exact alpha.1 format
|
|
170
|
+
string would need to relax to a prefix-only check.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
3
174
|
## 2.5.0-alpha.1 -- 2026-05-23
|
|
4
175
|
|
|
5
176
|
NAC3 v2.5.0-alpha.1 is a **consolidation release**. Two parallel
|
package/SPEC.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# NAC3 -- Native Agent Contract
|
|
2
2
|
|
|
3
|
-
**Version:** 2.5.0-alpha.
|
|
4
|
-
**Status:** v2.5.0-alpha.
|
|
3
|
+
**Version:** 2.5.0-alpha.3 (alpha.2 + V24-04 OCC dispatch hooks on click/fill/select/invoke -- snapshot_stale rejects pre-side-effect)
|
|
4
|
+
**Status:** v2.5.0-alpha.3 alpha -- V24-04 contract teeth real: every mutating verb that accepts opts rejects stale snapshots with NacError('snapshot_stale')
|
|
5
5
|
**License:** Apache-2.0
|
|
6
6
|
**Editor:** Yujin (yujin.app)
|
|
7
7
|
|