@nac3/runtime 2.5.0-alpha.3 → 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 CHANGED
@@ -1,5 +1,78 @@
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
+
3
76
  ## 2.5.0-alpha.3 -- 2026-05-23
4
77
 
5
78
  NAC3 v2.5.0-alpha.3 wires the V24-04 OCC dispatch hooks into the
package/README.md CHANGED
@@ -137,9 +137,9 @@ Apache-2.0. See `LICENSE`.
137
137
 
138
138
  ## Repository
139
139
 
140
- [github.com/pkuschnirof/rpaforce-crm](https://github.com/pkuschnirof/rpaforce-crm)
141
- (directory: `packages/nac`)
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://rpaforce.com)
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.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')
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
 
@@ -3575,7 +3575,22 @@
3575
3575
  throw NacError('not_found', 'option ' + option + ' not present in ' + nac_id);
3576
3576
  }
3577
3577
 
3578
- 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
+ }
3579
3594
  /* H1.v5 (2026-05-20): single-arg ergonomic form. When the caller
3580
3595
  passes only a full nac_id (e.g. "conduit.tab.feed__your_feed"),
3581
3596
  resolve it directly against the DOM without requiring the
@@ -3646,6 +3661,16 @@
3646
3661
  '" not in DOM (no exact match, no "' + bareId + '__" qualified instance)',
3647
3662
  { candidates: available });
3648
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
+ }
3649
3674
  _focusElement(tabEl);
3650
3675
  tabEl.click();
3651
3676
  try { await wait_for('nac:tab:changed', 1500); } catch (e) { /* tolerated */ }
@@ -3657,6 +3682,16 @@
3657
3682
  '[data-nac-role="tab"][data-nac-id="' + tab_key + '"]'
3658
3683
  );
3659
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
+ }
3660
3695
  _focusElement(tabEl);
3661
3696
  tabEl.click();
3662
3697
  try {
@@ -4184,7 +4219,8 @@
4184
4219
  + targetPlugin + '"',
4185
4220
  { candidates: available });
4186
4221
  }
4187
- return await tab(targetPlugin, matched.nac_id);
4222
+ /* v2.5 alpha.4: propagate opts (V24-04 expected_*) down to tab(). */
4223
+ return await tab(targetPlugin, matched.nac_id, opts);
4188
4224
  }
4189
4225
 
4190
4226
  /* ---------- Visualization mode ---------------------------------- */
@@ -7558,7 +7594,7 @@
7558
7594
 
7559
7595
  global.NAC = {
7560
7596
  __nac_v1_installed: true,
7561
- version: '2.5.0-alpha.3',
7597
+ version: '2.5.0-alpha.4',
7562
7598
  spec_version: '2.5',
7563
7599
  /* v2.2.0 (V22-01) -- strict validation toggle. When true,
7564
7600
  NAC.register throws on findings (manifest_role_unknown,
@@ -7598,10 +7634,12 @@
7598
7634
  describe() output (RFC sec 5.2/5.3). expected_plugin_version
7599
7635
  / expected_tree_version / expected_element_state_hash on every
7600
7636
  mutating API reject with NacError('snapshot_stale', ...) when
7601
- the snapshot is stale. Default STRICT_VERSIONING=false in
7602
- 2.5.0-alpha.2 so adopters opt in; flips to true in alpha.3
7603
- once the dispatch hooks finish their soak window. */
7604
- STRICT_VERSIONING: false,
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,
7605
7643
  eager_hashing: false,
7606
7644
  conformance_tier: 'NAC-3-versioned',
7607
7645
  markHydrationComplete: markHydrationComplete,
package/dist/nac.cjs CHANGED
@@ -3576,7 +3576,22 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
3576
3576
  throw NacError('not_found', 'option ' + option + ' not present in ' + nac_id);
3577
3577
  }
3578
3578
 
3579
- 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
+ }
3580
3595
  /* H1.v5 (2026-05-20): single-arg ergonomic form. When the caller
3581
3596
  passes only a full nac_id (e.g. "conduit.tab.feed__your_feed"),
3582
3597
  resolve it directly against the DOM without requiring the
@@ -3647,6 +3662,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
3647
3662
  '" not in DOM (no exact match, no "' + bareId + '__" qualified instance)',
3648
3663
  { candidates: available });
3649
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
+ }
3650
3675
  _focusElement(tabEl);
3651
3676
  tabEl.click();
3652
3677
  try { await wait_for('nac:tab:changed', 1500); } catch (e) { /* tolerated */ }
@@ -3658,6 +3683,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
3658
3683
  '[data-nac-role="tab"][data-nac-id="' + tab_key + '"]'
3659
3684
  );
3660
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
+ }
3661
3696
  _focusElement(tabEl);
3662
3697
  tabEl.click();
3663
3698
  try {
@@ -4185,7 +4220,8 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
4185
4220
  + targetPlugin + '"',
4186
4221
  { candidates: available });
