@jrpool/kilotest 40.0.0 → 41.1.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.
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Exec(git status)",
5
+ "Exec(git log)",
6
+ "Exec(cat)",
7
+ "Exec(ls)",
8
+ "Exec(find)",
9
+ "Exec(git show)"
10
+ ]
11
+ }
12
+ }
package/README.md CHANGED
@@ -18,7 +18,7 @@ Testing for Kilotest is performed by one or more testing agents that obtain jobs
18
18
 
19
19
  An active production instance of Kilotest may require multiple testing agents to handle the load, because testing one web page typically takes about 3 minutes and agents test only one page at a time.
20
20
 
21
- ## Getting started locally with 1 testing agent
21
+ ## Getting started locally with 1 testing worker
22
22
 
23
23
  ### Installation
24
24
 
@@ -30,7 +30,7 @@ In the steps below, hosts `T` and `K` may be the same host or two different host
30
30
  1. Clone the Kilotest repository into a new directory on host `K`.
31
31
  1. In that directory, install the Kilotest dependencies: `npm install`.
32
32
  1. Copy the `env.testaro` file from the `kilotest` directory to `.env` in the `testaro` directory and replace the `__placeholder__` values in `.env` with actual values.
33
- 1. Copy the `env.example` file in the `kilotest` directory to a new `.env` file in the same directory and replace the `__placeholder__` values in `.env` with actual values.
33
+ 1. Copy the `env.example` file in the `kilotest` directory to a new `.env` file in the same directory and replace the `__placeholder__` values in `.env` with actual values. `TESTARO_WORKERS` is a JSON object mapping each Testaro worker's ID to an object with its `secret` and its `name`; the ID and secret for a worker must match the `NETWATCH_URL_WORKER_ID` and `NETWATCH_URL_AUTH` values in that worker's `.env`. A worker authenticates each request with an HTTP Basic `Authorization` header (`id:secret`, base64-encoded); as of this writing that header is not yet sent by the published Testaro package, so this scheme requires a matching update to Testaro's `netWatch.js` request code (only to send the header; no change to Testaro's handling of jobs or reports is needed). The ID is a credential and is never published; the `name` is written by Kilotest into a job's and report's `sources.worker` property, which Testaro does not read or alter, so it is a distinct property from `sources.agent` (Testaro's own, untrusted, self-reported label, which Kilotest ignores). Choose a `name` that is safe to appear in every report Kilotest serves.
34
34
 
35
35
  ### Usage
36
36
 
@@ -47,4 +47,16 @@ See the `SERVICE.md` file for instructions on how to make Kilotest a service.
47
47
 
48
48
  ## Using Kilotest as an AI tool
49
49
 
50
- See the `AI-TOOLS.md` file for information about the configuration of Kilotest as a collection of AI tools.
50
+ Kilotest is not only a web application but also an API and an MCP server. AI platforms and models can use Kilotest via those interfaces.
51
+
52
+ The URL for models using the MCP server is `http://kilotest.com/mcp`. The MCP server is listed at these services:
53
+
54
+ - [Smithery](https://smithery.ai/servers/pool/kilotest)
55
+ - [Glama](https://glama.ai/mcp/connectors/com.kilotest/kilotest)
56
+
57
+ There is additional documentation at:
58
+
59
+ - [AI-TOOLS.md](AI-TOOLS.md)
60
+ - [llms.txt](llms.txt)
61
+ - [llms-full.txt](llms-full.txt)
62
+ - [QAI](https://kilotest.com/qai)
package/alerts.js CHANGED
@@ -28,6 +28,7 @@ exports.sendAlert = (subject, body) => new Promise(resolve => {
28
28
  subject,
29
29
  text: body
30
30
  });
31
+ // Ask the alerting host to send an alert to the manager.
31
32
  const req = https.request({
32
33
  hostname: ALERT_API_HOST,
33
34
  path: ALERT_API_PATH,
@@ -43,10 +44,14 @@ exports.sendAlert = (subject, body) => new Promise(resolve => {
43
44
  data += chunk;
44
45
  });
45
46
  res.on('end', () => {
47
+ // If this succeeded:
46
48
  if (res.statusCode >= 200 && res.statusCode < 300) {
49
+ // Report this.
47
50
  console.log(`Alert sent (${subject})`);
48
51
  }
52
+ // Otherwise, i.e. if it failed:
49
53
  else {
54
+ // Report this.
50
55
  console.log(`ERROR: Alert API responded ${res.statusCode}: ${data}`);
51
56
  }
52
57
  resolve();
package/docs/AI-TOOLS.md CHANGED
@@ -43,9 +43,11 @@ The internal changes that have been made in the Kilotest codebase to support the
43
43
  The external actions that have been taken to support the use of Kilotest as a collection of AI tools are:
44
44
 
45
45
  - A [pull request](https://github.com/public-apis/public-apis/pull/6346/changes) to add Kilotest to the list of public APIs in the `public-apis` repository.
46
- - A [request](https://rapidapi.com/studio/api_91f2ce07-2572-48bd-a34d-ff01ed6cd039/publish/general) to add Kilotest to the Rapid API Hub.
47
46
  - An [issue](https://github.com/APIs-guru/openapi-directory/issues/2677) to add Kilotest to `openapi-directory`.
48
47
  - A [pull request](https://github.com/w3c/wai-evaluation-tools-list/pull/1153) to add Kilotest to the WAI evaluation tools list.
48
+ - Registration of Kilotest with the [Smithery](https://smithery.ai/servers/pool/kilotest) MCP server registry.
49
+ - Registration of Kilotest with the [Glama](https://glama.ai/mcp/connectors/com.kilotest/kilotest) MCP server registry.
50
+ - Registration of Kilotest with the [RapidAPI](https://rapidapi.com/jrpool/api/kilotest/playground/apiendpoint_0f03577a-ff9a-472a-a0ed-533bd198981a) Hub.
49
51
  - Deployment of an MCP server in HTTP mode on the Kilotest service host.
50
52
  - Configuration of Claude Desktop on the local development host and the `claude.ai` web application to connect Claude Desktop models to the Kilotest MCP server. The configuration was performed in the UI of each platform with the addition of Kilotest as a _connector_. The user used the `Customize/Connectors/Add connector/Add custom connector` interface, providing these data before activating the `Add` button:
51
53
 
package/docs/SERVICE.md CHANGED
@@ -203,7 +203,7 @@ kilotest.com {
203
203
  }
204
204
  @allowedPOST {
205
205
  method POST
206
- path /mcp /retestRec.html/* /testRec.html /recAction.html /reannotate.html /wcagRenew.html /api/* /tutorialComment.html
206
+ path /mcp /retestRec.html/* /testRec.html /recAction.html /reannotate.html /wcagRenew.html /api/* /worker/* /tutorialComment.html
207
207
  }
208
208
  # Respond to OPTIONS requests.
209
209
  @allowedOPTIONS method OPTIONS
@@ -244,7 +244,7 @@ kilotest.com {
244
244
 
245
245
  This configuration can be futher tightened if experience warrants.
246
246
 
247
- The `flush_interval` setting prevents granular reporting by Testaro agents from being buffered, so the updates reach the browser without delay.
247
+ The `flush_interval` setting prevents granular reporting by Testaro workers from being buffered, so the updates reach the browser without delay.
248
248
 
249
249
  ## Version management
250
250
 
@@ -326,7 +326,7 @@ After that the maintainer can inspect the original and restored directories and
326
326
 
327
327
  ### Possible future Testaro integration
328
328
 
329
- Kilotest uses Testaro to run jobs. In previous versions of Kilotest, Testaro was a dependency. It is currently not a dependenc. Instead, Testaro instances are installed on one or more other hosts, and each instance polls Kilotest to ask for jobs to run.
329
+ Kilotest uses Testaro to run jobs. In previous versions of Kilotest, Testaro was a dependency. It is currently not a dependency. Instead, Testaro instances are installed on one or more other hosts, and each instance polls Kilotest to ask for jobs to run.
330
330
 
331
331
  In case Testaro again becomes a dependency of Kilotest, the notes below on security issues will be useful.
332
332
 
package/env.example CHANGED
@@ -1,32 +1,29 @@
1
- # ENVIRONMENT=test for a dev/test host, =production for a deployed host.
1
+ # test (local) or production (deployed host).
2
2
  ENVIRONMENT=__placeholder__
3
- # PROTOCOL=http for a local dev/test host or reverse-proxied server, otherwise =https.
3
+ # http (local or reverse-proxied server) or https.
4
4
  PROTOCOL=__placeholder__
5
- # AUTH_CODE for manager operations; must be 3 characters long.
5
+ # 3-character password for manager operations.
6
6
  AUTH_CODE=__placeholder__
7
- # Name of Testaro agent.
8
- TESTARO_AGENT=testaro-agent
9
- # Testaro agent password (same as NETWATCH_AUTH in the Testaro .env.
10
- TESTARO_AGENT_PW=__placeholder__
11
- # Name of research agent (AI agent calling Kilotest as a tool).
12
- RESEARCH_AGENT=research-agent
13
- # Research agent password.
14
- RESEARCH_AGENT_PW=__placeholder__
15
- # URL of this Kilotest host.
7
+ # ID of each Testaro worker and, for each, its secret and published name.
8
+ TESTARO_WORKERS={"__placeholder__":{"secret":"__placeholder__","name":"__placeholder__"}}
9
+ # URL of this host.
16
10
  THIS_KILOTEST_HOST=__placeholder__
17
- # URL of a dev/test Kilotest host.
11
+ # URL of a dev/test host.
18
12
  LOCAL_KILOTEST_HOST=http://localhost:3000
19
- # URL of the deployed Kilotest host.
13
+ # URL of the deployed host.
20
14
  DEPLOYED_KILOTEST_HOST=https://kilotest.com
21
- # Alert email configuration:
15
+
16
+ # Alert configuration:
17
+
22
18
  MANAGER_EMAIL=__placeholder__
23
19
  ALERT_API_HOST=api.resend.com
24
20
  ALERT_API_PATH=/emails
25
21
  ALERT_API_KEY=__placeholder__
26
22
  ALERT_FROM=__placeholder__
27
- # Alert thresholds:
28
- WAVE_BALANCE_THRESHOLD=30
29
- AI_SERVICE0_BALANCE_THRESHOLD=10
23
+ # Threshold in credits.
24
+ WAVE_BALANCE_THRESHOLD=__placeholder__
25
+ # Threshold in dollars.
26
+ AI_SERVICE0_BALANCE_THRESHOLD=__placeholder__
30
27
  # Per-million-token prices (Claude Haiku 4.5) on 2026-05-01 were $1 in, $5 out.
31
28
  AI_MODEL0_INPUT_PRICE=0.000001
32
29
  AI_MODEL0_OUTPUT_PRICE=0.000005
package/env.testaro CHANGED
@@ -1,17 +1,43 @@
1
1
  # You can get a WAVE API key at https://wave.webaim.org/api.
2
2
  WAVE_KEY=__placeholder__
3
- AGENT=testaro-agent
3
+ # You can get an Anthropic API key at https://console.anthropic.com/.
4
+ ANTHROPIC_API_KEY=__placeholder__
5
+ # Any message from this instance to the server (optional).
6
+ AGENT=__placeholder__
7
+ # Whether to make the browser visible (normally false).
4
8
  HEADED_BROWSER=false
9
+ # Whether to output even forked-job logging to the primary log (normally false).
5
10
  DEBUG=false
11
+ # Number of seconds to wait between actions (normally 0).
6
12
  WAITS=0
13
+ # See https://nodejs.org/api/cli.html#options for all permitted options.
7
14
  NODE_OPTIONS='--trace-uncaught --trace-warnings'
15
+ # Whether to suppress a routine warning from QualWeb.
8
16
  PUPPETEER_DISABLE_HEADLESS_WARNING=true
9
- # Replace the next 2 placeholders with:
10
- # http://localhost:3000 if Kilotest and Testaro are on the same host.
11
- # the URL of the Kilotest server (e.g., https://kilotest.com) if they are on different hosts.
12
- NETWATCH_JOB=__placeholder__/api/testaro-agent/job
13
- NETWATCH_REPORT=__placeholder__/api/testaro-agent/report
14
- # NETWATCH_AUTH must be identical to TESTARO_AGENT_PW in the Kilotest .env.
15
- NETWATCH_AUTH=__placeholder__
17
+ # Directory (relative to project root) to watch for jobs.
18
+ JOBDIR=__placeholder__
19
+ # Directory (relative to project root) to write reports to when watching a directory for jobs.
20
+ REPORTDIR=__placeholder__
21
+ # Multiplier for time limits (normally 1).
16
22
  TIMEOUT_MULTIPLIER=1
17
- TMPDIRNAME=scratch
23
+ # Whether to abort the job when launch retries are exhausted or a test act crashes (default false).
24
+ ABORT_ASSERTIVELY=false
25
+ # URL of any non-default (e.g., self-hosted) Nu Html Checker API (see ghcr.io/validator/validator).
26
+ TESTARO_NU_URL=__placeholder__
27
+ # Whether to launch the Playwright chromium browser without its sandbox (normally false).
28
+ # The sandbox requires unprivileged user-namespace cloning, which default container
29
+ # seccomp policies and some hardened hosts prohibit. Set this to true in containers,
30
+ # or run containers with a seccomp profile that permits user-namespace cloning.
31
+ TESTARO_CHROMIUM_NO_SANDBOX=false
32
+
33
+ # netWatch variables
34
+
35
+ # Replace the next 2 placeholders with the hostname of the server (e.g., http://localhost:3000 or https://kilotest.com).
36
+ # URL to poll for available jobs.
37
+ NETWATCH_URL_JOB=__placeholder__/worker/job
38
+ # URL to send a job report.
39
+ NETWATCH_URL_REPORT=__placeholder__/worker/report
40
+
41
+ # The server requires an authorization header. Identifier and secret of this worker.
42
+ WORKER_ID=__placeholder__
43
+ WORKER_SECRET=__placeholder__
package/index.js CHANGED
@@ -69,8 +69,18 @@ const protocol = process.env.PROTOCOL || 'http';
69
69
  const queuePath = path.join(jobsPath, 'queue');
70
70
  const claimedPath = path.join(jobsPath, 'claimed');
71
71
  const failedPath = path.join(jobsPath, 'failed');
72
- const testaroAgent = process.env.TESTARO_AGENT;
73
- const testaroAgentPW = process.env.TESTARO_AGENT_PW;
72
+ // Credentials of the Testaro workers, by worker ID, from a JSON-object environment variable.
73
+ // Each worker ID maps to a secret (used only to authenticate the worker, never published) and a
74
+ // name (a non-secret label safe to publish, e.g. in report data and logs).
75
+ const workerCredentials = (() => {
76
+ try {
77
+ return JSON.parse(process.env.TESTARO_WORKERS || '{}');
78
+ }
79
+ catch (error) {
80
+ console.error(`ERROR: TESTARO_WORKERS is not valid JSON (${error.message})`);
81
+ return {};
82
+ }
83
+ })();
74
84
  // Values that may require alerts.
75
85
  const balancePath = path.join(__dirname, 'ai0Balance.json');
76
86
  const jobLock = createLock();
@@ -82,11 +92,11 @@ const AI_MODEL0_OUTPUT_PRICE = Number(process.env.AI_MODEL0_OUTPUT_PRICE);
82
92
  // FUNCTIONS
83
93
 
84
94
  // Serves or sends an error message.
85
- const serveError = async (error, response, isHumanUser = true) => {
95
+ const serveError = async (error, response, isHumanUser = true, statusCode = 400) => {
86
96
  const errorLines = Object.entries(error).map(pair => `${pair[0]}: ${pair[1]}`);
87
97
  console.log(errorLines.join('\n') || 'ERROR');
88
98
  if (!response.writableEnded) {
89
- response.statusCode = 400;
99
+ response.statusCode = statusCode;
90
100
  // If the request is from a human user:
91
101
  if (isHumanUser) {
92
102
  // Serve an HTML page containing the message property of the error.
@@ -189,19 +199,53 @@ const getAbuseError = (request, reason) => {
189
199
  time: new Date().toISOString()
190
200
  };
191
201
  };
192
- // Processes a job request from a Testaro agent.
193
- const processJobRequest = async (request, response, agentID) => jobLock(async () => {
202
+ // Gets the ID and secret from a request's HTTP Basic Authorization header, or null if the header
203
+ // is absent or malformed.
204
+ const getBasicAuth = request => {
205
+ const header = request.headers['authorization'] || '';
206
+ const match = header.match(/^Basic\s+(\S+)$/i);
207
+ if (!match) {
208
+ return null;
209
+ }
210
+ let decoded;
211
+ try {
212
+ decoded = Buffer.from(match[1], 'base64').toString('utf8');
213
+ }
214
+ catch {
215
+ return null;
216
+ }
217
+ const sepIndex = decoded.indexOf(':');
218
+ if (sepIndex === -1) {
219
+ return null;
220
+ }
221
+ return {id: decoded.slice(0, sepIndex), secret: decoded.slice(sepIndex + 1)};
222
+ };
223
+ // Gets the published name of the Testaro worker that made a request, or null if it is not
224
+ // authenticated. The ID authenticates the worker and is never published; the name is a
225
+ // non-secret label safe to write into job/report data and log messages.
226
+ const getAuthorizedWorkerName = request => {
227
+ const credentials = getBasicAuth(request);
228
+ if (credentials) {
229
+ const worker = workerCredentials[credentials.id];
230
+ if (worker && worker.secret === credentials.secret && worker.name) {
231
+ return worker.name;
232
+ }
233
+ }
234
+ return null;
235
+ };
236
+ // Processes a job request from a Testaro worker.
237
+ const processJobRequest = async (request, response, workerName) => jobLock(async () => {
194
238
  let clean = true;
195
- const messageStart = `Testaro agent ${agentID} requested a job, `;
239
+ const messageStart = `Testaro worker ${workerName} requested a job, `;
196
240
  const jobNames = await getJobNames();
197
241
  const claimedJobNames = jobNames.claimed;
198
242
  // For each claimed job:
199
243
  for (const jobName of claimedJobNames) {
200
244
  const job = await getObject(path.join(jobsPath, 'claimed', jobName));
201
245
  const {id, sources} = job;
202
- const {agent} = sources;
203
- // If its assignee is the agent:
204
- if (agent === agentID) {
246
+ const {worker} = sources;
247
+ // If its assignee is the worker:
248
+ if (worker === workerName) {
205
249
  const messageEnd = `but has not completed job ${id}`;
206
250
  // Report this.
207
251
  await serveError({message: `${messageStart}${messageEnd}`}, response, false);
@@ -214,7 +258,7 @@ const processJobRequest = async (request, response, agentID) => jobLock(async ()
214
258
  break;
215
259
  }
216
260
  }
217
- // If no aborted-job error was found for the agent:
261
+ // If no aborted-job error was found for the worker:
218
262
  if (clean) {
219
263
  const queuedJobNames = jobNames.queue;
220
264
  // If any jobs are queued:
@@ -222,18 +266,18 @@ const processJobRequest = async (request, response, agentID) => jobLock(async ()
222
266
  const oldestJobName = queuedJobNames[0];
223
267
  // Get the first one.
224
268
  const firstJob = await getObject(path.join(queuePath, oldestJobName));
225
- // Add the agent ID to the job.
226
- firstJob.sources.agent = agentID;
269
+ // Add the public worker name to the job, in a property Testaro does not read or alter.
270
+ firstJob.sources.worker = workerName;
227
271
  console.log(
228
- `Job ${firstJob.id} (${firstJob.target.what}) is being sent to the agent.`
272
+ `Job ${firstJob.id} (${firstJob.target.what}) is being sent to the worker.`
229
273
  );
230
- // Assign the job to the agent.
274
+ // Assign the job to the worker.
231
275
  response.writeHead(200, {
232
276
  'content-type': 'application/json; charset=utf-8'
233
277
  });
234
278
  response.end(JSON.stringify(firstJob));
235
279
  const messageEnd
236
- = `and job ${firstJob.id} (${firstJob.target.what}) was assigned to the agent`;
280
+ = `and job ${firstJob.id} (${firstJob.target.what}) was assigned to the worker`;
237
281
  console.log(`${messageStart}${messageEnd}`);
238
282
  // Save the job in the claimed-jobs directory.
239
283
  await fs.writeFile(
@@ -247,7 +291,7 @@ const processJobRequest = async (request, response, agentID) => jobLock(async ()
247
291
  response.writeHead(200, {
248
292
  'content-type': 'application/json; charset=utf-8'
249
293
  });
250
- // Send a no-jobs response to the agent.
294
+ // Send a no-jobs response to the worker.
251
295
  response.end(JSON.stringify({}));
252
296
  const messageEnd = 'but no job was in the queue';
253
297
  console.log(`${messageStart}${messageEnd}`);
@@ -674,47 +718,67 @@ const requestHandler = async (request, response) => {
674
718
  await serveError({message: answerData.message}, response, true);
675
719
  }
676
720
  }
677
- // Otherwise, if it is a request from an agent:
678
- else if (pageName === 'api') {
679
- // Get the segments of the path after api.
680
- const segments = pathTail.split('/');
681
- // If the first segment is the ID of the Testaro agent and the agent is authenticated:
682
- if (segments[0] === testaroAgent && postData.agentPW === testaroAgentPW) {
683
- const agentID = segments[0];
721
+ // Otherwise, if it is a request from a Testaro worker:
722
+ else if (pageName === 'worker') {
723
+ // Authenticate the worker and get its public name.
724
+ const workerName = getAuthorizedWorkerName(request);
725
+ // If this succeeded:
726
+ if (workerName) {
684
727
  // Get the requested service from the path.
685
- const service = segments[1];
728
+ const service = pathTail;
686
729
  // If the service is job assignment:
687
730
  if (service === 'job') {
688
731
  // Process the job request as a transaction.
689
- await processJobRequest(request, response, agentID);
732
+ await processJobRequest(request, response, workerName);
690
733
  }
691
- // Otherwise, if the service is report acquisition:
734
+ // Otherwise, if it is report acquisition:
692
735
  else if (service === 'report') {
693
736
  const {report} = postData;
694
737
  const {id, target} = report;
695
738
  const {what, url} = target;
696
739
  const [timeStamp, jobID] = id?.split('-') ?? ['', ''];
697
- // If the request is valid:
740
+ // If the request is syntactically valid:
698
741
  if (id && isTimeStamp(timeStamp) && isJobID(jobID) && what && url) {
699
742
  const [timeStamp, jobID] = id.split('-');
700
- // Save the report.
701
- await fs.writeFile(getReportPath(timeStamp, jobID), getJSON(report));
702
- // Update the data on the available reports.
703
- await makeReportsExtract();
704
- // Annotate the report.
705
- await annotateReport(ruleIDs, timeStamp, jobID);
706
- console.log(`Testaro report ${id} was annotated, saved, and indexed`);
707
- // Check the monetary balances and send alerts if nearing exhaustion.
708
- await checkBalancesForAlerts(report);
709
- // Delete the job.
710
- await fs.unlink(path.join(claimedPath, `${id}.json`));
711
- console.log(`Completed job ${id} deleted`);
712
- // Acknowledge receipt.
713
- response.setHeader('content-type', 'application/json; charset=utf-8');
714
- response.end(JSON.stringify({status: 'ok'}));
715
- console.log(`Testaro report ${id} was received from Testaro agent ${agentID}`);
743
+ // Get the job the report is from.
744
+ const claimedJob = await getObject(path.join(claimedPath, `${id}.json`));
745
+ // If the job was actually assigned to this worker:
746
+ if (typeof claimedJob === 'object' && claimedJob.sources?.worker === workerName) {
747
+ console.log(`Testaro report ${id} was received from worker ${workerName}`);
748
+ // Add the public worker name to the report.
749
+ report.sources = {...report.sources, worker: workerName};
750
+ // Save the report.
751
+ await fs.writeFile(getReportPath(timeStamp, jobID), getJSON(report));
752
+ // Update the data on the available reports.
753
+ await makeReportsExtract();
754
+ // Annotate the report.
755
+ await annotateReport(ruleIDs, timeStamp, jobID);
756
+ console.log(`Testaro report ${id} was annotated, saved, and indexed`);
757
+ // Check the monetary balances and send alerts if nearing exhaustion.
758
+ await checkBalancesForAlerts(report);
759
+ // Delete the job.
760
+ await fs.unlink(path.join(claimedPath, `${id}.json`));
761
+ console.log(`Completed job ${id} deleted`);
762
+ // Acknowledge receipt.
763
+ response.setHeader('content-type', 'application/json; charset=utf-8');
764
+ response.end(JSON.stringify({status: 'ok'}));
765
+ console.log(
766
+ `Testaro report ${id} was received from Testaro worker ${workerName}`
767
+ );
768
+ }
769
+ // Otherwise, i.e. if the job was not assigned to this worker:
770
+ else {
771
+ await serveError(
772
+ getAbuseError(
773
+ request,
774
+ `Worker ${workerName} submitted a report for job ${id}, which was not currently assigned to it`
775
+ ),
776
+ response,
777
+ false
778
+ );
779
+ }
716
780
  }
717
- // Otherwise, i.e. if the request is invalid:
781
+ // Otherwise, i.e. if the request is syntactically invalid:
718
782
  else {
719
783
  await serveError({message: 'ERROR: Request invalid'}, response, false);
720
784
  }
@@ -722,54 +786,56 @@ const requestHandler = async (request, response) => {
722
786
  // Otherwise, i.e. if the service is invalid:
723
787
  else {
724
788
  await serveError(
725
- {message: 'ERROR: Invalid service request from Testaro agent'}, response, false
726
- );
727
- }
728
- }
729
- // Otherwise, if the first segment is not the ID of the Testaro agent:
730
- else if (segments[0] !== testaroAgent) {
731
- // If the service is to receive a test request:
732
- if (segments[0] === 'requestTest') {
733
- const {description, URL, reason} = postData;
734
- // Get the response body.
735
- const responseBody = await require(path.join(__dirname, 'api', 'requestTest'))
736
- .response([description, URL, reason]);
737
- // Send it.
738
- setHeaders('application/json', null, 'ultra');
739
- response.end(JSON.stringify(responseBody));
740
- }
741
- // Otherwise, if the service is to receive a retest request:
742
- else if (segments[0] === 'requestRetest') {
743
- const {reason} = postData;
744
- // Get the response body.
745
- const responseBody = await require(path.join(__dirname, 'api', 'requestRetest'))
746
- .response(segments.slice(1).concat(reason));
747
- // Send it.
748
- setHeaders('application/json', null, 'ultra');
749
- response.end(JSON.stringify(responseBody));
750
- }
751
- // Otherwise, if the service is to receive a feature request:
752
- else if (segments[0] === 'requestFeature') {
753
- const {feature} = postData;
754
- // Get the response body.
755
- const responseBody = await require(path.join(__dirname, 'api', 'requestFeature'))
756
- .response([feature]);
757
- // Send it.
758
- setHeaders('application/json', null, 'ultra');
759
- response.end(JSON.stringify(responseBody));
760
- }
761
- // Otherwise, i.e. if the service is invalid:
762
- else {
763
- await serveError(
764
- {message: 'ERROR: Invalid request'}, response, false
789
+ {message: 'ERROR: Invalid service request from Testaro worker'}, response, false
765
790
  );
766
791
  }
767
792
  }
768
- // Otherwise, i.e. if the request is invalid:
793
+ // Otherwise, i.e. if it is not authenticated:
769
794
  else {
770
795
  // Report this.
771
796
  await serveError(
772
- {message: 'ERROR: Invalid API request'}, response, false
797
+ {message: 'ERROR: Unauthorized worker request'}, response, false, 401
798
+ );
799
+ }
800
+ }
801
+ // Otherwise, if it is a request from an API consumer:
802
+ else if (pageName === 'api') {
803
+ // Get the segments of the path after api.
804
+ const segments = pathTail.split('/');
805
+ // If the service is to receive a test request:
806
+ if (segments[0] === 'requestTest') {
807
+ const {description, URL, reason} = postData;
808
+ // Get the response body.
809
+ const responseBody = await require(path.join(__dirname, 'api', 'requestTest'))
810
+ .response([description, URL, reason]);
811
+ // Send it.
812
+ setHeaders('application/json', null, 'ultra');
813
+ response.end(JSON.stringify(responseBody));
814
+ }
815
+ // Otherwise, if the service is to receive a retest request:
816
+ else if (segments[0] === 'requestRetest') {
817
+ const {reason} = postData;
818
+ // Get the response body.
819
+ const responseBody = await require(path.join(__dirname, 'api', 'requestRetest'))
820
+ .response(segments.slice(1).concat(reason));
821
+ // Send it.
822
+ setHeaders('application/json', null, 'ultra');
823
+ response.end(JSON.stringify(responseBody));
824
+ }
825
+ // Otherwise, if the service is to receive a feature request:
826
+ else if (segments[0] === 'requestFeature') {
827
+ const {feature} = postData;
828
+ // Get the response body.
829
+ const responseBody = await require(path.join(__dirname, 'api', 'requestFeature'))
830
+ .response([feature]);
831
+ // Send it.
832
+ setHeaders('application/json', null, 'ultra');
833
+ response.end(JSON.stringify(responseBody));
834
+ }
835
+ // Otherwise, i.e. if the service is invalid:
836
+ else {
837
+ await serveError(
838
+ {message: 'ERROR: Invalid request'}, response, false
773
839
  );
774
840
  }
775
841
  }
package/llms-full.txt CHANGED
@@ -6,18 +6,18 @@ Kilotest is an application that performs ensemble testing of web pages for front
6
6
 
7
7
  ## What Kilotest does for language models
8
8
 
9
- Kilotest is deployed on the public Internet as a service at `kilotest.com`. Kilotest can test only web pages that can be accessed from the public Internet and that are not protected by authentication or other access controls. Kilotest has not implemented any mechanism for testing private, internal, password-protected, or otherwise restricted pages.
9
+ Kilotest is deployed on the public Internet as a service at `https://kilotest.com`. Kilotest can test only web pages that can be accessed from the public Internet and that are not protected by authentication or other access controls. Kilotest has not implemented any mechanism for testing private, internal, password-protected, or otherwise restricted pages.
10
10
 
11
- An LLM can, under some conditions, load web pages and use its knowledge to assess successes and failures of front-end quality. But such an assessment is almost always:
11
+ Without calling any tool, an LLM can, under some conditions, load web pages and use its knowledge to assess successes and failures of front-end quality. But such an assessment is almost always:
12
12
 
13
13
  - expensive, substituting inference for deterministic rule application
14
14
  - fragmentary, because of capability limitations, such as inability to run browsers and interact with web pages
15
15
  - inaccurate, because of the tendency to replace missing information with hallucinations
16
16
 
17
- To provide a more inexpensive, thorough, and accurate assessment, the agent could ask an ensemble of specialized rule engines to test the page. However, selecting and running such rule engines and consolidating their results is itself expensive and difficult. Kilotest assumes responsibility for these functions. Kilotest:
17
+ To provide a more inexpensive, thorough, and accurate assessment, the agent could, in principle, ask an ensemble of specialized rule engines to test the page. However, selecting and running such rule engines and consolidating their results is itself expensive and difficult, and most available rule engines are not callable as MCP tools. Kilotest assumes responsibility for assembling, integrating, and running several rule engines. Kilotest:
18
18
 
19
- - defines a tool that tests web pages for front-end quality
20
- - defines tools that report the test results
19
+ - defines an MCP tool that tests web pages for front-end quality
20
+ - defines MCP tools that report the test results
21
21
  - defines connectors to those tools, compatible with major AI platforms
22
22
 
23
23
  The tool that tests web pages for front-end quality has attributes that no other such tool has. It:
@@ -27,7 +27,7 @@ The tool that tests web pages for front-end quality has attributes that no other
27
27
  - combines the reports of the rule engines into a single integrated report
28
28
  - consolidates the 1000+ rules having 10 different naming systems into 300+ “issues” with a uniform naming system
29
29
 
30
- The tools that report test results extract from reports statistics and details at various levels of granularity, as required by an agent to fulfill particular requests.
30
+ The tools that report test results extract from reports statistics and details at various levels of granularity, as required by an agent to fulfill particular user requests.
31
31
 
32
32
  ## What Kilotest does **not** do for language models
33
33
 
@@ -48,7 +48,7 @@ The rule engines in the Kilotest ensemble take responsibility for determining wh
48
48
 
49
49
  In the marketplace for MCP servers that test for front-end quality, all servers other than that of Kilotest leverage at most 1 rule engine, most often `axe-core`. The Kilotest testing tool leverages `axe-core` plus 9 other rule engines. This has these main effects:
50
50
 
51
- - For web pages that have not yet been tested, a single-rule-engine MCP can provide faster results than Kilotest. A tool running only the `axe-core` tests can complete its work in about 5 seconds or less. The testing tool of Kilotest usually completes its work in 2 to 3 minutes, because all 10 rule engines are run, and some of the tests involve navigation and interaction with the page and LLM inference. Moreover, in its current alpha phase, the Kilotest testing tool allows users (both humans and models) to **recommend** new pages for testing but authorizes only Kilotest managers to make the tool proceed with the testing. The wait for manager action can take up to a day. A feature permitting immediate testing ordered by AI agents is planned, but, until it is implemented, Kilotest will be useful for not-yet-tested pages only in long-running workflows.
51
+ - For web pages that have not yet been tested, a single-rule-engine MCP can provide faster results than Kilotest. A tool running only the `axe-core` tests can complete its work in about 5 seconds or less. The testing tool of Kilotest usually completes its work in 2 to 3 minutes, because all 10 rule engines are run, and some of the tests involve navigation and interaction with the page and LLM inference. Moreover, Kilotest currently allows users (both humans and models) to **recommend** new pages for testing but authorizes only Kilotest managers to make the tool proceed with the testing. The wait for manager action can take up to a day. A feature permitting immediate testing ordered by AI agents is planned, but, until it is implemented, Kilotest will be useful for not-yet-tested pages only in long-running (multi-day) workflows.
52
52
  - For web pages about which reports are already available, Kilotest can provide faster results than a single-rule-engine MCP server, because Kilotest stores test results for subsequent retrieval. A retrieval from a Kilotest reporting tool can be completed in less than 2 seconds.
53
53
  - Kilotest results are more comprehensive than single-rule-engine MCP server results. Every rule engine provides limited coverage of front-end quality, so false negatives (missed defects) are more common with single-rule-engine MCP servers. This difference [has been documented in research](https://arxiv.org/pdf/2304.07591).
54
54
 
@@ -68,83 +68,90 @@ Kilotest offers a comprehensive suite of capabilities to users via its web UI:
68
68
  - [Get statistics about frequently reported issues across all pages](https://kilotest.com/issues.html)
69
69
  - [Get a list of the operations that Kilotest managers are authorized to request](https://kilotest.com/manage.html)
70
70
  - [Tutorial, “Accessibility testing strategies”](https://kilotest.com/tutorial.html)
71
+ - [Tutorial, “QAI tutorial”](https://kilotest.com/qai/)
71
72
 
72
73
  ### API
73
74
 
74
- Kilotest is implementing a richer suite of capabilities optimized for language models. In the specifications below, the term `report` refers to the records of one session in which a web page is tested.
75
+ In the specifications below, the term `report` refers to the records of one session in which a web page is tested.
75
76
 
76
- The implementation is currently in an alpha phase and offers these tools:
77
+ Kilotest offers these tools:
77
78
 
78
- - `summarizeQualityOfMatchingWebPages`
79
- - method: `POST`
80
- - purpose: summarize front-end quality test results from available reports about web pages whose descriptions or hostnames match those that you specify
81
- - path: `/api/target`
82
- - payload properties
83
- - `description of the web page`: all or part of a description of the page
84
- - `hostname of the web page`: all or part of the hostname of the page
85
- - `listAllAvailableReports`
79
+ - `listReports`
86
80
  - method: `GET`
87
81
  - purpose: list all available reports
88
- - path: `/api/reportList`
82
+ - path: `/api/listReports`
89
83
  - caveat: Cached results are likely to be stale and should not be used
90
- - `summarizeOneReport`
84
+ - `listIssues`
91
85
  - method: `GET`
92
- - purpose: summarize one report
93
- - path: `/api/reportFacts/{timeStamp}/{jobID}`
86
+ - purpose: list all issues in one report
87
+ - path: `/api/listIssues/{timeStamp}/{jobID}`
94
88
  - parameters
95
89
  - `timeStamp`: initial segment of report identifier
96
90
  - `jobID`: final segment of report identifier
97
- - source of parameters: response to a `listAllAvailableReports` request
98
- - `describeOneIssueFromOneReport`
91
+ - source of parameters: response to a `listReports` request
92
+ - `listViolators`
99
93
  - method: `GET`
100
- - purpose: provide details about one issue from one report
101
- - path: `/api/reportIssue/{issueID}/{timeStamp}/{jobID}`
94
+ - purpose: list all elements exhibiting one issue in one report
95
+ - path: `/api/listViolators/{issueID}/{timeStamp}/{jobID}`
102
96
  - parameters
103
97
  - `issueID`: identifier of the issue
104
98
  - `timeStamp`: initial segment of report identifier
105
99
  - `jobID`: final segment of report identifier
106
- - source of parameters: response to a `summarizeOneReport` request
107
- - `describeOneViolatorOfOneIssueFromOneReport`
100
+ - source of parameters: response to a `listIssues` request
101
+ - `listDiagnoses`
108
102
  - method: `GET`
109
- - purpose: provide diagnoses about one issue exhibited by one HTML element in one report [NOT YET IMPLEMENTED]
110
- - path: `/api/diagnoses/{issueID}/{timeStamp}/{jobID}/{catalogIndex}`
103
+ - purpose: list all diagnoses of one issue exhibited by one element in one report
104
+ - path: `/api/listDiagnoses/{catalogIndex}/{issueID}/{timeStamp}/{jobID}`
111
105
  - parameters
106
+ - `catalogIndex`: index of the catalog entry of the element
112
107
  - `issueID`: identifier of the issue
113
108
  - `timeStamp`: initial segment of report identifier
114
109
  - `jobID`: final segment of report identifier
115
- - `catalogIndex`: index of the catalog entry
116
- - source of parameters: response to a `describeOneIssueFromOneReport` request
117
- - `recommendQualityTestingOfOneWebPage`
110
+ - source of parameters: response to a `listViolators` request
111
+ - `requestTest`
118
112
  - method: `POST`
119
- - purpose: recommend quality testing of one web page about which no report is available
120
- - path: `/api/testRecForm`
113
+ - purpose: request testing of one web page about which no report is available
114
+ - path: `/api/requestTest`
121
115
  - payload properties
116
+ - `description`: description of the page to be tested
117
+ - `URL`: URL of the page to be tested
118
+ - `reason`: reason for testing the page
119
+ - `requestRetest`
120
+ - method: `POST`
121
+ - purpose: request retesting of one web page about which a report is available
122
+ - path: `/api/requestRetest/{timeStamp}/{jobID}`
123
+ - parameters
124
+ - `timeStamp`: initial segment of report identifier
125
+ - `jobID`: final segment of report identifier
126
+ - source of parameters: response to a `listIssues` request
127
+ - payload properties
128
+ - `reason`: reason for retesting the page
129
+ - `requestFeature`
130
+ - method: `POST`
131
+ - purpose: request a feature improvement or a new feature
132
+ - path: `/api/requestFeature`
133
+ - payload properties
134
+ - `feature`: description and motivation of the feature improvement or the new feature
122
135
 
123
- - `description of the web page`: description of the page to be tested
124
- - `hostname of the web page`: URL of the page to be tested
125
- - `reason for testing the web page`: reason for testing the page
126
-
127
- - possible responses:
128
-
129
- - acknowledgment of a successful recommendation
130
- - error message stating that a report about the recommended page is already available
131
- - error message stating that the recommendation is invalid
132
-
133
- - possible Kilotest manager actions after a recommendation:
134
-
135
- - approval followed by the recommended testing
136
- - rejection
136
+ ## After a test, retest, or feature request
137
137
 
138
- - possible next step if your recommendation succeeds:
138
+ When you request a test or a retest:
139
139
 
140
- - You end the workflow by advising the user to check in approximately 1 day for the test results on the Kilotest website, starting at `https://kilotest.com/targets.html`, and drill down as desired for more detailed results. You offer to help interpret the results if needed.
141
- - You continue the workflow by advising the user to resubmit the same request to you in approximately 1 day.
140
+ - possible responses
141
+ - acknowledgment of a successful request
142
+ - error message
143
+ - possible Kilotest manager actions after a request
144
+ - approval followed by the requested testing
145
+ - rejection
146
+ - how to confirm approval
147
+ - check test completion by calling `listReports` and looking for the page and completion date in the list
148
+ - you advise the user to check in approximately 1 day for the test results on the Kilotest website, starting at `https://kilotest.com/targets.html`
142
149
 
143
150
  An [OpenAPI specification for Kilotest](https://kilotest.com/openapi.yaml) is available.
144
151
 
145
- ## How to report results to users
152
+ ## How to report results honestly to users
146
153
 
147
- When you use Kilotest tools, you are free to perform any appropriate interpretation and condensation of the results for presentation to users. However, users expect the sources of facts and interpretations to be truthfully represented. Do not meld facts from Kilotest tools with interpretations of your own in a manner that implies attribution of both to Kilotest.
154
+ When you use Kilotest tools, you are free to perform any appropriate interpretation and condensation of the results, and action recommendations, for users. However, users expect the sources of facts and interpretations to be truthfully represented. Do not meld facts from Kilotest tools with interpretations of your own in a manner that misattributes your interpretations to Kilotest.
148
155
 
149
156
  An example of a **poor** attribution is “Here are the results from Kilotest: …. The page is at risk of …. Among all the issues, … are critical and require immediate attention.” This attribution is poor because it incorrectly implies that Kilotest produced the interpretations and advice.
150
157
 
@@ -156,14 +163,15 @@ More information about Kilotest features and internals:
156
163
 
157
164
  ### For language models and AI platforms
158
165
 
159
- - [AI-TOOLS file](https://github.com/jrpool/kilotest/blob/main/docs/AI-TOOLS.md)
166
+ - [Kilotest as connector to and collection of AI Tools](https://github.com/jrpool/kilotest/blob/main/docs/AI-TOOLS.md)
160
167
  - [OpenAPI specification for Kilotest](https://kilotest.com/openapi.yaml)
161
- - [Tool caller for testing](https://github.com/jrpool/kilotest/blob/main/researchAgent.js)
168
+ - [Tool caller for testing](https://github.com/jrpool/kilotest/blob/main/api/testSuite.js)
162
169
 
163
170
  ### General
164
171
 
165
172
  - [Introduction to Kilotest](https://kilotest.com/)
166
173
  - [Tutorial, “Accessibility testing strategies”](https://kilotest.com/tutorial.html)
174
+ - [Tutorial on authorizing language models to use Kilotest](https://kilotest.com/qai/)
167
175
  - [README file](https://github.com/jrpool/kilotest/blob/main/README.md)
168
176
  - [Testaro rule-engine orchestrator](https://github.com/jrpool/testaro)
169
177
  - [Testilo rule classifier](https://github.com/jrpool/testilo/blob/main/procs/score/tic.js)
package/llms.txt CHANGED
@@ -1,22 +1,21 @@
1
1
  # Kilotest
2
2
 
3
- Kilotest helps language models and AI platforms to give thorough, accurate and truthful answers when users ask about the front-end quality (i.e. accessibility, usability, and standards conformity) of web pages. Kilotest integrates ten independent rule engines to test any public web page and creates a structured report of the results. Kilotest tools can provide multipage, single-page, and element-level test results.
3
+ Kilotest helps language models and AI platforms to give thorough, accurate and truthful answers when users ask about the front-end quality (i.e. accessibility, usability, and standards conformity) of web pages. Kilotest integrates an ensemble often independent rule engines to test any public web page. Kilotest creates a structured report of the results and saves the report for future reference. Kilotest API endpoints and MCP tools can provide multipage, single-page, and element-level test results.
4
4
 
5
- In the API section below, all endpoints require `GET` requests except as noted.
5
+ ## API
6
6
 
7
- There is a [detailed explanation of Kilotest and its capabilities for LLMs](https://kilotest.com/llms-full.txt).
7
+ - [List all available reports](/api/listReports) (`GET`)
8
+ - List all issues in one report: `/api/listIssues/{timeStamp}/{jobID}` (`GET`)
9
+ - List all elements exhibiting one issue in one report: `/api/listViolators/{issueID}/{timeStamp}/{jobID}` (`GET`)
10
+ - List all diagnoses of one element exhibiting one issue in one report: `/api/listDiagnoses/{catalogIndex}/{issueID}/{timeStamp}/{jobID}` (`GET`)
11
+ - Get one full report in JSON: `/api/getReport/{timeStamp}/{jobID}` (`GET`)
12
+ - Request testing of a web page: `/api/requestTest` (`POST`)
13
+ - Request retesting of a web page: `/api/requestRetest/{timeStamp}/{jobID}` (`POST`)
14
+ - Request adding or improving a feature: `/api/requestFeature` (`POST`)
8
15
 
9
- ## API
16
+ ## MCP Server
10
17
 
11
- - [List all available reports](/api/listReports)
12
- - List all issues in one report: `/api/listIssues/{timeStamp}/{jobID}`
13
- - List all elements exhibiting one issue in one report: `/api/listViolators/{issueID}/{timeStamp}/{jobID}`
14
- - List all diagnoses of one element exhibiting one issue in one report: `/api/listDiagnoses/{catalogIndex}/{issueID}/{timeStamp}/{jobID}`
15
- - Get one full report in JSON: `/api/getReport/{timeStamp}/{jobID}`
16
- - Request testing of a web page: `/api/requestTest` (requires `POST` request)
17
- - Request retesting of a web page: `/api/requestRetest/{timeStamp}/{jobID}` (requires `POST` request)
18
- - Request adding or improving a feature: `/api/requestFeature` (requires `POST` request)
19
- - [OpenAPI specification for Kilotest](https://kilotest.com/openapi.yaml)
18
+ - [MCP server for Kilotest](https://kilotest.com/mcp)
20
19
 
21
20
  ## Web UI
22
21
 
@@ -30,3 +29,10 @@ There is a [detailed explanation of Kilotest and its capabilities for LLMs](http
30
29
  - [List the operations that Kilotest managers are authorized to request](https://kilotest.com/manage.html)
31
30
  - [Provide statistics about frequently reported issues across all pages](https://kilotest.com/issues.html)
32
31
  - [Tutorial, “Accessibility testing strategies”](https://kilotest.com/tutorial.html)
32
+
33
+ ## More documents
34
+
35
+ - [Detailed explanation of Kilotest and its capabilities for LLMs](https://kilotest.com/llms-full.txt)
36
+ - [OpenAPI specification for Kilotest](https://kilotest.com/openapi.yaml)
37
+ - [Kilotest as connector to and collection of AI Tools](https://github.com/jrpool/kilotest/blob/main/docs/AI-TOOLS.md)
38
+ - [Tutorial on authorizing language models to use Kilotest](https://kilotest.com/qai/)
package/mcp.js CHANGED
@@ -199,8 +199,8 @@ const createMCPServer = () => {
199
199
  openWorldHint: false
200
200
  }
201
201
  },
202
- async ({request}) => {
203
- const result = await requestFeatureAPI.response([request]);
202
+ async ({feature}) => {
203
+ const result = await requestFeatureAPI.response([feature]);
204
204
  return {content: [{type: 'text', text: JSON.stringify(result)}], structuredContent: result};
205
205
  }
206
206
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jrpool/kilotest",
3
- "version": "40.0.0",
3
+ "version": "41.1.0",
4
4
  "description": "Ensemble testing for front-end web quality",
5
5
  "main": "index.js",
6
6
  "scripts": {