@nac3/runtime 2.5.2 → 2.6.0

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,106 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.6.0 -- 2026-11-11
4
+
5
+ A MINOR release: the plugin extension contract of section 15 grows the
6
+ six hooks a canvas or API surface needed in order to live in a
7
+ repository of its own and still be operable through this runtime
8
+ (RFC V26-01). Nothing in the v2.5 surface changed shape -- a manifest
9
+ written against 2.5.2 registers and runs unmodified -- and one defect
10
+ of 2.5.2 is fixed, which is the only behaviour an existing manifest can
11
+ notice.
12
+
13
+ The spec version moves to **2.6** because 15.4 says it must: this
14
+ release adds a backend to the vocabulary, and a runtime that does not
15
+ implement `emitter-listen` MUST refuse a manifest declaring it rather
16
+ than skip it silently.
17
+
18
+ ### Added
19
+
20
+ - **Discovery (SPEC 15.10)** -- `NAC.plugins()` and
21
+ `NAC.describePlugin(slug)`. Until now the registry was readable only
22
+ by `call`, `read` and `subscribe`, all three of which require the
23
+ caller to already know the slug and the path: an agent that did not
24
+ register the plugin itself could not learn it exists. It read the DOM
25
+ manifest, found the chrome, and the canvas surface was invisible --
26
+ and for a plugin that declares no DOM at all there was nothing to
27
+ find. Both functions are synchronous (they read a local object) and
28
+ hand back a COPY, so a reader cannot reach the live registry and
29
+ rewrite another plugin's routing.
30
+
31
+ - **Self-description (SPEC 15.11)** -- optional `label`, `hint` and
32
+ typed `params` on a verb; `label`, `hint`, `unit` on state and
33
+ events. The DOM half of the protocol has had a name and a typed field
34
+ list since v1; the plugin half had neither, so on a surface where the
35
+ actionable thing IS the argument -- a coordinate and a zoom, an
36
+ instant, a page, a pose -- nothing declared its shape, its unit or
37
+ its range, and a voice runner could not name the verb out loud.
38
+ Optional everywhere; rejected at register time with `invalid` when
39
+ declared and malformed.
40
+
41
+ - **`emitter-listen` backend (SPEC 15.4)** -- the ninth backend, and
42
+ the first real event source that is not postMessage. A plugin
43
+ wrapping a library that emits its own events (`map.on('moveend')`,
44
+ `video.addEventListener('timeupdate')`, pdf.js `pagechanging`) had to
45
+ poll or hand-write a mirror node; now it declares the emitter, the
46
+ event name and, optionally, the state paths to re-read at event time.
47
+ The subscribe / unsubscribe method pair is detected from the three
48
+ shapes libraries ship, or declared outright. An emitter with no
49
+ removal method is REFUSED: a subscription that cannot be torn down is
50
+ a leak dressed as a success.
51
+
52
+ - **`sdk-call` reaches an object outside `window`, and positionally**
53
+ (SPEC 15.4) -- `handle` resolves the path against an object
54
+ registered with the new `NAC.registerApiHandle(name, obj)` instead of
55
+ the global one, which is what SPEC 15.1 always named as a motivating
56
+ case ("invoke `excalidrawAPI.setElements(...)` on a React ref") and
57
+ the backend could not do. `args_order` spells out the positional
58
+ argument list, so a library signature like `map.setView(center,
59
+ zoom)` is expressible. Both optional: without them the backend
60
+ behaves exactly as in 2.5.
61
+
62
+ - **A declared code space for a plugin's own errors (SPEC 15.9)** --
63
+ codes under the reserved `plugin.` prefix travel verbatim on
64
+ `err.code`, which is how "this row is not materialised" becomes
65
+ distinguishable from "that row does not exist". Until now that worked
66
+ by accident of implementation: `call` lifted ANY string a backend put
67
+ on `err._code`, against a published list of exactly ten codes. A code
68
+ that is neither one of the ten nor under the prefix is now refused as
69
+ `invalid`, with the refused string preserved on `err.offending_code`.
70
+
71
+ ### Fixed
72
+
73
+ - **`synthetic-mutation` no longer returns a subscription that can
74
+ never fire** (SPEC 15.4). When an observed state's mirror node was
75
+ absent, the runtime dropped it (`if (el) elements.push(el)`); with
76
+ nothing left to observe, `subscribe` returned a valid handle and the
77
+ callback was never called. Success and silence -- the silent damage
78
+ this protocol exists to remove, inside the protocol. It now rejects
79
+ with `backend_target_missing`, naming the state paths and selectors
80
+ that did not resolve. A manifest whose node legitimately comes and
81
+ goes -- the row of a virtualised grid -- declares the new optional
82
+ `root`: a container that outlives the node, observed with
83
+ `subtree: true` and re-resolved on every mutation, so a subscription
84
+ taken while the node was absent fires when it mounts. The move from
85
+ unreadable to readable is itself an emit.
86
+
87
+ ### Evidence
88
+
89
+ - Layer 1 (unit): `runtime/test/stage13-plugin-hooks.mjs`, 67
90
+ assertions, wired into `npm test`. It carries its own red proof: run
91
+ it against the 2.5.2 bytes
92
+ (`NAC3_RUNTIME_PATH=... node runtime/test/stage13-plugin-hooks.mjs`)
93
+ and 15 assertions fail, four of them the silent-subscription defect.
94
+ - Layer 2 (browser, against a library we do not control):
95
+ `demos/v26-leaflet-plugin/` driven by
96
+ `scripts/run-demo-v26-leaflet-plugin.mjs` -- a real Leaflet 1.9.4
97
+ loaded from unpkg with a pinned SRI hash, a plugin file that uses
98
+ nothing but the published runtime surface, 37 assertions, each effect
99
+ checked twice: once through the protocol and once against Leaflet's
100
+ own API. Evidence in `evidence/v26-leaflet-plugin/<run-date>/`.
101
+ This closes the gap registered as "the contract was never exercised
102
+ against a real app".
103
+
3
104
  ## 2.5.2 -- 2026-10-27