4187
4222
  }
4188
- return await tab(targetPlugin, matched.nac_id);
4223
+ /* v2.5 alpha.4: propagate opts (V24-04 expected_*) down to tab(). */
4224
+ return await tab(targetPlugin, matched.nac_id, opts);
4189
4225
  }
4190
4226
 
4191
4227
  /* ---------- Visualization mode ---------------------------------- */
@@ -7559,7 +7595,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
7559
7595
 
7560
7596
  global.NAC = {
7561
7597
  __nac_v1_installed: true,
7562
- version: '2.5.0-alpha.3',
7598
+ version: '2.5.0-alpha.4',
7563
7599
  spec_version: '2.5',
7564
7600
  /* v2.2.0 (V22-01) -- strict validation toggle. When true,
7565
7601
  NAC.register throws on findings (manifest_role_unknown,
@@ -7599,10 +7635,12 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
7599
7635
  describe() output (RFC sec 5.2/5.3). expected_plugin_version
7600
7636
  / expected_tree_version / expected_element_state_hash on every
7601
7637
  mutating API reject with NacError('snapshot_stale', ...) when
7602
- the snapshot is stale. Default STRICT_VERSIONING=false in
7603
- 2.5.0-alpha.2 so adopters opt in; flips to true in alpha.3
7604
- once the dispatch hooks finish their soak window. */
7605
- STRICT_VERSIONING: false,
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,
7606
7644
  eager_hashing: false,
7607
7645
  conformance_tier: 'NAC-3-versioned',
7608
7646
  markHydrationComplete: markHydrationComplete,
package/dist/nac.mjs CHANGED
@@ -3576,7 +3576,22 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
3576
3576
  throw NacError('not_found', 'option ' + option + ' not present in ' + nac_id);
3577
3577
  }
3578
3578
 
3579
- 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
+ }
3580
3595
  /* H1.v5 (2026-05-20): single-arg ergonomic form. When the caller
3581
3596
  passes only a full nac_id (e.g. "conduit.tab.feed__your_feed"),
3582
3597
  resolve it directly against the DOM without requiring the
@@ -3647,6 +3662,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
3647
3662
  '" not in DOM (no exact match, no "' + bareId + '__" qualified instance)',
3648
3663
  { candidates: available });
3649
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
+ }
3650
3675
  _focusElement(tabEl);
3651
3676
  tabEl.click();
3652
3677
  try { await wait_for('nac:tab:changed', 1500); } catch (e) { /* tolerated */ }
@@ -3658,6 +3683,16 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
3658
3683
  '[data-nac-role="tab"][data-nac-id="' + tab_key + '"]'
3659
3684
  );
3660
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
+ }
3661
3696
  _focusElement(tabEl);
3662
3697
  tabEl.click();
3663
3698
  try {
@@ -4185,7 +4220,8 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
4185
4220
  + targetPlugin + '"',
4186
4221
  { candidates: available });
4187
4222
  }
4188
- return await tab(targetPlugin, matched.nac_id);
4223
+ /* v2.5 alpha.4: propagate opts (V24-04 expected_*) down to tab(). */
4224
+ return await tab(targetPlugin, matched.nac_id, opts);
4189
4225
  }
4190
4226
 
4191
4227
  /* ---------- Visualization mode ---------------------------------- */
@@ -7559,7 +7595,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
7559
7595
 
7560
7596
  global.NAC = {
7561
7597
  __nac_v1_installed: true,
7562
- version: '2.5.0-alpha.3',
7598
+ version: '2.5.0-alpha.4',
7563
7599
  spec_version: '2.5',
7564
7600
  /* v2.2.0 (V22-01) -- strict validation toggle. When true,
7565
7601
  NAC.register throws on findings (manifest_role_unknown,
@@ -7599,10 +7635,12 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
7599
7635
  describe() output (RFC sec 5.2/5.3). expected_plugin_version
7600
7636
  / expected_tree_version / expected_element_state_hash on every
7601
7637
  mutating API reject with NacError('snapshot_stale', ...) when
7602
- the snapshot is stale. Default STRICT_VERSIONING=false in
7603
- 2.5.0-alpha.2 so adopters opt in; flips to true in alpha.3
7604
- once the dispatch hooks finish their soak window. */
7605
- STRICT_VERSIONING: false,
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,
7606
7644
  eager_hashing: false,
7607
7645
  conformance_tier: 'NAC-3-versioned',
7608
7646
  markHydrationComplete: markHydrationComplete,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nac3/runtime",
3
- "version": "2.5.0-alpha.3",
3
+ "version": "2.5.0-alpha.4",
4
4
  "description": "Native Agent Contract -- spec + reference runtime that lets web UIs be driven by AI agents, voice runners, and accessibility tools.",
5
5
  "keywords": [
6
6
  "nac",