@nac3/runtime 2.5.0-alpha.2 → 2.5.0-alpha.4
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 +144 -0
- package/README.md +3 -3
- package/SPEC.md +2 -2
- package/dist/nac.browser.js +88 -7
- package/dist/nac.cjs +88 -7
- package/dist/nac.mjs +88 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,149 @@
|
|
|
1
1
|
# Changelog
|
|
2
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
|
+
|
|
3
147
|
## 2.5.0-alpha.2 -- 2026-05-23
|
|
4
148
|
|
|
5
149
|
NAC3 v2.5.0-alpha.2 lands the V24-04 OCC foundation that was
|
package/README.md
CHANGED
|
@@ -137,9 +137,9 @@ Apache-2.0. See `LICENSE`.
|
|
|
137
137
|
|
|
138
138
|
## Repository
|
|
139
139
|
|
|
140
|
-
[github.com/
|
|
141
|
-
(directory: `
|
|
140
|
+
[github.com/yujinapp/nac-spec](https://github.com/yujinapp/nac-spec)
|
|
141
|
+
(directory: `runtime/`)
|
|
142
142
|
|
|
143
143
|
## Author
|
|
144
144
|
|
|
145
|
-
[Yujin](https://
|
|
145
|
+
[Yujin](https://yujin.app)
|
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.4 (alpha.3 + tab(opts) + STRICT_VERSIONING default flipped to true -- V24-04 contract fully covered across every mutating verb)
|
|
4
|
+
**Status:** v2.5.0-alpha.4 alpha -- V24-04 SHIPPED end-to-end. Promotion alpha->latest gated on the three-layer test bar (sec 3.1 PROJECT.md)
|
|
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)) {
|
|
@@ -3542,7 +3575,22 @@
|
|
|
3542
3575
|
throw NacError('not_found', 'option ' + option + ' not present in ' + nac_id);
|
|
3543
3576
|
}
|
|
3544
3577
|
|
|
3545
|
-
async function tab(plugin, tab_key) {
|
|
3578
|
+
async function tab(plugin, tab_key, opts) {
|
|
3579
|
+
/* v2.5.0-alpha.4: opts third arg accepts V24-04 expected_*
|
|
3580
|
+
parameters (expected_plugin_version / expected_tree_version /
|
|
3581
|
+
expected_element_state_hash). When opts has any expected_* OR
|
|
3582
|
+
STRICT_VERSIONING is on, the OCC gate runs before the tab
|
|
3583
|
+
click. Pre-alpha.4 the signature was (plugin, tab_key); the
|
|
3584
|
+
single-arg ergonomic form keeps working because opts on the
|
|
3585
|
+
single-arg path is the SECOND argument (tab_key); we detect
|
|
3586
|
+
that case and re-bind. */
|
|
3587
|
+
/* Re-binding: single-arg ergonomic form may have been called as
|
|
3588
|
+
tab(bareId) OR tab(bareId, opts). Differentiate by typeof. */
|
|
3589
|
+
if (tab_key !== undefined && typeof tab_key === 'object' && tab_key !== null
|
|
3590
|
+
&& typeof plugin === 'string' && plugin.indexOf('.') >= 0) {
|
|
3591
|
+
opts = tab_key;
|
|
3592
|
+
tab_key = undefined;
|
|
3593
|
+
}
|
|
3546
3594
|
/* H1.v5 (2026-05-20): single-arg ergonomic form. When the caller
|
|
3547
3595
|
passes only a full nac_id (e.g. "conduit.tab.feed__your_feed"),
|
|
3548
3596
|
resolve it directly against the DOM without requiring the
|
|
@@ -3613,6 +3661,16 @@
|
|
|
3613
3661
|
'" not in DOM (no exact match, no "' + bareId + '__" qualified instance)',
|
|
3614
3662
|
{ candidates: available });
|
|
3615
3663
|
}
|
|
3664
|
+
/* v2.5 V24-04 OCC gate, same conditional pattern as click. */
|
|
3665
|
+
{
|
|
3666
|
+
const _o = opts || {};
|
|
3667
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3668
|
+
|| ('expected_tree_version' in _o)
|
|
3669
|
+
|| ('expected_element_state_hash' in _o);
|
|
3670
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3671
|
+
await _resolveVersionExpectations(opts, tabEl);
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3616
3674
|
_focusElement(tabEl);
|
|
3617
3675
|
tabEl.click();
|
|
3618
3676
|
try { await wait_for('nac:tab:changed', 1500); } catch (e) { /* tolerated */ }
|
|
@@ -3624,6 +3682,16 @@
|
|
|
3624
3682
|
'[data-nac-role="tab"][data-nac-id="' + tab_key + '"]'
|
|
3625
3683
|
);
|
|
3626
3684
|
if (!tabEl) throw NacError('not_found', 'tab ' + tab_key + ' missing');
|
|
3685
|
+
/* v2.5 V24-04 OCC gate (two-arg path). */
|
|
3686
|
+
{
|
|
3687
|
+
const _o = opts || {};
|
|
3688
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3689
|
+
|| ('expected_tree_version' in _o)
|
|
3690
|
+
|| ('expected_element_state_hash' in _o);
|
|
3691
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3692
|
+
await _resolveVersionExpectations(opts, tabEl);
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3627
3695
|
_focusElement(tabEl);
|
|
3628
3696
|
tabEl.click();
|
|
3629
3697
|
try {
|
|
@@ -3836,6 +3904,16 @@
|
|
|
3836
3904
|
an invoke based on UI state should do it in their
|
|
3837
3905
|
nac:action:requested listener and emit nac:action:failed
|
|
3838
3906
|
with a meaningful error code. */
|
|
3907
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3908
|
+
{
|
|
3909
|
+
const _o = opts || {};
|
|
3910
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3911
|
+
|| ('expected_tree_version' in _o)
|
|
3912
|
+
|| ('expected_element_state_hash' in _o);
|
|
3913
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3914
|
+
await _resolveVersionExpectations(opts, el);
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3839
3917
|
const verb = (payload && payload.verb)
|
|
3840
3918
|
|| el.getAttribute('data-nac-action')
|
|
3841
3919
|
|| '';
|
|
@@ -4141,7 +4219,8 @@
|
|
|
4141
4219
|
+ targetPlugin + '"',
|
|
4142
4220
|
{ candidates: available });
|
|
4143
4221
|
}
|
|
4144
|
-
|
|
4222
|
+
/* v2.5 alpha.4: propagate opts (V24-04 expected_*) down to tab(). */
|
|
4223
|
+
return await tab(targetPlugin, matched.nac_id, opts);
|
|
4145
4224
|
}
|
|
4146
4225
|
|
|
4147
4226
|
/* ---------- Visualization mode ---------------------------------- */
|
|
@@ -7515,7 +7594,7 @@
|
|
|
7515
7594
|
|
|
7516
7595
|
global.NAC = {
|
|
7517
7596
|
__nac_v1_installed: true,
|
|
7518
|
-
version: '2.5.0-alpha.
|
|
7597
|
+
version: '2.5.0-alpha.4',
|
|
7519
7598
|
spec_version: '2.5',
|
|
7520
7599
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7521
7600
|
NAC.register throws on findings (manifest_role_unknown,
|
|
@@ -7555,10 +7634,12 @@
|
|
|
7555
7634
|
describe() output (RFC sec 5.2/5.3). expected_plugin_version
|
|
7556
7635
|
/ expected_tree_version / expected_element_state_hash on every
|
|
7557
7636
|
mutating API reject with NacError('snapshot_stale', ...) when
|
|
7558
|
-
the snapshot is stale.
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7637
|
+
the snapshot is stale. As of v2.5.0-alpha.4 every mutating
|
|
7638
|
+
verb (click/fill/select/invoke/tab/tab_by_label) honours the
|
|
7639
|
+
gate, so STRICT_VERSIONING default flips to true: callers
|
|
7640
|
+
MUST pass at least one expected_* or set STRICT_VERSIONING
|
|
7641
|
+
=false explicitly. Removed in v2.6 (becomes unconditional). */
|
|
7642
|
+
STRICT_VERSIONING: true,
|
|
7562
7643
|
eager_hashing: false,
|
|
7563
7644
|
conformance_tier: 'NAC-3-versioned',
|
|
7564
7645
|
markHydrationComplete: markHydrationComplete,
|
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)) {
|
|
@@ -3543,7 +3576,22 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3543
3576
|
throw NacError('not_found', 'option ' + option + ' not present in ' + nac_id);
|
|
3544
3577
|
}
|
|
3545
3578
|
|
|
3546
|
-
async function tab(plugin, tab_key) {
|
|
3579
|
+
async function tab(plugin, tab_key, opts) {
|
|
3580
|
+
/* v2.5.0-alpha.4: opts third arg accepts V24-04 expected_*
|
|
3581
|
+
parameters (expected_plugin_version / expected_tree_version /
|
|
3582
|
+
expected_element_state_hash). When opts has any expected_* OR
|
|
3583
|
+
STRICT_VERSIONING is on, the OCC gate runs before the tab
|
|
3584
|
+
click. Pre-alpha.4 the signature was (plugin, tab_key); the
|
|
3585
|
+
single-arg ergonomic form keeps working because opts on the
|
|
3586
|
+
single-arg path is the SECOND argument (tab_key); we detect
|
|
3587
|
+
that case and re-bind. */
|
|
3588
|
+
/* Re-binding: single-arg ergonomic form may have been called as
|
|
3589
|
+
tab(bareId) OR tab(bareId, opts). Differentiate by typeof. */
|
|
3590
|
+
if (tab_key !== undefined && typeof tab_key === 'object' && tab_key !== null
|
|
3591
|
+
&& typeof plugin === 'string' && plugin.indexOf('.') >= 0) {
|
|
3592
|
+
opts = tab_key;
|
|
3593
|
+
tab_key = undefined;
|
|
3594
|
+
}
|
|
3547
3595
|
/* H1.v5 (2026-05-20): single-arg ergonomic form. When the caller
|
|
3548
3596
|
passes only a full nac_id (e.g. "conduit.tab.feed__your_feed"),
|
|
3549
3597
|
resolve it directly against the DOM without requiring the
|
|
@@ -3614,6 +3662,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3614
3662
|
'" not in DOM (no exact match, no "' + bareId + '__" qualified instance)',
|
|
3615
3663
|
{ candidates: available });
|
|
3616
3664
|
}
|
|
3665
|
+
/* v2.5 V24-04 OCC gate, same conditional pattern as click. */
|
|
3666
|
+
{
|
|
3667
|
+
const _o = opts || {};
|
|
3668
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3669
|
+
|| ('expected_tree_version' in _o)
|
|
3670
|
+
|| ('expected_element_state_hash' in _o);
|
|
3671
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3672
|
+
await _resolveVersionExpectations(opts, tabEl);
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3617
3675
|
_focusElement(tabEl);
|
|
3618
3676
|
tabEl.click();
|
|
3619
3677
|
try { await wait_for('nac:tab:changed', 1500); } catch (e) { /* tolerated */ }
|
|
@@ -3625,6 +3683,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3625
3683
|
'[data-nac-role="tab"][data-nac-id="' + tab_key + '"]'
|
|
3626
3684
|
);
|
|
3627
3685
|
if (!tabEl) throw NacError('not_found', 'tab ' + tab_key + ' missing');
|
|
3686
|
+
/* v2.5 V24-04 OCC gate (two-arg path). */
|
|
3687
|
+
{
|
|
3688
|
+
const _o = opts || {};
|
|
3689
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3690
|
+
|| ('expected_tree_version' in _o)
|
|
3691
|
+
|| ('expected_element_state_hash' in _o);
|
|
3692
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3693
|
+
await _resolveVersionExpectations(opts, tabEl);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3628
3696
|
_focusElement(tabEl);
|
|
3629
3697
|
tabEl.click();
|
|
3630
3698
|
try {
|
|
@@ -3837,6 +3905,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3837
3905
|
an invoke based on UI state should do it in their
|
|
3838
3906
|
nac:action:requested listener and emit nac:action:failed
|
|
3839
3907
|
with a meaningful error code. */
|
|
3908
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3909
|
+
{
|
|
3910
|
+
const _o = opts || {};
|
|
3911
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3912
|
+
|| ('expected_tree_version' in _o)
|
|
3913
|
+
|| ('expected_element_state_hash' in _o);
|
|
3914
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3915
|
+
await _resolveVersionExpectations(opts, el);
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3840
3918
|
const verb = (payload && payload.verb)
|
|
3841
3919
|
|| el.getAttribute('data-nac-action')
|
|
3842
3920
|
|| '';
|
|
@@ -4142,7 +4220,8 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4142
4220
|
+ targetPlugin + '"',
|
|
4143
4221
|
{ candidates: available });
|
|
4144
4222
|
}
|
|
4145
|
-
|
|
4223
|
+
/* v2.5 alpha.4: propagate opts (V24-04 expected_*) down to tab(). */
|
|
4224
|
+
return await tab(targetPlugin, matched.nac_id, opts);
|
|
4146
4225
|
}
|
|
4147
4226
|
|
|
4148
4227
|
/* ---------- Visualization mode ---------------------------------- */
|
|
@@ -7516,7 +7595,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7516
7595
|
|
|
7517
7596
|
global.NAC = {
|
|
7518
7597
|
__nac_v1_installed: true,
|
|
7519
|
-
version: '2.5.0-alpha.
|
|
7598
|
+
version: '2.5.0-alpha.4',
|
|
7520
7599
|
spec_version: '2.5',
|
|
7521
7600
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7522
7601
|
NAC.register throws on findings (manifest_role_unknown,
|
|
@@ -7556,10 +7635,12 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7556
7635
|
describe() output (RFC sec 5.2/5.3). expected_plugin_version
|
|
7557
7636
|
/ expected_tree_version / expected_element_state_hash on every
|
|
7558
7637
|
mutating API reject with NacError('snapshot_stale', ...) when
|
|
7559
|
-
the snapshot is stale.
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7638
|
+
the snapshot is stale. As of v2.5.0-alpha.4 every mutating
|
|
7639
|
+
verb (click/fill/select/invoke/tab/tab_by_label) honours the
|
|
7640
|
+
gate, so STRICT_VERSIONING default flips to true: callers
|
|
7641
|
+
MUST pass at least one expected_* or set STRICT_VERSIONING
|
|
7642
|
+
=false explicitly. Removed in v2.6 (becomes unconditional). */
|
|
7643
|
+
STRICT_VERSIONING: true,
|
|
7563
7644
|
eager_hashing: false,
|
|
7564
7645
|
conformance_tier: 'NAC-3-versioned',
|
|
7565
7646
|
markHydrationComplete: markHydrationComplete,
|
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)) {
|
|
@@ -3543,7 +3576,22 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3543
3576
|
throw NacError('not_found', 'option ' + option + ' not present in ' + nac_id);
|
|
3544
3577
|
}
|
|
3545
3578
|
|
|
3546
|
-
async function tab(plugin, tab_key) {
|
|
3579
|
+
async function tab(plugin, tab_key, opts) {
|
|
3580
|
+
/* v2.5.0-alpha.4: opts third arg accepts V24-04 expected_*
|
|
3581
|
+
parameters (expected_plugin_version / expected_tree_version /
|
|
3582
|
+
expected_element_state_hash). When opts has any expected_* OR
|
|
3583
|
+
STRICT_VERSIONING is on, the OCC gate runs before the tab
|
|
3584
|
+
click. Pre-alpha.4 the signature was (plugin, tab_key); the
|
|
3585
|
+
single-arg ergonomic form keeps working because opts on the
|
|
3586
|
+
single-arg path is the SECOND argument (tab_key); we detect
|
|
3587
|
+
that case and re-bind. */
|
|
3588
|
+
/* Re-binding: single-arg ergonomic form may have been called as
|
|
3589
|
+
tab(bareId) OR tab(bareId, opts). Differentiate by typeof. */
|
|
3590
|
+
if (tab_key !== undefined && typeof tab_key === 'object' && tab_key !== null
|
|
3591
|
+
&& typeof plugin === 'string' && plugin.indexOf('.') >= 0) {
|
|
3592
|
+
opts = tab_key;
|
|
3593
|
+
tab_key = undefined;
|
|
3594
|
+
}
|
|
3547
3595
|
/* H1.v5 (2026-05-20): single-arg ergonomic form. When the caller
|
|
3548
3596
|
passes only a full nac_id (e.g. "conduit.tab.feed__your_feed"),
|
|
3549
3597
|
resolve it directly against the DOM without requiring the
|
|
@@ -3614,6 +3662,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3614
3662
|
'" not in DOM (no exact match, no "' + bareId + '__" qualified instance)',
|
|
3615
3663
|
{ candidates: available });
|
|
3616
3664
|
}
|
|
3665
|
+
/* v2.5 V24-04 OCC gate, same conditional pattern as click. */
|
|
3666
|
+
{
|
|
3667
|
+
const _o = opts || {};
|
|
3668
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3669
|
+
|| ('expected_tree_version' in _o)
|
|
3670
|
+
|| ('expected_element_state_hash' in _o);
|
|
3671
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3672
|
+
await _resolveVersionExpectations(opts, tabEl);
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3617
3675
|
_focusElement(tabEl);
|
|
3618
3676
|
tabEl.click();
|
|
3619
3677
|
try { await wait_for('nac:tab:changed', 1500); } catch (e) { /* tolerated */ }
|
|
@@ -3625,6 +3683,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3625
3683
|
'[data-nac-role="tab"][data-nac-id="' + tab_key + '"]'
|
|
3626
3684
|
);
|
|
3627
3685
|
if (!tabEl) throw NacError('not_found', 'tab ' + tab_key + ' missing');
|
|
3686
|
+
/* v2.5 V24-04 OCC gate (two-arg path). */
|
|
3687
|
+
{
|
|
3688
|
+
const _o = opts || {};
|
|
3689
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3690
|
+
|| ('expected_tree_version' in _o)
|
|
3691
|
+
|| ('expected_element_state_hash' in _o);
|
|
3692
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3693
|
+
await _resolveVersionExpectations(opts, tabEl);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3628
3696
|
_focusElement(tabEl);
|
|
3629
3697
|
tabEl.click();
|
|
3630
3698
|
try {
|
|
@@ -3837,6 +3905,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3837
3905
|
an invoke based on UI state should do it in their
|
|
3838
3906
|
nac:action:requested listener and emit nac:action:failed
|
|
3839
3907
|
with a meaningful error code. */
|
|
3908
|
+
/* v2.5 / RFC V24-04 OCC gate. */
|
|
3909
|
+
{
|
|
3910
|
+
const _o = opts || {};
|
|
3911
|
+
const _hasExp = ('expected_plugin_version' in _o)
|
|
3912
|
+
|| ('expected_tree_version' in _o)
|
|
3913
|
+
|| ('expected_element_state_hash' in _o);
|
|
3914
|
+
if (_hasExp || _strictVersioningOn()) {
|
|
3915
|
+
await _resolveVersionExpectations(opts, el);
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3840
3918
|
const verb = (payload && payload.verb)
|
|
3841
3919
|
|| el.getAttribute('data-nac-action')
|
|
3842
3920
|
|| '';
|
|
@@ -4142,7 +4220,8 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4142
4220
|
+ targetPlugin + '"',
|
|
4143
4221
|
{ candidates: available });
|
|
4144
4222
|
}
|
|
4145
|
-
|
|
4223
|
+
/* v2.5 alpha.4: propagate opts (V24-04 expected_*) down to tab(). */
|
|
4224
|
+
return await tab(targetPlugin, matched.nac_id, opts);
|
|
4146
4225
|
}
|
|
4147
4226
|
|
|
4148
4227
|
/* ---------- Visualization mode ---------------------------------- */
|
|
@@ -7516,7 +7595,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7516
7595
|
|
|
7517
7596
|
global.NAC = {
|
|
7518
7597
|
__nac_v1_installed: true,
|
|
7519
|
-
version: '2.5.0-alpha.
|
|
7598
|
+
version: '2.5.0-alpha.4',
|
|
7520
7599
|
spec_version: '2.5',
|
|
7521
7600
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7522
7601
|
NAC.register throws on findings (manifest_role_unknown,
|
|
@@ -7556,10 +7635,12 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7556
7635
|
describe() output (RFC sec 5.2/5.3). expected_plugin_version
|
|
7557
7636
|
/ expected_tree_version / expected_element_state_hash on every
|
|
7558
7637
|
mutating API reject with NacError('snapshot_stale', ...) when
|
|
7559
|
-
the snapshot is stale.
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7638
|
+
the snapshot is stale. As of v2.5.0-alpha.4 every mutating
|
|
7639
|
+
verb (click/fill/select/invoke/tab/tab_by_label) honours the
|
|
7640
|
+
gate, so STRICT_VERSIONING default flips to true: callers
|
|
7641
|
+
MUST pass at least one expected_* or set STRICT_VERSIONING
|
|
7642
|
+
=false explicitly. Removed in v2.6 (becomes unconditional). */
|
|
7643
|
+
STRICT_VERSIONING: true,
|
|
7563
7644
|
eager_hashing: false,
|
|
7564
7645
|
conformance_tier: 'NAC-3-versioned',
|
|
7565
7646
|
markHydrationComplete: markHydrationComplete,
|
package/package.json
CHANGED