@nac3/runtime 2.5.0-alpha.5 → 2.5.1
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 +1051 -887
- package/README.md +145 -145
- package/SPEC.md +1783 -1442
- package/contract-head.json +16 -0
- package/dist/cli-levels.json +214 -0
- package/dist/cli-url.mjs +751 -0
- package/dist/cli.js +232 -38
- package/dist/nac-chat-client.d.ts +5 -75
- package/dist/nac-v2-extensions.d.ts +71 -68
- package/dist/nac.browser.js +118 -31
- package/dist/nac.cjs +118 -31
- package/dist/nac.d.ts +140 -34
- package/dist/nac.mjs +118 -31
- package/package.json +19 -19
package/dist/nac.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
// Generated by build.mjs -- do not edit.
|
|
2
|
-
//
|
|
1
|
+
// Generated by build.mjs -- do not edit. Source: js/nac.js
|
|
2
|
+
// Core runtime surface for @nac3/runtime v2.5.1.
|
|
3
|
+
// The data-table (dt_*) + brownfield primitives live in the
|
|
4
|
+
// extensions entry: import '@nac3/runtime/extensions' and see
|
|
5
|
+
// the NACExtensions interface in nac-v2-extensions.d.ts.
|
|
3
6
|
|
|
4
7
|
export interface NACError extends Error {
|
|
5
|
-
|
|
8
|
+
name: 'NacError';
|
|
9
|
+
code: 'not_found' | 'invalid' | 'timeout' | 'disabled'
|
|
10
|
+
| 'capability_required' | 'snapshot_stale' | 'version_required'
|
|
11
|
+
| 'no_matching_instance' | 'ambiguous_qualifier' | 'ambiguous_tab'
|
|
12
|
+
| 'ambiguous_label' | 'plugin_not_registered' | 'verb_not_declared'
|
|
13
|
+
| 'state_not_declared' | 'event_not_declared' | 'no_confirm_handler'
|
|
14
|
+
| string;
|
|
15
|
+
/** Populated on v2.4 strict-resolution failures (sec 5.4). */
|
|
16
|
+
candidates?: Array<{ nac_id: string; label: string }>;
|
|
6
17
|
}
|
|
7
18
|
|
|
8
19
|
export interface ManifestElement {
|
|
@@ -26,42 +37,137 @@ export interface Manifest {
|
|
|
26
37
|
[k: string]: unknown;
|
|
27
38
|
}
|
|
28
39
|
|
|
40
|
+
/** Opts accepted by every mutating verb (V24-04 OCC gate, sec 5.4 + 9). */
|
|
41
|
+
export interface MutateOpts {
|
|
42
|
+
source?: string;
|
|
43
|
+
timeout?: number;
|
|
44
|
+
expected_plugin_version?: number | string;
|
|
45
|
+
expected_tree_version?: number | string;
|
|
46
|
+
expected_element_state_hash?: string;
|
|
47
|
+
qualifier?: string;
|
|
48
|
+
qualifier_ordinal?: number;
|
|
49
|
+
[k: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ValidateGlobalReport {
|
|
53
|
+
ok: boolean;
|
|
54
|
+
duplicates: unknown[];
|
|
55
|
+
orphans: unknown[];
|
|
56
|
+
unmounted: unknown[];
|
|
57
|
+
convention_violations: unknown[];
|
|
58
|
+
plugin_instance_violations: unknown[];
|
|
59
|
+
plugin_count: number;
|
|
60
|
+
total_ids: number;
|
|
61
|
+
timestamp: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Subscription handle returned by NAC.subscribe (V25-01). */
|
|
65
|
+
export interface SubscriptionHandle {
|
|
66
|
+
__v25_sub: true;
|
|
67
|
+
id: number;
|
|
68
|
+
plugin: string;
|
|
69
|
+
event_path: string;
|
|
70
|
+
backend: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
29
73
|
export interface NACRuntime {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
74
|
+
__nac_v1_installed: true;
|
|
75
|
+
version: string;
|
|
76
|
+
spec_version: string;
|
|
77
|
+
|
|
78
|
+
/* v2.2 / v2.5 strict-mode flags */
|
|
79
|
+
STRICT_VALIDATION: boolean;
|
|
80
|
+
HARD_DEDUP: boolean;
|
|
81
|
+
STRICT_VERSIONING: boolean;
|
|
82
|
+
eager_hashing: boolean;
|
|
83
|
+
conformance_tier: string;
|
|
84
|
+
|
|
85
|
+
/* registry */
|
|
86
|
+
register(manifest: Manifest): void;
|
|
87
|
+
unregister(plugin_slug: string): void;
|
|
88
|
+
manifest(plugin_slug: string): Manifest | null;
|
|
89
|
+
/** v2.5 V24-02 -- idempotent (re)registration. */
|
|
90
|
+
syncPlugin(manifest: Manifest): { replaced: boolean; slug: string; version: number | string };
|
|
91
|
+
syncPlugin(slug: string, manifest: Manifest): { replaced: boolean; slug: string; version: number | string };
|
|
92
|
+
list_registered_plugins(): string[];
|
|
93
|
+
bindAction(...args: unknown[]): unknown;
|
|
94
|
+
bindTab(...args: unknown[]): unknown;
|
|
95
|
+
markHydrationComplete(): void;
|
|
96
|
+
versionHistory(): Array<{ tree_version: number | string; trigger: string; affected_plugins: string[] }>;
|
|
97
|
+
|
|
98
|
+
/* read / introspection */
|
|
99
|
+
describe(): { active: string | null; plugins: unknown[]; [k: string]: unknown };
|
|
100
|
+
list(...args: unknown[]): unknown;
|
|
101
|
+
find(...args: unknown[]): unknown;
|
|
102
|
+
read_feedback(...args: unknown[]): unknown;
|
|
103
|
+
snapshot_state(...args: unknown[]): unknown;
|
|
104
|
+
validate(...args: unknown[]): unknown;
|
|
105
|
+
validate_global(): ValidateGlobalReport;
|
|
106
|
+
is_blocked(): boolean;
|
|
107
|
+
|
|
108
|
+
/* imperative verbs (v2.0 baseline) */
|
|
109
|
+
click(nac_id: string, opts?: MutateOpts): Promise<{ ok: true }>;
|
|
110
|
+
fill(nac_id: string, value: string | number | boolean, opts?: MutateOpts): Promise<{ ok: true }>;
|
|
111
|
+
select(nac_id: string, option: string, opts?: MutateOpts): Promise<{ ok: true }>;
|
|
112
|
+
tab(plugin: string, tab_key?: string, opts?: MutateOpts): Promise<{ ok: true }>;
|
|
113
|
+
set_mode(mode: 'modal' | 'maximized' | 'new_tab' | 'new_window'): void;
|
|
36
114
|
go_to_section(nac_id: string): Promise<{ ok: true }>;
|
|
37
115
|
drag_drop(source_id: string, target_id: string, opts?: { to_index?: number }): Promise<{ ok: true }>;
|
|
38
|
-
|
|
116
|
+
|
|
117
|
+
/* v1.4.1 -- ergonomic resolution (v2.4 strict, sec 5.4) */
|
|
118
|
+
click_by_verb(plugin: string | null, verb: string, opts?: MutateOpts): Promise<{ ok: true }>;
|
|
119
|
+
tab_by_label(plugin: string | null, label: string, opts?: MutateOpts): Promise<{ ok: true }>;
|
|
120
|
+
|
|
121
|
+
/* v2.3 -- payload-bearing actions */
|
|
122
|
+
invoke(action_id: string, payload: object, opts?: MutateOpts): Promise<{ ok: true; request_id: string; ack: object | null }>;
|
|
123
|
+
utter(action_id: string, opts: { text: string; lang?: string; voice?: string; metadata?: object } & MutateOpts): Promise<{ ok: true; request_id: string; ack: object | null }>;
|
|
124
|
+
|
|
125
|
+
/* v2.3 -- field editor primitive */
|
|
126
|
+
edit_field(field_nac_id: string): void;
|
|
127
|
+
|
|
128
|
+
/* v2.3 -- auth-aware capabilities */
|
|
129
|
+
setCapabilities(arr: string | string[] | null): void;
|
|
130
|
+
grantCapability(cap: string): void;
|
|
131
|
+
revokeCapability(cap: string): void;
|
|
132
|
+
userCapabilities(): string[];
|
|
133
|
+
|
|
134
|
+
/* v2.5 V24-05 -- authority + sudo elevation */
|
|
135
|
+
set_confirm_handler(fn: (req: unknown) => boolean | Promise<boolean>): void;
|
|
136
|
+
confirm_action(action_id: string, message: unknown, opts?: { scope?: 'low' | 'medium' | 'high'; metadata?: object }): Promise<boolean>;
|
|
137
|
+
request_authority(scope: 'low' | 'medium' | 'high', ttl_ms: number, opts?: { metadata?: object }): Promise<{ granted: boolean; scope: string; expires_at: number | null }>;
|
|
138
|
+
has_authority(scope: string): boolean;
|
|
139
|
+
revoke_authority(scope: string): void;
|
|
140
|
+
|
|
141
|
+
/* v2.5 V25-01 Block A -- plugin extension contract (canvas + API) */
|
|
142
|
+
registerPlugin(slug: string, manifest: { verbs?: object; state?: object; events?: object }): void;
|
|
143
|
+
call(plugin: string, verb_path: string, args?: unknown): Promise<unknown>;
|
|
144
|
+
read(plugin: string, state_path: string): Promise<unknown>;
|
|
145
|
+
subscribe(plugin: string, event_path: string, cb: (...args: unknown[]) => void): SubscriptionHandle;
|
|
146
|
+
unsubscribe(handle: SubscriptionHandle): void;
|
|
147
|
+
|
|
148
|
+
/* v2.5 V25-03 Block C -- asistive labels */
|
|
149
|
+
narrate(plugin: string | null, nac_id: string): string | null;
|
|
150
|
+
|
|
151
|
+
/* v2.5 V25-02 Block B -- tree navigation */
|
|
152
|
+
context(plugin: string): { breadcrumb: Array<{ nac_id: string; label: string | null }> };
|
|
153
|
+
tree(plugin: string, rootId?: string): Array<{ nac_id: string; label: string | null; opens?: string; leaf?: true }>;
|
|
154
|
+
|
|
155
|
+
/* v2.5 V25-04 Block D -- effect detection */
|
|
156
|
+
expect(plugin: string, statePath: string, value: unknown, opts?: { timeout_ms?: number; poll_ms?: number; comparator?: (cur: unknown, want: unknown) => boolean }): Promise<unknown>;
|
|
157
|
+
diff(plugin: string, statePath: string, actionFn: () => unknown | Promise<unknown>): Promise<{ before: unknown; after: unknown; changed: boolean }>;
|
|
158
|
+
|
|
159
|
+
/* utility */
|
|
160
|
+
wait_for(...args: unknown[]): unknown;
|
|
39
161
|
screenshot(): Promise<string>;
|
|
40
|
-
register(manifest: Manifest): void;
|
|
41
|
-
manifest(plugin_slug: string): Manifest | null;
|
|
42
|
-
describe(): { active: string | null; plugins: unknown[] };
|
|
43
|
-
describe_v2?(): { v2_scope_entries: unknown[]; sitemap?: unknown; data_tables?: unknown[] };
|
|
44
|
-
validate_global(opts?: { probe?: boolean }): Array<{
|
|
45
|
-
severity: 'error' | 'warn' | 'info';
|
|
46
|
-
code: string;
|
|
47
|
-
nac_id: string | null;
|
|
48
|
-
message: string;
|
|
49
|
-
detail: Record<string, unknown>;
|
|
50
|
-
}>;
|
|
51
162
|
set_provenance_secret(secret: string): void;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
dt_select(table_id: string, target: unknown): { ok: true };
|
|
61
|
-
dt_commit(table_id: string): { ok: true; final_state: unknown } | { ok: false; errors: Array<{ code: string }> };
|
|
62
|
-
dt_discard(table_id: string): { ok: true };
|
|
63
|
-
dt_state(table_id: string): unknown;
|
|
64
|
-
dt_read_aggregate(table_id: string, agg_key: string, column: string): number | null;
|
|
163
|
+
|
|
164
|
+
errors: Record<string, string>;
|
|
165
|
+
config: { default_timeout_ms: number; [k: string]: unknown };
|
|
166
|
+
NacError(code: string, message?: string, extra?: object): NACError;
|
|
167
|
+
|
|
168
|
+
/* The runtime exposes many more v1.x widget primitives (toast,
|
|
169
|
+
stepper, calendar, chart, map, carousel, timeline, ...) and the
|
|
170
|
+
extensions module attaches the dt_* / brownfield surface. */
|
|
65
171
|
[k: string]: unknown;
|
|
66
172
|
}
|
|
67
173
|
|
package/dist/nac.mjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== 'undefined' ? window : {});
|
|
3
3
|
/* =====================================================================
|
|
4
4
|
NAC3 (Native Agent Contract v3) -- reference JavaScript runtime.
|
|
5
|
-
Spec:
|
|
6
|
-
|
|
5
|
+
Spec: SPEC.md (repo root). Public docs: yujin.app/nac-spec/.
|
|
6
|
+
Apache-2.0 License -- Pablo Adrian Kuschniroff + Sumi, 2026.
|
|
7
7
|
=====================================================================
|
|
8
8
|
|
|
9
9
|
AUTHORITATIVE VERSION CONSTANT: see the global.NAC export at the
|
|
10
|
-
bottom of this file. `version: '2.
|
|
11
|
-
the normative declaration. The dated changelog sections below are
|
|
10
|
+
bottom of this file. `version: '2.5.1', spec_version: '2.5'`
|
|
11
|
+
is the normative declaration. The dated changelog sections below are
|
|
12
12
|
historical notes; if they ever drift from the export, the export
|
|
13
13
|
wins.
|
|
14
14
|
|
|
@@ -1137,7 +1137,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
1137
1137
|
|
|
1138
1138
|
function _candidateLabel(el) {
|
|
1139
1139
|
/* Best-effort human label for a DOM element. Used in
|
|
1140
|
-
candidates[].label so voice/
|
|
1140
|
+
candidates[].label so voice/assistive can re-prompt. */
|
|
1141
1141
|
if (!el) return '';
|
|
1142
1142
|
const al = el.getAttribute && el.getAttribute('aria-label');
|
|
1143
1143
|
if (al) return String(al).trim();
|
|
@@ -2363,11 +2363,34 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
2363
2363
|
fields[], tabs[], kpis[], rows.cells[], breadcrumbs[], etc. */
|
|
2364
2364
|
function _collectManifestIds(m) {
|
|
2365
2365
|
const out = [];
|
|
2366
|
+
/* v2.5 fix (audit N-33): the CANONICAL manifest shape is
|
|
2367
|
+
`elements: [{ id, role, ... }]` -- that is what section 4
|
|
2368
|
+
documents, what every demo ships and what the rest of this
|
|
2369
|
+
runtime reads (see _capabilityFor, which walks
|
|
2370
|
+
m.elements.concat(m.tabs) by `.id`). This collector used to
|
|
2371
|
+
read ONLY the legacy groups below, keyed by `nac_id`, so for
|
|
2372
|
+
a manifest written the documented way it returned an empty
|
|
2373
|
+
list. Everything built on top went quietly wrong in the same
|
|
2374
|
+
direction: validate_global() reported total_ids = 0, called
|
|
2375
|
+
every declared element an orphan, could never report a
|
|
2376
|
+
duplicate, an unmounted id or a convention violation, and
|
|
2377
|
+
still answered ok = true. A validator that cannot see the
|
|
2378
|
+
manifest is not a lenient validator, it is a green light
|
|
2379
|
+
with nothing behind it. Both shapes are read now; the legacy
|
|
2380
|
+
groups stay because manifests in the wild still use them. */
|
|
2381
|
+
const elems = (m && m.elements) || [];
|
|
2382
|
+
elems.forEach(function (e) {
|
|
2383
|
+
if (e && e.id) out.push(String(e.id));
|
|
2384
|
+
});
|
|
2366
2385
|
const groups = ['actions', 'fields', 'tabs', 'kpis', 'charts'];
|
|
2367
2386
|
groups.forEach(function (g) {
|
|
2368
2387
|
const arr = (m && m[g]) || [];
|
|
2369
2388
|
arr.forEach(function (x) {
|
|
2389
|
+
/* tabs are declared with `.id` in the canonical shape and
|
|
2390
|
+
with `.nac_id` in the legacy one; take whichever is there
|
|
2391
|
+
instead of choosing a winner. */
|
|
2370
2392
|
if (x && x.nac_id) out.push(String(x.nac_id));
|
|
2393
|
+
else if (x && x.id) out.push(String(x.id));
|
|
2371
2394
|
});
|
|
2372
2395
|
});
|
|
2373
2396
|
if (m && m.rows && Array.isArray(m.rows.cells)) {
|
|
@@ -2384,7 +2407,14 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
2384
2407
|
}
|
|
2385
2408
|
});
|
|
2386
2409
|
}
|
|
2387
|
-
|
|
2410
|
+
/* Unique: an id declared in two shapes of the SAME manifest is one
|
|
2411
|
+
id, not a cross-plugin duplicate. */
|
|
2412
|
+
const seen = Object.create(null);
|
|
2413
|
+
return out.filter(function (id) {
|
|
2414
|
+
if (seen[id]) return false;
|
|
2415
|
+
seen[id] = true;
|
|
2416
|
+
return true;
|
|
2417
|
+
});
|
|
2388
2418
|
}
|
|
2389
2419
|
|
|
2390
2420
|
function unregister(slug) {
|
|
@@ -3489,23 +3519,45 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3489
3519
|
_focusElement(el);
|
|
3490
3520
|
const ft = el.getAttribute('data-nac-field-type');
|
|
3491
3521
|
|
|
3522
|
+
/* The native property setter, or null when this host has no such
|
|
3523
|
+
constructor (audit N-44).
|
|
3524
|
+
|
|
3525
|
+
Every call site below already had a fallback -- `el.value = v`
|
|
3526
|
+
when the descriptor has no setter -- and the fallback was
|
|
3527
|
+
UNREACHABLE in the only environment it was written for. The guard
|
|
3528
|
+
tested the descriptor and the expression reached through
|
|
3529
|
+
`window.HTMLInputElement.prototype` to produce it, so on a host
|
|
3530
|
+
with a partial DOM (a test shim, an SSR or headless context --
|
|
3531
|
+
the paths this runtime claims to support) fill() threw
|
|
3532
|
+
`Cannot read properties of undefined (reading 'prototype')`
|
|
3533
|
+
before any fallback could run. Worse than the crash: the thrown
|
|
3534
|
+
value is a raw TypeError with no `code`, so a caller relying on
|
|
3535
|
+
the error contract gets nothing it can branch on.
|
|
3536
|
+
|
|
3537
|
+
A real browser is unaffected: the constructors always exist,
|
|
3538
|
+
the descriptor is found, and the native setter is used exactly
|
|
3539
|
+
as before -- which is what keeps React's controlled inputs
|
|
3540
|
+
working. */
|
|
3541
|
+
const _nativeSetter = function (ctorName, prop) {
|
|
3542
|
+
var ctor = (typeof window !== 'undefined') ? window[ctorName] : undefined;
|
|
3543
|
+
if (!ctor || !ctor.prototype) return null;
|
|
3544
|
+
var d = Object.getOwnPropertyDescriptor(ctor.prototype, prop);
|
|
3545
|
+
return (d && d.set) ? d.set : null;
|
|
3546
|
+
};
|
|
3547
|
+
|
|
3492
3548
|
if (ft === 'checkbox' || ft === 'radio') {
|
|
3493
3549
|
/* React tracks `checked` similarly to `value`; use the native
|
|
3494
3550
|
setter so controlled checkboxes/radios update state. */
|
|
3495
|
-
var nativeCheckedSetter =
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
if (nativeCheckedSetter && nativeCheckedSetter.set) {
|
|
3499
|
-
nativeCheckedSetter.set.call(el, !!value);
|
|
3551
|
+
var nativeCheckedSetter = _nativeSetter('HTMLInputElement', 'checked');
|
|
3552
|
+
if (nativeCheckedSetter) {
|
|
3553
|
+
nativeCheckedSetter.call(el, !!value);
|
|
3500
3554
|
} else {
|
|
3501
3555
|
el.checked = !!value;
|
|
3502
3556
|
}
|
|
3503
3557
|
} else if (el.tagName === 'SELECT') {
|
|
3504
|
-
var nativeSelectSetter =
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
if (nativeSelectSetter && nativeSelectSetter.set) {
|
|
3508
|
-
nativeSelectSetter.set.call(el, String(value));
|
|
3558
|
+
var nativeSelectSetter = _nativeSetter('HTMLSelectElement', 'value');
|
|
3559
|
+
if (nativeSelectSetter) {
|
|
3560
|
+
nativeSelectSetter.call(el, String(value));
|
|
3509
3561
|
} else {
|
|
3510
3562
|
el.value = String(value);
|
|
3511
3563
|
}
|
|
@@ -3517,13 +3569,13 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3517
3569
|
tracks the original property setter on HTMLInputElement.prototype.
|
|
3518
3570
|
Use the native setter so React's onChange receives the new value
|
|
3519
3571
|
and updates its state. Works on plain DOM inputs unchanged. */
|
|
3520
|
-
var
|
|
3521
|
-
?
|
|
3522
|
-
|
|
3523
|
-
|
|
3572
|
+
var nativeValueSetter = _nativeSetter(
|
|
3573
|
+
(el.tagName === 'TEXTAREA') ? 'HTMLTextAreaElement' : 'HTMLInputElement',
|
|
3574
|
+
'value'
|
|
3575
|
+
);
|
|
3524
3576
|
var newVal = String(value == null ? '' : value);
|
|
3525
|
-
if (nativeValueSetter
|
|
3526
|
-
nativeValueSetter.
|
|
3577
|
+
if (nativeValueSetter) {
|
|
3578
|
+
nativeValueSetter.call(el, newVal);
|
|
3527
3579
|
} else {
|
|
3528
3580
|
el.value = newVal;
|
|
3529
3581
|
}
|
|
@@ -4630,16 +4682,36 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4630
4682
|
DOM that belong to no manifest?" The per-plugin validate(slug)
|
|
4631
4683
|
cannot see across boundaries; this one can.
|
|
4632
4684
|
|
|
4633
|
-
Returns
|
|
4685
|
+
Returns an OBJECT OF NAMED BUCKETS -- not a flat array of
|
|
4686
|
+
findings. Every item of every bucket carries `code` and
|
|
4687
|
+
`severity` since 2.5.0 (audit N-14), so a CI integration can
|
|
4688
|
+
gate on a code without parsing a message:
|
|
4634
4689
|
{
|
|
4635
4690
|
ok: boolean,
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4691
|
+
has_errors: boolean,
|
|
4692
|
+
duplicates: [{code nac_id_duplicate_across_plugins,
|
|
4693
|
+
severity error, nac_id, plugins:[...]}],
|
|
4694
|
+
orphans: [{code nac_id_orphan_in_dom, severity warn,
|
|
4695
|
+
nac_id, in_dom:true, in_manifest:false,
|
|
4696
|
+
plugin_root:?}],
|
|
4697
|
+
unmounted: [{code nac_id_declared_not_mounted,
|
|
4698
|
+
severity warn, nac_id, in_manifest:true,
|
|
4699
|
+
in_dom:false, plugin}],
|
|
4700
|
+
convention_violations:
|
|
4701
|
+
[{code nac_id_missing_plugin_prefix,
|
|
4702
|
+
severity warn, nac_id, plugin, hint}],
|
|
4703
|
+
plugin_instance_violations:
|
|
4704
|
+
[{code duplicate_plugin_no_instance_id,
|
|
4705
|
+
severity error, slug, ...}],
|
|
4706
|
+
tolerated: [{kind, nac_id, until, original}],
|
|
4640
4707
|
plugin_count, total_ids,
|
|
4641
4708
|
timestamp
|
|
4642
4709
|
}
|
|
4710
|
+
The five codes are published, with their severity and what to do
|
|
4711
|
+
about each, in api/latest/findings.json. (The code names above are
|
|
4712
|
+
written unquoted on purpose: the catalogue generator greps the
|
|
4713
|
+
emission shape out of this file, and a comment is not an
|
|
4714
|
+
emission.)
|
|
4643
4715
|
|
|
4644
4716
|
A NAC-3 codebase that wants drift to be a CI blocker should run
|
|
4645
4717
|
this in addition to the per-plugin validate(slug) loop. */
|
|
@@ -4678,6 +4750,13 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4678
4750
|
ids.forEach(function (id) {
|
|
4679
4751
|
if (id.indexOf(slug + '.') !== 0 && id !== slug) {
|
|
4680
4752
|
out.convention_violations.push({
|
|
4753
|
+
/* v2.5 / audit N-14: every finding of this validator carries
|
|
4754
|
+
a code from the published catalogue, so section 12 promise
|
|
4755
|
+
4 ("the validate_global finding codes will not be reused")
|
|
4756
|
+
covers a real set instead of an empty one. The code is the
|
|
4757
|
+
stable identity; the message is not. */
|
|
4758
|
+
code: 'nac_id_missing_plugin_prefix',
|
|
4759
|
+
severity: 'warn',
|
|
4681
4760
|
nac_id: id, plugin: slug,
|
|
4682
4761
|
hint: 'expected prefix "' + slug + '."',
|
|
4683
4762
|
});
|
|
@@ -4689,7 +4768,11 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4689
4768
|
/* Duplicates: any id that appears in 2+ manifests. */
|
|
4690
4769
|
for (const id in idIndex) {
|
|
4691
4770
|
if (idIndex[id].length >= 2) {
|
|
4692
|
-
out.duplicates.push({
|
|
4771
|
+
out.duplicates.push({
|
|
4772
|
+
code: 'nac_id_duplicate_across_plugins',
|
|
4773
|
+
severity: 'error',
|
|
4774
|
+
nac_id: id, plugins: idIndex[id].slice(),
|
|
4775
|
+
});
|
|
4693
4776
|
}
|
|
4694
4777
|
}
|
|
4695
4778
|
|
|
@@ -4710,6 +4793,8 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4710
4793
|
severity for the caller to decide. */
|
|
4711
4794
|
const root = el.closest('[data-nac-plugin]');
|
|
4712
4795
|
out.orphans.push({
|
|
4796
|
+
code: 'nac_id_orphan_in_dom',
|
|
4797
|
+
severity: 'warn',
|
|
4713
4798
|
nac_id: id,
|
|
4714
4799
|
in_dom: true,
|
|
4715
4800
|
in_manifest: false,
|
|
@@ -4723,6 +4808,8 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4723
4808
|
for (const id in idIndex) {
|
|
4724
4809
|
if (!inDom[id]) {
|
|
4725
4810
|
out.unmounted.push({
|
|
4811
|
+
code: 'nac_id_declared_not_mounted',
|
|
4812
|
+
severity: 'warn',
|
|
4726
4813
|
nac_id: id, in_manifest: true, in_dom: false,
|
|
4727
4814
|
plugin: idIndex[id][0],
|
|
4728
4815
|
});
|
|
@@ -7592,7 +7679,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7592
7679
|
}
|
|
7593
7680
|
|
|
7594
7681
|
/* ================================================================
|
|
7595
|
-
v2.5 Block C -- RFC V25-03:
|
|
7682
|
+
v2.5 Block C -- RFC V25-03: assistive labels (narrate)
|
|
7596
7683
|
================================================================
|
|
7597
7684
|
|
|
7598
7685
|
NAC.narrate(plugin, nac_id) -> string
|
|
@@ -7835,7 +7922,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7835
7922
|
|
|
7836
7923
|
global.NAC = {
|
|
7837
7924
|
__nac_v1_installed: true,
|
|
7838
|
-
version: '2.5.
|
|
7925
|
+
version: '2.5.1',
|
|
7839
7926
|
spec_version: '2.5',
|
|
7840
7927
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7841
7928
|
NAC.register throws on findings (manifest_role_unknown,
|
|
@@ -8086,7 +8173,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
8086
8173
|
read: read,
|
|
8087
8174
|
subscribe: subscribe,
|
|
8088
8175
|
unsubscribe: unsubscribe,
|
|
8089
|
-
/* v2.5 Block C --
|
|
8176
|
+
/* v2.5 Block C -- assistive labels (SPEC.md sec 17 / RFC V25-03).
|
|
8090
8177
|
Canonical human-readable label resolution for screen readers,
|
|
8091
8178
|
TTS, voice flows, audit logs. Priority order: aria-label >
|
|
8092
8179
|
visible text > data-nac-label > nac_id fallback. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nac3/runtime",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
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",
|
|
@@ -58,29 +58,29 @@
|
|
|
58
58
|
},
|
|
59
59
|
"files": [
|
|
60
60
|
"dist/",
|
|
61
|
-
"src/",
|
|
62
61
|
"README.md",
|
|
63
62
|
"LICENSE",
|
|
64
63
|
"SPEC.md",
|
|
65
|
-
"CHANGELOG.md"
|
|
64
|
+
"CHANGELOG.md",
|
|
65
|
+
"contract-head.json"
|
|
66
66
|
],
|
|
67
67
|
"scripts": {
|
|
68
|
-
"build":
|
|
69
|
-
"test":
|
|
70
|
-
"test:smoke":
|
|
71
|
-
"test:v22":
|
|
72
|
-
"test:v23":
|
|
73
|
-
"test:v23-shadow":
|
|
74
|
-
"test:v23-caps":
|
|
75
|
-
"test:v23-editor":
|
|
76
|
-
"test:v23-interop":
|
|
77
|
-
"test:stage2":
|
|
78
|
-
"test:stage7":
|
|
79
|
-
"test:stage8":
|
|
80
|
-
"test:stage9":
|
|
81
|
-
"test:stage10":
|
|
82
|
-
"test:stage11":
|
|
83
|
-
"prepublishOnly": "npm run build && npm test"
|
|
68
|
+
"build": "node ./build.mjs",
|
|
69
|
+
"test": "node ./test/smoke.mjs && node ./test/v22.mjs && node ./test/v23-invoke.mjs && node ./test/v23-shadow.mjs && node ./test/v23-capabilities.mjs && node ./test/v23-editor.mjs && node ./test/v23-interop.mjs && node ./test/stage2-disambiguation.mjs && node ./test/stage7-strict-resolution.mjs && node ./test/stage8-plugin-extension.mjs && node ./test/stage9-sync-plugin.mjs && node ./test/stage10-authority-sudo.mjs && node ./test/stage11-plugin-id-dedup.mjs && node ./test/stage12-snapshot-versioning.mjs",
|
|
70
|
+
"test:smoke": "node ./test/smoke.mjs",
|
|
71
|
+
"test:v22": "node ./test/v22.mjs",
|
|
72
|
+
"test:v23": "node ./test/v23-invoke.mjs",
|
|
73
|
+
"test:v23-shadow": "node ./test/v23-shadow.mjs",
|
|
74
|
+
"test:v23-caps": "node ./test/v23-capabilities.mjs",
|
|
75
|
+
"test:v23-editor": "node ./test/v23-editor.mjs",
|
|
76
|
+
"test:v23-interop": "node ./test/v23-interop.mjs",
|
|
77
|
+
"test:stage2": "node ./test/stage2-disambiguation.mjs",
|
|
78
|
+
"test:stage7": "node ./test/stage7-strict-resolution.mjs",
|
|
79
|
+
"test:stage8": "node ./test/stage8-plugin-extension.mjs",
|
|
80
|
+
"test:stage9": "node ./test/stage9-sync-plugin.mjs",
|
|
81
|
+
"test:stage10": "node ./test/stage10-authority-sudo.mjs",
|
|
82
|
+
"test:stage11": "node ./test/stage11-plugin-id-dedup.mjs",
|
|
83
|
+
"prepublishOnly": "npm run build && node ../scripts/check-version-coherence.mjs && npm test"
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": ">=18"
|