@nac3/runtime 2.5.0-alpha.2 → 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 +71 -0
- package/SPEC.md +2 -2
- package/dist/nac.browser.js +44 -1
- package/dist/nac.cjs +44 -1
- package/dist/nac.mjs +44 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
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
|
+
|
|
3
74
|
## 2.5.0-alpha.2 -- 2026-05-23
|
|
4
75
|
|
|
5
76
|
NAC3 v2.5.0-alpha.2 lands the V24-04 OCC foundation that was
|
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
|
|
package/dist/nac.browser.js
CHANGED
|
@@ -3229,6 +3229,19 @@
|
|
|
3229
3229
|
});
|
|
3230
3230
|
throw NacError(ariaPF.reason, ariaPF.message);
|
|
3231
3231
|
}
|
|
3232
|
+
/* v2.5 / RFC V24-04 OCC gate. Only await when opts actually
|
|
3233
|
+
carries expected_* OR STRICT_VERSIONING demands it; otherwise
|
|
3234
|
+
skip to avoid introducing a microtask boundary that would
|
|
3235
|
+
reorder side-effect-then-immediate-check call patterns. */
|
|
3236
|
+
{
|
|
3237
|
+
const _o = opts || {};
|
|
3238
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3239
|
+
|| ('expected_tree_version' in _o)
|
|
3240
|
+
|| ('expected_element_state_hash' in _o);
|
|
3241
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3242
|
+
await _resolveVersionExpectations(opts, el);
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3232
3245
|
const role = el.getAttribute('data-nac-role') || 'action';
|
|
3233
3246
|
const family = _CLICK_EVENT_FAMILY[role] || _CLICK_EVENT_FAMILY['action'];
|
|
3234
3247
|
/* The first event in each family is the "success" signal; if a
|
|
@@ -3462,6 +3475,16 @@
|
|
|
3462
3475
|
});
|
|
3463
3476
|
throw NacError(fillPF.reason, fillPF.message);
|
|
3464
3477
|
}
|
|
3478
|
+
/* v2.5 / RFC V24-04 OCC gate. Same conditional pattern as click. */
|
|
3479
|
+
{
|
|
3480
|
+
const _o = opts || {};
|
|
3481
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3482
|
+
|| ('expected_tree_version' in _o)
|
|
3483
|
+
|| ('expected_element_state_hash' in _o);
|
|
3484
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3485
|
+
await _resolveVersionExpectations(opts, el);
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3465
3488
|
_focusElement(el);
|
|
3466
3489
|
const ft = el.getAttribute('data-nac-field-type');
|
|
3467
3490
|
|
|
@@ -3522,6 +3545,16 @@
|
|
|
3522
3545
|
async function select(nac_id, option, opts) {
|
|
3523
3546
|
const el = _findElement(nac_id, opts);
|
|
3524
3547
|
if (!el) throw NacError('not_found', 'No select with nac_id=' + nac_id);
|
|
3548
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3549
|
+
{
|
|
3550
|
+
const _o = opts || {};
|
|
3551
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3552
|
+
|| ('expected_tree_version' in _o)
|
|
3553
|
+
|| ('expected_element_state_hash' in _o);
|
|
3554
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3555
|
+
await _resolveVersionExpectations(opts, el);
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3525
3558
|
_focusElement(el);
|
|
3526
3559
|
if (el.tagName === 'SELECT') {
|
|
3527
3560
|
if (el.multiple && Array.isArray(option)) {
|
|
@@ -3836,6 +3869,16 @@
|
|
|
3836
3869
|
an invoke based on UI state should do it in their
|
|
3837
3870
|
nac:action:requested listener and emit nac:action:failed
|
|
3838
3871
|
with a meaningful error code. */
|
|
3872
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3873
|
+
{
|
|
3874
|
+
const _o = opts || {};
|
|
3875
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3876
|
+
|| ('expected_tree_version' in _o)
|
|
3877
|
+
|| ('expected_element_state_hash' in _o);
|
|
3878
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3879
|
+
await _resolveVersionExpectations(opts, el);
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3839
3882
|
const verb = (payload && payload.verb)
|
|
3840
3883
|
|| el.getAttribute('data-nac-action')
|
|
3841
3884
|
|| '';
|
|
@@ -7515,7 +7558,7 @@
|
|
|
7515
7558
|
|
|
7516
7559
|
global.NAC = {
|
|
7517
7560
|
__nac_v1_installed: true,
|
|
7518
|
-
version: '2.5.0-alpha.
|
|
7561
|
+
version: '2.5.0-alpha.3',
|
|
7519
7562
|
spec_version: '2.5',
|
|
7520
7563
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7521
7564
|
NAC.register throws on findings (manifest_role_unknown,
|
package/dist/nac.cjs
CHANGED
|
@@ -3230,6 +3230,19 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3230
3230
|
});
|
|
3231
3231
|
throw NacError(ariaPF.reason, ariaPF.message);
|
|
3232
3232
|
}
|
|
3233
|
+
/* v2.5 / RFC V24-04 OCC gate. Only await when opts actually
|
|
3234
|
+
carries expected_* OR STRICT_VERSIONING demands it; otherwise
|
|
3235
|
+
skip to avoid introducing a microtask boundary that would
|
|
3236
|
+
reorder side-effect-then-immediate-check call patterns. */
|
|
3237
|
+
{
|
|
3238
|
+
const _o = opts || {};
|
|
3239
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3240
|
+
|| ('expected_tree_version' in _o)
|
|
3241
|
+
|| ('expected_element_state_hash' in _o);
|
|
3242
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3243
|
+
await _resolveVersionExpectations(opts, el);
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3233
3246
|
const role = el.getAttribute('data-nac-role') || 'action';
|
|
3234
3247
|
const family = _CLICK_EVENT_FAMILY[role] || _CLICK_EVENT_FAMILY['action'];
|
|
3235
3248
|
/* The first event in each family is the "success" signal; if a
|
|
@@ -3463,6 +3476,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3463
3476
|
});
|
|
3464
3477
|
throw NacError(fillPF.reason, fillPF.message);
|
|
3465
3478
|
}
|
|
3479
|
+
/* v2.5 / RFC V24-04 OCC gate. Same conditional pattern as click. */
|
|
3480
|
+
{
|
|
3481
|
+
const _o = opts || {};
|
|
3482
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3483
|
+
|| ('expected_tree_version' in _o)
|
|
3484
|
+
|| ('expected_element_state_hash' in _o);
|
|
3485
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3486
|
+
await _resolveVersionExpectations(opts, el);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3466
3489
|
_focusElement(el);
|
|
3467
3490
|
const ft = el.getAttribute('data-nac-field-type');
|
|
3468
3491
|
|
|
@@ -3523,6 +3546,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3523
3546
|
async function select(nac_id, option, opts) {
|
|
3524
3547
|
const el = _findElement(nac_id, opts);
|
|
3525
3548
|
if (!el) throw NacError('not_found', 'No select with nac_id=' + nac_id);
|
|
3549
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3550
|
+
{
|
|
3551
|
+
const _o = opts || {};
|
|
3552
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3553
|
+
|| ('expected_tree_version' in _o)
|
|
3554
|
+
|| ('expected_element_state_hash' in _o);
|
|
3555
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3556
|
+
await _resolveVersionExpectations(opts, el);
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3526
3559
|
_focusElement(el);
|
|
3527
3560
|
if (el.tagName === 'SELECT') {
|
|
3528
3561
|
if (el.multiple && Array.isArray(option)) {
|
|
@@ -3837,6 +3870,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3837
3870
|
an invoke based on UI state should do it in their
|
|
3838
3871
|
nac:action:requested listener and emit nac:action:failed
|
|
3839
3872
|
with a meaningful error code. */
|
|
3873
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3874
|
+
{
|
|
3875
|
+
const _o = opts || {};
|
|
3876
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3877
|
+
|| ('expected_tree_version' in _o)
|
|
3878
|
+
|| ('expected_element_state_hash' in _o);
|
|
3879
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3880
|
+
await _resolveVersionExpectations(opts, el);
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3840
3883
|
const verb = (payload && payload.verb)
|
|
3841
3884
|
|| el.getAttribute('data-nac-action')
|
|
3842
3885
|
|| '';
|
|
@@ -7516,7 +7559,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7516
7559
|
|
|
7517
7560
|
global.NAC = {
|
|
7518
7561
|
__nac_v1_installed: true,
|
|
7519
|
-
version: '2.5.0-alpha.
|
|
7562
|
+
version: '2.5.0-alpha.3',
|
|
7520
7563
|
spec_version: '2.5',
|
|
7521
7564
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7522
7565
|
NAC.register throws on findings (manifest_role_unknown,
|
package/dist/nac.mjs
CHANGED
|
@@ -3230,6 +3230,19 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3230
3230
|
});
|
|
3231
3231
|
throw NacError(ariaPF.reason, ariaPF.message);
|
|
3232
3232
|
}
|
|
3233
|
+
/* v2.5 / RFC V24-04 OCC gate. Only await when opts actually
|
|
3234
|
+
carries expected_* OR STRICT_VERSIONING demands it; otherwise
|
|
3235
|
+
skip to avoid introducing a microtask boundary that would
|
|
3236
|
+
reorder side-effect-then-immediate-check call patterns. */
|
|
3237
|
+
{
|
|
3238
|
+
const _o = opts || {};
|
|
3239
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3240
|
+
|| ('expected_tree_version' in _o)
|
|
3241
|
+
|| ('expected_element_state_hash' in _o);
|
|
3242
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3243
|
+
await _resolveVersionExpectations(opts, el);
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3233
3246
|
const role = el.getAttribute('data-nac-role') || 'action';
|
|
3234
3247
|
const family = _CLICK_EVENT_FAMILY[role] || _CLICK_EVENT_FAMILY['action'];
|
|
3235
3248
|
/* The first event in each family is the "success" signal; if a
|
|
@@ -3463,6 +3476,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3463
3476
|
});
|
|
3464
3477
|
throw NacError(fillPF.reason, fillPF.message);
|
|
3465
3478
|
}
|
|
3479
|
+
/* v2.5 / RFC V24-04 OCC gate. Same conditional pattern as click. */
|
|
3480
|
+
{
|
|
3481
|
+
const _o = opts || {};
|
|
3482
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3483
|
+
|| ('expected_tree_version' in _o)
|
|
3484
|
+
|| ('expected_element_state_hash' in _o);
|
|
3485
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3486
|
+
await _resolveVersionExpectations(opts, el);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3466
3489
|
_focusElement(el);
|
|
3467
3490
|
const ft = el.getAttribute('data-nac-field-type');
|
|
3468
3491
|
|
|
@@ -3523,6 +3546,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3523
3546
|
async function select(nac_id, option, opts) {
|
|
3524
3547
|
const el = _findElement(nac_id, opts);
|
|
3525
3548
|
if (!el) throw NacError('not_found', 'No select with nac_id=' + nac_id);
|
|
3549
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3550
|
+
{
|
|
3551
|
+
const _o = opts || {};
|
|
3552
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3553
|
+
|| ('expected_tree_version' in _o)
|
|
3554
|
+
|| ('expected_element_state_hash' in _o);
|
|
3555
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3556
|
+
await _resolveVersionExpectations(opts, el);
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3526
3559
|
_focusElement(el);
|
|
3527
3560
|
if (el.tagName === 'SELECT') {
|
|
3528
3561
|
if (el.multiple && Array.isArray(option)) {
|
|
@@ -3837,6 +3870,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3837
3870
|
an invoke based on UI state should do it in their
|
|
3838
3871
|
nac:action:requested listener and emit nac:action:failed
|
|
3839
3872
|
with a meaningful error code. */
|
|
3873
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3874
|
+
{
|
|
3875
|
+
const _o = opts || {};
|
|
3876
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3877
|
+
|| ('expected_tree_version' in _o)
|
|
3878
|
+
|| ('expected_element_state_hash' in _o);
|
|
3879
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3880
|
+
await _resolveVersionExpectations(opts, el);
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3840
3883
|
const verb = (payload && payload.verb)
|
|
3841
3884
|
|| el.getAttribute('data-nac-action')
|
|
3842
3885
|
|| '';
|
|
@@ -7516,7 +7559,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7516
7559
|
|
|
7517
7560
|
global.NAC = {
|
|
7518
7561
|
__nac_v1_installed: true,
|
|
7519
|
-
version: '2.5.0-alpha.
|
|
7562
|
+
version: '2.5.0-alpha.3',
|
|
7520
7563
|
spec_version: '2.5',
|
|
7521
7564
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7522
7565
|
NAC.register throws on findings (manifest_role_unknown,
|
package/package.json
CHANGED