4
105
 
5
106
  A patch release with no runtime behaviour change. Like 2.5.1 it exists
package/NOTICE ADDED
@@ -0,0 +1,15 @@
1
+ NAC3 -- Native Agent Contract
2
+ nac-spec: protocol specification and reference runtime
3
+ https://yujin.app/nac-spec/
4
+
5
+ Copyright 2026 Pablo Kuschniroff <pablo.kuschnirof@gmail.com>
6
+ Published under the name Yujin (rpaforce.com).
7
+
8
+ Licensed under the Apache License, Version 2.0. See the LICENSE file in
9
+ this distribution, or http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ This product includes software developed by Pablo Kuschniroff.
12
+
13
+ Section 4(d) of the License requires a Derivative Work to reproduce the
14
+ attribution above in its own NOTICE file, in its documentation, or
15
+ within a display it generates.
package/SPEC.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NAC3 -- Native Agent Contract
2
2
 
3
- **Version:** 2.5.2 (stable -- the complete v2.5 surface: narrate, context+tree, expect+diff)
3
+ **Version:** 2.6.0 (stable -- the v2.5 surface plus the v2.6 plugin extension hooks: discovery, self-description, emitter-listen)
4
4
  **Status:** Stable release. The npm dist-tag `latest` points here; section 9.1 states what that guarantees and what a prerelease does not. This document states its version in exactly one place, the line above. The shipped RFCs and their Layer 2 + Layer 3 evidence are listed in `README.md` and `runtime/CHANGELOG.md`.
5
5
  **License:** Apache-2.0
6
6
  **Editor:** Yujin (yujin.app)
@@ -1400,7 +1400,7 @@ code, is the authority.
1400
1400
 
1401
1401
  ---
1402
1402
 
1403
- ## 15. Plugin extension contract -- canvas + API surfaces (v2.5)
1403
+ ## 15. Plugin extension contract -- canvas + API surfaces (v2.5, extended in v2.6)
1404
1404
 
1405
1405
  Sections 1-14 assume the agent-relevant surface is **DOM**. Every
