@nac3/runtime 2.5.2 → 2.8.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 +928 -0
- package/NOTICE +15 -0
- package/README.md +110 -3
- package/SPEC.md +1590 -25
- package/contract-head.json +4 -4
- package/dist/cli-harness.mjs +468 -0
- package/dist/cli-levels.json +56 -15
- package/dist/cli-lint.mjs +718 -24
- package/dist/cli-url.mjs +234 -80
- package/dist/cli.js +317 -12
- package/dist/dom-harness.mjs +578 -0
- package/dist/nac-chat-client.browser.js +47 -6
- package/dist/nac-chat-client.cjs +47 -6
- package/dist/nac-chat-client.mjs +47 -6
- package/dist/nac-v2-extensions.browser.js +359 -18
- package/dist/nac-v2-extensions.cjs +359 -18
- package/dist/nac-v2-extensions.d.ts +1 -1
- package/dist/nac-v2-extensions.mjs +359 -18
- package/dist/nac.browser.js +2482 -88
- package/dist/nac.cjs +2482 -88
- package/dist/nac.d.ts +131 -2
- package/dist/nac.mjs +2482 -88
- package/package.json +30 -3
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/README.md
CHANGED
|
@@ -14,8 +14,10 @@ npm install @nac3/runtime
|
|
|
14
14
|
- The v2.0 brownfield extensions (scope tree, ephemeral capture,
|
|
15
15
|
HMAC, isTrusted).
|
|
16
16
|
- A reference chat client that wires voice + LLM + dispatcher.
|
|
17
|
-
- A CLI (`npx nac validate <
|
|
18
|
-
|
|
17
|
+
- A CLI (`npx nac validate <target>`) with three modes: a static
|
|
18
|
+
lint over your markup, a **harness** mode that mounts a page in Node
|
|
19
|
+
and decides the conformance requirements that do not need a browser,
|
|
20
|
+
and a URL mode that drives a real one.
|
|
19
21
|
- TypeScript types.
|
|
20
22
|
|
|
21
23
|
## Hello world (vanilla)
|
|
@@ -86,11 +88,17 @@ export function Greet() {
|
|
|
86
88
|
|
|
87
89
|
## CLI
|
|
88
90
|
|
|
91
|
+
Three modes, and they do not pretend to be each other.
|
|
92
|
+
|
|
93
|
+
### 1. Static lint -- reads files, executes nothing
|
|
94
|
+
|
|
89
95
|
```
|
|
90
96
|
npx @nac3/runtime validate ./src
|
|
91
97
|
```
|
|
92
98
|
|
|
93
|
-
|
|
99
|
+
It reads 28 markup and template extensions (`--ext=.foo` adds more),
|
|
100
|
+
**says how many files it read**, and refuses when it read none -- a
|
|
101
|
+
tree it could not open must not look like a conforming one. Reports:
|
|
94
102
|
|
|
95
103
|
- `tab_role_drift` -- a `data-nac-id="tab.X"` without
|
|
96
104
|
`data-nac-role="tab"`.
|
|
@@ -101,12 +109,70 @@ Static lint over your HTML/PHP. Reports:
|
|
|
101
109
|
- `tab_id_manifest_role_drift` -- manifest entry id like `tab.X`
|
|
102
110
|
but the entry's role isn't `'tab'`.
|
|
103
111
|
|
|
112
|
+
- `no_lintable_files` -- it read ZERO files, so it is reporting
|
|
113
|
+
nothing about this tree. Not the same as a clean tree, and it says
|
|
114
|
+
so instead of printing `Total findings: 0`.
|
|
115
|
+
|
|
104
116
|
Exit codes:
|
|
105
117
|
|
|
106
118
|
- `0` -- no findings at the configured severity (default `error`).
|
|
107
119
|
- `1` -- findings at or above the configured severity.
|
|
108
120
|
- `2` -- target not found / argument error.
|
|
109
121
|
|
|
122
|
+
### 2. Harness -- mounts the page in Node
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
npx @nac3/runtime validate ./page.html --harness --requirements
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
It parses the markup into a synthesised document, loads the runtime,
|
|
129
|
+
**runs the page's own scripts** in a sandbox with no network, and then
|
|
130
|
+
asks the runtime the same questions the browser mode asks -- with the
|
|
131
|
+
same observer and the same decider table, so the two modes cannot form
|
|
132
|
+
two opinions about what the contract says.
|
|
133
|
+
|
|
134
|
+
Of the eleven requirements of SPEC.md section 8 it **decides five** and
|
|
135
|
+
**declares the other six**, each with the reason it cannot:
|
|
136
|
+
|
|
137
|
+
- three are a human judgement no tool makes (which widgets an agent
|
|
138
|
+
*should* be able to operate is the author's call);
|
|
139
|
+
- two are behavioural -- the completion event comes from your handler,
|
|
140
|
+
so they need the page driven (`--drive`, mode 3);
|
|
141
|
+
- and one is `validate_global({probe: true})`, which asks the document
|
|
142
|
+
whether an element is *reachable*. A synthesised document answers
|
|
143
|
+
whatever its stub decides, not what a browser would, so deciding it
|
|
144
|
+
here would be measuring the stub.
|
|
145
|
+
|
|
146
|
+
A mode that decided eleven of eleven would be lying about at least one
|
|
147
|
+
of them. What it *can* decide it decides for real, including in the
|
|
148
|
+
negative: an id your manifest advertises that nothing paints makes
|
|
149
|
+
"`NAC.click(id)` works for every advertised id" **false** without
|
|
150
|
+
driving anything.
|
|
151
|
+
|
|
152
|
+
It **executes your page**, which is the difference between this mode
|
|
153
|
+
and the lint above. The lint still touches nothing.
|
|
154
|
+
|
|
155
|
+
Exit codes:
|
|
156
|
+
|
|
157
|
+
- `0` -- nothing decidable fails at level 1 (the normal answer: no
|
|
158
|
+
level can be *asserted* from Node, and that is not a failure of your
|
|
159
|
+
page).
|
|
160
|
+
- `1` -- a level 1 requirement was decided to FAIL. A decided failure
|
|
161
|
+
at level 2 or 3 is printed and does not fail the run: a page that
|
|
162
|
+
never aimed at level 3 is not broken for lacking an HMAC.
|
|
163
|
+
- `2` -- nothing to mount, or more than one page and no `index`.
|
|
164
|
+
|
|
165
|
+
### 3. URL -- drives a real browser
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
npx @nac3/runtime validate https://example.org/app --drive
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Needs Playwright, which is **not** a dependency of this package
|
|
172
|
+
(`npm i -D playwright && npx playwright install chromium`). This is
|
|
173
|
+
the only mode that can report a conformance level, because three of
|
|
174
|
+
the four requirements of level 1 are about what the page DOES.
|
|
175
|
+
|
|
110
176
|
## Subpath imports
|
|
111
177
|
|
|
112
178
|
```js
|
|
@@ -135,6 +201,47 @@ import '@nac3/runtime/chat-client'; // reference voice + chat client
|
|
|
135
201
|
|
|
136
202
|
Apache-2.0. See `LICENSE`.
|
|
137
203
|
|
|
204
|
+
## What the tarball contains
|
|
205
|
+
|
|
206
|
+
`npm install @nac3/runtime` gives you the **built** artefacts and the
|
|
207
|
+
documents that describe them -- nothing else:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
dist/ the runtime, the extensions, the chat client, the CLI
|
|
211
|
+
README.md LICENSE NOTICE SPEC.md CHANGELOG.md contract-head.json
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
That is the whole published file set (`files` in `package.json`), and
|
|
215
|
+
it is deliberate: what an adopter needs is the artefact plus the text
|
|
216
|
+
that governs it.
|
|
217
|
+
|
|
218
|
+
**So two of the package's own scripts do not work from an install, and
|
|
219
|
+
that is by design rather than an oversight:**
|
|
220
|
+
|
|
221
|
+
| Script | Needs |
|
|
222
|
+
|---|---|
|
|
223
|
+
| `npm run build` | the repository -- it reads `js/nac.js` (the authoritative version constant), `SPEC.md` and `scripts/`, none of which ship |
|
|
224
|
+
| `npm test` | the repository -- the 22-suite battery lives in `test/`, which does not ship |
|
|
225
|
+
|
|
226
|
+
`prepublishOnly` and `postpublish` reach `../scripts/` for the same
|
|
227
|
+
reason. They only ever run on `npm publish`, which only happens from a
|
|
228
|
+
checkout, so they are correct where they run and impossible anywhere
|
|
229
|
+
else.
|
|
230
|
+
|
|
231
|
+
To build or test, clone the repository:
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
git clone https://github.com/yujinapp/nac-spec.git
|
|
235
|
+
cd nac-spec/runtime
|
|
236
|
+
npm run build
|
|
237
|
+
npm test
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
This section is not a convention anyone has to remember:
|
|
241
|
+
`test/battery-coverage.mjs` refuses a `package.json` with a script
|
|
242
|
+
that reaches outside the published file set without a written reason,
|
|
243
|
+
and it checks that this heading still exists.
|
|
244
|
+
|
|
138
245
|
## Repository
|
|
139
246
|
|
|
140
247
|
[github.com/yujinapp/nac-spec](https://github.com/yujinapp/nac-spec)
|