@skill-harness/cli 0.25.1 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/decision.js +13 -4
- package/package.json +3 -3
package/dist/decision.js
CHANGED
|
@@ -1553,8 +1553,9 @@ function normalize2(payload) {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
function deadline(signal) {
|
|
1555
1555
|
return new Promise((_, reject) => {
|
|
1556
|
-
|
|
1557
|
-
signal.
|
|
1556
|
+
const fail = () => reject(signal.reason instanceof Error ? signal.reason : new Error("provider request timed out"));
|
|
1557
|
+
if (signal.aborted) return fail();
|
|
1558
|
+
signal.addEventListener("abort", fail, { once: true });
|
|
1558
1559
|
});
|
|
1559
1560
|
}
|
|
1560
1561
|
async function readBounded(response, timedOut) {
|
|
@@ -1590,7 +1591,7 @@ async function readBounded(response, timedOut) {
|
|
|
1590
1591
|
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
1591
1592
|
}
|
|
1592
1593
|
function failure(startedAt, error) {
|
|
1593
|
-
const publicErrors = ["invalid provider response", "provider request timed out", "provider response exceeded limit"];
|
|
1594
|
+
const publicErrors = ["invalid provider response", "provider request timed out", "provider response exceeded limit", "provider request cancelled"];
|
|
1594
1595
|
const message = error instanceof Error && publicErrors.includes(error.message) ? error.message : "provider request failed";
|
|
1595
1596
|
return {
|
|
1596
1597
|
status: "error",
|
|
@@ -1605,6 +1606,7 @@ async function callProvider(provider, model, example, options = {}) {
|
|
|
1605
1606
|
const startedAt = performance.now();
|
|
1606
1607
|
let controller;
|
|
1607
1608
|
let timer;
|
|
1609
|
+
let cancel;
|
|
1608
1610
|
try {
|
|
1609
1611
|
const request = makeRequest(provider, model, example);
|
|
1610
1612
|
requiredString(options.apiKey, "apiKey", 16 * 1024);
|
|
@@ -1615,8 +1617,14 @@ async function callProvider(provider, model, example, options = {}) {
|
|
|
1615
1617
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 3e5) {
|
|
1616
1618
|
throw new TypeError("invalid timeout");
|
|
1617
1619
|
}
|
|
1620
|
+
if (options.signal !== void 0 && !(options.signal instanceof AbortSignal)) {
|
|
1621
|
+
throw new TypeError("signal must be an AbortSignal");
|
|
1622
|
+
}
|
|
1623
|
+
if (options.signal?.aborted) throw new Error("provider request cancelled");
|
|
1618
1624
|
controller = new AbortController();
|
|
1619
|
-
|
|
1625
|
+
cancel = () => controller.abort(new Error("provider request cancelled"));
|
|
1626
|
+
options.signal?.addEventListener("abort", cancel, { once: true });
|
|
1627
|
+
timer = setTimeout(() => controller.abort(new Error("provider request timed out")), timeoutMs);
|
|
1620
1628
|
const timedOut = deadline(controller.signal);
|
|
1621
1629
|
const response = await Promise.race([
|
|
1622
1630
|
(options.fetchImpl ?? fetch)(request.url, {
|
|
@@ -1641,6 +1649,7 @@ async function callProvider(provider, model, example, options = {}) {
|
|
|
1641
1649
|
return failure(startedAt, error);
|
|
1642
1650
|
} finally {
|
|
1643
1651
|
if (timer !== void 0) clearTimeout(timer);
|
|
1652
|
+
if (cancel) options.signal?.removeEventListener("abort", cancel);
|
|
1644
1653
|
controller?.abort();
|
|
1645
1654
|
}
|
|
1646
1655
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skill-harness/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"description": "skill-harness CLI \u2014 run, grade, review, and lint agent-skill scenarios on the pi harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prepack": "node ../../scripts/release-pack.mjs --guard"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@skill-harness/core": "0.
|
|
48
|
-
"@skill-harness/adapters": "0.
|
|
47
|
+
"@skill-harness/core": "0.26.1",
|
|
48
|
+
"@skill-harness/adapters": "0.26.1"
|
|
49
49
|
}
|
|
50
50
|
}
|