1406
1406
  addressable element has a `data-nac-id` attribute, every verb fires
@@ -1420,6 +1420,17 @@ its own routing contract to such surfaces. The runtime stays
1420
1420
  agnostic of any specific app -- it learns how to talk to one only
1421
1421
  by reading the plugin's manifest.
1422
1422
 
1423
+ v2.6 adds no new way to REACH an app: the backends of 15.4 already
1424
+ cover the ones that exist. What it adds is the half that was missing
1425
+ for a plugin to live in a repository of its own -- how an agent FINDS
1426
+ a plugin it did not register (15.10) and UNDERSTANDS what its verbs
1427
+ take (15.11), one real event source that is not postMessage
1428
+ (`emitter-listen`, 15.4), the two reaches `sdk-call` lacked (an API
1429
+ object outside `window`, and positional arguments), a fail-closed rule
1430
+ for an observer with nothing to observe, and a declared code space for
1431
+ a plugin's own errors (15.9). A manifest written against v2.5 needs no
1432
+ changes.
1433
+
1423
1434
  ### 15.1 Why a new primitive set
1424
1435
 
1425
1436
  DOM-only `NAC.click(id)` cannot:
@@ -1437,7 +1448,7 @@ heuristics. The fix is to add an explicit, agnostic verb that
1437
1448
  takes a plugin slug and a verb path, and lets the plugin's
1438
1449
  manifest declare how that verb is routed.
1439
1450
 
1440
- ### 15.2 The three primitives
1451
+ ### 15.2 The primitives
1441
1452
 
1442
1453
  ```ts
1443
1454
  NAC.registerPlugin(slug: string, manifest: PluginManifest): void
@@ -1446,6 +1457,15 @@ NAC.read(plugin: string, state_path: string): Promise<any>
1446
1457
  NAC.subscribe(plugin: string, event_path: string,
1447
1458
  cb: (data: any) => void): SubscriptionHandle
1448
1459
  NAC.unsubscribe(handle: SubscriptionHandle): void
1460
+
1461
+ /* v2.6 -- discovery (sec 15.10) */
1462
+ NAC.plugins(): PluginDescriptor[]
1463
+ NAC.describePlugin(slug: string): PluginDescriptor
1464
+
1465
+ /* v2.6 -- API handles for objects that never land on `window` (15.4) */
1466
+ NAC.registerApiHandle(name: string, obj: object): void
1467
+ NAC.unregisterApiHandle(name: string): boolean
1468
+ NAC.apiHandles(): string[]
1449
1469
  ```
1450
1470
 
1451
1471
  - `registerPlugin(slug, manifest)` registers a v2.5 plugin. A given
@@ -1467,14 +1487,26 @@ NAC.unsubscribe(handle: SubscriptionHandle): void
1467
1487
  synthesised via polling / MutationObserver -- the manifest
1468
1488
  declares which.
1469
1489
 
1470
- All four functions are async (Promise-returning) except
1471
- `unsubscribe`, which is synchronous and idempotent.
1490
+ - `plugins()` returns a descriptor for every registered v2.5 plugin,
1491
+ ordered by slug; `describePlugin(slug)` returns one. Both are
1492
+ read-only: the descriptor is a COPY, so a caller cannot reach the
1493
+ live registry through it (sec 15.10).
1494
+ - `registerApiHandle(name, obj)` publishes an API object under a name
1495
+ a manifest can reference with `handle`. The object itself never
1496
+ enters the manifest -- manifests stay pure JSON.
1497
+
1498
+ `call`, `read` and `subscribe` reach a surface and are therefore async
1499
+ (Promise-returning). `unsubscribe`, `plugins`, `describePlugin` and the
1500
+ handle registry only touch local state and are synchronous;
1501
+ `unsubscribe` is also idempotent.
1472
1502
 
1473
1503
  ### 15.3 Plugin manifest shape
1474
1504
 
