@kinti/a11y-toolkit 5.25.2 → 5.27.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/README.md +1 -1
- package/a11y_toolkit/a11y.py +31 -4
- package/a11y_toolkit/a11yact.py +9 -1
- package/a11y_toolkit/a11yannotate.py +185 -0
- package/a11y_toolkit/a11yaudit.py +903 -186
- package/a11y_toolkit/a11ybadge.py +24 -17
- package/a11y_toolkit/a11ybudget.py +145 -1
- package/a11y_toolkit/a11ycorpus.py +58 -24
- package/a11y_toolkit/a11ycrit.py +110 -53
- package/a11y_toolkit/a11ydiff.py +104 -34
- package/a11y_toolkit/a11ydisprove.py +15 -8
- package/a11y_toolkit/a11ydocx.py +8 -6
- package/a11y_toolkit/a11ydom.py +451 -96
- package/a11y_toolkit/a11yen301549.py +147 -0
- package/a11y_toolkit/a11yengines.py +157 -0
- package/a11y_toolkit/a11yevidence.py +182 -36
- package/a11y_toolkit/a11yfix.py +131 -52
- package/a11y_toolkit/a11yinit.py +30 -5
- package/a11y_toolkit/a11yjourney.py +110 -4
- package/a11y_toolkit/a11yledger.py +119 -12
- package/a11y_toolkit/a11ylocate.py +247 -0
- package/a11y_toolkit/a11yopenacr.py +28 -7
- package/a11y_toolkit/a11ypatches.py +154 -0
- package/a11y_toolkit/a11ypatterns.py +344 -0
- package/a11y_toolkit/a11ypdf.py +109 -53
- package/a11y_toolkit/a11yrgaa.py +60 -0
- package/a11y_toolkit/a11yroute.py +34 -12
- package/a11y_toolkit/a11ysarif.py +70 -21
- package/a11y_toolkit/a11yscope.py +296 -0
- package/a11y_toolkit/a11yscroll.py +7 -5
- package/a11y_toolkit/a11ystatement.py +30 -6
- package/a11y_toolkit/a11ytrace.py +293 -0
- package/a11y_toolkit/a11yvalidate.py +21 -15
- package/a11y_toolkit/a11yvpat.py +54 -11
- package/a11y_toolkit/a11yvtt.py +22 -6
- package/a11y_toolkit/a11ywiz.py +121 -0
- package/a11y_toolkit/contrast.py +62 -24
- package/a11y_toolkit/locales/en.json +222 -24
- package/a11y_toolkit/locales/es.json +223 -25
- package/a11y_toolkit/rgaa.json +2661 -0
- package/a11y_toolkit/server.py +247 -59
- package/package.json +2 -2
- package/a11y_toolkit/a11yplan.py +0 -214
- package/a11y_toolkit/a11ywcagem.py +0 -237
package/a11y_toolkit/server.py
CHANGED
|
@@ -13,6 +13,10 @@ Tools:
|
|
|
13
13
|
- a11y_suggest_color(fg, bg, target?) nearest passing color
|
|
14
14
|
- a11y_generate_declaration(...) legal statement RD 1112/2018 / EAA
|
|
15
15
|
- a11y_snapshot(url) interactive elements + tab order
|
|
16
|
+
- a11y_locate(html, query, role?, multiple?) element by accessible name →
|
|
17
|
+
deterministic route, honest refusal
|
|
18
|
+
- a11y_patches(html, lang?) sealed patch-set of the
|
|
19
|
+
deterministic fixes (sha-keyed)
|
|
16
20
|
- a11y_diff(a, b) regression diff between snapshots
|
|
17
21
|
- a11y_diff_urls(url_a, url_b) staging vs production in one call
|
|
18
22
|
- a11y_aria_live_snippet(lang?) injectable live-region monitor
|
|
@@ -26,6 +30,7 @@ Tools:
|
|
|
26
30
|
- a11y_hover(url, …) tooltip Escape dismissibility (1.4.13)
|
|
27
31
|
- a11y_sr_transcript(url, …) what a blind user hears, linearized
|
|
28
32
|
- a11y_journey_verdict(task, steps, outcome) blindfold task verdict: friction log → scored evidence
|
|
33
|
+
(seal=true → the sha-sealed a11y-journey/1 record)
|
|
29
34
|
- a11y_vtt_check(url, …) caption CONTENT quality (1.2.2)
|
|
30
35
|
- a11y_audit_pdf(path) PDF structural screening — nobody automated it
|
|
31
36
|
- a11y_docx_screen(path) DOCX structural screening (alt, fake headings, lang, table headers)
|
|
@@ -41,9 +46,11 @@ Tools:
|
|
|
41
46
|
- a11y_wcag3_preview(report, lang?) re-group findings under the WCAG 3
|
|
42
47
|
Working Draft outcomes (no score)
|
|
43
48
|
- a11y_route(goal, lang?) the router: goal → ordered tools (start here)
|
|
49
|
+
- a11y_scope(reports, standard?, …) applicability scope: machine proposes,
|
|
50
|
+
human confirms (EN 301 549 clauses)
|
|
44
51
|
|
|
45
52
|
Prompts: audit-page, fix-contrast, pre-deploy-check, declaration-eaa,
|
|
46
|
-
|
|
53
|
+
blindfold-task.
|
|
47
54
|
|
|
48
55
|
Register in an MCP client (no clone needed):
|
|
49
56
|
|
|
@@ -66,8 +73,10 @@ from .a11yscroll import audit_scroll # noqa: E402
|
|
|
66
73
|
from .a11yvalidate import validate_url, validate_html # noqa: E402
|
|
67
74
|
from .a11yevidence import build_pack as build_pack_fn # noqa: E402
|
|
68
75
|
from .a11ydiff import snapshot as snapshot_fn, diff as diff_fn # noqa: E402
|
|
76
|
+
from .a11ylocate import locate as locate_fn # noqa: E402
|
|
77
|
+
from .a11ypatches import build as patches_build_fn, apply_patches as patches_apply_fn # noqa: E402
|
|
69
78
|
from .a11ycrit import criterion as criterion_fn # noqa: E402
|
|
70
|
-
from .a11yjourney import verdict as journey_verdict_fn # noqa: E402
|
|
79
|
+
from .a11yjourney import verdict as journey_verdict_fn, seal_record as journey_seal_fn, record_verify as journey_verify_fn # noqa: E402
|
|
71
80
|
from .a11yvtt import vtt_check as vtt_check_fn # noqa: E402
|
|
72
81
|
from .a11ypdf import pdf_screen as pdf_screen_fn # noqa: E402
|
|
73
82
|
from .a11ydocx import docx_screen as docx_screen_fn # noqa: E402
|
|
@@ -81,13 +90,14 @@ from .a11yopenacr import generate_openacr as openacr_fn # noqa: E402
|
|
|
81
90
|
from .a11ydom import contrast_dom as contrast_dom_fn # noqa: E402
|
|
82
91
|
from .a11ywcag3 import preview as wcag3_preview_fn # noqa: E402
|
|
83
92
|
from .a11yroute import route as route_fn # noqa: E402
|
|
93
|
+
from .a11yscope import build_scope as scope_fn # noqa: E402
|
|
84
94
|
|
|
85
95
|
try:
|
|
86
96
|
from .arialive_js import ARIALIVE_JS # installed as a module (pip)
|
|
87
97
|
except ImportError:
|
|
88
98
|
ARIALIVE_JS = None # repo checkout: read the file
|
|
89
99
|
|
|
90
|
-
VERSION = '5.
|
|
100
|
+
VERSION = '5.27.0'
|
|
91
101
|
|
|
92
102
|
# Params renombrados a inglés en 5.11.0; se aceptan los nombres previos.
|
|
93
103
|
PARAM_ALIASES = {
|
|
@@ -127,7 +137,7 @@ TOOLS = [
|
|
|
127
137
|
{
|
|
128
138
|
'name': 'a11y_audit_url',
|
|
129
139
|
'description': ('Express WCAG 2.2 audit of a URL or an HTML string: 20+ automated '
|
|
130
|
-
'signals with a weighted 0-100 score — images without alt (1.1.1), '
|
|
140
|
+
'signals with a weighted 0-100 score — images without alt (1.1.1), low-quality alt text (filenames, generics, placeholders; also 1.1.1), '
|
|
131
141
|
'controls without accessible names (4.1.2), form fields without labels '
|
|
132
142
|
'(3.3.2), missing autocomplete on user-data fields (1.3.5), click '
|
|
133
143
|
'handlers on non-interactive elements (2.1.1), unknown ARIA roles and '
|
|
@@ -146,8 +156,46 @@ TOOLS = [
|
|
|
146
156
|
'pages': {'type': 'integer', 'minimum': 1, 'maximum': 20, 'description': 'light same-domain crawl: audit up to N pages, aggregated by score and recurring signals (default 1, max 20)'},
|
|
147
157
|
'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'output language (en default)'},
|
|
148
158
|
'timeout': {'type': 'number', 'description': 'fetch timeout seconds (30 default)'},
|
|
159
|
+
'standard': {'type': 'string', 'enum': ['en301549', 'rgaa'], 'description': 'en301549: EN clause per finding (EAA procurement, Canada ICT) · rgaa: French RGAA criterion per finding'},
|
|
160
|
+
'target': {'type': 'string', 'enum': ['web', 'documents', 'software'], 'description': 'EN 301 549 target: web=9.x clauses (default), documents=10.x, software=11.x'},
|
|
149
161
|
}},
|
|
150
162
|
},
|
|
163
|
+
{
|
|
164
|
+
'name': 'a11y_locate',
|
|
165
|
+
'description': ('Find an element by its accessible name and get its deterministic '
|
|
166
|
+
'route selector (the same tag:nth-of-type identity annotate() uses): '
|
|
167
|
+
'controls, headings, images with alt, iframes with title, fields '
|
|
168
|
+
'with an explicit name. High confidence only on exact unique '
|
|
169
|
+
'matches; when several elements share the name it refuses to pick '
|
|
170
|
+
'one and returns the full candidate list (ambiguous) — a match is '
|
|
171
|
+
'never invented. Feeds agents that edit code by selector and '
|
|
172
|
+
'panel deep-links.'),
|
|
173
|
+
'inputSchema': {'type': 'object', 'properties': {
|
|
174
|
+
'html': {'type': 'string', 'description': 'raw HTML to search'},
|
|
175
|
+
'query': {'type': 'string', 'description': 'accessible name to find (e.g. "Submit")'},
|
|
176
|
+
'role': {'type': 'string', 'description': 'filter by role: button, link, textbox, checkbox, radio, combobox, heading, h1-h6, image…'},
|
|
177
|
+
'multiple': {'type': 'boolean', 'description': 'list every exact match instead of refusing (default false)'},
|
|
178
|
+
'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'output language (en default)'},
|
|
179
|
+
}, 'required': ['html', 'query']},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
'name': 'a11y_patches',
|
|
183
|
+
'description': ('Sealed patch-set of the deterministic safe fixes: build runs '
|
|
184
|
+
'a11y_autofix once and records WHICH fixes were applied to WHICH '
|
|
185
|
+
'page (SHA-256-keyed, format a11y-patches/1, engine version '
|
|
186
|
+
'stamped); verify re-checks a set against a page — the same page '
|
|
187
|
+
'must reproduce the same fixes, a different page is stale (sets '
|
|
188
|
+
'never blind-apply). The artifact an agent or CI applies upstream: '
|
|
189
|
+
'fixing the original web is the client job, the engine hands over '
|
|
190
|
+
'the evidence.'),
|
|
191
|
+
'inputSchema': {'type': 'object', 'properties': {
|
|
192
|
+
'html': {'type': 'string', 'description': 'raw HTML'},
|
|
193
|
+
'action': {'type': 'string', 'enum': ['build', 'verify'], 'description': 'build: run autofix and seal the record (default); verify: check patch_set against this html'},
|
|
194
|
+
'patch_set': {'type': 'object', 'description': 'a11y-patches/1 artifact (verify only)'},
|
|
195
|
+
'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'output language (en default)'},
|
|
196
|
+
'title': {'type': 'string', 'description': 'title for the fixed copy (build only)'},
|
|
197
|
+
}, 'required': ['html']},
|
|
198
|
+
},
|
|
151
199
|
{
|
|
152
200
|
'name': 'a11y_audit_dom',
|
|
153
201
|
'description': ('Deep RENDERED WCAG audit via local Playwright/Chromium: real computed '
|
|
@@ -167,6 +215,8 @@ TOOLS = [
|
|
|
167
215
|
'auth_state': {'type': 'string', 'description': 'Path to a Playwright storage_state JSON (exported session) to audit behind login — local file, never uploaded'},
|
|
168
216
|
'browser': {'type': 'string', 'enum': ['auto', 'chromium', 'firefox', 'webkit', 'chrome', 'msedge'], 'description': 'Browser engine (auto = detect the first available)'},
|
|
169
217
|
'color_scheme': {'type': 'string', 'enum': ['light', 'dark'], 'description': 'Emulate prefers-color-scheme: run the contrast pass in dark mode too — dark themes fail where light passes (nobody audits both)'},
|
|
218
|
+
'standard': {'type': 'string', 'enum': ['en301549'], 'description': 'add the EN 301 549 V4.1.1 (2026) clause to every finding plus a standard block'},
|
|
219
|
+
'target': {'type': 'string', 'enum': ['web', 'documents', 'software'], 'description': 'EN 301 549 target: web=9.x clauses (default), documents=10.x, software=11.x'},
|
|
170
220
|
},
|
|
171
221
|
'required': ['url']},
|
|
172
222
|
},
|
|
@@ -354,6 +404,7 @@ TOOLS = [
|
|
|
354
404
|
'lang': {'type': 'string', 'enum': ['es', 'en']},
|
|
355
405
|
'max_batches': {'type': 'integer', 'description': 'scroll batches (5 default)'},
|
|
356
406
|
'auth_state': {'type': 'string', 'description': 'Path to a Playwright storage_state JSON (exported session) to audit an authenticated feed'},
|
|
407
|
+
'browser': {'type': 'string', 'enum': ['auto', 'chromium', 'firefox', 'webkit', 'chrome', 'msedge'], 'description': 'Browser engine (auto = detect the first available)'},
|
|
357
408
|
},
|
|
358
409
|
'required': ['url']},
|
|
359
410
|
},
|
|
@@ -375,8 +426,39 @@ TOOLS = [
|
|
|
375
426
|
'reports': {'type': 'array', 'items': {'type': 'object'},
|
|
376
427
|
'description': 'audit report objects (any mode)'},
|
|
377
428
|
'snapshot': {'type': 'object', 'description': 'a11y_snapshot output (optional)'},
|
|
429
|
+
'scope': {'type': 'object', 'description': 'a11y_scope output: human-confirmed exclusions become not-applicable rows with their reason (machine proposals never exclude)'},
|
|
378
430
|
'reviewer': {'type': 'object', 'description': '{"name":…, "credential":…, "review_date":…} to prefill the signature block'},
|
|
379
431
|
'verified': {'type': 'array', 'items': {'type': 'string'}, 'description': 'Criterion codes an agent/human verified against this sample (manual checklist protocol) — they become agent-verified in the matrix; automated-fail stays fail'},
|
|
432
|
+
'build': {'type': 'object', 'description': 'Build reference sealed into the pack sha — the claim→artifact chain: {"commit":…, "ci_url":…} or {"ref": "git:716d870"}'},
|
|
433
|
+
'lang': {'type': 'string', 'enum': ['en', 'es'], 'description': 'Pack language: matrix status labels and notes (en default)'},
|
|
434
|
+
}, 'required': ['reports']},
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
'name': 'a11y_scope',
|
|
438
|
+
'description': ('Semi-automatic applicability scoping — the layer between the audit '
|
|
439
|
+
'and the conformance claim (the pattern of the Government of Canada '
|
|
440
|
+
'CIO wizard for EN 301 549, informed by the audit instead of 118 '
|
|
441
|
+
'hand-answered questions). Reads the features block of the reports '
|
|
442
|
+
'(media elements, form controls — positive evidence of what the audit '
|
|
443
|
+
'SAW) and proposes the structural exclusions: no video anywhere → '
|
|
444
|
+
'1.2.x proposed-excluded, no form controls → 3.3.x proposed-excluded. '
|
|
445
|
+
'The machine PROPOSES, the human CONFIRMS via answers '
|
|
446
|
+
'{"1.2.4": {"status": "excluded", "reason": "…"}} — only confirmed '
|
|
447
|
+
'exclusions may become not-applicable downstream (a11y_evidence, '
|
|
448
|
+
'a11y_generate_vpat, a11y_generate_openacr); a proposal never '
|
|
449
|
+
'excludes. standard=en301549 adds the EN 301 549 V4.1.1 (2026) '
|
|
450
|
+
'clause to every row (9.x web / 10.x documents / 11.x software — '
|
|
451
|
+
'numbering verified 55/55 A/AA) and the EN-only families (5, 6, 7, '
|
|
452
|
+
'8, 12, 13) as honest applicability rows this toolkit does not '
|
|
453
|
+
'evaluate. Live counter: N of 55 criteria in scope.'),
|
|
454
|
+
'inputSchema': {'type': 'object', 'properties': {
|
|
455
|
+
'reports': {'type': 'array', 'items': {'type': 'object'},
|
|
456
|
+
'description': 'audit report objects (any mode; reports carrying the features block power the machine proposals)'},
|
|
457
|
+
'standard': {'type': 'string', 'enum': ['wcag22', 'en301549', 'rgaa'], 'description': 'wcag22 (default), en301549 (clause refs + EN families) or rgaa (French 106-criterion checklist)'},
|
|
458
|
+
'target': {'type': 'string', 'enum': ['web', 'documents', 'software'], 'description': 'ICT target: web=9.x clauses (default), documents=10.x, software=11.x'},
|
|
459
|
+
'targets': {'type': 'array', 'items': {'type': 'string', 'enum': ['web', 'documents', 'software']}, 'description': 'combined scope across ICT targets (like GSA ART multi-item); rows carry a clauses dict per target'},
|
|
460
|
+
'answers': {'type': 'object', 'description': 'human confirmations keyed by criterion code: status in-scope|proposed-excluded|excluded'},
|
|
461
|
+
'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'output language (en default)'},
|
|
380
462
|
}, 'required': ['reports']},
|
|
381
463
|
},
|
|
382
464
|
{
|
|
@@ -394,6 +476,7 @@ TOOLS = [
|
|
|
394
476
|
'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'Output language (en default)'},
|
|
395
477
|
'timeout': {'type': 'number', 'description': 'Page load timeout seconds (45 default)'},
|
|
396
478
|
'auth_state': {'type': 'string', 'description': 'Path to a Playwright storage_state JSON to test forms behind login'},
|
|
479
|
+
'browser': {'type': 'string', 'enum': ['auto', 'chromium', 'firefox', 'webkit', 'chrome', 'msedge'], 'description': 'Browser engine (auto = detect the first available)'},
|
|
397
480
|
},
|
|
398
481
|
'required': ['url']},
|
|
399
482
|
},
|
|
@@ -425,7 +508,8 @@ TOOLS = [
|
|
|
425
508
|
'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'Output language (en default)'},
|
|
426
509
|
'timeout': {'type': 'number', 'description': 'Page load timeout (45 default)'},
|
|
427
510
|
'auth_state': {'type': 'string', 'description': 'Path to a Playwright storage_state JSON (exported session) to audit behind login — stays local'},
|
|
428
|
-
|
|
511
|
+
'browser': {'type': 'string', 'enum': ['auto', 'chromium', 'firefox', 'webkit', 'chrome', 'msedge'], 'description': 'Browser engine (auto = detect the first available)'},
|
|
512
|
+
}, 'required': ['url']},
|
|
429
513
|
},
|
|
430
514
|
{
|
|
431
515
|
'name': 'a11y_sr_transcript',
|
|
@@ -473,6 +557,7 @@ TOOLS = [
|
|
|
473
557
|
'url': {'type': 'string', 'description': 'URL (for record/gaps)'},
|
|
474
558
|
'report': {'type': 'object', 'description': 'audit report object (for record)'},
|
|
475
559
|
'ledger_path': {'type': 'string', 'description': 'ledger file path (default: a11y-ledger.json)'},
|
|
560
|
+
'lang': {'type': 'string', 'enum': ['en', 'es'], 'description': 'Notes language (en default)'},
|
|
476
561
|
}, 'required': ['action']},
|
|
477
562
|
},
|
|
478
563
|
{
|
|
@@ -503,13 +588,15 @@ TOOLS = [
|
|
|
503
588
|
'accessible name, log friction per step, then call this. Task usability '
|
|
504
589
|
'evidence, never conformance.'),
|
|
505
590
|
'inputSchema': {'type': 'object', 'properties': {
|
|
506
|
-
'task': {'type': 'object', 'description': '{"goal": what the agent attempted, "kind": sign-up|checkout|password-reset|search|custom}'},
|
|
591
|
+
'task': {'type': 'object', 'description': '{"goal": what the agent attempted, "kind": sign-up|checkout|password-reset|search|onboarding|settings|data-export|custom}'},
|
|
507
592
|
'steps': {'type': 'array', 'items': {'type': 'object'}, 'description': 'journey steps: {action, target (accessible name), perceived, friction?} — friction is {pattern: journey_* key} or {criterion, severity, issue, remediation?}'},
|
|
508
593
|
'outcome': {'type': 'object', 'description': '{"completed": bool, "gave_up": bool, "workaround_used": bool, "notes"}'},
|
|
509
594
|
'url': {'type': 'string', 'description': 'page(s) where the journey ran'},
|
|
510
595
|
'lang': {'type': 'string', 'enum': ['en', 'es'], 'description': 'output language'},
|
|
511
596
|
'output_path': {'type': 'string', 'description': 'write the full verdict JSON here instead of returning it inline'},
|
|
512
|
-
|
|
597
|
+
'seal': {'type': 'boolean', 'description': 'return the sealed a11y-journey/1 record instead: the walk + judgment + steps, sha-sealed (record_verify re-derives the verdict from the steps)'},
|
|
598
|
+
'verify_record': {'type': 'object', 'description': 'an a11y-journey/1 record to verify instead of judging: returns verified or tampered (sha + deterministic re-scoring)'},
|
|
599
|
+
}, 'required': []},
|
|
513
600
|
},
|
|
514
601
|
{
|
|
515
602
|
'name': 'a11y_generate_vpat',
|
|
@@ -518,7 +605,8 @@ TOOLS = [
|
|
|
518
605
|
'the full 55-criterion WCAG 2.2 A/AA table with Remarks auto-filled from '
|
|
519
606
|
'the pack (status, measured values, examples, remaining human effort) and '
|
|
520
607
|
'every Conformance Level starting at Not Evaluated — automated fails force '
|
|
521
|
-
'Does Not Support
|
|
608
|
+
'Does Not Support, review-level signals stay Not Evaluated with the '
|
|
609
|
+
'evidence in Remarks, and a qualified human sets the rest via overrides '
|
|
522
610
|
'(supports, partially_supports, does_not_support, not_applicable, '
|
|
523
611
|
'not_evaluated). The document is a DRAFT until the signature block, which '
|
|
524
612
|
'must reference the pack sha256, is completed. VPAT is the US/ADA '
|
|
@@ -535,9 +623,11 @@ TOOLS = [
|
|
|
535
623
|
'notes': {'type': 'string', 'description': 'Additional notes to include'},
|
|
536
624
|
'overrides': {'type': 'object', 'description': 'Criterion → conformance level set by a qualified human: {"1.1.1": "supports", "1.2.2": "not_applicable", …}'},
|
|
537
625
|
'reviewer': {'type': 'object', 'description': '{"name":…, "credential":…, "review_date":…} to prefill the signature block'},
|
|
626
|
+
'scope': {'type': 'object', 'description': 'a11y_scope output: human-confirmed exclusions become Not Applicable with their reason (machine proposals never); overrides still win'},
|
|
538
627
|
'output_path': {'type': 'string', 'description': 'save the VPAT HTML here (optional)'},
|
|
539
628
|
'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'Document language (default en)'},
|
|
540
|
-
},
|
|
629
|
+
},
|
|
630
|
+
'required': ['product']},
|
|
541
631
|
},
|
|
542
632
|
{
|
|
543
633
|
'name': 'a11y_generate_openacr',
|
|
@@ -546,8 +636,8 @@ TOOLS = [
|
|
|
546
636
|
'a11y_evidence pack (or raw audit reports): the full 55-criterion '
|
|
547
637
|
'WCAG 2.2 A/AA matrix as chapters with one web component per '
|
|
548
638
|
'criterion, adherence levels starting at not-evaluated (automated '
|
|
549
|
-
'fails force does-not-support
|
|
550
|
-
'
|
|
639
|
+
'fails force does-not-support; review-level signals stay not-evaluated '
|
|
640
|
+
'with the evidence in notes) and notes auto-filled from the pack (status, '
|
|
551
641
|
'measured values, remaining human effort, sha256). Same honesty '
|
|
552
642
|
'rule as a11y_generate_vpat: the machine fills notes, a qualified '
|
|
553
643
|
'human sets levels via overrides (supports, partially_supports, …; '
|
|
@@ -566,9 +656,11 @@ TOOLS = [
|
|
|
566
656
|
'methods': {'type': 'string', 'description': 'Evaluation methods used (default: honest automated-screening note)'},
|
|
567
657
|
'notes': {'type': 'string', 'description': 'Additional notes to include'},
|
|
568
658
|
'overrides': {'type': 'object', 'description': 'Criterion → adherence level set by a qualified human: {"1.1.1": "supports", "1.2.2": "not_applicable", …} (hyphenated forms accepted)'},
|
|
659
|
+
'scope': {'type': 'object', 'description': 'a11y_scope output: human-confirmed exclusions become not-applicable with their reason (machine proposals never); overrides still win'},
|
|
569
660
|
'output_path': {'type': 'string', 'description': 'save the OpenACR YAML here (optional)'},
|
|
570
661
|
'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'Document language (default en)'},
|
|
571
|
-
},
|
|
662
|
+
},
|
|
663
|
+
'required': ['product']},
|
|
572
664
|
},
|
|
573
665
|
{
|
|
574
666
|
'name': 'a11y_contrast_dom',
|
|
@@ -747,15 +839,6 @@ _PROMPTS = [
|
|
|
747
839
|
{'name': 'status', 'description': 'plena | parcial | no_conforme', 'required': False},
|
|
748
840
|
],
|
|
749
841
|
},
|
|
750
|
-
{
|
|
751
|
-
'name': 'conformance-wcagem',
|
|
752
|
-
'description': 'Guided WCAG-EM conformance ladder for a site: express screening → agent-verified guided evaluation on a representative sample → conformance report inputs.',
|
|
753
|
-
'arguments': [
|
|
754
|
-
{'name': 'url', 'description': 'site root to evaluate', 'required': True},
|
|
755
|
-
{'name': 'tier', 'description': 'express | guided | conformance (default: express)', 'required': False},
|
|
756
|
-
{'name': 'language', 'description': 'es or en', 'required': False},
|
|
757
|
-
],
|
|
758
|
-
},
|
|
759
842
|
{
|
|
760
843
|
'name': 'blindfold-task',
|
|
761
844
|
'description': ('Blindfold usability test — the agent attempts a real task perceiving '
|
|
@@ -766,7 +849,7 @@ _PROMPTS = [
|
|
|
766
849
|
'arguments': [
|
|
767
850
|
{'name': 'url', 'description': 'page where the task lives', 'required': True},
|
|
768
851
|
{'name': 'goal', 'description': 'the task in user terms ("sign up for the newsletter")', 'required': True},
|
|
769
|
-
{'name': 'kind', 'description': 'sign-up | checkout | password-reset | search | custom', 'required': False},
|
|
852
|
+
{'name': 'kind', 'description': 'sign-up | checkout | password-reset | search | onboarding | settings | data-export | custom', 'required': False},
|
|
770
853
|
{'name': 'language', 'description': 'es or en', 'required': False},
|
|
771
854
|
],
|
|
772
855
|
},
|
|
@@ -822,18 +905,6 @@ def _prompt(name, args):
|
|
|
822
905
|
+ "3. Informa: hallazgos nuevos (bloqueantes), hallazgos resueltos (buenas noticias), interactivos añadidos/eliminados/renombrados, cambios de orden de foco.\n"
|
|
823
906
|
"4. Veredicto: GO (sin hallazgos altos nuevos ni regresiones de foco) / NO-GO (en caso contrario) con la evidencia.",
|
|
824
907
|
},
|
|
825
|
-
'conformance-wcagem': {
|
|
826
|
-
'en': f"Run the WCAG-EM conformance ladder for {args.get('url','the site')} (tier: {args.get('tier','express')}):\n"
|
|
827
|
-
"1. EXPRESS (always): a11y_audit_url on the root and the 4-5 key pages (use pages parameter / crawl). Report scores and findings by severity.\n"
|
|
828
|
-
"2. GUIDED: pick a WCAG-EM sample — structured pages (home, contact, login, a content page, a form flow) plus a random pick from the crawl. On each sample page, run a11y_audit_dom if Playwright is available, then verify the manual checklist yourself (keyboard walk, focus visibility, zoom 200%, error announcement on one form). Mark each item verified-by-agent vs automated-only.\n"
|
|
829
|
-
"3. CONFORMANCE: only with a human in the loop — compile the evidence (sample, pages, results, dates) into WCAG-EM report structure, state the scope honestly (sample-based evaluation, not a certification), and feed inaccessible_content into a11y_generate_declaration.\n"
|
|
830
|
-
"Escalate one tier at a time; never present tier 1 or 2 as conformance.",
|
|
831
|
-
'es': f"Ejecuta la escalera de conformidad WCAG-EM para {args.get('url','el sitio')} (nivel: {args.get('tier','express')})\u003a\n"
|
|
832
|
-
"1. EXPRESS (siempre): a11y_audit_url en la raíz y las 4-5 páginas clave (parámetro pages). Informa puntuaciones y hallazgos por severidad.\n"
|
|
833
|
-
"2. GUIDED: elige una muestra WCAG-EM — páginas estructurales (inicio, contacto, login, una de contenido, un flujo de formulario) más una aleatoria del rastreo. En cada una, a11y_audit_dom si hay Playwright, y verifica tú el checklist manual (recorrido de teclado, foco visible, zoom 200%, anuncio de errores en un formulario). Marca cada punto como verificado-por-agente o solo-automático.\n"
|
|
834
|
-
"3. CONFORMANCE: solo con humana en el bucle — recopila la evidencia (muestra, páginas, resultados, fechas) en la estructura del informe WCAG-EM, declara el alcance con honestidad (evaluación por muestreo, no certificación) y alimenta inaccessible_content en a11y_generate_declaration.\n"
|
|
835
|
-
"Escala un nivel cada vez; nunca presentes el nivel 1 o 2 como conformidad.",
|
|
836
|
-
},
|
|
837
908
|
'declaration-eaa': {
|
|
838
909
|
'en': f"Generate an accessibility statement for {args.get('entity','the entity')} ({args.get('url','URL')}):\n"
|
|
839
910
|
"1. Establish the compliance state with a11y_audit_url (parcial is the honest default when findings exist).\n"
|
|
@@ -895,7 +966,7 @@ _PARAM_DOCS = {
|
|
|
895
966
|
('a11y_forms', 'browser'): 'Browser engine (auto = detect the first available)',
|
|
896
967
|
('a11y_sr_transcript', 'url'): 'Page URL to get the screen reader announcement transcript',
|
|
897
968
|
('a11y_sr_transcript', 'timeout'): 'Page load timeout in seconds (default 45)',
|
|
898
|
-
('a11y_journey_verdict', 'task'): 'Task the agent attempted blindfolded: {"goal": …, "kind": sign-up|checkout|password-reset|search|custom}',
|
|
969
|
+
('a11y_journey_verdict', 'task'): 'Task the agent attempted blindfolded: {"goal": …, "kind": sign-up|checkout|password-reset|search|onboarding|settings|data-export|custom}',
|
|
899
970
|
('a11y_journey_verdict', 'steps'): 'Journey steps in order; each friction item is a journey_* pattern key or a raw {criterion, severity, issue}',
|
|
900
971
|
('a11y_journey_verdict', 'outcome'): 'How the journey ended: completed / gave_up / workaround_used + notes',
|
|
901
972
|
('a11y_journey_verdict', 'url'): 'Where the journey ran',
|
|
@@ -974,6 +1045,7 @@ _PARAM_DOCS = {
|
|
|
974
1045
|
('a11y_criterion', 'signal'): 'Signal id from any finding (e.g. img_no_alt): resolves its criterion and published ACT rules with w3.org links',
|
|
975
1046
|
('a11y_criterion', 'lang'): 'Explanation language (default en)',
|
|
976
1047
|
('a11y_evidence', 'reports'): 'Audit report objects to bundle (any mode: static, rendered, reflow, keyboard, scroll)',
|
|
1048
|
+
('a11y_evidence', 'build'): 'Build reference sealed into the sha: {"commit":…, "ci_url":…} or {"ref": "git:sha"} — the claim→artifact chain',
|
|
977
1049
|
('a11y_evidence', 'snapshot'): 'Optional a11y_snapshot output to include as an artifact',
|
|
978
1050
|
('a11y_evidence', 'reviewer'): 'Optional prefill for the signature block: {"name":…, "credential":…, "review_date":…}',
|
|
979
1051
|
('a11y_aria_live_snippet', 'lang'): 'Monitor panel language (default en)',
|
|
@@ -986,6 +1058,16 @@ _PARAM_DOCS = {
|
|
|
986
1058
|
('a11y_generate_vpat', 'methods'): 'Evaluation methods used (default: honest automated-screening note)',
|
|
987
1059
|
('a11y_generate_vpat', 'notes'): 'Additional notes to include',
|
|
988
1060
|
('a11y_generate_vpat', 'overrides'): 'Criterion → conformance level set by a qualified human: {"1.1.1": "supports", "1.2.2": "not_applicable", …}',
|
|
1061
|
+
('a11y_generate_vpat', 'scope'): 'a11y_scope output: human-confirmed exclusions become Not Applicable with their reason (proposals never)',
|
|
1062
|
+
('a11y_scope', 'reports'): 'Audit report objects (any mode; the features block powers machine proposals)',
|
|
1063
|
+
('a11y_scope', 'standard'): 'wcag22 (default) or en301549: clause refs + EN families (5, 6, 7, 8, 12, 13)',
|
|
1064
|
+
('a11y_scope', 'target'): 'ICT target: web=9.x clauses (default), documents=10.x, software=11.x',
|
|
1065
|
+
('a11y_scope', 'answers'): 'Human confirmations keyed by criterion code: {"1.2.4": {"status": "excluded", "reason": "no live media"}}',
|
|
1066
|
+
('a11y_audit_url', 'standard'): 'Add the EN 301 549 V4.1.1 (2026) clause to every finding (EAA procurement, Canada ICT)',
|
|
1067
|
+
('a11y_audit_url', 'target'): 'EN 301 549 target: web=9.x (default), documents=10.x, software=11.x',
|
|
1068
|
+
('a11y_audit_dom', 'standard'): 'Add the EN 301 549 V4.1.1 (2026) clause to every finding',
|
|
1069
|
+
('a11y_audit_dom', 'target'): 'EN 301 549 target: web=9.x (default), documents=10.x, software=11.x',
|
|
1070
|
+
('a11y_evidence', 'scope'): 'a11y_scope output: human-confirmed exclusions become not-applicable rows (proposals never)',
|
|
989
1071
|
('a11y_generate_vpat', 'reviewer'): '{"name":…, "credential":…, "review_date":…} to prefill the signature block',
|
|
990
1072
|
('a11y_generate_vpat', 'output_path'): 'Local path to save the VPAT HTML (omit to receive it inline)',
|
|
991
1073
|
('a11y_generate_vpat', 'lang'): 'Document language (default en)',
|
|
@@ -1029,6 +1111,7 @@ _ROUTING = {
|
|
|
1029
1111
|
'a11y_badge': 'Scope: the honest SVG seal for audited sites; the machine-readable bundle is a11y_evidence.',
|
|
1030
1112
|
'a11y_criterion': 'Knowledge lookup; does not fetch or audit anything — includes the official Understanding WCAG 2.2 link for the criterion.',
|
|
1031
1113
|
'a11y_evidence': 'The tier-3 handoff object; feed it every audit report you have.',
|
|
1114
|
+
'a11y_scope': 'The applicability layer before conformance: run after the audits, confirm the machine proposals via answers, then feed the scope here — a11y_evidence/vpat/openacr turn confirmed exclusions into not-applicable with their reason.',
|
|
1032
1115
|
'a11y_aria_live_snippet': 'Diagnostics aid to inject in a browser; not an audit by itself.',
|
|
1033
1116
|
'a11y_generate_declaration': 'Legal statement generator; drive inaccessible_content from audit findings and a11y_evidence.',
|
|
1034
1117
|
'a11y_generate_vpat': 'The US/ADA counterpart of a11y_generate_declaration; feed it the a11y_evidence pack — levels stay Not Evaluated until a qualified human sets them.',
|
|
@@ -1055,6 +1138,8 @@ _ANN = {
|
|
|
1055
1138
|
'a11y_forms': ('Form error testing', True, True),
|
|
1056
1139
|
'a11y_scroll': ('Infinite-scroll audit', True, True),
|
|
1057
1140
|
'a11y_snapshot': ('A11y snapshot + tab order', True, True),
|
|
1141
|
+
'a11y_locate': ('Locate element by accessible name', True, True),
|
|
1142
|
+
'a11y_patches': ('Sealed patch-set (sha-keyed)', True, False),
|
|
1058
1143
|
'a11y_diff': ('Snapshot regression diff', True, False),
|
|
1059
1144
|
'a11y_diff_urls': ('Staging vs production diff', True, True),
|
|
1060
1145
|
'a11y_contrast_pair': ('Contrast ratio + verdicts', True, False),
|
|
@@ -1081,6 +1166,7 @@ _ANN = {
|
|
|
1081
1166
|
'a11y_forced_colors': ('forced-colors survival heuristic', True, True),
|
|
1082
1167
|
'a11y_wcag3_preview': ('WCAG 3 draft preview (no score)', True, False),
|
|
1083
1168
|
'a11y_route': ('Tool router (goal or page to steps)', True, True),
|
|
1169
|
+
'a11y_scope': ('Applicability scope (semi-automatic)', True, False),
|
|
1084
1170
|
}
|
|
1085
1171
|
# TDQS hygiene: annotations must match reality, and every description states
|
|
1086
1172
|
# its return shape and when (not) to use the tool. a11y_ledger.record mutates
|
|
@@ -1098,8 +1184,8 @@ _RETURNS = {
|
|
|
1098
1184
|
'a11y_diff': 'Returns JSON: {ok, added, removed, renamed, focus_order_changed, first_differences} — ok:false means a regression to review.',
|
|
1099
1185
|
'a11y_diff_urls': 'Returns the same diff shape as a11y_diff, for two live URLs.',
|
|
1100
1186
|
'a11y_aria_live_snippet': 'Returns the injectable JavaScript as text (bookmarklet or page.evaluate).',
|
|
1101
|
-
'a11y_badge': 'Returns the honest SVG badge
|
|
1102
|
-
'a11y_autofix': 'Returns JSON: {fixed_html, applied [{fix, …}], not_applied [{issue, remediation}]}
|
|
1187
|
+
'a11y_badge': 'Returns the honest SVG badge as text content (the agent writes the file).',
|
|
1188
|
+
'a11y_autofix': 'Returns JSON: {fixed_html, applied [{fix, …}], not_applied [{issue, remediation}]} as text content (the agent writes the file).',
|
|
1103
1189
|
'a11y_reflow': 'Returns JSON: {url, viewport, horizontal_scroll, offenders [{selector, width}]}.',
|
|
1104
1190
|
'a11y_keyboard': 'Returns JSON: {tab_stops, trap_detected, escape_releases, findings}.',
|
|
1105
1191
|
'a11y_scroll': 'Returns JSON: {mode, url, score, findings [{criterion, severity, signal, issue, remediation}], summary} — same shape as the audits.',
|
|
@@ -1110,7 +1196,7 @@ _RETURNS = {
|
|
|
1110
1196
|
'a11y_disprove': 'Returns JSON: {confirmed, rejected, score} — a fresh score over confirmed findings only.',
|
|
1111
1197
|
'a11y_ledger': 'record returns the stored entry; gaps returns criteria never checked; summary returns {entries, active_signals, resolved, mean_score}.',
|
|
1112
1198
|
'a11y_criterion': 'Returns JSON: {criterion, level, understanding, toolkit_signals, requires, typical_failures, how_to_check} — signal mode adds {signal, act_rules [{id, name, status, url}]}; {error, …} for unknown codes.',
|
|
1113
|
-
'a11y_evidence': 'Returns the pack JSON (a11y-evidence-pack/2)
|
|
1199
|
+
'a11y_evidence': 'Returns the pack JSON (a11y-evidence-pack/2) as text content (the agent writes the file).',
|
|
1114
1200
|
'a11y_journey_verdict': 'Returns JSON: {verdict pass|partial|fail|blocked, score 0-100, findings [{criterion, severity, signal, issue, remediation, step}], summary, rules} — writes a file only when output_path is given.',
|
|
1115
1201
|
'a11y_generate_declaration': 'Returns {html, summary} — the accessible legal statement; writes a file only when output_path is given.',
|
|
1116
1202
|
'a11y_generate_vpat': 'Returns {html, summary {level: count}, levels {code: level}, pack_sha256, draft} — the VPAT draft; writes a file only when output_path is given.',
|
|
@@ -1118,6 +1204,7 @@ _RETURNS = {
|
|
|
1118
1204
|
'a11y_contrast_dom': 'Returns JSON: {url, selector, text_color, worst_ratio, median_ratio, p95_ratio, area_passes_aa_normal_text_4_5, worst_zone?, sampled_pixels, interpretation}.',
|
|
1119
1205
|
'a11y_wcag3_preview': 'Returns JSON: {mode, draft, disclaimer, mapping_note, no_score, conformance_model, outcomes [{outcome, draft_url, findings, severity, signals, criteria_22}], counts, unmapped} — never a score.',
|
|
1120
1206
|
'a11y_route': 'Returns JSON: {route, steps [{step, tool, why}], alternates, prompts, cli, note} — the ordered tool sequence for the goal. Diagnosis mode (url/html passed): {mode: diagnose, vitals {score, summary, signals}, symptoms [{symptom, evidence}], steps [...], guarantee} — evidence orders the exams, severity breaks ties.',
|
|
1207
|
+
'a11y_scope': 'Returns JSON: {format: a11y-scope/1, standard, target, criteria [{criterion, level, status, clause?, evidence?, reason?}], counters, en301549_families?, sha256} — statuses in-scope|proposed-excluded|excluded; only human-confirmed exclusions count downstream.',
|
|
1121
1208
|
}
|
|
1122
1209
|
_USAGE = {
|
|
1123
1210
|
'a11y_forms': 'Use on test/staging forms, or forms you own: invalid data is REALLY submitted. Do not run against production forms that trigger real emails, orders or leads.',
|
|
@@ -1129,13 +1216,19 @@ _USAGE = {
|
|
|
1129
1216
|
'a11y_generate_vpat': 'Run after the audits you trust; a qualified human must set the final levels (overrides) and sign before publishing — the machine fills Remarks, never the claim.',
|
|
1130
1217
|
'a11y_generate_openacr': 'Run after the audits you trust; validate and render in the GSA OpenACR editor (gsa.github.io/openacr-editor) — a qualified human must set the final adherence levels before publishing.',
|
|
1131
1218
|
'a11y_wcag3_preview': 'Run after any audit when the team asks "what about WCAG 3?"; re-baseline on each W3C draft publication (roughly March/September).',
|
|
1219
|
+
'a11y_scope': 'Run after the audits, before any conformance artifact: confirm the machine proposals via answers, then pass the scope to a11y_evidence — only human-confirmed exclusions become not-applicable, and each exclusion carries its reason.',
|
|
1132
1220
|
}
|
|
1133
1221
|
for _t in TOOLS:
|
|
1134
1222
|
_title, _ro, _ow = _ANN[_t['name']]
|
|
1135
1223
|
_title_ro = _RO_OVERRIDE.get(_t['name'], _ro)
|
|
1136
1224
|
_title_same = _IDEM_OVERRIDE.get(_t['name'], True)
|
|
1137
1225
|
_t['title'] = 'a11y-toolkit: ' + _title
|
|
1138
|
-
|
|
1226
|
+
# destructiveHint honrado (semántica MCP): «no-read-only» NO equivale a
|
|
1227
|
+
# destructivo. Escribir el fichero que te piden es un efecto normal; lo
|
|
1228
|
+
# genuinamente irreversible es a11y_forms (ENVÍA datos reales a la web
|
|
1229
|
+
# auditada) — el resto son cómputo + guardado dirigido por el usuario
|
|
1230
|
+
_t['annotations'] = {'readOnlyHint': _title_ro,
|
|
1231
|
+
'destructiveHint': _t['name'] in ('a11y_forms',),
|
|
1139
1232
|
'idempotentHint': _title_same, 'openWorldHint': _ow}
|
|
1140
1233
|
if _t['name'] in _RETURNS:
|
|
1141
1234
|
_t['description'] += ' ' + _RETURNS[_t['name']]
|
|
@@ -1151,6 +1244,24 @@ def _content(obj):
|
|
|
1151
1244
|
return r
|
|
1152
1245
|
|
|
1153
1246
|
|
|
1247
|
+
def _enrich_standard(res, standard, target, lang):
|
|
1248
|
+
"""Post-hoc EN 301 549 enrichment for report shapes that don't pass
|
|
1249
|
+
through audit_html (site crawl, rendered): adds the standard block and a
|
|
1250
|
+
clause ref to every finding. standard=None → res unchanged."""
|
|
1251
|
+
if standard != 'en301549' or not isinstance(res, dict) or 'error' in res:
|
|
1252
|
+
return res
|
|
1253
|
+
from . import a11yen301549 as _enstd
|
|
1254
|
+
pages = res.get('reports') if 'reports' in res else [res]
|
|
1255
|
+
tgt = target or _enstd.target_for_mode(res.get('mode', 'static'))
|
|
1256
|
+
res['standard'] = _enstd.standard_block(tgt, lang)
|
|
1257
|
+
for pg in pages:
|
|
1258
|
+
for h in pg.get('findings', []):
|
|
1259
|
+
cl = _enstd.clause_for(h.get('criterion', '').split(' ')[0], tgt)
|
|
1260
|
+
if cl:
|
|
1261
|
+
h['clause'] = cl
|
|
1262
|
+
return res
|
|
1263
|
+
|
|
1264
|
+
|
|
1154
1265
|
def invoke(name, args):
|
|
1155
1266
|
args = {PARAM_ALIASES.get(k, k): v for k, v in (args or {}).items()}
|
|
1156
1267
|
if name == 'a11y_contrast_pair':
|
|
@@ -1184,22 +1295,31 @@ def invoke(name, args):
|
|
|
1184
1295
|
try:
|
|
1185
1296
|
if args.get('html'):
|
|
1186
1297
|
return _content(audit_html_fn(args['html'], args.get('url') or '(html)',
|
|
1187
|
-
lang=args.get('lang', 'en')
|
|
1298
|
+
lang=args.get('lang', 'en'),
|
|
1299
|
+
standard=args.get('standard'),
|
|
1300
|
+
target=args.get('target')))
|
|
1188
1301
|
if args.get('pages', 1) > 1:
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1302
|
+
res = audit_site_fn(args['url'], max_pages=args['pages'],
|
|
1303
|
+
timeout=args.get('timeout', 30),
|
|
1304
|
+
lang=args.get('lang', 'en'))
|
|
1305
|
+
res = _enrich_standard(res, args.get('standard'),
|
|
1306
|
+
args.get('target'), args.get('lang', 'en'))
|
|
1307
|
+
return _content(res)
|
|
1192
1308
|
return _content(audit_url_fn(args['url'], timeout=args.get('timeout', 30),
|
|
1193
|
-
lang=args.get('lang', 'en')
|
|
1309
|
+
lang=args.get('lang', 'en'),
|
|
1310
|
+
standard=args.get('standard'),
|
|
1311
|
+
target=args.get('target')))
|
|
1194
1312
|
except Exception as e: # noqa: BLE001
|
|
1195
1313
|
return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
|
|
1196
1314
|
if name == 'a11y_audit_dom':
|
|
1197
1315
|
try:
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1316
|
+
res = audit_dom_url(args['url'], timeout=args.get('timeout', 45),
|
|
1317
|
+
lang=args.get('lang', 'en'),
|
|
1318
|
+
auth_state=args.get('auth_state'),
|
|
1319
|
+
browser=args.get('browser', 'auto'),
|
|
1320
|
+
color_scheme=args.get('color_scheme', 'light'))
|
|
1321
|
+
return _content(_enrich_standard(res, args.get('standard'),
|
|
1322
|
+
args.get('target'), args.get('lang', 'en')))
|
|
1203
1323
|
except ImportError:
|
|
1204
1324
|
return {'content': [{'type': 'text',
|
|
1205
1325
|
'text': 'Playwright not installed: pip install playwright && playwright install chromium (or use a11y_audit_url for the zero-dependency static audit)'}],
|
|
@@ -1215,6 +1335,17 @@ def invoke(name, args):
|
|
|
1215
1335
|
'isError': True}
|
|
1216
1336
|
except Exception as e: # noqa: BLE001
|
|
1217
1337
|
return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
|
|
1338
|
+
if name == 'a11y_locate':
|
|
1339
|
+
return _content(locate_fn(args['html'], args['query'],
|
|
1340
|
+
role=args.get('role'),
|
|
1341
|
+
multiple=bool(args.get('multiple', False)),
|
|
1342
|
+
lang=args.get('lang', 'en')))
|
|
1343
|
+
if name == 'a11y_patches':
|
|
1344
|
+
if args.get('action') == 'verify':
|
|
1345
|
+
return _content(patches_apply_fn(args['html'], args.get('patch_set'),
|
|
1346
|
+
lang=args.get('lang', 'en')))
|
|
1347
|
+
return _content(patches_build_fn(args['html'], lang=args.get('lang', 'en'),
|
|
1348
|
+
title=args.get('title')))
|
|
1218
1349
|
if name == 'a11y_diff':
|
|
1219
1350
|
def _load(v):
|
|
1220
1351
|
v = v.strip()
|
|
@@ -1240,7 +1371,8 @@ def invoke(name, args):
|
|
|
1240
1371
|
try:
|
|
1241
1372
|
return _content(audit_scroll(args['url'], max_batches=args.get('max_batches', 5),
|
|
1242
1373
|
lang=args.get('lang', 'en'),
|
|
1243
|
-
auth_state=args.get('auth_state')
|
|
1374
|
+
auth_state=args.get('auth_state'),
|
|
1375
|
+
browser=args.get('browser', 'auto')))
|
|
1244
1376
|
except ImportError:
|
|
1245
1377
|
return {'content': [{'type': 'text',
|
|
1246
1378
|
'text': 'Playwright not installed: pip install playwright && playwright install chromium'}],
|
|
@@ -1261,7 +1393,7 @@ def invoke(name, args):
|
|
|
1261
1393
|
return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
|
|
1262
1394
|
if name == 'a11y_forms':
|
|
1263
1395
|
try:
|
|
1264
|
-
return _content(audit_forms(args['url'], timeout=args.get('timeout', 45),
|
|
1396
|
+
return _content(audit_forms(args['url'], timeout=args.get('timeout', 45), browser=args.get('browser', 'auto'),
|
|
1265
1397
|
lang=args.get('lang', 'en'),
|
|
1266
1398
|
auth_state=args.get('auth_state')))
|
|
1267
1399
|
except ImportError:
|
|
@@ -1274,7 +1406,19 @@ def invoke(name, args):
|
|
|
1274
1406
|
try:
|
|
1275
1407
|
return _content(build_pack_fn(args['reports'], snapshot=args.get('snapshot'),
|
|
1276
1408
|
reviewer=args.get('reviewer'),
|
|
1277
|
-
verified=args.get('verified')
|
|
1409
|
+
verified=args.get('verified'),
|
|
1410
|
+
scope=args.get('scope'),
|
|
1411
|
+
build=args.get('build'),
|
|
1412
|
+
lang=args.get('lang', 'en')))
|
|
1413
|
+
except Exception as e: # noqa: BLE001
|
|
1414
|
+
return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
|
|
1415
|
+
if name == 'a11y_scope':
|
|
1416
|
+
try:
|
|
1417
|
+
return _content(scope_fn(args['reports'], standard=args.get('standard', 'wcag22'),
|
|
1418
|
+
target=args.get('target', 'web'),
|
|
1419
|
+
answers=args.get('answers'),
|
|
1420
|
+
targets=args.get('targets'),
|
|
1421
|
+
lang=args.get('lang', 'en')))
|
|
1278
1422
|
except Exception as e: # noqa: BLE001
|
|
1279
1423
|
return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
|
|
1280
1424
|
if name == 'a11y_autofix':
|
|
@@ -1304,7 +1448,7 @@ def invoke(name, args):
|
|
|
1304
1448
|
return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
|
|
1305
1449
|
if name == 'a11y_hover':
|
|
1306
1450
|
try:
|
|
1307
|
-
return _content(audit_hover(args['url'], timeout=args.get('timeout', 45),
|
|
1451
|
+
return _content(audit_hover(args['url'], timeout=args.get('timeout', 45), browser=args.get('browser', 'auto'),
|
|
1308
1452
|
lang=args.get('lang', 'en'),
|
|
1309
1453
|
auth_state=args.get('auth_state')))
|
|
1310
1454
|
except ImportError:
|
|
@@ -1341,10 +1485,14 @@ def invoke(name, args):
|
|
|
1341
1485
|
if not args.get('url'):
|
|
1342
1486
|
return _content({'error': 'gaps requires url'})
|
|
1343
1487
|
from .a11yledger import gaps as _gaps
|
|
1344
|
-
return _content(_gaps(args['url'], path=path))
|
|
1488
|
+
return _content(_gaps(args['url'], path=path, lang=args.get('lang', 'en')))
|
|
1345
1489
|
if action == 'summary':
|
|
1346
1490
|
from .a11yledger import summary as _sum
|
|
1347
|
-
return _content(_sum(path=path))
|
|
1491
|
+
return _content(_sum(path=path, lang=args.get('lang', 'en')))
|
|
1492
|
+
# enum inválido: error de tool-result nombrando la action y las
|
|
1493
|
+
# válidas — no caer al 'unknown tool' del dispatcher
|
|
1494
|
+
return _content({'error': f'invalid action: {action}',
|
|
1495
|
+
'valid_actions': ['record', 'gaps', 'summary']})
|
|
1348
1496
|
except Exception as e:
|
|
1349
1497
|
return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
|
|
1350
1498
|
if name == 'a11y_criterion':
|
|
@@ -1353,6 +1501,27 @@ def invoke(name, args):
|
|
|
1353
1501
|
return _content(criterion_fn(args.get('code'), lang=args.get('lang', 'en'),
|
|
1354
1502
|
signal=args.get('signal')))
|
|
1355
1503
|
if name == 'a11y_journey_verdict':
|
|
1504
|
+
if args.get('verify_record') is not None:
|
|
1505
|
+
return _content(journey_verify_fn(args['verify_record'],
|
|
1506
|
+
lang=args.get('lang', 'en')))
|
|
1507
|
+
# verify-only calls need just verify_record; the judge/seal path
|
|
1508
|
+
# (schema-optional since 5.26.1) still requires the walk itself
|
|
1509
|
+
_missing = [k for k in ('task', 'steps', 'outcome') if not args.get(k)]
|
|
1510
|
+
if _missing:
|
|
1511
|
+
return _content({'error': f'{", ".join(_missing)} required '
|
|
1512
|
+
'(only verify_record calls omit task/steps/outcome)'})
|
|
1513
|
+
if args.get('seal'):
|
|
1514
|
+
rec = journey_seal_fn(args['task'], args['steps'], args['outcome'],
|
|
1515
|
+
url=args.get('url', ''),
|
|
1516
|
+
lang=args.get('lang', 'en'))
|
|
1517
|
+
if args.get('output_path') and 'error' not in rec:
|
|
1518
|
+
with open(args['output_path'], 'w', encoding='utf-8') as f:
|
|
1519
|
+
f.write(json.dumps(rec, ensure_ascii=False, indent=1) + '\n')
|
|
1520
|
+
return _content({'out': args['output_path'],
|
|
1521
|
+
'sha256': rec['sha256'],
|
|
1522
|
+
'verdict': rec['verdict']['verdict'],
|
|
1523
|
+
'score': rec['verdict']['score']})
|
|
1524
|
+
return _content(rec)
|
|
1356
1525
|
res = journey_verdict_fn(args['task'], args['steps'], args['outcome'],
|
|
1357
1526
|
url=args.get('url', ''), lang=args.get('lang', 'en'))
|
|
1358
1527
|
if args.get('output_path') and 'error' not in res:
|
|
@@ -1405,7 +1574,8 @@ def invoke(name, args):
|
|
|
1405
1574
|
description=args.get('product_description'),
|
|
1406
1575
|
contact=args.get('contact'), methods=args.get('methods'),
|
|
1407
1576
|
notes=args.get('notes'), overrides=args.get('overrides'),
|
|
1408
|
-
reviewer=args.get('reviewer'),
|
|
1577
|
+
reviewer=args.get('reviewer'), scope=args.get('scope'),
|
|
1578
|
+
lang=args.get('lang', 'en'),
|
|
1409
1579
|
output_path=args.get('output_path'))
|
|
1410
1580
|
if 'error' in res:
|
|
1411
1581
|
return {'content': [{'type': 'text', 'text': res['error']}], 'isError': True}
|
|
@@ -1425,7 +1595,8 @@ def invoke(name, args):
|
|
|
1425
1595
|
description=args.get('product_description'),
|
|
1426
1596
|
author=args.get('author'), contact=args.get('contact'),
|
|
1427
1597
|
methods=args.get('methods'), notes=args.get('notes'),
|
|
1428
|
-
overrides=args.get('overrides'),
|
|
1598
|
+
overrides=args.get('overrides'), scope=args.get('scope'),
|
|
1599
|
+
lang=args.get('lang', 'en'),
|
|
1429
1600
|
output_path=args.get('output_path'))
|
|
1430
1601
|
if 'error' in res:
|
|
1431
1602
|
return {'content': [{'type': 'text', 'text': res['error']}], 'isError': True}
|
|
@@ -1469,13 +1640,27 @@ def invoke(name, args):
|
|
|
1469
1640
|
else:
|
|
1470
1641
|
with open(os.path.join(HERE, 'arialive.js'), encoding='utf-8') as f:
|
|
1471
1642
|
js = f.read()
|
|
1472
|
-
if args.get('lang')
|
|
1643
|
+
if (args.get('lang') or 'en') != 'es':
|
|
1644
|
+
# the snippet's built-in labels are Spanish; the schema documents
|
|
1645
|
+
# en as the default, so only an explicit lang='es' keeps them
|
|
1473
1646
|
js = "window.ALM_LANG='en';\n" + js
|
|
1474
1647
|
return {'content': [{'type': 'text', 'text': js}]}
|
|
1475
1648
|
raise ValueError(f'unknown tool: {name}')
|
|
1476
1649
|
|
|
1477
1650
|
|
|
1478
1651
|
def main():
|
|
1652
|
+
# stdio MCP is UTF-8 by spec, but the process locale decides the pipe
|
|
1653
|
+
# encoding (cp1252 on Windows): one CJK/emoji finding would raise
|
|
1654
|
+
# UnicodeEncodeError OUTSIDE any try and kill the server mid-protocol.
|
|
1655
|
+
# stdin decodes with errors='replace' so a hostile line can never crash
|
|
1656
|
+
# the read either; stdout must encode everything we emit.
|
|
1657
|
+
for _stream, _kw in ((sys.stdin, {'encoding': 'utf-8', 'errors': 'replace'}),
|
|
1658
|
+
(sys.stdout, {'encoding': 'utf-8'})):
|
|
1659
|
+
if hasattr(_stream, 'reconfigure'):
|
|
1660
|
+
try:
|
|
1661
|
+
_stream.reconfigure(**_kw)
|
|
1662
|
+
except (ValueError, OSError, AttributeError):
|
|
1663
|
+
pass # exotic/closed streams: keep their default encoding
|
|
1479
1664
|
for line in sys.stdin:
|
|
1480
1665
|
line = line.strip()
|
|
1481
1666
|
if not line:
|
|
@@ -1498,7 +1683,10 @@ def main():
|
|
|
1498
1683
|
try:
|
|
1499
1684
|
if method == 'initialize':
|
|
1500
1685
|
resp = {'jsonrpc': '2.0', 'id': mid, 'result': {
|
|
1501
|
-
|
|
1686
|
+
# MCP: answer with the LATEST version we actually support,
|
|
1687
|
+
# never echo the client's (batching is rejected below, so
|
|
1688
|
+
# echoing e.g. '2025-06-18' would be a partial lie)
|
|
1689
|
+
'protocolVersion': '2024-11-05',
|
|
1502
1690
|
'capabilities': {'tools': {}, 'prompts': {}},
|
|
1503
1691
|
'serverInfo': {'name': 'a11y-toolkit', 'version': VERSION},
|
|
1504
1692
|
'instructions': INSTRUCTIONS,
|