@jrpool/kilotest 61.0.0 → 63.0.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/.devin/config.local.json +2 -1
- package/.markdownlint-cli2.jsonc +0 -1
- package/api/awaitTest.test.ts +9 -0
- package/api/getReport.test.ts +9 -0
- package/api/listDiagnoses.test.ts +9 -0
- package/api/listDiagnoses.ts +13 -3
- package/api/listIssues.test.ts +9 -0
- package/api/listIssues.ts +8 -4
- package/api/listPages.test.ts +9 -0
- package/api/listViolators.test.ts +9 -0
- package/api/listViolators.ts +5 -3
- package/api/orderNewTest.test.ts +9 -0
- package/api/orderRetest.test.ts +9 -0
- package/api/reportDisagreement.test.ts +217 -0
- package/api/reportDisagreement.ts +208 -0
- package/api/requestFeature.test.ts +9 -0
- package/api/requestNewTest.test.ts +9 -0
- package/api/requestRetest.test.ts +9 -0
- package/api/routes.test.ts +3 -2
- package/api/routes.ts +20 -1
- package/api/schemas.ts +48 -4
- package/api/util.test.ts +9 -0
- package/apiIntegration.test.ts +22 -0
- package/docs/SERVICE.md +6 -3
- package/env.example +5 -0
- package/index.test.ts +66 -0
- package/index.ts +30 -2
- package/lhm.plugin.json +455 -29
- package/llms-full.txt +13 -0
- package/llms.txt +1 -0
- package/mcp.test.ts +23 -4
- package/mcp.ts +24 -1
- package/openapi-3.0.yaml +195 -7
- package/openapi.yaml +191 -7
- package/package.json +1 -1
- package/server.json +1 -1
- package/test/setup.ts +4 -0
- package/web/tutorialAI/index.html +29 -1
package/index.ts
CHANGED
|
@@ -88,6 +88,7 @@ import {response as requestNewTestAPI} from './api/requestNewTest.ts';
|
|
|
88
88
|
import {response as orderNewTestAPI} from './api/orderNewTest.ts';
|
|
89
89
|
import {response as orderRetestAPI} from './api/orderRetest.ts';
|
|
90
90
|
import {response as awaitTestAPI} from './api/awaitTest.ts';
|
|
91
|
+
import {response as reportDisagreementAPI} from './api/reportDisagreement.ts';
|
|
91
92
|
|
|
92
93
|
// ENVIRONMENT
|
|
93
94
|
|
|
@@ -190,6 +191,7 @@ const apiRespond: {
|
|
|
190
191
|
orderNewTest: ApiResponder;
|
|
191
192
|
orderRetest: ApiResponder;
|
|
192
193
|
awaitTest: ApiResponder;
|
|
194
|
+
reportDisagreement: ApiResponder;
|
|
193
195
|
} = {
|
|
194
196
|
getReport: getReportAPI,
|
|
195
197
|
listDiagnoses: listDiagnosesAPI,
|
|
@@ -201,7 +203,8 @@ const apiRespond: {
|
|
|
201
203
|
requestNewTest: requestNewTestAPI,
|
|
202
204
|
orderNewTest: orderNewTestAPI,
|
|
203
205
|
orderRetest: orderRetestAPI,
|
|
204
|
-
awaitTest: awaitTestAPI
|
|
206
|
+
awaitTest: awaitTestAPI,
|
|
207
|
+
reportDisagreement: reportDisagreementAPI
|
|
205
208
|
};
|
|
206
209
|
|
|
207
210
|
// CONSTANTS
|
|
@@ -1396,6 +1399,16 @@ const handleRequest = async (request: IncomingMessage, response: ServerResponse)
|
|
|
1396
1399
|
setHeaders('application/json', null, 'ultra');
|
|
1397
1400
|
response.end(JSON.stringify(responseBody));
|
|
1398
1401
|
}
|
|
1402
|
+
// Otherwise, if the service is to receive a disagreement with a diagnosis:
|
|
1403
|
+
else if (segments[0] === 'reportDisagreement') {
|
|
1404
|
+
const {engineID, ruleID, reason} = postData as {engineID: string; ruleID: string; reason: string};
|
|
1405
|
+
// Get the response body.
|
|
1406
|
+
const responseBody = await apiRespond.reportDisagreement(segments.slice(1).concat(engineID, ruleID, reason));
|
|
1407
|
+
await recordPageMetric('apiOperations', 'reportDisagreement');
|
|
1408
|
+
// Send it.
|
|
1409
|
+
setHeaders('application/json', null, 'ultra');
|
|
1410
|
+
response.end(JSON.stringify(responseBody));
|
|
1411
|
+
}
|
|
1399
1412
|
// Otherwise, if the service is to order an immediate, automatically approved test:
|
|
1400
1413
|
else if (segments[0] === 'orderNewTest') {
|
|
1401
1414
|
const {description, URL, reason} = postData as {description: string; URL: string; reason: string};
|
|
@@ -1516,7 +1529,19 @@ export {serve};
|
|
|
1516
1529
|
|
|
1517
1530
|
// Starts the server using the configured protocol and credentials.
|
|
1518
1531
|
export const startServer = async () => {
|
|
1532
|
+
// Fail fast on missing required environment variables. THIS_KILOTEST_HOST is read raw
|
|
1533
|
+
// by getThisHost and interpolated into URLs in every response; KEY and CERT are
|
|
1534
|
+
// required only for HTTPS. Other env vars have documented defaults or designed
|
|
1535
|
+
// degradation (see env.example and docs/SERVICE.md) and are deliberately not required.
|
|
1536
|
+
const requiredEnvVars = ['THIS_KILOTEST_HOST'];
|
|
1519
1537
|
const startProtocol = process.env.PROTOCOL || 'http';
|
|
1538
|
+
if (startProtocol === 'https') {
|
|
1539
|
+
requiredEnvVars.push('KEY', 'CERT');
|
|
1540
|
+
}
|
|
1541
|
+
const missingEnvVars = requiredEnvVars.filter(name => !process.env[name]);
|
|
1542
|
+
if (missingEnvVars.length) {
|
|
1543
|
+
throw new Error(`Missing required environment variable(s): ${missingEnvVars.join(', ')}`);
|
|
1544
|
+
}
|
|
1520
1545
|
if (startProtocol === 'http') {
|
|
1521
1546
|
console.log('Starting HTTP server');
|
|
1522
1547
|
return serve(http, {});
|
|
@@ -1532,7 +1557,10 @@ export const startServer = async () => {
|
|
|
1532
1557
|
// Runs the server if the module was loaded directly (not required by a test). The starter is a parameter so tests can inject a spy, since ESM module exports cannot be monkey-patched.
|
|
1533
1558
|
export const runIfMain = (mainModule: unknown, currentModule: unknown, starter: () => Promise<unknown> = startServer) => {
|
|
1534
1559
|
if (mainModule === currentModule) {
|
|
1535
|
-
starter().catch(error =>
|
|
1560
|
+
starter().catch(error => {
|
|
1561
|
+
console.log(errorMessage(error));
|
|
1562
|
+
process.exitCode = 1;
|
|
1563
|
+
});
|
|
1536
1564
|
}
|
|
1537
1565
|
};
|
|
1538
1566
|
|