1475
1505
  ```ts
1476
1506
  interface PluginManifest {
1477
1507
  slug: string;
1508
+ label?: string; /* v2.6 -- human name of the surface */
1509
+ hint?: string; /* v2.6 -- one line on what it is for */
1478
1510
  verbs: { [verb_path: string]: VerbBinding };
1479
1511
  state: { [state_path: string]: StateBinding[] };
1480
1512
  events: { [event_path: string]: EventBinding };
@@ -1482,12 +1514,18 @@ interface PluginManifest {
1482
1514
 
1483
1515
  interface VerbBinding {
1484
1516
  backend: BackendKind;
1517
+ label?: string; /* v2.6 -- see 15.11 */
1518
+ hint?: string; /* v2.6 */
1519
+ params?: ParamDecl[]; /* v2.6 -- what the verb takes */
1485
1520
  /* backend-specific fields (see 15.4) */
1486
1521
  [k: string]: any;
1487
1522
  }
1488
1523
 
1489
1524
  interface StateBinding {
1490
1525
  backend: BackendKind;
1526
+ label?: string; /* v2.6 -- names the state PATH (see 15.11) */
1527
+ hint?: string; /* v2.6 */
1528
+ unit?: string; /* v2.6 -- 'degrees', 'seconds', 'page' */
1491
1529
  /* backend-specific fields (see 15.4) */
1492
1530
  extract?: string; /* extractor DSL string (see 15.5) */
1493
1531
  [k: string]: any;
@@ -1495,10 +1533,24 @@ interface StateBinding {
1495
1533
 
1496
1534
  interface EventBinding {
1497
1535
  backend: BackendKind;
1536
+ label?: string; /* v2.6 */
1537
+ hint?: string; /* v2.6 */
1498
1538
  /* backend-specific fields */
1499
1539
  [k: string]: any;
1500
1540
  }
1501
1541
 
1542
+ interface ParamDecl { /* v2.6 -- see 15.11 */
1543
+ name: string;
1544
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
1545
+ required?: boolean;
1546
+ unit?: string;
1547
+ min?: number;
1548
+ max?: number;
1549
+ enum?: any[];
1550
+ label?: string;
1551
+ hint?: string;
1552
+ }
1553
+
1502
1554
  type BackendKind =
1503
1555
  | 'postmessage'
1504
1556
  | 'postmessage-listen'
@@ -1507,7 +1559,8 @@ type BackendKind =
1507
1559
  | 'dom-mirror'
1508
1560
  | 'same-origin-window'
1509
1561
  | 'synthetic-mutation'
1510
- | 'synthetic-poll';
1562
+ | 'synthetic-poll'
1563
+ | 'emitter-listen'; /* v2.6 */
1511
1564
  ```
1512
1565
 
1513
1566
  Manifests are pure JSON (no JS callbacks). Forge, Sumi, and any
@@ -1518,24 +1571,56 @@ Verbs and events have **exactly one** binding. State has an
1518
1571
  **ordered array** of bindings: the runtime walks the chain in
1519
1572
  order, returning the first source that successfully resolved.
1520
1573
 
1574
+ Every field marked `v2.6` is OPTIONAL: a manifest written against
1575
+ v2.5 stays valid without changes. What is not optional is being
1576
+ well-formed WHEN declared -- a `label` that is not a string, or a
1577
+ `params` entry of a type outside the vocabulary above, is rejected at
1578
+ register time with `invalid` (sec 15.11).
1579
+
1521
1580
  ### 15.4 Backend vocabulary
1522
1581
 
1523
1582
  | Kind | Used for | Required fields |
1524
1583
  |------|----------|-----------------|
1525
1584
  | `postmessage` | Verb: post a message to an iframe via `postMessage`. | `target` (CSS selector of the iframe to send to), `message` (MessageId string), `values` (object literal interpolated with args), `values_from_args` (optional array of arg keys to forward verbatim) |
1526
1585
  | `postmessage-listen` | Event: listen for a specific incoming `MessageId` on `window.message`. | `source` (CSS selector of the iframe to filter origin by; if omitted, accept any source), `message` (MessageId to match), `extract` (extractor DSL into the message data) |
