@nac3/runtime 2.2.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/SPEC.md ADDED
@@ -0,0 +1,602 @@
1
+ # NAC3 -- Native Agent Contract
2
+
3
+ **Version:** 2.2.0
4
+ **Status:** Stable
5
+ **License:** Apache-2.0
6
+ **Editor:** Yujin (rpaforce.com)
7
+
8
+ ---
9
+
10
+ ## 0. Purpose
11
+
12
+ NAC3 is a contract between web UIs and the agents that drive them.
13
+ Agents include voice runners, LLM intermediaries, RPA bots,
14
+ accessibility tools, and end-to-end test runners. The contract
15
+ specifies:
16
+
17
+ 1. **How elements are named** -- so an agent can ask "click the
18
+ save button" and resolve it to a single DOM node.
19
+ 2. **How verbs apply** -- so an agent can call `NAC.click(id)`,
20
+ `NAC.fill(id, value)`, `NAC.tab(plugin, key)`, etc., without
21
+ per-app glue.
22
+ 3. **How completion is signalled** -- so an agent knows when a
23
+ step finished, with a deterministic event family per role.
24
+ 4. **How provenance is preserved** -- so a downstream system can
25
+ tell a real user click from a synthesised one.
26
+
27
+ NAC3 adds a thin layer on top of whatever framework you already
28
+ render with. It does not replace ARIA, React, Vue, or your design
29
+ system.
30
+
31
+ ---
32
+
33
+ ## 1. Roles
34
+
35
+ Every agent-relevant DOM element carries `data-nac-role`. The
36
+ canonical roles are:
37
+
38
+ | Role | Meaning | Example |
39
+ |------|---------|---------|
40
+ | `plugin` | A self-contained UI module (a page, a panel, a widget collection). | `<article data-nac-plugin="invoice">` |
41
+ | `section` | A landmark inside a plugin (header, body, footer, sidebar). | `<section data-nac-role="section">` |
42
+ | `region` | A nameable area inside a section (a card cluster, a result list). | `<div data-nac-role="region">` |
43
+ | `action` | A clickable widget that triggers a verb (button, link-as-button). | `<button data-nac-role="action" data-nac-action="save">` |
44
+ | `field` | An input the user types or toggles (text, number, checkbox, radio, date, file). | `<input data-nac-role="field">` |
45
+ | `option` | A selectable option inside a field (combobox / select / radio group child). | `<li data-nac-role="option">` |
46
+ | `tab` | A switchable panel selector. **Required when `data-nac-id` matches `^tab\.`** | `<button data-nac-role="tab" data-nac-id="tab.lines">` |
47
+ | `breadcrumb-item` | A breadcrumb hop. | `<a data-nac-role="breadcrumb-item">` |
48
+ | `accordion-toggle` | An expand/collapse control. | `<button data-nac-role="accordion-toggle">` |
49
+ | `step` | A wizard step indicator. | `<li data-nac-role="step">` |
50
+ | `pagination-item` | A page-jump control in a paginated list. | `<button data-nac-role="pagination-item">` |
51
+ | `confirm-button` | A confirm/cancel button inside a confirm dialog. | `<button data-nac-role="confirm-button">` |
52
+ | `sort-control` | A column sort header. | `<th data-nac-role="sort-control">` |
53
+ | `filter-control` | A column filter trigger. | `<button data-nac-role="filter-control">` |
54
+ | `data-table` | A data-table host (v2.1). | `<table data-nac-role="data-table">` |
55
+ | `navigation` | A landmark navigation region. **Not a tab.** | `<nav data-nac-role="navigation">` |
56
+ | `confirm-dialog` | The modal of a confirmation request. | `<div data-nac-role="confirm-dialog">` |
57
+
58
+ Roles outside this list are reserved for future use. A NAC-strict
59
+ runtime SHOULD reject unknown roles at register-time (v2.2). A
60
+ NAC-permissive runtime MAY treat unknown roles as `action` for
61
+ back-compat (v1.9 and v2.0 default).
62
+
63
+ ---
64
+
65
+ ## 2. Names
66
+
67
+ Every agent-resolvable element carries `data-nac-id`. The id is:
68
+
69
+ - **A dotted path** (e.g. `deals.list.row.42.actions.delete`).
70
+ Dots separate semantic levels; the runtime does not interpret
71
+ them, but humans and LLMs do.
72
+ - **Globally unique within a `data-nac-plugin` scope.** Two
73
+ different plugins MAY share an id; the runtime resolves by
74
+ `(plugin, id)` pair.
75
+ - **Stable across re-renders.** Frameworks that produce a new id
76
+ per render (random hashes, instance counters) break the contract.
77
+ - **Stable across UI redesigns.** A button moves from the toolbar
78
+ to a dropdown; its id MUST stay the same.
79
+
80
+ Reserved id prefixes (v2.1):
81
+
82
+ | Prefix | Reserved for |
83
+ |--------|--------------|
84
+ | `tab.` | Tab buttons. Role MUST be `tab`. |
85
+ | `modal.` | Modal-scoped elements. Role is the leaf widget's role. |
86
+ | `field.` | Form field shorthand. Role MUST be `field` or `option`. |
87
+ | `confirm.` | Confirm dialogs. |
88
+
89
+ ---
90
+
91
+ ## 3. Verbs
92
+
93
+ A `data-nac-role="action"` element MAY carry `data-nac-action="<verb>"`
94
+ naming what it does. The verb is a free-form snake-case identifier
95
+ agreed between the host and the agent. Common verbs:
96
+
97
+ `save`, `cancel`, `submit`, `delete`, `edit`, `view`, `create`,
98
+ `approve`, `reject`, `send`, `download`, `upload`, `refresh`,
99
+ `expand`, `collapse`, `open`, `close`, `add_row`, `remove_row`.
100
+
101
+ `NAC.click_by_verb(plugin, verb)` resolves a verb to the unique
102
+ action under that plugin and clicks it. Multiple actions sharing
103
+ the same verb under one plugin is a manifest error (lint:
104
+ `duplicate_verb`).
105
+
106
+ ---
107
+
108
+ ## 4. Manifest
109
+
110
+ Every plugin MAY register a manifest via:
111
+
112
+ ```js
113
+ NAC.register({
114
+ plugin_slug: 'invoice',
115
+ version: '1.0.0',
116
+ nac_version: '2.1',
117
+ elements: [
118
+ { id: 'invoice.save', role: 'action',
119
+ actions: [{ verb: 'save', label_i18n: { es: 'Guardar', en: 'Save', ... } }],
120
+ label_i18n: { es: 'Guardar factura', en: 'Save invoice', ... } },
121
+ ...
122
+ ],
123
+ tabs: [
124
+ { nac_id: 'tab.lines', label_i18n: { es: 'Lineas', en: 'Lines' } },
125
+ ...
126
+ ],
127
+ fields: [
128
+ { id: 'field.client_name', type: 'text', required: true,
129
+ label_i18n: { es: 'Cliente', en: 'Customer' } },
130
+ ...
131
+ ],
132
+ data_tables: [...]
133
+ });
134
+ ```
135
+
136
+ The manifest is the agent-facing source of truth. An LLM
137
+ intermediary that decides "the user said 'guardar'" looks up the
138
+ plugin manifest, finds the verb `save`, and emits
139
+ `NAC.click_by_verb('invoice', 'save')`.
140
+
141
+ ### 4.1 Required fields
142
+
143
+ - `plugin_slug` -- matches `data-nac-plugin` on the host element.
144
+ - `nac_version` -- the NAC3 version this manifest claims to comply
145
+ with. Runtime rejects manifests claiming a version higher than
146
+ itself.
147
+
148
+ ### 4.2 Optional fields
149
+
150
+ - `elements[]` -- the catalogue of named widgets. Each entry MUST
151
+ have `id` and `role`.
152
+ - `tabs[]` -- a separate top-level array for tabs. Equivalent to
153
+ `elements[]` entries with `role:'tab'`. Both shapes valid.
154
+ - `fields[]`, `actions[]`, `kpis[]`, `data_tables[]` -- typed
155
+ sub-collections; same semantics as `elements[]` filtered by
156
+ role. Demos pick the shape that reads cleanest to humans.
157
+
158
+ ### 4.3 i18n
159
+
160
+ Every `label_i18n` MUST cover all 10 NAC3 locales:
161
+
162
+ ```
163
+ es, en, pt, fr, ja, zh, hi, ar, de, it
164
+ ```
165
+
166
+ `i18n_strict: 'permissive'` on `NAC.autoRegister.watch()` allows
167
+ partial coverage during brownfield migration; production manifests
168
+ should ship 10 locales.
169
+
170
+ ---
171
+
172
+ ## 5. Public API
173
+
174
+ ### 5.1 Imperative
175
+
176
+ ```ts
177
+ NAC.click(nac_id: string, opts?: ClickOpts): Promise<{ok: true}>
178
+ NAC.click_by_verb(plugin: string|null, verb: string, opts?): Promise<...>
179
+ NAC.fill(nac_id: string, value: string|number|boolean): Promise<...>
180
+ NAC.select(nac_id: string, value: string): Promise<...>
181
+ NAC.tab(plugin: string, tab_key: string): Promise<...>
182
+ NAC.tab_by_label(plugin: string|null, label: string): Promise<...>
183
+ NAC.go_to_section(nac_id: string): Promise<...>
184
+ NAC.drag_drop(source_id, target_id, opts?: {to_index?: number}): Promise<...>
185
+ NAC.set_mode(mode: 'modal'|'maximized'|'new_tab'|'new_window'): void
186
+ NAC.screenshot(): Promise<string> // data URL
187
+ NAC.bindAction(el, handler, {plugin, action_id}): () => void // v2.2
188
+ ```
189
+
190
+ ### 5.1.1 Conformance helper (v2.2)
191
+
192
+ `NAC.bindAction(el, handler, ctx)` is the spec-conformant way to
193
+ wire a click handler. It emits `nac:action:succeeded` (or
194
+ `:failed`) automatically after the handler runs (sync, throw, or
195
+ Promise). Returns an unbinder. Use this instead of raw
196
+ `addEventListener('click', ...)` whenever the host supports it;
197
+ brownfield code can still emit the event manually as before.
198
+
199
+ ### 5.1.3 Field editor (v2.3 preview)
200
+
201
+ `NAC.edit_field(nac_id)` opens a modal that lets a user (or an
202
+ agent on their behalf) edit any text field with Word-style tools:
203
+
204
+ ```ts
205
+ NAC.edit_field(nac_id: string): Promise<{ok:true}>
206
+ ```
207
+
208
+ The modal registers under `plugin_slug='nac_editor'` with these
209
+ NAC-3 callable verbs:
210
+
211
+ | Verb | Effect |
212
+ |------|--------|
213
+ | `select_word` | select the word at the caret |
214
+ | `select_sentence` | select the sentence at the caret |
215
+ | `select_all` | ctrl-A within the editor |
216
+ | `replace` | replace selection with given text |
217
+ | `delete_selection` | remove current selection |
218
+ | `ai_correct_syntax` | POST current value to the LLM intermediary with system prompt "fix grammar + spelling, return only fixed text"; replace value with response |
219
+ | `save` | write back to source field, dispatch input + change events, close |
220
+ | `cancel` | discard, close |
221
+
222
+ Esc closes (cancel). Ctrl/Cmd+Enter saves. Click on overlay
223
+ backdrop cancels.
224
+
225
+ Spec sec 13 will formalise the contract in v2.3; the v2.2 runtime
226
+ ships a working reference impl so adopters can wire it today.
227
+ Available on any field via:
228
+
229
+ ```js
230
+ NAC.edit_field('invoice.client_name');
231
+ // or by intermediary:
232
+ NAC.click_by_verb('myplugin', 'edit_field', { nac_id: 'invoice.client_name' });
233
+ ```
234
+
235
+ ### 5.1.2 Strict validation flag (v2.2)
236
+
237
+ `NAC.STRICT_VALIDATION` (boolean, default `false` in v2.2). When
238
+ `true`, `NAC.register()` throws an `Error` with `code='strict_validation'`
239
+ and a `findings` array on any of:
240
+
241
+ - `manifest_role_unknown` -- entry's role outside the canonical set.
242
+ - `tab_id_manifest_role_drift` -- id matches `^tab\.` but role
243
+ is not `'tab'`.
244
+ - `manifest_dom_role_mismatch` -- mounted DOM element's
245
+ `data-nac-role` differs from manifest entry's role.
246
+
247
+ In v2.3 the default flips to `true`. In v3.0 the flag is removed
248
+ (strict is the only mode).
249
+
250
+ All async methods reject with `NacError` whose `code` is one of:
251
+
252
+ - `not_found` -- the named element/role/verb is not in the DOM.
253
+ - `invalid` -- argument shape is wrong.
254
+ - `timeout` -- side effect dispatched but the conformance ack
255
+ event did not arrive within 5 seconds. **A timeout means real
256
+ failure**: the handler may have hung, the ack was never wired,
257
+ a network race occurred. Callers MUST treat timeout as failure
258
+ unless they have proof of side effect via another channel.
259
+
260
+ ### 5.2 Introspection
261
+
262
+ ```ts
263
+ NAC.describe(): { active: string|null, plugins: PluginSnap[] }
264
+ NAC.describe_v2(): { v2_scope_entries: [...], sitemap: ..., data_tables: [...] }
265
+ NAC.manifest(plugin_slug: string): Manifest|null
266
+ NAC.validate_global(opts?: {probe?: boolean}): Findings[]
267
+ ```
268
+
269
+ ### 5.3 Data tables (v2.1)
270
+
271
+ ```ts
272
+ NAC.registerDataTable(spec: DataTableSpec): void
273
+ NAC.dt_add_row(table_id, values): {ok, row_id}
274
+ NAC.dt_remove_row(table_id, row_id): {ok}
275
+ NAC.dt_edit_cell(table_id, row_id, column, value): {ok} | {ok:false, error}
276
+ NAC.dt_set_cell(table_id, row, col, value): {ok} | {ok:false, error}
277
+ NAC.dt_select(table_id, target): {ok}
278
+ NAC.dt_commit(table_id): {ok, final_state} | {ok:false, errors:[...]}
279
+ NAC.dt_discard(table_id): {ok}
280
+ NAC.dt_state(table_id): TableState
281
+ NAC.dt_read_aggregate(table_id, agg_key, column): number|null
282
+ NAC.registerDataTableComputed(table_id, column, fn): void
283
+ ```
284
+
285
+ A data table has a `subkind`:
286
+
287
+ - `collection` -- ordered rows with optional transactional commit.
288
+ Used for invoice lines, cart items, log entries.
289
+ - `matrix` -- row x column grid where every cell carries a value.
290
+ Used for permission matrices, schedule grids.
291
+ - `matrix-singletree` -- matrix where each row collapses into a
292
+ tree (rare).
293
+
294
+ ---
295
+
296
+ ## 6. Events
297
+
298
+ Every action emits a deterministic completion event. The runtime's
299
+ `NAC.click()` polls for this event and resolves when it fires.
300
+
301
+ | Role | Success event | Failure event |
302
+ |------|---------------|---------------|
303
+ | `action` | `nac:action:succeeded` | `nac:action:failed` |
304
+ | `field` | `nac:field:changed` | -- |
305
+ | `option` | `nac:field:changed` | -- |
306
+ | `tab` | `nac:tab:activated` | -- |
307
+ | `breadcrumb-item` | `nac:breadcrumb:navigated` | -- |
308
+ | `accordion-toggle` | `nac:accordion:expanded` / `:collapsed` | -- |
309
+ | `step` | `nac:step:advanced` | -- |
310
+ | `pagination-item` | `nac:table:page_changed` | -- |
311
+ | `confirm-button` | `nac:confirm:resolved` / `:cancelled` | -- |
312
+ | `sort-control` | `nac:table:sort_changed` | -- |
313
+ | `filter-control` | `nac:table:filter_changed` | -- |
314
+
315
+ ### 6.1 Event detail shape
316
+
317
+ Every event detail carries the canonical id field plus `plugin`:
318
+
319
+ ```js
320
+ nac:action:succeeded {
321
+ detail: { plugin: 'invoice', action_id: 'invoice.save', ... }
322
+ }
323
+ nac:tab:activated {
324
+ detail: { plugin: 'invoice_edit_modal', tab_id: 'tab.lines', ... }
325
+ }
326
+ nac:field:changed {
327
+ detail: { plugin: 'invoice', field_id: 'field.client_name',
328
+ value: 'Acme Corp', ... }
329
+ }
330
+ ```
331
+
332
+ ### 6.2 Emitting from a host handler
333
+
334
+ A click handler MUST emit the corresponding success event after
335
+ its synchronous side effect:
336
+
337
+ ```js
338
+ button.addEventListener('click', function (ev) {
339
+ // ... do the work ...
340
+ document.dispatchEvent(new CustomEvent('nac:action:succeeded', {
341
+ detail: { plugin: 'invoice', action_id: 'invoice.save' }
342
+ }));
343
+ });
344
+ ```
345
+
346
+ If the work is asynchronous, emit after resolution. If the work
347
+ fails, emit `nac:action:failed` with `{detail: {plugin, action_id,
348
+ error: <message>}}`.
349
+
350
+ The v2.2 runtime will provide `NAC.bindAction(el, handler, ctx)`
351
+ that wraps `addEventListener` and emits automatically.
352
+
353
+ ### 6.3 Why not use the click event itself?
354
+
355
+ A DOM `click` event fires before the handler runs. NAC3's contract
356
+ needs to know when the **side effect completed**, not when the
357
+ click started. Hence the separate event family.
358
+
359
+ ---
360
+
361
+ ## 7. Provenance
362
+
363
+ ### 7.1 isTrusted
364
+
365
+ `event.isTrusted` is `true` for user-initiated clicks (real mouse,
366
+ real keypress, screen reader activation) and `false` for
367
+ synthesised clicks (`element.click()`, dispatchEvent of a built
368
+ MouseEvent, automation).
369
+
370
+ NAC3 MUST surface this via `event.detail.is_trusted` in the
371
+ success event. Hosts that take security-sensitive actions
372
+ (payment, deletion) MAY require `is_trusted === true` and reject
373
+ synthetic clicks. The reference demo `example-v20-full.php`
374
+ includes a button pair (`v20_panel.istrusted_real` and
375
+ `v20_panel.istrusted_fake`) that demonstrates the distinction.
376
+
377
+ ### 7.2 HMAC-signed manifests
378
+
379
+ A manifest MAY carry a `provenance` block:
380
+
381
+ ```js
382
+ NAC.set_provenance_secret('your-tenant-secret');
383
+ NAC.register({
384
+ plugin_slug: 'invoice',
385
+ ...,
386
+ provenance: {
387
+ signed_at: '2026-05-09T10:00:00Z',
388
+ signed_by: 'tenant-X',
389
+ signature: '<HMAC-SHA256 of manifest body>'
390
+ }
391
+ });
392
+ ```
393
+
394
+ The runtime computes the expected HMAC over a stable
395
+ serialisation of the manifest (excluding the signature itself)
396
+ and rejects manifests whose signature does not match. Used by
397
+ multi-tenant deployments to prevent a tenant from spoofing
398
+ another tenant's manifest.
399
+
400
+ ### 7.3 Threat model
401
+
402
+ See `SECURITY.md` for the full threat model. Short version:
403
+
404
+ - NAC3 does not authenticate the **user**. That is your auth
405
+ layer's job.
406
+ - NAC3 authenticates the **manifest** (HMAC).
407
+ - NAC3 distinguishes real clicks from synthesised clicks
408
+ (isTrusted) so a host can refuse the latter for sensitive verbs.
409
+ - NAC3 does not protect against a malicious agent running with
410
+ user-level access. Such an agent can do anything the user can.
411
+
412
+ ---
413
+
414
+ ## 8. Conformance levels
415
+
416
+ A page is **NAC-1 conformant** if:
417
+
418
+ - Every clickable widget that an agent should be able to operate
419
+ carries `data-nac-id` and `data-nac-role`.
420
+ - Every `data-nac-role="action"` element fires
421
+ `nac:action:succeeded` after its side effect.
422
+ - The page registers at least one plugin manifest via
423
+ `NAC.register()`.
424
+ - `NAC.click(id)` works for every advertised id.
425
+
426
+ A page is **NAC-2 conformant** if it also:
427
+
428
+ - Registers `tabs[]`, `fields[]`, `actions[]` arrays explicitly
429
+ in its manifest (not inferred from DOM).
430
+ - Provides `label_i18n` covering all 10 NAC3 locales for every
431
+ user-facing label.
432
+ - Implements the v2.0 brownfield primitives: scope tree,
433
+ ephemeral capture, autoRegister.watch.
434
+ - Passes `NAC.validate_global({probe: false})` with zero
435
+ `error`-severity findings.
436
+
437
+ A page is **NAC-3 conformant** if it also:
438
+
439
+ - Carries HMAC-signed manifests.
440
+ - Distinguishes `isTrusted` for security-sensitive verbs.
441
+ - Passes `NAC.validate_global({probe: true})` with zero
442
+ findings.
443
+
444
+ The NPM package's CLI (`npx @nac3/runtime validate <url>`) reports
445
+ the highest level a page reaches.
446
+
447
+ ---
448
+
449
+ ## 9. Versioning
450
+
451
+ NAC3 follows semver:
452
+
453
+ - **Major** bump: breaking change to public API or wire formats.
454
+ Adopters edit code.
455
+ - **Minor** bump: new features, backward-compatible. Old code
456
+ keeps working.
457
+ - **Patch** bump: bug fixes, doc-only changes.
458
+
459
+ Deprecation policy: a feature marked `@deprecated` in version
460
+ `X.Y.0` is removed no earlier than `(X+1).0.0`. The release notes
461
+ document every removal explicitly.
462
+
463
+ The NPM package version mirrors the spec version: `@nac3/runtime@2.1.3`
464
+ implements NAC3 v2.1 with three patch revisions.
465
+
466
+ ---
467
+
468
+ ## 10. Validators
469
+
470
+ ### 10.1 Runtime: `NAC.validate_global()`
471
+
472
+ Walks the live DOM + the registered manifests + the i18n catalog
473
+ and returns an array of findings:
474
+
475
+ ```ts
476
+ {
477
+ severity: 'error' | 'warn' | 'info',
478
+ code: string, // e.g. 'tab_role_drift'
479
+ nac_id: string | null,
480
+ message: string,
481
+ detail: Record<string, any>
482
+ }
483
+ ```
484
+
485
+ Findings codes are stable across patch releases; new codes only
486
+ in minor bumps.
487
+
488
+ ### 10.2 CLI: `npx @nac3/runtime validate <target>`
489
+
490
+ Wraps `validate_global` plus a static lint of HTML/manifest
491
+ coherence. Exit codes:
492
+
493
+ - `0` -- no findings of severity >= configured threshold.
494
+ - `1` -- findings.
495
+ - `2` -- the target itself failed to load.
496
+
497
+ Useful in CI: `npx @nac3/runtime validate ./dist/index.html
498
+ --severity=error`.
499
+
500
+ ---
501
+
502
+ ## 11. The system around NAC3
503
+
504
+ NAC3 is a contract layer. To turn a NAC-conformant page into a
505
+ voice-driven app, you also need:
506
+
507
+ 1. **A speech-to-text source** (browser SpeechRecognition,
508
+ Whisper API, etc).
509
+ 2. **An LLM intermediary** that takes user text + the page's
510
+ `NAC.describe()` snapshot + an i18n hint and emits structured
511
+ actions: `[{kind: 'click', nac_id: 'X'}, {kind: 'fill', nac_id:
512
+ 'Y', value: 'Z'}]`. See `guides/LLM_WIRING.md`.
513
+ 3. **A chat client** that holds the conversation and dispatches
514
+ the actions. The reference is `js/nac-chat-client.js`.
515
+ 4. **A text-to-speech sink** for spoken replies (browser
516
+ SpeechSynthesis, ElevenLabs, etc).
517
+
518
+ NAC3 standardises only step 2's input/output shape (the
519
+ `NAC.describe()` snapshot + the action shape). Steps 1, 3, 4 are
520
+ outside the spec; you compose what you like.
521
+
522
+ ---
523
+
524
+ ## 12. Stability guarantees
525
+
526
+ What this spec promises:
527
+
528
+ 1. The set of canonical roles in section 1 will not shrink.
529
+ New roles MAY be added in minor versions.
530
+ 2. The event family in section 6 will not be renamed.
531
+ New events MAY be added in minor versions.
532
+ 3. The verbs of `NAC.click`, `NAC.fill`, etc. will not change
533
+ shape in minor versions. New optional `opts` fields MAY appear.
534
+ 4. The `validate_global` finding codes will not be reused for
535
+ different conditions across minor versions.
536
+
537
+ What this spec does NOT promise:
538
+
539
+ 1. Precise wording of error messages (those are i18n catalog
540
+ strings; localisations may shift).
541
+ 2. The DOM strategy for finding elements (`querySelector` today;
542
+ may move to a faster index later).
543
+ 3. The internal manifest cache layout. Treat manifests as
544
+ write-only from the host side, read-only from the agent side.
545
+
546
+ ---
547
+
548
+ ## 13. Open questions (tracked separately)
549
+
550
+ - Should `data-nac-role="navigation"` ever resolve to a tab?
551
+ Currently no (v2.1). The v22 roadmap argues for stricter
552
+ rejection.
553
+ - Should `NAC.click()` accept relative ids (e.g. `'./save'` to
554
+ mean "save under the active plugin")? Not in v2.1; possibly v2.3.
555
+ - Should manifests support inheritance / extension across plugins
556
+ (one base manifest extended by a tenant)? Tracked as v3.0
557
+ candidate.
558
+
559
+ ---
560
+
561
+ ## 13.5 Governance
562
+
563
+ NAC3 is currently stewarded by Yujin. The spec is published
564
+ under Apache 2.0; the reference runtime under MIT. Yujin
565
+ commits to moving NAC3 to a neutral foundation (W3C community
566
+ group, Linux Foundation, or equivalent industry body) if and
567
+ when adoption justifies neutral governance. Until then, spec
568
+ changes follow the RFC process documented in
569
+ `CONTRIBUTING.md`, with public comment period of at least 14
570
+ days for any change that affects the public API or wire
571
+ formats.
572
+
573
+ Adopters: the Apache 2.0 + MIT license combination guarantees
574
+ that the spec and runtime survive any change in Yujin's
575
+ corporate status. You can fork either, run either, and ship
576
+ either, today and after we are gone. This document records
577
+ the commitment so the path to that survival is explicit, not
578
+ implicit.
579
+
580
+ ---
581
+
582
+ ## 14. Reference implementation
583
+
584
+ The canonical implementation is the reference runtime distributed
585
+ as the NPM package `@nac3/runtime`. The runtime is feature-complete
586
+ for v2.1 and ships:
587
+
588
+ - `js/nac.js` -- v1.9 base + the public API in section 5.
589
+ - `js/nac-v2-extensions.js` -- the v2.0 brownfield primitives
590
+ (scope tree, capture ephemeral, autoRegister, HMAC, isTrusted).
591
+ - `js/nac-chat-client.js` -- a reference chat client that wires
592
+ voice + LLM + dispatcher.
593
+
594
+ Other implementations are welcome (Python for native automation
595
+ runners, Rust for embedded agents, etc). The spec, not the JS
596
+ code, is the authority.
597
+
598
+ ---
599
+
600
+ *This document is the canonical NAC3 v2.1 specification. Edits to
601
+ this file constitute spec changes and require an RFC; see
602
+ `CONTRIBUTING.md`.*