@nac3/runtime 2.8.0 → 2.9.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 +198 -0
- package/README.md +10 -0
- package/SPEC.md +45 -4
- package/contract-head.json +4 -4
- package/dist/cli-levels.json +2 -2
- package/dist/cli-lint.mjs +255 -6
- package/dist/cli.js +6 -3
- package/dist/nac-chat-client.browser.js +19 -6
- package/dist/nac-chat-client.cjs +19 -6
- package/dist/nac-chat-client.mjs +19 -6
- package/dist/nac-mcp-interop.browser.js +636 -0
- package/dist/nac-mcp-interop.cjs +641 -0
- package/dist/nac-mcp-interop.d.ts +57 -0
- package/dist/nac-mcp-interop.mjs +641 -0
- package/dist/nac-v2-extensions.d.ts +1 -1
- package/dist/nac.browser.js +304 -69
- package/dist/nac.cjs +304 -69
- package/dist/nac.d.ts +1 -1
- package/dist/nac.mjs +304 -69
- package/package.json +28 -10
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* =====================================================================
|
|
3
|
-
NAC CLI v2.
|
|
3
|
+
NAC CLI v2.9.1 -- the entry point.
|
|
4
4
|
|
|
5
5
|
THREE modes since 2026-11-27, and they do not pretend to be each
|
|
6
6
|
other:
|
|
@@ -52,8 +52,8 @@ import fs from 'node:fs';
|
|
|
52
52
|
import path from 'node:path';
|
|
53
53
|
import { lintTree, manifestInventory, lintableFiles, LINT_EXTENSIONS } from './cli-lint.mjs';
|
|
54
54
|
|
|
55
|
-
const VERSION = '2.
|
|
56
|
-
const SPEC_VERSION = '2.
|
|
55
|
+
const VERSION = '2.9.1';
|
|
56
|
+
const SPEC_VERSION = '2.9';
|
|
57
57
|
|
|
58
58
|
const args = process.argv.slice(2);
|
|
59
59
|
const cmd = args[0];
|
|
@@ -100,6 +100,9 @@ function showHelp() {
|
|
|
100
100
|
console.log(' and report a verdict per conformance requirement.');
|
|
101
101
|
console.log(' It executes the page in a sandbox with no network;');
|
|
102
102
|
console.log(' the plain directory mode never executes anything.');
|
|
103
|
+
console.log(' A Node vm is NOT a security boundary: do not point');
|
|
104
|
+
console.log(' --harness at HTML you do not trust. Use the plain');
|
|
105
|
+
console.log(' directory mode for that -- it only reads bytes.');
|
|
103
106
|
console.log(' --requirements with --harness: the full breakdown, all 11 of them,');
|
|
104
107
|
console.log(' each DECIDED (pass/fail) or NOT-DECIDABLE with why');
|
|
105
108
|
console.log(' --ext=.a,.b ALSO read these extensions in directory mode.');
|
|
@@ -198,6 +198,19 @@
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/* ---------- DOM helpers ---------- */
|
|
201
|
+
/* 2.9.1 -- a nac_id arrives here from the intermediary's answer, so
|
|
202
|
+
it is outside data on its way into a quoted attribute selector. A
|
|
203
|
+
double quote closed the selector and the browser answered with a
|
|
204
|
+
raw DOMException. Escapes the only two characters that can break
|
|
205
|
+
out of a CSS string; see _nac_attrValue in js/nac.js for the long
|
|
206
|
+
form of why it is not CSS.escape(). */
|
|
207
|
+
function _nacAttrValue(value) {
|
|
208
|
+
return String(value)
|
|
209
|
+
.replace(/[\\"]/g, function (c) { return '\\' + c; })
|
|
210
|
+
.replace(/[\n\r\f]/g, function (c) {
|
|
211
|
+
return '\\' + c.charCodeAt(0).toString(16) + ' ';
|
|
212
|
+
});
|
|
213
|
+
}
|
|
201
214
|
function $(sel, root) { return (root || document).querySelector(sel); }
|
|
202
215
|
function _bubble(role, text) {
|
|
203
216
|
if (!NacChat._chatLog) return;
|
|
@@ -349,7 +362,7 @@
|
|
|
349
362
|
effect; we just don't wait for the conformance ack. */
|
|
350
363
|
function _directClick(nacId) {
|
|
351
364
|
if (!nacId) throw new Error('click: nac_id required');
|
|
352
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
365
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
353
366
|
if (!el) throw new Error('click: element not found ' + nacId);
|
|
354
367
|
try { el.click(); return { ok: true, dispatched: 'direct' }; }
|
|
355
368
|
catch (e) { throw new Error('click threw: ' + (e && e.message)); }
|
|
@@ -368,9 +381,9 @@
|
|
|
368
381
|
/* Fallback: walk the DOM looking for an element under this
|
|
369
382
|
plugin whose data-nac-action matches the verb. */
|
|
370
383
|
var root = plugin
|
|
371
|
-
? document.querySelector('[data-nac-plugin="' + plugin + '"]')
|
|
384
|
+
? document.querySelector('[data-nac-plugin="' + _nacAttrValue(plugin) + '"]')
|
|
372
385
|
: document;
|
|
373
|
-
var hit = root && root.querySelector('[data-nac-action="' + verb + '"][data-nac-id]');
|
|
386
|
+
var hit = root && root.querySelector('[data-nac-action="' + _nacAttrValue(verb) + '"][data-nac-id]');
|
|
374
387
|
if (!hit) throw new Error('click_by_verb: no nac_id for verb=' + verb + ' plugin=' + plugin);
|
|
375
388
|
try { hit.click(); return { ok: true, dispatched: 'direct_dom_walk' }; }
|
|
376
389
|
catch (e) { throw new Error('click_by_verb threw: ' + e.message); }
|
|
@@ -379,7 +392,7 @@
|
|
|
379
392
|
}
|
|
380
393
|
function _directFill(nacId, value) {
|
|
381
394
|
if (!nacId) throw new Error('fill: nac_id required');
|
|
382
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
395
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
383
396
|
if (!el) throw new Error('fill: element not found ' + nacId);
|
|
384
397
|
try {
|
|
385
398
|
el.focus();
|
|
@@ -391,7 +404,7 @@
|
|
|
391
404
|
}
|
|
392
405
|
function _directSelect(nacId, value) {
|
|
393
406
|
if (!nacId) throw new Error('select: nac_id required');
|
|
394
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
407
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
395
408
|
if (!el) throw new Error('select: element not found ' + nacId);
|
|
396
409
|
try {
|
|
397
410
|
if (el.tagName === 'SELECT') {
|
|
@@ -399,7 +412,7 @@
|
|
|
399
412
|
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
400
413
|
} else {
|
|
401
414
|
/* radio/checkbox: find the option with matching value */
|
|
402
|
-
var opt = el.querySelector('[value="' + value + '"]');
|
|
415
|
+
var opt = el.querySelector('[value="' + _nacAttrValue(value) + '"]');
|
|
403
416
|
if (opt) {
|
|
404
417
|
opt.checked = true;
|
|
405
418
|
opt.dispatchEvent(new Event('change', { bubbles: true }));
|
package/dist/nac-chat-client.cjs
CHANGED
|
@@ -199,6 +199,19 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
/* ---------- DOM helpers ---------- */
|
|
202
|
+
/* 2.9.1 -- a nac_id arrives here from the intermediary's answer, so
|
|
203
|
+
it is outside data on its way into a quoted attribute selector. A
|
|
204
|
+
double quote closed the selector and the browser answered with a
|
|
205
|
+
raw DOMException. Escapes the only two characters that can break
|
|
206
|
+
out of a CSS string; see _nac_attrValue in js/nac.js for the long
|
|
207
|
+
form of why it is not CSS.escape(). */
|
|
208
|
+
function _nacAttrValue(value) {
|
|
209
|
+
return String(value)
|
|
210
|
+
.replace(/[\\"]/g, function (c) { return '\\' + c; })
|
|
211
|
+
.replace(/[\n\r\f]/g, function (c) {
|
|
212
|
+
return '\\' + c.charCodeAt(0).toString(16) + ' ';
|
|
213
|
+
});
|
|
214
|
+
}
|
|
202
215
|
function $(sel, root) { return (root || document).querySelector(sel); }
|
|
203
216
|
function _bubble(role, text) {
|
|
204
217
|
if (!NacChat._chatLog) return;
|
|
@@ -350,7 +363,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
350
363
|
effect; we just don't wait for the conformance ack. */
|
|
351
364
|
function _directClick(nacId) {
|
|
352
365
|
if (!nacId) throw new Error('click: nac_id required');
|
|
353
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
366
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
354
367
|
if (!el) throw new Error('click: element not found ' + nacId);
|
|
355
368
|
try { el.click(); return { ok: true, dispatched: 'direct' }; }
|
|
356
369
|
catch (e) { throw new Error('click threw: ' + (e && e.message)); }
|
|
@@ -369,9 +382,9 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
369
382
|
/* Fallback: walk the DOM looking for an element under this
|
|
370
383
|
plugin whose data-nac-action matches the verb. */
|
|
371
384
|
var root = plugin
|
|
372
|
-
? document.querySelector('[data-nac-plugin="' + plugin + '"]')
|
|
385
|
+
? document.querySelector('[data-nac-plugin="' + _nacAttrValue(plugin) + '"]')
|
|
373
386
|
: document;
|
|
374
|
-
var hit = root && root.querySelector('[data-nac-action="' + verb + '"][data-nac-id]');
|
|
387
|
+
var hit = root && root.querySelector('[data-nac-action="' + _nacAttrValue(verb) + '"][data-nac-id]');
|
|
375
388
|
if (!hit) throw new Error('click_by_verb: no nac_id for verb=' + verb + ' plugin=' + plugin);
|
|
376
389
|
try { hit.click(); return { ok: true, dispatched: 'direct_dom_walk' }; }
|
|
377
390
|
catch (e) { throw new Error('click_by_verb threw: ' + e.message); }
|
|
@@ -380,7 +393,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
380
393
|
}
|
|
381
394
|
function _directFill(nacId, value) {
|
|
382
395
|
if (!nacId) throw new Error('fill: nac_id required');
|
|
383
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
396
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
384
397
|
if (!el) throw new Error('fill: element not found ' + nacId);
|
|
385
398
|
try {
|
|
386
399
|
el.focus();
|
|
@@ -392,7 +405,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
392
405
|
}
|
|
393
406
|
function _directSelect(nacId, value) {
|
|
394
407
|
if (!nacId) throw new Error('select: nac_id required');
|
|
395
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
408
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
396
409
|
if (!el) throw new Error('select: element not found ' + nacId);
|
|
397
410
|
try {
|
|
398
411
|
if (el.tagName === 'SELECT') {
|
|
@@ -400,7 +413,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
400
413
|
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
401
414
|
} else {
|
|
402
415
|
/* radio/checkbox: find the option with matching value */
|
|
403
|
-
var opt = el.querySelector('[value="' + value + '"]');
|
|
416
|
+
var opt = el.querySelector('[value="' + _nacAttrValue(value) + '"]');
|
|
404
417
|
if (opt) {
|
|
405
418
|
opt.checked = true;
|
|
406
419
|
opt.dispatchEvent(new Event('change', { bubbles: true }));
|
package/dist/nac-chat-client.mjs
CHANGED
|
@@ -199,6 +199,19 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
/* ---------- DOM helpers ---------- */
|
|
202
|
+
/* 2.9.1 -- a nac_id arrives here from the intermediary's answer, so
|
|
203
|
+
it is outside data on its way into a quoted attribute selector. A
|
|
204
|
+
double quote closed the selector and the browser answered with a
|
|
205
|
+
raw DOMException. Escapes the only two characters that can break
|
|
206
|
+
out of a CSS string; see _nac_attrValue in js/nac.js for the long
|
|
207
|
+
form of why it is not CSS.escape(). */
|
|
208
|
+
function _nacAttrValue(value) {
|
|
209
|
+
return String(value)
|
|
210
|
+
.replace(/[\\"]/g, function (c) { return '\\' + c; })
|
|
211
|
+
.replace(/[\n\r\f]/g, function (c) {
|
|
212
|
+
return '\\' + c.charCodeAt(0).toString(16) + ' ';
|
|
213
|
+
});
|
|
214
|
+
}
|
|
202
215
|
function $(sel, root) { return (root || document).querySelector(sel); }
|
|
203
216
|
function _bubble(role, text) {
|
|
204
217
|
if (!NacChat._chatLog) return;
|
|
@@ -350,7 +363,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
350
363
|
effect; we just don't wait for the conformance ack. */
|
|
351
364
|
function _directClick(nacId) {
|
|
352
365
|
if (!nacId) throw new Error('click: nac_id required');
|
|
353
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
366
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
354
367
|
if (!el) throw new Error('click: element not found ' + nacId);
|
|
355
368
|
try { el.click(); return { ok: true, dispatched: 'direct' }; }
|
|
356
369
|
catch (e) { throw new Error('click threw: ' + (e && e.message)); }
|
|
@@ -369,9 +382,9 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
369
382
|
/* Fallback: walk the DOM looking for an element under this
|
|
370
383
|
plugin whose data-nac-action matches the verb. */
|
|
371
384
|
var root = plugin
|
|
372
|
-
? document.querySelector('[data-nac-plugin="' + plugin + '"]')
|
|
385
|
+
? document.querySelector('[data-nac-plugin="' + _nacAttrValue(plugin) + '"]')
|
|
373
386
|
: document;
|
|
374
|
-
var hit = root && root.querySelector('[data-nac-action="' + verb + '"][data-nac-id]');
|
|
387
|
+
var hit = root && root.querySelector('[data-nac-action="' + _nacAttrValue(verb) + '"][data-nac-id]');
|
|
375
388
|
if (!hit) throw new Error('click_by_verb: no nac_id for verb=' + verb + ' plugin=' + plugin);
|
|
376
389
|
try { hit.click(); return { ok: true, dispatched: 'direct_dom_walk' }; }
|
|
377
390
|
catch (e) { throw new Error('click_by_verb threw: ' + e.message); }
|
|
@@ -380,7 +393,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
380
393
|
}
|
|
381
394
|
function _directFill(nacId, value) {
|
|
382
395
|
if (!nacId) throw new Error('fill: nac_id required');
|
|
383
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
396
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
384
397
|
if (!el) throw new Error('fill: element not found ' + nacId);
|
|
385
398
|
try {
|
|
386
399
|
el.focus();
|
|
@@ -392,7 +405,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
392
405
|
}
|
|
393
406
|
function _directSelect(nacId, value) {
|
|
394
407
|
if (!nacId) throw new Error('select: nac_id required');
|
|
395
|
-
var el = document.querySelector('[data-nac-id="' + nacId + '"]');
|
|
408
|
+
var el = document.querySelector('[data-nac-id="' + _nacAttrValue(nacId) + '"]');
|
|
396
409
|
if (!el) throw new Error('select: element not found ' + nacId);
|
|
397
410
|
try {
|
|
398
411
|
if (el.tagName === 'SELECT') {
|
|
@@ -400,7 +413,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
400
413
|
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
401
414
|
} else {
|
|
402
415
|
/* radio/checkbox: find the option with matching value */
|
|
403
|
-
var opt = el.querySelector('[value="' + value + '"]');
|
|
416
|
+
var opt = el.querySelector('[value="' + _nacAttrValue(value) + '"]');
|
|
404
417
|
if (opt) {
|
|
405
418
|
opt.checked = true;
|
|
406
419
|
opt.dispatchEvent(new Event('change', { bubbles: true }));
|