1527
- | `sdk-call` | Verb: call a globally-exposed JS function (e.g. Figma plugin, Excalidraw API). | `path` (dotted path into `window`, e.g. `figma.currentPage.selection`), `mode` (`assign` to set the path to the args value, `invoke` to call it as a function with the args object) |
1586
+ | `sdk-call` | Verb or state: call or read a JS function / property exposed on `window` or on a registered API handle (Figma plugin, Excalidraw API, a map instance). | `path` (dotted path, e.g. `figma.currentPage.selection`), `mode` (`assign` to set the path to the args value, `invoke` to call it as a function, `read` to return the value at the path), and from v2.6: `handle` (optional -- the name of an object registered with `NAC.registerApiHandle`; the `path` is walked against THAT object instead of the global one, which is how an API that never lands on `window` is reached), `args_order` (optional -- an array of arg names spelling out the POSITIONAL argument list, so `map.setView(center, zoom)` is expressible; without it the args object travels as a single argument, which is what every v2.5 manifest does) |
1528
1587
  | `script-bridge` | Verb or state: invoke an app's scripting bridge (Collabora's `CallPythonScript`, LibreOffice UNO bridge, Google Apps Script). | `bridge` (a backend-specific identifier like `collabora.python`), `script` (script identifier), `function` (function name to run), `args` (object literal interpolated with the call args), `response_match` (for state: the response MessageId to wait on), `timeout_ms` (optional, default 5000) |
1529
1588
  | `dom-mirror` | State: read from a DOM element whose attribute / class / text mirrors a canvas-internal state (e.g. a toolbar button highlighted when its formatting is active on the current selection). | `selector` (CSS selector to query), `extract` (extractor DSL, see 15.5) |
1530
1589
  | `same-origin-window` | State: read from `iframe.contentWindow.<path>` when the iframe is same-origin. The runtime detects cross-origin and falls through. | `target` (CSS selector of the iframe), `path` (dotted path into `contentWindow`) |
1531
- | `synthetic-mutation` | Event: synthesise an event by observing DOM mutations on one or more state sources and re-emitting when the observed value changes. | `observe` (array of state paths to watch; the runtime calls `read` on each and diffs across mutations), `throttle_ms` (optional, default 100) |
1590
+ | `synthetic-mutation` | Event: synthesise an event by observing DOM mutations on one or more state sources and re-emitting when the observed value changes. | `observe` (array of state paths to watch; the runtime calls `read` on each and diffs across mutations), `throttle_ms` (optional, default 100), `root` (optional, v2.6 -- a CSS selector for a container to observe instead of the mirror nodes themselves; see the fail-closed rule below) |
1532
1591
  | `synthetic-poll` | Event: synthesise an event by polling state sources. | `observe` (array of state paths), `interval_ms` (default 250) |
1592
+ | `emitter-listen` | Event (v2.6): listen to a REAL event source that is not postMessage -- a JS event emitter exposed by a library (`map.on('moveend')`, `video.addEventListener('timeupdate')`, pdf.js `pagechanging`, a recogniser's `onresult`). | `event` (required -- the library's event name), `handle` (optional -- a registered API handle to listen on), `path` (optional -- dotted path to the emitter; resolved against the handle when one is declared, against the global object otherwise; omitted means the handle itself is the emitter), `method` / `off_method` (optional -- the subscribe / unsubscribe method names; when omitted the runtime detects `on`/`off`, `addEventListener`/`removeEventListener` or `addListener`/`removeListener`, in that order), `extract` (optional extractor DSL over the payload the library hands the listener), `observe` (optional array of state paths: instead of the raw payload, the runtime re-reads those states at event time and the callback receives that snapshot -- the useful shape for a continuous surface, where the event says "it moved" and the state says where to) |
1533
1593
 
1534
1594
  Each backend MUST be implemented by the runtime as a self-contained
1535
1595
  dispatcher (`dispatch(binding, args, context) -> Promise<value>`).
1536
1596
  Adding a new backend type to the spec requires bumping the spec
1537
1597
  version; runtimes ignoring unknown backends MUST reject manifests
1538
- that declare them (no silent skip).
1598
+ that declare them (no silent skip). `emitter-listen` is the reason
1599
+ this document is 2.6 and not 2.5.3.
1600
+
1601
+ **Fail-closed rule for an observer with nothing to observe (v2.6).**
1602
+ `synthetic-mutation` resolves every observed state path to the DOM
1603
+ element its primary `dom-mirror` binding selects. When a selector
1604
+ matches no element, `subscribe` MUST reject with
1605
+ `backend_target_missing`, naming the state paths and selectors that
1606
+ did not resolve. It MUST NOT return a handle: a subscription that
1607
+ observes nothing resolves successfully and then never fires, which is
1608
+ precisely the silent damage this protocol exists to remove -- and
1609
+ until 2.5.2 that is what the reference runtime did.
1610
+
1611
+ A manifest whose observed node legitimately comes and goes -- the row
1612
+ of a virtualised grid, which exists only while it is scrolled into
1613
+ view -- declares `root`: a container that OUTLIVES the node. The
1614
+ runtime then observes the container with `subtree: true` and
1615
+ re-resolves the selectors on every mutation, so a subscription taken
1616
+ while the node was absent fires when the node mounts. `root` itself
1617
+ must resolve, for the same reason. When a subscription starts with
1618
+ nothing readable and the observed state later becomes readable, that
1619
+ transition is itself an emit: the move from unknown to known is the
1620
+ change the caller is waiting for. While an observed state is
1621
+ unreadable no event is emitted, so a manifest for which ABSENCE is
1622
+ meaningful declares it as data -- a `present` extractor, or a
1623
+ fallback binding in the chain.
1539
1624
 
1540
1625
  ### 15.5 Extractor mini-DSL
1541
1626
 
@@ -1685,6 +1770,152 @@ is one of:
1685
1770
  - `invalid` -- argument shape is wrong (bad slug, malformed
1686
1771
  manifest at register time, etc).
1687
1772
 
1773
+ **The plugin code space (v2.6).** The ten codes above are the whole
1774
+ contract vocabulary, and they are deliberately about ROUTING: they say
1775
+ the protocol could not get there, never why the application said no. A
1776
+ plugin that needs a code of its own -- `row_not_materialized` as
1777
+ something distinguishable from "that row does not exist", a document
1778
+ that is locked, an export still rendering -- raises it under the
1779
+ reserved prefix `plugin.`:
1780
+
1781
+ ```js
1782
+ const e = new Error('row 42 is not materialised');
1783
+ e._code = 'plugin.row_not_materialized';
1784
+ throw e; /* inside the backend the manifest routes to */
1785
+ ```
1786
+
1787
+ `NAC.call` and `NAC.subscribe` surface such a code verbatim on
1788
+ `err.code`. A code that is NEITHER one of the ten NOR under the
1789
+ `plugin.` prefix is refused as `invalid`, with the refused string
1790
+ preserved on `err.offending_code`: an undeclared code that travelled
1791
+ anyway is how a vocabulary stops being a vocabulary. The prefix is
1792
+ reserved -- the ten contract codes will never take it, so a plugin
1793
+ code can never collide with a future one.
1794
+
1795
+ ### 15.10 Discovery of the registry (v2.6)
1796
+
1797
+ Sections 15.2 to 15.9 all require the caller to already know the slug
1798
+ and the path. Until 2.5.2 that was the ONLY way in: the registry was
1799
+ readable by exactly three functions (`call`, `read`, `subscribe`), so
1800
+ an agent that did not register the plugin itself could not learn it
1801
+ exists. It read the DOM manifest (section 5), found the chrome, and
1802
+ the canvas surface was invisible. For a surface that declares no DOM
1803
+ at all -- a voice-only plugin -- there was nothing to find whatsoever.
1804
+
1805
+ ```ts
1806
+ NAC.plugins(): PluginDescriptor[] /* ordered by slug */
1807
+ NAC.describePlugin(slug: string): PluginDescriptor
1808
+
1809
+ interface PluginDescriptor {
1810
+ slug: string;
1811
+ label: string | null;
1812
+ hint: string | null;
1813
+ verbs: { verb_path: string; backend: string | null;
1814
+ label: string | null; hint: string | null;
1815
+ params: ParamDecl[] | null; handle?: string }[];
1816
+ state: { state_path: string; backends: (string | null)[];
1817
+ label: string | null; hint: string | null;
1818
+ unit: string | null }[];
1819
+ events: { event_path: string; backend: string | null;
1820
+ label: string | null; hint: string | null;
1821
+ observe: string[] | null; event?: string }[];
1822
+ }
1823
+ ```
1824
+
1825
+ Rules:
1826
+
1827
+ 1. Both are SYNCHRONOUS. They read a local object; nothing is
1828
+ dispatched to any surface, so there is no reason for an agent to
1829
+ await a round trip to find out what is there.
1830
+ 2. The descriptor is a **copy**. A caller MUST NOT be able to reach
1831
+ the live registry through it and rewrite another plugin's routing.
1832
+ 3. Verbs, state paths and events come back sorted by path, so two
1833
+ reads of the same registry are byte-comparable.
1834
+ 4. An undeclared `label` / `hint` / `params` reads as `null`, never as
1835
+ a missing key: a reader does not have to tell "absent" from
1836
+ "not declared".
1837
+ 5. `describePlugin` on an unregistered slug rejects with
1838
+ `plugin_not_registered` (sec 15.9).
1839
+
1840
+ Discovery is deliberately a read of what the manifest DECLARES, not a
1841
+ probe of the surface. It tells an agent what exists and how to name
1842
+ it; whether the surface answers today is what `call` and `read` are
1843
+ for.
1844
+
1845
+ ### 15.11 Self-description (v2.6)
1846
+
1847
+ The DOM half of this protocol has carried a human name and a typed
1848
+ field list since v1 (`data-nac-label`, `data-nac-hint`, `fields[]`
1849
+ with a type, section 6). The plugin half carried none: a manifest
1850
+ declared WHERE a verb routes and nothing about what it is called or
1851
+ what it takes. On a continuous surface the actionable thing IS the
1852
+ argument -- a coordinate and a zoom, an instant on a timeline, a page
1853
+ and a form field, a pose in three dimensions -- and nothing declared
1854
+ its shape, its unit or its range. A voice runner could not even name
1855
+ the verb out loud.
1856
+
1857
+ `label`, `hint`, `params` (verbs), `label` / `hint` / `unit` (state
1858
+ and events) close that. All optional; all read back through 15.10.
1859
+
1860
+ ```json
1861
+ {
1862
+ "slug": "acme.map",
1863
+ "label": "Acme map",
1864
+ "verbs": {
1865
+ "view.set": {
1866
+ "backend": "sdk-call",
1867
+ "handle": "acme.map",
1868
+ "path": "setView",
1869
+ "mode": "invoke",
1870
+ "args_order": ["center", "zoom"],
1871
+ "label": "Move the map",
1872
+ "hint": "Centres the map on a coordinate at a zoom level",
1873
+ "params": [
1874
+ { "name": "center", "type": "array", "required": true,
1875
+ "unit": "degrees", "label": "Centre", "hint": "[lat, lng]" },
1876
+ { "name": "zoom", "type": "number", "required": false,
1877
+ "unit": "zoom level", "min": 0, "max": 22 }
1878
+ ]
1879
+ }
1880
+ },
1881
+ "state": {
1882
+ "view.center": [
1883
+ { "backend": "sdk-call", "handle": "acme.map", "path": "getCenter",
1884
+ "mode": "invoke", "label": "Centre of the view", "unit": "degrees" }
1885
+ ]
1886
+ },
1887
+ "events": {
1888
+ "view.moved": {
1889
+ "backend": "emitter-listen", "handle": "acme.map",
1890
+ "event": "moveend", "observe": ["view.center"],
1891
+ "label": "The map stopped moving"
1892
+ }
1893
+ }
1894
+ }
1895
+ ```
1896
+
1897
+ Rules:
1898
+
1899
+ 1. A `label`, `hint` or `unit` that is declared MUST be a non-empty
1900
+ string; otherwise the manifest is rejected at register time with
1901
+ `invalid`.
1902
+ 2. `params` MUST be an array. Each entry MUST carry a `name` (unique
1903
+ within the verb) and a `type` from
1904
+ `string | number | boolean | object | array`. `required`, `unit`,
1905
+ `min`, `max`, `enum`, `label` and `hint` are optional, and are
1906
+ type-checked when present. Anything else is `invalid`.
1907
+ 3. The label of a state PATH is the first one its chain declares. A
1908
+ state path is one value with an ordered list of sources (sec 15.6),
1909
+ so it is named once, by whichever source names it.
1910
+ 4. `params` declares the shape of the `args` object `NAC.call`
1911
+ receives. The runtime does NOT validate args against it: the
1912
+ declaration exists so an agent can compose a call and a voice
1913
+ runner can speak it, and a surface that needs its arguments
1914
+ enforced enforces them where they land.
1915
+ 5. Nothing here is translated by the runtime. A label is authored in
1916
+ the language of the app; a host that speaks another one localises
1917
+ at its own layer (section 4.3).
1918
+
1688
1919
  ---
1689
1920
 
1690
1921
  ## 16. Tree navigation (v2.5 -- SHIPPED in 2.5.0-alpha.5 / RFC V25-02)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "api_schema": 1,
3
- "chain_head": "sha384-mzie2uMo7z01FLUHuazrTGn1Dzkk+5hYse4hMOkMe0hiPumb8p7s7452Lxu3Xkvk",
4
- "entry_count": 4,
3
+ "chain_head": "sha384-Zy0OWn+JJPSfJVsTKTfkWz3lrwGQQy8+ZcXUcCbrrooJHJQ/GL3Zc5xrUBv1dRAu",
4
+ "entry_count": 5,
5
5
  "generated_by": "scripts/build-contract-api.mjs",
6
6
  "note": "The third of three independent witnesses of the contract chain head (audit N-24). This copy is immutable once published: npm does not allow a version to be republished, so a host that rewrites the chain cannot reach back and change it. If this head disagrees with the one the host serves for this version, do not trust the host. Present from 2.5.0 onward; earlier releases were published before this API existed.",
7
7
  "protocol": "NAC3",
8
- "published_at": "2026-10-27",
9
- "runtime_version": "2.5.2",
8
+ "published_at": "2026-11-11",
9
+ "runtime_version": "2.6.0",
10
10
  "surface": "contract-head-witness",
11
11
  "witnesses": {
12
12
  "host": "api/index.json served by the web host (chain_head)",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "generated_by": "runtime/build.mjs from SPEC.md section 8 via scripts/spec-levels.mjs",
3
3
  "note": "Build input for the CLI validator. The published, signed copy of the same facts is api/v/<version>/levels.json.",
4
- "version": "2.5.2",
5
- "spec_version": "2.5",
4
+ "version": "2.6.0",
5
+ "spec_version": "2.6",
6
6
  "locales_required": [
7
7
  "es",
8
8
  "en",
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /* =====================================================================
3
- NAC CLI v2.5.2 -- the entry point.
3
+ NAC CLI v2.6.0 -- the entry point.
4
4
 
5
5
  Two modes, and they do not pretend to be each other:
6
6
 
@@ -32,8 +32,8 @@ import fs from 'node:fs';
32
32
  import path from 'node:path';
33
33
  import { staticLint } from './cli-lint.mjs';
34
34
 
35
- const VERSION = '2.5.2';
36
- const SPEC_VERSION = '2.5';
35
+ const VERSION = '2.6.0';
36
+ const SPEC_VERSION = '2.6';
37
37
 
38
38
  const args = process.argv.slice(2);
39
39
  const cmd = args[0];
@@ -1,5 +1,5 @@
1
1
  // Generated by build.mjs -- do not edit. Source: js/nac-v2-extensions.js
2
- // Brownfield + data-table extensions for @nac3/runtime v2.5.2.
2
+ // Brownfield + data-table extensions for @nac3/runtime v2.6.0.
3
3
  // This module MUST load AFTER the core runtime; it attaches every
4
4
  // member below onto the same window.NAC object. Import as:
5
5
  // import '@nac3/runtime';